@salla.sa/twilight-components 2.10.6 → 2.11.0
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-17e73f03.js → app-globals-ffcb56c9.js} +1 -1
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/salla-button_37.cjs.entry.js +231 -116
- package/dist/cjs/twilight.cjs.js +2 -2
- package/dist/collection/components/salla-file-upload/salla-file-upload.js +69 -6
- package/dist/collection/components/salla-gifting/salla-gifting.js +25 -41
- package/dist/collection/components/salla-login-modal/intefaces.js +9 -0
- package/dist/collection/components/salla-login-modal/salla-login-modal.js +61 -3
- package/dist/collection/components/salla-map/salla-map.js +29 -5
- package/dist/collection/components/salla-product-options/salla-product-options.js +77 -72
- package/dist/collection/components/salla-slider/salla-slider.js +63 -23
- package/dist/collection/components/salla-user-menu/salla-user-menu.js +1 -3
- package/dist/components/camera.js +11 -0
- package/dist/components/index.js +1 -1
- package/dist/components/salla-file-upload2.js +35 -3
- package/dist/components/salla-gifting.js +20 -36
- package/dist/components/salla-login-modal.js +81 -6
- package/dist/components/salla-map.js +10 -3
- package/dist/components/salla-product-options.js +65 -66
- package/dist/components/salla-slider2.js +28 -5
- package/dist/components/salla-user-menu.js +1 -3
- package/dist/esm/{app-globals-e0ea68fa.js → app-globals-3afeeb74.js} +1 -1
- package/dist/esm/loader.js +2 -2
- package/dist/esm/salla-button_37.entry.js +231 -116
- package/dist/esm/twilight.js +2 -2
- package/dist/esm-es5/{app-globals-e0ea68fa.js → app-globals-3afeeb74.js} +1 -1
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/salla-button_37.entry.js +4 -4
- package/dist/esm-es5/twilight.js +1 -1
- package/dist/twilight/{p-d5f8a6dd.entry.js → p-9bbacabc.entry.js} +4 -4
- package/dist/twilight/{p-c54f1404.js → p-d4a11dd1.js} +2 -2
- package/dist/twilight/p-d859d898.system.js +4 -0
- package/dist/twilight/{p-ecfca50d.system.js → p-db94f281.system.js} +2 -2
- package/dist/twilight/{p-e7ce5d86.system.entry.js → p-e69f3e88.system.entry.js} +1 -1
- package/dist/twilight/twilight.esm.js +1 -1
- package/dist/twilight/twilight.js +1 -1
- package/dist/types/components/salla-file-upload/salla-file-upload.d.ts +11 -1
- package/dist/types/components/salla-gifting/salla-gifting.d.ts +9 -9
- package/dist/types/components/salla-login-modal/intefaces.d.ts +12 -0
- package/dist/types/components/salla-login-modal/salla-login-modal.d.ts +9 -1
- package/dist/types/components/salla-map/salla-map.d.ts +8 -1
- package/dist/types/components/salla-product-options/interfaces.d.ts +6 -1
- package/dist/types/components/salla-product-options/salla-product-options.d.ts +21 -15
- package/dist/types/components/salla-slider/salla-slider.d.ts +52 -1
- package/dist/types/components/salla-user-menu/salla-user-menu.d.ts +0 -1
- package/dist/types/components.d.ts +87 -8
- package/package.json +4 -4
- package/dist/components/arrow-right.js +0 -11
- package/dist/twilight/p-d1ff3408.system.js +0 -4
|
@@ -3,10 +3,11 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { proxyCustomElement, HTMLElement, h } from '@stencil/core/internal/client';
|
|
5
5
|
import { e as email } from './mail.js';
|
|
6
|
+
import { C as CameraIcon } from './camera.js';
|
|
6
7
|
import { K as KeyboardArrowRightIcon } from './keyboard_arrow_right.js';
|
|
7
|
-
import { A as ArrowRightIcon } from './arrow-right.js';
|
|
8
8
|
import { H as Helper } from './Helper.js';
|
|
9
|
-
import { d as defineCustomElement$
|
|
9
|
+
import { d as defineCustomElement$7 } from './salla-button2.js';
|
|
10
|
+
import { d as defineCustomElement$6 } from './salla-file-upload2.js';
|
|
10
11
|
import { d as defineCustomElement$5 } from './salla-loading2.js';
|
|
11
12
|
import { d as defineCustomElement$4 } from './salla-modal2.js';
|
|
12
13
|
import { d as defineCustomElement$3 } from './salla-tel-input2.js';
|
|
@@ -26,6 +27,20 @@ const PhoneIcon = `<!-- Generated by IcoMoon.io -->
|
|
|
26
27
|
</svg>
|
|
27
28
|
`;
|
|
28
29
|
|
|
30
|
+
const ArrowRightIcon = `<!-- Generated by IcoMoon.io -->
|
|
31
|
+
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">
|
|
32
|
+
<title>arrow-right</title>
|
|
33
|
+
<path d="M29.217 15.465c-0.019-0.044-0.056-0.077-0.080-0.119-0.067-0.116-0.139-0.227-0.236-0.317-0.011-0.009-0.013-0.024-0.024-0.033l-10.667-9.333c-0.553-0.484-1.396-0.429-1.881 0.125-0.484 0.555-0.428 1.396 0.127 1.881l7.996 6.997h-20.452c-0.737 0-1.333 0.597-1.333 1.333s0.596 1.333 1.333 1.333h20.452l-7.996 6.997c-0.555 0.485-0.611 1.327-0.127 1.881 0.264 0.3 0.633 0.455 1.004 0.455 0.312 0 0.625-0.109 0.877-0.331l10.667-9.333c0.011-0.009 0.015-0.024 0.024-0.033 0.097-0.091 0.169-0.201 0.236-0.317 0.024-0.041 0.060-0.075 0.080-0.119 0.073-0.163 0.116-0.343 0.116-0.533s-0.043-0.371-0.116-0.535z"></path>
|
|
34
|
+
</svg>
|
|
35
|
+
`;
|
|
36
|
+
|
|
37
|
+
var CustomFieldType;
|
|
38
|
+
(function (CustomFieldType) {
|
|
39
|
+
CustomFieldType["TEXT"] = "text";
|
|
40
|
+
CustomFieldType["NUMBER"] = "number";
|
|
41
|
+
CustomFieldType["PHOTO"] = "photo";
|
|
42
|
+
})(CustomFieldType || (CustomFieldType = {}));
|
|
43
|
+
|
|
29
44
|
const sallaLoginModalCss = "";
|
|
30
45
|
|
|
31
46
|
const SallaLoginModal$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
@@ -51,6 +66,11 @@ const SallaLoginModal$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEle
|
|
|
51
66
|
this.currentTabName = 'home';
|
|
52
67
|
this.regType = 'phone';
|
|
53
68
|
this.translationLoaded = false;
|
|
69
|
+
this.dragAndDrop = salla.lang.get('common.uploader.drag_and_drop');
|
|
70
|
+
this.browseFromFiles = salla.lang.get('common.uploader.browse');
|
|
71
|
+
this.customFields = [];
|
|
72
|
+
this.customFieldsValues = {};
|
|
73
|
+
this.uploadedImage = undefined;
|
|
54
74
|
this.typing = (e, submitMethod = null) => {
|
|
55
75
|
const error = e.target.nextElementSibling;
|
|
56
76
|
e.target.classList.remove('s-has-error');
|
|
@@ -88,6 +108,7 @@ const SallaLoginModal$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEle
|
|
|
88
108
|
phone: regPhone || this.loginTelInput.phone,
|
|
89
109
|
country_code: countryCode,
|
|
90
110
|
verified_by: this.regType,
|
|
111
|
+
custom_fields: this.customFieldsValues,
|
|
91
112
|
};
|
|
92
113
|
emailValue && (data = Object.assign(Object.assign({}, data), { email: emailValue }));
|
|
93
114
|
this.verifyTab.getCode()
|
|
@@ -106,6 +127,8 @@ const SallaLoginModal$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEle
|
|
|
106
127
|
salla.lang.onLoaded(() => {
|
|
107
128
|
this.translationLoaded = true;
|
|
108
129
|
this.title = salla.lang.get('blocks.header.login');
|
|
130
|
+
this.dragAndDrop = salla.lang.get('common.uploader.drag_and_drop');
|
|
131
|
+
this.browseFromFiles = salla.lang.get('common.uploader.browse');
|
|
109
132
|
this.updateTranslations();
|
|
110
133
|
});
|
|
111
134
|
salla.event.on('login::open', (event) => this.open(event));
|
|
@@ -119,7 +142,7 @@ const SallaLoginModal$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEle
|
|
|
119
142
|
* @param {CustomEvent|{details:{case:'new_customer'|'authenticated', redirect_url:string|null}}} event
|
|
120
143
|
*/
|
|
121
144
|
onVerified(event) {
|
|
122
|
-
var _a, _b;
|
|
145
|
+
var _a, _b, _c, _d;
|
|
123
146
|
salla.log('verified', event);
|
|
124
147
|
//there is a case when force login is activated & is new user, it will return case inside error key., so cover it.
|
|
125
148
|
let verifyCase = ((_a = event.detail) === null || _a === void 0 ? void 0 : _a.data.case) || ((_b = event.detail) === null || _b === void 0 ? void 0 : _b.error.case);
|
|
@@ -128,6 +151,7 @@ const SallaLoginModal$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEle
|
|
|
128
151
|
return;
|
|
129
152
|
}
|
|
130
153
|
if (verifyCase === "new_customer") {
|
|
154
|
+
this.customFields = ((_d = (_c = event.detail) === null || _c === void 0 ? void 0 : _c.data) === null || _d === void 0 ? void 0 : _d.custom_fields) || [];
|
|
131
155
|
return this.showTab(this.registrationTab);
|
|
132
156
|
}
|
|
133
157
|
if (!salla.auth.canRedirect()) {
|
|
@@ -205,13 +229,42 @@ const SallaLoginModal$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEle
|
|
|
205
229
|
}
|
|
206
230
|
async newUserValidation() {
|
|
207
231
|
const isLogByPhone = this.regType == "phone", isLogByEmail = this.regType == "email", emailValue = this.regEmail.value || (isLogByEmail && this.loginEmail.value), isEmailValid = Helper.isValidEmail(emailValue), isFirstNameValid = this.firstName.value.length > 0, isLastNameValid = this.lastName.value.length > 0, isPhoneValid = await this.regTelInput.isValid() || isLogByPhone && await this.loginTelInput.isValid(), emailValidation = (emailValue && isEmailValid) || (!emailValue && !this.isEmailRequired);
|
|
208
|
-
|
|
232
|
+
// Custom Fields Validation
|
|
233
|
+
var isCustomFieldValid = true;
|
|
234
|
+
for (const item of this.customFieldsWrapper.children) {
|
|
235
|
+
if (item.tagName == "SALLA-FILE-UPLOAD") {
|
|
236
|
+
const fileUploader = item;
|
|
237
|
+
this.customFieldsValues[fileUploader.id] = fileUploader.uploadedImage;
|
|
238
|
+
if (fileUploader.required) {
|
|
239
|
+
if (!fileUploader.uploadedImage) {
|
|
240
|
+
isCustomFieldValid = false;
|
|
241
|
+
const errorMsg = salla.lang.get('common.errors.field_required', { attribute: fileUploader.title });
|
|
242
|
+
this.validateField(fileUploader, errorMsg);
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
if (item.tagName == "INPUT") {
|
|
247
|
+
const inputItem = item;
|
|
248
|
+
this.customFieldsValues[inputItem.id] = inputItem.value;
|
|
249
|
+
if (inputItem.required) {
|
|
250
|
+
if (inputItem.value.length == 0) {
|
|
251
|
+
isCustomFieldValid = false;
|
|
252
|
+
const errorMsg = salla.lang.get('common.errors.field_required', { attribute: inputItem.title });
|
|
253
|
+
this.validateField(inputItem, errorMsg);
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
if (emailValidation && isPhoneValid && isFirstNameValid && isLastNameValid && isCustomFieldValid)
|
|
209
259
|
return;
|
|
210
260
|
!isEmailValid && this.validateField(this.regEmail, this.emailErrorMsg);
|
|
211
261
|
!isFirstNameValid && this.validateField(this.firstName, this.firstNameErrorMsg);
|
|
212
262
|
!isLastNameValid && this.validateField(this.lastName, this.lastNameErrorMsg);
|
|
213
263
|
throw ('Please insert required fields');
|
|
214
264
|
}
|
|
265
|
+
getFilepondPlaceholder() {
|
|
266
|
+
return `<div class="s-login-modal-filepond-placeholder"><span class="s-login-modal-filepond-placeholder-icon">${CameraIcon}</span><p class="s-login-modal-filepond-placeholder-text">${this.dragAndDrop}</p> <span class="filepond--label-action">${this.browseFromFiles}</span></div>`;
|
|
267
|
+
}
|
|
215
268
|
// eslint-disable-next-line @stencil/own-methods-must-be-private
|
|
216
269
|
validateField(field, errorMsg) {
|
|
217
270
|
field.classList.add('s-has-error');
|
|
@@ -242,7 +295,20 @@ const SallaLoginModal$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEle
|
|
|
242
295
|
h("a", { href: "#", onClick: () => this.showTab(this.emailTab), class: "s-login-modal-link" }, salla.lang.get('blocks.header.login_by_email')) : '', h("slot", { name: "after-login-mobile" })) : '', this.isEmailAllowed ?
|
|
243
296
|
h("div", { class: this.generateTabClasses('login-email'), "data-name": "login-email", ref: tab => this.emailTab = tab }, h("slot", { name: "before-login-email" }), h("label", { class: "s-login-modal-label" }, salla.lang.get('common.elements.email')), h("form", { onSubmit: () => this.loginByEmail(event), method: "POST" }, h("input", { type: "email", ref: el => this.loginEmail = el, onKeyDown: e => this.typing(e), placeholder: "your@email.com", enterkeyhint: "next", class: "s-login-modal-input s-ltr" }), h("span", { class: "s-login-modal-error-message" }), h("salla-button", { "loader-position": 'center', width: "wide", onClick: () => this.loginByEmail(), ref: b => this.emailBtn = b }, salla.lang.get('blocks.header.enter'))), this.isMobileAllowed ?
|
|
244
297
|
h("a", { href: "#", onClick: () => this.showTab(this.mobileTab), class: "s-login-modal-link" }, salla.lang.get('blocks.header.login_by_sms'))
|
|
245
|
-
: '', h("slot", { name: "after-login-email" })) : '', h("salla-verify", { display: "inline", "support-web-auth": this.supportWebAuth ? 'true' : 'false', class: this.generateTabClasses('otp'), "data-name": "otp", ref: tab => this.verifyTab = tab, autoReload: false }, h("a", { onClick: () => this.showTab(this.regType == 'phone' ? this.mobileTab : this.emailTab), class: "s-verify-back", innerHTML: ArrowRightIcon, slot: "after-footer", href: "#" })), h("div", { "data-name": "registration", class: this.generateTabClasses('registration'), ref: tab => this.registrationTab = tab }, h("slot", { name: "before-registration" }), h("div", null, h("label", { class: "s-login-modal-label" }, salla.lang.get('blocks.header.your_name')), h("input", { type: "text", class: "s-login-modal-input", ref: el => this.firstName = el, onKeyDown: e => this.typing(e, this.newUser), placeholder: salla.lang.get('pages.profile.first_name') }), h("span", { class: "s-login-modal-error-message" })), h("div", null, h("label", { class: "s-login-modal-label" }, salla.lang.get('pages.profile.last_name')), h("input", { type: "text", class: "s-login-modal-input", ref: el => this.lastName = el, onKeyDown: e => this.typing(e, this.newUser), placeholder: salla.lang.get('pages.profile.last_name') }), h("span", { class: "s-login-modal-error-message" })), h("div", { class: this.generateRegClasses('phone') }, h("label", { class: "s-login-modal-label" }, salla.lang.get('common.elements.mobile')), h("salla-tel-input", { ref: el => this.regTelInput = el, onKeyDown: e => this.typing(e, this.newUser) })), h("div", { class: this.generateRegClasses('email') }, h("label", { class: "s-login-modal-label" }, salla.lang.get('common.elements.email')), h("input", { type: "email", ref: el => this.regEmail = el, onKeyDown: e => this.typing(e, this.newUser), placeholder: "your@email.com", class: "s-login-modal-input s-ltr" }), h("span", { class: "s-login-modal-error-message" })), h("
|
|
298
|
+
: '', h("slot", { name: "after-login-email" })) : '', h("salla-verify", { display: "inline", "support-web-auth": this.supportWebAuth ? 'true' : 'false', class: this.generateTabClasses('otp'), "data-name": "otp", ref: tab => this.verifyTab = tab, autoReload: false }, h("a", { onClick: () => this.showTab(this.regType == 'phone' ? this.mobileTab : this.emailTab), class: "s-verify-back", innerHTML: ArrowRightIcon, slot: "after-footer", href: "#" })), h("div", { "data-name": "registration", class: this.generateTabClasses('registration'), ref: tab => this.registrationTab = tab }, h("slot", { name: "before-registration" }), h("div", null, h("label", { class: "s-login-modal-label" }, salla.lang.get('blocks.header.your_name')), h("input", { type: "text", class: "s-login-modal-input", ref: el => this.firstName = el, onKeyDown: e => this.typing(e, this.newUser), placeholder: salla.lang.get('pages.profile.first_name') }), h("span", { class: "s-login-modal-error-message" })), h("div", null, h("label", { class: "s-login-modal-label" }, salla.lang.get('pages.profile.last_name')), h("input", { type: "text", class: "s-login-modal-input", ref: el => this.lastName = el, onKeyDown: e => this.typing(e, this.newUser), placeholder: salla.lang.get('pages.profile.last_name') }), h("span", { class: "s-login-modal-error-message" })), h("div", { class: this.generateRegClasses('phone') }, h("label", { class: "s-login-modal-label" }, salla.lang.get('common.elements.mobile')), h("salla-tel-input", { ref: el => this.regTelInput = el, onKeyDown: e => this.typing(e, this.newUser) })), h("div", { class: this.generateRegClasses('email') }, h("label", { class: "s-login-modal-label" }, salla.lang.get('common.elements.email')), h("input", { type: "email", ref: el => this.regEmail = el, onKeyDown: e => this.typing(e, this.newUser), placeholder: "your@email.com", class: "s-login-modal-input s-ltr" }), h("span", { class: "s-login-modal-error-message" })), h("div", { class: "s-login-modal-custom-fields", ref: el => this.customFieldsWrapper = el }, this.customFields.map((field) => {
|
|
299
|
+
if (field.type === CustomFieldType.PHOTO) {
|
|
300
|
+
return [
|
|
301
|
+
h("label", { class: "s-login-modal-label" }, field.label),
|
|
302
|
+
h("salla-file-upload", { "instant-upload": true, labelIdle: this.getFilepondPlaceholder(), id: `${field.id}`, title: field.label, required: field.required }),
|
|
303
|
+
h("span", { class: "s-login-modal-error-message" })
|
|
304
|
+
];
|
|
305
|
+
}
|
|
306
|
+
return [
|
|
307
|
+
h("label", { class: "s-login-modal-label" }, field.label),
|
|
308
|
+
h("input", { type: "text", onKeyDown: e => this.typing(e, this.newUser), onInput: el => field.type == CustomFieldType.NUMBER ? salla.helpers.inputDigitsOnly(el.target) : {}, placeholder: field.description, required: field.required, title: field.label, id: `${field.id}`, class: "s-login-modal-input s-ltr" }),
|
|
309
|
+
h("span", { class: "s-login-modal-error-message" })
|
|
310
|
+
];
|
|
311
|
+
})), h("salla-button", { "loader-position": 'center', width: "wide", onClick: () => this.newUser(), ref: b => this.regBtn = b }, salla.lang.get('blocks.header.register')), h("slot", { name: "after-registration" })))));
|
|
246
312
|
}
|
|
247
313
|
get host() { return this; }
|
|
248
314
|
static get style() { return sallaLoginModalCss; }
|
|
@@ -258,13 +324,17 @@ const SallaLoginModal$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEle
|
|
|
258
324
|
"emailErrorMsg": [32],
|
|
259
325
|
"firstNameErrorMsg": [32],
|
|
260
326
|
"lastNameErrorMsg": [32],
|
|
327
|
+
"dragAndDrop": [32],
|
|
328
|
+
"browseFromFiles": [32],
|
|
329
|
+
"customFields": [32],
|
|
330
|
+
"uploadedImage": [32],
|
|
261
331
|
"open": [64]
|
|
262
332
|
}, [[8, "verified", "onVerified"]]]);
|
|
263
333
|
function defineCustomElement$1() {
|
|
264
334
|
if (typeof customElements === "undefined") {
|
|
265
335
|
return;
|
|
266
336
|
}
|
|
267
|
-
const components = ["salla-login-modal", "salla-button", "salla-loading", "salla-modal", "salla-tel-input", "salla-verify"];
|
|
337
|
+
const components = ["salla-login-modal", "salla-button", "salla-file-upload", "salla-loading", "salla-modal", "salla-tel-input", "salla-verify"];
|
|
268
338
|
components.forEach(tagName => { switch (tagName) {
|
|
269
339
|
case "salla-login-modal":
|
|
270
340
|
if (!customElements.get(tagName)) {
|
|
@@ -272,6 +342,11 @@ function defineCustomElement$1() {
|
|
|
272
342
|
}
|
|
273
343
|
break;
|
|
274
344
|
case "salla-button":
|
|
345
|
+
if (!customElements.get(tagName)) {
|
|
346
|
+
defineCustomElement$7();
|
|
347
|
+
}
|
|
348
|
+
break;
|
|
349
|
+
case "salla-file-upload":
|
|
275
350
|
if (!customElements.get(tagName)) {
|
|
276
351
|
defineCustomElement$6();
|
|
277
352
|
}
|
|
@@ -463,15 +463,21 @@ const SallaMap$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
463
463
|
*/
|
|
464
464
|
this.searchable = false;
|
|
465
465
|
/**
|
|
466
|
-
*
|
|
466
|
+
* Latitude coordinate, defaults to Mecca 🕋 ❤️
|
|
467
467
|
*/
|
|
468
|
-
// start in mecca 🕋 ❤️
|
|
469
468
|
this.lat = 21.419421;
|
|
469
|
+
/**
|
|
470
|
+
* Longitude coordinate, defaults to Mecca 🕋 ❤️
|
|
471
|
+
*/
|
|
470
472
|
this.lng = 39.82553;
|
|
471
473
|
/**
|
|
472
474
|
* Sets google api key value
|
|
473
475
|
*/
|
|
474
476
|
this.apiKey = null;
|
|
477
|
+
/**
|
|
478
|
+
* Modal Title
|
|
479
|
+
*/
|
|
480
|
+
this.modalTitle = this.modalActivityTitle;
|
|
475
481
|
/**
|
|
476
482
|
* Sets start map zoom.
|
|
477
483
|
*/
|
|
@@ -635,7 +641,7 @@ const SallaMap$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
635
641
|
}
|
|
636
642
|
// rendering functions
|
|
637
643
|
getLocationModal() {
|
|
638
|
-
return (h("div", null, h("div", { class: "s-map-modal-title" }, this.
|
|
644
|
+
return (h("div", null, h("div", { class: "s-map-modal-title" }, this.modalTitle), h("div", { class: "s-map-modal-body" }, h("div", { class: "s-map-element", ref: el => (this.mapElement = el) }), this.readonly ? "" :
|
|
639
645
|
[
|
|
640
646
|
this.searchable && (h("div", { class: "s-map-search-wrapper" }, h("input", { class: "s-map-search-input", ref: el => (this.searchInput = el) }))),
|
|
641
647
|
h("salla-button", { class: "s-map-my-location-button", onClick: () => {
|
|
@@ -669,6 +675,7 @@ const SallaMap$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
669
675
|
"lat": [1026],
|
|
670
676
|
"lng": [1026],
|
|
671
677
|
"apiKey": [1025, "api-key"],
|
|
678
|
+
"modalTitle": [1, "modal-title"],
|
|
672
679
|
"zoom": [1026],
|
|
673
680
|
"theme": [1025],
|
|
674
681
|
"modalActivityTitle": [32],
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
4
|
import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
|
|
5
|
+
import { C as CameraIcon } from './camera.js';
|
|
5
6
|
import { d as defineCustomElement$4 } from './salla-conditional-fields2.js';
|
|
6
7
|
import { d as defineCustomElement$3 } from './salla-datetime-picker2.js';
|
|
7
8
|
import { d as defineCustomElement$2 } from './salla-file-upload2.js';
|
|
@@ -36,13 +37,6 @@ const CheckCircleIcon = `<!-- Generated by IcoMoon.io -->
|
|
|
36
37
|
</svg>
|
|
37
38
|
`;
|
|
38
39
|
|
|
39
|
-
const CameraIcon = `<!-- Generated by IcoMoon.io -->
|
|
40
|
-
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">
|
|
41
|
-
<title>camera</title>
|
|
42
|
-
<path d="M16 10.667c-4.044 0-7.333 3.289-7.333 7.333s3.289 7.333 7.333 7.333 7.333-3.289 7.333-7.333-3.289-7.333-7.333-7.333zM16 22.667c-2.573 0-4.667-2.093-4.667-4.667s2.093-4.667 4.667-4.667 4.667 2.093 4.667 4.667-2.093 4.667-4.667 4.667zM28 5.333h-3.287l-2.271-3.407c-0.248-0.371-0.664-0.593-1.109-0.593h-10.667c-0.445 0-0.861 0.223-1.109 0.593l-2.271 3.407h-3.287c-2.205 0-4 1.795-4 4v17.333c0 2.205 1.795 4 4 4h24c2.205 0 4-1.795 4-4v-17.333c0-2.205-1.795-4-4-4zM29.333 26.667c0 0.735-0.599 1.333-1.333 1.333h-24c-0.735 0-1.333-0.599-1.333-1.333v-17.333c0-0.735 0.599-1.333 1.333-1.333h4c0.445 0 0.861-0.223 1.109-0.593l2.272-3.407h9.239l2.271 3.407c0.248 0.371 0.664 0.593 1.109 0.593h4c0.735 0 1.333 0.599 1.333 1.333zM25.333 10.66c-0.736 0-1.333 0.604-1.333 1.34s0.597 1.333 1.333 1.333 1.333-0.597 1.333-1.333v-0.013c0-0.736-0.597-1.327-1.333-1.327z"></path>
|
|
43
|
-
</svg>
|
|
44
|
-
`;
|
|
45
|
-
|
|
46
40
|
const sallaProductOptionsCss = "";
|
|
47
41
|
|
|
48
42
|
const SallaProductOptions$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
@@ -60,7 +54,6 @@ const SallaProductOptions$1 = /*@__PURE__*/ proxyCustomElement(class extends HTM
|
|
|
60
54
|
this.dateTimeSelected = createEvent(this, "dateTimeSelected", 7);
|
|
61
55
|
this.dateSelected = createEvent(this, "dateSelected", 7);
|
|
62
56
|
this.timeSelected = createEvent(this, "timeSelected", 7);
|
|
63
|
-
this.options = [];
|
|
64
57
|
this.uploadedImage = undefined;
|
|
65
58
|
this.outOfStockText = salla.lang.get("pages.products.out_of_stock");
|
|
66
59
|
this.donationAmount = salla.lang.get('pages.products.donation_amount');
|
|
@@ -68,16 +61,22 @@ const SallaProductOptions$1 = /*@__PURE__*/ proxyCustomElement(class extends HTM
|
|
|
68
61
|
* The id of the product to which the options are going to be fetched for.
|
|
69
62
|
*/
|
|
70
63
|
this.productId = salla.config.get('page.id');
|
|
71
|
-
if (this.product) {
|
|
72
|
-
this.setProductDetail(JSON.parse(this.product));
|
|
73
|
-
}
|
|
74
|
-
else if (this.productId) {
|
|
75
|
-
this.fetchProductOptions();
|
|
76
|
-
}
|
|
77
64
|
salla.lang.onLoaded(() => {
|
|
78
65
|
this.outOfStockText = salla.lang.get("pages.products.out_of_stock");
|
|
79
66
|
this.donationAmount = salla.lang.get('pages.products.donation_amount');
|
|
80
67
|
});
|
|
68
|
+
if (this.options) {
|
|
69
|
+
try {
|
|
70
|
+
this.optionsData = JSON.parse(this.options);
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
catch (e) {
|
|
74
|
+
salla.log('Bad json passed via options prop');
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
if (this.productId && !salla.url.is_page('cart')) {
|
|
78
|
+
salla.api.product.getDetails(this.productId, ['options']).then(resp => this.optionsData = resp.data.options);
|
|
79
|
+
}
|
|
81
80
|
}
|
|
82
81
|
//todo:: typo here, but I think we will drop it anyway😌
|
|
83
82
|
handleMultiSelectFieldInput() {
|
|
@@ -88,18 +87,6 @@ const SallaProductOptions$1 = /*@__PURE__*/ proxyCustomElement(class extends HTM
|
|
|
88
87
|
}
|
|
89
88
|
this.itemsSelected.emit(multiSelectedItems);
|
|
90
89
|
}
|
|
91
|
-
/**
|
|
92
|
-
* Image Selection
|
|
93
|
-
*/
|
|
94
|
-
setProductDetail(detail) {
|
|
95
|
-
this.productDetail = detail;
|
|
96
|
-
this.options = detail.options;
|
|
97
|
-
}
|
|
98
|
-
fetchProductOptions() {
|
|
99
|
-
return salla.api.product.getDetails(this.productId, ['options']).then(resp => {
|
|
100
|
-
this.setProductDetail(resp.data);
|
|
101
|
-
});
|
|
102
|
-
}
|
|
103
90
|
getDisplayForType(option) {
|
|
104
91
|
if (this[`${option.type}Option`]) {
|
|
105
92
|
return this[`${option.type}Option`](option);
|
|
@@ -113,35 +100,22 @@ const SallaProductOptions$1 = /*@__PURE__*/ proxyCustomElement(class extends HTM
|
|
|
113
100
|
salla.log(`Couldn't find options type(${option.type})😢`);
|
|
114
101
|
return '';
|
|
115
102
|
}
|
|
103
|
+
getOptionShownWhen(option) {
|
|
104
|
+
return option.visibility_condition
|
|
105
|
+
? { "data-show-when": `options[${option.visibility_condition.option}] ${option.visibility_condition.operator} ${option.visibility_condition.value}` }
|
|
106
|
+
: {};
|
|
107
|
+
}
|
|
116
108
|
render() {
|
|
117
|
-
if (this.
|
|
109
|
+
if (this.optionsData.length == 0) {
|
|
118
110
|
return;
|
|
119
111
|
}
|
|
120
|
-
return (h(Host, { class: "s-product-options-wrapper" }, h("salla-conditional-fields", null, this.
|
|
112
|
+
return (h(Host, { class: "s-product-options-wrapper" }, h("salla-conditional-fields", null, this.optionsData.map((option) => h("div", Object.assign({ class: `s-product-options-option-container${option.visibility_condition ? ' hidden' : ''}` }, this.getOptionShownWhen(option)), option.name == 'splitter' ?
|
|
121
113
|
this.splitterOption()
|
|
122
114
|
: h("div", { class: "s-product-options-option" }, h("label", { htmlFor: 'options[' + option.id + ']', class: "s-product-options-option-label" }, h("b", null, option.name, option.required && h("span", null, " * "), " "), h("small", null, option.placeholder)), h("div", { class: "s-product-options-option-content" }, this.getDisplayForType(option))))))));
|
|
123
115
|
}
|
|
124
116
|
//@ts-ignore
|
|
125
|
-
colorOption(option) {
|
|
126
|
-
return h("fieldset", { class: "s-product-options-colors-wrapper" }, option === null || option === void 0 ? void 0 : option.details.map((value) => h("div", null, h("input", { onChange: e => this.colorSelected.emit(e), name: `color-choice-${option.id}`, id: `color-choice-${option.id}-${value.id}`, required: true, type: "radio" }), h("label", { htmlFor: `color-choice-${option.id}-${value.id}` }, h("span", { style: { "background-color": value.color } }), h("p", null, value.name)))));
|
|
127
|
-
}
|
|
128
|
-
//@ts-ignore
|
|
129
|
-
dateOption(option) {
|
|
130
|
-
//todo:: consider date-range @see https://github.com/SallaApp/theme-raed/blob/master/src/assets/js/partials/product-options.js#L8-L23
|
|
131
|
-
return h("div", { class: "s-product-options-date-element" }, h("salla-datetime-picker", { onPicked: e => this.dateSelected.emit(e), placeholder: option.name }));
|
|
132
|
-
}
|
|
133
|
-
//@ts-ignore
|
|
134
|
-
datetimeOption(option) {
|
|
135
|
-
//todo:: consider date-range @see https://github.com/SallaApp/theme-raed/blob/master/src/assets/js/partials/product-options.js#L8-L23
|
|
136
|
-
return h("div", { class: "s-product-options-datetime-element" }, 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) }));
|
|
137
|
-
}
|
|
138
|
-
//@ts-ignore
|
|
139
117
|
donationOption(option) {
|
|
140
|
-
|
|
141
|
-
let donation = this.productDetail.donation;
|
|
142
|
-
if (!donation)
|
|
143
|
-
return '';
|
|
144
|
-
return h("div", { class: "s-product-options-donation-wrapper" }, 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 : '' }), h("span", { class: "s-product-options-donation-amount-currency" }, salla.config.currency(salla.config.get('user.currency_code')).symbol));
|
|
118
|
+
return h("div", { class: "s-product-options-donation-wrapper" }, 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) }), h("span", { class: "s-product-options-donation-amount-currency" }, salla.config.currency(salla.config.get('user.currency_code')).symbol));
|
|
145
119
|
}
|
|
146
120
|
getFilepondPlaceholder() {
|
|
147
121
|
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>`;
|
|
@@ -151,6 +125,7 @@ const SallaProductOptions$1 = /*@__PURE__*/ proxyCustomElement(class extends HTM
|
|
|
151
125
|
this.uploader.querySelector('.filepond--root').style.height = '120px';
|
|
152
126
|
}, 1000);
|
|
153
127
|
}
|
|
128
|
+
//todo:: why we need this way, use the native way!!
|
|
154
129
|
//@ts-ignore
|
|
155
130
|
selectThumbnail(e, value) {
|
|
156
131
|
this.thumbnailSelected.emit(e);
|
|
@@ -185,21 +160,10 @@ const SallaProductOptions$1 = /*@__PURE__*/ proxyCustomElement(class extends HTM
|
|
|
185
160
|
imageOption(option) {
|
|
186
161
|
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) });
|
|
187
162
|
}
|
|
188
|
-
multipleOptions(option) {
|
|
189
|
-
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) => {
|
|
190
|
-
return h("div", null, 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() }), h("label", { htmlFor: `field-${option.id}-${value.id}` }, value.name));
|
|
191
|
-
}));
|
|
192
|
-
}
|
|
193
163
|
//@ts-ignore
|
|
194
164
|
numberOption(option) {
|
|
195
165
|
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" });
|
|
196
166
|
}
|
|
197
|
-
singleOption(option) {
|
|
198
|
-
return h("div", null, h("select", { name: `options[${option.id}]`, required: option.required, class: "s-form-control" }, h("option", { value: "" }, option.placeholder), option === null || option === void 0 ? void 0 :
|
|
199
|
-
option.details.map((op) => {
|
|
200
|
-
return h("option", { onChange: e => this.singleSelectOptionSelected.emit(e), value: op.id }, op.name);
|
|
201
|
-
})));
|
|
202
|
-
}
|
|
203
167
|
//@ts-ignore
|
|
204
168
|
splitterOption() {
|
|
205
169
|
return h("div", { class: "s-product-options-splitter" });
|
|
@@ -212,24 +176,59 @@ const SallaProductOptions$1 = /*@__PURE__*/ proxyCustomElement(class extends HTM
|
|
|
212
176
|
textareaOption(option) {
|
|
213
177
|
return h("div", { class: "s-product-options-textarea" }, h("div", { class: "mt-1" }, 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" })));
|
|
214
178
|
}
|
|
179
|
+
/**
|
|
180
|
+
* ============= Date Time options =============
|
|
181
|
+
*/
|
|
182
|
+
//@ts-ignore
|
|
183
|
+
timeOption(option) {
|
|
184
|
+
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) });
|
|
185
|
+
}
|
|
186
|
+
//@ts-ignore
|
|
187
|
+
dateOption(option) {
|
|
188
|
+
//todo:: consider date-range @see https://github.com/SallaApp/theme-raed/blob/master/src/assets/js/partials/product-options.js#L8-L23
|
|
189
|
+
return h("div", { class: "s-product-options-date-element" }, h("salla-datetime-picker", { onPicked: e => this.dateSelected.emit(e), placeholder: option.name }));
|
|
190
|
+
}
|
|
191
|
+
//@ts-ignore
|
|
192
|
+
datetimeOption(option) {
|
|
193
|
+
//todo:: consider date-range @see https://github.com/SallaApp/theme-raed/blob/master/src/assets/js/partials/product-options.js#L8-L23
|
|
194
|
+
return h("div", { class: "s-product-options-datetime-element" }, 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) }));
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* ============= Advanced options =============
|
|
198
|
+
*/
|
|
199
|
+
getOptionDetailName(detail, outOfStock = true) {
|
|
200
|
+
return detail.name
|
|
201
|
+
+ ((outOfStock && detail.is_out) ? ` - ${this.outOfStockText}` : '')
|
|
202
|
+
+ (detail.additional_price ? ` (${salla.money(detail.additional_price)})` : '');
|
|
203
|
+
}
|
|
204
|
+
singleOption(option) {
|
|
205
|
+
return h("div", null, h("select", { name: `options[${option.id}]`, required: option.required, class: "s-form-control" }, h("option", { value: "" }, option.placeholder), option === null || option === void 0 ? void 0 :
|
|
206
|
+
option.details.map((detail) => {
|
|
207
|
+
return h("option", { value: detail.id, disabled: detail.is_out, selected: detail.is_selected, onChange: e => this.singleSelectOptionSelected.emit(e) }, this.getOptionDetailName(detail));
|
|
208
|
+
})));
|
|
209
|
+
}
|
|
210
|
+
multipleOptions(option) {
|
|
211
|
+
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((detail) => {
|
|
212
|
+
return h("div", null, h("input", { type: "checkbox", value: detail.id, disabled: detail.is_out, checked: detail.is_selected, name: `options[${option.id}]`, id: `field-${option.id}-${detail.id}`, onChange: () => this.handleMultiSelectFieldInput(), "aria-describedby": `options[${option.id}]-description` }), h("label", { htmlFor: `field-${option.id}-${detail.id}` }, this.getOptionDetailName(detail)));
|
|
213
|
+
}));
|
|
214
|
+
}
|
|
215
|
+
//@ts-ignore
|
|
216
|
+
colorOption(option) {
|
|
217
|
+
return h("fieldset", { class: "s-product-options-colors-wrapper" }, option === null || option === void 0 ? void 0 : option.details.map((detail) => h("div", null, h("input", { type: "radio", value: detail.id, disabled: detail.is_out, required: option.required, checked: detail.is_selected, name: `options[${option.id}]`, id: `color-${this.productId}-${option.id}-${detail.id}`, onChange: e => this.colorSelected.emit(e) }), h("label", { htmlFor: `color-${this.productId}-${option.id}-${detail.id}` }, h("span", { style: { "background-color": detail.color } }), h("p", null, this.getOptionDetailName(detail))))));
|
|
218
|
+
}
|
|
215
219
|
//@ts-ignore
|
|
216
220
|
thumbnailOption(option) {
|
|
217
221
|
return h("div", { class: "s-product-options-thumbnails-wrapper" }, option.details.map((detail) => {
|
|
218
|
-
return h("div", null, h("input", {
|
|
222
|
+
return h("div", null, h("input", { type: "radio", value: detail.id, "data-itemid": detail.id, disabled: detail.is_out, required: option.required, checked: detail.is_selected, name: `options[${option.id}]`, "data-img-id": detail.option_value, id: `option_${this.productId}-${option.id}_${detail.id}`, onChange: (e) => this.selectThumbnail(e, detail.option_value) }), h("label", { htmlFor: `option_${this.productId}-${option.id}_${detail.id}`, "data-img-id": detail.option_value, class: "go-to-slide" }, h("img", { "data-src": detail.image, src: detail.image, title: detail.name, alt: detail.name }), h("span", { innerHTML: CheckCircleIcon, class: "s-product-options-thumbnails-icon" })), h("p", null, this.getOptionDetailName(detail, false), " "), detail.is_out ?
|
|
219
223
|
[h("small", { class: "s-product-options-thumbnails-stock-badge" }, this.outOfStockText), h("div", { class: "s-product-options-thumbnails-badge-overlay" })]
|
|
220
224
|
: '');
|
|
221
225
|
}));
|
|
222
226
|
}
|
|
223
|
-
//@ts-ignore
|
|
224
|
-
timeOption(option) {
|
|
225
|
-
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) });
|
|
226
|
-
}
|
|
227
227
|
static get style() { return sallaProductOptionsCss; }
|
|
228
228
|
}, [0, "salla-product-options", {
|
|
229
229
|
"productId": [2, "product-id"],
|
|
230
|
-
"
|
|
231
|
-
"
|
|
232
|
-
"options": [32],
|
|
230
|
+
"options": [1],
|
|
231
|
+
"optionsData": [32],
|
|
233
232
|
"uploadedImage": [32],
|
|
234
233
|
"outOfStockText": [32],
|
|
235
234
|
"donationAmount": [32]
|
|
@@ -53,6 +53,10 @@ const SallaSwiper = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
53
53
|
* Vertical or Horizontal thumbs slider
|
|
54
54
|
*/
|
|
55
55
|
this.verticalThumbs = false;
|
|
56
|
+
/**
|
|
57
|
+
* Vertical or Horizontal main slider
|
|
58
|
+
*/
|
|
59
|
+
this.vertical = false;
|
|
56
60
|
/**
|
|
57
61
|
* Auto Height slider
|
|
58
62
|
*/
|
|
@@ -129,13 +133,22 @@ const SallaSwiper = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
129
133
|
slidesPerView: 'auto',
|
|
130
134
|
spaceBetween: 0,
|
|
131
135
|
},
|
|
132
|
-
|
|
136
|
+
fullwidth: {
|
|
133
137
|
speed: 750,
|
|
134
138
|
parallax: true,
|
|
135
139
|
autoplay: {
|
|
136
140
|
delay: 5000,
|
|
137
141
|
},
|
|
138
142
|
},
|
|
143
|
+
fullscreen: {
|
|
144
|
+
speed: 1000,
|
|
145
|
+
parallax: true,
|
|
146
|
+
direction: "vertical",
|
|
147
|
+
followFinger: false,
|
|
148
|
+
touchReleaseOnEdges: true,
|
|
149
|
+
lazy: true,
|
|
150
|
+
mousewheel: {}
|
|
151
|
+
},
|
|
139
152
|
testimonials: {
|
|
140
153
|
draggable: true,
|
|
141
154
|
slidesPerView: 1,
|
|
@@ -344,11 +357,14 @@ const SallaSwiper = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
344
357
|
} : false,
|
|
345
358
|
breakpoints: {
|
|
346
359
|
768: {
|
|
347
|
-
direction: this.
|
|
360
|
+
direction: this.vertical ? "vertical" : "horizontal",
|
|
348
361
|
},
|
|
349
362
|
},
|
|
350
363
|
};
|
|
351
|
-
|
|
364
|
+
this.pre_defined_config.fullscreen.mousewheel = {
|
|
365
|
+
releaseOnEdges: this.host.querySelectorAll('.swiper-slide').length > 1 ? false : true
|
|
366
|
+
},
|
|
367
|
+
pre_defined_config = Object.assign(Object.assign({}, pre_defined_config), (this.pre_defined_config[this.type] || {}));
|
|
352
368
|
if (this.type == 'thumbs') {
|
|
353
369
|
for (const slide of this.thumbsSliderWrapper.children) {
|
|
354
370
|
//todo:: use `s-slider-slide`
|
|
@@ -393,7 +409,13 @@ const SallaSwiper = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
393
409
|
});
|
|
394
410
|
this.slider.on('reachBeginning', (slider) => this.reachBeginning.emit(slider));
|
|
395
411
|
this.slider.on('reachEnd', (slider) => this.reachEnd.emit(slider));
|
|
396
|
-
this.slider.on('slideChangeTransitionEnd', (slider) =>
|
|
412
|
+
this.slider.on('slideChangeTransitionEnd', (slider) => {
|
|
413
|
+
if (this.type == "fullscreen") {
|
|
414
|
+
const activeIndex = slider.activeIndex;
|
|
415
|
+
slider.params.mousewheel.releaseOnEdges = activeIndex === 0 || (activeIndex === slider.slides.length - 1);
|
|
416
|
+
}
|
|
417
|
+
this.slideChangeTransitionEnd.emit(slider);
|
|
418
|
+
});
|
|
397
419
|
this.slider.on('slideChangeTransitionStart', (slider) => this.slideChangeTransitionStart.emit(slider));
|
|
398
420
|
this.slider.on('slideNextTransitionEnd', (slider) => this.slideNextTransitionEnd.emit(slider));
|
|
399
421
|
this.slider.on('slideNextTransitionStart', (slider) => this.slideNextTransitionStart.emit(slider));
|
|
@@ -420,7 +442,7 @@ const SallaSwiper = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
420
442
|
: '', this.showControls ?
|
|
421
443
|
h("div", { class: "s-slider-block__title-nav", dir: "rtl" }, h("button", { "aria-label": "Previous Slide", class: "s-slider-prev s-slider-nav-arrow" }, h("span", { class: "s-slider-button-icon", innerHTML: this.isRTL ? KeyboardArrowRightIcon : ArrowLeftIcon })), h("button", { "aria-label": "Next Slide", class: "s-slider-next s-slider-nav-arrow" }, h("span", { class: "s-slider-button-icon", innerHTML: this.isRTL ? ArrowLeftIcon : KeyboardArrowRightIcon })))
|
|
422
444
|
: ''))
|
|
423
|
-
: '', h("div", { class: "swiper s-slider-container", ref: el => this.sliderContainer = el }, h("slot", null), h("div", { class: "swiper-wrapper s-slider-swiper-wrapper", ref: el => this.sliderWrapper = el }, h("slot", { name: 'items' })), this.pagination ? h("div", { class: "swiper-pagination" }) : ''), this.type == 'thumbs' ? h("div", { class: "s-slider-thumbs" }, h("div", { class: "swiper s-slider-thumbs-container", ref: el => this.thumbsSliderContainer = el }, h("div", { class: "s-slider-swiper-wrapper swiper-wrapper", ref: el => this.thumbsSliderWrapper = el }, h("slot", { name: "thumbs" })), this.showThumbsControls ? [h("div", { class: "s-slider-button s-slider-button-prev" }, h("salla-button", { disabled: this.isRTL ? (_a = this.thumbsSlider) === null || _a === void 0 ? void 0 : _a.isEnd : (_b = this.thumbsSlider) === null || _b === void 0 ? void 0 : _b.isBeginning, shape: "icon", color: "light", onClick: () => this.isRTL ? this.thumbsSlider.slideNext() : this.thumbsSlider.slidePrev() }, h("span", { class: "s-slider-button-icon", innerHTML: salla.config.get('theme.is_rtl') ? ArrowLeftIcon : KeyboardArrowRightIcon }))), h("div", { class: "s-slider-button s-slider-button-next" }, h("salla-button", { disabled: this.isRTL ? (_c = this.thumbsSlider) === null || _c === void 0 ? void 0 : _c.isBeginning : (_d = this.thumbsSlider) === null || _d === void 0 ? void 0 : _d.isEnd, shape: "icon", color: "light", onClick: () => this.isRTL ? this.thumbsSlider.slidePrev() : this.thumbsSlider.slideNext() }, h("span", { class: "s-slider-button-icon", innerHTML: salla.config.get('theme.is_rtl') ? KeyboardArrowRightIcon : ArrowLeftIcon })))] : '')) : ''));
|
|
445
|
+
: '', h("div", { class: "swiper s-slider-container", ref: el => this.sliderContainer = el }, h("slot", null), h("div", { class: "swiper-wrapper s-slider-swiper-wrapper", ref: el => this.sliderWrapper = el }, h("slot", { name: 'items' })), this.pagination ? h("div", { class: "swiper-pagination" }) : ''), this.type == 'thumbs' ? h("div", { class: "s-slider-thumbs" }, h("div", { class: "swiper s-slider-thumbs-container", ref: el => this.thumbsSliderContainer = el }, h("div", { class: "s-slider-swiper-wrapper swiper-wrapper", ref: el => this.thumbsSliderWrapper = el }, h("slot", { name: "thumbs" })), this.showThumbsControls ? [h("div", { class: "s-slider-button s-slider-button-prev" }, h("salla-button", { disabled: this.isRTL && !this.verticalThumbs ? (_a = this.thumbsSlider) === null || _a === void 0 ? void 0 : _a.isEnd : (_b = this.thumbsSlider) === null || _b === void 0 ? void 0 : _b.isBeginning, shape: "icon", color: "light", onClick: () => this.isRTL && !this.verticalThumbs ? this.thumbsSlider.slideNext() : this.thumbsSlider.slidePrev() }, h("span", { class: "s-slider-button-icon", innerHTML: salla.config.get('theme.is_rtl') ? ArrowLeftIcon : KeyboardArrowRightIcon }))), h("div", { class: "s-slider-button s-slider-button-next" }, h("salla-button", { disabled: this.isRTL && !this.verticalThumbs ? (_c = this.thumbsSlider) === null || _c === void 0 ? void 0 : _c.isBeginning : (_d = this.thumbsSlider) === null || _d === void 0 ? void 0 : _d.isEnd, shape: "icon", color: "light", onClick: () => this.isRTL && !this.verticalThumbs ? this.thumbsSlider.slidePrev() : this.thumbsSlider.slideNext() }, h("span", { class: "s-slider-button-icon", innerHTML: salla.config.get('theme.is_rtl') ? KeyboardArrowRightIcon : ArrowLeftIcon })))] : '')) : ''));
|
|
424
446
|
}
|
|
425
447
|
componentDidLoad() {
|
|
426
448
|
let itemsSlot = this.sliderWrapper.querySelector('div[slot="items"]');
|
|
@@ -445,6 +467,7 @@ const SallaSwiper = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
445
467
|
"blockSubtitle": [513, "block-subtitle"],
|
|
446
468
|
"displayAllUrl": [513, "display-all-url"],
|
|
447
469
|
"verticalThumbs": [516, "vertical-thumbs"],
|
|
470
|
+
"vertical": [516],
|
|
448
471
|
"autoHeight": [516, "auto-height"],
|
|
449
472
|
"showControls": [516, "show-controls"],
|
|
450
473
|
"controlsOuter": [516, "controls-outer"],
|
|
@@ -56,7 +56,6 @@ const SallaUserMenu$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
|
56
56
|
this.hello = salla.lang.get("pages.checkout.hello");
|
|
57
57
|
this.first_name = salla.storage.get('user.first_name') || '';
|
|
58
58
|
this.last_name = salla.storage.get('user.last_name') || '';
|
|
59
|
-
this.has_red_dot = salla.storage.get('user.notifications') || salla.storage.get('user.pending_orders');
|
|
60
59
|
this.avatar = salla.storage.get('user.avatar') || salla.url.cdn('images/avatar.png');
|
|
61
60
|
this.badges = {
|
|
62
61
|
notifications: salla.helpers.number(salla.storage.get('user.notifications') || 0),
|
|
@@ -141,7 +140,7 @@ const SallaUserMenu$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
|
141
140
|
salla.auth.logout();
|
|
142
141
|
}
|
|
143
142
|
getTheHeader() {
|
|
144
|
-
return h("div", { class: { 's-user-menu-trigger-slot': true, 's-user-menu-red-dot': this.
|
|
143
|
+
return h("div", { class: { 's-user-menu-trigger-slot': true, 's-user-menu-red-dot': this.badges.pending_orders || this.badges.notifications, 's-user-menu-trigger-avatar-only': this.avatarOnly }, id: 'trigger-slot', onClick: (e) => this.open(e), innerHTML: this.triggerSlot
|
|
145
144
|
.replace(/\{hello\}/g, this.hello)
|
|
146
145
|
.replace(/\{first_name\}/g, this.first_name)
|
|
147
146
|
.replace(/\{last_name\}/g, this.last_name)
|
|
@@ -187,7 +186,6 @@ const SallaUserMenu$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEleme
|
|
|
187
186
|
"hello": [32],
|
|
188
187
|
"first_name": [32],
|
|
189
188
|
"last_name": [32],
|
|
190
|
-
"has_red_dot": [32],
|
|
191
189
|
"avatar": [32],
|
|
192
190
|
"badges": [32],
|
|
193
191
|
"OrderUpdate": [32]
|