@shopware/nuxt-module 1.3.1 → 1.4.1

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.
Files changed (3) hide show
  1. package/README.md +4 -6
  2. package/package.json +9 -8
  3. package/plugin.ts +13 -2
package/README.md CHANGED
@@ -125,12 +125,10 @@ More about Nuxt configuration can be found [HERE](https://nuxt.com/docs/getting-
125
125
 
126
126
  Full changelog for stable version is available [here](https://github.com/shopware/frontends/blob/main/packages/nuxt-module/CHANGELOG.md)
127
127
 
128
- ### Latest changes: 1.3.1
128
+ ### Latest changes: 1.4.1
129
129
 
130
130
  ### Patch Changes
131
131
 
132
- - [#1628](https://github.com/shopware/frontends/pull/1628) [`a22588f`](https://github.com/shopware/frontends/commit/a22588f12393309d356c5d2f1a16526591f4e3d5) Thanks [@mkucmus](https://github.com/mkucmus)! - Read private shopware config only in SSR context.
133
-
134
- - Updated dependencies [[`7324620`](https://github.com/shopware/frontends/commit/7324620a3f39c1b62f7cc294192a3e8b8b336d09)]:
135
- - @shopware/api-client@1.2.1
136
- - @shopware/composables@1.8.1
132
+ - Updated dependencies [[`ab040bb`](https://github.com/shopware/frontends/commit/ab040bb6cc05541001a983c26d5cb6dbf3192394), [`c8fa438`](https://github.com/shopware/frontends/commit/c8fa438b38de6dbc43a2895f2d1906907447c384)]:
133
+ - @shopware/composables@1.9.1
134
+ - @shopware/helpers@1.5.0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shopware/nuxt-module",
3
- "version": "1.3.1",
3
+ "version": "1.4.1",
4
4
  "description": "Nuxt 3 module for Shopware Frontends",
5
5
  "author": "Shopware",
6
6
  "repository": {
@@ -34,18 +34,19 @@
34
34
  "index.cjs"
35
35
  ],
36
36
  "dependencies": {
37
- "@nuxt/kit": "3.15.4",
37
+ "@nuxt/kit": "3.17.5",
38
38
  "defu": "6.1.4",
39
+ "h3": "1.15.3",
39
40
  "js-cookie": "3.0.5",
40
- "@shopware/composables": "1.8.1",
41
- "@shopware/helpers": "1.4.0",
42
- "@shopware/api-client": "1.2.1"
41
+ "@shopware/composables": "1.9.1",
42
+ "@shopware/helpers": "1.5.0",
43
+ "@shopware/api-client": "1.3.0"
43
44
  },
44
45
  "devDependencies": {
45
46
  "@biomejs/biome": "1.8.3",
46
- "@nuxt/schema": "3.15.4",
47
- "nuxt": "3.15.4",
48
- "typescript": "5.6.3",
47
+ "@nuxt/schema": "3.17.5",
48
+ "nuxt": "3.17.5",
49
+ "typescript": "5.8.3",
49
50
  "unbuild": "2.0.0",
50
51
  "tsconfig": "0.0.0"
51
52
  },
package/plugin.ts CHANGED
@@ -1,6 +1,5 @@
1
1
  import { createAPIClient } from "@shopware/api-client";
2
2
  import { isMaintenanceMode } from "@shopware/helpers";
3
- import { defu } from "defu";
4
3
  import { getCookie } from "h3";
5
4
  import Cookies from "js-cookie";
6
5
  import { ref } from "vue";
@@ -8,6 +7,7 @@ import {
8
7
  createShopwareContext,
9
8
  defineNuxtPlugin,
10
9
  showError,
10
+ useRequestHeaders,
11
11
  useRuntimeConfig,
12
12
  useState,
13
13
  } from "#imports";
@@ -55,7 +55,7 @@ export default defineNuxtPlugin((NuxtApp) => {
55
55
  !!runtimeConfig?.shopware?.useUserContextInSSR;
56
56
 
57
57
  const contextTokenFromCookie = NuxtApp.ssrContext
58
- ? getCookie(NuxtApp.ssrContext?.event, "sw-context-token")
58
+ ? getCookie(NuxtApp.ssrContext.event, "sw-context-token")
59
59
  : Cookies.get("sw-context-token");
60
60
 
61
61
  const apiClient = createAPIClient({
@@ -89,11 +89,22 @@ export default defineNuxtPlugin((NuxtApp) => {
89
89
  }
90
90
  });
91
91
 
92
+ // Get browser locale in CSR and SSR
93
+ let browserLocale = "en-US";
94
+ if (import.meta.client) {
95
+ browserLocale = navigator.language;
96
+ } else {
97
+ browserLocale =
98
+ useRequestHeaders()["accept-language"]?.split(",")[0]?.split(";")[0] ??
99
+ "en-US";
100
+ }
101
+
92
102
  NuxtApp.vueApp.provide("apiClient", apiClient);
93
103
  // Shopware context
94
104
  const shopwareContext = createShopwareContext(NuxtApp.vueApp, {
95
105
  enableDevtools: true,
96
106
  devStorefrontUrl: runtimeConfig.public.shopware?.devStorefrontUrl || null,
107
+ browserLocale,
97
108
  });
98
109
  NuxtApp.vueApp.provide("shopware", shopwareContext);
99
110