react-centra-checkout: update and add data type on add*Item handlers#541
react-centra-checkout: update and add data type on add*Item handlers#541adamsoderstrom wants to merge 3 commits intomainfrom
data type on add*Item handlers#541Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
🦋 Changeset detectedLatest commit: d39d30d The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
4d418f7 to
efc55b4
Compare
Codecov ReportAll 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
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
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
addItemhandler to accept optionaldataparameter with product metadata - Updated
addBundleItemhandler 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.
| /** | ||
| * 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 |
There was a problem hiding this comment.
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.
|
Passing |
datatype onaddBundleItemdatainaddItemhandler