@scayle/storefront-nuxt 8.61.3 → 8.62.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,84 @@
1
1
  # @scayle/storefront-nuxt
2
2
 
3
+ ## 8.62.1
4
+
5
+ ### Patch Changes
6
+
7
+ - **\[Security\]** Use the patched Nuxt for build — `nuxt@3.21.8` (3.x) / `nuxt@4.4.8` (4.x), with matching `@nuxt/kit` and `@nuxt/schema` — which includes the fix for [CVE-2026-53721](https://nvd.nist.gov/vuln/detail/CVE-2026-53721) ([GHSA-mm7m-92g8-7m47](https://github.com/nuxt/nuxt/security/advisories/GHSA-mm7m-92g8-7m47)), a route-rule middleware bypass.
8
+
9
+ Compatibility with previously-supported Nuxt versions is unchanged and remains specified via each package's `peerDependencies` and the Nuxt compatibility flag. `@scayle/storefront-core` is released in lockstep with `@scayle/storefront-nuxt`.
10
+
11
+ **Dependencies**
12
+
13
+ **@scayle/storefront-core v8.62.1**
14
+
15
+ - No changes in this release.
16
+
17
+ ## 8.62.0
18
+
19
+ ### Minor Changes
20
+
21
+ - **\[Promotions\]** Enabled promotion segmentation on the client for `usePromotions`, `useCurrentPromotions`, and `usePromotionsByIds`.
22
+
23
+ These composables inject `segmentation: true` when `import.meta.client` is true, so logged-in shoppers receive promotions tailored to their customer segment without passing the flag manually. Server-side calls keep `segmentation: false` and continue to use the cached anonymous promotion list so customer-specific promotions are not stored in shared cache responses.
24
+
25
+ The public `params` type omits `segmentation` on these composables so storefront code does not set it directly.
26
+
27
+ **\[BREAKING\]** `usePromotionsByIds` now accepts `{ ids: string[] }` for `params` instead of `string[]`.
28
+ - Before:
29
+
30
+ ```ts
31
+ const { data } = usePromotionsByIds({
32
+ params: ['promo-1', 'promo-2'],
33
+ })
34
+ ```
35
+
36
+ - After:
37
+
38
+ ```ts
39
+ const { data } = usePromotionsByIds({
40
+ params: {
41
+ ids: ['promo-1', 'promo-2'],
42
+ },
43
+ })
44
+ ```
45
+
46
+ Segmentation is applied automatically on the client, same as `usePromotions` and `useCurrentPromotions`.
47
+
48
+ ### Patch Changes
49
+
50
+ **Dependencies**
51
+
52
+ **@scayle/storefront-core v8.62.0**
53
+
54
+ - Minor
55
+ - **\[Promotions\]** Added customer-segmented promotion fetches when a valid session token is present.
56
+
57
+ `getPromotions`, `getCurrentPromotions`, and `getPromotionsByIds` accept a `segmentation` flag. When it is `true` and the request has a non-expired access token, the handlers call the Storefront API with `customerToken` and skip the shared cache so results match the logged-in customer. When it is `false`, handlers use the cached anonymous promotion list so customer-specific promotions are not stored in shared cache responses.
58
+
59
+ **\[BREAKING\]** `getPromotionsByIds` now expects `{ ids: string[], segmentation: boolean }` instead of a bare `string[]` array.
60
+ - Before (custom RPC handler via `context.callRpc`):
61
+
62
+ ```ts
63
+ const promotions = await context.callRpc?.('getPromotionsByIds', [
64
+ 'promo-1',
65
+ 'promo-2',
66
+ ])
67
+ ```
68
+
69
+ - After:
70
+
71
+ ```ts
72
+ const promotions = await context.callRpc?.('getPromotionsByIds', {
73
+ ids: ['promo-1', 'promo-2'],
74
+ segmentation: true,
75
+ })
76
+ ```
77
+
78
+ Promotion list handlers use `POST` instead of `GET` so `segmentation` and `customerToken` are not sent in the URL.
79
+
80
+ **\[User\]** Exported `getValidatedAccessToken` to return a JWT only when it is present and not expired. Basket merge and promotion handlers use it when passing `customerToken` to the Storefront API.
81
+
3
82
  ## 8.61.3
4
83
 
5
84
  ### Patch Changes
package/dist/module.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scayle/storefront-nuxt",
3
- "version": "8.61.3",
3
+ "version": "8.62.1",
4
4
  "configKey": "storefront",
5
5
  "compatibility": {
6
6
  "nuxt": ">=3.13"
package/dist/module.mjs CHANGED
@@ -57,7 +57,7 @@ export default {
57
57
  }`;
58
58
  }
59
59
  const PACKAGE_NAME = "@scayle/storefront-nuxt";
60
- const PACKAGE_VERSION = "8.61.3";
60
+ const PACKAGE_VERSION = "8.62.1";
61
61
  const logger = createConsola({
62
62
  fancy: true,
63
63
  formatOptions: {
@@ -26,6 +26,6 @@ import type { MaybeRefOrGetter } from 'vue';
26
26
  * loading state, and any error information.
27
27
  */
28
28
  export declare function useCurrentPromotions<DataT = NormalizedRpcResponse<'getCurrentPromotions'>, PickKeys extends KeysOf<DataT> = KeysOf<DataT>, DefaultT = null>({ params, options, }?: Partial<{
29
- params: MaybeRefOrGetter<RpcMethodParameters<'getCurrentPromotions'>>;
29
+ params: MaybeRefOrGetter<Omit<RpcMethodParameters<'getCurrentPromotions'>, 'segmentation'>>;
30
30
  options: UseRpcOptions<'getCurrentPromotions', DataT, PickKeys, DefaultT>;
31
31
  }>, key?: UseRpcCacheKey): UseRpcReturn<'getCurrentPromotions', DataT, PickKeys, DefaultT>;
@@ -1,9 +1,16 @@
1
1
  import { useRpc } from "../core/useRpc.js";
2
+ import { toValue } from "vue";
2
3
  export function useCurrentPromotions({
3
4
  params,
4
5
  options
5
6
  } = {}, key = "useCurrentPromotions") {
6
- return useRpc("getCurrentPromotions", key, params, {
7
+ const paramsWithSegmentation = () => {
8
+ return {
9
+ ...toValue(params),
10
+ segmentation: import.meta.client
11
+ };
12
+ };
13
+ return useRpc("getCurrentPromotions", key, paramsWithSegmentation, {
7
14
  getCachedData(cacheKey, nuxtApp) {
8
15
  const hydrationData = nuxtApp.isHydrating ? nuxtApp.payload.data[cacheKey] : nuxtApp.static.data[cacheKey];
9
16
  return hydrationData ?? nuxtApp._asyncData[cacheKey]?.data.value;
@@ -23,6 +23,6 @@ import type { MaybeRefOrGetter } from 'vue';
23
23
  * loading state, and any error information.
24
24
  */
25
25
  export declare function usePromotions<DataT = NormalizedRpcResponse<'getPromotions'>, PickKeys extends KeysOf<DataT> = KeysOf<DataT>, DefaultT = null>({ params, options, }?: Partial<{
26
- params: MaybeRefOrGetter<RpcMethodParameters<'getPromotions'>>;
26
+ params: MaybeRefOrGetter<Omit<RpcMethodParameters<'getPromotions'>, 'segmentation'>>;
27
27
  options: UseRpcOptions<'getPromotions', DataT, PickKeys, DefaultT>;
28
28
  }>, key?: UseRpcCacheKey): UseRpcReturn<'getPromotions', DataT, PickKeys, DefaultT>;
@@ -1,7 +1,14 @@
1
1
  import { useRpc } from "../core/useRpc.js";
2
+ import { toValue } from "vue";
2
3
  export function usePromotions({
3
4
  params,
4
5
  options
5
6
  } = {}, key = "usePromotions") {
6
- return useRpc("getPromotions", key, params, options);
7
+ const paramsWithSegmentation = () => {
8
+ return {
9
+ ...toValue(params),
10
+ segmentation: import.meta.client
11
+ };
12
+ };
13
+ return useRpc("getPromotions", key, paramsWithSegmentation, options);
7
14
  }
@@ -23,6 +23,6 @@ import type { MaybeRefOrGetter } from 'vue';
23
23
  * loading state, and any error information.
24
24
  */
25
25
  export declare function usePromotionsByIds<DataT = NormalizedRpcResponse<'getPromotionsByIds'>, PickKeys extends KeysOf<DataT> = KeysOf<DataT>, DefaultT = null>({ params, options, }?: Partial<{
26
- params: MaybeRefOrGetter<RpcMethodParameters<'getPromotionsByIds'>>;
26
+ params: MaybeRefOrGetter<Omit<RpcMethodParameters<'getPromotionsByIds'>, 'segmentation'>>;
27
27
  options: UseRpcOptions<'getPromotionsByIds', DataT, PickKeys, DefaultT>;
28
28
  }>, key?: UseRpcCacheKey): UseRpcReturn<'getPromotionsByIds', DataT, PickKeys, DefaultT>;
@@ -1,7 +1,15 @@
1
1
  import { useRpc } from "../core/useRpc.js";
2
+ import { toValue } from "vue";
2
3
  export function usePromotionsByIds({
3
4
  params,
4
5
  options
5
6
  } = {}, key = "usePromotionsByIds") {
6
- return useRpc("getPromotionsByIds", key, params, options);
7
+ const paramsWithSegmentation = () => {
8
+ const base = toValue(params);
9
+ return {
10
+ ids: base?.ids ?? [],
11
+ segmentation: import.meta.client
12
+ };
13
+ };
14
+ return useRpc("getPromotionsByIds", key, paramsWithSegmentation, options);
7
15
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@scayle/storefront-nuxt",
3
3
  "type": "module",
4
- "version": "8.61.3",
4
+ "version": "8.62.1",
5
5
  "description": "Nuxt integration for the SCAYLE Commerce Engine and Storefront API",
6
6
  "author": "SCAYLE Commerce Engine",
7
7
  "license": "MIT",
@@ -68,7 +68,7 @@
68
68
  },
69
69
  "peerDependencies": {
70
70
  "@nuxt/kit": ">=3.13.0 || >=4.2.0",
71
- "@scayle/storefront-api": "^19.0.0",
71
+ "@scayle/storefront-api": "^19.1.2",
72
72
  "fishery": "^2.2.2",
73
73
  "h3": "^1.10.0",
74
74
  "nitropack": "^2.9.7",
@@ -97,35 +97,35 @@
97
97
  "vue-router": "^4.4.0",
98
98
  "zod": "^4.0.0",
99
99
  "@scayle/h3-session": "0.7.0",
100
- "@scayle/storefront-core": "8.61.3"
100
+ "@scayle/storefront-core": "8.62.1"
101
101
  },
102
102
  "devDependencies": {
103
103
  "@arethetypeswrong/cli": "0.18.2",
104
104
  "@nuxt/eslint-config": "1.15.2",
105
- "@nuxt/kit": "^3.20.2",
105
+ "@nuxt/kit": "^3.21.7",
106
106
  "@nuxtjs/i18n": "10.4.0",
107
107
  "@nuxt/module-builder": "1.0.2",
108
- "@nuxt/schema": "^3.20.2",
108
+ "@nuxt/schema": "^3.21.7",
109
109
  "@nuxt/test-utils": "4.0.0",
110
110
  "@scayle/eslint-config-storefront": "^4.8.0",
111
111
  "@scayle/eslint-plugin-vue-composable": "^1.1.0",
112
112
  "@scayle/unstorage-scayle-kv-driver": "^2.1.0",
113
113
  "@types/node": "24.12.2",
114
- "@vitest/coverage-v8": "4.1.7",
115
- "eslint": "10.4.0",
114
+ "@vitest/coverage-v8": "4.1.9",
115
+ "eslint": "10.5.0",
116
116
  "eslint-formatter-gitlab": "7.1.0",
117
117
  "fishery": "2.4.0",
118
118
  "h3": "1.15.11",
119
- "happy-dom": "20.9.0",
119
+ "happy-dom": "20.10.6",
120
120
  "nitro-test-utils": "0.11.2",
121
121
  "nitropack": "2.13.4",
122
122
  "node-mocks-http": "1.17.2",
123
- "nuxt": "^3.20.2",
123
+ "nuxt": "^3.21.7",
124
124
  "publint": "0.3.21",
125
125
  "typescript": "6.0.3",
126
126
  "unbuild": "3.6.1",
127
- "vitest": "4.1.7",
128
- "vue-tsc": "3.3.2",
127
+ "vitest": "4.1.9",
128
+ "vue-tsc": "3.3.5",
129
129
  "@scayle/vitest-config-storefront": "1.0.0"
130
130
  },
131
131
  "scripts": {