Skip to content

Conversation

@jnsdls
Copy link
Member

@jnsdls jnsdls commented Oct 30, 2025

TL;DR

Refactored the Buy Widget component to handle success URL redirection internally rather than in the parent component.

What changed?

  • Modified the StyledBuyWidget component to accept a successUrl prop instead of callback handlers
  • Moved the success URL redirection logic from the PayPage component into the StyledBuyWidget component
  • Updated the type definition of StyledBuyWidget props to exclude onSuccess, onError, and onCancel from the base props and add the new successUrl prop

How to test?

  1. Navigate to the Pay page with a success URL parameter
  2. Complete a transaction using the Buy Widget
  3. Verify you are redirected to the success URL with the success=true parameter appended

Why make this change?

This change improves component encapsulation by moving the redirection logic into the widget itself, making the parent component cleaner and the widget more self-contained. It also ensures consistent handling of success redirects across all implementations of the Buy Widget.

Summary by CodeRabbit

  • Refactor
    • Consolidated payment success redirect handling within the buy widget component, enabling simpler post-purchase navigation configuration and improving the completion flow reliability.

@vercel
Copy link

vercel bot commented Oct 30, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
thirdweb-www Ready Ready Preview Comment Oct 30, 2025 9:41pm
4 Skipped Deployments
Project Deployment Preview Comments Updated (UTC)
docs-v2 Skipped Skipped Oct 30, 2025 9:41pm
nebula Skipped Skipped Oct 30, 2025 9:41pm
thirdweb_playground Skipped Skipped Oct 30, 2025 9:41pm
wallet-ui Skipped Skipped Oct 30, 2025 9:41pm

@changeset-bot
Copy link

changeset-bot bot commented Oct 30, 2025

⚠️ No Changeset found

Latest commit: 1e8e1d9

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@vercel vercel bot temporarily deployed to Preview – nebula October 30, 2025 21:33 Inactive
@vercel vercel bot temporarily deployed to Preview – wallet-ui October 30, 2025 21:33 Inactive
@vercel vercel bot temporarily deployed to Preview – thirdweb_playground October 30, 2025 21:33 Inactive
@vercel vercel bot temporarily deployed to Preview – docs-v2 October 30, 2025 21:33 Inactive
@github-actions github-actions bot added the Dashboard Involves changes to the Dashboard. label Oct 30, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 30, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

The success URL redirect logic is being refactored from the PayPage component into the StyledBuyWidget component. StyledBuyWidget now accepts a successUrl prop and internally handles navigation with a success query parameter when the BuyWidget succeeds.

Changes

Cohort / File(s) Summary
Success URL redirect refactoring
apps/dashboard/src/app/pay/landing/styled-buy-widget.tsx
Updated component props signature to omit onSuccess, onError, onCancel handlers from BuyWidgetProps and add optional successUrl?: string field. Implemented internal onSuccess handler that navigates to successUrl with success=true query parameter on success.
Success URL prop delegation
apps/dashboard/src/app/pay/page.tsx
Removed inline onSuccess callback logic and now passes successUrl directly as a prop to StyledBuyWidget.

Sequence Diagram(s)

sequenceDiagram
    participant PayPage
    participant StyledBuyWidget
    participant BuyWidget
    participant Browser

    Note over PayPage,Browser: Before: Redirect logic in PayPage
    PayPage->>StyledBuyWidget: onSuccess callback handler
    StyledBuyWidget->>BuyWidget: passes onSuccess callback
    BuyWidget->>StyledBuyWidget: trigger onSuccess
    StyledBuyWidget->>Browser: navigate to successUrl + query param

    Note over PayPage,Browser: After: Redirect logic in StyledBuyWidget
    PayPage->>StyledBuyWidget: successUrl prop
    StyledBuyWidget->>BuyWidget: internal onSuccess handler
    BuyWidget->>StyledBuyWidget: success event
    StyledBuyWidget->>Browser: navigate to successUrl + query param
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

  • Straightforward refactoring: redirect logic moved between two closely related components without algorithmic complexity
  • Prop signature changes are clear and consistent
  • URL construction logic remains unchanged, only relocated
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch Move_success_URL_handling_from_PayPage_to_StyledBuyWidget_component

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between b88f75b and 1e8e1d9.

📒 Files selected for processing (2)
  • apps/dashboard/src/app/pay/landing/styled-buy-widget.tsx (2 hunks)
  • apps/dashboard/src/app/pay/page.tsx (1 hunks)

Comment @coderabbitai help to get the list of available commands and usage tips.

@jnsdls jnsdls marked this pull request as ready for review October 30, 2025 21:34
@jnsdls jnsdls requested review from a team as code owners October 30, 2025 21:34
@jnsdls jnsdls merged commit 8ef418c into main Oct 30, 2025
20 of 22 checks passed
@jnsdls jnsdls deleted the Move_success_URL_handling_from_PayPage_to_StyledBuyWidget_component branch October 30, 2025 21:35
@codecov
Copy link

codecov bot commented Oct 30, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 54.87%. Comparing base (b88f75b) to head (1e8e1d9).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #8342   +/-   ##
=======================================
  Coverage   54.87%   54.87%           
=======================================
  Files         919      919           
  Lines       60653    60653           
  Branches     4117     4117           
=======================================
  Hits        33283    33283           
  Misses      27268    27268           
  Partials      102      102           
Flag Coverage Δ
packages 54.87% <ø> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Member Author

jnsdls commented Oct 30, 2025


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • merge-queue - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@github-actions
Copy link
Contributor

github-actions bot commented Oct 30, 2025

size-limit report 📦

Path Size
@thirdweb-dev/nexus (esm) 104.88 KB (0%)
@thirdweb-dev/nexus (cjs) 316.6 KB (0%)

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

Labels

Dashboard Involves changes to the Dashboard.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants