Skip to content

Conversation

@MananTank
Copy link
Member

@MananTank MananTank commented Oct 1, 2025


PR-Codex overview

This PR primarily focuses on refactoring and enhancing the payment and transaction handling components in the thirdweb library. It introduces new types, improves existing interfaces, and modifies various components to better handle payment methods and UI states.

Detailed summary

  • Deleted unused files related to paymentMachine and related stories.
  • Added currency prop to TransactionModal.
  • Updated UnsupportedTokenScreenProps to enforce required properties.
  • Refined DepositScreen by removing the onBack prop.
  • Changed StepRunnerProps to require properties instead of optional.
  • Modified PaymentSelectionProps to enforce required fields.
  • Enhanced TransactionModal to manage deposit flow better.
  • Introduced new story variants for TransactionWidget and CheckoutWidget.
  • Updated SuccessScreen to handle payment ID states.
  • Refactored FundWallet and TransactionPayment to include metadata and currency props.

The following files were skipped due to too many changes: packages/thirdweb/src/stories/Bridge/CheckoutWidget.stories.tsx, packages/thirdweb/src/stories/Bridge/PaymentSelection.stories.tsx, packages/thirdweb/src/stories/Bridge/fixtures.ts, packages/thirdweb/src/react/web/ui/Bridge/payment-details/PaymentOverview.tsx, packages/thirdweb/src/stories/Bridge/PaymentDetails.stories.tsx, packages/thirdweb/src/react/web/ui/Bridge/TransactionWidget.tsx, packages/thirdweb/src/react/web/ui/Bridge/BuyWidget.tsx, packages/thirdweb/src/react/web/ui/Bridge/CheckoutWidget.tsx

✨ Ask PR-Codex anything about this PR by commenting with /codex {your question}

Summary by CodeRabbit

  • New Features

    • Optional fiat currency display across payment & transaction modals (defaults to USD).
    • Token support detection with an unsupported-token screen.
  • Refactor

    • Bridge flows reorganized into modular multi-step UIs (selection, quote, preview, execute, success).
    • Components now accept explicit metadata (title/description/image) and explicit currency/mode props; centralized branding handling.
  • Documentation

    • Storybook reorganized with decorator-based theming, updated/added widget stories, and cleaned story exports.

@MananTank MananTank requested review from a team as code owners October 1, 2025 21:31
@changeset-bot
Copy link

changeset-bot bot commented Oct 1, 2025

⚠️ No Changeset found

Latest commit: ef9cf34

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
Copy link

vercel bot commented Oct 1, 2025

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

Project Deployment Preview Comments Updated (UTC)
docs-v2 Ready Ready Preview Comment Oct 3, 2025 4:06pm
nebula Ready Ready Preview Comment Oct 3, 2025 4:06pm
thirdweb_playground Ready Ready Preview Comment Oct 3, 2025 4:06pm
thirdweb-www Ready Ready Preview Comment Oct 3, 2025 4:06pm
wallet-ui Ready Ready Preview Comment Oct 3, 2025 4:06pm

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 1, 2025

Walkthrough

Removes paymentMachine and BridgeOrchestrator; refactors bridge UIs into container/content multi-screen flows; replaces uiOptions with explicit props (currency, metadata, paymentInfo/transaction/destinationToken); adds useTokenQuery and bridge UI types; updates hooks, component prop signatures, Storybook stories, and tests.

Changes

Cohort / File(s) Summary of changes
Core Hooks: Send Transaction Currency
packages/thirdweb/src/react/core/hooks/transaction/useSendTransaction.ts, packages/thirdweb/src/react/web/hooks/transaction/useSendTransaction.tsx
Added optional currency?: SupportedFiatCurrency to modal config and passed it into TransactionModal; added SupportedFiatCurrency imports.
Payment Machine Removal
packages/thirdweb/src/react/core/machines/paymentMachine.ts, packages/thirdweb/src/react/core/machines/paymentMachine.test.ts
Deleted paymentMachine implementation, its types (PaymentMode, PaymentMethod, PaymentMachineContext, events/states) and the associated test suite.
Bridge Orchestrator Removal
packages/thirdweb/src/react/web/ui/Bridge/BridgeOrchestrator.tsx, packages/thirdweb/src/stories/Bridge/BridgeOrchestrator.stories.tsx
Removed BridgeOrchestrator component, its public types (UIOptions, props) and its Storybook stories.
Widget Container/Content Rewrites
packages/thirdweb/src/react/web/ui/Bridge/BuyWidget.tsx, packages/thirdweb/src/react/web/ui/Bridge/CheckoutWidget.tsx, packages/thirdweb/src/react/web/ui/Bridge/TransactionWidget.tsx, packages/thirdweb/src/react/web/ui/Bridge/swap-widget/SwapWidget.tsx
Rewrote widgets into container/content multi-screen flows; token/transaction-centric queries; explicit currency/metadata propagation; new wrapper/content components; removed/changed presetOptions.
Transaction Modal & Deposit Flow
packages/thirdweb/src/react/web/ui/TransactionButton/TransactionModal.tsx, packages/thirdweb/src/react/web/ui/TransactionButton/DepositScreen.tsx
Replaced orchestrator usage with DepositAndExecuteTx and TransactionWidgetContentWrapper; added currency to ModalProps; removed onBack from DepositScreen.
Bridge UI Components: Props Refactors
packages/thirdweb/src/react/web/ui/Bridge/DirectPayment.tsx, packages/thirdweb/src/react/web/ui/Bridge/FundWallet.tsx, packages/thirdweb/src/react/web/ui/Bridge/TransactionPayment.tsx, packages/thirdweb/src/react/web/ui/Bridge/common/WithHeader.tsx
Removed uiOptions indirection; introduced explicit props (currency, metadata, paymentInfo/transaction/destinationToken, buttonLabel); converted several exported interfaces to type aliases and updated signatures/imports.
StepRunner, QuoteLoader, PaymentDetails, PaymentOverview
packages/thirdweb/src/react/web/ui/Bridge/StepRunner.tsx, packages/thirdweb/src/react/web/ui/Bridge/QuoteLoader.tsx, packages/thirdweb/src/react/web/ui/Bridge/payment-details/PaymentDetails.tsx, packages/thirdweb/src/react/web/ui/Bridge/payment-details/PaymentOverview.tsx
Expanded/changed prop shapes (added client, windowAdapter, feePayer, mode, autoStart, onComplete); removed uiOptions; updated signatures to explicit currency, metadata, modeInfo, and transaction types.
Payment Selection & Token Selection
packages/thirdweb/src/react/web/ui/Bridge/payment-selection/PaymentSelection.tsx, packages/thirdweb/src/react/web/ui/Bridge/payment-selection/TokenSelection.tsx
Converted exported interface to internal type; made receiverAddress, onBack, paymentMethods, currency more explicit/required; added destinationToken/destinationAmount; removed includeDestinationToken; updated PaymentMethod import path.
Success / Unsupported / Quote UI
packages/thirdweb/src/react/web/ui/Bridge/payment-success/SuccessScreen.tsx, packages/thirdweb/src/react/web/ui/Bridge/UnsupportedTokenScreen.tsx, packages/thirdweb/src/react/web/ui/Bridge/QuoteLoader.tsx
Replaced exported interfaces with internal types; altered prop shapes (e.g., showContinueWithTx, required hasPaymentId, required tokenAddress); removed uiOptions usage; added feePayer/mode handling.
Bridge Common: Token Query & Types
packages/thirdweb/src/react/web/ui/Bridge/common/token-query.ts, packages/thirdweb/src/react/web/ui/Bridge/types.ts
Added useTokenQuery hook (handles unsupported tokens and stable queryKey); added new exported types DirectPaymentInfo, ModeInfo, PaymentMethod, RequiredParams.
Payment Overview & Details Prop Migration
packages/thirdweb/src/react/web/ui/Bridge/payment-details/PaymentDetails.tsx, packages/thirdweb/src/react/web/ui/Bridge/payment-details/PaymentOverview.tsx
Replaced uiOptions with explicit metadata, currency, modeInfo; updated internal subcomponent prop passing and transaction overview types.
Stories: Refactors, Additions & Theming
packages/thirdweb/src/stories/Bridge/*, packages/thirdweb/src/stories/Bridge/fixtures.ts, packages/thirdweb/src/stories/utils.tsx, many story files added/removed/updated
Removed many theme-wrapper components; switched to decorator-based ModalThemeWrapper (now renders both dark & light); updated stories to new prop shapes (currency, metadata, modeInfo); added some new stories and removed obsolete ones; updated fixtures to explicit UI shapes; changed ModalThemeWrapper signature.
Misc Hooks & UI Tweaks
packages/thirdweb/src/react/core/hooks/usePaymentMethods.ts, packages/thirdweb/src/react/web/ui/Bridge/payment-selection/TokenSelection.tsx, apps/playground-web/src/app/payments/components/RightSection.tsx
Changed PaymentMethod import path to bridge types; removed includeDestinationToken option from usePaymentMethods and consumers; removed presetOptions usage from CheckoutWidget call.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor User
  participant Widget as TransactionWidgetContent
  participant Sel as PaymentSelection
  participant Quote as QuoteLoader
  participant Prev as PaymentDetails
  participant Exec as StepRunner
  participant Tx as TransactionPayment
  participant Succ as SuccessScreen
  Note over Widget: init-ui
  User->>Widget: Open widget
  Widget->>Sel: Render methodSelection
  Sel-->>Widget: onPaymentMethodSelected(method)
  Widget->>Quote: Render load-quote
  Quote-->>Widget: onQuoteReceived(quote)
  Widget->>Prev: Render preview
  Prev-->>Widget: onConfirm()
  alt buy flow
    Widget->>Exec: execute-buy
    Exec-->>Widget: onComplete(statuses)
    Widget->>Succ: success
    Succ-->>Widget: onDone()
  else direct tx
    Widget->>Tx: execute-tx
    Tx-->>Widget: onExecuteTransaction()
    Widget->>Succ: success
    Succ-->>Widget: onDone()
  end
  Widget-->>User: Close/Callback
Loading
sequenceDiagram
  autonumber
  actor User
  participant Modal as TransactionModal
  participant Dep as DepositAndExecuteTx
  participant Wrap as TransactionWidgetContentWrapper
  alt requires deposit
    User->>Modal: Open (transaction)
    Modal->>Dep: Show deposit flow
    Dep-->>Modal: deposit complete → execute
    Modal->>Dep: Render ExecutingTxScreen
    Dep-->>Modal: tx result
  else no deposit
    User->>Modal: Open (transaction)
    Modal->>Wrap: Delegate to multi-step flow
    Wrap-->>Modal: onTxSent(data)
  end
  Modal-->>User: onTxSent/onClose
Loading

Estimated code review effort

🎯 5 (Critical) | ⏱️ ~120 minutes

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Description Check ⚠️ Warning The pull request description only includes the template comments and contains no actual content under the required sections such as a concise title, notes for the reviewer, or testing instructions. Please replace the template comments with the actual PR description by providing a formatted title, any important notes for reviewers, and detailed instructions for how to test these changes.
Docstring Coverage ⚠️ Warning Docstring coverage is 24.39% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (1 passed)
Check name Status Explanation
Title Check ✅ Passed The title clearly describes the two primary changes in this pull request—removing the Bridge Orchestrator and refactoring the Bridge widget components—which accurately reflects the main focus of the changeset.
✨ 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 pay-widget-refactor

Warning

Review ran into problems

🔥 Problems

Errors were encountered while retrieving linked issues.

Errors (1)
  • TEAM-0000: Entity not found: Issue - Could not find referenced Issue.

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

@graphite-app
Copy link
Contributor

graphite-app bot commented Oct 1, 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.

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: 9

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (8)
packages/thirdweb/src/react/web/ui/Bridge/UnsupportedTokenScreen.tsx (1)

30-40: Include token & chain in the query key.

useQuery caches by queryKey. With a constant key, switching to a different token (or chain) without unmounting keeps using the cached observer, so this analytics event never re-runs and the new token isn’t tracked. Add the dynamic props to the key so React Query treats each combination separately. (tanstack.dev)

   useQuery({
     queryFn: () => {
       trackPayEvent({
         chainId: chain.id,
         client,
         event: "ub:ui:unsupported_token",
         fromToken: tokenAddress,
       });
     },
-    queryKey: ["unsupported_token"],
+    queryKey: ["unsupported_token", chain.id, tokenAddress],
   });
packages/thirdweb/src/react/web/ui/TransactionButton/TransactionModal.tsx (1)

135-138: Pass onComplete through the deposit flow

The execute-after-deposit path equally skips onComplete. Wrap the callback you hand to ExecutingTxScreen so the modal reports completion consistently.

       <ExecutingTxScreen
         closeModal={props.onClose}
-        onTxSent={props.onTxSent}
+        onTxSent={(data) => {
+          props.onTxSent(data);
+          props.onComplete();
+        }}
         tx={props.tx}
         windowAdapter={webWindowAdapter}
       />
packages/thirdweb/src/react/web/ui/Bridge/payment-success/SuccessScreen.tsx (1)

18-49: Type/default parameter mismatch.

The type declares hasPaymentId: boolean (required), but line 59 provides a default value hasPaymentId = false. This creates an inconsistency: the type says the prop is required, but the implementation allows it to be omitted.

Apply this diff to make the type match the implementation:

   /**
    * Whether or not this payment is associated with a payment ID. If it does, we show a different message.
    */
-  hasPaymentId: boolean;
+  hasPaymentId?: boolean;
 };
packages/thirdweb/src/react/web/ui/Bridge/QuoteLoader.tsx (1)

40-80: Restore optional prop signatures

sender, onBack, purchaseData, paymentLinkId, and the new feePayer prop are declared as prop: T | undefined. That makes each prop required (consumers must now pass undefined explicitly) even though they were previously optional. This is a breaking API change for anyone using QuoteLoader internally or externally. Please switch these back to optional properties (prop?: T) so existing call sites continue to compile.

-  sender: string | undefined;
+  sender?: string;-  onBack: (() => void) | undefined;
+  onBack?: () => void;-  purchaseData: PurchaseData | undefined;
+  purchaseData?: PurchaseData;-  paymentLinkId: string | undefined;
+  paymentLinkId?: string;-  feePayer: "sender" | "receiver" | undefined;
+  feePayer?: "sender" | "receiver";
packages/thirdweb/src/react/web/ui/Bridge/StepRunner.tsx (1)

30-73: Keep optional StepRunner props optional

title, wallet, onCancel, and onBack now use prop: T | undefined, which forces callers to provide these props explicitly (even when intentionally omitted). They used to be optional, so this silently breaks every existing usage site. Please revert them to optional properties (prop?: T) to preserve the component’s public API.

-type StepRunnerProps = {
-  title: string | undefined;
+type StepRunnerProps = {
+  title?: string;-  wallet: Wallet | undefined;
+  wallet?: Wallet;-  onCancel: (() => void) | undefined;
+  onCancel?: () => void;-  onBack: (() => void) | undefined;
+  onBack?: () => void;
packages/thirdweb/src/react/web/ui/Bridge/FundWallet.tsx (1)

150-161: Don't hardcode USD on quick-buy buttons

Now that we expose currency, the quick amount experience must display the selected fiat. The handler still assumes USD (usdAmount param) and the buttons render $${amount}, so if currency === "EUR" the UI shows the wrong symbol and conversion text. Please base both the label and conversion math on the active currency (e.g. use formatCurrencyAmount(currency, fiatAmount) and fall back to USD only when no price exists), otherwise non-USD flows are misleading.

Apply this diff to fix the issue:

-  const handleQuickAmount = (usdAmount: number) => {
-    const price = destinationToken.prices[currency || "USD"] || 0;
+  const handleQuickAmount = (fiatAmount: number) => {
+    const price =
+      destinationToken.prices[currency] ??
+      destinationToken.prices["USD"] ??
+      0;
     if (price === 0) {
       return;
     }
     // Convert USD amount to token amount using token price
-    const tokenAmount = usdAmount / price;
+    const tokenAmount = fiatAmount / price;
@@
-              {presetOptions?.map((amount) => (
+              {presetOptions?.map((fiatAmount) => (
                 <Button
-                  key={amount}
-                  onClick={() => handleQuickAmount(Number(amount))}
+                  key={fiatAmount}
+                  onClick={() => handleQuickAmount(fiatAmount)}
@@
-                >
-                  ${amount}
+                >
+                  {formatCurrencyAmount(currency, fiatAmount)}
                 </Button>
               ))}

Also applies to: 285-299

packages/thirdweb/src/react/web/ui/Bridge/payment-selection/PaymentSelection.tsx (1)

164-168: Honor explicit includeDestinationToken=false.

Swapping to || makes an explicit includeDestinationToken of false behave as though it were true whenever the receiver differs from the payer. That regresses the opt-out behavior; respect consumer intent by falling back only when the prop is undefined.

-    includeDestinationToken:
-      includeDestinationToken ||
-      receiverAddress?.toLowerCase() !==
-        payerWallet?.getAccount()?.address?.toLowerCase(),
+    includeDestinationToken:
+      includeDestinationToken ??
+      receiverAddress?.toLowerCase() !==
+        payerWallet?.getAccount()?.address?.toLowerCase(),
packages/thirdweb/src/react/web/ui/Bridge/TransactionWidget.tsx (1)

369-400: Handle locale fetch failures instead of hanging the UI.

When useConnectLocale rejects, localQuery.data stays undefined while isPending is false, so the current if (tokenQuery.isPending || !localQuery.data) branch renders the loading spinner forever. Users never see an error or a retry path. Please add an error branch (similar to the token query handling) so locale fetch failures surface a message and recovery option.

🧹 Nitpick comments (1)
packages/thirdweb/src/react/core/hooks/usePaymentMethods.ts (1)

14-15: Resolve the unused includeDestinationToken flag

The flag still never influences the fetch logic; only the cache key sees it. Either wire it into the query or drop the option so consumers aren't misled.

📜 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 e11b0da and 013cf42.

📒 Files selected for processing (35)
  • packages/thirdweb/src/react/core/hooks/transaction/useSendTransaction.ts (2 hunks)
  • packages/thirdweb/src/react/core/hooks/usePaymentMethods.ts (1 hunks)
  • packages/thirdweb/src/react/web/hooks/transaction/useSendTransaction.tsx (1 hunks)
  • packages/thirdweb/src/react/web/ui/Bridge/BridgeOrchestrator.tsx (0 hunks)
  • packages/thirdweb/src/react/web/ui/Bridge/BuyWidget.tsx (4 hunks)
  • packages/thirdweb/src/react/web/ui/Bridge/CheckoutWidget.tsx (5 hunks)
  • packages/thirdweb/src/react/web/ui/Bridge/DirectPayment.tsx (5 hunks)
  • packages/thirdweb/src/react/web/ui/Bridge/FundWallet.tsx (9 hunks)
  • packages/thirdweb/src/react/web/ui/Bridge/QuoteLoader.tsx (3 hunks)
  • packages/thirdweb/src/react/web/ui/Bridge/StepRunner.tsx (3 hunks)
  • packages/thirdweb/src/react/web/ui/Bridge/TransactionPayment.tsx (9 hunks)
  • packages/thirdweb/src/react/web/ui/Bridge/TransactionWidget.tsx (7 hunks)
  • packages/thirdweb/src/react/web/ui/Bridge/UnsupportedTokenScreen.tsx (1 hunks)
  • packages/thirdweb/src/react/web/ui/Bridge/common/WithHeader.tsx (2 hunks)
  • packages/thirdweb/src/react/web/ui/Bridge/common/token-query.ts (1 hunks)
  • packages/thirdweb/src/react/web/ui/Bridge/payment-details/PaymentDetails.tsx (5 hunks)
  • packages/thirdweb/src/react/web/ui/Bridge/payment-details/PaymentOverview.tsx (11 hunks)
  • packages/thirdweb/src/react/web/ui/Bridge/payment-selection/PaymentSelection.tsx (5 hunks)
  • packages/thirdweb/src/react/web/ui/Bridge/payment-success/SuccessScreen.tsx (4 hunks)
  • packages/thirdweb/src/react/web/ui/Bridge/swap-widget/SwapWidget.tsx (6 hunks)
  • packages/thirdweb/src/react/web/ui/Bridge/types.ts (1 hunks)
  • packages/thirdweb/src/react/web/ui/TransactionButton/TransactionModal.tsx (5 hunks)
  • packages/thirdweb/src/stories/Bridge/BridgeOrchestrator.stories.tsx (0 hunks)
  • packages/thirdweb/src/stories/Bridge/CheckoutWidget.stories.tsx (1 hunks)
  • packages/thirdweb/src/stories/Bridge/DirectPayment.stories.tsx (1 hunks)
  • packages/thirdweb/src/stories/Bridge/ErrorBanner.stories.tsx (2 hunks)
  • packages/thirdweb/src/stories/Bridge/FundWallet.stories.tsx (1 hunks)
  • packages/thirdweb/src/stories/Bridge/PaymentDetails.stories.tsx (2 hunks)
  • packages/thirdweb/src/stories/Bridge/PaymentSelection.stories.tsx (1 hunks)
  • packages/thirdweb/src/stories/Bridge/StepRunner.stories.tsx (1 hunks)
  • packages/thirdweb/src/stories/Bridge/SuccessScreen.stories.tsx (2 hunks)
  • packages/thirdweb/src/stories/Bridge/TransactionPayment.stories.tsx (1 hunks)
  • packages/thirdweb/src/stories/Bridge/UnsupportedTokenScreen.stories.tsx (1 hunks)
  • packages/thirdweb/src/stories/Bridge/fixtures.ts (9 hunks)
  • packages/thirdweb/src/stories/utils.tsx (1 hunks)
💤 Files with no reviewable changes (2)
  • packages/thirdweb/src/stories/Bridge/BridgeOrchestrator.stories.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/BridgeOrchestrator.tsx
🧰 Additional context used
📓 Path-based instructions (5)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.{ts,tsx}: Write idiomatic TypeScript with explicit function declarations and return types
Limit each file to one stateless, single-responsibility function for clarity
Re-use shared types from @/types or local types.ts barrels
Prefer type aliases over interface except for nominal shapes
Avoid any and unknown unless unavoidable; narrow generics when possible
Choose composition over inheritance; leverage utility types (Partial, Pick, etc.)
Comment only ambiguous logic; avoid restating TypeScript in prose

**/*.{ts,tsx}: Use explicit function declarations and explicit return types in TypeScript
Limit each file to one stateless, single‑responsibility function
Re‑use shared types from @/types where applicable
Prefer type aliases over interface except for nominal shapes
Avoid any and unknown unless unavoidable; narrow generics when possible
Prefer composition over inheritance; use utility types (Partial, Pick, etc.)
Lazy‑import optional features and avoid top‑level side‑effects to reduce bundle size

Files:

  • packages/thirdweb/src/react/web/ui/Bridge/common/token-query.ts
  • packages/thirdweb/src/react/core/hooks/transaction/useSendTransaction.ts
  • packages/thirdweb/src/react/web/hooks/transaction/useSendTransaction.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/payment-details/PaymentOverview.tsx
  • packages/thirdweb/src/stories/Bridge/fixtures.ts
  • packages/thirdweb/src/react/core/hooks/usePaymentMethods.ts
  • packages/thirdweb/src/react/web/ui/Bridge/swap-widget/SwapWidget.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/DirectPayment.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/common/WithHeader.tsx
  • packages/thirdweb/src/stories/Bridge/CheckoutWidget.stories.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/types.ts
  • packages/thirdweb/src/react/web/ui/Bridge/payment-details/PaymentDetails.tsx
  • packages/thirdweb/src/stories/Bridge/FundWallet.stories.tsx
  • packages/thirdweb/src/react/web/ui/TransactionButton/TransactionModal.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/FundWallet.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/CheckoutWidget.tsx
  • packages/thirdweb/src/stories/Bridge/PaymentSelection.stories.tsx
  • packages/thirdweb/src/stories/Bridge/TransactionPayment.stories.tsx
  • packages/thirdweb/src/stories/Bridge/UnsupportedTokenScreen.stories.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/TransactionPayment.tsx
  • packages/thirdweb/src/stories/utils.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/payment-selection/PaymentSelection.tsx
  • packages/thirdweb/src/stories/Bridge/DirectPayment.stories.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/TransactionWidget.tsx
  • packages/thirdweb/src/stories/Bridge/ErrorBanner.stories.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/UnsupportedTokenScreen.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/BuyWidget.tsx
  • packages/thirdweb/src/stories/Bridge/StepRunner.stories.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/payment-success/SuccessScreen.tsx
  • packages/thirdweb/src/stories/Bridge/SuccessScreen.stories.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/StepRunner.tsx
  • packages/thirdweb/src/stories/Bridge/PaymentDetails.stories.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/QuoteLoader.tsx
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (CLAUDE.md)

Load heavy dependencies inside async paths to keep initial bundle lean (lazy loading)

Files:

  • packages/thirdweb/src/react/web/ui/Bridge/common/token-query.ts
  • packages/thirdweb/src/react/core/hooks/transaction/useSendTransaction.ts
  • packages/thirdweb/src/react/web/hooks/transaction/useSendTransaction.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/payment-details/PaymentOverview.tsx
  • packages/thirdweb/src/stories/Bridge/fixtures.ts
  • packages/thirdweb/src/react/core/hooks/usePaymentMethods.ts
  • packages/thirdweb/src/react/web/ui/Bridge/swap-widget/SwapWidget.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/DirectPayment.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/common/WithHeader.tsx
  • packages/thirdweb/src/stories/Bridge/CheckoutWidget.stories.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/types.ts
  • packages/thirdweb/src/react/web/ui/Bridge/payment-details/PaymentDetails.tsx
  • packages/thirdweb/src/stories/Bridge/FundWallet.stories.tsx
  • packages/thirdweb/src/react/web/ui/TransactionButton/TransactionModal.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/FundWallet.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/CheckoutWidget.tsx
  • packages/thirdweb/src/stories/Bridge/PaymentSelection.stories.tsx
  • packages/thirdweb/src/stories/Bridge/TransactionPayment.stories.tsx
  • packages/thirdweb/src/stories/Bridge/UnsupportedTokenScreen.stories.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/TransactionPayment.tsx
  • packages/thirdweb/src/stories/utils.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/payment-selection/PaymentSelection.tsx
  • packages/thirdweb/src/stories/Bridge/DirectPayment.stories.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/TransactionWidget.tsx
  • packages/thirdweb/src/stories/Bridge/ErrorBanner.stories.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/UnsupportedTokenScreen.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/BuyWidget.tsx
  • packages/thirdweb/src/stories/Bridge/StepRunner.stories.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/payment-success/SuccessScreen.tsx
  • packages/thirdweb/src/stories/Bridge/SuccessScreen.stories.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/StepRunner.tsx
  • packages/thirdweb/src/stories/Bridge/PaymentDetails.stories.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/QuoteLoader.tsx
packages/thirdweb/**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

packages/thirdweb/**/*.{ts,tsx}: Every public symbol must have comprehensive TSDoc with at least one compiling @example and a custom tag (@beta, @internal, @experimental, etc.)
Comment only ambiguous logic; avoid restating TypeScript in prose
Lazy‑load heavy dependencies inside async paths (e.g., const { jsPDF } = await import("jspdf"))

Files:

  • packages/thirdweb/src/react/web/ui/Bridge/common/token-query.ts
  • packages/thirdweb/src/react/core/hooks/transaction/useSendTransaction.ts
  • packages/thirdweb/src/react/web/hooks/transaction/useSendTransaction.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/payment-details/PaymentOverview.tsx
  • packages/thirdweb/src/stories/Bridge/fixtures.ts
  • packages/thirdweb/src/react/core/hooks/usePaymentMethods.ts
  • packages/thirdweb/src/react/web/ui/Bridge/swap-widget/SwapWidget.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/DirectPayment.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/common/WithHeader.tsx
  • packages/thirdweb/src/stories/Bridge/CheckoutWidget.stories.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/types.ts
  • packages/thirdweb/src/react/web/ui/Bridge/payment-details/PaymentDetails.tsx
  • packages/thirdweb/src/stories/Bridge/FundWallet.stories.tsx
  • packages/thirdweb/src/react/web/ui/TransactionButton/TransactionModal.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/FundWallet.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/CheckoutWidget.tsx
  • packages/thirdweb/src/stories/Bridge/PaymentSelection.stories.tsx
  • packages/thirdweb/src/stories/Bridge/TransactionPayment.stories.tsx
  • packages/thirdweb/src/stories/Bridge/UnsupportedTokenScreen.stories.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/TransactionPayment.tsx
  • packages/thirdweb/src/stories/utils.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/payment-selection/PaymentSelection.tsx
  • packages/thirdweb/src/stories/Bridge/DirectPayment.stories.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/TransactionWidget.tsx
  • packages/thirdweb/src/stories/Bridge/ErrorBanner.stories.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/UnsupportedTokenScreen.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/BuyWidget.tsx
  • packages/thirdweb/src/stories/Bridge/StepRunner.stories.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/payment-success/SuccessScreen.tsx
  • packages/thirdweb/src/stories/Bridge/SuccessScreen.stories.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/StepRunner.tsx
  • packages/thirdweb/src/stories/Bridge/PaymentDetails.stories.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/QuoteLoader.tsx
**/*.stories.tsx

📄 CodeRabbit inference engine (CLAUDE.md)

For new UI components, add Storybook stories (*.stories.tsx) alongside the code

Files:

  • packages/thirdweb/src/stories/Bridge/CheckoutWidget.stories.tsx
  • packages/thirdweb/src/stories/Bridge/FundWallet.stories.tsx
  • packages/thirdweb/src/stories/Bridge/PaymentSelection.stories.tsx
  • packages/thirdweb/src/stories/Bridge/TransactionPayment.stories.tsx
  • packages/thirdweb/src/stories/Bridge/UnsupportedTokenScreen.stories.tsx
  • packages/thirdweb/src/stories/Bridge/DirectPayment.stories.tsx
  • packages/thirdweb/src/stories/Bridge/ErrorBanner.stories.tsx
  • packages/thirdweb/src/stories/Bridge/StepRunner.stories.tsx
  • packages/thirdweb/src/stories/Bridge/SuccessScreen.stories.tsx
  • packages/thirdweb/src/stories/Bridge/PaymentDetails.stories.tsx
**/types.ts

📄 CodeRabbit inference engine (AGENTS.md)

Provide and re‑use local type barrels in a types.ts file

Files:

  • packages/thirdweb/src/react/web/ui/Bridge/types.ts
🧠 Learnings (5)
📚 Learning: 2025-08-29T15:37:38.513Z
Learnt from: CR
PR: thirdweb-dev/js#0
File: AGENTS.md:0-0
Timestamp: 2025-08-29T15:37:38.513Z
Learning: Applies to apps/{dashboard,playground}/**/*.{ts,tsx} : Client-side data fetching: wrap calls in React Query with descriptive, stable `queryKeys` and set sensible `staleTime/cacheTime` (≥ 60s default); keep tokens secret via internal routes or server actions

Applied to files:

  • packages/thirdweb/src/react/web/ui/Bridge/common/token-query.ts
📚 Learning: 2025-09-24T11:08:43.783Z
Learnt from: MananTank
PR: thirdweb-dev/js#8106
File: packages/thirdweb/src/react/web/ui/Bridge/bridge-widget/bridge-widget.tsx:34-41
Timestamp: 2025-09-24T11:08:43.783Z
Learning: In BridgeWidgetProps for packages/thirdweb/src/react/web/ui/Bridge/bridge-widget/bridge-widget.tsx, the Swap onError callback signature requires a non-undefined SwapPreparedQuote parameter (unlike Buy's onError which allows undefined quote). This is intentional - SwapWidget's onError is only called when a quote is available.

Applied to files:

  • packages/thirdweb/src/react/web/ui/Bridge/swap-widget/SwapWidget.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/CheckoutWidget.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/TransactionWidget.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/BuyWidget.tsx
📚 Learning: 2025-08-29T15:37:38.513Z
Learnt from: CR
PR: thirdweb-dev/js#0
File: AGENTS.md:0-0
Timestamp: 2025-08-29T15:37:38.513Z
Learning: Applies to apps/{dashboard,playground}/**/*.stories.tsx : Add Storybook stories (`*.stories.tsx`) alongside new UI components

Applied to files:

  • packages/thirdweb/src/stories/Bridge/CheckoutWidget.stories.tsx
📚 Learning: 2025-07-18T19:20:32.530Z
Learnt from: CR
PR: thirdweb-dev/js#0
File: .cursor/rules/dashboard.mdc:0-0
Timestamp: 2025-07-18T19:20:32.530Z
Learning: Applies to dashboard/**/*client.tsx : Interactive UI that relies on hooks (`useState`, `useEffect`, React Query, wallet hooks).

Applied to files:

  • packages/thirdweb/src/react/web/ui/Bridge/CheckoutWidget.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/TransactionWidget.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/BuyWidget.tsx
📚 Learning: 2025-07-18T19:20:32.530Z
Learnt from: CR
PR: thirdweb-dev/js#0
File: .cursor/rules/dashboard.mdc:0-0
Timestamp: 2025-07-18T19:20:32.530Z
Learning: Applies to dashboard/**/*client.tsx : Anything that consumes hooks from `tanstack/react-query` or thirdweb SDKs.

Applied to files:

  • packages/thirdweb/src/react/web/ui/Bridge/CheckoutWidget.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/TransactionWidget.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/BuyWidget.tsx
🧬 Code graph analysis (29)
packages/thirdweb/src/react/web/ui/Bridge/common/token-query.ts (1)
packages/thirdweb/src/pay/convert/get-token.ts (1)
  • getToken (6-37)
packages/thirdweb/src/react/core/hooks/transaction/useSendTransaction.ts (1)
packages/thirdweb/src/pay/convert/type.ts (1)
  • SupportedFiatCurrency (27-27)
packages/thirdweb/src/react/web/ui/Bridge/payment-details/PaymentOverview.tsx (6)
packages/thirdweb/src/pay/convert/type.ts (1)
  • SupportedFiatCurrency (27-27)
packages/thirdweb/src/react/core/machines/paymentMachine.ts (1)
  • PaymentMethod (22-36)
packages/thirdweb/src/bridge/types/Token.ts (1)
  • Token (3-12)
packages/thirdweb/src/react/web/ui/Bridge/types.ts (1)
  • ModeInfo (11-22)
packages/thirdweb/src/react/web/ui/Bridge/common/TokenBalanceRow.tsx (1)
  • TokenBalanceRow (14-98)
packages/thirdweb/src/react/core/hooks/useTransactionDetails.ts (1)
  • useTransactionDetails (55-187)
packages/thirdweb/src/stories/Bridge/fixtures.ts (3)
packages/thirdweb/src/bridge/types/Token.ts (1)
  • TokenWithPrices (14-16)
packages/thirdweb/src/react/web/ui/Bridge/types.ts (1)
  • DirectPaymentInfo (4-9)
packages/thirdweb/src/exports/thirdweb.ts (1)
  • PreparedTransaction (179-179)
packages/thirdweb/src/react/web/ui/Bridge/swap-widget/SwapWidget.tsx (2)
packages/thirdweb/src/exports/react.ts (1)
  • SwapWidgetProps (150-150)
packages/thirdweb/src/pay/convert/type.ts (1)
  • SupportedFiatCurrency (27-27)
packages/thirdweb/src/react/web/ui/Bridge/DirectPayment.tsx (4)
packages/thirdweb/src/react/web/ui/Bridge/types.ts (1)
  • DirectPaymentInfo (4-9)
packages/thirdweb/src/pay/convert/type.ts (1)
  • SupportedFiatCurrency (27-27)
packages/thirdweb/src/react/web/ui/ConnectWallet/screens/Buy/swap/FiatValue.tsx (1)
  • FiatValue (15-55)
packages/thirdweb/src/react/web/ui/Bridge/common/WithHeader.tsx (1)
  • WithHeader (9-73)
packages/thirdweb/src/react/web/ui/Bridge/common/WithHeader.tsx (3)
packages/thirdweb/src/exports/thirdweb.ts (1)
  • ThirdwebClient (25-25)
packages/thirdweb/src/react/web/ui/components/basic.tsx (1)
  • Container (80-193)
packages/thirdweb/src/react/web/ui/components/text.tsx (1)
  • Text (18-34)
packages/thirdweb/src/stories/Bridge/CheckoutWidget.stories.tsx (3)
packages/thirdweb/src/stories/utils.tsx (1)
  • storyClient (14-16)
packages/thirdweb/src/stories/Bridge/fixtures.ts (1)
  • DIRECT_PAYMENT_UI_OPTIONS (771-864)
packages/thirdweb/src/react/web/ui/Bridge/CheckoutWidget.tsx (2)
  • CheckoutWidgetProps (45-211)
  • CheckoutWidget (315-352)
packages/thirdweb/src/react/web/ui/Bridge/types.ts (1)
packages/thirdweb/src/exports/thirdweb.ts (1)
  • PreparedTransaction (179-179)
packages/thirdweb/src/react/web/ui/Bridge/payment-details/PaymentDetails.tsx (3)
packages/thirdweb/src/pay/convert/type.ts (1)
  • SupportedFiatCurrency (27-27)
packages/thirdweb/src/react/web/ui/Bridge/types.ts (1)
  • ModeInfo (11-22)
packages/thirdweb/src/react/web/ui/components/basic.tsx (1)
  • ModalHeader (36-68)
packages/thirdweb/src/stories/Bridge/FundWallet.stories.tsx (3)
packages/thirdweb/src/stories/Bridge/fixtures.ts (2)
  • FUND_WALLET_UI_OPTIONS (714-768)
  • RECEIVER_ADDRESSES (642-648)
packages/thirdweb/src/stories/utils.tsx (1)
  • ModalThemeWrapper (18-36)
packages/thirdweb/src/react/web/ui/Bridge/FundWallet.tsx (1)
  • FundWallet (96-384)
packages/thirdweb/src/react/web/ui/TransactionButton/TransactionModal.tsx (4)
packages/thirdweb/src/pay/convert/type.ts (1)
  • SupportedFiatCurrency (27-27)
packages/thirdweb/src/react/web/ui/Bridge/TransactionWidget.tsx (1)
  • TransactionWidgetContentWrapper (337-427)
packages/thirdweb/src/react/web/ui/ConnectWallet/locale/getConnectLocale.ts (1)
  • useConnectLocale (45-54)
packages/thirdweb/src/react/web/ui/TransactionButton/DepositScreen.tsx (1)
  • DepositScreen (77-281)
packages/thirdweb/src/react/web/ui/Bridge/FundWallet.tsx (4)
packages/thirdweb/src/react/web/ui/PayEmbed.tsx (1)
  • PayEmbedConnectOptions (431-541)
packages/thirdweb/src/bridge/types/Token.ts (1)
  • TokenWithPrices (14-16)
packages/thirdweb/src/pay/convert/type.ts (1)
  • SupportedFiatCurrency (27-27)
packages/thirdweb/src/react/web/ui/Bridge/common/TokenAndChain.tsx (1)
  • TokenAndChain (22-99)
packages/thirdweb/src/react/web/ui/Bridge/CheckoutWidget.tsx (14)
packages/thirdweb/src/react/core/hooks/useBridgePrepare.ts (2)
  • BridgePrepareResult (23-27)
  • BridgePrepareRequest (14-18)
packages/thirdweb/src/react/web/ui/ConnectWallet/locale/getConnectLocale.ts (1)
  • useConnectLocale (45-54)
packages/thirdweb/src/react/web/ui/Bridge/common/token-query.ts (1)
  • useTokenQuery (13-45)
packages/thirdweb/src/bridge/types/Token.ts (1)
  • TokenWithPrices (14-16)
packages/thirdweb/src/react/core/machines/paymentMachine.ts (1)
  • PaymentMethod (22-36)
packages/thirdweb/src/react/core/hooks/useStepExecutor.ts (1)
  • CompletedStatusResult (19-26)
packages/thirdweb/src/react/web/ui/Bridge/DirectPayment.tsx (1)
  • DirectPayment (48-205)
packages/thirdweb/src/react/web/ui/Bridge/payment-selection/PaymentSelection.tsx (1)
  • PaymentSelection (108-333)
packages/thirdweb/src/react/web/ui/Bridge/QuoteLoader.tsx (1)
  • QuoteLoader (83-164)
packages/thirdweb/src/react/web/ui/Bridge/payment-details/PaymentDetails.tsx (1)
  • PaymentDetails (64-451)
packages/thirdweb/src/react/web/ui/Bridge/StepRunner.tsx (1)
  • StepRunner (75-426)
packages/thirdweb/src/react/web/adapters/WindowAdapter.ts (1)
  • webWindowAdapter (23-23)
packages/thirdweb/src/react/web/ui/Bridge/payment-success/SuccessScreen.tsx (1)
  • SuccessScreen (53-199)
packages/thirdweb/src/react/web/ui/Bridge/ErrorBanner.tsx (1)
  • ErrorBanner (31-107)
packages/thirdweb/src/stories/Bridge/PaymentSelection.stories.tsx (3)
packages/thirdweb/src/stories/utils.tsx (2)
  • storyClient (14-16)
  • ModalThemeWrapper (18-36)
packages/thirdweb/src/stories/Bridge/fixtures.ts (1)
  • USDC (38-49)
packages/thirdweb/src/react/web/ui/Bridge/payment-selection/PaymentSelection.tsx (1)
  • PaymentSelection (108-333)
packages/thirdweb/src/stories/Bridge/TransactionPayment.stories.tsx (3)
packages/thirdweb/src/stories/utils.tsx (2)
  • storyClient (14-16)
  • ModalThemeWrapper (18-36)
packages/thirdweb/src/stories/Bridge/fixtures.ts (1)
  • TRANSACTION_UI_OPTIONS (867-907)
packages/thirdweb/src/react/web/ui/Bridge/TransactionPayment.tsx (1)
  • TransactionPayment (80-445)
packages/thirdweb/src/stories/Bridge/UnsupportedTokenScreen.stories.tsx (3)
packages/thirdweb/src/stories/utils.tsx (2)
  • storyClient (14-16)
  • ModalThemeWrapper (18-36)
packages/thirdweb/src/exports/thirdweb.ts (2)
  • defineChain (18-18)
  • NATIVE_TOKEN_ADDRESS (31-31)
packages/thirdweb/src/react/web/ui/Bridge/UnsupportedTokenScreen.tsx (1)
  • UnsupportedTokenScreen (25-101)
packages/thirdweb/src/react/web/ui/Bridge/TransactionPayment.tsx (6)
packages/thirdweb/src/pay/convert/type.ts (1)
  • SupportedFiatCurrency (27-27)
packages/thirdweb/src/react/core/hooks/others/useChainQuery.ts (1)
  • useChainMetadata (165-175)
packages/thirdweb/src/react/core/hooks/useTransactionDetails.ts (1)
  • useTransactionDetails (55-187)
packages/thirdweb/src/react/web/ui/Bridge/common/WithHeader.tsx (1)
  • WithHeader (9-73)
packages/thirdweb/src/react/web/ui/Bridge/common/TokenAndChain.tsx (1)
  • ChainIcon (159-186)
packages/thirdweb/src/react/web/ui/components/ChainName.tsx (1)
  • ChainName (11-30)
packages/thirdweb/src/react/web/ui/Bridge/payment-selection/PaymentSelection.tsx (2)
packages/thirdweb/src/react/web/ui/PayEmbed.tsx (1)
  • PayEmbedConnectOptions (431-541)
packages/thirdweb/src/pay/convert/type.ts (1)
  • SupportedFiatCurrency (27-27)
packages/thirdweb/src/stories/Bridge/DirectPayment.stories.tsx (3)
packages/thirdweb/src/stories/utils.tsx (2)
  • storyClient (14-16)
  • ModalThemeWrapper (18-36)
packages/thirdweb/src/stories/Bridge/fixtures.ts (1)
  • DIRECT_PAYMENT_UI_OPTIONS (771-864)
packages/thirdweb/src/react/web/ui/Bridge/DirectPayment.tsx (1)
  • DirectPayment (48-205)
packages/thirdweb/src/react/web/ui/Bridge/TransactionWidget.tsx (16)
packages/thirdweb/src/transaction/actions/wait-for-tx-receipt.ts (1)
  • WaitForReceiptOptions (14-20)
packages/thirdweb/src/react/web/ui/ConnectWallet/locale/getConnectLocale.ts (1)
  • useConnectLocale (45-54)
packages/thirdweb/src/react/web/ui/Bridge/common/token-query.ts (1)
  • useTokenQuery (13-45)
packages/thirdweb/src/bridge/types/Token.ts (1)
  • TokenWithPrices (14-16)
packages/thirdweb/src/react/core/machines/paymentMachine.ts (1)
  • PaymentMethod (22-36)
packages/thirdweb/src/react/core/hooks/useBridgePrepare.ts (2)
  • BridgePrepareResult (23-27)
  • BridgePrepareRequest (14-18)
packages/thirdweb/src/react/core/hooks/useStepExecutor.ts (1)
  • CompletedStatusResult (19-26)
packages/thirdweb/src/react/web/ui/Bridge/TransactionPayment.tsx (1)
  • TransactionPayment (80-445)
packages/thirdweb/src/react/web/ui/Bridge/payment-selection/PaymentSelection.tsx (1)
  • PaymentSelection (108-333)
packages/thirdweb/src/react/web/ui/Bridge/QuoteLoader.tsx (1)
  • QuoteLoader (83-164)
packages/thirdweb/src/react/web/ui/Bridge/payment-details/PaymentDetails.tsx (1)
  • PaymentDetails (64-451)
packages/thirdweb/src/react/web/ui/Bridge/StepRunner.tsx (1)
  • StepRunner (75-426)
packages/thirdweb/src/react/web/adapters/WindowAdapter.ts (1)
  • webWindowAdapter (23-23)
packages/thirdweb/src/react/web/ui/Bridge/payment-success/SuccessScreen.tsx (1)
  • SuccessScreen (53-199)
packages/thirdweb/src/react/web/ui/Bridge/ErrorBanner.tsx (1)
  • ErrorBanner (31-107)
packages/thirdweb/src/react/web/ui/TransactionButton/ExecutingScreen.tsx (1)
  • ExecutingTxScreen (19-183)
packages/thirdweb/src/stories/Bridge/ErrorBanner.stories.tsx (2)
packages/thirdweb/src/stories/utils.tsx (2)
  • storyClient (14-16)
  • ModalThemeWrapper (18-36)
packages/thirdweb/src/react/web/ui/Bridge/ErrorBanner.tsx (1)
  • ErrorBanner (31-107)
packages/thirdweb/src/react/web/ui/Bridge/UnsupportedTokenScreen.tsx (1)
packages/thirdweb/src/bridge/types/Chain.ts (1)
  • Chain (5-40)
packages/thirdweb/src/react/web/ui/Bridge/BuyWidget.tsx (16)
packages/thirdweb/src/react/web/ui/ConnectWallet/locale/getConnectLocale.ts (1)
  • useConnectLocale (45-54)
packages/thirdweb/src/react/web/ui/Bridge/common/token-query.ts (1)
  • useTokenQuery (13-45)
packages/thirdweb/src/bridge/types/Token.ts (1)
  • TokenWithPrices (14-16)
packages/thirdweb/src/react/core/machines/paymentMachine.ts (1)
  • PaymentMethod (22-36)
packages/thirdweb/src/react/core/hooks/useBridgePrepare.ts (2)
  • BridgePrepareResult (23-27)
  • BridgePrepareRequest (14-18)
packages/thirdweb/src/react/core/hooks/useStepExecutor.ts (1)
  • CompletedStatusResult (19-26)
packages/thirdweb/src/react/web/ui/Bridge/FundWallet.tsx (1)
  • FundWallet (96-384)
packages/thirdweb/src/react/web/ui/Bridge/payment-selection/PaymentSelection.tsx (1)
  • PaymentSelection (108-333)
packages/thirdweb/src/react/web/ui/Bridge/QuoteLoader.tsx (1)
  • QuoteLoader (83-164)
packages/thirdweb/src/react/web/ui/Bridge/payment-details/PaymentDetails.tsx (1)
  • PaymentDetails (64-451)
packages/thirdweb/src/react/web/ui/Bridge/StepRunner.tsx (1)
  • StepRunner (75-426)
packages/thirdweb/src/react/web/adapters/WindowAdapter.ts (1)
  • webWindowAdapter (23-23)
packages/thirdweb/src/react/web/ui/Bridge/payment-success/SuccessScreen.tsx (1)
  • SuccessScreen (53-199)
packages/thirdweb/src/react/web/ui/Bridge/ErrorBanner.tsx (1)
  • ErrorBanner (31-107)
packages/thirdweb/src/react/web/ui/ConnectWallet/Modal/ConnectEmbed.tsx (1)
  • EmbedContainer (459-485)
packages/thirdweb/src/react/web/ui/components/DynamicHeight.tsx (1)
  • DynamicHeight (8-33)
packages/thirdweb/src/stories/Bridge/StepRunner.stories.tsx (5)
packages/thirdweb/src/stories/utils.tsx (2)
  • storyClient (14-16)
  • ModalThemeWrapper (18-36)
packages/thirdweb/src/react/core/hooks/useStepExecutor.ts (1)
  • CompletedStatusResult (19-26)
packages/thirdweb/src/stories/Bridge/fixtures.ts (2)
  • STORY_MOCK_WALLET (90-90)
  • simpleBuyQuote (251-311)
packages/thirdweb/src/react/web/adapters/WindowAdapter.ts (1)
  • webWindowAdapter (23-23)
packages/thirdweb/src/react/web/ui/Bridge/StepRunner.tsx (1)
  • StepRunner (75-426)
packages/thirdweb/src/stories/Bridge/SuccessScreen.stories.tsx (4)
packages/thirdweb/src/react/web/adapters/WindowAdapter.ts (1)
  • webWindowAdapter (23-23)
packages/thirdweb/src/stories/utils.tsx (2)
  • storyClient (14-16)
  • ModalThemeWrapper (18-36)
packages/thirdweb/src/react/web/ui/Bridge/payment-success/SuccessScreen.tsx (1)
  • SuccessScreen (53-199)
packages/thirdweb/src/stories/Bridge/fixtures.ts (2)
  • simpleOnrampQuote (93-123)
  • simpleBuyQuote (251-311)
packages/thirdweb/src/react/web/ui/Bridge/StepRunner.tsx (1)
packages/thirdweb/src/react/core/hooks/useBridgePrepare.ts (2)
  • BridgePrepareRequest (14-18)
  • BridgePrepareResult (23-27)
packages/thirdweb/src/stories/Bridge/PaymentDetails.stories.tsx (3)
packages/thirdweb/src/stories/utils.tsx (2)
  • storyClient (14-16)
  • ModalThemeWrapper (18-36)
packages/thirdweb/src/react/web/ui/Bridge/payment-details/PaymentDetails.tsx (1)
  • PaymentDetails (64-451)
packages/thirdweb/src/stories/Bridge/fixtures.ts (3)
  • simpleOnrampQuote (93-123)
  • DIRECT_PAYMENT_UI_OPTIONS (771-864)
  • TRANSACTION_UI_OPTIONS (867-907)
packages/thirdweb/src/react/web/ui/Bridge/QuoteLoader.tsx (1)
packages/thirdweb/src/pay/types.ts (1)
  • PurchaseData (1-1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (8)
  • GitHub Check: E2E Tests (pnpm, webpack)
  • GitHub Check: E2E Tests (pnpm, vite)
  • GitHub Check: E2E Tests (pnpm, esbuild)
  • GitHub Check: Lint Packages
  • GitHub Check: Size
  • GitHub Check: Unit Tests
  • GitHub Check: Build Packages
  • GitHub Check: Analyze (javascript)
🔇 Additional comments (11)
packages/thirdweb/src/react/core/hooks/transaction/useSendTransaction.ts (1)

98-103: Currency option addition looks good

Nice to see the fiat currency choice formalized with SupportedFiatCurrency; this keeps the modal typing aligned with the rest of the bridge flow.

packages/thirdweb/src/stories/Bridge/fixtures.ts (1)

684-907: Nice explicit fixture typing

Defining focused UI option shapes (FundWalletUIOptions, etc.) makes the stories much easier to reason about—thanks for tightening that up.

packages/thirdweb/src/react/web/ui/Bridge/payment-success/SuccessScreen.tsx (2)

136-143: LGTM!

The conditional message rendering based on showContinueWithTx is clear and correct.


158-162: LGTM!

Button label logic correctly reflects the showContinueWithTx flow.

packages/thirdweb/src/react/web/hooks/transaction/useSendTransaction.tsx (1)

139-141: LGTM!

The currency prop addition follows the same optional pattern as country and aligns with the broader currency handling refactor across bridge components.

packages/thirdweb/src/stories/utils.tsx (1)

18-36: LGTM!

The refactor to render both dark and light themes simultaneously is a good improvement for Storybook visualization. The removal of the theme prop simplifies the API and the implementation is clean.

packages/thirdweb/src/react/web/ui/Bridge/common/WithHeader.tsx (2)

9-21: LGTM!

The refactor from nested uiOptions.metadata to explicit title, description, and image props makes the component's dependencies clearer and more maintainable.


23-73: LGTM!

The rendering logic correctly uses the new explicit props with appropriate null checks and conditional rendering.

packages/thirdweb/src/stories/Bridge/UnsupportedTokenScreen.stories.tsx (1)

7-21: Decorator-based theming keeps both palettes aligned

Switching to the shared ModalThemeWrapper decorator neatly exercises the screen in both dark and light modes without per-story prop plumbing. Looks great.

packages/thirdweb/src/stories/Bridge/StepRunner.stories.tsx (1)

13-45: Great fixture wiring for autonomous StepRunner preview

Bundling the mock wallet, prepared quote, and auto-start flag lets the story showcase the full execution flow without network travel. Nice job tightening the public surface.

packages/thirdweb/src/stories/Bridge/TransactionPayment.stories.tsx (1)

7-50: Unified arg presets simplify the TransactionPayment variants

Reusing the TRANSACTION_UI_OPTIONS presets while applying the global modal theme decorator keeps every variant consistent and eliminates duplicate wiring. Nicely streamlined.

@github-actions
Copy link
Contributor

github-actions bot commented Oct 1, 2025

size-limit report 📦

Path Size Loading time (3g) Running time (snapdragon) Total time
thirdweb (esm) 64.6 KB (0%) 1.3 s (0%) 233 ms (+340.97% 🔺) 1.6 s
thirdweb (cjs) 365.75 KB (0%) 7.4 s (0%) 644 ms (+33.33% 🔺) 8 s
thirdweb (minimal + tree-shaking) 5.73 KB (0%) 115 ms (0%) 135 ms (+3439.83% 🔺) 250 ms
thirdweb/chains (tree-shaking) 526 B (0%) 11 ms (0%) 76 ms (+6634.92% 🔺) 87 ms
thirdweb/react (minimal + tree-shaking) 19.13 KB (0%) 383 ms (0%) 101 ms (+3320.28% 🔺) 483 ms

@codecov
Copy link

codecov bot commented Oct 1, 2025

Codecov Report

❌ Patch coverage is 3.81895% with 680 lines in your changes missing coverage. Please review.
✅ Project coverage is 56.07%. Comparing base (fd20a6c) to head (ef9cf34).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...ges/thirdweb/src/react/web/ui/Bridge/BuyWidget.tsx 3.58% 269 Missing ⚠️
...dweb/src/react/web/ui/Bridge/TransactionWidget.tsx 4.07% 259 Missing ⚠️
...eact/web/ui/TransactionButton/TransactionModal.tsx 2.70% 36 Missing ⚠️
...dweb/src/react/web/ui/Bridge/common/token-query.ts 12.90% 27 Missing ⚠️
...web/src/react/web/ui/Bridge/TransactionPayment.tsx 0.00% 22 Missing ⚠️
...es/thirdweb/src/react/web/ui/Bridge/FundWallet.tsx 0.00% 21 Missing ⚠️
.../web/ui/Bridge/payment-details/PaymentOverview.tsx 0.00% 20 Missing ⚠️
...t/web/ui/Bridge/payment-details/PaymentDetails.tsx 0.00% 10 Missing ⚠️
...dweb/src/react/web/ui/Bridge/common/WithHeader.tsx 11.11% 8 Missing ⚠️
...ct/web/ui/Bridge/payment-success/SuccessScreen.tsx 0.00% 3 Missing ⚠️
... and 4 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8169      +/-   ##
==========================================
- Coverage   56.29%   56.07%   -0.22%     
==========================================
  Files         906      905       -1     
  Lines       59209    59228      +19     
  Branches     4179     4124      -55     
==========================================
- Hits        33330    33212     -118     
- Misses      25774    25912     +138     
+ Partials      105      104       -1     
Flag Coverage Δ
packages 56.07% <3.81%> (-0.22%) ⬇️
Files with missing lines Coverage Δ
...react/core/hooks/transaction/useSendTransaction.ts 10.84% <ø> (ø)
...thirdweb/src/react/core/hooks/usePaymentMethods.ts 6.36% <ø> (+0.11%) ⬆️
...es/thirdweb/src/react/web/ui/Bridge/StepRunner.tsx 3.78% <ø> (ø)
...src/react/web/ui/Bridge/UnsupportedTokenScreen.tsx 14.28% <ø> (ø)
...web/ui/Bridge/payment-selection/TokenSelection.tsx 5.29% <ø> (ø)
...react/web/hooks/transaction/useSendTransaction.tsx 35.59% <0.00%> (-0.62%) ⬇️
...b/ui/Bridge/payment-selection/PaymentSelection.tsx 7.28% <0.00%> (+0.17%) ⬆️
...c/react/web/ui/TransactionButton/DepositScreen.tsx 12.86% <0.00%> (ø)
...s/thirdweb/src/react/web/ui/Bridge/QuoteLoader.tsx 6.94% <0.00%> (+0.18%) ⬆️
...ct/web/ui/Bridge/payment-success/SuccessScreen.tsx 10.90% <0.00%> (ø)
... and 9 more

... and 3 files with indirect coverage changes

🚀 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
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: 3

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
packages/thirdweb/src/react/web/ui/Bridge/FundWallet.tsx (1)

31-94: Add TSDoc to public type.

Per coding guidelines, every public symbol in packages/thirdweb/** must have comprehensive TSDoc with at least one @example and a custom tag.

Apply this diff to add TSDoc:

+/**
+ * Props for the FundWallet component.
+ * @example
+ * ```tsx
+ * <FundWallet
+ *   client={client}
+ *   destinationToken={ethToken}
+ *   currency="USD"
+ *   metadata={{ title: "Fund Wallet", description: "Add ETH", image: undefined }}
+ *   onContinue={(amount, token, receiver) => console.log(amount)}
+ *   presetOptions={[5, 10, 20]}
+ *   connectOptions={undefined}
+ *   showThirdwebBranding={true}
+ *   receiverAddress={undefined}
+ *   initialAmount={undefined}
+ *   buttonLabel={undefined}
+ * />
+ * ```
+ * @internal
+ */
 type FundWalletProps = {

As per coding guidelines.

♻️ Duplicate comments (2)
packages/thirdweb/src/stories/Bridge/PaymentDetails.stories.tsx (2)

164-174: Same concern: verify modeInfo and spread operator usage.

Similar to the previous story, ensure that the modeInfo.transaction field and the spread of TRANSACTION_UI_OPTIONS.erc20Transfer don't conflict or cause duplication.


176-186: Same concern: verify modeInfo and spread operator usage.

Similar to the previous transaction stories, ensure that the modeInfo.transaction field and the spread of TRANSACTION_UI_OPTIONS.contractInteraction don't conflict or cause duplication.

🧹 Nitpick comments (6)
packages/thirdweb/src/stories/Bridge/DirectPayment.stories.tsx (1)

6-22: Consider using Storybook actions for better interactivity.

The meta configuration is well-structured with proper typing and decorator-based theming. Consider enhancing the onContinue callback to use Storybook's action logger for better story interactivity:

+import { action } from "@storybook/addon-actions";
+
 const meta: Meta<typeof DirectPayment> = {
   args: {
     client: storyClient,
-    onContinue: (_amount, _token, _receiverAddress) => {},
+    onContinue: action("onContinue"),
     currency: "USD",
     ...DIRECT_PAYMENT_UI_OPTIONS.digitalArt,
   },

This would allow reviewers and developers to see the callback arguments in the Storybook Actions panel when testing stories.

packages/thirdweb/src/stories/Bridge/PaymentSelection.stories.tsx (1)

10-17: Use Storybook actions for interactive callbacks.

The callback handlers use alert() and empty functions, which limits the ability to observe interactions in Storybook's Actions panel. Replace them with Storybook actions for better debugging and demonstration.

Apply this diff:

+import { action } from "@storybook/addon-actions";
+
 const meta: Meta<typeof PaymentSelection> = {
   args: {
     client: storyClient,
-    onBack: () => {
-      alert("Back");
-    },
+    onBack: action("onBack"),
     connectLocale: en,
     destinationAmount: "1",
     destinationToken: USDC,
-    onError: (error) => console.error("Error:", error),
-    onPaymentMethodSelected: () => {},
+    onError: action("onError"),
+    onPaymentMethodSelected: action("onPaymentMethodSelected"),
     country: "US",
packages/thirdweb/src/stories/Bridge/TransactionPayment.stories.tsx (2)

11-12: Verify spread order doesn't override currency.

The explicit currency: "USD" is set before spreading ...TRANSACTION_UI_OPTIONS.ethTransfer. If the fixture object includes a currency field, it will override the explicit value. Consider reordering:

  args: {
    client: storyClient,
    onExecuteTransaction: () => {},
    onContinue: (_amount, _token, _receiverAddress) => {},
-   currency: "USD",
    ...TRANSACTION_UI_OPTIONS.ethTransfer,
+   currency: "USD",
  },

This ensures your explicit currency always takes precedence.


28-32: Consider removing redundant spread.

The EthereumTransfer story spreads TRANSACTION_UI_OPTIONS.ethTransfer, which is already spread in the base meta args (line 12). This is redundant but harmless.

 export const EthereumTransfer: Story = {
-  args: {
-    ...TRANSACTION_UI_OPTIONS.ethTransfer,
-  },
+  args: {},
 };

Alternatively, remove it from the base meta args if you want each story to be explicit about its transaction type.

packages/thirdweb/src/react/web/ui/Bridge/FundWallet.tsx (2)

150-162: Simplify currency fallback and verify price availability.

The pattern currency || "USD" appears multiple times (lines 151, 268, 270). If currency is typed as SupportedFiatCurrency (required prop on line 79), the fallback is unnecessary and could mask issues if the price for the specified currency is missing.

Consider checking price availability explicitly:

 const handleQuickAmount = (usdAmount: number) => {
-  const price = destinationToken.prices[currency || "USD"] || 0;
+  const price = destinationToken.prices[currency] || 0;
   if (price === 0) {
+    console.warn(`Price not available for currency: ${currency}`);
     return;
   }
   const tokenAmount = usdAmount / price;
   const formattedAmount = numberToPlainString(
     Number.parseFloat(tokenAmount.toFixed(6)),
   );
   setAmount(formattedAmount);
 };

Similarly update lines 268-271.


165-174: Remove unreachable metadata.title fallback or confirm its necessity.

BuyWidget always supplies a title prop to FundWallet, so metadata.title is never undefined and the fallback (Buy ${destinationToken.symbol}) is never executed. Remove the fallback logic or reserve it for future callers.

📜 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 013cf42 and ff2e53e.

📒 Files selected for processing (11)
  • packages/thirdweb/src/react/web/ui/Bridge/FundWallet.tsx (9 hunks)
  • packages/thirdweb/src/react/web/ui/Bridge/common/WithHeader.tsx (3 hunks)
  • packages/thirdweb/src/stories/Bridge/DirectPayment.stories.tsx (1 hunks)
  • packages/thirdweb/src/stories/Bridge/ErrorBanner.stories.tsx (2 hunks)
  • packages/thirdweb/src/stories/Bridge/FundWallet.stories.tsx (1 hunks)
  • packages/thirdweb/src/stories/Bridge/PaymentDetails.stories.tsx (2 hunks)
  • packages/thirdweb/src/stories/Bridge/PaymentSelection.stories.tsx (1 hunks)
  • packages/thirdweb/src/stories/Bridge/StepRunner.stories.tsx (1 hunks)
  • packages/thirdweb/src/stories/Bridge/SuccessScreen.stories.tsx (2 hunks)
  • packages/thirdweb/src/stories/Bridge/TransactionPayment.stories.tsx (1 hunks)
  • packages/thirdweb/src/stories/Bridge/UnsupportedTokenScreen.stories.tsx (1 hunks)
🧰 Additional context used
📓 Path-based instructions (4)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.{ts,tsx}: Write idiomatic TypeScript with explicit function declarations and return types
Limit each file to one stateless, single-responsibility function for clarity
Re-use shared types from @/types or local types.ts barrels
Prefer type aliases over interface except for nominal shapes
Avoid any and unknown unless unavoidable; narrow generics when possible
Choose composition over inheritance; leverage utility types (Partial, Pick, etc.)
Comment only ambiguous logic; avoid restating TypeScript in prose

**/*.{ts,tsx}: Use explicit function declarations and explicit return types in TypeScript
Limit each file to one stateless, single‑responsibility function
Re‑use shared types from @/types where applicable
Prefer type aliases over interface except for nominal shapes
Avoid any and unknown unless unavoidable; narrow generics when possible
Prefer composition over inheritance; use utility types (Partial, Pick, etc.)
Lazy‑import optional features and avoid top‑level side‑effects to reduce bundle size

Files:

  • packages/thirdweb/src/stories/Bridge/StepRunner.stories.tsx
  • packages/thirdweb/src/stories/Bridge/DirectPayment.stories.tsx
  • packages/thirdweb/src/stories/Bridge/TransactionPayment.stories.tsx
  • packages/thirdweb/src/stories/Bridge/ErrorBanner.stories.tsx
  • packages/thirdweb/src/stories/Bridge/PaymentDetails.stories.tsx
  • packages/thirdweb/src/stories/Bridge/PaymentSelection.stories.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/FundWallet.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/common/WithHeader.tsx
  • packages/thirdweb/src/stories/Bridge/FundWallet.stories.tsx
  • packages/thirdweb/src/stories/Bridge/UnsupportedTokenScreen.stories.tsx
  • packages/thirdweb/src/stories/Bridge/SuccessScreen.stories.tsx
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (CLAUDE.md)

Load heavy dependencies inside async paths to keep initial bundle lean (lazy loading)

Files:

  • packages/thirdweb/src/stories/Bridge/StepRunner.stories.tsx
  • packages/thirdweb/src/stories/Bridge/DirectPayment.stories.tsx
  • packages/thirdweb/src/stories/Bridge/TransactionPayment.stories.tsx
  • packages/thirdweb/src/stories/Bridge/ErrorBanner.stories.tsx
  • packages/thirdweb/src/stories/Bridge/PaymentDetails.stories.tsx
  • packages/thirdweb/src/stories/Bridge/PaymentSelection.stories.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/FundWallet.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/common/WithHeader.tsx
  • packages/thirdweb/src/stories/Bridge/FundWallet.stories.tsx
  • packages/thirdweb/src/stories/Bridge/UnsupportedTokenScreen.stories.tsx
  • packages/thirdweb/src/stories/Bridge/SuccessScreen.stories.tsx
**/*.stories.tsx

📄 CodeRabbit inference engine (CLAUDE.md)

For new UI components, add Storybook stories (*.stories.tsx) alongside the code

Files:

  • packages/thirdweb/src/stories/Bridge/StepRunner.stories.tsx
  • packages/thirdweb/src/stories/Bridge/DirectPayment.stories.tsx
  • packages/thirdweb/src/stories/Bridge/TransactionPayment.stories.tsx
  • packages/thirdweb/src/stories/Bridge/ErrorBanner.stories.tsx
  • packages/thirdweb/src/stories/Bridge/PaymentDetails.stories.tsx
  • packages/thirdweb/src/stories/Bridge/PaymentSelection.stories.tsx
  • packages/thirdweb/src/stories/Bridge/FundWallet.stories.tsx
  • packages/thirdweb/src/stories/Bridge/UnsupportedTokenScreen.stories.tsx
  • packages/thirdweb/src/stories/Bridge/SuccessScreen.stories.tsx
packages/thirdweb/**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

packages/thirdweb/**/*.{ts,tsx}: Every public symbol must have comprehensive TSDoc with at least one compiling @example and a custom tag (@beta, @internal, @experimental, etc.)
Comment only ambiguous logic; avoid restating TypeScript in prose
Lazy‑load heavy dependencies inside async paths (e.g., const { jsPDF } = await import("jspdf"))

Files:

  • packages/thirdweb/src/stories/Bridge/StepRunner.stories.tsx
  • packages/thirdweb/src/stories/Bridge/DirectPayment.stories.tsx
  • packages/thirdweb/src/stories/Bridge/TransactionPayment.stories.tsx
  • packages/thirdweb/src/stories/Bridge/ErrorBanner.stories.tsx
  • packages/thirdweb/src/stories/Bridge/PaymentDetails.stories.tsx
  • packages/thirdweb/src/stories/Bridge/PaymentSelection.stories.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/FundWallet.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/common/WithHeader.tsx
  • packages/thirdweb/src/stories/Bridge/FundWallet.stories.tsx
  • packages/thirdweb/src/stories/Bridge/UnsupportedTokenScreen.stories.tsx
  • packages/thirdweb/src/stories/Bridge/SuccessScreen.stories.tsx
🧬 Code graph analysis (11)
packages/thirdweb/src/stories/Bridge/StepRunner.stories.tsx (5)
packages/thirdweb/src/react/web/ui/Bridge/StepRunner.tsx (1)
  • StepRunner (75-426)
packages/thirdweb/src/stories/utils.tsx (2)
  • storyClient (14-16)
  • ModalThemeWrapper (18-36)
packages/thirdweb/src/react/core/hooks/useStepExecutor.ts (1)
  • CompletedStatusResult (19-26)
packages/thirdweb/src/stories/Bridge/fixtures.ts (2)
  • STORY_MOCK_WALLET (90-90)
  • simpleBuyQuote (251-311)
packages/thirdweb/src/react/web/adapters/WindowAdapter.ts (1)
  • webWindowAdapter (23-23)
packages/thirdweb/src/stories/Bridge/DirectPayment.stories.tsx (5)
packages/thirdweb/src/react/web/ui/Bridge/DirectPayment.tsx (1)
  • DirectPayment (48-205)
packages/thirdweb/src/stories/utils.tsx (2)
  • storyClient (14-16)
  • ModalThemeWrapper (18-36)
packages/thirdweb/src/stories/Bridge/fixtures.ts (1)
  • DIRECT_PAYMENT_UI_OPTIONS (771-864)
packages/thirdweb/src/stories/Bridge/FundWallet.stories.tsx (1)
  • CustomButtonLabel (59-63)
packages/thirdweb/src/stories/Bridge/TransactionPayment.stories.tsx (1)
  • CustomButtonLabel (46-50)
packages/thirdweb/src/stories/Bridge/TransactionPayment.stories.tsx (4)
packages/thirdweb/src/react/web/ui/Bridge/TransactionPayment.tsx (1)
  • TransactionPayment (80-445)
packages/thirdweb/src/stories/utils.tsx (1)
  • ModalThemeWrapper (18-36)
packages/thirdweb/src/stories/Bridge/fixtures.ts (1)
  • TRANSACTION_UI_OPTIONS (867-907)
packages/thirdweb/src/stories/Bridge/DirectPayment.stories.tsx (1)
  • CustomButtonLabel (57-61)
packages/thirdweb/src/stories/Bridge/ErrorBanner.stories.tsx (2)
packages/thirdweb/src/react/web/ui/Bridge/ErrorBanner.tsx (1)
  • ErrorBanner (31-107)
packages/thirdweb/src/stories/utils.tsx (2)
  • storyClient (14-16)
  • ModalThemeWrapper (18-36)
packages/thirdweb/src/stories/Bridge/PaymentDetails.stories.tsx (3)
packages/thirdweb/src/react/web/ui/Bridge/payment-details/PaymentDetails.tsx (1)
  • PaymentDetails (64-451)
packages/thirdweb/src/stories/Bridge/fixtures.ts (3)
  • simpleOnrampQuote (93-123)
  • DIRECT_PAYMENT_UI_OPTIONS (771-864)
  • TRANSACTION_UI_OPTIONS (867-907)
packages/thirdweb/src/stories/utils.tsx (2)
  • storyClient (14-16)
  • ModalThemeWrapper (18-36)
packages/thirdweb/src/stories/Bridge/PaymentSelection.stories.tsx (3)
packages/thirdweb/src/react/web/ui/Bridge/payment-selection/PaymentSelection.tsx (1)
  • PaymentSelection (108-333)
packages/thirdweb/src/stories/utils.tsx (2)
  • storyClient (14-16)
  • ModalThemeWrapper (18-36)
packages/thirdweb/src/stories/Bridge/fixtures.ts (1)
  • USDC (38-49)
packages/thirdweb/src/react/web/ui/Bridge/FundWallet.tsx (3)
packages/thirdweb/src/react/web/ui/PayEmbed.tsx (1)
  • PayEmbedConnectOptions (431-541)
packages/thirdweb/src/bridge/types/Token.ts (1)
  • TokenWithPrices (14-16)
packages/thirdweb/src/pay/convert/type.ts (1)
  • SupportedFiatCurrency (27-27)
packages/thirdweb/src/react/web/ui/Bridge/common/WithHeader.tsx (2)
packages/thirdweb/src/react/web/ui/components/basic.tsx (1)
  • Container (80-193)
packages/thirdweb/src/react/web/ui/components/text.tsx (1)
  • Text (18-34)
packages/thirdweb/src/stories/Bridge/FundWallet.stories.tsx (5)
packages/thirdweb/src/react/web/ui/Bridge/FundWallet.tsx (1)
  • FundWallet (96-388)
packages/thirdweb/src/stories/utils.tsx (2)
  • storyClient (14-16)
  • ModalThemeWrapper (18-36)
packages/thirdweb/src/stories/Bridge/fixtures.ts (2)
  • RECEIVER_ADDRESSES (642-648)
  • FUND_WALLET_UI_OPTIONS (714-768)
packages/thirdweb/src/stories/Bridge/DirectPayment.stories.tsx (1)
  • CustomButtonLabel (57-61)
packages/thirdweb/src/stories/Bridge/TransactionPayment.stories.tsx (1)
  • CustomButtonLabel (46-50)
packages/thirdweb/src/stories/Bridge/UnsupportedTokenScreen.stories.tsx (2)
packages/thirdweb/src/react/web/ui/Bridge/UnsupportedTokenScreen.tsx (1)
  • UnsupportedTokenScreen (25-101)
packages/thirdweb/src/stories/utils.tsx (2)
  • storyClient (14-16)
  • ModalThemeWrapper (18-36)
packages/thirdweb/src/stories/Bridge/SuccessScreen.stories.tsx (4)
packages/thirdweb/src/react/web/ui/Bridge/payment-success/SuccessScreen.tsx (1)
  • SuccessScreen (53-199)
packages/thirdweb/src/stories/Bridge/fixtures.ts (2)
  • simpleBuyQuote (251-311)
  • simpleOnrampQuote (93-123)
packages/thirdweb/src/react/web/adapters/WindowAdapter.ts (1)
  • webWindowAdapter (23-23)
packages/thirdweb/src/stories/utils.tsx (2)
  • storyClient (14-16)
  • ModalThemeWrapper (18-36)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: Unit Tests
  • GitHub Check: Size
  • GitHub Check: Lint Packages
  • GitHub Check: Analyze (javascript)
🔇 Additional comments (30)
packages/thirdweb/src/stories/Bridge/ErrorBanner.stories.tsx (3)

1-3: LGTM!

The imports are appropriate for the decorator-based theming refactor and align with the pattern used across other Bridge stories.


14-29: LGTM!

The meta configuration correctly implements the decorator-based theming pattern. All required props are provided in the args, and the decorator ensures both light and dark theme variants are rendered.


31-63: LGTM!

The story exports provide comprehensive coverage of different error scenarios, including edge cases like missing cancel button and empty error messages. The stories are well-structured and follow Storybook best practices.

packages/thirdweb/src/stories/Bridge/DirectPayment.stories.tsx (2)

1-4: LGTM!

The imports are clean and align with the decorator-based theming refactor. The direct import of DirectPayment without wrapper components simplifies the story setup.


27-61: LGTM!

The story definitions are clean, consistent, and cover diverse use cases (digital art, concert tickets, subscriptions, physical products, no-image scenarios, and custom button labels). The pattern of spreading fixture options is maintainable and DRY.

packages/thirdweb/src/stories/Bridge/PaymentSelection.stories.tsx (1)

38-51: LGTM! Well-structured story configurations.

The story exports are well-organized with descriptive names that clearly communicate the scenarios being tested. The two stories effectively demonstrate the component's behavior with different paymentMethods configurations.

packages/thirdweb/src/stories/Bridge/UnsupportedTokenScreen.stories.tsx (4)

1-5: LGTM: Imports are clean and properly organized.

All imports are used and follow ESM conventions with .js extensions.


7-22: LGTM: Meta definition is well-structured.

The meta correctly types the component, provides all required props (client, chain, tokenAddress), and uses the decorator pattern for theme variations.


27-31: LGTM: TokenNotSupported story correctly demonstrates the token-unsupported path.

The story uses Ethereum mainnet (chain 1) to trigger the non-testnet "Token Not Supported" message, inheriting other required props from the meta args.


33-37: LGTM: TestnetNotSupported story correctly demonstrates the testnet path.

The story uses Sepolia testnet (chain ID 11155111) to trigger the "Testnet Not Supported" message. The chain ID is correct and the comment is helpful.

packages/thirdweb/src/stories/Bridge/SuccessScreen.stories.tsx (5)

5-7: LGTM! Import refactoring aligns with decorator approach.

The import changes correctly reflect the move from per-story theme wrappers to a global decorator pattern, and the fixture imports are properly scoped.


69-88: LGTM! Meta configuration properly implements global decorator pattern.

The meta configuration correctly:

  • Updates component reference from wrapper to direct SuccessScreen
  • Provides all required props with sensible defaults
  • Implements ModalThemeWrapper as a global decorator, consistent with the refactoring across Bridge stories

The new showContinueWithTx and hasPaymentId props enable testing different transaction flow scenarios.


93-95: LGTM! Basic story provides sensible default scenario.

The Basic story serves as a minimal example using meta defaults, replacing the previous Default/DefaultLight stories with a unified approach via the global decorator.


97-112: LGTM! Payment scenario stories provide good coverage.

OnrampPayment and ComplexPayment stories effectively test different completion scenarios (onramp-only and combined flows) with appropriate fixture data.


122-129: Review the PaymentId story prop combination.

The PaymentId story sets both hasPaymentId: true and showContinueWithTx: true, but based on the component implementation, when hasPaymentId is true, the Continue/Done button is not rendered at all. Setting showContinueWithTx has no effect in this case.

Consider whether showContinueWithTx: true is intentional here, or if it should be removed/set to false since the button won't be visible when hasPaymentId is true.

Based on the component logic in SuccessScreen.tsx:

{!hasPaymentId && (
  <Button fullWidth onClick={onDone} variant="accent">
    {showContinueWithTx ? "Continue" : "Done"}
  </Button>
)}
packages/thirdweb/src/stories/Bridge/TransactionPayment.stories.tsx (2)

15-21: LGTM: Clean decorator pattern.

The decorator correctly applies ModalThemeWrapper to all stories, providing consistent dark/light theme rendering. This is a good refactor from per-story theming.


34-50: LGTM: Story configurations are correct.

The remaining stories correctly override the base args with their respective transaction types (ERC20 transfer, contract interaction, and custom button label). The structure is clean and consistent.

packages/thirdweb/src/stories/Bridge/StepRunner.stories.tsx (3)

3-3: LGTM: Import added for WindowAdapter.

The import of webWindowAdapter is correctly sourced from the WindowAdapter module and used in the story args on line 18.


25-31: LGTM: Decorator pattern correctly implemented.

The ModalThemeWrapper decorator is properly applied to wrap all stories with both dark and light theme variants, replacing the previous per-story theme configuration approach. This aligns with the broader refactoring pattern across Bridge stories.


41-45: LGTM: Story renamed and simplified.

The story has been renamed from Light to Basic and correctly provides the required request prop. The structure is clean and follows the new decorator-based theming approach.

packages/thirdweb/src/stories/Bridge/PaymentDetails.stories.tsx (4)

3-3: LGTM: Import updated to direct component.

The import correctly references PaymentDetails directly instead of a theme-wrapped variant, aligning with the decorator-based theming approach.


61-87: LGTM: Meta configuration updated with new props and decorator.

The meta args have been properly updated to include the new required props (modeInfo, currency, metadata, client, confirmButtonLabel), and the ModalThemeWrapper decorator is correctly applied. The structure aligns with the refactored component API.


99-105: Spread operator safe – no overriding of critical props DIRECT_PAYMENT_UI_OPTIONS.credits only defines metadata, buttonLabel, and paymentInfo, so it cannot override paymentMethod or preparedQuote.


152-162: Ignore – the spread is applied at the root of args, not inside modeInfo, so it cannot override modeInfo.transaction.

Likely an incorrect or invalid review comment.

packages/thirdweb/src/react/web/ui/Bridge/common/WithHeader.tsx (2)

30-31: Good: Added explicit sizing constraints.

Adding overflow: "hidden" and width: "100%" ensures the image container behaves predictably and prevents layout issues.


11-11: Retain required title prop All callers supply a non‐undefined string via fallback (e.g. metadata.title || "…", or the ternary in FundWallet), so title: string is correct.

Likely an incorrect or invalid review comment.

packages/thirdweb/src/react/web/ui/Bridge/FundWallet.tsx (1)

109-109: LGTM: State initialization.

Correctly initializes amount state with the initialAmount prop fallback to empty string.

packages/thirdweb/src/stories/Bridge/FundWallet.stories.tsx (3)

6-28: Good: Simplified story structure with global decorator.

The refactor from per-story theme variants to a global ModalThemeWrapper decorator reduces duplication and aligns with the pattern used in other Bridge stories (e.g., DirectPayment, TransactionPayment).


33-63: LGTM: Story definitions follow consistent pattern.

All stories correctly spread UI options from fixtures and override specific props where needed (e.g., receiverAddress). This is consistent with other Bridge story files.


13-17: Required prop defaults verified.
FUND_WALLET_UI_OPTIONS.ethDefault supplies destinationToken and metadata, and the story explicitly defines currency, presetOptions, connectOptions, and showThirdwebBranding, covering all required props.

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: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (3)
packages/thirdweb/src/react/web/ui/Bridge/TransactionWidget.tsx (1)

337-341: Add required TSDoc for TransactionWidgetContentWrapper.

Public exports under packages/thirdweb must include comprehensive TSDoc with a compiling @example and a custom tag. Please document this wrapper accordingly.

packages/thirdweb/src/react/web/ui/Bridge/FundWallet.tsx (1)

150-161: Fix fiat preset UX: use selected currency symbol, not hardcoded “$”; drop redundant fallbacks; rename param.

  • Label buttons with the active currency (not “$”).
  • Remove unnecessary || "USD" since currency is required here.
  • Rename usdAmountfiatAmount for clarity.
-const handleQuickAmount = (usdAmount: number) => {
-  const price = destinationToken.prices[currency || "USD"] || 0;
+const handleQuickAmount = (fiatAmount: number) => {
+  const price = destinationToken.prices[currency] ?? 0;
   if (price === 0) {
     return;
   }
-  const tokenAmount = usdAmount / price;
+  const tokenAmount = fiatAmount / price;
   const formattedAmount = numberToPlainString(
     Number.parseFloat(tokenAmount.toFixed(6)),
   );
   setAmount(formattedAmount);
 };
...
-                {formatCurrencyAmount(
-                  currency || "USD",
-                  Number(amount) *
-                    (destinationToken.prices[currency || "USD"] || 0),
-                )}
+                {formatCurrencyAmount(
+                  currency,
+                  Number(amount) * (destinationToken.prices[currency] ?? 0),
+                )}
...
-              {presetOptions?.map((amount) => (
+              {presetOptions?.map((fiat) => (
                 <Button
-                  key={amount}
-                  onClick={() => handleQuickAmount(Number(amount))}
+                  key={fiat}
+                  onClick={() => handleQuickAmount(Number(fiat))}
                   style={{
                     backgroundColor: theme.colors.tertiaryBg,
                     flex: 1,
                     fontSize: fontSize.sm,
                     borderRadius: radius.lg,
                     padding: `${spacing.sm} ${spacing.md}`,
                   }}
                   variant="outline"
                 >
-                  ${amount}
+                  {formatCurrencyAmount(currency, fiat)}
                 </Button>
               ))}

Also applies to: 268-271, 289-305

packages/thirdweb/src/react/web/ui/Bridge/payment-selection/PaymentSelection.tsx (1)

107-123: Add explicit return type and comprehensive TSDoc.

The exported PaymentSelection function is missing:

  1. An explicit return type annotation
  2. Comprehensive TSDoc with at least one compiling @example and a custom tag (@beta, @internal, @experimental, etc.)

As per coding guidelines for packages/thirdweb/**/*.{ts,tsx}, every public symbol must have TSDoc documentation.

Apply this diff to add the return type and TSDoc:

+/**
+ * PaymentSelection component allows users to choose and configure their payment method
+ * for bridging tokens to a destination chain.
+ * 
+ * @param props - The payment selection configuration
+ * @returns A React component for payment method selection
+ * 
+ * @example
+ * ```tsx
+ * import { PaymentSelection } from "thirdweb/react";
+ * import { createThirdwebClient } from "thirdweb";
+ * 
+ * const client = createThirdwebClient({ clientId: "..." });
+ * 
+ * function MyBridge() {
+ *   return (
+ *     <PaymentSelection
+ *       destinationToken={{ chainId: 137, address: "0x...", decimals: 18 }}
+ *       destinationAmount="100"
+ *       receiverAddress="0x..."
+ *       client={client}
+ *       onPaymentMethodSelected={(method) => console.log(method)}
+ *       onError={(error) => console.error(error)}
+ *       onBack={() => console.log("back")}
+ *       connectOptions={{}}
+ *       connectLocale={{}}
+ *       paymentMethods={["crypto", "card"]}
+ *       currency="USD"
+ *       includeDestinationToken={false}
+ *       feePayer={undefined}
+ *       country={undefined}
+ *       supportedTokens={undefined}
+ *     />
+ *   );
+ * }
+ * ```
+ * 
+ * @internal
+ */
 export function PaymentSelection({
   destinationToken,
   client,
   destinationAmount,
   receiverAddress,
   onPaymentMethodSelected,
   onError,
   onBack,
   connectOptions,
   connectLocale,
   includeDestinationToken,
   paymentMethods,
   supportedTokens,
   feePayer,
   currency,
   country,
-}: PaymentSelectionProps) {
+}: PaymentSelectionProps): JSX.Element {

As per coding guidelines.

♻️ Duplicate comments (3)
packages/thirdweb/src/react/web/ui/Bridge/TransactionWidget.tsx (1)

359-370: Guard spreading connectOptions when branding is disabled.

When showThirdwebBranding is false and props.connectOptions is undefined (the default), spreading ...props.connectOptions throws TypeError: Cannot convert undefined or null to object, so the widget never renders. Please stage a safe fallback before spreading.

   const connectOptions = useMemo(() => {
     if (props.showThirdwebBranding === false) {
-      return {
-        ...props.connectOptions,
-        connectModal: {
-          ...props.connectOptions?.connectModal,
-          showThirdwebBranding: props.showThirdwebBranding,
-        },
-      };
+      const baseConnectOptions =
+        props.connectOptions ?? ({} as TransactionWidgetConnectOptions);
+      const baseConnectModal = baseConnectOptions.connectModal ?? {};
+      return {
+        ...baseConnectOptions,
+        connectModal: {
+          ...baseConnectModal,
+          showThirdwebBranding: props.showThirdwebBranding,
+        },
+      };
     }
     return props.connectOptions;
   }, [props.connectOptions, props.showThirdwebBranding]);
packages/thirdweb/src/react/web/ui/Bridge/CheckoutWidget.tsx (1)

383-401: Handle token lookup errors; don’t render an empty shell.

On failed useTokenQuery, we drop to return null. Reuse ErrorBanner with Retry/Cancel (as previously requested).

   } else if (tokenQuery.data?.type === "success") {
     return (
       <CheckoutWidgetContent
         {...props}
         connectLocale={localQuery.data}
         destinationToken={tokenQuery.data.token}
         currency={props.currency || "USD"}
         paymentMethods={props.paymentMethods || ["crypto", "card"]}
         connectOptions={connectOptions}
         showThirdwebBranding={
           props.showThirdwebBranding === undefined
             ? true
             : props.showThirdwebBranding
         }
       />
     );
   }
 
-  return null;
+  if (tokenQuery.isError) {
+    return (
+      <ErrorBanner
+        client={props.client}
+        error={tokenQuery.error as Error}
+        onRetry={() => tokenQuery.refetch()}
+        onCancel={() => props.onCancel?.(undefined)}
+      />
+    );
+  }
+  return null;
packages/thirdweb/src/react/web/ui/Bridge/FundWallet.tsx (1)

95-107: Add explicit return type and TSDoc on exported component.

Public exports in packages/thirdweb require TSDoc and an explicit return type. Add a brief TSDoc with an example and annotate the return as React.JSX.Element.

As per coding guidelines.

+/**
+ * Component for funding a wallet with tokens using fiat or crypto.
+ * @param props - FundWalletProps
+ * @returns React component
+ * @example
+ * ```tsx
+ * <FundWallet
+ *   client={client}
+ *   destinationToken={token}
+ *   currency="USD"
+ *   metadata={{ title: "Fund", description: "Add funds", image: undefined }}
+ *   onContinue={() => {}}
+ *   presetOptions={[5, 10, 20]}
+ *   connectOptions={undefined}
+ *   showThirdwebBranding
+ * />
+ * ```
+ * @internal
+ */
 export function FundWallet({
   client,
   receiverAddress,
   onContinue,
   presetOptions,
   connectOptions,
   showThirdwebBranding,
   initialAmount,
   destinationToken,
   currency,
   buttonLabel,
   metadata,
-}: FundWalletProps) {
+}: FundWalletProps): React.JSX.Element {
🧹 Nitpick comments (5)
packages/thirdweb/src/react/web/ui/Bridge/FundWallet.tsx (1)

350-367: Polish button label when amount is empty.

Avoid “Buy 0 TOKEN” before input. Use token-only label if amount is falsy.

-  {buttonLabel || `Buy ${amount} ${destinationToken.symbol}`}
+  {buttonLabel ||
+    (amount ? `Buy ${amount} ${destinationToken.symbol}` : `Buy ${destinationToken.symbol}`)}
packages/thirdweb/src/react/web/ui/Bridge/BuyWidget.tsx (2)

375-416: Surface token lookup failures instead of returning null.

When useTokenQuery errors (non-unsupported cases), the wrapper falls through to null. Render ErrorBanner with Retry and Cancel.

   } else if (tokenQuery.data?.type === "success") {
     return (
       <BridgeWidgetContent
         {...props}
         connectLocale={localQuery.data}
         destinationToken={tokenQuery.data.token}
         currency={props.currency || "USD"}
         paymentMethods={props.paymentMethods || ["crypto", "card"]}
         presetOptions={props.presetOptions || [5, 10, 20]}
         connectOptions={connectOptions}
         showThirdwebBranding={
           props.showThirdwebBranding === undefined
             ? true
             : props.showThirdwebBranding
         }
       />
     );
   }
 
-  return null;
+  if (tokenQuery.isError) {
+    return (
+      <ErrorBanner
+        client={props.client}
+        error={tokenQuery.error as Error}
+        onRetry={() => tokenQuery.refetch()}
+        onCancel={() => props.onCancel?.(undefined)}
+      />
+    );
+  }
+  return null;

375-388: Optional: fallback locale if Connect locale fails.

If localQuery.isError, fall back to "en_US" to avoid indefinite spinner.

- if (tokenQuery.isPending || !localQuery.data) {
+ if (tokenQuery.isPending || (!localQuery.data && !localQuery.isError)) {
    ...
- } else if (tokenQuery.data?.type === "unsupported_token") {
+ } else if (localQuery.isError) {
+   // proceed with default locale if needed
+   // e.g., const fallbackLocale = getConnectLocaleSync("en_US");
+   // or render content with a minimal copy
+   // Keep as a TODO if sync API not available
+ }
packages/thirdweb/src/react/web/ui/Bridge/CheckoutWidget.tsx (1)

486-514: Nit: name the first screen “buy-ui”/“start” for parity.

Align screen ids with BuyWidget (“1:buy-ui”) for consistency.

-  | { id: "1:init-ui" }
+  | { id: "1:buy-ui" }
packages/thirdweb/src/react/web/ui/Bridge/payment-selection/PaymentSelection.tsx (1)

212-214: Remove dead code: fallback for required prop.

The currency prop is now required (line 91), so the fallback || "USD" on line 213 is dead code and will never execute.

Apply this diff to remove the unnecessary fallback:

     const fiatPaymentMethod: PaymentMethod = {
-      currency: currency || "USD",
+      currency,
       onramp: provider,
       payerWallet,
       type: "fiat",
     };
📜 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 ff2e53e and b4a82a3.

📒 Files selected for processing (5)
  • packages/thirdweb/src/react/web/ui/Bridge/BuyWidget.tsx (5 hunks)
  • packages/thirdweb/src/react/web/ui/Bridge/CheckoutWidget.tsx (6 hunks)
  • packages/thirdweb/src/react/web/ui/Bridge/FundWallet.tsx (9 hunks)
  • packages/thirdweb/src/react/web/ui/Bridge/TransactionWidget.tsx (7 hunks)
  • packages/thirdweb/src/react/web/ui/Bridge/payment-selection/PaymentSelection.tsx (5 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.{ts,tsx}: Write idiomatic TypeScript with explicit function declarations and return types
Limit each file to one stateless, single-responsibility function for clarity
Re-use shared types from @/types or local types.ts barrels
Prefer type aliases over interface except for nominal shapes
Avoid any and unknown unless unavoidable; narrow generics when possible
Choose composition over inheritance; leverage utility types (Partial, Pick, etc.)
Comment only ambiguous logic; avoid restating TypeScript in prose

**/*.{ts,tsx}: Use explicit function declarations and explicit return types in TypeScript
Limit each file to one stateless, single‑responsibility function
Re‑use shared types from @/types where applicable
Prefer type aliases over interface except for nominal shapes
Avoid any and unknown unless unavoidable; narrow generics when possible
Prefer composition over inheritance; use utility types (Partial, Pick, etc.)
Lazy‑import optional features and avoid top‑level side‑effects to reduce bundle size

Files:

  • packages/thirdweb/src/react/web/ui/Bridge/BuyWidget.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/FundWallet.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/payment-selection/PaymentSelection.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/CheckoutWidget.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/TransactionWidget.tsx
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (CLAUDE.md)

Load heavy dependencies inside async paths to keep initial bundle lean (lazy loading)

Files:

  • packages/thirdweb/src/react/web/ui/Bridge/BuyWidget.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/FundWallet.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/payment-selection/PaymentSelection.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/CheckoutWidget.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/TransactionWidget.tsx
packages/thirdweb/**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

packages/thirdweb/**/*.{ts,tsx}: Every public symbol must have comprehensive TSDoc with at least one compiling @example and a custom tag (@beta, @internal, @experimental, etc.)
Comment only ambiguous logic; avoid restating TypeScript in prose
Lazy‑load heavy dependencies inside async paths (e.g., const { jsPDF } = await import("jspdf"))

Files:

  • packages/thirdweb/src/react/web/ui/Bridge/BuyWidget.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/FundWallet.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/payment-selection/PaymentSelection.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/CheckoutWidget.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/TransactionWidget.tsx
🧠 Learnings (3)
📚 Learning: 2025-09-24T11:08:43.783Z
Learnt from: MananTank
PR: thirdweb-dev/js#8106
File: packages/thirdweb/src/react/web/ui/Bridge/bridge-widget/bridge-widget.tsx:34-41
Timestamp: 2025-09-24T11:08:43.783Z
Learning: In BridgeWidgetProps for packages/thirdweb/src/react/web/ui/Bridge/bridge-widget/bridge-widget.tsx, the Swap onError callback signature requires a non-undefined SwapPreparedQuote parameter (unlike Buy's onError which allows undefined quote). This is intentional - SwapWidget's onError is only called when a quote is available.

Applied to files:

  • packages/thirdweb/src/react/web/ui/Bridge/BuyWidget.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/TransactionWidget.tsx
📚 Learning: 2025-07-18T19:20:32.530Z
Learnt from: CR
PR: thirdweb-dev/js#0
File: .cursor/rules/dashboard.mdc:0-0
Timestamp: 2025-07-18T19:20:32.530Z
Learning: Applies to dashboard/**/*client.tsx : Interactive UI that relies on hooks (`useState`, `useEffect`, React Query, wallet hooks).

Applied to files:

  • packages/thirdweb/src/react/web/ui/Bridge/BuyWidget.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/CheckoutWidget.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/TransactionWidget.tsx
📚 Learning: 2025-07-18T19:20:32.530Z
Learnt from: CR
PR: thirdweb-dev/js#0
File: .cursor/rules/dashboard.mdc:0-0
Timestamp: 2025-07-18T19:20:32.530Z
Learning: Applies to dashboard/**/*client.tsx : Anything that consumes hooks from `tanstack/react-query` or thirdweb SDKs.

Applied to files:

  • packages/thirdweb/src/react/web/ui/Bridge/BuyWidget.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/CheckoutWidget.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/TransactionWidget.tsx
🧬 Code graph analysis (5)
packages/thirdweb/src/react/web/ui/Bridge/BuyWidget.tsx (16)
packages/thirdweb/src/react/web/ui/ConnectWallet/locale/getConnectLocale.ts (1)
  • useConnectLocale (45-54)
packages/thirdweb/src/react/web/ui/Bridge/common/token-query.ts (1)
  • useTokenQuery (13-45)
packages/thirdweb/src/bridge/types/Token.ts (1)
  • TokenWithPrices (14-16)
packages/thirdweb/src/react/core/machines/paymentMachine.ts (1)
  • PaymentMethod (22-36)
packages/thirdweb/src/react/core/hooks/useBridgePrepare.ts (2)
  • BridgePrepareResult (23-27)
  • BridgePrepareRequest (14-18)
packages/thirdweb/src/react/core/hooks/useStepExecutor.ts (1)
  • CompletedStatusResult (19-26)
packages/thirdweb/src/react/web/ui/Bridge/FundWallet.tsx (1)
  • FundWallet (95-388)
packages/thirdweb/src/react/web/ui/Bridge/payment-selection/PaymentSelection.tsx (1)
  • PaymentSelection (107-332)
packages/thirdweb/src/react/web/ui/Bridge/QuoteLoader.tsx (1)
  • QuoteLoader (83-164)
packages/thirdweb/src/react/web/ui/Bridge/payment-details/PaymentDetails.tsx (1)
  • PaymentDetails (64-451)
packages/thirdweb/src/react/web/ui/Bridge/StepRunner.tsx (1)
  • StepRunner (75-426)
packages/thirdweb/src/react/web/adapters/WindowAdapter.ts (1)
  • webWindowAdapter (23-23)
packages/thirdweb/src/react/web/ui/Bridge/payment-success/SuccessScreen.tsx (1)
  • SuccessScreen (53-199)
packages/thirdweb/src/react/web/ui/Bridge/ErrorBanner.tsx (1)
  • ErrorBanner (31-107)
packages/thirdweb/src/react/web/ui/ConnectWallet/Modal/ConnectEmbed.tsx (1)
  • EmbedContainer (459-485)
packages/thirdweb/src/react/web/ui/components/DynamicHeight.tsx (1)
  • DynamicHeight (8-33)
packages/thirdweb/src/react/web/ui/Bridge/FundWallet.tsx (4)
packages/thirdweb/src/react/web/ui/PayEmbed.tsx (1)
  • PayEmbedConnectOptions (431-541)
packages/thirdweb/src/bridge/types/Token.ts (1)
  • TokenWithPrices (14-16)
packages/thirdweb/src/pay/convert/type.ts (1)
  • SupportedFiatCurrency (27-27)
packages/thirdweb/src/react/web/ui/Bridge/common/TokenAndChain.tsx (1)
  • TokenAndChain (22-99)
packages/thirdweb/src/react/web/ui/Bridge/payment-selection/PaymentSelection.tsx (2)
packages/thirdweb/src/react/web/ui/PayEmbed.tsx (1)
  • PayEmbedConnectOptions (431-541)
packages/thirdweb/src/pay/convert/type.ts (1)
  • SupportedFiatCurrency (27-27)
packages/thirdweb/src/react/web/ui/Bridge/CheckoutWidget.tsx (15)
packages/thirdweb/src/react/core/hooks/useBridgePrepare.ts (2)
  • BridgePrepareResult (23-27)
  • BridgePrepareRequest (14-18)
packages/thirdweb/src/react/web/ui/ConnectWallet/locale/getConnectLocale.ts (1)
  • useConnectLocale (45-54)
packages/thirdweb/src/react/web/ui/Bridge/common/token-query.ts (1)
  • useTokenQuery (13-45)
packages/thirdweb/src/bridge/types/Token.ts (1)
  • TokenWithPrices (14-16)
packages/thirdweb/src/react/core/machines/paymentMachine.ts (1)
  • PaymentMethod (22-36)
packages/thirdweb/src/react/core/hooks/useStepExecutor.ts (1)
  • CompletedStatusResult (19-26)
packages/thirdweb/src/react/web/ui/Bridge/DirectPayment.tsx (1)
  • DirectPayment (48-205)
packages/thirdweb/src/react/web/ui/Bridge/payment-selection/PaymentSelection.tsx (1)
  • PaymentSelection (107-332)
packages/thirdweb/src/react/web/ui/Bridge/QuoteLoader.tsx (1)
  • QuoteLoader (83-164)
packages/thirdweb/src/react/web/ui/Bridge/payment-details/PaymentDetails.tsx (1)
  • PaymentDetails (64-451)
packages/thirdweb/src/react/web/ui/Bridge/StepRunner.tsx (1)
  • StepRunner (75-426)
packages/thirdweb/src/react/web/adapters/WindowAdapter.ts (1)
  • webWindowAdapter (23-23)
packages/thirdweb/src/react/web/ui/Bridge/payment-success/SuccessScreen.tsx (1)
  • SuccessScreen (53-199)
packages/thirdweb/src/react/web/ui/Bridge/ErrorBanner.tsx (1)
  • ErrorBanner (31-107)
packages/thirdweb/src/react/web/ui/ConnectWallet/Modal/ConnectEmbed.tsx (1)
  • EmbedContainer (459-485)
packages/thirdweb/src/react/web/ui/Bridge/TransactionWidget.tsx (17)
packages/thirdweb/src/transaction/actions/wait-for-tx-receipt.ts (1)
  • WaitForReceiptOptions (14-20)
packages/thirdweb/src/react/web/ui/ConnectWallet/locale/getConnectLocale.ts (1)
  • useConnectLocale (45-54)
packages/thirdweb/src/react/web/ui/Bridge/common/token-query.ts (1)
  • useTokenQuery (13-45)
packages/thirdweb/src/bridge/types/Token.ts (1)
  • TokenWithPrices (14-16)
packages/thirdweb/src/react/core/machines/paymentMachine.ts (1)
  • PaymentMethod (22-36)
packages/thirdweb/src/react/core/hooks/useBridgePrepare.ts (2)
  • BridgePrepareResult (23-27)
  • BridgePrepareRequest (14-18)
packages/thirdweb/src/react/core/hooks/useStepExecutor.ts (1)
  • CompletedStatusResult (19-26)
packages/thirdweb/src/react/web/ui/Bridge/TransactionPayment.tsx (1)
  • TransactionPayment (80-445)
packages/thirdweb/src/react/web/ui/Bridge/payment-selection/PaymentSelection.tsx (1)
  • PaymentSelection (107-332)
packages/thirdweb/src/react/web/ui/Bridge/QuoteLoader.tsx (1)
  • QuoteLoader (83-164)
packages/thirdweb/src/react/web/ui/Bridge/payment-details/PaymentDetails.tsx (1)
  • PaymentDetails (64-451)
packages/thirdweb/src/react/web/ui/Bridge/StepRunner.tsx (1)
  • StepRunner (75-426)
packages/thirdweb/src/react/web/adapters/WindowAdapter.ts (1)
  • webWindowAdapter (23-23)
packages/thirdweb/src/react/web/ui/Bridge/payment-success/SuccessScreen.tsx (1)
  • SuccessScreen (53-199)
packages/thirdweb/src/react/web/ui/Bridge/ErrorBanner.tsx (1)
  • ErrorBanner (31-107)
packages/thirdweb/src/react/web/ui/TransactionButton/ExecutingScreen.tsx (1)
  • ExecutingTxScreen (19-183)
packages/thirdweb/src/react/web/ui/ConnectWallet/Modal/ConnectEmbed.tsx (1)
  • EmbedContainer (459-485)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (8)
  • GitHub Check: E2E Tests (pnpm, esbuild)
  • GitHub Check: Size
  • GitHub Check: E2E Tests (pnpm, vite)
  • GitHub Check: E2E Tests (pnpm, webpack)
  • GitHub Check: Unit Tests
  • GitHub Check: Lint Packages
  • GitHub Check: Build Packages
  • GitHub Check: Analyze (javascript)
🔇 Additional comments (4)
packages/thirdweb/src/react/web/ui/Bridge/BuyWidget.tsx (1)

361-373: Branding override preserves consumer config. LGTM.

Only overrides connectModal.showThirdwebBranding when the widget explicitly sets showThirdwebBranding === false. Good.

packages/thirdweb/src/react/web/ui/Bridge/FundWallet.tsx (1)

189-190: No stray quote: textOverflow value is properly quoted
Verified that textOverflow: "ellipsis" in TokenAndChain.tsx (line 82) uses matching quotes—no build break risk.

Likely an incorrect or invalid review comment.

packages/thirdweb/src/react/web/ui/Bridge/payment-selection/PaymentSelection.tsx (2)

26-26: Dropping the export on PaymentSelectionProps is safe; no imports or type‐references exist outside its own file.

Likely an incorrect or invalid review comment.


40-40: Ensure all PaymentSelection usages supply new required props

Widgets correctly pass receiverAddress, onBack, paymentMethods and currency, but the Storybook example only provides client and onBack. Update the story (and any other call sites) to include the newly required props—or add sensible defaults—to avoid runtime errors.

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: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (3)
packages/thirdweb/src/react/web/ui/TransactionButton/DepositScreen.tsx (2)

77-82: Add an explicit return type.

The function lacks an explicit return type. Per coding guidelines, TypeScript functions should declare return types explicitly.

As per coding guidelines.

Apply this diff:

-export function DepositScreen(props: {
+export function DepositScreen(props: {
   connectLocale: ConnectLocale;
   client: ThirdwebClient;
   tx: PreparedTransaction;
   onDone: () => void;
-}) {
+}): React.JSX.Element {

77-82: Add explicit return type to DepositScreen. Per coding guidelines, functions must declare a return type; update its signature to export function DepositScreen(props: …): JSX.Element { … }.

packages/thirdweb/src/stories/Bridge/fixtures.ts (1)

313-371: Unify token price shape: use prices: { USD } instead of priceUsd

Several fixtures define token prices as priceUsd, while others use prices: { USD: ... }. Downstream UI expects a consistent shape; the mismatch can break fiat displays.

Standardize all occurrences to prices: { USD: <number> }.

Example change:

-          name: "Ethereum",
-          priceUsd: 2500.0,
+          name: "Ethereum",
+          prices: { USD: 2500.0 },

Apply similarly to all tokens in these quotes.

Also applies to: 373-438, 442-594

♻️ Duplicate comments (1)
packages/thirdweb/src/react/web/ui/Bridge/TransactionWidget.tsx (1)

412-423: ** Prevent runtime crash when spreading undefined connectModal.**

If props.connectOptions.connectModal is undefined, spreading it at line 417 throws TypeError: Cannot convert undefined or null to object, breaking the widget before any UI renders. Guard with a fallback object.

Apply this diff to fix:

   const connectOptions = useMemo(() => {
     if (props.showThirdwebBranding === false) {
       return {
         ...props.connectOptions,
         connectModal: {
-          ...props.connectOptions?.connectModal,
+          ...(props.connectOptions?.connectModal ?? {}),
           showThirdwebBranding: props.showThirdwebBranding,
         },
       };
     }
     return props.connectOptions;
   }, [props.connectOptions, props.showThirdwebBranding]);
🧹 Nitpick comments (12)
packages/thirdweb/src/stories/Bridge/Transaction/useSendTransactionModal.stories.tsx (1)

25-39: Disable during pending and use testnet/smaller amount for safety

Avoid duplicate submits and accidental large-value mainnet sends in Storybook. Consider Base Sepolia and a tiny amount; also disable while pending.

-import { base } from "../../../chains/chain-definitions/base.js";
+import { baseSepolia } from "../../../chains/chain-definitions/base-sepolia.js";
@@
-    <Button
+    <Button
       variant="primary"
+      disabled={sendTx.isPending}
       onClick={() => {
         const sendFunds = prepareTransaction({
-          chain: base,
+          chain: baseSepolia,
           client: storyClient,
           to: "0x83Dd93fA5D8343094f850f90B3fb90088C1bB425",
-          value: toWei("100"),
+          value: toWei("0.001"),
         });
 
         sendTx.mutate(sendFunds);
       }}
     >
-      {sendTx.isPending ? "Sending..." : "Send 100 Base ETH"}
+      {sendTx.isPending ? "Sending..." : "Send 0.001 Base Sepolia ETH"}
     </Button>
packages/thirdweb/src/react/web/ui/TransactionButton/TransactionModal.tsx (2)

89-123: Tidy up wrapper props and clarify onComplete semantics

  • You pass several props as undefined to TransactionWidgetContentWrapper; they can be omitted.
  • onComplete exists on ModalProps but isn’t used. Either remove it from the public surface or document when it should fire to avoid confusion.

Minimal prop cleanup:

   return (
     <TransactionWidgetContentWrapper
       client={props.client}
       country={props.country}
       currency={props.currency}
       transaction={props.tx}
       onCancel={props.onClose}
       locale={props.localeId}
       onSuccess={(data) => {
         props.onTxSent(data);
       }}
       title={props.payOptions.metadata?.name}
       description={props.payOptions.metadata?.description}
       image={props.payOptions.metadata?.image}
       paymentMethods={
         props.payOptions.buyWithCrypto === false
           ? ["card"]
           : props.payOptions.buyWithFiat === false
             ? ["crypto"]
             : ["crypto", "card"]
       }
       showThirdwebBranding={props.payOptions.showThirdwebBranding}
       supportedTokens={props.supportedTokens}
-      onError={undefined}
-      paymentLinkId={undefined}
-      buttonLabel={undefined}
-      purchaseData={undefined}
     />
   );

41-87: Consider adding TSDoc for TransactionModal (public symbol)

If exported from the package’s public surface, add TSDoc with an example and stability tag (@beta/@internal) per package guidelines.

packages/thirdweb/src/react/web/ui/Bridge/BuyWidget.tsx (4)

349-360: Avoid re-firing analytics on window focus/mount re-renders

React Query refetches on window focus by default; this will re-trigger trackPayEvent. Disable refetch for this tracking-only query.

Apply this diff:

   useQuery({
     queryFn: () => {
       trackPayEvent({
         client: props.client,
         event: "ub:ui:buy_widget:render",
         toChainId: props.chain.id,
         toToken: props.tokenAddress,
       });
       return true;
     },
-    queryKey: ["buy_widget:render"],
+    queryKey: ["buy_widget:render"],
+    refetchOnMount: false,
+    refetchOnWindowFocus: false,
+    refetchOnReconnect: false,
   });

520-527: Use functional state updates to avoid stale closures in transitions

setScreen({...screen, ...}) can read stale state under quick successive updates. Prefer functional updates.

Apply this diff and replicate for other setScreen calls:

-        onContinue={(destinationAmount, destinationToken, receiverAddress) => {
-          setScreen({
-            id: "2:methodSelection",
-            destinationAmount,
-            destinationToken,
-            receiverAddress,
-          });
-        }}
+        onContinue={(destinationAmount, destinationToken, receiverAddress) => {
+          setScreen(() => ({
+            id: "2:methodSelection",
+            destinationAmount,
+            destinationToken,
+            receiverAddress,
+          }));
+        }}

627-637: Minor: drop explicit undefined props

Passing confirmButtonLabel={undefined} is redundant; removing it simplifies the call.

-        confirmButtonLabel={undefined}

656-664: Minor: drop explicit undefined props

Passing title={undefined} to StepRunner is unnecessary; remove for clarity.

-        title={undefined}
packages/thirdweb/src/react/web/ui/Bridge/StepRunner.tsx (1)

175-188: Nit: simplify background color helper

getStepBackgroundColor returns the same value for all statuses; inline or collapse the switch.

-  const getStepBackgroundColor = (
-    status: "pending" | "executing" | "completed" | "failed",
-  ) => {
-    switch (status) {
-      case "completed":
-        return theme.colors.tertiaryBg;
-      case "executing":
-        return theme.colors.tertiaryBg;
-      case "failed":
-        return theme.colors.tertiaryBg;
-      default:
-        return theme.colors.tertiaryBg;
-    }
-  };
+  const getStepBackgroundColor = () => theme.colors.tertiaryBg;
packages/thirdweb/src/react/web/ui/Bridge/DirectPayment.tsx (1)

18-46: Consider making showThirdwebBranding optional in the type to match the component default.

The type requires showThirdwebBranding: boolean (line 45), but the component provides a default value = true (line 53). For consistency, consider either making the type optional (showThirdwebBranding?: boolean) or removing the default from the component signature. Current code works but mixing required types with defaults is less conventional.

packages/thirdweb/src/stories/Bridge/Transaction/TransactionWidget.stories.tsx (3)

1-8: Wire callbacks to Storybook actions for visibility

Use addon-actions so interactions are observable in the UI.

+import { action } from "@storybook/addon-actions";

9-20: Prefer satisfies Meta<...> and add autodocs; use actions for callbacks

Improves type safety, docs, and interactive logging. As per coding guidelines.

-const meta: Meta<typeof StoryVariant> = {
-  args: {
-    client: storyClient,
-    onSuccess: () => {},
-    onError: () => {},
-    onCancel: () => {},
-    currency: "USD",
-    ...TRANSACTION_UI_OPTIONS.ethTransfer,
-  },
-  component: StoryVariant,
-  title: "Bridge/Transaction/TransactionWidget",
-};
+const meta = {
+  args: {
+    client: storyClient,
+    onSuccess: action("onSuccess"),
+    onError: action("onError"),
+    onCancel: action("onCancel"),
+    currency: "USD",
+    ...TRANSACTION_UI_OPTIONS.ethTransfer,
+  },
+  component: StoryVariant,
+  title: "Bridge/Transaction/TransactionWidget",
+  tags: ["autodocs"],
+} satisfies Meta<typeof StoryVariant>;

49-63: Add explicit return type to comply with TS guidelines

Keeps story TS strict and consistent. As per coding guidelines.

-function StoryVariant(props: TransactionWidgetProps) {
+function StoryVariant(props: TransactionWidgetProps): JSX.Element {
   return (
     <div
       style={{
         display: "flex",
         flexDirection: "column",
         gap: "40px",
         alignItems: "center",
       }}
     >
       <TransactionWidget {...props} theme="dark" />
       <TransactionWidget {...props} theme="light" />
     </div>
   );
}
📜 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 b4a82a3 and c2a9024.

📒 Files selected for processing (24)
  • apps/playground-web/src/app/payments/components/RightSection.tsx (0 hunks)
  • packages/thirdweb/src/react/web/ui/Bridge/BuyWidget.tsx (5 hunks)
  • packages/thirdweb/src/react/web/ui/Bridge/CheckoutWidget.tsx (6 hunks)
  • packages/thirdweb/src/react/web/ui/Bridge/DirectPayment.tsx (5 hunks)
  • packages/thirdweb/src/react/web/ui/Bridge/StepRunner.tsx (3 hunks)
  • packages/thirdweb/src/react/web/ui/Bridge/TransactionPayment.tsx (10 hunks)
  • packages/thirdweb/src/react/web/ui/Bridge/TransactionWidget.tsx (8 hunks)
  • packages/thirdweb/src/react/web/ui/Bridge/types.ts (1 hunks)
  • packages/thirdweb/src/react/web/ui/TransactionButton/DepositScreen.tsx (1 hunks)
  • packages/thirdweb/src/react/web/ui/TransactionButton/TransactionModal.tsx (6 hunks)
  • packages/thirdweb/src/stories/Bridge/CheckoutWidget.stories.tsx (1 hunks)
  • packages/thirdweb/src/stories/Bridge/DirectPayment.stories.tsx (0 hunks)
  • packages/thirdweb/src/stories/Bridge/ErrorBanner.stories.tsx (2 hunks)
  • packages/thirdweb/src/stories/Bridge/FundWallet.stories.tsx (0 hunks)
  • packages/thirdweb/src/stories/Bridge/PaymentDetails.stories.tsx (2 hunks)
  • packages/thirdweb/src/stories/Bridge/PaymentSelection.stories.tsx (1 hunks)
  • packages/thirdweb/src/stories/Bridge/StepRunner.stories.tsx (1 hunks)
  • packages/thirdweb/src/stories/Bridge/SuccessScreen.stories.tsx (2 hunks)
  • packages/thirdweb/src/stories/Bridge/Transaction/TransactionWidget.stories.tsx (1 hunks)
  • packages/thirdweb/src/stories/Bridge/Transaction/useSendTransactionModal.stories.tsx (1 hunks)
  • packages/thirdweb/src/stories/Bridge/TransactionPayment.stories.tsx (0 hunks)
  • packages/thirdweb/src/stories/Bridge/UnsupportedTokenScreen.stories.tsx (1 hunks)
  • packages/thirdweb/src/stories/Bridge/fixtures.ts (9 hunks)
  • packages/thirdweb/src/stories/BuyWidget.stories.tsx (3 hunks)
💤 Files with no reviewable changes (4)
  • apps/playground-web/src/app/payments/components/RightSection.tsx
  • packages/thirdweb/src/stories/Bridge/DirectPayment.stories.tsx
  • packages/thirdweb/src/stories/Bridge/FundWallet.stories.tsx
  • packages/thirdweb/src/stories/Bridge/TransactionPayment.stories.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/thirdweb/src/react/web/ui/Bridge/types.ts
🧰 Additional context used
📓 Path-based instructions (4)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.{ts,tsx}: Write idiomatic TypeScript with explicit function declarations and return types
Limit each file to one stateless, single-responsibility function for clarity
Re-use shared types from @/types or local types.ts barrels
Prefer type aliases over interface except for nominal shapes
Avoid any and unknown unless unavoidable; narrow generics when possible
Choose composition over inheritance; leverage utility types (Partial, Pick, etc.)
Comment only ambiguous logic; avoid restating TypeScript in prose

**/*.{ts,tsx}: Use explicit function declarations and explicit return types in TypeScript
Limit each file to one stateless, single‑responsibility function
Re‑use shared types from @/types where applicable
Prefer type aliases over interface except for nominal shapes
Avoid any and unknown unless unavoidable; narrow generics when possible
Prefer composition over inheritance; use utility types (Partial, Pick, etc.)
Lazy‑import optional features and avoid top‑level side‑effects to reduce bundle size

Files:

  • packages/thirdweb/src/stories/Bridge/Transaction/TransactionWidget.stories.tsx
  • packages/thirdweb/src/stories/BuyWidget.stories.tsx
  • packages/thirdweb/src/react/web/ui/TransactionButton/TransactionModal.tsx
  • packages/thirdweb/src/stories/Bridge/UnsupportedTokenScreen.stories.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/StepRunner.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/BuyWidget.tsx
  • packages/thirdweb/src/react/web/ui/TransactionButton/DepositScreen.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/TransactionPayment.tsx
  • packages/thirdweb/src/stories/Bridge/ErrorBanner.stories.tsx
  • packages/thirdweb/src/stories/Bridge/CheckoutWidget.stories.tsx
  • packages/thirdweb/src/stories/Bridge/Transaction/useSendTransactionModal.stories.tsx
  • packages/thirdweb/src/stories/Bridge/SuccessScreen.stories.tsx
  • packages/thirdweb/src/stories/Bridge/PaymentDetails.stories.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/CheckoutWidget.tsx
  • packages/thirdweb/src/stories/Bridge/fixtures.ts
  • packages/thirdweb/src/stories/Bridge/StepRunner.stories.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/TransactionWidget.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/DirectPayment.tsx
  • packages/thirdweb/src/stories/Bridge/PaymentSelection.stories.tsx
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (CLAUDE.md)

Load heavy dependencies inside async paths to keep initial bundle lean (lazy loading)

Files:

  • packages/thirdweb/src/stories/Bridge/Transaction/TransactionWidget.stories.tsx
  • packages/thirdweb/src/stories/BuyWidget.stories.tsx
  • packages/thirdweb/src/react/web/ui/TransactionButton/TransactionModal.tsx
  • packages/thirdweb/src/stories/Bridge/UnsupportedTokenScreen.stories.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/StepRunner.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/BuyWidget.tsx
  • packages/thirdweb/src/react/web/ui/TransactionButton/DepositScreen.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/TransactionPayment.tsx
  • packages/thirdweb/src/stories/Bridge/ErrorBanner.stories.tsx
  • packages/thirdweb/src/stories/Bridge/CheckoutWidget.stories.tsx
  • packages/thirdweb/src/stories/Bridge/Transaction/useSendTransactionModal.stories.tsx
  • packages/thirdweb/src/stories/Bridge/SuccessScreen.stories.tsx
  • packages/thirdweb/src/stories/Bridge/PaymentDetails.stories.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/CheckoutWidget.tsx
  • packages/thirdweb/src/stories/Bridge/fixtures.ts
  • packages/thirdweb/src/stories/Bridge/StepRunner.stories.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/TransactionWidget.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/DirectPayment.tsx
  • packages/thirdweb/src/stories/Bridge/PaymentSelection.stories.tsx
**/*.stories.tsx

📄 CodeRabbit inference engine (CLAUDE.md)

For new UI components, add Storybook stories (*.stories.tsx) alongside the code

Files:

  • packages/thirdweb/src/stories/Bridge/Transaction/TransactionWidget.stories.tsx
  • packages/thirdweb/src/stories/BuyWidget.stories.tsx
  • packages/thirdweb/src/stories/Bridge/UnsupportedTokenScreen.stories.tsx
  • packages/thirdweb/src/stories/Bridge/ErrorBanner.stories.tsx
  • packages/thirdweb/src/stories/Bridge/CheckoutWidget.stories.tsx
  • packages/thirdweb/src/stories/Bridge/Transaction/useSendTransactionModal.stories.tsx
  • packages/thirdweb/src/stories/Bridge/SuccessScreen.stories.tsx
  • packages/thirdweb/src/stories/Bridge/PaymentDetails.stories.tsx
  • packages/thirdweb/src/stories/Bridge/StepRunner.stories.tsx
  • packages/thirdweb/src/stories/Bridge/PaymentSelection.stories.tsx
packages/thirdweb/**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

packages/thirdweb/**/*.{ts,tsx}: Every public symbol must have comprehensive TSDoc with at least one compiling @example and a custom tag (@beta, @internal, @experimental, etc.)
Comment only ambiguous logic; avoid restating TypeScript in prose
Lazy‑load heavy dependencies inside async paths (e.g., const { jsPDF } = await import("jspdf"))

Files:

  • packages/thirdweb/src/stories/Bridge/Transaction/TransactionWidget.stories.tsx
  • packages/thirdweb/src/stories/BuyWidget.stories.tsx
  • packages/thirdweb/src/react/web/ui/TransactionButton/TransactionModal.tsx
  • packages/thirdweb/src/stories/Bridge/UnsupportedTokenScreen.stories.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/StepRunner.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/BuyWidget.tsx
  • packages/thirdweb/src/react/web/ui/TransactionButton/DepositScreen.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/TransactionPayment.tsx
  • packages/thirdweb/src/stories/Bridge/ErrorBanner.stories.tsx
  • packages/thirdweb/src/stories/Bridge/CheckoutWidget.stories.tsx
  • packages/thirdweb/src/stories/Bridge/Transaction/useSendTransactionModal.stories.tsx
  • packages/thirdweb/src/stories/Bridge/SuccessScreen.stories.tsx
  • packages/thirdweb/src/stories/Bridge/PaymentDetails.stories.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/CheckoutWidget.tsx
  • packages/thirdweb/src/stories/Bridge/fixtures.ts
  • packages/thirdweb/src/stories/Bridge/StepRunner.stories.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/TransactionWidget.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/DirectPayment.tsx
  • packages/thirdweb/src/stories/Bridge/PaymentSelection.stories.tsx
🧠 Learnings (4)
📚 Learning: 2025-08-29T15:37:38.513Z
Learnt from: CR
PR: thirdweb-dev/js#0
File: AGENTS.md:0-0
Timestamp: 2025-08-29T15:37:38.513Z
Learning: Applies to apps/{dashboard,playground}/**/*.stories.tsx : Add Storybook stories (`*.stories.tsx`) alongside new UI components

Applied to files:

  • packages/thirdweb/src/stories/Bridge/Transaction/TransactionWidget.stories.tsx
  • packages/thirdweb/src/stories/BuyWidget.stories.tsx
  • packages/thirdweb/src/stories/Bridge/CheckoutWidget.stories.tsx
📚 Learning: 2025-09-24T11:08:43.783Z
Learnt from: MananTank
PR: thirdweb-dev/js#8106
File: packages/thirdweb/src/react/web/ui/Bridge/bridge-widget/bridge-widget.tsx:34-41
Timestamp: 2025-09-24T11:08:43.783Z
Learning: In BridgeWidgetProps for packages/thirdweb/src/react/web/ui/Bridge/bridge-widget/bridge-widget.tsx, the Swap onError callback signature requires a non-undefined SwapPreparedQuote parameter (unlike Buy's onError which allows undefined quote). This is intentional - SwapWidget's onError is only called when a quote is available.

Applied to files:

  • packages/thirdweb/src/react/web/ui/Bridge/BuyWidget.tsx
📚 Learning: 2025-07-18T19:20:32.530Z
Learnt from: CR
PR: thirdweb-dev/js#0
File: .cursor/rules/dashboard.mdc:0-0
Timestamp: 2025-07-18T19:20:32.530Z
Learning: Applies to dashboard/**/*client.tsx : Interactive UI that relies on hooks (`useState`, `useEffect`, React Query, wallet hooks).

Applied to files:

  • packages/thirdweb/src/react/web/ui/Bridge/BuyWidget.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/CheckoutWidget.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/TransactionWidget.tsx
📚 Learning: 2025-07-18T19:20:32.530Z
Learnt from: CR
PR: thirdweb-dev/js#0
File: .cursor/rules/dashboard.mdc:0-0
Timestamp: 2025-07-18T19:20:32.530Z
Learning: Applies to dashboard/**/*client.tsx : Anything that consumes hooks from `tanstack/react-query` or thirdweb SDKs.

Applied to files:

  • packages/thirdweb/src/react/web/ui/Bridge/BuyWidget.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/CheckoutWidget.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/TransactionWidget.tsx
🧬 Code graph analysis (19)
packages/thirdweb/src/stories/Bridge/Transaction/TransactionWidget.stories.tsx (2)
packages/thirdweb/src/stories/utils.tsx (1)
  • storyClient (14-16)
packages/thirdweb/src/stories/Bridge/fixtures.ts (1)
  • TRANSACTION_UI_OPTIONS (800-840)
packages/thirdweb/src/stories/BuyWidget.stories.tsx (3)
packages/thirdweb/src/react/web/ui/Bridge/BuyWidget.tsx (1)
  • BuyWidget (329-339)
packages/thirdweb/src/stories/utils.tsx (1)
  • storyClient (14-16)
packages/thirdweb/src/exports/chains.ts (2)
  • base (17-17)
  • ethereum (32-32)
packages/thirdweb/src/react/web/ui/TransactionButton/TransactionModal.tsx (3)
packages/thirdweb/src/pay/convert/type.ts (1)
  • SupportedFiatCurrency (27-27)
packages/thirdweb/src/react/web/ui/Bridge/TransactionWidget.tsx (1)
  • TransactionWidgetContentWrapper (351-483)
packages/thirdweb/src/react/web/ui/ConnectWallet/locale/getConnectLocale.ts (1)
  • useConnectLocale (45-54)
packages/thirdweb/src/stories/Bridge/UnsupportedTokenScreen.stories.tsx (2)
packages/thirdweb/src/react/web/ui/Bridge/UnsupportedTokenScreen.tsx (1)
  • UnsupportedTokenScreen (25-101)
packages/thirdweb/src/stories/utils.tsx (2)
  • storyClient (14-16)
  • ModalThemeWrapper (18-36)
packages/thirdweb/src/react/web/ui/Bridge/StepRunner.tsx (1)
packages/thirdweb/src/react/core/hooks/useBridgePrepare.ts (2)
  • BridgePrepareRequest (14-18)
  • BridgePrepareResult (23-27)
packages/thirdweb/src/react/web/ui/Bridge/BuyWidget.tsx (18)
packages/thirdweb/src/react/web/ui/ConnectWallet/locale/getConnectLocale.ts (1)
  • useConnectLocale (45-54)
packages/thirdweb/src/react/web/ui/Bridge/common/token-query.ts (1)
  • useTokenQuery (13-45)
packages/thirdweb/src/react/web/ui/Bridge/UnsupportedTokenScreen.tsx (1)
  • UnsupportedTokenScreen (25-101)
packages/thirdweb/src/react/web/ui/Bridge/ErrorBanner.tsx (1)
  • ErrorBanner (31-107)
packages/thirdweb/src/bridge/types/Token.ts (1)
  • TokenWithPrices (14-16)
packages/thirdweb/src/react/core/machines/paymentMachine.ts (1)
  • PaymentMethod (22-36)
packages/thirdweb/src/react/core/hooks/useBridgePrepare.ts (2)
  • BridgePrepareResult (23-27)
  • BridgePrepareRequest (14-18)
packages/thirdweb/src/react/core/hooks/useStepExecutor.ts (1)
  • CompletedStatusResult (19-26)
packages/thirdweb/src/react/web/ui/Bridge/types.ts (1)
  • RequiredParams (24-26)
packages/thirdweb/src/react/web/ui/Bridge/FundWallet.tsx (1)
  • FundWallet (95-388)
packages/thirdweb/src/react/web/ui/Bridge/payment-selection/PaymentSelection.tsx (1)
  • PaymentSelection (107-332)
packages/thirdweb/src/react/web/ui/Bridge/QuoteLoader.tsx (1)
  • QuoteLoader (83-164)
packages/thirdweb/src/react/web/ui/Bridge/payment-details/PaymentDetails.tsx (1)
  • PaymentDetails (64-451)
packages/thirdweb/src/react/web/ui/Bridge/StepRunner.tsx (1)
  • StepRunner (75-426)
packages/thirdweb/src/react/web/adapters/WindowAdapter.ts (1)
  • webWindowAdapter (23-23)
packages/thirdweb/src/react/web/ui/Bridge/payment-success/SuccessScreen.tsx (1)
  • SuccessScreen (53-199)
packages/thirdweb/src/react/web/ui/ConnectWallet/Modal/ConnectEmbed.tsx (1)
  • EmbedContainer (459-485)
packages/thirdweb/src/react/web/ui/components/DynamicHeight.tsx (1)
  • DynamicHeight (8-33)
packages/thirdweb/src/react/web/ui/TransactionButton/DepositScreen.tsx (1)
packages/thirdweb/src/react/web/ui/components/basic.tsx (1)
  • ModalHeader (36-68)
packages/thirdweb/src/react/web/ui/Bridge/TransactionPayment.tsx (4)
packages/thirdweb/src/pay/convert/type.ts (1)
  • SupportedFiatCurrency (27-27)
packages/thirdweb/src/react/core/hooks/others/useChainQuery.ts (1)
  • useChainMetadata (165-175)
packages/thirdweb/src/react/core/hooks/useTransactionDetails.ts (1)
  • useTransactionDetails (55-187)
packages/thirdweb/src/react/web/ui/Bridge/common/WithHeader.tsx (1)
  • WithHeader (9-66)
packages/thirdweb/src/stories/Bridge/ErrorBanner.stories.tsx (2)
packages/thirdweb/src/react/web/ui/Bridge/ErrorBanner.tsx (1)
  • ErrorBanner (31-107)
packages/thirdweb/src/stories/utils.tsx (2)
  • storyClient (14-16)
  • ModalThemeWrapper (18-36)
packages/thirdweb/src/stories/Bridge/CheckoutWidget.stories.tsx (3)
packages/thirdweb/src/stories/utils.tsx (1)
  • storyClient (14-16)
packages/thirdweb/src/stories/Bridge/fixtures.ts (1)
  • DIRECT_PAYMENT_UI_OPTIONS (704-797)
packages/thirdweb/src/react/web/ui/Bridge/CheckoutWidget.tsx (2)
  • CheckoutWidgetProps (45-211)
  • CheckoutWidget (315-325)
packages/thirdweb/src/stories/Bridge/Transaction/useSendTransactionModal.stories.tsx (1)
packages/thirdweb/src/stories/utils.tsx (1)
  • storyClient (14-16)
packages/thirdweb/src/stories/Bridge/SuccessScreen.stories.tsx (3)
packages/thirdweb/src/react/web/ui/Bridge/payment-success/SuccessScreen.tsx (1)
  • SuccessScreen (53-199)
packages/thirdweb/src/stories/Bridge/fixtures.ts (2)
  • simpleBuyQuote (251-311)
  • simpleOnrampQuote (93-123)
packages/thirdweb/src/stories/utils.tsx (2)
  • storyClient (14-16)
  • ModalThemeWrapper (18-36)
packages/thirdweb/src/stories/Bridge/PaymentDetails.stories.tsx (3)
packages/thirdweb/src/react/web/ui/Bridge/payment-details/PaymentDetails.tsx (1)
  • PaymentDetails (64-451)
packages/thirdweb/src/stories/Bridge/fixtures.ts (4)
  • simpleOnrampQuote (93-123)
  • DIRECT_PAYMENT_UI_OPTIONS (704-797)
  • simpleBuyQuote (251-311)
  • TRANSACTION_UI_OPTIONS (800-840)
packages/thirdweb/src/stories/utils.tsx (2)
  • storyClient (14-16)
  • ModalThemeWrapper (18-36)
packages/thirdweb/src/react/web/ui/Bridge/CheckoutWidget.tsx (15)
packages/thirdweb/src/react/core/hooks/useBridgePrepare.ts (2)
  • BridgePrepareResult (23-27)
  • BridgePrepareRequest (14-18)
packages/thirdweb/src/react/web/ui/ConnectWallet/locale/getConnectLocale.ts (1)
  • useConnectLocale (45-54)
packages/thirdweb/src/react/web/ui/Bridge/common/token-query.ts (1)
  • useTokenQuery (13-45)
packages/thirdweb/src/react/web/ui/Bridge/ErrorBanner.tsx (1)
  • ErrorBanner (31-107)
packages/thirdweb/src/bridge/types/Token.ts (1)
  • TokenWithPrices (14-16)
packages/thirdweb/src/react/core/machines/paymentMachine.ts (1)
  • PaymentMethod (22-36)
packages/thirdweb/src/react/core/hooks/useStepExecutor.ts (1)
  • CompletedStatusResult (19-26)
packages/thirdweb/src/react/web/ui/Bridge/DirectPayment.tsx (1)
  • DirectPayment (48-205)
packages/thirdweb/src/react/web/ui/Bridge/payment-selection/PaymentSelection.tsx (1)
  • PaymentSelection (107-332)
packages/thirdweb/src/react/web/ui/Bridge/QuoteLoader.tsx (1)
  • QuoteLoader (83-164)
packages/thirdweb/src/react/web/ui/Bridge/payment-details/PaymentDetails.tsx (1)
  • PaymentDetails (64-451)
packages/thirdweb/src/react/web/ui/Bridge/StepRunner.tsx (1)
  • StepRunner (75-426)
packages/thirdweb/src/react/web/adapters/WindowAdapter.ts (1)
  • webWindowAdapter (23-23)
packages/thirdweb/src/react/web/ui/Bridge/payment-success/SuccessScreen.tsx (1)
  • SuccessScreen (53-199)
packages/thirdweb/src/react/web/ui/ConnectWallet/Modal/ConnectEmbed.tsx (1)
  • EmbedContainer (459-485)
packages/thirdweb/src/stories/Bridge/fixtures.ts (1)
packages/thirdweb/src/react/web/ui/Bridge/types.ts (1)
  • DirectPaymentInfo (4-9)
packages/thirdweb/src/stories/Bridge/StepRunner.stories.tsx (4)
packages/thirdweb/src/react/web/ui/Bridge/StepRunner.tsx (1)
  • StepRunner (75-426)
packages/thirdweb/src/stories/utils.tsx (2)
  • storyClient (14-16)
  • ModalThemeWrapper (18-36)
packages/thirdweb/src/stories/Bridge/fixtures.ts (2)
  • STORY_MOCK_WALLET (90-90)
  • simpleBuyQuote (251-311)
packages/thirdweb/src/react/web/adapters/WindowAdapter.ts (1)
  • webWindowAdapter (23-23)
packages/thirdweb/src/react/web/ui/Bridge/TransactionWidget.tsx (16)
packages/thirdweb/src/transaction/actions/wait-for-tx-receipt.ts (1)
  • WaitForReceiptOptions (14-20)
packages/thirdweb/src/react/web/ui/ConnectWallet/locale/getConnectLocale.ts (1)
  • useConnectLocale (45-54)
packages/thirdweb/src/react/web/ui/Bridge/UnsupportedTokenScreen.tsx (1)
  • UnsupportedTokenScreen (25-101)
packages/thirdweb/src/bridge/types/Token.ts (1)
  • TokenWithPrices (14-16)
packages/thirdweb/src/react/core/machines/paymentMachine.ts (1)
  • PaymentMethod (22-36)
packages/thirdweb/src/react/core/hooks/useBridgePrepare.ts (2)
  • BridgePrepareResult (23-27)
  • BridgePrepareRequest (14-18)
packages/thirdweb/src/react/core/hooks/useStepExecutor.ts (1)
  • CompletedStatusResult (19-26)
packages/thirdweb/src/react/web/ui/Bridge/TransactionPayment.tsx (1)
  • TransactionPayment (80-448)
packages/thirdweb/src/react/web/ui/Bridge/payment-selection/PaymentSelection.tsx (1)
  • PaymentSelection (107-332)
packages/thirdweb/src/react/web/ui/Bridge/QuoteLoader.tsx (1)
  • QuoteLoader (83-164)
packages/thirdweb/src/react/web/ui/Bridge/payment-details/PaymentDetails.tsx (1)
  • PaymentDetails (64-451)
packages/thirdweb/src/react/web/ui/Bridge/StepRunner.tsx (1)
  • StepRunner (75-426)
packages/thirdweb/src/react/web/adapters/WindowAdapter.ts (1)
  • webWindowAdapter (23-23)
packages/thirdweb/src/react/web/ui/Bridge/payment-success/SuccessScreen.tsx (1)
  • SuccessScreen (53-199)
packages/thirdweb/src/react/web/ui/Bridge/ErrorBanner.tsx (1)
  • ErrorBanner (31-107)
packages/thirdweb/src/react/web/ui/TransactionButton/ExecutingScreen.tsx (1)
  • ExecutingTxScreen (19-183)
packages/thirdweb/src/react/web/ui/Bridge/DirectPayment.tsx (4)
packages/thirdweb/src/react/web/ui/Bridge/types.ts (1)
  • DirectPaymentInfo (4-9)
packages/thirdweb/src/pay/convert/type.ts (1)
  • SupportedFiatCurrency (27-27)
packages/thirdweb/src/react/web/ui/ConnectWallet/screens/Buy/swap/FiatValue.tsx (1)
  • FiatValue (15-55)
packages/thirdweb/src/react/web/ui/Bridge/common/WithHeader.tsx (1)
  • WithHeader (9-66)
packages/thirdweb/src/stories/Bridge/PaymentSelection.stories.tsx (3)
packages/thirdweb/src/react/web/ui/Bridge/payment-selection/PaymentSelection.tsx (1)
  • PaymentSelection (107-332)
packages/thirdweb/src/stories/utils.tsx (2)
  • storyClient (14-16)
  • ModalThemeWrapper (18-36)
packages/thirdweb/src/stories/Bridge/fixtures.ts (1)
  • USDC (38-49)
🪛 Gitleaks (8.28.0)
packages/thirdweb/src/stories/BuyWidget.stories.tsx

[high] 26-26: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


[high] 39-39: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


[high] 52-52: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


[high] 101-101: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Size
🔇 Additional comments (16)
packages/thirdweb/src/stories/Bridge/ErrorBanner.stories.tsx (3)

1-3: LGTM!

The imports are correctly updated to support the decorator-based theming approach. The addition of ModalThemeWrapper and storyClient from utils aligns with the refactoring objective to standardize theming across Bridge stories.


14-29: LGTM! Cleaner decorator-based approach.

The meta configuration correctly refactors to use:

  • ErrorBanner directly instead of the removed wrapper component
  • Shared storyClient for consistent configuration
  • Decorator pattern for theming (renders both light and dark variants via ModalThemeWrapper)

This approach is more maintainable than per-story theming and aligns with Storybook best practices.


34-63: LGTM! Comprehensive error scenario coverage.

The story definitions provide good coverage of error states:

  • Various error types (network, user rejection, insufficient funds, generic)
  • Optional prop handling (onCancel: undefined)
  • Edge case testing (empty error message)

These stories will correctly render with the decorator-based theming approach, automatically showing both light and dark theme variants.

packages/thirdweb/src/react/web/ui/TransactionButton/DepositScreen.tsx (2)

73-76: TSDoc is acceptable for an @internal symbol.

The @internal tag indicates this is not part of the public API, so the lack of an @example is acceptable. If this symbol is promoted to public in the future, ensure a compiling @example is added per coding guidelines.

As per coding guidelines.


146-146: LGTM: Consistent removal of back navigation.

The removal of the onBack prop from ModalHeader is consistent with the removal of onBack from the component's props. No back button will be rendered, which aligns with the refactor to remove BridgeOrchestrator and simplify navigation flows.

packages/thirdweb/src/stories/Bridge/fixtures.ts (1)

641-648: Good: limit story-only addresses to local scope

Making RECEIVER_ADDRESSES non-exported reduces accidental external coupling. LGTM.

packages/thirdweb/src/stories/Bridge/StepRunner.stories.tsx (1)

12-36: Story setup looks correct

Meta args, decorator, and webWindowAdapter wiring align with the new StepRunner API. request provided in the story itself is fine.

packages/thirdweb/src/stories/Bridge/PaymentSelection.stories.tsx (2)

7-36: Props and decorator align with new PaymentSelection API

Args are explicit (currency, methods, receiverAddress) and the ModalThemeWrapper decorator keeps theme coverage. Looks good.


41-51: Nice split of crypto-only and card-only variants

The two targeted stories simplify coverage versus many small variants. LGTM.

packages/thirdweb/src/stories/Bridge/CheckoutWidget.stories.tsx (1)

11-21: Stories look solid and exercise the new props correctly

Meta/args and variants are well‑wired; rendering both themes via StoryVariant is clean. No issues.

packages/thirdweb/src/stories/Bridge/UnsupportedTokenScreen.stories.tsx (1)

7-22: Decorator-based theming and args look correct

Directly targets UnsupportedTokenScreen with proper defaults; mainnet/testnet stories cover both UI branches.

packages/thirdweb/src/react/web/ui/Bridge/BuyWidget.tsx (2)

362-374: Branding override preserves consumer config (good fix)

Only forcing connectModal.showThirdwebBranding when widget explicitly disables branding avoids overwriting integrator settings.


342-347: Confirm default locale id format ("en_US" vs "en-US")

Ensure the default matches LocaleId values used by useConnectLocale. If the enum expects hyphenated tags, switch to "en-US".

packages/thirdweb/src/react/web/ui/Bridge/StepRunner.tsx (1)

30-73: Internal type visibility is correct
No external references to StepRunnerProps found; leaving it unexported is fine.

packages/thirdweb/src/stories/Bridge/Transaction/TransactionWidget.stories.tsx (2)

25-47: Story args layering looks good

Variants correctly rely on meta args and override only scenario-specific fields.


1-7: Confirm .js path import is intentional

The import targets a TS module with a .js extension. If your tooling expects extensionless or TS paths in Storybook, consider aligning to repo convention; otherwise keep as-is.

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: 1

♻️ Duplicate comments (2)
packages/thirdweb/src/react/web/ui/Bridge/BuyWidget.tsx (1)

362-374: Guard connectModal spread and only override branding when prop is provided.

Avoid spreading possibly-undefined and preserve consumer-provided modal settings; only set showThirdwebBranding when the widget prop is explicitly set.

Apply this diff:

-  const connectOptions = useMemo(() => {
-    if (props.showThirdwebBranding === false) {
-      return {
-        ...props.connectOptions,
-        connectModal: {
-          ...props.connectOptions?.connectModal,
-          showThirdwebBranding: false,
-        },
-      };
-    }
-    return props.connectOptions;
-  }, [props.connectOptions, props.showThirdwebBranding]);
+  const connectOptions = useMemo(() => {
+    if (!props.connectOptions) return undefined;
+    const showThirdwebBranding =
+      props.showThirdwebBranding ??
+      props.connectOptions.connectModal?.showThirdwebBranding;
+    return {
+      ...props.connectOptions,
+      connectModal: {
+        ...(props.connectOptions.connectModal || {}),
+        ...(showThirdwebBranding !== undefined
+          ? { showThirdwebBranding }
+          : {}),
+      },
+    };
+  }, [props.connectOptions, props.showThirdwebBranding]);
packages/thirdweb/src/react/web/ui/Bridge/TransactionWidget.tsx (1)

411-423: Prevent runtime crash when connectModal is absent.

Guard the spread with a fallback and only set showThirdwebBranding when explicitly disabling branding.

Apply this diff:

-  const connectOptions = useMemo(() => {
-    if (props.showThirdwebBranding === false) {
-      return {
-        ...props.connectOptions,
-        connectModal: {
-          ...props.connectOptions?.connectModal,
-          showThirdwebBranding: props.showThirdwebBranding,
-        },
-      };
-    }
-    return props.connectOptions;
-  }, [props.connectOptions, props.showThirdwebBranding]);
+  const connectOptions = useMemo(() => {
+    if (props.showThirdwebBranding === false) {
+      return {
+        ...props.connectOptions,
+        connectModal: {
+          ...(props.connectOptions?.connectModal || {}),
+          showThirdwebBranding: false,
+        },
+      };
+    }
+    return props.connectOptions;
+  }, [props.connectOptions, props.showThirdwebBranding]);
🧹 Nitpick comments (2)
packages/thirdweb/src/react/web/ui/Bridge/TransactionWidget.tsx (2)

438-455: Use ErrorBanner for tx errors to align UX and analytics.

Replace custom error block with ErrorBanner to unify recovery and event tracking.

Apply this diff:

-  } else if (txQuery.error) {
-    return (
-      <div
-        style={{
-          alignItems: "center",
-          display: "flex",
-          flexDirection: "column",
-          justifyContent: "center",
-          minHeight: "350px",
-        }}
-      >
-        <AccentFailIcon size={iconSize["3xl"]} />
-        <Spacer y="lg" />
-        <Text color="secondaryText" size="md">
-          {txQuery.error.message}
-        </Text>
-      </div>
-    );
+  } else if (txQuery.error) {
+    return (
+      <ErrorBanner
+        client={props.client}
+        error={txQuery.error as Error}
+        onRetry={() => txQuery.refetch()}
+        onCancel={props.onCancel}
+      />
+    );

407-409: Query key too broad; avoid stringify(props).

Using stringify(props) risks unstable keys and cache churn. Limit to stable fields (chainId, tokenAddress, amount, transaction hash/nonce) and omit functions.

Example:

-    queryKey: ["transaction-query", stringify(props)],
+    queryKey: [
+      "transaction-query",
+      props.transaction.chain.id,
+      props.tokenAddress,
+      props.amount,
+      // include a stable transaction identifier if available
+      // props.transaction.to, props.transaction.data, etc.
+    ],
📜 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 c2a9024 and 344c246.

📒 Files selected for processing (6)
  • packages/thirdweb/src/react/core/hooks/usePaymentMethods.ts (0 hunks)
  • packages/thirdweb/src/react/web/ui/Bridge/BuyWidget.tsx (5 hunks)
  • packages/thirdweb/src/react/web/ui/Bridge/CheckoutWidget.tsx (6 hunks)
  • packages/thirdweb/src/react/web/ui/Bridge/TransactionWidget.tsx (8 hunks)
  • packages/thirdweb/src/react/web/ui/Bridge/payment-selection/PaymentSelection.tsx (4 hunks)
  • packages/thirdweb/src/stories/Bridge/PaymentSelection.stories.tsx (1 hunks)
💤 Files with no reviewable changes (1)
  • packages/thirdweb/src/react/core/hooks/usePaymentMethods.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/thirdweb/src/react/web/ui/Bridge/payment-selection/PaymentSelection.tsx
🧰 Additional context used
📓 Path-based instructions (4)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.{ts,tsx}: Write idiomatic TypeScript with explicit function declarations and return types
Limit each file to one stateless, single-responsibility function for clarity
Re-use shared types from @/types or local types.ts barrels
Prefer type aliases over interface except for nominal shapes
Avoid any and unknown unless unavoidable; narrow generics when possible
Choose composition over inheritance; leverage utility types (Partial, Pick, etc.)
Comment only ambiguous logic; avoid restating TypeScript in prose

**/*.{ts,tsx}: Use explicit function declarations and explicit return types in TypeScript
Limit each file to one stateless, single‑responsibility function
Re‑use shared types from @/types where applicable
Prefer type aliases over interface except for nominal shapes
Avoid any and unknown unless unavoidable; narrow generics when possible
Prefer composition over inheritance; use utility types (Partial, Pick, etc.)
Lazy‑import optional features and avoid top‑level side‑effects to reduce bundle size

Files:

  • packages/thirdweb/src/react/web/ui/Bridge/CheckoutWidget.tsx
  • packages/thirdweb/src/stories/Bridge/PaymentSelection.stories.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/BuyWidget.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/TransactionWidget.tsx
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (CLAUDE.md)

Load heavy dependencies inside async paths to keep initial bundle lean (lazy loading)

Files:

  • packages/thirdweb/src/react/web/ui/Bridge/CheckoutWidget.tsx
  • packages/thirdweb/src/stories/Bridge/PaymentSelection.stories.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/BuyWidget.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/TransactionWidget.tsx
packages/thirdweb/**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

packages/thirdweb/**/*.{ts,tsx}: Every public symbol must have comprehensive TSDoc with at least one compiling @example and a custom tag (@beta, @internal, @experimental, etc.)
Comment only ambiguous logic; avoid restating TypeScript in prose
Lazy‑load heavy dependencies inside async paths (e.g., const { jsPDF } = await import("jspdf"))

Files:

  • packages/thirdweb/src/react/web/ui/Bridge/CheckoutWidget.tsx
  • packages/thirdweb/src/stories/Bridge/PaymentSelection.stories.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/BuyWidget.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/TransactionWidget.tsx
**/*.stories.tsx

📄 CodeRabbit inference engine (CLAUDE.md)

For new UI components, add Storybook stories (*.stories.tsx) alongside the code

Files:

  • packages/thirdweb/src/stories/Bridge/PaymentSelection.stories.tsx
🧠 Learnings (3)
📚 Learning: 2025-09-24T11:08:43.783Z
Learnt from: MananTank
PR: thirdweb-dev/js#8106
File: packages/thirdweb/src/react/web/ui/Bridge/bridge-widget/bridge-widget.tsx:34-41
Timestamp: 2025-09-24T11:08:43.783Z
Learning: In BridgeWidgetProps for packages/thirdweb/src/react/web/ui/Bridge/bridge-widget/bridge-widget.tsx, the Swap onError callback signature requires a non-undefined SwapPreparedQuote parameter (unlike Buy's onError which allows undefined quote). This is intentional - SwapWidget's onError is only called when a quote is available.

Applied to files:

  • packages/thirdweb/src/react/web/ui/Bridge/CheckoutWidget.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/BuyWidget.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/TransactionWidget.tsx
📚 Learning: 2025-07-18T19:20:32.530Z
Learnt from: CR
PR: thirdweb-dev/js#0
File: .cursor/rules/dashboard.mdc:0-0
Timestamp: 2025-07-18T19:20:32.530Z
Learning: Applies to dashboard/**/*client.tsx : Interactive UI that relies on hooks (`useState`, `useEffect`, React Query, wallet hooks).

Applied to files:

  • packages/thirdweb/src/react/web/ui/Bridge/CheckoutWidget.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/BuyWidget.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/TransactionWidget.tsx
📚 Learning: 2025-07-18T19:20:32.530Z
Learnt from: CR
PR: thirdweb-dev/js#0
File: .cursor/rules/dashboard.mdc:0-0
Timestamp: 2025-07-18T19:20:32.530Z
Learning: Applies to dashboard/**/*client.tsx : Anything that consumes hooks from `tanstack/react-query` or thirdweb SDKs.

Applied to files:

  • packages/thirdweb/src/react/web/ui/Bridge/CheckoutWidget.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/BuyWidget.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/TransactionWidget.tsx
🧬 Code graph analysis (4)
packages/thirdweb/src/react/web/ui/Bridge/CheckoutWidget.tsx (14)
packages/thirdweb/src/react/core/hooks/useBridgePrepare.ts (2)
  • BridgePrepareResult (23-27)
  • BridgePrepareRequest (14-18)
packages/thirdweb/src/react/web/ui/ConnectWallet/locale/getConnectLocale.ts (1)
  • useConnectLocale (45-54)
packages/thirdweb/src/react/web/ui/Bridge/common/token-query.ts (1)
  • useTokenQuery (13-45)
packages/thirdweb/src/react/web/ui/Bridge/ErrorBanner.tsx (1)
  • ErrorBanner (31-107)
packages/thirdweb/src/bridge/types/Token.ts (1)
  • TokenWithPrices (14-16)
packages/thirdweb/src/react/core/machines/paymentMachine.ts (1)
  • PaymentMethod (22-36)
packages/thirdweb/src/react/core/hooks/useStepExecutor.ts (1)
  • CompletedStatusResult (19-26)
packages/thirdweb/src/react/web/ui/Bridge/DirectPayment.tsx (1)
  • DirectPayment (48-205)
packages/thirdweb/src/react/web/ui/Bridge/payment-selection/PaymentSelection.tsx (1)
  • PaymentSelection (102-322)
packages/thirdweb/src/react/web/ui/Bridge/QuoteLoader.tsx (1)
  • QuoteLoader (83-164)
packages/thirdweb/src/react/web/ui/Bridge/payment-details/PaymentDetails.tsx (1)
  • PaymentDetails (64-451)
packages/thirdweb/src/react/web/ui/Bridge/StepRunner.tsx (1)
  • StepRunner (75-426)
packages/thirdweb/src/react/web/adapters/WindowAdapter.ts (1)
  • webWindowAdapter (23-23)
packages/thirdweb/src/react/web/ui/Bridge/payment-success/SuccessScreen.tsx (1)
  • SuccessScreen (53-199)
packages/thirdweb/src/stories/Bridge/PaymentSelection.stories.tsx (3)
packages/thirdweb/src/react/web/ui/Bridge/payment-selection/PaymentSelection.tsx (1)
  • PaymentSelection (102-322)
packages/thirdweb/src/stories/utils.tsx (2)
  • storyClient (14-16)
  • ModalThemeWrapper (18-36)
packages/thirdweb/src/stories/Bridge/fixtures.ts (1)
  • USDC (38-49)
packages/thirdweb/src/react/web/ui/Bridge/BuyWidget.tsx (15)
packages/thirdweb/src/react/web/ui/ConnectWallet/locale/getConnectLocale.ts (1)
  • useConnectLocale (45-54)
packages/thirdweb/src/react/web/ui/Bridge/common/token-query.ts (1)
  • useTokenQuery (13-45)
packages/thirdweb/src/react/web/ui/Bridge/ErrorBanner.tsx (1)
  • ErrorBanner (31-107)
packages/thirdweb/src/bridge/types/Token.ts (1)
  • TokenWithPrices (14-16)
packages/thirdweb/src/react/core/machines/paymentMachine.ts (1)
  • PaymentMethod (22-36)
packages/thirdweb/src/react/core/hooks/useBridgePrepare.ts (2)
  • BridgePrepareResult (23-27)
  • BridgePrepareRequest (14-18)
packages/thirdweb/src/react/core/hooks/useStepExecutor.ts (1)
  • CompletedStatusResult (19-26)
packages/thirdweb/src/react/web/ui/Bridge/types.ts (1)
  • RequiredParams (24-26)
packages/thirdweb/src/react/web/ui/Bridge/FundWallet.tsx (1)
  • FundWallet (95-388)
packages/thirdweb/src/react/web/ui/Bridge/payment-selection/PaymentSelection.tsx (1)
  • PaymentSelection (102-322)
packages/thirdweb/src/react/web/ui/Bridge/QuoteLoader.tsx (1)
  • QuoteLoader (83-164)
packages/thirdweb/src/react/web/ui/Bridge/payment-details/PaymentDetails.tsx (1)
  • PaymentDetails (64-451)
packages/thirdweb/src/react/web/ui/Bridge/StepRunner.tsx (1)
  • StepRunner (75-426)
packages/thirdweb/src/react/web/adapters/WindowAdapter.ts (1)
  • webWindowAdapter (23-23)
packages/thirdweb/src/react/web/ui/Bridge/payment-success/SuccessScreen.tsx (1)
  • SuccessScreen (53-199)
packages/thirdweb/src/react/web/ui/Bridge/TransactionWidget.tsx (15)
packages/thirdweb/src/transaction/actions/wait-for-tx-receipt.ts (1)
  • WaitForReceiptOptions (14-20)
packages/thirdweb/src/react/web/ui/ConnectWallet/locale/getConnectLocale.ts (1)
  • useConnectLocale (45-54)
packages/thirdweb/src/bridge/types/Token.ts (1)
  • TokenWithPrices (14-16)
packages/thirdweb/src/react/core/machines/paymentMachine.ts (1)
  • PaymentMethod (22-36)
packages/thirdweb/src/react/core/hooks/useBridgePrepare.ts (2)
  • BridgePrepareResult (23-27)
  • BridgePrepareRequest (14-18)
packages/thirdweb/src/react/core/hooks/useStepExecutor.ts (1)
  • CompletedStatusResult (19-26)
packages/thirdweb/src/react/web/ui/Bridge/TransactionPayment.tsx (1)
  • TransactionPayment (80-448)
packages/thirdweb/src/react/web/ui/Bridge/payment-selection/PaymentSelection.tsx (1)
  • PaymentSelection (102-322)
packages/thirdweb/src/react/web/ui/Bridge/QuoteLoader.tsx (1)
  • QuoteLoader (83-164)
packages/thirdweb/src/react/web/ui/Bridge/payment-details/PaymentDetails.tsx (1)
  • PaymentDetails (64-451)
packages/thirdweb/src/react/web/ui/Bridge/StepRunner.tsx (1)
  • StepRunner (75-426)
packages/thirdweb/src/react/web/adapters/WindowAdapter.ts (1)
  • webWindowAdapter (23-23)
packages/thirdweb/src/react/web/ui/Bridge/payment-success/SuccessScreen.tsx (1)
  • SuccessScreen (53-199)
packages/thirdweb/src/react/web/ui/Bridge/ErrorBanner.tsx (1)
  • ErrorBanner (31-107)
packages/thirdweb/src/react/web/ui/ConnectWallet/Modal/ConnectEmbed.tsx (1)
  • EmbedContainer (459-485)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (8)
  • GitHub Check: E2E Tests (pnpm, esbuild)
  • GitHub Check: E2E Tests (pnpm, vite)
  • GitHub Check: Build Packages
  • GitHub Check: Unit Tests
  • GitHub Check: Lint Packages
  • GitHub Check: E2E Tests (pnpm, webpack)
  • GitHub Check: Size
  • GitHub Check: Analyze (javascript)
🔇 Additional comments (4)
packages/thirdweb/src/react/web/ui/Bridge/CheckoutWidget.tsx (1)

399-411: Good error surfacing with retry/cancel.

Switch to ErrorBanner on token lookup failure avoids empty renders and adds analytics + recovery paths.

packages/thirdweb/src/stories/Bridge/PaymentSelection.stories.tsx (2)

7-35: Story config looks solid and aligned with new props.

Decorator approach and default args cover main paths (crypto/fiat) well.


40-50: Clear variants for method filtering.

OnlyCryptoMethodEnabled / OnlyFiatMethodEnabled are helpful focused demos.

packages/thirdweb/src/react/web/ui/Bridge/TransactionWidget.tsx (1)

371-394: Verify native token handling when amount is provided.

If tokenAddress is undefined, this code treats it as NATIVE_TOKEN_ADDRESS and sets erc20Value. Ensure prepareTransaction expects erc20Value for native tokens; otherwise, set value (wei) instead.

Would you confirm prepareTransaction’s behavior for native vs ERC-20 amounts? If native requires value, we should branch:

-        erc20Value = {
-          amountWei: toUnits(props.amount, token.decimals),
-          tokenAddress: checksumAddress(tokenAddress),
-        };
+        if (tokenAddress === NATIVE_TOKEN_ADDRESS) {
+          return {
+            type: "success",
+            transaction: prepareTransaction({
+              ...props.transaction,
+              value: toUnits(props.amount, token.decimals),
+            }),
+          };
+        } else {
+          erc20Value = {
+            amountWei: toUnits(props.amount, token.decimals),
+            tokenAddress: checksumAddress(tokenAddress),
+          };
+        }

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
packages/thirdweb/src/react/web/ui/Bridge/BuyWidget.tsx (1)

375-429: Missing error handling for token query failures.

When tokenQuery fails for reasons other than "unsupported_token", the component falls through to return null, leaving users with an empty widget and no recovery path. The tokenQuery.error case at lines 413-426 only handles explicit error results, but doesn't catch the scenario where tokenQuery.data is undefined due to a non-"unsupported" failure.

Add an explicit check for tokenQuery.isError before the final return null:

  } else if (tokenQuery.data?.type === "success") {
    return (
      <BridgeWidgetContent
        {...props}
        connectLocale={localQuery.data}
        destinationToken={tokenQuery.data.token}
        currency={props.currency || "USD"}
        paymentMethods={props.paymentMethods || ["crypto", "card"]}
        presetOptions={props.presetOptions || [5, 10, 20]}
        connectOptions={connectOptions}
        showThirdwebBranding={
          props.showThirdwebBranding === undefined
            ? true
            : props.showThirdwebBranding
        }
      />
    );
- } else if (tokenQuery.error) {
+ } else if (tokenQuery.isError || tokenQuery.error) {
    return (
      <ErrorBanner
        client={props.client}
-       error={tokenQuery.error}
+       error={tokenQuery.error || new Error("Failed to load token")}
        onRetry={() => {
          tokenQuery.refetch();
        }}
        onCancel={() => {
          props.onCancel?.(undefined);
        }}
      />
    );
  }

  return null;
♻️ Duplicate comments (6)
packages/thirdweb/src/react/web/ui/Bridge/BuyWidget.tsx (1)

362-373: Fix branding memo to preserve consumer settings.

This memo unconditionally overwrites connectOptions.connectModal.showThirdwebBranding when the widget prop is false, but fails to preserve the consumer's existing setting when the widget prop is undefined. This regresses integrators who explicitly configured connectModal.showThirdwebBranding.

Apply the diff from the previous review to only override branding when explicitly provided:

  const connectOptions = useMemo(() => {
-   if (props.showThirdwebBranding === false) {
+   if (!props.connectOptions) return undefined;
+   const showThirdwebBranding =
+     props.showThirdwebBranding ??
+     props.connectOptions.connectModal?.showThirdwebBranding;
+   return {
+     ...props.connectOptions,
+     connectModal: {
+       ...(props.connectOptions.connectModal || {}),
+       ...(showThirdwebBranding !== undefined
+         ? { showThirdwebBranding }
+         : {}),
+     },
+   };
- return {
-   ...props.connectOptions,
-   connectModal: {
-     ...props.connectOptions?.connectModal,
-     showThirdwebBranding: false,
-   },
- };
-   }
-   return props.connectOptions;
  }, [props.connectOptions, props.showThirdwebBranding]);
packages/thirdweb/src/react/web/ui/Bridge/CheckoutWidget.tsx (2)

348-360: Fix branding memo to preserve consumer settings.

This memo has the same issue as BuyWidget: it unconditionally overwrites connectOptions.connectModal.showThirdwebBranding when the widget prop is false, but fails to preserve the consumer's setting when the prop is undefined.

Apply the same fix as recommended for BuyWidget:

  const connectOptions = useMemo(() => {
-   if (props.showThirdwebBranding === false) {
+   if (!props.connectOptions) return undefined;
+   const showThirdwebBranding =
+     props.showThirdwebBranding ??
+     props.connectOptions.connectModal?.showThirdwebBranding;
+   return {
+     ...props.connectOptions,
+     connectModal: {
+       ...(props.connectOptions.connectModal || {}),
+       ...(showThirdwebBranding !== undefined
+         ? { showThirdwebBranding }
+         : {}),
+     },
+   };
- return {
-   ...props.connectOptions,
-   connectModal: {
-     ...props.connectOptions?.connectModal,
-     showThirdwebBranding: false,
-   },
- };
-   }
-   return props.connectOptions;
  }, [props.connectOptions, props.showThirdwebBranding]);

375-415: Missing error handling for token query failures.

Same issue as BuyWidget: when tokenQuery fails for reasons other than "unsupported_token", the component returns null, leaving users without a recovery path.

Add explicit error handling before the final return null:

  } else if (tokenQuery.data?.type === "success") {
    return (
      <CheckoutWidgetContent
        {...props}
        connectLocale={localQuery.data}
        destinationToken={tokenQuery.data.token}
        currency={props.currency || "USD"}
        paymentMethods={props.paymentMethods || ["crypto", "card"]}
        connectOptions={connectOptions}
        showThirdwebBranding={
          props.showThirdwebBranding === undefined
            ? true
            : props.showThirdwebBranding
        }
      />
    );
- } else if (tokenQuery.error) {
+ } else if (tokenQuery.isError || tokenQuery.error) {
    return (
      <ErrorBanner
        client={props.client}
-       error={tokenQuery.error}
+       error={tokenQuery.error || new Error("Failed to load token")}
        onRetry={() => {
          tokenQuery.refetch();
        }}
        onCancel={() => {
          props.onCancel?.(undefined);
        }}
      />
    );
  }

  return null;
packages/thirdweb/src/stories/Bridge/PaymentDetails.stories.tsx (2)

99-105: Fix missing modeInfo override for direct payment scenario.

This story spreads DIRECT_PAYMENT_UI_OPTIONS.credits which includes paymentInfo, but doesn't override modeInfo to set mode: "direct_payment". Without this, the story falls back to the meta default modeInfo: { mode: "fund_wallet" }, which doesn't match the direct payment scenario the story is testing.

Apply this diff:

 export const OnrampSimpleDirectPayment: Story = {
   args: {
     paymentMethod: fiatPaymentMethod,
     preparedQuote: simpleOnrampQuote,
+    modeInfo: {
+      mode: "direct_payment",
+      paymentInfo: DIRECT_PAYMENT_UI_OPTIONS.credits.paymentInfo,
+    },
     ...DIRECT_PAYMENT_UI_OPTIONS.credits,
   },
 };

121-127: Fix missing modeInfo override for direct payment scenario.

This story spreads DIRECT_PAYMENT_UI_OPTIONS.digitalArt which includes paymentInfo, but doesn't override modeInfo to set mode: "direct_payment". Without this, the story falls back to the meta default modeInfo: { mode: "fund_wallet" }, which doesn't match the direct payment scenario.

Apply this diff:

 export const BuySimpleDirectPayment: Story = {
   args: {
     paymentMethod: ethCryptoPaymentMethod,
     preparedQuote: simpleBuyQuote,
+    modeInfo: {
+      mode: "direct_payment",
+      paymentInfo: DIRECT_PAYMENT_UI_OPTIONS.digitalArt.paymentInfo,
+    },
     ...DIRECT_PAYMENT_UI_OPTIONS.digitalArt,
   },
 };
packages/thirdweb/src/react/web/ui/Bridge/TransactionWidget.tsx (1)

412-423: Guard against undefined connectModal before spreading.

If props.connectOptions?.connectModal is undefined, spreading it will throw TypeError: Cannot convert undefined or null to object, causing the widget to crash before rendering.

Apply this diff:

   const connectOptions = useMemo(() => {
     if (props.showThirdwebBranding === false) {
       return {
         ...props.connectOptions,
         connectModal: {
-          ...props.connectOptions?.connectModal,
+          ...(props.connectOptions?.connectModal || {}),
           showThirdwebBranding: props.showThirdwebBranding,
         },
       };
     }
     return props.connectOptions;
   }, [props.connectOptions, props.showThirdwebBranding]);
🧹 Nitpick comments (1)
packages/thirdweb/src/react/web/ui/Bridge/CheckoutWidget.tsx (1)

461-463: Consider removing duplicate RequiredParams utility.

The RequiredParams utility type is already defined in packages/thirdweb/src/react/web/ui/Bridge/types.ts (lines 25-27). Instead of duplicating it here, import it from the centralized types module.

Apply this diff to import the utility:

-type RequiredParams<T extends object, keys extends keyof T> = T & {
-  [K in keys]-?: T[K];
-};
-
 function CheckoutWidgetContent(
   props: RequiredParams<

And add the import at the top:

 import { useTokenQuery } from "./common/token-query.js";
 import { DirectPayment } from "./DirectPayment.js";
 import { ErrorBanner } from "./ErrorBanner.js";
 import { PaymentDetails } from "./payment-details/PaymentDetails.js";
 import { PaymentSelection } from "./payment-selection/PaymentSelection.js";
 import { SuccessScreen } from "./payment-success/SuccessScreen.js";
 import { QuoteLoader } from "./QuoteLoader.js";
 import { StepRunner } from "./StepRunner.js";
-import type { PaymentMethod } from "./types.js";
+import type { PaymentMethod, RequiredParams } from "./types.js";
 import { UnsupportedTokenScreen } from "./UnsupportedTokenScreen.js";
📜 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 344c246 and 3496e97.

📒 Files selected for processing (13)
  • packages/thirdweb/src/react/core/hooks/usePaymentMethods.ts (1 hunks)
  • packages/thirdweb/src/react/core/machines/paymentMachine.test.ts (0 hunks)
  • packages/thirdweb/src/react/core/machines/paymentMachine.ts (0 hunks)
  • packages/thirdweb/src/react/web/ui/Bridge/BuyWidget.tsx (5 hunks)
  • packages/thirdweb/src/react/web/ui/Bridge/CheckoutWidget.tsx (6 hunks)
  • packages/thirdweb/src/react/web/ui/Bridge/QuoteLoader.tsx (4 hunks)
  • packages/thirdweb/src/react/web/ui/Bridge/TransactionWidget.tsx (8 hunks)
  • packages/thirdweb/src/react/web/ui/Bridge/payment-details/PaymentDetails.tsx (5 hunks)
  • packages/thirdweb/src/react/web/ui/Bridge/payment-details/PaymentOverview.tsx (10 hunks)
  • packages/thirdweb/src/react/web/ui/Bridge/payment-selection/PaymentSelection.tsx (4 hunks)
  • packages/thirdweb/src/react/web/ui/Bridge/payment-selection/TokenSelection.tsx (1 hunks)
  • packages/thirdweb/src/react/web/ui/Bridge/types.ts (1 hunks)
  • packages/thirdweb/src/stories/Bridge/PaymentDetails.stories.tsx (2 hunks)
💤 Files with no reviewable changes (2)
  • packages/thirdweb/src/react/core/machines/paymentMachine.ts
  • packages/thirdweb/src/react/core/machines/paymentMachine.test.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/thirdweb/src/react/core/hooks/usePaymentMethods.ts
🧰 Additional context used
📓 Path-based instructions (5)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.{ts,tsx}: Write idiomatic TypeScript with explicit function declarations and return types
Limit each file to one stateless, single-responsibility function for clarity
Re-use shared types from @/types or local types.ts barrels
Prefer type aliases over interface except for nominal shapes
Avoid any and unknown unless unavoidable; narrow generics when possible
Choose composition over inheritance; leverage utility types (Partial, Pick, etc.)
Comment only ambiguous logic; avoid restating TypeScript in prose

**/*.{ts,tsx}: Use explicit function declarations and explicit return types in TypeScript
Limit each file to one stateless, single‑responsibility function
Re‑use shared types from @/types where applicable
Prefer type aliases over interface except for nominal shapes
Avoid any and unknown unless unavoidable; narrow generics when possible
Prefer composition over inheritance; use utility types (Partial, Pick, etc.)
Lazy‑import optional features and avoid top‑level side‑effects to reduce bundle size

Files:

  • packages/thirdweb/src/react/web/ui/Bridge/payment-details/PaymentOverview.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/payment-details/PaymentDetails.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/payment-selection/TokenSelection.tsx
  • packages/thirdweb/src/stories/Bridge/PaymentDetails.stories.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/CheckoutWidget.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/BuyWidget.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/QuoteLoader.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/types.ts
  • packages/thirdweb/src/react/web/ui/Bridge/payment-selection/PaymentSelection.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/TransactionWidget.tsx
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (CLAUDE.md)

Load heavy dependencies inside async paths to keep initial bundle lean (lazy loading)

Files:

  • packages/thirdweb/src/react/web/ui/Bridge/payment-details/PaymentOverview.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/payment-details/PaymentDetails.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/payment-selection/TokenSelection.tsx
  • packages/thirdweb/src/stories/Bridge/PaymentDetails.stories.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/CheckoutWidget.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/BuyWidget.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/QuoteLoader.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/types.ts
  • packages/thirdweb/src/react/web/ui/Bridge/payment-selection/PaymentSelection.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/TransactionWidget.tsx
packages/thirdweb/**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

packages/thirdweb/**/*.{ts,tsx}: Every public symbol must have comprehensive TSDoc with at least one compiling @example and a custom tag (@beta, @internal, @experimental, etc.)
Comment only ambiguous logic; avoid restating TypeScript in prose
Lazy‑load heavy dependencies inside async paths (e.g., const { jsPDF } = await import("jspdf"))

Files:

  • packages/thirdweb/src/react/web/ui/Bridge/payment-details/PaymentOverview.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/payment-details/PaymentDetails.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/payment-selection/TokenSelection.tsx
  • packages/thirdweb/src/stories/Bridge/PaymentDetails.stories.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/CheckoutWidget.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/BuyWidget.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/QuoteLoader.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/types.ts
  • packages/thirdweb/src/react/web/ui/Bridge/payment-selection/PaymentSelection.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/TransactionWidget.tsx
**/*.stories.tsx

📄 CodeRabbit inference engine (CLAUDE.md)

For new UI components, add Storybook stories (*.stories.tsx) alongside the code

Files:

  • packages/thirdweb/src/stories/Bridge/PaymentDetails.stories.tsx
**/types.ts

📄 CodeRabbit inference engine (AGENTS.md)

Provide and re‑use local type barrels in a types.ts file

Files:

  • packages/thirdweb/src/react/web/ui/Bridge/types.ts
🧠 Learnings (6)
📚 Learning: 2025-07-18T19:20:32.530Z
Learnt from: CR
PR: thirdweb-dev/js#0
File: .cursor/rules/dashboard.mdc:0-0
Timestamp: 2025-07-18T19:20:32.530Z
Learning: Applies to dashboard/**/*client.tsx : Interactive UI that relies on hooks (`useState`, `useEffect`, React Query, wallet hooks).

Applied to files:

  • packages/thirdweb/src/react/web/ui/Bridge/CheckoutWidget.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/BuyWidget.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/TransactionWidget.tsx
📚 Learning: 2025-07-18T19:20:32.530Z
Learnt from: CR
PR: thirdweb-dev/js#0
File: .cursor/rules/dashboard.mdc:0-0
Timestamp: 2025-07-18T19:20:32.530Z
Learning: Applies to dashboard/**/*client.tsx : Anything that consumes hooks from `tanstack/react-query` or thirdweb SDKs.

Applied to files:

  • packages/thirdweb/src/react/web/ui/Bridge/CheckoutWidget.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/BuyWidget.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/TransactionWidget.tsx
📚 Learning: 2025-09-24T11:08:43.783Z
Learnt from: MananTank
PR: thirdweb-dev/js#8106
File: packages/thirdweb/src/react/web/ui/Bridge/bridge-widget/bridge-widget.tsx:34-41
Timestamp: 2025-09-24T11:08:43.783Z
Learning: In BridgeWidgetProps for packages/thirdweb/src/react/web/ui/Bridge/bridge-widget/bridge-widget.tsx, the Swap onError callback signature requires a non-undefined SwapPreparedQuote parameter (unlike Buy's onError which allows undefined quote). This is intentional - SwapWidget's onError is only called when a quote is available.

Applied to files:

  • packages/thirdweb/src/react/web/ui/Bridge/BuyWidget.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/TransactionWidget.tsx
📚 Learning: 2025-09-23T19:56:43.668Z
Learnt from: MananTank
PR: thirdweb-dev/js#8106
File: packages/thirdweb/src/react/web/ui/ConnectWallet/Modal/ConnectEmbed.tsx:482-485
Timestamp: 2025-09-23T19:56:43.668Z
Learning: In packages/thirdweb/src/react/web/ui/ConnectWallet/Modal/ConnectEmbed.tsx, the EmbedContainer uses width: "100vw" intentionally rather than "100%" - this is by design for the bridge widget embedding use case.

Applied to files:

  • packages/thirdweb/src/react/web/ui/Bridge/BuyWidget.tsx
📚 Learning: 2025-08-29T15:37:38.513Z
Learnt from: CR
PR: thirdweb-dev/js#0
File: AGENTS.md:0-0
Timestamp: 2025-08-29T15:37:38.513Z
Learning: Applies to packages/thirdweb/**/*.{ts,tsx} : Every public symbol must have comprehensive TSDoc with at least one compiling `example` and a custom tag (`beta`, `internal`, `experimental`, etc.)

Applied to files:

  • packages/thirdweb/src/react/web/ui/Bridge/types.ts
📚 Learning: 2025-07-18T19:19:55.613Z
Learnt from: CR
PR: thirdweb-dev/js#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-18T19:19:55.613Z
Learning: Applies to packages/thirdweb/src/exports/** : Every public symbol must have comprehensive TSDoc with at least one `example` block that compiles and custom annotation tags (`beta`, `internal`, `experimental`)

Applied to files:

  • packages/thirdweb/src/react/web/ui/Bridge/types.ts
🧬 Code graph analysis (8)
packages/thirdweb/src/react/web/ui/Bridge/payment-details/PaymentOverview.tsx (3)
packages/thirdweb/src/pay/convert/type.ts (1)
  • SupportedFiatCurrency (27-27)
packages/thirdweb/src/react/web/ui/Bridge/types.ts (2)
  • PaymentMethod (32-46)
  • ModeInfo (12-23)
packages/thirdweb/src/react/core/hooks/useTransactionDetails.ts (1)
  • useTransactionDetails (55-187)
packages/thirdweb/src/react/web/ui/Bridge/payment-details/PaymentDetails.tsx (3)
packages/thirdweb/src/pay/convert/type.ts (1)
  • SupportedFiatCurrency (27-27)
packages/thirdweb/src/react/web/ui/Bridge/types.ts (1)
  • ModeInfo (12-23)
packages/thirdweb/src/react/web/ui/components/basic.tsx (1)
  • ModalHeader (36-68)
packages/thirdweb/src/stories/Bridge/PaymentDetails.stories.tsx (3)
packages/thirdweb/src/react/web/ui/Bridge/payment-details/PaymentDetails.tsx (1)
  • PaymentDetails (63-450)
packages/thirdweb/src/stories/Bridge/fixtures.ts (4)
  • simpleOnrampQuote (93-123)
  • DIRECT_PAYMENT_UI_OPTIONS (704-797)
  • simpleBuyQuote (251-311)
  • TRANSACTION_UI_OPTIONS (800-840)
packages/thirdweb/src/stories/utils.tsx (2)
  • storyClient (14-16)
  • ModalThemeWrapper (18-36)
packages/thirdweb/src/react/web/ui/Bridge/CheckoutWidget.tsx (13)
packages/thirdweb/src/react/core/hooks/useBridgePrepare.ts (2)
  • BridgePrepareResult (23-27)
  • BridgePrepareRequest (14-18)
packages/thirdweb/src/react/web/ui/ConnectWallet/locale/getConnectLocale.ts (1)
  • useConnectLocale (45-54)
packages/thirdweb/src/react/web/ui/Bridge/common/token-query.ts (1)
  • useTokenQuery (13-45)
packages/thirdweb/src/react/web/ui/Bridge/ErrorBanner.tsx (1)
  • ErrorBanner (31-107)
packages/thirdweb/src/bridge/types/Token.ts (1)
  • TokenWithPrices (14-16)
packages/thirdweb/src/react/web/ui/Bridge/types.ts (2)
  • PaymentMethod (32-46)
  • RequiredParams (25-27)
packages/thirdweb/src/react/web/ui/Bridge/DirectPayment.tsx (1)
  • DirectPayment (48-205)
packages/thirdweb/src/react/web/ui/Bridge/payment-selection/PaymentSelection.tsx (1)
  • PaymentSelection (102-322)
packages/thirdweb/src/react/web/ui/Bridge/QuoteLoader.tsx (1)
  • QuoteLoader (83-164)
packages/thirdweb/src/react/web/ui/Bridge/payment-details/PaymentDetails.tsx (1)
  • PaymentDetails (63-450)
packages/thirdweb/src/react/web/ui/Bridge/StepRunner.tsx (1)
  • StepRunner (75-426)
packages/thirdweb/src/react/web/adapters/WindowAdapter.ts (1)
  • webWindowAdapter (23-23)
packages/thirdweb/src/react/web/ui/Bridge/payment-success/SuccessScreen.tsx (1)
  • SuccessScreen (53-199)
packages/thirdweb/src/react/web/ui/Bridge/BuyWidget.tsx (12)
packages/thirdweb/src/react/web/ui/ConnectWallet/locale/getConnectLocale.ts (1)
  • useConnectLocale (45-54)
packages/thirdweb/src/react/web/ui/Bridge/common/token-query.ts (1)
  • useTokenQuery (13-45)
packages/thirdweb/src/react/web/ui/Bridge/UnsupportedTokenScreen.tsx (1)
  • UnsupportedTokenScreen (25-101)
packages/thirdweb/src/react/web/ui/Bridge/ErrorBanner.tsx (1)
  • ErrorBanner (31-107)
packages/thirdweb/src/bridge/types/Token.ts (1)
  • TokenWithPrices (14-16)
packages/thirdweb/src/react/web/ui/Bridge/types.ts (2)
  • PaymentMethod (32-46)
  • RequiredParams (25-27)
packages/thirdweb/src/react/core/hooks/useBridgePrepare.ts (2)
  • BridgePrepareResult (23-27)
  • BridgePrepareRequest (14-18)
packages/thirdweb/src/react/core/hooks/useStepExecutor.ts (1)
  • CompletedStatusResult (19-26)
packages/thirdweb/src/react/web/ui/Bridge/FundWallet.tsx (1)
  • FundWallet (95-388)
packages/thirdweb/src/react/web/adapters/WindowAdapter.ts (1)
  • webWindowAdapter (23-23)
packages/thirdweb/src/react/web/ui/ConnectWallet/Modal/ConnectEmbed.tsx (1)
  • EmbedContainer (459-485)
packages/thirdweb/src/react/web/ui/components/DynamicHeight.tsx (1)
  • DynamicHeight (8-33)
packages/thirdweb/src/react/web/ui/Bridge/QuoteLoader.tsx (1)
packages/thirdweb/src/pay/types.ts (1)
  • PurchaseData (1-1)
packages/thirdweb/src/react/web/ui/Bridge/payment-selection/PaymentSelection.tsx (2)
packages/thirdweb/src/react/web/ui/PayEmbed.tsx (1)
  • PayEmbedConnectOptions (431-541)
packages/thirdweb/src/pay/convert/type.ts (1)
  • SupportedFiatCurrency (27-27)
packages/thirdweb/src/react/web/ui/Bridge/TransactionWidget.tsx (17)
packages/thirdweb/src/transaction/actions/wait-for-tx-receipt.ts (1)
  • WaitForReceiptOptions (14-20)
packages/thirdweb/src/react/web/ui/ConnectWallet/locale/getConnectLocale.ts (1)
  • useConnectLocale (45-54)
packages/thirdweb/src/exports/utils.ts (1)
  • stringify (189-189)
packages/thirdweb/src/bridge/types/Token.ts (1)
  • TokenWithPrices (14-16)
packages/thirdweb/src/react/web/ui/Bridge/types.ts (1)
  • PaymentMethod (32-46)
packages/thirdweb/src/react/core/hooks/useBridgePrepare.ts (2)
  • BridgePrepareResult (23-27)
  • BridgePrepareRequest (14-18)
packages/thirdweb/src/react/core/hooks/useStepExecutor.ts (1)
  • CompletedStatusResult (19-26)
packages/thirdweb/src/react/web/ui/Bridge/TransactionPayment.tsx (1)
  • TransactionPayment (80-448)
packages/thirdweb/src/react/web/ui/Bridge/payment-selection/PaymentSelection.tsx (1)
  • PaymentSelection (102-322)
packages/thirdweb/src/react/web/ui/Bridge/QuoteLoader.tsx (1)
  • QuoteLoader (83-164)
packages/thirdweb/src/react/web/ui/Bridge/payment-details/PaymentDetails.tsx (1)
  • PaymentDetails (63-450)
packages/thirdweb/src/react/web/ui/Bridge/StepRunner.tsx (1)
  • StepRunner (75-426)
packages/thirdweb/src/react/web/adapters/WindowAdapter.ts (1)
  • webWindowAdapter (23-23)
packages/thirdweb/src/react/web/ui/Bridge/payment-success/SuccessScreen.tsx (1)
  • SuccessScreen (53-199)
packages/thirdweb/src/react/web/ui/Bridge/ErrorBanner.tsx (1)
  • ErrorBanner (31-107)
packages/thirdweb/src/react/web/ui/TransactionButton/ExecutingScreen.tsx (1)
  • ExecutingTxScreen (19-183)
packages/thirdweb/src/react/web/ui/ConnectWallet/Modal/ConnectEmbed.tsx (1)
  • EmbedContainer (459-485)
🔇 Additional comments (40)
packages/thirdweb/src/react/web/ui/Bridge/payment-selection/TokenSelection.tsx (1)

17-17: LGTM! Import path update aligns with type consolidation.

The PaymentMethod type import now references the centralized Bridge types module, consistent with the broader refactor to consolidate UI bridge types into a single source of truth.

packages/thirdweb/src/react/web/ui/Bridge/QuoteLoader.tsx (4)

19-19: LGTM! Import path aligns with type consolidation.

The PaymentMethod import now references the centralized Bridge types module.


40-80: Explicit undefined typing clarifies contracts.

The props signature updates make optional fields explicitly typed as | undefined rather than using optional syntax (?:), and introduce feePayer and mode props to replace the previous uiOptions-based approach. This improves type safety and aligns with the broader refactor to explicit prop contracts.


94-129: Mode-based event tracking correctly replaces uiOptions logic.

The new mode prop ("direct_payment" | "fund_wallet" | "transaction") drives analytics event naming, and feePayer is now explicitly passed rather than derived from uiOptions. The event tracking call correctly uses the mode value.


166-240: Fee payer correctly propagated through bridge params.

The getBridgeParams function signature now includes feePayer and passes it to both transfer and onramp paths (lines 208, 173). The default "sender" value is applied when feePayer is undefined (line 208), ensuring consistent behavior.

packages/thirdweb/src/react/web/ui/Bridge/BuyWidget.tsx (5)

328-338: LGTM! Clean container/content separation.

The refactor into BridgeWidgetContainer and BridgeWidgetContentWrapper provides clear separation of theming/layout concerns from content orchestration logic.


342-346: Token query flow correctly replaces bridge data query.

The useTokenQuery hook provides token-based routing, enabling clean separation between unsupported tokens, successful token resolution, and error cases.


431-473: Screen state machine provides clear navigation.

The discriminated union types for screen states enable type-safe navigation between widget screens, ensuring each screen receives its required props.


514-721: Multi-screen orchestration correctly wires navigation.

The BridgeWidgetContent function properly orchestrates transitions between screens (buy-ui → methodSelection → load-quote → preview → execute → success/error), and handlers (handleError, handleCancel) centralize error/cancel logic.


726-743: Container correctly applies theming and layout.

The BridgeWidgetContainer wraps content with CustomThemeProvider, EmbedContainer, and DynamicHeight for consistent theming and responsive height behavior.

packages/thirdweb/src/react/web/ui/Bridge/payment-details/PaymentDetails.tsx (5)

7-7: LGTM! Import addition supports explicit currency typing.

The SupportedFiatCurrency import enables explicit typing of the new currency prop.


20-20: LGTM! Import addition supports new type surface.

The ModeInfo and PaymentMethod imports align with the centralized Bridge types refactor.


24-61: Metadata-driven props improve clarity.

The props signature now explicitly receives metadata, currency, and modeInfo instead of relying on nested uiOptions, making the component's requirements clear and type-safe.


274-277: Header correctly derives title from metadata.

The ModalHeader uses metadata.title with a sensible fallback ("Payment Details"), ensuring a title is always displayed.


285-299: PaymentOverview correctly receives explicit props.

The component invocation passes currency, metadata, and modeInfo directly, aligning with the updated PaymentOverview signature.

packages/thirdweb/src/react/web/ui/Bridge/CheckoutWidget.tsx (5)

315-325: LGTM! Container/content separation mirrors BuyWidget pattern.

The refactor into CheckoutWidgetContainer and CheckoutWidgetContentWrapper provides consistent architecture with BuyWidget.


329-333: Token query flow correctly replaces bridge data query.

The useTokenQuery hook enables token-based routing between unsupported tokens, successful resolution, and error cases.


417-459: Screen state machine enables type-safe navigation.

The discriminated union for screen states ensures each screen receives its required data at compile time.


501-712: Multi-screen orchestration correctly wires flow.

The screen transitions and handlers (handleError, handleCancel) properly orchestrate the checkout flow from init-ui through to success/error states.


717-734: Container applies consistent theming.

The container pattern mirrors BuyWidget, providing theme and layout wrapping.

packages/thirdweb/src/react/web/ui/Bridge/types.ts (1)

1-46: LGTM! Centralized type definitions improve maintainability.

The new types module consolidates Bridge UI types into a single source of truth, with clear discriminated unions for ModeInfo and PaymentMethod that enable type-safe handling across payment flows. The RequiredParams utility provides a clean way to enforce required fields on types.

As confirmed in the past review, these types are internal to the Bridge UI and don't require TSDoc since they're not re-exported through the public API.

packages/thirdweb/src/react/web/ui/Bridge/payment-details/PaymentOverview.tsx (5)

4-5: LGTM! Import additions support explicit prop typing.

The added imports enable explicit typing of the new currency prop and transaction-related logic.


16-16: LGTM! Import additions align with type consolidation.

The ModeInfo and PaymentMethod imports reference the centralized Bridge types module.


18-41: Explicit props improve clarity and type safety.

The component signature now explicitly receives currency, metadata, and modeInfo instead of nested uiOptions, making requirements clear and enabling better type checking.


144-206: Mode-based rendering correctly accesses modeInfo fields.

Each rendering branch (direct_payment, fund_wallet, transaction) correctly accesses the appropriate fields from modeInfo, and the discriminated union ensures type safety at each access point.


212-228: TransactionOverViewCompact correctly receives explicit props.

The internal component signature and invocation properly pass transaction, currency, and metadata directly, and useTransactionDetails receives the correct parameters.

packages/thirdweb/src/react/web/ui/Bridge/payment-selection/PaymentSelection.tsx (3)

21-21: LGTM! Import path aligns with type consolidation.

The PaymentMethod import now references the centralized Bridge types module.


26-94: Explicit prop typing clarifies component contract.

The props signature updates convert optional fields to explicit | undefined typing and make several fields required (destinationToken, destinationAmount, receiverAddress, onBack, paymentMethods, currency). This eliminates ambiguity and improves type safety.


96-100: Step type expansion supports token selection flow.

The addition of the tokenSelection variant with selectedWallet enables proper type-safe handling of the token selection screen state.

packages/thirdweb/src/stories/Bridge/PaymentDetails.stories.tsx (4)

1-16: LGTM!

The imports are correctly updated to reflect the refactored component structure, importing PaymentDetails directly and removing the wrapper-based approach.


61-87: LGTM!

The meta configuration is properly structured with appropriate defaults and the ModalThemeWrapper decorator for consistent theming across stories.


152-162: LGTM!

The transaction mode story correctly overrides modeInfo with mode: "transaction" and the associated transaction field before spreading the UI options.


164-186: LGTM!

Both transaction mode stories correctly override modeInfo with mode: "transaction" and the associated transaction field.

packages/thirdweb/src/react/web/ui/Bridge/TransactionWidget.tsx (7)

1-55: LGTM!

The imports are correctly updated to support the refactored multi-screen architecture, including new types for state management and screen-specific components.


56-215: LGTM!

The prop types are well-defined. The onSuccess signature change from () => void to (data: WaitForReceiptOptions) => void is appropriate for the refactored architecture, providing callers with transaction receipt details including chain, client, and transaction hash.


329-340: LGTM!

Clean component structure that delegates to container (for theming/styling) and content wrapper (for data loading and state management).


485-539: LGTM!

Well-structured screen state machine using discriminated unions, and clean RequiredParams utility type for enforcing required fields in component props.


541-596: LGTM!

The component is properly initialized with required parameters, and the init-ui screen correctly wires the TransactionPayment component with appropriate callbacks for state transitions.


598-752: LGTM!

The payment flow screens are correctly implemented with proper state transitions, error handling, and prop wiring. The success screen correctly sets showContinueWithTx={true} and transitions to transaction execution on user confirmation.


754-808: LGTM!

The error and execute-tx screens are correctly wired with appropriate callbacks. The ExecutingTxScreen properly receives the transaction and calls props.onSuccess with WaitForReceiptOptions data, and the container component correctly applies theming and layout.

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: 1

🧹 Nitpick comments (1)
packages/thirdweb/src/stories/Bridge/Transaction/useSendTransactionModal.stories.tsx (1)

22-35: Use realistic transaction amounts in demo stories. The Bridge transaction stories use toWei("100") (100 ETH), whereas other examples (e.g. PayEmbed stories) use toWei("0.123") (~0.123 ETH). Reduce to a smaller value like toWei("0.01") or match existing examples to avoid large demo transactions.

📜 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 3496e97 and 07614c1.

📒 Files selected for processing (1)
  • packages/thirdweb/src/stories/Bridge/Transaction/useSendTransactionModal.stories.tsx (1 hunks)
🧰 Additional context used
📓 Path-based instructions (4)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.{ts,tsx}: Write idiomatic TypeScript with explicit function declarations and return types
Limit each file to one stateless, single-responsibility function for clarity
Re-use shared types from @/types or local types.ts barrels
Prefer type aliases over interface except for nominal shapes
Avoid any and unknown unless unavoidable; narrow generics when possible
Choose composition over inheritance; leverage utility types (Partial, Pick, etc.)
Comment only ambiguous logic; avoid restating TypeScript in prose

**/*.{ts,tsx}: Use explicit function declarations and explicit return types in TypeScript
Limit each file to one stateless, single‑responsibility function
Re‑use shared types from @/types where applicable
Prefer type aliases over interface except for nominal shapes
Avoid any and unknown unless unavoidable; narrow generics when possible
Prefer composition over inheritance; use utility types (Partial, Pick, etc.)
Lazy‑import optional features and avoid top‑level side‑effects to reduce bundle size

Files:

  • packages/thirdweb/src/stories/Bridge/Transaction/useSendTransactionModal.stories.tsx
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (CLAUDE.md)

Load heavy dependencies inside async paths to keep initial bundle lean (lazy loading)

Files:

  • packages/thirdweb/src/stories/Bridge/Transaction/useSendTransactionModal.stories.tsx
**/*.stories.tsx

📄 CodeRabbit inference engine (CLAUDE.md)

For new UI components, add Storybook stories (*.stories.tsx) alongside the code

Files:

  • packages/thirdweb/src/stories/Bridge/Transaction/useSendTransactionModal.stories.tsx
packages/thirdweb/**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

packages/thirdweb/**/*.{ts,tsx}: Every public symbol must have comprehensive TSDoc with at least one compiling @example and a custom tag (@beta, @internal, @experimental, etc.)
Comment only ambiguous logic; avoid restating TypeScript in prose
Lazy‑load heavy dependencies inside async paths (e.g., const { jsPDF } = await import("jspdf"))

Files:

  • packages/thirdweb/src/stories/Bridge/Transaction/useSendTransactionModal.stories.tsx
🧠 Learnings (1)
📚 Learning: 2025-08-29T15:37:38.513Z
Learnt from: CR
PR: thirdweb-dev/js#0
File: AGENTS.md:0-0
Timestamp: 2025-08-29T15:37:38.513Z
Learning: Applies to apps/{dashboard,playground}/**/*.stories.tsx : Add Storybook stories (`*.stories.tsx`) alongside new UI components

Applied to files:

  • packages/thirdweb/src/stories/Bridge/Transaction/useSendTransactionModal.stories.tsx
🧬 Code graph analysis (1)
packages/thirdweb/src/stories/Bridge/Transaction/useSendTransactionModal.stories.tsx (3)
packages/thirdweb/src/exports/thirdweb.ts (2)
  • prepareTransaction (181-181)
  • PreparedTransaction (179-179)
packages/thirdweb/src/exports/chains.ts (2)
  • base (17-17)
  • sepolia (74-74)
packages/thirdweb/src/stories/utils.tsx (1)
  • storyClient (14-16)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (7)
  • GitHub Check: E2E Tests (pnpm, webpack)
  • GitHub Check: E2E Tests (pnpm, esbuild)
  • GitHub Check: Size
  • GitHub Check: Unit Tests
  • GitHub Check: Lint Packages
  • GitHub Check: Build Packages
  • GitHub Check: Analyze (javascript)
🔇 Additional comments (3)
packages/thirdweb/src/stories/Bridge/Transaction/useSendTransactionModal.stories.tsx (3)

1-14: LGTM!

The imports are well-organized and all appear to be utilized in the story file.


16-20: LGTM!

The Storybook meta configuration correctly references the Variant component and uses an appropriate title hierarchy.


37-47: LGTM!

The story configurations are well-structured with descriptive names that clearly communicate their purpose.

@graphite-app
Copy link
Contributor

graphite-app bot commented Oct 3, 2025

Merge activity

…8169)

<!--

## title your PR with this format: "[SDK/Dashboard/Portal] Feature/Fix: Concise title for the changes"

If you did not copy the branch name from Linear, paste the issue tag here (format is TEAM-0000):

## Notes for the reviewer

Anything important to call out? Be sure to also clarify these in your comments.

## How to test

Unit tests, playground, etc.

-->

<!-- start pr-codex -->

---

## PR-Codex overview
This PR primarily focuses on refactoring and updating various components related to payment and transaction handling in the `thirdweb` library. It introduces new props, modifies existing interfaces, and cleans up the codebase by removing unused files.

### Detailed summary
- Deleted several unused files related to payment and transaction handling.
- Updated `transaction` and `payment` components to use new props and interfaces.
- Replaced `type` definitions with `interface` in some components for consistency.
- Improved error handling and state management in transaction modals.
- Enhanced `SuccessScreen` and `UnsupportedTokenScreen` with new props for better UI.
- Modified various story files to reflect component updates and new props.
- Adjusted payment selection and fund wallet components to align with new data structures.

> The following files were skipped due to too many changes: `packages/thirdweb/src/stories/Bridge/CheckoutWidget.stories.tsx`, `packages/thirdweb/src/stories/Bridge/PaymentSelection.stories.tsx`, `packages/thirdweb/src/stories/Bridge/fixtures.ts`, `packages/thirdweb/src/react/web/ui/Bridge/payment-details/PaymentOverview.tsx`, `packages/thirdweb/src/stories/Bridge/PaymentDetails.stories.tsx`, `packages/thirdweb/src/react/web/ui/Bridge/TransactionWidget.tsx`, `packages/thirdweb/src/react/web/ui/Bridge/BuyWidget.tsx`, `packages/thirdweb/src/react/web/ui/Bridge/CheckoutWidget.tsx`

> ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}`

<!-- end pr-codex -->

<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit

* **New Features**
  * Optional fiat currency display across payment & transaction modals (defaults to USD).
  * Token support detection with a dedicated unsupported-token screen.

* **Refactor**
  * Bridge flows reorganized into modular multi-step UIs (selection, quote, preview, execute, success).
  * Components now use explicit metadata (title/description/image) and explicit currency/mode props; branding handling centralized.

* **Documentation**
  * Storybook reorganized: decorator-based theming, updated/added widget stories, and cleaned-up story exports.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
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: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
packages/thirdweb/src/react/web/ui/Bridge/BuyWidget.tsx (1)

375-429: Remove unreachable final return
The return null at the end is dead code—useTokenQuery always yields pending, unsupported, success, or error. Drop this branch.

♻️ Duplicate comments (5)
packages/thirdweb/src/react/web/ui/Bridge/common/token-query.ts (2)

13-17: Add comprehensive TSDoc with example.

This public hook is missing TSDoc documentation. Per coding guidelines for packages/thirdweb/**/*.{ts,tsx}, every public symbol must have comprehensive TSDoc with at least one compiling @example and a custom tag (@beta, @internal, @experimental, etc.).

As per coding guidelines.


19-39: Fix error handling logic.

Line 26 evaluates a ternary expression inside .catch() but doesn't return its result. This means errors are always swallowed, and token will be undefined for both unsupported tokens and other errors.

Apply this diff to fix the error handling:

       ).catch((err) => {
-        err.message.includes("not supported") ? undefined : Promise.reject(err);
+        if (!err.message.includes("not supported")) {
+          throw err;
+        }
+        return undefined;
       });
packages/thirdweb/src/stories/Bridge/PaymentDetails.stories.tsx (2)

99-105: Verify modeInfo is set correctly for direct payment story.

The OnrampSimpleDirectPayment story spreads DIRECT_PAYMENT_UI_OPTIONS.credits but doesn't explicitly override modeInfo. Since the default meta args set modeInfo: { mode: "fund_wallet" }, this story may be incorrectly displaying a fund wallet mode instead of direct payment mode.

Check if the fixture includes modeInfo:

#!/bin/bash
# Description: Check if DIRECT_PAYMENT_UI_OPTIONS includes modeInfo

# Search for DIRECT_PAYMENT_UI_OPTIONS definition
ast-grep --pattern $'export const DIRECT_PAYMENT_UI_OPTIONS: $_ = {
  $$$
  credits: {
    $$$
  }
  $$$
}'

If modeInfo is not in the fixture, apply this diff:

 export const OnrampSimpleDirectPayment: Story = {
   args: {
     paymentMethod: fiatPaymentMethod,
     preparedQuote: simpleOnrampQuote,
+    modeInfo: {
+      mode: "direct_payment",
+      paymentInfo: DIRECT_PAYMENT_UI_OPTIONS.credits.paymentInfo,
+    },
     ...DIRECT_PAYMENT_UI_OPTIONS.credits,
   },
 };

121-127: Verify modeInfo is set correctly for direct payment story.

The BuySimpleDirectPayment story spreads DIRECT_PAYMENT_UI_OPTIONS.digitalArt but doesn't explicitly override modeInfo. Since the default meta args set modeInfo: { mode: "fund_wallet" }, this story may be incorrectly displaying a fund wallet mode instead of direct payment mode.

Check if the fixture includes modeInfo:

#!/bin/bash
# Description: Check if DIRECT_PAYMENT_UI_OPTIONS includes modeInfo for digitalArt

# Search for DIRECT_PAYMENT_UI_OPTIONS definition
ast-grep --pattern $'export const DIRECT_PAYMENT_UI_OPTIONS: $_ = {
  $$$
  digitalArt: {
    $$$
  }
  $$$
}'

If modeInfo is not in the fixture, apply this diff:

 export const BuySimpleDirectPayment: Story = {
   args: {
     paymentMethod: ethCryptoPaymentMethod,
     preparedQuote: simpleBuyQuote,
+    modeInfo: {
+      mode: "direct_payment",
+      paymentInfo: DIRECT_PAYMENT_UI_OPTIONS.digitalArt.paymentInfo,
+    },
     ...DIRECT_PAYMENT_UI_OPTIONS.digitalArt,
   },
 };
packages/thirdweb/src/react/web/ui/Bridge/common/WithHeader.tsx (1)

9-15: Add explicit return type and TSDoc.

Per coding guidelines, public components in packages/thirdweb/** must have comprehensive TSDoc with at least one @example and a custom tag (@internal, etc.), plus an explicit return type.

Apply this diff:

+/**
+ * Renders content with an optional header containing title, description, and image.
+ * @param props - Component properties
+ * @param props.children - Content to render below the header
+ * @param props.title - Header title text
+ * @param props.description - Optional header description
+ * @param props.image - Optional header image URL (supports IPFS)
+ * @param props.client - ThirdwebClient for resolving IPFS URLs
+ * @returns React component with optional header wrapper
+ * @example
+ * ```tsx
+ * <WithHeader
+ *   client={client}
+ *   title="Fund Wallet"
+ *   description="Add funds to your wallet"
+ *   image="ipfs://..."
+ * >
+ *   <div>Content</div>
+ * </WithHeader>
+ * ```
+ * @internal
+ */
 export function WithHeader(props: {
   children: React.ReactNode;
   title: string;
   description: string | undefined;
   image: string | undefined;
   client: ThirdwebClient;
-}) {
+}): React.JSX.Element {

As per coding guidelines.

🧹 Nitpick comments (2)
packages/thirdweb/src/stories/BuyWidget.stories.tsx (1)

16-18: Excellent story coverage for various BuyWidget scenarios.

The renamed and new stories effectively demonstrate:

  • Native token purchases (BuyBaseNativeToken)
  • ERC-20 token purchases (BuyBaseUSDC)
  • UI customization (CustomTitleDescriptionAndButtonLabel, HideTitle)
  • Large amount handling across chains (LargeAmount)

Consider adding explicit return type annotations to align with the TypeScript coding guidelines:

-export function BuyBaseNativeToken() {
+export function BuyBaseNativeToken(): JSX.Element {
   return <BuyWidget client={storyClient} chain={base} amount="0.1" />;
 }

-export function BuyBaseUSDC() {
+export function BuyBaseUSDC(): JSX.Element {
   return (
     <BuyWidget
       client={storyClient}
       chain={base}
       amount="0.1"
       tokenAddress="0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"
     />
   );
 }

-export function CustomTitleDescriptionAndButtonLabel() {
+export function CustomTitleDescriptionAndButtonLabel(): JSX.Element {
   return (
     <BuyWidget
       client={storyClient}
       title="Custom Title"
       description="Custom Description"
       chain={base}
       amount="0.1"
       tokenAddress="0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"
       buttonLabel="Custom Button Label"
     />
   );
 }

-export function HideTitle() {
+export function HideTitle(): JSX.Element {
   return (
     <BuyWidget
       client={storyClient}
       title=""
       chain={base}
       amount="0.1"
       tokenAddress="0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"
     />
   );
 }

-export function LargeAmount() {
+export function LargeAmount(): JSX.Element {
   return (
     <BuyWidget
       client={storyClient}
       chain={ethereum}
       tokenAddress="0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984"
       amount="150000"
     />
   );
 }

As per coding guidelines

Also applies to: 20-29, 31-43, 45-55, 96-105

packages/thirdweb/src/react/web/ui/Bridge/CheckoutWidget.tsx (1)

362-415: Remove unreachable return null fallback
The final return null in CheckoutWidget.tsx can never be reached—useTokenQuery always yields a pending, error, or valid-data state.

📜 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 07614c1 and ef9cf34.

📒 Files selected for processing (43)
  • apps/playground-web/src/app/payments/components/RightSection.tsx (0 hunks)
  • packages/thirdweb/src/react/core/hooks/transaction/useSendTransaction.ts (2 hunks)
  • packages/thirdweb/src/react/core/hooks/usePaymentMethods.ts (1 hunks)
  • packages/thirdweb/src/react/core/machines/paymentMachine.test.ts (0 hunks)
  • packages/thirdweb/src/react/core/machines/paymentMachine.ts (0 hunks)
  • packages/thirdweb/src/react/web/hooks/transaction/useSendTransaction.tsx (1 hunks)
  • packages/thirdweb/src/react/web/ui/Bridge/BridgeOrchestrator.tsx (0 hunks)
  • packages/thirdweb/src/react/web/ui/Bridge/BuyWidget.tsx (5 hunks)
  • packages/thirdweb/src/react/web/ui/Bridge/CheckoutWidget.tsx (6 hunks)
  • packages/thirdweb/src/react/web/ui/Bridge/DirectPayment.tsx (5 hunks)
  • packages/thirdweb/src/react/web/ui/Bridge/FundWallet.tsx (9 hunks)
  • packages/thirdweb/src/react/web/ui/Bridge/QuoteLoader.tsx (4 hunks)
  • packages/thirdweb/src/react/web/ui/Bridge/StepRunner.tsx (3 hunks)
  • packages/thirdweb/src/react/web/ui/Bridge/TransactionPayment.tsx (10 hunks)
  • packages/thirdweb/src/react/web/ui/Bridge/TransactionWidget.tsx (8 hunks)
  • packages/thirdweb/src/react/web/ui/Bridge/UnsupportedTokenScreen.tsx (1 hunks)
  • packages/thirdweb/src/react/web/ui/Bridge/common/WithHeader.tsx (3 hunks)
  • packages/thirdweb/src/react/web/ui/Bridge/common/token-query.ts (1 hunks)
  • packages/thirdweb/src/react/web/ui/Bridge/payment-details/PaymentDetails.tsx (5 hunks)
  • packages/thirdweb/src/react/web/ui/Bridge/payment-details/PaymentOverview.tsx (10 hunks)
  • packages/thirdweb/src/react/web/ui/Bridge/payment-selection/PaymentSelection.tsx (4 hunks)
  • packages/thirdweb/src/react/web/ui/Bridge/payment-selection/TokenSelection.tsx (1 hunks)
  • packages/thirdweb/src/react/web/ui/Bridge/payment-success/SuccessScreen.tsx (4 hunks)
  • packages/thirdweb/src/react/web/ui/Bridge/swap-widget/SwapWidget.tsx (6 hunks)
  • packages/thirdweb/src/react/web/ui/Bridge/types.ts (1 hunks)
  • packages/thirdweb/src/react/web/ui/TransactionButton/DepositScreen.tsx (1 hunks)
  • packages/thirdweb/src/react/web/ui/TransactionButton/TransactionModal.tsx (6 hunks)
  • packages/thirdweb/src/stories/Bridge/BridgeOrchestrator.stories.tsx (0 hunks)
  • packages/thirdweb/src/stories/Bridge/CheckoutWidget.stories.tsx (1 hunks)
  • packages/thirdweb/src/stories/Bridge/DirectPayment.stories.tsx (0 hunks)
  • packages/thirdweb/src/stories/Bridge/ErrorBanner.stories.tsx (2 hunks)
  • packages/thirdweb/src/stories/Bridge/FundWallet.stories.tsx (0 hunks)
  • packages/thirdweb/src/stories/Bridge/PaymentDetails.stories.tsx (2 hunks)
  • packages/thirdweb/src/stories/Bridge/PaymentSelection.stories.tsx (1 hunks)
  • packages/thirdweb/src/stories/Bridge/StepRunner.stories.tsx (1 hunks)
  • packages/thirdweb/src/stories/Bridge/SuccessScreen.stories.tsx (2 hunks)
  • packages/thirdweb/src/stories/Bridge/Transaction/TransactionWidget.stories.tsx (1 hunks)
  • packages/thirdweb/src/stories/Bridge/Transaction/useSendTransactionModal.stories.tsx (1 hunks)
  • packages/thirdweb/src/stories/Bridge/TransactionPayment.stories.tsx (0 hunks)
  • packages/thirdweb/src/stories/Bridge/UnsupportedTokenScreen.stories.tsx (1 hunks)
  • packages/thirdweb/src/stories/Bridge/fixtures.ts (9 hunks)
  • packages/thirdweb/src/stories/BuyWidget.stories.tsx (3 hunks)
  • packages/thirdweb/src/stories/utils.tsx (1 hunks)
💤 Files with no reviewable changes (8)
  • packages/thirdweb/src/stories/Bridge/FundWallet.stories.tsx
  • apps/playground-web/src/app/payments/components/RightSection.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/BridgeOrchestrator.tsx
  • packages/thirdweb/src/stories/Bridge/TransactionPayment.stories.tsx
  • packages/thirdweb/src/stories/Bridge/BridgeOrchestrator.stories.tsx
  • packages/thirdweb/src/react/core/machines/paymentMachine.ts
  • packages/thirdweb/src/react/core/machines/paymentMachine.test.ts
  • packages/thirdweb/src/stories/Bridge/DirectPayment.stories.tsx
🚧 Files skipped from review as they are similar to previous changes (6)
  • packages/thirdweb/src/stories/Bridge/StepRunner.stories.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/payment-selection/TokenSelection.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/types.ts
  • packages/thirdweb/src/react/core/hooks/transaction/useSendTransaction.ts
  • packages/thirdweb/src/react/web/hooks/transaction/useSendTransaction.tsx
  • packages/thirdweb/src/stories/Bridge/CheckoutWidget.stories.tsx
🧰 Additional context used
📓 Path-based instructions (4)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.{ts,tsx}: Write idiomatic TypeScript with explicit function declarations and return types
Limit each file to one stateless, single-responsibility function for clarity
Re-use shared types from @/types or local types.ts barrels
Prefer type aliases over interface except for nominal shapes
Avoid any and unknown unless unavoidable; narrow generics when possible
Choose composition over inheritance; leverage utility types (Partial, Pick, etc.)
Comment only ambiguous logic; avoid restating TypeScript in prose

**/*.{ts,tsx}: Use explicit function declarations and explicit return types in TypeScript
Limit each file to one stateless, single‑responsibility function
Re‑use shared types from @/types where applicable
Prefer type aliases over interface except for nominal shapes
Avoid any and unknown unless unavoidable; narrow generics when possible
Prefer composition over inheritance; use utility types (Partial, Pick, etc.)
Lazy‑import optional features and avoid top‑level side‑effects to reduce bundle size

Files:

  • packages/thirdweb/src/react/web/ui/TransactionButton/DepositScreen.tsx
  • packages/thirdweb/src/stories/utils.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/payment-success/SuccessScreen.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/payment-details/PaymentDetails.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/StepRunner.tsx
  • packages/thirdweb/src/stories/Bridge/fixtures.ts
  • packages/thirdweb/src/react/web/ui/Bridge/payment-details/PaymentOverview.tsx
  • packages/thirdweb/src/stories/Bridge/Transaction/TransactionWidget.stories.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/BuyWidget.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/UnsupportedTokenScreen.tsx
  • packages/thirdweb/src/stories/BuyWidget.stories.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/TransactionPayment.tsx
  • packages/thirdweb/src/stories/Bridge/ErrorBanner.stories.tsx
  • packages/thirdweb/src/stories/Bridge/PaymentDetails.stories.tsx
  • packages/thirdweb/src/stories/Bridge/Transaction/useSendTransactionModal.stories.tsx
  • packages/thirdweb/src/react/core/hooks/usePaymentMethods.ts
  • packages/thirdweb/src/react/web/ui/Bridge/payment-selection/PaymentSelection.tsx
  • packages/thirdweb/src/react/web/ui/TransactionButton/TransactionModal.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/common/WithHeader.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/QuoteLoader.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/CheckoutWidget.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/swap-widget/SwapWidget.tsx
  • packages/thirdweb/src/stories/Bridge/PaymentSelection.stories.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/TransactionWidget.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/FundWallet.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/DirectPayment.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/common/token-query.ts
  • packages/thirdweb/src/stories/Bridge/SuccessScreen.stories.tsx
  • packages/thirdweb/src/stories/Bridge/UnsupportedTokenScreen.stories.tsx
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (CLAUDE.md)

Load heavy dependencies inside async paths to keep initial bundle lean (lazy loading)

Files:

  • packages/thirdweb/src/react/web/ui/TransactionButton/DepositScreen.tsx
  • packages/thirdweb/src/stories/utils.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/payment-success/SuccessScreen.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/payment-details/PaymentDetails.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/StepRunner.tsx
  • packages/thirdweb/src/stories/Bridge/fixtures.ts
  • packages/thirdweb/src/react/web/ui/Bridge/payment-details/PaymentOverview.tsx
  • packages/thirdweb/src/stories/Bridge/Transaction/TransactionWidget.stories.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/BuyWidget.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/UnsupportedTokenScreen.tsx
  • packages/thirdweb/src/stories/BuyWidget.stories.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/TransactionPayment.tsx
  • packages/thirdweb/src/stories/Bridge/ErrorBanner.stories.tsx
  • packages/thirdweb/src/stories/Bridge/PaymentDetails.stories.tsx
  • packages/thirdweb/src/stories/Bridge/Transaction/useSendTransactionModal.stories.tsx
  • packages/thirdweb/src/react/core/hooks/usePaymentMethods.ts
  • packages/thirdweb/src/react/web/ui/Bridge/payment-selection/PaymentSelection.tsx
  • packages/thirdweb/src/react/web/ui/TransactionButton/TransactionModal.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/common/WithHeader.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/QuoteLoader.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/CheckoutWidget.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/swap-widget/SwapWidget.tsx
  • packages/thirdweb/src/stories/Bridge/PaymentSelection.stories.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/TransactionWidget.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/FundWallet.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/DirectPayment.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/common/token-query.ts
  • packages/thirdweb/src/stories/Bridge/SuccessScreen.stories.tsx
  • packages/thirdweb/src/stories/Bridge/UnsupportedTokenScreen.stories.tsx
packages/thirdweb/**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

packages/thirdweb/**/*.{ts,tsx}: Every public symbol must have comprehensive TSDoc with at least one compiling @example and a custom tag (@beta, @internal, @experimental, etc.)
Comment only ambiguous logic; avoid restating TypeScript in prose
Lazy‑load heavy dependencies inside async paths (e.g., const { jsPDF } = await import("jspdf"))

Files:

  • packages/thirdweb/src/react/web/ui/TransactionButton/DepositScreen.tsx
  • packages/thirdweb/src/stories/utils.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/payment-success/SuccessScreen.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/payment-details/PaymentDetails.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/StepRunner.tsx
  • packages/thirdweb/src/stories/Bridge/fixtures.ts
  • packages/thirdweb/src/react/web/ui/Bridge/payment-details/PaymentOverview.tsx
  • packages/thirdweb/src/stories/Bridge/Transaction/TransactionWidget.stories.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/BuyWidget.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/UnsupportedTokenScreen.tsx
  • packages/thirdweb/src/stories/BuyWidget.stories.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/TransactionPayment.tsx
  • packages/thirdweb/src/stories/Bridge/ErrorBanner.stories.tsx
  • packages/thirdweb/src/stories/Bridge/PaymentDetails.stories.tsx
  • packages/thirdweb/src/stories/Bridge/Transaction/useSendTransactionModal.stories.tsx
  • packages/thirdweb/src/react/core/hooks/usePaymentMethods.ts
  • packages/thirdweb/src/react/web/ui/Bridge/payment-selection/PaymentSelection.tsx
  • packages/thirdweb/src/react/web/ui/TransactionButton/TransactionModal.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/common/WithHeader.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/QuoteLoader.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/CheckoutWidget.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/swap-widget/SwapWidget.tsx
  • packages/thirdweb/src/stories/Bridge/PaymentSelection.stories.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/TransactionWidget.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/FundWallet.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/DirectPayment.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/common/token-query.ts
  • packages/thirdweb/src/stories/Bridge/SuccessScreen.stories.tsx
  • packages/thirdweb/src/stories/Bridge/UnsupportedTokenScreen.stories.tsx
**/*.stories.tsx

📄 CodeRabbit inference engine (CLAUDE.md)

For new UI components, add Storybook stories (*.stories.tsx) alongside the code

Files:

  • packages/thirdweb/src/stories/Bridge/Transaction/TransactionWidget.stories.tsx
  • packages/thirdweb/src/stories/BuyWidget.stories.tsx
  • packages/thirdweb/src/stories/Bridge/ErrorBanner.stories.tsx
  • packages/thirdweb/src/stories/Bridge/PaymentDetails.stories.tsx
  • packages/thirdweb/src/stories/Bridge/Transaction/useSendTransactionModal.stories.tsx
  • packages/thirdweb/src/stories/Bridge/PaymentSelection.stories.tsx
  • packages/thirdweb/src/stories/Bridge/SuccessScreen.stories.tsx
  • packages/thirdweb/src/stories/Bridge/UnsupportedTokenScreen.stories.tsx
🧠 Learnings (14)
📚 Learning: 2025-08-29T15:37:38.513Z
Learnt from: CR
PR: thirdweb-dev/js#0
File: AGENTS.md:0-0
Timestamp: 2025-08-29T15:37:38.513Z
Learning: Applies to apps/{dashboard,playground}/**/*.stories.tsx : Add Storybook stories (`*.stories.tsx`) alongside new UI components

Applied to files:

  • packages/thirdweb/src/stories/Bridge/Transaction/TransactionWidget.stories.tsx
  • packages/thirdweb/src/stories/Bridge/Transaction/useSendTransactionModal.stories.tsx
📚 Learning: 2025-09-24T11:08:43.783Z
Learnt from: MananTank
PR: thirdweb-dev/js#8106
File: packages/thirdweb/src/react/web/ui/Bridge/bridge-widget/bridge-widget.tsx:34-41
Timestamp: 2025-09-24T11:08:43.783Z
Learning: In BridgeWidgetProps for packages/thirdweb/src/react/web/ui/Bridge/bridge-widget/bridge-widget.tsx, the Swap onError callback signature requires a non-undefined SwapPreparedQuote parameter (unlike Buy's onError which allows undefined quote). This is intentional - SwapWidget's onError is only called when a quote is available.

Applied to files:

  • packages/thirdweb/src/react/web/ui/Bridge/BuyWidget.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/CheckoutWidget.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/swap-widget/SwapWidget.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/TransactionWidget.tsx
📚 Learning: 2025-07-18T19:20:32.530Z
Learnt from: CR
PR: thirdweb-dev/js#0
File: .cursor/rules/dashboard.mdc:0-0
Timestamp: 2025-07-18T19:20:32.530Z
Learning: Applies to dashboard/**/*client.tsx : Interactive UI that relies on hooks (`useState`, `useEffect`, React Query, wallet hooks).

Applied to files:

  • packages/thirdweb/src/react/web/ui/Bridge/BuyWidget.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/CheckoutWidget.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/TransactionWidget.tsx
📚 Learning: 2025-07-18T19:20:32.530Z
Learnt from: CR
PR: thirdweb-dev/js#0
File: .cursor/rules/dashboard.mdc:0-0
Timestamp: 2025-07-18T19:20:32.530Z
Learning: Applies to dashboard/**/*client.tsx : Anything that consumes hooks from `tanstack/react-query` or thirdweb SDKs.

Applied to files:

  • packages/thirdweb/src/react/web/ui/Bridge/BuyWidget.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/CheckoutWidget.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/TransactionWidget.tsx
📚 Learning: 2025-10-02T12:41:46.918Z
Learnt from: MananTank
PR: thirdweb-dev/js#8169
File: packages/thirdweb/src/stories/BuyWidget.stories.tsx:1-1
Timestamp: 2025-10-02T12:41:46.918Z
Learning: In the thirdweb SDK stories, importing `Meta` from `storybook/react-vite` is acceptable and should not be flagged as an issue.

Applied to files:

  • packages/thirdweb/src/stories/BuyWidget.stories.tsx
  • packages/thirdweb/src/stories/Bridge/ErrorBanner.stories.tsx
📚 Learning: 2025-09-03T23:35:50.476Z
Learnt from: MananTank
PR: thirdweb-dev/js#7977
File: apps/playground-web/src/app/page.tsx:61-65
Timestamp: 2025-09-03T23:35:50.476Z
Learning: In the thirdweb-dev/js codebase, specifically for React components in **/*.{ts,tsx} files, do not suggest adding explicit return types like `: JSX.Element` or `: React.ReactElement` to function components. The project maintainer MananTank has explicitly declined these suggestions.

Applied to files:

  • packages/thirdweb/src/stories/Bridge/Transaction/useSendTransactionModal.stories.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/FundWallet.tsx
📚 Learning: 2025-10-01T22:32:18.080Z
Learnt from: MananTank
PR: thirdweb-dev/js#8169
File: packages/thirdweb/src/react/web/ui/Bridge/FundWallet.tsx:95-107
Timestamp: 2025-10-01T22:32:18.080Z
Learning: In the thirdweb-dev/js codebase, specifically for React components in packages/thirdweb/src/react/**/*.{ts,tsx} files, do not suggest adding TSDoc blocks to function components. The project maintainer MananTank has explicitly declined these suggestions.

Applied to files:

  • packages/thirdweb/src/stories/Bridge/Transaction/useSendTransactionModal.stories.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/FundWallet.tsx
📚 Learning: 2025-08-29T15:37:38.513Z
Learnt from: CR
PR: thirdweb-dev/js#0
File: AGENTS.md:0-0
Timestamp: 2025-08-29T15:37:38.513Z
Learning: Applies to apps/{dashboard,playground}/**/*.{ts,tsx} : Client-side data fetching: wrap calls in React Query with descriptive, stable `queryKeys` and set sensible `staleTime/cacheTime` (≥ 60s default); keep tokens secret via internal routes or server actions

Applied to files:

  • packages/thirdweb/src/react/web/ui/Bridge/common/token-query.ts
📚 Learning: 2025-08-29T15:37:38.513Z
Learnt from: CR
PR: thirdweb-dev/js#0
File: AGENTS.md:0-0
Timestamp: 2025-08-29T15:37:38.513Z
Learning: Applies to packages/thirdweb/**/*.{ts,tsx} : Every public symbol must have comprehensive TSDoc with at least one compiling `example` and a custom tag (`beta`, `internal`, `experimental`, etc.)

Applied to files:

  • packages/thirdweb/src/react/web/ui/Bridge/common/token-query.ts
📚 Learning: 2025-07-18T19:19:55.613Z
Learnt from: CR
PR: thirdweb-dev/js#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-18T19:19:55.613Z
Learning: Applies to packages/thirdweb/src/exports/** : Every public symbol must have comprehensive TSDoc with at least one `example` block that compiles and custom annotation tags (`beta`, `internal`, `experimental`)

Applied to files:

  • packages/thirdweb/src/react/web/ui/Bridge/common/token-query.ts
📚 Learning: 2025-07-18T19:20:32.530Z
Learnt from: CR
PR: thirdweb-dev/js#0
File: .cursor/rules/dashboard.mdc:0-0
Timestamp: 2025-07-18T19:20:32.530Z
Learning: Applies to dashboard/**/*client.tsx : Keep `queryKey` stable and descriptive for cache hits.

Applied to files:

  • packages/thirdweb/src/react/web/ui/Bridge/common/token-query.ts
📚 Learning: 2025-07-18T19:19:55.613Z
Learnt from: CR
PR: thirdweb-dev/js#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-18T19:19:55.613Z
Learning: Applies to apps/{dashboard,playground-web}/**/*.{ts,tsx} : Use descriptive, stable `queryKeys` for React Query cache hits

Applied to files:

  • packages/thirdweb/src/react/web/ui/Bridge/common/token-query.ts
📚 Learning: 2025-09-17T11:02:13.528Z
Learnt from: MananTank
PR: thirdweb-dev/js#8044
File: packages/thirdweb/src/react/web/ui/Bridge/swap-widget/use-tokens.ts:15-17
Timestamp: 2025-09-17T11:02:13.528Z
Learning: The thirdweb `client` object is serializable and can safely be used in React Query keys, similar to the `contract` object.

Applied to files:

  • packages/thirdweb/src/react/web/ui/Bridge/common/token-query.ts
📚 Learning: 2025-06-13T13:03:41.732Z
Learnt from: MananTank
PR: thirdweb-dev/js#7332
File: apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/public-pages/nft/overview/nft-drop-claim.tsx:82-90
Timestamp: 2025-06-13T13:03:41.732Z
Learning: The thirdweb `contract` object is serializable and can safely be used in contexts (e.g., React-Query keys) that require serializable values.

Applied to files:

  • packages/thirdweb/src/react/web/ui/Bridge/common/token-query.ts
🧬 Code graph analysis (26)
packages/thirdweb/src/react/web/ui/TransactionButton/DepositScreen.tsx (1)
packages/thirdweb/src/react/web/ui/components/basic.tsx (1)
  • ModalHeader (36-68)
packages/thirdweb/src/react/web/ui/Bridge/payment-details/PaymentDetails.tsx (3)
packages/thirdweb/src/pay/convert/type.ts (1)
  • SupportedFiatCurrency (27-27)
packages/thirdweb/src/react/web/ui/Bridge/types.ts (1)
  • ModeInfo (12-23)
packages/thirdweb/src/react/web/ui/components/basic.tsx (1)
  • ModalHeader (36-68)
packages/thirdweb/src/react/web/ui/Bridge/StepRunner.tsx (1)
packages/thirdweb/src/react/core/hooks/useBridgePrepare.ts (2)
  • BridgePrepareRequest (14-18)
  • BridgePrepareResult (23-27)
packages/thirdweb/src/stories/Bridge/fixtures.ts (1)
packages/thirdweb/src/react/web/ui/Bridge/types.ts (1)
  • DirectPaymentInfo (5-10)
packages/thirdweb/src/react/web/ui/Bridge/payment-details/PaymentOverview.tsx (4)
packages/thirdweb/src/pay/convert/type.ts (1)
  • SupportedFiatCurrency (27-27)
packages/thirdweb/src/react/web/ui/Bridge/types.ts (2)
  • PaymentMethod (32-46)
  • ModeInfo (12-23)
packages/thirdweb/src/react/web/ui/Bridge/common/TokenBalanceRow.tsx (1)
  • TokenBalanceRow (14-98)
packages/thirdweb/src/react/core/hooks/useTransactionDetails.ts (1)
  • useTransactionDetails (55-187)
packages/thirdweb/src/stories/Bridge/Transaction/TransactionWidget.stories.tsx (3)
packages/thirdweb/src/stories/utils.tsx (1)
  • storyClient (14-16)
packages/thirdweb/src/stories/Bridge/fixtures.ts (1)
  • TRANSACTION_UI_OPTIONS (800-840)
packages/thirdweb/src/react/web/ui/Bridge/TransactionWidget.tsx (2)
  • TransactionWidgetProps (56-215)
  • TransactionWidget (330-340)
packages/thirdweb/src/react/web/ui/Bridge/BuyWidget.tsx (16)
packages/thirdweb/src/react/web/ui/ConnectWallet/locale/getConnectLocale.ts (1)
  • useConnectLocale (45-54)
packages/thirdweb/src/react/web/ui/Bridge/common/token-query.ts (1)
  • useTokenQuery (13-45)
packages/thirdweb/src/react/web/ui/Bridge/ErrorBanner.tsx (1)
  • ErrorBanner (31-107)
packages/thirdweb/src/bridge/types/Token.ts (1)
  • TokenWithPrices (14-16)
packages/thirdweb/src/react/web/ui/Bridge/types.ts (2)
  • PaymentMethod (32-46)
  • RequiredParams (25-27)
packages/thirdweb/src/react/core/hooks/useBridgePrepare.ts (2)
  • BridgePrepareResult (23-27)
  • BridgePrepareRequest (14-18)
packages/thirdweb/src/react/core/hooks/useStepExecutor.ts (1)
  • CompletedStatusResult (19-26)
packages/thirdweb/src/react/web/ui/Bridge/FundWallet.tsx (1)
  • FundWallet (95-388)
packages/thirdweb/src/react/web/ui/Bridge/payment-selection/PaymentSelection.tsx (1)
  • PaymentSelection (102-322)
packages/thirdweb/src/react/web/ui/Bridge/QuoteLoader.tsx (1)
  • QuoteLoader (83-164)
packages/thirdweb/src/react/web/ui/Bridge/payment-details/PaymentDetails.tsx (1)
  • PaymentDetails (63-450)
packages/thirdweb/src/react/web/ui/Bridge/StepRunner.tsx (1)
  • StepRunner (75-426)
packages/thirdweb/src/react/web/adapters/WindowAdapter.ts (1)
  • webWindowAdapter (23-23)
packages/thirdweb/src/react/web/ui/Bridge/payment-success/SuccessScreen.tsx (1)
  • SuccessScreen (53-199)
packages/thirdweb/src/react/web/ui/ConnectWallet/Modal/ConnectEmbed.tsx (1)
  • EmbedContainer (459-485)
packages/thirdweb/src/react/web/ui/components/DynamicHeight.tsx (1)
  • DynamicHeight (8-33)
packages/thirdweb/src/react/web/ui/Bridge/UnsupportedTokenScreen.tsx (2)
packages/thirdweb/src/bridge/types/Chain.ts (1)
  • Chain (5-40)
packages/thirdweb/src/exports/thirdweb.ts (1)
  • ThirdwebClient (25-25)
packages/thirdweb/src/stories/BuyWidget.stories.tsx (3)
packages/thirdweb/src/react/web/ui/Bridge/BuyWidget.tsx (1)
  • BuyWidget (328-338)
packages/thirdweb/src/stories/utils.tsx (1)
  • storyClient (14-16)
packages/thirdweb/src/exports/chains.ts (2)
  • base (17-17)
  • ethereum (32-32)
packages/thirdweb/src/react/web/ui/Bridge/TransactionPayment.tsx (7)
packages/thirdweb/src/exports/thirdweb.ts (1)
  • PreparedTransaction (179-179)
packages/thirdweb/src/pay/convert/type.ts (1)
  • SupportedFiatCurrency (27-27)
packages/thirdweb/src/react/core/hooks/useTransactionDetails.ts (1)
  • useTransactionDetails (55-187)
packages/thirdweb/src/exports/utils.ts (2)
  • resolvePromisedValue (198-198)
  • shortenAddress (149-149)
packages/thirdweb/src/react/web/ui/Bridge/common/WithHeader.tsx (1)
  • WithHeader (9-66)
packages/thirdweb/src/react/web/ui/Bridge/common/TokenAndChain.tsx (1)
  • ChainIcon (159-186)
packages/thirdweb/src/react/web/ui/components/ChainName.tsx (1)
  • ChainName (11-30)
packages/thirdweb/src/stories/Bridge/ErrorBanner.stories.tsx (2)
packages/thirdweb/src/react/web/ui/Bridge/ErrorBanner.tsx (1)
  • ErrorBanner (31-107)
packages/thirdweb/src/stories/utils.tsx (2)
  • storyClient (14-16)
  • ModalThemeWrapper (18-36)
packages/thirdweb/src/stories/Bridge/PaymentDetails.stories.tsx (3)
packages/thirdweb/src/react/web/ui/Bridge/payment-details/PaymentDetails.tsx (1)
  • PaymentDetails (63-450)
packages/thirdweb/src/stories/Bridge/fixtures.ts (3)
  • simpleOnrampQuote (93-123)
  • DIRECT_PAYMENT_UI_OPTIONS (704-797)
  • TRANSACTION_UI_OPTIONS (800-840)
packages/thirdweb/src/stories/utils.tsx (2)
  • storyClient (14-16)
  • ModalThemeWrapper (18-36)
packages/thirdweb/src/stories/Bridge/Transaction/useSendTransactionModal.stories.tsx (4)
packages/thirdweb/src/exports/thirdweb.ts (2)
  • prepareTransaction (181-181)
  • PreparedTransaction (179-179)
packages/thirdweb/src/exports/chains.ts (2)
  • base (17-17)
  • sepolia (74-74)
packages/thirdweb/src/stories/utils.tsx (1)
  • storyClient (14-16)
packages/thirdweb/src/react/web/hooks/transaction/useSendTransaction.tsx (1)
  • useSendTransaction (124-179)
packages/thirdweb/src/react/web/ui/Bridge/payment-selection/PaymentSelection.tsx (2)
packages/thirdweb/src/react/web/ui/PayEmbed.tsx (1)
  • PayEmbedConnectOptions (431-541)
packages/thirdweb/src/pay/convert/type.ts (1)
  • SupportedFiatCurrency (27-27)
packages/thirdweb/src/react/web/ui/TransactionButton/TransactionModal.tsx (3)
packages/thirdweb/src/pay/convert/type.ts (1)
  • SupportedFiatCurrency (27-27)
packages/thirdweb/src/react/web/ui/Bridge/TransactionWidget.tsx (1)
  • TransactionWidgetContentWrapper (351-483)
packages/thirdweb/src/react/web/ui/ConnectWallet/locale/getConnectLocale.ts (1)
  • useConnectLocale (45-54)
packages/thirdweb/src/react/web/ui/Bridge/common/WithHeader.tsx (2)
packages/thirdweb/src/react/web/ui/components/basic.tsx (1)
  • Container (80-193)
packages/thirdweb/src/react/web/ui/components/text.tsx (1)
  • Text (18-34)
packages/thirdweb/src/react/web/ui/Bridge/QuoteLoader.tsx (1)
packages/thirdweb/src/pay/types.ts (1)
  • PurchaseData (1-1)
packages/thirdweb/src/react/web/ui/Bridge/CheckoutWidget.tsx (13)
packages/thirdweb/src/react/core/hooks/useBridgePrepare.ts (2)
  • BridgePrepareResult (23-27)
  • BridgePrepareRequest (14-18)
packages/thirdweb/src/react/web/ui/ConnectWallet/locale/getConnectLocale.ts (1)
  • useConnectLocale (45-54)
packages/thirdweb/src/react/web/ui/Bridge/common/token-query.ts (1)
  • useTokenQuery (13-45)
packages/thirdweb/src/bridge/types/Token.ts (1)
  • TokenWithPrices (14-16)
packages/thirdweb/src/react/web/ui/Bridge/types.ts (1)
  • PaymentMethod (32-46)
packages/thirdweb/src/react/core/hooks/useStepExecutor.ts (1)
  • CompletedStatusResult (19-26)
packages/thirdweb/src/react/web/ui/Bridge/DirectPayment.tsx (1)
  • DirectPayment (48-205)
packages/thirdweb/src/react/web/ui/Bridge/payment-selection/PaymentSelection.tsx (1)
  • PaymentSelection (102-322)
packages/thirdweb/src/react/web/ui/Bridge/QuoteLoader.tsx (1)
  • QuoteLoader (83-164)
packages/thirdweb/src/react/web/ui/Bridge/payment-details/PaymentDetails.tsx (1)
  • PaymentDetails (63-450)
packages/thirdweb/src/react/web/ui/Bridge/StepRunner.tsx (1)
  • StepRunner (75-426)
packages/thirdweb/src/react/web/adapters/WindowAdapter.ts (1)
  • webWindowAdapter (23-23)
packages/thirdweb/src/react/web/ui/Bridge/payment-success/SuccessScreen.tsx (1)
  • SuccessScreen (53-199)
packages/thirdweb/src/react/web/ui/Bridge/swap-widget/SwapWidget.tsx (1)
packages/thirdweb/src/pay/convert/type.ts (1)
  • SupportedFiatCurrency (27-27)
packages/thirdweb/src/stories/Bridge/PaymentSelection.stories.tsx (3)
packages/thirdweb/src/react/web/ui/Bridge/payment-selection/PaymentSelection.tsx (1)
  • PaymentSelection (102-322)
packages/thirdweb/src/stories/utils.tsx (2)
  • storyClient (14-16)
  • ModalThemeWrapper (18-36)
packages/thirdweb/src/stories/Bridge/fixtures.ts (1)
  • USDC (38-49)
packages/thirdweb/src/react/web/ui/Bridge/TransactionWidget.tsx (15)
packages/thirdweb/src/transaction/actions/wait-for-tx-receipt.ts (1)
  • WaitForReceiptOptions (14-20)
packages/thirdweb/src/react/web/ui/ConnectWallet/locale/getConnectLocale.ts (1)
  • useConnectLocale (45-54)
packages/thirdweb/src/exports/utils.ts (1)
  • stringify (189-189)
packages/thirdweb/src/react/web/ui/Bridge/UnsupportedTokenScreen.tsx (1)
  • UnsupportedTokenScreen (25-101)
packages/thirdweb/src/bridge/types/Token.ts (1)
  • TokenWithPrices (14-16)
packages/thirdweb/src/react/web/ui/Bridge/TransactionPayment.tsx (1)
  • TransactionPayment (80-448)
packages/thirdweb/src/react/web/ui/Bridge/payment-selection/PaymentSelection.tsx (1)
  • PaymentSelection (102-322)
packages/thirdweb/src/react/web/ui/Bridge/QuoteLoader.tsx (1)
  • QuoteLoader (83-164)
packages/thirdweb/src/react/web/ui/Bridge/payment-details/PaymentDetails.tsx (1)
  • PaymentDetails (63-450)
packages/thirdweb/src/react/web/ui/Bridge/StepRunner.tsx (1)
  • StepRunner (75-426)
packages/thirdweb/src/react/web/adapters/WindowAdapter.ts (1)
  • webWindowAdapter (23-23)
packages/thirdweb/src/react/web/ui/Bridge/payment-success/SuccessScreen.tsx (1)
  • SuccessScreen (53-199)
packages/thirdweb/src/react/web/ui/Bridge/ErrorBanner.tsx (1)
  • ErrorBanner (31-107)
packages/thirdweb/src/react/web/ui/TransactionButton/ExecutingScreen.tsx (1)
  • ExecutingTxScreen (19-183)
packages/thirdweb/src/react/web/ui/ConnectWallet/Modal/ConnectEmbed.tsx (1)
  • EmbedContainer (459-485)
packages/thirdweb/src/react/web/ui/Bridge/FundWallet.tsx (4)
packages/thirdweb/src/react/web/ui/PayEmbed.tsx (1)
  • PayEmbedConnectOptions (431-541)
packages/thirdweb/src/bridge/types/Token.ts (1)
  • TokenWithPrices (14-16)
packages/thirdweb/src/pay/convert/type.ts (1)
  • SupportedFiatCurrency (27-27)
packages/thirdweb/src/react/web/ui/Bridge/common/TokenAndChain.tsx (1)
  • TokenAndChain (22-99)
packages/thirdweb/src/react/web/ui/Bridge/DirectPayment.tsx (4)
packages/thirdweb/src/react/web/ui/Bridge/types.ts (1)
  • DirectPaymentInfo (5-10)
packages/thirdweb/src/pay/convert/type.ts (1)
  • SupportedFiatCurrency (27-27)
packages/thirdweb/src/react/web/ui/ConnectWallet/screens/Buy/swap/FiatValue.tsx (1)
  • FiatValue (15-55)
packages/thirdweb/src/react/web/ui/Bridge/common/WithHeader.tsx (1)
  • WithHeader (9-66)
packages/thirdweb/src/react/web/ui/Bridge/common/token-query.ts (1)
packages/thirdweb/src/pay/convert/get-token.ts (1)
  • getToken (6-37)
packages/thirdweb/src/stories/Bridge/SuccessScreen.stories.tsx (3)
packages/thirdweb/src/react/web/ui/Bridge/payment-success/SuccessScreen.tsx (1)
  • SuccessScreen (53-199)
packages/thirdweb/src/stories/Bridge/fixtures.ts (2)
  • simpleBuyQuote (251-311)
  • simpleOnrampQuote (93-123)
packages/thirdweb/src/stories/utils.tsx (2)
  • storyClient (14-16)
  • ModalThemeWrapper (18-36)
packages/thirdweb/src/stories/Bridge/UnsupportedTokenScreen.stories.tsx (3)
packages/thirdweb/src/react/web/ui/Bridge/UnsupportedTokenScreen.tsx (1)
  • UnsupportedTokenScreen (25-101)
packages/thirdweb/src/stories/utils.tsx (2)
  • storyClient (14-16)
  • ModalThemeWrapper (18-36)
packages/thirdweb/src/exports/thirdweb.ts (2)
  • defineChain (18-18)
  • NATIVE_TOKEN_ADDRESS (31-31)
🪛 Gitleaks (8.28.0)
packages/thirdweb/src/stories/BuyWidget.stories.tsx

[high] 26-26: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


[high] 39-39: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


[high] 52-52: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


[high] 101-101: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (8)
  • GitHub Check: Build Packages
  • GitHub Check: E2E Tests (pnpm, webpack)
  • GitHub Check: E2E Tests (pnpm, esbuild)
  • GitHub Check: E2E Tests (pnpm, vite)
  • GitHub Check: Size
  • GitHub Check: Unit Tests
  • GitHub Check: Lint Packages
  • GitHub Check: Analyze (javascript)

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

Labels

packages Playground Changes involving the Playground codebase. SDK Involves changes to the thirdweb SDK

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants