Integrate Page Designer with PWA Kit
With Page Designer, you can create reusable page types and component types for your Progressive Web App (PWA) Kit site. Use the no-code Page Designer visual editor in Business Manager to design, schedule, and publish Page Designer pages for your site. When integrated with a PWA Kit site, Page Designer enables the rendering of dynamic, responsive pages that use React components.
This guide explains how to configure PWA Kit so that your site can show Page Designer pages.
Before running the commands in this topic, replace any placeholders with actual values. Placeholders have this format: $PLACEHOLDER.
To integrate Page Designer with a PWA Kit site:
-
Build your site with either of these implementations:
- Composable Storefront (PWA Kit version 2.7.0 or later) for your whole site with usage of the Retail React app template
- A phased headless rollout (Storefront Reference Architecture - SFRA and PWA Kit version 2.7.0 or later with usage of the Retail React app template)
-
Create or update a SLAS public or private client. Follow the steps in Create a SLAS Client or use the registerClient API endpoint.
-
In the Scopes field, include this scope:
sfcc.shopper-experience.A SLAS private client offers several advantages over a public client. See Use a SLAS Private Client.
-
-
MRT Admin Permission: To configure the connected MRT environment in Business Manager and use headless Page Designer features, merchants need the MRT Admin permission in Account Manager.
-
Configure your MRT environment URL in Business Manager, in Administration > Sites > Manage Sites > Your Site > MRT Configuration. Page Designer uses this URL to render your PWA Kit storefront for live editing.
-
Single MRT Environment: Each Business Manager site can only have one MRT environment configured. Multiple MRT environments pointing to the same Business Manager site (n
assignment) isn't supported. -
Create your Page Designer pages in the Page Designer visual editor. See Create a Page Using the Page Designer Visual Editor.
- Required for all metadata types: Add
arch_type: "headless"to all Page Designer metadata files—pages, components, and aspect types (PDP, PLP, Search)—for headless rendering to work correctly. Without this field, Business Manager expects ISML components. - No ISML required: With headless Page Designer (
arch_type: "headless"), you only need React components, not ISML templates. This change is a major advantage, simplifying development and freeing you from maintaining parallel ISML and React implementations. - No custom JavaScript in metadata: Pages and components marked as
arch_type: "headless"don't run custom JavaScript. Only the page and component metadata (JSON) is evaluated—custom scripts are ignored. You implement all storefront logic in your PWA Kit React code—an intentional architectural change to separate concerns between the storefront (PWA Kit) and server (B2C Commerce). - You define your components as pure React components with metadata in JSON format, specifying the architecture type, attributes, and regions.
- For pages, you define metadata including the
routepath where the page is accessible. - Make sure that component metadata matches your React component's props structure.
Understanding the Page Designer architecture helps you build better components and integrate them effectively into your PWA Kit site.
Page Designer uses a hierarchical architecture with three main concepts: pages, regions, and components.
A Page is the top-level container representing a complete web page. It contains:
- Page metadata including name, description, and route
- One or more Regions that organize content
- Architecture type set to
"headless"for React-only rendering - A route path that defines where the page is accessible
In PWA Kit, you fetch page data with the usePage() hook from @salesforce/commerce-sdk-react and render it with the <Page> component.
Page Metadata Example:
Key Fields:
arch_type: "headless"- Enables React-only rendering without ISML (required for headless pages).- Set to
"headless"for PWA Kit React rendering. - Set to
"controller"or omit for traditional ISML rendering. - Supports hybrid storefronts with both ISML and headless pages, enabling incremental migration.
- Set to
route- Critical: URL path where the page is accessible. Page Designer uses this field to render your storefront in edit mode.- Static routes:
"/"for homepage,"/about"for about page - Dynamic routes with parameters:
"/product/:productId","/category/:categoryId" - Important: Make sure route parameters (
:productId,:categoryId) match the attribute IDs defined in the page's aspect type - Page Designer loads your PWA Kit storefront at this route when editing the page.
- Static routes:
region_definitions- Defines the content areas for this page.
How Page Designer Uses Routes:
When you edit a headless page in the Page Designer visual editor, Page Designer:
- Reads the
routefield from the page metadata. - Loads your PWA Kit storefront URL (configured as the connected MRT environment in Business Manager).
- Goes to the route (for example,
/,/product/123,/category/mens). - Renders your React page in an iframe for live editing.
- Uses
arch_type: "headless"to identify which components are headless.
This means:
- No special page-viewer route needed - Pages render at their actual routes.
- Non-breaking change - ISML pages without
arch_type: "headless"continue to work. - Hybrid storefronts supported - Mix ISML and headless pages during migration.
- Accurate preview - See exactly what customers see on your PWA Kit site.
Routes in Page Types:
Different page types require different route configurations:
| Page Type | Route Example | Description |
|---|---|---|
| Homepage | "/" | Static route for the main landing page |
| Content Page | "/about", "/contact" | Static routes for informational pages |
| Product Detail Page (PDP) | "/product/:productId" | Dynamic route where :productId matches the attribute ID in the PDP aspect type |
| Category/Product Listing Page (PLP) | "/category/:categoryId" | Dynamic route where :categoryId matches the attribute ID in the PLP aspect type |
| Search Results Page | "/search" | Static route for search results |
Dynamic Route Parameters:
For pages with dynamic routes (PDP, PLP), the route parameter name must match the attribute ID defined in the page's aspect type metadata:
In this example, the route parameter :productId matches the attribute definition id: "productId". When a merchant selects a product in Page Designer, the system uses this attribute to construct the correct URL for preview.
A Region is a logical content area within a page or component. Regions:
- Contain an ordered list of components.
- Are nestable within Layout components.
- Are identifiable by unique IDs (for example, 'main', 'header', 'sidebar').
- Can define maximum component limits and restrictions.
The <Region> component from @salesforce/commerce-sdk-react/components handles rendering regions and their child components.
Components are the building blocks of your page content. There are two types:
Leaf Components (Content Components):
- Render actual content (images, text, products, carousels).
- Do NOT contain nested regions.
- Have
"region_definitions": []in their metadata. - Examples: ContentCard, Hero, ProductCarousel.
- Receive their configuration as props directly from Page Designer.
Layout Components (Container Components):
- Organize other components with visual layouts (grids, columns, tabs).
- Must contain one or more nested Regions to hold child components.
- Have populated
"region_definitions"in their metadata. - Use the
<Region>component to render their nested content. - Examples: Grid, Carousel (when used as a container).
Component Metadata Example (Leaf Component):
Component Metadata Example (Layout Component):
Key Fields:
arch_type: "headless"- Required for React-only components (no ISML).group- Organizes components in Page Designer.region_definitions- Empty array for leaf components, populated for layout components.attribute_definitions- Props that will be passed to your React component.
Understanding how components are discovered, loaded, and rendered helps you debug issues and optimize performance:
- Page Load: The
<Page>component receives page data from the Shopper Experience API viausePage()hook. - Region Rendering: The
<Page>component maps over its regions and renders each using the<Region>component. - Component Discovery: For each component in a region, the
<Component>wrapper:- Looks up the React component in the registry using the component's
typeId. - Lazy-loads the component if needed (triggers React Suspense).
- Extracts component data from the Page Designer configuration.
- Looks up the React component in the registry using the component's
- Component Rendering: The resolved React component receives:
- Props matching the
attribute_definitionsfrom metadata (title, image, etc.) regions: Nested regions (for layout components only)page: Reference to the full page objectregionId: ID of the parent regiondesignMetadata: Design mode metadata (for Page Designer editor integration)
- Props matching the
The component registry dynamically loads Page Designer components on-demand using lazy imports. Instead of a simple mapping object, it uses a ComponentRegistry class that enables:
- Lazy loading: Components are only loaded when needed, reducing initial bundle size.
- Dynamic imports: Each component is registered with an importer function.
- Fallback support: Optional loading states during component load.
- Data loaders: Optional server/client data fetching functions hoisted to the page.
Registry Initialization Example:
How It Works:
- Call
initializeRegistry()once during app startup. - When a page renders, the registry checks if the component is loaded.
- If not loaded, it calls the importer function (triggers React Suspense).
- Subsequent uses of the same component are instant.
Key Benefits:
- Only components used on the page are downloaded.
- Initial page load is faster.
- Components are shared across pages (loaded one time and cached).
- Eliminates the manual management of imports in page files.
Layout components organize other components using visual layouts. They render nested regions to hold child components.
Here's an example of a layout component that shows content in a responsive grid:
Store the metadata in your cartridge at:
cartridge/experience/components/{group}/{componentId}.json
- arch_type is "headless": This tells Business Manager no ISML component is needed.
- Receive
regionsandcomponentsprop: Layout components get an array of region objects and the parent component object. - Map over regions: Each nested region is rendered using the
<Region>component. - Pass required props: Each
<Region>needs:regionId: The unique identifier for the regioncomponent: The parent component object (theRegionfinds the region data fromcomponent.regions)key: React key prop for list rendering
- Metadata region match: Make sure the
region_definitionsin your metadata match the regions your component expects.
Leaf components render actual content and do NOT contain nested regions. They're the "content" pieces that get placed inside layout components.
Here's an example of a leaf component that displays an image:
Store the metadata in your cartridge at:
cartridge/experience/components/{group}/{componentId}.json
- arch_type is "headless": No ISML component needed.
- region_definitions is empty array: Leaf components don't have nested regions.
- Attributes match props: Each
attribute_definitionbecomes a prop passed to your React component. - Define PropTypes: Always define PropTypes to match your metadata attributes.
- Supported attribute types: string, text, markup, integer, boolean, product, category, file, page, image, url, enum, custom
The older PWA Kit Page Designer implementation required ISML components. This section describes how to migrate to the new headless metadata approach, which uses React components only.
The biggest win: You no longer need ISML components. With arch_type: "headless", you only maintain React components.
| Aspect | Old PWA Kit Approach (with ISML) | New Approach |
|---|---|---|
| Component Definition | ISML + React components required | React components only |
| Metadata | Component metadata in JSON | Component metadata in JSON with arch_type: "headless" |
| Maintenance | Two implementations (ISML + React) | Single React implementation |
| Component Registry and Bundle Impact | Uses a mapping object that you configure manually to register components. All components loaded. No lazy loading. | Uses a dynamic registry to lazy load components. Only the used components are loaded (code splitting). Loading of non-critical components or resources is deferred until they're needed. |
| Dependencies | @salesforce/commerce-sdk-react | Requires @salesforce/storefront-next-runtime in PWA Kit v3.17 or later, in addition to @salesforce/commerce-sdk-react. |
| Region or Component | Basic components | Enhanced Region and Component with design mode |
| Page Routing | Manual route setup | Automatic via route field in metadata |
| Server-Side Custom JavaScript | Executed at run time | No server-side JavaScript code. All functionality is implemented in React code. |
| Preview | Preview in Page Designer shows only ISML pages. Storefront Preview needed for PWA live preview. | Page Designer can preview PWA Kit storefront. |
Add the @salesforce/storefront-next-runtime package to your project:
Update your package.json:
For each existing component in your cartridge, update the JSON metadata file to include arch_type: "headless":
Before (cartridge/experience/components/commerce_assets/photoTile.json):
After:
Required changes for each component:
- Add
"arch_type": "headless". - Add
"region_definitions": []for leaf components, or populate with regions for layout components.
For each existing page in your cartridge, update the JSON metadata to include arch_type and route:
Before (cartridge/experience/pages/homePage.json):
After:
Route examples:
- Homepage:
"route": "/" - Static pages:
"route": "/about","route": "/contact" - Product pages:
"route": "/product/:productId"(:productIdmatches the attribute ID in your aspect type) - Category pages:
"route": "/category/:categoryId"(:categoryIdmatches the attribute ID in your aspect type)
For each aspect type (PDP, PLP, Search), add arch_type:
Before (cartridge/experience/aspects/pdp.json):
After:
Replace the old manual component mapping with the new registry approach.
Remove the old mapping pattern from your page-viewer:
Create a registry file at app/page-designer/registry.js:
Update your page-viewer to use the registry:
Update your main _app/index.jsx to initialize the registry and wrap with PageDesignerProvider:
Key setup points:
- Initialize registry at module level (outside the component) so components are available during SSR.
- Pass
usidfromuseUsid()hook to the provider for session tracking. - Detect mode from URL - Page Designer passes
mode=EDITormode=PREVIEWas query parameters. - Always wrap with PageDesignerProvider - it handles both design mode and normal rendering.
Create app/components/page-designer-init/index.jsx to handle design mode behaviors:
Create app/hooks/use-global-anchor-block.js to prevent link navigation in design mode:
In app/components/_app/index.jsx, render PageDesignerInit inside the provider:
- Deploy your updated cartridge with headless metadata to your SFCC instance.
- Restart your PWA Kit development server:
- Verify in Business Manager:
- Go to Merchant Tools > Content > Components.
- Your components appear with no ISML requirement.
- Test page rendering:
- Go to your pages (homepage, PDP, PLP).
- Components render using the registry.
- Test in Page Designer:
- Open the Page Designer visual editor.
- Edit a page - your PWA Kit site shows in the preview.
- Drag components - changes show immediately.
Challenge: Custom JavaScript no longer runs
Solution: Headless components (arch_type: "headless") do not run custom JavaScript from Page Designer metadata. Migrate all custom logic to your React components. This approach is intentional—it separates storefront logic (PWA Kit React) from content configuration (Business Manager JSON).
Example:
Challenge: Forgetting to set arch_type: "headless"
Solution: Always include "arch_type": "headless" in your metadata. Otherwise, Business Manager expects ISML components.
Challenge: Metadata attributes don't match React props
Solution: Ensure every attribute_definition id matches a prop name in your React component. Use PropTypes to validate.
Challenge: Component typeId mismatch
Solution: The typeId format is {group}.{componentId}. In your registry, use the same format: 'odyssey_base.myComponent': MyComponent
Challenge: Layout component regions not rendering
Solution: Ensure that your metadata includes region_definitions and your React component maps over the regions prop with <Region> components.
Challenge: Page route not working
Solution: For page metadata, include the route field with the URL path (for example, "route": "/" for homepage).
Challenge: Region not found
Solution: Verify regionId matches the region ID in your page data. For nested regions, pass component not page. Use errorElement prop to handle missing regions gracefully.
Challenge: Visual editing not working
Solution: Ensure PageDesignerProvider wraps your content. Verify targetOrigin matches your Business Manager URL. Check browser console for postMessage errors.
The updated Page Designer implementation includes several new features for enhanced visual editing support.
Components now receive designMetadata with information for visual editing:
Components also receive additional props:
component- The full component data objectregionId- The parent region's ID
You don't need to use these props, but they're available if needed for custom behavior.
Use the usePageDesignerMode hook to conditionally render content based on design mode:
Or use the utility functions for checking outside of React components:
The Page component no longer requires a components prop. Components are now resolved via the registry.
| Before | After |
|---|---|
<Page page={data} components={map} /> | <Page page={data} /> |
Required components prop | Components from registry |
Used PageContext internally | No context needed |
The Region component API has changed to support nested regions in layout components:
| Before | After |
|---|---|
<Region region={regionObj} /> | <Region component={comp} regionId="main" /> |
| Received region object directly | Finds region by ID from component |
| No fallback support | fallbackElement and errorElement props |
New Region Props:
The Component is now internal and uses the registry. You don't interact with it directly.
| Before | After |
|---|---|
Used usePageContext() for component map | Uses registry.getComponent() |
Wrapped in <div className="component"> | No wrapper div |
| Synchronous rendering | Suspense-based lazy loading |
Here's a consolidated before/after example showing the full transformation:
Before (Old API):
After (New API):
Follow these steps to set up Page Designer in a new PWA Kit project.
Create app/page-designer/registry.js to register your components with lazy loading:
Update app/components/_app/index.jsx to initialize Page Designer:
Create app/components/page-designer-init/index.jsx:
Create app/hooks/use-global-anchor-block.js:
With this setup:
- Your existing routes work automatically - No special page-viewer route needed
- Page Designer loads your actual routes - When you edit a page with
"route": "/", Page Designer loads your homepage at/ - Live editing - Changes in Page Designer's visual editor appear instantly in your PWA Kit storefront
- Hybrid support - Mix headless and ISML pages during migration
Example: If you create a homepage with:
Page Designer:
- Loads your PWA Kit site's homepage (
/). - Renders it in an iframe for editing.
- Applies changes in real-time.
- GitHub: Page Designer Repo for PWA Kit
- Salesforce Help: Page Designer Pages