@salla.sa/twilight-components 2.10.2 → 2.10.3
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-0a1abeac.js → app-globals-90c8a4ae.js} +1 -1
- package/dist/cjs/index-1d2b3370.js +2 -6
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/{salla-button_35.cjs.entry.js → salla-button_37.cjs.entry.js} +357 -5
- package/dist/cjs/twilight.cjs.js +2 -2
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/salla-datetime-picker/salla-datetime-picker.js +3 -0
- package/dist/collection/components/salla-map/salla-map.js +39 -4
- package/dist/collection/components/salla-product-options/interfaces.js +25 -0
- package/dist/collection/components/salla-product-options/salla-product-options.css +0 -0
- package/dist/collection/components/salla-product-options/salla-product-options.js +425 -0
- package/dist/collection/components/salla-slider/salla-slider.js +10 -0
- package/dist/collection/components/salla-user-menu/salla-user-menu.js +4 -2
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +2 -1
- package/dist/components/salla-conditional-fields.js +1 -94
- package/dist/{esm/salla-conditional-fields.entry.js → components/salla-conditional-fields2.js} +22 -7
- package/dist/components/salla-datetime-picker2.js +3 -0
- package/dist/components/salla-map.js +38 -3
- package/dist/components/salla-product-options.d.ts +11 -0
- package/dist/components/salla-product-options.js +274 -0
- package/dist/components/salla-slider2.js +10 -0
- package/dist/components/salla-user-menu.js +4 -2
- package/dist/esm/{app-globals-d3b05078.js → app-globals-85b49bd0.js} +1 -1
- package/dist/esm/index-f1d446ac.js +2 -6
- package/dist/esm/loader.js +2 -2
- package/dist/esm/{salla-button_35.entry.js → salla-button_37.entry.js} +356 -6
- package/dist/esm/twilight.js +2 -2
- package/dist/esm-es5/{app-globals-d3b05078.js → app-globals-85b49bd0.js} +2 -2
- package/dist/esm-es5/index-f1d446ac.js +2 -2
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/{salla-button_35.entry.js → salla-button_37.entry.js} +4 -4
- package/dist/esm-es5/twilight.js +1 -1
- package/dist/twilight/{p-9d458384.entry.js → p-01c0588c.entry.js} +5 -5
- package/dist/twilight/{p-95180d48.system.entry.js → p-3e3f8778.system.entry.js} +7 -7
- package/dist/twilight/p-48244f0e.system.js +4 -0
- package/dist/twilight/{p-70235d2a.system.js → p-67eca51d.system.js} +2 -2
- package/dist/twilight/{p-1b14dc52.js → p-d910f09b.js} +2 -2
- package/dist/twilight/twilight.esm.js +1 -1
- package/dist/twilight/twilight.js +1 -1
- package/dist/types/components/salla-map/salla-map.d.ts +3 -0
- package/dist/types/components/salla-product-options/interfaces.d.ts +133 -0
- package/dist/types/components/salla-product-options/salla-product-options.d.ts +89 -0
- package/dist/types/components/salla-slider/salla-slider.d.ts +3 -0
- package/dist/types/components/salla-user-menu/salla-user-menu.d.ts +1 -0
- package/dist/types/components.d.ts +77 -0
- package/package.json +5 -4
- package/dist/cjs/salla-conditional-fields.cjs.entry.js +0 -88
- package/dist/esm-es5/salla-conditional-fields.entry.js +0 -4
- package/dist/twilight/p-5d3cb89c.system.entry.js +0 -4
- package/dist/twilight/p-6a3883ae.entry.js +0 -4
- package/dist/twilight/p-97f66179.system.js +0 -4
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import { Component, Host, h, Prop, Method, State, Event } from '@stencil/core';
|
|
4
|
+
import { Component, Host, h, Prop, Method, State, Event, Element } from '@stencil/core';
|
|
5
5
|
import Location from '../../assets/svg/location.svg';
|
|
6
6
|
import Edit from '../../assets/svg/edit.svg';
|
|
7
7
|
import CurrentLocation from '../../assets/svg/location-target.svg';
|
|
@@ -17,6 +17,7 @@ export class SallaMap {
|
|
|
17
17
|
this.locateButtonTitle = 'Locate';
|
|
18
18
|
this.locateButtonEdit = 'Edit';
|
|
19
19
|
this.searchInputValue = null;
|
|
20
|
+
this.geolocationError = false;
|
|
20
21
|
/**
|
|
21
22
|
* Disable or enable actions
|
|
22
23
|
*/
|
|
@@ -125,8 +126,19 @@ export class SallaMap {
|
|
|
125
126
|
address: this.searchInputValue ? this.searchInputValue : null,
|
|
126
127
|
});
|
|
127
128
|
});
|
|
128
|
-
|
|
129
|
-
|
|
129
|
+
if (!this.host.hasAttribute('lat') && !this.host.hasAttribute('lng')) {
|
|
130
|
+
this.getCurrentLocation();
|
|
131
|
+
if (this.geolocationError) {
|
|
132
|
+
this.map.setCenter({
|
|
133
|
+
lat: this.lat,
|
|
134
|
+
lng: this.lng,
|
|
135
|
+
});
|
|
136
|
+
this.marker.setPosition({
|
|
137
|
+
lat: this.lat,
|
|
138
|
+
lng: this.lng,
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
}
|
|
130
142
|
});
|
|
131
143
|
}
|
|
132
144
|
getCurrentLocation() {
|
|
@@ -146,7 +158,28 @@ export class SallaMap {
|
|
|
146
158
|
lng: position.coords.longitude,
|
|
147
159
|
address: this.searchInputValue ? this.searchInputValue : null,
|
|
148
160
|
});
|
|
149
|
-
});
|
|
161
|
+
}, this.handleLocationError.bind(this));
|
|
162
|
+
}
|
|
163
|
+
else {
|
|
164
|
+
salla.log('Geolocation is not supported by this browser.');
|
|
165
|
+
this.geolocationError = true;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
handleLocationError(error) {
|
|
169
|
+
this.geolocationError = true;
|
|
170
|
+
switch (error.code) {
|
|
171
|
+
case error.PERMISSION_DENIED:
|
|
172
|
+
salla.log('User denied the request for Geolocation.');
|
|
173
|
+
break;
|
|
174
|
+
case error.POSITION_UNAVAILABLE:
|
|
175
|
+
salla.log('Location information is unavailable.');
|
|
176
|
+
break;
|
|
177
|
+
case error.TIMEOUT:
|
|
178
|
+
salla.log('The request to get user location timed out.');
|
|
179
|
+
break;
|
|
180
|
+
case error.UNKNOWN_ERROR:
|
|
181
|
+
salla.log('An unknown error occurred.');
|
|
182
|
+
break;
|
|
150
183
|
}
|
|
151
184
|
}
|
|
152
185
|
/**
|
|
@@ -347,6 +380,7 @@ export class SallaMap {
|
|
|
347
380
|
"locateButtonTitle": {},
|
|
348
381
|
"locateButtonEdit": {},
|
|
349
382
|
"searchInputValue": {},
|
|
383
|
+
"geolocationError": {},
|
|
350
384
|
"searchInput": {},
|
|
351
385
|
"mapElement": {}
|
|
352
386
|
}; }
|
|
@@ -417,4 +451,5 @@ export class SallaMap {
|
|
|
417
451
|
}
|
|
418
452
|
}
|
|
419
453
|
}; }
|
|
454
|
+
static get elementRef() { return "host"; }
|
|
420
455
|
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Crafted with ❤ by Salla
|
|
3
|
+
*/
|
|
4
|
+
export var DisplayType;
|
|
5
|
+
(function (DisplayType) {
|
|
6
|
+
DisplayType["COLOR"] = "color";
|
|
7
|
+
DisplayType["DATE"] = "date";
|
|
8
|
+
DisplayType["DATETIME"] = "datetime";
|
|
9
|
+
DisplayType["DONATION"] = "donation";
|
|
10
|
+
DisplayType["IMAGE"] = "image";
|
|
11
|
+
DisplayType["MULTIPLE_OPTIONS"] = "multiple-options";
|
|
12
|
+
DisplayType["NUMBER"] = "number";
|
|
13
|
+
DisplayType["SINGLE_OPTION"] = "single-option";
|
|
14
|
+
DisplayType["SPLITTER"] = "splitter";
|
|
15
|
+
DisplayType["TEXT"] = "text";
|
|
16
|
+
DisplayType["TEXTAREA"] = "textarea";
|
|
17
|
+
DisplayType["THUMBNAIL"] = "thumbnail";
|
|
18
|
+
DisplayType["TIME"] = "time";
|
|
19
|
+
DisplayType["RADIO"] = "radio";
|
|
20
|
+
DisplayType["CHECKBOX"] = "checkbox";
|
|
21
|
+
})(DisplayType || (DisplayType = {}));
|
|
22
|
+
export var Currency;
|
|
23
|
+
(function (Currency) {
|
|
24
|
+
Currency["Sar"] = "SAR";
|
|
25
|
+
})(Currency || (Currency = {}));
|
|
File without changes
|
|
@@ -0,0 +1,425 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Crafted with ❤ by Salla
|
|
3
|
+
*/
|
|
4
|
+
import { Component, Prop, h, State, Host, Event } from '@stencil/core';
|
|
5
|
+
import { DisplayType } from './interfaces';
|
|
6
|
+
import CheckCircleIcon from '../../assets/svg/check.svg';
|
|
7
|
+
import CameraIcon from '../../assets/svg/camera.svg';
|
|
8
|
+
export class SallaProductOptions {
|
|
9
|
+
constructor() {
|
|
10
|
+
this.options = [];
|
|
11
|
+
this.uploadedImage = undefined;
|
|
12
|
+
this.outOfStockText = salla.lang.get("pages.products.out_of_stock");
|
|
13
|
+
this.donationAmount = salla.lang.get('pages.products.donation_amount');
|
|
14
|
+
/**
|
|
15
|
+
* The id of the product to which the options are going to be fetched for.
|
|
16
|
+
*/
|
|
17
|
+
this.productId = salla.config.get('page.id');
|
|
18
|
+
if (this.product) {
|
|
19
|
+
this.setProductDetail(JSON.parse(this.product));
|
|
20
|
+
}
|
|
21
|
+
else if (this.productId) {
|
|
22
|
+
this.fetchProductOptions();
|
|
23
|
+
}
|
|
24
|
+
salla.lang.onLoaded(() => {
|
|
25
|
+
this.outOfStockText = salla.lang.get("pages.products.out_of_stock");
|
|
26
|
+
this.donationAmount = salla.lang.get('pages.products.donation_amount');
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
//todo:: typo here, but I think we will drop it anyway😌
|
|
30
|
+
handleMultiSelectFieldInput() {
|
|
31
|
+
var checkedBoxes = this.multipleOptionDom.querySelectorAll('input[type="checkbox"]:checked');
|
|
32
|
+
var multiSelectedItems = [];
|
|
33
|
+
for (let checkbox of checkedBoxes) {
|
|
34
|
+
multiSelectedItems.push(checkbox.value);
|
|
35
|
+
}
|
|
36
|
+
this.itemsSelected.emit(multiSelectedItems);
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Image Selection
|
|
40
|
+
*/
|
|
41
|
+
setProductDetail(detail) {
|
|
42
|
+
this.productDetail = detail;
|
|
43
|
+
this.options = detail.options;
|
|
44
|
+
}
|
|
45
|
+
fetchProductOptions() {
|
|
46
|
+
return salla.api.product.getDetail(this.productId, ['options']).then(resp => {
|
|
47
|
+
this.setProductDetail(resp.data);
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
getDisplayForType(option) {
|
|
51
|
+
if (this[`${option.type}Option`]) {
|
|
52
|
+
return this[`${option.type}Option`](option);
|
|
53
|
+
}
|
|
54
|
+
if (option.type === DisplayType.MULTIPLE_OPTIONS) {
|
|
55
|
+
return this.multipleOptions(option);
|
|
56
|
+
}
|
|
57
|
+
if (option.type === DisplayType.SINGLE_OPTION) {
|
|
58
|
+
return this.singleOption(option);
|
|
59
|
+
}
|
|
60
|
+
salla.log(`Couldn't find options type(${option.type})😢`);
|
|
61
|
+
return '';
|
|
62
|
+
}
|
|
63
|
+
render() {
|
|
64
|
+
if (this.options.length == 0) {
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
return (h(Host, { class: "s-product-options-wrapper" },
|
|
68
|
+
h("salla-conditional-fields", null, this.options.map((option) => h("div", { class: "s-product-options-option-container" }, option.name == 'splitter' ?
|
|
69
|
+
this.splitterOption()
|
|
70
|
+
: h("div", { class: "s-product-options-option" },
|
|
71
|
+
h("label", { htmlFor: 'options[' + option.id + ']', class: "s-product-options-option-label" },
|
|
72
|
+
h("b", null,
|
|
73
|
+
option.name,
|
|
74
|
+
option.required && h("span", null, " * "),
|
|
75
|
+
" "),
|
|
76
|
+
h("small", null, option.placeholder)),
|
|
77
|
+
h("div", { class: "s-product-options-option-content" }, this.getDisplayForType(option))))))));
|
|
78
|
+
}
|
|
79
|
+
//@ts-ignore
|
|
80
|
+
colorOption(option) {
|
|
81
|
+
return h("fieldset", { class: "s-product-options-colors-wrapper" }, option === null || option === void 0 ? void 0 : option.details.map((value) => h("div", null,
|
|
82
|
+
h("input", { onChange: e => this.colorSelected.emit(e), name: `color-choice-${option.id}`, id: `color-choice-${option.id}-${value.id}`, required: true, type: "radio" }),
|
|
83
|
+
h("label", { htmlFor: `color-choice-${option.id}-${value.id}` },
|
|
84
|
+
h("span", { style: { "background-color": value.color } }),
|
|
85
|
+
h("p", null, value.name)))));
|
|
86
|
+
}
|
|
87
|
+
//@ts-ignore
|
|
88
|
+
dateOption(option) {
|
|
89
|
+
//todo:: consider date-range @see https://github.com/SallaApp/theme-raed/blob/master/src/assets/js/partials/product-options.js#L8-L23
|
|
90
|
+
return h("div", { class: "s-product-options-date-element" },
|
|
91
|
+
h("salla-datetime-picker", { onPicked: e => this.dateSelected.emit(e), placeholder: option.name }));
|
|
92
|
+
}
|
|
93
|
+
//@ts-ignore
|
|
94
|
+
datetimeOption(option) {
|
|
95
|
+
//todo:: consider date-range @see https://github.com/SallaApp/theme-raed/blob/master/src/assets/js/partials/product-options.js#L8-L23
|
|
96
|
+
return h("div", { class: "s-product-options-datetime-element" },
|
|
97
|
+
h("salla-datetime-picker", { mode: "range", dateFormat: "Y-m-d G:i:K", enableTime: true, minDate: option.from_date_time, maxDate: option.to_date_time, placeholder: option.name, onPicked: e => this.dateTimeSelected.emit(e) }));
|
|
98
|
+
}
|
|
99
|
+
//@ts-ignore
|
|
100
|
+
donationOption(option) {
|
|
101
|
+
var _a;
|
|
102
|
+
let donation = this.productDetail.donation;
|
|
103
|
+
if (!donation)
|
|
104
|
+
return '';
|
|
105
|
+
return h("div", { class: "s-product-options-donation-wrapper" },
|
|
106
|
+
h("input", { type: "text", id: "donating-amount", name: "donating_amount", class: "s-form-control", placeholder: option.placeholder, onInput: e => salla.helpers.inputDigitsOnly(e.target), onBlur: e => this.donationMoneyEntered.emit(e), value: salla.url.is_page('cart') ? (_a = this.productDetail) === null || _a === void 0 ? void 0 : _a.price : '' }),
|
|
107
|
+
h("span", { class: "s-product-options-donation-amount-currency" }, salla.config.currency(salla.config.get('user.currency_code')).symbol));
|
|
108
|
+
}
|
|
109
|
+
getFilepondPlaceholder() {
|
|
110
|
+
return `<div class="s-product-options-filepond-placeholder"><span class="s-product-options-filepond-placeholder-icon">${CameraIcon}</span><p class="s-product-options-filepond-placeholder-text">اسحب او افلت الصورة هنا</p> <span class="filepond--label-action">او تصفح من جهازك</span></div>`;
|
|
111
|
+
}
|
|
112
|
+
setUploaderHeight() {
|
|
113
|
+
setTimeout(() => {
|
|
114
|
+
this.uploader.querySelector('.filepond--root').style.height = '120px';
|
|
115
|
+
}, 1000);
|
|
116
|
+
}
|
|
117
|
+
//@ts-ignore
|
|
118
|
+
selectThumbnail(e, value) {
|
|
119
|
+
// salla.event.emit('product-options::goToSlide', value)
|
|
120
|
+
this.thumbnailSelected.emit(e);
|
|
121
|
+
}
|
|
122
|
+
//todo:: move it to another place, create component if there is no component
|
|
123
|
+
//@ts-ignore
|
|
124
|
+
getServerConfig(url, option_id) {
|
|
125
|
+
return {
|
|
126
|
+
process: async (_fieldName, file, _metadata, load, error, _progress, abort, _transfer, _options) => {
|
|
127
|
+
const formData = new FormData();
|
|
128
|
+
formData.append("image_url", file, file.name);
|
|
129
|
+
return await salla.product.uploadGiftImage(formData)
|
|
130
|
+
.then((resp) => {
|
|
131
|
+
this.uploadedImage = resp.data.url;
|
|
132
|
+
load('success');
|
|
133
|
+
file.metadata = `_${new Date().getTime()}`;
|
|
134
|
+
}).catch(e => {
|
|
135
|
+
console.log(e);
|
|
136
|
+
error('error');
|
|
137
|
+
})
|
|
138
|
+
.finally(() => {
|
|
139
|
+
return {
|
|
140
|
+
abort: () => {
|
|
141
|
+
abort();
|
|
142
|
+
},
|
|
143
|
+
};
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
//@ts-ignore
|
|
149
|
+
imageOption(option) {
|
|
150
|
+
return h("salla-file-upload", { "instant-upload": true, ref: element => this.uploader = element, "data-item-id": salla.url.is_page('cart') ? option.id : '', class: { "s-product-options-image-input": true, required: option.required }, labelIdle: this.getFilepondPlaceholder(), onRemove: () => this.setUploaderHeight(), serverConfig: this.getServerConfig(salla.cart.api.getUrl('cart/option-image'), salla.url.is_page('cart') ? option.id : null) });
|
|
151
|
+
}
|
|
152
|
+
multipleOptions(option) {
|
|
153
|
+
return h("div", { ref: element => this.multipleOptionDom = element, class: { "s-product-options-multiple-options-wrapper": true, 'required': option.required } }, option === null || option === void 0 ? void 0 : option.details.map((value) => {
|
|
154
|
+
return h("div", null,
|
|
155
|
+
h("input", { id: `field-${option.id}-${value.id}`, "aria-describedby": `options[${option.id}]-description`, name: `options[${option.id}]`, value: value.id, type: "checkbox", onChange: () => this.handleMultiSelectFieldInput() }),
|
|
156
|
+
h("label", { htmlFor: `field-${option.id}-${value.id}` }, value.name));
|
|
157
|
+
}));
|
|
158
|
+
}
|
|
159
|
+
//@ts-ignore
|
|
160
|
+
numberOption(option) {
|
|
161
|
+
return h("input", { placeholder: option.placeholder, name: `options[${option.id}]`, type: "text", onInput: e => salla.helpers.inputDigitsOnly(e.target), onBlur: e => this.numberOptionEntered.emit(e), class: "s-form-control" });
|
|
162
|
+
}
|
|
163
|
+
singleOption(option) {
|
|
164
|
+
return h("div", null,
|
|
165
|
+
h("select", { name: `options[${option.id}]`, required: option.required, class: "s-form-control" },
|
|
166
|
+
h("option", { value: "" }, option.placeholder), option === null || option === void 0 ? void 0 :
|
|
167
|
+
option.details.map((op) => {
|
|
168
|
+
return h("option", {
|
|
169
|
+
// selected={op.id == this.selectedSingleOption}
|
|
170
|
+
onChange: e => this.singleSelectOptionSelected.emit(e), value: op.id }, op.name);
|
|
171
|
+
})));
|
|
172
|
+
}
|
|
173
|
+
//@ts-ignore
|
|
174
|
+
splitterOption() {
|
|
175
|
+
return h("div", { class: "s-product-options-splitter" });
|
|
176
|
+
}
|
|
177
|
+
//@ts-ignore
|
|
178
|
+
textOption(option) {
|
|
179
|
+
return h("div", { class: "s-product-options-text" },
|
|
180
|
+
h("input", { placeholder: option.placeholder, name: `options[${option.id}]`, type: "text", onInput: e => this.textOptionEntered.emit(e), required: option.required, class: 's-form-control' }));
|
|
181
|
+
}
|
|
182
|
+
//@ts-ignore
|
|
183
|
+
textareaOption(option) {
|
|
184
|
+
return h("div", { class: "s-product-options-textarea" },
|
|
185
|
+
h("div", { class: "mt-1" },
|
|
186
|
+
h("textarea", { rows: 4, name: `options[${option.id}]`, required: option.required, id: `options[${option.id}]`, placeholder: option.placeholder, onInput: (e) => this.textareaOptionEntered.emit(e), class: "s-form-control" })));
|
|
187
|
+
}
|
|
188
|
+
//@ts-ignore
|
|
189
|
+
thumbnailOption(option) {
|
|
190
|
+
return h("div", { class: "s-product-options-thumbnails-wrapper" }, option.details.map((detail) => {
|
|
191
|
+
return h("div", null,
|
|
192
|
+
h("input", { required: option.required, type: "radio", id: `option_${option.id}_${detail.id}`, disabled: detail.is_out, "data-itemid": detail.id, name: `options[${option.id}]`, "data-img-id": detail.option_value, value: detail.option_value, onChange: (e) => this.selectThumbnail(e, detail.option_value) }),
|
|
193
|
+
h("label", { htmlFor: `option_${option.id}_${detail.id}`, "data-img-id": detail.option_value, class: "go-to-slide" },
|
|
194
|
+
h("img", { "data-src": detail.image, src: detail.image, title: detail.name, alt: detail.name }),
|
|
195
|
+
h("span", { innerHTML: CheckCircleIcon, class: "s-product-options-thumbnails-icon" })),
|
|
196
|
+
h("p", null,
|
|
197
|
+
detail.name,
|
|
198
|
+
" "),
|
|
199
|
+
detail.is_out ?
|
|
200
|
+
[h("small", { class: "s-product-options-thumbnails-stock-badge" }, this.outOfStockText), h("div", { class: "s-product-options-thumbnails-badge-overlay" })]
|
|
201
|
+
: '');
|
|
202
|
+
}));
|
|
203
|
+
}
|
|
204
|
+
//@ts-ignore
|
|
205
|
+
timeOption(option) {
|
|
206
|
+
return h("salla-datetime-picker", { class: "s-product-options-time-element", enableTime: true, placeholder: option.name, noCalendar: true, dateFormat: "h:i K", onPicked: e => this.timeSelected.emit(e) });
|
|
207
|
+
}
|
|
208
|
+
static get is() { return "salla-product-options"; }
|
|
209
|
+
static get originalStyleUrls() { return {
|
|
210
|
+
"$": ["salla-product-options.scss"]
|
|
211
|
+
}; }
|
|
212
|
+
static get styleUrls() { return {
|
|
213
|
+
"$": ["salla-product-options.css"]
|
|
214
|
+
}; }
|
|
215
|
+
static get properties() { return {
|
|
216
|
+
"productId": {
|
|
217
|
+
"type": "number",
|
|
218
|
+
"mutable": false,
|
|
219
|
+
"complexType": {
|
|
220
|
+
"original": "number",
|
|
221
|
+
"resolved": "number",
|
|
222
|
+
"references": {}
|
|
223
|
+
},
|
|
224
|
+
"required": false,
|
|
225
|
+
"optional": false,
|
|
226
|
+
"docs": {
|
|
227
|
+
"tags": [],
|
|
228
|
+
"text": "The id of the product to which the options are going to be fetched for."
|
|
229
|
+
},
|
|
230
|
+
"attribute": "product-id",
|
|
231
|
+
"reflect": false,
|
|
232
|
+
"defaultValue": "salla.config.get('page.id')"
|
|
233
|
+
},
|
|
234
|
+
"product": {
|
|
235
|
+
"type": "string",
|
|
236
|
+
"mutable": false,
|
|
237
|
+
"complexType": {
|
|
238
|
+
"original": "string",
|
|
239
|
+
"resolved": "string",
|
|
240
|
+
"references": {}
|
|
241
|
+
},
|
|
242
|
+
"required": false,
|
|
243
|
+
"optional": false,
|
|
244
|
+
"docs": {
|
|
245
|
+
"tags": [],
|
|
246
|
+
"text": "Product detail information."
|
|
247
|
+
},
|
|
248
|
+
"attribute": "product",
|
|
249
|
+
"reflect": false
|
|
250
|
+
}
|
|
251
|
+
}; }
|
|
252
|
+
static get states() { return {
|
|
253
|
+
"productDetail": {},
|
|
254
|
+
"options": {},
|
|
255
|
+
"uploadedImage": {},
|
|
256
|
+
"outOfStockText": {},
|
|
257
|
+
"donationAmount": {}
|
|
258
|
+
}; }
|
|
259
|
+
static get events() { return [{
|
|
260
|
+
"method": "colorSelected",
|
|
261
|
+
"name": "colorSelected",
|
|
262
|
+
"bubbles": true,
|
|
263
|
+
"cancelable": true,
|
|
264
|
+
"composed": true,
|
|
265
|
+
"docs": {
|
|
266
|
+
"tags": [],
|
|
267
|
+
"text": "Colors Option Event"
|
|
268
|
+
},
|
|
269
|
+
"complexType": {
|
|
270
|
+
"original": "any",
|
|
271
|
+
"resolved": "any",
|
|
272
|
+
"references": {}
|
|
273
|
+
}
|
|
274
|
+
}, {
|
|
275
|
+
"method": "thumbnailSelected",
|
|
276
|
+
"name": "thumbnailSelected",
|
|
277
|
+
"bubbles": true,
|
|
278
|
+
"cancelable": true,
|
|
279
|
+
"composed": true,
|
|
280
|
+
"docs": {
|
|
281
|
+
"tags": [],
|
|
282
|
+
"text": "Thumbnails Option"
|
|
283
|
+
},
|
|
284
|
+
"complexType": {
|
|
285
|
+
"original": "any",
|
|
286
|
+
"resolved": "any",
|
|
287
|
+
"references": {}
|
|
288
|
+
}
|
|
289
|
+
}, {
|
|
290
|
+
"method": "singleSelectOptionSelected",
|
|
291
|
+
"name": "singleSelectOptionSelected",
|
|
292
|
+
"bubbles": true,
|
|
293
|
+
"cancelable": true,
|
|
294
|
+
"composed": true,
|
|
295
|
+
"docs": {
|
|
296
|
+
"tags": [],
|
|
297
|
+
"text": "Single Select Option"
|
|
298
|
+
},
|
|
299
|
+
"complexType": {
|
|
300
|
+
"original": "any",
|
|
301
|
+
"resolved": "any",
|
|
302
|
+
"references": {}
|
|
303
|
+
}
|
|
304
|
+
}, {
|
|
305
|
+
"method": "donationMoneyEntered",
|
|
306
|
+
"name": "donationMoneyEntered",
|
|
307
|
+
"bubbles": true,
|
|
308
|
+
"cancelable": true,
|
|
309
|
+
"composed": true,
|
|
310
|
+
"docs": {
|
|
311
|
+
"tags": [],
|
|
312
|
+
"text": "Donation Option"
|
|
313
|
+
},
|
|
314
|
+
"complexType": {
|
|
315
|
+
"original": "any",
|
|
316
|
+
"resolved": "any",
|
|
317
|
+
"references": {}
|
|
318
|
+
}
|
|
319
|
+
}, {
|
|
320
|
+
"method": "textOptionEntered",
|
|
321
|
+
"name": "textOptionEntered",
|
|
322
|
+
"bubbles": true,
|
|
323
|
+
"cancelable": true,
|
|
324
|
+
"composed": true,
|
|
325
|
+
"docs": {
|
|
326
|
+
"tags": [],
|
|
327
|
+
"text": "Text Option"
|
|
328
|
+
},
|
|
329
|
+
"complexType": {
|
|
330
|
+
"original": "any",
|
|
331
|
+
"resolved": "any",
|
|
332
|
+
"references": {}
|
|
333
|
+
}
|
|
334
|
+
}, {
|
|
335
|
+
"method": "textareaOptionEntered",
|
|
336
|
+
"name": "textareaOptionEntered",
|
|
337
|
+
"bubbles": true,
|
|
338
|
+
"cancelable": true,
|
|
339
|
+
"composed": true,
|
|
340
|
+
"docs": {
|
|
341
|
+
"tags": [],
|
|
342
|
+
"text": "Textarea Option"
|
|
343
|
+
},
|
|
344
|
+
"complexType": {
|
|
345
|
+
"original": "any",
|
|
346
|
+
"resolved": "any",
|
|
347
|
+
"references": {}
|
|
348
|
+
}
|
|
349
|
+
}, {
|
|
350
|
+
"method": "numberOptionEntered",
|
|
351
|
+
"name": "numberOptionEntered",
|
|
352
|
+
"bubbles": true,
|
|
353
|
+
"cancelable": true,
|
|
354
|
+
"composed": true,
|
|
355
|
+
"docs": {
|
|
356
|
+
"tags": [],
|
|
357
|
+
"text": "Number Option"
|
|
358
|
+
},
|
|
359
|
+
"complexType": {
|
|
360
|
+
"original": "any",
|
|
361
|
+
"resolved": "any",
|
|
362
|
+
"references": {}
|
|
363
|
+
}
|
|
364
|
+
}, {
|
|
365
|
+
"method": "itemsSelected",
|
|
366
|
+
"name": "itemsSelected",
|
|
367
|
+
"bubbles": true,
|
|
368
|
+
"cancelable": true,
|
|
369
|
+
"composed": true,
|
|
370
|
+
"docs": {
|
|
371
|
+
"tags": [],
|
|
372
|
+
"text": "Multi-Select Option"
|
|
373
|
+
},
|
|
374
|
+
"complexType": {
|
|
375
|
+
"original": "string[]",
|
|
376
|
+
"resolved": "string[]",
|
|
377
|
+
"references": {}
|
|
378
|
+
}
|
|
379
|
+
}, {
|
|
380
|
+
"method": "dateTimeSelected",
|
|
381
|
+
"name": "dateTimeSelected",
|
|
382
|
+
"bubbles": true,
|
|
383
|
+
"cancelable": true,
|
|
384
|
+
"composed": true,
|
|
385
|
+
"docs": {
|
|
386
|
+
"tags": [],
|
|
387
|
+
"text": "DateTime Selection Option"
|
|
388
|
+
},
|
|
389
|
+
"complexType": {
|
|
390
|
+
"original": "any",
|
|
391
|
+
"resolved": "any",
|
|
392
|
+
"references": {}
|
|
393
|
+
}
|
|
394
|
+
}, {
|
|
395
|
+
"method": "dateSelected",
|
|
396
|
+
"name": "dateSelected",
|
|
397
|
+
"bubbles": true,
|
|
398
|
+
"cancelable": true,
|
|
399
|
+
"composed": true,
|
|
400
|
+
"docs": {
|
|
401
|
+
"tags": [],
|
|
402
|
+
"text": "Date Selection Option"
|
|
403
|
+
},
|
|
404
|
+
"complexType": {
|
|
405
|
+
"original": "any",
|
|
406
|
+
"resolved": "any",
|
|
407
|
+
"references": {}
|
|
408
|
+
}
|
|
409
|
+
}, {
|
|
410
|
+
"method": "timeSelected",
|
|
411
|
+
"name": "timeSelected",
|
|
412
|
+
"bubbles": true,
|
|
413
|
+
"cancelable": true,
|
|
414
|
+
"composed": true,
|
|
415
|
+
"docs": {
|
|
416
|
+
"tags": [],
|
|
417
|
+
"text": "Time Selection Option"
|
|
418
|
+
},
|
|
419
|
+
"complexType": {
|
|
420
|
+
"original": "any",
|
|
421
|
+
"resolved": "any",
|
|
422
|
+
"references": {}
|
|
423
|
+
}
|
|
424
|
+
}]; }
|
|
425
|
+
}
|
|
@@ -14,6 +14,10 @@ export class SallaSwiper {
|
|
|
14
14
|
* Show/hide slider block title
|
|
15
15
|
*/
|
|
16
16
|
this.blockTitle = '';
|
|
17
|
+
/**
|
|
18
|
+
* Enable call a specific slide
|
|
19
|
+
*/
|
|
20
|
+
// @Prop({reflect: true}) enableCallToSlide: boolean = false;
|
|
17
21
|
/**
|
|
18
22
|
* Show/hide slider block sub title
|
|
19
23
|
*/
|
|
@@ -245,6 +249,12 @@ export class SallaSwiper {
|
|
|
245
249
|
salla.lang.onLoaded(() => {
|
|
246
250
|
this.displayAllTitle = salla.lang.get('blocks.home.display_all');
|
|
247
251
|
});
|
|
252
|
+
// if (this.enableCallToSlide) {
|
|
253
|
+
// salla.event.on('product-options::goToSlide', data => {
|
|
254
|
+
// const slideIndex = this.sliderWrapper.querySelector(`[data-img-id="${data}"]`).getAttribute('data-slid-index');
|
|
255
|
+
// this.slideTo(parseInt(slideIndex), 300, false);
|
|
256
|
+
// });
|
|
257
|
+
// }
|
|
248
258
|
return new Promise((resolve, reject) => {
|
|
249
259
|
// @ts-ignore
|
|
250
260
|
if (typeof Swiper !== 'undefined') {
|
|
@@ -37,6 +37,7 @@ export class SallaUserMenu {
|
|
|
37
37
|
this.hello = salla.lang.get("pages.checkout.hello");
|
|
38
38
|
this.first_name = salla.storage.get('user.first_name') || '';
|
|
39
39
|
this.last_name = salla.storage.get('user.last_name') || '';
|
|
40
|
+
this.has_red_dot = salla.storage.get('user.notifications') || salla.storage.get('user.pending_orders');
|
|
40
41
|
this.avatar = salla.storage.get('user.avatar') || salla.url.cdn('images/avatar.png');
|
|
41
42
|
this.badges = {
|
|
42
43
|
notifications: salla.helpers.number(salla.storage.get('user.notifications') || 0),
|
|
@@ -78,7 +79,7 @@ export class SallaUserMenu {
|
|
|
78
79
|
}
|
|
79
80
|
//we need it to be the last item
|
|
80
81
|
this.items.logout = LogoutIcon;
|
|
81
|
-
this.triggerSlot = ((_a = this.host.querySelector('[slot="trigger"]')) === null || _a === void 0 ? void 0 : _a.innerHTML) || '<div class="s-user-menu-trigger"><img class="s-user-menu-trigger-avatar" src="{avatar}" alt="{first_name}{last_name}"
|
|
82
|
+
this.triggerSlot = ((_a = this.host.querySelector('[slot="trigger"]')) === null || _a === void 0 ? void 0 : _a.innerHTML) || '<div class="s-user-menu-trigger"><div class="s-user-menu-avatar-wrap"><img class="s-user-menu-trigger-avatar" src="{avatar}" alt="{first_name}{last_name}" /></div><div class="s-user-menu-trigger-content"><span class="s-user-menu-trigger-hello">{hello}</span><p class="s-user-menu-trigger-name">{first_name} {last_name}</p></div> <i class="s-user-menu-trigger-icon">{icon}</i></div>';
|
|
82
83
|
if (salla.config.isGuest()) {
|
|
83
84
|
return;
|
|
84
85
|
}
|
|
@@ -121,7 +122,7 @@ export class SallaUserMenu {
|
|
|
121
122
|
salla.auth.logout();
|
|
122
123
|
}
|
|
123
124
|
getTheHeader() {
|
|
124
|
-
return h("div", { class: { 's-user-menu-trigger-slot': true, 's-user-menu-trigger-avatar-only': this.avatarOnly }, id: 'trigger-slot', onClick: (e) => this.open(e), innerHTML: this.triggerSlot
|
|
125
|
+
return h("div", { class: { 's-user-menu-trigger-slot': true, 's-user-menu-red-dot': this.has_red_dot, 's-user-menu-trigger-avatar-only': this.avatarOnly }, id: 'trigger-slot', onClick: (e) => this.open(e), innerHTML: this.triggerSlot
|
|
125
126
|
.replace(/\{hello\}/g, this.hello)
|
|
126
127
|
.replace(/\{first_name\}/g, this.first_name)
|
|
127
128
|
.replace(/\{last_name\}/g, this.last_name)
|
|
@@ -259,6 +260,7 @@ export class SallaUserMenu {
|
|
|
259
260
|
"hello": {},
|
|
260
261
|
"first_name": {},
|
|
261
262
|
"last_name": {},
|
|
263
|
+
"has_red_dot": {},
|
|
262
264
|
"avatar": {},
|
|
263
265
|
"badges": {},
|
|
264
266
|
"OrderUpdate": {}
|
|
@@ -21,6 +21,7 @@ export { SallaModal as SallaModal } from '../types/components/salla-modal/salla-
|
|
|
21
21
|
export { SallaOfferModal as SallaOfferModal } from '../types/components/salla-offer-modal/salla-offer-modal';
|
|
22
22
|
export { SallaPlaceholder as SallaPlaceholder } from '../types/components/salla-placeholder/salla-placeholder';
|
|
23
23
|
export { SallaProductAvailability as SallaProductAvailability } from '../types/components/salla-product-availability/salla-product-availability';
|
|
24
|
+
export { SallaProductOptions as SallaProductOptions } from '../types/components/salla-product-options/salla-product-options';
|
|
24
25
|
export { SallaProductSizeGuide as SallaProductSizeGuide } from '../types/components/salla-product-size-guide/salla-product-size-guide';
|
|
25
26
|
export { SallaQuantityInput as SallaQuantityInput } from '../types/components/salla-quantity-input/salla-quantity-input';
|
|
26
27
|
export { SallaQuickOrder as SallaQuickOrder } from '../types/components/salla-quick-order/salla-quick-order';
|