create-sitecore-jss 22.7.0-canary.1 → 22.7.0-canary.10
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/angular-xmcloud/package.json +2 -2
- package/dist/templates/nextjs/package.json +8 -21
- package/dist/templates/nextjs/scripts/templates/component-src.ts +1 -0
- package/dist/templates/nextjs/src/Bootstrap.tsx +1 -0
- package/dist/templates/nextjs/src/Layout.tsx +1 -1
- package/dist/templates/nextjs/src/Navigation.tsx +1 -0
- package/dist/templates/nextjs/src/NotFound.tsx +1 -0
- package/dist/templates/nextjs/src/Scripts.tsx +2 -0
- package/dist/templates/nextjs/src/components/ContentBlock.tsx +1 -0
- package/dist/templates/nextjs/src/lib/next-config/plugins/monorepo.js +2 -2
- package/dist/templates/nextjs/src/pages/404.tsx +1 -0
- package/dist/templates/nextjs/src/pages/[[...path]].tsx +1 -1
- package/dist/templates/nextjs/src/pages/_app.tsx +1 -0
- package/dist/templates/nextjs/src/temp/gitignore +0 -1
- package/dist/templates/nextjs/tsconfig.json +0 -1
- package/dist/templates/nextjs-styleguide/graphql.d.ts +5 -0
- package/dist/templates/nextjs-styleguide/package.json +3 -1
- package/dist/templates/nextjs-styleguide/src/Navigation.tsx +1 -0
- package/dist/templates/nextjs-styleguide/src/components/fields/Styleguide-FieldUsage-Checkbox.tsx +1 -0
- package/dist/templates/nextjs-styleguide/src/components/fields/Styleguide-FieldUsage-ContentList.tsx +1 -0
- package/dist/templates/nextjs-styleguide/src/components/fields/Styleguide-FieldUsage-Custom.tsx +1 -0
- package/dist/templates/nextjs-styleguide/src/components/fields/Styleguide-FieldUsage-Date.tsx +1 -0
- package/dist/templates/nextjs-styleguide/src/components/fields/Styleguide-FieldUsage-File.tsx +1 -0
- package/dist/templates/nextjs-styleguide/src/components/fields/Styleguide-FieldUsage-Image.tsx +1 -0
- package/dist/templates/nextjs-styleguide/src/components/fields/Styleguide-FieldUsage-ItemLink.tsx +1 -0
- package/dist/templates/nextjs-styleguide/src/components/fields/Styleguide-FieldUsage-Link.tsx +1 -0
- package/dist/templates/nextjs-styleguide/src/components/fields/Styleguide-FieldUsage-Number.tsx +1 -0
- package/dist/templates/nextjs-styleguide/src/components/fields/Styleguide-FieldUsage-RichText.tsx +1 -0
- package/dist/templates/nextjs-styleguide/src/components/fields/Styleguide-FieldUsage-Text.tsx +1 -0
- package/dist/templates/nextjs-styleguide/src/components/graphql/GraphQL-ConnectedDemo.dynamic.tsx +59 -16
- package/dist/templates/nextjs-styleguide/src/components/graphql/GraphQL-IntegratedDemo.tsx +2 -3
- package/dist/templates/nextjs-styleguide/src/components/graphql/GraphQL-Layout.tsx +5 -1
- package/dist/templates/nextjs-styleguide/src/components/styleguide/Styleguide-ComponentParams.tsx +1 -0
- package/dist/templates/nextjs-styleguide/src/components/styleguide/Styleguide-CustomRouteType.tsx +2 -3
- package/dist/templates/nextjs-styleguide/src/components/styleguide/Styleguide-EditFrame.tsx +1 -0
- package/dist/templates/nextjs-styleguide/src/components/styleguide/Styleguide-Layout-Reuse.tsx +1 -0
- package/dist/templates/nextjs-styleguide/src/components/styleguide/Styleguide-Layout-Tabs-Tab.tsx +4 -1
- package/dist/templates/nextjs-styleguide/src/components/styleguide/Styleguide-Layout-Tabs.tsx +4 -3
- package/dist/templates/nextjs-styleguide/src/components/styleguide/Styleguide-Layout.tsx +1 -0
- package/dist/templates/nextjs-styleguide/src/components/styleguide/Styleguide-Multilingual.tsx +1 -0
- package/dist/templates/nextjs-styleguide/src/components/styleguide/Styleguide-RouteFields.tsx +1 -0
- package/dist/templates/nextjs-styleguide/src/components/styleguide/Styleguide-Section.tsx +1 -0
- package/dist/templates/nextjs-styleguide/src/components/styleguide/Styleguide-SitecoreContext.tsx +1 -0
- package/dist/templates/nextjs-styleguide/src/components/styleguide/Styleguide-Specimen.tsx +1 -0
- package/dist/templates/{nextjs → nextjs-styleguide}/src/lib/next-config/plugins/graphql.js +2 -14
- package/dist/templates/nextjs-styleguide/src/pages/_app.tsx +1 -0
- package/dist/templates/nextjs-styleguide-tracking/src/Navigation.tsx +1 -0
- package/dist/templates/nextjs-styleguide-tracking/src/Scripts.tsx +1 -0
- package/dist/templates/nextjs-styleguide-tracking/src/components/styleguide/Styleguide-Tracking.tsx +7 -7
- package/dist/templates/nextjs-sxa/scripts/templates/component-src.ts +1 -1
- package/dist/templates/nextjs-sxa/src/Layout.tsx +1 -1
- package/dist/templates/nextjs-sxa/src/assets/sass/components/_component-column-splitter.scss +2 -2
- package/dist/templates/nextjs-sxa/src/assets/sass/components/promo/_promo-shadow.scss +2 -2
- package/dist/templates/nextjs-sxa/src/components/ColumnSplitter.tsx +1 -1
- package/dist/templates/nextjs-sxa/src/components/Container.tsx +1 -1
- package/dist/templates/nextjs-sxa/src/components/Image.tsx +1 -1
- package/dist/templates/nextjs-sxa/src/components/LinkList.tsx +1 -1
- package/dist/templates/nextjs-sxa/src/components/Navigation.tsx +1 -1
- package/dist/templates/nextjs-sxa/src/components/PageContent.tsx +1 -1
- package/dist/templates/nextjs-sxa/src/components/PartialDesignDynamicPlaceholder.tsx +1 -1
- package/dist/templates/nextjs-sxa/src/components/Promo.tsx +1 -1
- package/dist/templates/nextjs-sxa/src/components/RichText.tsx +1 -1
- package/dist/templates/nextjs-sxa/src/components/RowSplitter.tsx +1 -1
- package/dist/templates/nextjs-sxa/src/components/Title.tsx +1 -1
- package/dist/templates/nextjs-sxa/src/lib/next-config/plugins/sass.js +3 -0
- package/dist/templates/nextjs-sxa/src/pages/404.tsx +1 -0
- package/dist/templates/nextjs-sxa/src/pages/500.tsx +1 -0
- package/dist/templates/nextjs-sxa/src/pages/_app.tsx +1 -0
- package/dist/templates/nextjs-xmcloud/package.json +2 -2
- package/dist/templates/nextjs-xmcloud/scripts/templates/byoc-component-src.ts +1 -1
- package/dist/templates/nextjs-xmcloud/src/Bootstrap.tsx +1 -1
- package/dist/templates/nextjs-xmcloud/src/Scripts.tsx +1 -0
- package/dist/templates/nextjs-xmcloud/src/byoc/index.tsx +1 -1
- package/dist/templates/nextjs-xmcloud/src/components/CdpPageView.tsx +1 -0
- package/dist/templates/nextjs-xmcloud/src/components/FEAASScripts.tsx +1 -0
- package/dist/templates/nextjs-xmcloud/src/pages/[[...path]].tsx +1 -1
- package/dist/templates/nextjs-xmcloud/src/pages/feaas/render.tsx +1 -0
- package/dist/templates/react/package.json +3 -3
- package/package.json +2 -2
- package/dist/templates/nextjs/.graphql-let.yml +0 -8
- package/dist/templates/nextjs/scripts/fetch-graphql-introspection-data.ts +0 -46
- package/dist/templates/nextjs/src/temp/GraphQLIntrospectionResult.json +0 -22216
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
"prepare:proxy-build": "ts-node --project src/tsconfig.webpack-server.json ./scripts/proxy-build.ts"
|
|
9
9
|
},
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"@sitecore-cloudsdk/core": "^0.5.
|
|
12
|
-
"@sitecore-cloudsdk/events": "^0.5.
|
|
11
|
+
"@sitecore-cloudsdk/core": "^0.5.1",
|
|
12
|
+
"@sitecore-cloudsdk/events": "^0.5.1",
|
|
13
13
|
"font-awesome": "^4.7.0",
|
|
14
14
|
"sass": "^1.52.3",
|
|
15
15
|
"sass-alias": "^1.0.5"
|
|
@@ -26,28 +26,18 @@
|
|
|
26
26
|
"license": "Apache-2.0",
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@sitecore-jss/sitecore-jss-nextjs": "<%- version %>",
|
|
29
|
-
"
|
|
30
|
-
"graphql-tag": "^2.12.6",
|
|
31
|
-
"next": "^14.2.18",
|
|
29
|
+
"next": "^15.3.1",
|
|
32
30
|
"next-localization": "^0.12.0",
|
|
33
|
-
"react": "^
|
|
34
|
-
"react-dom": "^
|
|
31
|
+
"react": "^19.1.0",
|
|
32
|
+
"react-dom": "^19.1.0",
|
|
35
33
|
"sharp": "0.32.6"
|
|
36
34
|
},
|
|
37
35
|
"devDependencies": {
|
|
38
|
-
"@graphql-codegen/cli": "^5.0.0",
|
|
39
|
-
"@graphql-codegen/import-types-preset": "^3.0.0",
|
|
40
|
-
"@graphql-codegen/plugin-helpers": "^5.0.1",
|
|
41
|
-
"@graphql-codegen/typed-document-node": "^5.0.1",
|
|
42
|
-
"@graphql-codegen/typescript": "^4.0.1",
|
|
43
|
-
"@graphql-codegen/typescript-operations": "^4.0.1",
|
|
44
|
-
"@graphql-codegen/typescript-resolvers": "^4.0.1",
|
|
45
|
-
"@graphql-typed-document-node/core": "^3.2.0",
|
|
46
36
|
"@sitecore-jss/sitecore-jss-cli": "<%- version %>",
|
|
47
37
|
"@sitecore-jss/sitecore-jss-dev-tools": "<%- version %>",
|
|
48
38
|
"@types/node": "^22.9.0",
|
|
49
|
-
"@types/react": "^
|
|
50
|
-
"@types/react-dom": "^
|
|
39
|
+
"@types/react": "^19.1.2",
|
|
40
|
+
"@types/react-dom": "^19.1.3",
|
|
51
41
|
"@typescript-eslint/eslint-plugin": "^8.14.0",
|
|
52
42
|
"@typescript-eslint/parser": "^8.14.0",
|
|
53
43
|
"chalk": "~4.1.2",
|
|
@@ -59,22 +49,19 @@
|
|
|
59
49
|
"eslint-config-next": "^13.1.5",
|
|
60
50
|
"eslint-config-prettier": "^8.6.0",
|
|
61
51
|
"eslint-plugin-prettier": "^4.2.1",
|
|
62
|
-
"eslint-plugin-react": "^7.
|
|
52
|
+
"eslint-plugin-react": "^7.37.5",
|
|
63
53
|
"eslint-plugin-yaml": "^0.5.0",
|
|
64
|
-
"graphql-let": "^0.18.6",
|
|
65
54
|
"npm-run-all": "~4.1.5",
|
|
66
55
|
"prettier": "^2.8.3",
|
|
67
56
|
"ts-node": "^10.9.1",
|
|
68
57
|
"tsconfig-paths": "^4.1.2",
|
|
69
|
-
"typescript": "~5.4.0"
|
|
70
|
-
"yaml-loader": "^0.8.0"
|
|
58
|
+
"typescript": "~5.4.0"
|
|
71
59
|
},
|
|
72
60
|
"scripts": {
|
|
73
61
|
"jss": "jss",
|
|
74
62
|
"lint": "eslint ./src/**/*.tsx ./src/**/*.ts ./scripts/**/*.ts",
|
|
75
|
-
"bootstrap": "ts-node --require dotenv-flow/config --project tsconfig.scripts.json scripts/bootstrap.ts
|
|
63
|
+
"bootstrap": "ts-node --require dotenv-flow/config --project tsconfig.scripts.json scripts/bootstrap.ts",
|
|
76
64
|
"build": "cross-env NODE_ENV=production npm-run-all --serial bootstrap next:build",
|
|
77
|
-
"graphql:update": "ts-node --project tsconfig.scripts.json ./scripts/fetch-graphql-introspection-data.ts",
|
|
78
65
|
"next:build": "next build",
|
|
79
66
|
"next:dev": "cross-env NODE_OPTIONS='--inspect' next dev",
|
|
80
67
|
"next:start": "next start",
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
function generateComponentSrc(componentName: string): string {
|
|
7
7
|
return `import { Text, Field, withDatasourceCheck } from '@sitecore-jss/sitecore-jss-nextjs';
|
|
8
8
|
import { ComponentProps } from 'lib/component-props';
|
|
9
|
+
import { JSX } from 'react';
|
|
9
10
|
|
|
10
11
|
type ${componentName}Props = ComponentProps & {
|
|
11
12
|
fields: {
|
|
@@ -5,7 +5,7 @@ const monorepoPlugin = (nextConfig = {}) => {
|
|
|
5
5
|
return Object.assign({}, nextConfig, {
|
|
6
6
|
webpack: (config, options) => {
|
|
7
7
|
if (options.isServer) {
|
|
8
|
-
config.externals = ['
|
|
8
|
+
config.externals = ['vertx', ...config.externals];
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
// Overload the Webpack config if it was already overloaded
|
|
@@ -14,7 +14,7 @@ const monorepoPlugin = (nextConfig = {}) => {
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
return config;
|
|
17
|
-
}
|
|
17
|
+
},
|
|
18
18
|
});
|
|
19
19
|
};
|
|
20
20
|
|
|
@@ -5,7 +5,9 @@
|
|
|
5
5
|
},
|
|
6
6
|
"devDependencies": {
|
|
7
7
|
"@sitecore-jss/sitecore-jss-dev-tools": "<%- version %>",
|
|
8
|
-
"@types/nprogress": "^0.2.0"
|
|
8
|
+
"@types/nprogress": "^0.2.0",
|
|
9
|
+
"graphql": "^16.11.0",
|
|
10
|
+
"graphql-tag": "^2.12.6"
|
|
9
11
|
},
|
|
10
12
|
"scripts": {
|
|
11
13
|
"start": "cross-env NODE_ENV=development JSS_MODE=disconnected \"npm-run-all --serial bootstrap --parallel next:dev start:disconnected-proxy start:watch-components\"",
|
package/dist/templates/nextjs-styleguide/src/components/graphql/GraphQL-ConnectedDemo.dynamic.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useEffect } from 'react';
|
|
1
|
+
import React, { JSX, useEffect } from 'react';
|
|
2
2
|
import {
|
|
3
3
|
Text,
|
|
4
4
|
Link,
|
|
@@ -8,24 +8,67 @@ import {
|
|
|
8
8
|
withDatasourceCheck,
|
|
9
9
|
} from '@sitecore-jss/sitecore-jss-nextjs';
|
|
10
10
|
import { GraphQLRequestClient } from '@sitecore-jss/sitecore-jss-nextjs/graphql';
|
|
11
|
-
import {
|
|
12
|
-
resetEditorChromes
|
|
13
|
-
} from '@sitecore-jss/sitecore-jss-nextjs/utils';
|
|
11
|
+
import { resetEditorChromes } from '@sitecore-jss/sitecore-jss-nextjs/utils';
|
|
14
12
|
import NextLink from 'next/link';
|
|
15
|
-
import
|
|
16
|
-
import {
|
|
17
|
-
<%- helper.getAppPrefix(appPrefix, appName, false) %>AppRoute as AppRoute,
|
|
18
|
-
Item,
|
|
19
|
-
<%- helper.getAppPrefix(appPrefix, appName, false) %>GraphQlConnectedDemo as GrapQLConnectedDemoDatasource,
|
|
20
|
-
} from 'graphql-types';
|
|
13
|
+
import ConnectedDemoQuery from './GraphQL-ConnectedDemo.dynamic.graphql';
|
|
21
14
|
import { ComponentProps } from 'lib/component-props';
|
|
22
15
|
import config from 'temp/config';
|
|
23
16
|
|
|
24
|
-
type
|
|
17
|
+
type GraphQLConnectedDemoDataSource = {
|
|
18
|
+
sample1: {
|
|
19
|
+
jsonValue: {
|
|
20
|
+
value: string;
|
|
21
|
+
};
|
|
22
|
+
value: string;
|
|
23
|
+
};
|
|
24
|
+
sample2: {
|
|
25
|
+
definition: {
|
|
26
|
+
type: string;
|
|
27
|
+
shared: boolean;
|
|
28
|
+
};
|
|
29
|
+
jsonValue: {
|
|
30
|
+
value: {
|
|
31
|
+
href: string;
|
|
32
|
+
linktype: string;
|
|
33
|
+
target: string;
|
|
34
|
+
text: string;
|
|
35
|
+
url: string;
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
target: string;
|
|
39
|
+
text: string;
|
|
40
|
+
url: string;
|
|
41
|
+
};
|
|
42
|
+
name: string;
|
|
43
|
+
id: string;
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
type Item = {
|
|
47
|
+
id: string;
|
|
48
|
+
url: {
|
|
49
|
+
path: string;
|
|
50
|
+
};
|
|
51
|
+
pageTitle: {
|
|
52
|
+
value: string;
|
|
53
|
+
jsonValue: {
|
|
54
|
+
value: string;
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
type ItemSearchResults = {
|
|
60
|
+
results: Item[];
|
|
61
|
+
};
|
|
25
62
|
|
|
26
63
|
type GraphQLConnectedDemoData = {
|
|
27
|
-
datasource:
|
|
28
|
-
contextItem:
|
|
64
|
+
datasource: GraphQLConnectedDemoDataSource;
|
|
65
|
+
contextItem: {
|
|
66
|
+
id: string;
|
|
67
|
+
children: ItemSearchResults;
|
|
68
|
+
pageTitle: {
|
|
69
|
+
value: string;
|
|
70
|
+
};
|
|
71
|
+
};
|
|
29
72
|
};
|
|
30
73
|
|
|
31
74
|
type GraphQLConnectedDemoProps = ComponentProps & GraphQLConnectedDemoData;
|
|
@@ -82,7 +125,7 @@ const GraphQLConnectedDemo = (props: GraphQLConnectedDemoProps): JSX.Element =>
|
|
|
82
125
|
children:
|
|
83
126
|
<ul>
|
|
84
127
|
{props.contextItem.children.results.map((child) => {
|
|
85
|
-
const routeItem = child as
|
|
128
|
+
const routeItem = child as Item;
|
|
86
129
|
|
|
87
130
|
return (
|
|
88
131
|
<li key={routeItem.id}>
|
|
@@ -115,7 +158,7 @@ export const getStaticProps: GetStaticComponentProps = async (rendering, layoutD
|
|
|
115
158
|
|
|
116
159
|
const result = await graphQLClient.request<GraphQLConnectedDemoData>(
|
|
117
160
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
118
|
-
|
|
161
|
+
ConnectedDemoQuery,
|
|
119
162
|
{
|
|
120
163
|
datasource: rendering.dataSource,
|
|
121
164
|
contextItem: layoutData?.sitecore?.route?.itemId,
|
|
@@ -143,7 +186,7 @@ export const getServerSideProps: GetServerSideComponentProps = async (rendering,
|
|
|
143
186
|
|
|
144
187
|
const result = await graphQLClient.request<GraphQLConnectedDemoData>(
|
|
145
188
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
146
|
-
|
|
189
|
+
ConnectedDemoQuery,
|
|
147
190
|
{
|
|
148
191
|
datasource: rendering.dataSource,
|
|
149
192
|
contextItem: layoutData?.sitecore?.route?.itemId,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { JSX } from 'react';
|
|
1
2
|
import { Text, Link, withDatasourceCheck } from '@sitecore-jss/sitecore-jss-nextjs';
|
|
2
3
|
import { ComponentProps } from 'lib/component-props';
|
|
3
4
|
import NextLink from 'next/link';
|
|
@@ -114,9 +115,7 @@ const GraphQLIntegratedDemo = (props: GraphQlIntegratedDemoProps): JSX.Element =
|
|
|
114
115
|
<ul>
|
|
115
116
|
{contextItem.children.results.map((child: Item) => (
|
|
116
117
|
<li key={child.id}>
|
|
117
|
-
<NextLink href={child.url.path}>
|
|
118
|
-
{child.pageTitle.value}
|
|
119
|
-
</NextLink>
|
|
118
|
+
<NextLink href={child.url.path}>{child.pageTitle.value}</NextLink>
|
|
120
119
|
(editable title too! <Text field={child.pageTitle.jsonValue} />)
|
|
121
120
|
</li>
|
|
122
121
|
))}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { JSX } from 'react';
|
|
1
2
|
import { Placeholder, useSitecoreContext } from '@sitecore-jss/sitecore-jss-nextjs';
|
|
2
3
|
import { ComponentProps } from 'lib/component-props';
|
|
3
4
|
|
|
@@ -28,7 +29,10 @@ const GraphQLLayout = ({ rendering }: ComponentProps): JSX.Element => {
|
|
|
28
29
|
</>
|
|
29
30
|
)}
|
|
30
31
|
{!disconnectedMode && (
|
|
31
|
-
<Placeholder
|
|
32
|
+
<Placeholder
|
|
33
|
+
name="<%- helper.getAppPrefix(appPrefix, appName) %>jss-graphql-layout"
|
|
34
|
+
rendering={rendering}
|
|
35
|
+
/>
|
|
32
36
|
)}
|
|
33
37
|
</div>
|
|
34
38
|
);
|
package/dist/templates/nextjs-styleguide/src/components/styleguide/Styleguide-CustomRouteType.tsx
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { JSX } from 'react';
|
|
1
2
|
import Link from 'next/link';
|
|
2
3
|
import { useSitecoreContext, Text, RichText, Field } from '@sitecore-jss/sitecore-jss-nextjs';
|
|
3
4
|
|
|
@@ -27,9 +28,7 @@ const StyleguideCustomRouteType = (): JSX.Element => {
|
|
|
27
28
|
|
|
28
29
|
<RichText field={fields.content} />
|
|
29
30
|
|
|
30
|
-
<Link href="/styleguide">
|
|
31
|
-
Return to the Styleguide
|
|
32
|
-
</Link>
|
|
31
|
+
<Link href="/styleguide">Return to the Styleguide</Link>
|
|
33
32
|
</div>
|
|
34
33
|
);
|
|
35
34
|
};
|
package/dist/templates/nextjs-styleguide/src/components/styleguide/Styleguide-Layout-Tabs-Tab.tsx
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { JSX } from 'react';
|
|
1
2
|
import {
|
|
2
3
|
Text,
|
|
3
4
|
RichText,
|
|
@@ -7,13 +8,15 @@ import {
|
|
|
7
8
|
} from '@sitecore-jss/sitecore-jss-nextjs';
|
|
8
9
|
import { ComponentProps } from 'lib/component-props';
|
|
9
10
|
|
|
10
|
-
type
|
|
11
|
+
export type TabProps = {
|
|
11
12
|
fields: {
|
|
12
13
|
content: Field<string>;
|
|
13
14
|
title: Field<string>;
|
|
14
15
|
};
|
|
15
16
|
};
|
|
16
17
|
|
|
18
|
+
type StyleguideLayoutTabsTabProps = ComponentProps & TabProps;
|
|
19
|
+
|
|
17
20
|
/**
|
|
18
21
|
* This is a single tab within the tabs sample component. These are added to the tabs placeholder.
|
|
19
22
|
* This component demonstrates conditionally altering rendering when in the Sitecore Experience Editor to improve
|
package/dist/templates/nextjs-styleguide/src/components/styleguide/Styleguide-Layout-Tabs.tsx
CHANGED
|
@@ -3,6 +3,7 @@ import { withPlaceholder, withSitecoreContext, Text } from '@sitecore-jss/siteco
|
|
|
3
3
|
import StyleguideSpecimen from './Styleguide-Specimen';
|
|
4
4
|
import { ComponentWithContextProps } from 'lib/component-props';
|
|
5
5
|
import { StyleguideSpecimenFields } from 'lib/component-props/styleguide';
|
|
6
|
+
import { TabProps } from './Styleguide-Layout-Tabs-Tab';
|
|
6
7
|
|
|
7
8
|
interface StyleguideLayoutTabsState {
|
|
8
9
|
activeTabIndex: number;
|
|
@@ -55,7 +56,7 @@ class StyleguideLayoutTabs extends React.Component<
|
|
|
55
56
|
*/}
|
|
56
57
|
{!isEditing &&
|
|
57
58
|
(tabsPlaceholder || [])
|
|
58
|
-
.filter((tab: ReactElement) => tab.props && tab.props.fields)
|
|
59
|
+
.filter((tab: ReactElement) => tab.props && (tab.props as TabProps).fields)
|
|
59
60
|
.map((tab: ReactElement, index: number) => (
|
|
60
61
|
<li className="nav-item" key={`tab${index}`}>
|
|
61
62
|
<a
|
|
@@ -63,14 +64,14 @@ class StyleguideLayoutTabs extends React.Component<
|
|
|
63
64
|
onClick={() => this.setActiveTab(index)}
|
|
64
65
|
href="#t"
|
|
65
66
|
>
|
|
66
|
-
<Text field={tab.props.fields.title} />
|
|
67
|
+
<Text field={(tab.props as TabProps).fields.title} />
|
|
67
68
|
</a>
|
|
68
69
|
</li>
|
|
69
70
|
))}
|
|
70
71
|
</ul>
|
|
71
72
|
<div className="p-3 border-left border-right border-bottom">
|
|
72
73
|
{(tabsPlaceholder || []).map((tab: ReactElement) => {
|
|
73
|
-
const isValid = tab.props && tab.props.fields;
|
|
74
|
+
const isValid = tab.props && (tab.props as TabProps).fields;
|
|
74
75
|
|
|
75
76
|
// allow experience editor markup components to render
|
|
76
77
|
if (!isValid && isEditing) return tab;
|
|
@@ -7,19 +7,7 @@ const graphqlPlugin = (nextConfig = {}) => {
|
|
|
7
7
|
config.module.rules.push({
|
|
8
8
|
test: /\.graphql$/,
|
|
9
9
|
exclude: /node_modules/,
|
|
10
|
-
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
config.module.rules.push({
|
|
14
|
-
test: /\.graphqls$/,
|
|
15
|
-
exclude: /node_modules/,
|
|
16
|
-
use: ['graphql-let/schema/loader'],
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
config.module.rules.push({
|
|
20
|
-
test: /\.ya?ml$/,
|
|
21
|
-
type: 'json',
|
|
22
|
-
use: 'yaml-loader',
|
|
10
|
+
loader: 'graphql-tag/loader',
|
|
23
11
|
});
|
|
24
12
|
|
|
25
13
|
// Overload the Webpack config if it was already overloaded
|
|
@@ -28,7 +16,7 @@ const graphqlPlugin = (nextConfig = {}) => {
|
|
|
28
16
|
}
|
|
29
17
|
|
|
30
18
|
return config;
|
|
31
|
-
}
|
|
19
|
+
},
|
|
32
20
|
});
|
|
33
21
|
};
|
|
34
22
|
|
package/dist/templates/nextjs-styleguide-tracking/src/components/styleguide/Styleguide-Tracking.tsx
CHANGED
|
@@ -18,13 +18,13 @@ type StyleguideTrackingProps = ComponentWithContextProps & StyleguideSpecimenFie
|
|
|
18
18
|
* Demonstrates analytics tracking patterns (xDB)
|
|
19
19
|
*/
|
|
20
20
|
class StyleguideTracking extends React.Component<StyleguideTrackingProps> {
|
|
21
|
-
private event: RefObject<HTMLInputElement>;
|
|
22
|
-
private goal: RefObject<HTMLInputElement>;
|
|
23
|
-
private outcomeName: RefObject<HTMLInputElement>;
|
|
24
|
-
private outcomeValue: RefObject<HTMLInputElement>;
|
|
25
|
-
private campaign: RefObject<HTMLInputElement>;
|
|
26
|
-
private pageId: RefObject<HTMLInputElement>;
|
|
27
|
-
private pageUrl: RefObject<HTMLInputElement>;
|
|
21
|
+
private event: RefObject<HTMLInputElement | null>;
|
|
22
|
+
private goal: RefObject<HTMLInputElement | null>;
|
|
23
|
+
private outcomeName: RefObject<HTMLInputElement | null>;
|
|
24
|
+
private outcomeValue: RefObject<HTMLInputElement | null>;
|
|
25
|
+
private campaign: RefObject<HTMLInputElement | null>;
|
|
26
|
+
private pageId: RefObject<HTMLInputElement | null>;
|
|
27
|
+
private pageUrl: RefObject<HTMLInputElement | null>;
|
|
28
28
|
|
|
29
29
|
private trackingApiOptions: TrackingRequestOptions;
|
|
30
30
|
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* @returns component src boilerplate as a string
|
|
5
5
|
*/
|
|
6
6
|
function generateComponentSrc(componentName: string): string {
|
|
7
|
-
return `import
|
|
7
|
+
return `import { JSX } from 'react';
|
|
8
8
|
import { ComponentParams, ComponentRendering } from '@sitecore-jss/sitecore-jss-nextjs';
|
|
9
9
|
|
|
10
10
|
interface ${componentName}Props {
|