@scayle/storefront-product-listing 0.2.0 → 0.4.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.
@@ -1,13 +1,16 @@
1
1
  import { type ProductSortConfig } from '@scayle/storefront-nuxt';
2
2
  import { type ComputedRef } from 'vue';
3
- import type { RouteLocationNormalizedLoadedGeneric } from 'vue-router';
3
+ import type { RouteLocationNormalizedLoadedGeneric, RouteLocationRaw } from 'vue-router';
4
4
  type SelectedSort = ProductSortConfig & {
5
5
  key: string;
6
6
  label: string;
7
7
  };
8
+ type SortLink = SelectedSort & {
9
+ to: RouteLocationRaw;
10
+ };
8
11
  export interface UseProductListSortReturn {
9
12
  selectedSort: ComputedRef<SelectedSort | undefined>;
10
- sortLinks: ComputedRef<SelectedSort[]>;
13
+ sortLinks: ComputedRef<SortLink[]>;
11
14
  isDefaultSortSelected: ComputedRef<boolean>;
12
15
  }
13
16
  export interface ProductListSortOptions {
@@ -21,9 +24,11 @@ export interface ProductListSortOptions {
21
24
  * @param {ProductListSortOptions} [options] - Options for configuring the sorting behavior.
22
25
  * @param {SelectedSort[]} [options.sortingOptions] - Array of available sorting options.
23
26
  * @param {string} [options.defaultSortingKey] - Default sorting key to be applied if no specific sort is selected.
27
+ *
24
28
  * @returns - computed properties and methods related to sorting:
29
+ *
25
30
  * - {ComputedRef<SelectedSort | undefined>} selectedSort - The currently selected sorting option.
26
- * - {ComputedRef<SelectedSort[]>} sortLinks - Links with updated query parameters for each sorting option.
31
+ * - {ComputedRef<SortLink[]>} sortLinks - Links with updated query parameters for each sorting option.
27
32
  * - {ComputedRef<boolean>} isDefaultSortSelected - Boolean indicating if the default sort is selected.
28
33
  */
29
34
  export declare function useProductListSort(route: RouteLocationNormalizedLoadedGeneric, { sortingOptions, defaultSortingKey }?: ProductListSortOptions): UseProductListSortReturn;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scayle/storefront-product-listing",
3
- "version": "0.2.0",
3
+ "version": "0.4.0",
4
4
  "description": "Collection of essential composables and utilities to work with product listing",
5
5
  "author": "SCAYLE Commerce Engine",
6
6
  "license": "MIT",