Skip to content

react-centra-checkout: update and add data type on add*Item handlers#541

Open
adamsoderstrom wants to merge 3 commits intomainfrom
feature/react-centra-checkout-add-item-data
Open

react-centra-checkout: update and add data type on add*Item handlers#541
adamsoderstrom wants to merge 3 commits intomainfrom
feature/react-centra-checkout-add-item-data

Conversation

@adamsoderstrom
Copy link
Member

  • fix(react-centra-checkout): update data type on addBundleItem
  • feat(react-centra-checkout): add support for data in addItem handler

@vercel
Copy link

vercel bot commented May 28, 2025

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

Name Status Preview Comments Updated (UTC)
docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 28, 2025 8:56am

@changeset-bot
Copy link

changeset-bot bot commented May 28, 2025

🦋 Changeset detected

Latest commit: d39d30d

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

This PR includes changesets to release 1 package
Name Type
@noaignite/react-centra-checkout Minor

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

@adamsoderstrom adamsoderstrom requested a review from FadiGo May 28, 2025 08:42
@codecov
Copy link

codecov bot commented May 28, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

@@           Coverage Diff           @@
##             main     #541   +/-   ##
=======================================
  Coverage   73.81%   73.81%           
=======================================
  Files          62       62           
  Lines        2112     2112           
  Branches      295      295           
=======================================
  Hits         1559     1559           
  Misses        541      541           
  Partials       12       12           
Files with missing lines Coverage Δ
packages/react-centra-checkout/src/Context.tsx 75.96% <100.00%> (ø)
...ackages/react-centra-checkout/src/PaymentEmbed.tsx 82.14% <ø> (ø)
...ages/react-centra-checkout/src/ShipwalletEmbed.tsx 100.00% <ø> (ø)
🚀 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

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Updates the react-centra-checkout package to enhance the addItem and addBundleItem handlers with improved data type support and adds missing 'use client' directives for Next.js compatibility.

  • Enhanced addItem handler to accept optional data parameter with product metadata
  • Updated addBundleItem handler with more specific typed data interface replacing generic Record type
  • Added 'use client' directives to React components for Next.js client-side rendering compatibility

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
packages/react-centra-checkout/src/Context.tsx Enhanced type definitions for addItem and addBundleItem handlers with structured data parameters
packages/react-centra-checkout/src/ShipwalletEmbed.tsx Added 'use client' directive for Next.js compatibility
packages/react-centra-checkout/src/PaymentEmbed.tsx Added 'use client' directive for Next.js compatibility
.changeset/tangy-toys-double.md Changelog entry for addItem data support feature
.changeset/rotten-pugs-unite.md Changelog entry for missing 'use client' directives fix
.changeset/green-months-hang.md Changelog entry for addBundleItem data type update

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines +73 to +92
/**
* The URL to the product added, so the item can be linked back to its origin
*/
productUrl?: string
/**
* The category id of the added product, so the item can be linked back to its origin.
*/
category?: string
/**
* Requires shared secret. Comment that will end up on the order line
*/
comment?: string
/**
* Localized size (localizedSize) & localization definition name (localizationDefinitionName)
*/
localizedProdSize?: string
/**
* The ID of subscription plan
*/
subscriptionPlan?: string
Copy link

Copilot AI Sep 24, 2025

Choose a reason for hiding this comment

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

The data type definition for addItem is duplicated in the addBundleItem interface (lines 109-127). Consider extracting this into a shared interface to avoid code duplication and ensure consistency.

Copilot uses AI. Check for mistakes.
@adamsoderstrom
Copy link
Member Author

Passing undefined in data is probably not possible, since it's not JSON parseable.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants