@sitecore-content-sdk/nextjs 1.4.0-canary.8 → 1.4.0-canary.9
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/middleware/personalize-middleware.js +13 -9
- package/dist/cjs/middleware/redirects-middleware.js +22 -1
- package/dist/esm/middleware/personalize-middleware.js +13 -9
- package/dist/esm/middleware/redirects-middleware.js +22 -1
- package/package.json +4 -4
- package/types/middleware/personalize-middleware.d.ts +1 -1
- package/types/middleware/personalize-middleware.d.ts.map +1 -1
- package/types/middleware/redirects-middleware.d.ts +2 -1
- package/types/middleware/redirects-middleware.d.ts.map +1 -1
|
@@ -28,11 +28,6 @@ class PersonalizeMiddleware extends middleware_1.MiddlewareBase {
|
|
|
28
28
|
super(config);
|
|
29
29
|
this.config = config;
|
|
30
30
|
this.handle = (req, res) => __awaiter(this, void 0, void 0, function* () {
|
|
31
|
-
// Skip if service wasn't initialized (no edge config)
|
|
32
|
-
if (!this.personalizeService) {
|
|
33
|
-
core_1.debug.personalize('skipped (personalize service not configured - edge config required)');
|
|
34
|
-
return res;
|
|
35
|
-
}
|
|
36
31
|
if (!this.config.enabled) {
|
|
37
32
|
core_1.debug.personalize('skipped (personalize middleware is disabled globally)');
|
|
38
33
|
return res;
|
|
@@ -61,6 +56,10 @@ class PersonalizeMiddleware extends middleware_1.MiddlewareBase {
|
|
|
61
56
|
}
|
|
62
57
|
const site = this.getSite(req, res);
|
|
63
58
|
// Get personalization info from Experience Edge
|
|
59
|
+
// personalizeService is guaranteed to be non-null here because disabled() check passed
|
|
60
|
+
if (!this.personalizeService) {
|
|
61
|
+
return res;
|
|
62
|
+
}
|
|
64
63
|
const personalizeInfo = yield this.personalizeService.getPersonalizeInfo(pathname, language, site.name);
|
|
65
64
|
if (!personalizeInfo) {
|
|
66
65
|
// Likely an invalid route / language
|
|
@@ -153,6 +152,15 @@ class PersonalizeMiddleware extends middleware_1.MiddlewareBase {
|
|
|
153
152
|
fetch: fetch,
|
|
154
153
|
});
|
|
155
154
|
}
|
|
155
|
+
disabled(req, res) {
|
|
156
|
+
// Check if API config is missing - if so, disable the middleware
|
|
157
|
+
if (!this.personalizeService) {
|
|
158
|
+
core_1.debug.personalize('skipped (personalize service not configured - edge config required)');
|
|
159
|
+
return true;
|
|
160
|
+
}
|
|
161
|
+
// ignore files
|
|
162
|
+
return req.nextUrl.pathname.includes('.') || super.disabled(req, res);
|
|
163
|
+
}
|
|
156
164
|
getExperienceParams(req) {
|
|
157
165
|
const extraParams = this.config.getExtraUtmParams ? this.config.getExtraUtmParams(req) : {};
|
|
158
166
|
const utm = Object.assign({ campaign: req.nextUrl.searchParams.get('utm_campaign') || undefined, content: req.nextUrl.searchParams.get('utm_content') || undefined, medium: req.nextUrl.searchParams.get('utm_medium') || undefined, source: req.nextUrl.searchParams.get('utm_source') || undefined }, extraParams);
|
|
@@ -164,10 +172,6 @@ class PersonalizeMiddleware extends middleware_1.MiddlewareBase {
|
|
|
164
172
|
utm,
|
|
165
173
|
};
|
|
166
174
|
}
|
|
167
|
-
disabled(req, res) {
|
|
168
|
-
// ignore files
|
|
169
|
-
return req.nextUrl.pathname.includes('.') || super.disabled(req, res);
|
|
170
|
-
}
|
|
171
175
|
initPersonalizeServer(_a) {
|
|
172
176
|
return __awaiter(this, arguments, void 0, function* ({ hostname, siteName, request, response, }) {
|
|
173
177
|
yield (0, server_1.CloudSDK)(request, response, {
|
|
@@ -151,6 +151,17 @@ class RedirectsMiddleware extends middleware_1.MiddlewareBase {
|
|
|
151
151
|
return res;
|
|
152
152
|
}
|
|
153
153
|
});
|
|
154
|
+
this.locales = config.locales;
|
|
155
|
+
// Validate API config is present - redirects requires either Edge or local API configuration
|
|
156
|
+
const hasEdgeConfig = !!(this.config.contextId || this.config.clientContextId);
|
|
157
|
+
const hasLocalConfig = !!(this.config.apiHost && this.config.apiKey);
|
|
158
|
+
if (!hasEdgeConfig && !hasLocalConfig) {
|
|
159
|
+
console.warn('[RedirectsMiddleware] Redirects middleware requires either Edge configuration (contextId/clientContextId) or local API configuration (apiHost/apiKey). ' +
|
|
160
|
+
'Redirects features will be disabled. This is expected when API configuration is not available.');
|
|
161
|
+
// Set to null to indicate service is disabled
|
|
162
|
+
this.redirectsService = null;
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
154
165
|
const graphQLOptions = {
|
|
155
166
|
api: Object.assign({ edge: {
|
|
156
167
|
contextId: this.config.contextId,
|
|
@@ -170,7 +181,14 @@ class RedirectsMiddleware extends middleware_1.MiddlewareBase {
|
|
|
170
181
|
// (underlying default 'cross-fetch' is not currently compatible: https://github.com/lquixada/cross-fetch/issues/78)
|
|
171
182
|
this.redirectsService =
|
|
172
183
|
(_a = this.config.redirectsService) !== null && _a !== void 0 ? _a : new site_1.RedirectsService(Object.assign(Object.assign({}, config), { clientFactory: this.getClientFactory(graphQLOptions), fetch: fetch }));
|
|
173
|
-
|
|
184
|
+
}
|
|
185
|
+
disabled(req, res) {
|
|
186
|
+
// Check if API config is missing - if so, disable the middleware
|
|
187
|
+
if (!this.redirectsService) {
|
|
188
|
+
core_1.debug.redirects('skipped (redirects service not configured - API config required)');
|
|
189
|
+
return true;
|
|
190
|
+
}
|
|
191
|
+
return super.disabled(req, res);
|
|
174
192
|
}
|
|
175
193
|
/**
|
|
176
194
|
* Method returns RedirectInfo when matches
|
|
@@ -181,6 +199,9 @@ class RedirectsMiddleware extends middleware_1.MiddlewareBase {
|
|
|
181
199
|
*/
|
|
182
200
|
getExistsRedirect(req, siteName) {
|
|
183
201
|
return __awaiter(this, void 0, void 0, function* () {
|
|
202
|
+
if (!this.redirectsService) {
|
|
203
|
+
return undefined;
|
|
204
|
+
}
|
|
184
205
|
const { pathname: incomingURL, search: incomingQS = '' } = this.normalizeUrl(req.nextUrl.clone());
|
|
185
206
|
const locale = this.getLanguage(req);
|
|
186
207
|
const normalizedPath = incomingURL.replace(/\/*$/gi, '').toLowerCase();
|
|
@@ -25,11 +25,6 @@ export class PersonalizeMiddleware extends MiddlewareBase {
|
|
|
25
25
|
super(config);
|
|
26
26
|
this.config = config;
|
|
27
27
|
this.handle = (req, res) => __awaiter(this, void 0, void 0, function* () {
|
|
28
|
-
// Skip if service wasn't initialized (no edge config)
|
|
29
|
-
if (!this.personalizeService) {
|
|
30
|
-
debug.personalize('skipped (personalize service not configured - edge config required)');
|
|
31
|
-
return res;
|
|
32
|
-
}
|
|
33
28
|
if (!this.config.enabled) {
|
|
34
29
|
debug.personalize('skipped (personalize middleware is disabled globally)');
|
|
35
30
|
return res;
|
|
@@ -58,6 +53,10 @@ export class PersonalizeMiddleware extends MiddlewareBase {
|
|
|
58
53
|
}
|
|
59
54
|
const site = this.getSite(req, res);
|
|
60
55
|
// Get personalization info from Experience Edge
|
|
56
|
+
// personalizeService is guaranteed to be non-null here because disabled() check passed
|
|
57
|
+
if (!this.personalizeService) {
|
|
58
|
+
return res;
|
|
59
|
+
}
|
|
61
60
|
const personalizeInfo = yield this.personalizeService.getPersonalizeInfo(pathname, language, site.name);
|
|
62
61
|
if (!personalizeInfo) {
|
|
63
62
|
// Likely an invalid route / language
|
|
@@ -150,6 +149,15 @@ export class PersonalizeMiddleware extends MiddlewareBase {
|
|
|
150
149
|
fetch: fetch,
|
|
151
150
|
});
|
|
152
151
|
}
|
|
152
|
+
disabled(req, res) {
|
|
153
|
+
// Check if API config is missing - if so, disable the middleware
|
|
154
|
+
if (!this.personalizeService) {
|
|
155
|
+
debug.personalize('skipped (personalize service not configured - edge config required)');
|
|
156
|
+
return true;
|
|
157
|
+
}
|
|
158
|
+
// ignore files
|
|
159
|
+
return req.nextUrl.pathname.includes('.') || super.disabled(req, res);
|
|
160
|
+
}
|
|
153
161
|
getExperienceParams(req) {
|
|
154
162
|
const extraParams = this.config.getExtraUtmParams ? this.config.getExtraUtmParams(req) : {};
|
|
155
163
|
const utm = Object.assign({ campaign: req.nextUrl.searchParams.get('utm_campaign') || undefined, content: req.nextUrl.searchParams.get('utm_content') || undefined, medium: req.nextUrl.searchParams.get('utm_medium') || undefined, source: req.nextUrl.searchParams.get('utm_source') || undefined }, extraParams);
|
|
@@ -161,10 +169,6 @@ export class PersonalizeMiddleware extends MiddlewareBase {
|
|
|
161
169
|
utm,
|
|
162
170
|
};
|
|
163
171
|
}
|
|
164
|
-
disabled(req, res) {
|
|
165
|
-
// ignore files
|
|
166
|
-
return req.nextUrl.pathname.includes('.') || super.disabled(req, res);
|
|
167
|
-
}
|
|
168
172
|
initPersonalizeServer(_a) {
|
|
169
173
|
return __awaiter(this, arguments, void 0, function* ({ hostname, siteName, request, response, }) {
|
|
170
174
|
yield CloudSDK(request, response, {
|
|
@@ -145,6 +145,17 @@ export class RedirectsMiddleware extends MiddlewareBase {
|
|
|
145
145
|
return res;
|
|
146
146
|
}
|
|
147
147
|
});
|
|
148
|
+
this.locales = config.locales;
|
|
149
|
+
// Validate API config is present - redirects requires either Edge or local API configuration
|
|
150
|
+
const hasEdgeConfig = !!(this.config.contextId || this.config.clientContextId);
|
|
151
|
+
const hasLocalConfig = !!(this.config.apiHost && this.config.apiKey);
|
|
152
|
+
if (!hasEdgeConfig && !hasLocalConfig) {
|
|
153
|
+
console.warn('[RedirectsMiddleware] Redirects middleware requires either Edge configuration (contextId/clientContextId) or local API configuration (apiHost/apiKey). ' +
|
|
154
|
+
'Redirects features will be disabled. This is expected when API configuration is not available.');
|
|
155
|
+
// Set to null to indicate service is disabled
|
|
156
|
+
this.redirectsService = null;
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
148
159
|
const graphQLOptions = {
|
|
149
160
|
api: Object.assign({ edge: {
|
|
150
161
|
contextId: this.config.contextId,
|
|
@@ -164,7 +175,14 @@ export class RedirectsMiddleware extends MiddlewareBase {
|
|
|
164
175
|
// (underlying default 'cross-fetch' is not currently compatible: https://github.com/lquixada/cross-fetch/issues/78)
|
|
165
176
|
this.redirectsService =
|
|
166
177
|
(_a = this.config.redirectsService) !== null && _a !== void 0 ? _a : new RedirectsService(Object.assign(Object.assign({}, config), { clientFactory: this.getClientFactory(graphQLOptions), fetch: fetch }));
|
|
167
|
-
|
|
178
|
+
}
|
|
179
|
+
disabled(req, res) {
|
|
180
|
+
// Check if API config is missing - if so, disable the middleware
|
|
181
|
+
if (!this.redirectsService) {
|
|
182
|
+
debug.redirects('skipped (redirects service not configured - API config required)');
|
|
183
|
+
return true;
|
|
184
|
+
}
|
|
185
|
+
return super.disabled(req, res);
|
|
168
186
|
}
|
|
169
187
|
/**
|
|
170
188
|
* Method returns RedirectInfo when matches
|
|
@@ -175,6 +193,9 @@ export class RedirectsMiddleware extends MiddlewareBase {
|
|
|
175
193
|
*/
|
|
176
194
|
getExistsRedirect(req, siteName) {
|
|
177
195
|
return __awaiter(this, void 0, void 0, function* () {
|
|
196
|
+
if (!this.redirectsService) {
|
|
197
|
+
return undefined;
|
|
198
|
+
}
|
|
178
199
|
const { pathname: incomingURL, search: incomingQS = '' } = this.normalizeUrl(req.nextUrl.clone());
|
|
179
200
|
const locale = this.getLanguage(req);
|
|
180
201
|
const normalizedPath = incomingURL.replace(/\/*$/gi, '').toLowerCase();
|
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.9",
|
|
4
4
|
"main": "dist/cjs/index.js",
|
|
5
5
|
"module": "dist/esm/index.js",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -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.9",
|
|
95
|
+
"@sitecore-content-sdk/react": "1.4.0-canary.9",
|
|
96
96
|
"recast": "^0.23.11",
|
|
97
97
|
"regex-parser": "^2.3.1",
|
|
98
98
|
"sync-disk-cache": "^2.1.0"
|
|
@@ -171,7 +171,7 @@
|
|
|
171
171
|
},
|
|
172
172
|
"description": "",
|
|
173
173
|
"types": "types/index.d.ts",
|
|
174
|
-
"gitHead": "
|
|
174
|
+
"gitHead": "d6d456ba7f417687b97043650089598078a8b5c1",
|
|
175
175
|
"files": [
|
|
176
176
|
"dist",
|
|
177
177
|
"types",
|
|
@@ -51,8 +51,8 @@ export declare class PersonalizeMiddleware extends MiddlewareBase {
|
|
|
51
51
|
*/
|
|
52
52
|
constructor(config: PersonalizeMiddlewareConfig);
|
|
53
53
|
handle: (req: NextRequest, res: NextResponse) => Promise<NextResponse>;
|
|
54
|
-
protected getExperienceParams(req: NextRequest): ExperienceParams;
|
|
55
54
|
protected disabled(req: NextRequest, res: NextResponse): boolean | undefined;
|
|
55
|
+
protected getExperienceParams(req: NextRequest): ExperienceParams;
|
|
56
56
|
protected initPersonalizeServer({ hostname, siteName, request, response, }: {
|
|
57
57
|
hostname: string;
|
|
58
58
|
siteName: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"personalize-middleware.d.ts","sourceRoot":"","sources":["../../src/middleware/personalize-middleware.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AACxD,OAAO,EACL,kBAAkB,EAElB,eAAe,EAGhB,MAAM,wCAAwC,CAAC;AAEhD,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAuB,MAAM,cAAc,CAAC;AAGzF,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAE3C;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAC/B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,2BAA2B,GAAG,oBAAoB,GAC5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 'fetch' | '
|
|
|
20
20
|
*/
|
|
21
21
|
export declare class RedirectsMiddleware extends MiddlewareBase {
|
|
22
22
|
protected config: RedirectsMiddlewareConfig;
|
|
23
|
-
protected redirectsService: RedirectsService;
|
|
23
|
+
protected redirectsService: RedirectsService | null;
|
|
24
24
|
private locales;
|
|
25
25
|
/**
|
|
26
26
|
* @param {RedirectsMiddlewareConfig} [config] redirects middleware config
|
|
27
27
|
*/
|
|
28
28
|
constructor(config: RedirectsMiddlewareConfig);
|
|
29
29
|
handle: (req: NextRequest, res: NextResponse) => Promise<NextResponse>;
|
|
30
|
+
protected disabled(req: NextRequest, res: NextResponse): boolean | undefined;
|
|
30
31
|
/**
|
|
31
32
|
* Method returns RedirectInfo when matches
|
|
32
33
|
* @param {NextRequest} req request
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"redirects-middleware.d.ts","sourceRoot":"","sources":["../../src/middleware/redirects-middleware.ts"],"names":[],"mappings":"AACA,OAAO,EACL,gBAAgB,EAChB,sBAAsB,EAItB,YAAY,EAEb,MAAM,iCAAiC,CAAC;AAOzC,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAExD,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAuB,MAAM,cAAc,CAAC;AACzF,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAK3C,KAAK,cAAc,GAAG,YAAY,GAAG;IAAE,kBAAkB,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAErE;;;GAGG;AACH,MAAM,MAAM,yBAAyB,GAAG,IAAI,CAAC,sBAAsB,EAAE,OAAO,GAAG,eAAe,CAAC,GAC7F,cAAc,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,GAC7B,OAAO,CAAC,WAAW,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GACpD,oBAAoB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