Skip to content

feat: add useCardForm() hook with tokenization and 3DS (ACC-6925)#346

Draft
OnurVar wants to merge 1 commit intoov/feat/ACC-6492from
ov/feat/ACC-6925
Draft

feat: add useCardForm() hook with tokenization and 3DS (ACC-6925)#346
OnurVar wants to merge 1 commit intoov/feat/ACC-6492from
ov/feat/ACC-6925

Conversation

@OnurVar
Copy link
Copy Markdown
Contributor

@OnurVar OnurVar commented Apr 14, 2026

Summary

  • Add useCardForm() hook that wraps RawDataManager to provide managed card form state, auto-formatting, touch-based validation, debounced native sync, BIN detection, and guarded submit for tokenization/3DS
  • Add useRawDataManagerBridge internal hook managing RawDataManager lifecycle, event subscription, and cleanup
  • Add CardFormTypes with UseCardFormOptions, UseCardFormReturn, CardFormErrors, CardFormField
  • Add debounce utility in src/utils/debounce.ts
  • Export useCardForm and types from package root

Jira

ACC-6925

Test plan

  • npm run lint — clean
  • npm test — 32/32 tests pass
  • npx tsc --noEmit — no TypeScript errors
  • Manual: verify hook initializes RawDataManager when SDK is ready
  • Manual: verify card number auto-formats with spaces
  • Manual: verify expiry auto-formats as MM/YY
  • Manual: verify validation errors surface only for touched fields
  • Manual: verify submit is no-op when form is invalid

@OnurVar OnurVar requested a review from a team as a code owner April 14, 2026 23:23
@OnurVar OnurVar marked this pull request as draft April 14, 2026 23:23
@OnurVar OnurVar self-assigned this Apr 14, 2026
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 14, 2026

Warnings
⚠️ This PR doesn't seem to contain any updated Unit Test for Swift 🤔. Please consider double checking it 🙏
Messages
📖 ✅ No SwiftLint violations found.

Generated by 🚫 Danger Swift against d6c9c11

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 14, 2026

Warnings
⚠️ This PR doesn't seem to contain any updated Unit Test for Kotlin 🤔. Please consider double checking it 🙏
Messages
📖 ✅ No detekt violations found.

Generated by 🚫 Danger Kotlin against d6c9c11

Copy link
Copy Markdown

@unblocked unblocked Bot left a comment

Choose a reason for hiding this comment

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

4 issues found.

About Unblocked

Unblocked has been set up to automatically review your team's pull requests to identify genuine bugs and issues.

📖 Documentation — Learn more in our docs.

💬 Ask questions — Mention @unblocked to request a review or summary, or ask follow-up questions about your code.

👍 Give feedback — React to comments with 👍 or 👎 to help us improve.

⚙️ Customize — Adjust settings in your preferences.

Comment thread src/utils/debounce.ts Outdated
Comment thread src/Components/hooks/useCardForm.ts Outdated
Comment thread src/Components/hooks/useCardForm.ts Outdated
Comment thread src/Components/hooks/useCardForm.ts Outdated
@github-actions
Copy link
Copy Markdown

Appetize Android link: https://appetize.io/app/iuefsgpuqgjtcbcbyy6tqrvybi

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 14, 2026

Appetize iOS link: https://appetize.io/app/ky32djjab7giv4h7llx3bnjiwi

@OnurVar OnurVar force-pushed the ov/feat/ACC-6492 branch 2 times, most recently from 2ad0a1c to 70bbf52 Compare April 15, 2026 23:39
setIsInitialized(true);
} catch (err) {
if (!cancelled) {
console.error('[useRawDataManagerBridge] init failed:', err);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

How confident are we that the sensitive card info cant be emitted here? Passing the whole error gives me pause, in case the err might contain the raw input there could be potential to leak the PAN/CVV?

@OnurVar OnurVar force-pushed the ov/feat/ACC-6925 branch 2 times, most recently from 234f02d to d6c9c11 Compare April 20, 2026 10:45
@github-actions
Copy link
Copy Markdown

Warnings
⚠️ PR is classed as Work in Progress
Messages
📖 ✅ No ESLint violations found.

Generated by 🚫 dangerJS against d6c9c11

@OnurVar OnurVar force-pushed the ov/feat/ACC-6925 branch 2 times, most recently from 83e7493 to 6cb3a53 Compare April 21, 2026 01:18
@OnurVar OnurVar force-pushed the ov/feat/ACC-6492 branch 3 times, most recently from 05e7ea6 to 3d72c17 Compare April 23, 2026 16:06
…925)

Backs the card form with a provider-managed raw-data lifecycle on
PrimerCheckoutProvider (activeMethod, cardFormState, setRawData, submit,
retry, clearPaymentOutcome, paymentOutcome, settings). The hook forwards
field updates to the provider and surfaces validation state without
owning the native manager, so the manager survives nav transitions.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants