@salla.sa/twilight-components 1.0.24 → 1.0.26

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 (34) 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-button_5.cjs.entry.js +67 -61
  4. package/dist/cjs/{salla-login-c74587ef.js → salla-login-bf0972bf.js} +29 -19
  5. package/dist/cjs/salla-product-availability.cjs.entry.js +61 -34
  6. package/dist/cjs/salla-rating.cjs.entry.js +3 -3
  7. package/dist/cjs/twilight-components.cjs.js +1 -1
  8. package/dist/collection/components/salla-login/salla-login.js +35 -25
  9. package/dist/collection/components/salla-product-availability/salla-product-availability.js +78 -234
  10. package/dist/collection/components/salla-rating/salla-rating.js +3 -3
  11. package/dist/collection/components/salla-tel-input/salla-tel-input.js +39 -39
  12. package/dist/collection/components/salla-verify/salla-verify.js +38 -27
  13. package/dist/esm/index.js +1 -1
  14. package/dist/esm/loader.js +1 -1
  15. package/dist/esm/salla-button_5.entry.js +67 -61
  16. package/dist/esm/{salla-login-d08f0d7e.js → salla-login-fcb7ad15.js} +29 -19
  17. package/dist/esm/salla-product-availability.entry.js +61 -34
  18. package/dist/esm/salla-rating.entry.js +3 -3
  19. package/dist/esm/twilight-components.js +1 -1
  20. package/dist/twilight-components/index.esm.js +1 -1
  21. package/dist/twilight-components/p-13855688.js +1 -0
  22. package/dist/twilight-components/{p-e6a3a0dc.entry.js → p-6d5f0951.entry.js} +1 -1
  23. package/dist/twilight-components/p-8cce4c31.entry.js +1 -0
  24. package/dist/twilight-components/p-b4e1d032.entry.js +1 -0
  25. package/dist/twilight-components/twilight-components.esm.js +1 -1
  26. package/dist/types/components/salla-login/salla-login.d.ts +3 -3
  27. package/dist/types/components/salla-product-availability/salla-product-availability.d.ts +10 -8
  28. package/dist/types/components/salla-tel-input/salla-tel-input.d.ts +4 -2
  29. package/dist/types/components/salla-verify/salla-verify.d.ts +2 -1
  30. package/dist/types/components.d.ts +3 -24
  31. package/package.json +1 -1
  32. package/dist/twilight-components/p-1918a33c.js +0 -1
  33. package/dist/twilight-components/p-22f06d26.entry.js +0 -1
  34. package/dist/twilight-components/p-7fe5d346.entry.js +0 -1
@@ -11,21 +11,21 @@ export class SallaLogin {
11
11
  e.key == 'Enter' && submitMethod();
12
12
  };
13
13
  this.loginBySMS = async () => {
14
- const { phone, countryCode } = await this.loginTelInput.getValues();
14
+ const { mobile, countryCode } = await this.loginTelInput.getValues();
15
15
  const isPhoneValid = await this.loginTelInput.isValid();
16
16
  if (!isPhoneValid)
17
17
  return;
18
18
  this.smsBtn.load()
19
19
  .then(() => this.smsBtn.disable())
20
- .then(() => salla.auth.api.login({ type: 'mobile', phone: phone, country_code: countryCode }))
20
+ .then(() => salla.auth.api.login({ type: 'mobile', phone: mobile, country_code: countryCode }))
21
21
  .then(() => this.smsBtn.stop() && this.smsBtn.enable())
22
22
  .then(() => this.showTab(this.verifyTab))
23
- .then(() => this.verifyTab.by = 'sms')
24
- .then(() => this.verifyTab.show({ phone: phone, country_code: countryCode }));
23
+ .then(() => (this.verifyTab.by = 'sms') && (this.verifyTab.url = 'auth/mobile/verify'))
24
+ .then(() => this.verifyTab.show({ phone: mobile, country_code: countryCode }));
25
25
  };
26
26
  this.loginByEmail = () => {
27
27
  if (!Helper.isValidEmail(this.loginEmail.value)) {
28
- this.validateField(this.loginEmail, this.isEmailValid);
28
+ this.validateField(this.loginEmail, this.emailErrorMsg);
29
29
  return;
30
30
  }
31
31
  this.emailBtn.load()
@@ -37,7 +37,7 @@ export class SallaLogin {
37
37
  .then(() => this.verifyTab.show({ email: this.loginEmail.value }));
38
38
  };
39
39
  this.newUser = async () => {
40
- const { phone: regPhone, countryCode, countryKey } = await this.regTelInput.getValues();
40
+ const { mobile: regPhone, countryCode, countryKey } = await this.regTelInput.getValues();
41
41
  await this.newUserValidation();
42
42
  await this.regBtn.load();
43
43
  await this.regBtn.disable();
@@ -45,7 +45,7 @@ export class SallaLogin {
45
45
  .then(code => salla.auth.api.register({
46
46
  first_name: this.firstName.value,
47
47
  last_name: this.lastName.value,
48
- phone: regPhone || this.loginTelInput.phone,
48
+ phone: regPhone || this.loginTelInput.mobile,
49
49
  email: this.regEmail.value || this.loginEmail.value,
50
50
  country_code: countryCode,
51
51
  country_key: countryKey,
@@ -58,6 +58,7 @@ export class SallaLogin {
58
58
  this.title = this.host.title || salla.lang.get('blocks.header.login');
59
59
  this.host.removeAttribute('title');
60
60
  salla.event.on('languages::translations.loaded', () => {
61
+ var _a;
61
62
  this.loginTypeTitle = salla.lang.get('blocks.header.select_login_way');
62
63
  this.loginText = salla.lang.get('blocks.header.login');
63
64
  this.smsLabel = salla.lang.get('blocks.header.sms');
@@ -67,15 +68,18 @@ export class SallaLogin {
67
68
  this.bySMSText = salla.lang.get('blocks.header.login_by_sms');
68
69
  this.byEmailText = salla.lang.get('blocks.header.login_by_email');
69
70
  this.title = salla.lang.get('blocks.header.login');
70
- this.isEmailValid = salla.lang.get('common.elements.email_is_valid');
71
+ this.emailErrorMsg = salla.lang.get('common.elements.email_is_valid');
71
72
  this.firstNameLabel = salla.lang.get('blocks.header.your_name');
72
73
  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 });
74
+ this.firstNameErrorMsg = salla.lang.get('common.errors.field_required', { attribute: this.firstNameLabel });
75
+ this.lastNameErrorMsg = salla.lang.get('common.errors.field_required', { attribute: this.lastNameLabel });
76
+ (_a = this.modal) === null || _a === void 0 ? void 0 : _a.setTitle(this.title);
77
+ this.showTab(this.isEmailAllowed ? this.homeTab : this.mobileTab);
75
78
  });
76
79
  salla.auth.event.onVerificationFailed(() => {
77
80
  //
78
81
  });
82
+ salla.event.on('login::show', () => this.show());
79
83
  }
80
84
  /**
81
85
  * @param {CustomEvent|{details:{case:'new_customer'|'authenticated', redirect_url:string|null}}} event
@@ -106,16 +110,21 @@ export class SallaLogin {
106
110
  return this.modal.show();
107
111
  }
108
112
  showTab(tab, evt) {
113
+ var _a, _b;
109
114
  evt === null || evt === void 0 ? void 0 : evt.preventDefault();
110
115
  [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);
112
- setTimeout(() => { this.host.querySelector('.s-login-wrapper').setAttribute('style', 'height:' + (tab === null || tab === void 0 ? void 0 : tab.scrollHeight) + 'px'); });
116
+ setTimeout(() => {
117
+ [this.homeTab, this.mobileTab, this.emailTab, this.verifyTab, this.registrationTab].map(el => Helper.toggleElement(el, 's-login-active', 's-login-unactive', () => el == tab));
118
+ }, 200);
119
+ setTimeout(() => {
120
+ this.host.querySelector('.s-login-wrapper').setAttribute('style', 'height:' + (tab === null || tab === void 0 ? void 0 : tab.scrollHeight) + 'px');
121
+ });
113
122
  if ([this.mobileTab, this.emailTab].includes(tab)) {
114
123
  this.regType = tab === this.mobileTab ? 'phone' : 'email';
115
124
  }
116
125
  let isRegistrationTab = tab == this.registrationTab;
117
- isRegistrationTab && this.firstName.focus();
118
- this.modal.setTitle(isRegistrationTab ? salla.lang.get('common.titles.registration') : this.title);
126
+ isRegistrationTab && ((_a = this.firstName) === null || _a === void 0 ? void 0 : _a.focus());
127
+ (_b = this.modal) === null || _b === void 0 ? void 0 : _b.setTitle(isRegistrationTab ? salla.lang.get('common.titles.registration') : this.title);
119
128
  if (!isRegistrationTab) {
120
129
  Helper.toggleElement(this.regMobileBlock, 's-hidden', 's-block', () => this.regType === 'phone')
121
130
  .toggleElement(this.regEmailBlock, 's-hidden', 's-block', () => this.regType === 'email');
@@ -126,9 +135,9 @@ export class SallaLogin {
126
135
  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
136
  if (isEmailValid && isPhoneValid && isFirstNameValid && isLastNameValid)
128
137
  return;
129
- !isEmailValid && this.validateField(this.regEmail, this.isEmailValid);
130
- !isFirstNameValid && this.validateField(this.firstName, this.firstNameRequired);
131
- !isLastNameValid && this.validateField(this.lastName, this.lastNameRequired);
138
+ !isEmailValid && this.validateField(this.regEmail, this.emailErrorMsg);
139
+ !isFirstNameValid && this.validateField(this.firstName, this.firstNameErrorMsg);
140
+ !isLastNameValid && this.validateField(this.lastName, this.lastNameErrorMsg);
132
141
  throw ('Please insert required fields');
133
142
  }
134
143
  validateField(field, errorMsg) {
@@ -153,14 +162,15 @@ export class SallaLogin {
153
162
  h("div", { class: "s-login-tab", ref: tab => this.mobileTab = tab },
154
163
  h("label", { class: "s-login-label" }, this.mobileLabel),
155
164
  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) : ''),
165
+ h("salla-button", { "loader-position": 'center', wide: true, onClick: () => this.loginBySMS(), ref: b => this.smsBtn = b }, this.enterText),
166
+ this.isEmailAllowed ?
167
+ h("a", { href: "#", onClick: () => this.showTab(this.emailTab), class: "s-login-link" }, this.byEmailText) : ''),
158
168
  this.isEmailAllowed ?
159
169
  h("div", { class: "s-login-tab", ref: tab => this.emailTab = tab },
160
170
  h("label", { class: "s-login-label" }, this.emailLabel),
161
171
  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" }),
162
172
  h("span", { class: "s-login-error-message" }),
163
- h("salla-button", { wide: true, onClick: () => this.loginByEmail(), ref: b => this.emailBtn = b }, this.enterText),
173
+ h("salla-button", { "loader-position": 'center', wide: true, onClick: () => this.loginByEmail(), ref: b => this.emailBtn = b }, this.enterText),
164
174
  h("a", { href: "#", onClick: () => this.showTab(this.mobileTab), class: "s-login-link" }, this.bySMSText)) : '',
165
175
  h("salla-verify", { "without-modal": true, ref: tab => this.verifyTab = tab, autoReload: false, "is-show-back": true }),
166
176
  h("div", { ref: tab => this.registrationTab = tab },
@@ -172,12 +182,12 @@ export class SallaLogin {
172
182
  h("span", { class: "s-login-error-message" }),
173
183
  h("div", { ref: el => this.regMobileBlock = el, class: "mb-1.5" },
174
184
  h("label", { class: "s-login-label" }, this.mobileLabel),
175
- h("salla-tel-input", { phone: '', ref: el => this.regTelInput = el, onKeyDown: e => this.typing(e, this.newUser) })),
185
+ h("salla-tel-input", { ref: el => this.regTelInput = el, onKeyDown: e => this.typing(e, this.newUser) })),
176
186
  h("div", { ref: el => this.regEmailBlock = el, class: "mb-1.5" },
177
187
  h("label", { class: "s-login-label" }, this.emailLabel),
178
188
  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" }),
179
189
  h("span", { class: "s-login-error-message" })),
180
- h("salla-button", { wide: true, onClick: () => this.newUser(), ref: b => this.regBtn = b }, salla.lang.get('blocks.header.register'))))));
190
+ h("salla-button", { "loader-position": 'center', wide: true, onClick: () => this.newUser(), ref: b => this.regBtn = b }, salla.lang.get('blocks.header.register'))))));
181
191
  }
182
192
  static get is() { return "salla-login"; }
183
193
  static get originalStyleUrls() { return {
@@ -216,11 +226,11 @@ export class SallaLogin {
216
226
  "enterText": {},
217
227
  "bySMSText": {},
218
228
  "byEmailText": {},
219
- "isEmailValid": {},
229
+ "emailErrorMsg": {},
220
230
  "firstNameLabel": {},
221
231
  "lastNameLabel": {},
222
- "firstNameRequired": {},
223
- "lastNameRequired": {}
232
+ "firstNameErrorMsg": {},
233
+ "lastNameErrorMsg": {}
224
234
  }; }
225
235
  static get methods() { return {
226
236
  "show": {
@@ -1,73 +1,103 @@
1
- import { Component, Host, h, Prop, Watch, Element, Method } from '@stencil/core';
1
+ import { Component, Host, h, Prop, Watch, Element, State } from '@stencil/core';
2
2
  import Helper from "../../Helpers/Helper";
3
3
  export class SallaProductAvailability {
4
4
  constructor() {
5
5
  this.isUser = Helper.isUser();
6
- this.buttonText = salla.lang.get('pages.products.notify_availability');
7
- this.countryCode = salla.config.country_code || 'SA';
8
- this.subscribeText = salla.lang.get('common.elements.submit');
9
- this.cancelText = salla.lang.get('common.elements.cancel');
10
- this.subTitle = salla.lang.get('pages.products.notify_availability_subtitle');
11
- this.mobileLabel = salla.lang.get('common.elements.mobile');
12
- this.emailLabel = salla.lang.get('common.elements.email');
13
- this.mobilePlaceholder = salla.lang.get('common.elements.mobile_placeholder');
14
- this.emailPlaceholder = salla.lang.get('common.elements.email_placeholder');
15
- this.productId = salla.config.page.id;
16
- this.subscribedMessage = salla.lang.get('pages.products.notify_availability_success');
6
+ this.productId = salla.get('page.id');
17
7
  this.isSubscribed = false;
8
+ // @Method()
9
+ this.submit = async () => {
10
+ if (this.isUser) {
11
+ return salla.api.product.availabilitySubscribe(this.productId)
12
+ .then(() => this.isSubscribed = true);
13
+ }
14
+ let { mobile, countryCode } = await this.mobileInput.getValues(), data = { id: this.productId, country_code: countryCode };
15
+ mobile !== '' && (data['mobile'] = mobile);
16
+ this.email.value !== '' && (data['email'] = this.email.value);
17
+ await this.validateform({ mobile: mobile, email: this.email.value });
18
+ return this.btn.load()
19
+ .then(() => this.btn.disable())
20
+ .then(() => salla.api.product.availabilitySubscribe(data))
21
+ .then(() => this.isSubscribed = true) //no need to wait until finishing alert animation
22
+ .then(() => this.btn.stop())
23
+ .then(() => this.modal.hide())
24
+ .catch(() => this.btn.stop() && this.btn.enable());
25
+ };
26
+ // helpers
27
+ this.typing = (e, submitMethod) => {
28
+ const error = e.target.nextElementSibling;
29
+ e.target.classList.remove('s-has-error');
30
+ (error === null || error === void 0 ? void 0 : error.classList.contains('s-product-availability-error-msg')) && (error.innerText = '');
31
+ e.key == 'Enter' && submitMethod();
32
+ };
18
33
  if (this.isUser) {
19
34
  return;
20
35
  }
21
36
  this.channelsWatcher(this.channels);
22
37
  this.title_ = this.host.title || salla.lang.get('pages.products.notify_availability_title');
23
38
  this.host.removeAttribute('title');
39
+ salla.event.on('languages::translations.loaded', () => {
40
+ var _a;
41
+ this.title_ = this.host.title || salla.lang.get('pages.products.notify_availability_title');
42
+ this.subscribeText = salla.lang.get('common.elements.submit');
43
+ this.cancelText = salla.lang.get('common.elements.cancel');
44
+ this.subTitle = salla.lang.get('pages.products.notify_availability_subtitle');
45
+ this.mobileLabel = salla.lang.get('common.elements.mobile');
46
+ this.emailLabel = salla.lang.get('common.elements.email');
47
+ this.emailPlaceholder = salla.lang.get('common.elements.email_placeholder');
48
+ this.subscribedMessage = salla.lang.get('pages.products.notify_availability_success');
49
+ this.buttonText = salla.lang.get('pages.products.notify_availability');
50
+ this.emailErrorMsg = salla.lang.get('common.elements.email_is_valid');
51
+ (_a = this.modal) === null || _a === void 0 ? void 0 : _a.setTitle(this.title_);
52
+ });
24
53
  }
25
54
  channelsWatcher(newValue) {
26
55
  this.channels_ = newValue.split(',');
27
56
  }
28
- async submit() {
29
- if (this.isUser) {
30
- return salla.api.product.availabilitySubscribe(this.productId)
31
- .then(() => this.isSubscribed = true);
32
- }
33
- let data = { id: this.productId, country_code: this.countryCode };
34
- if (this.mobile.value !== '') {
35
- data['mobile'] = this.mobile.value;
57
+ async validateform(data) {
58
+ if (this.channels_.includes('email') && !data.mobile) {
59
+ const isEmailValid = Helper.isValidEmail(this.email.value);
60
+ if (isEmailValid)
61
+ return;
62
+ !isEmailValid && this.validateField(this.email, this.emailErrorMsg);
36
63
  }
37
- if (this.email.value !== '') {
38
- data['email'] = this.email.value;
64
+ if (this.channels_.includes('sms') && !data.email) {
65
+ const isPhoneValid = await this.mobileInput.isValid();
66
+ if (isPhoneValid)
67
+ return;
39
68
  }
40
- return this.btn.load()
41
- .then(() => this.btn.disable())
42
- .then(() => salla.api.product.availabilitySubscribe(data))
43
- .then(() => this.isSubscribed = true) //no need to wait until finishing alert animation
44
- .then(() => this.btn.stop())
45
- .then(() => this.modal.hide())
46
- .catch(() => this.btn.stop() && this.btn.enable());
69
+ throw ('Please insert required fields');
70
+ }
71
+ validateField(field, errorMsg) {
72
+ field.classList.add('s-has-error');
73
+ field.nextElementSibling['innerText'] = '* ' + errorMsg;
47
74
  }
48
75
  render() {
49
76
  return (h(Host, null,
50
77
  this.isSubscribed
51
- ? h("div", { class: "s-product-availability-subscribed" }, this.subscribedMessage)
78
+ ? h("div", { class: "s-product-availability-subscribed" },
79
+ h("i", { class: "sicon-bell-ring s-product-availability-subs-icon" }),
80
+ " ",
81
+ this.subscribedMessage)
52
82
  : h("slot", null,
53
83
  h("salla-button", { wide: true, onClick: () => this.isUser ? this.submit() : this.modal.show() }, this.buttonText)),
54
84
  this.isUser || this.isSubscribed ? '' : this.renderModal()));
55
85
  }
56
86
  renderModal() {
57
- return (h("salla-modal", { ref: modal => this.modal = modal, title: this.title_, subTitle: this.subTitle, icon: "sicon-bell-ring", width: "md" },
87
+ return (h("salla-modal", { ref: modal => this.modal = modal, title: this.title_, subTitle: this.subTitle, icon: "sicon-bell-ring", width: "sm" },
58
88
  h("div", { class: "s-product-availability-body" },
59
89
  this.channels_.includes('email') ? [
60
90
  h("label", { class: "s-product-availability-label" }, this.emailLabel),
61
- h("input", { class: "s-product-availability-input", placeholder: this.emailPlaceholder, ref: el => this.email = el, type: "email" })
91
+ h("input", { class: "s-product-availability-input", onKeyDown: e => this.typing(e, this.submit), placeholder: this.emailPlaceholder, ref: el => this.email = el, type: "email" }),
92
+ h("span", { class: "s-product-availability-error-msg" })
62
93
  ] : '',
63
94
  this.channels_.includes('sms') ? [
64
95
  h("label", { class: "s-product-availability-label" }, this.mobileLabel),
65
- h("input", { class: "s-product-availability-input", placeholder: this.mobilePlaceholder, ref: el => this.mobile = el, type: "text" }),
66
- h("input", { type: "hidden", value: this.countryCode }),
96
+ h("salla-tel-input", { ref: el => this.mobileInput = el, onKeyDown: e => this.typing(e, this.submit) })
67
97
  ] : ''),
68
98
  h("div", { slot: "footer", class: "s-product-availability-footer" },
69
- h("salla-button", { wide: true, ref: btn => this.btn = btn, onClick: () => this.submit() }, this.subscribeText),
70
- h("salla-button", { wide: true, "btn-style": "outline" }, this.cancelText))));
99
+ h("salla-button", { wide: true, "btn-style": "outline", onClick: () => this.modal.hide() }, this.cancelText),
100
+ h("salla-button", { "loader-position": 'center', wide: true, ref: btn => this.btn = btn, onClick: () => this.submit() }, this.subscribeText))));
71
101
  }
72
102
  static get is() { return "salla-product-availability"; }
73
103
  static get properties() { return {
@@ -88,168 +118,6 @@ export class SallaProductAvailability {
88
118
  "attribute": "channels",
89
119
  "reflect": false
90
120
  },
91
- "buttonText": {
92
- "type": "string",
93
- "mutable": false,
94
- "complexType": {
95
- "original": "string",
96
- "resolved": "string",
97
- "references": {}
98
- },
99
- "required": false,
100
- "optional": false,
101
- "docs": {
102
- "tags": [],
103
- "text": ""
104
- },
105
- "attribute": "button-text",
106
- "reflect": false,
107
- "defaultValue": "salla.lang.get('pages.products.notify_availability')"
108
- },
109
- "countryCode": {
110
- "type": "string",
111
- "mutable": false,
112
- "complexType": {
113
- "original": "string",
114
- "resolved": "string",
115
- "references": {}
116
- },
117
- "required": false,
118
- "optional": false,
119
- "docs": {
120
- "tags": [],
121
- "text": ""
122
- },
123
- "attribute": "country-code",
124
- "reflect": false,
125
- "defaultValue": "salla.config.country_code || 'SA'"
126
- },
127
- "subscribeText": {
128
- "type": "string",
129
- "mutable": false,
130
- "complexType": {
131
- "original": "string",
132
- "resolved": "string",
133
- "references": {}
134
- },
135
- "required": false,
136
- "optional": false,
137
- "docs": {
138
- "tags": [],
139
- "text": ""
140
- },
141
- "attribute": "subscribe-text",
142
- "reflect": false,
143
- "defaultValue": "salla.lang.get('common.elements.submit')"
144
- },
145
- "cancelText": {
146
- "type": "string",
147
- "mutable": false,
148
- "complexType": {
149
- "original": "string",
150
- "resolved": "string",
151
- "references": {}
152
- },
153
- "required": false,
154
- "optional": false,
155
- "docs": {
156
- "tags": [],
157
- "text": ""
158
- },
159
- "attribute": "cancel-text",
160
- "reflect": false,
161
- "defaultValue": "salla.lang.get('common.elements.cancel')"
162
- },
163
- "subTitle": {
164
- "type": "string",
165
- "mutable": false,
166
- "complexType": {
167
- "original": "string",
168
- "resolved": "string",
169
- "references": {}
170
- },
171
- "required": false,
172
- "optional": false,
173
- "docs": {
174
- "tags": [],
175
- "text": ""
176
- },
177
- "attribute": "sub-title",
178
- "reflect": false,
179
- "defaultValue": "salla.lang.get('pages.products.notify_availability_subtitle')"
180
- },
181
- "mobileLabel": {
182
- "type": "string",
183
- "mutable": false,
184
- "complexType": {
185
- "original": "string",
186
- "resolved": "string",
187
- "references": {}
188
- },
189
- "required": false,
190
- "optional": false,
191
- "docs": {
192
- "tags": [],
193
- "text": ""
194
- },
195
- "attribute": "mobile-label",
196
- "reflect": false,
197
- "defaultValue": "salla.lang.get('common.elements.mobile')"
198
- },
199
- "emailLabel": {
200
- "type": "string",
201
- "mutable": false,
202
- "complexType": {
203
- "original": "string",
204
- "resolved": "string",
205
- "references": {}
206
- },
207
- "required": false,
208
- "optional": false,
209
- "docs": {
210
- "tags": [],
211
- "text": ""
212
- },
213
- "attribute": "email-label",
214
- "reflect": false,
215
- "defaultValue": "salla.lang.get('common.elements.email')"
216
- },
217
- "mobilePlaceholder": {
218
- "type": "string",
219
- "mutable": false,
220
- "complexType": {
221
- "original": "string",
222
- "resolved": "string",
223
- "references": {}
224
- },
225
- "required": false,
226
- "optional": false,
227
- "docs": {
228
- "tags": [],
229
- "text": ""
230
- },
231
- "attribute": "mobile-placeholder",
232
- "reflect": false,
233
- "defaultValue": "salla.lang.get('common.elements.mobile_placeholder')"
234
- },
235
- "emailPlaceholder": {
236
- "type": "string",
237
- "mutable": false,
238
- "complexType": {
239
- "original": "string",
240
- "resolved": "string",
241
- "references": {}
242
- },
243
- "required": false,
244
- "optional": false,
245
- "docs": {
246
- "tags": [],
247
- "text": ""
248
- },
249
- "attribute": "email-placeholder",
250
- "reflect": false,
251
- "defaultValue": "salla.lang.get('common.elements.email_placeholder')"
252
- },
253
121
  "productId": {
254
122
  "type": "number",
255
123
  "mutable": false,
@@ -266,25 +134,7 @@ export class SallaProductAvailability {
266
134
  },
267
135
  "attribute": "product-id",
268
136
  "reflect": false,
269
- "defaultValue": "salla.config.page.id"
270
- },
271
- "subscribedMessage": {
272
- "type": "string",
273
- "mutable": false,
274
- "complexType": {
275
- "original": "string",
276
- "resolved": "string",
277
- "references": {}
278
- },
279
- "required": false,
280
- "optional": false,
281
- "docs": {
282
- "tags": [],
283
- "text": ""
284
- },
285
- "attribute": "subscribed-message",
286
- "reflect": false,
287
- "defaultValue": "salla.lang.get('pages.products.notify_availability_success')"
137
+ "defaultValue": "salla.get('page.id')"
288
138
  },
289
139
  "isSubscribed": {
290
140
  "type": "boolean",
@@ -305,23 +155,17 @@ export class SallaProductAvailability {
305
155
  "defaultValue": "false"
306
156
  }
307
157
  }; }
308
- static get methods() { return {
309
- "submit": {
310
- "complexType": {
311
- "signature": "() => Promise<any>",
312
- "parameters": [],
313
- "references": {
314
- "Promise": {
315
- "location": "global"
316
- }
317
- },
318
- "return": "Promise<any>"
319
- },
320
- "docs": {
321
- "text": "",
322
- "tags": []
323
- }
324
- }
158
+ static get states() { return {
159
+ "subscribeText": {},
160
+ "cancelText": {},
161
+ "subTitle": {},
162
+ "mobileLabel": {},
163
+ "emailLabel": {},
164
+ "emailPlaceholder": {},
165
+ "subscribedMessage": {},
166
+ "title_": {},
167
+ "buttonText": {},
168
+ "emailErrorMsg": {}
325
169
  }; }
326
170
  static get elementRef() { return "host"; }
327
171
  static get watchers() { return [{
@@ -10,7 +10,7 @@ export class SallaRating {
10
10
  }
11
11
  async show() {
12
12
  return this.modal.show()
13
- .then(() => salla.feedback.api.order(salla.get('page.id')))
13
+ .then(() => salla.feedback.api.order(salla.config.get('page.id')))
14
14
  .then(res => this.order = res.data)
15
15
  .then(() => this.modal.setTitle(salla.lang.get('pages.rating.rate_order') + ' <span class="unicode">(#' + this.order.id + ')</span>'))
16
16
  .then(() => this.modal.stopLoading())
@@ -142,7 +142,7 @@ export class SallaRating {
142
142
  if (Object.keys(data).length == 0) {
143
143
  return;
144
144
  }
145
- data['order_id'] = salla.get('page.id');
145
+ data['order_id'] = salla.config.get('page.id');
146
146
  data['type'] = this.currentTab.dataset.type;
147
147
  this.submitted.push(this.currentIndex);
148
148
  return salla.feedback.api[this.currentTab.dataset.type](data);
@@ -175,7 +175,7 @@ export class SallaRating {
175
175
  this.order.testimonials_enabled ?
176
176
  h("div", { class: "rating-outer-form s-rating-step-wrap s-rating-step s-rating-hidden", "data-type": "store" },
177
177
  h("div", { class: "s-rating-rounded-icon" },
178
- h("img", { src: salla.get('store.logo'), alt: "store name", class: "s-rating-store-logo" })),
178
+ h("img", { src: salla.config.get('store.logo'), alt: "store name", class: "s-rating-store-logo" })),
179
179
  h("h2", { class: "s-rating-title" }, salla.lang.get('pages.rating.rate_the_store')),
180
180
  h("div", { class: "s-rating-stars-company" },
181
181
  " ",