@plentymarkets/shop-core 1.4.1 → 1.5.0

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": "shop-core",
3
3
  "configKey": "shopCore",
4
- "version": "1.4.1",
4
+ "version": "1.5.0",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "0.8.4",
7
7
  "unbuild": "2.0.0"
@@ -1,6 +1,5 @@
1
1
  import axios from "axios";
2
2
  import { ApiError } from "@plentymarkets/shop-api";
3
- import { updateVsfLocale } from "../utils/sdkClientHelper.js";
4
3
  import { useCsrfToken } from "./useCsrfToken.js";
5
4
  import { tryUseNuxtApp, useCookie, useNuxtApp, useRuntimeConfig } from "#imports";
6
5
  const createHttpClient = () => {
@@ -21,9 +20,6 @@ const createHttpClient = () => {
21
20
  if (configId) request.headers["x-config-id"] = configId;
22
21
  if (pwaHashCookie.value) request.headers["x-pwa-edit-hash"] = pwaHashCookie.value;
23
22
  request.headers["locale"] = locale;
24
- if (import.meta.server) {
25
- request.headers["cookie"] = updateVsfLocale(request.headers["cookie"], locale);
26
- }
27
23
  return request;
28
24
  });
29
25
  client.interceptors.response.use((response) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plentymarkets/shop-core",
3
- "version": "1.4.1",
3
+ "version": "1.5.0",
4
4
  "description": "Core module for PlentyONE Shop",
5
5
  "repository": {
6
6
  "type": "git",
@@ -42,7 +42,7 @@
42
42
  "test:types": "vue-tsc --noEmit && cd playground && vue-tsc --noEmit"
43
43
  },
44
44
  "dependencies": {
45
- "@plentymarkets/shop-api": "^0.105.1",
45
+ "@plentymarkets/shop-api": "^0.106.0",
46
46
  "@vue-storefront/sdk": "^3.4.1",
47
47
  "js-sha256": "^0.11.0",
48
48
  "mitt": "^3.0.1",
@@ -1,22 +0,0 @@
1
- import { describe, expect, it } from "vitest";
2
- import { updateVsfLocale } from "../sdkClientHelper.js";
3
- describe("sdk client helper", () => {
4
- it("should update the locale", () => {
5
- const cookie = "vsf-locale=en";
6
- const locale = "fr";
7
- const result = updateVsfLocale(cookie, locale);
8
- expect(result).toBe("vsf-locale=fr");
9
- });
10
- it("should update the cookie in existing cookie string", () => {
11
- const cookie = "vsf-locale=en; test=123";
12
- const locale = "de";
13
- const result = updateVsfLocale(cookie, locale);
14
- expect(result).toBe("vsf-locale=de; test=123");
15
- });
16
- it("should update the locale when cookie is empty", () => {
17
- const cookie = "";
18
- const locale = "de";
19
- const result = updateVsfLocale(cookie, locale);
20
- expect(result).toBe("; vsf-locale=de");
21
- });
22
- });
@@ -1 +0,0 @@
1
- export declare const updateVsfLocale: (cookie: string, locale: string) => string;
@@ -1,16 +0,0 @@
1
- const VSL_LOCALE_COOKIE = "vsf-locale";
2
- export const updateVsfLocale = (cookie, locale) => {
3
- let cookieExists = false;
4
- const cookies = (cookie ?? "").split(";");
5
- const cookiesArray = cookies.map((cookie2) => {
6
- if (cookie2.trim().includes(VSL_LOCALE_COOKIE)) {
7
- cookieExists = true;
8
- return `${VSL_LOCALE_COOKIE}=${locale}`;
9
- }
10
- return cookie2;
11
- });
12
- if (!cookieExists) {
13
- cookiesArray.push(`${VSL_LOCALE_COOKIE}=${locale}`);
14
- }
15
- return cookiesArray.join("; ");
16
- };