@W-18568104@: Integrate commerce-sdk-react with v2#2510
@W-18568104@: Integrate commerce-sdk-react with v2#2510shethj merged 91 commits intorelease-2.10.xfrom
Conversation
Co-authored-by: Adam Raya <adamraya@users.noreply.github.com> Signed-off-by: Jainam Sheth <99490559+shethj@users.noreply.github.com>
🎉 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) |
…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
vmarta
left a comment
There was a problem hiding this comment.
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 () => { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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() |
There was a problem hiding this comment.
Curious why this is changed to login..
There was a problem hiding this comment.
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.
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-reactonce the package is released.Types of Changes
Changes
How to Test-Drive This PR
git clean -dxffrom monorepo rootnpm installfrom monorepo rootpackages/template-retail-react-appnpm startnpm run testlocally and make sure the tests pass. This will not work in CI until I merge the bug fix for auth init.Checklists
General
Accessibility Compliance
You must check off all items in one of the follow two lists:
or...
Localization