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
284 stars 134 forks source link

[FEATURE] OCAPI has a way to get the content of Page designer? #696

Closed zero-luo closed 2 years ago

zero-luo commented 2 years ago

We want to use PWA kit to refactor the website; but we now have a problem, OCAPI does not provide an interface to get the content of Page designer.

We tried to use the PageMgr.serializePage(page.ID, null) method, but found an error

Can't compile script '[DEBUGGER EXPR: ]'

wainclude url="/on/demandware.store/Sites-xxx-xxx-Site/en/SYSTEMPage-Include?cid=homepage&params=%7b%22custom%22%3a%22%22%2c%22aspect_attributes%22%3anull%7d&ot=JSON"

image

The existing website uses the SFRA framework, and the home page of the website about us and the FAQ page are all created using Page designer, and customers have been using Page designer to manage and maintain pages. We can't abandon Page designer.

Is there any way to solve the compatibility problem between PWA kit and Page designer

petarm commented 2 years ago

Hello, this code works for us: `var PageMgr = require('dw/experience/PageMgr'); var CatalogMgr = require('dw/catalog/CatalogMgr');

/**

serialize.public = true; exports.Serialize = serialize;`

And you can call it: PageDesigner-Serialize?pageIds=homepage-example

zero-luo commented 2 years ago

@petarm

OH MAN!

We used the method you provided and finally got the PageDesigner json data;

Thank you very much;

image