@ikas/storefront 2.0.24 → 2.0.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/index.js CHANGED
@@ -1 +1 @@
1
- export{Image}from"./components/image/index.js";export{IkasEditorComponentLoader}from"./components/page-editor/loader/index.js";export{IkasBlog,IkasBlogCategory,IkasBlogContent,IkasBlogMetaData,IkasBlogMetadataTargetType,IkasBlogTag,IkasBlogWriter}from"./models/data/blog/index.js";export{IkasBrand}from"./models/data/brand/index.js";export{IkasCategory,IkasCategoryPath,IkasFilterCategory}from"./models/data/category/index.js";export{IkasCheckout,IkasCheckoutCustomer,IkasCheckoutRecoveryEmailStatus,IkasCheckoutRecoveryStatus,IkasCheckoutStatus,IkasPaymentMethod,IkasShippingMethod,IkasShippingMethodEnum}from"./models/data/checkout/index.js";export{IkasCustomerAddress}from"./models/data/customer/address/index.js";export{IkasCustomer}from"./models/data/customer/index.js";export{IkasCustomerReview}from"./models/data/customer-review/index.js";export{IkasHTMLMetaData,IkasHTMLMetaDataTargetType}from"./models/data/html-meta-data/index.js";export{IkasImage}from"./models/data/image/index.js";export{IkasCardAssociation,IkasCardType}from"./models/data/installment-info/index.js";export{IkasMerchantSettings}from"./models/data/merchant-settings/index.js";export{IkasAmountTypeEnum,IkasOrder,IkasOrderCancelledReason,IkasOrderPackageFulfillStatus,IkasOrderPackageStatus,IkasOrderPaymentStatus,IkasOrderShippingMethod,IkasOrderStatus,OrderLineItemStatusEnum}from"./models/data/order/index.js";export{IkasOrderLineItem}from"./models/data/order/line-item/index.js";export{IkasOrderRefundSettings}from"./models/data/order/refund/settings.js";export{IkasOrderLineOptions}from"./models/data/order/line-item/options/index.js";export{IkasOrderLineOptionsValue}from"./models/data/order/line-item/options/options-value/index.js";export{IkasProduct,IkasProductType}from"./models/data/product/index.js";export{IkasProductVariantType}from"./models/data/product/variant-type/index.js";export{IkasProductVariant}from"./models/data/product/variant/index.js";export{IkasProductPrice}from"./models/data/product/variant/price/index.js";export{IkasProductAttribute,IkasProductAttributeType}from"./models/data/product-attribute/index.js";export{IkasProductAttributeValue}from"./models/data/product/attribute-value/index.js";export{IkasApplicableProductFilterValue,IkasProductFilter,IkasProductFilterDisplayType,IkasProductFilterSettings,IkasProductFilterSortType,IkasProductFilterType,IkasProductFilterValue,RangeValue,parseRangeStr}from"./models/data/product-filter/index.js";export{IkasFavoriteProduct}from"./models/data/favorite-product/index.js";export{IkasContactForm}from"./models/data/contact-form/index.js";export{IkasVariantSelectionType,IkasVariantType}from"./models/data/variant-type/index.js";export{IkasVariantValue}from"./models/data/variant-type/variant-value/index.js";export{IkasOrderTransaction,IkasTransactionStatusEnum,IkasTransactionTypeEnum}from"./models/data/order-transaction/index.js";export{IkasProductOption,IkasProductOptionDateSettings,IkasProductOptionFileSettings,IkasProductOptionSelectSettings,IkasProductOptionSelectType,IkasProductOptionSelectValue,IkasProductOptionSelectValueTranslations,IkasProductOptionSet,IkasProductOptionSetTranslations,IkasProductOptionTextSettings,IkasProductOptionTranslations,IkasProductOptionType}from"./models/data/product-option-set/index.js";export{IkasRaffle,IkasRaffleMetaData,IkasRaffleParticipant}from"./models/data/raffle/index.js";export{IkasSlider}from"./models/data/slider/index.js";export{IkasProductCampaign}from"./models/data/product-campaing/index.js";export{IkasTheme}from"./models/theme/theme.js";export{IkasThemePage,IkasThemePageType}from"./models/theme/page/index.js";export{IkasThemePageComponent}from"./models/theme/page/component/index.js";export{IkasThemeComponent}from"./models/theme/component/index.js";export{IkasThemeComponentProp,IkasThemeComponentPropType}from"./models/theme/component/prop/index.js";export{IkasLinkPropValue,IkasLinkType}from"./models/theme/page/component/prop-value/link.js";export{IkasBrandPropValue}from"./models/theme/page/component/prop-value/brand.js";export{IkasBrandListPropValue}from"./models/theme/page/component/prop-value/brand-list.js";export{IkasProductListPropValue}from"./models/theme/page/component/prop-value/product-list.js";export{IkasProductDetailPropValue}from"./models/theme/page/component/prop-value/product-detail.js";export{IkasCategoryPropValue}from"./models/theme/page/component/prop-value/category.js";export{IkasCategoryListPropValue}from"./models/theme/page/component/prop-value/category-list.js";export{IkasThemeSettings}from"./models/theme/settings/index.js";export{IkasThemeCustomData}from"./models/theme/custom-data/index.js";export{IkasBlogPropValue}from"./models/theme/page/component/prop-value/blog.js";export{IkasBlogListPropValue}from"./models/theme/page/component/prop-value/blog-list.js";export{IkasBlogCategoryPropValue}from"./models/theme/page/component/prop-value/blog-category.js";export{IkasBlogCategoryListPropValue}from"./models/theme/page/component/prop-value/blog-category-list.js";export{IkasRafflePropValue}from"./models/theme/page/component/prop-value/raffle.js";export{IkasRaffleListPropValue}from"./models/theme/page/component/prop-value/raffle-list.js";export{IkasBlogList,IkasBlogListType}from"./models/ui/blog-list/index.js";export{IkasBlogCategoryList,IkasBlogCategoryListType}from"./models/ui/blog-category-list/index.js";export{IkasBrandList,IkasBrandListSortType,IkasBrandListType}from"./models/ui/brand-list/index.js";export{IkasCategoryList,IkasCategoryListSortType,IkasCategoryListType}from"./models/ui/category-list/index.js";export{IkasNavigationLink}from"./models/ui/navigation-link/index.js";export{IkasProductDetail}from"./models/ui/product-detail/index.js";export{IkasProductList,IkasProductListSortType,IkasProductListType}from"./models/ui/product-list/index.js";export{IkasAttributeDetail}from"./models/ui/product-attribute-detail/index.js";export{IkasAttributeList}from"./models/ui/product-attribute-list/index.js";export{IkasCustomerReviewList}from"./models/ui/customer-review-list/index.js";export{Validator}from"./models/ui/validator/index.js";export{EmailRule,EqualsRule,IdentityNumberRule,LessThanRule,MaxRule,MinRule,PhoneRule,RequiredRule,ValidationRule,ValidatorErrorType}from"./models/ui/validator/rules/index.js";export{LoginForm}from"./models/ui/validator/form/login.js";export{AddressForm}from"./models/ui/validator/form/address.js";export{RegisterForm}from"./models/ui/validator/form/register.js";export{ContactForm}from"./models/ui/validator/form/contact-form.js";export{ForgotPasswordForm}from"./models/ui/validator/form/forgot-password.js";export{RecoverPasswordForm}from"./models/ui/validator/form/recover-password.js";export{AccountInfoForm}from"./models/ui/validator/form/account-info.js";export{RaffleForm}from"./models/ui/validator/form/raffle-form.js";export{CustomerReviewForm}from"./models/ui/validator/form/customer-review.js";export{IkasComponentRenderer}from"./models/ui/component-renderer/index.js";export{IkasRaffleList}from"./models/ui/raffle-list/index.js";import*as e from"./pages/home.js";export{e as IndexPage};import*as o from"./pages/_slug_/index.js";export{o as SlugPage};import*as t from"./pages/pages/_slug_.js";export{t as CustomPage};import*as r from"./pages/checkout.js";export{r as CheckoutPage};import*as a from"./pages/account/index.js";export{a as AccountPage};import*as s from"./pages/account/addresses.js";export{s as AddressesPage};import*as p from"./pages/account/orders/index.js";export{p as OrdersPage};import*as m from"./pages/account/orders/_id_.js";export{m as OrderDetailPage};import*as i from"./pages/account/login.js";export{i as LoginPage};import*as d from"./pages/account/register.js";export{d as RegisterPage};import*as n from"./pages/account/forgot-password.js";export{n as ForgotPasswordPage};import*as l from"./pages/account/recover-password.js";export{l as RecoverPasswordPage};import*as u from"./pages/cart.js";export{u as CartPage};import*as x from"./pages/editor.js";export{x as EditorPage};import*as c from"./pages/account/favorite-products.js";export{c as FavoriteProductsPage};import*as f from"./pages/search.js";export{f as SearchPage};import*as g from"./pages/404.js";export{g as NotFoundPage};import*as k from"./pages/blog/index.js";export{k as BlogPage};import*as I from"./pages/blog/_slug_.js";export{I as BlogSlugPage};import*as j from"./pages/raffle/_slug_.js";export{j as RafflePage};import*as P from"./pages/raffle/index.js";export{P as RafflesPage};import*as y from"./pages/account/raffles.js";export{y as AccountRafflesPage};export{APIGenerator}from"./scripts/generators/api/index.js";export{ComponentImportsGenerator}from"./scripts/generators/components/index.js";export{ConfigGenerator}from"./scripts/generators/config/index.js";export{PageGenerator}from"./scripts/generators/pages/index.js";export{StoreGenerator}from"./scripts/generators/store/index.js";export{ThemeJsonGenerator}from"./scripts/generators/theme/index.js";export{CustomDataTypesGenerator}from"./scripts/generators/types/index.js";export{IkasBaseStore}from"./store/base.js";export{IkasStorefrontConfig}from"./storefront/index.js";export{decodeBase64,findAllByKey,findAllIndexes,formatDate,pascalCase,sortObject,stringSorter,stringToSlug,tryForEach,validatePhoneNumber}from"./utils/helper.js";export{formatMoney,getCurrencySymbol}from"./utils/currency.js";export{createTranslationInputData,useTranslation}from"./utils/i18n.js";export{Analytics}from"./analytics/analytics.js";export{AnalyticsBody,AnalyticsHead}from"./analytics/head/index.js";
1
+ export{Image}from"./components/image/index.js";export{IkasEditorComponentLoader}from"./components/page-editor/loader/index.js";export{IkasBlog,IkasBlogCategory,IkasBlogContent,IkasBlogMetaData,IkasBlogMetadataTargetType,IkasBlogTag,IkasBlogWriter}from"./models/data/blog/index.js";export{IkasBrand}from"./models/data/brand/index.js";export{IkasCategory,IkasCategoryPath,IkasFilterCategory}from"./models/data/category/index.js";export{IkasCheckout,IkasCheckoutCustomer,IkasCheckoutRecoveryEmailStatus,IkasCheckoutRecoveryStatus,IkasCheckoutStatus,IkasPaymentMethod,IkasShippingMethod,IkasShippingMethodEnum}from"./models/data/checkout/index.js";export{IkasCustomerAddress}from"./models/data/customer/address/index.js";export{IkasCustomer}from"./models/data/customer/index.js";export{IkasCustomerReview}from"./models/data/customer-review/index.js";export{IkasHTMLMetaData,IkasHTMLMetaDataTargetType}from"./models/data/html-meta-data/index.js";export{IkasImage}from"./models/data/image/index.js";export{IkasCardAssociation,IkasCardType}from"./models/data/installment-info/index.js";export{IkasMerchantSettings}from"./models/data/merchant-settings/index.js";export{IkasAmountTypeEnum,IkasOrder,IkasOrderCancelledReason,IkasOrderPackageFulfillStatus,IkasOrderPackageStatus,IkasOrderPaymentStatus,IkasOrderShippingMethod,IkasOrderStatus,OrderLineItemStatusEnum}from"./models/data/order/index.js";export{IkasOrderLineItem}from"./models/data/order/line-item/index.js";export{IkasOrderRefundSettings}from"./models/data/order/refund/settings.js";export{IkasOrderLineOptions}from"./models/data/order/line-item/options/index.js";export{IkasOrderLineOptionsValue}from"./models/data/order/line-item/options/options-value/index.js";export{IkasProduct,IkasProductType}from"./models/data/product/index.js";export{IkasProductVariantType}from"./models/data/product/variant-type/index.js";export{IkasProductVariant}from"./models/data/product/variant/index.js";export{IkasProductPrice}from"./models/data/product/variant/price/index.js";export{IkasProductAttribute,IkasProductAttributeType}from"./models/data/product-attribute/index.js";export{IkasProductAttributeValue}from"./models/data/product/attribute-value/index.js";export{IkasApplicableProductFilterValue,IkasProductFilter,IkasProductFilterDisplayType,IkasProductFilterSettings,IkasProductFilterSortType,IkasProductFilterType,IkasProductFilterValue,IkasProductStockFilterValue,RangeValue,parseRangeStr}from"./models/data/product-filter/index.js";export{IkasFavoriteProduct}from"./models/data/favorite-product/index.js";export{IkasContactForm}from"./models/data/contact-form/index.js";export{IkasVariantSelectionType,IkasVariantType}from"./models/data/variant-type/index.js";export{IkasVariantValue}from"./models/data/variant-type/variant-value/index.js";export{IkasOrderTransaction,IkasTransactionStatusEnum,IkasTransactionTypeEnum}from"./models/data/order-transaction/index.js";export{IkasProductOption,IkasProductOptionDateSettings,IkasProductOptionFileSettings,IkasProductOptionSelectSettings,IkasProductOptionSelectType,IkasProductOptionSelectValue,IkasProductOptionSelectValueTranslations,IkasProductOptionSet,IkasProductOptionSetTranslations,IkasProductOptionTextSettings,IkasProductOptionTranslations,IkasProductOptionType}from"./models/data/product-option-set/index.js";export{IkasRaffle,IkasRaffleMetaData,IkasRaffleParticipant}from"./models/data/raffle/index.js";export{IkasSlider}from"./models/data/slider/index.js";export{IkasProductCampaign}from"./models/data/product-campaing/index.js";export{IkasTheme}from"./models/theme/theme.js";export{IkasThemePage,IkasThemePageType}from"./models/theme/page/index.js";export{IkasThemePageComponent}from"./models/theme/page/component/index.js";export{IkasThemeComponent}from"./models/theme/component/index.js";export{IkasThemeComponentProp,IkasThemeComponentPropType}from"./models/theme/component/prop/index.js";export{IkasLinkPropValue,IkasLinkType}from"./models/theme/page/component/prop-value/link.js";export{IkasBrandPropValue}from"./models/theme/page/component/prop-value/brand.js";export{IkasBrandListPropValue}from"./models/theme/page/component/prop-value/brand-list.js";export{IkasProductListPropValue}from"./models/theme/page/component/prop-value/product-list.js";export{IkasProductDetailPropValue}from"./models/theme/page/component/prop-value/product-detail.js";export{IkasCategoryPropValue}from"./models/theme/page/component/prop-value/category.js";export{IkasCategoryListPropValue}from"./models/theme/page/component/prop-value/category-list.js";export{IkasThemeSettings}from"./models/theme/settings/index.js";export{IkasThemeCustomData}from"./models/theme/custom-data/index.js";export{IkasBlogPropValue}from"./models/theme/page/component/prop-value/blog.js";export{IkasBlogListPropValue}from"./models/theme/page/component/prop-value/blog-list.js";export{IkasBlogCategoryPropValue}from"./models/theme/page/component/prop-value/blog-category.js";export{IkasBlogCategoryListPropValue}from"./models/theme/page/component/prop-value/blog-category-list.js";export{IkasRafflePropValue}from"./models/theme/page/component/prop-value/raffle.js";export{IkasRaffleListPropValue}from"./models/theme/page/component/prop-value/raffle-list.js";export{IkasBlogList,IkasBlogListType}from"./models/ui/blog-list/index.js";export{IkasBlogCategoryList,IkasBlogCategoryListType}from"./models/ui/blog-category-list/index.js";export{IkasBrandList,IkasBrandListSortType,IkasBrandListType}from"./models/ui/brand-list/index.js";export{IkasCategoryList,IkasCategoryListSortType,IkasCategoryListType}from"./models/ui/category-list/index.js";export{IkasNavigationLink}from"./models/ui/navigation-link/index.js";export{IkasProductDetail}from"./models/ui/product-detail/index.js";export{IkasProductList,IkasProductListSortType,IkasProductListType}from"./models/ui/product-list/index.js";export{IkasAttributeDetail}from"./models/ui/product-attribute-detail/index.js";export{IkasAttributeList}from"./models/ui/product-attribute-list/index.js";export{IkasCustomerReviewList}from"./models/ui/customer-review-list/index.js";export{Validator}from"./models/ui/validator/index.js";export{EmailRule,EqualsRule,IdentityNumberRule,LessThanRule,MaxRule,MinRule,PhoneRule,RequiredRule,ValidationRule,ValidatorErrorType}from"./models/ui/validator/rules/index.js";export{LoginForm}from"./models/ui/validator/form/login.js";export{AddressForm}from"./models/ui/validator/form/address.js";export{RegisterForm}from"./models/ui/validator/form/register.js";export{ContactForm}from"./models/ui/validator/form/contact-form.js";export{ForgotPasswordForm}from"./models/ui/validator/form/forgot-password.js";export{RecoverPasswordForm}from"./models/ui/validator/form/recover-password.js";export{AccountInfoForm}from"./models/ui/validator/form/account-info.js";export{RaffleForm}from"./models/ui/validator/form/raffle-form.js";export{CustomerReviewForm}from"./models/ui/validator/form/customer-review.js";export{IkasComponentRenderer}from"./models/ui/component-renderer/index.js";export{IkasRaffleList}from"./models/ui/raffle-list/index.js";import*as e from"./pages/home.js";export{e as IndexPage};import*as o from"./pages/_slug_/index.js";export{o as SlugPage};import*as t from"./pages/pages/_slug_.js";export{t as CustomPage};import*as r from"./pages/checkout.js";export{r as CheckoutPage};import*as a from"./pages/account/index.js";export{a as AccountPage};import*as s from"./pages/account/addresses.js";export{s as AddressesPage};import*as p from"./pages/account/orders/index.js";export{p as OrdersPage};import*as i from"./pages/account/orders/_id_.js";export{i as OrderDetailPage};import*as m from"./pages/account/login.js";export{m as LoginPage};import*as d from"./pages/account/register.js";export{d as RegisterPage};import*as n from"./pages/account/forgot-password.js";export{n as ForgotPasswordPage};import*as l from"./pages/account/recover-password.js";export{l as RecoverPasswordPage};import*as u from"./pages/cart.js";export{u as CartPage};import*as x from"./pages/editor.js";export{x as EditorPage};import*as c from"./pages/account/favorite-products.js";export{c as FavoriteProductsPage};import*as f from"./pages/search.js";export{f as SearchPage};import*as g from"./pages/404.js";export{g as NotFoundPage};import*as k from"./pages/blog/index.js";export{k as BlogPage};import*as I from"./pages/blog/_slug_.js";export{I as BlogSlugPage};import*as j from"./pages/raffle/_slug_.js";export{j as RafflePage};import*as P from"./pages/raffle/index.js";export{P as RafflesPage};import*as y from"./pages/account/raffles.js";export{y as AccountRafflesPage};export{APIGenerator}from"./scripts/generators/api/index.js";export{ComponentImportsGenerator}from"./scripts/generators/components/index.js";export{ConfigGenerator}from"./scripts/generators/config/index.js";export{PageGenerator}from"./scripts/generators/pages/index.js";export{StoreGenerator}from"./scripts/generators/store/index.js";export{ThemeJsonGenerator}from"./scripts/generators/theme/index.js";export{CustomDataTypesGenerator}from"./scripts/generators/types/index.js";export{IkasBaseStore}from"./store/base.js";export{IkasStorefrontConfig}from"./storefront/index.js";export{decodeBase64,findAllByKey,findAllIndexes,formatDate,pascalCase,sortObject,stringSorter,stringToSlug,tryForEach,validatePhoneNumber}from"./utils/helper.js";export{formatMoney,getCurrencySymbol}from"./utils/currency.js";export{createTranslationInputData,useTranslation}from"./utils/i18n.js";export{Analytics}from"./analytics/analytics.js";export{AnalyticsBody,AnalyticsHead}from"./analytics/head/index.js";
@@ -19,6 +19,7 @@ export declare class IkasProductFilter {
19
19
  private productList?;
20
20
  constructor(data?: Partial<IkasProductFilter>, productList?: IkasProductList | undefined | null);
21
21
  get isCustomValueFilter(): boolean;
22
+ get isStockFilter(): boolean;
22
23
  get valueList(): string[];
23
24
  get keyList(): string[];
24
25
  get displayedValues(): IkasApplicableProductFilterValue[];
@@ -89,6 +90,10 @@ export declare enum IkasProductFilterSortType {
89
90
  PRODUCT_COUNT_ASC = "PRODUCT_COUNT_ASC",
90
91
  PRODUCT_COUNT_DESC = "PRODUCT_COUNT_DESC"
91
92
  }
93
+ export declare enum IkasProductStockFilterValue {
94
+ IN_STOCK = "in-stock",
95
+ OUT_OF_STOCK = "out-of-stock"
96
+ }
92
97
  export declare class RangeValue {
93
98
  from: number;
94
99
  to: number | undefined | null;
@@ -1 +1 @@
1
- import{__assign as t}from'../../../ext/tslib/tslib.es6.js';import{makeAutoObservable as e}from"mobx";import{IkasImage as i}from"../image/index.js";import n from'../../../ext/lodash/sortBy.js';import s from'../../../ext/lodash/cloneDeep.js';var o,u,l,r=function(){function i(i,n){if(void 0===i&&(i={}),this.values=null,this.customValues=null,this.settings=null,this._numberRange=null,this.numberRangeLimit=null,this.numberRangeListOptions=null,this.productList=null,this.id=i.id||"",this.key=i.key||"",this.name=i.name||"",this.order=i.order||0,this.type=i.type||o.BRAND,this.displayType=i.displayType||u.BOX,this.isMultiSelect=i.isMultiSelect||!1,this.isFacetFilter=i.isFacetFilter||!1,this.values=i.values?i.values.map((function(t){return new a(t)})):null,this.customValues=i.customValues||null,this.settings=i.settings?new c(i.settings):null,this.displayType===u.NUMBER_RANGE_LIST&&this.customValues&&this.customValues.length&&(this.numberRangeListOptions=this.customValues.map((function(e){return new p(t(t({key:e},m(e)),{isSelected:!1}))}))),this.displayType===u.NUMBER_RANGE&&this.customValues&&this.customValues.length){var s=this.customValues[0];this.numberRangeLimit=m(s)}this.productList=n,e(this)}return Object.defineProperty(i.prototype,"isCustomValueFilter",{get:function(){return[u.NUMBER_RANGE_LIST,u.NUMBER_RANGE].includes(this.displayType)},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"valueList",{get:function(){var t,e=this;return this._numberRange?[this.rangeToId(this._numberRange)]:this.numberRangeListOptions?this.numberRangeListOptions.filter((function(t){return t.isSelected})).map((function(t){return e.rangeToId(t)})):(null===(t=this.values)||void 0===t?void 0:t.filter((function(t){return t.isSelected})).map((function(t){return t.id})))||[]},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"keyList",{get:function(){var t,e=this;return this._numberRange?[this.rangeToId(this._numberRange)]:this.numberRangeListOptions?this.numberRangeListOptions.filter((function(t){return t.isSelected})).map((function(t){return e.rangeToId(t)})):(null===(t=this.values)||void 0===t?void 0:t.filter((function(t){return t.isSelected})).map((function(t){return t.key})))||[]},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"displayedValues",{get:function(){var t,e,i=(null===(t=this.settings)||void 0===t?void 0:t.sortType)||l.ALPHABETICAL_ASC,s=[l.ALPHABETICAL_DESC,l.PRODUCT_COUNT_DESC].includes(i),o=[l.ALPHABETICAL_ASC,l.ALPHABETICAL_DESC].includes(i),u=null===(e=this.values)||void 0===e?void 0:e.filter((function(t){return 0!==t.resultCount||t.isSelected}));return u=n(u,o?"name":"resultCount"),s&&(u=null==u?void 0:u.reverse()),u},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"numberRange",{get:function(){return this._numberRange},enumerable:!1,configurable:!0}),i.prototype.onFilterValueClick=function(t){var e,i;if(this.isCustomValueFilter)throw new Error("onFilterValueClick cannot be used with NUMBER_RANGE | NUMBER_RANGE_LIST types!");t._isSelected=!t.isSelected,!this.isMultiSelect&&t.isSelected&&(null===(e=this.values)||void 0===e||e.forEach((function(e){e.id!==t.id&&(e._isSelected=!1)}))),null===(i=this.productList)||void 0===i||i.applyFilters()},i.prototype.onNumberRangeClick=function(t){var e,i;if(this.displayType!==u.NUMBER_RANGE_LIST)throw new Error("onNumberRangeClick can only be used with NUMBER_RANGE filters!");t._isSelected=!t.isSelected,!this.isMultiSelect&&t.isSelected&&(null===(e=this.numberRangeListOptions)||void 0===e||e.forEach((function(e){e.key!==t.key&&(e._isSelected=!1)}))),null===(i=this.productList)||void 0===i||i.applyFilters()},i.prototype.onNumberRangeChange=function(t){var e,i,n;if(this.displayType!==u.NUMBER_RANGE)throw new Error("onNumberRangeChange can only be used with NUMBER_RANGE filters!");if(!t)return this._numberRange=null,void(null===(e=this.productList)||void 0===e||e.applyFilters());var o=new d(s(t));o.from<this.numberRangeLimit.from&&(o.from=this._numberRange.from),o.to&&(null===(i=this.numberRangeLimit)||void 0===i?void 0:i.to)&&o.to>this.numberRangeLimit.to&&(o.to=this.numberRangeLimit.to),this._numberRange=o,null===(n=this.productList)||void 0===n||n.applyFilters()},i.prototype.clear=function(){var t,e;this._numberRange=null,null===(t=this.numberRangeListOptions)||void 0===t||t.forEach((function(t){return t._isSelected=!1})),null===(e=this.values)||void 0===e||e.forEach((function(t){return t._isSelected=!1}))},i.prototype.toInput=function(){var t;return{id:this.key,type:this.type,valueList:this.valueList,useAndFilter:null===(t=this.settings)||void 0===t?void 0:t.useAndFilter}},i.prototype.toJSON=function(){var e=t({},this);return delete e.productList,e},i.prototype.applyQueryParam=function(t){var e,i,n=t.split(",");this.displayType===u.NUMBER_RANGE?this._numberRange=new d(m(t)):this.displayType===u.NUMBER_RANGE_LIST?null===(e=this.numberRangeListOptions)||void 0===e||e.forEach((function(t){n.includes(t.key)&&(t._isSelected=!0)})):null===(i=this.values)||void 0===i||i.forEach((function(t){n.includes(t.key)&&0!==t.resultCount&&(t._isSelected=!0)}))},i.prototype.rangeToId=function(t){return"".concat(t.from,":").concat(t.to||"")},i}(),a=function(){function n(t){void 0===t&&(t={}),this.colorCode=null,this.thumbnailImageId=null,this.thumbnailImage=null,this.resultCount=null,this._isSelected=!1,this.id=t.id||"",this.key=t.key||"",this.name=t.name||"",this.colorCode=t.colorCode||null,this.thumbnailImageId=t.thumbnailImageId||null,this.thumbnailImageId&&(this.thumbnailImage=new i(this.thumbnailImageId)),this._isSelected=t.isSelected||!1,this.resultCount=void 0!==t.resultCount&&null!==t.resultCount?t.resultCount:null,e(this)}return Object.defineProperty(n.prototype,"isSelected",{get:function(){return this._isSelected},enumerable:!1,configurable:!0}),n.prototype.toJSON=function(){return t(t({},this),{isSelected:this._isSelected})},n}(),h=function(t){this.id=t.id,this.type=t.type,this.displayType=t.displayType,this.valueList=t.valueList,e(this)},c=function(t){this.useAndFilter=null,this.useAndFilter=t.useAndFilter||!1,this.showCollapsedOnDesktop=t.showCollapsedOnDesktop||!1,this.showCollapsedOnMobile=t.showCollapsedOnMobile||!1,this.sortType=t.sortType||l.ALPHABETICAL_ASC,e(this)};!function(t){t.ATTRIBUTE="ATTRIBUTE",t.BRAND="BRAND",t.DISCOUNT_RATIO="DISCOUNT_RATIO",t.PRICE="PRICE",t.STOCK_STATUS="STOCK_STATUS",t.TAG="TAG",t.VARIANT_TYPE="VARIANT_TYPE"}(o||(o={})),function(t){t.BOX="BOX",t.DATE_RANGE="DATE_RANGE",t.LIST="LIST",t.NUMBER_RANGE_LIST="NUMBER_RANGE_LIST",t.NUMBER_RANGE="NUMBER_RANGE",t.SWATCH="SWATCH"}(u||(u={})),function(t){t.ALPHABETICAL_ASC="ALPHABETICAL_ASC",t.ALPHABETICAL_DESC="ALPHABETICAL_DESC",t.PRODUCT_COUNT_ASC="PRODUCT_COUNT_ASC",t.PRODUCT_COUNT_DESC="PRODUCT_COUNT_DESC"}(l||(l={}));var d=function(t){this.from=t.from||0,this.to=t.to||null,e(this)},p=function(){function i(t){this.from=t.from||0,this.to=t.to||null,this.key=t.key||"",this._isSelected=t.isSelected||!1,e(this)}return Object.defineProperty(i.prototype,"isSelected",{get:function(){return this._isSelected},enumerable:!1,configurable:!0}),i.prototype.toJSON=function(){return t(t({},this),{isSelected:this._isSelected})},i}();function m(t){try{var e=t.split(":").map((function(t){return parseInt(t)}));return new d({from:isNaN(e[0])?0:e[0],to:isNaN(e[1])?void 0:e[1]})}catch(t){return console.log(t),new d({from:0,to:0})}}export{a as IkasApplicableProductFilterValue,r as IkasProductFilter,u as IkasProductFilterDisplayType,c as IkasProductFilterSettings,l as IkasProductFilterSortType,o as IkasProductFilterType,h as IkasProductFilterValue,d as RangeValue,m as parseRangeStr};
1
+ import{__assign as t}from'../../../ext/tslib/tslib.es6.js';import{makeAutoObservable as e}from"mobx";import{IkasImage as i}from"../image/index.js";import n from'../../../ext/lodash/sortBy.js';import s from'../../../ext/lodash/cloneDeep.js';var o,r,u,l,a=function(){function i(i,n){if(void 0===i&&(i={}),this.values=null,this.customValues=null,this.settings=null,this._numberRange=null,this.numberRangeLimit=null,this.numberRangeListOptions=null,this.productList=null,this.id=i.id||"",this.key=i.key||"",this.name=i.name||"",this.order=i.order||0,this.type=i.type||o.BRAND,this.displayType=i.displayType||r.BOX,this.isMultiSelect=i.isMultiSelect||!1,this.isFacetFilter=i.isFacetFilter||!1,this.values=i.values?i.values.map((function(t){return new c(t)})):null,this.customValues=i.customValues||null,this.settings=i.settings?new d(i.settings):null,this.displayType===r.NUMBER_RANGE_LIST&&this.customValues&&this.customValues.length&&(this.numberRangeListOptions=this.customValues.map((function(e){return new m(t(t({key:e},f(e)),{isSelected:!1}))}))),this.displayType===r.NUMBER_RANGE&&this.customValues&&this.customValues.length){var s=this.customValues[0];this.numberRangeLimit=f(s)}this.productList=n,e(this)}return Object.defineProperty(i.prototype,"isCustomValueFilter",{get:function(){return[r.NUMBER_RANGE_LIST,r.NUMBER_RANGE].includes(this.displayType)},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"isStockFilter",{get:function(){return this.type===o.STOCK_STATUS},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"valueList",{get:function(){var t,e=this;return this._numberRange?[this.rangeToId(this._numberRange)]:this.numberRangeListOptions?this.numberRangeListOptions.filter((function(t){return t.isSelected})).map((function(t){return e.rangeToId(t)})):(null===(t=this.values)||void 0===t?void 0:t.filter((function(t){return t.isSelected})).map((function(t){return t.id})))||[]},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"keyList",{get:function(){var t,e=this;return this._numberRange?[this.rangeToId(this._numberRange)]:this.numberRangeListOptions?this.numberRangeListOptions.filter((function(t){return t.isSelected})).map((function(t){return e.rangeToId(t)})):(null===(t=this.values)||void 0===t?void 0:t.filter((function(t){return t.isSelected})).map((function(t){return t.key})))||[]},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"displayedValues",{get:function(){var t,e,i=(null===(t=this.settings)||void 0===t?void 0:t.sortType)||u.ALPHABETICAL_ASC,s=[u.ALPHABETICAL_DESC,u.PRODUCT_COUNT_DESC].includes(i),o=[u.ALPHABETICAL_ASC,u.ALPHABETICAL_DESC].includes(i),r=null===(e=this.values)||void 0===e?void 0:e.filter((function(t){return 0!==t.resultCount||t.isSelected}));return r=n(r,o?"name":"resultCount"),s&&(r=null==r?void 0:r.reverse()),r},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"numberRange",{get:function(){return this._numberRange},enumerable:!1,configurable:!0}),i.prototype.onFilterValueClick=function(t){var e,i;if(this.isCustomValueFilter)throw new Error("onFilterValueClick cannot be used with NUMBER_RANGE | NUMBER_RANGE_LIST types!");t._isSelected=!t.isSelected,!this.isMultiSelect&&t.isSelected&&(null===(e=this.values)||void 0===e||e.forEach((function(e){e.id!==t.id&&(e._isSelected=!1)}))),null===(i=this.productList)||void 0===i||i.applyFilters()},i.prototype.onNumberRangeClick=function(t){var e,i;if(this.displayType!==r.NUMBER_RANGE_LIST)throw new Error("onNumberRangeClick can only be used with NUMBER_RANGE filters!");t._isSelected=!t.isSelected,!this.isMultiSelect&&t.isSelected&&(null===(e=this.numberRangeListOptions)||void 0===e||e.forEach((function(e){e.key!==t.key&&(e._isSelected=!1)}))),null===(i=this.productList)||void 0===i||i.applyFilters()},i.prototype.onNumberRangeChange=function(t){var e,i,n;if(this.displayType!==r.NUMBER_RANGE)throw new Error("onNumberRangeChange can only be used with NUMBER_RANGE filters!");if(!t)return this._numberRange=null,void(null===(e=this.productList)||void 0===e||e.applyFilters());var o=new p(s(t));o.from<this.numberRangeLimit.from&&(o.from=this._numberRange.from),o.to&&(null===(i=this.numberRangeLimit)||void 0===i?void 0:i.to)&&o.to>this.numberRangeLimit.to&&(o.to=this.numberRangeLimit.to),this._numberRange=o,null===(n=this.productList)||void 0===n||n.applyFilters()},i.prototype.clear=function(){var t,e;this._numberRange=null,null===(t=this.numberRangeListOptions)||void 0===t||t.forEach((function(t){return t._isSelected=!1})),null===(e=this.values)||void 0===e||e.forEach((function(t){return t._isSelected=!1}))},i.prototype.toInput=function(){var t;return{id:this.key,type:this.type,valueList:this.valueList,useAndFilter:null===(t=this.settings)||void 0===t?void 0:t.useAndFilter}},i.prototype.toJSON=function(){var e=t({},this);return delete e.productList,e},i.prototype.applyQueryParam=function(t){var e,i,n=t.split(",");this.displayType===r.NUMBER_RANGE?this._numberRange=new p(f(t)):this.displayType===r.NUMBER_RANGE_LIST?null===(e=this.numberRangeListOptions)||void 0===e||e.forEach((function(t){n.includes(t.key)&&(t._isSelected=!0)})):null===(i=this.values)||void 0===i||i.forEach((function(t){n.includes(t.key)&&0!==t.resultCount&&(t._isSelected=!0)}))},i.prototype.rangeToId=function(t){return"".concat(t.from,":").concat(t.to||"")},i}(),c=function(){function n(t){void 0===t&&(t={}),this.colorCode=null,this.thumbnailImageId=null,this.thumbnailImage=null,this.resultCount=null,this._isSelected=!1,this.id=t.id||"",this.key=t.key||"",this.name=t.name||"",this.colorCode=t.colorCode||null,this.thumbnailImageId=t.thumbnailImageId||null,this.thumbnailImageId&&(this.thumbnailImage=new i(this.thumbnailImageId)),this._isSelected=t.isSelected||!1,this.resultCount=void 0!==t.resultCount&&null!==t.resultCount?t.resultCount:null,e(this)}return Object.defineProperty(n.prototype,"isSelected",{get:function(){return this._isSelected},enumerable:!1,configurable:!0}),n.prototype.toJSON=function(){return t(t({},this),{isSelected:this._isSelected})},n}(),h=function(t){this.id=t.id,this.type=t.type,this.displayType=t.displayType,this.valueList=t.valueList,e(this)},d=function(t){this.useAndFilter=null,this.useAndFilter=t.useAndFilter||!1,this.showCollapsedOnDesktop=t.showCollapsedOnDesktop||!1,this.showCollapsedOnMobile=t.showCollapsedOnMobile||!1,this.sortType=t.sortType||u.ALPHABETICAL_ASC,e(this)};!function(t){t.ATTRIBUTE="ATTRIBUTE",t.BRAND="BRAND",t.DISCOUNT_RATIO="DISCOUNT_RATIO",t.PRICE="PRICE",t.STOCK_STATUS="STOCK_STATUS",t.TAG="TAG",t.VARIANT_TYPE="VARIANT_TYPE"}(o||(o={})),function(t){t.BOX="BOX",t.DATE_RANGE="DATE_RANGE",t.LIST="LIST",t.NUMBER_RANGE_LIST="NUMBER_RANGE_LIST",t.NUMBER_RANGE="NUMBER_RANGE",t.SWATCH="SWATCH"}(r||(r={})),function(t){t.ALPHABETICAL_ASC="ALPHABETICAL_ASC",t.ALPHABETICAL_DESC="ALPHABETICAL_DESC",t.PRODUCT_COUNT_ASC="PRODUCT_COUNT_ASC",t.PRODUCT_COUNT_DESC="PRODUCT_COUNT_DESC"}(u||(u={})),function(t){t.IN_STOCK="in-stock",t.OUT_OF_STOCK="out-of-stock"}(l||(l={}));var p=function(t){this.from=t.from||0,this.to=t.to||null,e(this)},m=function(){function i(t){this.from=t.from||0,this.to=t.to||null,this.key=t.key||"",this._isSelected=t.isSelected||!1,e(this)}return Object.defineProperty(i.prototype,"isSelected",{get:function(){return this._isSelected},enumerable:!1,configurable:!0}),i.prototype.toJSON=function(){return t(t({},this),{isSelected:this._isSelected})},i}();function f(t){try{var e=t.split(":").map((function(t){return parseInt(t)}));return new p({from:isNaN(e[0])?0:e[0],to:isNaN(e[1])?void 0:e[1]})}catch(t){return console.log(t),new p({from:0,to:0})}}export{c as IkasApplicableProductFilterValue,a as IkasProductFilter,r as IkasProductFilterDisplayType,d as IkasProductFilterSettings,u as IkasProductFilterSortType,o as IkasProductFilterType,h as IkasProductFilterValue,l as IkasProductStockFilterValue,p as RangeValue,f as parseRangeStr};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ikas/storefront",
3
- "version": "2.0.24",
3
+ "version": "2.0.25",
4
4
  "main": "./build/index.js",
5
5
  "module": "./build/index.js",
6
6
  "author": "Umut Ozan Yıldırım",