Skip to content

@W-18568104@: Integrate commerce-sdk-react with v2#2510

Merged
shethj merged 91 commits intorelease-2.10.xfrom
feature/refactor-sdk-init
Jul 29, 2025
Merged

@W-18568104@: Integrate commerce-sdk-react with v2#2510
shethj merged 91 commits intorelease-2.10.xfrom
feature/refactor-sdk-init

Conversation

@shethj
Copy link
Contributor

@shethj shethj commented Jun 4, 2025

Description

This PR implements consuming changes to commerce-sdk-react for allowing integration with PWA Kit v2.x
The changes mainly involve updating CommerceAPIProvider to call the API provider from commerce-sdk-react while keeping the functionality of v2 providers as-is.

The PR also implements lazy loading for baskets. A basket is created only when the shopper adds an item to the basket.
This keeps the behavior in-line with hybrid and commerce-sdk-react

Other changes involve fixing unit tests to accomodate changes to how auth works and we've changed the version for react-testing-library which has some interface and behavior changes in tests.

NOTE: This PR uses a nightly release for commerce-sdk-react.
The nightly will then be replaced with the next version of @salesforece/commerce-sdk-react once the package is released.

Types of Changes

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Documentation update
  • Breaking change (could cause existing functionality to not work as expected)
  • Other changes (non-breaking changes that does not fit any of the above)

Breaking changes include:

  • Removing a public function or component or prop
  • Adding a required argument to a function
  • Changing the data type of a function parameter or return value
  • Adding a new peer dependency to package.json

Changes

  • (change1)

How to Test-Drive This PR

  • Pull Changes
  • Run git clean -dxf from monorepo root
  • Run npm install from monorepo root
  • Navigate to packages/template-retail-react-app
  • Run npm start
  • Smoke test the app locally.
  • Run npm run test locally and make sure the tests pass. This will not work in CI until I merge the bug fix for auth init.

Checklists

General

  • Changes are covered by test cases
  • CHANGELOG.md updated with a short description of changes (not required for documentation updates)

Accessibility Compliance

You must check off all items in one of the follow two lists:

  • There are no changes to UI

or...

Localization

  • Changes include a UI text update in the Retail React App (which requires translation)

@shethj shethj requested a review from a team as a code owner June 4, 2025 14:49
@shethj shethj changed the base branch from develop to feature/commerce-sdk-for-v2 June 4, 2025 14:51
@cc-prodsec
Copy link
Collaborator

cc-prodsec commented Jun 4, 2025

🎉 Snyk checks have passed. No issues have been found so far.

security/snyk check is complete. No issues have been found. (View Details)

license/snyk check is complete. No issues have been found. (View Details)

shethj and others added 6 commits June 4, 2025 10:59
…155@) (#2501)

* Sync package lock files

* Copy over commerce-sdk-react from `develop` branch

* Retail app now uses the commerce-sdk-react in monorepo

* 1st attempt at supporting the older React 17

* Downgrade retail app to use React 17

* Sync package lock files

* Commerce-sdk-react supports both React 17 and 18

* Clean up code

* Tweak comment

* Add tests

* Fix bug with changing key

* Align dependencies with commerce-sdk-react

* Debug CI error

* Revert "Debug CI error"

This reverts commit e4d36bc.

* Delete commerce-sdk-react package

* Sync package lock files

* Sync package lock files

* Restore package lock files

* Sync package lock files
@shethj shethj requested review from alexvuong and vmarta June 26, 2025 04:25
Copy link
Contributor

@vmarta vmarta left a comment

Choose a reason for hiding this comment

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

Cool, I think you're almost there.

Added a few comments. And review this one too please: #2510 (comment)

})

test('Can apply and remove product-level coupon code with promotion', async () => {
test.skip('Can apply and remove product-level coupon code with promotion', async () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Similar to Alex's previous comment, let's make sure that all of skipped tests in this PR have some comments. So we understand why they were being skipped.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed the skip from that one. That test passes fine. I was missing awaiting a few user actions.

await logout.mutateAsync();
await api.auth.ready();
await logout.mutateAsync()
await this.login()
Copy link
Contributor

Choose a reason for hiding this comment

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

Curious why this is changed to login..

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That was to re-establish a guest session after logout but turns out calling api.auth.ready() has the same effect. I reverted back to using that to keep things consistent.

Thanks for catching this.

@shethj shethj requested a review from vmarta June 27, 2025 16:26
@shethj shethj changed the base branch from feature/commerce-sdk-for-v2 to release-2.9.x July 29, 2025 16:29
@shethj shethj changed the base branch from release-2.9.x to release-2.10.x July 29, 2025 17:30
@shethj shethj merged commit 7032dc0 into release-2.10.x Jul 29, 2025
19 checks passed
@shethj shethj deleted the feature/refactor-sdk-init branch July 29, 2025 17:30
@shethj shethj mentioned this pull request Jul 29, 2025
12 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants