@salla.sa/twilight-components 2.12.71 → 2.12.72
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/salla-filters-widget.cjs.entry.js +12 -8
- package/dist/cjs/salla-filters-widget.cjs.entry.js.map +1 -1
- package/dist/cjs/salla-price-range.cjs.entry.js +28 -15
- package/dist/cjs/salla-price-range.cjs.entry.js.map +1 -1
- package/dist/cjs/salla-products-list.cjs.entry.js +54 -27
- package/dist/cjs/salla-products-list.cjs.entry.js.map +1 -1
- package/dist/cjs/twilight.cjs.js +1 -1
- package/dist/collection/components/salla-filters-widget/salla-filters-widget.js +12 -8
- package/dist/collection/components/salla-filters-widget/salla-filters-widget.js.map +1 -1
- package/dist/collection/components/salla-price-range/salla-price-range.js +31 -16
- package/dist/collection/components/salla-price-range/salla-price-range.js.map +1 -1
- package/dist/collection/components/salla-products-list/salla-products-list.js +91 -27
- package/dist/collection/components/salla-products-list/salla-products-list.js.map +1 -1
- package/dist/components/salla-filters-widget2.js +12 -8
- package/dist/components/salla-filters-widget2.js.map +1 -1
- package/dist/components/salla-price-range2.js +30 -15
- package/dist/components/salla-price-range2.js.map +1 -1
- package/dist/components/salla-products-list.js +58 -27
- package/dist/components/salla-products-list.js.map +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/salla-filters-widget.entry.js +12 -8
- package/dist/esm/salla-filters-widget.entry.js.map +1 -1
- package/dist/esm/salla-price-range.entry.js +28 -15
- package/dist/esm/salla-price-range.entry.js.map +1 -1
- package/dist/esm/salla-products-list.entry.js +54 -27
- package/dist/esm/salla-products-list.entry.js.map +1 -1
- package/dist/esm/twilight.js +1 -1
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/loader.js.map +1 -1
- package/dist/esm-es5/salla-filters-widget.entry.js +2 -2
- package/dist/esm-es5/salla-filters-widget.entry.js.map +1 -1
- package/dist/esm-es5/salla-price-range.entry.js +2 -2
- package/dist/esm-es5/salla-price-range.entry.js.map +1 -1
- package/dist/esm-es5/salla-products-list.entry.js +2 -2
- package/dist/esm-es5/salla-products-list.entry.js.map +1 -1
- package/dist/esm-es5/twilight.js +1 -1
- package/dist/esm-es5/twilight.js.map +1 -1
- package/dist/twilight/p-06d0f1fc.system.entry.js +5 -0
- package/dist/twilight/p-06d0f1fc.system.entry.js.map +1 -0
- package/dist/twilight/p-2059b78a.system.js +1 -1
- package/dist/twilight/p-2059b78a.system.js.map +1 -1
- package/dist/twilight/{p-2f8608f8.system.entry.js → p-65b34312.system.entry.js} +2 -2
- package/dist/twilight/p-65b34312.system.entry.js.map +1 -0
- package/dist/twilight/p-73543cab.entry.js +5 -0
- package/dist/twilight/p-73543cab.entry.js.map +1 -0
- package/dist/twilight/p-b095f117.system.entry.js +5 -0
- package/dist/twilight/p-b095f117.system.entry.js.map +1 -0
- package/dist/twilight/p-c868470b.entry.js +5 -0
- package/dist/twilight/p-c868470b.entry.js.map +1 -0
- package/dist/twilight/p-f5558708.entry.js +5 -0
- package/dist/twilight/p-f5558708.entry.js.map +1 -0
- package/dist/twilight/twilight.esm.js +1 -1
- package/dist/twilight/twilight.esm.js.map +1 -1
- package/dist/types/components/salla-filters-widget/salla-filters-widget.d.ts +1 -1
- package/dist/types/components/salla-price-range/salla-price-range.d.ts +2 -0
- package/dist/types/components/salla-products-list/salla-products-list.d.ts +14 -1
- package/dist/types/components.d.ts +16 -0
- package/package.json +5 -5
- package/dist/twilight/p-070d4e23.system.entry.js +0 -5
- package/dist/twilight/p-070d4e23.system.entry.js.map +0 -1
- package/dist/twilight/p-098528e4.entry.js +0 -5
- package/dist/twilight/p-098528e4.entry.js.map +0 -1
- package/dist/twilight/p-27fb76ab.entry.js +0 -5
- package/dist/twilight/p-27fb76ab.entry.js.map +0 -1
- package/dist/twilight/p-2f8608f8.system.entry.js.map +0 -1
- package/dist/twilight/p-52890817.entry.js +0 -5
- package/dist/twilight/p-52890817.entry.js.map +0 -1
- package/dist/twilight/p-c944174c.system.entry.js +0 -5
- package/dist/twilight/p-c944174c.system.entry.js.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
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
2
|
/*!
|
|
3
3
|
* Crafted with ❤ by Salla
|
|
4
|
-
*/System.register(["./p-548cb28d.system.js","./p-0826088e.system.js","./p-8f18fe08.system.js"],(function(t){"use strict";var e,i,n,o,s,r,a,l;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.a;l=t.F}],execute:function(){var u=":host{display:block}";var c=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.MINIMUM,a.VARIANTS].includes(t.type)){return""}
|
|
5
|
-
//# sourceMappingURL=p-
|
|
4
|
+
*/System.register(["./p-548cb28d.system.js","./p-0826088e.system.js","./p-8f18fe08.system.js"],(function(t){"use strict";var e,i,n,o,s,r,a,l;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.a;l=t.F}],execute:function(){var u=":host{display:block}";var c=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.MINIMUM,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":t.inputType,checked:l||e.isSelectedOption(t,a),disabled:l,class:"s-filters-".concat(l?"checkbox":t.inputType),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||!this.filtersData[t.key]){return false}return t.inputType===l.CHECKBOX?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}());c.style=u}}}));
|
|
5
|
+
//# sourceMappingURL=p-65b34312.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","MINIMUM","VARIANTS","includes","disabledAndSelectedOption","otherOptions","filterOption","index","value","isDisabledAndSelected","slug","Number","id","label","h","class","htmlFor","opacity","name","inputType","isSelectedOption","disabled","onChange","e","changed","emit","event","getOptionLabel","unshift","push","filtersData","FilterOptionInputType","CHECKBOX","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, FilterOptionInputType, 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.MINIMUM, 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\" : option.inputType}\n checked={isDisabledAndSelected || this.isSelectedOption(option, value)}\n disabled={isDisabledAndSelected}\n class={`s-filters-${isDisabledAndSelected ? \"checkbox\" : option.inputType}`}\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 || !this.filtersData[option.key]) {\n return false\n }\n\n return option.inputType === FilterOptionInputType.CHECKBOX\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":";;;yQAAA,IAAMA,EAAwB,uB,ICQjBC,EAAkBC,EAAA,kC,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ChDxB,EAAA,aAEErE,KAAKU,OAAO4B,OAASC,EAAkBC,MACnCxC,KAAKsD,mBAAmBtD,KAAKU,QAC7B2D,EAAA,qBAAmByB,UAAW,SAACb,GAAU,OAAAzE,EAAKuE,QAAQC,KAAKC,EAAMc,OAAxB,EACzCH,IAAK,SAAAI,GAAS,OAAAxF,EAAKiC,WAAauD,CAAlB,EACdX,YAAarF,KAAKqF,YAClB3E,OAAQV,KAAKU,UAGpBV,KAAKS,cACJ4D,EAAA,KAAGC,MAAM,wBACPqB,QAAS,WAAM,OAAAnF,EAAKwC,UAAL,IAAmBhD,KAAKiD,WAAajD,KAAKoB,cAAgBpB,KAAKsB,gB,yHAtL7D,I"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Crafted with ❤ by Salla
|
|
3
|
+
*/
|
|
4
|
+
import{r as t,c as i,h as e,H as s}from"./p-dd9b5ccb.js";const r=":host{display:block}.rtl .rtl-range-slider,[dir=rtl] .rtl-range-slider{-webkit-transform:rotateY(180deg);transform:rotateY(180deg)}.rtl .rtl-range-numbers,[dir=rtl] .rtl-range-numbers{-ms-flex-direction:row-reverse;flex-direction:row-reverse}.rtl .form-select,.rtl select,[dir=rtl] .form-select,[dir=rtl] select{background-position:left 0.5rem center;padding-right:12px}.rtl .menu-divide li:not(:last-child):after,[dir=rtl] .menu-divide li:not(:last-child):after{left:0;right:auto}input[type=range]::-webkit-slider-thumb{pointer-events:all;width:24px;height:24px;-webkit-appearance:none}[type=checkbox]:checked{background-size:80%}";const l=class{constructor(e){t(this,e);this.changed=i(this,"changed",7);this.filterValues=[];this.minPrice=undefined;this.maxPrice=undefined;this.option=undefined;this.filtersData=undefined;this.min=0;this.max=1e4;this.priceOptions=undefined;this.moreThanLabel="أكثر من";this.lessThanLabel="أقل من";this.toLabel="الى";this.fromLabel="من";this.typing=false;this.debounce=setTimeout((()=>""),1e3)}connectedCallback(){var t;if(this.filtersData&&((t=this.filtersData)===null||t===void 0?void 0:t.price)){this.minPrice=this.filtersData.price.min;this.maxPrice=this.filtersData.price.max}salla.lang.onLoaded((()=>{this.moreThanLabel=salla.lang.getWithDefault("common.elements.more_than",this.moreThanLabel);this.lessThanLabel=salla.lang.getWithDefault("common.elements.less_than",this.lessThanLabel);this.toLabel=salla.lang.getWithDefault("common.elements.to",this.toLabel);this.fromLabel=salla.lang.getWithDefault("common.elements.from",this.fromLabel)}));if(this.option.values.length==1){return}if(this.option.values.length<=5){this.filterValues=this.option.values;return}const i=Math.ceil(this.option.values.length/5);for(let t=0;t<this.option.values.length;t+=i){this.filterValues.push(this.option.values.slice(t,t+i).reduce(((t,i)=>{t.to=i.to;t.count+=i.count;return t})))}}async reset(){this.minInput.value=null;this.maxInput.value=null}getPriceLabel(t){if(isNaN(t.from)||t.from<1){return`${this.lessThanLabel} ${salla.money(t.to)}`}if(isNaN(t.to)||t.to<1){return`${this.moreThanLabel} ${salla.money(t.from)}`}return`${salla.money(t.from)} ${this.toLabel} ${salla.money(t.to)}`}handleMinMaxPrice(t,i){this.minPrice=i.from;this.maxPrice=i.to!="*"?i.to:"";this.changedEventHandler(t)}async changedEventHandler(t,i=false){this.typing=true;salla.helpers.inputDigitsOnly(t.target);let e=t?t.target.value*1:"";clearTimeout(this.debounce);this.debounce=setTimeout((()=>{this.typing=false;if(i){if(!this.maxPrice&&e){this.maxPrice=""}this.minInputValidation(e)}else{if(!this.minPrice&&e){this.minPrice=0}this.maxInputValidation(e)}this.isReady&&this.changed.emit({event:t,option:this.option,value:{max:this.maxPrice,min:this.minPrice}})}),1e3)}minInputValidation(t){if(t&&(t>this.max||this.maxPrice&&t>this.maxPrice)){return}if(t<this.min){this.minPrice=this.min;return}if(t){this.minPrice=t}}maxInputValidation(t){if(t&&(t<this.min||this.minPrice&&t<this.minPrice)){return}if(t>this.max){this.maxPrice=this.max;return}if(t){this.maxPrice=t}}isChecked(t){if(!this.minPrice&&!this.maxPrice){return false}let i=(t.from<1||t.from=="*")&&this.minPrice==0||t.from==this.minPrice;let e=t.to=="*"||!t.to||t.to==this.maxPrice;return i&&e}render(){return e(s,null,this.filterValues.map(((t,i)=>e("label",{class:"s-filters-label",htmlFor:`${this.option.key}-${i}`},e("input",{id:`${this.option.key}-${i}`,name:"price",type:"radio",checked:this.isChecked(t),class:"s-filters-radio",onChange:i=>this.handleMinMaxPrice(i,t)}),this.getPriceLabel(t)))),e("div",{class:"flex justify-center items-center"},e("div",{class:"relative max-w-xl w-full"},e("div",{class:"s-price-range-inputs"},e("div",{class:"s-price-range-relative"},e("div",{class:"s-price-range-currency"}," ",salla.config.currency().symbol),e("input",{type:"number",maxlength:"5",ref:t=>this.minInput=t,onInput:t=>this.changedEventHandler(t,true),value:this.minPrice,placeholder:this.fromLabel,class:"s-price-range-number-input"})),e("div",{class:"s-price-range-gray-text"}," -"),e("div",{class:"s-price-range-relative"},e("div",{class:"s-price-range-currency"}," ",salla.config.currency().symbol),e("input",{type:"number",maxlength:"5",placeholder:this.toLabel,ref:t=>this.maxInput=t,onInput:t=>this.changedEventHandler(t),value:this.maxPrice,class:"s-price-range-number-input","aria-describedby":"price-currency"}))))))}componentDidLoad(){this.isReady=true}};l.style=r;export{l as salla_price_range};
|
|
5
|
+
//# sourceMappingURL=p-73543cab.entry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["sallaPriceRangeCss","SallaPriceRange","this","filterValues","setTimeout","connectedCallback","filtersData","_a","price","minPrice","min","maxPrice","max","salla","lang","onLoaded","moreThanLabel","getWithDefault","lessThanLabel","toLabel","fromLabel","option","values","length","chunkSize","Math","ceil","i","push","slice","reduce","final","currentValue","to","count","reset","minInput","value","maxInput","getPriceLabel","filterValue","isNaN","from","money","handleMinMaxPrice","event","changedEventHandler","isMin","typing","helpers","inputDigitsOnly","target","clearTimeout","debounce","minInputValidation","maxInputValidation","isReady","changed","emit","isChecked","isMinEqual","isMaxEqual","render","h","Host","map","index","class","htmlFor","key","id","name","type","checked","onChange","e","config","currency","symbol","maxlength","ref","el","onInput","placeholder","componentDidLoad"],"sources":["src/components/salla-price-range/salla-price-range.scss?tag=salla-price-range","src/components/salla-price-range/salla-price-range.tsx"],"sourcesContent":[":host {\n display: block;\n}\n\n\n.rtl, [dir=\"rtl\"] {\n .rtl-range-slider {\n transform: rotateY(180deg);\n }\n\n .rtl-range-numbers{\n flex-direction: row-reverse;\n }\n\n .form-select, select{\n background-position: left 0.5rem center;\n padding-right: 12px;\n } \n\n // divide\n.menu-divide {\n li {\n &:not(:last-child) {\n &:after {\n left: 0;\n right: auto;\n }\n }\n }\n}\n}\n\ninput[type=range]::-webkit-slider-thumb {\n pointer-events: all;\n width: 24px;\n height: 24px;\n -webkit-appearance: none;\n}\n\n[type='checkbox']:checked{\n background-size: 80%;\n}","import { Component, Host, h, State, Prop, Event, Method } from '@stencil/core';\nimport { Filter, FilterValue } from \"../salla-filters/interfaces\";\n\n@Component({\n tag: 'salla-price-range',\n styleUrl: 'salla-price-range.scss',\n})\nexport class SallaPriceRange {\n /**\n * Minimum price threshold value\n */\n @Prop({ mutable: true }) minPrice;\n\n /**\n * Maximum price threshold value\n */\n @Prop({ mutable: true }) maxPrice;\n\n /**\n * Product price range filter option object instance\n */\n @Prop({ reflect: true }) option: Filter;\n\n /**\n * Currently selected price filter data\n */\n @Prop({ reflect: true }) filtersData: any;\n\n\n @State() min = 0;\n @State() max = 10000;\n @State() priceOptions: any;\n @State() moreThanLabel: string = \"أكثر من\";\n @State() lessThanLabel: string = \"أقل من\";\n @State() toLabel: string = \"الى\";\n @State() fromLabel: string = \"من\";\n @State() typing: boolean = false;\n @State() debounce: ReturnType<typeof setTimeout> = setTimeout(() => '', 1000);\n /**\n * Custome event emitted when there is a change in price input.\n */\n @Event() changed: any;\n\n isReady: Boolean;\n minInput: HTMLInputElement;\n maxInput: HTMLInputElement;\n filterValues: Array<FilterValue> = [];\n\n\n connectedCallback() {\n if (this.filtersData && this.filtersData?.price) {\n this.minPrice = this.filtersData.price.min;\n this.maxPrice = this.filtersData.price.max;\n }\n salla.lang.onLoaded(() => {\n this.moreThanLabel = salla.lang.getWithDefault('common.elements.more_than', this.moreThanLabel)\n this.lessThanLabel = salla.lang.getWithDefault('common.elements.less_than', this.lessThanLabel)\n this.toLabel = salla.lang.getWithDefault('common.elements.to', this.toLabel)\n this.fromLabel = salla.lang.getWithDefault('common.elements.from', this.fromLabel)\n })\n\n //no need to show one option only\n if (this.option.values.length == 1) {\n return;\n }\n //here we may receive too many prices, we will group all inputs to\n if (this.option.values.length <= 5) {\n this.filterValues = this.option.values;\n return;\n }\n const chunkSize = Math.ceil(this.option.values.length / 5);\n for (let i = 0; i < this.option.values.length; i += chunkSize) {\n this.filterValues.push(\n this.option.values\n .slice(i, i + chunkSize)\n .reduce((final: FilterValue, currentValue: FilterValue) => {\n final.to = currentValue.to;\n final.count += currentValue.count;\n return final;\n })\n );\n // do whatever\n }\n }\n\n /**\n * reset the price range inputs\n */\n @Method()\n async reset() {\n //@ts-ignore\n this.minInput.value = null;\n this.maxInput.value = null;\n }\n\n private getPriceLabel(filterValue: FilterValue) {\n // @ts-ignore\n if (isNaN(filterValue.from) || filterValue.from < 1) {\n return `${this.lessThanLabel} ${salla.money(filterValue.to)}`;\n }\n // @ts-ignore\n if (isNaN(filterValue.to) || filterValue.to < 1) {\n return `${this.moreThanLabel} ${salla.money(filterValue.from)}`;\n }\n\n return `${salla.money(filterValue.from)} ${this.toLabel} ${salla.money(filterValue.to)}`;\n }\n\n private handleMinMaxPrice(event: Event, value: FilterValue): void {\n\n //todo:: cover when from is star\n this.minPrice = value.from;\n this.maxPrice = value.to != '*' ? value.to : \"\";\n\n this.changedEventHandler(event);\n }\n\n private async changedEventHandler(event, isMin = false) {\n this.typing = true;\n salla.helpers.inputDigitsOnly(event.target)\n let value = event ? event.target.value * 1 : \"\"\n clearTimeout(this.debounce)\n this.debounce = setTimeout(() => {\n this.typing = false\n if (isMin) {\n if (!this.maxPrice && value) {\n this.maxPrice = '';\n }\n this.minInputValidation(value);\n } else {\n if (!this.minPrice && value) {\n this.minPrice = 0;\n }\n this.maxInputValidation(value)\n }\n\n this.isReady && this.changed.emit({\n event: event,\n option: this.option,\n value: { max: this.maxPrice, min: this.minPrice }\n })\n\n }, 1000)\n }\n\n\n minInputValidation(value) {\n if (value && (value > this.max || (this.maxPrice && value > this.maxPrice))) {\n // this.minPrice = this.maxPrice;\n return;\n }\n\n if (value < this.min) {\n this.minPrice = this.min;\n return;\n }\n\n if (value) {\n this.minPrice = value;\n }\n }\n\n maxInputValidation(value) {\n if (value && (value < this.min || (this.minPrice && value < this.minPrice))) {\n // this.maxPrice = this.minPrice;\n return;\n }\n if (value > this.max) {\n this.maxPrice = this.max;\n return;\n }\n\n if (value) {\n this.maxPrice = value;\n }\n }\n\n private isChecked(filterValue: FilterValue) {\n if (!this.minPrice && !this.maxPrice) {\n return false;\n }\n\n //1 filterValue.from zero or * and this.minPrice not set or zero\n //2 filterValue.from == this.minPrice\n //@ts-ignore\n let isMinEqual = ((filterValue.from < 1 || filterValue.from == '*') && this.minPrice == 0) || filterValue.from == this.minPrice;\n\n //1 filterValue.to == \"*\" or null\n //2 filterValue.to == this.max\n let isMaxEqual = filterValue.to == '*' || !filterValue.to || filterValue.to == this.maxPrice;\n return isMinEqual && isMaxEqual;\n }\n\n\n render() {\n return (\n <Host>\n {\n this.filterValues.map((filterValue: FilterValue, index: number) => {\n return <label class=\"s-filters-label\" htmlFor={`${this.option.key}-${index}`}>\n <input\n id={`${this.option.key}-${index}`}\n name=\"price\"\n type=\"radio\"\n checked={this.isChecked(filterValue)}\n class=\"s-filters-radio\"\n onChange={e => this.handleMinMaxPrice(e, filterValue)}\n />\n {this.getPriceLabel(filterValue)}\n </label>\n })\n }\n\n\n <div class=\"flex justify-center items-center\">\n <div class=\"relative max-w-xl w-full\">\n <div class=\"s-price-range-inputs\">\n <div class=\"s-price-range-relative\">\n <div class=\"s-price-range-currency\"> {salla.config.currency().symbol}</div>\n <input\n type=\"number\"\n maxlength=\"5\"\n ref={el => this.minInput = el}\n onInput={(event) => this.changedEventHandler(event, true)}\n value={this.minPrice}\n placeholder={this.fromLabel}\n class=\"s-price-range-number-input\"\n />\n </div>\n\n <div class=\"s-price-range-gray-text\"> -</div>\n <div class=\"s-price-range-relative\">\n <div class=\"s-price-range-currency\"> {salla.config.currency().symbol}</div>\n <input type=\"number\" maxlength=\"5\"\n placeholder={this.toLabel}\n ref={el => this.maxInput = el}\n onInput={(event) => this.changedEventHandler(event)}\n value={this.maxPrice}\n class=\"s-price-range-number-input\" aria-describedby=\"price-currency\" />\n </div>\n </div>\n </div>\n </div>\n </Host>\n );\n }\n\n componentDidLoad() {\n this.isReady = true;\n }\n}\n"],"mappings":";;;yDAAA,MAAMA,EAAqB,0nB,MCOdC,EAAe,M,0DAuC1BC,KAAAC,aAAmC,G,0GAjBpB,E,SACA,I,+CAEkB,U,mBACA,S,aACN,M,eACE,K,YACF,M,cACwBC,YAAW,IAAM,IAAI,I,CAYxE,iBAAAC,G,MACE,GAAIH,KAAKI,eAAeC,EAAAL,KAAKI,eAAW,MAAAC,SAAA,SAAAA,EAAEC,OAAO,CAC/CN,KAAKO,SAAWP,KAAKI,YAAYE,MAAME,IACvCR,KAAKS,SAAWT,KAAKI,YAAYE,MAAMI,G,CAEzCC,MAAMC,KAAKC,UAAS,KAClBb,KAAKc,cAAgBH,MAAMC,KAAKG,eAAe,4BAA6Bf,KAAKc,eACjFd,KAAKgB,cAAgBL,MAAMC,KAAKG,eAAe,4BAA6Bf,KAAKgB,eACjFhB,KAAKiB,QAAUN,MAAMC,KAAKG,eAAe,qBAAsBf,KAAKiB,SACpEjB,KAAKkB,UAAYP,MAAMC,KAAKG,eAAe,uBAAwBf,KAAKkB,UAAU,IAIpF,GAAIlB,KAAKmB,OAAOC,OAAOC,QAAU,EAAG,CAClC,M,CAGF,GAAIrB,KAAKmB,OAAOC,OAAOC,QAAU,EAAG,CAClCrB,KAAKC,aAAeD,KAAKmB,OAAOC,OAChC,M,CAEF,M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mB,OAAOgD,OAAOH,IAC1BK,KAAK,QACLC,KAAK,QACLC,QAASvE,KAAKyD,UAAUnB,GACxB2B,MAAM,kBACNO,SAAUC,GAAKzE,KAAK0C,kBAAkB+B,EAAGnC,KAE1CtC,KAAKqC,cAAcC,MAM1BuB,EAAA,OAAKI,MAAM,oCACTJ,EAAA,OAAKI,MAAM,4BACTJ,EAAA,OAAKI,MAAM,wBACTJ,EAAA,OAAKI,MAAM,0BACTJ,EAAA,OAAKI,MAAM,0BAAwB,IAAGtD,MAAM+D,OAAOC,WAAWC,QAC9Df,EAAA,SACES,KAAK,SACLO,UAAU,IACVC,IAAKC,GAAM/E,KAAKkC,SAAW6C,EAC3BC,QAAUrC,GAAU3C,KAAK4C,oBAAoBD,EAAO,MACpDR,MAAOnC,KAAKO,SACZ0E,YAAajF,KAAKkB,UAClB+C,MAAM,gCAIVJ,EAAA,OAAKI,MAAM,2BAAyB,MACpCJ,EAAA,OAAKI,MAAM,0BACTJ,EAAA,OAAKI,MAAM,0BAAwB,IAAGtD,MAAM+D,OAAOC,WAAWC,QAC9Df,EAAA,SAAOS,KAAK,SAASO,UAAU,IAC7BI,YAAajF,KAAKiB,QAClB6D,IAAKC,GAAM/E,KAAKoC,SAAW2C,EAC3BC,QAAUrC,GAAU3C,KAAK4C,oBAAoBD,GAC7CR,MAAOnC,KAAKS,SACZwD,MAAM,6BAA4B,mBAAkB,uB,CASpE,gBAAAiB,GACElF,KAAKsD,QAAU,I"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
var __awaiter=this&&this.__awaiter||function(e,t,n,i){function r(e){return e instanceof n?e:new n((function(t){t(e)}))}return new(n||(n=Promise))((function(n,o){function a(e){try{l(i.next(e))}catch(e){o(e)}}function s(e){try{l(i["throw"](e))}catch(e){o(e)}}function l(e){e.done?n(e.value):r(e.value).then(a,s)}l((i=i.apply(e,t||[])).next())}))};var __generator=this&&this.__generator||function(e,t){var n={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},i,r,o,a;return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(e){return function(t){return l([e,t])}}function l(s){if(i)throw new TypeError("Generator is already executing.");while(a&&(a=0,s[0]&&(n=0)),n)try{if(i=1,r&&(o=s[0]&2?r["return"]:s[0]?r["throw"]||((o=r["return"])&&o.call(r),0):r.next)&&!(o=o.call(r,s[1])).done)return o;if(r=0,o)s=[s[0]&2,o.value];switch(s[0]){case 0:case 1:o=s;break;case 4:n.label++;return{value:s[1],done:false};case 5:n.label++;r=s[1];s=[0];continue;case 7:s=n.ops.pop();n.trys.pop();continue;default:if(!(o=n.trys,o=o.length>0&&o[o.length-1])&&(s[0]===6||s[0]===2)){n=0;continue}if(s[0]===3&&(!o||s[1]>o[0]&&s[1]<o[3])){n.label=s[1];break}if(s[0]===6&&n.label<o[1]){n.label=o[1];o=s;break}if(o&&n.label<o[2]){n.label=o[2];n.ops.push(s);break}if(o[2])n.ops.pop();n.trys.pop();continue}s=t.call(e,n)}catch(e){s=[6,e];r=0}finally{i=o=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:true}}};
|
|
2
|
+
/*!
|
|
3
|
+
* Crafted with ❤ by Salla
|
|
4
|
+
*/System.register(["./p-548cb28d.system.js","./p-8f7b9e36.system.js","./p-0826088e.system.js"],(function(e){"use strict";var t,n,i,r,o,a,s;return{setters:[function(e){t=e.r;n=e.c;i=e.h;r=e.H;o=e.g},function(e){a=e.a},function(e){s=e.H}],execute:function(){var l='\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>shopping-bag</title>\n<path d="M28 10.667h-4v-2.667c0-4.412-3.588-8-8-8s-8 3.588-8 8v2.667h-4c-0.736 0-1.333 0.596-1.333 1.333v13.333c0 3.676 2.991 6.667 6.667 6.667h13.333c3.676 0 6.667-2.991 6.667-6.667v-13.333c0-0.737-0.597-1.333-1.333-1.333zM10.667 8c0-2.941 2.392-5.333 5.333-5.333s5.333 2.392 5.333 5.333v2.667h-10.667zM26.667 25.333c0 2.205-1.795 4-4 4h-13.333c-2.205 0-4-1.795-4-4v-12h2.667v2.667c0 0.737 0.597 1.333 1.333 1.333s1.333-0.596 1.333-1.333v-2.667h10.667v2.667c0 0.737 0.597 1.333 1.333 1.333s1.333-0.596 1.333-1.333v-2.667h2.667z"></path>\n</svg>\n';var c="";var u=e("salla_products_list",function(){function e(e){var i=this;t(this,e);this.productsFetched=n(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((function(){i.placeholderText=salla.lang.get("pages.categories.no_products");i.endOfText=salla.lang.get("common.elements.end_of_content");i.failedLoadMore=salla.lang.get("common.elements.failed_to_load_more")}))}e.prototype.connectedCallback=function(){var e=this;salla.event.on("salla-filters::changed",(function(t){return e.setFilters(t)}))};e.prototype.setFilters=function(e){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){if(!!e&&JSON.stringify(this.parsedFilters)===JSON.stringify(e)){return[2]}window.scrollTo({top:0,behavior:"smooth"});this.parsedFilters=e;return[2,this.reload()]}))}))};e.prototype.reload=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){!this.autoload&&this.loadMoreWrapper&&(this.loadMoreWrapper.style.display="none");salla.infiniteScroll.destroy(this.infiniteScroll);this.buildNextPageUrl();this.wrapper.innerHTML="";this.init();return[2]}))}))};e.prototype.isFilterable=function(){return salla.config.get("store.settings.product.filters")&&this.filtersResults};e.prototype.isSourceWithoutValue=function(){return["offers","latest","sales"].includes(this.getSource())};e.prototype.animateItems=function(){a({targets:"salla-products-list salla-product-card",opacity:[0,1],duration:1200,translateY:[20,0],delay:function(e,t){return t*100}})};e.prototype.initBaseNextPageUrl=function(e){var t=this;this.nextPage=salla.url.api("products?source=".concat(e));if(this.limit){this.nextPage+="&per_page=".concat(this.limit>32?32:this.limit)}if(this.sortBy){this.nextPage+="&sort=".concat(this.sortBy)}this.nextPage+="&filterable=1";var n=function(e,n){if(["string","number"].includes(typeof n)){i.nextPage+="&filters[".concat(encodeURIComponent(e),"]=").concat(encodeURIComponent(n))}else if(Array.isArray(n)){n.forEach((function(n){return t.nextPage+="&filters[".concat(encodeURIComponent(e),"][]=").concat(encodeURIComponent(n))}))}else if(typeof n==="object"){for(var r=0,o=Object.entries(n);r<o.length;r++){var a=o[r],s=a[0],l=a[1];i.nextPage+="&filters[".concat(encodeURIComponent(e),"][").concat(encodeURIComponent(s),"]=").concat(encodeURIComponent(l))}}};var i=this;for(var r=0,o=Object.entries(this.parsedFilters||{});r<o.length;r++){var a=o[r],s=a[0],l=a[1];n(s,l)}};e.prototype.buildNextPageUrl=function(){var e=this.getSource();if(e==="json"){return}this.initBaseNextPageUrl(e);if(this.isSourceWithoutValue()){return}if(["search","related","landing-page"].includes(e)){this.nextPage+="&source_value=".concat(this.getSourceValue());return}try{this.nextPage+="&source_value[]=".concat(this.getSourceValue().join("&source_value[]="))}catch(t){salla.logger.warn('source-value prop should be array of ids ex source-value="[1,2,3]" for the source ['.concat(e,"]"));this.sourceValueIsValid=false}};e.prototype.loading=function(e,t){if(e===void 0){e=true}if(t===void 0){t=false}if(!e){if(!this.autoload){this.btnLoader&&(this.btnLoader.style.display="none")}this.loader&&(this.loader.style.display="none")}else{var n=t&&!this.autoload?this.btnLoader:this.loader;n&&(n.style.display="inherit")}};e.prototype.getItemHTML=function(e){this.getSource()==="landing-page"&&(e.url="");var t=this.hasCustomComponent?this.productCardComponent:"salla-product-card";var n=document.createElement(t);n.product=e;this.applyLandingPageStyles(n);this.applyHorizontalCardStyles(n);return n};e.prototype.applyLandingPageStyles=function(e){if(this.getSource()==="landing-page"&&!this.hasCustomComponent){e.toggleAttribute("hide-add-btn",true);e.classList.add("s-product-card-fit-height")}};e.prototype.applyHorizontalCardStyles=function(e){if(!this.horizontalCards){return}e.setAttribute("horizontal",true);if(!this.hasCustomComponent){e.setAttribute("shadow-on-hover",true)}};e.prototype.getSource=function(){return s.getProductsSource(this.source)};e.prototype.getSourceValue=function(){return s.getProductsSourceValue(this.source,this.sourceValue)};e.prototype.appendDataLayer=function(e){var t=document.createElement("script");var n={event:"impressions",ecommerce:{currencyCode:salla.config.get("user.currency_code"),impressions:e.map((function(e){return{id:e.id,name:e.name,price:e.price,brand:"",quantity:e.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")}}};t.appendChild(document.createTextNode("window.dataLayer = window.dataLayer || [];"));t.appendChild(document.createTextNode("window.dataLayer.push("+JSON.stringify(n)+");"));document.head.appendChild(t)};e.prototype.initiateInfiniteScroll=function(){var e=this;var t,n,i;if(!this.hasInfiniteScroll){return}this.infiniteScroll=salla.infiniteScroll.initiate(this.wrapper,this.wrapper,{path:function(){return e.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",(function(){e.loading(true,e.autoload?false:true)}));(n=this.infiniteScroll)===null||n===void 0?void 0:n.on("load",(function(t){var n;if(!((n=t.data)===null||n===void 0?void 0:n.length)&&e.infiniteScroll.pageIndex==2){e.showPlaceholder=true;salla.infiniteScroll.destroy(e.infiniteScroll);e.loading(false);return}else{e.showPlaceholder=false}e.infiniteScroll.appendItems(e.handleResponse(t));if(e.infiniteScroll.pageIndex==2){if(!e.autoload&&e.nextPage){e.loadMoreWrapper.style.display="block"}e.animateItems()}}));(i=this.infiniteScroll)===null||i===void 0?void 0:i.on("error",(function(){e.status.querySelector(".s-infinite-scroll-error").classList.remove("s-hidden");e.loading(false)}));salla.onReady((function(){return salla.infiniteScroll.loadNextPage(e.infiniteScroll)}))};e.prototype.loadMore=function(){return __awaiter(this,void 0,void 0,(function(){var e;return __generator(this,(function(t){(e=this.infiniteScroll)===null||e===void 0?void 0:e.loadNextPage();return[2]}))}))};e.prototype.componentWillLoad=function(){var e=this;return s.onSallaReadyPromise((function(){e.hasCustomComponent=!!customElements.get(e.productCardComponent);e.sourceValueIsValid=!!(e.getSourceValue()||e.isSourceWithoutValue());e.hasInfiniteScroll=!["json","selected","related","landing-page"].includes(e.getSource())&&!e.limit;try{var t=new URLSearchParams(window.location.search);e.sortBy=e.sortBy||t.get("sort")||t.get("by");var n={};t.forEach((function(e,t){var i=t.match(/^filters\[(\w+)\](\[(\w+)\])?$/);if(i){var r=i[1];var o=i[3];if(o){n[r]=n[r]||{};n[r][o]=e}else{n[r]=e}}}));e.parsedFilters=n}catch(e){salla.logger.warn("failed to get filters from url",e.message)}e.buildNextPageUrl();e.isReady=true;if(!e.sourceValueIsValid){salla.logger.warn("source-value prop is required for source [".concat(e.getSource(),"]"));return}if(e.hasInfiniteScroll){return}if(e.getSource()==="json"){if(!e.getSourceValue().length){e.showPlaceholder=true;return}setTimeout((function(){e.getSourceValue().map((function(t){return e.wrapper.append(e.getItemHTML(t))}))}));return}if(e.getSource()==="selected"&&!e.getSourceValue().length){e.showPlaceholder=true;return}return s.fetchProducts(e.getSource(),e.getSourceValue(),e.limit).then((function(t){if(!t.data.length){e.showPlaceholder=true;e.loading(false);return}setTimeout((function(){e.handleResponse(t).forEach((function(t){return e.wrapper.append(t)}))}),100)}))}))};e.prototype.canRender=function(){return this.sourceValueIsValid&&this.isReady};e.prototype.render=function(){var e=this;if(!this.canRender()){return""}if(this.showPlaceholder){return i("div",{class:"s-products-list-placeholder"},i("span",{innerHTML:l}),i("p",null,this.placeholderText))}return i(r,{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:function(t){return e.wrapper=t}}),i("div",{class:"s-infinite-scroll-status",ref:function(t){return e.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)),this.hasInfiniteScroll&&i("div",{class:"s-products-list-loading-wrapper",style:{display:"none"},ref:function(t){return e.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:function(t){return e.loadMoreWrapper=t}},i("button",{onClick:function(){return e.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:function(t){return e.btnLoader=t},style:{display:"none"}}))):"")};e.prototype.componentDidLoad=function(){this.hasInfiniteScroll&&this.init()};e.prototype.init=function(){this.initiateInfiniteScroll();this.loading()};e.prototype.handleResponse=function(e){var t=this;var n,i,r,o,a,l;var c=this.getSource();var u="";if(((n=e.cursor)===null||n===void 0?void 0:n.current)===1){u=s.getPageTitleForSource(c);try{if(this.getSource()==="search"){u=salla.lang.get("common.elements.search_about",{word:this.getSourceValue()})}else if(!u){var d=this.parsedFilters.category_id||this.getSourceValue()[0];u=((o=(r=(i=e.filters.find((function(e){return e.key=="category_id"})))===null||i===void 0?void 0:i.values)===null||r===void 0?void 0:r.find((function(e){return e.key==d})))===null||o===void 0?void 0:o.value)||""}u+=(u?" - ":"")+salla.lang.choice("blocks.header.products_count",(a=e.data)===null||a===void 0?void 0:a.length);if(e.data.length===15){u=u.replace(e.data.length,salla.lang.get("common.elements.more_than")+" "+e.data.length)}e.title=u}catch(e){}}salla.event.emit("salla-products-list::products.fetched",e);this.productsFetched.emit(e);if(e.filters&&this.isFilterable()){this.filtersResults=true;salla.event.emit("filters::fetched",{filters:e.filters})}else if(this.isFilterable()){salla.event.emit("filters::hidden")}this.nextPage=e.cursor?e.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((l=e.data)===null||l===void 0?void 0:l.map((function(e){return t.getItemHTML(e)})))||[]};Object.defineProperty(e.prototype,"host",{get:function(){return o(this)},enumerable:false,configurable:true});return e}());u.style=c}}}));
|
|
5
|
+
//# sourceMappingURL=p-b095f117.system.entry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["sallaProductsListCss","SallaProductsList","exports","class_1","hostRef","_this","this","salla","lang","get","onLoaded","placeholderText","endOfText","failedLoadMore","prototype","connectedCallback","event","on","filters","setFilters","JSON","stringify","parsedFilters","window","scrollTo","top","behavior","reload","autoload","loadMoreWrapper","style","display","infiniteScroll","destroy","buildNextPageUrl","wrapper","innerHTML","init","isFilterable","config","filtersResults","isSourceWithoutValue","includes","getSource","animateItems","anime","targets","opacity","duration","translateY","delay","_el","i","initBaseNextPageUrl","source","nextPage","url","api","concat","limit","sortBy","key","value","this_1","encodeURIComponent","Array","isArray","forEach","item","_j","_k","Object","entries","length","_l","k","v","_i","_g","_h","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","hasInfiniteScroll","initiate","path","history","scrollThreshold","loadOnScroll","_a","_b","response","pageIndex","showPlaceholder","appendItems","handleResponse","_c","status","querySelector","remove","onReady","loadNextPage","loadMore","componentWillLoad","onSallaReadyPromise","customElements","searchParams","URLSearchParams","location","search","filters_1","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_1","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 salla.infiniteScroll.destroy(this.infiniteScroll);\n this.buildNextPageUrl();\n // TODO: this is problematic in testing, for the time being it's been resolved like this\n this.wrapper.innerHTML = '';\n this.init();\n }\n\n\n private status: HTMLDivElement;\n private btnLoader: 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 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\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 {this.hasInfiniteScroll && <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":";;;q9BAAA,IAAMA,EAAuB,G,ICQhBC,EAAiBC,EAAA,iCAC5B,SAAAC,EAAAC,GAAA,IAAAC,EAAAC,K,kOAyF6C,M,sDAgBN,4B,UAGf,E,kJAKWC,MAAMC,KAAKC,IAAI,gC,eACrBF,MAAMC,KAAKC,IAAI,kC,oBACVF,MAAMC,KAAKC,IAAI,uC,mFAlH/CF,MAAMC,KAAKE,UAAS,WAClBL,EAAKM,gBAAkBJ,MAAMC,KAAKC,IAAI,gCACtCJ,EAAKO,UAAYL,MAAMC,KAAKC,IAAI,kCAChCJ,EAAKQ,eAAiBN,MAAMC,KAAKC,IAAI,sC,IAGzCN,EAAAW,UAAAC,kBAAA,eAAAV,EAAAC,KACEC,MAAMS,MAAMC,GAA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,MAAMyL,KAAK,wCAAyCzD,GAC1D1I,KAAKoM,gBAAgBD,KAAKzD,GAE1B,GAAIA,EAAS9H,SAAWZ,KAAKgC,eAAgB,CAC3ChC,KAAKkC,eAAiB,KACtBjC,MAAMS,MAAMyL,KAAK,mBAAoB,CAAEvL,QAAS8H,EAAS9H,S,MACpD,GAAIZ,KAAKgC,eAAgB,CAC9B/B,MAAMS,MAAMyL,KAAK,kB,CAEnBnM,KAAKiD,SAAWyF,EAAS2C,OAAS3C,EAAS2C,OAAOgB,KAAOrM,KAAKiD,SAC9DjD,KAAKgF,QAAQ,OACb,GAAIhF,KAAKkI,oBAAsBlI,KAAKiD,SAAU,CAC5CjD,KAAK0B,eAAe4K,OAAO,CAAEhE,gBAAiB,MAAOC,aAAc,QACnEvI,KAAKgJ,OAAOC,cAAc,2BAA2BhD,UAAUiD,OAAO,W,CAExE,QAAOqD,EAAA7D,EAAShC,QAAI,MAAA6F,SAAA,SAAAA,EAAEvF,KAAI,SAAAzB,GAAW,OAAAxF,EAAKuF,YAAYC,EAAjB,MAA8B,E,yHAtfzC,I"}
|
|
@@ -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{a,F as n}from"./p-61ac07f6.js";const r=":host{display:block}";const o=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.MINIMUM,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":s.inputType,checked:n||this.isSelectedOption(s,a),disabled:n,class:`s-filters-${n?"checkbox":s.inputType}`,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||!this.filtersData[s.key]){return false}return s.inputType===n.CHECKBOX?this.filtersData[s.key].includes(t):this.filtersData[s.key]==t}getOptionLabel(s,t){if(s.key=="rating"){return i("salla-rating-stars",{size:"small",value:t})}let e=t.value||"null";return i("span",{class:"s-filters-option-name"},e)}render(){return i(e,{class:"s-filters-widget-container"},i("h3",{class:"s-filters-widget-title",onClick:()=>this.toggleWidget()},i("span",null,this.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)}};o.style=r;export{o as salla_filters_widget};
|
|
5
|
+
//# sourceMappingURL=p-c868470b.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","MINIMUM","VARIANTS","includes","disabledAndSelectedOption","otherOptions","filterOption","index","value","isDisabledAndSelected","slug","Number","id","label","h","class","htmlFor","opacity","name","inputType","isSelectedOption","disabled","onChange","e","changed","emit","event","getOptionLabel","unshift","push","concat","filtersData","FilterOptionInputType","CHECKBOX","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, FilterOptionInputType, 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.MINIMUM, 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\" : option.inputType}\n checked={isDisabledAndSelected || this.isSelectedOption(option, value)}\n disabled={isDisabledAndSelected}\n class={`s-filters-${isDisabledAndSelected ? \"checkbox\" : option.inputType}`}\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 || !this.filtersData[option.key]) {\n return false\n }\n\n return option.inputType === FilterOptionInputType.CHECKBOX\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":";;;0IAAA,MAAMA,EAAwB,uB,MCQjBC,EAAkB,M,0DAwBrBC,KAAAC,WAAqB,I,yFAEF,K,gBACI,M,mBACE,a,mBACA,U,UACZC,MAAMC,OAAOC,IAAI,O,C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{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");salla.infiniteScroll.destroy(this.infiniteScroll);this.buildNextPageUrl();this.wrapper.innerHTML="";this.init()}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 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)),this.hasInfiniteScroll&&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-f5558708.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","infiniteScroll","destroy","buildNextPageUrl","wrapper","innerHTML","init","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","hasInfiniteScroll","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 salla.infiniteScroll.destroy(this.infiniteScroll);\n this.buildNextPageUrl();\n // TODO: this is problematic in testing, for the time being it's been resolved like this\n this.wrapper.innerHTML = '';\n this.init();\n }\n\n\n private status: HTMLDivElement;\n private btnLoader: 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 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\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 {this.hasInfiniteScroll && <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,kOAyF6C,M,sDAgBN,4B,UAGf,E,kJAKWC,MAAMC,KAAKC,IAAI,gC,eACrBF,MAAMC,KAAKC,IAAI,kC,oBACVF,MAAMC,KAAKC,IAAI,uC,mFAlH/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,I,CAQtE,gBAAMC,CAAWD,GACf,KAAMA,GAAWE,KAAKC,UAAUV,KAAKW,iBAAmBF,KAAKC,UAAUH,GAAU,CAC/E,M,CAEFK,OAAOC,SAAS,CAAEC,IAAK,EAAGC,SAAU,WACpCf,KAAKW,cAAgBJ,EACrB,OAAOP,KAAKgB,Q,CAOd,YAAMA,IACHhB,KAAKiB,UAAYjB,KAAKkB,kBAAoBlB,KAAKkB,gBAAgBC,MAAMC,QAAU,QAChFxB,MAAMyB,eAAeC,QAAQtB,KAAKqB,gBAClCrB,KAAKuB,mBAELvB,KAAKwB,QAAQC,UAAY,GACzBzB,KAAK0B,M,CA2FC,YAAA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AKoH,oBAAsBpH,KAAK4C,SAAU,CAC5C5C,KAAKqB,eAAemK,OAAO,CAAEhE,gBAAiB,MAAOC,aAAc,QACnEzH,KAAKmI,OAAOC,cAAc,2BAA2BjD,UAAUkD,OAAO,W,CAExE,QAAOoD,EAAA7D,EAAShC,QAAI,MAAA6F,SAAA,SAAAA,EAAEvF,KAAIzB,GAAWzE,KAAKwE,YAAYC,OAAa,E"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{p as e,b as a}from"./p-dd9b5ccb.js";export{s as setNonce}from"./p-dd9b5ccb.js";import{g as t}from"./p-66395721.js";import"./p-f84bae34.js";const o=()=>{const a=import.meta.url;const t={};if(a!==""){t.resourcesUrl=new URL(".",a).href}return e(t)};o().then((e=>{t();return a(JSON.parse('[["p-55355e64",[[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-03170ed5",[[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-412d8d1c",[[0,"salla-filters",{"filters":[1040],"isSidebarOpen":[32],"filtersData":[32],"apply":[32],"reset":[32],"getFilters":[64],"applyFilters":[64],"resetFilters":[64]}]]],["p-19548833",[[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-37d0c076",[[0,"salla-advertisement",{"position":[32],"advertisements":[32],"advertIcon":[32],"currentSlug":[32]}]]],["p-89564b2e",[[0,"salla-apps-icons",{"hideTitle":[4,"hide-title"],"appsTitle":[1,"apps-title"],"vertical":[4],"apps":[32]}]]],["p-902f747a",[[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-38ddeb9e",[[0,"salla-installment",{"price":[1],"language":[1],"currency":[1],"tamaraIsActive":[32],"tabbyIsActive":[32],"spotiiIsActive":[32]}]]],["p-041f94a6",[[0,"salla-loyalty-prize-item",{"item":[16]}]]],["p-3d58cecc",[[0,"salla-payments",{"withSbc":[4,"with-sbc"],"sbcId":[1,"sbc-id"],"withMadeInKsa":[4,"with-made-in-ksa"],"payments":[32],"placeholderImage":[32]}]]],["p-098528e4",[[0,"salla-products-list",{"source":[1537],"sourceValue":[1032,"source-value"],"limit":[1026],"sortBy":[1025,"sort-by"],"filtersResults":[1540,"filters-results"],"horizontalCards":[516,"horizontal-cards"],"productCardComponent":[1,"product-card-component"],"page":[32],"nextPage":[32],"hasInfiniteScroll":[32],"hasCustomComponent":[32],"sourceValueIsValid":[32],"placeholderText":[32],"isReady":[32],"showPlaceholder":[32],"parsedFilters":[32],"setFilters":[64],"reload":[64]}]]],["p-b7b592bc",[[0,"salla-social",{"links":[32],"iconsList":[32]}]]],["p-3834f37c",[[4,"salla-conditional-fields",null,[[0,"change","changeHandler"]]]]],["p-2768c606",[[0,"salla-notification-item",{"notification":[16]}]]],["p-52890817",[[0,"salla-price-range",{"minPrice":[1032,"min-price"],"maxPrice":[1032,"max-price"],"option":[16],"filtersData":[520,"filters-data"],"min":[32],"max":[32],"priceOptions":[32],"moreThanLabel":[32],"lessThanLabel":[32],"toLabel":[32],"fromLabel":[32],"reset":[64]}]]],["p-29f9af2d",[[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]}]]],["p-27fb76ab",[[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]}]]]]'),e)}));
|
|
4
|
+
import{p as e,b as a}from"./p-dd9b5ccb.js";export{s as setNonce}from"./p-dd9b5ccb.js";import{g as t}from"./p-66395721.js";import"./p-f84bae34.js";const o=()=>{const a=import.meta.url;const t={};if(a!==""){t.resourcesUrl=new URL(".",a).href}return e(t)};o().then((e=>{t();return a(JSON.parse('[["p-55355e64",[[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-03170ed5",[[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-412d8d1c",[[0,"salla-filters",{"filters":[1040],"isSidebarOpen":[32],"filtersData":[32],"apply":[32],"reset":[32],"getFilters":[64],"applyFilters":[64],"resetFilters":[64]}]]],["p-19548833",[[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-37d0c076",[[0,"salla-advertisement",{"position":[32],"advertisements":[32],"advertIcon":[32],"currentSlug":[32]}]]],["p-89564b2e",[[0,"salla-apps-icons",{"hideTitle":[4,"hide-title"],"appsTitle":[1,"apps-title"],"vertical":[4],"apps":[32]}]]],["p-902f747a",[[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-38ddeb9e",[[0,"salla-installment",{"price":[1],"language":[1],"currency":[1],"tamaraIsActive":[32],"tabbyIsActive":[32],"spotiiIsActive":[32]}]]],["p-041f94a6",[[0,"salla-loyalty-prize-item",{"item":[16]}]]],["p-3d58cecc",[[0,"salla-payments",{"withSbc":[4,"with-sbc"],"sbcId":[1,"sbc-id"],"withMadeInKsa":[4,"with-made-in-ksa"],"payments":[32],"placeholderImage":[32]}]]],["p-f5558708",[[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-b7b592bc",[[0,"salla-social",{"links":[32],"iconsList":[32]}]]],["p-3834f37c",[[4,"salla-conditional-fields",null,[[0,"change","changeHandler"]]]]],["p-2768c606",[[0,"salla-notification-item",{"notification":[16]}]]],["p-73543cab",[[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-29f9af2d",[[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]}]]],["p-c868470b",[[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]}]]]]'),e)}));
|
|
5
5
|
//# sourceMappingURL=twilight.esm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["patchBrowser","importMeta","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":";;;kJAKA,MAAMA,EAAe,KAyBjB,MAAMC,cAAyBC,IAC/B,MAAMC,EAAqE,GAC3E,GAAIF,IAAe,GAAI,CACnBE,EAAKC,aAAe,IAAIC,IAAI,IAAKJ,GAAYK,IACrD,CACI,OAAOC,EAAeJ,EAAK,EC/B/BH,IAAeQ,MAAKC,IAClBC,IACA,OAAOC,EAAcC,KAAAC,MAAA,
|
|
1
|
+
{"version":3,"names":["patchBrowser","importMeta","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":";;;kJAKA,MAAMA,EAAe,KAyBjB,MAAMC,cAAyBC,IAC/B,MAAMC,EAAqE,GAC3E,GAAIF,IAAe,GAAI,CACnBE,EAAKC,aAAe,IAAIC,IAAI,IAAKJ,GAAYK,IACrD,CACI,OAAOC,EAAeJ,EAAK,EC/B/BH,IAAeQ,MAAKC,IAClBC,IACA,OAAOC,EAAcC,KAAAC,MAAA,yqmBAAuCJ,EAAA"}
|