@shopware/nuxt-module 1.4.3 → 1.4.4

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 CHANGED
@@ -161,15 +161,16 @@ Import your custom types from local files and export them as shown above. This a
161
161
 
162
162
  Full changelog for stable version is available [here](https://github.com/shopware/frontends/blob/main/packages/nuxt-module/CHANGELOG.md)
163
163
 
164
- ### Latest changes: 1.4.3
164
+ ### Latest changes: 1.4.4
165
165
 
166
166
  ### Patch Changes
167
167
 
168
- - [#2232](https://github.com/shopware/frontends/pull/2232) [`f52c2da`](https://github.com/shopware/frontends/commit/f52c2da685c0c5085e6579aea37f86b6ce1d8281) Thanks [@patzick](https://github.com/patzick)! - bump h3 version after security audit
168
+ - [#2370](https://github.com/shopware/frontends/pull/2370) [`9661432`](https://github.com/shopware/frontends/commit/96614324dfed3d9d83fbf85710145dd529a23f46) Thanks [@patzick](https://github.com/patzick)! - Fix SSR and CSR Shopware endpoint handling in the Nuxt module.
169
169
 
170
- - [#2321](https://github.com/shopware/frontends/pull/2321) [`5a785cc`](https://github.com/shopware/frontends/commit/5a785ccff72c4fe95ec3f774eeb7053e8b1e55fa) Thanks [@mkucmus](https://github.com/mkucmus)! - Auto-inject `#shopware` types via `addTypeTemplate`, skip if project provides own `shopware.d.ts`
170
+ The module now persists the resolved SSR endpoint into private runtime config,
171
+ avoids reading private runtime config on the client, and correctly honors both
172
+ `endpoint` and deprecated `shopwareEndpoint` values during server rendering.
171
173
 
172
- - Updated dependencies [[`9604f22`](https://github.com/shopware/frontends/commit/9604f22678150d04c3c3156fd8ee2ce440c8c8bf), [`b40305f`](https://github.com/shopware/frontends/commit/b40305f9e2ec51f29c279650e411bb773438faed), [`432dd24`](https://github.com/shopware/frontends/commit/432dd246571dfa8c149293da97d5bb16f505e54c), [`b5f7e2a`](https://github.com/shopware/frontends/commit/b5f7e2a20c9dfdde1690e9006252d847f732bc0a), [`b5f7e2a`](https://github.com/shopware/frontends/commit/b5f7e2a20c9dfdde1690e9006252d847f732bc0a), [`9604f22`](https://github.com/shopware/frontends/commit/9604f22678150d04c3c3156fd8ee2ce440c8c8bf), [`a871c7b`](https://github.com/shopware/frontends/commit/a871c7b6256b75c2e40d93fc0354ba1971420062), [`c9bde38`](https://github.com/shopware/frontends/commit/c9bde38d497d5c6c2fbd97700a362eb44ce8881f)]:
173
- - @shopware/api-client@1.5.0
174
- - @shopware/composables@1.11.0
175
- - @shopware/helpers@1.7.0
174
+ - Updated dependencies [[`22fc8a7`](https://github.com/shopware/frontends/commit/22fc8a7301f6a7d2612d907ab73555978b651c00), [`bea7f58`](https://github.com/shopware/frontends/commit/bea7f5882cb58c6d47c84a82db5c8ecaf9bcf8ef), [`b8c0091`](https://github.com/shopware/frontends/commit/b8c00913c3afb5e1e63de9565105f8f8e3bf299f)]:
175
+ - @shopware/helpers@1.7.1
176
+ - @shopware/composables@1.11.1
package/dist/index.d.mts CHANGED
@@ -25,4 +25,5 @@ type ShopwareNuxtOptions = {
25
25
  useUserContextInSSR?: boolean;
26
26
  };
27
27
 
28
- export { type ShopwareNuxtOptions, _default as default };
28
+ export { _default as default };
29
+ export type { ShopwareNuxtOptions };
package/dist/index.d.ts CHANGED
@@ -25,4 +25,5 @@ type ShopwareNuxtOptions = {
25
25
  useUserContextInSSR?: boolean;
26
26
  };
27
27
 
28
- export { type ShopwareNuxtOptions, _default as default };
28
+ export { _default as default };
29
+ export type { ShopwareNuxtOptions };
package/dist/index.mjs CHANGED
@@ -21,24 +21,37 @@ const index = defineNuxtModule({
21
21
  async setup(options, nuxt) {
22
22
  const logger = useLogger(MODULE_ID);
23
23
  const resolver = createResolver(import.meta.url);
24
- const shopwareConfig = nuxt.options.runtimeConfig?.public?.shopware ?? void 0;
24
+ nuxt.options.runtimeConfig.shopware = defu(
25
+ nuxt.options.runtimeConfig.shopware || {},
26
+ options || {}
27
+ );
25
28
  nuxt.options.runtimeConfig.public.shopware = defu(
26
29
  nuxt.options.runtimeConfig.public.shopware || {},
27
30
  options || {}
28
31
  );
29
- if (isConfigDeprecated(shopwareConfig)) {
32
+ const resolvedPublicShopwareConfig = nuxt.options.runtimeConfig.public.shopware;
33
+ const resolvedPrivateShopwareConfig = nuxt.options.runtimeConfig.shopware;
34
+ if (isConfigDeprecated(resolvedPublicShopwareConfig) || isConfigDeprecated(resolvedPrivateShopwareConfig)) {
30
35
  logger.warn(
31
36
  "You are using deprecated configuration (shopwareEndpoint or shopwareAccessToken). 'shopware' prefix is not needed anymore. Please update your _nuxt.config.ts_ "
32
37
  );
33
38
  }
34
- if (shopwareConfig?.endpoint) {
35
- logger.info(
36
- `You are using SSR Shopware API endpoint: ${shopwareConfig.endpoint}`
39
+ const envPublicEndpoint = process.env.NUXT_PUBLIC_SHOPWARE_ENDPOINT || process.env.NUXT_PUBLIC_SHOPWARE_SHOPWARE_ENDPOINT;
40
+ const envPrivateEndpoint = process.env.NUXT_SHOPWARE_ENDPOINT || process.env.NUXT_SHOPWARE_SHOPWARE_ENDPOINT;
41
+ const csrEndpoint = envPublicEndpoint || resolvedPublicShopwareConfig?.endpoint || resolvedPublicShopwareConfig?.shopwareEndpoint;
42
+ const ssrEndpoint = envPrivateEndpoint || resolvedPrivateShopwareConfig?.endpoint || resolvedPrivateShopwareConfig?.shopwareEndpoint || csrEndpoint;
43
+ if (ssrEndpoint) {
44
+ nuxt.options.runtimeConfig.shopware = defu(
45
+ nuxt.options.runtimeConfig.shopware || {},
46
+ {
47
+ endpoint: ssrEndpoint
48
+ }
37
49
  );
38
50
  }
39
- logger.info(
40
- `CSR Shopware API endpoint: ${shopwareConfig?.endpoint ?? shopwareConfig?.shopwareEndpoint}`
41
- );
51
+ if (ssrEndpoint) {
52
+ logger.info(`You are using SSR Shopware API endpoint: ${ssrEndpoint}`);
53
+ }
54
+ logger.info(`CSR Shopware API endpoint: ${csrEndpoint}`);
42
55
  addPlugin({
43
56
  src: resolver.resolve("../plugin.ts")
44
57
  });
@@ -58,6 +71,15 @@ const index = defineNuxtModule({
58
71
  src: "https://frontends.shopware.com/"
59
72
  }
60
73
  });
74
+ addCustomTab({
75
+ name: "shopware-cms",
76
+ title: "CMS Elements",
77
+ icon: "carbon:assembly-cluster",
78
+ view: {
79
+ type: "iframe",
80
+ src: "https://frontends.shopware.com/getting-started/cms/"
81
+ }
82
+ });
61
83
  }
62
84
  });
63
85
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shopware/nuxt-module",
3
- "version": "1.4.3",
3
+ "version": "1.4.4",
4
4
  "description": "Nuxt 3 module for Shopware Frontends",
5
5
  "author": "Shopware",
6
6
  "repository": {
@@ -34,21 +34,21 @@
34
34
  "index.cjs"
35
35
  ],
36
36
  "dependencies": {
37
- "@nuxt/kit": "4.2.2",
38
- "defu": "6.1.4",
39
- "h3": "1.15.9",
37
+ "@nuxt/kit": "4.4.6",
38
+ "defu": "6.1.7",
39
+ "h3": "1.15.11",
40
40
  "js-cookie": "3.0.5",
41
- "@shopware/composables": "1.11.0",
42
- "@shopware/helpers": "1.7.0",
41
+ "@shopware/composables": "1.11.1",
42
+ "@shopware/helpers": "1.7.1",
43
43
  "@shopware/api-client": "1.5.0"
44
44
  },
45
45
  "devDependencies": {
46
46
  "@biomejs/biome": "1.8.3",
47
- "@nuxt/schema": "4.2.2",
48
- "@typescript/native-preview": "7.0.0-dev.20260111.1",
49
- "nuxt": "4.2.2",
47
+ "@nuxt/schema": "4.4.6",
48
+ "@typescript/native-preview": "7.0.0-dev.20260205.1",
49
+ "nuxt": "4.4.6",
50
50
  "unbuild": "2.0.0",
51
- "vitest": "4.0.18",
51
+ "vitest": "4.1.6",
52
52
  "tsconfig": "0.0.0"
53
53
  },
54
54
  "scripts": {
package/plugin.ts CHANGED
@@ -31,14 +31,18 @@ export default defineNuxtPlugin((NuxtApp) => {
31
31
 
32
32
  const shopwareRuntimeConfigPublic = runtimeConfig.public
33
33
  .shopware as ShopwareNuxtOptions;
34
- const shopwareRuntimeConfig = runtimeConfig.shopware as ShopwareNuxtOptions;
34
+ const shopwareRuntimeConfig = import.meta.server
35
+ ? (runtimeConfig.shopware as ShopwareNuxtOptions)
36
+ : undefined;
35
37
 
36
38
  const shopwareEndpointCSR =
37
39
  shopwareRuntimeConfigPublic?.endpoint ??
38
40
  shopwareRuntimeConfigPublic?.shopwareEndpoint;
39
41
 
40
42
  const shopwareEndpointSSR =
41
- (NuxtApp.ssrContext && shopwareRuntimeConfig?.endpoint) ||
43
+ (NuxtApp.ssrContext &&
44
+ (shopwareRuntimeConfig?.endpoint ??
45
+ shopwareRuntimeConfig?.shopwareEndpoint)) ||
42
46
  shopwareEndpointCSR;
43
47
 
44
48
  const shopwareEndpoint = import.meta.server
@@ -68,6 +72,10 @@ export default defineNuxtPlugin((NuxtApp) => {
68
72
  headers?: Record<string, string>;
69
73
  };
70
74
 
75
+ const privateApiClientConfig = import.meta.server
76
+ ? (runtimeConfig.apiClientConfig as ApiClientConfig)
77
+ : undefined;
78
+
71
79
  const apiClient = createAPIClient({
72
80
  baseURL: shopwareEndpoint,
73
81
  accessToken: shopwareAccessToken,
@@ -75,8 +83,7 @@ export default defineNuxtPlugin((NuxtApp) => {
75
83
  ? contextTokenFromCookie
76
84
  : "",
77
85
  defaultHeaders:
78
- (NuxtApp.ssrContext &&
79
- (runtimeConfig.apiClientConfig as ApiClientConfig)?.headers) ||
86
+ (NuxtApp.ssrContext && privateApiClientConfig?.headers) ||
80
87
  (runtimeConfig.public?.apiClientConfig as ApiClientConfig)?.headers,
81
88
  });
82
89