@scayle/storefront-nuxt 8.0.1 → 8.1.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,19 @@
|
|
|
1
1
|
# @scayle/storefront-nuxt
|
|
2
2
|
|
|
3
|
+
## 8.1.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
**Dependencies**
|
|
8
|
+
|
|
9
|
+
- Updated dependency to @scayle/storefront-core@8.1.1
|
|
10
|
+
|
|
11
|
+
## 8.1.0
|
|
12
|
+
|
|
13
|
+
### Minor Changes
|
|
14
|
+
|
|
15
|
+
- **Breaking:** `useBasket` no longer accepts `orderCustomData` in its parameters. This functionality was unintentionally added and was never officially supported. Now it has been removed.
|
|
16
|
+
|
|
3
17
|
## 8.0.1
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -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
|
|
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: [
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
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.
|
|
4
|
+
"version": "8.1.1",
|
|
5
5
|
"description": "Nuxt integration for the SCAYLE Commerce Engine and Storefront API",
|
|
6
6
|
"author": "SCAYLE Commerce Engine",
|
|
7
7
|
"license": "MIT",
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
"@nuxt/kit": "^3.12.2",
|
|
74
74
|
"@opentelemetry/api": "^1.9.0",
|
|
75
75
|
"@scayle/h3-session": "^0.4.1",
|
|
76
|
-
"@scayle/storefront-core": "8.1.
|
|
76
|
+
"@scayle/storefront-core": "8.1.1",
|
|
77
77
|
"@scayle/unstorage-compression-driver": "^0.1.5",
|
|
78
78
|
"@vueuse/core": "12.0.0",
|
|
79
79
|
"consola": "^3.2.3",
|
|
@@ -94,7 +94,7 @@
|
|
|
94
94
|
"@nuxt/eslint": "0.7.2",
|
|
95
95
|
"@nuxt/module-builder": "0.8.4",
|
|
96
96
|
"@nuxt/schema": "3.13.2",
|
|
97
|
-
"@nuxt/test-utils": "3.15.
|
|
97
|
+
"@nuxt/test-utils": "3.15.1",
|
|
98
98
|
"@scayle/eslint-config-storefront": "4.3.2",
|
|
99
99
|
"@scayle/eslint-plugin-vue-composable": "0.2.1",
|
|
100
100
|
"@types/node": "22.10.1",
|