@scayle/storefront-nuxt 8.26.1 → 8.27.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,30 @@
1
1
  # @scayle/storefront-nuxt
2
2
 
3
+ ## 8.27.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Updated `useBasket` to include a `getApplicablePromotionsByCode` function. This function fetches the applicable promotions for the current basket.
8
+
9
+ ### Patch Changes
10
+
11
+ **Dependencies**
12
+
13
+ **@scayle/storefront-core v8.27.0**
14
+
15
+ - Minor
16
+ - Added a new `getApplicablePromotionsByCode` RPC method which can be used to fetch applicable promotions for a basket.
17
+
18
+ ## 8.26.2
19
+
20
+ ### Patch Changes
21
+
22
+ **Dependencies**
23
+
24
+ **@scayle/storefront-core v8.26.2**
25
+
26
+ - No changes in this release.
27
+
3
28
  ## 8.26.1
4
29
 
5
30
  ### Patch Changes
package/dist/module.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scayle/storefront-nuxt",
3
- "version": "8.26.1",
3
+ "version": "8.27.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.26.1";
57
+ const PACKAGE_VERSION = "8.27.0";
58
58
  const logger = createConsola({
59
59
  fancy: true,
60
60
  formatOptions: {
@@ -1,5 +1,5 @@
1
1
  import { generateBasketKey } from '@scayle/storefront-core/dist/utils/keys';
2
- import type { AddOrUpdateItemType, RpcMethodParameters, RpcMethodReturnType, BasketItem, Product, BasketTotalPrice } from '@scayle/storefront-core';
2
+ import type { AddOrUpdateItemType, RpcMethodParameters, BasketResponseData, RpcMethodReturnType, BasketItem, Product, BasketTotalPrice } from '@scayle/storefront-core';
3
3
  import { ExistingItemHandling } from '@scayle/storefront-core';
4
4
  import { type NormalizedRpcResponse, type UseRpcReturn } from '../core/useRpc.js';
5
5
  import { type MaybeRefOrGetter, type ComputedRef, type Ref } from 'vue';
@@ -21,6 +21,7 @@ type UseBasketBaseReturn = Omit<Awaited<UseRpcReturn<'getBasket'>>, 'data'> & {
21
21
  addItems: (items: AddOrUpdateItemType[], existingItemHandling?: typeof ExistingItemHandling.ADD_QUANTITY_TO_EXISTING) => Promise<void>;
22
22
  removeItemByKey: (itemKey: string) => Promise<void>;
23
23
  updateItem: (basketItemKey: string, update: BasketItemUpdateData) => Promise<void>;
24
+ getApplicablePromotionsByCode: (promotionCode: string) => Promise<BasketResponseData>;
24
25
  clear: () => Promise<void>;
25
26
  items: ComputedRef<BasketItem[] | undefined>;
26
27
  cost: ComputedRef<BasketTotalPrice | undefined>;
@@ -26,6 +26,9 @@ export function useBasket({
26
26
  const mergeBasketsRpc = useRpcCall("mergeBaskets");
27
27
  const clearBasketRpc = useRpcCall("clearBasket");
28
28
  const removeItemFromBasketRpc = useRpcCall("removeItemFromBasket");
29
+ const getApplicablePromotionsByCodeRpc = useRpcCall(
30
+ "getApplicablePromotionsByCode"
31
+ );
29
32
  const sanitizedParams = computed(() => {
30
33
  const rawParams = toValue(params);
31
34
  if (rawParams && "orderCustomData" in rawParams) {
@@ -154,6 +157,12 @@ export function useBasket({
154
157
  });
155
158
  data.value = basket;
156
159
  };
160
+ const getApplicablePromotionsByCode = async (promotionCode) => {
161
+ const { basket } = await getApplicablePromotionsByCodeRpc({
162
+ promotionCode
163
+ });
164
+ return basket;
165
+ };
157
166
  const clear = async () => {
158
167
  await clearBasketRpc();
159
168
  };
@@ -217,6 +226,7 @@ export function useBasket({
217
226
  removeItemByKey,
218
227
  updateItem,
219
228
  clear,
229
+ getApplicablePromotionsByCode,
220
230
  key: basketKey,
221
231
  packages,
222
232
  shippingDates,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@scayle/storefront-nuxt",
3
3
  "type": "module",
4
- "version": "8.26.1",
4
+ "version": "8.27.0",
5
5
  "description": "Nuxt integration for the SCAYLE Commerce Engine and Storefront API",
6
6
  "author": "SCAYLE Commerce Engine",
7
7
  "license": "MIT",
@@ -81,7 +81,7 @@
81
81
  "dependencies": {
82
82
  "@opentelemetry/api": "^1.9.0",
83
83
  "@scayle/h3-session": "0.6.1",
84
- "@scayle/storefront-core": "8.26.1",
84
+ "@scayle/storefront-core": "8.27.0",
85
85
  "@scayle/unstorage-compression-driver": "^0.2.7",
86
86
  "@vercel/nft": "0.29.3",
87
87
  "@vueuse/core": "13.2.0",