-
Notifications
You must be signed in to change notification settings - Fork 275
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[XM Cloud][Next.js] Editing Configuration Endpoint #1724
Conversation
…s; modify component builder codegen to export components
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good.
Please add an appropriate title to the PR.
See some comments.
packages/sitecore-jss-nextjs/src/editing/editing-config-middleware.ts
Outdated
Show resolved
Hide resolved
packages/sitecore-jss-nextjs/src/editing/editing-config-middleware.test.ts
Show resolved
Hide resolved
packages/create-sitecore-jss/src/templates/nextjs/scripts/generate-metadata.ts
Show resolved
Hide resolved
import { getJssEditingSecret } from '../utils/utils'; | ||
import { debug } from '@sitecore-jss/sitecore-jss'; | ||
|
||
interface Metadata { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This interface should be exported / shared with the metadata generation
packages/create-sitecore-jss/src/templates/nextjs/scripts/generate-metadata.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, just one minor adjustment suggested.
const metadata: Metadata = { packages: {} }; | ||
metadata.packages = getPackagesMetadata(); | ||
writeMetadata(metadata); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would switch our SDK function to be a getMetadata()
function which returns Metadata
(shouldn't have any knowledge of "packages" here in the app layer). This way, if we add anything to metadata in the future, there is nothing in the app layer to update.
const metadata: Metadata = { packages: {} }; | |
metadata.packages = getPackagesMetadata(); | |
writeMetadata(metadata); | |
const metadata = getMetadata(); | |
writeMetadata(metadata); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. 👍🏼
The commented functionality has been tested and works ok :)
Description / Motivation
This PR introduces a protected endpoint in the xmcloud addon -
/api/editing/config?secret=[jss-editing-secret]
. The endpoint provides configuration information (the sitecore packages used by the app and all registered components) to be used to determine feature compatibility on pages side.Includes:
Testing Details
Types of changes