@salla.sa/twilight-components 2.10.2 → 2.10.4
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-6d8fd0d2.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} +364 -10
- 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 +422 -0
- package/dist/collection/components/salla-quick-order/salla-quick-order.js +2 -2
- package/dist/collection/components/salla-slider/salla-slider.js +37 -3
- 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 +270 -0
- package/dist/components/salla-quick-order.js +2 -2
- package/dist/components/salla-slider2.js +20 -3
- package/dist/components/salla-user-menu.js +4 -2
- package/dist/esm/{app-globals-d3b05078.js → app-globals-49168536.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} +363 -11
- package/dist/esm/twilight.js +2 -2
- package/dist/esm-es5/{app-globals-d3b05078.js → app-globals-49168536.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-49a71773.system.js +4 -0
- package/dist/twilight/{p-9d458384.entry.js → p-d5f8a6dd.entry.js} +5 -5
- package/dist/twilight/{p-95180d48.system.entry.js → p-e7ce5d86.system.entry.js} +7 -7
- package/dist/twilight/{p-70235d2a.system.js → p-f03909a5.system.js} +2 -2
- package/dist/twilight/{p-1b14dc52.js → p-f6948417.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 +8 -0
- package/dist/types/components/salla-user-menu/salla-user-menu.d.ts +1 -0
- package/dist/types/components.d.ts +85 -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,422 @@
|
|
|
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.getDetails(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
|
+
this.thumbnailSelected.emit(e);
|
|
120
|
+
}
|
|
121
|
+
//todo:: move it to another place, create component if there is no component
|
|
122
|
+
//@ts-ignore
|
|
123
|
+
getServerConfig(url, option_id) {
|
|
124
|
+
return {
|
|
125
|
+
process: async (_fieldName, file, _metadata, load, error, _progress, abort, _transfer, _options) => {
|
|
126
|
+
const formData = new FormData();
|
|
127
|
+
formData.append("image_url", file, file.name);
|
|
128
|
+
return await salla.product.uploadGiftImage(formData)
|
|
129
|
+
.then((resp) => {
|
|
130
|
+
this.uploadedImage = resp.data.url;
|
|
131
|
+
load('success');
|
|
132
|
+
file.metadata = `_${new Date().getTime()}`;
|
|
133
|
+
}).catch(e => {
|
|
134
|
+
console.log(e);
|
|
135
|
+
error('error');
|
|
136
|
+
})
|
|
137
|
+
.finally(() => {
|
|
138
|
+
return {
|
|
139
|
+
abort: () => {
|
|
140
|
+
abort();
|
|
141
|
+
},
|
|
142
|
+
};
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
//@ts-ignore
|
|
148
|
+
imageOption(option) {
|
|
149
|
+
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) });
|
|
150
|
+
}
|
|
151
|
+
multipleOptions(option) {
|
|
152
|
+
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) => {
|
|
153
|
+
return h("div", null,
|
|
154
|
+
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() }),
|
|
155
|
+
h("label", { htmlFor: `field-${option.id}-${value.id}` }, value.name));
|
|
156
|
+
}));
|
|
157
|
+
}
|
|
158
|
+
//@ts-ignore
|
|
159
|
+
numberOption(option) {
|
|
160
|
+
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" });
|
|
161
|
+
}
|
|
162
|
+
singleOption(option) {
|
|
163
|
+
return h("div", null,
|
|
164
|
+
h("select", { name: `options[${option.id}]`, required: option.required, class: "s-form-control" },
|
|
165
|
+
h("option", { value: "" }, option.placeholder), option === null || option === void 0 ? void 0 :
|
|
166
|
+
option.details.map((op) => {
|
|
167
|
+
return h("option", { onChange: e => this.singleSelectOptionSelected.emit(e), value: op.id }, op.name);
|
|
168
|
+
})));
|
|
169
|
+
}
|
|
170
|
+
//@ts-ignore
|
|
171
|
+
splitterOption() {
|
|
172
|
+
return h("div", { class: "s-product-options-splitter" });
|
|
173
|
+
}
|
|
174
|
+
//@ts-ignore
|
|
175
|
+
textOption(option) {
|
|
176
|
+
return h("div", { class: "s-product-options-text" },
|
|
177
|
+
h("input", { placeholder: option.placeholder, name: `options[${option.id}]`, type: "text", onInput: e => this.textOptionEntered.emit(e), required: option.required, class: 's-form-control' }));
|
|
178
|
+
}
|
|
179
|
+
//@ts-ignore
|
|
180
|
+
textareaOption(option) {
|
|
181
|
+
return h("div", { class: "s-product-options-textarea" },
|
|
182
|
+
h("div", { class: "mt-1" },
|
|
183
|
+
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" })));
|
|
184
|
+
}
|
|
185
|
+
//@ts-ignore
|
|
186
|
+
thumbnailOption(option) {
|
|
187
|
+
return h("div", { class: "s-product-options-thumbnails-wrapper" }, option.details.map((detail) => {
|
|
188
|
+
return h("div", null,
|
|
189
|
+
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) }),
|
|
190
|
+
h("label", { htmlFor: `option_${option.id}_${detail.id}`, "data-img-id": detail.option_value, class: "go-to-slide" },
|
|
191
|
+
h("img", { "data-src": detail.image, src: detail.image, title: detail.name, alt: detail.name }),
|
|
192
|
+
h("span", { innerHTML: CheckCircleIcon, class: "s-product-options-thumbnails-icon" })),
|
|
193
|
+
h("p", null,
|
|
194
|
+
detail.name,
|
|
195
|
+
" "),
|
|
196
|
+
detail.is_out ?
|
|
197
|
+
[h("small", { class: "s-product-options-thumbnails-stock-badge" }, this.outOfStockText), h("div", { class: "s-product-options-thumbnails-badge-overlay" })]
|
|
198
|
+
: '');
|
|
199
|
+
}));
|
|
200
|
+
}
|
|
201
|
+
//@ts-ignore
|
|
202
|
+
timeOption(option) {
|
|
203
|
+
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) });
|
|
204
|
+
}
|
|
205
|
+
static get is() { return "salla-product-options"; }
|
|
206
|
+
static get originalStyleUrls() { return {
|
|
207
|
+
"$": ["salla-product-options.scss"]
|
|
208
|
+
}; }
|
|
209
|
+
static get styleUrls() { return {
|
|
210
|
+
"$": ["salla-product-options.css"]
|
|
211
|
+
}; }
|
|
212
|
+
static get properties() { return {
|
|
213
|
+
"productId": {
|
|
214
|
+
"type": "number",
|
|
215
|
+
"mutable": false,
|
|
216
|
+
"complexType": {
|
|
217
|
+
"original": "number",
|
|
218
|
+
"resolved": "number",
|
|
219
|
+
"references": {}
|
|
220
|
+
},
|
|
221
|
+
"required": false,
|
|
222
|
+
"optional": false,
|
|
223
|
+
"docs": {
|
|
224
|
+
"tags": [],
|
|
225
|
+
"text": "The id of the product to which the options are going to be fetched for."
|
|
226
|
+
},
|
|
227
|
+
"attribute": "product-id",
|
|
228
|
+
"reflect": false,
|
|
229
|
+
"defaultValue": "salla.config.get('page.id')"
|
|
230
|
+
},
|
|
231
|
+
"product": {
|
|
232
|
+
"type": "string",
|
|
233
|
+
"mutable": false,
|
|
234
|
+
"complexType": {
|
|
235
|
+
"original": "string",
|
|
236
|
+
"resolved": "string",
|
|
237
|
+
"references": {}
|
|
238
|
+
},
|
|
239
|
+
"required": false,
|
|
240
|
+
"optional": false,
|
|
241
|
+
"docs": {
|
|
242
|
+
"tags": [],
|
|
243
|
+
"text": "Product detail information."
|
|
244
|
+
},
|
|
245
|
+
"attribute": "product",
|
|
246
|
+
"reflect": false
|
|
247
|
+
}
|
|
248
|
+
}; }
|
|
249
|
+
static get states() { return {
|
|
250
|
+
"productDetail": {},
|
|
251
|
+
"options": {},
|
|
252
|
+
"uploadedImage": {},
|
|
253
|
+
"outOfStockText": {},
|
|
254
|
+
"donationAmount": {}
|
|
255
|
+
}; }
|
|
256
|
+
static get events() { return [{
|
|
257
|
+
"method": "colorSelected",
|
|
258
|
+
"name": "colorSelected",
|
|
259
|
+
"bubbles": true,
|
|
260
|
+
"cancelable": true,
|
|
261
|
+
"composed": true,
|
|
262
|
+
"docs": {
|
|
263
|
+
"tags": [],
|
|
264
|
+
"text": "Colors Option Event"
|
|
265
|
+
},
|
|
266
|
+
"complexType": {
|
|
267
|
+
"original": "any",
|
|
268
|
+
"resolved": "any",
|
|
269
|
+
"references": {}
|
|
270
|
+
}
|
|
271
|
+
}, {
|
|
272
|
+
"method": "thumbnailSelected",
|
|
273
|
+
"name": "thumbnailSelected",
|
|
274
|
+
"bubbles": true,
|
|
275
|
+
"cancelable": true,
|
|
276
|
+
"composed": true,
|
|
277
|
+
"docs": {
|
|
278
|
+
"tags": [],
|
|
279
|
+
"text": "Thumbnails Option"
|
|
280
|
+
},
|
|
281
|
+
"complexType": {
|
|
282
|
+
"original": "any",
|
|
283
|
+
"resolved": "any",
|
|
284
|
+
"references": {}
|
|
285
|
+
}
|
|
286
|
+
}, {
|
|
287
|
+
"method": "singleSelectOptionSelected",
|
|
288
|
+
"name": "singleSelectOptionSelected",
|
|
289
|
+
"bubbles": true,
|
|
290
|
+
"cancelable": true,
|
|
291
|
+
"composed": true,
|
|
292
|
+
"docs": {
|
|
293
|
+
"tags": [],
|
|
294
|
+
"text": "Single Select Option"
|
|
295
|
+
},
|
|
296
|
+
"complexType": {
|
|
297
|
+
"original": "any",
|
|
298
|
+
"resolved": "any",
|
|
299
|
+
"references": {}
|
|
300
|
+
}
|
|
301
|
+
}, {
|
|
302
|
+
"method": "donationMoneyEntered",
|
|
303
|
+
"name": "donationMoneyEntered",
|
|
304
|
+
"bubbles": true,
|
|
305
|
+
"cancelable": true,
|
|
306
|
+
"composed": true,
|
|
307
|
+
"docs": {
|
|
308
|
+
"tags": [],
|
|
309
|
+
"text": "Donation Option"
|
|
310
|
+
},
|
|
311
|
+
"complexType": {
|
|
312
|
+
"original": "any",
|
|
313
|
+
"resolved": "any",
|
|
314
|
+
"references": {}
|
|
315
|
+
}
|
|
316
|
+
}, {
|
|
317
|
+
"method": "textOptionEntered",
|
|
318
|
+
"name": "textOptionEntered",
|
|
319
|
+
"bubbles": true,
|
|
320
|
+
"cancelable": true,
|
|
321
|
+
"composed": true,
|
|
322
|
+
"docs": {
|
|
323
|
+
"tags": [],
|
|
324
|
+
"text": "Text Option"
|
|
325
|
+
},
|
|
326
|
+
"complexType": {
|
|
327
|
+
"original": "any",
|
|
328
|
+
"resolved": "any",
|
|
329
|
+
"references": {}
|
|
330
|
+
}
|
|
331
|
+
}, {
|
|
332
|
+
"method": "textareaOptionEntered",
|
|
333
|
+
"name": "textareaOptionEntered",
|
|
334
|
+
"bubbles": true,
|
|
335
|
+
"cancelable": true,
|
|
336
|
+
"composed": true,
|
|
337
|
+
"docs": {
|
|
338
|
+
"tags": [],
|
|
339
|
+
"text": "Textarea Option"
|
|
340
|
+
},
|
|
341
|
+
"complexType": {
|
|
342
|
+
"original": "any",
|
|
343
|
+
"resolved": "any",
|
|
344
|
+
"references": {}
|
|
345
|
+
}
|
|
346
|
+
}, {
|
|
347
|
+
"method": "numberOptionEntered",
|
|
348
|
+
"name": "numberOptionEntered",
|
|
349
|
+
"bubbles": true,
|
|
350
|
+
"cancelable": true,
|
|
351
|
+
"composed": true,
|
|
352
|
+
"docs": {
|
|
353
|
+
"tags": [],
|
|
354
|
+
"text": "Number Option"
|
|
355
|
+
},
|
|
356
|
+
"complexType": {
|
|
357
|
+
"original": "any",
|
|
358
|
+
"resolved": "any",
|
|
359
|
+
"references": {}
|
|
360
|
+
}
|
|
361
|
+
}, {
|
|
362
|
+
"method": "itemsSelected",
|
|
363
|
+
"name": "itemsSelected",
|
|
364
|
+
"bubbles": true,
|
|
365
|
+
"cancelable": true,
|
|
366
|
+
"composed": true,
|
|
367
|
+
"docs": {
|
|
368
|
+
"tags": [],
|
|
369
|
+
"text": "Multi-Select Option"
|
|
370
|
+
},
|
|
371
|
+
"complexType": {
|
|
372
|
+
"original": "string[]",
|
|
373
|
+
"resolved": "string[]",
|
|
374
|
+
"references": {}
|
|
375
|
+
}
|
|
376
|
+
}, {
|
|
377
|
+
"method": "dateTimeSelected",
|
|
378
|
+
"name": "dateTimeSelected",
|
|
379
|
+
"bubbles": true,
|
|
380
|
+
"cancelable": true,
|
|
381
|
+
"composed": true,
|
|
382
|
+
"docs": {
|
|
383
|
+
"tags": [],
|
|
384
|
+
"text": "DateTime Selection Option"
|
|
385
|
+
},
|
|
386
|
+
"complexType": {
|
|
387
|
+
"original": "any",
|
|
388
|
+
"resolved": "any",
|
|
389
|
+
"references": {}
|
|
390
|
+
}
|
|
391
|
+
}, {
|
|
392
|
+
"method": "dateSelected",
|
|
393
|
+
"name": "dateSelected",
|
|
394
|
+
"bubbles": true,
|
|
395
|
+
"cancelable": true,
|
|
396
|
+
"composed": true,
|
|
397
|
+
"docs": {
|
|
398
|
+
"tags": [],
|
|
399
|
+
"text": "Date Selection Option"
|
|
400
|
+
},
|
|
401
|
+
"complexType": {
|
|
402
|
+
"original": "any",
|
|
403
|
+
"resolved": "any",
|
|
404
|
+
"references": {}
|
|
405
|
+
}
|
|
406
|
+
}, {
|
|
407
|
+
"method": "timeSelected",
|
|
408
|
+
"name": "timeSelected",
|
|
409
|
+
"bubbles": true,
|
|
410
|
+
"cancelable": true,
|
|
411
|
+
"composed": true,
|
|
412
|
+
"docs": {
|
|
413
|
+
"tags": [],
|
|
414
|
+
"text": "Time Selection Option"
|
|
415
|
+
},
|
|
416
|
+
"complexType": {
|
|
417
|
+
"original": "any",
|
|
418
|
+
"resolved": "any",
|
|
419
|
+
"references": {}
|
|
420
|
+
}
|
|
421
|
+
}]; }
|
|
422
|
+
}
|
|
@@ -91,7 +91,7 @@ export class SallaQuickOrder {
|
|
|
91
91
|
return;
|
|
92
92
|
}
|
|
93
93
|
return this.getPayload()
|
|
94
|
-
.then((payload) => salla.api.cart.
|
|
94
|
+
.then((payload) => salla.api.cart.createQuickOrder(payload))
|
|
95
95
|
.then(() => {
|
|
96
96
|
this.quickOrderSubmited.emit();
|
|
97
97
|
this.submitSucess = true;
|
|
@@ -166,7 +166,7 @@ export class SallaQuickOrder {
|
|
|
166
166
|
h("article", { innerHTML: this.agreementText })))));
|
|
167
167
|
}
|
|
168
168
|
componentWillLoad() {
|
|
169
|
-
return salla.api.withoutNotifier(() => salla.api.cart.
|
|
169
|
+
return salla.api.withoutNotifier(() => salla.api.cart.getQuickOrderSettings().then(res => {
|
|
170
170
|
var _a, _b;
|
|
171
171
|
this.isAvailable = true;
|
|
172
172
|
this.quickOrderTitle = res.data.title;
|
|
@@ -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
|
*/
|
|
@@ -26,6 +30,10 @@ export class SallaSwiper {
|
|
|
26
30
|
* Vertical or Horizontal thumbs slider
|
|
27
31
|
*/
|
|
28
32
|
this.verticalThumbs = false;
|
|
33
|
+
/**
|
|
34
|
+
* Auto Height slider
|
|
35
|
+
*/
|
|
36
|
+
this.autoHeight = false;
|
|
29
37
|
/**
|
|
30
38
|
* Show/hide arrows
|
|
31
39
|
*/
|
|
@@ -111,10 +119,12 @@ export class SallaSwiper {
|
|
|
111
119
|
breakpoints: { 1024: { slidesPerView: 2 } }
|
|
112
120
|
},
|
|
113
121
|
blog: {
|
|
122
|
+
parallax: true,
|
|
123
|
+
speed: 800,
|
|
124
|
+
loop: true,
|
|
114
125
|
slidesPerView: 1,
|
|
115
126
|
centeredSlides: true,
|
|
116
127
|
spaceBetween: 30,
|
|
117
|
-
effect: "fade",
|
|
118
128
|
breakpoints: {
|
|
119
129
|
320: { spaceBetween: 10 },
|
|
120
130
|
768: { spaceBetween: 15 },
|
|
@@ -123,8 +133,7 @@ export class SallaSwiper {
|
|
|
123
133
|
},
|
|
124
134
|
thumbs: {
|
|
125
135
|
slidesPerView: 1,
|
|
126
|
-
spaceBetween: 30
|
|
127
|
-
autoHeight: true
|
|
136
|
+
spaceBetween: 30
|
|
128
137
|
}
|
|
129
138
|
};
|
|
130
139
|
}
|
|
@@ -245,6 +254,12 @@ export class SallaSwiper {
|
|
|
245
254
|
salla.lang.onLoaded(() => {
|
|
246
255
|
this.displayAllTitle = salla.lang.get('blocks.home.display_all');
|
|
247
256
|
});
|
|
257
|
+
// if (this.enableCallToSlide) {
|
|
258
|
+
// salla.event.on('product-options::goToSlide', data => {
|
|
259
|
+
// const slideIndex = this.sliderWrapper.querySelector(`[data-img-id="${data}"]`).getAttribute('data-slid-index');
|
|
260
|
+
// this.slideTo(parseInt(slideIndex), 300, false);
|
|
261
|
+
// });
|
|
262
|
+
// }
|
|
248
263
|
return new Promise((resolve, reject) => {
|
|
249
264
|
// @ts-ignore
|
|
250
265
|
if (typeof Swiper !== 'undefined') {
|
|
@@ -283,6 +298,7 @@ export class SallaSwiper {
|
|
|
283
298
|
autoplay: this.autoPlay,
|
|
284
299
|
centeredSlides: this.centered,
|
|
285
300
|
slidesPerView: this.slidesPerView,
|
|
301
|
+
autoHeight: this.autoHeight,
|
|
286
302
|
lazy: true,
|
|
287
303
|
on: {
|
|
288
304
|
// todo:: find better way for this workaround to show lazyLoad for duplicated slides, for some reason they are loaded but class not added.
|
|
@@ -504,6 +520,24 @@ export class SallaSwiper {
|
|
|
504
520
|
"reflect": true,
|
|
505
521
|
"defaultValue": "false"
|
|
506
522
|
},
|
|
523
|
+
"autoHeight": {
|
|
524
|
+
"type": "boolean",
|
|
525
|
+
"mutable": false,
|
|
526
|
+
"complexType": {
|
|
527
|
+
"original": "boolean",
|
|
528
|
+
"resolved": "boolean",
|
|
529
|
+
"references": {}
|
|
530
|
+
},
|
|
531
|
+
"required": false,
|
|
532
|
+
"optional": false,
|
|
533
|
+
"docs": {
|
|
534
|
+
"tags": [],
|
|
535
|
+
"text": "Auto Height slider"
|
|
536
|
+
},
|
|
537
|
+
"attribute": "auto-height",
|
|
538
|
+
"reflect": true,
|
|
539
|
+
"defaultValue": "false"
|
|
540
|
+
},
|
|
507
541
|
"showControls": {
|
|
508
542
|
"type": "boolean",
|
|
509
543
|
"mutable": false,
|
|
@@ -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';
|