@sitecore-jss/sitecore-jss-nextjs 22.3.0-canary.12 → 22.3.0-canary.13
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/cjs/ComponentBuilder.js +1 -1
- package/dist/cjs/editing/editing-render-middleware.js +2 -2
- package/dist/cjs/editing/render-middleware.js +1 -1
- package/dist/cjs/middleware/personalize-middleware.js +6 -6
- package/dist/cjs/middleware/redirects-middleware.js +2 -2
- package/dist/cjs/services/base-graphql-sitemap-service.js +9 -9
- package/dist/cjs/services/component-props-service.js +2 -3
- package/dist/cjs/utils/utils.js +0 -1
- package/dist/esm/ComponentBuilder.js +1 -1
- package/dist/esm/editing/editing-render-middleware.js +2 -2
- package/dist/esm/editing/render-middleware.js +1 -1
- package/dist/esm/middleware/personalize-middleware.js +6 -6
- package/dist/esm/middleware/redirects-middleware.js +2 -2
- package/dist/esm/services/base-graphql-sitemap-service.js +9 -9
- package/dist/esm/services/component-props-service.js +2 -3
- package/dist/esm/utils/utils.js +0 -1
- package/package.json +11 -12
- package/types/ComponentBuilder.d.ts +1 -1
- package/types/editing/editing-render-middleware.d.ts +3 -3
- package/types/editing/render-middleware.d.ts +2 -1
- package/types/middleware/redirects-middleware.d.ts +1 -1
- package/types/services/base-graphql-sitemap-service.d.ts +7 -6
- package/types/services/component-props-service.d.ts +1 -2
- package/types/utils/utils.d.ts +0 -1
|
@@ -34,7 +34,7 @@ class ComponentBuilder {
|
|
|
34
34
|
/**
|
|
35
35
|
* Creates a new instance of component factory
|
|
36
36
|
* Component can be imported dynamically or statically.
|
|
37
|
-
* @param {
|
|
37
|
+
* @param {object} [config] Component factory configuration
|
|
38
38
|
* @param {boolean} [config.isEditing] Indicates if component factory is used in editing mode
|
|
39
39
|
* @returns {ComponentFactory} Component factory implementation
|
|
40
40
|
*/
|
|
@@ -30,7 +30,7 @@ class ChromesHandler extends render_middleware_1.RenderMiddlewareBase {
|
|
|
30
30
|
this.config = config;
|
|
31
31
|
/**
|
|
32
32
|
* Default page URL resolution.
|
|
33
|
-
* @param {
|
|
33
|
+
* @param {object} args Arguments for resolving the page URL
|
|
34
34
|
* @param {string} args.serverUrl The root server URL e.g. 'http://localhost:3000'
|
|
35
35
|
* @param {string} args.itemPath The Sitecore relative item path e.g. '/styleguide'
|
|
36
36
|
* @returns {string} The URL to render
|
|
@@ -173,7 +173,7 @@ class ChromesHandler extends render_middleware_1.RenderMiddlewareBase {
|
|
|
173
173
|
exports.ChromesHandler = ChromesHandler;
|
|
174
174
|
/**
|
|
175
175
|
* Type guard for EditingMetadataPreviewData
|
|
176
|
-
* @param {
|
|
176
|
+
* @param {object} data preview data to check
|
|
177
177
|
* @returns true if the data is EditingMetadataPreviewData
|
|
178
178
|
* @see EditingMetadataPreviewData
|
|
179
179
|
*/
|
|
@@ -9,7 +9,7 @@ class RenderMiddlewareBase {
|
|
|
9
9
|
constructor() {
|
|
10
10
|
/**
|
|
11
11
|
* Gets query parameters that should be passed along to subsequent requests (e.g. for deployment protection bypass)
|
|
12
|
-
* @param {
|
|
12
|
+
* @param {object} query Object of query parameters from incoming URL
|
|
13
13
|
* @returns Object of approved query parameters
|
|
14
14
|
*/
|
|
15
15
|
this.getQueryParamsForPropagation = (query) => {
|
|
@@ -135,8 +135,8 @@ class PersonalizeMiddleware extends middleware_1.MiddlewareBase {
|
|
|
135
135
|
}
|
|
136
136
|
});
|
|
137
137
|
}
|
|
138
|
-
initPersonalizeServer(
|
|
139
|
-
return __awaiter(this,
|
|
138
|
+
initPersonalizeServer(_a) {
|
|
139
|
+
return __awaiter(this, arguments, void 0, function* ({ hostname, siteName, request, response, }) {
|
|
140
140
|
yield (0, server_2.CloudSDK)(request, response, {
|
|
141
141
|
sitecoreEdgeUrl: this.config.cdpConfig.sitecoreEdgeUrl,
|
|
142
142
|
sitecoreEdgeContextId: this.config.cdpConfig.sitecoreEdgeContextId,
|
|
@@ -148,13 +148,13 @@ class PersonalizeMiddleware extends middleware_1.MiddlewareBase {
|
|
|
148
148
|
.initialize();
|
|
149
149
|
});
|
|
150
150
|
}
|
|
151
|
-
personalize(
|
|
152
|
-
|
|
153
|
-
|
|
151
|
+
personalize(_a, request_1) {
|
|
152
|
+
return __awaiter(this, arguments, void 0, function* ({ params, friendlyId, language, timeout, variantIds, }, request) {
|
|
153
|
+
var _b;
|
|
154
154
|
sitecore_jss_1.debug.personalize('executing experience for %s %o', friendlyId, params);
|
|
155
155
|
return (yield (0, server_3.personalize)(request, {
|
|
156
156
|
channel: this.config.cdpConfig.channel || 'WEB',
|
|
157
|
-
currency: (
|
|
157
|
+
currency: (_b = this.config.cdpConfig.currency) !== null && _b !== void 0 ? _b : 'USD',
|
|
158
158
|
friendlyId,
|
|
159
159
|
params,
|
|
160
160
|
language,
|
|
@@ -98,7 +98,7 @@ class RedirectsMiddleware extends middleware_1.MiddlewareBase {
|
|
|
98
98
|
url.search = prepareNewURL.search;
|
|
99
99
|
url.locale = req.nextUrl.locale;
|
|
100
100
|
}
|
|
101
|
-
/** return Response redirect with http code of redirect type
|
|
101
|
+
/** return Response redirect with http code of redirect type */
|
|
102
102
|
switch (existsRedirect.redirectType) {
|
|
103
103
|
case site_1.REDIRECT_TYPE_301: {
|
|
104
104
|
return this.createRedirectResponse(url, res, 301, 'Moved Permanently');
|
|
@@ -272,7 +272,7 @@ class RedirectsMiddleware extends middleware_1.MiddlewareBase {
|
|
|
272
272
|
/**
|
|
273
273
|
* Checks if the current URL query matches the provided pattern, considering all permutations of query parameters.
|
|
274
274
|
* It constructs all possible query parameter permutations and tests them against the pattern.
|
|
275
|
-
* @param {
|
|
275
|
+
* @param {object} params - The parameters for the URL match.
|
|
276
276
|
* @param {string} params.pathname - The current URL pathname.
|
|
277
277
|
* @param {string} params.queryString - The current URL query string.
|
|
278
278
|
* @param {string} params.pattern - The regex pattern to test the constructed URLs against.
|
|
@@ -75,6 +75,14 @@ query ${usesPersonalize ? 'PersonalizeSitemapQuery' : 'DefaultSitemapQuery'}(
|
|
|
75
75
|
* @mixes SearchQueryService<PageListQueryResult>
|
|
76
76
|
*/
|
|
77
77
|
class BaseGraphQLSitemapService {
|
|
78
|
+
/**
|
|
79
|
+
* Creates an instance of graphQL sitemap service with the provided options
|
|
80
|
+
* @param {GraphQLSitemapServiceConfig} options instance
|
|
81
|
+
*/
|
|
82
|
+
constructor(options) {
|
|
83
|
+
this.options = options;
|
|
84
|
+
this._graphQLClient = this.getGraphQLClient();
|
|
85
|
+
}
|
|
78
86
|
/**
|
|
79
87
|
* GraphQL client accessible by descendant classes when needed
|
|
80
88
|
*/
|
|
@@ -87,14 +95,6 @@ class BaseGraphQLSitemapService {
|
|
|
87
95
|
get query() {
|
|
88
96
|
return defaultQuery(this.options.includePersonalizedRoutes);
|
|
89
97
|
}
|
|
90
|
-
/**
|
|
91
|
-
* Creates an instance of graphQL sitemap service with the provided options
|
|
92
|
-
* @param {GraphQLSitemapServiceConfig} options instance
|
|
93
|
-
*/
|
|
94
|
-
constructor(options) {
|
|
95
|
-
this.options = options;
|
|
96
|
-
this._graphQLClient = this.getGraphQLClient();
|
|
97
|
-
}
|
|
98
98
|
/**
|
|
99
99
|
* Fetch sitemap which could be used for generation of static pages during `next export`.
|
|
100
100
|
* The `locale` parameter will be used in the item query, but since i18n is not supported,
|
|
@@ -162,8 +162,8 @@ class BaseGraphQLSitemapService {
|
|
|
162
162
|
});
|
|
163
163
|
}
|
|
164
164
|
fetchLanguageSitePaths(language, siteName) {
|
|
165
|
-
var _a, _b, _c, _d;
|
|
166
165
|
return __awaiter(this, void 0, void 0, function* () {
|
|
166
|
+
var _a, _b, _c, _d;
|
|
167
167
|
const args = {
|
|
168
168
|
siteName: siteName,
|
|
169
169
|
language: language,
|
|
@@ -56,8 +56,8 @@ class ComponentPropsService {
|
|
|
56
56
|
* @returns {Promise<ComponentPropsCollection>} component props
|
|
57
57
|
*/
|
|
58
58
|
fetchComponentProps(fetchFunctionFactory, layoutData, context) {
|
|
59
|
-
var _a;
|
|
60
59
|
return __awaiter(this, void 0, void 0, function* () {
|
|
60
|
+
var _a;
|
|
61
61
|
// Array of side effect functions
|
|
62
62
|
const requests = yield this.collectRequests({
|
|
63
63
|
placeholders: (_a = layoutData.sitecore.route) === null || _a === void 0 ? void 0 : _a.placeholders,
|
|
@@ -71,7 +71,7 @@ class ComponentPropsService {
|
|
|
71
71
|
/**
|
|
72
72
|
* Go through layout service data, check all renderings using displayName, which should make some side effects.
|
|
73
73
|
* Write result in requests variable
|
|
74
|
-
* @param {
|
|
74
|
+
* @param {object} params params
|
|
75
75
|
* @param {PlaceholdersData} [params.placeholders]
|
|
76
76
|
* @param {FetchFunctionFactory<NextContext>} params.fetchFunctionFactory
|
|
77
77
|
* @param {LayoutServiceData} params.layoutData
|
|
@@ -151,7 +151,6 @@ class ComponentPropsService {
|
|
|
151
151
|
* flatRenderings(placeholders);
|
|
152
152
|
*
|
|
153
153
|
* RESULT: [{ uid: 1 }, { uid: 2 }, { uid: 11 }, { uid: 22 }]
|
|
154
|
-
*
|
|
155
154
|
* @param {PlaceholdersData} placeholders placeholders
|
|
156
155
|
* @returns {ComponentRendering[]} renderings
|
|
157
156
|
*/
|
package/dist/cjs/utils/utils.js
CHANGED
|
@@ -29,7 +29,6 @@ exports.getPublicUrl = getPublicUrl;
|
|
|
29
29
|
* 1. Subscribe on events provided by webpack.
|
|
30
30
|
* 2. Reset editor chromes when build is finished
|
|
31
31
|
* @param {boolean} [forceReload] force page reload instead of reset chromes
|
|
32
|
-
* @default forceReload false
|
|
33
32
|
*/
|
|
34
33
|
const handleEditorFastRefresh = (forceReload = false) => {
|
|
35
34
|
if (process.env.NODE_ENV !== 'development' || !(0, editing_1.isEditorActive)()) {
|
|
@@ -31,7 +31,7 @@ export class ComponentBuilder {
|
|
|
31
31
|
/**
|
|
32
32
|
* Creates a new instance of component factory
|
|
33
33
|
* Component can be imported dynamically or statically.
|
|
34
|
-
* @param {
|
|
34
|
+
* @param {object} [config] Component factory configuration
|
|
35
35
|
* @param {boolean} [config.isEditing] Indicates if component factory is used in editing mode
|
|
36
36
|
* @returns {ComponentFactory} Component factory implementation
|
|
37
37
|
*/
|
|
@@ -27,7 +27,7 @@ export class ChromesHandler extends RenderMiddlewareBase {
|
|
|
27
27
|
this.config = config;
|
|
28
28
|
/**
|
|
29
29
|
* Default page URL resolution.
|
|
30
|
-
* @param {
|
|
30
|
+
* @param {object} args Arguments for resolving the page URL
|
|
31
31
|
* @param {string} args.serverUrl The root server URL e.g. 'http://localhost:3000'
|
|
32
32
|
* @param {string} args.itemPath The Sitecore relative item path e.g. '/styleguide'
|
|
33
33
|
* @returns {string} The URL to render
|
|
@@ -169,7 +169,7 @@ export class ChromesHandler extends RenderMiddlewareBase {
|
|
|
169
169
|
}
|
|
170
170
|
/**
|
|
171
171
|
* Type guard for EditingMetadataPreviewData
|
|
172
|
-
* @param {
|
|
172
|
+
* @param {object} data preview data to check
|
|
173
173
|
* @returns true if the data is EditingMetadataPreviewData
|
|
174
174
|
* @see EditingMetadataPreviewData
|
|
175
175
|
*/
|
|
@@ -6,7 +6,7 @@ export class RenderMiddlewareBase {
|
|
|
6
6
|
constructor() {
|
|
7
7
|
/**
|
|
8
8
|
* Gets query parameters that should be passed along to subsequent requests (e.g. for deployment protection bypass)
|
|
9
|
-
* @param {
|
|
9
|
+
* @param {object} query Object of query parameters from incoming URL
|
|
10
10
|
* @returns Object of approved query parameters
|
|
11
11
|
*/
|
|
12
12
|
this.getQueryParamsForPropagation = (query) => {
|
|
@@ -132,8 +132,8 @@ export class PersonalizeMiddleware extends MiddlewareBase {
|
|
|
132
132
|
}
|
|
133
133
|
});
|
|
134
134
|
}
|
|
135
|
-
initPersonalizeServer(
|
|
136
|
-
return __awaiter(this,
|
|
135
|
+
initPersonalizeServer(_a) {
|
|
136
|
+
return __awaiter(this, arguments, void 0, function* ({ hostname, siteName, request, response, }) {
|
|
137
137
|
yield CloudSDK(request, response, {
|
|
138
138
|
sitecoreEdgeUrl: this.config.cdpConfig.sitecoreEdgeUrl,
|
|
139
139
|
sitecoreEdgeContextId: this.config.cdpConfig.sitecoreEdgeContextId,
|
|
@@ -145,13 +145,13 @@ export class PersonalizeMiddleware extends MiddlewareBase {
|
|
|
145
145
|
.initialize();
|
|
146
146
|
});
|
|
147
147
|
}
|
|
148
|
-
personalize(
|
|
149
|
-
|
|
150
|
-
|
|
148
|
+
personalize(_a, request_1) {
|
|
149
|
+
return __awaiter(this, arguments, void 0, function* ({ params, friendlyId, language, timeout, variantIds, }, request) {
|
|
150
|
+
var _b;
|
|
151
151
|
debug.personalize('executing experience for %s %o', friendlyId, params);
|
|
152
152
|
return (yield personalize(request, {
|
|
153
153
|
channel: this.config.cdpConfig.channel || 'WEB',
|
|
154
|
-
currency: (
|
|
154
|
+
currency: (_b = this.config.cdpConfig.currency) !== null && _b !== void 0 ? _b : 'USD',
|
|
155
155
|
friendlyId,
|
|
156
156
|
params,
|
|
157
157
|
language,
|
|
@@ -92,7 +92,7 @@ export class RedirectsMiddleware extends MiddlewareBase {
|
|
|
92
92
|
url.search = prepareNewURL.search;
|
|
93
93
|
url.locale = req.nextUrl.locale;
|
|
94
94
|
}
|
|
95
|
-
/** return Response redirect with http code of redirect type
|
|
95
|
+
/** return Response redirect with http code of redirect type */
|
|
96
96
|
switch (existsRedirect.redirectType) {
|
|
97
97
|
case REDIRECT_TYPE_301: {
|
|
98
98
|
return this.createRedirectResponse(url, res, 301, 'Moved Permanently');
|
|
@@ -266,7 +266,7 @@ export class RedirectsMiddleware extends MiddlewareBase {
|
|
|
266
266
|
/**
|
|
267
267
|
* Checks if the current URL query matches the provided pattern, considering all permutations of query parameters.
|
|
268
268
|
* It constructs all possible query parameter permutations and tests them against the pattern.
|
|
269
|
-
* @param {
|
|
269
|
+
* @param {object} params - The parameters for the URL match.
|
|
270
270
|
* @param {string} params.pathname - The current URL pathname.
|
|
271
271
|
* @param {string} params.queryString - The current URL query string.
|
|
272
272
|
* @param {string} params.pattern - The regex pattern to test the constructed URLs against.
|
|
@@ -71,6 +71,14 @@ query ${usesPersonalize ? 'PersonalizeSitemapQuery' : 'DefaultSitemapQuery'}(
|
|
|
71
71
|
* @mixes SearchQueryService<PageListQueryResult>
|
|
72
72
|
*/
|
|
73
73
|
export class BaseGraphQLSitemapService {
|
|
74
|
+
/**
|
|
75
|
+
* Creates an instance of graphQL sitemap service with the provided options
|
|
76
|
+
* @param {GraphQLSitemapServiceConfig} options instance
|
|
77
|
+
*/
|
|
78
|
+
constructor(options) {
|
|
79
|
+
this.options = options;
|
|
80
|
+
this._graphQLClient = this.getGraphQLClient();
|
|
81
|
+
}
|
|
74
82
|
/**
|
|
75
83
|
* GraphQL client accessible by descendant classes when needed
|
|
76
84
|
*/
|
|
@@ -83,14 +91,6 @@ export class BaseGraphQLSitemapService {
|
|
|
83
91
|
get query() {
|
|
84
92
|
return defaultQuery(this.options.includePersonalizedRoutes);
|
|
85
93
|
}
|
|
86
|
-
/**
|
|
87
|
-
* Creates an instance of graphQL sitemap service with the provided options
|
|
88
|
-
* @param {GraphQLSitemapServiceConfig} options instance
|
|
89
|
-
*/
|
|
90
|
-
constructor(options) {
|
|
91
|
-
this.options = options;
|
|
92
|
-
this._graphQLClient = this.getGraphQLClient();
|
|
93
|
-
}
|
|
94
94
|
/**
|
|
95
95
|
* Fetch sitemap which could be used for generation of static pages during `next export`.
|
|
96
96
|
* The `locale` parameter will be used in the item query, but since i18n is not supported,
|
|
@@ -158,8 +158,8 @@ export class BaseGraphQLSitemapService {
|
|
|
158
158
|
});
|
|
159
159
|
}
|
|
160
160
|
fetchLanguageSitePaths(language, siteName) {
|
|
161
|
-
var _a, _b, _c, _d;
|
|
162
161
|
return __awaiter(this, void 0, void 0, function* () {
|
|
162
|
+
var _a, _b, _c, _d;
|
|
163
163
|
const args = {
|
|
164
164
|
siteName: siteName,
|
|
165
165
|
language: language,
|
|
@@ -50,8 +50,8 @@ export class ComponentPropsService {
|
|
|
50
50
|
* @returns {Promise<ComponentPropsCollection>} component props
|
|
51
51
|
*/
|
|
52
52
|
fetchComponentProps(fetchFunctionFactory, layoutData, context) {
|
|
53
|
-
var _a;
|
|
54
53
|
return __awaiter(this, void 0, void 0, function* () {
|
|
54
|
+
var _a;
|
|
55
55
|
// Array of side effect functions
|
|
56
56
|
const requests = yield this.collectRequests({
|
|
57
57
|
placeholders: (_a = layoutData.sitecore.route) === null || _a === void 0 ? void 0 : _a.placeholders,
|
|
@@ -65,7 +65,7 @@ export class ComponentPropsService {
|
|
|
65
65
|
/**
|
|
66
66
|
* Go through layout service data, check all renderings using displayName, which should make some side effects.
|
|
67
67
|
* Write result in requests variable
|
|
68
|
-
* @param {
|
|
68
|
+
* @param {object} params params
|
|
69
69
|
* @param {PlaceholdersData} [params.placeholders]
|
|
70
70
|
* @param {FetchFunctionFactory<NextContext>} params.fetchFunctionFactory
|
|
71
71
|
* @param {LayoutServiceData} params.layoutData
|
|
@@ -145,7 +145,6 @@ export class ComponentPropsService {
|
|
|
145
145
|
* flatRenderings(placeholders);
|
|
146
146
|
*
|
|
147
147
|
* RESULT: [{ uid: 1 }, { uid: 2 }, { uid: 11 }, { uid: 22 }]
|
|
148
|
-
*
|
|
149
148
|
* @param {PlaceholdersData} placeholders placeholders
|
|
150
149
|
* @returns {ComponentRendering[]} renderings
|
|
151
150
|
*/
|
package/dist/esm/utils/utils.js
CHANGED
|
@@ -25,7 +25,6 @@ export const getPublicUrl = () => {
|
|
|
25
25
|
* 1. Subscribe on events provided by webpack.
|
|
26
26
|
* 2. Reset editor chromes when build is finished
|
|
27
27
|
* @param {boolean} [forceReload] force page reload instead of reset chromes
|
|
28
|
-
* @default forceReload false
|
|
29
28
|
*/
|
|
30
29
|
export const handleEditorFastRefresh = (forceReload = false) => {
|
|
31
30
|
if (process.env.NODE_ENV !== 'development' || !isEditorActive()) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sitecore-jss/sitecore-jss-nextjs",
|
|
3
|
-
"version": "22.3.0-canary.
|
|
3
|
+
"version": "22.3.0-canary.13",
|
|
4
4
|
"main": "dist/cjs/index.js",
|
|
5
5
|
"module": "dist/esm/index.js",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"generate-docs": "npx typedoc --plugin typedoc-plugin-markdown --readme none --out ../../ref-docs/sitecore-jss-nextjs --entryPoints src/index.ts --entryPoints src/monitoring/index.ts --entryPoints src/editing/index.ts --entryPoints src/middleware/index.ts --entryPoints src/context/index.ts --entryPoints src/utils/index.ts --entryPoints src/site/index.ts --entryPoints src/graphql/index.ts --githubPages false"
|
|
15
15
|
},
|
|
16
16
|
"engines": {
|
|
17
|
-
"node": ">=
|
|
17
|
+
"node": ">=22"
|
|
18
18
|
},
|
|
19
19
|
"author": {
|
|
20
20
|
"name": "Sitecore Corporation",
|
|
@@ -36,9 +36,9 @@
|
|
|
36
36
|
"@types/chai-string": "^1.4.2",
|
|
37
37
|
"@types/enzyme": "^3.10.12",
|
|
38
38
|
"@types/mocha": "^10.0.1",
|
|
39
|
-
"@types/node": "~
|
|
39
|
+
"@types/node": "~22.9.0",
|
|
40
40
|
"@types/prop-types": "^15.7.5",
|
|
41
|
-
"@types/react": "^18.2.
|
|
41
|
+
"@types/react": "^18.2.45",
|
|
42
42
|
"@types/react-dom": "^18.0.10",
|
|
43
43
|
"@types/sinon": "^10.0.13",
|
|
44
44
|
"@types/sinon-chai": "^3.2.9",
|
|
@@ -51,11 +51,11 @@
|
|
|
51
51
|
"cross-fetch": "^3.1.5",
|
|
52
52
|
"del-cli": "^5.0.0",
|
|
53
53
|
"enzyme": "^3.11.0",
|
|
54
|
-
"eslint": "^8.
|
|
54
|
+
"eslint": "^8.56.0",
|
|
55
55
|
"eslint-plugin-react": "^7.32.1",
|
|
56
56
|
"jsdom": "^21.1.0",
|
|
57
57
|
"mocha": "^10.2.0",
|
|
58
|
-
"next": "^14.2.
|
|
58
|
+
"next": "^14.2.18",
|
|
59
59
|
"nock": "^13.3.0",
|
|
60
60
|
"nyc": "^15.1.0",
|
|
61
61
|
"react": "^18.2.0",
|
|
@@ -63,19 +63,18 @@
|
|
|
63
63
|
"sinon": "^15.0.1",
|
|
64
64
|
"sinon-chai": "^3.7.0",
|
|
65
65
|
"ts-node": "^10.9.1",
|
|
66
|
-
"typescript": "~4.
|
|
66
|
+
"typescript": "~5.4.0"
|
|
67
67
|
},
|
|
68
68
|
"peerDependencies": {
|
|
69
69
|
"@sitecore-cloudsdk/core": "^0.4.1",
|
|
70
70
|
"@sitecore-cloudsdk/personalize": "^0.4.1",
|
|
71
|
-
"next": "^14.2.7",
|
|
72
71
|
"react": "^18.2.0",
|
|
73
72
|
"react-dom": "^18.2.0"
|
|
74
73
|
},
|
|
75
74
|
"dependencies": {
|
|
76
|
-
"@sitecore-jss/sitecore-jss": "^22.3.0-canary.
|
|
77
|
-
"@sitecore-jss/sitecore-jss-dev-tools": "^22.3.0-canary.
|
|
78
|
-
"@sitecore-jss/sitecore-jss-react": "^22.3.0-canary.
|
|
75
|
+
"@sitecore-jss/sitecore-jss": "^22.3.0-canary.13",
|
|
76
|
+
"@sitecore-jss/sitecore-jss-dev-tools": "^22.3.0-canary.13",
|
|
77
|
+
"@sitecore-jss/sitecore-jss-react": "^22.3.0-canary.13",
|
|
79
78
|
"@vercel/kv": "^0.2.1",
|
|
80
79
|
"prop-types": "^15.8.1",
|
|
81
80
|
"regex-parser": "^2.2.11",
|
|
@@ -83,7 +82,7 @@
|
|
|
83
82
|
},
|
|
84
83
|
"description": "",
|
|
85
84
|
"types": "types/index.d.ts",
|
|
86
|
-
"gitHead": "
|
|
85
|
+
"gitHead": "3594160e4faebace2e135b19675ae9583992a405",
|
|
87
86
|
"files": [
|
|
88
87
|
"dist",
|
|
89
88
|
"types",
|
|
@@ -50,7 +50,7 @@ export declare class ComponentBuilder {
|
|
|
50
50
|
/**
|
|
51
51
|
* Creates a new instance of component factory
|
|
52
52
|
* Component can be imported dynamically or statically.
|
|
53
|
-
* @param {
|
|
53
|
+
* @param {object} [config] Component factory configuration
|
|
54
54
|
* @param {boolean} [config.isEditing] Indicates if component factory is used in editing mode
|
|
55
55
|
* @returns {ComponentFactory} Component factory implementation
|
|
56
56
|
*/
|
|
@@ -32,7 +32,7 @@ export type EditingRenderMiddlewareConfig = {
|
|
|
32
32
|
*
|
|
33
33
|
* Function used to determine route/page URL to render.
|
|
34
34
|
* This may be necessary for certain custom Next.js routing configurations.
|
|
35
|
-
* @param {
|
|
35
|
+
* @param {object} args Arguments for resolving the page URL
|
|
36
36
|
* @param {string} args.serverUrl The root server URL e.g. 'http://localhost:3000'. Available in Chromes Edit Mode only.
|
|
37
37
|
* @param {string} itemPath The Sitecore relative item path e.g. '/styleguide'
|
|
38
38
|
* @returns {string} The URL to render
|
|
@@ -73,7 +73,7 @@ export declare class ChromesHandler extends RenderMiddlewareBase {
|
|
|
73
73
|
render(req: NextApiRequest, res: NextApiResponse): Promise<void>;
|
|
74
74
|
/**
|
|
75
75
|
* Default page URL resolution.
|
|
76
|
-
* @param {
|
|
76
|
+
* @param {object} args Arguments for resolving the page URL
|
|
77
77
|
* @param {string} args.serverUrl The root server URL e.g. 'http://localhost:3000'
|
|
78
78
|
* @param {string} args.itemPath The Sitecore relative item path e.g. '/styleguide'
|
|
79
79
|
* @returns {string} The URL to render
|
|
@@ -117,7 +117,7 @@ export type EditingMetadataPreviewData = {
|
|
|
117
117
|
};
|
|
118
118
|
/**
|
|
119
119
|
* Type guard for EditingMetadataPreviewData
|
|
120
|
-
* @param {
|
|
120
|
+
* @param {object} data preview data to check
|
|
121
121
|
* @returns true if the data is EditingMetadataPreviewData
|
|
122
122
|
* @see EditingMetadataPreviewData
|
|
123
123
|
*/
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
1
2
|
import { IncomingHttpHeaders } from 'http';
|
|
2
3
|
/**
|
|
3
4
|
* Base class for middleware that handles pages and components rendering in Sitecore Editors.
|
|
@@ -5,7 +6,7 @@ import { IncomingHttpHeaders } from 'http';
|
|
|
5
6
|
export declare abstract class RenderMiddlewareBase {
|
|
6
7
|
/**
|
|
7
8
|
* Gets query parameters that should be passed along to subsequent requests (e.g. for deployment protection bypass)
|
|
8
|
-
* @param {
|
|
9
|
+
* @param {object} query Object of query parameters from incoming URL
|
|
9
10
|
* @returns Object of approved query parameters
|
|
10
11
|
*/
|
|
11
12
|
protected getQueryParamsForPropagation: (query: Partial<{
|
|
@@ -57,7 +57,7 @@ export declare class RedirectsMiddleware extends MiddlewareBase {
|
|
|
57
57
|
/**
|
|
58
58
|
* Checks if the current URL query matches the provided pattern, considering all permutations of query parameters.
|
|
59
59
|
* It constructs all possible query parameter permutations and tests them against the pattern.
|
|
60
|
-
* @param {
|
|
60
|
+
* @param {object} params - The parameters for the URL match.
|
|
61
61
|
* @param {string} params.pathname - The current URL pathname.
|
|
62
62
|
* @param {string} params.queryString - The current URL query string.
|
|
63
63
|
* @param {string} params.pattern - The regex pattern to test the constructed URLs against.
|
|
@@ -27,7 +27,8 @@ interface SiteRouteQueryVariables {
|
|
|
27
27
|
* Optional. Paths starting with these provided prefixes will be excluded from returned results.
|
|
28
28
|
*/
|
|
29
29
|
excludedPaths?: string[];
|
|
30
|
-
/**
|
|
30
|
+
/**
|
|
31
|
+
* common variable for all GraphQL queries
|
|
31
32
|
* it will be used for every type of query to regulate result batch size
|
|
32
33
|
* Optional. How many result items to fetch in each GraphQL call. This is needed for pagination.
|
|
33
34
|
* @default 100
|
|
@@ -96,6 +97,11 @@ export type StaticPath = {
|
|
|
96
97
|
export declare abstract class BaseGraphQLSitemapService {
|
|
97
98
|
options: BaseGraphQLSitemapServiceConfig;
|
|
98
99
|
private _graphQLClient;
|
|
100
|
+
/**
|
|
101
|
+
* Creates an instance of graphQL sitemap service with the provided options
|
|
102
|
+
* @param {GraphQLSitemapServiceConfig} options instance
|
|
103
|
+
*/
|
|
104
|
+
constructor(options: BaseGraphQLSitemapServiceConfig);
|
|
99
105
|
/**
|
|
100
106
|
* GraphQL client accessible by descendant classes when needed
|
|
101
107
|
*/
|
|
@@ -104,11 +110,6 @@ export declare abstract class BaseGraphQLSitemapService {
|
|
|
104
110
|
* Gets the default query used for fetching the list of site pages
|
|
105
111
|
*/
|
|
106
112
|
protected get query(): string;
|
|
107
|
-
/**
|
|
108
|
-
* Creates an instance of graphQL sitemap service with the provided options
|
|
109
|
-
* @param {GraphQLSitemapServiceConfig} options instance
|
|
110
|
-
*/
|
|
111
|
-
constructor(options: BaseGraphQLSitemapServiceConfig);
|
|
112
113
|
/**
|
|
113
114
|
* Fetch sitemap which could be used for generation of static pages during `next export`.
|
|
114
115
|
* The `locale` parameter will be used in the item query, but since i18n is not supported,
|
|
@@ -41,7 +41,7 @@ export declare class ComponentPropsService {
|
|
|
41
41
|
/**
|
|
42
42
|
* Go through layout service data, check all renderings using displayName, which should make some side effects.
|
|
43
43
|
* Write result in requests variable
|
|
44
|
-
* @param {
|
|
44
|
+
* @param {object} params params
|
|
45
45
|
* @param {PlaceholdersData} [params.placeholders]
|
|
46
46
|
* @param {FetchFunctionFactory<NextContext>} params.fetchFunctionFactory
|
|
47
47
|
* @param {LayoutServiceData} params.layoutData
|
|
@@ -73,7 +73,6 @@ export declare class ComponentPropsService {
|
|
|
73
73
|
* flatRenderings(placeholders);
|
|
74
74
|
*
|
|
75
75
|
* RESULT: [{ uid: 1 }, { uid: 2 }, { uid: 11 }, { uid: 22 }]
|
|
76
|
-
*
|
|
77
76
|
* @param {PlaceholdersData} placeholders placeholders
|
|
78
77
|
* @returns {ComponentRendering[]} renderings
|
|
79
78
|
*/
|
package/types/utils/utils.d.ts
CHANGED
|
@@ -13,7 +13,6 @@ export declare const getPublicUrl: () => string;
|
|
|
13
13
|
* 1. Subscribe on events provided by webpack.
|
|
14
14
|
* 2. Reset editor chromes when build is finished
|
|
15
15
|
* @param {boolean} [forceReload] force page reload instead of reset chromes
|
|
16
|
-
* @default forceReload false
|
|
17
16
|
*/
|
|
18
17
|
export declare const handleEditorFastRefresh: (forceReload?: boolean) => void;
|
|
19
18
|
export declare const getJssEditingSecret: () => string;
|