create-sitecore-jss 22.5.0-beta.4 → 22.5.0-beta.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/templates/nextjs-sxa/src/Layout.tsx +31 -10
- package/dist/templates/nextjs-xmcloud/src/Bootstrap.tsx +5 -2
- package/dist/templates/nextjs-xmcloud/src/lib/page-props-factory/plugins/component-themes.ts +2 -2
- package/dist/templates/nextjs-xmcloud/src/lib/page-props-factory/plugins/preview-mode.ts +11 -4
- package/package.json +2 -2
- package/dist/templates/nextjs-xmcloud/src/pages/component-library/render.tsx +0 -51
|
@@ -3,7 +3,14 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import Head from 'next/head';
|
|
6
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
Placeholder,
|
|
8
|
+
LayoutServiceData,
|
|
9
|
+
Field,
|
|
10
|
+
DesignLibrary,
|
|
11
|
+
HTMLLink,
|
|
12
|
+
RenderingType
|
|
13
|
+
} from '@sitecore-jss/sitecore-jss-nextjs';
|
|
7
14
|
import config from 'temp/config';
|
|
8
15
|
import Scripts from 'src/Scripts';
|
|
9
16
|
|
|
@@ -40,15 +47,29 @@ const Layout = ({ layoutData, headLinks }: LayoutProps): JSX.Element => {
|
|
|
40
47
|
|
|
41
48
|
{/* root placeholder for the app, which we add components to using route data */}
|
|
42
49
|
<div className={mainClassPageEditing}>
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
<% if (templates.includes('nextjs-xmcloud') || templates.includes('nextjs-sxa')) { %>
|
|
51
|
+
{layoutData.sitecore.context.renderingType === RenderingType.Component ? (
|
|
52
|
+
<DesignLibrary {...layoutData} />
|
|
53
|
+
) : (
|
|
54
|
+
<>
|
|
55
|
+
<header>
|
|
56
|
+
<div id="header">
|
|
57
|
+
{route && <Placeholder name="headless-header" rendering={route} />}
|
|
58
|
+
</div>
|
|
59
|
+
</header>
|
|
60
|
+
<main>
|
|
61
|
+
<div id="content">
|
|
62
|
+
{route && <Placeholder name="headless-main" rendering={route} />}
|
|
63
|
+
</div>
|
|
64
|
+
</main>
|
|
65
|
+
<footer>
|
|
66
|
+
<div id="footer">
|
|
67
|
+
{route && <Placeholder name="headless-footer" rendering={route} />}
|
|
68
|
+
</div>
|
|
69
|
+
</footer>
|
|
70
|
+
</>
|
|
71
|
+
)}
|
|
72
|
+
<% } %>
|
|
52
73
|
</div>
|
|
53
74
|
</>
|
|
54
75
|
);
|
|
@@ -3,7 +3,7 @@ import { SitecorePageProps } from 'lib/page-props';
|
|
|
3
3
|
import { CloudSDK } from '@sitecore-cloudsdk/core/browser';
|
|
4
4
|
import '@sitecore-cloudsdk/events/browser';
|
|
5
5
|
import config from 'temp/config';
|
|
6
|
-
import { LayoutServicePageState } from '@sitecore-jss/sitecore-jss-nextjs';
|
|
6
|
+
import { LayoutServicePageState, RenderingType } from '@sitecore-jss/sitecore-jss-nextjs';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* The Bootstrap component is the entry point for performing any initialization logic
|
|
@@ -16,7 +16,10 @@ const Bootstrap = (props: SitecorePageProps): JSX.Element | null => {
|
|
|
16
16
|
const renderingType = props.layoutData?.sitecore?.context.renderingType;
|
|
17
17
|
if (process.env.NODE_ENV === 'development')
|
|
18
18
|
console.debug('Browser Events SDK is not initialized in development environment');
|
|
19
|
-
else if (
|
|
19
|
+
else if (
|
|
20
|
+
pageState !== LayoutServicePageState.Normal ||
|
|
21
|
+
renderingType === RenderingType.Component
|
|
22
|
+
)
|
|
20
23
|
console.debug('Browser Events SDK is not initialized in edit and preview modes');
|
|
21
24
|
else {
|
|
22
25
|
CloudSDK({
|
package/dist/templates/nextjs-xmcloud/src/lib/page-props-factory/plugins/component-themes.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SitecorePageProps } from 'lib/page-props';
|
|
2
|
-
import {
|
|
2
|
+
import { getDesignLibraryStylesheetLinks } from '@sitecore-jss/sitecore-jss-nextjs';
|
|
3
3
|
import { Plugin } from '..';
|
|
4
4
|
import config from 'temp/config';
|
|
5
5
|
|
|
@@ -10,7 +10,7 @@ class ComponentThemesPlugin implements Plugin {
|
|
|
10
10
|
async exec(props: SitecorePageProps) {
|
|
11
11
|
// Collect FEAAS, BYOC, SXA component themes
|
|
12
12
|
props.headLinks.push(
|
|
13
|
-
...
|
|
13
|
+
...getDesignLibraryStylesheetLinks(
|
|
14
14
|
props.layoutData,
|
|
15
15
|
config.sitecoreEdgeContextId,
|
|
16
16
|
config.sitecoreEdgeUrl
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
} from '@sitecore-jss/sitecore-jss-nextjs';
|
|
7
7
|
import {
|
|
8
8
|
editingDataService,
|
|
9
|
-
|
|
9
|
+
isDesignLibraryPreviewData,
|
|
10
10
|
isEditingMetadataPreviewData,
|
|
11
11
|
} from '@sitecore-jss/sitecore-jss-nextjs/editing';
|
|
12
12
|
import { SitecorePageProps } from 'lib/page-props';
|
|
@@ -21,9 +21,16 @@ class PreviewModePlugin implements Plugin {
|
|
|
21
21
|
async exec(props: SitecorePageProps, context: GetServerSidePropsContext | GetStaticPropsContext) {
|
|
22
22
|
if (!context.preview) return props;
|
|
23
23
|
|
|
24
|
-
if (
|
|
25
|
-
const {
|
|
26
|
-
|
|
24
|
+
if (isDesignLibraryPreviewData(context.previewData)) {
|
|
25
|
+
const {
|
|
26
|
+
itemId,
|
|
27
|
+
componentUid,
|
|
28
|
+
site,
|
|
29
|
+
language,
|
|
30
|
+
renderingId,
|
|
31
|
+
dataSourceId,
|
|
32
|
+
version,
|
|
33
|
+
} = context.previewData;
|
|
27
34
|
|
|
28
35
|
const componentService = new RestComponentLayoutService({
|
|
29
36
|
apiHost: config.sitecoreApiHost,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-sitecore-jss",
|
|
3
|
-
"version": "22.5.0-beta.
|
|
3
|
+
"version": "22.5.0-beta.5",
|
|
4
4
|
"description": "Sitecore JSS initializer",
|
|
5
5
|
"bin": "./dist/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -65,5 +65,5 @@
|
|
|
65
65
|
"ts-node": "^10.9.1",
|
|
66
66
|
"typescript": "~5.6.3"
|
|
67
67
|
},
|
|
68
|
-
"gitHead": "
|
|
68
|
+
"gitHead": "3f27536c37ff0b5cf193dde5fb8e22020bc43b26"
|
|
69
69
|
}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { GetServerSideProps } from 'next';
|
|
2
|
-
import Head from 'next/head';
|
|
3
|
-
import {
|
|
4
|
-
ComponentLibraryLayout,
|
|
5
|
-
ComponentPropsContext,
|
|
6
|
-
SitecoreContext,
|
|
7
|
-
} from '@sitecore-jss/sitecore-jss-nextjs';
|
|
8
|
-
import { SitecorePageProps } from 'lib/page-props';
|
|
9
|
-
import { sitecorePagePropsFactory } from 'lib/page-props-factory';
|
|
10
|
-
import NotFound from 'src/NotFound';
|
|
11
|
-
import { componentBuilder } from 'temp/componentBuilder';
|
|
12
|
-
import config from 'temp/config';
|
|
13
|
-
|
|
14
|
-
const FEAASRender = ({
|
|
15
|
-
notFound,
|
|
16
|
-
componentProps,
|
|
17
|
-
layoutData,
|
|
18
|
-
headLinks,
|
|
19
|
-
}: SitecorePageProps): JSX.Element => {
|
|
20
|
-
if (notFound) {
|
|
21
|
-
return <NotFound />;
|
|
22
|
-
}
|
|
23
|
-
return (
|
|
24
|
-
<ComponentPropsContext value={componentProps}>
|
|
25
|
-
<SitecoreContext
|
|
26
|
-
componentFactory={componentBuilder.getComponentFactory()}
|
|
27
|
-
layoutData={layoutData}
|
|
28
|
-
>
|
|
29
|
-
<Head>
|
|
30
|
-
<title>Sitecore Component Library</title>
|
|
31
|
-
<link rel="icon" href={`${config.publicUrl}/favicon.ico`} />
|
|
32
|
-
{headLinks.map((headLink) => (
|
|
33
|
-
<link rel={headLink.rel} key={headLink.href} href={headLink.href} />
|
|
34
|
-
))}
|
|
35
|
-
</Head>
|
|
36
|
-
<ComponentLibraryLayout {...layoutData} />
|
|
37
|
-
</SitecoreContext>
|
|
38
|
-
</ComponentPropsContext>
|
|
39
|
-
);
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
export const getServerSideProps: GetServerSideProps = async (context) => {
|
|
43
|
-
const props = await sitecorePagePropsFactory.create(context);
|
|
44
|
-
return {
|
|
45
|
-
props,
|
|
46
|
-
// not found when page not requested through editing render api or notFound set in page-props
|
|
47
|
-
notFound: props.notFound || !context.preview,
|
|
48
|
-
};
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
export default FEAASRender;
|