@plentymarkets/shop-core 1.21.9 → 1.21.11

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
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@plentymarkets/shop-core",
3
3
  "configKey": "shopCore",
4
- "version": "1.21.9",
4
+ "version": "1.21.11",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
7
7
  "unbuild": "unknown"
package/dist/module.mjs CHANGED
@@ -36,7 +36,9 @@ const module$1 = defineNuxtModule({
36
36
  nuxt.options.runtimeConfig.public.shopCore = {
37
37
  apiUrl: _options.apiUrl,
38
38
  configId: _options.configId,
39
- enableSSRMetrics: _options.enableSSRMetrics ?? false,
39
+ experimental: {
40
+ enableSSRMetrics: _options.experimental?.enableSSRMetrics ?? false
41
+ },
40
42
  middlewareSSRUrl: _options.middlewareSSRUrl,
41
43
  logger: {
42
44
  sdkPlugin: {
@@ -17,6 +17,7 @@ export default defineNuxtPlugin((nuxtApp) => {
17
17
  );
18
18
  const noCache = runtimeConfig.public.noCache || nuxtApp.$router.currentRoute.value.query?.noCache?.toString() || "";
19
19
  const referrerId = nuxtApp.$router.currentRoute.value.query?.ReferrerID?.toString() ?? "";
20
+ const shouldSkipCookiesSSR = nuxtApp.$router.currentRoute.value.meta?.skipCookiesSSR ?? false;
20
21
  const { token: csrfToken } = useCsrfToken();
21
22
  const ssrCookie = ref([]);
22
23
  logger.log("\u{1F680} initializing SDK plugin");
@@ -33,7 +34,8 @@ export default defineNuxtPlugin((nuxtApp) => {
33
34
  referrerId,
34
35
  noCache,
35
36
  requestHeaders,
36
- ssrCookie: ssrCookie.value
37
+ ssrCookie: ssrCookie.value,
38
+ shouldSkipCookiesSSR
37
39
  });
38
40
  logger.verbose(`\u{1F4EC} prepared headers: `, JSON.stringify(headers));
39
41
  return {
@@ -6,6 +6,10 @@ declare module '#app' {
6
6
  config: ShopCoreConfig;
7
7
  };
8
8
  }
9
+ interface PageMeta {
10
+ /** When true, the x-without-session-cookie header is sent for all SDK requests on this page during SSR. */
11
+ skipCookiesSSR?: boolean;
12
+ }
9
13
  }
10
14
 
11
15
  declare module '@plentymarkets/shop-core' {
@@ -2,7 +2,9 @@ export interface ModuleOptions {
2
2
  apiUrl: string;
3
3
  apiEndpoint: string;
4
4
  configId: number;
5
- enableSSRMetrics?: boolean;
5
+ experimental?: {
6
+ enableSSRMetrics?: boolean;
7
+ };
6
8
  middlewareSSRUrl?: string;
7
9
  logger?: {
8
10
  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.shouldSkipCookiesSSR) {
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
  };
@@ -10,6 +10,7 @@ export interface SdkHeaderContext {
10
10
  noCache?: string;
11
11
  requestHeaders?: Record<string, string>;
12
12
  ssrCookie?: string[];
13
+ shouldSkipCookiesSSR?: boolean;
13
14
  }
14
15
  export interface HandleSdkResponseContext {
15
16
  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 = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plentymarkets/shop-core",
3
- "version": "1.21.9",
3
+ "version": "1.21.11",
4
4
  "description": "Core module for PlentyONE Shop",
5
5
  "repository": {
6
6
  "type": "git",
@@ -50,7 +50,7 @@
50
50
  },
51
51
  "dependencies": {
52
52
  "@noble/hashes": "^2.0.1",
53
- "@plentymarkets/shop-api": "^0.156.0",
53
+ "@plentymarkets/shop-api": "^0.157.0",
54
54
  "@vue-storefront/sdk": "^3.4.1",
55
55
  "cookie-es": "^2.0.0",
56
56
  "knitwork": "^1.3.0",