@ikas/storefront 2.0.69 → 2.0.70
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 t,__generator as e}from'../../../ext/tslib/tslib.es6.js';import{makeAutoObservable as i}from"mobx";import"../../theme/theme.js";import{IkasThemePageType as r}from"../../theme/page/index.js";import"../../theme/component/prop/index.js";import"../../theme/page/component/prop-value/link.js";import"../brand-list/index.js";import"../blog-list/index.js";import"../blog-category-list/index.js";import"../category-list/index.js";import{IkasProductDetail as s}from"../product-detail/index.js";import"../product-attribute-detail/index.js";import"../product-attribute-list/index.js";import"../customer-review-list/index.js";import"../customer-review-summary-list/index.js";import"../validator/index.js";import"../validator/rules/index.js";import"../validator/form/login.js";import"../validator/form/address.js";import"../validator/form/register.js";import"../validator/form/contact-form.js";import"../validator/form/forgot-password.js";import"../validator/form/recover-password.js";import"../validator/form/account-info.js";import"../validator/form/raffle-form.js";import"../validator/form/customer-review.js";import"../raffle-list/index.js";import"../../theme/settings/index.js";import"../../theme/custom-data/index.js";import"../../../api/blog/index.js";import"../../../api/brand/index.js";import"../../../api/cart/index.js";import"../../../api/category/index.js";import"../../../api/checkout/index.js";import"../../../api/city/index.js";import"../../../api/country/index.js";import"../../../api/customer/index.js";import"../../../api/customer-review/index.js";import"../../../api/customer-review-summary/index.js";import"../../../api/district/index.js";import"../../../api/html-meta-data/index.js";import"../../../api/merchant/index.js";import{IkasProductSearchAPI as n}from"../../../api/product-search/index.js";import"../../data/blog/index.js";import"../../data/brand/index.js";import{ModelOrder as a,IkasFilterCategory as o}from"../../data/category/index.js";import"../../data/checkout/index.js";import"../../data/customer/address/index.js";import"../../data/customer/index.js";import"../../data/customer-review/index.js";import"../../data/html-meta-data/index.js";import"../../data/image/index.js";import"../../data/installment-info/index.js";import"../../data/merchant-settings/index.js";import"../../data/order/index.js";import"../../data/order/line-item/index.js";import"../../../api/product-option-file/index.js";import"../../data/product/index.js";import"../../data/variant-type/index.js";import"../../data/product/variant/index.js";import"../../data/product/variant/price/index.js";import"../../data/product-attribute/index.js";import"../../data/product/attribute-value/index.js";import{IkasProductFilter as u,IkasProductFilterValue as c}from"../../data/product-filter/index.js";import"../../data/variant-type/variant-value/index.js";import"../../data/order-transaction/index.js";import"../../data/product-option-set/index.js";import"../../data/raffle/index.js";import"../../data/product-campaing/campaign/index.js";import"../../data/customer-attribute/index.js";import"../../data/customer-attribute/customer-attribute-sales-channel/index.js";import"../../../api/apollo.js";import"../../../api/favorite-product/index.js";import"../../../api/contact-form/index.js";import"../../../api/state/index.js";import"../../../api/product-option-set/index.js";import"../../../api/raffle/index.js";import"../../../api/back-in-stock-reminder/index.js";import"../../../api/product-campaign/index.js";import l from'../../../ext/query-string/index.js';import d from'../../../ext/lodash/debounce.js';import{Analytics as p}from"../../../analytics/analytics.js";import"../../../analytics/head/index.js";import{IkasStorefrontConfig as h}from"../../../storefront/index.js";import{SortByDirectionEnum as f,SortByTypeEnum as m}from"../../../__generated__/global-types.js";var g,_,y,v=function(){function y(n,a){var c=this;if(this.filters=null,this._filterCategories=null,this._infiniteScrollPage=null,this._initialized=!1,this._minPage=null,this._filterBrandId=null,this._filterCategoryId=null,this._relatedProductData=null,this.pageSpecificData=null,this._recommendFor=null,this._isLoading=!1,this._fetchRequestTime=0,this.router=null,this.applyFilters=function(){return t(c,void 0,void 0,(function(){var t,i;return e(this,(function(e){switch(e.label){case 0:return[4,this.getInitial()];case 1:return t=e.sent(),[r.CATEGORY,r.BRAND,r.SEARCH].includes(this._pageType)?(t&&this.isBrowser()&&!this.isSearch&&!h.isEditor&&(null===(i=this.router)||void 0===i||i.replace("".concat(location.pathname).concat(this.filterQueryParams?"?"+this.filterQueryParams:""),void 0,{shallow:!0})),[2]):[2]}}))}))},this.getInitial=function(i,r){return t(c,void 0,void 0,(function(){var t,n,a,o,u,c,l,d,p;return e(this,(function(e){switch(e.label){case 0:this._isLoading=!0,t=Date.now(),this._fetchRequestTime=t,e.label=1;case 1:return e.trys.push([1,12,13,14]),n=r?this._page:1,a=this._limit,!this.isFilterable||this.filters?[3,3]:[4,this.getFilters()];case 2:e.sent(),e.label=3;case 3:return this.applyQueryParamFilters(i),this.isSearch&&!this.hasAppliedfilter?(this.data=[],this._page=1,this._minPage=1,this._count=0,this._initialized=!0,[2,!0]):(o=void 0,this.isStatic?(n=void 0,a=200,[3,10]):[3,4]);case 4:return this.isDiscounted?(n=1,a=10,[3,10]):[3,5];case 5:return this.isRecommended?(n=1,a=10,[3,10]):[3,6];case 6:return this.isLastViewed?this.isBrowser()?[4,this.waitForCustomerStoreInit()]:[3,9]:[3,10];case 7:return e.sent(),[4,h.store.customerStore.getLastViewedProducts()];case 8:return(u=e.sent())&&u.length&&(o=u.map((function(t){return t.productId}))),[3,10];case 9:return[2];case 10:return[4,this.searchProducts(n||1,a||10,o)];case 11:return(c=e.sent())&&this._fetchRequestTime===t?(l=[],this.isStatic||this.isLastViewed?(d=this.isStatic?this._productListPropValue.productIds:h.store.customerStore._lastViewedProducts,l=(null==d?void 0:d.map((function(t){var e=c.data.find((function(e){return e.id===t.productId})),i=null==e?void 0:e.variants.find((function(e){return e.id===t.variantId}));if((null==i?void 0:i.isActive)||(i=null==e?void 0:e.variants.find((function(t){return t.isActive}))),e&&i)return new s(e,i.variantValues)})).filter((function(t){return!!t})))||[]):l=c.data.map((function(t){var e=t.variants.find((function(t){return t.isActive}));return new s(t,(e||t.variants[0]).variantValues)})),this.applyFacets(c.facets),this.data=l,this._count=c.count,this._initialized=!0,this._page=n||1,this._minPage=this.page,r||(this._infiniteScrollPage=null),this.handleListingEvent(),[2,!0]):[2];case 12:return p=e.sent(),console.log(p),[3,14];case 13:return t===this._fetchRequestTime&&(this._isLoading=!1),[7];case 14:return[2]}}))}))},this.getPrev=function(){return t(c,void 0,void 0,(function(){var t,i,r,n;return e(this,(function(e){switch(e.label){case 0:if(this.isStatic||this.isDiscounted||this.isRecommended||this.isLastViewed||this._isLoading||!this.hasPrev)return[2];this._isLoading=!0,e.label=1;case 1:return e.trys.push([1,3,4,5]),t=this._minPage-1,[4,this.searchProducts(t,this.limit)];case 2:return(i=e.sent())?(r=i.data.map((function(t){var e=t.variants.find((function(t){return t.isActive}));return new s(t,(e||t.variants[0]).variantValues)})),this.data=r.concat(this.data),this._count=i.count,this._minPage=t,[3,5]):[2];case 3:return n=e.sent(),console.log(n),[3,5];case 4:return this._isLoading=!1,[7];case 5:return[2]}}))}))},this.getNext=function(){return t(c,void 0,void 0,(function(){var t,i,r;return e(this,(function(e){switch(e.label){case 0:if(this.isStatic||this.isDiscounted||this.isRecommended||this.isLastViewed||this._isLoading||!this.hasNext)return[2];this._isLoading=!0,e.label=1;case 1:return e.trys.push([1,3,4,5]),[4,this.searchProducts(this.page+1,this.limit)];case 2:return(t=e.sent())?(i=t.data.map((function(t){var e=t.variants.find((function(t){return t.isActive}));return new s(t,(e||t.variants[0]).variantValues)})),this.data=this.data.concat(i),this._count=t.count,this._page=this.page+1,[3,5]):[2];case 3:return r=e.sent(),console.log(r),[3,5];case 4:return this._isLoading=!1,[7];case 5:return[2]}}))}))},this.getPage=function(i){return t(c,void 0,void 0,(function(){var t,r,n;return e(this,(function(e){switch(e.label){case 0:if(this._isLoading||this.isStatic||this.isDiscounted||this.isRecommended||this.isLastViewed)return[2];this._isLoading=!0,e.label=1;case 1:return e.trys.push([1,3,4,5]),[4,this.searchProducts(i,this.limit)];case 2:return(t=e.sent())?(r=t.data.map((function(t){var e=t.variants.find((function(t){return t.isActive}));return new s(t,(e||t.variants[0]).variantValues)})),this.data=r,this._count=t.count,this._page=i,this._minPage=i,[3,5]):[2];case 3:return n=e.sent(),console.log(n),[3,5];case 4:return this._isLoading=!1,[7];case 5:return[2]}}))}))},this.setVisibleInfiniteScrollPage=function(t){var e;c._infiniteScrollPage!==t&&(c._infiniteScrollPage=t,h.isEditor||null===(e=c.router)||void 0===e||e.replace("".concat(location.pathname).concat(c.filterQueryParams?"?"+c.filterQueryParams:""),void 0,{shallow:!0}))},this.searchDebouncer=d((function(){c.applyFilters()}),100),this.searchAnalyticsDebouncer=d((function(){p.search(c._searchKeyword)}),1e3),this.data=n.data?n.data.map((function(t){return new s(t.product,t.selectedVariantValues)})):[],this._type=n.type||n.productListPropValue.productListType||g.ALL,this._pageType=n.pageType,this._sort=n.sort||n.productListPropValue.initialSort||_.LAST_ADDED,"A_Z"!==this.initialSort&&"Z_A"!==this.initialSort||(this._sort=_.LAST_ADDED),this._limit=n.limit||n.productListPropValue.initialLimit||20,this._page=n.page||1,this._minPage=n.minPage||null,this._count=n.count||0,this._searchKeyword=n.searchKeyword||"",this._productListPropValue=n.productListPropValue,this._filterBrandId=n.filterBrandId||null,this._filterCategoryId=n.filterCategoryId||null,this._relatedProductData=n.relatedProductData||null,this._recommendFor=n.recommendFor,this.filters=n.filters?n.filters.map((function(t){return new u(t,c)})):null,this._filterCategories=n.filterCategories?n.filterCategories.map((function(t){return new o(t)})):null,this.pageSpecificData=n.pageSpecificData||null,this.router=a,i(this),this.setPageSpecificSort(),this.isBrowser())if(this.restoreInfiniteScrollPage(),location.search&&(this.isFilterable||this._type===g.SEARCH)){var l=this.getQueryParams();this.getInitial(l,this._page>1)}else this._page>1?this.getInitial(void 0,!0):this.isLastViewed?this.getInitial():this.handleListingEvent()}return Object.defineProperty(y.prototype,"sort",{get:function(){return this._sort},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"limit",{get:function(){return this._limit},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"pageType",{get:function(){return this._pageType},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"page",{get:function(){return this._page},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"minPage",{get:function(){return this._minPage||1},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"count",{get:function(){return this._count},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"pageCount",{get:function(){return Math.ceil(this._count/this._limit)},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"searchKeyword",{get:function(){return this._searchKeyword},set:function(t){t!==this._searchKeyword&&(this._searchKeyword=t,this.searchDebouncer(),this.searchAnalyticsDebouncer())},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"isInitialized",{get:function(){return this._initialized},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"isFilterable",{get:function(){return this._type===g.ALL||this._type===g.CATEGORY},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"isFiltered",{get:function(){var t,e;return(null===(t=this.filters)||void 0===t?void 0:t.some((function(t){return!!t.valueList.length})))||!!this._searchKeyword||this._pageType!==r.CATEGORY&&(!!this._filterCategoryId||(null===(e=this._filterCategories)||void 0===e?void 0:e.some((function(t){return t.isSelected}))))},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"isStatic",{get:function(){return this._type===g.STATIC},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"isDiscounted",{get:function(){return this._type===g.DISCOUNTED},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"isRecommended",{get:function(){return this._type===g.RECOMMENDED},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"isLastViewed",{get:function(){return this._type===g.LAST_VIEWED},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"isRelatedProducts",{get:function(){return this._type===g.RELATED_PRODUCTS},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"isSearch",{get:function(){return this._type===g.SEARCH},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"hasPrev",{get:function(){return!(this.isStatic||this.isDiscounted||this.isRecommended||!this._minPage)&&this._minPage>1},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"hasNext",{get:function(){return!(this.isStatic||this.isDiscounted||this.isRecommended)&&this.page*this.limit<this.count},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"isLoading",{get:function(){return this._isLoading},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"filterQueryParams",{get:function(){var t,e,i,s,n=this,a={},o=this.getQueryParams();if(o&&o.forEach((function(t,e){"s"!==e&&(a[e]=t)})),null===(t=this.filters)||void 0===t||t.forEach((function(t){t.keyList.length&&(a[t.key]=t.keyList)})),this._searchKeyword&&(a.s=this._searchKeyword),this._infiniteScrollPage&&(a.page=this._infiniteScrollPage),this._pageType!==r.CATEGORY){var u=null===(e=this.filterCategories)||void 0===e?void 0:e.filter((function(t){return t.isSelected}));if(!!(null==u?void 0:u.length))a.c=null==u?void 0:u.map((function(t){return t.slug}));else if(this._filterCategoryId){var c=null===(s=null===(i=this.filterCategories)||void 0===i?void 0:i.find((function(t){return t.id===n._filterCategoryId})))||void 0===s?void 0:s.slug;c&&(a.c=c)}}return l.stringify(a,{arrayFormat:"comma"})},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"filterCategories",{get:function(){var t;return null===(t=this._filterCategories)||void 0===t?void 0:t.filter((function(t){return 0!==t.resultCount}))},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"hasAppliedfilter",{get:function(){var t;return!!this._searchKeyword||(null===(t=this.filters)||void 0===t?void 0:t.some((function(t){return!!t.valueList.length})))},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"isFeaturedSortEnabled",{get:function(){var t;return(null===(t=this.pageSpecificData)||void 0===t?void 0:t.orderType)===a.MANUALLY&&[g.ALL,g.CATEGORY].includes(this._type)},enumerable:!1,configurable:!0}),y.prototype.setPageSpecificSort=function(){var t;if((null===(t=this.pageSpecificData)||void 0===t?void 0:t.orderType)&&[g.ALL,g.CATEGORY].includes(this._type))switch(this.pageSpecificData.orderType){case a.HIGHEST_DISCOUNT_RATIO:this._sort=_.DECRASING_DISCOUNT;break;case a.LOWEST_DISCOUNT_RATIO:this._sort=_.INCREASING_DISCOUNT;break;case a.HIGHEST_PRICE:this._sort=_.DECREASING_PRICE;break;case a.LOWEST_PRICE:this._sort=_.INCREASING_PRICE;break;case a.NEWEST:this._sort=_.LAST_ADDED;break;case a.OLDEST:this._sort=_.FIRST_ADDED;break;case a.MANUALLY:this._sort=_.FEATURED}},y.prototype.getSortParams=function(){var t=f.DESC,e=m.CREATED_AT;switch(this._sort){case _.INCREASING_PRICE:t=f.ASC,e=m.PRICE;break;case _.DECREASING_PRICE:t=f.DESC,e=m.PRICE;break;case _.FIRST_ADDED:t=f.ASC,e=m.CREATED_AT;break;case _.LAST_ADDED:t=f.DESC,e=m.CREATED_AT;break;case _.INCREASING_DISCOUNT:t=f.ASC,e=m.DISCOUNT_RATIO;break;case _.DECRASING_DISCOUNT:t=f.DESC,e=m.DISCOUNT_RATIO;break;case _.FEATURED:if(this.isSearch)return;t=f.ASC,e=m.MANUAL_SORT}return{direction:t,type:e}},y.prototype.searchProducts=function(i,s,a){var o,u,l;return t(this,void 0,void 0,(function(){var t,d,p,f;return e(this,(function(e){switch(e.label){case 0:return t=[],d=[],null===(o=this.filters)||void 0===o||o.forEach((function(e){e.valueList.length&&t.push(new c({id:e.id,type:e.type,displayType:e.displayType,valueList:e.valueList})),e.isFacetFilter&&d.push({id:e.id,type:e.type,displayType:e.displayType})})),p=null===(u=this._filterCategories)||void 0===u?void 0:u.filter((function(t){return t.isSelected})).map((function(t){return t.id})),f=this.getSortParams(),this.isRelatedProducts&&this._relatedProductData?[4,n.getRelatedProducts({priceListId:h.priceListId,salesChannelId:h.salesChannelId,productId:this._relatedProductData.productId,brandIds:this._relatedProductData.brandIds,categoryIds:this._relatedProductData.categoryIds})]:[3,2];case 1:case 3:return[2,e.sent()];case 2:return[4,n.searchProducts({page:i,perPage:s,productIdList:this.isStatic?null===(l=this._productListPropValue.productIds)||void 0===l?void 0:l.map((function(t){return t.productId})):a,filterList:t,facetList:d,brandId:this._pageType===r.BRAND&&this._type!==g.SEARCH?this._filterBrandId:void 0,categoryIdList:p&&p.length?p:this._filterCategoryId?[this._filterCategoryId]:void 0,priceListId:h.priceListId,salesChannelId:h.salesChannelId,query:this._searchKeyword,order:this._type===g.SEARCH?null:f?[f]:null},!0)]}}))}))},y.prototype.getFilters=function(){var i;return t(this,void 0,void 0,(function(){var t,s,a=this;return e(this,(function(e){switch(e.label){case 0:return[4,n.getProductFilterData(this._filterCategoryId?this._filterCategoryId:void 0)];case 1:return t=e.sent(),this.filters=null==t?void 0:t.filters.map((function(t){return new u(t,a)})),this._filterCategories=null==t?void 0:t.categories,this.pageType!==r.CATEGORY&&this._filterCategoryId&&(s=null===(i=this._filterCategories)||void 0===i?void 0:i.find((function(t){return t.id===a._filterCategoryId})))&&(s._isSelected=!0),this.filters&&this.filters.sort((function(t,e){return t.order>e.order?1:-1})),[2]}}))}))},y.prototype.applyQueryParamFilters=function(t){var e,i=this;try{null==t||t.forEach((function(t,e){var r,s=null===(r=i.filters)||void 0===r?void 0:r.find((function(t){return t.key===e}));s&&s.applyQueryParam(t)}));var s=null==t?void 0:t.get("s");if(s&&(this._searchKeyword=s),this._pageType!==r.CATEGORY){var n=null==t?void 0:t.get("c"),a=null==n?void 0:n.split(",");a&&a.length&&(null===(e=this.filterCategories)||void 0===e||e.forEach((function(t){t._isSelected=a.some((function(e){return e===t.slug}))})))}}catch(t){console.log(t)}},y.prototype.applyFacets=function(t){var e,i;null===(e=this.filters)||void 0===e||e.forEach((function(e){var i,r,s,n=null==t?void 0:t.find((function(t){return t.id===e.id}));n?null===(i=e.values)||void 0===i||i.forEach((function(t){var i=n.values.find((function(e){return e.id===t.id}));i?t.resultCount=i.count:e.isCustomValueFilter?t.resultCount=null:t.resultCount=0})):e.isCustomValueFilter?null===(r=e.values)||void 0===r||r.forEach((function(t){return t.resultCount=null})):null===(s=e.values)||void 0===s||s.forEach((function(t){return t.resultCount=0}))}));var r=null==t?void 0:t.find((function(t){return"category"===t.id}));r&&(null===(i=this._filterCategories)||void 0===i||i.forEach((function(t){var e=r.values.find((function(e){return e.id===t.id}));t.resultCount=e?e.count:0})))},y.prototype.clearFilters=function(){var t,e;null===(t=this.filters)||void 0===t||t.forEach((function(t){return t.clear()})),this._searchKeyword="",this._pageType!==r.CATEGORY&&(this._filterCategoryId=void 0),null===(e=this._filterCategories)||void 0===e||e.forEach((function(t){return t._isSelected=!1})),this.applyFilters()},y.prototype.setSortType=function(i){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return this._sort=i,[4,this.getInitial()];case 1:return t.sent(),[2]}}))}))},y.prototype.onFilterCategoryClick=function(i,r){var s,n;return void 0===r&&(r=!1),t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return r?(null===(s=this._filterCategories)||void 0===s||s.forEach((function(t){t.id===i.id&&(t._isSelected=!t.isSelected)})),[4,this.applyFilters()]):[3,2];case 1:return t.sent(),[3,3];case 2:h.isEditor||null===(n=this.router)||void 0===n||n.push(i.href+(this.filterQueryParams?"?"+this.filterQueryParams:"")),t.label=3;case 3:return[2]}}))}))},y.prototype.toJSON=function(){return{data:this.data,type:this._type,pageType:this._pageType,sort:this._sort,limit:this._limit,page:this._page,count:this._count,searchKeyword:this._searchKeyword,initialized:this._initialized,minPage:this._minPage,filterBrandId:this._filterBrandId,filterCategoryId:this._filterCategoryId,filterCategories:this._filterCategories,filters:this.filters,recommendFor:this._recommendFor,productListPropValue:this._productListPropValue,pageSpecificData:this.pageSpecificData}},y.prototype.restoreInfiniteScrollPage=function(){var t=this.getQueryParams(),e=null==t?void 0:t.get("page");if(e){var i=parseInt(e);isNaN(i)||(this._page=i,this._infiniteScrollPage=i)}},y.prototype.getQueryParams=function(){if(this.isBrowser())return new URLSearchParams(location.search)},y.prototype.isBrowser=function(){return"undefined"!=typeof window},y.prototype.waitForCustomerStoreInit=function(){return new Promise((function(t){var e=setInterval((function(){h.store.customerStore.initialized&&(clearInterval(e),t(null))}),1e3)}))},y.prototype.handleListingEvent=function(){this.searchKeyword&&this.data.length?p.viewSearchResults(this._searchKeyword,this.data):this.data.length&&this._type===g.ALL&&p.viewListing(this.data)},y}();!function(t){t.ALL="ALL",t.STATIC="STATIC",t.DISCOUNTED="DISCOUNTED",t.RECOMMENDED="RECOMMENDED",t.CATEGORY="CATEGORY",t.SEARCH="SEARCH",t.LAST_VIEWED="LAST_VIEWED",t.RELATED_PRODUCTS="RELATED_PRODUCTS"}(g||(g={})),function(t){t.INCREASING_PRICE="INCREASING_PRICE",t.DECREASING_PRICE="DECREASING_PRICE",t.LAST_ADDED="LAST_ADDED",t.FIRST_ADDED="FIRST_ADDED",t.INCREASING_DISCOUNT="INCREASING_DISCOUNT",t.DECRASING_DISCOUNT="DECRASING_DISCOUNT",t.FEATURED="FEATURED"}(_||(_={})),function(t){t.CATEGORY="CATEGORY",t.BRAND="BRAND"}(y||(y={}));export{v as IkasProductList,_ as IkasProductListSortType,g as IkasProductListType,y as IkasRelatedProductsType};
|
|
1
|
+
import{__awaiter as t,__generator as e}from'../../../ext/tslib/tslib.es6.js';import{makeAutoObservable as i}from"mobx";import"../../theme/theme.js";import{IkasThemePageType as r}from"../../theme/page/index.js";import"../../theme/component/prop/index.js";import"../../theme/page/component/prop-value/link.js";import"../brand-list/index.js";import"../blog-list/index.js";import"../blog-category-list/index.js";import"../category-list/index.js";import{IkasProductDetail as s}from"../product-detail/index.js";import"../product-attribute-detail/index.js";import"../product-attribute-list/index.js";import"../customer-review-list/index.js";import"../customer-review-summary-list/index.js";import"../validator/index.js";import"../validator/rules/index.js";import"../validator/form/login.js";import"../validator/form/address.js";import"../validator/form/register.js";import"../validator/form/contact-form.js";import"../validator/form/forgot-password.js";import"../validator/form/recover-password.js";import"../validator/form/account-info.js";import"../validator/form/raffle-form.js";import"../validator/form/customer-review.js";import"../raffle-list/index.js";import"../../theme/settings/index.js";import"../../theme/custom-data/index.js";import"../../../api/blog/index.js";import"../../../api/brand/index.js";import"../../../api/cart/index.js";import"../../../api/category/index.js";import"../../../api/checkout/index.js";import"../../../api/city/index.js";import"../../../api/country/index.js";import"../../../api/customer/index.js";import"../../../api/customer-review/index.js";import"../../../api/customer-review-summary/index.js";import"../../../api/district/index.js";import"../../../api/html-meta-data/index.js";import"../../../api/merchant/index.js";import{IkasProductSearchAPI as n}from"../../../api/product-search/index.js";import"../../data/blog/index.js";import"../../data/brand/index.js";import{ModelOrder as a,IkasFilterCategory as o}from"../../data/category/index.js";import"../../data/checkout/index.js";import"../../data/customer/address/index.js";import"../../data/customer/index.js";import"../../data/customer-review/index.js";import"../../data/html-meta-data/index.js";import"../../data/image/index.js";import"../../data/installment-info/index.js";import"../../data/merchant-settings/index.js";import"../../data/order/index.js";import"../../data/order/line-item/index.js";import"../../../api/product-option-file/index.js";import"../../data/product/index.js";import"../../data/variant-type/index.js";import"../../data/product/variant/index.js";import"../../data/product/variant/price/index.js";import"../../data/product-attribute/index.js";import"../../data/product/attribute-value/index.js";import{IkasProductFilter as u,IkasProductFilterValue as c}from"../../data/product-filter/index.js";import"../../data/variant-type/variant-value/index.js";import"../../data/order-transaction/index.js";import"../../data/product-option-set/index.js";import"../../data/raffle/index.js";import"../../data/product-campaing/campaign/index.js";import"../../data/customer-attribute/index.js";import"../../data/customer-attribute/customer-attribute-sales-channel/index.js";import"../../../api/apollo.js";import"../../../api/favorite-product/index.js";import"../../../api/contact-form/index.js";import"../../../api/state/index.js";import"../../../api/product-option-set/index.js";import"../../../api/raffle/index.js";import"../../../api/back-in-stock-reminder/index.js";import"../../../api/product-campaign/index.js";import l from'../../../ext/query-string/index.js';import d from'../../../ext/lodash/debounce.js';import{Analytics as p}from"../../../analytics/analytics.js";import"../../../analytics/head/index.js";import{IkasStorefrontConfig as h}from"../../../storefront/index.js";import{SortByDirectionEnum as f,SortByTypeEnum as m}from"../../../__generated__/global-types.js";var g,_,y,v=function(){function y(n,a){var c=this;if(this.filters=null,this._filterCategories=null,this._infiniteScrollPage=null,this._initialized=!1,this._minPage=null,this._filterBrandId=null,this._filterCategoryId=null,this._relatedProductData=null,this.pageSpecificData=null,this._recommendFor=null,this._isLoading=!1,this._fetchRequestTime=0,this.router=null,this.applyFilters=function(){return t(c,void 0,void 0,(function(){var t,i;return e(this,(function(e){switch(e.label){case 0:return[4,this.getInitial()];case 1:return t=e.sent(),[r.CATEGORY,r.BRAND,r.SEARCH].includes(this._pageType)?(t&&this.isBrowser()&&!this.isSearch&&!h.isEditor&&(null===(i=this.router)||void 0===i||i.replace("".concat(location.pathname).concat(this.filterQueryParams?"?"+this.filterQueryParams:""),void 0,{shallow:!0})),[2]):[2]}}))}))},this.getInitial=function(i,r){return t(c,void 0,void 0,(function(){var t,n,a,o,u,c,l,d,p;return e(this,(function(e){switch(e.label){case 0:this._isLoading=!0,t=Date.now(),this._fetchRequestTime=t,e.label=1;case 1:return e.trys.push([1,12,13,14]),n=r?this._page:1,a=this._limit,!this.isFilterable||this.filters?[3,3]:[4,this.getFilters()];case 2:e.sent(),e.label=3;case 3:return this.applyQueryParamFilters(i),this.isSearch&&!this.hasAppliedfilter?(this.data=[],this._page=1,this._minPage=1,this._count=0,this._initialized=!0,[2,!0]):(o=void 0,this.isStatic?(n=void 0,a=200,[3,10]):[3,4]);case 4:return this.isDiscounted?(n=1,a=10,[3,10]):[3,5];case 5:return this.isRecommended?(n=1,a=10,[3,10]):[3,6];case 6:return this.isLastViewed?this.isBrowser()?[4,this.waitForCustomerStoreInit()]:[3,9]:[3,10];case 7:return e.sent(),[4,h.store.customerStore.getLastViewedProducts()];case 8:return(u=e.sent())&&u.length&&(o=u.map((function(t){return t.productId}))),[3,10];case 9:return[2];case 10:return[4,this.searchProducts(n||1,a||10,o)];case 11:return(c=e.sent())&&this._fetchRequestTime===t?(l=[],this.isStatic||this.isLastViewed?(d=this.isStatic?this._productListPropValue.productIds:h.store.customerStore._lastViewedProducts,l=(null==d?void 0:d.map((function(t){var e=c.data.find((function(e){return e.id===t.productId})),i=null==e?void 0:e.variants.find((function(e){return e.id===t.variantId}));if((null==i?void 0:i.isActive)||(i=null==e?void 0:e.variants.find((function(t){return t.isActive}))),e&&i)return new s(e,i.variantValues)})).filter((function(t){return!!t})))||[]):l=c.data.map((function(t){var e=t.variants.find((function(t){return t.isActive}));return new s(t,(e||t.variants[0]).variantValues)})),this.applyFacets(c.facets),this.data=l,this._count=c.count,this._initialized=!0,this._page=n||1,this._minPage=this.page,r||(this._infiniteScrollPage=null),this.handleListingEvent(),[2,!0]):[2];case 12:return p=e.sent(),console.log(p),[3,14];case 13:return t===this._fetchRequestTime&&(this._isLoading=!1),[7];case 14:return[2]}}))}))},this.getPrev=function(){return t(c,void 0,void 0,(function(){var t,i,r,n;return e(this,(function(e){switch(e.label){case 0:if(this.isStatic||this.isDiscounted||this.isRecommended||this.isLastViewed||this._isLoading||!this.hasPrev)return[2];this._isLoading=!0,e.label=1;case 1:return e.trys.push([1,3,4,5]),t=this._minPage-1,[4,this.searchProducts(t,this.limit)];case 2:return(i=e.sent())?(r=i.data.map((function(t){var e=t.variants.find((function(t){return t.isActive}));return new s(t,(e||t.variants[0]).variantValues)})),this.data=r.concat(this.data),this._count=i.count,this._minPage=t,[3,5]):[2];case 3:return n=e.sent(),console.log(n),[3,5];case 4:return this._isLoading=!1,[7];case 5:return[2]}}))}))},this.getNext=function(){return t(c,void 0,void 0,(function(){var t,i,r;return e(this,(function(e){switch(e.label){case 0:if(this.isStatic||this.isDiscounted||this.isRecommended||this.isLastViewed||this._isLoading||!this.hasNext)return[2];this._isLoading=!0,e.label=1;case 1:return e.trys.push([1,3,4,5]),[4,this.searchProducts(this.page+1,this.limit)];case 2:return(t=e.sent())?(i=t.data.map((function(t){var e=t.variants.find((function(t){return t.isActive}));return new s(t,(e||t.variants[0]).variantValues)})),this.data=this.data.concat(i),this._count=t.count,this._page=this.page+1,[3,5]):[2];case 3:return r=e.sent(),console.log(r),[3,5];case 4:return this._isLoading=!1,[7];case 5:return[2]}}))}))},this.getPage=function(i){return t(c,void 0,void 0,(function(){var t,r,n;return e(this,(function(e){switch(e.label){case 0:if(this._isLoading||this.isStatic||this.isDiscounted||this.isRecommended||this.isLastViewed)return[2];this._isLoading=!0,e.label=1;case 1:return e.trys.push([1,3,4,5]),[4,this.searchProducts(i,this.limit)];case 2:return(t=e.sent())?(r=t.data.map((function(t){var e=t.variants.find((function(t){return t.isActive}));return new s(t,(e||t.variants[0]).variantValues)})),this.data=r,this._count=t.count,this._page=i,this._minPage=i,[3,5]):[2];case 3:return n=e.sent(),console.log(n),[3,5];case 4:return this._isLoading=!1,[7];case 5:return[2]}}))}))},this.setVisibleInfiniteScrollPage=function(t){var e;c._infiniteScrollPage!==t&&(c._infiniteScrollPage=t,h.isEditor||null===(e=c.router)||void 0===e||e.replace("".concat(location.pathname).concat(c.filterQueryParams?"?"+c.filterQueryParams:""),void 0,{shallow:!0}))},this.searchDebouncer=d((function(){c.applyFilters()}),100),this.searchAnalyticsDebouncer=d((function(){p.search(c._searchKeyword)}),1e3),this.data=n.data?n.data.map((function(t){return new s(t.product,t.selectedVariantValues)})):[],this._type=n.type||n.productListPropValue.productListType||g.ALL,this._pageType=n.pageType,this._sort=n.sort||n.productListPropValue.initialSort||_.LAST_ADDED,"A_Z"!==this.initialSort&&"Z_A"!==this.initialSort||(this._sort=_.LAST_ADDED),this._limit=n.limit||n.productListPropValue.initialLimit||20,this._page=n.page||1,this._minPage=n.minPage||null,this._count=n.count||0,this._searchKeyword=n.searchKeyword||"",this._productListPropValue=n.productListPropValue,this._filterBrandId=n.filterBrandId||null,this._filterCategoryId=n.filterCategoryId||null,this._relatedProductData=n.relatedProductData||null,this._recommendFor=n.recommendFor,this.filters=n.filters?n.filters.map((function(t){return new u(t,c)})):null,this._filterCategories=n.filterCategories?n.filterCategories.map((function(t){return new o(t)})):null,this.pageSpecificData=n.pageSpecificData||null,this.router=a,i(this),this.setPageSpecificSort(),this.isBrowser())if(this.restoreInfiniteScrollPage(),location.search&&(this.isFilterable||this._type===g.SEARCH)){var l=this.getQueryParams();this.getInitial(l,this._page>1)}else this._page>1?this.getInitial(void 0,!0):this.isLastViewed?this.getInitial():this.handleListingEvent()}return Object.defineProperty(y.prototype,"sort",{get:function(){return this._sort},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"limit",{get:function(){return this._limit},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"pageType",{get:function(){return this._pageType},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"page",{get:function(){return this._page},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"minPage",{get:function(){return this._minPage||1},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"count",{get:function(){return this._count},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"pageCount",{get:function(){return Math.ceil(this._count/this._limit)},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"searchKeyword",{get:function(){return this._searchKeyword},set:function(t){t!==this._searchKeyword&&(this._searchKeyword=t,this.searchDebouncer(),this.searchAnalyticsDebouncer())},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"isInitialized",{get:function(){return this._initialized},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"isFilterable",{get:function(){return this._type===g.ALL||this._type===g.CATEGORY},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"isFiltered",{get:function(){var t,e;return(null===(t=this.filters)||void 0===t?void 0:t.some((function(t){return!!t.valueList.length})))||!!this._searchKeyword||this._pageType!==r.CATEGORY&&(!!this._filterCategoryId||(null===(e=this._filterCategories)||void 0===e?void 0:e.some((function(t){return t.isSelected}))))},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"isStatic",{get:function(){return this._type===g.STATIC},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"isDiscounted",{get:function(){return this._type===g.DISCOUNTED},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"isRecommended",{get:function(){return this._type===g.RECOMMENDED},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"isLastViewed",{get:function(){return this._type===g.LAST_VIEWED},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"isRelatedProducts",{get:function(){return this._type===g.RELATED_PRODUCTS},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"isSearch",{get:function(){return this._type===g.SEARCH},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"hasPrev",{get:function(){return!(this.isStatic||this.isDiscounted||this.isRecommended||!this._minPage)&&this._minPage>1},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"hasNext",{get:function(){return!(this.isStatic||this.isDiscounted||this.isRecommended)&&this.page*this.limit<this.count},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"isLoading",{get:function(){return this._isLoading},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"filterQueryParams",{get:function(){var t,e,i,s,n=this,a={};if(null===(t=this.filters)||void 0===t||t.forEach((function(t){t.keyList.length&&(a[t.key]=t.keyList)})),this._searchKeyword&&(a.s=this._searchKeyword),this._infiniteScrollPage&&(a.page=this._infiniteScrollPage),this._pageType!==r.CATEGORY){var o=null===(e=this.filterCategories)||void 0===e?void 0:e.filter((function(t){return t.isSelected}));if(!!(null==o?void 0:o.length))a.c=null==o?void 0:o.map((function(t){return t.slug}));else if(this._filterCategoryId){var u=null===(s=null===(i=this.filterCategories)||void 0===i?void 0:i.find((function(t){return t.id===n._filterCategoryId})))||void 0===s?void 0:s.slug;u&&(a.c=u)}}return l.stringify(a,{arrayFormat:"comma"})},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"filterCategories",{get:function(){var t;return null===(t=this._filterCategories)||void 0===t?void 0:t.filter((function(t){return 0!==t.resultCount}))},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"hasAppliedfilter",{get:function(){var t;return!!this._searchKeyword||(null===(t=this.filters)||void 0===t?void 0:t.some((function(t){return!!t.valueList.length})))},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"isFeaturedSortEnabled",{get:function(){var t;return(null===(t=this.pageSpecificData)||void 0===t?void 0:t.orderType)===a.MANUALLY&&[g.ALL,g.CATEGORY].includes(this._type)},enumerable:!1,configurable:!0}),y.prototype.setPageSpecificSort=function(){var t;if((null===(t=this.pageSpecificData)||void 0===t?void 0:t.orderType)&&[g.ALL,g.CATEGORY].includes(this._type))switch(this.pageSpecificData.orderType){case a.HIGHEST_DISCOUNT_RATIO:this._sort=_.DECRASING_DISCOUNT;break;case a.LOWEST_DISCOUNT_RATIO:this._sort=_.INCREASING_DISCOUNT;break;case a.HIGHEST_PRICE:this._sort=_.DECREASING_PRICE;break;case a.LOWEST_PRICE:this._sort=_.INCREASING_PRICE;break;case a.NEWEST:this._sort=_.LAST_ADDED;break;case a.OLDEST:this._sort=_.FIRST_ADDED;break;case a.MANUALLY:this._sort=_.FEATURED}},y.prototype.getSortParams=function(){var t=f.DESC,e=m.CREATED_AT;switch(this._sort){case _.INCREASING_PRICE:t=f.ASC,e=m.PRICE;break;case _.DECREASING_PRICE:t=f.DESC,e=m.PRICE;break;case _.FIRST_ADDED:t=f.ASC,e=m.CREATED_AT;break;case _.LAST_ADDED:t=f.DESC,e=m.CREATED_AT;break;case _.INCREASING_DISCOUNT:t=f.ASC,e=m.DISCOUNT_RATIO;break;case _.DECRASING_DISCOUNT:t=f.DESC,e=m.DISCOUNT_RATIO;break;case _.FEATURED:if(this.isSearch)return;t=f.ASC,e=m.MANUAL_SORT}return{direction:t,type:e}},y.prototype.searchProducts=function(i,s,a){var o,u,l;return t(this,void 0,void 0,(function(){var t,d,p,f;return e(this,(function(e){switch(e.label){case 0:return t=[],d=[],null===(o=this.filters)||void 0===o||o.forEach((function(e){e.valueList.length&&t.push(new c({id:e.id,type:e.type,displayType:e.displayType,valueList:e.valueList})),e.isFacetFilter&&d.push({id:e.id,type:e.type,displayType:e.displayType})})),p=null===(u=this._filterCategories)||void 0===u?void 0:u.filter((function(t){return t.isSelected})).map((function(t){return t.id})),f=this.getSortParams(),this.isRelatedProducts&&this._relatedProductData?[4,n.getRelatedProducts({priceListId:h.priceListId,salesChannelId:h.salesChannelId,productId:this._relatedProductData.productId,brandIds:this._relatedProductData.brandIds,categoryIds:this._relatedProductData.categoryIds})]:[3,2];case 1:case 3:return[2,e.sent()];case 2:return[4,n.searchProducts({page:i,perPage:s,productIdList:this.isStatic?null===(l=this._productListPropValue.productIds)||void 0===l?void 0:l.map((function(t){return t.productId})):a,filterList:t,facetList:d,brandId:this._pageType===r.BRAND&&this._type!==g.SEARCH?this._filterBrandId:void 0,categoryIdList:p&&p.length?p:this._filterCategoryId?[this._filterCategoryId]:void 0,priceListId:h.priceListId,salesChannelId:h.salesChannelId,query:this._searchKeyword,order:this._type===g.SEARCH?null:f?[f]:null},!0)]}}))}))},y.prototype.getFilters=function(){var i;return t(this,void 0,void 0,(function(){var t,s,a=this;return e(this,(function(e){switch(e.label){case 0:return[4,n.getProductFilterData(this._filterCategoryId?this._filterCategoryId:void 0)];case 1:return t=e.sent(),this.filters=null==t?void 0:t.filters.map((function(t){return new u(t,a)})),this._filterCategories=null==t?void 0:t.categories,this.pageType!==r.CATEGORY&&this._filterCategoryId&&(s=null===(i=this._filterCategories)||void 0===i?void 0:i.find((function(t){return t.id===a._filterCategoryId})))&&(s._isSelected=!0),this.filters&&this.filters.sort((function(t,e){return t.order>e.order?1:-1})),[2]}}))}))},y.prototype.applyQueryParamFilters=function(t){var e,i=this;try{null==t||t.forEach((function(t,e){var r,s=null===(r=i.filters)||void 0===r?void 0:r.find((function(t){return t.key===e}));s&&s.applyQueryParam(t)}));var s=null==t?void 0:t.get("s");if(s&&(this._searchKeyword=s),this._pageType!==r.CATEGORY){var n=null==t?void 0:t.get("c"),a=null==n?void 0:n.split(",");a&&a.length&&(null===(e=this.filterCategories)||void 0===e||e.forEach((function(t){t._isSelected=a.some((function(e){return e===t.slug}))})))}}catch(t){console.log(t)}},y.prototype.applyFacets=function(t){var e,i;null===(e=this.filters)||void 0===e||e.forEach((function(e){var i,r,s,n=null==t?void 0:t.find((function(t){return t.id===e.id}));n?null===(i=e.values)||void 0===i||i.forEach((function(t){var i=n.values.find((function(e){return e.id===t.id}));i?t.resultCount=i.count:e.isCustomValueFilter?t.resultCount=null:t.resultCount=0})):e.isCustomValueFilter?null===(r=e.values)||void 0===r||r.forEach((function(t){return t.resultCount=null})):null===(s=e.values)||void 0===s||s.forEach((function(t){return t.resultCount=0}))}));var r=null==t?void 0:t.find((function(t){return"category"===t.id}));r&&(null===(i=this._filterCategories)||void 0===i||i.forEach((function(t){var e=r.values.find((function(e){return e.id===t.id}));t.resultCount=e?e.count:0})))},y.prototype.clearFilters=function(){var t,e;null===(t=this.filters)||void 0===t||t.forEach((function(t){return t.clear()})),this._searchKeyword="",this._pageType!==r.CATEGORY&&(this._filterCategoryId=void 0),null===(e=this._filterCategories)||void 0===e||e.forEach((function(t){return t._isSelected=!1})),this.applyFilters()},y.prototype.setSortType=function(i){return t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return this._sort=i,[4,this.getInitial()];case 1:return t.sent(),[2]}}))}))},y.prototype.onFilterCategoryClick=function(i,r){var s,n;return void 0===r&&(r=!1),t(this,void 0,void 0,(function(){return e(this,(function(t){switch(t.label){case 0:return r?(null===(s=this._filterCategories)||void 0===s||s.forEach((function(t){t.id===i.id&&(t._isSelected=!t.isSelected)})),[4,this.applyFilters()]):[3,2];case 1:return t.sent(),[3,3];case 2:h.isEditor||null===(n=this.router)||void 0===n||n.push(i.href+(this.filterQueryParams?"?"+this.filterQueryParams:"")),t.label=3;case 3:return[2]}}))}))},y.prototype.toJSON=function(){return{data:this.data,type:this._type,pageType:this._pageType,sort:this._sort,limit:this._limit,page:this._page,count:this._count,searchKeyword:this._searchKeyword,initialized:this._initialized,minPage:this._minPage,filterBrandId:this._filterBrandId,filterCategoryId:this._filterCategoryId,filterCategories:this._filterCategories,filters:this.filters,recommendFor:this._recommendFor,productListPropValue:this._productListPropValue,pageSpecificData:this.pageSpecificData}},y.prototype.restoreInfiniteScrollPage=function(){var t=this.getQueryParams(),e=null==t?void 0:t.get("page");if(e){var i=parseInt(e);isNaN(i)||(this._page=i,this._infiniteScrollPage=i)}},y.prototype.getQueryParams=function(){if(this.isBrowser())return new URLSearchParams(location.search)},y.prototype.isBrowser=function(){return"undefined"!=typeof window},y.prototype.waitForCustomerStoreInit=function(){return new Promise((function(t){var e=setInterval((function(){h.store.customerStore.initialized&&(clearInterval(e),t(null))}),1e3)}))},y.prototype.handleListingEvent=function(){this.searchKeyword&&this.data.length?p.viewSearchResults(this._searchKeyword,this.data):this.data.length&&this._type===g.ALL&&p.viewListing(this.data)},y}();!function(t){t.ALL="ALL",t.STATIC="STATIC",t.DISCOUNTED="DISCOUNTED",t.RECOMMENDED="RECOMMENDED",t.CATEGORY="CATEGORY",t.SEARCH="SEARCH",t.LAST_VIEWED="LAST_VIEWED",t.RELATED_PRODUCTS="RELATED_PRODUCTS"}(g||(g={})),function(t){t.INCREASING_PRICE="INCREASING_PRICE",t.DECREASING_PRICE="DECREASING_PRICE",t.LAST_ADDED="LAST_ADDED",t.FIRST_ADDED="FIRST_ADDED",t.INCREASING_DISCOUNT="INCREASING_DISCOUNT",t.DECRASING_DISCOUNT="DECRASING_DISCOUNT",t.FEATURED="FEATURED"}(_||(_={})),function(t){t.CATEGORY="CATEGORY",t.BRAND="BRAND"}(y||(y={}));export{v as IkasProductList,_ as IkasProductListSortType,g as IkasProductListType,y as IkasRelatedProductsType};
|