diff --git a/.githooks/commit-msg b/.githooks/commit-msg index 865cf65c2..3a1276348 100755 --- a/.githooks/commit-msg +++ b/.githooks/commit-msg @@ -1,24 +1,54 @@ #!/bin/sh -echo "~~~~**** Commit hook started ****~~~~" +echo "*****~~~~~ Commit hook initiated ~~~~~~*****" commit_msg_file=$1 commit_msg=$(cat "$commit_msg_file") - # For formatting your code -npx prettier --write . +echo +echo "*****~~~~~ Formatting - Check for unformatted files ~~~~~~*****" + +# Check for unformatted JavaScript and JSON files using Prettier +unformatted_js_files=$(git ls-files | grep '\.js\|\.json' | xargs npx prettier --list-different) + +# If there are unformatted JavaScript, TypeScript, or JSON files, print an error message and exit with a non-zero status code +if [ -n "$unformatted_js_files" ]; then + echo "Error: Unformatted JavaScript, YML or JSON files found. Please run 'npx prettier --write .' for formatting whole repository or 'npx prettier --write' on the following files:" + echo "$unformatted_js_files" + exit 1 +fi + +# Check for unformatted ReScript files npm run re:format -# Define your commit message convention (e.g., starts with "feature:", "fix:", etc.) -commit_regex="^(Merge branch|feat|fix|chore|docs|style|refactor|test|enhancement).+" +echo +echo "*****~~~~~ All files are formatted. ~~~~~~*****" +echo + +echo +echo "*****~~~~~ Commit message validation! ~~~~~*****" +echo +# Define your commit message convention (e.g., starts with "feat:", "fix:", etc.) +commit_regex="^(Merge branch|(feat|fix|chore|refactor|docs|test|style|enhancement):).+" + -if ! echo "$commit_msg" | grep -Ei "$commit_regex" ; then - echo "Aborting commit. Your commit message does not follow the conventional format." - echo "Example - : - " +if git log --show-signature -n 1 | grep -q 'gpg:'; then + if ! echo "$commit_msg" | grep -Ei "$commit_regex" ; then + echo "Aborting commit. Your commit message does not follow the conventional format." + echo "The commit message should begin with one of the following keywords followed by a colon: 'feat', 'fix', 'chore', 'refactor', 'docs', 'test' or 'style'. For example, it should be formatted like this: 'feat: - '" + exit 1 + fi +else + echo "~~~~**** Error: Commit Signature Missing. ****~~~~" + echo "Please make sure to sign your commits. You can sign your commit by using the '-S' option with 'git commit'." + echo "Example: git commit -S -m 'Your commit message'" + echo "Signing commits is crucial for verifying contributions. Consult GitHub's documentation on commit signature verification for guidance: https://docs.github.com/en/authentication/managing-commit-signature-verification/signing-commits" exit 1 fi # If the commit message matches the convention, the script exits successfully. -echo "~~~~**** Commit hook completed ****~~~~" +echo +echo "*****~~~~~ Commit hook completed ~~~~~~*****" +echo exit 0 diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 987dd59bb..c91742e85 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -39,4 +39,3 @@ Or did you test this change manually (provide relevant screenshots)? - [ ] I ran `npm run re:build` - [ ] I reviewed submitted code - [ ] I added unit tests for my changes where possible -- [ ] I added a [CHANGELOG](/CHANGELOG.md) entry if applicable diff --git a/.github/workflows/release-new-version.yml b/.github/workflows/release-new-version.yml index 01ca10b53..ade4f1982 100644 --- a/.github/workflows/release-new-version.yml +++ b/.github/workflows/release-new-version.yml @@ -1,19 +1,19 @@ name: Release a new hyperswitch version -# on: -# schedule: -# - cron: "30 14 * * 0-4" # Run workflow at 8 PM IST every Sunday-Thursday +on: + schedule: + - cron: "30 14 * * 0-4" # Run workflow at 8 PM IST every Sunday-Thursday -# workflow_dispatch: + workflow_dispatch: -# concurrency: -# group: ${{ github.workflow }}-${{ github.ref }} -# cancel-in-progress: true +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true -on: - pull_request_target: - types: - - closed +# on: +# pull_request_target: +# types: +# - closed env: # Allow more retries for network requests in cargo (downloading crates) and @@ -30,9 +30,9 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v4 - # with: - # fetch-depth: 0 - # token: ${{ secrets.AUTO_RELEASE_PAT }} + with: + fetch-depth: 0 + token: ${{ secrets.AUTO_RELEASE_PAT }} - name: Install Rust uses: dtolnay/rust-toolchain@master diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 000000000..4924cc8c7 --- /dev/null +++ b/.prettierignore @@ -0,0 +1,2 @@ +CHANGELOG.md +*euclid* diff --git a/CHANGELOG.md b/CHANGELOG.md index ccce7288b..5a7ad669e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,18 +1,83 @@ # Changelog - All notable changes to this project will be documented in this file. See [conventional commits](https://www.conventionalcommits.org/) for commit guidelines. ---- +- - - + +## 1.3.1 (2023-12-07) + +### Bug Fixes + +- Euclid wasm minimum amount ([#78](https://github.com/juspay/hyperswitch-control-center/pull/78)) ([`2f730e0`](https://github.com/juspay/hyperswitch-control-center/commit/2f730e0602e49dd11a8e0790df91941b91e1577b)) +- Update wasm file to fix minimum amount ([`ea1b8fe`](https://github.com/juspay/hyperswitch-control-center/commit/ea1b8fefdf83a583d115467e78e10c68b4a1145e)) -## 1.1.0 (2023-11-29) +**Full Changelog:** [`v1.3.0...v1.3.1`](https://github.com/juspay/hyperswitch-control-center/compare/v1.3.0...v1.3.1) + +- - - + + +## 1.3.0 (2023-12-07) ### Features -- Add-release-new-version-action ([`880a10e`](https://github.com/juspay/hyperswitch-control-center/commit/880a10e0695284bb76a6e4cf156774a8a6e0fb01)) -- Add change log template ([`9475c4a`](https://github.com/juspay/hyperswitch-control-center/commit/9475c4a2863c12110a4f8bf2826fa68cdba7ab09)) +- Profile id and profile name concat ([#73](https://github.com/juspay/hyperswitch-control-center/pull/73)) ([`8266a95`](https://github.com/juspay/hyperswitch-control-center/commit/8266a95ede73e2b66677d7d1046c4271c8fbd526)) +- New connector Icons and Searchbar for connector ([#46](https://github.com/juspay/hyperswitch-control-center/pull/46)) ([`2717c0d`](https://github.com/juspay/hyperswitch-control-center/commit/2717c0d3f09807022f53929ddd244aed3c28034d)) + +### Bug Fixes + +- Default card layout ([#70](https://github.com/juspay/hyperswitch-control-center/pull/70)) ([`b7690bc`](https://github.com/juspay/hyperswitch-control-center/commit/b7690bc569895ce0d92425314bcfc783f8d3365f)) +- Top 5 errors fix ([#60](https://github.com/juspay/hyperswitch-control-center/pull/60)) ([`d5b19d6`](https://github.com/juspay/hyperswitch-control-center/commit/d5b19d67ea6cc7e07153b0bfb58ca4beedf1a594)) +- SDK code refactoring and return URL addition ([#72](https://github.com/juspay/hyperswitch-control-center/pull/72)) ([`d77b875`](https://github.com/juspay/hyperswitch-control-center/commit/d77b875b9e1c872985678975d4651f6cc90ac364)) +- SDK Go to payment fix in Success Status ([#74](https://github.com/juspay/hyperswitch-control-center/pull/74)) ([`66ea60b`](https://github.com/juspay/hyperswitch-control-center/commit/66ea60b321bdd3efd7980a99e007135f29998951)) +- Payment settings added under developers ([#77](https://github.com/juspay/hyperswitch-control-center/pull/77)) ([`592ce41`](https://github.com/juspay/hyperswitch-control-center/commit/592ce413fb529847c1428197f18420e6f2a28d66)) + +### Miscellaneous Tasks + +- Response warnings removed ([#68](https://github.com/juspay/hyperswitch-control-center/pull/68)) ([`7427f10`](https://github.com/juspay/hyperswitch-control-center/commit/7427f1051dc6e88258699a90cef3453f66fe5f98)) +- User Management File Changes ([#76](https://github.com/juspay/hyperswitch-control-center/pull/76)) ([`8807933`](https://github.com/juspay/hyperswitch-control-center/commit/8807933a676f8041eab5cbc5b833ed06e17a76eb)) + +**Full Changelog:** [`v1.2.0...v1.3.0`](https://github.com/juspay/hyperswitch-control-center/compare/v1.2.0...v1.3.0) + +- - - + + +## 1.2.0 (2023-12-06) + +### Features + +- Bankofamerica addition in prod ([#69](https://github.com/juspay/hyperswitch-control-center/pull/69)) ([`bf6bde8`](https://github.com/juspay/hyperswitch-control-center/commit/bf6bde89eaaf3c443e07c191b42d2a9293377130)) +- Support oss auth flow ([#64](https://github.com/juspay/hyperswitch-control-center/pull/64)) ([`59601ec`](https://github.com/juspay/hyperswitch-control-center/commit/59601ec4449505ff4fcd1e048d6ced78997062a9)) + +### Bug Fixes + +- 3ds code refactor and bugfixes ([#61](https://github.com/juspay/hyperswitch-control-center/pull/61)) ([`9d4f503`](https://github.com/juspay/hyperswitch-control-center/commit/9d4f5036b458b671f4f1899619d891f74e936b8f)) +- Commit-msg file changes & README.md file updated. ([#65](https://github.com/juspay/hyperswitch-control-center/pull/65)) ([`96a81e0`](https://github.com/juspay/hyperswitch-control-center/commit/96a81e0363ade432fb288cc59a5dfb64ad029e48)) +- Update README.md ([#66](https://github.com/juspay/hyperswitch-control-center/pull/66)) ([`1930bd2`](https://github.com/juspay/hyperswitch-control-center/commit/1930bd294de22a962304c4389426b741429fd1dc)) +- Live Mode SDK Fixes. ([#67](https://github.com/juspay/hyperswitch-control-center/pull/67)) ([`844920b`](https://github.com/juspay/hyperswitch-control-center/commit/844920b6fd09aa07edbf33ba83ff2aaa394c7a78)) + +**Full Changelog:** [`v1.1.0...v1.2.0`](https://github.com/juspay/hyperswitch-control-center/compare/v1.1.0...v1.2.0) + +- - - + + +## 1.1.0 (2023-12-05) + +### Features + +- Business profile UI changes ([#51](https://github.com/juspay/hyperswitch-control-center/pull/51)) ([`7d2a443`](https://github.com/juspay/hyperswitch-control-center/commit/7d2a4430980539977a8e8ddfd9d959547549258a)) + +### Bug Fixes + +- Warning icon added ([#59](https://github.com/juspay/hyperswitch-control-center/pull/59)) ([`4fbaee4`](https://github.com/juspay/hyperswitch-control-center/commit/4fbaee4bf0b1b65b08513bd9208e49f154911ae0)) +- Optional test live mode removal & typo fix ([#63](https://github.com/juspay/hyperswitch-control-center/pull/63)) ([`9466057`](https://github.com/juspay/hyperswitch-control-center/commit/94660575566729f1b6a8013e9d09e1a4bc8cff20)) + +### Miscellaneous Tasks + +- Signed commit added. ([#62](https://github.com/juspay/hyperswitch-control-center/pull/62)) ([`4f69afe`](https://github.com/juspay/hyperswitch-control-center/commit/4f69afe1946bd431fb6e8a31ee621358ff28ad12)) +- Cleanup Configs ([#48](https://github.com/juspay/hyperswitch-control-center/pull/48)) ([`5bfae97`](https://github.com/juspay/hyperswitch-control-center/commit/5bfae972ac4cd2f367d26317c203b2c9d425535d)) +- Dead code removal ([#55](https://github.com/juspay/hyperswitch-control-center/pull/55)) ([`b220415`](https://github.com/juspay/hyperswitch-control-center/commit/b220415bc390a5129e82e1b59dc6115a35cb6f84)) -**Full Changelog:** [`v1.0.2...v1.1.0`](https://github.com/juspay/hyperswitch-control-center/compare/v1.0.2...v1.1.0) +**Full Changelog:** [`v1.0.5...v1.1.0`](https://github.com/juspay/hyperswitch-control-center/compare/v1.0.5...v1.1.0) ---- +- - - -Changelog generated by [cocogitto](https://github.com/cocogitto/cocogitto). +Changelog generated by [cocogitto](https://github.com/cocogitto/cocogitto). \ No newline at end of file diff --git a/README.md b/README.md index a01f6bafd..0a849af3f 100644 --- a/README.md +++ b/README.md @@ -136,9 +136,9 @@ The `home_page` feature flag controls whether the dashboard home page is enabled The `test_live_toggle` feature flag enables users to toggle between test and live modes when signing in. When enabled, users will see an option during sign-in to actively switch between test and live environments. -#### Test Live Mode +#### Is Live Mode -The `test_live_mode` feature flag enables displaying the current mode - test or live - that the user is accessing. When enabled, it will show a visual indicator within the dashboard signaling whether the user is currently in a test environment or live production environment. +The `is_live_mode` feature flag enables the live mode - that the user is accessing. When enabled, it will show a visual indicator within the dashboard signaling whether the user is currently in a test environment or live production environment. #### Magic Link @@ -152,18 +152,6 @@ The `production_access` feature flag enables a flow for users to request live pr The `quick_start` feature flag enables the simplified onboarding flow for new users, where he connects to processors, configure payment routing and testing a payment, all in one flow. -#### Stripe plus paypal - -The `stripe_plus_paypal` feature flag enables access to simplified multi-processor connectivity through Stripe and PayPal. When turned on, users are guided through a streamlined setup flow to connect both Stripe and PayPal accounts and experience it in a checkout page. - -#### Woocommerce - -The `woocommerce` feature flag controls the visibility of WooCommerce integration with Hyperswitch flow within the dashboard. When enabled, users will have access to the step-by-step guide to integrate the woocommerce plugin for hyperswitch. - -#### Open SDK - -The `open_sdk` feature flag enables access to the Checkout Page web SDK from within the dashboard. When enabled, developers can preview the SDK from within the dashboard and make payments. - --- ## Deployment @@ -275,10 +263,82 @@ curl https://raw.githubusercontent.com/juspay/hyperswitch-control-center/main/aw --- +## Versioning + +For a detailed list of changes made in each version, please refer to the [CHANGELOG](./CHANGELOG.md) file. + +--- + ## Contributing We welcome contributions from the community! If you would like to contribute to Hyperswitch, please follow our contribution guidelines. +### Commit Conventions + +We follow the [Conventional Commits](https://www.conventionalcommits.org/) specification for our commit messages. Each commit message should have a structured format: + +`(): ` + +The commit message should begin with one of the following keywords followed by a colon: 'feat', 'fix', 'chore', 'refactor', 'docs', 'test' or 'style'. For example, it should be formatted like this: `feat: - ` + +### Signing Commits + +All commits should be signed to verify the authenticity of contributors. Follow the steps below to sign your commits: + +1. Generate a GPG key if you haven't already: + + ```bash + gpg --gen-key + ``` + +2. List your GPG keys and copy the GPG key ID:: + + ```bash + gpg --list-secret-keys --keyid-format LONG + ``` + + #### Identify the GPG key you want to add to your GitHub account. + + a. Run the following command to export your GPG public key in ASCII-armored format: + + ```bash + gpg --armor --export + Replace with the actual key ID. + ``` + + b. Copy the entire output, including the lines that start with "-----BEGIN PGP PUBLIC KEY BLOCK-----" and "-----END PGP PUBLIC KEY BLOCK-----". + + c. Go to your GitHub Settings. + + d. Click on "SSH and GPG keys" in the left sidebar. + + e. Click the "New GPG key" button. + + f. Paste your GPG public key into the provided text box. + + g. Click the "Add GPG key" button. + + h. Now your GPG public key is associated with your GitHub account, and you can sign your commits for added security. + +3. Configure Git to use your GPG key: + + ```bash + git config --global user.signingkey + ``` + +4. Set Git to sign all your commits by default: + + ```bash + git config --global commit.gpgSign true + ``` + +5. Commit your changes with the -S option to sign the commit: + ```bash + git commit -S -m "your commit message" + ``` + +For further assistance, please refer to the [GitHub documentation on signing commits](https://docs.github.com/en/authentication/managing-commit-signature-verification/signing-commits). + --- ## License diff --git a/config/FeatureFlag.json b/config/FeatureFlag.json index bbe5ac822..9d6e08029 100644 --- a/config/FeatureFlag.json +++ b/config/FeatureFlag.json @@ -1,12 +1,9 @@ { "test_live_toggle": false, - "test_live_mode": false, + "is_live_mode": false, "magic_link": false, "production_access": false, "quick_start": false, - "stripe_plus_paypal": false, - "woocommerce": false, - "open_sdk": false, "switch_merchant": false, "audit_trail": false, "system_metrics": false, @@ -21,5 +18,6 @@ "mixpanel": false, "business_profile": false, "generate_report": false, - "forgot_password": false -} \ No newline at end of file + "forgot_password": false, + "oss_build": true +} diff --git a/package-lock.json b/package-lock.json index a315ba727..581a1335b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { - "name": "rescript-euler-dashboard", - "version": "1.0.2", + "name": "hyperswitch-dashboard", + "version": "1.0.5", "lockfileVersion": 3, "requires": true, "packages": { "": { - "name": "rescript-euler-dashboard", - "version": "1.0.2", + "name": "hyperswitch-dashboard", + "version": "1.0.5", "hasInstallScript": true, "license": "MIT", "dependencies": { diff --git a/package.json b/package.json index c2f9c4eac..4e94eab64 100644 --- a/package.json +++ b/package.json @@ -1,28 +1,22 @@ { - "name": "rescript-euler-dashboard", - "version": "1.0.2", + "name": "hyperswitch-dashboard", + "version": "1.0.5", "main": "index.js", "author": "Shiva Nandan ", "license": "MIT", "scripts": { + "setup-env": "chmod +x ./replace_env.sh && ./replace_env.sh", "pre-commit": "bash .githooks/commit-msg", - "start": "chmod +x ./replace_env.sh && ./replace_env.sh && cp env-config.js ./public/hyperswitch && APP_VERSION=$npm_package_version && appName=hyperswitch webpack serve --config webpack.dev.js", - "start:server_compiler": "webpack --config webpack.server.js --watch", + "start": "npm run setup-env && cp env-config.js ./public/hyperswitch && APP_VERSION=$npm_package_version && appName=hyperswitch webpack serve --config webpack.dev.js", + "serve": "npm run setup-env && cp env-config.js ./dist/hyperswitch && node dist/server/server.js", "prod:start": "webpack serve --config webpack.dev.js", - "build:prod": "chmod +x ./replace_env.sh && ./replace_env.sh && cp env-config.js ./public/hyperswitch && APP_VERSION=$npm_package_version && webpack --config webpack.prod.js", - "ssr_sript_build": "BRANCH_NAME=ssr webpack --config webpack.prod.js", - "ssr_run_server": "node --watch dist/server/server.js", "build:netlify": "webpack --config webpack.prod.js --env netlifyHosted", + "build:test": "cd tests && npx rescript build -with-deps", + "build:prod": "npm run setup-env && cp env-config.js ./public/hyperswitch && APP_VERSION=$npm_package_version && webpack --config webpack.prod.js", "re:build": "rescript", "re:clean": "rescript clean", "re:start": "rescript build -w", "re:format": "rescript format -all", - "use-prod-ec": "mv public/_redirects_for_prod public/_redirects", - "serve": "chmod +x ./replace_env.sh && ./replace_env.sh && cp env-config.js ./dist/hyperswitch && node dist/server/server.js", - "build:test": "cd tests && npx rescript build -with-deps", - "clean:test": "cd tests && npx rescript clean -with-deps", - "unit:test": "cd tests && npx rescript build -with-deps && jest unit_test", - "revert:test": "cd tests && npx rescript clean -with-deps && cd .. && npx rescript build -with-deps", "postinstall": "git config core.hooksPath .githooks && chmod +x .githooks/commit-msg" }, "husky": { diff --git a/public/hyperswitch/Gateway/ACI.svg b/public/hyperswitch/Gateway/ACI.svg index b03aa675f..1ed65dcd3 100644 --- a/public/hyperswitch/Gateway/ACI.svg +++ b/public/hyperswitch/Gateway/ACI.svg @@ -1,9 +1,18 @@ - - - - - - - - + + + + + + + + + + + + + + + + + diff --git a/public/hyperswitch/Gateway/ADYEN.svg b/public/hyperswitch/Gateway/ADYEN.svg index 1cfb88e78..f4095e3b9 100644 --- a/public/hyperswitch/Gateway/ADYEN.svg +++ b/public/hyperswitch/Gateway/ADYEN.svg @@ -1,5 +1,5 @@ - - - - + + + + diff --git a/public/hyperswitch/Gateway/AIRWALLEX.svg b/public/hyperswitch/Gateway/AIRWALLEX.svg index 9414ff88a..5defb5f9d 100644 --- a/public/hyperswitch/Gateway/AIRWALLEX.svg +++ b/public/hyperswitch/Gateway/AIRWALLEX.svg @@ -1,29 +1,11 @@ - - - - - - - - + + + + + + + + + + diff --git a/public/hyperswitch/Gateway/AUTHORIZEDOTNET.svg b/public/hyperswitch/Gateway/AUTHORIZEDOTNET.svg index ed45d04db..1894e1a85 100644 --- a/public/hyperswitch/Gateway/AUTHORIZEDOTNET.svg +++ b/public/hyperswitch/Gateway/AUTHORIZEDOTNET.svg @@ -1,14 +1,6 @@ - - - - - - - - - - - - - + + + + + diff --git a/public/hyperswitch/Gateway/BAMBORA.svg b/public/hyperswitch/Gateway/BAMBORA.svg index 18babfc47..6c8c94cf9 100644 --- a/public/hyperswitch/Gateway/BAMBORA.svg +++ b/public/hyperswitch/Gateway/BAMBORA.svg @@ -1,29 +1,98 @@ - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/public/hyperswitch/Gateway/BANKOFAMERICA.svg b/public/hyperswitch/Gateway/BANKOFAMERICA.svg index dffcb704c..518551a55 100644 --- a/public/hyperswitch/Gateway/BANKOFAMERICA.svg +++ b/public/hyperswitch/Gateway/BANKOFAMERICA.svg @@ -1,29 +1,16 @@ - - - - - - - - + + + + + + + + + + + + + + + diff --git a/public/hyperswitch/Gateway/BITPAY.svg b/public/hyperswitch/Gateway/BITPAY.svg index a273cffa8..03ac70f7d 100644 --- a/public/hyperswitch/Gateway/BITPAY.svg +++ b/public/hyperswitch/Gateway/BITPAY.svg @@ -1,30 +1,18 @@ - - - - - - - - - + + + + + + + + + + + + + + + + + diff --git a/public/hyperswitch/Gateway/BLUESNAP.svg b/public/hyperswitch/Gateway/BLUESNAP.svg index ba0493c94..7257803b5 100644 --- a/public/hyperswitch/Gateway/BLUESNAP.svg +++ b/public/hyperswitch/Gateway/BLUESNAP.svg @@ -1,29 +1,6 @@ - - - - - - - - + + + + + diff --git a/public/hyperswitch/Gateway/BRAINTREE,.svg b/public/hyperswitch/Gateway/BRAINTREE,.svg deleted file mode 100644 index e2cf25df9..000000000 --- a/public/hyperswitch/Gateway/BRAINTREE,.svg +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - diff --git a/public/hyperswitch/Gateway/BRAINTREE.svg b/public/hyperswitch/Gateway/BRAINTREE.svg index a3c1080b1..6140a3f81 100644 --- a/public/hyperswitch/Gateway/BRAINTREE.svg +++ b/public/hyperswitch/Gateway/BRAINTREE.svg @@ -1,4 +1,5 @@ - - + + + diff --git a/public/hyperswitch/Gateway/CASHTOCODE.svg b/public/hyperswitch/Gateway/CASHTOCODE.svg index 0136f6cc6..8e253649e 100644 --- a/public/hyperswitch/Gateway/CASHTOCODE.svg +++ b/public/hyperswitch/Gateway/CASHTOCODE.svg @@ -1,26 +1,7 @@ - - - - - - - - + + + + + + diff --git a/public/hyperswitch/Gateway/CHECKOUT.svg b/public/hyperswitch/Gateway/CHECKOUT.svg index f68198419..0c2026c20 100644 --- a/public/hyperswitch/Gateway/CHECKOUT.svg +++ b/public/hyperswitch/Gateway/CHECKOUT.svg @@ -1,4 +1,5 @@ - - + + + diff --git a/public/hyperswitch/Gateway/COINBASE.svg b/public/hyperswitch/Gateway/COINBASE.svg index 8581d97e0..448c42433 100644 --- a/public/hyperswitch/Gateway/COINBASE.svg +++ b/public/hyperswitch/Gateway/COINBASE.svg @@ -1,9 +1,5 @@ - - - - - - - - + + + + diff --git a/public/hyperswitch/Gateway/CRYPTOPAY.svg b/public/hyperswitch/Gateway/CRYPTOPAY.svg index 56e18e4f0..c223f189e 100644 --- a/public/hyperswitch/Gateway/CRYPTOPAY.svg +++ b/public/hyperswitch/Gateway/CRYPTOPAY.svg @@ -1,31 +1,5 @@ - - - - - - - - - - - - - + + + + diff --git a/public/hyperswitch/Gateway/CYBERSOURCE.svg b/public/hyperswitch/Gateway/CYBERSOURCE.svg index 387a3a2c9..e79e20c75 100644 --- a/public/hyperswitch/Gateway/CYBERSOURCE.svg +++ b/public/hyperswitch/Gateway/CYBERSOURCE.svg @@ -1,6 +1,7 @@ - - - - + + + + + diff --git a/public/hyperswitch/Gateway/DLOCAL.svg b/public/hyperswitch/Gateway/DLOCAL.svg index c64144a70..c59c83768 100644 --- a/public/hyperswitch/Gateway/DLOCAL.svg +++ b/public/hyperswitch/Gateway/DLOCAL.svg @@ -1,29 +1,6 @@ - - - - - - - - + + + + + diff --git a/public/hyperswitch/Gateway/FISERV.svg b/public/hyperswitch/Gateway/FISERV.svg index 4446c6eaf..26a34922d 100644 --- a/public/hyperswitch/Gateway/FISERV.svg +++ b/public/hyperswitch/Gateway/FISERV.svg @@ -1,41 +1,34 @@ - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/public/hyperswitch/Gateway/FORTE.svg b/public/hyperswitch/Gateway/FORTE.svg index e358cd7a0..b32ccdfc4 100644 --- a/public/hyperswitch/Gateway/FORTE.svg +++ b/public/hyperswitch/Gateway/FORTE.svg @@ -1,29 +1,10 @@ - - - - - - - - + + + + + + + + + diff --git a/public/hyperswitch/Gateway/GLOBALPAY.svg b/public/hyperswitch/Gateway/GLOBALPAY.svg index 25197f302..991324a6a 100644 --- a/public/hyperswitch/Gateway/GLOBALPAY.svg +++ b/public/hyperswitch/Gateway/GLOBALPAY.svg @@ -1,22 +1,6 @@ - - - - - - - - - - + + + + + diff --git a/public/hyperswitch/Gateway/GLOBEPAY.svg b/public/hyperswitch/Gateway/GLOBEPAY.svg index b0248394d..876ba1f17 100644 --- a/public/hyperswitch/Gateway/GLOBEPAY.svg +++ b/public/hyperswitch/Gateway/GLOBEPAY.svg @@ -1,14 +1,7 @@ - - - - - - - - - - - - - + + + + + + diff --git a/public/hyperswitch/Gateway/GOCARDLESS.svg b/public/hyperswitch/Gateway/GOCARDLESS.svg index d6900cff7..d57bc7176 100644 --- a/public/hyperswitch/Gateway/GOCARDLESS.svg +++ b/public/hyperswitch/Gateway/GOCARDLESS.svg @@ -1,12 +1,6 @@ - - - - - - - - - - - + + + + + diff --git a/public/hyperswitch/Gateway/IATAPAY.svg b/public/hyperswitch/Gateway/IATAPAY.svg index 3d579b30f..7e3b5a85a 100644 --- a/public/hyperswitch/Gateway/IATAPAY.svg +++ b/public/hyperswitch/Gateway/IATAPAY.svg @@ -1,26 +1,12 @@ - - - - - - - - + + + + + + + + + + + diff --git a/public/hyperswitch/Gateway/KLARNA.svg b/public/hyperswitch/Gateway/KLARNA.svg index 4bedd5c42..358ff6e37 100644 --- a/public/hyperswitch/Gateway/KLARNA.svg +++ b/public/hyperswitch/Gateway/KLARNA.svg @@ -1,17 +1,5 @@ - - - - - - - - - - - - - - - - + + + + diff --git a/public/hyperswitch/Gateway/MOLLIE.svg b/public/hyperswitch/Gateway/MOLLIE.svg index 5dcfe70ee..9f932bd9d 100644 --- a/public/hyperswitch/Gateway/MOLLIE.svg +++ b/public/hyperswitch/Gateway/MOLLIE.svg @@ -1,29 +1,5 @@ - - - - - - - - + + + + diff --git a/public/hyperswitch/Gateway/MULTISAFEPAY.svg b/public/hyperswitch/Gateway/MULTISAFEPAY.svg index 2ab336149..74bb05262 100644 --- a/public/hyperswitch/Gateway/MULTISAFEPAY.svg +++ b/public/hyperswitch/Gateway/MULTISAFEPAY.svg @@ -1,29 +1,6 @@ - - - - - - - - + + + + + diff --git a/public/hyperswitch/Gateway/NEXINETS.svg b/public/hyperswitch/Gateway/NEXINETS.svg index 831c9f5e9..ec146a66b 100644 --- a/public/hyperswitch/Gateway/NEXINETS.svg +++ b/public/hyperswitch/Gateway/NEXINETS.svg @@ -1,29 +1,8 @@ - - - - - - - - + + + + + + + diff --git a/public/hyperswitch/Gateway/NMI.svg b/public/hyperswitch/Gateway/NMI.svg index 0df7ff847..4c2a942da 100644 --- a/public/hyperswitch/Gateway/NMI.svg +++ b/public/hyperswitch/Gateway/NMI.svg @@ -1,29 +1,11 @@ - - - - - - - - + + + + + + + + + + diff --git a/public/hyperswitch/Gateway/NOON.svg b/public/hyperswitch/Gateway/NOON.svg index a402e66cc..63fea799f 100644 --- a/public/hyperswitch/Gateway/NOON.svg +++ b/public/hyperswitch/Gateway/NOON.svg @@ -1,73 +1,6 @@ - - - - - - - - - - - - - - - - - - - - - + + + + + diff --git a/public/hyperswitch/Gateway/NUVEI.svg b/public/hyperswitch/Gateway/NUVEI.svg index b8f69dab3..fbb6c15ad 100644 --- a/public/hyperswitch/Gateway/NUVEI.svg +++ b/public/hyperswitch/Gateway/NUVEI.svg @@ -1,29 +1,17 @@ - - - - - - - - + + + + + + + + + + + + + + + + diff --git a/public/hyperswitch/Gateway/OPENNODE.svg b/public/hyperswitch/Gateway/OPENNODE.svg index 0d56fea6c..256d4e285 100644 --- a/public/hyperswitch/Gateway/OPENNODE.svg +++ b/public/hyperswitch/Gateway/OPENNODE.svg @@ -1,9 +1,20 @@ - - + + + + + + + + + + + + + + - - - - + + + diff --git a/public/hyperswitch/Gateway/PAYME.svg b/public/hyperswitch/Gateway/PAYME.svg index 5e11c8ad5..d3940a755 100644 --- a/public/hyperswitch/Gateway/PAYME.svg +++ b/public/hyperswitch/Gateway/PAYME.svg @@ -1,14 +1,7 @@ - - - - - - - - - - - - - + + + + + + diff --git a/public/hyperswitch/Gateway/PAYPAL.svg b/public/hyperswitch/Gateway/PAYPAL.svg index ec0d03537..f05d99443 100644 --- a/public/hyperswitch/Gateway/PAYPAL.svg +++ b/public/hyperswitch/Gateway/PAYPAL.svg @@ -1,6 +1,7 @@ - - - - + + + + + diff --git a/public/hyperswitch/Gateway/PAYU.svg b/public/hyperswitch/Gateway/PAYU.svg index 86df94018..db9c7fa38 100644 --- a/public/hyperswitch/Gateway/PAYU.svg +++ b/public/hyperswitch/Gateway/PAYU.svg @@ -1,4 +1,12 @@ - - + + + + + + + + + + diff --git a/public/hyperswitch/Gateway/POWERTRANZ.svg b/public/hyperswitch/Gateway/POWERTRANZ.svg index 7d644a886..fd31975f0 100644 --- a/public/hyperswitch/Gateway/POWERTRANZ.svg +++ b/public/hyperswitch/Gateway/POWERTRANZ.svg @@ -1,9 +1,5 @@ - - - - - - - - + + + + diff --git a/public/hyperswitch/Gateway/PROPHETPAY.svg b/public/hyperswitch/Gateway/PROPHETPAY.svg index 822a035c5..55476013f 100644 --- a/public/hyperswitch/Gateway/PROPHETPAY.svg +++ b/public/hyperswitch/Gateway/PROPHETPAY.svg @@ -1,9 +1,6 @@ - - - - - - - - + + + + + diff --git a/public/hyperswitch/Gateway/RAPYD.svg b/public/hyperswitch/Gateway/RAPYD.svg index 58faf2eed..c8c934616 100644 --- a/public/hyperswitch/Gateway/RAPYD.svg +++ b/public/hyperswitch/Gateway/RAPYD.svg @@ -1,29 +1,16 @@ - - - - - - - - + + + + + + + + + + + + + + + diff --git a/public/hyperswitch/Gateway/SHIFT4.svg b/public/hyperswitch/Gateway/SHIFT4.svg index d56d816cd..7c71eb7bd 100644 --- a/public/hyperswitch/Gateway/SHIFT4.svg +++ b/public/hyperswitch/Gateway/SHIFT4.svg @@ -1,29 +1,16 @@ - - - - - - - - + + + + + + + + + + + + + + + diff --git a/public/hyperswitch/Gateway/STAX.svg b/public/hyperswitch/Gateway/STAX.svg index d9d338cc1..3ba608d3f 100644 --- a/public/hyperswitch/Gateway/STAX.svg +++ b/public/hyperswitch/Gateway/STAX.svg @@ -1,29 +1,12 @@ - - - - - - - - + + + + + + + + + + + diff --git a/public/hyperswitch/Gateway/STRIPE.svg b/public/hyperswitch/Gateway/STRIPE.svg index 62a4d5dfa..5c81cb479 100644 --- a/public/hyperswitch/Gateway/STRIPE.svg +++ b/public/hyperswitch/Gateway/STRIPE.svg @@ -1,12 +1,11 @@ - - - - - - + + + + - - - + + + + - + \ No newline at end of file diff --git a/public/hyperswitch/Gateway/TRUSTPAY.svg b/public/hyperswitch/Gateway/TRUSTPAY.svg index 208e4c1b4..98845d079 100644 --- a/public/hyperswitch/Gateway/TRUSTPAY.svg +++ b/public/hyperswitch/Gateway/TRUSTPAY.svg @@ -1,5 +1,6 @@ - - - + + + + diff --git a/public/hyperswitch/Gateway/TSYS.svg b/public/hyperswitch/Gateway/TSYS.svg index db3ea804d..348da1e25 100644 --- a/public/hyperswitch/Gateway/TSYS.svg +++ b/public/hyperswitch/Gateway/TSYS.svg @@ -1,14 +1,8 @@ - - - - - - - - - - - - - + + + + + + + diff --git a/public/hyperswitch/Gateway/VOLT.svg b/public/hyperswitch/Gateway/VOLT.svg index 623d2e63c..f1fd13a0c 100644 --- a/public/hyperswitch/Gateway/VOLT.svg +++ b/public/hyperswitch/Gateway/VOLT.svg @@ -1,17 +1,6 @@ - - - - + + + + + diff --git a/public/hyperswitch/Gateway/WORLDLINE.svg b/public/hyperswitch/Gateway/WORLDLINE.svg index e3d73b7a2..1f0f23fad 100644 --- a/public/hyperswitch/Gateway/WORLDLINE.svg +++ b/public/hyperswitch/Gateway/WORLDLINE.svg @@ -1,26 +1,20 @@ - - - - - - - - + + + + + + + + + + + + + + + + + + + diff --git a/public/hyperswitch/Gateway/WORLDPAY.svg b/public/hyperswitch/Gateway/WORLDPAY.svg index 04cc3c665..7b6a7b169 100644 --- a/public/hyperswitch/Gateway/WORLDPAY.svg +++ b/public/hyperswitch/Gateway/WORLDPAY.svg @@ -1,45 +1,5 @@ - - - - - - - - - - - - - - - - - + + + + diff --git a/public/hyperswitch/Gateway/ZEN.svg b/public/hyperswitch/Gateway/ZEN.svg index c94e7fd9f..10b921919 100644 --- a/public/hyperswitch/Gateway/ZEN.svg +++ b/public/hyperswitch/Gateway/ZEN.svg @@ -1,9 +1,6 @@ - - - - - - - - + + + + + diff --git a/public/hyperswitch/icons/warning.svg b/public/hyperswitch/icons/warning.svg new file mode 100644 index 000000000..b7e56b83f --- /dev/null +++ b/public/hyperswitch/icons/warning.svg @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/public/hyperswitch/module.js b/public/hyperswitch/module.js index d5143e314..632af9f49 100644 --- a/public/hyperswitch/module.js +++ b/public/hyperswitch/module.js @@ -62,3 +62,43 @@ function getParsedJson(str) { throw e; } } + +function getThreeDsKeys() { + if (wasm) { + return wasm.getThreeDsKeys(); + } else { + return []; + } +} + +function getAllKeys() { + if (wasm) { + return wasm.getAllKeys(); + } else { + return []; + } +} + +function getKeyType(str) { + if (wasm) { + return wasm.getKeyType(str); + } else { + return ""; + } +} + +function getAllConnectors() { + if (wasm) { + return wasm.getAllConnectors(); + } else { + return []; + } +} + +function getVariantValues(str) { + if (wasm) { + return wasm.getVariantValues(str); + } else { + return []; + } +} diff --git a/public/hyperswitch/wasm/euclid.d.ts b/public/hyperswitch/wasm/euclid.d.ts index fa5ff3caa..94af4dabd 100644 --- a/public/hyperswitch/wasm/euclid.d.ts +++ b/public/hyperswitch/wasm/euclid.d.ts @@ -1,142 +1,128 @@ /* tslint:disable */ /* eslint-disable */ /** - * This function can be used by the frontend to educate wasm about the forex rates data. - * The input argument is a struct fields base_currency and conversion where later is all the conversions associated with the base_currency - * to all different currencies present. - * @param {any} forex - * @returns {any} - */ +* This function can be used by the frontend to educate wasm about the forex rates data. +* The input argument is a struct fields base_currency and conversion where later is all the conversions associated with the base_currency +* to all different currencies present. +* @param {any} forex +* @returns {any} +*/ export function setForexData(forex: any): any; /** - * This function can be used to perform currency_conversion on the input amount, from_currency, - * to_currency which are all expected to be one of currencies we already have in our Currency - * enum. - * @param {bigint} amount - * @param {any} from_currency - * @param {any} to_currency - * @returns {any} - */ -export function convertCurrency( - amount: bigint, - from_currency: any, - to_currency: any, -): any; -/** - * This function can be used by the frontend to provide the WASM with information about - * all the merchant's connector accounts. The input argument is a vector of all the merchant's - * connector accounts from the API. - * @param {any} mcas - * @returns {any} - */ +* This function can be used to perform currency_conversion on the input amount, from_currency, +* to_currency which are all expected to be one of currencies we already have in our Currency +* enum. +* @param {bigint} amount +* @param {any} from_currency +* @param {any} to_currency +* @returns {any} +*/ +export function convertCurrency(amount: bigint, from_currency: any, to_currency: any): any; +/** +* This function can be used by the frontend to provide the WASM with information about +* all the merchant's connector accounts. The input argument is a vector of all the merchant's +* connector accounts from the API. +* @param {any} mcas +* @returns {any} +*/ export function seedKnowledgeGraph(mcas: any): any; /** - * This function allows the frontend to get all the merchant's configured - * connectors that are valid for a rule based on the conditions specified in - * the rule - * @param {any} rule - * @returns {any} - */ +* This function allows the frontend to get all the merchant's configured +* connectors that are valid for a rule based on the conditions specified in +* the rule +* @param {any} rule +* @returns {any} +*/ export function getValidConnectorsForRule(rule: any): any; /** - * @param {any} js_program - * @returns {any} - */ +* @param {any} js_program +* @returns {any} +*/ export function analyzeProgram(js_program: any): any; /** - * @param {any} program - * @param {any} input - * @returns {any} - */ +* @param {any} program +* @param {any} input +* @returns {any} +*/ export function runProgram(program: any, input: any): any; /** - * @returns {any} - */ +* @returns {any} +*/ export function getAllConnectors(): any; /** - * @returns {any} - */ +* @returns {any} +*/ export function getAllKeys(): any; /** - * @param {string} key - * @returns {string} - */ +* @param {string} key +* @returns {string} +*/ export function getKeyType(key: string): string; /** - * @returns {any} - */ +* @returns {any} +*/ export function getThreeDsKeys(): any; /** - * @returns {any} - */ +* @returns {any} +*/ export function getSurchargeKeys(): any; /** - * @param {string} val - * @returns {string} - */ +* @param {string} val +* @returns {string} +*/ export function parseToString(val: string): string; /** - * @param {string} key - * @returns {any} - */ +* @param {string} key +* @returns {any} +*/ export function getVariantValues(key: string): any; /** - * @param {bigint} n1 - * @param {bigint} n2 - * @returns {bigint} - */ +* @param {bigint} n1 +* @param {bigint} n2 +* @returns {bigint} +*/ export function addTwo(n1: bigint, n2: bigint): bigint; /** - * @param {string} key - * @returns {any} - */ +* @param {string} key +* @returns {any} +*/ export function getConnectorConfig(key: string): any; /** - * @param {string} key - * @returns {any} - */ +* @param {string} key +* @returns {any} +*/ export function getPayoutConnectorConfig(key: string): any; /** - * @param {any} input - * @param {any} response - * @returns {any} - */ +* @param {any} input +* @param {any} response +* @returns {any} +*/ export function getRequestPayload(input: any, response: any): any; /** - * @param {any} input - * @returns {any} - */ +* @param {any} input +* @returns {any} +*/ export function getResponsePayload(input: any): any; /** - * @param {string} key - * @returns {any} - */ +* @param {string} key +* @returns {any} +*/ export function getDescriptionCategory(key: string): any; /** - * - * Function exposed as `wasm` function in js `parse`. Allowing use to extend the functionality and - * usage for web - * @param {string} val - * @returns {string} - */ +* +* Function exposed as `wasm` function in js `parse`. Allowing use to extend the functionality and +* usage for web +* @param {string} val +* @returns {string} +*/ export function parse(val: string): string; -export type InitInput = - | RequestInfo - | URL - | Response - | BufferSource - | WebAssembly.Module; +export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module; export interface InitOutput { readonly memory: WebAssembly.Memory; readonly setForexData: (a: number, b: number) => void; - readonly convertCurrency: ( - a: number, - b: number, - c: number, - d: number, - ) => void; + readonly convertCurrency: (a: number, b: number, c: number, d: number) => void; readonly seedKnowledgeGraph: (a: number, b: number) => void; readonly getValidConnectorsForRule: (a: number, b: number) => void; readonly analyzeProgram: (a: number, b: number) => void; @@ -156,12 +142,7 @@ export interface InitOutput { readonly parse: (a: number, b: number, c: number) => void; readonly parseToString: (a: number, b: number, c: number) => void; readonly __wbindgen_export_0: (a: number, b: number) => number; - readonly __wbindgen_export_1: ( - a: number, - b: number, - c: number, - d: number, - ) => number; + readonly __wbindgen_export_1: (a: number, b: number, c: number, d: number) => number; readonly __wbindgen_add_to_stack_pointer: (a: number) => number; readonly __wbindgen_export_2: (a: number, b: number, c: number) => void; readonly __wbindgen_export_3: (a: number) => void; @@ -169,23 +150,21 @@ export interface InitOutput { export type SyncInitInput = BufferSource | WebAssembly.Module; /** - * Instantiates the given `module`, which can either be bytes or - * a precompiled `WebAssembly.Module`. - * - * @param {SyncInitInput} module - * - * @returns {InitOutput} - */ +* Instantiates the given `module`, which can either be bytes or +* a precompiled `WebAssembly.Module`. +* +* @param {SyncInitInput} module +* +* @returns {InitOutput} +*/ export function initSync(module: SyncInitInput): InitOutput; /** - * If `module_or_path` is {RequestInfo} or {URL}, makes a request and - * for everything else, calls `WebAssembly.instantiate` directly. - * - * @param {InitInput | Promise} module_or_path - * - * @returns {Promise} - */ -export default function __wbg_init( - module_or_path?: InitInput | Promise, -): Promise; +* If `module_or_path` is {RequestInfo} or {URL}, makes a request and +* for everything else, calls `WebAssembly.instantiate` directly. +* +* @param {InitInput | Promise} module_or_path +* +* @returns {Promise} +*/ +export default function __wbg_init (module_or_path?: InitInput | Promise): Promise; diff --git a/public/hyperswitch/wasm/euclid.js b/public/hyperswitch/wasm/euclid.js index be86d0cf0..dadd31f11 100644 --- a/public/hyperswitch/wasm/euclid.js +++ b/public/hyperswitch/wasm/euclid.js @@ -1,30 +1,21 @@ let wasm; -const cachedTextDecoder = - typeof TextDecoder !== "undefined" - ? new TextDecoder("utf-8", { ignoreBOM: true, fatal: true }) - : { - decode: () => { - throw Error("TextDecoder not available"); - }, - }; - -if (typeof TextDecoder !== "undefined") { - cachedTextDecoder.decode(); -} +const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } ); + +if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); }; let cachedUint8Memory0 = null; function getUint8Memory0() { - if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) { - cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer); - } - return cachedUint8Memory0; + if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) { + cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer); + } + return cachedUint8Memory0; } function getStringFromWasm0(ptr, len) { - ptr = ptr >>> 0; - return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len)); + ptr = ptr >>> 0; + return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len)); } const heap = new Array(128).fill(undefined); @@ -34,1017 +25,938 @@ heap.push(undefined, null, true, false); let heap_next = heap.length; function addHeapObject(obj) { - if (heap_next === heap.length) heap.push(heap.length + 1); - const idx = heap_next; - heap_next = heap[idx]; + if (heap_next === heap.length) heap.push(heap.length + 1); + const idx = heap_next; + heap_next = heap[idx]; - heap[idx] = obj; - return idx; + heap[idx] = obj; + return idx; } -function getObject(idx) { - return heap[idx]; -} +function getObject(idx) { return heap[idx]; } function dropObject(idx) { - if (idx < 132) return; - heap[idx] = heap_next; - heap_next = idx; + if (idx < 132) return; + heap[idx] = heap_next; + heap_next = idx; } function takeObject(idx) { - const ret = getObject(idx); - dropObject(idx); - return ret; + const ret = getObject(idx); + dropObject(idx); + return ret; } let WASM_VECTOR_LEN = 0; -const cachedTextEncoder = - typeof TextEncoder !== "undefined" - ? new TextEncoder("utf-8") - : { - encode: () => { - throw Error("TextEncoder not available"); - }, - }; - -const encodeString = - typeof cachedTextEncoder.encodeInto === "function" +const cachedTextEncoder = (typeof TextEncoder !== 'undefined' ? new TextEncoder('utf-8') : { encode: () => { throw Error('TextEncoder not available') } } ); + +const encodeString = (typeof cachedTextEncoder.encodeInto === 'function' ? function (arg, view) { - return cachedTextEncoder.encodeInto(arg, view); - } + return cachedTextEncoder.encodeInto(arg, view); +} : function (arg, view) { - const buf = cachedTextEncoder.encode(arg); - view.set(buf); - return { - read: arg.length, - written: buf.length, - }; - }; + const buf = cachedTextEncoder.encode(arg); + view.set(buf); + return { + read: arg.length, + written: buf.length + }; +}); function passStringToWasm0(arg, malloc, realloc) { - if (realloc === undefined) { - const buf = cachedTextEncoder.encode(arg); - const ptr = malloc(buf.length, 1) >>> 0; - getUint8Memory0() - .subarray(ptr, ptr + buf.length) - .set(buf); - WASM_VECTOR_LEN = buf.length; - return ptr; - } - let len = arg.length; - let ptr = malloc(len, 1) >>> 0; + if (realloc === undefined) { + const buf = cachedTextEncoder.encode(arg); + const ptr = malloc(buf.length, 1) >>> 0; + getUint8Memory0().subarray(ptr, ptr + buf.length).set(buf); + WASM_VECTOR_LEN = buf.length; + return ptr; + } - const mem = getUint8Memory0(); + let len = arg.length; + let ptr = malloc(len, 1) >>> 0; - let offset = 0; + const mem = getUint8Memory0(); - for (; offset < len; offset++) { - const code = arg.charCodeAt(offset); - if (code > 0x7f) break; - mem[ptr + offset] = code; - } + let offset = 0; - if (offset !== len) { - if (offset !== 0) { - arg = arg.slice(offset); + for (; offset < len; offset++) { + const code = arg.charCodeAt(offset); + if (code > 0x7F) break; + mem[ptr + offset] = code; } - ptr = realloc(ptr, len, (len = offset + arg.length * 3), 1) >>> 0; - const view = getUint8Memory0().subarray(ptr + offset, ptr + len); - const ret = encodeString(arg, view); - offset += ret.written; - } + if (offset !== len) { + if (offset !== 0) { + arg = arg.slice(offset); + } + ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0; + const view = getUint8Memory0().subarray(ptr + offset, ptr + len); + const ret = encodeString(arg, view); + + offset += ret.written; + } - WASM_VECTOR_LEN = offset; - return ptr; + WASM_VECTOR_LEN = offset; + return ptr; } function isLikeNone(x) { - return x === undefined || x === null; + return x === undefined || x === null; } let cachedInt32Memory0 = null; function getInt32Memory0() { - if (cachedInt32Memory0 === null || cachedInt32Memory0.byteLength === 0) { - cachedInt32Memory0 = new Int32Array(wasm.memory.buffer); - } - return cachedInt32Memory0; + if (cachedInt32Memory0 === null || cachedInt32Memory0.byteLength === 0) { + cachedInt32Memory0 = new Int32Array(wasm.memory.buffer); + } + return cachedInt32Memory0; } let cachedBigInt64Memory0 = null; function getBigInt64Memory0() { - if ( - cachedBigInt64Memory0 === null || - cachedBigInt64Memory0.byteLength === 0 - ) { - cachedBigInt64Memory0 = new BigInt64Array(wasm.memory.buffer); - } - return cachedBigInt64Memory0; + if (cachedBigInt64Memory0 === null || cachedBigInt64Memory0.byteLength === 0) { + cachedBigInt64Memory0 = new BigInt64Array(wasm.memory.buffer); + } + return cachedBigInt64Memory0; } let cachedFloat64Memory0 = null; function getFloat64Memory0() { - if (cachedFloat64Memory0 === null || cachedFloat64Memory0.byteLength === 0) { - cachedFloat64Memory0 = new Float64Array(wasm.memory.buffer); - } - return cachedFloat64Memory0; + if (cachedFloat64Memory0 === null || cachedFloat64Memory0.byteLength === 0) { + cachedFloat64Memory0 = new Float64Array(wasm.memory.buffer); + } + return cachedFloat64Memory0; } function debugString(val) { - // primitive types - const type = typeof val; - if (type == "number" || type == "boolean" || val == null) { - return `${val}`; - } - if (type == "string") { - return `"${val}"`; - } - if (type == "symbol") { - const description = val.description; - if (description == null) { - return "Symbol"; - } else { - return `Symbol(${description})`; + // primitive types + const type = typeof val; + if (type == 'number' || type == 'boolean' || val == null) { + return `${val}`; } - } - if (type == "function") { - const name = val.name; - if (typeof name == "string" && name.length > 0) { - return `Function(${name})`; - } else { - return "Function"; + if (type == 'string') { + return `"${val}"`; } - } - // objects - if (Array.isArray(val)) { - const length = val.length; - let debug = "["; - if (length > 0) { - debug += debugString(val[0]); + if (type == 'symbol') { + const description = val.description; + if (description == null) { + return 'Symbol'; + } else { + return `Symbol(${description})`; + } } - for (let i = 1; i < length; i++) { - debug += ", " + debugString(val[i]); + if (type == 'function') { + const name = val.name; + if (typeof name == 'string' && name.length > 0) { + return `Function(${name})`; + } else { + return 'Function'; + } } - debug += "]"; - return debug; - } - // Test for built-in - const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val)); - let className; - if (builtInMatches.length > 1) { - className = builtInMatches[1]; - } else { - // Failed to match the standard '[object ClassName]' - return toString.call(val); - } - if (className == "Object") { - // we're a user defined class or Object - // JSON.stringify avoids problems with cycles, and is generally much - // easier than looping through ownProperties of `val`. - try { - return "Object(" + JSON.stringify(val) + ")"; - } catch (_) { - return "Object"; + // objects + if (Array.isArray(val)) { + const length = val.length; + let debug = '['; + if (length > 0) { + debug += debugString(val[0]); + } + for(let i = 1; i < length; i++) { + debug += ', ' + debugString(val[i]); + } + debug += ']'; + return debug; + } + // Test for built-in + const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val)); + let className; + if (builtInMatches.length > 1) { + className = builtInMatches[1]; + } else { + // Failed to match the standard '[object ClassName]' + return toString.call(val); } - } - // errors - if (val instanceof Error) { - return `${val.name}: ${val.message}\n${val.stack}`; - } - // TODO we could test for more things here, like `Set`s and `Map`s. - return className; + if (className == 'Object') { + // we're a user defined class or Object + // JSON.stringify avoids problems with cycles, and is generally much + // easier than looping through ownProperties of `val`. + try { + return 'Object(' + JSON.stringify(val) + ')'; + } catch (_) { + return 'Object'; + } + } + // errors + if (val instanceof Error) { + return `${val.name}: ${val.message}\n${val.stack}`; + } + // TODO we could test for more things here, like `Set`s and `Map`s. + return className; } /** - * This function can be used by the frontend to educate wasm about the forex rates data. - * The input argument is a struct fields base_currency and conversion where later is all the conversions associated with the base_currency - * to all different currencies present. - * @param {any} forex - * @returns {any} - */ +* This function can be used by the frontend to educate wasm about the forex rates data. +* The input argument is a struct fields base_currency and conversion where later is all the conversions associated with the base_currency +* to all different currencies present. +* @param {any} forex +* @returns {any} +*/ export function setForexData(forex) { - try { - const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); - wasm.setForexData(retptr, addHeapObject(forex)); - var r0 = getInt32Memory0()[retptr / 4 + 0]; - var r1 = getInt32Memory0()[retptr / 4 + 1]; - var r2 = getInt32Memory0()[retptr / 4 + 2]; - if (r2) { - throw takeObject(r1); + try { + const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); + wasm.setForexData(retptr, addHeapObject(forex)); + var r0 = getInt32Memory0()[retptr / 4 + 0]; + var r1 = getInt32Memory0()[retptr / 4 + 1]; + var r2 = getInt32Memory0()[retptr / 4 + 2]; + if (r2) { + throw takeObject(r1); + } + return takeObject(r0); + } finally { + wasm.__wbindgen_add_to_stack_pointer(16); } - return takeObject(r0); - } finally { - wasm.__wbindgen_add_to_stack_pointer(16); - } } /** - * This function can be used to perform currency_conversion on the input amount, from_currency, - * to_currency which are all expected to be one of currencies we already have in our Currency - * enum. - * @param {bigint} amount - * @param {any} from_currency - * @param {any} to_currency - * @returns {any} - */ +* This function can be used to perform currency_conversion on the input amount, from_currency, +* to_currency which are all expected to be one of currencies we already have in our Currency +* enum. +* @param {bigint} amount +* @param {any} from_currency +* @param {any} to_currency +* @returns {any} +*/ export function convertCurrency(amount, from_currency, to_currency) { - try { - const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); - wasm.convertCurrency( - retptr, - amount, - addHeapObject(from_currency), - addHeapObject(to_currency), - ); - var r0 = getInt32Memory0()[retptr / 4 + 0]; - var r1 = getInt32Memory0()[retptr / 4 + 1]; - var r2 = getInt32Memory0()[retptr / 4 + 2]; - if (r2) { - throw takeObject(r1); + try { + const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); + wasm.convertCurrency(retptr, amount, addHeapObject(from_currency), addHeapObject(to_currency)); + var r0 = getInt32Memory0()[retptr / 4 + 0]; + var r1 = getInt32Memory0()[retptr / 4 + 1]; + var r2 = getInt32Memory0()[retptr / 4 + 2]; + if (r2) { + throw takeObject(r1); + } + return takeObject(r0); + } finally { + wasm.__wbindgen_add_to_stack_pointer(16); } - return takeObject(r0); - } finally { - wasm.__wbindgen_add_to_stack_pointer(16); - } } /** - * This function can be used by the frontend to provide the WASM with information about - * all the merchant's connector accounts. The input argument is a vector of all the merchant's - * connector accounts from the API. - * @param {any} mcas - * @returns {any} - */ +* This function can be used by the frontend to provide the WASM with information about +* all the merchant's connector accounts. The input argument is a vector of all the merchant's +* connector accounts from the API. +* @param {any} mcas +* @returns {any} +*/ export function seedKnowledgeGraph(mcas) { - try { - const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); - wasm.seedKnowledgeGraph(retptr, addHeapObject(mcas)); - var r0 = getInt32Memory0()[retptr / 4 + 0]; - var r1 = getInt32Memory0()[retptr / 4 + 1]; - var r2 = getInt32Memory0()[retptr / 4 + 2]; - if (r2) { - throw takeObject(r1); + try { + const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); + wasm.seedKnowledgeGraph(retptr, addHeapObject(mcas)); + var r0 = getInt32Memory0()[retptr / 4 + 0]; + var r1 = getInt32Memory0()[retptr / 4 + 1]; + var r2 = getInt32Memory0()[retptr / 4 + 2]; + if (r2) { + throw takeObject(r1); + } + return takeObject(r0); + } finally { + wasm.__wbindgen_add_to_stack_pointer(16); } - return takeObject(r0); - } finally { - wasm.__wbindgen_add_to_stack_pointer(16); - } } /** - * This function allows the frontend to get all the merchant's configured - * connectors that are valid for a rule based on the conditions specified in - * the rule - * @param {any} rule - * @returns {any} - */ +* This function allows the frontend to get all the merchant's configured +* connectors that are valid for a rule based on the conditions specified in +* the rule +* @param {any} rule +* @returns {any} +*/ export function getValidConnectorsForRule(rule) { - try { - const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); - wasm.getValidConnectorsForRule(retptr, addHeapObject(rule)); - var r0 = getInt32Memory0()[retptr / 4 + 0]; - var r1 = getInt32Memory0()[retptr / 4 + 1]; - var r2 = getInt32Memory0()[retptr / 4 + 2]; - if (r2) { - throw takeObject(r1); + try { + const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); + wasm.getValidConnectorsForRule(retptr, addHeapObject(rule)); + var r0 = getInt32Memory0()[retptr / 4 + 0]; + var r1 = getInt32Memory0()[retptr / 4 + 1]; + var r2 = getInt32Memory0()[retptr / 4 + 2]; + if (r2) { + throw takeObject(r1); + } + return takeObject(r0); + } finally { + wasm.__wbindgen_add_to_stack_pointer(16); } - return takeObject(r0); - } finally { - wasm.__wbindgen_add_to_stack_pointer(16); - } } /** - * @param {any} js_program - * @returns {any} - */ +* @param {any} js_program +* @returns {any} +*/ export function analyzeProgram(js_program) { - try { - const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); - wasm.analyzeProgram(retptr, addHeapObject(js_program)); - var r0 = getInt32Memory0()[retptr / 4 + 0]; - var r1 = getInt32Memory0()[retptr / 4 + 1]; - var r2 = getInt32Memory0()[retptr / 4 + 2]; - if (r2) { - throw takeObject(r1); + try { + const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); + wasm.analyzeProgram(retptr, addHeapObject(js_program)); + var r0 = getInt32Memory0()[retptr / 4 + 0]; + var r1 = getInt32Memory0()[retptr / 4 + 1]; + var r2 = getInt32Memory0()[retptr / 4 + 2]; + if (r2) { + throw takeObject(r1); + } + return takeObject(r0); + } finally { + wasm.__wbindgen_add_to_stack_pointer(16); } - return takeObject(r0); - } finally { - wasm.__wbindgen_add_to_stack_pointer(16); - } } /** - * @param {any} program - * @param {any} input - * @returns {any} - */ +* @param {any} program +* @param {any} input +* @returns {any} +*/ export function runProgram(program, input) { - try { - const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); - wasm.runProgram(retptr, addHeapObject(program), addHeapObject(input)); - var r0 = getInt32Memory0()[retptr / 4 + 0]; - var r1 = getInt32Memory0()[retptr / 4 + 1]; - var r2 = getInt32Memory0()[retptr / 4 + 2]; - if (r2) { - throw takeObject(r1); + try { + const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); + wasm.runProgram(retptr, addHeapObject(program), addHeapObject(input)); + var r0 = getInt32Memory0()[retptr / 4 + 0]; + var r1 = getInt32Memory0()[retptr / 4 + 1]; + var r2 = getInt32Memory0()[retptr / 4 + 2]; + if (r2) { + throw takeObject(r1); + } + return takeObject(r0); + } finally { + wasm.__wbindgen_add_to_stack_pointer(16); } - return takeObject(r0); - } finally { - wasm.__wbindgen_add_to_stack_pointer(16); - } } /** - * @returns {any} - */ +* @returns {any} +*/ export function getAllConnectors() { - try { - const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); - wasm.getAllConnectors(retptr); - var r0 = getInt32Memory0()[retptr / 4 + 0]; - var r1 = getInt32Memory0()[retptr / 4 + 1]; - var r2 = getInt32Memory0()[retptr / 4 + 2]; - if (r2) { - throw takeObject(r1); + try { + const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); + wasm.getAllConnectors(retptr); + var r0 = getInt32Memory0()[retptr / 4 + 0]; + var r1 = getInt32Memory0()[retptr / 4 + 1]; + var r2 = getInt32Memory0()[retptr / 4 + 2]; + if (r2) { + throw takeObject(r1); + } + return takeObject(r0); + } finally { + wasm.__wbindgen_add_to_stack_pointer(16); } - return takeObject(r0); - } finally { - wasm.__wbindgen_add_to_stack_pointer(16); - } } /** - * @returns {any} - */ +* @returns {any} +*/ export function getAllKeys() { - try { - const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); - wasm.getAllKeys(retptr); - var r0 = getInt32Memory0()[retptr / 4 + 0]; - var r1 = getInt32Memory0()[retptr / 4 + 1]; - var r2 = getInt32Memory0()[retptr / 4 + 2]; - if (r2) { - throw takeObject(r1); + try { + const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); + wasm.getAllKeys(retptr); + var r0 = getInt32Memory0()[retptr / 4 + 0]; + var r1 = getInt32Memory0()[retptr / 4 + 1]; + var r2 = getInt32Memory0()[retptr / 4 + 2]; + if (r2) { + throw takeObject(r1); + } + return takeObject(r0); + } finally { + wasm.__wbindgen_add_to_stack_pointer(16); } - return takeObject(r0); - } finally { - wasm.__wbindgen_add_to_stack_pointer(16); - } } /** - * @param {string} key - * @returns {string} - */ +* @param {string} key +* @returns {string} +*/ export function getKeyType(key) { - let deferred3_0; - let deferred3_1; - try { - const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); - const ptr0 = passStringToWasm0( - key, - wasm.__wbindgen_export_0, - wasm.__wbindgen_export_1, - ); - const len0 = WASM_VECTOR_LEN; - wasm.getKeyType(retptr, ptr0, len0); - var r0 = getInt32Memory0()[retptr / 4 + 0]; - var r1 = getInt32Memory0()[retptr / 4 + 1]; - var r2 = getInt32Memory0()[retptr / 4 + 2]; - var r3 = getInt32Memory0()[retptr / 4 + 3]; - var ptr2 = r0; - var len2 = r1; - if (r3) { - ptr2 = 0; - len2 = 0; - throw takeObject(r2); + let deferred3_0; + let deferred3_1; + try { + const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); + const ptr0 = passStringToWasm0(key, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1); + const len0 = WASM_VECTOR_LEN; + wasm.getKeyType(retptr, ptr0, len0); + var r0 = getInt32Memory0()[retptr / 4 + 0]; + var r1 = getInt32Memory0()[retptr / 4 + 1]; + var r2 = getInt32Memory0()[retptr / 4 + 2]; + var r3 = getInt32Memory0()[retptr / 4 + 3]; + var ptr2 = r0; + var len2 = r1; + if (r3) { + ptr2 = 0; len2 = 0; + throw takeObject(r2); + } + deferred3_0 = ptr2; + deferred3_1 = len2; + return getStringFromWasm0(ptr2, len2); + } finally { + wasm.__wbindgen_add_to_stack_pointer(16); + wasm.__wbindgen_export_2(deferred3_0, deferred3_1, 1); } - deferred3_0 = ptr2; - deferred3_1 = len2; - return getStringFromWasm0(ptr2, len2); - } finally { - wasm.__wbindgen_add_to_stack_pointer(16); - wasm.__wbindgen_export_2(deferred3_0, deferred3_1, 1); - } } /** - * @returns {any} - */ +* @returns {any} +*/ export function getThreeDsKeys() { - try { - const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); - wasm.getThreeDsKeys(retptr); - var r0 = getInt32Memory0()[retptr / 4 + 0]; - var r1 = getInt32Memory0()[retptr / 4 + 1]; - var r2 = getInt32Memory0()[retptr / 4 + 2]; - if (r2) { - throw takeObject(r1); + try { + const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); + wasm.getThreeDsKeys(retptr); + var r0 = getInt32Memory0()[retptr / 4 + 0]; + var r1 = getInt32Memory0()[retptr / 4 + 1]; + var r2 = getInt32Memory0()[retptr / 4 + 2]; + if (r2) { + throw takeObject(r1); + } + return takeObject(r0); + } finally { + wasm.__wbindgen_add_to_stack_pointer(16); } - return takeObject(r0); - } finally { - wasm.__wbindgen_add_to_stack_pointer(16); - } } /** - * @returns {any} - */ +* @returns {any} +*/ export function getSurchargeKeys() { - try { - const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); - wasm.getSurchargeKeys(retptr); - var r0 = getInt32Memory0()[retptr / 4 + 0]; - var r1 = getInt32Memory0()[retptr / 4 + 1]; - var r2 = getInt32Memory0()[retptr / 4 + 2]; - if (r2) { - throw takeObject(r1); + try { + const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); + wasm.getSurchargeKeys(retptr); + var r0 = getInt32Memory0()[retptr / 4 + 0]; + var r1 = getInt32Memory0()[retptr / 4 + 1]; + var r2 = getInt32Memory0()[retptr / 4 + 2]; + if (r2) { + throw takeObject(r1); + } + return takeObject(r0); + } finally { + wasm.__wbindgen_add_to_stack_pointer(16); } - return takeObject(r0); - } finally { - wasm.__wbindgen_add_to_stack_pointer(16); - } } /** - * @param {string} val - * @returns {string} - */ +* @param {string} val +* @returns {string} +*/ export function parseToString(val) { - let deferred2_0; - let deferred2_1; - try { - const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); - const ptr0 = passStringToWasm0( - val, - wasm.__wbindgen_export_0, - wasm.__wbindgen_export_1, - ); - const len0 = WASM_VECTOR_LEN; - wasm.parse(retptr, ptr0, len0); - var r0 = getInt32Memory0()[retptr / 4 + 0]; - var r1 = getInt32Memory0()[retptr / 4 + 1]; - deferred2_0 = r0; - deferred2_1 = r1; - return getStringFromWasm0(r0, r1); - } finally { - wasm.__wbindgen_add_to_stack_pointer(16); - wasm.__wbindgen_export_2(deferred2_0, deferred2_1, 1); - } + let deferred2_0; + let deferred2_1; + try { + const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); + const ptr0 = passStringToWasm0(val, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1); + const len0 = WASM_VECTOR_LEN; + wasm.parse(retptr, ptr0, len0); + var r0 = getInt32Memory0()[retptr / 4 + 0]; + var r1 = getInt32Memory0()[retptr / 4 + 1]; + deferred2_0 = r0; + deferred2_1 = r1; + return getStringFromWasm0(r0, r1); + } finally { + wasm.__wbindgen_add_to_stack_pointer(16); + wasm.__wbindgen_export_2(deferred2_0, deferred2_1, 1); + } } /** - * @param {string} key - * @returns {any} - */ +* @param {string} key +* @returns {any} +*/ export function getVariantValues(key) { - try { - const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); - const ptr0 = passStringToWasm0( - key, - wasm.__wbindgen_export_0, - wasm.__wbindgen_export_1, - ); - const len0 = WASM_VECTOR_LEN; - wasm.getVariantValues(retptr, ptr0, len0); - var r0 = getInt32Memory0()[retptr / 4 + 0]; - var r1 = getInt32Memory0()[retptr / 4 + 1]; - var r2 = getInt32Memory0()[retptr / 4 + 2]; - if (r2) { - throw takeObject(r1); + try { + const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); + const ptr0 = passStringToWasm0(key, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1); + const len0 = WASM_VECTOR_LEN; + wasm.getVariantValues(retptr, ptr0, len0); + var r0 = getInt32Memory0()[retptr / 4 + 0]; + var r1 = getInt32Memory0()[retptr / 4 + 1]; + var r2 = getInt32Memory0()[retptr / 4 + 2]; + if (r2) { + throw takeObject(r1); + } + return takeObject(r0); + } finally { + wasm.__wbindgen_add_to_stack_pointer(16); } - return takeObject(r0); - } finally { - wasm.__wbindgen_add_to_stack_pointer(16); - } } /** - * @param {bigint} n1 - * @param {bigint} n2 - * @returns {bigint} - */ +* @param {bigint} n1 +* @param {bigint} n2 +* @returns {bigint} +*/ export function addTwo(n1, n2) { - const ret = wasm.addTwo(n1, n2); - return ret; + const ret = wasm.addTwo(n1, n2); + return ret; } /** - * @param {string} key - * @returns {any} - */ +* @param {string} key +* @returns {any} +*/ export function getConnectorConfig(key) { - try { - const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); - const ptr0 = passStringToWasm0( - key, - wasm.__wbindgen_export_0, - wasm.__wbindgen_export_1, - ); - const len0 = WASM_VECTOR_LEN; - wasm.getConnectorConfig(retptr, ptr0, len0); - var r0 = getInt32Memory0()[retptr / 4 + 0]; - var r1 = getInt32Memory0()[retptr / 4 + 1]; - var r2 = getInt32Memory0()[retptr / 4 + 2]; - if (r2) { - throw takeObject(r1); + try { + const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); + const ptr0 = passStringToWasm0(key, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1); + const len0 = WASM_VECTOR_LEN; + wasm.getConnectorConfig(retptr, ptr0, len0); + var r0 = getInt32Memory0()[retptr / 4 + 0]; + var r1 = getInt32Memory0()[retptr / 4 + 1]; + var r2 = getInt32Memory0()[retptr / 4 + 2]; + if (r2) { + throw takeObject(r1); + } + return takeObject(r0); + } finally { + wasm.__wbindgen_add_to_stack_pointer(16); } - return takeObject(r0); - } finally { - wasm.__wbindgen_add_to_stack_pointer(16); - } } /** - * @param {string} key - * @returns {any} - */ +* @param {string} key +* @returns {any} +*/ export function getPayoutConnectorConfig(key) { - try { - const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); - const ptr0 = passStringToWasm0( - key, - wasm.__wbindgen_export_0, - wasm.__wbindgen_export_1, - ); - const len0 = WASM_VECTOR_LEN; - wasm.getPayoutConnectorConfig(retptr, ptr0, len0); - var r0 = getInt32Memory0()[retptr / 4 + 0]; - var r1 = getInt32Memory0()[retptr / 4 + 1]; - var r2 = getInt32Memory0()[retptr / 4 + 2]; - if (r2) { - throw takeObject(r1); + try { + const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); + const ptr0 = passStringToWasm0(key, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1); + const len0 = WASM_VECTOR_LEN; + wasm.getPayoutConnectorConfig(retptr, ptr0, len0); + var r0 = getInt32Memory0()[retptr / 4 + 0]; + var r1 = getInt32Memory0()[retptr / 4 + 1]; + var r2 = getInt32Memory0()[retptr / 4 + 2]; + if (r2) { + throw takeObject(r1); + } + return takeObject(r0); + } finally { + wasm.__wbindgen_add_to_stack_pointer(16); } - return takeObject(r0); - } finally { - wasm.__wbindgen_add_to_stack_pointer(16); - } } /** - * @param {any} input - * @param {any} response - * @returns {any} - */ +* @param {any} input +* @param {any} response +* @returns {any} +*/ export function getRequestPayload(input, response) { - try { - const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); - wasm.getRequestPayload( - retptr, - addHeapObject(input), - addHeapObject(response), - ); - var r0 = getInt32Memory0()[retptr / 4 + 0]; - var r1 = getInt32Memory0()[retptr / 4 + 1]; - var r2 = getInt32Memory0()[retptr / 4 + 2]; - if (r2) { - throw takeObject(r1); + try { + const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); + wasm.getRequestPayload(retptr, addHeapObject(input), addHeapObject(response)); + var r0 = getInt32Memory0()[retptr / 4 + 0]; + var r1 = getInt32Memory0()[retptr / 4 + 1]; + var r2 = getInt32Memory0()[retptr / 4 + 2]; + if (r2) { + throw takeObject(r1); + } + return takeObject(r0); + } finally { + wasm.__wbindgen_add_to_stack_pointer(16); } - return takeObject(r0); - } finally { - wasm.__wbindgen_add_to_stack_pointer(16); - } } /** - * @param {any} input - * @returns {any} - */ +* @param {any} input +* @returns {any} +*/ export function getResponsePayload(input) { - try { - const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); - wasm.getResponsePayload(retptr, addHeapObject(input)); - var r0 = getInt32Memory0()[retptr / 4 + 0]; - var r1 = getInt32Memory0()[retptr / 4 + 1]; - var r2 = getInt32Memory0()[retptr / 4 + 2]; - if (r2) { - throw takeObject(r1); + try { + const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); + wasm.getResponsePayload(retptr, addHeapObject(input)); + var r0 = getInt32Memory0()[retptr / 4 + 0]; + var r1 = getInt32Memory0()[retptr / 4 + 1]; + var r2 = getInt32Memory0()[retptr / 4 + 2]; + if (r2) { + throw takeObject(r1); + } + return takeObject(r0); + } finally { + wasm.__wbindgen_add_to_stack_pointer(16); } - return takeObject(r0); - } finally { - wasm.__wbindgen_add_to_stack_pointer(16); - } } /** - * @param {string} key - * @returns {any} - */ +* @param {string} key +* @returns {any} +*/ export function getDescriptionCategory(key) { - try { - const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); - const ptr0 = passStringToWasm0( - key, - wasm.__wbindgen_export_0, - wasm.__wbindgen_export_1, - ); - const len0 = WASM_VECTOR_LEN; - wasm.getDescriptionCategory(retptr, ptr0, len0); - var r0 = getInt32Memory0()[retptr / 4 + 0]; - var r1 = getInt32Memory0()[retptr / 4 + 1]; - var r2 = getInt32Memory0()[retptr / 4 + 2]; - if (r2) { - throw takeObject(r1); + try { + const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); + const ptr0 = passStringToWasm0(key, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1); + const len0 = WASM_VECTOR_LEN; + wasm.getDescriptionCategory(retptr, ptr0, len0); + var r0 = getInt32Memory0()[retptr / 4 + 0]; + var r1 = getInt32Memory0()[retptr / 4 + 1]; + var r2 = getInt32Memory0()[retptr / 4 + 2]; + if (r2) { + throw takeObject(r1); + } + return takeObject(r0); + } finally { + wasm.__wbindgen_add_to_stack_pointer(16); } - return takeObject(r0); - } finally { - wasm.__wbindgen_add_to_stack_pointer(16); - } } function handleError(f, args) { - try { - return f.apply(this, args); - } catch (e) { - wasm.__wbindgen_export_3(addHeapObject(e)); - } + try { + return f.apply(this, args); + } catch (e) { + wasm.__wbindgen_export_3(addHeapObject(e)); + } } /** - * - * Function exposed as `wasm` function in js `parse`. Allowing use to extend the functionality and - * usage for web - * @param {string} val - * @returns {string} - */ +* +* Function exposed as `wasm` function in js `parse`. Allowing use to extend the functionality and +* usage for web +* @param {string} val +* @returns {string} +*/ export function parse(val) { - let deferred2_0; - let deferred2_1; - try { - const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); - const ptr0 = passStringToWasm0( - val, - wasm.__wbindgen_export_0, - wasm.__wbindgen_export_1, - ); - const len0 = WASM_VECTOR_LEN; - wasm.parse(retptr, ptr0, len0); - var r0 = getInt32Memory0()[retptr / 4 + 0]; - var r1 = getInt32Memory0()[retptr / 4 + 1]; - deferred2_0 = r0; - deferred2_1 = r1; - return getStringFromWasm0(r0, r1); - } finally { - wasm.__wbindgen_add_to_stack_pointer(16); - wasm.__wbindgen_export_2(deferred2_0, deferred2_1, 1); - } + let deferred2_0; + let deferred2_1; + try { + const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); + const ptr0 = passStringToWasm0(val, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1); + const len0 = WASM_VECTOR_LEN; + wasm.parse(retptr, ptr0, len0); + var r0 = getInt32Memory0()[retptr / 4 + 0]; + var r1 = getInt32Memory0()[retptr / 4 + 1]; + deferred2_0 = r0; + deferred2_1 = r1; + return getStringFromWasm0(r0, r1); + } finally { + wasm.__wbindgen_add_to_stack_pointer(16); + wasm.__wbindgen_export_2(deferred2_0, deferred2_1, 1); + } } async function __wbg_load(module, imports) { - if (typeof Response === "function" && module instanceof Response) { - if (typeof WebAssembly.instantiateStreaming === "function") { - try { - return await WebAssembly.instantiateStreaming(module, imports); - } catch (e) { - if (module.headers.get("Content-Type") != "application/wasm") { - console.warn( - "`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", - e, - ); - } else { - throw e; + if (typeof Response === 'function' && module instanceof Response) { + if (typeof WebAssembly.instantiateStreaming === 'function') { + try { + return await WebAssembly.instantiateStreaming(module, imports); + + } catch (e) { + if (module.headers.get('Content-Type') != 'application/wasm') { + console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e); + + } else { + throw e; + } + } } - } - } - const bytes = await module.arrayBuffer(); - return await WebAssembly.instantiate(bytes, imports); - } else { - const instance = await WebAssembly.instantiate(module, imports); + const bytes = await module.arrayBuffer(); + return await WebAssembly.instantiate(bytes, imports); - if (instance instanceof WebAssembly.Instance) { - return { instance, module }; } else { - return instance; + const instance = await WebAssembly.instantiate(module, imports); + + if (instance instanceof WebAssembly.Instance) { + return { instance, module }; + + } else { + return instance; + } } - } } function __wbg_get_imports() { - const imports = {}; - imports.wbg = {}; - imports.wbg.__wbindgen_string_new = function (arg0, arg1) { - const ret = getStringFromWasm0(arg0, arg1); - return addHeapObject(ret); - }; - imports.wbg.__wbindgen_object_drop_ref = function (arg0) { - takeObject(arg0); - }; - imports.wbg.__wbg_set_bedc3d02d0f05eb0 = function (arg0, arg1, arg2) { - const ret = getObject(arg0).set(getObject(arg1), getObject(arg2)); - return addHeapObject(ret); - }; - imports.wbg.__wbindgen_is_string = function (arg0) { - const ret = typeof getObject(arg0) === "string"; - return ret; - }; - imports.wbg.__wbindgen_error_new = function (arg0, arg1) { - const ret = new Error(getStringFromWasm0(arg0, arg1)); - return addHeapObject(ret); - }; - imports.wbg.__wbg_set_841ac57cff3d672b = function (arg0, arg1, arg2) { - getObject(arg0)[takeObject(arg1)] = takeObject(arg2); - }; - imports.wbg.__wbg_new_b51585de1b234aff = function () { - const ret = new Object(); - return addHeapObject(ret); - }; - imports.wbg.__wbindgen_is_object = function (arg0) { - const val = getObject(arg0); - const ret = typeof val === "object" && val !== null; - return ret; - }; - imports.wbg.__wbg_entries_e51f29c7bba0c054 = function (arg0) { - const ret = Object.entries(getObject(arg0)); - return addHeapObject(ret); - }; - imports.wbg.__wbg_length_fff51ee6522a1a18 = function (arg0) { - const ret = getObject(arg0).length; - return ret; - }; - imports.wbg.__wbg_get_44be0491f933a435 = function (arg0, arg1) { - const ret = getObject(arg0)[arg1 >>> 0]; - return addHeapObject(ret); - }; - imports.wbg.__wbindgen_string_get = function (arg0, arg1) { - const obj = getObject(arg1); - const ret = typeof obj === "string" ? obj : undefined; - var ptr1 = isLikeNone(ret) - ? 0 - : passStringToWasm0( - ret, - wasm.__wbindgen_export_0, - wasm.__wbindgen_export_1, - ); - var len1 = WASM_VECTOR_LEN; - getInt32Memory0()[arg0 / 4 + 1] = len1; - getInt32Memory0()[arg0 / 4 + 0] = ptr1; - }; - imports.wbg.__wbg_new_56693dbed0c32988 = function () { - const ret = new Map(); - return addHeapObject(ret); - }; - imports.wbg.__wbindgen_number_new = function (arg0) { - const ret = arg0; - return addHeapObject(ret); - }; - imports.wbg.__wbindgen_bigint_from_i64 = function (arg0) { - const ret = arg0; - return addHeapObject(ret); - }; - imports.wbg.__wbindgen_jsval_loose_eq = function (arg0, arg1) { - const ret = getObject(arg0) == getObject(arg1); - return ret; - }; - imports.wbg.__wbindgen_boolean_get = function (arg0) { - const v = getObject(arg0); - const ret = typeof v === "boolean" ? (v ? 1 : 0) : 2; - return ret; - }; - imports.wbg.__wbindgen_is_bigint = function (arg0) { - const ret = typeof getObject(arg0) === "bigint"; - return ret; - }; - imports.wbg.__wbindgen_bigint_get_as_i64 = function (arg0, arg1) { - const v = getObject(arg1); - const ret = typeof v === "bigint" ? v : undefined; - getBigInt64Memory0()[arg0 / 8 + 1] = isLikeNone(ret) ? BigInt(0) : ret; - getInt32Memory0()[arg0 / 4 + 0] = !isLikeNone(ret); - }; - imports.wbg.__wbindgen_jsval_eq = function (arg0, arg1) { - const ret = getObject(arg0) === getObject(arg1); - return ret; - }; - imports.wbg.__wbindgen_bigint_from_u64 = function (arg0) { - const ret = BigInt.asUintN(64, arg0); - return addHeapObject(ret); - }; - imports.wbg.__wbindgen_number_get = function (arg0, arg1) { - const obj = getObject(arg1); - const ret = typeof obj === "number" ? obj : undefined; - getFloat64Memory0()[arg0 / 8 + 1] = isLikeNone(ret) ? 0 : ret; - getInt32Memory0()[arg0 / 4 + 0] = !isLikeNone(ret); - }; - imports.wbg.__wbg_isSafeInteger_bb8e18dd21c97288 = function (arg0) { - const ret = Number.isSafeInteger(getObject(arg0)); - return ret; - }; - imports.wbg.__wbg_isArray_4c24b343cb13cfb1 = function (arg0) { - const ret = Array.isArray(getObject(arg0)); - return ret; - }; - imports.wbg.__wbg_iterator_97f0c81209c6c35a = function () { - const ret = Symbol.iterator; - return addHeapObject(ret); - }; - imports.wbg.__wbindgen_in = function (arg0, arg1) { - const ret = getObject(arg0) in getObject(arg1); - return ret; - }; - imports.wbg.__wbg_new_898a68150f225f2e = function () { - const ret = new Array(); - return addHeapObject(ret); - }; - imports.wbg.__wbg_set_502d29070ea18557 = function (arg0, arg1, arg2) { - getObject(arg0)[arg1 >>> 0] = takeObject(arg2); - }; - imports.wbg.__wbg_String_88810dfeb4021902 = function (arg0, arg1) { - const ret = String(getObject(arg1)); - const ptr1 = passStringToWasm0( - ret, - wasm.__wbindgen_export_0, - wasm.__wbindgen_export_1, - ); - const len1 = WASM_VECTOR_LEN; - getInt32Memory0()[arg0 / 4 + 1] = len1; - getInt32Memory0()[arg0 / 4 + 0] = ptr1; - }; - imports.wbg.__wbg_getwithrefkey_5e6d9547403deab8 = function (arg0, arg1) { - const ret = getObject(arg0)[getObject(arg1)]; - return addHeapObject(ret); - }; - imports.wbg.__wbindgen_is_undefined = function (arg0) { - const ret = getObject(arg0) === undefined; - return ret; - }; - imports.wbg.__wbg_next_ddb3312ca1c4e32a = function () { - return handleError(function (arg0) { - const ret = getObject(arg0).next(); - return addHeapObject(ret); - }, arguments); - }; - imports.wbg.__wbg_done_5c1f01fb660d73b5 = function (arg0) { - const ret = getObject(arg0).done; - return ret; - }; - imports.wbg.__wbg_value_1695675138684bd5 = function (arg0) { - const ret = getObject(arg0).value; - return addHeapObject(ret); - }; - imports.wbg.__wbg_fromCodePoint_5aced4409dbb8969 = function () { - return handleError(function (arg0) { - const ret = String.fromCodePoint(arg0 >>> 0); - return addHeapObject(ret); - }, arguments); - }; - imports.wbg.__wbindgen_bigint_from_i128 = function (arg0, arg1) { - const ret = (arg0 << BigInt(64)) | BigInt.asUintN(64, arg1); - return addHeapObject(ret); - }; - imports.wbg.__wbindgen_bigint_from_u128 = function (arg0, arg1) { - const ret = - (BigInt.asUintN(64, arg0) << BigInt(64)) | BigInt.asUintN(64, arg1); - return addHeapObject(ret); - }; - imports.wbg.__wbindgen_memory = function () { - const ret = wasm.memory; - return addHeapObject(ret); - }; - imports.wbg.__wbg_buffer_085ec1f694018c4f = function (arg0) { - const ret = getObject(arg0).buffer; - return addHeapObject(ret); - }; - imports.wbg.__wbg_newwithbyteoffsetandlength_6da8e527659b86aa = function ( - arg0, - arg1, - arg2, - ) { - const ret = new Uint8Array(getObject(arg0), arg1 >>> 0, arg2 >>> 0); - return addHeapObject(ret); - }; - imports.wbg.__wbg_new_8125e318e6245eed = function (arg0) { - const ret = new Uint8Array(getObject(arg0)); - return addHeapObject(ret); - }; - imports.wbg.__wbg_from_d7c216d4616bb368 = function (arg0) { - const ret = Array.from(getObject(arg0)); - return addHeapObject(ret); - }; - imports.wbg.__wbg_get_97b561fb56f034b5 = function () { - return handleError(function (arg0, arg1) { - const ret = Reflect.get(getObject(arg0), getObject(arg1)); - return addHeapObject(ret); - }, arguments); - }; - imports.wbg.__wbindgen_is_function = function (arg0) { - const ret = typeof getObject(arg0) === "function"; - return ret; - }; - imports.wbg.__wbg_call_cb65541d95d71282 = function () { - return handleError(function (arg0, arg1) { - const ret = getObject(arg0).call(getObject(arg1)); - return addHeapObject(ret); - }, arguments); - }; - imports.wbg.__wbg_next_526fc47e980da008 = function (arg0) { - const ret = getObject(arg0).next; - return addHeapObject(ret); - }; - imports.wbg.__wbg_length_72e2208bbc0efc61 = function (arg0) { - const ret = getObject(arg0).length; - return ret; - }; - imports.wbg.__wbg_set_5cf90238115182c3 = function (arg0, arg1, arg2) { - getObject(arg0).set(getObject(arg1), arg2 >>> 0); - }; - imports.wbg.__wbg_instanceof_Uint8Array_d8d9cb2b8e8ac1d4 = function (arg0) { - let result; - try { - result = getObject(arg0) instanceof Uint8Array; - } catch { - result = false; - } - const ret = result; - return ret; - }; - imports.wbg.__wbg_instanceof_ArrayBuffer_39ac22089b74fddb = function (arg0) { - let result; - try { - result = getObject(arg0) instanceof ArrayBuffer; - } catch { - result = false; - } - const ret = result; - return ret; - }; - imports.wbg.__wbindgen_object_clone_ref = function (arg0) { - const ret = getObject(arg0); - return addHeapObject(ret); - }; - imports.wbg.__wbindgen_debug_string = function (arg0, arg1) { - const ret = debugString(getObject(arg1)); - const ptr1 = passStringToWasm0( - ret, - wasm.__wbindgen_export_0, - wasm.__wbindgen_export_1, - ); - const len1 = WASM_VECTOR_LEN; - getInt32Memory0()[arg0 / 4 + 1] = len1; - getInt32Memory0()[arg0 / 4 + 0] = ptr1; - }; - imports.wbg.__wbindgen_throw = function (arg0, arg1) { - throw new Error(getStringFromWasm0(arg0, arg1)); - }; - - return imports; + const imports = {}; + imports.wbg = {}; + imports.wbg.__wbindgen_string_new = function(arg0, arg1) { + const ret = getStringFromWasm0(arg0, arg1); + return addHeapObject(ret); + }; + imports.wbg.__wbindgen_object_drop_ref = function(arg0) { + takeObject(arg0); + }; + imports.wbg.__wbg_set_bedc3d02d0f05eb0 = function(arg0, arg1, arg2) { + const ret = getObject(arg0).set(getObject(arg1), getObject(arg2)); + return addHeapObject(ret); + }; + imports.wbg.__wbindgen_is_string = function(arg0) { + const ret = typeof(getObject(arg0)) === 'string'; + return ret; + }; + imports.wbg.__wbindgen_error_new = function(arg0, arg1) { + const ret = new Error(getStringFromWasm0(arg0, arg1)); + return addHeapObject(ret); + }; + imports.wbg.__wbg_set_841ac57cff3d672b = function(arg0, arg1, arg2) { + getObject(arg0)[takeObject(arg1)] = takeObject(arg2); + }; + imports.wbg.__wbg_new_b51585de1b234aff = function() { + const ret = new Object(); + return addHeapObject(ret); + }; + imports.wbg.__wbindgen_is_object = function(arg0) { + const val = getObject(arg0); + const ret = typeof(val) === 'object' && val !== null; + return ret; + }; + imports.wbg.__wbg_entries_e51f29c7bba0c054 = function(arg0) { + const ret = Object.entries(getObject(arg0)); + return addHeapObject(ret); + }; + imports.wbg.__wbg_length_fff51ee6522a1a18 = function(arg0) { + const ret = getObject(arg0).length; + return ret; + }; + imports.wbg.__wbg_get_44be0491f933a435 = function(arg0, arg1) { + const ret = getObject(arg0)[arg1 >>> 0]; + return addHeapObject(ret); + }; + imports.wbg.__wbindgen_string_get = function(arg0, arg1) { + const obj = getObject(arg1); + const ret = typeof(obj) === 'string' ? obj : undefined; + var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1); + var len1 = WASM_VECTOR_LEN; + getInt32Memory0()[arg0 / 4 + 1] = len1; + getInt32Memory0()[arg0 / 4 + 0] = ptr1; + }; + imports.wbg.__wbg_new_56693dbed0c32988 = function() { + const ret = new Map(); + return addHeapObject(ret); + }; + imports.wbg.__wbindgen_number_new = function(arg0) { + const ret = arg0; + return addHeapObject(ret); + }; + imports.wbg.__wbindgen_bigint_from_i64 = function(arg0) { + const ret = arg0; + return addHeapObject(ret); + }; + imports.wbg.__wbindgen_jsval_loose_eq = function(arg0, arg1) { + const ret = getObject(arg0) == getObject(arg1); + return ret; + }; + imports.wbg.__wbindgen_boolean_get = function(arg0) { + const v = getObject(arg0); + const ret = typeof(v) === 'boolean' ? (v ? 1 : 0) : 2; + return ret; + }; + imports.wbg.__wbindgen_is_bigint = function(arg0) { + const ret = typeof(getObject(arg0)) === 'bigint'; + return ret; + }; + imports.wbg.__wbindgen_bigint_get_as_i64 = function(arg0, arg1) { + const v = getObject(arg1); + const ret = typeof(v) === 'bigint' ? v : undefined; + getBigInt64Memory0()[arg0 / 8 + 1] = isLikeNone(ret) ? BigInt(0) : ret; + getInt32Memory0()[arg0 / 4 + 0] = !isLikeNone(ret); + }; + imports.wbg.__wbindgen_jsval_eq = function(arg0, arg1) { + const ret = getObject(arg0) === getObject(arg1); + return ret; + }; + imports.wbg.__wbindgen_bigint_from_u64 = function(arg0) { + const ret = BigInt.asUintN(64, arg0); + return addHeapObject(ret); + }; + imports.wbg.__wbindgen_number_get = function(arg0, arg1) { + const obj = getObject(arg1); + const ret = typeof(obj) === 'number' ? obj : undefined; + getFloat64Memory0()[arg0 / 8 + 1] = isLikeNone(ret) ? 0 : ret; + getInt32Memory0()[arg0 / 4 + 0] = !isLikeNone(ret); + }; + imports.wbg.__wbg_isSafeInteger_bb8e18dd21c97288 = function(arg0) { + const ret = Number.isSafeInteger(getObject(arg0)); + return ret; + }; + imports.wbg.__wbg_isArray_4c24b343cb13cfb1 = function(arg0) { + const ret = Array.isArray(getObject(arg0)); + return ret; + }; + imports.wbg.__wbg_iterator_97f0c81209c6c35a = function() { + const ret = Symbol.iterator; + return addHeapObject(ret); + }; + imports.wbg.__wbindgen_in = function(arg0, arg1) { + const ret = getObject(arg0) in getObject(arg1); + return ret; + }; + imports.wbg.__wbg_new_898a68150f225f2e = function() { + const ret = new Array(); + return addHeapObject(ret); + }; + imports.wbg.__wbg_set_502d29070ea18557 = function(arg0, arg1, arg2) { + getObject(arg0)[arg1 >>> 0] = takeObject(arg2); + }; + imports.wbg.__wbg_String_88810dfeb4021902 = function(arg0, arg1) { + const ret = String(getObject(arg1)); + const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1); + const len1 = WASM_VECTOR_LEN; + getInt32Memory0()[arg0 / 4 + 1] = len1; + getInt32Memory0()[arg0 / 4 + 0] = ptr1; + }; + imports.wbg.__wbg_getwithrefkey_5e6d9547403deab8 = function(arg0, arg1) { + const ret = getObject(arg0)[getObject(arg1)]; + return addHeapObject(ret); + }; + imports.wbg.__wbindgen_is_undefined = function(arg0) { + const ret = getObject(arg0) === undefined; + return ret; + }; + imports.wbg.__wbg_next_ddb3312ca1c4e32a = function() { return handleError(function (arg0) { + const ret = getObject(arg0).next(); + return addHeapObject(ret); + }, arguments) }; + imports.wbg.__wbg_done_5c1f01fb660d73b5 = function(arg0) { + const ret = getObject(arg0).done; + return ret; + }; + imports.wbg.__wbg_value_1695675138684bd5 = function(arg0) { + const ret = getObject(arg0).value; + return addHeapObject(ret); + }; + imports.wbg.__wbg_fromCodePoint_5aced4409dbb8969 = function() { return handleError(function (arg0) { + const ret = String.fromCodePoint(arg0 >>> 0); + return addHeapObject(ret); + }, arguments) }; + imports.wbg.__wbindgen_bigint_from_i128 = function(arg0, arg1) { + const ret = arg0 << BigInt(64) | BigInt.asUintN(64, arg1); + return addHeapObject(ret); + }; + imports.wbg.__wbindgen_bigint_from_u128 = function(arg0, arg1) { + const ret = BigInt.asUintN(64, arg0) << BigInt(64) | BigInt.asUintN(64, arg1); + return addHeapObject(ret); + }; + imports.wbg.__wbindgen_memory = function() { + const ret = wasm.memory; + return addHeapObject(ret); + }; + imports.wbg.__wbg_buffer_085ec1f694018c4f = function(arg0) { + const ret = getObject(arg0).buffer; + return addHeapObject(ret); + }; + imports.wbg.__wbg_newwithbyteoffsetandlength_6da8e527659b86aa = function(arg0, arg1, arg2) { + const ret = new Uint8Array(getObject(arg0), arg1 >>> 0, arg2 >>> 0); + return addHeapObject(ret); + }; + imports.wbg.__wbg_new_8125e318e6245eed = function(arg0) { + const ret = new Uint8Array(getObject(arg0)); + return addHeapObject(ret); + }; + imports.wbg.__wbg_from_d7c216d4616bb368 = function(arg0) { + const ret = Array.from(getObject(arg0)); + return addHeapObject(ret); + }; + imports.wbg.__wbg_get_97b561fb56f034b5 = function() { return handleError(function (arg0, arg1) { + const ret = Reflect.get(getObject(arg0), getObject(arg1)); + return addHeapObject(ret); + }, arguments) }; + imports.wbg.__wbindgen_is_function = function(arg0) { + const ret = typeof(getObject(arg0)) === 'function'; + return ret; + }; + imports.wbg.__wbg_call_cb65541d95d71282 = function() { return handleError(function (arg0, arg1) { + const ret = getObject(arg0).call(getObject(arg1)); + return addHeapObject(ret); + }, arguments) }; + imports.wbg.__wbg_next_526fc47e980da008 = function(arg0) { + const ret = getObject(arg0).next; + return addHeapObject(ret); + }; + imports.wbg.__wbg_length_72e2208bbc0efc61 = function(arg0) { + const ret = getObject(arg0).length; + return ret; + }; + imports.wbg.__wbg_set_5cf90238115182c3 = function(arg0, arg1, arg2) { + getObject(arg0).set(getObject(arg1), arg2 >>> 0); + }; + imports.wbg.__wbg_instanceof_Uint8Array_d8d9cb2b8e8ac1d4 = function(arg0) { + let result; + try { + result = getObject(arg0) instanceof Uint8Array; + } catch { + result = false; + } + const ret = result; + return ret; + }; + imports.wbg.__wbg_instanceof_ArrayBuffer_39ac22089b74fddb = function(arg0) { + let result; + try { + result = getObject(arg0) instanceof ArrayBuffer; + } catch { + result = false; + } + const ret = result; + return ret; + }; + imports.wbg.__wbindgen_object_clone_ref = function(arg0) { + const ret = getObject(arg0); + return addHeapObject(ret); + }; + imports.wbg.__wbindgen_debug_string = function(arg0, arg1) { + const ret = debugString(getObject(arg1)); + const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1); + const len1 = WASM_VECTOR_LEN; + getInt32Memory0()[arg0 / 4 + 1] = len1; + getInt32Memory0()[arg0 / 4 + 0] = ptr1; + }; + imports.wbg.__wbindgen_throw = function(arg0, arg1) { + throw new Error(getStringFromWasm0(arg0, arg1)); + }; + + return imports; } -function __wbg_init_memory(imports, maybe_memory) {} +function __wbg_init_memory(imports, maybe_memory) { + +} function __wbg_finalize_init(instance, module) { - wasm = instance.exports; - __wbg_init.__wbindgen_wasm_module = module; - cachedBigInt64Memory0 = null; - cachedFloat64Memory0 = null; - cachedInt32Memory0 = null; - cachedUint8Memory0 = null; - - return wasm; + wasm = instance.exports; + __wbg_init.__wbindgen_wasm_module = module; + cachedBigInt64Memory0 = null; + cachedFloat64Memory0 = null; + cachedInt32Memory0 = null; + cachedUint8Memory0 = null; + + + return wasm; } function initSync(module) { - if (wasm !== undefined) return wasm; + if (wasm !== undefined) return wasm; - const imports = __wbg_get_imports(); + const imports = __wbg_get_imports(); - __wbg_init_memory(imports); + __wbg_init_memory(imports); - if (!(module instanceof WebAssembly.Module)) { - module = new WebAssembly.Module(module); - } + if (!(module instanceof WebAssembly.Module)) { + module = new WebAssembly.Module(module); + } - const instance = new WebAssembly.Instance(module, imports); + const instance = new WebAssembly.Instance(module, imports); - return __wbg_finalize_init(instance, module); + return __wbg_finalize_init(instance, module); } async function __wbg_init(input) { - if (wasm !== undefined) return wasm; + if (wasm !== undefined) return wasm; - if (typeof input === "undefined") { - input = new URL("euclid_bg.wasm", import.meta.url); - } - const imports = __wbg_get_imports(); + if (typeof input === 'undefined') { + input = new URL('euclid_bg.wasm', import.meta.url); + } + const imports = __wbg_get_imports(); - if ( - typeof input === "string" || - (typeof Request === "function" && input instanceof Request) || - (typeof URL === "function" && input instanceof URL) - ) { - input = fetch(input); - } + if (typeof input === 'string' || (typeof Request === 'function' && input instanceof Request) || (typeof URL === 'function' && input instanceof URL)) { + input = fetch(input); + } - __wbg_init_memory(imports); + __wbg_init_memory(imports); - const { instance, module } = await __wbg_load(await input, imports); + const { instance, module } = await __wbg_load(await input, imports); - return __wbg_finalize_init(instance, module); + return __wbg_finalize_init(instance, module); } -export { initSync }; +export { initSync } export default __wbg_init; diff --git a/public/hyperswitch/wasm/euclid_bg.wasm b/public/hyperswitch/wasm/euclid_bg.wasm index 82ab15f17..7314c5215 100644 Binary files a/public/hyperswitch/wasm/euclid_bg.wasm and b/public/hyperswitch/wasm/euclid_bg.wasm differ diff --git a/public/hyperswitch/wasm/euclid_bg.wasm.d.ts b/public/hyperswitch/wasm/euclid_bg.wasm.d.ts index e783b24d1..0c8b9d86f 100644 --- a/public/hyperswitch/wasm/euclid_bg.wasm.d.ts +++ b/public/hyperswitch/wasm/euclid_bg.wasm.d.ts @@ -2,12 +2,7 @@ /* eslint-disable */ export const memory: WebAssembly.Memory; export function setForexData(a: number, b: number): void; -export function convertCurrency( - a: number, - b: number, - c: number, - d: number, -): void; +export function convertCurrency(a: number, b: number, c: number, d: number): void; export function seedKnowledgeGraph(a: number, b: number): void; export function getValidConnectorsForRule(a: number, b: number): void; export function analyzeProgram(a: number, b: number): void; @@ -27,12 +22,7 @@ export function getDescriptionCategory(a: number, b: number, c: number): void; export function parse(a: number, b: number, c: number): void; export function parseToString(a: number, b: number, c: number): void; export function __wbindgen_export_0(a: number, b: number): number; -export function __wbindgen_export_1( - a: number, - b: number, - c: number, - d: number, -): number; +export function __wbindgen_export_1(a: number, b: number, c: number, d: number): number; export function __wbindgen_add_to_stack_pointer(a: number): number; export function __wbindgen_export_2(a: number, b: number, c: number): void; export function __wbindgen_export_3(a: number): void; diff --git a/src/components/DynamicTable.res b/src/components/DynamicTable.res index f81f988c3..3437daf71 100644 --- a/src/components/DynamicTable.res +++ b/src/components/DynamicTable.res @@ -56,7 +56,7 @@ let make = ( ~mandatoryRemoteKeys=[], ~isSearchKeyArray=false, ~forcePreventConcatData=false, - ~collapseTabelRow=false, + ~collapseTableRow=false, ~showRefreshFilter=true, ~showRemoteOptions=false, ~filterButtonStyle="", @@ -548,7 +548,7 @@ let make = ( ?bottomActions ?defaultSort tableLocalFilter - collapseTabelRow + collapseTableRow getRowDetails ?onMouseEnter ?onMouseLeave @@ -590,7 +590,7 @@ let make = ( ?renderCard ?defaultSort tableLocalFilter - collapseTabelRow + collapseTableRow ?frozenUpto ?heightHeadingClass getRowDetails diff --git a/src/components/DynamicTable.resi b/src/components/DynamicTable.resi index 74296ea60..c300f88e5 100644 --- a/src/components/DynamicTable.resi +++ b/src/components/DynamicTable.resi @@ -42,7 +42,7 @@ let make: ( ~mandatoryRemoteKeys: array=?, ~isSearchKeyArray: bool=?, ~forcePreventConcatData: bool=?, - ~collapseTabelRow: bool=?, + ~collapseTableRow: bool=?, ~showRefreshFilter: bool=?, ~showRemoteOptions: bool=?, ~filterButtonStyle: string=?, diff --git a/src/components/LoadedTable.res b/src/components/LoadedTable.res index e7380840a..85436c29b 100644 --- a/src/components/LoadedTable.res +++ b/src/components/LoadedTable.res @@ -185,7 +185,7 @@ let make = ( ~tableheadingClass="", ~tableBorderClass="", ~tableDataBorderClass="", - ~collapseTabelRow=false, + ~collapseTableRow=false, ~getRowDetails=?, ~onMouseEnter=?, ~onMouseLeave=?, @@ -774,7 +774,7 @@ let make = ( ? "" : `${isMinHeightRequired ? noScrollbar ? "" : "overflow-x-scroll" : "overflow-scroll"}` let loadedTable = -
+
{switch dataView { | Table => { let children = @@ -798,7 +798,7 @@ let make = ( tableBorderClass tableDataBorderClass enableEqualWidthCol - collapseTabelRow + collapseTableRow ?getRowDetails ?onExpandClickData actualData diff --git a/src/components/LoadedTable.resi b/src/components/LoadedTable.resi index 2436b54fc..f43376ddd 100644 --- a/src/components/LoadedTable.resi +++ b/src/components/LoadedTable.resi @@ -66,7 +66,7 @@ let make: ( ~tableheadingClass: string=?, ~tableBorderClass: string=?, ~tableDataBorderClass: string=?, - ~collapseTabelRow: bool=?, + ~collapseTableRow: bool=?, ~getRowDetails: Js.Nullable.t<'t> => React.element=?, ~onMouseEnter: 't => unit=?, ~onMouseLeave: 't => unit=?, diff --git a/src/components/LoadedTableWithCustomColumns.res b/src/components/LoadedTableWithCustomColumns.res index 0c39d55d4..29118421e 100644 --- a/src/components/LoadedTableWithCustomColumns.res +++ b/src/components/LoadedTableWithCustomColumns.res @@ -36,7 +36,7 @@ let make = ( ~tableheadingClass="", ~tableBorderClass="", ~tableDataBorderClass="", - ~collapseTabelRow=false, + ~collapseTableRow=false, ~getRowDetails=_ => React.null, ~onMouseEnter=?, ~onMouseLeave=?, @@ -132,7 +132,7 @@ let make = ( ?renderCard ?defaultSort tableLocalFilter - collapseTabelRow + collapseTableRow ?frozenUpto ?heightHeadingClass getRowDetails diff --git a/src/components/Loader.res b/src/components/Loader.res index 5ed36be52..cbf78e93b 100644 --- a/src/components/Loader.res +++ b/src/components/Loader.res @@ -25,20 +25,19 @@ let make = (
- {React.string(loadingText)} {children}
-
- - + + +
- - -
+
+ +
diff --git a/src/components/PaginationRevamp.res b/src/components/PaginationRevamp.res index 501fd6468..cf192eff7 100644 --- a/src/components/PaginationRevamp.res +++ b/src/components/PaginationRevamp.res @@ -114,8 +114,8 @@ let make = (~resultsPerPage, ~totalResults, ~currentPage, ~paginate, ~btnCount=4 if number < 0 { let input = number === -1 ? pageInput1 : pageInput2 - let prevValue = pageN->LogicUtils.getValueFromArr(idx - 1, 0) - let nextValue = pageN->LogicUtils.getValueFromArr(idx + 1, 0) + let prevValue = pageN->LogicUtils.getValueFromArray(idx - 1, 0) + let nextValue = pageN->LogicUtils.getValueFromArray(idx + 1, 0) let dropDownOptions = Belt.Array.range(prevValue + 1, nextValue - 1) ->Js.Array2.map(int => int->Belt.Int.toString) diff --git a/src/components/ReactWindowTable.res b/src/components/ReactWindowTable.res index 41973e3fb..1df7d96fc 100644 --- a/src/components/ReactWindowTable.res +++ b/src/components/ReactWindowTable.res @@ -62,7 +62,7 @@ module NewCell = { ~removeVerticalLines, ~highlightEnabledFieldsArray, ~tableDataBorderClass="", - ~collapseTabelRow=false, + ~collapseTableRow=false, ~expandedRow: _ => React.element, ~onMouseEnter, ~onMouseLeave, @@ -171,9 +171,9 @@ module NewCell = { className={`${cellWidth} ${overflowStyle} h-auto align-top ${borderClass} ${highlightCell ? "hover:font-bold" : ""} ${tableDataBorderClass} - ${collapseTabelRow ? cursorI : ""}`} + ${collapseTableRow ? cursorI : ""}`} onClick={_ => { - if collapseTabelRow && cellIndex == 0 { + if collapseTableRow && cellIndex == 0 { handleExpand(rowIndex, true) if !isCurrentRowExpanded { setExpandedIndexArr(prev => { @@ -187,7 +187,7 @@ module NewCell = { } }}>
- {if collapseTabelRow { + {if collapseTableRow {
{if cellIndex === 0 { @@ -228,7 +228,7 @@ module ReactWindowTableComponent = { ~tableheadingClass="", ~tableBorderClass="", ~tableDataBorderClass="", - ~collapseTabelRow=false, + ~collapseTableRow=false, ~getRowDetails=?, ~getIndex=?, ~rowItemHeight=100, @@ -480,7 +480,7 @@ module ReactWindowTableComponent = { removeVerticalLines highlightEnabledFieldsArray tableDataBorderClass - collapseTabelRow + collapseTableRow expandedRow={_ => getRowDetails(rowIndex)} onMouseEnter onMouseLeave @@ -654,7 +654,7 @@ let make = ( ~tableheadingClass="", ~tableBorderClass="", ~tableDataBorderClass="", - ~collapseTabelRow=false, + ~collapseTableRow=false, ~getRowDetails=?, ~getIndex=?, ~rowItemHeight=100, @@ -1156,7 +1156,7 @@ let make = ( tableheadingClass tableBorderClass tableDataBorderClass - collapseTabelRow + collapseTableRow ?getRowDetails ?getIndex rowItemHeight diff --git a/src/components/RemoteFilter.res b/src/components/RemoteFilter.res index e43392d8b..d8df016a8 100644 --- a/src/components/RemoteFilter.res +++ b/src/components/RemoteFilter.res @@ -385,7 +385,7 @@ module ApplyFilterButton = { selectedFiltersList ->Js.Array2.map(filter => { let inputFieldsArr = filter.inputFields - let inputField = inputFieldsArr->LogicUtils.getValueFromArr(0, defaultinputField) + let inputField = inputFieldsArr->LogicUtils.getValueFromArray(0, defaultinputField) (inputField.name, inputField) }) ->Js.Dict.fromArray diff --git a/src/components/Table.res b/src/components/Table.res index d31302620..b5bf98613 100644 --- a/src/components/Table.res +++ b/src/components/Table.res @@ -63,7 +63,7 @@ module TableRow = { ~evenVertivalLines, ~highlightEnabledFieldsArray, ~tableDataBorderClass="", - ~collapseTabelRow=false, + ~collapseTableRow=false, ~expandedRow: _ => React.element, ~onMouseEnter, ~onMouseLeave, @@ -178,7 +178,7 @@ module TableRow = { } else { `${borderTop} border-r ${borderColor}` } - let cursorI = cellIndex == 0 && collapseTabelRow ? "cursor-pointer" : "" + let cursorI = cellIndex == 0 && collapseTableRow ? "cursor-pointer" : "" let isLast = cellIndex === colsLen - 1 let lastColProp = isLast && fixLastCol ? "border-l h-full !py-0 flex flex-col justify-center" : "" @@ -203,13 +203,13 @@ module TableRow = { className={`${tableRowBorderClass} ${customColorCell}`} style={ReactDOMStyle.make(~width=fixedWidthClass, ())} onClick={_ => { - if collapseTabelRow && cellIndex == 0 { + if collapseTableRow && cellIndex == 0 { setIsCurrentRowExpanded(prev => !prev) setExpandedData(_ => expandedRow()) } }}>
- {if collapseTabelRow { + {if collapseTableRow {
{if cellIndex === 0 { @@ -622,7 +622,7 @@ let make = ( ~tableheadingClass="", ~tableBorderClass="", ~tableDataBorderClass="", - ~collapseTabelRow=false, + ~collapseTableRow=false, ~getRowDetails=?, ~actualData=?, ~onExpandClickData as _=?, @@ -725,7 +725,7 @@ let make = ( evenVertivalLines highlightEnabledFieldsArray tableDataBorderClass - collapseTabelRow + collapseTableRow expandedRow={_ => getRowDetails(offset + rowIndex)} onMouseEnter onMouseLeave diff --git a/src/components/Table.resi b/src/components/Table.resi index 9db95af34..ea3ffbf8c 100644 --- a/src/components/Table.resi +++ b/src/components/Table.resi @@ -147,7 +147,7 @@ module TableRow: { ~evenVertivalLines: bool, ~highlightEnabledFieldsArray: Js.Array2.t, ~tableDataBorderClass: string=?, - ~collapseTabelRow: bool=?, + ~collapseTableRow: bool=?, ~expandedRow: unit => React.element, ~onMouseEnter: option unit>, ~onMouseLeave: option unit>, @@ -263,7 +263,7 @@ let make: ( ~tableheadingClass: string=?, ~tableBorderClass: string=?, ~tableDataBorderClass: string=?, - ~collapseTabelRow: bool=?, + ~collapseTableRow: bool=?, ~getRowDetails: Js.Nullable.t<'b> => React.element=?, ~actualData: Js.Array2.t>=?, ~onExpandClickData: 'onExpandClickData=?, diff --git a/src/components/priority-logics/AddPLGateway.res b/src/components/priority-logics/AddPLGateway.res index 1df692d5c..6001c2f9b 100644 --- a/src/components/priority-logics/AddPLGateway.res +++ b/src/components/priority-logics/AddPLGateway.res @@ -231,6 +231,7 @@ let make = ( fixedDropDownDirection=SelectBox.TopRight searchable=true defaultLeftIcon={FontAwesome("plus")} + maxHeight="max-h-full sm:max-h-64" /> {React.string("*")}
diff --git a/src/entryPoints/hyperswitch/EntryPointUtils.res b/src/entryPoints/hyperswitch/EntryPointUtils.res index 5b67e4f6d..8c3e13a98 100644 --- a/src/entryPoints/hyperswitch/EntryPointUtils.res +++ b/src/entryPoints/hyperswitch/EntryPointUtils.res @@ -37,7 +37,7 @@ module ContextWrapper = { } } -let renderDashboardApp = (~uiConfig=UIConfig.defaultUIConfig, children) => { +let renderDashboardApp = (~uiConfig, children) => { switch ReactDOM.querySelector("#app") { | Some(container) => open ReactDOM.Client diff --git a/src/entryPoints/hyperswitch/FeatureFlagUtils.res b/src/entryPoints/hyperswitch/FeatureFlagUtils.res index 150c8cff9..cbc3b2dd4 100644 --- a/src/entryPoints/hyperswitch/FeatureFlagUtils.res +++ b/src/entryPoints/hyperswitch/FeatureFlagUtils.res @@ -4,11 +4,8 @@ type featureFlag = { testLiveToggle: bool, magicLink: bool, quickStart: bool, - stripePlusPayPal: bool, - wooCommerce: bool, - openSDK: bool, switchMerchant: bool, - testLiveMode: option, + isLiveMode: bool, auditTrail: bool, systemMetrics: bool, sampleData: bool, @@ -23,6 +20,7 @@ type featureFlag = { mixPanel: bool, verifyConnector: bool, forgetPassword: bool, + ossBuild: bool, } let featureFlagType = (featureFlags: Js.Json.t) => { @@ -34,11 +32,8 @@ let featureFlagType = (featureFlags: Js.Json.t) => { testLiveToggle: dict->getBool("test_live_toggle", false), magicLink: dict->getBool("magic_link", false), quickStart: dict->getBool("quick_start", false), - stripePlusPayPal: dict->getBool("stripe_plus_paypal", false), - wooCommerce: dict->getBool("woocommerce", false), - openSDK: dict->getBool("open_sdk", false), switchMerchant: dict->getBool("switch_merchant", false), - testLiveMode: dict->getOptionBool("test_live_mode"), + isLiveMode: dict->getBool("is_live_mode", false), auditTrail: dict->getBool("audit_trail", false), systemMetrics: dict->getBool("system_metrics", false), sampleData: dict->getBool("sample_data", false), @@ -53,6 +48,7 @@ let featureFlagType = (featureFlags: Js.Json.t) => { mixPanel: dict->getBool("mixpanel", false), verifyConnector: dict->getBool("verify_connector", false), forgetPassword: dict->getBool("forgot_password", false), + ossBuild: dict->getBool("oss_build", false), } typedFeatureFlag } diff --git a/src/entryPoints/hyperswitch/HyperSwitchApp.res b/src/entryPoints/hyperswitch/HyperSwitchApp.res index 4ed82e6da..e8f6b0dcf 100644 --- a/src/entryPoints/hyperswitch/HyperSwitchApp.res +++ b/src/entryPoints/hyperswitch/HyperSwitchApp.res @@ -32,8 +32,8 @@ let make = () => { } = React.useContext(GlobalProvider.defaultContext) let (screenState, setScreenState) = React.useState(_ => PageLoaderWrapper.Loading) let {isProdIntentCompleted} = React.useContext(GlobalProvider.defaultContext) - let fetchBusinessProfiles = HSwitchMerchantAccountUtils.useFetchBusinessProfiles() - let fetchMerchantAccountDetails = HSwitchMerchantAccountUtils.useFetchMerchantDetails() + let fetchBusinessProfiles = MerchantAccountUtils.useFetchBusinessProfiles() + let fetchMerchantAccountDetails = MerchantAccountUtils.useFetchMerchantDetails() let fetchConnectorListResponse = ConnectorUtils.useFetchConnectorList() let enumDetails = HyperswitchAtom.enumVariantAtom @@ -50,18 +50,16 @@ let make = () => { let getEnumDetails = EnumVariantHook.useFetchEnumDetails() let verificationDays = getFromMerchantDetails("verification")->LogicUtils.getIntFromString(-1) let userRole = getFromUserDetails("user_role") - let modeText = - featureFlagDetails.testLiveMode->Belt.Option.getWithDefault(false) ? "Live Mode" : "Test Mode" + let modeText = featureFlagDetails.isLiveMode ? "Live Mode" : "Test Mode" let titleComingSoonMessage = "Coming Soon!" let subtitleComingSoonMessage = "We are currently working on this page." - let modeStyles = - featureFlagDetails.testLiveMode->Belt.Option.getWithDefault(false) - ? "bg-hyperswitch_green_trans border-hyperswitch_green_trans text-hyperswitch_green" - : "bg-orange-600/80 border-orange-500 text-grey-700" + let modeStyles = featureFlagDetails.isLiveMode + ? "bg-hyperswitch_green_trans border-hyperswitch_green_trans text-hyperswitch_green" + : "bg-orange-600/80 border-orange-500 text-grey-700" let merchantDetailsValue = HSwitchUtils.useMerchantDetailsValue() let isReconEnabled = - (merchantDetailsValue->HSwitchMerchantAccountUtils.getMerchantDetails).recon_status === Active + (merchantDetailsValue->MerchantAccountUtils.getMerchantDetails).recon_status === Active let hyperSwitchAppSidebars = SidebarValues.getHyperSwitchAppSidebars( ~isReconEnabled, @@ -93,7 +91,6 @@ let make = () => { } else { setDashboardPageState(_ => #AGREEMENT_SIGNATURE) } - setScreenState(_ => PageLoaderWrapper.Success) } catch { | _ => setDashboardPageState(_ => #HOME) @@ -123,6 +120,18 @@ let make = () => { let _profileDetails = await fetchBusinessProfiles() let _connectorList = await fetchConnectorListResponse() let _merchantDetails = await fetchMerchantAccountDetails() + + if featureFlagDetails.quickStart { + let _featureFlag = await fetchInitialEnums() + } + + if featureFlagDetails.isLiveMode { + getAgreementEnum()->ignore + } else { + setDashboardPageState(_ => #HOME) + } + + setScreenState(_ => PageLoaderWrapper.Success) } catch { | _ => setDashboardPageState(_ => #HOME) @@ -135,27 +144,6 @@ let make = () => { None }) - React.useEffect1(() => { - switch featureFlagDetails.testLiveMode { - | Some(val) => - if val { - getAgreementEnum()->ignore - } else { - setDashboardPageState(_ => #HOME) - setScreenState(_ => PageLoaderWrapper.Success) - } - | None => () - } - None - }, [featureFlagDetails.testLiveMode]) - - React.useEffect1(() => { - if featureFlagDetails.quickStart { - fetchInitialEnums()->ignore - } - None - }, [featureFlagDetails.quickStart]) - let setPageState = (pageState: ProviderTypes.dashboardPageStateTypes) => { setDashboardPageState(_ => pageState) React.null @@ -192,16 +180,16 @@ let make = () => { } } -
- {switch dashboardPageState { - | #POST_LOGIN_QUES_NOT_DONE => - | #AUTO_CONNECTOR_INTEGRATION => - | #INTEGRATION_DOC => - | #AGREEMENT_SIGNATURE => - | #PROD_ONBOARDING => - | #QUICK_START => - | #HOME => - + +
+ {switch dashboardPageState { + | #POST_LOGIN_QUES_NOT_DONE => + | #AUTO_CONNECTOR_INTEGRATION => + | #INTEGRATION_DOC => + | #AGREEMENT_SIGNATURE => + | #PROD_ONBOARDING => + | #QUICK_START => + | #HOME =>
@@ -229,7 +217,7 @@ let make = () => {
+ className="w-full h-screen overflow-x-scroll xl:overflow-x-hidden overflow-y-scroll">
@@ -299,14 +287,14 @@ let make = () => { renderList={() => } renderShow={routingType => } /> - | list{"users", "invite-users"} => + | list{"users", "invite-users"} => | list{"users", ...remainingPath} => } - renderShow={id => } + renderList={() => } + renderShow={_ => } /> | list{"analytics-payments"} => @@ -330,16 +318,22 @@ let make = () => { - | list{"webhooks", ...remainingPath} => + | list{"payment-settings", ...remainingPath} => } + renderList={() => } renderShow={profileId => - } + } /> - | list{"recon"} => - | list{"sdk"} => + | list{"recon"} => + + + + | list{"sdk"} => + + + | list{"3ds"} => | list{"account-settings"} => @@ -379,13 +373,13 @@ let make = () => {
- - | #WOOCOMMERCE_FLOW => - | #DEFAULT => -
- -
- | #STRIPE_PLUS_PAYPAL => - }} -
+ | #WOOCOMMERCE_FLOW => + | #DEFAULT => +
+ +
+ | #STRIPE_PLUS_PAYPAL => + }} +
+
} diff --git a/src/entryPoints/hyperswitch/HyperSwitchEntry.res b/src/entryPoints/hyperswitch/HyperSwitchEntry.res index 29c8550bd..2ab9ea88c 100644 --- a/src/entryPoints/hyperswitch/HyperSwitchEntry.res +++ b/src/entryPoints/hyperswitch/HyperSwitchEntry.res @@ -9,6 +9,7 @@ module HyperSwitchEntryComponent = { let url = RescriptReactRouter.useUrl() let (_zone, setZone) = React.useContext(UserTimeZoneProvider.userTimeContext) let setFeatureFlag = HyperswitchAtom.featureFlagAtom->Recoil.useSetRecoilState + let (screenState, setScreenState) = React.useState(_ => PageLoaderWrapper.Loading) let featureFlagDetails = HyperswitchAtom.featureFlagAtom ->Recoil.useRecoilValueFromAtom @@ -42,10 +43,9 @@ module HyperSwitchEntryComponent = { let setPageName = pageTitle => { let page = pageTitle->LogicUtils.snakeToTitle - let title = - featureFlagDetails.testLiveMode->Belt.Option.getWithDefault(false) - ? `${page} - Dashboard` - : `${page} - Dashboard [Test]` + let title = featureFlagDetails.isLiveMode + ? `${page} - Dashboard` + : `${page} - Dashboard [Test]` DOMUtils.document.title = title GoogleAnalytics.send({hitType: "pageview", page}) hyperswitchMixPanel( @@ -74,10 +74,11 @@ module HyperSwitchEntryComponent = { let stringifiedResponse = (await postDetails(url, Js.Dict.empty()->Js.Json.object_, Post))->Js.Json.stringify setFeatureFlag(._ => stringifiedResponse) + setScreenState(_ => PageLoaderWrapper.Success) } catch { - | Js.Exn.Error(e) => { - let _err = Js.Exn.message(e)->Belt.Option.getWithDefault("Failed to Fetch!") - } + | Js.Exn.Error(e) => + let err = Js.Exn.message(e)->Belt.Option.getWithDefault("Something went wrong!") + setScreenState(_ => PageLoaderWrapper.Error(err)) } } @@ -86,13 +87,15 @@ module HyperSwitchEntryComponent = { None }) -
- - - - - -
+ +
+ + + + + +
+
} } diff --git a/src/entryPoints/hyperswitch/Provider/GlobalProvider.res b/src/entryPoints/hyperswitch/Provider/GlobalProvider.res index 10a8b7365..894350380 100644 --- a/src/entryPoints/hyperswitch/Provider/GlobalProvider.res +++ b/src/entryPoints/hyperswitch/Provider/GlobalProvider.res @@ -8,8 +8,6 @@ let defaultValue = { setShowProdIntentForm: _ => (), integrationDetails: defaultIntegrationValue, setIntegrationDetails: _ => (), - tabIndexForDevelopers: 0, - setTabIndexForDevelopers: _ => (), dashboardPageState: #DEFAULT, setDashboardPageState: _ => (), permissionInfo: [], @@ -23,11 +21,6 @@ let defaultValue = { let defaultContext = React.createContext(defaultValue) module Provider = { - let makeProps = (~value, ~children, ()) => - { - "value": value, - "children": children, - } let make = React.Context.provider(defaultContext) } @@ -35,7 +28,6 @@ module Provider = { let make = (~children) => { let (showFeedbackModal, setShowFeedbackModal) = React.useState(_ => false) let (showProdIntentForm, setShowProdIntentForm) = React.useState(_ => false) - let (tabIndexForDevelopers, setTabIndexForDevelopers) = React.useState(_ => 0) let (dashboardPageState, setDashboardPageState) = React.useState(_ => #DEFAULT) let (permissionInfo, setPermissionInfo) = React.useState(_ => []) let (isProdIntentCompleted, setIsProdIntentCompleted) = React.useState(_ => false) @@ -56,8 +48,6 @@ let make = (~children) => { integrationDetails, showProdIntentForm, setShowProdIntentForm, - tabIndexForDevelopers, - setTabIndexForDevelopers, dashboardPageState, setDashboardPageState, permissionInfo, diff --git a/src/entryPoints/hyperswitch/Provider/ProviderHelper.res b/src/entryPoints/hyperswitch/Provider/ProviderHelper.res index 2b77f3d3e..1618d9dbd 100644 --- a/src/entryPoints/hyperswitch/Provider/ProviderHelper.res +++ b/src/entryPoints/hyperswitch/Provider/ProviderHelper.res @@ -47,18 +47,6 @@ let itemToObjMapperForGetInfo = dict => { } } -let getDefaultValueOfGetInfo = { - module_: "", - description: "", - permissions: [ - { - enum_name: "", - description: "", - isPermissionAllowed: false, - }, - ], -} - let getDefaultValueOfEnum = { { enum_name: "", diff --git a/src/entryPoints/hyperswitch/Provider/ProviderTypes.res b/src/entryPoints/hyperswitch/Provider/ProviderTypes.res index 8bddb58da..8d04f0306 100644 --- a/src/entryPoints/hyperswitch/Provider/ProviderTypes.res +++ b/src/entryPoints/hyperswitch/Provider/ProviderTypes.res @@ -38,8 +38,6 @@ type contextType = { setShowFeedbackModal: (bool => bool) => unit, showProdIntentForm: bool, setShowProdIntentForm: (bool => bool) => unit, - tabIndexForDevelopers: int, - setTabIndexForDevelopers: (int => int) => unit, dashboardPageState: dashboardPageStateTypes, setDashboardPageState: (dashboardPageStateTypes => dashboardPageStateTypes) => unit, integrationDetails: integrationDetailsType, diff --git a/src/entryPoints/hyperswitch/SidebarValues.res b/src/entryPoints/hyperswitch/SidebarValues.res index 679aead89..2e7b100cd 100644 --- a/src/entryPoints/hyperswitch/SidebarValues.res +++ b/src/entryPoints/hyperswitch/SidebarValues.res @@ -227,11 +227,11 @@ let systemMetric = SubLevelLink({ searchOptions: [("View System Metrics", "")], }) -let webhooks = SubLevelLink({ - name: "Webhooks", - link: `/webhooks`, +let paymentSettings = SubLevelLink({ + name: "Payment Settings", + link: `/payment-settings`, access: ReadWrite, - searchOptions: [("View Webhooks", "")], + searchOptions: [("View payment settings", ""), ("View webhooks", ""), ("View return url", "")], }) let developers = (isDevelopersEnabled, userRole, systemMetrics) => { @@ -243,8 +243,8 @@ let developers = (isDevelopersEnabled, userRole, systemMetrics) => { icon: "developer", showSection: true, links: isInternalUser && systemMetrics - ? [apiKeys, webhooks, systemMetric] - : [apiKeys, webhooks], + ? [apiKeys, paymentSettings, systemMetric] + : [apiKeys, paymentSettings], }) : emptyComponent } @@ -303,7 +303,7 @@ let reconTag = (recon, isReconEnabled) => : emptyComponent let getHyperSwitchAppSidebars = ( - ~isReconEnabled=false, + ~isReconEnabled: bool, ~featureFlagDetails: FeatureFlagUtils.featureFlag, ~userRole, (), diff --git a/src/entryPoints/hyperswitch/WooCommerce/WooCommerce.res b/src/entryPoints/hyperswitch/WooCommerce/WooCommerce.res index c9cb1f07d..95affa306 100644 --- a/src/entryPoints/hyperswitch/WooCommerce/WooCommerce.res +++ b/src/entryPoints/hyperswitch/WooCommerce/WooCommerce.res @@ -139,8 +139,7 @@ module ConfigureWebHook = { @react.component let make = (~handleNavigation, ~title, ~description) => { let businessProfiles = Recoil.useRecoilValueFromAtom(HyperswitchAtom.businessProfilesAtom) - let defaultBusinessProfile = - businessProfiles->HSwitchMerchantAccountUtils.getValueFromBusinessProfile + let defaultBusinessProfile = businessProfiles->MerchantAccountUtils.getValueFromBusinessProfile
@@ -184,7 +183,7 @@ module ConfigureWebHook = { {"Use this key to authenticate all API requests from your application's server"->React.string}
-
@@ -233,7 +232,7 @@ let make = () => { let activeBusinessProfile = HyperswitchAtom.businessProfilesAtom ->Recoil.useRecoilValueFromAtom - ->HSwitchMerchantAccountUtils.getValueFromBusinessProfile + ->MerchantAccountUtils.getValueFromBusinessProfile let naviagteToHome = _ => { setDashboardPageState(_ => #HOME) @@ -247,7 +246,7 @@ let make = () => { try { if forward && !(stepInView->enumToValueMapper(enums)) { let currentStepVariant = stepInView->variantToEnumMapper - let _resp = await Boolean(true)->usePostEnumDetails(currentStepVariant) + let _ = await Boolean(true)->usePostEnumDetails(currentStepVariant) } } catch { | _ => () diff --git a/src/entryPoints/hyperswitch/WooCommerce/WooCommerceUIUtils.res b/src/entryPoints/hyperswitch/WooCommerce/WooCommerceUIUtils.res index a723901a0..84b4a0c03 100644 --- a/src/entryPoints/hyperswitch/WooCommerce/WooCommerceUIUtils.res +++ b/src/entryPoints/hyperswitch/WooCommerce/WooCommerceUIUtils.res @@ -79,16 +79,16 @@ module SelectPaymentMethods = { let enumRecoilUpdateArr = [] if enums.firstProcessorConnected.processorID->Js.String2.length === 0 { - let _fPCResp = await body->postEnumDetails(#FirstProcessorConnected) + let _ = await body->postEnumDetails(#FirstProcessorConnected) enumRecoilUpdateArr->Array.push((body, #FirstProcessorConnected)) } if !enums.isMultipleConfiguration { - let _mCResp = await Boolean(true)->postEnumDetails(#IsMultipleConfiguration) + let _ = await Boolean(true)->postEnumDetails(#IsMultipleConfiguration) enumRecoilUpdateArr->Array.push((Boolean(true), #IsMultipleConfiguration)) } - let _res = updateEnumInRecoil(enumRecoilUpdateArr) + let _ = updateEnumInRecoil(enumRecoilUpdateArr) } catch { | _ => setButtonState(_ => Button.Normal) } diff --git a/src/hooks/ListHooks.res b/src/hooks/ListHooks.res index abd0da52c..ba592d442 100644 --- a/src/hooks/ListHooks.res +++ b/src/hooks/ListHooks.res @@ -14,12 +14,12 @@ let useListCount = (~entityName) => { | CONNECTOR => response ->getObjectArrayFromJson - ->HSwitchUtils.filterList(~removeFromList=FRMPlayer, ()) + ->HSwitchUtils.filterList(~removeFromList=FRMPlayer) ->Js.Array2.length | FRAUD_RISK_MANAGEMENT => response ->getObjectArrayFromJson - ->HSwitchUtils.filterList(~removeFromList=Connector, ()) + ->HSwitchUtils.filterList(~removeFromList=Connector) ->Js.Array2.length | _ => response->getArrayFromJson([])->Js.Array2.length } diff --git a/src/libraries/Window.res b/src/libraries/Window.res index 8a326afbb..211d31224 100644 --- a/src/libraries/Window.res +++ b/src/libraries/Window.res @@ -38,6 +38,21 @@ external getConnectorConfig: string => Js.Json.t = "getConnectorConfig" @val @scope("window") external getPayoutConnectorConfig: string => Js.Json.t = "getPayoutConnectorConfig" +@val @scope("window") +external getThreeDsKeys: unit => array = "getThreeDsKeys" + +@val @scope("window") +external getAllKeys: unit => array = "getAllKeys" + +@val @scope("window") +external getKeyType: string => string = "getKeyType" + +@val @scope("window") +external getAllConnectors: unit => array = "getAllConnectors" + +@val @scope("window") +external getVariantValues: string => array = "getVariantValues" + @val @scope("window") open ConnectorTypes external getRequestPayload: (wasmRequest, wasmExtraPayload) => Js.Json.t = "getRequestPayload" diff --git a/src/screens/HyperSwitch/APIUtils/APIUtils.res b/src/screens/HyperSwitch/APIUtils/APIUtils.res index eeb907d2e..9f16ed28c 100644 --- a/src/screens/HyperSwitch/APIUtils/APIUtils.res +++ b/src/screens/HyperSwitch/APIUtils/APIUtils.res @@ -194,6 +194,8 @@ let getURL = ( | _ => `${userUrl}/${(userType :> string)->Js.String2.toLowerCase}` } | #CREATE_MERCHANT => `${userUrl}/create_merchant` + | #OSSSIGNIN => `${userUrl}/signin` + | #OSSSIGNUP => `${userUrl}/signup` | _ => `${userUrl}/${(userType :> string)->Js.String2.toLowerCase}` } | RECON => @@ -256,7 +258,7 @@ let handleLogout = async ( ~setAuthStatus, ) => { let logoutUrl = getURL(~entityName=USERS, ~methodType=Post, ~userType=#SIGNOUT, ()) - let _res = await fetchApi(logoutUrl, ~method_=Fetch.Post, ()) + let _ = await fetchApi(logoutUrl, ~method_=Fetch.Post, ()) setAuthStatus(HyperSwitchAuthTypes.LoggedOut) LocalStorage.clear() RescriptReactRouter.push("/register") @@ -399,7 +401,7 @@ let useGetMethod = (~showErrorToast=true, ()) => { _ => { hyperswitchMixPanel(~eventName=Some(`${urlPath}_tryplayground_register`), ()) hyperswitchMixPanel(~eventName=Some(`global_tryplayground_register`), ()) - let _res = handleLogout(~fetchApi, ~setAuthStatus) + let _ = handleLogout(~fetchApi, ~setAuthStatus) } }, }, @@ -460,7 +462,7 @@ let useUpdateMethod = (~showErrorToast=true, ()) => { _ => { hyperswitchMixPanel(~eventName=Some(`${urlPath}_tryplayground_register`), ()) hyperswitchMixPanel(~eventName=Some(`global_tryplayground_register`), ()) - let _res = handleLogout(~fetchApi, ~setAuthStatus) + let _ = handleLogout(~fetchApi, ~setAuthStatus) } }, }, diff --git a/src/screens/HyperSwitch/APIUtils/APIUtilsTypes.res b/src/screens/HyperSwitch/APIUtils/APIUtilsTypes.res index 8df6d202a..532138536 100644 --- a/src/screens/HyperSwitch/APIUtils/APIUtilsTypes.res +++ b/src/screens/HyperSwitch/APIUtils/APIUtilsTypes.res @@ -53,5 +53,7 @@ type userType = [ | #INVITE | #RESEND_INVITE | #CREATE_MERCHANT + | #OSSSIGNIN + | #OSSSIGNUP | #NONE ] diff --git a/src/screens/HyperSwitch/Analytics/AnalyticsTypes.res b/src/screens/HyperSwitch/Analytics/AnalyticsTypes.res index 6fb6a0403..c4db779e0 100644 --- a/src/screens/HyperSwitch/Analytics/AnalyticsTypes.res +++ b/src/screens/HyperSwitch/Analytics/AnalyticsTypes.res @@ -173,12 +173,19 @@ type paymentsSingleStateSeries = { payment_processed_amount: float, payment_avg_ticket_size: float, } + +type error_message_type = { + reason: string, + count: int, + percentage: float, +} + type paymentTableType = { payment_success_rate: float, payment_count: float, payment_success_count: float, payment_processed_amount: float, - payment_error_message: string, + payment_error_message: array, avg_ticket_size: float, connector: string, payment_method: string, diff --git a/src/screens/HyperSwitch/Analytics/DownloadReportModal.res b/src/screens/HyperSwitch/Analytics/DownloadReportModal.res index cf8680463..6955e3041 100644 --- a/src/screens/HyperSwitch/Analytics/DownloadReportModal.res +++ b/src/screens/HyperSwitch/Analytics/DownloadReportModal.res @@ -27,7 +27,7 @@ let make = (~reportModal, ~setReportModal, ~entityName) => { let downloadReport = async body => { try { let url = getURL(~entityName, ~methodType=Post, ()) - let _res = await updateDetails(url, body, Post) + let _ = await updateDetails(url, body, Post) setReportModal(_ => false) showToast(~message="Email Sent", ~toastType=ToastSuccess, ()) } catch { diff --git a/src/screens/HyperSwitch/Analytics/ErrorReasons.res b/src/screens/HyperSwitch/Analytics/ErrorReasons.res index e6f68af93..a591fb944 100644 --- a/src/screens/HyperSwitch/Analytics/ErrorReasons.res +++ b/src/screens/HyperSwitch/Analytics/ErrorReasons.res @@ -1,7 +1,7 @@ type errorObject = { error_reason: string, - count: string, - percentage: string, + count: int, + percentage: float, } type cols = @@ -23,8 +23,8 @@ let tableItemToObjMapper: 'a => errorObject = dict => { open LogicUtils { error_reason: dict->getString(ErrorReason->colMapper, "NA"), - count: dict->getString(Count->colMapper, "NA"), - percentage: dict->getString(Percentage->colMapper, "NA"), + count: dict->getInt(Count->colMapper, 0), + percentage: dict->getFloat(Percentage->colMapper, 0.0), } } @@ -51,8 +51,8 @@ let getHeading = colType => { let getCell = (errorObj, colType): Table.cell => { switch colType { | ErrorReason => Text(errorObj.error_reason) - | Count => Text(errorObj.count) - | Percentage => Text(errorObj.percentage) + | Count => Text(errorObj.count->Belt.Int.toString) + | Percentage => Text(errorObj.percentage->Belt.Float.toString) } } @@ -69,7 +69,7 @@ let tableEntity = EntityType.makeEntity( ) @react.component -let make = (~errorMessage) => { +let make = (~errors: array) => { let (showModal, setShowModal) = React.useState(_ => false) let (offset, setOffset) = React.useState(_ => 0) @@ -78,43 +78,28 @@ let make = (~errorMessage) => { order: Table.INC, } - let errors = - errorMessage - ->Js.String2.split("$$") - ->Js.Array2.filter(err => err->Js.String2.length > 0) - ->Js.Array2.map(Js.String2.trim) - ->Js.Array2.reverseInPlace - let getCellText = { - let errorStr = - errors - ->Belt.Array.get(0) - ->Belt.Option.getWithDefault("Error Reasons") - ->Js.String2.slice(~from=0, ~to_=15) + let errorStr = switch errors->Belt.Array.get(0) { + | Some(val) => val.reason->Js.String2.slice(~from=0, ~to_=15) + | _ => "Error Reasons" + } `${errorStr}...` } - let getItem = (arr, index) => arr->Belt.Array.get(index)->Belt.Option.getWithDefault("") - let tableData = if errors->Js.Array2.length > 0 { errors->Js.Array2.map(item => { - let arr = item->Js.String2.split("(") - let error_reason = arr->getItem(0) - let percentage = arr->getItem(1)->Js.String2.split(")")->getItem(0) - let count = arr->getItem(2)->Js.String2.split(")")->getItem(0) - { - error_reason, - percentage, - count, + error_reason: item.reason, + percentage: item.percentage, + count: item.count, }->Js.Nullable.return }) } else { [] } - let tableBorderClass = "border-collapse border border-jp-gray-940 border-solid border-2 rounded-sm border-opacity-30 dark:border-jp-gray-dark_table_border_color dark:border-opacity-30 -mt-4" + let tableBorderClass = "border-collapse border border-jp-gray-940 border-solid border-2 border-opacity-30 dark:border-jp-gray-dark_table_border_color dark:border-opacity-30" <> {if errors->Js.Array2.length > 0 { @@ -132,26 +117,25 @@ let make = (~errorMessage) => { showModal setShowModal modalClass="w-full max-w-xl mx-auto md:mt-44 "> -
- Js.Array2.length} - offset - setOffset - defaultSort - currrentFetchCount={tableData->Js.Array2.length} - tableLocalFilter=false - tableheadingClass=tableBorderClass - tableBorderClass - tableDataBorderClass=tableBorderClass - isAnalyticsModule=true - /> -
+ Js.Array2.length} + offset + setOffset + defaultSort + currrentFetchCount={tableData->Js.Array2.length} + tableLocalFilter=false + tableheadingClass=tableBorderClass + tableBorderClass + ignoreHeaderBg=true + tableDataBorderClass=tableBorderClass + isAnalyticsModule=true + /> } diff --git a/src/screens/HyperSwitch/Analytics/HSAnalyticsUtils.res b/src/screens/HyperSwitch/Analytics/HSAnalyticsUtils.res index 44ea205b3..516800622 100644 --- a/src/screens/HyperSwitch/Analytics/HSAnalyticsUtils.res +++ b/src/screens/HyperSwitch/Analytics/HSAnalyticsUtils.res @@ -174,10 +174,6 @@ let getStringListFromArrayDict = metrics => { metrics->Js.Array2.map(item => item->getDictFromJsonObject->getString("name", "")) } -let getCustomFormattedFloatDate = (floatDate, format) => { - floatDate->Js.Date.fromFloat->Js.Date.toISOString->Table.dateFormat(format) -} - module NoData = { @react.component let make = (~title, ~subTitle) => { @@ -209,7 +205,7 @@ let generateTablePayload = ( ~isIndustry: bool, ~mode: option, ~customFilter, - ~showDeltaMetrics=false, + ~showDeltaMetrics, ~moduleName as _: string, ~source: string="BATCH", (), diff --git a/src/screens/HyperSwitch/Analytics/HomePageOverview/HomePageOverviewComponent.res b/src/screens/HyperSwitch/Analytics/HomePageOverview/HomePageOverviewComponent.res index 03f95e8de..66e65800b 100644 --- a/src/screens/HyperSwitch/Analytics/HomePageOverview/HomePageOverviewComponent.res +++ b/src/screens/HyperSwitch/Analytics/HomePageOverview/HomePageOverviewComponent.res @@ -214,7 +214,7 @@ module OverviewInfo = { let generateSampleData = async () => { try { let generateSampleDataUrl = getURL(~entityName=GENERATE_SAMPLE_DATA, ~methodType=Post, ()) - let _generateSampleData = await updateDetails( + let _ = await updateDetails( generateSampleDataUrl, [("record", 50.0->Js.Json.number)]->Js.Dict.fromArray->Js.Json.object_, Post, diff --git a/src/screens/HyperSwitch/Analytics/PaymentsAnalytics/PaymentAnalyticsEntity.res b/src/screens/HyperSwitch/Analytics/PaymentsAnalytics/PaymentAnalyticsEntity.res index 2bc68686f..c6988eccd 100644 --- a/src/screens/HyperSwitch/Analytics/PaymentsAnalytics/PaymentAnalyticsEntity.res +++ b/src/screens/HyperSwitch/Analytics/PaymentsAnalytics/PaymentAnalyticsEntity.res @@ -72,7 +72,21 @@ let distribution = ->Js.Dict.fromArray ->Js.Json.object_ -let tableItemToObjMapper: 'a => paymentTableType = dict => { +let tableItemToObjMapper: Js.Dict.t => paymentTableType = dict => { + let parseErrorReasons = dict => { + dict + ->getArrayFromDict(PaymentErrorMessage->colMapper, []) + ->Js.Array2.map(errorJson => { + let dict = errorJson->getDictFromJsonObject + + { + reason: dict->getString("reason", ""), + count: dict->getInt("count", 0), + percentage: dict->getFloat("percentage", 0.0), + } + }) + } + { payment_success_rate: dict->getFloat(SuccessRate->colMapper, 0.0), payment_count: dict->getFloat(Count->colMapper, 0.0), @@ -90,7 +104,7 @@ let tableItemToObjMapper: 'a => paymentTableType = dict => { authentication_type: dict->getString(AuthType->colMapper, "OTHER")->Js.String2.toUpperCase, refund_status: dict->getString(Status->colMapper, "OTHER")->Js.String2.toUpperCase, weekly_payment_success_rate: dict->getWeeklySR->Js.String2.toUpperCase, - payment_error_message: dict->getString(PaymentErrorMessage->colMapper, ""), + payment_error_message: dict->parseErrorReasons, } } @@ -195,7 +209,7 @@ let getCell = (paymentTable, colType): Table.cell => { | Status => Text(paymentTable.refund_status) | WeeklySuccessRate => Text(paymentTable.weekly_payment_success_rate) | PaymentErrorMessage => - Table.CustomCell(, "NA") + Table.CustomCell(, "NA") | NoCol => Text("") } } diff --git a/src/screens/HyperSwitch/Analytics/SystemMetrics/SystemMetricsAnalytics.res b/src/screens/HyperSwitch/Analytics/SystemMetrics/SystemMetricsAnalytics.res index 73ffee061..da89e0dcb 100644 --- a/src/screens/HyperSwitch/Analytics/SystemMetrics/SystemMetricsAnalytics.res +++ b/src/screens/HyperSwitch/Analytics/SystemMetrics/SystemMetricsAnalytics.res @@ -74,256 +74,6 @@ module APITableInfo = { } } -module ConnectorLatency = { - open DynamicSingleStat - open SystemMetricsAnalyticsUtils - open HSAnalyticsUtils - open AnalyticsTypes - @react.component - let make = () => { - let (_totalVolume, setTotalVolume) = React.useState(_ => 0) - - let getStatData = ( - singleStatData: systemMetricsObjectType, - timeSeriesData: array, - deltaTimestampData: DynamicSingleStat.deltaRange, - colType, - _mode, - ) => { - switch colType { - | Latency | _ => { - title: "Payments Confirm Latency", - tooltipText: "Average time taken for the entire Payments Confirm API call.", - deltaTooltipComponent: AnalyticsUtils.singlestatDeltaTooltipFormat( - singleStatData.latency, - deltaTimestampData.currentSr, - ), - value: singleStatData.latency /. 1000.0, - delta: { - singleStatData.latency - }, - data: constructData("latency", timeSeriesData), - statType: "LatencyMs", - showDelta: false, - } - } - } - - let defaultColumns: array> = [ - { - sectionName: "", - columns: [Latency], - }, - ] - - let singleStatBodyMake = (singleStatBodyEntity: singleStatBodyEntity) => { - let filters = - [ - ("api_name", ["PaymentsConfirm"->Js.Json.string]->Js.Json.array), - ("status_code", [200.0->Js.Json.number]->Js.Json.array), - ("flow_type", ["Payment"->Js.Json.string]->Js.Json.array), - ] - ->Js.Dict.fromArray - ->Js.Json.object_ - - [ - AnalyticsUtils.getFilterRequestBody( - ~filter=filters->Some, - ~metrics=singleStatBodyEntity.metrics, - ~delta=?singleStatBodyEntity.delta, - ~startDateTime=singleStatBodyEntity.startDateTime, - ~endDateTime=singleStatBodyEntity.endDateTime, - ~mode=singleStatBodyEntity.mode, - ~customFilter=?singleStatBodyEntity.customFilter, - ~source=?singleStatBodyEntity.source, - ~granularity=singleStatBodyEntity.granularity, - ~prefix=singleStatBodyEntity.prefix, - (), - )->Js.Json.object_, - ] - ->Js.Json.array - ->Js.Json.stringify - } - - let getStatEntity: 'a => DynamicSingleStat.entityType<'colType, 't, 't2> = metrics => { - urlConfig: [ - { - uri: `${HSwitchGlobalVars.hyperSwitchApiPrefix}/analytics/v1/metrics/${domain}`, - metrics: metrics->getStringListFromArrayDict, - singleStatBody: singleStatBodyMake, - singleStatTimeSeriesBody: singleStatBodyMake, - }, - ], - getObjects: itemToObjMapper, - getTimeSeriesObject: timeSeriesObjMapper, - defaultColumns, - getData: getStatData, - totalVolumeCol: None, - matrixUriMapper: _ => - `${HSwitchGlobalVars.hyperSwitchApiPrefix}/analytics/v1/metrics/${domain}`, - } - - let metrics = [Latency->getStringFromVarient]->Js.Array2.map(key => { - [("name", key->Js.Json.string)]->Js.Dict.fromArray->Js.Json.object_ - }) - - let singleStatEntity = getStatEntity(metrics) - let dateDict = HSwitchRemoteFilter.getDateFilteredObject() - - Js.Array2.map(getStringFromVarient)} - moduleName="SystemMetrics" - defaultStartDate={dateDict.start_time} - defaultEndDate={dateDict.end_time} - setTotalVolume - showPercentage=false - isHomePage=false - statSentiment={singleStatEntity.statSentiment->Belt.Option.getWithDefault(Js.Dict.empty())} - /> - } -} - -module HSiwtchPaymentConfirmLatency = { - open DynamicSingleStat - open SystemMetricsAnalyticsUtils - open Promise - open LogicUtils - @react.component - let make = () => { - let url = `${HSwitchGlobalVars.hyperSwitchApiPrefix}/analytics/v1/metrics/${domain}` - let (isLoading, setIsLoading) = React.useState(_ => true) - let (latency, setLatency) = React.useState(_ => 0) - let (connectorLatency, setConnectorLatency) = React.useState(_ => 0) - let (overallLatency, setOverallrLatency) = React.useState(_ => 0) - let updateDetails = APIUtils.useUpdateMethod() - let dateDict = HSwitchRemoteFilter.getDateFilteredObject() - - let singleStatBodyEntity = { - metrics: ["latency", "api_count", "status_code_count"], - startDateTime: dateDict.start_time, - endDateTime: dateDict.end_time, - } - - let singleStatBodyMake = (singleStatBodyEntity: singleStatBodyEntity, flowType) => { - let filters = - [ - ("api_name", ["PaymentsConfirm"->Js.Json.string]->Js.Json.array), - ("status_code", [200.0->Js.Json.number]->Js.Json.array), - ("flow_type", [flowType->Js.Json.string]->Js.Json.array), - ] - ->Js.Dict.fromArray - ->Js.Json.object_ - - [ - AnalyticsUtils.getFilterRequestBody( - ~filter=filters->Some, - ~metrics=singleStatBodyEntity.metrics, - ~delta=?singleStatBodyEntity.delta, - ~startDateTime=singleStatBodyEntity.startDateTime, - ~endDateTime=singleStatBodyEntity.endDateTime, - ~mode=singleStatBodyEntity.mode, - ~customFilter=?singleStatBodyEntity.customFilter, - ~source=?singleStatBodyEntity.source, - ~granularity=singleStatBodyEntity.granularity, - ~prefix=singleStatBodyEntity.prefix, - (), - )->Js.Json.object_, - ]->Js.Json.array - } - - let parseJson = json => { - json - ->getDictFromJsonObject - ->getJsonObjectFromDict("queryData") - ->getArrayFromJson([]) - ->Belt.Array.get(0) - ->Belt.Option.getWithDefault(Js.Json.object_(Js.Dict.empty())) - ->getDictFromJsonObject - ->getInt("latency", 0) - } - - let getOverallLatency = async () => { - updateDetails(url, singleStatBodyEntity->singleStatBodyMake("Payment"), Fetch.Post) - ->thenResolve(json => { - setOverallrLatency(_ => json->parseJson) - }) - ->catch(_ => { - setIsLoading(_ => false) - resolve() - }) - ->ignore - } - - let getConnectorLatency = () => { - updateDetails(url, singleStatBodyEntity->singleStatBodyMake("OutgoingEvent"), Fetch.Post) - ->thenResolve(json => { - setConnectorLatency(_ => json->parseJson) - setIsLoading(_ => false) - }) - ->catch(_ => { - setIsLoading(_ => false) - resolve() - }) - ->ignore - } - - React.useEffect2(() => { - let value = overallLatency - connectorLatency - setLatency(_ => value) - - None - }, (overallLatency, connectorLatency)) - - React.useEffect0(() => { - getOverallLatency()->ignore - getConnectorLatency()->ignore - - None - }) - - if isLoading { -
- -
- } else { -
-
-
-
-
- {latencyShortNum( - ~labelValue=latency->Belt.Int.toFloat /. 1000.0, - ~includeMilliseconds=true, - (), - ) - ->Js.String2.toLowerCase - ->React.string} -
-
-
-
- {"Hyperswitch overhead for payment confirm"->React.string} -
- - -
} - toolTipPosition=ToolTip.Top - /> -
-
-
-
- } - } -} - module SystemMetricsAnalytics = { open AnalyticsTypes open LogicUtils @@ -397,14 +147,6 @@ module SystemMetricsAnalytics = { let filterDataOrig = getFilterData(filterUri, Fetch.Post, filterBody) let filterData = filterDataOrig->Belt.Option.getWithDefault(Js.Json.object_(Js.Dict.empty())) - let _hideFiltersDefaultValue = - filterValue - ->Js.Dict.keys - ->Js.Array2.filter(item => - filteredTabKeys->Js.Array2.find(key => key == item)->Belt.Option.isSome - ) - ->Js.Array2.length < 1 - Js.Dict.entries->Js.Array2.length > 0}> {switch chartEntity1 { | Some(chartEntity) => diff --git a/src/screens/HyperSwitch/Connectors/ConnectorAccountDetails.res b/src/screens/HyperSwitch/Connectors/ConnectorAccountDetails.res index 89bb12e5d..05be61eba 100644 --- a/src/screens/HyperSwitch/Connectors/ConnectorAccountDetails.res +++ b/src/screens/HyperSwitch/Connectors/ConnectorAccountDetails.res @@ -34,8 +34,7 @@ module BusinessProfileRender = { let {setDashboardPageState} = React.useContext(GlobalProvider.defaultContext) let businessProfiles = Recoil.useRecoilValueFromAtom(HyperswitchAtom.businessProfilesAtom) - let arrayOfBusinessProfile = - businessProfiles->HSwitchMerchantAccountUtils.getArrayOfBusinessProfile + let arrayOfBusinessProfile = businessProfiles->MerchantAccountUtils.getArrayOfBusinessProfile let (showModalFromOtherScreen, setShowModalFromOtherScreen) = React.useState(_ => false) @@ -56,83 +55,43 @@ module BusinessProfileRender = { } <> -
- - InputFields.selectInput( - ~input={ - ...input, - onChange: { - ev => { - input.onChange(ev) - mixpanelEventWrapper( - ~url, - ~selectedConnector, - ~actionName=`settings_choose_country`, - ~hyperswitchMixPanel, - ) - } - }, + + InputFields.selectInput( + ~input={ + ...input, + onChange: { + ev => { + input.onChange(ev) + mixpanelEventWrapper( + ~url, + ~selectedConnector, + ~actionName=`settings_choose_country`, + ~hyperswitchMixPanel, + ) + } }, - ~deselectDisable=true, - ~disableSelect=isUpdateFlow, - ~customStyle="max-h-48", - ~options={ - arrayOfBusinessProfile->HSwitchMerchantAccountUtils.businessProfileNameDropDownOption - }, - ~buttonText="Select Country", - ~placeholder="", - (), - ), - (), - )} - /> - - InputFields.selectInput( - ~input={ - ...input, - onChange: { - ev => { - input.onChange(ev) - mixpanelEventWrapper( - ~url, - ~selectedConnector, - ~actionName=`settings_choose_label`, - ~hyperswitchMixPanel, - ) - } - }, - }, - ~options={ - arrayOfBusinessProfile->HSwitchMerchantAccountUtils.businessProfileIdDropDownOption - }, - ~buttonText="Select Option", - ~deselectDisable=true, - ~disableSelect=isUpdateFlow, - ~placeholder="", - (), - ), - (), - )} - /> -
+ }, + ~deselectDisable=true, + ~disableSelect=isUpdateFlow, + ~customStyle="max-h-48", + ~options={ + arrayOfBusinessProfile->MerchantAccountUtils.businessProfileNameDropDownOption + }, + ~buttonText="Select Country", + ~placeholder="", + (), + ), + (), + )} + />
- // {"Add new configuration"->React.string} - // onClickHandler("country")}> - // {React.string("here.")} - // {"Manage your list of business units"->React.string} HSwitchMerchantAccountUtils.getValueFromBusinessProfile + defaultBusinessProfile->MerchantAccountUtils.getValueFromBusinessProfile React.useEffect1(() => { mixpanelEventWrapper( @@ -343,7 +302,7 @@ let make = ( ~connector, ~bodyType, ~isPayoutFlow, - ~isLiveMode={featureFlagDetails.testLiveMode->Belt.Option.getWithDefault(false)}, + ~isLiveMode={featureFlagDetails.isLiveMode}, (), ) setScreenState(_ => Loading) @@ -396,7 +355,7 @@ let make = ( ~connector, ~bodyType, ~isPayoutFlow, - ~isLiveMode={featureFlagDetails.testLiveMode->Belt.Option.getWithDefault(false)}, + ~isLiveMode={featureFlagDetails.isLiveMode}, (), )->ignoreFields(connectorID, verifyConnectorIgnoreField) @@ -406,7 +365,7 @@ let make = ( ~connector=Some(connector), (), ) - let _response = await updateDetails(url, body, Post) + let _ = await updateDetails(url, body, Post) setShowVerifyModal(_ => false) onSubmitMain(values)->ignore } catch { @@ -485,9 +444,7 @@ let make = ( formClass="flex flex-col ">
- Js.String2.toUpperCase} className="w-14 h-14 rounded-full" - /> + Js.String2.toUpperCase} />

{connector->LogicUtils.capitalizeString->React.string}

diff --git a/src/screens/HyperSwitch/Connectors/ConnectorAccountDetailsHelper.res b/src/screens/HyperSwitch/Connectors/ConnectorAccountDetailsHelper.res index 366abf74f..9bbb1c54e 100644 --- a/src/screens/HyperSwitch/Connectors/ConnectorAccountDetailsHelper.res +++ b/src/screens/HyperSwitch/Connectors/ConnectorAccountDetailsHelper.res @@ -132,7 +132,7 @@ module RenderConnectorInputFields = { ~selectedConnector, ~dict=details, ~fieldName=formName, - ~isLiveMode={featureFlagDetails.testLiveMode->Belt.Option.getWithDefault(false)}, + ~isLiveMode={featureFlagDetails.isLiveMode}, )} />
diff --git a/src/screens/HyperSwitch/Connectors/ConnectorList.res b/src/screens/HyperSwitch/Connectors/ConnectorList.res index 65aabb996..eff322ee2 100644 --- a/src/screens/HyperSwitch/Connectors/ConnectorList.res +++ b/src/screens/HyperSwitch/Connectors/ConnectorList.res @@ -1,3 +1,27 @@ +external formEventToStr: ReactEvent.Form.t => string = "%identity" + +let p1MediumTextStyle = HSwitchUtils.getTextClass(~textVariant=P1, ~paragraphTextVariant=Medium, ()) + +module RequestConnector = { + @react.component + let make = (~connectorList, ~setShowModal) => { + Js.Array2.length === 0}> +
+
+ +
+

+ {"Uh-oh! Looks like we couldn't find the processor you were searching for."->React.string} +

+
+
+ } +} + module NewProcessorCards = { @react.component let make = ( @@ -11,12 +35,11 @@ module NewProcessorCards = { ->LogicUtils.safeParse ->FeatureFlagUtils.featureFlagType - let connectorsAvailableForIntegration = - featureFlagDetails.testLiveMode->Belt.Option.getWithDefault(false) - ? ConnectorUtils.connectorListForLive - : isPayoutFlow - ? ConnectorUtils.payoutConnectorList - : ConnectorUtils.connectorList + let connectorsAvailableForIntegration = featureFlagDetails.isLiveMode + ? ConnectorUtils.connectorListForLive + : isPayoutFlow + ? ConnectorUtils.payoutConnectorList + : ConnectorUtils.connectorList let unConfiguredConnectors = connectorsAvailableForIntegration->Js.Array2.filter(total => @@ -24,6 +47,8 @@ module NewProcessorCards = { ) let (showModal, setShowModal) = React.useState(_ => false) + let (searchedConnector, setSearchedConnector) = React.useState(_ => "") + let searchRef = React.useRef(Js.Nullable.null) let urlPrefix = isPayoutFlow ? "payoutconnectors/new" : "connectors/new" let handleClick = connectorName => { @@ -31,104 +56,153 @@ module NewProcessorCards = { } let unConfiguredConnectorsCount = unConfiguredConnectors->Js.Array2.length - let descriptedConnectors = (connectorList, heading, showRequestConnectorBtn) => { + let handleSearch = event => { + let val = ref(ReactEvent.Form.currentTarget(event)["value"]) + setSearchedConnector(_ => val.contents) + } + + let descriptedConnectors = ( + connectorList, + heading, + showRequestConnectorBtn, + ~showSearch=true, + (), + ) => { <> +

+ {heading->React.string} +

-

- {heading->React.string} -

+ + ReactDOM.Ref.domRef} + type_="text" + value=searchedConnector + onChange=handleSearch + placeholder="Search a processor" + className={`rounded-md px-4 py-2 focus:outline-none w-1/3 border`} + /> +
setShowModal(_ => true)} className="text-blue-900 cursor-pointer underline underline-offset-4 font-medium"> - {"Can't find the processor of you're choice?"->React.string} + {"Can't find the processor of your choice?"->React.string}
-
- {connectorList - ->Array.mapWithIndex((connector, i) => { - let connectorName = connector->ConnectorUtils.getConnectorNameString - let connectorInfo = connector->ConnectorUtils.getConnectorInfo - let size = switch connectorName->ConnectorUtils.getConnectorNameTypeFromString { - | PHONYPAY | PRETENDPAY | FAUXPAY => "w-8 h-8" - | _ => "w-14 h-14 rounded-full" - } + Js.Array2.length > 0}> +
+ {connectorList + ->Array.mapWithIndex((connector, i) => { + let connectorName = connector->ConnectorUtils.getConnectorNameString + let connectorInfo = connector->ConnectorUtils.getConnectorInfo + let size = "w-14 h-14 rounded-sm" -
string_of_int} - className="border p-8 gap-4 bg-white rounded flex flex-col justify-between"> -
- Js.String2.toUpperCase} className=size /> -

- {connectorName->LogicUtils.capitalizeString->React.string} -

+
string_of_int} + className="border p-6 gap-4 bg-white rounded flex flex-col justify-between"> +
+ Js.String2.toUpperCase} className=size /> +

+ {connectorName->LogicUtils.capitalizeString->React.string} +

+
+
+ {connectorInfo.description->React.string} +
+
-
- {connectorInfo.description->React.string} -
-
- }) - ->React.array} -
+ }) + ->React.array} +
+
+ } - let iconsConnectors = (connectorList, heading, showRequestConnectorBtn) => { + let iconsConnectors = ( + connectorList, + heading, + showRequestConnectorBtn, + ~showSearch=true, + (), + ) => { <> +

+ {heading->React.string} +

-

- {heading->React.string} -

+ + ReactDOM.Ref.domRef} + type_="text" + value=searchedConnector + onChange=handleSearch + placeholder="Search a processor" + className={`rounded-md px-4 py-2 focus:outline-none w-1/3 border`} + /> +
setShowModal(_ => true)} className="text-blue-900 cursor-pointer underline underline-offset-4 font-medium"> - {"Can't find the processor of you're choice?"->React.string} + {"Can't find the processor of your choice?"->React.string}
-
- {connectorList - ->Array.mapWithIndex((connector, i) => { - let connectorName = connector->ConnectorUtils.getConnectorNameString - let size = switch connectorName->ConnectorUtils.getConnectorNameTypeFromString { - | PHONYPAY | PRETENDPAY | FAUXPAY => "w-8 h-8" - | _ => "w-14 h-14 rounded-full" - } - string_of_int} - description={connectorName->LogicUtils.capitalizeString} - toolTipFor={
handleClick(connectorName)}> - Js.String2.toUpperCase} className=size /> -
} - toolTipPosition={Top} - tooltipWidthClass="w-30" - /> - }) - ->React.array} -
+ Js.Array2.length > 0}> +
+ {connectorList + ->Array.mapWithIndex((connector, i) => { + let connectorName = connector->ConnectorUtils.getConnectorNameString + let size = "w-14 h-14 rounded-sm" + string_of_int} + description={connectorName->LogicUtils.capitalizeString} + toolTipFor={
handleClick(connectorName)}> + Js.String2.toUpperCase} className=size /> +
} + toolTipPosition={Top} + tooltipWidthClass="w-30" + /> + }) + ->React.array} +
+
+ } + let connectorListFiltered = { + if searchedConnector->Js.String2.length > 0 { + connectorsAvailableForIntegration->Js.Array2.filter(item => + item + ->ConnectorUtils.getConnectorNameString + ->Js.String2.includes(searchedConnector->Js.String2.toLowerCase) + ) + } else { + connectorsAvailableForIntegration + } + } 0}>
{if showIcons { <> - {connectorsAvailableForIntegration->iconsConnectors("Connect a new processor", true)} + {connectorListFiltered->iconsConnectors("Connect a new connector", true, ())} { {featureFlagDetails.testProcessors ->ConnectorUtils.dummyConnectorList - ->iconsConnectors("Connect a test processor", false)} + ->iconsConnectors("Connect a test connector", false, ~showSearch=false, ())} } } else { @@ -136,18 +210,15 @@ module NewProcessorCards = { {featureFlagDetails.testProcessors ->ConnectorUtils.dummyConnectorList - ->descriptedConnectors("Connect a test processor", false)} + ->descriptedConnectors("Connect a test connector", false, ~showSearch=false, ())} - {connectorsAvailableForIntegration->descriptedConnectors( - "Connect a new processor", - true, - )} + {connectorListFiltered->descriptedConnectors("Connect a new connector", true, ())} }}
{ setOffset entity={ConnectorTableUtils.connectorEntity(`${entityPrefix}connectors`)} currrentFetchCount={filteredConnectorData->Js.Array2.length} - collapseTabelRow=false + collapseTableRow=false /> diff --git a/src/screens/HyperSwitch/Connectors/ConnectorPaymentMethod.res b/src/screens/HyperSwitch/Connectors/ConnectorPaymentMethod.res index 05997d4a8..be2e23d32 100644 --- a/src/screens/HyperSwitch/Connectors/ConnectorPaymentMethod.res +++ b/src/screens/HyperSwitch/Connectors/ConnectorPaymentMethod.res @@ -86,9 +86,7 @@ let make = (
- Js.String2.toUpperCase} className="w-14 h-14 rounded-full" - /> + Js.String2.toUpperCase} />

{connector->LogicUtils.capitalizeString->React.string}

diff --git a/src/screens/HyperSwitch/Connectors/ConnectorPreview.res b/src/screens/HyperSwitch/Connectors/ConnectorPreview.res index 2123eeab2..3aa47e30d 100644 --- a/src/screens/HyperSwitch/Connectors/ConnectorPreview.res +++ b/src/screens/HyperSwitch/Connectors/ConnectorPreview.res @@ -6,7 +6,7 @@ module InfoField = { Js.String2.length > 0}>

{label->React.string}

-

{str->React.string}

+

{str->React.string}

} @@ -102,6 +102,15 @@ module ConnectorSummaryGrid = { let url = RescriptReactRouter.useUrl() let showToast = ToastState.useShowToast() let hyperswitchMixPanel = HSMixPanel.useSendEvent() + let businessProfiles = HyperswitchAtom.businessProfilesAtom->Recoil.useRecoilValueFromAtom + let defaultBusinessProfile = businessProfiles->MerchantAccountUtils.getValueFromBusinessProfile + let arrayOfBusinessProfile = businessProfiles->MerchantAccountUtils.getArrayOfBusinessProfile + let currentProfileName = + arrayOfBusinessProfile + ->Js.Array2.find((ele: HSwitchSettingTypes.profileEntity) => + ele.profile_id === connectorInfo.profile_id + ) + ->Belt.Option.getWithDefault(defaultBusinessProfile) let merchantId = HSLocalStorage.getFromMerchantDetails("merchant_id") let connectorDetails = React.useMemo1(() => { try { @@ -129,9 +138,9 @@ module ConnectorSummaryGrid = { let webhooksUrl = ConnectorUtils.getWebhooksUrl(~connectorName=connector, ~merchantId)
-
+

{"Processor Mode"->React.string}

-
+
{if connectorInfo.test_mode { {"TEST MODE"->React.string} @@ -143,13 +152,15 @@ module ConnectorSummaryGrid = { }}
-
-

{"Profile Id"->React.string}

-
{connectorInfo.profile_id->React.string}
+
+

{"Profile"->React.string}

+
+ {`${currentProfileName.profile_name} - ${connectorInfo.profile_id}`->React.string} +
-
+

{"API Keys"->React.string}

-
+
{connectorAccountFields ->Js.Dict.keys ->Array.mapWithIndex((field, index) => { @@ -164,31 +175,28 @@ module ConnectorSummaryGrid = { ->React.array}
-
+

{"Webhooks"->React.string}

-
-
-
{webhooksUrl->React.string}
-
{ - Clipboard.writeText(webhooksUrl) - showToast(~message="Copied to Clipboard!", ~toastType=ToastSuccess, ()) - hyperswitchMixPanel( - ~pageName=`${url.path->LogicUtils.getListHead}`, - ~contextName="webhook_processor", - ~actionName="hs_webhookcopied", - (), - ) - }}> - -
-
+
+
{webhooksUrl->React.string}
+ { + Clipboard.writeText(webhooksUrl) + showToast(~message="Copied to Clipboard!", ~toastType=ToastSuccess, ()) + hyperswitchMixPanel( + ~pageName=`${url.path->LogicUtils.getListHead}`, + ~contextName="webhook_processor", + ~actionName="hs_webhookcopied", + (), + ) + }} + />
-
+

{"PMTs"->React.string}

-
+
{connectorInfo.payment_methods_enabled ->Array.mapWithIndex((field, index) => { Js.Json.object_, Post) + let _ = await updateDetails(url, disableConnectorPayload->Js.Json.object_, Post) showToast(~message=`Successfully Saved the Changes`, ~toastType=ToastSuccess, ()) RescriptReactRouter.push("/connectors") } catch { @@ -272,8 +280,7 @@ let make = (
Js.String2.toUpperCase} - className="w-14 h-14 rounded-full" + gateway={connectorInfo.connector_name->Js.String2.toUpperCase} className="w-14 h-14" />

{connectorInfo.connector_name->LogicUtils.capitalizeString->React.string} diff --git a/src/screens/HyperSwitch/Connectors/ConnectorTableUtils.res b/src/screens/HyperSwitch/Connectors/ConnectorTableUtils.res index 8d1f943dd..21a26b2a2 100644 --- a/src/screens/HyperSwitch/Connectors/ConnectorTableUtils.res +++ b/src/screens/HyperSwitch/Connectors/ConnectorTableUtils.res @@ -202,10 +202,7 @@ let getCell = (connector: connectorPayload, colType): Table.cell => { }) | ProfileId => Text(connector.profile_id) | ProfileName => - Table.CustomCell( - , - "", - ) + Table.CustomCell(, "") | ConnectorLabel => Text(connector.connector_label) // | Actions => diff --git a/src/screens/HyperSwitch/Connectors/ConnectorUtils.res b/src/screens/HyperSwitch/Connectors/ConnectorUtils.res index c8541627b..8b08ba1b4 100644 --- a/src/screens/HyperSwitch/Connectors/ConnectorUtils.res +++ b/src/screens/HyperSwitch/Connectors/ConnectorUtils.res @@ -194,14 +194,15 @@ let connectorList: array = [ let connectorListForLive: array = [ STRIPE, ADYEN, - CHECKOUT, - ZEN, - BLUESNAP, - TRUSTPAY, - PAYME, PAYPAL, + BANKOFAMERICA, + BLUESNAP, + CHECKOUT, CRYPTOPAY, IATAPAY, + PAYME, + TRUSTPAY, + ZEN, ] let getPaymentMethodFromString = paymentMethod => { diff --git a/src/screens/HyperSwitch/Connectors/ConnectorWebhooks.res b/src/screens/HyperSwitch/Connectors/ConnectorWebhooks.res index 614df31b3..6cde1d7c5 100644 --- a/src/screens/HyperSwitch/Connectors/ConnectorWebhooks.res +++ b/src/screens/HyperSwitch/Connectors/ConnectorWebhooks.res @@ -57,9 +57,7 @@ let make = (~connectorName, ~setCurrentStep, ~currentStep, ~isUpdateFlow) => {
- Js.String2.toUpperCase} className="w-14 h-14 rounded-full" - /> + Js.String2.toUpperCase} className="w-14 h-14" />

{connectorName->LogicUtils.capitalizeString->React.string}

diff --git a/src/screens/HyperSwitch/Connectors/Wallets/ApplePayWalletIntegration.res b/src/screens/HyperSwitch/Connectors/Wallets/ApplePayWalletIntegration.res index 5717838cd..b6b7f13bd 100644 --- a/src/screens/HyperSwitch/Connectors/Wallets/ApplePayWalletIntegration.res +++ b/src/screens/HyperSwitch/Connectors/Wallets/ApplePayWalletIntegration.res @@ -91,7 +91,7 @@ module Simplified = { try { let (body, domainName) = values->constructVerifyApplePayReq(connectorID) let verifyAppleUrl = getURL(~entityName=VERIFY_APPLE_PAY, ~methodType=Post, ()) - let _response = await updateAPIHook(`${verifyAppleUrl}/${merchantId}`, body, Post) + let _ = await updateAPIHook(`${verifyAppleUrl}/${merchantId}`, body, Post) let updatedValue = values->constructApplePayMetadata(metadataInputs, #simplified) update(updatedValue) diff --git a/src/screens/HyperSwitch/Developer/DeveloperUtils.res b/src/screens/HyperSwitch/Developer/APIKeys/DeveloperUtils.res similarity index 91% rename from src/screens/HyperSwitch/Developer/DeveloperUtils.res rename to src/screens/HyperSwitch/Developer/APIKeys/DeveloperUtils.res index 9b366d562..b0701f9b3 100644 --- a/src/screens/HyperSwitch/Developer/DeveloperUtils.res +++ b/src/screens/HyperSwitch/Developer/APIKeys/DeveloperUtils.res @@ -1,22 +1,10 @@ open HSwitchSettingTypes -let titleClass = "md:font-bold font-semibold md:text-fs-16 text-fs-13 text-jp-gray-900 text-opacity-75 dark:text-white dark:text-opacity-75" - -let paymentsEvents = ["succeeded", "failed", "processing", "action_required"] -let refundsEvents = ["succeeded", "failed"] -let disputesEvents = ["opened", "expired", "accepted", "cancelled", "challenged", "won", "lost"] - -let webhookEventsDict = - [ - ("payment", paymentsEvents->Js.Array2.map(Js.Json.string)->Js.Json.array), - ("refund", refundsEvents->Js.Array2.map(Js.Json.string)->Js.Json.array), - ("dispute", disputesEvents->Js.Array2.map(Js.Json.string)->Js.Json.array), - ]->Js.Dict.fromArray let validateAPIKeyForm = ( values: Js.Json.t, ~setIsDisabled=_ => (), keys: array, - ~setShowCustomDate=_ => (), + ~setShowCustomDate, (), ) => { let errors = Js.Dict.empty() @@ -81,7 +69,6 @@ let getRecordTypeFromString = value => { type apiKey = { key_id: string, - merchant_id: string, name: string, description: string, prefix: string, @@ -93,7 +80,6 @@ type apiKey = { let itemToObjMapper = dict => { open LogicUtils { - merchant_id: getString(dict, "merchant_id", ""), key_id: getString(dict, "key_id", ""), name: getString(dict, "name", ""), description: getString(dict, "description", ""), diff --git a/src/screens/HyperSwitch/Developer/KeyManagement.res b/src/screens/HyperSwitch/Developer/APIKeys/KeyManagement.res similarity index 99% rename from src/screens/HyperSwitch/Developer/KeyManagement.res rename to src/screens/HyperSwitch/Developer/APIKeys/KeyManagement.res index 667f31fc1..786f55fa7 100644 --- a/src/screens/HyperSwitch/Developer/KeyManagement.res +++ b/src/screens/HyperSwitch/Developer/APIKeys/KeyManagement.res @@ -105,7 +105,7 @@ module ApiEditModal = { } } - let _res = getAPIKeyDetails() + let _ = getAPIKeyDetails() } catch { | Js.Exn.Error(e) => switch Js.Exn.message(e) { diff --git a/src/screens/HyperSwitch/Developer/PublishableAndHashKeySection.res b/src/screens/HyperSwitch/Developer/APIKeys/PublishableAndHashKeySection.res similarity index 96% rename from src/screens/HyperSwitch/Developer/PublishableAndHashKeySection.res rename to src/screens/HyperSwitch/Developer/APIKeys/PublishableAndHashKeySection.res index 4935c4cdf..042edf735 100644 --- a/src/screens/HyperSwitch/Developer/PublishableAndHashKeySection.res +++ b/src/screens/HyperSwitch/Developer/APIKeys/PublishableAndHashKeySection.res @@ -4,7 +4,7 @@ let make = () => { let url = RescriptReactRouter.useUrl() let fetchDetails = APIUtils.useGetMethod() let (merchantInfo, setMerchantInfo) = React.useState(() => - Js.Json.null->HSwitchMerchantAccountUtils.getMerchantDetails + Js.Json.null->MerchantAccountUtils.getMerchantDetails ) let (screenState, setScreenState) = React.useState(_ => PageLoaderWrapper.Loading) @@ -13,7 +13,7 @@ let make = () => { try { let accountUrl = APIUtils.getURL(~entityName=MERCHANT_ACCOUNT, ~methodType=Get, ()) let merchantDetails = await fetchDetails(accountUrl) - let merchantInfo = merchantDetails->HSwitchMerchantAccountUtils.getMerchantDetails + let merchantInfo = merchantDetails->MerchantAccountUtils.getMerchantDetails setMerchantInfo(_ => merchantInfo) setScreenState(_ => PageLoaderWrapper.Success) } catch { diff --git a/src/screens/HyperSwitch/Developer/Webhooks.res b/src/screens/HyperSwitch/Developer/PaymentSettings/PaymentSettings.res similarity index 73% rename from src/screens/HyperSwitch/Developer/Webhooks.res rename to src/screens/HyperSwitch/Developer/PaymentSettings/PaymentSettings.res index 35685e3d7..f6e9911ad 100644 --- a/src/screens/HyperSwitch/Developer/Webhooks.res +++ b/src/screens/HyperSwitch/Developer/PaymentSettings/PaymentSettings.res @@ -1,9 +1,37 @@ +module InfoViewForWebhooks = { + @react.component + let make = (~heading, ~subHeading, ~isCopy=false) => { + let showToast = ToastState.useShowToast() + let onCopyClick = ev => { + ev->ReactEvent.Mouse.stopPropagation + Clipboard.writeText(subHeading) + showToast(~message="Copied to Clipboard!", ~toastType=ToastSuccess, ()) + } + +
+

{heading->React.string}

+
+

{subHeading->React.string}

+ + { + onCopyClick(ev) + }} + /> + +
+
+ } +} + @react.component let make = (~webhookOnly=false, ~showFormOnly=false, ~profileId="") => { open DeveloperUtils open APIUtils open HSwitchUtils - open HSwitchMerchantAccountUtils + open MerchantAccountUtils let url = RescriptReactRouter.useUrl() let id = url.path->Belt.List.toArray->Belt.Array.get(1)->Belt.Option.getWithDefault(profileId) let businessProfileDetails = useGetBusinessProflile(id) @@ -16,7 +44,7 @@ let make = (~webhookOnly=false, ~showFormOnly=false, ~profileId="") => { let (screenState, setScreenState) = React.useState(_ => PageLoaderWrapper.Success) let bgClass = webhookOnly ? "" : "bg-white dark:bg-jp-gray-lightgray_background" - let fetchBusinessProfiles = HSwitchMerchantAccountUtils.useFetchBusinessProfiles() + let fetchBusinessProfiles = MerchantAccountUtils.useFetchBusinessProfiles() let onSubmit = async (values, _) => { try { @@ -50,11 +78,11 @@ let make = (~webhookOnly=false, ~showFormOnly=false, ~profileId="") => { LogicUtils.capitalizeString} + currentPageTitle={businessProfileDetails.profile_name} cursorStyle="cursor-pointer" /> @@ -65,13 +93,13 @@ let make = (~webhookOnly=false, ~showFormOnly=false, ~profileId="") => { : "border border-jp-gray-500 rounded-md dark:border-jp-gray-960"} ${bgClass} `}> parseBussinessProfileJson->Js.Json.object_} + initialValues={businessProfileDetails->parseBussinessProfileJson->Js.Json.object_} subscription=ReactFinalForm.subscribeToValues validate={values => { open HSwitchSettingTypes - HSwitchMerchantAccountUtils.validateMerchantAccountForm( + MerchantAccountUtils.validateMerchantAccountForm( ~values, - ~setIsDisabled, + ~setIsDisabled=Some(setIsDisabled), ~fieldsToValidate={ [WebhookUrl, ReturnUrl]->Js.Array2.filter(urlField => urlField === WebhookUrl || !webhookOnly @@ -87,6 +115,26 @@ let make = (~webhookOnly=false, ~showFormOnly=false, ~profileId="") => { className={`${showFormOnly ? "" : "px-2 py-4"} flex flex-col gap-7 overflow-hidden`}> +
+ + +
+
+ + Belt.Option.getWithDefault( + "NA", + )} + isCopy=true + /> +
{[webhookUrl, returnUrl] ->Js.Array2.filter(urlField => urlField.label === "Webhook URL" || !webhookOnly) @@ -112,6 +160,7 @@ let make = (~webhookOnly=false, ~showFormOnly=false, ~profileId="") => { />
+ }} /> diff --git a/src/screens/HyperSwitch/Developer/PaymentSettings/PaymentSettingsList.res b/src/screens/HyperSwitch/Developer/PaymentSettings/PaymentSettingsList.res new file mode 100644 index 000000000..709c6c1b8 --- /dev/null +++ b/src/screens/HyperSwitch/Developer/PaymentSettings/PaymentSettingsList.res @@ -0,0 +1,38 @@ +@react.component +let make = ( + ~isFromSettings=true, + ~showModalFromOtherScreen=false, + ~setShowModalFromOtherScreen=_bool => (), +) => { + open PaymentSettingsListEntity + let (offset, setOffset) = React.useState(_ => 0) + + let businessProfileValues = + HyperswitchAtom.businessProfilesAtom + ->Recoil.useRecoilValueFromAtom + ->MerchantAccountUtils.getArrayOfBusinessProfile + + +
+
+ + Js.Array2.map(Js.Nullable.return)} + totalResults={businessProfileValues->Js.Array2.length} + offset + setOffset + currrentFetchCount={businessProfileValues->Js.Array2.length} + /> +
+
+
+} diff --git a/src/screens/HyperSwitch/Developer/PaymentSettings/PaymentSettingsListEntity.res b/src/screens/HyperSwitch/Developer/PaymentSettings/PaymentSettingsListEntity.res new file mode 100644 index 000000000..2c1350547 --- /dev/null +++ b/src/screens/HyperSwitch/Developer/PaymentSettings/PaymentSettingsListEntity.res @@ -0,0 +1,63 @@ +open HSwitchSettingTypes +open BusinessMappingUtils + +type columns = + | ProfileName + | ReturnUrl + | WebhookUrl + +let visibleColumns = [WebhookUrl, ReturnUrl, ProfileName] + +let defaultColumns = [ProfileName, ReturnUrl, WebhookUrl] + +let allColumns = [ProfileName, ReturnUrl, WebhookUrl] + +let getHeading = colType => { + switch colType { + | ProfileName => + Table.makeHeaderInfo(~key="profile_name", ~title="Profile Name", ~showSort=true, ()) + | ReturnUrl => Table.makeHeaderInfo(~key="return_url", ~title="Return URL", ~showSort=true, ()) + | WebhookUrl => Table.makeHeaderInfo(~key="webhook_url", ~title="Webhook URL", ~showSort=true, ()) + } +} + +let getCell = (item: profileEntity, colType): Table.cell => { + switch colType { + | ProfileName => Text(item.profile_name) + | ReturnUrl => Text(item.return_url->Belt.Option.getWithDefault("")) + | WebhookUrl => Text(item.webhook_details.webhook_url->Belt.Option.getWithDefault("")) + } +} + +let itemToObjMapper = dict => { + open LogicUtils + open MerchantAccountUtils + { + profile_id: getString(dict, "profile_id", ""), + profile_name: getString(dict, ProfileName->getStringFromVariant, ""), + merchant_id: getString(dict, "merchant_id", ""), + return_url: getOptionString(dict, "return_url"), + payment_response_hash_key: getOptionString(dict, "payment_response_hash_key"), + webhook_details: dict + ->getObj("webhook_details", Js.Dict.empty()) + ->constructWebhookDetailsObject, + } +} + +let getItems: Js.Json.t => array = json => { + LogicUtils.getArrayDataFromJson(json, itemToObjMapper) +} + +let webhookProfileTableEntity = EntityType.makeEntity( + ~uri="", + ~getObjects=getItems, + ~defaultColumns, + ~allColumns, + ~getHeading, + ~dataKey="", + ~getCell, + ~getShowLink={ + profile => `/payment-settings/${profile.profile_id}` + }, + (), +) diff --git a/src/screens/HyperSwitch/Disputes/Disputes.res b/src/screens/HyperSwitch/Disputes/Disputes.res index 60397188f..9f7bd78af 100644 --- a/src/screens/HyperSwitch/Disputes/Disputes.res +++ b/src/screens/HyperSwitch/Disputes/Disputes.res @@ -89,9 +89,9 @@ let make = () => {
- { customColumnMapper={DisputesEntity.disputesMapDefaultCols} showSerialNumberInCustomizeColumns=false sortingBasedOnDisabled=false - hideTitle=true />
diff --git a/src/screens/HyperSwitch/FraudAndRisk/FRMConfigure.res b/src/screens/HyperSwitch/FraudAndRisk/FRMConfigure.res index 7919ffbeb..b6df5589b 100644 --- a/src/screens/HyperSwitch/FraudAndRisk/FRMConfigure.res +++ b/src/screens/HyperSwitch/FraudAndRisk/FRMConfigure.res @@ -32,7 +32,7 @@ let make = () => { setInitialValues(_ => { generateInitialValuesDict( ~selectedFRMInfo=frmInfo, - ~isLiveMode=featureFlagDetails.testLiveMode->Belt.Option.getWithDefault(false), + ~isLiveMode=featureFlagDetails.isLiveMode, (), ) }) diff --git a/src/screens/HyperSwitch/FraudAndRisk/FRMIntegrationFields.res b/src/screens/HyperSwitch/FraudAndRisk/FRMIntegrationFields.res index b38dbca63..6e9cfb80e 100644 --- a/src/screens/HyperSwitch/FraudAndRisk/FRMIntegrationFields.res +++ b/src/screens/HyperSwitch/FraudAndRisk/FRMIntegrationFields.res @@ -33,7 +33,7 @@ module AdvanceSettings = { let businessProfileValue = Recoil.useRecoilValueFromAtom( HyperswitchAtom.businessProfilesAtom, - )->HSwitchMerchantAccountUtils.getValueFromBusinessProfile + )->MerchantAccountUtils.getValueFromBusinessProfile React.useEffect1(() => { if !isUpdateFlow { @@ -228,11 +228,7 @@ let make = ( } | None => - generateInitialValuesDict( - ~selectedFRMInfo, - ~isLiveMode={featureFlagDetails.testLiveMode->Belt.Option.getWithDefault(false)}, - (), - ) + generateInitialValuesDict(~selectedFRMInfo, ~isLiveMode={featureFlagDetails.isLiveMode}, ()) } }, [retrivedValues]) @@ -280,7 +276,7 @@ let make = ( ->Js.Json.object_ let url = getURL(~entityName=MERCHANT_ACCOUNT, ~methodType=Post, ()) try { - let _res = await updateDetails(url, body, Post) + let _ = await updateDetails(url, body, Post) } catch { | _ => () } diff --git a/src/screens/HyperSwitch/FraudAndRisk/FRMSelect.res b/src/screens/HyperSwitch/FraudAndRisk/FRMSelect.res index 82c783905..ec508b529 100644 --- a/src/screens/HyperSwitch/FraudAndRisk/FRMSelect.res +++ b/src/screens/HyperSwitch/FraudAndRisk/FRMSelect.res @@ -199,7 +199,7 @@ let make = () => { setOffset entity={FRMTableUtils.connectorEntity("fraud-risk-management")} currrentFetchCount={filteredFRMData->Js.Array2.length} - collapseTabelRow=false + collapseTableRow=false /> diff --git a/src/screens/HyperSwitch/FraudAndRisk/FRMSummary.res b/src/screens/HyperSwitch/FraudAndRisk/FRMSummary.res index 25cf6560a..255e5eff6 100644 --- a/src/screens/HyperSwitch/FraudAndRisk/FRMSummary.res +++ b/src/screens/HyperSwitch/FraudAndRisk/FRMSummary.res @@ -79,7 +79,7 @@ let make = (~initialValues, ~currentStep, ~setCurrentStep, ~isUpdateFlow) => { let frmID = initialValues->getDictFromJsonObject->getString("merchant_connector_id", "") let disableFRMPayload = initialValues->FRMTypes.getDisableConnectorPayload(isFRMDisabled) let url = getURL(~entityName=FRAUD_RISK_MANAGEMENT, ~methodType=Post, ~id=Some(frmID), ()) - let _res = await updateDetails(url, disableFRMPayload->Js.Json.object_, Post) + let _ = await updateDetails(url, disableFRMPayload->Js.Json.object_, Post) showToast(~message=`Successfully Saved the Changes`, ~toastType=ToastSuccess, ()) RescriptReactRouter.push("/fraud-risk-management") } catch { diff --git a/src/screens/HyperSwitch/HSMixPanel.res b/src/screens/HyperSwitch/HSMixPanel.res index 3b03952e0..0714c40b6 100644 --- a/src/screens/HyperSwitch/HSMixPanel.res +++ b/src/screens/HyperSwitch/HSMixPanel.res @@ -69,7 +69,7 @@ let useSendEvent = () => { } try { - let _res = await fetchApi( + let _ = await fetchApi( `${dashboardUrl}/mixpanel/track`, ~method_=Fetch.Post, ~bodyStr=`data=${body diff --git a/src/screens/HyperSwitch/HSwitchRemoteFilter.res b/src/screens/HyperSwitch/HSwitchRemoteFilter.res index cafc07e40..dbe71f353 100644 --- a/src/screens/HyperSwitch/HSwitchRemoteFilter.res +++ b/src/screens/HyperSwitch/HSwitchRemoteFilter.res @@ -201,7 +201,7 @@ module SearchBarFilter = {
Js.String2.length > 0}>
- diff --git a/src/screens/HyperSwitch/Routing/DefaultRouting.res b/src/screens/HyperSwitch/Routing/DefaultRouting.res index 359a7ac3d..77add1855 100644 --- a/src/screens/HyperSwitch/Routing/DefaultRouting.res +++ b/src/screens/HyperSwitch/Routing/DefaultRouting.res @@ -1,6 +1,6 @@ open APIUtils open APIUtilsTypes -open HSwitchMerchantAccountUtils +open MerchantAccountUtils @react.component let make = () => { @@ -10,8 +10,7 @@ let make = () => { let fetchDetails = useGetMethod() let showPopUp = PopUpState.useShowPopUp() let businessProfiles = HyperswitchAtom.businessProfilesAtom->Recoil.useRecoilValueFromAtom - let defaultBusinessProfile = - businessProfiles->HSwitchMerchantAccountUtils.getValueFromBusinessProfile + let defaultBusinessProfile = businessProfiles->MerchantAccountUtils.getValueFromBusinessProfile let arrayOfBusinessProfile = businessProfiles->getArrayOfBusinessProfile let (profile, setProfile) = React.useState(_ => defaultBusinessProfile.profile_id) let (screenState, setScreenState) = React.useState(_ => PageLoaderWrapper.Loading) @@ -102,22 +101,12 @@ let make = () => {
Js.Json.object_}>
-
-
- businessProfileNameDropDownOption} - label="Profile Name" - /> - businessProfileIdDropDownOption} - label="Profile Id" - /> -
-
+ businessProfileNameDropDownOption} + label="Profile" + />
{ | ProfileId => Text(historyData.profile_id) | ProfileName => Table.CustomCell( - , + , "", ) | Description => Text(historyData.description) diff --git a/src/screens/HyperSwitch/Routing/PriorityRouting.res b/src/screens/HyperSwitch/Routing/PriorityRouting.res index ef7e572da..5d1a2d0d9 100644 --- a/src/screens/HyperSwitch/Routing/PriorityRouting.res +++ b/src/screens/HyperSwitch/Routing/PriorityRouting.res @@ -36,7 +36,7 @@ module SimpleRoutingView = { let activateRuleURL = getURL(~entityName=ROUTING, ~methodType=Post, ~id=None, ()) - let _res = await updateDetails( + let _ = await updateDetails( activateRuleURL, getRoutingPayload( data, @@ -65,7 +65,7 @@ module SimpleRoutingView = { try { setScreenState(_ => Loading) let activateRuleURL = getURL(~entityName=ROUTING, ~methodType=Post, ~id=routingId, ()) - let _res = await updateDetails(activateRuleURL, Js.Dict.empty()->Js.Json.object_, Post) + let _ = await updateDetails(activateRuleURL, Js.Dict.empty()->Js.Json.object_, Post) showToast( ~message="Successfully Activated Selected Configuration !", ~toastType=ToastState.ToastSuccess, diff --git a/src/screens/HyperSwitch/Routing/RoutingUtils.res b/src/screens/HyperSwitch/Routing/RoutingUtils.res index 079bfea39..a79c99991 100644 --- a/src/screens/HyperSwitch/Routing/RoutingUtils.res +++ b/src/screens/HyperSwitch/Routing/RoutingUtils.res @@ -623,7 +623,7 @@ module SaveAndActivateButton = { onSubmitResponse->Js.Nullable.toOption->Belt.Option.getWithDefault(Js.Json.null) let currentActivatedId = currentActivatedFromJson->LogicUtils.getDictFromJsonObject->LogicUtils.getString("id", "") - let _response = await handleActivateConfiguration(Some(currentActivatedId)) + let _ = await handleActivateConfiguration(Some(currentActivatedId)) } catch { | Js.Exn.Error(e) => let _err = @@ -688,23 +688,41 @@ let validateNameAndDescription = (~dict, ~errors) => { }) } +let checkIfValuePresent = dict => { + let valueFromObject = dict->getDictfromDict("value") + + valueFromObject + ->getArrayFromDict("value", []) + ->Js.Array2.filter(ele => { + ele != ""->Js.Json.string + }) + ->Js.Array2.length > 0 || + valueFromObject->getString("value", "")->Js.String2.length > 0 || + valueFromObject->getFloat("value", -1.0) !== -1.0 || + (valueFromObject->getDictfromDict("value")->getString("key", "")->Js.String2.length > 0 && + valueFromObject->getDictfromDict("value")->getString("value", "")->Js.String2.length > 0) +} +let validateConditionJsonFor3ds = json => { + switch json->Js.Json.decodeObject { + | Some(dict) => + ["comparison", "lhs"]->Js.Array2.every(key => dict->Js.Dict.get(key)->Belt.Option.isSome) && + dict->checkIfValuePresent + | None => false + } +} + let validateConditions = dict => { dict ->LogicUtils.getArrayFromDict("conditions", []) ->Js.Array2.every(MakeRuleFieldComponent.validateConditionJson) } -let validateConditionsEvenIfOneExists = dict => { - let conditionsArray = dict->LogicUtils.getArrayFromDict("conditions", []) - let vector = Js.Vector.make(conditionsArray->Js.Array2.length, false) +let validateConditionsFor3ds = dict => { + let conditionsArray = dict->LogicUtils.getArrayFromDict("statements", []) - conditionsArray->Array.forEachWithIndex((value, index) => { - let res = value->MakeRuleFieldComponent.validateConditionJson - vector->Js.Vector.set(index, res) + conditionsArray->Array.every(value => { + value->validateConditionJsonFor3ds }) - - let _result = Js.Vector.filterInPlace((. val) => val == true, vector) - vector } let filterEmptyValues = (arr: array) => { diff --git a/src/screens/HyperSwitch/Routing/VolumeSplitRouting.res b/src/screens/HyperSwitch/Routing/VolumeSplitRouting.res index fb62618f0..388b8c1fd 100644 --- a/src/screens/HyperSwitch/Routing/VolumeSplitRouting.res +++ b/src/screens/HyperSwitch/Routing/VolumeSplitRouting.res @@ -142,7 +142,7 @@ module VolumeRoutingView = { try { setScreenState(_ => Loading) let activateRuleURL = getURL(~entityName=ROUTING, ~methodType=Post, ~id=activatingId, ()) - let _res = await updateDetails(activateRuleURL, Js.Dict.empty()->Js.Json.object_, Post) + let _ = await updateDetails(activateRuleURL, Js.Dict.empty()->Js.Json.object_, Post) showToast(~message="Successfully Activated !", ~toastType=ToastState.ToastSuccess, ()) RescriptReactRouter.replace(`/routing?`) setScreenState(_ => Success) @@ -172,7 +172,7 @@ module VolumeRoutingView = { setScreenState(_ => Loading) let deactivateRoutingURL = `${getURL(~entityName=ROUTING, ~methodType=Post, ())}/deactivate` let body = [("profile_id", profile->Js.Json.string)]->Js.Dict.fromArray->Js.Json.object_ - let _res = await updateDetails(deactivateRoutingURL, body, Post) + let _ = await updateDetails(deactivateRoutingURL, body, Post) showToast(~message="Successfully Deactivated !", ~toastType=ToastState.ToastSuccess, ()) RescriptReactRouter.replace(`/routing?`) setScreenState(_ => Success) @@ -337,8 +337,7 @@ module VolumeRoutingView = { @react.component let make = (~routingRuleId, ~isActive) => { let businessProfiles = Recoil.useRecoilValueFromAtom(HyperswitchAtom.businessProfilesAtom) - let defaultBusinessProfile = - businessProfiles->HSwitchMerchantAccountUtils.getValueFromBusinessProfile + let defaultBusinessProfile = businessProfiles->MerchantAccountUtils.getValueFromBusinessProfile let (profile, setProfile) = React.useState(_ => defaultBusinessProfile.profile_id) let (formState, setFormState) = React.useState(_ => AdvancedRoutingTypes.EditReplica) let (initialRule, setInitialRule) = React.useState(() => None) diff --git a/src/screens/HyperSwitch/RoutingRevamp/AdvancedRouting.res b/src/screens/HyperSwitch/RoutingRevamp/AdvancedRouting.res index cccabcc27..3ce8c81c7 100644 --- a/src/screens/HyperSwitch/RoutingRevamp/AdvancedRouting.res +++ b/src/screens/HyperSwitch/RoutingRevamp/AdvancedRouting.res @@ -45,21 +45,6 @@ module Add3DSCondition = { @react.component let make = (~isFirst, ~id) => { let classStyle = "flex justify-center relative py-2 h-fit min-w-min hover:bg-jp-2-light-gray-100 focus:outline-none rounded-md items-center border-2 border-border_gray border-opacity-50 text-jp-2-light-gray-1200 px-4 transition duration-[250ms] ease-out-[cubic-bezier(0.33, 1, 0.68, 1)] overflow-hidden" - let (dropdownval, setDropdownval) = React.useState(_ => "three_ds") - let field = ReactFinalForm.useField(`${id}.routingOutput.override_3ds`).input - - let input: ReactFinalForm.fieldRenderPropsInput = { - name: `${id}.routingOutput.override_3ds`, - onBlur: _ev => (), - onChange: ev => { - let value = ev->AdvancedRoutingUIUtils.formEventToStr - field.onChange(value->toForm) - setDropdownval(_ => value) - }, - onFocus: _ev => (), - value: dropdownval->Js.Json.string, - checked: true, - } let options: array = [ {value: "three_ds", label: "3DS"}, @@ -74,13 +59,19 @@ module Add3DSCondition = {
{"Auth type"->React.string}
{"= is Equal to"->React.string}
-
@@ -100,7 +91,7 @@ module Wrapper = { ~notFirstRule=true, ~isDragging=false, ~wasm, - ~isfrom3ds=false, + ~isFrom3ds=false, ) => { let showToast = ToastState.useShowToast() let isMobileView = MatchMedia.useMobileChecker() @@ -230,12 +221,12 @@ module Wrapper = { ${border} border-blue-700`}> - + - + - +
@@ -347,8 +338,7 @@ let make = (~routingRuleId, ~isActive, ~setCurrentRouting) => { let url = RescriptReactRouter.useUrl() let hyperswitchMixPanel = HSMixPanel.useSendEvent() let businessProfiles = Recoil.useRecoilValueFromAtom(HyperswitchAtom.businessProfilesAtom) - let defaultBusinessProfile = - businessProfiles->HSwitchMerchantAccountUtils.getValueFromBusinessProfile + let defaultBusinessProfile = businessProfiles->MerchantAccountUtils.getValueFromBusinessProfile let (profile, setProfile) = React.useState(_ => defaultBusinessProfile.profile_id) let (initialValues, setInitialValues) = React.useState(_ => initialValues->toJson) let (initialRule, setInitialRule) = React.useState(() => None) @@ -508,7 +498,7 @@ let make = (~routingRuleId, ~isActive, ~setCurrentRouting) => { try { setScreenState(_ => Loading) let activateRuleURL = getURL(~entityName=ROUTING, ~methodType=Post, ~id=activatingId, ()) - let _res = await updateDetails(activateRuleURL, Js.Dict.empty()->Js.Json.object_, Post) + let _ = await updateDetails(activateRuleURL, Js.Dict.empty()->Js.Json.object_, Post) showToast(~message="Successfully Activated !", ~toastType=ToastState.ToastSuccess, ()) RescriptReactRouter.replace(`/routing?`) setScreenState(_ => Success) @@ -537,7 +527,7 @@ let make = (~routingRuleId, ~isActive, ~setCurrentRouting) => { setScreenState(_ => Loading) let deactivateRoutingURL = `${getURL(~entityName=ROUTING, ~methodType=Post, ())}/deactivate` let body = [("profile_id", profile->Js.Json.string)]->Js.Dict.fromArray->Js.Json.object_ - let _res = await updateDetails(deactivateRoutingURL, body, Post) + let _ = await updateDetails(deactivateRoutingURL, body, Post) showToast(~message="Successfully Deactivated !", ~toastType=ToastState.ToastSuccess, ()) RescriptReactRouter.replace(`/routing?`) setScreenState(_ => Success) @@ -572,65 +562,7 @@ let make = (~routingRuleId, ~isActive, ~setCurrentRouting) => { let rulesDict = dataDict->getArrayFromDict("rules", []) - let modifiedRules = rulesDict->Js.Array2.map(ruleJson => { - let ruleDict = ruleJson->getDictFromJsonObject - let statements = ruleDict->getArrayFromDict("statements", []) - - let modifiedStatements = statements->Array.reduce( - [ - { - condition: [], - }, - ], - (acc, statement) => { - let statementDict = statement->getDictFromJsonObject - let logicalOperator = statementDict->getString("logical", "")->Js.String2.toLowerCase - - let lastItem = - acc - ->Belt.Array.get(acc->Js.Array2.length - 1) - ->Belt.Option.getWithDefault({condition: []}) - - let condition = { - lhs: statementDict->getString("lhs", ""), - comparison: switch statementDict->getString("comparison", "")->operatorMapper { - | IS - | EQUAL_TO - | CONTAINS => "equal" - | IS_NOT - | NOT_CONTAINS - | NOT_EQUAL_TO => "not_equal" - | GREATER_THAN => "greater_than" - | LESS_THAN => "less_than" - | UnknownOperator(str) => str - }, - value: statementDict->getDictfromDict("value")->getStatementValue, - metadata: statementDict->getJsonObjectFromDict("metadata"), - } - - let newAcc = if logicalOperator === "or" { - acc->Js.Array2.concat([ - { - condition: [condition], - }, - ]) - } else { - lastItem.condition->Array.push(condition) - let filteredArr = - acc->Array.filterWithIndex((_, i) => i !== acc->Js.Array2.length - 1) - filteredArr->Array.push(lastItem) - filteredArr - } - - newAcc - }, - ) - { - "name": ruleDict->getString("name", ""), - "connectorSelection": ruleDict->getJsonObjectFromDict("connectorSelection"), - "statements": modifiedStatements->Js.Array2.map(toJson)->Js.Json.array, - } - }) + let modifiedRules = rulesDict->generateRule let defaultSelection = dataDict diff --git a/src/screens/HyperSwitch/RoutingRevamp/AdvancedRoutingUIUtils.res b/src/screens/HyperSwitch/RoutingRevamp/AdvancedRoutingUIUtils.res index 48c1b2341..28e1d3092 100644 --- a/src/screens/HyperSwitch/RoutingRevamp/AdvancedRoutingUIUtils.res +++ b/src/screens/HyperSwitch/RoutingRevamp/AdvancedRoutingUIUtils.res @@ -318,9 +318,8 @@ module FieldInp = { module RuleFieldBase = { @react.component - let make = (~isFirst, ~id, ~isExpanded, ~onClick, ~wasm) => { + let make = (~isFirst, ~id, ~isExpanded, ~onClick, ~wasm, ~isFrom3ds) => { let (hover, setHover) = React.useState(_ => false) - let (paymentMethod, setpaymentMethod) = React.useState(_ => []) let (keyType, setKeyType) = React.useState(_ => "") let (variantValues, setVariantValues) = React.useState(_ => []) let field = ReactFinalForm.useField(`${id}.lhs`).input @@ -339,20 +338,19 @@ module RuleFieldBase = { setKeyTypeAndVariants(wasm, value) } - React.useEffect0(() => { - let methodKeys = switch wasm { - | Some(res) => res.getAllKeys() - | None => [] - } + let methodKeys = React.useMemo0(() => { let value = field.value->LogicUtils.getStringFromJson("") if value->Js.String2.length > 0 { setKeyTypeAndVariants(wasm, value) } - setpaymentMethod(_ => methodKeys) - None + if isFrom3ds { + Window.getThreeDsKeys() + } else { + Window.getAllKeys() + } }) - Js.Array2.length > 0}> + Js.Array2.length > 0}> {if isExpanded {
- +
@@ -394,7 +392,7 @@ module RuleFieldBase = { module MakeRuleField = { @react.component - let make = (~id, ~isExpanded, ~wasm) => { + let make = (~id, ~isExpanded, ~wasm, ~isFrom3ds) => { let ruleJsonPath = `${id}.statements` let conditionsInput = ReactFinalForm.useField(ruleJsonPath).input let fields = conditionsInput.value->Js.Json.decodeArray->Belt.Option.getWithDefault([]) @@ -419,6 +417,7 @@ module MakeRuleField = { id={`${ruleJsonPath}[${i->Belt.Int.toString}]`} isExpanded wasm + isFrom3ds /> )->React.array} {if isExpanded { diff --git a/src/screens/HyperSwitch/RoutingRevamp/AdvancedRoutingUtils.res b/src/screens/HyperSwitch/RoutingRevamp/AdvancedRoutingUtils.res index 92451c08c..0c342c5a1 100644 --- a/src/screens/HyperSwitch/RoutingRevamp/AdvancedRoutingUtils.res +++ b/src/screens/HyperSwitch/RoutingRevamp/AdvancedRoutingUtils.res @@ -1,11 +1,10 @@ -open LogicUtils -open AdvancedRoutingTypes +external toJson: 'a => Js.Json.t = "%identity" let getCurrentDetailedUTCTime = () => { Js.Date.fromFloat(Js.Date.now())->Js.Date.toUTCString } -let defaultThreeDsObjectValue = { +let defaultThreeDsObjectValue: AdvancedRoutingTypes.connectorSelection = { override_3ds: "three_ds", } @@ -45,6 +44,7 @@ let getRoutingTypeName = (routingType: AdvancedRoutingTypes.routing) => { } let getRoutingNameString = (~routingType) => { + open LogicUtils let routingText = routingType->getRoutingTypeName `${routingText->capitalizeString} Based Routing-${getCurrentShortUTCTime()}` } @@ -97,32 +97,38 @@ let variantTypeMapper: string => AdvancedRoutingTypes.variantType = variantType } } -let getStatementValue = valueDict => { +let getStatementValue: Js.Dict.t => AdvancedRoutingTypes.value = valueDict => { + open LogicUtils { \"type": valueDict->getString("type", ""), value: valueDict->getJsonObjectFromDict("value"), } } -let statementTypeMapper = dict => { - lhs: dict->getString("lhs", ""), - comparison: dict->getString("comparison", ""), - value: getStatementValue(dict->getDictfromDict("value")), - logical: dict->getString("logical", ""), +let statementTypeMapper: Js.Dict.t => AdvancedRoutingTypes.statement = dict => { + open LogicUtils + { + lhs: dict->getString("lhs", ""), + comparison: dict->getString("comparison", ""), + value: getStatementValue(dict->getDictfromDict("value")), + logical: dict->getString("logical", ""), + } } let conditionTypeMapper = (statementArr: array) => { + open LogicUtils let statements = statementArr->Array.reduce([], (acc, statementJson) => { let conditionArray = statementJson->getDictFromJsonObject->getArrayFromDict("condition", []) let arr = conditionArray->Js.Array2.mapi((conditionJson, index) => { let statementDict = conditionJson->getDictFromJsonObject - { + let returnValue: AdvancedRoutingTypes.statement = { lhs: statementDict->getString("lhs", ""), comparison: statementDict->getString("comparison", ""), logical: index === 0 ? "OR" : "AND", value: getStatementValue(statementDict->getDictfromDict("value")), } + returnValue }) acc->Js.Array2.concat(arr) }) @@ -131,6 +137,7 @@ let conditionTypeMapper = (statementArr: array) => { } let routingTypeMapper = (str: string) => { + open AdvancedRoutingTypes switch str->Js.String2.toLowerCase { | "priority" => PRIORITY | "volume_split" => VOLUME_SPLIT @@ -138,7 +145,10 @@ let routingTypeMapper = (str: string) => { } } -let volumeSplitConnectorSelectionDataMapper = dict => { +let volumeSplitConnectorSelectionDataMapper: Js.Dict.t< + Js.Json.t, +> => AdvancedRoutingTypes.volumeSplitConnectorSelectionData = dict => { + open LogicUtils { split: dict->getInt("split", 0), connector: { @@ -150,14 +160,18 @@ let volumeSplitConnectorSelectionDataMapper = dict => { } } -let priorityConnectorSelectionDataMapper = dict => { +let priorityConnectorSelectionDataMapper: Js.Dict.t< + Js.Json.t, +> => AdvancedRoutingTypes.connector = dict => { + open LogicUtils { connector: dict->getString("connector", ""), merchant_connector_id: dict->getString("merchant_connector_id", ""), } } -let connectorSelectionDataMapperFromJson: Js.Json.t => connectorSelectionData = json => { +let connectorSelectionDataMapperFromJson: Js.Json.t => AdvancedRoutingTypes.connectorSelectionData = json => { + open LogicUtils let split = json->getDictFromJsonObject->getOptionInt("split") let dict = json->getDictFromJsonObject switch split { @@ -169,15 +183,25 @@ let connectorSelectionDataMapperFromJson: Js.Json.t => connectorSelectionData = let getDefaultSelection: Js.Dict.t< Js.Json.t, > => AdvancedRoutingTypes.connectorSelection = defaultSelection => { - { - \"type": defaultSelection->getString("type", ""), - data: defaultSelection - ->getArrayFromDict("data", []) - ->Js.Array2.map(ele => ele->connectorSelectionDataMapperFromJson), + open LogicUtils + let override3dsValue = defaultSelection->getString("override_3ds", "") + + if override3dsValue->Js.String2.length > 0 { + { + override_3ds: override3dsValue, + } + } else { + { + \"type": defaultSelection->getString("type", ""), + data: defaultSelection + ->getArrayFromDict("data", []) + ->Js.Array2.map(ele => ele->connectorSelectionDataMapperFromJson), + } } } let getConnectorStringFromConnectorSelectionData = connectorSelectionData => { + open AdvancedRoutingTypes switch connectorSelectionData { | VolumeObject(obj) => { merchant_connector_id: obj.connector.merchant_connector_id, @@ -191,13 +215,15 @@ let getConnectorStringFromConnectorSelectionData = connectorSelectionData => { } let getSplitFromConnectorSelectionData = connectorSelectionData => { + open AdvancedRoutingTypes switch connectorSelectionData { | VolumeObject(obj) => obj.split | _ => 0 } } -let ruleInfoTypeMapper = json => { +let ruleInfoTypeMapper: Js.Dict.t => AdvancedRoutingTypes.algorithmData = json => { + open LogicUtils let rulesArray = json->getArrayFromDict("rules", []) let defaultSelection = json->getDictfromDict("defaultSelection") @@ -251,6 +277,7 @@ let getGatewaysArrayFromValueData = data => { } let getModalObj = (routingType, text) => { + open AdvancedRoutingTypes switch routingType { | ADVANCED => { conType: "Activate current configured configuration?", @@ -301,14 +328,16 @@ let isStatementMandatoryFieldsPresent = (statement: AdvancedRoutingTypes.stateme statementValue) } -let algorithmTypeMapper = values => { +let algorithmTypeMapper: Js.Dict.t => AdvancedRoutingTypes.algorithm = values => { + open LogicUtils { data: values->getDictfromDict("data")->ruleInfoTypeMapper, \"type": values->getString("type", ""), } } -let getRoutingTypesFromJson = (values: Js.Json.t) => { +let getRoutingTypesFromJson: Js.Json.t => AdvancedRoutingTypes.advancedRouting = values => { + open LogicUtils let valuesDict = values->getDictFromJsonObject { @@ -321,3 +350,68 @@ let getRoutingTypesFromJson = (values: Js.Json.t) => { let validateStatements = statementsArray => { statementsArray->Js.Array2.every(isStatementMandatoryFieldsPresent) } + +let generateStatements = statements => { + open LogicUtils + + let initialValueForStatement: AdvancedRoutingTypes.statementSendType = { + condition: [], + } + + statements->Array.reduce([initialValueForStatement], (acc, statement) => { + let statementDict = statement->getDictFromJsonObject + let logicalOperator = statementDict->getString("logical", "")->Js.String2.toLowerCase + + let lastItem = + acc->Belt.Array.get(acc->Js.Array2.length - 1)->Belt.Option.getWithDefault({condition: []}) + + let condition: AdvancedRoutingTypes.statement = { + lhs: statementDict->getString("lhs", ""), + comparison: switch statementDict->getString("comparison", "")->operatorMapper { + | IS + | EQUAL_TO + | CONTAINS => "equal" + | IS_NOT + | NOT_CONTAINS + | NOT_EQUAL_TO => "not_equal" + | GREATER_THAN => "greater_than" + | LESS_THAN => "less_than" + | UnknownOperator(str) => str + }, + value: statementDict->getDictfromDict("value")->getStatementValue, + metadata: statementDict->getJsonObjectFromDict("metadata"), + } + + let newAcc = if logicalOperator === "or" { + acc->Js.Array2.concat([ + { + condition: [condition], + }, + ]) + } else { + lastItem.condition->Array.push(condition) + let filteredArr = acc->Array.filterWithIndex((_, i) => i !== acc->Js.Array2.length - 1) + filteredArr->Array.push(lastItem) + filteredArr + } + + newAcc + }) +} + +let generateRule = rulesDict => { + let modifiedRules = rulesDict->Js.Array2.map(ruleJson => { + open LogicUtils + let ruleDict = ruleJson->getDictFromJsonObject + let statements = ruleDict->getArrayFromDict("statements", []) + + let modifiedStatements = statements->generateStatements + + { + "name": ruleDict->getString("name", ""), + "connectorSelection": ruleDict->getJsonObjectFromDict("connectorSelection"), + "statements": modifiedStatements->Js.Array2.map(toJson)->Js.Json.array, + } + }) + modifiedRules +} diff --git a/src/screens/HyperSwitch/RoutingRevamp/BasicDetailsForm.res b/src/screens/HyperSwitch/RoutingRevamp/BasicDetailsForm.res index a9f167333..647bc5b71 100644 --- a/src/screens/HyperSwitch/RoutingRevamp/BasicDetailsForm.res +++ b/src/screens/HyperSwitch/RoutingRevamp/BasicDetailsForm.res @@ -72,7 +72,7 @@ let make = ( ~profile=?, ~setProfile=?, ) => { - open HSwitchMerchantAccountUtils + open MerchantAccountUtils let hyperswitchMixPanel = HSMixPanel.useSendEvent() let ip1 = ReactFinalForm.useField(`name`).input let ip2 = ReactFinalForm.useField(`description`).input @@ -146,11 +146,11 @@ let make = (
- {React.string("Profile Name")} + {React.string("Profile")} - Belt.Option.getWithDefault( defaultBusinessProfile.profile_id, )} @@ -167,20 +167,12 @@ let make = (
-
- Belt.Option.getWithDefault(_ => ())} - profile={profile->Belt.Option.getWithDefault(defaultBusinessProfile.profile_id)} - options={arrayOfBusinessProfile->businessProfileNameDropDownOption} - label="Profile Name" - /> - Belt.Option.getWithDefault(_ => ())} - profile={profile->Belt.Option.getWithDefault(defaultBusinessProfile.profile_id)} - options={arrayOfBusinessProfile->businessProfileIdDropDownOption} - label="Profile Id" - /> -
+ Belt.Option.getWithDefault(_ => ())} + profile={profile->Belt.Option.getWithDefault(defaultBusinessProfile.profile_id)} + options={arrayOfBusinessProfile->businessProfileNameDropDownOption} + label="Profile" + />
diff --git a/src/screens/HyperSwitch/RoutingRevamp/Previewers/RulePreviewer.res b/src/screens/HyperSwitch/RoutingRevamp/Previewers/RulePreviewer.res index a85510891..7686ad9b7 100644 --- a/src/screens/HyperSwitch/RoutingRevamp/Previewers/RulePreviewer.res +++ b/src/screens/HyperSwitch/RoutingRevamp/Previewers/RulePreviewer.res @@ -28,7 +28,7 @@ module GatewayView = { } @react.component -let make = (~ruleInfo: algorithmData, ~isfrom3ds=false) => { +let make = (~ruleInfo: algorithmData, ~isFrom3ds=false) => { open LogicUtils
{ let value = switch statement.value.value->Js.Json.classify { | JSONArray(arr) => arr->Js.Array2.joinWith(", ") | JSONString(str) => str + | JSONNumber(num) => num->Belt.Float.toString | _ => "" } @@ -97,13 +98,13 @@ let make = (~ruleInfo: algorithmData, ~isfrom3ds=false) => { Js.Array2.length > 0}> - +
{threeDsType->LogicUtils.capitalizeString->React.string}
- + Belt.Option.getWithDefault([])} /> diff --git a/src/screens/HyperSwitch/SDKPayment/SDKPage.res b/src/screens/HyperSwitch/SDKPayment/SDKPage.res index 101429608..2e37537e2 100644 --- a/src/screens/HyperSwitch/SDKPayment/SDKPage.res +++ b/src/screens/HyperSwitch/SDKPayment/SDKPage.res @@ -1,8 +1,10 @@ let h3Leading2Style = HSwitchUtils.getTextClass(~textVariant=H3, ~h3TextVariant=Leading_2, ()) external toJson: 'a => Js.Json.t = "%identity" +external formEventToStr: ReactEvent.Form.t => string = "%identity" +external strToFormEvent: Js.String.t => ReactEvent.Form.t = "%identity" module SDKConfiguarationFields = { - open HSwitchMerchantAccountUtils + open MerchantAccountUtils @react.component let make = (~initialValues: SDKPaymentTypes.paymentType) => { let businessProfiles = Recoil.useRecoilValueFromAtom(HyperswitchAtom.businessProfilesAtom) @@ -17,7 +19,7 @@ module SDKConfiguarationFields = { }) let selectProfileField = FormRenderer.makeFieldInfo( - ~label="Business profile", + ~label="Profile", ~name="profile_id", ~placeholder="", ~customInput=InputFields.selectInput( @@ -30,20 +32,6 @@ module SDKConfiguarationFields = { ), (), ) - let selectProfileId = FormRenderer.makeFieldInfo( - ~label="Profile Id", - ~name="profile_id", - ~placeholder="", - ~customInput=InputFields.selectInput( - ~deselectDisable=true, - ~options=arrayOfBusinessProfile->businessProfileIdDropDownOption, - ~buttonText="Select Profile Id", - ~disableSelect=disableSelectionForProfile, - ~fullLength=true, - (), - ), - (), - ) let selectCurrencyField = FormRenderer.makeFieldInfo( ~label="Currency", ~name="currency", @@ -60,26 +48,43 @@ module SDKConfiguarationFields = { let enterAmountField = FormRenderer.makeFieldInfo( ~label="Enter amount", ~name="amount", - ~placeholder="Enter amount", - ~customInput=InputFields.numericTextInput(~isDisabled=false, ~customStyle="w-full", ()), + ~customInput=(~input, ~placeholder as _) => + InputFields.numericTextInput( + ~input={ + ...input, + value: (initialValues.amount / 100)->string_of_int->Js.Json.string, + onChange: { + ev => { + let eventValueToInt = ev->formEventToStr->LogicUtils.getIntFromString(0) + let valInCents = (eventValueToInt * 100)->string_of_int->strToFormEvent + input.onChange(valInCents) + } + }, + }, + ~isDisabled=false, + ~customStyle="w-full", + ~placeholder="Enter amount", + (), + ), (), ) - <> +
- Js.String2.length > 0)} + text="Show preview" + disabledParamter={!(initialValues.profile_id->Js.String2.length > 0)} + customSumbitButtonStyle="!mt-5" /> - +
} } @react.component let make = () => { - open HSwitchMerchantAccountUtils + open MerchantAccountUtils let hyperswitchMixPanel = HSMixPanel.useSendEvent() let url = RescriptReactRouter.useUrl() let filtersFromUrl = url.search->LogicUtils.getDictFromUrlSearchParams @@ -103,18 +108,11 @@ let make = () => { None }, [defaultBusinessProfile.profile_id->Js.String2.length]) - let onProceed = async (~paymentId as _) => { - let paymentId = - filtersFromUrl - ->Js.Dict.get("payment_intent_client_secret") - ->Belt.Option.getWithDefault("") - ->Js.String2.split("_") - - let id = `${paymentId->Belt.Array.get(0)->Belt.Option.getWithDefault("")}_${paymentId - ->Belt.Array.get(1) - ->Belt.Option.getWithDefault("")}` - - RescriptReactRouter.replace(`/payments/${id}`) + let onProceed = async (~paymentId) => { + switch paymentId { + | Some(val) => RescriptReactRouter.replace(`/payments/${val}`) + | None => () + } } let onSubmit = (values, _) => { diff --git a/src/screens/HyperSwitch/SDKPayment/SDKPaymentTypes.res b/src/screens/HyperSwitch/SDKPayment/SDKPaymentTypes.res index 42146dfe9..52dc3f62a 100644 --- a/src/screens/HyperSwitch/SDKPayment/SDKPaymentTypes.res +++ b/src/screens/HyperSwitch/SDKPayment/SDKPaymentTypes.res @@ -1,7 +1,51 @@ +type address = { + line1: string, + line2: string, + line3: string, + city: string, + state: string, + zip: string, + country: string, + first_name: string, + last_name: string, +} + +type phone = { + number: string, + country_code: string, +} + +type shipping = { + address: address, + phone: phone, +} + +type billing = { + address: address, + phone: phone, +} +type orderDetails = { + product_name: string, + quantity: int, + amount: int, +} +type metadata = {order_details: orderDetails} + type paymentType = { amount: int, - currency: string, + mutable currency: string, profile_id: string, customer_id: string, description: string, + capture_method: string, + amount_to_capture: int, + email: string, + name: string, + phone: string, + phone_country_code: string, + authentication_type: string, + shipping: shipping, + billing: billing, + metadata: metadata, + return_url: string, } diff --git a/src/screens/HyperSwitch/SDKPayment/SDKPaymentUtils.res b/src/screens/HyperSwitch/SDKPayment/SDKPaymentUtils.res index 1680b7392..257fba928 100644 --- a/src/screens/HyperSwitch/SDKPayment/SDKPaymentUtils.res +++ b/src/screens/HyperSwitch/SDKPayment/SDKPaymentUtils.res @@ -1,33 +1,138 @@ let initialValueForForm: HSwitchSettingTypes.profileEntity => SDKPaymentTypes.paymentType = defaultBusinessProfile => { { - amount: 100, + amount: 10000, currency: "United States-USD", profile_id: defaultBusinessProfile.profile_id, description: "Default value", customer_id: "hyperswitch_sdk_demo_id", + email: "guest@example.com", + name: "John Doe", + phone: "999999999", + phone_country_code: "+65", + authentication_type: "no_three_ds", + shipping: { + address: { + line1: "1467", + line2: "Harrison Street", + line3: "Harrison Street", + city: "San Fransico", + state: "California", + zip: "94122", + country: "US", + first_name: "John", + last_name: "Doe", + }, + phone: { + number: "1234567890", + country_code: "+1", + }, + }, + billing: { + address: { + line1: "1467", + line2: "Harrison Street", + line3: "Harrison Street", + city: "San Fransico", + state: "California", + zip: "94122", + country: "US", + first_name: "John", + last_name: "Doe", + }, + phone: { + number: "1234567890", + country_code: "+1", + }, + }, + metadata: { + order_details: { + product_name: "Apple iphone 15", + quantity: 1, + amount: 100, + }, + }, + capture_method: "automatic", + amount_to_capture: 100, + return_url: `${Window.Location.origin}${Window.Location.pathName}`, } } +let getCurrencyValue = (countryCurrency: string) => { + countryCurrency + ->Js.String2.split("-") + ->Belt.Array.get(1) + ->Belt.Option.getWithDefault("USD") + ->Js.String2.trim +} + let getTypedValueForPayment: Js.Json.t => SDKPaymentTypes.paymentType = values => { open LogicUtils let dictOfValues = values->getDictFromJsonObject + let shippingAddress = + values->getDictFromJsonObject->getDictfromDict("shipping")->getDictfromDict("address") + let shippingPhone = + values->getDictFromJsonObject->getDictfromDict("shipping")->getDictfromDict("phone") + let billingAddress = + values->getDictFromJsonObject->getDictfromDict("billing")->getDictfromDict("address") + let billingPhone = + values->getDictFromJsonObject->getDictfromDict("shipping")->getDictfromDict("phone") + let metaData = + values->getDictFromJsonObject->getDictfromDict("metadata")->getDictfromDict("order_details") + { amount: dictOfValues->getInt("amount", 100), currency: dictOfValues->getString("currency", "United States-USD"), profile_id: dictOfValues->getString("profile_id", ""), customer_id: dictOfValues->getString("customer_id", ""), description: dictOfValues->getString("description", "Default value"), + email: dictOfValues->getString("email", ""), + name: dictOfValues->getString("name", ""), + phone: dictOfValues->getString("phone", ""), + phone_country_code: dictOfValues->getString("phone_country_code", ""), + authentication_type: dictOfValues->getString("authentication_type", ""), + shipping: { + address: { + line1: shippingAddress->getString("line1", ""), + line2: shippingAddress->getString("line2", ""), + line3: shippingAddress->getString("line3", ""), + city: shippingAddress->getString("city", ""), + state: shippingAddress->getString("state", ""), + zip: shippingAddress->getString("zip", ""), + country: shippingAddress->getString("country", ""), + first_name: shippingAddress->getString("first_name", ""), + last_name: shippingAddress->getString("last_name", ""), + }, + phone: { + number: shippingPhone->getString("number", ""), + country_code: shippingPhone->getString("country_code", ""), + }, + }, + billing: { + address: { + line1: billingAddress->getString("line1", ""), + line2: billingAddress->getString("line2", ""), + line3: billingAddress->getString("line3", ""), + city: billingAddress->getString("city", ""), + state: billingAddress->getString("state", ""), + zip: billingAddress->getString("zip", ""), + country: billingAddress->getString("country", ""), + first_name: billingAddress->getString("first_name", ""), + last_name: billingAddress->getString("last_name", ""), + }, + phone: { + number: billingPhone->getString("number", ""), + country_code: billingPhone->getString("country_code", ""), + }, + }, + metadata: { + order_details: { + product_name: metaData->getString("product_name", ""), + quantity: 1, + amount: dictOfValues->getInt("amount", 100), + }, + }, + capture_method: "automatic", + amount_to_capture: dictOfValues->getInt("amount", 100), + return_url: dictOfValues->getString("return_url", ""), } } - -let convertAmountToCents = (amount: int) => { - amount * 100 -} - -let getCurrencyValue = (countryCurrency: string) => { - countryCurrency - ->Js.String2.split("-") - ->Belt.Array.get(1) - ->Belt.Option.getWithDefault("USD") - ->Js.String2.trim -} diff --git a/src/screens/HyperSwitch/SDKPayment/TestPayment.res b/src/screens/HyperSwitch/SDKPayment/TestPayment.res index 0c5b7fd42..a085f26ea 100644 --- a/src/screens/HyperSwitch/SDKPayment/TestPayment.res +++ b/src/screens/HyperSwitch/SDKPayment/TestPayment.res @@ -1,13 +1,9 @@ external toJson: 'a => Js.Json.t = "%identity" -let headerTextStyle = "text-xl font-semibold text-grey-700" -let subTextStyle = "text-base font-normal text-grey-700 opacity-50" -let dividerColor = "bg-grey-700 bg-opacity-20 h-px w-full" -let highlightedText = "text-base font-normal text-blue-700 underline" @react.component let make = ( ~returnUrl, - ~onProceed: (~paymentId: string) => promise, + ~onProceed: (~paymentId: option) => promise, ~sdkWidth="w-[60%]", ~isTestCredsNeeded=true, ~customWidth="w-full md:w-1/2", @@ -23,7 +19,7 @@ let make = ( let updateDetails = useUpdateMethod(~showErrorToast=false, ()) let (clientSecret, setClientSecret) = React.useState(_ => None) let (paymentStatus, setPaymentStatus) = React.useState(_ => INCOMPLETE) - let (paymentId, setPaymentId) = React.useState(_ => "") + let (paymentId, setPaymentId) = React.useState(_ => None) let merchantDetailsValue = HSwitchUtils.useMerchantDetailsValue() let publishableKey = merchantDetailsValue->getDictFromJsonObject->getString("publishable_key", "") let paymentElementOptions = CheckoutHelper.getOptionReturnUrl(returnUrl) @@ -32,26 +28,31 @@ let make = ( let searchParams = url.search let filtersFromUrl = getDictFromUrlSearchParams(searchParams) + let getClientSecretFromPaymentId = (~paymentIntentClientSecret) => { + switch paymentIntentClientSecret { + | Some(paymentIdFromClientSecret) => + let paymentClientSecretSplitArray = paymentIdFromClientSecret->Js.String2.split("_") + Some( + `${paymentClientSecretSplitArray->LogicUtils.getValueFromArray( + 0, + "", + )}_${paymentClientSecretSplitArray->LogicUtils.getValueFromArray(1, "")}`, + ) + + | None => None + } + } + let getClientSecret = async () => { + open SDKPaymentUtils try { let url = `${HSwitchGlobalVars.hyperSwitchApiPrefix}/payments` - let body = - Js.Dict.fromArray([ - ("currency", initialValues.currency->SDKPaymentUtils.getCurrencyValue->Js.Json.string), - ( - "amount", - initialValues.amount - ->SDKPaymentUtils.convertAmountToCents - ->Belt.Int.toFloat - ->Js.Json.number, - ), - ("profile_id", initialValues.profile_id->Js.Json.string), - ("customer_id", "hyperswitch_sdk_demo_id"->Js.Json.string), - ("description", initialValues.description->Js.Json.string), - ])->Js.Json.object_ + let paymentData = initialValues->toJson->Js.Json.stringify->safeParse->getTypedValueForPayment + paymentData.currency = paymentData.currency->getCurrencyValue + let body = paymentData->toJson let response = await updateDetails(url, body, Post) let clientSecret = response->getDictFromJsonObject->getOptionString("client_secret") - setPaymentId(_ => response->getDictFromJsonObject->getString("payment_id", "")) + setPaymentId(_ => response->getDictFromJsonObject->getOptionString("payment_id")) setClientSecret(_ => clientSecret) setPaymentStatus(_ => INCOMPLETE) } catch { @@ -62,10 +63,17 @@ let make = ( React.useEffect1(() => { let status = filtersFromUrl->Js.Dict.get("status")->Belt.Option.getWithDefault("")->Js.String2.toLowerCase + let paymentIdFromPaymemtIntentClientSecret = getClientSecretFromPaymentId( + ~paymentIntentClientSecret=url.search + ->LogicUtils.getDictFromUrlSearchParams + ->Js.Dict.get("payment_intent_client_secret"), + ) if status === "succeeded" { setPaymentStatus(_ => SUCCESS) + setPaymentId(_ => paymentIdFromPaymemtIntentClientSecret) } else if status === "failed" { setPaymentStatus(_ => FAILED("")) + setPaymentId(_ => paymentIdFromPaymemtIntentClientSecret) } else if status === "processing" { setPaymentStatus(_ => PROCESSING) } else { @@ -87,6 +95,7 @@ let make = ( buttonOnClick={_ => onProceed(~paymentId)->ignore} customWidth bgColor="bg-green-success_page_bg" + isButtonVisible={paymentId->Belt.Option.isSome} /> | FAILED(_err) => @@ -97,6 +106,7 @@ let make = ( buttonOnClick={_ => onProceed(~paymentId)->ignore} customWidth bgColor="bg-red-failed_page_bg" + isButtonVisible={paymentId->Belt.Option.isSome} /> | CHECKCONFIGURATION => SDKPaymentUtils.convertAmountToCents} + amount={initialValues.amount} setClientSecret />
@@ -151,7 +161,7 @@ let make = ( elementOptions paymentElementOptions returnUrl - amount={initialValues.amount->SDKPaymentUtils.convertAmountToCents} + amount={initialValues.amount} setClientSecret /> } diff --git a/src/screens/HyperSwitch/SelfServe/HSwitchProdOnboarding/CheckoutHelper.res b/src/screens/HyperSwitch/SelfServe/HSwitchProdOnboarding/CheckoutHelper.res index 805cbb784..12949501d 100644 --- a/src/screens/HyperSwitch/SelfServe/HSwitchProdOnboarding/CheckoutHelper.res +++ b/src/screens/HyperSwitch/SelfServe/HSwitchProdOnboarding/CheckoutHelper.res @@ -112,6 +112,7 @@ fields: { radios: true, spacedAccordionItems: false, }, + showCardFormByDefault: false, wallets: { walletReturnUrl: returnUrl, applePay: "auto", diff --git a/src/screens/HyperSwitch/SelfServe/HSwitchProdOnboarding/HSwitchAgreementScreen.res b/src/screens/HyperSwitch/SelfServe/HSwitchProdOnboarding/HSwitchAgreementScreen.res index 2d5561985..4ba8eb111 100644 --- a/src/screens/HyperSwitch/SelfServe/HSwitchProdOnboarding/HSwitchAgreementScreen.res +++ b/src/screens/HyperSwitch/SelfServe/HSwitchProdOnboarding/HSwitchAgreementScreen.res @@ -17,7 +17,7 @@ let make = () => { try { let agreementUrl = getURL(~entityName=USERS, ~userType=#MERCHANT_DATA, ~methodType=Post, ()) let body = ProdOnboardingUtils.getProdApiBody(~parentVariant=#ProductionAgreement, ()) - let _response = await updateDetails(agreementUrl, body, Post) + let _ = await updateDetails(agreementUrl, body, Post) setDashboardPageState(_ => #PROD_ONBOARDING) } catch { | _ => diff --git a/src/screens/HyperSwitch/SelfServe/HSwitchProdOnboarding/LiveEndpointsSetup.res b/src/screens/HyperSwitch/SelfServe/HSwitchProdOnboarding/LiveEndpointsSetup.res index 5103bbb28..910eb2dae 100644 --- a/src/screens/HyperSwitch/SelfServe/HSwitchProdOnboarding/LiveEndpointsSetup.res +++ b/src/screens/HyperSwitch/SelfServe/HSwitchProdOnboarding/LiveEndpointsSetup.res @@ -170,7 +170,7 @@ let make = (~pageView, ~setPageView, ~previewState: option pageView->ProdOnboardingUtils.getPageView) showToast(~message=`Details updated`, ~toastType=ToastState.ToastSuccess, ()) setButtonState(_ => Normal) @@ -184,7 +184,7 @@ let make = (~pageView, ~setPageView, ~previewState: option Loading) let mercahantUpdateBody = [("webhook_url", webhookEndpoint->Js.Json.string)]->Js.Dict.fromArray->Js.Json.object_ - let body = mercahantUpdateBody->HSwitchMerchantAccountUtils.getSettingsPayload(merchantId) + let body = mercahantUpdateBody->MerchantAccountUtils.getSettingsPayload(merchantId) let url = getURL(~entityName=MERCHANT_ACCOUNT, ~methodType=Post, ()) let merchantInfo = await updateDetails(url, body, Post) setMerchantDetailsValue(._ => merchantInfo->Js.Json.stringify) diff --git a/src/screens/HyperSwitch/SelfServe/HSwitchProdOnboarding/ProdOnboardingLanding.res b/src/screens/HyperSwitch/SelfServe/HSwitchProdOnboarding/ProdOnboardingLanding.res index 10530cc20..5cb5682fa 100644 --- a/src/screens/HyperSwitch/SelfServe/HSwitchProdOnboarding/ProdOnboardingLanding.res +++ b/src/screens/HyperSwitch/SelfServe/HSwitchProdOnboarding/ProdOnboardingLanding.res @@ -244,7 +244,7 @@ let make = () => { setButtonState(_ => Loading) let url = getURL(~entityName=USERS, ~userType=#MERCHANT_DATA, ~methodType=Post, ()) let body = ProdOnboardingUtils.getProdApiBody(~parentVariant=#SetupComplete, ()) - let _response = await updateDetails(url, body, Post) + let _ = await updateDetails(url, body, Post) setButtonState(_ => Normal) setDashboardPageState(_ => #HOME) } catch { diff --git a/src/screens/HyperSwitch/SelfServe/HSwitchProdOnboarding/ProdOnboardingUIUtils.res b/src/screens/HyperSwitch/SelfServe/HSwitchProdOnboarding/ProdOnboardingUIUtils.res index 5728292af..f02485a24 100644 --- a/src/screens/HyperSwitch/SelfServe/HSwitchProdOnboarding/ProdOnboardingUIUtils.res +++ b/src/screens/HyperSwitch/SelfServe/HSwitchProdOnboarding/ProdOnboardingUIUtils.res @@ -1,5 +1,4 @@ let subTextStyle = "text-base font-normal text-grey-700 opacity-50" -let highlightedText = "text-base font-normal text-blue-700 underline" let headerTextStyle = "text-xl font-semibold text-grey-700" module WarningBlock = { @@ -16,16 +15,6 @@ module WarningBlock = {
} } -module NoteBlock = { - @react.component - let make = (~noteText) => { -
- -

{noteText->React.string}

-
- } -} module ModalChildElementsForSpecificConnector = { @react.component @@ -137,20 +126,23 @@ module BasicAccountSetupSuccessfulPage = { ~customWidth="w-full", ~bgColor="bg-green-success_page_bg", ~buttonState=Button.Normal, + ~isButtonVisible=true, ) => {

{statusText->React.string}

-
} } diff --git a/src/screens/HyperSwitch/SelfServe/HSwitchProdOnboarding/SetupConnectorCredentials.res b/src/screens/HyperSwitch/SelfServe/HSwitchProdOnboarding/SetupConnectorCredentials.res index e6f70932c..eb78baa61 100644 --- a/src/screens/HyperSwitch/SelfServe/HSwitchProdOnboarding/SetupConnectorCredentials.res +++ b/src/screens/HyperSwitch/SelfServe/HSwitchProdOnboarding/SetupConnectorCredentials.res @@ -121,9 +121,9 @@ let make = (~selectedConnector, ~pageView, ~setPageView, ~setConnectorID) => { ) let {profile_id} = - Recoil.useRecoilValueFromAtom( - HyperswitchAtom.businessProfilesAtom, - )->HSwitchMerchantAccountUtils.getValueFromBusinessProfile + HyperswitchAtom.businessProfilesAtom + ->Recoil.useRecoilValueFromAtom + ->MerchantAccountUtils.getValueFromBusinessProfile let updateSetupConnectorCredentials = async connectorId => { try { @@ -133,7 +133,7 @@ let make = (~selectedConnector, ~pageView, ~setPageView, ~setConnectorID) => { ~connectorId, (), ) - let _response = await updateDetails(url, body, Post) + let _ = await updateDetails(url, body, Post) setPageView(_ => pageView->ProdOnboardingUtils.getPageView) } catch { | _ => () @@ -173,7 +173,7 @@ let make = (~selectedConnector, ~pageView, ~setPageView, ~setConnectorID) => { ~values, ~connector=connectorName, ~bodyType, - ~isLiveMode={featureFlagDetails.testLiveMode->Belt.Option.getWithDefault(false)}, + ~isLiveMode={featureFlagDetails.isLiveMode}, (), ) @@ -238,12 +238,12 @@ let make = (~selectedConnector, ~pageView, ~setPageView, ~setConnectorID) => { ~connector={connectorName}, ~bodyType, ~isPayoutFlow=false, - ~isLiveMode={featureFlagDetails.testLiveMode->Belt.Option.getWithDefault(false)}, + ~isLiveMode={featureFlagDetails.isLiveMode}, (), )->ignoreFields(connectorID, verifyConnectorIgnoreField) let url = getURL(~entityName=CONNECTOR, ~methodType=Post, ~connector=Some(connectorName), ()) - let _response = await updateDetails(url, body, Post) + let _ = await updateDetails(url, body, Post) setShowVerifyModal(_ => false) onSubmitMain(values)->ignore setIsLoading(_ => false) diff --git a/src/screens/HyperSwitch/SelfServe/HSwitchSandboxOnboarding/CodeSnippets.res b/src/screens/HyperSwitch/SelfServe/HSwitchSandboxOnboarding/CodeSnippets.res index 173d9658c..aa89ea871 100644 --- a/src/screens/HyperSwitch/SelfServe/HSwitchSandboxOnboarding/CodeSnippets.res +++ b/src/screens/HyperSwitch/SelfServe/HSwitchSandboxOnboarding/CodeSnippets.res @@ -733,55 +733,3 @@ app.post("/create-payment", async (req, res) => { }); app.listen(4242, () => console.log("Node server listening on port 4242!"));` - -let reactDisplayPaymentConfirmation: string = `const handleSubmit = async (e) => { - e.preventDefault(); - if (!hyper || !widgets) { - // hyper-js has not yet loaded. - // Make sure to disable form submission until hyper-js has loaded. - return; - } - setIsLoading(true); - const { error } = await hyper.confirmPayment({ - widgets, - confirmParams: { - // Make sure to change this to your payment completion page - return_url: "https://example.com/complete", - }, - }); - // This point will only be reached if there is an immediate error occurring while confirming the payment. Otherwise, your customer will be redirected to your "return_url" - // For some payment flows such as Sofort, iDEAL, your customer will be redirected to an intermediate page to complete authorization of the payment, and then redirected to the "return_url". - if (error.type === "validation_error") { - setMessage(error.message); - } else { - setMessage("An unexpected error occurred."); - } - setIsLoading(false); -};` - -let nodeDisplayPaymentConfirmation: string = `//Look for a parameter called "payment_intent_client_secret" in the url which gives a payment ID, which is then used to retrieve the status of the payment - -const paymentID = new URLSearchParams(window.location.search).get( - "payment_intent_client_secret" -); - -if (!paymentID) { - return; -} - -hyper.retrievePaymentIntent(paymentID).then(({ paymentIntent }) => { - switch (paymentIntent.status) { - case "succeeded": - setMessage("Payment succeeded!"); - break; - case "processing": - setMessage("Your payment is processing."); - break; - case "requires_payment_method": - setMessage("Your payment was not successful, please try again."); - break; - default: - setMessage("Something went wrong."); - break; - } -});` diff --git a/src/screens/HyperSwitch/SelfServe/HSwitchSandboxOnboarding/UserOnboarding.res b/src/screens/HyperSwitch/SelfServe/HSwitchSandboxOnboarding/UserOnboarding.res index e3a384156..2fc90fb0a 100644 --- a/src/screens/HyperSwitch/SelfServe/HSwitchSandboxOnboarding/UserOnboarding.res +++ b/src/screens/HyperSwitch/SelfServe/HSwitchSandboxOnboarding/UserOnboarding.res @@ -1,6 +1,3 @@ -let headerTextCss = "font-semibold text-grey-700 text-xl" -let subTextCss = "font-normal text-grey-700 opacity-50 text-base" - let buildHyperswitch: array = [ { headerIcon: "migrate-from-stripe", @@ -123,7 +120,7 @@ let make = () => { ~metadata=metaDataDict, (), ) - let _res = await updateDetails(url, body, Post) + let _ = await updateDetails(url, body, Post) setIntegrationDetails(_ => body->ProviderHelper.getIntegrationDetails) } catch { | _ => () @@ -149,7 +146,7 @@ let make = () => { ->Js.Json.object_, (), ) - let _res = await updateDetails(url, body, Post) + let _ = await updateDetails(url, body, Post) setIntegrationDetails(_ => body->ProviderHelper.getIntegrationDetails) setDashboardPageState(_ => #HOME) } catch { diff --git a/src/screens/HyperSwitch/SelfServe/HSwitchSandboxOnboarding/UserOnboardingUIUtils.res b/src/screens/HyperSwitch/SelfServe/HSwitchSandboxOnboarding/UserOnboardingUIUtils.res index 8724636b1..e54d0211f 100644 --- a/src/screens/HyperSwitch/SelfServe/HSwitchSandboxOnboarding/UserOnboardingUIUtils.res +++ b/src/screens/HyperSwitch/SelfServe/HSwitchSandboxOnboarding/UserOnboardingUIUtils.res @@ -24,7 +24,7 @@ module PublishableKeyArea = { @react.component let make = (~currentRoute) => { let merchantDetailsValue = HSwitchUtils.useMerchantDetailsValue() - let detail = merchantDetailsValue->HSwitchMerchantAccountUtils.getMerchantDetails + let detail = merchantDetailsValue->MerchantAccountUtils.getMerchantDetails let contextName = `${currentRoute->variantToTextMapperForBuildHS}_5.loadhyperswitchcheckout` { let merchantDetailsValue = HSwitchUtils.useMerchantDetailsValue() - let detail = merchantDetailsValue->HSwitchMerchantAccountUtils.getMerchantDetails + let detail = merchantDetailsValue->MerchantAccountUtils.getMerchantDetails let contextName = `${currentRoute->variantToTextMapperForBuildHS}_5.loadhyperswitchcheckout` body->ProviderHelper.getIntegrationDetails) } catch { | _ => () @@ -984,7 +984,7 @@ let getTabsForIntegration = ( src="https://hyperswitch.io/img/site/wordpress_hyperswitch_settings.png" />
- +
body->ProviderHelper.getIntegrationDetails) } catch { | _ => () diff --git a/src/screens/HyperSwitch/Settings/BusinessDetails.res b/src/screens/HyperSwitch/Settings/BusinessDetails.res index 0d1daf80e..04897eeed 100644 --- a/src/screens/HyperSwitch/Settings/BusinessDetails.res +++ b/src/screens/HyperSwitch/Settings/BusinessDetails.res @@ -1,5 +1,5 @@ open HSwitchSettingTypes -open HSwitchMerchantAccountUtils +open MerchantAccountUtils open APIUtils open SettingsFieldsInfo @@ -133,7 +133,7 @@ let make = () => { validateMerchantAccountForm( ~values, ~fieldsToValidate=[PrimaryPhone, PrimaryEmail, Website, SecondaryEmail, SecondaryPhone], - ~setIsDisabled, + ~setIsDisabled=Some(setIsDisabled), ~initialData={merchantInfo->Js.Json.object_}, ) }}> diff --git a/src/screens/HyperSwitch/Settings/BusinessMapping/BusinessMappingEntity.res b/src/screens/HyperSwitch/Settings/BusinessMapping/BusinessMappingEntity.res index 425b75fb8..72109d403 100644 --- a/src/screens/HyperSwitch/Settings/BusinessMapping/BusinessMappingEntity.res +++ b/src/screens/HyperSwitch/Settings/BusinessMapping/BusinessMappingEntity.res @@ -4,22 +4,18 @@ open BusinessMappingUtils type columns = | ProfileName | ProfileId - | ReturnUrl - | WebhookUrl -let visibleColumns = [ProfileName, ProfileId, ReturnUrl, WebhookUrl] +let visibleColumns = [ProfileId, ProfileName] -let defaultColumns = [ProfileName, ProfileId, ReturnUrl, WebhookUrl] +let defaultColumns = [ProfileId, ProfileName] -let allColumns = [ProfileName, ProfileId, ReturnUrl, WebhookUrl] +let allColumns = [ProfileId, ProfileName] let getHeading = colType => { switch colType { | ProfileId => Table.makeHeaderInfo(~key="profile_id", ~title="Profile Id", ~showSort=true, ()) | ProfileName => Table.makeHeaderInfo(~key="profile_name", ~title="Profile Name", ~showSort=true, ()) - | ReturnUrl => Table.makeHeaderInfo(~key="return_url", ~title="Return URL", ~showSort=true, ()) - | WebhookUrl => Table.makeHeaderInfo(~key="webhook_url", ~title="Webhook URL", ~showSort=true, ()) } } @@ -27,14 +23,12 @@ let getCell = (item: profileEntity, colType): Table.cell => { switch colType { | ProfileId => Text(item.profile_id) | ProfileName => Text(item.profile_name) - | ReturnUrl => Text(item.return_url->Belt.Option.getWithDefault("")) - | WebhookUrl => Text(item.webhook_details.webhook_url->Belt.Option.getWithDefault("")) } } let itemToObjMapper = dict => { open LogicUtils - open HSwitchMerchantAccountUtils + open MerchantAccountUtils { profile_id: getString(dict, "profile_id", ""), profile_name: getString(dict, ProfileName->getStringFromVariant, ""), @@ -51,7 +45,7 @@ let getItems: Js.Json.t => array = json => { LogicUtils.getArrayDataFromJson(json, itemToObjMapper) } -let apiKeysTableEntity = EntityType.makeEntity( +let businessProfileTableEntity = EntityType.makeEntity( ~uri="", ~getObjects=getItems, ~defaultColumns, @@ -61,18 +55,3 @@ let apiKeysTableEntity = EntityType.makeEntity( ~getCell, (), ) - -let businessProfileTabelEntity = showLink => - EntityType.makeEntity( - ~uri="", - ~getObjects=getItems, - ~defaultColumns, - ~allColumns, - ~getHeading, - ~dataKey="", - ~getCell, - ~getShowLink={ - profile => showLink ? `/webhooks/${profile.profile_id}` : "" - }, - (), - ) diff --git a/src/screens/HyperSwitch/Settings/BusinessMapping/BusinessProfile.res b/src/screens/HyperSwitch/Settings/BusinessMapping/BusinessProfile.res index 384f1d88f..4cea24ef1 100644 --- a/src/screens/HyperSwitch/Settings/BusinessMapping/BusinessProfile.res +++ b/src/screens/HyperSwitch/Settings/BusinessMapping/BusinessProfile.res @@ -67,7 +67,6 @@ let make = ( ~isFromSettings=true, ~showModalFromOtherScreen=false, ~setShowModalFromOtherScreen=_bool => (), - ~isFromWebhooks=false, ) => { open APIUtils open BusinessMappingUtils @@ -81,17 +80,17 @@ let make = ( let (screenState, setScreenState) = React.useState(_ => PageLoaderWrapper.Success) let businessProfileValues = - Recoil.useRecoilValueFromAtom( - HyperswitchAtom.businessProfilesAtom, - )->HSwitchMerchantAccountUtils.getArrayOfBusinessProfile + HyperswitchAtom.businessProfilesAtom + ->Recoil.useRecoilValueFromAtom + ->MerchantAccountUtils.getArrayOfBusinessProfile - let fetchBusinessProfiles = HSwitchMerchantAccountUtils.useFetchBusinessProfiles() + let fetchBusinessProfiles = MerchantAccountUtils.useFetchBusinessProfiles() let updateMerchantDetails = async body => { try { setScreenState(_ => PageLoaderWrapper.Loading) let url = getURL(~entityName=BUSINESS_PROFILE, ~methodType=Post, ()) - let _res = await updateDetails(url, body, Post) + let _ = await updateDetails(url, body, Post) fetchBusinessProfiles()->ignore showToast(~message="Your Entry added successfully", ~toastType=ToastState.ToastSuccess, ()) if !isFromSettings { @@ -111,24 +110,21 @@ let make = ( updateMerchantDetails(values)->ignore Js.Nullable.null } - let tableHeaderText = isFromWebhooks ? "Webhooks" : "Business Profiles"
Js.Array2.map(Js.Nullable.return)} totalResults={businessProfileValues->Js.Array2.length} @@ -136,14 +132,9 @@ let make = ( setOffset currrentFetchCount={businessProfileValues->Js.Array2.length} /> - // - -
- -
-
+
+ +
diff --git a/src/screens/HyperSwitch/Settings/HSwitchProfileSettings.res b/src/screens/HyperSwitch/Settings/HSwitchProfileSettings.res index 40478cbdf..2569fc1e0 100644 --- a/src/screens/HyperSwitch/Settings/HSwitchProfileSettings.res +++ b/src/screens/HyperSwitch/Settings/HSwitchProfileSettings.res @@ -73,7 +73,7 @@ module ResetPassword = { setIsLoading(_ => true) try { let url = getURL(~entityName=USERS, ~userType=#FORGOT_PASSWORD, ~methodType=Post, ()) - let _res = await updateDetails(url, body, Post) + let _ = await updateDetails(url, body, Post) showToast(~message="Please check your registered e-mail", ~toastType=ToastSuccess, ()) setIsLoading(_ => false) } catch { diff --git a/src/screens/HyperSwitch/Settings/HSwitchMerchantAccountUtils.res b/src/screens/HyperSwitch/Settings/MerchantAccountUtils.res similarity index 99% rename from src/screens/HyperSwitch/Settings/HSwitchMerchantAccountUtils.res rename to src/screens/HyperSwitch/Settings/MerchantAccountUtils.res index ac05ee285..e942288ba 100644 --- a/src/screens/HyperSwitch/Settings/HSwitchMerchantAccountUtils.res +++ b/src/screens/HyperSwitch/Settings/MerchantAccountUtils.res @@ -396,7 +396,7 @@ let validateCustom = (key, errors, value) => { let validateMerchantAccountForm = ( ~values: Js.Json.t, ~fieldsToValidate: array, - ~setIsDisabled=?, + ~setIsDisabled, ~initialData, ) => { let errors = Js.Dict.empty() @@ -492,7 +492,7 @@ module BusinessProfile = { let businessProfileNameDropDownOption = arrBusinessProfile => arrBusinessProfile->Js.Array2.map(ele => { let obj: SelectBox.dropdownOption = { - label: ele.profile_name, + label: {`${ele.profile_name} (${ele.profile_id})`}, value: ele.profile_id, } obj diff --git a/src/screens/HyperSwitch/SetupAccount/HSwitchSetupAccount.res b/src/screens/HyperSwitch/SetupAccount/HSwitchSetupAccount.res index 1365c964f..3e2b9b72a 100644 --- a/src/screens/HyperSwitch/SetupAccount/HSwitchSetupAccount.res +++ b/src/screens/HyperSwitch/SetupAccount/HSwitchSetupAccount.res @@ -12,7 +12,7 @@ let make = () => { let activeBusinessProfile = HyperswitchAtom.businessProfilesAtom ->Recoil.useRecoilValueFromAtom - ->HSwitchMerchantAccountUtils.getValueFromBusinessProfile + ->MerchantAccountUtils.getValueFromBusinessProfile let indexOfStepCounterVal = listOfStepCounter->Js.Array2.indexOf(stepCounter) let { @@ -77,7 +77,7 @@ let make = () => { ->getDictFromJsonObject ->getOptionString("id") let activateRuleURL = getURL(~entityName=ROUTING, ~methodType=Post, ~id=activatingId, ()) - let _res = await updateDetails(activateRuleURL, Js.Dict.empty()->Js.Json.object_, Post) + let _ = await updateDetails(activateRuleURL, Js.Dict.empty()->Js.Json.object_, Post) setStepCounter(_ => #ROUTING_ENABLED) // *GENERATE_SAMPLE_DATA @@ -100,7 +100,7 @@ let make = () => { (), ) let integrationUrl = getURL(~entityName=INTEGRATION_DETAILS, ~methodType=Post, ()) - let _res = await updateDetails(integrationUrl, body, Post) + let _ = await updateDetails(integrationUrl, body, Post) setIntegrationDetails(_ => body->ProviderHelper.getIntegrationDetails) setDashboardPageState(_ => #INTEGRATION_DOC) } catch { diff --git a/src/screens/HyperSwitch/StripePlusPaypal/StripePlusPaypal.res b/src/screens/HyperSwitch/StripePlusPaypal/StripePlusPaypal.res index f6fbbc65c..9148bf60d 100644 --- a/src/screens/HyperSwitch/StripePlusPaypal/StripePlusPaypal.res +++ b/src/screens/HyperSwitch/StripePlusPaypal/StripePlusPaypal.res @@ -20,7 +20,7 @@ let make = () => { let activeBusinessProfile = HyperswitchAtom.businessProfilesAtom ->Recoil.useRecoilValueFromAtom - ->HSwitchMerchantAccountUtils.getValueFromBusinessProfile + ->MerchantAccountUtils.getValueFromBusinessProfile let naviagteToHome = _ => { setDashboardPageState(_ => #HOME) diff --git a/src/screens/HyperSwitch/StripePlusPaypal/StripePlusPaypalUIUtils.res b/src/screens/HyperSwitch/StripePlusPaypal/StripePlusPaypalUIUtils.res index 99a79cc1a..f69b830c9 100644 --- a/src/screens/HyperSwitch/StripePlusPaypal/StripePlusPaypalUIUtils.res +++ b/src/screens/HyperSwitch/StripePlusPaypal/StripePlusPaypalUIUtils.res @@ -41,10 +41,10 @@ module SelectPaymentMethods = { let enumRecoilUpdateArr = [] if enums.firstProcessorConnected.processorID->Js.String2.length === 0 { - let _resp = await body->postEnumDetails(#FirstProcessorConnected) + let _ = await body->postEnumDetails(#FirstProcessorConnected) enumRecoilUpdateArr->Array.push((body, #FirstProcessorConnected)) } else if enums.secondProcessorConnected.processorID->Js.String2.length === 0 { - let _resp = await body->postEnumDetails(#SecondProcessorConnected) + let _ = await body->postEnumDetails(#SecondProcessorConnected) enumRecoilUpdateArr->Array.push((body, #SecondProcessorConnected)) } @@ -53,7 +53,7 @@ module SelectPaymentMethods = { } else if selectedConnector === PAYPAL { enumRecoilUpdateArr->Array.push((body, #PaypalConnected)) } - let _res = updateEnumInRecoil(enumRecoilUpdateArr) + let _ = updateEnumInRecoil(enumRecoilUpdateArr) } catch { | _ => setButtonState(_ => Button.Normal) } @@ -140,12 +140,11 @@ module TestPayment = { let postEnumDetails = EnumVariantHook.usePostEnumDetails() let (key, setKey) = React.useState(_ => "") let businessProfiles = Recoil.useRecoilValueFromAtom(HyperswitchAtom.businessProfilesAtom) - let defaultBusinessProfile = - businessProfiles->HSwitchMerchantAccountUtils.getValueFromBusinessProfile + let defaultBusinessProfile = businessProfiles->MerchantAccountUtils.getValueFromBusinessProfile let updateTestPaymentEnum = async _ => { try { - let _resp = await Boolean(true)->postEnumDetails(#SPTestPayment) + let _ = await Boolean(true)->postEnumDetails(#SPTestPayment) } catch { | _ => () } diff --git a/src/screens/HyperSwitch/SwitchMerchant/SwitchMerchant.res b/src/screens/HyperSwitch/SwitchMerchant/SwitchMerchant.res index 1e5d74966..c513079d5 100644 --- a/src/screens/HyperSwitch/SwitchMerchant/SwitchMerchant.res +++ b/src/screens/HyperSwitch/SwitchMerchant/SwitchMerchant.res @@ -9,8 +9,8 @@ module NewAccountCreationModal = { try { let url = getURL(~entityName=USERS, ~userType=#CREATE_MERCHANT, ~methodType=Fetch.Post, ()) let body = values - let _res = await updateDetails(url, body, Post) - let _merchantIds = await fetchMerchantIDs() + let _ = await updateDetails(url, body, Post) + let _ = await fetchMerchantIDs() showToast( ~toastType=ToastSuccess, ~message="Account Created Successfully!", diff --git a/src/screens/HyperSwitch/ThreeDSFlow/HSwitchThreeDS.res b/src/screens/HyperSwitch/ThreeDSFlow/HSwitchThreeDS.res index c7e55f912..35814ca2c 100644 --- a/src/screens/HyperSwitch/ThreeDSFlow/HSwitchThreeDS.res +++ b/src/screens/HyperSwitch/ThreeDSFlow/HSwitchThreeDS.res @@ -9,7 +9,12 @@ module ActiveRulePreview = { let ruleInfo = initialRule->Belt.Option.getWithDefault(Js.Dict.empty()) let name = ruleInfo->getString("name", "") let description = ruleInfo->getString("description", "") - let ruleInfo = ruleInfo->getJsonObjectFromDict("rules")->RoutingUtils.ruleInfoTypeMapper + + let ruleInfo = + ruleInfo + ->getJsonObjectFromDict("algorithm") + ->getDictFromJsonObject + ->AdvancedRoutingUtils.ruleInfoTypeMapper Belt.Option.isSome}>
@@ -25,7 +30,7 @@ module ActiveRulePreview = { {description->React.string}

- +
} @@ -34,7 +39,7 @@ module ActiveRulePreview = { module Configure3DSRule = { @react.component let make = (~wasm) => { - let ruleInput = ReactFinalForm.useField("json.rules").input + let ruleInput = ReactFinalForm.useField("algorithm.rules").input let (rules, setRules) = React.useState(_ => ruleInput.value->LogicUtils.getArrayFromJson([])) React.useEffect1(() => { ruleInput.onChange(rules->arrToFormEvent) @@ -58,7 +63,7 @@ module Configure3DSRule = { let notFirstRule = ruleInput.value->LogicUtils.getArrayFromJson([])->Js.Array2.length > 1 let rule = ruleInput.value->Js.Json.decodeArray->Belt.Option.getWithDefault([]) let keyExtractor = (index, _rule, isDragging) => { - let id = {`json.rules[${string_of_int(index)}]`} + let id = {`algorithm.rules[${string_of_int(index)}]`} let i = 1 } if notFirstRule { @@ -98,9 +103,7 @@ let make = () => { let fetchDetails = useGetMethod(~showErrorToast=false, ()) let updateDetails = useUpdateMethod(~showErrorToast=false, ()) let (wasm, setWasm) = React.useState(_ => None) - let (initialValues, _setInitialValues) = React.useState(_ => - buildInitial3DSValue->Js.Json.object_ - ) + let (initialValues, _setInitialValues) = React.useState(_ => buildInitial3DSValue->toJson) let (initialRule, setInitialRule) = React.useState(() => None) let (screenState, setScreenState) = React.useState(_ => PageLoaderWrapper.Loading) let (pageView, setPageView) = React.useState(_ => NEW) @@ -123,18 +126,14 @@ let make = () => { try { let threeDsUrl = getURL(~entityName=THREE_DS, ~methodType=Get, ()) let threeDsRuleDetail = await fetchDetails(threeDsUrl) - let schemaValue = - threeDsRuleDetail - ->getDictFromJsonObject - ->getObj("program", Js.Dict.empty()) - ->getObj("metadata", Js.Dict.empty()) - ->getObj("schema", Js.Dict.empty()) + let responseDict = threeDsRuleDetail->getDictFromJsonObject + let programValue = responseDict->getObj("program", Js.Dict.empty()) let intitialValue = [ - ("name", schemaValue->LogicUtils.getString("name", "")->Js.Json.string), - ("description", schemaValue->LogicUtils.getString("description", "")->Js.Json.string), - ("rules", schemaValue->LogicUtils.getObj("json", Js.Dict.empty())->Js.Json.object_), + ("name", responseDict->LogicUtils.getString("name", "")->Js.Json.string), + ("description", responseDict->LogicUtils.getString("description", "")->Js.Json.string), + ("algorithm", programValue->Js.Json.object_), ]->Js.Dict.fromArray setInitialRule(_ => Some(intitialValue)) @@ -183,24 +182,10 @@ let make = () => { let onSubmit = async (values, _) => { try { setScreenState(_ => Loading) - let dict = values->LogicUtils.getDictFromJsonObject - - let json = dict->LogicUtils.getJsonObjectFromDict("json")->LogicUtils.getDictFromJsonObject - - let description = dict->LogicUtils.getString("description", "") - let name = dict->LogicUtils.getString("name", "") - - let metadata = - [ - ("name", name->Js.Json.string), - ("description", description->Js.Json.string), - ("schema", dict->Js.Json.object_), - ]->Js.Dict.fromArray - - let threeDsPayload = buildThreeDsPayloadBody(json, wasm, metadata, name) + let threeDsPayload = values->buildThreeDsPayloadBody let getActivateUrl = getURL(~entityName=THREE_DS, ~methodType=Put, ()) - let _response = await updateDetails(getActivateUrl, threeDsPayload->Js.Json.object_, Put) + let _ = await updateDetails(getActivateUrl, threeDsPayload->toJson, Put) fetchDetails()->ignore setShowWarning(_ => true) RescriptReactRouter.replace(`/3ds`) @@ -221,7 +206,7 @@ let make = () => { RoutingUtils.validateNameAndDescription(~dict, ~errors) - switch dict->Js.Dict.get("json")->Belt.Option.flatMap(Js.Json.decodeObject) { + switch dict->Js.Dict.get("algorithm")->Belt.Option.flatMap(Js.Json.decodeObject) { | Some(jsonDict) => { let index = 1 let rules = jsonDict->LogicUtils.getArrayFromDict("rules", []) @@ -230,9 +215,9 @@ let make = () => { } else { rules->Array.forEachWithIndex((rule, i) => { let ruleDict = rule->LogicUtils.getDictFromJsonObject - if RoutingUtils.validateConditionsEvenIfOneExists(ruleDict)->Js.Array2.length == 0 { + if !RoutingUtils.validateConditionsFor3ds(ruleDict) { errors->Js.Dict.set( - `Rule ${(i + index)->string_of_int} - Condition`, + `Rule ${(i + 1)->string_of_int} - Condition`, `Invalid`->Js.Json.string, ) } diff --git a/src/screens/HyperSwitch/ThreeDSFlow/ThreeDSUtils.res b/src/screens/HyperSwitch/ThreeDSFlow/ThreeDSUtils.res index 42d2fda37..dd71cc234 100644 --- a/src/screens/HyperSwitch/ThreeDSFlow/ThreeDSUtils.res +++ b/src/screens/HyperSwitch/ThreeDSFlow/ThreeDSUtils.res @@ -1,55 +1,51 @@ -external toJson: 'a => array = "%identity" -type conditonType = { - \"logical.operator"?: string, - field: string, - real_field: string, - operator: string, - value: string, -} +external toJson: 'a => Js.Json.t = "%identity" type pageState = NEW | LANDING -open RoutingUtils -let conditions: array = [ +let statementObject: array = [ { - field: "amount", - real_field: "amount", - operator: "EQUAL TO", - value: "", + lhs: "amount", + value: { + \"type": "number", + value: ""->Js.Json.string, + }, + comparison: "EQUAL TO", }, { - \"logical.operator": "AND", - field: "currency", - real_field: "currency", - operator: "IS", - value: "", + logical: "AND", + value: { + \"type": "number", + value: ""->Js.Json.string, + }, + lhs: "currency", + comparison: "IS", }, ] -let constructNameDescription = - [ - ("name", `3DS Rule-${getCurrentUTCTime()}`->Js.Json.string), - ("description", `This is a Three-Ds Rule created at ${currentTimeInUTC}`->Js.Json.string), - ]->Js.Dict.fromArray - -let buildInitial3DSValue = { - let routingValueOutput = [("override_3ds", "three_ds"->Js.Json.string)]->Js.Dict.fromArray - let defaultValue = - [ - ("gateways", []->Js.Json.array), - ("conditions", conditions->toJson->Js.Json.array), - ("routingOutput", routingValueOutput->Js.Json.object_), - ]->Js.Dict.fromArray - - let initialJson = [("rules", [defaultValue->Js.Json.object_]->Js.Json.array)]->Js.Dict.fromArray - - let initialValueJson = constructNameDescription +type threeDsRoutingType = { + name: string, + description: string, + algorithm: AdvancedRoutingTypes.algorithmData, +} - initialValueJson->Js.Dict.set("json", initialJson->Js.Json.object_) - initialValueJson->Js.Dict.set("code", ""->Js.Json.string) +let rules: AdvancedRoutingTypes.rule = { + name: "rule_1", + connectorSelection: { + override_3ds: "three_ds", + }, + statements: statementObject, +} - // initialValueJson->Js.Dict.set("routingOutput", routingValueOutput->Js.Json.object_) - initialValueJson +let buildInitial3DSValue: threeDsRoutingType = { + name: `3DS Rule-${RoutingUtils.getCurrentUTCTime()}`, + description: `This is a Three-Ds Rule created at ${RoutingUtils.currentTimeInUTC}`, + algorithm: { + rules: [rules], + defaultSelection: { + override_3ds: "", + }, + metadata: Js.Json.null, + }, } let pageStateMapper = pageType => { @@ -59,58 +55,37 @@ let pageStateMapper = pageType => { } } -let generateRule = (index, statement, ~threeDsValue, ()) => { - let ruleObj = Js.Dict.fromArray([ - ("name", `rule_${string_of_int(index + 1)}`->Js.Json.string), - ("statements", statement->Js.Json.array), - ]) - ruleObj->Js.Dict.set("routingOutput", threeDsValue->Js.Json.object_) - ruleObj -} -let constuctAlgorithmValue = (rules, metadata) => { +let constuctAlgorithmValue = rules => { let defaultSelection = [("override_3ds", Js.Json.null)]->Js.Dict.fromArray let algorithm = [ ("defaultSelection", defaultSelection->Js.Json.object_), ("rules", rules->Js.Json.array), - ("metadata", metadata->Js.Json.object_), ]->Js.Dict.fromArray algorithm } -let buildThreeDsPayloadBody = (dict, wasm, metadata, name) => { +let buildThreeDsPayloadBody = values => { open LogicUtils - let threeDsPayload = [("name", name->Js.Json.string)]->Js.Dict.fromArray - - let rules = [] - - let _payload = - dict - ->getArrayFromDict("rules", []) - ->Array.reduceWithIndex([], (acc, priorityLogicObj, index) => { - switch priorityLogicObj->Js.Json.decodeObject { - | Some(priorityLogicObj) => { - let statement = generateStatement( - priorityLogicObj->getArrayFromDict("conditions", []), - wasm, - ) - let threeDsValue = priorityLogicObj->getObj("routingOutput", Js.Dict.empty()) - - let ruleObj = generateRule(index, statement, ~threeDsValue, ()) - rules->Array.push(ruleObj->Js.Json.object_) - } - - | None => () - } - acc - }) - - let algorithm = constuctAlgorithmValue(rules, metadata) - - threeDsPayload->Js.Dict.set("algorithm", algorithm->Js.Json.object_) + let valuesDict = values->getDictFromJsonObject + let dataDict = valuesDict->getDictfromDict("algorithm") + let rulesDict = dataDict->getArrayFromDict("rules", []) + + let modifiedRules = rulesDict->AdvancedRoutingUtils.generateRule + + let threeDsPayload = { + "name": valuesDict->getString("name", ""), + "algorithm": { + "defaultSelection": { + "override_3ds": null, + }, + "rules": modifiedRules, + "metadata": Js.Dict.empty()->Js.Json.object_, + }, + } threeDsPayload } diff --git a/src/screens/HyperSwitch/UserManagement/HSwitchInviteUsers.res b/src/screens/HyperSwitch/UserManagement/InviteUsers.res similarity index 95% rename from src/screens/HyperSwitch/UserManagement/HSwitchInviteUsers.res rename to src/screens/HyperSwitch/UserManagement/InviteUsers.res index f062c3305..6d79824bd 100644 --- a/src/screens/HyperSwitch/UserManagement/HSwitchInviteUsers.res +++ b/src/screens/HyperSwitch/UserManagement/InviteUsers.res @@ -1,5 +1,5 @@ module InviteEmailForm = { - open HSwitchUserManagementUtils + open UserManagementUtils @react.component let make = (~setRoleTypeValue) => { open LogicUtils @@ -12,7 +12,7 @@ module InviteEmailForm = { let role = `roleType` ->getArrayFromForm - ->LogicUtils.getValueFromArr(0, ""->Js.Json.string) + ->LogicUtils.getValueFromArray(0, ""->Js.Json.string) ->getStringFromJson("") let getRolesList = async () => { @@ -24,7 +24,7 @@ module InviteEmailForm = { (), ) let response = await fetchDetails(roleListUrl) - let typedResponse: array = + let typedResponse: array = response->LogicUtils.getArrayDataFromJson(roleListResponseMapper) setRoleListData(_ => typedResponse) } catch { @@ -68,7 +68,7 @@ module InviteEmailForm = { @react.component let make = () => { - open HSwitchUserManagementUtils + open UserManagementUtils open APIUtils open LogicUtils let fetchDetails = useGetMethod() @@ -88,7 +88,7 @@ let make = () => { let inviteUserReq = async (body, index) => { try { let url = getURL(~entityName=USERS, ~userType=#INVITE, ~methodType=Post, ()) - let _res = await updateDetails(url, body, Post) + let _ = await updateDetails(url, body, Post) if index === 0 { showToast(~message=`Invite(s) sent successfully via Email`, ~toastType=ToastSuccess, ()) } @@ -99,7 +99,7 @@ let make = () => { let inviteListOfUsers = async values => { let valDict = values->getDictFromJsonObject - let role = valDict->getStrArray("roleType")->LogicUtils.getValueFromArr(0, "") + let role = valDict->getStrArray("roleType")->LogicUtils.getValueFromArray(0, "") valDict ->getStrArray("emailList") @@ -112,7 +112,7 @@ let make = () => { ] ->Js.Dict.fromArray ->Js.Json.object_ - let _res = inviteUserReq(body, index) + let _ = inviteUserReq(body, index) }) await HyperSwitchUtils.delay(400) RescriptReactRouter.push("/users") diff --git a/src/screens/HyperSwitch/UserManagement/HSwitchShowUserData.res b/src/screens/HyperSwitch/UserManagement/ShowUserData.res similarity index 89% rename from src/screens/HyperSwitch/UserManagement/HSwitchShowUserData.res rename to src/screens/HyperSwitch/UserManagement/ShowUserData.res index 521a96fb6..e5a88bd68 100644 --- a/src/screens/HyperSwitch/UserManagement/HSwitchShowUserData.res +++ b/src/screens/HyperSwitch/UserManagement/ShowUserData.res @@ -1,22 +1,22 @@ -open HSwitchUserManagementUtils +open UserManagementUtils -external typeConversion: array> => array< - HSwitchUserRoleEntity.userTableTypes, +external typeConversion: array> => array< + UserRoleEntity.userTableTypes, > = "%identity" module UserHeading = { @react.component - let make = (~infoValue: HSwitchUserRoleEntity.userTableTypes, ~userId) => { + let make = (~infoValue: UserRoleEntity.userTableTypes, ~userId) => { open APIUtils let showToast = ToastState.useShowToast() let updateDetails = useUpdateMethod() - let status = infoValue.status->HSwitchUserRoleEntity.statusToVariantMapper + let status = infoValue.status->UserRoleEntity.statusToVariantMapper let resendInvite = async () => { try { let url = getURL(~entityName=USERS, ~userType=#RESEND_INVITE, ~methodType=Post, ()) let body = [("user_id", userId->Js.Json.string)]->Js.Dict.fromArray->Js.Json.object_ - let _res = await updateDetails(url, body, Post) + let _ = await updateDetails(url, body, Post) showToast(~message=`Invite resend. Please check your email.`, ~toastType=ToastSuccess, ()) } catch { | _ => () @@ -64,7 +64,7 @@ let make = () => { let currentSelectedUser = React.useMemo1(() => { usersList ->typeConversion - ->Array.reduce(Js.Dict.empty()->HSwitchUserRoleEntity.itemToObjMapperForUser, (acc, ele) => { + ->Array.reduce(Js.Dict.empty()->UserRoleEntity.itemToObjMapperForUser, (acc, ele) => { url.path->Belt.List.toArray->Js.Array2.joinWith("/")->Js.String2.includes(ele.user_id) ? ele : acc @@ -122,8 +122,7 @@ let make = () => { (), ) let res = await fetchDetails(userDataURL) - let userData = - res->LogicUtils.getArrayDataFromJson(HSwitchUserRoleEntity.itemToObjMapperForUser) + let userData = res->LogicUtils.getArrayDataFromJson(UserRoleEntity.itemToObjMapperForUser) setUsersList(_ => userData->Js.Array2.map(Js.Nullable.return)) } catch { | _ => () diff --git a/src/screens/HyperSwitch/UserManagement/HSwitchUserManagementUtils.res b/src/screens/HyperSwitch/UserManagement/UserManagementUtils.res similarity index 91% rename from src/screens/HyperSwitch/UserManagement/HSwitchUserManagementUtils.res rename to src/screens/HyperSwitch/UserManagement/UserManagementUtils.res index b4ed31ea3..97b8ad06f 100644 --- a/src/screens/HyperSwitch/UserManagement/HSwitchUserManagementUtils.res +++ b/src/screens/HyperSwitch/UserManagement/UserManagementUtils.res @@ -48,14 +48,14 @@ let validateForm = (values, ~fieldsToValidate: array) => { errors->Js.Json.object_ } -let roleListDataMapper: HSwitchUserRoleEntity.roleListResponse => SelectBox.dropdownOption = ele => { +let roleListDataMapper: UserRoleEntity.roleListResponse => SelectBox.dropdownOption = ele => { { label: ele.role_name, value: ele.role_id, } } -let roleOptions: array => array< +let roleOptions: array => array< SelectBox.dropdownOption, > = roleListData => roleListData->Js.Array2.map(roleListDataMapper) @@ -117,7 +117,7 @@ module RolePermissionValueRenderer = { ~readWriteValues: array, ) => { let getReadWriteValue = index => { - readWriteValues->LogicUtils.getValueFromArr(index, ProviderHelper.getDefaultValueOfEnum) + readWriteValues->LogicUtils.getValueFromArray(index, ProviderHelper.getDefaultValueOfEnum) } let readValue = getReadWriteValue(0).description let writeValue = getReadWriteValue(1).description @@ -151,12 +151,9 @@ module RolePermissionValueRenderer = { } } -let roleListResponseMapper: Js.Dict.t< - Js.Json.t, -> => HSwitchUserRoleEntity.roleListResponse = dict => { +let roleListResponseMapper: Js.Dict.t => UserRoleEntity.roleListResponse = dict => { open LogicUtils { - permissions: dict->getStrArray("permissions"), role_id: dict->getString("role_id", ""), role_name: dict->getString("role_name", ""), } diff --git a/src/screens/HyperSwitch/UserManagement/HSwitchUserRoleEntity.res b/src/screens/HyperSwitch/UserManagement/UserRoleEntity.res similarity index 61% rename from src/screens/HyperSwitch/UserManagement/HSwitchUserRoleEntity.res rename to src/screens/HyperSwitch/UserManagement/UserRoleEntity.res index d27ae6dfb..f362e2413 100644 --- a/src/screens/HyperSwitch/UserManagement/HSwitchUserRoleEntity.res +++ b/src/screens/HyperSwitch/UserManagement/UserRoleEntity.res @@ -7,7 +7,6 @@ type userStatus = Active | InviteSent | None type userTableTypes = { user_id: string, email: string, - last_modified_at: string, name: string, role_id: string, role_name: string, @@ -31,10 +30,6 @@ type roleColTypes = | Description | ActiveUsers -let defaultColumnsForRole = [Role, Description, CreatedBy, CreatedOn, ActiveUsers] - -let allColumnsForRole = [Role, Description, CreatedBy, CreatedOn, ActiveUsers] - let itemToObjMapperForUser = dict => { { user_id: getString(dict, "user_id", ""), @@ -43,17 +38,10 @@ let itemToObjMapperForUser = dict => { role_id: getString(dict, "role_id", ""), role_name: getString(dict, "role_name", ""), status: getString(dict, "status", ""), - last_modified_at: getString(dict, "last_modified_at", ""), } } -type roleTableTypes = { - permissions: array, - role_id: string, -} - type roleListResponse = { - permissions: array, role_id: string, role_name: string, } @@ -67,25 +55,6 @@ let getHeadingForUser = (colType: userColTypes) => { } } -let itemToObjMapperForRole = dict => { - { - permissions: dict->getStrArray("permissions"), - role_id: dict->getString("role_id", ""), - } -} - -let getHeadingForRole = colType => { - switch colType { - | Role => Table.makeHeaderInfo(~key="role", ~title="Role name", ~showSort=true, ()) - | Description => - Table.makeHeaderInfo(~key="description", ~title="Description", ~showSort=true, ()) - | CreatedBy => Table.makeHeaderInfo(~key="created_by", ~title="Created By", ~showSort=true, ()) - | CreatedOn => Table.makeHeaderInfo(~key="created_on", ~title="Created On", ~showSort=true, ()) - | ActiveUsers => - Table.makeHeaderInfo(~key="activeUsers", ~title="Active Users", ~showSort=true, ()) - } -} - let roleToVariantMapper = role => { switch role->Js.String2.toUpperCase { | "ADMIN" => Admin @@ -149,32 +118,10 @@ let getCellForUser = (data: userTableTypes, colType: userColTypes): Table.cell = } } -let getCellForRole = (data: roleTableTypes, colType: roleColTypes): Table.cell => { - let role = data.role_id->roleToVariantMapper - switch colType { - | Role => - CustomCell( -
getCssMapperForRole}`}> - {data.role_id->Js.String2.toUpperCase->React.string} -
, - "", - ) - | Description => Text(data.role_id) - | CreatedBy => Text(data.role_id) - | CreatedOn => Date(data.role_id) - | ActiveUsers => Text(data.role_id) - } -} - let getUserData: Js.Json.t => array = json => { getArrayDataFromJson(json, itemToObjMapperForUser) } -let getRoleData: Js.Json.t => array = json => { - getArrayDataFromJson(json, itemToObjMapperForRole) -} - let userEntity = EntityType.makeEntity( ~uri="", ~getObjects=getUserData, @@ -186,15 +133,3 @@ let userEntity = EntityType.makeEntity( ~getShowLink={userId => `/users/${userId.user_id}?state=user`}, (), ) - -// let roleEntity = EntityType.makeEntity( -// ~uri="", -// ~getObjects=getRoleData, -// ~defaultColumns=defaultColumnsForRole, -// ~allColumns=allColumnsForRole, -// ~getHeading=getHeadingForRole, -// ~getCell=getCellForRole, -// ~dataKey="", -// ~getShowLink={roleId => `/users/${roleId.role_id}?state=role`}, -// (), -// ) diff --git a/src/screens/HyperSwitch/UserManagement/HSwitchUserRoleEntry.res b/src/screens/HyperSwitch/UserManagement/UserRoleEntry.res similarity index 98% rename from src/screens/HyperSwitch/UserManagement/HSwitchUserRoleEntry.res rename to src/screens/HyperSwitch/UserManagement/UserRoleEntry.res index 3a2a13480..5541a02fb 100644 --- a/src/screens/HyperSwitch/UserManagement/HSwitchUserRoleEntry.res +++ b/src/screens/HyperSwitch/UserManagement/UserRoleEntry.res @@ -1,5 +1,5 @@ type roles = Users | Roles -open HSwitchUserRoleEntity +open UserRoleEntity @react.component let make = () => { @@ -99,7 +99,7 @@ let make = () => { entity={userEntity} currrentFetchCount={usersFilterData->Js.Array2.length} showSerialNumber=true - collapseTabelRow=false + collapseTableRow=false rowHeightClass="h-20" tableheadingClass="h-16" /> diff --git a/src/screens/HyperSwitch/UserManagement/HSwitchUserRoleShowData.res b/src/screens/HyperSwitch/UserManagement/UserRoleShowData.res similarity index 71% rename from src/screens/HyperSwitch/UserManagement/HSwitchUserRoleShowData.res rename to src/screens/HyperSwitch/UserManagement/UserRoleShowData.res index dbea74c83..3ff2dc197 100644 --- a/src/screens/HyperSwitch/UserManagement/HSwitchUserRoleShowData.res +++ b/src/screens/HyperSwitch/UserManagement/UserRoleShowData.res @@ -1,14 +1,14 @@ @react.component -let make = (~id as _) => { +let make = () => { let url = RescriptReactRouter.useUrl() - let stateName = url.search->Js.String2.split("=")->LogicUtils.getValueFromArr(1, "") + let stateName = url.search->Js.String2.split("=")->LogicUtils.getValueFromArray(1, "")
{switch stateName->Js.String2.toLowerCase { - | "user" => + | "user" => | _ => { RescriptReactRouter.replace("?state=user") - + } }}
diff --git a/src/screens/HyperSwitch/Utils/HSwitchGlobalSearchBar.res b/src/screens/HyperSwitch/Utils/HSwitchGlobalSearchBar.res index 8dbfef132..d25db93ec 100644 --- a/src/screens/HyperSwitch/Utils/HSwitchGlobalSearchBar.res +++ b/src/screens/HyperSwitch/Utils/HSwitchGlobalSearchBar.res @@ -1,37 +1,12 @@ -let regex = (a, searchString) => { - let searchStringNew = - searchString - ->Js.String2.replaceByRe(%re("/[<>\[\]';|?*\\]/g"), "") - ->Js.String2.replaceByRe(%re("/\(/g"), "\\(") - ->Js.String2.replaceByRe(%re("/\+/g"), "\\+") - ->Js.String2.replaceByRe(%re("/\)/g"), "\\)") - Js.Re.fromStringWithFlags("(.*)(" ++ a ++ "" ++ searchStringNew ++ ")(.*)", ~flags="i") -} - -let shouldDisplay = (~globalSearchList, ~searchText) => { - let isMatch = switch Js.String2.match_(globalSearchList, regex("\\b", searchText)) { - | Some(_) => true - | None => Js.String2.match_(globalSearchList, regex("_", searchText))->Belt.Option.isSome - } - isMatch && searchText->Js.String2.length > 0 -} -let listText = (text, searchText) => { - switch Js.String2.match_(text, regex("\\b", searchText)) { - | Some(r) => r->Array.sliceToEnd(~start=1)->Belt.Array.keepMap(x => x) - | None => - switch Js.String2.match_(text, regex("_", searchText)) { - | Some(a) => a->Array.sliceToEnd(~start=1)->Belt.Array.keepMap(x => x) - | None => [text] - } - } -} let matchInSearchOption = (searchOptions, searchText, name, link, ~sectionName="", ()) => { + open LogicUtils + let valueReturned = searchOptions ->Belt.Option.getWithDefault([]) ->Js.Array2.filter(item => { let (searchKey, _redirection) = item - shouldDisplay(~globalSearchList=searchKey, ~searchText) + checkStringStartsWithSubstring(~itemToCheck=searchKey, ~searchText) }) ->Js.Array2.map(item => { let (searchKey, redirection) = item @@ -54,7 +29,9 @@ let matchInSearchOption = (searchOptions, searchText, name, link, ~sectionName=" module RenderedComponent = { @react.component let make = (~ele, ~searchText) => { - listText(ele, searchText) + open LogicUtils + + listOfMatchedText(ele, searchText) ->Array.mapWithIndex((item, i) => { if ( Js.String2.toLowerCase(item) == Js.String2.toLowerCase(searchText) && @@ -80,6 +57,8 @@ module RenderedComponent = { @react.component let make = () => { open HeadlessUI + open LogicUtils + let (showModal, setShowModal) = React.useState(_ => false) let (searchText, setSearchText) = React.useState(_ => "") let (arr, setArr) = React.useState(_ => []) @@ -91,7 +70,7 @@ let make = () => { let merchentDetails = HSwitchUtils.useMerchantDetailsValue() let userRole = HSLocalStorage.getFromUserDetails("user_role") let isReconEnabled = - (merchentDetails->HSwitchMerchantAccountUtils.getMerchantDetails).recon_status === Active + (merchentDetails->MerchantAccountUtils.getMerchantDetails).recon_status === Active let hswitchTabs = SidebarValues.getHyperSwitchAppSidebars( ~isReconEnabled, @@ -108,7 +87,7 @@ let make = () => { switch item { | Link(obj) | RemoteLink(obj) => { - if shouldDisplay(~globalSearchList=obj.name, ~searchText) { + if checkStringStartsWithSubstring(~itemToCheck=obj.name, ~searchText) { let matchedEle = [ ("elements", [""->Js.Json.string, obj.name->Js.Json.string]->Js.Json.array), @@ -136,8 +115,8 @@ let make = () => { | SubLevelLink(obj) | SubLevelRemoteLink(obj) => { if ( - shouldDisplay(~globalSearchList=sectionObj.name, ~searchText) || - shouldDisplay(~globalSearchList=obj.name, ~searchText) + checkStringStartsWithSubstring(~itemToCheck=sectionObj.name, ~searchText) || + checkStringStartsWithSubstring(~itemToCheck=obj.name, ~searchText) ) { let matchedEle = [ @@ -169,7 +148,7 @@ let make = () => { } | LinkWithTag(obj) => { - if shouldDisplay(~globalSearchList=obj.name, ~searchText) { + if checkStringStartsWithSubstring(~itemToCheck=obj.name, ~searchText) { let matchedEle = [ ("elements", [obj.name->Js.Json.string]->Js.Json.array), diff --git a/src/screens/HyperSwitch/Utils/HSwitchVerticalStepper.res b/src/screens/HyperSwitch/Utils/HSwitchVerticalStepper.res deleted file mode 100644 index f560072f3..000000000 --- a/src/screens/HyperSwitch/Utils/HSwitchVerticalStepper.res +++ /dev/null @@ -1,143 +0,0 @@ -type stepperValueType = { - collapsedText: string, - renderComponent: React.element, - isSelectable: bool, -} - -module StepperRenderedComponent = { - @react.component - let make = ( - ~headerText=None, - ~overrideStyles="", - ~btnText="", - ~isBtnVisible=true, - ~customOnClick=() => (), - ~isDisabled=false, - ~customHeaderComponent=React.null, - ) => { - let stepCompHeight = isBtnVisible ? "h-25" : "h-15" -
- Belt.Option.isSome}> -

- {headerText->Belt.Option.getWithDefault("")->React.string} -

-
- - {customHeaderComponent} - -
- } -} - -let getMixpanelEvent = ( - url: RescriptReactRouter.url, - ~actionName, - ~hyperswitchMixPanel: HSMixPanel.functionType, -) => { - [url.path->LogicUtils.getListHead, "global"]->Js.Array2.forEach(ele => - hyperswitchMixPanel(~pageName=ele, ~contextName="onboarding_checklist", ~actionName, ()) - ) -} - -let skipAndContinue = async ( - ~updateDetails: (Js.String2.t, Js.Json.t, Fetch.requestMethod) => promise, - ~body, - ~setIntegrationDetails, -) => { - try { - let url = APIUtils.getURL(~entityName=INTEGRATION_DETAILS, ~methodType=Post, ()) - let _res = await updateDetails(url, body, Post) - setIntegrationDetails(_ => body->ProviderHelper.getIntegrationDetails) - } catch { - | _ => () - } -} - -let getStepperValue = (~integrationDetails: ProviderTypes.integrationDetailsType) => { - [ - { - collapsedText: "Free tier activated", - renderComponent: - {"10K free transactions per month. Explore detailed pricing"->React.string} - - {"here"->React.string} - -

} - isBtnVisible=false - />, - isSelectable: false, - }, - { - collapsedText: "Dashboard configured", - renderComponent: , - isSelectable: false, - }, - { - collapsedText: "Integrate Hyperswitch", - renderComponent: , - isSelectable: true, - }, - ] -} - -module VerticalStepper = { - @react.component - let make = (~onboardingStep, ~stepperValue) => { - let selectedStepTextStyle = index => - index === onboardingStep - ? "text-blue-800 font-bold" - : "text-jp-gray-banner_black font-semibold" - - let selectedStepStyle = index => - index < onboardingStep ? "bg-blue-800 " : " bg-jp-gray-700 opacity-50" - - let selectedIcon = index => { - index < onboardingStep ? : - } - -
- {stepperValue - ->Array.mapWithIndex((value, index) => { - let isLast = stepperValue->Js.Array2.length - 1 === index -
-
-
{index->selectedIcon}
- - {if onboardingStep === index { -
-
selectedStepStyle}`} /> -
-
- } else { -
selectedStepStyle} `} /> - }} - -
-
string_of_int} className="flex flex-col gap-3"> -
string_of_int} className={`text-xl ${index->selectedStepTextStyle}`}> - {value.collapsedText->React.string} -
- {value.renderComponent} -
-
- }) - ->React.array} -
- } -} diff --git a/src/screens/login/HSwitchLoginFlow/HyperSwitchAuth.res b/src/screens/login/HSwitchLoginFlow/HyperSwitchAuth.res index a706cb5f0..223f1c818 100644 --- a/src/screens/login/HSwitchLoginFlow/HyperSwitchAuth.res +++ b/src/screens/login/HSwitchLoginFlow/HyperSwitchAuth.res @@ -15,7 +15,7 @@ let make = (~setAuthStatus: HyperSwitchAuthTypes.authStatus => unit, ~authType, let showToast = ToastState.useShowToast() let updateDetails = useUpdateMethod(~showErrorToast=false, ()) let (email, setEmail) = React.useState(_ => "") - let {magicLink: isMagicLinkEnabled, forgetPassword} = + let {magicLink: isMagicLinkEnabled, forgetPassword, ossBuild: isOssBuild} = HyperswitchAtom.featureFlagAtom ->Recoil.useRecoilValueFromAtom ->LogicUtils.safeParse @@ -53,9 +53,9 @@ let make = (~setAuthStatus: HyperSwitchAuthTypes.authStatus => unit, ~authType, Js.Nullable.null } - let getUserWithEmailPassword = async (body, email) => { + let getUserWithEmailPassword = async (body, email, userType) => { try { - let url = getURL(~entityName=USERS, ~userType=#SIGNIN, ~methodType=Post, ()) + let url = getURL(~entityName=USERS, ~userType, ~methodType=Post, ()) let res = await updateDetails(url, body, Post) let token = parseResponseJson(~json=res, ~email) @@ -75,14 +75,14 @@ let make = (~setAuthStatus: HyperSwitchAuthTypes.authStatus => unit, ~authType, let openPlayground = _ => { hyperswitchMixPanel(~eventName=Some("try_playground"), ~email=playgroundUserEmail, ()) let body = getEmailPasswordBody(playgroundUserEmail, playgroundUserPassword, country) - getUserWithEmailPassword(body, playgroundUserEmail)->ignore + getUserWithEmailPassword(body, playgroundUserEmail, #SIGNIN)->ignore HSLocalStorage.setIsPlaygroundInLocalStorage(true) } let setResetPassword = async body => { try { let url = getURL(~entityName=USERS, ~userType=#RESET_PASSWORD, ~methodType=Post, ()) - let _res = await updateDetails(url, body, Post) + let _ = await updateDetails(url, body, Post) RescriptReactRouter.push("/") showToast(~message=`Password Changed Successfully`, ~toastType=ToastSuccess, ()) setAuthType(_ => LoginWithEmail) @@ -96,7 +96,7 @@ let make = (~setAuthStatus: HyperSwitchAuthTypes.authStatus => unit, ~authType, let setForgetPassword = async body => { try { let url = getURL(~entityName=USERS, ~userType=#FORGOT_PASSWORD, ~methodType=Post, ()) - let _res = await updateDetails(url, body, Post) + let _ = await updateDetails(url, body, Post) setAuthType(_ => ForgetPasswordEmailSent) showToast(~message="Please check your registered e-mail", ~toastType=ToastSuccess, ()) } catch { @@ -108,7 +108,7 @@ let make = (~setAuthStatus: HyperSwitchAuthTypes.authStatus => unit, ~authType, let resendVerifyEmail = async body => { try { let url = getURL(~entityName=USERS, ~userType=#VERIFY_EMAIL_REQUEST, ~methodType=Post, ()) - let _res = await updateDetails(url, body, Post) + let _ = await updateDetails(url, body, Post) setAuthType(_ => ResendVerifyEmailSent) showToast(~message="Please check your registered e-mail", ~toastType=ToastSuccess, ()) } catch { @@ -159,14 +159,20 @@ let make = (~setAuthStatus: HyperSwitchAuthTypes.authStatus => unit, ~authType, | (false, SignUP) => { let password = getString(valuesDict, "password", "") let body = getEmailPasswordBody(email, password, country) - - getUserWithEmailPassword(body, email)->ignore + if isOssBuild { + getUserWithEmailPassword(body, email, #OSSSIGNUP)->ignore + } else { + getUserWithEmailPassword(body, email, #SIGNIN)->ignore + } } | (_, LoginWithPassword) => { let password = getString(valuesDict, "password", "") let body = getEmailPasswordBody(email, password, country) - - getUserWithEmailPassword(body, email)->ignore + if isOssBuild { + getUserWithEmailPassword(body, email, #OSSSIGNIN)->ignore + } else { + getUserWithEmailPassword(body, email, #SIGNIN)->ignore + } } | (_, ResetPassword) => { let queryDict = url.search->getDictFromUrlSearchParams diff --git a/src/screens/login/HSwitchLoginFlow/HyperSwitchAuthScreen.res b/src/screens/login/HSwitchLoginFlow/HyperSwitchAuthScreen.res index ed749027e..ab716ea83 100644 --- a/src/screens/login/HSwitchLoginFlow/HyperSwitchAuthScreen.res +++ b/src/screens/login/HSwitchLoginFlow/HyperSwitchAuthScreen.res @@ -47,7 +47,7 @@ let make = (~setAuthStatus: HyperSwitchAuthTypes.authStatus => unit) => { open HyperSwitchAuthTypes let url = RescriptReactRouter.useUrl() let (mode, setMode) = React.useState(_ => TestButtonMode) - let {testLiveMode, magicLink: isMagicLinkEnabled} = + let {isLiveMode, magicLink: isMagicLinkEnabled} = HyperswitchAtom.featureFlagAtom ->Recoil.useRecoilValueFromAtom ->LogicUtils.safeParse @@ -74,7 +74,7 @@ let make = (~setAuthStatus: HyperSwitchAuthTypes.authStatus => unit) => { }, [isMagicLinkEnabled]) React.useEffect1(() => { - if testLiveMode->Belt.Option.getWithDefault(false) { + if isLiveMode { setMode(_ => LiveButtonMode) } else { setMode(_ => TestButtonMode) diff --git a/src/screens/login/HSwitchLoginFlow/HyperSwitchAuthTypes.res b/src/screens/login/HSwitchLoginFlow/HyperSwitchAuthTypes.res index 16d723ecc..0dffb0772 100644 --- a/src/screens/login/HSwitchLoginFlow/HyperSwitchAuthTypes.res +++ b/src/screens/login/HSwitchLoginFlow/HyperSwitchAuthTypes.res @@ -1,6 +1,4 @@ type authInfo = { - email: string, - name: string, token: string, merchantId: string, username: string, @@ -11,17 +9,11 @@ open LogicUtils let getAuthInfo = (json, str) => { let dict = json->JsonFlattenUtils.flattenObject(false) - let emailKey = "email" - let tokenKey = "token" - - let name = "name" let merchantIdKey = "merchantId" let userNameKey = "username" let authInfo = { - name: getString(dict, name, ""), - email: getString(dict, emailKey, ""), token: getString(dict, tokenKey, str), merchantId: getString(dict, merchantIdKey, str), username: getString(dict, userNameKey, ""), @@ -32,8 +24,6 @@ let getAuthInfo = (json, str) => { let getDummyAuthInfoForToken = token => { let authInfo = { - name: "", - email: "", token, merchantId: "", username: "", diff --git a/src/screens/login/HSwitchLoginFlow/HyperSwitchAuthUtils.res b/src/screens/login/HSwitchLoginFlow/HyperSwitchAuthUtils.res index 599639e1a..7a102d294 100644 --- a/src/screens/login/HSwitchLoginFlow/HyperSwitchAuthUtils.res +++ b/src/screens/login/HSwitchLoginFlow/HyperSwitchAuthUtils.res @@ -163,10 +163,10 @@ let validateForm = (values: Js.Json.t, keys: array) => { } // password check - HSwitchMerchantAccountUtils.passwordKeyValidation(value, key, "create_password", errors) + MerchantAccountUtils.passwordKeyValidation(value, key, "create_password", errors) // confirm password check - HSwitchMerchantAccountUtils.confirmPasswordCheck( + MerchantAccountUtils.confirmPasswordCheck( value, key, "comfirm_password", @@ -310,7 +310,7 @@ module Header = { @react.component let make = (~authType, ~setAuthType, ~email) => { let form = ReactFinalForm.useForm() - let {magicLink: isMagicLinkEnabled, testLiveMode} = + let {magicLink: isMagicLinkEnabled, isLiveMode} = HyperswitchAtom.featureFlagAtom ->Recoil.useRecoilValueFromAtom ->LogicUtils.safeParse @@ -383,18 +383,14 @@ module Header = {

{cardHeaderText->React.string}

{switch authType { | LoginWithPassword | LoginWithEmail => - switch testLiveMode { - | Some(val) => - !val - ? getHeaderLink( - ~prefix="New to Hyperswitch?", - ~authType=SignUP, - ~path="/register", - ~sufix="Sign up", - ) - : React.null - | _ => React.null - } + !isLiveMode + ? getHeaderLink( + ~prefix="New to Hyperswitch?", + ~authType=SignUP, + ~path="/register", + ~sufix="Sign up", + ) + : React.null | SignUP => getHeaderLink( diff --git a/src/utils/DateTimeUtils.res b/src/utils/DateTimeUtils.res index d1767212f..13c0181e8 100644 --- a/src/utils/DateTimeUtils.res +++ b/src/utils/DateTimeUtils.res @@ -36,14 +36,6 @@ let getStartOfWeek = (dayJs: Js.Date.t, startOfday: days) => { ->DayJs.getDayJsForJsDate } -let utcTimeToIST = timeStr => { - if !(timeStr->Js.String.endsWith("Z") || timeStr->Js.String.endsWith("z")) { - `${timeStr}Z` - } else { - timeStr - } -} - let utcToIST = timeStr => { let isEU = false let updatedHour = Js.Date.getHours(timeStr) +. 5.0 @@ -70,21 +62,6 @@ let utcToISTDate = timeStr => { } } -let lastDate = (date: float) => { - Js.Date.setDate( - Js.Date.setMonthD( - date->Js.Date.fromFloat, - ~month=Js.Date.getMonth(date->Js.Date.fromFloat) +. 1., - ~date=1., - (), - )->Js.Date.fromFloat, - 0., - ) -} -let firstDate = (date: float) => { - Js.Date.setDate(date->Js.Date.fromFloat, 1.) -} - let parseAsFloat = (dateStr: string) => { let date = (dateStr->DayJs.getDayJsForString).toDate(.) Js.Date.makeWithYMDHMS( diff --git a/src/utils/DownloadUtils.res b/src/utils/DownloadUtils.res index 82a212f2c..ccadc0d6f 100644 --- a/src/utils/DownloadUtils.res +++ b/src/utils/DownloadUtils.res @@ -15,22 +15,7 @@ let download = (~fileName, ~content, ~fileType) => { a->clickElement } type imageType = [#svg | #png | #jpeg | #jpg] -let imageTypeToStr = imageType => { - switch imageType { - | #svg => "svg" - | #png => "png" - | #jpeg => "jpeg" - | #jpg => "jpg" - } -} let downloadOld = (~fileName, ~content) => { download(~fileName, ~content, ~fileType="text/plain") } - -let openInNewTab = (~href) => { - let a = Webapi.Dom.document->Webapi.Dom.Document.createElement("a") - a->Webapi.Dom.Element.setAttribute("href", href) - a->Webapi.Dom.Element.setAttribute("target", "_blank") - a->clickElement -} diff --git a/src/utils/HSwitchGlobalVars.res b/src/utils/HSwitchGlobalVars.res index 48b59cd28..2ad551df6 100644 --- a/src/utils/HSwitchGlobalVars.res +++ b/src/utils/HSwitchGlobalVars.res @@ -59,5 +59,4 @@ let urlToDownloadApplePayCertificate = switch hostType { | _ => "/apple-developer-merchantid-domain-association" } -let recoEmail = "biz@hyperswitch.io" let agreementVersion = "1.1.0" diff --git a/src/utils/LogicUtils.res b/src/utils/LogicUtils.res index f3039cd6d..854b3ea2f 100644 --- a/src/utils/LogicUtils.res +++ b/src/utils/LogicUtils.res @@ -510,7 +510,7 @@ let getDictfromDict = (dict, key) => { let checkLeapYear = year => (mod(year, 4) === 0 && mod(year, 100) !== 0) || mod(year, 400) === 0 -let getValueFromArr = (arr, index, default) => +let getValueFromArray = (arr, index, default) => arr->Belt.Array.get(index)->Belt.Option.getWithDefault(default) let isEqualStringArr = (arr1, arr2) => { @@ -607,3 +607,36 @@ let getTitle = name => { ->Js.Array2.map(capitalizeString) ->Js.Array2.joinWith(" ") } + +// Regex to check if a string contains a substring +let regex = (positionToCheckFrom, searchString) => { + let searchStringNew = + searchString + ->Js.String2.replaceByRe(%re("/[<>\[\]';|?*\\]/g"), "") + ->Js.String2.replaceByRe(%re("/\(/g"), "\\(") + ->Js.String2.replaceByRe(%re("/\+/g"), "\\+") + ->Js.String2.replaceByRe(%re("/\)/g"), "\\)") + Js.Re.fromStringWithFlags( + "(.*)(" ++ positionToCheckFrom ++ "" ++ searchStringNew ++ ")(.*)", + ~flags="i", + ) +} + +let checkStringStartsWithSubstring = (~itemToCheck, ~searchText) => { + let isMatch = switch Js.String2.match_(itemToCheck, regex("\\b", searchText)) { + | Some(_) => true + | None => Js.String2.match_(itemToCheck, regex("_", searchText))->Belt.Option.isSome + } + isMatch && searchText->Js.String2.length > 0 +} + +let listOfMatchedText = (text, searchText) => { + switch Js.String2.match_(text, regex("\\b", searchText)) { + | Some(r) => r->Array.sliceToEnd(~start=1)->Belt.Array.keepMap(x => x) + | None => + switch Js.String2.match_(text, regex("_", searchText)) { + | Some(a) => a->Array.sliceToEnd(~start=1)->Belt.Array.keepMap(x => x) + | None => [text] + } + } +} diff --git a/tests/bsconfig.json b/tests/bsconfig.json deleted file mode 100644 index a0c7873e6..000000000 --- a/tests/bsconfig.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "name": "editor-ui", - "jsx": { - "version": 4, - "mode": "classic" - }, - "bsc-flags": ["-bs-super-errors"], - "sources": [ - { - "dir": "../src", - "subdirs": true - }, - { - "dir": "../tests", - "subdirs": true, - "type": "dev" - } - ], - "suffix": ".bs.js", - "namespace": true, - "ppx-flags": [], - "package-specs": { - "module": "commonjs", - "in-source": true - }, - "bs-dev-dependencies": ["@glennsl/rescript-jest"], - "bs-dependencies": [ - "@rescript/react", - "rescript-webapi", - "bs-fetch", - "@ryyppy/rescript-promise", - "rescript-debounce-react" - ] -} diff --git a/tests/marketplace/unit_test/InitTest.res b/tests/marketplace/unit_test/InitTest.res deleted file mode 100644 index 76f513b3d..000000000 --- a/tests/marketplace/unit_test/InitTest.res +++ /dev/null @@ -1,13 +0,0 @@ -open Jest -open Expect - -let () = { - describe("Test", () => { - let expectedValue = "test" - let actualValue = "test" - - test("Test", () => { - expect(actualValue)->toEqual(expectedValue) - }) - }) -} diff --git a/webpack.common.js b/webpack.common.js index 687b6dd56..966c1a507 100644 --- a/webpack.common.js +++ b/webpack.common.js @@ -6,23 +6,10 @@ const ReactRefreshWebpackPlugin = require("@pmmmwh/react-refresh-webpack-plugin" const tailwindcss = require("tailwindcss"); const MonacoWebpackPlugin = require("monaco-editor-webpack-plugin"); -const appEntryPoint = { - hyperswitch: "hyperswitch/HyperSwitchEntry", -}; - -function getAppEntryPoint(appName) { - const path = appEntryPoint[appName]; - if (path) { - return `./src/entryPoints/${path}.bs.js`; - } else { - return undefined; - } -} - module.exports = (appName = "hyperswitch", publicPath = "auto") => { const isDevelopment = process.env.NODE_ENV !== "production"; let entryObj = { - app: getAppEntryPoint(appName), + app: `./src/entryPoints/hyperswitch/HyperSwitchEntry.bs.js`, }; return { entry: entryObj,