@plentymarkets/shop-core 1.21.9 → 1.21.10
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/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -36,7 +36,10 @@ const module$1 = defineNuxtModule({
|
|
|
36
36
|
nuxt.options.runtimeConfig.public.shopCore = {
|
|
37
37
|
apiUrl: _options.apiUrl,
|
|
38
38
|
configId: _options.configId,
|
|
39
|
-
|
|
39
|
+
experimental: {
|
|
40
|
+
enableSSRMetrics: _options.experimental?.enableSSRMetrics ?? false,
|
|
41
|
+
enableSSRWithoutSessionCookie: _options.experimental?.enableSSRWithoutSessionCookie ?? false
|
|
42
|
+
},
|
|
40
43
|
middlewareSSRUrl: _options.middlewareSSRUrl,
|
|
41
44
|
logger: {
|
|
42
45
|
sdkPlugin: {
|
|
@@ -2,7 +2,10 @@ export interface ModuleOptions {
|
|
|
2
2
|
apiUrl: string;
|
|
3
3
|
apiEndpoint: string;
|
|
4
4
|
configId: number;
|
|
5
|
-
|
|
5
|
+
experimental?: {
|
|
6
|
+
enableSSRMetrics?: boolean;
|
|
7
|
+
enableSSRWithoutSessionCookie?: boolean;
|
|
8
|
+
};
|
|
6
9
|
middlewareSSRUrl?: string;
|
|
7
10
|
logger?: {
|
|
8
11
|
sdkPlugin?: {
|
|
@@ -46,6 +46,11 @@ export const getI18nLocale = (nuxtApp) => {
|
|
|
46
46
|
}
|
|
47
47
|
return i18nLocale;
|
|
48
48
|
};
|
|
49
|
+
const addExperimentalHeaders = (headers, context) => {
|
|
50
|
+
if (isServer() && context.moduleConfig?.experimental?.enableSSRWithoutSessionCookie) {
|
|
51
|
+
headers["x-without-session-cookie"] = "true";
|
|
52
|
+
}
|
|
53
|
+
};
|
|
49
54
|
export const createSdkRequestHeaders = (context) => {
|
|
50
55
|
if (isServer()) {
|
|
51
56
|
const mergedCookieString = parseHeaderCookies(context);
|
|
@@ -63,5 +68,6 @@ export const createSdkRequestHeaders = (context) => {
|
|
|
63
68
|
...context.noCache && { noCache: context.noCache },
|
|
64
69
|
...isServer() && { ...context.requestHeaders }
|
|
65
70
|
};
|
|
71
|
+
addExperimentalHeaders(headers, context);
|
|
66
72
|
return headers;
|
|
67
73
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { NuxtSSRContext } from '#app';
|
|
2
2
|
import type { Ref } from '#imports';
|
|
3
|
+
import type { ModuleOptions } from '../../types/index.js';
|
|
3
4
|
import type { createSdkLogger } from './sdk.logger.js';
|
|
4
5
|
export interface SdkHeaderContext {
|
|
5
6
|
configId?: string;
|
|
@@ -10,6 +11,7 @@ export interface SdkHeaderContext {
|
|
|
10
11
|
noCache?: string;
|
|
11
12
|
requestHeaders?: Record<string, string>;
|
|
12
13
|
ssrCookie?: string[];
|
|
14
|
+
moduleConfig?: ModuleOptions;
|
|
13
15
|
}
|
|
14
16
|
export interface HandleSdkResponseContext {
|
|
15
17
|
response: any;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { isServer } from "./runtime.js";
|
|
2
2
|
export const setSSRMetrics = (nuxtApp, startTime, url) => {
|
|
3
|
-
if (!nuxtApp.$config.public.shopCore.enableSSRMetrics) return;
|
|
3
|
+
if (!nuxtApp.$config.public.shopCore.experimental.enableSSRMetrics) return;
|
|
4
4
|
if (isServer()) {
|
|
5
5
|
const duration = Date.now() - startTime;
|
|
6
6
|
const timing = {
|