@nextlytics/core 0.4.0 → 0.4.1-canary.103
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/middleware.js
CHANGED
|
@@ -72,10 +72,14 @@ function createNextlyticsMiddleware(config, dispatchEvent, updateEvent) {
|
|
|
72
72
|
return Response.json({ error: "Method not allowed" }, { status: 405 });
|
|
73
73
|
}
|
|
74
74
|
if (reqInfo.isNextjsInternal || reqInfo.isPrefetch || reqInfo.isStaticFile) {
|
|
75
|
-
|
|
75
|
+
const response2 = import_server.NextResponse.next();
|
|
76
|
+
response2.headers.set(import_server_component_context.headerNames.active, "1");
|
|
77
|
+
return response2;
|
|
76
78
|
}
|
|
77
79
|
if (!reqInfo.isPageNavigation && !config.isApiPath(pathname)) {
|
|
78
|
-
|
|
80
|
+
const response2 = import_server.NextResponse.next();
|
|
81
|
+
response2.headers.set(import_server_component_context.headerNames.active, "1");
|
|
82
|
+
return response2;
|
|
79
83
|
}
|
|
80
84
|
const pageRenderId = (0, import_uitils.generateId)();
|
|
81
85
|
const serverContext = (0, import_uitils.createServerContext)(request);
|
|
@@ -7,6 +7,7 @@ declare const headerNames: {
|
|
|
7
7
|
readonly search: "x-nl-search";
|
|
8
8
|
readonly pageRenderId: "x-nl-page-render-id";
|
|
9
9
|
readonly isSoftNavigation: "x-nl-is-soft-nav";
|
|
10
|
+
readonly active: "x-nl-active";
|
|
10
11
|
readonly scripts: "x-nl-scripts";
|
|
11
12
|
};
|
|
12
13
|
declare const LAST_PAGE_RENDER_ID_COOKIE = "last-page-render-id";
|
|
@@ -30,6 +30,7 @@ const headerNames = {
|
|
|
30
30
|
search: `${HEADER_PREFIX}search`,
|
|
31
31
|
pageRenderId: `${HEADER_PREFIX}page-render-id`,
|
|
32
32
|
isSoftNavigation: `${HEADER_PREFIX}is-soft-nav`,
|
|
33
|
+
active: `${HEADER_PREFIX}active`,
|
|
33
34
|
scripts: `${HEADER_PREFIX}scripts`
|
|
34
35
|
};
|
|
35
36
|
const LAST_PAGE_RENDER_ID_COOKIE = "last-page-render-id";
|
package/dist/server.js
CHANGED
|
@@ -179,7 +179,9 @@ function Nextlytics(userConfig) {
|
|
|
179
179
|
const headersList = await (0, import_headers.headers)();
|
|
180
180
|
const ctx = (0, import_server_component_context.restoreServerComponentContext)(headersList);
|
|
181
181
|
if (!ctx) {
|
|
182
|
-
|
|
182
|
+
if (!headersList.get(import_server_component_context.headerNames.active)) {
|
|
183
|
+
console.warn("[Nextlytics] nextlyticsMiddleware should be added in order for Server to work");
|
|
184
|
+
}
|
|
183
185
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children });
|
|
184
186
|
}
|
|
185
187
|
const requestCtx = await createRequestContext();
|