SalesforceCommerceCloud / pwa-kit

React-based JavaScript frontend framework to create a progressive web app (PWA) storefront for Salesforce B2C Commerce.
https://developer.salesforce.com/docs/commerce/pwa-kit-managed-runtime/guide/pwa-kit-overview.html
BSD 3-Clause "New" or "Revised" License
276 stars 126 forks source link

Session Bridge in PWA, How can we have hybrid storefront #1633

Open Mohansharu opened 6 months ago

Mohansharu commented 6 months ago

Hi,

I'm trying to have a home page in SFRA and a few pages in PWA like a hybrid. I have referred this document https://developer.salesforce.com/docs/commerce/pwa-kit-managed-runtime/guide/phased-headless-rollouts.html, but still, I'm not getting how to achieve this do we need to deploy PWA to MRT to see changes?

I have cloned the repo that they mentioned in the doc and I'm using the latest PWA version in the cartridge path I have followed what they have mentioned. How can we do this? and also how to check please provide some info regarding this or share some documents that might be useful.

agurumurthy96 commented 6 months ago

Have you gone through this portion in the documentation link that you shared? https://developer.salesforce.com/docs/commerce/pwa-kit-managed-runtime/guide/phased-headless-rollouts.html#set-up-phased-rollouts-locally-sig-instances

You do not need to deploy it on MRT, and can use the hybrid dev server as a reverse proxy to test on localhost. https://github.com/SalesforceCommerceCloud/composable-hybrid-dev-server

Mohansharu commented 6 months ago

Hi @agurumurthy96

I'm trying to make these changes in local and also to have a homepage in PWA rest of all modules in SFRA, how to achieve this in refArch? https://developer.salesforce.com/docs/commerce/pwa-kit-managed-runtime/guide/phased-headless-rollouts.html. I have followed this document like having the SLAS plugin cartridge in the workspace as well as the base cartridge in the repo and have updated the cartridge path as mentioned in the doc. also, I have created the SLAS ID in BM by specifying the scope they mentioned. Since I have the version 3 or greater PWA code base, I have not done any code changes in the auth.js file which they specified clearly in the doc. what needs to be done in routes exactly? and also I have tried with extensibility as well using overrides but still no luck, once after i followed the above doc steps when I run PWA storefront added product to cart if I click on cart page it's showing like below

image

after this what do we need to do here I have been stuck here, If I see a storefront one tab in PWA and another one in SFRA both work independently there is no relation between them after doing all the changes. Am I missing anything please help me

bendvc commented 6 months ago

@Mohansharu If you are hoping to be doing local development for a hybrid please take a look at this project that was specifically made for that purpose.

Mohansharu commented 6 months ago

Hi @bendvc, I have referred to this cartridge and followed the steps, whenever I run localhost 8001 which is our hybrid server it shows PWA storefront when I add the product to the cart according to code it should render cart and checkout page in SFRA based on below code

image

it's working as expected but when it comes to 'cart' SFRA storefront when I click on the salesforce logo which is nothing but the home page it's navigating to the SFRA home page. It needs to navigate to the PWA home page right?

bendvc commented 5 months ago

Hey @Mohansharu .. so from what I'm hearing you are successfully making the transition from PWA-Kit to SFRA for checkout, but you are expecting that clicking the home button will bring you back to PWA-Kit home, and not SFRA home?

I'm going to loop in the dev (@sandragolden) of the project I previously mentioned to get her take on it since I'm not super familiar with it.

athik88 commented 5 months ago

Hi @Mohansharu We are tracking this request through cases: [46081299] and [46061053] For the request sfra to pwa transition, you need to configure redirect rules in BM (Merchant Tools > SEO > URL Redirects) We can connect tomorrow as per support case 46081299 and discuss Thanks

sandragolden commented 5 months ago

@bendvc @Mohansharu I use the plugin_redirect cartridge to handle these cases. As you can see, mine does redirect back to cart through the use of plugin_redirect

Mohansharu commented 5 months ago

@sandragolden @bendvc plugin_redirect worked for SFRA and was able to redirect back to PWA and even @athik88 told how we can specify SEO redirects to navigate to category pages from SFRA to PWA storefront. Thanks for the help and suggestion.

If we want to navigate to different categories from SFRA to PWA do we need to specify SEO URL redirects for individual categories or can we specify all categories in one shot?