@scayle/storefront-nuxt 8.0.1 → 8.1.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,11 @@
1
1
  # @scayle/storefront-nuxt
2
2
 
3
+ ## 8.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - **Breaking:** `useBasket` no longer accepts `orderCustomData` in its parameters. This functionality was unintentionally added and was never officially supported. Now it has been removed.
8
+
3
9
  ## 8.0.1
4
10
 
5
11
  ### Patch Changes
package/dist/module.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scayle/storefront-nuxt",
3
- "version": "8.0.1",
3
+ "version": "8.1.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.0.1";
48
+ const PACKAGE_VERSION = "8.1.0";
49
49
  const logger = createConsola({
50
50
  fancy: true,
51
51
  formatOptions: {
@@ -4,7 +4,7 @@ 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
6
  type UseBasketOptions = Partial<{
7
- params: MaybeRefOrGetter<RpcMethodParameters<'getBasket'>>;
7
+ params: MaybeRefOrGetter<Omit<RpcMethodParameters<'getBasket'>, 'orderCustomData'>>;
8
8
  key: string;
9
9
  }>;
10
10
  type UseBasketBaseReturn = Omit<Awaited<UseRpcReturn<'getBasket'>>, 'data'> & {
@@ -14,7 +14,6 @@ import {
14
14
  import { useRpcCall } from "../core/useRpcCall.js";
15
15
  import {
16
16
  toValue,
17
- toRef,
18
17
  computed
19
18
  } from "vue";
20
19
  import { FetchError } from "ofetch";
@@ -26,10 +25,18 @@ export function useBasket({
26
25
  const mergeBasketsRpc = useRpcCall("mergeBaskets");
27
26
  const clearBasketRpc = useRpcCall("clearBasket");
28
27
  const removeItemFromBasketRpc = useRpcCall("removeItemFromBasket");
29
- const asyncData = useRpc("getBasket", key, params, {
28
+ const sanitizedParams = computed(() => {
29
+ const rawParams = toValue(params);
30
+ if (rawParams && "orderCustomData" in rawParams) {
31
+ const { orderCustomData, ...sanitized } = rawParams;
32
+ return sanitized;
33
+ }
34
+ return rawParams;
35
+ });
36
+ const asyncData = useRpc("getBasket", key, sanitizedParams, {
30
37
  server: false,
31
38
  // NOTE: In some cases it might be ok to fetch on server
32
- watch: [toRef(params)],
39
+ watch: [sanitizedParams],
33
40
  dedupe: "defer",
34
41
  transform: (basketResponse) => basketResponse.basket,
35
42
  getCachedData: (key2, nuxtApp) => {
@@ -60,7 +67,7 @@ export function useBasket({
60
67
  displayData,
61
68
  customData,
62
69
  itemGroup,
63
- with: toValue(params)
70
+ with: toValue(sanitizedParams)
64
71
  });
65
72
  data.value = basket;
66
73
  handleBasketError(basketErrors);
@@ -73,7 +80,7 @@ export function useBasket({
73
80
  const { basket, errors: basketErrors } = await addItemsToBasketRpc({
74
81
  items: items2,
75
82
  existingItemHandling,
76
- with: toValue(params)
83
+ with: toValue(sanitizedParams)
77
84
  });
78
85
  data.value = basket;
79
86
  handleBasketError(basketErrors);
@@ -104,7 +111,7 @@ export function useBasket({
104
111
  const mergeBaskets = async (args) => {
105
112
  return await mergeBasketsRpc({
106
113
  ...args,
107
- with: toValue(params)
114
+ with: toValue(sanitizedParams)
108
115
  });
109
116
  };
110
117
  const findItem = (item) => {
@@ -127,14 +134,14 @@ export function useBasket({
127
134
  }
128
135
  const { basket } = await removeItemFromBasketRpc({
129
136
  itemKey: element.key,
130
- with: toValue(params)
137
+ with: toValue(sanitizedParams)
131
138
  });
132
139
  data.value = basket;
133
140
  };
134
141
  const removeItemByKey = async (itemKey) => {
135
142
  const { basket } = await removeItemFromBasketRpc({
136
143
  itemKey,
137
- with: toValue(params)
144
+ with: toValue(sanitizedParams)
138
145
  });
139
146
  data.value = basket;
140
147
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@scayle/storefront-nuxt",
3
3
  "type": "module",
4
- "version": "8.0.1",
4
+ "version": "8.1.0",
5
5
  "description": "Nuxt integration for the SCAYLE Commerce Engine and Storefront API",
6
6
  "author": "SCAYLE Commerce Engine",
7
7
  "license": "MIT",