@scayle/storefront-product-listing 1.7.0 → 1.8.1
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 +12 -0
- package/dist/module.json +1 -1
- package/dist/module.mjs +1 -1
- package/dist/runtime/composables/useAllShopCategoriesForId.d.ts +1 -1
- package/dist/runtime/composables/useAppliedFilters.js +3 -0
- package/dist/runtime/utils/filters.d.ts +10 -0
- package/dist/runtime/utils/filters.js +25 -0
- package/package.json +27 -27
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @scayle/storefront-product-listing
|
|
2
2
|
|
|
3
|
+
## 1.8.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Corrected import from `@scayle/storefront-core` to `@scayle/storefront-nuxt`.
|
|
8
|
+
|
|
9
|
+
## 1.8.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- Enhanced `useAppliedFilters` to support the `minReduction` and `maxReduction` filter names, enabling proper handling of the `max_savings_percentage` filter.
|
|
14
|
+
|
|
3
15
|
## 1.7.0
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { defineNuxtModule, createResolver, addImportsDir } from '@nuxt/kit';
|
|
2
2
|
|
|
3
3
|
const PACKAGE_NAME = "@scayle/storefront-product-listing";
|
|
4
|
-
const PACKAGE_VERSION = "1.
|
|
4
|
+
const PACKAGE_VERSION = "1.8.1";
|
|
5
5
|
const module = defineNuxtModule({
|
|
6
6
|
meta: {
|
|
7
7
|
name: PACKAGE_NAME,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { KeysOf, NormalizedRpcResponse, UseRpcOptions, UseRpcReturn } from '@scayle/storefront-nuxt/composables';
|
|
2
2
|
import type { MaybeRefOrGetter } from 'vue';
|
|
3
|
-
import type { RpcMethodParameters } from '@scayle/storefront-
|
|
3
|
+
import type { RpcMethodParameters } from '@scayle/storefront-nuxt';
|
|
4
4
|
export declare function useAllShopCategoriesForId<DataT = NormalizedRpcResponse<'getAllShopCategoriesForId'>, PickKeys extends KeysOf<DataT> = KeysOf<DataT>, DefaultT = null>({ params, options, }?: Partial<{
|
|
5
5
|
params: MaybeRefOrGetter<RpcMethodParameters<'getAllShopCategoriesForId'>>;
|
|
6
6
|
options: UseRpcOptions<'getAllShopCategoriesForId', DataT, PickKeys, DefaultT>;
|
|
@@ -10,6 +10,9 @@ export function useAppliedFilters(route, { filtersPrefix } = { filtersPrefix: "f
|
|
|
10
10
|
if (appliedFilter.value.minPrice !== void 0 || appliedFilter.value.maxPrice !== void 0) {
|
|
11
11
|
count += 1;
|
|
12
12
|
}
|
|
13
|
+
if (appliedFilter.value.minReduction !== void 0 || appliedFilter.value.maxReduction !== void 0) {
|
|
14
|
+
count += 1;
|
|
15
|
+
}
|
|
13
16
|
return count;
|
|
14
17
|
});
|
|
15
18
|
const appliedAttributeValues = computed(
|
|
@@ -35,6 +35,16 @@ export declare const createNewAttributeQuery: (route: RouteLocationNormalizedLoa
|
|
|
35
35
|
* @returns {LocationQuery} A new query object with the updated price filter.
|
|
36
36
|
*/
|
|
37
37
|
export declare const createNewPriceQuery: (route: RouteLocationNormalizedLoadedGeneric, appliedFilter: ProductSearchQuery, prices: RangeTuple) => LocationQuery;
|
|
38
|
+
/**
|
|
39
|
+
* Creates a new reduction filter query object.
|
|
40
|
+
*
|
|
41
|
+
* @param route - The Vue Router route object.
|
|
42
|
+
* @param appliedFilter - The currently applied filter.
|
|
43
|
+
* @param reductions - The new reduction range.
|
|
44
|
+
*
|
|
45
|
+
* @returns A new query object with the updated reduction filter.
|
|
46
|
+
*/
|
|
47
|
+
export declare const createNewReductionQuery: (route: RouteLocationNormalizedLoadedGeneric, appliedFilter: ProductSearchQuery, reductions: RangeTuple) => LocationQuery;
|
|
38
48
|
/**
|
|
39
49
|
* Creates a new boolean attribute filter query object.
|
|
40
50
|
*
|
|
@@ -16,6 +16,8 @@ export const parseFilterDataFromRoute = (route, filtersPrefix) => {
|
|
|
16
16
|
switch (filterName) {
|
|
17
17
|
case "minPrice":
|
|
18
18
|
case "maxPrice":
|
|
19
|
+
case "minReduction":
|
|
20
|
+
case "maxReduction":
|
|
19
21
|
if (isNaN(Number(value))) {
|
|
20
22
|
return;
|
|
21
23
|
}
|
|
@@ -85,6 +87,16 @@ export const createNewPriceQuery = (route, appliedFilter, prices) => {
|
|
|
85
87
|
}
|
|
86
88
|
return { ...query, ...priceFilterQuery };
|
|
87
89
|
};
|
|
90
|
+
export const createNewReductionQuery = (route, appliedFilter, reductions) => {
|
|
91
|
+
const priceFilterQuery = {};
|
|
92
|
+
if (appliedFilter.minReduction !== reductions[0]) {
|
|
93
|
+
priceFilterQuery["filters[minReduction]"] = reductions[0].toString();
|
|
94
|
+
}
|
|
95
|
+
if (appliedFilter.maxReduction !== reductions[1]) {
|
|
96
|
+
priceFilterQuery["filters[maxReduction]"] = reductions[1].toString();
|
|
97
|
+
}
|
|
98
|
+
return { ...route.query, ...priceFilterQuery };
|
|
99
|
+
};
|
|
88
100
|
export const createNewBoolAttributeQuery = (route, appliedFilter, { slug, value }) => {
|
|
89
101
|
const booleanFilterQuery = {};
|
|
90
102
|
const query = { ...route.query };
|
|
@@ -114,10 +126,23 @@ const getClearedPriceQuery = (route) => {
|
|
|
114
126
|
}
|
|
115
127
|
return query;
|
|
116
128
|
};
|
|
129
|
+
const getClearedReductionQuery = (route) => {
|
|
130
|
+
const query = { ...route.query };
|
|
131
|
+
if (query["filters[maxReduction]"]) {
|
|
132
|
+
delete query["filters[maxReduction]"];
|
|
133
|
+
}
|
|
134
|
+
if (query["filters[minReduction]"]) {
|
|
135
|
+
delete query["filters[minReduction]"];
|
|
136
|
+
}
|
|
137
|
+
return query;
|
|
138
|
+
};
|
|
117
139
|
export const getClearedFilterQueryByKey = (route, key) => {
|
|
118
140
|
if (key === "prices") {
|
|
119
141
|
return getClearedPriceQuery(route);
|
|
120
142
|
}
|
|
143
|
+
if (key === "reductions") {
|
|
144
|
+
return getClearedReductionQuery(route);
|
|
145
|
+
}
|
|
121
146
|
const query = { ...route.query };
|
|
122
147
|
const filterKey = `filters[${key}]`;
|
|
123
148
|
if (query[filterKey]) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scayle/storefront-product-listing",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.8.1",
|
|
4
4
|
"description": "Collection of essential composables and utilities to work with product listing",
|
|
5
5
|
"author": "SCAYLE Commerce Engine",
|
|
6
6
|
"license": "MIT",
|
|
@@ -31,23 +31,6 @@
|
|
|
31
31
|
"imports": {
|
|
32
32
|
"#storefront-product-listing": "./dist/runtime/index.js"
|
|
33
33
|
},
|
|
34
|
-
"scripts": {
|
|
35
|
-
"build": "nuxt-module-build build",
|
|
36
|
-
"dev": "nuxt dev playground",
|
|
37
|
-
"dev:build": "nuxt build playground",
|
|
38
|
-
"prep": "nuxt-module-build prepare && nuxt prepare playground",
|
|
39
|
-
"lint": "eslint .",
|
|
40
|
-
"lint:ci": "eslint . --format gitlab",
|
|
41
|
-
"lint:fix": "eslint . --fix",
|
|
42
|
-
"format": "dprint check",
|
|
43
|
-
"format:fix": "dprint fmt",
|
|
44
|
-
"test": "vitest --run",
|
|
45
|
-
"test:watch": "vitest",
|
|
46
|
-
"test:ci": "vitest --run --coverage --reporter=default --reporter=junit --outputFile=./coverage/junit.xml",
|
|
47
|
-
"typecheck": "vue-tsc --noEmit && cd playground && vue-tsc --noEmit",
|
|
48
|
-
"package:lint": "publint",
|
|
49
|
-
"verify-packaging": "attw --pack . --profile esm-only"
|
|
50
|
-
},
|
|
51
34
|
"peerDependencies": {
|
|
52
35
|
"@nuxt/kit": ">=3.13.0",
|
|
53
36
|
"@scayle/storefront-core": "^8.0.0",
|
|
@@ -64,26 +47,43 @@
|
|
|
64
47
|
"@nuxt/module-builder": "1.0.1",
|
|
65
48
|
"@nuxt/schema": "3.16.2",
|
|
66
49
|
"@nuxt/test-utils": "3.18.0",
|
|
67
|
-
"@scayle/eslint-config-storefront": "4.5.
|
|
50
|
+
"@scayle/eslint-config-storefront": "4.5.11",
|
|
68
51
|
"@scayle/storefront-api": "18.9.0",
|
|
69
|
-
"@scayle/storefront-nuxt": "8.
|
|
70
|
-
"@types/node": "22.15.
|
|
71
|
-
"@vitest/coverage-v8": "3.2.
|
|
52
|
+
"@scayle/storefront-nuxt": "8.31.0",
|
|
53
|
+
"@types/node": "22.15.33",
|
|
54
|
+
"@vitest/coverage-v8": "3.2.4",
|
|
72
55
|
"@vue/test-utils": "2.4.6",
|
|
73
|
-
"@vueuse/core": "13.
|
|
56
|
+
"@vueuse/core": "13.4.0",
|
|
74
57
|
"dprint": "0.50.0",
|
|
75
58
|
"eslint-formatter-gitlab": "6.0.1",
|
|
76
59
|
"eslint": "9.29.0",
|
|
77
60
|
"fishery": "2.3.1",
|
|
78
61
|
"happy-dom": "18.0.1",
|
|
79
62
|
"nuxt": "3.16.2",
|
|
80
|
-
"publint": "0.
|
|
63
|
+
"publint": "0.3.12",
|
|
81
64
|
"schema-dts": "1.1.5",
|
|
82
65
|
"typescript": "5.8.3",
|
|
83
66
|
"unbuild": "3.5.0",
|
|
84
|
-
"vitest": "3.2.
|
|
67
|
+
"vitest": "3.2.4",
|
|
85
68
|
"vue-router": "4.5.1",
|
|
86
69
|
"vue-tsc": "2.2.10",
|
|
87
|
-
"vue": "3.5.
|
|
70
|
+
"vue": "3.5.17"
|
|
71
|
+
},
|
|
72
|
+
"scripts": {
|
|
73
|
+
"build": "nuxt-module-build build",
|
|
74
|
+
"dev": "nuxt dev playground",
|
|
75
|
+
"dev:build": "nuxt build playground",
|
|
76
|
+
"prep": "nuxt-module-build prepare && nuxt prepare playground",
|
|
77
|
+
"lint": "eslint .",
|
|
78
|
+
"lint:ci": "eslint . --format gitlab",
|
|
79
|
+
"lint:fix": "eslint . --fix",
|
|
80
|
+
"format": "dprint check",
|
|
81
|
+
"format:fix": "dprint fmt",
|
|
82
|
+
"test": "vitest --run",
|
|
83
|
+
"test:watch": "vitest",
|
|
84
|
+
"test:ci": "vitest --run --coverage --reporter=default --reporter=junit --outputFile=./coverage/junit.xml",
|
|
85
|
+
"typecheck": "vue-tsc --noEmit && cd playground && vue-tsc --noEmit",
|
|
86
|
+
"package:lint": "publint",
|
|
87
|
+
"verify-packaging": "attw --pack . --profile esm-only"
|
|
88
88
|
}
|
|
89
|
-
}
|
|
89
|
+
}
|