@scayle/storefront-nuxt 8.26.2 → 8.28.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,45 @@
1
1
  # @scayle/storefront-nuxt
2
2
 
3
+ ## 8.28.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Introduced the `useCategoryTree` composable for streamlined category tree retrieval.
8
+
9
+ ```ts
10
+ const { data, status, error } = useCategoryTree({
11
+ params: {
12
+ children: 10,
13
+ includeHidden: true,
14
+ properties: { withName: ['sale'] },
15
+ },
16
+ })
17
+ ```
18
+
19
+ ### Patch Changes
20
+
21
+ **Dependencies**
22
+
23
+ **@scayle/storefront-core v8.28.0**
24
+
25
+ - Minor
26
+ - Introduced the `getCategoryTree` RPC for retrieving the complete category tree.
27
+
28
+ ## 8.27.0
29
+
30
+ ### Minor Changes
31
+
32
+ - Updated `useBasket` to include a `getApplicablePromotionsByCode` function. This function fetches the applicable promotions for the current basket.
33
+
34
+ ### Patch Changes
35
+
36
+ **Dependencies**
37
+
38
+ **@scayle/storefront-core v8.27.0**
39
+
40
+ - Minor
41
+ - Added a new `getApplicablePromotionsByCode` RPC method which can be used to fetch applicable promotions for a basket.
42
+
3
43
  ## 8.26.2
4
44
 
5
45
  ### Patch Changes
package/dist/module.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scayle/storefront-nuxt",
3
- "version": "8.26.2",
3
+ "version": "8.28.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.2";
57
+ const PACKAGE_VERSION = "8.28.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,
@@ -0,0 +1,9 @@
1
+ import type { MaybeRefOrGetter } from 'vue';
2
+ import { type KeysOf, type NormalizedRpcResponse, type UseRpcOptions, type UseRpcReturn } from '../core/useRpc.js';
3
+ import type { RpcMethodParameters } from '@scayle/storefront-core';
4
+ type UseCategoriesBaseReturn<DataT, PickKeys extends KeysOf<DataT>, DefaultT> = Awaited<UseRpcReturn<'getCategoryTree', DataT, PickKeys, DefaultT>> & Promise<Awaited<UseRpcReturn<'getCategoryTree', DataT, PickKeys, DefaultT>>>;
5
+ export declare function useCategoryTree<DataT = NormalizedRpcResponse<'getCategoryTree'>, PickKeys extends KeysOf<DataT> = KeysOf<DataT>, DefaultT = null>({ params, options, }?: Partial<{
6
+ params: MaybeRefOrGetter<RpcMethodParameters<'getCategoryTree'>>;
7
+ options: UseRpcOptions<'getCategoryTree', DataT, PickKeys, DefaultT>;
8
+ }>, key?: string): UseCategoriesBaseReturn<DataT, PickKeys, DefaultT>;
9
+ export {};
@@ -0,0 +1,9 @@
1
+ import {
2
+ useRpc
3
+ } from "../core/useRpc.js";
4
+ export function useCategoryTree({
5
+ params,
6
+ options
7
+ } = {}, key = "useCategoryTree") {
8
+ return useRpc("getCategoryTree", key, params, options);
9
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@scayle/storefront-nuxt",
3
3
  "type": "module",
4
- "version": "8.26.2",
4
+ "version": "8.28.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.2",
84
+ "@scayle/storefront-core": "8.28.0",
85
85
  "@scayle/unstorage-compression-driver": "^0.2.7",
86
86
  "@vercel/nft": "0.29.3",
87
87
  "@vueuse/core": "13.2.0",
@@ -110,7 +110,7 @@
110
110
  "@scayle/eslint-config-storefront": "4.5.2",
111
111
  "@scayle/eslint-plugin-vue-composable": "0.2.1",
112
112
  "@scayle/unstorage-scayle-kv-driver": "0.1.2",
113
- "@types/node": "22.15.19",
113
+ "@types/node": "22.15.21",
114
114
  "dprint": "0.50.0",
115
115
  "eslint-formatter-gitlab": "6.0.0",
116
116
  "eslint": "9.27.0",