-
Notifications
You must be signed in to change notification settings - Fork 635
[MNY-354] Portal: Add Buy Widget iframe docs #8614
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
4 Skipped Deployments
|
|
WalkthroughAdds a new exported React component Changes
Sequence Diagram(s)(omitted — changes are documentation/UI additions and sidebar updates without a multi-component runtime control flow requiring diagramming) Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
Warning Review ran into problems🔥 ProblemsErrors were encountered while retrieving linked issues. Errors (1)
Comment |
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
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. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #8614 +/- ##
=======================================
Coverage 53.02% 53.02%
=======================================
Files 924 924
Lines 61726 61726
Branches 4035 4035
=======================================
Hits 32730 32730
Misses 28898 28898
Partials 98 98
🚀 New features to boost your workflow:
|
There was a problem hiding this 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
🤖 Fix all issues with AI agents
In @apps/portal/src/app/bridge/buy-widget/iframe/iframe-code-preview.tsx:
- Around line 1-34: This file duplicates iframe preview logic used in
bridge-widget and checkout-widget; extract a shared component
IframeCodePreview(props: {src: string; title: string; height?: string}) that
renders the Tabs+CodeBlock and preview iframe (default height "700px") and then
replace the local IframeCodePreview in this file (and the two other copies) with
the shared component, passing the appropriate title and height values; ensure
the generated HTML in CodeBlock uses the same height string and the preview
iframe uses title, src, height, width="100%", className="rounded-xl" and
style={{ border: 0 }} to preserve behavior.
In @apps/portal/src/app/bridge/buy-widget/iframe/page.mdx:
- Line 55: The IframeCodePreview src URL has a syntax error: the query parameter
lacks the '?' separator; update the src prop value passed to IframeCodePreview
so the URL reads "https://thirdweb.com/bridge/buy-widget?theme=light" (i.e.,
insert the '?' before "theme=light") to correctly pass the theme query
parameter.
🧹 Nitpick comments (1)
apps/portal/src/app/bridge/buy-widget/iframe/iframe-code-preview.tsx (1)
3-3: Add explicit return type annotation.Per coding guidelines, TypeScript functions should have explicit return type annotations.
♻️ Proposed fix
-export function IframeCodePreview(props: { src: string }) { +export function IframeCodePreview(props: { src: string }): JSX.Element {As per coding guidelines, all functions should have explicit return types.
📜 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.
📒 Files selected for processing (5)
apps/portal/src/app/bridge/buy-widget/iframe/iframe-code-preview.tsxapps/portal/src/app/bridge/buy-widget/iframe/page.mdxapps/portal/src/app/bridge/buy-widget/page.mdxapps/portal/src/app/bridge/buy-widget/react/page.mdxapps/portal/src/app/bridge/sidebar.tsx
🧰 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 TypeScript file to one stateless, single-responsibility function for clarity
Re-use shared types from@/typesor localtypes.tsbarrels
Prefer type aliases over interface except for nominal shapes in TypeScript
Avoidanyandunknownin 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/portal/src/app/bridge/buy-widget/iframe/iframe-code-preview.tsxapps/portal/src/app/bridge/sidebar.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 lintbefore committing, ensure there are no linting errors
Files:
apps/portal/src/app/bridge/buy-widget/iframe/iframe-code-preview.tsxapps/portal/src/app/bridge/sidebar.tsx
**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (AGENTS.md)
Lazy-import optional features; avoid top-level side-effects
Files:
apps/portal/src/app/bridge/buy-widget/iframe/iframe-code-preview.tsxapps/portal/src/app/bridge/sidebar.tsx
🧬 Code graph analysis (1)
apps/portal/src/app/bridge/buy-widget/iframe/iframe-code-preview.tsx (2)
apps/portal/src/app/bridge/checkout-widget/iframe/iframe-code-preview.tsx (1)
IframeCodePreview(3-34)apps/portal/src/app/bridge/bridge-widget/iframe/iframe-code-preview.tsx (1)
IframeCodePreview(10-40)
⏰ 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: Analyze (javascript)
🔇 Additional comments (4)
apps/portal/src/app/bridge/buy-widget/react/page.mdx (1)
1-127: LGTM!The documentation is well-structured and provides clear examples for integrating the BuyWidget React component. The progressive examples (basic usage → token prefill → custom receiver address) make it easy for developers to understand different use cases.
apps/portal/src/app/bridge/sidebar.tsx (1)
44-84: LGTM!The sidebar navigation updates properly reflect the new Buy Widget documentation structure. The consistent pattern across all widgets (Swap, Buy, and Checkout) with React Component and Iframe options makes the navigation intuitive.
apps/portal/src/app/bridge/buy-widget/iframe/page.mdx (1)
149-167: LGTM!The event listener implementation properly validates the message origin and source before processing events, which is a good security practice for postMessage communication.
apps/portal/src/app/bridge/buy-widget/page.mdx (1)
1-61: LGTM!The landing page provides a clear overview of the Buy Widget features and effectively guides users to the appropriate integration method (iframe or React component).
size-limit report 📦
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
apps/portal/src/app/bridge/buy-widget/page.mdx (1)
35-51: Minor indentation inconsistency.Line 39 appears to use different indentation (tab vs spaces) compared to surrounding lines. Run
pnpm fixto ensure consistent formatting across the file.As per coding guidelines, Biome governs formatting and should normalize this automatically.
📜 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.
📒 Files selected for processing (5)
apps/portal/src/app/bridge/buy-widget/iframe/iframe-code-preview.tsxapps/portal/src/app/bridge/buy-widget/iframe/page.mdxapps/portal/src/app/bridge/buy-widget/page.mdxapps/portal/src/app/bridge/buy-widget/react/page.mdxapps/portal/src/app/bridge/sidebar.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
- apps/portal/src/app/bridge/buy-widget/iframe/iframe-code-preview.tsx
🧰 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 TypeScript file to one stateless, single-responsibility function for clarity
Re-use shared types from@/typesor localtypes.tsbarrels
Prefer type aliases over interface except for nominal shapes in TypeScript
Avoidanyandunknownin 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/portal/src/app/bridge/sidebar.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 lintbefore committing, ensure there are no linting errors
Files:
apps/portal/src/app/bridge/sidebar.tsx
**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (AGENTS.md)
Lazy-import optional features; avoid top-level side-effects
Files:
apps/portal/src/app/bridge/sidebar.tsx
🪛 Gitleaks (8.30.0)
apps/portal/src/app/bridge/buy-widget/react/page.mdx
[high] 81-81: 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). (6)
- GitHub Check: Lint Packages
- GitHub Check: Build Packages
- GitHub Check: Unit Tests
- GitHub Check: E2E Tests (pnpm, webpack)
- GitHub Check: Size
- GitHub Check: Analyze (javascript)
🔇 Additional comments (9)
apps/portal/src/app/bridge/buy-widget/page.mdx (1)
1-17: LGTM!The imports are well-organized and the metadata structure follows the established pattern for documentation pages. The "payments" icon choice appropriately reflects the Buy Widget's purpose.
apps/portal/src/app/bridge/buy-widget/react/page.mdx (3)
1-15: LGTM!The imports and metadata structure are consistent with the other Buy Widget documentation pages.
29-108: Well-structured documentation examples.The code examples are clear, progressively introduce features, and properly demonstrate the ThirdwebProvider requirement. The examples cover the main use cases effectively.
81-81: Static analysis false positive - this is a public blockchain address.The flagged value is the USDC contract address on Base chain, which is public, on-chain information and not a secret API key. Blockchain contract addresses are meant to be shared and used in code examples.
apps/portal/src/app/bridge/buy-widget/iframe/page.mdx (3)
1-16: LGTM!The imports are well-organized with the local
IframeCodePreviewcomponent properly imported relative to the current file. Metadata structure is consistent with the other documentation pages.
50-141: Comprehensive customization documentation.The iframe options are well-documented with clear examples for each customization parameter. The note about URI encoding for special characters (line 62) is a helpful reminder that will prevent common integration errors.
143-167: Excellent security-conscious event handling.The event listener example properly validates both the
originandsourcebefore processing messages (line 154), which is a critical security practice when usingpostMessage. This prevents malicious iframes from sending spoofed events.apps/portal/src/app/bridge/sidebar.tsx (2)
24-86: Well-structured navigation reorganization.The widget section now clearly distinguishes three separate widgets (Swap, Buy, Checkout), each with consistent nested links for React and Iframe implementations. The paths align with the new documentation files added in this PR (
/bridge/buy-widget,/bridge/buy-widget/react,/bridge/buy-widget/iframe).
1-8: Clean TypeScript setup with explicit typing.The file properly imports types and explicitly types the
sidebarexport asSideBar, following the coding guideline for explicit type declarations.
Merge activity
|
<!--
## 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 introduces the `Buy Widget`, enhancing the portal with a new iframe component for purchasing crypto. It includes documentation, features, and examples for users to integrate the widget easily.
### Detailed summary
- Added `IframeCodePreview` component in `iframe-code-preview.tsx`.
- Updated sidebar links to reflect the new `Buy Widget` and `Swap Widget`.
- Created documentation for the `Buy Widget` in `page.mdx`, detailing features and integration.
- Added example usage of the `BuyWidget` component in `react/page.mdx`.
- Developed `iframe/page.mdx` with customization options and event listening for the widget.
> ✨ 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**
* Added an iframe embed preview with code/preview tabs for trying the Buy widget.
* **Documentation**
* Added comprehensive Buy widget docs (overview, React and iframe guides, examples, customization, event listening, live playgrounds).
* **Chores**
* Updated site navigation: Widgets section reorganized to list Swap, Buy, and Checkout widgets with updated links.
<sub>✏️ Tip: You can customize this high-level summary in your review settings.</sub>
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
6060ba7 to
c1275a5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
apps/portal/src/app/bridge/buy-widget/page.mdx (1)
1-8: Remove unused imports and consolidate import statements.
DetailsandDocImageare imported but never used in this file. Additionally, the two imports from"@doc"can be consolidated into a single statement.🧹 Suggested cleanup
-import { - Details, - createMetadata, - DocImage, -} from "@doc"; -import { ArticleIconCard } from "@doc"; +import { createMetadata, ArticleIconCard } from "@doc"; import { FrameIcon, PlayIcon } from "lucide-react"; import { ReactIcon } from "@/icons";
📜 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.
📒 Files selected for processing (5)
apps/portal/src/app/bridge/buy-widget/iframe/iframe-code-preview.tsxapps/portal/src/app/bridge/buy-widget/iframe/page.mdxapps/portal/src/app/bridge/buy-widget/page.mdxapps/portal/src/app/bridge/buy-widget/react/page.mdxapps/portal/src/app/bridge/sidebar.tsx
🚧 Files skipped from review as they are similar to previous changes (3)
- apps/portal/src/app/bridge/buy-widget/react/page.mdx
- apps/portal/src/app/bridge/buy-widget/iframe/iframe-code-preview.tsx
- apps/portal/src/app/bridge/buy-widget/iframe/page.mdx
🧰 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 TypeScript file to one stateless, single-responsibility function for clarity
Re-use shared types from@/typesor localtypes.tsbarrels
Prefer type aliases over interface except for nominal shapes in TypeScript
Avoidanyandunknownin 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/portal/src/app/bridge/sidebar.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 lintbefore committing, ensure there are no linting errors
Files:
apps/portal/src/app/bridge/sidebar.tsx
**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (AGENTS.md)
Lazy-import optional features; avoid top-level side-effects
Files:
apps/portal/src/app/bridge/sidebar.tsx
⏰ 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, esbuild)
- GitHub Check: E2E Tests (pnpm, webpack)
- GitHub Check: Build Packages
- GitHub Check: Size
- GitHub Check: Lint Packages
- GitHub Check: Unit Tests
- GitHub Check: Analyze (javascript)
🔇 Additional comments (2)
apps/portal/src/app/bridge/buy-widget/page.mdx (1)
10-61: Documentation content looks well-structured.The metadata, feature list, integration options, and playground link are clearly organized. The
ArticleIconCardcomponents provide intuitive navigation to the iframe and React integration docs.apps/portal/src/app/bridge/sidebar.tsx (1)
43-84: Widget sidebar entries are well-structured and consistent.The navigation structure for Swap, Buy, and Checkout widgets follows a consistent pattern with properly nested links. The new Buy Widget entry aligns with the documentation pages introduced in this PR.

PR-Codex overview
This PR introduces a new
Buy Widgetfeature that allows users to purchase crypto tokens through an iframe or a React component. It enhances the user interface with tabs for code and preview, updates sidebar links, and enriches documentation for better integration.Detailed summary
IframeCodePreviewcomponent for displaying iframe code snippets.Buy WidgetandSwap Widget.Buy WidgetandBuy Widget Componentwith features and integration examples.iframedocumentation with query parameter options for customization.Summary by CodeRabbit
New Features
Documentation
Chores
✏️ Tip: You can customize this high-level summary in your review settings.