Skip to content

fix: a hell lot of kyc flow related issues#657

Merged
Hugo0 merged 8 commits intopeanut-walletfrom
fix/kyc-bugs
Feb 5, 2025
Merged

fix: a hell lot of kyc flow related issues#657
Hugo0 merged 8 commits intopeanut-walletfrom
fix/kyc-bugs

Conversation

@kushagrasarathe
Copy link
Contributor

@kushagrasarathe kushagrasarathe commented Jan 31, 2025

  • fixes TASK-6563 : where clicking done would not do anything inside the iframe, now closes modal
  • fixes TASK-8618 : where kyc status badge was incorrect on user profile header
  • fixes TASK-8553 : where cashout success message appeared twice & wasn't responsive on mobile devices
  • fixes TASK-8617 : kyc responsiveness issues
  • fixes TASK-7606 : kyc modal responsiveness issue with cta
  • fixes TASK-7605 : closes parent task for kyc related issues

Summary by CodeRabbit

  • New Features

    • Modal now auto-closes when an action completes inside embedded content.
    • The KYC process now provides near-real-time status feedback and streamlined steps, with clearer messaging regarding progress.
    • The user profile displays distinct, color-coded badges corresponding to the updated KYC status.
  • Style

    • Enhanced layout and spacing adjustments improve responsiveness across devices.
    • Updated visual elements ensure a more consistent and accessible user interface.

@vercel
Copy link

vercel bot commented Jan 31, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
peanut-ui ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 3, 2025 3:57pm

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 31, 2025

Walkthrough

This pull request introduces several UI and control flow improvements. The IframeWrapper now listens for iframe messages to close the modal upon receiving a 'complete' event, and its KYC polling interval was shortened. The GlobalKYCComponent replaces standard HTML buttons with Chakra UI components, removes redundant state, and refines confirmation messaging. Other components, including LinkAccountComponent, UpdateUserComponent, OfframpSuccessView, and ProfileSection, received layout and styling adjustments to enhance responsiveness and clarity in their displays.

Changes

File(s) Change Summary
src/.../IframeWrapper/index.tsx Added a useEffect hook to listen for iframe messages that trigger onClose when a 'complete' event is received; updated polling interval from 3s to 1.5s; changed container overflow styling.
src/.../KYCComponent/index.tsx Replaced HTML buttons with Chakra UI Button; removed unused userState; streamlined rendering logic and confirmation messages; updated step mapping for improved accessibility.
src/.../LinkAccountComponent/index.tsx Modified layout classes for postal code and country inputs to use a responsive flex layout (column on small screens, row on medium+ screens); adjusted padding for device-specific spacing.
src/.../UpdateUserComponent/index.tsx Replaced the standard HTML button with a Button component configured with variant and size; revised error handling to specifically check for "User already exists".
src/.../Success.view.tsx Replaced multiple plain label elements with a structured Card.Title and Card.Description format for displaying fund status messages.
src/.../ProfileSection.tsx Updated conditional rendering for the KYC badge to display a green "KYC Done" badge when approved and a purple "No KYC" badge otherwise.

Sequence Diagram(s)

sequenceDiagram
    participant Iframe
    participant IframeWrapper
    participant Modal
    Iframe->>IframeWrapper: Send message {name: "complete", metadata: {status: "completed"}}
    IframeWrapper->>Modal: Invoke onClose() to close modal
Loading

Possibly related PRs

Suggested reviewers

  • jjramirezn

Poem

I'm a bunny with code to share,
Hopping through changes with nimble care.
I listen to iframes with eager art,
Buttons and badges now play their part.
With a hop and a skip, my code leaps high,
Celebrating updates beneath a clear blue sky.
🐇✨


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@notion-workspace
Copy link

@notion-workspace
Copy link

@notion-workspace
Copy link

@notion-workspace
Copy link

@notion-workspace
Copy link

@notion-workspace
Copy link

KYC Bugs

@kushagrasarathe kushagrasarathe marked this pull request as ready for review February 3, 2025 15:53
@kushagrasarathe kushagrasarathe changed the title [WIP] fix: kyc inconsistencies on peanut wallet fix: a hell lot of kyc flow related issues Feb 3, 2025
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
src/components/Global/IframeWrapper/index.tsx (1)

119-120: Consider the performance impact of increased polling frequency.

Reducing the polling interval from 3s to 1.5s improves responsiveness but may increase server load. Consider implementing exponential backoff or websockets for a more scalable solution.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between cd9af54 and e10cdc7.

📒 Files selected for processing (6)
  • src/components/Global/IframeWrapper/index.tsx (4 hunks)
  • src/components/Global/KYCComponent/index.tsx (7 hunks)
  • src/components/Global/LinkAccountComponent/index.tsx (2 hunks)
  • src/components/Global/UpdateUserComponent/index.tsx (2 hunks)
  • src/components/Offramp/Success.view.tsx (0 hunks)
  • src/components/Profile/Components/ProfileSection.tsx (1 hunks)
💤 Files with no reviewable changes (1)
  • src/components/Offramp/Success.view.tsx
✅ Files skipped from review due to trivial changes (1)
  • src/components/Global/LinkAccountComponent/index.tsx
🔇 Additional comments (6)
src/components/Profile/Components/ProfileSection.tsx (1)

32-40: LGTM! Improved KYC status visibility.

The updated conditional rendering provides clearer differentiation between approved and non-approved KYC statuses through distinct badge colors and text.

src/components/Global/UpdateUserComponent/index.tsx (1)

119-127: LGTM! Enhanced UI consistency.

The switch to Bruddle's Button component improves visual consistency across the application.

src/components/Global/IframeWrapper/index.tsx (1)

35-45: LGTM! Enhanced iframe interaction.

Added message event listener improves modal closure handling upon completion.

src/components/Global/KYCComponent/index.tsx (3)

228-228: LGTM! Improved user communication.

The updated message "Your KYC progress might be lost" is more accurate than the previous definitive statement.


409-415: LGTM! Enhanced accessibility.

Wrapping step labels in label elements improves screen reader compatibility.


382-389: LGTM! Improved UI consistency.

The switch to Bruddle Card components with consistent styling enhances the visual hierarchy.

Copy link
Contributor

@Hugo0 Hugo0 left a comment

Choose a reason for hiding this comment

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

nice pr name

Copy link
Contributor

@Hugo0 Hugo0 left a comment

Choose a reason for hiding this comment

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

Nice! Everything relatively straightforward fixes, no issues on myend

Comment on lines 34 to +42

// track completed event from iframe and close the modal
useEffect(() => {
const handleMessage = (event: MessageEvent) => {
if (event.data?.name === 'complete' && event.data?.metadata?.status === 'completed') {
onClose()
}
}

Copy link
Contributor

Choose a reason for hiding this comment

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

yessss nice!

is the eventname literally just called complete?

src: kyclink,
visible: true,
closeConfirmMessage: 'Are you sure? Your KYC progress will be lost.',
closeConfirmMessage: 'Are you sure? Your KYC progress might be lost.',
Copy link
Contributor

Choose a reason for hiding this comment

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

isn't it 100% sure that it will be lost now? Since we're listening for the completion event

(but the copy is still good in that case)

{errors.email && <span className="text-start text-h9 font-normal text-red">{errors.email.message}</span>}

<button type="submit" className="btn btn-purple h-8 w-full text-h8" disabled={isLoading}>
<Button type="submit" variant="purple" size="small" disabled={isLoading}>
Copy link
Contributor

Choose a reason for hiding this comment

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

Upvote

Comment on lines +32 to +37
{user?.user.kycStatus === 'approved' ? (
<Badge color="green" className="rounded-sm border-success-1 bg-white text-success-1">
KYC Done
</Badge>
) : (
<Badge color="purple" className="rounded-sm border-primary-1 bg-white text-primary-1">
Copy link
Contributor

Choose a reason for hiding this comment

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

good! idk why we had it like that before

@Hugo0 Hugo0 merged commit fa4f614 into peanut-wallet Feb 5, 2025
4 checks passed
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.

2 participants