@scayle/storefront-nuxt 8.41.4 → 8.42.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,144 @@
1
1
  # @scayle/storefront-nuxt
2
2
 
3
+ ## 8.42.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Added `promotions` field to `BasketItem` type to support multiple promotions per basket item.
8
+
9
+ The `promotions` field is an array of `BasketItemPromotion` objects.
10
+ With the introduction of the new `promotions` array field, the `promotion` field is now deprecated.
11
+
12
+ Before:
13
+
14
+ ```json
15
+ "promotion": {
16
+ "id": "123",
17
+ "name": "Promotion 1",
18
+ "isActive": true,
19
+ }
20
+ ```
21
+
22
+ After:
23
+
24
+ ```json
25
+ "promotions": [{
26
+ "id": "123",
27
+ "name": "Promotion 1",
28
+ "isActive": true,
29
+ }]
30
+ ```
31
+
32
+ For more details, see the [Storefront API documentation](https://scayle.dev/en/api-guides/storefront-api/resources/baskets/get-a-basket).
33
+
34
+ - Updated the parameters of the RPC functions `updateBasketItemRpc` and `updateBasketItem` with the new `promotions` attribute.
35
+
36
+ This attribute is used to support multiple promotions on basket items.
37
+
38
+ Before:
39
+
40
+ ```ts
41
+ const updateBasketItemRpc = useRpcCall('updateBasketItem')
42
+ const addItemToBasketRpc = useRpcCall('addItemToBasket')
43
+
44
+ updateBasketItemRpc({
45
+ // ...
46
+ promotionId: 'promotionId',
47
+ promotionCode: 'promotionCode',
48
+ })
49
+
50
+ addItemToBasketRpc({
51
+ // ...
52
+ promotionId: 'promotionId',
53
+ promotionCode: 'promotionCode',
54
+ })
55
+
56
+ // Or with useBasket composable
57
+
58
+ const { addItem } = useBasket()
59
+ addItem({
60
+ // ...
61
+ promotionId: 'promotionId',
62
+ })
63
+ ```
64
+
65
+ After:
66
+
67
+ ```ts
68
+ const updateBasketItemRpc = useRpcCall('updateBasketItem')
69
+ const addItemToBasketRpc = useRpcCall('addItemToBasket')
70
+
71
+ updateBasketItemRpc({
72
+ // ...
73
+ promotions: [
74
+ { id: 'promotionId', code: 'promotionCode' },
75
+ {
76
+ id: 'promotionId2',
77
+ },
78
+ ],
79
+ })
80
+
81
+ addItemToBasketRpc({
82
+ // ...
83
+ promotions: [
84
+ { id: 'promotionId', code: 'promotionCode' },
85
+ {
86
+ id: 'promotionId2',
87
+ },
88
+ ],
89
+ })
90
+
91
+ // Or for useBasket with composable
92
+
93
+ const { addItem } = useBasket()
94
+ addItem({
95
+ // ...
96
+ promotions: [
97
+ { id: 'promotionId', code: 'promotionCode' },
98
+ {
99
+ id: 'promotionId2',
100
+ },
101
+ ],
102
+ })
103
+ ```
104
+
105
+ For more details, see the [Add a variant](https://scayle.dev/en/api-guides/storefront-api/resources/baskets/add-a-variant) and [Update an item](https://scayle.dev/en/api-guides/storefront-api/resources/baskets/update-an-item) guides.
106
+
107
+ ### Patch Changes
108
+
109
+ **Dependencies**
110
+
111
+ **@scayle/storefront-core v8.42.0**
112
+
113
+ - Minor
114
+
115
+ - Added `promotions` field to `BasketItem` type to support multiple promotions per basket item.
116
+
117
+ The `promotions` field is an array of `BasketItemPromotion` objects.
118
+ With the introduction of the new `promotions` array field, the `promotion` field is now deprecated.
119
+
120
+ Before:
121
+
122
+ ```json
123
+ "promotion": {
124
+ "id": "123",
125
+ "name": "Promotion 1",
126
+ "isActive": true,
127
+ }
128
+ ```
129
+
130
+ After:
131
+
132
+ ```json
133
+ "promotions": [{
134
+ "id": "123",
135
+ "name": "Promotion 1",
136
+ "isActive": true,
137
+ }]
138
+ ```
139
+
140
+ For more details, see the [Storefront API documentation](https://scayle.dev/en/api-guides/storefront-api/resources/baskets/get-a-basket).
141
+
3
142
  ## 8.41.4
4
143
 
5
144
  ### Patch Changes
package/dist/module.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scayle/storefront-nuxt",
3
- "version": "8.41.4",
3
+ "version": "8.42.0",
4
4
  "configKey": "storefront",
5
5
  "compatibility": {
6
6
  "nuxt": "^3.9.0"
package/dist/module.mjs CHANGED
@@ -54,7 +54,7 @@ export default {
54
54
  }`;
55
55
  }
56
56
  const PACKAGE_NAME = "@scayle/storefront-nuxt";
57
- const PACKAGE_VERSION = "8.41.4";
57
+ const PACKAGE_VERSION = "8.42.0";
58
58
  const logger = createConsola({
59
59
  fancy: true,
60
60
  formatOptions: {
@@ -51,6 +51,7 @@ export function useBasket({
51
51
  const addItem = async ({
52
52
  variantId,
53
53
  promotionId,
54
+ promotions,
54
55
  quantity,
55
56
  existingItemHandling,
56
57
  displayData,
@@ -60,6 +61,7 @@ export function useBasket({
60
61
  try {
61
62
  const { basket, errors: basketErrors } = await addItemToBasketRpc({
62
63
  promotionId,
64
+ promotions,
63
65
  variantId,
64
66
  quantity,
65
67
  existingItemHandling,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@scayle/storefront-nuxt",
3
3
  "type": "module",
4
- "version": "8.41.4",
4
+ "version": "8.42.0",
5
5
  "description": "Nuxt integration for the SCAYLE Commerce Engine and Storefront API",
6
6
  "author": "SCAYLE Commerce Engine",
7
7
  "license": "MIT",
@@ -90,7 +90,7 @@
90
90
  "utility-types": "^3.11.0",
91
91
  "vue-router": "^4.4.0",
92
92
  "zod": "^4.0.0",
93
- "@scayle/storefront-core": "8.41.4",
93
+ "@scayle/storefront-core": "8.42.0",
94
94
  "@scayle/unstorage-compression-driver": "1.1.0"
95
95
  },
96
96
  "devDependencies": {