@salla.sa/twilight-components 2.12.74 → 2.12.77

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 (134) hide show
  1. package/README.md +56 -47
  2. package/dist/cjs/{app-globals-36ab7ecf.js → app-globals-6f163c1c.js} +2 -2
  3. package/dist/cjs/app-globals-6f163c1c.js.map +1 -0
  4. package/dist/cjs/index-40f35e63.js +4 -0
  5. package/dist/cjs/{interfaces-56469cd9.js → interfaces-c3b1e489.js} +6 -5
  6. package/dist/cjs/interfaces-c3b1e489.js.map +1 -0
  7. package/dist/cjs/loader.cjs.js +2 -2
  8. package/dist/cjs/salla-app-install-alert.cjs.entry.js +82 -0
  9. package/dist/cjs/salla-app-install-alert.cjs.entry.js.map +1 -0
  10. package/dist/cjs/salla-filters-widget.cjs.entry.js +8 -5
  11. package/dist/cjs/salla-filters-widget.cjs.entry.js.map +1 -1
  12. package/dist/cjs/salla-filters.cjs.entry.js +4 -5
  13. package/dist/cjs/salla-filters.cjs.entry.js.map +1 -1
  14. package/dist/cjs/salla-products-list.cjs.entry.js +22 -13
  15. package/dist/cjs/salla-products-list.cjs.entry.js.map +1 -1
  16. package/dist/cjs/twilight.cjs.js +2 -2
  17. package/dist/collection/collection-manifest.json +1 -0
  18. package/dist/collection/components/salla-app-install-alert/salla-app-install-alert.css +3 -0
  19. package/dist/collection/components/salla-app-install-alert/salla-app-install-alert.js +89 -0
  20. package/dist/collection/components/salla-app-install-alert/salla-app-install-alert.js.map +1 -0
  21. package/dist/collection/components/salla-app-install-alert/test/salla-app-install-alert.e2e.js +13 -0
  22. package/dist/collection/components/salla-app-install-alert/test/salla-app-install-alert.e2e.js.map +1 -0
  23. package/dist/collection/components/salla-app-install-alert/test/salla-app-install-alert.spec.js +21 -0
  24. package/dist/collection/components/salla-app-install-alert/test/salla-app-install-alert.spec.js.map +1 -0
  25. package/dist/collection/components/salla-filters/interfaces.js +3 -2
  26. package/dist/collection/components/salla-filters/interfaces.js.map +1 -1
  27. package/dist/collection/components/salla-filters/salla-filters.js +4 -5
  28. package/dist/collection/components/salla-filters/salla-filters.js.map +1 -1
  29. package/dist/collection/components/salla-filters-widget/salla-filters-widget.js +8 -5
  30. package/dist/collection/components/salla-filters-widget/salla-filters-widget.js.map +1 -1
  31. package/dist/collection/components/salla-products-list/salla-products-list.js +22 -13
  32. package/dist/collection/components/salla-products-list/salla-products-list.js.map +1 -1
  33. package/dist/components/index.js +1 -1
  34. package/dist/components/index.js.map +1 -1
  35. package/dist/components/salla-app-install-alert.d.ts +11 -0
  36. package/dist/components/salla-app-install-alert.js +100 -0
  37. package/dist/components/salla-app-install-alert.js.map +1 -0
  38. package/dist/components/salla-filters-widget2.js +11 -7
  39. package/dist/components/salla-filters-widget2.js.map +1 -1
  40. package/dist/components/salla-filters.js +4 -5
  41. package/dist/components/salla-filters.js.map +1 -1
  42. package/dist/components/salla-products-list.js +22 -13
  43. package/dist/components/salla-products-list.js.map +1 -1
  44. package/dist/esm/{app-globals-3843d7b4.js → app-globals-efc9607d.js} +2 -2
  45. package/dist/esm/app-globals-efc9607d.js.map +1 -0
  46. package/dist/esm/index-e6c3f002.js +4 -0
  47. package/dist/esm/{interfaces-cb9e8802.js → interfaces-3159d022.js} +5 -4
  48. package/dist/esm/interfaces-3159d022.js.map +1 -0
  49. package/dist/esm/loader.js +2 -2
  50. package/dist/esm/salla-app-install-alert.entry.js +78 -0
  51. package/dist/esm/salla-app-install-alert.entry.js.map +1 -0
  52. package/dist/esm/salla-filters-widget.entry.js +8 -5
  53. package/dist/esm/salla-filters-widget.entry.js.map +1 -1
  54. package/dist/esm/salla-filters.entry.js +4 -5
  55. package/dist/esm/salla-filters.entry.js.map +1 -1
  56. package/dist/esm/salla-products-list.entry.js +22 -13
  57. package/dist/esm/salla-products-list.entry.js.map +1 -1
  58. package/dist/esm/twilight.js +2 -2
  59. package/dist/esm-es5/{app-globals-3843d7b4.js → app-globals-efc9607d.js} +3 -3
  60. package/dist/esm-es5/app-globals-efc9607d.js.map +1 -0
  61. package/dist/esm-es5/index-e6c3f002.js +1 -1
  62. package/dist/esm-es5/index-e6c3f002.js.map +1 -1
  63. package/dist/esm-es5/{interfaces-cb9e8802.js → interfaces-3159d022.js} +2 -2
  64. package/dist/esm-es5/interfaces-3159d022.js.map +1 -0
  65. package/dist/esm-es5/loader.js +1 -1
  66. package/dist/esm-es5/loader.js.map +1 -1
  67. package/dist/esm-es5/salla-app-install-alert.entry.js +5 -0
  68. package/dist/esm-es5/salla-app-install-alert.entry.js.map +1 -0
  69. package/dist/esm-es5/salla-filters-widget.entry.js +1 -1
  70. package/dist/esm-es5/salla-filters-widget.entry.js.map +1 -1
  71. package/dist/esm-es5/salla-filters.entry.js +1 -1
  72. package/dist/esm-es5/salla-filters.entry.js.map +1 -1
  73. package/dist/esm-es5/salla-products-list.entry.js +2 -2
  74. package/dist/esm-es5/salla-products-list.entry.js.map +1 -1
  75. package/dist/esm-es5/twilight.js +1 -1
  76. package/dist/esm-es5/twilight.js.map +1 -1
  77. package/dist/twilight/{p-75f5e4ac.system.js → p-14ba306c.system.js} +4 -4
  78. package/dist/twilight/p-14ba306c.system.js.map +1 -0
  79. package/dist/twilight/p-42bec37b.entry.js +5 -0
  80. package/dist/twilight/p-42bec37b.entry.js.map +1 -0
  81. package/dist/twilight/p-456195ae.system.js +5 -0
  82. package/dist/twilight/{p-2059b78a.system.js.map → p-456195ae.system.js.map} +1 -1
  83. package/dist/twilight/p-4b7f7e1b.entry.js +5 -0
  84. package/dist/twilight/p-4b7f7e1b.entry.js.map +1 -0
  85. package/dist/twilight/p-572e1989.system.entry.js +5 -0
  86. package/dist/twilight/p-572e1989.system.entry.js.map +1 -0
  87. package/dist/twilight/p-6900d691.system.entry.js +5 -0
  88. package/dist/twilight/p-6900d691.system.entry.js.map +1 -0
  89. package/dist/twilight/{p-61ac07f6.js → p-6cf5973f.js} +2 -2
  90. package/dist/twilight/p-6cf5973f.js.map +1 -0
  91. package/dist/twilight/p-82b08e0b.system.js +5 -0
  92. package/dist/twilight/p-82b08e0b.system.js.map +1 -0
  93. package/dist/twilight/p-88169663.entry.js +5 -0
  94. package/dist/twilight/p-88169663.entry.js.map +1 -0
  95. package/dist/twilight/p-9f54aa1e.system.entry.js +5 -0
  96. package/dist/twilight/p-9f54aa1e.system.entry.js.map +1 -0
  97. package/dist/twilight/p-c2c2f116.entry.js +5 -0
  98. package/dist/twilight/p-c2c2f116.entry.js.map +1 -0
  99. package/dist/twilight/p-e1a5fa10.system.entry.js +5 -0
  100. package/dist/twilight/p-e1a5fa10.system.entry.js.map +1 -0
  101. package/dist/twilight/{p-66395721.js → p-e6534d30.js} +3 -3
  102. package/dist/twilight/p-e6534d30.js.map +1 -0
  103. package/dist/twilight/twilight.esm.js +1 -1
  104. package/dist/twilight/twilight.esm.js.map +1 -1
  105. package/dist/twilight/twilight.js +1 -1
  106. package/dist/types/components/salla-app-install-alert/salla-app-install-alert.d.ts +22 -0
  107. package/dist/types/components/salla-filters/interfaces.d.ts +11 -11
  108. package/dist/types/components/salla-products-list/salla-products-list.d.ts +1 -0
  109. package/dist/types/components.d.ts +13 -0
  110. package/package.json +5 -5
  111. package/dist/cjs/app-globals-36ab7ecf.js.map +0 -1
  112. package/dist/cjs/interfaces-56469cd9.js.map +0 -1
  113. package/dist/esm/app-globals-3843d7b4.js.map +0 -1
  114. package/dist/esm/interfaces-cb9e8802.js.map +0 -1
  115. package/dist/esm-es5/app-globals-3843d7b4.js.map +0 -1
  116. package/dist/esm-es5/interfaces-cb9e8802.js.map +0 -1
  117. package/dist/twilight/p-2059b78a.system.js +0 -5
  118. package/dist/twilight/p-4de34318.entry.js +0 -5
  119. package/dist/twilight/p-4de34318.entry.js.map +0 -1
  120. package/dist/twilight/p-61ac07f6.js.map +0 -1
  121. package/dist/twilight/p-65b34312.system.entry.js +0 -5
  122. package/dist/twilight/p-65b34312.system.entry.js.map +0 -1
  123. package/dist/twilight/p-66395721.js.map +0 -1
  124. package/dist/twilight/p-75f5e4ac.system.js.map +0 -1
  125. package/dist/twilight/p-89c5b834.system.entry.js +0 -5
  126. package/dist/twilight/p-89c5b834.system.entry.js.map +0 -1
  127. package/dist/twilight/p-8f18fe08.system.js +0 -5
  128. package/dist/twilight/p-8f18fe08.system.js.map +0 -1
  129. package/dist/twilight/p-b095f117.system.entry.js +0 -5
  130. package/dist/twilight/p-b095f117.system.entry.js.map +0 -1
  131. package/dist/twilight/p-c868470b.entry.js +0 -5
  132. package/dist/twilight/p-c868470b.entry.js.map +0 -1
  133. package/dist/twilight/p-f5558708.entry.js +0 -5
  134. package/dist/twilight/p-f5558708.entry.js.map +0 -1
@@ -0,0 +1,5 @@
1
+ /*!
2
+ * Crafted with ❤ by Salla
3
+ */
4
+ import{r as s,c as t,h as i,H as e,g as h}from"./p-dd9b5ccb.js";import{H as l}from"./p-5ce4c61e.js";import{F as a}from"./p-6cf5973f.js";const n=":host{display:block}";const r=class{constructor(i){s(this,i);this.changed=t(this,"changed",7);this.initHeight=195;this.withLoadMore=undefined;this.filtersData=undefined;this.option=undefined;this.isOpen=true;this.isShowMore=false;this.showMoreLabel="عرض المزيد";this.showLessLabel="عرض أقل";this.page=salla.config.get("page")}connectedCallback(){this.withLoadMore=this.option.key!="price"&&Array.isArray(this.option.values)&&this.option.values.length>8;salla.onReady((()=>{this.page=salla.config.get("page")}));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 setWidgetHeight(s=250){this.widgetContent.removeAttribute("style");setTimeout((()=>{let s=this.widgetContent.offsetHeight;this.widgetContent.style.height=s+"px"}),s)}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.VARIANTS].includes(s.type)){return""}const t=[];const e=[];s.values.forEach(((h,l)=>{let a=typeof h=="number"?h:h.key||h.value;const n=this.page.slug=="product.index"&&Number(h.key)==this.page.id;const r=i("label",{class:"s-filters-label",htmlFor:`${s.key}-option-${l}`,style:{opacity:n?"0.6":"1"}},i("input",{id:`${s.key}-option-${l}`,name:n?"current-category":s.key,type:n?"checkbox":"radio",checked:n||this.isSelectedOption(s,a),disabled:n,class:`s-filters-${n?"checkbox":s.type}`,onChange:t=>!n?this.changed.emit({event:t,option:s,value:a}):null}),this.getOptionLabel(s,h));if(n){t.unshift(r)}else{e.push(r)}}));return t.concat(e)}isSelectedOption(s,t){if(!this.filtersData){return false}if(s.type===a.VARIANTS){return this.filtersData[s.type][s.key].includes(t)}return s.type===a.VALUES?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.option.label),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)}};r.style=n;export{r as salla_filters_widget};
5
+ //# sourceMappingURL=p-42bec37b.entry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["sallaFiltersWidgetCss","SallaFiltersWidget","this","initHeight","salla","config","get","connectedCallback","withLoadMore","option","key","Array","isArray","values","length","onReady","page","lang","onLoaded","showMoreLabel","getWithDefault","showLessLabel","componentDidLoad","widgetValues","scrollHeight","style","maxHeight","widgetContent","height","setWidgetHeight","delay","removeAttribute","setTimeout","currentWidgetHeight","offsetHeight","reset","type","FilterOptionTypes","RANGE","priceRange","from","host","querySelectorAll","forEach","input","checked","showMore","isShowMore","toggleWidget","isOpen","Helper","toggleElementClassIf","renderFilterOption","VALUES","VARIANTS","includes","disabledAndSelectedOption","otherOptions","filterOption","index","value","isDisabledAndSelected","slug","Number","id","label","h","class","htmlFor","opacity","name","isSelectedOption","disabled","onChange","e","changed","emit","event","getOptionLabel","unshift","push","concat","filtersData","size","render","Host","onClick","ref","el","onChanged","detail","price"],"sources":["src/components/salla-filters-widget/salla-filters-widget.scss?tag=salla-filters-widget","src/components/salla-filters-widget/salla-filters-widget.tsx"],"sourcesContent":[":host {\n display: block;\n}\n","import { Component, Host, h, Method, State, Prop, Event, Element } from '@stencil/core';\nimport Helper from '../../Helpers/Helper';\nimport { Filter, FilterOptionTypes } from \"../salla-filters/interfaces\";\n\n@Component({\n tag: 'salla-filters-widget',\n styleUrl: 'salla-filters-widget.scss',\n})\nexport class SallaFiltersWidget {\n @Element() host: HTMLElement;\n\n /**\n * Show more or less filter options.\n */\n @Prop({ mutable: true }) withLoadMore: boolean;\n\n /**\n * Selected filter options value.\n */\n @Prop({ reflect: true }) filtersData: object;\n\n /**\n * Filter option along with possible values.\n */\n @Prop({ reflect: true }) option: Filter;\n\n\n priceRange: HTMLSallaPriceRangeElement\n\n\n private widgetValues: HTMLElement;\n private widgetContent: HTMLDivElement;\n private initHeight: number = 195;\n\n @State() isOpen: boolean = true;\n @State() isShowMore: boolean = false;\n @State() showMoreLabel: string = \"عرض المزيد\";\n @State() showLessLabel: string = \"عرض أقل\";\n @State() page: any = salla.config.get('page');\n\n /**\n * Custom event emitted up on filter option selection changes.\n */\n @Event() changed: any;\n\n connectedCallback() {\n //lets be smart and don't show 5 and more link for 8 options\n this.withLoadMore = this.option.key != 'price' && Array.isArray(this.option.values) && this.option.values.length > 8;\n salla.onReady(() => {\n this.page = salla.config.get('page');\n })\n salla.lang.onLoaded(() => {\n this.showMoreLabel = salla.lang.getWithDefault('common.titles.more', this.showMoreLabel)\n this.showLessLabel = salla.lang.getWithDefault('common.elements.show_less', this.showLessLabel)\n })\n }\n\n componentDidLoad() {\n this.widgetValues.scrollHeight < this.initHeight && (this.withLoadMore = false);\n (this.withLoadMore && this.widgetValues) && (this.widgetValues.style.maxHeight = `${this.initHeight}px`);\n this.widgetContent.style.height = `${this.widgetContent.scrollHeight}px`;\n }\n\n @Method()\n async setWidgetHeight(delay = 250) {\n this.widgetContent.removeAttribute('style');\n setTimeout(() => {\n let currentWidgetHeight: number = this.widgetContent.offsetHeight;\n this.widgetContent.style.height = currentWidgetHeight + 'px';\n }, delay)\n }\n\n /**\n * Reset selected filter options.\n */\n @Method()\n async reset() {\n if (this.option.type === FilterOptionTypes.RANGE) {\n this.priceRange.reset()\n }\n Array.from(this.host.querySelectorAll('input')).forEach(input => input.checked = false);\n }\n\n\n /**\n * Action to show more or less filter options.\n */\n @Method()\n async showMore() {\n this.isShowMore = !this.isShowMore\n this.widgetContent.style.height = 'auto';\n this.widgetValues.style.maxHeight = this.isShowMore ? `${this.widgetValues.scrollHeight}px` : `${this.initHeight}px`;\n setTimeout(() => {\n this.widgetContent.style.height = `${this.widgetContent.scrollHeight}px`;\n }, 400); // get height after time of collapse animtion (duration-300)\n }\n\n /**\n * Action to toggle widget open or closed (expand/ collapse).\n */\n @Method()\n async toggleWidget() {\n this.isOpen = !this.isOpen;\n Helper.toggleElementClassIf(this.widgetContent, 's-filters-widget-opened', 's-filters-widget-closed', () => this.isOpen);\n }\n\n renderFilterOption(option: Filter) {\n if (![FilterOptionTypes.VALUES, FilterOptionTypes.VARIANTS].includes(option.type)) {\n return '';\n }\n \n const disabledAndSelectedOption = [];\n const otherOptions = [];\n \n option.values.forEach((filterOption, index) => {\n let value = typeof filterOption == 'number' ? filterOption : (filterOption.key || filterOption.value);\n \n const isDisabledAndSelected = this.page.slug == 'product.index' && Number(filterOption.key) == this.page.id;\n \n const label = (\n <label class=\"s-filters-label\" htmlFor={`${option.key}-option-${index}`} style={{\"opacity\" : isDisabledAndSelected ? \"0.6\" : \"1\"}}>\n <input\n id={`${option.key}-option-${index}`}\n name={isDisabledAndSelected ? \"current-category\" : option.key}\n type={isDisabledAndSelected ? \"checkbox\" : 'radio'}\n checked={isDisabledAndSelected || this.isSelectedOption(option, value)}\n disabled={isDisabledAndSelected}\n class={`s-filters-${isDisabledAndSelected ? \"checkbox\" : option.type}`}\n onChange={e => !isDisabledAndSelected ? this.changed.emit({ event: e, option: option, value: value }) : null}\n />\n {this.getOptionLabel(option, filterOption)}\n </label>\n );\n \n if (isDisabledAndSelected) {\n disabledAndSelectedOption.unshift(label); // Add to the beginning of the disabledAndSelectedOption array\n } else {\n otherOptions.push(label); // Add to the end of the otherOptions array\n }\n });\n \n return disabledAndSelectedOption.concat(otherOptions);\n }\n \n \n \n\n private isSelectedOption(option: Filter, value) {\n\n \n if (!this.filtersData) {\n return false\n }\n \n if(option.type === FilterOptionTypes.VARIANTS){\n return this.filtersData[option.type][option.key].includes(value)\n }\n\n return option.type === FilterOptionTypes.VALUES\n ? this.filtersData[option.key].includes(value)\n : this.filtersData[option.key] == value;\n }\n\n private getOptionLabel(option: Filter, filterOption) {\n if (option.key == 'rating') {\n //in amazon has stars & up, should we add it, to avoid those people who will come to say I selected 4 why I see 5 sars products\n return <salla-rating-stars size=\"small\" value={filterOption} />;\n }\n let label = filterOption.value || 'null';\n //label+=filterOption.count ? ` (${salla.helpers.number(filterOption.count)})` : '';\n return <span class=\"s-filters-option-name\">{label}</span>;\n }\n\n render() {\n return (\n <Host class=\"s-filters-widget-container\">\n <h3 class=\"s-filters-widget-title\" onClick={() => this.toggleWidget()}>\n <span>{this.option.label}</span>\n <span class={`s-filters-widget-plusminus ${this.isOpen ? 's-filters-widget-plusminus-active' : ''}`} />\n </h3>\n <div class=\"s-filters-widget-content\" ref={(el) => this.widgetContent = el}>\n <div class=\"s-filters-widget-values\" ref={(el) => this.widgetValues = el}>\n <slot />\n {\n this.option.type !== FilterOptionTypes.RANGE\n ? this.renderFilterOption(this.option)\n : <salla-price-range onChanged={(event) => this.changed.emit(event.detail)}\n ref={price => this.priceRange = price}\n filtersData={this.filtersData}\n option={this.option} />\n }\n </div>\n {this.withLoadMore &&\n <a class=\"s-filters-widget-more\"\n onClick={() => this.showMore()}>{!this.isShowMore ? this.showMoreLabel : this.showLessLabel}</a>\n }\n </div>\n </Host>\n );\n }\n\n}\n"],"mappings":";;;wIAAA,MAAMA,EAAwB,uB,MCQjBC,EAAkB,M,0DAwBrBC,KAAAC,WAAqB,I,yFAEF,K,gBACI,M,mBACE,a,mBACA,U,UACZC,MAAMC,OAAOC,IAAI,O,CAOtC,iBAAAC,GAEEL,KAAKM,aAAeN,KAAKO,OAAOC,KAAO,SAAWC,MAAMC,QAAQV,KAAKO,OAAOI,SAAWX,KAAKO,OAAOI,OAAOC,OAAS,EACnHV,MAAMW,SAAQ,KACZb,KAAKc,KAAOZ,MAAMC,OAAOC,IAAI,OAAO,IAEtCF,MAAMa,KAAKC,UAAS,KAClBhB,KAAKiB,cAAgBf,MAAMa,KAAKG,eAAe,qBAAsBlB,KAAKiB,eAC1EjB,KAAKmB,cAAgBjB,MAAMa,KAAKG,eAAe,4BAA6BlB,KAAKmB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QAAMC,MAAM,yBAAyBF,E,CAG9C,MAAAmB,GACE,OACElB,EAACmB,EAAI,CAAClB,MAAM,8BACVD,EAAA,MAAIC,MAAM,yBAAyBmB,QAAS,IAAMpF,KAAK8C,gBACrDkB,EAAA,YAAOhE,KAAKO,OAAOwD,OACnBC,EAAA,QAAMC,MAAO,8BAA8BjE,KAAK+C,OAAS,oCAAsC,QAEjGiB,EAAA,OAAKC,MAAM,2BAA2BoB,IAAMC,GAAOtF,KAAKyB,cAAgB6D,GACtEtB,EAAA,OAAKC,MAAM,0BAA0BoB,IAAMC,GAAOtF,KAAKqB,aAAeiE,GACpEtB,EAAA,aAEEhE,KAAKO,OAAO2B,OAASC,EAAkBC,MACnCpC,KAAKkD,mBAAmBlD,KAAKO,QAC7ByD,EAAA,qBAAmBuB,UAAYZ,GAAU3E,KAAKyE,QAAQC,KAAKC,EAAMa,QACjEH,IAAKI,GAASzF,KAAKqC,WAAaoD,EAChCT,YAAahF,KAAKgF,YAClBzE,OAAQP,KAAKO,UAGpBP,KAAKM,cACJ0D,EAAA,KAAGC,MAAM,wBACPmB,QAAS,IAAMpF,KAAK4C,aAAc5C,KAAK6C,WAAa7C,KAAKiB,cAAgBjB,KAAKmB,gB"}
@@ -0,0 +1,5 @@
1
+ /*!
2
+ * Crafted with ❤ by Salla
3
+ */
4
+ System.register(["./p-548cb28d.system.js","./p-14ba306c.system.js","./p-9beb6b7b.system.js"],(function(e,t){"use strict";var a,o,l;return{setters:[function(t){a=t.p;o=t.b;e("setNonce",t.s)},function(e){l=e.g},function(){}],execute:function(){var e=function(){var e=t.meta.url;var o={};if(e!==""){o.resourcesUrl=new URL(".",e).href}return a(o)};e().then((function(e){l();return o(JSON.parse('[["p-676a92f9.system",[[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],"sliderConfig":[520,"slider-config"],"productCardComponent":[1,"product-card-component"],"productsData":[32],"isReady":[32],"sourceValueIsValid":[32],"hasCustomComponent":[32],"apiUrl":[32],"parsedSourceValue":[32]}]]],["p-33d51337.system",[[0,"salla-product-options",{"productId":[2,"product-id"],"options":[1],"optionsData":[32],"outOfStockText":[32],"donationAmount":[32],"selectDonationAmount":[32],"selectAmount":[32],"isCustomDonation":[32],"selectedOptions":[32],"canDisabled":[32],"selectedSkus":[32],"selectedOutSkus":[32],"getSelectedOptionsData":[64],"reportValidity":[64],"hasOutOfStockOption":[64],"getSelectedOptions":[64],"getOption":[64]}]]],["p-9f54aa1e.system",[[0,"salla-filters",{"filters":[1040],"isSidebarOpen":[32],"filtersData":[32],"apply":[32],"reset":[32],"getFilters":[64],"applyFilters":[64],"resetFilters":[64]}]]],["p-259fa86e.system",[[0,"salla-notifications",{"loadMoreText":[1,"load-more-text"],"itemPerPage":[2,"item-per-page"],"notifications":[32],"pagination":[32],"hasInfiniteScroll":[32],"total":[32],"showPlaceholder":[32],"nextPage":[32],"no_notifications_trans":[32],"load_more_text_trans":[32]}]]],["p-1868754d.system",[[0,"salla-advertisement",{"position":[32],"advertisements":[32],"advertIcon":[32],"currentSlug":[32]}]]],["p-6900d691.system",[[0,"salla-app-install-alert",{"data":[32],"ctaLink":[32],"open":[32],"closing":[32]}]]],["p-8241fdbe.system",[[0,"salla-apps-icons",{"hideTitle":[4,"hide-title"],"appsTitle":[1,"apps-title"],"vertical":[4],"apps":[32]}]]],["p-0a6b09fa.system",[[0,"salla-contacts",{"contactsTitle":[1,"contacts-title"],"hideTitle":[4,"hide-title"],"isHeader":[4,"is-header"],"horizontal":[4],"iconsOnly":[4,"icons-only"],"contacts":[32],"iconsList":[32]}]]],["p-e97e300b.system",[[0,"salla-installment",{"price":[1],"language":[1],"currency":[1],"tamaraIsActive":[32],"tabbyIsActive":[32],"spotiiIsActive":[32]}]]],["p-6b22ed0e.system",[[0,"salla-loyalty-prize-item",{"item":[16]}]]],["p-390ad22a.system",[[0,"salla-payments",{"withSbc":[4,"with-sbc"],"sbcId":[1,"sbc-id"],"withMadeInKsa":[4,"with-made-in-ksa"],"payments":[32],"placeholderImage":[32]}]]],["p-e1a5fa10.system",[[0,"salla-products-list",{"source":[1537],"sourceValue":[1032,"source-value"],"limit":[1026],"sortBy":[1025,"sort-by"],"filtersResults":[1540,"filters-results"],"horizontalCards":[516,"horizontal-cards"],"autoload":[1028],"loadMoreText":[1,"load-more-text"],"productCardComponent":[1,"product-card-component"],"page":[32],"nextPage":[32],"hasInfiniteScroll":[32],"hasCustomComponent":[32],"sourceValueIsValid":[32],"placeholderText":[32],"endOfText":[32],"failedLoadMore":[32],"isReady":[32],"showPlaceholder":[32],"parsedFilters":[32],"setFilters":[64],"reload":[64]}]]],["p-bf4cc420.system",[[0,"salla-social",{"links":[32],"iconsList":[32]}]]],["p-06d0f1fc.system",[[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],"typing":[32],"debounce":[32],"reset":[64]}]]],["p-572e1989.system",[[4,"salla-filters-widget",{"withLoadMore":[1028,"with-load-more"],"filtersData":[16],"option":[16],"isOpen":[32],"isShowMore":[32],"showMoreLabel":[32],"showLessLabel":[32],"page":[32],"setWidgetHeight":[64],"reset":[64],"showMore":[64],"toggleWidget":[64]}]]],["p-025d4f2d.system",[[4,"salla-conditional-fields",null,[[0,"change","changeHandler"]]]]],["p-9a7f3e65.system",[[0,"salla-notification-item",{"notification":[16]}]]],["p-d28aa599.system",[[4,"salla-gifting",{"productId":[2,"product-id"],"widgetTitle":[1,"widget-title"],"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]}],[0,"salla-menu",{"source":[1],"sourceValue":[1,"source-value"],"topnav":[4],"useReactLink":[4,"use-react-link"],"menus":[32],"hasCustomComponent":[32],"setMenuContent":[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"],"inline":[516],"withoutReload":[4,"without-reload"],"currentTabName":[32],"regType":[32],"translationLoaded":[32],"currentPhone":[32],"currentEmail":[32],"title":[32],"emailErrorMsg":[32],"firstNameErrorMsg":[32],"lastNameErrorMsg":[32],"hasError":[32],"errorMessage":[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-bottom-alert",{"type":[513],"icon":[513],"message":[513],"actionUrl":[513,"action-url"],"actionLabel":[513,"action-label"],"storeId":[32],"template":[32],"loading":[32],"templateData":[32],"defaultMessage":[32],"defaultActionLabel":[32],"storeFeatures":[32],"storeDetails":[32],"storePrice":[32],"theDeveloper":[32],"templateInformation":[32],"buyTheTemplate":[32],"isRtl":[32]}],[0,"salla-comments",{"itemId":[2,"item-id"],"loadMoreText":[1,"load-more-text"],"hideForm":[4,"hide-form"],"type":[1],"comments":[32],"pagination":[32],"total":[32],"showPlaceholder":[32],"nextPage":[32],"noComments":[32],"comment_title":[32],"comment_name":[32],"placeholder_text":[32]}],[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-profile",{"customFields":[1,"custom-fields"],"userData":[32],"userDefinedFields":[32],"disableAction":[32],"first_name_trans":[32],"last_name_trans":[32],"birthday_trans":[32],"birthday_placeholder_trans":[32],"gender_trans":[32],"gender_placeholder_trans":[32],"male_trans":[32],"female_trans":[32],"email_trans":[32],"mobile_trans":[32],"save_btn_trans":[32],"drag_and_drop_trans":[32],"browse_trans":[32],"email_required_trans":[32],"invalid_email_trans":[32],"setCustomFields":[64]}],[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],"maxWords":[2,"max-words"],"showAction":[4,"show-action"],"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],"refresh":[64]}],[0,"salla-breadcrumb",{"items":[1],"breadcrumbs":[32],"currentPage":[32],"isRtl":[32]}],[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],"loadMoreText":[1,"load-more-text"],"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-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],"hasError":[32],"errorMessage":[32],"isProfileVerify":[32],"getCode":[64],"open":[64]}],[0,"salla-comment-form",{"type":[1537],"showAvatar":[4,"show-avatar"],"itemId":[1544,"item-id"],"placeholder":[32],"submitText":[32],"canComment":[32]}],[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-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]}],[0,"salla-comment-item",{"comment":[16],"has_bought_trans":[32],"rated_trans":[32],"waiting_approval_trans":[32],"has_order_trans":[32]}],[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"]]],[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]}],[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"],"cartId":[1025,"cart-id"],"amount":[1538],"currency":[1025],"options":[16],"isRequireShipping":[1028,"is-require-shipping"],"applePayOnly":[1028,"apple-pay-only"],"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]}],[4,"salla-list-tile",{"href":[1],"target":[1]}],[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-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],"windowWidth":[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]}],[0,"salla-skeleton",{"type":[1],"width":[1],"height":[1]}],[4,"salla-placeholder",{"icon":[1],"alignment":[1],"iconSize":[1,"icon-size"],"translationLoaded":[32]}],[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],"type":[513],"load":[64],"stop":[64],"setText":[64],"disable":[64],"enable":[64]}]]]]'),e)}))}}}));
5
+ //# sourceMappingURL=p-456195ae.system.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["patchBrowser","importMeta","module","meta","url","opts","resourcesUrl","URL","href","promiseResolve","then","options","globalScripts","bootstrapLazy","JSON","parse"],"sources":["../../node_modules/.pnpm/@stencil+core@4.2.0/node_modules/@stencil/core/internal/client/patch-browser.js","@lazy-browser-entrypoint?app-data=conditional"],"sourcesContent":["/*\n Stencil Client Patch Browser v4.2.0 | MIT Licensed | https://stenciljs.com\n */\nimport { BUILD, NAMESPACE } from '@stencil/core/internal/app-data';\nimport { consoleDevInfo, doc, promiseResolve, H } from '@stencil/core';\nconst patchBrowser = () => {\n // NOTE!! This fn cannot use async/await!\n if (BUILD.isDev && !BUILD.isTesting) {\n consoleDevInfo('Running in development mode.');\n }\n if (BUILD.cloneNodeFix) {\n // opted-in to polyfill cloneNode() for slot polyfilled components\n patchCloneNodeFix(H.prototype);\n }\n if (BUILD.profile && !performance.mark) {\n // not all browsers support performance.mark/measure (Safari 10)\n // because the mark/measure APIs are designed to write entries to a buffer in the browser that does not exist,\n // simply stub the implementations out.\n // TODO(STENCIL-323): Remove this patch when support for older browsers is removed (breaking)\n // @ts-ignore\n performance.mark = performance.measure = () => {\n /*noop*/\n };\n performance.getEntriesByName = () => [];\n }\n // @ts-ignore\n const scriptElm = BUILD.scriptDataOpts\n ? Array.from(doc.querySelectorAll('script')).find((s) => new RegExp(`\\/${NAMESPACE}(\\\\.esm)?\\\\.js($|\\\\?|#)`).test(s.src) ||\n s.getAttribute('data-stencil-namespace') === NAMESPACE)\n : null;\n const importMeta = import.meta.url;\n const opts = BUILD.scriptDataOpts ? (scriptElm || {})['data-opts'] || {} : {};\n if (importMeta !== '') {\n opts.resourcesUrl = new URL('.', importMeta).href;\n }\n return promiseResolve(opts);\n};\nconst patchCloneNodeFix = (HTMLElementPrototype) => {\n const nativeCloneNodeFn = HTMLElementPrototype.cloneNode;\n HTMLElementPrototype.cloneNode = function (deep) {\n if (this.nodeName === 'TEMPLATE') {\n return nativeCloneNodeFn.call(this, deep);\n }\n const clonedNode = nativeCloneNodeFn.call(this, false);\n const srcChildNodes = this.childNodes;\n if (deep) {\n for (let i = 0; i < srcChildNodes.length; i++) {\n // Node.ATTRIBUTE_NODE === 2, and checking because IE11\n if (srcChildNodes[i].nodeType !== 2) {\n clonedNode.appendChild(srcChildNodes[i].cloneNode(true));\n }\n }\n }\n return clonedNode;\n };\n};\nexport { patchBrowser };\n","export { setNonce } from '@stencil/core';\nimport { bootstrapLazy } from '@stencil/core';\nimport { patchBrowser } from '@stencil/core/internal/client/patch-browser';\nimport { globalScripts } from '@stencil/core/internal/app-globals';\npatchBrowser().then(options => {\n globalScripts();\n return bootstrapLazy([/*!__STENCIL_LAZY_DATA__*/], options);\n});\n"],"mappings":";;;kPAKA,IAAMA,EAAe,WAyBjB,IAAMC,EAAaC,EAAAC,KAAAC,IACnB,IAAMC,EAAqE,GAC3E,GAAIJ,IAAe,GAAI,CACnBI,EAAKC,aAAe,IAAIC,IAAI,IAAKN,GAAYO,I,CAEjD,OAAOC,EAAeJ,EAC1B,EChCAL,IAAeU,MAAK,SAAAC,GAClBC,IACA,OAAOC,EAAcC,KAAAC,MAAA,gymBAAuCJ,EAC9D,G"}
1
+ {"version":3,"names":["patchBrowser","importMeta","module","meta","url","opts","resourcesUrl","URL","href","promiseResolve","then","options","globalScripts","bootstrapLazy","JSON","parse"],"sources":["../../node_modules/.pnpm/@stencil+core@4.2.0/node_modules/@stencil/core/internal/client/patch-browser.js","@lazy-browser-entrypoint?app-data=conditional"],"sourcesContent":["/*\n Stencil Client Patch Browser v4.2.0 | MIT Licensed | https://stenciljs.com\n */\nimport { BUILD, NAMESPACE } from '@stencil/core/internal/app-data';\nimport { consoleDevInfo, doc, promiseResolve, H } from '@stencil/core';\nconst patchBrowser = () => {\n // NOTE!! This fn cannot use async/await!\n if (BUILD.isDev && !BUILD.isTesting) {\n consoleDevInfo('Running in development mode.');\n }\n if (BUILD.cloneNodeFix) {\n // opted-in to polyfill cloneNode() for slot polyfilled components\n patchCloneNodeFix(H.prototype);\n }\n if (BUILD.profile && !performance.mark) {\n // not all browsers support performance.mark/measure (Safari 10)\n // because the mark/measure APIs are designed to write entries to a buffer in the browser that does not exist,\n // simply stub the implementations out.\n // TODO(STENCIL-323): Remove this patch when support for older browsers is removed (breaking)\n // @ts-ignore\n performance.mark = performance.measure = () => {\n /*noop*/\n };\n performance.getEntriesByName = () => [];\n }\n // @ts-ignore\n const scriptElm = BUILD.scriptDataOpts\n ? Array.from(doc.querySelectorAll('script')).find((s) => new RegExp(`\\/${NAMESPACE}(\\\\.esm)?\\\\.js($|\\\\?|#)`).test(s.src) ||\n s.getAttribute('data-stencil-namespace') === NAMESPACE)\n : null;\n const importMeta = import.meta.url;\n const opts = BUILD.scriptDataOpts ? (scriptElm || {})['data-opts'] || {} : {};\n if (importMeta !== '') {\n opts.resourcesUrl = new URL('.', importMeta).href;\n }\n return promiseResolve(opts);\n};\nconst patchCloneNodeFix = (HTMLElementPrototype) => {\n const nativeCloneNodeFn = HTMLElementPrototype.cloneNode;\n HTMLElementPrototype.cloneNode = function (deep) {\n if (this.nodeName === 'TEMPLATE') {\n return nativeCloneNodeFn.call(this, deep);\n }\n const clonedNode = nativeCloneNodeFn.call(this, false);\n const srcChildNodes = this.childNodes;\n if (deep) {\n for (let i = 0; i < srcChildNodes.length; i++) {\n // Node.ATTRIBUTE_NODE === 2, and checking because IE11\n if (srcChildNodes[i].nodeType !== 2) {\n clonedNode.appendChild(srcChildNodes[i].cloneNode(true));\n }\n }\n }\n return clonedNode;\n };\n};\nexport { patchBrowser };\n","export { setNonce } from '@stencil/core';\nimport { bootstrapLazy } from '@stencil/core';\nimport { patchBrowser } from '@stencil/core/internal/client/patch-browser';\nimport { globalScripts } from '@stencil/core/internal/app-globals';\npatchBrowser().then(options => {\n globalScripts();\n return bootstrapLazy([/*!__STENCIL_LAZY_DATA__*/], options);\n});\n"],"mappings":";;;kPAKA,IAAMA,EAAe,WAyBjB,IAAMC,EAAaC,EAAAC,KAAAC,IACnB,IAAMC,EAAqE,GAC3E,GAAIJ,IAAe,GAAI,CACnBI,EAAKC,aAAe,IAAIC,IAAI,IAAKN,GAAYO,I,CAEjD,OAAOC,EAAeJ,EAC1B,EChCAL,IAAeU,MAAK,SAAAC,GAClBC,IACA,OAAOC,EAAcC,KAAAC,MAAA,84mBAAuCJ,EAC9D,G"}
@@ -0,0 +1,5 @@
1
+ /*!
2
+ * Crafted with ❤ by Salla
3
+ */
4
+ import{r as t,c as s,h as i,H as e,g as l}from"./p-dd9b5ccb.js";import{a as r}from"./p-5a803ecc.js";import{H as n}from"./p-5ce4c61e.js";const a=`\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`;const o="";const h=class{constructor(i){t(this,i);this.productsFetched=s(this,"productsFetched",7);this.source=undefined;this.sourceValue=undefined;this.limit=undefined;this.sortBy=undefined;this.filtersResults=undefined;this.horizontalCards=undefined;this.autoload=false;this.loadMoreText=undefined;this.productCardComponent="custom-salla-product-card";this.page=1;this.nextPage=undefined;this.hasInfiniteScroll=undefined;this.hasCustomComponent=undefined;this.sourceValueIsValid=undefined;this.placeholderText=salla.lang.get("pages.categories.no_products");this.endOfText=salla.lang.get("common.elements.end_of_content");this.failedLoadMore=salla.lang.get("common.elements.failed_to_load_more");this.isReady=undefined;this.showPlaceholder=undefined;this.parsedFilters=undefined;salla.lang.onLoaded((()=>{this.placeholderText=salla.lang.get("pages.categories.no_products");this.endOfText=salla.lang.get("common.elements.end_of_content");this.failedLoadMore=salla.lang.get("common.elements.failed_to_load_more")}))}connectedCallback(){salla.event.on("salla-filters::changed",(t=>this.setFilters(t)))}async setFilters(t){if(!!t&&JSON.stringify(this.parsedFilters)===JSON.stringify(t)){return}window.scrollTo({top:0,behavior:"smooth"});this.parsedFilters=t;return this.reload()}async reload(){!this.autoload&&this.loadMoreWrapper&&(this.loadMoreWrapper.style.display="none");this.hasInfiniteScroll&&salla.infiniteScroll.destroy(this.infiniteScroll);this.buildNextPageUrl();this.wrapper.innerHTML="";if(this.hasInfiniteScroll){this.init()}else{this.getInitialData()}}isFilterable(){return salla.config.get("store.settings.product.filters")&&this.filtersResults}isSourceWithoutValue(){return["offers","latest","sales"].includes(this.getSource())}animateItems(){r({targets:"salla-products-list salla-product-card",opacity:[0,1],duration:1200,translateY:[20,0],delay:function(t,s){return s*100}})}initBaseNextPageUrl(t){this.nextPage=salla.url.api(`products?source=${t}`);if(this.limit){this.nextPage+=`&per_page=${this.limit>32?32:this.limit}`}if(this.sortBy){this.nextPage+=`&sort=${this.sortBy}`}this.nextPage+="&filterable=1";for(const[t,s]of Object.entries(this.parsedFilters||{})){if(["string","number"].includes(typeof s)){this.nextPage+=`&filters[${encodeURIComponent(t)}]=${encodeURIComponent(s)}`}else if(Array.isArray(s)){s.forEach((s=>this.nextPage+=`&filters[${encodeURIComponent(t)}][]=${encodeURIComponent(s)}`))}else if(typeof s==="object"){for(const[i,e]of Object.entries(s)){this.nextPage+=`&filters[${encodeURIComponent(t)}][${encodeURIComponent(i)}]=${encodeURIComponent(e)}`}}}}buildNextPageUrl(){let 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=${this.getSourceValue()}`;return}try{this.nextPage+=`&source_value[]=${this.getSourceValue().join("&source_value[]=")}`}catch(s){salla.logger.warn(`source-value prop should be array of ids ex source-value="[1,2,3]" for the source [${t}]`);this.sourceValueIsValid=false}}loading(t=true,s=false){if(!t){if(!this.autoload){this.btnLoader&&(this.btnLoader.style.display="none")}this.loader&&(this.loader.style.display="none")}else{let t=s&&!this.autoload?this.btnLoader:this.loader;t&&(t.style.display="inherit")}}getItemHTML(t){this.getSource()==="landing-page"&&(t.url="");const s=this.hasCustomComponent?this.productCardComponent:"salla-product-card";const i=document.createElement(s);i.product=t;this.applyLandingPageStyles(i);this.applyHorizontalCardStyles(i);return i}applyLandingPageStyles(t){if(this.getSource()==="landing-page"&&!this.hasCustomComponent){t.toggleAttribute("hide-add-btn",true);t.classList.add("s-product-card-fit-height")}}applyHorizontalCardStyles(t){if(!this.horizontalCards){return}t.setAttribute("horizontal",true);if(!this.hasCustomComponent){t.setAttribute("shadow-on-hover",true)}}getSource(){return n.getProductsSource(this.source)}getSourceValue(){return n.getProductsSourceValue(this.source,this.sourceValue)}appendDataLayer(t){const s=document.createElement("script");let i={event:"impressions",ecommerce:{currencyCode:salla.config.get("user.currency_code"),impressions:t.map((t=>({id:t.id,name:t.name,price:t.price,brand:"",quantity:t.quantity,variant:"",categories:[{name:salla.config.get("page.title"),id:salla.config.get("page.id")}],category:salla.config.get("page.title")}))),page:{pageName:salla.config.get("page.slug"),mobileApp:0,referrer:document.referrer,theme:salla.config.get("theme.name")}}};s.appendChild(document.createTextNode("window.dataLayer = window.dataLayer || [];"));s.appendChild(document.createTextNode("window.dataLayer.push("+JSON.stringify(i)+");"));document.head.appendChild(s)}initiateInfiniteScroll(){var t,s,i;if(!this.hasInfiniteScroll){return}this.infiniteScroll=salla.infiniteScroll.initiate(this.wrapper,this.wrapper,{path:()=>this.nextPage,history:false,nextPage:this.nextPage,scrollThreshold:this.autoload?100:false,loadOnScroll:this.autoload},true);(t=this.infiniteScroll)===null||t===void 0?void 0:t.on("request",(()=>{this.loading(true,this.autoload?false:true)}));(s=this.infiniteScroll)===null||s===void 0?void 0:s.on("load",(t=>{var s;if(!((s=t.data)===null||s===void 0?void 0:s.length)&&this.infiniteScroll.pageIndex==2){this.showPlaceholder=true;salla.infiniteScroll.destroy(this.infiniteScroll);this.loading(false);return}else{this.showPlaceholder=false}this.infiniteScroll.appendItems(this.handleResponse(t));if(this.infiniteScroll.pageIndex==2){if(!this.autoload&&this.nextPage){this.loadMoreWrapper.style.display="block"}this.animateItems()}}));(i=this.infiniteScroll)===null||i===void 0?void 0:i.on("error",(()=>{this.status.querySelector(".s-infinite-scroll-error").classList.remove("s-hidden");this.loading(false)}));salla.onReady((()=>salla.infiniteScroll.loadNextPage(this.infiniteScroll)))}async loadMore(){var t;(t=this.infiniteScroll)===null||t===void 0?void 0:t.loadNextPage()}componentWillLoad(){return n.onSallaReadyPromise((()=>{this.hasCustomComponent=!!customElements.get(this.productCardComponent);this.sourceValueIsValid=!!(this.getSourceValue()||this.isSourceWithoutValue());this.hasInfiniteScroll=!["json","selected","related","landing-page"].includes(this.getSource())&&!this.limit;try{let t=new URLSearchParams(window.location.search);this.sortBy=this.sortBy||t.get("sort")||t.get("by");let s={};t.forEach(((t,i)=>{const e=i.match(/^filters\[(\w+)\](\[(\w+)\])?$/);if(e){const i=e[1];const l=e[3];if(l){s[i]=s[i]||{};s[i][l]=t}else{s[i]=t}}}));this.parsedFilters=s}catch(t){salla.logger.warn("failed to get filters from url",t.message)}this.buildNextPageUrl();this.isReady=true;if(!this.sourceValueIsValid){salla.logger.warn(`source-value prop is required for source [${this.getSource()}]`);return}if(this.hasInfiniteScroll){return}if(this.getSource()==="json"){if(!this.getSourceValue().length){this.showPlaceholder=true;return}setTimeout((()=>{this.getSourceValue().map((t=>this.wrapper.append(this.getItemHTML(t))))}));return}if(this.getSource()==="selected"&&!this.getSourceValue().length){this.showPlaceholder=true;return}return this.getInitialData()}))}getInitialData(){this.loading();n.fetchProducts(this.getSource(),this.getSourceValue(),this.limit).then((t=>{if(!t.data.length){this.showPlaceholder=true;this.loading(false);return}setTimeout((()=>{this.handleResponse(t).forEach((t=>this.wrapper.append(t)))}),100)}))}canRender(){return this.sourceValueIsValid&&this.isReady}render(){if(!this.canRender()){return""}if(this.showPlaceholder){return i("div",{class:"s-products-list-placeholder"},i("span",{innerHTML:a}),i("p",null,this.placeholderText))}return i(e,{class:"s-products-list"},i("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:t=>this.wrapper=t}),i("div",{class:"s-infinite-scroll-status",ref:t=>this.status=t},i("p",{class:"s-infinite-scroll-last infinite-scroll-last s-hidden"},this.endOfText),i("p",{class:"s-infinite-scroll-error infinite-scroll-error s-hidden"},this.failedLoadMore)),i("div",{class:"s-products-list-loading-wrapper",style:{display:"none"},ref:t=>this.loader=t},i("span",{class:"s-button-loader s-button-loader-center s-infinite-scroll-btn-loader"})),this.hasInfiniteScroll&&this.nextPage&&!this.autoload?i("div",{class:"s-infinite-scroll-wrapper",style:{display:"none"},ref:t=>this.loadMoreWrapper=t},i("button",{onClick:()=>this.loadMore(),class:"s-infinite-scroll-btn s-button-btn s-button-primary"},i("span",{class:"s-button-text s-infinite-scroll-btn-text"},this.loadMoreText?this.loadMoreText:salla.lang.get("common.elements.load_more")),i("span",{class:"s-button-loader s-button-loader-center s-infinite-scroll-btn-loader",ref:t=>this.btnLoader=t,style:{display:"none"}}))):"")}componentDidLoad(){this.hasInfiniteScroll&&this.init()}init(){this.initiateInfiniteScroll();this.loading()}handleResponse(t){var s,i,e,l,r,a;let o=this.getSource();let h="";if(((s=t.cursor)===null||s===void 0?void 0:s.current)===1){h=n.getPageTitleForSource(o);try{if(this.getSource()==="search"){h=salla.lang.get("common.elements.search_about",{word:this.getSourceValue()})}else if(!h){let s=this.parsedFilters.category_id||this.getSourceValue()[0];h=((l=(e=(i=t.filters.find((t=>t.key=="category_id")))===null||i===void 0?void 0:i.values)===null||e===void 0?void 0:e.find((t=>t.key==s)))===null||l===void 0?void 0:l.value)||""}h+=(h?" - ":"")+salla.lang.choice("blocks.header.products_count",(r=t.data)===null||r===void 0?void 0:r.length);if(t.data.length===15){h=h.replace(t.data.length,salla.lang.get("common.elements.more_than")+" "+t.data.length)}t.title=h}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((t=>this.getItemHTML(t))))||[]}get host(){return l(this)}};h.style=o;export{h as salla_products_list};
5
+ //# sourceMappingURL=p-4b7f7e1b.entry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["sallaProductsListCss","SallaProductsList","constructor","hostRef","salla","lang","get","onLoaded","this","placeholderText","endOfText","failedLoadMore","connectedCallback","event","on","filters","setFilters","JSON","stringify","parsedFilters","window","scrollTo","top","behavior","reload","autoload","loadMoreWrapper","style","display","hasInfiniteScroll","infiniteScroll","destroy","buildNextPageUrl","wrapper","innerHTML","init","getInitialData","isFilterable","config","filtersResults","isSourceWithoutValue","includes","getSource","animateItems","anime","targets","opacity","duration","translateY","delay","_el","i","initBaseNextPageUrl","source","nextPage","url","api","limit","sortBy","key","value","Object","entries","encodeURIComponent","Array","isArray","forEach","item","k","v","getSourceValue","join","e","logger","warn","sourceValueIsValid","loading","isLoading","isBtn","btnLoader","loader","currentLoader","getItemHTML","product","customComponentTag","hasCustomComponent","productCardComponent","productCard","document","createElement","applyLandingPageStyles","applyHorizontalCardStyles","toggleAttribute","classList","add","horizontalCards","setAttribute","Helper","getProductsSource","getProductsSourceValue","sourceValue","appendDataLayer","data","scriptElement","dataLayer","ecommerce","currencyCode","impressions","map","id","name","price","brand","quantity","variant","categories","category","page","pageName","mobileApp","referrer","theme","appendChild","createTextNode","head","initiateInfiniteScroll","initiate","path","history","scrollThreshold","loadOnScroll","_a","_b","response","length","pageIndex","showPlaceholder","appendItems","handleResponse","_c","status","querySelector","remove","onReady","loadNextPage","loadMore","componentWillLoad","onSallaReadyPromise","customElements","searchParams","URLSearchParams","location","search","matches","match","filterName","nestedKey","message","isReady","setTimeout","append","fetchProducts","then","res","card","canRender","render","h","class","ShoppingBag","Host","ref","onClick","loadMoreText","componentDidLoad","title","cursor","current","getPageTitleForSource","word","catId","category_id","_d","find","filter","values","cat","choice","_e","replace","emit","productsFetched","next","option","_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 constructor() {\n salla.lang.onLoaded(() => {\n this.placeholderText = salla.lang.get('pages.categories.no_products');\n this.endOfText = salla.lang.get('common.elements.end_of_content');\n this.failedLoadMore = salla.lang.get('common.elements.failed_to_load_more');\n })\n }\n connectedCallback() {\n salla.event.on('salla-filters::changed', filters => this.setFilters(filters))\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 !this.autoload && this.loadMoreWrapper && (this.loadMoreWrapper.style.display = 'none');\n this.hasInfiniteScroll && 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 if (this.hasInfiniteScroll) {\n this.init();\n } else {\n this.getInitialData();\n }\n }\n\n\n private status: HTMLDivElement;\n private btnLoader: HTMLElement;\n private loader: HTMLElement;\n private loadMoreWrapper: HTMLElement;\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' | 'wishlist';\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 /**\n * Autoload next page when scroll\n */\n @Prop({ mutable: true }) autoload: boolean = false;\n\n /**\n * Load more text\n */\n @Prop() loadMoreText: string;\n\n /**\n * Custom Card Component for the Salla Products List.\n *\n * This component allows you to customize the appearance of individual product cards within a Salla Products List.\n *\n * @example\n * <salla-products-list product-card-component=\"my-custom-card-style1\" ...\n * <salla-products-list product-card-component=\"my-custom-card-style2\" ...\n */\n @Prop() productCardComponent: string = 'custom-salla-product-card';\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 = salla.lang.get('pages.categories.no_products');\n @State() endOfText: string = salla.lang.get('common.elements.end_of_content');\n @State() failedLoadMore: string = salla.lang.get('common.elements.failed_to_load_more');\n\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\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 // @ts-ignore\n this.nextPage += `&filters[${encodeURIComponent(key)}]=${encodeURIComponent(value)}`;\n } else if (Array.isArray(value)) {\n value.forEach(item => this.nextPage += `&filters[${encodeURIComponent(key)}][]=${encodeURIComponent(item)}`);\n } else if (typeof value === 'object') {\n for (const [k, v] of Object.entries(value)) {\n this.nextPage += `&filters[${encodeURIComponent(key)}][${encodeURIComponent(k)}]=${encodeURIComponent(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, isBtn = false) {\n if (!isLoading) {\n if (!this.autoload) {\n this.btnLoader && (this.btnLoader.style.display = 'none');\n }\n this.loader && (this.loader.style.display = 'none');\n } else {\n let currentLoader = isBtn && !this.autoload ? this.btnLoader : this.loader;\n currentLoader && (currentLoader.style.display = 'inherit');\n }\n }\n\n private getItemHTML(product) {\n //as a request they don't want to let the user to open the product details\n //todo:: find a better way to handle this request\n this.getSource() === 'landing-page' && (product.url = '');\n const customComponentTag = this.hasCustomComponent ? this.productCardComponent : 'salla-product-card';\n const productCard = document.createElement(customComponentTag) as HTMLSallaProductCardElement;\n\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 //@ts-ignore\n private appendDataLayer(data) {\n const scriptElement = document.createElement('script');\n let dataLayer = {\n \"event\": \"impressions\",\n \"ecommerce\": {\n \"currencyCode\": salla.config.get('user.currency_code'),\n // \"event_id\":\"\", // todo\n \"impressions\": data.map((product) => {\n return {\n \"id\": product.id,\n \"name\": product.name,\n \"price\": product.price,\n \"brand\": \"\",\n \"quantity\": product.quantity,\n \"variant\": \"\",\n \"categories\": [\n {\n \"name\": salla.config.get('page.title'),\n \"id\": salla.config.get('page.id')\n }\n ],\n \"category\": salla.config.get('page.title')\n }\n }),\n \"page\": {\n // \"fingerprint\":\"\", // todo\n \"pageName\": salla.config.get('page.slug'),\n \"mobileApp\": 0,\n \"referrer\": document.referrer,\n \"theme\": salla.config.get('theme.name')\n },\n }\n }\n scriptElement.appendChild(document.createTextNode('window.dataLayer = window.dataLayer || [];'));\n scriptElement.appendChild(document.createTextNode('window.dataLayer.push(' + JSON.stringify(dataLayer) + ');'));\n document.head.appendChild(scriptElement);\n }\n\n private initiateInfiniteScroll() {\n if (!this.hasInfiniteScroll) {\n return;\n }\n this.infiniteScroll = salla.infiniteScroll.initiate(this.wrapper, this.wrapper, {\n path: () => this.nextPage,\n history: false,\n nextPage: this.nextPage,\n scrollThreshold: this.autoload ? 100 : false,\n loadOnScroll: this.autoload,\n }, /* infinite via api*/true);\n this.infiniteScroll?.on('request', () => {\n this.loading(true, this.autoload ? false : true);\n })\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 //todo::test it more\n /*if (['categories', 'brands', 'tags', 'search', 'latest'].includes(this.getSource())) {\n this.appendDataLayer(response.data);\n }*/\n if (!this.autoload && this.nextPage) {\n this.loadMoreWrapper.style.display = 'block';\n }\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 async loadMore() {\n this.infiniteScroll?.loadNextPage();\n }\n\n componentWillLoad() {\n return Helper.onSallaReadyPromise(() => {\n this.hasCustomComponent = !!customElements.get(this.productCardComponent);\n this.sourceValueIsValid = !!(this.getSourceValue() || this.isSourceWithoutValue());\n this.hasInfiniteScroll = !['json', 'selected', 'related', 'landing-page'].includes(this.getSource()) && !this.limit;\n try {\n let searchParams = new URLSearchParams(window.location.search);\n this.sortBy = this.sortBy || searchParams.get('sort') || searchParams.get('by');\n let filters = {}\n searchParams.forEach((value, key) => {\n // Assuming the key is in the format filters[xxx]\n const matches = key.match(/^filters\\[(\\w+)\\](\\[(\\w+)\\])?$/);\n \n if (matches) {\n const filterName = matches[1]; // e.g. \"price\" for filters[price]\n const nestedKey = matches[3]; // e.g. \"min\" or \"max\" for filters[price][min] or filters[price][max]\n \n if (nestedKey) {\n // Handle nested object\n filters[filterName] = filters[filterName] || {};\n filters[filterName][nestedKey] = value;\n } else {\n // Handle regular key\n filters[filterName] = value;\n }\n }\n });\n this.parsedFilters = filters;\n } catch (e) {\n salla.logger.warn('failed to get filters from url', e.message);\n }\n this.buildNextPageUrl();\n\n this.isReady = true;\n\n if (!this.sourceValueIsValid) {\n salla.logger.warn(`source-value prop is required for source [${this.getSource()}]`);\n return;\n }\n if (this.hasInfiniteScroll) {\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 setTimeout(() => {\n this.getSourceValue().map(product => this.wrapper.append(this.getItemHTML(product)));\n });\n return;\n }\n\n // Handle selected source\n if (this.getSource() === 'selected' && !this.getSourceValue().length) {\n this.showPlaceholder = true;\n return;\n }\n\n return this.getInitialData();\n });\n }\n\n private getInitialData(){\n this.loading();\n Helper.fetchProducts(this.getSource(), this.getSourceValue(), this.limit).then(res => {\n if (!res.data.length) {\n this.showPlaceholder = true;\n this.loading(false);\n return;\n }\n setTimeout(() => {\n this.handleResponse(res).forEach(card => this.wrapper.append(card));\n }, 100);\n });\n }\n\n private canRender() {\n return this.sourceValueIsValid && this.isReady;\n }\n\n render() {\n if (!this.canRender()) {\n return '';\n }\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 <div class=\"s-infinite-scroll-status\" ref={status => this.status = status}>\n <p class=\"s-infinite-scroll-last infinite-scroll-last s-hidden\" >{this.endOfText}</p>\n <p class=\"s-infinite-scroll-error infinite-scroll-error s-hidden\">{this.failedLoadMore}</p>\n </div>\n\n <div class=\"s-products-list-loading-wrapper\" style={{ \"display\": \"none\" }} ref={loader => this.loader = loader}><span class=\"s-button-loader s-button-loader-center s-infinite-scroll-btn-loader\"></span></div>\n \n {this.hasInfiniteScroll && this.nextPage && !this.autoload ? (\n <div class=\"s-infinite-scroll-wrapper\" style={{ \"display\": \"none\" }} ref={loadMoreWrapper => this.loadMoreWrapper = loadMoreWrapper}>\n <button onClick={() => this.loadMore()} class=\"s-infinite-scroll-btn s-button-btn s-button-primary\">\n <span class=\"s-button-text s-infinite-scroll-btn-text\">{this.loadMoreText ? this.loadMoreText : salla.lang.get('common.elements.load_more')}</span>\n <span class=\"s-button-loader s-button-loader-center s-infinite-scroll-btn-loader\" ref={btnLoader => this.btnLoader = btnLoader} style={{ \"display\": \"none\" }}></span>\n </button>\n </div>\n ) : \"\"}\n </Host>\n );\n }\n\n componentDidLoad() {\n this.hasInfiniteScroll && 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 === 15) {\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":";;;81BAAA,MAAMA,EAAuB,G,MCQhBC,EAAiB,MAC5B,WAAAC,CAAAC,G,kOA6F6C,M,sDAgBN,4B,UAGf,E,kJAKWC,MAAMC,KAAKC,IAAI,gC,eACrBF,MAAMC,KAAKC,IAAI,kC,oBACVF,MAAMC,KAAKC,IAAI,uC,mFAtH/CF,MAAMC,KAAKE,UAAS,KAClBC,KAAKC,gBAAkBL,MAAMC,KAAKC,IAAI,gCACtCE,KAAKE,UAAYN,MAAMC,KAAKC,IAAI,kCAChCE,KAAKG,eAAiBP,MAAMC,KAAKC,IAAI,sCAAsC,G,CAG/E,iBAAAM,GACER,MAAMS,MAAMC,GAAG,0BAA0BC,GAAWP,KAAKQ,WAAWD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QAAQxD,EAAS/B,KAAKgC,OAAQlI,MAAMC,KAAKC,IAAI,6BAA+B,IAAM+H,EAAS/B,KAAKgC,O,CAEhHD,EAAS0C,MAAQA,C,CACjB,MAAOvG,GAAG,C,CAGdpE,MAAMS,MAAMiL,KAAK,wCAAyCzD,GAC1D7H,KAAKuL,gBAAgBD,KAAKzD,GAE1B,GAAIA,EAAStH,SAAWP,KAAK6B,eAAgB,CAC3C7B,KAAK+B,eAAiB,KACtBnC,MAAMS,MAAMiL,KAAK,mBAAoB,CAAE/K,QAASsH,EAAStH,S,MACpD,GAAIP,KAAK6B,eAAgB,CAC9BjC,MAAMS,MAAMiL,KAAK,kB,CAEnBtL,KAAK8C,SAAW+E,EAAS2C,OAAS3C,EAAS2C,OAAOgB,KAAOxL,KAAK8C,SAC9D9C,KAAKoE,QAAQ,OACb,GAAIpE,KAAKqB,oBAAsBrB,KAAK8C,SAAU,CAC5C9C,KAAKsB,eAAemK,OAAO,CAAEhE,gBAAiB,MAAOC,aAAc,QACnE1H,KAAKoI,OAAOC,cAAc,2BAA2BhD,UAAUiD,OAAO,W,CAExE,QAAOoD,EAAA7D,EAAS/B,QAAI,MAAA4F,SAAA,SAAAA,EAAEtF,KAAIzB,GAAW3E,KAAK0E,YAAYC,OAAa,E"}
@@ -0,0 +1,5 @@
1
+ var __awaiter=this&&this.__awaiter||function(t,e,i,n){function o(t){return t instanceof i?t:new i((function(e){e(t)}))}return new(i||(i=Promise))((function(i,s){function r(t){try{l(n.next(t))}catch(t){s(t)}}function a(t){try{l(n["throw"](t))}catch(t){s(t)}}function l(t){t.done?i(t.value):o(t.value).then(r,a)}l((n=n.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:[]},n,o,s,r;return r={next:a(0),throw:a(1),return:a(2)},typeof Symbol==="function"&&(r[Symbol.iterator]=function(){return this}),r;function a(t){return function(e){return l([t,e])}}function l(a){if(n)throw new TypeError("Generator is already executing.");while(r&&(r=0,a[0]&&(i=0)),i)try{if(n=1,o&&(s=a[0]&2?o["return"]:a[0]?o["throw"]||((s=o["return"])&&s.call(o),0):o.next)&&!(s=s.call(o,a[1])).done)return s;if(o=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++;o=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];o=0}finally{n=s=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}};
2
+ /*!
3
+ * Crafted with ❤ by Salla
4
+ */System.register(["./p-548cb28d.system.js","./p-0826088e.system.js","./p-82b08e0b.system.js"],(function(t){"use strict";var e,i,n,o,s,r,a;return{setters:[function(t){e=t.r;i=t.c;n=t.h;o=t.H;s=t.g},function(t){r=t.H},function(t){a=t.F}],execute:function(){var l=":host{display:block}";var u=t("salla_filters_widget",function(){function t(t){e(this,t);this.changed=i(this,"changed",7);this.initHeight=195;this.withLoadMore=undefined;this.filtersData=undefined;this.option=undefined;this.isOpen=true;this.isShowMore=false;this.showMoreLabel="عرض المزيد";this.showLessLabel="عرض أقل";this.page=salla.config.get("page")}t.prototype.connectedCallback=function(){var t=this;this.withLoadMore=this.option.key!="price"&&Array.isArray(this.option.values)&&this.option.values.length>8;salla.onReady((function(){t.page=salla.config.get("page")}));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.setWidgetHeight=function(t){if(t===void 0){t=250}return __awaiter(this,void 0,void 0,(function(){var e=this;return __generator(this,(function(i){this.widgetContent.removeAttribute("style");setTimeout((function(){var t=e.widgetContent.offsetHeight;e.widgetContent.style.height=t+"px"}),t);return[2]}))}))};t.prototype.reset=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){if(this.option.type===a.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;r.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(![a.VALUES,a.VARIANTS].includes(t.type)){return""}var i=[];var o=[];t.values.forEach((function(s,r){var a=typeof s=="number"?s:s.key||s.value;var l=e.page.slug=="product.index"&&Number(s.key)==e.page.id;var u=n("label",{class:"s-filters-label",htmlFor:"".concat(t.key,"-option-").concat(r),style:{opacity:l?"0.6":"1"}},n("input",{id:"".concat(t.key,"-option-").concat(r),name:l?"current-category":t.key,type:l?"checkbox":"radio",checked:l||e.isSelectedOption(t,a),disabled:l,class:"s-filters-".concat(l?"checkbox":t.type),onChange:function(i){return!l?e.changed.emit({event:i,option:t,value:a}):null}}),e.getOptionLabel(t,s));if(l){i.unshift(u)}else{o.push(u)}}));return i.concat(o)};t.prototype.isSelectedOption=function(t,e){if(!this.filtersData){return false}if(t.type===a.VARIANTS){return this.filtersData[t.type][t.key].includes(e)}return t.type===a.VALUES?this.filtersData[t.key].includes(e):this.filtersData[t.key]==e};t.prototype.getOptionLabel=function(t,e){if(t.key=="rating"){return n("salla-rating-stars",{size:"small",value:e})}var i=e.value||"null";return n("span",{class:"s-filters-option-name"},i)};t.prototype.render=function(){var t=this;return n(o,{class:"s-filters-widget-container"},n("h3",{class:"s-filters-widget-title",onClick:function(){return t.toggleWidget()}},n("span",null,this.option.label),n("span",{class:"s-filters-widget-plusminus ".concat(this.isOpen?"s-filters-widget-plusminus-active":"")})),n("div",{class:"s-filters-widget-content",ref:function(e){return t.widgetContent=e}},n("div",{class:"s-filters-widget-values",ref:function(e){return t.widgetValues=e}},n("slot",null),this.option.type!==a.RANGE?this.renderFilterOption(this.option):n("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&&n("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 s(this)},enumerable:false,configurable:true});return t}());u.style=l}}}));
5
+ //# sourceMappingURL=p-572e1989.system.entry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["sallaFiltersWidgetCss","SallaFiltersWidget","exports","this","initHeight","salla","config","get","class_1","prototype","connectedCallback","_this","withLoadMore","option","key","Array","isArray","values","length","onReady","page","lang","onLoaded","showMoreLabel","getWithDefault","showLessLabel","componentDidLoad","widgetValues","scrollHeight","style","maxHeight","concat","widgetContent","height","setWidgetHeight","delay","removeAttribute","setTimeout","currentWidgetHeight","offsetHeight","reset","type","FilterOptionTypes","RANGE","priceRange","from","host","querySelectorAll","forEach","input","checked","showMore","isShowMore","toggleWidget","isOpen","Helper","toggleElementClassIf","renderFilterOption","VALUES","VARIANTS","includes","disabledAndSelectedOption","otherOptions","filterOption","index","value","isDisabledAndSelected","slug","Number","id","label","h","class","htmlFor","opacity","name","isSelectedOption","disabled","onChange","e","changed","emit","event","getOptionLabel","unshift","push","filtersData","size","render","Host","onClick","ref","el","onChanged","detail","price"],"sources":["src/components/salla-filters-widget/salla-filters-widget.scss?tag=salla-filters-widget","src/components/salla-filters-widget/salla-filters-widget.tsx"],"sourcesContent":[":host {\n display: block;\n}\n","import { Component, Host, h, Method, State, Prop, Event, Element } from '@stencil/core';\nimport Helper from '../../Helpers/Helper';\nimport { Filter, FilterOptionTypes } from \"../salla-filters/interfaces\";\n\n@Component({\n tag: 'salla-filters-widget',\n styleUrl: 'salla-filters-widget.scss',\n})\nexport class SallaFiltersWidget {\n @Element() host: HTMLElement;\n\n /**\n * Show more or less filter options.\n */\n @Prop({ mutable: true }) withLoadMore: boolean;\n\n /**\n * Selected filter options value.\n */\n @Prop({ reflect: true }) filtersData: object;\n\n /**\n * Filter option along with possible values.\n */\n @Prop({ reflect: true }) option: Filter;\n\n\n priceRange: HTMLSallaPriceRangeElement\n\n\n private widgetValues: HTMLElement;\n private widgetContent: HTMLDivElement;\n private initHeight: number = 195;\n\n @State() isOpen: boolean = true;\n @State() isShowMore: boolean = false;\n @State() showMoreLabel: string = \"عرض المزيد\";\n @State() showLessLabel: string = \"عرض أقل\";\n @State() page: any = salla.config.get('page');\n\n /**\n * Custom event emitted up on filter option selection changes.\n */\n @Event() changed: any;\n\n connectedCallback() {\n //lets be smart and don't show 5 and more link for 8 options\n this.withLoadMore = this.option.key != 'price' && Array.isArray(this.option.values) && this.option.values.length > 8;\n salla.onReady(() => {\n this.page = salla.config.get('page');\n })\n salla.lang.onLoaded(() => {\n this.showMoreLabel = salla.lang.getWithDefault('common.titles.more', this.showMoreLabel)\n this.showLessLabel = salla.lang.getWithDefault('common.elements.show_less', this.showLessLabel)\n })\n }\n\n componentDidLoad() {\n this.widgetValues.scrollHeight < this.initHeight && (this.withLoadMore = false);\n (this.withLoadMore && this.widgetValues) && (this.widgetValues.style.maxHeight = `${this.initHeight}px`);\n this.widgetContent.style.height = `${this.widgetContent.scrollHeight}px`;\n }\n\n @Method()\n async setWidgetHeight(delay = 250) {\n this.widgetContent.removeAttribute('style');\n setTimeout(() => {\n let currentWidgetHeight: number = this.widgetContent.offsetHeight;\n this.widgetContent.style.height = currentWidgetHeight + 'px';\n }, delay)\n }\n\n /**\n * Reset selected filter options.\n */\n @Method()\n async reset() {\n if (this.option.type === FilterOptionTypes.RANGE) {\n this.priceRange.reset()\n }\n Array.from(this.host.querySelectorAll('input')).forEach(input => input.checked = false);\n }\n\n\n /**\n * Action to show more or less filter options.\n */\n @Method()\n async showMore() {\n this.isShowMore = !this.isShowMore\n this.widgetContent.style.height = 'auto';\n this.widgetValues.style.maxHeight = this.isShowMore ? `${this.widgetValues.scrollHeight}px` : `${this.initHeight}px`;\n setTimeout(() => {\n this.widgetContent.style.height = `${this.widgetContent.scrollHeight}px`;\n }, 400); // get height after time of collapse animtion (duration-300)\n }\n\n /**\n * Action to toggle widget open or closed (expand/ collapse).\n */\n @Method()\n async toggleWidget() {\n this.isOpen = !this.isOpen;\n Helper.toggleElementClassIf(this.widgetContent, 's-filters-widget-opened', 's-filters-widget-closed', () => this.isOpen);\n }\n\n renderFilterOption(option: Filter) {\n if (![FilterOptionTypes.VALUES, FilterOptionTypes.VARIANTS].includes(option.type)) {\n return '';\n }\n \n const disabledAndSelectedOption = [];\n const otherOptions = [];\n \n option.values.forEach((filterOption, index) => {\n let value = typeof filterOption == 'number' ? filterOption : (filterOption.key || filterOption.value);\n \n const isDisabledAndSelected = this.page.slug == 'product.index' && Number(filterOption.key) == this.page.id;\n \n const label = (\n <label class=\"s-filters-label\" htmlFor={`${option.key}-option-${index}`} style={{\"opacity\" : isDisabledAndSelected ? \"0.6\" : \"1\"}}>\n <input\n id={`${option.key}-option-${index}`}\n name={isDisabledAndSelected ? \"current-category\" : option.key}\n type={isDisabledAndSelected ? \"checkbox\" : 'radio'}\n checked={isDisabledAndSelected || this.isSelectedOption(option, value)}\n disabled={isDisabledAndSelected}\n class={`s-filters-${isDisabledAndSelected ? \"checkbox\" : option.type}`}\n onChange={e => !isDisabledAndSelected ? this.changed.emit({ event: e, option: option, value: value }) : null}\n />\n {this.getOptionLabel(option, filterOption)}\n </label>\n );\n \n if (isDisabledAndSelected) {\n disabledAndSelectedOption.unshift(label); // Add to the beginning of the disabledAndSelectedOption array\n } else {\n otherOptions.push(label); // Add to the end of the otherOptions array\n }\n });\n \n return disabledAndSelectedOption.concat(otherOptions);\n }\n \n \n \n\n private isSelectedOption(option: Filter, value) {\n\n \n if (!this.filtersData) {\n return false\n }\n \n if(option.type === FilterOptionTypes.VARIANTS){\n return this.filtersData[option.type][option.key].includes(value)\n }\n\n return option.type === FilterOptionTypes.VALUES\n ? this.filtersData[option.key].includes(value)\n : this.filtersData[option.key] == value;\n }\n\n private getOptionLabel(option: Filter, filterOption) {\n if (option.key == 'rating') {\n //in amazon has stars & up, should we add it, to avoid those people who will come to say I selected 4 why I see 5 sars products\n return <salla-rating-stars size=\"small\" value={filterOption} />;\n }\n let label = filterOption.value || 'null';\n //label+=filterOption.count ? ` (${salla.helpers.number(filterOption.count)})` : '';\n return <span class=\"s-filters-option-name\">{label}</span>;\n }\n\n render() {\n return (\n <Host class=\"s-filters-widget-container\">\n <h3 class=\"s-filters-widget-title\" onClick={() => this.toggleWidget()}>\n <span>{this.option.label}</span>\n <span class={`s-filters-widget-plusminus ${this.isOpen ? 's-filters-widget-plusminus-active' : ''}`} />\n </h3>\n <div class=\"s-filters-widget-content\" ref={(el) => this.widgetContent = el}>\n <div class=\"s-filters-widget-values\" ref={(el) => this.widgetValues = el}>\n <slot />\n {\n this.option.type !== FilterOptionTypes.RANGE\n ? this.renderFilterOption(this.option)\n : <salla-price-range onChanged={(event) => this.changed.emit(event.detail)}\n ref={price => this.priceRange = price}\n filtersData={this.filtersData}\n option={this.option} />\n }\n </div>\n {this.withLoadMore &&\n <a class=\"s-filters-widget-more\"\n onClick={() => this.showMore()}>{!this.isShowMore ? this.showMoreLabel : this.showLessLabel}</a>\n }\n </div>\n </Host>\n );\n }\n\n}\n"],"mappings":";;;iQAAA,IAAMA,EAAwB,uB,ICQjBC,EAAkBC,EAAA,kC,yDAwBrBC,KAAAC,WAAqB,I,yFAEF,K,gBACI,M,mBACE,a,mBACA,U,UACZC,MAAMC,OAAOC,IAAI,O,CAOtCC,EAAAC,UAAAC,kBAAA,eAAAC,EAAAR,KAEEA,KAAKS,aAAeT,KAAKU,OAAOC,KAAO,SAAWC,MAAMC,QAAQb,KAAKU,OAAOI,SAAWd,KAAKU,OAAOI,OAAOC,OAAS,EACnHb,MAAMc,SAAQ,WACZR,EAAKS,KAAOf,MAAMC,OAAOC,IAAI,O,IAE/BF,MAAMgB,KAAKC,UAAS,WAClBX,EAAKY,cAAgBlB,MAAMgB,KAAKG,eAAe,qBAAsBb,EAAKY,eAC1EZ,EAAKc,cAAgBpB,MAAMgB,KAAKG,eAAe,4BAA6Bb,EAAKc,c,KAIrFjB,EAAAC,UAAAiB,iBAAA,WACEvB,KAAKwB,aAAaC,aAAezB,KAAKC,aAAeD,KAAKS,aAAe,OACxET,KAAKS,cAAgBT,KAAKwB,eAAkBxB,KAAKwB,aAAaE,MAAMC,UAAY,GAAAC,OAAG5B,KAAKC,WAAU,OACnGD,KAAK6B,cAAcH,MAAMI,OAAS,GAAAF,OAAG5B,KAAK6B,cAAcJ,aAAY,K,EAIhEpB,EAAAC,UAAAyB,gBAAN,SAAsBC,GAAA,GAAAA,SAAA,GAAAA,EAAA,GAAW,C,gGAC/BhC,KAAK6B,cAAcI,gBAAgB,SACnCC,YAAW,WACT,IAAIC,EAA8B3B,EAAKqB,cAAcO,aACrD5B,EAAKqB,cAAcH,MAAMI,OAASK,EAAsB,I,GACvDH,G,iBAOC3B,EA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WAAM,OAAA/E,EAAK0C,cAAL,GAChDkB,EAAA,YAAOpE,KAAKU,OAAOyD,OACnBC,EAAA,QAAMC,MAAO,8BAAAzC,OAA8B5B,KAAKmD,OAAS,oCAAsC,OAEjGiB,EAAA,OAAKC,MAAM,2BAA2BmB,IAAK,SAACC,GAAO,OAAAjF,EAAKqB,cAAgB4D,CAArB,GACjDrB,EAAA,OAAKC,MAAM,0BAA0BmB,IAAK,SAACC,GAAO,OAAAjF,EAAKgB,aAAeiE,CAApB,GAChDrB,EAAA,aAEEpE,KAAKU,OAAO4B,OAASC,EAAkBC,MACnCxC,KAAKsD,mBAAmBtD,KAAKU,QAC7B0D,EAAA,qBAAmBsB,UAAW,SAACX,GAAU,OAAAvE,EAAKqE,QAAQC,KAAKC,EAAMY,OAAxB,EACzCH,IAAK,SAAAI,GAAS,OAAApF,EAAKiC,WAAamD,CAAlB,EACdT,YAAanF,KAAKmF,YAClBzE,OAAQV,KAAKU,UAGpBV,KAAKS,cACJ2D,EAAA,KAAGC,MAAM,wBACPkB,QAAS,WAAM,OAAA/E,EAAKwC,UAAL,IAAmBhD,KAAKiD,WAAajD,KAAKoB,cAAgBpB,KAAKsB,gB,yHA1L7D,I"}
@@ -0,0 +1,5 @@
1
+ /*!
2
+ * Crafted with ❤ by Salla
3
+ */
4
+ System.register(["./p-548cb28d.system.js"],(function(t){"use strict";var e,n,a,i;return{setters:[function(t){e=t.r;n=t.h;a=t.H;i=t.g}],execute:function(){var o=":host{display:block}";var s=t("salla_app_install_alert",function(){function t(t){e(this,t);this.data=salla.config.get("store.app_install_prompt");this.ctaLink=undefined;this.open=false;this.closing=false}t.prototype.connectedCallback=function(){var t=this;salla.onReady((function(){t.data=salla.config.get("store.app_install_prompt");if(!t.isMobileOrTabletDevice()){return}t.ctaLink=salla.config.get("store.apps")[t.getMobileOS()==="iOS"?"appstore":"googleplay"];setTimeout((function(){return t.open=true}),3e3)}))};t.prototype.getMobileOS=function(){var t=navigator.userAgent;if(/android/i.test(t)){return"Android"}else if(/iPad|iPhone|iPod/.test(t)||/Macintosh/i.test(navigator.userAgent)&&"ontouchend"in document){return"iOS"}return"Other"};t.prototype.isMobileOrTabletDevice=function(t){if(t===void 0){t=1024}var e=window.innerWidth<=t;var n=/Macintosh|Android|iPhone|iPad|iPod/i.test(navigator.userAgent);var a="ontouchstart"in window||"ontouchend"in document||navigator.maxTouchPoints>0;return n&&e&&a};t.prototype.closeAlert=function(){var t=this;salla.storage.set("app_install_prompt_disabled",true);if(this.data.position==="top"){this.open=false}else{this.closing=true;this.host.addEventListener("animationend",(function(){t.closing=false;t.open=false}),{once:true})}};t.prototype.render=function(){var t=this;return n(a,{class:"s-app-install-alert-wrapper ".concat(this.open?"open":""," ").concat(this.closing?"closing":""),position:this.data.position},n("div",null,n("img",{src:this.data.icon,width:"58",height:"58",alt:"".concat(salla.config.get("store.name"))})),n("div",null,n("h2",{class:"s-app-install-alert-title"},this.data.title),n("p",{class:"s-app-install-alert-sub-title"},this.data.sub_title,n("a",{href:this.ctaLink,target:"_blank","aria-label":"download app",class:"s-app-install-alert-cta"},salla.lang.getWithDefault("blocks.footer.download_app_now","حمله الآن")))),n("button",{class:"s-app-install-alert-cancel-button",onClick:function(){return t.closeAlert()}},n("i",{class:"sicon-cancel"})))};Object.defineProperty(t.prototype,"host",{get:function(){return i(this)},enumerable:false,configurable:true});return t}());s.style=o}}}));
5
+ //# sourceMappingURL=p-6900d691.system.entry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["sallaAppInstallAlertCss","SallaAppInstallAlert","exports","salla","config","get","class_1","prototype","connectedCallback","_this","this","onReady","data","isMobileOrTabletDevice","ctaLink","getMobileOS","setTimeout","open","ua","navigator","userAgent","test","document","screen","screenWidth","window","innerWidth","userAgentCheck","hasTouch","maxTouchPoints","closeAlert","storage","set","position","closing","host","addEventListener","once","render","h","Host","class","concat","src","icon","width","height","alt","title","sub_title","href","target","lang","getWithDefault","onClick"],"sources":["src/components/salla-app-install-alert/salla-app-install-alert.scss?tag=salla-app-install-alert","src/components/salla-app-install-alert/salla-app-install-alert.tsx"],"sourcesContent":[":host {\n display: block;\n}\n","import { Component, h, State, Element, Host } from '@stencil/core';\n\n@Component({\n tag: 'salla-app-install-alert',\n styleUrl: 'salla-app-install-alert.scss',\n})\nexport class SallaAppInstallAlert {\n connectedCallback() {\n salla.onReady(() => {\n this.data = salla.config.get('store.app_install_prompt');\n if (!this.isMobileOrTabletDevice()) {\n return;\n }\n\n this.ctaLink = salla.config.get('store.apps')[this.getMobileOS() === 'iOS' ? 'appstore' : 'googleplay'];\n setTimeout(() => (this.open = true), 3000);\n });\n }\n @State() data: any = salla.config.get('store.app_install_prompt');\n @State() ctaLink: string;\n @State() open: boolean = false;\n @State() closing: boolean = false;\n @Element() private host: HTMLElement;\n\n\n\n /**\n * Get the OS of device (android/ios).\n * @returns {string} returns iOS/Android/Other\n */\n private getMobileOS(): string {\n const ua = navigator.userAgent;\n if (/android/i.test(ua)) {\n return 'Android';\n } else if (\n /iPad|iPhone|iPod/.test(ua) ||\n (/Macintosh/i.test(navigator.userAgent) && 'ontouchend' in document)\n ) {\n return 'iOS';\n }\n return 'Other';\n }\n\n /**\n * Check if the website opens from mobile or tablet devices only (android/ios).\n *\n * @param {number} screen the width of the biggest screen to be checked\n * @returns {boolean} true if it is mobile or tablet else false\n */\n private isMobileOrTabletDevice(screen = 1024): boolean {\n const screenWidth = window.innerWidth <= screen;\n const userAgentCheck = /Macintosh|Android|iPhone|iPad|iPod/i.test(navigator.userAgent);\n const hasTouch =\n 'ontouchstart' in window ||\n 'ontouchend' in document ||\n navigator.maxTouchPoints > 0;\n\n return userAgentCheck && screenWidth && hasTouch;\n }\n\n closeAlert() {\n salla.storage.set('app_install_prompt_disabled', true);\n if (this.data.position === 'top') {\n this.open = false;\n } else {\n // handle closing animation first, then close the banner\n this.closing = true;\n this.host.addEventListener(\n 'animationend',\n () => {\n this.closing = false\n this.open = false;\n },\n { once: true }\n );\n }\n }\n\n\n render() {\n return (\n <Host class={`s-app-install-alert-wrapper ${this.open ? 'open' : ''} ${this.closing ? 'closing' : ''}`} position={this.data.position}>\n <div>\n <img src={this.data.icon} width=\"58\" height=\"58\" alt={`${salla.config.get('store.name')}`} />\n </div>\n <div>\n <h2 class=\"s-app-install-alert-title\">{this.data.title}</h2>\n <p class=\"s-app-install-alert-sub-title\">\n {this.data.sub_title}\n <a href={this.ctaLink} target=\"_blank\" aria-label=\"download app\" class=\"s-app-install-alert-cta\">\n {salla.lang.getWithDefault('blocks.footer.download_app_now', 'حمله الآن')}\n </a>\n </p>\n </div>\n <button class=\"s-app-install-alert-cancel-button\" onClick={() => this.closeAlert()}>\n <i class=\"sicon-cancel\"></i>\n </button>\n </Host>\n );\n }\n}\n"],"mappings":";;;0JAAA,IAAMA,EAA0B,uB,ICMnBC,EAAoBC,EAAA,qC,kCAYVC,MAAMC,OAAOC,IAAI,4B,iCAEb,M,aACG,K,CAd5BC,EAAAC,UAAAC,kBAAA,eAAAC,EAAAC,KACEP,MAAMQ,SAAQ,WACZF,EAAKG,KAAOT,MAAMC,OAAOC,IAAI,4BAC7B,IAAKI,EAAKI,yBAA0B,CAClC,M,CAGFJ,EAAKK,QAAUX,MAAMC,OAAOC,IAAI,cAAcI,EAAKM,gBAAkB,MAAQ,WAAa,cAC1FC,YAAW,kBAAOP,EAAKQ,KAAO,IAAnB,GAA0B,I,KAejCX,EAAAC,UAAAQ,YAAA,WACN,IAAMG,EAAKC,UAAUC,UACrB,GAAI,WAAWC,KAAKH,GAAK,CACvB,MAAO,S,MACF,GACL,mBAAmBG,KAAKH,IACvB,aAAaG,KAAKF,UAAUC,YAAc,eAAgBE,SAC3D,CACA,MAAO,K,CAET,MAAO,O,EASDhB,EAAAC,UAAAM,uBAAA,SAAuBU,GAAA,GAAAA,SAAA,GAAAA,EAAA,IAAa,CAC1C,IAAMC,EAAcC,OAAOC,YAAcH,EACzC,IAAMI,EAAiB,sCAAsCN,KAAKF,UAAUC,WAC5E,IAAMQ,EACJ,iBAAkBH,QAClB,eAAgBH,UAChBH,UAAUU,eAAiB,EAE7B,OAAOF,GAAkBH,GAAeI,C,EAG1CtB,EAAAC,UAAAuB,WAAA,eAAArB,EAAAC,KACEP,MAAM4B,QAAQC,IAAI,8BAA+B,MACjD,GAAItB,KAAKE,KAAKqB,WAAa,MAAO,CAChCvB,KAAKO,KAAO,K,KACP,CAELP,KAAKwB,QAAU,KACfxB,KAAKyB,KAAKC,iBACR,gBACA,WACE3B,EAAKyB,QAAU,MACfzB,EAAKQ,KAAO,K,GAEd,CAAEoB,KAAM,M,GAMd/B,EAAAC,UAAA+B,OAAA,eAAA7B,EAAAC,KACE,OACE6B,EAACC,EAAI,CAACC,MAAO,+BAAAC,OAA+BhC,KAAKO,KAAO,OAAS,GAAE,KAAAyB,OAAIhC,KAAKwB,QAAU,UAAY,IAAMD,SAAUvB,KAAKE,KAAKqB,UAC1HM,EAAA,WACEA,EAAA,OAAKI,IAAKjC,KAAKE,KAAKgC,KAAMC,MAAM,KAAKC,OAAO,KAAKC,IAAK,GAAAL,OAAGvC,MAAMC,OAAOC,IAAI,kBAE5EkC,EAAA,WACEA,EAAA,MAAIE,MAAM,6BAA6B/B,KAAKE,KAAKoC,OACjDT,EAAA,KAAGE,MAAM,iCACN/B,KAAKE,KAAKqC,UACXV,EAAA,KAAGW,KAAMxC,KAAKI,QAASqC,OAAO,SAAQ,aAAY,eAAeV,MAAM,2BACpEtC,MAAMiD,KAAKC,eAAe,iCAAkC,gBAInEd,EAAA,UAAQE,MAAM,oCAAoCa,QAAS,WAAM,OAAA7C,EAAKqB,YAAL,GAC/DS,EAAA,KAAGE,MAAM,kB,yHAzFc,I"}
@@ -1,5 +1,5 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- var a;(function(a){a["VALUES"]="values";a["VARIANTS"]="variants";a["MINIMUM"]="minimum";a["RANGE"]="range"})(a||(a={}));var n;(function(a){a["CHECKBOX"]="checkbox";a["RADIO"]="radio"})(n||(n={}));export{n as F,a};
5
- //# sourceMappingURL=p-61ac07f6.js.map
4
+ var a;(function(a){a["VALUES"]="values";a["VARIANTS"]="variants";a["MINIMUM"]="minimum";a["RANGE"]="range"})(a||(a={}));var n;(function(a){a["VALUES"]="values";a["VARIANT"]="variants";a["RANGE"]="range"})(n||(n={}));export{a as F};
5
+ //# sourceMappingURL=p-6cf5973f.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["FilterOptionTypes","FilterOptionInputType"],"sources":["src/components/salla-filters/interfaces.ts"],"sourcesContent":["export enum FilterOptionTypes {\n // CATEGORIES = \"categories\",\n // BRANDs = \"brands\",\n // RATING = \"rating\",\n // PRICE = \"price\",\n // RADIO = \"radio\",\n VALUES = \"values\",\n VARIANTS = \"variants\",\n MINIMUM = \"minimum\",\n RANGE = \"range\",\n}\n\nexport enum FilterOptionInputType {\n VALUES = \"values\",\n VARIANT = \"variants\",\n RANGE = \"range\",\n}\n\nexport interface FilterValue {\n key?: string,\n count?: number,\n value?: string,\n from?: number| \"*\",\n to?: number | \"*\"\n}\n\n\nexport interface Filter {\n key?: string;\n label?: string;\n type?: FilterOptionTypes;\n values?: FilterValue[];\n max?: number;\n min?: number;\n}\n"],"mappings":";;;IAAYA,GAAZ,SAAYA,GAMVA,EAAA,mBACAA,EAAA,uBACAA,EAAA,qBACAA,EAAA,gBACD,EAVD,CAAYA,MAAiB,KAY7B,IAAYC,GAAZ,SAAYA,GACVA,EAAA,mBACAA,EAAA,sBACAA,EAAA,gBACD,EAJD,CAAYA,MAAqB,Y"}
@@ -0,0 +1,5 @@
1
+ /*!
2
+ * Crafted with ❤ by Salla
3
+ */
4
+ System.register([],(function(n){"use strict";return{execute:function(){n("F",void 0);var e;(function(n){n["VALUES"]="values";n["VARIANTS"]="variants";n["MINIMUM"]="minimum";n["RANGE"]="range"})(e||(e=n("F",{})));var t;(function(n){n["VALUES"]="values";n["VARIANT"]="variants";n["RANGE"]="range"})(t||(t={}))}}}));
5
+ //# sourceMappingURL=p-82b08e0b.system.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["FilterOptionTypes","exports","FilterOptionInputType"],"sources":["src/components/salla-filters/interfaces.ts"],"sourcesContent":["export enum FilterOptionTypes {\n // CATEGORIES = \"categories\",\n // BRANDs = \"brands\",\n // RATING = \"rating\",\n // PRICE = \"price\",\n // RADIO = \"radio\",\n VALUES = \"values\",\n VARIANTS = \"variants\",\n MINIMUM = \"minimum\",\n RANGE = \"range\",\n}\n\nexport enum FilterOptionInputType {\n VALUES = \"values\",\n VARIANT = \"variants\",\n RANGE = \"range\",\n}\n\nexport interface FilterValue {\n key?: string,\n count?: number,\n value?: string,\n from?: number| \"*\",\n to?: number | \"*\"\n}\n\n\nexport interface Filter {\n key?: string;\n label?: string;\n type?: FilterOptionTypes;\n values?: FilterValue[];\n max?: number;\n min?: number;\n}\n"],"mappings":";;;yFAAYA,GAAZ,SAAYA,GAMVA,EAAA,mBACAA,EAAA,uBACAA,EAAA,qBACAA,EAAA,gBACD,EAVD,CAAYA,MAAiBC,EAAA,UAY7B,IAAYC,GAAZ,SAAYA,GACVA,EAAA,mBACAA,EAAA,sBACAA,EAAA,gBACD,EAJD,CAAYA,MAAqB,I"}
@@ -0,0 +1,5 @@
1
+ /*!
2
+ * Crafted with ❤ by Salla
3
+ */
4
+ import{r as t,h as s,H as a,g as i}from"./p-dd9b5ccb.js";const l=":host{display:block}";const e=class{constructor(s){t(this,s);this.data=salla.config.get("store.app_install_prompt");this.ctaLink=undefined;this.open=false;this.closing=false}connectedCallback(){salla.onReady((()=>{this.data=salla.config.get("store.app_install_prompt");if(!this.isMobileOrTabletDevice()){return}this.ctaLink=salla.config.get("store.apps")[this.getMobileOS()==="iOS"?"appstore":"googleplay"];setTimeout((()=>this.open=true),3e3)}))}getMobileOS(){const t=navigator.userAgent;if(/android/i.test(t)){return"Android"}else if(/iPad|iPhone|iPod/.test(t)||/Macintosh/i.test(navigator.userAgent)&&"ontouchend"in document){return"iOS"}return"Other"}isMobileOrTabletDevice(t=1024){const s=window.innerWidth<=t;const a=/Macintosh|Android|iPhone|iPad|iPod/i.test(navigator.userAgent);const i="ontouchstart"in window||"ontouchend"in document||navigator.maxTouchPoints>0;return a&&s&&i}closeAlert(){salla.storage.set("app_install_prompt_disabled",true);if(this.data.position==="top"){this.open=false}else{this.closing=true;this.host.addEventListener("animationend",(()=>{this.closing=false;this.open=false}),{once:true})}}render(){return s(a,{class:`s-app-install-alert-wrapper ${this.open?"open":""} ${this.closing?"closing":""}`,position:this.data.position},s("div",null,s("img",{src:this.data.icon,width:"58",height:"58",alt:`${salla.config.get("store.name")}`})),s("div",null,s("h2",{class:"s-app-install-alert-title"},this.data.title),s("p",{class:"s-app-install-alert-sub-title"},this.data.sub_title,s("a",{href:this.ctaLink,target:"_blank","aria-label":"download app",class:"s-app-install-alert-cta"},salla.lang.getWithDefault("blocks.footer.download_app_now","حمله الآن")))),s("button",{class:"s-app-install-alert-cancel-button",onClick:()=>this.closeAlert()},s("i",{class:"sicon-cancel"})))}get host(){return i(this)}};e.style=l;export{e as salla_app_install_alert};
5
+ //# sourceMappingURL=p-88169663.entry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["sallaAppInstallAlertCss","SallaAppInstallAlert","salla","config","get","connectedCallback","onReady","this","data","isMobileOrTabletDevice","ctaLink","getMobileOS","setTimeout","open","ua","navigator","userAgent","test","document","screen","screenWidth","window","innerWidth","userAgentCheck","hasTouch","maxTouchPoints","closeAlert","storage","set","position","closing","host","addEventListener","once","render","h","Host","class","src","icon","width","height","alt","title","sub_title","href","target","lang","getWithDefault","onClick"],"sources":["src/components/salla-app-install-alert/salla-app-install-alert.scss?tag=salla-app-install-alert","src/components/salla-app-install-alert/salla-app-install-alert.tsx"],"sourcesContent":[":host {\n display: block;\n}\n","import { Component, h, State, Element, Host } from '@stencil/core';\n\n@Component({\n tag: 'salla-app-install-alert',\n styleUrl: 'salla-app-install-alert.scss',\n})\nexport class SallaAppInstallAlert {\n connectedCallback() {\n salla.onReady(() => {\n this.data = salla.config.get('store.app_install_prompt');\n if (!this.isMobileOrTabletDevice()) {\n return;\n }\n\n this.ctaLink = salla.config.get('store.apps')[this.getMobileOS() === 'iOS' ? 'appstore' : 'googleplay'];\n setTimeout(() => (this.open = true), 3000);\n });\n }\n @State() data: any = salla.config.get('store.app_install_prompt');\n @State() ctaLink: string;\n @State() open: boolean = false;\n @State() closing: boolean = false;\n @Element() private host: HTMLElement;\n\n\n\n /**\n * Get the OS of device (android/ios).\n * @returns {string} returns iOS/Android/Other\n */\n private getMobileOS(): string {\n const ua = navigator.userAgent;\n if (/android/i.test(ua)) {\n return 'Android';\n } else if (\n /iPad|iPhone|iPod/.test(ua) ||\n (/Macintosh/i.test(navigator.userAgent) && 'ontouchend' in document)\n ) {\n return 'iOS';\n }\n return 'Other';\n }\n\n /**\n * Check if the website opens from mobile or tablet devices only (android/ios).\n *\n * @param {number} screen the width of the biggest screen to be checked\n * @returns {boolean} true if it is mobile or tablet else false\n */\n private isMobileOrTabletDevice(screen = 1024): boolean {\n const screenWidth = window.innerWidth <= screen;\n const userAgentCheck = /Macintosh|Android|iPhone|iPad|iPod/i.test(navigator.userAgent);\n const hasTouch =\n 'ontouchstart' in window ||\n 'ontouchend' in document ||\n navigator.maxTouchPoints > 0;\n\n return userAgentCheck && screenWidth && hasTouch;\n }\n\n closeAlert() {\n salla.storage.set('app_install_prompt_disabled', true);\n if (this.data.position === 'top') {\n this.open = false;\n } else {\n // handle closing animation first, then close the banner\n this.closing = true;\n this.host.addEventListener(\n 'animationend',\n () => {\n this.closing = false\n this.open = false;\n },\n { once: true }\n );\n }\n }\n\n\n render() {\n return (\n <Host class={`s-app-install-alert-wrapper ${this.open ? 'open' : ''} ${this.closing ? 'closing' : ''}`} position={this.data.position}>\n <div>\n <img src={this.data.icon} width=\"58\" height=\"58\" alt={`${salla.config.get('store.name')}`} />\n </div>\n <div>\n <h2 class=\"s-app-install-alert-title\">{this.data.title}</h2>\n <p class=\"s-app-install-alert-sub-title\">\n {this.data.sub_title}\n <a href={this.ctaLink} target=\"_blank\" aria-label=\"download app\" class=\"s-app-install-alert-cta\">\n {salla.lang.getWithDefault('blocks.footer.download_app_now', 'حمله الآن')}\n </a>\n </p>\n </div>\n <button class=\"s-app-install-alert-cancel-button\" onClick={() => this.closeAlert()}>\n <i class=\"sicon-cancel\"></i>\n </button>\n </Host>\n );\n }\n}\n"],"mappings":";;;yDAAA,MAAMA,EAA0B,uB,MCMnBC,EAAoB,M,mCAYVC,MAAMC,OAAOC,IAAI,4B,iCAEb,M,aACG,K,CAd5B,iBAAAC,GACEH,MAAMI,SAAQ,KACZC,KAAKC,KAAON,MAAMC,OAAOC,IAAI,4BAC7B,IAAKG,KAAKE,yBAA0B,CAClC,M,CAGFF,KAAKG,QAAUR,MAAMC,OAAOC,IAAI,cAAcG,KAAKI,gBAAkB,MAAQ,WAAa,cAC1FC,YAAW,IAAOL,KAAKM,KAAO,MAAO,IAAK,G,CAetC,WAAAF,GACN,MAAMG,EAAKC,UAAUC,UACrB,GAAI,WAAWC,KAAKH,GAAK,CACvB,MAAO,S,MACF,GACL,mBAAmBG,KAAKH,IACvB,aAAaG,KAAKF,UAAUC,YAAc,eAAgBE,SAC3D,CACA,MAAO,K,CAET,MAAO,O,CASD,sBAAAT,CAAuBU,EAAS,MACtC,MAAMC,EAAcC,OAAOC,YAAcH,EACzC,MAAMI,EAAiB,sCAAsCN,KAAKF,UAAUC,WAC5E,MAAMQ,EACJ,iBAAkBH,QAClB,eAAgBH,UAChBH,UAAUU,eAAiB,EAE7B,OAAOF,GAAkBH,GAAeI,C,CAG1C,UAAAE,GACExB,MAAMyB,QAAQC,IAAI,8BAA+B,MACjD,GAAIrB,KAAKC,KAAKqB,WAAa,MAAO,CAChCtB,KAAKM,KAAO,K,KACP,CAELN,KAAKuB,QAAU,KACfvB,KAAKwB,KAAKC,iBACR,gBACA,KACEzB,KAAKuB,QAAU,MACfvB,KAAKM,KAAO,KAAK,GAEnB,CAAEoB,KAAM,M,EAMd,MAAAC,GACE,OACEC,EAACC,EAAI,CAACC,MAAO,+BAA+B9B,KAAKM,KAAO,OAAS,MAAMN,KAAKuB,QAAU,UAAY,KAAMD,SAAUtB,KAAKC,KAAKqB,UAC1HM,EAAA,WACEA,EAAA,OAAKG,IAAK/B,KAAKC,KAAK+B,KAAMC,MAAM,KAAKC,OAAO,KAAKC,IAAK,GAAGxC,MAAMC,OAAOC,IAAI,mBAE5E+B,EAAA,WACEA,EAAA,MAAIE,MAAM,6BAA6B9B,KAAKC,KAAKmC,OACjDR,EAAA,KAAGE,MAAM,iCACN9B,KAAKC,KAAKoC,UACXT,EAAA,KAAGU,KAAMtC,KAAKG,QAASoC,OAAO,SAAQ,aAAY,eAAeT,MAAM,2BACpEnC,MAAM6C,KAAKC,eAAe,iCAAkC,gBAInEb,EAAA,UAAQE,MAAM,oCAAoCY,QAAS,IAAM1C,KAAKmB,cACpES,EAAA,KAAGE,MAAM,kB"}
@@ -0,0 +1,5 @@
1
+ var __awaiter=this&&this.__awaiter||function(t,e,r,a){function i(t){return t instanceof r?t:new r((function(e){e(t)}))}return new(r||(r=Promise))((function(r,n){function s(t){try{l(a.next(t))}catch(t){n(t)}}function o(t){try{l(a["throw"](t))}catch(t){n(t)}}function l(t){t.done?r(t.value):i(t.value).then(s,o)}l((a=a.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:[]},a,i,n,s;return s={next:o(0),throw:o(1),return:o(2)},typeof Symbol==="function"&&(s[Symbol.iterator]=function(){return this}),s;function o(t){return function(e){return l([t,e])}}function l(o){if(a)throw new TypeError("Generator is already executing.");while(s&&(s=0,o[0]&&(r=0)),r)try{if(a=1,i&&(n=o[0]&2?i["return"]:o[0]?i["throw"]||((n=i["return"])&&n.call(i),0):i.next)&&!(n=n.call(i,o[1])).done)return n;if(i=0,n)o=[o[0]&2,n.value];switch(o[0]){case 0:case 1:n=o;break;case 4:r.label++;return{value:o[1],done:false};case 5:r.label++;i=o[1];o=[0];continue;case 7:o=r.ops.pop();r.trys.pop();continue;default:if(!(n=r.trys,n=n.length>0&&n[n.length-1])&&(o[0]===6||o[0]===2)){r=0;continue}if(o[0]===3&&(!n||o[1]>n[0]&&o[1]<n[3])){r.label=o[1];break}if(o[0]===6&&r.label<n[1]){r.label=n[1];n=o;break}if(n&&r.label<n[2]){r.label=n[2];r.ops.push(o);break}if(n[2])r.ops.pop();r.trys.pop();continue}o=e.call(t,r)}catch(t){o=[6,t];i=0}finally{a=n=0}if(o[0]&5)throw o[1];return{value:o[0]?o[1]:void 0,done:true}}};
2
+ /*!
3
+ * Crafted with ❤ by Salla
4
+ */System.register(["./p-548cb28d.system.js","./p-82b08e0b.system.js"],(function(t){"use strict";var e,r,a,i,n,s;return{setters:[function(t){e=t.r;r=t.c;a=t.h;i=t.H;n=t.g},function(t){s=t.F}],execute:function(){var o=":host{display:block}.s-rating-stars-small{line-height:12px}.s-filters-radio{background-image:none !important}";var l=t("salla_filters",function(){function t(t){var a=this;e(this,t);this.changed=r(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 a.host.style.display="none"}));salla.lang.onLoaded((function(){a.apply=salla.lang.get("pages.checkout.apply");a.reset=salla.lang.get("pages.categories.filters_reset")}));salla.event.on("filters::fetched",(function(t){var e=t.filters;a.host.style.display="";var r={};a.filters=e.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;if(t.key=="rating"){t.type=s.VALUES;var e=t.values,i=e.max,n=e.min;t.values=[5,4,3,2,1].filter((function(t){return t>=n||t<=i}))}if(a.filtersData[t.key]){r[t.key]=a.filtersData[t.key]}return t}));a.filtersData=r;a.host.childNodes.forEach((function(t){return __awaiter(a,void 0,void 0,(function(){var e;return __generator(this,(function(r){switch(r.label){case 0:e=t.setWidgetHeight;if(!e)return[3,2];return[4,t.setWidgetHeight()];case 1:e=r.sent();r.label=2;case 2:return[2,e]}}))}))}))}))}t.prototype.connectedCallback=function(){var t=this;try{var e=new URLSearchParams(window.location.search);var r={};var a=function(e,a){var i=e.replace(/\]/g,"").split("[");i.reduce((function(e,r,i,n){var s=i===n.length-1;var o=/^\d+$/.test(r)?parseInt(r,10):r;if(s){if(/^\d+$/.test(r)){t.addObjectValue(e,n[i-1],a);return e[n[i-1]]}else if(e[o]){e[o]=[e[o],a]}else{e[o]=a}}else{e[o]=e[o]||{}}return e[o]}),r)};for(var i=0,n=e.entries();i<n.length;i++){var s=n[i],o=s[0],l=s[1];a(o,l)}this.filtersData=this.flattenObject(r["filters"])||{}}catch(t){salla.logger.warn("failed to get filters from url",t.message)}};t.prototype.flattenObject=function(t){for(var e in t){if(typeof t[e]==="object"){if(t[e][e]&&Array.isArray(t[e][e])){t[e]=t[e][e]}else{this.flattenObject(t[e])}}}return t};t.prototype.addObjectValue=function(t,e,r){if(t.hasOwnProperty(e)){if(Array.isArray(t[e])){t[e].push(r)}else{t[e]=[t[e],r]}}else{t[e]=[r]}};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){var a=new URL(window.location.href);for(var i=0,n=a.searchParams.entries();i<n.length;i++){var s=n[i][0];if(s.startsWith("filters")){a.searchParams.delete(s)}}var o=e.encodeFilters(e.filtersData);var l=a.search.split("&").filter((function(t){return!t.includes("filters")})).join("&");if(!!l){a.search=a.search.split("&filters")[0]+"&"+o}else{a.search="?".concat(o)}window.history.pushState({},"",a.href)}else{var a=new URL(window.location.href);(r=a.searchParams)===null||r===void 0?void 0:r.delete("filters");window.history.pushState({},"",a.toString())}salla.event.emit("salla-filters::changed",e.filtersData);e.changed.emit(e.filtersData)}),300);return[2]}))}))};t.prototype.encodeFilters=function(t,e){if(e===void 0){e="filters"}var r=[];for(var a in t){if(Object.prototype.hasOwnProperty.call(t,a)){var i=t[a];var n=e?"".concat(e,"[").concat(a,"]"):a;if(Array.isArray(i)){for(var s=0;s<i.length;s++){r.push("".concat(n,"[").concat(s,"]=").concat(i[s]))}}else if(typeof i==="object"&&i!==null){r.push(this.encodeFilters(i,n))}else{var o="".concat(n,"=").concat(i);r.push(o)}}}return r.join("&")};t.prototype.resetFilters=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){this.removeFiltersQueryParams();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.removeFiltersQueryParams=function(){var t=new URLSearchParams(window.location.search);var e=Array.from(t.keys()).filter((function(t){return!t.startsWith("filters[")})).map((function(e){return"".concat(encodeURIComponent(e),"=").concat(encodeURIComponent(t.get(e)))})).join("&");var r=e?"".concat(window.location.pathname,"?").concat(e):window.location.pathname;window.history.pushState({},"",r)};t.prototype.handleOptionChange=function(t,e,r){if(e.type===s.RANGE){this.filtersData[e.key]=r}var a=t.target.checked;if(e.type===s.VARIANTS){this.filtersData.variants=this.filtersData.variants||{};a&&(this.filtersData.variants[e.key]=r);a||delete this.filtersData.variants[e.key]}else if(t.target.type=="radio"){a&&(this.filtersData[e.key]=r);a||delete this.filtersData[e.key]}else if(t.target.type=="checkbox"){this.filtersData[e.key]=this.filtersData[e.key]||[];if(a){this.filtersData[e.key].push(r)}this.filtersData[e.key]=this.filtersData[e.key].filter((function(t){return t!=r}))}this.applyFilters()};t.prototype.render=function(){var t=this;var e,r;return a(i,null,(e=this.filters)===null||e===void 0?void 0:e.map((function(e){return a("salla-filters-widget",{option:e,filtersData:t.filtersData,onChanged:function(e){var r=e.detail,a=r.event,i=r.option,n=r.value;return t.handleOptionChange(a,i,n)}})})),((r=this.filters)===null||r===void 0?void 0:r.length)?a("div",{class:"s-filters-footer"},a("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 n(this)},enumerable:false,configurable:true});return t}());l.style=o}}}));
5
+ //# sourceMappingURL=p-9f54aa1e.system.entry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["sallaFiltersCss","SallaFilters","exports","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","type","FilterOptionTypes","VALUES","values","max_1","max","min_1","min","stars","filtersData","childNodes","forEach","widget","__awaiter","__generator","_d","setWidgetHeight","sent","prototype","connectedCallback","searchParams","URLSearchParams","window","location","search","filterObject","value","keys","replace","split","reduce","obj","keyPart","index","array","isLastKey","length","finalKey","test","parseInt","addObjectValue","_i","entries","flattenObject","e","logger","warn","message","Array","isArray","hasOwnProperty","push","getFilters","applyFilters","hasFilters","Object","setTimeout","url","URL","href","startsWith","delete","encodedFilterValues","encodeFilters","sanitizedFilterValues","item","includes","join","concat","history","pushState","_a","toString","emit","changed","parentKey","encodedFilters","call","fullKey","i","result","resetFilters","removeFiltersQueryParams","newUrl","from","encodeURIComponent","finalUrl","pathname","handleOptionChange","option","RANGE","isChecked","target","checked","VARIANTS","variants","val","render","h","Host","onChanged","detail","_b","class","color","fill","onClick","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, 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\n if (filter.key == 'rating') {\n filter.type = FilterOptionTypes.VALUES;\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 this.host.childNodes.forEach(async (widget: HTMLSallaFiltersWidgetElement) => widget.setWidgetHeight && await widget.setWidgetHeight())\n });\n }\n\n connectedCallback() {\n try {\n const searchParams = new URLSearchParams(window.location.search);\n const filterObject = {};\n\n for (const [key, value] of searchParams.entries()) {\n const keys = key.replace(/\\]/g, '').split('[');\n keys.reduce((obj, keyPart, index, array) => {\n const isLastKey = index === array.length - 1;\n const finalKey = /^\\d+$/.test(keyPart) ? parseInt(keyPart, 10) : keyPart;\n if (isLastKey) {\n if (/^\\d+$/.test(keyPart)) {\n this.addObjectValue(obj, array[index - 1], value)\n return obj[array[index - 1]];\n } else if (obj[finalKey]) {\n obj[finalKey] = [obj[finalKey], value];\n } else {\n obj[finalKey] = value;\n }\n } else {\n obj[finalKey] = obj[finalKey] || {};\n }\n\n return obj[finalKey];\n }, filterObject);\n }\n\n this.filtersData = this.flattenObject(filterObject[\"filters\"]) || {};\n } catch (e) {\n salla.logger.warn('failed to get filters from url', e.message);\n }\n\n }\n\n private flattenObject(obj: any) {\n for (const key in obj) {\n if (typeof obj[key] === 'object') {\n if (obj[key][key] && Array.isArray(obj[key][key])) {\n obj[key] = obj[key][key];\n } else {\n this.flattenObject(obj[key]);\n }\n }\n }\n return obj;\n }\n\n\n private addObjectValue(obj, key, value) {\n if (obj.hasOwnProperty(key)) {\n if (Array.isArray(obj[key])) {\n obj[key].push(value);\n } else {\n obj[key] = [obj[key], value];\n }\n } else {\n obj[key] = [value];\n }\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 let url = new URL(window.location.href);\n for (const [key] of url.searchParams.entries()) {\n if (key.startsWith(\"filters\")) {\n url.searchParams.delete(key);\n }\n }\n let encodedFilterValues = this.encodeFilters(this.filtersData)\n let sanitizedFilterValues = url.search.split(\"&\").filter(item => !item.includes('filters')).join(\"&\")\n if (!!sanitizedFilterValues) {\n url.search = url.search.split(\"&filters\")[0] + \"&\" + encodedFilterValues\n }else {\n url.search = `?${encodedFilterValues}`\n }\n window.history.pushState({}, '', url.href);\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 private encodeFilters(filters, parentKey = 'filters') {\n const encodedFilters = [];\n\n for (const key in filters) {\n if (Object.prototype.hasOwnProperty.call(filters, key)) {\n const value = filters[key];\n\n const fullKey = parentKey ? `${parentKey}[${key}]` : key;\n if (Array.isArray(value)) {\n for (let i = 0; i < value.length; i++) {\n encodedFilters.push(`${fullKey}[${i}]=${value[i]}`)\n }\n }\n else if (typeof value === 'object' && value !== null) {\n encodedFilters.push(this.encodeFilters(value, fullKey));\n } else {\n // const encodedKey = encodeURIComponent(fullKey);\n // const encodedValue = encodeURIComponent(value);\n let result = `${fullKey}=${value}`\n encodedFilters.push(result);\n }\n }\n }\n return encodedFilters.join('&');\n };\n\n /**\n * Reset selected filters.\n */\n @Method()\n async resetFilters() {\n this.removeFiltersQueryParams()\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 private removeFiltersQueryParams() {\n const searchParams = new URLSearchParams(window.location.search);\n\n const newUrl = Array.from(searchParams.keys())\n .filter(key => !key.startsWith('filters['))\n .map(key => `${encodeURIComponent(key)}=${encodeURIComponent(searchParams.get(key))}`)\n .join('&');\n\n const finalUrl = newUrl ? `${window.location.pathname}?${newUrl}` : window.location.pathname;\n window.history.pushState({}, '', finalUrl);\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\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 }\n\n else if (event.target.type == \"radio\") {\n isChecked && (this.filtersData[option.key] = value);\n isChecked || (delete this.filtersData[option.key]);\n }\n\n //it's checkbox\n // add if condition to avoid error when the filter is not existed in the filtersData\n else if(event.target.type == \"checkbox\") {\n this.filtersData[option.key] = this.filtersData[option.key] || [];\n if (isChecked) {\n this.filtersData[option.key].push(value);\n\n }\n this.filtersData[option.key] = this.filtersData[option.key].filter(val => val != value);\n }\n this.applyFilters();\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":";;;mNAAA,IAAMA,EAAkB,gH,ICOXC,EAAYC,EAAA,2BAEvB,SAAAC,EAAAC,GAAA,IAAAC,EAAAC,K,2CA4GQA,KAAAC,QAAU,M,qEAGmB,G,0CA9GnCC,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,MAExB,GAAID,EAAOM,KAAO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*!
2
+ * Crafted with ❤ by Salla
3
+ */
4
+ import{r as t,c as s,h as e,H as i,g as l}from"./p-dd9b5ccb.js";import{F as a}from"./p-6cf5973f.js";const r=":host{display:block}.s-rating-stars-small{line-height:12px}.s-filters-radio{background-image:none !important}";const n=class{constructor(e){t(this,e);this.changed=s(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",(()=>this.host.style.display="none"));salla.lang.onLoaded((()=>{this.apply=salla.lang.get("pages.checkout.apply");this.reset=salla.lang.get("pages.categories.filters_reset")}));salla.event.on("filters::fetched",(({filters:t})=>{this.host.style.display="";let s={};this.filters=t.map((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;if(t.key=="rating"){t.type=a.VALUES;let{max:s,min:e}=t.values;t.values=[5,4,3,2,1].filter((t=>t>=e||t<=s))}if(this.filtersData[t.key]){s[t.key]=this.filtersData[t.key]}return t}));this.filtersData=s;this.host.childNodes.forEach((async t=>t.setWidgetHeight&&await t.setWidgetHeight()))}))}connectedCallback(){try{const t=new URLSearchParams(window.location.search);const s={};for(const[e,i]of t.entries()){const t=e.replace(/\]/g,"").split("[");t.reduce(((t,s,e,l)=>{const a=e===l.length-1;const r=/^\d+$/.test(s)?parseInt(s,10):s;if(a){if(/^\d+$/.test(s)){this.addObjectValue(t,l[e-1],i);return t[l[e-1]]}else if(t[r]){t[r]=[t[r],i]}else{t[r]=i}}else{t[r]=t[r]||{}}return t[r]}),s)}this.filtersData=this.flattenObject(s["filters"])||{}}catch(t){salla.logger.warn("failed to get filters from url",t.message)}}flattenObject(t){for(const s in t){if(typeof t[s]==="object"){if(t[s][s]&&Array.isArray(t[s][s])){t[s]=t[s][s]}else{this.flattenObject(t[s])}}}return t}addObjectValue(t,s,e){if(t.hasOwnProperty(s)){if(Array.isArray(t[s])){t[s].push(e)}else{t[s]=[t[s],e]}}else{t[s]=[e]}}async getFilters(){return this.filtersData}async applyFilters(){if(!this.isReady){return}let t=Object.keys(this.filtersData).length>0;setTimeout((()=>{var s;if(t){let t=new URL(window.location.href);for(const[s]of t.searchParams.entries()){if(s.startsWith("filters")){t.searchParams.delete(s)}}let s=this.encodeFilters(this.filtersData);let e=t.search.split("&").filter((t=>!t.includes("filters"))).join("&");if(!!e){t.search=t.search.split("&filters")[0]+"&"+s}else{t.search=`?${s}`}window.history.pushState({},"",t.href)}else{let t=new URL(window.location.href);(s=t.searchParams)===null||s===void 0?void 0:s.delete("filters");window.history.pushState({},"",t.toString())}salla.event.emit("salla-filters::changed",this.filtersData);this.changed.emit(this.filtersData)}),300)}encodeFilters(t,s="filters"){const e=[];for(const i in t){if(Object.prototype.hasOwnProperty.call(t,i)){const l=t[i];const a=s?`${s}[${i}]`:i;if(Array.isArray(l)){for(let t=0;t<l.length;t++){e.push(`${a}[${t}]=${l[t]}`)}}else if(typeof l==="object"&&l!==null){e.push(this.encodeFilters(l,a))}else{let t=`${a}=${l}`;e.push(t)}}}return e.join("&")}async resetFilters(){this.removeFiltersQueryParams();this.filtersData={};this.host.childNodes.forEach((t=>t.reset&&t.reset()));salla.event.emit("salla-filters::reset");return this.applyFilters()}removeFiltersQueryParams(){const t=new URLSearchParams(window.location.search);const s=Array.from(t.keys()).filter((t=>!t.startsWith("filters["))).map((s=>`${encodeURIComponent(s)}=${encodeURIComponent(t.get(s))}`)).join("&");const e=s?`${window.location.pathname}?${s}`:window.location.pathname;window.history.pushState({},"",e)}handleOptionChange(t,s,e){if(s.type===a.RANGE){this.filtersData[s.key]=e}let i=t.target.checked;if(s.type===a.VARIANTS){this.filtersData.variants=this.filtersData.variants||{};i&&(this.filtersData.variants[s.key]=e);i||delete this.filtersData.variants[s.key]}else if(t.target.type=="radio"){i&&(this.filtersData[s.key]=e);i||delete this.filtersData[s.key]}else if(t.target.type=="checkbox"){this.filtersData[s.key]=this.filtersData[s.key]||[];if(i){this.filtersData[s.key].push(e)}this.filtersData[s.key]=this.filtersData[s.key].filter((t=>t!=e))}this.applyFilters()}render(){var t,s;return e(i,null,(t=this.filters)===null||t===void 0?void 0:t.map((t=>e("salla-filters-widget",{option:t,filtersData:this.filtersData,onChanged:({detail:{event:t,option:s,value:e}})=>this.handleOptionChange(t,s,e)}))),((s=this.filters)===null||s===void 0?void 0:s.length)?e("div",{class:"s-filters-footer"},e("salla-button",{color:"gray",fill:"outline",onClick:()=>this.resetFilters()},this.reset)):"")}componentDidLoad(){this.isReady=true}get host(){return l(this)}};n.style=r;export{n as salla_filters};
5
+ //# sourceMappingURL=p-c2c2f116.entry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["sallaFiltersCss","SallaFilters","constructor","hostRef","this","isReady","salla","event","on","host","style","display","lang","onLoaded","apply","get","reset","filters","freshFilterData","map","filter","label","category_id","brand_id","rating","price","key","type","FilterOptionTypes","VALUES","max","min","values","stars","filtersData","childNodes","forEach","async","widget","setWidgetHeight","connectedCallback","searchParams","URLSearchParams","window","location","search","filterObject","value","entries","keys","replace","split","reduce","obj","keyPart","index","array","isLastKey","length","finalKey","test","parseInt","addObjectValue","flattenObject","e","logger","warn","message","Array","isArray","hasOwnProperty","push","getFilters","applyFilters","hasFilters","Object","setTimeout","url","URL","href","startsWith","delete","encodedFilterValues","encodeFilters","sanitizedFilterValues","item","includes","join","history","pushState","_a","toString","emit","changed","parentKey","encodedFilters","prototype","call","fullKey","i","result","resetFilters","removeFiltersQueryParams","newUrl","from","encodeURIComponent","finalUrl","pathname","handleOptionChange","option","RANGE","isChecked","target","checked","VARIANTS","variants","val","render","h","Host","onChanged","detail","_b","class","color","fill","onClick","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, 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\n if (filter.key == 'rating') {\n filter.type = FilterOptionTypes.VALUES;\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 this.host.childNodes.forEach(async (widget: HTMLSallaFiltersWidgetElement) => widget.setWidgetHeight && await widget.setWidgetHeight())\n });\n }\n\n connectedCallback() {\n try {\n const searchParams = new URLSearchParams(window.location.search);\n const filterObject = {};\n\n for (const [key, value] of searchParams.entries()) {\n const keys = key.replace(/\\]/g, '').split('[');\n keys.reduce((obj, keyPart, index, array) => {\n const isLastKey = index === array.length - 1;\n const finalKey = /^\\d+$/.test(keyPart) ? parseInt(keyPart, 10) : keyPart;\n if (isLastKey) {\n if (/^\\d+$/.test(keyPart)) {\n this.addObjectValue(obj, array[index - 1], value)\n return obj[array[index - 1]];\n } else if (obj[finalKey]) {\n obj[finalKey] = [obj[finalKey], value];\n } else {\n obj[finalKey] = value;\n }\n } else {\n obj[finalKey] = obj[finalKey] || {};\n }\n\n return obj[finalKey];\n }, filterObject);\n }\n\n this.filtersData = this.flattenObject(filterObject[\"filters\"]) || {};\n } catch (e) {\n salla.logger.warn('failed to get filters from url', e.message);\n }\n\n }\n\n private flattenObject(obj: any) {\n for (const key in obj) {\n if (typeof obj[key] === 'object') {\n if (obj[key][key] && Array.isArray(obj[key][key])) {\n obj[key] = obj[key][key];\n } else {\n this.flattenObject(obj[key]);\n }\n }\n }\n return obj;\n }\n\n\n private addObjectValue(obj, key, value) {\n if (obj.hasOwnProperty(key)) {\n if (Array.isArray(obj[key])) {\n obj[key].push(value);\n } else {\n obj[key] = [obj[key], value];\n }\n } else {\n obj[key] = [value];\n }\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 let url = new URL(window.location.href);\n for (const [key] of url.searchParams.entries()) {\n if (key.startsWith(\"filters\")) {\n url.searchParams.delete(key);\n }\n }\n let encodedFilterValues = this.encodeFilters(this.filtersData)\n let sanitizedFilterValues = url.search.split(\"&\").filter(item => !item.includes('filters')).join(\"&\")\n if (!!sanitizedFilterValues) {\n url.search = url.search.split(\"&filters\")[0] + \"&\" + encodedFilterValues\n }else {\n url.search = `?${encodedFilterValues}`\n }\n window.history.pushState({}, '', url.href);\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 private encodeFilters(filters, parentKey = 'filters') {\n const encodedFilters = [];\n\n for (const key in filters) {\n if (Object.prototype.hasOwnProperty.call(filters, key)) {\n const value = filters[key];\n\n const fullKey = parentKey ? `${parentKey}[${key}]` : key;\n if (Array.isArray(value)) {\n for (let i = 0; i < value.length; i++) {\n encodedFilters.push(`${fullKey}[${i}]=${value[i]}`)\n }\n }\n else if (typeof value === 'object' && value !== null) {\n encodedFilters.push(this.encodeFilters(value, fullKey));\n } else {\n // const encodedKey = encodeURIComponent(fullKey);\n // const encodedValue = encodeURIComponent(value);\n let result = `${fullKey}=${value}`\n encodedFilters.push(result);\n }\n }\n }\n return encodedFilters.join('&');\n };\n\n /**\n * Reset selected filters.\n */\n @Method()\n async resetFilters() {\n this.removeFiltersQueryParams()\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 private removeFiltersQueryParams() {\n const searchParams = new URLSearchParams(window.location.search);\n\n const newUrl = Array.from(searchParams.keys())\n .filter(key => !key.startsWith('filters['))\n .map(key => `${encodeURIComponent(key)}=${encodeURIComponent(searchParams.get(key))}`)\n .join('&');\n\n const finalUrl = newUrl ? `${window.location.pathname}?${newUrl}` : window.location.pathname;\n window.history.pushState({}, '', finalUrl);\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\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 }\n\n else if (event.target.type == \"radio\") {\n isChecked && (this.filtersData[option.key] = value);\n isChecked || (delete this.filtersData[option.key]);\n }\n\n //it's checkbox\n // add if condition to avoid error when the filter is not existed in the filtersData\n else if(event.target.type == \"checkbox\") {\n this.filtersData[option.key] = this.filtersData[option.key] || [];\n if (isChecked) {\n this.filtersData[option.key].push(value);\n\n }\n this.filtersData[option.key] = this.filtersData[option.key].filter(val => val != value);\n }\n this.applyFilters();\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":";;;oGAAA,MAAMA,EAAkB,gH,MCOXC,EAAY,MAEvB,WAAAC,CAAAC,G,2CA4GQC,KAAAC,QAAU,M,qEAGmB,G,0CA9GnCC,MAAMC,MAAMC,GAAG,mBAAmB,IAAMJ,KAAKK,KAAKC,MAAMC,QAAU,SAElEL,MAAMM,KAAKC,UAAS,KAClBT,KAAKU,MAAQR,MAAMM,KAAKG,IAAI,wBAC5BX,KAAKY,MAAQV,MAAMM,KAAKG,IAAI,iCAAiC,IAG/DT,MAAMC,MAAMC,GAAG,oBAAoB,EAAGS,cACpCb,KAAKK,KAAKC,MAAMC,QAAU,GAC1B,IAAIO,EAAkB,GACtBd,KAAKa,QAAUA,EACZE,KAAKC,IACJA,EAAOC,MAAQ,CACbC,YAAahB,MAAMM,KAAKG,IAAI,4BAC5BQ,SAAUjB,MAAMM,KAAKG,IAAI,wBACzBS,OAAQlB,MAAMM,KAAKG,IAAI,kCACvBU,MAAOnB,MAAMM,KAAKG,IAAI,kCACtBK,EAAOM,MAAQN,E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