create-sitecore-jss 22.8.0-canary.15 → 22.8.0-canary.17
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 +40 -10
- package/dist/templates/nextjs-sxa/src/assets/sass/components/_component-column-splitter.scss +14 -14
- package/dist/templates/nextjs-sxa/src/assets/sass/components/promo/_promo-shadow.scss +42 -42
- package/dist/templates/nextjs-sxa/src/pages/404.tsx +8 -0
- package/dist/templates/nextjs-sxa/src/pages/500.tsx +8 -0
- package/dist/templates/nextjs-xmcloud/src/Bootstrap.tsx +6 -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 +51 -0
- package/dist/templates/react/package.json +2 -2
- package/package.json +2 -2
|
@@ -3,7 +3,16 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { JSX } from 'react';
|
|
5
5
|
import Head from 'next/head';
|
|
6
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
LayoutServiceData,
|
|
8
|
+
Field,
|
|
9
|
+
HTMLLink,
|
|
10
|
+
Placeholder,
|
|
11
|
+
<% if (templates.includes('nextjs-xmcloud')) { %>
|
|
12
|
+
DesignLibrary,
|
|
13
|
+
RenderingType,
|
|
14
|
+
<% } %>
|
|
15
|
+
} from '@sitecore-jss/sitecore-jss-nextjs';
|
|
7
16
|
import config from 'temp/config';
|
|
8
17
|
import Scripts from 'src/Scripts';
|
|
9
18
|
|
|
@@ -27,6 +36,26 @@ const Layout = ({ layoutData, headLinks }: LayoutProps): JSX.Element => {
|
|
|
27
36
|
const isPageEditing = layoutData.sitecore.context.pageEditing;
|
|
28
37
|
const mainClassPageEditing = isPageEditing ? 'editing-mode' : 'prod-mode';
|
|
29
38
|
|
|
39
|
+
const renderContent = () => (
|
|
40
|
+
<>
|
|
41
|
+
<header>
|
|
42
|
+
<div id="header">
|
|
43
|
+
{route && <Placeholder name="headless-header" rendering={route} />}
|
|
44
|
+
</div>
|
|
45
|
+
</header>
|
|
46
|
+
<main>
|
|
47
|
+
<div id="content">
|
|
48
|
+
{route && <Placeholder name="headless-main" rendering={route} />}
|
|
49
|
+
</div>
|
|
50
|
+
</main>
|
|
51
|
+
<footer>
|
|
52
|
+
<div id="footer">
|
|
53
|
+
{route && <Placeholder name="headless-footer" rendering={route} />}
|
|
54
|
+
</div>
|
|
55
|
+
</footer>
|
|
56
|
+
</>
|
|
57
|
+
);
|
|
58
|
+
|
|
30
59
|
return (
|
|
31
60
|
<>
|
|
32
61
|
<Scripts />
|
|
@@ -40,18 +69,19 @@ const Layout = ({ layoutData, headLinks }: LayoutProps): JSX.Element => {
|
|
|
40
69
|
|
|
41
70
|
{/* root placeholder for the app, which we add components to using route data */}
|
|
42
71
|
<div className={mainClassPageEditing}>
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
72
|
+
<% if (templates.includes('nextjs-xmcloud')) { %>
|
|
73
|
+
{layoutData.sitecore.context.renderingType === RenderingType.Component ? (
|
|
74
|
+
<DesignLibrary {...layoutData} />
|
|
75
|
+
) : (
|
|
76
|
+
renderContent()
|
|
77
|
+
)}
|
|
78
|
+
<% } else { %>
|
|
79
|
+
{renderContent()}
|
|
80
|
+
<% } %>
|
|
52
81
|
</div>
|
|
53
82
|
</>
|
|
54
83
|
);
|
|
55
84
|
};
|
|
56
85
|
|
|
57
86
|
export default Layout;
|
|
87
|
+
|
package/dist/templates/nextjs-sxa/src/assets/sass/components/_component-column-splitter.scss
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
@import '@sass/abstracts/vars';
|
|
2
|
-
|
|
3
|
-
.row.column-splitter {
|
|
4
|
-
margin-left: 0;
|
|
5
|
-
margin-right: 0;
|
|
6
|
-
padding-left: $default-padding * 0.5;
|
|
7
|
-
padding-right: $default-padding * 0.5;
|
|
8
|
-
max-width: none;
|
|
9
|
-
|
|
10
|
-
> div {
|
|
11
|
-
padding-left: $default-padding;
|
|
12
|
-
padding-right: $default-padding;
|
|
13
|
-
}
|
|
14
|
-
}
|
|
1
|
+
@import '@sass/abstracts/vars';
|
|
2
|
+
|
|
3
|
+
.row.column-splitter {
|
|
4
|
+
margin-left: 0;
|
|
5
|
+
margin-right: 0;
|
|
6
|
+
padding-left: $default-padding * 0.5;
|
|
7
|
+
padding-right: $default-padding * 0.5;
|
|
8
|
+
max-width: none;
|
|
9
|
+
|
|
10
|
+
> div {
|
|
11
|
+
padding-left: $default-padding;
|
|
12
|
+
padding-right: $default-padding;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -1,42 +1,42 @@
|
|
|
1
|
-
@import "@sass/abstracts/vars";
|
|
2
|
-
@import "@sass/abstracts/mixins";
|
|
3
|
-
|
|
4
|
-
.promo-shadow {
|
|
5
|
-
max-width: 960px;
|
|
6
|
-
padding: 0;
|
|
7
|
-
border-top-width: 3px;
|
|
8
|
-
border-top-color: $promo-shadow-border;
|
|
9
|
-
border-style: solid;
|
|
10
|
-
overflow: visible;
|
|
11
|
-
position: relative;
|
|
12
|
-
&.promo {
|
|
13
|
-
float: left;
|
|
14
|
-
}
|
|
15
|
-
>.component-content {
|
|
16
|
-
padding: 15px;
|
|
17
|
-
margin: 0 0 30px 0;
|
|
18
|
-
@include respond-to(all-mobile) {
|
|
19
|
-
margin: 0 10px 30px 10px;
|
|
20
|
-
}
|
|
21
|
-
&:before, &:after {
|
|
22
|
-
opacity: 0.7;
|
|
23
|
-
box-shadow: 0 17px 10px rgba(0, 0, 0, 0.7);
|
|
24
|
-
position: absolute;
|
|
25
|
-
z-index: -1;
|
|
26
|
-
height: 20%;
|
|
27
|
-
max-height: 100px;
|
|
28
|
-
max-width: 460px;
|
|
29
|
-
width: 47%;
|
|
30
|
-
content: "";
|
|
31
|
-
bottom: 10px;
|
|
32
|
-
}
|
|
33
|
-
&:before {
|
|
34
|
-
left: 2%;
|
|
35
|
-
transform: rotate(-3deg);
|
|
36
|
-
}
|
|
37
|
-
&:after {
|
|
38
|
-
right: 2%;
|
|
39
|
-
transform: rotate(3deg);
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
}
|
|
1
|
+
@import "@sass/abstracts/vars";
|
|
2
|
+
@import "@sass/abstracts/mixins";
|
|
3
|
+
|
|
4
|
+
.promo-shadow {
|
|
5
|
+
max-width: 960px;
|
|
6
|
+
padding: 0;
|
|
7
|
+
border-top-width: 3px;
|
|
8
|
+
border-top-color: $promo-shadow-border;
|
|
9
|
+
border-style: solid;
|
|
10
|
+
overflow: visible;
|
|
11
|
+
position: relative;
|
|
12
|
+
&.promo {
|
|
13
|
+
float: left;
|
|
14
|
+
}
|
|
15
|
+
>.component-content {
|
|
16
|
+
padding: 15px;
|
|
17
|
+
margin: 0 0 30px 0;
|
|
18
|
+
@include respond-to(all-mobile) {
|
|
19
|
+
margin: 0 10px 30px 10px;
|
|
20
|
+
}
|
|
21
|
+
&:before, &:after {
|
|
22
|
+
opacity: 0.7;
|
|
23
|
+
box-shadow: 0 17px 10px rgba(0, 0, 0, 0.7);
|
|
24
|
+
position: absolute;
|
|
25
|
+
z-index: -1;
|
|
26
|
+
height: 20%;
|
|
27
|
+
max-height: 100px;
|
|
28
|
+
max-width: 460px;
|
|
29
|
+
width: 47%;
|
|
30
|
+
content: "";
|
|
31
|
+
bottom: 10px;
|
|
32
|
+
}
|
|
33
|
+
&:before {
|
|
34
|
+
left: 2%;
|
|
35
|
+
transform: rotate(-3deg);
|
|
36
|
+
}
|
|
37
|
+
&:after {
|
|
38
|
+
right: 2%;
|
|
39
|
+
transform: rotate(3deg);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -22,6 +22,14 @@ const Custom404 = (props: SitecorePageProps): JSX.Element => {
|
|
|
22
22
|
<SitecoreContext
|
|
23
23
|
componentFactory={componentBuilder.getComponentFactory()}
|
|
24
24
|
layoutData={props.layoutData}
|
|
25
|
+
<% if (templates.includes('nextjs-xmcloud')) { %>
|
|
26
|
+
api={{
|
|
27
|
+
edge: {
|
|
28
|
+
contextId: config.sitecoreEdgeContextId,
|
|
29
|
+
edgeUrl: config.sitecoreEdgeUrl,
|
|
30
|
+
},
|
|
31
|
+
}}
|
|
32
|
+
<% } %>
|
|
25
33
|
>
|
|
26
34
|
<Layout layoutData={props.layoutData} headLinks={props.headLinks} />
|
|
27
35
|
</SitecoreContext>
|
|
@@ -38,6 +38,14 @@ const Custom500 = (props: SitecorePageProps): JSX.Element => {
|
|
|
38
38
|
<SitecoreContext
|
|
39
39
|
componentFactory={componentBuilder.getComponentFactory()}
|
|
40
40
|
layoutData={props.layoutData}
|
|
41
|
+
<% if (templates.includes('nextjs-xmcloud')) { %>
|
|
42
|
+
api={{
|
|
43
|
+
edge: {
|
|
44
|
+
contextId: config.sitecoreEdgeContextId,
|
|
45
|
+
edgeUrl: config.sitecoreEdgeUrl,
|
|
46
|
+
},
|
|
47
|
+
}}
|
|
48
|
+
<% } %>
|
|
41
49
|
>
|
|
42
50
|
<Layout layoutData={props.layoutData} headLinks={props.headLinks} />
|
|
43
51
|
</SitecoreContext>
|
|
@@ -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
|
|
@@ -13,9 +13,13 @@ const Bootstrap = (props: SitecorePageProps): JSX.Element | null => {
|
|
|
13
13
|
// Browser ClientSDK init allows for page view events to be tracked
|
|
14
14
|
useEffect(() => {
|
|
15
15
|
const pageState = props.layoutData?.sitecore?.context.pageState;
|
|
16
|
+
const renderingType = props.layoutData?.sitecore?.context.renderingType;
|
|
16
17
|
if (process.env.NODE_ENV === 'development')
|
|
17
18
|
console.debug('Browser Events SDK is not initialized in development environment');
|
|
18
|
-
else if (
|
|
19
|
+
else if (
|
|
20
|
+
pageState !== LayoutServicePageState.Normal ||
|
|
21
|
+
renderingType === RenderingType.Component
|
|
22
|
+
)
|
|
19
23
|
console.debug('Browser Events SDK is not initialized in edit and preview modes');
|
|
20
24
|
else {
|
|
21
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,11 +6,14 @@ import {
|
|
|
6
6
|
} from '@sitecore-jss/sitecore-jss-nextjs';
|
|
7
7
|
import {
|
|
8
8
|
editingDataService,
|
|
9
|
+
isDesignLibraryPreviewData,
|
|
9
10
|
isEditingMetadataPreviewData,
|
|
10
11
|
} from '@sitecore-jss/sitecore-jss-nextjs/editing';
|
|
11
12
|
import { SitecorePageProps } from 'lib/page-props';
|
|
12
13
|
import { graphQLEditingService } from 'lib/graphql-editing-service';
|
|
13
14
|
import { Plugin } from '..';
|
|
15
|
+
import { RestComponentLayoutService } from '@sitecore-jss/sitecore-jss-nextjs';
|
|
16
|
+
import config from 'temp/config';
|
|
14
17
|
|
|
15
18
|
class PreviewModePlugin implements Plugin {
|
|
16
19
|
order = 1;
|
|
@@ -18,6 +21,54 @@ class PreviewModePlugin implements Plugin {
|
|
|
18
21
|
async exec(props: SitecorePageProps, context: GetServerSidePropsContext | GetStaticPropsContext) {
|
|
19
22
|
if (!context.preview) return props;
|
|
20
23
|
|
|
24
|
+
if (isDesignLibraryPreviewData(context.previewData)) {
|
|
25
|
+
const {
|
|
26
|
+
itemId,
|
|
27
|
+
componentUid,
|
|
28
|
+
site,
|
|
29
|
+
language,
|
|
30
|
+
renderingId,
|
|
31
|
+
dataSourceId,
|
|
32
|
+
version,
|
|
33
|
+
mode,
|
|
34
|
+
} = context.previewData;
|
|
35
|
+
|
|
36
|
+
const componentService = new RestComponentLayoutService({
|
|
37
|
+
sitecoreEdgeContextId: config.sitecoreEdgeContextId,
|
|
38
|
+
sitecoreEdgeUrl: config.sitecoreEdgeUrl,
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
const componentData = await componentService.fetchComponentData({
|
|
42
|
+
siteName: site,
|
|
43
|
+
itemId,
|
|
44
|
+
language,
|
|
45
|
+
componentUid,
|
|
46
|
+
renderingId,
|
|
47
|
+
dataSourceId,
|
|
48
|
+
version,
|
|
49
|
+
mode,
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
if (!componentData) {
|
|
53
|
+
throw new Error(
|
|
54
|
+
`Unable to fetch editing data for preview ${JSON.stringify(context.previewData)}`
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// we can reuse editing service, fortunately
|
|
59
|
+
const dictionaryData = await graphQLEditingService.fetchDictionaryData({
|
|
60
|
+
siteName: site,
|
|
61
|
+
language,
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
props.locale = context.previewData.language;
|
|
65
|
+
props.layoutData = componentData;
|
|
66
|
+
props.headLinks = [];
|
|
67
|
+
props.dictionary = dictionaryData;
|
|
68
|
+
|
|
69
|
+
return props;
|
|
70
|
+
}
|
|
71
|
+
|
|
21
72
|
// If we're in Pages preview (editing) Metadata Edit Mode, prefetch the editing data
|
|
22
73
|
if (isEditingMetadataPreviewData(context.previewData)) {
|
|
23
74
|
const { site, itemId, language, version, variantIds, layoutKind } = context.previewData;
|
|
@@ -35,9 +35,9 @@
|
|
|
35
35
|
"graphql": "~16.8.1",
|
|
36
36
|
"graphql-tag": "~2.12.6",
|
|
37
37
|
"i18next": "^22.0.6",
|
|
38
|
-
"react": "^19.
|
|
38
|
+
"react": "^19.1.0",
|
|
39
39
|
"react-app-polyfill": "^3.0.0",
|
|
40
|
-
"react-dom": "^19.
|
|
40
|
+
"react-dom": "^19.1.0",
|
|
41
41
|
"react-helmet": "~6.1.0",
|
|
42
42
|
"react-i18next": "~12.0.0",
|
|
43
43
|
"react-router-dom": "~6.4.4",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-sitecore-jss",
|
|
3
|
-
"version": "22.8.0-canary.
|
|
3
|
+
"version": "22.8.0-canary.17",
|
|
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": "9410adbc422816647f24b8fe117d6096181e0b5a"
|
|
69
69
|
}
|