@shopware/nuxt-module 1.3.1 → 1.4.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/README.md +8 -6
- package/package.json +7 -7
- package/plugin.ts +12 -1
package/README.md
CHANGED
|
@@ -125,12 +125,14 @@ 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.
|
|
128
|
+
### Latest changes: 1.4.0
|
|
129
129
|
|
|
130
|
-
###
|
|
130
|
+
### Minor Changes
|
|
131
|
+
|
|
132
|
+
- [#1812](https://github.com/shopware/frontends/pull/1812) [`c28810d`](https://github.com/shopware/frontends/commit/c28810d0ca503b97c232438e200bbf5ba5dab403) Thanks [@patzick](https://github.com/patzick)! - `useShopwareContext` - added `browserLocale` field. With nuxt-module it's automatically injected into context. Should be used for proper date formatting.
|
|
131
133
|
|
|
132
|
-
|
|
134
|
+
### Patch Changes
|
|
133
135
|
|
|
134
|
-
- Updated dependencies [[`
|
|
135
|
-
- @shopware/api-client@1.
|
|
136
|
-
- @shopware/composables@1.
|
|
136
|
+
- Updated dependencies [[`d016d6b`](https://github.com/shopware/frontends/commit/d016d6b845bff9a148405a74dae88d7fc81ec99c), [`c28810d`](https://github.com/shopware/frontends/commit/c28810d0ca503b97c232438e200bbf5ba5dab403), [`a7ff606`](https://github.com/shopware/frontends/commit/a7ff60681d1a164d5c9f2020c506262e96fad5dc), [`d016d6b`](https://github.com/shopware/frontends/commit/d016d6b845bff9a148405a74dae88d7fc81ec99c), [`bd70905`](https://github.com/shopware/frontends/commit/bd70905b8443fd57d8d8cb3cfc6501a9117dea49)]:
|
|
137
|
+
- @shopware/api-client@1.3.0
|
|
138
|
+
- @shopware/composables@1.9.0
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shopware/nuxt-module",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"description": "Nuxt 3 module for Shopware Frontends",
|
|
5
5
|
"author": "Shopware",
|
|
6
6
|
"repository": {
|
|
@@ -34,18 +34,18 @@
|
|
|
34
34
|
"index.cjs"
|
|
35
35
|
],
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@nuxt/kit": "3.
|
|
37
|
+
"@nuxt/kit": "3.16.2",
|
|
38
38
|
"defu": "6.1.4",
|
|
39
39
|
"js-cookie": "3.0.5",
|
|
40
|
-
"@shopware/composables": "1.
|
|
40
|
+
"@shopware/composables": "1.9.0",
|
|
41
41
|
"@shopware/helpers": "1.4.0",
|
|
42
|
-
"@shopware/api-client": "1.
|
|
42
|
+
"@shopware/api-client": "1.3.0"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@biomejs/biome": "1.8.3",
|
|
46
|
-
"@nuxt/schema": "3.
|
|
47
|
-
"nuxt": "3.
|
|
48
|
-
"typescript": "5.
|
|
46
|
+
"@nuxt/schema": "3.16.2",
|
|
47
|
+
"nuxt": "3.16.2",
|
|
48
|
+
"typescript": "5.8.3",
|
|
49
49
|
"unbuild": "2.0.0",
|
|
50
50
|
"tsconfig": "0.0.0"
|
|
51
51
|
},
|
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";
|
|
@@ -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
|
|