@salla.sa/twilight-components 2.12.69 → 2.12.71
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/app-globals-36ab7ecf.js.map +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/salla-add-product-button_47.cjs.entry.js +9 -1
- package/dist/cjs/salla-add-product-button_47.cjs.entry.js.map +1 -1
- package/dist/cjs/salla-filters.cjs.entry.js +96 -3
- package/dist/cjs/salla-filters.cjs.entry.js.map +1 -1
- package/dist/cjs/twilight.cjs.js +1 -1
- package/dist/collection/components/salla-bottom-alert/salla-bottom-alert.js +12 -2
- package/dist/collection/components/salla-bottom-alert/salla-bottom-alert.js.map +1 -1
- package/dist/collection/components/salla-filters/salla-filters.js +96 -3
- package/dist/collection/components/salla-filters/salla-filters.js.map +1 -1
- package/dist/components/index.js.map +1 -1
- package/dist/components/salla-bottom-alert.js +12 -2
- package/dist/components/salla-bottom-alert.js.map +1 -1
- package/dist/components/salla-filters.js +96 -3
- package/dist/components/salla-filters.js.map +1 -1
- package/dist/esm/app-globals-3843d7b4.js.map +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/salla-add-product-button_47.entry.js +9 -1
- package/dist/esm/salla-add-product-button_47.entry.js.map +1 -1
- package/dist/esm/salla-filters.entry.js +96 -3
- package/dist/esm/salla-filters.entry.js.map +1 -1
- package/dist/esm/twilight.js +1 -1
- package/dist/esm-es5/app-globals-3843d7b4.js.map +1 -1
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/loader.js.map +1 -1
- package/dist/esm-es5/salla-add-product-button_47.entry.js +1 -1
- package/dist/esm-es5/salla-add-product-button_47.entry.js.map +1 -1
- package/dist/esm-es5/salla-filters.entry.js +2 -2
- package/dist/esm-es5/salla-filters.entry.js.map +1 -1
- package/dist/esm-es5/twilight.js +1 -1
- package/dist/esm-es5/twilight.js.map +1 -1
- package/dist/twilight/p-2059b78a.system.js +1 -1
- package/dist/twilight/p-2059b78a.system.js.map +1 -1
- package/dist/twilight/{p-ce2fd4cc.entry.js → p-29f9af2d.entry.js} +2 -2
- package/dist/twilight/p-29f9af2d.entry.js.map +1 -0
- package/dist/twilight/p-412d8d1c.entry.js +5 -0
- package/dist/twilight/p-412d8d1c.entry.js.map +1 -0
- package/dist/twilight/{p-17637111.system.entry.js → p-5bf1cc00.system.entry.js} +2 -2
- package/dist/twilight/p-5bf1cc00.system.entry.js.map +1 -0
- package/dist/twilight/p-66395721.js.map +1 -1
- package/dist/twilight/p-75f5e4ac.system.js.map +1 -1
- package/dist/twilight/p-d3520da5.system.entry.js +5 -0
- package/dist/twilight/p-d3520da5.system.entry.js.map +1 -0
- package/dist/twilight/twilight.esm.js +1 -1
- package/dist/twilight/twilight.esm.js.map +1 -1
- package/dist/types/components/salla-bottom-alert/salla-bottom-alert.d.ts +3 -0
- package/dist/types/components/salla-filters/salla-filters.d.ts +4 -0
- package/package.json +5 -5
- package/dist/twilight/p-17637111.system.entry.js.map +0 -1
- package/dist/twilight/p-2ad1baef.entry.js +0 -5
- package/dist/twilight/p-2ad1baef.entry.js.map +0 -1
- package/dist/twilight/p-ce2fd4cc.entry.js.map +0 -1
- package/dist/twilight/p-d236e332.system.entry.js +0 -5
- package/dist/twilight/p-d236e332.system.entry.js.map +0 -1
|
@@ -56,13 +56,63 @@ const SallaFilters = class {
|
|
|
56
56
|
}
|
|
57
57
|
connectedCallback() {
|
|
58
58
|
try {
|
|
59
|
-
|
|
60
|
-
|
|
59
|
+
const searchParams = new URLSearchParams(window.location.search);
|
|
60
|
+
const filterObject = {};
|
|
61
|
+
for (const [key, value] of searchParams.entries()) {
|
|
62
|
+
const keys = key.replace(/\]/g, '').split('[');
|
|
63
|
+
keys.reduce((obj, keyPart, index, array) => {
|
|
64
|
+
const isLastKey = index === array.length - 1;
|
|
65
|
+
const finalKey = /^\d+$/.test(keyPart) ? parseInt(keyPart, 10) : keyPart;
|
|
66
|
+
if (isLastKey) {
|
|
67
|
+
if (/^\d+$/.test(keyPart)) {
|
|
68
|
+
this.addObjectValue(obj, array[index - 1], value);
|
|
69
|
+
return obj[array[index - 1]];
|
|
70
|
+
}
|
|
71
|
+
else if (obj[finalKey]) {
|
|
72
|
+
obj[finalKey] = [obj[finalKey], value];
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
obj[finalKey] = value;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
obj[finalKey] = obj[finalKey] || {};
|
|
80
|
+
}
|
|
81
|
+
return obj[finalKey];
|
|
82
|
+
}, filterObject);
|
|
83
|
+
}
|
|
84
|
+
this.filtersData = this.flattenObject(filterObject["filters"]) || {};
|
|
61
85
|
}
|
|
62
86
|
catch (e) {
|
|
63
87
|
salla.logger.warn('failed to get filters from url', e.message);
|
|
64
88
|
}
|
|
65
89
|
}
|
|
90
|
+
flattenObject(obj) {
|
|
91
|
+
for (const key in obj) {
|
|
92
|
+
if (typeof obj[key] === 'object') {
|
|
93
|
+
if (obj[key][key] && Array.isArray(obj[key][key])) {
|
|
94
|
+
obj[key] = obj[key][key];
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
this.flattenObject(obj[key]);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
return obj;
|
|
102
|
+
}
|
|
103
|
+
addObjectValue(obj, key, value) {
|
|
104
|
+
if (obj.hasOwnProperty(key)) {
|
|
105
|
+
if (Array.isArray(obj[key])) {
|
|
106
|
+
obj[key].push(value);
|
|
107
|
+
}
|
|
108
|
+
else {
|
|
109
|
+
obj[key] = [obj[key], value];
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
else {
|
|
113
|
+
obj[key] = [value];
|
|
114
|
+
}
|
|
115
|
+
}
|
|
66
116
|
/**
|
|
67
117
|
* Method to get filter data.
|
|
68
118
|
*/
|
|
@@ -80,7 +130,15 @@ const SallaFilters = class {
|
|
|
80
130
|
setTimeout(() => {
|
|
81
131
|
var _a;
|
|
82
132
|
if (hasFilters) {
|
|
83
|
-
|
|
133
|
+
let url = new URL(window.location.href);
|
|
134
|
+
for (const [key] of url.searchParams.entries()) {
|
|
135
|
+
if (key.startsWith("filters")) {
|
|
136
|
+
url.searchParams.delete(key);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
let encodedFilterValues = this.encodeFilters(this.filtersData);
|
|
140
|
+
url.search = url.search ? url.search.split("&filters")[0] + "&" + encodedFilterValues : `?${encodedFilterValues}`;
|
|
141
|
+
window.history.pushState({}, '', url.href);
|
|
84
142
|
}
|
|
85
143
|
else {
|
|
86
144
|
let url = new URL(window.location.href);
|
|
@@ -91,15 +149,50 @@ const SallaFilters = class {
|
|
|
91
149
|
this.changed.emit(this.filtersData);
|
|
92
150
|
}, 300);
|
|
93
151
|
}
|
|
152
|
+
encodeFilters(filters, parentKey = 'filters') {
|
|
153
|
+
const encodedFilters = [];
|
|
154
|
+
for (const key in filters) {
|
|
155
|
+
if (Object.prototype.hasOwnProperty.call(filters, key)) {
|
|
156
|
+
const value = filters[key];
|
|
157
|
+
const fullKey = parentKey ? `${parentKey}[${key}]` : key;
|
|
158
|
+
if (Array.isArray(value)) {
|
|
159
|
+
for (let i = 0; i < value.length; i++) {
|
|
160
|
+
encodedFilters.push(`${fullKey}[${i}]=${value[i]}`);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
else if (typeof value === 'object' && value !== null) {
|
|
164
|
+
encodedFilters.push(this.encodeFilters(value, fullKey));
|
|
165
|
+
}
|
|
166
|
+
else {
|
|
167
|
+
// const encodedKey = encodeURIComponent(fullKey);
|
|
168
|
+
// const encodedValue = encodeURIComponent(value);
|
|
169
|
+
let result = `${fullKey}=${value}`;
|
|
170
|
+
encodedFilters.push(result);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
return encodedFilters.join('&');
|
|
175
|
+
}
|
|
176
|
+
;
|
|
94
177
|
/**
|
|
95
178
|
* Reset selected filters.
|
|
96
179
|
*/
|
|
97
180
|
async resetFilters() {
|
|
181
|
+
this.removeFiltersQueryParams();
|
|
98
182
|
this.filtersData = {};
|
|
99
183
|
this.host.childNodes.forEach((widget) => widget.reset && widget.reset());
|
|
100
184
|
salla.event.emit('salla-filters::reset');
|
|
101
185
|
return this.applyFilters();
|
|
102
186
|
}
|
|
187
|
+
removeFiltersQueryParams() {
|
|
188
|
+
const searchParams = new URLSearchParams(window.location.search);
|
|
189
|
+
const newUrl = Array.from(searchParams.keys())
|
|
190
|
+
.filter(key => !key.startsWith('filters['))
|
|
191
|
+
.map(key => `${encodeURIComponent(key)}=${encodeURIComponent(searchParams.get(key))}`)
|
|
192
|
+
.join('&');
|
|
193
|
+
const finalUrl = newUrl ? `${window.location.pathname}?${newUrl}` : window.location.pathname;
|
|
194
|
+
window.history.pushState({}, '', finalUrl);
|
|
195
|
+
}
|
|
103
196
|
/**
|
|
104
197
|
* @param {{target:HTMLInputElement}} event
|
|
105
198
|
* @param option
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"salla-filters.entry.cjs.js","mappings":";;;;;;;;;;AAAA,MAAM,eAAe,GAAG,+GAA+G;;MCO1H,YAAY;EAEvB;;;IAwDQ,YAAO,GAAG,KAAK,CAAC;;;uBAGa,EAAE;;;IA1DrC,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC,iBAAiB,EAAE,MAAM,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,GAAG,MAAM,CAAC,CAAC;IAE1E,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC;MAClB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,sBAAsB,CAAC,CAAC;MACpD,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,gCAAgC,CAAC,CAAC;KAC/D,CAAC,CAAC;IAEH,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC,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EnDA,0BAAc,KAAK,EAAC,MAAM,EAAC,IAAI,EAAC,SAAS,EAAC,OAAO,EAAE,MAAM,IAAI,CAAC,YAAY,EAAE,IAAG,IAAI,CAAC,KAAK,CAAgB,CACrG,GAAG,EAAE,CACN,CAAC;GACT;EAED,gBAAgB;IACd,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;GACrB;;;;;;;","names":["FilterOptionInputType","FilterOptionTypes","h","Host"],"sources":["src/components/salla-filters/salla-filters.scss?tag=salla-filters","src/components/salla-filters/salla-filters.tsx"],"sourcesContent":[":host {\n display: block;\n}\n\n.s-rating-stars-small {\n line-height: 12px;\n}\n.s-filters-radio{\n background-image: none !important;\n}","import { Component, Element, h, Event, EventEmitter, Host, Method, Prop, State } from '@stencil/core';\nimport { Filter, FilterOptionInputType, FilterOptionTypes } from \"./interfaces\";\n\n@Component({\n tag: 'salla-filters',\n styleUrl: 'salla-filters.scss',\n})\nexport class SallaFilters {\n\n constructor() {\n salla.event.on('filters::hidden', () => this.host.style.display = 'none');\n\n salla.lang.onLoaded(() => {\n this.apply = salla.lang.get('pages.checkout.apply');\n this.reset = salla.lang.get('pages.categories.filters_reset');\n });\n\n salla.event.on('filters::fetched', ({ filters }) => {\n this.host.style.display = '';\n let freshFilterData = {};\n this.filters = filters\n .map((filter: Filter) => {\n filter.label = {\n category_id: salla.lang.get('common.titles.categories'),\n brand_id: salla.lang.get('common.titles.brands'),\n rating: salla.lang.get('pages.categories.filter_rating'),\n price: salla.lang.get('pages.categories.filter_price'),\n }[filter.key] || filter.label;\n filter.inputType = FilterOptionInputType.RADIO;//todo:: support FilterOptionInputType.CHECKBOX\n if (filter.key == 'rating') {\n filter.inputType = FilterOptionInputType.RADIO;\n //@ts-ignore\n let { max, min } = filter.values;\n //@ts-ignore\n filter.values = [5, 4, 3, 2, 1].filter(stars => stars >= min || stars <= max)\n }\n\n //when getting new filters, maybe less than we had, so let's get from the old one, only what is existed now.\n if (this.filtersData[filter.key]) {\n freshFilterData[filter.key] = this.filtersData[filter.key];\n }\n\n return filter;\n });\n this.filtersData = freshFilterData;\n this.host.childNodes.forEach(async (widget: HTMLSallaFiltersWidgetElement) => widget.setWidgetHeight && await widget.setWidgetHeight())\n });\n }\n\n connectedCallback() {\n try {\n let filters = (new URLSearchParams(window.location.search)).get('filters')\n this.filtersData = filters ? JSON.parse(decodeURIComponent(filters)) : {};\n } catch (e) {\n salla.logger.warn('failed to get filters from url', e.message);\n }\n }\n\n @Element() host: HTMLElement;\n\n /**\n * Array of filter options\n */\n @Prop({ reflect: true, mutable: true }) filters?: Filter[];\n\n private isReady = false;//to avoid triggering the changed event\n\n @State() isSidebarOpen: boolean;\n @State() filtersData: object | any = {}\n @State() apply: string;\n @State() reset: string;\n\n /**\n * Custom event fired when the selected filters are changed.\n */\n @Event() changed: EventEmitter;\n\n /**\n * Method to get filter data.\n */\n @Method()\n async getFilters() {\n return this.filtersData;\n }\n\n /**\n * Apply filter action.\n */\n @Method()\n async applyFilters() {\n if (!this.isReady) {\n return;\n }\n let hasFilters = Object.keys(this.filtersData).length > 0;\n setTimeout(() => {\n if (hasFilters) {\n window.history.pushState({}, '', salla.url.addParamToUrl('filters', encodeURIComponent(JSON.stringify(this.filtersData))));\n } else {\n let url = new URL(window.location.href);\n url.searchParams?.delete('filters');\n window.history.pushState({}, '', url.toString());\n }\n salla.event.emit('salla-filters::changed', this.filtersData);\n this.changed.emit(this.filtersData);\n }, 300);\n }\n\n /**\n * Reset selected filters.\n */\n @Method()\n async resetFilters() {\n this.filtersData = {};\n this.host.childNodes.forEach((widget: HTMLSallaFiltersWidgetElement) => widget.reset && widget.reset())\n salla.event.emit('salla-filters::reset');\n return this.applyFilters();\n }\n\n\n /**\n * @param {{target:HTMLInputElement}} event\n * @param option\n * @param value\n * @private\n */\n private handleOptionChange(event, option: Filter, value) {\n if (option.type === FilterOptionTypes.RANGE) {\n this.filtersData[option.key] = value;\n\n }\n let isChecked = event.target.checked;\n\n if (option.type === FilterOptionTypes.VARIANTS) {\n this.filtersData.variants = this.filtersData.variants || {};\n isChecked && (this.filtersData.variants[option.key] = value);\n isChecked || (delete this.filtersData.variants[option.key]);\n\n }\n\n if (event.target.type == FilterOptionInputType.RADIO) {\n isChecked && (this.filtersData[option.key] = value);\n isChecked || (delete this.filtersData[option.key]);\n }\n\n //it's checkbox\n // add if condition to avoid error when the filter is not existed in the filtersData\n if (event.target.type == FilterOptionInputType.CHECKBOX) {\n this.filtersData[option.key] = this.filtersData[option.key] || [];\n if (isChecked) {\n this.filtersData[option.key].push(value);\n\n }\n this.filtersData[option.key] = this.filtersData[option.key].filter(val => val != value);\n }\n this.applyFilters();\n }\n\n render() {\n return <Host>\n {this.filters?.map(option => <salla-filters-widget\n option={option}\n filtersData={this.filtersData}\n onChanged={({ detail: { event, option, value } }) => this.handleOptionChange(event, option, value)} />)}\n\n {this.filters?.length ? <div class=\"s-filters-footer\">\n {/* <salla-button color='primary' onClick={() => this.applyFilters()}>{this.apply}</salla-button> */}\n <salla-button color='gray' fill='outline' onClick={() => this.resetFilters()}>{this.reset}</salla-button>\n </div> : ''}\n </Host>;\n }\n\n componentDidLoad() {\n this.isReady = true;\n }\n}\n\n"],"version":3}
|
|
1
|
+
{"file":"salla-filters.entry.cjs.js","mappings":";;;;;;;;;;AAAA,MAAM,eAAe,GAAG,+GAA+G;;MCO1H,YAAY;EAEvB;;;IA4GQ,YAAO,GAAG,KAAK,CAAC;;;uBAGa,EAAE;;;IA9GrC,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC,iBAAiB,EAAE,MAAM,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,GAAG,MAAM,CAAC,CAAC;IAE1E,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC;MAClB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,sBAAsB,CAAC,CAAC;MACpD,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,gCAAgC,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,CAAC,GAAG,IAAI,GAAG,IAAI,KAAK,CAAC,CAAC;KACzF;IACD,IAAI,CAAC,YAAY,EAAE,CAAC;GACrB;EAED,MAAM;;IACJ,OAAOE,QAACC,UAAI,QACT,MAAA,IAAI,CAAC,OAAO;SAAE,GAAG,CAAC,MAAM,IAAID,kCAC3B,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,IAAI,CAAC,WAAW,EAC7B,SAAS,EAAE,CAAC,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,KAAK,IAAI,CAAC,kBAAkB,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,GAAI,CAAC,EAExG,CAAA,MAAA,IAAI,CAAC,OAAO,0CAAE,MAAM,IAAGA,iBAAK,KAAK,EAAC,kBAAkB,IAEnDA,0BAAc,KAAK,EAAC,MAAM,EAAC,IAAI,EAAC,SAAS,EAAC,OAAO,EAAE,MAAM,IAAI,CAAC,YAAY,EAAE,IAAG,IAAI,CAAC,KAAK,CAAgB,CACrG,GAAG,EAAE,CACN,CAAC;GACT;EAED,gBAAgB;IACd,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;GACrB;;;;;;;","names":["FilterOptionInputType","FilterOptionTypes","h","Host"],"sources":["src/components/salla-filters/salla-filters.scss?tag=salla-filters","src/components/salla-filters/salla-filters.tsx"],"sourcesContent":[":host {\n display: block;\n}\n\n.s-rating-stars-small {\n line-height: 12px;\n}\n.s-filters-radio{\n background-image: none !important;\n}","import { Component, Element, h, Event, EventEmitter, Host, Method, Prop, State } from '@stencil/core';\nimport { Filter, FilterOptionInputType, FilterOptionTypes } from \"./interfaces\";\n\n@Component({\n tag: 'salla-filters',\n styleUrl: 'salla-filters.scss',\n})\nexport class SallaFilters {\n\n constructor() {\n salla.event.on('filters::hidden', () => this.host.style.display = 'none');\n\n salla.lang.onLoaded(() => {\n this.apply = salla.lang.get('pages.checkout.apply');\n this.reset = salla.lang.get('pages.categories.filters_reset');\n });\n\n salla.event.on('filters::fetched', ({ filters }) => {\n this.host.style.display = '';\n let freshFilterData = {};\n this.filters = filters\n .map((filter: Filter) => {\n filter.label = {\n category_id: salla.lang.get('common.titles.categories'),\n brand_id: salla.lang.get('common.titles.brands'),\n rating: salla.lang.get('pages.categories.filter_rating'),\n price: salla.lang.get('pages.categories.filter_price'),\n }[filter.key] || filter.label;\n filter.inputType = FilterOptionInputType.RADIO;//todo:: support FilterOptionInputType.CHECKBOX\n if (filter.key == 'rating') {\n filter.inputType = FilterOptionInputType.RADIO;\n //@ts-ignore\n let { max, min } = filter.values;\n //@ts-ignore\n filter.values = [5, 4, 3, 2, 1].filter(stars => stars >= min || stars <= max)\n }\n\n //when getting new filters, maybe less than we had, so let's get from the old one, only what is existed now.\n if (this.filtersData[filter.key]) {\n freshFilterData[filter.key] = this.filtersData[filter.key];\n }\n\n return filter;\n });\n this.filtersData = freshFilterData;\n this.host.childNodes.forEach(async (widget: HTMLSallaFiltersWidgetElement) => widget.setWidgetHeight && await widget.setWidgetHeight())\n });\n }\n\n connectedCallback() {\n try {\n const searchParams = new URLSearchParams(window.location.search);\n const filterObject = {};\n\n for (const [key, value] of searchParams.entries()) {\n const keys = key.replace(/\\]/g, '').split('[');\n keys.reduce((obj, keyPart, index, array) => {\n const isLastKey = index === array.length - 1;\n const finalKey = /^\\d+$/.test(keyPart) ? parseInt(keyPart, 10) : keyPart;\n if (isLastKey) {\n if (/^\\d+$/.test(keyPart)) {\n this.addObjectValue(obj, array[index - 1], value)\n return obj[array[index - 1]];\n } else if (obj[finalKey]) {\n obj[finalKey] = [obj[finalKey], value];\n } else {\n obj[finalKey] = value;\n }\n } else {\n obj[finalKey] = obj[finalKey] || {};\n }\n\n return obj[finalKey];\n }, filterObject);\n }\n\n this.filtersData = this.flattenObject(filterObject[\"filters\"]) || {};\n } catch (e) {\n salla.logger.warn('failed to get filters from url', e.message);\n }\n\n }\n\n private flattenObject(obj: any) {\n for (const key in obj) {\n if (typeof obj[key] === 'object') {\n if (obj[key][key] && Array.isArray(obj[key][key])) {\n obj[key] = obj[key][key];\n } else {\n this.flattenObject(obj[key]);\n }\n }\n }\n return obj;\n }\n\n\n private addObjectValue(obj, key, value) {\n if (obj.hasOwnProperty(key)) {\n if (Array.isArray(obj[key])) {\n obj[key].push(value);\n } else {\n obj[key] = [obj[key], value];\n }\n } else {\n obj[key] = [value];\n }\n }\n\n\n @Element() host: HTMLElement;\n\n /**\n * Array of filter options\n */\n @Prop({ reflect: true, mutable: true }) filters?: Filter[];\n\n private isReady = false;//to avoid triggering the changed event\n\n @State() isSidebarOpen: boolean;\n @State() filtersData: object | any = {}\n @State() apply: string;\n @State() reset: string;\n\n /**\n * Custom event fired when the selected filters are changed.\n */\n @Event() changed: EventEmitter;\n\n /**\n * Method to get filter data.\n */\n @Method()\n async getFilters() {\n return this.filtersData;\n }\n\n /**\n * Apply filter action.\n */\n @Method()\n async applyFilters() {\n if (!this.isReady) {\n return;\n }\n let hasFilters = Object.keys(this.filtersData).length > 0;\n setTimeout(() => {\n if (hasFilters) {\n let url = new URL(window.location.href);\n for (const [key] of url.searchParams.entries()) {\n if (key.startsWith(\"filters\")) {\n url.searchParams.delete(key);\n }\n }\n let encodedFilterValues = this.encodeFilters(this.filtersData)\n url.search = url.search ? url.search.split(\"&filters\")[0] + \"&\" + encodedFilterValues : `?${encodedFilterValues}`;\n window.history.pushState({}, '', url.href);\n } else {\n let url = new URL(window.location.href);\n url.searchParams?.delete('filters');\n window.history.pushState({}, '', url.toString());\n }\n salla.event.emit('salla-filters::changed', this.filtersData);\n this.changed.emit(this.filtersData);\n }, 300);\n }\n\n private encodeFilters(filters, parentKey = 'filters') {\n const encodedFilters = [];\n\n for (const key in filters) {\n if (Object.prototype.hasOwnProperty.call(filters, key)) {\n const value = filters[key];\n\n const fullKey = parentKey ? `${parentKey}[${key}]` : key;\n if (Array.isArray(value)) {\n for (let i = 0; i < value.length; i++) {\n encodedFilters.push(`${fullKey}[${i}]=${value[i]}`)\n }\n }\n else if (typeof value === 'object' && value !== null) {\n encodedFilters.push(this.encodeFilters(value, fullKey));\n } else {\n // const encodedKey = encodeURIComponent(fullKey);\n // const encodedValue = encodeURIComponent(value);\n let result = `${fullKey}=${value}`\n encodedFilters.push(result);\n }\n }\n }\n return encodedFilters.join('&');\n };\n\n /**\n * Reset selected filters.\n */\n @Method()\n async resetFilters() {\n this.removeFiltersQueryParams()\n this.filtersData = {};\n this.host.childNodes.forEach((widget: HTMLSallaFiltersWidgetElement) => widget.reset && widget.reset())\n salla.event.emit('salla-filters::reset');\n return this.applyFilters();\n }\n\n private removeFiltersQueryParams() {\n const searchParams = new URLSearchParams(window.location.search);\n\n const newUrl = Array.from(searchParams.keys())\n .filter(key => !key.startsWith('filters['))\n .map(key => `${encodeURIComponent(key)}=${encodeURIComponent(searchParams.get(key))}`)\n .join('&');\n\n const finalUrl = newUrl ? `${window.location.pathname}?${newUrl}` : window.location.pathname;\n window.history.pushState({}, '', finalUrl);\n }\n\n /**\n * @param {{target:HTMLInputElement}} event\n * @param option\n * @param value\n * @private\n */\n private handleOptionChange(event, option: Filter, value) {\n if (option.type === FilterOptionTypes.RANGE) {\n this.filtersData[option.key] = value;\n\n }\n let isChecked = event.target.checked;\n\n if (option.type === FilterOptionTypes.VARIANTS) {\n this.filtersData.variants = this.filtersData.variants || {};\n isChecked && (this.filtersData.variants[option.key] = value);\n isChecked || (delete this.filtersData.variants[option.key]);\n\n }\n\n if (event.target.type == FilterOptionInputType.RADIO) {\n isChecked && (this.filtersData[option.key] = value);\n isChecked || (delete this.filtersData[option.key]);\n }\n\n //it's checkbox\n // add if condition to avoid error when the filter is not existed in the filtersData\n if (event.target.type == FilterOptionInputType.CHECKBOX) {\n this.filtersData[option.key] = this.filtersData[option.key] || [];\n if (isChecked) {\n this.filtersData[option.key].push(value);\n\n }\n this.filtersData[option.key] = this.filtersData[option.key].filter(val => val != value);\n }\n this.applyFilters();\n }\n\n render() {\n return <Host>\n {this.filters?.map(option => <salla-filters-widget\n option={option}\n filtersData={this.filtersData}\n onChanged={({ detail: { event, option, value } }) => this.handleOptionChange(event, option, value)} />)}\n\n {this.filters?.length ? <div class=\"s-filters-footer\">\n {/* <salla-button color='primary' onClick={() => this.applyFilters()}>{this.apply}</salla-button> */}\n <salla-button color='gray' fill='outline' onClick={() => this.resetFilters()}>{this.reset}</salla-button>\n </div> : ''}\n </Host>;\n }\n\n componentDidLoad() {\n this.isReady = true;\n }\n}\n\n"],"version":3}
|
package/dist/cjs/twilight.cjs.js
CHANGED
|
@@ -23,7 +23,7 @@ const patchBrowser = () => {
|
|
|
23
23
|
|
|
24
24
|
patchBrowser().then(options => {
|
|
25
25
|
appGlobals.globalScripts();
|
|
26
|
-
return index.bootstrapLazy(JSON.parse("[[\"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],\"sliderConfig\":[520,\"slider-config\"],\"productCardComponent\":[1,\"product-card-component\"],\"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],\"selectDonationAmount\":[32],\"selectAmount\":[32],\"isCustomDonation\":[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-notifications.cjs\",[[0,\"salla-notifications\",{\"loadMoreText\":[1,\"load-more-text\"],\"itemPerPage\":[2,\"item-per-page\"],\"notifications\":[32],\"pagination\":[32],\"hasInfiniteScroll\":[32],\"total\":[32],\"showPlaceholder\":[32],\"nextPage\":[32],\"no_notifications_trans\":[32],\"load_more_text_trans\":[32]}]]],[\"salla-advertisement.cjs\",[[0,\"salla-advertisement\",{\"position\":[32],\"advertisements\":[32],\"advertIcon\":[32],\"currentSlug\":[32]}]]],[\"salla-apps-icons.cjs\",[[0,\"salla-apps-icons\",{\"hideTitle\":[4,\"hide-title\"],\"appsTitle\":[1,\"apps-title\"],\"vertical\":[4],\"apps\":[32]}]]],[\"salla-contacts.cjs\",[[0,\"salla-contacts\",{\"contactsTitle\":[1,\"contacts-title\"],\"hideTitle\":[4,\"hide-title\"],\"isHeader\":[4,\"is-header\"],\"horizontal\":[4],\"iconsOnly\":[4,\"icons-only\"],\"contacts\":[32],\"iconsList\":[32]}]]],[\"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-payments.cjs\",[[0,\"salla-payments\",{\"withSbc\":[4,\"with-sbc\"],\"sbcId\":[1,\"sbc-id\"],\"withMadeInKsa\":[4,\"with-made-in-ksa\"],\"payments\":[32],\"placeholderImage\":[32]}]]],[\"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\"],\"productCardComponent\":[1,\"product-card-component\"],\"page\":[32],\"nextPage\":[32],\"hasInfiniteScroll\":[32],\"hasCustomComponent\":[32],\"sourceValueIsValid\":[32],\"placeholderText\":[32],\"isReady\":[32],\"showPlaceholder\":[32],\"parsedFilters\":[32],\"setFilters\":[64],\"reload\":[64]}]]],[\"salla-social.cjs\",[[0,\"salla-social\",{\"links\":[32],\"iconsList\":[32]}]]],[\"salla-conditional-fields.cjs\",[[4,\"salla-conditional-fields\",null,[[0,\"change\",\"changeHandler\"]]]]],[\"salla-notification-item.cjs\",[[0,\"salla-notification-item\",{\"notification\":[16]}]]],[\"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-add-product-button_47.cjs\",[[4,\"salla-gifting\",{\"productId\":[2,\"product-id\"],\"widgetTitle\":[1,\"widget-title\"],\"widgetSubtitle\":[1,\"widget-subtitle\"],\"sectionTitle\":[32],\"sectionSubtitle\":[32],\"sectionBtnText\":[32],\"giftDetails\":[32],\"selectImageForYourGift\":[32],\"selectImageOrUpload\":[32],\"selectGiftMessage\":[32],\"giftCustomText\":[32],\"textId\":[32],\"incorrectGiftText\":[32],\"nextStep\":[32],\"senderNameLabel\":[32],\"receiverNameFieldLabel\":[32],\"receiverMobileFieldLabel\":[32],\"receiverEmailFieldLabel\":[32],\"emailPlaceholder\":[32],\"sendLater\":[32],\"selectSendDateAndTime\":[32],\"canNotEditOrderAfterSelectDate\":[32],\"sendGift\":[32],\"donationRequired\":[32],\"currentStep\":[32],\"showCalendar\":[32],\"showGiftText\":[32],\"currentLang\":[32],\"parentClass\":[32],\"errors\":[32],\"gift\":[32],\"selectedGiftTextOption\":[32],\"showTextArea\":[32],\"selectedImage\":[32],\"uploadedImage\":[32],\"selectedText\":[32],\"senderName\":[32],\"errorMessage\":[32],\"hasError\":[32],\"quantity\":[32],\"deliveryDate\":[32],\"timeZone\":[32],\"receiverName\":[32],\"receiverMobile\":[32],\"receiverCountryCode\":[32],\"receiverEmail\":[32],\"open\":[64],\"close\":[64],\"goToStep2\":[64]}],[4,\"salla-loyalty\",{\"prizePoints\":[1544,\"prize-points\"],\"customerPoints\":[1538,\"customer-points\"],\"prizeTitle\":[1537,\"prize-title\"],\"allowEmail\":[4,\"allow-email\"],\"allowMobile\":[4,\"allow-mobile\"],\"requireEmail\":[4,\"require-email\"],\"guestMessage\":[1025,\"guest-message\"],\"loyaltyProgram\":[32],\"buttonLoading\":[32],\"selectedItem\":[32],\"askConfirmation\":[32],\"is_loggedin\":[32],\"hasError\":[32],\"errorMessage\":[32],\"translationLoaded\":[32],\"open\":[64],\"close\":[64],\"resetExchange\":[64],\"exchangeLoyaltyPoint\":[64]}],[0,\"salla-menu\",{\"source\":[1],\"sourceValue\":[1,\"source-value\"],\"topnav\":[4],\"useReactLink\":[4,\"use-react-link\"],\"menus\":[32],\"hasCustomComponent\":[32],\"setMenuContent\":[64]}],[4,\"salla-product-size-guide\",{\"guides\":[32],\"productId\":[32],\"placeholder_title\":[32],\"placeholder_description\":[32],\"modal_title\":[32],\"hasError\":[32],\"open\":[64],\"close\":[64]}],[4,\"salla-login-modal\",{\"isEmailAllowed\":[1028,\"is-email-allowed\"],\"isMobileAllowed\":[1028,\"is-mobile-allowed\"],\"isEmailRequired\":[1028,\"is-email-required\"],\"supportWebAuth\":[516,\"support-web-auth\"],\"inline\":[516],\"withoutReload\":[4,\"without-reload\"],\"currentTabName\":[32],\"regType\":[32],\"translationLoaded\":[32],\"currentPhone\":[32],\"currentEmail\":[32],\"title\":[32],\"emailErrorMsg\":[32],\"firstNameErrorMsg\":[32],\"lastNameErrorMsg\":[32],\"hasError\":[32],\"errorMessage\":[32],\"dragAndDrop\":[32],\"browseFromFiles\":[32],\"customFields\":[32],\"uploadedImage\":[32],\"open\":[64]},[[8,\"verified\",\"onVerified\"]]],[0,\"salla-offer-modal\",{\"offer\":[32],\"offer_name\":[32],\"offer_message\":[32],\"hasError\":[32],\"errorMessage\":[32],\"productID\":[32],\"offer_type\":[32],\"translationLoaded\":[32],\"addToCartLabel\":[32],\"open\":[64],\"showOffer\":[64]}],[0,\"salla-rating-modal\",{\"orderId\":[2,\"order-id\"],\"order\":[32],\"hasError\":[32],\"errorMessage\":[32],\"translationLoaded\":[32],\"open\":[64],\"close\":[64]}],[4,\"salla-scopes\",{\"selection\":[1],\"searchDisplayLimit\":[2,\"search-display-limit\"],\"translationLoaded\":[32],\"mode\":[32],\"current_scope\":[32],\"scopes\":[32],\"originalScopesList\":[32],\"selected_scope\":[32],\"isOpenedBefore\":[32],\"hasError\":[32],\"loading\":[32],\"close\":[64],\"open\":[64],\"handleSubmit\":[64]}],[0,\"salla-localization-modal\",{\"language\":[1537],\"currency\":[1537],\"translationLoaded\":[32],\"languages\":[32],\"currencies\":[32],\"hasError\":[32],\"errorMessage\":[32],\"open\":[64],\"close\":[64],\"submit\":[64]}],[0,\"salla-bottom-alert\",{\"type\":[513],\"icon\":[513],\"message\":[513],\"actionUrl\":[513,\"action-url\"],\"actionLabel\":[513,\"action-label\"],\"storeId\":[32],\"template\":[32],\"loading\":[32],\"templateData\":[32],\"defaultMessage\":[32],\"defaultActionLabel\":[32],\"storeFeatures\":[32],\"storeDetails\":[32],\"storePrice\":[32],\"templateInformation\":[32],\"buyTheTemplate\":[32]}],[0,\"salla-comments\",{\"itemId\":[2,\"item-id\"],\"loadMoreText\":[1,\"load-more-text\"],\"hideForm\":[4,\"hide-form\"],\"type\":[1],\"comments\":[32],\"pagination\":[32],\"total\":[32],\"showPlaceholder\":[32],\"nextPage\":[32],\"noComments\":[32],\"comment_title\":[32],\"comment_name\":[32],\"placeholder_text\":[32]}],[0,\"salla-quick-order\",{\"quickOrderTitle\":[1025,\"quick-order-title\"],\"subTitle\":[1025,\"sub-title\"],\"payButtonTitle\":[1025,\"pay-button-title\"],\"confirmPayButtonTitle\":[1025,\"confirm-pay-button-title\"],\"agreementText\":[1025,\"agreement-text\"],\"isEmailRequired\":[1028,\"is-email-required\"],\"productId\":[1025,\"product-id\"],\"thanksMessage\":[1025,\"thanks-message\"],\"quickOrderStyle\":[1025,\"quick-order-style\"],\"user\":[32],\"isAvailable\":[32],\"oneClick\":[32],\"expanded\":[32],\"isTermsRequired\":[32],\"countryCode\":[32],\"submitSucess\":[32],\"placeHolderEmail\":[32],\"emailOptional\":[32],\"agreementShowText\":[32],\"agreementModalHead\":[32],\"userNameLabel\":[32],\"termsChecked\":[32]}],[0,\"salla-user-profile\",{\"customFields\":[1,\"custom-fields\"],\"userData\":[32],\"userDefinedFields\":[32],\"disableAction\":[32],\"first_name_trans\":[32],\"last_name_trans\":[32],\"birthday_trans\":[32],\"birthday_placeholder_trans\":[32],\"gender_trans\":[32],\"gender_placeholder_trans\":[32],\"male_trans\":[32],\"female_trans\":[32],\"email_trans\":[32],\"mobile_trans\":[32],\"save_btn_trans\":[32],\"drag_and_drop_trans\":[32],\"browse_trans\":[32],\"email_required_trans\":[32],\"invalid_email_trans\":[32],\"setCustomFields\":[64]}],[0,\"salla-user-settings\",{\"isNotifiable\":[516,\"is-notifiable\"],\"deactivateAccount\":[32],\"promotionalMsgs\":[32],\"deactivateDesc\":[32],\"promotionalMsgsDesc\":[32],\"sorryForLeavingText\":[32],\"warningText\":[32],\"keepAccount\":[32],\"buttonLoading\":[32]}],[0,\"salla-search\",{\"inline\":[4],\"oval\":[4],\"height\":[2],\"maxWords\":[2,\"max-words\"],\"showAction\":[4,\"show-action\"],\"translationLoaded\":[32],\"results\":[32],\"loading\":[32],\"typing\":[32],\"debounce\":[32],\"search_term\":[32]},[[0,\"keydown\",\"handleKeyDown\"]]],[4,\"salla-social-share\",{\"url\":[513],\"urlName\":[513,\"url-name\"],\"platforms\":[513],\"opened\":[32],\"allPlatforms\":[32],\"platformIcons\":[32],\"convertedPlatforms\":[32],\"open\":[64],\"refresh\":[64]}],[0,\"salla-breadcrumb\",{\"items\":[1],\"breadcrumbs\":[32],\"currentPage\":[32],\"isRtl\":[32]}],[4,\"salla-cart-summary\",{\"showCartLabel\":[4,\"show-cart-label\"],\"cartSummaryCount\":[32],\"cartSummaryTotal\":[32],\"cartLabel\":[32],\"animateToCart\":[64]}],[4,\"salla-infinite-scroll\",{\"nextPage\":[1,\"next-page\"],\"autoload\":[1028],\"container\":[1],\"loadMoreText\":[1,\"load-more-text\"],\"item\":[1],\"loadMore\":[32],\"noMore\":[32],\"failedToLoad\":[32]}],[0,\"salla-maintenance-alert\",{\"title\":[32],\"message\":[32],\"buttonTitle\":[32]}],[4,\"salla-quantity-input\",{\"cartItemId\":[8,\"cart-item-id\"],\"quantity\":[32],\"fireChangeEvent\":[32],\"decrease\":[64],\"increase\":[64],\"setValue\":[64]}],[4,\"salla-user-menu\",{\"inline\":[516],\"avatarOnly\":[516,\"avatar-only\"],\"showHeader\":[516,\"show-header\"],\"relativeDropdown\":[516,\"relative-dropdown\"],\"accountLoading\":[32],\"opened\":[32],\"notifications\":[32],\"orders\":[32],\"pending_orders\":[32],\"wishlist\":[32],\"profile\":[32],\"rating\":[32],\"logout\":[32],\"hello\":[32],\"first_name\":[32],\"last_name\":[32],\"avatar\":[32],\"is_loggedIn\":[32],\"badges\":[32],\"hasBadges\":[32],\"OrderUpdate\":[32]}],[4,\"salla-map\",{\"name\":[1],\"required\":[4],\"readonly\":[4],\"searchable\":[1028],\"lat\":[1026],\"lng\":[1026],\"apiKey\":[1025,\"api-key\"],\"modalTitle\":[1,\"modal-title\"],\"zoom\":[1026],\"theme\":[1025],\"modalActivityTitle\":[32],\"confirmButtonTitle\":[32],\"locateButtonTitle\":[32],\"locateButtonEdit\":[32],\"searchPlaceholder\":[32],\"searchInputValue\":[32],\"formattedAddress\":[32],\"geolocationError\":[32],\"searchInput\":[32],\"mapInput\":[32],\"mapElement\":[32],\"selectedLat\":[32],\"selectedLng\":[32],\"open\":[64]}],[4,\"salla-verify\",{\"display\":[1],\"type\":[1025],\"autoReload\":[4,\"auto-reload\"],\"supportWebAuth\":[4,\"support-web-auth\"],\"translationLoaded\":[32],\"title\":[32],\"resendAfter\":[32],\"hasError\":[32],\"errorMessage\":[32],\"isProfileVerify\":[32],\"getCode\":[64],\"open\":[64]}],[0,\"salla-comment-form\",{\"type\":[1537],\"showAvatar\":[4,\"show-avatar\"],\"itemId\":[1544,\"item-id\"],\"placeholder\":[32],\"submitText\":[32],\"canComment\":[32]}],[4,\"salla-color-picker\",{\"name\":[1],\"required\":[4],\"color\":[1537],\"format\":[1],\"showCancelButton\":[4,\"show-cancel-button\"],\"showTextField\":[4,\"show-text-field\"],\"enableAlpha\":[4,\"enable-alpha\"],\"widgetColor\":[32],\"setPickerOption\":[64],\"movePopUp\":[64],\"setColorValue\":[64],\"openPicker\":[64],\"closePicker\":[64],\"destroyPicker\":[64]}],[4,\"salla-product-card\",{\"product\":[1],\"horizontal\":[4],\"shadowOnHover\":[4,\"shadow-on-hover\"],\"hideAddBtn\":[4,\"hide-add-btn\"],\"fullImage\":[4,\"full-image\"],\"minimal\":[4],\"isSpecial\":[4,\"is-special\"],\"showQuantity\":[4,\"show-quantity\"],\"productData\":[32],\"fitImageHeight\":[32],\"remained\":[32],\"outOfStock\":[32],\"donationAmount\":[32],\"startingPrice\":[32],\"addToCart\":[32],\"placeholder\":[32]}],[0,\"salla-comment-item\",{\"comment\":[16],\"has_bought_trans\":[32],\"rated_trans\":[32],\"waiting_approval_trans\":[32],\"has_order_trans\":[32]}],[4,\"salla-tab-content\",{\"name\":[1],\"isSelected\":[32],\"getChild\":[64]}],[4,\"salla-tab-header\",{\"name\":[1],\"activeClass\":[1,\"active-class\"],\"height\":[8],\"centered\":[4],\"isSelected\":[32],\"getChild\":[64]}],[4,\"salla-tabs\",{\"backgroundColor\":[1,\"background-color\"],\"vertical\":[4]},[[0,\"tabSelected\",\"onSelectedTab\"]]],[4,\"salla-add-product-button\",{\"channels\":[513],\"subscribedOptions\":[1,\"subscribed-options\"],\"quickBuy\":[1540,\"quick-buy\"],\"quantity\":[514],\"donatingAmount\":[514,\"donating-amount\"],\"notifyOptionsAvailability\":[516,\"notify-options-availability\"],\"productId\":[520,\"product-id\"],\"supportStickyBar\":[516,\"support-sticky-bar\"],\"productStatus\":[513,\"product-status\"],\"productType\":[513,\"product-type\"],\"hasOutOfStockOption\":[32],\"hasSubscribedOptions\":[32],\"selectedOptions\":[32],\"showQuickBuy\":[32]}],[0,\"salla-count-down\",{\"date\":[1],\"boxed\":[4],\"size\":[1],\"color\":[1],\"labeled\":[4],\"endText\":[1,\"end-text\"],\"digits\":[1],\"endOfDay\":[4,\"end-of-day\"],\"daysLabel\":[32],\"hoursLabel\":[32],\"minutesLabel\":[32],\"secondsLabel\":[32],\"endLabel\":[32],\"invalidDate\":[32],\"offerEnded\":[32],\"countInterval\":[32],\"days\":[32],\"hours\":[32],\"minutes\":[32],\"seconds\":[32],\"endCountDown\":[64]}],[0,\"salla-datetime-picker\",{\"value\":[1537],\"required\":[4],\"name\":[513],\"placeholder\":[1],\"allowInput\":[4,\"allow-input\"],\"allowInvalidPreload\":[4,\"allow-invalid-preload\"],\"altFormat\":[1,\"alt-format\"],\"altInput\":[4,\"alt-input\"],\"altInputClass\":[1,\"alt-input-class\"],\"appendTo\":[16],\"ariaDateFormat\":[1,\"aria-date-format\"],\"autoFillDefaultTime\":[4,\"auto-fill-default-time\"],\"clickOpens\":[4,\"click-opens\"],\"closeOnSelect\":[4,\"close-on-select\"],\"conjunction\":[1],\"dateFormat\":[1,\"date-format\"],\"defaultDate\":[8,\"default-date\"],\"defaultHour\":[2,\"default-hour\"],\"defaultMinute\":[2,\"default-minute\"],\"defaultSeconds\":[2,\"default-seconds\"],\"disable\":[16],\"disableMobile\":[4,\"disable-mobile\"],\"enable\":[16],\"enableSeconds\":[4,\"enable-seconds\"],\"enableTime\":[4,\"enable-time\"],\"formatDate\":[16],\"hourIncrement\":[2,\"hour-increment\"],\"inline\":[4],\"locale\":[1],\"maxDate\":[8,\"max-date\"],\"maxTime\":[8,\"max-time\"],\"minDate\":[8,\"min-date\"],\"minTime\":[8,\"min-time\"],\"minuteIncrement\":[2,\"minute-increment\"],\"mode\":[1],\"monthSelectorType\":[1,\"month-selector-type\"],\"nextArrow\":[1,\"next-arrow\"],\"noCalendar\":[4,\"no-calendar\"],\"dateParser\":[16],\"position\":[1],\"positionElement\":[16],\"prevArrow\":[1,\"prev-arrow\"],\"shorthandCurrentMonth\":[4,\"shorthand-current-month\"],\"static\":[4],\"showMonths\":[2,\"show-months\"],\"time_24hr\":[4,\"time_-2-4hr\"],\"weekNumbers\":[4,\"week-numbers\"],\"wrap\":[4]}],[0,\"salla-product-availability\",{\"channels\":[1],\"notifyOptionsAvailability\":[4,\"notify-options-availability\"],\"productId\":[2,\"product-id\"],\"isSubscribed\":[1028,\"is-subscribed\"],\"translationLoaded\":[32],\"title_\":[32],\"isVisitorSubscribed\":[32]}],[0,\"salla-quick-buy\",{\"type\":[1025],\"productId\":[1025,\"product-id\"],\"cartId\":[1025,\"cart-id\"],\"amount\":[1538],\"currency\":[1025],\"options\":[16],\"isRequireShipping\":[1028,\"is-require-shipping\"],\"applePayOnly\":[1028,\"apple-pay-only\"],\"isApplePayActive\":[32],\"quickBuy\":[32]}],[0,\"salla-file-upload\",{\"value\":[1537],\"files\":[513],\"height\":[513],\"cartItemId\":[1,\"cart-item-id\"],\"profileImage\":[516,\"profile-image\"],\"name\":[1537],\"payloadName\":[1,\"payload-name\"],\"accept\":[1537],\"fileId\":[2,\"file-id\"],\"url\":[1025],\"method\":[1],\"formData\":[1,\"form-data\"],\"required\":[4],\"maxFileSize\":[1,\"max-file-size\"],\"disabled\":[4],\"allowDrop\":[4,\"allow-drop\"],\"allowBrowse\":[4,\"allow-browse\"],\"allowPaste\":[4,\"allow-paste\"],\"allowMultiple\":[4,\"allow-multiple\"],\"allowReplace\":[4,\"allow-replace\"],\"allowRevert\":[4,\"allow-revert\"],\"allowRemove\":[4,\"allow-remove\"],\"allowProcess\":[4,\"allow-process\"],\"allowReorder\":[4,\"allow-reorder\"],\"storeAsFile\":[4,\"store-as-file\"],\"forceRevert\":[4,\"force-revert\"],\"maxFilesCount\":[2,\"max-files-count\"],\"maxParallelUploads\":[2,\"max-parallel-uploads\"],\"checkValidity\":[4,\"check-validity\"],\"itemInsertLocation\":[1,\"item-insert-location\"],\"itemInsertInterval\":[2,\"item-insert-interval\"],\"credits\":[4],\"dropOnPage\":[4,\"drop-on-page\"],\"dropOnElement\":[4,\"drop-on-element\"],\"dropValidation\":[4,\"drop-validation\"],\"ignoredFiles\":[16],\"instantUpload\":[1028,\"instant-upload\"],\"chunkUploads\":[4,\"chunk-uploads\"],\"chunkForce\":[4,\"chunk-force\"],\"chunkSize\":[2,\"chunk-size\"],\"chunkRetryDelays\":[16],\"labelDecimalSeparator\":[1,\"label-decimal-separator\"],\"labelThousandsSeparator\":[1,\"label-thousands-separator\"],\"labelIdle\":[1025,\"label-idle\"],\"iconRemove\":[1,\"icon-remove\"],\"iconProcess\":[1,\"icon-process\"],\"iconRetry\":[1,\"icon-retry\"],\"iconUndo\":[1,\"icon-undo\"],\"setOption\":[64]}],[4,\"salla-list-tile\",{\"href\":[1],\"target\":[1]}],[0,\"salla-progress-bar\",{\"donation\":[1],\"target\":[1026],\"value\":[1026],\"height\":[1025],\"header\":[1025],\"stripped\":[1028],\"message\":[1025],\"unit\":[1025],\"color\":[1025]}],[0,\"salla-rating-stars\",{\"name\":[1],\"size\":[1],\"value\":[2],\"reviews\":[2]}],[4,\"salla-slider\",{\"blockTitle\":[513,\"block-title\"],\"listenToThumbnailsOption\":[516,\"listen-to-thumbnails-option\"],\"blockSubtitle\":[513,\"block-subtitle\"],\"displayAllUrl\":[513,\"display-all-url\"],\"arrowsCentered\":[516,\"arrows-centered\"],\"verticalThumbs\":[516,\"vertical-thumbs\"],\"gridThumbs\":[516,\"grid-thumbs\"],\"vertical\":[516],\"autoHeight\":[516,\"auto-height\"],\"showControls\":[516,\"show-controls\"],\"controlsOuter\":[516,\"controls-outer\"],\"showThumbsControls\":[4,\"show-thumbs-controls\"],\"autoPlay\":[4,\"auto-play\"],\"slidesPerView\":[1,\"slides-per-view\"],\"pagination\":[4],\"centered\":[4],\"loop\":[4],\"direction\":[1537],\"type\":[1],\"sliderConfig\":[520,\"slider-config\"],\"thumbsConfig\":[520,\"thumbs-config\"],\"currentIndex\":[32],\"isEnd\":[32],\"isBeginning\":[32],\"swiperScript\":[32],\"displayAllTitle\":[32],\"windowWidth\":[32],\"slideTo\":[64],\"slideNext\":[64],\"slidePrev\":[64],\"slideToLoop\":[64],\"slideNextLoop\":[64],\"slidePrevLoop\":[64],\"slideReset\":[64],\"slideToClosest\":[64],\"update\":[64],\"updateAutoHeight\":[64],\"updateSlides\":[64],\"updateProgress\":[64],\"updateSlidesClasses\":[64],\"getSlides\":[64]}],[0,\"salla-skeleton\",{\"type\":[1],\"width\":[1],\"height\":[1]}],[4,\"salla-placeholder\",{\"icon\":[1],\"alignment\":[1],\"iconSize\":[1,\"icon-size\"],\"translationLoaded\":[32]}],[0,\"salla-tel-input\",{\"phone\":[1025],\"name\":[1],\"countryCode\":[1025,\"country-code\"],\"mobileRequired\":[32],\"countryCodeLabel\":[32],\"mobileLabel\":[32],\"tooShort\":[32],\"tooLong\":[32],\"invalidCountryCode\":[32],\"invalidNumber\":[32],\"errorMap\":[32],\"getValues\":[64],\"isValid\":[64]}],[4,\"salla-modal\",{\"isClosable\":[1028,\"is-closable\"],\"width\":[513],\"position\":[513],\"visible\":[516],\"hasSkeleton\":[516,\"has-skeleton\"],\"isLoading\":[1540,\"is-loading\"],\"subTitleFirst\":[4,\"sub-title-first\"],\"noPadding\":[4,\"no-padding\"],\"subTitle\":[1,\"sub-title\"],\"centered\":[4],\"iconStyle\":[1,\"icon-style\"],\"modalTitle\":[32],\"open\":[64],\"close\":[64],\"setTitle\":[64],\"loading\":[64],\"stopLoading\":[64]},[[0,\"keyup\",\"handleKeyUp\"]]],[0,\"salla-loading\",{\"size\":[8],\"width\":[8],\"color\":[1],\"bgColor\":[1,\"bg-color\"]}],[4,\"salla-button\",{\"shape\":[513],\"color\":[513],\"fill\":[513],\"size\":[513],\"width\":[513],\"loading\":[516],\"disabled\":[516],\"loaderPosition\":[1,\"loader-position\"],\"href\":[1],\"type\":[513],\"load\":[64],\"stop\":[64],\"setText\":[64],\"disable\":[64],\"enable\":[64]}]]],[\"salla-filters-widget.cjs\",[[4,\"salla-filters-widget\",{\"withLoadMore\":[1028,\"with-load-more\"],\"filtersData\":[16],\"option\":[16],\"isOpen\":[32],\"isShowMore\":[32],\"showMoreLabel\":[32],\"showLessLabel\":[32],\"page\":[32],\"setWidgetHeight\":[64],\"reset\":[64],\"showMore\":[64],\"toggleWidget\":[64]}]]]]"), options);
|
|
26
|
+
return index.bootstrapLazy(JSON.parse("[[\"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],\"sliderConfig\":[520,\"slider-config\"],\"productCardComponent\":[1,\"product-card-component\"],\"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],\"selectDonationAmount\":[32],\"selectAmount\":[32],\"isCustomDonation\":[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-notifications.cjs\",[[0,\"salla-notifications\",{\"loadMoreText\":[1,\"load-more-text\"],\"itemPerPage\":[2,\"item-per-page\"],\"notifications\":[32],\"pagination\":[32],\"hasInfiniteScroll\":[32],\"total\":[32],\"showPlaceholder\":[32],\"nextPage\":[32],\"no_notifications_trans\":[32],\"load_more_text_trans\":[32]}]]],[\"salla-advertisement.cjs\",[[0,\"salla-advertisement\",{\"position\":[32],\"advertisements\":[32],\"advertIcon\":[32],\"currentSlug\":[32]}]]],[\"salla-apps-icons.cjs\",[[0,\"salla-apps-icons\",{\"hideTitle\":[4,\"hide-title\"],\"appsTitle\":[1,\"apps-title\"],\"vertical\":[4],\"apps\":[32]}]]],[\"salla-contacts.cjs\",[[0,\"salla-contacts\",{\"contactsTitle\":[1,\"contacts-title\"],\"hideTitle\":[4,\"hide-title\"],\"isHeader\":[4,\"is-header\"],\"horizontal\":[4],\"iconsOnly\":[4,\"icons-only\"],\"contacts\":[32],\"iconsList\":[32]}]]],[\"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-payments.cjs\",[[0,\"salla-payments\",{\"withSbc\":[4,\"with-sbc\"],\"sbcId\":[1,\"sbc-id\"],\"withMadeInKsa\":[4,\"with-made-in-ksa\"],\"payments\":[32],\"placeholderImage\":[32]}]]],[\"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\"],\"productCardComponent\":[1,\"product-card-component\"],\"page\":[32],\"nextPage\":[32],\"hasInfiniteScroll\":[32],\"hasCustomComponent\":[32],\"sourceValueIsValid\":[32],\"placeholderText\":[32],\"isReady\":[32],\"showPlaceholder\":[32],\"parsedFilters\":[32],\"setFilters\":[64],\"reload\":[64]}]]],[\"salla-social.cjs\",[[0,\"salla-social\",{\"links\":[32],\"iconsList\":[32]}]]],[\"salla-conditional-fields.cjs\",[[4,\"salla-conditional-fields\",null,[[0,\"change\",\"changeHandler\"]]]]],[\"salla-notification-item.cjs\",[[0,\"salla-notification-item\",{\"notification\":[16]}]]],[\"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-add-product-button_47.cjs\",[[4,\"salla-gifting\",{\"productId\":[2,\"product-id\"],\"widgetTitle\":[1,\"widget-title\"],\"widgetSubtitle\":[1,\"widget-subtitle\"],\"sectionTitle\":[32],\"sectionSubtitle\":[32],\"sectionBtnText\":[32],\"giftDetails\":[32],\"selectImageForYourGift\":[32],\"selectImageOrUpload\":[32],\"selectGiftMessage\":[32],\"giftCustomText\":[32],\"textId\":[32],\"incorrectGiftText\":[32],\"nextStep\":[32],\"senderNameLabel\":[32],\"receiverNameFieldLabel\":[32],\"receiverMobileFieldLabel\":[32],\"receiverEmailFieldLabel\":[32],\"emailPlaceholder\":[32],\"sendLater\":[32],\"selectSendDateAndTime\":[32],\"canNotEditOrderAfterSelectDate\":[32],\"sendGift\":[32],\"donationRequired\":[32],\"currentStep\":[32],\"showCalendar\":[32],\"showGiftText\":[32],\"currentLang\":[32],\"parentClass\":[32],\"errors\":[32],\"gift\":[32],\"selectedGiftTextOption\":[32],\"showTextArea\":[32],\"selectedImage\":[32],\"uploadedImage\":[32],\"selectedText\":[32],\"senderName\":[32],\"errorMessage\":[32],\"hasError\":[32],\"quantity\":[32],\"deliveryDate\":[32],\"timeZone\":[32],\"receiverName\":[32],\"receiverMobile\":[32],\"receiverCountryCode\":[32],\"receiverEmail\":[32],\"open\":[64],\"close\":[64],\"goToStep2\":[64]}],[4,\"salla-loyalty\",{\"prizePoints\":[1544,\"prize-points\"],\"customerPoints\":[1538,\"customer-points\"],\"prizeTitle\":[1537,\"prize-title\"],\"allowEmail\":[4,\"allow-email\"],\"allowMobile\":[4,\"allow-mobile\"],\"requireEmail\":[4,\"require-email\"],\"guestMessage\":[1025,\"guest-message\"],\"loyaltyProgram\":[32],\"buttonLoading\":[32],\"selectedItem\":[32],\"askConfirmation\":[32],\"is_loggedin\":[32],\"hasError\":[32],\"errorMessage\":[32],\"translationLoaded\":[32],\"open\":[64],\"close\":[64],\"resetExchange\":[64],\"exchangeLoyaltyPoint\":[64]}],[0,\"salla-menu\",{\"source\":[1],\"sourceValue\":[1,\"source-value\"],\"topnav\":[4],\"useReactLink\":[4,\"use-react-link\"],\"menus\":[32],\"hasCustomComponent\":[32],\"setMenuContent\":[64]}],[4,\"salla-product-size-guide\",{\"guides\":[32],\"productId\":[32],\"placeholder_title\":[32],\"placeholder_description\":[32],\"modal_title\":[32],\"hasError\":[32],\"open\":[64],\"close\":[64]}],[4,\"salla-login-modal\",{\"isEmailAllowed\":[1028,\"is-email-allowed\"],\"isMobileAllowed\":[1028,\"is-mobile-allowed\"],\"isEmailRequired\":[1028,\"is-email-required\"],\"supportWebAuth\":[516,\"support-web-auth\"],\"inline\":[516],\"withoutReload\":[4,\"without-reload\"],\"currentTabName\":[32],\"regType\":[32],\"translationLoaded\":[32],\"currentPhone\":[32],\"currentEmail\":[32],\"title\":[32],\"emailErrorMsg\":[32],\"firstNameErrorMsg\":[32],\"lastNameErrorMsg\":[32],\"hasError\":[32],\"errorMessage\":[32],\"dragAndDrop\":[32],\"browseFromFiles\":[32],\"customFields\":[32],\"uploadedImage\":[32],\"open\":[64]},[[8,\"verified\",\"onVerified\"]]],[0,\"salla-offer-modal\",{\"offer\":[32],\"offer_name\":[32],\"offer_message\":[32],\"hasError\":[32],\"errorMessage\":[32],\"productID\":[32],\"offer_type\":[32],\"translationLoaded\":[32],\"addToCartLabel\":[32],\"open\":[64],\"showOffer\":[64]}],[0,\"salla-rating-modal\",{\"orderId\":[2,\"order-id\"],\"order\":[32],\"hasError\":[32],\"errorMessage\":[32],\"translationLoaded\":[32],\"open\":[64],\"close\":[64]}],[4,\"salla-scopes\",{\"selection\":[1],\"searchDisplayLimit\":[2,\"search-display-limit\"],\"translationLoaded\":[32],\"mode\":[32],\"current_scope\":[32],\"scopes\":[32],\"originalScopesList\":[32],\"selected_scope\":[32],\"isOpenedBefore\":[32],\"hasError\":[32],\"loading\":[32],\"close\":[64],\"open\":[64],\"handleSubmit\":[64]}],[0,\"salla-localization-modal\",{\"language\":[1537],\"currency\":[1537],\"translationLoaded\":[32],\"languages\":[32],\"currencies\":[32],\"hasError\":[32],\"errorMessage\":[32],\"open\":[64],\"close\":[64],\"submit\":[64]}],[0,\"salla-bottom-alert\",{\"type\":[513],\"icon\":[513],\"message\":[513],\"actionUrl\":[513,\"action-url\"],\"actionLabel\":[513,\"action-label\"],\"storeId\":[32],\"template\":[32],\"loading\":[32],\"templateData\":[32],\"defaultMessage\":[32],\"defaultActionLabel\":[32],\"storeFeatures\":[32],\"storeDetails\":[32],\"storePrice\":[32],\"theDeveloper\":[32],\"templateInformation\":[32],\"buyTheTemplate\":[32],\"isRtl\":[32]}],[0,\"salla-comments\",{\"itemId\":[2,\"item-id\"],\"loadMoreText\":[1,\"load-more-text\"],\"hideForm\":[4,\"hide-form\"],\"type\":[1],\"comments\":[32],\"pagination\":[32],\"total\":[32],\"showPlaceholder\":[32],\"nextPage\":[32],\"noComments\":[32],\"comment_title\":[32],\"comment_name\":[32],\"placeholder_text\":[32]}],[0,\"salla-quick-order\",{\"quickOrderTitle\":[1025,\"quick-order-title\"],\"subTitle\":[1025,\"sub-title\"],\"payButtonTitle\":[1025,\"pay-button-title\"],\"confirmPayButtonTitle\":[1025,\"confirm-pay-button-title\"],\"agreementText\":[1025,\"agreement-text\"],\"isEmailRequired\":[1028,\"is-email-required\"],\"productId\":[1025,\"product-id\"],\"thanksMessage\":[1025,\"thanks-message\"],\"quickOrderStyle\":[1025,\"quick-order-style\"],\"user\":[32],\"isAvailable\":[32],\"oneClick\":[32],\"expanded\":[32],\"isTermsRequired\":[32],\"countryCode\":[32],\"submitSucess\":[32],\"placeHolderEmail\":[32],\"emailOptional\":[32],\"agreementShowText\":[32],\"agreementModalHead\":[32],\"userNameLabel\":[32],\"termsChecked\":[32]}],[0,\"salla-user-profile\",{\"customFields\":[1,\"custom-fields\"],\"userData\":[32],\"userDefinedFields\":[32],\"disableAction\":[32],\"first_name_trans\":[32],\"last_name_trans\":[32],\"birthday_trans\":[32],\"birthday_placeholder_trans\":[32],\"gender_trans\":[32],\"gender_placeholder_trans\":[32],\"male_trans\":[32],\"female_trans\":[32],\"email_trans\":[32],\"mobile_trans\":[32],\"save_btn_trans\":[32],\"drag_and_drop_trans\":[32],\"browse_trans\":[32],\"email_required_trans\":[32],\"invalid_email_trans\":[32],\"setCustomFields\":[64]}],[0,\"salla-user-settings\",{\"isNotifiable\":[516,\"is-notifiable\"],\"deactivateAccount\":[32],\"promotionalMsgs\":[32],\"deactivateDesc\":[32],\"promotionalMsgsDesc\":[32],\"sorryForLeavingText\":[32],\"warningText\":[32],\"keepAccount\":[32],\"buttonLoading\":[32]}],[0,\"salla-search\",{\"inline\":[4],\"oval\":[4],\"height\":[2],\"maxWords\":[2,\"max-words\"],\"showAction\":[4,\"show-action\"],\"translationLoaded\":[32],\"results\":[32],\"loading\":[32],\"typing\":[32],\"debounce\":[32],\"search_term\":[32]},[[0,\"keydown\",\"handleKeyDown\"]]],[4,\"salla-social-share\",{\"url\":[513],\"urlName\":[513,\"url-name\"],\"platforms\":[513],\"opened\":[32],\"allPlatforms\":[32],\"platformIcons\":[32],\"convertedPlatforms\":[32],\"open\":[64],\"refresh\":[64]}],[0,\"salla-breadcrumb\",{\"items\":[1],\"breadcrumbs\":[32],\"currentPage\":[32],\"isRtl\":[32]}],[4,\"salla-cart-summary\",{\"showCartLabel\":[4,\"show-cart-label\"],\"cartSummaryCount\":[32],\"cartSummaryTotal\":[32],\"cartLabel\":[32],\"animateToCart\":[64]}],[4,\"salla-infinite-scroll\",{\"nextPage\":[1,\"next-page\"],\"autoload\":[1028],\"container\":[1],\"loadMoreText\":[1,\"load-more-text\"],\"item\":[1],\"loadMore\":[32],\"noMore\":[32],\"failedToLoad\":[32]}],[0,\"salla-maintenance-alert\",{\"title\":[32],\"message\":[32],\"buttonTitle\":[32]}],[4,\"salla-quantity-input\",{\"cartItemId\":[8,\"cart-item-id\"],\"quantity\":[32],\"fireChangeEvent\":[32],\"decrease\":[64],\"increase\":[64],\"setValue\":[64]}],[4,\"salla-user-menu\",{\"inline\":[516],\"avatarOnly\":[516,\"avatar-only\"],\"showHeader\":[516,\"show-header\"],\"relativeDropdown\":[516,\"relative-dropdown\"],\"accountLoading\":[32],\"opened\":[32],\"notifications\":[32],\"orders\":[32],\"pending_orders\":[32],\"wishlist\":[32],\"profile\":[32],\"rating\":[32],\"logout\":[32],\"hello\":[32],\"first_name\":[32],\"last_name\":[32],\"avatar\":[32],\"is_loggedIn\":[32],\"badges\":[32],\"hasBadges\":[32],\"OrderUpdate\":[32]}],[4,\"salla-map\",{\"name\":[1],\"required\":[4],\"readonly\":[4],\"searchable\":[1028],\"lat\":[1026],\"lng\":[1026],\"apiKey\":[1025,\"api-key\"],\"modalTitle\":[1,\"modal-title\"],\"zoom\":[1026],\"theme\":[1025],\"modalActivityTitle\":[32],\"confirmButtonTitle\":[32],\"locateButtonTitle\":[32],\"locateButtonEdit\":[32],\"searchPlaceholder\":[32],\"searchInputValue\":[32],\"formattedAddress\":[32],\"geolocationError\":[32],\"searchInput\":[32],\"mapInput\":[32],\"mapElement\":[32],\"selectedLat\":[32],\"selectedLng\":[32],\"open\":[64]}],[4,\"salla-verify\",{\"display\":[1],\"type\":[1025],\"autoReload\":[4,\"auto-reload\"],\"supportWebAuth\":[4,\"support-web-auth\"],\"translationLoaded\":[32],\"title\":[32],\"resendAfter\":[32],\"hasError\":[32],\"errorMessage\":[32],\"isProfileVerify\":[32],\"getCode\":[64],\"open\":[64]}],[0,\"salla-comment-form\",{\"type\":[1537],\"showAvatar\":[4,\"show-avatar\"],\"itemId\":[1544,\"item-id\"],\"placeholder\":[32],\"submitText\":[32],\"canComment\":[32]}],[4,\"salla-color-picker\",{\"name\":[1],\"required\":[4],\"color\":[1537],\"format\":[1],\"showCancelButton\":[4,\"show-cancel-button\"],\"showTextField\":[4,\"show-text-field\"],\"enableAlpha\":[4,\"enable-alpha\"],\"widgetColor\":[32],\"setPickerOption\":[64],\"movePopUp\":[64],\"setColorValue\":[64],\"openPicker\":[64],\"closePicker\":[64],\"destroyPicker\":[64]}],[4,\"salla-product-card\",{\"product\":[1],\"horizontal\":[4],\"shadowOnHover\":[4,\"shadow-on-hover\"],\"hideAddBtn\":[4,\"hide-add-btn\"],\"fullImage\":[4,\"full-image\"],\"minimal\":[4],\"isSpecial\":[4,\"is-special\"],\"showQuantity\":[4,\"show-quantity\"],\"productData\":[32],\"fitImageHeight\":[32],\"remained\":[32],\"outOfStock\":[32],\"donationAmount\":[32],\"startingPrice\":[32],\"addToCart\":[32],\"placeholder\":[32]}],[0,\"salla-comment-item\",{\"comment\":[16],\"has_bought_trans\":[32],\"rated_trans\":[32],\"waiting_approval_trans\":[32],\"has_order_trans\":[32]}],[4,\"salla-tab-content\",{\"name\":[1],\"isSelected\":[32],\"getChild\":[64]}],[4,\"salla-tab-header\",{\"name\":[1],\"activeClass\":[1,\"active-class\"],\"height\":[8],\"centered\":[4],\"isSelected\":[32],\"getChild\":[64]}],[4,\"salla-tabs\",{\"backgroundColor\":[1,\"background-color\"],\"vertical\":[4]},[[0,\"tabSelected\",\"onSelectedTab\"]]],[4,\"salla-add-product-button\",{\"channels\":[513],\"subscribedOptions\":[1,\"subscribed-options\"],\"quickBuy\":[1540,\"quick-buy\"],\"quantity\":[514],\"donatingAmount\":[514,\"donating-amount\"],\"notifyOptionsAvailability\":[516,\"notify-options-availability\"],\"productId\":[520,\"product-id\"],\"supportStickyBar\":[516,\"support-sticky-bar\"],\"productStatus\":[513,\"product-status\"],\"productType\":[513,\"product-type\"],\"hasOutOfStockOption\":[32],\"hasSubscribedOptions\":[32],\"selectedOptions\":[32],\"showQuickBuy\":[32]}],[0,\"salla-count-down\",{\"date\":[1],\"boxed\":[4],\"size\":[1],\"color\":[1],\"labeled\":[4],\"endText\":[1,\"end-text\"],\"digits\":[1],\"endOfDay\":[4,\"end-of-day\"],\"daysLabel\":[32],\"hoursLabel\":[32],\"minutesLabel\":[32],\"secondsLabel\":[32],\"endLabel\":[32],\"invalidDate\":[32],\"offerEnded\":[32],\"countInterval\":[32],\"days\":[32],\"hours\":[32],\"minutes\":[32],\"seconds\":[32],\"endCountDown\":[64]}],[0,\"salla-datetime-picker\",{\"value\":[1537],\"required\":[4],\"name\":[513],\"placeholder\":[1],\"allowInput\":[4,\"allow-input\"],\"allowInvalidPreload\":[4,\"allow-invalid-preload\"],\"altFormat\":[1,\"alt-format\"],\"altInput\":[4,\"alt-input\"],\"altInputClass\":[1,\"alt-input-class\"],\"appendTo\":[16],\"ariaDateFormat\":[1,\"aria-date-format\"],\"autoFillDefaultTime\":[4,\"auto-fill-default-time\"],\"clickOpens\":[4,\"click-opens\"],\"closeOnSelect\":[4,\"close-on-select\"],\"conjunction\":[1],\"dateFormat\":[1,\"date-format\"],\"defaultDate\":[8,\"default-date\"],\"defaultHour\":[2,\"default-hour\"],\"defaultMinute\":[2,\"default-minute\"],\"defaultSeconds\":[2,\"default-seconds\"],\"disable\":[16],\"disableMobile\":[4,\"disable-mobile\"],\"enable\":[16],\"enableSeconds\":[4,\"enable-seconds\"],\"enableTime\":[4,\"enable-time\"],\"formatDate\":[16],\"hourIncrement\":[2,\"hour-increment\"],\"inline\":[4],\"locale\":[1],\"maxDate\":[8,\"max-date\"],\"maxTime\":[8,\"max-time\"],\"minDate\":[8,\"min-date\"],\"minTime\":[8,\"min-time\"],\"minuteIncrement\":[2,\"minute-increment\"],\"mode\":[1],\"monthSelectorType\":[1,\"month-selector-type\"],\"nextArrow\":[1,\"next-arrow\"],\"noCalendar\":[4,\"no-calendar\"],\"dateParser\":[16],\"position\":[1],\"positionElement\":[16],\"prevArrow\":[1,\"prev-arrow\"],\"shorthandCurrentMonth\":[4,\"shorthand-current-month\"],\"static\":[4],\"showMonths\":[2,\"show-months\"],\"time_24hr\":[4,\"time_-2-4hr\"],\"weekNumbers\":[4,\"week-numbers\"],\"wrap\":[4]}],[0,\"salla-product-availability\",{\"channels\":[1],\"notifyOptionsAvailability\":[4,\"notify-options-availability\"],\"productId\":[2,\"product-id\"],\"isSubscribed\":[1028,\"is-subscribed\"],\"translationLoaded\":[32],\"title_\":[32],\"isVisitorSubscribed\":[32]}],[0,\"salla-quick-buy\",{\"type\":[1025],\"productId\":[1025,\"product-id\"],\"cartId\":[1025,\"cart-id\"],\"amount\":[1538],\"currency\":[1025],\"options\":[16],\"isRequireShipping\":[1028,\"is-require-shipping\"],\"applePayOnly\":[1028,\"apple-pay-only\"],\"isApplePayActive\":[32],\"quickBuy\":[32]}],[0,\"salla-file-upload\",{\"value\":[1537],\"files\":[513],\"height\":[513],\"cartItemId\":[1,\"cart-item-id\"],\"profileImage\":[516,\"profile-image\"],\"name\":[1537],\"payloadName\":[1,\"payload-name\"],\"accept\":[1537],\"fileId\":[2,\"file-id\"],\"url\":[1025],\"method\":[1],\"formData\":[1,\"form-data\"],\"required\":[4],\"maxFileSize\":[1,\"max-file-size\"],\"disabled\":[4],\"allowDrop\":[4,\"allow-drop\"],\"allowBrowse\":[4,\"allow-browse\"],\"allowPaste\":[4,\"allow-paste\"],\"allowMultiple\":[4,\"allow-multiple\"],\"allowReplace\":[4,\"allow-replace\"],\"allowRevert\":[4,\"allow-revert\"],\"allowRemove\":[4,\"allow-remove\"],\"allowProcess\":[4,\"allow-process\"],\"allowReorder\":[4,\"allow-reorder\"],\"storeAsFile\":[4,\"store-as-file\"],\"forceRevert\":[4,\"force-revert\"],\"maxFilesCount\":[2,\"max-files-count\"],\"maxParallelUploads\":[2,\"max-parallel-uploads\"],\"checkValidity\":[4,\"check-validity\"],\"itemInsertLocation\":[1,\"item-insert-location\"],\"itemInsertInterval\":[2,\"item-insert-interval\"],\"credits\":[4],\"dropOnPage\":[4,\"drop-on-page\"],\"dropOnElement\":[4,\"drop-on-element\"],\"dropValidation\":[4,\"drop-validation\"],\"ignoredFiles\":[16],\"instantUpload\":[1028,\"instant-upload\"],\"chunkUploads\":[4,\"chunk-uploads\"],\"chunkForce\":[4,\"chunk-force\"],\"chunkSize\":[2,\"chunk-size\"],\"chunkRetryDelays\":[16],\"labelDecimalSeparator\":[1,\"label-decimal-separator\"],\"labelThousandsSeparator\":[1,\"label-thousands-separator\"],\"labelIdle\":[1025,\"label-idle\"],\"iconRemove\":[1,\"icon-remove\"],\"iconProcess\":[1,\"icon-process\"],\"iconRetry\":[1,\"icon-retry\"],\"iconUndo\":[1,\"icon-undo\"],\"setOption\":[64]}],[4,\"salla-list-tile\",{\"href\":[1],\"target\":[1]}],[0,\"salla-progress-bar\",{\"donation\":[1],\"target\":[1026],\"value\":[1026],\"height\":[1025],\"header\":[1025],\"stripped\":[1028],\"message\":[1025],\"unit\":[1025],\"color\":[1025]}],[0,\"salla-rating-stars\",{\"name\":[1],\"size\":[1],\"value\":[2],\"reviews\":[2]}],[4,\"salla-slider\",{\"blockTitle\":[513,\"block-title\"],\"listenToThumbnailsOption\":[516,\"listen-to-thumbnails-option\"],\"blockSubtitle\":[513,\"block-subtitle\"],\"displayAllUrl\":[513,\"display-all-url\"],\"arrowsCentered\":[516,\"arrows-centered\"],\"verticalThumbs\":[516,\"vertical-thumbs\"],\"gridThumbs\":[516,\"grid-thumbs\"],\"vertical\":[516],\"autoHeight\":[516,\"auto-height\"],\"showControls\":[516,\"show-controls\"],\"controlsOuter\":[516,\"controls-outer\"],\"showThumbsControls\":[4,\"show-thumbs-controls\"],\"autoPlay\":[4,\"auto-play\"],\"slidesPerView\":[1,\"slides-per-view\"],\"pagination\":[4],\"centered\":[4],\"loop\":[4],\"direction\":[1537],\"type\":[1],\"sliderConfig\":[520,\"slider-config\"],\"thumbsConfig\":[520,\"thumbs-config\"],\"currentIndex\":[32],\"isEnd\":[32],\"isBeginning\":[32],\"swiperScript\":[32],\"displayAllTitle\":[32],\"windowWidth\":[32],\"slideTo\":[64],\"slideNext\":[64],\"slidePrev\":[64],\"slideToLoop\":[64],\"slideNextLoop\":[64],\"slidePrevLoop\":[64],\"slideReset\":[64],\"slideToClosest\":[64],\"update\":[64],\"updateAutoHeight\":[64],\"updateSlides\":[64],\"updateProgress\":[64],\"updateSlidesClasses\":[64],\"getSlides\":[64]}],[0,\"salla-skeleton\",{\"type\":[1],\"width\":[1],\"height\":[1]}],[4,\"salla-placeholder\",{\"icon\":[1],\"alignment\":[1],\"iconSize\":[1,\"icon-size\"],\"translationLoaded\":[32]}],[0,\"salla-tel-input\",{\"phone\":[1025],\"name\":[1],\"countryCode\":[1025,\"country-code\"],\"mobileRequired\":[32],\"countryCodeLabel\":[32],\"mobileLabel\":[32],\"tooShort\":[32],\"tooLong\":[32],\"invalidCountryCode\":[32],\"invalidNumber\":[32],\"errorMap\":[32],\"getValues\":[64],\"isValid\":[64]}],[4,\"salla-modal\",{\"isClosable\":[1028,\"is-closable\"],\"width\":[513],\"position\":[513],\"visible\":[516],\"hasSkeleton\":[516,\"has-skeleton\"],\"isLoading\":[1540,\"is-loading\"],\"subTitleFirst\":[4,\"sub-title-first\"],\"noPadding\":[4,\"no-padding\"],\"subTitle\":[1,\"sub-title\"],\"centered\":[4],\"iconStyle\":[1,\"icon-style\"],\"modalTitle\":[32],\"open\":[64],\"close\":[64],\"setTitle\":[64],\"loading\":[64],\"stopLoading\":[64]},[[0,\"keyup\",\"handleKeyUp\"]]],[0,\"salla-loading\",{\"size\":[8],\"width\":[8],\"color\":[1],\"bgColor\":[1,\"bg-color\"]}],[4,\"salla-button\",{\"shape\":[513],\"color\":[513],\"fill\":[513],\"size\":[513],\"width\":[513],\"loading\":[516],\"disabled\":[516],\"loaderPosition\":[1,\"loader-position\"],\"href\":[1],\"type\":[513],\"load\":[64],\"stop\":[64],\"setText\":[64],\"disable\":[64],\"enable\":[64]}]]],[\"salla-filters-widget.cjs\",[[4,\"salla-filters-widget\",{\"withLoadMore\":[1028,\"with-load-more\"],\"filtersData\":[16],\"option\":[16],\"isOpen\":[32],\"isShowMore\":[32],\"showMoreLabel\":[32],\"showLessLabel\":[32],\"page\":[32],\"setWidgetHeight\":[64],\"reset\":[64],\"showMore\":[64],\"toggleWidget\":[64]}]]]]"), options);
|
|
27
27
|
});
|
|
28
28
|
|
|
29
29
|
exports.setNonce = index.setNonce;
|
|
@@ -15,8 +15,10 @@ export class SallaBottomAlert {
|
|
|
15
15
|
this.storeFeatures = salla.lang.get('common.elements.store_features');
|
|
16
16
|
this.storeDetails = salla.lang.get('common.elements.store_details');
|
|
17
17
|
this.storePrice = salla.lang.get('common.elements.store_price');
|
|
18
|
+
this.theDeveloper = salla.lang.get('common.elements.the_developer');
|
|
18
19
|
this.templateInformation = salla.lang.get('common.elements.template_information');
|
|
19
20
|
this.buyTheTemplate = salla.lang.get('common.elements.buy_the_template');
|
|
21
|
+
this.isRtl = salla.config.get('theme.is_rtl', true);
|
|
20
22
|
this.type = 'popup';
|
|
21
23
|
this.icon = undefined;
|
|
22
24
|
this.message = undefined;
|
|
@@ -31,8 +33,11 @@ export class SallaBottomAlert {
|
|
|
31
33
|
this.buyTheTemplate = salla.lang.get('common.elements.buy_the_template');
|
|
32
34
|
salla.helpers.setNested(salla.lang.messages['ar.trans'], 'common.elements.store_price', 'سعر المتجر');
|
|
33
35
|
salla.helpers.setNested(salla.lang.messages['en.trans'], 'common.elements.store_price', 'Store Price');
|
|
36
|
+
salla.helpers.setNested(salla.lang.messages['ar.trans'], 'common.elements.the_developer', 'المطور');
|
|
37
|
+
salla.helpers.setNested(salla.lang.messages['en.trans'], 'common.elements.the_developer', 'the developer');
|
|
34
38
|
setTimeout(() => {
|
|
35
39
|
this.storePrice = salla.lang.get('common.elements.store_price');
|
|
40
|
+
this.theDeveloper = salla.lang.get('common.elements.the_developer');
|
|
36
41
|
});
|
|
37
42
|
});
|
|
38
43
|
}
|
|
@@ -40,6 +45,9 @@ export class SallaBottomAlert {
|
|
|
40
45
|
return this.modal.open()
|
|
41
46
|
.then(() => this.handleTemplateRequest());
|
|
42
47
|
}
|
|
48
|
+
getDefaultMessage() {
|
|
49
|
+
return this.isRtl ? this.defaultMessage.substring(0, this.defaultMessage.lastIndexOf(" ")) : this.defaultMessage.split(" ").slice(0, -2).join(" ");
|
|
50
|
+
}
|
|
43
51
|
handleTemplateRequest() {
|
|
44
52
|
if (Object.keys(this.templateData).length) {
|
|
45
53
|
return;
|
|
@@ -79,7 +87,7 @@ export class SallaBottomAlert {
|
|
|
79
87
|
h("div", { class: "s-bottom-alert-modal-content-footer" }, this.templateData.price && h("div", { class: "s-bottom-alert-modal-price-wrapper" }, h("div", null, this.storePrice), h("div", { class: "s-bottom-alert-modal-price-wrapper-amount" }, salla.money((_r = this.templateData) === null || _r === void 0 ? void 0 : _r.price))), h("salla-button", { color: 'primary', size: "medium", width: 'wide', href: (_s = this.templateData) === null || _s === void 0 ? void 0 : _s.link }, h("i", { innerHTML: shoppingBag }), this.buyTheTemplate)) : '')] : ''));
|
|
80
88
|
}
|
|
81
89
|
render() {
|
|
82
|
-
return (h(Host, { class: "s-bottom-alert-wrapper" }, h("div", { class: "s-bottom-alert-content" }, h("div", { class: "s-bottom-alert-icon" }, this.icon ? h("i", { class: this.icon }) : h("i", { innerHTML: infoIcon })), h("div", { class: "s-bottom-alert-message" }, this.message ? (this.message) : typeof this.template == 'object' && Object.keys(this.template).length ? (h("span", null, this.
|
|
90
|
+
return (h(Host, { class: "s-bottom-alert-wrapper" }, h("div", { class: "s-bottom-alert-content" }, h("div", { class: "s-bottom-alert-icon" }, this.icon ? h("i", { class: this.icon }) : h("i", { innerHTML: infoIcon })), h("div", { class: "s-bottom-alert-message" }, this.message ? (this.message) : typeof this.template == 'object' && Object.keys(this.template).length ? (h("span", null, this.getDefaultMessage(), " ", h("span", { class: "s-bottom-alert-message-highlight" }, this.template.developer && this.template.developer.name ? this.template.developer.name : this.theDeveloper), " ", h("span", { class: "s-bottom-alert-message-splitter" }, "|"), " ", this.storePrice, ":", " ", h("span", { class: "s-bottom-alert-message-highlight" }, salla.money(this.template.price)))) : (this.defaultMessage)), this.type !== 'banner' ? (h("div", { class: "s-bottom-alert-action" }, h("salla-button", { href: this.actionUrl, size: "medium", onClick: () => this.handleAction(), width: "normal" }, this.actionLabel ? this.actionLabel : this.defaultActionLabel))) : null, this.type === 'popup' ? this.popup() : null)));
|
|
83
91
|
}
|
|
84
92
|
static get is() { return "salla-bottom-alert"; }
|
|
85
93
|
static get originalStyleUrls() {
|
|
@@ -193,8 +201,10 @@ export class SallaBottomAlert {
|
|
|
193
201
|
"storeFeatures": {},
|
|
194
202
|
"storeDetails": {},
|
|
195
203
|
"storePrice": {},
|
|
204
|
+
"theDeveloper": {},
|
|
196
205
|
"templateInformation": {},
|
|
197
|
-
"buyTheTemplate": {}
|
|
206
|
+
"buyTheTemplate": {},
|
|
207
|
+
"isRtl": {}
|
|
198
208
|
};
|
|
199
209
|
}
|
|
200
210
|
static get elementRef() { return "host"; }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"salla-bottom-alert.js","sourceRoot":"","sources":["../../../src/components/salla-bottom-alert/salla-bottom-alert.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAA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AK,CAAC,CAC5B,CACF,CACR,CAAC,CAAC,CAAC,CACF,IAAI,CAAC,cAAc,CACpB,CACG;QACL,IAAI,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,CACxB,WAAK,KAAK,EAAC,uBAAuB;UAChC,oBACE,IAAI,EAAE,IAAI,CAAC,SAAS,EACpB,IAAI,EAAC,QAAQ,EACb,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,YAAY,EAAE,EAClC,KAAK,EAAC,QAAQ,IAEb,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,kBAAkB,CACjD,CACX,CACP,CAAC,CAAC,CAAC,IAAI;QAEN,IAAI,CAAC,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,IAAI,CAEzC,CACD,CACR,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAEF","sourcesContent":["import { Component, Host, h, Element, Prop, State } from '@stencil/core';\nimport infoIcon from '../../assets/svg/info.svg';\nimport shoppingBag from '../../assets/svg/shopping-bag2.svg';\n@Component({\n tag: 'salla-bottom-alert',\n styleUrl: 'salla-bottom-alert.scss',\n})\nexport class SallaBottomAlert {\n constructor() {\n salla.lang.onLoaded(() => {\n this.defaultMessage = salla.lang.get('common.elements.experimental_and_available_store');\n this.defaultActionLabel = salla.lang.get('common.elements.know_more');\n this.storeFeatures = salla.lang.get('common.elements.store_features');\n this.storeDetails = salla.lang.get('common.elements.store_details');\n this.templateInformation = salla.lang.get('common.elements.template_information');\n this.buyTheTemplate = salla.lang.get('common.elements.buy_the_template');\n salla.helpers.setNested(salla.lang.messages['ar.trans'], 'common.elements.store_price', 'سعر المتجر');\n salla.helpers.setNested(salla.lang.messages['en.trans'], 'common.elements.store_price', 'Store Price');\n setTimeout(() => {\n this.storePrice = salla.lang.get('common.elements.store_price');\n });\n });\n }\n\n private modal: HTMLSallaModalElement;\n @Element() host: HTMLElement;\n\n @State() storeId: string = salla.config.get('store.id')\n @State() template: any = salla.config.get('store.template')\n @State() loading: boolean = false\n @State() templateData: any = {}\n @State() defaultMessage: string = salla.lang.get('common.elements.experimental_and_available_store');\n @State() defaultActionLabel: string = salla.lang.get('common.elements.know_more');\n @State() storeFeatures: string = salla.lang.get('common.elements.store_features');\n @State() storeDetails: string = salla.lang.get('common.elements.store_details');\n @State() storePrice: string = salla.lang.get('common.elements.store_price');\n @State() templateInformation: string = salla.lang.get('common.elements.template_information');\n @State() buyTheTemplate: string = salla.lang.get('common.elements.buy_the_template');\n /**\n * Alert Type\n * */\n @Prop({ reflect: true }) type: 'link' | 'popup' | 'banner' = 'popup';\n\n /**\n * Alert Icon class from salla icons library - ex: sicon-user\n * */\n @Prop({ reflect: true }) icon: string;\n\n /**\n * Alert Message\n * */\n @Prop({ reflect: true }) message: string;\n\n /**\n * Button url - used when type is link\n * */\n @Prop({ reflect: true }) actionUrl: string;\n\n /**\n * Button label - used when type is link and popup\n * */\n @Prop({ reflect: true }) actionLabel: string;\n\n private open() {\n return this.modal.open()\n .then(() => this.handleTemplateRequest())\n }\n\n private handleTemplateRequest() {\n if (Object.keys(this.templateData).length) {\n return;\n }\n this.modal.loading()\n return salla.api.request(`/store/template`, {}, 'get', { 'Store-Identifier': this.storeId })\n .then((res) => {\n this.modal.setTitle(this.templateInformation)\n this.templateData = res.data\n this.modal.stopLoading()\n })\n .catch(() => {\n this.modal.close()\n })\n }\n\n private handleAction() {\n if (this.type === 'link') {\n window.location.href = this.actionUrl;\n }\n\n if (this.type === 'popup') {\n this.open()\n }\n }\n\n popup() {\n return (\n <salla-modal class=\"s-bottom-alert-modal\" ref={modal => this.modal = modal} no-padding>\n {Object.keys(this.templateData).length ?\n [<div class=\"s-bottom-alert-modal-inner s-scrollbar\">\n {Array.isArray(this.templateData?.screenshots) && this.templateData?.screenshots?.length ? <div class=\"s-bottom-alert-modal-cover\">\n <img src={this.templateData?.screenshots[0]} alt=\"\" />\n </div> : ''}\n <div class={{\"s-bottom-alert-modal-content\": true, \"s-bottom-alert-modal-content-extra-padding\":this.templateData.price}} >\n {this.templateData?.description ?\n [<div class=\"s-bottom-alert-modal-content-title\">\n {this.storeDetails}\n </div>,\n <div class=\"s-bottom-alert-modal-content-description\" innerHTML={this.templateData?.description}></div>,\n <hr />\n ] : ''}\n {this.templateData?.features ? [<div class=\"s-bottom-alert-modal-content-title\">\n {this.storeFeatures}\n </div>,\n <div class=\"s-bottom-alert-modal-content-features\" innerHTML={this.templateData?.features}></div>\n ] : ''}\n {Array.isArray(this.templateData?.screenshots) && this.templateData?.screenshots?.length > 1 ?\n <salla-slider id='template-screenshots' type='carousel' class=\"s-bottom-alert-modal-content-screenshots\">\n <div slot='items'>\n {this.templateData?.screenshots.map((screenshot) => {\n return <div class=\"s-bottom-alert-modal-content-screenshot\">\n <img src={screenshot} alt=\"\" />\n </div>\n })}\n </div>\n </salla-slider>\n : ''}\n\n {this.templateData?.extra_info ?\n <div class=\"s-bottom-alert-modal-content-description\" innerHTML={this.templateData?.description}></div>\n : ''}\n </div>\n {this.templateData?.link ?\n <div class=\"s-bottom-alert-modal-content-footer\">\n {this.templateData.price && <div class=\"s-bottom-alert-modal-price-wrapper\">\n <div>\n {this.storePrice}\n </div>\n <div class=\"s-bottom-alert-modal-price-wrapper-amount\">\n {salla.money(this.templateData?.price)}\n </div>\n </div>}\n <salla-button\n color='primary'\n size=\"medium\"\n width='wide'\n href={this.templateData?.link}\n >\n <i innerHTML={shoppingBag}></i>\n {this.buyTheTemplate}\n </salla-button>\n </div> : ''\n }\n </div>] : ''\n }\n\n </salla-modal>\n )\n }\n render() {\n return (\n <Host class=\"s-bottom-alert-wrapper\">\n <div class=\"s-bottom-alert-content\">\n <div class=\"s-bottom-alert-icon\">\n {this.icon ? <i class={this.icon}></i> : <i innerHTML={infoIcon}></i>}\n </div>\n <div class=\"s-bottom-alert-message\">\n {this.message ? ( this.message ) : typeof this.template == 'object' && Object.keys(this.template).length ? (\n <span>\n {this.defaultMessage.substring(0, this.defaultMessage.lastIndexOf(\" \"))}{\" \"}\n <span class=\"s-bottom-alert-message-highlight\">\n {this.template.developer}\n </span>{\" \"}\n <span class=\"s-bottom-alert-message-splitter\">|</span> {this.storePrice}:{\" \"}\n <span class=\"s-bottom-alert-message-highlight\">\n {salla.money(this.template.price)}\n </span>\n </span>\n ) : (\n this.defaultMessage\n )}\n </div>\n {this.type !== 'banner' ? (\n <div class=\"s-bottom-alert-action\">\n <salla-button\n href={this.actionUrl}\n size=\"medium\"\n onClick={() => this.handleAction()}\n width=\"normal\"\n >\n {this.actionLabel ? this.actionLabel : this.defaultActionLabel}\n </salla-button>\n </div>\n ) : null}\n {\n this.type === 'popup' ? this.popup() : null\n }\n </div>\n </Host>\n );\n }\n\n}\n"]}
|
|
1
|
+
{"version":3,"file":"salla-bottom-alert.js","sourceRoot":"","sources":["../../../src/components/salla-bottom-alert/salla-bottom-alert.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACzE,OAAO,QAAQ,MAAM,2BAA2B,CAAC;AACjD,OAAO,WAAW,MAAM,oCAAoC,CAAC;AAK7D,MAAM,OAAO,gBAAgB;EAC3B;mBAsB2B,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,UAAU,CAAC;oBAC9B,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,gBAAgB,CAAC;mBAC/B,KAAK;wBACJ,EAAE;0BACG,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,kDAAkD,CAAC;8BAC9D,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,2BAA2B,CAAC;yBAChD,KAAK,C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} from '@stencil/core';\nimport infoIcon from '../../assets/svg/info.svg';\nimport shoppingBag from '../../assets/svg/shopping-bag2.svg';\n@Component({\n tag: 'salla-bottom-alert',\n styleUrl: 'salla-bottom-alert.scss',\n})\nexport class SallaBottomAlert {\n constructor() {\n salla.lang.onLoaded(() => {\n this.defaultMessage = salla.lang.get('common.elements.experimental_and_available_store');\n this.defaultActionLabel = salla.lang.get('common.elements.know_more');\n this.storeFeatures = salla.lang.get('common.elements.store_features');\n this.storeDetails = salla.lang.get('common.elements.store_details');\n this.templateInformation = salla.lang.get('common.elements.template_information');\n this.buyTheTemplate = salla.lang.get('common.elements.buy_the_template');\n salla.helpers.setNested(salla.lang.messages['ar.trans'], 'common.elements.store_price', 'سعر المتجر');\n salla.helpers.setNested(salla.lang.messages['en.trans'], 'common.elements.store_price', 'Store Price');\n salla.helpers.setNested(salla.lang.messages['ar.trans'], 'common.elements.the_developer', 'المطور');\n salla.helpers.setNested(salla.lang.messages['en.trans'], 'common.elements.the_developer', 'the developer');\n setTimeout(() => {\n this.storePrice = salla.lang.get('common.elements.store_price');\n this.theDeveloper = salla.lang.get('common.elements.the_developer');\n });\n });\n }\n\n private modal: HTMLSallaModalElement;\n @Element() host: HTMLElement;\n\n @State() storeId: string = salla.config.get('store.id')\n @State() template: any = salla.config.get('store.template')\n @State() loading: boolean = false\n @State() templateData: any = {}\n @State() defaultMessage: string = salla.lang.get('common.elements.experimental_and_available_store');\n @State() defaultActionLabel: string = salla.lang.get('common.elements.know_more');\n @State() storeFeatures: string = salla.lang.get('common.elements.store_features');\n @State() storeDetails: string = salla.lang.get('common.elements.store_details');\n @State() storePrice: string = salla.lang.get('common.elements.store_price');\n @State() theDeveloper: string = salla.lang.get('common.elements.the_developer');\n @State() templateInformation: string = salla.lang.get('common.elements.template_information');\n @State() buyTheTemplate: string = salla.lang.get('common.elements.buy_the_template');\n @State() isRtl: boolean = salla.config.get('theme.is_rtl', true);\n /**\n * Alert Type\n * */\n @Prop({ reflect: true }) type: 'link' | 'popup' | 'banner' = 'popup';\n\n /**\n * Alert Icon class from salla icons library - ex: sicon-user\n * */\n @Prop({ reflect: true }) icon: string;\n\n /**\n * Alert Message\n * */\n @Prop({ reflect: true }) message: string;\n\n /**\n * Button url - used when type is link\n * */\n @Prop({ reflect: true }) actionUrl: string;\n\n /**\n * Button label - used when type is link and popup\n * */\n @Prop({ reflect: true }) actionLabel: string;\n\n private open() {\n return this.modal.open()\n .then(() => this.handleTemplateRequest())\n }\n private getDefaultMessage(){\n return this.isRtl ? this.defaultMessage.substring(0, this.defaultMessage.lastIndexOf(\" \")) : this.defaultMessage.split(\" \").slice(0, -2).join(\" \");\n }\n private handleTemplateRequest() {\n if (Object.keys(this.templateData).length) {\n return;\n }\n this.modal.loading()\n return salla.api.request(`/store/template`, {}, 'get', { 'Store-Identifier': this.storeId })\n .then((res) => {\n this.modal.setTitle(this.templateInformation)\n this.templateData = res.data\n this.modal.stopLoading()\n })\n .catch(() => {\n this.modal.close()\n })\n }\n\n private handleAction() {\n if (this.type === 'link') {\n window.location.href = this.actionUrl;\n }\n\n if (this.type === 'popup') {\n this.open()\n }\n }\n\n popup() {\n return (\n <salla-modal class=\"s-bottom-alert-modal\" ref={modal => this.modal = modal} no-padding>\n {Object.keys(this.templateData).length ?\n [<div class=\"s-bottom-alert-modal-inner s-scrollbar\">\n {Array.isArray(this.templateData?.screenshots) && this.templateData?.screenshots?.length ? <div class=\"s-bottom-alert-modal-cover\">\n <img src={this.templateData?.screenshots[0]} alt=\"\" />\n </div> : ''}\n <div class={{\"s-bottom-alert-modal-content\": true, \"s-bottom-alert-modal-content-extra-padding\":this.templateData.price}} >\n {this.templateData?.description ?\n [<div class=\"s-bottom-alert-modal-content-title\">\n {this.storeDetails}\n </div>,\n <div class=\"s-bottom-alert-modal-content-description\" innerHTML={this.templateData?.description}></div>,\n <hr />\n ] : ''}\n {this.templateData?.features ? [<div class=\"s-bottom-alert-modal-content-title\">\n {this.storeFeatures}\n </div>,\n <div class=\"s-bottom-alert-modal-content-features\" innerHTML={this.templateData?.features}></div>\n ] : ''}\n {Array.isArray(this.templateData?.screenshots) && this.templateData?.screenshots?.length > 1 ?\n <salla-slider id='template-screenshots' type='carousel' class=\"s-bottom-alert-modal-content-screenshots\">\n <div slot='items'>\n {this.templateData?.screenshots.map((screenshot) => {\n return <div class=\"s-bottom-alert-modal-content-screenshot\">\n <img src={screenshot} alt=\"\" />\n </div>\n })}\n </div>\n </salla-slider>\n : ''}\n\n {this.templateData?.extra_info ?\n <div class=\"s-bottom-alert-modal-content-description\" innerHTML={this.templateData?.description}></div>\n : ''}\n </div>\n {this.templateData?.link ?\n <div class=\"s-bottom-alert-modal-content-footer\">\n {this.templateData.price && <div class=\"s-bottom-alert-modal-price-wrapper\">\n <div>\n {this.storePrice}\n </div>\n <div class=\"s-bottom-alert-modal-price-wrapper-amount\">\n {salla.money(this.templateData?.price)}\n </div>\n </div>}\n <salla-button\n color='primary'\n size=\"medium\"\n width='wide'\n href={this.templateData?.link}\n >\n <i innerHTML={shoppingBag}></i>\n {this.buyTheTemplate}\n </salla-button>\n </div> : ''\n }\n </div>] : ''\n }\n\n </salla-modal>\n )\n }\n render() {\n return (\n <Host class=\"s-bottom-alert-wrapper\">\n <div class=\"s-bottom-alert-content\">\n <div class=\"s-bottom-alert-icon\">\n {this.icon ? <i class={this.icon}></i> : <i innerHTML={infoIcon}></i>}\n </div>\n <div class=\"s-bottom-alert-message\">\n {this.message ? ( this.message ) : typeof this.template == 'object' && Object.keys(this.template).length ? (\n <span>\n {this.getDefaultMessage()}{\" \"}\n <span class=\"s-bottom-alert-message-highlight\">\n {this.template.developer && this.template.developer.name ? this.template.developer.name : this.theDeveloper}\n </span>{\" \"}\n <span class=\"s-bottom-alert-message-splitter\">|</span> {this.storePrice}:{\" \"}\n <span class=\"s-bottom-alert-message-highlight\">\n {salla.money(this.template.price)}\n </span>\n </span>\n ) : (\n this.defaultMessage\n )}\n </div>\n {this.type !== 'banner' ? (\n <div class=\"s-bottom-alert-action\">\n <salla-button\n href={this.actionUrl}\n size=\"medium\"\n onClick={() => this.handleAction()}\n width=\"normal\"\n >\n {this.actionLabel ? this.actionLabel : this.defaultActionLabel}\n </salla-button>\n </div>\n ) : null}\n {\n this.type === 'popup' ? this.popup() : null\n }\n </div>\n </Host>\n );\n }\n\n}\n"]}
|
|
@@ -47,13 +47,63 @@ export class SallaFilters {
|
|
|
47
47
|
}
|
|
48
48
|
connectedCallback() {
|
|
49
49
|
try {
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
const searchParams = new URLSearchParams(window.location.search);
|
|
51
|
+
const filterObject = {};
|
|
52
|
+
for (const [key, value] of searchParams.entries()) {
|
|
53
|
+
const keys = key.replace(/\]/g, '').split('[');
|
|
54
|
+
keys.reduce((obj, keyPart, index, array) => {
|
|
55
|
+
const isLastKey = index === array.length - 1;
|
|
56
|
+
const finalKey = /^\d+$/.test(keyPart) ? parseInt(keyPart, 10) : keyPart;
|
|
57
|
+
if (isLastKey) {
|
|
58
|
+
if (/^\d+$/.test(keyPart)) {
|
|
59
|
+
this.addObjectValue(obj, array[index - 1], value);
|
|
60
|
+
return obj[array[index - 1]];
|
|
61
|
+
}
|
|
62
|
+
else if (obj[finalKey]) {
|
|
63
|
+
obj[finalKey] = [obj[finalKey], value];
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
obj[finalKey] = value;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
obj[finalKey] = obj[finalKey] || {};
|
|
71
|
+
}
|
|
72
|
+
return obj[finalKey];
|
|
73
|
+
}, filterObject);
|
|
74
|
+
}
|
|
75
|
+
this.filtersData = this.flattenObject(filterObject["filters"]) || {};
|
|
52
76
|
}
|
|
53
77
|
catch (e) {
|
|
54
78
|
salla.logger.warn('failed to get filters from url', e.message);
|
|
55
79
|
}
|
|
56
80
|
}
|
|
81
|
+
flattenObject(obj) {
|
|
82
|
+
for (const key in obj) {
|
|
83
|
+
if (typeof obj[key] === 'object') {
|
|
84
|
+
if (obj[key][key] && Array.isArray(obj[key][key])) {
|
|
85
|
+
obj[key] = obj[key][key];
|
|
86
|
+
}
|
|
87
|
+
else {
|
|
88
|
+
this.flattenObject(obj[key]);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
return obj;
|
|
93
|
+
}
|
|
94
|
+
addObjectValue(obj, key, value) {
|
|
95
|
+
if (obj.hasOwnProperty(key)) {
|
|
96
|
+
if (Array.isArray(obj[key])) {
|
|
97
|
+
obj[key].push(value);
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
obj[key] = [obj[key], value];
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
else {
|
|
104
|
+
obj[key] = [value];
|
|
105
|
+
}
|
|
106
|
+
}
|
|
57
107
|
/**
|
|
58
108
|
* Method to get filter data.
|
|
59
109
|
*/
|
|
@@ -71,7 +121,15 @@ export class SallaFilters {
|
|
|
71
121
|
setTimeout(() => {
|
|
72
122
|
var _a;
|
|
73
123
|
if (hasFilters) {
|
|
74
|
-
|
|
124
|
+
let url = new URL(window.location.href);
|
|
125
|
+
for (const [key] of url.searchParams.entries()) {
|
|
126
|
+
if (key.startsWith("filters")) {
|
|
127
|
+
url.searchParams.delete(key);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
let encodedFilterValues = this.encodeFilters(this.filtersData);
|
|
131
|
+
url.search = url.search ? url.search.split("&filters")[0] + "&" + encodedFilterValues : `?${encodedFilterValues}`;
|
|
132
|
+
window.history.pushState({}, '', url.href);
|
|
75
133
|
}
|
|
76
134
|
else {
|
|
77
135
|
let url = new URL(window.location.href);
|
|
@@ -82,15 +140,50 @@ export class SallaFilters {
|
|
|
82
140
|
this.changed.emit(this.filtersData);
|
|
83
141
|
}, 300);
|
|
84
142
|
}
|
|
143
|
+
encodeFilters(filters, parentKey = 'filters') {
|
|
144
|
+
const encodedFilters = [];
|
|
145
|
+
for (const key in filters) {
|
|
146
|
+
if (Object.prototype.hasOwnProperty.call(filters, key)) {
|
|
147
|
+
const value = filters[key];
|
|
148
|
+
const fullKey = parentKey ? `${parentKey}[${key}]` : key;
|
|
149
|
+
if (Array.isArray(value)) {
|
|
150
|
+
for (let i = 0; i < value.length; i++) {
|
|
151
|
+
encodedFilters.push(`${fullKey}[${i}]=${value[i]}`);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
else if (typeof value === 'object' && value !== null) {
|
|
155
|
+
encodedFilters.push(this.encodeFilters(value, fullKey));
|
|
156
|
+
}
|
|
157
|
+
else {
|
|
158
|
+
// const encodedKey = encodeURIComponent(fullKey);
|
|
159
|
+
// const encodedValue = encodeURIComponent(value);
|
|
160
|
+
let result = `${fullKey}=${value}`;
|
|
161
|
+
encodedFilters.push(result);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
return encodedFilters.join('&');
|
|
166
|
+
}
|
|
167
|
+
;
|
|
85
168
|
/**
|
|
86
169
|
* Reset selected filters.
|
|
87
170
|
*/
|
|
88
171
|
async resetFilters() {
|
|
172
|
+
this.removeFiltersQueryParams();
|
|
89
173
|
this.filtersData = {};
|
|
90
174
|
this.host.childNodes.forEach((widget) => widget.reset && widget.reset());
|
|
91
175
|
salla.event.emit('salla-filters::reset');
|
|
92
176
|
return this.applyFilters();
|
|
93
177
|
}
|
|
178
|
+
removeFiltersQueryParams() {
|
|
179
|
+
const searchParams = new URLSearchParams(window.location.search);
|
|
180
|
+
const newUrl = Array.from(searchParams.keys())
|
|
181
|
+
.filter(key => !key.startsWith('filters['))
|
|
182
|
+
.map(key => `${encodeURIComponent(key)}=${encodeURIComponent(searchParams.get(key))}`)
|
|
183
|
+
.join('&');
|
|
184
|
+
const finalUrl = newUrl ? `${window.location.pathname}?${newUrl}` : window.location.pathname;
|
|
185
|
+
window.history.pushState({}, '', finalUrl);
|
|
186
|
+
}
|
|
94
187
|
/**
|
|
95
188
|
* @param {{target:HTMLInputElement}} event
|
|
96
189
|
* @param option
|