@salla.sa/twilight-components 1.0.22 → 1.0.24
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.cjs.js +2 -2
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/salla-branches.cjs.entry.js +5 -2
- package/dist/cjs/salla-button_5.cjs.entry.js +79 -29
- package/dist/cjs/salla-localization.cjs.entry.js +6 -4
- package/dist/cjs/salla-login-c74587ef.js +154 -0
- package/dist/cjs/salla-offer.cjs.entry.js +2 -2
- package/dist/cjs/salla-rating.cjs.entry.js +12 -9
- package/dist/cjs/{salla-search-45173394.js → salla-search-eb0112c0.js} +16 -23
- package/dist/cjs/salla-search.cjs.entry.js +1 -1
- package/dist/cjs/twilight-components.cjs.js +1 -1
- package/dist/collection/components/salla-branches/salla-branches.js +7 -3
- package/dist/collection/components/salla-button/salla-button.js +2 -0
- package/dist/collection/components/salla-localization/salla-localization.js +11 -60
- package/dist/collection/components/salla-login/salla-login.css +15 -2
- package/dist/collection/components/salla-login/salla-login.js +132 -252
- package/dist/collection/components/salla-modal/salla-modal.css +0 -0
- package/dist/collection/components/salla-modal/salla-modal.js +28 -20
- package/dist/collection/components/salla-offer/salla-offer.js +2 -2
- package/dist/collection/components/salla-rating/salla-rating.js +12 -9
- package/dist/collection/components/salla-search/salla-search.css +1 -0
- package/dist/collection/components/salla-search/salla-search.js +19 -62
- package/dist/collection/components/salla-search/search-response.js +1 -0
- package/dist/collection/components/salla-tel-input/salla-tel-input.js +86 -6
- package/dist/collection/components/salla-verify/salla-verify.js +18 -13
- package/dist/esm/index.js +2 -2
- package/dist/esm/loader.js +1 -1
- package/dist/esm/salla-branches.entry.js +5 -2
- package/dist/esm/salla-button_5.entry.js +79 -29
- package/dist/esm/salla-localization.entry.js +6 -4
- package/dist/esm/salla-login-d08f0d7e.js +152 -0
- package/dist/esm/salla-offer.entry.js +2 -2
- package/dist/esm/salla-rating.entry.js +12 -9
- package/dist/esm/{salla-search-5e691ebb.js → salla-search-57bd45eb.js} +16 -23
- package/dist/esm/salla-search.entry.js +1 -1
- package/dist/esm/twilight-components.js +1 -1
- package/dist/twilight-components/index.esm.js +1 -1
- package/dist/twilight-components/p-1918a33c.js +1 -0
- package/dist/twilight-components/p-22f06d26.entry.js +1 -0
- package/dist/twilight-components/p-47f3d098.entry.js +1 -0
- package/dist/twilight-components/p-5bf5ce53.entry.js +1 -0
- package/dist/twilight-components/p-aa9880cb.entry.js +1 -0
- package/dist/twilight-components/p-b195e28c.entry.js +1 -0
- package/dist/twilight-components/p-e6a3a0dc.entry.js +1 -0
- package/dist/twilight-components/p-e7edc889.js +1 -0
- package/dist/twilight-components/twilight-components.esm.js +1 -1
- package/dist/types/components/salla-branches/salla-branches.d.ts +1 -0
- package/dist/types/components/salla-login/salla-login.d.ts +21 -12
- package/dist/types/components/salla-search/salla-search.d.ts +2 -7
- package/dist/types/components/salla-search/search-response.d.ts +18 -0
- package/dist/types/components/salla-tel-input/salla-tel-input.d.ts +18 -6
- package/dist/types/components/salla-verify/salla-verify.d.ts +2 -2
- package/dist/types/components.d.ts +5 -43
- package/package.json +1 -1
- package/dist/cjs/salla-login-c438bb35.js +0 -128
- package/dist/esm/salla-login-dd957742.js +0 -126
- package/dist/twilight-components/p-1a6d8171.entry.js +0 -1
- package/dist/twilight-components/p-1deb8111.entry.js +0 -1
- package/dist/twilight-components/p-3a4d963e.js +0 -1
- package/dist/twilight-components/p-5b2eb87d.entry.js +0 -1
- package/dist/twilight-components/p-7fbdf746.entry.js +0 -1
- package/dist/twilight-components/p-81a61f4e.js +0 -1
- package/dist/twilight-components/p-ce991664.entry.js +0 -1
- package/dist/twilight-components/p-da73fc9b.entry.js +0 -1
|
@@ -1,20 +1,78 @@
|
|
|
1
|
-
import { Component, Element, h, Listen, Method, Prop } from '@stencil/core';
|
|
1
|
+
import { Component, Element, h, Listen, Method, Prop, State } from '@stencil/core';
|
|
2
2
|
import Helper from "../../Helpers/Helper";
|
|
3
3
|
export class SallaLogin {
|
|
4
4
|
constructor() {
|
|
5
|
-
this.regType = 'phone';
|
|
6
5
|
this.isEmailAllowed = true;
|
|
7
|
-
this.
|
|
8
|
-
this.
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
this.
|
|
15
|
-
|
|
6
|
+
this.regType = 'phone';
|
|
7
|
+
this.typing = (e, submitMethod) => {
|
|
8
|
+
const error = e.target.nextElementSibling;
|
|
9
|
+
e.target.classList.remove('s-has-error');
|
|
10
|
+
(error === null || error === void 0 ? void 0 : error.classList.contains('s-login-error-message')) && (error.innerText = '');
|
|
11
|
+
e.key == 'Enter' && submitMethod();
|
|
12
|
+
};
|
|
13
|
+
this.loginBySMS = async () => {
|
|
14
|
+
const { phone, countryCode } = await this.loginTelInput.getValues();
|
|
15
|
+
const isPhoneValid = await this.loginTelInput.isValid();
|
|
16
|
+
if (!isPhoneValid)
|
|
17
|
+
return;
|
|
18
|
+
this.smsBtn.load()
|
|
19
|
+
.then(() => this.smsBtn.disable())
|
|
20
|
+
.then(() => salla.auth.api.login({ type: 'mobile', phone: phone, country_code: countryCode }))
|
|
21
|
+
.then(() => this.smsBtn.stop() && this.smsBtn.enable())
|
|
22
|
+
.then(() => this.showTab(this.verifyTab))
|
|
23
|
+
.then(() => this.verifyTab.by = 'sms')
|
|
24
|
+
.then(() => this.verifyTab.show({ phone: phone, country_code: countryCode }));
|
|
25
|
+
};
|
|
26
|
+
this.loginByEmail = () => {
|
|
27
|
+
if (!Helper.isValidEmail(this.loginEmail.value)) {
|
|
28
|
+
this.validateField(this.loginEmail, this.isEmailValid);
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
this.emailBtn.load()
|
|
32
|
+
.then(() => this.emailBtn.disable())
|
|
33
|
+
.then(() => salla.auth.api.login({ type: 'email', email: this.loginEmail.value }))
|
|
34
|
+
.then(() => this.emailBtn.stop() && this.emailBtn.enable())
|
|
35
|
+
.then(() => this.showTab(this.verifyTab))
|
|
36
|
+
.then(() => this.verifyTab.by = 'email')
|
|
37
|
+
.then(() => this.verifyTab.show({ email: this.loginEmail.value }));
|
|
38
|
+
};
|
|
39
|
+
this.newUser = async () => {
|
|
40
|
+
const { phone: regPhone, countryCode, countryKey } = await this.regTelInput.getValues();
|
|
41
|
+
await this.newUserValidation();
|
|
42
|
+
await this.regBtn.load();
|
|
43
|
+
await this.regBtn.disable();
|
|
44
|
+
this.verifyTab.getCode()
|
|
45
|
+
.then(code => salla.auth.api.register({
|
|
46
|
+
first_name: this.firstName.value,
|
|
47
|
+
last_name: this.lastName.value,
|
|
48
|
+
phone: regPhone || this.loginTelInput.phone,
|
|
49
|
+
email: this.regEmail.value || this.loginEmail.value,
|
|
50
|
+
country_code: countryCode,
|
|
51
|
+
country_key: countryKey,
|
|
52
|
+
code: code,
|
|
53
|
+
verified_by: this.regType,
|
|
54
|
+
}))
|
|
55
|
+
.then(() => window.location.reload())
|
|
56
|
+
.catch(() => this.regBtn.stop() && this.regBtn.enable());
|
|
57
|
+
};
|
|
16
58
|
this.title = this.host.title || salla.lang.get('blocks.header.login');
|
|
17
59
|
this.host.removeAttribute('title');
|
|
60
|
+
salla.event.on('languages::translations.loaded', () => {
|
|
61
|
+
this.loginTypeTitle = salla.lang.get('blocks.header.select_login_way');
|
|
62
|
+
this.loginText = salla.lang.get('blocks.header.login');
|
|
63
|
+
this.smsLabel = salla.lang.get('blocks.header.sms');
|
|
64
|
+
this.mobileLabel = salla.lang.get('common.elements.mobile');
|
|
65
|
+
this.emailLabel = salla.lang.get('common.elements.email');
|
|
66
|
+
this.enterText = salla.lang.get('blocks.header.enter');
|
|
67
|
+
this.bySMSText = salla.lang.get('blocks.header.login_by_sms');
|
|
68
|
+
this.byEmailText = salla.lang.get('blocks.header.login_by_email');
|
|
69
|
+
this.title = salla.lang.get('blocks.header.login');
|
|
70
|
+
this.isEmailValid = salla.lang.get('common.elements.email_is_valid');
|
|
71
|
+
this.firstNameLabel = salla.lang.get('blocks.header.your_name');
|
|
72
|
+
this.lastNameLabel = salla.lang.get('pages.profile.last_name');
|
|
73
|
+
this.firstNameRequired = salla.lang.get('common.errors.field_required', { attribute: this.firstNameLabel });
|
|
74
|
+
this.lastNameRequired = salla.lang.get('common.errors.field_required', { attribute: this.lastNameLabel });
|
|
75
|
+
});
|
|
18
76
|
salla.auth.event.onVerificationFailed(() => {
|
|
19
77
|
//
|
|
20
78
|
});
|
|
@@ -28,7 +86,7 @@ export class SallaLogin {
|
|
|
28
86
|
return;
|
|
29
87
|
}
|
|
30
88
|
if (event.detail.case === "new_customer") {
|
|
31
|
-
return this.showTab(this.
|
|
89
|
+
return this.showTab(this.registrationTab);
|
|
32
90
|
}
|
|
33
91
|
//TODO::It looks that is this workaround🤔
|
|
34
92
|
if (salla.auth.event.getTypeActionOnVerified() !== 'redirect') {
|
|
@@ -39,21 +97,23 @@ export class SallaLogin {
|
|
|
39
97
|
}
|
|
40
98
|
window.location.reload();
|
|
41
99
|
}
|
|
100
|
+
// from salla-verify comp
|
|
42
101
|
onbackClicked() {
|
|
43
|
-
this.regType == 'phone' ? this.showTab(this.
|
|
102
|
+
this.regType == 'phone' ? this.showTab(this.mobileTab) : this.showTab(this.emailTab);
|
|
44
103
|
}
|
|
45
104
|
async show() {
|
|
46
|
-
this.showTab(this.isEmailAllowed ? this.
|
|
105
|
+
this.showTab(this.isEmailAllowed ? this.homeTab : this.mobileTab);
|
|
47
106
|
return this.modal.show();
|
|
48
107
|
}
|
|
49
|
-
showTab(tab) {
|
|
50
|
-
|
|
51
|
-
|
|
108
|
+
showTab(tab, evt) {
|
|
109
|
+
evt === null || evt === void 0 ? void 0 : evt.preventDefault();
|
|
110
|
+
[this.homeTab, this.mobileTab, this.emailTab, this.verifyTab, this.registrationTab].map(el => Helper.toggleElement(el, 'visible', 'hidden', () => el == tab));
|
|
111
|
+
setTimeout(() => { [this.homeTab, this.mobileTab, this.emailTab, this.verifyTab, this.registrationTab].map(el => Helper.toggleElement(el, 's-login-active', 's-login-unactive', () => el == tab)); }, 200);
|
|
52
112
|
setTimeout(() => { this.host.querySelector('.s-login-wrapper').setAttribute('style', 'height:' + (tab === null || tab === void 0 ? void 0 : tab.scrollHeight) + 'px'); });
|
|
53
|
-
if ([this.
|
|
54
|
-
this.regType = tab === this.
|
|
113
|
+
if ([this.mobileTab, this.emailTab].includes(tab)) {
|
|
114
|
+
this.regType = tab === this.mobileTab ? 'phone' : 'email';
|
|
55
115
|
}
|
|
56
|
-
let isRegistrationTab = tab == this.
|
|
116
|
+
let isRegistrationTab = tab == this.registrationTab;
|
|
57
117
|
isRegistrationTab && this.firstName.focus();
|
|
58
118
|
this.modal.setTitle(isRegistrationTab ? salla.lang.get('common.titles.registration') : this.title);
|
|
59
119
|
if (!isRegistrationTab) {
|
|
@@ -62,100 +122,66 @@ export class SallaLogin {
|
|
|
62
122
|
}
|
|
63
123
|
return this;
|
|
64
124
|
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
this.email.nextElementSibling['innerText'] = '* ' + salla.lang.get('common.elements.email_is_valid');
|
|
125
|
+
async newUserValidation() {
|
|
126
|
+
const isPhoneReg = this.regType == "phone", isEmailReg = this.regType == "email", isFirstNameValid = this.firstName.value.length > 0, isLastNameValid = this.lastName.value.length > 0, isEmailValid = Helper.isValidEmail(this.regEmail.value || isEmailReg && this.loginEmail.value), isPhoneValid = await this.regTelInput.isValid() || isPhoneReg && await this.loginTelInput.isValid();
|
|
127
|
+
if (isEmailValid && isPhoneValid && isFirstNameValid && isLastNameValid)
|
|
69
128
|
return;
|
|
70
|
-
|
|
71
|
-
this.
|
|
72
|
-
this.
|
|
73
|
-
|
|
74
|
-
.then(() => this.showTab(this.tab4))
|
|
75
|
-
.then(() => (this.tab4.by = 'email') && (this.tab4.url = 'auth/email/verify'))
|
|
76
|
-
.then(() => this.tab4.show({ email: this.email.value }));
|
|
77
|
-
}
|
|
78
|
-
async loginBySMS() {
|
|
79
|
-
const { phone, countryCode } = await this.loginTelInput.getValues();
|
|
80
|
-
if (phone.length < 6) {
|
|
81
|
-
this.loginTelInput.classList.add('s-has-error');
|
|
82
|
-
this.loginTelInput.nextElementSibling['innerText'] = '* ' + salla.lang.get('mobile_app.strings.incorrect_mobile');
|
|
83
|
-
return;
|
|
84
|
-
}
|
|
85
|
-
this.loginTelInput.nextElementSibling['innerText'] = '';
|
|
86
|
-
this.loginTelInput.classList.remove('s-has-error');
|
|
87
|
-
salla.auth.api.login({ type: 'mobile', phone: phone, country_code: countryCode })
|
|
88
|
-
.then(() => this.showTab(this.tab4))
|
|
89
|
-
.then(() => (this.tab4.by = 'sms') && (this.tab4.url = 'auth/mobile/verify'))
|
|
90
|
-
.then(() => this.tab4.show({ phone: phone, country_code: countryCode }));
|
|
129
|
+
!isEmailValid && this.validateField(this.regEmail, this.isEmailValid);
|
|
130
|
+
!isFirstNameValid && this.validateField(this.firstName, this.firstNameRequired);
|
|
131
|
+
!isLastNameValid && this.validateField(this.lastName, this.lastNameRequired);
|
|
132
|
+
throw ('Please insert required fields');
|
|
91
133
|
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
target.classList.remove('s-has-error');
|
|
96
|
-
target.nextElementSibling.innerText = '';
|
|
97
|
-
}
|
|
98
|
-
async newUser() {
|
|
99
|
-
const { phone: regPhone, countryCode, countryKey } = await this.regTelInput.getValues();
|
|
100
|
-
this.tab4.getCode()
|
|
101
|
-
.then(code => salla.auth.api.register({
|
|
102
|
-
first_name: this.firstName.value,
|
|
103
|
-
last_name: this.lastName.value,
|
|
104
|
-
phone: regPhone || this.loginTelInput.phone,
|
|
105
|
-
email: this.regEmail.value || this.email.value,
|
|
106
|
-
country_code: countryCode,
|
|
107
|
-
country_key: countryKey,
|
|
108
|
-
code: code,
|
|
109
|
-
verified_by: this.regType,
|
|
110
|
-
})).then(() => window.location.reload());
|
|
134
|
+
validateField(field, errorMsg) {
|
|
135
|
+
field.classList.add('s-has-error');
|
|
136
|
+
field.nextElementSibling['innerText'] = '* ' + errorMsg;
|
|
111
137
|
}
|
|
112
138
|
render() {
|
|
113
|
-
return (h("salla-modal", { id: "salla-login", title: this.title, ref: modal => this.modal = modal, width: "xs" },
|
|
139
|
+
return (h("salla-modal", { id: "salla-login", icon: "sicon-user", title: this.title, ref: modal => this.modal = modal, width: "xs" },
|
|
114
140
|
h("div", { class: "s-login-wrapper" },
|
|
115
141
|
this.isEmailAllowed ?
|
|
116
|
-
h("div", { class: "s-login-tab", ref: tab => this.
|
|
142
|
+
h("div", { class: "s-login-tab", ref: tab => this.homeTab = tab },
|
|
117
143
|
h("p", { class: "s-login-sub-title" }, this.loginTypeTitle),
|
|
118
|
-
h("a", { href: "#", class: "s-login-main-btn", onClick: () => this.showTab(this.
|
|
144
|
+
h("a", { href: "#", class: "s-login-main-btn", onClick: (evt) => this.showTab(this.mobileTab, evt) },
|
|
119
145
|
h("i", { class: "s-login-main-btn-icon sicon-phone" }),
|
|
120
146
|
h("span", { class: "s-login-main-btn-text" }, this.smsLabel),
|
|
121
147
|
h("i", { class: "main-btn-arrow sicon-keyboard_arrow_left" })),
|
|
122
|
-
h("a", { href: "#", class: "s-login-main-btn", onClick: () => this.showTab(this.
|
|
148
|
+
h("a", { href: "#", class: "s-login-main-btn", onClick: (evt) => this.showTab(this.emailTab, evt) },
|
|
123
149
|
h("i", { class: "s-login-main-btn-icon sicon-mail" }),
|
|
124
150
|
h("span", { class: "s-login-main-btn-text" }, this.emailLabel),
|
|
125
151
|
h("i", { class: "main-btn-arrow sicon-keyboard_arrow_left" })))
|
|
126
152
|
: '',
|
|
127
|
-
h("div", { class: "s-login-tab", ref: tab => this.
|
|
153
|
+
h("div", { class: "s-login-tab", ref: tab => this.mobileTab = tab },
|
|
128
154
|
h("label", { class: "s-login-label" }, this.mobileLabel),
|
|
129
|
-
h("salla-tel-input", {
|
|
130
|
-
h("
|
|
131
|
-
h("
|
|
132
|
-
this.isEmailAllowed ? h("a", { href: "#", onClick: () => this.showTab(this.tab3), class: "s-login-link" }, this.byEmailText) : ''),
|
|
155
|
+
h("salla-tel-input", { ref: el => this.loginTelInput = el, onKeyDown: e => this.typing(e, this.loginBySMS) }),
|
|
156
|
+
h("salla-button", { wide: true, onClick: () => this.loginBySMS(), ref: b => this.smsBtn = b }, this.enterText),
|
|
157
|
+
this.isEmailAllowed ? h("a", { href: "#", onClick: () => this.showTab(this.emailTab), class: "s-login-link" }, this.byEmailText) : ''),
|
|
133
158
|
this.isEmailAllowed ?
|
|
134
|
-
h("div", { class: "s-login-tab", ref: tab => this.
|
|
159
|
+
h("div", { class: "s-login-tab", ref: tab => this.emailTab = tab },
|
|
135
160
|
h("label", { class: "s-login-label" }, this.emailLabel),
|
|
136
|
-
h("input", {
|
|
161
|
+
h("input", { type: "email", ref: el => this.loginEmail = el, onKeyDown: e => this.typing(e, this.loginByEmail), placeholder: "your@email.com", class: "s-login-input s-ltr" }),
|
|
137
162
|
h("span", { class: "s-login-error-message" }),
|
|
138
|
-
h("salla-button", { wide: true, onClick: () => this.loginByEmail() }, this.enterText),
|
|
139
|
-
h("a", { href: "#", onClick: () => this.showTab(this.
|
|
140
|
-
h("salla-verify", { "without-modal": true, ref: tab => this.
|
|
141
|
-
h("div", { ref: tab => this.
|
|
142
|
-
h("label", { class: "s-login-label" },
|
|
143
|
-
h("input", { type: "text", class: "s-login-input", ref: el => this.firstName = el, placeholder: salla.lang.get('pages.profile.first_name') }),
|
|
144
|
-
h("
|
|
145
|
-
h("
|
|
146
|
-
h("
|
|
163
|
+
h("salla-button", { wide: true, onClick: () => this.loginByEmail(), ref: b => this.emailBtn = b }, this.enterText),
|
|
164
|
+
h("a", { href: "#", onClick: () => this.showTab(this.mobileTab), class: "s-login-link" }, this.bySMSText)) : '',
|
|
165
|
+
h("salla-verify", { "without-modal": true, ref: tab => this.verifyTab = tab, autoReload: false, "is-show-back": true }),
|
|
166
|
+
h("div", { ref: tab => this.registrationTab = tab },
|
|
167
|
+
h("label", { class: "s-login-label" }, this.firstNameLabel),
|
|
168
|
+
h("input", { type: "text", class: "s-login-input", ref: el => this.firstName = el, onKeyDown: e => this.typing(e, this.newUser), placeholder: salla.lang.get('pages.profile.first_name') }),
|
|
169
|
+
h("span", { class: "s-login-error-message" }),
|
|
170
|
+
h("label", { class: "s-login-label" }, this.lastNameLabel),
|
|
171
|
+
h("input", { type: "text", class: "s-login-input", ref: el => this.lastName = el, onKeyDown: e => this.typing(e, this.newUser), placeholder: salla.lang.get('pages.profile.last_name') }),
|
|
172
|
+
h("span", { class: "s-login-error-message" }),
|
|
173
|
+
h("div", { ref: el => this.regMobileBlock = el, class: "mb-1.5" },
|
|
147
174
|
h("label", { class: "s-login-label" }, this.mobileLabel),
|
|
148
|
-
h("salla-tel-input", { phone: '', ref: el => this.regTelInput = el }),
|
|
149
|
-
|
|
150
|
-
h("div", { ref: el => this.regEmailBlock = el },
|
|
175
|
+
h("salla-tel-input", { phone: '', ref: el => this.regTelInput = el, onKeyDown: e => this.typing(e, this.newUser) })),
|
|
176
|
+
h("div", { ref: el => this.regEmailBlock = el, class: "mb-1.5" },
|
|
151
177
|
h("label", { class: "s-login-label" }, this.emailLabel),
|
|
152
|
-
h("input", { type: "email", ref: el => this.regEmail = el,
|
|
178
|
+
h("input", { type: "email", ref: el => this.regEmail = el, onKeyDown: e => this.typing(e, this.newUser), placeholder: "your@email.com", class: "s-login-input s-ltr" }),
|
|
153
179
|
h("span", { class: "s-login-error-message" })),
|
|
154
|
-
h("salla-button", { wide: true, onClick: () => this.newUser() }, salla.lang.get('blocks.header.register'))))));
|
|
180
|
+
h("salla-button", { wide: true, onClick: () => this.newUser(), ref: b => this.regBtn = b }, salla.lang.get('blocks.header.register'))))));
|
|
155
181
|
}
|
|
156
182
|
static get is() { return "salla-login"; }
|
|
157
183
|
static get originalStyleUrls() { return {
|
|
158
|
-
"$": ["salla-login.
|
|
184
|
+
"$": ["salla-login.scss"]
|
|
159
185
|
}; }
|
|
160
186
|
static get styleUrls() { return {
|
|
161
187
|
"$": ["salla-login.css"]
|
|
@@ -178,170 +204,24 @@ export class SallaLogin {
|
|
|
178
204
|
"attribute": "is-email-allowed",
|
|
179
205
|
"reflect": false,
|
|
180
206
|
"defaultValue": "true"
|
|
181
|
-
},
|
|
182
|
-
"loginTypeTitle": {
|
|
183
|
-
"type": "string",
|
|
184
|
-
"mutable": false,
|
|
185
|
-
"complexType": {
|
|
186
|
-
"original": "string",
|
|
187
|
-
"resolved": "string",
|
|
188
|
-
"references": {}
|
|
189
|
-
},
|
|
190
|
-
"required": false,
|
|
191
|
-
"optional": false,
|
|
192
|
-
"docs": {
|
|
193
|
-
"tags": [],
|
|
194
|
-
"text": ""
|
|
195
|
-
},
|
|
196
|
-
"attribute": "login-type-title",
|
|
197
|
-
"reflect": false,
|
|
198
|
-
"defaultValue": "salla.lang.get('blocks.header.select_login_way')"
|
|
199
|
-
},
|
|
200
|
-
"loginText": {
|
|
201
|
-
"type": "string",
|
|
202
|
-
"mutable": false,
|
|
203
|
-
"complexType": {
|
|
204
|
-
"original": "string",
|
|
205
|
-
"resolved": "string",
|
|
206
|
-
"references": {}
|
|
207
|
-
},
|
|
208
|
-
"required": false,
|
|
209
|
-
"optional": false,
|
|
210
|
-
"docs": {
|
|
211
|
-
"tags": [],
|
|
212
|
-
"text": ""
|
|
213
|
-
},
|
|
214
|
-
"attribute": "login-text",
|
|
215
|
-
"reflect": false,
|
|
216
|
-
"defaultValue": "salla.lang.get('blocks.header.login')"
|
|
217
|
-
},
|
|
218
|
-
"smsLabel": {
|
|
219
|
-
"type": "string",
|
|
220
|
-
"mutable": false,
|
|
221
|
-
"complexType": {
|
|
222
|
-
"original": "string",
|
|
223
|
-
"resolved": "string",
|
|
224
|
-
"references": {}
|
|
225
|
-
},
|
|
226
|
-
"required": false,
|
|
227
|
-
"optional": false,
|
|
228
|
-
"docs": {
|
|
229
|
-
"tags": [],
|
|
230
|
-
"text": ""
|
|
231
|
-
},
|
|
232
|
-
"attribute": "sms-label",
|
|
233
|
-
"reflect": false,
|
|
234
|
-
"defaultValue": "salla.lang.get('blocks.header.sms')"
|
|
235
|
-
},
|
|
236
|
-
"mobileLabel": {
|
|
237
|
-
"type": "string",
|
|
238
|
-
"mutable": false,
|
|
239
|
-
"complexType": {
|
|
240
|
-
"original": "string",
|
|
241
|
-
"resolved": "string",
|
|
242
|
-
"references": {}
|
|
243
|
-
},
|
|
244
|
-
"required": false,
|
|
245
|
-
"optional": false,
|
|
246
|
-
"docs": {
|
|
247
|
-
"tags": [],
|
|
248
|
-
"text": ""
|
|
249
|
-
},
|
|
250
|
-
"attribute": "mobile-label",
|
|
251
|
-
"reflect": false,
|
|
252
|
-
"defaultValue": "salla.lang.get('common.elements.mobile')"
|
|
253
|
-
},
|
|
254
|
-
"emailLabel": {
|
|
255
|
-
"type": "string",
|
|
256
|
-
"mutable": false,
|
|
257
|
-
"complexType": {
|
|
258
|
-
"original": "string",
|
|
259
|
-
"resolved": "string",
|
|
260
|
-
"references": {}
|
|
261
|
-
},
|
|
262
|
-
"required": false,
|
|
263
|
-
"optional": false,
|
|
264
|
-
"docs": {
|
|
265
|
-
"tags": [],
|
|
266
|
-
"text": ""
|
|
267
|
-
},
|
|
268
|
-
"attribute": "email-label",
|
|
269
|
-
"reflect": false,
|
|
270
|
-
"defaultValue": "salla.lang.get('common.elements.email')"
|
|
271
|
-
},
|
|
272
|
-
"enterText": {
|
|
273
|
-
"type": "string",
|
|
274
|
-
"mutable": false,
|
|
275
|
-
"complexType": {
|
|
276
|
-
"original": "string",
|
|
277
|
-
"resolved": "string",
|
|
278
|
-
"references": {}
|
|
279
|
-
},
|
|
280
|
-
"required": false,
|
|
281
|
-
"optional": false,
|
|
282
|
-
"docs": {
|
|
283
|
-
"tags": [],
|
|
284
|
-
"text": ""
|
|
285
|
-
},
|
|
286
|
-
"attribute": "enter-text",
|
|
287
|
-
"reflect": false,
|
|
288
|
-
"defaultValue": "salla.lang.get('blocks.header.enter')"
|
|
289
|
-
},
|
|
290
|
-
"bySMSText": {
|
|
291
|
-
"type": "string",
|
|
292
|
-
"mutable": false,
|
|
293
|
-
"complexType": {
|
|
294
|
-
"original": "string",
|
|
295
|
-
"resolved": "string",
|
|
296
|
-
"references": {}
|
|
297
|
-
},
|
|
298
|
-
"required": false,
|
|
299
|
-
"optional": false,
|
|
300
|
-
"docs": {
|
|
301
|
-
"tags": [],
|
|
302
|
-
"text": ""
|
|
303
|
-
},
|
|
304
|
-
"attribute": "by-s-m-s-text",
|
|
305
|
-
"reflect": false,
|
|
306
|
-
"defaultValue": "salla.lang.get('blocks.header.login_by_sms')"
|
|
307
|
-
},
|
|
308
|
-
"byEmailText": {
|
|
309
|
-
"type": "string",
|
|
310
|
-
"mutable": false,
|
|
311
|
-
"complexType": {
|
|
312
|
-
"original": "string",
|
|
313
|
-
"resolved": "string",
|
|
314
|
-
"references": {}
|
|
315
|
-
},
|
|
316
|
-
"required": false,
|
|
317
|
-
"optional": false,
|
|
318
|
-
"docs": {
|
|
319
|
-
"tags": [],
|
|
320
|
-
"text": ""
|
|
321
|
-
},
|
|
322
|
-
"attribute": "by-email-text",
|
|
323
|
-
"reflect": false,
|
|
324
|
-
"defaultValue": "salla.lang.get('blocks.header.login_by_email')"
|
|
325
|
-
},
|
|
326
|
-
"backText": {
|
|
327
|
-
"type": "string",
|
|
328
|
-
"mutable": false,
|
|
329
|
-
"complexType": {
|
|
330
|
-
"original": "string",
|
|
331
|
-
"resolved": "string",
|
|
332
|
-
"references": {}
|
|
333
|
-
},
|
|
334
|
-
"required": false,
|
|
335
|
-
"optional": false,
|
|
336
|
-
"docs": {
|
|
337
|
-
"tags": [],
|
|
338
|
-
"text": ""
|
|
339
|
-
},
|
|
340
|
-
"attribute": "back-text",
|
|
341
|
-
"reflect": false,
|
|
342
|
-
"defaultValue": "salla.lang.get('common.elements.back')"
|
|
343
207
|
}
|
|
344
208
|
}; }
|
|
209
|
+
static get states() { return {
|
|
210
|
+
"title": {},
|
|
211
|
+
"loginTypeTitle": {},
|
|
212
|
+
"loginText": {},
|
|
213
|
+
"smsLabel": {},
|
|
214
|
+
"mobileLabel": {},
|
|
215
|
+
"emailLabel": {},
|
|
216
|
+
"enterText": {},
|
|
217
|
+
"bySMSText": {},
|
|
218
|
+
"byEmailText": {},
|
|
219
|
+
"isEmailValid": {},
|
|
220
|
+
"firstNameLabel": {},
|
|
221
|
+
"lastNameLabel": {},
|
|
222
|
+
"firstNameRequired": {},
|
|
223
|
+
"lastNameRequired": {}
|
|
224
|
+
}; }
|
|
345
225
|
static get methods() { return {
|
|
346
226
|
"show": {
|
|
347
227
|
"complexType": {
|
|
File without changes
|
|
@@ -84,39 +84,47 @@ export class SallaModal {
|
|
|
84
84
|
h("div", { class: "s-modal-overlay", ref: el => this.overlay = el, onClick: () => this.closeModal() }),
|
|
85
85
|
h("span", { class: 's-modal-spacer s-modal-align-' + this.position }, "\u200B"),
|
|
86
86
|
h("div", { class: 's-modal-body ' + 's-modal-align-' + this.position + ' s-modal-' + this.width, slot: "body" }, this.isLoading
|
|
87
|
-
? h("
|
|
87
|
+
? h("div", { class: "s-modal-loader-wrap" },
|
|
88
|
+
h("span", { class: "s-modal-loader" }))
|
|
88
89
|
:
|
|
89
90
|
[h("div", { class: { 's-modal-header': true, 's-modal-is-center': this.icon != '' || this.imageIcon != '' } },
|
|
90
91
|
this.isClosable ?
|
|
91
92
|
h("button", { class: "s-modal-close", onClick: () => this.closeModal(), type: "button" },
|
|
92
93
|
h("span", { class: "sicon-cancel" }))
|
|
93
94
|
: '',
|
|
94
|
-
this.error || this.success || this.icon
|
|
95
|
-
? h("div", { class: {
|
|
96
|
-
's-modal-icon': true,
|
|
97
|
-
's-modal-bg-error': this.error,
|
|
98
|
-
's-modal-bg-success': this.success,
|
|
99
|
-
's-modal-bg-normal': !this.error && !this.success,
|
|
100
|
-
's-modal-bg-primary': this.primary
|
|
101
|
-
} },
|
|
102
|
-
h("i", { class: {
|
|
103
|
-
[this.icon]: true,
|
|
104
|
-
's-modal-text-error': this.error,
|
|
105
|
-
's-modal-text-success': this.success,
|
|
106
|
-
} }))
|
|
107
|
-
: this.imageIcon ?
|
|
108
|
-
h("img", { class: "s-modal-header-img", src: this.imageIcon })
|
|
109
|
-
: '',
|
|
110
95
|
this.title || this.subTitle ?
|
|
111
|
-
h("div", { class: "s-modal-header-
|
|
112
|
-
|
|
113
|
-
|
|
96
|
+
h("div", { class: "s-modal-header-inner" },
|
|
97
|
+
this.error || this.success || this.icon
|
|
98
|
+
? h("div", { class: {
|
|
99
|
+
's-modal-icon': true,
|
|
100
|
+
's-modal-bg-error': this.error,
|
|
101
|
+
's-modal-bg-success': this.success,
|
|
102
|
+
's-modal-bg-normal': !this.error && !this.success,
|
|
103
|
+
's-modal-bg-primary': this.primary
|
|
104
|
+
} },
|
|
105
|
+
h("i", { class: {
|
|
106
|
+
[this.icon]: true,
|
|
107
|
+
's-modal-text-error': this.error,
|
|
108
|
+
's-modal-text-success': this.success,
|
|
109
|
+
} }))
|
|
110
|
+
: this.imageIcon ?
|
|
111
|
+
h("img", { class: "s-modal-header-img", src: this.imageIcon })
|
|
112
|
+
: '',
|
|
113
|
+
h("div", { class: "s-modal-header-content" },
|
|
114
|
+
h("div", { class: { 's-modal-title': true, 's-modal-title-below': this.subTitleFirst }, innerHTML: this.title }),
|
|
115
|
+
h("p", { class: { 's-modal-sub-title': true }, innerHTML: this.subTitle })))
|
|
114
116
|
: ''),
|
|
115
117
|
h("slot", null),
|
|
116
118
|
h("slot", { name: "footer" })
|
|
117
119
|
]))));
|
|
118
120
|
}
|
|
119
121
|
static get is() { return "salla-modal"; }
|
|
122
|
+
static get originalStyleUrls() { return {
|
|
123
|
+
"$": ["salla-modal.scss"]
|
|
124
|
+
}; }
|
|
125
|
+
static get styleUrls() { return {
|
|
126
|
+
"$": ["salla-modal.css"]
|
|
127
|
+
}; }
|
|
120
128
|
static get properties() { return {
|
|
121
129
|
"error": {
|
|
122
130
|
"type": "boolean",
|
|
@@ -15,7 +15,7 @@ export class SallaOffer {
|
|
|
15
15
|
this.productSlot = ((_c = Helper.getElement('[slot="product"]')) === null || _c === void 0 ? void 0 : _c.innerHTML) || this.defaultProductSlot();
|
|
16
16
|
salla.offer.event.onExisted(data => {
|
|
17
17
|
//TODO:: use the best, should we hide the offer by product Id or Offer id🤔
|
|
18
|
-
if (salla.
|
|
18
|
+
if (salla.localData.get('remember-offer-' + data.offer.offer_id)) {
|
|
19
19
|
salla.log('User selected to don\'t show this offer again.');
|
|
20
20
|
return;
|
|
21
21
|
}
|
|
@@ -29,7 +29,7 @@ export class SallaOffer {
|
|
|
29
29
|
.then(response => this.offer = response.data[0]);
|
|
30
30
|
}
|
|
31
31
|
rememberMe(event) {
|
|
32
|
-
salla.
|
|
32
|
+
salla.localData.set('remember-offer-' + this.offer.id, event.target.checked);
|
|
33
33
|
}
|
|
34
34
|
addItem() {
|
|
35
35
|
// this here, is sallaButton
|
|
@@ -53,11 +53,13 @@ export class SallaRating {
|
|
|
53
53
|
showActiveStep(current = null) {
|
|
54
54
|
var _a;
|
|
55
55
|
this.currentTab = current || this.steps[this.currentIndex];
|
|
56
|
-
Helper.toggle('.s-rating-step', 's-rating-
|
|
57
|
-
.toggle('.s-rating-step
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
56
|
+
Helper.toggle('.s-rating-step-dot', 's-rating-bg-gray', 's-rating-bg-primary', dot => dot != this.dots[this.currentIndex])
|
|
57
|
+
.toggle('.s-rating-step', 's-rating-active', 's-rating-hidden', tab => tab == this.currentTab);
|
|
58
|
+
if (this.currentIndex != 0) {
|
|
59
|
+
// the animation
|
|
60
|
+
Helper.toggleElement(this.currentTab, 's-rating-unactive', 's-rating-hidden', () => true);
|
|
61
|
+
setTimeout(() => Helper.toggleElement(this.currentTab, 's-rating-active', 's-rating-unactive', () => true), 300);
|
|
62
|
+
}
|
|
61
63
|
// Btn text
|
|
62
64
|
let nextType = (_a = this.steps[this.currentIndex + 1]) === null || _a === void 0 ? void 0 : _a.dataset.type;
|
|
63
65
|
this.nextBtn.querySelector('.s-button-text').innerHTML = nextType
|
|
@@ -105,6 +107,7 @@ export class SallaRating {
|
|
|
105
107
|
this.nextBtn.stop();
|
|
106
108
|
salla.config.canLeave = true;
|
|
107
109
|
this.currentIndex == this.stepsCount && this.showThankYou();
|
|
110
|
+
this.modal.isClosable = false;
|
|
108
111
|
});
|
|
109
112
|
}
|
|
110
113
|
submittedBefore() {
|
|
@@ -170,7 +173,7 @@ export class SallaRating {
|
|
|
170
173
|
h("salla-modal", { isLoading: true, width: "md", ref: modal => this.modal = modal }, this.order
|
|
171
174
|
? [h("div", { class: "s-rating-wrapper", ref: el => this.body = el },
|
|
172
175
|
this.order.testimonials_enabled ?
|
|
173
|
-
h("div", { class: "rating-outer-form s-rating-step-wrap s-rating-step", "data-type": "store" },
|
|
176
|
+
h("div", { class: "rating-outer-form s-rating-step-wrap s-rating-step s-rating-hidden", "data-type": "store" },
|
|
174
177
|
h("div", { class: "s-rating-rounded-icon" },
|
|
175
178
|
h("img", { src: salla.get('store.logo'), alt: "store name", class: "s-rating-store-logo" })),
|
|
176
179
|
h("h2", { class: "s-rating-title" }, salla.lang.get('pages.rating.rate_the_store')),
|
|
@@ -181,7 +184,7 @@ export class SallaRating {
|
|
|
181
184
|
h("small", { class: "s-rating-validation-msg" }))
|
|
182
185
|
: '',
|
|
183
186
|
this.order.products_enabled
|
|
184
|
-
? h("section", { class: "s-rating-step", "data-type": "products" }, this.order.products.map((item, index) => h("div", { class: "rating-outer-form s-rating-product", "data-stars-error": salla.lang.get('pages.rating.rate_product_stars') },
|
|
187
|
+
? h("section", { class: "s-rating-step s-rating-hidden", "data-type": "products" }, this.order.products.map((item, index) => h("div", { class: "rating-outer-form s-rating-product", "data-stars-error": salla.lang.get('pages.rating.rate_product_stars') },
|
|
185
188
|
h("img", { src: item.product.thumbnail, alt: item.product.name, class: "s-rating-product-img" }),
|
|
186
189
|
h("div", { class: "s-rating-product-details" },
|
|
187
190
|
h("h3", { class: "s-rating-product-title" },
|
|
@@ -195,7 +198,7 @@ export class SallaRating {
|
|
|
195
198
|
h("small", { class: "s-rating-validation-msg" })))))
|
|
196
199
|
: '',
|
|
197
200
|
this.order.shipping_enabled
|
|
198
|
-
? h("div", { class: "rating-outer-form s-rating-step-wrap s-rating-step", "data-type": "shipping" },
|
|
201
|
+
? h("div", { class: "rating-outer-form s-rating-step-wrap s-rating-step s-rating-hidden", "data-type": "shipping" },
|
|
199
202
|
h("input", { type: "hidden", name: "shipping_company_id", value: this.order.shipping.company.id }),
|
|
200
203
|
this.order.shipping.company.logo
|
|
201
204
|
? h("div", { class: "s-rating-rounded-icon" },
|
|
@@ -216,7 +219,7 @@ export class SallaRating {
|
|
|
216
219
|
h("div", { class: "s-rating-footer" },
|
|
217
220
|
h("button", { ref: el => this.backBtn = el, onClick: () => this.previousTab(), class: "s-rating-btn s-rating-unvisiable" }, salla.lang.get('common.elements.back')),
|
|
218
221
|
this.stepsCount > 1 ? h("ul", { class: "s-rating-dots" }, [0, 1, 2].slice(0, this.stepsCount).map(() => h("li", { class: 's-rating-bg-gray s-rating-step-dot' }))) : '',
|
|
219
|
-
h("salla-button", { ref: el => this.nextBtn = el, onClick: () => this.submit() }, salla.lang.get('common.elements.next'))),]
|
|
222
|
+
h("salla-button", { "loader-position": 'center', ref: el => this.nextBtn = el, onClick: () => this.submit() }, salla.lang.get('common.elements.next'))),]
|
|
220
223
|
: '')));
|
|
221
224
|
}
|
|
222
225
|
componentDidRender() {
|