From cc312ec9ef93c1432262967d3261419596f5e570 Mon Sep 17 00:00:00 2001 From: Pritish Budhiraja Date: Mon, 2 Sep 2024 17:37:48 +0530 Subject: [PATCH 01/23] refactor: react suspense log added (#565) --- package-lock.json | 108 ++++++++++++++++++ package.json | 2 + src/Index.res | 2 +- src/PaymentElement.res | 47 ++++---- src/Payments/PaymentRequestButtonElement.res | 11 +- src/RenderPaymentMethods.res | 27 +++-- src/WalletElement.res | 5 +- src/orca-log-catcher/ErrorBoundary.res | 21 +++- src/orca-log-catcher/OrcaLogger.res | 11 +- .../ReusableReactSuspense.res | 8 ++ webpack.common.js | 13 ++- 11 files changed, 204 insertions(+), 51 deletions(-) create mode 100644 src/orca-log-catcher/ReusableReactSuspense.res diff --git a/package-lock.json b/package-lock.json index d9793b9ae..1cf7d6047 100644 --- a/package-lock.json +++ b/package-lock.json @@ -23,6 +23,7 @@ "devDependencies": { "@babel/core": "^7.25.2", "@babel/preset-env": "^7.25.3", + "@babel/preset-react": "^7.24.7", "@commitlint/cli": "^17.0.3", "@commitlint/config-conventional": "^17.0.3", "@semantic-release/changelog": "^6.0.3", @@ -32,6 +33,7 @@ "@semantic-release/release-notes-generator": "^14.0.1", "autoprefixer": "^10.4.8", "babel-loader": "^9.1.3", + "babel-plugin-add-react-displayname": "^0.0.5", "copy-webpack-plugin": "^11.0.0", "css-loader": "^6.7.1", "cz-conventional-changelog": "^3.3.0", @@ -739,6 +741,21 @@ "@babel/core": "^7.0.0-0" } }, + "node_modules/@babel/plugin-syntax-jsx": { + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.24.7.tgz", + "integrity": "sha512-6ddciUPe/mpMnOKv/U+RSd2vvVy+Yw/JfBB0ZHYjEZt9NLHmCUylNYlsbqCCS1Bffjlb0fCwC9Vqz+sBz6PsiQ==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.24.7" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, "node_modules/@babel/plugin-syntax-logical-assignment-operators": { "version": "7.10.4", "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-logical-assignment-operators/-/plugin-syntax-logical-assignment-operators-7.10.4.tgz", @@ -1472,6 +1489,71 @@ "@babel/core": "^7.0.0-0" } }, + "node_modules/@babel/plugin-transform-react-display-name": { + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-display-name/-/plugin-transform-react-display-name-7.24.7.tgz", + "integrity": "sha512-H/Snz9PFxKsS1JLI4dJLtnJgCJRoo0AUm3chP6NYr+9En1JMKloheEiLIhlp5MDVznWo+H3AAC1Mc8lmUEpsgg==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.24.7" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-react-jsx": { + "version": "7.25.2", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-jsx/-/plugin-transform-react-jsx-7.25.2.tgz", + "integrity": "sha512-KQsqEAVBpU82NM/B/N9j9WOdphom1SZH3R+2V7INrQUH+V9EBFwZsEJl8eBIVeQE62FxJCc70jzEZwqU7RcVqA==", + "dev": true, + "dependencies": { + "@babel/helper-annotate-as-pure": "^7.24.7", + "@babel/helper-module-imports": "^7.24.7", + "@babel/helper-plugin-utils": "^7.24.8", + "@babel/plugin-syntax-jsx": "^7.24.7", + "@babel/types": "^7.25.2" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-react-jsx-development": { + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-jsx-development/-/plugin-transform-react-jsx-development-7.24.7.tgz", + "integrity": "sha512-QG9EnzoGn+Qar7rxuW+ZOsbWOt56FvvI93xInqsZDC5fsekx1AlIO4KIJ5M+D0p0SqSH156EpmZyXq630B8OlQ==", + "dev": true, + "dependencies": { + "@babel/plugin-transform-react-jsx": "^7.24.7" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-react-pure-annotations": { + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-pure-annotations/-/plugin-transform-react-pure-annotations-7.24.7.tgz", + "integrity": "sha512-PLgBVk3fzbmEjBJ/u8kFzOqS9tUeDjiaWud/rRym/yjCo/M9cASPlnrd2ZmmZpQT40fOOrvR8jh+n8jikrOhNA==", + "dev": true, + "dependencies": { + "@babel/helper-annotate-as-pure": "^7.24.7", + "@babel/helper-plugin-utils": "^7.24.7" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, "node_modules/@babel/plugin-transform-regenerator": { "version": "7.24.7", "resolved": "https://registry.npmjs.org/@babel/plugin-transform-regenerator/-/plugin-transform-regenerator-7.24.7.tgz", @@ -1762,6 +1844,26 @@ "@babel/core": "^7.0.0-0 || ^8.0.0-0 <8.0.0" } }, + "node_modules/@babel/preset-react": { + "version": "7.24.7", + "resolved": "https://registry.npmjs.org/@babel/preset-react/-/preset-react-7.24.7.tgz", + "integrity": "sha512-AAH4lEkpmzFWrGVlHaxJB7RLH21uPQ9+He+eFLWHmF9IuFQVugz8eAsamaW0DXRrTfco5zj1wWtpdcXJUOfsag==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.24.7", + "@babel/helper-validator-option": "^7.24.7", + "@babel/plugin-transform-react-display-name": "^7.24.7", + "@babel/plugin-transform-react-jsx": "^7.24.7", + "@babel/plugin-transform-react-jsx-development": "^7.24.7", + "@babel/plugin-transform-react-pure-annotations": "^7.24.7" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, "node_modules/@babel/regjsgen": { "version": "0.8.0", "resolved": "https://registry.npmjs.org/@babel/regjsgen/-/regjsgen-0.8.0.tgz", @@ -4509,6 +4611,12 @@ "webpack": ">=5" } }, + "node_modules/babel-plugin-add-react-displayname": { + "version": "0.0.5", + "resolved": "https://registry.npmjs.org/babel-plugin-add-react-displayname/-/babel-plugin-add-react-displayname-0.0.5.tgz", + "integrity": "sha512-LY3+Y0XVDYcShHHorshrDbt4KFWL4bSeniCtl4SYZbask+Syngk1uMPCeN9+nSiZo6zX5s0RTq/J9Pnaaf/KHw==", + "dev": true + }, "node_modules/babel-plugin-polyfill-corejs2": { "version": "0.4.11", "resolved": "https://registry.npmjs.org/babel-plugin-polyfill-corejs2/-/babel-plugin-polyfill-corejs2-0.4.11.tgz", diff --git a/package.json b/package.json index ae16e824e..3aeea3c30 100644 --- a/package.json +++ b/package.json @@ -56,6 +56,7 @@ "devDependencies": { "@babel/core": "^7.25.2", "@babel/preset-env": "^7.25.3", + "@babel/preset-react": "^7.24.7", "@commitlint/cli": "^17.0.3", "@commitlint/config-conventional": "^17.0.3", "@semantic-release/changelog": "^6.0.3", @@ -65,6 +66,7 @@ "@semantic-release/release-notes-generator": "^14.0.1", "autoprefixer": "^10.4.8", "babel-loader": "^9.1.3", + "babel-plugin-add-react-displayname": "^0.0.5", "copy-webpack-plugin": "^11.0.0", "css-loader": "^6.7.1", "cz-conventional-changelog": "^3.3.0", diff --git a/src/Index.res b/src/Index.res index a254531ff..34fb585d3 100644 --- a/src/Index.res +++ b/src/Index.res @@ -9,7 +9,7 @@ let app = switch ReactDOM.querySelector("#app") {
- + diff --git a/src/PaymentElement.res b/src/PaymentElement.res index afa3e8b4a..8d8e045b0 100644 --- a/src/PaymentElement.res +++ b/src/PaymentElement.res @@ -284,47 +284,47 @@ let make = (~cardProps, ~expiryProps, ~cvcProps, ~paymentType: CardThemeType.mod } let checkoutEle = { - + {switch selectedOption->PaymentModeType.paymentMode { | Card => | Klarna => - + - + | ACHTransfer => - + - + | SepaTransfer => - + - + | BacsTransfer => - + - + | ACHBankDebit => - + - + | SepaBankDebit => - + - + | BacsBankDebit => - + - + | BanContactCard => | BecsBankDebit => - + - + | Boleto => - + - + | ApplePay => switch applePayToken { | ApplePayTokenOptional(optToken) => @@ -350,9 +350,9 @@ let make = (~cardProps, ~expiryProps, ~cvcProps, ~paymentType: CardThemeType.mod }} | _ => - + - + }} } @@ -402,7 +402,10 @@ let make = (~cardProps, ~expiryProps, ~cvcProps, ~paymentType: CardThemeType.mod condition={(paymentOptions->Array.length > 0 || walletOptions->Array.length > 0) && showFields}>
- + { {walletOptions ->Array.mapWithIndex((item, i) => { Int.toString}-request-button`}> - } key={i->Int.toString}> + level={ErrorBoundary.RequestButton} + key={`${item}-${i->Int.toString}-request-button`} + componentName="PaymentRequestButtonElement"> + } + componentName="PaymentRequestButtonElement" + key={i->Int.toString}> {switch clientSecret { | Some(_) => switch item->paymentMode { @@ -123,7 +128,7 @@ let make = (~sessions, ~walletOptions, ~paymentType) => { } | None => React.null }} - + }) ->React.array} diff --git a/src/RenderPaymentMethods.res b/src/RenderPaymentMethods.res index 8f0ab28d1..d2def612a 100644 --- a/src/RenderPaymentMethods.res +++ b/src/RenderPaymentMethods.res @@ -72,28 +72,30 @@ let make = (
{switch paymentType { | Card => - + - }> + } + componentName="SingleLineCardPaymentLazy"> - + | GooglePayElement | PayPalElement | ApplePayElement | KlarnaElement | ExpressCheckoutElement | Payment => - + {paymentType->Utils.getIsWalletElementPaymentType ? : } - }> + } + componentName="PaymentElementRendererLazy"> - + | CardNumberElement => | PaymentMethodsManagement => - + - }> + } + componentName="PaymentManagementLazy"> - + | PaymentMethodCollectElement | NONE => React.null }} diff --git a/src/WalletElement.res b/src/WalletElement.res index 897286d7e..27fb89e34 100644 --- a/src/WalletElement.res +++ b/src/WalletElement.res @@ -33,7 +33,10 @@ let make = (~paymentType) => { Array.length > 0}>
- +
diff --git a/src/orca-log-catcher/ErrorBoundary.res b/src/orca-log-catcher/ErrorBoundary.res index b05080046..4f95da757 100644 --- a/src/orca-log-catcher/ErrorBoundary.res +++ b/src/orca-log-catcher/ErrorBoundary.res @@ -123,7 +123,7 @@ module ErrorTextAndImage = { module ErrorCard = { @react.component - let make = (~error: Sentry.ErrorBoundary.fallbackArg, ~level) => { + let make = (~error: Sentry.ErrorBoundary.fallbackArg, ~level, ~componentName) => { let beaconApiCall = data => { if data->Array.length > 0 { let logData = data->Array.map(OrcaLogger.logFileToObj)->JSON.Encode.array->JSON.stringify @@ -135,13 +135,20 @@ module ErrorCard = { let loggingLevel = GlobalVars.loggingLevelStr let enableLogging = GlobalVars.enableLogging if enableLogging && ["DEBUG", "INFO", "WARN", "ERROR"]->Array.includes(loggingLevel) { + let errorDict = + error + ->Identity.anyTypeToJson + ->Utils.getDictFromJson + + errorDict->Dict.set("componentName", componentName->JSON.Encode.string) + let errorLog: OrcaLogger.logFile = { logType: ERROR, timestamp: Date.now()->Float.toString, sessionId: "", source: "orca-elements", version: GlobalVars.repoVersion, - value: error->Identity.anyTypeToJson->JSON.stringify, + value: errorDict->JSON.Encode.object->JSON.stringify, internalMetadata: "", category: USER_ERROR, paymentId: "", @@ -200,10 +207,12 @@ module ErrorCard = { } } -let defaultFallback = (e, level) => { - +let defaultFallback = (e, level, componentName) => { + } @react.component -let make = (~children, ~renderFallback=defaultFallback, ~level=PaymentMethod) => { - renderFallback(e, level)}> children +let make = (~children, ~renderFallback=defaultFallback, ~level=PaymentMethod, ~componentName) => { + renderFallback(e, level, componentName)}> + children + } diff --git a/src/orca-log-catcher/OrcaLogger.res b/src/orca-log-catcher/OrcaLogger.res index c73c14a04..fa0ca071b 100644 --- a/src/orca-log-catcher/OrcaLogger.res +++ b/src/orca-log-catcher/OrcaLogger.res @@ -539,14 +539,17 @@ let make = ( let counter = eventName->calculateAndUpdateCounterHook if GlobalVars.enableLogging && counter <= maxLogsPushedPerEventName { switch loggingLevel { - | DEBUG => log->Array.push(mainLogFile, _)->ignore + | DEBUG => log->(Array.push(mainLogFile, _))->ignore | INFO => [INFO, WARNING, ERROR]->Array.includes(log.logType) - ? log->Array.push(mainLogFile, _)->ignore + ? log->(Array.push(mainLogFile, _))->ignore : () | WARNING => - [WARNING, ERROR]->Array.includes(log.logType) ? log->Array.push(mainLogFile, _)->ignore : () - | ERROR => [ERROR]->Array.includes(log.logType) ? log->Array.push(mainLogFile, _)->ignore : () + [WARNING, ERROR]->Array.includes(log.logType) + ? log->(Array.push(mainLogFile, _))->ignore + : () + | ERROR => + [ERROR]->Array.includes(log.logType) ? log->(Array.push(mainLogFile, _))->ignore : () | SILENT => () } } diff --git a/src/orca-log-catcher/ReusableReactSuspense.res b/src/orca-log-catcher/ReusableReactSuspense.res new file mode 100644 index 000000000..8827d9218 --- /dev/null +++ b/src/orca-log-catcher/ReusableReactSuspense.res @@ -0,0 +1,8 @@ +@react.component +let make = (~children, ~loaderComponent, ~componentName) => { + Console.log2("-- componentName -- ", componentName) + + + {children} + +} diff --git a/webpack.common.js b/webpack.common.js index 9ab14dfbc..a2b8c40ff 100644 --- a/webpack.common.js +++ b/webpack.common.js @@ -8,6 +8,7 @@ const HtmlWebpackPlugin = require("html-webpack-plugin"); const TerserPlugin = require("terser-webpack-plugin"); const { BundleAnalyzerPlugin } = require("webpack-bundle-analyzer"); const { sentryWebpackPlugin } = require("@sentry/webpack-plugin"); +const AddReactDisplayNamePlugin = require("babel-plugin-add-react-displayname"); const getEnvVariable = (variable, defaultValue) => process.env[variable] ?? defaultValue; @@ -138,6 +139,10 @@ module.exports = (publicPath = "auto") => { compress: { drop_console: false, }, + mangle: { + keep_fnames: true, // Prevent function names from being mangled + keep_classnames: true, // Prevent class names from being mangled + }, }, }), ], @@ -161,17 +166,21 @@ module.exports = (publicPath = "auto") => { ], }, { - test: /\.js$/, + test: /\.jsx?$/, // Matches both .js and .jsx files exclude: /node_modules/, use: { loader: "babel-loader", options: { - presets: ["@babel/preset-env"], + presets: ["@babel/preset-env", "@babel/preset-react"], + plugins: [AddReactDisplayNamePlugin], }, }, }, ], }, entry: entries, + resolve: { + extensions: [".js", ".jsx"], + }, }; }; From 0b8c9cd72f792f039d2b146e9e10c87884f921a4 Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Mon, 2 Sep 2024 12:09:16 +0000 Subject: [PATCH 02/23] chore(release): 0.84.7 [skip ci] ## [0.84.7](https://github.com/juspay/hyperswitch-web/compare/v0.84.6...v0.84.7) (2024-09-02) --- 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 1c41e4c69..40dd68040 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,5 @@ +## [0.84.7](https://github.com/juspay/hyperswitch-web/compare/v0.84.6...v0.84.7) (2024-09-02) + ## [0.84.6](https://github.com/juspay/hyperswitch-web/compare/v0.84.5...v0.84.6) (2024-08-30) diff --git a/package-lock.json b/package-lock.json index 1cf7d6047..9e5ba7892 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "orca-payment-page", - "version": "0.84.6", + "version": "0.84.7", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "orca-payment-page", - "version": "0.84.6", + "version": "0.84.7", "hasInstallScript": true, "dependencies": { "@glennsl/rescript-fetch": "^0.2.0", diff --git a/package.json b/package.json index 3aeea3c30..b2474f79a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "orca-payment-page", - "version": "0.84.6", + "version": "0.84.7", "main": "index.js", "private": true, "dependencies": { From a251de52d70b0389bc5b0e789bcc1982cf343344 Mon Sep 17 00:00:00 2001 From: ArushKapoorJuspay <121166031+ArushKapoorJuspay@users.noreply.github.com> Date: Tue, 3 Sep 2024 05:26:50 +0530 Subject: [PATCH 03/23] fix: added customization for padding inside accordion item rule (#595) --- src/BrutalTheme.res | 1 + src/CharcoalTheme.res | 1 + src/Components/Accordion.res | 1 - src/Components/AccordionContainer.res | 1 - src/DefaultTheme.res | 1 + src/MidnightTheme.res | 1 + src/SoftTheme.res | 1 + 7 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/BrutalTheme.res b/src/BrutalTheme.res index 7bb4125da..ceb18a16e 100644 --- a/src/BrutalTheme.res +++ b/src/BrutalTheme.res @@ -138,6 +138,7 @@ let brutalRules = (theme: CardThemeType.themeClass) => "color": theme.colorBackgroundText, "transition": "height 1s ease", "borderColor": `#000000 !important`, + "padding": "20px", }, ".AccordionMore": { "backgroundColor": theme.colorBackground, diff --git a/src/CharcoalTheme.res b/src/CharcoalTheme.res index 8c8da2f64..6709840f7 100644 --- a/src/CharcoalTheme.res +++ b/src/CharcoalTheme.res @@ -137,6 +137,7 @@ let charcoalRules = theme => "backgroundColor": theme.colorBackground, "color": theme.colorTextSecondary, "transition": "height 1s ease", + "padding": "20px", }, ".AccordionMore": { "backgroundColor": theme.colorBackground, diff --git a/src/Components/Accordion.res b/src/Components/Accordion.res index b9f540c64..5d6250064 100644 --- a/src/Components/Accordion.res +++ b/src/Components/Accordion.res @@ -39,7 +39,6 @@ let make = ( style={ minHeight: "60px", width: "-webkit-fill-available", - padding: "20px", cursor: "pointer", marginBottom: layoutClass.spacedAccordionItems ? themeObj.spacingAccordionItem : "", border: `1px solid ${themeObj.borderColor}`, diff --git a/src/Components/AccordionContainer.res b/src/Components/AccordionContainer.res index 9f99ecb2e..56f4b2d3f 100644 --- a/src/Components/AccordionContainer.res +++ b/src/Components/AccordionContainer.res @@ -34,7 +34,6 @@ module Loader = { }, borderTopStyle: {i == 0 && !layoutClass.spacedAccordionItems ? "hidden" : "solid"}, width: "100%", - paddingLeft: "25px", marginBottom: layoutClass.spacedAccordionItems ? themeObj.spacingAccordionItem : "", cursor: "pointer", }> diff --git a/src/DefaultTheme.res b/src/DefaultTheme.res index 51e414300..738ed839e 100644 --- a/src/DefaultTheme.res +++ b/src/DefaultTheme.res @@ -147,6 +147,7 @@ let defaultRules = theme => "color": theme.colorTextSecondary, "transition": "height 1s ease", "boxShadow": "0px 1px 1px rgb(0 0 0 / 3%), 0px 3px 6px rgb(0 0 0 / 2%)", + "padding": "20px", }, ".AccordionMore": { "backgroundColor": theme.colorBackground, diff --git a/src/MidnightTheme.res b/src/MidnightTheme.res index eced1032a..49b194977 100644 --- a/src/MidnightTheme.res +++ b/src/MidnightTheme.res @@ -154,6 +154,7 @@ let midnightRules = theme => "transition": "height 1s ease", "color": "#e0e0e0", "boxShadow": "0px 2px 4px rgb(0 0 0 / 50%), 0px 1px 6px rgb(0 0 0 / 25%)", + "padding": "20px", }, ".AccordionItem:hover": { "color": theme.colorTextSecondary, diff --git a/src/SoftTheme.res b/src/SoftTheme.res index 41b28ae98..4177b13ba 100644 --- a/src/SoftTheme.res +++ b/src/SoftTheme.res @@ -136,6 +136,7 @@ let softRules = theme => "color": theme.colorTextSecondary, "transition": "background .15s ease, border .15s ease, box-shadow .15s ease", "boxShadow": `4px 4px 5px #353637, -4px -4px 5px #434445`, + "padding": "20px", }, ".AccordionItem--selected": { "color": theme.colorPrimary, From ca2a9432b496bd879c0fee0c783c149d33b5ab1b Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Mon, 2 Sep 2024 23:58:20 +0000 Subject: [PATCH 04/23] chore(release): 0.84.8 [skip ci] ## [0.84.8](https://github.com/juspay/hyperswitch-web/compare/v0.84.7...v0.84.8) (2024-09-02) ### Bug Fixes * added customization for padding inside accordion item rule ([#595](https://github.com/juspay/hyperswitch-web/issues/595)) ([a251de5](https://github.com/juspay/hyperswitch-web/commit/a251de52d70b0389bc5b0e789bcc1982cf343344)) --- 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 40dd68040..68434fb3f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## [0.84.8](https://github.com/juspay/hyperswitch-web/compare/v0.84.7...v0.84.8) (2024-09-02) + + +### Bug Fixes + +* added customization for padding inside accordion item rule ([#595](https://github.com/juspay/hyperswitch-web/issues/595)) ([a251de5](https://github.com/juspay/hyperswitch-web/commit/a251de52d70b0389bc5b0e789bcc1982cf343344)) + ## [0.84.7](https://github.com/juspay/hyperswitch-web/compare/v0.84.6...v0.84.7) (2024-09-02) ## [0.84.6](https://github.com/juspay/hyperswitch-web/compare/v0.84.5...v0.84.6) (2024-08-30) diff --git a/package-lock.json b/package-lock.json index 9e5ba7892..5d0a1e17d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "orca-payment-page", - "version": "0.84.7", + "version": "0.84.8", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "orca-payment-page", - "version": "0.84.7", + "version": "0.84.8", "hasInstallScript": true, "dependencies": { "@glennsl/rescript-fetch": "^0.2.0", diff --git a/package.json b/package.json index b2474f79a..c1499718a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "orca-payment-page", - "version": "0.84.7", + "version": "0.84.8", "main": "index.js", "private": true, "dependencies": { From bf0456234bb6746a4e8c44fd7f9cd364c914e665 Mon Sep 17 00:00:00 2001 From: ArushKapoorJuspay <121166031+ArushKapoorJuspay@users.noreply.github.com> Date: Tue, 3 Sep 2024 11:09:27 +0530 Subject: [PATCH 05/23] fix: added loader for netecetera when openurl_if_required is sent post otp submission (#589) --- src/orca-loader/Elements.res | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/orca-loader/Elements.res b/src/orca-loader/Elements.res index 8535a5180..96bb201cd 100644 --- a/src/orca-loader/Elements.res +++ b/src/orca-loader/Elements.res @@ -679,6 +679,11 @@ let make = ( switch eventDataObject->getOptionalJsonFromJson("openurl_if_required") { | Some(val) => + messageParentWindow([ + ("fullscreen", true->JSON.Encode.bool), + ("param", "paymentloader"->JSON.Encode.string), + ("iframeId", selectorString->JSON.Encode.string), + ]) if redirect.contents === "always" { Window.Location.replace(val->JSON.Decode.string->Option.getOr("")) resolve(JSON.Encode.null) From 483eb393d075006b9e309d5f5914e5a027ea151a Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Tue, 3 Sep 2024 05:40:55 +0000 Subject: [PATCH 06/23] chore(release): 0.84.9 [skip ci] ## [0.84.9](https://github.com/juspay/hyperswitch-web/compare/v0.84.8...v0.84.9) (2024-09-03) ### Bug Fixes * added loader for netecetera when openurl_if_required is sent post otp submission ([#589](https://github.com/juspay/hyperswitch-web/issues/589)) ([bf04562](https://github.com/juspay/hyperswitch-web/commit/bf0456234bb6746a4e8c44fd7f9cd364c914e665)) --- 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 68434fb3f..7528d527d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## [0.84.9](https://github.com/juspay/hyperswitch-web/compare/v0.84.8...v0.84.9) (2024-09-03) + + +### Bug Fixes + +* added loader for netecetera when openurl_if_required is sent post otp submission ([#589](https://github.com/juspay/hyperswitch-web/issues/589)) ([bf04562](https://github.com/juspay/hyperswitch-web/commit/bf0456234bb6746a4e8c44fd7f9cd364c914e665)) + ## [0.84.8](https://github.com/juspay/hyperswitch-web/compare/v0.84.7...v0.84.8) (2024-09-02) diff --git a/package-lock.json b/package-lock.json index 5d0a1e17d..0812e6668 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "orca-payment-page", - "version": "0.84.8", + "version": "0.84.9", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "orca-payment-page", - "version": "0.84.8", + "version": "0.84.9", "hasInstallScript": true, "dependencies": { "@glennsl/rescript-fetch": "^0.2.0", diff --git a/package.json b/package.json index c1499718a..93e651e02 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "orca-payment-page", - "version": "0.84.8", + "version": "0.84.9", "main": "index.js", "private": true, "dependencies": { From 55b6a9f61068a105dc2b948078571ebd755831a9 Mon Sep 17 00:00:00 2001 From: sakksham7 <130480324+sakksham7@users.noreply.github.com> Date: Tue, 3 Sep 2024 12:02:57 +0530 Subject: [PATCH 07/23] fix: zsl fix (#596) Co-authored-by: Saksham Sharma --- public/icons/orca.svg | 218 ++++++++++++++++++++------ src/Payments/PaymentMethodsRecord.res | 8 +- 2 files changed, 170 insertions(+), 56 deletions(-) diff --git a/public/icons/orca.svg b/public/icons/orca.svg index 3edb66648..c8b5abeb1 100644 --- a/public/icons/orca.svg +++ b/public/icons/orca.svg @@ -1704,11 +1704,7 @@ License) /> - + + + + + + + + + + + + - - + + - - - + + + - - - - + + + + @@ -2356,42 +2414,42 @@ License) + stroke="#333333" + stroke-width="1.5" + stroke-linecap="round" + stroke-linejoin="round" + /> + stroke="#333333" + stroke-width="1.5" + stroke-miterlimit="10" + /> - + stroke="#333333" + stroke-width="1.5" + stroke-miterlimit="10" + /> + + stroke="#333333" + stroke-width="1.5" + /> - - + - + + fill="#003087" + /> + d="M112.57 391.19c20.056 0 38.928-7.808 53.12-22l76.693-76.692c5.385-5.404 14.765-5.384 20.15 0l76.989 76.989c14.191 14.172 33.045 21.98 53.12 21.98h15.098l-97.138 97.139c-30.326 30.344-79.505 30.344-109.85 0l-97.415-97.416h9.232zm280.068-271.294c-20.056 0-38.929 7.809-53.12 22l-76.97 76.99c-5.551 5.53-14.6 5.568-20.15-.02l-76.711-76.693c-14.192-14.191-33.046-21.999-53.12-21.999h-9.234l97.416-97.416c30.344-30.344 79.523-30.344 109.867 0l97.138 97.138h-15.116z" + /> + d="M22.758 200.753l58.024-58.024h31.787c13.84 0 27.384 5.605 37.172 15.394l76.694 76.693c7.178 7.179 16.596 10.768 26.033 10.768 9.417 0 18.854-3.59 26.014-10.75l76.989-76.99c9.787-9.787 23.331-15.393 37.171-15.393h37.654l58.3 58.302c30.343 30.344 30.343 79.523 0 109.867l-58.3 58.303H392.64c-13.84 0-27.384-5.605-37.171-15.394l-76.97-76.99c-13.914-13.894-38.172-13.894-52.066.02l-76.694 76.674c-9.788 9.788-23.332 15.413-37.172 15.413H80.782L22.758 310.62c-30.344-30.345-30.344-79.524 0-109.868" + /> + d="m444.17 32h-373.89c-20.43 0-38.28 14.7-38.28 34.89v374.71c0 20.31 17.85 38.4 38.28 38.4h373.78c20.54 0 35.94-18.2 35.94-38.39v-374.72c.12-20.19-15.4-34.89-35.83-34.89zm-166.17 355h-103.68l-41.57-248.56 90.75-8.62 22 176.87c20.53-33.45 45.88-86 45.88-121.87 0-19.62-3.36-33-8.61-44l82.63-16.72c9.56 15.78 13.86 32 13.86 52.57-.01 65.5-55.92 150.59-101.26 210.33z" + /> - - - - + + + + - + - \ No newline at end of file + diff --git a/src/Payments/PaymentMethodsRecord.res b/src/Payments/PaymentMethodsRecord.res index ccbaefeae..f72b3b3f0 100644 --- a/src/Payments/PaymentMethodsRecord.res +++ b/src/Payments/PaymentMethodsRecord.res @@ -123,9 +123,7 @@ let defaultPaymentMethodFields = { miniIcon: None, } -let icon = (~size=22, ~width=size, name) => { - -} +let icon = (~size=22, ~width=size, name) => let paymentMethodsFields = [ { @@ -530,8 +528,8 @@ let paymentMethodsFields = [ { paymentMethodName: "local_bank_transfer_transfer", fields: [InfoElement], - icon: Some(icon("bank", ~size=19)), - displayName: "Local Bank Transfer", + icon: Some(icon("union-pay", ~size=19, ~width=30)), + displayName: "Union Pay", miniIcon: None, }, { From c617b4a9674fb0cb8db00c8f0debe36a4f5dfc1e Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Tue, 3 Sep 2024 06:34:32 +0000 Subject: [PATCH 08/23] chore(release): 0.84.10 [skip ci] ## [0.84.10](https://github.com/juspay/hyperswitch-web/compare/v0.84.9...v0.84.10) (2024-09-03) ### Bug Fixes * zsl fix ([#596](https://github.com/juspay/hyperswitch-web/issues/596)) ([55b6a9f](https://github.com/juspay/hyperswitch-web/commit/55b6a9f61068a105dc2b948078571ebd755831a9)) --- 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 7528d527d..b7b7743ca 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## [0.84.10](https://github.com/juspay/hyperswitch-web/compare/v0.84.9...v0.84.10) (2024-09-03) + + +### Bug Fixes + +* zsl fix ([#596](https://github.com/juspay/hyperswitch-web/issues/596)) ([55b6a9f](https://github.com/juspay/hyperswitch-web/commit/55b6a9f61068a105dc2b948078571ebd755831a9)) + ## [0.84.9](https://github.com/juspay/hyperswitch-web/compare/v0.84.8...v0.84.9) (2024-09-03) diff --git a/package-lock.json b/package-lock.json index 0812e6668..8f3175c8e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "orca-payment-page", - "version": "0.84.9", + "version": "0.84.10", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "orca-payment-page", - "version": "0.84.9", + "version": "0.84.10", "hasInstallScript": true, "dependencies": { "@glennsl/rescript-fetch": "^0.2.0", diff --git a/package.json b/package.json index 93e651e02..9507bd4c1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "orca-payment-page", - "version": "0.84.9", + "version": "0.84.10", "main": "index.js", "private": true, "dependencies": { From 638ccfca91625db8cb14ee74593b6fb09d1fe3fc Mon Sep 17 00:00:00 2001 From: ArushKapoorJuspay <121166031+ArushKapoorJuspay@users.noreply.github.com> Date: Tue, 3 Sep 2024 15:45:11 +0530 Subject: [PATCH 09/23] fix: added support to send post messages to parent iframe (#594) --- src/Hooks/UtilityHooks.res | 20 ++++++++++++++++++++ src/ThreeDSAuth.res | 4 ++++ 2 files changed, 24 insertions(+) diff --git a/src/Hooks/UtilityHooks.res b/src/Hooks/UtilityHooks.res index 09a4ef605..ed06c76c5 100644 --- a/src/Hooks/UtilityHooks.res +++ b/src/Hooks/UtilityHooks.res @@ -41,3 +41,23 @@ let useIsCustomerAcceptanceRequired = ( displaySavedPaymentMethodsCheckbox, )) } + +let useSendEventsToParent = eventsToSendToParent => { + React.useEffect0(() => { + let handle = (ev: Window.event) => { + let eventDataObject = ev.data->Identity.anyTypeToJson + let eventsDict = eventDataObject->Utils.getDictFromJson + + let events = eventsDict->Dict.keysToArray + + let shouldSendToParent = + events->Array.some(event => eventsToSendToParent->Array.includes(event)) + + if shouldSendToParent { + Utils.messageParentWindow(eventsDict->Dict.toArray) + } + } + Window.addEventListener("message", handle) + Some(() => {Window.removeEventListener("message", handle)}) + }) +} diff --git a/src/ThreeDSAuth.res b/src/ThreeDSAuth.res index e836219b0..5d5f9a6f6 100644 --- a/src/ThreeDSAuth.res +++ b/src/ThreeDSAuth.res @@ -21,6 +21,10 @@ let make = () => { } } + let eventsToSendToParent = ["confirmParams", "poll_status", "openurl_if_required"] + + eventsToSendToParent->UtilityHooks.useSendEventsToParent + React.useEffect0(() => { messageParentWindow([("iframeMountedCallback", true->JSON.Encode.bool)]) let handle = (ev: Window.event) => { From ac73a1714c329712e0a3d92d20f000fcac2cc581 Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Tue, 3 Sep 2024 10:16:48 +0000 Subject: [PATCH 10/23] chore(release): 0.84.11 [skip ci] ## [0.84.11](https://github.com/juspay/hyperswitch-web/compare/v0.84.10...v0.84.11) (2024-09-03) ### Bug Fixes * added support to send post messages to parent iframe ([#594](https://github.com/juspay/hyperswitch-web/issues/594)) ([638ccfc](https://github.com/juspay/hyperswitch-web/commit/638ccfca91625db8cb14ee74593b6fb09d1fe3fc)) --- 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 b7b7743ca..722a151b8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## [0.84.11](https://github.com/juspay/hyperswitch-web/compare/v0.84.10...v0.84.11) (2024-09-03) + + +### Bug Fixes + +* added support to send post messages to parent iframe ([#594](https://github.com/juspay/hyperswitch-web/issues/594)) ([638ccfc](https://github.com/juspay/hyperswitch-web/commit/638ccfca91625db8cb14ee74593b6fb09d1fe3fc)) + ## [0.84.10](https://github.com/juspay/hyperswitch-web/compare/v0.84.9...v0.84.10) (2024-09-03) diff --git a/package-lock.json b/package-lock.json index 8f3175c8e..2b0b5678b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "orca-payment-page", - "version": "0.84.10", + "version": "0.84.11", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "orca-payment-page", - "version": "0.84.10", + "version": "0.84.11", "hasInstallScript": true, "dependencies": { "@glennsl/rescript-fetch": "^0.2.0", diff --git a/package.json b/package.json index 9507bd4c1..21ed7fa22 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "orca-payment-page", - "version": "0.84.10", + "version": "0.84.11", "main": "index.js", "private": true, "dependencies": { From d0e7f8cc3fc1a6b5bbad866a7220c19672adb364 Mon Sep 17 00:00:00 2001 From: Sanskar Atrey Date: Tue, 3 Sep 2024 16:16:11 +0530 Subject: [PATCH 11/23] refactor: payments code refactor (#597) --- src/Payment.res | 42 ++++++---------------------------- src/Utilities/PaymentUtils.res | 35 ++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 35 deletions(-) diff --git a/src/Payment.res b/src/Payment.res index 5f51a1429..8ead3bf2a 100644 --- a/src/Payment.res +++ b/src/Payment.res @@ -55,42 +55,11 @@ let make = (~paymentMode, ~integrateError, ~logger) => { }, (cardNumber, cardScheme, showFields)) let supportedCardBrands = React.useMemo(() => { - let cardPaymentMethod = - paymentMethodListValue.payment_methods->Array.find(ele => ele.payment_method === "card") - - switch cardPaymentMethod { - | Some(cardPaymentMethod) => - let cardNetworks = cardPaymentMethod.payment_method_types->Array.map(ele => ele.card_networks) - let cardNetworkNames = - cardNetworks->Array.map(ele => - ele->Array.map( - val => val.card_network->CardUtils.getCardStringFromType->String.toLowerCase, - ) - ) - Some( - cardNetworkNames - ->Array.reduce([], (acc, ele) => acc->Array.concat(ele)) - ->Utils.getUniqueArray, - ) - | None => None - } + paymentMethodListValue->PaymentUtils.getSupportedCardBrands }, [paymentMethodListValue]) - let checkIsCardSupported = cardNumber => { - let cardBrand = cardNumber->CardUtils.getCardBrand - let clearValue = cardNumber->clearSpaces - if cardValid(clearValue, cardBrand) { - switch supportedCardBrands { - | Some(brands) => Some(brands->Array.includes(cardBrand->String.toLowerCase)) - | None => Some(true) - } - } else { - None - } - } - React.useEffect(() => { - setIsCardSupported(_ => checkIsCardSupported(cardNumber)) + setIsCardSupported(_ => PaymentUtils.checkIsCardSupported(cardNumber, supportedCardBrands)) None }, (supportedCardBrands, cardNumber)) @@ -116,7 +85,10 @@ let make = (~paymentMode, ~integrateError, ~logger) => { let card = val->formatCardNumber(cardType) let clearValue = card->clearSpaces setCardValid(clearValue, setIsCardValid) - if cardValid(clearValue, cardBrand) && checkIsCardSupported(clearValue)->Option.getOr(false) { + if ( + cardValid(clearValue, cardBrand) && + PaymentUtils.checkIsCardSupported(clearValue, supportedCardBrands)->Option.getOr(false) + ) { handleInputFocus(~currentRef=cardRef, ~destinationRef=expiryRef) } if card->String.length > 6 && cardNumber->pincodeVisibility { @@ -173,7 +145,7 @@ let make = (~paymentMode, ~integrateError, ~logger) => { let handleCardBlur = ev => { let cardNumber = ReactEvent.Focus.target(ev)["value"] if cardNumberInRange(cardNumber)->Array.includes(true) && calculateLuhn(cardNumber) { - setIsCardValid(_ => checkIsCardSupported(cardNumber)) + setIsCardValid(_ => PaymentUtils.checkIsCardSupported(cardNumber, supportedCardBrands)) } else if cardNumber->String.length == 0 { setIsCardValid(_ => None) } else { diff --git a/src/Utilities/PaymentUtils.res b/src/Utilities/PaymentUtils.res index 735ad4d57..92a9d34c1 100644 --- a/src/Utilities/PaymentUtils.res +++ b/src/Utilities/PaymentUtils.res @@ -472,3 +472,38 @@ let sortCustomerMethodsBasedOnPriority = ( sortArr->Belt.SortArray.stableSortBy(handleCustomerMethodsSort) } } + +let getSupportedCardBrands = ( + paymentMethodListValue: OrcaPaymentPage.PaymentMethodsRecord.paymentMethodList, +) => { + let cardPaymentMethod = + paymentMethodListValue.payment_methods->Array.find(ele => ele.payment_method === "card") + + switch cardPaymentMethod { + | Some(cardPaymentMethod) => + let cardNetworks = cardPaymentMethod.payment_method_types->Array.map(ele => ele.card_networks) + let cardNetworkNames = + cardNetworks->Array.map(ele => + ele->Array.map(val => val.card_network->CardUtils.getCardStringFromType->String.toLowerCase) + ) + Some( + cardNetworkNames + ->Array.reduce([], (acc, ele) => acc->Array.concat(ele)) + ->Utils.getUniqueArray, + ) + | None => None + } +} + +let checkIsCardSupported = (cardNumber, supportedCardBrands) => { + let cardBrand = cardNumber->CardUtils.getCardBrand + let clearValue = cardNumber->CardUtils.clearSpaces + if CardUtils.cardValid(clearValue, cardBrand) { + switch supportedCardBrands { + | Some(brands) => Some(brands->Array.includes(cardBrand->String.toLowerCase)) + | None => Some(true) + } + } else { + None + } +} From 95119fab3f10f15e10996830a95614438bf03911 Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Tue, 3 Sep 2024 10:52:09 +0000 Subject: [PATCH 12/23] chore(release): 0.84.12 [skip ci] ## [0.84.12](https://github.com/juspay/hyperswitch-web/compare/v0.84.11...v0.84.12) (2024-09-03) --- 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 722a151b8..9a7540af7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,5 @@ +## [0.84.12](https://github.com/juspay/hyperswitch-web/compare/v0.84.11...v0.84.12) (2024-09-03) + ## [0.84.11](https://github.com/juspay/hyperswitch-web/compare/v0.84.10...v0.84.11) (2024-09-03) diff --git a/package-lock.json b/package-lock.json index 2b0b5678b..7d0a79187 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "orca-payment-page", - "version": "0.84.11", + "version": "0.84.12", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "orca-payment-page", - "version": "0.84.11", + "version": "0.84.12", "hasInstallScript": true, "dependencies": { "@glennsl/rescript-fetch": "^0.2.0", diff --git a/package.json b/package.json index 21ed7fa22..6fd7a8168 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "orca-payment-page", - "version": "0.84.11", + "version": "0.84.12", "main": "index.js", "private": true, "dependencies": { From 94f47e128a74f51fecaf28e72dd9f9c410296e0d Mon Sep 17 00:00:00 2001 From: Pritish Budhiraja Date: Tue, 3 Sep 2024 16:53:21 +0530 Subject: [PATCH 13/23] fix: console log removal --- src/orca-log-catcher/ReusableReactSuspense.res | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/orca-log-catcher/ReusableReactSuspense.res b/src/orca-log-catcher/ReusableReactSuspense.res index 8827d9218..b9fcb1608 100644 --- a/src/orca-log-catcher/ReusableReactSuspense.res +++ b/src/orca-log-catcher/ReusableReactSuspense.res @@ -1,7 +1,5 @@ @react.component let make = (~children, ~loaderComponent, ~componentName) => { - Console.log2("-- componentName -- ", componentName) - {children} From 15e928ca9b6a9fa289782250bf84e9a204c855e6 Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Tue, 3 Sep 2024 11:25:00 +0000 Subject: [PATCH 14/23] chore(release): 0.84.13 [skip ci] ## [0.84.13](https://github.com/juspay/hyperswitch-web/compare/v0.84.12...v0.84.13) (2024-09-03) ### Bug Fixes * console log removal ([94f47e1](https://github.com/juspay/hyperswitch-web/commit/94f47e128a74f51fecaf28e72dd9f9c410296e0d)) --- 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 9a7540af7..08b576efa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## [0.84.13](https://github.com/juspay/hyperswitch-web/compare/v0.84.12...v0.84.13) (2024-09-03) + + +### Bug Fixes + +* console log removal ([94f47e1](https://github.com/juspay/hyperswitch-web/commit/94f47e128a74f51fecaf28e72dd9f9c410296e0d)) + ## [0.84.12](https://github.com/juspay/hyperswitch-web/compare/v0.84.11...v0.84.12) (2024-09-03) ## [0.84.11](https://github.com/juspay/hyperswitch-web/compare/v0.84.10...v0.84.11) (2024-09-03) diff --git a/package-lock.json b/package-lock.json index 7d0a79187..cb606634b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "orca-payment-page", - "version": "0.84.12", + "version": "0.84.13", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "orca-payment-page", - "version": "0.84.12", + "version": "0.84.13", "hasInstallScript": true, "dependencies": { "@glennsl/rescript-fetch": "^0.2.0", diff --git a/package.json b/package.json index 6fd7a8168..471f1ce7e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "orca-payment-page", - "version": "0.84.12", + "version": "0.84.13", "main": "index.js", "private": true, "dependencies": { From 65dc747d7e3af3a19afc682a72e63b2b177c4e9e Mon Sep 17 00:00:00 2001 From: Pritish Budhiraja Date: Tue, 3 Sep 2024 21:25:46 +0530 Subject: [PATCH 15/23] Update CODEOWNERS --- .github/CODEOWNERS | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 840e56b3d..dfdd081ac 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1,4 +1,4 @@ -- @akash-c-k @ArushKapoorJuspay @PritishBudhiraja @seekshiva @swamu +- @akash-c-k @ArushKapoorJuspay @PritishBudhiraja @seekshiva docs/ @akash-c-k LICENSE @akash-c-k @@ -16,4 +16,4 @@ aws/ @seekshiva webpack.dev.js @ArushKapoorJuspay @PritishBudhiraja @seekshiva webpack.common.js @ArushKapoorJuspay @PritishBudhiraja @seekshiva -src/ @seekshiva @PritishBudhiraja @ArushKapoorJuspay @swamu +src/ @seekshiva @PritishBudhiraja @ArushKapoorJuspay From 46b0ef46f7af2aa8fbd5ac59c4fa8b0903b21c03 Mon Sep 17 00:00:00 2001 From: ArushKapoorJuspay <121166031+ArushKapoorJuspay@users.noreply.github.com> Date: Wed, 4 Sep 2024 15:40:53 +0530 Subject: [PATCH 16/23] fix: changed post message from parent window to current window (#598) --- Hyperswitch-React-Demo-App/server.js | 3 ++- src/Utilities/Utils.res | 13 ++++++++----- src/orca-loader/Elements.res | 14 +++++++------- 3 files changed, 17 insertions(+), 13 deletions(-) diff --git a/Hyperswitch-React-Demo-App/server.js b/Hyperswitch-React-Demo-App/server.js index 13cd945c2..514948cef 100644 --- a/Hyperswitch-React-Demo-App/server.js +++ b/Hyperswitch-React-Demo-App/server.js @@ -54,6 +54,7 @@ const paymentData = { authentication_type: "three_ds", customer_id: "hyperswitch_sdk_demo_id", email: "hyperswitch_sdk_demo_id@gmail.com", + request_external_three_ds_authentication: false, description: "Hello this is description", shipping: { address: { @@ -97,7 +98,7 @@ const paymentData = { } const profileId = process.env.PROFILE_ID; -if(profileId) { +if (profileId) { paymentData.profile_id = profileId; } diff --git a/src/Utilities/Utils.res b/src/Utilities/Utils.res index deb9d3fa6..572300a53 100644 --- a/src/Utilities/Utils.res +++ b/src/Utilities/Utils.res @@ -1,8 +1,6 @@ @val external document: 'a = "document" -type window -type parent -@val external window: window = "window" -@val @scope("window") external iframeParent: parent = "parent" +@val external window: Dom.element = "window" +@val @scope("window") external iframeParent: Dom.element = "parent" type event = {data: string} external dictToObj: Dict.t<'a> => {..} = "%identity" @@ -15,12 +13,17 @@ type dateTimeFormat = {resolvedOptions: unit => options} @send external remove: Dom.element => unit = "remove" -@send external postMessage: (parent, JSON.t, string) => unit = "postMessage" +@send external postMessage: (Dom.element, JSON.t, string) => unit = "postMessage" + open ErrorUtils let messageParentWindow = (~targetOrigin="*", messageArr) => { iframeParent->postMessage(messageArr->Dict.fromArray->JSON.Encode.object, targetOrigin) } +let messageCurrentWindow = (~targetOrigin="*", messageArr) => { + window->postMessage(messageArr->Dict.fromArray->JSON.Encode.object, targetOrigin) +} + let handleOnFocusPostMessage = (~targetOrigin="*") => { messageParentWindow([("focus", true->JSON.Encode.bool)], ~targetOrigin) } diff --git a/src/orca-loader/Elements.res b/src/orca-loader/Elements.res index 96bb201cd..691372db5 100644 --- a/src/orca-loader/Elements.res +++ b/src/orca-loader/Elements.res @@ -612,7 +612,7 @@ let make = ( } switch eventDataObject->getOptionalJsonFromJson("poll_status") { | Some(val) => { - messageParentWindow([ + messageCurrentWindow([ ("fullscreen", true->JSON.Encode.bool), ("param", "paymentloader"->JSON.Encode.string), ("iframeId", selectorString->JSON.Encode.string), @@ -650,7 +650,7 @@ let make = ( ) resolve(JSON.Encode.null) } else { - messageParentWindow([ + messageCurrentWindow([ ("fullscreen", false->JSON.Encode.bool), ("submitSuccessful", true->JSON.Encode.bool), ("data", json), @@ -662,7 +662,7 @@ let make = ( if redirect.contents === "always" { Window.Location.replace(url) } - messageParentWindow([ + messageCurrentWindow([ ("submitSuccessful", false->JSON.Encode.bool), ("error", err->Identity.anyTypeToJson), ]) @@ -679,7 +679,7 @@ let make = ( switch eventDataObject->getOptionalJsonFromJson("openurl_if_required") { | Some(val) => - messageParentWindow([ + messageCurrentWindow([ ("fullscreen", true->JSON.Encode.bool), ("param", "paymentloader"->JSON.Encode.string), ("iframeId", selectorString->JSON.Encode.string), @@ -696,17 +696,17 @@ let make = ( ~isForceSync=true, ) ->then(json => { - messageParentWindow([("submitSuccessful", true->JSON.Encode.bool), ("data", json)]) + messageCurrentWindow([("submitSuccessful", true->JSON.Encode.bool), ("data", json)]) resolve(json) }) ->catch(err => { - messageParentWindow([ + messageCurrentWindow([ ("submitSuccessful", false->JSON.Encode.bool), ("error", err->Identity.anyTypeToJson), ]) resolve(err->Identity.anyTypeToJson) }) - ->finally(_ => messageParentWindow([("fullscreen", false->JSON.Encode.bool)])) + ->finally(_ => messageCurrentWindow([("fullscreen", false->JSON.Encode.bool)])) }->ignore | None => () From fa06e12c66fe44ced81322153447ef73f59e0ec1 Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Wed, 4 Sep 2024 10:12:37 +0000 Subject: [PATCH 17/23] chore(release): 0.84.14 [skip ci] ## [0.84.14](https://github.com/juspay/hyperswitch-web/compare/v0.84.13...v0.84.14) (2024-09-04) ### Bug Fixes * changed post message from parent window to current window ([#598](https://github.com/juspay/hyperswitch-web/issues/598)) ([46b0ef4](https://github.com/juspay/hyperswitch-web/commit/46b0ef46f7af2aa8fbd5ac59c4fa8b0903b21c03)) --- 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 08b576efa..cc5731fd4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## [0.84.14](https://github.com/juspay/hyperswitch-web/compare/v0.84.13...v0.84.14) (2024-09-04) + + +### Bug Fixes + +* changed post message from parent window to current window ([#598](https://github.com/juspay/hyperswitch-web/issues/598)) ([46b0ef4](https://github.com/juspay/hyperswitch-web/commit/46b0ef46f7af2aa8fbd5ac59c4fa8b0903b21c03)) + ## [0.84.13](https://github.com/juspay/hyperswitch-web/compare/v0.84.12...v0.84.13) (2024-09-03) diff --git a/package-lock.json b/package-lock.json index cb606634b..93cfa4bd5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "orca-payment-page", - "version": "0.84.13", + "version": "0.84.14", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "orca-payment-page", - "version": "0.84.13", + "version": "0.84.14", "hasInstallScript": true, "dependencies": { "@glennsl/rescript-fetch": "^0.2.0", diff --git a/package.json b/package.json index 471f1ce7e..257382a6c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "orca-payment-page", - "version": "0.84.13", + "version": "0.84.14", "main": "index.js", "private": true, "dependencies": { From 1f3cc6bd44cfb0e1086920cb7631e6ba416ec74b Mon Sep 17 00:00:00 2001 From: sakksham7 <130480324+sakksham7@users.noreply.github.com> Date: Mon, 9 Sep 2024 11:06:47 +0530 Subject: [PATCH 18/23] fix: integ env in webpack (#602) Co-authored-by: Saksham Sharma --- webpack.common.js | 33 +++++++++++++++++++++++++++------ 1 file changed, 27 insertions(+), 6 deletions(-) diff --git a/webpack.common.js b/webpack.common.js index a2b8c40ff..3b6b748fa 100644 --- a/webpack.common.js +++ b/webpack.common.js @@ -36,15 +36,36 @@ const getSdkUrl = (env, customUrl) => { }; const sdkUrl = getSdkUrl(sdkEnv, envSdkUrl); +const getEnvironmentDomain = (prodDomain, integDomain, defaultDomain) => { + switch (sdkEnv) { + case "prod": + return prodDomain; + case "integ": + return integDomain; + default: + return defaultDomain; + } +}; + +const backendDomain = getEnvironmentDomain("checkout", "dev", "beta"); +const confirmDomain = getEnvironmentDomain("api", "integ-api", "sandbox"); +const logDomain = getEnvironmentDomain("api", "integ-api", "sandbox"); + const backendEndPoint = - envBackendUrl || - `https://${sdkEnv === "prod" ? "checkout" : "beta"}.hyperswitch.io/api`; + envBackendUrl || `https://${backendDomain}.hyperswitch.io/api`; + const confirmEndPoint = - envBackendUrl || - `https://${sdkEnv === "prod" ? "api" : "sandbox"}.hyperswitch.io`; + envBackendUrl || `https://${confirmDomain}.hyperswitch.io`; + const logEndpoint = - envLoggingUrl || - `https://${sdkEnv === "prod" ? "api" : "sandbox"}.hyperswitch.io/logs/sdk`; + envLoggingUrl || `https://${logDomain}.hyperswitch.io/logs/sdk`; + +console.log("Test SDK values ===>", { + sdkEnv, + sdkUrl, + backendEndPoint, + confirmEndPoint, +}); const enableLogging = true; const loggingLevel = "DEBUG"; From 65f873dabb67bfb966a0d51e8e2bfebefbc2c026 Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Mon, 9 Sep 2024 05:38:15 +0000 Subject: [PATCH 19/23] chore(release): 0.84.15 [skip ci] ## [0.84.15](https://github.com/juspay/hyperswitch-web/compare/v0.84.14...v0.84.15) (2024-09-09) ### Bug Fixes * integ env in webpack ([#602](https://github.com/juspay/hyperswitch-web/issues/602)) ([1f3cc6b](https://github.com/juspay/hyperswitch-web/commit/1f3cc6bd44cfb0e1086920cb7631e6ba416ec74b)) --- 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 cc5731fd4..2d4a31175 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## [0.84.15](https://github.com/juspay/hyperswitch-web/compare/v0.84.14...v0.84.15) (2024-09-09) + + +### Bug Fixes + +* integ env in webpack ([#602](https://github.com/juspay/hyperswitch-web/issues/602)) ([1f3cc6b](https://github.com/juspay/hyperswitch-web/commit/1f3cc6bd44cfb0e1086920cb7631e6ba416ec74b)) + ## [0.84.14](https://github.com/juspay/hyperswitch-web/compare/v0.84.13...v0.84.14) (2024-09-04) diff --git a/package-lock.json b/package-lock.json index 93cfa4bd5..9f8bb01ba 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "orca-payment-page", - "version": "0.84.14", + "version": "0.84.15", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "orca-payment-page", - "version": "0.84.14", + "version": "0.84.15", "hasInstallScript": true, "dependencies": { "@glennsl/rescript-fetch": "^0.2.0", diff --git a/package.json b/package.json index 257382a6c..78bb089eb 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "orca-payment-page", - "version": "0.84.14", + "version": "0.84.15", "main": "index.js", "private": true, "dependencies": { From 54e613cc4e992f760543c1be796cf7563c5c78cf Mon Sep 17 00:00:00 2001 From: sakksham7 <130480324+sakksham7@users.noreply.github.com> Date: Mon, 9 Sep 2024 17:16:27 +0530 Subject: [PATCH 20/23] fix: added wild cards support (#601) Co-authored-by: Saksham Sharma Co-authored-by: Shiva Nandan --- src/CardUtils.res | 8 ++++++-- src/GlobalVars.res | 2 +- src/Payment.res | 3 ++- src/Utilities/PaymentUtils.res | 4 +++- src/Utilities/Utils.res | 2 ++ 5 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/CardUtils.res b/src/CardUtils.res index 9ad523fb7..a20967fdc 100644 --- a/src/CardUtils.res +++ b/src/CardUtils.res @@ -458,8 +458,12 @@ let maxCardLength = cardBrand => { let cardValid = (cardNumber, cardBrand) => { let clearValueLength = cardNumber->clearSpaces->String.length - (clearValueLength == maxCardLength(cardBrand) || - (cardBrand === "Visa" && clearValueLength == 16)) && calculateLuhn(cardNumber) + if cardBrand == "" && (GlobalVars.isInteg || GlobalVars.isSandbox) { + Utils.checkIsTestCardWildcard(cardNumber) + } else { + (clearValueLength == maxCardLength(cardBrand) || + (cardBrand === "Visa" && clearValueLength == 16)) && calculateLuhn(cardNumber) + } } let blurRef = (ref: React.ref>) => { ref.current->Nullable.toOption->Option.forEach(input => input->blur)->ignore diff --git a/src/GlobalVars.res b/src/GlobalVars.res index 0580a11fb..e7be7c345 100644 --- a/src/GlobalVars.res +++ b/src/GlobalVars.res @@ -12,5 +12,5 @@ @val external maxLogsPushedPerEventName: int = "maxLogsPushedPerEventName" let targetOrigin: string = "*" let isInteg = sdkUrl === "https://dev.hyperswitch.io" -let isSandbox = sdkUrl === "https://beta.hyperswitch.io" +let isSandbox = sdkUrl === "https://beta.hyperswitch.io" || sdkUrl === "http://localhost:9050" let isProd = sdkUrl === "https://checkout.hyperswitch.io" diff --git a/src/Payment.res b/src/Payment.res index 8ead3bf2a..13dd3d733 100644 --- a/src/Payment.res +++ b/src/Payment.res @@ -87,7 +87,8 @@ let make = (~paymentMode, ~integrateError, ~logger) => { setCardValid(clearValue, setIsCardValid) if ( cardValid(clearValue, cardBrand) && - PaymentUtils.checkIsCardSupported(clearValue, supportedCardBrands)->Option.getOr(false) + (PaymentUtils.checkIsCardSupported(clearValue, supportedCardBrands)->Option.getOr(false) || + Utils.checkIsTestCardWildcard(clearValue)) ) { handleInputFocus(~currentRef=cardRef, ~destinationRef=expiryRef) } diff --git a/src/Utilities/PaymentUtils.res b/src/Utilities/PaymentUtils.res index 92a9d34c1..108f3f8c2 100644 --- a/src/Utilities/PaymentUtils.res +++ b/src/Utilities/PaymentUtils.res @@ -498,7 +498,9 @@ let getSupportedCardBrands = ( let checkIsCardSupported = (cardNumber, supportedCardBrands) => { let cardBrand = cardNumber->CardUtils.getCardBrand let clearValue = cardNumber->CardUtils.clearSpaces - if CardUtils.cardValid(clearValue, cardBrand) { + if cardBrand == "" && (GlobalVars.isInteg || GlobalVars.isSandbox) { + Some(CardUtils.cardValid(clearValue, cardBrand)) + } else if CardUtils.cardValid(clearValue, cardBrand) { switch supportedCardBrands { | Some(brands) => Some(brands->Array.includes(cardBrand->String.toLowerCase)) | None => Some(true) diff --git a/src/Utilities/Utils.res b/src/Utilities/Utils.res index 572300a53..e6f1e9f13 100644 --- a/src/Utilities/Utils.res +++ b/src/Utilities/Utils.res @@ -1375,3 +1375,5 @@ let getFirstAndLastNameFromFullName = fullName => { (firstName, lastNameJson) } + +let checkIsTestCardWildcard = val => ["1111222233334444"]->Array.includes(val) From a6eb3c2666d61623d42efe1b33aa62ba7d4ee585 Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Mon, 9 Sep 2024 11:48:04 +0000 Subject: [PATCH 21/23] chore(release): 0.84.16 [skip ci] ## [0.84.16](https://github.com/juspay/hyperswitch-web/compare/v0.84.15...v0.84.16) (2024-09-09) ### Bug Fixes * added wild cards support ([#601](https://github.com/juspay/hyperswitch-web/issues/601)) ([54e613c](https://github.com/juspay/hyperswitch-web/commit/54e613cc4e992f760543c1be796cf7563c5c78cf)) --- 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 2d4a31175..bd62ddcbd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## [0.84.16](https://github.com/juspay/hyperswitch-web/compare/v0.84.15...v0.84.16) (2024-09-09) + + +### Bug Fixes + +* added wild cards support ([#601](https://github.com/juspay/hyperswitch-web/issues/601)) ([54e613c](https://github.com/juspay/hyperswitch-web/commit/54e613cc4e992f760543c1be796cf7563c5c78cf)) + ## [0.84.15](https://github.com/juspay/hyperswitch-web/compare/v0.84.14...v0.84.15) (2024-09-09) diff --git a/package-lock.json b/package-lock.json index 9f8bb01ba..2a3831870 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "orca-payment-page", - "version": "0.84.15", + "version": "0.84.16", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "orca-payment-page", - "version": "0.84.15", + "version": "0.84.16", "hasInstallScript": true, "dependencies": { "@glennsl/rescript-fetch": "^0.2.0", diff --git a/package.json b/package.json index 78bb089eb..ac75c27ce 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "orca-payment-page", - "version": "0.84.15", + "version": "0.84.16", "main": "index.js", "private": true, "dependencies": { From dadefa8699bea20f5a15de0568e6e77baf402115 Mon Sep 17 00:00:00 2001 From: sakksham7 <130480324+sakksham7@users.noreply.github.com> Date: Mon, 9 Sep 2024 17:21:22 +0530 Subject: [PATCH 22/23] refactor: log removed (#604) Co-authored-by: Saksham Sharma Co-authored-by: Pritish Budhiraja --- webpack.common.js | 7 ------- 1 file changed, 7 deletions(-) diff --git a/webpack.common.js b/webpack.common.js index 3b6b748fa..fdd7f08e3 100644 --- a/webpack.common.js +++ b/webpack.common.js @@ -60,13 +60,6 @@ const confirmEndPoint = const logEndpoint = envLoggingUrl || `https://${logDomain}.hyperswitch.io/logs/sdk`; -console.log("Test SDK values ===>", { - sdkEnv, - sdkUrl, - backendEndPoint, - confirmEndPoint, -}); - const enableLogging = true; const loggingLevel = "DEBUG"; const maxLogsPushedPerEventName = 100; From bddeb86f2dadb99ce63201c2457479c4344cf20a Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Mon, 9 Sep 2024 11:52:48 +0000 Subject: [PATCH 23/23] chore(release): 0.84.17 [skip ci] ## [0.84.17](https://github.com/juspay/hyperswitch-web/compare/v0.84.16...v0.84.17) (2024-09-09) --- 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 bd62ddcbd..61c7d8f36 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,5 @@ +## [0.84.17](https://github.com/juspay/hyperswitch-web/compare/v0.84.16...v0.84.17) (2024-09-09) + ## [0.84.16](https://github.com/juspay/hyperswitch-web/compare/v0.84.15...v0.84.16) (2024-09-09) diff --git a/package-lock.json b/package-lock.json index 2a3831870..b28e41384 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "orca-payment-page", - "version": "0.84.16", + "version": "0.84.17", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "orca-payment-page", - "version": "0.84.16", + "version": "0.84.17", "hasInstallScript": true, "dependencies": { "@glennsl/rescript-fetch": "^0.2.0", diff --git a/package.json b/package.json index ac75c27ce..06a8832f8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "orca-payment-page", - "version": "0.84.16", + "version": "0.84.17", "main": "index.js", "private": true, "dependencies": {