@ikas/storefront-providers 5.0.63 → 5.0.64

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,5 +1,5 @@
1
1
  import { IkasBrand, IkasCategory, IkasFilterCategory, IkasProduct, IkasProductFilter, IkasThemeJsonPageType } from "@ikas/storefront-models";
2
- import { IkasRecommendedProductProps, IkasRelatedProductProps, IkasViewedTogetherProductProps } from "../../../providers/prop-value/product-list";
2
+ import { IkasRecommendedProductProps, IkasRelatedProductProps, IkasViewedTogetherProductProps, IkasPurchasedTogetherProductProps } 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[];
@@ -21,6 +21,7 @@ export declare type IkasProductList = {
21
21
  relatedProductData?: IkasRelatedProductProps | null;
22
22
  recommendedProductData?: IkasRecommendedProductProps | null;
23
23
  viewedTogetherProductData?: IkasViewedTogetherProductProps | null;
24
+ purchasedTogetherProductData?: IkasPurchasedTogetherProductProps | null;
24
25
  pageSpecificData: IkasCategory | IkasBrand | null;
25
26
  recommendFor?: string | null;
26
27
  isLoading?: boolean;
@@ -39,7 +40,8 @@ export declare enum IkasProductListType {
39
40
  LAST_VIEWED = "LAST_VIEWED",
40
41
  RELATED_PRODUCTS = "RELATED_PRODUCTS",
41
42
  VIEWED_TOGETHER = "VIEWED_TOGETHER",
42
- RECOMMENDED_PRODUCTS = "RECOMMENDED_PRODUCTS"
43
+ RECOMMENDED_PRODUCTS = "RECOMMENDED_PRODUCTS",
44
+ PURCHASED_TOGETHER = "PURCHASED_TOGETHER"
43
45
  }
44
46
  export declare enum IkasProductListSortType {
45
47
  INCREASING_PRICE = "INCREASING_PRICE",
@@ -83,4 +85,4 @@ export declare type FacetValue = {
83
85
  id: string;
84
86
  count: number;
85
87
  };
86
- export type { IkasRelatedProductProps, IkasViewedTogetherProductProps, IkasRecommendedProductProps, };
88
+ export type { IkasRelatedProductProps, IkasViewedTogetherProductProps, IkasRecommendedProductProps, IkasPurchasedTogetherProductProps, };
@@ -1 +1 @@
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
+ var E,A,T,_,R;!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.PURCHASED_TOGETHER="PURCHASED_TOGETHER"}(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"}(R||(R={}));export{T as IkasProductListSortByTypeEnum,A as IkasProductListSortType,E as IkasProductListType,R 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 s}from"@ikas/storefront-model-functions";import{searchProducts as u,getSuggestedProducts as l,GetSuggestedProductsMethodEnum as c,getProductFilterData as f,SortByDirectionEnum as v,SortByTypeEnum as I}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 p(i,o){var u,l,c,f;return e(this,void 0,void 0,(function(){var e,v,I,E,p,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]),v=o?i.page:1,I=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,C(i))v=void 0,I=200;else if(function(e){return e.type===a.DISCOUNTED}(i))v=1,I=10;else if(function(e){return e.type===a.RECOMMENDED}(i))v=1,I=10;else if(D(i))return[2];return[4,A(i,v||1,I||10,undefined)];case 4:return(E=t.sent())&&i.fetchRequestTime===e?(p=[],D(i)?[2]:(C(i)?(g=i.productListPropValue.productIds||[],p=(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})))||[]):p=(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,a=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)?a()[t.id]:t.id,i=s.values.find((function(e){return e.id===r}));i?t.resultCount=i.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===(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=E.data)||void 0===c?void 0:c.facets),i.data=p,i.count=(null===(f=E.data)||void 0===f?void 0:f.count)||0,i.initialized=!0,i.page=v||1,i.minPage=i.page,[2,!0])):[2];case 5:return y=t.sent(),console.error(y),[3,6];case 6:return[2]}}))}))}function C(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,p){var D,A,T;return e(this,void 0,void 0,(function(){var e,g,y,R,h,m;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 i=y(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})})),R=null===(A=r.filterCategories)||void 0===A?void 0:A.filter((function(e){return e.isSelected})).map((function(e){return e.id})),h=function(e){var t,r;switch(e.sort){case d.INCREASING_PRICE:t=v.ASC,r=I.PRICE;break;case d.DECREASING_PRICE:t=v.DESC,r=I.PRICE;break;case d.FIRST_ADDED:t=v.ASC,r=I.CREATED_AT;break;case d.LAST_ADDED:t=v.DESC,r=I.CREATED_AT;break;case d.INCREASING_DISCOUNT:t=v.ASC,r=I.DISCOUNT_RATIO;break;case d.DECRASING_DISCOUNT:t=v.DESC,r=I.DISCOUNT_RATIO;break;case d.FEATURED:if(S(e))return;t=v.ASC,r=I.MANUAL_SORT;break;case d.DEFAULT:t=void 0,r=void 0;break;case d.AVERAGE_RATING:t=v.DESC,r=I.AVERAGE_RATING;break;case d.REVIEW_COUNT:t=v.DESC,r=I.REVIEW_COUNT;break;case d.SALE_COUNT:t=v.DESC,r=I.SALE_COUNT;break;case d.A_Z:t=v.ASC,r=I.NAME;break;case d.Z_A:t=v.DESC,r=I.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()},r.excludedFields)]:[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()},r.excludedFields)]:[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()},r.excludedFields)]:[3,6];case 6:return m={input:{page:n,perPage:f,productIdList:C(r)?null===(T=r.productListPropValue.productIds)||void 0===T?void 0:T.map((function(e){return e.productId})):p,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?[]:h?[h]:[],showStockOption:E.getStockPreference()||o.SHOW_ALL}},[4,u(m,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{p as getInitial};
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 I,SortByTypeEnum as p}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 v(i,o){var u,l,c,f;return e(this,void 0,void 0,(function(){var e,I,p,E,v,A,h;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.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]),I=o?i.page:1,p=i.limit,!function(e){return e.type===n.ALL||e.type===n.CATEGORY}(i)||i.filters?[3,3]:[4,S(i)];case 2:t.sent(),t.label=3;case 3:if(T(i))return i.data=[],i.page=1,i.minPage=1,i.count=0,i.initialized=!0,[2,!0];if(void 0,C(i))I=void 0,p=200;else if(function(e){return e.type===n.DISCOUNTED}(i))I=1,p=10;else if(function(e){return e.type===n.RECOMMENDED}(i))I=1,p=10;else if(D(i))return[2];return[4,g(i,I||1,p||10,undefined)];case 4:return(E=t.sent())&&i.fetchRequestTime===e?(v=[],D(i)?[2]:(C(i)?(A=i.productListPropValue.productIds||[],v=(null==A?void 0:A.map((function(e){var t,i,a=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})),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=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,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=E.data)||void 0===c?void 0:c.facets),i.data=v,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 h=t.sent(),console.error(h),[3,6];case 6:return[2]}}))}))}function C(e){return e.type===n.STATIC}function D(e){return e.type===n.LAST_VIEWED}function T(e){return e.type===n.SEARCH}function g(r,a,f,v){var D,g,S;return e(this,void 0,void 0,(function(){var e,A,h,y,R,m;return t(this,(function(t){switch(t.label){case 0:return e=[],A=[],h=s.getValueList,null===(D=r.filters)||void 0===D||D.forEach((function(t){var i=h(t);i.length&&e.push({id:t.id,type:t.type,displayType:t.displayType,valueList:i}),t.isFacetFilter&&!r.isFacetListNotSent&&A.push({id:t.id,type:t.type,displayType:t.displayType})})),y=null===(g=r.filterCategories)||void 0===g?void 0:g.filter((function(e){return e.isSelected})).map((function(e){return e.id})),R=function(e){var t,r;switch(e.sort){case d.INCREASING_PRICE:t=I.ASC,r=p.PRICE;break;case d.DECREASING_PRICE:t=I.DESC,r=p.PRICE;break;case d.FIRST_ADDED:t=I.ASC,r=p.CREATED_AT;break;case d.LAST_ADDED:t=I.DESC,r=p.CREATED_AT;break;case d.INCREASING_DISCOUNT:t=I.ASC,r=p.DISCOUNT_RATIO;break;case d.DECRASING_DISCOUNT:t=I.DESC,r=p.DISCOUNT_RATIO;break;case d.FEATURED:if(T(e))return;t=I.ASC,r=p.MANUAL_SORT;break;case d.DEFAULT:t=void 0,r=void 0;break;case d.AVERAGE_RATING:t=I.DESC,r=p.AVERAGE_RATING;break;case d.REVIEW_COUNT:t=I.DESC,r=p.REVIEW_COUNT;break;case d.SALE_COUNT:t=I.DESC,r=p.SALE_COUNT;break;case d.A_Z:t=I.ASC,r=p.NAME;break;case d.Z_A:t=I.DESC,r=p.NAME}if(t&&r)return{direction:t,type:r}}(r),function(e){return e.type===n.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()},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:E.getPriceListId(),salesChannelId:E.getSalesChannelId(),brandIds:r.recommendedProductData.brandIds,categoryIds:r.recommendedProductData.categoryIds,locale:E.getCurrentLocale()},r.excludedFields)]:[3,4];case 4:return console.log("list.viewedTogetherProductData 2",r.viewedTogetherProductData),console.log("list.purchasedTogetherProductData 2",r.purchasedTogetherProductData),function(e){return e.type===n.VIEWED_TOGETHER}(r)&&r.viewedTogetherProductData?[4,l({priceListId:E.getPriceListId(),salesChannelId:E.getSalesChannelId(),method:c.VIEWED_TOGETHER,productIds:r.viewedTogetherProductData.productIds,locale:E.getCurrentLocale()},r.excludedFields)]:[3,6];case 6:return function(e){return e.type===n.PURCHASED_TOGETHER}(r)&&r.purchasedTogetherProductData?[4,l({priceListId:E.getPriceListId(),salesChannelId:E.getSalesChannelId(),method:c.PURCHASED_TOGETHER,productIds:r.purchasedTogetherProductData.productIds,locale:E.getCurrentLocale()},r.excludedFields)]:[3,8];case 8:return m={input:{page:a,perPage:f,productIdList:C(r)?null===(S=r.productListPropValue.productIds)||void 0===S?void 0:S.map((function(e){return e.productId})):v,filterList:e,facetList:A,brandId:r.pageType===i.BRAND&&r.type!==n.SEARCH?r.filterBrandId:void 0,categoryIdList:y&&y.length?y:r.filterCategoryId?[r.filterCategoryId]:void 0,priceListId:E.getPriceListId(),salesChannelId:E.getSalesChannelId(),query:r.searchKeyword,order:r.type===n.SEARCH?[]:R?[R]:[],showStockOption:E.getStockPreference()||o.SHOW_ALL}},[4,u(m,r.excludedFields)]}}))}))}function S(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:E.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 A(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 A=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};
@@ -14,12 +14,16 @@ export declare type IkasRecommendedProductProps = {
14
14
  export declare type IkasViewedTogetherProductProps = {
15
15
  productIds: string[];
16
16
  };
17
+ export declare type IkasPurchasedTogetherProductProps = {
18
+ productIds: string[];
19
+ };
17
20
  export declare class IkasProductListPropValueProvider implements IkasPropValueProvider<IkasProductList> {
18
21
  private pageType;
19
22
  private productListPropValue;
20
23
  private pageSpecificData?;
21
24
  private relatedProductData?;
22
25
  private viewedTogetherProductData?;
26
+ private purchasedTogetherProductData?;
23
27
  private recommendedProductData?;
24
28
  constructor(pageType: IkasThemeJsonPageType, productListPropValue: IkasProductListPropValue, pageSpecificData?: any);
25
29
  getValue(): Promise<IkasProductList>;
@@ -1 +1 @@
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 a,IkasProductListSortType as o}from"../../models/ui/product-list/index.js";import{getInitial as d}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,c;return t(this,void 0,void 0,(function(){var t,p,u,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?(u=this.pageSpecificData,p=u.id):this.pageType===i.BRAND&&(l=this.pageSpecificData,t=l.id)),this.productListPropValue.productListType===r.CATEGORY&&this.productListPropValue.category&&(p=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===a.CATEGORY?this.relatedProductData.categoryIds=this.pageSpecificData.categories&&this.pageSpecificData.categories.length?[this.pageSpecificData.categories[0].id]:null:this.relatedProductData.brandIds=[null===(c=null===(s=this.pageSpecificData)||void 0===s?void 0:s.brand)||void 0===c?void 0:c.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:p,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,isFacetListNotSent:this.productListPropValue.isFacetListNotSent,filters:null,infiniteScrollPage:null},[4,d(n)];case 1:return e.sent(),n.pageSpecificData=null,[2,n]}}))}))},s}();export{s as IkasProductListPropValueProvider};
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 a,IkasProductListSortType as o}from"../../models/ui/product-list/index.js";import{getInitial as d}from"../../models/ui/product-list/init.js";var s=function(){function s(t,e,i){this.relatedProductData=null,this.viewedTogetherProductData=null,this.purchasedTogetherProductData=null,this.recommendedProductData=null,this.pageType=t,this.productListPropValue=e,this.pageSpecificData=i,this.relatedProductData=null,this.viewedTogetherProductData=null,this.purchasedTogetherProductData=null,this.recommendedProductData=null}return s.prototype.getValue=function(){var s,c;return t(this,void 0,void 0,(function(){var t,u,p,l,h;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,u=p.id):this.pageType===i.BRAND&&(l=this.pageSpecificData,t=l.id)),this.productListPropValue.productListType===r.CATEGORY&&this.productListPropValue.category&&(u=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===a.CATEGORY?this.relatedProductData.categoryIds=this.pageSpecificData.categories&&this.pageSpecificData.categories.length?[this.pageSpecificData.categories[0].id]:null:this.relatedProductData.brandIds=[null===(c=null===(s=this.pageSpecificData)||void 0===s?void 0:s.brand)||void 0===c?void 0:c.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.pageType===i.PRODUCT&&this.productListPropValue.productListType===r.PURCHASED_TOGETHER&&this.pageSpecificData&&(this.purchasedTogetherProductData={productIds:[]},this.purchasedTogetherProductData.productIds=[this.pageSpecificData.id]),console.log("this.purchasedTogetherProductData",this.purchasedTogetherProductData),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])),h={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:u,pageType:this.pageType,pageSpecificData:[i.CATEGORY,i.BRAND].includes(this.pageType)?this.pageSpecificData:null,relatedProductData:this.relatedProductData,recommendedProductData:this.recommendedProductData,viewedTogetherProductData:this.viewedTogetherProductData,purchasedTogetherProductData:this.purchasedTogetherProductData,excludedFields:this.productListPropValue.excludedFields,isFacetListNotSent:this.productListPropValue.isFacetListNotSent,filters:null,infiniteScrollPage:null},[4,d(h)];case 1:return e.sent(),h.pageSpecificData=null,[2,h]}}))}))},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.63",
3
+ "version": "5.0.64",
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.63",
21
- "@ikas/storefront-config": "^5.0.63",
22
- "@ikas/storefront-model-functions": "^5.0.63",
23
- "@ikas/storefront-models": "^5.0.63",
20
+ "@ikas/storefront-api": "^5.0.64",
21
+ "@ikas/storefront-config": "^5.0.64",
22
+ "@ikas/storefront-model-functions": "^5.0.64",
23
+ "@ikas/storefront-models": "^5.0.64",
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.63",
42
- "@ikas/storefront-config": "^5.0.63",
43
- "@ikas/storefront-model-functions": "^5.0.63",
44
- "@ikas/storefront-models": "^5.0.63",
41
+ "@ikas/storefront-api": "^5.0.64",
42
+ "@ikas/storefront-config": "^5.0.64",
43
+ "@ikas/storefront-model-functions": "^5.0.64",
44
+ "@ikas/storefront-models": "^5.0.64",
45
45
  "lodash": "^4.17.21"
46
46
  }
47
47
  }