Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DO NOT MERGE] POC SCAPI App Server Affinity for PWA Kit v2.x #2036

Open
wants to merge 11 commits into
base: release-2.8.x
Choose a base branch
from

Conversation

shethj
Copy link
Collaborator

@shethj shethj commented Oct 1, 2024

Description

For a Phased Launch storefront, SCAPI requires each request to contain ECOM dwsid in sfdc_dwsid header with each request.
To allow PWA Kit to read dwsid from cookies we require the cookie to be set with httpOnly=false.
Plugin SLAS manually sets response cookies and has been setting dwsid with httpOnly=false
We can leverage that cookie to be used in PWA Kit to send with each SCAPI request.

Also,
PWA Kit currently calls OCAPI /sessions which also overrides the dwsid cookie with httpOnly=true.
This PR removes the OCAPI /sessions request as it is no longer required.

See updated SLAS flows for hybrid here:
https://lucid.app/lucidchart/df562464-786e-4e16-9de5-41432a8fa9b8/edit?invitationId=inv_37b0c43d-e2f0-4858-ac5f-19b4ea37360f

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

  • Remove calls to OCAPI /sessions
  • Added sfdc_dwsid header to all requests made in commerce-api
  • Update hasSFRAAuthStateChanged logic to read access_tokens from cc-at cookie and update token in localstorage or call login if cc-at='refresh'
  • Change refresh token storage to cookieStorage instead of LocalStorage

How to Test-Drive This PR

  • Logon to www.phased-launch-testing.com
  • Clear Site Data using DevTools
  • Load Home Page
  • Open Network Tab and confirm /sessions requests are not made
  • Open Cookies and confirm dwsid is not being set
  • Add item to cart and navigate to cart page
  • Open cookies and verify dwsid is now set
  • Navigate back to PWA Kit page
  • Inspect any SCAPI request and confirm sfdc_dwsid exists in request headers

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 added the skip changelog Skip the "Changelog Check" GitHub Actions step even if the Changelog.md files are not updated label Oct 1, 2024
@shethj shethj requested a review from a team as a code owner October 1, 2024 00:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
skip changelog Skip the "Changelog Check" GitHub Actions step even if the Changelog.md files are not updated
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant