@scayle/storefront-product-listing 1.4.0 → 1.5.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 +6 -0
- package/dist/index.d.mts +2 -2
- package/dist/module.json +2 -2
- package/dist/module.mjs +1 -1
- package/dist/runtime/index.d.ts +1 -0
- package/dist/runtime/index.js +1 -0
- package/dist/runtime/utils/category.d.ts +19 -0
- package/dist/runtime/utils/category.js +23 -0
- package/package.json +19 -19
package/CHANGELOG.md
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -4,9 +4,9 @@ import { FilterItemWithValues } from '@scayle/storefront-api';
|
|
|
4
4
|
|
|
5
5
|
type RangeTuple = [start: number, end: number];
|
|
6
6
|
|
|
7
|
-
declare const breadcrumbsFactory: Factory<BreadcrumbItem[], any, BreadcrumbItem[]>;
|
|
7
|
+
declare const breadcrumbsFactory: Factory<BreadcrumbItem[], any, BreadcrumbItem[], BreadcrumbItem[]>;
|
|
8
8
|
|
|
9
|
-
declare const filtersFactory: Factory<FilterItemWithValues[], any, FilterItemWithValues[]>;
|
|
9
|
+
declare const filtersFactory: Factory<FilterItemWithValues[], any, FilterItemWithValues[], FilterItemWithValues[]>;
|
|
10
10
|
|
|
11
11
|
export { breadcrumbsFactory, filtersFactory };
|
|
12
12
|
export type { RangeTuple };
|
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.
|
|
4
|
+
"version": "1.5.0",
|
|
5
5
|
"compatibility": {
|
|
6
6
|
"bridge": false,
|
|
7
7
|
"nuxt": ">=3.13"
|
|
8
8
|
},
|
|
9
9
|
"builder": {
|
|
10
10
|
"@nuxt/module-builder": "1.0.1",
|
|
11
|
-
"unbuild": "
|
|
11
|
+
"unbuild": "3.5.0"
|
|
12
12
|
}
|
|
13
13
|
}
|
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.5.0";
|
|
5
5
|
const module = defineNuxtModule({
|
|
6
6
|
meta: {
|
|
7
7
|
name: PACKAGE_NAME,
|
package/dist/runtime/index.d.ts
CHANGED
package/dist/runtime/index.js
CHANGED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Category } from '@scayle/storefront-nuxt';
|
|
2
|
+
/**
|
|
3
|
+
* Get all ancestors of a category.
|
|
4
|
+
* @param category - The category to get the ancestors of.
|
|
5
|
+
* @returns An array of all ancestors of the category.
|
|
6
|
+
*/
|
|
7
|
+
export declare const getCategoryAncestors: (category: Category) => Category[];
|
|
8
|
+
/**
|
|
9
|
+
* Check if a category is a sale category.
|
|
10
|
+
* @param category - The category to check.
|
|
11
|
+
* @returns True if the category is the sale category, false otherwise.
|
|
12
|
+
*/
|
|
13
|
+
export declare const isSaleCategory: (category: Category) => boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Flatten a category tree.
|
|
16
|
+
* @param categoryTree - The category tree to flatten.
|
|
17
|
+
* @returns A flattened array of all categories in the tree.
|
|
18
|
+
*/
|
|
19
|
+
export declare const flattenCategoryTree: (categoryTree: Category[]) => Category[];
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export const getCategoryAncestors = (category) => {
|
|
2
|
+
if (!category?.parent) {
|
|
3
|
+
return [];
|
|
4
|
+
}
|
|
5
|
+
return [...getCategoryAncestors(category.parent), category.parent];
|
|
6
|
+
};
|
|
7
|
+
export const isSaleCategory = (category) => {
|
|
8
|
+
return category.properties.some(({ name }) => name === "sale");
|
|
9
|
+
};
|
|
10
|
+
export const flattenCategoryTree = (categoryTree) => {
|
|
11
|
+
const flattenedCategoryTreeList = categoryTree.reduce(
|
|
12
|
+
(categories, categoryNode) => {
|
|
13
|
+
const children = categoryNode?.children ?? [];
|
|
14
|
+
return categories.concat(categoryNode, ...flattenCategoryTree(children));
|
|
15
|
+
},
|
|
16
|
+
[]
|
|
17
|
+
);
|
|
18
|
+
return [
|
|
19
|
+
...new Map(
|
|
20
|
+
flattenedCategoryTreeList.map((item) => [item?.id ?? item, item])
|
|
21
|
+
).values()
|
|
22
|
+
];
|
|
23
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scayle/storefront-product-listing",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.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",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"build": "nuxt-module-build build",
|
|
36
36
|
"dev": "nuxi dev playground",
|
|
37
37
|
"dev:build": "nuxi build playground",
|
|
38
|
-
"prep": "nuxt-module-build
|
|
38
|
+
"prep": "nuxt-module-build prepare && nuxi prepare playground",
|
|
39
39
|
"lint": "eslint .",
|
|
40
40
|
"lint:ci": "eslint . --format gitlab",
|
|
41
41
|
"lint:fix": "eslint . --fix",
|
|
@@ -59,30 +59,30 @@
|
|
|
59
59
|
"vue": "^3.5.13"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
|
-
"@arethetypeswrong/cli": "0.
|
|
63
|
-
"@nuxt/kit": "3.
|
|
62
|
+
"@arethetypeswrong/cli": "0.18.1",
|
|
63
|
+
"@nuxt/kit": "3.16.2",
|
|
64
64
|
"@nuxt/module-builder": "1.0.1",
|
|
65
|
-
"@nuxt/schema": "3.
|
|
66
|
-
"@nuxt/test-utils": "3.
|
|
67
|
-
"@scayle/eslint-config-storefront": "4.5.
|
|
68
|
-
"@scayle/storefront-api": "18.3.
|
|
69
|
-
"@scayle/storefront-nuxt": "8.
|
|
70
|
-
"@types/node": "22.
|
|
65
|
+
"@nuxt/schema": "3.16.2",
|
|
66
|
+
"@nuxt/test-utils": "3.18.0",
|
|
67
|
+
"@scayle/eslint-config-storefront": "4.5.2",
|
|
68
|
+
"@scayle/storefront-api": "18.3.1",
|
|
69
|
+
"@scayle/storefront-nuxt": "8.25.4",
|
|
70
|
+
"@types/node": "22.15.17",
|
|
71
71
|
"@vue/test-utils": "2.4.6",
|
|
72
72
|
"@vueuse/core": "13.1.0",
|
|
73
73
|
"dprint": "0.49.1",
|
|
74
|
-
"eslint-formatter-gitlab": "
|
|
75
|
-
"eslint": "9.
|
|
76
|
-
"fishery": "2.
|
|
77
|
-
"happy-dom": "17.4.
|
|
78
|
-
"nuxt": "3.
|
|
74
|
+
"eslint-formatter-gitlab": "6.0.0",
|
|
75
|
+
"eslint": "9.26.0",
|
|
76
|
+
"fishery": "2.3.1",
|
|
77
|
+
"happy-dom": "17.4.7",
|
|
78
|
+
"nuxt": "3.16.2",
|
|
79
79
|
"publint": "0.2.12",
|
|
80
80
|
"schema-dts": "1.1.5",
|
|
81
81
|
"typescript": "5.8.3",
|
|
82
|
-
"unbuild": "
|
|
83
|
-
"vitest": "3.1.
|
|
84
|
-
"vue-router": "4.5.
|
|
85
|
-
"vue-tsc": "2.2.
|
|
82
|
+
"unbuild": "3.5.0",
|
|
83
|
+
"vitest": "3.1.3",
|
|
84
|
+
"vue-router": "4.5.1",
|
|
85
|
+
"vue-tsc": "2.2.10",
|
|
86
86
|
"vue": "3.5.13"
|
|
87
87
|
}
|
|
88
88
|
}
|