[nextjs][content] Support time-based preview in editing render endpoint#524
Conversation
🦋 Changeset detectedLatest commit: 0ef3b03 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
📦 Package Size and Test Coverage Report
|
illiakovalenko
left a comment
There was a problem hiding this comment.
Looks good 👍
Please, see a couple of comments below
| [EDITING_PARAMS_HEADER]: JSON.stringify(previewData), | ||
| }; | ||
|
|
||
| if (query.sc_previewTime) { |
There was a problem hiding this comment.
We have mapEditingParams method, you can map this parameter there
| sc_layoutKind?: LayoutKind; | ||
| sc_variant?: string; | ||
| sc_version?: string; | ||
| sc_previewTime?: string; |
There was a problem hiding this comment.
The new parameter needs to be passed to EditingService.fetchEditingData, so that it is included in the layout request.
There was a problem hiding this comment.
It should be set as a sc_previewTime header
| [EDITING_PARAMS_HEADER]: JSON.stringify(previewData), | ||
| }; | ||
|
|
||
| if (query.sc_previewTime) { |
There was a problem hiding this comment.
Also, keep in mind that we have editing-render-route-handler - App Router. You, probably, shouldn't need to make any additional changes there, as updating the mapEditingParams method should apply this automatically. Probably only unit tests
…nterfaces for enhanced preview functionality
| dataSourceId: query.dataSourceId, | ||
| version: query.sc_version, | ||
| generation: query.generation, | ||
| ...(query.sc_previewTime && { previewTime: query.sc_previewTime }), |
There was a problem hiding this comment.
In design studio we don't expect to pass it, so let's remove it. We need to support it only for Sitecore Pages
| mode, | ||
| site, | ||
| variantId, | ||
| ...(previewTime && { previewTime }), |
There was a problem hiding this comment.
Can we simplify it a bit?
| ...(previewTime && { previewTime }), | |
| previewTime, |
There was a problem hiding this comment.
Let's add unit tests to cover new parameter
There was a problem hiding this comment.
Let's update unit tests
…nt, EditingService, and utility functions
…/github.com/Sitecore/content-sdk into feature/JSS-9801-support-time-based-preview
…PreviewData interface
9ebc7bd to
0ef3b03
Compare
Description / Motivation
This PR adds support for calendar-based preview in the JSS editing render endpoint. The editing middleware now accepts an optional
sc_previewTimequery parameter and forwards it as a header to Edge Preview GraphQL.This enables XM Cloud Pages users to preview content at specific future dates, allowing validation of scheduled content changes before they go live.
Testing Details
Unit Tests:
sc_previewTimequery param is forwarded as headersc_previewTimeis absentManual Testing:
sc_previewTimeparameterTypes of changes