@salla.sa/twilight-components 2.11.76 → 2.11.78
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/salla-button_37.cjs.entry.js +43 -26
- package/dist/cjs/salla-product-options.cjs.entry.js +7 -3
- package/dist/collection/components/salla-count-down/salla-count-down.js +1 -1
- package/dist/collection/components/salla-file-upload/salla-file-upload.js +2 -1
- package/dist/collection/components/salla-map/salla-map.js +7 -2
- package/dist/collection/components/salla-product-options/salla-product-options.js +7 -3
- package/dist/collection/components/salla-quick-order/salla-quick-order.js +33 -22
- package/dist/components/salla-count-down.js +1 -1
- package/dist/components/salla-file-upload2.js +2 -1
- package/dist/components/salla-map2.js +7 -2
- package/dist/components/salla-product-options.js +7 -3
- package/dist/components/salla-quick-order.js +33 -22
- package/dist/esm/salla-button_37.entry.js +43 -26
- package/dist/esm/salla-product-options.entry.js +7 -3
- package/dist/esm-es5/salla-button_37.entry.js +2 -2
- package/dist/esm-es5/salla-product-options.entry.js +1 -1
- package/dist/twilight/p-43149637.system.js +1 -1
- package/dist/twilight/p-4dd8ab94.system.entry.js +4 -0
- package/dist/twilight/p-7ac5f373.entry.js +36 -0
- package/dist/twilight/p-d6b621c9.entry.js +4 -0
- package/dist/twilight/p-ebe2e8d7.system.entry.js +53 -0
- package/dist/twilight/twilight.esm.js +1 -1
- package/dist/types/components/salla-quick-order/salla-quick-order.d.ts +2 -1
- package/package.json +5 -5
- package/dist/twilight/p-12b12fd9.entry.js +0 -36
- package/dist/twilight/p-6c9b05ef.entry.js +0 -4
- package/dist/twilight/p-8da31ccb.system.entry.js +0 -4
- package/dist/twilight/p-e3b59bf5.system.entry.js +0 -53
|
@@ -2715,7 +2715,7 @@ const SallaCountDown = class {
|
|
|
2715
2715
|
return salla.helpers.number(digit, this.digits === 'en');
|
|
2716
2716
|
}
|
|
2717
2717
|
startCountDown() {
|
|
2718
|
-
let countDownDate = new Date(this.date);
|
|
2718
|
+
let countDownDate = new Date(this.date.replace(/-/g, "/"));
|
|
2719
2719
|
if (this.endOfDay || this.date.split(' ').length === 1) {
|
|
2720
2720
|
countDownDate.setHours(23, 59, 59, 999);
|
|
2721
2721
|
}
|
|
@@ -20800,6 +20800,7 @@ const SallaFileUpload = class {
|
|
|
20800
20800
|
let fileInput = this.getFormDataFileInput();
|
|
20801
20801
|
fileInput.type = 'hidden';
|
|
20802
20802
|
fileInput.value = this.value;
|
|
20803
|
+
this.hiddenInput.value = this.value;
|
|
20803
20804
|
fileInput.dispatchEvent(new window.Event('change', { bubbles: true }));
|
|
20804
20805
|
return this.uploaded.emit(this.value);
|
|
20805
20806
|
}
|
|
@@ -20886,7 +20887,7 @@ const SallaFileUpload = class {
|
|
|
20886
20887
|
return (index.h(index.Host, { class: {
|
|
20887
20888
|
"s-file-upload": true,
|
|
20888
20889
|
"s-file-upload-profile-image": this.profileImage,
|
|
20889
|
-
} }, index.h("input", { type: "file", name: this.name, value: this.value, ref: ele => this.fileUploader = ele, required: this.required, class: "s-file-upload-wrapper s-file-upload-input", accept: this.accept }), index.h("input", { class: "s-
|
|
20890
|
+
} }, index.h("input", { type: "file", name: this.name, value: this.value, ref: ele => this.fileUploader = ele, required: this.required, class: "s-file-upload-wrapper s-file-upload-input", accept: this.accept }), index.h("input", { class: "s-hidden", name: 'hidden-' + this.name, required: this.required, value: this.value, ref: input => this.hiddenInput = input })));
|
|
20890
20891
|
}
|
|
20891
20892
|
componentDidLoad() {
|
|
20892
20893
|
let files = this.getFiles();
|
|
@@ -22837,12 +22838,17 @@ const SallaMap = class {
|
|
|
22837
22838
|
lng: this.lng,
|
|
22838
22839
|
address: this.formattedAddress ? this.formattedAddress : null,
|
|
22839
22840
|
};
|
|
22840
|
-
this.mapInput.value = `${points.lat}, ${points.lng}`;
|
|
22841
22841
|
salla.event.emit('salla-map::selected', points);
|
|
22842
22842
|
this.selected.emit(points);
|
|
22843
22843
|
this.selectedLat = points.lat;
|
|
22844
22844
|
this.selectedLng = points.lng;
|
|
22845
22845
|
this.getPositionAddress(new google.maps.LatLng(points.lat, points.lng), true);
|
|
22846
|
+
if (!this.selectedLat || !this.selectedLng) {
|
|
22847
|
+
this.mapInput.value = null;
|
|
22848
|
+
}
|
|
22849
|
+
else {
|
|
22850
|
+
this.mapInput.value = `${this.selectedLat}, ${this.selectedLng}`;
|
|
22851
|
+
}
|
|
22846
22852
|
this.mapInput.dispatchEvent(new window.Event('change', { bubbles: true }));
|
|
22847
22853
|
this.locationModal.close();
|
|
22848
22854
|
} }, this.confirmButtonTitle)
|
|
@@ -22854,7 +22860,7 @@ const SallaMap = class {
|
|
|
22854
22860
|
this.locationModal = modal;
|
|
22855
22861
|
} }, this.getLocationModal()), index.h("slot", { name: "button" }, index.h("salla-button", { onClick: () => {
|
|
22856
22862
|
this.open();
|
|
22857
|
-
}, color: "primary", class: "s-map-location-button" }, index.h("span", { class: "s-map-location-icon", innerHTML: this.formattedAddress ? Edit : Location }), this.formattedAddress ? (index.h("div", null, this.locateButtonEdit, " | ", this.formatAddress(this.formattedAddress))) : (this.locateButtonTitle))), index.h("input", {
|
|
22863
|
+
}, color: "primary", class: "s-map-location-button" }, index.h("span", { class: "s-map-location-icon", innerHTML: this.formattedAddress ? Edit : Location }), this.formattedAddress ? (index.h("div", null, this.locateButtonEdit, " | ", this.formatAddress(this.formattedAddress))) : (this.locateButtonTitle))), index.h("input", { class: "s-hidden", name: this.name, required: this.required, value: this.getLatLng(), ref: color => this.mapInput = color })));
|
|
22858
22864
|
}
|
|
22859
22865
|
get host() { return index.getElement(this); }
|
|
22860
22866
|
};
|
|
@@ -26328,36 +26334,47 @@ const SallaQuickOrder = class {
|
|
|
26328
26334
|
const parsedToDOM = new DOMParser().parseFromString(agreement_text, 'text/html');
|
|
26329
26335
|
return parsedToDOM.documentElement.innerText.substring(0, length) + '...';
|
|
26330
26336
|
}
|
|
26331
|
-
|
|
26332
|
-
|
|
26333
|
-
|
|
26334
|
-
|
|
26335
|
-
|
|
26336
|
-
|
|
26337
|
-
|
|
26338
|
-
|
|
26339
|
-
|
|
26340
|
-
|
|
26341
|
-
|
|
26342
|
-
|
|
26343
|
-
|
|
26344
|
-
|
|
26345
|
-
|
|
26346
|
-
|
|
26347
|
-
|
|
26348
|
-
|
|
26349
|
-
|
|
26350
|
-
|
|
26337
|
+
loadQuickOrderSettings() {
|
|
26338
|
+
var _a, _b, _c;
|
|
26339
|
+
let data = salla.config.get('store.settings.product.quick_order');
|
|
26340
|
+
if (!data) {
|
|
26341
|
+
return Promise.resolve();
|
|
26342
|
+
}
|
|
26343
|
+
this.user = salla.config.get('user') || salla.storage.get('user') || {};
|
|
26344
|
+
this.countryCode = ((_a = this.user) === null || _a === void 0 ? void 0 : _a.country_code) || this.countryCode;
|
|
26345
|
+
// make email required if user is gust or is required from server
|
|
26346
|
+
this.isEmailRequired = ((_b = this.user) === null || _b === void 0 ? void 0 : _b.email) ? false : this.isEmailRequired;
|
|
26347
|
+
// check if one click is available
|
|
26348
|
+
this.oneClick = (_c = this.user) === null || _c === void 0 ? void 0 : _c.email;
|
|
26349
|
+
this.initComponentData(data);
|
|
26350
|
+
return Promise.resolve();
|
|
26351
|
+
// return salla.api.withoutNotifier(() => salla.api.cart.getQuickOrderSettings().then(res => this.initComponentData(res.data)));
|
|
26352
|
+
}
|
|
26353
|
+
initComponentData(data) {
|
|
26354
|
+
this.quickOrderTitle = data.title;
|
|
26355
|
+
this.subTitle = data.sub_title;
|
|
26356
|
+
this.payButtonTitle = data.order_now_button;
|
|
26357
|
+
this.isEmailRequired = data.is_email_required;
|
|
26358
|
+
this.isTermsRequired = data.show_agreement;
|
|
26359
|
+
this.agreementText = data.agreement;
|
|
26360
|
+
this.confirmPayButtonTitle = data.confirm_button;
|
|
26361
|
+
this.thanksMessage = data.thanks_message;
|
|
26362
|
+
this.quickOrderStyle = data.style;
|
|
26363
|
+
this.isAvailable = true;
|
|
26351
26364
|
}
|
|
26352
26365
|
componentWillLoad() {
|
|
26353
|
-
return new Promise(resolve => salla.onReady(() => this.
|
|
26366
|
+
return new Promise(resolve => salla.onReady(() => this.loadQuickOrderSettings().then(resolve)));
|
|
26354
26367
|
}
|
|
26355
26368
|
render() {
|
|
26356
26369
|
if (!this.isAvailable) {
|
|
26357
26370
|
return;
|
|
26358
26371
|
}
|
|
26359
26372
|
if (this.submitSucess) {
|
|
26360
|
-
return (index.h(index.Host, { class: "s-quick-order" }, index.h("div", { class: 's-quick-order-confirm', style: {
|
|
26373
|
+
return (index.h(index.Host, { class: "s-quick-order" }, index.h("div", { class: 's-quick-order-confirm', style: {
|
|
26374
|
+
backgroundColor: salla.config.get('theme.color.primary') + '10',
|
|
26375
|
+
borderColor: salla.config.get('theme.color.primary') + '10',
|
|
26376
|
+
color: salla.config.get('theme.color.primary')
|
|
26377
|
+
} }, index.h("i", { innerHTML: CelebrationIcon }), index.h("span", null, this.thanksMessage))));
|
|
26361
26378
|
}
|
|
26362
26379
|
return (index.h(index.Host, { class: `s-quick-order s-quick-order-${this.getDarkOrLight()}` }, index.h("div", { class: `s-quick-order-container s-quick-order-${this.quickOrderStyle}`, style: { backgroundColor: this.getStyleColor() } }, index.h("div", { class: "s-quick-order-button-cont" }, index.h("div", null, index.h("h3", null, this.quickOrderTitle), index.h("p", null, this.subTitle)), index.h("salla-button", { class: this.expanded ? "s-quick-order-btn-close" : "", onClick: (e) => this.submit(e, true), color: this.getBtnColor() }, this.oneClick
|
|
26363
26380
|
? this.confirmPayButtonTitle : this.expanded ? index.h("i", { innerHTML: Cancel$1 }) : this.confirmPayButtonTitle)), index.h("form", { onSubmit: (e) => this.submit(e), class: 's-quick-order-expandable ' + (this.expanded ? 's-quick-order-shown' : '') }, Salla.config.isGuest() &&
|
|
@@ -160,8 +160,12 @@ const SallaProductOptions = class {
|
|
|
160
160
|
data.detail = detail;
|
|
161
161
|
}
|
|
162
162
|
let optionElement = event.target.closest('.s-product-options-option');
|
|
163
|
-
if (event.target.value
|
|
164
|
-
|
|
163
|
+
if (event.target.value
|
|
164
|
+
|| ((option.type == DisplayType.FILE || option.type == DisplayType.IMAGE) && event.type === 'added')
|
|
165
|
+
|| (option.type == DisplayType.MAP && event.type === 'selected' && (event.target.lat && event.target.lng))) {
|
|
166
|
+
setTimeout(() => {
|
|
167
|
+
optionElement.classList.remove('s-product-options-option-error');
|
|
168
|
+
}, 200);
|
|
165
169
|
}
|
|
166
170
|
const index = this.selectedOptions.findIndex(option => option.option_id === data.option.id);
|
|
167
171
|
index > -1 ? this.selectedOptions[index] = Object.assign(Object.assign({}, data.detail), { option_id: data.option.id }) : this.selectedOptions.push(Object.assign(Object.assign({}, data.detail), { option_id: data.option.id }));
|
|
@@ -298,7 +302,7 @@ const SallaProductOptions = class {
|
|
|
298
302
|
+ (detail.additional_price ? ` <p> (${salla.money(detail.additional_price)}) </p>` : '');
|
|
299
303
|
}
|
|
300
304
|
return detail.name
|
|
301
|
-
+ ((outOfStock && this.isOptionDetailOut(detail)) ? ` - ${
|
|
305
|
+
+ ((outOfStock && this.isOptionDetailOut(detail)) ? ` - ${salla.lang.get("pages.products.out_of_stock")}` : '')
|
|
302
306
|
+ (detail.additional_price ? ` (${salla.money(detail.additional_price)})` : '');
|
|
303
307
|
}
|
|
304
308
|
isOptionDetailOut(detail) {
|
|
@@ -44,7 +44,7 @@ export class SallaCountDown {
|
|
|
44
44
|
return salla.helpers.number(digit, this.digits === 'en');
|
|
45
45
|
}
|
|
46
46
|
startCountDown() {
|
|
47
|
-
let countDownDate = new Date(this.date);
|
|
47
|
+
let countDownDate = new Date(this.date.replace(/-/g, "/"));
|
|
48
48
|
if (this.endOfDay || this.date.split(' ').length === 1) {
|
|
49
49
|
countDownDate.setHours(23, 59, 59, 999);
|
|
50
50
|
}
|
|
@@ -165,6 +165,7 @@ export class SallaFileUpload {
|
|
|
165
165
|
let fileInput = this.getFormDataFileInput();
|
|
166
166
|
fileInput.type = 'hidden';
|
|
167
167
|
fileInput.value = this.value;
|
|
168
|
+
this.hiddenInput.value = this.value;
|
|
168
169
|
fileInput.dispatchEvent(new window.Event('change', { bubbles: true }));
|
|
169
170
|
return this.uploaded.emit(this.value);
|
|
170
171
|
}
|
|
@@ -253,7 +254,7 @@ export class SallaFileUpload {
|
|
|
253
254
|
"s-file-upload-profile-image": this.profileImage,
|
|
254
255
|
} },
|
|
255
256
|
h("input", { type: "file", name: this.name, value: this.value, ref: ele => this.fileUploader = ele, required: this.required, class: "s-file-upload-wrapper s-file-upload-input", accept: this.accept }),
|
|
256
|
-
h("input", { class: "s-
|
|
257
|
+
h("input", { class: "s-hidden", name: 'hidden-' + this.name, required: this.required, value: this.value, ref: input => this.hiddenInput = input })));
|
|
257
258
|
}
|
|
258
259
|
componentDidLoad() {
|
|
259
260
|
let files = this.getFiles();
|
|
@@ -258,12 +258,17 @@ export class SallaMap {
|
|
|
258
258
|
lng: this.lng,
|
|
259
259
|
address: this.formattedAddress ? this.formattedAddress : null,
|
|
260
260
|
};
|
|
261
|
-
this.mapInput.value = `${points.lat}, ${points.lng}`;
|
|
262
261
|
salla.event.emit('salla-map::selected', points);
|
|
263
262
|
this.selected.emit(points);
|
|
264
263
|
this.selectedLat = points.lat;
|
|
265
264
|
this.selectedLng = points.lng;
|
|
266
265
|
this.getPositionAddress(new google.maps.LatLng(points.lat, points.lng), true);
|
|
266
|
+
if (!this.selectedLat || !this.selectedLng) {
|
|
267
|
+
this.mapInput.value = null;
|
|
268
|
+
}
|
|
269
|
+
else {
|
|
270
|
+
this.mapInput.value = `${this.selectedLat}, ${this.selectedLng}`;
|
|
271
|
+
}
|
|
267
272
|
this.mapInput.dispatchEvent(new window.Event('change', { bubbles: true }));
|
|
268
273
|
this.locationModal.close();
|
|
269
274
|
} }, this.confirmButtonTitle)
|
|
@@ -284,7 +289,7 @@ export class SallaMap {
|
|
|
284
289
|
this.locateButtonEdit,
|
|
285
290
|
" | ",
|
|
286
291
|
this.formatAddress(this.formattedAddress))) : (this.locateButtonTitle))),
|
|
287
|
-
h("input", {
|
|
292
|
+
h("input", { class: "s-hidden", name: this.name, required: this.required, value: this.getLatLng(), ref: color => this.mapInput = color })));
|
|
288
293
|
}
|
|
289
294
|
static get is() { return "salla-map"; }
|
|
290
295
|
static get originalStyleUrls() { return {
|
|
@@ -114,8 +114,12 @@ export class SallaProductOptions {
|
|
|
114
114
|
data.detail = detail;
|
|
115
115
|
}
|
|
116
116
|
let optionElement = event.target.closest('.s-product-options-option');
|
|
117
|
-
if (event.target.value
|
|
118
|
-
|
|
117
|
+
if (event.target.value
|
|
118
|
+
|| ((option.type == DisplayType.FILE || option.type == DisplayType.IMAGE) && event.type === 'added')
|
|
119
|
+
|| (option.type == DisplayType.MAP && event.type === 'selected' && (event.target.lat && event.target.lng))) {
|
|
120
|
+
setTimeout(() => {
|
|
121
|
+
optionElement.classList.remove('s-product-options-option-error');
|
|
122
|
+
}, 200);
|
|
119
123
|
}
|
|
120
124
|
const index = this.selectedOptions.findIndex(option => option.option_id === data.option.id);
|
|
121
125
|
index > -1 ? this.selectedOptions[index] = Object.assign(Object.assign({}, data.detail), { option_id: data.option.id }) : this.selectedOptions.push(Object.assign(Object.assign({}, data.detail), { option_id: data.option.id }));
|
|
@@ -274,7 +278,7 @@ export class SallaProductOptions {
|
|
|
274
278
|
+ (detail.additional_price ? ` <p> (${salla.money(detail.additional_price)}) </p>` : '');
|
|
275
279
|
}
|
|
276
280
|
return detail.name
|
|
277
|
-
+ ((outOfStock && this.isOptionDetailOut(detail)) ? ` - ${
|
|
281
|
+
+ ((outOfStock && this.isOptionDetailOut(detail)) ? ` - ${salla.lang.get("pages.products.out_of_stock")}` : '')
|
|
278
282
|
+ (detail.additional_price ? ` (${salla.money(detail.additional_price)})` : '');
|
|
279
283
|
}
|
|
280
284
|
isOptionDetailOut(detail) {
|
|
@@ -147,29 +147,36 @@ export class SallaQuickOrder {
|
|
|
147
147
|
const parsedToDOM = new DOMParser().parseFromString(agreement_text, 'text/html');
|
|
148
148
|
return parsedToDOM.documentElement.innerText.substring(0, length) + '...';
|
|
149
149
|
}
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
150
|
+
loadQuickOrderSettings() {
|
|
151
|
+
var _a, _b, _c;
|
|
152
|
+
let data = salla.config.get('store.settings.product.quick_order');
|
|
153
|
+
if (!data) {
|
|
154
|
+
return Promise.resolve();
|
|
155
|
+
}
|
|
156
|
+
this.user = salla.config.get('user') || salla.storage.get('user') || {};
|
|
157
|
+
this.countryCode = ((_a = this.user) === null || _a === void 0 ? void 0 : _a.country_code) || this.countryCode;
|
|
158
|
+
// make email required if user is gust or is required from server
|
|
159
|
+
this.isEmailRequired = ((_b = this.user) === null || _b === void 0 ? void 0 : _b.email) ? false : this.isEmailRequired;
|
|
160
|
+
// check if one click is available
|
|
161
|
+
this.oneClick = (_c = this.user) === null || _c === void 0 ? void 0 : _c.email;
|
|
162
|
+
this.initComponentData(data);
|
|
163
|
+
return Promise.resolve();
|
|
164
|
+
// return salla.api.withoutNotifier(() => salla.api.cart.getQuickOrderSettings().then(res => this.initComponentData(res.data)));
|
|
165
|
+
}
|
|
166
|
+
initComponentData(data) {
|
|
167
|
+
this.quickOrderTitle = data.title;
|
|
168
|
+
this.subTitle = data.sub_title;
|
|
169
|
+
this.payButtonTitle = data.order_now_button;
|
|
170
|
+
this.isEmailRequired = data.is_email_required;
|
|
171
|
+
this.isTermsRequired = data.show_agreement;
|
|
172
|
+
this.agreementText = data.agreement;
|
|
173
|
+
this.confirmPayButtonTitle = data.confirm_button;
|
|
174
|
+
this.thanksMessage = data.thanks_message;
|
|
175
|
+
this.quickOrderStyle = data.style;
|
|
176
|
+
this.isAvailable = true;
|
|
170
177
|
}
|
|
171
178
|
componentWillLoad() {
|
|
172
|
-
return new Promise(resolve => salla.onReady(() => this.
|
|
179
|
+
return new Promise(resolve => salla.onReady(() => this.loadQuickOrderSettings().then(resolve)));
|
|
173
180
|
}
|
|
174
181
|
render() {
|
|
175
182
|
if (!this.isAvailable) {
|
|
@@ -177,7 +184,11 @@ export class SallaQuickOrder {
|
|
|
177
184
|
}
|
|
178
185
|
if (this.submitSucess) {
|
|
179
186
|
return (h(Host, { class: "s-quick-order" },
|
|
180
|
-
h("div", { class: 's-quick-order-confirm', style: {
|
|
187
|
+
h("div", { class: 's-quick-order-confirm', style: {
|
|
188
|
+
backgroundColor: salla.config.get('theme.color.primary') + '10',
|
|
189
|
+
borderColor: salla.config.get('theme.color.primary') + '10',
|
|
190
|
+
color: salla.config.get('theme.color.primary')
|
|
191
|
+
} },
|
|
181
192
|
h("i", { innerHTML: CelebrationIcon }),
|
|
182
193
|
h("span", null, this.thanksMessage))));
|
|
183
194
|
}
|
|
@@ -49,7 +49,7 @@ const SallaCountDown$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElem
|
|
|
49
49
|
return salla.helpers.number(digit, this.digits === 'en');
|
|
50
50
|
}
|
|
51
51
|
startCountDown() {
|
|
52
|
-
let countDownDate = new Date(this.date);
|
|
52
|
+
let countDownDate = new Date(this.date.replace(/-/g, "/"));
|
|
53
53
|
if (this.endOfDay || this.date.split(' ').length === 1) {
|
|
54
54
|
countDownDate.setHours(23, 59, 59, 999);
|
|
55
55
|
}
|
|
@@ -15267,6 +15267,7 @@ const SallaFileUpload = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
|
15267
15267
|
let fileInput = this.getFormDataFileInput();
|
|
15268
15268
|
fileInput.type = 'hidden';
|
|
15269
15269
|
fileInput.value = this.value;
|
|
15270
|
+
this.hiddenInput.value = this.value;
|
|
15270
15271
|
fileInput.dispatchEvent(new window.Event('change', { bubbles: true }));
|
|
15271
15272
|
return this.uploaded.emit(this.value);
|
|
15272
15273
|
}
|
|
@@ -15353,7 +15354,7 @@ const SallaFileUpload = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
|
15353
15354
|
return (h(Host, { class: {
|
|
15354
15355
|
"s-file-upload": true,
|
|
15355
15356
|
"s-file-upload-profile-image": this.profileImage,
|
|
15356
|
-
} }, h("input", { type: "file", name: this.name, value: this.value, ref: ele => this.fileUploader = ele, required: this.required, class: "s-file-upload-wrapper s-file-upload-input", accept: this.accept }), h("input", { class: "s-
|
|
15357
|
+
} }, h("input", { type: "file", name: this.name, value: this.value, ref: ele => this.fileUploader = ele, required: this.required, class: "s-file-upload-wrapper s-file-upload-input", accept: this.accept }), h("input", { class: "s-hidden", name: 'hidden-' + this.name, required: this.required, value: this.value, ref: input => this.hiddenInput = input })));
|
|
15357
15358
|
}
|
|
15358
15359
|
componentDidLoad() {
|
|
15359
15360
|
let files = this.getFiles();
|
|
@@ -689,12 +689,17 @@ const SallaMap = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
689
689
|
lng: this.lng,
|
|
690
690
|
address: this.formattedAddress ? this.formattedAddress : null,
|
|
691
691
|
};
|
|
692
|
-
this.mapInput.value = `${points.lat}, ${points.lng}`;
|
|
693
692
|
salla.event.emit('salla-map::selected', points);
|
|
694
693
|
this.selected.emit(points);
|
|
695
694
|
this.selectedLat = points.lat;
|
|
696
695
|
this.selectedLng = points.lng;
|
|
697
696
|
this.getPositionAddress(new google.maps.LatLng(points.lat, points.lng), true);
|
|
697
|
+
if (!this.selectedLat || !this.selectedLng) {
|
|
698
|
+
this.mapInput.value = null;
|
|
699
|
+
}
|
|
700
|
+
else {
|
|
701
|
+
this.mapInput.value = `${this.selectedLat}, ${this.selectedLng}`;
|
|
702
|
+
}
|
|
698
703
|
this.mapInput.dispatchEvent(new window.Event('change', { bubbles: true }));
|
|
699
704
|
this.locationModal.close();
|
|
700
705
|
} }, this.confirmButtonTitle)
|
|
@@ -706,7 +711,7 @@ const SallaMap = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
706
711
|
this.locationModal = modal;
|
|
707
712
|
} }, this.getLocationModal()), h("slot", { name: "button" }, h("salla-button", { onClick: () => {
|
|
708
713
|
this.open();
|
|
709
|
-
}, color: "primary", class: "s-map-location-button" }, h("span", { class: "s-map-location-icon", innerHTML: this.formattedAddress ? Edit : Location }), this.formattedAddress ? (h("div", null, this.locateButtonEdit, " | ", this.formatAddress(this.formattedAddress))) : (this.locateButtonTitle))), h("input", {
|
|
714
|
+
}, color: "primary", class: "s-map-location-button" }, h("span", { class: "s-map-location-icon", innerHTML: this.formattedAddress ? Edit : Location }), this.formattedAddress ? (h("div", null, this.locateButtonEdit, " | ", this.formatAddress(this.formattedAddress))) : (this.locateButtonTitle))), h("input", { class: "s-hidden", name: this.name, required: this.required, value: this.getLatLng(), ref: color => this.mapInput = color })));
|
|
710
715
|
}
|
|
711
716
|
get host() { return this; }
|
|
712
717
|
static get style() { return sallaMapCss; }
|
|
@@ -166,8 +166,12 @@ const SallaProductOptions$1 = /*@__PURE__*/ proxyCustomElement(class extends HTM
|
|
|
166
166
|
data.detail = detail;
|
|
167
167
|
}
|
|
168
168
|
let optionElement = event.target.closest('.s-product-options-option');
|
|
169
|
-
if (event.target.value
|
|
170
|
-
|
|
169
|
+
if (event.target.value
|
|
170
|
+
|| ((option.type == DisplayType.FILE || option.type == DisplayType.IMAGE) && event.type === 'added')
|
|
171
|
+
|| (option.type == DisplayType.MAP && event.type === 'selected' && (event.target.lat && event.target.lng))) {
|
|
172
|
+
setTimeout(() => {
|
|
173
|
+
optionElement.classList.remove('s-product-options-option-error');
|
|
174
|
+
}, 200);
|
|
171
175
|
}
|
|
172
176
|
const index = this.selectedOptions.findIndex(option => option.option_id === data.option.id);
|
|
173
177
|
index > -1 ? this.selectedOptions[index] = Object.assign(Object.assign({}, data.detail), { option_id: data.option.id }) : this.selectedOptions.push(Object.assign(Object.assign({}, data.detail), { option_id: data.option.id }));
|
|
@@ -304,7 +308,7 @@ const SallaProductOptions$1 = /*@__PURE__*/ proxyCustomElement(class extends HTM
|
|
|
304
308
|
+ (detail.additional_price ? ` <p> (${salla.money(detail.additional_price)}) </p>` : '');
|
|
305
309
|
}
|
|
306
310
|
return detail.name
|
|
307
|
-
+ ((outOfStock && this.isOptionDetailOut(detail)) ? ` - ${
|
|
311
|
+
+ ((outOfStock && this.isOptionDetailOut(detail)) ? ` - ${salla.lang.get("pages.products.out_of_stock")}` : '')
|
|
308
312
|
+ (detail.additional_price ? ` (${salla.money(detail.additional_price)})` : '');
|
|
309
313
|
}
|
|
310
314
|
isOptionDetailOut(detail) {
|
|
@@ -175,36 +175,47 @@ const SallaQuickOrder$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEle
|
|
|
175
175
|
const parsedToDOM = new DOMParser().parseFromString(agreement_text, 'text/html');
|
|
176
176
|
return parsedToDOM.documentElement.innerText.substring(0, length) + '...';
|
|
177
177
|
}
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
178
|
+
loadQuickOrderSettings() {
|
|
179
|
+
var _a, _b, _c;
|
|
180
|
+
let data = salla.config.get('store.settings.product.quick_order');
|
|
181
|
+
if (!data) {
|
|
182
|
+
return Promise.resolve();
|
|
183
|
+
}
|
|
184
|
+
this.user = salla.config.get('user') || salla.storage.get('user') || {};
|
|
185
|
+
this.countryCode = ((_a = this.user) === null || _a === void 0 ? void 0 : _a.country_code) || this.countryCode;
|
|
186
|
+
// make email required if user is gust or is required from server
|
|
187
|
+
this.isEmailRequired = ((_b = this.user) === null || _b === void 0 ? void 0 : _b.email) ? false : this.isEmailRequired;
|
|
188
|
+
// check if one click is available
|
|
189
|
+
this.oneClick = (_c = this.user) === null || _c === void 0 ? void 0 : _c.email;
|
|
190
|
+
this.initComponentData(data);
|
|
191
|
+
return Promise.resolve();
|
|
192
|
+
// return salla.api.withoutNotifier(() => salla.api.cart.getQuickOrderSettings().then(res => this.initComponentData(res.data)));
|
|
193
|
+
}
|
|
194
|
+
initComponentData(data) {
|
|
195
|
+
this.quickOrderTitle = data.title;
|
|
196
|
+
this.subTitle = data.sub_title;
|
|
197
|
+
this.payButtonTitle = data.order_now_button;
|
|
198
|
+
this.isEmailRequired = data.is_email_required;
|
|
199
|
+
this.isTermsRequired = data.show_agreement;
|
|
200
|
+
this.agreementText = data.agreement;
|
|
201
|
+
this.confirmPayButtonTitle = data.confirm_button;
|
|
202
|
+
this.thanksMessage = data.thanks_message;
|
|
203
|
+
this.quickOrderStyle = data.style;
|
|
204
|
+
this.isAvailable = true;
|
|
198
205
|
}
|
|
199
206
|
componentWillLoad() {
|
|
200
|
-
return new Promise(resolve => salla.onReady(() => this.
|
|
207
|
+
return new Promise(resolve => salla.onReady(() => this.loadQuickOrderSettings().then(resolve)));
|
|
201
208
|
}
|
|
202
209
|
render() {
|
|
203
210
|
if (!this.isAvailable) {
|
|
204
211
|
return;
|
|
205
212
|
}
|
|
206
213
|
if (this.submitSucess) {
|
|
207
|
-
return (h(Host, { class: "s-quick-order" }, h("div", { class: 's-quick-order-confirm', style: {
|
|
214
|
+
return (h(Host, { class: "s-quick-order" }, h("div", { class: 's-quick-order-confirm', style: {
|
|
215
|
+
backgroundColor: salla.config.get('theme.color.primary') + '10',
|
|
216
|
+
borderColor: salla.config.get('theme.color.primary') + '10',
|
|
217
|
+
color: salla.config.get('theme.color.primary')
|
|
218
|
+
} }, h("i", { innerHTML: CelebrationIcon }), h("span", null, this.thanksMessage))));
|
|
208
219
|
}
|
|
209
220
|
return (h(Host, { class: `s-quick-order s-quick-order-${this.getDarkOrLight()}` }, h("div", { class: `s-quick-order-container s-quick-order-${this.quickOrderStyle}`, style: { backgroundColor: this.getStyleColor() } }, h("div", { class: "s-quick-order-button-cont" }, h("div", null, h("h3", null, this.quickOrderTitle), h("p", null, this.subTitle)), h("salla-button", { class: this.expanded ? "s-quick-order-btn-close" : "", onClick: (e) => this.submit(e, true), color: this.getBtnColor() }, this.oneClick
|
|
210
221
|
? this.confirmPayButtonTitle : this.expanded ? h("i", { innerHTML: Cancel }) : this.confirmPayButtonTitle)), h("form", { onSubmit: (e) => this.submit(e), class: 's-quick-order-expandable ' + (this.expanded ? 's-quick-order-shown' : '') }, Salla.config.isGuest() &&
|
|
@@ -2711,7 +2711,7 @@ const SallaCountDown = class {
|
|
|
2711
2711
|
return salla.helpers.number(digit, this.digits === 'en');
|
|
2712
2712
|
}
|
|
2713
2713
|
startCountDown() {
|
|
2714
|
-
let countDownDate = new Date(this.date);
|
|
2714
|
+
let countDownDate = new Date(this.date.replace(/-/g, "/"));
|
|
2715
2715
|
if (this.endOfDay || this.date.split(' ').length === 1) {
|
|
2716
2716
|
countDownDate.setHours(23, 59, 59, 999);
|
|
2717
2717
|
}
|
|
@@ -20796,6 +20796,7 @@ const SallaFileUpload = class {
|
|
|
20796
20796
|
let fileInput = this.getFormDataFileInput();
|
|
20797
20797
|
fileInput.type = 'hidden';
|
|
20798
20798
|
fileInput.value = this.value;
|
|
20799
|
+
this.hiddenInput.value = this.value;
|
|
20799
20800
|
fileInput.dispatchEvent(new window.Event('change', { bubbles: true }));
|
|
20800
20801
|
return this.uploaded.emit(this.value);
|
|
20801
20802
|
}
|
|
@@ -20882,7 +20883,7 @@ const SallaFileUpload = class {
|
|
|
20882
20883
|
return (h(Host, { class: {
|
|
20883
20884
|
"s-file-upload": true,
|
|
20884
20885
|
"s-file-upload-profile-image": this.profileImage,
|
|
20885
|
-
} }, h("input", { type: "file", name: this.name, value: this.value, ref: ele => this.fileUploader = ele, required: this.required, class: "s-file-upload-wrapper s-file-upload-input", accept: this.accept }), h("input", { class: "s-
|
|
20886
|
+
} }, h("input", { type: "file", name: this.name, value: this.value, ref: ele => this.fileUploader = ele, required: this.required, class: "s-file-upload-wrapper s-file-upload-input", accept: this.accept }), h("input", { class: "s-hidden", name: 'hidden-' + this.name, required: this.required, value: this.value, ref: input => this.hiddenInput = input })));
|
|
20886
20887
|
}
|
|
20887
20888
|
componentDidLoad() {
|
|
20888
20889
|
let files = this.getFiles();
|
|
@@ -22833,12 +22834,17 @@ const SallaMap = class {
|
|
|
22833
22834
|
lng: this.lng,
|
|
22834
22835
|
address: this.formattedAddress ? this.formattedAddress : null,
|
|
22835
22836
|
};
|
|
22836
|
-
this.mapInput.value = `${points.lat}, ${points.lng}`;
|
|
22837
22837
|
salla.event.emit('salla-map::selected', points);
|
|
22838
22838
|
this.selected.emit(points);
|
|
22839
22839
|
this.selectedLat = points.lat;
|
|
22840
22840
|
this.selectedLng = points.lng;
|
|
22841
22841
|
this.getPositionAddress(new google.maps.LatLng(points.lat, points.lng), true);
|
|
22842
|
+
if (!this.selectedLat || !this.selectedLng) {
|
|
22843
|
+
this.mapInput.value = null;
|
|
22844
|
+
}
|
|
22845
|
+
else {
|
|
22846
|
+
this.mapInput.value = `${this.selectedLat}, ${this.selectedLng}`;
|
|
22847
|
+
}
|
|
22842
22848
|
this.mapInput.dispatchEvent(new window.Event('change', { bubbles: true }));
|
|
22843
22849
|
this.locationModal.close();
|
|
22844
22850
|
} }, this.confirmButtonTitle)
|
|
@@ -22850,7 +22856,7 @@ const SallaMap = class {
|
|
|
22850
22856
|
this.locationModal = modal;
|
|
22851
22857
|
} }, this.getLocationModal()), h("slot", { name: "button" }, h("salla-button", { onClick: () => {
|
|
22852
22858
|
this.open();
|
|
22853
|
-
}, color: "primary", class: "s-map-location-button" }, h("span", { class: "s-map-location-icon", innerHTML: this.formattedAddress ? Edit : Location }), this.formattedAddress ? (h("div", null, this.locateButtonEdit, " | ", this.formatAddress(this.formattedAddress))) : (this.locateButtonTitle))), h("input", {
|
|
22859
|
+
}, color: "primary", class: "s-map-location-button" }, h("span", { class: "s-map-location-icon", innerHTML: this.formattedAddress ? Edit : Location }), this.formattedAddress ? (h("div", null, this.locateButtonEdit, " | ", this.formatAddress(this.formattedAddress))) : (this.locateButtonTitle))), h("input", { class: "s-hidden", name: this.name, required: this.required, value: this.getLatLng(), ref: color => this.mapInput = color })));
|
|
22854
22860
|
}
|
|
22855
22861
|
get host() { return getElement(this); }
|
|
22856
22862
|
};
|
|
@@ -26324,36 +26330,47 @@ const SallaQuickOrder = class {
|
|
|
26324
26330
|
const parsedToDOM = new DOMParser().parseFromString(agreement_text, 'text/html');
|
|
26325
26331
|
return parsedToDOM.documentElement.innerText.substring(0, length) + '...';
|
|
26326
26332
|
}
|
|
26327
|
-
|
|
26328
|
-
|
|
26329
|
-
|
|
26330
|
-
|
|
26331
|
-
|
|
26332
|
-
|
|
26333
|
-
|
|
26334
|
-
|
|
26335
|
-
|
|
26336
|
-
|
|
26337
|
-
|
|
26338
|
-
|
|
26339
|
-
|
|
26340
|
-
|
|
26341
|
-
|
|
26342
|
-
|
|
26343
|
-
|
|
26344
|
-
|
|
26345
|
-
|
|
26346
|
-
|
|
26333
|
+
loadQuickOrderSettings() {
|
|
26334
|
+
var _a, _b, _c;
|
|
26335
|
+
let data = salla.config.get('store.settings.product.quick_order');
|
|
26336
|
+
if (!data) {
|
|
26337
|
+
return Promise.resolve();
|
|
26338
|
+
}
|
|
26339
|
+
this.user = salla.config.get('user') || salla.storage.get('user') || {};
|
|
26340
|
+
this.countryCode = ((_a = this.user) === null || _a === void 0 ? void 0 : _a.country_code) || this.countryCode;
|
|
26341
|
+
// make email required if user is gust or is required from server
|
|
26342
|
+
this.isEmailRequired = ((_b = this.user) === null || _b === void 0 ? void 0 : _b.email) ? false : this.isEmailRequired;
|
|
26343
|
+
// check if one click is available
|
|
26344
|
+
this.oneClick = (_c = this.user) === null || _c === void 0 ? void 0 : _c.email;
|
|
26345
|
+
this.initComponentData(data);
|
|
26346
|
+
return Promise.resolve();
|
|
26347
|
+
// return salla.api.withoutNotifier(() => salla.api.cart.getQuickOrderSettings().then(res => this.initComponentData(res.data)));
|
|
26348
|
+
}
|
|
26349
|
+
initComponentData(data) {
|
|
26350
|
+
this.quickOrderTitle = data.title;
|
|
26351
|
+
this.subTitle = data.sub_title;
|
|
26352
|
+
this.payButtonTitle = data.order_now_button;
|
|
26353
|
+
this.isEmailRequired = data.is_email_required;
|
|
26354
|
+
this.isTermsRequired = data.show_agreement;
|
|
26355
|
+
this.agreementText = data.agreement;
|
|
26356
|
+
this.confirmPayButtonTitle = data.confirm_button;
|
|
26357
|
+
this.thanksMessage = data.thanks_message;
|
|
26358
|
+
this.quickOrderStyle = data.style;
|
|
26359
|
+
this.isAvailable = true;
|
|
26347
26360
|
}
|
|
26348
26361
|
componentWillLoad() {
|
|
26349
|
-
return new Promise(resolve => salla.onReady(() => this.
|
|
26362
|
+
return new Promise(resolve => salla.onReady(() => this.loadQuickOrderSettings().then(resolve)));
|
|
26350
26363
|
}
|
|
26351
26364
|
render() {
|
|
26352
26365
|
if (!this.isAvailable) {
|
|
26353
26366
|
return;
|
|
26354
26367
|
}
|
|
26355
26368
|
if (this.submitSucess) {
|
|
26356
|
-
return (h(Host, { class: "s-quick-order" }, h("div", { class: 's-quick-order-confirm', style: {
|
|
26369
|
+
return (h(Host, { class: "s-quick-order" }, h("div", { class: 's-quick-order-confirm', style: {
|
|
26370
|
+
backgroundColor: salla.config.get('theme.color.primary') + '10',
|
|
26371
|
+
borderColor: salla.config.get('theme.color.primary') + '10',
|
|
26372
|
+
color: salla.config.get('theme.color.primary')
|
|
26373
|
+
} }, h("i", { innerHTML: CelebrationIcon }), h("span", null, this.thanksMessage))));
|
|
26357
26374
|
}
|
|
26358
26375
|
return (h(Host, { class: `s-quick-order s-quick-order-${this.getDarkOrLight()}` }, h("div", { class: `s-quick-order-container s-quick-order-${this.quickOrderStyle}`, style: { backgroundColor: this.getStyleColor() } }, h("div", { class: "s-quick-order-button-cont" }, h("div", null, h("h3", null, this.quickOrderTitle), h("p", null, this.subTitle)), h("salla-button", { class: this.expanded ? "s-quick-order-btn-close" : "", onClick: (e) => this.submit(e, true), color: this.getBtnColor() }, this.oneClick
|
|
26359
26376
|
? this.confirmPayButtonTitle : this.expanded ? h("i", { innerHTML: Cancel$1 }) : this.confirmPayButtonTitle)), h("form", { onSubmit: (e) => this.submit(e), class: 's-quick-order-expandable ' + (this.expanded ? 's-quick-order-shown' : '') }, Salla.config.isGuest() &&
|
|
@@ -156,8 +156,12 @@ const SallaProductOptions = class {
|
|
|
156
156
|
data.detail = detail;
|
|
157
157
|
}
|
|
158
158
|
let optionElement = event.target.closest('.s-product-options-option');
|
|
159
|
-
if (event.target.value
|
|
160
|
-
|
|
159
|
+
if (event.target.value
|
|
160
|
+
|| ((option.type == DisplayType.FILE || option.type == DisplayType.IMAGE) && event.type === 'added')
|
|
161
|
+
|| (option.type == DisplayType.MAP && event.type === 'selected' && (event.target.lat && event.target.lng))) {
|
|
162
|
+
setTimeout(() => {
|
|
163
|
+
optionElement.classList.remove('s-product-options-option-error');
|
|
164
|
+
}, 200);
|
|
161
165
|
}
|
|
162
166
|
const index = this.selectedOptions.findIndex(option => option.option_id === data.option.id);
|
|
163
167
|
index > -1 ? this.selectedOptions[index] = Object.assign(Object.assign({}, data.detail), { option_id: data.option.id }) : this.selectedOptions.push(Object.assign(Object.assign({}, data.detail), { option_id: data.option.id }));
|
|
@@ -294,7 +298,7 @@ const SallaProductOptions = class {
|
|
|
294
298
|
+ (detail.additional_price ? ` <p> (${salla.money(detail.additional_price)}) </p>` : '');
|
|
295
299
|
}
|
|
296
300
|
return detail.name
|
|
297
|
-
+ ((outOfStock && this.isOptionDetailOut(detail)) ? ` - ${
|
|
301
|
+
+ ((outOfStock && this.isOptionDetailOut(detail)) ? ` - ${salla.lang.get("pages.products.out_of_stock")}` : '')
|
|
298
302
|
+ (detail.additional_price ? ` (${salla.money(detail.additional_price)})` : '');
|
|
299
303
|
}
|
|
300
304
|
isOptionDetailOut(detail) {
|