@scayle/storefront-nuxt 8.5.3 → 8.6.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/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # @scayle/storefront-nuxt
2
2
 
3
+ ## 8.6.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [Basket] Add support to update existing basket items to `useBasket`
8
+
9
+ ## 8.5.4
10
+
11
+ ### Patch Changes
12
+
13
+ **Dependencies**
14
+
15
+ - Updated dependency to @scayle/storefront-core@8.3.1
16
+
3
17
  ## 8.5.3
4
18
 
5
19
  ### Patch Changes
package/dist/module.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scayle/storefront-nuxt",
3
- "version": "8.5.3",
3
+ "version": "8.6.0",
4
4
  "configKey": "storefront",
5
5
  "compatibility": {
6
6
  "nuxt": "^3.9.0"
package/dist/module.mjs CHANGED
@@ -45,7 +45,7 @@ export default {
45
45
  }`;
46
46
  }
47
47
  const PACKAGE_NAME = "@scayle/storefront-nuxt";
48
- const PACKAGE_VERSION = "8.5.3";
48
+ const PACKAGE_VERSION = "8.6.0";
49
49
  const logger = createConsola({
50
50
  fancy: true,
51
51
  formatOptions: {
@@ -3,6 +3,7 @@ import { ExistingItemHandling } from '@scayle/storefront-core';
3
3
  import { type NormalizedRpcResponse, type UseRpcReturn } from '../core/useRpc.js';
4
4
  import { type MaybeRefOrGetter, type ComputedRef, type Ref } from 'vue';
5
5
  import type { BasketKey, BasketPackageInformation } from '@scayle/storefront-api';
6
+ import type { BasketItemUpdateData } from '@scayle/storefront-core/dist/rpc/methods/index';
6
7
  type UseBasketOptions = Partial<{
7
8
  params: MaybeRefOrGetter<Omit<RpcMethodParameters<'getBasket'>, 'orderCustomData'>>;
8
9
  key: string;
@@ -32,6 +33,7 @@ type UseBasketBaseReturn = Omit<Awaited<UseRpcReturn<'getBasket'>>, 'data'> & {
32
33
  variantId: number;
33
34
  }) => Promise<void>;
34
35
  removeItemByKey: (itemKey: string) => Promise<void>;
36
+ updateItem: (basketItemKey: string, update: BasketItemUpdateData) => Promise<void>;
35
37
  clear: () => Promise<void>;
36
38
  products: ComputedRef<Product[]>;
37
39
  count: ComputedRef<number | undefined>;
@@ -22,6 +22,7 @@ export function useBasket({
22
22
  } = {}, key = "useBasket") {
23
23
  const addItemToBasketRpc = useRpcCall("addItemToBasket");
24
24
  const addItemsToBasketRpc = useRpcCall("addItemsToBasket");
25
+ const updateBasketItemRpc = useRpcCall("updateBasketItem");
25
26
  const mergeBasketsRpc = useRpcCall("mergeBaskets");
26
27
  const clearBasketRpc = useRpcCall("clearBasket");
27
28
  const removeItemFromBasketRpc = useRpcCall("removeItemFromBasket");
@@ -145,6 +146,14 @@ export function useBasket({
145
146
  });
146
147
  data.value = basket;
147
148
  };
149
+ const updateItem = async (basketItemKey, updateData) => {
150
+ const { basket } = await updateBasketItemRpc({
151
+ basketItemKey,
152
+ update: updateData,
153
+ with: toValue(sanitizedParams)
154
+ });
155
+ data.value = basket;
156
+ };
148
157
  const clear = async () => {
149
158
  await clearBasketRpc();
150
159
  };
@@ -210,6 +219,7 @@ export function useBasket({
210
219
  addItems,
211
220
  removeItem,
212
221
  removeItemByKey,
222
+ updateItem,
213
223
  clear,
214
224
  contains,
215
225
  products,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@scayle/storefront-nuxt",
3
3
  "type": "module",
4
- "version": "8.5.3",
4
+ "version": "8.6.0",
5
5
  "description": "Nuxt integration for the SCAYLE Commerce Engine and Storefront API",
6
6
  "author": "SCAYLE Commerce Engine",
7
7
  "license": "MIT",
@@ -72,7 +72,7 @@
72
72
  "dependencies": {
73
73
  "@opentelemetry/api": "^1.9.0",
74
74
  "@scayle/h3-session": "0.6.0",
75
- "@scayle/storefront-core": "8.3.0",
75
+ "@scayle/storefront-core": "8.3.1",
76
76
  "@scayle/unstorage-compression-driver": "^0.2.3",
77
77
  "@vueuse/core": "12.5.0",
78
78
  "consola": "^3.2.3",
@@ -97,7 +97,7 @@
97
97
  "@nuxt/test-utils": "3.15.4",
98
98
  "@scayle/eslint-config-storefront": "4.4.1",
99
99
  "@scayle/eslint-plugin-vue-composable": "0.2.1",
100
- "@types/node": "22.10.9",
100
+ "@types/node": "22.10.10",
101
101
  "dprint": "0.48.0",
102
102
  "eslint": "9.18.0",
103
103
  "eslint-formatter-gitlab": "5.1.0",