@sitecore-content-sdk/nextjs 1.4.0-canary.16 → 1.4.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/cjs/client/sitecore-nextjs-client.js +1 -1
- package/dist/cjs/editing/feaas-render-middleware.js +1 -1
- package/dist/cjs/middleware/index.js +1 -24
- package/dist/cjs/{middleware/app-router-multisite-middleware.js → proxy/app-router-multisite-proxy.js} +8 -8
- package/dist/cjs/proxy/index.js +26 -0
- package/dist/cjs/{middleware/locale-middleware.js → proxy/locale-proxy.js} +13 -13
- package/dist/cjs/{middleware/multisite-middleware.js → proxy/multisite-proxy.js} +16 -16
- package/dist/cjs/{middleware/personalize-middleware.js → proxy/personalize-proxy.js} +18 -18
- package/dist/cjs/{middleware/middleware.js → proxy/proxy.js} +25 -25
- package/dist/cjs/{middleware/redirects-middleware.js → proxy/redirects-proxy.js} +32 -26
- package/dist/cjs/route-handler/robots-route-handler.js +6 -1
- package/dist/cjs/route-handler/sitemap-route-handler.js +6 -1
- package/dist/cjs/utils/utils.js +2 -2
- package/dist/esm/client/sitecore-nextjs-client.js +1 -1
- package/dist/esm/editing/feaas-render-middleware.js +1 -1
- package/dist/esm/middleware/index.js +0 -9
- package/dist/esm/{middleware/app-router-multisite-middleware.js → proxy/app-router-multisite-proxy.js} +6 -6
- package/dist/esm/proxy/index.js +9 -0
- package/dist/esm/{middleware/locale-middleware.js → proxy/locale-proxy.js} +10 -10
- package/dist/esm/{middleware/multisite-middleware.js → proxy/multisite-proxy.js} +13 -13
- package/dist/esm/{middleware/personalize-middleware.js → proxy/personalize-proxy.js} +15 -15
- package/dist/esm/{middleware/middleware.js → proxy/proxy.js} +21 -21
- package/dist/esm/{middleware/redirects-middleware.js → proxy/redirects-proxy.js} +28 -22
- package/dist/esm/route-handler/robots-route-handler.js +6 -1
- package/dist/esm/route-handler/sitemap-route-handler.js +6 -1
- package/dist/esm/utils/utils.js +1 -1
- package/package.json +12 -7
- package/proxy.d.ts +1 -0
- package/types/editing/editing-config-middleware.d.ts.map +1 -1
- package/types/editing/feaas-render-middleware.d.ts +1 -1
- package/types/middleware/index.d.ts +0 -9
- package/types/middleware/index.d.ts.map +1 -1
- package/types/{middleware/app-router-multisite-middleware.d.ts → proxy/app-router-multisite-proxy.d.ts} +6 -6
- package/types/proxy/app-router-multisite-proxy.d.ts.map +1 -0
- package/types/proxy/index.d.ts +10 -0
- package/types/proxy/index.d.ts.map +1 -0
- package/types/proxy/locale-proxy.d.ts +35 -0
- package/types/proxy/locale-proxy.d.ts.map +1 -0
- package/types/{middleware/multisite-middleware.d.ts → proxy/multisite-proxy.d.ts} +11 -11
- package/types/proxy/multisite-proxy.d.ts.map +1 -0
- package/types/{middleware/personalize-middleware.d.ts → proxy/personalize-proxy.d.ts} +9 -9
- package/types/proxy/personalize-proxy.d.ts.map +1 -0
- package/types/{middleware/middleware.d.ts → proxy/proxy.d.ts} +22 -24
- package/types/proxy/proxy.d.ts.map +1 -0
- package/types/{middleware/redirects-middleware.d.ts → proxy/redirects-proxy.d.ts} +10 -10
- package/types/proxy/redirects-proxy.d.ts.map +1 -0
- package/types/route-handler/robots-route-handler.d.ts.map +1 -1
- package/types/route-handler/sitemap-route-handler.d.ts.map +1 -1
- package/types/middleware/app-router-multisite-middleware.d.ts.map +0 -1
- package/types/middleware/locale-middleware.d.ts +0 -35
- package/types/middleware/locale-middleware.d.ts.map +0 -1
- package/types/middleware/middleware.d.ts.map +0 -1
- package/types/middleware/multisite-middleware.d.ts.map +0 -1
- package/types/middleware/personalize-middleware.d.ts.map +0 -1
- package/types/middleware/redirects-middleware.d.ts.map +0 -1
|
@@ -14,16 +14,16 @@ import { createGraphQLClientFactory, } from '@sitecore-content-sdk/core/client';
|
|
|
14
14
|
export const REWRITE_HEADER_NAME = 'x-sc-rewrite';
|
|
15
15
|
export const LOCALE_HEADER_NAME = 'x-sc-locale';
|
|
16
16
|
/**
|
|
17
|
-
*
|
|
17
|
+
* Proxy handler class to be extended by all proxy implementations
|
|
18
18
|
* @public
|
|
19
19
|
*/
|
|
20
|
-
export class
|
|
20
|
+
export class ProxyHandler {
|
|
21
21
|
}
|
|
22
22
|
/**
|
|
23
|
-
* Base
|
|
23
|
+
* Base proxy class with common methods
|
|
24
24
|
* @public
|
|
25
25
|
*/
|
|
26
|
-
export class
|
|
26
|
+
export class ProxyBase extends ProxyHandler {
|
|
27
27
|
constructor(config) {
|
|
28
28
|
super();
|
|
29
29
|
this.config = config;
|
|
@@ -60,14 +60,14 @@ export class MiddlewareBase extends Middleware {
|
|
|
60
60
|
const isKnownDevice = isMobile || isKnownPlatform;
|
|
61
61
|
const purpose = req.headers.get('purpose');
|
|
62
62
|
const nextRouterPrefetch = req.headers.get('Next-Router-Prefetch');
|
|
63
|
-
const
|
|
63
|
+
const proxyPrefetch = req.headers.get('x-middleware-prefetch');
|
|
64
64
|
// Some real navigations on different devices may incorrectly include 'prefetch' headers.
|
|
65
65
|
// To avoid skipping personalization in such cases, we treat 'x-middleware-prefetch' as a more reliable signal of true prefetch behavior.
|
|
66
|
-
if (isKnownDevice &&
|
|
66
|
+
if (isKnownDevice && proxyPrefetch === '1') {
|
|
67
67
|
return false;
|
|
68
68
|
}
|
|
69
69
|
// Otherwise, standard prefetch detection
|
|
70
|
-
return purpose === 'prefetch' || nextRouterPrefetch === '1' ||
|
|
70
|
+
return purpose === 'prefetch' || nextRouterPrefetch === '1' || proxyPrefetch === '1';
|
|
71
71
|
}
|
|
72
72
|
disabled(req, res) {
|
|
73
73
|
const { pathname } = req.nextUrl;
|
|
@@ -78,7 +78,7 @@ export class MiddlewareBase extends Middleware {
|
|
|
78
78
|
}
|
|
79
79
|
/**
|
|
80
80
|
* Safely extract all headers for debug logging
|
|
81
|
-
* Necessary to avoid
|
|
81
|
+
* Necessary to avoid proxy issue https://github.com/vercel/next.js/issues/39765
|
|
82
82
|
* @param {Headers} incomingHeaders Incoming headers
|
|
83
83
|
* @returns Object with headers as key/value pairs
|
|
84
84
|
*/
|
|
@@ -102,7 +102,7 @@ export class MiddlewareBase extends Middleware {
|
|
|
102
102
|
}
|
|
103
103
|
/**
|
|
104
104
|
* Extract language from locale header of the response
|
|
105
|
-
* set by
|
|
105
|
+
* set by LocaleProxy for app router application
|
|
106
106
|
* @param {NextResponse} res response
|
|
107
107
|
* @returns {string | undefined} language or undefined if not found
|
|
108
108
|
*/
|
|
@@ -156,8 +156,9 @@ export class MiddlewareBase extends Middleware {
|
|
|
156
156
|
// Note an absolute URL is required: https://nextjs.org/docs/messages/middleware-relative-urls
|
|
157
157
|
const rewriteUrl = req.nextUrl.clone();
|
|
158
158
|
rewriteUrl.pathname = rewritePath;
|
|
159
|
-
|
|
160
|
-
|
|
159
|
+
// NextResponse.rewrite requires a string URL, not a NextURL object
|
|
160
|
+
const response = NextResponse.rewrite(rewriteUrl.href, res);
|
|
161
|
+
// Share rewrite path with following executed proxies
|
|
161
162
|
if (!skipHeader) {
|
|
162
163
|
response.headers.set(REWRITE_HEADER_NAME, rewritePath);
|
|
163
164
|
}
|
|
@@ -165,25 +166,24 @@ export class MiddlewareBase extends Middleware {
|
|
|
165
166
|
}
|
|
166
167
|
}
|
|
167
168
|
/**
|
|
168
|
-
* Define a
|
|
169
|
-
* @param {
|
|
169
|
+
* Define a proxy with a list of proxy handlers
|
|
170
|
+
* @param {ProxyHandler[]} proxies List of proxy handlers to execute
|
|
170
171
|
* @public
|
|
171
172
|
*/
|
|
172
|
-
export const
|
|
173
|
+
export const defineProxy = (...proxies) => {
|
|
173
174
|
return {
|
|
174
175
|
/**
|
|
175
|
-
* Execute all
|
|
176
|
+
* Execute all proxies
|
|
176
177
|
* @param {NextRequest} req request
|
|
177
|
-
* @param {NextFetchEvent} ev fetch event
|
|
178
178
|
* @param {NextResponse} [res] response
|
|
179
179
|
*/
|
|
180
|
-
exec: (req,
|
|
180
|
+
exec: (req, res) => __awaiter(void 0, void 0, void 0, function* () {
|
|
181
181
|
const response = res || NextResponse.next();
|
|
182
|
-
debug.common('
|
|
182
|
+
debug.common('proxy start');
|
|
183
183
|
const start = Date.now();
|
|
184
|
-
const
|
|
185
|
-
debug.common('
|
|
186
|
-
return
|
|
184
|
+
const proxyResponse = yield proxies.reduce((p, proxy) => p.then((res) => proxy.handle(req, res)), Promise.resolve(response));
|
|
185
|
+
debug.common('proxy end in %dms', Date.now() - start);
|
|
186
|
+
return proxyResponse;
|
|
187
187
|
}),
|
|
188
188
|
};
|
|
189
189
|
};
|
|
@@ -12,25 +12,24 @@ import { RedirectsService, REDIRECT_TYPE_301, REDIRECT_TYPE_302, REDIRECT_TYPE_S
|
|
|
12
12
|
import { areURLSearchParamsEqual, escapeNonSpecialQuestionMarks, isRegexOrUrl, mergeURLSearchParams, } from '@sitecore-content-sdk/core/utils';
|
|
13
13
|
import { NextResponse } from 'next/server';
|
|
14
14
|
import regexParser from 'regex-parser';
|
|
15
|
-
import {
|
|
15
|
+
import { ProxyBase, REWRITE_HEADER_NAME } from './proxy';
|
|
16
16
|
const REGEXP_CONTEXT_SITE_LANG = new RegExp(/\$siteLang/, 'i');
|
|
17
17
|
const REGEXP_ABSOLUTE_URL = new RegExp('^(?:[a-z]+:)?//', 'i');
|
|
18
18
|
/**
|
|
19
|
-
*
|
|
19
|
+
* Proxy / handler fetches all redirects from Sitecore instance by grapqhl service
|
|
20
20
|
* compares with current url and redirects to target url
|
|
21
21
|
* @public
|
|
22
22
|
*/
|
|
23
|
-
export class
|
|
23
|
+
export class RedirectsProxy extends ProxyBase {
|
|
24
24
|
/**
|
|
25
|
-
* @param {
|
|
25
|
+
* @param {RedirectsProxyConfig} [config] redirects proxy config
|
|
26
26
|
*/
|
|
27
27
|
constructor(config) {
|
|
28
|
-
var _a;
|
|
29
28
|
super(config);
|
|
30
29
|
this.config = config;
|
|
31
30
|
this.handle = (req, res) => __awaiter(this, void 0, void 0, function* () {
|
|
32
31
|
if (!this.config.enabled) {
|
|
33
|
-
debug.redirects('skipped (redirects
|
|
32
|
+
debug.redirects('skipped (redirects proxy is disabled globally)');
|
|
34
33
|
return res;
|
|
35
34
|
}
|
|
36
35
|
try {
|
|
@@ -39,13 +38,13 @@ export class RedirectsMiddleware extends MiddlewareBase {
|
|
|
39
38
|
const hostname = this.getHostHeader(req) || this.defaultHostname;
|
|
40
39
|
let site;
|
|
41
40
|
const startTimestamp = Date.now();
|
|
42
|
-
debug.redirects('redirects
|
|
41
|
+
debug.redirects('redirects proxy start: %o', {
|
|
43
42
|
pathname,
|
|
44
43
|
language,
|
|
45
44
|
hostname,
|
|
46
45
|
});
|
|
47
46
|
if (this.disabled(req, res)) {
|
|
48
|
-
debug.redirects('skipped (redirects
|
|
47
|
+
debug.redirects('skipped (redirects proxy is disabled)');
|
|
49
48
|
return res;
|
|
50
49
|
}
|
|
51
50
|
const isAppRouterRequest = this.isAppRouter(res);
|
|
@@ -55,10 +54,10 @@ export class RedirectsMiddleware extends MiddlewareBase {
|
|
|
55
54
|
return false;
|
|
56
55
|
}
|
|
57
56
|
// Skip prefetch requests from Next.js, which are not original client requests
|
|
58
|
-
// as they load unnecessary requests that burden the redirects
|
|
57
|
+
// as they load unnecessary requests that burden the redirects proxy with meaningless traffic
|
|
59
58
|
if (this.isPrefetch(req)) {
|
|
60
59
|
debug.redirects('skipped (prefetch)');
|
|
61
|
-
res.headers.set('x-
|
|
60
|
+
res.headers.set('x-proxy-cache', 'no-cache');
|
|
62
61
|
res.headers.set('Cache-Control', 'no-store, must-revalidate');
|
|
63
62
|
return false;
|
|
64
63
|
}
|
|
@@ -135,7 +134,7 @@ export class RedirectsMiddleware extends MiddlewareBase {
|
|
|
135
134
|
const redirectedResponse = REGEXP_ABSOLUTE_URL.test(existsRedirect.target)
|
|
136
135
|
? processAbsoluteUrlTarget(reqUrl, existsRedirect)
|
|
137
136
|
: processRelativeUrlTarget(reqUrl, existsRedirect);
|
|
138
|
-
debug.redirects('redirects
|
|
137
|
+
debug.redirects('redirects proxy end in %dms: %o', Date.now() - startTimestamp, {
|
|
139
138
|
redirected: redirectedResponse.redirected,
|
|
140
139
|
status: redirectedResponse.status,
|
|
141
140
|
url: redirectedResponse.url,
|
|
@@ -144,17 +143,22 @@ export class RedirectsMiddleware extends MiddlewareBase {
|
|
|
144
143
|
return redirectedResponse;
|
|
145
144
|
}
|
|
146
145
|
catch (error) {
|
|
147
|
-
console.log('Redirect
|
|
146
|
+
console.log('Redirect proxy failed:');
|
|
148
147
|
console.log(error);
|
|
149
148
|
return res;
|
|
150
149
|
}
|
|
151
150
|
});
|
|
152
151
|
this.locales = config.locales;
|
|
152
|
+
// If redirectsService is provided directly (e.g., for testing), use it
|
|
153
|
+
if (this.config.redirectsService) {
|
|
154
|
+
this.redirectsService = this.config.redirectsService;
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
153
157
|
// Validate API config is present - redirects requires either Edge or local API configuration
|
|
154
158
|
const hasEdgeConfig = !!(this.config.contextId || this.config.clientContextId);
|
|
155
159
|
const hasLocalConfig = !!(this.config.apiHost && this.config.apiKey);
|
|
156
160
|
if (!hasEdgeConfig && !hasLocalConfig) {
|
|
157
|
-
console.warn('[
|
|
161
|
+
console.warn('[RedirectsProxy] Redirects proxy requires either Edge configuration (contextId/clientContextId) or local API configuration (apiHost/apiKey). ' +
|
|
158
162
|
'Redirects features will be disabled. This is expected when API configuration is not available.');
|
|
159
163
|
// Set to null to indicate service is disabled
|
|
160
164
|
this.redirectsService = null;
|
|
@@ -177,16 +181,16 @@ export class RedirectsMiddleware extends MiddlewareBase {
|
|
|
177
181
|
};
|
|
178
182
|
// NOTE: we provide native fetch for compatibility on Next.js Edge Runtime
|
|
179
183
|
// (underlying default 'cross-fetch' is not currently compatible: https://github.com/lquixada/cross-fetch/issues/78)
|
|
180
|
-
this.redirectsService =
|
|
181
|
-
(_a = this.config.redirectsService) !== null && _a !== void 0 ? _a : new RedirectsService(Object.assign(Object.assign({}, config), { clientFactory: this.getClientFactory(graphQLOptions), fetch: fetch }));
|
|
184
|
+
this.redirectsService = new RedirectsService(Object.assign(Object.assign({}, config), { clientFactory: this.getClientFactory(graphQLOptions), fetch: fetch }));
|
|
182
185
|
}
|
|
183
186
|
disabled(req, res) {
|
|
184
|
-
// Check if API config is missing - if so, disable the
|
|
187
|
+
// Check if API config is missing - if so, disable the proxy
|
|
185
188
|
if (!this.redirectsService) {
|
|
186
189
|
debug.redirects('skipped (redirects service not configured - API config required)');
|
|
187
190
|
return true;
|
|
188
191
|
}
|
|
189
|
-
|
|
192
|
+
// ignore files
|
|
193
|
+
return req.nextUrl.pathname.includes('.') || super.disabled(req, res);
|
|
190
194
|
}
|
|
191
195
|
/**
|
|
192
196
|
* Method returns RedirectInfo when matches
|
|
@@ -275,7 +279,7 @@ export class RedirectsMiddleware extends MiddlewareBase {
|
|
|
275
279
|
/**
|
|
276
280
|
* Remove special parameters(Next.JS)
|
|
277
281
|
* Example: /about/contact/us
|
|
278
|
-
* When a user clicks on this link, Next.js should generate a link for the
|
|
282
|
+
* When a user clicks on this link, Next.js should generate a link for the proxy, formatted like this:
|
|
279
283
|
* http://host/about/contact/us?path=about&path=contact&path=us
|
|
280
284
|
*/
|
|
281
285
|
const newQueryString = url.search
|
|
@@ -349,7 +353,7 @@ export class RedirectsMiddleware extends MiddlewareBase {
|
|
|
349
353
|
}
|
|
350
354
|
}
|
|
351
355
|
/**
|
|
352
|
-
* Helper function to create a redirect response and remove the x-
|
|
356
|
+
* Helper function to create a redirect response and remove the x-proxy-next header.
|
|
353
357
|
* @param {NextURL | string} url The URL to redirect to.
|
|
354
358
|
* @param {Response} res The response object.
|
|
355
359
|
* @param {number} status The HTTP status code of the redirect.
|
|
@@ -357,14 +361,16 @@ export class RedirectsMiddleware extends MiddlewareBase {
|
|
|
357
361
|
* @returns {NextResponse<unknown>} The redirect response.
|
|
358
362
|
*/
|
|
359
363
|
createRedirectResponse(url, res, status, statusText) {
|
|
360
|
-
|
|
364
|
+
// Convert NextURL to string if needed - NextResponse.redirect requires a string URL
|
|
365
|
+
const urlString = typeof url === 'string' ? url : url.href;
|
|
366
|
+
const redirect = NextResponse.redirect(urlString, {
|
|
361
367
|
status,
|
|
362
368
|
statusText,
|
|
363
369
|
headers: res === null || res === void 0 ? void 0 : res.headers,
|
|
364
370
|
});
|
|
365
371
|
if (res === null || res === void 0 ? void 0 : res.headers) {
|
|
366
|
-
redirect.headers.delete('x-
|
|
367
|
-
redirect.headers.delete('x-
|
|
372
|
+
redirect.headers.delete('x-proxy-next');
|
|
373
|
+
redirect.headers.delete('x-proxy-rewrite');
|
|
368
374
|
redirect.headers.delete(REWRITE_HEADER_NAME);
|
|
369
375
|
}
|
|
370
376
|
return redirect;
|
|
@@ -28,11 +28,12 @@ export const createRobotsRouteHandler = (options) => {
|
|
|
28
28
|
const GET = (req) => __awaiter(void 0, void 0, void 0, function* () {
|
|
29
29
|
var _a;
|
|
30
30
|
try {
|
|
31
|
-
const startTimestamp = Date.now();
|
|
32
31
|
const hostName = req.headers.get('x-forwarded-host') ||
|
|
33
32
|
((_a = req.headers.get('host')) === null || _a === void 0 ? void 0 : _a.split(':')[0]) ||
|
|
34
33
|
'localhost';
|
|
35
34
|
const site = siteResolver.getByHost(hostName);
|
|
35
|
+
// Access request data first, then capture timestamp for Next.js 16 compatibility
|
|
36
|
+
const startTimestamp = Date.now();
|
|
36
37
|
debug.robots('robots route handler start: %o', {
|
|
37
38
|
hostName,
|
|
38
39
|
siteName: site.name,
|
|
@@ -56,6 +57,10 @@ export const createRobotsRouteHandler = (options) => {
|
|
|
56
57
|
});
|
|
57
58
|
}
|
|
58
59
|
catch (error) {
|
|
60
|
+
// Re-throw prerender bail-out errors so Next.js can handle them properly
|
|
61
|
+
if (error instanceof Error && error.digest === 'NEXT_PRERENDER_INTERRUPTED') {
|
|
62
|
+
throw error;
|
|
63
|
+
}
|
|
59
64
|
console.log('Robots route handler failed:');
|
|
60
65
|
console.log(error);
|
|
61
66
|
return new Response('Internal Server Error', {
|
|
@@ -35,8 +35,9 @@ export function createSitemapRouteHandler(options) {
|
|
|
35
35
|
});
|
|
36
36
|
const GET = (req) => __awaiter(this, void 0, void 0, function* () {
|
|
37
37
|
try {
|
|
38
|
-
const startTimestamp = Date.now();
|
|
39
38
|
const options = getOptions(req);
|
|
39
|
+
// Access request data first, then capture timestamp for Next.js 16 compatibility
|
|
40
|
+
const startTimestamp = Date.now();
|
|
40
41
|
debug.sitemap('sitemap route handler start: %o', {
|
|
41
42
|
options,
|
|
42
43
|
});
|
|
@@ -49,6 +50,10 @@ export function createSitemapRouteHandler(options) {
|
|
|
49
50
|
});
|
|
50
51
|
}
|
|
51
52
|
catch (error) {
|
|
53
|
+
// Re-throw prerender bail-out errors so Next.js can handle them properly
|
|
54
|
+
if (error instanceof Error && error.digest === 'NEXT_PRERENDER_INTERRUPTED') {
|
|
55
|
+
throw error;
|
|
56
|
+
}
|
|
52
57
|
console.log('Sitemap route handler failed:');
|
|
53
58
|
console.log(error);
|
|
54
59
|
if (error instanceof Error && error.message === 'REDIRECT_404') {
|
package/dist/esm/utils/utils.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { isEditorActive, resetEditorChromes } from '@sitecore-content-sdk/core/editing';
|
|
2
|
-
import { REWRITE_HEADER_NAME } from '../
|
|
2
|
+
import { REWRITE_HEADER_NAME } from '../proxy/proxy';
|
|
3
3
|
/**
|
|
4
4
|
* Since Sitecore editors do not support Fast Refresh:
|
|
5
5
|
* 1. Subscribe on events provided by webpack.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sitecore-content-sdk/nextjs",
|
|
3
|
-
"version": "1.4.0-canary.
|
|
3
|
+
"version": "1.4.0-canary.17",
|
|
4
4
|
"main": "dist/cjs/index.js",
|
|
5
5
|
"module": "dist/esm/index.js",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"test": "mocha --require ./test/setup.js \"./src/**/*.test.ts\" \"./src/**/*.test.tsx\" --exit",
|
|
16
16
|
"prepublishOnly": "npm run build",
|
|
17
17
|
"coverage": "nyc npm test",
|
|
18
|
-
"generate-docs": "npx typedoc --plugin typedoc-plugin-markdown --outputFileStrategy Members --parametersFormat table --readme none --out ../../ref-docs/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/client/index.ts --entryPoints src/tools/index.ts --entryPoints src/editing/codegen/index.ts --entryPoints src/route-handler/index.ts --githubPages false",
|
|
18
|
+
"generate-docs": "npx typedoc --plugin typedoc-plugin-markdown --outputFileStrategy Members --parametersFormat table --readme none --out ../../ref-docs/nextjs --entryPoints src/index.ts --entryPoints src/monitoring/index.ts --entryPoints src/editing/index.ts --entryPoints src/proxy/index.ts --entryPoints src/middleware/index.ts --entryPoints src/context/index.ts --entryPoints src/utils/index.ts --entryPoints src/site/index.ts --entryPoints src/client/index.ts --entryPoints src/tools/index.ts --entryPoints src/editing/codegen/index.ts --entryPoints src/route-handler/index.ts --githubPages false",
|
|
19
19
|
"api-extractor": "npm run build && api-extractor run --local --verbose",
|
|
20
20
|
"api-extractor:verify": "api-extractor run"
|
|
21
21
|
},
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"glob": "^11.0.2",
|
|
64
64
|
"jsdom": "^26.1.0",
|
|
65
65
|
"mocha": "^11.2.2",
|
|
66
|
-
"next": "^
|
|
66
|
+
"next": "^16.1.1",
|
|
67
67
|
"nock": "14.0.0-beta.7",
|
|
68
68
|
"nyc": "^17.1.0",
|
|
69
69
|
"prettier": "^2.8.0",
|
|
@@ -79,7 +79,7 @@
|
|
|
79
79
|
"@sitecore-cloudsdk/core": "^0.5.1",
|
|
80
80
|
"@sitecore-cloudsdk/events": "^0.5.1",
|
|
81
81
|
"@sitecore-cloudsdk/personalize": "^0.5.1",
|
|
82
|
-
"next": "^
|
|
82
|
+
"next": "^16.1.1",
|
|
83
83
|
"react": "^19.2.1",
|
|
84
84
|
"react-dom": "^19.2.1",
|
|
85
85
|
"typescript": "^5.4.0"
|
|
@@ -91,8 +91,8 @@
|
|
|
91
91
|
},
|
|
92
92
|
"dependencies": {
|
|
93
93
|
"@babel/parser": "^7.27.2",
|
|
94
|
-
"@sitecore-content-sdk/core": "1.4.0-canary.
|
|
95
|
-
"@sitecore-content-sdk/react": "1.4.0-canary.
|
|
94
|
+
"@sitecore-content-sdk/core": "1.4.0-canary.17",
|
|
95
|
+
"@sitecore-content-sdk/react": "1.4.0-canary.17",
|
|
96
96
|
"recast": "^0.23.11",
|
|
97
97
|
"regex-parser": "^2.3.1",
|
|
98
98
|
"sync-disk-cache": "^2.1.0"
|
|
@@ -133,6 +133,11 @@
|
|
|
133
133
|
"require": "./dist/cjs/editing/index.js",
|
|
134
134
|
"types": "./types/editing/index.d.ts"
|
|
135
135
|
},
|
|
136
|
+
"./proxy": {
|
|
137
|
+
"import": "./dist/esm/proxy/index.js",
|
|
138
|
+
"require": "./dist/cjs/proxy/index.js",
|
|
139
|
+
"types": "./types/proxy/index.d.ts"
|
|
140
|
+
},
|
|
136
141
|
"./middleware": {
|
|
137
142
|
"import": "./dist/esm/middleware/index.js",
|
|
138
143
|
"require": "./dist/cjs/middleware/index.js",
|
|
@@ -171,7 +176,7 @@
|
|
|
171
176
|
},
|
|
172
177
|
"description": "",
|
|
173
178
|
"types": "types/index.d.ts",
|
|
174
|
-
"gitHead": "
|
|
179
|
+
"gitHead": "c9137ad2f4478d4fe51195b43cde55440cbfde5a",
|
|
175
180
|
"files": [
|
|
176
181
|
"dist",
|
|
177
182
|
"types",
|
package/proxy.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './types/proxy/index';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"editing-config-middleware.d.ts","sourceRoot":"","sources":["../../src/editing/editing-config-middleware.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"editing-config-middleware.d.ts","sourceRoot":"","sources":["../../src/editing/editing-config-middleware.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,MAAM,CAAC;AAMvD,OAAO,EAAE,QAAQ,EAAE,MAAM,oCAAoC,CAAC;AAI9D,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAE3E;;;GAGG;AACH,MAAM,MAAM,6BAA6B,GAAG;IAC1C;;OAEG;IACH,UAAU,EAAE,YAAY,CAAC,yBAAyB,CAAC,CAAC;IACpD;;OAEG;IACH,QAAQ,EAAE,QAAQ,CAAC;CACpB,CAAC;AAEF;;;;GAIG;AACH,qBAAa,uBAAuB;IAItB,SAAS,CAAC,MAAM,EAAE,6BAA6B;IAH3D;;OAEG;gBACmB,MAAM,EAAE,6BAA6B;IAE3D;;;OAGG;IACI,UAAU,IAAI,CAAC,GAAG,EAAE,cAAc,EAAE,GAAG,EAAE,eAAe,KAAK,OAAO,CAAC,IAAI,CAAC;IAIjF,OAAO,CAAC,OAAO,CAsCb;CACH"}
|
|
@@ -22,7 +22,7 @@ export declare class FEAASRenderMiddleware extends RenderMiddlewareBase {
|
|
|
22
22
|
private pageUrl;
|
|
23
23
|
private defaultPageUrl;
|
|
24
24
|
/**
|
|
25
|
-
* @param {
|
|
25
|
+
* @param {FEAASRenderMiddlewareConfig} [config] FEAAS render middleware config
|
|
26
26
|
*/
|
|
27
27
|
constructor(config?: FEAASRenderMiddlewareConfig | undefined);
|
|
28
28
|
/**
|
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
export { debug } from '@sitecore-content-sdk/core';
|
|
2
|
-
export { MiddlewareBase, MiddlewareBaseConfig, Middleware, defineMiddleware } from './middleware';
|
|
3
|
-
export { RedirectsMiddleware, RedirectsMiddlewareConfig } from './redirects-middleware';
|
|
4
|
-
export { PersonalizeMiddleware, PersonalizeMiddlewareConfig } from './personalize-middleware';
|
|
5
|
-
export { MultisiteMiddleware, MultisiteMiddlewareConfig } from './multisite-middleware';
|
|
6
|
-
export { AppRouterMultisiteMiddleware } from './app-router-multisite-middleware';
|
|
7
1
|
export { SitemapMiddleware } from './sitemap-middleware';
|
|
8
2
|
export { RobotsMiddleware } from './robots-middleware';
|
|
9
|
-
export { LocaleMiddleware, LocaleMiddlewareConfig } from './locale-middleware';
|
|
10
|
-
export { PersonalizeService, PersonalizeServiceConfig, } from '@sitecore-content-sdk/core/personalize';
|
|
11
|
-
export { RedirectsService, RedirectsServiceConfig, REDIRECT_TYPE_301, REDIRECT_TYPE_302, REDIRECT_TYPE_SERVER_TRANSFER, RedirectInfo, } from '@sitecore-content-sdk/core/site';
|
|
12
3
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/middleware/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/middleware/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC"}
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { NextResponse } from 'next/server';
|
|
2
|
-
import {
|
|
2
|
+
import { MultisiteProxy } from './multisite-proxy';
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* Proxy/handler for enabling multisite support in the Next.js App Router.
|
|
5
5
|
* @public
|
|
6
6
|
*/
|
|
7
|
-
export declare class
|
|
7
|
+
export declare class AppRouterMultisiteProxy extends MultisiteProxy {
|
|
8
8
|
/**
|
|
9
9
|
* Warns when multisite is disabled in App Router.
|
|
10
|
-
* The
|
|
10
|
+
* The proxy will still run to prevent routing errors.
|
|
11
11
|
* @param {NextResponse} _res response (unused, kept for method signature compatibility)
|
|
12
12
|
*/
|
|
13
13
|
protected shouldWarnWhenDisabled(_res: NextResponse): void;
|
|
14
14
|
/**
|
|
15
|
-
* In App Router, we cannot skip the
|
|
15
|
+
* In App Router, we cannot skip the proxy even if enabled is false,
|
|
16
16
|
* because the route structure requires the [site] segment.
|
|
17
17
|
* @returns {boolean} always returns false (never skip) for App Router
|
|
18
18
|
*/
|
|
@@ -25,4 +25,4 @@ export declare class AppRouterMultisiteMiddleware extends MultisiteMiddleware {
|
|
|
25
25
|
*/
|
|
26
26
|
protected getSiteRewrite(pathname: string, siteName: string): string;
|
|
27
27
|
}
|
|
28
|
-
//# sourceMappingURL=app-router-multisite-
|
|
28
|
+
//# sourceMappingURL=app-router-multisite-proxy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app-router-multisite-proxy.d.ts","sourceRoot":"","sources":["../../src/proxy/app-router-multisite-proxy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEnD;;;GAGG;AACH,qBAAa,uBAAwB,SAAQ,cAAc;IACzD;;;;OAIG;IAEH,SAAS,CAAC,sBAAsB,CAAC,IAAI,EAAE,YAAY,GAAG,IAAI;IAS1D;;;;OAIG;IACH,SAAS,CAAC,sBAAsB,IAAI,OAAO;IAI3C;;;;;OAKG;IACH,SAAS,CAAC,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM;CAIrE"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { debug } from '@sitecore-content-sdk/core';
|
|
2
|
+
export { ProxyBase, ProxyBaseConfig, ProxyHandler, defineProxy } from './proxy';
|
|
3
|
+
export { RedirectsProxy, RedirectsProxyConfig } from './redirects-proxy';
|
|
4
|
+
export { PersonalizeProxy, PersonalizeProxyConfig } from './personalize-proxy';
|
|
5
|
+
export { MultisiteProxy, MultisiteProxyConfig } from './multisite-proxy';
|
|
6
|
+
export { AppRouterMultisiteProxy } from './app-router-multisite-proxy';
|
|
7
|
+
export { LocaleProxy, LocaleProxyConfig } from './locale-proxy';
|
|
8
|
+
export { PersonalizeService, PersonalizeServiceConfig, } from '@sitecore-content-sdk/core/personalize';
|
|
9
|
+
export { RedirectsService, RedirectsServiceConfig, REDIRECT_TYPE_301, REDIRECT_TYPE_302, REDIRECT_TYPE_SERVER_TRANSFER, RedirectInfo, } from '@sitecore-content-sdk/core/site';
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/proxy/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAChF,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACzE,OAAO,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAC/E,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACzE,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAChE,OAAO,EACL,kBAAkB,EAClB,wBAAwB,GACzB,MAAM,wCAAwC,CAAC;AAChD,OAAO,EACL,gBAAgB,EAChB,sBAAsB,EACtB,iBAAiB,EACjB,iBAAiB,EACjB,6BAA6B,EAC7B,YAAY,GACb,MAAM,iCAAiC,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { NextResponse, NextRequest } from 'next/server';
|
|
2
|
+
import { ProxyBase, ProxyBaseConfig } from './proxy';
|
|
3
|
+
/**
|
|
4
|
+
* The interface for the Locale proxy configuration.
|
|
5
|
+
* @public
|
|
6
|
+
*/
|
|
7
|
+
export type LocaleProxyConfig = ProxyBaseConfig & {
|
|
8
|
+
/**
|
|
9
|
+
* List of locales supported by the application
|
|
10
|
+
*/
|
|
11
|
+
locales: string[];
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Proxy/handler for handling locale-based routing in the Next.js App Router.
|
|
15
|
+
* This proxy is responsible for extracting the locale from the request path and rewriting it if necessary.
|
|
16
|
+
* It also sets the locale header in the response.
|
|
17
|
+
* @public
|
|
18
|
+
*/
|
|
19
|
+
export declare class LocaleProxy extends ProxyBase {
|
|
20
|
+
protected config: LocaleProxyConfig;
|
|
21
|
+
/**
|
|
22
|
+
* @param {LocaleProxyConfig} config Locale proxy config
|
|
23
|
+
*/
|
|
24
|
+
constructor(config: LocaleProxyConfig);
|
|
25
|
+
handle: (req: NextRequest, res: NextResponse) => Promise<NextResponse>;
|
|
26
|
+
protected disabled(req: NextRequest, res: NextResponse): boolean | undefined;
|
|
27
|
+
/**
|
|
28
|
+
* Extract locale from path
|
|
29
|
+
* @param {string} path request path
|
|
30
|
+
* @returns {string | undefined} the locale if found
|
|
31
|
+
*/
|
|
32
|
+
protected getLocaleFromPath(path: string): string | undefined;
|
|
33
|
+
private setLocaleHeader;
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=locale-proxy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"locale-proxy.d.ts","sourceRoot":"","sources":["../../src/proxy/locale-proxy.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAGxD,OAAO,EAAE,SAAS,EAAE,eAAe,EAAsB,MAAM,SAAS,CAAC;AAEzE;;;GAGG;AACH,MAAM,MAAM,iBAAiB,GAAG,eAAe,GAAG;IAChD;;OAEG;IACH,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB,CAAC;AAEF;;;;;GAKG;AACH,qBAAa,WAAY,SAAQ,SAAS;IAI5B,SAAS,CAAC,MAAM,EAAE,iBAAiB;IAH/C;;OAEG;gBACmB,MAAM,EAAE,iBAAiB;IAI/C,MAAM,GAAU,KAAK,WAAW,EAAE,KAAK,YAAY,KAAG,OAAO,CAAC,YAAY,CAAC,CA6CzE;IAEF,SAAS,CAAC,QAAQ,CAAC,GAAG,EAAE,WAAW,EAAE,GAAG,EAAE,YAAY,GAAG,OAAO,GAAG,SAAS;IAK5E;;;;OAIG;IACH,SAAS,CAAC,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAM7D,OAAO,CAAC,eAAe;CAGxB"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { NextResponse, NextRequest } from 'next/server';
|
|
2
|
-
import {
|
|
2
|
+
import { ProxyBase, ProxyBaseConfig } from './proxy';
|
|
3
3
|
import { SitecoreConfig } from '../config';
|
|
4
4
|
export type CookieAttributes = {
|
|
5
5
|
/**
|
|
@@ -16,20 +16,20 @@ export type CookieAttributes = {
|
|
|
16
16
|
sameSite?: true | false | 'lax' | 'strict' | 'none' | undefined;
|
|
17
17
|
};
|
|
18
18
|
/**
|
|
19
|
-
* The interface for the
|
|
19
|
+
* The interface for the MultisiteProxy configuration.
|
|
20
20
|
* @public
|
|
21
21
|
*/
|
|
22
|
-
export type
|
|
22
|
+
export type MultisiteProxyConfig = ProxyBaseConfig & SitecoreConfig['multisite'];
|
|
23
23
|
/**
|
|
24
|
-
*
|
|
24
|
+
* Proxy / handler for multisite support
|
|
25
25
|
* @public
|
|
26
26
|
*/
|
|
27
|
-
export declare class
|
|
28
|
-
protected config:
|
|
27
|
+
export declare class MultisiteProxy extends ProxyBase {
|
|
28
|
+
protected config: MultisiteProxyConfig;
|
|
29
29
|
/**
|
|
30
|
-
* @param {
|
|
30
|
+
* @param {MultisiteProxyConfig} [config] Multisite proxy config
|
|
31
31
|
*/
|
|
32
|
-
constructor(config:
|
|
32
|
+
constructor(config: MultisiteProxyConfig);
|
|
33
33
|
handle: (req: NextRequest, res: NextResponse) => Promise<NextResponse>;
|
|
34
34
|
protected disabled(req: NextRequest, res: NextResponse): boolean | undefined;
|
|
35
35
|
/**
|
|
@@ -38,9 +38,9 @@ export declare class MultisiteMiddleware extends MiddlewareBase {
|
|
|
38
38
|
*/
|
|
39
39
|
protected shouldWarnWhenDisabled(_res: NextResponse): void;
|
|
40
40
|
/**
|
|
41
|
-
* Determines if
|
|
41
|
+
* Determines if proxy should be skipped when multisite is disabled.
|
|
42
42
|
* Override in subclasses to provide router-specific behavior.
|
|
43
|
-
* @returns {boolean} true if
|
|
43
|
+
* @returns {boolean} true if proxy should be skipped when disabled
|
|
44
44
|
*/
|
|
45
45
|
protected shouldSkipWhenDisabled(): boolean;
|
|
46
46
|
/**
|
|
@@ -51,4 +51,4 @@ export declare class MultisiteMiddleware extends MiddlewareBase {
|
|
|
51
51
|
*/
|
|
52
52
|
protected getSiteRewrite(pathname: string, siteName: string): string;
|
|
53
53
|
}
|
|
54
|
-
//# sourceMappingURL=multisite-
|
|
54
|
+
//# sourceMappingURL=multisite-proxy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"multisite-proxy.d.ts","sourceRoot":"","sources":["../../src/proxy/multisite-proxy.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAGxD,OAAO,EAAE,SAAS,EAAE,eAAe,EAAuB,MAAM,SAAS,CAAC;AAC1E,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAG3C,MAAM,MAAM,gBAAgB,GAAG;IAC7B;;OAEG;IACH,MAAM,EAAE,OAAO,CAAC;IAChB;;OAEG;IACH,QAAQ,EAAE,OAAO,CAAC;IAClB;;OAEG;IACH,QAAQ,CAAC,EAAE,IAAI,GAAG,KAAK,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,SAAS,CAAC;CACjE,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,oBAAoB,GAAG,eAAe,GAAG,cAAc,CAAC,WAAW,CAAC,CAAC;AAEjF;;;GAGG;AACH,qBAAa,cAAe,SAAQ,SAAS;IAI/B,SAAS,CAAC,MAAM,EAAE,oBAAoB;IAHlD;;OAEG;gBACmB,MAAM,EAAE,oBAAoB;IAIlD,MAAM,GAAU,KAAK,WAAW,EAAE,KAAK,YAAY,KAAG,OAAO,CAAC,YAAY,CAAC,CA2FzE;IAEF,SAAS,CAAC,QAAQ,CAAC,GAAG,EAAE,WAAW,EAAE,GAAG,EAAE,YAAY,GAAG,OAAO,GAAG,SAAS;IAK5E;;;OAGG;IAEH,SAAS,CAAC,sBAAsB,CAAC,IAAI,EAAE,YAAY,GAAG,IAAI;IAI1D;;;;OAIG;IACH,SAAS,CAAC,sBAAsB,IAAI,OAAO;IAI3C;;;;;OAKG;IACH,SAAS,CAAC,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM;CAKrE"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { NextResponse, NextRequest } from 'next/server';
|
|
2
2
|
import { PersonalizeService, PersonalizeInfo } from '@sitecore-content-sdk/core/personalize';
|
|
3
|
-
import {
|
|
3
|
+
import { ProxyBase, ProxyBaseConfig } from './proxy';
|
|
4
4
|
import { SitecoreConfig } from '../config';
|
|
5
5
|
/**
|
|
6
6
|
* Represents the geolocation data used for personalization
|
|
@@ -11,10 +11,10 @@ export type PersonalizeGeoData = {
|
|
|
11
11
|
region?: string;
|
|
12
12
|
};
|
|
13
13
|
/**
|
|
14
|
-
* The interface for the
|
|
14
|
+
* The interface for the PersonalizeProxy configuration.
|
|
15
15
|
* @public
|
|
16
16
|
*/
|
|
17
|
-
export type
|
|
17
|
+
export type PersonalizeProxyConfig = ProxyBaseConfig & SitecoreConfig['api']['edge'] & SitecoreConfig['personalize'] & {
|
|
18
18
|
personalizeService?: PersonalizeService;
|
|
19
19
|
getExtraUtmParams?: (req: NextRequest) => Partial<ExperienceParams['utm']>;
|
|
20
20
|
extractGeoDataCb?: (req?: NextRequest) => Promise<PersonalizeGeoData> | PersonalizeGeoData;
|
|
@@ -40,16 +40,16 @@ type PersonalizeExecution = {
|
|
|
40
40
|
variantIds: string[];
|
|
41
41
|
};
|
|
42
42
|
/**
|
|
43
|
-
*
|
|
43
|
+
* Proxy / handler to support Sitecore Personalize
|
|
44
44
|
* @public
|
|
45
45
|
*/
|
|
46
|
-
export declare class
|
|
47
|
-
protected config:
|
|
46
|
+
export declare class PersonalizeProxy extends ProxyBase {
|
|
47
|
+
protected config: PersonalizeProxyConfig;
|
|
48
48
|
protected personalizeService: PersonalizeService | null;
|
|
49
49
|
/**
|
|
50
|
-
* @param {
|
|
50
|
+
* @param {PersonalizeProxyConfig} [config] Personalize proxy config
|
|
51
51
|
*/
|
|
52
|
-
constructor(config:
|
|
52
|
+
constructor(config: PersonalizeProxyConfig);
|
|
53
53
|
handle: (req: NextRequest, res: NextResponse) => Promise<NextResponse>;
|
|
54
54
|
protected disabled(req: NextRequest, res: NextResponse): boolean | undefined;
|
|
55
55
|
protected getExperienceParams(req: NextRequest): ExperienceParams;
|
|
@@ -78,4 +78,4 @@ export declare class PersonalizeMiddleware extends MiddlewareBase {
|
|
|
78
78
|
protected getPersonalizeExecutions(personalizeInfo: PersonalizeInfo, language: string): PersonalizeExecution[];
|
|
79
79
|
}
|
|
80
80
|
export {};
|
|
81
|
-
//# sourceMappingURL=personalize-
|
|
81
|
+
//# sourceMappingURL=personalize-proxy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"personalize-proxy.d.ts","sourceRoot":"","sources":["../../src/proxy/personalize-proxy.ts"],"names":[],"mappings":"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"}
|