Skip to content

Conversation

@MananTank
Copy link
Member

@MananTank MananTank commented Dec 29, 2025


PR-Codex overview

This PR introduces support for customizable payment methods in the checkout widget, allowing users to select between "crypto" and "card" options. It also refines the integration type handling and enhances the iframe functionality for the checkout experience.

Detailed summary

  • Added integrationType option to BridgeComponentsPlaygroundOptions.
  • Introduced paymentMethods parsing in page.tsx for checkout widget.
  • Updated LeftSection to conditionally render ColorFormGroup.
  • Enhanced CheckoutWidgetEmbed to accept paymentMethods.
  • Modified RightSection to support iframe rendering for checkout.
  • Created buildCheckoutIframeUrl function to generate URLs with payment methods.
  • Updated CodeGen to handle iframe code generation.
  • Added documentation for payment methods in iframe page.
  • Adjusted CheckoutPlayground to manage integration types and theme changes.

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

Summary by CodeRabbit

  • New Features

    • Checkout widget: optional paymentMethods filter (crypto or card) and iframe integration.
    • Playground: tab-based switcher (React / Iframe), URL state persistence, and theme-aware preview.
    • Preview/code generation: iframe-specific preview and HTML snippet export for iframe integration.
  • Documentation

    • Added "Payment Methods" docs for iframe integration with examples.

✏️ Tip: You can customize this high-level summary in your review settings.

@vercel
Copy link

vercel bot commented Dec 29, 2025

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

Project Deployment Review Updated (UTC)
docs-v2 Ready Ready Preview, Comment Dec 29, 2025 3:52pm
thirdweb_playground Ready Ready Preview, Comment Dec 29, 2025 3:52pm
thirdweb-www Ready Ready Preview, Comment Dec 29, 2025 3:52pm
2 Skipped Deployments
Project Deployment Review Updated (UTC)
nebula Skipped Skipped Dec 29, 2025 3:52pm
wallet-ui Skipped Skipped Dec 29, 2025 3:52pm

@vercel vercel bot temporarily deployed to Preview – wallet-ui December 29, 2025 15:32 Inactive
@vercel vercel bot temporarily deployed to Preview – nebula December 29, 2025 15:32 Inactive
@changeset-bot
Copy link

changeset-bot bot commented Dec 29, 2025

⚠️ No Changeset found

Latest commit: 8b9bf79

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

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 29, 2025

Walkthrough

Adds optional paymentMethods prop and query parsing for the checkout widget; introduces iframe integration in the playground with tab-based React/Iframe switching, theme sync, URL state management, iframe code generation, and documentation for paymentMethods.

Changes

Cohort / File(s) Summary
Dashboard — Checkout prop
apps/dashboard/src/app/bridge/checkout-widget/CheckoutWidgetEmbed.client.tsx, apps/dashboard/src/app/bridge/checkout-widget/page.tsx
Added optional paymentMethods?: ("crypto" | "card")[] prop on CheckoutWidgetEmbed; page parses paymentMethods query param and forwards it.
Playground — Tab & integration entry
apps/playground-web/src/app/bridge/checkout-widget/CheckoutPlayground.tsx, apps/playground-web/src/app/bridge/checkout-widget/page.tsx
CheckoutPlayground now accepts defaultTab?: "iframe" | "react"; page is async, validates tab search param and supplies defaultTab. Theme sync and URL query updates added.
Playground — Types
apps/playground-web/src/app/bridge/components/types.ts
Added integrationType?: "iframe" | "react" to BridgeComponentsPlaygroundOptions.
Playground — Iframe URL util
apps/playground-web/src/app/bridge/components/buildCheckoutIframeUrl.ts
New buildCheckoutIframeUrl(options) exports URL builder including core params and optional fields (theme, currency, branding, title, image, buttonLabel, and single paymentMethods value).
Playground — Code generation & UI adjustments
apps/playground-web/src/app/bridge/components/CodeGen.tsx, apps/playground-web/src/app/bridge/components/LeftSection.tsx, apps/playground-web/src/app/bridge/components/RightSection.tsx
CodeGen renders iframe HTML when integrationType === "iframe"; LeftSection hides color controls for iframe mode; RightSection renders an iframe preview using buildCheckoutIframeUrl for iframe mode.
Docs — iframe page
apps/portal/src/app/bridge/checkout-widget/iframe/page.mdx
Added "Payment Methods" docs describing paymentMethods query param with examples for crypto and card modes.

Sequence Diagram(s)

mermaid
sequenceDiagram
participant User
participant PlaygroundUI as "Playground UI (React)"
participant PageRouter as "Next/Page (server)"
participant URLBuilder as "buildCheckoutIframeUrl"
participant Iframe as "Checkout Iframe"
Note over User,PlaygroundUI: Tab selection / options change
User->>PlaygroundUI: selects "Iframe" tab / updates options
PlaygroundUI->>PageRouter: update query param (tab, options) via URL pushState
PlaygroundUI->>URLBuilder: buildCheckoutIframeUrl(options)
URLBuilder-->>PlaygroundUI: iframe src URL
PlaygroundUI->>Iframe: set iframe.src
Iframe-->>PlaygroundUI: (loads checkout widget)

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Pre-merge checks and finishing touches

❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Description check ❓ Inconclusive The PR description includes an automated PR-Codex overview with a detailed summary of changes, but lacks explicit 'Notes for the reviewer' and 'How to test' sections required by the template. Add 'Notes for the reviewer' section to highlight important details and a 'How to test' section with specific testing instructions (unit tests, playground testing, etc.).
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title '[MNY-346] Playground: Add CheckoutWidget iframe' clearly describes the main change - adding iframe support for the CheckoutWidget in the playground.
Linked Issues check ✅ Passed The linked issue MNY-346 lacks specific requirements. Based on the PR objectives and code changes, the implementation adds iframe support and customizable payment methods to the checkout widget as intended.
Out of Scope Changes check ✅ Passed All changes are focused on adding checkout widget iframe support and payment method customization. Updates to documentation, components, and utilities align with the stated objectives.
✨ 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 12-29-playground_add_checkoutwidget_iframe

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.

@github-actions github-actions bot added Dashboard Involves changes to the Dashboard. Playground Changes involving the Playground codebase. Portal Involves changes to the Portal (docs) codebase. labels Dec 29, 2025
Copy link
Member Author


How to use the Graphite Merge Queue

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

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

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

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

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

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

@MananTank MananTank marked this pull request as ready for review December 29, 2025 15:32
@MananTank MananTank requested review from a team as code owners December 29, 2025 15:32
@MananTank MananTank changed the title Playground: Add CheckoutWidget iframe [MNY-346] Playground: Add CheckoutWidget iframe Dec 29, 2025
@linear
Copy link

linear bot commented Dec 29, 2025

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (3)
apps/playground-web/src/app/bridge/components/buildCheckoutIframeUrl.ts (1)

6-9: Unused parameter _type should be documented or removed.

The _type parameter is prefixed with underscore indicating it's intentionally unused, but its purpose isn't clear. Consider adding a comment explaining why it exists (perhaps for future use or API consistency) or removing it if not needed.

💡 Suggested improvement
 export function buildCheckoutIframeUrl(
   options: BridgeComponentsPlaygroundOptions,
-  _type: "code" | "preview",
+  _type: "code" | "preview", // Reserved for future differentiation between code and preview URLs
 ) {
apps/playground-web/src/app/bridge/checkout-widget/CheckoutPlayground.tsx (2)

35-46: Consider handling the undefined case explicitly.

On line 42, if tab is undefined, this would set ?tab= (empty string) in the URL. While this edge case may be unreachable in the current usage (since integrationType is always set from defaults or props), adding an explicit guard would make the intent clearer.

🔎 Suggested improvement
 function updatePageUrl(
   tab: BridgeComponentsPlaygroundOptions["integrationType"],
 ) {
+  if (!tab) return;
+
   const url = new URL(window.location.href);
   if (tab === defaultOptions.integrationType) {
     url.searchParams.delete("tab");
   } else {
-    url.searchParams.set("tab", tab || "");
+    url.searchParams.set("tab", tab);
   }

   window.history.replaceState({}, "", url.toString());
 }

58-67: Consider using resolvedTheme for accurate theme detection.

The useTheme hook from next-themes provides both theme (which can be "system") and resolvedTheme (the actual applied theme). When theme is "system", the current logic defaults to "light", which may not match the user's actual system preference.

🔎 Suggested improvement
 export function CheckoutPlayground(props: { defaultTab?: "iframe" | "react" }) {
-  const { theme } = useTheme();
+  const { resolvedTheme } = useTheme();

   const [options, setOptions] = useState<BridgeComponentsPlaygroundOptions>(
     () => ({
       ...defaultOptions,
       integrationType: props.defaultTab || defaultOptions.integrationType,
     }),
   );

   // Change theme on global theme change
   useEffect(() => {
     setOptions((prev) => ({
       ...prev,
       theme: {
         ...prev.theme,
-        type: theme === "dark" ? "dark" : "light",
+        type: resolvedTheme === "dark" ? "dark" : "light",
       },
     }));
-  }, [theme]);
+  }, [resolvedTheme]);
📜 Review details

Configuration used: Organization 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 ec73f1f and d5397aa.

📒 Files selected for processing (10)
  • apps/dashboard/src/app/bridge/checkout-widget/CheckoutWidgetEmbed.client.tsx
  • apps/dashboard/src/app/bridge/checkout-widget/page.tsx
  • apps/playground-web/src/app/bridge/checkout-widget/CheckoutPlayground.tsx
  • apps/playground-web/src/app/bridge/checkout-widget/page.tsx
  • apps/playground-web/src/app/bridge/components/CodeGen.tsx
  • apps/playground-web/src/app/bridge/components/LeftSection.tsx
  • apps/playground-web/src/app/bridge/components/RightSection.tsx
  • apps/playground-web/src/app/bridge/components/buildCheckoutIframeUrl.ts
  • apps/playground-web/src/app/bridge/components/types.ts
  • apps/portal/src/app/bridge/checkout-widget/iframe/page.mdx
🧰 Additional context used
📓 Path-based instructions (10)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.{ts,tsx}: Write idiomatic TypeScript with explicit function declarations and return types
Limit each TypeScript 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 in TypeScript
Avoid any and unknown in TypeScript unless unavoidable; narrow generics when possible
Choose composition over inheritance; leverage utility types (Partial, Pick, etc.) in TypeScript

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

Files:

  • apps/playground-web/src/app/bridge/components/LeftSection.tsx
  • apps/playground-web/src/app/bridge/checkout-widget/page.tsx
  • apps/dashboard/src/app/bridge/checkout-widget/CheckoutWidgetEmbed.client.tsx
  • apps/playground-web/src/app/bridge/components/CodeGen.tsx
  • apps/playground-web/src/app/bridge/components/RightSection.tsx
  • apps/playground-web/src/app/bridge/components/types.ts
  • apps/playground-web/src/app/bridge/components/buildCheckoutIframeUrl.ts
  • apps/playground-web/src/app/bridge/checkout-widget/CheckoutPlayground.tsx
  • apps/dashboard/src/app/bridge/checkout-widget/page.tsx
apps/{dashboard,playground-web}/src/**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

apps/{dashboard,playground-web}/src/**/*.{ts,tsx}: Import UI component primitives from @/components/ui/* (Button, Input, Select, Tabs, Card, Sidebar, Badge, Separator) in dashboard and playground
Use Tailwind CSS only – no inline styles or CSS modules in dashboard and playground
Use cn() from @/lib/utils for conditional Tailwind class merging
Use design system tokens for styling (backgrounds: bg-card, borders: border-border, muted text: text-muted-foreground)
Expose className prop on root element for component overrides

Files:

  • apps/playground-web/src/app/bridge/components/LeftSection.tsx
  • apps/playground-web/src/app/bridge/checkout-widget/page.tsx
  • apps/dashboard/src/app/bridge/checkout-widget/CheckoutWidgetEmbed.client.tsx
  • apps/playground-web/src/app/bridge/components/CodeGen.tsx
  • apps/playground-web/src/app/bridge/components/RightSection.tsx
  • apps/playground-web/src/app/bridge/components/types.ts
  • apps/playground-web/src/app/bridge/components/buildCheckoutIframeUrl.ts
  • apps/playground-web/src/app/bridge/checkout-widget/CheckoutPlayground.tsx
  • apps/dashboard/src/app/bridge/checkout-widget/page.tsx
**/*.{js,jsx,ts,tsx,json}

📄 CodeRabbit inference engine (AGENTS.md)

Biome governs formatting and linting; its rules live in biome.json. Run pnpm fix & pnpm lint before committing, ensure there are no linting errors

Files:

  • apps/playground-web/src/app/bridge/components/LeftSection.tsx
  • apps/playground-web/src/app/bridge/checkout-widget/page.tsx
  • apps/dashboard/src/app/bridge/checkout-widget/CheckoutWidgetEmbed.client.tsx
  • apps/playground-web/src/app/bridge/components/CodeGen.tsx
  • apps/playground-web/src/app/bridge/components/RightSection.tsx
  • apps/playground-web/src/app/bridge/components/types.ts
  • apps/playground-web/src/app/bridge/components/buildCheckoutIframeUrl.ts
  • apps/playground-web/src/app/bridge/checkout-widget/CheckoutPlayground.tsx
  • apps/dashboard/src/app/bridge/checkout-widget/page.tsx
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (AGENTS.md)

Lazy-import optional features; avoid top-level side-effects

Files:

  • apps/playground-web/src/app/bridge/components/LeftSection.tsx
  • apps/playground-web/src/app/bridge/checkout-widget/page.tsx
  • apps/dashboard/src/app/bridge/checkout-widget/CheckoutWidgetEmbed.client.tsx
  • apps/playground-web/src/app/bridge/components/CodeGen.tsx
  • apps/playground-web/src/app/bridge/components/RightSection.tsx
  • apps/playground-web/src/app/bridge/components/types.ts
  • apps/playground-web/src/app/bridge/components/buildCheckoutIframeUrl.ts
  • apps/playground-web/src/app/bridge/checkout-widget/CheckoutPlayground.tsx
  • apps/dashboard/src/app/bridge/checkout-widget/page.tsx
apps/dashboard/src/**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

apps/dashboard/src/**/*.{ts,tsx}: Use NavLink for internal navigation with automatic active states in dashboard
Start server component files with import "server-only"; in Next.js
Read cookies/headers with next/headers in server components
Access server-only environment variables in server components
Perform heavy data fetching in server components
Implement redirect logic with redirect() from next/navigation in server components
Begin client component files with 'use client'; directive in Next.js
Handle interactive UI with React hooks (useState, useEffect, React Query, wallet hooks) in client components
Access browser APIs (localStorage, window, IntersectionObserver) in client components
Support fast transitions with prefetched data in client components
Always call getAuthToken() to retrieve JWT from cookies on server side
Use Authorization: Bearer header for API calls – never embed tokens in URLs
Return typed results (Project[], User[]) from server-side data fetches – avoid any
Wrap client-side API calls in React Query (@tanstack/react-query)
Use descriptive, stable queryKeys in React Query for cache hits
Configure staleTime/cacheTime in React Query based on freshness (default ≥ 60s)
Keep tokens secret via internal API routes or server actions
Never import posthog-js in server components – only use analytics client-side

Files:

  • apps/dashboard/src/app/bridge/checkout-widget/CheckoutWidgetEmbed.client.tsx
  • apps/dashboard/src/app/bridge/checkout-widget/page.tsx
apps/dashboard/**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/dashboard.mdc)

apps/dashboard/**/*.{ts,tsx}: Always import from the central UI library under @/components/ui/* for reusable core UI components like Button, Input, Select, Tabs, Card, Sidebar, Separator, Badge
Use NavLink from @/components/ui/NavLink for internal navigation to ensure active states are handled automatically
For notices and skeletons, rely on AnnouncementBanner, GenericLoadingPage, and EmptyStateCard components
Import icons from lucide-react or the project-specific …/icons exports; never embed raw SVG
Keep components pure; fetch data outside using server components or hooks and pass it down via props
Use Tailwind CSS as the styling system; avoid inline styles or CSS modules
Merge class names with cn from @/lib/utils to keep conditional logic readable
Stick to design tokens: use bg-card, border-border, text-muted-foreground and other Tailwind variables instead of hard-coded colors
Use spacing utilities (px-*, py-*, gap-*) instead of custom margins
Follow mobile-first responsive design with Tailwind helpers (max-sm, md, lg, xl)
Never hard-code colors; always use Tailwind variables
Combine class names via cn, and expose className prop if useful in components
Use React Query (@tanstack/react-query) for all client-side data fetching with typed hooks

Files:

  • apps/dashboard/src/app/bridge/checkout-widget/CheckoutWidgetEmbed.client.tsx
  • apps/dashboard/src/app/bridge/checkout-widget/page.tsx
apps/dashboard/**/*.client.tsx

📄 CodeRabbit inference engine (.cursor/rules/dashboard.mdc)

apps/dashboard/**/*.client.tsx: Name component files after the component in PascalCase; append .client.tsx when the component is interactive
Client components must start with 'use client'; directive before imports

Files:

  • apps/dashboard/src/app/bridge/checkout-widget/CheckoutWidgetEmbed.client.tsx
apps/{dashboard,playground}/**/*.{tsx,ts}

📄 CodeRabbit inference engine (AGENTS.md)

apps/{dashboard,playground}/**/*.{tsx,ts}: Import UI primitives from @/components/ui/_ (Button, Input, Select, Tabs, Card, Sidebar, Badge, Separator) in Dashboard and Playground apps
Use NavLink for internal navigation so active states are handled automatically
Use Tailwind CSS for styling – no inline styles or CSS modules
Merge class names with cn() from @/lib/utils to keep conditional logic readable
Stick to design tokens for styling: backgrounds (bg-card), borders (border-border), muted text (text-muted-foreground), etc.
Server Components: Read cookies/headers with next/headers, access server-only environment variables or secrets, perform heavy data fetching, implement redirect logic with redirect() from next/navigation, and start files with import 'server-only'; to prevent client bundling
Client Components: Begin files with 'use client'; before imports, handle interactive UI relying on React hooks (useState, useEffect, React Query, wallet hooks), access browser APIs (localStorage, window, IntersectionObserver, etc.), and support fast transitions with client-side data prefetching
For client-side data fetching: Wrap calls in React Query (@tanstack/react-query), use descriptive and stable queryKeys for cache hits, configure staleTime / cacheTime based on freshness requirements (default ≥ 60 s), and keep tokens secret by calling internal API routes or server actions

Files:

  • apps/dashboard/src/app/bridge/checkout-widget/CheckoutWidgetEmbed.client.tsx
  • apps/dashboard/src/app/bridge/checkout-widget/page.tsx
apps/{dashboard,playground}/**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

apps/{dashboard,playground}/**/*.{ts,tsx}: For server-side data fetching: Always call getAuthToken() to retrieve the JWT from cookies and inject the token as an Authorization: Bearer header – never embed it in the URL. Return typed results (Project[], User[], …) – avoid any
Never import posthog-js in server components; analytics reporting is client-side only

Files:

  • apps/dashboard/src/app/bridge/checkout-widget/CheckoutWidgetEmbed.client.tsx
  • apps/dashboard/src/app/bridge/checkout-widget/page.tsx
apps/dashboard/**/page.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/dashboard.mdc)

Use the container class with a max-w-7xl cap for consistent page width

Files:

  • apps/dashboard/src/app/bridge/checkout-widget/page.tsx
🧬 Code graph analysis (7)
apps/playground-web/src/app/bridge/components/LeftSection.tsx (1)
apps/playground-web/src/app/wallets/sign-in/components/ColorFormGroup.tsx (1)
  • ColorFormGroup (9-111)
apps/playground-web/src/app/bridge/checkout-widget/page.tsx (1)
apps/playground-web/src/app/bridge/checkout-widget/CheckoutPlayground.tsx (1)
  • CheckoutPlayground (48-105)
apps/playground-web/src/app/bridge/components/CodeGen.tsx (2)
apps/playground-web/src/app/bridge/components/types.ts (1)
  • BridgeComponentsPlaygroundOptions (33-63)
apps/playground-web/src/app/bridge/components/buildCheckoutIframeUrl.ts (1)
  • buildCheckoutIframeUrl (6-66)
apps/playground-web/src/app/bridge/components/RightSection.tsx (1)
apps/playground-web/src/app/bridge/components/buildCheckoutIframeUrl.ts (1)
  • buildCheckoutIframeUrl (6-66)
apps/playground-web/src/app/bridge/components/buildCheckoutIframeUrl.ts (1)
apps/playground-web/src/app/bridge/components/types.ts (1)
  • BridgeComponentsPlaygroundOptions (33-63)
apps/playground-web/src/app/bridge/checkout-widget/CheckoutPlayground.tsx (3)
apps/playground-web/src/app/bridge/components/types.ts (1)
  • BridgeComponentsPlaygroundOptions (33-63)
apps/playground-web/src/app/bridge/components/LeftSection.tsx (1)
  • LeftSection (21-521)
apps/playground-web/src/app/bridge/components/RightSection.tsx (1)
  • RightSection (30-183)
apps/dashboard/src/app/bridge/checkout-widget/page.tsx (1)
apps/dashboard/src/app/bridge/_common/parseQueryParams.ts (1)
  • parseQueryParams (3-11)
⏰ 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, vite)
  • GitHub Check: E2E Tests (pnpm, webpack)
  • GitHub Check: E2E Tests (pnpm, esbuild)
  • GitHub Check: Build Packages
  • GitHub Check: Unit Tests
  • GitHub Check: Lint Packages
  • GitHub Check: Size
  • GitHub Check: Analyze (javascript)
🔇 Additional comments (18)
apps/portal/src/app/bridge/checkout-widget/iframe/page.mdx (1)

132-154: LGTM! Documentation clearly explains the new payment methods parameter.

The documentation accurately describes the new paymentMethods query parameter with clear examples. The structure is consistent with other sections and the examples effectively demonstrate both crypto-only and card-only modes.

apps/playground-web/src/app/bridge/components/types.ts (1)

34-34: LGTM! Clean type extension.

The optional integrationType field is well-typed with a clear union type and enables the iframe/React rendering modes introduced in this PR.

apps/playground-web/src/app/bridge/components/LeftSection.tsx (1)

487-500: LGTM! Appropriate conditional rendering for iframe mode.

The ColorFormGroup is correctly hidden when the checkout widget is in iframe mode, as color customization isn't applicable to iframe integrations. The comment clarifies the intent.

apps/playground-web/src/app/bridge/components/RightSection.tsx (1)

160-175: LGTM! Proper iframe integration with appropriate fallback.

The conditional rendering correctly switches between iframe and React widget based on integration type. The iframe attributes are well-configured with smooth animation.

apps/playground-web/src/app/bridge/components/CodeGen.tsx (3)

29-30: LGTM! Clean conditional flag.

The isIframe flag correctly determines when to generate iframe code based on widget type and integration type.


37-42: LGTM! Proper conditional code generation.

The code generation appropriately switches between iframe HTML and React/TypeScript code based on the integration type, with correct language specification for syntax highlighting.


49-59: LGTM! Clean iframe HTML generation.

The getIframeCode function generates well-formatted HTML with appropriate iframe attributes. The use of buildCheckoutIframeUrl ensures consistency with the preview rendering.

apps/playground-web/src/app/bridge/components/buildCheckoutIframeUrl.ts (1)

54-63: Verify behavior when no payment methods are selected.

The logic only adds the paymentMethods parameter when exactly one method is selected. If both are selected or neither is selected, no parameter is added. Confirm this aligns with the API behavior—specifically, ensure that an empty paymentMethods array is handled correctly by the widget.

apps/dashboard/src/app/bridge/checkout-widget/page.tsx (2)

71-77: LGTM! Clean parameter parsing with proper validation.

The paymentMethods query parameter is correctly parsed and validated, returning a typed array for valid values ("crypto" or "card") and undefined otherwise. The single-method constraint aligns with the iframe URL builder implementation.


136-136: LGTM! Parameter properly propagated to CheckoutWidgetEmbed.

The parsed paymentMethods value is correctly passed to the CheckoutWidgetEmbed component.

apps/playground-web/src/app/bridge/checkout-widget/page.tsx (4)

13-14: LGTM! Proper type-safe tab definitions.

The validTabs constant with as const and derived ValidTabs type provide strong typing for the tab validation logic.


25-36: LGTM! Correct async implementation for Next.js 15.

The page component properly handles the async searchParams Promise as required by Next.js 15. The tab extraction and validation logic correctly handles edge cases and provides type safety.


44-44: Verify the documentation link update is intentional.

The docsLink was changed from a previous path to https://portal.thirdweb.com/bridge/checkout-widget?utm_source=playground. Confirm this new URL is correct and the documentation exists at this location.


46-46: LGTM! Tab preference correctly passed to playground.

The validated tab is properly passed as defaultTab to enable URL-driven tab selection between iframe and React modes.

apps/dashboard/src/app/bridge/checkout-widget/CheckoutWidgetEmbed.client.tsx (1)

37-37: LGTM!

Clean prop forwarding implementation. The paymentMethods prop is correctly typed as an optional array of string literals and properly passed through to the underlying CheckoutWidget component.

Also applies to: 52-52, 84-84

apps/playground-web/src/app/bridge/checkout-widget/CheckoutPlayground.tsx (3)

3-12: LGTM!

Imports follow the coding guidelines with TabButtons from @/components/ui/*. The integrationType default is correctly initialized.


75-89: LGTM!

The tab switching implementation is clean with proper active state tracking via isActive and controlled state updates.


91-101: LGTM!

The layout follows mobile-first responsive design with Tailwind utilities. The LeftSection and RightSection are properly wired with state management props.

@MananTank MananTank force-pushed the 12-29-playground_add_checkoutwidget_iframe branch from d5397aa to 8b9bf79 Compare December 29, 2025 15:39
@vercel vercel bot temporarily deployed to Preview – nebula December 29, 2025 15:39 Inactive
@vercel vercel bot temporarily deployed to Preview – wallet-ui December 29, 2025 15:39 Inactive
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

🧹 Nitpick comments (1)
apps/playground-web/src/app/bridge/checkout-widget/CheckoutPlayground.tsx (1)

79-79: State update pattern may lose concurrent updates.

Using object spread with the current options from closure can lose concurrent state updates. Use the functional setState pattern to ensure all updates are based on the latest state.

🔎 Proposed fix
 {
   name: "React",
-  onClick: () => setOptions({ ...options, integrationType: "react" }),
+  onClick: () => setOptions(prev => ({ ...prev, integrationType: "react" })),
   isActive: options.integrationType === "react",
 },
 {
   name: "Iframe",
-  onClick: () =>
-    setOptions({ ...options, integrationType: "iframe" }),
+  onClick: () => setOptions(prev => ({ ...prev, integrationType: "iframe" })),
   isActive: options.integrationType === "iframe",
 },

Also applies to: 84-85

📜 Review details

Configuration used: Organization 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 d5397aa and 8b9bf79.

📒 Files selected for processing (10)
  • apps/dashboard/src/app/bridge/checkout-widget/CheckoutWidgetEmbed.client.tsx
  • apps/dashboard/src/app/bridge/checkout-widget/page.tsx
  • apps/playground-web/src/app/bridge/checkout-widget/CheckoutPlayground.tsx
  • apps/playground-web/src/app/bridge/checkout-widget/page.tsx
  • apps/playground-web/src/app/bridge/components/CodeGen.tsx
  • apps/playground-web/src/app/bridge/components/LeftSection.tsx
  • apps/playground-web/src/app/bridge/components/RightSection.tsx
  • apps/playground-web/src/app/bridge/components/buildCheckoutIframeUrl.ts
  • apps/playground-web/src/app/bridge/components/types.ts
  • apps/portal/src/app/bridge/checkout-widget/iframe/page.mdx
🚧 Files skipped from review as they are similar to previous changes (5)
  • apps/dashboard/src/app/bridge/checkout-widget/page.tsx
  • apps/playground-web/src/app/bridge/components/RightSection.tsx
  • apps/playground-web/src/app/bridge/components/CodeGen.tsx
  • apps/playground-web/src/app/bridge/components/types.ts
  • apps/portal/src/app/bridge/checkout-widget/iframe/page.mdx
🧰 Additional context used
📓 Path-based instructions (9)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.{ts,tsx}: Write idiomatic TypeScript with explicit function declarations and return types
Limit each TypeScript 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 in TypeScript
Avoid any and unknown in TypeScript unless unavoidable; narrow generics when possible
Choose composition over inheritance; leverage utility types (Partial, Pick, etc.) in TypeScript

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

Files:

  • apps/dashboard/src/app/bridge/checkout-widget/CheckoutWidgetEmbed.client.tsx
  • apps/playground-web/src/app/bridge/components/buildCheckoutIframeUrl.ts
  • apps/playground-web/src/app/bridge/checkout-widget/page.tsx
  • apps/playground-web/src/app/bridge/components/LeftSection.tsx
  • apps/playground-web/src/app/bridge/checkout-widget/CheckoutPlayground.tsx
apps/{dashboard,playground-web}/src/**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

apps/{dashboard,playground-web}/src/**/*.{ts,tsx}: Import UI component primitives from @/components/ui/* (Button, Input, Select, Tabs, Card, Sidebar, Badge, Separator) in dashboard and playground
Use Tailwind CSS only – no inline styles or CSS modules in dashboard and playground
Use cn() from @/lib/utils for conditional Tailwind class merging
Use design system tokens for styling (backgrounds: bg-card, borders: border-border, muted text: text-muted-foreground)
Expose className prop on root element for component overrides

Files:

  • apps/dashboard/src/app/bridge/checkout-widget/CheckoutWidgetEmbed.client.tsx
  • apps/playground-web/src/app/bridge/components/buildCheckoutIframeUrl.ts
  • apps/playground-web/src/app/bridge/checkout-widget/page.tsx
  • apps/playground-web/src/app/bridge/components/LeftSection.tsx
  • apps/playground-web/src/app/bridge/checkout-widget/CheckoutPlayground.tsx
apps/dashboard/src/**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

apps/dashboard/src/**/*.{ts,tsx}: Use NavLink for internal navigation with automatic active states in dashboard
Start server component files with import "server-only"; in Next.js
Read cookies/headers with next/headers in server components
Access server-only environment variables in server components
Perform heavy data fetching in server components
Implement redirect logic with redirect() from next/navigation in server components
Begin client component files with 'use client'; directive in Next.js
Handle interactive UI with React hooks (useState, useEffect, React Query, wallet hooks) in client components
Access browser APIs (localStorage, window, IntersectionObserver) in client components
Support fast transitions with prefetched data in client components
Always call getAuthToken() to retrieve JWT from cookies on server side
Use Authorization: Bearer header for API calls – never embed tokens in URLs
Return typed results (Project[], User[]) from server-side data fetches – avoid any
Wrap client-side API calls in React Query (@tanstack/react-query)
Use descriptive, stable queryKeys in React Query for cache hits
Configure staleTime/cacheTime in React Query based on freshness (default ≥ 60s)
Keep tokens secret via internal API routes or server actions
Never import posthog-js in server components – only use analytics client-side

Files:

  • apps/dashboard/src/app/bridge/checkout-widget/CheckoutWidgetEmbed.client.tsx
apps/dashboard/**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/dashboard.mdc)

apps/dashboard/**/*.{ts,tsx}: Always import from the central UI library under @/components/ui/* for reusable core UI components like Button, Input, Select, Tabs, Card, Sidebar, Separator, Badge
Use NavLink from @/components/ui/NavLink for internal navigation to ensure active states are handled automatically
For notices and skeletons, rely on AnnouncementBanner, GenericLoadingPage, and EmptyStateCard components
Import icons from lucide-react or the project-specific …/icons exports; never embed raw SVG
Keep components pure; fetch data outside using server components or hooks and pass it down via props
Use Tailwind CSS as the styling system; avoid inline styles or CSS modules
Merge class names with cn from @/lib/utils to keep conditional logic readable
Stick to design tokens: use bg-card, border-border, text-muted-foreground and other Tailwind variables instead of hard-coded colors
Use spacing utilities (px-*, py-*, gap-*) instead of custom margins
Follow mobile-first responsive design with Tailwind helpers (max-sm, md, lg, xl)
Never hard-code colors; always use Tailwind variables
Combine class names via cn, and expose className prop if useful in components
Use React Query (@tanstack/react-query) for all client-side data fetching with typed hooks

Files:

  • apps/dashboard/src/app/bridge/checkout-widget/CheckoutWidgetEmbed.client.tsx
apps/dashboard/**/*.client.tsx

📄 CodeRabbit inference engine (.cursor/rules/dashboard.mdc)

apps/dashboard/**/*.client.tsx: Name component files after the component in PascalCase; append .client.tsx when the component is interactive
Client components must start with 'use client'; directive before imports

Files:

  • apps/dashboard/src/app/bridge/checkout-widget/CheckoutWidgetEmbed.client.tsx
**/*.{js,jsx,ts,tsx,json}

📄 CodeRabbit inference engine (AGENTS.md)

Biome governs formatting and linting; its rules live in biome.json. Run pnpm fix & pnpm lint before committing, ensure there are no linting errors

Files:

  • apps/dashboard/src/app/bridge/checkout-widget/CheckoutWidgetEmbed.client.tsx
  • apps/playground-web/src/app/bridge/components/buildCheckoutIframeUrl.ts
  • apps/playground-web/src/app/bridge/checkout-widget/page.tsx
  • apps/playground-web/src/app/bridge/components/LeftSection.tsx
  • apps/playground-web/src/app/bridge/checkout-widget/CheckoutPlayground.tsx
apps/{dashboard,playground}/**/*.{tsx,ts}

📄 CodeRabbit inference engine (AGENTS.md)

apps/{dashboard,playground}/**/*.{tsx,ts}: Import UI primitives from @/components/ui/_ (Button, Input, Select, Tabs, Card, Sidebar, Badge, Separator) in Dashboard and Playground apps
Use NavLink for internal navigation so active states are handled automatically
Use Tailwind CSS for styling – no inline styles or CSS modules
Merge class names with cn() from @/lib/utils to keep conditional logic readable
Stick to design tokens for styling: backgrounds (bg-card), borders (border-border), muted text (text-muted-foreground), etc.
Server Components: Read cookies/headers with next/headers, access server-only environment variables or secrets, perform heavy data fetching, implement redirect logic with redirect() from next/navigation, and start files with import 'server-only'; to prevent client bundling
Client Components: Begin files with 'use client'; before imports, handle interactive UI relying on React hooks (useState, useEffect, React Query, wallet hooks), access browser APIs (localStorage, window, IntersectionObserver, etc.), and support fast transitions with client-side data prefetching
For client-side data fetching: Wrap calls in React Query (@tanstack/react-query), use descriptive and stable queryKeys for cache hits, configure staleTime / cacheTime based on freshness requirements (default ≥ 60 s), and keep tokens secret by calling internal API routes or server actions

Files:

  • apps/dashboard/src/app/bridge/checkout-widget/CheckoutWidgetEmbed.client.tsx
apps/{dashboard,playground}/**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

apps/{dashboard,playground}/**/*.{ts,tsx}: For server-side data fetching: Always call getAuthToken() to retrieve the JWT from cookies and inject the token as an Authorization: Bearer header – never embed it in the URL. Return typed results (Project[], User[], …) – avoid any
Never import posthog-js in server components; analytics reporting is client-side only

Files:

  • apps/dashboard/src/app/bridge/checkout-widget/CheckoutWidgetEmbed.client.tsx
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (AGENTS.md)

Lazy-import optional features; avoid top-level side-effects

Files:

  • apps/dashboard/src/app/bridge/checkout-widget/CheckoutWidgetEmbed.client.tsx
  • apps/playground-web/src/app/bridge/components/buildCheckoutIframeUrl.ts
  • apps/playground-web/src/app/bridge/checkout-widget/page.tsx
  • apps/playground-web/src/app/bridge/components/LeftSection.tsx
  • apps/playground-web/src/app/bridge/checkout-widget/CheckoutPlayground.tsx
🧬 Code graph analysis (3)
apps/playground-web/src/app/bridge/components/buildCheckoutIframeUrl.ts (1)
apps/playground-web/src/app/bridge/components/types.ts (1)
  • BridgeComponentsPlaygroundOptions (33-63)
apps/playground-web/src/app/bridge/checkout-widget/page.tsx (1)
apps/playground-web/src/app/bridge/checkout-widget/CheckoutPlayground.tsx (1)
  • CheckoutPlayground (48-105)
apps/playground-web/src/app/bridge/components/LeftSection.tsx (1)
apps/playground-web/src/app/wallets/sign-in/components/ColorFormGroup.tsx (1)
  • ColorFormGroup (9-111)
⏰ 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). (6)
  • GitHub Check: Lint Packages
  • GitHub Check: E2E Tests (pnpm, webpack)
  • GitHub Check: Unit Tests
  • GitHub Check: Size
  • GitHub Check: Build Packages
  • GitHub Check: Analyze (javascript)
🔇 Additional comments (5)
apps/dashboard/src/app/bridge/checkout-widget/CheckoutWidgetEmbed.client.tsx (1)

37-37: LGTM! Clean prop forwarding for payment methods.

The addition of the optional paymentMethods prop is correctly typed and forwarded to the underlying CheckoutWidget component.

Also applies to: 52-52, 84-84

apps/playground-web/src/app/bridge/components/LeftSection.tsx (1)

487-500: LGTM! Appropriate conditional rendering for iframe mode.

Hiding the color customization UI when using iframe integration makes sense, as the iframe likely doesn't support theme color overrides (only light/dark mode selection is available).

apps/playground-web/src/app/bridge/checkout-widget/page.tsx (2)

13-14: LGTM! Correct Next.js 15 async searchParams handling.

The implementation correctly:

  • Uses async function with Promise-based searchParams (Next.js 15 requirement)
  • Validates tab against allowed values with proper type guards
  • Handles edge cases (array values, undefined, invalid strings)
  • Falls back to undefined for invalid tabs

Also applies to: 25-36


44-44: Documentation link is valid and accessible.

The URL correctly points to published documentation that covers checkout widget iframe integration. No action required.

apps/playground-web/src/app/bridge/components/buildCheckoutIframeUrl.ts (1)

54-62: The single payment method restriction is intentional but silently fails with multiple methods.

The iframe API only supports a single payment method via the paymentMethods query parameter. The code correctly avoids passing invalid data when multiple methods are configured, but this creates a silent failure: if an array has 2+ elements, nothing is sent to the iframe (defaulting to both methods enabled).

The documentation references "comma-separated" values, but the iframe endpoint doesn't parse them—it only accepts single string values ("crypto" or "card"). Consider either:

  1. Documenting that only single-method configuration is supported
  2. Supporting comma-separated values in the iframe parser if the API can handle multiple methods
  3. Warning developers when they attempt multi-method configuration on the iframe URL builder

@codecov
Copy link

codecov bot commented Dec 29, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 53.19%. Comparing base (ec73f1f) to head (8b9bf79).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #8591   +/-   ##
=======================================
  Coverage   53.19%   53.19%           
=======================================
  Files         922      922           
  Lines       61480    61480           
  Branches     4032     4032           
=======================================
  Hits        32706    32706           
  Misses      28676    28676           
  Partials       98       98           
Flag Coverage Δ
packages 53.19% <ø> (ø)
🚀 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.

@github-actions
Copy link
Contributor

github-actions bot commented Dec 29, 2025

size-limit report 📦

Path Size
@thirdweb-dev/nexus (esm) 105.66 KB (0%)
@thirdweb-dev/nexus (cjs) 319.47 KB (0%)

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

Labels

Dashboard Involves changes to the Dashboard. Playground Changes involving the Playground codebase. Portal Involves changes to the Portal (docs) codebase.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants