@ikas/storefront-providers 5.0.22 → 5.0.24
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/models/prop-value/product-list.d.ts +5 -0
- package/build/models/ui/product-list/index.d.ts +5 -3
- package/build/models/ui/product-list/index.js +1 -1
- package/build/models/ui/product-list/init.js +1 -1
- package/build/providers/prop-value/product-list.d.ts +5 -0
- package/build/providers/prop-value/product-list.js +1 -1
- package/package.json +9 -9
|
@@ -9,10 +9,15 @@ export declare type IkasProductListPropValue = {
|
|
|
9
9
|
usePageFilter?: boolean | null;
|
|
10
10
|
category?: string | null;
|
|
11
11
|
relatedProductsType?: IkasRelatedProductsType | null;
|
|
12
|
+
recommendedProductsType?: IkasRecommendedProductsType | null;
|
|
12
13
|
excludedFields?: string[] | null;
|
|
13
14
|
};
|
|
14
15
|
declare type IkasProductVariantId = {
|
|
15
16
|
productId: string;
|
|
16
17
|
variantId: string;
|
|
17
18
|
};
|
|
19
|
+
declare type IkasRecommendedProductsType = {
|
|
20
|
+
category?: string | null;
|
|
21
|
+
brand?: string | null;
|
|
22
|
+
};
|
|
18
23
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IkasBrand, IkasCategory, IkasFilterCategory, IkasProduct, IkasProductFilter, IkasThemeJsonPageType } from "@ikas/storefront-models";
|
|
2
|
-
import { IkasRelatedProductProps, IkasViewedTogetherProductProps } from "../../../providers/prop-value/product-list";
|
|
2
|
+
import { IkasRecommendedProductProps, IkasRelatedProductProps, IkasViewedTogetherProductProps } from "../../../providers/prop-value/product-list";
|
|
3
3
|
import { IkasProductListPropValue } from "../../prop-value/product-list";
|
|
4
4
|
export declare type IkasProductList = {
|
|
5
5
|
data: IkasProduct[];
|
|
@@ -19,6 +19,7 @@ export declare type IkasProductList = {
|
|
|
19
19
|
filterBrandId?: string | null;
|
|
20
20
|
filterCategoryId?: string | null;
|
|
21
21
|
relatedProductData?: IkasRelatedProductProps | null;
|
|
22
|
+
recommendedProductData?: IkasRecommendedProductProps | null;
|
|
22
23
|
viewedTogetherProductData?: IkasViewedTogetherProductProps | null;
|
|
23
24
|
pageSpecificData: IkasCategory | IkasBrand | null;
|
|
24
25
|
recommendFor?: string | null;
|
|
@@ -36,7 +37,8 @@ export declare enum IkasProductListType {
|
|
|
36
37
|
SEARCH = "SEARCH",
|
|
37
38
|
LAST_VIEWED = "LAST_VIEWED",
|
|
38
39
|
RELATED_PRODUCTS = "RELATED_PRODUCTS",
|
|
39
|
-
VIEWED_TOGETHER = "VIEWED_TOGETHER"
|
|
40
|
+
VIEWED_TOGETHER = "VIEWED_TOGETHER",
|
|
41
|
+
RECOMMENDED_PRODUCTS = "RECOMMENDED_PRODUCTS"
|
|
40
42
|
}
|
|
41
43
|
export declare enum IkasProductListSortType {
|
|
42
44
|
INCREASING_PRICE = "INCREASING_PRICE",
|
|
@@ -80,4 +82,4 @@ export declare type FacetValue = {
|
|
|
80
82
|
id: string;
|
|
81
83
|
count: number;
|
|
82
84
|
};
|
|
83
|
-
export type { IkasRelatedProductProps, IkasViewedTogetherProductProps };
|
|
85
|
+
export type { IkasRelatedProductProps, IkasViewedTogetherProductProps, IkasRecommendedProductProps, };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var E,A,T,_,
|
|
1
|
+
var E,A,T,_,D;!function(E){E.ALL="ALL",E.STATIC="STATIC",E.DISCOUNTED="DISCOUNTED",E.RECOMMENDED="RECOMMENDED",E.CATEGORY="CATEGORY",E.SEARCH="SEARCH",E.LAST_VIEWED="LAST_VIEWED",E.RELATED_PRODUCTS="RELATED_PRODUCTS",E.VIEWED_TOGETHER="VIEWED_TOGETHER",E.RECOMMENDED_PRODUCTS="RECOMMENDED_PRODUCTS"}(E||(E={})),function(E){E.INCREASING_PRICE="INCREASING_PRICE",E.DECREASING_PRICE="DECREASING_PRICE",E.LAST_ADDED="LAST_ADDED",E.FIRST_ADDED="FIRST_ADDED",E.INCREASING_DISCOUNT="INCREASING_DISCOUNT",E.DECRASING_DISCOUNT="DECRASING_DISCOUNT",E.FEATURED="FEATURED",E.DEFAULT="DEFAULT",E.AVERAGE_RATING="AVERAGE_RATING",E.REVIEW_COUNT="REVIEW_COUNT",E.SALE_COUNT="SALE_COUNT",E.A_Z="A_Z",E.Z_A="Z_A"}(A||(A={})),function(E){E.AVERAGE_RATING="AVERAGE_RATING",E.CREATED_AT="CREATED_AT",E.DISCOUNT_RATIO="DISCOUNT_RATIO",E.MANUAL_SORT="MANUAL_SORT",E.NAME="NAME",E.PRICE="PRICE",E.REVIEW_COUNT="REVIEW_COUNT",E.SALE_COUNT="SALE_COUNT"}(T||(T={})),function(E){E.CATEGORY="CATEGORY",E.BRAND="BRAND"}(_||(_={})),function(E){E.HIDE_OUT_OF_STOCK="HIDE_OUT_OF_STOCK",E.SHOW_ALL="SHOW_ALL",E.SHOW_OUT_OF_STOCK_AT_END="SHOW_OUT_OF_STOCK_AT_END"}(D||(D={}));export{T as IkasProductListSortByTypeEnum,A as IkasProductListSortType,E as IkasProductListType,D as IkasProductSearchShowStockOption,_ as IkasRelatedProductsType};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__awaiter as e,__generator as t,__assign as r}from'./../../../ext/tslib/tslib.es6.js';import{IkasThemeJsonPageType as i,IkasCategoryProductsOrderType as n}from"@ikas/storefront-models";import{IkasProductListType as a,IkasProductSearchShowStockOption as o,IkasProductListSortType as d}from"./index.js";import{IkasProductFilterFunctions as
|
|
1
|
+
import{__awaiter as e,__generator as t,__assign as r}from'./../../../ext/tslib/tslib.es6.js';import{IkasThemeJsonPageType as i,IkasCategoryProductsOrderType as n}from"@ikas/storefront-models";import{IkasProductListType as a,IkasProductSearchShowStockOption as o,IkasProductListSortType as d}from"./index.js";import{IkasProductFilterFunctions as s}from"@ikas/storefront-model-functions";import{searchProducts as u,getSuggestedProducts as l,GetSuggestedProductsMethodEnum as c,getProductFilterData as f,SortByDirectionEnum as I,SortByTypeEnum as v}from"@ikas/storefront-api";import{IkasStorefrontConfig as E}from"@ikas/storefront-config";import"../blog-category-list/index.js";import"../blog-list/index.js";import"../brand-list/index.js";import"../category-list/index.js";function C(i,o){var u,l,c,f;return e(this,void 0,void 0,(function(){var e,I,v,E,C,g,y;return t(this,(function(t){switch(t.label){case 0:!function(e){var t;if((null===(t=e.pageSpecificData)||void 0===t?void 0:t.orderType)&&[a.ALL].includes(e.type))switch(e.pageSpecificData.orderType){case n.HIGHEST_DISCOUNT_RATIO:e.sort=d.DECRASING_DISCOUNT;break;case n.LOWEST_DISCOUNT_RATIO:e.sort=d.INCREASING_DISCOUNT;break;case n.HIGHEST_PRICE:e.sort=d.DECREASING_PRICE;break;case n.LOWEST_PRICE:e.sort=d.INCREASING_PRICE;break;case n.NEWEST:e.sort=d.LAST_ADDED;break;case n.OLDEST:e.sort=d.FIRST_ADDED;break;case n.MANUALLY:e.sort=d.FEATURED}}(i),i.isLoading=!0,e=Date.now(),i.fetchRequestTime=e,t.label=1;case 1:return t.trys.push([1,5,,6]),I=o?i.page:1,v=i.limit,!function(e){return e.type===a.ALL||e.type===a.CATEGORY}(i)||i.filters?[3,3]:[4,T(i)];case 2:t.sent(),t.label=3;case 3:if(S(i))return i.data=[],i.page=1,i.minPage=1,i.count=0,i.initialized=!0,[2,!0];if(void 0,p(i))I=void 0,v=200;else if(function(e){return e.type===a.DISCOUNTED}(i))I=1,v=10;else if(function(e){return e.type===a.RECOMMENDED}(i))I=1,v=10;else if(D(i))return[2];return[4,A(i,I||1,v||10,undefined)];case 4:return(E=t.sent())&&i.fetchRequestTime===e?(C=[],D(i)?[2]:(p(i)?(g=i.productListPropValue.productIds||[],C=(null==g?void 0:g.map((function(e){var t,i,n=null===(i=null===(t=E.data)||void 0===t?void 0:t.data)||void 0===i?void 0:i.find((function(t){return t.id===e.productId})),a=null==n?void 0:n.variants.find((function(t){return t.id===e.variantId}));if((null==a?void 0:a.isActive)||(a=null==n?void 0:n.variants.find((function(e){return e.isActive}))),n&&a)return r(r({},n),{selectedVariantValues:a.variantValues})})).filter((function(e){return!!e})))||[]):C=(null===(l=null===(u=E.data)||void 0===u?void 0:u.data)||void 0===l?void 0:l.map((function(e){var t=e.variants.find((function(e){return e.isActive}));return r(r({},e),{selectedVariantValues:(t||e.variants[0]).variantValues})})))||[],function(e,t){var r,i,n=s.isCustomValueFilter;null===(r=e.filters)||void 0===r||r.forEach((function(e){var r,i,a,o=null==t?void 0:t.find((function(t){return t.id===e.id}));o?null===(r=e.values)||void 0===r||r.forEach((function(t){var r=o.values.find((function(e){return e.id===t.id}));r?t.resultCount=r.count:n(e)?t.resultCount=null:t.resultCount=0})):n(e)?null===(i=e.values)||void 0===i||i.forEach((function(e){return e.resultCount=null})):null===(a=e.values)||void 0===a||a.forEach((function(e){return e.resultCount=0}))}));var a=null==t?void 0:t.find((function(e){return"category"===e.id}));a&&(null===(i=e.filterCategories)||void 0===i||i.forEach((function(e){var t=a.values.find((function(t){return t.id===e.id}));e.resultCount=t?t.count:0})))}(i,null===(c=E.data)||void 0===c?void 0:c.facets),i.data=C,i.count=(null===(f=E.data)||void 0===f?void 0:f.count)||0,i.initialized=!0,i.page=I||1,i.minPage=i.page,[2,!0])):[2];case 5:return y=t.sent(),console.error(y),[3,6];case 6:return[2]}}))}))}function p(e){return e.type===a.STATIC}function D(e){return e.type===a.LAST_VIEWED}function S(e){return e.type===a.SEARCH}function A(r,n,f,C){var D,A,T;return e(this,void 0,void 0,(function(){var e,g,y,R,m,h;return t(this,(function(t){switch(t.label){case 0:return e=[],g=[],y=s.getValueList,null===(D=r.filters)||void 0===D||D.forEach((function(t){var r=y(t);r.length&&e.push({id:t.id,type:t.type,displayType:t.displayType,valueList:r}),t.isFacetFilter&&g.push({id:t.id,type:t.type,displayType:t.displayType})})),R=null===(A=r.filterCategories)||void 0===A?void 0:A.filter((function(e){return e.isSelected})).map((function(e){return e.id})),m=function(e){var t,r;switch(e.sort){case d.INCREASING_PRICE:t=I.ASC,r=v.PRICE;break;case d.DECREASING_PRICE:t=I.DESC,r=v.PRICE;break;case d.FIRST_ADDED:t=I.ASC,r=v.CREATED_AT;break;case d.LAST_ADDED:t=I.DESC,r=v.CREATED_AT;break;case d.INCREASING_DISCOUNT:t=I.ASC,r=v.DISCOUNT_RATIO;break;case d.DECRASING_DISCOUNT:t=I.DESC,r=v.DISCOUNT_RATIO;break;case d.FEATURED:if(S(e))return;t=I.ASC,r=v.MANUAL_SORT;break;case d.DEFAULT:t=void 0,r=void 0;break;case d.AVERAGE_RATING:t=I.DESC,r=v.AVERAGE_RATING;break;case d.REVIEW_COUNT:t=I.DESC,r=v.REVIEW_COUNT;break;case d.SALE_COUNT:t=I.DESC,r=v.SALE_COUNT;break;case d.A_Z:t=I.ASC,r=v.NAME;break;case d.Z_A:t=I.DESC,r=v.NAME}if(t&&r)return{direction:t,type:r}}(r),function(e){return e.type===a.RELATED_PRODUCTS}(r)&&r.relatedProductData?[4,l({priceListId:E.getPriceListId(),salesChannelId:E.getSalesChannelId(),productId:r.relatedProductData.productId,brandIds:r.relatedProductData.brandIds,categoryIds:r.relatedProductData.categoryIds,locale:E.getCurrentLocale()})]:[3,2];case 1:case 3:case 5:case 7:return[2,t.sent()];case 2:return function(e){return e.type===a.RECOMMENDED_PRODUCTS}(r)&&r.recommendedProductData?[4,l({priceListId:E.getPriceListId(),salesChannelId:E.getSalesChannelId(),brandIds:r.recommendedProductData.brandIds,categoryIds:r.recommendedProductData.categoryIds,locale:E.getCurrentLocale()})]:[3,4];case 4:return function(e){return e.type===a.VIEWED_TOGETHER}(r)&&r.viewedTogetherProductData?[4,l({priceListId:E.getPriceListId(),salesChannelId:E.getSalesChannelId(),method:c.VIEWED_TOGETHER,productIds:r.viewedTogetherProductData.productIds,locale:E.getCurrentLocale()})]:[3,6];case 6:return h={input:{page:n,perPage:f,productIdList:p(r)?null===(T=r.productListPropValue.productIds)||void 0===T?void 0:T.map((function(e){return e.productId})):C,filterList:e,facetList:g,brandId:r.pageType===i.BRAND&&r.type!==a.SEARCH?r.filterBrandId:void 0,categoryIdList:R&&R.length?R:r.filterCategoryId?[r.filterCategoryId]:void 0,priceListId:E.getPriceListId(),salesChannelId:E.getSalesChannelId(),query:r.searchKeyword,order:r.type===a.SEARCH?[]:m?[m]:[],showStockOption:E.getStockPreference()||o.SHOW_ALL}},[4,u(h,r.excludedFields)]}}))}))}function T(r){var n,a,o,d,s;return e(this,void 0,void 0,(function(){var e,u;return t(this,(function(t){switch(t.label){case 0:return[4,f({categoryId:r.filterCategoryId?r.filterCategoryId:void 0,locale:E.getCurrentLocale()})];case 1:return e=t.sent(),r.filters=(null===(n=null==e?void 0:e.data)||void 0===n?void 0:n.filters)||null,r.filterCategories=(null===(o=null===(a=null==e?void 0:e.data)||void 0===a?void 0:a.categories)||void 0===o?void 0:o.map((function(e){return new g(e)})))||null,r.disabledSortTypes=null===(d=e.data)||void 0===d?void 0:d.disabledSortTypes,r.pageType!==i.CATEGORY&&r.filterCategoryId&&(u=null===(s=r.filterCategories)||void 0===s?void 0:s.find((function(e){return e.id===r.filterCategoryId})))&&(u.isSelected=!0),r.filters&&r.filters.sort((function(e,t){return e.order>t.order?1:-1})),[2]}}))}))}var g=function(e){this.id=e.id,this.name=e.name,this.metaData=e.metaData,this.isAutomated=e.isAutomated,this.resultCount=e.resultCount,this.isSelected=e.isSelected,this.imageId=e.imageId};export{C as getInitial};
|
|
@@ -7,6 +7,10 @@ export declare type IkasRelatedProductProps = {
|
|
|
7
7
|
categoryIds: string[] | null;
|
|
8
8
|
productId: string;
|
|
9
9
|
};
|
|
10
|
+
export declare type IkasRecommendedProductProps = {
|
|
11
|
+
brandIds: string[] | null;
|
|
12
|
+
categoryIds: string[] | null;
|
|
13
|
+
};
|
|
10
14
|
export declare type IkasViewedTogetherProductProps = {
|
|
11
15
|
productIds: string[];
|
|
12
16
|
};
|
|
@@ -16,6 +20,7 @@ export declare class IkasProductListPropValueProvider implements IkasPropValuePr
|
|
|
16
20
|
private pageSpecificData?;
|
|
17
21
|
private relatedProductData?;
|
|
18
22
|
private viewedTogetherProductData?;
|
|
23
|
+
private recommendedProductData?;
|
|
19
24
|
constructor(pageType: IkasThemeJsonPageType, productListPropValue: IkasProductListPropValue, pageSpecificData?: any);
|
|
20
25
|
getValue(): Promise<IkasProductList>;
|
|
21
26
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__awaiter as t,__generator as
|
|
1
|
+
import{__awaiter as t,__generator as e}from'./../../ext/tslib/tslib.es6.js';import{IkasThemeJsonPageType as i}from"@ikas/storefront-models";import"../../models/ui/blog-category-list/index.js";import"../../models/ui/blog-list/index.js";import"../../models/ui/brand-list/index.js";import"../../models/ui/category-list/index.js";import{IkasProductListType as r,IkasRelatedProductsType as d,IkasProductListSortType as o}from"../../models/ui/product-list/index.js";import{getInitial as a}from"../../models/ui/product-list/init.js";var s=function(){function s(t,e,i){this.relatedProductData=null,this.viewedTogetherProductData=null,this.recommendedProductData=null,this.pageType=t,this.productListPropValue=e,this.pageSpecificData=i,this.relatedProductData=null,this.viewedTogetherProductData=null,this.recommendedProductData=null}return s.prototype.getValue=function(){var s,u;return t(this,void 0,void 0,(function(){var t,c,p,l,n;return e(this,(function(e){switch(e.label){case 0:return this.productListPropValue.productListType===r.ALL&&this.productListPropValue.usePageFilter&&(this.pageType===i.CATEGORY?(p=this.pageSpecificData,c=p.id):this.pageType===i.BRAND&&(l=this.pageSpecificData,t=l.id)),this.productListPropValue.productListType===r.CATEGORY&&this.productListPropValue.category&&(c=this.productListPropValue.category),this.pageType===i.PRODUCT&&this.productListPropValue.productListType===r.RELATED_PRODUCTS&&this.productListPropValue.relatedProductsType&&this.pageSpecificData&&(this.relatedProductData={brandIds:null,categoryIds:null,productId:""},this.productListPropValue.relatedProductsType===d.CATEGORY?this.relatedProductData.categoryIds=this.pageSpecificData.categories.map((function(t){return t.id})):this.relatedProductData.brandIds=[null===(u=null===(s=this.pageSpecificData)||void 0===s?void 0:s.brand)||void 0===u?void 0:u.id],this.relatedProductData.productId=this.pageSpecificData.id),this.pageType===i.PRODUCT&&this.productListPropValue.productListType===r.VIEWED_TOGETHER&&this.pageSpecificData&&(this.viewedTogetherProductData={productIds:[]},this.viewedTogetherProductData.productIds=[this.pageSpecificData.id]),this.productListPropValue.productListType===r.RECOMMENDED_PRODUCTS&&this.productListPropValue.recommendedProductsType&&(this.recommendedProductData={brandIds:null,categoryIds:null},this.productListPropValue.recommendedProductsType.category?this.recommendedProductData.categoryIds=[this.productListPropValue.recommendedProductsType.category]:this.productListPropValue.recommendedProductsType.brand&&(this.recommendedProductData.brandIds=[this.productListPropValue.recommendedProductsType.brand])),n={data:[],count:0,page:1,limit:this.productListPropValue.initialLimit||10,type:this.productListPropValue.productListType||r.ALL,sort:this.productListPropValue.initialSort||o.LAST_ADDED,productListPropValue:this.productListPropValue,filterBrandId:t,filterCategoryId:c,pageType:this.pageType,pageSpecificData:[i.CATEGORY,i.BRAND].includes(this.pageType)?this.pageSpecificData:null,relatedProductData:this.relatedProductData,recommendedProductData:this.recommendedProductData,viewedTogetherProductData:this.viewedTogetherProductData,excludedFields:this.productListPropValue.excludedFields,filters:null,infiniteScrollPage:null},[4,a(n)];case 1:return e.sent(),n.pageSpecificData=null,[2,n]}}))}))},s}();export{s as IkasProductListPropValueProvider};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ikas/storefront-providers",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.24",
|
|
4
4
|
"description": "Data providers for ikas storefront theme components.",
|
|
5
5
|
"author": "ikas",
|
|
6
6
|
"license": "ISC",
|
|
@@ -17,10 +17,10 @@
|
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
19
|
"@rollup/plugin-commonjs": "^22.0.0",
|
|
20
|
-
"@ikas/storefront-api": "^5.0.
|
|
21
|
-
"@ikas/storefront-config": "^5.0.
|
|
22
|
-
"@ikas/storefront-model-functions": "^5.0.
|
|
23
|
-
"@ikas/storefront-models": "^5.0.
|
|
20
|
+
"@ikas/storefront-api": "^5.0.24",
|
|
21
|
+
"@ikas/storefront-config": "^5.0.24",
|
|
22
|
+
"@ikas/storefront-model-functions": "^5.0.24",
|
|
23
|
+
"@ikas/storefront-models": "^5.0.24",
|
|
24
24
|
"@rollup/plugin-node-resolve": "^13.3.0",
|
|
25
25
|
"rollup-plugin-rename-node-modules": "^1.2.0",
|
|
26
26
|
"@types/lodash": "^4.14.168",
|
|
@@ -38,10 +38,10 @@
|
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {
|
|
40
40
|
"mobx": "^6.1.3",
|
|
41
|
-
"@ikas/storefront-api": "^5.0.
|
|
42
|
-
"@ikas/storefront-config": "^5.0.
|
|
43
|
-
"@ikas/storefront-model-functions": "^5.0.
|
|
44
|
-
"@ikas/storefront-models": "^5.0.
|
|
41
|
+
"@ikas/storefront-api": "^5.0.24",
|
|
42
|
+
"@ikas/storefront-config": "^5.0.24",
|
|
43
|
+
"@ikas/storefront-model-functions": "^5.0.24",
|
|
44
|
+
"@ikas/storefront-models": "^5.0.24",
|
|
45
45
|
"lodash": "^4.17.21"
|
|
46
46
|
}
|
|
47
47
|
}
|