@salla.sa/twilight-components 2.11.126 → 2.11.128
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/{Helper-63d6ab45.js → Helper-f14223e6.js} +48 -1
- package/dist/cjs/Helper-f14223e6.js.map +1 -0
- package/dist/cjs/app-globals-8c76baa2.js.map +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/salla-add-product-button_40.cjs.entry.js +2 -2
- package/dist/cjs/salla-add-product-button_40.cjs.entry.js.map +1 -1
- package/dist/cjs/salla-filters-widget.cjs.entry.js +1 -1
- package/dist/cjs/salla-products-list.cjs.entry.js +27 -47
- package/dist/cjs/salla-products-list.cjs.entry.js.map +1 -1
- package/dist/cjs/salla-products-slider.cjs.entry.js +9 -35
- package/dist/cjs/salla-products-slider.cjs.entry.js.map +1 -1
- package/dist/cjs/twilight.cjs.js +1 -1
- package/dist/collection/Helpers/Helper.js +47 -0
- package/dist/collection/Helpers/Helper.js.map +1 -1
- package/dist/collection/components/salla-products-list/salla-products-list.js +27 -47
- package/dist/collection/components/salla-products-list/salla-products-list.js.map +1 -1
- package/dist/collection/components/salla-products-slider/salla-products-slider.js +26 -52
- package/dist/collection/components/salla-products-slider/salla-products-slider.js.map +1 -1
- package/dist/collection/components/salla-quantity-input/salla-quantity-input.js +1 -1
- package/dist/collection/components/salla-quantity-input/salla-quantity-input.js.map +1 -1
- package/dist/components/Helper.js +47 -0
- package/dist/components/Helper.js.map +1 -1
- package/dist/components/index.js.map +1 -1
- package/dist/components/salla-products-list.js +27 -47
- package/dist/components/salla-products-list.js.map +1 -1
- package/dist/components/salla-products-slider.js +10 -36
- package/dist/components/salla-products-slider.js.map +1 -1
- package/dist/components/salla-quantity-input.js +1 -1
- package/dist/components/salla-quantity-input.js.map +1 -1
- package/dist/esm/{Helper-30bbdc37.js → Helper-a7971963.js} +48 -1
- package/dist/esm/Helper-a7971963.js.map +1 -0
- package/dist/esm/app-globals-8e3be062.js.map +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/salla-add-product-button_40.entry.js +2 -2
- package/dist/esm/salla-add-product-button_40.entry.js.map +1 -1
- package/dist/esm/salla-filters-widget.entry.js +1 -1
- package/dist/esm/salla-products-list.entry.js +27 -47
- package/dist/esm/salla-products-list.entry.js.map +1 -1
- package/dist/esm/salla-products-slider.entry.js +9 -35
- package/dist/esm/salla-products-slider.entry.js.map +1 -1
- package/dist/esm/twilight.js +1 -1
- package/dist/esm-es5/Helper-a7971963.js +5 -0
- package/dist/esm-es5/Helper-a7971963.js.map +1 -0
- package/dist/esm-es5/app-globals-8e3be062.js.map +1 -1
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/salla-add-product-button_40.entry.js +1 -1
- package/dist/esm-es5/salla-add-product-button_40.entry.js.map +1 -1
- package/dist/esm-es5/salla-filters-widget.entry.js +1 -1
- package/dist/esm-es5/salla-products-list.entry.js +2 -2
- package/dist/esm-es5/salla-products-list.entry.js.map +1 -1
- package/dist/esm-es5/salla-products-slider.entry.js +1 -1
- package/dist/esm-es5/salla-products-slider.entry.js.map +1 -1
- package/dist/esm-es5/twilight.js +1 -1
- package/dist/twilight/p-0254e9be.system.js +1 -1
- package/dist/twilight/p-059b0be0.system.js.map +1 -1
- package/dist/twilight/{p-3544bca0.entry.js → p-05e73fab.entry.js} +2 -2
- package/dist/twilight/{p-3544bca0.entry.js.map → p-05e73fab.entry.js.map} +1 -1
- package/dist/twilight/p-2042f370.system.js +5 -0
- package/dist/twilight/p-2042f370.system.js.map +1 -0
- package/dist/twilight/p-24d6867a.entry.js +5 -0
- package/dist/twilight/p-24d6867a.entry.js.map +1 -0
- package/dist/twilight/p-3278e007.js.map +1 -1
- package/dist/twilight/p-5ffffea6.js +5 -0
- package/dist/twilight/p-5ffffea6.js.map +1 -0
- package/dist/twilight/p-7857f10e.system.entry.js +5 -0
- package/dist/twilight/p-7857f10e.system.entry.js.map +1 -0
- package/dist/twilight/{p-710f64c1.entry.js → p-84baa754.entry.js} +2 -2
- package/dist/twilight/p-908e0bc9.system.entry.js +5 -0
- package/dist/twilight/p-908e0bc9.system.entry.js.map +1 -0
- package/dist/twilight/{p-3ae8f976.system.entry.js → p-941f36a6.system.entry.js} +2 -2
- package/dist/twilight/{p-3ae8f976.system.entry.js.map → p-941f36a6.system.entry.js.map} +1 -1
- package/dist/twilight/{p-e4f8147f.system.entry.js → p-d38d47c0.system.entry.js} +2 -2
- package/dist/twilight/p-ef0c75da.entry.js +5 -0
- package/dist/twilight/p-ef0c75da.entry.js.map +1 -0
- package/dist/twilight/twilight.esm.js +1 -1
- package/dist/types/Helpers/Helper.d.ts +2 -0
- package/dist/types/components/salla-products-list/salla-products-list.d.ts +4 -2
- package/dist/types/components/salla-products-slider/salla-products-slider.d.ts +6 -6
- package/package.json +5 -5
- package/dist/cjs/Helper-63d6ab45.js.map +0 -1
- package/dist/esm/Helper-30bbdc37.js.map +0 -1
- package/dist/esm-es5/Helper-30bbdc37.js +0 -5
- package/dist/esm-es5/Helper-30bbdc37.js.map +0 -1
- package/dist/twilight/p-77944169.system.js +0 -5
- package/dist/twilight/p-77944169.system.js.map +0 -1
- package/dist/twilight/p-82053aa3.system.entry.js +0 -5
- package/dist/twilight/p-82053aa3.system.entry.js.map +0 -1
- package/dist/twilight/p-be3279c0.entry.js +0 -5
- package/dist/twilight/p-be3279c0.entry.js.map +0 -1
- package/dist/twilight/p-c3539119.entry.js +0 -5
- package/dist/twilight/p-c3539119.entry.js.map +0 -1
- package/dist/twilight/p-cf703bcf.system.entry.js +0 -5
- package/dist/twilight/p-cf703bcf.system.entry.js.map +0 -1
- package/dist/twilight/p-dad8bacc.js +0 -5
- package/dist/twilight/p-dad8bacc.js.map +0 -1
- /package/dist/twilight/{p-710f64c1.entry.js.map → p-84baa754.entry.js.map} +0 -0
- /package/dist/twilight/{p-e4f8147f.system.entry.js.map → p-d38d47c0.system.entry.js.map} +0 -0
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
7
7
|
|
|
8
8
|
const index = require('./index-e85bd084.js');
|
|
9
|
-
const Helper = require('./Helper-
|
|
9
|
+
const Helper = require('./Helper-f14223e6.js');
|
|
10
10
|
const interfaces = require('./interfaces-56bf4b49.js');
|
|
11
11
|
|
|
12
12
|
const sallaFiltersWidgetCss = ":host{display:block}";
|
|
@@ -7,6 +7,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
7
7
|
|
|
8
8
|
const index = require('./index-e85bd084.js');
|
|
9
9
|
const anime_es = require('./anime.es-9dd45a69.js');
|
|
10
|
+
const Helper = require('./Helper-f14223e6.js');
|
|
10
11
|
|
|
11
12
|
const ShoppingBag = `<!-- Generated by IcoMoon.io -->
|
|
12
13
|
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">
|
|
@@ -155,58 +156,37 @@ const SallaProductsList = class {
|
|
|
155
156
|
this.sourceValueIsValid = false;
|
|
156
157
|
}
|
|
157
158
|
}
|
|
158
|
-
getSource() {
|
|
159
|
-
return {
|
|
160
|
-
'brands.single': 'brands',
|
|
161
|
-
'product.index': 'categories',
|
|
162
|
-
'product.index.latest': 'latest',
|
|
163
|
-
'product.index.offers': 'offers',
|
|
164
|
-
'product.index.search': 'search',
|
|
165
|
-
'landing-page': 'landing-page',
|
|
166
|
-
'product.index.tag': 'tags',
|
|
167
|
-
'product.index.sales': 'sales',
|
|
168
|
-
'components.most_sales_products': 'sales', //temporary, delete it after two days from now
|
|
169
|
-
}[this.source || salla.config.get('page.slug')] || this.source || 'latest';
|
|
170
|
-
}
|
|
171
|
-
getSourceValue() {
|
|
172
|
-
let source = this.getSource();
|
|
173
|
-
//todo:: enhance this code, it call JSON.parse too many times.
|
|
174
|
-
if (!['search', 'json', 'offers', 'latest', 'sales'].includes(source)) {
|
|
175
|
-
if (this.sourceValue && Array.isArray(JSON.parse(this.sourceValue)) && JSON.parse(this.sourceValue).length) {
|
|
176
|
-
return JSON.parse(this.sourceValue);
|
|
177
|
-
}
|
|
178
|
-
if (this.sourceValue && typeof JSON.parse(this.sourceValue) == 'number') {
|
|
179
|
-
return [JSON.parse(this.sourceValue)];
|
|
180
|
-
}
|
|
181
|
-
if (!this.sourceValue && ['categories', 'tags', 'brands'].includes(this.getSource())) {
|
|
182
|
-
return [salla.config.get('page.id')];
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
if (this.sourceValue) {
|
|
186
|
-
return this.sourceValue;
|
|
187
|
-
}
|
|
188
|
-
if (source === 'search') {
|
|
189
|
-
return (new URLSearchParams(window.location.search)).get('q');
|
|
190
|
-
}
|
|
191
|
-
return salla.config.get('page.id');
|
|
192
|
-
}
|
|
193
159
|
loading(isLoading = true) {
|
|
194
160
|
this.btnLoader.style.display = isLoading ? 'inherit' : 'none';
|
|
195
161
|
}
|
|
196
162
|
getItemHTML(product) {
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
163
|
+
const customComponentTag = this.hasCustomComponent ? 'custom-salla-product-card' : 'salla-product-card';
|
|
164
|
+
const productCard = document.createElement(customComponentTag);
|
|
165
|
+
productCard.product = product;
|
|
166
|
+
this.applyLandingPageStyles(productCard);
|
|
167
|
+
this.applyHorizontalCardStyles(productCard);
|
|
168
|
+
return productCard;
|
|
169
|
+
}
|
|
170
|
+
applyLandingPageStyles(productCard) {
|
|
171
|
+
if (this.getSource() === 'landing-page' && !this.hasCustomComponent) {
|
|
172
|
+
productCard.toggleAttribute('hide-add-btn', true);
|
|
173
|
+
productCard.classList.add('s-product-card-fit-height');
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
applyHorizontalCardStyles(productCard) {
|
|
177
|
+
if (!this.horizontalCards) {
|
|
178
|
+
return;
|
|
204
179
|
}
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
180
|
+
productCard.setAttribute('horizontal', true);
|
|
181
|
+
if (!this.hasCustomComponent) {
|
|
182
|
+
productCard.setAttribute('shadow-on-hover', true);
|
|
208
183
|
}
|
|
209
|
-
|
|
184
|
+
}
|
|
185
|
+
getSource() {
|
|
186
|
+
return Helper.Helper.getProductsSource(this.source);
|
|
187
|
+
}
|
|
188
|
+
getSourceValue() {
|
|
189
|
+
return Helper.Helper.getProductsSourceValue(this.source, this.sourceValue);
|
|
210
190
|
}
|
|
211
191
|
fetchProducts() {
|
|
212
192
|
salla.product.fetch({
|
|
@@ -237,7 +217,7 @@ const SallaProductsList = class {
|
|
|
237
217
|
this.infiniteScroll.on('request', () => this.loading());
|
|
238
218
|
this.infiniteScroll.on('load', response => {
|
|
239
219
|
var _a;
|
|
240
|
-
if (!((_a = response.data) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
220
|
+
if (!((_a = response.data) === null || _a === void 0 ? void 0 : _a.length) && this.infiniteScroll.pageIndex == 2) {
|
|
241
221
|
this.showPlaceholder = true;
|
|
242
222
|
salla.infiniteScroll.destroy(this.infiniteScroll);
|
|
243
223
|
this.loading(false);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"salla-products-list.entry.cjs.js","mappings":";;;;;;;;;;;;;;;;;AAAA,MAAM,oBAAoB,GAAG,EAAE;;MCQlB,iBAAiB;;;;;;;;;gBA+FJ,CAAC;;;;;;;;;;EA9FzB,iBAAiB;IACf,KAAK,CAAC,OAAO,CAAC;MACZ,IAAI,CAAC,kBAAkB,GAAG,CAAC,CAAC,cAAc,CAAC,GAAG,CAAC,2BAA2B,CAAC,CAAC;MAC5E,IAAI,CAAC,kBAAkB,GAAG,CAAC,EAAE,IAAI,CAAC,cAAc,EAAE,IAAI,IAAI,CAAC,oBAAoB,EAAE,CAAC,CAAC;MACnF,IAAI,CAAC,iBAAiB,GAAG,CAAC,CAAC,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,cAAc,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,SAAS,EAA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Q,CAAC,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAC,IAAI,GAAG,IAAI,CAAC,QAAQ,CAAC;IACvE,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IACpB,IAAI,IAAI,CAAC,iBAAiB,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE;MAC5C,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,EAAC,eAAe,EAAE,KAAK,EAAE,YAAY,EAAE,KAAK,EAAC,CAAC,CAAC;MAC1E,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;KACnF;IACD,OAAO,CAAA,MAAA,QAAQ,CAAC,IAAI,0CAAE,GAAG,CAAC,OAAO,IAAI,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,KAAI,EAAE,CAAC;GACvE;;;;;;;","names":["anime","h","Host"],"sources":["./src/components/salla-products-list/salla-products-list.scss?tag=salla-products-list","./src/components/salla-products-list/salla-products-list.tsx"],"sourcesContent":["\n","import {Component, Host, h, Prop, State, Element, Method} from '@stencil/core';\nimport anime from 'animejs';\nimport ShoppingBag from '../../assets/svg/shopping-bag.svg';\n\n@Component({\n tag: 'salla-products-list',\n styleUrl: 'salla-products-list.scss'\n})\nexport class SallaProductsList {\n connectedCallback() {\n salla.onReady(() => {\n this.hasCustomComponent = !!customElements.get('custom-salla-product-card');\n this.sourceValueIsValid = !!(this.getSourceValue() || this.isSourceWithoutValue());\n this.hasInfiniteScroll = !['json', 'selected', 'related', 'landing-page'].includes(this.getSource());\n try {\n let searchParams = new URLSearchParams(window.location.search);\n this.sortBy = this.sortBy || searchParams.get('sort') || searchParams.get('by');\n let filters = searchParams.get('filters')\n this.parsedFilters = filters ? JSON.parse(decodeURIComponent(filters)) : {};\n } catch (e) {\n salla.logger.warn('failed to get filters from url', e.message);\n }\n this.buildNextPageUrl();\n this.createStatusDom();\n\n this.isReady = true;\n });\n\n if (!this.sourceValueIsValid) {\n salla.logger.warn(`source-value prop is required for source [${this.getSource()}]`);\n return;\n }\n salla.event.on('salla-filters::changed', filters => this.setFilters(filters))\n\n\n }\n\n @Method()\n async setFilters(filters) {\n if (!!filters && JSON.stringify(this.parsedFilters) === JSON.stringify(filters)) {\n return;\n }\n window.scrollTo({top: 0,behavior: 'smooth'});\n this.parsedFilters = filters;\n return this.reload();\n }\n\n\n @Method()\n async reload() {\n salla.infiniteScroll.destroy(this.infiniteScroll);\n this.buildNextPageUrl();\n this.wrapper.innerHTML = '';\n this.init();\n }\n\n\n private status: HTMLDivElement;\n private btnLoader: HTMLAnchorElement;\n @Element() host: HTMLElement;\n private wrapper: any;\n private infiniteScroll: any;\n /**\n * The source of the products list\n * @type {string}\n * */\n @Prop({\n reflect: true,\n mutable: true\n }) source: 'categories' | 'latest' | 'related' | 'brands' | 'json' | 'search' | 'tags' | 'selected' | 'offers' | 'landing-page' | 'sales';\n\n /**\n * The source value, cloud be different values as following:\n * - array of ids when `source` in ['categories', 'brands', 'tags', 'selected']\n * - keyword when `source` = 'search'\n * - products payload when `source` = 'json'\n * - product_id when `source` = 'related'\n *\n * @type {string}\n * */\n @Prop({mutable: true}) sourceValue: any;\n\n /**\n * Limit for number of products in the list.\n */\n @Prop({mutable: true}) limit: number;\n\n /**\n * Sorting the list of products\n */\n @Prop({mutable: true}) sortBy?: string | 'ourSuggest' | 'bestSell' | 'topRated' | 'priceFromTopToLow' | 'priceFromLowToTop';\n\n /**\n * should listen to filters events `salla-filters::changed` and re-render\n */\n @Prop({reflect: true, mutable: true}) filtersResults: boolean;\n\n /**\n * Horizontal cards\n */\n @Prop({reflect: true}) horizontalCards: boolean\n\n // State\n @State() page: number = 1;\n @State() nextPage: string;\n @State() hasInfiniteScroll: boolean;\n @State() hasCustomComponent: boolean;\n @State() sourceValueIsValid: boolean;\n @State() placeholderText: string;\n @State() isReady: boolean;\n @State() showPlaceholder: boolean;\n @State() parsedFilters: any;\n\n private isFilterable() {\n return salla.config.get('store.settings.product.filters') && this.filtersResults;\n }\n\n private isSourceWithoutValue() {\n return ['offers', 'latest', 'sales'].includes(this.getSource());\n }\n\n private animateItems() {\n anime({\n targets: 'salla-products-list salla-product-card',\n opacity: [0, 1],\n duration: 1200,\n translateY: [20, 0],\n delay: function (_el, i) {\n return i * 100;\n },\n })\n }\n\n private createStatusDom() {\n this.status = document.createElement('div');\n this.status.className = 's-infinite-scroll-wrapper';\n this.status.innerHTML = `<div class=\"s-infinite-scroll-status\">\n <p class=\"s-infinite-scroll-last infinite-scroll-last s-hidden\" >${salla.lang.get('common.elements.end_of_content')}</p>\n <p class=\"s-infinite-scroll-error infinite-scroll-error s-hidden\">${salla.lang.get('common.elements.failed_to_load_more')}</p>\n </div>\n <a href=\"#\" class=\"s-infinite-scroll-btn s-button-btn\">\n <span class=\"s-button-loader s-button-loader-center s-infinite-scroll-btn-loader\" style=\"display: none\"></span>\n </a>`;\n this.btnLoader = this.status.querySelector('.s-button-loader');\n salla.lang.onLoaded(() => {\n this.status.querySelector('.s-infinite-scroll-last').innerHTML = salla.lang.get('common.elements.end_of_content');\n this.status.querySelector('.s-infinite-scroll-error').innerHTML = salla.lang.get('common.elements.failed_to_load_more');\n this.placeholderText = salla.lang.get('pages.categories.no_products');\n });\n }\n\n private initBaseNextPageUrl(source: string) {\n\n this.nextPage = salla.url.api(`products?source=${source}`);\n\n if (this.limit) {\n this.nextPage += `&per_page=${this.limit > 32 ? 32 : this.limit}`;\n }\n if (this.sortBy) {\n this.nextPage += `&sort=${this.sortBy}`;\n }\n // if (!this.isFilterable()) {\n // return this.nextPage;\n // }\n this.nextPage += '&filterable=1';\n for (const [key, value] of Object.entries(this.parsedFilters || {})) {\n if ([\"string\", \"number\"].includes(typeof value)) {\n this.nextPage += `&filters[${key}]=${value}`;\n } else if (Array.isArray(value)) {\n (value as any).forEach(item => this.nextPage += `&filters[${key}][]=${item}`)\n } else if (typeof value === 'object') {\n for (const [k, v] of Object.entries(value)) {\n this.nextPage += `&filters[${key}][${k}]=${v}`;\n }\n }\n }\n }\n\n private buildNextPageUrl() {\n let source = this.getSource();\n if (source === 'json') {\n return;\n }\n this.initBaseNextPageUrl(source);\n if (this.isSourceWithoutValue()) {\n return;\n }\n\n if (['search', 'related', 'landing-page'].includes(source)) {\n this.nextPage += `&source_value=${this.getSourceValue()}`;\n return;\n }\n\n try {\n this.nextPage += `&source_value[]=${this.getSourceValue().join('&source_value[]=')}`;\n } catch (e) {\n salla.logger.warn(`source-value prop should be array of ids ex source-value=\"[1,2,3]\" for the source [${source}]`);\n this.sourceValueIsValid = false;\n }\n }\n\n 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 //todo:: enhance this code, it call JSON.parse too many times.\n if (!['search', 'json', 'offers', 'latest', 'sales'].includes(source)) {\n if (this.sourceValue && Array.isArray(JSON.parse(this.sourceValue)) && JSON.parse(this.sourceValue).length) {\n return JSON.parse(this.sourceValue);\n }\n\n if (this.sourceValue && typeof JSON.parse(this.sourceValue) == 'number') {\n return [JSON.parse(this.sourceValue)];\n }\n if (!this.sourceValue && ['categories', 'tags', 'brands'].includes(this.getSource())) {\n return [salla.config.get('page.id')];\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 customComponentTag: string = this.hasCustomComponent ? 'custom-salla-product-card' : 'salla-product-card';\n let customComponent: HTMLSallaProductCardElement = document.createElement(customComponentTag) as HTMLSallaProductCardElement;\n customComponent.product = product;\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 customComponent.toggleAttribute('shadow-on-hover', true);\n }\n return customComponent;\n }\n\n private fetchProducts() {\n salla.product.fetch({\n source: this.getSource(),\n source_value: this.getSourceValue(),\n limit: this.limit\n })\n .then(res => {\n if (!res.data.length) {\n this.showPlaceholder = true;\n this.loading(false);\n return;\n }\n this.handleResponse(res).forEach(card => this.wrapper.append(card));\n })\n }\n \n private initiateInfiniteScroll() {\n if (!this.hasInfiniteScroll) {\n return;\n }\n\n this.host.insertAdjacentElement('beforeend', this.status);\n this.infiniteScroll = salla.infiniteScroll.initiate(this.wrapper, this.wrapper, {\n path: () => this.nextPage,\n history: false,\n nextPage: this.nextPage,\n scrollThreshold: 100,\n }, /* infinite via api*/true);\n this.infiniteScroll.on('request', () => this.loading())\n this.infiniteScroll.on('load', response => {\n if (!response.data?.length) {\n this.showPlaceholder = true;\n salla.infiniteScroll.destroy(this.infiniteScroll);\n this.loading(false);\n return;\n }else{\n this.showPlaceholder = false;\n\n }\n this.infiniteScroll.appendItems(this.handleResponse(response))\n if (this.infiniteScroll.pageIndex == 2) {\n this.animateItems();\n }\n })\n this.infiniteScroll.on('error', () => {\n this.status.querySelector('.s-infinite-scroll-error').classList.remove('s-hidden')\n this.loading(false);\n });\n salla.onReady(() => salla.infiniteScroll.loadNextPage(this.infiniteScroll))\n }\n\n private canRender() {\n return this.sourceValueIsValid && this.isReady;\n }\n\n render() {\n if (!this.canRender()) {\n return '';\n }\n if (this.showPlaceholder) {\n return <div class=\"s-products-list-placeholder\">\n <span innerHTML={ShoppingBag}/>\n <p>{this.placeholderText}</p>\n </div>;\n }\n return (\n <Host class=\"s-products-list\">\n <div class={{\n \"s-products-list-wrapper\": true,\n 's-products-list-horizontal-cards': this.horizontalCards && !this.filtersResults,\n 's-products-list-vertical-cards': !this.horizontalCards && !this.filtersResults,\n 's-products-list-filters-results': this.filtersResults,\n }}\n ref={wrapper => this.wrapper = wrapper}/>\n </Host>\n );\n }\n\n componentDidLoad() {\n if (!this.canRender()) {\n return;\n }\n\n // Handle json source\n if (this.getSource() === 'json') {\n if (!this.getSourceValue().length) {\n this.showPlaceholder = true;\n return;\n }\n this.getSourceValue().map(product => this.wrapper.append(this.getItemHTML(product)));\n return;\n }\n // Handle selected source\n if (this.getSource() === 'selected' || this.getSource() === 'landing-page') {\n if (this.getSource() === 'selected' && !this.getSourceValue().length) {\n this.showPlaceholder = true;\n return;\n }\n this.fetchProducts()\n return;\n }\n this.init();\n }\n\n private init() {\n this.initiateInfiniteScroll();\n this.loading();\n }\n\n private handleResponse(response): Array<HTMLElement> {\n //💡 when source is related, cursor will not be existed\n if (response.filters && this.isFilterable()) {\n this.filtersResults = true;\n salla.event.emit('filters::fetched', {filters: response.filters});\n } else if (this.isFilterable()) {\n salla.event.emit('filters::hidden');\n }\n this.nextPage = response.cursor ? response.cursor.next : this.nextPage;\n this.loading(false);\n if (this.hasInfiniteScroll && !this.nextPage) {\n this.infiniteScroll.option({scrollThreshold: false, loadOnScroll: false});\n this.status.querySelector('.s-infinite-scroll-last').classList.remove('s-hidden');\n }\n return response.data?.map(product => this.getItemHTML(product)) || [];\n }\n}\n"],"version":3}
|
|
1
|
+
{"file":"salla-products-list.entry.cjs.js","mappings":";;;;;;;;;;;;;;;;;;AAAA,MAAM,oBAAoB,GAAG,EAAE;;MCQlB,iBAAiB;;;;;;;;;gBA+FJ,CAAC;;;;;;;;;;EA9FzB,iBAAiB;IACf,KAAK,CAAC,OAAO,CAAC;MACZ,IAAI,CAAC,kBAAkB,GAAG,CAAC,CAAC,cAAc,CAAC,GAAG,CAAC,2BAA2B,CAAC,CAAC;MAC5E,IAA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,CAAC,YAAY,EAAE,EAAE;MAC3C,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC;MAC3B,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,kBAAkB,EAAE,EAAE,OAAO,EAAE,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC;KACrE;SAAM,IAAI,IAAI,CAAC,YAAY,EAAE,EAAE;MAC9B,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;KACrC;IACD,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAC,IAAI,GAAG,IAAI,CAAC,QAAQ,CAAC;IACvE,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IACpB,IAAI,IAAI,CAAC,iBAAiB,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE;MAC5C,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,EAAE,eAAe,EAAE,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,CAAC,CAAC;MAC5E,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;KACnF;IACD,OAAO,CAAA,MAAA,QAAQ,CAAC,IAAI,0CAAE,GAAG,CAAC,OAAO,IAAI,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,KAAI,EAAE,CAAC;GACvE;;;;;;;","names":["anime","Helper","h","Host"],"sources":["./src/components/salla-products-list/salla-products-list.scss?tag=salla-products-list","./src/components/salla-products-list/salla-products-list.tsx"],"sourcesContent":["\n","import { Component, Host, h, Prop, State, Element, Method } from '@stencil/core';\nimport anime from 'animejs';\nimport ShoppingBag from '../../assets/svg/shopping-bag.svg';\nimport Helper from '../../Helpers/Helper';\n@Component({\n tag: 'salla-products-list',\n styleUrl: 'salla-products-list.scss'\n})\nexport class SallaProductsList {\n connectedCallback() {\n salla.onReady(() => {\n this.hasCustomComponent = !!customElements.get('custom-salla-product-card');\n this.sourceValueIsValid = !!(this.getSourceValue() || this.isSourceWithoutValue());\n this.hasInfiniteScroll = !['json', 'selected', 'related', 'landing-page'].includes(this.getSource());\n try {\n let searchParams = new URLSearchParams(window.location.search);\n this.sortBy = this.sortBy || searchParams.get('sort') || searchParams.get('by');\n let filters = searchParams.get('filters')\n this.parsedFilters = filters ? JSON.parse(decodeURIComponent(filters)) : {};\n } catch (e) {\n salla.logger.warn('failed to get filters from url', e.message);\n }\n this.buildNextPageUrl();\n this.createStatusDom();\n\n this.isReady = true;\n });\n\n if (!this.sourceValueIsValid) {\n salla.logger.warn(`source-value prop is required for source [${this.getSource()}]`);\n return;\n }\n salla.event.on('salla-filters::changed', filters => this.setFilters(filters))\n\n\n }\n\n @Method()\n async setFilters(filters) {\n if (!!filters && JSON.stringify(this.parsedFilters) === JSON.stringify(filters)) {\n return;\n }\n window.scrollTo({ top: 0, behavior: 'smooth' });\n this.parsedFilters = filters;\n return this.reload();\n }\n\n\n @Method()\n async reload() {\n salla.infiniteScroll.destroy(this.infiniteScroll);\n this.buildNextPageUrl();\n this.wrapper.innerHTML = '';\n this.init();\n }\n\n\n private status: HTMLDivElement;\n private btnLoader: HTMLAnchorElement;\n @Element() host: HTMLElement;\n private wrapper: any;\n private infiniteScroll: any;\n /**\n * The source of the products list\n * @type {string}\n * */\n @Prop({\n reflect: true,\n mutable: true\n }) source: 'categories' | 'latest' | 'related' | 'brands' | 'json' | 'search' | 'tags' | 'selected' | 'offers' | 'landing-page' | 'sales';\n\n /**\n * The source value, cloud be different values as following:\n * - array of ids when `source` in ['categories', 'brands', 'tags', 'selected']\n * - keyword when `source` = 'search'\n * - products payload when `source` = 'json'\n * - product_id when `source` = 'related'\n *\n * @type {string}\n * */\n @Prop({ mutable: true }) sourceValue: any;\n\n /**\n * Limit for number of products in the list.\n */\n @Prop({ mutable: true }) limit: number;\n\n /**\n * Sorting the list of products\n */\n @Prop({ mutable: true }) sortBy?: string | 'ourSuggest' | 'bestSell' | 'topRated' | 'priceFromTopToLow' | 'priceFromLowToTop';\n\n /**\n * should listen to filters events `salla-filters::changed` and re-render\n */\n @Prop({ reflect: true, mutable: true }) filtersResults: boolean;\n\n /**\n * Horizontal cards\n */\n @Prop({ reflect: true }) horizontalCards: boolean\n\n // State\n @State() page: number = 1;\n @State() nextPage: string;\n @State() hasInfiniteScroll: boolean;\n @State() hasCustomComponent: boolean;\n @State() sourceValueIsValid: boolean;\n @State() placeholderText: string;\n @State() isReady: boolean;\n @State() showPlaceholder: boolean;\n @State() parsedFilters: any;\n\n private isFilterable() {\n return salla.config.get('store.settings.product.filters') && this.filtersResults;\n }\n\n private isSourceWithoutValue() {\n return ['offers', 'latest', 'sales'].includes(this.getSource());\n }\n\n private animateItems() {\n anime({\n targets: 'salla-products-list salla-product-card',\n opacity: [0, 1],\n duration: 1200,\n translateY: [20, 0],\n delay: function (_el, i) {\n return i * 100;\n },\n })\n }\n\n private createStatusDom() {\n this.status = document.createElement('div');\n this.status.className = 's-infinite-scroll-wrapper';\n this.status.innerHTML = `<div class=\"s-infinite-scroll-status\">\n <p class=\"s-infinite-scroll-last infinite-scroll-last s-hidden\" >${salla.lang.get('common.elements.end_of_content')}</p>\n <p class=\"s-infinite-scroll-error infinite-scroll-error s-hidden\">${salla.lang.get('common.elements.failed_to_load_more')}</p>\n </div>\n <a href=\"#\" class=\"s-infinite-scroll-btn s-button-btn\">\n <span class=\"s-button-loader s-button-loader-center s-infinite-scroll-btn-loader\" style=\"display: none\"></span>\n </a>`;\n this.btnLoader = this.status.querySelector('.s-button-loader');\n salla.lang.onLoaded(() => {\n this.status.querySelector('.s-infinite-scroll-last').innerHTML = salla.lang.get('common.elements.end_of_content');\n this.status.querySelector('.s-infinite-scroll-error').innerHTML = salla.lang.get('common.elements.failed_to_load_more');\n this.placeholderText = salla.lang.get('pages.categories.no_products');\n });\n }\n\n private initBaseNextPageUrl(source: string) {\n\n this.nextPage = salla.url.api(`products?source=${source}`);\n\n if (this.limit) {\n this.nextPage += `&per_page=${this.limit > 32 ? 32 : this.limit}`;\n }\n if (this.sortBy) {\n this.nextPage += `&sort=${this.sortBy}`;\n }\n // if (!this.isFilterable()) {\n // return this.nextPage;\n // }\n this.nextPage += '&filterable=1';\n for (const [key, value] of Object.entries(this.parsedFilters || {})) {\n if ([\"string\", \"number\"].includes(typeof value)) {\n this.nextPage += `&filters[${key}]=${value}`;\n } else if (Array.isArray(value)) {\n (value as any).forEach(item => this.nextPage += `&filters[${key}][]=${item}`)\n } else if (typeof value === 'object') {\n for (const [k, v] of Object.entries(value)) {\n this.nextPage += `&filters[${key}][${k}]=${v}`;\n }\n }\n }\n }\n\n private buildNextPageUrl() {\n let source = this.getSource();\n if (source === 'json') {\n return;\n }\n this.initBaseNextPageUrl(source);\n if (this.isSourceWithoutValue()) {\n return;\n }\n\n if (['search', 'related', 'landing-page'].includes(source)) {\n this.nextPage += `&source_value=${this.getSourceValue()}`;\n return;\n }\n\n try {\n this.nextPage += `&source_value[]=${this.getSourceValue().join('&source_value[]=')}`;\n } catch (e) {\n salla.logger.warn(`source-value prop should be array of ids ex source-value=\"[1,2,3]\" for the source [${source}]`);\n this.sourceValueIsValid = false;\n }\n }\n\n\n private loading(isLoading = true) {\n this.btnLoader.style.display = isLoading ? 'inherit' : 'none';\n }\n\n private getItemHTML(product) {\n const customComponentTag = this.hasCustomComponent ? 'custom-salla-product-card' : 'salla-product-card';\n const productCard = document.createElement(customComponentTag) as HTMLSallaProductCardElement;\n productCard.product = product;\n\n this.applyLandingPageStyles(productCard);\n this.applyHorizontalCardStyles(productCard);\n\n return productCard;\n }\n\n private applyLandingPageStyles(productCard) {\n if (this.getSource() === 'landing-page' && !this.hasCustomComponent) {\n productCard.toggleAttribute('hide-add-btn', true);\n productCard.classList.add('s-product-card-fit-height');\n }\n }\n\n private applyHorizontalCardStyles(productCard) {\n if (!this.horizontalCards) {\n return;\n }\n productCard.setAttribute('horizontal', true);\n if (!this.hasCustomComponent) {\n productCard.setAttribute('shadow-on-hover', true);\n }\n\n }\n\n private getSource() {\n return Helper.getProductsSource(this.source);\n }\n\n private getSourceValue() {\n return Helper.getProductsSourceValue(this.source, this.sourceValue);\n }\n\n private fetchProducts() {\n salla.product.fetch({\n source: this.getSource(),\n source_value: this.getSourceValue(),\n limit: this.limit\n })\n .then(res => {\n if (!res.data.length) {\n this.showPlaceholder = true;\n this.loading(false);\n return;\n }\n this.handleResponse(res).forEach(card => this.wrapper.append(card));\n })\n }\n\n private initiateInfiniteScroll() {\n if (!this.hasInfiniteScroll) {\n return;\n }\n\n this.host.insertAdjacentElement('beforeend', this.status);\n this.infiniteScroll = salla.infiniteScroll.initiate(this.wrapper, this.wrapper, {\n path: () => this.nextPage,\n history: false,\n nextPage: this.nextPage,\n scrollThreshold: 100,\n }, /* infinite via api*/true);\n this.infiniteScroll.on('request', () => this.loading())\n this.infiniteScroll.on('load', response => {\n if (!response.data?.length && this.infiniteScroll.pageIndex == 2) {\n this.showPlaceholder = true;\n salla.infiniteScroll.destroy(this.infiniteScroll);\n this.loading(false);\n return;\n } else {\n this.showPlaceholder = false;\n\n }\n this.infiniteScroll.appendItems(this.handleResponse(response))\n if (this.infiniteScroll.pageIndex == 2) {\n this.animateItems();\n }\n })\n this.infiniteScroll.on('error', () => {\n this.status.querySelector('.s-infinite-scroll-error').classList.remove('s-hidden')\n this.loading(false);\n });\n salla.onReady(() => salla.infiniteScroll.loadNextPage(this.infiniteScroll))\n }\n\n private canRender() {\n return this.sourceValueIsValid && this.isReady;\n }\n\n render() {\n if (!this.canRender()) {\n return '';\n }\n if (this.showPlaceholder) {\n return <div class=\"s-products-list-placeholder\">\n <span innerHTML={ShoppingBag} />\n <p>{this.placeholderText}</p>\n </div>;\n }\n return (\n <Host class=\"s-products-list\">\n <div class={{\n \"s-products-list-wrapper\": true,\n 's-products-list-horizontal-cards': this.horizontalCards && !this.filtersResults,\n 's-products-list-vertical-cards': !this.horizontalCards && !this.filtersResults,\n 's-products-list-filters-results': this.filtersResults,\n }}\n ref={wrapper => this.wrapper = wrapper} />\n </Host>\n );\n }\n\n componentDidLoad() {\n if (!this.canRender()) {\n return;\n }\n\n // Handle json source\n if (this.getSource() === 'json') {\n if (!this.getSourceValue().length) {\n this.showPlaceholder = true;\n return;\n }\n this.getSourceValue().map(product => this.wrapper.append(this.getItemHTML(product)));\n return;\n }\n // Handle selected source\n if (this.getSource() === 'selected' || this.getSource() === 'landing-page') {\n if (this.getSource() === 'selected' && !this.getSourceValue().length) {\n this.showPlaceholder = true;\n return;\n }\n this.fetchProducts()\n return;\n }\n this.init();\n }\n\n private init() {\n this.initiateInfiniteScroll();\n this.loading();\n }\n\n private handleResponse(response): Array<HTMLElement> {\n //💡 when source is related, cursor will not be existed\n if (response.filters && this.isFilterable()) {\n this.filtersResults = true;\n salla.event.emit('filters::fetched', { filters: response.filters });\n } else if (this.isFilterable()) {\n salla.event.emit('filters::hidden');\n }\n this.nextPage = response.cursor ? response.cursor.next : this.nextPage;\n this.loading(false);\n if (this.hasInfiniteScroll && !this.nextPage) {\n this.infiniteScroll.option({ scrollThreshold: false, loadOnScroll: false });\n this.status.querySelector('.s-infinite-scroll-last').classList.remove('s-hidden');\n }\n return response.data?.map(product => this.getItemHTML(product)) || [];\n }\n}\n"],"version":3}
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
7
7
|
|
|
8
8
|
const index = require('./index-e85bd084.js');
|
|
9
|
+
const Helper = require('./Helper-f14223e6.js');
|
|
9
10
|
|
|
10
11
|
const sallaProductsSliderCss = "";
|
|
11
12
|
|
|
@@ -16,10 +17,10 @@ const SallaProductsSlider = class {
|
|
|
16
17
|
this.subTitle = undefined;
|
|
17
18
|
this.sliderId = undefined;
|
|
18
19
|
this.displayAllUrl = undefined;
|
|
20
|
+
this.autoplay = undefined;
|
|
19
21
|
this.source = undefined;
|
|
20
22
|
this.sourceValue = undefined;
|
|
21
23
|
this.limit = undefined;
|
|
22
|
-
this.autoplay = undefined;
|
|
23
24
|
this.productsData = undefined;
|
|
24
25
|
this.isReady = undefined;
|
|
25
26
|
this.sourceValueIsValid = undefined;
|
|
@@ -44,39 +45,6 @@ const SallaProductsSlider = class {
|
|
|
44
45
|
}
|
|
45
46
|
return index.h("div", { class: "s-products-slider-card" }, index.h("salla-product-card", { "show-quantity": this.getSource() == 'landing-page', "hide-add-btn": this.getSource() == 'landing-page', "shadow-on-hover": true, product: product }));
|
|
46
47
|
}
|
|
47
|
-
getSource() {
|
|
48
|
-
return {
|
|
49
|
-
'brands.single': 'brands',
|
|
50
|
-
'product.index': 'categories',
|
|
51
|
-
'product.index.latest': 'latest',
|
|
52
|
-
'product.index.offers': 'offers',
|
|
53
|
-
'product.index.search': 'search',
|
|
54
|
-
'landing-page': 'landing-page',
|
|
55
|
-
'product.index.tag': 'tags',
|
|
56
|
-
}[this.source || salla.config.get('page.slug')] || this.source || 'latest';
|
|
57
|
-
}
|
|
58
|
-
getSourceValue() {
|
|
59
|
-
let source = this.getSource();
|
|
60
|
-
//todo:: enhance this code, it call JSON.parse too many times.
|
|
61
|
-
if (!['search', 'json', 'offers', 'latest', 'sales', 'related'].includes(source)) {
|
|
62
|
-
if (this.sourceValue && Array.isArray(JSON.parse(this.sourceValue)) && JSON.parse(this.sourceValue).length) {
|
|
63
|
-
return JSON.parse(this.sourceValue);
|
|
64
|
-
}
|
|
65
|
-
if (this.sourceValue && typeof JSON.parse(this.sourceValue) == 'number') {
|
|
66
|
-
return [JSON.parse(this.sourceValue)];
|
|
67
|
-
}
|
|
68
|
-
if (!this.sourceValue && ['categories', 'tags', 'brands'].includes(this.getSource())) {
|
|
69
|
-
return [salla.config.get('page.id')];
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
if (this.sourceValue) {
|
|
73
|
-
return this.sourceValue;
|
|
74
|
-
}
|
|
75
|
-
if (source === 'search') {
|
|
76
|
-
return (new URLSearchParams(window.location.search)).get('q');
|
|
77
|
-
}
|
|
78
|
-
return salla.config.get('page.id');
|
|
79
|
-
}
|
|
80
48
|
canRender() {
|
|
81
49
|
return this.sourceValueIsValid && this.isReady;
|
|
82
50
|
}
|
|
@@ -95,12 +63,18 @@ const SallaProductsSlider = class {
|
|
|
95
63
|
this.isReady = true;
|
|
96
64
|
});
|
|
97
65
|
}
|
|
66
|
+
getSource() {
|
|
67
|
+
return Helper.Helper.getProductsSource(this.source);
|
|
68
|
+
}
|
|
69
|
+
getSourceValue() {
|
|
70
|
+
return Helper.Helper.getProductsSourceValue(this.source, this.sourceValue);
|
|
71
|
+
}
|
|
98
72
|
render() {
|
|
99
73
|
var _a;
|
|
100
74
|
if ((this.getSource() == 'related' && !salla.config.get('store.settings.product.related_products_enabled')) || !this.canRender()) {
|
|
101
75
|
return;
|
|
102
76
|
}
|
|
103
|
-
return (index.h(index.Host, { class: "s-products-slider-wrapper" }, index.h("salla-slider", {
|
|
77
|
+
return (index.h(index.Host, { class: "s-products-slider-wrapper" }, index.h("salla-slider", { class: "s-products-slider-slider", id: this.sliderId || `s-products-slider-${Math.random().toString(36).substr(2, 9)}`, "auto-play": this.autoplay, type: "carousel", "block-title": this.blockTitle, "block-subTitle": this.subTitle, "display-all-url": this.displayAllUrl }, index.h("div", { slot: "items" }, (_a = this.productsData) === null || _a === void 0 ? void 0 : _a.map(product => this.getItemHTML(product))))));
|
|
104
78
|
}
|
|
105
79
|
get host() { return index.getElement(this); }
|
|
106
80
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"salla-products-slider.entry.cjs.js","mappings":"
|
|
1
|
+
{"file":"salla-products-slider.entry.cjs.js","mappings":";;;;;;;;;;AAAA,MAAM,sBAAsB,GAAG,EAAE;;MCQpB,mBAAmB;EAC9B;;;;;;;;;;;;;;kBAgF0B,EAAE;;IA/E1B,KAAK,CAAC,OAAO,CAAC;MACZ,IAAI,CAAC,kBAAkB,GAAG,CAAC,EAAE,IAAI,CAAC,SAAS,EAAE,IAAI,IAAI,CAAC,oBAA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AAC,cAAc,EAAE;MACnC,KAAK,EAAE,IAAI,CAAC,KAAK;KAClB,CAAC,CAAC,IAAI,CAAC,GAAG;MACT,IAAI,CAAC,YAAY,GAAG,GAAG,CAAC,IAAI,CAAA;MAC5B,IAAI,CAAC,OAAO,GAAG,IAAI,CAAA;KACpB,CAAC,CAAA;GACH;EACO,SAAS;IACf,OAAOC,aAAM,CAAC,iBAAiB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;GAC9C;EAEO,cAAc;IACpB,OAAOA,aAAM,CAAC,sBAAsB,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;GACrE;EAED,MAAM;;IACJ,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,SAAS,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,iDAAiD,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,EAAE,EAAE;MAChI,OAAO;KACR;IACD,QACED,QAACE,UAAI,IAAC,KAAK,EAAC,2BAA2B,IACrCF,0BACE,KAAK,EAAC,0BAA0B,EAChC,EAAE,EAAE,IAAI,CAAC,QAAQ,IAAI,qBAAqB,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,eACxE,IAAI,CAAC,QAAQ,EACxB,IAAI,EAAC,UAAU,iBACF,IAAI,CAAC,UAAU,oBACZ,IAAI,CAAC,QAAQ,qBACZ,IAAI,CAAC,aAAa,IAEnCA,iBAAK,IAAI,EAAC,OAAO,IACd,MAAA,IAAI,CAAC,YAAY,0CAAE,GAAG,CAAC,OAAO,IAAI,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,CACzD,CACO,CACV,EACP;GACH;;;;;;;","names":["h","Helper","Host"],"sources":["./src/components/salla-products-slider/salla-products-slider.scss?tag=salla-products-slider","./src/components/salla-products-slider/salla-products-slider.tsx"],"sourcesContent":[".s-products-slider{\n &-wrapper{\n\n }\n &-slider{\n\n }\n &-card{\n\n }\n}","import { Component, Host, h, Prop, Element, State } from '@stencil/core';\nimport Helper from '../../Helpers/Helper';\n@Component({\n tag: 'salla-products-slider',\n styleUrl: 'salla-products-slider.scss'\n})\n\n//todo:: extends this component from salla-products-list or the opposite\nexport class SallaProductsSlider {\n constructor() {\n salla.onReady(() => {\n this.sourceValueIsValid = !!(this.getSource() || this.isSourceWithoutValue());\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 }\n private isSourceWithoutValue() {\n return ['offers', 'latest', 'sales'].includes(this.getSource());\n }\n\n @Element() host: HTMLElement;\n //todo:: support limit, default =10, make sure that maximum is 32,\n\n /**\n * Title of the block - works only if slider is true\n * @type {string}\n * @default ''\n * */\n @Prop() blockTitle: string;\n\n /**\n * Sub title of the block - works only if slider is true\n * @type {string}\n * @default ''\n * */\n @Prop() subTitle: string;\n\n /**\n * Slider Id, if not provided will be generated automatically\n * @type {string}\n * @default ''\n * */\n @Prop() sliderId: string;\n\n /**\n * Display 'ALL' URL\n * @type {string}\n * @default ''\n * */\n @Prop() displayAllUrl: string;\n\n /**\n * autoplay option for products slider\n */\n @Prop({ mutable: true }) autoplay: boolean\n\n /**\n * Source of the products, if api will get the products from the API, if json will get the products from the products prop\n * @type {string}\n * @default ''\n * */\n @Prop({\n reflect: true,\n mutable: true\n }) source: 'categories' | 'latest' | 'related' | 'brands' | 'json' | 'tags' | 'selected' | 'offers' | 'landing-page';\n\n /**\n * The source value, cloud be different values as following:\n * - array of ids when `source` in ['categories', 'brands', 'tags', 'selected']\n * - products payload when `source` = 'json'\n * - product_id when `source` = 'related'\n *\n * @type {string}\n * */\n @Prop() sourceValue: string;\n\n /**\n * Limit for number of products in the list.\n */\n @Prop({ mutable: true }) limit: number;\n\n\n @State() productsData: any;\n @State() isReady: boolean;\n @State() sourceValueIsValid: boolean;\n @State() hasCustomComponent: boolean;\n @State() apiUrl: string = '';\n @State() parsedSourceValue: any;\n\n private getItemHTML(product) {\n if (this.hasCustomComponent) {\n return <div class=\"s-products-slider-card\">\n <custom-salla-product-card product={product} source={this.getSource()} source-value={this.getSourceValue()} />\n </div>;\n }\n\n return <div class=\"s-products-slider-card\">\n <salla-product-card\n show-quantity={this.getSource() == 'landing-page'}\n hide-add-btn={this.getSource() == 'landing-page'}\n shadow-on-hover={true}\n product={product} />\n </div>;\n }\n\n\n\n\n private canRender() {\n return this.sourceValueIsValid && this.isReady;\n }\n\n componentWillLoad() {\n if (this.source === 'json') {\n this.productsData = this.getSourceValue();\n this.isReady = true\n return;\n }\n return salla.product.fetch({\n source: this.getSource(),\n source_value: this.getSourceValue(),\n limit: this.limit,\n }).then(res => {\n this.productsData = res.data\n this.isReady = true\n })\n }\n private getSource() {\n return Helper.getProductsSource(this.source);\n }\n\n private getSourceValue() {\n return Helper.getProductsSourceValue(this.source, this.sourceValue);\n }\n\n render() {\n if ((this.getSource() == 'related' && !salla.config.get('store.settings.product.related_products_enabled')) || !this.canRender()) {\n return;\n }\n return (\n <Host class=\"s-products-slider-wrapper\">\n <salla-slider\n class=\"s-products-slider-slider\"\n id={this.sliderId || `s-products-slider-${Math.random().toString(36).substr(2, 9)}`}\n auto-play={this.autoplay}\n type=\"carousel\"\n block-title={this.blockTitle}\n block-subTitle={this.subTitle}\n display-all-url={this.displayAllUrl}\n >\n <div slot=\"items\">\n {this.productsData?.map(product => this.getItemHTML(product))}\n </div>\n </salla-slider>\n </Host>\n );\n }\n\n}\n"],"version":3}
|
package/dist/cjs/twilight.cjs.js
CHANGED
|
@@ -26,7 +26,7 @@ const patchBrowser = () => {
|
|
|
26
26
|
|
|
27
27
|
patchBrowser().then(options => {
|
|
28
28
|
appGlobals.globalScripts();
|
|
29
|
-
return index.bootstrapLazy(JSON.parse("[[\"salla-add-product-button_40.cjs\",[[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\",{\"cartItemId\":[8,\"cart-item-id\"],\"quantity\":[32],\"fireChangeEvent\":[32],\"decrease\":[64],\"increase\":[64],\"setValue\":[64]}],[4,\"salla-user-menu\",{\"inline\":[516],\"avatarOnly\":[516,\"avatar-only\"],\"showHeader\":[516,\"show-header\"],\"relativeDropdown\":[516,\"relative-dropdown\"],\"accountLoading\":[32],\"opened\":[32],\"notifications\":[32],\"orders\":[32],\"pending_orders\":[32],\"wishlist\":[32],\"profile\":[32],\"rating\":[32],\"logout\":[32],\"hello\":[32],\"first_name\":[32],\"last_name\":[32],\"avatar\":[32],\"is_loggedIn\":[32],\"badges\":[32],\"hasBadges\":[32],\"OrderUpdate\":[32]}],[4,\"salla-product-card\",{\"product\":[1],\"horizontal\":[4],\"shadowOnHover\":[4,\"shadow-on-hover\"],\"hideAddBtn\":[4,\"hide-add-btn\"],\"fullImage\":[4,\"full-image\"],\"minimal\":[4],\"isSpecial\":[4,\"is-special\"],\"showQuantity\":[4,\"show-quantity\"],\"productData\":[32],\"fitImageHeight\":[32],\"remained\":[32],\"outOfStock\":[32],\"donationAmount\":[32],\"startingPrice\":[32],\"addToCart\":[32],\"placeholder\":[32]}],[4,\"salla-map\",{\"name\":[1],\"required\":[4],\"readonly\":[4],\"searchable\":[1028],\"lat\":[1026],\"lng\":[1026],\"apiKey\":[1025,\"api-key\"],\"modalTitle\":[1,\"modal-title\"],\"zoom\":[1026],\"theme\":[1025],\"modalActivityTitle\":[32],\"confirmButtonTitle\":[32],\"locateButtonTitle\":[32],\"locateButtonEdit\":[32],\"searchPlaceholder\":[32],\"searchInputValue\":[32],\"formattedAddress\":[32],\"geolocationError\":[32],\"searchInput\":[32],\"mapInput\":[32],\"mapElement\":[32],\"selectedLat\":[32],\"selectedLng\":[32],\"open\":[64]}],[4,\"salla-verify\",{\"display\":[1],\"type\":[1025],\"autoReload\":[4,\"auto-reload\"],\"supportWebAuth\":[4,\"support-web-auth\"],\"translationLoaded\":[32],\"title\":[32],\"resendAfter\":[32],\"isProfileVerify\":[32],\"getCode\":[64],\"open\":[64]}],[4,\"salla-color-picker\",{\"name\":[1],\"required\":[4],\"color\":[1537],\"format\":[1],\"showCancelButton\":[4,\"show-cancel-button\"],\"showTextField\":[4,\"show-text-field\"],\"enableAlpha\":[4,\"enable-alpha\"],\"widgetColor\":[32],\"setPickerOption\":[64],\"movePopUp\":[64],\"setColorValue\":[64],\"openPicker\":[64],\"closePicker\":[64],\"destroyPicker\":[64]}],[4,\"salla-add-product-button\",{\"channels\":[513],\"subscribedOptions\":[1,\"subscribed-options\"],\"quickBuy\":[1540,\"quick-buy\"],\"quantity\":[514],\"donatingAmount\":[514,\"donating-amount\"],\"notifyOptionsAvailability\":[516,\"notify-options-availability\"],\"productId\":[520,\"product-id\"],\"supportStickyBar\":[516,\"support-sticky-bar\"],\"productStatus\":[513,\"product-status\"],\"productType\":[513,\"product-type\"],\"hasOutOfStockOption\":[32],\"hasSubscribedOptions\":[32],\"selectedOptions\":[32],\"showQuickBuy\":[32]}],[0,\"salla-count-down\",{\"date\":[1],\"boxed\":[4],\"size\":[1],\"color\":[1],\"labeled\":[4],\"endText\":[1,\"end-text\"],\"digits\":[1],\"endOfDay\":[4,\"end-of-day\"],\"daysLabel\":[32],\"hoursLabel\":[32],\"minutesLabel\":[32],\"secondsLabel\":[32],\"endLabel\":[32],\"invalidDate\":[32],\"offerEnded\":[32],\"countInterval\":[32],\"days\":[32],\"hours\":[32],\"minutes\":[32],\"seconds\":[32],\"endCountDown\":[64]}],[0,\"salla-datetime-picker\",{\"value\":[1537],\"required\":[4],\"name\":[513],\"placeholder\":[1],\"allowInput\":[4,\"allow-input\"],\"allowInvalidPreload\":[4,\"allow-invalid-preload\"],\"altFormat\":[1,\"alt-format\"],\"altInput\":[4,\"alt-input\"],\"altInputClass\":[1,\"alt-input-class\"],\"appendTo\":[16],\"ariaDateFormat\":[1,\"aria-date-format\"],\"autoFillDefaultTime\":[4,\"auto-fill-default-time\"],\"clickOpens\":[4,\"click-opens\"],\"closeOnSelect\":[4,\"close-on-select\"],\"conjunction\":[1],\"dateFormat\":[1,\"date-format\"],\"defaultDate\":[8,\"default-date\"],\"defaultHour\":[2,\"default-hour\"],\"defaultMinute\":[2,\"default-minute\"],\"defaultSeconds\":[2,\"default-seconds\"],\"disable\":[16],\"disableMobile\":[4,\"disable-mobile\"],\"enable\":[16],\"enableSeconds\":[4,\"enable-seconds\"],\"enableTime\":[4,\"enable-time\"],\"formatDate\":[16],\"hourIncrement\":[2,\"hour-increment\"],\"inline\":[4],\"locale\":[1],\"maxDate\":[8,\"max-date\"],\"maxTime\":[8,\"max-time\"],\"minDate\":[8,\"min-date\"],\"minTime\":[8,\"min-time\"],\"minuteIncrement\":[2,\"minute-increment\"],\"mode\":[1],\"monthSelectorType\":[1,\"month-selector-type\"],\"nextArrow\":[1,\"next-arrow\"],\"noCalendar\":[4,\"no-calendar\"],\"dateParser\":[16],\"position\":[1],\"positionElement\":[16],\"prevArrow\":[1,\"prev-arrow\"],\"shorthandCurrentMonth\":[4,\"shorthand-current-month\"],\"static\":[4],\"showMonths\":[2,\"show-months\"],\"time_24hr\":[4,\"time_-2-4hr\"],\"weekNumbers\":[4,\"week-numbers\"],\"wrap\":[4]}],[4,\"salla-tab-content\",{\"name\":[1],\"isSelected\":[32],\"getChild\":[64]}],[4,\"salla-tab-header\",{\"name\":[1],\"activeClass\":[1,\"active-class\"],\"height\":[8],\"centered\":[4],\"isSelected\":[32],\"getChild\":[64]}],[4,\"salla-tabs\",{\"backgroundColor\":[1,\"background-color\"],\"vertical\":[4]},[[0,\"tabSelected\",\"onSelectedTab\"]]],[0,\"salla-product-availability\",{\"channels\":[1],\"notifyOptionsAvailability\":[4,\"notify-options-availability\"],\"productId\":[2,\"product-id\"],\"isSubscribed\":[1028,\"is-subscribed\"],\"translationLoaded\":[32],\"title_\":[32],\"isVisitorSubscribed\":[32]}],[0,\"salla-quick-buy\",{\"type\":[1025],\"productId\":[1025,\"product-id\"],\"amount\":[1538],\"currency\":[1025],\"options\":[16],\"isRequireShipping\":[1028,\"is-require-shipping\"],\"isApplePayActive\":[32],\"quickBuy\":[32]}],[0,\"salla-file-upload\",{\"value\":[1537],\"files\":[513],\"height\":[513],\"cartItemId\":[1,\"cart-item-id\"],\"profileImage\":[516,\"profile-image\"],\"name\":[1537],\"payloadName\":[1,\"payload-name\"],\"accept\":[1537],\"fileId\":[2,\"file-id\"],\"url\":[1025],\"method\":[1],\"formData\":[1,\"form-data\"],\"required\":[4],\"maxFileSize\":[1,\"max-file-size\"],\"disabled\":[4],\"allowDrop\":[4,\"allow-drop\"],\"allowBrowse\":[4,\"allow-browse\"],\"allowPaste\":[4,\"allow-paste\"],\"allowMultiple\":[4,\"allow-multiple\"],\"allowReplace\":[4,\"allow-replace\"],\"allowRevert\":[4,\"allow-revert\"],\"allowRemove\":[4,\"allow-remove\"],\"allowProcess\":[4,\"allow-process\"],\"allowReorder\":[4,\"allow-reorder\"],\"storeAsFile\":[4,\"store-as-file\"],\"forceRevert\":[4,\"force-revert\"],\"maxFilesCount\":[2,\"max-files-count\"],\"maxParallelUploads\":[2,\"max-parallel-uploads\"],\"checkValidity\":[4,\"check-validity\"],\"itemInsertLocation\":[1,\"item-insert-location\"],\"itemInsertInterval\":[2,\"item-insert-interval\"],\"credits\":[4],\"dropOnPage\":[4,\"drop-on-page\"],\"dropOnElement\":[4,\"drop-on-element\"],\"dropValidation\":[4,\"drop-validation\"],\"ignoredFiles\":[16],\"instantUpload\":[1028,\"instant-upload\"],\"chunkUploads\":[4,\"chunk-uploads\"],\"chunkForce\":[4,\"chunk-force\"],\"chunkSize\":[2,\"chunk-size\"],\"chunkRetryDelays\":[16],\"labelDecimalSeparator\":[1,\"label-decimal-separator\"],\"labelThousandsSeparator\":[1,\"label-thousands-separator\"],\"labelIdle\":[1025,\"label-idle\"],\"iconRemove\":[1,\"icon-remove\"],\"iconProcess\":[1,\"icon-process\"],\"iconRetry\":[1,\"icon-retry\"],\"iconUndo\":[1,\"icon-undo\"],\"setOption\":[64]}],[0,\"salla-progress-bar\",{\"donation\":[1],\"target\":[1026],\"value\":[1026],\"height\":[1025],\"header\":[1025],\"stripped\":[1028],\"message\":[1025],\"unit\":[1025],\"color\":[1025]}],[0,\"salla-rating-stars\",{\"name\":[1],\"size\":[1],\"value\":[2],\"reviews\":[2]}],[4,\"salla-list-tile\",{\"href\":[1],\"target\":[1]}],[4,\"salla-slider\",{\"blockTitle\":[513,\"block-title\"],\"listenToThumbnailsOption\":[516,\"listen-to-thumbnails-option\"],\"blockSubtitle\":[513,\"block-subtitle\"],\"displayAllUrl\":[513,\"display-all-url\"],\"arrowsCentered\":[516,\"arrows-centered\"],\"verticalThumbs\":[516,\"vertical-thumbs\"],\"gridThumbs\":[516,\"grid-thumbs\"],\"vertical\":[516],\"autoHeight\":[516,\"auto-height\"],\"showControls\":[516,\"show-controls\"],\"controlsOuter\":[516,\"controls-outer\"],\"showThumbsControls\":[4,\"show-thumbs-controls\"],\"autoPlay\":[4,\"auto-play\"],\"slidesPerView\":[1,\"slides-per-view\"],\"pagination\":[4],\"centered\":[4],\"loop\":[4],\"direction\":[1537],\"type\":[1],\"sliderConfig\":[520,\"slider-config\"],\"thumbsConfig\":[520,\"thumbs-config\"],\"currentIndex\":[32],\"isEnd\":[32],\"isBeginning\":[32],\"swiperScript\":[32],\"displayAllTitle\":[32],\"slideTo\":[64],\"slideNext\":[64],\"slidePrev\":[64],\"slideToLoop\":[64],\"slideNextLoop\":[64],\"slidePrevLoop\":[64],\"slideReset\":[64],\"slideToClosest\":[64],\"update\":[64],\"updateAutoHeight\":[64],\"updateSlides\":[64],\"updateProgress\":[64],\"updateSlidesClasses\":[64],\"getSlides\":[64]}],[4,\"salla-placeholder\",{\"icon\":[1],\"alignment\":[1],\"iconSize\":[1,\"icon-size\"],\"translationLoaded\":[32]}],[0,\"salla-skeleton\",{\"type\":[1],\"width\":[1],\"height\":[1]}],[0,\"salla-tel-input\",{\"phone\":[1025],\"name\":[1],\"countryCode\":[1025,\"country-code\"],\"mobileRequired\":[32],\"countryCodeLabel\":[32],\"mobileLabel\":[32],\"tooShort\":[32],\"tooLong\":[32],\"invalidCountryCode\":[32],\"invalidNumber\":[32],\"errorMap\":[32],\"getValues\":[64],\"isValid\":[64]}],[4,\"salla-modal\",{\"isClosable\":[1028,\"is-closable\"],\"width\":[513],\"position\":[513],\"visible\":[516],\"hasSkeleton\":[516,\"has-skeleton\"],\"isLoading\":[1540,\"is-loading\"],\"subTitleFirst\":[4,\"sub-title-first\"],\"noPadding\":[4,\"no-padding\"],\"subTitle\":[1,\"sub-title\"],\"centered\":[4],\"iconStyle\":[1,\"icon-style\"],\"modalTitle\":[32],\"open\":[64],\"close\":[64],\"setTitle\":[64],\"loading\":[64],\"stopLoading\":[64]},[[0,\"keyup\",\"handleKeyUp\"]]],[0,\"salla-loading\",{\"size\":[8],\"width\":[8],\"color\":[1],\"bgColor\":[1,\"bg-color\"]}],[4,\"salla-button\",{\"shape\":[513],\"color\":[513],\"fill\":[513],\"size\":[513],\"width\":[513],\"loading\":[516],\"disabled\":[516],\"loaderPosition\":[1,\"loader-position\"],\"href\":[1],\"load\":[64],\"stop\":[64],\"setText\":[64],\"disable\":[64],\"enable\":[64]}]]],[\"salla-products-slider.cjs\",[[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\"],\"limit\":[1026],\"autoplay\":[1028],\"productsData\":[32],\"isReady\":[32],\"sourceValueIsValid\":[32],\"hasCustomComponent\":[32],\"apiUrl\":[32],\"parsedSourceValue\":[32]}]]],[\"salla-product-options.cjs\",[[0,\"salla-product-options\",{\"productId\":[2,\"product-id\"],\"options\":[1],\"optionsData\":[32],\"outOfStockText\":[32],\"donationAmount\":[32],\"selectedOptions\":[32],\"canDisabled\":[32],\"selectedSkus\":[32],\"selectedOutSkus\":[32],\"getSelectedOptionsData\":[64],\"reportValidity\":[64],\"hasOutOfStockOption\":[64],\"getSelectedOptions\":[64],\"getOption\":[64]}]]],[\"salla-filters.cjs\",[[0,\"salla-filters\",{\"filters\":[1040],\"isSidebarOpen\":[32],\"filtersData\":[32],\"apply\":[32],\"reset\":[32],\"getFilters\":[64],\"applyFilters\":[64],\"resetFilters\":[64]}]]],[\"salla-comment-form.cjs\",[[0,\"salla-comment-form\",{\"type\":[1537],\"showAvatar\":[4,\"show-avatar\"],\"itemId\":[1544,\"item-id\"],\"placeholder\":[32],\"submitText\":[32],\"canComment\":[32]}]]],[\"salla-installment.cjs\",[[0,\"salla-installment\",{\"price\":[1],\"language\":[1],\"currency\":[1],\"tamaraIsActive\":[32],\"tabbyIsActive\":[32],\"spotiiIsActive\":[32]}]]],[\"salla-loyalty-prize-item.cjs\",[[0,\"salla-loyalty-prize-item\",{\"item\":[16]}]]],[\"salla-products-list.cjs\",[[0,\"salla-products-list\",{\"source\":[1537],\"sourceValue\":[1032,\"source-value\"],\"limit\":[1026],\"sortBy\":[1025,\"sort-by\"],\"filtersResults\":[1540,\"filters-results\"],\"horizontalCards\":[516,\"horizontal-cards\"],\"page\":[32],\"nextPage\":[32],\"hasInfiniteScroll\":[32],\"hasCustomComponent\":[32],\"sourceValueIsValid\":[32],\"placeholderText\":[32],\"isReady\":[32],\"showPlaceholder\":[32],\"parsedFilters\":[32],\"setFilters\":[64],\"reload\":[64]}]]],[\"salla-price-range.cjs\",[[0,\"salla-price-range\",{\"minPrice\":[1032,\"min-price\"],\"maxPrice\":[1032,\"max-price\"],\"option\":[16],\"filtersData\":[520,\"filters-data\"],\"min\":[32],\"max\":[32],\"priceOptions\":[32],\"moreThanLabel\":[32],\"lessThanLabel\":[32],\"toLabel\":[32],\"fromLabel\":[32],\"reset\":[64]}]]],[\"salla-filters-widget.cjs\",[[4,\"salla-filters-widget\",{\"widgetTitle\":[1025,\"widget-title\"],\"withLoadMore\":[1028,\"with-load-more\"],\"filtersData\":[16],\"option\":[16],\"isOpen\":[32],\"isShowMore\":[32],\"showMoreLabel\":[32],\"showLessLabel\":[32],\"reset\":[64],\"showMore\":[64],\"toggleWidget\":[64]}]]],[\"salla-conditional-fields.cjs\",[[4,\"salla-conditional-fields\",null,[[0,\"change\",\"changeHandler\"]]]]]]"), options);
|
|
29
|
+
return index.bootstrapLazy(JSON.parse("[[\"salla-add-product-button_40.cjs\",[[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\",{\"cartItemId\":[8,\"cart-item-id\"],\"quantity\":[32],\"fireChangeEvent\":[32],\"decrease\":[64],\"increase\":[64],\"setValue\":[64]}],[4,\"salla-user-menu\",{\"inline\":[516],\"avatarOnly\":[516,\"avatar-only\"],\"showHeader\":[516,\"show-header\"],\"relativeDropdown\":[516,\"relative-dropdown\"],\"accountLoading\":[32],\"opened\":[32],\"notifications\":[32],\"orders\":[32],\"pending_orders\":[32],\"wishlist\":[32],\"profile\":[32],\"rating\":[32],\"logout\":[32],\"hello\":[32],\"first_name\":[32],\"last_name\":[32],\"avatar\":[32],\"is_loggedIn\":[32],\"badges\":[32],\"hasBadges\":[32],\"OrderUpdate\":[32]}],[4,\"salla-product-card\",{\"product\":[1],\"horizontal\":[4],\"shadowOnHover\":[4,\"shadow-on-hover\"],\"hideAddBtn\":[4,\"hide-add-btn\"],\"fullImage\":[4,\"full-image\"],\"minimal\":[4],\"isSpecial\":[4,\"is-special\"],\"showQuantity\":[4,\"show-quantity\"],\"productData\":[32],\"fitImageHeight\":[32],\"remained\":[32],\"outOfStock\":[32],\"donationAmount\":[32],\"startingPrice\":[32],\"addToCart\":[32],\"placeholder\":[32]}],[4,\"salla-map\",{\"name\":[1],\"required\":[4],\"readonly\":[4],\"searchable\":[1028],\"lat\":[1026],\"lng\":[1026],\"apiKey\":[1025,\"api-key\"],\"modalTitle\":[1,\"modal-title\"],\"zoom\":[1026],\"theme\":[1025],\"modalActivityTitle\":[32],\"confirmButtonTitle\":[32],\"locateButtonTitle\":[32],\"locateButtonEdit\":[32],\"searchPlaceholder\":[32],\"searchInputValue\":[32],\"formattedAddress\":[32],\"geolocationError\":[32],\"searchInput\":[32],\"mapInput\":[32],\"mapElement\":[32],\"selectedLat\":[32],\"selectedLng\":[32],\"open\":[64]}],[4,\"salla-verify\",{\"display\":[1],\"type\":[1025],\"autoReload\":[4,\"auto-reload\"],\"supportWebAuth\":[4,\"support-web-auth\"],\"translationLoaded\":[32],\"title\":[32],\"resendAfter\":[32],\"isProfileVerify\":[32],\"getCode\":[64],\"open\":[64]}],[4,\"salla-color-picker\",{\"name\":[1],\"required\":[4],\"color\":[1537],\"format\":[1],\"showCancelButton\":[4,\"show-cancel-button\"],\"showTextField\":[4,\"show-text-field\"],\"enableAlpha\":[4,\"enable-alpha\"],\"widgetColor\":[32],\"setPickerOption\":[64],\"movePopUp\":[64],\"setColorValue\":[64],\"openPicker\":[64],\"closePicker\":[64],\"destroyPicker\":[64]}],[4,\"salla-add-product-button\",{\"channels\":[513],\"subscribedOptions\":[1,\"subscribed-options\"],\"quickBuy\":[1540,\"quick-buy\"],\"quantity\":[514],\"donatingAmount\":[514,\"donating-amount\"],\"notifyOptionsAvailability\":[516,\"notify-options-availability\"],\"productId\":[520,\"product-id\"],\"supportStickyBar\":[516,\"support-sticky-bar\"],\"productStatus\":[513,\"product-status\"],\"productType\":[513,\"product-type\"],\"hasOutOfStockOption\":[32],\"hasSubscribedOptions\":[32],\"selectedOptions\":[32],\"showQuickBuy\":[32]}],[0,\"salla-count-down\",{\"date\":[1],\"boxed\":[4],\"size\":[1],\"color\":[1],\"labeled\":[4],\"endText\":[1,\"end-text\"],\"digits\":[1],\"endOfDay\":[4,\"end-of-day\"],\"daysLabel\":[32],\"hoursLabel\":[32],\"minutesLabel\":[32],\"secondsLabel\":[32],\"endLabel\":[32],\"invalidDate\":[32],\"offerEnded\":[32],\"countInterval\":[32],\"days\":[32],\"hours\":[32],\"minutes\":[32],\"seconds\":[32],\"endCountDown\":[64]}],[0,\"salla-datetime-picker\",{\"value\":[1537],\"required\":[4],\"name\":[513],\"placeholder\":[1],\"allowInput\":[4,\"allow-input\"],\"allowInvalidPreload\":[4,\"allow-invalid-preload\"],\"altFormat\":[1,\"alt-format\"],\"altInput\":[4,\"alt-input\"],\"altInputClass\":[1,\"alt-input-class\"],\"appendTo\":[16],\"ariaDateFormat\":[1,\"aria-date-format\"],\"autoFillDefaultTime\":[4,\"auto-fill-default-time\"],\"clickOpens\":[4,\"click-opens\"],\"closeOnSelect\":[4,\"close-on-select\"],\"conjunction\":[1],\"dateFormat\":[1,\"date-format\"],\"defaultDate\":[8,\"default-date\"],\"defaultHour\":[2,\"default-hour\"],\"defaultMinute\":[2,\"default-minute\"],\"defaultSeconds\":[2,\"default-seconds\"],\"disable\":[16],\"disableMobile\":[4,\"disable-mobile\"],\"enable\":[16],\"enableSeconds\":[4,\"enable-seconds\"],\"enableTime\":[4,\"enable-time\"],\"formatDate\":[16],\"hourIncrement\":[2,\"hour-increment\"],\"inline\":[4],\"locale\":[1],\"maxDate\":[8,\"max-date\"],\"maxTime\":[8,\"max-time\"],\"minDate\":[8,\"min-date\"],\"minTime\":[8,\"min-time\"],\"minuteIncrement\":[2,\"minute-increment\"],\"mode\":[1],\"monthSelectorType\":[1,\"month-selector-type\"],\"nextArrow\":[1,\"next-arrow\"],\"noCalendar\":[4,\"no-calendar\"],\"dateParser\":[16],\"position\":[1],\"positionElement\":[16],\"prevArrow\":[1,\"prev-arrow\"],\"shorthandCurrentMonth\":[4,\"shorthand-current-month\"],\"static\":[4],\"showMonths\":[2,\"show-months\"],\"time_24hr\":[4,\"time_-2-4hr\"],\"weekNumbers\":[4,\"week-numbers\"],\"wrap\":[4]}],[4,\"salla-tab-content\",{\"name\":[1],\"isSelected\":[32],\"getChild\":[64]}],[4,\"salla-tab-header\",{\"name\":[1],\"activeClass\":[1,\"active-class\"],\"height\":[8],\"centered\":[4],\"isSelected\":[32],\"getChild\":[64]}],[4,\"salla-tabs\",{\"backgroundColor\":[1,\"background-color\"],\"vertical\":[4]},[[0,\"tabSelected\",\"onSelectedTab\"]]],[0,\"salla-product-availability\",{\"channels\":[1],\"notifyOptionsAvailability\":[4,\"notify-options-availability\"],\"productId\":[2,\"product-id\"],\"isSubscribed\":[1028,\"is-subscribed\"],\"translationLoaded\":[32],\"title_\":[32],\"isVisitorSubscribed\":[32]}],[0,\"salla-quick-buy\",{\"type\":[1025],\"productId\":[1025,\"product-id\"],\"amount\":[1538],\"currency\":[1025],\"options\":[16],\"isRequireShipping\":[1028,\"is-require-shipping\"],\"isApplePayActive\":[32],\"quickBuy\":[32]}],[0,\"salla-file-upload\",{\"value\":[1537],\"files\":[513],\"height\":[513],\"cartItemId\":[1,\"cart-item-id\"],\"profileImage\":[516,\"profile-image\"],\"name\":[1537],\"payloadName\":[1,\"payload-name\"],\"accept\":[1537],\"fileId\":[2,\"file-id\"],\"url\":[1025],\"method\":[1],\"formData\":[1,\"form-data\"],\"required\":[4],\"maxFileSize\":[1,\"max-file-size\"],\"disabled\":[4],\"allowDrop\":[4,\"allow-drop\"],\"allowBrowse\":[4,\"allow-browse\"],\"allowPaste\":[4,\"allow-paste\"],\"allowMultiple\":[4,\"allow-multiple\"],\"allowReplace\":[4,\"allow-replace\"],\"allowRevert\":[4,\"allow-revert\"],\"allowRemove\":[4,\"allow-remove\"],\"allowProcess\":[4,\"allow-process\"],\"allowReorder\":[4,\"allow-reorder\"],\"storeAsFile\":[4,\"store-as-file\"],\"forceRevert\":[4,\"force-revert\"],\"maxFilesCount\":[2,\"max-files-count\"],\"maxParallelUploads\":[2,\"max-parallel-uploads\"],\"checkValidity\":[4,\"check-validity\"],\"itemInsertLocation\":[1,\"item-insert-location\"],\"itemInsertInterval\":[2,\"item-insert-interval\"],\"credits\":[4],\"dropOnPage\":[4,\"drop-on-page\"],\"dropOnElement\":[4,\"drop-on-element\"],\"dropValidation\":[4,\"drop-validation\"],\"ignoredFiles\":[16],\"instantUpload\":[1028,\"instant-upload\"],\"chunkUploads\":[4,\"chunk-uploads\"],\"chunkForce\":[4,\"chunk-force\"],\"chunkSize\":[2,\"chunk-size\"],\"chunkRetryDelays\":[16],\"labelDecimalSeparator\":[1,\"label-decimal-separator\"],\"labelThousandsSeparator\":[1,\"label-thousands-separator\"],\"labelIdle\":[1025,\"label-idle\"],\"iconRemove\":[1,\"icon-remove\"],\"iconProcess\":[1,\"icon-process\"],\"iconRetry\":[1,\"icon-retry\"],\"iconUndo\":[1,\"icon-undo\"],\"setOption\":[64]}],[0,\"salla-progress-bar\",{\"donation\":[1],\"target\":[1026],\"value\":[1026],\"height\":[1025],\"header\":[1025],\"stripped\":[1028],\"message\":[1025],\"unit\":[1025],\"color\":[1025]}],[0,\"salla-rating-stars\",{\"name\":[1],\"size\":[1],\"value\":[2],\"reviews\":[2]}],[4,\"salla-list-tile\",{\"href\":[1],\"target\":[1]}],[4,\"salla-slider\",{\"blockTitle\":[513,\"block-title\"],\"listenToThumbnailsOption\":[516,\"listen-to-thumbnails-option\"],\"blockSubtitle\":[513,\"block-subtitle\"],\"displayAllUrl\":[513,\"display-all-url\"],\"arrowsCentered\":[516,\"arrows-centered\"],\"verticalThumbs\":[516,\"vertical-thumbs\"],\"gridThumbs\":[516,\"grid-thumbs\"],\"vertical\":[516],\"autoHeight\":[516,\"auto-height\"],\"showControls\":[516,\"show-controls\"],\"controlsOuter\":[516,\"controls-outer\"],\"showThumbsControls\":[4,\"show-thumbs-controls\"],\"autoPlay\":[4,\"auto-play\"],\"slidesPerView\":[1,\"slides-per-view\"],\"pagination\":[4],\"centered\":[4],\"loop\":[4],\"direction\":[1537],\"type\":[1],\"sliderConfig\":[520,\"slider-config\"],\"thumbsConfig\":[520,\"thumbs-config\"],\"currentIndex\":[32],\"isEnd\":[32],\"isBeginning\":[32],\"swiperScript\":[32],\"displayAllTitle\":[32],\"slideTo\":[64],\"slideNext\":[64],\"slidePrev\":[64],\"slideToLoop\":[64],\"slideNextLoop\":[64],\"slidePrevLoop\":[64],\"slideReset\":[64],\"slideToClosest\":[64],\"update\":[64],\"updateAutoHeight\":[64],\"updateSlides\":[64],\"updateProgress\":[64],\"updateSlidesClasses\":[64],\"getSlides\":[64]}],[4,\"salla-placeholder\",{\"icon\":[1],\"alignment\":[1],\"iconSize\":[1,\"icon-size\"],\"translationLoaded\":[32]}],[0,\"salla-skeleton\",{\"type\":[1],\"width\":[1],\"height\":[1]}],[0,\"salla-tel-input\",{\"phone\":[1025],\"name\":[1],\"countryCode\":[1025,\"country-code\"],\"mobileRequired\":[32],\"countryCodeLabel\":[32],\"mobileLabel\":[32],\"tooShort\":[32],\"tooLong\":[32],\"invalidCountryCode\":[32],\"invalidNumber\":[32],\"errorMap\":[32],\"getValues\":[64],\"isValid\":[64]}],[4,\"salla-modal\",{\"isClosable\":[1028,\"is-closable\"],\"width\":[513],\"position\":[513],\"visible\":[516],\"hasSkeleton\":[516,\"has-skeleton\"],\"isLoading\":[1540,\"is-loading\"],\"subTitleFirst\":[4,\"sub-title-first\"],\"noPadding\":[4,\"no-padding\"],\"subTitle\":[1,\"sub-title\"],\"centered\":[4],\"iconStyle\":[1,\"icon-style\"],\"modalTitle\":[32],\"open\":[64],\"close\":[64],\"setTitle\":[64],\"loading\":[64],\"stopLoading\":[64]},[[0,\"keyup\",\"handleKeyUp\"]]],[0,\"salla-loading\",{\"size\":[8],\"width\":[8],\"color\":[1],\"bgColor\":[1,\"bg-color\"]}],[4,\"salla-button\",{\"shape\":[513],\"color\":[513],\"fill\":[513],\"size\":[513],\"width\":[513],\"loading\":[516],\"disabled\":[516],\"loaderPosition\":[1,\"loader-position\"],\"href\":[1],\"load\":[64],\"stop\":[64],\"setText\":[64],\"disable\":[64],\"enable\":[64]}]]],[\"salla-products-slider.cjs\",[[0,\"salla-products-slider\",{\"blockTitle\":[1,\"block-title\"],\"subTitle\":[1,\"sub-title\"],\"sliderId\":[1,\"slider-id\"],\"displayAllUrl\":[1,\"display-all-url\"],\"autoplay\":[1028],\"source\":[1537],\"sourceValue\":[1,\"source-value\"],\"limit\":[1026],\"productsData\":[32],\"isReady\":[32],\"sourceValueIsValid\":[32],\"hasCustomComponent\":[32],\"apiUrl\":[32],\"parsedSourceValue\":[32]}]]],[\"salla-product-options.cjs\",[[0,\"salla-product-options\",{\"productId\":[2,\"product-id\"],\"options\":[1],\"optionsData\":[32],\"outOfStockText\":[32],\"donationAmount\":[32],\"selectedOptions\":[32],\"canDisabled\":[32],\"selectedSkus\":[32],\"selectedOutSkus\":[32],\"getSelectedOptionsData\":[64],\"reportValidity\":[64],\"hasOutOfStockOption\":[64],\"getSelectedOptions\":[64],\"getOption\":[64]}]]],[\"salla-filters.cjs\",[[0,\"salla-filters\",{\"filters\":[1040],\"isSidebarOpen\":[32],\"filtersData\":[32],\"apply\":[32],\"reset\":[32],\"getFilters\":[64],\"applyFilters\":[64],\"resetFilters\":[64]}]]],[\"salla-comment-form.cjs\",[[0,\"salla-comment-form\",{\"type\":[1537],\"showAvatar\":[4,\"show-avatar\"],\"itemId\":[1544,\"item-id\"],\"placeholder\":[32],\"submitText\":[32],\"canComment\":[32]}]]],[\"salla-installment.cjs\",[[0,\"salla-installment\",{\"price\":[1],\"language\":[1],\"currency\":[1],\"tamaraIsActive\":[32],\"tabbyIsActive\":[32],\"spotiiIsActive\":[32]}]]],[\"salla-loyalty-prize-item.cjs\",[[0,\"salla-loyalty-prize-item\",{\"item\":[16]}]]],[\"salla-products-list.cjs\",[[0,\"salla-products-list\",{\"source\":[1537],\"sourceValue\":[1032,\"source-value\"],\"limit\":[1026],\"sortBy\":[1025,\"sort-by\"],\"filtersResults\":[1540,\"filters-results\"],\"horizontalCards\":[516,\"horizontal-cards\"],\"page\":[32],\"nextPage\":[32],\"hasInfiniteScroll\":[32],\"hasCustomComponent\":[32],\"sourceValueIsValid\":[32],\"placeholderText\":[32],\"isReady\":[32],\"showPlaceholder\":[32],\"parsedFilters\":[32],\"setFilters\":[64],\"reload\":[64]}]]],[\"salla-price-range.cjs\",[[0,\"salla-price-range\",{\"minPrice\":[1032,\"min-price\"],\"maxPrice\":[1032,\"max-price\"],\"option\":[16],\"filtersData\":[520,\"filters-data\"],\"min\":[32],\"max\":[32],\"priceOptions\":[32],\"moreThanLabel\":[32],\"lessThanLabel\":[32],\"toLabel\":[32],\"fromLabel\":[32],\"reset\":[64]}]]],[\"salla-filters-widget.cjs\",[[4,\"salla-filters-widget\",{\"widgetTitle\":[1025,\"widget-title\"],\"withLoadMore\":[1028,\"with-load-more\"],\"filtersData\":[16],\"option\":[16],\"isOpen\":[32],\"isShowMore\":[32],\"showMoreLabel\":[32],\"showLessLabel\":[32],\"reset\":[64],\"showMore\":[64],\"toggleWidget\":[64]}]]],[\"salla-conditional-fields.cjs\",[[4,\"salla-conditional-fields\",null,[[0,\"change\",\"changeHandler\"]]]]]]"), options);
|
|
30
30
|
});
|
|
31
31
|
|
|
32
32
|
exports.setNonce = index.setNonce;
|
|
@@ -31,6 +31,53 @@ class Helper {
|
|
|
31
31
|
//@ts-ignore
|
|
32
32
|
return this.debounce_(fn, ...data);
|
|
33
33
|
}
|
|
34
|
+
getProductsSource(source) {
|
|
35
|
+
return {
|
|
36
|
+
'brands.single': 'brands',
|
|
37
|
+
'product.index': 'categories',
|
|
38
|
+
'product.index.latest': 'latest',
|
|
39
|
+
'product.index.offers': 'offers',
|
|
40
|
+
'product.index.search': 'search',
|
|
41
|
+
'landing-page': 'landing-page',
|
|
42
|
+
'product.index.tag': 'tags',
|
|
43
|
+
'product.index.sales': 'sales',
|
|
44
|
+
'components.most_sales_products': 'sales', //temporary, delete it after two days from now
|
|
45
|
+
}[source || salla.config.get('page.slug')] || source || 'latest';
|
|
46
|
+
}
|
|
47
|
+
getProductsSourceValue(source, sourceValue) {
|
|
48
|
+
const parsedSource = this.getProductsSource(source);
|
|
49
|
+
// Validate if the source value is a valid JSON string
|
|
50
|
+
let parsedSourceValue = null;
|
|
51
|
+
if (sourceValue) {
|
|
52
|
+
try {
|
|
53
|
+
parsedSourceValue = JSON.parse(sourceValue);
|
|
54
|
+
}
|
|
55
|
+
catch (error) {
|
|
56
|
+
console.error('Invalid JSON string in sourceValue:', error);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
// Handle different source types
|
|
60
|
+
if (!['search', 'json', 'offers', 'latest', 'sales', 'related'].includes(parsedSource)) {
|
|
61
|
+
if (Array.isArray(parsedSourceValue) && parsedSourceValue.length) {
|
|
62
|
+
return parsedSourceValue;
|
|
63
|
+
}
|
|
64
|
+
if (typeof parsedSourceValue === 'number') {
|
|
65
|
+
return [parsedSourceValue];
|
|
66
|
+
}
|
|
67
|
+
if (!sourceValue && ['categories', 'tags', 'brands'].includes(source)) {
|
|
68
|
+
return [salla.config.get('page.id')];
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
// Return sourceValue if it exists and is a valid JSON object/array
|
|
72
|
+
if (parsedSourceValue || sourceValue) {
|
|
73
|
+
return parsedSourceValue || sourceValue;
|
|
74
|
+
}
|
|
75
|
+
if (parsedSource === 'search') {
|
|
76
|
+
return new URLSearchParams(window.location.search).get('q') || '';
|
|
77
|
+
}
|
|
78
|
+
// Return page id as default value
|
|
79
|
+
return salla.config.get('page.id');
|
|
80
|
+
}
|
|
34
81
|
}
|
|
35
82
|
export default new Helper;
|
|
36
83
|
//# sourceMappingURL=Helper.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Helper.js","sourceRoot":"","sources":["../../src/Helpers/Helper.ts"],"names":[],"mappings":"AAAA,uBAAuB;AACvB,KAAK,CAAC,KAAK,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC;AAEjC,MAAM,MAAM;EAGV,oBAAoB,CAAC,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ;IACxD,QAAQ,GAAG,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACpE,QAAQ,GAAG,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACpE,IAAI,UAAU,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAC;IACnC,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,SAAS,CAAC,MAAM,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC;IACjE,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC;IAC9D,OAAO,IAAI,CAAC;EACd,CAAC;EAED,aAAa,CAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ;IAClD,QAAQ,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,IAAI,CAAC,oBAAoB,CAAC,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC;IACzH,OAAO,IAAI,CAAC;EACd,CAAC;EAED,YAAY,CAAC,KAAK;IAChB,MAAM,EAAE,GAAG,uJAAuJ,CAAC;IACnK,OAAO,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC;EAC9C,CAAC;EAED,aAAa,CAAC,IAAI;IAChB,IAAI,eAAe,GAAG,gmBAAgmB,CAAC;IACvnB,OAAO,IAAI,CAAC,OAAO,CAAC,eAAe,EAAE,EAAE,CAAC,CAAC;EAC3C,CAAC;EAED,QAAQ,CAAC,EAAE,EAAE,GAAG,IAAI;IAClB,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE;MACnB,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,QAAQ,EAAE,GAAG,SAAS,EAAE,EAAE,CAAC,QAAQ,CAAC,GAAG,SAAS,CAAC,EAAE,GAAG,CAAC,CAAC;KAClG;IACD,YAAY;IACZ,OAAO,IAAI,CAAC,SAAS,CAAC,EAAE,EAAE,GAAG,IAAI,CAAC,CAAC;EACrC,CAAC;CACF;AAED,eAAe,IAAI,MAAM,CAAC","sourcesContent":["//TODO::reduce it to 10\nsalla.event.setMaxListeners(100);\n\nclass Helper {\n private debounce_: Boolean;\n\n toggleElementClassIf(element, classes1, classes2, callback) {\n classes1 = Array.isArray(classes1) ? classes1 : classes1.split(' ');\n classes2 = Array.isArray(classes2) ? classes2 : classes2.split(' ');\n let isClasses1 = callback(element);\n element?.classList.remove(...(isClasses1 ? classes2 : classes1));\n element?.classList.add(...(isClasses1 ? classes1 : classes2));\n return this;\n }\n\n toggleClassIf(selector, classes1, classes2, callback) {\n document.querySelectorAll(selector).forEach(element => this.toggleElementClassIf(element, classes1, classes2, callback));\n return this;\n }\n\n isValidEmail(email) {\n const re = /^(([^<>()[\\]\\\\.,;:\\s@\"]+(\\.[^<>()[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/;\n return re.test(String(email).toLowerCase());\n }\n\n filterEmojies(text) {\n var characterFilter = /(?:[\\u2700-\\u27bf]|(?:\\ud83c[\\udde6-\\uddff]){2}|[\\ud800-\\udbff][\\udc00-\\udfff]|[\\u0023-\\u0039]\\ufe0f?\\u20e3|\\u3299|\\u3297|\\u303d|\\u3030|\\u24c2|\\ud83c[\\udd70-\\udd71]|\\ud83c[\\udd7e-\\udd7f]|\\ud83c\\udd8e|\\ud83c[\\udd91-\\udd9a]|\\ud83c[\\udde6-\\uddff]|\\ud83c[\\ude01-\\ude02]|\\ud83c\\ude1a|\\ud83c\\ude2f|\\ud83c[\\ude32-\\ude3a]|\\ud83c[\\ude50-\\ude51]|\\u203c|\\u2049|[\\u25aa-\\u25ab]|\\u25b6|\\u25c0|[\\u25fb-\\u25fe]|\\u00a9|\\u00ae|\\u2122|\\u2139|\\ud83c\\udc04|[\\u2600-\\u26FF]|\\u2b05|\\u2b06|\\u2b07|\\u2b1b|\\u2b1c|\\u2b50|\\u2b55|\\u231a|\\u231b|\\u2328|\\u23cf|[\\u23e9-\\u23f3]|[\\u23f8-\\u23fa]|\\ud83c\\udccf|\\u2934|\\u2935|[\\u2190-\\u21ff])/g;\n return text.replace(characterFilter, \"\");\n }\n\n debounce(fn, ...data) {\n if (!this.debounce_) {\n this.debounce_ = salla.helpers.debounce((callback, ...innerData) => callback(...innerData), 500);\n }\n //@ts-ignore\n return this.debounce_(fn, ...data);\n }\n}\n\nexport default new Helper;\n"]}
|
|
1
|
+
{"version":3,"file":"Helper.js","sourceRoot":"","sources":["../../src/Helpers/Helper.ts"],"names":[],"mappings":"AAAA,uBAAuB;AACvB,KAAK,CAAC,KAAK,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC;AAEjC,MAAM,MAAM;EAGV,oBAAoB,CAAC,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ;IACxD,QAAQ,GAAG,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACpE,QAAQ,GAAG,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACpE,IAAI,UAAU,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAC;IACnC,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,SAAS,CAAC,MAAM,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC;IACjE,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC;IAC9D,OAAO,IAAI,CAAC;EACd,CAAC;EAED,aAAa,CAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ;IAClD,QAAQ,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC,OAAO,CA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AAC,SAAS,CAAC,CAAC;EACrC,CAAC;CACF;AAED,eAAe,IAAI,MAAM,CAAC","sourcesContent":["//TODO::reduce it to 10\nsalla.event.setMaxListeners(100);\n\nclass Helper {\n private debounce_: Boolean;\n\n toggleElementClassIf(element, classes1, classes2, callback) {\n classes1 = Array.isArray(classes1) ? classes1 : classes1.split(' ');\n classes2 = Array.isArray(classes2) ? classes2 : classes2.split(' ');\n let isClasses1 = callback(element);\n element?.classList.remove(...(isClasses1 ? classes2 : classes1));\n element?.classList.add(...(isClasses1 ? classes1 : classes2));\n return this;\n }\n\n toggleClassIf(selector, classes1, classes2, callback) {\n document.querySelectorAll(selector).forEach(element => this.toggleElementClassIf(element, classes1, classes2, callback));\n return this;\n }\n\n isValidEmail(email) {\n const re = /^(([^<>()[\\]\\\\.,;:\\s@\"]+(\\.[^<>()[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/;\n return re.test(String(email).toLowerCase());\n }\n\n filterEmojies(text) {\n var characterFilter = /(?:[\\u2700-\\u27bf]|(?:\\ud83c[\\udde6-\\uddff]){2}|[\\ud800-\\udbff][\\udc00-\\udfff]|[\\u0023-\\u0039]\\ufe0f?\\u20e3|\\u3299|\\u3297|\\u303d|\\u3030|\\u24c2|\\ud83c[\\udd70-\\udd71]|\\ud83c[\\udd7e-\\udd7f]|\\ud83c\\udd8e|\\ud83c[\\udd91-\\udd9a]|\\ud83c[\\udde6-\\uddff]|\\ud83c[\\ude01-\\ude02]|\\ud83c\\ude1a|\\ud83c\\ude2f|\\ud83c[\\ude32-\\ude3a]|\\ud83c[\\ude50-\\ude51]|\\u203c|\\u2049|[\\u25aa-\\u25ab]|\\u25b6|\\u25c0|[\\u25fb-\\u25fe]|\\u00a9|\\u00ae|\\u2122|\\u2139|\\ud83c\\udc04|[\\u2600-\\u26FF]|\\u2b05|\\u2b06|\\u2b07|\\u2b1b|\\u2b1c|\\u2b50|\\u2b55|\\u231a|\\u231b|\\u2328|\\u23cf|[\\u23e9-\\u23f3]|[\\u23f8-\\u23fa]|\\ud83c\\udccf|\\u2934|\\u2935|[\\u2190-\\u21ff])/g;\n return text.replace(characterFilter, \"\");\n }\n\n debounce(fn, ...data) {\n if (!this.debounce_) {\n this.debounce_ = salla.helpers.debounce((callback, ...innerData) => callback(...innerData), 500);\n }\n //@ts-ignore\n return this.debounce_(fn, ...data);\n }\n\n getProductsSource(source) {\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 }[source || salla.config.get('page.slug')] || source || 'latest';\n }\n\n getProductsSourceValue(source, sourceValue) {\n const parsedSource = this.getProductsSource(source);\n\n // Validate if the source value is a valid JSON string\n let parsedSourceValue: any = null;\n if (sourceValue) {\n try {\n parsedSourceValue = JSON.parse(sourceValue);\n } catch (error) {\n console.error('Invalid JSON string in sourceValue:', error);\n }\n }\n\n // Handle different source types\n if (!['search', 'json', 'offers', 'latest', 'sales', 'related'].includes(parsedSource)) {\n\n if (Array.isArray(parsedSourceValue) && parsedSourceValue.length) {\n return parsedSourceValue;\n }\n\n if (typeof parsedSourceValue === 'number') {\n return [parsedSourceValue];\n }\n\n if (!sourceValue && ['categories', 'tags', 'brands'].includes(source)) {\n return [salla.config.get('page.id')];\n }\n }\n\n // Return sourceValue if it exists and is a valid JSON object/array\n if (parsedSourceValue || sourceValue) {\n return parsedSourceValue || sourceValue;\n }\n\n if (parsedSource === 'search') {\n return new URLSearchParams(window.location.search).get('q') || '';\n }\n\n // Return page id as default value\n return salla.config.get('page.id');\n }\n}\n\nexport default new Helper;\n"]}
|