@salla.sa/twilight-components 1.6.15-alpha.6 → 1.6.15-alpha.8
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/index-cac2fd59.js +2 -2
- package/dist/cjs/{index-69a7a6c7.js → index-e31283b9.js} +2 -2
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/{salla-button_27.cjs.entry.js → salla-button_28.cjs.entry.js} +120 -34
- package/dist/cjs/twilight.cjs.js +2 -2
- package/dist/collection/Helpers/Helper.js +16 -0
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/salla-infinite-scroll/salla-infinite-scroll.js +2 -1
- package/dist/collection/components/salla-login-modal/salla-login-modal.js +3 -2
- package/dist/collection/components/salla-modal/salla-modal.js +5 -4
- package/dist/collection/components/salla-product-availability/salla-product-availability.js +2 -1
- package/dist/collection/components/salla-product-size-guide/salla-product-size-guide.js +32 -30
- package/dist/collection/components/salla-rating-modal/salla-rating-modal.js +7 -6
- package/dist/collection/components/salla-rating-stars/salla-rating-stars.js +2 -1
- package/dist/collection/components/salla-search/salla-search.js +3 -2
- package/dist/collection/components/salla-user-settings/salla-user-settings.css +0 -0
- package/dist/collection/components/salla-user-settings/salla-user-settings.js +107 -0
- package/dist/collection/components/salla-verify/salla-verify.js +4 -2
- package/dist/components/Helper.js +33 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +3 -2
- package/dist/components/salla-infinite-scroll.js +2 -1
- package/dist/components/salla-login-modal.js +3 -2
- package/dist/components/salla-modal2.js +4 -3
- package/dist/components/salla-product-availability2.js +2 -1
- package/dist/components/salla-product-size-guide.js +13 -4
- package/dist/components/salla-quantity-input.js +2 -14
- package/dist/components/salla-rating-modal.js +7 -6
- package/dist/components/salla-rating-stars2.js +2 -1
- package/dist/components/salla-search.js +3 -2
- package/dist/components/salla-user-settings.d.ts +11 -0
- package/dist/components/salla-user-settings.js +116 -0
- package/dist/components/salla-verify2.js +4 -2
- package/dist/esm/index-0ce70ad2.js +2 -2
- package/dist/esm/{index-c55c8ada.js → index-ba113e58.js} +2 -2
- package/dist/esm/loader.js +2 -2
- package/dist/esm/{salla-button_27.entry.js → salla-button_28.entry.js} +120 -35
- package/dist/esm/twilight.js +2 -2
- package/dist/esm-es5/index-0ce70ad2.js +1 -1
- package/dist/esm-es5/{index-c55c8ada.js → index-ba113e58.js} +2 -2
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/{salla-button_27.entry.js → salla-button_28.entry.js} +4 -4
- package/dist/esm-es5/twilight.js +1 -1
- package/dist/twilight/{p-c2def1b6.system.js → p-06ea46ec.system.js} +2 -2
- package/dist/twilight/{p-72f4e219.js → p-1a47b5b8.js} +2 -2
- package/dist/twilight/{p-d836f54e.entry.js → p-8f5f328e.entry.js} +1 -1
- package/dist/twilight/p-c7334639.system.js +4 -0
- package/dist/twilight/{p-cd5fd608.system.entry.js → p-e45ddf3b.system.entry.js} +4 -4
- package/dist/twilight/twilight.esm.js +1 -1
- package/dist/twilight/twilight.js +1 -1
- package/dist/types/Helpers/Helper.d.ts +3 -0
- package/dist/types/components/salla-user-settings/salla-user-settings.d.ts +18 -0
- package/dist/types/components.d.ts +15 -0
- package/package.json +4 -4
- package/dist/twilight/p-5ad1bc70.system.js +0 -4
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
4
|
import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
|
|
5
|
+
import { H as Helper } from './Helper.js';
|
|
5
6
|
|
|
6
7
|
const sallaInfiniteScrollCss = "";
|
|
7
8
|
|
|
@@ -44,7 +45,7 @@ const SallaInfiniteScroll$1 = /*@__PURE__*/ proxyCustomElement(class extends HTM
|
|
|
44
45
|
}
|
|
45
46
|
loading(isLoading = true) {
|
|
46
47
|
let btnText = this.status.querySelector('.s-button-text');
|
|
47
|
-
|
|
48
|
+
Helper.toggleElementClassIf(btnText, 's-button-hide', 's-button-show', () => isLoading);
|
|
48
49
|
this.btnLoader.style.display = isLoading ? 'inherit' : 'none';
|
|
49
50
|
}
|
|
50
51
|
render() {
|
|
@@ -5,6 +5,7 @@ import { proxyCustomElement, HTMLElement, h } from '@stencil/core/internal/clien
|
|
|
5
5
|
import { e as email } from './mail.js';
|
|
6
6
|
import { K as KeyboardArrowRightIcon } from './keyboard_arrow_right.js';
|
|
7
7
|
import { A as ArrowRightIcon } from './arrow-right.js';
|
|
8
|
+
import { H as Helper } from './Helper.js';
|
|
8
9
|
import { d as defineCustomElement$6 } from './salla-button2.js';
|
|
9
10
|
import { d as defineCustomElement$5 } from './salla-loading2.js';
|
|
10
11
|
import { d as defineCustomElement$4 } from './salla-modal2.js';
|
|
@@ -68,7 +69,7 @@ const SallaLoginModal$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEle
|
|
|
68
69
|
};
|
|
69
70
|
this.loginByEmail = (event = null) => {
|
|
70
71
|
event === null || event === void 0 ? void 0 : event.preventDefault();
|
|
71
|
-
if (!
|
|
72
|
+
if (!Helper.isValidEmail(this.loginEmail.value)) {
|
|
72
73
|
this.validateField(this.loginEmail, this.emailErrorMsg);
|
|
73
74
|
return;
|
|
74
75
|
}
|
|
@@ -202,7 +203,7 @@ const SallaLoginModal$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEle
|
|
|
202
203
|
.finally(() => btn.stop() && btn.enable());
|
|
203
204
|
}
|
|
204
205
|
async newUserValidation() {
|
|
205
|
-
const isLogByPhone = this.regType == "phone", isLogByEmail = this.regType == "email", emailValue = this.regEmail.value || (isLogByEmail && this.loginEmail.value), isEmailValid =
|
|
206
|
+
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);
|
|
206
207
|
if (emailValidation && isPhoneValid && isFirstNameValid && isLastNameValid)
|
|
207
208
|
return;
|
|
208
209
|
!isEmailValid && this.validateField(this.regEmail, this.emailErrorMsg);
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
|
|
5
5
|
import { C as Cancel } from './cancel.js';
|
|
6
|
+
import { H as Helper } from './Helper.js';
|
|
6
7
|
import { d as defineCustomElement$1 } from './salla-loading2.js';
|
|
7
8
|
|
|
8
9
|
const AlertEngineIcon = `<!-- Generated by IcoMoon.io -->
|
|
@@ -127,7 +128,7 @@ const SallaModal = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
127
128
|
}
|
|
128
129
|
toggleModal(isOpen) {
|
|
129
130
|
const body = this.host.querySelector('.s-modal-body');
|
|
130
|
-
|
|
131
|
+
Helper.toggleElementClassIf(body, 's-modal-entering', 's-modal-leaving', () => isOpen)
|
|
131
132
|
.toggleElementClassIf(this.overlay, 's-modal-entering', 's-modal-overlay-leaving', () => isOpen)
|
|
132
133
|
.toggleElementClassIf(document.body, 'modal-is-open', 'modal-is-closed', () => isOpen);
|
|
133
134
|
if (!isOpen) {
|
|
@@ -163,8 +164,8 @@ const SallaModal = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
163
164
|
: '', this.modalTitle || this.subTitle ?
|
|
164
165
|
h("div", { class: "s-modal-header-inner" }, h("slot", { name: 'icon' }, !!this.iconStyle ?
|
|
165
166
|
h("div", { class: this.iconBlockClasses(), innerHTML: this.iconStyle == 'error' ? AlertEngineIcon : CheckCircle2 })
|
|
166
|
-
: ''), h("div", { class: "s-modal-header-content" }, h("div", { class: { 's-modal-title': true, 's-modal-title-below': this.subTitleFirst }, innerHTML: this.modalTitle }), h("p", { class: { 's-modal-sub-title': true }, innerHTML: this.subTitle })))
|
|
167
|
-
:
|
|
167
|
+
: ''), h("div", { class: "s-modal-header-content" }, this.modalTitle ? h("div", { class: { 's-modal-title': true, 's-modal-title-below': this.subTitleFirst }, innerHTML: this.modalTitle }) : '', this.subTitle ? h("p", { class: { 's-modal-sub-title': true }, innerHTML: this.subTitle }) : ''))
|
|
168
|
+
: ''), h("slot", null), h("slot", { name: "footer" })))));
|
|
168
169
|
}
|
|
169
170
|
//move the modal as root dom, because we need the model to be outside the forms
|
|
170
171
|
componentDidLoad() {
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
4
|
import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
|
|
5
|
+
import { H as Helper } from './Helper.js';
|
|
5
6
|
import { d as defineCustomElement$4 } from './salla-button2.js';
|
|
6
7
|
import { d as defineCustomElement$3 } from './salla-loading2.js';
|
|
7
8
|
import { d as defineCustomElement$2 } from './salla-modal2.js';
|
|
@@ -83,7 +84,7 @@ const SallaProductAvailability = /*@__PURE__*/ proxyCustomElement(class extends
|
|
|
83
84
|
async validateform() {
|
|
84
85
|
try {
|
|
85
86
|
if (this.channels_.includes('email')) {
|
|
86
|
-
const isEmailValid =
|
|
87
|
+
const isEmailValid = Helper.isValidEmail(this.email.value);
|
|
87
88
|
if (isEmailValid)
|
|
88
89
|
return;
|
|
89
90
|
!isEmailValid && this.validateField(this.email, salla.lang.get('common.elements.email_is_valid'));
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
|
-
import { proxyCustomElement, HTMLElement, h
|
|
4
|
+
import { proxyCustomElement, HTMLElement, h } from '@stencil/core/internal/client';
|
|
5
5
|
import { d as defineCustomElement$8 } from './salla-loading2.js';
|
|
6
6
|
import { d as defineCustomElement$7 } from './salla-modal2.js';
|
|
7
7
|
import { d as defineCustomElement$6 } from './salla-placeholder2.js';
|
|
@@ -10,6 +10,13 @@ import { d as defineCustomElement$4 } from './salla-tab-content2.js';
|
|
|
10
10
|
import { d as defineCustomElement$3 } from './salla-tab-header2.js';
|
|
11
11
|
import { d as defineCustomElement$2 } from './salla-tabs2.js';
|
|
12
12
|
|
|
13
|
+
const PencilRuler = `<!-- Generated by IcoMoon.io -->
|
|
14
|
+
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">
|
|
15
|
+
<title>pencil-ruler</title>
|
|
16
|
+
<path d="M3.057 11.609c0.26 0.26 0.601 0.391 0.943 0.391s0.683-0.131 0.943-0.391l6.667-6.667c0.521-0.521 0.521-1.364 0-1.885l-1.285-1.285c-1.143-1.143-2.661-1.772-4.276-1.772-1.616 0-3.135 0.629-4.276 1.772-1.143 1.141-1.772 2.66-1.772 4.276 0 1.615 0.629 3.135 1.772 4.276zM3.657 3.657c1.277-1.277 3.504-1.277 4.781 0l0.343 0.343-4.781 4.781-0.343-0.343c-0.639-0.639-0.991-1.488-0.991-2.391s0.352-1.752 0.991-2.391zM29.317 20.972c-0.2-0.707-0.932-1.119-1.645-0.921-0.709 0.2-1.121 0.937-0.921 1.645l1.987 7.041-7.041-1.987c-0.707-0.195-1.444 0.213-1.645 0.921-0.2 0.708 0.212 1.445 0.921 1.645l9.333 2.633c0.119 0.032 0.24 0.049 0.361 0.049 0.349 0 0.689-0.137 0.943-0.391 0.341-0.341 0.472-0.84 0.34-1.305zM31.609 8.772l-8.381-8.381c-0.5-0.5-1.385-0.5-1.885 0l-8.171 8.171s-0.001 0-0.001 0.001 0 0.001-0.001 0.001l-4.607 4.607s0 0-0.001 0 0 0 0 0.001l-8.171 8.171c-0.251 0.249-0.391 0.588-0.391 0.943 0 0.353 0.14 0.693 0.391 0.943l8.381 8.381c0.249 0.251 0.589 0.391 0.943 0.391s0.693-0.14 0.943-0.391l20.952-20.952c0.521-0.521 0.521-1.365 0-1.885zM9.715 28.781l-6.495-6.496 1.676-1.676 1.851 1.851c0.26 0.26 0.601 0.391 0.943 0.391s0.683-0.131 0.943-0.391c0.521-0.521 0.521-1.364 0-1.885l-1.851-1.851 2.724-2.724 3.008 3.008c0.26 0.26 0.601 0.391 0.943 0.391s0.683-0.131 0.943-0.391c0.521-0.521 0.521-1.364 0-1.885l-3.008-3.008 2.724-2.724 1.851 1.851c0.26 0.26 0.601 0.391 0.943 0.391s0.683-0.131 0.943-0.391c0.521-0.52 0.521-1.364 0-1.885l-1.851-1.851 2.724-2.724 3.008 3.008c0.26 0.26 0.601 0.391 0.943 0.391s0.683-0.131 0.943-0.391c0.521-0.521 0.521-1.365 0-1.885l-3.008-3.008 1.677-1.677 6.496 6.496z"></path>
|
|
17
|
+
</svg>
|
|
18
|
+
`;
|
|
19
|
+
|
|
13
20
|
const sallaProductSizeGuideCss = "";
|
|
14
21
|
|
|
15
22
|
const SallaProductSizeGuide$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
@@ -54,9 +61,11 @@ const SallaProductSizeGuide$1 = /*@__PURE__*/ proxyCustomElement(class extends H
|
|
|
54
61
|
return h("salla-placeholder", { alignment: "center", iconSize: "xl" }, h("div", { slot: "title" }, this.placeholder_title), h("div", { slot: "description" }, this.placeholder_description));
|
|
55
62
|
}
|
|
56
63
|
render() {
|
|
57
|
-
return (h(
|
|
58
|
-
[
|
|
59
|
-
|
|
64
|
+
return (h("salla-modal", { class: "s-product-size-guide-wrapper", id: 'salla-product-size-guide-modal', isLoading: true, "has-skeleton": true, width: "md", ref: modal => this.modal = modal }, h("span", { slot: 'icon', class: "s-product-size-guide-header-icon", innerHTML: PencilRuler }), h("div", { slot: "loading" }, h("div", { class: "s-product-size-guide-skeleton" }, h("salla-skeleton", { height: '15px', width: '25%' }), h("div", { class: "s-product-size-guide-skeleton-header" }, h("salla-skeleton", { height: '40px' }), h("salla-skeleton", { height: '40px' }), h("salla-skeleton", { height: '40px' }), h("salla-skeleton", { height: '40px' })), h("div", { class: "s-product-size-guide-skeleton-content" }, h("salla-skeleton", { height: '15px', width: '25%' }), h("salla-skeleton", { height: '10px', width: '75%' }), h("salla-skeleton", { height: '10px', width: '50%' }), h("salla-skeleton", { height: '10px', width: '75%' }), h("salla-skeleton", { height: '10px', width: '100%' }), h("salla-skeleton", { height: '10px', width: '25%' }), h("salla-skeleton", { height: '10px', width: '60%' }), h("salla-skeleton", { height: '10px', width: '45%' }), h("salla-skeleton", { height: '10px', width: '30%' })))), h("slot", { name: "header" }), !this.hasError && !!this.guides ?
|
|
65
|
+
[
|
|
66
|
+
h("salla-tabs", null, this.guides.map((guide) => h("salla-tab-header", { slot: "header", name: guide.name }, h("span", null, guide.name))), this.guides.map((guide) => h("salla-tab-content", { slot: "content", name: guide.name }, h("div", { innerHTML: guide.description }))))
|
|
67
|
+
]
|
|
68
|
+
: this.showPlaceholder(), h("slot", { name: "footer" })));
|
|
60
69
|
}
|
|
61
70
|
get host() { return this; }
|
|
62
71
|
static get style() { return sallaProductSizeGuideCss; }
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* Crafted with ❤ by Salla
|
|
3
3
|
*/
|
|
4
4
|
import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
|
|
5
|
+
import { H as Helper } from './Helper.js';
|
|
5
6
|
|
|
6
7
|
const Add = `<!-- Generated by IcoMoon.io -->
|
|
7
8
|
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">
|
|
@@ -17,19 +18,6 @@ const Minus = `<!-- Generated by IcoMoon.io -->
|
|
|
17
18
|
</svg>
|
|
18
19
|
`;
|
|
19
20
|
|
|
20
|
-
//TODO::check why there are too much listeners for languages::translations.loaded
|
|
21
|
-
salla.event.setMaxListeners(20);
|
|
22
|
-
class Helper {
|
|
23
|
-
debounce(fn, ...data) {
|
|
24
|
-
if (!this.debounce_) {
|
|
25
|
-
this.debounce_ = Salla.helpers.debounce((callback, ...innerData) => callback(...innerData), 500);
|
|
26
|
-
}
|
|
27
|
-
//@ts-ignore
|
|
28
|
-
return this.debounce_(fn, ...data);
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
const Helper$1 = new Helper;
|
|
32
|
-
|
|
33
21
|
const sallaQuantityInputCss = "";
|
|
34
22
|
|
|
35
23
|
const SallaQuantityInput$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
@@ -49,7 +37,7 @@ const SallaQuantityInput$1 = /*@__PURE__*/ proxyCustomElement(class extends HTML
|
|
|
49
37
|
if (!this.didLoaded) {
|
|
50
38
|
return;
|
|
51
39
|
}
|
|
52
|
-
Helper
|
|
40
|
+
Helper.debounce(() => salla.document.event.fireEvent(this.textInput, 'change', { 'bubbles': true }));
|
|
53
41
|
}
|
|
54
42
|
componentWillLoad() {
|
|
55
43
|
this.quantity = parseInt(this.host.getAttribute('value')) || 1;
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
|
|
5
5
|
import { C as CheckCircle2, d as defineCustomElement$4 } from './salla-modal2.js';
|
|
6
|
+
import { H as Helper } from './Helper.js';
|
|
6
7
|
import { d as defineCustomElement$6 } from './salla-button2.js';
|
|
7
8
|
import { d as defineCustomElement$5 } from './salla-loading2.js';
|
|
8
9
|
import { d as defineCustomElement$3 } from './salla-rating-stars2.js';
|
|
@@ -79,12 +80,12 @@ const SallaRatingModal$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEl
|
|
|
79
80
|
showActiveStep(current = null) {
|
|
80
81
|
var _a, _b;
|
|
81
82
|
this.currentTab = current || this.steps[this.currentIndex];
|
|
82
|
-
|
|
83
|
+
Helper.toggleClassIf('.s-rating-modal-step-dot', 's-rating-modal-bg-gray', 's-rating-modal-bg-primary', dot => dot != this.dots[this.currentIndex])
|
|
83
84
|
.toggleClassIf('.s-rating-modal-step', 's-rating-modal-active', 's-rating-modal-hidden', tab => tab == this.currentTab);
|
|
84
85
|
if (this.currentIndex != 0) {
|
|
85
86
|
// the animation
|
|
86
|
-
|
|
87
|
-
setTimeout(() =>
|
|
87
|
+
Helper.toggleElementClassIf(this.currentTab, 's-rating-modal-unactive', 's-rating-modal-hidden', () => true);
|
|
88
|
+
setTimeout(() => Helper.toggleElementClassIf(this.currentTab, 's-rating-modal-active', 's-rating-modal-unactive', () => true), 300);
|
|
88
89
|
}
|
|
89
90
|
// Btn text
|
|
90
91
|
let nextType = (_a = this.steps[this.currentIndex + 1]) === null || _a === void 0 ? void 0 : _a.dataset.type;
|
|
@@ -94,7 +95,7 @@ const SallaRatingModal$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEl
|
|
|
94
95
|
}
|
|
95
96
|
previousTab() {
|
|
96
97
|
this.currentIndex > 0 && this.currentIndex--;
|
|
97
|
-
|
|
98
|
+
Helper.toggleElementClassIf(this.backBtn, 's-rating-modal-unvisiable', 'block', () => this.currentIndex == 0);
|
|
98
99
|
this.showActiveStep();
|
|
99
100
|
}
|
|
100
101
|
submit() {
|
|
@@ -105,7 +106,7 @@ const SallaRatingModal$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEl
|
|
|
105
106
|
.then(() => this.currentTab.querySelectorAll('[name],.s-rating-modal-btn-star').forEach(el => el.setAttribute('disabled', '')))
|
|
106
107
|
.then(() => this.currentIndex < this.stepsCount && this.currentIndex++)
|
|
107
108
|
.then(() => this.showActiveStep())
|
|
108
|
-
.then(() =>
|
|
109
|
+
.then(() => Helper.toggleClassIf('#prev-btn', 'block', 's-rating-modal-unvisiable', () => true))
|
|
109
110
|
.finally(() => {
|
|
110
111
|
this.nextBtn.stop();
|
|
111
112
|
salla.config.canLeave = true;
|
|
@@ -130,7 +131,7 @@ const SallaRatingModal$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEl
|
|
|
130
131
|
return;
|
|
131
132
|
}
|
|
132
133
|
type = type || rating['dataset'].type;
|
|
133
|
-
|
|
134
|
+
Helper.toggleElementClassIf(comment, 'save', 's-has-error', el => el.value.length > 3);
|
|
134
135
|
throw validationMessage.innerHTML = stars
|
|
135
136
|
? (salla.lang.get('common.errors.not_less_than_chars', { chars: 4 }) + ' ' + comment.getAttribute('placeholder'))
|
|
136
137
|
: salla.lang.get(`pages.rating.rate_${type}_stars`).replace(' (:item)', '');
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
|
|
5
5
|
import { S as Star2 } from './star2.js';
|
|
6
|
+
import { H as Helper } from './Helper.js';
|
|
6
7
|
|
|
7
8
|
const sallaRatingStarsCss = "";
|
|
8
9
|
|
|
@@ -32,7 +33,7 @@ const SallaRatingStars = /*@__PURE__*/ proxyCustomElement(class extends HTMLElem
|
|
|
32
33
|
this.startsElem.querySelector('.rating_hidden_input').value = selectedIndex;
|
|
33
34
|
// Loop through each star, and add or remove the `.selected` class to toggle highlighting
|
|
34
35
|
this.startsElem.querySelectorAll('.s-rating-stars-btn-star')
|
|
35
|
-
.forEach((star, index) =>
|
|
36
|
+
.forEach((star, index) => Helper.toggleElementClassIf(star, 's-rating-stars-selected', 's-rating-stars-unselected', () => index < parseInt(selectedIndex)));
|
|
36
37
|
// update aria-pressed attr status
|
|
37
38
|
this.startsElem.querySelectorAll('[aria-pressed]').forEach(star => star.removeAttribute('aria-pressed'));
|
|
38
39
|
selected.setAttribute('aria-pressed', 'true');
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { proxyCustomElement, HTMLElement, h } from '@stencil/core/internal/client';
|
|
5
5
|
import { S as Search } from './search.js';
|
|
6
|
+
import { H as Helper } from './Helper.js';
|
|
6
7
|
import { d as defineCustomElement$3 } from './salla-loading2.js';
|
|
7
8
|
import { d as defineCustomElement$2 } from './salla-modal2.js';
|
|
8
9
|
|
|
@@ -80,7 +81,7 @@ const SallaSearch$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
80
81
|
}
|
|
81
82
|
}
|
|
82
83
|
search(val) {
|
|
83
|
-
|
|
84
|
+
this.noResults.style.display = 'none';
|
|
84
85
|
//run loading spinner or stop it
|
|
85
86
|
this.loading = true;
|
|
86
87
|
salla.product.search(val)
|
|
@@ -91,7 +92,7 @@ const SallaSearch$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
91
92
|
afterSearching(isEmpty = true) {
|
|
92
93
|
var _a;
|
|
93
94
|
this.noResults.style.display = isEmpty || ((_a = this.results) === null || _a === void 0 ? void 0 : _a.data.length) > 0 ? 'none' : 'block';
|
|
94
|
-
|
|
95
|
+
Helper.toggleElementClassIf(this.container, 's-search-container-open', 's-search-no-results', () => { var _a; return (_a = this.results) === null || _a === void 0 ? void 0 : _a.data.length; });
|
|
95
96
|
this.loading = false;
|
|
96
97
|
salla.product.api.previousQuery = ''; //avoid having error 'Query is same as previous one!' after reopen modal;
|
|
97
98
|
this.inputValue.length < 3 ? this.container.classList.remove('s-search-no-results') : '';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Components, JSX } from "../types/components";
|
|
2
|
+
|
|
3
|
+
interface SallaUserSettings extends Components.SallaUserSettings, HTMLElement {}
|
|
4
|
+
export const SallaUserSettings: {
|
|
5
|
+
prototype: SallaUserSettings;
|
|
6
|
+
new (): SallaUserSettings;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Used to define this component and all nested components recursively.
|
|
10
|
+
*/
|
|
11
|
+
export const defineCustomElement: () => void;
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Crafted with ❤ by Salla
|
|
3
|
+
*/
|
|
4
|
+
import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
|
|
5
|
+
import { d as defineCustomElement$5 } from './salla-button2.js';
|
|
6
|
+
import { d as defineCustomElement$4 } from './salla-list-tile2.js';
|
|
7
|
+
import { d as defineCustomElement$3 } from './salla-loading2.js';
|
|
8
|
+
import { d as defineCustomElement$2 } from './salla-modal2.js';
|
|
9
|
+
|
|
10
|
+
const Bullhorn = `<!-- Generated by IcoMoon.io -->
|
|
11
|
+
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">
|
|
12
|
+
<title>bullhorn</title>
|
|
13
|
+
<path d="M30.129 0.264c-0.339-0.252-0.776-0.328-1.179-0.208l-24.951 7.485v-0.216c0-0.736-0.597-1.333-1.333-1.333s-1.333 0.597-1.333 1.333v14.667c0 0.736 0.597 1.333 1.333 1.333s1.333-0.597 1.333-1.333v-0.112l3.448 1.207-0.595 1.704c-0.321 1.019-0.227 2.103 0.267 3.051s1.327 1.647 2.345 1.968l6.359 2.004c0.399 0.127 0.804 0.187 1.201 0.187 1.699 0 3.277-1.091 3.812-2.785l0.423-1.295 7.633 2.672c0.143 0.049 0.292 0.075 0.44 0.075 0.273 0 0.543-0.084 0.772-0.247 0.352-0.249 0.561-0.655 0.561-1.087v-28c0-0.421-0.199-0.819-0.537-1.069zM18.297 28.4c-0.221 0.701-0.973 1.089-1.673 0.871l-6.357-2.004c-0.34-0.108-0.617-0.34-0.781-0.656s-0.196-0.676-0.101-0.977l0.581-1.665 8.777 3.072zM28 27.453l-24-8.4v-8.728l24-7.2z"></path>
|
|
14
|
+
</svg>
|
|
15
|
+
`;
|
|
16
|
+
|
|
17
|
+
const UserOff = `<!-- Generated by IcoMoon.io -->
|
|
18
|
+
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">
|
|
19
|
+
<title>user-off</title>
|
|
20
|
+
<path d="M10.837 19.309c-4.963 1.284-8.171 4.303-8.171 7.691v3.667c0 0.736 0.597 1.333 1.333 1.333s1.333-0.597 1.333-1.333v-3.667c0-2.101 2.48-4.155 6.172-5.109 0.713-0.184 1.141-0.912 0.957-1.625-0.184-0.711-0.908-1.137-1.625-0.956zM12.859 3.715c0.933-0.685 2.020-1.048 3.141-1.048 2.941 0 5.333 2.392 5.333 5.333 0 1.121-0.363 2.208-1.048 3.141-0.436 0.593-0.308 1.428 0.284 1.864 0.239 0.175 0.515 0.259 0.788 0.259 0.411 0 0.815-0.188 1.076-0.544 1.025-1.393 1.567-3.025 1.567-4.72 0-4.412-3.588-8-8-8-1.695 0-3.327 0.541-4.721 1.567-0.592 0.435-0.72 1.269-0.284 1.864 0.436 0.593 1.269 0.721 1.864 0.284zM31.609 29.724l-29.333-29.333c-0.521-0.521-1.364-0.521-1.885 0s-0.521 1.364 0 1.885l29.333 29.333c0.26 0.26 0.601 0.391 0.943 0.391s0.683-0.131 0.943-0.391c0.521-0.521 0.521-1.364 0-1.885z"></path>
|
|
21
|
+
</svg>
|
|
22
|
+
`;
|
|
23
|
+
|
|
24
|
+
const sallaUserSettingsCss = "";
|
|
25
|
+
|
|
26
|
+
const SallaUserSettings$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
27
|
+
constructor() {
|
|
28
|
+
super();
|
|
29
|
+
this.__registerHost();
|
|
30
|
+
// Texts
|
|
31
|
+
this.deactivateAccount = salla.lang.get('pages.profile.deactivate_account');
|
|
32
|
+
this.promotionalMsgs = salla.lang.get('pages.profile.promotional_messages');
|
|
33
|
+
this.deactivateDesc = salla.lang.get('pages.profile.deactivate_account_description');
|
|
34
|
+
this.promotionalMsgsDesc = salla.lang.get('pages.profile.promotional_messages_description');
|
|
35
|
+
this.sorryForLeavingText = salla.lang.get('pages.profile.warning_for_deactivate');
|
|
36
|
+
this.warningText = salla.lang.get('pages.profile.sorry_for_leaving');
|
|
37
|
+
this.keepAccount = salla.lang.get('pages.profile.keep_account');
|
|
38
|
+
this.buttonLoading = false;
|
|
39
|
+
this.isNotifiable = false;
|
|
40
|
+
salla.lang.onLoaded(() => {
|
|
41
|
+
this.deactivateAccount = salla.lang.get('pages.profile.deactivate_account');
|
|
42
|
+
this.promotionalMsgs = salla.lang.get('pages.profile.promotional_messages');
|
|
43
|
+
this.deactivateDesc = salla.lang.get('pages.profile.deactivate_account_description');
|
|
44
|
+
this.promotionalMsgsDesc = salla.lang.get('pages.profile.promotional_messages_description');
|
|
45
|
+
this.warningText = salla.lang.get('pages.profile.warning_for_deactivate');
|
|
46
|
+
this.sorryForLeavingText = salla.lang.get('pages.profile.sorry_for_leaving');
|
|
47
|
+
this.keepAccount = salla.lang.get('pages.profile.keep_account');
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
toggleNotification(event) {
|
|
51
|
+
salla.profile.updateSettings({ is_notifiable: event.target.checked });
|
|
52
|
+
}
|
|
53
|
+
capitalizeText(str) {
|
|
54
|
+
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
55
|
+
}
|
|
56
|
+
openDeactivateModal() {
|
|
57
|
+
this.confirmationModal.setTitle(this.capitalizeText(this.deactivateAccount));
|
|
58
|
+
this.confirmationModal.open();
|
|
59
|
+
}
|
|
60
|
+
async deleteAccount() {
|
|
61
|
+
await salla.profile.delete().finally(() => this.confirmationModal.close());
|
|
62
|
+
}
|
|
63
|
+
render() {
|
|
64
|
+
return (h(Host, { class: "s-user-settings-wrapper" }, h("div", { class: "s-user-settings-section" }, h("salla-list-tile", null, h("div", { slot: "icon", class: "s-user-settings-section-icon" }, h("span", { innerHTML: Bullhorn })), h("div", { slot: "title", class: "s-user-settings-section-title" }, this.capitalizeText(this.promotionalMsgs)), h("div", { slot: "subtitle", class: "s-user-settings-section-subtitle" }, this.capitalizeText(this.promotionalMsgsDesc)), h("div", { slot: 'action', class: "s-user-settings-section-action" }, h("label", { class: "s-toggle" }, h("input", { class: "s-toggle-input", checked: this.isNotifiable, onChange: (e) => this.toggleNotification(e), type: "checkbox" }), h("div", { class: "s-toggle-switcher" }))))), h("div", { class: "s-user-settings-section" }, h("salla-list-tile", null, h("div", { slot: "icon", class: "s-user-settings-section-icon" }, h("span", { innerHTML: UserOff })), h("div", { slot: "title", class: "s-user-settings-section-title" }, this.capitalizeText(this.deactivateAccount)), h("div", { slot: "subtitle", class: "s-user-settings-section-subtitle" }, this.capitalizeText(this.deactivateDesc)), h("div", { slot: 'action', class: "s-user-settings-section-action" }, h("salla-button", { shape: "link", color: "danger", onClick: () => this.openDeactivateModal() }, this.capitalizeText(this.deactivateAccount))))), h("salla-modal", { width: "sm", subTitle: this.capitalizeText(this.sorryForLeavingText), ref: modal => this.confirmationModal = modal }, h("span", { slot: 'icon', class: "s-user-settings-confirmation-icon", innerHTML: UserOff }), h("div", { class: "s-user-settings-confirmation" }, h("div", { class: "s-user-settings-confirmation-warning" }, this.capitalizeText(this.warningText)), h("div", { class: "s-user-settings-confirmation-actions" }, h("salla-button", { width: "wide", onClick: () => this.confirmationModal.close() }, this.capitalizeText(this.keepAccount)), h("salla-button", { fill: 'outline', loading: this.buttonLoading, width: "wide", onClick: () => this.deleteAccount() }, this.capitalizeText(this.deactivateAccount)))))));
|
|
65
|
+
}
|
|
66
|
+
static get style() { return sallaUserSettingsCss; }
|
|
67
|
+
}, [0, "salla-user-settings", {
|
|
68
|
+
"isNotifiable": [516, "is-notifiable"],
|
|
69
|
+
"deactivateAccount": [32],
|
|
70
|
+
"promotionalMsgs": [32],
|
|
71
|
+
"deactivateDesc": [32],
|
|
72
|
+
"promotionalMsgsDesc": [32],
|
|
73
|
+
"sorryForLeavingText": [32],
|
|
74
|
+
"warningText": [32],
|
|
75
|
+
"keepAccount": [32],
|
|
76
|
+
"buttonLoading": [32]
|
|
77
|
+
}]);
|
|
78
|
+
function defineCustomElement$1() {
|
|
79
|
+
if (typeof customElements === "undefined") {
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
const components = ["salla-user-settings", "salla-button", "salla-list-tile", "salla-loading", "salla-modal"];
|
|
83
|
+
components.forEach(tagName => { switch (tagName) {
|
|
84
|
+
case "salla-user-settings":
|
|
85
|
+
if (!customElements.get(tagName)) {
|
|
86
|
+
customElements.define(tagName, SallaUserSettings$1);
|
|
87
|
+
}
|
|
88
|
+
break;
|
|
89
|
+
case "salla-button":
|
|
90
|
+
if (!customElements.get(tagName)) {
|
|
91
|
+
defineCustomElement$5();
|
|
92
|
+
}
|
|
93
|
+
break;
|
|
94
|
+
case "salla-list-tile":
|
|
95
|
+
if (!customElements.get(tagName)) {
|
|
96
|
+
defineCustomElement$4();
|
|
97
|
+
}
|
|
98
|
+
break;
|
|
99
|
+
case "salla-loading":
|
|
100
|
+
if (!customElements.get(tagName)) {
|
|
101
|
+
defineCustomElement$3();
|
|
102
|
+
}
|
|
103
|
+
break;
|
|
104
|
+
case "salla-modal":
|
|
105
|
+
if (!customElements.get(tagName)) {
|
|
106
|
+
defineCustomElement$2();
|
|
107
|
+
}
|
|
108
|
+
break;
|
|
109
|
+
} });
|
|
110
|
+
}
|
|
111
|
+
defineCustomElement$1();
|
|
112
|
+
|
|
113
|
+
const SallaUserSettings = SallaUserSettings$1;
|
|
114
|
+
const defineCustomElement = defineCustomElement$1;
|
|
115
|
+
|
|
116
|
+
export { SallaUserSettings, defineCustomElement };
|
|
@@ -129,12 +129,14 @@ const SallaVerify = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
129
129
|
this.otpInputs[0].focus();
|
|
130
130
|
}
|
|
131
131
|
resendTimer() {
|
|
132
|
-
|
|
132
|
+
this.resendMessage.style.display = 'block';
|
|
133
|
+
this.resend.style.display = 'none';
|
|
133
134
|
this.resendAfter = 30;
|
|
134
135
|
let timerId = setInterval(() => {
|
|
135
136
|
if (this.resendAfter <= 0) {
|
|
136
137
|
clearInterval(timerId);
|
|
137
|
-
|
|
138
|
+
this.resend.style.display = 'block';
|
|
139
|
+
this.resendMessage.style.display = 'none';
|
|
138
140
|
}
|
|
139
141
|
else {
|
|
140
142
|
this.timer.innerHTML = `${this.resendAfter >= 10 ? this.resendAfter : '0' + this.resendAfter} : 00`;
|
|
@@ -1881,10 +1881,10 @@ const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
|
|
|
1881
1881
|
}
|
|
1882
1882
|
switch(bundleId) {
|
|
1883
1883
|
|
|
1884
|
-
case 'salla-
|
|
1884
|
+
case 'salla-button_28':
|
|
1885
1885
|
return import(
|
|
1886
1886
|
/* webpackMode: "lazy" */
|
|
1887
|
-
'./salla-
|
|
1887
|
+
'./salla-button_28.entry.js').then(processMod, consoleError);
|
|
1888
1888
|
case 'salla-add-product-button':
|
|
1889
1889
|
return import(
|
|
1890
1890
|
/* webpackMode: "lazy" */
|