@ikas/storefront 6.1.0-beta.200 → 6.1.0-beta.201

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,__assign as i}from'./../../../ext/tslib/tslib.es6.js';import{makeAutoObservable as r}from"mobx";import s from"lodash/debounce";import"../../data/blog/category/index.js";import"../../data/blog/content/index.js";import"../../data/blog/meta-data/index.js";import"../../data/blog/tag/index.js";import"../../data/blog/index.js";import"../../data/brand/index.js";import{IkasThemeJsonPageType as o,IkasCategoryProductsOrderType as a,IkasThemeJsonStockPreference as n,IkasProductFilterType as d,IkasProductFilterDisplayType as u}from"@ikas/storefront-models";import"../../data/campaign-offer/index.js";import"../../data/cart/campaign-offer/index.js";import"../../data/cart/index.js";import"../../data/category/path-item/index.js";import"../../data/category/index.js";import"../../data/checkout/index.js";import"../../data/checkout-settings/index.js";import"../../data/city/index.js";import"../../data/country/index.js";import"../../data/customer/address/region/index.js";import"../../data/customer/address/index.js";import"../../data/customer/address/ikas-localized-customer-address.js";import"../../data/customer/attribute/index.js";import"../../data/customer/review/summary/index.js";import"../../data/customer/review/index.js";import"../../data/customer/index.js";import"../../data/customer-form-data-input/index.js";import"../../data/district/index.js";import"../../data/favorite-product/index.js";import{IkasFilterCategory as c}from"../../data/filter-category/index.js";import"../../data/html-meta-data/index.js";import"../../data/image/index.js";import"../../data/order/address/region/index.js";import"../../data/order/address/index.js";import"../../data/order/line-item/option/value/index.js";import"../../data/order/line-item/variant/value/index.js";import"../../data/order/line-item/variant/index.js";import"../../data/order/line-item/index.js";import"../../data/order/order-transaction-with-prices/index.js";import"../../data/order/package/index.js";import"../../data/order/transaction/index.js";import"../../data/order/index.js";import"../../data/payment-gateway/index.js";import"../../data/product/attribute-value/index.js";import{IkasProductFilter as l,IkasProductFilterValue as p}from"../../data/product/filter/index.js";import"../../data/product/campaign-offer/index.js";import"../../data/product/option-set/option/index.js";import"../../data/product/option-set/index.js";import"../../data/product/stock-location/index.js";import"../../data/product/variant/price/index.js";import"../../data/product/variant/index.js";import"../../data/variant-type/index.js";import{IkasProduct as h}from"../../data/product/index.js";import"../../data/raffle/index.js";import"../../data/shipping-zone/state/city/district/region/index.js";import"../../data/state/index.js";import"../../data/storefront-popup/storefront-popup-display-filter/index.js";import"../../data/storefront-popup/storefront-popup-display-settings/index.js";import"../../data/storefront-popup/storefront-popup-page-filter/index.js";import"../../data/storefront-popup/index.js";import"../../data/theme-json/index.js";import"../../data/theme-json/component/index.js";import"../../data/theme-json/custom-data/index.js";import"../../data/variant-type/variant-value/index.js";import"@ikas/localized-address";import g from"../../../store/product/index.js";import f from"query-string";import{SortByDirectionEnum as m,SortByTypeEnum as _,GetSuggestedProductsMethodEnum as y}from"@ikas/storefront-api";import{IkasStorefrontConfig as v}from"@ikas/storefront-config";import{Analytics as I}from"../../../analytics/analytics.js";import"../../../analytics/head/index.js";import"../../../components/page/index.js";import"../../../components/page/head.js";import"react";import"next/image.js";import{stringToSlug as E,IkasProductVariantFunctions as S}from"@ikas/storefront-model-functions";import"../../../components/link/index.js";import"../../../components/page-editor/loader/style.module.scss.js";import"../../../components/google-captcha/index.js";import"../../../components/paypal-express-checkout/index.js";import"../blog-list/index.js";import"../blog-category-list/index.js";import"../brand-list/index.js";import"../category-list/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/ikas-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"../../../pages/home.js";import"../../../pages/_slug_/index.js";import"../../../pages/pages/_slug_.js";import"../../../pages/checkout.js";import"../../../pages/account/index.js";import"../../../pages/account/addresses.js";import"../../../pages/account/orders/index.js";import"../../../pages/account/orders/_id_.js";import"../../../pages/account/login.js";import"../../../pages/account/register.js";import"../../../pages/account/forgot-password.js";import"../../../pages/account/recover-password.js";import"../../../pages/cart.js";import"../../../pages/editor.js";import"../../../pages/account/favorite-products.js";import"../../../pages/search.js";import"next/error.js";import"../../../pages/blog/index.js";import"../../../pages/blog/_slug_.js";import"../../../pages/raffle/_slug_.js";import"../../../pages/raffle/index.js";import"../../../pages/account/raffles.js";import"../../../pages/account/activate.js";import{IkasBaseStore as C}from"../../../store/base.js";import"../../../store/customer/index.js";import"../../../store/cart/index.js";import"lodash/get";var b,P,T,D,A,j=function(){function b(a,n){var d=this;this.filters=null,this._filterCategories=null,this._infiniteScrollPage=null,this._enableSuggestions=null,this._baseCategoryIdList=null,this._initialized=!1,this._minPage=null,this._filterBrandId=null,this._filterCategoryId=null,this._relatedProductData=null,this._recommendedProductData=null,this._viewedTogetherProductData=null,this.pageSpecificData=null,this._recommendFor=null,this._isLoading=!1,this._fetchRequestTime=0,this.router=null,this._excludedFields=null,this._isFacetListNotSent=!1,this._disabledSortTypes=null,this._suggestions=null,this._suggestionCategoryId=null,this.applyFilters=function(){return t(d,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return[4,this.getInitial()];case 1:return t=e.sent(),[o.CATEGORY,o.BRAND,o.SEARCH].includes(this._pageType)?(t&&this.setQueryParams(),[2]):[2]}}))}))},this.getSelectedVariant=function(t){return t.variants[0]},this.getInitial=function(r,s){return t(d,void 0,void 0,(function(){var t,o,a,n,d,u,c,l,p,g,f,m,_,y,v,I,E=this;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,14,15,16]),o=s?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(r),this.isSearch&&!this.hasAppliedfilter?(this.data=[],this._page=1,this._minPage=1,this._count=0,this._initialized=!0,[2,!0]):(n=void 0,d=!1,this.isStatic?(o=void 0,a=200,[3,10]):[3,4]);case 4:return this.isDiscounted?(o=1,a=10,[3,10]):[3,5];case 5:return this.isRecommended?(o=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,C.getInstance().customerStore.getLastViewedProducts()];case 8:return(u=e.sent())&&u.length?(n=u.map((function(t){return t.productId})),d=C.getInstance().customerStore.useLastViewedProductResponse,[3,10]):[2];case 9:return[2];case 10:return d?(l=C.getInstance().customerStore._savedLastViewedProductsResponse,[3,13]):[3,11];case 11:return[4,this.searchProducts(o||1,a||10,n)];case 12:l=e.sent(),e.label=13;case 13:return(c=l)&&this._fetchRequestTime===t?(p=[],!d&&this.isLastViewed&&C.getInstance().customerStore.setSavedLastViewedProductsResponse(c),this.isStatic||this.isLastViewed?(g=this.isStatic?this._productListPropValue.productIds:C.getInstance().customerStore._lastViewedProducts,p=(null==g?void 0:g.map((function(t){var e,r,s=null===(r=null===(e=c.data)||void 0===e?void 0:e.data)||void 0===r?void 0:r.find((function(e){return e.id===t.productId})),o=null==s?void 0:s.variants.find((function(e){return e.id===t.variantId}));if((null==o?void 0:o.isActive)&&S.hasStock(o)||(o=null==s?void 0:s.variants.find((function(t){return t.isActive&&S.hasStock(t)}))),s&&o)return new h(i(i({},s),{selectedVariantValues:o.variantValues}))})).filter((function(t){return!!t})))||[]):p=(null===(_=null===(m=c.data)||void 0===m?void 0:m.data)||void 0===_?void 0:_.map((function(t){var e=E.getSelectedVariant(t);return new h(i(i({},t),{selectedVariantValues:e.variantValues}))})))||[],this.applyFacets(null===(y=c.data)||void 0===y?void 0:y.facets),this.data=p,this._count=(null===(v=c.data)||void 0===v?void 0:v.count)||0,this._initialized=!0,this._page=o||1,this._minPage=this.page,this._suggestions=null===(I=c.data)||void 0===I?void 0:I.suggestions,this.setIsFilteredForProducts(),this.setIsStaticForProducts(),s||(this._infiniteScrollPage=null),this.handleListingEvent(),[2,!0]):[2];case 14:return f=e.sent(),console.log(f),[3,16];case 15:return t===this._fetchRequestTime&&(this._isLoading=!1),[7];case 16:return[2]}}))}))},this.getPrev=function(){return t(d,void 0,void 0,(function(){var t,r,s,o,a,n,d,u=this;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(r=e.sent())?(s=null===(n=null===(a=r.data)||void 0===a?void 0:a.data)||void 0===n?void 0:n.map((function(t){var e=u.getSelectedVariant(t);return new h(i(i({},t),{selectedVariantValues:e.variantValues}))})),this.data=(null==s?void 0:s.concat(this.data))||this.data,this._count=(null===(d=r.data)||void 0===d?void 0:d.count)||this._count,this._minPage=t,this.setIsFilteredForProducts(),this.setIsStaticForProducts(),[3,5]):[2];case 3:return o=e.sent(),console.log(o),[3,5];case 4:return this._isLoading=!1,[7];case 5:return[2]}}))}))},this.getNext=function(){return t(d,void 0,void 0,(function(){var t,r,s,o,a,n,d=this;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())?(r=null===(a=null===(o=t.data)||void 0===o?void 0:o.data)||void 0===a?void 0:a.map((function(t){var e=d.getSelectedVariant(t);return new h(i(i({},t),{selectedVariantValues:e.variantValues}))})),this.data=this.data.concat(r||[]),this._count=(null===(n=t.data)||void 0===n?void 0:n.count)||this._count,this._page=this.page+1,this.setIsFilteredForProducts(),this.setIsStaticForProducts(),[3,5]):[2];case 3:return s=e.sent(),console.log(s),[3,5];case 4:return this._isLoading=!1,[7];case 5:return[2]}}))}))},this.getPage=function(r){return t(d,void 0,void 0,(function(){var t,s,o,a,n,d,u=this;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(r,this.limit)];case 2:return(t=e.sent())?(s=null===(n=null===(a=t.data)||void 0===a?void 0:a.data)||void 0===n?void 0:n.map((function(t){var e=u.getSelectedVariant(t);return new h(i(i({},t),{selectedVariantValues:e.variantValues}))})),this.data=s||[],this._count=(null===(d=t.data)||void 0===d?void 0:d.count)||0,this._page=r,this._minPage=r,this.setIsFilteredForProducts(),this.setIsStaticForProducts(),[3,5]):[2];case 3:return o=e.sent(),console.log(o),[3,5];case 4:return this._isLoading=!1,[7];case 5:return[2]}}))}))},this.setVisibleInfiniteScrollPage=function(t){var e;d._infiniteScrollPage!==t&&(d._infiniteScrollPage=t,v.getIsEditor()||null===(e=d.router)||void 0===e||e.replace("".concat(location.pathname).concat(d.queryParams?"?"+d.queryParams:""),void 0,{shallow:!0}))},this.searchDebouncer=s((function(){d.applyFilters()}),500),this.searchAnalyticsDebouncer=s((function(){I.search(d._searchKeyword,d.data.length)}),1e3);var u=a,p=a;if(this.data=a.data?a.data.map((function(t){return new h(t)})):[],this._type=u.type||p._type||u.productListPropValue.productListType||p._productListPropValue.productListType||P.ALL,this._pageType=a.pageType,this._sort=a.sort||a.productListPropValue.initialSort||T.LAST_ADDED,this._limit=a.limit||u.productListPropValue.initialLimit||p._productListPropValue.initialLimit||20,this._page=a.page||1,this._minPage=a.minPage||null,this._count=a.count||0,this._searchKeyword=a.searchKeyword||"",this._productListPropValue=u.productListPropValue||p._productListPropValue,this._filterBrandId=u.filterBrandId||p._filterBrandId||null,this._filterCategoryId=u.filterCategoryId||p._filterCategoryId||null,this._relatedProductData=u.relatedProductData||p._relatedProductData||null,this._recommendedProductData=u.recommendedProductData||p._recommendedProductData||null,this._viewedTogetherProductData=u.viewedTogetherProductData||p._viewedTogetherProductData||null,this._excludedFields=u.excludedFields||p._excludedFields||null,this._isFacetListNotSent=u.isFacetListNotSent||p._isFacetListNotSent||!1,this._disabledSortTypes=u.disabledSortTypes||p._disabledSortTypes||null,this._recommendFor=u.recommendFor||p._recommendFor,this.filters=a.filters?a.filters.map((function(t){return new l(t,d)})):null,this._filterCategories=a.filterCategories?a.filterCategories.map((function(t){return new c(t)})):null,this.pageSpecificData=u.pageSpecificData||p.pageSpecificData||null,this.router=n,r(this,{router:!1}),this.setPageSpecificSort(),this.setIsFilteredForProducts(),this.setIsStaticForProducts(),this.isBrowser())if(this.restoreInfiniteScrollPage(),location.search&&(this.isFilterable||this._type===P.SEARCH)){var g=this.pageType===o.PRODUCT?void 0:this.getQueryParams();this.getInitial(g,this._page>1)}else this._page>1?this.getInitial(void 0,!0):this.isLastViewed?this.getInitial():this.handleListingEvent()}return Object.defineProperty(b.prototype,"sort",{get:function(){return this._sort},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"limit",{get:function(){return this._limit},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"pageType",{get:function(){return this._pageType},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"page",{get:function(){return this._page},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"minPage",{get:function(){return this._minPage||1},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"baseCategoryIdList",{get:function(){return this._baseCategoryIdList},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"count",{get:function(){return this._count},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"pageCount",{get:function(){return Math.ceil(this._count/this._limit)},enumerable:!1,configurable:!0}),Object.defineProperty(b.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(b.prototype,"enableSuggestions",{get:function(){return this._enableSuggestions},set:function(t){this._enableSuggestions=t},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"suggestions",{get:function(){return this._suggestions},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"suggestionCategoryId",{get:function(){return this._suggestionCategoryId},set:function(t){this._suggestionCategoryId=t},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"isInitialized",{get:function(){return this._initialized},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"isFilterable",{get:function(){return this._type===P.ALL||this._type===P.CATEGORY},enumerable:!1,configurable:!0}),Object.defineProperty(b.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!==o.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(b.prototype,"isStatic",{get:function(){return this._type===P.STATIC},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"isDiscounted",{get:function(){return this._type===P.DISCOUNTED},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"isRecommended",{get:function(){return this._type===P.RECOMMENDED},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"isLastViewed",{get:function(){return this._type===P.LAST_VIEWED},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"isRelatedProducts",{get:function(){return this._type===P.RELATED_PRODUCTS},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"isRecommendedProducts",{get:function(){return this._type===P.RECOMMENDED_PRODUCTS},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"isViewedTogetherProducts",{get:function(){return this._type===P.VIEWED_TOGETHER},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"isSearch",{get:function(){return this._type===P.SEARCH},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"hasPrev",{get:function(){return!(this.isStatic||this.isDiscounted||this.isRecommended||!this._minPage)&&this._minPage>1},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"hasNext",{get:function(){return!(this.isStatic||this.isDiscounted||this.isRecommended)&&this.page*this.limit<this.count},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"isLoading",{get:function(){return this._isLoading},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"queryParams",{get:function(){var t,e,i,r,s=this,a={};if(null===(t=this.filters)||void 0===t||t.forEach((function(t){t.keyList.length&&(a[E(t.name)]=t.isDiscountStatusFilter?t.keyList.map((function(e){return t.discountStatusMapping[e]})):t.keyList)})),this._searchKeyword&&(a.s=encodeURIComponent(this._searchKeyword)),this._sort&&(a.o=R[this._sort]),this._baseCategoryIdList&&(a.bc=this._baseCategoryIdList),this._suggestionCategoryId&&(a.suggestionCategoryId=this._suggestionCategoryId),this._infiniteScrollPage&&(a.page=this._infiniteScrollPage),this._pageType!==o.CATEGORY){var n=null===(e=this.filterCategories)||void 0===e?void 0:e.filter((function(t){return t.isSelected}));if(!!(null==n?void 0:n.length))a.c=null==n?void 0:n.map((function(t){return t.slug}));else if(this._filterCategoryId){var d=null===(r=null===(i=this.filterCategories)||void 0===i?void 0:i.find((function(t){return t.id===s._filterCategoryId})))||void 0===r?void 0:r.slug;d&&(a.c=d)}}return f.stringify(a,{arrayFormat:"comma",encode:!1})},enumerable:!1,configurable:!0}),Object.defineProperty(b.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(b.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(b.prototype,"isFeaturedSortEnabled",{get:function(){var t;return(null===(t=this.pageSpecificData)||void 0===t?void 0:t.orderType)===a.MANUALLY&&[P.ALL,P.CATEGORY].includes(this._type)},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"disabledSortTypes",{get:function(){return this._disabledSortTypes},enumerable:!1,configurable:!0}),b.prototype.setIsFilteredForProducts=function(){var t=this;this.data.forEach((function(e){return e.isFiltered=t.isFiltered||!1}))},b.prototype.setIsStaticForProducts=function(){var t=this;this.data.forEach((function(e){return e.isStatic=t.isStatic||!1}))},b.prototype.setPageSpecificSort=function(){var t;if((null===(t=this.pageSpecificData)||void 0===t?void 0:t.orderType)&&[P.ALL].includes(this._type))switch(this.pageSpecificData.orderType){case a.HIGHEST_DISCOUNT_RATIO:this._sort=T.DECRASING_DISCOUNT;break;case a.LOWEST_DISCOUNT_RATIO:this._sort=T.INCREASING_DISCOUNT;break;case a.HIGHEST_PRICE:this._sort=T.DECREASING_PRICE;break;case a.LOWEST_PRICE:this._sort=T.INCREASING_PRICE;break;case a.NEWEST:this._sort=T.LAST_ADDED;break;case a.OLDEST:this._sort=T.FIRST_ADDED;break;case a.MANUALLY:this._sort=T.FEATURED}},b.prototype.getSortParams=function(){var t,e;switch(this._sort){case T.INCREASING_PRICE:t=m.ASC,e=_.PRICE;break;case T.DECREASING_PRICE:t=m.DESC,e=_.PRICE;break;case T.FIRST_ADDED:t=m.ASC,e=_.CREATED_AT;break;case T.LAST_ADDED:t=m.DESC,e=_.CREATED_AT;break;case T.INCREASING_DISCOUNT:t=m.ASC,e=_.DISCOUNT_RATIO;break;case T.DECRASING_DISCOUNT:t=m.DESC,e=_.DISCOUNT_RATIO;break;case T.FEATURED:if(this.isSearch)return;t=m.ASC,e=_.MANUAL_SORT;break;case T.DEFAULT:t=void 0,e=void 0;break;case T.AVERAGE_RATING:t=m.DESC,e=_.AVERAGE_RATING;break;case T.REVIEW_COUNT:t=m.DESC,e=_.REVIEW_COUNT;break;case T.SALE_COUNT:t=m.DESC,e=_.SALE_COUNT;break;case T.A_Z:t=m.ASC,e=_.NAME;break;case T.Z_A:t=m.DESC,e=_.NAME}if(t&&e)return{direction:t,type:e}},b.prototype.searchProducts=function(r,s,a){var c,l,h,f,m,_;return t(this,void 0,void 0,(function(){var t,I,E,S,C,b,T,D,A,j,R=this;return e(this,(function(e){switch(e.label){case 0:return t=[],I=[],null===(c=this.filters)||void 0===c||c.forEach((function(e){e.valueList.length&&t.push(new p({id:e.id,type:e.type,displayType:e.displayType,valueList:e.isDiscountStatusFilter?e.valueList.map((function(t){return e.discountStatusMapping[t]})):e.valueList})),e.isFacetFilter&&!R._isFacetListNotSent&&I.push({id:e.id,type:e.type,displayType:e.displayType})})),(E=null===(l=new URLSearchParams(location.search))||void 0===l?void 0:l.get("suggestion"))&&(S=JSON.parse(decodeURIComponent(E)),(C=S.brandId)&&((b=null===(h=this.filters)||void 0===h?void 0:h.find((function(t){return"brand"===t.id&&t.type===d.BRAND})))&&(T=null===(f=b.values)||void 0===f?void 0:f.find((function(t){return t.id===C})))&&b.applyQueryParam(T.name),t.push(new p({id:"brand",type:d.BRAND,displayType:u.BOX,valueList:[C]}))),S.categoryId&&(this._filterCategoryId=S.categoryId),this._searchKeyword=""),D=null===(m=this._filterCategories)||void 0===m?void 0:m.filter((function(t){return t.isSelected})).map((function(t){return t.id})),A=this.getSortParams(),this.isRelatedProducts&&this._relatedProductData?[4,g.getSuggestedProducts({priceListId:v.getPriceListId(),salesChannelId:v.getSalesChannelId(),productId:this._relatedProductData.productId,brandIds:this._relatedProductData.brandIds,categoryIds:this._relatedProductData.categoryIds,locale:v.getCurrentLocale()})]:[3,2];case 1:case 3:case 5:case 7:return[2,e.sent()];case 2:return this.isRecommendedProducts&&this._recommendedProductData?[4,g.getSuggestedProducts({priceListId:v.getPriceListId(),salesChannelId:v.getSalesChannelId(),brandIds:this._recommendedProductData.brandIds,categoryIds:this._recommendedProductData.categoryIds,locale:v.getCurrentLocale()})]:[3,4];case 4:return this.isViewedTogetherProducts&&this._viewedTogetherProductData?[4,g.getSuggestedProducts({priceListId:v.getPriceListId(),salesChannelId:v.getSalesChannelId(),method:y.VIEWED_TOGETHER,productIds:this._viewedTogetherProductData.productIds,locale:v.getCurrentLocale()})]:[3,6];case 6:return j={input:i(i(i(i({page:r,perPage:s},this.enableSuggestions?{enableSuggestions:this.enableSuggestions}:{}),{productIdList:this.isStatic?null===(_=this._productListPropValue.productIds)||void 0===_?void 0:_.map((function(t){return t.productId})):a,filterList:t,facetList:I}),this.baseCategoryIdList?{baseCategoryIdList:this.baseCategoryIdList}:{}),{brandId:this._pageType===o.BRAND&&this._type!==P.SEARCH?this._filterBrandId:void 0,categoryIdList:D&&D.length?D:this._filterCategoryId?[this._filterCategoryId]:void 0,priceListId:v.getPriceListId(),salesChannelId:v.getSalesChannelId(),query:this._searchKeyword,order:A?[A]:[],showStockOption:v.getStockPreference()||n.SHOW_ALL})},[4,g.searchProducts(j,this._excludedFields)]}}))}))},b.prototype.getFilters=function(){var i,r,s,a;return t(this,void 0,void 0,(function(){var t,n,d=this;return e(this,(function(e){switch(e.label){case 0:return[4,g.getProductFilterData({categoryId:this._filterCategoryId?this._filterCategoryId:void 0,locale:v.getCurrentLocale()})];case 1:return t=e.sent(),this.filters=null===(i=null==t?void 0:t.data)||void 0===i?void 0:i.filters.map((function(t){return new l(t,d)})),this._filterCategories=null===(r=null==t?void 0:t.data)||void 0===r?void 0:r.categories,this._disabledSortTypes=null===(s=t.data)||void 0===s?void 0:s.disabledSortTypes,this.pageType!==o.CATEGORY&&this._filterCategoryId&&(n=null===(a=this._filterCategories)||void 0===a?void 0:a.find((function(t){return t.id===d._filterCategoryId})))&&(n.isSelected=!0),this.filters&&this.filters.sort((function(t,e){return t.order>e.order?1:-1})),[2]}}))}))},b.prototype.applyQueryParamFilters=function(t){var e,i,r=this;try{null==t||t.forEach((function(t,e){var i,s=null===(i=r.filters)||void 0===i?void 0:i.find((function(t){return t.key===e||t.name===e||E(t.name)===E(e)}));s&&s.applyQueryParam(t)}));var s=null==t?void 0:t.get("s");s&&(this._searchKeyword=s);var a=null==t?void 0:t.get("o");if(a){var n=parseInt(a),d=Object.entries(R).find((function(t){return t[1]===n}));d&&(this._sort=d[0])}if(this._pageType!==o.CATEGORY){var u=null==t?void 0:t.get("c"),c=null==u?void 0:u.split(",");c&&c.length&&(null===(e=this.filterCategories)||void 0===e||e.forEach((function(t){t.isSelected=c.some((function(e){return e===t.slug}))})))}if(this._pageType===o.SEARCH){var l=null==t?void 0:t.get("bc"),p=null==l?void 0:l.split(",");p&&(this._baseCategoryIdList=p);var h=null===(i=new URLSearchParams(location.search))||void 0===i?void 0:i.get("suggestion");if(h){var g=JSON.parse(decodeURIComponent(h)).categoryId;g&&(this.suggestionCategoryId=g)}var f=null==t?void 0:t.get("suggestionCategoryId");f&&(this.suggestionCategoryId=f,this._filterCategoryId=f,this._searchKeyword="")}}catch(t){console.log(t)}},b.prototype.applyFacets=function(t){var e,i;null===(e=this.filters)||void 0===e||e.forEach((function(e){var i,r,s,o=null==t?void 0:t.find((function(t){return t.id===e.id}));o?null===(i=e.values)||void 0===i||i.forEach((function(t){var i=e.isDiscountStatusFilter?e.discountStatusMapping[t.id]:t.id,r=o.values.find((function(t){return t.id===i}));r?t.resultCount=r.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})))},b.prototype.setQueryParams=function(){var t;!this.isBrowser()||this.isSearch||v.getIsEditor()||null===(t=this.router)||void 0===t||t.replace("".concat(location.pathname).concat(this.queryParams?"?"+this.queryParams:""),void 0,{shallow:!0})},b.prototype.clearFilters=function(){var t,e;null===(t=this.filters)||void 0===t||t.forEach((function(t){return t.clear()})),this._searchKeyword="",this._pageType!==o.CATEGORY&&(this._filterCategoryId=void 0),null===(e=this._filterCategories)||void 0===e||e.forEach((function(t){return t.isSelected=!1})),this.applyFilters()},b.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()&&this.setQueryParams(),[2]}}))}))},b.prototype.onFilterCategoryClick=function(i,r){var s,o;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:v.getIsEditor()||null===(o=C.getInstance().router)||void 0===o||o.push(i.href+(this.queryParams?"?"+this.queryParams:"")),t.label=3;case 3:return[2]}}))}))},b.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}},b.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)}},b.prototype.getQueryParams=function(){if(this.isBrowser())return new URLSearchParams(location.search)},b.prototype.isBrowser=function(){return"undefined"!=typeof window},b.prototype.waitForCustomerStoreInit=function(){return new Promise((function(t){var e=setInterval((function(){C.getInstance().customerStore.initialized&&(clearInterval(e),t(null))}),1e3)}))},b.prototype.handleListingEvent=function(){this.searchKeyword&&this.data.length?I.viewSearchResults(this._searchKeyword,this.data):this.data.length&&this._type===P.ALL&&I.viewListing(this.data)},b}();!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",t.VIEWED_TOGETHER="VIEWED_TOGETHER",t.RECOMMENDED_PRODUCTS="RECOMMENDED_PRODUCTS"}(P||(P={})),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",t.DEFAULT="DEFAULT",t.AVERAGE_RATING="AVERAGE_RATING",t.REVIEW_COUNT="REVIEW_COUNT",t.SALE_COUNT="SALE_COUNT",t.A_Z="A_Z",t.Z_A="Z_A"}(T||(T={})),function(t){t.AVERAGE_RATING="AVERAGE_RATING",t.CREATED_AT="CREATED_AT",t.DISCOUNT_RATIO="DISCOUNT_RATIO",t.MANUAL_SORT="MANUAL_SORT",t.NAME="NAME",t.PRICE="PRICE",t.REVIEW_COUNT="REVIEW_COUNT",t.SALE_COUNT="SALE_COUNT"}(D||(D={})),function(t){t.CATEGORY="CATEGORY",t.BRAND="BRAND"}(A||(A={}));var R=((b={})[T.INCREASING_PRICE]=1,b[T.DECREASING_PRICE]=2,b[T.LAST_ADDED]=3,b[T.FIRST_ADDED]=4,b[T.INCREASING_DISCOUNT]=5,b[T.DECRASING_DISCOUNT]=6,b[T.FEATURED]=7,b[T.DEFAULT]=8,b[T.AVERAGE_RATING]=9,b[T.REVIEW_COUNT]=10,b[T.SALE_COUNT]=11,b[T.A_Z]=12,b[T.Z_A]=13,b);export{j as IkasProductList,D as IkasProductListSortByTypeEnum,T as IkasProductListSortType,P as IkasProductListType,A as IkasRelatedProductsType};
1
+ import{__awaiter as t,__generator as e,__assign as i}from'./../../../ext/tslib/tslib.es6.js';import{makeAutoObservable as r}from"mobx";import s from"lodash/debounce";import"../../data/blog/category/index.js";import"../../data/blog/content/index.js";import"../../data/blog/meta-data/index.js";import"../../data/blog/tag/index.js";import"../../data/blog/index.js";import"../../data/brand/index.js";import{IkasThemeJsonPageType as o,IkasCategoryProductsOrderType as a,IkasThemeJsonStockPreference as n,IkasProductFilterType as d,IkasProductFilterDisplayType as u}from"@ikas/storefront-models";import"../../data/campaign-offer/index.js";import"../../data/cart/campaign-offer/index.js";import"../../data/cart/index.js";import"../../data/category/path-item/index.js";import"../../data/category/index.js";import"../../data/checkout/index.js";import"../../data/checkout-settings/index.js";import"../../data/city/index.js";import"../../data/country/index.js";import"../../data/customer/address/region/index.js";import"../../data/customer/address/index.js";import"../../data/customer/address/ikas-localized-customer-address.js";import"../../data/customer/attribute/index.js";import"../../data/customer/review/summary/index.js";import"../../data/customer/review/index.js";import"../../data/customer/index.js";import"../../data/customer-form-data-input/index.js";import"../../data/district/index.js";import"../../data/favorite-product/index.js";import{IkasFilterCategory as c}from"../../data/filter-category/index.js";import"../../data/html-meta-data/index.js";import"../../data/image/index.js";import"../../data/order/address/region/index.js";import"../../data/order/address/index.js";import"../../data/order/line-item/option/value/index.js";import"../../data/order/line-item/variant/value/index.js";import"../../data/order/line-item/variant/index.js";import"../../data/order/line-item/index.js";import"../../data/order/order-transaction-with-prices/index.js";import"../../data/order/package/index.js";import"../../data/order/transaction/index.js";import"../../data/order/index.js";import"../../data/payment-gateway/index.js";import"../../data/product/attribute-value/index.js";import{IkasProductFilter as l,IkasProductFilterValue as p}from"../../data/product/filter/index.js";import"../../data/product/campaign-offer/index.js";import"../../data/product/option-set/option/index.js";import"../../data/product/option-set/index.js";import"../../data/product/stock-location/index.js";import"../../data/product/variant/price/index.js";import"../../data/product/variant/index.js";import"../../data/variant-type/index.js";import{IkasProduct as h}from"../../data/product/index.js";import"../../data/raffle/index.js";import"../../data/shipping-zone/state/city/district/region/index.js";import"../../data/state/index.js";import"../../data/storefront-popup/storefront-popup-display-filter/index.js";import"../../data/storefront-popup/storefront-popup-display-settings/index.js";import"../../data/storefront-popup/storefront-popup-page-filter/index.js";import"../../data/storefront-popup/index.js";import"../../data/theme-json/index.js";import"../../data/theme-json/component/index.js";import"../../data/theme-json/custom-data/index.js";import"../../data/variant-type/variant-value/index.js";import"@ikas/localized-address";import g from"../../../store/product/index.js";import f from"query-string";import{SortByDirectionEnum as m,SortByTypeEnum as _,GetSuggestedProductsMethodEnum as y}from"@ikas/storefront-api";import{IkasStorefrontConfig as v}from"@ikas/storefront-config";import{Analytics as I}from"../../../analytics/analytics.js";import"../../../analytics/head/index.js";import"../../../components/page/index.js";import"../../../components/page/head.js";import"react";import"next/image.js";import{stringToSlug as E,IkasProductVariantFunctions as S}from"@ikas/storefront-model-functions";import"../../../components/link/index.js";import"../../../components/page-editor/loader/style.module.scss.js";import"../../../components/google-captcha/index.js";import"../../../components/paypal-express-checkout/index.js";import"../blog-list/index.js";import"../blog-category-list/index.js";import"../brand-list/index.js";import"../category-list/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/ikas-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"../../../pages/home.js";import"../../../pages/_slug_/index.js";import"../../../pages/pages/_slug_.js";import"../../../pages/checkout.js";import"../../../pages/account/index.js";import"../../../pages/account/addresses.js";import"../../../pages/account/orders/index.js";import"../../../pages/account/orders/_id_.js";import"../../../pages/account/login.js";import"../../../pages/account/register.js";import"../../../pages/account/forgot-password.js";import"../../../pages/account/recover-password.js";import"../../../pages/cart.js";import"../../../pages/editor.js";import"../../../pages/account/favorite-products.js";import"../../../pages/search.js";import"next/error.js";import"../../../pages/blog/index.js";import"../../../pages/blog/_slug_.js";import"../../../pages/raffle/_slug_.js";import"../../../pages/raffle/index.js";import"../../../pages/account/raffles.js";import"../../../pages/account/activate.js";import{IkasBaseStore as C}from"../../../store/base.js";import"../../../store/customer/index.js";import"../../../store/cart/index.js";import"lodash/get";var b,P,T,D,A,j=function(){function b(a,n){var d=this;this.filters=null,this._filterCategories=null,this._infiniteScrollPage=null,this._enableSuggestions=null,this._baseCategoryIdList=null,this._initialized=!1,this._minPage=null,this._filterBrandId=null,this._filterCategoryId=null,this._relatedProductData=null,this._recommendedProductData=null,this._viewedTogetherProductData=null,this.pageSpecificData=null,this._recommendFor=null,this._isLoading=!1,this._fetchRequestTime=0,this.router=null,this._excludedFields=null,this._isFacetListNotSent=!1,this._disabledSortTypes=null,this._suggestions=null,this._suggestionCategoryId=null,this.applyFilters=function(){return t(d,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return[4,this.getInitial()];case 1:return t=e.sent(),[o.CATEGORY,o.BRAND,o.SEARCH].includes(this._pageType)?(t&&this.setQueryParams(),[2]):[2]}}))}))},this.getSelectedVariant=function(t){return t.variants[0]},this.getInitial=function(r,s){return t(d,void 0,void 0,(function(){var t,o,a,n,d,u,c,l,p,g,f,m,_,y,v,I,E=this;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,14,15,16]),o=s?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(r),this.isSearch&&!this.hasAppliedfilter?(this.data=[],this._page=1,this._minPage=1,this._count=0,this._initialized=!0,[2,!0]):(n=void 0,d=!1,this.isStatic?(o=void 0,a=200,[3,10]):[3,4]);case 4:return this.isDiscounted?(o=1,a=10,[3,10]):[3,5];case 5:return this.isRecommended?(o=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,C.getInstance().customerStore.getLastViewedProducts()];case 8:return(u=e.sent())&&u.length?(n=u.map((function(t){return t.productId})),d=C.getInstance().customerStore.useLastViewedProductResponse,[3,10]):[2];case 9:return[2];case 10:return d?(l=C.getInstance().customerStore._savedLastViewedProductsResponse,[3,13]):[3,11];case 11:return[4,this.searchProducts(o||1,a||10,n)];case 12:l=e.sent(),e.label=13;case 13:return(c=l)&&this._fetchRequestTime===t?(p=[],!d&&this.isLastViewed&&C.getInstance().customerStore.setSavedLastViewedProductsResponse(c),this.isStatic||this.isLastViewed?(g=this.isStatic?this._productListPropValue.productIds:C.getInstance().customerStore._lastViewedProducts,p=(null==g?void 0:g.map((function(t){var e,r,s=null===(r=null===(e=c.data)||void 0===e?void 0:e.data)||void 0===r?void 0:r.find((function(e){return e.id===t.productId})),o=null==s?void 0:s.variants.find((function(e){return e.id===t.variantId}));if((null==o?void 0:o.isActive)&&S.hasStock(o)||(o=null==s?void 0:s.variants.find((function(t){return t.isActive&&S.hasStock(t)}))),s&&o)return new h(i(i({},s),{selectedVariantValues:o.variantValues}))})).filter((function(t){return!!t})))||[]):p=(null===(_=null===(m=c.data)||void 0===m?void 0:m.data)||void 0===_?void 0:_.map((function(t){var e=E.getSelectedVariant(t);return new h(i(i({},t),{selectedVariantValues:e.variantValues}))})))||[],this.applyFacets(null===(y=c.data)||void 0===y?void 0:y.facets),this.data=p,this._count=(null===(v=c.data)||void 0===v?void 0:v.count)||0,this._initialized=!0,this._page=o||1,this._minPage=this.page,this._suggestions=null===(I=c.data)||void 0===I?void 0:I.suggestions,this.setIsFilteredForProducts(),this.setIsStaticForProducts(),s||(this._infiniteScrollPage=null),this.handleListingEvent(),[2,!0]):[2];case 14:return f=e.sent(),console.log(f),[3,16];case 15:return t===this._fetchRequestTime&&(this._isLoading=!1),[7];case 16:return[2]}}))}))},this.getPrev=function(){return t(d,void 0,void 0,(function(){var t,r,s,o,a,n,d,u=this;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(r=e.sent())?(s=null===(n=null===(a=r.data)||void 0===a?void 0:a.data)||void 0===n?void 0:n.map((function(t){var e=u.getSelectedVariant(t);return new h(i(i({},t),{selectedVariantValues:e.variantValues}))})),this.data=(null==s?void 0:s.concat(this.data))||this.data,this._count=(null===(d=r.data)||void 0===d?void 0:d.count)||this._count,this._minPage=t,this.setIsFilteredForProducts(),this.setIsStaticForProducts(),[3,5]):[2];case 3:return o=e.sent(),console.log(o),[3,5];case 4:return this._isLoading=!1,[7];case 5:return[2]}}))}))},this.getNext=function(){return t(d,void 0,void 0,(function(){var t,r,s,o,a,n,d=this;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())?(r=null===(a=null===(o=t.data)||void 0===o?void 0:o.data)||void 0===a?void 0:a.map((function(t){var e=d.getSelectedVariant(t);return new h(i(i({},t),{selectedVariantValues:e.variantValues}))})),this.data=this.data.concat(r||[]),this._count=(null===(n=t.data)||void 0===n?void 0:n.count)||this._count,this._page=this.page+1,this.setIsFilteredForProducts(),this.setIsStaticForProducts(),[3,5]):[2];case 3:return s=e.sent(),console.log(s),[3,5];case 4:return this._isLoading=!1,[7];case 5:return[2]}}))}))},this.getPage=function(r){return t(d,void 0,void 0,(function(){var t,s,o,a,n,d,u=this;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(r,this.limit)];case 2:return(t=e.sent())?(s=null===(n=null===(a=t.data)||void 0===a?void 0:a.data)||void 0===n?void 0:n.map((function(t){var e=u.getSelectedVariant(t);return new h(i(i({},t),{selectedVariantValues:e.variantValues}))})),this.data=s||[],this._count=(null===(d=t.data)||void 0===d?void 0:d.count)||0,this._page=r,this._minPage=r,this.setIsFilteredForProducts(),this.setIsStaticForProducts(),[3,5]):[2];case 3:return o=e.sent(),console.log(o),[3,5];case 4:return this._isLoading=!1,[7];case 5:return[2]}}))}))},this.setVisibleInfiniteScrollPage=function(t){var e;d._infiniteScrollPage!==t&&(d._infiniteScrollPage=t,v.getIsEditor()||null===(e=d.router)||void 0===e||e.replace("".concat(location.pathname).concat(d.queryParams?"?"+d.queryParams:""),void 0,{shallow:!0}))},this.searchDebouncer=s((function(){d.applyFilters()}),500),this.searchAnalyticsDebouncer=s((function(){I.search(d._searchKeyword,d.data.length)}),1e3);var u=a,p=a;if(this.data=a.data?a.data.map((function(t){return new h(t)})):[],this._type=u.type||p._type||u.productListPropValue.productListType||p._productListPropValue.productListType||P.ALL,this._pageType=a.pageType,this._sort=a.sort||a.productListPropValue.initialSort||T.LAST_ADDED,this._limit=a.limit||u.productListPropValue.initialLimit||p._productListPropValue.initialLimit||20,this._page=a.page||1,this._minPage=a.minPage||null,this._count=a.count||0,this._searchKeyword=a.searchKeyword||"",this._productListPropValue=u.productListPropValue||p._productListPropValue,this._filterBrandId=u.filterBrandId||p._filterBrandId||null,this._filterCategoryId=u.filterCategoryId||p._filterCategoryId||null,this._relatedProductData=u.relatedProductData||p._relatedProductData||null,this._recommendedProductData=u.recommendedProductData||p._recommendedProductData||null,this._viewedTogetherProductData=u.viewedTogetherProductData||p._viewedTogetherProductData||null,this._excludedFields=u.excludedFields||p._excludedFields||null,this._isFacetListNotSent=u.isFacetListNotSent||p._isFacetListNotSent||!1,this._disabledSortTypes=u.disabledSortTypes||p._disabledSortTypes||null,this._recommendFor=u.recommendFor||p._recommendFor,this.filters=a.filters?a.filters.map((function(t){return new l(t,d)})):null,this._filterCategories=a.filterCategories?a.filterCategories.map((function(t){return new c(t)})):null,this.pageSpecificData=u.pageSpecificData||p.pageSpecificData||null,this.router=n,r(this,{router:!1}),this.setPageSpecificSort(),this.setIsFilteredForProducts(),this.setIsStaticForProducts(),this.isBrowser())if(this.restoreInfiniteScrollPage(),location.search&&(this.isFilterable||this._type===P.SEARCH)){var g=this.pageType===o.PRODUCT?void 0:this.getQueryParams();this.getInitial(g,this._page>1)}else this._page>1?this.getInitial(void 0,!0):this.isLastViewed?this.getInitial():this.handleListingEvent()}return Object.defineProperty(b.prototype,"sort",{get:function(){return this._sort},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"limit",{get:function(){return this._limit},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"pageType",{get:function(){return this._pageType},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"page",{get:function(){return this._page},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"minPage",{get:function(){return this._minPage||1},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"baseCategoryIdList",{get:function(){return this._baseCategoryIdList},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"count",{get:function(){return this._count},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"pageCount",{get:function(){return Math.ceil(this._count/this._limit)},enumerable:!1,configurable:!0}),Object.defineProperty(b.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(b.prototype,"enableSuggestions",{get:function(){return this._enableSuggestions},set:function(t){this._enableSuggestions=t},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"suggestions",{get:function(){return this._suggestions},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"suggestionCategoryId",{get:function(){return this._suggestionCategoryId},set:function(t){this._suggestionCategoryId=t},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"isInitialized",{get:function(){return this._initialized},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"isFilterable",{get:function(){return this._type===P.ALL||this._type===P.CATEGORY},enumerable:!1,configurable:!0}),Object.defineProperty(b.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!==o.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(b.prototype,"isStatic",{get:function(){return this._type===P.STATIC},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"isDiscounted",{get:function(){return this._type===P.DISCOUNTED},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"isRecommended",{get:function(){return this._type===P.RECOMMENDED},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"isLastViewed",{get:function(){return this._type===P.LAST_VIEWED},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"isRelatedProducts",{get:function(){return this._type===P.RELATED_PRODUCTS},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"isRecommendedProducts",{get:function(){return this._type===P.RECOMMENDED_PRODUCTS},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"isViewedTogetherProducts",{get:function(){return this._type===P.VIEWED_TOGETHER},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"isSearch",{get:function(){return this._type===P.SEARCH},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"hasPrev",{get:function(){return!(this.isStatic||this.isDiscounted||this.isRecommended||!this._minPage)&&this._minPage>1},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"hasNext",{get:function(){return!(this.isStatic||this.isDiscounted||this.isRecommended)&&this.page*this.limit<this.count},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"isLoading",{get:function(){return this._isLoading},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"queryParams",{get:function(){var t,e,i,r,s=this,a={};if(null===(t=this.filters)||void 0===t||t.forEach((function(t){t.keyList.length&&(a[E(t.name)]=t.isDiscountStatusFilter?t.keyList.map((function(e){return t.discountStatusMapping[e]})):t.keyList)})),this._searchKeyword&&(a.s=encodeURIComponent(this._searchKeyword)),this._sort&&(a.o=R[this._sort]),this._baseCategoryIdList&&(a.bc=this._baseCategoryIdList),this._suggestionCategoryId&&(a.suggestionCategoryId=this._suggestionCategoryId),this._infiniteScrollPage&&(a.page=this._infiniteScrollPage),this._pageType!==o.CATEGORY){var n=null===(e=this.filterCategories)||void 0===e?void 0:e.filter((function(t){return t.isSelected}));if(!!(null==n?void 0:n.length))a.c=null==n?void 0:n.map((function(t){return t.slug}));else if(this._filterCategoryId){var d=null===(r=null===(i=this.filterCategories)||void 0===i?void 0:i.find((function(t){return t.id===s._filterCategoryId})))||void 0===r?void 0:r.slug;d&&(a.c=d)}}return f.stringify(a,{arrayFormat:"comma",encode:!1})},enumerable:!1,configurable:!0}),Object.defineProperty(b.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(b.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(b.prototype,"isFeaturedSortEnabled",{get:function(){var t;return(null===(t=this.pageSpecificData)||void 0===t?void 0:t.orderType)===a.MANUALLY&&[P.ALL,P.CATEGORY].includes(this._type)},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"disabledSortTypes",{get:function(){return this._disabledSortTypes},enumerable:!1,configurable:!0}),b.prototype.setIsFilteredForProducts=function(){var t=this;this.data.forEach((function(e){return e.isFiltered=t.isFiltered||!1}))},b.prototype.setIsStaticForProducts=function(){var t=this;this.data.forEach((function(e){return e.isStatic=t.isStatic||!1}))},b.prototype.setPageSpecificSort=function(){var t;if((null===(t=this.pageSpecificData)||void 0===t?void 0:t.orderType)&&[P.ALL].includes(this._type))switch(this.pageSpecificData.orderType){case a.HIGHEST_DISCOUNT_RATIO:this._sort=T.DECRASING_DISCOUNT;break;case a.LOWEST_DISCOUNT_RATIO:this._sort=T.INCREASING_DISCOUNT;break;case a.HIGHEST_PRICE:this._sort=T.DECREASING_PRICE;break;case a.LOWEST_PRICE:this._sort=T.INCREASING_PRICE;break;case a.NEWEST:this._sort=T.LAST_ADDED;break;case a.OLDEST:this._sort=T.FIRST_ADDED;break;case a.MANUALLY:this._sort=T.FEATURED}},b.prototype.getSortParams=function(){var t,e;switch(this._sort){case T.INCREASING_PRICE:t=m.ASC,e=_.PRICE;break;case T.DECREASING_PRICE:t=m.DESC,e=_.PRICE;break;case T.FIRST_ADDED:t=m.ASC,e=_.CREATED_AT;break;case T.LAST_ADDED:t=m.DESC,e=_.CREATED_AT;break;case T.INCREASING_DISCOUNT:t=m.ASC,e=_.DISCOUNT_RATIO;break;case T.DECRASING_DISCOUNT:t=m.DESC,e=_.DISCOUNT_RATIO;break;case T.FEATURED:if(this.isSearch)return;t=m.ASC,e=_.MANUAL_SORT;break;case T.DEFAULT:t=void 0,e=void 0;break;case T.AVERAGE_RATING:t=m.DESC,e=_.AVERAGE_RATING;break;case T.REVIEW_COUNT:t=m.DESC,e=_.REVIEW_COUNT;break;case T.SALE_COUNT:t=m.DESC,e=_.SALE_COUNT;break;case T.A_Z:t=m.ASC,e=_.NAME;break;case T.Z_A:t=m.DESC,e=_.NAME}if(t&&e)return{direction:t,type:e}},b.prototype.searchProducts=function(r,s,a){var c,l,h,f,m,_;return t(this,void 0,void 0,(function(){var t,I,E,S,C,b,T,D,A,j,R=this;return e(this,(function(e){switch(e.label){case 0:return t=[],I=[],null===(c=this.filters)||void 0===c||c.forEach((function(e){e.valueList.length&&t.push(new p({id:e.id,type:e.type,displayType:e.displayType,valueList:e.isDiscountStatusFilter?e.valueList.map((function(t){return e.discountStatusMapping[t]})):e.valueList})),e.isFacetFilter&&!R._isFacetListNotSent&&I.push({id:e.id,type:e.type,displayType:e.displayType})})),(E=null===(l=new URLSearchParams(location.search))||void 0===l?void 0:l.get("suggestion"))&&(S=JSON.parse(decodeURIComponent(E)),(C=S.brandId)&&((b=null===(h=this.filters)||void 0===h?void 0:h.find((function(t){return"brand"===t.id&&t.type===d.BRAND})))&&(T=null===(f=b.values)||void 0===f?void 0:f.find((function(t){return t.id===C})))&&b.applyQueryParam(T.name),t.push(new p({id:"brand",type:d.BRAND,displayType:u.BOX,valueList:[C]}))),S.categoryId&&(this._filterCategoryId=S.categoryId),this._searchKeyword=""),D=null===(m=this._filterCategories)||void 0===m?void 0:m.filter((function(t){return t.isSelected})).map((function(t){return t.id})),A=this.getSortParams(),this.isRelatedProducts&&this._relatedProductData?[4,g.getSuggestedProducts({priceListId:v.getPriceListId(),salesChannelId:v.getSalesChannelId(),productId:this._relatedProductData.productId,brandIds:this._relatedProductData.brandIds,categoryIds:this._relatedProductData.categoryIds,locale:v.getCurrentLocale()},this._excludedFields)]:[3,2];case 1:case 3:case 5:case 7:return[2,e.sent()];case 2:return this.isRecommendedProducts&&this._recommendedProductData?[4,g.getSuggestedProducts({priceListId:v.getPriceListId(),salesChannelId:v.getSalesChannelId(),brandIds:this._recommendedProductData.brandIds,categoryIds:this._recommendedProductData.categoryIds,locale:v.getCurrentLocale()},this._excludedFields)]:[3,4];case 4:return this.isViewedTogetherProducts&&this._viewedTogetherProductData?[4,g.getSuggestedProducts({priceListId:v.getPriceListId(),salesChannelId:v.getSalesChannelId(),method:y.VIEWED_TOGETHER,productIds:this._viewedTogetherProductData.productIds,locale:v.getCurrentLocale()},this._excludedFields)]:[3,6];case 6:return j={input:i(i(i(i({page:r,perPage:s},this.enableSuggestions?{enableSuggestions:this.enableSuggestions}:{}),{productIdList:this.isStatic?null===(_=this._productListPropValue.productIds)||void 0===_?void 0:_.map((function(t){return t.productId})):a,filterList:t,facetList:I}),this.baseCategoryIdList?{baseCategoryIdList:this.baseCategoryIdList}:{}),{brandId:this._pageType===o.BRAND&&this._type!==P.SEARCH?this._filterBrandId:void 0,categoryIdList:D&&D.length?D:this._filterCategoryId?[this._filterCategoryId]:void 0,priceListId:v.getPriceListId(),salesChannelId:v.getSalesChannelId(),query:this._searchKeyword,order:A?[A]:[],showStockOption:v.getStockPreference()||n.SHOW_ALL})},[4,g.searchProducts(j,this._excludedFields)]}}))}))},b.prototype.getFilters=function(){var i,r,s,a;return t(this,void 0,void 0,(function(){var t,n,d=this;return e(this,(function(e){switch(e.label){case 0:return[4,g.getProductFilterData({categoryId:this._filterCategoryId?this._filterCategoryId:void 0,locale:v.getCurrentLocale()})];case 1:return t=e.sent(),this.filters=null===(i=null==t?void 0:t.data)||void 0===i?void 0:i.filters.map((function(t){return new l(t,d)})),this._filterCategories=null===(r=null==t?void 0:t.data)||void 0===r?void 0:r.categories,this._disabledSortTypes=null===(s=t.data)||void 0===s?void 0:s.disabledSortTypes,this.pageType!==o.CATEGORY&&this._filterCategoryId&&(n=null===(a=this._filterCategories)||void 0===a?void 0:a.find((function(t){return t.id===d._filterCategoryId})))&&(n.isSelected=!0),this.filters&&this.filters.sort((function(t,e){return t.order>e.order?1:-1})),[2]}}))}))},b.prototype.applyQueryParamFilters=function(t){var e,i,r=this;try{null==t||t.forEach((function(t,e){var i,s=null===(i=r.filters)||void 0===i?void 0:i.find((function(t){return t.key===e||t.name===e||E(t.name)===E(e)}));s&&s.applyQueryParam(t)}));var s=null==t?void 0:t.get("s");s&&(this._searchKeyword=s);var a=null==t?void 0:t.get("o");if(a){var n=parseInt(a),d=Object.entries(R).find((function(t){return t[1]===n}));d&&(this._sort=d[0])}if(this._pageType!==o.CATEGORY){var u=null==t?void 0:t.get("c"),c=null==u?void 0:u.split(",");c&&c.length&&(null===(e=this.filterCategories)||void 0===e||e.forEach((function(t){t.isSelected=c.some((function(e){return e===t.slug}))})))}if(this._pageType===o.SEARCH){var l=null==t?void 0:t.get("bc"),p=null==l?void 0:l.split(",");p&&(this._baseCategoryIdList=p);var h=null===(i=new URLSearchParams(location.search))||void 0===i?void 0:i.get("suggestion");if(h){var g=JSON.parse(decodeURIComponent(h)).categoryId;g&&(this.suggestionCategoryId=g)}var f=null==t?void 0:t.get("suggestionCategoryId");f&&(this.suggestionCategoryId=f,this._filterCategoryId=f,this._searchKeyword="")}}catch(t){console.log(t)}},b.prototype.applyFacets=function(t){var e,i;null===(e=this.filters)||void 0===e||e.forEach((function(e){var i,r,s,o=null==t?void 0:t.find((function(t){return t.id===e.id}));o?null===(i=e.values)||void 0===i||i.forEach((function(t){var i=e.isDiscountStatusFilter?e.discountStatusMapping[t.id]:t.id,r=o.values.find((function(t){return t.id===i}));r?t.resultCount=r.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})))},b.prototype.setQueryParams=function(){var t;!this.isBrowser()||this.isSearch||v.getIsEditor()||null===(t=this.router)||void 0===t||t.replace("".concat(location.pathname).concat(this.queryParams?"?"+this.queryParams:""),void 0,{shallow:!0})},b.prototype.clearFilters=function(){var t,e;null===(t=this.filters)||void 0===t||t.forEach((function(t){return t.clear()})),this._searchKeyword="",this._pageType!==o.CATEGORY&&(this._filterCategoryId=void 0),null===(e=this._filterCategories)||void 0===e||e.forEach((function(t){return t.isSelected=!1})),this.applyFilters()},b.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()&&this.setQueryParams(),[2]}}))}))},b.prototype.onFilterCategoryClick=function(i,r){var s,o;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:v.getIsEditor()||null===(o=C.getInstance().router)||void 0===o||o.push(i.href+(this.queryParams?"?"+this.queryParams:"")),t.label=3;case 3:return[2]}}))}))},b.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}},b.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)}},b.prototype.getQueryParams=function(){if(this.isBrowser())return new URLSearchParams(location.search)},b.prototype.isBrowser=function(){return"undefined"!=typeof window},b.prototype.waitForCustomerStoreInit=function(){return new Promise((function(t){var e=setInterval((function(){C.getInstance().customerStore.initialized&&(clearInterval(e),t(null))}),1e3)}))},b.prototype.handleListingEvent=function(){this.searchKeyword&&this.data.length?I.viewSearchResults(this._searchKeyword,this.data):this.data.length&&this._type===P.ALL&&I.viewListing(this.data)},b}();!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",t.VIEWED_TOGETHER="VIEWED_TOGETHER",t.RECOMMENDED_PRODUCTS="RECOMMENDED_PRODUCTS"}(P||(P={})),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",t.DEFAULT="DEFAULT",t.AVERAGE_RATING="AVERAGE_RATING",t.REVIEW_COUNT="REVIEW_COUNT",t.SALE_COUNT="SALE_COUNT",t.A_Z="A_Z",t.Z_A="Z_A"}(T||(T={})),function(t){t.AVERAGE_RATING="AVERAGE_RATING",t.CREATED_AT="CREATED_AT",t.DISCOUNT_RATIO="DISCOUNT_RATIO",t.MANUAL_SORT="MANUAL_SORT",t.NAME="NAME",t.PRICE="PRICE",t.REVIEW_COUNT="REVIEW_COUNT",t.SALE_COUNT="SALE_COUNT"}(D||(D={})),function(t){t.CATEGORY="CATEGORY",t.BRAND="BRAND"}(A||(A={}));var R=((b={})[T.INCREASING_PRICE]=1,b[T.DECREASING_PRICE]=2,b[T.LAST_ADDED]=3,b[T.FIRST_ADDED]=4,b[T.INCREASING_DISCOUNT]=5,b[T.DECRASING_DISCOUNT]=6,b[T.FEATURED]=7,b[T.DEFAULT]=8,b[T.AVERAGE_RATING]=9,b[T.REVIEW_COUNT]=10,b[T.SALE_COUNT]=11,b[T.A_Z]=12,b[T.Z_A]=13,b);export{j as IkasProductList,D as IkasProductListSortByTypeEnum,T as IkasProductListSortType,P as IkasProductListType,A as IkasRelatedProductsType};
@@ -34,7 +34,7 @@ export default class ProductStore {
34
34
  page?: number | undefined;
35
35
  totalCount?: any;
36
36
  }>>;
37
- static getSuggestedProducts(params: GetSuggestedProductsQueryParams): Promise<APIResponse<{
37
+ static getSuggestedProducts(params: GetSuggestedProductsQueryParams, excludedFields?: string[] | null): Promise<APIResponse<{
38
38
  data: IkasProduct[] | undefined;
39
39
  count?: number | undefined;
40
40
  facets?: null | undefined;
@@ -1 +1 @@
1
- import{__awaiter as t,__generator as o,__assign as r}from'./../../ext/tslib/tslib.es6.js';import{listProductBackInStockRemind as e,saveProductBackInStockRemind as i,APIResponse as a,searchProducts as d,getProductFilterData as s,getRelatedProducts as n,getSuggestedProducts as m,listProductAttribute as u,getProductCampaigns as l,getVariantStockLocations as p,getOrderLineFile as c,listProductOptionSet as f,listCampaignOffer as v}from"@ikas/storefront-api";import{IkasProduct as j}from"../../models/data/product/index.js";import{IkasProductAttribute as x}from"../../models/data/product/attribute/index.js";import{IkasProductCampaign as h}from"../../models/data/product/campaign/index.js";import{IkasProductFilter as g}from"../../models/data/product/filter/index.js";import{IkasProductOptionSet as w}from"../../models/data/product/option-set/index.js";import{IkasFilterCategory as b}from"../../models/data/filter-category/index.js";import{IkasStorefrontConfig as y}from"@ikas/storefront-config";import{IkasProductStockLocations as k}from"../../models/data/product/stock-location/index.js";import"../../models/data/blog/category/index.js";import"../../models/data/blog/content/index.js";import"../../models/data/blog/meta-data/index.js";import"../../models/data/blog/tag/index.js";import"../../models/data/blog/index.js";import"../../models/data/brand/index.js";import"@ikas/storefront-models";import"mobx";import{IkasCampaignOffer as L}from"../../models/data/campaign-offer/index.js";import"../../models/data/cart/campaign-offer/index.js";import"../../models/data/cart/index.js";import"../../models/data/category/path-item/index.js";import"../../models/data/category/index.js";import"../../models/data/checkout/index.js";import"../../models/data/checkout-settings/index.js";import"../../models/data/city/index.js";import"../../models/data/country/index.js";import"../../models/data/customer/address/region/index.js";import"../../models/data/customer/address/index.js";import"../../models/data/customer/address/ikas-localized-customer-address.js";import"../../models/data/customer/attribute/index.js";import"../../models/data/customer/review/summary/index.js";import"../../models/data/customer/review/index.js";import"../../models/data/customer/index.js";import"../../models/data/customer-form-data-input/index.js";import"../../models/data/district/index.js";import"../../models/data/favorite-product/index.js";import"../../models/data/html-meta-data/index.js";import"../../models/data/image/index.js";import"../../models/data/order/address/region/index.js";import"../../models/data/order/address/index.js";import"../../models/data/order/line-item/option/value/index.js";import"../../models/data/order/line-item/variant/value/index.js";import"../../models/data/order/line-item/variant/index.js";import"../../models/data/order/line-item/index.js";import"../../models/data/order/order-transaction-with-prices/index.js";import"../../models/data/order/package/index.js";import"../../models/data/order/transaction/index.js";import"../../models/data/order/index.js";import"../../models/data/payment-gateway/index.js";import"../../models/data/product/attribute-value/index.js";import"../../models/data/product/campaign-offer/index.js";import"../../models/data/product/option-set/option/index.js";import"../../models/data/product/variant/price/index.js";import"../../models/data/product/variant/index.js";import"../../models/data/variant-type/index.js";import"../../models/data/raffle/index.js";import"../../models/data/shipping-zone/state/city/district/region/index.js";import"../../models/data/state/index.js";import"../../models/data/storefront-popup/storefront-popup-display-filter/index.js";import"../../models/data/storefront-popup/storefront-popup-display-settings/index.js";import"../../models/data/storefront-popup/storefront-popup-page-filter/index.js";import"../../models/data/storefront-popup/index.js";import"../../models/data/theme-json/index.js";import"../../models/data/theme-json/component/index.js";import"../../models/data/theme-json/custom-data/index.js";import"../../models/data/variant-type/variant-value/index.js";import"@ikas/localized-address";import"../../models/ui/blog-list/index.js";import"../../models/ui/blog-category-list/index.js";import"../../models/ui/brand-list/index.js";import"../../models/ui/category-list/index.js";import"../../models/ui/product-list/index.js";import"../../models/ui/product-attribute-detail/index.js";import"../../models/ui/product-attribute-list/index.js";import"../../models/ui/customer-review-list/index.js";import"../../models/ui/customer-review-summary-list/index.js";import"../../models/ui/validator/index.js";import"../../models/ui/validator/rules/index.js";import"../../models/ui/validator/form/login.js";import"../../models/ui/validator/form/address.js";import"../../models/ui/validator/form/ikas-address.js";import"../../models/ui/validator/form/register.js";import"../../models/ui/validator/form/contact-form.js";import"../../models/ui/validator/form/forgot-password.js";import"../../models/ui/validator/form/recover-password.js";import"../../models/ui/validator/form/account-info.js";import"../../models/ui/validator/form/raffle-form.js";import"../../models/ui/validator/form/customer-review.js";import"../../models/ui/raffle-list/index.js";var P=function(){function P(){}return P.listProductBackInStockRemind=function(r){return t(this,void 0,void 0,(function(){return o(this,(function(t){switch(t.label){case 0:return[4,e(r)];case 1:return[2,t.sent()]}}))}))},P.saveProductBackInStockRemind=function(r){return t(this,void 0,void 0,(function(){return o(this,(function(t){switch(t.label){case 0:return[4,i(r)];case 1:return[2,t.sent()]}}))}))},P.searchProducts=function(e,i){var s,n;return t(this,void 0,void 0,(function(){var t;return o(this,(function(o){switch(o.label){case 0:return[4,d(e,i)];case 1:return t=o.sent(),[2,new a(r(r({locale:y.getCurrentLocale()},t.data),{data:null===(n=null===(s=t.data)||void 0===s?void 0:s.data)||void 0===n?void 0:n.map((function(t){return new j(t)}))}))]}}))}))},P.getProductFilterData=function(r){var e;return t(this,void 0,void 0,(function(){var t;return o(this,(function(o){switch(o.label){case 0:return[4,s(r)];case 1:return t=o.sent(),[2,new a(t.data?{filters:t.data.filters.map((function(t){return new g(t)})),categories:null===(e=t.data.categories)||void 0===e?void 0:e.map((function(t){return new b(t)})),disabledSortTypes:t.data.disabledSortTypes}:null,t.graphQLErrors)]}}))}))},P.getRelatedProducts=function(e){var i,d;return t(this,void 0,void 0,(function(){var t;return o(this,(function(o){switch(o.label){case 0:return[4,n(e)];case 1:return t=o.sent(),[2,new a(r(r({},t.data),{data:null===(d=null===(i=t.data)||void 0===i?void 0:i.data)||void 0===d?void 0:d.map((function(t){return new j(t)}))}),t.graphQLErrors)]}}))}))},P.getSuggestedProducts=function(e){var i,d;return t(this,void 0,void 0,(function(){var t;return o(this,(function(o){switch(o.label){case 0:return[4,m(e)];case 1:return t=o.sent(),[2,new a(r(r({},t.data),{data:null===(d=null===(i=t.data)||void 0===i?void 0:i.data)||void 0===d?void 0:d.map((function(t){return new j(t)}))}),t.graphQLErrors)]}}))}))},P.listProductAttribute=function(r){var e;return t(this,void 0,void 0,(function(){var t;return o(this,(function(o){switch(o.label){case 0:return[4,u(r)];case 1:return t=o.sent(),[2,new a(null===(e=t.data)||void 0===e?void 0:e.map((function(t){return new x(t)})),t.graphQLErrors)]}}))}))},P.getProductCampaigns=function(r){var e;return t(this,void 0,void 0,(function(){var t;return o(this,(function(o){switch(o.label){case 0:return[4,l(r)];case 1:return t=o.sent(),[2,new a(null===(e=t.data)||void 0===e?void 0:e.map((function(t){return new h(t)})),t.graphQLErrors)]}}))}))},P.getVariantStockLocations=function(r){var e;return t(this,void 0,void 0,(function(){var t;return o(this,(function(o){switch(o.label){case 0:return[4,p(r)];case 1:return t=o.sent(),[2,new a(null===(e=t.data)||void 0===e?void 0:e.map((function(t){return new k(t)})),t.graphQLErrors)]}}))}))},P.getOrderLineFile=function(r){return t(this,void 0,void 0,(function(){return o(this,(function(t){switch(t.label){case 0:return[4,c(r)];case 1:return[2,t.sent()]}}))}))},P.listProductOptionSet=function(r){var e;return t(this,void 0,void 0,(function(){var t;return o(this,(function(o){switch(o.label){case 0:return[4,f(r)];case 1:return t=o.sent(),[2,new a(null===(e=t.data)||void 0===e?void 0:e.map((function(t){return new w(t)})),t.graphQLErrors)]}}))}))},P.listCampaignOffer=function(r){var e;return t(this,void 0,void 0,(function(){var t;return o(this,(function(o){switch(o.label){case 0:return[4,v(r)];case 1:return t=o.sent(),[2,new a(null===(e=t.data)||void 0===e?void 0:e.map((function(t){return new L(t)})),t.graphQLErrors)]}}))}))},P}();export{P as default};
1
+ import{__awaiter as t,__generator as o,__assign as r}from'./../../ext/tslib/tslib.es6.js';import{listProductBackInStockRemind as e,saveProductBackInStockRemind as i,APIResponse as a,searchProducts as d,getProductFilterData as s,getRelatedProducts as n,getSuggestedProducts as m,listProductAttribute as u,getProductCampaigns as l,getVariantStockLocations as p,getOrderLineFile as c,listProductOptionSet as f,listCampaignOffer as v}from"@ikas/storefront-api";import{IkasProduct as j}from"../../models/data/product/index.js";import{IkasProductAttribute as x}from"../../models/data/product/attribute/index.js";import{IkasProductCampaign as h}from"../../models/data/product/campaign/index.js";import{IkasProductFilter as g}from"../../models/data/product/filter/index.js";import{IkasProductOptionSet as w}from"../../models/data/product/option-set/index.js";import{IkasFilterCategory as b}from"../../models/data/filter-category/index.js";import{IkasStorefrontConfig as y}from"@ikas/storefront-config";import{IkasProductStockLocations as k}from"../../models/data/product/stock-location/index.js";import"../../models/data/blog/category/index.js";import"../../models/data/blog/content/index.js";import"../../models/data/blog/meta-data/index.js";import"../../models/data/blog/tag/index.js";import"../../models/data/blog/index.js";import"../../models/data/brand/index.js";import"@ikas/storefront-models";import"mobx";import{IkasCampaignOffer as L}from"../../models/data/campaign-offer/index.js";import"../../models/data/cart/campaign-offer/index.js";import"../../models/data/cart/index.js";import"../../models/data/category/path-item/index.js";import"../../models/data/category/index.js";import"../../models/data/checkout/index.js";import"../../models/data/checkout-settings/index.js";import"../../models/data/city/index.js";import"../../models/data/country/index.js";import"../../models/data/customer/address/region/index.js";import"../../models/data/customer/address/index.js";import"../../models/data/customer/address/ikas-localized-customer-address.js";import"../../models/data/customer/attribute/index.js";import"../../models/data/customer/review/summary/index.js";import"../../models/data/customer/review/index.js";import"../../models/data/customer/index.js";import"../../models/data/customer-form-data-input/index.js";import"../../models/data/district/index.js";import"../../models/data/favorite-product/index.js";import"../../models/data/html-meta-data/index.js";import"../../models/data/image/index.js";import"../../models/data/order/address/region/index.js";import"../../models/data/order/address/index.js";import"../../models/data/order/line-item/option/value/index.js";import"../../models/data/order/line-item/variant/value/index.js";import"../../models/data/order/line-item/variant/index.js";import"../../models/data/order/line-item/index.js";import"../../models/data/order/order-transaction-with-prices/index.js";import"../../models/data/order/package/index.js";import"../../models/data/order/transaction/index.js";import"../../models/data/order/index.js";import"../../models/data/payment-gateway/index.js";import"../../models/data/product/attribute-value/index.js";import"../../models/data/product/campaign-offer/index.js";import"../../models/data/product/option-set/option/index.js";import"../../models/data/product/variant/price/index.js";import"../../models/data/product/variant/index.js";import"../../models/data/variant-type/index.js";import"../../models/data/raffle/index.js";import"../../models/data/shipping-zone/state/city/district/region/index.js";import"../../models/data/state/index.js";import"../../models/data/storefront-popup/storefront-popup-display-filter/index.js";import"../../models/data/storefront-popup/storefront-popup-display-settings/index.js";import"../../models/data/storefront-popup/storefront-popup-page-filter/index.js";import"../../models/data/storefront-popup/index.js";import"../../models/data/theme-json/index.js";import"../../models/data/theme-json/component/index.js";import"../../models/data/theme-json/custom-data/index.js";import"../../models/data/variant-type/variant-value/index.js";import"@ikas/localized-address";import"../../models/ui/blog-list/index.js";import"../../models/ui/blog-category-list/index.js";import"../../models/ui/brand-list/index.js";import"../../models/ui/category-list/index.js";import"../../models/ui/product-list/index.js";import"../../models/ui/product-attribute-detail/index.js";import"../../models/ui/product-attribute-list/index.js";import"../../models/ui/customer-review-list/index.js";import"../../models/ui/customer-review-summary-list/index.js";import"../../models/ui/validator/index.js";import"../../models/ui/validator/rules/index.js";import"../../models/ui/validator/form/login.js";import"../../models/ui/validator/form/address.js";import"../../models/ui/validator/form/ikas-address.js";import"../../models/ui/validator/form/register.js";import"../../models/ui/validator/form/contact-form.js";import"../../models/ui/validator/form/forgot-password.js";import"../../models/ui/validator/form/recover-password.js";import"../../models/ui/validator/form/account-info.js";import"../../models/ui/validator/form/raffle-form.js";import"../../models/ui/validator/form/customer-review.js";import"../../models/ui/raffle-list/index.js";var P=function(){function P(){}return P.listProductBackInStockRemind=function(r){return t(this,void 0,void 0,(function(){return o(this,(function(t){switch(t.label){case 0:return[4,e(r)];case 1:return[2,t.sent()]}}))}))},P.saveProductBackInStockRemind=function(r){return t(this,void 0,void 0,(function(){return o(this,(function(t){switch(t.label){case 0:return[4,i(r)];case 1:return[2,t.sent()]}}))}))},P.searchProducts=function(e,i){var s,n;return t(this,void 0,void 0,(function(){var t;return o(this,(function(o){switch(o.label){case 0:return[4,d(e,i)];case 1:return t=o.sent(),[2,new a(r(r({locale:y.getCurrentLocale()},t.data),{data:null===(n=null===(s=t.data)||void 0===s?void 0:s.data)||void 0===n?void 0:n.map((function(t){return new j(t)}))}))]}}))}))},P.getProductFilterData=function(r){var e;return t(this,void 0,void 0,(function(){var t;return o(this,(function(o){switch(o.label){case 0:return[4,s(r)];case 1:return t=o.sent(),[2,new a(t.data?{filters:t.data.filters.map((function(t){return new g(t)})),categories:null===(e=t.data.categories)||void 0===e?void 0:e.map((function(t){return new b(t)})),disabledSortTypes:t.data.disabledSortTypes}:null,t.graphQLErrors)]}}))}))},P.getRelatedProducts=function(e){var i,d;return t(this,void 0,void 0,(function(){var t;return o(this,(function(o){switch(o.label){case 0:return[4,n(e)];case 1:return t=o.sent(),[2,new a(r(r({},t.data),{data:null===(d=null===(i=t.data)||void 0===i?void 0:i.data)||void 0===d?void 0:d.map((function(t){return new j(t)}))}),t.graphQLErrors)]}}))}))},P.getSuggestedProducts=function(e,i){var d,s;return t(this,void 0,void 0,(function(){var t;return o(this,(function(o){switch(o.label){case 0:return[4,m(e,i)];case 1:return t=o.sent(),[2,new a(r(r({},t.data),{data:null===(s=null===(d=t.data)||void 0===d?void 0:d.data)||void 0===s?void 0:s.map((function(t){return new j(t)}))}),t.graphQLErrors)]}}))}))},P.listProductAttribute=function(r){var e;return t(this,void 0,void 0,(function(){var t;return o(this,(function(o){switch(o.label){case 0:return[4,u(r)];case 1:return t=o.sent(),[2,new a(null===(e=t.data)||void 0===e?void 0:e.map((function(t){return new x(t)})),t.graphQLErrors)]}}))}))},P.getProductCampaigns=function(r){var e;return t(this,void 0,void 0,(function(){var t;return o(this,(function(o){switch(o.label){case 0:return[4,l(r)];case 1:return t=o.sent(),[2,new a(null===(e=t.data)||void 0===e?void 0:e.map((function(t){return new h(t)})),t.graphQLErrors)]}}))}))},P.getVariantStockLocations=function(r){var e;return t(this,void 0,void 0,(function(){var t;return o(this,(function(o){switch(o.label){case 0:return[4,p(r)];case 1:return t=o.sent(),[2,new a(null===(e=t.data)||void 0===e?void 0:e.map((function(t){return new k(t)})),t.graphQLErrors)]}}))}))},P.getOrderLineFile=function(r){return t(this,void 0,void 0,(function(){return o(this,(function(t){switch(t.label){case 0:return[4,c(r)];case 1:return[2,t.sent()]}}))}))},P.listProductOptionSet=function(r){var e;return t(this,void 0,void 0,(function(){var t;return o(this,(function(o){switch(o.label){case 0:return[4,f(r)];case 1:return t=o.sent(),[2,new a(null===(e=t.data)||void 0===e?void 0:e.map((function(t){return new w(t)})),t.graphQLErrors)]}}))}))},P.listCampaignOffer=function(r){var e;return t(this,void 0,void 0,(function(){var t;return o(this,(function(o){switch(o.label){case 0:return[4,v(r)];case 1:return t=o.sent(),[2,new a(null===(e=t.data)||void 0===e?void 0:e.map((function(t){return new L(t)})),t.graphQLErrors)]}}))}))},P}();export{P as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ikas/storefront",
3
- "version": "6.1.0-beta.200",
3
+ "version": "6.1.0-beta.201",
4
4
  "description": "Storefront functionality for ikas storefront themes.",
5
5
  "author": "ikas",
6
6
  "license": "ISC",
@@ -22,11 +22,11 @@
22
22
  "swiper": "11.0.6"
23
23
  },
24
24
  "devDependencies": {
25
- "@ikas/storefront-api": "^6.1.0-beta.200",
26
- "@ikas/storefront-config": "^6.1.0-beta.200",
27
- "@ikas/storefront-model-functions": "^6.1.0-beta.200",
28
- "@ikas/storefront-models": "^6.1.0-beta.200",
29
- "@ikas/storefront-providers": "^6.1.0-beta.200",
25
+ "@ikas/storefront-api": "^6.1.0-beta.201",
26
+ "@ikas/storefront-config": "^6.1.0-beta.201",
27
+ "@ikas/storefront-model-functions": "^6.1.0-beta.201",
28
+ "@ikas/storefront-models": "^6.1.0-beta.201",
29
+ "@ikas/storefront-providers": "^6.1.0-beta.201",
30
30
  "@ikas/localized-address": "1.0.0-beta.6",
31
31
  "@adyen/adyen-web": "^5.57.0",
32
32
  "@rollup/plugin-commonjs": "^22.0.0",
@@ -61,11 +61,11 @@
61
61
  },
62
62
  "peerDependencies": {
63
63
  "@ikas/localized-address": "1.0.0-beta.6",
64
- "@ikas/storefront-api": "^6.1.0-beta.200",
65
- "@ikas/storefront-config": "^6.1.0-beta.200",
66
- "@ikas/storefront-model-functions": "^6.1.0-beta.200",
67
- "@ikas/storefront-models": "^6.1.0-beta.200",
68
- "@ikas/storefront-providers": "^6.1.0-beta.200",
64
+ "@ikas/storefront-api": "^6.1.0-beta.201",
65
+ "@ikas/storefront-config": "^6.1.0-beta.201",
66
+ "@ikas/storefront-model-functions": "^6.1.0-beta.201",
67
+ "@ikas/storefront-models": "^6.1.0-beta.201",
68
+ "@ikas/storefront-providers": "^6.1.0-beta.201",
69
69
  "mobx": "^6.1.3",
70
70
  "mobx-react-lite": "^3.1.5",
71
71
  "next": "12.2.0",