@ikas/storefront-providers 6.1.0-beta.343 → 6.1.0-beta.344
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.
|
@@ -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
|
|
1
|
+
import{__awaiter as e,__generator as t,__assign as r}from'./../../../ext/tslib/tslib.es6.js';import{IkasThemeJsonPageType as i,IkasCategoryProductsOrderType as a}from"@ikas/storefront-models";import{IkasProductListType as n,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 E,SortByTypeEnum as I}from"@ikas/storefront-api";import{IkasStorefrontConfig as p}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 v(i,o){var u,l,c,f;return e(this,void 0,void 0,(function(){var e,E,I,p,v,g,R;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)&&[n.ALL].includes(e.type))switch(e.pageSpecificData.orderType){case a.BEST_SELLER:e.sort=d.SALE_COUNT;break;case a.HIGHEST_DISCOUNT_RATIO:e.sort=d.DECRASING_DISCOUNT;break;case a.LOWEST_DISCOUNT_RATIO:e.sort=d.INCREASING_DISCOUNT;break;case a.HIGHEST_PRICE:e.sort=d.DECREASING_PRICE;break;case a.LOWEST_PRICE:e.sort=d.INCREASING_PRICE;break;case a.NEWEST:e.sort=d.LAST_ADDED;break;case a.OLDEST:e.sort=d.FIRST_ADDED;break;case a.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]),E=o?i.page:1,I=i.limit,!function(e){return e.type===n.ALL||e.type===n.CATEGORY}(i)||i.filters?[3,3]:[4,A(i)];case 2:t.sent(),t.label=3;case 3:if(D(i))return i.data=[],i.page=1,i.minPage=1,i.count=0,i.initialized=!0,[2,!0];if(void 0,C(i))E=void 0,I=200;else if(function(e){return e.type===n.DISCOUNTED}(i))E=1,I=10;else if(function(e){return e.type===n.RECOMMENDED}(i))E=1,I=10;else if(S(i))return[2];return[4,T(i,E||1,I||10,undefined)];case 4:return(p=t.sent())&&i.fetchRequestTime===e?(v=[],S(i)?[2]:(C(i)?(g=i.productListPropValue.productIds||[],v=(null==g?void 0:g.map((function(e){var t,i,a=null===(i=null===(t=p.data)||void 0===t?void 0:t.data)||void 0===i?void 0:i.find((function(t){return t.id===e.productId})),n=null==a?void 0:a.variants.find((function(t){return t.id===e.variantId}));if((null==n?void 0:n.isActive)||(n=null==a?void 0:a.variants.find((function(e){return e.isActive}))),a&&n)return r(r({},a),{selectedVariantValues:n.variantValues})})).filter((function(e){return!!e})))||[]):v=(null===(l=null===(u=p.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,a=s.isCustomValueFilter,n=s.getDiscountStatusMapping,o=s.isDiscountStatusFilter;null===(r=e.filters)||void 0===r||r.forEach((function(e){var r,i,d,s=null==t?void 0:t.find((function(t){return t.id===e.id}));s?null===(r=e.values)||void 0===r||r.forEach((function(t){var r=o(e)?n()[t.id]:t.id,i=s.values.find((function(e){return e.id===r}));i?t.resultCount=i.count:a(e)?t.resultCount=null:t.resultCount=0})):a(e)?null===(i=e.values)||void 0===i||i.forEach((function(e){return e.resultCount=null})):null===(d=e.values)||void 0===d||d.forEach((function(e){return e.resultCount=0}))}));var d=null==t?void 0:t.find((function(e){return"category"===e.id}));d&&(null===(i=e.filterCategories)||void 0===i||i.forEach((function(e){var t=d.values.find((function(t){return t.id===e.id}));e.resultCount=t?t.count:0})));e.filters&&e.filters.forEach((function(e){e.values=s.getDisplayedValues(e)}))}(i,null===(c=p.data)||void 0===c?void 0:c.facets),i.data=v,i.count=(null===(f=p.data)||void 0===f?void 0:f.count)||0,i.initialized=!0,i.page=E||1,i.minPage=i.page,[2,!0])):[2];case 5:return R=t.sent(),console.error(R),[3,6];case 6:return[2]}}))}))}function C(e){return e.type===n.STATIC}function S(e){return e.type===n.LAST_VIEWED}function D(e){return e.type===n.SEARCH}function T(r,a,f,v){var S,T,A;return e(this,void 0,void 0,(function(){var e,g,R,h,y,L;return t(this,(function(t){switch(t.label){case 0:return e=[],g=[],R=s.getValueList,null===(S=r.filters)||void 0===S||S.forEach((function(t){var i=R(t);i.length&&e.push({id:t.id,type:t.type,displayType:t.displayType,valueList:i}),t.isFacetFilter&&!r.isFacetListNotSent&&g.push({id:t.id,type:t.type,displayType:t.displayType})})),h=null===(T=r.filterCategories)||void 0===T?void 0:T.filter((function(e){return e.isSelected})).map((function(e){return e.id})),y=function(e){var t,r;switch(e.sort){case d.INCREASING_PRICE:t=E.ASC,r=I.PRICE;break;case d.DECREASING_PRICE:t=E.DESC,r=I.PRICE;break;case d.FIRST_ADDED:t=E.ASC,r=I.CREATED_AT;break;case d.LAST_ADDED:t=E.DESC,r=I.CREATED_AT;break;case d.INCREASING_DISCOUNT:t=E.ASC,r=I.DISCOUNT_RATIO;break;case d.DECRASING_DISCOUNT:t=E.DESC,r=I.DISCOUNT_RATIO;break;case d.FEATURED:if(D(e))return;t=E.ASC,r=I.MANUAL_SORT;break;case d.DEFAULT:t=void 0,r=void 0;break;case d.AVERAGE_RATING:t=E.DESC,r=I.AVERAGE_RATING;break;case d.REVIEW_COUNT:t=E.DESC,r=I.REVIEW_COUNT;break;case d.SALE_COUNT:t=E.DESC,r=I.SALE_COUNT;break;case d.A_Z:t=E.ASC,r=I.NAME;break;case d.Z_A:t=E.DESC,r=I.NAME}if(t&&r)return{direction:t,type:r}}(r),function(e){return e.type===n.RELATED_PRODUCTS}(r)&&r.relatedProductData?[4,l({priceListId:p.getPriceListId(),salesChannelId:p.getSalesChannelId(),productId:r.relatedProductData.productId,brandIds:r.relatedProductData.brandIds,categoryIds:r.relatedProductData.categoryIds,locale:p.getCurrentLocale()},r.excludedFields)]:[3,2];case 1:case 3:case 5:case 7:case 9:return[2,t.sent()];case 2:return function(e){return e.type===n.RECOMMENDED_PRODUCTS}(r)&&r.recommendedProductData?[4,l({priceListId:p.getPriceListId(),salesChannelId:p.getSalesChannelId(),brandIds:r.recommendedProductData.brandIds,categoryIds:r.recommendedProductData.categoryIds,locale:p.getCurrentLocale()},r.excludedFields)]:[3,4];case 4:return function(e){return e.type===n.VIEWED_TOGETHER}(r)&&r.viewedTogetherProductData?[4,l({priceListId:p.getPriceListId(),salesChannelId:p.getSalesChannelId(),method:c.VIEWED_TOGETHER,productIds:r.viewedTogetherProductData.productIds,locale:p.getCurrentLocale()},r.excludedFields)]:[3,6];case 6:return function(e){return e.type===n.PURCHASED_TOGETHER}(r)&&r.purchasedTogetherProductData?[4,l({priceListId:p.getPriceListId(),salesChannelId:p.getSalesChannelId(),method:c.PURCHASED_TOGETHER,productIds:r.purchasedTogetherProductData.productIds,locale:p.getCurrentLocale()},r.excludedFields)]:[3,8];case 8:return L={input:{page:a,perPage:f,productIdList:C(r)?null===(A=r.productListPropValue.productIds)||void 0===A?void 0:A.map((function(e){return e.productId})):v,filterList:e,facetList:g,brandId:r.pageType===i.BRAND&&r.type!==n.SEARCH?r.filterBrandId:void 0,categoryIdList:h&&h.length?h:r.filterCategoryId?[r.filterCategoryId]:void 0,priceListId:p.getPriceListId(),salesChannelId:p.getSalesChannelId(),query:r.searchKeyword,order:r.type===n.SEARCH?[]:y?[y]:[],showStockOption:p.getStockPreference()||o.SHOW_ALL}},[4,u(L,r.excludedFields)]}}))}))}function A(r){var a,n,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:p.getCurrentLocale()})];case 1:return e=t.sent(),r.filters=(null===(a=null==e?void 0:e.data)||void 0===a?void 0:a.filters)||null,r.filterCategories=(null===(o=null===(n=null==e?void 0:e.data)||void 0===n?void 0:n.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{v as getInitial};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ikas/storefront-providers",
|
|
3
|
-
"version": "6.1.0-beta.
|
|
3
|
+
"version": "6.1.0-beta.344",
|
|
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": "^6.1.0-beta.
|
|
21
|
-
"@ikas/storefront-config": "^6.1.0-beta.
|
|
22
|
-
"@ikas/storefront-model-functions": "^6.1.0-beta.
|
|
23
|
-
"@ikas/storefront-models": "^6.1.0-beta.
|
|
20
|
+
"@ikas/storefront-api": "^6.1.0-beta.344",
|
|
21
|
+
"@ikas/storefront-config": "^6.1.0-beta.344",
|
|
22
|
+
"@ikas/storefront-model-functions": "^6.1.0-beta.344",
|
|
23
|
+
"@ikas/storefront-models": "^6.1.0-beta.344",
|
|
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": "^6.1.0-beta.
|
|
42
|
-
"@ikas/storefront-config": "^6.1.0-beta.
|
|
43
|
-
"@ikas/storefront-model-functions": "^6.1.0-beta.
|
|
44
|
-
"@ikas/storefront-models": "^6.1.0-beta.
|
|
41
|
+
"@ikas/storefront-api": "^6.1.0-beta.344",
|
|
42
|
+
"@ikas/storefront-config": "^6.1.0-beta.344",
|
|
43
|
+
"@ikas/storefront-model-functions": "^6.1.0-beta.344",
|
|
44
|
+
"@ikas/storefront-models": "^6.1.0-beta.344",
|
|
45
45
|
"lodash": "^4.17.21"
|
|
46
46
|
}
|
|
47
47
|
}
|