Skip to content

Conversation

@joaquim-verges
Copy link
Member

@joaquim-verges joaquim-verges commented Jun 23, 2025


PR-Codex overview

This PR focuses on enhancing the handling of metadata for payment widgets, including improvements to image URL resolution and modifications to widget properties for better user experience.

Detailed summary

  • Updated WithHeader to use getUrl for image URL resolution.
  • Added description and image properties to BuyWidget.
  • Modified LeftSection and RightSection to reflect changes in labels and added properties for description and image.
  • Introduced getDefaultImage function for fallback images.

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

Summary by CodeRabbit

  • New Features

    • Payment widgets now support metadata images that are not URLs, ensuring better compatibility and display.
  • Bug Fixes

    • Improved handling of image data in payment widgets to prevent display issues with non-URL metadata images.
  • Refactor

    • Streamlined logic for resolving image URLs in header backgrounds for improved maintainability.
    • Checkout widget now uses flexible, theme-aware default values for name, description, and image, enhancing customization.
  • Style

    • Updated input field labels in the "Metadata Options" section for clarity.

@vercel
Copy link

vercel bot commented Jun 23, 2025

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

Name Status Preview Comments Updated (UTC)
docs-v2 ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 23, 2025 0:50am
nebula ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 23, 2025 0:50am
thirdweb_playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 23, 2025 0:50am
thirdweb-www ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 23, 2025 0:50am
wallet-ui ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 23, 2025 0:50am

@changeset-bot
Copy link

changeset-bot bot commented Jun 23, 2025

🦋 Changeset detected

Latest commit: d0ce77d

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
thirdweb Patch
@thirdweb-dev/nebula Patch
@thirdweb-dev/wagmi-adapter Patch

Not sure what this means? Click here to learn what changesets are.

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

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jun 23, 2025

Walkthrough

The changes update payment widget metadata handling, including improved support for non-URL images and refactored image URL resolution. Input field labels in the UI are adjusted for clarity. Default values and theme-aware placeholder images are introduced for checkout widgets, with logic refactored into new helper functions where appropriate.

Changes

File(s) Change Summary
.changeset/fluffy-cows-swim.md Added a patch note for handling non-URL metadata images in payment widgets for the thirdweb package.
apps/playground-web/src/app/connect/pay/embed/LeftSection.tsx Changed input field labels: "Title" to "Name" and "Image" to "Description" in the Metadata Options section.
apps/playground-web/src/app/connect/pay/embed/RightSection.tsx Refactored CheckoutWidget to accept name, description, and image props with theme-aware defaults; added getDefaultImage().
apps/playground-web/src/components/pay/direct-payment.tsx Added an image property ("/drip-hoodie.png") to the CheckoutWidget in BuyMerchPreview.
packages/thirdweb/src/react/web/ui/Bridge/common/WithHeader.tsx Extracted image URL resolution logic into a new getUrl() helper function for background images.
packages/thirdweb/src/react/web/ui/Bridge/BuyWidget.tsx Extended BuyWidgetProps with optional description and image; included these in metadata passed to bridgeDataQuery results.

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant LeftSection
  participant RightSection
  participant CheckoutWidget

  User->>LeftSection: Edit metadata fields (Name, Description, Image)
  LeftSection->>RightSection: Pass payOptions (name, description, image)
  RightSection->>CheckoutWidget: Render with props (name, description, image)
  RightSection->>CheckoutWidget: If missing, use theme-aware defaults
  CheckoutWidget->>User: Display payment widget with resolved metadata
Loading

Suggested labels

Dashboard

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.

📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 6776d08 and d0ce77d.

📒 Files selected for processing (6)
  • .changeset/fluffy-cows-swim.md (1 hunks)
  • apps/playground-web/src/app/connect/pay/embed/LeftSection.tsx (2 hunks)
  • apps/playground-web/src/app/connect/pay/embed/RightSection.tsx (3 hunks)
  • apps/playground-web/src/components/pay/direct-payment.tsx (1 hunks)
  • packages/thirdweb/src/react/web/ui/Bridge/BuyWidget.tsx (3 hunks)
  • packages/thirdweb/src/react/web/ui/Bridge/common/WithHeader.tsx (2 hunks)
✅ Files skipped from review due to trivial changes (1)
  • packages/thirdweb/src/react/web/ui/Bridge/BuyWidget.tsx
🚧 Files skipped from review as they are similar to previous changes (5)
  • .changeset/fluffy-cows-swim.md
  • apps/playground-web/src/components/pay/direct-payment.tsx
  • apps/playground-web/src/app/connect/pay/embed/LeftSection.tsx
  • apps/playground-web/src/app/connect/pay/embed/RightSection.tsx
  • packages/thirdweb/src/react/web/ui/Bridge/common/WithHeader.tsx
⏰ Context from checks skipped due to timeout of 90000ms (8)
  • GitHub Check: E2E Tests (pnpm, vite)
  • GitHub Check: E2E Tests (pnpm, esbuild)
  • GitHub Check: Size
  • GitHub Check: E2E Tests (pnpm, webpack)
  • GitHub Check: Unit Tests
  • GitHub Check: Build Packages
  • GitHub Check: Lint Packages
  • GitHub Check: Analyze (javascript)
✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

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

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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

CodeRabbit Commands (Invoked using PR comments)

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

Other keywords and placeholders

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

CodeRabbit Configuration File (.coderabbit.yaml)

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

Documentation and Community

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

@github-actions github-actions bot added Playground Changes involving the Playground codebase. packages SDK Involves changes to the thirdweb SDK labels Jun 23, 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.

@joaquim-verges joaquim-verges changed the title Handle non-URLs for metadata images in payment widgets [SDK] Handle non-URLs for metadata images in payment widgets Jun 23, 2025
@joaquim-verges joaquim-verges marked this pull request as ready for review June 23, 2025 00:15
@joaquim-verges joaquim-verges requested review from a team as code owners June 23, 2025 00:15
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
apps/playground-web/src/app/connect/pay/embed/RightSection.tsx (1)

182-186: Consider alternatives to external placeholder service.

While the theme-aware default images are a good UX improvement, relying on an external service (placehold.co) introduces potential reliability and privacy concerns.

Consider these alternatives:

  1. Use local placeholder images bundled with the app
  2. Generate placeholder images using CSS/Canvas
  3. Use a more reliable CDN service

If you must use external placeholders, consider extracting the URLs to constants for better maintainability:

+const PLACEHOLDER_URLS = {
+  dark: "https://placehold.co/600x400/1d1d23/7c7a85?text=Your%20Product%20Here&font=roboto",
+  light: "https://placehold.co/600x400/f2eff3/6f6d78?text=Your%20Product%20Here&font=roboto"
+} as const;
+
 function getDefaultImage(theme: "dark" | "light") {
-  return theme === "dark"
-    ? "https://placehold.co/600x400/1d1d23/7c7a85?text=Your%20Product%20Here&font=roboto"
-    : "https://placehold.co/600x400/f2eff3/6f6d78?text=Your%20Product%20Here&font=roboto";
+  return PLACEHOLDER_URLS[theme];
 }
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 897bdc7 and 66fd195.

📒 Files selected for processing (5)
  • .changeset/fluffy-cows-swim.md (1 hunks)
  • apps/playground-web/src/app/connect/pay/embed/LeftSection.tsx (2 hunks)
  • apps/playground-web/src/app/connect/pay/embed/RightSection.tsx (2 hunks)
  • apps/playground-web/src/components/pay/direct-payment.tsx (1 hunks)
  • packages/thirdweb/src/react/web/ui/Bridge/common/WithHeader.tsx (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (8)
  • GitHub Check: E2E Tests (pnpm, esbuild)
  • GitHub Check: E2E Tests (pnpm, webpack)
  • GitHub Check: E2E Tests (pnpm, vite)
  • GitHub Check: Build Packages
  • GitHub Check: Lint Packages
  • GitHub Check: Size
  • GitHub Check: Unit Tests
  • GitHub Check: Analyze (javascript)
🔇 Additional comments (7)
.changeset/fluffy-cows-swim.md (1)

1-6: Changeset documentation looks good.

The changeset correctly documents the patch for handling non-URLs in metadata images for payment widgets.

apps/playground-web/src/components/pay/direct-payment.tsx (1)

14-14: Good addition of explicit image prop.

Adding the explicit image prop makes the CheckoutWidget usage more clear and aligns with the improved metadata handling across the codebase.

apps/playground-web/src/app/connect/pay/embed/LeftSection.tsx (2)

280-280: Improved label clarity.

Changing "Title" to "Name" provides better semantic clarity for the product name field.


321-321: Fixed incorrect field labeling.

Correcting the label from "Image" to "Description" for the description input field fixes what appears to be a mislabeling issue and improves user experience.

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

30-33: Good refactoring of URL resolution logic.

Extracting the URL resolution into the getUrl helper function improves code readability and reusability.


67-75: Well-implemented helper function.

The getUrl function properly handles IPFS URI resolution and provides a clean abstraction for URL processing.

apps/playground-web/src/app/connect/pay/embed/RightSection.tsx (1)

74-76: Improved flexibility with individual props and defaults.

The refactoring from a single purchaseData object to individual props with fallback defaults provides better flexibility and ensures graceful handling of missing metadata.

@github-actions
Copy link
Contributor

github-actions bot commented Jun 23, 2025

size-limit report 📦

Path Size Loading time (3g) Running time (snapdragon) Total time
thirdweb (esm) 62.56 KB (0%) 1.3 s (0%) 334 ms (+72.26% 🔺) 1.6 s
thirdweb (cjs) 350.74 KB (0%) 7.1 s (0%) 1.6 s (-1.88% 🔽) 8.6 s
thirdweb (minimal + tree-shaking) 5.72 KB (0%) 115 ms (0%) 97 ms (+786.74% 🔺) 212 ms
thirdweb/chains (tree-shaking) 530 B (0%) 11 ms (0%) 38 ms (+420.28% 🔺) 48 ms
thirdweb/react (minimal + tree-shaking) 19.61 KB (0%) 393 ms (0%) 61 ms (+110.99% 🔺) 453 ms

@codecov
Copy link

codecov bot commented Jun 23, 2025

Codecov Report

Attention: Patch coverage is 0% with 17 lines in your changes missing coverage. Please review.

Project coverage is 52.08%. Comparing base (897bdc7) to head (d0ce77d).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...dweb/src/react/web/ui/Bridge/common/WithHeader.tsx 0.00% 10 Missing ⚠️
...ges/thirdweb/src/react/web/ui/Bridge/BuyWidget.tsx 0.00% 7 Missing ⚠️

❌ Your patch status has failed because the patch coverage (0.00%) is below the target coverage (80.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7413      +/-   ##
==========================================
- Coverage   52.08%   52.08%   -0.01%     
==========================================
  Files         947      947              
  Lines       63623    63636      +13     
  Branches     4215     4222       +7     
==========================================
+ Hits        33140    33146       +6     
- Misses      30377    30384       +7     
  Partials      106      106              
Flag Coverage Δ
packages 52.08% <0.00%> (-0.01%) ⬇️
Files with missing lines Coverage Δ
...ges/thirdweb/src/react/web/ui/Bridge/BuyWidget.tsx 11.01% <0.00%> (-0.70%) ⬇️
...dweb/src/react/web/ui/Bridge/common/WithHeader.tsx 12.72% <0.00%> (-1.56%) ⬇️

... and 2 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.

@joaquim-verges joaquim-verges merged commit 3107ba1 into main Jun 23, 2025
24 of 25 checks passed
@joaquim-verges joaquim-verges deleted the Handle_non-URLs_for_metadata_images_in_payment_widgets branch June 23, 2025 00:54
@joaquim-verges joaquim-verges mentioned this pull request Jun 23, 2025
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.

2 participants