@salla.sa/twilight-components 2.12.2 → 2.12.3

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 (138) hide show
  1. package/dist/cjs/{Helper-f14223e6.js → Helper-9f7c98a8.js} +14 -1
  2. package/dist/cjs/Helper-9f7c98a8.js.map +1 -0
  3. package/dist/cjs/app-globals-33911fba.js +65 -0
  4. package/dist/cjs/app-globals-33911fba.js.map +1 -0
  5. package/dist/cjs/loader.cjs.js +1 -1
  6. package/dist/cjs/salla-add-product-button_40.cjs.entry.js +1 -1
  7. package/dist/cjs/salla-add-product-button_40.cjs.entry.js.map +1 -1
  8. package/dist/cjs/salla-filters-widget.cjs.entry.js +1 -1
  9. package/dist/cjs/salla-filters.cjs.entry.js +6 -0
  10. package/dist/cjs/salla-filters.cjs.entry.js.map +1 -1
  11. package/dist/cjs/salla-price-range.cjs.entry.js +3 -0
  12. package/dist/cjs/salla-price-range.cjs.entry.js.map +1 -1
  13. package/dist/cjs/salla-products-list.cjs.entry.js +28 -3
  14. package/dist/cjs/salla-products-list.cjs.entry.js.map +1 -1
  15. package/dist/cjs/salla-products-slider.cjs.entry.js +1 -1
  16. package/dist/cjs/twilight.cjs.js +1 -1
  17. package/dist/collection/Helpers/Helper.js +13 -0
  18. package/dist/collection/Helpers/Helper.js.map +1 -1
  19. package/dist/collection/components/salla-add-product-button/salla-add-product-button.js.map +1 -1
  20. package/dist/collection/components/salla-filters/salla-filters.js +8 -2
  21. package/dist/collection/components/salla-filters/salla-filters.js.map +1 -1
  22. package/dist/collection/components/salla-price-range/salla-price-range.js +4 -1
  23. package/dist/collection/components/salla-price-range/salla-price-range.js.map +1 -1
  24. package/dist/collection/components/salla-products-list/salla-products-list.js +44 -2
  25. package/dist/collection/components/salla-products-list/salla-products-list.js.map +1 -1
  26. package/dist/collection/global/app.js +3 -5
  27. package/dist/collection/global/app.js.map +1 -1
  28. package/dist/collection/index.js.map +1 -1
  29. package/dist/components/Helper.js +13 -0
  30. package/dist/components/Helper.js.map +1 -1
  31. package/dist/components/index.js +20 -4170
  32. package/dist/components/index.js.map +1 -1
  33. package/dist/components/salla-add-product-button2.js.map +1 -1
  34. package/dist/components/salla-filters.js +6 -0
  35. package/dist/components/salla-filters.js.map +1 -1
  36. package/dist/components/salla-price-range2.js +3 -0
  37. package/dist/components/salla-price-range2.js.map +1 -1
  38. package/dist/components/salla-products-list.js +28 -3
  39. package/dist/components/salla-products-list.js.map +1 -1
  40. package/dist/esm/{Helper-a7971963.js → Helper-e4611a7c.js} +14 -1
  41. package/dist/esm/Helper-e4611a7c.js.map +1 -0
  42. package/dist/esm/app-globals-6b360973.js +63 -0
  43. package/dist/esm/app-globals-6b360973.js.map +1 -0
  44. package/dist/esm/loader.js +1 -1
  45. package/dist/esm/salla-add-product-button_40.entry.js +1 -1
  46. package/dist/esm/salla-add-product-button_40.entry.js.map +1 -1
  47. package/dist/esm/salla-filters-widget.entry.js +1 -1
  48. package/dist/esm/salla-filters.entry.js +6 -0
  49. package/dist/esm/salla-filters.entry.js.map +1 -1
  50. package/dist/esm/salla-price-range.entry.js +3 -0
  51. package/dist/esm/salla-price-range.entry.js.map +1 -1
  52. package/dist/esm/salla-products-list.entry.js +29 -4
  53. package/dist/esm/salla-products-list.entry.js.map +1 -1
  54. package/dist/esm/salla-products-slider.entry.js +1 -1
  55. package/dist/esm/twilight.js +1 -1
  56. package/dist/esm-es5/Helper-e4611a7c.js +5 -0
  57. package/dist/esm-es5/Helper-e4611a7c.js.map +1 -0
  58. package/dist/esm-es5/app-globals-6b360973.js +23 -0
  59. package/dist/esm-es5/app-globals-6b360973.js.map +1 -0
  60. package/dist/esm-es5/loader.js +1 -1
  61. package/dist/esm-es5/salla-add-product-button_40.entry.js +1 -1
  62. package/dist/esm-es5/salla-add-product-button_40.entry.js.map +1 -1
  63. package/dist/esm-es5/salla-filters-widget.entry.js +1 -1
  64. package/dist/esm-es5/salla-filters.entry.js +1 -1
  65. package/dist/esm-es5/salla-filters.entry.js.map +1 -1
  66. package/dist/esm-es5/salla-price-range.entry.js.map +1 -1
  67. package/dist/esm-es5/salla-products-list.entry.js +1 -1
  68. package/dist/esm-es5/salla-products-list.entry.js.map +1 -1
  69. package/dist/esm-es5/salla-products-slider.entry.js +1 -1
  70. package/dist/esm-es5/twilight.js +1 -1
  71. package/dist/twilight/{p-a378c3be.entry.js → p-1342a68f.entry.js} +2 -2
  72. package/dist/twilight/p-15b4fb7a.js +23 -0
  73. package/dist/twilight/p-15b4fb7a.js.map +1 -0
  74. package/dist/twilight/{p-0e716419.entry.js → p-23215851.entry.js} +2 -2
  75. package/dist/twilight/p-23215851.entry.js.map +1 -0
  76. package/dist/twilight/p-2d334c27.system.js +5 -0
  77. package/dist/twilight/p-2d334c27.system.js.map +1 -0
  78. package/dist/twilight/{p-9ab303f5.system.entry.js → p-3671b683.system.entry.js} +2 -2
  79. package/dist/twilight/{p-5ffffea6.js → p-431fcc73.js} +2 -2
  80. package/dist/twilight/p-431fcc73.js.map +1 -0
  81. package/dist/twilight/{p-671591bd.system.js → p-5f400dc8.system.js} +2 -2
  82. package/dist/twilight/{p-0bab8332.entry.js → p-61d1ce2d.entry.js} +2 -2
  83. package/dist/twilight/p-61d1ce2d.entry.js.map +1 -0
  84. package/dist/twilight/p-8891fdc9.system.js +23 -0
  85. package/dist/twilight/p-8891fdc9.system.js.map +1 -0
  86. package/dist/twilight/p-8e3f85c5.system.entry.js.map +1 -1
  87. package/dist/twilight/p-90f60c35.system.entry.js +5 -0
  88. package/dist/twilight/p-90f60c35.system.entry.js.map +1 -0
  89. package/dist/twilight/{p-ee9a8735.system.entry.js → p-b4d2ecf1.system.entry.js} +2 -2
  90. package/dist/twilight/p-b4d2ecf1.system.entry.js.map +1 -0
  91. package/dist/twilight/p-c0a87009.system.entry.js +5 -0
  92. package/dist/twilight/p-c0a87009.system.entry.js.map +1 -0
  93. package/dist/twilight/p-ce042888.entry.js.map +1 -1
  94. package/dist/twilight/p-e0cb00aa.entry.js +5 -0
  95. package/dist/twilight/p-e0cb00aa.entry.js.map +1 -0
  96. package/dist/twilight/{p-3d027624.entry.js → p-ea65d3c9.entry.js} +2 -2
  97. package/dist/twilight/{p-37264cdf.system.entry.js → p-ffec6e8f.system.entry.js} +2 -2
  98. package/dist/twilight/twilight.esm.js +1 -1
  99. package/dist/twilight/twilight.js +1 -1
  100. package/dist/types/Helpers/Helper.d.ts +1 -0
  101. package/dist/types/components/salla-filters/salla-filters.d.ts +2 -2
  102. package/dist/types/components/salla-price-range/salla-price-range.d.ts +3 -0
  103. package/dist/types/components/salla-products-list/salla-products-list.d.ts +5 -0
  104. package/dist/types/components.d.ts +12 -1
  105. package/dist/types/global/app.d.ts +1 -5
  106. package/dist/types/index.d.ts +1 -0
  107. package/package.json +3 -3
  108. package/dist/cjs/Helper-f14223e6.js.map +0 -1
  109. package/dist/cjs/app-globals-9ad08b7a.js +0 -4215
  110. package/dist/cjs/app-globals-9ad08b7a.js.map +0 -1
  111. package/dist/esm/Helper-a7971963.js.map +0 -1
  112. package/dist/esm/app-globals-d0d32791.js +0 -4213
  113. package/dist/esm/app-globals-d0d32791.js.map +0 -1
  114. package/dist/esm-es5/Helper-a7971963.js +0 -5
  115. package/dist/esm-es5/Helper-a7971963.js.map +0 -1
  116. package/dist/esm-es5/app-globals-d0d32791.js +0 -25
  117. package/dist/esm-es5/app-globals-d0d32791.js.map +0 -1
  118. package/dist/twilight/p-0bab8332.entry.js.map +0 -1
  119. package/dist/twilight/p-0e716419.entry.js.map +0 -1
  120. package/dist/twilight/p-2042f370.system.js +0 -5
  121. package/dist/twilight/p-2042f370.system.js.map +0 -1
  122. package/dist/twilight/p-5ffffea6.js.map +0 -1
  123. package/dist/twilight/p-aa8e58b9.js +0 -25
  124. package/dist/twilight/p-aa8e58b9.js.map +0 -1
  125. package/dist/twilight/p-bd2b7381.system.js +0 -25
  126. package/dist/twilight/p-bd2b7381.system.js.map +0 -1
  127. package/dist/twilight/p-be148f43.system.entry.js +0 -5
  128. package/dist/twilight/p-be148f43.system.entry.js.map +0 -1
  129. package/dist/twilight/p-c4a4b584.system.entry.js +0 -5
  130. package/dist/twilight/p-c4a4b584.system.entry.js.map +0 -1
  131. package/dist/twilight/p-dd290c58.entry.js +0 -5
  132. package/dist/twilight/p-dd290c58.entry.js.map +0 -1
  133. package/dist/twilight/p-ee9a8735.system.entry.js.map +0 -1
  134. /package/dist/twilight/{p-a378c3be.entry.js.map → p-1342a68f.entry.js.map} +0 -0
  135. /package/dist/twilight/{p-9ab303f5.system.entry.js.map → p-3671b683.system.entry.js.map} +0 -0
  136. /package/dist/twilight/{p-671591bd.system.js.map → p-5f400dc8.system.js.map} +0 -0
  137. /package/dist/twilight/{p-3d027624.entry.js.map → p-ea65d3c9.entry.js.map} +0 -0
  138. /package/dist/twilight/{p-37264cdf.system.entry.js.map → p-ffec6e8f.system.entry.js.map} +0 -0
@@ -1,5 +1,5 @@
1
1
  var __awaiter=this&&this.__awaiter||function(t,e,i,n){function s(t){return t instanceof i?t:new i((function(e){e(t)}))}return new(i||(i=Promise))((function(i,r){function o(t){try{l(n.next(t))}catch(t){r(t)}}function a(t){try{l(n["throw"](t))}catch(t){r(t)}}function l(t){t.done?i(t.value):s(t.value).then(o,a)}l((n=n.apply(t,e||[])).next())}))};var __generator=this&&this.__generator||function(t,e){var i={label:0,sent:function(){if(r[0]&1)throw r[1];return r[1]},trys:[],ops:[]},n,s,r,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol==="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(t){return function(e){return l([t,e])}}function l(a){if(n)throw new TypeError("Generator is already executing.");while(o&&(o=0,a[0]&&(i=0)),i)try{if(n=1,s&&(r=a[0]&2?s["return"]:a[0]?s["throw"]||((r=s["return"])&&r.call(s),0):s.next)&&!(r=r.call(s,a[1])).done)return r;if(s=0,r)a=[a[0]&2,r.value];switch(a[0]){case 0:case 1:r=a;break;case 4:i.label++;return{value:a[1],done:false};case 5:i.label++;s=a[1];a=[0];continue;case 7:a=i.ops.pop();i.trys.pop();continue;default:if(!(r=i.trys,r=r.length>0&&r[r.length-1])&&(a[0]===6||a[0]===2)){i=0;continue}if(a[0]===3&&(!r||a[1]>r[0]&&a[1]<r[3])){i.label=a[1];break}if(a[0]===6&&i.label<r[1]){i.label=r[1];r=a;break}if(r&&i.label<r[2]){i.label=r[2];i.ops.push(a);break}if(r[2])i.ops.pop();i.trys.pop();continue}a=e.call(t,i)}catch(t){a=[6,t];s=0}finally{n=r=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}};
2
2
  /*!
3
3
  * Crafted with ❤ by Salla
4
- */import{r as registerInstance,c as createEvent,h,H as Host,g as getElement}from"./index-c5e788f5.js";import{H as Helper}from"./Helper-a7971963.js";import{a as FilterOptionTypes,F as FilterOptionInputType}from"./interfaces-5bea5a45.js";var sallaFiltersWidgetCss=":host{display:block}";var SallaFiltersWidget=function(){function t(t){registerInstance(this,t);this.changed=createEvent(this,"changed",7);this.initHeight=195;this.widgetTitle=undefined;this.withLoadMore=undefined;this.filtersData=undefined;this.option=undefined;this.isOpen=true;this.isShowMore=false;this.showMoreLabel="عرض المزيد";this.showLessLabel="عرض أقل"}t.prototype.connectedCallback=function(){var t=this;this.withLoadMore=this.option.key!="price"&&Array.isArray(this.option.values)&&this.option.values.length>8;this.widgetTitle=this.option.label;salla.lang.onLoaded((function(){t.showMoreLabel=salla.lang.getWithDefault("common.titles.more",t.showMoreLabel);t.showLessLabel=salla.lang.getWithDefault("common.elements.show_less",t.showLessLabel)}))};t.prototype.componentDidLoad=function(){this.widgetValues.scrollHeight<this.initHeight&&(this.withLoadMore=false);this.withLoadMore&&this.widgetValues&&(this.widgetValues.style.maxHeight="".concat(this.initHeight,"px"));this.widgetContent.style.height="".concat(this.widgetContent.scrollHeight,"px")};t.prototype.reset=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){if(this.option.type===FilterOptionTypes.RANGE){this.priceRange.reset()}Array.from(this.host.querySelectorAll("input")).forEach((function(t){return t.checked=false}));return[2]}))}))};t.prototype.showMore=function(){return __awaiter(this,void 0,void 0,(function(){var t=this;return __generator(this,(function(e){this.isShowMore=!this.isShowMore;this.widgetContent.style.height="auto";this.widgetValues.style.maxHeight=this.isShowMore?"".concat(this.widgetValues.scrollHeight,"px"):"".concat(this.initHeight,"px");setTimeout((function(){t.widgetContent.style.height="".concat(t.widgetContent.scrollHeight,"px")}),400);return[2]}))}))};t.prototype.toggleWidget=function(){return __awaiter(this,void 0,void 0,(function(){var t=this;return __generator(this,(function(e){this.isOpen=!this.isOpen;Helper.toggleElementClassIf(this.widgetContent,"s-filters-widget-opened","s-filters-widget-closed",(function(){return t.isOpen}));return[2]}))}))};t.prototype.renderFilterOption=function(t){var e=this;if(![FilterOptionTypes.VALUES,FilterOptionTypes.MINIMUM,FilterOptionTypes.VARIANTS].includes(t.type)){return""}return t.values.map((function(i,n){var s=typeof i=="number"?i:i.key||i.value;return h("label",{class:"s-filters-label",htmlFor:"".concat(t.key,"-option-").concat(n)},h("input",{id:"".concat(t.key,"-option-").concat(n),name:t.key,type:t.inputType,checked:e.isSelectedOption(t,s),class:"s-filters-".concat(t.inputType),onChange:function(i){return e.changed.emit({event:i,option:t,value:s})}}),e.getOptionLabel(t,i))}))};t.prototype.isSelectedOption=function(t,e){if(!this.filtersData||!this.filtersData[t.key]){return false}return t.inputType===FilterOptionInputType.CHECKBOX?this.filtersData[t.key].includes(e):this.filtersData[t.key]==e};t.prototype.getOptionLabel=function(t,e){if(t.key=="rating"){return h("salla-rating-stars",{size:"small",value:e})}var i=e.value||"null";return h("span",{class:"s-filters-option-name"},i)};t.prototype.render=function(){var t=this;return h(Host,{class:"s-filters-widget-container"},h("h3",{class:"s-filters-widget-title",onClick:function(){return t.toggleWidget()}},h("span",null,this.widgetTitle),h("span",{class:"s-filters-widget-plusminus ".concat(this.isOpen?"s-filters-widget-plusminus-active":"")})),h("div",{class:"s-filters-widget-content",ref:function(e){return t.widgetContent=e}},h("div",{class:"s-filters-widget-values",ref:function(e){return t.widgetValues=e}},h("slot",null),this.option.type!==FilterOptionTypes.RANGE?this.renderFilterOption(this.option):h("salla-price-range",{onChanged:function(e){return t.changed.emit(e.detail)},ref:function(e){return t.priceRange=e},filtersData:this.filtersData,option:this.option})),this.withLoadMore&&h("a",{class:"s-filters-widget-more",onClick:function(){return t.showMore()}},!this.isShowMore?this.showMoreLabel:this.showLessLabel)))};Object.defineProperty(t.prototype,"host",{get:function(){return getElement(this)},enumerable:false,configurable:true});return t}();SallaFiltersWidget.style=sallaFiltersWidgetCss;export{SallaFiltersWidget as salla_filters_widget};
4
+ */import{r as registerInstance,c as createEvent,h,H as Host,g as getElement}from"./index-c5e788f5.js";import{H as Helper}from"./Helper-e4611a7c.js";import{a as FilterOptionTypes,F as FilterOptionInputType}from"./interfaces-5bea5a45.js";var sallaFiltersWidgetCss=":host{display:block}";var SallaFiltersWidget=function(){function t(t){registerInstance(this,t);this.changed=createEvent(this,"changed",7);this.initHeight=195;this.widgetTitle=undefined;this.withLoadMore=undefined;this.filtersData=undefined;this.option=undefined;this.isOpen=true;this.isShowMore=false;this.showMoreLabel="عرض المزيد";this.showLessLabel="عرض أقل"}t.prototype.connectedCallback=function(){var t=this;this.withLoadMore=this.option.key!="price"&&Array.isArray(this.option.values)&&this.option.values.length>8;this.widgetTitle=this.option.label;salla.lang.onLoaded((function(){t.showMoreLabel=salla.lang.getWithDefault("common.titles.more",t.showMoreLabel);t.showLessLabel=salla.lang.getWithDefault("common.elements.show_less",t.showLessLabel)}))};t.prototype.componentDidLoad=function(){this.widgetValues.scrollHeight<this.initHeight&&(this.withLoadMore=false);this.withLoadMore&&this.widgetValues&&(this.widgetValues.style.maxHeight="".concat(this.initHeight,"px"));this.widgetContent.style.height="".concat(this.widgetContent.scrollHeight,"px")};t.prototype.reset=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){if(this.option.type===FilterOptionTypes.RANGE){this.priceRange.reset()}Array.from(this.host.querySelectorAll("input")).forEach((function(t){return t.checked=false}));return[2]}))}))};t.prototype.showMore=function(){return __awaiter(this,void 0,void 0,(function(){var t=this;return __generator(this,(function(e){this.isShowMore=!this.isShowMore;this.widgetContent.style.height="auto";this.widgetValues.style.maxHeight=this.isShowMore?"".concat(this.widgetValues.scrollHeight,"px"):"".concat(this.initHeight,"px");setTimeout((function(){t.widgetContent.style.height="".concat(t.widgetContent.scrollHeight,"px")}),400);return[2]}))}))};t.prototype.toggleWidget=function(){return __awaiter(this,void 0,void 0,(function(){var t=this;return __generator(this,(function(e){this.isOpen=!this.isOpen;Helper.toggleElementClassIf(this.widgetContent,"s-filters-widget-opened","s-filters-widget-closed",(function(){return t.isOpen}));return[2]}))}))};t.prototype.renderFilterOption=function(t){var e=this;if(![FilterOptionTypes.VALUES,FilterOptionTypes.MINIMUM,FilterOptionTypes.VARIANTS].includes(t.type)){return""}return t.values.map((function(i,n){var s=typeof i=="number"?i:i.key||i.value;return h("label",{class:"s-filters-label",htmlFor:"".concat(t.key,"-option-").concat(n)},h("input",{id:"".concat(t.key,"-option-").concat(n),name:t.key,type:t.inputType,checked:e.isSelectedOption(t,s),class:"s-filters-".concat(t.inputType),onChange:function(i){return e.changed.emit({event:i,option:t,value:s})}}),e.getOptionLabel(t,i))}))};t.prototype.isSelectedOption=function(t,e){if(!this.filtersData||!this.filtersData[t.key]){return false}return t.inputType===FilterOptionInputType.CHECKBOX?this.filtersData[t.key].includes(e):this.filtersData[t.key]==e};t.prototype.getOptionLabel=function(t,e){if(t.key=="rating"){return h("salla-rating-stars",{size:"small",value:e})}var i=e.value||"null";return h("span",{class:"s-filters-option-name"},i)};t.prototype.render=function(){var t=this;return h(Host,{class:"s-filters-widget-container"},h("h3",{class:"s-filters-widget-title",onClick:function(){return t.toggleWidget()}},h("span",null,this.widgetTitle),h("span",{class:"s-filters-widget-plusminus ".concat(this.isOpen?"s-filters-widget-plusminus-active":"")})),h("div",{class:"s-filters-widget-content",ref:function(e){return t.widgetContent=e}},h("div",{class:"s-filters-widget-values",ref:function(e){return t.widgetValues=e}},h("slot",null),this.option.type!==FilterOptionTypes.RANGE?this.renderFilterOption(this.option):h("salla-price-range",{onChanged:function(e){return t.changed.emit(e.detail)},ref:function(e){return t.priceRange=e},filtersData:this.filtersData,option:this.option})),this.withLoadMore&&h("a",{class:"s-filters-widget-more",onClick:function(){return t.showMore()}},!this.isShowMore?this.showMoreLabel:this.showLessLabel)))};Object.defineProperty(t.prototype,"host",{get:function(){return getElement(this)},enumerable:false,configurable:true});return t}();SallaFiltersWidget.style=sallaFiltersWidgetCss;export{SallaFiltersWidget as salla_filters_widget};
5
5
  //# sourceMappingURL=salla-filters-widget.entry.js.map
@@ -1,5 +1,5 @@
1
1
  var __awaiter=this&&this.__awaiter||function(t,e,r,i){function a(t){return t instanceof r?t:new r((function(e){e(t)}))}return new(r||(r=Promise))((function(r,n){function s(t){try{o(i.next(t))}catch(t){n(t)}}function l(t){try{o(i["throw"](t))}catch(t){n(t)}}function o(t){t.done?r(t.value):a(t.value).then(s,l)}o((i=i.apply(t,e||[])).next())}))};var __generator=this&&this.__generator||function(t,e){var r={label:0,sent:function(){if(n[0]&1)throw n[1];return n[1]},trys:[],ops:[]},i,a,n,s;return s={next:l(0),throw:l(1),return:l(2)},typeof Symbol==="function"&&(s[Symbol.iterator]=function(){return this}),s;function l(t){return function(e){return o([t,e])}}function o(l){if(i)throw new TypeError("Generator is already executing.");while(s&&(s=0,l[0]&&(r=0)),r)try{if(i=1,a&&(n=l[0]&2?a["return"]:l[0]?a["throw"]||((n=a["return"])&&n.call(a),0):a.next)&&!(n=n.call(a,l[1])).done)return n;if(a=0,n)l=[l[0]&2,n.value];switch(l[0]){case 0:case 1:n=l;break;case 4:r.label++;return{value:l[1],done:false};case 5:r.label++;a=l[1];l=[0];continue;case 7:l=r.ops.pop();r.trys.pop();continue;default:if(!(n=r.trys,n=n.length>0&&n[n.length-1])&&(l[0]===6||l[0]===2)){r=0;continue}if(l[0]===3&&(!n||l[1]>n[0]&&l[1]<n[3])){r.label=l[1];break}if(l[0]===6&&r.label<n[1]){r.label=n[1];n=l;break}if(n&&r.label<n[2]){r.label=n[2];r.ops.push(l);break}if(n[2])r.ops.pop();r.trys.pop();continue}l=e.call(t,r)}catch(t){l=[6,t];a=0}finally{i=n=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:true}}};
2
2
  /*!
3
3
  * Crafted with ❤ by Salla
4
- */import{r as registerInstance,c as createEvent,h,H as Host,g as getElement}from"./index-c5e788f5.js";import{F as FilterOptionInputType,a as FilterOptionTypes}from"./interfaces-5bea5a45.js";var sallaFiltersCss=":host{display:block}.s-rating-stars-small{line-height:12px}.s-filters-radio{background-image:none !important}";var SallaFilters=function(){function t(t){var e=this;registerInstance(this,t);this.changed=createEvent(this,"changed",7);this.isReady=false;this.filters=undefined;this.isSidebarOpen=undefined;this.filtersData={};this.apply=undefined;this.reset=undefined;salla.event.on("filters::hidden",(function(){return e.host.style.display="none"}));salla.lang.onLoaded((function(){e.apply=salla.lang.get("pages.checkout.apply");e.reset=salla.lang.get("pages.categories.filters_reset")}));salla.event.on("filters::fetched",(function(t){var r=t.filters;e.host.style.display="";var i={};e.filters=r.map((function(t){t.label={category_id:salla.lang.get("common.titles.categories"),brand_id:salla.lang.get("common.titles.brands"),rating:salla.lang.get("pages.categories.filter_rating"),price:salla.lang.get("pages.categories.filter_price")}[t.key]||t.label;t.inputType=FilterOptionInputType.RADIO;if(t.key=="rating"){t.inputType=FilterOptionInputType.RADIO;var r=t.values,a=r.max,n=r.min;t.values=[5,4,3,2,1].filter((function(t){return t>=n||t<=a}))}if(e.filtersData[t.key]){i[t.key]=e.filtersData[t.key]}return t}));e.filtersData=i}))}t.prototype.connectedCallback=function(){try{var t=new URLSearchParams(window.location.search).get("filters");this.filtersData=t?JSON.parse(decodeURIComponent(t)):{}}catch(t){salla.logger.warn("failed to get filters from url",t.message)}};t.prototype.getFilters=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){return[2,this.filtersData]}))}))};t.prototype.applyFilters=function(){return __awaiter(this,void 0,void 0,(function(){var t;var e=this;return __generator(this,(function(r){if(!this.isReady){return[2]}t=Object.keys(this.filtersData).length>0;setTimeout((function(){var r;if(t){window.history.pushState({},"",salla.url.addParamToUrl("filters",encodeURIComponent(JSON.stringify(e.filtersData))))}else{var i=new URL(window.location.href);(r=i.searchParams)===null||r===void 0?void 0:r.delete("filters");window.history.pushState({},"",i.toString())}salla.event.emit("salla-filters::changed",e.filtersData);e.changed.emit(e.filtersData)}),300);return[2]}))}))};t.prototype.resetFilters=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){this.filtersData={};this.host.childNodes.forEach((function(t){return t.reset&&t.reset()}));salla.event.emit("salla-filters::reset");return[2,this.applyFilters()]}))}))};t.prototype.handleOptionChange=function(t,e,r){if(e.type===FilterOptionTypes.RANGE){this.filtersData[e.key]=r;return}var i=t.target.checked;if(t.target.type==FilterOptionInputType.RADIO){i&&(this.filtersData[e.key]=r);i||delete this.filtersData[e.key];return}this.filtersData[e.key]=this.filtersData[e.key]||[];if(i){this.filtersData[e.key].push(r);return}this.filtersData[e.key]=this.filtersData[e.key].filter((function(t){return t!=r}))};t.prototype.render=function(){var t=this;var e,r;return h(Host,null,(e=this.filters)===null||e===void 0?void 0:e.map((function(e){return h("salla-filters-widget",{option:e,filtersData:t.filtersData,onChanged:function(e){var r=e.detail,i=r.event,a=r.option,n=r.value;return t.handleOptionChange(i,a,n)}})})),((r=this.filters)===null||r===void 0?void 0:r.length)&&h("div",{class:"s-filters-footer"},h("salla-button",{color:"primary",onClick:function(){return t.applyFilters()}},this.apply),h("salla-button",{color:"gray",fill:"outline",onClick:function(){return t.resetFilters()}},this.reset)))};t.prototype.componentDidLoad=function(){this.isReady=true};Object.defineProperty(t.prototype,"host",{get:function(){return getElement(this)},enumerable:false,configurable:true});return t}();SallaFilters.style=sallaFiltersCss;export{SallaFilters as salla_filters};
4
+ */import{r as registerInstance,c as createEvent,h,H as Host,g as getElement}from"./index-c5e788f5.js";import{F as FilterOptionInputType,a as FilterOptionTypes}from"./interfaces-5bea5a45.js";var sallaFiltersCss=":host{display:block}.s-rating-stars-small{line-height:12px}.s-filters-radio{background-image:none !important}";var SallaFilters=function(){function t(t){var e=this;registerInstance(this,t);this.changed=createEvent(this,"changed",7);this.isReady=false;this.filters=undefined;this.isSidebarOpen=undefined;this.filtersData={};this.apply=undefined;this.reset=undefined;salla.event.on("filters::hidden",(function(){return e.host.style.display="none"}));salla.lang.onLoaded((function(){e.apply=salla.lang.get("pages.checkout.apply");e.reset=salla.lang.get("pages.categories.filters_reset")}));salla.event.on("filters::fetched",(function(t){var r=t.filters;e.host.style.display="";var i={};e.filters=r.map((function(t){t.label={category_id:salla.lang.get("common.titles.categories"),brand_id:salla.lang.get("common.titles.brands"),rating:salla.lang.get("pages.categories.filter_rating"),price:salla.lang.get("pages.categories.filter_price")}[t.key]||t.label;t.inputType=FilterOptionInputType.RADIO;if(t.key=="rating"){t.inputType=FilterOptionInputType.RADIO;var r=t.values,a=r.max,n=r.min;t.values=[5,4,3,2,1].filter((function(t){return t>=n||t<=a}))}if(e.filtersData[t.key]){i[t.key]=e.filtersData[t.key]}return t}));e.filtersData=i}))}t.prototype.connectedCallback=function(){try{var t=new URLSearchParams(window.location.search).get("filters");this.filtersData=t?JSON.parse(decodeURIComponent(t)):{}}catch(t){salla.logger.warn("failed to get filters from url",t.message)}};t.prototype.getFilters=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){return[2,this.filtersData]}))}))};t.prototype.applyFilters=function(){return __awaiter(this,void 0,void 0,(function(){var t;var e=this;return __generator(this,(function(r){if(!this.isReady){return[2]}t=Object.keys(this.filtersData).length>0;setTimeout((function(){var r;if(t){window.history.pushState({},"",salla.url.addParamToUrl("filters",encodeURIComponent(JSON.stringify(e.filtersData))))}else{var i=new URL(window.location.href);(r=i.searchParams)===null||r===void 0?void 0:r.delete("filters");window.history.pushState({},"",i.toString())}salla.event.emit("salla-filters::changed",e.filtersData);e.changed.emit(e.filtersData)}),300);return[2]}))}))};t.prototype.resetFilters=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){this.filtersData={};this.host.childNodes.forEach((function(t){return t.reset&&t.reset()}));salla.event.emit("salla-filters::reset");return[2,this.applyFilters()]}))}))};t.prototype.handleOptionChange=function(t,e,r){if(e.type===FilterOptionTypes.RANGE){this.filtersData[e.key]=r;return}var i=t.target.checked;if(e.type===FilterOptionTypes.VARIANTS){this.filtersData.variants=this.filtersData.variants||{};i&&(this.filtersData.variants[e.key]=r);i||delete this.filtersData.variants[e.key];return}if(t.target.type==FilterOptionInputType.RADIO){i&&(this.filtersData[e.key]=r);i||delete this.filtersData[e.key];return}this.filtersData[e.key]=this.filtersData[e.key]||[];if(i){this.filtersData[e.key].push(r);return}this.filtersData[e.key]=this.filtersData[e.key].filter((function(t){return t!=r}))};t.prototype.render=function(){var t=this;var e,r;return h(Host,null,(e=this.filters)===null||e===void 0?void 0:e.map((function(e){return h("salla-filters-widget",{option:e,filtersData:t.filtersData,onChanged:function(e){var r=e.detail,i=r.event,a=r.option,n=r.value;return t.handleOptionChange(i,a,n)}})})),((r=this.filters)===null||r===void 0?void 0:r.length)&&h("div",{class:"s-filters-footer"},h("salla-button",{color:"primary",onClick:function(){return t.applyFilters()}},this.apply),h("salla-button",{color:"gray",fill:"outline",onClick:function(){return t.resetFilters()}},this.reset)))};t.prototype.componentDidLoad=function(){this.isReady=true};Object.defineProperty(t.prototype,"host",{get:function(){return getElement(this)},enumerable:false,configurable:true});return t}();SallaFilters.style=sallaFiltersCss;export{SallaFilters as salla_filters};
5
5
  //# sourceMappingURL=salla-filters.entry.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["sallaFiltersCss","SallaFilters","class_1","hostRef","_this","this","isReady","salla","event","on","host","style","display","lang","onLoaded","apply","get","reset","_c","filters","freshFilterData","map","filter","label","category_id","brand_id","rating","price","key","inputType","FilterOptionInputType","RADIO","values","max_1","max","min_1","min","stars","filtersData","prototype","connectedCallback","URLSearchParams","window","location","search","JSON","parse","decodeURIComponent","e","logger","warn","message","getFilters","applyFilters","hasFilters","Object","keys","length","setTimeout","history","pushState","url","addParamToUrl","encodeURIComponent","stringify","URL","href","_a","searchParams","delete","toString","emit","changed","resetFilters","childNodes","forEach","widget","handleOptionChange","option","value","type","FilterOptionTypes","RANGE","isChecked","target","checked","push","val","render","h","Host","onChanged","_d","detail","_b","class","color","onClick","fill","componentDidLoad"],"sources":["src/components/salla-filters/salla-filters.scss?tag=salla-filters","src/components/salla-filters/salla-filters.tsx"],"sourcesContent":[":host {\n display: block;\n}\n\n.s-rating-stars-small {\n line-height: 12px;\n}\n.s-filters-radio{\n background-image: none !important;\n}","import { Component, Element, h, Event, EventEmitter, Host, Method, Prop, State } from '@stencil/core';\nimport { Filter, FilterOptionInputType, FilterOptionTypes } from \"./interfaces\";\n\n@Component({\n tag: 'salla-filters',\n styleUrl: 'salla-filters.scss',\n})\nexport class SallaFilters {\n\n constructor() {\n salla.event.on('filters::hidden', () => this.host.style.display = 'none');\n\n salla.lang.onLoaded(() => {\n this.apply = salla.lang.get('pages.checkout.apply');\n this.reset = salla.lang.get('pages.categories.filters_reset');\n });\n\n salla.event.on('filters::fetched', ({ filters }) => {\n this.host.style.display = '';\n let freshFilterData = {};\n this.filters = filters\n .map((filter: Filter) => {\n filter.label = {\n category_id: salla.lang.get('common.titles.categories'),\n brand_id: salla.lang.get('common.titles.brands'),\n rating: salla.lang.get('pages.categories.filter_rating'),\n price: salla.lang.get('pages.categories.filter_price'),\n }[filter.key] || filter.label;\n filter.inputType = FilterOptionInputType.RADIO;//todo:: support FilterOptionInputType.CHECKBOX\n if (filter.key == 'rating') {\n filter.inputType = FilterOptionInputType.RADIO;\n //@ts-ignore\n let { max, min } = filter.values;\n //@ts-ignore\n filter.values = [5, 4, 3, 2, 1].filter(stars => stars >= min || stars <= max)\n }\n\n //when getting new filters, maybe less than we had, so let's get from the old one, only what is existed now.\n if (this.filtersData[filter.key]) {\n freshFilterData[filter.key] = this.filtersData[filter.key];\n }\n\n return filter;\n });\n this.filtersData = freshFilterData;\n });\n }\n\n connectedCallback() {\n try {\n let filters = (new URLSearchParams(window.location.search)).get('filters')\n this.filtersData = filters ? JSON.parse(decodeURIComponent(filters)) : {};\n } catch (e) {\n salla.logger.warn('failed to get filters from url', e.message);\n }\n }\n\n @Element() host: HTMLElement;\n\n /**\n * Array of filter options\n */\n @Prop({ reflect: true, mutable: true }) filters?: Filter[];\n\n private isReady = false;//to avoid triggering the changed event\n\n @State() isSidebarOpen: boolean;\n @State() filtersData: object = {}\n @State() apply: string;\n @State() reset: string;\n\n /**\n * Custom event fired when the selected filters are changed.\n */\n @Event() changed: EventEmitter;\n\n /**\n * Method to get filter data.\n */\n @Method()\n async getFilters() {\n return this.filtersData;\n }\n\n /**\n * Apply filter action.\n */\n @Method()\n async applyFilters() {\n if (!this.isReady) {\n return;\n }\n let hasFilters = Object.keys(this.filtersData).length > 0;\n setTimeout(() => {\n if (hasFilters) {\n window.history.pushState({}, '', salla.url.addParamToUrl('filters', encodeURIComponent(JSON.stringify(this.filtersData))));\n } else {\n let url = new URL(window.location.href);\n url.searchParams?.delete('filters');\n window.history.pushState({}, '', url.toString());\n }\n salla.event.emit('salla-filters::changed', this.filtersData);\n this.changed.emit(this.filtersData);\n }, 300);\n }\n\n /**\n * Reset selected filters.\n */\n @Method()\n async resetFilters() {\n this.filtersData = {};\n this.host.childNodes.forEach((widget: HTMLSallaFiltersWidgetElement) => widget.reset && widget.reset())\n salla.event.emit('salla-filters::reset');\n return this.applyFilters();\n }\n\n /**\n * @param {{target:HTMLInputElement}} event\n * @param option\n * @param value\n * @private\n */\n private handleOptionChange(event, option: Filter, value) {\n if (option.type === FilterOptionTypes.RANGE) {\n this.filtersData[option.key] = value;\n return;\n }\n let isChecked = event.target.checked;\n if (event.target.type == FilterOptionInputType.RADIO) {\n isChecked && (this.filtersData[option.key] = value);\n isChecked || (delete this.filtersData[option.key]);\n return;\n }\n\n //it's checkbox\n this.filtersData[option.key] = this.filtersData[option.key] || [];\n if (isChecked) {\n this.filtersData[option.key].push(value);\n return;\n }\n this.filtersData[option.key] = this.filtersData[option.key].filter(val => val != value);\n }\n\n render() {\n return <Host>\n {this.filters?.map(option => <salla-filters-widget\n option={option}\n filtersData={this.filtersData}\n onChanged={({ detail: { event, option, value } }) => this.handleOptionChange(event, option, value)} />)}\n\n {this.filters?.length && <div class=\"s-filters-footer\">\n <salla-button color='primary' onClick={() => this.applyFilters()}>{this.apply}</salla-button>\n <salla-button color='gray' fill='outline' onClick={() => this.resetFilters()}>{this.reset}</salla-button>\n </div>}\n </Host>;\n }\n\n componentDidLoad() {\n this.isReady = true;\n }\n}\n\n"],"mappings":";;;+LAAA,IAAMA,gBAAkB,gH,ICOXC,aAAY,WAEvB,SAAAC,EAAAC,GAAA,IAAAC,EAAAC,K,oEAuDQA,KAAAC,QAAU,M,qEAGa,G,0CAzD7BC,MAAMC,MAAMC,GAAG,mBAAmB,WAAM,OAAAL,EAAKM,KAAKC,MAAMC,QAAU,MAA1B,IAExCL,MAAMM,KAAKC,UAAS,WAClBV,EAAKW,MAAQR,MAAMM,KAAKG,IAAI,wBAC5BZ,EAAKa,MAAQV,MAAMM,KAAKG,IAAI,iC,IAG9BT,MAAMC,MAAMC,GAAG,oBAAoB,SAACS,G,IAAEC,EAAOD,EAAAC,QAC3Cf,EAAKM,KAAKC,MAAMC,QAAU,GAC1B,IAAIQ,EAAkB,GACtBhB,EAAKe,QAAUA,EACZE,KAAI,SAACC,GACJA,EAAOC,MAAQ,CACbC,YAAajB,MAAMM,KAAKG,IAAI,4BAC5BS,SAAUlB,MAAMM,KAAKG,IAAI,wBACzBU,OAAQnB,MAAMM,KAAKG,IAAI,kCACvBW,MAAOpB,MAAMM,KAAKG,IAAI,kCACtBM,EAAOM,MAAQN,EAAOC,MACxBD,EAAOO,UAAYC,sBAAsBC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WAAO,MAAA2E,SAAA,SAAAA,EAAErC,SAAUgC,EAAA,OAAKM,MAAM,oBAClCN,EAAA,gBAAcO,MAAM,UAAUC,QAAS,WAAM,OAAA7F,EAAKiD,cAAL,GAAsBhD,KAAKU,OACxE0E,EAAA,gBAAcO,MAAM,OAAOE,KAAK,UAAUD,QAAS,WAAM,OAAA7F,EAAKqE,cAAL,GAAsBpE,KAAKY,Q,EAK1Ff,EAAAqC,UAAA4D,iBAAA,WACE9F,KAAKC,QAAU,I,kIAxJM,G"}
1
+ {"version":3,"names":["sallaFiltersCss","SallaFilters","class_1","hostRef","_this","this","isReady","salla","event","on","host","style","display","lang","onLoaded","apply","get","reset","_c","filters","freshFilterData","map","filter","label","category_id","brand_id","rating","price","key","inputType","FilterOptionInputType","RADIO","values","max_1","max","min_1","min","stars","filtersData","prototype","connectedCallback","URLSearchParams","window","location","search","JSON","parse","decodeURIComponent","e","logger","warn","message","getFilters","applyFilters","hasFilters","Object","keys","length","setTimeout","history","pushState","url","addParamToUrl","encodeURIComponent","stringify","URL","href","_a","searchParams","delete","toString","emit","changed","resetFilters","childNodes","forEach","widget","handleOptionChange","option","value","type","FilterOptionTypes","RANGE","isChecked","target","checked","VARIANTS","variants","push","val","render","h","Host","onChanged","_d","detail","_b","class","color","onClick","fill","componentDidLoad"],"sources":["src/components/salla-filters/salla-filters.scss?tag=salla-filters","src/components/salla-filters/salla-filters.tsx"],"sourcesContent":[":host {\n display: block;\n}\n\n.s-rating-stars-small {\n line-height: 12px;\n}\n.s-filters-radio{\n background-image: none !important;\n}","import { Component, Element, h, Event, EventEmitter, Host, Method, Prop, State } from '@stencil/core';\nimport { Filter, FilterOptionInputType, FilterOptionTypes } from \"./interfaces\";\n\n@Component({\n tag: 'salla-filters',\n styleUrl: 'salla-filters.scss',\n})\nexport class SallaFilters {\n\n constructor() {\n salla.event.on('filters::hidden', () => this.host.style.display = 'none');\n\n salla.lang.onLoaded(() => {\n this.apply = salla.lang.get('pages.checkout.apply');\n this.reset = salla.lang.get('pages.categories.filters_reset');\n });\n\n salla.event.on('filters::fetched', ({ filters }) => {\n this.host.style.display = '';\n let freshFilterData = {};\n this.filters = filters\n .map((filter: Filter) => {\n filter.label = {\n category_id: salla.lang.get('common.titles.categories'),\n brand_id: salla.lang.get('common.titles.brands'),\n rating: salla.lang.get('pages.categories.filter_rating'),\n price: salla.lang.get('pages.categories.filter_price'),\n }[filter.key] || filter.label;\n filter.inputType = FilterOptionInputType.RADIO;//todo:: support FilterOptionInputType.CHECKBOX\n if (filter.key == 'rating') {\n filter.inputType = FilterOptionInputType.RADIO;\n //@ts-ignore\n let { max, min } = filter.values;\n //@ts-ignore\n filter.values = [5, 4, 3, 2, 1].filter(stars => stars >= min || stars <= max)\n }\n\n //when getting new filters, maybe less than we had, so let's get from the old one, only what is existed now.\n if (this.filtersData[filter.key]) {\n freshFilterData[filter.key] = this.filtersData[filter.key];\n }\n\n return filter;\n });\n this.filtersData = freshFilterData;\n });\n }\n\n connectedCallback() {\n try {\n let filters = (new URLSearchParams(window.location.search)).get('filters')\n this.filtersData = filters ? JSON.parse(decodeURIComponent(filters)) : {};\n } catch (e) {\n salla.logger.warn('failed to get filters from url', e.message);\n }\n }\n\n @Element() host: HTMLElement;\n\n /**\n * Array of filter options\n */\n @Prop({ reflect: true, mutable: true }) filters?: Filter[];\n\n private isReady = false;//to avoid triggering the changed event\n\n @State() isSidebarOpen: boolean;\n @State() filtersData: object|any = {}\n @State() apply: string;\n @State() reset: string;\n\n /**\n * Custom event fired when the selected filters are changed.\n */\n @Event() changed: EventEmitter;\n\n /**\n * Method to get filter data.\n */\n @Method()\n async getFilters() {\n return this.filtersData;\n }\n\n /**\n * Apply filter action.\n */\n @Method()\n async applyFilters() {\n if (!this.isReady) {\n return;\n }\n let hasFilters = Object.keys(this.filtersData).length > 0;\n setTimeout(() => {\n if (hasFilters) {\n window.history.pushState({}, '', salla.url.addParamToUrl('filters', encodeURIComponent(JSON.stringify(this.filtersData))));\n } else {\n let url = new URL(window.location.href);\n url.searchParams?.delete('filters');\n window.history.pushState({}, '', url.toString());\n }\n salla.event.emit('salla-filters::changed', this.filtersData);\n this.changed.emit(this.filtersData);\n }, 300);\n }\n\n /**\n * Reset selected filters.\n */\n @Method()\n async resetFilters() {\n this.filtersData = {};\n this.host.childNodes.forEach((widget: HTMLSallaFiltersWidgetElement) => widget.reset && widget.reset())\n salla.event.emit('salla-filters::reset');\n return this.applyFilters();\n }\n\n\n /**\n * @param {{target:HTMLInputElement}} event\n * @param option\n * @param value\n * @private\n */\n private handleOptionChange(event, option: Filter, value) {\n if (option.type === FilterOptionTypes.RANGE) {\n this.filtersData[option.key] = value;\n return;\n }\n let isChecked = event.target.checked;\n\n if(option.type === FilterOptionTypes.VARIANTS){\n this.filtersData.variants=this.filtersData.variants||{};\n isChecked && (this.filtersData.variants[option.key] = value);\n isChecked || (delete this.filtersData.variants[option.key]);\n return;\n }\n \n if (event.target.type == FilterOptionInputType.RADIO) {\n isChecked && (this.filtersData[option.key] = value);\n isChecked || (delete this.filtersData[option.key]);\n return;\n }\n\n //it's checkbox\n this.filtersData[option.key] = this.filtersData[option.key] || [];\n if (isChecked) {\n this.filtersData[option.key].push(value);\n return;\n }\n this.filtersData[option.key] = this.filtersData[option.key].filter(val => val != value);\n }\n\n render() {\n return <Host>\n {this.filters?.map(option => <salla-filters-widget\n option={option}\n filtersData={this.filtersData}\n onChanged={({ detail: { event, option, value } }) => this.handleOptionChange(event, option, value)} />)}\n\n {this.filters?.length && <div class=\"s-filters-footer\">\n <salla-button color='primary' onClick={() => this.applyFilters()}>{this.apply}</salla-button>\n <salla-button color='gray' fill='outline' onClick={() => this.resetFilters()}>{this.reset}</salla-button>\n </div>}\n </Host>;\n }\n\n componentDidLoad() {\n this.isReady = true;\n }\n}\n\n"],"mappings":";;;+LAAA,IAAMA,gBAAkB,gH,ICOXC,aAAY,WAEvB,SAAAC,EAAAC,GAAA,IAAAC,EAAAC,K,oEAuDQA,KAAAC,QAAU,M,qEAG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edCallback","_this","filtersData","_a","price","minPrice","min","maxPrice","max","salla","lang","onLoaded","moreThanLabel","getWithDefault","lessThanLabel","toLabel","fromLabel","option","values","length","chunkSize","Math","ceil","i","push","slice","reduce","final","currentValue","to","count","reset","minInput","value","maxInput","getPriceLabel","filterValue","isNaN","from","concat","money","handleMinMaxPrice","event","changedEventHandler","isMin","helpers","inputDigitsOnly","target","minInputValidation","maxInputValidation","isReady","changed","emit","isChecked","isMinEqual","isMaxEqual","render","h","Host","map","index","class","htmlFor","key","id","name","type","checked","onChange","e","config","currency","symbol","maxlength","ref","el","onInput","placeholder","componentDidLoad"],"sources":["src/components/salla-price-range/salla-price-range.scss?tag=salla-price-range","src/components/salla-price-range/salla-price-range.tsx"],"sourcesContent":[":host {\n display: block;\n}\n\n\n.rtl, [dir=\"rtl\"] {\n .rtl-range-slider {\n transform: rotateY(180deg);\n }\n\n .rtl-range-numbers{\n flex-direction: row-reverse;\n }\n\n .form-select, select{\n background-position: left 0.5rem center;\n padding-right: 12px;\n } \n\n // divide\n.menu-divide {\n li {\n &:not(:last-child) {\n &:after {\n left: 0;\n right: auto;\n }\n }\n }\n}\n}\n\ninput[type=range]::-webkit-slider-thumb {\n pointer-events: all;\n width: 24px;\n height: 24px;\n -webkit-appearance: none;\n}\n\n[type='checkbox']:checked{\n background-size: 80%;\n}","import {Component, Host, h, State, Prop, Event, Method} from '@stencil/core';\nimport {Filter, FilterValue} from \"../salla-filters/interfaces\";\n\n@Component({\n tag: 'salla-price-range',\n styleUrl: 'salla-price-range.scss',\n})\nexport class SallaPriceRange {\n /**\n * Minimum price threshold value\n */\n @Prop({mutable: true}) minPrice;\n\n /**\n * Maximum price threshold value\n */\n @Prop({mutable: true}) maxPrice;\n\n /**\n * Product price range filter option object instance\n */\n @Prop({reflect: true}) option: Filter;\n\n /**\n * Currently selected price filter data\n */\n @Prop({reflect: true}) filtersData: any;\n\n\n @State() min = 0;\n @State() max = 10000;\n @State() priceOptions: any;\n @State() moreThanLabel: string=\"أكثر من\";\n @State() lessThanLabel: string=\"أقل من\";\n @State() toLabel: string=\"الى\";\n @State() fromLabel: string=\"من\";\n\n /**\n * Custome event emitted when there is a change in price input.\n */\n @Event() changed: any;\n\n isReady: Boolean;\n minInput: HTMLInputElement;\n maxInput: HTMLInputElement;\n filterValues: Array<FilterValue> = [];\n\n\n connectedCallback() {\n if (this.filtersData && this.filtersData?.price) {\n this.minPrice = this.filtersData.price.min;\n this.maxPrice = this.filtersData.price.max;\n }\n salla.lang.onLoaded(() => {\n this.moreThanLabel=salla.lang.getWithDefault('common.elements.more_than', this.moreThanLabel)\n this.lessThanLabel=salla.lang.getWithDefault('common.elements.less_than', this.lessThanLabel)\n this.toLabel=salla.lang.getWithDefault('common.elements.to', this.toLabel)\n this.fromLabel=salla.lang.getWithDefault('common.elements.from', this.fromLabel)\n })\n\n //no need to show one option only\n if (this.option.values.length == 1) {\n return;\n }\n //here we may receive too many prices, we will group all inputs to\n if (this.option.values.length <= 5) {\n this.filterValues = this.option.values;\n return;\n }\n const chunkSize = Math.ceil(this.option.values.length / 5);\n for (let i = 0; i < this.option.values.length; i += chunkSize) {\n this.filterValues.push(\n this.option.values\n .slice(i, i + chunkSize)\n .reduce((final: FilterValue, currentValue: FilterValue) => {\n final.to = currentValue.to;\n final.count += currentValue.count;\n return final;\n })\n );\n // do whatever\n }\n }\n\n @Method()\n async reset() {\n //@ts-ignore\n this.minInput.value = null;\n this.maxInput.value = null;\n }\n\n private getPriceLabel(filterValue: FilterValue) {\n // @ts-ignore\n if (isNaN(filterValue.from) || filterValue.from < 1) {\n return `${this.lessThanLabel} ${salla.money(filterValue.to)}`;\n }\n // @ts-ignore\n if (isNaN(filterValue.to) || filterValue.to < 1) {\n return `${this.moreThanLabel} ${salla.money(filterValue.from)}`;\n }\n\n return `${salla.money(filterValue.from)} ${this.toLabel} ${salla.money(filterValue.to)}`;\n }\n\n private handleMinMaxPrice(event: Event, value: FilterValue): void {\n\n //todo:: cover when from is star\n this.minPrice = value.from;\n this.maxPrice = value.to != '*' ? value.to : null;\n\n this.changedEventHandler(event);\n }\n\n private async changedEventHandler(event, isMin = false) {\n salla.helpers.inputDigitsOnly(event.target)\n let value = event ? event.target.value * 1 : null\n if (isMin) {\n this.minInputValidation(value);\n } else {\n this.maxInputValidation(value)\n }\n\n\n this.isReady && this.changed.emit({\n event: event,\n option: this.option,\n value: {max: this.maxPrice, min: this.minPrice}\n })\n }\n\n\n minInputValidation(value) {\n if (value && (value > this.max || value > this.maxPrice)) {\n // this.minPrice = this.maxPrice;\n return;\n }\n\n if (value < this.min) {\n this.minPrice = this.min;\n return;\n }\n\n if (value) {\n this.minPrice = value;\n }\n }\n\n maxInputValidation(value) {\n if (value && (value < this.min || value < this.minPrice)) {\n // this.maxPrice = this.minPrice;\n return;\n }\n if (value > this.max) {\n this.maxPrice = this.max;\n return;\n }\n\n if (value) {\n this.maxPrice = value;\n }\n }\n\n private isChecked(filterValue: FilterValue) {\n if (!this.minPrice && !this.maxPrice) {\n return false;\n }\n\n //1 filterValue.from zero or * and this.minPrice not set or zero\n //2 filterValue.from == this.minPrice\n //@ts-ignore\n let isMinEqual = ((filterValue.from < 1 || filterValue.from == '*') && this.minPrice == 0) || filterValue.from == this.minPrice;\n\n //1 filterValue.to == \"*\" or null\n //2 filterValue.to == this.max\n let isMaxEqual = filterValue.to == '*' || !filterValue.to || filterValue.to == this.maxPrice;\n return isMinEqual && isMaxEqual;\n }\n\n\n render() {\n return (\n <Host>\n {\n this.filterValues.map((filterValue: FilterValue, index: number) => {\n return <label class=\"s-filters-label\" htmlFor={`${this.option.key}-${index}`}>\n <input\n id={`${this.option.key}-${index}`}\n name=\"price\"\n type=\"radio\"\n checked={this.isChecked(filterValue)}\n class=\"s-filters-radio\"\n onChange={e => this.handleMinMaxPrice(e, filterValue)}\n />\n {this.getPriceLabel(filterValue)}\n </label>\n })\n }\n\n\n <div class=\"flex justify-center items-center\">\n <div class=\"relative max-w-xl w-full\">\n <div class=\"s-price-range-inputs\">\n <div class=\"s-price-range-relative\">\n <div class=\"s-price-range-currency\"> {salla.config.currency().symbol}</div>\n <input\n type=\"number\"\n maxlength=\"5\"\n ref={el => this.minInput = el}\n onInput={(event) => this.changedEventHandler(event, true)}\n value={this.minPrice}\n placeholder={this.fromLabel}\n class=\"s-price-range-number-input\"\n />\n </div>\n\n <div class=\"s-price-range-gray-text\"> -</div>\n <div class=\"s-price-range-relative\">\n <div class=\"s-price-range-currency\"> {salla.config.currency().symbol}</div>\n <input type=\"number\" maxlength=\"5\"\n placeholder={this.toLabel}\n ref={el => this.maxInput = el}\n onInput={(event) => this.changedEventHandler(event)}\n value={this.maxPrice}\n class=\"s-price-range-number-input\" aria-describedby=\"price-currency\"/>\n </div>\n </div>\n </div>\n </div>\n </Host>\n );\n }\n\n componentDidLoad() {\n this.isReady = true;\n }\n}\n"],"mappings":";;;uFAAA,IAAMA,mBAAqB,0nB,ICOdC,gBAAe,W,kFAsC1BC,KAAAC,aAAmC,G,0GAhBpB,E,SACA,I,+CAEgB,U,mBACA,S,aACN,M,eACE,I,CAa3BC,EAAAC,UAAAC,kBAAA,eAAAC,EAAAL,K,MACE,GAAIA,KAAKM,eAAeC,EAAAP,KAAKM,eAAW,MAAAC,SAAA,SAAAA,EAAEC,OAAO,CAC/CR,KAAKS,SAAWT,KAAKM,YAAYE,MAAME,IACvCV,KAAKW,SAAWX,KAAKM,YAAYE,MAAMI,G,CAEzCC,MAAMC,KAAKC,UAAS,WAClBV,EAAKW,cAAcH,MAAMC,KAAKG,eAAe,4BAA6BZ,EAAKW,eAC/EX,EAAKa,cAAcL,MAAMC,KAAKG,eAAe,4BAA6BZ,EAAKa,eAC/Eb,EAAKc,QAAQN,MAAMC,KAAKG,eAAe,qBAAsBZ,EAAKc,SAClEd,EAAKe,UAAUP,MAAMC,KAAKG,eAAe,uBAAwBZ,EAAKe,U,IAIxE,GAAIpB,KAAKqB,OAAOC,OAAOC,QAAU,EAAG,CAClC,M,CAGF,GAAIvB,KAAKqB,O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AAkBC,QAAS,GAAAvB,OAAGtC,EAAKgB,OAAO8C,IAAG,KAAAxB,OAAIqB,IACnEH,EAAA,SACEO,GAAI,GAAAzB,OAAGtC,EAAKgB,OAAO8C,IAAG,KAAAxB,OAAIqB,GAC1BK,KAAK,QACLC,KAAK,QACLC,QAASlE,EAAKoD,UAAUjB,GACxByB,MAAM,kBACNO,SAAU,SAAAC,GAAK,OAAApE,EAAKwC,kBAAkB4B,EAAGjC,EAA1B,IAEhBnC,EAAKkC,cAAcC,G,IAM1BqB,EAAA,OAAKI,MAAM,oCACTJ,EAAA,OAAKI,MAAM,4BACTJ,EAAA,OAAKI,MAAM,wBACTJ,EAAA,OAAKI,MAAM,0BACTJ,EAAA,OAAKI,MAAM,0BAAwB,IAAGpD,MAAM6D,OAAOC,WAAWC,QAC9Df,EAAA,SACES,KAAK,SACLO,UAAU,IACVC,IAAK,SAAAC,GAAM,OAAA1E,EAAK+B,SAAW2C,CAAhB,EACXC,QAAS,SAAClC,GAAU,OAAAzC,EAAK0C,oBAAoBD,EAAO,KAAhC,EACpBT,MAAOrC,KAAKS,SACZwE,YAAajF,KAAKoB,UAClB6C,MAAM,gCAIVJ,EAAA,OAAKI,MAAM,2BAAyB,MACpCJ,EAAA,OAAKI,MAAM,0BACTJ,EAAA,OAAKI,MAAM,0BAAwB,IAAGpD,MAAM6D,OAAOC,WAAWC,QAC9Df,EAAA,SAAOS,KAAK,SAASO,UAAU,IACxBI,YAAajF,KAAKmB,QAClB2D,IAAK,SAAAC,GAAM,OAAA1E,EAAKiC,SAAWyC,CAAhB,EACXC,QAAS,SAAClC,GAAU,OAAAzC,EAAK0C,oBAAoBD,EAAzB,EACpBT,MAAOrC,KAAKW,SACZsD,MAAM,6BAA4B,mBAAkB,uB,EASzE/D,EAAAC,UAAA+E,iBAAA,WACElF,KAAKsD,QAAU,I,WAlOS,G"}
1
+ {"version":3,"names":["sallaPriceRangeCss","SallaPriceRange","this","filterValues","class_1","prototype","connectedCallback","_this","filtersData","_a","price","minPrice","min","maxPrice","max","salla","lang","onLoaded","moreThanLabel","getWithDefault","lessThanLabel","toLabel","fromLabel","option","values","length","chunkSize","Math","ceil","i","push","slice","reduce","final","currentValue","to","count","reset","minInput","value","maxInput","getPriceLabel","filterValue","isNaN","from","concat","money","handleMinMaxPrice","event","changedEventHandler","isMin","helpers","inputDigitsOnly","target","minInputValidation","maxInputValidation","isReady","changed","emit","isChecked","isMinEqual","isMaxEqual","render","h","Host","map","index","class","htmlFor","key","id","name","type","checked","onChange","e","config","currency","symbol","maxlength","ref","el","onInput","placeholder","componentDidLoad"],"sources":["src/components/salla-price-range/salla-price-range.scss?tag=salla-price-range","src/components/salla-price-range/salla-price-range.tsx"],"sourcesContent":[":host {\n display: block;\n}\n\n\n.rtl, [dir=\"rtl\"] {\n .rtl-range-slider {\n transform: rotateY(180deg);\n }\n\n .rtl-range-numbers{\n flex-direction: row-reverse;\n }\n\n .form-select, select{\n background-position: left 0.5rem center;\n padding-right: 12px;\n } \n\n // divide\n.menu-divide {\n li {\n &:not(:last-child) {\n &:after {\n left: 0;\n right: auto;\n }\n }\n }\n}\n}\n\ninput[type=range]::-webkit-slider-thumb {\n pointer-events: all;\n width: 24px;\n height: 24px;\n -webkit-appearance: none;\n}\n\n[type='checkbox']:checked{\n background-size: 80%;\n}","import {Component, Host, h, State, Prop, Event, Method} from '@stencil/core';\nimport {Filter, FilterValue} from \"../salla-filters/interfaces\";\n\n@Component({\n tag: 'salla-price-range',\n styleUrl: 'salla-price-range.scss',\n})\nexport class SallaPriceRange {\n /**\n * Minimum price threshold value\n */\n @Prop({mutable: true}) minPrice;\n\n /**\n * Maximum price threshold value\n */\n @Prop({mutable: true}) maxPrice;\n\n /**\n * Product price range filter option object instance\n */\n @Prop({reflect: true}) option: Filter;\n\n /**\n * Currently selected price filter data\n */\n @Prop({reflect: true}) filtersData: any;\n\n\n @State() min = 0;\n @State() max = 10000;\n @State() priceOptions: any;\n @State() moreThanLabel: string=\"أكثر من\";\n @State() lessThanLabel: string=\"أقل من\";\n @State() toLabel: string=\"الى\";\n @State() fromLabel: string=\"من\";\n\n /**\n * Custome event emitted when there is a change in price input.\n */\n @Event() changed: any;\n\n isReady: Boolean;\n minInput: HTMLInputElement;\n maxInput: HTMLInputElement;\n filterValues: Array<FilterValue> = [];\n\n\n connectedCallback() {\n if (this.filtersData && this.filtersData?.price) {\n this.minPrice = this.filtersData.price.min;\n this.maxPrice = this.filtersData.price.max;\n }\n salla.lang.onLoaded(() => {\n this.moreThanLabel=salla.lang.getWithDefault('common.elements.more_than', this.moreThanLabel)\n this.lessThanLabel=salla.lang.getWithDefault('common.elements.less_than', this.lessThanLabel)\n this.toLabel=salla.lang.getWithDefault('common.elements.to', this.toLabel)\n this.fromLabel=salla.lang.getWithDefault('common.elements.from', this.fromLabel)\n })\n\n //no need to show one option only\n if (this.option.values.length == 1) {\n return;\n }\n //here we may receive too many prices, we will group all inputs to\n if (this.option.values.length <= 5) {\n this.filterValues = this.option.values;\n return;\n }\n const chunkSize = Math.ceil(this.option.values.length / 5);\n for (let i = 0; i < this.option.values.length; i += chunkSize) {\n this.filterValues.push(\n this.option.values\n .slice(i, i + chunkSize)\n .reduce((final: FilterValue, currentValue: FilterValue) => {\n final.to = currentValue.to;\n final.count += currentValue.count;\n return final;\n })\n );\n // do whatever\n }\n }\n\n /**\n * reset the price range inputs\n */\n @Method()\n async reset() {\n //@ts-ignore\n this.minInput.value = null;\n this.maxInput.value = null;\n }\n\n private getPriceLabel(filterValue: FilterValue) {\n // @ts-ignore\n if (isNaN(filterValue.from) || filterValue.from < 1) {\n return `${this.lessThanLabel} ${salla.money(filterValue.to)}`;\n }\n // @ts-ignore\n if (isNaN(filterValue.to) || filterValue.to < 1) {\n return `${this.moreThanLabel} ${salla.money(filterValue.from)}`;\n }\n\n return `${salla.money(filterValue.from)} ${this.toLabel} ${salla.money(filterValue.to)}`;\n }\n\n private handleMinMaxPrice(event: Event, value: FilterValue): void {\n\n //todo:: cover when from is star\n this.minPrice = value.from;\n this.maxPrice = value.to != '*' ? value.to : null;\n\n this.changedEventHandler(event);\n }\n\n private async changedEventHandler(event, isMin = false) {\n salla.helpers.inputDigitsOnly(event.target)\n let value = event ? event.target.value * 1 : null\n if (isMin) {\n this.minInputValidation(value);\n } else {\n this.maxInputValidation(value)\n }\n\n\n this.isReady && this.changed.emit({\n event: event,\n option: this.option,\n value: {max: this.maxPrice, min: this.minPrice}\n })\n }\n\n\n minInputValidation(value) {\n if (value && (value > this.max || value > this.maxPrice)) {\n // this.minPrice = this.maxPrice;\n return;\n }\n\n if (value < this.min) {\n this.minPrice = this.min;\n return;\n }\n\n if (value) {\n this.minPrice = value;\n }\n }\n\n maxInputValidation(value) {\n if (value && (value < this.min || value < this.minPrice)) {\n // this.maxPrice = this.minPrice;\n return;\n }\n if (value > this.max) {\n this.maxPrice = this.max;\n return;\n }\n\n if (value) {\n this.maxPrice = value;\n }\n }\n\n private isChecked(filterValue: FilterValue) {\n if (!this.minPrice && !this.maxPrice) {\n return false;\n }\n\n //1 filterValue.from zero or * and this.minPrice not set or zero\n //2 filterValue.from == this.minPrice\n //@ts-ignore\n let isMinEqual = ((filterValue.from < 1 || filterValue.from == '*') && this.minPrice == 0) || filterValue.from == this.minPrice;\n\n //1 filterValue.to == \"*\" or null\n //2 filterValue.to == this.max\n let isMaxEqual = filterValue.to == '*' || !filterValue.to || filterValue.to == this.maxPrice;\n return isMinEqual && isMaxEqual;\n }\n\n\n render() {\n return (\n <Host>\n {\n this.filterValues.map((filterValue: FilterValue, index: number) => {\n return <label class=\"s-filters-label\" htmlFor={`${this.option.key}-${index}`}>\n <input\n id={`${this.option.key}-${index}`}\n name=\"price\"\n type=\"radio\"\n checked={this.isChecked(filterValue)}\n class=\"s-filters-radio\"\n onChange={e => this.handleMinMaxPrice(e, filterValue)}\n />\n {this.getPriceLabel(filterValue)}\n </label>\n })\n }\n\n\n <div class=\"flex justify-center items-center\">\n <div class=\"relative max-w-xl w-full\">\n <div class=\"s-price-range-inputs\">\n <div class=\"s-price-range-relative\">\n <div class=\"s-price-range-currency\"> {salla.config.currency().symbol}</div>\n <input\n type=\"number\"\n maxlength=\"5\"\n ref={el => this.minInput = el}\n onInput={(event) => this.changedEventHandler(event, true)}\n value={this.minPrice}\n placeholder={this.fromLabel}\n class=\"s-price-range-number-input\"\n />\n </div>\n\n <div class=\"s-price-range-gray-text\"> -</div>\n <div class=\"s-price-range-relative\">\n <div class=\"s-price-range-currency\"> {salla.config.currency().symbol}</div>\n <input type=\"number\" maxlength=\"5\"\n placeholder={this.toLabel}\n ref={el => this.maxInput = el}\n onInput={(event) => this.changedEventHandler(event)}\n value={this.maxPrice}\n class=\"s-price-range-number-input\" aria-describedby=\"price-currency\"/>\n </div>\n </div>\n </div>\n </div>\n </Host>\n );\n }\n\n componentDidLoad() {\n this.isReady = true;\n }\n}\n"],"mappings":";;;uFAAA,IAAMA,mBAAqB,0nB,ICOdC,gBAAe,W,kFAsC1BC,KAAAC,aAAmC,G,0GAhBpB,E,SACA,I,+CAEgB,U,mBACA,S,aACN,M,eACE,I,CAa3BC,EAAAC,UAAAC,kBAAA,eAAAC,EAAAL,K,MACE,GAAIA,KAAKM,eAAeC,EAAAP,KAAKM,eAAW,MAAAC,SAAA,SAAAA,EAAEC,OAAO,CAC/CR,KAAKS,SAAWT,KAAKM,YAAYE,MAAME,IACvCV,KAAKW,SAAWX,KAAKM,YAAYE,MAAMI,G,CAEzCC,MAAMC,KAAKC,UAAS,WAClBV,EAAKW,cAAcH,MAAMC,KAAKG,eAAe,4BAA6BZ,EAAKW,eAC/EX,EAAKa,cAAcL,MAAMC,KAAKG,eAAe,4BAA6BZ,EAAKa,eAC/Eb,EAAKc,QAAQN,MAAMC,KAAKG,eAAe,qBAAsBZ,EAAKc,SAClEd,EAAKe,UAAUP,MAAMC,KAAKG,eAAe,uBAAwBZ,EAAKe,U,IAIxE,GAAIpB,KAAKqB,OAAOC,OAAOC,QAAU,EAAG,CAClC,M,CAGF,GAAIvB,KAA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?t:new i((function(e){e(t)}))}return new(i||(i=Promise))((function(i,s){function o(t){try{l(r.next(t))}catch(t){s(t)}}function a(t){try{l(r["throw"](t))}catch(t){s(t)}}function l(t){t.done?i(t.value):n(t.value).then(o,a)}l((r=r.apply(t,e||[])).next())}))};var __generator=this&&this.__generator||function(t,e){var i={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},r,n,s,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol==="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(t){return function(e){return l([t,e])}}function l(a){if(r)throw new TypeError("Generator is already executing.");while(o&&(o=0,a[0]&&(i=0)),i)try{if(r=1,n&&(s=a[0]&2?n["return"]:a[0]?n["throw"]||((s=n["return"])&&s.call(n),0):n.next)&&!(s=s.call(n,a[1])).done)return s;if(n=0,s)a=[a[0]&2,s.value];switch(a[0]){case 0:case 1:s=a;break;case 4:i.label++;return{value:a[1],done:false};case 5:i.label++;n=a[1];a=[0];continue;case 7:a=i.ops.pop();i.trys.pop();continue;default:if(!(s=i.trys,s=s.length>0&&s[s.length-1])&&(a[0]===6||a[0]===2)){i=0;continue}if(a[0]===3&&(!s||a[1]>s[0]&&a[1]<s[3])){i.label=a[1];break}if(a[0]===6&&i.label<s[1]){i.label=s[1];s=a;break}if(s&&i.label<s[2]){i.label=s[2];i.ops.push(a);break}if(s[2])i.ops.pop();i.trys.pop();continue}a=e.call(t,i)}catch(t){a=[6,t];n=0}finally{r=s=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}};
2
2
  /*!
3
3
  * Crafted with ❤ by Salla
4
- */import{r as registerInstance,h,H as Host,g as getElement}from"./index-c5e788f5.js";import{a as anime}from"./anime.es-f7ad0bd3.js";import{H as Helper}from"./Helper-a7971963.js";var ShoppingBag='\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>shopping-bag</title>\n<path d="M28 10.667h-4v-2.667c0-4.412-3.588-8-8-8s-8 3.588-8 8v2.667h-4c-0.736 0-1.333 0.596-1.333 1.333v13.333c0 3.676 2.991 6.667 6.667 6.667h13.333c3.676 0 6.667-2.991 6.667-6.667v-13.333c0-0.737-0.597-1.333-1.333-1.333zM10.667 8c0-2.941 2.392-5.333 5.333-5.333s5.333 2.392 5.333 5.333v2.667h-10.667zM26.667 25.333c0 2.205-1.795 4-4 4h-13.333c-2.205 0-4-1.795-4-4v-12h2.667v2.667c0 0.737 0.597 1.333 1.333 1.333s1.333-0.596 1.333-1.333v-2.667h10.667v2.667c0 0.737 0.597 1.333 1.333 1.333s1.333-0.596 1.333-1.333v-2.667h2.667z"></path>\n</svg>\n';var sallaProductsListCss="";var SallaProductsList=function(){function t(t){registerInstance(this,t);this.source=undefined;this.sourceValue=undefined;this.limit=undefined;this.sortBy=undefined;this.filtersResults=undefined;this.horizontalCards=undefined;this.page=1;this.nextPage=undefined;this.hasInfiniteScroll=undefined;this.hasCustomComponent=undefined;this.sourceValueIsValid=undefined;this.placeholderText=undefined;this.isReady=undefined;this.showPlaceholder=undefined;this.parsedFilters=undefined}t.prototype.connectedCallback=function(){var t=this;salla.onReady((function(){t.hasCustomComponent=!!customElements.get("custom-salla-product-card");t.sourceValueIsValid=!!(t.getSourceValue()||t.isSourceWithoutValue());t.hasInfiniteScroll=!["json","selected","related","landing-page"].includes(t.getSource());try{var e=new URLSearchParams(window.location.search);t.sortBy=t.sortBy||e.get("sort")||e.get("by");var i=e.get("filters");t.parsedFilters=i?JSON.parse(decodeURIComponent(i)):{}}catch(t){salla.logger.warn("failed to get filters from url",t.message)}t.buildNextPageUrl();t.createStatusDom();t.isReady=true}));if(!this.sourceValueIsValid){salla.logger.warn("source-value prop is required for source [".concat(this.getSource(),"]"));return}salla.event.on("salla-filters::changed",(function(e){return t.setFilters(e)}))};t.prototype.setFilters=function(t){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){if(!!t&&JSON.stringify(this.parsedFilters)===JSON.stringify(t)){return[2]}window.scrollTo({top:0,behavior:"smooth"});this.parsedFilters=t;return[2,this.reload()]}))}))};t.prototype.reload=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){salla.infiniteScroll.destroy(this.infiniteScroll);this.buildNextPageUrl();this.wrapper.innerHTML="";this.init();return[2]}))}))};t.prototype.isFilterable=function(){return salla.config.get("store.settings.product.filters")&&this.filtersResults};t.prototype.isSourceWithoutValue=function(){return["offers","latest","sales"].includes(this.getSource())};t.prototype.animateItems=function(){anime({targets:"salla-products-list salla-product-card",opacity:[0,1],duration:1200,translateY:[20,0],delay:function(t,e){return e*100}})};t.prototype.createStatusDom=function(){var t=this;this.status=document.createElement("div");this.status.className="s-infinite-scroll-wrapper";this.status.innerHTML='<div class="s-infinite-scroll-status">\n <p class="s-infinite-scroll-last infinite-scroll-last s-hidden" >'.concat(salla.lang.get("common.elements.end_of_content"),'</p>\n <p class="s-infinite-scroll-error infinite-scroll-error s-hidden">').concat(salla.lang.get("common.elements.failed_to_load_more"),'</p>\n </div>\n <a href="#" class="s-infinite-scroll-btn s-button-btn">\n <span class="s-button-loader s-button-loader-center s-infinite-scroll-btn-loader" style="display: none"></span>\n </a>');this.btnLoader=this.status.querySelector(".s-button-loader");salla.lang.onLoaded((function(){t.status.querySelector(".s-infinite-scroll-last").innerHTML=salla.lang.get("common.elements.end_of_content");t.status.querySelector(".s-infinite-scroll-error").innerHTML=salla.lang.get("common.elements.failed_to_load_more");t.placeholderText=salla.lang.get("pages.categories.no_products")}))};t.prototype.initBaseNextPageUrl=function(t){var e=this;this.nextPage=salla.url.api("products?source=".concat(t));if(this.limit){this.nextPage+="&per_page=".concat(this.limit>32?32:this.limit)}if(this.sortBy){this.nextPage+="&sort=".concat(this.sortBy)}this.nextPage+="&filterable=1";var i=function(t,i){if(["string","number"].includes(typeof i)){r.nextPage+="&filters[".concat(t,"]=").concat(i)}else if(Array.isArray(i)){i.forEach((function(i){return e.nextPage+="&filters[".concat(t,"][]=").concat(i)}))}else if(typeof i==="object"){for(var n=0,s=Object.entries(i);n<s.length;n++){var o=s[n],a=o[0],l=o[1];r.nextPage+="&filters[".concat(t,"][").concat(a,"]=").concat(l)}}};var r=this;for(var n=0,s=Object.entries(this.parsedFilters||{});n<s.length;n++){var o=s[n],a=o[0],l=o[1];i(a,l)}};t.prototype.buildNextPageUrl=function(){var t=this.getSource();if(t==="json"){return}this.initBaseNextPageUrl(t);if(this.isSourceWithoutValue()){return}if(["search","related","landing-page"].includes(t)){this.nextPage+="&source_value=".concat(this.getSourceValue());return}try{this.nextPage+="&source_value[]=".concat(this.getSourceValue().join("&source_value[]="))}catch(e){salla.logger.warn('source-value prop should be array of ids ex source-value="[1,2,3]" for the source ['.concat(t,"]"));this.sourceValueIsValid=false}};t.prototype.loading=function(t){if(t===void 0){t=true}this.btnLoader.style.display=t?"inherit":"none"};t.prototype.getItemHTML=function(t){var e=this.hasCustomComponent?"custom-salla-product-card":"salla-product-card";var i=document.createElement(e);i.product=t;this.applyLandingPageStyles(i);this.applyHorizontalCardStyles(i);return i};t.prototype.applyLandingPageStyles=function(t){if(this.getSource()==="landing-page"&&!this.hasCustomComponent){t.toggleAttribute("hide-add-btn",true);t.classList.add("s-product-card-fit-height")}};t.prototype.applyHorizontalCardStyles=function(t){if(!this.horizontalCards){return}t.setAttribute("horizontal",true);if(!this.hasCustomComponent){t.setAttribute("shadow-on-hover",true)}};t.prototype.getSource=function(){return Helper.getProductsSource(this.source)};t.prototype.getSourceValue=function(){return Helper.getProductsSourceValue(this.source,this.sourceValue)};t.prototype.fetchProducts=function(){var t=this;salla.product.api.fetch({source:this.getSource(),source_value:this.getSourceValue(),limit:this.limit}).then((function(e){if(!e.data.length){t.showPlaceholder=true;t.loading(false);return}t.handleResponse(e).forEach((function(e){return t.wrapper.append(e)}))}))};t.prototype.initiateInfiniteScroll=function(){var t=this;var e,i,r;if(!this.hasInfiniteScroll){return}this.host.insertAdjacentElement("beforeend",this.status);this.infiniteScroll=salla.infiniteScroll.initiate(this.wrapper,this.wrapper,{path:function(){return t.nextPage},history:false,nextPage:this.nextPage,scrollThreshold:100},true);(e=this.infiniteScroll)===null||e===void 0?void 0:e.on("request",(function(){return t.loading()}));(i=this.infiniteScroll)===null||i===void 0?void 0:i.on("load",(function(e){var i;if(!((i=e.data)===null||i===void 0?void 0:i.length)&&t.infiniteScroll.pageIndex==2){t.showPlaceholder=true;salla.infiniteScroll.destroy(t.infiniteScroll);t.loading(false);return}else{t.showPlaceholder=false}t.infiniteScroll.appendItems(t.handleResponse(e));if(t.infiniteScroll.pageIndex==2){t.animateItems()}}));(r=this.infiniteScroll)===null||r===void 0?void 0:r.on("error",(function(){t.status.querySelector(".s-infinite-scroll-error").classList.remove("s-hidden");t.loading(false)}));salla.onReady((function(){return salla.infiniteScroll.loadNextPage(t.infiniteScroll)}))};t.prototype.canRender=function(){return this.sourceValueIsValid&&this.isReady};t.prototype.render=function(){var t=this;if(!this.canRender()){return""}if(this.showPlaceholder){return h("div",{class:"s-products-list-placeholder"},h("span",{innerHTML:ShoppingBag}),h("p",null,this.placeholderText))}return h(Host,{class:"s-products-list"},h("div",{class:{"s-products-list-wrapper":true,"s-products-list-horizontal-cards":this.horizontalCards&&!this.filtersResults,"s-products-list-vertical-cards":!this.horizontalCards&&!this.filtersResults,"s-products-list-filters-results":this.filtersResults},ref:function(e){return t.wrapper=e}}))};t.prototype.componentDidLoad=function(){var t=this;if(!this.canRender()){return}if(this.getSource()==="json"){if(!this.getSourceValue().length){this.showPlaceholder=true;return}this.getSourceValue().map((function(e){return t.wrapper.append(t.getItemHTML(e))}));return}if(this.getSource()==="selected"||this.getSource()==="landing-page"){if(this.getSource()==="selected"&&!this.getSourceValue().length){this.showPlaceholder=true;return}this.fetchProducts();return}this.init()};t.prototype.init=function(){this.initiateInfiniteScroll();this.loading()};t.prototype.handleResponse=function(t){var e=this;var i;if(t.filters&&this.isFilterable()){this.filtersResults=true;salla.event.emit("filters::fetched",{filters:t.filters})}else if(this.isFilterable()){salla.event.emit("filters::hidden")}this.nextPage=t.cursor?t.cursor.next:this.nextPage;this.loading(false);if(this.hasInfiniteScroll&&!this.nextPage){this.infiniteScroll.option({scrollThreshold:false,loadOnScroll:false});this.status.querySelector(".s-infinite-scroll-last").classList.remove("s-hidden")}return((i=t.data)===null||i===void 0?void 0:i.map((function(t){return e.getItemHTML(t)})))||[]};Object.defineProperty(t.prototype,"host",{get:function(){return getElement(this)},enumerable:false,configurable:true});return t}();SallaProductsList.style=sallaProductsListCss;export{SallaProductsList as salla_products_list};
4
+ */import{r as registerInstance,c as createEvent,h,H as Host,g as getElement}from"./index-c5e788f5.js";import{a as anime}from"./anime.es-f7ad0bd3.js";import{H as Helper}from"./Helper-e4611a7c.js";var ShoppingBag='\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>shopping-bag</title>\n<path d="M28 10.667h-4v-2.667c0-4.412-3.588-8-8-8s-8 3.588-8 8v2.667h-4c-0.736 0-1.333 0.596-1.333 1.333v13.333c0 3.676 2.991 6.667 6.667 6.667h13.333c3.676 0 6.667-2.991 6.667-6.667v-13.333c0-0.737-0.597-1.333-1.333-1.333zM10.667 8c0-2.941 2.392-5.333 5.333-5.333s5.333 2.392 5.333 5.333v2.667h-10.667zM26.667 25.333c0 2.205-1.795 4-4 4h-13.333c-2.205 0-4-1.795-4-4v-12h2.667v2.667c0 0.737 0.597 1.333 1.333 1.333s1.333-0.596 1.333-1.333v-2.667h10.667v2.667c0 0.737 0.597 1.333 1.333 1.333s1.333-0.596 1.333-1.333v-2.667h2.667z"></path>\n</svg>\n';var sallaProductsListCss="";var SallaProductsList=function(){function t(t){registerInstance(this,t);this.productsFetched=createEvent(this,"productsFetched",7);this.source=undefined;this.sourceValue=undefined;this.limit=undefined;this.sortBy=undefined;this.filtersResults=undefined;this.horizontalCards=undefined;this.page=1;this.nextPage=undefined;this.hasInfiniteScroll=undefined;this.hasCustomComponent=undefined;this.sourceValueIsValid=undefined;this.placeholderText=undefined;this.isReady=undefined;this.showPlaceholder=undefined;this.parsedFilters=undefined}t.prototype.connectedCallback=function(){var t=this;salla.onReady((function(){t.hasCustomComponent=!!customElements.get("custom-salla-product-card");t.sourceValueIsValid=!!(t.getSourceValue()||t.isSourceWithoutValue());t.hasInfiniteScroll=!["json","selected","related","landing-page"].includes(t.getSource());try{var e=new URLSearchParams(window.location.search);t.sortBy=t.sortBy||e.get("sort")||e.get("by");var i=e.get("filters");t.parsedFilters=i?JSON.parse(decodeURIComponent(i)):{}}catch(t){salla.logger.warn("failed to get filters from url",t.message)}t.buildNextPageUrl();t.createStatusDom();t.isReady=true}));if(!this.sourceValueIsValid){salla.logger.warn("source-value prop is required for source [".concat(this.getSource(),"]"));return}salla.event.on("salla-filters::changed",(function(e){return t.setFilters(e)}))};t.prototype.setFilters=function(t){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){if(!!t&&JSON.stringify(this.parsedFilters)===JSON.stringify(t)){return[2]}window.scrollTo({top:0,behavior:"smooth"});this.parsedFilters=t;return[2,this.reload()]}))}))};t.prototype.reload=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){salla.infiniteScroll.destroy(this.infiniteScroll);this.buildNextPageUrl();this.wrapper.innerHTML="";this.init();return[2]}))}))};t.prototype.isFilterable=function(){return salla.config.get("store.settings.product.filters")&&this.filtersResults};t.prototype.isSourceWithoutValue=function(){return["offers","latest","sales"].includes(this.getSource())};t.prototype.animateItems=function(){anime({targets:"salla-products-list salla-product-card",opacity:[0,1],duration:1200,translateY:[20,0],delay:function(t,e){return e*100}})};t.prototype.createStatusDom=function(){var t=this;this.status=document.createElement("div");this.status.className="s-infinite-scroll-wrapper";this.status.innerHTML='<div class="s-infinite-scroll-status">\n <p class="s-infinite-scroll-last infinite-scroll-last s-hidden" >'.concat(salla.lang.get("common.elements.end_of_content"),'</p>\n <p class="s-infinite-scroll-error infinite-scroll-error s-hidden">').concat(salla.lang.get("common.elements.failed_to_load_more"),'</p>\n </div>\n <a href="#" class="s-infinite-scroll-btn s-button-btn">\n <span class="s-button-loader s-button-loader-center s-infinite-scroll-btn-loader" style="display: none"></span>\n </a>');this.btnLoader=this.status.querySelector(".s-button-loader");salla.lang.onLoaded((function(){t.status.querySelector(".s-infinite-scroll-last").innerHTML=salla.lang.get("common.elements.end_of_content");t.status.querySelector(".s-infinite-scroll-error").innerHTML=salla.lang.get("common.elements.failed_to_load_more");t.placeholderText=salla.lang.get("pages.categories.no_products")}))};t.prototype.initBaseNextPageUrl=function(t){var e=this;this.nextPage=salla.url.api("products?source=".concat(t));if(this.limit){this.nextPage+="&per_page=".concat(this.limit>32?32:this.limit)}if(this.sortBy){this.nextPage+="&sort=".concat(this.sortBy)}this.nextPage+="&filterable=1";var i=function(t,i){if(["string","number"].includes(typeof i)){r.nextPage+="&filters[".concat(t,"]=").concat(i)}else if(Array.isArray(i)){i.forEach((function(i){return e.nextPage+="&filters[".concat(t,"][]=").concat(i)}))}else if(typeof i==="object"){for(var n=0,s=Object.entries(i);n<s.length;n++){var o=s[n],a=o[0],l=o[1];r.nextPage+="&filters[".concat(t,"][").concat(a,"]=").concat(l)}}};var r=this;for(var n=0,s=Object.entries(this.parsedFilters||{});n<s.length;n++){var o=s[n],a=o[0],l=o[1];i(a,l)}};t.prototype.buildNextPageUrl=function(){var t=this.getSource();if(t==="json"){return}this.initBaseNextPageUrl(t);if(this.isSourceWithoutValue()){return}if(["search","related","landing-page"].includes(t)){this.nextPage+="&source_value=".concat(this.getSourceValue());return}try{this.nextPage+="&source_value[]=".concat(this.getSourceValue().join("&source_value[]="))}catch(e){salla.logger.warn('source-value prop should be array of ids ex source-value="[1,2,3]" for the source ['.concat(t,"]"));this.sourceValueIsValid=false}};t.prototype.loading=function(t){if(t===void 0){t=true}this.btnLoader.style.display=t?"inherit":"none"};t.prototype.getItemHTML=function(t){var e=this.hasCustomComponent?"custom-salla-product-card":"salla-product-card";var i=document.createElement(e);i.product=t;this.applyLandingPageStyles(i);this.applyHorizontalCardStyles(i);return i};t.prototype.applyLandingPageStyles=function(t){if(this.getSource()==="landing-page"&&!this.hasCustomComponent){t.toggleAttribute("hide-add-btn",true);t.classList.add("s-product-card-fit-height")}};t.prototype.applyHorizontalCardStyles=function(t){if(!this.horizontalCards){return}t.setAttribute("horizontal",true);if(!this.hasCustomComponent){t.setAttribute("shadow-on-hover",true)}};t.prototype.getSource=function(){return Helper.getProductsSource(this.source)};t.prototype.getSourceValue=function(){return Helper.getProductsSourceValue(this.source,this.sourceValue)};t.prototype.fetchProducts=function(){var t=this;salla.product.api.fetch({source:this.getSource(),source_value:this.getSourceValue(),limit:this.limit}).then((function(e){if(!e.data.length){t.showPlaceholder=true;t.loading(false);return}t.handleResponse(e).forEach((function(e){return t.wrapper.append(e)}))}))};t.prototype.initiateInfiniteScroll=function(){var t=this;var e,i,r;if(!this.hasInfiniteScroll){return}this.host.insertAdjacentElement("beforeend",this.status);this.infiniteScroll=salla.infiniteScroll.initiate(this.wrapper,this.wrapper,{path:function(){return t.nextPage},history:false,nextPage:this.nextPage,scrollThreshold:100},true);(e=this.infiniteScroll)===null||e===void 0?void 0:e.on("request",(function(){return t.loading()}));(i=this.infiniteScroll)===null||i===void 0?void 0:i.on("load",(function(e){var i;if(!((i=e.data)===null||i===void 0?void 0:i.length)&&t.infiniteScroll.pageIndex==2){t.showPlaceholder=true;salla.infiniteScroll.destroy(t.infiniteScroll);t.loading(false);return}else{t.showPlaceholder=false}t.infiniteScroll.appendItems(t.handleResponse(e));if(t.infiniteScroll.pageIndex==2){t.animateItems()}}));(r=this.infiniteScroll)===null||r===void 0?void 0:r.on("error",(function(){t.status.querySelector(".s-infinite-scroll-error").classList.remove("s-hidden");t.loading(false)}));salla.onReady((function(){return salla.infiniteScroll.loadNextPage(t.infiniteScroll)}))};t.prototype.canRender=function(){return this.sourceValueIsValid&&this.isReady};t.prototype.render=function(){var t=this;if(!this.canRender()){return""}if(this.showPlaceholder){return h("div",{class:"s-products-list-placeholder"},h("span",{innerHTML:ShoppingBag}),h("p",null,this.placeholderText))}return h(Host,{class:"s-products-list"},h("div",{class:{"s-products-list-wrapper":true,"s-products-list-horizontal-cards":this.horizontalCards&&!this.filtersResults,"s-products-list-vertical-cards":!this.horizontalCards&&!this.filtersResults,"s-products-list-filters-results":this.filtersResults},ref:function(e){return t.wrapper=e}}))};t.prototype.componentDidLoad=function(){var t=this;if(!this.canRender()){return}if(this.getSource()==="json"){if(!this.getSourceValue().length){this.showPlaceholder=true;return}this.getSourceValue().map((function(e){return t.wrapper.append(t.getItemHTML(e))}));return}if(this.getSource()==="selected"||this.getSource()==="landing-page"){if(this.getSource()==="selected"&&!this.getSourceValue().length){this.showPlaceholder=true;return}this.fetchProducts();return}this.init()};t.prototype.init=function(){this.initiateInfiniteScroll();this.loading()};t.prototype.handleResponse=function(t){var e=this;var i,r,n,s,o,a;var l=this.getSource();var c="";if(((i=t.cursor)===null||i===void 0?void 0:i.current)===1){c=Helper.getPageTitleForSource(l);try{if(this.getSource()==="search"){c=salla.lang.get("common.elements.search_about",{word:this.getSourceValue()})}else if(!c){var u=this.parsedFilters.category_id||this.getSourceValue()[0];c=((s=(n=(r=t.filters.find((function(t){return t.key=="category_id"})))===null||r===void 0?void 0:r.values)===null||n===void 0?void 0:n.find((function(t){return t.key==u})))===null||s===void 0?void 0:s.value)||""}c+=(c?" - ":"")+salla.lang.choice("blocks.header.products_count",(o=t.data)===null||o===void 0?void 0:o.length);if(t.data.length===20){c=c.replace(t.data.length,salla.lang.get("common.elements.more_than")+" "+t.data.length)}t.title=c}catch(t){}}salla.event.emit("salla-products-list::products.fetched",t);this.productsFetched.emit(t);if(t.filters&&this.isFilterable()){this.filtersResults=true;salla.event.emit("filters::fetched",{filters:t.filters})}else if(this.isFilterable()){salla.event.emit("filters::hidden")}this.nextPage=t.cursor?t.cursor.next:this.nextPage;this.loading(false);if(this.hasInfiniteScroll&&!this.nextPage){this.infiniteScroll.option({scrollThreshold:false,loadOnScroll:false});this.status.querySelector(".s-infinite-scroll-last").classList.remove("s-hidden")}return((a=t.data)===null||a===void 0?void 0:a.map((function(t){return e.getItemHTML(t)})))||[]};Object.defineProperty(t.prototype,"host",{get:function(){return getElement(this)},enumerable:false,configurable:true});return t}();SallaProductsList.style=sallaProductsListCss;export{SallaProductsList as salla_products_list};
5
5
  //# sourceMappingURL=salla-products-list.entry.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["sallaProductsListCss","SallaProductsList","class_1","prototype","connectedCallback","_this","this","salla","onReady","hasCustomComponent","customElements","get","sourceValueIsValid","getSourceValue","isSourceWithoutValue","hasInfiniteScroll","includes","getSource","searchParams","URLSearchParams","window","location","search","sortBy","filters","parsedFilters","JSON","parse","decodeURIComponent","e","logger","warn","message","buildNextPageUrl","createStatusDom","isReady","concat","event","on","setFilters","stringify","scrollTo","top","behavior","reload","infiniteScroll","destroy","wrapper","innerHTML","init","isFilterable","config","filtersResults","animateItems","anime","targets","opacity","duration","translateY","delay","_el","i","status","document","createElement","className","lang","btnLoader","querySelector","onLoaded","placeholderText","initBaseNextPageUrl","source","nextPage","url","api","limit","key","value","this_1","Array","isArray","forEach","item","_f","_g","Object","entries","length","_h","k","v","_i","_d","_e","join","loading","isLoading","style","display","getItemHTML","product","customComponentTag","productCard","applyLandingPageStyles","applyHorizontalCardStyles","toggleAttribute","classList","add","horizontalCards","setAttribute","Helper","getProductsSource","getProductsSourceValue","sourceValue","fetchProducts","fetch","source_value","then","res","data","showPlaceholder","handleResponse","card","append","initiateInfiniteScroll","host","insertAdjacentElement","initiate","path","history","scrollThreshold","_a","_b","response","pageIndex","appendItems","_c","remove","loadNextPage","canRender","render","h","class","ShoppingBag","Host","ref","componentDidLoad","map","emit","cursor","next","option","loadOnScroll"],"sources":["src/components/salla-products-list/salla-products-list.scss?tag=salla-products-list","src/components/salla-products-list/salla-products-list.tsx"],"sourcesContent":["\n","import { Component, Host, h, Prop, State, Element, Method } from '@stencil/core';\nimport anime from 'animejs';\nimport ShoppingBag from '../../assets/svg/shopping-bag.svg';\nimport Helper from '../../Helpers/Helper';\n@Component({\n tag: 'salla-products-list',\n styleUrl: 'salla-products-list.scss'\n})\nexport class SallaProductsList {\n connectedCallback() {\n salla.onReady(() => {\n this.hasCustomComponent = !!customElements.get('custom-salla-product-card');\n this.sourceValueIsValid = !!(this.getSourceValue() || this.isSourceWithoutValue());\n this.hasInfiniteScroll = !['json', 'selected', 'related', 'landing-page'].includes(this.getSource());\n try {\n let searchParams = new URLSearchParams(window.location.search);\n this.sortBy = this.sortBy || searchParams.get('sort') || searchParams.get('by');\n let filters = searchParams.get('filters')\n this.parsedFilters = filters ? JSON.parse(decodeURIComponent(filters)) : {};\n } catch (e) {\n salla.logger.warn('failed to get filters from url', e.message);\n }\n this.buildNextPageUrl();\n this.createStatusDom();\n\n this.isReady = true;\n });\n\n if (!this.sourceValueIsValid) {\n salla.logger.warn(`source-value prop is required for source [${this.getSource()}]`);\n return;\n }\n salla.event.on('salla-filters::changed', filters => this.setFilters(filters))\n\n\n }\n\n /**\n * Set parsed filters data from URI\n * @param filters\n */\n @Method()\n async setFilters(filters) {\n if (!!filters && JSON.stringify(this.parsedFilters) === JSON.stringify(filters)) {\n return;\n }\n window.scrollTo({ top: 0, behavior: 'smooth' });\n this.parsedFilters = filters;\n return this.reload();\n }\n\n /**\n * Reload the list of products (entire content of the component).\n */\n @Method()\n async reload() {\n salla.infiniteScroll.destroy(this.infiniteScroll);\n this.buildNextPageUrl();\n // TODO: this is problematic in testing, for the time being it's been resolved like this\n this.wrapper.innerHTML = '';\n this.init();\n }\n\n\n private status: HTMLDivElement;\n private btnLoader: HTMLAnchorElement;\n @Element() host: HTMLElement;\n private wrapper: any;\n private infiniteScroll: any;\n /**\n * The source of the products list\n * @type {string}\n * */\n @Prop({\n reflect: true,\n mutable: true\n }) source: 'categories' | 'latest' | 'related' | 'brands' | 'json' | 'search' | 'tags' | 'selected' | 'offers' | 'landing-page' | 'sales';\n\n /**\n * The source value, cloud be different values as following:\n * - array of ids when `source` in ['categories', 'brands', 'tags', 'selected']\n * - keyword when `source` = 'search'\n * - products payload when `source` = 'json'\n * - product_id when `source` = 'related'\n *\n * @type {string}\n * */\n @Prop({ mutable: true }) sourceValue: any;\n\n /**\n * Limit for number of products in the list.\n */\n @Prop({ mutable: true }) limit: number;\n\n /**\n * Sorting the list of products\n */\n @Prop({ mutable: true }) sortBy?: string | 'ourSuggest' | 'bestSell' | 'topRated' | 'priceFromTopToLow' | 'priceFromLowToTop';\n\n /**\n * should listen to filters events `salla-filters::changed` and re-render\n */\n @Prop({ reflect: true, mutable: true }) filtersResults: boolean;\n\n /**\n * Horizontal cards\n */\n @Prop({ reflect: true }) horizontalCards: boolean\n\n // State\n @State() page: number = 1;\n @State() nextPage: string;\n @State() hasInfiniteScroll: boolean;\n @State() hasCustomComponent: boolean;\n @State() sourceValueIsValid: boolean;\n @State() placeholderText: string;\n @State() isReady: boolean;\n @State() showPlaceholder: boolean;\n @State() parsedFilters: any;\n\n private isFilterable() {\n return salla.config.get('store.settings.product.filters') && this.filtersResults;\n }\n\n private isSourceWithoutValue() {\n return ['offers', 'latest', 'sales'].includes(this.getSource());\n }\n\n private animateItems() {\n anime({\n targets: 'salla-products-list salla-product-card',\n opacity: [0, 1],\n duration: 1200,\n translateY: [20, 0],\n delay: function (_el, i) {\n return i * 100;\n },\n })\n }\n\n private createStatusDom() {\n this.status = document.createElement('div');\n this.status.className = 's-infinite-scroll-wrapper';\n this.status.innerHTML = `<div class=\"s-infinite-scroll-status\">\n <p class=\"s-infinite-scroll-last infinite-scroll-last s-hidden\" >${salla.lang.get('common.elements.end_of_content')}</p>\n <p class=\"s-infinite-scroll-error infinite-scroll-error s-hidden\">${salla.lang.get('common.elements.failed_to_load_more')}</p>\n </div>\n <a href=\"#\" class=\"s-infinite-scroll-btn s-button-btn\">\n <span class=\"s-button-loader s-button-loader-center s-infinite-scroll-btn-loader\" style=\"display: none\"></span>\n </a>`;\n this.btnLoader = this.status.querySelector('.s-button-loader');\n salla.lang.onLoaded(() => {\n this.status.querySelector('.s-infinite-scroll-last').innerHTML = salla.lang.get('common.elements.end_of_content');\n this.status.querySelector('.s-infinite-scroll-error').innerHTML = salla.lang.get('common.elements.failed_to_load_more');\n this.placeholderText = salla.lang.get('pages.categories.no_products');\n });\n }\n\n private initBaseNextPageUrl(source: string) {\n\n this.nextPage = salla.url.api(`products?source=${source}`);\n\n if (this.limit) {\n this.nextPage += `&per_page=${this.limit > 32 ? 32 : this.limit}`;\n }\n if (this.sortBy) {\n this.nextPage += `&sort=${this.sortBy}`;\n }\n // if (!this.isFilterable()) {\n // return this.nextPage;\n // }\n this.nextPage += '&filterable=1';\n for (const [key, value] of Object.entries(this.parsedFilters || {})) {\n if ([\"string\", \"number\"].includes(typeof value)) {\n this.nextPage += `&filters[${key}]=${value}`;\n } else if (Array.isArray(value)) {\n (value as any).forEach(item => this.nextPage += `&filters[${key}][]=${item}`)\n } else if (typeof value === 'object') {\n for (const [k, v] of Object.entries(value)) {\n this.nextPage += `&filters[${key}][${k}]=${v}`;\n }\n }\n }\n }\n\n private buildNextPageUrl() {\n let source = this.getSource();\n if (source === 'json') {\n return;\n }\n this.initBaseNextPageUrl(source);\n if (this.isSourceWithoutValue()) {\n return;\n }\n\n if (['search', 'related', 'landing-page'].includes(source)) {\n this.nextPage += `&source_value=${this.getSourceValue()}`;\n return;\n }\n\n try {\n this.nextPage += `&source_value[]=${this.getSourceValue().join('&source_value[]=')}`;\n } catch (e) {\n salla.logger.warn(`source-value prop should be array of ids ex source-value=\"[1,2,3]\" for the source [${source}]`);\n this.sourceValueIsValid = false;\n }\n }\n\n\n private loading(isLoading = true) {\n this.btnLoader.style.display = isLoading ? 'inherit' : 'none';\n }\n\n private getItemHTML(product) {\n const customComponentTag = this.hasCustomComponent ? 'custom-salla-product-card' : 'salla-product-card';\n const productCard = document.createElement(customComponentTag) as HTMLSallaProductCardElement;\n productCard.product = product;\n\n this.applyLandingPageStyles(productCard);\n this.applyHorizontalCardStyles(productCard);\n\n return productCard;\n }\n\n private applyLandingPageStyles(productCard) {\n if (this.getSource() === 'landing-page' && !this.hasCustomComponent) {\n productCard.toggleAttribute('hide-add-btn', true);\n productCard.classList.add('s-product-card-fit-height');\n }\n }\n\n private applyHorizontalCardStyles(productCard) {\n if (!this.horizontalCards) {\n return;\n }\n productCard.setAttribute('horizontal', true);\n if (!this.hasCustomComponent) {\n productCard.setAttribute('shadow-on-hover', true);\n }\n\n }\n\n private getSource() {\n return Helper.getProductsSource(this.source);\n }\n\n private getSourceValue() {\n return Helper.getProductsSourceValue(this.source, this.sourceValue);\n }\n\n private fetchProducts() {\n salla.product.api.fetch({\n source: this.getSource(),\n source_value: this.getSourceValue(),\n limit: this.limit\n })\n .then(res => {\n if (!res.data.length) {\n this.showPlaceholder = true;\n this.loading(false);\n return;\n }\n this.handleResponse(res).forEach(card => this.wrapper.append(card));\n })\n }\n\n private initiateInfiniteScroll() {\n if (!this.hasInfiniteScroll) {\n return;\n }\n\n this.host.insertAdjacentElement('beforeend', this.status);\n this.infiniteScroll = salla.infiniteScroll.initiate(this.wrapper, this.wrapper, {\n path: () => this.nextPage,\n history: false,\n nextPage: this.nextPage,\n scrollThreshold: 100,\n }, /* infinite via api*/true);\n this.infiniteScroll?.on('request', () => this.loading())\n this.infiniteScroll?.on('load', response => {\n if (!response.data?.length && this.infiniteScroll.pageIndex == 2) {\n this.showPlaceholder = true;\n salla.infiniteScroll.destroy(this.infiniteScroll);\n this.loading(false);\n return;\n } else {\n this.showPlaceholder = false;\n\n }\n this.infiniteScroll.appendItems(this.handleResponse(response))\n if (this.infiniteScroll.pageIndex == 2) {\n this.animateItems();\n }\n })\n this.infiniteScroll?.on('error', () => {\n this.status.querySelector('.s-infinite-scroll-error').classList.remove('s-hidden')\n this.loading(false);\n });\n salla.onReady(() => salla.infiniteScroll.loadNextPage(this.infiniteScroll))\n }\n\n private canRender() {\n return this.sourceValueIsValid && this.isReady;\n }\n\n render() {\n if (!this.canRender()) {\n return '';\n }\n if (this.showPlaceholder) {\n return <div class=\"s-products-list-placeholder\">\n <span innerHTML={ShoppingBag} />\n <p>{this.placeholderText}</p>\n </div>;\n }\n return (\n <Host class=\"s-products-list\">\n <div class={{\n \"s-products-list-wrapper\": true,\n 's-products-list-horizontal-cards': this.horizontalCards && !this.filtersResults,\n 's-products-list-vertical-cards': !this.horizontalCards && !this.filtersResults,\n 's-products-list-filters-results': this.filtersResults,\n }}\n ref={wrapper => this.wrapper = wrapper} />\n </Host>\n );\n }\n\n componentDidLoad() {\n if (!this.canRender()) {\n return;\n }\n\n // Handle json source\n if (this.getSource() === 'json') {\n if (!this.getSourceValue().length) {\n this.showPlaceholder = true;\n return;\n }\n this.getSourceValue().map(product => this.wrapper.append(this.getItemHTML(product)));\n return;\n }\n // Handle selected source\n if (this.getSource() === 'selected' || this.getSource() === 'landing-page') {\n if (this.getSource() === 'selected' && !this.getSourceValue().length) {\n this.showPlaceholder = true;\n return;\n }\n this.fetchProducts()\n return;\n }\n this.init();\n }\n\n private init() {\n this.initiateInfiniteScroll();\n this.loading();\n }\n\n private handleResponse(response): Array<HTMLElement> {\n //💡 when source is related, cursor will not be existed\n if (response.filters && this.isFilterable()) {\n this.filtersResults = true;\n salla.event.emit('filters::fetched', { filters: response.filters });\n } else if (this.isFilterable()) {\n salla.event.emit('filters::hidden');\n }\n this.nextPage = response.cursor ? response.cursor.next : this.nextPage;\n this.loading(false);\n if (this.hasInfiniteScroll && !this.nextPage) {\n this.infiniteScroll.option({ scrollThreshold: false, loadOnScroll: false });\n this.status.querySelector('.s-infinite-scroll-last').classList.remove('s-hidden');\n }\n return response.data?.map(product => this.getItemHTML(product)) || [];\n }\n}\n"],"mappings":";;;i5BAAA,IAAMA,qBAAuB,G,ICQhBC,kBAAiB,W,0MAsGJ,E,+OArGxBC,EAAAC,UAAAC,kBAAA,eAAAC,EAAAC,KACEC,MAAMC,SAAQ,WACZH,EAAK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,QAAI,MAAAY,SAAA,SAAAA,EAAEgB,KAAI,SAAA/C,GAAW,OAAAhG,EAAK+F,YAAYC,EAAjB,MAA8B,E,kIA7WzC,G"}
1
+ {"version":3,"names":["sallaProductsListCss","SallaProductsList","class_1","prototype","connectedCallback","_this","this","salla","onReady","hasCustomComponent","customElements","get","sourceValueIsValid","getSourceValue","isSourceWithoutValue","hasInfiniteScroll","includes","getSource","searchParams","URLSearchParams","window","location","search","sortBy","filters","parsedFilters","JSON","parse","decodeURIComponent","e","logger","warn","message","buildNextPageUrl","createStatusDom","isReady","concat","event","on","setFilters","stringify","scrollTo","top","behavior","reload","infiniteScroll","destroy","wrapper","innerHTML","init","isFilterable","config","filtersResults","animateItems","anime","targets","opacity","duration","translateY","delay","_el","i","status","document","createElement","className","lang","btnLoader","querySelector","onLoaded","placeholderText","initBaseNextPageUrl","source","nextPage","url","api","limit","key","value","this_1","Array","isArray","forEach","item","_j","_k","Object","entries","length","_l","k","v","_i","_g","_h","join","loading","isLoading","style","display","getItemHTML","product","customComponentTag","productCard","applyLandingPageStyles","applyHorizontalCardStyles","toggleAttribute","classList","add","horizontalCards","setAttribute","Helper","getProductsSource","getProductsSourceValue","sourceValue","fetchProducts","fetch","source_value","then","res","data","showPlaceholder","handleResponse","card","append","initiateInfiniteScroll","host","insertAdjacentElement","initiate","path","history","scrollThreshold","_a","_b","response","pageIndex","appendItems","_c","remove","loadNextPage","canRender","render","h","class","ShoppingBag","Host","ref","componentDidLoad","map","title","cursor","current","getPageTitleForSource","word","catId_1","category_id","_d","find","filter","values","cat","choice","_e","replace","emit","productsFetched","next","option","loadOnScroll","_f"],"sources":["src/components/salla-products-list/salla-products-list.scss?tag=salla-products-list","src/components/salla-products-list/salla-products-list.tsx"],"sourcesContent":["\n","import { Component, Host, h, Prop, State, Element, Method, Event, EventEmitter } from '@stencil/core';\nimport anime from 'animejs';\nimport ShoppingBag from '../../assets/svg/shopping-bag.svg';\nimport Helper from '../../Helpers/Helper';\n@Component({\n tag: 'salla-products-list',\n styleUrl: 'salla-products-list.scss'\n})\nexport class SallaProductsList {\n connectedCallback() {\n salla.onReady(() => {\n this.hasCustomComponent = !!customElements.get('custom-salla-product-card');\n this.sourceValueIsValid = !!(this.getSourceValue() || this.isSourceWithoutValue());\n this.hasInfiniteScroll = !['json', 'selected', 'related', 'landing-page'].includes(this.getSource());\n try {\n let searchParams = new URLSearchParams(window.location.search);\n this.sortBy = this.sortBy || searchParams.get('sort') || searchParams.get('by');\n let filters = searchParams.get('filters')\n this.parsedFilters = filters ? JSON.parse(decodeURIComponent(filters)) : {};\n } catch (e) {\n salla.logger.warn('failed to get filters from url', e.message);\n }\n this.buildNextPageUrl();\n this.createStatusDom();\n\n this.isReady = true;\n });\n\n if (!this.sourceValueIsValid) {\n salla.logger.warn(`source-value prop is required for source [${this.getSource()}]`);\n return;\n }\n salla.event.on('salla-filters::changed', filters => this.setFilters(filters))\n\n\n }\n\n /**\n * Set parsed filters data from URI\n * @param filters\n */\n @Method()\n async setFilters(filters) {\n if (!!filters && JSON.stringify(this.parsedFilters) === JSON.stringify(filters)) {\n return;\n }\n window.scrollTo({ top: 0, behavior: 'smooth' });\n this.parsedFilters = filters;\n return this.reload();\n }\n\n /**\n * Reload the list of products (entire content of the component).\n */\n @Method()\n async reload() {\n salla.infiniteScroll.destroy(this.infiniteScroll);\n this.buildNextPageUrl();\n // TODO: this is problematic in testing, for the time being it's been resolved like this\n this.wrapper.innerHTML = '';\n this.init();\n }\n\n\n private status: HTMLDivElement;\n private btnLoader: HTMLAnchorElement;\n @Element() host: HTMLElement;\n private wrapper: any;\n private infiniteScroll: any;\n /**\n * The source of the products list\n * @type {string}\n * */\n @Prop({\n reflect: true,\n mutable: true\n }) source: 'categories' | 'latest' | 'related' | 'brands' | 'json' | 'search' | 'tags' | 'selected' | 'offers' | 'landing-page' | 'sales';\n\n /**\n * The source value, cloud be different values as following:\n * - array of ids when `source` in ['categories', 'brands', 'tags', 'selected']\n * - keyword when `source` = 'search'\n * - products payload when `source` = 'json'\n * - product_id when `source` = 'related'\n *\n * @type {string}\n * */\n @Prop({ mutable: true }) sourceValue: any;\n\n /**\n * Limit for number of products in the list.\n */\n @Prop({ mutable: true }) limit: number;\n\n /**\n * Sorting the list of products\n */\n @Prop({ mutable: true }) sortBy?: string | 'ourSuggest' | 'bestSell' | 'topRated' | 'priceFromTopToLow' | 'priceFromLowToTop';\n\n /**\n * should listen to filters events `salla-filters::changed` and re-render\n */\n @Prop({ reflect: true, mutable: true }) filtersResults: boolean;\n\n /**\n * Horizontal cards\n */\n @Prop({ reflect: true }) horizontalCards: boolean\n\n // State\n @State() page: number = 1;\n @State() nextPage: string;\n @State() hasInfiniteScroll: boolean;\n @State() hasCustomComponent: boolean;\n @State() sourceValueIsValid: boolean;\n @State() placeholderText: string;\n @State() isReady: boolean;\n @State() showPlaceholder: boolean;\n @State() parsedFilters: any;\n\n /**\n * Custom event fired when the the products fetched.\n */\n @Event() productsFetched: EventEmitter;\n\n private isFilterable() {\n return salla.config.get('store.settings.product.filters') && this.filtersResults;\n }\n\n private isSourceWithoutValue() {\n return ['offers', 'latest', 'sales'].includes(this.getSource());\n }\n\n private animateItems() {\n anime({\n targets: 'salla-products-list salla-product-card',\n opacity: [0, 1],\n duration: 1200,\n translateY: [20, 0],\n delay: function (_el, i) {\n return i * 100;\n },\n })\n }\n\n private createStatusDom() {\n this.status = document.createElement('div');\n this.status.className = 's-infinite-scroll-wrapper';\n this.status.innerHTML = `<div class=\"s-infinite-scroll-status\">\n <p class=\"s-infinite-scroll-last infinite-scroll-last s-hidden\" >${salla.lang.get('common.elements.end_of_content')}</p>\n <p class=\"s-infinite-scroll-error infinite-scroll-error s-hidden\">${salla.lang.get('common.elements.failed_to_load_more')}</p>\n </div>\n <a href=\"#\" class=\"s-infinite-scroll-btn s-button-btn\">\n <span class=\"s-button-loader s-button-loader-center s-infinite-scroll-btn-loader\" style=\"display: none\"></span>\n </a>`;\n this.btnLoader = this.status.querySelector('.s-button-loader');\n salla.lang.onLoaded(() => {\n this.status.querySelector('.s-infinite-scroll-last').innerHTML = salla.lang.get('common.elements.end_of_content');\n this.status.querySelector('.s-infinite-scroll-error').innerHTML = salla.lang.get('common.elements.failed_to_load_more');\n this.placeholderText = salla.lang.get('pages.categories.no_products');\n });\n }\n\n private initBaseNextPageUrl(source: string) {\n\n this.nextPage = salla.url.api(`products?source=${source}`);\n\n if (this.limit) {\n this.nextPage += `&per_page=${this.limit > 32 ? 32 : this.limit}`;\n }\n if (this.sortBy) {\n this.nextPage += `&sort=${this.sortBy}`;\n }\n // if (!this.isFilterable()) {\n // return this.nextPage;\n // }\n this.nextPage += '&filterable=1';\n for (const [key, value] of Object.entries(this.parsedFilters || {})) {\n if ([\"string\", \"number\"].includes(typeof value)) {\n this.nextPage += `&filters[${key}]=${value}`;\n } else if (Array.isArray(value)) {\n (value as any).forEach(item => this.nextPage += `&filters[${key}][]=${item}`)\n } else if (typeof value === 'object') {\n for (const [k, v] of Object.entries(value)) {\n this.nextPage += `&filters[${key}][${k}]=${v}`;\n }\n }\n }\n }\n\n private buildNextPageUrl() {\n let source = this.getSource();\n if (source === 'json') {\n return;\n }\n this.initBaseNextPageUrl(source);\n if (this.isSourceWithoutValue()) {\n return;\n }\n\n if (['search', 'related', 'landing-page'].includes(source)) {\n this.nextPage += `&source_value=${this.getSourceValue()}`;\n return;\n }\n\n try {\n this.nextPage += `&source_value[]=${this.getSourceValue().join('&source_value[]=')}`;\n } catch (e) {\n salla.logger.warn(`source-value prop should be array of ids ex source-value=\"[1,2,3]\" for the source [${source}]`);\n this.sourceValueIsValid = false;\n }\n }\n\n\n private loading(isLoading = true) {\n this.btnLoader.style.display = isLoading ? 'inherit' : 'none';\n }\n\n private getItemHTML(product) {\n const customComponentTag = this.hasCustomComponent ? 'custom-salla-product-card' : 'salla-product-card';\n const productCard = document.createElement(customComponentTag) as HTMLSallaProductCardElement;\n productCard.product = product;\n\n this.applyLandingPageStyles(productCard);\n this.applyHorizontalCardStyles(productCard);\n\n return productCard;\n }\n\n private applyLandingPageStyles(productCard) {\n if (this.getSource() === 'landing-page' && !this.hasCustomComponent) {\n productCard.toggleAttribute('hide-add-btn', true);\n productCard.classList.add('s-product-card-fit-height');\n }\n }\n\n private applyHorizontalCardStyles(productCard) {\n if (!this.horizontalCards) {\n return;\n }\n productCard.setAttribute('horizontal', true);\n if (!this.hasCustomComponent) {\n productCard.setAttribute('shadow-on-hover', true);\n }\n\n }\n\n private getSource() {\n return Helper.getProductsSource(this.source);\n }\n\n private getSourceValue() {\n return Helper.getProductsSourceValue(this.source, this.sourceValue);\n }\n\n private fetchProducts() {\n salla.product.api.fetch({\n source: this.getSource(),\n source_value: this.getSourceValue(),\n limit: this.limit\n })\n .then(res => {\n if (!res.data.length) {\n this.showPlaceholder = true;\n this.loading(false);\n return;\n }\n this.handleResponse(res).forEach(card => this.wrapper.append(card));\n })\n }\n\n private initiateInfiniteScroll() {\n if (!this.hasInfiniteScroll) {\n return;\n }\n\n this.host.insertAdjacentElement('beforeend', this.status);\n this.infiniteScroll = salla.infiniteScroll.initiate(this.wrapper, this.wrapper, {\n path: () => this.nextPage,\n history: false,\n nextPage: this.nextPage,\n scrollThreshold: 100,\n }, /* infinite via api*/true);\n this.infiniteScroll?.on('request', () => this.loading())\n this.infiniteScroll?.on('load', response => {\n if (!response.data?.length && this.infiniteScroll.pageIndex == 2) {\n this.showPlaceholder = true;\n salla.infiniteScroll.destroy(this.infiniteScroll);\n this.loading(false);\n return;\n } else {\n this.showPlaceholder = false;\n\n }\n this.infiniteScroll.appendItems(this.handleResponse(response))\n if (this.infiniteScroll.pageIndex == 2) {\n this.animateItems();\n }\n })\n this.infiniteScroll?.on('error', () => {\n this.status.querySelector('.s-infinite-scroll-error').classList.remove('s-hidden')\n this.loading(false);\n });\n salla.onReady(() => salla.infiniteScroll.loadNextPage(this.infiniteScroll))\n }\n\n private canRender() {\n return this.sourceValueIsValid && this.isReady;\n }\n\n render() {\n if (!this.canRender()) {\n return '';\n }\n if (this.showPlaceholder) {\n return <div class=\"s-products-list-placeholder\">\n <span innerHTML={ShoppingBag} />\n <p>{this.placeholderText}</p>\n </div>;\n }\n return (\n <Host class=\"s-products-list\">\n <div class={{\n \"s-products-list-wrapper\": true,\n 's-products-list-horizontal-cards': this.horizontalCards && !this.filtersResults,\n 's-products-list-vertical-cards': !this.horizontalCards && !this.filtersResults,\n 's-products-list-filters-results': this.filtersResults,\n }}\n ref={wrapper => this.wrapper = wrapper} />\n </Host>\n );\n }\n\n componentDidLoad() {\n if (!this.canRender()) {\n return;\n }\n\n // Handle json source\n if (this.getSource() === 'json') {\n if (!this.getSourceValue().length) {\n this.showPlaceholder = true;\n return;\n }\n this.getSourceValue().map(product => this.wrapper.append(this.getItemHTML(product)));\n return;\n }\n // Handle selected source\n if (this.getSource() === 'selected' || this.getSource() === 'landing-page') {\n if (this.getSource() === 'selected' && !this.getSourceValue().length) {\n this.showPlaceholder = true;\n return;\n }\n this.fetchProducts()\n return;\n }\n this.init();\n }\n\n private init() {\n this.initiateInfiniteScroll();\n this.loading();\n }\n\n private handleResponse(response): Array<HTMLElement> {\n let source=this.getSource();\n let title = '';\n //help the developer to know the current page title\n if (response.cursor?.current === 1) {\n title = Helper.getPageTitleForSource(source);\n try {\n if (this.getSource() === 'search') {\n title = salla.lang.get('common.elements.search_about', {'word': this.getSourceValue()});\n } else if (!title) {\n let catId = this.parsedFilters.category_id || this.getSourceValue()[0];\n // get the first filter that its key is category_id, then get the value when filter.value.*.key==catId\n title = response.filters.find(filter => filter.key == 'category_id') ?. values ?. find(cat => cat.key == catId) ?. value || '';\n }\n title += (title ? ' - ' : '') + salla.lang.choice('blocks.header.products_count', response.data ?. length);\n if (response.data.length === 20) {\n title = title.replace(response.data.length, salla.lang.get('common.elements.more_than') + ' ' + response.data.length)\n }\n response.title = title;\n } catch (e) {}\n }\n\n salla.event.emit('salla-products-list::products.fetched', response);\n this.productsFetched.emit(response);\n //💡 when source is related, cursor will not be existed\n if (response.filters && this.isFilterable()) {\n this.filtersResults = true;\n salla.event.emit('filters::fetched', { filters: response.filters });\n } else if (this.isFilterable()) {\n salla.event.emit('filters::hidden');\n }\n this.nextPage = response.cursor ? response.cursor.next : this.nextPage;\n this.loading(false);\n if (this.hasInfiniteScroll && !this.nextPage) {\n this.infiniteScroll.option({ scrollThreshold: false, loadOnScroll: false });\n this.status.querySelector('.s-infinite-scroll-last').classList.remove('s-hidden');\n }\n return response.data?.map(product => this.getItemHTML(product)) || [];\n }\n}\n"],"mappings":";;;k6BAAA,IAAMA,qBAAuB,G,ICQhBC,kBAAiB,W,qQAsGJ,E,+OArGxBC,EAAAC,UAAAC,kBAAA,eAAAC,EAAAC,KACEC,MAAMC,SAAQ,WACZH,EAAKI,qBAAuBC,eAAeC,IAAI,6BAC/CN,EAAKO,sBAAwBP,EAAKQ,kBAAoBR,EAAKS,wBAC3DT,EAAKU,mBAAqB,CAAC,OAAQ,WAAY,UAAW,gBAAgBC,SAASX,EAAKY,aACxF,IACE,IAAIC,EAAe,IAAIC,gBAAgBC,OAAOC,SAASC,QACvDjB,EAAKkB,OAASlB,EAAKkB,QAAUL,EAAaP,IAAI,SAAWO,EAAaP,IAAI,MAC1E,IAAIa,EAAUN,EAAaP,IAAI,WAC/BN,EAAKoB,cAAgBD,EAAUE,KAAKC,MAAMC,mBAAmBJ,IAAY,E,CACzE,MAAOK,GACPtB,MAAMuB,OAAOC,KAAK,iCAAkCF,EAAEG,Q,CAExD3B,EAAK4B,mBACL5B,EAAK6B,kBAEL7B,EAAK8B,QAAU,I,IAGjB,IAAK7B,KAAKM,mBAAoB,CAC5BL,MAAMuB,OAAOC,KAAK,6CAAAK,OAA6C9B,KAAKW,YAAW,MAC/E,M,CAEFV,MAAM8B,MAAMC,GAAG,0BAA0B,SAAAd,GAAW,OAAAnB,EAAKkC,WAAWf,EAAhB,G,EAUhDtB,EAAAC,UAAAoC,WAAN,SAAiBf,G,qFACf,KAAMA,GAAWE,KAAKc,UAAUlC,KAAKmB,iBA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AASgB,OAAShB,EAASgB,OAAOgB,KAAOhK,KAAKmE,SAC9DnE,KAAK0F,QAAQ,OACb,GAAI1F,KAAKS,oBAAsBT,KAAKmE,SAAU,CAC5CnE,KAAKuC,eAAe0H,OAAO,CAAEpC,gBAAiB,MAAOqC,aAAc,QACnElK,KAAKwD,OAAOM,cAAc,2BAA2BuC,UAAU+B,OAAO,W,CAExE,QAAO+B,EAAAnC,EAASd,QAAI,MAAAiD,SAAA,SAAAA,EAAErB,KAAI,SAAA/C,GAAW,OAAAhG,EAAK+F,YAAYC,EAAjB,MAA8B,E,kIAzYzC,G"}
@@ -1,5 +1,5 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r as registerInstance,h,H as Host,g as getElement}from"./index-c5e788f5.js";import{H as Helper}from"./Helper-a7971963.js";var sallaProductsSliderCss="";var SallaProductsSlider=function(){function e(e){var t=this;registerInstance(this,e);this.blockTitle=undefined;this.subTitle=undefined;this.sliderId=undefined;this.displayAllUrl=undefined;this.autoplay=undefined;this.source=undefined;this.sourceValue=undefined;this.limit=undefined;this.productsData=undefined;this.isReady=undefined;this.sourceValueIsValid=undefined;this.hasCustomComponent=undefined;this.apiUrl="";this.parsedSourceValue=undefined;salla.onReady((function(){t.sourceValueIsValid=!!(t.getSource()||t.isSourceWithoutValue());if(!t.sourceValueIsValid){salla.logger.warn("source-value prop is required for source [".concat(t.getSource(),"]"));return}t.hasCustomComponent=!!customElements.get("custom-salla-product-card")}))}e.prototype.isSourceWithoutValue=function(){return["offers","latest","sales"].includes(this.getSource())};e.prototype.getItemHTML=function(e){if(this.hasCustomComponent){return h("div",{class:"s-products-slider-card"},h("custom-salla-product-card",{product:e,source:this.getSource(),"source-value":this.getSourceValue()}))}return h("div",{class:"s-products-slider-card"},h("salla-product-card",{"show-quantity":this.getSource()=="landing-page","hide-add-btn":this.getSource()=="landing-page","shadow-on-hover":true,product:e}))};e.prototype.canRender=function(){return this.sourceValueIsValid&&this.isReady};e.prototype.componentWillLoad=function(){var e=this;if(this.source==="json"){this.productsData=this.getSourceValue();this.isReady=true;return}return salla.product.api.fetch({source:this.getSource(),source_value:this.getSourceValue(),limit:this.limit}).then((function(t){e.productsData=t.data;e.isReady=true}))};e.prototype.getSource=function(){return Helper.getProductsSource(this.source)};e.prototype.getSourceValue=function(){return Helper.getProductsSourceValue(this.source,this.sourceValue)};e.prototype.render=function(){var e=this;var t;if(this.getSource()=="related"&&!salla.config.get("store.settings.product.related_products_enabled")||!this.canRender()){return}return h(Host,{class:"s-products-slider-wrapper"},h("salla-slider",{class:"s-products-slider-slider",id:this.sliderId||"s-products-slider-".concat(Math.random().toString(36).substr(2,9)),"auto-play":this.autoplay,type:"carousel","block-title":this.blockTitle,"block-subTitle":this.subTitle,"display-all-url":this.displayAllUrl},h("div",{slot:"items"},(t=this.productsData)===null||t===void 0?void 0:t.map((function(t){return e.getItemHTML(t)})))))};Object.defineProperty(e.prototype,"host",{get:function(){return getElement(this)},enumerable:false,configurable:true});return e}();SallaProductsSlider.style=sallaProductsSliderCss;export{SallaProductsSlider as salla_products_slider};
4
+ import{r as registerInstance,h,H as Host,g as getElement}from"./index-c5e788f5.js";import{H as Helper}from"./Helper-e4611a7c.js";var sallaProductsSliderCss="";var SallaProductsSlider=function(){function e(e){var t=this;registerInstance(this,e);this.blockTitle=undefined;this.subTitle=undefined;this.sliderId=undefined;this.displayAllUrl=undefined;this.autoplay=undefined;this.source=undefined;this.sourceValue=undefined;this.limit=undefined;this.productsData=undefined;this.isReady=undefined;this.sourceValueIsValid=undefined;this.hasCustomComponent=undefined;this.apiUrl="";this.parsedSourceValue=undefined;salla.onReady((function(){t.sourceValueIsValid=!!(t.getSource()||t.isSourceWithoutValue());if(!t.sourceValueIsValid){salla.logger.warn("source-value prop is required for source [".concat(t.getSource(),"]"));return}t.hasCustomComponent=!!customElements.get("custom-salla-product-card")}))}e.prototype.isSourceWithoutValue=function(){return["offers","latest","sales"].includes(this.getSource())};e.prototype.getItemHTML=function(e){if(this.hasCustomComponent){return h("div",{class:"s-products-slider-card"},h("custom-salla-product-card",{product:e,source:this.getSource(),"source-value":this.getSourceValue()}))}return h("div",{class:"s-products-slider-card"},h("salla-product-card",{"show-quantity":this.getSource()=="landing-page","hide-add-btn":this.getSource()=="landing-page","shadow-on-hover":true,product:e}))};e.prototype.canRender=function(){return this.sourceValueIsValid&&this.isReady};e.prototype.componentWillLoad=function(){var e=this;if(this.source==="json"){this.productsData=this.getSourceValue();this.isReady=true;return}return salla.product.api.fetch({source:this.getSource(),source_value:this.getSourceValue(),limit:this.limit}).then((function(t){e.productsData=t.data;e.isReady=true}))};e.prototype.getSource=function(){return Helper.getProductsSource(this.source)};e.prototype.getSourceValue=function(){return Helper.getProductsSourceValue(this.source,this.sourceValue)};e.prototype.render=function(){var e=this;var t;if(this.getSource()=="related"&&!salla.config.get("store.settings.product.related_products_enabled")||!this.canRender()){return}return h(Host,{class:"s-products-slider-wrapper"},h("salla-slider",{class:"s-products-slider-slider",id:this.sliderId||"s-products-slider-".concat(Math.random().toString(36).substr(2,9)),"auto-play":this.autoplay,type:"carousel","block-title":this.blockTitle,"block-subTitle":this.subTitle,"display-all-url":this.displayAllUrl},h("div",{slot:"items"},(t=this.productsData)===null||t===void 0?void 0:t.map((function(t){return e.getItemHTML(t)})))))};Object.defineProperty(e.prototype,"host",{get:function(){return getElement(this)},enumerable:false,configurable:true});return e}();SallaProductsSlider.style=sallaProductsSliderCss;export{SallaProductsSlider as salla_products_slider};
5
5
  //# sourceMappingURL=salla-products-slider.entry.js.map
@@ -1,5 +1,5 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{p as promiseResolve,b as bootstrapLazy}from"./index-c5e788f5.js";export{s as setNonce}from"./index-c5e788f5.js";import{g as globalScripts}from"./app-globals-d0d32791.js";import"./_commonjsHelpers-9adcfb67.js";var patchBrowser=function(){var e=import.meta.url;var a={};if(e!==""){a.resourcesUrl=new URL(".",e).href}return promiseResolve(a)};patchBrowser().then((function(e){globalScripts();return bootstrapLazy(JSON.parse('[["salla-add-product-button_40",[[4,"salla-gifting",{"productId":[2,"product-id"],"widgetSubtitle":[1,"widget-subtitle"],"sectionTitle":[32],"sectionSubtitle":[32],"sectionBtnText":[32],"giftDetails":[32],"selectImageForYourGift":[32],"selectImageOrUpload":[32],"selectGiftMessage":[32],"giftCustomText":[32],"textId":[32],"incorrectGiftText":[32],"nextStep":[32],"senderNameLabel":[32],"receiverNameFieldLabel":[32],"receiverMobileFieldLabel":[32],"receiverEmailFieldLabel":[32],"emailPlaceholder":[32],"sendLater":[32],"selectSendDateAndTime":[32],"canNotEditOrderAfterSelectDate":[32],"sendGift":[32],"donationRequired":[32],"currentStep":[32],"showCalendar":[32],"showGiftText":[32],"currentLang":[32],"parentClass":[32],"errors":[32],"gift":[32],"selectedGiftTextOption":[32],"showTextArea":[32],"selectedImage":[32],"uploadedImage":[32],"selectedText":[32],"senderName":[32],"errorMessage":[32],"hasError":[32],"quantity":[32],"deliveryDate":[32],"timeZone":[32],"receiverName":[32],"receiverMobile":[32],"receiverCountryCode":[32],"receiverEmail":[32],"open":[64],"close":[64],"goToStep2":[64]}],[4,"salla-loyalty",{"prizePoints":[1544,"prize-points"],"customerPoints":[1538,"customer-points"],"prizeTitle":[1537,"prize-title"],"allowEmail":[4,"allow-email"],"allowMobile":[4,"allow-mobile"],"requireEmail":[4,"require-email"],"guestMessage":[1025,"guest-message"],"loyaltyProgram":[32],"buttonLoading":[32],"selectedItem":[32],"askConfirmation":[32],"is_loggedin":[32],"hasError":[32],"errorMessage":[32],"translationLoaded":[32],"open":[64],"close":[64],"resetExchange":[64],"exchangeLoyaltyPoint":[64]}],[4,"salla-product-size-guide",{"guides":[32],"productId":[32],"placeholder_title":[32],"placeholder_description":[32],"modal_title":[32],"hasError":[32],"open":[64],"close":[64]}],[4,"salla-login-modal",{"isEmailAllowed":[1028,"is-email-allowed"],"isMobileAllowed":[1028,"is-mobile-allowed"],"isEmailRequired":[1028,"is-email-required"],"supportWebAuth":[516,"support-web-auth"],"currentTabName":[32],"regType":[32],"translationLoaded":[32],"currentPhone":[32],"currentEmail":[32],"title":[32],"emailErrorMsg":[32],"firstNameErrorMsg":[32],"lastNameErrorMsg":[32],"dragAndDrop":[32],"browseFromFiles":[32],"customFields":[32],"uploadedImage":[32],"open":[64]},[[8,"verified","onVerified"]]],[0,"salla-offer-modal",{"offer":[32],"offer_name":[32],"offer_message":[32],"hasError":[32],"errorMessage":[32],"productID":[32],"offer_type":[32],"translationLoaded":[32],"addToCartLabel":[32],"open":[64],"showOffer":[64]}],[0,"salla-rating-modal",{"orderId":[2,"order-id"],"order":[32],"hasError":[32],"errorMessage":[32],"translationLoaded":[32],"open":[64],"close":[64]}],[4,"salla-scopes",{"selection":[1],"searchDisplayLimit":[2,"search-display-limit"],"translationLoaded":[32],"mode":[32],"current_scope":[32],"scopes":[32],"originalScopesList":[32],"selected_scope":[32],"isOpenedBefore":[32],"hasError":[32],"loading":[32],"close":[64],"open":[64],"handleSubmit":[64]}],[0,"salla-localization-modal",{"language":[1537],"currency":[1537],"translationLoaded":[32],"languages":[32],"currencies":[32],"hasError":[32],"errorMessage":[32],"open":[64],"close":[64],"submit":[64]}],[0,"salla-quick-order",{"quickOrderTitle":[1025,"quick-order-title"],"subTitle":[1025,"sub-title"],"payButtonTitle":[1025,"pay-button-title"],"confirmPayButtonTitle":[1025,"confirm-pay-button-title"],"agreementText":[1025,"agreement-text"],"isEmailRequired":[1028,"is-email-required"],"productId":[1025,"product-id"],"thanksMessage":[1025,"thanks-message"],"quickOrderStyle":[1025,"quick-order-style"],"user":[32],"isAvailable":[32],"oneClick":[32],"expanded":[32],"isTermsRequired":[32],"countryCode":[32],"submitSucess":[32],"placeHolderEmail":[32],"emailOptional":[32],"agreementShowText":[32],"agreementModalHead":[32],"userNameLabel":[32],"termsChecked":[32]}],[0,"salla-user-settings",{"isNotifiable":[516,"is-notifiable"],"deactivateAccount":[32],"promotionalMsgs":[32],"deactivateDesc":[32],"promotionalMsgsDesc":[32],"sorryForLeavingText":[32],"warningText":[32],"keepAccount":[32],"buttonLoading":[32]}],[0,"salla-search",{"inline":[4],"oval":[4],"height":[2],"translationLoaded":[32],"results":[32],"loading":[32],"typing":[32],"debounce":[32],"search_term":[32]},[[0,"keydown","handleKeyDown"]]],[4,"salla-social-share",{"url":[513],"urlName":[513,"url-name"],"platforms":[513],"opened":[32],"allPlatforms":[32],"platformIcons":[32],"convertedPlatforms":[32],"open":[64]}],[4,"salla-cart-summary",{"showCartLabel":[4,"show-cart-label"],"cartSummaryCount":[32],"cartSummaryTotal":[32],"cartLabel":[32],"animateToCart":[64]}],[4,"salla-infinite-scroll",{"nextPage":[1,"next-page"],"autoload":[1028],"container":[1],"item":[1],"loadMore":[32],"noMore":[32],"failedToLoad":[32]}],[0,"salla-maintenance-alert",{"title":[32],"message":[32],"buttonTitle":[32]}],[4,"salla-quantity-input",{"cartItemId":[8,"cart-item-id"],"quantity":[32],"fireChangeEvent":[32],"decrease":[64],"increase":[64],"setValue":[64]}],[4,"salla-user-menu",{"inline":[516],"avatarOnly":[516,"avatar-only"],"showHeader":[516,"show-header"],"relativeDropdown":[516,"relative-dropdown"],"accountLoading":[32],"opened":[32],"notifications":[32],"orders":[32],"pending_orders":[32],"wishlist":[32],"profile":[32],"rating":[32],"logout":[32],"hello":[32],"first_name":[32],"last_name":[32],"avatar":[32],"is_loggedIn":[32],"badges":[32],"hasBadges":[32],"OrderUpdate":[32]}],[4,"salla-product-card",{"product":[1],"horizontal":[4],"shadowOnHover":[4,"shadow-on-hover"],"hideAddBtn":[4,"hide-add-btn"],"fullImage":[4,"full-image"],"minimal":[4],"isSpecial":[4,"is-special"],"showQuantity":[4,"show-quantity"],"productData":[32],"fitImageHeight":[32],"remained":[32],"outOfStock":[32],"donationAmount":[32],"startingPrice":[32],"addToCart":[32],"placeholder":[32]}],[4,"salla-map",{"name":[1],"required":[4],"readonly":[4],"searchable":[1028],"lat":[1026],"lng":[1026],"apiKey":[1025,"api-key"],"modalTitle":[1,"modal-title"],"zoom":[1026],"theme":[1025],"modalActivityTitle":[32],"confirmButtonTitle":[32],"locateButtonTitle":[32],"locateButtonEdit":[32],"searchPlaceholder":[32],"searchInputValue":[32],"formattedAddress":[32],"geolocationError":[32],"searchInput":[32],"mapInput":[32],"mapElement":[32],"selectedLat":[32],"selectedLng":[32],"open":[64]}],[4,"salla-verify",{"display":[1],"type":[1025],"autoReload":[4,"auto-reload"],"supportWebAuth":[4,"support-web-auth"],"translationLoaded":[32],"title":[32],"resendAfter":[32],"isProfileVerify":[32],"getCode":[64],"open":[64]}],[4,"salla-color-picker",{"name":[1],"required":[4],"color":[1537],"format":[1],"showCancelButton":[4,"show-cancel-button"],"showTextField":[4,"show-text-field"],"enableAlpha":[4,"enable-alpha"],"widgetColor":[32],"setPickerOption":[64],"movePopUp":[64],"setColorValue":[64],"openPicker":[64],"closePicker":[64],"destroyPicker":[64]}],[4,"salla-add-product-button",{"channels":[513],"subscribedOptions":[1,"subscribed-options"],"quickBuy":[1540,"quick-buy"],"quantity":[514],"donatingAmount":[514,"donating-amount"],"notifyOptionsAvailability":[516,"notify-options-availability"],"productId":[520,"product-id"],"supportStickyBar":[516,"support-sticky-bar"],"productStatus":[513,"product-status"],"productType":[513,"product-type"],"hasOutOfStockOption":[32],"hasSubscribedOptions":[32],"selectedOptions":[32],"showQuickBuy":[32]}],[0,"salla-count-down",{"date":[1],"boxed":[4],"size":[1],"color":[1],"labeled":[4],"endText":[1,"end-text"],"digits":[1],"endOfDay":[4,"end-of-day"],"daysLabel":[32],"hoursLabel":[32],"minutesLabel":[32],"secondsLabel":[32],"endLabel":[32],"invalidDate":[32],"offerEnded":[32],"countInterval":[32],"days":[32],"hours":[32],"minutes":[32],"seconds":[32],"endCountDown":[64]}],[0,"salla-datetime-picker",{"value":[1537],"required":[4],"name":[513],"placeholder":[1],"allowInput":[4,"allow-input"],"allowInvalidPreload":[4,"allow-invalid-preload"],"altFormat":[1,"alt-format"],"altInput":[4,"alt-input"],"altInputClass":[1,"alt-input-class"],"appendTo":[16],"ariaDateFormat":[1,"aria-date-format"],"autoFillDefaultTime":[4,"auto-fill-default-time"],"clickOpens":[4,"click-opens"],"closeOnSelect":[4,"close-on-select"],"conjunction":[1],"dateFormat":[1,"date-format"],"defaultDate":[8,"default-date"],"defaultHour":[2,"default-hour"],"defaultMinute":[2,"default-minute"],"defaultSeconds":[2,"default-seconds"],"disable":[16],"disableMobile":[4,"disable-mobile"],"enable":[16],"enableSeconds":[4,"enable-seconds"],"enableTime":[4,"enable-time"],"formatDate":[16],"hourIncrement":[2,"hour-increment"],"inline":[4],"locale":[1],"maxDate":[8,"max-date"],"maxTime":[8,"max-time"],"minDate":[8,"min-date"],"minTime":[8,"min-time"],"minuteIncrement":[2,"minute-increment"],"mode":[1],"monthSelectorType":[1,"month-selector-type"],"nextArrow":[1,"next-arrow"],"noCalendar":[4,"no-calendar"],"dateParser":[16],"position":[1],"positionElement":[16],"prevArrow":[1,"prev-arrow"],"shorthandCurrentMonth":[4,"shorthand-current-month"],"static":[4],"showMonths":[2,"show-months"],"time_24hr":[4,"time_-2-4hr"],"weekNumbers":[4,"week-numbers"],"wrap":[4]}],[4,"salla-tab-content",{"name":[1],"isSelected":[32],"getChild":[64]}],[4,"salla-tab-header",{"name":[1],"activeClass":[1,"active-class"],"height":[8],"centered":[4],"isSelected":[32],"getChild":[64]}],[4,"salla-tabs",{"backgroundColor":[1,"background-color"],"vertical":[4]},[[0,"tabSelected","onSelectedTab"]]],[0,"salla-product-availability",{"channels":[1],"notifyOptionsAvailability":[4,"notify-options-availability"],"productId":[2,"product-id"],"isSubscribed":[1028,"is-subscribed"],"translationLoaded":[32],"title_":[32],"isVisitorSubscribed":[32]}],[0,"salla-quick-buy",{"type":[1025],"productId":[1025,"product-id"],"amount":[1538],"currency":[1025],"options":[16],"isRequireShipping":[1028,"is-require-shipping"],"isApplePayActive":[32],"quickBuy":[32]}],[0,"salla-file-upload",{"value":[1537],"files":[513],"height":[513],"cartItemId":[1,"cart-item-id"],"profileImage":[516,"profile-image"],"name":[1537],"payloadName":[1,"payload-name"],"accept":[1537],"fileId":[2,"file-id"],"url":[1025],"method":[1],"formData":[1,"form-data"],"required":[4],"maxFileSize":[1,"max-file-size"],"disabled":[4],"allowDrop":[4,"allow-drop"],"allowBrowse":[4,"allow-browse"],"allowPaste":[4,"allow-paste"],"allowMultiple":[4,"allow-multiple"],"allowReplace":[4,"allow-replace"],"allowRevert":[4,"allow-revert"],"allowRemove":[4,"allow-remove"],"allowProcess":[4,"allow-process"],"allowReorder":[4,"allow-reorder"],"storeAsFile":[4,"store-as-file"],"forceRevert":[4,"force-revert"],"maxFilesCount":[2,"max-files-count"],"maxParallelUploads":[2,"max-parallel-uploads"],"checkValidity":[4,"check-validity"],"itemInsertLocation":[1,"item-insert-location"],"itemInsertInterval":[2,"item-insert-interval"],"credits":[4],"dropOnPage":[4,"drop-on-page"],"dropOnElement":[4,"drop-on-element"],"dropValidation":[4,"drop-validation"],"ignoredFiles":[16],"instantUpload":[1028,"instant-upload"],"chunkUploads":[4,"chunk-uploads"],"chunkForce":[4,"chunk-force"],"chunkSize":[2,"chunk-size"],"chunkRetryDelays":[16],"labelDecimalSeparator":[1,"label-decimal-separator"],"labelThousandsSeparator":[1,"label-thousands-separator"],"labelIdle":[1025,"label-idle"],"iconRemove":[1,"icon-remove"],"iconProcess":[1,"icon-process"],"iconRetry":[1,"icon-retry"],"iconUndo":[1,"icon-undo"],"setOption":[64]}],[0,"salla-progress-bar",{"donation":[1],"target":[1026],"value":[1026],"height":[1025],"header":[1025],"stripped":[1028],"message":[1025],"unit":[1025],"color":[1025]}],[0,"salla-rating-stars",{"name":[1],"size":[1],"value":[2],"reviews":[2]}],[4,"salla-list-tile",{"href":[1],"target":[1]}],[4,"salla-slider",{"blockTitle":[513,"block-title"],"listenToThumbnailsOption":[516,"listen-to-thumbnails-option"],"blockSubtitle":[513,"block-subtitle"],"displayAllUrl":[513,"display-all-url"],"arrowsCentered":[516,"arrows-centered"],"verticalThumbs":[516,"vertical-thumbs"],"gridThumbs":[516,"grid-thumbs"],"vertical":[516],"autoHeight":[516,"auto-height"],"showControls":[516,"show-controls"],"controlsOuter":[516,"controls-outer"],"showThumbsControls":[4,"show-thumbs-controls"],"autoPlay":[4,"auto-play"],"slidesPerView":[1,"slides-per-view"],"pagination":[4],"centered":[4],"loop":[4],"direction":[1537],"type":[1],"sliderConfig":[520,"slider-config"],"thumbsConfig":[520,"thumbs-config"],"currentIndex":[32],"isEnd":[32],"isBeginning":[32],"swiperScript":[32],"displayAllTitle":[32],"slideTo":[64],"slideNext":[64],"slidePrev":[64],"slideToLoop":[64],"slideNextLoop":[64],"slidePrevLoop":[64],"slideReset":[64],"slideToClosest":[64],"update":[64],"updateAutoHeight":[64],"updateSlides":[64],"updateProgress":[64],"updateSlidesClasses":[64],"getSlides":[64]}],[4,"salla-placeholder",{"icon":[1],"alignment":[1],"iconSize":[1,"icon-size"],"translationLoaded":[32]}],[0,"salla-skeleton",{"type":[1],"width":[1],"height":[1]}],[0,"salla-tel-input",{"phone":[1025],"name":[1],"countryCode":[1025,"country-code"],"mobileRequired":[32],"countryCodeLabel":[32],"mobileLabel":[32],"tooShort":[32],"tooLong":[32],"invalidCountryCode":[32],"invalidNumber":[32],"errorMap":[32],"getValues":[64],"isValid":[64]}],[4,"salla-modal",{"isClosable":[1028,"is-closable"],"width":[513],"position":[513],"visible":[516],"hasSkeleton":[516,"has-skeleton"],"isLoading":[1540,"is-loading"],"subTitleFirst":[4,"sub-title-first"],"noPadding":[4,"no-padding"],"subTitle":[1,"sub-title"],"centered":[4],"iconStyle":[1,"icon-style"],"modalTitle":[32],"open":[64],"close":[64],"setTitle":[64],"loading":[64],"stopLoading":[64]},[[0,"keyup","handleKeyUp"]]],[0,"salla-loading",{"size":[8],"width":[8],"color":[1],"bgColor":[1,"bg-color"]}],[4,"salla-button",{"shape":[513],"color":[513],"fill":[513],"size":[513],"width":[513],"loading":[516],"disabled":[516],"loaderPosition":[1,"loader-position"],"href":[1],"load":[64],"stop":[64],"setText":[64],"disable":[64],"enable":[64]}]]],["salla-products-slider",[[0,"salla-products-slider",{"blockTitle":[1,"block-title"],"subTitle":[1,"sub-title"],"sliderId":[1,"slider-id"],"displayAllUrl":[1,"display-all-url"],"autoplay":[1028],"source":[1537],"sourceValue":[1,"source-value"],"limit":[1026],"productsData":[32],"isReady":[32],"sourceValueIsValid":[32],"hasCustomComponent":[32],"apiUrl":[32],"parsedSourceValue":[32]}]]],["salla-product-options",[[0,"salla-product-options",{"productId":[2,"product-id"],"options":[1],"optionsData":[32],"outOfStockText":[32],"donationAmount":[32],"selectedOptions":[32],"canDisabled":[32],"selectedSkus":[32],"selectedOutSkus":[32],"getSelectedOptionsData":[64],"reportValidity":[64],"hasOutOfStockOption":[64],"getSelectedOptions":[64],"getOption":[64]}]]],["salla-filters",[[0,"salla-filters",{"filters":[1040],"isSidebarOpen":[32],"filtersData":[32],"apply":[32],"reset":[32],"getFilters":[64],"applyFilters":[64],"resetFilters":[64]}]]],["salla-comment-form",[[0,"salla-comment-form",{"type":[1537],"showAvatar":[4,"show-avatar"],"itemId":[1544,"item-id"],"placeholder":[32],"submitText":[32],"canComment":[32]}]]],["salla-installment",[[0,"salla-installment",{"price":[1],"language":[1],"currency":[1],"tamaraIsActive":[32],"tabbyIsActive":[32],"spotiiIsActive":[32]}]]],["salla-loyalty-prize-item",[[0,"salla-loyalty-prize-item",{"item":[16]}]]],["salla-products-list",[[0,"salla-products-list",{"source":[1537],"sourceValue":[1032,"source-value"],"limit":[1026],"sortBy":[1025,"sort-by"],"filtersResults":[1540,"filters-results"],"horizontalCards":[516,"horizontal-cards"],"page":[32],"nextPage":[32],"hasInfiniteScroll":[32],"hasCustomComponent":[32],"sourceValueIsValid":[32],"placeholderText":[32],"isReady":[32],"showPlaceholder":[32],"parsedFilters":[32],"setFilters":[64],"reload":[64]}]]],["salla-price-range",[[0,"salla-price-range",{"minPrice":[1032,"min-price"],"maxPrice":[1032,"max-price"],"option":[16],"filtersData":[520,"filters-data"],"min":[32],"max":[32],"priceOptions":[32],"moreThanLabel":[32],"lessThanLabel":[32],"toLabel":[32],"fromLabel":[32],"reset":[64]}]]],["salla-filters-widget",[[4,"salla-filters-widget",{"widgetTitle":[1025,"widget-title"],"withLoadMore":[1028,"with-load-more"],"filtersData":[16],"option":[16],"isOpen":[32],"isShowMore":[32],"showMoreLabel":[32],"showLessLabel":[32],"reset":[64],"showMore":[64],"toggleWidget":[64]}]]],["salla-conditional-fields",[[4,"salla-conditional-fields",null,[[0,"change","changeHandler"]]]]]]'),e)}));
4
+ import{p as promiseResolve,b as bootstrapLazy}from"./index-c5e788f5.js";export{s as setNonce}from"./index-c5e788f5.js";import{g as globalScripts}from"./app-globals-6b360973.js";import"./_commonjsHelpers-9adcfb67.js";var patchBrowser=function(){var e=import.meta.url;var a={};if(e!==""){a.resourcesUrl=new URL(".",e).href}return promiseResolve(a)};patchBrowser().then((function(e){globalScripts();return bootstrapLazy(JSON.parse('[["salla-add-product-button_40",[[4,"salla-gifting",{"productId":[2,"product-id"],"widgetSubtitle":[1,"widget-subtitle"],"sectionTitle":[32],"sectionSubtitle":[32],"sectionBtnText":[32],"giftDetails":[32],"selectImageForYourGift":[32],"selectImageOrUpload":[32],"selectGiftMessage":[32],"giftCustomText":[32],"textId":[32],"incorrectGiftText":[32],"nextStep":[32],"senderNameLabel":[32],"receiverNameFieldLabel":[32],"receiverMobileFieldLabel":[32],"receiverEmailFieldLabel":[32],"emailPlaceholder":[32],"sendLater":[32],"selectSendDateAndTime":[32],"canNotEditOrderAfterSelectDate":[32],"sendGift":[32],"donationRequired":[32],"currentStep":[32],"showCalendar":[32],"showGiftText":[32],"currentLang":[32],"parentClass":[32],"errors":[32],"gift":[32],"selectedGiftTextOption":[32],"showTextArea":[32],"selectedImage":[32],"uploadedImage":[32],"selectedText":[32],"senderName":[32],"errorMessage":[32],"hasError":[32],"quantity":[32],"deliveryDate":[32],"timeZone":[32],"receiverName":[32],"receiverMobile":[32],"receiverCountryCode":[32],"receiverEmail":[32],"open":[64],"close":[64],"goToStep2":[64]}],[4,"salla-loyalty",{"prizePoints":[1544,"prize-points"],"customerPoints":[1538,"customer-points"],"prizeTitle":[1537,"prize-title"],"allowEmail":[4,"allow-email"],"allowMobile":[4,"allow-mobile"],"requireEmail":[4,"require-email"],"guestMessage":[1025,"guest-message"],"loyaltyProgram":[32],"buttonLoading":[32],"selectedItem":[32],"askConfirmation":[32],"is_loggedin":[32],"hasError":[32],"errorMessage":[32],"translationLoaded":[32],"open":[64],"close":[64],"resetExchange":[64],"exchangeLoyaltyPoint":[64]}],[4,"salla-product-size-guide",{"guides":[32],"productId":[32],"placeholder_title":[32],"placeholder_description":[32],"modal_title":[32],"hasError":[32],"open":[64],"close":[64]}],[4,"salla-login-modal",{"isEmailAllowed":[1028,"is-email-allowed"],"isMobileAllowed":[1028,"is-mobile-allowed"],"isEmailRequired":[1028,"is-email-required"],"supportWebAuth":[516,"support-web-auth"],"currentTabName":[32],"regType":[32],"translationLoaded":[32],"currentPhone":[32],"currentEmail":[32],"title":[32],"emailErrorMsg":[32],"firstNameErrorMsg":[32],"lastNameErrorMsg":[32],"dragAndDrop":[32],"browseFromFiles":[32],"customFields":[32],"uploadedImage":[32],"open":[64]},[[8,"verified","onVerified"]]],[0,"salla-offer-modal",{"offer":[32],"offer_name":[32],"offer_message":[32],"hasError":[32],"errorMessage":[32],"productID":[32],"offer_type":[32],"translationLoaded":[32],"addToCartLabel":[32],"open":[64],"showOffer":[64]}],[0,"salla-rating-modal",{"orderId":[2,"order-id"],"order":[32],"hasError":[32],"errorMessage":[32],"translationLoaded":[32],"open":[64],"close":[64]}],[4,"salla-scopes",{"selection":[1],"searchDisplayLimit":[2,"search-display-limit"],"translationLoaded":[32],"mode":[32],"current_scope":[32],"scopes":[32],"originalScopesList":[32],"selected_scope":[32],"isOpenedBefore":[32],"hasError":[32],"loading":[32],"close":[64],"open":[64],"handleSubmit":[64]}],[0,"salla-localization-modal",{"language":[1537],"currency":[1537],"translationLoaded":[32],"languages":[32],"currencies":[32],"hasError":[32],"errorMessage":[32],"open":[64],"close":[64],"submit":[64]}],[0,"salla-quick-order",{"quickOrderTitle":[1025,"quick-order-title"],"subTitle":[1025,"sub-title"],"payButtonTitle":[1025,"pay-button-title"],"confirmPayButtonTitle":[1025,"confirm-pay-button-title"],"agreementText":[1025,"agreement-text"],"isEmailRequired":[1028,"is-email-required"],"productId":[1025,"product-id"],"thanksMessage":[1025,"thanks-message"],"quickOrderStyle":[1025,"quick-order-style"],"user":[32],"isAvailable":[32],"oneClick":[32],"expanded":[32],"isTermsRequired":[32],"countryCode":[32],"submitSucess":[32],"placeHolderEmail":[32],"emailOptional":[32],"agreementShowText":[32],"agreementModalHead":[32],"userNameLabel":[32],"termsChecked":[32]}],[0,"salla-user-settings",{"isNotifiable":[516,"is-notifiable"],"deactivateAccount":[32],"promotionalMsgs":[32],"deactivateDesc":[32],"promotionalMsgsDesc":[32],"sorryForLeavingText":[32],"warningText":[32],"keepAccount":[32],"buttonLoading":[32]}],[0,"salla-search",{"inline":[4],"oval":[4],"height":[2],"translationLoaded":[32],"results":[32],"loading":[32],"typing":[32],"debounce":[32],"search_term":[32]},[[0,"keydown","handleKeyDown"]]],[4,"salla-social-share",{"url":[513],"urlName":[513,"url-name"],"platforms":[513],"opened":[32],"allPlatforms":[32],"platformIcons":[32],"convertedPlatforms":[32],"open":[64]}],[4,"salla-cart-summary",{"showCartLabel":[4,"show-cart-label"],"cartSummaryCount":[32],"cartSummaryTotal":[32],"cartLabel":[32],"animateToCart":[64]}],[4,"salla-infinite-scroll",{"nextPage":[1,"next-page"],"autoload":[1028],"container":[1],"item":[1],"loadMore":[32],"noMore":[32],"failedToLoad":[32]}],[0,"salla-maintenance-alert",{"title":[32],"message":[32],"buttonTitle":[32]}],[4,"salla-quantity-input",{"cartItemId":[8,"cart-item-id"],"quantity":[32],"fireChangeEvent":[32],"decrease":[64],"increase":[64],"setValue":[64]}],[4,"salla-user-menu",{"inline":[516],"avatarOnly":[516,"avatar-only"],"showHeader":[516,"show-header"],"relativeDropdown":[516,"relative-dropdown"],"accountLoading":[32],"opened":[32],"notifications":[32],"orders":[32],"pending_orders":[32],"wishlist":[32],"profile":[32],"rating":[32],"logout":[32],"hello":[32],"first_name":[32],"last_name":[32],"avatar":[32],"is_loggedIn":[32],"badges":[32],"hasBadges":[32],"OrderUpdate":[32]}],[4,"salla-product-card",{"product":[1],"horizontal":[4],"shadowOnHover":[4,"shadow-on-hover"],"hideAddBtn":[4,"hide-add-btn"],"fullImage":[4,"full-image"],"minimal":[4],"isSpecial":[4,"is-special"],"showQuantity":[4,"show-quantity"],"productData":[32],"fitImageHeight":[32],"remained":[32],"outOfStock":[32],"donationAmount":[32],"startingPrice":[32],"addToCart":[32],"placeholder":[32]}],[4,"salla-map",{"name":[1],"required":[4],"readonly":[4],"searchable":[1028],"lat":[1026],"lng":[1026],"apiKey":[1025,"api-key"],"modalTitle":[1,"modal-title"],"zoom":[1026],"theme":[1025],"modalActivityTitle":[32],"confirmButtonTitle":[32],"locateButtonTitle":[32],"locateButtonEdit":[32],"searchPlaceholder":[32],"searchInputValue":[32],"formattedAddress":[32],"geolocationError":[32],"searchInput":[32],"mapInput":[32],"mapElement":[32],"selectedLat":[32],"selectedLng":[32],"open":[64]}],[4,"salla-verify",{"display":[1],"type":[1025],"autoReload":[4,"auto-reload"],"supportWebAuth":[4,"support-web-auth"],"translationLoaded":[32],"title":[32],"resendAfter":[32],"isProfileVerify":[32],"getCode":[64],"open":[64]}],[4,"salla-color-picker",{"name":[1],"required":[4],"color":[1537],"format":[1],"showCancelButton":[4,"show-cancel-button"],"showTextField":[4,"show-text-field"],"enableAlpha":[4,"enable-alpha"],"widgetColor":[32],"setPickerOption":[64],"movePopUp":[64],"setColorValue":[64],"openPicker":[64],"closePicker":[64],"destroyPicker":[64]}],[4,"salla-add-product-button",{"channels":[513],"subscribedOptions":[1,"subscribed-options"],"quickBuy":[1540,"quick-buy"],"quantity":[514],"donatingAmount":[514,"donating-amount"],"notifyOptionsAvailability":[516,"notify-options-availability"],"productId":[520,"product-id"],"supportStickyBar":[516,"support-sticky-bar"],"productStatus":[513,"product-status"],"productType":[513,"product-type"],"hasOutOfStockOption":[32],"hasSubscribedOptions":[32],"selectedOptions":[32],"showQuickBuy":[32]}],[0,"salla-count-down",{"date":[1],"boxed":[4],"size":[1],"color":[1],"labeled":[4],"endText":[1,"end-text"],"digits":[1],"endOfDay":[4,"end-of-day"],"daysLabel":[32],"hoursLabel":[32],"minutesLabel":[32],"secondsLabel":[32],"endLabel":[32],"invalidDate":[32],"offerEnded":[32],"countInterval":[32],"days":[32],"hours":[32],"minutes":[32],"seconds":[32],"endCountDown":[64]}],[0,"salla-datetime-picker",{"value":[1537],"required":[4],"name":[513],"placeholder":[1],"allowInput":[4,"allow-input"],"allowInvalidPreload":[4,"allow-invalid-preload"],"altFormat":[1,"alt-format"],"altInput":[4,"alt-input"],"altInputClass":[1,"alt-input-class"],"appendTo":[16],"ariaDateFormat":[1,"aria-date-format"],"autoFillDefaultTime":[4,"auto-fill-default-time"],"clickOpens":[4,"click-opens"],"closeOnSelect":[4,"close-on-select"],"conjunction":[1],"dateFormat":[1,"date-format"],"defaultDate":[8,"default-date"],"defaultHour":[2,"default-hour"],"defaultMinute":[2,"default-minute"],"defaultSeconds":[2,"default-seconds"],"disable":[16],"disableMobile":[4,"disable-mobile"],"enable":[16],"enableSeconds":[4,"enable-seconds"],"enableTime":[4,"enable-time"],"formatDate":[16],"hourIncrement":[2,"hour-increment"],"inline":[4],"locale":[1],"maxDate":[8,"max-date"],"maxTime":[8,"max-time"],"minDate":[8,"min-date"],"minTime":[8,"min-time"],"minuteIncrement":[2,"minute-increment"],"mode":[1],"monthSelectorType":[1,"month-selector-type"],"nextArrow":[1,"next-arrow"],"noCalendar":[4,"no-calendar"],"dateParser":[16],"position":[1],"positionElement":[16],"prevArrow":[1,"prev-arrow"],"shorthandCurrentMonth":[4,"shorthand-current-month"],"static":[4],"showMonths":[2,"show-months"],"time_24hr":[4,"time_-2-4hr"],"weekNumbers":[4,"week-numbers"],"wrap":[4]}],[4,"salla-tab-content",{"name":[1],"isSelected":[32],"getChild":[64]}],[4,"salla-tab-header",{"name":[1],"activeClass":[1,"active-class"],"height":[8],"centered":[4],"isSelected":[32],"getChild":[64]}],[4,"salla-tabs",{"backgroundColor":[1,"background-color"],"vertical":[4]},[[0,"tabSelected","onSelectedTab"]]],[0,"salla-product-availability",{"channels":[1],"notifyOptionsAvailability":[4,"notify-options-availability"],"productId":[2,"product-id"],"isSubscribed":[1028,"is-subscribed"],"translationLoaded":[32],"title_":[32],"isVisitorSubscribed":[32]}],[0,"salla-quick-buy",{"type":[1025],"productId":[1025,"product-id"],"amount":[1538],"currency":[1025],"options":[16],"isRequireShipping":[1028,"is-require-shipping"],"isApplePayActive":[32],"quickBuy":[32]}],[0,"salla-file-upload",{"value":[1537],"files":[513],"height":[513],"cartItemId":[1,"cart-item-id"],"profileImage":[516,"profile-image"],"name":[1537],"payloadName":[1,"payload-name"],"accept":[1537],"fileId":[2,"file-id"],"url":[1025],"method":[1],"formData":[1,"form-data"],"required":[4],"maxFileSize":[1,"max-file-size"],"disabled":[4],"allowDrop":[4,"allow-drop"],"allowBrowse":[4,"allow-browse"],"allowPaste":[4,"allow-paste"],"allowMultiple":[4,"allow-multiple"],"allowReplace":[4,"allow-replace"],"allowRevert":[4,"allow-revert"],"allowRemove":[4,"allow-remove"],"allowProcess":[4,"allow-process"],"allowReorder":[4,"allow-reorder"],"storeAsFile":[4,"store-as-file"],"forceRevert":[4,"force-revert"],"maxFilesCount":[2,"max-files-count"],"maxParallelUploads":[2,"max-parallel-uploads"],"checkValidity":[4,"check-validity"],"itemInsertLocation":[1,"item-insert-location"],"itemInsertInterval":[2,"item-insert-interval"],"credits":[4],"dropOnPage":[4,"drop-on-page"],"dropOnElement":[4,"drop-on-element"],"dropValidation":[4,"drop-validation"],"ignoredFiles":[16],"instantUpload":[1028,"instant-upload"],"chunkUploads":[4,"chunk-uploads"],"chunkForce":[4,"chunk-force"],"chunkSize":[2,"chunk-size"],"chunkRetryDelays":[16],"labelDecimalSeparator":[1,"label-decimal-separator"],"labelThousandsSeparator":[1,"label-thousands-separator"],"labelIdle":[1025,"label-idle"],"iconRemove":[1,"icon-remove"],"iconProcess":[1,"icon-process"],"iconRetry":[1,"icon-retry"],"iconUndo":[1,"icon-undo"],"setOption":[64]}],[0,"salla-progress-bar",{"donation":[1],"target":[1026],"value":[1026],"height":[1025],"header":[1025],"stripped":[1028],"message":[1025],"unit":[1025],"color":[1025]}],[0,"salla-rating-stars",{"name":[1],"size":[1],"value":[2],"reviews":[2]}],[4,"salla-list-tile",{"href":[1],"target":[1]}],[4,"salla-slider",{"blockTitle":[513,"block-title"],"listenToThumbnailsOption":[516,"listen-to-thumbnails-option"],"blockSubtitle":[513,"block-subtitle"],"displayAllUrl":[513,"display-all-url"],"arrowsCentered":[516,"arrows-centered"],"verticalThumbs":[516,"vertical-thumbs"],"gridThumbs":[516,"grid-thumbs"],"vertical":[516],"autoHeight":[516,"auto-height"],"showControls":[516,"show-controls"],"controlsOuter":[516,"controls-outer"],"showThumbsControls":[4,"show-thumbs-controls"],"autoPlay":[4,"auto-play"],"slidesPerView":[1,"slides-per-view"],"pagination":[4],"centered":[4],"loop":[4],"direction":[1537],"type":[1],"sliderConfig":[520,"slider-config"],"thumbsConfig":[520,"thumbs-config"],"currentIndex":[32],"isEnd":[32],"isBeginning":[32],"swiperScript":[32],"displayAllTitle":[32],"slideTo":[64],"slideNext":[64],"slidePrev":[64],"slideToLoop":[64],"slideNextLoop":[64],"slidePrevLoop":[64],"slideReset":[64],"slideToClosest":[64],"update":[64],"updateAutoHeight":[64],"updateSlides":[64],"updateProgress":[64],"updateSlidesClasses":[64],"getSlides":[64]}],[4,"salla-placeholder",{"icon":[1],"alignment":[1],"iconSize":[1,"icon-size"],"translationLoaded":[32]}],[0,"salla-skeleton",{"type":[1],"width":[1],"height":[1]}],[0,"salla-tel-input",{"phone":[1025],"name":[1],"countryCode":[1025,"country-code"],"mobileRequired":[32],"countryCodeLabel":[32],"mobileLabel":[32],"tooShort":[32],"tooLong":[32],"invalidCountryCode":[32],"invalidNumber":[32],"errorMap":[32],"getValues":[64],"isValid":[64]}],[4,"salla-modal",{"isClosable":[1028,"is-closable"],"width":[513],"position":[513],"visible":[516],"hasSkeleton":[516,"has-skeleton"],"isLoading":[1540,"is-loading"],"subTitleFirst":[4,"sub-title-first"],"noPadding":[4,"no-padding"],"subTitle":[1,"sub-title"],"centered":[4],"iconStyle":[1,"icon-style"],"modalTitle":[32],"open":[64],"close":[64],"setTitle":[64],"loading":[64],"stopLoading":[64]},[[0,"keyup","handleKeyUp"]]],[0,"salla-loading",{"size":[8],"width":[8],"color":[1],"bgColor":[1,"bg-color"]}],[4,"salla-button",{"shape":[513],"color":[513],"fill":[513],"size":[513],"width":[513],"loading":[516],"disabled":[516],"loaderPosition":[1,"loader-position"],"href":[1],"load":[64],"stop":[64],"setText":[64],"disable":[64],"enable":[64]}]]],["salla-products-slider",[[0,"salla-products-slider",{"blockTitle":[1,"block-title"],"subTitle":[1,"sub-title"],"sliderId":[1,"slider-id"],"displayAllUrl":[1,"display-all-url"],"autoplay":[1028],"source":[1537],"sourceValue":[1,"source-value"],"limit":[1026],"productsData":[32],"isReady":[32],"sourceValueIsValid":[32],"hasCustomComponent":[32],"apiUrl":[32],"parsedSourceValue":[32]}]]],["salla-product-options",[[0,"salla-product-options",{"productId":[2,"product-id"],"options":[1],"optionsData":[32],"outOfStockText":[32],"donationAmount":[32],"selectedOptions":[32],"canDisabled":[32],"selectedSkus":[32],"selectedOutSkus":[32],"getSelectedOptionsData":[64],"reportValidity":[64],"hasOutOfStockOption":[64],"getSelectedOptions":[64],"getOption":[64]}]]],["salla-filters",[[0,"salla-filters",{"filters":[1040],"isSidebarOpen":[32],"filtersData":[32],"apply":[32],"reset":[32],"getFilters":[64],"applyFilters":[64],"resetFilters":[64]}]]],["salla-comment-form",[[0,"salla-comment-form",{"type":[1537],"showAvatar":[4,"show-avatar"],"itemId":[1544,"item-id"],"placeholder":[32],"submitText":[32],"canComment":[32]}]]],["salla-installment",[[0,"salla-installment",{"price":[1],"language":[1],"currency":[1],"tamaraIsActive":[32],"tabbyIsActive":[32],"spotiiIsActive":[32]}]]],["salla-loyalty-prize-item",[[0,"salla-loyalty-prize-item",{"item":[16]}]]],["salla-products-list",[[0,"salla-products-list",{"source":[1537],"sourceValue":[1032,"source-value"],"limit":[1026],"sortBy":[1025,"sort-by"],"filtersResults":[1540,"filters-results"],"horizontalCards":[516,"horizontal-cards"],"page":[32],"nextPage":[32],"hasInfiniteScroll":[32],"hasCustomComponent":[32],"sourceValueIsValid":[32],"placeholderText":[32],"isReady":[32],"showPlaceholder":[32],"parsedFilters":[32],"setFilters":[64],"reload":[64]}]]],["salla-price-range",[[0,"salla-price-range",{"minPrice":[1032,"min-price"],"maxPrice":[1032,"max-price"],"option":[16],"filtersData":[520,"filters-data"],"min":[32],"max":[32],"priceOptions":[32],"moreThanLabel":[32],"lessThanLabel":[32],"toLabel":[32],"fromLabel":[32],"reset":[64]}]]],["salla-filters-widget",[[4,"salla-filters-widget",{"widgetTitle":[1025,"widget-title"],"withLoadMore":[1028,"with-load-more"],"filtersData":[16],"option":[16],"isOpen":[32],"isShowMore":[32],"showMoreLabel":[32],"showLessLabel":[32],"reset":[64],"showMore":[64],"toggleWidget":[64]}]]],["salla-conditional-fields",[[4,"salla-conditional-fields",null,[[0,"change","changeHandler"]]]]]]'),e)}));
5
5
  //# sourceMappingURL=twilight.js.map
@@ -1,5 +1,5 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r as s,c as t,h as i,H as e,g as h}from"./p-c76c4ed2.js";import{H as l}from"./p-5ffffea6.js";import{a,F as n}from"./p-d3cc3770.js";const r=":host{display:block}";const o=class{constructor(i){s(this,i);this.changed=t(this,"changed",7);this.initHeight=195;this.widgetTitle=undefined;this.withLoadMore=undefined;this.filtersData=undefined;this.option=undefined;this.isOpen=true;this.isShowMore=false;this.showMoreLabel="عرض المزيد";this.showLessLabel="عرض أقل"}connectedCallback(){this.withLoadMore=this.option.key!="price"&&Array.isArray(this.option.values)&&this.option.values.length>8;this.widgetTitle=this.option.label;salla.lang.onLoaded((()=>{this.showMoreLabel=salla.lang.getWithDefault("common.titles.more",this.showMoreLabel);this.showLessLabel=salla.lang.getWithDefault("common.elements.show_less",this.showLessLabel)}))}componentDidLoad(){this.widgetValues.scrollHeight<this.initHeight&&(this.withLoadMore=false);this.withLoadMore&&this.widgetValues&&(this.widgetValues.style.maxHeight=`${this.initHeight}px`);this.widgetContent.style.height=`${this.widgetContent.scrollHeight}px`}async reset(){if(this.option.type===a.RANGE){this.priceRange.reset()}Array.from(this.host.querySelectorAll("input")).forEach((s=>s.checked=false))}async showMore(){this.isShowMore=!this.isShowMore;this.widgetContent.style.height="auto";this.widgetValues.style.maxHeight=this.isShowMore?`${this.widgetValues.scrollHeight}px`:`${this.initHeight}px`;setTimeout((()=>{this.widgetContent.style.height=`${this.widgetContent.scrollHeight}px`}),400)}async toggleWidget(){this.isOpen=!this.isOpen;l.toggleElementClassIf(this.widgetContent,"s-filters-widget-opened","s-filters-widget-closed",(()=>this.isOpen))}renderFilterOption(s){if(![a.VALUES,a.MINIMUM,a.VARIANTS].includes(s.type)){return""}return s.values.map(((t,e)=>{let h=typeof t=="number"?t:t.key||t.value;return i("label",{class:"s-filters-label",htmlFor:`${s.key}-option-${e}`},i("input",{id:`${s.key}-option-${e}`,name:s.key,type:s.inputType,checked:this.isSelectedOption(s,h),class:`s-filters-${s.inputType}`,onChange:t=>this.changed.emit({event:t,option:s,value:h})}),this.getOptionLabel(s,t))}))}isSelectedOption(s,t){if(!this.filtersData||!this.filtersData[s.key]){return false}return s.inputType===n.CHECKBOX?this.filtersData[s.key].includes(t):this.filtersData[s.key]==t}getOptionLabel(s,t){if(s.key=="rating"){return i("salla-rating-stars",{size:"small",value:t})}let e=t.value||"null";return i("span",{class:"s-filters-option-name"},e)}render(){return i(e,{class:"s-filters-widget-container"},i("h3",{class:"s-filters-widget-title",onClick:()=>this.toggleWidget()},i("span",null,this.widgetTitle),i("span",{class:`s-filters-widget-plusminus ${this.isOpen?"s-filters-widget-plusminus-active":""}`})),i("div",{class:"s-filters-widget-content",ref:s=>this.widgetContent=s},i("div",{class:"s-filters-widget-values",ref:s=>this.widgetValues=s},i("slot",null),this.option.type!==a.RANGE?this.renderFilterOption(this.option):i("salla-price-range",{onChanged:s=>this.changed.emit(s.detail),ref:s=>this.priceRange=s,filtersData:this.filtersData,option:this.option})),this.withLoadMore&&i("a",{class:"s-filters-widget-more",onClick:()=>this.showMore()},!this.isShowMore?this.showMoreLabel:this.showLessLabel)))}get host(){return h(this)}};o.style=r;export{o as salla_filters_widget};
5
- //# sourceMappingURL=p-a378c3be.entry.js.map
4
+ import{r as s,c as t,h as i,H as e,g as h}from"./p-c76c4ed2.js";import{H as l}from"./p-431fcc73.js";import{a,F as n}from"./p-d3cc3770.js";const r=":host{display:block}";const o=class{constructor(i){s(this,i);this.changed=t(this,"changed",7);this.initHeight=195;this.widgetTitle=undefined;this.withLoadMore=undefined;this.filtersData=undefined;this.option=undefined;this.isOpen=true;this.isShowMore=false;this.showMoreLabel="عرض المزيد";this.showLessLabel="عرض أقل"}connectedCallback(){this.withLoadMore=this.option.key!="price"&&Array.isArray(this.option.values)&&this.option.values.length>8;this.widgetTitle=this.option.label;salla.lang.onLoaded((()=>{this.showMoreLabel=salla.lang.getWithDefault("common.titles.more",this.showMoreLabel);this.showLessLabel=salla.lang.getWithDefault("common.elements.show_less",this.showLessLabel)}))}componentDidLoad(){this.widgetValues.scrollHeight<this.initHeight&&(this.withLoadMore=false);this.withLoadMore&&this.widgetValues&&(this.widgetValues.style.maxHeight=`${this.initHeight}px`);this.widgetContent.style.height=`${this.widgetContent.scrollHeight}px`}async reset(){if(this.option.type===a.RANGE){this.priceRange.reset()}Array.from(this.host.querySelectorAll("input")).forEach((s=>s.checked=false))}async showMore(){this.isShowMore=!this.isShowMore;this.widgetContent.style.height="auto";this.widgetValues.style.maxHeight=this.isShowMore?`${this.widgetValues.scrollHeight}px`:`${this.initHeight}px`;setTimeout((()=>{this.widgetContent.style.height=`${this.widgetContent.scrollHeight}px`}),400)}async toggleWidget(){this.isOpen=!this.isOpen;l.toggleElementClassIf(this.widgetContent,"s-filters-widget-opened","s-filters-widget-closed",(()=>this.isOpen))}renderFilterOption(s){if(![a.VALUES,a.MINIMUM,a.VARIANTS].includes(s.type)){return""}return s.values.map(((t,e)=>{let h=typeof t=="number"?t:t.key||t.value;return i("label",{class:"s-filters-label",htmlFor:`${s.key}-option-${e}`},i("input",{id:`${s.key}-option-${e}`,name:s.key,type:s.inputType,checked:this.isSelectedOption(s,h),class:`s-filters-${s.inputType}`,onChange:t=>this.changed.emit({event:t,option:s,value:h})}),this.getOptionLabel(s,t))}))}isSelectedOption(s,t){if(!this.filtersData||!this.filtersData[s.key]){return false}return s.inputType===n.CHECKBOX?this.filtersData[s.key].includes(t):this.filtersData[s.key]==t}getOptionLabel(s,t){if(s.key=="rating"){return i("salla-rating-stars",{size:"small",value:t})}let e=t.value||"null";return i("span",{class:"s-filters-option-name"},e)}render(){return i(e,{class:"s-filters-widget-container"},i("h3",{class:"s-filters-widget-title",onClick:()=>this.toggleWidget()},i("span",null,this.widgetTitle),i("span",{class:`s-filters-widget-plusminus ${this.isOpen?"s-filters-widget-plusminus-active":""}`})),i("div",{class:"s-filters-widget-content",ref:s=>this.widgetContent=s},i("div",{class:"s-filters-widget-values",ref:s=>this.widgetValues=s},i("slot",null),this.option.type!==a.RANGE?this.renderFilterOption(this.option):i("salla-price-range",{onChanged:s=>this.changed.emit(s.detail),ref:s=>this.priceRange=s,filtersData:this.filtersData,option:this.option})),this.withLoadMore&&i("a",{class:"s-filters-widget-more",onClick:()=>this.showMore()},!this.isShowMore?this.showMoreLabel:this.showLessLabel)))}get host(){return h(this)}};o.style=r;export{o as salla_filters_widget};
5
+ //# sourceMappingURL=p-1342a68f.entry.js.map