@ikas/storefront-providers 4.0.0-alpha.9 → 4.0.0-beta.10
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/build/ext/tslib/tslib.es6.js +1 -0
- package/{src/index.ts → build/index.d.ts} +20 -22
- package/build/index.js +1 -0
- package/build/models/prop-value/attribute-list.d.ts +6 -0
- package/build/models/prop-value/attribute.d.ts +6 -0
- package/build/models/prop-value/blog-category-list.d.ts +6 -0
- package/build/models/prop-value/blog-category.d.ts +4 -0
- package/build/models/prop-value/blog-list.d.ts +8 -0
- package/build/models/prop-value/blog.d.ts +4 -0
- package/build/models/prop-value/brand-list.d.ts +8 -0
- package/build/models/prop-value/brand.d.ts +4 -0
- package/build/models/prop-value/brand.js +1 -0
- package/build/models/prop-value/category-list.d.ts +8 -0
- package/build/models/prop-value/category.d.ts +4 -0
- package/build/models/prop-value/link.d.ts +18 -0
- package/build/models/prop-value/link.js +1 -0
- package/build/models/prop-value/product-list.d.ts +17 -0
- package/build/models/prop-value/product.d.ts +5 -0
- package/build/models/prop-value/raffle-list.d.ts +4 -0
- package/build/models/prop-value/raffle.d.ts +4 -0
- package/build/models/ui/blog-category-list/index.d.ts +17 -0
- package/build/models/ui/blog-category-list/index.js +1 -0
- package/build/models/ui/blog-category-list/init.d.ts +2 -0
- package/build/models/ui/blog-category-list/init.js +1 -0
- package/build/models/ui/blog-list/index.d.ts +19 -0
- package/build/models/ui/blog-list/index.js +1 -0
- package/build/models/ui/blog-list/init.d.ts +2 -0
- package/build/models/ui/blog-list/init.js +1 -0
- package/build/models/ui/brand-list/index.d.ts +22 -0
- package/build/models/ui/brand-list/index.js +1 -0
- package/build/models/ui/brand-list/init.d.ts +2 -0
- package/build/models/ui/brand-list/init.js +1 -0
- package/build/models/ui/category-list/index.d.ts +22 -0
- package/build/models/ui/category-list/index.js +1 -0
- package/build/models/ui/category-list/init.d.ts +2 -0
- package/build/models/ui/category-list/init.js +1 -0
- package/build/models/ui/component-renderer/index.d.ts +6 -0
- package/build/models/ui/customer-review-list/index.d.ts +11 -0
- package/build/models/ui/customer-review-list/init.d.ts +2 -0
- package/build/models/ui/customer-review-summary-list/index.d.ts +11 -0
- package/build/models/ui/customer-review-summary-list/init.d.ts +2 -0
- package/{src/models/ui/index.ts → build/models/ui/index.d.ts} +12 -12
- package/build/models/ui/navigation-link/index.d.ts +7 -0
- package/build/models/ui/product-attribute-detail/index.d.ts +6 -0
- package/build/models/ui/product-attribute-list/index.d.ts +6 -0
- package/build/models/ui/product-list/index.d.ts +64 -0
- package/build/models/ui/product-list/index.js +1 -0
- package/build/models/ui/product-list/init.d.ts +2 -0
- package/build/models/ui/product-list/init.js +1 -0
- package/build/models/ui/raffle-list/index.d.ts +16 -0
- package/build/models/ui/raffle-list/init.d.ts +2 -0
- package/build/models/ui/raffle-list/init.js +1 -0
- package/build/providers/helpers/raffle.d.ts +3 -0
- package/build/providers/helpers/raffle.js +1 -0
- package/build/providers/page-data-get.d.ts +31 -0
- package/build/providers/page-data-get.js +1 -0
- package/build/providers/placeholders.d.ts +7 -0
- package/build/providers/placeholders.js +1 -0
- package/build/providers/prop-value/attribute-list.d.ts +8 -0
- package/build/providers/prop-value/attribute-list.js +1 -0
- package/build/providers/prop-value/attribute.d.ts +8 -0
- package/build/providers/prop-value/attribute.js +1 -0
- package/build/providers/prop-value/blog-category-list.d.ts +8 -0
- package/build/providers/prop-value/blog-category-list.js +1 -0
- package/build/providers/prop-value/blog-category.d.ts +8 -0
- package/build/providers/prop-value/blog-category.js +1 -0
- package/build/providers/prop-value/blog-list.d.ts +11 -0
- package/build/providers/prop-value/blog-list.js +1 -0
- package/build/providers/prop-value/blog.d.ts +8 -0
- package/build/providers/prop-value/blog.js +1 -0
- package/build/providers/prop-value/boolean.d.ts +6 -0
- package/build/providers/prop-value/boolean.js +1 -0
- package/build/providers/prop-value/brand-list.d.ts +8 -0
- package/build/providers/prop-value/brand-list.js +1 -0
- package/build/providers/prop-value/brand.d.ts +8 -0
- package/build/providers/prop-value/brand.js +1 -0
- package/build/providers/prop-value/category-list.d.ts +8 -0
- package/build/providers/prop-value/category-list.js +1 -0
- package/build/providers/prop-value/category.d.ts +8 -0
- package/build/providers/prop-value/category.js +1 -0
- package/build/providers/prop-value/color.d.ts +6 -0
- package/build/providers/prop-value/color.js +1 -0
- package/build/providers/prop-value/custom.d.ts +42 -0
- package/build/providers/prop-value/custom.js +1 -0
- package/build/providers/prop-value/image-list.d.ts +7 -0
- package/build/providers/prop-value/image-list.js +1 -0
- package/build/providers/prop-value/image.d.ts +7 -0
- package/build/providers/prop-value/image.js +1 -0
- package/{src/providers/prop-value/index.ts → build/providers/prop-value/index.d.ts} +3 -3
- package/build/providers/prop-value/link.d.ts +26 -0
- package/build/providers/prop-value/link.js +1 -0
- package/build/providers/prop-value/product-detail.d.ts +8 -0
- package/build/providers/prop-value/product-detail.js +1 -0
- package/build/providers/prop-value/product-list.d.ts +17 -0
- package/build/providers/prop-value/product-list.js +1 -0
- package/build/providers/prop-value/raffle-list.d.ts +5 -0
- package/build/providers/prop-value/raffle-list.js +1 -0
- package/build/providers/prop-value/raffle.d.ts +8 -0
- package/build/providers/prop-value/raffle.js +1 -0
- package/build/providers/prop-value/rich-text.d.ts +6 -0
- package/build/providers/prop-value/rich-text.js +1 -0
- package/build/providers/prop-value/slider.d.ts +7 -0
- package/build/providers/prop-value/slider.js +1 -0
- package/build/providers/prop-value/text.d.ts +6 -0
- package/build/providers/prop-value/text.js +1 -0
- package/build/providers/types.d.ts +66 -0
- package/build/providers/types.js +1 -0
- package/package.json +16 -15
- package/src/models/prop-value/attribute-list.ts +0 -8
- package/src/models/prop-value/attribute.ts +0 -8
- package/src/models/prop-value/blog-category-list.ts +0 -9
- package/src/models/prop-value/blog-category.ts +0 -6
- package/src/models/prop-value/blog-list.ts +0 -13
- package/src/models/prop-value/blog.ts +0 -6
- package/src/models/prop-value/brand-list.ts +0 -11
- package/src/models/prop-value/brand.ts +0 -6
- package/src/models/prop-value/category-list.ts +0 -11
- package/src/models/prop-value/category.ts +0 -6
- package/src/models/prop-value/link.ts +0 -22
- package/src/models/prop-value/product-list.ts +0 -29
- package/src/models/prop-value/product.ts +0 -7
- package/src/models/prop-value/raffle-list.ts +0 -6
- package/src/models/prop-value/raffle.ts +0 -6
- package/src/models/ui/blog-category-list/index.ts +0 -19
- package/src/models/ui/blog-category-list/init.ts +0 -54
- package/src/models/ui/blog-list/index.ts +0 -21
- package/src/models/ui/blog-list/init.ts +0 -49
- package/src/models/ui/brand-list/index.ts +0 -25
- package/src/models/ui/brand-list/init.ts +0 -47
- package/src/models/ui/category-list/index.ts +0 -25
- package/src/models/ui/category-list/init.ts +0 -50
- package/src/models/ui/component-renderer/index.ts +0 -5
- package/src/models/ui/customer-review-list/index.ts +0 -12
- package/src/models/ui/customer-review-list/init.ts +0 -33
- package/src/models/ui/customer-review-summary-list/index.ts +0 -12
- package/src/models/ui/customer-review-summary-list/init.ts +0 -33
- package/src/models/ui/navigation-link/index.ts +0 -7
- package/src/models/ui/product-attribute-detail/index.ts +0 -7
- package/src/models/ui/product-attribute-list/index.ts +0 -7
- package/src/models/ui/product-list/index.ts +0 -80
- package/src/models/ui/product-list/init.ts +0 -407
- package/src/models/ui/raffle-list/index.ts +0 -17
- package/src/models/ui/raffle-list/init.ts +0 -44
- package/src/providers/helpers/raffle.ts +0 -69
- package/src/providers/page-data-get.ts +0 -708
- package/src/providers/placeholders.ts +0 -138
- package/src/providers/prop-value/attribute-list.ts +0 -75
- package/src/providers/prop-value/attribute.ts +0 -77
- package/src/providers/prop-value/blog-category-list.ts +0 -29
- package/src/providers/prop-value/blog-category.ts +0 -49
- package/src/providers/prop-value/blog-list.ts +0 -61
- package/src/providers/prop-value/blog.ts +0 -41
- package/src/providers/prop-value/boolean.ts +0 -14
- package/src/providers/prop-value/brand-list.ts +0 -30
- package/src/providers/prop-value/brand.ts +0 -46
- package/src/providers/prop-value/category-list.ts +0 -31
- package/src/providers/prop-value/category.ts +0 -45
- package/src/providers/prop-value/color.ts +0 -14
- package/src/providers/prop-value/custom.ts +0 -560
- package/src/providers/prop-value/image-list.ts +0 -16
- package/src/providers/prop-value/image.ts +0 -16
- package/src/providers/prop-value/link.ts +0 -259
- package/src/providers/prop-value/product-detail.ts +0 -92
- package/src/providers/prop-value/product-list.ts +0 -124
- package/src/providers/prop-value/raffle-list.ts +0 -20
- package/src/providers/prop-value/raffle.ts +0 -41
- package/src/providers/prop-value/rich-text.ts +0 -14
- package/src/providers/prop-value/slider.ts +0 -19
- package/src/providers/prop-value/text.ts +0 -14
- package/src/providers/types.ts +0 -88
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ikas/storefront-providers",
|
|
3
|
-
"version": "4.0.0-
|
|
3
|
+
"version": "4.0.0-beta.10",
|
|
4
4
|
"description": "Data providers for ikas storefront theme components.",
|
|
5
|
-
"author": "
|
|
5
|
+
"author": "ikas",
|
|
6
6
|
"license": "ISC",
|
|
7
|
-
"main": "./
|
|
8
|
-
"module": "./
|
|
7
|
+
"main": "./build/index.js",
|
|
8
|
+
"module": "./build/index.js",
|
|
9
9
|
"files": [
|
|
10
|
-
"./
|
|
10
|
+
"./build"
|
|
11
11
|
],
|
|
12
12
|
"type": "module",
|
|
13
13
|
"scripts": {
|
|
@@ -17,11 +17,12 @@
|
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
19
|
"@rollup/plugin-commonjs": "^22.0.0",
|
|
20
|
-
"@ikas/storefront-api": "^4.0.0-
|
|
21
|
-
"@ikas/storefront-config": "^4.0.0-
|
|
22
|
-
"@ikas/storefront-model-functions": "^4.0.0-
|
|
23
|
-
"@ikas/storefront-models": "^4.0.0-
|
|
20
|
+
"@ikas/storefront-api": "^4.0.0-beta.10",
|
|
21
|
+
"@ikas/storefront-config": "^4.0.0-beta.10",
|
|
22
|
+
"@ikas/storefront-model-functions": "^4.0.0-beta.10",
|
|
23
|
+
"@ikas/storefront-models": "^4.0.0-beta.10",
|
|
24
24
|
"@rollup/plugin-node-resolve": "^13.3.0",
|
|
25
|
+
"rollup-plugin-rename-node-modules": "^1.2.0",
|
|
25
26
|
"@types/lodash": "^4.14.168",
|
|
26
27
|
"@types/react": "^16.9.55",
|
|
27
28
|
"mobx": "^6.1.3",
|
|
@@ -33,14 +34,14 @@
|
|
|
33
34
|
"typescript": "^4.7.2",
|
|
34
35
|
"ttypescript": "^1.5.12",
|
|
35
36
|
"typescript-transform-paths": "^2.2.2",
|
|
36
|
-
"lodash": "^4.17.
|
|
37
|
+
"lodash": "^4.17.21"
|
|
37
38
|
},
|
|
38
39
|
"peerDependencies": {
|
|
39
40
|
"mobx": "^6.1.3",
|
|
40
|
-
"@ikas/storefront-api": "^4.0.0-
|
|
41
|
-
"@ikas/storefront-config": "^4.0.0-
|
|
42
|
-
"@ikas/storefront-model-functions": "^4.0.0-
|
|
43
|
-
"@ikas/storefront-models": "^4.0.0-
|
|
44
|
-
"lodash": "^4.17.
|
|
41
|
+
"@ikas/storefront-api": "^4.0.0-beta.10",
|
|
42
|
+
"@ikas/storefront-config": "^4.0.0-beta.10",
|
|
43
|
+
"@ikas/storefront-model-functions": "^4.0.0-beta.10",
|
|
44
|
+
"@ikas/storefront-models": "^4.0.0-beta.10",
|
|
45
|
+
"lodash": "^4.17.21"
|
|
45
46
|
}
|
|
46
47
|
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { IkasBlogListType } from "../ui";
|
|
2
|
-
|
|
3
|
-
export type IkasBlogListPropValue = {
|
|
4
|
-
blogListType: IkasBlogListType;
|
|
5
|
-
initialLimit?: number | null;
|
|
6
|
-
|
|
7
|
-
// Only for static lists
|
|
8
|
-
blogIds?: string[] | null;
|
|
9
|
-
|
|
10
|
-
// For CATEGORY type only
|
|
11
|
-
categoryId: string | null;
|
|
12
|
-
usePageFilter?: boolean | null;
|
|
13
|
-
};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { IkasBrandListSortType, IkasBrandListType } from "../ui";
|
|
2
|
-
|
|
3
|
-
export type IkasBrandListPropValue = {
|
|
4
|
-
brandListType: IkasBrandListType;
|
|
5
|
-
initialSort?: IkasBrandListSortType | null;
|
|
6
|
-
initialLimit?: number | null;
|
|
7
|
-
|
|
8
|
-
// Only for static lists
|
|
9
|
-
brandCount?: number | null;
|
|
10
|
-
brandIds?: string[] | null;
|
|
11
|
-
};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { IkasCategoryListSortType, IkasCategoryListType } from "../ui";
|
|
2
|
-
|
|
3
|
-
export type IkasCategoryListPropValue = {
|
|
4
|
-
categoryListType: IkasCategoryListType;
|
|
5
|
-
initialSort?: IkasCategoryListSortType | null;
|
|
6
|
-
initialLimit?: number | null;
|
|
7
|
-
|
|
8
|
-
// Only for static lists
|
|
9
|
-
categoryCount?: number | null;
|
|
10
|
-
categoryIds?: string[] | null;
|
|
11
|
-
};
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { IkasThemeJsonPageType } from "@ikas/storefront-models";
|
|
2
|
-
|
|
3
|
-
export type IkasLinkPropValue = {
|
|
4
|
-
id?: string | null;
|
|
5
|
-
linkType?: IkasLinkType | null;
|
|
6
|
-
label?: string | null;
|
|
7
|
-
pageId?: string | null;
|
|
8
|
-
pageType?: IkasThemeJsonPageType | null;
|
|
9
|
-
itemId?: string | null;
|
|
10
|
-
externalLink?: string | null;
|
|
11
|
-
fileUrl?: string | null;
|
|
12
|
-
|
|
13
|
-
// This will be used to link to a specific part of the page
|
|
14
|
-
pageComponentId?: string | null;
|
|
15
|
-
subLinks: IkasLinkPropValue[];
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
export enum IkasLinkType {
|
|
19
|
-
PAGE = "PAGE",
|
|
20
|
-
EXTERNAL = "EXTERNAL",
|
|
21
|
-
FILE = "FILE",
|
|
22
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
IkasProductListSortType,
|
|
3
|
-
IkasProductListType,
|
|
4
|
-
IkasRelatedProductsType,
|
|
5
|
-
} from "../ui";
|
|
6
|
-
|
|
7
|
-
export type IkasProductListPropValue = {
|
|
8
|
-
id: string;
|
|
9
|
-
productListType: IkasProductListType;
|
|
10
|
-
initialSort?: IkasProductListSortType | null;
|
|
11
|
-
initialLimit?: number | null;
|
|
12
|
-
|
|
13
|
-
// Only for static lists
|
|
14
|
-
productCount?: number | null;
|
|
15
|
-
productIds?: IkasProductVariantId[] | null;
|
|
16
|
-
|
|
17
|
-
// Only for collection and brand pages
|
|
18
|
-
// Example collections/man -> lists products inside the "man" category
|
|
19
|
-
usePageFilter?: boolean | null;
|
|
20
|
-
category?: string | null;
|
|
21
|
-
|
|
22
|
-
// Only for related products
|
|
23
|
-
relatedProductsType?: IkasRelatedProductsType | null;
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
type IkasProductVariantId = {
|
|
27
|
-
productId: string;
|
|
28
|
-
variantId: string;
|
|
29
|
-
};
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { IkasBlogCategory } from "@ikas/storefront-models";
|
|
2
|
-
import { IkasBlogCategoryListPropValue } from "../../prop-value/blog-category-list";
|
|
3
|
-
|
|
4
|
-
export type IkasBlogCategoryList = {
|
|
5
|
-
data: IkasBlogCategory[];
|
|
6
|
-
type: IkasBlogCategoryListType;
|
|
7
|
-
limit: number;
|
|
8
|
-
page: number;
|
|
9
|
-
count: number;
|
|
10
|
-
initialized?: boolean;
|
|
11
|
-
minPage?: number | null;
|
|
12
|
-
blogCategoryListPropValue: IkasBlogCategoryListPropValue;
|
|
13
|
-
isLoading?: boolean;
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
export enum IkasBlogCategoryListType {
|
|
17
|
-
ALL = "ALL",
|
|
18
|
-
STATIC = "STATIC",
|
|
19
|
-
}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { listBlogCategory } from "@ikas/storefront-api";
|
|
2
|
-
import { IkasBlogCategory } from "@ikas/storefront-models";
|
|
3
|
-
import { IkasBlogCategoryList, IkasBlogCategoryListType } from ".";
|
|
4
|
-
|
|
5
|
-
export async function getInitial(list: IkasBlogCategoryList) {
|
|
6
|
-
try {
|
|
7
|
-
const response = await listBlogCategories(
|
|
8
|
-
list,
|
|
9
|
-
isStatic(list) ? 1 : list.page,
|
|
10
|
-
isStatic(list)
|
|
11
|
-
? list.blogCategoryListPropValue.blogCategoryIds?.length || 10
|
|
12
|
-
: list.limit
|
|
13
|
-
);
|
|
14
|
-
|
|
15
|
-
if (isStatic(list)) {
|
|
16
|
-
list.data =
|
|
17
|
-
(list.blogCategoryListPropValue.blogCategoryIds
|
|
18
|
-
?.map((bID) => {
|
|
19
|
-
return response.data?.data?.find((b) => b.id === bID);
|
|
20
|
-
})
|
|
21
|
-
.filter((b) => !!b) as IkasBlogCategory[]) || [];
|
|
22
|
-
} else {
|
|
23
|
-
list.data = response.data?.data || [];
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
list.count = response.data?.count || 0;
|
|
27
|
-
list.initialized = true;
|
|
28
|
-
list.minPage = list.page;
|
|
29
|
-
} catch (err) {
|
|
30
|
-
console.error(err);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
function isStatic(list: IkasBlogCategoryList) {
|
|
35
|
-
return list.type === IkasBlogCategoryListType.STATIC;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
async function listBlogCategories(
|
|
39
|
-
list: IkasBlogCategoryList,
|
|
40
|
-
page: number,
|
|
41
|
-
limit: number
|
|
42
|
-
) {
|
|
43
|
-
return await listBlogCategory({
|
|
44
|
-
id: isStatic(list)
|
|
45
|
-
? list.blogCategoryListPropValue.blogCategoryIds
|
|
46
|
-
? { in: list.blogCategoryListPropValue.blogCategoryIds }
|
|
47
|
-
: undefined
|
|
48
|
-
: undefined,
|
|
49
|
-
pagination: {
|
|
50
|
-
page,
|
|
51
|
-
limit,
|
|
52
|
-
},
|
|
53
|
-
});
|
|
54
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { IkasBlog } from "@ikas/storefront-models";
|
|
2
|
-
import { IkasBlogListPropValue } from "../../prop-value/blog-list";
|
|
3
|
-
|
|
4
|
-
export type IkasBlogList = {
|
|
5
|
-
data: IkasBlog[];
|
|
6
|
-
type: IkasBlogListType;
|
|
7
|
-
limit: number;
|
|
8
|
-
page: number;
|
|
9
|
-
count: number;
|
|
10
|
-
initialized?: boolean;
|
|
11
|
-
minPage?: number | null;
|
|
12
|
-
blogListPropValue: IkasBlogListPropValue;
|
|
13
|
-
filterCategoryId: string | null;
|
|
14
|
-
isLoading?: boolean;
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
export enum IkasBlogListType {
|
|
18
|
-
ALL = "ALL",
|
|
19
|
-
STATIC = "STATIC",
|
|
20
|
-
CATEGORY = "CATEGORY",
|
|
21
|
-
}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { listBlog } from "@ikas/storefront-api";
|
|
2
|
-
import { IkasBlog } from "@ikas/storefront-models";
|
|
3
|
-
import { IkasBlogList, IkasBlogListType } from ".";
|
|
4
|
-
|
|
5
|
-
export async function getInitial(list: IkasBlogList) {
|
|
6
|
-
try {
|
|
7
|
-
const response = await listBlogs(
|
|
8
|
-
list,
|
|
9
|
-
isStatic(list) ? 1 : list.page,
|
|
10
|
-
isStatic(list) ? list.blogListPropValue.blogIds?.length || 10 : list.limit
|
|
11
|
-
);
|
|
12
|
-
|
|
13
|
-
if (isStatic(list)) {
|
|
14
|
-
list.data =
|
|
15
|
-
(list.blogListPropValue.blogIds
|
|
16
|
-
?.map((bID) => {
|
|
17
|
-
return response.data?.data?.find((b) => b.id === bID);
|
|
18
|
-
})
|
|
19
|
-
.filter((b) => !!b) as IkasBlog[]) || [];
|
|
20
|
-
} else {
|
|
21
|
-
list.data = response.data?.data || [];
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
list.count = response.data?.count || 0;
|
|
25
|
-
list.initialized = true;
|
|
26
|
-
list.minPage = list.page;
|
|
27
|
-
} catch (err) {
|
|
28
|
-
console.error(err);
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
function isStatic(list: IkasBlogList) {
|
|
33
|
-
return list.type === IkasBlogListType.STATIC;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
async function listBlogs(list: IkasBlogList, page: number, limit: number) {
|
|
37
|
-
const response = await listBlog({
|
|
38
|
-
id: isStatic(list) ? { in: list.blogListPropValue.blogIds } : undefined,
|
|
39
|
-
pagination: {
|
|
40
|
-
page,
|
|
41
|
-
limit,
|
|
42
|
-
},
|
|
43
|
-
categoryId: list.filterCategoryId
|
|
44
|
-
? { eq: list.filterCategoryId }
|
|
45
|
-
: undefined,
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
return response;
|
|
49
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { IkasBrand } from "@ikas/storefront-models";
|
|
2
|
-
import { IkasBrandListPropValue } from "../../prop-value/brand-list";
|
|
3
|
-
|
|
4
|
-
export type IkasBrandList = {
|
|
5
|
-
data: IkasBrand[];
|
|
6
|
-
type: IkasBrandListType;
|
|
7
|
-
sort: IkasBrandListSortType;
|
|
8
|
-
limit: number;
|
|
9
|
-
page: number;
|
|
10
|
-
count: number;
|
|
11
|
-
initialized?: boolean;
|
|
12
|
-
minPage?: number | null;
|
|
13
|
-
brandListPropValue: IkasBrandListPropValue;
|
|
14
|
-
isLoading?: boolean;
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
export enum IkasBrandListType {
|
|
18
|
-
ALL = "ALL",
|
|
19
|
-
STATIC = "STATIC",
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export enum IkasBrandListSortType {
|
|
23
|
-
A_Z = "A_Z",
|
|
24
|
-
Z_A = "Z_A",
|
|
25
|
-
}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { listProductBrand } from "@ikas/storefront-api";
|
|
2
|
-
import { IkasBrand } from "@ikas/storefront-models";
|
|
3
|
-
import { IkasBrandList, IkasBrandListSortType, IkasBrandListType } from ".";
|
|
4
|
-
|
|
5
|
-
export async function getInitial(list: IkasBrandList) {
|
|
6
|
-
try {
|
|
7
|
-
const _isStatic = isStatic(list);
|
|
8
|
-
const response = await listProductBrand({
|
|
9
|
-
id: _isStatic
|
|
10
|
-
? list.brandListPropValue.brandIds
|
|
11
|
-
? { in: list.brandListPropValue.brandIds }
|
|
12
|
-
: undefined
|
|
13
|
-
: undefined,
|
|
14
|
-
pagination: {
|
|
15
|
-
page: _isStatic ? undefined : list.page,
|
|
16
|
-
limit: _isStatic ? undefined : list.limit,
|
|
17
|
-
},
|
|
18
|
-
sort: getSortParams(list),
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
if (_isStatic) {
|
|
22
|
-
list.data =
|
|
23
|
-
(list.brandListPropValue.brandIds
|
|
24
|
-
?.map((bID) => {
|
|
25
|
-
return response.data?.data?.find((b) => b.id === bID);
|
|
26
|
-
})
|
|
27
|
-
.filter((b) => !!b) as IkasBrand[]) || [];
|
|
28
|
-
} else {
|
|
29
|
-
list.data = response.data?.data || [];
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
list.count = response.data?.count || 0;
|
|
33
|
-
list.initialized = true;
|
|
34
|
-
list.minPage = list.page;
|
|
35
|
-
} catch (err) {
|
|
36
|
-
console.error(err);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
function isStatic(list: IkasBrandList) {
|
|
41
|
-
return list.type === IkasBrandListType.STATIC;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
function getSortParams(list: IkasBrandList) {
|
|
45
|
-
if (list.sort === IkasBrandListSortType.A_Z) return "name";
|
|
46
|
-
else return "-name";
|
|
47
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { IkasCategory } from "@ikas/storefront-models";
|
|
2
|
-
import { IkasCategoryListPropValue } from "../../prop-value/category-list";
|
|
3
|
-
|
|
4
|
-
export type IkasCategoryList = {
|
|
5
|
-
data: IkasCategory[];
|
|
6
|
-
type: IkasCategoryListType;
|
|
7
|
-
sort: IkasCategoryListSortType;
|
|
8
|
-
limit: number;
|
|
9
|
-
page: number;
|
|
10
|
-
count: number;
|
|
11
|
-
initialized?: boolean;
|
|
12
|
-
minPage?: number | null;
|
|
13
|
-
categoryListPropValue: IkasCategoryListPropValue;
|
|
14
|
-
isLoading?: boolean;
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
export enum IkasCategoryListType {
|
|
18
|
-
ALL = "ALL",
|
|
19
|
-
STATIC = "STATIC",
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export enum IkasCategoryListSortType {
|
|
23
|
-
A_Z = "A_Z",
|
|
24
|
-
Z_A = "Z_A",
|
|
25
|
-
}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { listCategory } from "@ikas/storefront-api";
|
|
2
|
-
import { IkasCategory } from "@ikas/storefront-models";
|
|
3
|
-
import {
|
|
4
|
-
IkasCategoryList,
|
|
5
|
-
IkasCategoryListSortType,
|
|
6
|
-
IkasCategoryListType,
|
|
7
|
-
} from ".";
|
|
8
|
-
|
|
9
|
-
export async function getInitial(list: IkasCategoryList) {
|
|
10
|
-
try {
|
|
11
|
-
const response = await listCategory({
|
|
12
|
-
id: isStatic(list)
|
|
13
|
-
? list.categoryListPropValue.categoryIds
|
|
14
|
-
? { in: list.categoryListPropValue.categoryIds }
|
|
15
|
-
: undefined
|
|
16
|
-
: undefined,
|
|
17
|
-
pagination: {
|
|
18
|
-
page: isStatic(list) ? undefined : list.page,
|
|
19
|
-
limit: isStatic(list) ? undefined : list.limit,
|
|
20
|
-
},
|
|
21
|
-
sort: getSortParams(list),
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
if (isStatic(list)) {
|
|
25
|
-
list.data =
|
|
26
|
-
(list.categoryListPropValue.categoryIds
|
|
27
|
-
?.map((cID) => {
|
|
28
|
-
return response.data?.data?.find((c) => c.id === cID);
|
|
29
|
-
})
|
|
30
|
-
.filter((c) => !!c) as IkasCategory[]) || [];
|
|
31
|
-
} else {
|
|
32
|
-
list.data = response.data?.data || [];
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
list.count = response.data?.count || 0;
|
|
36
|
-
list.initialized = true;
|
|
37
|
-
list.minPage = list.page;
|
|
38
|
-
} catch (err) {
|
|
39
|
-
console.error(err);
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
function isStatic(list: IkasCategoryList) {
|
|
44
|
-
return list.type === IkasCategoryListType.STATIC;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
function getSortParams(list: IkasCategoryList) {
|
|
48
|
-
if (list.sort === IkasCategoryListSortType.A_Z) return "name";
|
|
49
|
-
else return "-name";
|
|
50
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { IkasCustomerReview } from "@ikas/storefront-models";
|
|
2
|
-
|
|
3
|
-
export type IkasCustomerReviewList = {
|
|
4
|
-
data: IkasCustomerReview[];
|
|
5
|
-
limit: number;
|
|
6
|
-
page: number;
|
|
7
|
-
count: number;
|
|
8
|
-
initialized?: boolean;
|
|
9
|
-
minPage?: number | null;
|
|
10
|
-
productId: string;
|
|
11
|
-
isLoading?: boolean;
|
|
12
|
-
};
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { listCustomerReviews } from "@ikas/storefront-api";
|
|
2
|
-
import { IkasStorefrontConfig } from "@ikas/storefront-config";
|
|
3
|
-
import { IkasCustomerReviewList } from ".";
|
|
4
|
-
|
|
5
|
-
export async function getInitial(list: IkasCustomerReviewList) {
|
|
6
|
-
try {
|
|
7
|
-
const response = await _listCustomerReviews(list, list.page, list.limit);
|
|
8
|
-
|
|
9
|
-
list.data = response.data?.data || [];
|
|
10
|
-
list.count = response.data?.count || 0;
|
|
11
|
-
list.initialized = true;
|
|
12
|
-
list.minPage = list.page;
|
|
13
|
-
} catch (err) {
|
|
14
|
-
console.error(err);
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
async function _listCustomerReviews(
|
|
19
|
-
list: IkasCustomerReviewList,
|
|
20
|
-
page: number,
|
|
21
|
-
limit: number
|
|
22
|
-
) {
|
|
23
|
-
return await listCustomerReviews({
|
|
24
|
-
productId: list.productId,
|
|
25
|
-
input: {
|
|
26
|
-
salesChannelId: IkasStorefrontConfig.getSalesChannelId() || "",
|
|
27
|
-
},
|
|
28
|
-
pagination: {
|
|
29
|
-
page,
|
|
30
|
-
limit,
|
|
31
|
-
},
|
|
32
|
-
});
|
|
33
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { IkasCustomerReviewSummary } from "@ikas/storefront-models";
|
|
2
|
-
|
|
3
|
-
export type IkasCustomerReviewSummaryList = {
|
|
4
|
-
data: IkasCustomerReviewSummary[];
|
|
5
|
-
limit: number;
|
|
6
|
-
page: number;
|
|
7
|
-
count: number;
|
|
8
|
-
initialized?: boolean;
|
|
9
|
-
minPage?: number | null;
|
|
10
|
-
productId: string;
|
|
11
|
-
isLoading?: boolean;
|
|
12
|
-
};
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { listCustomerReviewSummary } from "@ikas/storefront-api";
|
|
2
|
-
import { IkasCustomerReviewSummaryList } from ".";
|
|
3
|
-
|
|
4
|
-
export async function getInitial(list: IkasCustomerReviewSummaryList) {
|
|
5
|
-
try {
|
|
6
|
-
const response = await _listCustomerReviewSummary(
|
|
7
|
-
list,
|
|
8
|
-
list.page,
|
|
9
|
-
list.limit
|
|
10
|
-
);
|
|
11
|
-
|
|
12
|
-
list.data = response.data?.data || [];
|
|
13
|
-
list.count = response.data?.count || 0;
|
|
14
|
-
list.initialized = true;
|
|
15
|
-
list.minPage = list.page;
|
|
16
|
-
} catch (err) {
|
|
17
|
-
console.error(err);
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
async function _listCustomerReviewSummary(
|
|
22
|
-
list: IkasCustomerReviewSummaryList,
|
|
23
|
-
page: number,
|
|
24
|
-
limit: number
|
|
25
|
-
) {
|
|
26
|
-
return await listCustomerReviewSummary({
|
|
27
|
-
productId: { eq: list.productId },
|
|
28
|
-
pagination: {
|
|
29
|
-
page,
|
|
30
|
-
limit,
|
|
31
|
-
},
|
|
32
|
-
});
|
|
33
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { IkasProduct } from "@ikas/storefront-models";
|
|
2
|
-
import { IkasAttributeListPropValue } from "../../prop-value/attribute-list";
|
|
3
|
-
|
|
4
|
-
export type IkasAttributeList = {
|
|
5
|
-
productDetail: IkasProduct | null;
|
|
6
|
-
attributeListPropValue: IkasAttributeListPropValue;
|
|
7
|
-
};
|