pwa-kit icon indicating copy to clipboard operation
pwa-kit copied to clipboard

issue 738 - adding back OCAPI session bridge for phased rollouts

Open sandragolden opened this issue 2 years ago • 1 comments

see issue #738

Description

Steps To Reproduce

  1. start out on pwa, add products to guest cart
  2. cart page redirects to SFRA cart page, session is successfully restored from PWA refresh token
  3. on SFRA login page, click "login" -> returns to PWA for login
  4. login via PWA
  5. return to SFRA cart page. notice that the previous guest dwsid is still set and onSession is never triggered on SFRA, resulting in a cleared guest cart. Customer is not logged in via SFRA.

Expected result

Returning to SFRA after logging in via PWA should maintain session state and cart

Current State: Notice that returning to SFRA the second time never calls onSession so the dwsid is never set from the logged in refresh token. The old dwsid from the initial session is used, resulting in an empty cart. There's no way to login via SFRA.

https://user-images.githubusercontent.com/375787/192851283-ddea313f-ecfc-4451-b984-f3f862a460b1.mov

Updated State

https://user-images.githubusercontent.com/375787/192851325-e499d233-b54b-44e5-8e73-11e5d274d4c9.mov

Types of Changes

  • [x] 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)

Changes

  • restoring previous code/ session bridge that was removed #684, required for phased rollouts. Left session bridge commented out. If this is the desired approach, we should add this line to the phased rollout documentation

How to Test-Drive This PR

  1. start out on pwa, add products to guest cart
  2. cart page redirects to SFRA cart page, session is successfully restored from PWA refresh token
  3. on SFRA login page, click "login" -> returns to PWA for login
  4. login via PWA
  5. return to SFRA cart page. notice you are correctly logged in and cart is restored.

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:

  • [x] There are no changes to UI

or...

Localization

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

sandragolden avatar Sep 28 '22 18:09 sandragolden

@johnboxall @kevinxh I'd like to get your takes on this change.

To me, the changes proposed in this PR makes sense and it's easier to implement than other options. Since the PWA Kit itself does not have any use for the session bridge, it being commented out by default makes sense. Only users who are setting up a phased launch environment should uncomment it.

If we add this change, we'll want to update our phased launch documentation to include a step to uncomment and enable the session bridge.

vcua-mobify avatar Oct 05 '22 19:10 vcua-mobify

I believe that once we merge this, we will no longer need to session bridge on the PWA side. cc @shethj

I'll come back to this PR after reviewing this.

kevinxh avatar Oct 25 '22 18:10 kevinxh

We are currently on hold due to holiday moratorium for SLAS session bridge work like this.

bfeister avatar Nov 21 '22 17:11 bfeister

@sandragolden With the SESB (Session Bridging) changes in https://github.com/SalesforceCommerceCloud/plugin_slas/releases/tag/v6.4.0 are we able to close this? cc @shethj @vcua-mobify thoughts?

bfeister avatar Feb 10 '23 14:02 bfeister

@sandragolden With the SESB (Session Bridging) changes in https://github.com/SalesforceCommerceCloud/plugin_slas/releases/tag/v6.4.0 are we able to close this? cc @shethj @vcua-mobify thoughts?

Hi @bfeister, I upgraded to plugin_slas v6.4.1 and can confirm this is still an issue with hybrid deployments. I verified the issue is present in pwa-kit v2.2.0 and v2.6.0. This fix still corrects the issue.

sandragolden avatar Feb 21 '23 23:02 sandragolden

This change has been merged in #1164.

alexvuong avatar May 04 '23 17:05 alexvuong