Skip to content

feat: Superposition#1426

Open
Shivam25092001 wants to merge 3 commits intomainfrom
feat/superposition-b
Open

feat: Superposition#1426
Shivam25092001 wants to merge 3 commits intomainfrom
feat/superposition-b

Conversation

@Shivam25092001
Copy link
Copy Markdown
Contributor

Type of Change

  • Bugfix
  • New feature
  • Enhancement
  • Refactoring
  • Dependency updates
  • Documentation
  • CI/CD

Description

Superposition in web

How did you test it?

TESTING MATRIX

Checklist

  • I ran npm run re:build
  • I reviewed submitted code
  • I added unit tests for my changes where possible

@semanticdiff-com
Copy link
Copy Markdown

semanticdiff-com bot commented Mar 20, 2026

Review changes with  SemanticDiff

Changed Files
File Status
  package-lock.json  0% smaller
  package.json  0% smaller
  shared-code  0% smaller
  src/Components/AddressPaymentInput.res Unsupported file format
  src/Components/BillingNamePaymentInput.res Unsupported file format
  src/Components/BlikCodePaymentInput.res Unsupported file format
  src/Components/CryptoCurrencyNetworks.res Unsupported file format
  src/Components/DocumentNumberInput.res Unsupported file format
  src/Components/DynamicFields.res Unsupported file format
  src/Components/EmailPaymentInput.res Unsupported file format
  src/Components/FullNamePaymentInput.res Unsupported file format
  src/Components/GiftCardNumberInput.res Unsupported file format
  src/Components/GiftCardPinInput.res Unsupported file format
  src/Components/ManageSavedItem.res Unsupported file format
  src/Components/NicknamePaymentInput.res Unsupported file format
  src/Components/PhoneNumberPaymentInput.res Unsupported file format
  src/Components/PixPaymentInput.res Unsupported file format
  src/Components/ReactFinalFormField.res Unsupported file format
  src/Components/VpaIdPaymentInput.res Unsupported file format
  src/LocaleStrings/ArabicLocale.res Unsupported file format
  src/LocaleStrings/CatalanLocale.res Unsupported file format
  src/LocaleStrings/ChineseLocale.res Unsupported file format
  src/LocaleStrings/DeutschLocale.res Unsupported file format
  src/LocaleStrings/DutchLocale.res Unsupported file format
  src/LocaleStrings/EnglishGBLocale.res Unsupported file format
  src/LocaleStrings/EnglishLocale.res Unsupported file format
  src/LocaleStrings/FrenchBelgiumLocale.res Unsupported file format
  src/LocaleStrings/FrenchLocale.res Unsupported file format
  src/LocaleStrings/HebrewLocale.res Unsupported file format
  src/LocaleStrings/ItalianLocale.res Unsupported file format
  src/LocaleStrings/JapaneseLocale.res Unsupported file format
  src/LocaleStrings/LocaleStringTypes.res Unsupported file format
  src/LocaleStrings/PolishLocale.res Unsupported file format
  src/LocaleStrings/PortugueseLocale.res Unsupported file format
  src/LocaleStrings/RussianLocale.res Unsupported file format
  src/LocaleStrings/SpanishLocale.res Unsupported file format
  src/LocaleStrings/SwedishLocale.res Unsupported file format
  src/LocaleStrings/TraditionalChineseLocale.res Unsupported file format
  src/Payments/ACHBankDebit.res Unsupported file format
  src/Payments/BacsBankDebit.res Unsupported file format
  src/Payments/BankDebitModal.res Unsupported file format
  src/Payments/BecsBankDebit.res Unsupported file format
  src/Payments/CardPayment.res Unsupported file format
  src/Payments/DateOfBirth.res Unsupported file format
  src/Payments/PaymentMethodsRecord.res Unsupported file format
  src/Utilities/DynamicFieldsUtils.res Unsupported file format
  src/Utilities/Utils.res Unsupported file format
  webpack.dev.js  0% smaller

@aritro2002
Copy link
Copy Markdown
Contributor

🔍 Code Review by opencode

Status: ⚠️ Changes Requested


🚨 Critical Issues (Must Fix)

1. React Hooks Violations (ESLint Errors)

File Issue Location
ReactFinalFormField.res Conditional hook call - useField called inside switch Lines 12-15
DynamicFields.res Hooks in render - useRef called inside JSX callbacks Lines 543, 649, 680

Why critical: Breaks React's Rules of Hooks, causes undefined behavior.

2. Unused Open Statements (Build Warnings)

File Issue Location
VpaIdPaymentInput.res Unused open Utils Line 2
EmailPaymentInput.res Unused open Utils Line 2

⚠️ Medium Priority

File Issue Location
DynamicFieldsUtils.res Unused match case _ => "unknown" Line 744

✅ Verified Good

  • Build passes (713 files, 0 errors)
  • No debug logs
  • No Belt modules
  • Proper validation patterns
  • Correct shared-code integration

Required Fixes

1. ReactFinalFormField.res (Lines 12-15):

// Change from:
let field = switch validationRule {
| Some(rule) => ReactFinalForm.useField(name, ~config={validate: createValidator(rule)})
| None => ReactFinalForm.useField(name)
}

// To:
let config = validationRule->Option.map(rule => {validate: createValidator(rule)})
let field = ReactFinalForm.useField(name, ~config?)

2. DynamicFields.res (Lines 543, 649, 680):
Move useRef calls to top of component, pass refs to JSX instead of calling inside render.

3. Remove unused open Utils from:

  • VpaIdPaymentInput.res:2
  • EmailPaymentInput.res:2

Verification Commands

npm run re:build      # Must pass
npm run test:hooks    # Must show 0 errors

Once fixed, this PR is ready for approval.


Reviewed by opencode AI using hyperswitch-web skill guidelines

~localeObject=localeString->Obj.magic,
)

let line1Field: ReactFinalForm.Field.fieldProps = ReactFinalForm.useField(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

line1Field: ReactFinalForm.Field.fieldProps, no need to add such types


let formatBSB = bsb => {
let formatted = bsb->String.replaceRegExp(%re("/\D+/g"), "")
let formatted = bsb->String.replaceRegExp(%re("/\\D+/g"), "")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reason for this change?

fieldName="Blik code"
setValue={setblikCode}
value=blikCode
setValue={_ => ()}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see many places where you’ve added _ => (). If it’s the same everywhere, just remove setValue if it’s not required.

Comment on lines -6 to -18
let setDocumentNumber = Recoil.useSetRecoilState(RecoilAtoms.userDocumentNumber)

let pixCNPJ = Recoil.useRecoilValueFromAtom(userPixCNPJ)
let pixCPF = Recoil.useRecoilValueFromAtom(userPixCPF)

React.useEffect(() => {
switch documentType {
| "cpf" => setDocumentNumber(_ => pixCPF)
| "cnpj" => setDocumentNumber(_ => pixCNPJ)
| _ => setDocumentNumber(_ => RecoilAtoms.defaultFieldValues)
}
None
}, (documentType, pixCNPJ, pixCPF))
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this was a special case for pix,
refer to #1358,
check of it's working.


@react.component
let make = () => {
let make = (~name="email") => {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noticed that in many files you’ve added a name parameter with a default value (e.g., giftCardNumber) in components like GiftCardNumberInput, EmailPaymentInput, etc.

I don’t think consumers will need to pass a different name for these inputs. Do we really need to expose the name parameter here?

@aritro2002
Copy link
Copy Markdown
Contributor

@Shivam25092001 , could you please pull the latest changes from main and resolve the merge conflicts? There have been quite a lot of updates.

Also, I noticed that you've used fc in several places—please use the full form instead. Additionally, there are many places where types have been explicitly added during declaration; since these can be inferred automatically, they aren’t necessary.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 2, 2026

🚫 Missing Linked Issue

Hi 👋 This pull request does not appear to be linked to any open issue yet.

Linking your PR to an issue helps keep the project tidy and ensures the issue is closed automatically.

✔️ How to fix this

  • Add a keyword like Fixes #123 or Closes #456 to your PR description or a commit message.
  • Or link it manually using the "Linked issues" panel in the PR sidebar.

Tip: You can link multiple issues.
🚫 Note: If only one issue is linked, it must be open for this check to pass.

Once linked, this check will pass automatically on your next push or when you re-run the workflow.

Thanks for helping maintainers! 🙌

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 6, 2026

🚫 Missing Linked Issue

Hi 👋 This pull request does not appear to be linked to any open issue yet.

Linking your PR to an issue helps keep the project tidy and ensures the issue is closed automatically.

✔️ How to fix this

  • Add a keyword like Fixes #123 or Closes #456 to your PR description or a commit message.
  • Or link it manually using the "Linked issues" panel in the PR sidebar.

Tip: You can link multiple issues.
🚫 Note: If only one issue is linked, it must be open for this check to pass.

Once linked, this check will pass automatically on your next push or when you re-run the workflow.

Thanks for helping maintainers! 🙌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants