@ikas/storefront 5.0.11 → 5.0.13

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.
Files changed (156) hide show
  1. package/build/analytics/analytics.js +1 -1
  2. package/build/analytics/googleAnalytics.js +1 -1
  3. package/build/analytics/googleTagManager.js +1 -1
  4. package/build/analytics/ikas.js +1 -1
  5. package/build/components/checkout/components/address-form/model.js +1 -1
  6. package/build/components/checkout/components/cart-summary/cart-item/index.js +1 -1
  7. package/build/components/checkout/components/cart-summary/index.js +1 -1
  8. package/build/components/checkout/components/customer-addresses/model.js +1 -1
  9. package/build/components/checkout/components/error/argument-validation-error/index.d.ts +8 -0
  10. package/build/components/checkout/components/error/argument-validation-error/index.js +1 -0
  11. package/build/components/checkout/components/error/index.js +1 -1
  12. package/build/components/checkout/components/master-pass/credit-card-form/index.js +1 -1
  13. package/build/components/checkout/components/master-pass/modal-otp/index.js +1 -1
  14. package/build/components/checkout/components/offer-product/index.js +1 -1
  15. package/build/components/checkout/components/quick-registration/model.js +1 -1
  16. package/build/components/checkout/index.js +1 -1
  17. package/build/components/checkout/model.d.ts +2 -2
  18. package/build/components/checkout/model.js +1 -1
  19. package/build/components/checkout/modelMasterPass.js +1 -1
  20. package/build/components/checkout/steps/step-payment/payment-gateways/index.js +1 -1
  21. package/build/components/checkout/steps/step-success/index.js +1 -1
  22. package/build/components/page/head.js +1 -1
  23. package/build/components/page/index.js +1 -1
  24. package/build/components/page-editor/ThemeComponentEditor.js +1 -1
  25. package/build/components/page-editor/model.js +1 -1
  26. package/build/components/popup/index.d.ts +2 -0
  27. package/build/components/popup/index.js +1 -0
  28. package/build/components/popup/renderer/index.d.ts +11 -0
  29. package/build/components/popup/renderer/index.js +1 -0
  30. package/build/components/popup/renderer/model.d.ts +21 -0
  31. package/build/components/popup/renderer/model.js +1 -0
  32. package/build/components/popup/utils/index.d.ts +8 -0
  33. package/build/components/popup/utils/index.js +1 -0
  34. package/build/ext/@ikas/popup-renderer/build/ext/tslib/tslib.es6.mjs.js +1 -0
  35. package/build/ext/@ikas/popup-renderer/build/popup-renderer/assets/left-arrow.js +1 -0
  36. package/build/ext/@ikas/popup-renderer/build/popup-renderer/assets/right-arrow.js +1 -0
  37. package/build/ext/@ikas/popup-renderer/build/popup-renderer/assets/x-close.js +1 -0
  38. package/build/ext/@ikas/popup-renderer/build/popup-renderer/components/button-element-renderer/index.js +1 -0
  39. package/build/ext/@ikas/popup-renderer/build/popup-renderer/components/divider-element-renderer/index.js +1 -0
  40. package/build/ext/@ikas/popup-renderer/build/popup-renderer/components/form-element-renderer/checkbox-item-view/index.js +1 -0
  41. package/build/ext/@ikas/popup-renderer/build/popup-renderer/components/form-element-renderer/date-item-view/index.js +1 -0
  42. package/build/ext/@ikas/popup-renderer/build/popup-renderer/components/form-element-renderer/gender-item-view/index.js +1 -0
  43. package/build/ext/@ikas/popup-renderer/build/popup-renderer/components/form-element-renderer/index.js +1 -0
  44. package/build/ext/@ikas/popup-renderer/build/popup-renderer/components/form-element-renderer/input-item-view/index.js +1 -0
  45. package/build/ext/@ikas/popup-renderer/build/popup-renderer/components/image-column-element-renderer/index.js +1 -0
  46. package/build/ext/@ikas/popup-renderer/build/popup-renderer/components/image-element-renderer/index.js +1 -0
  47. package/build/ext/@ikas/popup-renderer/build/popup-renderer/components/index.js +1 -0
  48. package/build/ext/@ikas/popup-renderer/build/popup-renderer/components/product-list-renderer/index.js +1 -0
  49. package/build/ext/@ikas/popup-renderer/build/popup-renderer/components/social-element-renderer/index.js +1 -0
  50. package/build/ext/@ikas/popup-renderer/build/popup-renderer/components/space-element-renderer/index.js +1 -0
  51. package/build/ext/@ikas/popup-renderer/build/popup-renderer/components/text-element-renderer/index.js +1 -0
  52. package/build/ext/@ikas/popup-renderer/build/popup-renderer/helpers/index.js +1 -0
  53. package/build/ext/@ikas/popup-renderer/build/popup-renderer/models/index.js +1 -0
  54. package/build/ext/@ikas/popup-renderer/build/popup-renderer/models/modal/background-settings/index.js +1 -0
  55. package/build/ext/@ikas/popup-renderer/build/popup-renderer/models/modal/close-settings/index.js +1 -0
  56. package/build/ext/@ikas/popup-renderer/build/popup-renderer/models/modal/index.js +1 -0
  57. package/build/ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/base/index.js +1 -0
  58. package/build/ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/button/index.js +1 -0
  59. package/build/ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/divider/index.js +1 -0
  60. package/build/ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/form/checkbox/index.js +1 -0
  61. package/build/ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/form/customer-attribute/index.js +1 -0
  62. package/build/ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/form/customer-birthday/index.js +1 -0
  63. package/build/ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/form/customer-email/index.js +1 -0
  64. package/build/ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/form/customer-gender/index.js +1 -0
  65. package/build/ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/form/customer-name/index.js +1 -0
  66. package/build/ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/form/customer-phone/index.js +1 -0
  67. package/build/ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/form/customer-surname/index.js +1 -0
  68. package/build/ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/form/form-settings/index.js +1 -0
  69. package/build/ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/form/index.js +1 -0
  70. package/build/ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/image/index.js +1 -0
  71. package/build/ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/image-column/index.js +1 -0
  72. package/build/ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/product/detail-settings/index.js +1 -0
  73. package/build/ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/product/index.js +1 -0
  74. package/build/ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/social/index.js +1 -0
  75. package/build/ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/space/index.js +1 -0
  76. package/build/ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/elements/text/index.js +1 -0
  77. package/build/ext/@ikas/popup-renderer/build/popup-renderer/models/modal/step/index.js +1 -0
  78. package/build/ext/@ikas/popup-renderer/build/popup-renderer/models/modal/teaser/index.js +1 -0
  79. package/build/ext/@ikas/popup-renderer/build/popup-renderer/models/modal/window-settings/index.js +1 -0
  80. package/build/ext/@ikas/popup-renderer/build/popup-renderer/models/settings/index.js +1 -0
  81. package/build/ext/@ikas/popup-renderer/build/popup-renderer/models/settings/visibility-condition/index.js +1 -0
  82. package/build/ext/@ikas/popup-renderer/build/popup-renderer/models/settings/visibility-time/index.js +1 -0
  83. package/build/ext/mobx-react/dist/mobxreact.esm.js +1 -0
  84. package/build/ext/swiper/modules/navigation.css.js +1 -0
  85. package/build/ext/swiper/modules/navigation.mjs.js +1 -0
  86. package/build/ext/swiper/modules/pagination.css.js +1 -0
  87. package/build/ext/swiper/modules/scrollbar.mjs.js +1 -0
  88. package/build/ext/swiper/shared/classes-to-selector.mjs.js +1 -0
  89. package/build/ext/swiper/shared/create-element-if-not-defined.mjs.js +1 -0
  90. package/build/ext/swiper/shared/ssr-window.esm.mjs.js +1 -0
  91. package/build/ext/swiper/shared/swiper-core.mjs.js +1 -0
  92. package/build/ext/swiper/shared/update-on-virtual-data.mjs.js +1 -0
  93. package/build/ext/swiper/shared/update-swiper.mjs.js +1 -0
  94. package/build/ext/swiper/shared/utils.mjs.js +1 -0
  95. package/build/ext/swiper/swiper-react.mjs.js +1 -0
  96. package/build/ext/swiper/swiper.css.js +1 -0
  97. package/build/hooks/useCustomerReviews.js +1 -1
  98. package/build/hooks/useStore.js +1 -1
  99. package/build/index.js +1 -1
  100. package/build/models/data/customer/index.d.ts +8 -1
  101. package/build/models/data/customer/index.js +1 -1
  102. package/build/models/data/customer-form-data-input/customer-register-subscription-input/index.d.ts +7 -0
  103. package/build/models/data/customer-form-data-input/customer-register-subscription-input/index.js +1 -0
  104. package/build/models/data/customer-form-data-input/index.d.ts +19 -0
  105. package/build/models/data/customer-form-data-input/index.js +1 -0
  106. package/build/models/data/index.d.ts +2 -0
  107. package/build/models/data/product/index.js +1 -1
  108. package/build/models/data/storefront-popup/index.d.ts +40 -0
  109. package/build/models/data/storefront-popup/index.js +1 -0
  110. package/build/models/data/storefront-popup/storefront-popup-analytics/index.d.ts +7 -0
  111. package/build/models/data/storefront-popup/storefront-popup-analytics/index.js +1 -0
  112. package/build/models/data/storefront-popup/storefront-popup-date-f/304/261lter/index.d.ts +6 -0
  113. package/build/models/data/storefront-popup/storefront-popup-date-f/304/261lter/index.js +1 -0
  114. package/build/models/data/storefront-popup/storefront-popup-display-filter/index.d.ts +11 -0
  115. package/build/models/data/storefront-popup/storefront-popup-display-filter/index.js +1 -0
  116. package/build/models/data/storefront-popup/storefront-popup-display-settings/index.d.ts +16 -0
  117. package/build/models/data/storefront-popup/storefront-popup-display-settings/index.js +1 -0
  118. package/build/models/data/storefront-popup/storefront-popup-page-filter/index.d.ts +16 -0
  119. package/build/models/data/storefront-popup/storefront-popup-page-filter/index.js +1 -0
  120. package/build/models/data/storefront-popup/storefront-popup-page-filter/storefront-popup-page-filter-data/index.d.ts +12 -0
  121. package/build/models/data/storefront-popup/storefront-popup-page-filter/storefront-popup-page-filter-data/index.js +1 -0
  122. package/build/models/data/storefront-popup/storefront-popup-routing/index.d.ts +6 -0
  123. package/build/models/data/storefront-popup/storefront-popup-routing/index.js +1 -0
  124. package/build/models/ui/blog-category-list/index.js +1 -1
  125. package/build/models/ui/brand-list/index.js +1 -1
  126. package/build/models/ui/category-list/index.js +1 -1
  127. package/build/models/ui/customer-review-list/index.d.ts +3 -0
  128. package/build/models/ui/customer-review-list/index.js +1 -1
  129. package/build/models/ui/customer-review-summary-list/index.js +1 -1
  130. package/build/models/ui/product-list/index.js +1 -1
  131. package/build/models/ui/raffle-list/index.js +1 -1
  132. package/build/models/ui/validator/form/account-info.js +1 -1
  133. package/build/models/ui/validator/form/address.js +1 -1
  134. package/build/models/ui/validator/form/ikas-address.js +1 -1
  135. package/build/models/ui/validator/form/register.js +1 -1
  136. package/build/page-data-init/index.js +1 -1
  137. package/build/pages/checkout.js +1 -1
  138. package/build/store/blog/index.js +1 -1
  139. package/build/store/brand/index.js +1 -1
  140. package/build/store/cart/index.js +1 -1
  141. package/build/store/category/index.js +1 -1
  142. package/build/store/checkout/index.js +1 -1
  143. package/build/store/customer/api.d.ts +2 -1
  144. package/build/store/customer/api.js +1 -1
  145. package/build/store/customer/index.d.ts +2 -0
  146. package/build/store/customer/index.js +1 -1
  147. package/build/store/html-meta-data/index.js +1 -1
  148. package/build/store/location/index.js +1 -1
  149. package/build/store/product/index.js +1 -1
  150. package/build/store/storefront-popup/index.d.ts +74 -0
  151. package/build/store/storefront-popup/index.js +1 -0
  152. package/package.json +18 -12
  153. package/build/components/checkout/components/epaykolay-button/index.d.ts +0 -5
  154. package/build/components/checkout/components/epaykolay-button/index.js +0 -1
  155. package/build/components/checkout/components/epaykolay-button/style.module.scss.js +0 -1
  156. package/build/components/checkout/components/svg/epaykolay.js +0 -1
@@ -1 +1 @@
1
- import{__awaiter as t,__generator as i}from'./../../../ext/tslib/tslib.es6.js';import{makeAutoObservable as e}from"mobx";import a from"../../../store/blog/index.js";import{IkasBlogCategory as o}from"../../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"@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/district/index.js";import"../../data/favorite-product/index.js";import"../../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/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"../../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"../../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/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";var r,n=function(){function n(a){var n=this;this._initialized=!1,this._minPage=null,this._isLoading=!1,this.getPrev=function(){return t(n,void 0,void 0,(function(){var t,e,a,o,r,n;return i(this,(function(i){switch(i.label){case 0:if(this.isStatic||this._isLoading||!this.hasPrev)return[2];this._isLoading=!0,i.label=1;case 1:return i.trys.push([1,3,4,5]),t=this._minPage-1,[4,this.listBlogCategories(t,this.limit)];case 2:return e=i.sent(),this.data=(null===(r=null===(o=e.data)||void 0===o?void 0:o.data)||void 0===r?void 0:r.concat(this.data))||this.data,this._count=(null===(n=e.data)||void 0===n?void 0:n.count)||this._count,this._minPage=t,[3,5];case 3:return a=i.sent(),console.log(a),[3,5];case 4:return this._isLoading=!1,[7];case 5:return[2]}}))}))},this.getNext=function(){return t(n,void 0,void 0,(function(){var t,e,a,o;return i(this,(function(i){switch(i.label){case 0:if(this.isStatic||this._isLoading||!this.hasNext)return[2];this._isLoading=!0,i.label=1;case 1:return i.trys.push([1,3,4,5]),[4,this.listBlogCategories(this.page+1,this.limit)];case 2:return t=i.sent(),this.data=this.data.concat((null===(a=t.data)||void 0===a?void 0:a.data)||[]),this._count=(null===(o=t.data)||void 0===o?void 0:o.count)||this._count,this._page=this.page+1,[3,5];case 3:return e=i.sent(),console.log(e),[3,5];case 4:return this._isLoading=!1,[7];case 5:return[2]}}))}))},this.getPage=function(e){return t(n,void 0,void 0,(function(){var t,a,o,r;return i(this,(function(i){switch(i.label){case 0:if(this._isLoading||this.isStatic)return[2];this._isLoading=!0,i.label=1;case 1:return i.trys.push([1,3,4,5]),[4,this.listBlogCategories(e,this.limit)];case 2:return t=i.sent(),this.data=(null===(o=t.data)||void 0===o?void 0:o.data)||[],this._count=(null===(r=t.data)||void 0===r?void 0:r.count)||0,this._page=e,this._minPage=e,[3,5];case 3:return a=i.sent(),console.log(a),[3,5];case 4:return this._isLoading=!1,[7];case 5:return[2]}}))}))},this.data=a.data?a.data.map((function(t){return new o(t)})):[],this._type=a.type||a.blogCategoryListPropValue.blogCategoryListType||r.ALL,this._limit=a.limit||a.blogCategoryListPropValue.initialLimit||20,this._page=a.page||1,this._count=a.count||0,this._initialized=a.initialized||!1,this._minPage=a.minPage,this._blogCategoryListPropValue=a.blogCategoryListPropValue,e(this)}return Object.defineProperty(n.prototype,"limit",{get:function(){return this._limit},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"page",{get:function(){return this._page},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"count",{get:function(){return this._count},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"pageCount",{get:function(){return Math.ceil(this._count/this._limit)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"isInitialized",{get:function(){return this._initialized},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"isStatic",{get:function(){return this._type===r.STATIC},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"hasPrev",{get:function(){return!(this.isStatic||!this._minPage)&&this._minPage>1},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"hasNext",{get:function(){return!this.isStatic&&this.page*this.limit<this.count},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"isLoading",{get:function(){return this._isLoading},enumerable:!1,configurable:!0}),n.prototype.listBlogCategories=function(e,o){return t(this,void 0,void 0,(function(){return i(this,(function(t){switch(t.label){case 0:return[4,a.listBlogCategory({id:this.isStatic&&this._blogCategoryListPropValue.blogCategoryIds?{in:this._blogCategoryListPropValue.blogCategoryIds}:void 0,pagination:{page:e,limit:o}})];case 1:return[2,t.sent()]}}))}))},n.prototype.toJSON=function(){return{data:this.data,type:this._type,limit:this._limit,page:this._page,count:this._count,initialized:this._initialized,minPage:this._minPage,blogCategoryListPropValue:this._blogCategoryListPropValue}},n}();!function(t){t.ALL="ALL",t.STATIC="STATIC"}(r||(r={}));export{n as IkasBlogCategoryList,r as IkasBlogCategoryListType};
1
+ import{__awaiter as t,__generator as i}from'./../../../ext/tslib/tslib.es6.js';import{makeAutoObservable as e}from"mobx";import a from"../../../store/blog/index.js";import{IkasBlogCategory as o}from"../../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"@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"../../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/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"../../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"../../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/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";var r,n=function(){function n(a){var n=this;this._initialized=!1,this._minPage=null,this._isLoading=!1,this.getPrev=function(){return t(n,void 0,void 0,(function(){var t,e,a,o,r,n;return i(this,(function(i){switch(i.label){case 0:if(this.isStatic||this._isLoading||!this.hasPrev)return[2];this._isLoading=!0,i.label=1;case 1:return i.trys.push([1,3,4,5]),t=this._minPage-1,[4,this.listBlogCategories(t,this.limit)];case 2:return e=i.sent(),this.data=(null===(r=null===(o=e.data)||void 0===o?void 0:o.data)||void 0===r?void 0:r.concat(this.data))||this.data,this._count=(null===(n=e.data)||void 0===n?void 0:n.count)||this._count,this._minPage=t,[3,5];case 3:return a=i.sent(),console.log(a),[3,5];case 4:return this._isLoading=!1,[7];case 5:return[2]}}))}))},this.getNext=function(){return t(n,void 0,void 0,(function(){var t,e,a,o;return i(this,(function(i){switch(i.label){case 0:if(this.isStatic||this._isLoading||!this.hasNext)return[2];this._isLoading=!0,i.label=1;case 1:return i.trys.push([1,3,4,5]),[4,this.listBlogCategories(this.page+1,this.limit)];case 2:return t=i.sent(),this.data=this.data.concat((null===(a=t.data)||void 0===a?void 0:a.data)||[]),this._count=(null===(o=t.data)||void 0===o?void 0:o.count)||this._count,this._page=this.page+1,[3,5];case 3:return e=i.sent(),console.log(e),[3,5];case 4:return this._isLoading=!1,[7];case 5:return[2]}}))}))},this.getPage=function(e){return t(n,void 0,void 0,(function(){var t,a,o,r;return i(this,(function(i){switch(i.label){case 0:if(this._isLoading||this.isStatic)return[2];this._isLoading=!0,i.label=1;case 1:return i.trys.push([1,3,4,5]),[4,this.listBlogCategories(e,this.limit)];case 2:return t=i.sent(),this.data=(null===(o=t.data)||void 0===o?void 0:o.data)||[],this._count=(null===(r=t.data)||void 0===r?void 0:r.count)||0,this._page=e,this._minPage=e,[3,5];case 3:return a=i.sent(),console.log(a),[3,5];case 4:return this._isLoading=!1,[7];case 5:return[2]}}))}))},this.data=a.data?a.data.map((function(t){return new o(t)})):[],this._type=a.type||a.blogCategoryListPropValue.blogCategoryListType||r.ALL,this._limit=a.limit||a.blogCategoryListPropValue.initialLimit||20,this._page=a.page||1,this._count=a.count||0,this._initialized=a.initialized||!1,this._minPage=a.minPage,this._blogCategoryListPropValue=a.blogCategoryListPropValue,e(this)}return Object.defineProperty(n.prototype,"limit",{get:function(){return this._limit},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"page",{get:function(){return this._page},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"count",{get:function(){return this._count},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"pageCount",{get:function(){return Math.ceil(this._count/this._limit)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"isInitialized",{get:function(){return this._initialized},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"isStatic",{get:function(){return this._type===r.STATIC},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"hasPrev",{get:function(){return!(this.isStatic||!this._minPage)&&this._minPage>1},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"hasNext",{get:function(){return!this.isStatic&&this.page*this.limit<this.count},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"isLoading",{get:function(){return this._isLoading},enumerable:!1,configurable:!0}),n.prototype.listBlogCategories=function(e,o){return t(this,void 0,void 0,(function(){return i(this,(function(t){switch(t.label){case 0:return[4,a.listBlogCategory({id:this.isStatic&&this._blogCategoryListPropValue.blogCategoryIds?{in:this._blogCategoryListPropValue.blogCategoryIds}:void 0,pagination:{page:e,limit:o}})];case 1:return[2,t.sent()]}}))}))},n.prototype.toJSON=function(){return{data:this.data,type:this._type,limit:this._limit,page:this._page,count:this._count,initialized:this._initialized,minPage:this._minPage,blogCategoryListPropValue:this._blogCategoryListPropValue}},n}();!function(t){t.ALL="ALL",t.STATIC="STATIC"}(r||(r={}));export{n as IkasBlogCategoryList,r as IkasBlogCategoryListType};
@@ -1 +1 @@
1
- import{__awaiter as t,__generator as i}from'./../../../ext/tslib/tslib.es6.js';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{IkasBrand as e}from"../../data/brand/index.js";import"@ikas/storefront-models";import{makeAutoObservable as a}from"mobx";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/district/index.js";import"../../data/favorite-product/index.js";import"../../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/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"../../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"../../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/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 r from"../../../store/brand/index.js";var n,o,s=function(){function s(s){var d=this;this._initialized=!1,this._minPage=null,this._isLoading=!1,this.getInitial=function(){return t(d,void 0,void 0,(function(){var t,e,a,n,o;return i(this,(function(i){switch(i.label){case 0:if(this._isLoading)return[2];this._isLoading=!0,i.label=1;case 1:return i.trys.push([1,3,4,5]),[4,r.listProductBrand({id:this.isStatic&&this._brandListPropValue.brandIds?{in:this._brandListPropValue.brandIds}:void 0,pagination:{page:this.isStatic?void 0:this.page,limit:this.isStatic?void 0:this.limit},sort:this.getSortParams()})];case 2:return t=i.sent(),this.isStatic?this.data=(null===(a=this._brandListPropValue.brandIds)||void 0===a?void 0:a.map((function(i){var e,a;return null===(a=null===(e=t.data)||void 0===e?void 0:e.data)||void 0===a?void 0:a.find((function(t){return t.id===i}))})).filter((function(t){return!!t})))||[]:this.data=(null===(n=t.data)||void 0===n?void 0:n.data)||[],this._count=(null===(o=t.data)||void 0===o?void 0:o.count)||0,this._initialized=!0,this._minPage=this.page,[3,5];case 3:return e=i.sent(),console.log(e),[3,5];case 4:return this._isLoading=!1,[7];case 5:return[2]}}))}))},this.getPrev=function(){return t(d,void 0,void 0,(function(){var t,e,a,n,o,s;return i(this,(function(i){switch(i.label){case 0:if(this.isStatic||this._isLoading||!this.hasPrev)return[2];this._isLoading=!0,i.label=1;case 1:return i.trys.push([1,3,4,5]),t=this._minPage-1,[4,r.listProductBrand({pagination:{page:t,limit:this.limit},sort:this.getSortParams()})];case 2:return e=i.sent(),this.data=(null===(o=null===(n=e.data)||void 0===n?void 0:n.data)||void 0===o?void 0:o.concat(this.data))||this.data,this._count=(null===(s=e.data)||void 0===s?void 0:s.count)||0,this._minPage=t,[3,5];case 3:return a=i.sent(),console.log(a),[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,e,a,n;return i(this,(function(i){switch(i.label){case 0:if(this.isStatic||this._isLoading||!this.hasNext)return[2];this._isLoading=!0,i.label=1;case 1:return i.trys.push([1,3,4,5]),[4,r.listProductBrand({pagination:{page:this.page+1,limit:this.limit},sort:this.getSortParams()})];case 2:return t=i.sent(),this.data=this.data.concat((null===(a=t.data)||void 0===a?void 0:a.data)||[]),this._count=(null===(n=t.data)||void 0===n?void 0:n.count)||this.count,this._page=this.page+1,[3,5];case 3:return e=i.sent(),console.log(e),[3,5];case 4:return this._isLoading=!1,[7];case 5:return[2]}}))}))},this.getPage=function(e){return t(d,void 0,void 0,(function(){var t,a,n,o;return i(this,(function(i){switch(i.label){case 0:if(this._isLoading||this.isStatic)return[2];this._isLoading=!0,i.label=1;case 1:return i.trys.push([1,3,4,5]),[4,r.listProductBrand({pagination:{page:e,limit:this.limit},sort:this.getSortParams()})];case 2:return t=i.sent(),this.data=(null===(n=t.data)||void 0===n?void 0:n.data)||[],this._count=(null===(o=t.data)||void 0===o?void 0:o.count)||0,this._page=e,this._minPage=e,[3,5];case 3:return a=i.sent(),console.log(a),[3,5];case 4:return this._isLoading=!1,[7];case 5:return[2]}}))}))},this.data=s.data?s.data.map((function(t){return new e(t)})):[],this._type=s.type||s.brandListPropValue.brandListType||n.ALL,this._sort=s.sort||s.brandListPropValue.initialSort||o.A_Z,this._limit=s.limit||s.brandListPropValue.initialLimit||20,this._page=s.page||1,this._count=s.count||0,this._initialized=s.initialized||!1,this._minPage=s.minPage,this._brandListPropValue=s.brandListPropValue,a(this)}return Object.defineProperty(s.prototype,"sort",{get:function(){return this._sort},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"limit",{get:function(){return this._limit},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"page",{get:function(){return this._page},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"count",{get:function(){return this._count},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"pageCount",{get:function(){return Math.ceil(this._count/this._limit)},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"isInitialized",{get:function(){return this._initialized},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"isStatic",{get:function(){return this._type===n.STATIC},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"hasPrev",{get:function(){return!(this.isStatic||!this._minPage)&&this._minPage>1},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"hasNext",{get:function(){return!this.isStatic&&this.page*this.limit<this.count},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"isLoading",{get:function(){return this._isLoading},enumerable:!1,configurable:!0}),s.prototype.getSortParams=function(){return this._sort===o.A_Z?"name":"-name"},s.prototype.setSortType=function(e){return t(this,void 0,void 0,(function(){return i(this,(function(t){switch(t.label){case 0:return this._sort=e,[4,this.getInitial()];case 1:return t.sent(),[2]}}))}))},s.prototype.toJSON=function(){return{data:this.data,type:this._type,sort:this._sort,limit:this._limit,page:this._page,count:this._count,initialized:this._initialized,minPage:this._minPage,brandListPropValue:this._brandListPropValue}},s}();!function(t){t.ALL="ALL",t.STATIC="STATIC"}(n||(n={})),function(t){t.A_Z="A_Z",t.Z_A="Z_A"}(o||(o={}));export{s as IkasBrandList,o as IkasBrandListSortType,n as IkasBrandListType};
1
+ import{__awaiter as t,__generator as i}from'./../../../ext/tslib/tslib.es6.js';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{IkasBrand as e}from"../../data/brand/index.js";import"@ikas/storefront-models";import{makeAutoObservable as a}from"mobx";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"../../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/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"../../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"../../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/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 r from"../../../store/brand/index.js";var n,o,s=function(){function s(s){var d=this;this._initialized=!1,this._minPage=null,this._isLoading=!1,this.getInitial=function(){return t(d,void 0,void 0,(function(){var t,e,a,n,o;return i(this,(function(i){switch(i.label){case 0:if(this._isLoading)return[2];this._isLoading=!0,i.label=1;case 1:return i.trys.push([1,3,4,5]),[4,r.listProductBrand({id:this.isStatic&&this._brandListPropValue.brandIds?{in:this._brandListPropValue.brandIds}:void 0,pagination:{page:this.isStatic?void 0:this.page,limit:this.isStatic?void 0:this.limit},sort:this.getSortParams()})];case 2:return t=i.sent(),this.isStatic?this.data=(null===(a=this._brandListPropValue.brandIds)||void 0===a?void 0:a.map((function(i){var e,a;return null===(a=null===(e=t.data)||void 0===e?void 0:e.data)||void 0===a?void 0:a.find((function(t){return t.id===i}))})).filter((function(t){return!!t})))||[]:this.data=(null===(n=t.data)||void 0===n?void 0:n.data)||[],this._count=(null===(o=t.data)||void 0===o?void 0:o.count)||0,this._initialized=!0,this._minPage=this.page,[3,5];case 3:return e=i.sent(),console.log(e),[3,5];case 4:return this._isLoading=!1,[7];case 5:return[2]}}))}))},this.getPrev=function(){return t(d,void 0,void 0,(function(){var t,e,a,n,o,s;return i(this,(function(i){switch(i.label){case 0:if(this.isStatic||this._isLoading||!this.hasPrev)return[2];this._isLoading=!0,i.label=1;case 1:return i.trys.push([1,3,4,5]),t=this._minPage-1,[4,r.listProductBrand({pagination:{page:t,limit:this.limit},sort:this.getSortParams()})];case 2:return e=i.sent(),this.data=(null===(o=null===(n=e.data)||void 0===n?void 0:n.data)||void 0===o?void 0:o.concat(this.data))||this.data,this._count=(null===(s=e.data)||void 0===s?void 0:s.count)||0,this._minPage=t,[3,5];case 3:return a=i.sent(),console.log(a),[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,e,a,n;return i(this,(function(i){switch(i.label){case 0:if(this.isStatic||this._isLoading||!this.hasNext)return[2];this._isLoading=!0,i.label=1;case 1:return i.trys.push([1,3,4,5]),[4,r.listProductBrand({pagination:{page:this.page+1,limit:this.limit},sort:this.getSortParams()})];case 2:return t=i.sent(),this.data=this.data.concat((null===(a=t.data)||void 0===a?void 0:a.data)||[]),this._count=(null===(n=t.data)||void 0===n?void 0:n.count)||this.count,this._page=this.page+1,[3,5];case 3:return e=i.sent(),console.log(e),[3,5];case 4:return this._isLoading=!1,[7];case 5:return[2]}}))}))},this.getPage=function(e){return t(d,void 0,void 0,(function(){var t,a,n,o;return i(this,(function(i){switch(i.label){case 0:if(this._isLoading||this.isStatic)return[2];this._isLoading=!0,i.label=1;case 1:return i.trys.push([1,3,4,5]),[4,r.listProductBrand({pagination:{page:e,limit:this.limit},sort:this.getSortParams()})];case 2:return t=i.sent(),this.data=(null===(n=t.data)||void 0===n?void 0:n.data)||[],this._count=(null===(o=t.data)||void 0===o?void 0:o.count)||0,this._page=e,this._minPage=e,[3,5];case 3:return a=i.sent(),console.log(a),[3,5];case 4:return this._isLoading=!1,[7];case 5:return[2]}}))}))},this.data=s.data?s.data.map((function(t){return new e(t)})):[],this._type=s.type||s.brandListPropValue.brandListType||n.ALL,this._sort=s.sort||s.brandListPropValue.initialSort||o.A_Z,this._limit=s.limit||s.brandListPropValue.initialLimit||20,this._page=s.page||1,this._count=s.count||0,this._initialized=s.initialized||!1,this._minPage=s.minPage,this._brandListPropValue=s.brandListPropValue,a(this)}return Object.defineProperty(s.prototype,"sort",{get:function(){return this._sort},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"limit",{get:function(){return this._limit},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"page",{get:function(){return this._page},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"count",{get:function(){return this._count},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"pageCount",{get:function(){return Math.ceil(this._count/this._limit)},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"isInitialized",{get:function(){return this._initialized},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"isStatic",{get:function(){return this._type===n.STATIC},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"hasPrev",{get:function(){return!(this.isStatic||!this._minPage)&&this._minPage>1},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"hasNext",{get:function(){return!this.isStatic&&this.page*this.limit<this.count},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"isLoading",{get:function(){return this._isLoading},enumerable:!1,configurable:!0}),s.prototype.getSortParams=function(){return this._sort===o.A_Z?"name":"-name"},s.prototype.setSortType=function(e){return t(this,void 0,void 0,(function(){return i(this,(function(t){switch(t.label){case 0:return this._sort=e,[4,this.getInitial()];case 1:return t.sent(),[2]}}))}))},s.prototype.toJSON=function(){return{data:this.data,type:this._type,sort:this._sort,limit:this._limit,page:this._page,count:this._count,initialized:this._initialized,minPage:this._minPage,brandListPropValue:this._brandListPropValue}},s}();!function(t){t.ALL="ALL",t.STATIC="STATIC"}(n||(n={})),function(t){t.A_Z="A_Z",t.Z_A="Z_A"}(o||(o={}));export{s as IkasBrandList,o as IkasBrandListSortType,n as IkasBrandListType};
@@ -1 +1 @@
1
- import{__awaiter as t,__generator as i}from'./../../../ext/tslib/tslib.es6.js';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"@ikas/storefront-models";import{makeAutoObservable as e}from"mobx";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{IkasCategory as a}from"../../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/district/index.js";import"../../data/favorite-product/index.js";import"../../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/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"../../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"../../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/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 r from"../../../store/category/index.js";var o,n,s=function(){function s(s){var d=this;this._initialized=!1,this._minPage=null,this._isLoading=!1,this.getInitial=function(){return t(d,void 0,void 0,(function(){var t,e,a,o,n;return i(this,(function(i){switch(i.label){case 0:if(this._isLoading)return[2];this._isLoading=!0,i.label=1;case 1:return i.trys.push([1,3,4,5]),[4,r.listCategory({id:this.isStatic&&this._categoryListPropValue.categoryIds?{in:this._categoryListPropValue.categoryIds}:void 0,pagination:{page:this.isStatic?void 0:this.page,limit:this.isStatic?void 0:this.limit},sort:this.getSortParams()})];case 2:return t=i.sent(),this.isStatic?this.data=(null===(a=this._categoryListPropValue.categoryIds)||void 0===a?void 0:a.map((function(i){var e,a;return null===(a=null===(e=t.data)||void 0===e?void 0:e.data)||void 0===a?void 0:a.find((function(t){return t.id===i}))})).filter((function(t){return!!t})))||[]:this.data=(null===(o=t.data)||void 0===o?void 0:o.data)||[],this._count=(null===(n=t.data)||void 0===n?void 0:n.count)||0,this._initialized=!0,this._minPage=this.page,[3,5];case 3:return e=i.sent(),console.log(e),[3,5];case 4:return this._isLoading=!1,[7];case 5:return[2]}}))}))},this.getPrev=function(){return t(d,void 0,void 0,(function(){var t,e,a,o,n,s;return i(this,(function(i){switch(i.label){case 0:if(this.isStatic||this._isLoading||!this.hasPrev)return[2];this._isLoading=!0,i.label=1;case 1:return i.trys.push([1,3,4,5]),t=this._minPage-1,[4,r.listCategory({pagination:{page:t,limit:this.limit},sort:this.getSortParams()})];case 2:return e=i.sent(),this.data=(null===(n=null===(o=e.data)||void 0===o?void 0:o.data)||void 0===n?void 0:n.concat(this.data))||this.data,this._count=(null===(s=e.data)||void 0===s?void 0:s.count)||this._count,this._minPage=t,[3,5];case 3:return a=i.sent(),console.log(a),[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,e,a,o;return i(this,(function(i){switch(i.label){case 0:if(this.isStatic||this._isLoading||!this.hasNext)return[2];this._isLoading=!0,i.label=1;case 1:return i.trys.push([1,3,4,5]),[4,r.listCategory({pagination:{page:this.page+1,limit:this.limit},sort:this.getSortParams()})];case 2:return t=i.sent(),this.data=this.data.concat((null===(a=t.data)||void 0===a?void 0:a.data)||[]),this._count=(null===(o=t.data)||void 0===o?void 0:o.count)||this._count,this._page=this.page+1,[3,5];case 3:return e=i.sent(),console.log(e),[3,5];case 4:return this._isLoading=!1,[7];case 5:return[2]}}))}))},this.getPage=function(e){return t(d,void 0,void 0,(function(){var t,a,o,n;return i(this,(function(i){switch(i.label){case 0:if(this._isLoading||this.isStatic)return[2];this._isLoading=!0,i.label=1;case 1:return i.trys.push([1,3,4,5]),[4,r.listCategory({pagination:{page:e,limit:this.limit},sort:this.getSortParams()})];case 2:return t=i.sent(),this.data=(null===(o=t.data)||void 0===o?void 0:o.data)||[],this._count=(null===(n=t.data)||void 0===n?void 0:n.count)||0,this._page=e,this._minPage=e,[3,5];case 3:return a=i.sent(),console.log(a),[3,5];case 4:return this._isLoading=!1,[7];case 5:return[2]}}))}))},this.data=s.data?s.data.map((function(t){return new a(t)})):[],this._type=s.type||s.categoryListPropValue.categoryListType||o.ALL,this._sort=s.sort||s.categoryListPropValue.initialSort||n.A_Z,this._limit=s.limit||s.categoryListPropValue.initialLimit||20,this._page=s.page||1,this._count=s.count||0,this._initialized=s.initialized||!1,this._minPage=s.minPage,this._categoryListPropValue=s.categoryListPropValue,e(this)}return Object.defineProperty(s.prototype,"sort",{get:function(){return this._sort},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"limit",{get:function(){return this._limit},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"page",{get:function(){return this._page},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"count",{get:function(){return this._count},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"pageCount",{get:function(){return Math.ceil(this._count/this._limit)},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"isInitialized",{get:function(){return this._initialized},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"isStatic",{get:function(){return this._type===o.STATIC},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"hasPrev",{get:function(){return!(this.isStatic||!this._minPage)&&this._minPage>1},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"hasNext",{get:function(){return!this.isStatic&&this.page*this.limit<this.count},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"isLoading",{get:function(){return this._isLoading},enumerable:!1,configurable:!0}),s.prototype.getSortParams=function(){return this._sort===n.A_Z?"name":"-name"},s.prototype.setSortType=function(e){return t(this,void 0,void 0,(function(){return i(this,(function(t){switch(t.label){case 0:return this._sort=e,[4,this.getInitial()];case 1:return t.sent(),[2]}}))}))},s.prototype.toJSON=function(){return{data:this.data,type:this._type,sort:this._sort,limit:this._limit,page:this._page,count:this._count,initialized:this._initialized,minPage:this._minPage,categoryListPropValue:this._categoryListPropValue}},s}();!function(t){t.ALL="ALL",t.STATIC="STATIC"}(o||(o={})),function(t){t.A_Z="A_Z",t.Z_A="Z_A"}(n||(n={}));export{s as IkasCategoryList,n as IkasCategoryListSortType,o as IkasCategoryListType};
1
+ import{__awaiter as t,__generator as i}from'./../../../ext/tslib/tslib.es6.js';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"@ikas/storefront-models";import{makeAutoObservable as e}from"mobx";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{IkasCategory as a}from"../../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"../../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/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"../../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"../../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/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 r from"../../../store/category/index.js";var o,n,s=function(){function s(s){var d=this;this._initialized=!1,this._minPage=null,this._isLoading=!1,this.getInitial=function(){return t(d,void 0,void 0,(function(){var t,e,a,o,n;return i(this,(function(i){switch(i.label){case 0:if(this._isLoading)return[2];this._isLoading=!0,i.label=1;case 1:return i.trys.push([1,3,4,5]),[4,r.listCategory({id:this.isStatic&&this._categoryListPropValue.categoryIds?{in:this._categoryListPropValue.categoryIds}:void 0,pagination:{page:this.isStatic?void 0:this.page,limit:this.isStatic?void 0:this.limit},sort:this.getSortParams()})];case 2:return t=i.sent(),this.isStatic?this.data=(null===(a=this._categoryListPropValue.categoryIds)||void 0===a?void 0:a.map((function(i){var e,a;return null===(a=null===(e=t.data)||void 0===e?void 0:e.data)||void 0===a?void 0:a.find((function(t){return t.id===i}))})).filter((function(t){return!!t})))||[]:this.data=(null===(o=t.data)||void 0===o?void 0:o.data)||[],this._count=(null===(n=t.data)||void 0===n?void 0:n.count)||0,this._initialized=!0,this._minPage=this.page,[3,5];case 3:return e=i.sent(),console.log(e),[3,5];case 4:return this._isLoading=!1,[7];case 5:return[2]}}))}))},this.getPrev=function(){return t(d,void 0,void 0,(function(){var t,e,a,o,n,s;return i(this,(function(i){switch(i.label){case 0:if(this.isStatic||this._isLoading||!this.hasPrev)return[2];this._isLoading=!0,i.label=1;case 1:return i.trys.push([1,3,4,5]),t=this._minPage-1,[4,r.listCategory({pagination:{page:t,limit:this.limit},sort:this.getSortParams()})];case 2:return e=i.sent(),this.data=(null===(n=null===(o=e.data)||void 0===o?void 0:o.data)||void 0===n?void 0:n.concat(this.data))||this.data,this._count=(null===(s=e.data)||void 0===s?void 0:s.count)||this._count,this._minPage=t,[3,5];case 3:return a=i.sent(),console.log(a),[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,e,a,o;return i(this,(function(i){switch(i.label){case 0:if(this.isStatic||this._isLoading||!this.hasNext)return[2];this._isLoading=!0,i.label=1;case 1:return i.trys.push([1,3,4,5]),[4,r.listCategory({pagination:{page:this.page+1,limit:this.limit},sort:this.getSortParams()})];case 2:return t=i.sent(),this.data=this.data.concat((null===(a=t.data)||void 0===a?void 0:a.data)||[]),this._count=(null===(o=t.data)||void 0===o?void 0:o.count)||this._count,this._page=this.page+1,[3,5];case 3:return e=i.sent(),console.log(e),[3,5];case 4:return this._isLoading=!1,[7];case 5:return[2]}}))}))},this.getPage=function(e){return t(d,void 0,void 0,(function(){var t,a,o,n;return i(this,(function(i){switch(i.label){case 0:if(this._isLoading||this.isStatic)return[2];this._isLoading=!0,i.label=1;case 1:return i.trys.push([1,3,4,5]),[4,r.listCategory({pagination:{page:e,limit:this.limit},sort:this.getSortParams()})];case 2:return t=i.sent(),this.data=(null===(o=t.data)||void 0===o?void 0:o.data)||[],this._count=(null===(n=t.data)||void 0===n?void 0:n.count)||0,this._page=e,this._minPage=e,[3,5];case 3:return a=i.sent(),console.log(a),[3,5];case 4:return this._isLoading=!1,[7];case 5:return[2]}}))}))},this.data=s.data?s.data.map((function(t){return new a(t)})):[],this._type=s.type||s.categoryListPropValue.categoryListType||o.ALL,this._sort=s.sort||s.categoryListPropValue.initialSort||n.A_Z,this._limit=s.limit||s.categoryListPropValue.initialLimit||20,this._page=s.page||1,this._count=s.count||0,this._initialized=s.initialized||!1,this._minPage=s.minPage,this._categoryListPropValue=s.categoryListPropValue,e(this)}return Object.defineProperty(s.prototype,"sort",{get:function(){return this._sort},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"limit",{get:function(){return this._limit},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"page",{get:function(){return this._page},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"count",{get:function(){return this._count},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"pageCount",{get:function(){return Math.ceil(this._count/this._limit)},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"isInitialized",{get:function(){return this._initialized},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"isStatic",{get:function(){return this._type===o.STATIC},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"hasPrev",{get:function(){return!(this.isStatic||!this._minPage)&&this._minPage>1},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"hasNext",{get:function(){return!this.isStatic&&this.page*this.limit<this.count},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"isLoading",{get:function(){return this._isLoading},enumerable:!1,configurable:!0}),s.prototype.getSortParams=function(){return this._sort===n.A_Z?"name":"-name"},s.prototype.setSortType=function(e){return t(this,void 0,void 0,(function(){return i(this,(function(t){switch(t.label){case 0:return this._sort=e,[4,this.getInitial()];case 1:return t.sent(),[2]}}))}))},s.prototype.toJSON=function(){return{data:this.data,type:this._type,sort:this._sort,limit:this._limit,page:this._page,count:this._count,initialized:this._initialized,minPage:this._minPage,categoryListPropValue:this._categoryListPropValue}},s}();!function(t){t.ALL="ALL",t.STATIC="STATIC"}(o||(o={})),function(t){t.A_Z="A_Z",t.Z_A="Z_A"}(n||(n={}));export{s as IkasCategoryList,n as IkasCategoryListSortType,o as IkasCategoryListType};
@@ -8,6 +8,7 @@ export declare class IkasCustomerReviewList {
8
8
  private _minPage?;
9
9
  private _productId?;
10
10
  private _hasImage?;
11
+ private _productIds?;
11
12
  private _isLoading;
12
13
  constructor(data: IkasCustomerReviewListParams);
13
14
  get limit(): number;
@@ -19,6 +20,7 @@ export declare class IkasCustomerReviewList {
19
20
  get hasNext(): boolean;
20
21
  get isLoading(): boolean;
21
22
  get hasImage(): boolean | undefined;
23
+ get productIds(): string[] | null | undefined;
22
24
  private listCustomerReviews;
23
25
  getInitial: () => Promise<void>;
24
26
  getPrev: () => Promise<void>;
@@ -42,5 +44,6 @@ export declare type IkasCustomerReviewListParams = {
42
44
  initialized?: boolean;
43
45
  minPage?: number;
44
46
  productId?: string;
47
+ productIds?: string[];
45
48
  hasImage?: boolean;
46
49
  };
@@ -1 +1 @@
1
- import{__awaiter as t,__generator as i,__assign as e}from'./../../../ext/tslib/tslib.es6.js';import{IkasStorefrontConfig as a}from"@ikas/storefront-config";import{makeAutoObservable as r}from"mobx";import n from"../../../store/customer/api.js";import o from"../../../store/product/index.js";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"@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{IkasCustomerReview as s}from"../../data/customer/review/index.js";import"../../data/customer/index.js";import"../../data/district/index.js";import"../../data/favorite-product/index.js";import"../../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/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"../../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"../../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/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";var d=function(){function d(e){var a=this;this._initialized=!1,this._minPage=null,this._productId=null,this._hasImage=!1,this._isLoading=!1,this.getInitial=function(){return t(a,void 0,void 0,(function(){var t,e,a,r;return i(this,(function(i){switch(i.label){case 0:if(this._isLoading)return[2];this._isLoading=!0,i.label=1;case 1:return i.trys.push([1,3,4,5]),[4,this.listCustomerReviews(this.page,this.limit,this.hasImage)];case 2:return t=i.sent(),this.data=(null===(a=t.data)||void 0===a?void 0:a.data)||[],this._count=(null===(r=t.data)||void 0===r?void 0:r.count)||0,this._initialized=!0,this._minPage=this.page,[3,5];case 3:return e=i.sent(),console.log(e),[3,5];case 4:return this._isLoading=!1,[7];case 5:return[2]}}))}))},this.getPrev=function(){return t(a,void 0,void 0,(function(){var t,e,a,r,n;return i(this,(function(i){switch(i.label){case 0:if(this._isLoading||!this.hasPrev)return[2];this._isLoading=!0,i.label=1;case 1:return i.trys.push([1,3,4,5]),t=this._minPage-1,[4,this.listCustomerReviews(t,this.limit,this.hasImage)];case 2:return e=i.sent(),this.data=(null===(r=e.data)||void 0===r?void 0:r.data.concat(this.data))||this.data,this._count=(null===(n=e.data)||void 0===n?void 0:n.count)||this._count,this._minPage=t,[3,5];case 3:return a=i.sent(),console.log(a),[3,5];case 4:return this._isLoading=!1,[7];case 5:return[2]}}))}))},this.getNext=function(){return t(a,void 0,void 0,(function(){var t,e,a,r;return i(this,(function(i){switch(i.label){case 0:if(this._isLoading||!this.hasNext)return[2];this._isLoading=!0,i.label=1;case 1:return i.trys.push([1,3,4,5]),[4,this.listCustomerReviews(this.page+1,this.limit,this.hasImage)];case 2:return t=i.sent(),this.data=this.data.concat((null===(a=t.data)||void 0===a?void 0:a.data)||[]),this._count=(null===(r=t.data)||void 0===r?void 0:r.count)||this._count,this._page=this.page+1,[3,5];case 3:return e=i.sent(),console.log(e),[3,5];case 4:return this._isLoading=!1,[7];case 5:return[2]}}))}))},this.getPage=function(e){return t(a,void 0,void 0,(function(){var t,a,r,n;return i(this,(function(i){switch(i.label){case 0:if(this._isLoading)return[2];this._isLoading=!0,i.label=1;case 1:return i.trys.push([1,3,4,5]),[4,this.listCustomerReviews(e,this.limit,this.hasImage)];case 2:return t=i.sent(),this.data=(null===(r=t.data)||void 0===r?void 0:r.data)||[],this._count=(null===(n=t.data)||void 0===n?void 0:n.count)||0,this._page=e,this._minPage=e,[3,5];case 3:return a=i.sent(),console.log(a),[3,5];case 4:return this._isLoading=!1,[7];case 5:return[2]}}))}))},this.data=e.data?e.data.map((function(t){return new s(t)})):[],this._limit=e.limit||5,this._page=e.page||1,this._count=e.count||0,this._initialized=e.initialized||!1,this._hasImage=e.hasImage||!1,this._minPage=e.minPage,this._productId=e.productId||null,r(this)}return Object.defineProperty(d.prototype,"limit",{get:function(){return this._limit},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"page",{get:function(){return this._page},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"count",{get:function(){return this._count},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"pageCount",{get:function(){return Math.ceil(this._count/this._limit)},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"isInitialized",{get:function(){return this._initialized},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"hasPrev",{get:function(){return!!this._minPage&&this._minPage>1},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"hasNext",{get:function(){return this.page*this.limit<this.count},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"isLoading",{get:function(){return this._isLoading},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"hasImage",{get:function(){return this._hasImage},enumerable:!1,configurable:!0}),d.prototype.listCustomerReviews=function(r,s,d){var u,c,p;return t(this,void 0,void 0,(function(){var t,m,l;return i(this,(function(i){switch(i.label){case 0:return[4,n.listCustomerReviews({productId:this._productId,input:{salesChannelId:a.getSalesChannelId()||""},pagination:{page:r,limit:s},hasImage:d})];case 1:return t=i.sent(),!(null===(u=t.data)||void 0===u?void 0:u.data)||this._productId?[3,3]:(m=null===(c=null==t?void 0:t.data)||void 0===c?void 0:c.data.map((function(t){return null==t?void 0:t.productId})),[4,o.searchProducts({input:{productIdList:m}})]);case 2:l=i.sent(),t.data.data=null===(p=null==t?void 0:t.data)||void 0===p?void 0:p.data.map((function(t){var i,a,r=null===(a=null===(i=null==l?void 0:l.data)||void 0===i?void 0:i.data)||void 0===a?void 0:a.find((function(i){return i.id===t.productId}));return e(e({},t),{product:r})})).filter((function(t){return t.product&&!t.product.deleted})),i.label=3;case 3:return[2,t]}}))}))},d.prototype.toJSON=function(){return{data:this.data,limit:this._limit,page:this._page,count:this._count,initialized:this._initialized,minPage:this._minPage,productId:this._productId}},d}();export{d as IkasCustomerReviewList};
1
+ import{__awaiter as t,__generator as i,__assign as e}from'./../../../ext/tslib/tslib.es6.js';import{IkasStorefrontConfig as a}from"@ikas/storefront-config";import{makeAutoObservable as r}from"mobx";import o from"../../../store/customer/api.js";import n from"../../../store/product/index.js";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"@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{IkasCustomerReview as s}from"../../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"../../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/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"../../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"../../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/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";var d=function(){function d(e){var a=this;this._initialized=!1,this._minPage=null,this._productId=null,this._hasImage=!1,this._productIds=null,this._isLoading=!1,this.getInitial=function(){return t(a,void 0,void 0,(function(){var t,e,a,r;return i(this,(function(i){switch(i.label){case 0:if(this._isLoading)return[2];this._isLoading=!0,i.label=1;case 1:return i.trys.push([1,3,4,5]),[4,this.listCustomerReviews(this.page,this.limit,this.hasImage,this.productIds)];case 2:return t=i.sent(),this.data=(null===(a=t.data)||void 0===a?void 0:a.data)||[],this._count=(null===(r=t.data)||void 0===r?void 0:r.count)||0,this._initialized=!0,this._minPage=this.page,[3,5];case 3:return e=i.sent(),console.log(e),[3,5];case 4:return this._isLoading=!1,[7];case 5:return[2]}}))}))},this.getPrev=function(){return t(a,void 0,void 0,(function(){var t,e,a,r,o;return i(this,(function(i){switch(i.label){case 0:if(this._isLoading||!this.hasPrev)return[2];this._isLoading=!0,i.label=1;case 1:return i.trys.push([1,3,4,5]),t=this._minPage-1,[4,this.listCustomerReviews(t,this.limit,this.hasImage,this.productIds)];case 2:return e=i.sent(),this.data=(null===(r=e.data)||void 0===r?void 0:r.data.concat(this.data))||this.data,this._count=(null===(o=e.data)||void 0===o?void 0:o.count)||this._count,this._minPage=t,[3,5];case 3:return a=i.sent(),console.log(a),[3,5];case 4:return this._isLoading=!1,[7];case 5:return[2]}}))}))},this.getNext=function(){return t(a,void 0,void 0,(function(){var t,e,a,r;return i(this,(function(i){switch(i.label){case 0:if(this._isLoading||!this.hasNext)return[2];this._isLoading=!0,i.label=1;case 1:return i.trys.push([1,3,4,5]),[4,this.listCustomerReviews(this.page+1,this.limit,this.hasImage,this.productIds)];case 2:return t=i.sent(),this.data=this.data.concat((null===(a=t.data)||void 0===a?void 0:a.data)||[]),this._count=(null===(r=t.data)||void 0===r?void 0:r.count)||this._count,this._page=this.page+1,[3,5];case 3:return e=i.sent(),console.log(e),[3,5];case 4:return this._isLoading=!1,[7];case 5:return[2]}}))}))},this.getPage=function(e){return t(a,void 0,void 0,(function(){var t,a,r,o;return i(this,(function(i){switch(i.label){case 0:if(this._isLoading)return[2];this._isLoading=!0,i.label=1;case 1:return i.trys.push([1,3,4,5]),[4,this.listCustomerReviews(e,this.limit,this.hasImage,this.productIds)];case 2:return t=i.sent(),this.data=(null===(r=t.data)||void 0===r?void 0:r.data)||[],this._count=(null===(o=t.data)||void 0===o?void 0:o.count)||0,this._page=e,this._minPage=e,[3,5];case 3:return a=i.sent(),console.log(a),[3,5];case 4:return this._isLoading=!1,[7];case 5:return[2]}}))}))},this.data=e.data?e.data.map((function(t){return new s(t)})):[],this._limit=e.limit||5,this._page=e.page||1,this._count=e.count||0,this._initialized=e.initialized||!1,this._hasImage=e.hasImage||!1,this._minPage=e.minPage,this._productId=e.productId||null,this._productIds=e.productIds||null,r(this)}return Object.defineProperty(d.prototype,"limit",{get:function(){return this._limit},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"page",{get:function(){return this._page},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"count",{get:function(){return this._count},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"pageCount",{get:function(){return Math.ceil(this._count/this._limit)},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"isInitialized",{get:function(){return this._initialized},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"hasPrev",{get:function(){return!!this._minPage&&this._minPage>1},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"hasNext",{get:function(){return this.page*this.limit<this.count},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"isLoading",{get:function(){return this._isLoading},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"hasImage",{get:function(){return this._hasImage},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"productIds",{get:function(){return this._productIds},enumerable:!1,configurable:!0}),d.prototype.listCustomerReviews=function(r,s,d,u){var c,p,m;return t(this,void 0,void 0,(function(){var t,l,h;return i(this,(function(i){switch(i.label){case 0:return[4,o.listCustomerReviews(e(e(e({},this._productId?{productId:this._productId}:{}),{input:{salesChannelId:a.getSalesChannelId()||""},pagination:{page:r,limit:s},hasImage:d}),u?{productIds:u}:{}))];case 1:return t=i.sent(),!(null===(c=t.data)||void 0===c?void 0:c.data)||this._productId?[3,3]:(l=null===(p=null==t?void 0:t.data)||void 0===p?void 0:p.data.map((function(t){return null==t?void 0:t.productId})),[4,n.searchProducts({input:{productIdList:l}})]);case 2:h=i.sent(),t.data.data=null===(m=null==t?void 0:t.data)||void 0===m?void 0:m.data.map((function(t){var i,a,r=null===(a=null===(i=null==h?void 0:h.data)||void 0===i?void 0:i.data)||void 0===a?void 0:a.find((function(i){return i.id===t.productId}));return e(e({},t),{product:r})})).filter((function(t){return t.product&&!t.product.deleted})),i.label=3;case 3:return[2,t]}}))}))},d.prototype.toJSON=function(){return{data:this.data,limit:this._limit,page:this._page,count:this._count,initialized:this._initialized,minPage:this._minPage,productId:this._productId}},d}();export{d as IkasCustomerReviewList};
@@ -1 +1 @@
1
- import{__awaiter as t,__generator as i}from'./../../../ext/tslib/tslib.es6.js';import{makeAutoObservable as e}from"mobx";import a from"../../../store/customer/api.js";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"@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{IkasCustomerReviewSummary as r}from"../../data/customer/review/summary/index.js";import"../../data/customer/review/index.js";import"../../data/customer/index.js";import"../../data/district/index.js";import"../../data/favorite-product/index.js";import"../../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/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"../../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"../../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/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";var n=function(){function n(a){var n=this;this._initialized=!1,this._minPage=null,this._isLoading=!1,this.getInitial=function(){return t(n,void 0,void 0,(function(){var t,e,a,r;return i(this,(function(i){switch(i.label){case 0:if(this._isLoading)return[2];this._isLoading=!0,i.label=1;case 1:return i.trys.push([1,3,4,5]),[4,this.listCustomerReviewSummary(this.page,this.limit)];case 2:return t=i.sent(),this.data=(null===(a=t.data)||void 0===a?void 0:a.data)||[],this._count=(null===(r=t.data)||void 0===r?void 0:r.count)||0,this._initialized=!0,this._minPage=this.page,[3,5];case 3:return e=i.sent(),console.log(e),[3,5];case 4:return this._isLoading=!1,[7];case 5:return[2]}}))}))},this.getPrev=function(){return t(n,void 0,void 0,(function(){var t,e,a,r,n,o;return i(this,(function(i){switch(i.label){case 0:if(this._isLoading||!this.hasPrev)return[2];this._isLoading=!0,i.label=1;case 1:return i.trys.push([1,3,4,5]),t=this._minPage-1,[4,this.listCustomerReviewSummary(t,this.limit)];case 2:return e=i.sent(),this.data=(null===(n=null===(r=e.data)||void 0===r?void 0:r.data)||void 0===n?void 0:n.concat(this.data))||this.data,this._count=(null===(o=e.data)||void 0===o?void 0:o.count)||this._count,this._minPage=t,[3,5];case 3:return a=i.sent(),console.log(a),[3,5];case 4:return this._isLoading=!1,[7];case 5:return[2]}}))}))},this.getNext=function(){return t(n,void 0,void 0,(function(){var t,e,a,r;return i(this,(function(i){switch(i.label){case 0:if(this._isLoading||!this.hasNext)return[2];this._isLoading=!0,i.label=1;case 1:return i.trys.push([1,3,4,5]),[4,this.listCustomerReviewSummary(this.page+1,this.limit)];case 2:return t=i.sent(),this.data=this.data.concat((null===(a=t.data)||void 0===a?void 0:a.data)||[]),this._count=(null===(r=t.data)||void 0===r?void 0:r.count)||this._count,this._page=this.page+1,[3,5];case 3:return e=i.sent(),console.log(e),[3,5];case 4:return this._isLoading=!1,[7];case 5:return[2]}}))}))},this.getPage=function(e){return t(n,void 0,void 0,(function(){var t,a,r,n;return i(this,(function(i){switch(i.label){case 0:if(this._isLoading)return[2];this._isLoading=!0,i.label=1;case 1:return i.trys.push([1,3,4,5]),[4,this.listCustomerReviewSummary(e,this.limit)];case 2:return t=i.sent(),this.data=(null===(r=t.data)||void 0===r?void 0:r.data)||[],this._count=(null===(n=t.data)||void 0===n?void 0:n.count)||0,this._page=e,this._minPage=e,[3,5];case 3:return a=i.sent(),console.log(a),[3,5];case 4:return this._isLoading=!1,[7];case 5:return[2]}}))}))},this.data=a.data?a.data.map((function(t){return new r(t)})):[],this._limit=a.limit||5,this._page=a.page||1,this._count=a.count||0,this._initialized=a.initialized||!1,this._minPage=a.minPage,this._productId=a.productId,e(this)}return Object.defineProperty(n.prototype,"limit",{get:function(){return this._limit},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"page",{get:function(){return this._page},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"count",{get:function(){return this._count},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"pageCount",{get:function(){return Math.ceil(this._count/this._limit)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"isInitialized",{get:function(){return this._initialized},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"hasPrev",{get:function(){return!!this._minPage&&this._minPage>1},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"hasNext",{get:function(){return this.page*this.limit<this.count},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"isLoading",{get:function(){return this._isLoading},enumerable:!1,configurable:!0}),n.prototype.listCustomerReviewSummary=function(e,r){return t(this,void 0,void 0,(function(){return i(this,(function(t){switch(t.label){case 0:return[4,a.listCustomerReviewSummary({productId:{eq:this._productId},pagination:{page:e,limit:r}})];case 1:return[2,t.sent()]}}))}))},n.prototype.toJSON=function(){return{data:this.data,limit:this._limit,page:this._page,count:this._count,initialized:this._initialized,minPage:this._minPage,productId:this._productId}},n}();export{n as IkasCustomerReviewSummaryList};
1
+ import{__awaiter as t,__generator as i}from'./../../../ext/tslib/tslib.es6.js';import{makeAutoObservable as e}from"mobx";import a from"../../../store/customer/api.js";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"@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{IkasCustomerReviewSummary as r}from"../../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"../../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/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"../../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"../../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/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";var n=function(){function n(a){var n=this;this._initialized=!1,this._minPage=null,this._isLoading=!1,this.getInitial=function(){return t(n,void 0,void 0,(function(){var t,e,a,r;return i(this,(function(i){switch(i.label){case 0:if(this._isLoading)return[2];this._isLoading=!0,i.label=1;case 1:return i.trys.push([1,3,4,5]),[4,this.listCustomerReviewSummary(this.page,this.limit)];case 2:return t=i.sent(),this.data=(null===(a=t.data)||void 0===a?void 0:a.data)||[],this._count=(null===(r=t.data)||void 0===r?void 0:r.count)||0,this._initialized=!0,this._minPage=this.page,[3,5];case 3:return e=i.sent(),console.log(e),[3,5];case 4:return this._isLoading=!1,[7];case 5:return[2]}}))}))},this.getPrev=function(){return t(n,void 0,void 0,(function(){var t,e,a,r,n,o;return i(this,(function(i){switch(i.label){case 0:if(this._isLoading||!this.hasPrev)return[2];this._isLoading=!0,i.label=1;case 1:return i.trys.push([1,3,4,5]),t=this._minPage-1,[4,this.listCustomerReviewSummary(t,this.limit)];case 2:return e=i.sent(),this.data=(null===(n=null===(r=e.data)||void 0===r?void 0:r.data)||void 0===n?void 0:n.concat(this.data))||this.data,this._count=(null===(o=e.data)||void 0===o?void 0:o.count)||this._count,this._minPage=t,[3,5];case 3:return a=i.sent(),console.log(a),[3,5];case 4:return this._isLoading=!1,[7];case 5:return[2]}}))}))},this.getNext=function(){return t(n,void 0,void 0,(function(){var t,e,a,r;return i(this,(function(i){switch(i.label){case 0:if(this._isLoading||!this.hasNext)return[2];this._isLoading=!0,i.label=1;case 1:return i.trys.push([1,3,4,5]),[4,this.listCustomerReviewSummary(this.page+1,this.limit)];case 2:return t=i.sent(),this.data=this.data.concat((null===(a=t.data)||void 0===a?void 0:a.data)||[]),this._count=(null===(r=t.data)||void 0===r?void 0:r.count)||this._count,this._page=this.page+1,[3,5];case 3:return e=i.sent(),console.log(e),[3,5];case 4:return this._isLoading=!1,[7];case 5:return[2]}}))}))},this.getPage=function(e){return t(n,void 0,void 0,(function(){var t,a,r,n;return i(this,(function(i){switch(i.label){case 0:if(this._isLoading)return[2];this._isLoading=!0,i.label=1;case 1:return i.trys.push([1,3,4,5]),[4,this.listCustomerReviewSummary(e,this.limit)];case 2:return t=i.sent(),this.data=(null===(r=t.data)||void 0===r?void 0:r.data)||[],this._count=(null===(n=t.data)||void 0===n?void 0:n.count)||0,this._page=e,this._minPage=e,[3,5];case 3:return a=i.sent(),console.log(a),[3,5];case 4:return this._isLoading=!1,[7];case 5:return[2]}}))}))},this.data=a.data?a.data.map((function(t){return new r(t)})):[],this._limit=a.limit||5,this._page=a.page||1,this._count=a.count||0,this._initialized=a.initialized||!1,this._minPage=a.minPage,this._productId=a.productId,e(this)}return Object.defineProperty(n.prototype,"limit",{get:function(){return this._limit},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"page",{get:function(){return this._page},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"count",{get:function(){return this._count},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"pageCount",{get:function(){return Math.ceil(this._count/this._limit)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"isInitialized",{get:function(){return this._initialized},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"hasPrev",{get:function(){return!!this._minPage&&this._minPage>1},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"hasNext",{get:function(){return this.page*this.limit<this.count},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"isLoading",{get:function(){return this._isLoading},enumerable:!1,configurable:!0}),n.prototype.listCustomerReviewSummary=function(e,r){return t(this,void 0,void 0,(function(){return i(this,(function(t){switch(t.label){case 0:return[4,a.listCustomerReviewSummary({productId:{eq:this._productId},pagination:{page:e,limit:r}})];case 1:return[2,t.sent()]}}))}))},n.prototype.toJSON=function(){return{data:this.data,limit:this._limit,page:this._page,count:this._count,initialized:this._initialized,minPage:this._minPage,productId:this._productId}},n}();export{n as IkasCustomerReviewSummaryList};
@@ -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}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/district/index.js";import"../../data/favorite-product/index.js";import{IkasFilterCategory as d}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/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 c,IkasProductFilterValue as u}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 l}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/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 p from"../../../store/product/index.js";import h from"query-string";import{SortByDirectionEnum as f,SortByTypeEnum as g,GetSuggestedProductsMethodEnum as m}from"@ikas/storefront-api";import{IkasStorefrontConfig as _}from"@ikas/storefront-config";import{Analytics as v}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{IkasProductVariantFunctions as y}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"../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 E}from"../../../store/base.js";import"../../../store/customer/index.js";import"../../../store/cart/index.js";import"lodash/get";var I,S,C,T,A,P=function(){function I(a,n){var u=this;this.filters=null,this._filterCategories=null,this._infiniteScrollPage=null,this._initialized=!1,this._minPage=null,this._filterBrandId=null,this._filterCategoryId=null,this._relatedProductData=null,this._viewedTogetherProductData=null,this.pageSpecificData=null,this._recommendFor=null,this._isLoading=!1,this._fetchRequestTime=0,this.router=null,this._excludedFields=null,this._disabledSortTypes=null,this.applyFilters=function(){return t(u,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(u,void 0,void 0,(function(){var t,o,a,n,d,c,u,p,h,f,g,m,_,v,I,S=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,E.getInstance().customerStore.getLastViewedProducts()];case 8:return(c=e.sent())&&c.length?(n=c.map((function(t){return t.productId})),d=E.getInstance().customerStore.useLastViewedProductResponse,[3,10]):[2];case 9:return[2];case 10:return d?(p=E.getInstance().customerStore._savedLastViewedProductsResponse,[3,13]):[3,11];case 11:return[4,this.searchProducts(o||1,a||10,n)];case 12:p=e.sent(),e.label=13;case 13:return(u=p)&&this._fetchRequestTime===t?(h=[],!d&&this.isLastViewed&&E.getInstance().customerStore.setSavedLastViewedProductsResponse(u),this.isStatic||this.isLastViewed?(f=this.isStatic?this._productListPropValue.productIds:E.getInstance().customerStore._lastViewedProducts,h=(null==f?void 0:f.map((function(t){var e,r,s=null===(r=null===(e=u.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)&&y.hasStock(o)||(o=null==s?void 0:s.variants.find((function(t){return t.isActive&&y.hasStock(t)}))),s&&o)return new l(i(i({},s),{selectedVariantValues:o.variantValues}))})).filter((function(t){return!!t})))||[]):h=(null===(_=null===(m=u.data)||void 0===m?void 0:m.data)||void 0===_?void 0:_.map((function(t){var e=S.getSelectedVariant(t);return new l(i(i({},t),{selectedVariantValues:e.variantValues}))})))||[],this.applyFacets(null===(v=u.data)||void 0===v?void 0:v.facets),this.data=h,this._count=(null===(I=u.data)||void 0===I?void 0:I.count)||0,this._initialized=!0,this._page=o||1,this._minPage=this.page,this.setIsFilteredForProducts(),this.setIsStaticForProducts(),s||(this._infiniteScrollPage=null),this.handleListingEvent(),[2,!0]):[2];case 14:return g=e.sent(),console.log(g),[3,16];case 15:return t===this._fetchRequestTime&&(this._isLoading=!1),[7];case 16:return[2]}}))}))},this.getPrev=function(){return t(u,void 0,void 0,(function(){var t,r,s,o,a,n,d,c=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=c.getSelectedVariant(t);return new l(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(u,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 l(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(u,void 0,void 0,(function(){var t,s,o,a,n,d,c=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=c.getSelectedVariant(t);return new l(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;u._infiniteScrollPage!==t&&(u._infiniteScrollPage=t,_.getIsEditor()||null===(e=u.router)||void 0===e||e.replace("".concat(location.pathname).concat(u.queryParams?"?"+u.queryParams:""),void 0,{shallow:!0}))},this.searchDebouncer=s((function(){u.applyFilters()}),500),this.searchAnalyticsDebouncer=s((function(){v.search(u._searchKeyword)}),1e3);var p=a,h=a;if(this.data=a.data?a.data.map((function(t){return new l(t)})):[],this._type=p.type||h._type||p.productListPropValue.productListType||h._productListPropValue.productListType||S.ALL,this._pageType=a.pageType,this._sort=a.sort||a.productListPropValue.initialSort||C.LAST_ADDED,this._limit=a.limit||p.productListPropValue.initialLimit||h._productListPropValue.initialLimit||20,this._page=a.page||1,this._minPage=a.minPage||null,this._count=a.count||0,this._searchKeyword=a.searchKeyword||"",this._productListPropValue=p.productListPropValue||h._productListPropValue,this._filterBrandId=p.filterBrandId||h._filterBrandId||null,this._filterCategoryId=p.filterCategoryId||h._filterCategoryId||null,this._relatedProductData=p.relatedProductData||h._relatedProductData||null,this._viewedTogetherProductData=p.viewedTogetherProductData||h._viewedTogetherProductData||null,this._excludedFields=p.excludedFields||h._excludedFields||null,this._disabledSortTypes=p.disabledSortTypes||h._disabledSortTypes||null,this._recommendFor=p.recommendFor||h._recommendFor,this.filters=a.filters?a.filters.map((function(t){return new c(t,u)})):null,this._filterCategories=a.filterCategories?a.filterCategories.map((function(t){return new d(t)})):null,this.pageSpecificData=p.pageSpecificData||h.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===S.SEARCH)){var f=this.getQueryParams();this.getInitial(f,this._page>1)}else this._page>1?this.getInitial(void 0,!0):this.isLastViewed?this.getInitial():this.handleListingEvent()}return Object.defineProperty(I.prototype,"sort",{get:function(){return this._sort},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"limit",{get:function(){return this._limit},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"pageType",{get:function(){return this._pageType},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"page",{get:function(){return this._page},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"minPage",{get:function(){return this._minPage||1},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"count",{get:function(){return this._count},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"pageCount",{get:function(){return Math.ceil(this._count/this._limit)},enumerable:!1,configurable:!0}),Object.defineProperty(I.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(I.prototype,"isInitialized",{get:function(){return this._initialized},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"isFilterable",{get:function(){return this._type===S.ALL||this._type===S.CATEGORY},enumerable:!1,configurable:!0}),Object.defineProperty(I.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(I.prototype,"isStatic",{get:function(){return this._type===S.STATIC},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"isDiscounted",{get:function(){return this._type===S.DISCOUNTED},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"isRecommended",{get:function(){return this._type===S.RECOMMENDED},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"isLastViewed",{get:function(){return this._type===S.LAST_VIEWED},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"isRelatedProducts",{get:function(){return this._type===S.RELATED_PRODUCTS},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"isViewedTogetherProducts",{get:function(){return this._type===S.VIEWED_TOGETHER},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"isSearch",{get:function(){return this._type===S.SEARCH},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"hasPrev",{get:function(){return!(this.isStatic||this.isDiscounted||this.isRecommended||!this._minPage)&&this._minPage>1},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"hasNext",{get:function(){return!(this.isStatic||this.isDiscounted||this.isRecommended)&&this.page*this.limit<this.count},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"isLoading",{get:function(){return this._isLoading},enumerable:!1,configurable:!0}),Object.defineProperty(I.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[t.key]=t.keyList)})),this._searchKeyword&&(a.s=this._searchKeyword),this._sort&&(a.o=b[this._sort]),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 h.stringify(a,{arrayFormat:"comma"})},enumerable:!1,configurable:!0}),Object.defineProperty(I.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(I.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(I.prototype,"isFeaturedSortEnabled",{get:function(){var t;return(null===(t=this.pageSpecificData)||void 0===t?void 0:t.orderType)===a.MANUALLY&&[S.ALL,S.CATEGORY].includes(this._type)},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"disabledSortTypes",{get:function(){return this._disabledSortTypes},enumerable:!1,configurable:!0}),I.prototype.setIsFilteredForProducts=function(){var t=this;this.data.forEach((function(e){return e.isFiltered=t.isFiltered||!1}))},I.prototype.setIsStaticForProducts=function(){var t=this;this.data.forEach((function(e){return e.isStatic=t.isStatic||!1}))},I.prototype.setPageSpecificSort=function(){var t;if((null===(t=this.pageSpecificData)||void 0===t?void 0:t.orderType)&&[S.ALL].includes(this._type))switch(this.pageSpecificData.orderType){case a.HIGHEST_DISCOUNT_RATIO:this._sort=C.DECRASING_DISCOUNT;break;case a.LOWEST_DISCOUNT_RATIO:this._sort=C.INCREASING_DISCOUNT;break;case a.HIGHEST_PRICE:this._sort=C.DECREASING_PRICE;break;case a.LOWEST_PRICE:this._sort=C.INCREASING_PRICE;break;case a.NEWEST:this._sort=C.LAST_ADDED;break;case a.OLDEST:this._sort=C.FIRST_ADDED;break;case a.MANUALLY:this._sort=C.FEATURED}},I.prototype.getSortParams=function(){var t,e;switch(this._sort){case C.INCREASING_PRICE:t=f.ASC,e=g.PRICE;break;case C.DECREASING_PRICE:t=f.DESC,e=g.PRICE;break;case C.FIRST_ADDED:t=f.ASC,e=g.CREATED_AT;break;case C.LAST_ADDED:t=f.DESC,e=g.CREATED_AT;break;case C.INCREASING_DISCOUNT:t=f.ASC,e=g.DISCOUNT_RATIO;break;case C.DECRASING_DISCOUNT:t=f.DESC,e=g.DISCOUNT_RATIO;break;case C.FEATURED:if(this.isSearch)return;t=f.ASC,e=g.MANUAL_SORT;break;case C.DEFAULT:t=void 0,e=void 0;break;case C.AVERAGE_RATING:t=f.DESC,e=g.AVERAGE_RATING;break;case C.REVIEW_COUNT:t=f.DESC,e=g.REVIEW_COUNT;break;case C.SALE_COUNT:t=f.DESC,e=g.SALE_COUNT;break;case C.A_Z:t=f.ASC,e=g.NAME;break;case C.Z_A:t=f.DESC,e=g.NAME}if(t&&e)return{direction:t,type:e}},I.prototype.searchProducts=function(i,r,s){var a,d,c;return t(this,void 0,void 0,(function(){var t,l,h,f,g;return e(this,(function(e){switch(e.label){case 0:return t=[],l=[],null===(a=this.filters)||void 0===a||a.forEach((function(e){e.valueList.length&&t.push(new u({id:e.id,type:e.type,displayType:e.displayType,valueList:e.valueList})),e.isFacetFilter&&l.push({id:e.id,type:e.type,displayType:e.displayType})})),h=null===(d=this._filterCategories)||void 0===d?void 0:d.filter((function(t){return t.isSelected})).map((function(t){return t.id})),f=this.getSortParams(),this.isRelatedProducts&&this._relatedProductData?[4,p.getSuggestedProducts({priceListId:_.getPriceListId(),salesChannelId:_.getSalesChannelId(),productId:this._relatedProductData.productId,brandIds:this._relatedProductData.brandIds,categoryIds:this._relatedProductData.categoryIds,locale:_.getCurrentLocale()})]:[3,2];case 1:case 3:case 5:return[2,e.sent()];case 2:return this.isViewedTogetherProducts&&this._viewedTogetherProductData?[4,p.getSuggestedProducts({priceListId:_.getPriceListId(),salesChannelId:_.getSalesChannelId(),method:m.VIEWED_TOGETHER,productIds:this._viewedTogetherProductData.productIds,locale:_.getCurrentLocale()})]:[3,4];case 4:return g={input:{page:i,perPage:r,productIdList:this.isStatic?null===(c=this._productListPropValue.productIds)||void 0===c?void 0:c.map((function(t){return t.productId})):s,filterList:t,facetList:l,brandId:this._pageType===o.BRAND&&this._type!==S.SEARCH?this._filterBrandId:void 0,categoryIdList:h&&h.length?h:this._filterCategoryId?[this._filterCategoryId]:void 0,priceListId:_.getPriceListId(),salesChannelId:_.getSalesChannelId(),query:this._searchKeyword,order:f?[f]:[],showStockOption:_.getStockPreference()||n.SHOW_ALL}},[4,p.searchProducts(g,this._excludedFields)]}}))}))},I.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,p.getProductFilterData({categoryId:this._filterCategoryId?this._filterCategoryId:void 0,locale:_.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 c(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]}}))}))},I.prototype.applyQueryParamFilters=function(t){var e,i=this;try{null==t||t.forEach((function(t,e){var r,s=null===(r=i.filters)||void 0===r?void 0:r.find((function(t){return t.key===e}));s&&s.applyQueryParam(t)}));var r=null==t?void 0:t.get("s");r&&(this._searchKeyword=r);var s=null==t?void 0:t.get("o");if(s){var a=parseInt(s),n=Object.entries(b).find((function(t){return t[1]===a}));n&&(this._sort=n[0])}if(this._pageType!==o.CATEGORY){var d=null==t?void 0:t.get("c"),c=null==d?void 0:d.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}))})))}}catch(t){console.log(t)}},I.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=o.values.find((function(e){return e.id===t.id}));i?t.resultCount=i.count:e.isCustomValueFilter?t.resultCount=null:t.resultCount=0})):e.isCustomValueFilter?null===(r=e.values)||void 0===r||r.forEach((function(t){return t.resultCount=null})):null===(s=e.values)||void 0===s||s.forEach((function(t){return t.resultCount=0}))}));var r=null==t?void 0:t.find((function(t){return"category"===t.id}));r&&(null===(i=this._filterCategories)||void 0===i||i.forEach((function(t){var e=r.values.find((function(e){return e.id===t.id}));t.resultCount=e?e.count:0})))},I.prototype.setQueryParams=function(){var t;!this.isBrowser()||this.isSearch||_.getIsEditor()||null===(t=this.router)||void 0===t||t.replace("".concat(location.pathname).concat(this.queryParams?"?"+this.queryParams:""),void 0,{shallow:!0})},I.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()},I.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]}}))}))},I.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:_.getIsEditor()||null===(o=E.getInstance().router)||void 0===o||o.push(i.href+(this.queryParams?"?"+this.queryParams:"")),t.label=3;case 3:return[2]}}))}))},I.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}},I.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)}},I.prototype.getQueryParams=function(){if(this.isBrowser())return new URLSearchParams(location.search)},I.prototype.isBrowser=function(){return"undefined"!=typeof window},I.prototype.waitForCustomerStoreInit=function(){return new Promise((function(t){var e=setInterval((function(){E.getInstance().customerStore.initialized&&(clearInterval(e),t(null))}),1e3)}))},I.prototype.handleListingEvent=function(){this.searchKeyword&&this.data.length?v.viewSearchResults(this._searchKeyword,this.data):this.data.length&&this._type===S.ALL&&v.viewListing(this.data)},I}();!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"}(S||(S={})),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"}(C||(C={})),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"}(T||(T={})),function(t){t.CATEGORY="CATEGORY",t.BRAND="BRAND"}(A||(A={}));var b=((I={})[C.INCREASING_PRICE]=1,I[C.DECREASING_PRICE]=2,I[C.LAST_ADDED]=3,I[C.FIRST_ADDED]=4,I[C.INCREASING_DISCOUNT]=5,I[C.DECRASING_DISCOUNT]=6,I[C.FEATURED]=7,I[C.DEFAULT]=8,I[C.AVERAGE_RATING]=9,I[C.REVIEW_COUNT]=10,I[C.SALE_COUNT]=11,I[C.A_Z]=12,I[C.Z_A]=13,I);export{P as IkasProductList,T as IkasProductListSortByTypeEnum,C as IkasProductListSortType,S 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}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 d}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/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 c,IkasProductFilterValue as u}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 l}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/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 p from"../../../store/product/index.js";import h from"query-string";import{SortByDirectionEnum as f,SortByTypeEnum as m,GetSuggestedProductsMethodEnum as g}from"@ikas/storefront-api";import{IkasStorefrontConfig as _}from"@ikas/storefront-config";import{Analytics as v}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{IkasProductVariantFunctions as y}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"../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 E}from"../../../store/base.js";import"../../../store/customer/index.js";import"../../../store/cart/index.js";import"lodash/get";var I,S,C,T,A,P=function(){function I(a,n){var u=this;this.filters=null,this._filterCategories=null,this._infiniteScrollPage=null,this._initialized=!1,this._minPage=null,this._filterBrandId=null,this._filterCategoryId=null,this._relatedProductData=null,this._viewedTogetherProductData=null,this.pageSpecificData=null,this._recommendFor=null,this._isLoading=!1,this._fetchRequestTime=0,this.router=null,this._excludedFields=null,this._disabledSortTypes=null,this.applyFilters=function(){return t(u,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(u,void 0,void 0,(function(){var t,o,a,n,d,c,u,p,h,f,m,g,_,v,I,S=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,E.getInstance().customerStore.getLastViewedProducts()];case 8:return(c=e.sent())&&c.length?(n=c.map((function(t){return t.productId})),d=E.getInstance().customerStore.useLastViewedProductResponse,[3,10]):[2];case 9:return[2];case 10:return d?(p=E.getInstance().customerStore._savedLastViewedProductsResponse,[3,13]):[3,11];case 11:return[4,this.searchProducts(o||1,a||10,n)];case 12:p=e.sent(),e.label=13;case 13:return(u=p)&&this._fetchRequestTime===t?(h=[],!d&&this.isLastViewed&&E.getInstance().customerStore.setSavedLastViewedProductsResponse(u),this.isStatic||this.isLastViewed?(f=this.isStatic?this._productListPropValue.productIds:E.getInstance().customerStore._lastViewedProducts,h=(null==f?void 0:f.map((function(t){var e,r,s=null===(r=null===(e=u.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)&&y.hasStock(o)||(o=null==s?void 0:s.variants.find((function(t){return t.isActive&&y.hasStock(t)}))),s&&o)return new l(i(i({},s),{selectedVariantValues:o.variantValues}))})).filter((function(t){return!!t})))||[]):h=(null===(_=null===(g=u.data)||void 0===g?void 0:g.data)||void 0===_?void 0:_.map((function(t){var e=S.getSelectedVariant(t);return new l(i(i({},t),{selectedVariantValues:e.variantValues}))})))||[],this.applyFacets(null===(v=u.data)||void 0===v?void 0:v.facets),this.data=h,this._count=(null===(I=u.data)||void 0===I?void 0:I.count)||0,this._initialized=!0,this._page=o||1,this._minPage=this.page,this.setIsFilteredForProducts(),this.setIsStaticForProducts(),s||(this._infiniteScrollPage=null),this.handleListingEvent(),[2,!0]):[2];case 14:return m=e.sent(),console.log(m),[3,16];case 15:return t===this._fetchRequestTime&&(this._isLoading=!1),[7];case 16:return[2]}}))}))},this.getPrev=function(){return t(u,void 0,void 0,(function(){var t,r,s,o,a,n,d,c=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=c.getSelectedVariant(t);return new l(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(u,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 l(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(u,void 0,void 0,(function(){var t,s,o,a,n,d,c=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=c.getSelectedVariant(t);return new l(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;u._infiniteScrollPage!==t&&(u._infiniteScrollPage=t,_.getIsEditor()||null===(e=u.router)||void 0===e||e.replace("".concat(location.pathname).concat(u.queryParams?"?"+u.queryParams:""),void 0,{shallow:!0}))},this.searchDebouncer=s((function(){u.applyFilters()}),500),this.searchAnalyticsDebouncer=s((function(){v.search(u._searchKeyword)}),1e3);var p=a,h=a;if(this.data=a.data?a.data.map((function(t){return new l(t)})):[],this._type=p.type||h._type||p.productListPropValue.productListType||h._productListPropValue.productListType||S.ALL,this._pageType=a.pageType,this._sort=a.sort||a.productListPropValue.initialSort||C.LAST_ADDED,this._limit=a.limit||p.productListPropValue.initialLimit||h._productListPropValue.initialLimit||20,this._page=a.page||1,this._minPage=a.minPage||null,this._count=a.count||0,this._searchKeyword=a.searchKeyword||"",this._productListPropValue=p.productListPropValue||h._productListPropValue,this._filterBrandId=p.filterBrandId||h._filterBrandId||null,this._filterCategoryId=p.filterCategoryId||h._filterCategoryId||null,this._relatedProductData=p.relatedProductData||h._relatedProductData||null,this._viewedTogetherProductData=p.viewedTogetherProductData||h._viewedTogetherProductData||null,this._excludedFields=p.excludedFields||h._excludedFields||null,this._disabledSortTypes=p.disabledSortTypes||h._disabledSortTypes||null,this._recommendFor=p.recommendFor||h._recommendFor,this.filters=a.filters?a.filters.map((function(t){return new c(t,u)})):null,this._filterCategories=a.filterCategories?a.filterCategories.map((function(t){return new d(t)})):null,this.pageSpecificData=p.pageSpecificData||h.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===S.SEARCH)){var f=this.getQueryParams();this.getInitial(f,this._page>1)}else this._page>1?this.getInitial(void 0,!0):this.isLastViewed?this.getInitial():this.handleListingEvent()}return Object.defineProperty(I.prototype,"sort",{get:function(){return this._sort},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"limit",{get:function(){return this._limit},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"pageType",{get:function(){return this._pageType},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"page",{get:function(){return this._page},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"minPage",{get:function(){return this._minPage||1},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"count",{get:function(){return this._count},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"pageCount",{get:function(){return Math.ceil(this._count/this._limit)},enumerable:!1,configurable:!0}),Object.defineProperty(I.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(I.prototype,"isInitialized",{get:function(){return this._initialized},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"isFilterable",{get:function(){return this._type===S.ALL||this._type===S.CATEGORY},enumerable:!1,configurable:!0}),Object.defineProperty(I.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(I.prototype,"isStatic",{get:function(){return this._type===S.STATIC},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"isDiscounted",{get:function(){return this._type===S.DISCOUNTED},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"isRecommended",{get:function(){return this._type===S.RECOMMENDED},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"isLastViewed",{get:function(){return this._type===S.LAST_VIEWED},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"isRelatedProducts",{get:function(){return this._type===S.RELATED_PRODUCTS},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"isViewedTogetherProducts",{get:function(){return this._type===S.VIEWED_TOGETHER},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"isSearch",{get:function(){return this._type===S.SEARCH},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"hasPrev",{get:function(){return!(this.isStatic||this.isDiscounted||this.isRecommended||!this._minPage)&&this._minPage>1},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"hasNext",{get:function(){return!(this.isStatic||this.isDiscounted||this.isRecommended)&&this.page*this.limit<this.count},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"isLoading",{get:function(){return this._isLoading},enumerable:!1,configurable:!0}),Object.defineProperty(I.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[t.key]=t.keyList)})),this._searchKeyword&&(a.s=this._searchKeyword),this._sort&&(a.o=b[this._sort]),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 h.stringify(a,{arrayFormat:"comma"})},enumerable:!1,configurable:!0}),Object.defineProperty(I.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(I.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(I.prototype,"isFeaturedSortEnabled",{get:function(){var t;return(null===(t=this.pageSpecificData)||void 0===t?void 0:t.orderType)===a.MANUALLY&&[S.ALL,S.CATEGORY].includes(this._type)},enumerable:!1,configurable:!0}),Object.defineProperty(I.prototype,"disabledSortTypes",{get:function(){return this._disabledSortTypes},enumerable:!1,configurable:!0}),I.prototype.setIsFilteredForProducts=function(){var t=this;this.data.forEach((function(e){return e.isFiltered=t.isFiltered||!1}))},I.prototype.setIsStaticForProducts=function(){var t=this;this.data.forEach((function(e){return e.isStatic=t.isStatic||!1}))},I.prototype.setPageSpecificSort=function(){var t;if((null===(t=this.pageSpecificData)||void 0===t?void 0:t.orderType)&&[S.ALL].includes(this._type))switch(this.pageSpecificData.orderType){case a.HIGHEST_DISCOUNT_RATIO:this._sort=C.DECRASING_DISCOUNT;break;case a.LOWEST_DISCOUNT_RATIO:this._sort=C.INCREASING_DISCOUNT;break;case a.HIGHEST_PRICE:this._sort=C.DECREASING_PRICE;break;case a.LOWEST_PRICE:this._sort=C.INCREASING_PRICE;break;case a.NEWEST:this._sort=C.LAST_ADDED;break;case a.OLDEST:this._sort=C.FIRST_ADDED;break;case a.MANUALLY:this._sort=C.FEATURED}},I.prototype.getSortParams=function(){var t,e;switch(this._sort){case C.INCREASING_PRICE:t=f.ASC,e=m.PRICE;break;case C.DECREASING_PRICE:t=f.DESC,e=m.PRICE;break;case C.FIRST_ADDED:t=f.ASC,e=m.CREATED_AT;break;case C.LAST_ADDED:t=f.DESC,e=m.CREATED_AT;break;case C.INCREASING_DISCOUNT:t=f.ASC,e=m.DISCOUNT_RATIO;break;case C.DECRASING_DISCOUNT:t=f.DESC,e=m.DISCOUNT_RATIO;break;case C.FEATURED:if(this.isSearch)return;t=f.ASC,e=m.MANUAL_SORT;break;case C.DEFAULT:t=void 0,e=void 0;break;case C.AVERAGE_RATING:t=f.DESC,e=m.AVERAGE_RATING;break;case C.REVIEW_COUNT:t=f.DESC,e=m.REVIEW_COUNT;break;case C.SALE_COUNT:t=f.DESC,e=m.SALE_COUNT;break;case C.A_Z:t=f.ASC,e=m.NAME;break;case C.Z_A:t=f.DESC,e=m.NAME}if(t&&e)return{direction:t,type:e}},I.prototype.searchProducts=function(i,r,s){var a,d,c;return t(this,void 0,void 0,(function(){var t,l,h,f,m;return e(this,(function(e){switch(e.label){case 0:return t=[],l=[],null===(a=this.filters)||void 0===a||a.forEach((function(e){e.valueList.length&&t.push(new u({id:e.id,type:e.type,displayType:e.displayType,valueList:e.valueList})),e.isFacetFilter&&l.push({id:e.id,type:e.type,displayType:e.displayType})})),h=null===(d=this._filterCategories)||void 0===d?void 0:d.filter((function(t){return t.isSelected})).map((function(t){return t.id})),f=this.getSortParams(),this.isRelatedProducts&&this._relatedProductData?[4,p.getSuggestedProducts({priceListId:_.getPriceListId(),salesChannelId:_.getSalesChannelId(),productId:this._relatedProductData.productId,brandIds:this._relatedProductData.brandIds,categoryIds:this._relatedProductData.categoryIds,locale:_.getCurrentLocale()})]:[3,2];case 1:case 3:case 5:return[2,e.sent()];case 2:return this.isViewedTogetherProducts&&this._viewedTogetherProductData?[4,p.getSuggestedProducts({priceListId:_.getPriceListId(),salesChannelId:_.getSalesChannelId(),method:g.VIEWED_TOGETHER,productIds:this._viewedTogetherProductData.productIds,locale:_.getCurrentLocale()})]:[3,4];case 4:return m={input:{page:i,perPage:r,productIdList:this.isStatic?null===(c=this._productListPropValue.productIds)||void 0===c?void 0:c.map((function(t){return t.productId})):s,filterList:t,facetList:l,brandId:this._pageType===o.BRAND&&this._type!==S.SEARCH?this._filterBrandId:void 0,categoryIdList:h&&h.length?h:this._filterCategoryId?[this._filterCategoryId]:void 0,priceListId:_.getPriceListId(),salesChannelId:_.getSalesChannelId(),query:this._searchKeyword,order:f?[f]:[],showStockOption:_.getStockPreference()||n.SHOW_ALL}},[4,p.searchProducts(m,this._excludedFields)]}}))}))},I.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,p.getProductFilterData({categoryId:this._filterCategoryId?this._filterCategoryId:void 0,locale:_.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 c(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]}}))}))},I.prototype.applyQueryParamFilters=function(t){var e,i=this;try{null==t||t.forEach((function(t,e){var r,s=null===(r=i.filters)||void 0===r?void 0:r.find((function(t){return t.key===e}));s&&s.applyQueryParam(t)}));var r=null==t?void 0:t.get("s");r&&(this._searchKeyword=r);var s=null==t?void 0:t.get("o");if(s){var a=parseInt(s),n=Object.entries(b).find((function(t){return t[1]===a}));n&&(this._sort=n[0])}if(this._pageType!==o.CATEGORY){var d=null==t?void 0:t.get("c"),c=null==d?void 0:d.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}))})))}}catch(t){console.log(t)}},I.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=o.values.find((function(e){return e.id===t.id}));i?t.resultCount=i.count:e.isCustomValueFilter?t.resultCount=null:t.resultCount=0})):e.isCustomValueFilter?null===(r=e.values)||void 0===r||r.forEach((function(t){return t.resultCount=null})):null===(s=e.values)||void 0===s||s.forEach((function(t){return t.resultCount=0}))}));var r=null==t?void 0:t.find((function(t){return"category"===t.id}));r&&(null===(i=this._filterCategories)||void 0===i||i.forEach((function(t){var e=r.values.find((function(e){return e.id===t.id}));t.resultCount=e?e.count:0})))},I.prototype.setQueryParams=function(){var t;!this.isBrowser()||this.isSearch||_.getIsEditor()||null===(t=this.router)||void 0===t||t.replace("".concat(location.pathname).concat(this.queryParams?"?"+this.queryParams:""),void 0,{shallow:!0})},I.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()},I.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]}}))}))},I.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:_.getIsEditor()||null===(o=E.getInstance().router)||void 0===o||o.push(i.href+(this.queryParams?"?"+this.queryParams:"")),t.label=3;case 3:return[2]}}))}))},I.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}},I.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)}},I.prototype.getQueryParams=function(){if(this.isBrowser())return new URLSearchParams(location.search)},I.prototype.isBrowser=function(){return"undefined"!=typeof window},I.prototype.waitForCustomerStoreInit=function(){return new Promise((function(t){var e=setInterval((function(){E.getInstance().customerStore.initialized&&(clearInterval(e),t(null))}),1e3)}))},I.prototype.handleListingEvent=function(){this.searchKeyword&&this.data.length?v.viewSearchResults(this._searchKeyword,this.data):this.data.length&&this._type===S.ALL&&v.viewListing(this.data)},I}();!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"}(S||(S={})),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"}(C||(C={})),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"}(T||(T={})),function(t){t.CATEGORY="CATEGORY",t.BRAND="BRAND"}(A||(A={}));var b=((I={})[C.INCREASING_PRICE]=1,I[C.DECREASING_PRICE]=2,I[C.LAST_ADDED]=3,I[C.FIRST_ADDED]=4,I[C.INCREASING_DISCOUNT]=5,I[C.DECRASING_DISCOUNT]=6,I[C.FEATURED]=7,I[C.DEFAULT]=8,I[C.AVERAGE_RATING]=9,I[C.REVIEW_COUNT]=10,I[C.SALE_COUNT]=11,I[C.A_Z]=12,I[C.Z_A]=13,I);export{P as IkasProductList,T as IkasProductListSortByTypeEnum,C as IkasProductListSortType,S as IkasProductListType,A as IkasRelatedProductsType};
@@ -1 +1 @@
1
- import{__awaiter as t,__generator as i}from'./../../../ext/tslib/tslib.es6.js';import{populateRaffleProducts as e}from"@ikas/storefront-providers";import{makeAutoObservable as a,runInAction as n}from"mobx";import r from"../../../store/raffle/index.js";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"@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/district/index.js";import"../../data/favorite-product/index.js";import"../../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/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"../../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"../../data/product/index.js";import{IkasRaffle as o}from"../../data/raffle/index.js";import"../../data/shipping-zone/state/city/district/region/index.js";import"../../data/state/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";var s=function(){function s(e){void 0===e&&(e={});var r=this;this._initialized=!1,this._minPage=null,this._isLoading=!1,this.getPrev=function(){return t(r,void 0,void 0,(function(){var t,e,a,n,r,o;return i(this,(function(i){switch(i.label){case 0:if(this._isLoading||!this.hasPrev)return[2];this._isLoading=!0,i.label=1;case 1:return i.trys.push([1,3,4,5]),t=this._minPage-1,[4,this.getRaffleList(t,this.limit)];case 2:return e=i.sent(),this.data=(null===(r=null===(n=e.data)||void 0===n?void 0:n.data)||void 0===r?void 0:r.concat(this.data))||this.data,this._count=(null===(o=e.data)||void 0===o?void 0:o.count)||this._count,this._minPage=t,[3,5];case 3:return a=i.sent(),console.log(a),[3,5];case 4:return this._isLoading=!1,[7];case 5:return[2]}}))}))},this.getNext=function(){return t(r,void 0,void 0,(function(){var t,e,a,n;return i(this,(function(i){switch(i.label){case 0:if(this._isLoading||!this.hasNext)return[2];this._isLoading=!0,i.label=1;case 1:return i.trys.push([1,3,4,5]),[4,this.getRaffleList(this.page+1,this.limit)];case 2:return t=i.sent(),this.data=this.data.concat((null===(a=t.data)||void 0===a?void 0:a.data)||[]),this._count=(null===(n=t.data)||void 0===n?void 0:n.count)||this._count,this._page=this.page+1,[3,5];case 3:return e=i.sent(),console.log(e),[3,5];case 4:return this._isLoading=!1,[7];case 5:return[2]}}))}))},this.getPage=function(e){return t(r,void 0,void 0,(function(){var t,a,r=this;return i(this,(function(i){switch(i.label){case 0:if(this._isLoading)return[2];this._isLoading=!0,i.label=1;case 1:return i.trys.push([1,3,4,5]),[4,this.getRaffleList(e,this.limit)];case 2:return t=i.sent(),n((function(){var i,a;r.data=(null===(i=t.data)||void 0===i?void 0:i.data)||[],r._count=(null===(a=t.data)||void 0===a?void 0:a.count)||0,r._page=e,r._minPage=e})),[3,5];case 3:return a=i.sent(),console.log(a),[3,5];case 4:return this._isLoading=!1,[7];case 5:return[2]}}))}))},this.data=e.data?e.data.map((function(t){return new o(t)})):[],this._limit=e.limit||20,this._page=e.page||1,this._count=e.count||0,this._initialized=e.initialized||!1,this._minPage=e.minPage||null,this._start=e.start||null,this._end=e.end||null,this._includeDeleted=e.includeDeleted||null,this._name=e.name||null,this._search=e.search||null,this._id=e.id||null,a(this)}return Object.defineProperty(s.prototype,"limit",{get:function(){return this._limit},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"page",{get:function(){return this._page},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"count",{get:function(){return this._count},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"pageCount",{get:function(){return Math.ceil(this._count/this._limit)},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"isInitialized",{get:function(){return this._initialized},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"hasPrev",{get:function(){return!!this._minPage&&this._minPage>1},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"hasNext",{get:function(){return this.page*this.limit<this.count},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"isLoading",{get:function(){return this._isLoading},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"minPage",{get:function(){return this._minPage||1},enumerable:!1,configurable:!0}),s.prototype.getRaffleList=function(a,n){var o;return t(this,void 0,void 0,(function(){var t;return i(this,(function(i){switch(i.label){case 0:return[4,r.listStorefrontRaffle({start:this._start?{eq:this._start}:void 0,end:this._end?{eq:this._end}:void 0,includeDeleted:this._includeDeleted||!1,name:this._name?{eq:this._name}:void 0,id:this._id?{eq:this._id}:void 0,search:this._search||void 0,pagination:{limit:n,page:a}})];case 1:return t=i.sent(),[4,e((null===(o=t.data)||void 0===o?void 0:o.data)||[])];case 2:return i.sent(),[2,t]}}))}))},s.prototype.toJSON=function(){return{data:this.data,limit:this._limit,page:this._page,count:this._count,initialized:this._initialized,minPage:this._minPage}},s}();export{s as IkasRaffleList};
1
+ import{__awaiter as t,__generator as i}from'./../../../ext/tslib/tslib.es6.js';import{populateRaffleProducts as e}from"@ikas/storefront-providers";import{makeAutoObservable as a,runInAction as n}from"mobx";import r from"../../../store/raffle/index.js";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"@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"../../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/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"../../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"../../data/product/index.js";import{IkasRaffle as o}from"../../data/raffle/index.js";import"../../data/shipping-zone/state/city/district/region/index.js";import"../../data/state/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";var s=function(){function s(e){void 0===e&&(e={});var r=this;this._initialized=!1,this._minPage=null,this._isLoading=!1,this.getPrev=function(){return t(r,void 0,void 0,(function(){var t,e,a,n,r,o;return i(this,(function(i){switch(i.label){case 0:if(this._isLoading||!this.hasPrev)return[2];this._isLoading=!0,i.label=1;case 1:return i.trys.push([1,3,4,5]),t=this._minPage-1,[4,this.getRaffleList(t,this.limit)];case 2:return e=i.sent(),this.data=(null===(r=null===(n=e.data)||void 0===n?void 0:n.data)||void 0===r?void 0:r.concat(this.data))||this.data,this._count=(null===(o=e.data)||void 0===o?void 0:o.count)||this._count,this._minPage=t,[3,5];case 3:return a=i.sent(),console.log(a),[3,5];case 4:return this._isLoading=!1,[7];case 5:return[2]}}))}))},this.getNext=function(){return t(r,void 0,void 0,(function(){var t,e,a,n;return i(this,(function(i){switch(i.label){case 0:if(this._isLoading||!this.hasNext)return[2];this._isLoading=!0,i.label=1;case 1:return i.trys.push([1,3,4,5]),[4,this.getRaffleList(this.page+1,this.limit)];case 2:return t=i.sent(),this.data=this.data.concat((null===(a=t.data)||void 0===a?void 0:a.data)||[]),this._count=(null===(n=t.data)||void 0===n?void 0:n.count)||this._count,this._page=this.page+1,[3,5];case 3:return e=i.sent(),console.log(e),[3,5];case 4:return this._isLoading=!1,[7];case 5:return[2]}}))}))},this.getPage=function(e){return t(r,void 0,void 0,(function(){var t,a,r=this;return i(this,(function(i){switch(i.label){case 0:if(this._isLoading)return[2];this._isLoading=!0,i.label=1;case 1:return i.trys.push([1,3,4,5]),[4,this.getRaffleList(e,this.limit)];case 2:return t=i.sent(),n((function(){var i,a;r.data=(null===(i=t.data)||void 0===i?void 0:i.data)||[],r._count=(null===(a=t.data)||void 0===a?void 0:a.count)||0,r._page=e,r._minPage=e})),[3,5];case 3:return a=i.sent(),console.log(a),[3,5];case 4:return this._isLoading=!1,[7];case 5:return[2]}}))}))},this.data=e.data?e.data.map((function(t){return new o(t)})):[],this._limit=e.limit||20,this._page=e.page||1,this._count=e.count||0,this._initialized=e.initialized||!1,this._minPage=e.minPage||null,this._start=e.start||null,this._end=e.end||null,this._includeDeleted=e.includeDeleted||null,this._name=e.name||null,this._search=e.search||null,this._id=e.id||null,a(this)}return Object.defineProperty(s.prototype,"limit",{get:function(){return this._limit},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"page",{get:function(){return this._page},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"count",{get:function(){return this._count},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"pageCount",{get:function(){return Math.ceil(this._count/this._limit)},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"isInitialized",{get:function(){return this._initialized},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"hasPrev",{get:function(){return!!this._minPage&&this._minPage>1},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"hasNext",{get:function(){return this.page*this.limit<this.count},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"isLoading",{get:function(){return this._isLoading},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"minPage",{get:function(){return this._minPage||1},enumerable:!1,configurable:!0}),s.prototype.getRaffleList=function(a,n){var o;return t(this,void 0,void 0,(function(){var t;return i(this,(function(i){switch(i.label){case 0:return[4,r.listStorefrontRaffle({start:this._start?{eq:this._start}:void 0,end:this._end?{eq:this._end}:void 0,includeDeleted:this._includeDeleted||!1,name:this._name?{eq:this._name}:void 0,id:this._id?{eq:this._id}:void 0,search:this._search||void 0,pagination:{limit:n,page:a}})];case 1:return t=i.sent(),[4,e((null===(o=t.data)||void 0===o?void 0:o.data)||[])];case 2:return i.sent(),[2,t]}}))}))},s.prototype.toJSON=function(){return{data:this.data,limit:this._limit,page:this._page,count:this._count,initialized:this._initialized,minPage:this._minPage}},s}();export{s as IkasRaffleList};
@@ -1 +1 @@
1
- import{__awaiter as e,__generator as t,__spreadArray as r}from'./../../../../ext/tslib/tslib.es6.js';import{makeObservable as a,computed as i,action as o}from"mobx";import{Validator as s}from"../index.js";import{IkasBaseStore as n}from"../../../../store/base.js";import"../../../../store/customer/index.js";import"../../../../store/cart/index.js";import{PhoneRule as d,RequiredRule as m}from"../rules/index.js";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{IkasCustomerEmailSubscriptionStatus 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/district/index.js";import"../../../data/favorite-product/index.js";import"../../../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/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"../../../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"../../../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/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";var p=function(){function p(e){var t=this;this.validatorRules=function(e){return void 0===e&&(e=!1),r([new m({model:t.customer,fieldKey:"firstName",valuePath:"firstName",message:t.message.requiredRule}),new m({model:t.customer,fieldKey:"lastName",valuePath:"lastName",message:t.message.requiredRule})],e?[new d({model:t.customer,fieldKey:"phone",valuePath:"phone",message:t.message.phoneRule})]:[],!0)},this.onFirstNameChange=function(e){t.customer.firstName=e},this.onLastNameChange=function(e){t.customer.lastName=e},this.onPhoneChange=function(e){t.customer.phone=e||null,e||t.validator.setRules(t.validatorRules())},a(this,{firstNameErrorMessage:i,lastNameErrorMessage:i,phoneErrorMessage:i,isMarketingAccepted:i,hasError:i,firstName:i,lastName:i,phone:i,validateAll:o,submit:o}),this.customer=e.customer,this.message=e.message,this.validator=new s(this.customer,this.validatorRules())}return Object.defineProperty(p.prototype,"hasError",{get:function(){return this.validator.hasError},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"email",{get:function(){return this.customer.email},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"firstName",{get:function(){return this.customer.firstName},set:function(e){this.customer.firstName=e},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"lastName",{get:function(){return this.customer.lastName||""},set:function(e){this.customer.lastName=e},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"phone",{get:function(){return this.customer.phone||""},set:function(e){this.customer.phone=e},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"isMarketingAccepted",{get:function(){return this.customer.isSubscribed},set:function(e){this.customer.subscriptionStatus=e?u.SUBSCRIBED:u.NOT_SUBSCRIBED},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"firstNameErrorMessage",{get:function(){var e,t;return null===(t=null===(e=this.validator.results)||void 0===e?void 0:e.firstName)||void 0===t?void 0:t.errorMessage},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"lastNameErrorMessage",{get:function(){var e,t;return null===(t=null===(e=this.validator.results)||void 0===e?void 0:e.lastName)||void 0===t?void 0:t.errorMessage},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"phoneErrorMessage",{get:function(){var e,t;return null===(t=null===(e=this.validator.results)||void 0===e?void 0:e.phone)||void 0===t?void 0:t.errorMessage},enumerable:!1,configurable:!0}),p.prototype.validateAll=function(){return this.validator.validateAll()},p.prototype.submit=function(){return e(this,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return e={isFormError:!1,isSuccess:!1},this.phone&&this.validator.setRules(this.validatorRules(!0)),[4,this.validateAll()];case 1:if(t.sent())return e.isFormError=!0,[2,e];t.label=2;case 2:return t.trys.push([2,4,,5]),[4,n.getInstance().customerStore.saveCustomer(this.customer)];case 3:return t.sent()&&(e.isSuccess=!0),[2,e];case 4:return t.sent(),[2,e];case 5:return[2]}}))}))},p}();export{p as AccountInfoForm};
1
+ import{__awaiter as t,__generator as e,__spreadArray as r}from'./../../../../ext/tslib/tslib.es6.js';import{makeObservable as a,computed as i,action as o}from"mobx";import{Validator as s}from"../index.js";import{IkasBaseStore as n}from"../../../../store/base.js";import"../../../../store/customer/index.js";import"../../../../store/cart/index.js";import{PhoneRule as d,RequiredRule as m}from"../rules/index.js";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{IkasCustomerEmailSubscriptionStatus 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"../../../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/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"../../../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"../../../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/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";var p=function(){function p(t){var e=this;this.validatorRules=function(t){return void 0===t&&(t=!1),r([new m({model:e.customer,fieldKey:"firstName",valuePath:"firstName",message:e.message.requiredRule}),new m({model:e.customer,fieldKey:"lastName",valuePath:"lastName",message:e.message.requiredRule})],t?[new d({model:e.customer,fieldKey:"phone",valuePath:"phone",message:e.message.phoneRule})]:[],!0)},this.onFirstNameChange=function(t){e.customer.firstName=t},this.onLastNameChange=function(t){e.customer.lastName=t},this.onPhoneChange=function(t){e.customer.phone=t||null,t||e.validator.setRules(e.validatorRules())},a(this,{firstNameErrorMessage:i,lastNameErrorMessage:i,phoneErrorMessage:i,isMarketingAccepted:i,hasError:i,firstName:i,lastName:i,phone:i,validateAll:o,submit:o}),this.customer=t.customer,this.message=t.message,this.validator=new s(this.customer,this.validatorRules())}return Object.defineProperty(p.prototype,"hasError",{get:function(){return this.validator.hasError},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"email",{get:function(){return this.customer.email},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"firstName",{get:function(){return this.customer.firstName},set:function(t){this.customer.firstName=t},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"lastName",{get:function(){return this.customer.lastName||""},set:function(t){this.customer.lastName=t},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"phone",{get:function(){return this.customer.phone||""},set:function(t){this.customer.phone=t},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"isMarketingAccepted",{get:function(){return this.customer.isSubscribed},set:function(t){this.customer.subscriptionStatus=t?u.SUBSCRIBED:u.NOT_SUBSCRIBED},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"firstNameErrorMessage",{get:function(){var t,e;return null===(e=null===(t=this.validator.results)||void 0===t?void 0:t.firstName)||void 0===e?void 0:e.errorMessage},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"lastNameErrorMessage",{get:function(){var t,e;return null===(e=null===(t=this.validator.results)||void 0===t?void 0:t.lastName)||void 0===e?void 0:e.errorMessage},enumerable:!1,configurable:!0}),Object.defineProperty(p.prototype,"phoneErrorMessage",{get:function(){var t,e;return null===(e=null===(t=this.validator.results)||void 0===t?void 0:t.phone)||void 0===e?void 0:e.errorMessage},enumerable:!1,configurable:!0}),p.prototype.validateAll=function(){return this.validator.validateAll()},p.prototype.submit=function(){return t(this,void 0,void 0,(function(){var t;return e(this,(function(e){switch(e.label){case 0:return t={isFormError:!1,isSuccess:!1},this.phone&&this.validator.setRules(this.validatorRules(!0)),[4,this.validateAll()];case 1:if(e.sent())return t.isFormError=!0,[2,t];e.label=2;case 2:return e.trys.push([2,4,,5]),[4,n.getInstance().customerStore.saveCustomer(this.customer)];case 3:return e.sent()&&(t.isSuccess=!0),[2,t];case 4:return e.sent(),[2,t];case 5:return[2]}}))}))},p}();export{p as AccountInfoForm};
@@ -1 +1 @@
1
- import{__spreadArray as t,__awaiter as e,__generator as i}from'./../../../../ext/tslib/tslib.es6.js';import{makeObservable as s,computed as r,observable as n,action as d}from"mobx";import a from"lodash/cloneDeep";import{Validator as o}from"../index.js";import{PhoneRule as u,RequiredRule as l}from"../rules/index.js";import{listCountry as c,listState as m,listCity as p,listDistrict as h}from"@ikas/storefront-api";import{IkasStorefrontConfig as f}from"@ikas/storefront-config";import{FREE_TEXT_CITY_COUNTRY_LIST as g}from"../../../../utils/constants.js";import{IkasBaseStore as v}from"../../../../store/base.js";import"../../../../store/customer/index.js";import"../../../../store/cart/index.js";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"@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{IkasCustomerAddress as y}from"../../../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/district/index.js";import"../../../data/favorite-product/index.js";import"../../../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/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"../../../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"../../../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/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";var j=function(t){return t.sort((function(t,e){return t.label.localeCompare(e.label)}))},b=function(t){return{label:t.name,value:t.id+""}},x=function(){function x(g){var j=this;this.countries=[],this.states=[],this.cities=[],this.districts=[],this._isCountriesPending=!0,this._isStatesPending=!1,this._isCitiesPending=!1,this._isDistrictsPending=!1,this.validatorRules=function(e){return void 0===e&&(e=!1),t([new l({model:j.address,fieldKey:"firstName",valuePath:"firstName",message:j.message.requiredRule}),new l({model:j.address,fieldKey:"lastName",valuePath:"lastName",message:j.message.requiredRule}),new l({model:j.address,fieldKey:"addressLine1",valuePath:"addressLine1",message:j.message.requiredRule}),new l({model:j.address,fieldKey:"country",valuePath:"country",message:j.message.requiredRule}),new l({model:j.address,fieldKey:"state",valuePath:"state",message:j.message.requiredRule}),new l({model:j.address,fieldKey:"city",valuePath:"city",message:j.message.requiredRule}),new l({model:j.address,fieldKey:"title",valuePath:"title",message:j.message.requiredRule})],e?[new u({model:j.address,fieldKey:"phone",valuePath:"phone",message:j.message.phoneRule})]:[],!0)},this.onTitleChange=function(t){j.address.title=t},this.onFirstNameChange=function(t){j.address.firstName=t},this.onLastNameChange=function(t){j.address.lastName=t},this.onPhoneChange=function(t){j.address.phone=t,t||j.validator.setRules(j.validatorRules())},this.onAddressLine1Change=function(t){j.address.addressLine1=t},this.onAddressLine2Change=function(t){j.address.addressLine2=t},this.onAddressPostalCodeChange=function(t){j.address.postalCode=t},this.onCountryChange=function(t){var e;if((null===(e=j.address.country)||void 0===e?void 0:e.id)!==t){var i=j.countries.find((function(e){return e.id===t}));j.address.country={id:(null==i?void 0:i.id)||null,name:(null==i?void 0:i.name)||"",code:(null==i?void 0:i.iso3)||null,iso2:(null==i?void 0:i.iso2)||null,iso3:(null==i?void 0:i.iso3)||null},j.address.state=null,j.address.city=null,j.address.district=null,j.states=[],j.cities=[],j.districts=[],j.listStates()}},this.onStateChange=function(t){var e;if((null===(e=j.address.state)||void 0===e?void 0:e.id)!==t){var i=j.states.find((function(e){return e.id===t}));j.address.state={id:i.id,name:null==i?void 0:i.name,code:null==i?void 0:i.stateCode},j.address.city=null,j.address.district=null,j.cities=[],j.districts=[],j.listCities()}},this.onCityChange=function(t){var e;if((null===(e=j.address.city)||void 0===e?void 0:e.id)!==t){var i=j.cities.find((function(e){return e.id===t}));j.address.city={id:i.id,name:i.name,code:null},j.address.district=null,j.districts=[],j.listDistricts()}},this.onCityInputChange=function(t){j.districts=[],j.address.city={id:null,name:t,code:null}},this.onDistrictChange=function(t){var e;if((null===(e=j.address.district)||void 0===e?void 0:e.id)!==t){var i=j.districts.find((function(e){return e.id===t}));j.address.district={id:i.id,name:i.name,code:null}}},this.onDistrictInputChange=function(t){j.address.district={id:null,name:t,code:null}},this.listCountries=function(){return e(j,void 0,void 0,(function(){var t,e,s,r;return i(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,3,4]),this._isCountriesPending=!0,[4,c({})];case 1:return t=i.sent(),e=f.getCurrentRouting(),s=t.data||[],(null===(r=null==e?void 0:e.countryCodes)||void 0===r?void 0:r.length)&&(s=s.filter((function(t){var i;return t.iso2&&(null===(i=e.countryCodes)||void 0===i?void 0:i.includes(t.iso2))}))),this.countries=s,1!==this.countries.length||this.address.country||this.onCountryChange(this.countries[0].id),this.countries=s,[3,4];case 2:return i.sent(),[3,4];case 3:return this._isCountriesPending=!1,[7];case 4:return[2]}}))}))},this.listStates=function(){return e(j,void 0,void 0,(function(){var t,e;return i(this,(function(i){switch(i.label){case 0:if(!(null===(e=this.address.country)||void 0===e?void 0:e.id))return[2];i.label=1;case 1:return i.trys.push([1,3,4,5]),this._isStatesPending=!0,[4,m({countryId:{eq:this.address.country.id}})];case 2:return t=i.sent(),this.states=t.data||[],this.hasState||this.onStateChange(this.states[0].id),[3,5];case 3:return i.sent(),[3,5];case 4:return this._isStatesPending=!1,[7];case 5:return[2]}}))}))},this.listCities=function(){return e(j,void 0,void 0,(function(){var t,e,s,r;return i(this,(function(i){switch(i.label){case 0:if(!(null===(e=this.address.state)||void 0===e?void 0:e.id))return[2];i.label=1;case 1:return i.trys.push([1,3,4,5]),this._isCitiesPending=!0,[4,p({stateId:{eq:this.address.state.id},countryId:(null===(s=this.address.country)||void 0===s?void 0:s.id)?{eq:null===(r=this.address.country)||void 0===r?void 0:r.id}:void 0})];case 2:return t=i.sent(),this.cities=t.data||[],[3,5];case 3:return i.sent(),[3,5];case 4:return this._isCitiesPending=!1,[7];case 5:return[2]}}))}))},this.listDistricts=function(){return e(j,void 0,void 0,(function(){var t,e,s,r;return i(this,(function(i){switch(i.label){case 0:if(!(null===(e=this.address.city)||void 0===e?void 0:e.id))return[2];i.label=1;case 1:return i.trys.push([1,3,4,5]),this._isDistrictsPending=!0,[4,h({cityId:{eq:this.address.city.id},stateId:(null===(s=this.address.state)||void 0===s?void 0:s.id)?{eq:null===(r=this.address.state)||void 0===r?void 0:r.id}:void 0})];case 2:return t=i.sent(),this.districts=t.data||[],[3,5];case 3:return i.sent(),[3,5];case 4:return this._isDistrictsPending=!1,[7];case 5:return[2]}}))}))},this.validateAll=function(){return j.validator.validateAll()},this.submit=function(){return e(j,void 0,void 0,(function(){var t,e;return i(this,(function(i){switch(i.label){case 0:return t={isFormError:!1,isSuccess:!1},this.address.phone&&this.validator.setRules(this.validatorRules(!0)),[4,this.validateAll()];case 1:if(i.sent())return t.isFormError=!0,[2,t];if(!(e=a(v.getInstance().customerStore.customer))||!this.address)return[2,t];(null==e?void 0:e.addresses)||(e.addresses=[]),this.isEdit?e.addresses[this.editingAddressIndex]=this.address:e.addresses.push(this.address),i.label=2;case 2:return i.trys.push([2,4,,5]),[4,v.getInstance().customerStore.saveCustomer(e)];case 3:return i.sent()&&(t.isSuccess=!0),[2,t];case 4:return i.sent(),[2,t];case 5:return[2]}}))}))},s(this,{hasValidatorError:r,isEdit:r,results:r,editingAddressIndex:r,isFreeTextCity:r,isFreeTextDistrict:r,countries:n,states:n,cities:n,districts:n,_isCountriesPending:n,_isStatesPending:n,_isCitiesPending:n,_isDistrictsPending:n,isCountriesPending:r,isStatesPending:r,isCitiesPending:r,isDistrictsPending:r,onCountryChange:d,validateAll:d,submit:d}),this.address=g.address||new y({addressLine1:"",addressLine2:null,attributes:null,company:null,firstName:"",identityNumber:null,isDefault:null,lastName:"",phone:null,postalCode:null,taxNumber:null,taxOffice:null,title:"",country:null,state:null,city:null,district:null,id:"",createdAt:0,updatedAt:0}),this.message=g.message,this.validator=new o(this.address,this.validatorRules()),this.listCountries(),this.address.state&&this.listStates(),this.address.country&&this.listCities(),this.address.city&&this.listDistricts()}return Object.defineProperty(x.prototype,"isFreeTextCity",{get:function(){var t=this;return g.some((function(e){var i,s;return(null===(s=null===(i=t.address.country)||void 0===i?void 0:i.iso2)||void 0===s?void 0:s.toLowerCase())===e.toLowerCase()}))},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"isFreeTextDistrict",{get:function(){return!this.districtOptions.length},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"isEdit",{get:function(){return-1!==this.editingAddressIndex},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"editingAddressIndex",{get:function(){var t,e,i,s=this;return null!==(i=null===(e=null===(t=v.getInstance().customerStore.customer)||void 0===t?void 0:t.addresses)||void 0===e?void 0:e.findIndex((function(t){return t.id===s.address.id})))&&void 0!==i?i:-1},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"countryOptions",{get:function(){var t=this.countries.map(b);return j(t)},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"stateOptions",{get:function(){var t=this.states.map(b);return j(t)},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"cityOptions",{get:function(){var t=this.cities.map(b);return j(t)},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"districtOptions",{get:function(){var t=this.districts.map(b);return j(t)},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"hasState",{get:function(){return this.states.length>1},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"isCountriesPending",{get:function(){return this._isCountriesPending},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"isStatesPending",{get:function(){return this.isCountriesPending||this._isStatesPending},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"isCitiesPending",{get:function(){return this.isStatesPending||this._isCitiesPending},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"isDistrictsPending",{get:function(){return this.isCitiesPending||this._isDistrictsPending},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"hasValidatorError",{get:function(){return this.validator.hasError},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"results",{get:function(){return this.validator.results},enumerable:!1,configurable:!0}),x}();export{x as AddressForm};
1
+ import{__spreadArray as t,__awaiter as e,__generator as i}from'./../../../../ext/tslib/tslib.es6.js';import{makeObservable as s,computed as r,observable as n,action as d}from"mobx";import a from"lodash/cloneDeep";import{Validator as o}from"../index.js";import{PhoneRule as u,RequiredRule as l}from"../rules/index.js";import{listCountry as c,listState as m,listCity as p,listDistrict as h}from"@ikas/storefront-api";import{IkasStorefrontConfig as f}from"@ikas/storefront-config";import{FREE_TEXT_CITY_COUNTRY_LIST as g}from"../../../../utils/constants.js";import{IkasBaseStore as v}from"../../../../store/base.js";import"../../../../store/customer/index.js";import"../../../../store/cart/index.js";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"@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{IkasCustomerAddress as y}from"../../../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"../../../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/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"../../../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"../../../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/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";var j=function(t){return t.sort((function(t,e){return t.label.localeCompare(e.label)}))},b=function(t){return{label:t.name,value:t.id+""}},x=function(){function x(g){var j=this;this.countries=[],this.states=[],this.cities=[],this.districts=[],this._isCountriesPending=!0,this._isStatesPending=!1,this._isCitiesPending=!1,this._isDistrictsPending=!1,this.validatorRules=function(e){return void 0===e&&(e=!1),t([new l({model:j.address,fieldKey:"firstName",valuePath:"firstName",message:j.message.requiredRule}),new l({model:j.address,fieldKey:"lastName",valuePath:"lastName",message:j.message.requiredRule}),new l({model:j.address,fieldKey:"addressLine1",valuePath:"addressLine1",message:j.message.requiredRule}),new l({model:j.address,fieldKey:"country",valuePath:"country",message:j.message.requiredRule}),new l({model:j.address,fieldKey:"state",valuePath:"state",message:j.message.requiredRule}),new l({model:j.address,fieldKey:"city",valuePath:"city",message:j.message.requiredRule}),new l({model:j.address,fieldKey:"title",valuePath:"title",message:j.message.requiredRule})],e?[new u({model:j.address,fieldKey:"phone",valuePath:"phone",message:j.message.phoneRule})]:[],!0)},this.onTitleChange=function(t){j.address.title=t},this.onFirstNameChange=function(t){j.address.firstName=t},this.onLastNameChange=function(t){j.address.lastName=t},this.onPhoneChange=function(t){j.address.phone=t,t||j.validator.setRules(j.validatorRules())},this.onAddressLine1Change=function(t){j.address.addressLine1=t},this.onAddressLine2Change=function(t){j.address.addressLine2=t},this.onAddressPostalCodeChange=function(t){j.address.postalCode=t},this.onCountryChange=function(t){var e;if((null===(e=j.address.country)||void 0===e?void 0:e.id)!==t){var i=j.countries.find((function(e){return e.id===t}));j.address.country={id:(null==i?void 0:i.id)||null,name:(null==i?void 0:i.name)||"",code:(null==i?void 0:i.iso3)||null,iso2:(null==i?void 0:i.iso2)||null,iso3:(null==i?void 0:i.iso3)||null},j.address.state=null,j.address.city=null,j.address.district=null,j.states=[],j.cities=[],j.districts=[],j.listStates()}},this.onStateChange=function(t){var e;if((null===(e=j.address.state)||void 0===e?void 0:e.id)!==t){var i=j.states.find((function(e){return e.id===t}));j.address.state={id:i.id,name:null==i?void 0:i.name,code:null==i?void 0:i.stateCode},j.address.city=null,j.address.district=null,j.cities=[],j.districts=[],j.listCities()}},this.onCityChange=function(t){var e;if((null===(e=j.address.city)||void 0===e?void 0:e.id)!==t){var i=j.cities.find((function(e){return e.id===t}));j.address.city={id:i.id,name:i.name,code:null},j.address.district=null,j.districts=[],j.listDistricts()}},this.onCityInputChange=function(t){j.districts=[],j.address.city={id:null,name:t,code:null}},this.onDistrictChange=function(t){var e;if((null===(e=j.address.district)||void 0===e?void 0:e.id)!==t){var i=j.districts.find((function(e){return e.id===t}));j.address.district={id:i.id,name:i.name,code:null}}},this.onDistrictInputChange=function(t){j.address.district={id:null,name:t,code:null}},this.listCountries=function(){return e(j,void 0,void 0,(function(){var t,e,s,r;return i(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,3,4]),this._isCountriesPending=!0,[4,c({})];case 1:return t=i.sent(),e=f.getCurrentRouting(),s=t.data||[],(null===(r=null==e?void 0:e.countryCodes)||void 0===r?void 0:r.length)&&(s=s.filter((function(t){var i;return t.iso2&&(null===(i=e.countryCodes)||void 0===i?void 0:i.includes(t.iso2))}))),this.countries=s,1!==this.countries.length||this.address.country||this.onCountryChange(this.countries[0].id),this.countries=s,[3,4];case 2:return i.sent(),[3,4];case 3:return this._isCountriesPending=!1,[7];case 4:return[2]}}))}))},this.listStates=function(){return e(j,void 0,void 0,(function(){var t,e;return i(this,(function(i){switch(i.label){case 0:if(!(null===(e=this.address.country)||void 0===e?void 0:e.id))return[2];i.label=1;case 1:return i.trys.push([1,3,4,5]),this._isStatesPending=!0,[4,m({countryId:{eq:this.address.country.id}})];case 2:return t=i.sent(),this.states=t.data||[],this.hasState||this.onStateChange(this.states[0].id),[3,5];case 3:return i.sent(),[3,5];case 4:return this._isStatesPending=!1,[7];case 5:return[2]}}))}))},this.listCities=function(){return e(j,void 0,void 0,(function(){var t,e,s,r;return i(this,(function(i){switch(i.label){case 0:if(!(null===(e=this.address.state)||void 0===e?void 0:e.id))return[2];i.label=1;case 1:return i.trys.push([1,3,4,5]),this._isCitiesPending=!0,[4,p({stateId:{eq:this.address.state.id},countryId:(null===(s=this.address.country)||void 0===s?void 0:s.id)?{eq:null===(r=this.address.country)||void 0===r?void 0:r.id}:void 0})];case 2:return t=i.sent(),this.cities=t.data||[],[3,5];case 3:return i.sent(),[3,5];case 4:return this._isCitiesPending=!1,[7];case 5:return[2]}}))}))},this.listDistricts=function(){return e(j,void 0,void 0,(function(){var t,e,s,r;return i(this,(function(i){switch(i.label){case 0:if(!(null===(e=this.address.city)||void 0===e?void 0:e.id))return[2];i.label=1;case 1:return i.trys.push([1,3,4,5]),this._isDistrictsPending=!0,[4,h({cityId:{eq:this.address.city.id},stateId:(null===(s=this.address.state)||void 0===s?void 0:s.id)?{eq:null===(r=this.address.state)||void 0===r?void 0:r.id}:void 0})];case 2:return t=i.sent(),this.districts=t.data||[],[3,5];case 3:return i.sent(),[3,5];case 4:return this._isDistrictsPending=!1,[7];case 5:return[2]}}))}))},this.validateAll=function(){return j.validator.validateAll()},this.submit=function(){return e(j,void 0,void 0,(function(){var t,e;return i(this,(function(i){switch(i.label){case 0:return t={isFormError:!1,isSuccess:!1},this.address.phone&&this.validator.setRules(this.validatorRules(!0)),[4,this.validateAll()];case 1:if(i.sent())return t.isFormError=!0,[2,t];if(!(e=a(v.getInstance().customerStore.customer))||!this.address)return[2,t];(null==e?void 0:e.addresses)||(e.addresses=[]),this.isEdit?e.addresses[this.editingAddressIndex]=this.address:e.addresses.push(this.address),i.label=2;case 2:return i.trys.push([2,4,,5]),[4,v.getInstance().customerStore.saveCustomer(e)];case 3:return i.sent()&&(t.isSuccess=!0),[2,t];case 4:return i.sent(),[2,t];case 5:return[2]}}))}))},s(this,{hasValidatorError:r,isEdit:r,results:r,editingAddressIndex:r,isFreeTextCity:r,isFreeTextDistrict:r,countries:n,states:n,cities:n,districts:n,_isCountriesPending:n,_isStatesPending:n,_isCitiesPending:n,_isDistrictsPending:n,isCountriesPending:r,isStatesPending:r,isCitiesPending:r,isDistrictsPending:r,onCountryChange:d,validateAll:d,submit:d}),this.address=g.address||new y({addressLine1:"",addressLine2:null,attributes:null,company:null,firstName:"",identityNumber:null,isDefault:null,lastName:"",phone:null,postalCode:null,taxNumber:null,taxOffice:null,title:"",country:null,state:null,city:null,district:null,id:"",createdAt:0,updatedAt:0}),this.message=g.message,this.validator=new o(this.address,this.validatorRules()),this.listCountries(),this.address.state&&this.listStates(),this.address.country&&this.listCities(),this.address.city&&this.listDistricts()}return Object.defineProperty(x.prototype,"isFreeTextCity",{get:function(){var t=this;return g.some((function(e){var i,s;return(null===(s=null===(i=t.address.country)||void 0===i?void 0:i.iso2)||void 0===s?void 0:s.toLowerCase())===e.toLowerCase()}))},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"isFreeTextDistrict",{get:function(){return!this.districtOptions.length},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"isEdit",{get:function(){return-1!==this.editingAddressIndex},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"editingAddressIndex",{get:function(){var t,e,i,s=this;return null!==(i=null===(e=null===(t=v.getInstance().customerStore.customer)||void 0===t?void 0:t.addresses)||void 0===e?void 0:e.findIndex((function(t){return t.id===s.address.id})))&&void 0!==i?i:-1},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"countryOptions",{get:function(){var t=this.countries.map(b);return j(t)},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"stateOptions",{get:function(){var t=this.states.map(b);return j(t)},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"cityOptions",{get:function(){var t=this.cities.map(b);return j(t)},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"districtOptions",{get:function(){var t=this.districts.map(b);return j(t)},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"hasState",{get:function(){return this.states.length>1},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"isCountriesPending",{get:function(){return this._isCountriesPending},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"isStatesPending",{get:function(){return this.isCountriesPending||this._isStatesPending},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"isCitiesPending",{get:function(){return this.isStatesPending||this._isCitiesPending},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"isDistrictsPending",{get:function(){return this.isCitiesPending||this._isDistrictsPending},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"hasValidatorError",{get:function(){return this.validator.hasError},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"results",{get:function(){return this.validator.results},enumerable:!1,configurable:!0}),x}();export{x as AddressForm};