@salla.sa/twilight-components 2.11.100 → 2.11.102
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/salla-products-list.cjs.entry.js +8 -6
- package/dist/cjs/salla-products-list.cjs.entry.js.map +1 -1
- package/dist/collection/components/salla-products-list/salla-products-list.js +8 -6
- package/dist/collection/components/salla-products-list/salla-products-list.js.map +1 -1
- package/dist/components/salla-products-list.js +8 -6
- package/dist/components/salla-products-list.js.map +1 -1
- package/dist/esm/salla-products-list.entry.js +8 -6
- package/dist/esm/salla-products-list.entry.js.map +1 -1
- package/dist/esm-es5/salla-products-list.entry.js +1 -1
- package/dist/esm-es5/salla-products-list.entry.js.map +1 -1
- package/dist/twilight/p-1b5ffc6d.system.js +1 -1
- package/dist/twilight/p-3f6bca30.entry.js +5 -0
- package/dist/twilight/p-3f6bca30.entry.js.map +1 -0
- package/dist/twilight/p-91b4ebaf.system.entry.js +5 -0
- package/dist/twilight/p-91b4ebaf.system.entry.js.map +1 -0
- package/dist/twilight/twilight.esm.js +1 -1
- package/package.json +3 -3
- package/dist/twilight/p-2c4e8bf8.system.entry.js +0 -5
- package/dist/twilight/p-2c4e8bf8.system.entry.js.map +0 -1
- package/dist/twilight/p-e52586b3.entry.js +0 -5
- package/dist/twilight/p-e52586b3.entry.js.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{r as registerInstance,h,H as Host,g as getElement}from"./index-640776f3.js";var ShoppingBag='\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>shopping-bag</title>\n<path d="M28 10.667h-4v-2.667c0-4.412-3.588-8-8-8s-8 3.588-8 8v2.667h-4c-0.736 0-1.333 0.596-1.333 1.333v13.333c0 3.676 2.991 6.667 6.667 6.667h13.333c3.676 0 6.667-2.991 6.667-6.667v-13.333c0-0.737-0.597-1.333-1.333-1.333zM10.667 8c0-2.941 2.392-5.333 5.333-5.333s5.333 2.392 5.333 5.333v2.667h-10.667zM26.667 25.333c0 2.205-1.795 4-4 4h-13.333c-2.205 0-4-1.795-4-4v-12h2.667v2.667c0 0.737 0.597 1.333 1.333 1.333s1.333-0.596 1.333-1.333v-2.667h10.667v2.667c0 0.737 0.597 1.333 1.333 1.333s1.333-0.596 1.333-1.333v-2.667h2.667z"></path>\n</svg>\n';var sallaProductsListCss="";var SallaProductsList=function(){function e(e){var t=this;registerInstance(this,e);this.source=undefined;this.sourceValue=undefined;this.limit=undefined;this.filters=undefined;this.horizontalCards=undefined;this.page=1;this.nextPage=undefined;this.hasInfiniteScroll=undefined;this.hasCustomComponent=undefined;this.sourceValueIsValid=undefined;this.placeholderText=undefined;this.isReady=undefined;this.showPlaceholder=undefined;this.urlPrefix="";this.parsedFilters=undefined;salla.onReady((function(){t.sourceValueIsValid=!!(t.getSourceValue()||t.isSourceWithoutValue());t.buildNextPageUrl();t.isReady=true}));if(!this.sourceValueIsValid){salla.logger.warn("source-value prop is required for source [".concat(this.getSource(),"]"));return}this.hasCustomComponent=!!customElements.get("custom-salla-product-card");this.hasInfiniteScroll=!["json","selected","related","landing-page"].includes(this.getSource());this.status=document.createElement("div");this.status.className="s-infinite-scroll-wrapper";this.status.innerHTML='<div class="s-infinite-scroll-status">\n <p class="s-infinite-scroll-last infinite-scroll-last s-hidden" >'.concat(salla.lang.get("common.elements.end_of_content"),'</p>\n <p class="s-infinite-scroll-error infinite-scroll-error s-hidden">').concat(salla.lang.get("common.elements.failed_to_load_more"),'</p>\n </div>\n <a href="#" class="s-infinite-scroll-btn s-button-btn">\n <span class="s-button-loader s-button-loader-center s-infinite-scroll-btn-loader" style="display: none"></span>\n </a>');this.btnLoader=this.status.querySelector(".s-button-loader");salla.lang.onLoaded((function(){t.status.querySelector(".s-infinite-scroll-last").innerHTML=salla.lang.get("common.elements.end_of_content");t.status.querySelector(".s-infinite-scroll-error").innerHTML=salla.lang.get("common.elements.failed_to_load_more");t.placeholderText=salla.lang.get("pages.categories.no_products")}))}e.prototype.validateLimitMaximumValue=function(e,t){if(this.limit){this.urlPrefix+="&per_page=".concat(this.limit>32?32:this.limit,"}")}};e.prototype.parseFilters=function(e,t){var s=this;this.parsedFilters=typeof e=="string"?JSON.parse(e):e;this.urlPrefix="";var i=function(e,t){if(typeof t=="string"){r.urlPrefix+="&filters[".concat(e,"]=").concat(t)}else if(Array.isArray(t)){t.forEach((function(t){s.urlPrefix+="&filters[".concat(e,"][]=").concat(t,"}")}))}};var r=this;for(var n=0,
|
|
4
|
+
import{r as registerInstance,h,H as Host,g as getElement}from"./index-640776f3.js";var ShoppingBag='\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>shopping-bag</title>\n<path d="M28 10.667h-4v-2.667c0-4.412-3.588-8-8-8s-8 3.588-8 8v2.667h-4c-0.736 0-1.333 0.596-1.333 1.333v13.333c0 3.676 2.991 6.667 6.667 6.667h13.333c3.676 0 6.667-2.991 6.667-6.667v-13.333c0-0.737-0.597-1.333-1.333-1.333zM10.667 8c0-2.941 2.392-5.333 5.333-5.333s5.333 2.392 5.333 5.333v2.667h-10.667zM26.667 25.333c0 2.205-1.795 4-4 4h-13.333c-2.205 0-4-1.795-4-4v-12h2.667v2.667c0 0.737 0.597 1.333 1.333 1.333s1.333-0.596 1.333-1.333v-2.667h10.667v2.667c0 0.737 0.597 1.333 1.333 1.333s1.333-0.596 1.333-1.333v-2.667h2.667z"></path>\n</svg>\n';var sallaProductsListCss="";var SallaProductsList=function(){function e(e){var t=this;registerInstance(this,e);this.source=undefined;this.sourceValue=undefined;this.limit=undefined;this.filters=undefined;this.horizontalCards=undefined;this.page=1;this.nextPage=undefined;this.hasInfiniteScroll=undefined;this.hasCustomComponent=undefined;this.sourceValueIsValid=undefined;this.placeholderText=undefined;this.isReady=undefined;this.showPlaceholder=undefined;this.urlPrefix="";this.parsedFilters=undefined;salla.onReady((function(){t.sourceValueIsValid=!!(t.getSourceValue()||t.isSourceWithoutValue());t.buildNextPageUrl();t.isReady=true}));if(!this.sourceValueIsValid){salla.logger.warn("source-value prop is required for source [".concat(this.getSource(),"]"));return}this.hasCustomComponent=!!customElements.get("custom-salla-product-card");this.hasInfiniteScroll=!["json","selected","related","landing-page"].includes(this.getSource());this.status=document.createElement("div");this.status.className="s-infinite-scroll-wrapper";this.status.innerHTML='<div class="s-infinite-scroll-status">\n <p class="s-infinite-scroll-last infinite-scroll-last s-hidden" >'.concat(salla.lang.get("common.elements.end_of_content"),'</p>\n <p class="s-infinite-scroll-error infinite-scroll-error s-hidden">').concat(salla.lang.get("common.elements.failed_to_load_more"),'</p>\n </div>\n <a href="#" class="s-infinite-scroll-btn s-button-btn">\n <span class="s-button-loader s-button-loader-center s-infinite-scroll-btn-loader" style="display: none"></span>\n </a>');this.btnLoader=this.status.querySelector(".s-button-loader");salla.lang.onLoaded((function(){t.status.querySelector(".s-infinite-scroll-last").innerHTML=salla.lang.get("common.elements.end_of_content");t.status.querySelector(".s-infinite-scroll-error").innerHTML=salla.lang.get("common.elements.failed_to_load_more");t.placeholderText=salla.lang.get("pages.categories.no_products")}))}e.prototype.validateLimitMaximumValue=function(e,t){if(this.limit){this.urlPrefix+="&per_page=".concat(this.limit>32?32:this.limit,"}")}};e.prototype.parseFilters=function(e,t){var s=this;this.parsedFilters=typeof e=="string"?JSON.parse(e):e;this.urlPrefix="";var i=function(e,t){if(typeof t=="string"){r.urlPrefix+="&filters[".concat(e,"]=").concat(t)}else if(Array.isArray(t)){t.forEach((function(t){s.urlPrefix+="&filters[".concat(e,"][]=").concat(t,"}")}))}};var r=this;for(var n=0,a=Object.entries(this.parsedFilters);n<a.length;n++){var o=a[n],l=o[0],c=o[1];i(l,c)}if(this.getSource()=="categories"){this.wrapper.innerHTML="";this.init()}};e.prototype.isSourceWithoutValue=function(){return["offers","latest","sales"].includes(this.getSource())};e.prototype.buildNextPageUrl=function(){var e=this.getSource();if(e==="json"){return}if(this.isSourceWithoutValue()){this.nextPage=salla.url.api("products?source=".concat(e).concat(this.urlPrefix));return}if(["search","related","landing-page"].includes(e)){this.nextPage=salla.url.api("products?source=".concat(e,"&source_value=").concat(this.getSourceValue()).concat(this.urlPrefix));return}try{this.nextPage=salla.url.api("products?source=".concat(e,"&source_value[]=").concat(this.getSourceValue().join("&source_value[]=")).concat(this.urlPrefix))}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.getSource=function(){return{"brands.single":"brands","product.index":"categories","product.index.latest":"latest","product.index.offers":"offers","product.index.search":"search","landing-page":"landing-page","product.index.tag":"tags","product.index.sales":"sales","components.most_sales_products":"sales"}[this.source||salla.config.get("page.slug")]||this.source||"latest"};e.prototype.getSourceValue=function(){var e=this.getSource();if(!["search","json","offers","latest","sales"].includes(e)){if(Array.isArray(JSON.parse(this.sourceValue))&&JSON.parse(this.sourceValue).length){return JSON.parse(this.sourceValue)}if(typeof JSON.parse(this.sourceValue)=="number"){return[JSON.parse(this.sourceValue)]}}if(this.sourceValue){return this.sourceValue}if(e==="search"){return new URLSearchParams(window.location.search).get("q")}return salla.config.get("page.id")};e.prototype.loading=function(e){if(e===void 0){e=true}this.btnLoader.style.display=e?"inherit":"none"};e.prototype.getItemHTML=function(e){var t=this.hasCustomComponent?"custom-salla-product-card":"salla-product-card";t=document.createElement(t);t.setAttribute("product",JSON.stringify(e));if(this.getSource()=="landing-page"&&!this.hasCustomComponent){t.toggleAttribute("hide-add-btn",true);t.classList.add("s-product-card-fit-height")}if(this.horizontalCards&&!this.hasCustomComponent){t.toggleAttribute("horizontal",true)}t.toggleAttribute("shadow-on-hover",true);return t};e.prototype.initiateInfiniteScroll=function(){var e=this;if(!this.hasInfiniteScroll){return}this.host.insertAdjacentElement("afterend",this.status);this.infiniteScroll=salla.infiniteScroll.initiate(this.wrapper,this.wrapper,{path:function(){return e.nextPage},history:false,nextPage:this.nextPage,scrollThreshold:100},true);this.infiniteScroll.on("request",(function(){return e.loading()}));this.infiniteScroll.on("load",(function(t){return e.infiniteScroll.appendItems(e.handleResponse(t))}));this.infiniteScroll.on("error",(function(){e.status.querySelector(".s-infinite-scroll-error").classList.remove("s-hidden");e.loading(false)}))};e.prototype.canRender=function(){return this.sourceValueIsValid&&this.isReady};e.prototype.render=function(){var e=this;if(!this.canRender()){return""}if(this.showPlaceholder){return h("div",{class:"s-products-list-placeholder"},h("span",{innerHTML:ShoppingBag}),h("p",null,this.placeholderText))}return h(Host,{class:"s-products-list"},h("div",{class:{"s-products-list-wrapper":true,"s-products-list-horizontal-cards":this.horizontalCards,"s-products-list-vertical-cards":!this.horizontalCards},ref:function(t){return e.wrapper=t}}))};e.prototype.componentDidLoad=function(){var e=this;if(!this.canRender()){return}if(this.getSource()==="json"){if(!this.getSourceValue().length){this.showPlaceholder=true;return}this.getSourceValue().map((function(t){return e.wrapper.append(e.getItemHTML(t))}));return}if(this.getSource()=="categories"){var t=window.location.search.replace("?","").split("&").map((function(e){return e.split("=")})).reduce((function(e,t){var s=t[0],i=t[1];if(s=="sort"){e[s]=i}return e}),{});if(Object.entries(t).length){this.filters=t;return}}this.init()};e.prototype.init=function(){var e=this;this.initiateInfiniteScroll();this.loading();salla.product.fetch({source:this.getSource(),source_value:this.getSourceValue(),filters:this.filters,limit:this.limit}).then((function(t){if(!t.data.length){e.showPlaceholder=true;e.loading(false);return}e.handleResponse(t).forEach((function(t){return e.wrapper.append(t)}))}))};e.prototype.handleResponse=function(e){var t=this;var s;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((s=e.data)===null||s===void 0?void 0:s.map((function(e){return t.getItemHTML(e)})))||[]};Object.defineProperty(e.prototype,"host",{get:function(){return getElement(this)},enumerable:false,configurable:true});Object.defineProperty(e,"watchers",{get:function(){return{limit:["validateLimitMaximumValue"],filters:["parseFilters"]}},enumerable:false,configurable:true});return e}();SallaProductsList.style=sallaProductsListCss;export{SallaProductsList as salla_products_list};
|
|
5
5
|
//# sourceMappingURL=salla-products-list.entry.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["sallaProductsListCss","SallaProductsList","hostRef","_this","this","salla","onReady","sourceValueIsValid","getSourceValue","isSourceWithoutValue","buildNextPageUrl","isReady","logger","warn","concat","getSource","hasCustomComponent","customElements","get","hasInfiniteScroll","includes","status","document","createElement","className","innerHTML","lang","btnLoader","querySelector","onLoaded","placeholderText","prototype","validateLimitMaximumValue","_newValue","_","limit","urlPrefix","parseFilters","newValue","parsedFilters","JSON","parse","key","value","this_1","Array","isArray","forEach","item","_i","_b","Object","entries","length","_c","wrapper","init","nextPage","url","api","join","e","source","config","sourceValue","URLSearchParams","window","location","search","loading","isLoading","style","display","getItemHTML","product","customComponent","setAttribute","stringify","toggleAttribute","classList","add","horizontalCards","initiateInfiniteScroll","host","insertAdjacentElement","infiniteScroll","initiate","path","history","scrollThreshold","on","response","appendItems","handleResponse","remove","canRender","render","showPlaceholder","h","class","ShoppingBag","Host","ref","componentDidLoad","map","append","filters","replace","split","reduce","acc","fetch","source_value","then","res","data","card","cursor","next","option","loadOnScroll","_a"],"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, Watch} from '@stencil/core';\nimport ShoppingBag from '../../assets/svg/shopping-bag.svg';\n\n@Component({\n tag: 'salla-products-list',\n styleUrl: 'salla-products-list.scss'\n})\nexport class SallaProductsList {\n constructor() {\n salla.onReady(() => {\n this.sourceValueIsValid = !!(this.getSourceValue() || this.isSourceWithoutValue());\n this.buildNextPageUrl();\n this.isReady = true;\n });\n\n if (!this.sourceValueIsValid) {\n salla.logger.warn(`source-value prop is required for source [${this.getSource()}]`);\n return;\n }\n this.hasCustomComponent = !!customElements.get('custom-salla-product-card');\n\n this.hasInfiniteScroll = !['json', 'selected', 'related', 'landing-page'].includes(this.getSource());\n // Language\n //enhance\n this.status = document.createElement('div');\n this.status.className = 's-infinite-scroll-wrapper';\n this.status.innerHTML = `<div class=\"s-infinite-scroll-status\">\n <p class=\"s-infinite-scroll-last infinite-scroll-last s-hidden\" >${salla.lang.get('common.elements.end_of_content')}</p>\n <p class=\"s-infinite-scroll-error infinite-scroll-error s-hidden\">${salla.lang.get('common.elements.failed_to_load_more')}</p>\n </div>\n <a href=\"#\" class=\"s-infinite-scroll-btn s-button-btn\">\n <span class=\"s-button-loader s-button-loader-center s-infinite-scroll-btn-loader\" style=\"display: none\"></span>\n </a>`;\n this.btnLoader = this.status.querySelector('.s-button-loader');\n salla.lang.onLoaded(() => {\n this.status.querySelector('.s-infinite-scroll-last').innerHTML = salla.lang.get('common.elements.end_of_content');\n this.status.querySelector('.s-infinite-scroll-error').innerHTML = salla.lang.get('common.elements.failed_to_load_more');\n this.placeholderText = salla.lang.get('pages.categories.no_products');\n });\n }\n\n private readonly status: HTMLDivElement;\n private btnLoader: HTMLAnchorElement;\n @Element() host: HTMLElement;\n private wrapper: any;\n private infiniteScroll: any;\n /**\n * The source of the products list\n * @type {string}\n * */\n @Prop({\n reflect: true,\n mutable: true\n }) source: 'categories' | 'latest' | 'related' | 'brands' | 'json' | 'search' | 'tags' | 'selected' | 'offers' | 'landing-page' | 'sales';\n\n /**\n * The source value, cloud be different values as following:\n * - array of ids when `source` in ['categories', 'brands', 'tags', 'selected']\n * - keyword when `source` = 'search'\n * - products payload when `source` = 'json'\n * - product_id when `source` = 'related'\n *\n * @type {string}\n * */\n @Prop({mutable: true}) sourceValue: any;\n\n /**\n * Limit for number of products in the list.\n */\n @Prop({mutable: true}) limit: number;\n\n /**\n * Filter parameters. JSON STRING or object\n */\n @Prop({mutable: true}) filters: string | object;\n\n /**\n * Horizontal cards\n */\n @Prop({reflect: true}) horizontalCards: boolean\n\n @Watch('limit')\n validateLimitMaximumValue(_newValue: number, _) {\n if (this.limit) {\n this.urlPrefix += `&per_page=${this.limit > 32 ? 32 : this.limit}}`;\n }\n }\n\n @Watch('filters')\n parseFilters(newValue: string | object, _) {\n this.parsedFilters = typeof newValue == 'string' ? JSON.parse(newValue) : newValue\n this.urlPrefix = '';\n\n for (const [key, value] of Object.entries(this.parsedFilters)) {\n if (typeof value == \"string\") {\n this.urlPrefix += `&filters[${key}]=${value}`;\n } else if (Array.isArray(value)) {\n (value as any).forEach(item => {\n this.urlPrefix += `&filters[${key}][]=${item}}`\n })\n }\n }\n // reset page products\n if (this.getSource() == 'categories') {\n this.wrapper.innerHTML = '';\n this.init()\n }\n }\n\n // State\n @State() page: number = 1;\n @State() nextPage: string;\n @State() hasInfiniteScroll: boolean;\n @State() hasCustomComponent: boolean;\n @State() sourceValueIsValid: boolean;\n @State() placeholderText: string;\n @State() isReady: boolean;\n @State() showPlaceholder: boolean;\n @State() urlPrefix: string = '';\n @State() parsedFilters: any;\n\n private isSourceWithoutValue(){\n return ['offers', 'latest', 'sales'].includes(this.getSource());\n }\n private buildNextPageUrl() {\n if (this.getSource() === 'json') {\n return;\n }\n if (this.isSourceWithoutValue()) {\n this.nextPage = salla.url.api(`products?source=${this.getSource()}${this.urlPrefix}`);\n return;\n }\n\n if (['search', 'related', 'landing-page'].includes(this.getSource())) {\n this.nextPage = salla.url.api(`products?source=${this.getSource()}&source_value=${this.getSourceValue()}${this.urlPrefix}`);\n return;\n }\n\n try {\n this.nextPage = salla.url.api(`products?source=${this.getSource()}&source_value[]=${this.getSourceValue().join('&source_value[]=')}${this.urlPrefix}`);\n } catch (e) {\n salla.logger.warn(`source-value prop should be array of ids ex source-value=\"[1,2,3]\" for the source [${this.getSource()}]`);\n this.sourceValueIsValid = false;\n }\n }\n\n private getSource() {\n return {\n 'brands.single': 'brands',\n 'product.index': 'categories',\n 'product.index.latest': 'latest',\n 'product.index.offers': 'offers',\n 'product.index.search': 'search',\n 'landing-page': 'landing-page',\n 'product.index.tag': 'tags',\n 'product.index.sales': 'sales',\n }[this.source || salla.config.get('page.slug')] || this.source || 'latest';\n }\n\n private getSourceValue() {\n let source = this.getSource();\n\n if (!['search', 'json', 'offers', 'latest', 'sales'].includes(source)) {\n if (Array.isArray(JSON.parse(this.sourceValue)) && JSON.parse(this.sourceValue).length) {\n return JSON.parse(this.sourceValue);\n }\n\n if (typeof JSON.parse(this.sourceValue) == 'number') {\n return [JSON.parse(this.sourceValue)];\n }\n }\n\n if (this.sourceValue) {\n return this.sourceValue;\n }\n\n\n if (source === 'search') {\n return (new URLSearchParams(window.location.search)).get('q');\n }\n\n return salla.config.get('page.id');\n }\n\n\n private loading(isLoading = true) {\n this.btnLoader.style.display = isLoading ? 'inherit' : 'none';\n }\n\n private getItemHTML(product) {\n let customComponent: string | HTMLElement = this.hasCustomComponent ? 'custom-salla-product-card' : 'salla-product-card';\n customComponent = document.createElement(customComponent);\n customComponent.setAttribute('product', JSON.stringify(product));\n if (this.getSource() == 'landing-page' && !this.hasCustomComponent) {\n customComponent.toggleAttribute('hide-add-btn', true);\n customComponent.classList.add('s-product-card-fit-height');\n }\n if (this.horizontalCards && !this.hasCustomComponent) {\n customComponent.toggleAttribute('horizontal', true);\n }\n customComponent.toggleAttribute('shadow-on-hover', true);\n return customComponent;\n }\n\n private initiateInfiniteScroll() {\n if (!this.hasInfiniteScroll) {\n return;\n }\n\n this.host.insertAdjacentElement('afterend', this.status);\n this.infiniteScroll = salla.infiniteScroll.initiate(this.wrapper, this.wrapper, {\n path: () => this.nextPage,\n history: false,\n nextPage: this.nextPage,\n scrollThreshold: 100,\n }, /* infinite via api*/true);\n this.infiniteScroll.on('request', () => this.loading())\n this.infiniteScroll.on('load', response => this.infiniteScroll.appendItems(this.handleResponse(response)))\n this.infiniteScroll.on('error', () => {\n this.status.querySelector('.s-infinite-scroll-error').classList.remove('s-hidden')\n this.loading(false);\n });\n }\n\n private canRender() {\n return this.sourceValueIsValid && this.isReady;\n }\n\n render() {\n if (!this.canRender()) {\n return '';\n }\n if (this.showPlaceholder) {\n return <div class=\"s-products-list-placeholder\">\n <span innerHTML={ShoppingBag}/>\n <p>{this.placeholderText}</p>\n </div>;\n }\n return (\n <Host class=\"s-products-list\">\n <div class={{\n \"s-products-list-wrapper\": true,\n 's-products-list-horizontal-cards': this.horizontalCards,\n 's-products-list-vertical-cards': !this.horizontalCards,\n }}\n ref={wrapper => this.wrapper = wrapper}/>\n </Host>\n );\n }\n\n componentDidLoad() {\n if (!this.canRender()) {\n return;\n }\n if (this.getSource() === 'json') {\n if (!this.getSourceValue().length) {\n this.showPlaceholder = true;\n return;\n }\n this.getSourceValue().map(product => this.wrapper.append(this.getItemHTML(product)));\n return;\n }\n if (this.getSource() == 'categories') {\n // check if there is a filters in the url\n const filters = window.location.search\n .replace('?', '')\n .split('&')\n .map(item => item.split('='))\n .reduce((acc, [key, value]) => {\n if (key == 'sort') {\n acc[key] = value;\n }\n return acc;\n }, {});\n if (Object.entries(filters).length) {\n this.filters = filters;\n return;\n }\n }\n this.init();\n }\n\n private init() {\n this.initiateInfiniteScroll();\n this.loading();\n salla.product.fetch({\n source: this.getSource(),\n source_value: this.getSourceValue(),\n filters: this.filters,\n limit: this.limit\n })\n .then(res => {\n if (!res.data.length) {\n this.showPlaceholder = true;\n this.loading(false);\n return;\n }\n this.handleResponse(res).forEach(card => this.wrapper.append(card));\n })\n }\n\n private handleResponse(response): Array<HTMLElement> {\n //💡 when source is related, cursor will not be existed\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)) || [];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C9DrD,KAAKiE,QAAQ,OACb,GAAIjE,KAAKe,oBAAsBf,KAAKqD,SAAU,CAC5CrD,KAAKiF,eAAekC,OAAO,CAAC9B,gBAAiB,MAAO+B,aAAc,QAClEpH,KAAKiB,OAAOO,cAAc,2BAA2BmD,UAAUe,OAAO,W,CAExE,QAAO2B,EAAA9B,EAASwB,QAAI,MAAAM,SAAA,SAAAA,EAAEjB,KAAI,SAAA9B,GAAW,OAAAvE,EAAKsE,YAAYC,EAAjB,MAA8B,E,gSA9SzC,G"}
|
|
1
|
+
{"version":3,"names":["sallaProductsListCss","SallaProductsList","hostRef","_this","this","salla","onReady","sourceValueIsValid","getSourceValue","isSourceWithoutValue","buildNextPageUrl","isReady","logger","warn","concat","getSource","hasCustomComponent","customElements","get","hasInfiniteScroll","includes","status","document","createElement","className","innerHTML","lang","btnLoader","querySelector","onLoaded","placeholderText","prototype","validateLimitMaximumValue","_newValue","_","limit","urlPrefix","parseFilters","newValue","parsedFilters","JSON","parse","key","value","this_1","Array","isArray","forEach","item","_i","_b","Object","entries","length","_c","wrapper","init","source","nextPage","url","api","join","e","config","sourceValue","URLSearchParams","window","location","search","loading","isLoading","style","display","getItemHTML","product","customComponent","setAttribute","stringify","toggleAttribute","classList","add","horizontalCards","initiateInfiniteScroll","host","insertAdjacentElement","infiniteScroll","initiate","path","history","scrollThreshold","on","response","appendItems","handleResponse","remove","canRender","render","showPlaceholder","h","class","ShoppingBag","Host","ref","componentDidLoad","map","append","filters","replace","split","reduce","acc","fetch","source_value","then","res","data","card","cursor","next","option","loadOnScroll","_a"],"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, Watch} from '@stencil/core';\nimport ShoppingBag from '../../assets/svg/shopping-bag.svg';\n\n@Component({\n tag: 'salla-products-list',\n styleUrl: 'salla-products-list.scss'\n})\nexport class SallaProductsList {\n constructor() {\n salla.onReady(() => {\n this.sourceValueIsValid = !!(this.getSourceValue() || this.isSourceWithoutValue());\n this.buildNextPageUrl();\n this.isReady = true;\n });\n\n if (!this.sourceValueIsValid) {\n salla.logger.warn(`source-value prop is required for source [${this.getSource()}]`);\n return;\n }\n this.hasCustomComponent = !!customElements.get('custom-salla-product-card');\n\n this.hasInfiniteScroll = !['json', 'selected', 'related', 'landing-page'].includes(this.getSource());\n // Language\n //enhance\n this.status = document.createElement('div');\n this.status.className = 's-infinite-scroll-wrapper';\n this.status.innerHTML = `<div class=\"s-infinite-scroll-status\">\n <p class=\"s-infinite-scroll-last infinite-scroll-last s-hidden\" >${salla.lang.get('common.elements.end_of_content')}</p>\n <p class=\"s-infinite-scroll-error infinite-scroll-error s-hidden\">${salla.lang.get('common.elements.failed_to_load_more')}</p>\n </div>\n <a href=\"#\" class=\"s-infinite-scroll-btn s-button-btn\">\n <span class=\"s-button-loader s-button-loader-center s-infinite-scroll-btn-loader\" style=\"display: none\"></span>\n </a>`;\n this.btnLoader = this.status.querySelector('.s-button-loader');\n salla.lang.onLoaded(() => {\n this.status.querySelector('.s-infinite-scroll-last').innerHTML = salla.lang.get('common.elements.end_of_content');\n this.status.querySelector('.s-infinite-scroll-error').innerHTML = salla.lang.get('common.elements.failed_to_load_more');\n this.placeholderText = salla.lang.get('pages.categories.no_products');\n });\n }\n\n private readonly status: HTMLDivElement;\n private btnLoader: HTMLAnchorElement;\n @Element() host: HTMLElement;\n private wrapper: any;\n private infiniteScroll: any;\n /**\n * The source of the products list\n * @type {string}\n * */\n @Prop({\n reflect: true,\n mutable: true\n }) source: 'categories' | 'latest' | 'related' | 'brands' | 'json' | 'search' | 'tags' | 'selected' | 'offers' | 'landing-page' | 'sales';\n\n /**\n * The source value, cloud be different values as following:\n * - array of ids when `source` in ['categories', 'brands', 'tags', 'selected']\n * - keyword when `source` = 'search'\n * - products payload when `source` = 'json'\n * - product_id when `source` = 'related'\n *\n * @type {string}\n * */\n @Prop({mutable: true}) sourceValue: any;\n\n /**\n * Limit for number of products in the list.\n */\n @Prop({mutable: true}) limit: number;\n\n /**\n * Filter parameters. JSON STRING or object\n */\n @Prop({mutable: true}) filters: string | object;\n\n /**\n * Horizontal cards\n */\n @Prop({reflect: true}) horizontalCards: boolean\n\n @Watch('limit')\n validateLimitMaximumValue(_newValue: number, _) {\n if (this.limit) {\n this.urlPrefix += `&per_page=${this.limit > 32 ? 32 : this.limit}}`;\n }\n }\n\n @Watch('filters')\n parseFilters(newValue: string | object, _) {\n this.parsedFilters = typeof newValue == 'string' ? JSON.parse(newValue) : newValue\n this.urlPrefix = '';\n\n for (const [key, value] of Object.entries(this.parsedFilters)) {\n if (typeof value == \"string\") {\n this.urlPrefix += `&filters[${key}]=${value}`;\n } else if (Array.isArray(value)) {\n (value as any).forEach(item => {\n this.urlPrefix += `&filters[${key}][]=${item}}`\n })\n }\n }\n // reset page products\n if (this.getSource() == 'categories') {\n this.wrapper.innerHTML = '';\n this.init()\n }\n }\n\n // State\n @State() page: number = 1;\n @State() nextPage: string;\n @State() hasInfiniteScroll: boolean;\n @State() hasCustomComponent: boolean;\n @State() sourceValueIsValid: boolean;\n @State() placeholderText: string;\n @State() isReady: boolean;\n @State() showPlaceholder: boolean;\n @State() urlPrefix: string = '';\n @State() parsedFilters: any;\n\n private isSourceWithoutValue(){\n return ['offers', 'latest', 'sales'].includes(this.getSource());\n }\n\n private buildNextPageUrl() {\n let source = this.getSource();\n if (source === 'json') {\n return;\n }\n if (this.isSourceWithoutValue()) {\n this.nextPage = salla.url.api(`products?source=${source}${this.urlPrefix}`);\n return;\n }\n\n if (['search', 'related', 'landing-page'].includes(source)) {\n this.nextPage = salla.url.api(`products?source=${source}&source_value=${this.getSourceValue()}${this.urlPrefix}`);\n return;\n }\n\n try {\n this.nextPage = salla.url.api(`products?source=${source}&source_value[]=${this.getSourceValue().join('&source_value[]=')}${this.urlPrefix}`);\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 private getSource() {\n return {\n 'brands.single': 'brands',\n 'product.index': 'categories',\n 'product.index.latest': 'latest',\n 'product.index.offers': 'offers',\n 'product.index.search': 'search',\n 'landing-page': 'landing-page',\n 'product.index.tag': 'tags',\n 'product.index.sales': 'sales',\n 'components.most_sales_products': 'sales',//temporary, delete it after two days from now\n }[this.source || salla.config.get('page.slug')] || this.source || 'latest';\n }\n\n private getSourceValue() {\n let source = this.getSource();\n\n if (!['search', 'json', 'offers', 'latest', 'sales'].includes(source)) {\n if (Array.isArray(JSON.parse(this.sourceValue)) && JSON.parse(this.sourceValue).length) {\n return JSON.parse(this.sourceValue);\n }\n\n if (typeof JSON.parse(this.sourceValue) == 'number') {\n return [JSON.parse(this.sourceValue)];\n }\n }\n\n if (this.sourceValue) {\n return this.sourceValue;\n }\n\n\n if (source === 'search') {\n return (new URLSearchParams(window.location.search)).get('q');\n }\n\n return salla.config.get('page.id');\n }\n\n\n private loading(isLoading = true) {\n this.btnLoader.style.display = isLoading ? 'inherit' : 'none';\n }\n\n private getItemHTML(product) {\n let customComponent: string | HTMLElement = this.hasCustomComponent ? 'custom-salla-product-card' : 'salla-product-card';\n customComponent = document.createElement(customComponent);\n customComponent.setAttribute('product', JSON.stringify(product));\n if (this.getSource() == 'landing-page' && !this.hasCustomComponent) {\n customComponent.toggleAttribute('hide-add-btn', true);\n customComponent.classList.add('s-product-card-fit-height');\n }\n if (this.horizontalCards && !this.hasCustomComponent) {\n customComponent.toggleAttribute('horizontal', true);\n }\n customComponent.toggleAttribute('shadow-on-hover', true);\n return customComponent;\n }\n\n private initiateInfiniteScroll() {\n if (!this.hasInfiniteScroll) {\n return;\n }\n\n this.host.insertAdjacentElement('afterend', this.status);\n this.infiniteScroll = salla.infiniteScroll.initiate(this.wrapper, this.wrapper, {\n path: () => this.nextPage,\n history: false,\n nextPage: this.nextPage,\n scrollThreshold: 100,\n }, /* infinite via api*/true);\n this.infiniteScroll.on('request', () => this.loading())\n this.infiniteScroll.on('load', response => this.infiniteScroll.appendItems(this.handleResponse(response)))\n this.infiniteScroll.on('error', () => {\n this.status.querySelector('.s-infinite-scroll-error').classList.remove('s-hidden')\n this.loading(false);\n });\n }\n\n private canRender() {\n return this.sourceValueIsValid && this.isReady;\n }\n\n render() {\n if (!this.canRender()) {\n return '';\n }\n if (this.showPlaceholder) {\n return <div class=\"s-products-list-placeholder\">\n <span innerHTML={ShoppingBag}/>\n <p>{this.placeholderText}</p>\n </div>;\n }\n return (\n <Host class=\"s-products-list\">\n <div class={{\n \"s-products-list-wrapper\": true,\n 's-products-list-horizontal-cards': this.horizontalCards,\n 's-products-list-vertical-cards': !this.horizontalCards,\n }}\n ref={wrapper => this.wrapper = wrapper}/>\n </Host>\n );\n }\n\n componentDidLoad() {\n if (!this.canRender()) {\n return;\n }\n if (this.getSource() === 'json') {\n if (!this.getSourceValue().length) {\n this.showPlaceholder = true;\n return;\n }\n this.getSourceValue().map(product => this.wrapper.append(this.getItemHTML(product)));\n return;\n }\n if (this.getSource() == 'categories') {\n // check if there is a filters in the url\n const filters = window.location.search\n .replace('?', '')\n .split('&')\n .map(item => item.split('='))\n .reduce((acc, [key, value]) => {\n if (key == 'sort') {\n acc[key] = value;\n }\n return acc;\n }, {});\n if (Object.entries(filters).length) {\n this.filters = filters;\n return;\n }\n }\n this.init();\n }\n\n private init() {\n this.initiateInfiniteScroll();\n this.loading();\n salla.product.fetch({\n source: this.getSource(),\n source_value: this.getSourceValue(),\n filters: this.filters,\n limit: this.limit\n })\n .then(res => {\n if (!res.data.length) {\n this.showPlaceholder = true;\n this.loading(false);\n return;\n }\n this.handleResponse(res).forEach(card => this.wrapper.append(card));\n })\n }\n\n private handleResponse(response): Array<HTMLElement> {\n //💡 when source is related, cursor will not be existed\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('.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MAENA,KAAKsD,SAAWiC,EAAS0B,OAAS1B,EAAS0B,OAAOC,KAAOlH,KAAKsD,SAC9DtD,KAAKiE,QAAQ,OACb,GAAIjE,KAAKe,oBAAsBf,KAAKsD,SAAU,CAC5CtD,KAAKiF,eAAekC,OAAO,CAAC9B,gBAAiB,MAAO+B,aAAc,QAClEpH,KAAKiB,OAAOO,cAAc,2BAA2BmD,UAAUe,OAAO,W,CAExE,QAAO2B,EAAA9B,EAASwB,QAAI,MAAAM,SAAA,SAAAA,EAAEjB,KAAI,SAAA9B,GAAW,OAAAvE,EAAKsE,YAAYC,EAAjB,MAA8B,E,gSAjTzC,G"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
System.register(["./p-99570099.system.js","./p-cdbdb338.system.js","./p-99ed8fff.system.js"],(function(e,a){"use strict";var t,l,o;return{setters:[function(a){t=a.p;l=a.b;e("setNonce",a.s)},function(e){o=e.g},function(){}],execute:function(){var e=function(){var e=a.meta.url;var l={};if(e!==""){l.resourcesUrl=new URL(".",e).href}return t(l)};e().then((function(e){o();return l(JSON.parse('[["p-beb0d14b.system",[[4,"salla-gifting",{"productId":[2,"product-id"],"widgetSubtitle":[1,"widget-subtitle"],"sectionTitle":[32],"sectionSubtitle":[32],"sectionBtnText":[32],"giftDetails":[32],"selectImageForYourGift":[32],"selectImageOrUpload":[32],"selectGiftMessage":[32],"giftCustomText":[32],"textId":[32],"incorrectGiftText":[32],"nextStep":[32],"senderNameLabel":[32],"receiverNameFieldLabel":[32],"receiverMobileFieldLabel":[32],"receiverEmailFieldLabel":[32],"emailPlaceholder":[32],"sendLater":[32],"selectSendDateAndTime":[32],"canNotEditOrderAfterSelectDate":[32],"sendGift":[32],"donationRequired":[32],"currentStep":[32],"showCalendar":[32],"showGiftText":[32],"currentLang":[32],"parentClass":[32],"errors":[32],"gift":[32],"selectedGiftTextOption":[32],"showTextArea":[32],"selectedImage":[32],"uploadedImage":[32],"selectedText":[32],"senderName":[32],"errorMessage":[32],"hasError":[32],"quantity":[32],"deliveryDate":[32],"timeZone":[32],"receiverName":[32],"receiverMobile":[32],"receiverCountryCode":[32],"receiverEmail":[32],"open":[64],"close":[64],"goToStep2":[64]}],[4,"salla-loyalty",{"prizePoints":[1544,"prize-points"],"customerPoints":[1538,"customer-points"],"prizeTitle":[1537,"prize-title"],"allowEmail":[4,"allow-email"],"allowMobile":[4,"allow-mobile"],"requireEmail":[4,"require-email"],"guestMessage":[1025,"guest-message"],"loyaltyProgram":[32],"buttonLoading":[32],"selectedItem":[32],"askConfirmation":[32],"is_loggedin":[32],"hasError":[32],"errorMessage":[32],"translationLoaded":[32],"open":[64],"close":[64],"resetExchange":[64],"exchangeLoyaltyPoint":[64]}],[4,"salla-product-size-guide",{"guides":[32],"productId":[32],"placeholder_title":[32],"placeholder_description":[32],"modal_title":[32],"hasError":[32],"open":[64],"close":[64]}],[4,"salla-login-modal",{"isEmailAllowed":[1028,"is-email-allowed"],"isMobileAllowed":[1028,"is-mobile-allowed"],"isEmailRequired":[1028,"is-email-required"],"supportWebAuth":[516,"support-web-auth"],"currentTabName":[32],"regType":[32],"translationLoaded":[32],"title":[32],"emailErrorMsg":[32],"firstNameErrorMsg":[32],"lastNameErrorMsg":[32],"dragAndDrop":[32],"browseFromFiles":[32],"customFields":[32],"uploadedImage":[32],"open":[64]},[[8,"verified","onVerified"]]],[0,"salla-offer-modal",{"offer":[32],"offer_name":[32],"offer_message":[32],"hasError":[32],"errorMessage":[32],"productID":[32],"offer_type":[32],"translationLoaded":[32],"addToCartLabel":[32],"open":[64],"showOffer":[64]}],[0,"salla-rating-modal",{"orderId":[2,"order-id"],"order":[32],"hasError":[32],"errorMessage":[32],"translationLoaded":[32],"open":[64],"close":[64]}],[4,"salla-scopes",{"selection":[1],"searchDisplayLimit":[2,"search-display-limit"],"translationLoaded":[32],"mode":[32],"current_scope":[32],"scopes":[32],"originalScopesList":[32],"selected_scope":[32],"isOpenedBefore":[32],"hasError":[32],"loading":[32],"close":[64],"open":[64],"handleSubmit":[64]}],[0,"salla-localization-modal",{"language":[1537],"currency":[1537],"translationLoaded":[32],"languages":[32],"currencies":[32],"hasError":[32],"errorMessage":[32],"open":[64],"close":[64],"submit":[64]}],[0,"salla-quick-order",{"quickOrderTitle":[1025,"quick-order-title"],"subTitle":[1025,"sub-title"],"payButtonTitle":[1025,"pay-button-title"],"confirmPayButtonTitle":[1025,"confirm-pay-button-title"],"agreementText":[1025,"agreement-text"],"isEmailRequired":[1028,"is-email-required"],"productId":[1025,"product-id"],"thanksMessage":[1025,"thanks-message"],"quickOrderStyle":[1025,"quick-order-style"],"user":[32],"isAvailable":[32],"oneClick":[32],"expanded":[32],"isTermsRequired":[32],"countryCode":[32],"submitSucess":[32],"placeHolderEmail":[32],"emailOptional":[32],"agreementShowText":[32],"agreementModalHead":[32],"userNameLabel":[32],"termsChecked":[32]}],[0,"salla-user-settings",{"isNotifiable":[516,"is-notifiable"],"deactivateAccount":[32],"promotionalMsgs":[32],"deactivateDesc":[32],"promotionalMsgsDesc":[32],"sorryForLeavingText":[32],"warningText":[32],"keepAccount":[32],"buttonLoading":[32]}],[0,"salla-search",{"inline":[4],"oval":[4],"height":[2],"translationLoaded":[32],"results":[32],"loading":[32],"typing":[32],"debounce":[32],"search_term":[32]},[[0,"keydown","handleKeyDown"]]],[4,"salla-social-share",{"url":[513],"urlName":[513,"url-name"],"platforms":[513],"opened":[32],"allPlatforms":[32],"platformIcons":[32],"convertedPlatforms":[32],"open":[64]}],[4,"salla-cart-summary",{"showCartLabel":[4,"show-cart-label"],"cartSummaryCount":[32],"cartSummaryTotal":[32],"cartLabel":[32],"animateToCart":[64]}],[4,"salla-infinite-scroll",{"nextPage":[1,"next-page"],"autoload":[1028],"container":[1],"item":[1],"loadMore":[32],"noMore":[32],"failedToLoad":[32]}],[0,"salla-maintenance-alert",{"title":[32],"message":[32],"buttonTitle":[32]}],[4,"salla-quantity-input",{"quantity":[32],"decrease":[64],"increase":[64],"setValue":[64]}],[4,"salla-user-menu",{"inline":[516],"avatarOnly":[516,"avatar-only"],"showHeader":[516,"show-header"],"relativeDropdown":[516,"relative-dropdown"],"accountLoading":[32],"opened":[32],"notifications":[32],"orders":[32],"pending_orders":[32],"wishlist":[32],"profile":[32],"rating":[32],"logout":[32],"hello":[32],"first_name":[32],"last_name":[32],"avatar":[32],"is_loggedIn":[32],"badges":[32],"hasBadges":[32],"OrderUpdate":[32]}],[4,"salla-product-card",{"product":[1],"horizontal":[4],"shadowOnHover":[4,"shadow-on-hover"],"hideAddBtn":[4,"hide-add-btn"],"fullImage":[4,"full-image"],"minimal":[4],"isSpecial":[4,"is-special"],"showQuantity":[4,"show-quantity"],"productData":[32],"fitImageHeight":[32],"remained":[32],"outOfStock":[32],"donationAmount":[32],"startingPrice":[32],"addToCart":[32],"placeholder":[32]}],[4,"salla-map",{"name":[1],"required":[4],"readonly":[4],"searchable":[1028],"lat":[1026],"lng":[1026],"apiKey":[1025,"api-key"],"modalTitle":[1,"modal-title"],"zoom":[1026],"theme":[1025],"modalActivityTitle":[32],"confirmButtonTitle":[32],"locateButtonTitle":[32],"locateButtonEdit":[32],"searchPlaceholder":[32],"searchInputValue":[32],"formattedAddress":[32],"geolocationError":[32],"searchInput":[32],"mapInput":[32],"mapElement":[32],"selectedLat":[32],"selectedLng":[32],"open":[64]}],[4,"salla-verify",{"display":[1],"type":[1025],"autoReload":[4,"auto-reload"],"supportWebAuth":[4,"support-web-auth"],"translationLoaded":[32],"title":[32],"resendAfter":[32],"isProfileVerify":[32],"getCode":[64],"open":[64]}],[4,"salla-color-picker",{"name":[1],"required":[4],"color":[1537],"format":[1],"showCancelButton":[4,"show-cancel-button"],"showTextField":[4,"show-text-field"],"enableAlpha":[4,"enable-alpha"],"widgetColor":[32],"setPickerOption":[64],"movePopUp":[64],"setColorValue":[64],"openPicker":[64],"closePicker":[64],"destroyPicker":[64]}],[0,"salla-rating-stars",{"name":[1],"size":[1],"value":[2],"reviews":[2]}],[4,"salla-add-product-button",{"channels":[513],"subscribedOptions":[1,"subscribed-options"],"quickBuy":[1540,"quick-buy"],"quantity":[514],"donatingAmount":[514,"donating-amount"],"notifyOptionsAvailability":[516,"notify-options-availability"],"productId":[520,"product-id"],"supportStickyBar":[516,"support-sticky-bar"],"productStatus":[513,"product-status"],"productType":[513,"product-type"],"hasOutOfStockOption":[32],"hasSubscribedOptions":[32],"selectedOptions":[32],"showQuickBuy":[32]}],[0,"salla-count-down",{"date":[1],"boxed":[4],"size":[1],"color":[1],"labeled":[4],"endText":[1,"end-text"],"digits":[1],"endOfDay":[4,"end-of-day"],"daysLabel":[32],"hoursLabel":[32],"minutesLabel":[32],"secondsLabel":[32],"endLabel":[32],"invalidDate":[32],"offerEnded":[32],"countInterval":[32],"days":[32],"hours":[32],"minutes":[32],"seconds":[32],"endCountDown":[64]}],[0,"salla-datetime-picker",{"value":[1537],"required":[4],"name":[513],"placeholder":[1],"allowInput":[4,"allow-input"],"allowInvalidPreload":[4,"allow-invalid-preload"],"altFormat":[1,"alt-format"],"altInput":[4,"alt-input"],"altInputClass":[1,"alt-input-class"],"appendTo":[16],"ariaDateFormat":[1,"aria-date-format"],"autoFillDefaultTime":[4,"auto-fill-default-time"],"clickOpens":[4,"click-opens"],"closeOnSelect":[4,"close-on-select"],"conjunction":[1],"dateFormat":[1,"date-format"],"defaultDate":[8,"default-date"],"defaultHour":[2,"default-hour"],"defaultMinute":[2,"default-minute"],"defaultSeconds":[2,"default-seconds"],"disable":[16],"disableMobile":[4,"disable-mobile"],"enable":[16],"enableSeconds":[4,"enable-seconds"],"enableTime":[4,"enable-time"],"formatDate":[16],"hourIncrement":[2,"hour-increment"],"inline":[4],"locale":[1],"maxDate":[8,"max-date"],"maxTime":[8,"max-time"],"minDate":[8,"min-date"],"minTime":[8,"min-time"],"minuteIncrement":[2,"minute-increment"],"mode":[1],"monthSelectorType":[1,"month-selector-type"],"nextArrow":[1,"next-arrow"],"noCalendar":[4,"no-calendar"],"dateParser":[16],"position":[1],"positionElement":[16],"prevArrow":[1,"prev-arrow"],"shorthandCurrentMonth":[4,"shorthand-current-month"],"static":[4],"showMonths":[2,"show-months"],"time_24hr":[4,"time_-2-4hr"],"weekNumbers":[4,"week-numbers"],"wrap":[4]}],[4,"salla-tab-content",{"name":[1],"isSelected":[32],"getChild":[64]}],[4,"salla-tab-header",{"name":[1],"activeClass":[1,"active-class"],"height":[8],"centered":[4],"isSelected":[32],"getChild":[64]}],[4,"salla-tabs",{"backgroundColor":[1,"background-color"],"vertical":[4]},[[0,"tabSelected","onSelectedTab"]]],[0,"salla-product-availability",{"channels":[1],"notifyOptionsAvailability":[4,"notify-options-availability"],"productId":[2,"product-id"],"isSubscribed":[1028,"is-subscribed"],"translationLoaded":[32],"title_":[32],"isVisitorSubscribed":[32]}],[0,"salla-quick-buy",{"type":[1025],"productId":[1025,"product-id"],"amount":[1538],"currency":[1025],"options":[16],"isRequireShipping":[1028,"is-require-shipping"],"isApplePayActive":[32],"quickBuy":[32]}],[0,"salla-file-upload",{"value":[1537],"files":[513],"height":[513],"cartItemId":[1,"cart-item-id"],"profileImage":[516,"profile-image"],"name":[1537],"payloadName":[1,"payload-name"],"accept":[1537],"fileId":[2,"file-id"],"url":[1025],"method":[1],"formData":[1,"form-data"],"required":[4],"maxFileSize":[1,"max-file-size"],"disabled":[4],"allowDrop":[4,"allow-drop"],"allowBrowse":[4,"allow-browse"],"allowPaste":[4,"allow-paste"],"allowMultiple":[4,"allow-multiple"],"allowReplace":[4,"allow-replace"],"allowRevert":[4,"allow-revert"],"allowRemove":[4,"allow-remove"],"allowProcess":[4,"allow-process"],"allowReorder":[4,"allow-reorder"],"storeAsFile":[4,"store-as-file"],"forceRevert":[4,"force-revert"],"maxFilesCount":[2,"max-files-count"],"maxParallelUploads":[2,"max-parallel-uploads"],"checkValidity":[4,"check-validity"],"itemInsertLocation":[1,"item-insert-location"],"itemInsertInterval":[2,"item-insert-interval"],"credits":[4],"dropOnPage":[4,"drop-on-page"],"dropOnElement":[4,"drop-on-element"],"dropValidation":[4,"drop-validation"],"ignoredFiles":[16],"instantUpload":[1028,"instant-upload"],"chunkUploads":[4,"chunk-uploads"],"chunkForce":[4,"chunk-force"],"chunkSize":[2,"chunk-size"],"chunkRetryDelays":[16],"labelDecimalSeparator":[1,"label-decimal-separator"],"labelThousandsSeparator":[1,"label-thousands-separator"],"labelIdle":[1025,"label-idle"],"iconRemove":[1,"icon-remove"],"iconProcess":[1,"icon-process"],"iconRetry":[1,"icon-retry"],"iconUndo":[1,"icon-undo"],"setOption":[64]}],[0,"salla-progress-bar",{"donation":[1],"target":[1026],"value":[1026],"height":[1025],"header":[1025],"stripped":[1028],"message":[1025],"unit":[1025],"color":[1025]}],[4,"salla-list-tile",{"href":[1],"target":[1]}],[4,"salla-slider",{"blockTitle":[513,"block-title"],"listenToThumbnailsOption":[516,"listen-to-thumbnails-option"],"blockSubtitle":[513,"block-subtitle"],"displayAllUrl":[513,"display-all-url"],"arrowsCentered":[516,"arrows-centered"],"verticalThumbs":[516,"vertical-thumbs"],"gridThumbs":[516,"grid-thumbs"],"vertical":[516],"autoHeight":[516,"auto-height"],"showControls":[516,"show-controls"],"controlsOuter":[516,"controls-outer"],"showThumbsControls":[4,"show-thumbs-controls"],"autoPlay":[4,"auto-play"],"slidesPerView":[1,"slides-per-view"],"pagination":[4],"centered":[4],"loop":[4],"direction":[1537],"type":[1],"sliderConfig":[520,"slider-config"],"thumbsConfig":[520,"thumbs-config"],"currentIndex":[32],"isEnd":[32],"isBeginning":[32],"swiperScript":[32],"displayAllTitle":[32],"slideTo":[64],"slideNext":[64],"slidePrev":[64],"slideToLoop":[64],"slideNextLoop":[64],"slidePrevLoop":[64],"slideReset":[64],"slideToClosest":[64],"update":[64],"updateAutoHeight":[64],"updateSlides":[64],"updateProgress":[64],"updateSlidesClasses":[64],"getSlides":[64]}],[4,"salla-placeholder",{"icon":[1],"alignment":[1],"iconSize":[1,"icon-size"],"translationLoaded":[32]}],[0,"salla-skeleton",{"type":[1],"width":[1],"height":[1]}],[0,"salla-tel-input",{"phone":[1025],"name":[1],"countryCode":[1025,"country-code"],"mobileRequired":[32],"countryCodeLabel":[32],"mobileLabel":[32],"tooShort":[32],"tooLong":[32],"invalidCountryCode":[32],"invalidNumber":[32],"errorMap":[32],"getValues":[64],"isValid":[64]}],[4,"salla-modal",{"isClosable":[1028,"is-closable"],"width":[513],"position":[513],"visible":[516],"hasSkeleton":[516,"has-skeleton"],"isLoading":[1540,"is-loading"],"subTitleFirst":[4,"sub-title-first"],"noPadding":[4,"no-padding"],"subTitle":[1,"sub-title"],"centered":[4],"iconStyle":[1,"icon-style"],"modalTitle":[32],"open":[64],"close":[64],"setTitle":[64],"loading":[64],"stopLoading":[64]},[[0,"keyup","handleKeyUp"]]],[4,"salla-button",{"shape":[513],"color":[513],"fill":[513],"size":[513],"width":[513],"loading":[516],"disabled":[516],"loaderPosition":[1,"loader-position"],"href":[1],"load":[64],"stop":[64],"setText":[64],"disable":[64],"enable":[64]}],[0,"salla-loading",{"size":[8],"width":[8],"color":[1],"bgColor":[1,"bg-color"]}]]],["p-b0e2aad6.system",[[0,"salla-products-slider",{"blockTitle":[1,"block-title"],"subTitle":[1,"sub-title"],"sliderId":[1,"slider-id"],"displayAllUrl":[1,"display-all-url"],"source":[1537],"sourceValue":[1,"source-value"],"productsData":[32],"isReady":[32],"sourceValueIsValid":[32],"hasCustomComponent":[32],"urlPrefix":[32],"apiUrl":[32],"parsedSourceValue":[32]}]]],["p-8a361b7c.system",[[0,"salla-product-options",{"productId":[2,"product-id"],"options":[1],"optionsData":[32],"outOfStockText":[32],"donationAmount":[32],"selectedOptions":[32],"canDisabled":[32],"selectedSkus":[32],"selectedOutSkus":[32],"getSelectedOptionsData":[64],"reportValidity":[64],"hasOutOfStockOption":[64],"getSelectedOptions":[64],"getOption":[64]}]]],["p-d859be20.system",[[0,"salla-comment-form",{"type":[1537],"showAvatar":[4,"show-avatar"],"itemId":[1544,"item-id"],"placeholder":[32],"submitText":[32],"canComment":[32]}]]],["p-8e083fc9.system",[[0,"salla-installment",{"price":[1],"language":[1],"currency":[1],"tamaraIsActive":[32],"tabbyIsActive":[32],"spotiiIsActive":[32]}]]],["p-14d340bf.system",[[0,"salla-loyalty-prize-item",{"item":[16]}]]],["p-2c4e8bf8.system",[[0,"salla-products-list",{"source":[1537],"sourceValue":[1032,"source-value"],"limit":[1026],"filters":[1025],"horizontalCards":[516,"horizontal-cards"],"page":[32],"nextPage":[32],"hasInfiniteScroll":[32],"hasCustomComponent":[32],"sourceValueIsValid":[32],"placeholderText":[32],"isReady":[32],"showPlaceholder":[32],"urlPrefix":[32],"parsedFilters":[32]}]]],["p-2b618d65.system",[[4,"salla-conditional-fields",null,[[0,"change","changeHandler"]]]]]]'),e)}))}}}));
|
|
4
|
+
System.register(["./p-99570099.system.js","./p-cdbdb338.system.js","./p-99ed8fff.system.js"],(function(e,a){"use strict";var t,l,o;return{setters:[function(a){t=a.p;l=a.b;e("setNonce",a.s)},function(e){o=e.g},function(){}],execute:function(){var e=function(){var e=a.meta.url;var l={};if(e!==""){l.resourcesUrl=new URL(".",e).href}return t(l)};e().then((function(e){o();return l(JSON.parse('[["p-beb0d14b.system",[[4,"salla-gifting",{"productId":[2,"product-id"],"widgetSubtitle":[1,"widget-subtitle"],"sectionTitle":[32],"sectionSubtitle":[32],"sectionBtnText":[32],"giftDetails":[32],"selectImageForYourGift":[32],"selectImageOrUpload":[32],"selectGiftMessage":[32],"giftCustomText":[32],"textId":[32],"incorrectGiftText":[32],"nextStep":[32],"senderNameLabel":[32],"receiverNameFieldLabel":[32],"receiverMobileFieldLabel":[32],"receiverEmailFieldLabel":[32],"emailPlaceholder":[32],"sendLater":[32],"selectSendDateAndTime":[32],"canNotEditOrderAfterSelectDate":[32],"sendGift":[32],"donationRequired":[32],"currentStep":[32],"showCalendar":[32],"showGiftText":[32],"currentLang":[32],"parentClass":[32],"errors":[32],"gift":[32],"selectedGiftTextOption":[32],"showTextArea":[32],"selectedImage":[32],"uploadedImage":[32],"selectedText":[32],"senderName":[32],"errorMessage":[32],"hasError":[32],"quantity":[32],"deliveryDate":[32],"timeZone":[32],"receiverName":[32],"receiverMobile":[32],"receiverCountryCode":[32],"receiverEmail":[32],"open":[64],"close":[64],"goToStep2":[64]}],[4,"salla-loyalty",{"prizePoints":[1544,"prize-points"],"customerPoints":[1538,"customer-points"],"prizeTitle":[1537,"prize-title"],"allowEmail":[4,"allow-email"],"allowMobile":[4,"allow-mobile"],"requireEmail":[4,"require-email"],"guestMessage":[1025,"guest-message"],"loyaltyProgram":[32],"buttonLoading":[32],"selectedItem":[32],"askConfirmation":[32],"is_loggedin":[32],"hasError":[32],"errorMessage":[32],"translationLoaded":[32],"open":[64],"close":[64],"resetExchange":[64],"exchangeLoyaltyPoint":[64]}],[4,"salla-product-size-guide",{"guides":[32],"productId":[32],"placeholder_title":[32],"placeholder_description":[32],"modal_title":[32],"hasError":[32],"open":[64],"close":[64]}],[4,"salla-login-modal",{"isEmailAllowed":[1028,"is-email-allowed"],"isMobileAllowed":[1028,"is-mobile-allowed"],"isEmailRequired":[1028,"is-email-required"],"supportWebAuth":[516,"support-web-auth"],"currentTabName":[32],"regType":[32],"translationLoaded":[32],"title":[32],"emailErrorMsg":[32],"firstNameErrorMsg":[32],"lastNameErrorMsg":[32],"dragAndDrop":[32],"browseFromFiles":[32],"customFields":[32],"uploadedImage":[32],"open":[64]},[[8,"verified","onVerified"]]],[0,"salla-offer-modal",{"offer":[32],"offer_name":[32],"offer_message":[32],"hasError":[32],"errorMessage":[32],"productID":[32],"offer_type":[32],"translationLoaded":[32],"addToCartLabel":[32],"open":[64],"showOffer":[64]}],[0,"salla-rating-modal",{"orderId":[2,"order-id"],"order":[32],"hasError":[32],"errorMessage":[32],"translationLoaded":[32],"open":[64],"close":[64]}],[4,"salla-scopes",{"selection":[1],"searchDisplayLimit":[2,"search-display-limit"],"translationLoaded":[32],"mode":[32],"current_scope":[32],"scopes":[32],"originalScopesList":[32],"selected_scope":[32],"isOpenedBefore":[32],"hasError":[32],"loading":[32],"close":[64],"open":[64],"handleSubmit":[64]}],[0,"salla-localization-modal",{"language":[1537],"currency":[1537],"translationLoaded":[32],"languages":[32],"currencies":[32],"hasError":[32],"errorMessage":[32],"open":[64],"close":[64],"submit":[64]}],[0,"salla-quick-order",{"quickOrderTitle":[1025,"quick-order-title"],"subTitle":[1025,"sub-title"],"payButtonTitle":[1025,"pay-button-title"],"confirmPayButtonTitle":[1025,"confirm-pay-button-title"],"agreementText":[1025,"agreement-text"],"isEmailRequired":[1028,"is-email-required"],"productId":[1025,"product-id"],"thanksMessage":[1025,"thanks-message"],"quickOrderStyle":[1025,"quick-order-style"],"user":[32],"isAvailable":[32],"oneClick":[32],"expanded":[32],"isTermsRequired":[32],"countryCode":[32],"submitSucess":[32],"placeHolderEmail":[32],"emailOptional":[32],"agreementShowText":[32],"agreementModalHead":[32],"userNameLabel":[32],"termsChecked":[32]}],[0,"salla-user-settings",{"isNotifiable":[516,"is-notifiable"],"deactivateAccount":[32],"promotionalMsgs":[32],"deactivateDesc":[32],"promotionalMsgsDesc":[32],"sorryForLeavingText":[32],"warningText":[32],"keepAccount":[32],"buttonLoading":[32]}],[0,"salla-search",{"inline":[4],"oval":[4],"height":[2],"translationLoaded":[32],"results":[32],"loading":[32],"typing":[32],"debounce":[32],"search_term":[32]},[[0,"keydown","handleKeyDown"]]],[4,"salla-social-share",{"url":[513],"urlName":[513,"url-name"],"platforms":[513],"opened":[32],"allPlatforms":[32],"platformIcons":[32],"convertedPlatforms":[32],"open":[64]}],[4,"salla-cart-summary",{"showCartLabel":[4,"show-cart-label"],"cartSummaryCount":[32],"cartSummaryTotal":[32],"cartLabel":[32],"animateToCart":[64]}],[4,"salla-infinite-scroll",{"nextPage":[1,"next-page"],"autoload":[1028],"container":[1],"item":[1],"loadMore":[32],"noMore":[32],"failedToLoad":[32]}],[0,"salla-maintenance-alert",{"title":[32],"message":[32],"buttonTitle":[32]}],[4,"salla-quantity-input",{"quantity":[32],"decrease":[64],"increase":[64],"setValue":[64]}],[4,"salla-user-menu",{"inline":[516],"avatarOnly":[516,"avatar-only"],"showHeader":[516,"show-header"],"relativeDropdown":[516,"relative-dropdown"],"accountLoading":[32],"opened":[32],"notifications":[32],"orders":[32],"pending_orders":[32],"wishlist":[32],"profile":[32],"rating":[32],"logout":[32],"hello":[32],"first_name":[32],"last_name":[32],"avatar":[32],"is_loggedIn":[32],"badges":[32],"hasBadges":[32],"OrderUpdate":[32]}],[4,"salla-product-card",{"product":[1],"horizontal":[4],"shadowOnHover":[4,"shadow-on-hover"],"hideAddBtn":[4,"hide-add-btn"],"fullImage":[4,"full-image"],"minimal":[4],"isSpecial":[4,"is-special"],"showQuantity":[4,"show-quantity"],"productData":[32],"fitImageHeight":[32],"remained":[32],"outOfStock":[32],"donationAmount":[32],"startingPrice":[32],"addToCart":[32],"placeholder":[32]}],[4,"salla-map",{"name":[1],"required":[4],"readonly":[4],"searchable":[1028],"lat":[1026],"lng":[1026],"apiKey":[1025,"api-key"],"modalTitle":[1,"modal-title"],"zoom":[1026],"theme":[1025],"modalActivityTitle":[32],"confirmButtonTitle":[32],"locateButtonTitle":[32],"locateButtonEdit":[32],"searchPlaceholder":[32],"searchInputValue":[32],"formattedAddress":[32],"geolocationError":[32],"searchInput":[32],"mapInput":[32],"mapElement":[32],"selectedLat":[32],"selectedLng":[32],"open":[64]}],[4,"salla-verify",{"display":[1],"type":[1025],"autoReload":[4,"auto-reload"],"supportWebAuth":[4,"support-web-auth"],"translationLoaded":[32],"title":[32],"resendAfter":[32],"isProfileVerify":[32],"getCode":[64],"open":[64]}],[4,"salla-color-picker",{"name":[1],"required":[4],"color":[1537],"format":[1],"showCancelButton":[4,"show-cancel-button"],"showTextField":[4,"show-text-field"],"enableAlpha":[4,"enable-alpha"],"widgetColor":[32],"setPickerOption":[64],"movePopUp":[64],"setColorValue":[64],"openPicker":[64],"closePicker":[64],"destroyPicker":[64]}],[0,"salla-rating-stars",{"name":[1],"size":[1],"value":[2],"reviews":[2]}],[4,"salla-add-product-button",{"channels":[513],"subscribedOptions":[1,"subscribed-options"],"quickBuy":[1540,"quick-buy"],"quantity":[514],"donatingAmount":[514,"donating-amount"],"notifyOptionsAvailability":[516,"notify-options-availability"],"productId":[520,"product-id"],"supportStickyBar":[516,"support-sticky-bar"],"productStatus":[513,"product-status"],"productType":[513,"product-type"],"hasOutOfStockOption":[32],"hasSubscribedOptions":[32],"selectedOptions":[32],"showQuickBuy":[32]}],[0,"salla-count-down",{"date":[1],"boxed":[4],"size":[1],"color":[1],"labeled":[4],"endText":[1,"end-text"],"digits":[1],"endOfDay":[4,"end-of-day"],"daysLabel":[32],"hoursLabel":[32],"minutesLabel":[32],"secondsLabel":[32],"endLabel":[32],"invalidDate":[32],"offerEnded":[32],"countInterval":[32],"days":[32],"hours":[32],"minutes":[32],"seconds":[32],"endCountDown":[64]}],[0,"salla-datetime-picker",{"value":[1537],"required":[4],"name":[513],"placeholder":[1],"allowInput":[4,"allow-input"],"allowInvalidPreload":[4,"allow-invalid-preload"],"altFormat":[1,"alt-format"],"altInput":[4,"alt-input"],"altInputClass":[1,"alt-input-class"],"appendTo":[16],"ariaDateFormat":[1,"aria-date-format"],"autoFillDefaultTime":[4,"auto-fill-default-time"],"clickOpens":[4,"click-opens"],"closeOnSelect":[4,"close-on-select"],"conjunction":[1],"dateFormat":[1,"date-format"],"defaultDate":[8,"default-date"],"defaultHour":[2,"default-hour"],"defaultMinute":[2,"default-minute"],"defaultSeconds":[2,"default-seconds"],"disable":[16],"disableMobile":[4,"disable-mobile"],"enable":[16],"enableSeconds":[4,"enable-seconds"],"enableTime":[4,"enable-time"],"formatDate":[16],"hourIncrement":[2,"hour-increment"],"inline":[4],"locale":[1],"maxDate":[8,"max-date"],"maxTime":[8,"max-time"],"minDate":[8,"min-date"],"minTime":[8,"min-time"],"minuteIncrement":[2,"minute-increment"],"mode":[1],"monthSelectorType":[1,"month-selector-type"],"nextArrow":[1,"next-arrow"],"noCalendar":[4,"no-calendar"],"dateParser":[16],"position":[1],"positionElement":[16],"prevArrow":[1,"prev-arrow"],"shorthandCurrentMonth":[4,"shorthand-current-month"],"static":[4],"showMonths":[2,"show-months"],"time_24hr":[4,"time_-2-4hr"],"weekNumbers":[4,"week-numbers"],"wrap":[4]}],[4,"salla-tab-content",{"name":[1],"isSelected":[32],"getChild":[64]}],[4,"salla-tab-header",{"name":[1],"activeClass":[1,"active-class"],"height":[8],"centered":[4],"isSelected":[32],"getChild":[64]}],[4,"salla-tabs",{"backgroundColor":[1,"background-color"],"vertical":[4]},[[0,"tabSelected","onSelectedTab"]]],[0,"salla-product-availability",{"channels":[1],"notifyOptionsAvailability":[4,"notify-options-availability"],"productId":[2,"product-id"],"isSubscribed":[1028,"is-subscribed"],"translationLoaded":[32],"title_":[32],"isVisitorSubscribed":[32]}],[0,"salla-quick-buy",{"type":[1025],"productId":[1025,"product-id"],"amount":[1538],"currency":[1025],"options":[16],"isRequireShipping":[1028,"is-require-shipping"],"isApplePayActive":[32],"quickBuy":[32]}],[0,"salla-file-upload",{"value":[1537],"files":[513],"height":[513],"cartItemId":[1,"cart-item-id"],"profileImage":[516,"profile-image"],"name":[1537],"payloadName":[1,"payload-name"],"accept":[1537],"fileId":[2,"file-id"],"url":[1025],"method":[1],"formData":[1,"form-data"],"required":[4],"maxFileSize":[1,"max-file-size"],"disabled":[4],"allowDrop":[4,"allow-drop"],"allowBrowse":[4,"allow-browse"],"allowPaste":[4,"allow-paste"],"allowMultiple":[4,"allow-multiple"],"allowReplace":[4,"allow-replace"],"allowRevert":[4,"allow-revert"],"allowRemove":[4,"allow-remove"],"allowProcess":[4,"allow-process"],"allowReorder":[4,"allow-reorder"],"storeAsFile":[4,"store-as-file"],"forceRevert":[4,"force-revert"],"maxFilesCount":[2,"max-files-count"],"maxParallelUploads":[2,"max-parallel-uploads"],"checkValidity":[4,"check-validity"],"itemInsertLocation":[1,"item-insert-location"],"itemInsertInterval":[2,"item-insert-interval"],"credits":[4],"dropOnPage":[4,"drop-on-page"],"dropOnElement":[4,"drop-on-element"],"dropValidation":[4,"drop-validation"],"ignoredFiles":[16],"instantUpload":[1028,"instant-upload"],"chunkUploads":[4,"chunk-uploads"],"chunkForce":[4,"chunk-force"],"chunkSize":[2,"chunk-size"],"chunkRetryDelays":[16],"labelDecimalSeparator":[1,"label-decimal-separator"],"labelThousandsSeparator":[1,"label-thousands-separator"],"labelIdle":[1025,"label-idle"],"iconRemove":[1,"icon-remove"],"iconProcess":[1,"icon-process"],"iconRetry":[1,"icon-retry"],"iconUndo":[1,"icon-undo"],"setOption":[64]}],[0,"salla-progress-bar",{"donation":[1],"target":[1026],"value":[1026],"height":[1025],"header":[1025],"stripped":[1028],"message":[1025],"unit":[1025],"color":[1025]}],[4,"salla-list-tile",{"href":[1],"target":[1]}],[4,"salla-slider",{"blockTitle":[513,"block-title"],"listenToThumbnailsOption":[516,"listen-to-thumbnails-option"],"blockSubtitle":[513,"block-subtitle"],"displayAllUrl":[513,"display-all-url"],"arrowsCentered":[516,"arrows-centered"],"verticalThumbs":[516,"vertical-thumbs"],"gridThumbs":[516,"grid-thumbs"],"vertical":[516],"autoHeight":[516,"auto-height"],"showControls":[516,"show-controls"],"controlsOuter":[516,"controls-outer"],"showThumbsControls":[4,"show-thumbs-controls"],"autoPlay":[4,"auto-play"],"slidesPerView":[1,"slides-per-view"],"pagination":[4],"centered":[4],"loop":[4],"direction":[1537],"type":[1],"sliderConfig":[520,"slider-config"],"thumbsConfig":[520,"thumbs-config"],"currentIndex":[32],"isEnd":[32],"isBeginning":[32],"swiperScript":[32],"displayAllTitle":[32],"slideTo":[64],"slideNext":[64],"slidePrev":[64],"slideToLoop":[64],"slideNextLoop":[64],"slidePrevLoop":[64],"slideReset":[64],"slideToClosest":[64],"update":[64],"updateAutoHeight":[64],"updateSlides":[64],"updateProgress":[64],"updateSlidesClasses":[64],"getSlides":[64]}],[4,"salla-placeholder",{"icon":[1],"alignment":[1],"iconSize":[1,"icon-size"],"translationLoaded":[32]}],[0,"salla-skeleton",{"type":[1],"width":[1],"height":[1]}],[0,"salla-tel-input",{"phone":[1025],"name":[1],"countryCode":[1025,"country-code"],"mobileRequired":[32],"countryCodeLabel":[32],"mobileLabel":[32],"tooShort":[32],"tooLong":[32],"invalidCountryCode":[32],"invalidNumber":[32],"errorMap":[32],"getValues":[64],"isValid":[64]}],[4,"salla-modal",{"isClosable":[1028,"is-closable"],"width":[513],"position":[513],"visible":[516],"hasSkeleton":[516,"has-skeleton"],"isLoading":[1540,"is-loading"],"subTitleFirst":[4,"sub-title-first"],"noPadding":[4,"no-padding"],"subTitle":[1,"sub-title"],"centered":[4],"iconStyle":[1,"icon-style"],"modalTitle":[32],"open":[64],"close":[64],"setTitle":[64],"loading":[64],"stopLoading":[64]},[[0,"keyup","handleKeyUp"]]],[4,"salla-button",{"shape":[513],"color":[513],"fill":[513],"size":[513],"width":[513],"loading":[516],"disabled":[516],"loaderPosition":[1,"loader-position"],"href":[1],"load":[64],"stop":[64],"setText":[64],"disable":[64],"enable":[64]}],[0,"salla-loading",{"size":[8],"width":[8],"color":[1],"bgColor":[1,"bg-color"]}]]],["p-b0e2aad6.system",[[0,"salla-products-slider",{"blockTitle":[1,"block-title"],"subTitle":[1,"sub-title"],"sliderId":[1,"slider-id"],"displayAllUrl":[1,"display-all-url"],"source":[1537],"sourceValue":[1,"source-value"],"productsData":[32],"isReady":[32],"sourceValueIsValid":[32],"hasCustomComponent":[32],"urlPrefix":[32],"apiUrl":[32],"parsedSourceValue":[32]}]]],["p-8a361b7c.system",[[0,"salla-product-options",{"productId":[2,"product-id"],"options":[1],"optionsData":[32],"outOfStockText":[32],"donationAmount":[32],"selectedOptions":[32],"canDisabled":[32],"selectedSkus":[32],"selectedOutSkus":[32],"getSelectedOptionsData":[64],"reportValidity":[64],"hasOutOfStockOption":[64],"getSelectedOptions":[64],"getOption":[64]}]]],["p-d859be20.system",[[0,"salla-comment-form",{"type":[1537],"showAvatar":[4,"show-avatar"],"itemId":[1544,"item-id"],"placeholder":[32],"submitText":[32],"canComment":[32]}]]],["p-8e083fc9.system",[[0,"salla-installment",{"price":[1],"language":[1],"currency":[1],"tamaraIsActive":[32],"tabbyIsActive":[32],"spotiiIsActive":[32]}]]],["p-14d340bf.system",[[0,"salla-loyalty-prize-item",{"item":[16]}]]],["p-91b4ebaf.system",[[0,"salla-products-list",{"source":[1537],"sourceValue":[1032,"source-value"],"limit":[1026],"filters":[1025],"horizontalCards":[516,"horizontal-cards"],"page":[32],"nextPage":[32],"hasInfiniteScroll":[32],"hasCustomComponent":[32],"sourceValueIsValid":[32],"placeholderText":[32],"isReady":[32],"showPlaceholder":[32],"urlPrefix":[32],"parsedFilters":[32]}]]],["p-2b618d65.system",[[4,"salla-conditional-fields",null,[[0,"change","changeHandler"]]]]]]'),e)}))}}}));
|
|
5
5
|
//# sourceMappingURL=p-1b5ffc6d.system.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Crafted with ❤ by Salla
|
|
3
|
+
*/
|
|
4
|
+
import{r as s,h as t,H as i,g as e}from"./p-29c587ff.js";const r=`\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 n="";const l=class{constructor(t){s(this,t);this.source=undefined;this.sourceValue=undefined;this.limit=undefined;this.filters=undefined;this.horizontalCards=undefined;this.page=1;this.nextPage=undefined;this.hasInfiniteScroll=undefined;this.hasCustomComponent=undefined;this.sourceValueIsValid=undefined;this.placeholderText=undefined;this.isReady=undefined;this.showPlaceholder=undefined;this.urlPrefix="";this.parsedFilters=undefined;salla.onReady((()=>{this.sourceValueIsValid=!!(this.getSourceValue()||this.isSourceWithoutValue());this.buildNextPageUrl();this.isReady=true}));if(!this.sourceValueIsValid){salla.logger.warn(`source-value prop is required for source [${this.getSource()}]`);return}this.hasCustomComponent=!!customElements.get("custom-salla-product-card");this.hasInfiniteScroll=!["json","selected","related","landing-page"].includes(this.getSource());this.status=document.createElement("div");this.status.className="s-infinite-scroll-wrapper";this.status.innerHTML=`<div class="s-infinite-scroll-status">\n <p class="s-infinite-scroll-last infinite-scroll-last s-hidden" >${salla.lang.get("common.elements.end_of_content")}</p>\n <p class="s-infinite-scroll-error infinite-scroll-error s-hidden">${salla.lang.get("common.elements.failed_to_load_more")}</p>\n </div>\n <a href="#" class="s-infinite-scroll-btn s-button-btn">\n <span class="s-button-loader s-button-loader-center s-infinite-scroll-btn-loader" style="display: none"></span>\n </a>`;this.btnLoader=this.status.querySelector(".s-button-loader");salla.lang.onLoaded((()=>{this.status.querySelector(".s-infinite-scroll-last").innerHTML=salla.lang.get("common.elements.end_of_content");this.status.querySelector(".s-infinite-scroll-error").innerHTML=salla.lang.get("common.elements.failed_to_load_more");this.placeholderText=salla.lang.get("pages.categories.no_products")}))}validateLimitMaximumValue(s,t){if(this.limit){this.urlPrefix+=`&per_page=${this.limit>32?32:this.limit}}`}}parseFilters(s,t){this.parsedFilters=typeof s=="string"?JSON.parse(s):s;this.urlPrefix="";for(const[s,t]of Object.entries(this.parsedFilters)){if(typeof t=="string"){this.urlPrefix+=`&filters[${s}]=${t}`}else if(Array.isArray(t)){t.forEach((t=>{this.urlPrefix+=`&filters[${s}][]=${t}}`}))}}if(this.getSource()=="categories"){this.wrapper.innerHTML="";this.init()}}isSourceWithoutValue(){return["offers","latest","sales"].includes(this.getSource())}buildNextPageUrl(){let s=this.getSource();if(s==="json"){return}if(this.isSourceWithoutValue()){this.nextPage=salla.url.api(`products?source=${s}${this.urlPrefix}`);return}if(["search","related","landing-page"].includes(s)){this.nextPage=salla.url.api(`products?source=${s}&source_value=${this.getSourceValue()}${this.urlPrefix}`);return}try{this.nextPage=salla.url.api(`products?source=${s}&source_value[]=${this.getSourceValue().join("&source_value[]=")}${this.urlPrefix}`)}catch(t){salla.logger.warn(`source-value prop should be array of ids ex source-value="[1,2,3]" for the source [${s}]`);this.sourceValueIsValid=false}}getSource(){return{"brands.single":"brands","product.index":"categories","product.index.latest":"latest","product.index.offers":"offers","product.index.search":"search","landing-page":"landing-page","product.index.tag":"tags","product.index.sales":"sales","components.most_sales_products":"sales"}[this.source||salla.config.get("page.slug")]||this.source||"latest"}getSourceValue(){let s=this.getSource();if(!["search","json","offers","latest","sales"].includes(s)){if(Array.isArray(JSON.parse(this.sourceValue))&&JSON.parse(this.sourceValue).length){return JSON.parse(this.sourceValue)}if(typeof JSON.parse(this.sourceValue)=="number"){return[JSON.parse(this.sourceValue)]}}if(this.sourceValue){return this.sourceValue}if(s==="search"){return new URLSearchParams(window.location.search).get("q")}return salla.config.get("page.id")}loading(s=true){this.btnLoader.style.display=s?"inherit":"none"}getItemHTML(s){let t=this.hasCustomComponent?"custom-salla-product-card":"salla-product-card";t=document.createElement(t);t.setAttribute("product",JSON.stringify(s));if(this.getSource()=="landing-page"&&!this.hasCustomComponent){t.toggleAttribute("hide-add-btn",true);t.classList.add("s-product-card-fit-height")}if(this.horizontalCards&&!this.hasCustomComponent){t.toggleAttribute("horizontal",true)}t.toggleAttribute("shadow-on-hover",true);return t}initiateInfiniteScroll(){if(!this.hasInfiniteScroll){return}this.host.insertAdjacentElement("afterend",this.status);this.infiniteScroll=salla.infiniteScroll.initiate(this.wrapper,this.wrapper,{path:()=>this.nextPage,history:false,nextPage:this.nextPage,scrollThreshold:100},true);this.infiniteScroll.on("request",(()=>this.loading()));this.infiniteScroll.on("load",(s=>this.infiniteScroll.appendItems(this.handleResponse(s))));this.infiniteScroll.on("error",(()=>{this.status.querySelector(".s-infinite-scroll-error").classList.remove("s-hidden");this.loading(false)}))}canRender(){return this.sourceValueIsValid&&this.isReady}render(){if(!this.canRender()){return""}if(this.showPlaceholder){return t("div",{class:"s-products-list-placeholder"},t("span",{innerHTML:r}),t("p",null,this.placeholderText))}return t(i,{class:"s-products-list"},t("div",{class:{"s-products-list-wrapper":true,"s-products-list-horizontal-cards":this.horizontalCards,"s-products-list-vertical-cards":!this.horizontalCards},ref:s=>this.wrapper=s}))}componentDidLoad(){if(!this.canRender()){return}if(this.getSource()==="json"){if(!this.getSourceValue().length){this.showPlaceholder=true;return}this.getSourceValue().map((s=>this.wrapper.append(this.getItemHTML(s))));return}if(this.getSource()=="categories"){const s=window.location.search.replace("?","").split("&").map((s=>s.split("="))).reduce(((s,[t,i])=>{if(t=="sort"){s[t]=i}return s}),{});if(Object.entries(s).length){this.filters=s;return}}this.init()}init(){this.initiateInfiniteScroll();this.loading();salla.product.fetch({source:this.getSource(),source_value:this.getSourceValue(),filters:this.filters,limit:this.limit}).then((s=>{if(!s.data.length){this.showPlaceholder=true;this.loading(false);return}this.handleResponse(s).forEach((s=>this.wrapper.append(s)))}))}handleResponse(s){var t;this.nextPage=s.cursor?s.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((t=s.data)===null||t===void 0?void 0:t.map((s=>this.getItemHTML(s))))||[]}get host(){return e(this)}static get watchers(){return{limit:["validateLimitMaximumValue"],filters:["parseFilters"]}}};l.style=n;export{l as salla_products_list};
|
|
5
|
+
//# sourceMappingURL=p-3f6bca30.entry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["sallaProductsListCss","SallaProductsList","constructor","hostRef","salla","onReady","this","sourceValueIsValid","getSourceValue","isSourceWithoutValue","buildNextPageUrl","isReady","logger","warn","getSource","hasCustomComponent","customElements","get","hasInfiniteScroll","includes","status","document","createElement","className","innerHTML","lang","btnLoader","querySelector","onLoaded","placeholderText","validateLimitMaximumValue","_newValue","_","limit","urlPrefix","parseFilters","newValue","parsedFilters","JSON","parse","key","value","Object","entries","Array","isArray","forEach","item","wrapper","init","source","nextPage","url","api","join","e","config","sourceValue","length","URLSearchParams","window","location","search","loading","isLoading","style","display","getItemHTML","product","customComponent","setAttribute","stringify","toggleAttribute","classList","add","horizontalCards","initiateInfiniteScroll","host","insertAdjacentElement","infiniteScroll","initiate","path","history","scrollThreshold","on","response","appendItems","handleResponse","remove","canRender","render","showPlaceholder","h","class","ShoppingBag","Host","ref","componentDidLoad","map","append","filters","replace","split","reduce","acc","fetch","source_value","then","res","data","card","cursor","next","option","loadOnScroll","_a"],"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, Watch} from '@stencil/core';\nimport ShoppingBag from '../../assets/svg/shopping-bag.svg';\n\n@Component({\n tag: 'salla-products-list',\n styleUrl: 'salla-products-list.scss'\n})\nexport class SallaProductsList {\n constructor() {\n salla.onReady(() => {\n this.sourceValueIsValid = !!(this.getSourceValue() || this.isSourceWithoutValue());\n this.buildNextPageUrl();\n this.isReady = true;\n });\n\n if (!this.sourceValueIsValid) {\n salla.logger.warn(`source-value prop is required for source [${this.getSource()}]`);\n return;\n }\n this.hasCustomComponent = !!customElements.get('custom-salla-product-card');\n\n this.hasInfiniteScroll = !['json', 'selected', 'related', 'landing-page'].includes(this.getSource());\n // Language\n //enhance\n this.status = document.createElement('div');\n this.status.className = 's-infinite-scroll-wrapper';\n this.status.innerHTML = `<div class=\"s-infinite-scroll-status\">\n <p class=\"s-infinite-scroll-last infinite-scroll-last s-hidden\" >${salla.lang.get('common.elements.end_of_content')}</p>\n <p class=\"s-infinite-scroll-error infinite-scroll-error s-hidden\">${salla.lang.get('common.elements.failed_to_load_more')}</p>\n </div>\n <a href=\"#\" class=\"s-infinite-scroll-btn s-button-btn\">\n <span class=\"s-button-loader s-button-loader-center s-infinite-scroll-btn-loader\" style=\"display: none\"></span>\n </a>`;\n this.btnLoader = this.status.querySelector('.s-button-loader');\n salla.lang.onLoaded(() => {\n this.status.querySelector('.s-infinite-scroll-last').innerHTML = salla.lang.get('common.elements.end_of_content');\n this.status.querySelector('.s-infinite-scroll-error').innerHTML = salla.lang.get('common.elements.failed_to_load_more');\n this.placeholderText = salla.lang.get('pages.categories.no_products');\n });\n }\n\n private readonly status: HTMLDivElement;\n private btnLoader: HTMLAnchorElement;\n @Element() host: HTMLElement;\n private wrapper: any;\n private infiniteScroll: any;\n /**\n * The source of the products list\n * @type {string}\n * */\n @Prop({\n reflect: true,\n mutable: true\n }) source: 'categories' | 'latest' | 'related' | 'brands' | 'json' | 'search' | 'tags' | 'selected' | 'offers' | 'landing-page' | 'sales';\n\n /**\n * The source value, cloud be different values as following:\n * - array of ids when `source` in ['categories', 'brands', 'tags', 'selected']\n * - keyword when `source` = 'search'\n * - products payload when `source` = 'json'\n * - product_id when `source` = 'related'\n *\n * @type {string}\n * */\n @Prop({mutable: true}) sourceValue: any;\n\n /**\n * Limit for number of products in the list.\n */\n @Prop({mutable: true}) limit: number;\n\n /**\n * Filter parameters. JSON STRING or object\n */\n @Prop({mutable: true}) filters: string | object;\n\n /**\n * Horizontal cards\n */\n @Prop({reflect: true}) horizontalCards: boolean\n\n @Watch('limit')\n validateLimitMaximumValue(_newValue: number, _) {\n if (this.limit) {\n this.urlPrefix += `&per_page=${this.limit > 32 ? 32 : this.limit}}`;\n }\n }\n\n @Watch('filters')\n parseFilters(newValue: string | object, _) {\n this.parsedFilters = typeof newValue == 'string' ? JSON.parse(newValue) : newValue\n this.urlPrefix = '';\n\n for (const [key, value] of Object.entries(this.parsedFilters)) {\n if (typeof value == \"string\") {\n this.urlPrefix += `&filters[${key}]=${value}`;\n } else if (Array.isArray(value)) {\n (value as any).forEach(item => {\n this.urlPrefix += `&filters[${key}][]=${item}}`\n })\n }\n }\n // reset page products\n if (this.getSource() == 'categories') {\n this.wrapper.innerHTML = '';\n this.init()\n }\n }\n\n // State\n @State() page: number = 1;\n @State() nextPage: string;\n @State() hasInfiniteScroll: boolean;\n @State() hasCustomComponent: boolean;\n @State() sourceValueIsValid: boolean;\n @State() placeholderText: string;\n @State() isReady: boolean;\n @State() showPlaceholder: boolean;\n @State() urlPrefix: string = '';\n @State() parsedFilters: any;\n\n private isSourceWithoutValue(){\n return ['offers', 'latest', 'sales'].includes(this.getSource());\n }\n\n private buildNextPageUrl() {\n let source = this.getSource();\n if (source === 'json') {\n return;\n }\n if (this.isSourceWithoutValue()) {\n this.nextPage = salla.url.api(`products?source=${source}${this.urlPrefix}`);\n return;\n }\n\n if (['search', 'related', 'landing-page'].includes(source)) {\n this.nextPage = salla.url.api(`products?source=${source}&source_value=${this.getSourceValue()}${this.urlPrefix}`);\n return;\n }\n\n try {\n this.nextPage = salla.url.api(`products?source=${source}&source_value[]=${this.getSourceValue().join('&source_value[]=')}${this.urlPrefix}`);\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 private getSource() {\n return {\n 'brands.single': 'brands',\n 'product.index': 'categories',\n 'product.index.latest': 'latest',\n 'product.index.offers': 'offers',\n 'product.index.search': 'search',\n 'landing-page': 'landing-page',\n 'product.index.tag': 'tags',\n 'product.index.sales': 'sales',\n 'components.most_sales_products': 'sales',//temporary, delete it after two days from now\n }[this.source || salla.config.get('page.slug')] || this.source || 'latest';\n }\n\n private getSourceValue() {\n let source = this.getSource();\n\n if (!['search', 'json', 'offers', 'latest', 'sales'].includes(source)) {\n if (Array.isArray(JSON.parse(this.sourceValue)) && JSON.parse(this.sourceValue).length) {\n return JSON.parse(this.sourceValue);\n }\n\n if (typeof JSON.parse(this.sourceValue) == 'number') {\n return [JSON.parse(this.sourceValue)];\n }\n }\n\n if (this.sourceValue) {\n return this.sourceValue;\n }\n\n\n if (source === 'search') {\n return (new URLSearchParams(window.location.search)).get('q');\n }\n\n return salla.config.get('page.id');\n }\n\n\n private loading(isLoading = true) {\n this.btnLoader.style.display = isLoading ? 'inherit' : 'none';\n }\n\n private getItemHTML(product) {\n let customComponent: string | HTMLElement = this.hasCustomComponent ? 'custom-salla-product-card' : 'salla-product-card';\n customComponent = document.createElement(customComponent);\n customComponent.setAttribute('product', JSON.stringify(product));\n if (this.getSource() == 'landing-page' && !this.hasCustomComponent) {\n customComponent.toggleAttribute('hide-add-btn', true);\n customComponent.classList.add('s-product-card-fit-height');\n }\n if (this.horizontalCards && !this.hasCustomComponent) {\n customComponent.toggleAttribute('horizontal', true);\n }\n customComponent.toggleAttribute('shadow-on-hover', true);\n return customComponent;\n }\n\n private initiateInfiniteScroll() {\n if (!this.hasInfiniteScroll) {\n return;\n }\n\n this.host.insertAdjacentElement('afterend', this.status);\n this.infiniteScroll = salla.infiniteScroll.initiate(this.wrapper, this.wrapper, {\n path: () => this.nextPage,\n history: false,\n nextPage: this.nextPage,\n scrollThreshold: 100,\n }, /* infinite via api*/true);\n this.infiniteScroll.on('request', () => this.loading())\n this.infiniteScroll.on('load', response => this.infiniteScroll.appendItems(this.handleResponse(response)))\n this.infiniteScroll.on('error', () => {\n this.status.querySelector('.s-infinite-scroll-error').classList.remove('s-hidden')\n this.loading(false);\n });\n }\n\n private canRender() {\n return this.sourceValueIsValid && this.isReady;\n }\n\n render() {\n if (!this.canRender()) {\n return '';\n }\n if (this.showPlaceholder) {\n return <div class=\"s-products-list-placeholder\">\n <span innerHTML={ShoppingBag}/>\n <p>{this.placeholderText}</p>\n </div>;\n }\n return (\n <Host class=\"s-products-list\">\n <div class={{\n \"s-products-list-wrapper\": true,\n 's-products-list-horizontal-cards': this.horizontalCards,\n 's-products-list-vertical-cards': !this.horizontalCards,\n }}\n ref={wrapper => this.wrapper = wrapper}/>\n </Host>\n );\n }\n\n componentDidLoad() {\n if (!this.canRender()) {\n return;\n }\n if (this.getSource() === 'json') {\n if (!this.getSourceValue().length) {\n this.showPlaceholder = true;\n return;\n }\n this.getSourceValue().map(product => this.wrapper.append(this.getItemHTML(product)));\n return;\n }\n if (this.getSource() == 'categories') {\n // check if there is a filters in the url\n const filters = window.location.search\n .replace('?', '')\n .split('&')\n .map(item => item.split('='))\n .reduce((acc, [key, value]) => {\n if (key == 'sort') {\n acc[key] = value;\n }\n return acc;\n }, {});\n if (Object.entries(filters).length) {\n this.filters = filters;\n return;\n }\n }\n this.init();\n }\n\n private init() {\n this.initiateInfiniteScroll();\n this.loading();\n salla.product.fetch({\n source: this.getSource(),\n source_value: this.getSourceValue(),\n filters: this.filters,\n limit: this.limit\n })\n .then(res => {\n if (!res.data.length) {\n this.showPlaceholder = true;\n this.loading(false);\n return;\n }\n this.handleResponse(res).forEach(card => this.wrapper.append(card));\n })\n }\n\n private handleResponse(response): Array<HTMLElement> {\n //💡 when source is related, cursor will not be existed\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":";;;+wBAAA,MAAMA,EAAuB,G,MCOhBC,EAAiB,MAC5BC,YAAAC,G,gJAsGwB,E,iOAQK,G,6BA7G3BC,MAAMC,SAAQ,KACZC,KAAKC,sBAAwBD,KAAKE,kBAAoBF,KAAKG,wBAC3DH,KAAKI,mBACLJ,KAAK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EvB,eAAeF,G,MAErB/E,KAAK6C,SAAWkC,EAAS0B,OAAS1B,EAAS0B,OAAOC,KAAO1G,KAAK6C,SAC9D7C,KAAKyD,QAAQ,OACb,GAAIzD,KAAKY,oBAAsBZ,KAAK6C,SAAU,CAC5C7C,KAAKyE,eAAekC,OAAO,CAAC9B,gBAAiB,MAAO+B,aAAc,QAClE5G,KAAKc,OAAOO,cAAc,2BAA2B8C,UAAUe,OAAO,W,CAExE,QAAO2B,EAAA9B,EAASwB,QAAI,MAAAM,SAAA,SAAAA,EAAEjB,KAAI9B,GAAW9D,KAAK6D,YAAYC,OAAa,E"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Crafted with ❤ by Salla
|
|
3
|
+
*/
|
|
4
|
+
System.register(["./p-99570099.system.js"],(function(e){"use strict";var t,s,i,r;return{setters:[function(e){t=e.r;s=e.h;i=e.H;r=e.g}],execute:function(){var n='\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 o="";var a=e("salla_products_list",function(){function e(e){var s=this;t(this,e);this.source=undefined;this.sourceValue=undefined;this.limit=undefined;this.filters=undefined;this.horizontalCards=undefined;this.page=1;this.nextPage=undefined;this.hasInfiniteScroll=undefined;this.hasCustomComponent=undefined;this.sourceValueIsValid=undefined;this.placeholderText=undefined;this.isReady=undefined;this.showPlaceholder=undefined;this.urlPrefix="";this.parsedFilters=undefined;salla.onReady((function(){s.sourceValueIsValid=!!(s.getSourceValue()||s.isSourceWithoutValue());s.buildNextPageUrl();s.isReady=true}));if(!this.sourceValueIsValid){salla.logger.warn("source-value prop is required for source [".concat(this.getSource(),"]"));return}this.hasCustomComponent=!!customElements.get("custom-salla-product-card");this.hasInfiniteScroll=!["json","selected","related","landing-page"].includes(this.getSource());this.status=document.createElement("div");this.status.className="s-infinite-scroll-wrapper";this.status.innerHTML='<div class="s-infinite-scroll-status">\n <p class="s-infinite-scroll-last infinite-scroll-last s-hidden" >'.concat(salla.lang.get("common.elements.end_of_content"),'</p>\n <p class="s-infinite-scroll-error infinite-scroll-error s-hidden">').concat(salla.lang.get("common.elements.failed_to_load_more"),'</p>\n </div>\n <a href="#" class="s-infinite-scroll-btn s-button-btn">\n <span class="s-button-loader s-button-loader-center s-infinite-scroll-btn-loader" style="display: none"></span>\n </a>');this.btnLoader=this.status.querySelector(".s-button-loader");salla.lang.onLoaded((function(){s.status.querySelector(".s-infinite-scroll-last").innerHTML=salla.lang.get("common.elements.end_of_content");s.status.querySelector(".s-infinite-scroll-error").innerHTML=salla.lang.get("common.elements.failed_to_load_more");s.placeholderText=salla.lang.get("pages.categories.no_products")}))}e.prototype.validateLimitMaximumValue=function(e,t){if(this.limit){this.urlPrefix+="&per_page=".concat(this.limit>32?32:this.limit,"}")}};e.prototype.parseFilters=function(e,t){var s=this;this.parsedFilters=typeof e=="string"?JSON.parse(e):e;this.urlPrefix="";var i=function(e,t){if(typeof t=="string"){r.urlPrefix+="&filters[".concat(e,"]=").concat(t)}else if(Array.isArray(t)){t.forEach((function(t){s.urlPrefix+="&filters[".concat(e,"][]=").concat(t,"}")}))}};var r=this;for(var n=0,o=Object.entries(this.parsedFilters);n<o.length;n++){var a=o[n],l=a[0],c=a[1];i(l,c)}if(this.getSource()=="categories"){this.wrapper.innerHTML="";this.init()}};e.prototype.isSourceWithoutValue=function(){return["offers","latest","sales"].includes(this.getSource())};e.prototype.buildNextPageUrl=function(){var e=this.getSource();if(e==="json"){return}if(this.isSourceWithoutValue()){this.nextPage=salla.url.api("products?source=".concat(e).concat(this.urlPrefix));return}if(["search","related","landing-page"].includes(e)){this.nextPage=salla.url.api("products?source=".concat(e,"&source_value=").concat(this.getSourceValue()).concat(this.urlPrefix));return}try{this.nextPage=salla.url.api("products?source=".concat(e,"&source_value[]=").concat(this.getSourceValue().join("&source_value[]=")).concat(this.urlPrefix))}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.getSource=function(){return{"brands.single":"brands","product.index":"categories","product.index.latest":"latest","product.index.offers":"offers","product.index.search":"search","landing-page":"landing-page","product.index.tag":"tags","product.index.sales":"sales","components.most_sales_products":"sales"}[this.source||salla.config.get("page.slug")]||this.source||"latest"};e.prototype.getSourceValue=function(){var e=this.getSource();if(!["search","json","offers","latest","sales"].includes(e)){if(Array.isArray(JSON.parse(this.sourceValue))&&JSON.parse(this.sourceValue).length){return JSON.parse(this.sourceValue)}if(typeof JSON.parse(this.sourceValue)=="number"){return[JSON.parse(this.sourceValue)]}}if(this.sourceValue){return this.sourceValue}if(e==="search"){return new URLSearchParams(window.location.search).get("q")}return salla.config.get("page.id")};e.prototype.loading=function(e){if(e===void 0){e=true}this.btnLoader.style.display=e?"inherit":"none"};e.prototype.getItemHTML=function(e){var t=this.hasCustomComponent?"custom-salla-product-card":"salla-product-card";t=document.createElement(t);t.setAttribute("product",JSON.stringify(e));if(this.getSource()=="landing-page"&&!this.hasCustomComponent){t.toggleAttribute("hide-add-btn",true);t.classList.add("s-product-card-fit-height")}if(this.horizontalCards&&!this.hasCustomComponent){t.toggleAttribute("horizontal",true)}t.toggleAttribute("shadow-on-hover",true);return t};e.prototype.initiateInfiniteScroll=function(){var e=this;if(!this.hasInfiniteScroll){return}this.host.insertAdjacentElement("afterend",this.status);this.infiniteScroll=salla.infiniteScroll.initiate(this.wrapper,this.wrapper,{path:function(){return e.nextPage},history:false,nextPage:this.nextPage,scrollThreshold:100},true);this.infiniteScroll.on("request",(function(){return e.loading()}));this.infiniteScroll.on("load",(function(t){return e.infiniteScroll.appendItems(e.handleResponse(t))}));this.infiniteScroll.on("error",(function(){e.status.querySelector(".s-infinite-scroll-error").classList.remove("s-hidden");e.loading(false)}))};e.prototype.canRender=function(){return this.sourceValueIsValid&&this.isReady};e.prototype.render=function(){var e=this;if(!this.canRender()){return""}if(this.showPlaceholder){return s("div",{class:"s-products-list-placeholder"},s("span",{innerHTML:n}),s("p",null,this.placeholderText))}return s(i,{class:"s-products-list"},s("div",{class:{"s-products-list-wrapper":true,"s-products-list-horizontal-cards":this.horizontalCards,"s-products-list-vertical-cards":!this.horizontalCards},ref:function(t){return e.wrapper=t}}))};e.prototype.componentDidLoad=function(){var e=this;if(!this.canRender()){return}if(this.getSource()==="json"){if(!this.getSourceValue().length){this.showPlaceholder=true;return}this.getSourceValue().map((function(t){return e.wrapper.append(e.getItemHTML(t))}));return}if(this.getSource()=="categories"){var t=window.location.search.replace("?","").split("&").map((function(e){return e.split("=")})).reduce((function(e,t){var s=t[0],i=t[1];if(s=="sort"){e[s]=i}return e}),{});if(Object.entries(t).length){this.filters=t;return}}this.init()};e.prototype.init=function(){var e=this;this.initiateInfiniteScroll();this.loading();salla.product.fetch({source:this.getSource(),source_value:this.getSourceValue(),filters:this.filters,limit:this.limit}).then((function(t){if(!t.data.length){e.showPlaceholder=true;e.loading(false);return}e.handleResponse(t).forEach((function(t){return e.wrapper.append(t)}))}))};e.prototype.handleResponse=function(e){var t=this;var s;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((s=e.data)===null||s===void 0?void 0:s.map((function(e){return t.getItemHTML(e)})))||[]};Object.defineProperty(e.prototype,"host",{get:function(){return r(this)},enumerable:false,configurable:true});Object.defineProperty(e,"watchers",{get:function(){return{limit:["validateLimitMaximumValue"],filters:["parseFilters"]}},enumerable:false,configurable:true});return e}());a.style=o}}}));
|
|
5
|
+
//# sourceMappingURL=p-91b4ebaf.system.entry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["sallaProductsListCss","SallaProductsList","exports","class_1","hostRef","_this","this","salla","onReady","sourceValueIsValid","getSourceValue","isSourceWithoutValue","buildNextPageUrl","isReady","logger","warn","concat","getSource","hasCustomComponent","customElements","get","hasInfiniteScroll","includes","status","document","createElement","className","innerHTML","lang","btnLoader","querySelector","onLoaded","placeholderText","prototype","validateLimitMaximumValue","_newValue","_","limit","urlPrefix","parseFilters","newValue","parsedFilters","JSON","parse","key","value","this_1","Array","isArray","forEach","item","_i","_b","Object","entries","length","_c","wrapper","init","source","nextPage","url","api","join","e","config","sourceValue","URLSearchParams","window","location","search","loading","isLoading","style","display","getItemHTML","product","customComponent","setAttribute","stringify","toggleAttribute","classList","add","horizontalCards","initiateInfiniteScroll","host","insertAdjacentElement","infiniteScroll","initiate","path","history","scrollThreshold","on","response","appendItems","handleResponse","remove","canRender","render","showPlaceholder","h","class","ShoppingBag","Host","ref","componentDidLoad","map","append","filters","replace","split","reduce","acc","fetch","source_value","then","res","data","card","cursor","next","option","loadOnScroll","_a"],"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, Watch} from '@stencil/core';\nimport ShoppingBag from '../../assets/svg/shopping-bag.svg';\n\n@Component({\n tag: 'salla-products-list',\n styleUrl: 'salla-products-list.scss'\n})\nexport class SallaProductsList {\n constructor() {\n salla.onReady(() => {\n this.sourceValueIsValid = !!(this.getSourceValue() || this.isSourceWithoutValue());\n this.buildNextPageUrl();\n this.isReady = true;\n });\n\n if (!this.sourceValueIsValid) {\n salla.logger.warn(`source-value prop is required for source [${this.getSource()}]`);\n return;\n }\n this.hasCustomComponent = !!customElements.get('custom-salla-product-card');\n\n this.hasInfiniteScroll = !['json', 'selected', 'related', 'landing-page'].includes(this.getSource());\n // Language\n //enhance\n this.status = document.createElement('div');\n this.status.className = 's-infinite-scroll-wrapper';\n this.status.innerHTML = `<div class=\"s-infinite-scroll-status\">\n <p class=\"s-infinite-scroll-last infinite-scroll-last s-hidden\" >${salla.lang.get('common.elements.end_of_content')}</p>\n <p class=\"s-infinite-scroll-error infinite-scroll-error s-hidden\">${salla.lang.get('common.elements.failed_to_load_more')}</p>\n </div>\n <a href=\"#\" class=\"s-infinite-scroll-btn s-button-btn\">\n <span class=\"s-button-loader s-button-loader-center s-infinite-scroll-btn-loader\" style=\"display: none\"></span>\n </a>`;\n this.btnLoader = this.status.querySelector('.s-button-loader');\n salla.lang.onLoaded(() => {\n this.status.querySelector('.s-infinite-scroll-last').innerHTML = salla.lang.get('common.elements.end_of_content');\n this.status.querySelector('.s-infinite-scroll-error').innerHTML = salla.lang.get('common.elements.failed_to_load_more');\n this.placeholderText = salla.lang.get('pages.categories.no_products');\n });\n }\n\n private readonly status: HTMLDivElement;\n private btnLoader: HTMLAnchorElement;\n @Element() host: HTMLElement;\n private wrapper: any;\n private infiniteScroll: any;\n /**\n * The source of the products list\n * @type {string}\n * */\n @Prop({\n reflect: true,\n mutable: true\n }) source: 'categories' | 'latest' | 'related' | 'brands' | 'json' | 'search' | 'tags' | 'selected' | 'offers' | 'landing-page' | 'sales';\n\n /**\n * The source value, cloud be different values as following:\n * - array of ids when `source` in ['categories', 'brands', 'tags', 'selected']\n * - keyword when `source` = 'search'\n * - products payload when `source` = 'json'\n * - product_id when `source` = 'related'\n *\n * @type {string}\n * */\n @Prop({mutable: true}) sourceValue: any;\n\n /**\n * Limit for number of products in the list.\n */\n @Prop({mutable: true}) limit: number;\n\n /**\n * Filter parameters. JSON STRING or object\n */\n @Prop({mutable: true}) filters: string | object;\n\n /**\n * Horizontal cards\n */\n @Prop({reflect: true}) horizontalCards: boolean\n\n @Watch('limit')\n validateLimitMaximumValue(_newValue: number, _) {\n if (this.limit) {\n this.urlPrefix += `&per_page=${this.limit > 32 ? 32 : this.limit}}`;\n }\n }\n\n @Watch('filters')\n parseFilters(newValue: string | object, _) {\n this.parsedFilters = typeof newValue == 'string' ? JSON.parse(newValue) : newValue\n this.urlPrefix = '';\n\n for (const [key, value] of Object.entries(this.parsedFilters)) {\n if (typeof value == \"string\") {\n this.urlPrefix += `&filters[${key}]=${value}`;\n } else if (Array.isArray(value)) {\n (value as any).forEach(item => {\n this.urlPrefix += `&filters[${key}][]=${item}}`\n })\n }\n }\n // reset page products\n if (this.getSource() == 'categories') {\n this.wrapper.innerHTML = '';\n this.init()\n }\n }\n\n // State\n @State() page: number = 1;\n @State() nextPage: string;\n @State() hasInfiniteScroll: boolean;\n @State() hasCustomComponent: boolean;\n @State() sourceValueIsValid: boolean;\n @State() placeholderText: string;\n @State() isReady: boolean;\n @State() showPlaceholder: boolean;\n @State() urlPrefix: string = '';\n @State() parsedFilters: any;\n\n private isSourceWithoutValue(){\n return ['offers', 'latest', 'sales'].includes(this.getSource());\n }\n\n private buildNextPageUrl() {\n let source = this.getSource();\n if (source === 'json') {\n return;\n }\n if (this.isSourceWithoutValue()) {\n this.nextPage = salla.url.api(`products?source=${source}${this.urlPrefix}`);\n return;\n }\n\n if (['search', 'related', 'landing-page'].includes(source)) {\n this.nextPage = salla.url.api(`products?source=${source}&source_value=${this.getSourceValue()}${this.urlPrefix}`);\n return;\n }\n\n try {\n this.nextPage = salla.url.api(`products?source=${source}&source_value[]=${this.getSourceValue().join('&source_value[]=')}${this.urlPrefix}`);\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 private getSource() {\n return {\n 'brands.single': 'brands',\n 'product.index': 'categories',\n 'product.index.latest': 'latest',\n 'product.index.offers': 'offers',\n 'product.index.search': 'search',\n 'landing-page': 'landing-page',\n 'product.index.tag': 'tags',\n 'product.index.sales': 'sales',\n 'components.most_sales_products': 'sales',//temporary, delete it after two days from now\n }[this.source || salla.config.get('page.slug')] || this.source || 'latest';\n }\n\n private getSourceValue() {\n let source = this.getSource();\n\n if (!['search', 'json', 'offers', 'latest', 'sales'].includes(source)) {\n if (Array.isArray(JSON.parse(this.sourceValue)) && JSON.parse(this.sourceValue).length) {\n return JSON.parse(this.sourceValue);\n }\n\n if (typeof JSON.parse(this.sourceValue) == 'number') {\n return [JSON.parse(this.sourceValue)];\n }\n }\n\n if (this.sourceValue) {\n return this.sourceValue;\n }\n\n\n if (source === 'search') {\n return (new URLSearchParams(window.location.search)).get('q');\n }\n\n return salla.config.get('page.id');\n }\n\n\n private loading(isLoading = true) {\n this.btnLoader.style.display = isLoading ? 'inherit' : 'none';\n }\n\n private getItemHTML(product) {\n let customComponent: string | HTMLElement = this.hasCustomComponent ? 'custom-salla-product-card' : 'salla-product-card';\n customComponent = document.createElement(customComponent);\n customComponent.setAttribute('product', JSON.stringify(product));\n if (this.getSource() == 'landing-page' && !this.hasCustomComponent) {\n customComponent.toggleAttribute('hide-add-btn', true);\n customComponent.classList.add('s-product-card-fit-height');\n }\n if (this.horizontalCards && !this.hasCustomComponent) {\n customComponent.toggleAttribute('horizontal', true);\n }\n customComponent.toggleAttribute('shadow-on-hover', true);\n return customComponent;\n }\n\n private initiateInfiniteScroll() {\n if (!this.hasInfiniteScroll) {\n return;\n }\n\n this.host.insertAdjacentElement('afterend', this.status);\n this.infiniteScroll = salla.infiniteScroll.initiate(this.wrapper, this.wrapper, {\n path: () => this.nextPage,\n history: false,\n nextPage: this.nextPage,\n scrollThreshold: 100,\n }, /* infinite via api*/true);\n this.infiniteScroll.on('request', () => this.loading())\n this.infiniteScroll.on('load', response => this.infiniteScroll.appendItems(this.handleResponse(response)))\n this.infiniteScroll.on('error', () => {\n this.status.querySelector('.s-infinite-scroll-error').classList.remove('s-hidden')\n this.loading(false);\n });\n }\n\n private canRender() {\n return this.sourceValueIsValid && this.isReady;\n }\n\n render() {\n if (!this.canRender()) {\n return '';\n }\n if (this.showPlaceholder) {\n return <div class=\"s-products-list-placeholder\">\n <span innerHTML={ShoppingBag}/>\n <p>{this.placeholderText}</p>\n </div>;\n }\n return (\n <Host class=\"s-products-list\">\n <div class={{\n \"s-products-list-wrapper\": true,\n 's-products-list-horizontal-cards': this.horizontalCards,\n 's-products-list-vertical-cards': !this.horizontalCards,\n }}\n ref={wrapper => this.wrapper = wrapper}/>\n </Host>\n );\n }\n\n componentDidLoad() {\n if (!this.canRender()) {\n return;\n }\n if (this.getSource() === 'json') {\n if (!this.getSourceValue().length) {\n this.showPlaceholder = true;\n return;\n }\n this.getSourceValue().map(product => this.wrapper.append(this.getItemHTML(product)));\n return;\n }\n if (this.getSource() == 'categories') {\n // check if there is a filters in the url\n const filters = window.location.search\n .replace('?', '')\n .split('&')\n .map(item => item.split('='))\n .reduce((acc, [key, value]) => {\n if (key == 'sort') {\n acc[key] = value;\n }\n return acc;\n }, {});\n if (Object.entries(filters).length) {\n this.filters = filters;\n return;\n }\n }\n this.init();\n }\n\n private init() {\n this.initiateInfiniteScroll();\n this.loading();\n salla.product.fetch({\n source: this.getSource(),\n source_value: this.getSourceValue(),\n filters: this.filters,\n limit: this.limit\n })\n .then(res => {\n if (!res.data.length) {\n this.showPlaceholder = true;\n this.loading(false);\n return;\n }\n this.handleResponse(res).forEach(card => this.wrapper.append(card));\n })\n }\n\n private handleResponse(response): Array<HTMLElement> {\n //💡 when source is related, cursor will not be existed\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":";;;82BAAA,IAAMA,EAAuB,G,ICOhBC,EAAiBC,EAAA,iCAC5B,SAAAC,EAAAC,GAAA,IAAAC,EAAAC,K,gJAsGwB,E,iOAQK,G,6BA7G3BC,MAAMC,SAAQ,WACZH,EAAKI,sBAAwBJ,EAAKK,kBAAoBL,EAAKM,wBAC3DN,EAAKO,mBACLP,EAAKQ,QAAU,I,IAGjB,IAAKP,KAAKG,mBAAoB,CAC5BF,MAAMO,OAAOC,KAAK,6CAAAC,OAA6CV,KAAKW,YAAW,MAC/E,M,CAEFX,KAAKY,qBAAuBC,eAAeC,IAAI,6BAE/Cd,KAAKe,mBAAqB,CAAC,OAAQ,WAAY,UAAW,gBAAgBC,SAAShB,KAAKW,aAGxFX,KAAKiB,OAASC,SAASC,cAAc,OACrCnB,KAAKiB,OAAOG,UAAY,4BACxBpB,KAAKiB,OAAOI,UAAY,oHAAAX,OAC+CT,MAAMqB,KAAKR,IAAI,kCAAiC,oFAAAJ,OAC/CT,MAAMqB,KAAKR,IAAI,uCAAsC,0NAK7Hd,KAAKuB,UAAYvB,KAAKiB,OAAOO,cAAc,oBAC3CvB,MAAMqB,KAAKG,UAAS,WAClB1B,EAAKkB,OAAOO,cAAc,2BAA2BH,UAAYpB,MAAMqB,KAAKR,IAAI,kCAChFf,EAAKkB,OAAOO,cAAc,4BAA4BH,UAAYpB,MAAMqB,KAAKR,IAAI,uCACjFf,EAAK2B,gBAAkBzB,MAAMqB,KAAKR,IAAI,+B,IA6C1CjB,EAAA8B,UAAAC,0BAAA,SAA0BC,EAAmBC,GAC3C,GAAI9B,KAAK+B,MAAO,CACd/B,KAAKgC,WAAa,aAAAtB,OAAaV,KAAK+B,MAAQ,GAAK,GAAK/B,KAAK+B,MAAK,I,GAKpElC,EAAA8B,UAAAM,aAAA,SAAaC,EAA2BJ,GAAxC,IAA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AAf,IAAAxF,EAAAC,K,MAENA,KAAKsD,SAAWiC,EAAS0B,OAAS1B,EAAS0B,OAAOC,KAAOlH,KAAKsD,SAC9DtD,KAAKiE,QAAQ,OACb,GAAIjE,KAAKe,oBAAsBf,KAAKsD,SAAU,CAC5CtD,KAAKiF,eAAekC,OAAO,CAAC9B,gBAAiB,MAAO+B,aAAc,QAClEpH,KAAKiB,OAAOO,cAAc,2BAA2BmD,UAAUe,OAAO,W,CAExE,QAAO2B,EAAA9B,EAASwB,QAAI,MAAAM,SAAA,SAAAA,EAAEjB,KAAI,SAAA9B,GAAW,OAAAvE,EAAKsE,YAAYC,EAAjB,MAA8B,E,uRAjTzC,I"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import{p as e,b as a}from"./p-29c587ff.js";export{s as setNonce}from"./p-29c587ff.js";import{g as t}from"./p-1c245222.js";import"./p-ce54db8d.js";const l=()=>{const a=import.meta.url;const t={};if(a!==""){t.resourcesUrl=new URL(".",a).href}return e(t)};l().then((e=>{t();return a(JSON.parse('[["p-af862798",[[4,"salla-gifting",{"productId":[2,"product-id"],"widgetSubtitle":[1,"widget-subtitle"],"sectionTitle":[32],"sectionSubtitle":[32],"sectionBtnText":[32],"giftDetails":[32],"selectImageForYourGift":[32],"selectImageOrUpload":[32],"selectGiftMessage":[32],"giftCustomText":[32],"textId":[32],"incorrectGiftText":[32],"nextStep":[32],"senderNameLabel":[32],"receiverNameFieldLabel":[32],"receiverMobileFieldLabel":[32],"receiverEmailFieldLabel":[32],"emailPlaceholder":[32],"sendLater":[32],"selectSendDateAndTime":[32],"canNotEditOrderAfterSelectDate":[32],"sendGift":[32],"donationRequired":[32],"currentStep":[32],"showCalendar":[32],"showGiftText":[32],"currentLang":[32],"parentClass":[32],"errors":[32],"gift":[32],"selectedGiftTextOption":[32],"showTextArea":[32],"selectedImage":[32],"uploadedImage":[32],"selectedText":[32],"senderName":[32],"errorMessage":[32],"hasError":[32],"quantity":[32],"deliveryDate":[32],"timeZone":[32],"receiverName":[32],"receiverMobile":[32],"receiverCountryCode":[32],"receiverEmail":[32],"open":[64],"close":[64],"goToStep2":[64]}],[4,"salla-loyalty",{"prizePoints":[1544,"prize-points"],"customerPoints":[1538,"customer-points"],"prizeTitle":[1537,"prize-title"],"allowEmail":[4,"allow-email"],"allowMobile":[4,"allow-mobile"],"requireEmail":[4,"require-email"],"guestMessage":[1025,"guest-message"],"loyaltyProgram":[32],"buttonLoading":[32],"selectedItem":[32],"askConfirmation":[32],"is_loggedin":[32],"hasError":[32],"errorMessage":[32],"translationLoaded":[32],"open":[64],"close":[64],"resetExchange":[64],"exchangeLoyaltyPoint":[64]}],[4,"salla-product-size-guide",{"guides":[32],"productId":[32],"placeholder_title":[32],"placeholder_description":[32],"modal_title":[32],"hasError":[32],"open":[64],"close":[64]}],[4,"salla-login-modal",{"isEmailAllowed":[1028,"is-email-allowed"],"isMobileAllowed":[1028,"is-mobile-allowed"],"isEmailRequired":[1028,"is-email-required"],"supportWebAuth":[516,"support-web-auth"],"currentTabName":[32],"regType":[32],"translationLoaded":[32],"title":[32],"emailErrorMsg":[32],"firstNameErrorMsg":[32],"lastNameErrorMsg":[32],"dragAndDrop":[32],"browseFromFiles":[32],"customFields":[32],"uploadedImage":[32],"open":[64]},[[8,"verified","onVerified"]]],[0,"salla-offer-modal",{"offer":[32],"offer_name":[32],"offer_message":[32],"hasError":[32],"errorMessage":[32],"productID":[32],"offer_type":[32],"translationLoaded":[32],"addToCartLabel":[32],"open":[64],"showOffer":[64]}],[0,"salla-rating-modal",{"orderId":[2,"order-id"],"order":[32],"hasError":[32],"errorMessage":[32],"translationLoaded":[32],"open":[64],"close":[64]}],[4,"salla-scopes",{"selection":[1],"searchDisplayLimit":[2,"search-display-limit"],"translationLoaded":[32],"mode":[32],"current_scope":[32],"scopes":[32],"originalScopesList":[32],"selected_scope":[32],"isOpenedBefore":[32],"hasError":[32],"loading":[32],"close":[64],"open":[64],"handleSubmit":[64]}],[0,"salla-localization-modal",{"language":[1537],"currency":[1537],"translationLoaded":[32],"languages":[32],"currencies":[32],"hasError":[32],"errorMessage":[32],"open":[64],"close":[64],"submit":[64]}],[0,"salla-quick-order",{"quickOrderTitle":[1025,"quick-order-title"],"subTitle":[1025,"sub-title"],"payButtonTitle":[1025,"pay-button-title"],"confirmPayButtonTitle":[1025,"confirm-pay-button-title"],"agreementText":[1025,"agreement-text"],"isEmailRequired":[1028,"is-email-required"],"productId":[1025,"product-id"],"thanksMessage":[1025,"thanks-message"],"quickOrderStyle":[1025,"quick-order-style"],"user":[32],"isAvailable":[32],"oneClick":[32],"expanded":[32],"isTermsRequired":[32],"countryCode":[32],"submitSucess":[32],"placeHolderEmail":[32],"emailOptional":[32],"agreementShowText":[32],"agreementModalHead":[32],"userNameLabel":[32],"termsChecked":[32]}],[0,"salla-user-settings",{"isNotifiable":[516,"is-notifiable"],"deactivateAccount":[32],"promotionalMsgs":[32],"deactivateDesc":[32],"promotionalMsgsDesc":[32],"sorryForLeavingText":[32],"warningText":[32],"keepAccount":[32],"buttonLoading":[32]}],[0,"salla-search",{"inline":[4],"oval":[4],"height":[2],"translationLoaded":[32],"results":[32],"loading":[32],"typing":[32],"debounce":[32],"search_term":[32]},[[0,"keydown","handleKeyDown"]]],[4,"salla-social-share",{"url":[513],"urlName":[513,"url-name"],"platforms":[513],"opened":[32],"allPlatforms":[32],"platformIcons":[32],"convertedPlatforms":[32],"open":[64]}],[4,"salla-cart-summary",{"showCartLabel":[4,"show-cart-label"],"cartSummaryCount":[32],"cartSummaryTotal":[32],"cartLabel":[32],"animateToCart":[64]}],[4,"salla-infinite-scroll",{"nextPage":[1,"next-page"],"autoload":[1028],"container":[1],"item":[1],"loadMore":[32],"noMore":[32],"failedToLoad":[32]}],[0,"salla-maintenance-alert",{"title":[32],"message":[32],"buttonTitle":[32]}],[4,"salla-quantity-input",{"quantity":[32],"decrease":[64],"increase":[64],"setValue":[64]}],[4,"salla-user-menu",{"inline":[516],"avatarOnly":[516,"avatar-only"],"showHeader":[516,"show-header"],"relativeDropdown":[516,"relative-dropdown"],"accountLoading":[32],"opened":[32],"notifications":[32],"orders":[32],"pending_orders":[32],"wishlist":[32],"profile":[32],"rating":[32],"logout":[32],"hello":[32],"first_name":[32],"last_name":[32],"avatar":[32],"is_loggedIn":[32],"badges":[32],"hasBadges":[32],"OrderUpdate":[32]}],[4,"salla-product-card",{"product":[1],"horizontal":[4],"shadowOnHover":[4,"shadow-on-hover"],"hideAddBtn":[4,"hide-add-btn"],"fullImage":[4,"full-image"],"minimal":[4],"isSpecial":[4,"is-special"],"showQuantity":[4,"show-quantity"],"productData":[32],"fitImageHeight":[32],"remained":[32],"outOfStock":[32],"donationAmount":[32],"startingPrice":[32],"addToCart":[32],"placeholder":[32]}],[4,"salla-map",{"name":[1],"required":[4],"readonly":[4],"searchable":[1028],"lat":[1026],"lng":[1026],"apiKey":[1025,"api-key"],"modalTitle":[1,"modal-title"],"zoom":[1026],"theme":[1025],"modalActivityTitle":[32],"confirmButtonTitle":[32],"locateButtonTitle":[32],"locateButtonEdit":[32],"searchPlaceholder":[32],"searchInputValue":[32],"formattedAddress":[32],"geolocationError":[32],"searchInput":[32],"mapInput":[32],"mapElement":[32],"selectedLat":[32],"selectedLng":[32],"open":[64]}],[4,"salla-verify",{"display":[1],"type":[1025],"autoReload":[4,"auto-reload"],"supportWebAuth":[4,"support-web-auth"],"translationLoaded":[32],"title":[32],"resendAfter":[32],"isProfileVerify":[32],"getCode":[64],"open":[64]}],[4,"salla-color-picker",{"name":[1],"required":[4],"color":[1537],"format":[1],"showCancelButton":[4,"show-cancel-button"],"showTextField":[4,"show-text-field"],"enableAlpha":[4,"enable-alpha"],"widgetColor":[32],"setPickerOption":[64],"movePopUp":[64],"setColorValue":[64],"openPicker":[64],"closePicker":[64],"destroyPicker":[64]}],[0,"salla-rating-stars",{"name":[1],"size":[1],"value":[2],"reviews":[2]}],[4,"salla-add-product-button",{"channels":[513],"subscribedOptions":[1,"subscribed-options"],"quickBuy":[1540,"quick-buy"],"quantity":[514],"donatingAmount":[514,"donating-amount"],"notifyOptionsAvailability":[516,"notify-options-availability"],"productId":[520,"product-id"],"supportStickyBar":[516,"support-sticky-bar"],"productStatus":[513,"product-status"],"productType":[513,"product-type"],"hasOutOfStockOption":[32],"hasSubscribedOptions":[32],"selectedOptions":[32],"showQuickBuy":[32]}],[0,"salla-count-down",{"date":[1],"boxed":[4],"size":[1],"color":[1],"labeled":[4],"endText":[1,"end-text"],"digits":[1],"endOfDay":[4,"end-of-day"],"daysLabel":[32],"hoursLabel":[32],"minutesLabel":[32],"secondsLabel":[32],"endLabel":[32],"invalidDate":[32],"offerEnded":[32],"countInterval":[32],"days":[32],"hours":[32],"minutes":[32],"seconds":[32],"endCountDown":[64]}],[0,"salla-datetime-picker",{"value":[1537],"required":[4],"name":[513],"placeholder":[1],"allowInput":[4,"allow-input"],"allowInvalidPreload":[4,"allow-invalid-preload"],"altFormat":[1,"alt-format"],"altInput":[4,"alt-input"],"altInputClass":[1,"alt-input-class"],"appendTo":[16],"ariaDateFormat":[1,"aria-date-format"],"autoFillDefaultTime":[4,"auto-fill-default-time"],"clickOpens":[4,"click-opens"],"closeOnSelect":[4,"close-on-select"],"conjunction":[1],"dateFormat":[1,"date-format"],"defaultDate":[8,"default-date"],"defaultHour":[2,"default-hour"],"defaultMinute":[2,"default-minute"],"defaultSeconds":[2,"default-seconds"],"disable":[16],"disableMobile":[4,"disable-mobile"],"enable":[16],"enableSeconds":[4,"enable-seconds"],"enableTime":[4,"enable-time"],"formatDate":[16],"hourIncrement":[2,"hour-increment"],"inline":[4],"locale":[1],"maxDate":[8,"max-date"],"maxTime":[8,"max-time"],"minDate":[8,"min-date"],"minTime":[8,"min-time"],"minuteIncrement":[2,"minute-increment"],"mode":[1],"monthSelectorType":[1,"month-selector-type"],"nextArrow":[1,"next-arrow"],"noCalendar":[4,"no-calendar"],"dateParser":[16],"position":[1],"positionElement":[16],"prevArrow":[1,"prev-arrow"],"shorthandCurrentMonth":[4,"shorthand-current-month"],"static":[4],"showMonths":[2,"show-months"],"time_24hr":[4,"time_-2-4hr"],"weekNumbers":[4,"week-numbers"],"wrap":[4]}],[4,"salla-tab-content",{"name":[1],"isSelected":[32],"getChild":[64]}],[4,"salla-tab-header",{"name":[1],"activeClass":[1,"active-class"],"height":[8],"centered":[4],"isSelected":[32],"getChild":[64]}],[4,"salla-tabs",{"backgroundColor":[1,"background-color"],"vertical":[4]},[[0,"tabSelected","onSelectedTab"]]],[0,"salla-product-availability",{"channels":[1],"notifyOptionsAvailability":[4,"notify-options-availability"],"productId":[2,"product-id"],"isSubscribed":[1028,"is-subscribed"],"translationLoaded":[32],"title_":[32],"isVisitorSubscribed":[32]}],[0,"salla-quick-buy",{"type":[1025],"productId":[1025,"product-id"],"amount":[1538],"currency":[1025],"options":[16],"isRequireShipping":[1028,"is-require-shipping"],"isApplePayActive":[32],"quickBuy":[32]}],[0,"salla-file-upload",{"value":[1537],"files":[513],"height":[513],"cartItemId":[1,"cart-item-id"],"profileImage":[516,"profile-image"],"name":[1537],"payloadName":[1,"payload-name"],"accept":[1537],"fileId":[2,"file-id"],"url":[1025],"method":[1],"formData":[1,"form-data"],"required":[4],"maxFileSize":[1,"max-file-size"],"disabled":[4],"allowDrop":[4,"allow-drop"],"allowBrowse":[4,"allow-browse"],"allowPaste":[4,"allow-paste"],"allowMultiple":[4,"allow-multiple"],"allowReplace":[4,"allow-replace"],"allowRevert":[4,"allow-revert"],"allowRemove":[4,"allow-remove"],"allowProcess":[4,"allow-process"],"allowReorder":[4,"allow-reorder"],"storeAsFile":[4,"store-as-file"],"forceRevert":[4,"force-revert"],"maxFilesCount":[2,"max-files-count"],"maxParallelUploads":[2,"max-parallel-uploads"],"checkValidity":[4,"check-validity"],"itemInsertLocation":[1,"item-insert-location"],"itemInsertInterval":[2,"item-insert-interval"],"credits":[4],"dropOnPage":[4,"drop-on-page"],"dropOnElement":[4,"drop-on-element"],"dropValidation":[4,"drop-validation"],"ignoredFiles":[16],"instantUpload":[1028,"instant-upload"],"chunkUploads":[4,"chunk-uploads"],"chunkForce":[4,"chunk-force"],"chunkSize":[2,"chunk-size"],"chunkRetryDelays":[16],"labelDecimalSeparator":[1,"label-decimal-separator"],"labelThousandsSeparator":[1,"label-thousands-separator"],"labelIdle":[1025,"label-idle"],"iconRemove":[1,"icon-remove"],"iconProcess":[1,"icon-process"],"iconRetry":[1,"icon-retry"],"iconUndo":[1,"icon-undo"],"setOption":[64]}],[0,"salla-progress-bar",{"donation":[1],"target":[1026],"value":[1026],"height":[1025],"header":[1025],"stripped":[1028],"message":[1025],"unit":[1025],"color":[1025]}],[4,"salla-list-tile",{"href":[1],"target":[1]}],[4,"salla-slider",{"blockTitle":[513,"block-title"],"listenToThumbnailsOption":[516,"listen-to-thumbnails-option"],"blockSubtitle":[513,"block-subtitle"],"displayAllUrl":[513,"display-all-url"],"arrowsCentered":[516,"arrows-centered"],"verticalThumbs":[516,"vertical-thumbs"],"gridThumbs":[516,"grid-thumbs"],"vertical":[516],"autoHeight":[516,"auto-height"],"showControls":[516,"show-controls"],"controlsOuter":[516,"controls-outer"],"showThumbsControls":[4,"show-thumbs-controls"],"autoPlay":[4,"auto-play"],"slidesPerView":[1,"slides-per-view"],"pagination":[4],"centered":[4],"loop":[4],"direction":[1537],"type":[1],"sliderConfig":[520,"slider-config"],"thumbsConfig":[520,"thumbs-config"],"currentIndex":[32],"isEnd":[32],"isBeginning":[32],"swiperScript":[32],"displayAllTitle":[32],"slideTo":[64],"slideNext":[64],"slidePrev":[64],"slideToLoop":[64],"slideNextLoop":[64],"slidePrevLoop":[64],"slideReset":[64],"slideToClosest":[64],"update":[64],"updateAutoHeight":[64],"updateSlides":[64],"updateProgress":[64],"updateSlidesClasses":[64],"getSlides":[64]}],[4,"salla-placeholder",{"icon":[1],"alignment":[1],"iconSize":[1,"icon-size"],"translationLoaded":[32]}],[0,"salla-skeleton",{"type":[1],"width":[1],"height":[1]}],[0,"salla-tel-input",{"phone":[1025],"name":[1],"countryCode":[1025,"country-code"],"mobileRequired":[32],"countryCodeLabel":[32],"mobileLabel":[32],"tooShort":[32],"tooLong":[32],"invalidCountryCode":[32],"invalidNumber":[32],"errorMap":[32],"getValues":[64],"isValid":[64]}],[4,"salla-modal",{"isClosable":[1028,"is-closable"],"width":[513],"position":[513],"visible":[516],"hasSkeleton":[516,"has-skeleton"],"isLoading":[1540,"is-loading"],"subTitleFirst":[4,"sub-title-first"],"noPadding":[4,"no-padding"],"subTitle":[1,"sub-title"],"centered":[4],"iconStyle":[1,"icon-style"],"modalTitle":[32],"open":[64],"close":[64],"setTitle":[64],"loading":[64],"stopLoading":[64]},[[0,"keyup","handleKeyUp"]]],[4,"salla-button",{"shape":[513],"color":[513],"fill":[513],"size":[513],"width":[513],"loading":[516],"disabled":[516],"loaderPosition":[1,"loader-position"],"href":[1],"load":[64],"stop":[64],"setText":[64],"disable":[64],"enable":[64]}],[0,"salla-loading",{"size":[8],"width":[8],"color":[1],"bgColor":[1,"bg-color"]}]]],["p-2b88b124",[[0,"salla-products-slider",{"blockTitle":[1,"block-title"],"subTitle":[1,"sub-title"],"sliderId":[1,"slider-id"],"displayAllUrl":[1,"display-all-url"],"source":[1537],"sourceValue":[1,"source-value"],"productsData":[32],"isReady":[32],"sourceValueIsValid":[32],"hasCustomComponent":[32],"urlPrefix":[32],"apiUrl":[32],"parsedSourceValue":[32]}]]],["p-693e4852",[[0,"salla-product-options",{"productId":[2,"product-id"],"options":[1],"optionsData":[32],"outOfStockText":[32],"donationAmount":[32],"selectedOptions":[32],"canDisabled":[32],"selectedSkus":[32],"selectedOutSkus":[32],"getSelectedOptionsData":[64],"reportValidity":[64],"hasOutOfStockOption":[64],"getSelectedOptions":[64],"getOption":[64]}]]],["p-689a88be",[[0,"salla-comment-form",{"type":[1537],"showAvatar":[4,"show-avatar"],"itemId":[1544,"item-id"],"placeholder":[32],"submitText":[32],"canComment":[32]}]]],["p-1d92f3d2",[[0,"salla-installment",{"price":[1],"language":[1],"currency":[1],"tamaraIsActive":[32],"tabbyIsActive":[32],"spotiiIsActive":[32]}]]],["p-951e6830",[[0,"salla-loyalty-prize-item",{"item":[16]}]]],["p-e52586b3",[[0,"salla-products-list",{"source":[1537],"sourceValue":[1032,"source-value"],"limit":[1026],"filters":[1025],"horizontalCards":[516,"horizontal-cards"],"page":[32],"nextPage":[32],"hasInfiniteScroll":[32],"hasCustomComponent":[32],"sourceValueIsValid":[32],"placeholderText":[32],"isReady":[32],"showPlaceholder":[32],"urlPrefix":[32],"parsedFilters":[32]}]]],["p-cd9e431f",[[4,"salla-conditional-fields",null,[[0,"change","changeHandler"]]]]]]'),e)}));
|
|
4
|
+
import{p as e,b as a}from"./p-29c587ff.js";export{s as setNonce}from"./p-29c587ff.js";import{g as t}from"./p-1c245222.js";import"./p-ce54db8d.js";const l=()=>{const a=import.meta.url;const t={};if(a!==""){t.resourcesUrl=new URL(".",a).href}return e(t)};l().then((e=>{t();return a(JSON.parse('[["p-af862798",[[4,"salla-gifting",{"productId":[2,"product-id"],"widgetSubtitle":[1,"widget-subtitle"],"sectionTitle":[32],"sectionSubtitle":[32],"sectionBtnText":[32],"giftDetails":[32],"selectImageForYourGift":[32],"selectImageOrUpload":[32],"selectGiftMessage":[32],"giftCustomText":[32],"textId":[32],"incorrectGiftText":[32],"nextStep":[32],"senderNameLabel":[32],"receiverNameFieldLabel":[32],"receiverMobileFieldLabel":[32],"receiverEmailFieldLabel":[32],"emailPlaceholder":[32],"sendLater":[32],"selectSendDateAndTime":[32],"canNotEditOrderAfterSelectDate":[32],"sendGift":[32],"donationRequired":[32],"currentStep":[32],"showCalendar":[32],"showGiftText":[32],"currentLang":[32],"parentClass":[32],"errors":[32],"gift":[32],"selectedGiftTextOption":[32],"showTextArea":[32],"selectedImage":[32],"uploadedImage":[32],"selectedText":[32],"senderName":[32],"errorMessage":[32],"hasError":[32],"quantity":[32],"deliveryDate":[32],"timeZone":[32],"receiverName":[32],"receiverMobile":[32],"receiverCountryCode":[32],"receiverEmail":[32],"open":[64],"close":[64],"goToStep2":[64]}],[4,"salla-loyalty",{"prizePoints":[1544,"prize-points"],"customerPoints":[1538,"customer-points"],"prizeTitle":[1537,"prize-title"],"allowEmail":[4,"allow-email"],"allowMobile":[4,"allow-mobile"],"requireEmail":[4,"require-email"],"guestMessage":[1025,"guest-message"],"loyaltyProgram":[32],"buttonLoading":[32],"selectedItem":[32],"askConfirmation":[32],"is_loggedin":[32],"hasError":[32],"errorMessage":[32],"translationLoaded":[32],"open":[64],"close":[64],"resetExchange":[64],"exchangeLoyaltyPoint":[64]}],[4,"salla-product-size-guide",{"guides":[32],"productId":[32],"placeholder_title":[32],"placeholder_description":[32],"modal_title":[32],"hasError":[32],"open":[64],"close":[64]}],[4,"salla-login-modal",{"isEmailAllowed":[1028,"is-email-allowed"],"isMobileAllowed":[1028,"is-mobile-allowed"],"isEmailRequired":[1028,"is-email-required"],"supportWebAuth":[516,"support-web-auth"],"currentTabName":[32],"regType":[32],"translationLoaded":[32],"title":[32],"emailErrorMsg":[32],"firstNameErrorMsg":[32],"lastNameErrorMsg":[32],"dragAndDrop":[32],"browseFromFiles":[32],"customFields":[32],"uploadedImage":[32],"open":[64]},[[8,"verified","onVerified"]]],[0,"salla-offer-modal",{"offer":[32],"offer_name":[32],"offer_message":[32],"hasError":[32],"errorMessage":[32],"productID":[32],"offer_type":[32],"translationLoaded":[32],"addToCartLabel":[32],"open":[64],"showOffer":[64]}],[0,"salla-rating-modal",{"orderId":[2,"order-id"],"order":[32],"hasError":[32],"errorMessage":[32],"translationLoaded":[32],"open":[64],"close":[64]}],[4,"salla-scopes",{"selection":[1],"searchDisplayLimit":[2,"search-display-limit"],"translationLoaded":[32],"mode":[32],"current_scope":[32],"scopes":[32],"originalScopesList":[32],"selected_scope":[32],"isOpenedBefore":[32],"hasError":[32],"loading":[32],"close":[64],"open":[64],"handleSubmit":[64]}],[0,"salla-localization-modal",{"language":[1537],"currency":[1537],"translationLoaded":[32],"languages":[32],"currencies":[32],"hasError":[32],"errorMessage":[32],"open":[64],"close":[64],"submit":[64]}],[0,"salla-quick-order",{"quickOrderTitle":[1025,"quick-order-title"],"subTitle":[1025,"sub-title"],"payButtonTitle":[1025,"pay-button-title"],"confirmPayButtonTitle":[1025,"confirm-pay-button-title"],"agreementText":[1025,"agreement-text"],"isEmailRequired":[1028,"is-email-required"],"productId":[1025,"product-id"],"thanksMessage":[1025,"thanks-message"],"quickOrderStyle":[1025,"quick-order-style"],"user":[32],"isAvailable":[32],"oneClick":[32],"expanded":[32],"isTermsRequired":[32],"countryCode":[32],"submitSucess":[32],"placeHolderEmail":[32],"emailOptional":[32],"agreementShowText":[32],"agreementModalHead":[32],"userNameLabel":[32],"termsChecked":[32]}],[0,"salla-user-settings",{"isNotifiable":[516,"is-notifiable"],"deactivateAccount":[32],"promotionalMsgs":[32],"deactivateDesc":[32],"promotionalMsgsDesc":[32],"sorryForLeavingText":[32],"warningText":[32],"keepAccount":[32],"buttonLoading":[32]}],[0,"salla-search",{"inline":[4],"oval":[4],"height":[2],"translationLoaded":[32],"results":[32],"loading":[32],"typing":[32],"debounce":[32],"search_term":[32]},[[0,"keydown","handleKeyDown"]]],[4,"salla-social-share",{"url":[513],"urlName":[513,"url-name"],"platforms":[513],"opened":[32],"allPlatforms":[32],"platformIcons":[32],"convertedPlatforms":[32],"open":[64]}],[4,"salla-cart-summary",{"showCartLabel":[4,"show-cart-label"],"cartSummaryCount":[32],"cartSummaryTotal":[32],"cartLabel":[32],"animateToCart":[64]}],[4,"salla-infinite-scroll",{"nextPage":[1,"next-page"],"autoload":[1028],"container":[1],"item":[1],"loadMore":[32],"noMore":[32],"failedToLoad":[32]}],[0,"salla-maintenance-alert",{"title":[32],"message":[32],"buttonTitle":[32]}],[4,"salla-quantity-input",{"quantity":[32],"decrease":[64],"increase":[64],"setValue":[64]}],[4,"salla-user-menu",{"inline":[516],"avatarOnly":[516,"avatar-only"],"showHeader":[516,"show-header"],"relativeDropdown":[516,"relative-dropdown"],"accountLoading":[32],"opened":[32],"notifications":[32],"orders":[32],"pending_orders":[32],"wishlist":[32],"profile":[32],"rating":[32],"logout":[32],"hello":[32],"first_name":[32],"last_name":[32],"avatar":[32],"is_loggedIn":[32],"badges":[32],"hasBadges":[32],"OrderUpdate":[32]}],[4,"salla-product-card",{"product":[1],"horizontal":[4],"shadowOnHover":[4,"shadow-on-hover"],"hideAddBtn":[4,"hide-add-btn"],"fullImage":[4,"full-image"],"minimal":[4],"isSpecial":[4,"is-special"],"showQuantity":[4,"show-quantity"],"productData":[32],"fitImageHeight":[32],"remained":[32],"outOfStock":[32],"donationAmount":[32],"startingPrice":[32],"addToCart":[32],"placeholder":[32]}],[4,"salla-map",{"name":[1],"required":[4],"readonly":[4],"searchable":[1028],"lat":[1026],"lng":[1026],"apiKey":[1025,"api-key"],"modalTitle":[1,"modal-title"],"zoom":[1026],"theme":[1025],"modalActivityTitle":[32],"confirmButtonTitle":[32],"locateButtonTitle":[32],"locateButtonEdit":[32],"searchPlaceholder":[32],"searchInputValue":[32],"formattedAddress":[32],"geolocationError":[32],"searchInput":[32],"mapInput":[32],"mapElement":[32],"selectedLat":[32],"selectedLng":[32],"open":[64]}],[4,"salla-verify",{"display":[1],"type":[1025],"autoReload":[4,"auto-reload"],"supportWebAuth":[4,"support-web-auth"],"translationLoaded":[32],"title":[32],"resendAfter":[32],"isProfileVerify":[32],"getCode":[64],"open":[64]}],[4,"salla-color-picker",{"name":[1],"required":[4],"color":[1537],"format":[1],"showCancelButton":[4,"show-cancel-button"],"showTextField":[4,"show-text-field"],"enableAlpha":[4,"enable-alpha"],"widgetColor":[32],"setPickerOption":[64],"movePopUp":[64],"setColorValue":[64],"openPicker":[64],"closePicker":[64],"destroyPicker":[64]}],[0,"salla-rating-stars",{"name":[1],"size":[1],"value":[2],"reviews":[2]}],[4,"salla-add-product-button",{"channels":[513],"subscribedOptions":[1,"subscribed-options"],"quickBuy":[1540,"quick-buy"],"quantity":[514],"donatingAmount":[514,"donating-amount"],"notifyOptionsAvailability":[516,"notify-options-availability"],"productId":[520,"product-id"],"supportStickyBar":[516,"support-sticky-bar"],"productStatus":[513,"product-status"],"productType":[513,"product-type"],"hasOutOfStockOption":[32],"hasSubscribedOptions":[32],"selectedOptions":[32],"showQuickBuy":[32]}],[0,"salla-count-down",{"date":[1],"boxed":[4],"size":[1],"color":[1],"labeled":[4],"endText":[1,"end-text"],"digits":[1],"endOfDay":[4,"end-of-day"],"daysLabel":[32],"hoursLabel":[32],"minutesLabel":[32],"secondsLabel":[32],"endLabel":[32],"invalidDate":[32],"offerEnded":[32],"countInterval":[32],"days":[32],"hours":[32],"minutes":[32],"seconds":[32],"endCountDown":[64]}],[0,"salla-datetime-picker",{"value":[1537],"required":[4],"name":[513],"placeholder":[1],"allowInput":[4,"allow-input"],"allowInvalidPreload":[4,"allow-invalid-preload"],"altFormat":[1,"alt-format"],"altInput":[4,"alt-input"],"altInputClass":[1,"alt-input-class"],"appendTo":[16],"ariaDateFormat":[1,"aria-date-format"],"autoFillDefaultTime":[4,"auto-fill-default-time"],"clickOpens":[4,"click-opens"],"closeOnSelect":[4,"close-on-select"],"conjunction":[1],"dateFormat":[1,"date-format"],"defaultDate":[8,"default-date"],"defaultHour":[2,"default-hour"],"defaultMinute":[2,"default-minute"],"defaultSeconds":[2,"default-seconds"],"disable":[16],"disableMobile":[4,"disable-mobile"],"enable":[16],"enableSeconds":[4,"enable-seconds"],"enableTime":[4,"enable-time"],"formatDate":[16],"hourIncrement":[2,"hour-increment"],"inline":[4],"locale":[1],"maxDate":[8,"max-date"],"maxTime":[8,"max-time"],"minDate":[8,"min-date"],"minTime":[8,"min-time"],"minuteIncrement":[2,"minute-increment"],"mode":[1],"monthSelectorType":[1,"month-selector-type"],"nextArrow":[1,"next-arrow"],"noCalendar":[4,"no-calendar"],"dateParser":[16],"position":[1],"positionElement":[16],"prevArrow":[1,"prev-arrow"],"shorthandCurrentMonth":[4,"shorthand-current-month"],"static":[4],"showMonths":[2,"show-months"],"time_24hr":[4,"time_-2-4hr"],"weekNumbers":[4,"week-numbers"],"wrap":[4]}],[4,"salla-tab-content",{"name":[1],"isSelected":[32],"getChild":[64]}],[4,"salla-tab-header",{"name":[1],"activeClass":[1,"active-class"],"height":[8],"centered":[4],"isSelected":[32],"getChild":[64]}],[4,"salla-tabs",{"backgroundColor":[1,"background-color"],"vertical":[4]},[[0,"tabSelected","onSelectedTab"]]],[0,"salla-product-availability",{"channels":[1],"notifyOptionsAvailability":[4,"notify-options-availability"],"productId":[2,"product-id"],"isSubscribed":[1028,"is-subscribed"],"translationLoaded":[32],"title_":[32],"isVisitorSubscribed":[32]}],[0,"salla-quick-buy",{"type":[1025],"productId":[1025,"product-id"],"amount":[1538],"currency":[1025],"options":[16],"isRequireShipping":[1028,"is-require-shipping"],"isApplePayActive":[32],"quickBuy":[32]}],[0,"salla-file-upload",{"value":[1537],"files":[513],"height":[513],"cartItemId":[1,"cart-item-id"],"profileImage":[516,"profile-image"],"name":[1537],"payloadName":[1,"payload-name"],"accept":[1537],"fileId":[2,"file-id"],"url":[1025],"method":[1],"formData":[1,"form-data"],"required":[4],"maxFileSize":[1,"max-file-size"],"disabled":[4],"allowDrop":[4,"allow-drop"],"allowBrowse":[4,"allow-browse"],"allowPaste":[4,"allow-paste"],"allowMultiple":[4,"allow-multiple"],"allowReplace":[4,"allow-replace"],"allowRevert":[4,"allow-revert"],"allowRemove":[4,"allow-remove"],"allowProcess":[4,"allow-process"],"allowReorder":[4,"allow-reorder"],"storeAsFile":[4,"store-as-file"],"forceRevert":[4,"force-revert"],"maxFilesCount":[2,"max-files-count"],"maxParallelUploads":[2,"max-parallel-uploads"],"checkValidity":[4,"check-validity"],"itemInsertLocation":[1,"item-insert-location"],"itemInsertInterval":[2,"item-insert-interval"],"credits":[4],"dropOnPage":[4,"drop-on-page"],"dropOnElement":[4,"drop-on-element"],"dropValidation":[4,"drop-validation"],"ignoredFiles":[16],"instantUpload":[1028,"instant-upload"],"chunkUploads":[4,"chunk-uploads"],"chunkForce":[4,"chunk-force"],"chunkSize":[2,"chunk-size"],"chunkRetryDelays":[16],"labelDecimalSeparator":[1,"label-decimal-separator"],"labelThousandsSeparator":[1,"label-thousands-separator"],"labelIdle":[1025,"label-idle"],"iconRemove":[1,"icon-remove"],"iconProcess":[1,"icon-process"],"iconRetry":[1,"icon-retry"],"iconUndo":[1,"icon-undo"],"setOption":[64]}],[0,"salla-progress-bar",{"donation":[1],"target":[1026],"value":[1026],"height":[1025],"header":[1025],"stripped":[1028],"message":[1025],"unit":[1025],"color":[1025]}],[4,"salla-list-tile",{"href":[1],"target":[1]}],[4,"salla-slider",{"blockTitle":[513,"block-title"],"listenToThumbnailsOption":[516,"listen-to-thumbnails-option"],"blockSubtitle":[513,"block-subtitle"],"displayAllUrl":[513,"display-all-url"],"arrowsCentered":[516,"arrows-centered"],"verticalThumbs":[516,"vertical-thumbs"],"gridThumbs":[516,"grid-thumbs"],"vertical":[516],"autoHeight":[516,"auto-height"],"showControls":[516,"show-controls"],"controlsOuter":[516,"controls-outer"],"showThumbsControls":[4,"show-thumbs-controls"],"autoPlay":[4,"auto-play"],"slidesPerView":[1,"slides-per-view"],"pagination":[4],"centered":[4],"loop":[4],"direction":[1537],"type":[1],"sliderConfig":[520,"slider-config"],"thumbsConfig":[520,"thumbs-config"],"currentIndex":[32],"isEnd":[32],"isBeginning":[32],"swiperScript":[32],"displayAllTitle":[32],"slideTo":[64],"slideNext":[64],"slidePrev":[64],"slideToLoop":[64],"slideNextLoop":[64],"slidePrevLoop":[64],"slideReset":[64],"slideToClosest":[64],"update":[64],"updateAutoHeight":[64],"updateSlides":[64],"updateProgress":[64],"updateSlidesClasses":[64],"getSlides":[64]}],[4,"salla-placeholder",{"icon":[1],"alignment":[1],"iconSize":[1,"icon-size"],"translationLoaded":[32]}],[0,"salla-skeleton",{"type":[1],"width":[1],"height":[1]}],[0,"salla-tel-input",{"phone":[1025],"name":[1],"countryCode":[1025,"country-code"],"mobileRequired":[32],"countryCodeLabel":[32],"mobileLabel":[32],"tooShort":[32],"tooLong":[32],"invalidCountryCode":[32],"invalidNumber":[32],"errorMap":[32],"getValues":[64],"isValid":[64]}],[4,"salla-modal",{"isClosable":[1028,"is-closable"],"width":[513],"position":[513],"visible":[516],"hasSkeleton":[516,"has-skeleton"],"isLoading":[1540,"is-loading"],"subTitleFirst":[4,"sub-title-first"],"noPadding":[4,"no-padding"],"subTitle":[1,"sub-title"],"centered":[4],"iconStyle":[1,"icon-style"],"modalTitle":[32],"open":[64],"close":[64],"setTitle":[64],"loading":[64],"stopLoading":[64]},[[0,"keyup","handleKeyUp"]]],[4,"salla-button",{"shape":[513],"color":[513],"fill":[513],"size":[513],"width":[513],"loading":[516],"disabled":[516],"loaderPosition":[1,"loader-position"],"href":[1],"load":[64],"stop":[64],"setText":[64],"disable":[64],"enable":[64]}],[0,"salla-loading",{"size":[8],"width":[8],"color":[1],"bgColor":[1,"bg-color"]}]]],["p-2b88b124",[[0,"salla-products-slider",{"blockTitle":[1,"block-title"],"subTitle":[1,"sub-title"],"sliderId":[1,"slider-id"],"displayAllUrl":[1,"display-all-url"],"source":[1537],"sourceValue":[1,"source-value"],"productsData":[32],"isReady":[32],"sourceValueIsValid":[32],"hasCustomComponent":[32],"urlPrefix":[32],"apiUrl":[32],"parsedSourceValue":[32]}]]],["p-693e4852",[[0,"salla-product-options",{"productId":[2,"product-id"],"options":[1],"optionsData":[32],"outOfStockText":[32],"donationAmount":[32],"selectedOptions":[32],"canDisabled":[32],"selectedSkus":[32],"selectedOutSkus":[32],"getSelectedOptionsData":[64],"reportValidity":[64],"hasOutOfStockOption":[64],"getSelectedOptions":[64],"getOption":[64]}]]],["p-689a88be",[[0,"salla-comment-form",{"type":[1537],"showAvatar":[4,"show-avatar"],"itemId":[1544,"item-id"],"placeholder":[32],"submitText":[32],"canComment":[32]}]]],["p-1d92f3d2",[[0,"salla-installment",{"price":[1],"language":[1],"currency":[1],"tamaraIsActive":[32],"tabbyIsActive":[32],"spotiiIsActive":[32]}]]],["p-951e6830",[[0,"salla-loyalty-prize-item",{"item":[16]}]]],["p-3f6bca30",[[0,"salla-products-list",{"source":[1537],"sourceValue":[1032,"source-value"],"limit":[1026],"filters":[1025],"horizontalCards":[516,"horizontal-cards"],"page":[32],"nextPage":[32],"hasInfiniteScroll":[32],"hasCustomComponent":[32],"sourceValueIsValid":[32],"placeholderText":[32],"isReady":[32],"showPlaceholder":[32],"urlPrefix":[32],"parsedFilters":[32]}]]],["p-cd9e431f",[[4,"salla-conditional-fields",null,[[0,"change","changeHandler"]]]]]]'),e)}));
|
|
5
5
|
//# sourceMappingURL=twilight.esm.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salla.sa/twilight-components",
|
|
3
|
-
"version": "2.11.
|
|
3
|
+
"version": "2.11.102",
|
|
4
4
|
"license": "GPL-3.0",
|
|
5
5
|
"author": "Salla Team <support@salla.dev> (https://salla.dev)",
|
|
6
6
|
"bugs": {
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
},
|
|
79
79
|
"dependencies": {
|
|
80
80
|
"@salla.sa/applepay": "^2.11.93",
|
|
81
|
-
"@salla.sa/twilight": "^2.11.
|
|
81
|
+
"@salla.sa/twilight": "^2.11.102",
|
|
82
82
|
"@salla.sa/twilight-tailwind-theme": "^2.11.97",
|
|
83
83
|
"@types/node": "^18.15.3",
|
|
84
84
|
"animejs": "^3.2.1",
|
|
@@ -96,5 +96,5 @@
|
|
|
96
96
|
"vanilla-lazyload": "^17.8.3",
|
|
97
97
|
"vanilla-picker": "^2.12.1"
|
|
98
98
|
},
|
|
99
|
-
"gitHead": "
|
|
99
|
+
"gitHead": "4565eeb2a1f6b279c6857668b403e4a3d6a66482"
|
|
100
100
|
}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Crafted with ❤ by Salla
|
|
3
|
-
*/
|
|
4
|
-
System.register(["./p-99570099.system.js"],(function(e){"use strict";var t,s,i,r;return{setters:[function(e){t=e.r;s=e.h;i=e.H;r=e.g}],execute:function(){var n='\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 o="";var a=e("salla_products_list",function(){function e(e){var s=this;t(this,e);this.source=undefined;this.sourceValue=undefined;this.limit=undefined;this.filters=undefined;this.horizontalCards=undefined;this.page=1;this.nextPage=undefined;this.hasInfiniteScroll=undefined;this.hasCustomComponent=undefined;this.sourceValueIsValid=undefined;this.placeholderText=undefined;this.isReady=undefined;this.showPlaceholder=undefined;this.urlPrefix="";this.parsedFilters=undefined;salla.onReady((function(){s.sourceValueIsValid=!!(s.getSourceValue()||s.isSourceWithoutValue());s.buildNextPageUrl();s.isReady=true}));if(!this.sourceValueIsValid){salla.logger.warn("source-value prop is required for source [".concat(this.getSource(),"]"));return}this.hasCustomComponent=!!customElements.get("custom-salla-product-card");this.hasInfiniteScroll=!["json","selected","related","landing-page"].includes(this.getSource());this.status=document.createElement("div");this.status.className="s-infinite-scroll-wrapper";this.status.innerHTML='<div class="s-infinite-scroll-status">\n <p class="s-infinite-scroll-last infinite-scroll-last s-hidden" >'.concat(salla.lang.get("common.elements.end_of_content"),'</p>\n <p class="s-infinite-scroll-error infinite-scroll-error s-hidden">').concat(salla.lang.get("common.elements.failed_to_load_more"),'</p>\n </div>\n <a href="#" class="s-infinite-scroll-btn s-button-btn">\n <span class="s-button-loader s-button-loader-center s-infinite-scroll-btn-loader" style="display: none"></span>\n </a>');this.btnLoader=this.status.querySelector(".s-button-loader");salla.lang.onLoaded((function(){s.status.querySelector(".s-infinite-scroll-last").innerHTML=salla.lang.get("common.elements.end_of_content");s.status.querySelector(".s-infinite-scroll-error").innerHTML=salla.lang.get("common.elements.failed_to_load_more");s.placeholderText=salla.lang.get("pages.categories.no_products")}))}e.prototype.validateLimitMaximumValue=function(e,t){if(this.limit){this.urlPrefix+="&per_page=".concat(this.limit>32?32:this.limit,"}")}};e.prototype.parseFilters=function(e,t){var s=this;this.parsedFilters=typeof e=="string"?JSON.parse(e):e;this.urlPrefix="";var i=function(e,t){if(typeof t=="string"){r.urlPrefix+="&filters[".concat(e,"]=").concat(t)}else if(Array.isArray(t)){t.forEach((function(t){s.urlPrefix+="&filters[".concat(e,"][]=").concat(t,"}")}))}};var r=this;for(var n=0,o=Object.entries(this.parsedFilters);n<o.length;n++){var a=o[n],l=a[0],c=a[1];i(l,c)}if(this.getSource()=="categories"){this.wrapper.innerHTML="";this.init()}};e.prototype.isSourceWithoutValue=function(){return["offers","latest","sales"].includes(this.getSource())};e.prototype.buildNextPageUrl=function(){if(this.getSource()==="json"){return}if(this.isSourceWithoutValue()){this.nextPage=salla.url.api("products?source=".concat(this.getSource()).concat(this.urlPrefix));return}if(["search","related","landing-page"].includes(this.getSource())){this.nextPage=salla.url.api("products?source=".concat(this.getSource(),"&source_value=").concat(this.getSourceValue()).concat(this.urlPrefix));return}try{this.nextPage=salla.url.api("products?source=".concat(this.getSource(),"&source_value[]=").concat(this.getSourceValue().join("&source_value[]=")).concat(this.urlPrefix))}catch(e){salla.logger.warn('source-value prop should be array of ids ex source-value="[1,2,3]" for the source ['.concat(this.getSource(),"]"));this.sourceValueIsValid=false}};e.prototype.getSource=function(){return{"brands.single":"brands","product.index":"categories","product.index.latest":"latest","product.index.offers":"offers","product.index.search":"search","landing-page":"landing-page","product.index.tag":"tags","product.index.sales":"sales"}[this.source||salla.config.get("page.slug")]||this.source||"latest"};e.prototype.getSourceValue=function(){var e=this.getSource();if(!["search","json","offers","latest","sales"].includes(e)){if(Array.isArray(JSON.parse(this.sourceValue))&&JSON.parse(this.sourceValue).length){return JSON.parse(this.sourceValue)}if(typeof JSON.parse(this.sourceValue)=="number"){return[JSON.parse(this.sourceValue)]}}if(this.sourceValue){return this.sourceValue}if(e==="search"){return new URLSearchParams(window.location.search).get("q")}return salla.config.get("page.id")};e.prototype.loading=function(e){if(e===void 0){e=true}this.btnLoader.style.display=e?"inherit":"none"};e.prototype.getItemHTML=function(e){var t=this.hasCustomComponent?"custom-salla-product-card":"salla-product-card";t=document.createElement(t);t.setAttribute("product",JSON.stringify(e));if(this.getSource()=="landing-page"&&!this.hasCustomComponent){t.toggleAttribute("hide-add-btn",true);t.classList.add("s-product-card-fit-height")}if(this.horizontalCards&&!this.hasCustomComponent){t.toggleAttribute("horizontal",true)}t.toggleAttribute("shadow-on-hover",true);return t};e.prototype.initiateInfiniteScroll=function(){var e=this;if(!this.hasInfiniteScroll){return}this.host.insertAdjacentElement("afterend",this.status);this.infiniteScroll=salla.infiniteScroll.initiate(this.wrapper,this.wrapper,{path:function(){return e.nextPage},history:false,nextPage:this.nextPage,scrollThreshold:100},true);this.infiniteScroll.on("request",(function(){return e.loading()}));this.infiniteScroll.on("load",(function(t){return e.infiniteScroll.appendItems(e.handleResponse(t))}));this.infiniteScroll.on("error",(function(){e.status.querySelector(".s-infinite-scroll-error").classList.remove("s-hidden");e.loading(false)}))};e.prototype.canRender=function(){return this.sourceValueIsValid&&this.isReady};e.prototype.render=function(){var e=this;if(!this.canRender()){return""}if(this.showPlaceholder){return s("div",{class:"s-products-list-placeholder"},s("span",{innerHTML:n}),s("p",null,this.placeholderText))}return s(i,{class:"s-products-list"},s("div",{class:{"s-products-list-wrapper":true,"s-products-list-horizontal-cards":this.horizontalCards,"s-products-list-vertical-cards":!this.horizontalCards},ref:function(t){return e.wrapper=t}}))};e.prototype.componentDidLoad=function(){var e=this;if(!this.canRender()){return}if(this.getSource()==="json"){if(!this.getSourceValue().length){this.showPlaceholder=true;return}this.getSourceValue().map((function(t){return e.wrapper.append(e.getItemHTML(t))}));return}if(this.getSource()=="categories"){var t=window.location.search.replace("?","").split("&").map((function(e){return e.split("=")})).reduce((function(e,t){var s=t[0],i=t[1];if(s=="sort"){e[s]=i}return e}),{});if(Object.entries(t).length){this.filters=t;return}}this.init()};e.prototype.init=function(){var e=this;this.initiateInfiniteScroll();this.loading();salla.product.fetch({source:this.getSource(),source_value:this.getSourceValue(),filters:this.filters,limit:this.limit}).then((function(t){if(!t.data.length){e.showPlaceholder=true;e.loading(false);return}e.handleResponse(t).forEach((function(t){return e.wrapper.append(t)}))}))};e.prototype.handleResponse=function(e){var t=this;var s;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((s=e.data)===null||s===void 0?void 0:s.map((function(e){return t.getItemHTML(e)})))||[]};Object.defineProperty(e.prototype,"host",{get:function(){return r(this)},enumerable:false,configurable:true});Object.defineProperty(e,"watchers",{get:function(){return{limit:["validateLimitMaximumValue"],filters:["parseFilters"]}},enumerable:false,configurable:true});return e}());a.style=o}}}));
|
|
5
|
-
//# sourceMappingURL=p-2c4e8bf8.system.entry.js.map
|