@sitecore-jss/sitecore-jss-nextjs 22.1.0-canary.8 → 22.1.0-canary.81
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/components/Link.js +7 -3
- package/dist/cjs/components/NextImage.js +16 -6
- package/dist/cjs/components/RichText.js +2 -2
- package/dist/cjs/editing/constants.js +12 -3
- package/dist/cjs/editing/editing-config-middleware.js +8 -0
- package/dist/cjs/editing/editing-data-middleware.js +6 -0
- package/dist/cjs/editing/editing-render-middleware.js +228 -103
- package/dist/cjs/editing/feaas-render-middleware.js +8 -0
- package/dist/cjs/editing/index.js +4 -1
- package/dist/cjs/editing/render-middleware.js +18 -4
- package/dist/cjs/index.js +9 -7
- package/dist/cjs/middleware/middleware.js +12 -0
- package/dist/cjs/middleware/personalize-middleware.js +85 -25
- package/dist/cjs/middleware/redirects-middleware.js +57 -24
- package/dist/cjs/services/base-graphql-sitemap-service.js +5 -4
- package/dist/cjs/utils/index.js +4 -3
- package/dist/cjs/utils/utils.js +3 -3
- package/dist/esm/components/Link.js +7 -3
- package/dist/esm/components/NextImage.js +17 -6
- package/dist/esm/components/RichText.js +2 -2
- package/dist/esm/editing/constants.js +11 -2
- package/dist/esm/editing/editing-config-middleware.js +9 -1
- package/dist/esm/editing/editing-data-middleware.js +7 -1
- package/dist/esm/editing/editing-render-middleware.js +226 -103
- package/dist/esm/editing/feaas-render-middleware.js +9 -1
- package/dist/esm/editing/index.js +2 -1
- package/dist/esm/editing/render-middleware.js +19 -5
- package/dist/esm/index.js +3 -4
- package/dist/esm/middleware/middleware.js +12 -0
- package/dist/esm/middleware/personalize-middleware.js +86 -26
- package/dist/esm/middleware/redirects-middleware.js +57 -24
- package/dist/esm/services/base-graphql-sitemap-service.js +5 -4
- package/dist/esm/utils/index.js +2 -1
- package/dist/esm/utils/utils.js +1 -1
- package/package.json +10 -11
- package/types/ComponentBuilder.d.ts +3 -5
- package/types/components/Placeholder.d.ts +7 -2
- package/types/components/RichText.d.ts +6 -0
- package/types/editing/constants.d.ts +11 -2
- package/types/editing/editing-config-middleware.d.ts +7 -0
- package/types/editing/editing-data-service.d.ts +1 -0
- package/types/editing/editing-render-middleware.d.ts +111 -23
- package/types/editing/index.d.ts +2 -1
- package/types/editing/render-middleware.d.ts +9 -0
- package/types/index.d.ts +3 -4
- package/types/middleware/middleware.d.ts +6 -0
- package/types/middleware/personalize-middleware.d.ts +22 -2
- package/types/middleware/redirects-middleware.d.ts +8 -0
- package/types/services/base-graphql-sitemap-service.d.ts +3 -2
- package/types/utils/index.d.ts +2 -1
- package/dist/cjs/components/EditingComponentPlaceholder.js +0 -12
- package/dist/esm/components/EditingComponentPlaceholder.js +0 -5
- package/types/components/EditingComponentPlaceholder.d.ts +0 -4
|
@@ -8,7 +8,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
10
|
import { NextResponse } from 'next/server';
|
|
11
|
-
import { GraphQLPersonalizeService, getPersonalizedRewrite, } from '@sitecore-jss/sitecore-jss/personalize';
|
|
11
|
+
import { GraphQLPersonalizeService, getPersonalizedRewrite, CdpHelper, DEFAULT_VARIANT, } from '@sitecore-jss/sitecore-jss/personalize';
|
|
12
12
|
import { debug } from '@sitecore-jss/sitecore-jss';
|
|
13
13
|
import { MiddlewareBase } from './middleware';
|
|
14
14
|
import { init, personalize } from '@sitecore-cloudsdk/personalize/server';
|
|
@@ -58,6 +58,15 @@ export class PersonalizeMiddleware extends MiddlewareBase {
|
|
|
58
58
|
debug.personalize('skipped (no personalization configured)');
|
|
59
59
|
return response;
|
|
60
60
|
}
|
|
61
|
+
if (this.isPrefetch(req)) {
|
|
62
|
+
debug.personalize('skipped (prefetch)');
|
|
63
|
+
// Personalized, but this is a prefetch request.
|
|
64
|
+
// In this case, don't execute a personalize request; otherwise, the metrics for component A/B experiments would be inaccurate.
|
|
65
|
+
// Disable preflight caching to force revalidation on client-side navigation (personalization WILL be influenced).
|
|
66
|
+
// Note the reason we don't move this any earlier in the middleware is that we would then be sacrificing performance for non-personalized pages.
|
|
67
|
+
response.headers.set('x-middleware-cache', 'no-cache');
|
|
68
|
+
return response;
|
|
69
|
+
}
|
|
61
70
|
yield this.initPersonalizeServer({
|
|
62
71
|
hostname,
|
|
63
72
|
siteName: site.name,
|
|
@@ -65,32 +74,36 @@ export class PersonalizeMiddleware extends MiddlewareBase {
|
|
|
65
74
|
response,
|
|
66
75
|
});
|
|
67
76
|
const params = this.getExperienceParams(req);
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
77
|
+
const executions = this.getPersonalizeExecutions(personalizeInfo, language);
|
|
78
|
+
const identifiedVariantIds = [];
|
|
79
|
+
yield Promise.all(executions.map((execution) => this.personalize({
|
|
80
|
+
friendlyId: execution.friendlyId,
|
|
81
|
+
variantIds: execution.variantIds,
|
|
82
|
+
params,
|
|
83
|
+
language,
|
|
84
|
+
timeout,
|
|
85
|
+
}, req).then((personalization) => {
|
|
86
|
+
const variantId = personalization.variantId;
|
|
87
|
+
if (variantId) {
|
|
88
|
+
if (!execution.variantIds.includes(variantId)) {
|
|
89
|
+
debug.personalize('invalid variant %s', variantId);
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
identifiedVariantIds.push(variantId);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
})));
|
|
96
|
+
if (identifiedVariantIds.length === 0) {
|
|
97
|
+
debug.personalize('skipped (no variant(s) identified)');
|
|
85
98
|
return response;
|
|
86
99
|
}
|
|
87
100
|
// Path can be rewritten by previously executed middleware
|
|
88
101
|
const basePath = (res === null || res === void 0 ? void 0 : res.headers.get('x-sc-rewrite')) || pathname;
|
|
89
102
|
// Rewrite to persononalized path
|
|
90
|
-
const rewritePath = getPersonalizedRewrite(basePath,
|
|
103
|
+
const rewritePath = getPersonalizedRewrite(basePath, identifiedVariantIds);
|
|
91
104
|
response = this.rewrite(rewritePath, req, response);
|
|
92
|
-
// Disable preflight caching to force revalidation on client-side navigation (personalization
|
|
93
|
-
// See https://github.com/vercel/next.js/
|
|
105
|
+
// Disable preflight caching to force revalidation on client-side navigation (personalization MAY be influenced).
|
|
106
|
+
// See https://github.com/vercel/next.js/pull/32767
|
|
94
107
|
response.headers.set('x-middleware-cache', 'no-cache');
|
|
95
108
|
debug.personalize('personalize middleware end in %dms: %o', Date.now() - startTimestamp, {
|
|
96
109
|
rewritePath,
|
|
@@ -129,17 +142,18 @@ export class PersonalizeMiddleware extends MiddlewareBase {
|
|
|
129
142
|
});
|
|
130
143
|
});
|
|
131
144
|
}
|
|
132
|
-
personalize({ params,
|
|
145
|
+
personalize({ params, friendlyId, language, timeout, variantIds, }, request) {
|
|
133
146
|
var _a;
|
|
134
147
|
return __awaiter(this, void 0, void 0, function* () {
|
|
135
|
-
|
|
148
|
+
debug.personalize('executing experience for %s %o', friendlyId, params);
|
|
149
|
+
return (yield personalize(request, {
|
|
136
150
|
channel: this.config.cdpConfig.channel || 'WEB',
|
|
137
151
|
currency: (_a = this.config.cdpConfig.currency) !== null && _a !== void 0 ? _a : 'USD',
|
|
138
|
-
friendlyId
|
|
152
|
+
friendlyId,
|
|
139
153
|
params,
|
|
140
154
|
language,
|
|
141
|
-
|
|
142
|
-
|
|
155
|
+
pageVariantIds: variantIds,
|
|
156
|
+
}, { timeout }));
|
|
143
157
|
});
|
|
144
158
|
}
|
|
145
159
|
getExperienceParams(req) {
|
|
@@ -161,4 +175,50 @@ export class PersonalizeMiddleware extends MiddlewareBase {
|
|
|
161
175
|
// ignore files
|
|
162
176
|
return pathname.includes('.') || super.excludeRoute(pathname);
|
|
163
177
|
}
|
|
178
|
+
/**
|
|
179
|
+
* Aggregates personalize executions based on the provided route personalize information and language
|
|
180
|
+
* @param {PersonalizeInfo} personalizeInfo the route personalize information
|
|
181
|
+
* @param {string} language the language
|
|
182
|
+
* @returns An array of personalize executions
|
|
183
|
+
*/
|
|
184
|
+
getPersonalizeExecutions(personalizeInfo, language) {
|
|
185
|
+
if (personalizeInfo.variantIds.length === 0) {
|
|
186
|
+
return [];
|
|
187
|
+
}
|
|
188
|
+
const results = [];
|
|
189
|
+
return personalizeInfo.variantIds.reduce((results, variantId) => {
|
|
190
|
+
if (variantId.includes('_')) {
|
|
191
|
+
// Component-level personalization in format "<ComponentID>_<VariantID>"
|
|
192
|
+
const componentId = variantId.split('_')[0];
|
|
193
|
+
const friendlyId = CdpHelper.getComponentFriendlyId(personalizeInfo.pageId, componentId, language, this.config.scope || this.config.edgeConfig.scope);
|
|
194
|
+
const execution = results.find((x) => x.friendlyId === friendlyId);
|
|
195
|
+
if (execution) {
|
|
196
|
+
execution.variantIds.push(variantId);
|
|
197
|
+
}
|
|
198
|
+
else {
|
|
199
|
+
// The default/control variant (format "<ComponentID>_default") is also a valid value returned by the execution
|
|
200
|
+
const defaultVariant = `${componentId}${DEFAULT_VARIANT}`;
|
|
201
|
+
results.push({
|
|
202
|
+
friendlyId,
|
|
203
|
+
variantIds: [defaultVariant, variantId],
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
else {
|
|
208
|
+
// Embedded (page-level) personalization in format "<VariantID>"
|
|
209
|
+
const friendlyId = CdpHelper.getPageFriendlyId(personalizeInfo.pageId, language, this.config.scope || this.config.edgeConfig.scope);
|
|
210
|
+
const execution = results.find((x) => x.friendlyId === friendlyId);
|
|
211
|
+
if (execution) {
|
|
212
|
+
execution.variantIds.push(variantId);
|
|
213
|
+
}
|
|
214
|
+
else {
|
|
215
|
+
results.push({
|
|
216
|
+
friendlyId,
|
|
217
|
+
variantIds: [variantId],
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
return results;
|
|
222
|
+
}, results);
|
|
223
|
+
}
|
|
164
224
|
}
|
|
@@ -58,47 +58,40 @@ export class RedirectsMiddleware extends MiddlewareBase {
|
|
|
58
58
|
existsRedirect.target.includes(hostname))) {
|
|
59
59
|
existsRedirect.target = existsRedirect.target.replace(REGEXP_CONTEXT_SITE_LANG, site.language);
|
|
60
60
|
}
|
|
61
|
-
const url = req.nextUrl.clone();
|
|
61
|
+
const url = this.normalizeUrl(req.nextUrl.clone());
|
|
62
62
|
if (REGEXP_ABSOLUTE_URL.test(existsRedirect.target)) {
|
|
63
63
|
url.href = existsRedirect.target;
|
|
64
64
|
}
|
|
65
65
|
else {
|
|
66
|
-
const source = `${url.pathname}${url.search}`;
|
|
67
|
-
url.search = existsRedirect.isQueryStringPreserved ? url.search : '';
|
|
66
|
+
const source = `${url.pathname.replace(/\/*$/gi, '')}${url.search}`;
|
|
68
67
|
const urlFirstPart = existsRedirect.target.split('/')[1];
|
|
69
68
|
if (this.locales.includes(urlFirstPart)) {
|
|
70
|
-
|
|
69
|
+
req.nextUrl.locale = urlFirstPart;
|
|
71
70
|
existsRedirect.target = existsRedirect.target.replace(`/${urlFirstPart}`, '');
|
|
72
71
|
}
|
|
73
72
|
const target = source
|
|
74
73
|
.replace(regexParser(existsRedirect.pattern), existsRedirect.target)
|
|
75
74
|
.replace(/^\/\//, '/')
|
|
76
75
|
.split('?');
|
|
77
|
-
url.pathname = target[0];
|
|
78
76
|
if (target[1]) {
|
|
79
|
-
const
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
}
|
|
77
|
+
const movedSearchParams = existsRedirect.isQueryStringPreserved
|
|
78
|
+
? url.search.replace(/^\?/gi, '&')
|
|
79
|
+
: '';
|
|
80
|
+
url.search = '?' + new URLSearchParams(`${target[1]}${movedSearchParams}`).toString();
|
|
83
81
|
}
|
|
82
|
+
const prepareNewURL = new URL(`${target[0]}${url.search}`, url.origin);
|
|
83
|
+
url.href = prepareNewURL.href;
|
|
84
84
|
}
|
|
85
85
|
const redirectUrl = decodeURIComponent(url.href);
|
|
86
86
|
/** return Response redirect with http code of redirect type **/
|
|
87
87
|
switch (existsRedirect.redirectType) {
|
|
88
88
|
case REDIRECT_TYPE_301:
|
|
89
|
-
return NextResponse.redirect(redirectUrl, {
|
|
90
|
-
status: 301,
|
|
91
|
-
statusText: 'Moved Permanently',
|
|
92
|
-
headers: res === null || res === void 0 ? void 0 : res.headers,
|
|
93
|
-
});
|
|
89
|
+
return NextResponse.redirect(redirectUrl, Object.assign(Object.assign({}, res), { status: 301, statusText: 'Moved Permanently', headers: res === null || res === void 0 ? void 0 : res.headers }));
|
|
94
90
|
case REDIRECT_TYPE_302:
|
|
95
|
-
return NextResponse.redirect(redirectUrl, {
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
});
|
|
100
|
-
case REDIRECT_TYPE_SERVER_TRANSFER:
|
|
101
|
-
return NextResponse.rewrite(redirectUrl, res);
|
|
91
|
+
return NextResponse.redirect(redirectUrl, Object.assign(Object.assign({}, res), { status: 302, statusText: 'Found', headers: res === null || res === void 0 ? void 0 : res.headers }));
|
|
92
|
+
case REDIRECT_TYPE_SERVER_TRANSFER: {
|
|
93
|
+
return this.rewrite(redirectUrl, req, res || NextResponse.next());
|
|
94
|
+
}
|
|
102
95
|
default:
|
|
103
96
|
return res || NextResponse.next();
|
|
104
97
|
}
|
|
@@ -143,8 +136,9 @@ export class RedirectsMiddleware extends MiddlewareBase {
|
|
|
143
136
|
getExistsRedirect(req, siteName) {
|
|
144
137
|
return __awaiter(this, void 0, void 0, function* () {
|
|
145
138
|
const redirects = yield this.redirectsService.fetchRedirects(siteName);
|
|
146
|
-
const
|
|
147
|
-
const
|
|
139
|
+
const normalizedUrl = this.normalizeUrl(req.nextUrl.clone());
|
|
140
|
+
const tragetURL = normalizedUrl.pathname;
|
|
141
|
+
const targetQS = normalizedUrl.search || '';
|
|
148
142
|
const language = this.getLanguage(req);
|
|
149
143
|
const modifyRedirects = structuredClone(redirects);
|
|
150
144
|
return modifyRedirects.length
|
|
@@ -157,7 +151,7 @@ export class RedirectsMiddleware extends MiddlewareBase {
|
|
|
157
151
|
.replace(/(?<!\\)\?/g, '\\?')
|
|
158
152
|
.replace(/\$\/gi$/g, '')}[\/]?$/gi`;
|
|
159
153
|
return ((regexParser(redirect.pattern).test(tragetURL) ||
|
|
160
|
-
regexParser(redirect.pattern).test(`${tragetURL}${targetQS}`) ||
|
|
154
|
+
regexParser(redirect.pattern).test(`${tragetURL.replace(/\/*$/gi, '')}${targetQS}`) ||
|
|
161
155
|
regexParser(redirect.pattern).test(`/${req.nextUrl.locale}${tragetURL}`) ||
|
|
162
156
|
regexParser(redirect.pattern).test(`/${req.nextUrl.locale}${tragetURL}${targetQS}`)) &&
|
|
163
157
|
(redirect.locale
|
|
@@ -167,4 +161,43 @@ export class RedirectsMiddleware extends MiddlewareBase {
|
|
|
167
161
|
: undefined;
|
|
168
162
|
});
|
|
169
163
|
}
|
|
164
|
+
/**
|
|
165
|
+
* When a user clicks on a link generated by the Link component from next/link,
|
|
166
|
+
* Next.js adds special parameters in the route called path.
|
|
167
|
+
* This method removes these special parameters.
|
|
168
|
+
* @param {URL} url
|
|
169
|
+
* @returns {string} normalize url
|
|
170
|
+
*/
|
|
171
|
+
normalizeUrl(url) {
|
|
172
|
+
if (!url.search) {
|
|
173
|
+
return url;
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Prepare special parameters for exclusion.
|
|
177
|
+
*/
|
|
178
|
+
const splittedPathname = url.pathname
|
|
179
|
+
.split('/')
|
|
180
|
+
.filter((route) => route)
|
|
181
|
+
.map((route) => `path=${route}`);
|
|
182
|
+
/**
|
|
183
|
+
* Remove special parameters(Next.JS)
|
|
184
|
+
* Example: /about/contact/us
|
|
185
|
+
* When a user clicks on this link, Next.js should generate a link for the middleware, formatted like this:
|
|
186
|
+
* http://host/about/contact/us?path=about&path=contact&path=us
|
|
187
|
+
*/
|
|
188
|
+
const newQueryString = url.search
|
|
189
|
+
.replace(/^\?/, '')
|
|
190
|
+
.split('&')
|
|
191
|
+
.filter((param) => {
|
|
192
|
+
if (!splittedPathname.includes(param)) {
|
|
193
|
+
return param;
|
|
194
|
+
}
|
|
195
|
+
return false;
|
|
196
|
+
})
|
|
197
|
+
.join('&');
|
|
198
|
+
if (newQueryString) {
|
|
199
|
+
return new URL(`${url.pathname}?${newQueryString}`, url.origin);
|
|
200
|
+
}
|
|
201
|
+
return new URL(`${url.pathname}`, url.origin);
|
|
202
|
+
}
|
|
170
203
|
}
|
|
@@ -144,13 +144,14 @@ export class BaseGraphQLSitemapService {
|
|
|
144
144
|
const formatPath = (path) => formatStaticPath(path.replace(/^\/|\/$/g, '').split('/'), language);
|
|
145
145
|
const aggregatedPaths = [];
|
|
146
146
|
sitePaths.forEach((item) => {
|
|
147
|
-
var _a, _b, _c
|
|
147
|
+
var _a, _b, _c;
|
|
148
148
|
if (!item)
|
|
149
149
|
return;
|
|
150
150
|
aggregatedPaths.push(formatPath(item.path));
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
151
|
+
const variantIds = (_c = (_b = (_a = item.route) === null || _a === void 0 ? void 0 : _a.personalization) === null || _b === void 0 ? void 0 : _b.variantIds) === null || _c === void 0 ? void 0 : _c.filter((variantId) => !variantId.includes('_') // exclude component A/B test variants
|
|
152
|
+
);
|
|
153
|
+
if (variantIds === null || variantIds === void 0 ? void 0 : variantIds.length) {
|
|
154
|
+
aggregatedPaths.push(...variantIds.map((varId) => formatPath(getPersonalizedRewrite(item.path, [varId]))));
|
|
154
155
|
}
|
|
155
156
|
});
|
|
156
157
|
return aggregatedPaths;
|
package/dist/esm/utils/index.js
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
export { getPublicUrl, handleEditorFastRefresh } from './utils';
|
|
2
|
-
export { tryParseEnvValue,
|
|
2
|
+
export { tryParseEnvValue, resolveUrl } from '@sitecore-jss/sitecore-jss/utils';
|
|
3
|
+
export { isEditorActive, resetEditorChromes } from '@sitecore-jss/sitecore-jss/editing';
|
package/dist/esm/utils/utils.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isEditorActive, resetEditorChromes } from '@sitecore-jss/sitecore-jss/
|
|
1
|
+
import { isEditorActive, resetEditorChromes } from '@sitecore-jss/sitecore-jss/editing';
|
|
2
2
|
/**
|
|
3
3
|
* Get the publicUrl.
|
|
4
4
|
* This is used primarily to enable compatibility with Sitecore editors.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sitecore-jss/sitecore-jss-nextjs",
|
|
3
|
-
"version": "22.1.0-canary.
|
|
3
|
+
"version": "22.1.0-canary.81",
|
|
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": ">=20"
|
|
18
18
|
},
|
|
19
19
|
"author": {
|
|
20
20
|
"name": "Sitecore Corporation",
|
|
@@ -29,13 +29,13 @@
|
|
|
29
29
|
"url": "https://github.com/sitecore/jss/issues"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@sitecore-cloudsdk/personalize": "^0.3.
|
|
32
|
+
"@sitecore-cloudsdk/personalize": "^0.3.1",
|
|
33
33
|
"@types/chai": "^4.3.4",
|
|
34
34
|
"@types/chai-as-promised": "^7.1.5",
|
|
35
35
|
"@types/chai-string": "^1.4.2",
|
|
36
36
|
"@types/enzyme": "^3.10.12",
|
|
37
37
|
"@types/mocha": "^10.0.1",
|
|
38
|
-
"@types/node": "~
|
|
38
|
+
"@types/node": "~20.14.2",
|
|
39
39
|
"@types/prop-types": "^15.7.5",
|
|
40
40
|
"@types/react": "^18.2.22",
|
|
41
41
|
"@types/react-dom": "^18.0.10",
|
|
@@ -65,25 +65,24 @@
|
|
|
65
65
|
"typescript": "~4.9.4"
|
|
66
66
|
},
|
|
67
67
|
"peerDependencies": {
|
|
68
|
-
"@sitecore-cloudsdk/events": "^0.3.
|
|
69
|
-
"@sitecore-cloudsdk/personalize": "^0.3.
|
|
68
|
+
"@sitecore-cloudsdk/events": "^0.3.1",
|
|
69
|
+
"@sitecore-cloudsdk/personalize": "^0.3.1",
|
|
70
70
|
"next": "^14.1.0",
|
|
71
71
|
"react": "^18.2.0",
|
|
72
72
|
"react-dom": "^18.2.0"
|
|
73
73
|
},
|
|
74
74
|
"dependencies": {
|
|
75
|
-
"@sitecore-jss/sitecore-jss": "^22.1.0-canary.
|
|
76
|
-
"@sitecore-jss/sitecore-jss-dev-tools": "^22.1.0-canary.
|
|
77
|
-
"@sitecore-jss/sitecore-jss-react": "^22.1.0-canary.
|
|
75
|
+
"@sitecore-jss/sitecore-jss": "^22.1.0-canary.81",
|
|
76
|
+
"@sitecore-jss/sitecore-jss-dev-tools": "^22.1.0-canary.81",
|
|
77
|
+
"@sitecore-jss/sitecore-jss-react": "^22.1.0-canary.81",
|
|
78
78
|
"@vercel/kv": "^0.2.1",
|
|
79
|
-
"node-html-parser": "^6.1.4",
|
|
80
79
|
"prop-types": "^15.8.1",
|
|
81
80
|
"regex-parser": "^2.2.11",
|
|
82
81
|
"sync-disk-cache": "^2.1.0"
|
|
83
82
|
},
|
|
84
83
|
"description": "",
|
|
85
84
|
"types": "types/index.d.ts",
|
|
86
|
-
"gitHead": "
|
|
85
|
+
"gitHead": "fa64d44410d3369f17e9da3293ac38b95cb101f2",
|
|
87
86
|
"files": [
|
|
88
87
|
"dist",
|
|
89
88
|
"types",
|
|
@@ -1,18 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
import { ComponentFactory } from '@sitecore-jss/sitecore-jss-react';
|
|
1
|
+
import { ComponentFactory, JssComponentType } from '@sitecore-jss/sitecore-jss-react';
|
|
3
2
|
import { Module, ModuleFactory } from './sharedTypes/module-factory';
|
|
4
|
-
import { ComponentType } from 'react';
|
|
5
3
|
/**
|
|
6
4
|
* Represents a component that can be imported dynamically
|
|
7
5
|
*/
|
|
8
6
|
export type LazyModule = {
|
|
9
7
|
module: () => Promise<Module>;
|
|
10
|
-
element: (isEditing?: boolean) =>
|
|
8
|
+
element: (isEditing?: boolean) => JssComponentType;
|
|
11
9
|
};
|
|
12
10
|
/**
|
|
13
11
|
* Component is a module or a lazy module
|
|
14
12
|
*/
|
|
15
|
-
type Component = Module | LazyModule |
|
|
13
|
+
type Component = Module | LazyModule | JssComponentType;
|
|
16
14
|
/**
|
|
17
15
|
* Configuration for ComponentBuilder
|
|
18
16
|
*/
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
/// <reference types="@types/react" />
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import { PlaceholderComponentProps } from '@sitecore-jss/sitecore-jss-react';
|
|
4
|
-
|
|
3
|
+
import { PlaceholderComponentProps, WithSitecoreContextProps, EnhancedOmit } from '@sitecore-jss/sitecore-jss-react';
|
|
4
|
+
/**
|
|
5
|
+
* React Placeholder component wrapped by withSitecoreContext, so these properties shouldn't be passed to the Next.js Placeholder.
|
|
6
|
+
*/
|
|
7
|
+
type PlaceholderProps = EnhancedOmit<PlaceholderComponentProps, keyof WithSitecoreContextProps>;
|
|
8
|
+
export declare const Placeholder: (props: PlaceholderProps) => React.JSX.Element;
|
|
9
|
+
export {};
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
/// <reference types="@types/react" />
|
|
2
|
+
import React from 'react';
|
|
1
3
|
import PropTypes from 'prop-types';
|
|
2
4
|
import { RichTextProps as ReactRichTextProps } from '@sitecore-jss/sitecore-jss-react';
|
|
3
5
|
export type RichTextProps = ReactRichTextProps & {
|
|
@@ -19,9 +21,13 @@ export declare const RichText: {
|
|
|
19
21
|
field: PropTypes.Requireable<PropTypes.InferProps<{
|
|
20
22
|
value: PropTypes.Requireable<string>;
|
|
21
23
|
editable: PropTypes.Requireable<string>;
|
|
24
|
+
metadata: PropTypes.Requireable<{
|
|
25
|
+
[x: string]: any;
|
|
26
|
+
}>;
|
|
22
27
|
}>>;
|
|
23
28
|
tag: PropTypes.Requireable<string>;
|
|
24
29
|
editable: PropTypes.Requireable<boolean>;
|
|
30
|
+
emptyFieldEditingComponent: PropTypes.Requireable<NonNullable<React.ComponentClass<unknown, any> | React.FC<unknown>>>;
|
|
25
31
|
internalLinksSelector: PropTypes.Requireable<string>;
|
|
26
32
|
};
|
|
27
33
|
displayName: string;
|
|
@@ -1,3 +1,12 @@
|
|
|
1
1
|
export declare const QUERY_PARAM_EDITING_SECRET = "secret";
|
|
2
|
-
export declare const
|
|
3
|
-
export declare const
|
|
2
|
+
export declare const QUERY_PARAM_VERCEL_PROTECTION_BYPASS = "x-vercel-protection-bypass";
|
|
3
|
+
export declare const QUERY_PARAM_VERCEL_SET_BYPASS_COOKIE = "x-vercel-set-bypass-cookie";
|
|
4
|
+
/**
|
|
5
|
+
* Headers that should be passed along to (Editing Chromes handler) SSR request.
|
|
6
|
+
* Note these are in lowercase format to match expected `IncomingHttpHeaders`.
|
|
7
|
+
*/
|
|
8
|
+
export declare const EDITING_PASS_THROUGH_HEADERS: string[];
|
|
9
|
+
/**
|
|
10
|
+
* Default allowed origins for editing requests. This is used to enforce CORS, CSP headers.
|
|
11
|
+
*/
|
|
12
|
+
export declare const EDITING_ALLOWED_ORIGINS: string[];
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { NextApiRequest, NextApiResponse } from 'next';
|
|
2
|
+
import { EditMode } from '@sitecore-jss/sitecore-jss/layout';
|
|
2
3
|
import { Metadata } from '@sitecore-jss/sitecore-jss-dev-tools';
|
|
3
4
|
export type EditingConfigMiddlewareConfig = {
|
|
4
5
|
/**
|
|
@@ -9,6 +10,12 @@ export type EditingConfigMiddlewareConfig = {
|
|
|
9
10
|
* Application metadata
|
|
10
11
|
*/
|
|
11
12
|
metadata: Metadata;
|
|
13
|
+
/**
|
|
14
|
+
* Determines which editing mode should be used by Pages.
|
|
15
|
+
* Can be either 'chromes' or 'metadata'.
|
|
16
|
+
* By default its 'metadata'
|
|
17
|
+
*/
|
|
18
|
+
pagesEditMode?: EditMode;
|
|
12
19
|
};
|
|
13
20
|
/**
|
|
14
21
|
* Middleware / handler used in the editing config API route in xmcloud add on (e.g. '/api/editing/config')
|