@salla.sa/twilight-components 1.0.23 → 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.
Files changed (50) hide show
  1. package/dist/cjs/index.cjs.js +1 -1
  2. package/dist/cjs/loader.cjs.js +1 -1
  3. package/dist/cjs/salla-branches.cjs.entry.js +5 -2
  4. package/dist/cjs/salla-button_5.cjs.entry.js +63 -13
  5. package/dist/cjs/salla-localization.cjs.entry.js +6 -4
  6. package/dist/cjs/salla-login-c74587ef.js +154 -0
  7. package/dist/cjs/salla-offer.cjs.entry.js +2 -2
  8. package/dist/cjs/salla-rating.cjs.entry.js +12 -9
  9. package/dist/cjs/twilight-components.cjs.js +1 -1
  10. package/dist/collection/components/salla-branches/salla-branches.js +7 -3
  11. package/dist/collection/components/salla-button/salla-button.js +2 -0
  12. package/dist/collection/components/salla-localization/salla-localization.js +11 -60
  13. package/dist/collection/components/salla-login/salla-login.js +131 -251
  14. package/dist/collection/components/salla-modal/salla-modal.css +0 -0
  15. package/dist/collection/components/salla-modal/salla-modal.js +8 -1
  16. package/dist/collection/components/salla-offer/salla-offer.js +2 -2
  17. package/dist/collection/components/salla-rating/salla-rating.js +12 -9
  18. package/dist/collection/components/salla-tel-input/salla-tel-input.js +86 -6
  19. package/dist/collection/components/salla-verify/salla-verify.js +18 -13
  20. package/dist/esm/index.js +1 -1
  21. package/dist/esm/loader.js +1 -1
  22. package/dist/esm/salla-branches.entry.js +5 -2
  23. package/dist/esm/salla-button_5.entry.js +63 -13
  24. package/dist/esm/salla-localization.entry.js +6 -4
  25. package/dist/esm/salla-login-d08f0d7e.js +152 -0
  26. package/dist/esm/salla-offer.entry.js +2 -2
  27. package/dist/esm/salla-rating.entry.js +12 -9
  28. package/dist/esm/twilight-components.js +1 -1
  29. package/dist/twilight-components/index.esm.js +1 -1
  30. package/dist/twilight-components/p-1918a33c.js +1 -0
  31. package/dist/twilight-components/p-22f06d26.entry.js +1 -0
  32. package/dist/twilight-components/p-5bf5ce53.entry.js +1 -0
  33. package/dist/twilight-components/p-aa9880cb.entry.js +1 -0
  34. package/dist/twilight-components/p-b195e28c.entry.js +1 -0
  35. package/dist/twilight-components/p-e6a3a0dc.entry.js +1 -0
  36. package/dist/twilight-components/twilight-components.esm.js +1 -1
  37. package/dist/types/components/salla-branches/salla-branches.d.ts +1 -0
  38. package/dist/types/components/salla-login/salla-login.d.ts +21 -12
  39. package/dist/types/components/salla-tel-input/salla-tel-input.d.ts +18 -6
  40. package/dist/types/components/salla-verify/salla-verify.d.ts +2 -2
  41. package/dist/types/components.d.ts +5 -27
  42. package/package.json +1 -1
  43. package/dist/cjs/salla-login-6229ec94.js +0 -128
  44. package/dist/esm/salla-login-c368f5b3.js +0 -126
  45. package/dist/twilight-components/p-1a6d8171.entry.js +0 -1
  46. package/dist/twilight-components/p-48931f49.entry.js +0 -1
  47. package/dist/twilight-components/p-4d329f0d.js +0 -1
  48. package/dist/twilight-components/p-7fbdf746.entry.js +0 -1
  49. package/dist/twilight-components/p-ce991664.entry.js +0 -1
  50. package/dist/twilight-components/p-da73fc9b.entry.js +0 -1
@@ -1,4 +1,4 @@
1
- import { Component, Element, h, Method, Prop } from '@stencil/core';
1
+ import { Component, Element, h, Method, State } from '@stencil/core';
2
2
  import Helper from "../../Helpers/Helper";
3
3
  /**
4
4
  * @slot header - The top of the modal.
@@ -11,11 +11,13 @@ export class SallaLocalization {
11
11
  var _a, _b;
12
12
  this.language = salla.config.get('language', {});
13
13
  this.currency = salla.config.get('currency', {});
14
- this.languagesTitle = salla.lang.get('common.titles.language');
15
- this.currenciesTitle = salla.lang.get('common.titles.currency');
16
- this.ok = salla.lang.get('common.elements.ok');
17
14
  Helper.setHost(this.host);
18
15
  salla.event.on('localization::show', () => this.show());
16
+ salla.event.on('languages::translations.loaded', () => {
17
+ this.languagesTitle = salla.lang.get('common.titles.language');
18
+ this.currenciesTitle = salla.lang.get('common.titles.currency');
19
+ this.ok = salla.lang.get('common.elements.ok');
20
+ });
19
21
  /**
20
22
  * letting developer to insert his own slot like:
21
23
  * <salla-localization>
@@ -53,7 +55,7 @@ export class SallaLocalization {
53
55
  .then(() => url && (window.location.href = url));
54
56
  }
55
57
  render() {
56
- return (h("salla-modal", { id: "salla-localization", class: "hidden", ref: modal => this.modal = modal, "modal-width": "xs" },
58
+ return (h("salla-modal", { id: "salla-localization", class: "hidden", ref: modal => this.modal = modal, width: "xs" },
57
59
  h("div", { slot: "header" },
58
60
  h("slot", { name: "header" })),
59
61
  h("div", { class: "s-localization-inner" },
@@ -92,61 +94,10 @@ export class SallaLocalization {
92
94
  this.host.querySelectorAll('#language-slot').forEach(el => el.replaceWith(el.firstChild));
93
95
  }
94
96
  static get is() { return "salla-localization"; }
95
- static get properties() { return {
96
- "languagesTitle": {
97
- "type": "string",
98
- "mutable": false,
99
- "complexType": {
100
- "original": "string",
101
- "resolved": "string",
102
- "references": {}
103
- },
104
- "required": false,
105
- "optional": false,
106
- "docs": {
107
- "tags": [],
108
- "text": ""
109
- },
110
- "attribute": "languages-title",
111
- "reflect": false,
112
- "defaultValue": "salla.lang.get('common.titles.language')"
113
- },
114
- "currenciesTitle": {
115
- "type": "string",
116
- "mutable": false,
117
- "complexType": {
118
- "original": "string",
119
- "resolved": "string",
120
- "references": {}
121
- },
122
- "required": false,
123
- "optional": false,
124
- "docs": {
125
- "tags": [],
126
- "text": ""
127
- },
128
- "attribute": "currencies-title",
129
- "reflect": false,
130
- "defaultValue": "salla.lang.get('common.titles.currency')"
131
- },
132
- "ok": {
133
- "type": "string",
134
- "mutable": false,
135
- "complexType": {
136
- "original": "string",
137
- "resolved": "string",
138
- "references": {}
139
- },
140
- "required": false,
141
- "optional": false,
142
- "docs": {
143
- "tags": [],
144
- "text": ""
145
- },
146
- "attribute": "ok",
147
- "reflect": false,
148
- "defaultValue": "salla.lang.get('common.elements.ok')"
149
- }
97
+ static get states() { return {
98
+ "languagesTitle": {},
99
+ "currenciesTitle": {},
100
+ "ok": {}
150
101
  }; }
151
102
  static get methods() { return {
152
103
  "show": {
@@ -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.loginTypeTitle = salla.lang.get('blocks.header.select_login_way');
8
- this.loginText = salla.lang.get('blocks.header.login');
9
- this.smsLabel = salla.lang.get('blocks.header.sms');
10
- this.mobileLabel = salla.lang.get('common.elements.mobile');
11
- this.emailLabel = salla.lang.get('common.elements.email');
12
- this.enterText = salla.lang.get('blocks.header.enter');
13
- this.bySMSText = salla.lang.get('blocks.header.login_by_sms');
14
- this.byEmailText = salla.lang.get('blocks.header.login_by_email');
15
- this.backText = salla.lang.get('common.elements.back');
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.tab5);
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.tab2) : this.showTab(this.tab3);
102
+ this.regType == 'phone' ? this.showTab(this.mobileTab) : this.showTab(this.emailTab);
44
103
  }
45
104
  async show() {
46
- this.showTab(this.isEmailAllowed ? this.tab1 : this.tab2);
105
+ this.showTab(this.isEmailAllowed ? this.homeTab : this.mobileTab);
47
106
  return this.modal.show();
48
107
  }
49
- showTab(tab) {
50
- [this.tab1, this.tab2, this.tab3, this.tab4, this.tab5].map(el => Helper.toggleElement(el, 'visible', 'hidden', () => el == tab));
51
- setTimeout(() => { [this.tab1, this.tab2, this.tab3, this.tab4, this.tab5].map(el => Helper.toggleElement(el, 's-login-active', 's-login-unactive', () => el == tab)); }, 200);
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.tab2, this.tab3].includes(tab)) {
54
- this.regType = tab === this.tab2 ? 'phone' : 'email';
113
+ if ([this.mobileTab, this.emailTab].includes(tab)) {
114
+ this.regType = tab === this.mobileTab ? 'phone' : 'email';
55
115
  }
56
- let isRegistrationTab = tab == this.tab5;
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,96 +122,62 @@ export class SallaLogin {
62
122
  }
63
123
  return this;
64
124
  }
65
- loginByEmail() {
66
- if (!Helper.isValidEmail(this.email.value)) {
67
- this.email.classList.add('s-has-error');
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.email.nextElementSibling['innerText'] = '';
72
- this.email.classList.remove('s-has-error');
73
- salla.auth.api.login({ type: 'email', email: this.email.value })
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
- //TODO:: if it's enter, go submit
93
- typing({ target }) {
94
- target.type === 'tel' && salla.helpers.digitsOnly(target);
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.tab1 = tab },
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.tab2) },
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.tab3) },
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.tab2 = tab },
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", { phone: '', ref: el => this.loginTelInput = el }),
130
- h("span", { class: "s-login-error-message" }),
131
- h("salla-button", { wide: true, onClick: () => this.loginBySMS() }, this.enterText),
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.tab3 = tab },
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", { onChange: () => this.loginByEmail(), type: "email", ref: el => this.email = el, onInput: this.typing, placeholder: "your@email.com", class: "s-login-input s-ltr" }),
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.tab2), class: "s-login-link" }, this.bySMSText)) : '',
140
- h("salla-verify", { "without-modal": true, ref: tab => this.tab4 = tab, autoReload: false, "back-text": this.backText }),
141
- h("div", { ref: tab => this.tab5 = tab },
142
- h("label", { class: "s-login-label" }, salla.lang.get('blocks.header.your_name')),
143
- h("input", { type: "text", class: "s-login-input", ref: el => this.firstName = el, placeholder: salla.lang.get('pages.profile.first_name') }),
144
- h("label", { class: "s-login-label" }, salla.lang.get('pages.profile.last_name')),
145
- h("input", { type: "text", class: "s-login-input", ref: el => this.lastName = el, placeholder: salla.lang.get('pages.profile.last_name') }),
146
- h("div", { ref: el => this.regMobileBlock = el },
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
- h("span", { class: "s-login-error-message" })),
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, onInput: this.typing, placeholder: "your@email.com", class: "s-login-input s-ltr" }),
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 {
@@ -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": {
@@ -84,7 +84,8 @@ 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("span", null, "Loading...")
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 ?
@@ -118,6 +119,12 @@ export class SallaModal {
118
119
  ]))));
119
120
  }
120
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
+ }; }
121
128
  static get properties() { return {
122
129
  "error": {
123
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.localStore.get('remember-offer-' + data.offer.offer_id)) {
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.localStore.set('remember-offer-' + this.offer.id, event.target.checked);
32
+ salla.localData.set('remember-offer-' + this.offer.id, event.target.checked);
33
33
  }
34
34
  addItem() {
35
35
  // this here, is sallaButton