@scayle/storefront-product-listing 1.1.2 → 1.2.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 ADDED
@@ -0,0 +1,159 @@
1
+ # @scayle/storefront-product-listing
2
+
3
+ ## 1.2.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Update `APISortOrder` and `APISortOption` names due to update to newest `@scayle/storefront-nuxt` version.
8
+
9
+ ## 1.1.3
10
+
11
+ ### Patch Changes
12
+
13
+ - Ensure the module meta has the correct package version
14
+
15
+ ## 1.1.2
16
+
17
+ ### Patch Changes
18
+
19
+ - Update `useFiltersForListing` to automatically refresh filter data whenever the its parameter change. This will ensure `filteredProductCount` is up to date.
20
+
21
+ ## 1.1.1
22
+
23
+ ### Patch Changes
24
+
25
+ - We've updated to `nuxt@3.14`
26
+
27
+ ## 1.1.0
28
+
29
+ ### Minor Changes
30
+
31
+ - Updates the parameter type of `useFiltersForListing` from `MaybeRefOrGetter` to `Ref` to enforce that the parameter is a mandatory reactive reference.
32
+ Non-reactive parameter will not work as expected in the Boilerplate.
33
+ - Updates the parameter type of `useProductsForListing` from `MaybeRefOrGetter` to `Ref` to enforce that the parameter is a mandatory reactive reference.
34
+ Non-reactive parameter will not work as expected in the Boilerplate.
35
+
36
+ ## 1.0.0
37
+
38
+ ### Major Changes
39
+
40
+ - This release introduces the `@scayle/storefront-product-listing` package, decoupling composables and utilities of the Product Listing Page (PLP) functionality from the SCAYLE Storefront Boilerplate for enhanced modularity and integration.
41
+ This separation empowers developers with greater control over PLP updates and simplifies its integration into existing Storefront-based projects.
42
+
43
+ - [Discover more about the Product Listing Page for SCAYLE Storefront in our SCAYLE Resource Center.](https://scayle.dev/en/storefront-guide/developer-guide/features/pages/product-listing-page)
44
+
45
+ - This release requires `@scayle/storefront-nuxt@8.x` or higher. Support for `@scayle/storefront-nuxt@7.x` has been discontinued. Please update your dependencies accordingly. The `peerDependency` range has been updated to `^8.0.0`.
46
+
47
+ ### Minor Changes
48
+
49
+ - Compared to the original implementation within the SCAYLE Storefront Boilerplate, the `@scayle/storefront-product-detail` package has received some improvements and refactoring:
50
+
51
+ - The `useAppliedFilters` composable has been added to the `storefront-product-listing` package.
52
+ It now accepts a `filtersPrefix` parameter, allowing you to specify a custom prefix for filter-related query parameters.
53
+ - The `useProductListSort` composable has been added to the `storefront-product-listing` package.
54
+ It now accepts a `sortingOptions` and `defaultSortingKey` parameter, to config the sorting options and set the initial sorting value.
55
+ - The `useProductListFilter` composable has been added to the `storefront-product-listing` package.
56
+ It accepts `currentCategoryId`, which represents the active category, and `ProductListFilterOptions` for specifying options for the underlying `useFilters` composable.
57
+ - The `filters` utility has been added to the `storefront-product-listing` package.
58
+ It provides utilities for filter query manipulation.
59
+ - All exports are now defined in a single file, and everything is exposed via the `#storefront-product-listing` import.
60
+ - The `useProductsByCategory` composable has been added to the `storefront-product-listing` package.
61
+ It now accepts a `categoryId` and `ProductsByCategoryOptions` object that has
62
+ certain fetching products by category params(`category` & `categoryId`), `fetchingOptions`, `productsPerPage`,
63
+ `fetchProductsCacheTtl`, `cacheKeyPrefix`, `fetchingKey`, `withParams` (for product)
64
+ and `query` (current route query state).
65
+ - The `useProductListingSeoData` composable has been added to the `storefront-product-listing` package.
66
+ It accepts reactive `category`, `breadcrumbs`, an object of type `UrlParams` (containing a `baseUrl` and `fullPath`) which are used for building SEO data.
67
+ - Product Listing-related test factories are now exposed externally.
68
+ They can be used as follows:
69
+
70
+ ```ts
71
+ import { filtersFactory } from '@scayle/storefront-product-listing'
72
+ ```
73
+
74
+ - Upgrade the `storefront-core` and `storefront-nuxt` packages to version 8 and update your implementation to reflect the changes in RPC composables:
75
+ - The composables `useProductListFilter` and `useProductsByCategory` now return a `status` property instead of `fetching`. The `status` can have one of the following values: `idle`, `pending`, `error`, or `success`.
76
+ - The `fetch` method has been replaced by `refresh`. Update your logic accordingly to use the new method.
77
+
78
+ ## 0.6.0
79
+
80
+ ### Minor Changes
81
+
82
+ - Renamed the composables `useProductListFilter` to `useFiltersForListing`.
83
+ - Composable `useProductListFilter` now allows configuration of the parameters `includeSellableForFree`, `includeSoldOut`, `orFiltersOperator`.
84
+ - Removes the internal call to `useAppliedFilters` and `useProductListSort` which need to be explicitly passed to `useProductsForListing` and `useFiltersForListing`
85
+ - Renamed the composables `useProductsByCategory` to `useProductsForListing`.
86
+ - The configurable caching options `cacheKeyPrefix` and `fetchProductsCacheTtl` have been removed from the `useProductsByCategory` composable.
87
+ - Removed unnecessary parameter `category` and return value `activeCategoryName` from `useProductListingSeoData`.
88
+ - The `productsPerPage` parameter in the `useProductsByCategory` composable is now required and no longer provides a default value.
89
+ - Removed the `getClearedPriceQuery` utility function. Price filter resetting can now be achieved via the `getClearedFilterQueryByKey` function.
90
+
91
+ ## 0.5.0
92
+
93
+ ### Minor Changes
94
+
95
+ - Allow Storefront Nuxt v8 as a peer dependency
96
+
97
+ ## 0.4.2
98
+
99
+ ### Patch Changes
100
+
101
+ - The `useProductsByCategory` composable now sets the trackSearchAnalyticsEvent parameter by default if the current page evaluates to `1` and the `appliedFilter.term` is not empty.
102
+ The default behavior can be overriden by passing `trackSearchAnalyticsEvent: false` as part of `ProductsByCategoryOptions.params`.
103
+ For more details, check the [SCAYLE Search Analytics section](https://scayle.dev/en/developer-guide/products/search#scayle-search-analytics) in the SCAYLE Resource Center.
104
+
105
+ ## 0.4.1
106
+
107
+ ### Patch Changes
108
+
109
+ - Resolved an issue where the default parameter values for `useProductsByCategory` like `productsPerPage` or `cacheKeyPrefix` were not being set correctly.
110
+
111
+ ## 0.4.0
112
+
113
+ ### Minor Changes
114
+
115
+ - Fix computed `sortLinks` return type mismatch in `UseProductListSortReturn` interface.
116
+
117
+ ## 0.3.0
118
+
119
+ ### Minor Changes
120
+
121
+ - Fix `sortLinks` type by extending the `SelectedSort` type with `to` property which represents the `RouteLocationRaw` type from `vue-router`.
122
+
123
+ ## 0.2.0
124
+
125
+ ### Minor Changes
126
+
127
+ - Add and expose externally explicit return types/interfaces for all product listing composables.
128
+
129
+ ## 0.1.4
130
+
131
+ ### Patch Changes
132
+
133
+ - Resolved reactivity issues in composables by ensuring they receive the full `route` object instead of just the `query` object.
134
+ This allows for more reliable updates when the route changes.
135
+
136
+ ## 0.1.3
137
+
138
+ ### Patch Changes
139
+
140
+ - Resolve an issue where `sortLinks` in `useProductListSort` caused broken URLs on the PLP.
141
+ The `sortLinks` now include a `path` attribute reflecting the current route path.
142
+
143
+ ## 0.1.2
144
+
145
+ ### Patch Changes
146
+
147
+ - Update import of test factories to use new entry point
148
+
149
+ ## 0.1.1
150
+
151
+ ### Patch Changes
152
+
153
+ - Resolved issue where sorting did not correctly route to the first page.
154
+
155
+ ## 0.1.0
156
+
157
+ ### Minor Changes
158
+
159
+ - Introduce `@scayle/storefront-product-listing` package
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2024 SCAYLE GmbH
3
+ Copyright (c) 2025 SCAYLE GmbH
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/dist/module.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@scayle/storefront-product-listing",
3
3
  "configKey": "product-listing",
4
- "version": "1.0.0",
4
+ "version": "1.2.0",
5
5
  "compatibility": {
6
6
  "bridge": false,
7
7
  "nuxt": ">=3.13"
8
8
  },
9
9
  "builder": {
10
10
  "@nuxt/module-builder": "0.8.4",
11
- "unbuild": "3.0.1"
11
+ "unbuild": "3.3.1"
12
12
  }
13
13
  }
package/dist/module.mjs CHANGED
@@ -1,10 +1,12 @@
1
1
  import { defineNuxtModule, createResolver, addImportsDir } from '@nuxt/kit';
2
2
 
3
+ const PACKAGE_NAME = "@scayle/storefront-product-listing";
4
+ const PACKAGE_VERSION = "1.2.0";
3
5
  const module = defineNuxtModule({
4
6
  meta: {
5
- name: "@scayle/storefront-product-listing",
7
+ name: PACKAGE_NAME,
6
8
  configKey: "product-listing",
7
- version: "1.0.0",
9
+ version: PACKAGE_VERSION,
8
10
  compatibility: {
9
11
  bridge: false,
10
12
  nuxt: ">=3.13"
@@ -1,4 +1,4 @@
1
- import { type ComputedRef } from 'vue';
1
+ import type { ComputedRef } from 'vue';
2
2
  import type { ProductSearchQuery } from '@scayle/storefront-nuxt';
3
3
  import type { RouteLocationNormalizedLoadedGeneric } from 'vue-router';
4
4
  export type AppliedAttributeValues = Record<string, (string | number)[]>;
@@ -1,6 +1,6 @@
1
- import { type FetchFiltersParams } from '@scayle/storefront-nuxt';
1
+ import type { FetchFiltersParams } from '@scayle/storefront-nuxt';
2
2
  import { useFilters } from '@scayle/storefront-nuxt/composables';
3
- import { type ComputedRef, type Ref } from 'vue';
3
+ import type { ComputedRef, Ref } from 'vue';
4
4
  import type { FilterItemWithValues } from '@scayle/storefront-api';
5
5
  export type FiltersForListingOptions = Partial<{
6
6
  params: Ref<Omit<FetchFiltersParams, 'category'>>;
@@ -1,5 +1,5 @@
1
- import { type ProductSortConfig } from '@scayle/storefront-nuxt';
2
- import { type ComputedRef } from 'vue';
1
+ import type { ProductSortConfig } from '@scayle/storefront-nuxt';
2
+ import type { ComputedRef } from 'vue';
3
3
  import type { RouteLocationNormalizedLoadedGeneric, RouteLocationRaw } from 'vue-router';
4
4
  type SelectedSort = ProductSortConfig & {
5
5
  key: string;
@@ -1,38 +1,35 @@
1
- import {
2
- APISortOption,
3
- APISortOrder
4
- } from "@scayle/storefront-nuxt";
1
+ import { APISortOption, APISortOrder } from "@scayle/storefront-nuxt";
5
2
  import { computed } from "vue";
6
3
  export function useProductListSort(route, { sortingOptions, defaultSortingKey } = {
7
4
  sortingOptions: [
8
5
  {
9
6
  key: "top_seller",
10
7
  sortingKey: "scayle:v1:recommended",
11
- direction: APISortOrder.Descending,
8
+ direction: APISortOrder.DESCENDING,
12
9
  label: "sorting_select.top_seller"
13
10
  },
14
11
  {
15
12
  key: "date_newest",
16
- by: APISortOption.DateAdded,
17
- direction: APISortOrder.Descending,
13
+ by: APISortOption.DATE_ADDED,
14
+ direction: APISortOrder.DESCENDING,
18
15
  label: "sorting_select.date_newest"
19
16
  },
20
17
  {
21
18
  key: "price_desc",
22
- by: APISortOption.Price,
23
- direction: APISortOrder.Descending,
19
+ by: APISortOption.PRICE,
20
+ direction: APISortOrder.DESCENDING,
24
21
  label: "sorting_select.price_desc"
25
22
  },
26
23
  {
27
24
  key: "price_asc",
28
- by: APISortOption.Price,
29
- direction: APISortOrder.Ascending,
25
+ by: APISortOption.PRICE,
26
+ direction: APISortOrder.ASCENDING,
30
27
  label: "sorting_select.price_asc"
31
28
  },
32
29
  {
33
30
  key: "reduction_desc",
34
- by: APISortOption.Reduction,
35
- direction: APISortOrder.Descending,
31
+ by: APISortOption.REDUCTION,
32
+ direction: APISortOrder.DESCENDING,
36
33
  label: "sorting_select.reduction_desc"
37
34
  }
38
35
  ],
@@ -1,4 +1,4 @@
1
- import { type ComputedRef, type MaybeRefOrGetter } from 'vue';
1
+ import type { ComputedRef, MaybeRefOrGetter } from 'vue';
2
2
  import type { BreadcrumbItem } from '@scayle/storefront-nuxt';
3
3
  import type { BreadcrumbList, WithContext } from 'schema-dts';
4
4
  import type { RouteLocationNormalizedLoadedGeneric } from 'vue-router';
@@ -1,5 +1,5 @@
1
- import { type FetchProductsByCategoryParams, type Product } from '@scayle/storefront-nuxt';
2
- import { type Ref, type ComputedRef } from 'vue';
1
+ import type { FetchProductsByCategoryParams, Product } from '@scayle/storefront-nuxt';
2
+ import type { Ref, ComputedRef } from 'vue';
3
3
  import { useProducts } from '@scayle/storefront-nuxt/composables';
4
4
  import type { Pagination } from '@scayle/storefront-api';
5
5
  export type UseProductsForListingReturn = Pick<Awaited<ReturnType<typeof useProducts>>, 'error' | 'status'> & {
@@ -1,6 +1,4 @@
1
- import {
2
- extendPromise
3
- } from "@scayle/storefront-nuxt";
1
+ import { extendPromise } from "@scayle/storefront-nuxt";
4
2
  import { computed, ref } from "vue";
5
3
  import { useProducts } from "@scayle/storefront-nuxt/composables";
6
4
  export function useProductsForListing({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scayle/storefront-product-listing",
3
- "version": "1.1.2",
3
+ "version": "1.2.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",
@@ -23,6 +23,7 @@
23
23
  "main": "./dist/index.mjs",
24
24
  "types": "./dist/index.d.ts",
25
25
  "files": [
26
+ "CHANGELOG.md",
26
27
  "dist"
27
28
  ],
28
29
  "imports": {
@@ -39,7 +40,7 @@
39
40
  "format:fix": "dprint fmt",
40
41
  "test": "vitest --run --passWithNoTests",
41
42
  "test:watch": "vitest --passWithNoTests",
42
- "test:ci": "vitest --run --passWithNoTests --coverage --reporter=default --reporter=junit --outputFile=./junit.xml",
43
+ "test:ci": "vitest --run --passWithNoTests --coverage --reporter=default --reporter=junit --outputFile=./coverage/junit.xml",
43
44
  "typecheck": "vue-tsc --noEmit && cd playground && vue-tsc --noEmit",
44
45
  "package:lint": "publint"
45
46
  },
@@ -47,31 +48,31 @@
47
48
  "@nuxt/kit": "^3.13.0",
48
49
  "@scayle/storefront-nuxt": "^8.0.0",
49
50
  "@vue/test-utils": "2.4.6",
50
- "@vueuse/core": "12.0.0",
51
- "fishery": "2.2.2",
51
+ "@vueuse/core": "12.5.0",
52
+ "fishery": "2.2.3",
52
53
  "vue-router": "4.5.0"
53
54
  },
54
55
  "devDependencies": {
55
56
  "@nuxt/kit": "3.14.1592",
56
57
  "@nuxt/module-builder": "0.8.4",
57
58
  "@nuxt/schema": "3.14.1592",
58
- "@nuxt/test-utils": "3.15.1",
59
- "@scayle/eslint-config-storefront": "4.4.0",
60
- "@scayle/storefront-nuxt": "8.1.5",
61
- "@types/node": "22.10.2",
59
+ "@nuxt/test-utils": "3.15.4",
60
+ "@scayle/eslint-config-storefront": "4.4.1",
61
+ "@scayle/storefront-nuxt": "8.9.0",
62
+ "@types/node": "22.13.2",
62
63
  "@vue/test-utils": "2.4.6",
63
- "@vueuse/core": "12.0.0",
64
- "dprint": "0.47.6",
65
- "eslint": "9.17.0",
66
- "happy-dom": "15.11.7",
64
+ "@vueuse/core": "12.5.0",
65
+ "dprint": "0.49.0",
66
+ "eslint": "9.20.1",
67
+ "happy-dom": "17.1.0",
67
68
  "eslint-formatter-gitlab": "5.1.0",
68
69
  "nuxt": "3.14.1592",
69
70
  "publint": "0.2.12",
70
- "typescript": "5.6.3",
71
- "vitest": "2.1.8",
71
+ "typescript": "5.7.3",
72
+ "vitest": "2.1.9",
72
73
  "schema-dts": "1.1.2",
73
74
  "vue-router": "4.5.0",
74
- "fishery": "2.2.2",
75
- "vue-tsc": "2.1.10"
75
+ "fishery": "2.2.3",
76
+ "vue-tsc": "2.2.0"
76
77
  }
77
78
  }