@salla.sa/twilight-components 1.0.50 → 1.0.52

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 (67) hide show
  1. package/dist/cjs/index.cjs.js +3 -2
  2. package/dist/cjs/loader.cjs.js +1 -1
  3. package/dist/cjs/salla-button.cjs.entry.js +116 -0
  4. package/dist/cjs/salla-infinite-scroll.cjs.entry.js +2 -1
  5. package/dist/cjs/salla-localization-modal.cjs.entry.js +117 -0
  6. package/dist/cjs/{salla-search-a7147639.js → salla-login-modal-a2c7fa5d.js} +13 -87
  7. package/dist/cjs/salla-login-modal.cjs.entry.js +11 -0
  8. package/dist/cjs/salla-modal_2.cjs.entry.js +155 -0
  9. package/dist/cjs/{salla-offer.cjs.entry.js → salla-offer-modal.cjs.entry.js} +26 -26
  10. package/dist/cjs/{salla-rating.cjs.entry.js → salla-rating-modal.cjs.entry.js} +33 -33
  11. package/dist/cjs/salla-search-99d08b1f.js +79 -0
  12. package/dist/cjs/{salla-button_7.cjs.entry.js → salla-tel-input.cjs.entry.js} +0 -509
  13. package/dist/cjs/salla-verify-modal.cjs.entry.js +148 -0
  14. package/dist/cjs/twilight-components.cjs.js +1 -1
  15. package/dist/collection/collection-manifest.json +4 -4
  16. package/dist/collection/components/salla-infinite-scroll/salla-infinite-scroll.js +2 -1
  17. package/dist/collection/components/{salla-localization/salla-localization.css → salla-localization-modal/salla-localization-modal.css} +0 -0
  18. package/dist/collection/components/{salla-localization/salla-localization.js → salla-localization-modal/salla-localization-modal.js} +19 -19
  19. package/dist/collection/components/{salla-login/salla-login.css → salla-login-modal/salla-login-modal.css} +0 -0
  20. package/dist/collection/components/{salla-login/salla-login.js → salla-login-modal/salla-login-modal.js} +34 -34
  21. package/dist/collection/components/{salla-offer → salla-offer-modal}/offer-schema.js +0 -0
  22. package/dist/collection/components/{salla-offer/salla-offer.css → salla-offer-modal/salla-offer-modal.css} +4 -4
  23. package/dist/collection/components/{salla-offer/salla-offer.js → salla-offer-modal/salla-offer-modal.js} +33 -33
  24. package/dist/collection/components/{salla-rating → salla-rating-modal}/order-feedback-response.js +0 -0
  25. package/dist/collection/components/{salla-rating/salla-rating.css → salla-rating-modal/salla-rating-modal.css} +1 -1
  26. package/dist/collection/components/{salla-rating/salla-rating.js → salla-rating-modal/salla-rating-modal.js} +57 -57
  27. package/dist/collection/index.js +1 -1
  28. package/dist/esm/index.js +2 -1
  29. package/dist/esm/loader.js +1 -1
  30. package/dist/esm/salla-button.entry.js +112 -0
  31. package/dist/esm/salla-infinite-scroll.entry.js +2 -1
  32. package/dist/esm/salla-localization-modal.entry.js +113 -0
  33. package/dist/esm/{salla-search-813732a1.js → salla-login-modal-187c1f98.js} +13 -86
  34. package/dist/esm/salla-login-modal.entry.js +3 -0
  35. package/dist/esm/salla-modal_2.entry.js +150 -0
  36. package/dist/esm/{salla-offer.entry.js → salla-offer-modal.entry.js} +26 -26
  37. package/dist/esm/{salla-rating.entry.js → salla-rating-modal.entry.js} +33 -33
  38. package/dist/esm/salla-search-2e3e60cb.js +77 -0
  39. package/dist/esm/{salla-button_7.entry.js → salla-tel-input.entry.js} +2 -505
  40. package/dist/esm/salla-verify-modal.entry.js +144 -0
  41. package/dist/esm/twilight-components.js +1 -1
  42. package/dist/twilight-components/index.esm.js +1 -1
  43. package/dist/twilight-components/p-05dff05e.entry.js +1 -0
  44. package/dist/twilight-components/p-0b599094.js +1 -0
  45. package/dist/twilight-components/p-1f873057.entry.js +1 -0
  46. package/dist/twilight-components/p-2e03db57.entry.js +1 -0
  47. package/dist/twilight-components/p-5ffd56fb.js +1 -0
  48. package/dist/twilight-components/p-85427280.entry.js +1 -0
  49. package/dist/twilight-components/p-88d1bb89.entry.js +1 -0
  50. package/dist/twilight-components/p-8bfa19fb.entry.js +1 -0
  51. package/dist/twilight-components/{p-f89bc866.entry.js → p-e306c6bb.entry.js} +1 -1
  52. package/dist/twilight-components/p-ea455ae9.entry.js +1 -0
  53. package/dist/twilight-components/p-f0f51a3c.entry.js +1 -0
  54. package/dist/twilight-components/twilight-components.esm.js +1 -1
  55. package/dist/types/components/{salla-localization/salla-localization.d.ts → salla-localization-modal/salla-localization-modal.d.ts} +1 -1
  56. package/dist/types/components/{salla-login/salla-login.d.ts → salla-login-modal/salla-login-modal.d.ts} +1 -1
  57. package/dist/types/components/{salla-offer → salla-offer-modal}/offer-schema.d.ts +0 -0
  58. package/dist/types/components/{salla-offer/salla-offer.d.ts → salla-offer-modal/salla-offer-modal.d.ts} +1 -1
  59. package/dist/types/components/{salla-rating → salla-rating-modal}/order-feedback-response.d.ts +0 -0
  60. package/dist/types/components/{salla-rating/salla-rating.d.ts → salla-rating-modal/salla-rating-modal.d.ts} +1 -1
  61. package/dist/types/components.d.ts +36 -36
  62. package/dist/types/index.d.ts +1 -1
  63. package/package.json +1 -1
  64. package/dist/twilight-components/p-4b774cf9.entry.js +0 -1
  65. package/dist/twilight-components/p-59c23e12.entry.js +0 -1
  66. package/dist/twilight-components/p-b584e892.entry.js +0 -1
  67. package/dist/twilight-components/p-b8ed7363.js +0 -1
@@ -1,9 +1,9 @@
1
1
  import { r as registerInstance, h, g as getElement } from './index-8b97d225.js';
2
2
  import { H as Helper } from './Helper-7162a06c.js';
3
3
 
4
- const sallaLoginCss = "";
4
+ const sallaLoginModalCss = "";
5
5
 
6
- const SallaLogin = class {
6
+ const SallaLoginModal = class {
7
7
  constructor(hostRef) {
8
8
  registerInstance(this, hostRef);
9
9
  /**
@@ -37,7 +37,7 @@ const SallaLogin = class {
37
37
  this.typing = (e, submitMethod) => {
38
38
  const error = e.target.nextElementSibling;
39
39
  e.target.classList.remove('s-has-error');
40
- (error === null || error === void 0 ? void 0 : error.classList.contains('s-login-error-message')) && (error.innerText = '');
40
+ (error === null || error === void 0 ? void 0 : error.classList.contains('s-login-modal-error-message')) && (error.innerText = '');
41
41
  e.key == 'Enter' && submitMethod();
42
42
  };
43
43
  this.loginBySMS = async () => {
@@ -158,8 +158,8 @@ const SallaLogin = class {
158
158
  evt === null || evt === void 0 ? void 0 : evt.preventDefault();
159
159
  let tabs = [this.homeTab, this.mobileTab, this.emailTab, this.verifyTab, this.registrationTab];
160
160
  tabs.map(el => Helper.toggleElement(el, 'visible', 's-hidden', () => el == tab));
161
- setTimeout(() => tabs.map(el => Helper.toggleElement(el, 's-login-active', 's-login-unactive', () => el == tab)), 200);
162
- setTimeout(() => this.host.querySelector('.s-login-wrapper').setAttribute('style', 'height:' + (tab === null || tab === void 0 ? void 0 : tab.scrollHeight) + 'px'));
161
+ setTimeout(() => tabs.map(el => Helper.toggleElement(el, 's-login-modal-active', 's-login-modal-unactive', () => el == tab)), 200);
162
+ setTimeout(() => this.host.querySelector('.s-login-modal-wrapper').setAttribute('style', 'height:' + (tab === null || tab === void 0 ? void 0 : tab.scrollHeight) + 'px'));
163
163
  if ([this.mobileTab, this.emailTab].includes(tab)) {
164
164
  this.regType = tab === this.mobileTab ? 'phone' : 'email';
165
165
  }
@@ -187,89 +187,16 @@ const SallaLogin = class {
187
187
  field.nextElementSibling['innerText'] = '* ' + errorMsg;
188
188
  }
189
189
  render() {
190
- return (h("salla-modal", { id: "salla-login", icon: "sicon-user", title: this.title, ref: modal => this.modal = modal, width: "xs" }, h("div", { class: "s-login-wrapper" }, this.isEmailAllowed && this.isMobileAllowed ?
191
- h("div", { class: "s-login-tab", ref: tab => this.homeTab = tab }, h("p", { class: "s-login-sub-title" }, this.loginTypeTitle), h("slot", { name: "before-login-type" }), h("a", { href: "#", class: "s-login-main-btn", onClick: (evt) => this.showTab(this.mobileTab, evt) }, h("i", { class: "s-login-main-btn-icon sicon-phone" }), h("span", { class: "s-login-main-btn-text" }, this.smsLabel), h("i", { class: "main-btn-arrow sicon-keyboard_arrow_left" })), h("a", { href: "#", class: "s-login-main-btn", onClick: (evt) => this.showTab(this.emailTab, evt) }, h("i", { class: "s-login-main-btn-icon sicon-mail" }), h("span", { class: "s-login-main-btn-text" }, this.emailLabel), h("i", { class: "main-btn-arrow sicon-keyboard_arrow_left" })), h("slot", { name: "after-login-type" }))
190
+ return (h("salla-modal", { id: "salla-login", icon: "sicon-user", title: this.title, ref: modal => this.modal = modal, width: "xs" }, h("div", { class: "s-login-modal-wrapper" }, this.isEmailAllowed && this.isMobileAllowed ?
191
+ h("div", { class: "s-login-modal-tab", ref: tab => this.homeTab = tab }, h("p", { class: "s-login-modal-sub-title" }, this.loginTypeTitle), h("slot", { name: "before-login-type" }), h("a", { href: "#", class: "s-login-modal-main-btn", onClick: (evt) => this.showTab(this.mobileTab, evt) }, h("i", { class: "s-login-modal-main-btn-icon sicon-phone" }), h("span", { class: "s-login-modal-main-btn-text" }, this.smsLabel), h("i", { class: "main-btn-arrow sicon-keyboard_arrow_left" })), h("a", { href: "#", class: "s-login-modal-main-btn", onClick: (evt) => this.showTab(this.emailTab, evt) }, h("i", { class: "s-login-modal-main-btn-icon sicon-mail" }), h("span", { class: "s-login-modal-main-btn-text" }, this.emailLabel), h("i", { class: "main-btn-arrow sicon-keyboard_arrow_left" })), h("slot", { name: "after-login-type" }))
192
192
  : '', this.isMobileAllowed ?
193
- h("div", { class: "s-login-tab", ref: tab => this.mobileTab = tab }, h("slot", { name: "before-login-mobile" }), h("label", { class: "s-login-label" }, this.mobileLabel), h("salla-tel-input", { ref: el => this.loginTelInput = el, onKeyDown: e => this.typing(e, this.loginBySMS) }), h("salla-button", { "loader-position": 'center', wide: true, onClick: () => this.loginBySMS(), ref: b => this.smsBtn = b }, salla.lang.get('blocks.header.enter')), this.isEmailAllowed ?
194
- h("a", { href: "#", onClick: () => this.showTab(this.emailTab), class: "s-login-link" }, this.byEmailText) : '', h("slot", { name: "after-login-mobile" })) : '', this.isEmailAllowed ?
195
- h("div", { class: "s-login-tab", ref: tab => this.emailTab = tab }, h("slot", { name: "before-login-email" }), h("label", { class: "s-login-label" }, this.emailLabel), 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" }), h("span", { class: "s-login-error-message" }), h("salla-button", { "loader-position": 'center', wide: true, onClick: () => this.loginByEmail(), ref: b => this.emailBtn = b }, salla.lang.get('blocks.header.enter')), this.isMobileAllowed ?
196
- h("a", { href: "#", onClick: () => this.showTab(this.mobileTab), class: "s-login-link" }, this.bySMSText) : '', h("slot", { name: "after-login-email" })) : '', h("salla-verify-modal", { withoutModal: true, ref: tab => this.verifyTab = tab, autoReload: false }, h("a", { onClick: () => this.showTab(this.regType == 'phone' ? this.mobileTab : this.emailTab), class: "s-verify-modal-back sicon-arrow-right", slot: "after-footer", href: "#" })), h("div", { ref: tab => this.registrationTab = tab }, h("slot", { name: "before-registration" }), h("label", { class: "s-login-label" }, this.firstNameLabel), 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') }), h("span", { class: "s-login-error-message" }), h("label", { class: "s-login-label" }, this.lastNameLabel), 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') }), h("span", { class: "s-login-error-message" }), h("div", { ref: el => this.regMobileBlock = el, class: "mb-1.5" }, h("label", { class: "s-login-label" }, this.mobileLabel), h("salla-tel-input", { ref: el => this.regTelInput = el, onKeyDown: e => this.typing(e, this.newUser) })), h("div", { ref: el => this.regEmailBlock = el, class: "mb-1.5" }, h("label", { class: "s-login-label" }, this.emailLabel), 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" }), h("span", { class: "s-login-error-message" })), h("salla-button", { "loader-position": 'center', wide: true, onClick: () => this.newUser(), ref: b => this.regBtn = b }, salla.lang.get('blocks.header.register')), h("slot", { name: "after-registration" })))));
193
+ h("div", { class: "s-login-modal-tab", ref: tab => this.mobileTab = tab }, h("slot", { name: "before-login-mobile" }), h("label", { class: "s-login-modal-label" }, this.mobileLabel), h("salla-tel-input", { ref: el => this.loginTelInput = el, onKeyDown: e => this.typing(e, this.loginBySMS) }), h("salla-button", { "loader-position": 'center', wide: true, onClick: () => this.loginBySMS(), ref: b => this.smsBtn = b }, salla.lang.get('blocks.header.enter')), this.isEmailAllowed ?
194
+ h("a", { href: "#", onClick: () => this.showTab(this.emailTab), class: "s-login-modal-link" }, this.byEmailText) : '', h("slot", { name: "after-login-mobile" })) : '', this.isEmailAllowed ?
195
+ h("div", { class: "s-login-modal-tab", ref: tab => this.emailTab = tab }, h("slot", { name: "before-login-email" }), h("label", { class: "s-login-modal-label" }, this.emailLabel), h("input", { type: "email", ref: el => this.loginEmail = el, onKeyDown: e => this.typing(e, this.loginByEmail), placeholder: "your@email.com", class: "s-login-modal-input s-ltr" }), h("span", { class: "s-login-modal-error-message" }), h("salla-button", { "loader-position": 'center', wide: true, onClick: () => this.loginByEmail(), ref: b => this.emailBtn = b }, salla.lang.get('blocks.header.enter')), this.isMobileAllowed ?
196
+ h("a", { href: "#", onClick: () => this.showTab(this.mobileTab), class: "s-login-modal-link" }, this.bySMSText) : '', h("slot", { name: "after-login-email" })) : '', h("salla-verify-modal", { withoutModal: true, ref: tab => this.verifyTab = tab, autoReload: false }, h("a", { onClick: () => this.showTab(this.regType == 'phone' ? this.mobileTab : this.emailTab), class: "s-verify-modal-back sicon-arrow-right", slot: "after-footer", href: "#" })), h("div", { ref: tab => this.registrationTab = tab }, h("slot", { name: "before-registration" }), h("label", { class: "s-login-modal-label" }, this.firstNameLabel), h("input", { type: "text", class: "s-login-modal-input", ref: el => this.firstName = el, onKeyDown: e => this.typing(e, this.newUser), placeholder: salla.lang.get('pages.profile.first_name') }), h("span", { class: "s-login-modal-error-message" }), h("label", { class: "s-login-modal-label" }, this.lastNameLabel), h("input", { type: "text", class: "s-login-modal-input", ref: el => this.lastName = el, onKeyDown: e => this.typing(e, this.newUser), placeholder: salla.lang.get('pages.profile.last_name') }), h("span", { class: "s-login-modal-error-message" }), h("div", { ref: el => this.regMobileBlock = el, class: "mb-1.5" }, h("label", { class: "s-login-modal-label" }, this.mobileLabel), h("salla-tel-input", { ref: el => this.regTelInput = el, onKeyDown: e => this.typing(e, this.newUser) })), h("div", { ref: el => this.regEmailBlock = el, class: "mb-1.5" }, h("label", { class: "s-login-modal-label" }, this.emailLabel), h("input", { type: "email", ref: el => this.regEmail = el, onKeyDown: e => this.typing(e, this.newUser), placeholder: "your@email.com", class: "s-login-modal-input s-ltr" }), h("span", { class: "s-login-modal-error-message" })), h("salla-button", { "loader-position": 'center', wide: true, onClick: () => this.newUser(), ref: b => this.regBtn = b }, salla.lang.get('blocks.header.register')), h("slot", { name: "after-registration" })))));
197
197
  }
198
198
  get host() { return getElement(this); }
199
199
  };
200
- SallaLogin.style = sallaLoginCss;
200
+ SallaLoginModal.style = sallaLoginModalCss;
201
201
 
202
- const sallaSearchCss = "#s-search-modal .s-modal-wrapper{align-items:flex-start;padding:0}#s-search-modal .s-modal-spacer{display:inline}#s-search-modal .s-modal-body{padding:0;max-width:90%;margin-top:3.2rem;border-radius:0.5rem}#s-search-modal .s-modal-close{top:50%;transform:translateY(-50%)}";
203
-
204
- const SallaSearch = class {
205
- constructor(hostRef) {
206
- registerInstance(this, hostRef);
207
- var _a;
208
- Helper.setHost(this.host);
209
- this.productSlot = ((_a = Helper.getElement('[slot="product"]')) === null || _a === void 0 ? void 0 : _a.innerHTML) || this.getDefaultProductSlot();
210
- salla.event.on('search::show', () => this.modal.show());
211
- salla.event.on('languages::translations.loaded', () => {
212
- this.placeholder = salla.lang.get('blocks.header.search_placeholder');
213
- this.noResultsText = salla.lang.get('common.elements.no_options');
214
- });
215
- }
216
- onModalOpen() {
217
- this.modal.querySelector('.s-search-input').focus();
218
- }
219
- onModalClose() {
220
- this.modal.querySelector('.s-search-input').value = '';
221
- this.results = undefined;
222
- this.afterSearching();
223
- }
224
- getDefaultProductSlot() {
225
- return '<div class="s-search-product-image-container">' +
226
- ' <img class="s-search-product-image" src="{image}" alt="{name}"/>' +
227
- '</div>' +
228
- '<div class="s-search-product-details">' +
229
- ' <div class="s-search-product-title">{name}</div> <div class="s-search-product-price">{price}</div>' +
230
- '</div>';
231
- }
232
- //todo:: reset data when closing
233
- search(e) {
234
- Helper.hideElement(this.noResults);
235
- if (e.target.value.length === 0) {
236
- this.results = undefined;
237
- this.afterSearching();
238
- return;
239
- }
240
- if (e.target.value.length <= 2) {
241
- return;
242
- }
243
- //run loading spinner or stop it
244
- Helper.toggleElement(this.searchIcon, 's-search-spinner-loader', 'sicon-search', () => true);
245
- salla.search.api.search(e.target.value)
246
- .then(response => this.results = response)
247
- .catch(err => err !== 'Query Same As Previous!' ? this.results = undefined : null)
248
- .finally(() => this.afterSearching(/*isEmpty*/ false));
249
- }
250
- afterSearching(isEmpty = true) {
251
- var _a;
252
- this.noResults.style.display = isEmpty || ((_a = this.results) === null || _a === void 0 ? void 0 : _a.data.length) > 0 ? 'none' : 'block';
253
- Helper.toggleElement(this.container, 's-search-container-open', 'no-results', () => { var _a; return (_a = this.results) === null || _a === void 0 ? void 0 : _a.data.length; })
254
- .toggleElement(this.searchIcon, 's-search-spinner-loader', 'sicon-search', () => false); //stop searching anime
255
- salla.search.api.previousQuery = ''; //avoid having error 'Query Same As Previous' after reopen modal;
256
- }
257
- render() {
258
- var _a;
259
- return (h("salla-modal", { position: "top", id: "s-search-modal", ref: modal => this.modal = modal }, h("div", { class: "s-search-container", ref: container => this.container = container }, h("input", { class: "s-search-input", type: "text", placeholder: this.placeholder, onInput: e => this.search(e) }), h("span", { class: "s-search-icon" }, h("i", { class: "sicon-search", ref: el => this.searchIcon = el })), h("div", { class: "s-search-results" }, (_a = this.results) === null || _a === void 0 ? void 0 :
260
- _a.data.map(item => h("a", { href: item.url, class: "s-search-product", innerHTML: this.productSlot
261
- .replace(/\{name\}/g, item.name)
262
- .replace(/\{price\}/g, item.price) //todo:: get discounted price too
263
- .replace(/\{image\}/g, item.image_url) })), h("p", { ref: el => this.noResults = el, class: "s-search-no-results" }, this.noResultsText)))));
264
- }
265
- /**
266
- * Run it one time after load
267
- */
268
- componentDidLoad() {
269
- this.afterSearching();
270
- }
271
- get host() { return getElement(this); }
272
- };
273
- SallaSearch.style = sallaSearchCss;
274
-
275
- export { SallaLogin as S, SallaSearch as a };
202
+ export { SallaLoginModal as S };
@@ -0,0 +1,3 @@
1
+ export { S as salla_login_modal } from './salla-login-modal-187c1f98.js';
2
+ import './index-8b97d225.js';
3
+ import './Helper-7162a06c.js';
@@ -0,0 +1,150 @@
1
+ import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './index-8b97d225.js';
2
+ import { H as Helper } from './Helper-7162a06c.js';
3
+ export { S as salla_search } from './salla-search-2e3e60cb.js';
4
+
5
+ const sallaModalCss = "";
6
+
7
+ const SallaModal = class {
8
+ constructor(hostRef) {
9
+ registerInstance(this, hostRef);
10
+ this.modalOpened = createEvent(this, "modalOpened", 7);
11
+ this.modalClosed = createEvent(this, "modalClosed", 7);
12
+ this.isClosable = true; //todo::rename unclude
13
+ /**
14
+ * The size of the modal
15
+ */
16
+ this.width = 'md';
17
+ /**
18
+ * The position of the modal
19
+ */
20
+ this.position = 'middle';
21
+ /**
22
+ * Show the modal on rendering
23
+ */
24
+ this.visible = false;
25
+ /**
26
+ * Show loading in the middle
27
+ */
28
+ this.isLoading = false;
29
+ this.subTitleFirst = false; //todo:: choose better name
30
+ this.noPadding = false; //todo:: choose better name
31
+ this.subTitle = '';
32
+ /**
33
+ * Icon css class, default for types `error` is `sicon-alert-engine`, `success` is `sicon-check-circle2`
34
+ */
35
+ this.icon = '';
36
+ this.iconStyle = '';
37
+ /**
38
+ * url of an image
39
+ */
40
+ this.imageIcon = '';
41
+ Helper.setHost(this.host);
42
+ salla.event.on('modal::open', btn => btn.dataset.target == this.host.id && this.show());
43
+ salla.event.on('modal::close', btn => btn.dataset.target == this.host.id && this.hide());
44
+ this.title = this.host.title;
45
+ this.host.removeAttribute('title');
46
+ }
47
+ handleVisible(newValue) {
48
+ if (!newValue) {
49
+ this.toggleModal(false);
50
+ this.modalClosed.emit();
51
+ return;
52
+ }
53
+ this.host.classList.remove('s-hidden');
54
+ setTimeout(() => this.toggleModal(true)); //small amont of time to running toggle After adding hidden
55
+ this.modalOpened.emit();
56
+ }
57
+ /**
58
+ * Show the modal
59
+ */
60
+ async show() {
61
+ this.host.setAttribute('visible', '');
62
+ return this.host;
63
+ }
64
+ /**
65
+ * hide the modal
66
+ */
67
+ async hide() {
68
+ this.host.removeAttribute('visible');
69
+ return this.host;
70
+ }
71
+ /**
72
+ * Change the title
73
+ * @param {string} title
74
+ */
75
+ async setTitle(title) {
76
+ this.title = title;
77
+ return this.host;
78
+ }
79
+ /**
80
+ * Start loading
81
+ */
82
+ async loading() {
83
+ this.isLoading = true;
84
+ return this.host;
85
+ }
86
+ /**
87
+ * Stop the loading
88
+ */
89
+ async stopLoading() {
90
+ this.isLoading = false;
91
+ return this.host;
92
+ }
93
+ toggleModal(isOpen) {
94
+ const body = this.host.querySelector('.s-modal-body');
95
+ Helper.toggleElement(body, 's-modal-entering', 's-modal-leaving', () => isOpen)
96
+ .toggleElement(this.overlay, 's-modal-entering', 's-modal-overlay-leaving', () => isOpen)
97
+ //todo:: use united class names
98
+ .toggleElement(document.body, 'modal-is-open', 'modal-is-closed', () => isOpen);
99
+ if (!isOpen) {
100
+ setTimeout(() => this.host.classList.add('s-hidden'), 350);
101
+ }
102
+ }
103
+ closeModal() {
104
+ if (!this.isClosable) {
105
+ return;
106
+ }
107
+ this.host.removeAttribute('visible');
108
+ }
109
+ iconBlockClasses() {
110
+ return {
111
+ 's-modal-icon': true,
112
+ 's-modal-bg-error': this.iconStyle == 'error',
113
+ 's-modal-bg-success': this.iconStyle == 'success',
114
+ 's-modal-bg-normal': this.iconStyle != 'error' && this.iconStyle != 'success',
115
+ 's-modal-bg-primary': this.iconStyle == 'primary'
116
+ };
117
+ }
118
+ iconClasses() {
119
+ return {
120
+ [this.icon]: true,
121
+ 'sicon-alert-engine': !this.icon && this.iconStyle == 'error' && !this.imageIcon,
122
+ 'sicon-check-circle2': !this.icon && this.iconStyle == 'success' && !this.imageIcon,
123
+ };
124
+ }
125
+ //todo:: pref for each modal
126
+ render() {
127
+ this.host.id = this.host.id || 'salla-modal';
128
+ return (h(Host, { class: 'salla-modal s-modal-container s-hidden', "aria-modal": "true", role: "dialog" }, h("div", { class: "s-modal-overlay", ref: el => this.overlay = el, onClick: () => this.closeModal() }), h("div", { class: "s-modal-wrapper" }, h("span", { class: 's-modal-spacer s-modal-align-' + this.position }, "\u200B"), h("div", { class: 's-modal-body ' + 's-modal-align-' + this.position + ' s-modal-' + this.width + (this.noPadding ? ' s-modal-nopadding' : ' s-modal-padding') }, this.isLoading ?
129
+ h("div", { class: "s-modal-loader-wrap" }, h("span", { class: "s-modal-loader" }))
130
+ :
131
+ [
132
+ h("div", { class: { 's-modal-header': true, 's-modal-is-center': this.icon != '' || this.imageIcon != '' } }, this.isClosable ?
133
+ h("button", { class: "s-modal-close", onClick: () => this.closeModal(), type: "button" }, h("span", { class: "sicon-cancel" }))
134
+ : '', this.title || this.subTitle ?
135
+ h("div", { class: "s-modal-header-inner" }, this.iconStyle || this.icon
136
+ ? h("div", { class: this.iconBlockClasses() }, h("i", { class: this.iconClasses() }))
137
+ : this.imageIcon ? h("img", { class: "s-modal-header-img", src: this.imageIcon }) : '', h("div", { class: "s-modal-header-content" }, h("div", { class: { 's-modal-title': true, 's-modal-title-below': this.subTitleFirst }, innerHTML: this.title }), h("p", { class: { 's-modal-sub-title': true }, innerHTML: this.subTitle })))
138
+ : ''),
139
+ h("slot", null),
140
+ h("slot", { name: "footer" })
141
+ ]))));
142
+ }
143
+ get host() { return getElement(this); }
144
+ static get watchers() { return {
145
+ "visible": ["handleVisible"]
146
+ }; }
147
+ };
148
+ SallaModal.style = sallaModalCss;
149
+
150
+ export { SallaModal as salla_modal };
@@ -1,9 +1,9 @@
1
1
  import { r as registerInstance, h, g as getElement } from './index-8b97d225.js';
2
2
  import { H as Helper } from './Helper-7162a06c.js';
3
3
 
4
- const sallaOfferCss = "#salla-offer-modal .s-offer-body{-webkit-overflow-scrolling:touch}#salla-offer-modal .s-offer-body::-webkit-scrollbar{display:none}#salla-offer-modal .s-offer-next-btn{background:linear-gradient(90deg, #fff 25%, rgba(255, 255, 255, 0.4) 80%, rgba(255, 255, 255, 0) 100%)}#salla-offer-modal .s-offer-prev-btn{background:linear-gradient(-90deg, #fff 25%, rgba(255, 255, 255, 0.4) 80%, rgba(255, 255, 255, 0) 100%)}";
4
+ const sallaOfferModalCss = "#salla-offer-modal .s-offer-modal-body{-webkit-overflow-scrolling:touch}#salla-offer-modal .s-offer-modal-body::-webkit-scrollbar{display:none}#salla-offer-modal .s-offer-modal-next-btn{background:linear-gradient(90deg, #fff 25%, rgba(255, 255, 255, 0.4) 80%, rgba(255, 255, 255, 0) 100%)}#salla-offer-modal .s-offer-modal-prev-btn{background:linear-gradient(-90deg, #fff 25%, rgba(255, 255, 255, 0.4) 80%, rgba(255, 255, 255, 0) 100%)}";
5
5
 
6
- const SallaOffer = class {
6
+ const SallaOfferModal = class {
7
7
  constructor(hostRef) {
8
8
  registerInstance(this, hostRef);
9
9
  var _a, _b;
@@ -15,7 +15,7 @@ const SallaOffer = class {
15
15
  this.offer_expires_in = salla.lang.get('pages.products.offer_expires_in');
16
16
  this.remember_my_choice = salla.lang.get('common.remember_my_choice');
17
17
  });
18
- this.categorySlot = ((_a = Helper.getElement('[slot="category"]')) === null || _a === void 0 ? void 0 : _a.innerHTML) || '<i class="s-offer-badge-icon sicon-tag"></i><span class="s-offer-badge-text">{name}</span>';
18
+ this.categorySlot = ((_a = Helper.getElement('[slot="category"]')) === null || _a === void 0 ? void 0 : _a.innerHTML) || '<i class="s-offer-modal-badge-icon sicon-tag"></i><span class="s-offer-modal-badge-text">{name}</span>';
19
19
  this.productSlot = ((_b = Helper.getElement('[slot="product"]')) === null || _b === void 0 ? void 0 : _b.innerHTML) || this.defaultProductSlot();
20
20
  salla.offer.event.onExisted(data => {
21
21
  //TODO:: use the best, should we hide the offer by product Id or Offer id🤔
@@ -56,29 +56,29 @@ const SallaOffer = class {
56
56
  .finally(() => this['stop']());
57
57
  }
58
58
  defaultProductSlot() {
59
- return '<a href={url} class="s-offer-product-image-wrap"><img class="s-offer-product-image" src="{image}" /></a>' +
60
- '<div class="s-offer-product-info">' +
61
- ' <a href={url} class="s-offer-product-name">{name}</a>' +
62
- ' <div class="s-offer-product-price">{price}</div>' +
59
+ return '<a href={url} class="s-offer-modal-product-image-wrap"><img class="s-offer-modal-product-image" src="{image}" /></a>' +
60
+ '<div class="s-offer-modal-product-info">' +
61
+ ' <a href={url} class="s-offer-modal-product-name">{name}</a>' +
62
+ ' <div class="s-offer-modal-product-price">{price}</div>' +
63
63
  '</div>';
64
64
  }
65
65
  render() {
66
66
  var _a, _b;
67
67
  return h("salla-modal", { id: "salla-offer-modal", "sub-title-first": true, icon: "sicon-special-discount", title: "\u0639\u0631\u0648\u0636 \u0631\u0627\u0626\u0639\u0629 \u0641\u064A \u0627\u0646\u062A\u0638\u0627\u0631\u0643\u060C \u0645\u0627\u0630\u0627 \u0646\u062A\u0646\u0638\u0631!", "sub-title": this.offer_message, ref: modal => this.modal = modal, "is-loading": this.offer === null }, this.offer !== null
68
- ? [h("div", { class: "s-offer-scrolled-slider-wrap" }, h("div", { class: "s-offer-body s-offer-scrolled-slider" }, ((_a = this.offer.get.categories) === null || _a === void 0 ? void 0 : _a.length) > 0
69
- ? this.offer.get.categories.map(category => h("a", { href: category.urls.customer, class: "s-offer-badge s-offer-slider-item", innerHTML: this.categorySlot
68
+ ? [h("div", { class: "s-offer-modal-scrolled-slider-wrap" }, h("div", { class: "s-offer-modal-body s-offer-modal-scrolled-slider" }, ((_a = this.offer.get.categories) === null || _a === void 0 ? void 0 : _a.length) > 0
69
+ ? this.offer.get.categories.map(category => h("a", { href: category.urls.customer, class: "s-offer-modal-badge s-offer-modal-slider-item", innerHTML: this.categorySlot
70
70
  .replace(/\{name\}/g, category.name)
71
71
  .replace(/\{url\}/g, category.urls.customer) }))
72
- : (_b = this.offer.get.products) === null || _b === void 0 ? void 0 : _b.map(product => h("div", { class: "s-offer-product s-offer-slider-item", id: 'product_' + product.id, innerHTML: this.productSlot
72
+ : (_b = this.offer.get.products) === null || _b === void 0 ? void 0 : _b.map(product => h("div", { class: "s-offer-modal-product s-offer-modal-slider-item", id: 'product_' + product.id, innerHTML: this.productSlot
73
73
  .replace(/\{name\}/g, product.name)
74
74
  .replace(/\{url\}/g, product.url)
75
75
  .replace(/\{image\}/g, product.thumbnail)
76
76
  .replace(/\{price\}/g, product.has_special_price
77
- ? salla.money(product.price) + '<span class="s-offer-product-old-price">' + salla.money(product.regular_price) + '</span>'
78
- : salla.money(product.price)) }, h("div", { class: "s-offer-btn-wrap" }, h("salla-button", { wide: true, "btn-style": 'outline-primary', "data-id": product.id, "loader-position": "center", onClick: this.addItem }, salla.lang.get('pages.cart.add_to_cart')))))), h("div", { class: "s-offer-slider-nav" }, h("button", { class: "s-offer-nav-btn s-offer-prev-btn" }, h("span", { class: "s-offer-nav-btn-icon sicon-keyboard_arrow_right" })), h("button", { class: "s-offer-nav-btn s-offer-next-btn" }, h("span", { class: "s-offer-nav-btn-icon sicon-keyboard_arrow_left" })))),
79
- h("div", { class: "s-offer-footer", slot: "footer" }, this.offer.expiry_date ?
80
- h("p", { class: "s-offer-expiry" }, this.offer_expires_in, " ", this.offer.expiry_date)
81
- : '', h("label", { class: "s-offer-remember-label" }, h("input", { type: "checkbox", onChange: e => this.rememberMe(e), class: "s-offer-remember-input" }), "\u00A0 ", this.remember_my_choice)),
77
+ ? salla.money(product.price) + '<span class="s-offer-modal-product-old-price">' + salla.money(product.regular_price) + '</span>'
78
+ : salla.money(product.price)) }, h("div", { class: "s-offer-modal-btn-wrap" }, h("salla-button", { wide: true, "btn-style": 'outline-primary', "data-id": product.id, "loader-position": "center", onClick: this.addItem }, salla.lang.get('pages.cart.add_to_cart')))))), h("div", { class: "s-offer-modal-slider-nav" }, h("button", { class: "s-offer-modal-nav-btn s-offer-modal-prev-btn" }, h("span", { class: "s-offer-modal-nav-btn-icon sicon-keyboard_arrow_right" })), h("button", { class: "s-offer-modal-nav-btn s-offer-modal-next-btn" }, h("span", { class: "s-offer-modal-nav-btn-icon sicon-keyboard_arrow_left" })))),
79
+ h("div", { class: "s-offer-modal-footer", slot: "footer" }, this.offer.expiry_date ?
80
+ h("p", { class: "s-offer-modal-expiry" }, this.offer_expires_in, " ", this.offer.expiry_date)
81
+ : '', h("label", { class: "s-offer-modal-remember-label" }, h("input", { type: "checkbox", onChange: e => this.rememberMe(e), class: "s-offer-modal-remember-input" }), "\u00A0 ", this.remember_my_choice)),
82
82
  ] : '');
83
83
  }
84
84
  componentDidRender() {
@@ -87,11 +87,11 @@ const SallaOffer = class {
87
87
  this.modal.querySelectorAll('[hidden]').forEach(el => el.removeAttribute('hidden'));
88
88
  // Sooo mini Slider
89
89
  if (this.offer && window.screen.width > 639) {
90
- let sliderWrap = this.host.querySelector('.s-offer-scrolled-slider-wrap'), slider = this.host.querySelector('.s-offer-scrolled-slider'), navButtons = this.host.querySelectorAll('.s-offer-nav-btn'), nexBtn = this.host.querySelector('.s-offer-next-btn'), prevBtn = this.host.querySelector('.s-offer-prev-btn'), items = this.host.querySelectorAll('.s-offer-slider-item'), sliderNavMargin = 20, // space before displaying the next/prev btns.
90
+ let sliderWrap = this.host.querySelector('.s-offer-modal-scrolled-slider-wrap'), slider = this.host.querySelector('.s-offer-modal-scrolled-slider'), navButtons = this.host.querySelectorAll('.s-offer-modal-nav-btn'), nexBtn = this.host.querySelector('.s-offer-modal-next-btn'), prevBtn = this.host.querySelector('.s-offer-modal-prev-btn'), items = this.host.querySelectorAll('.s-offer-modal-slider-item'), sliderNavMargin = 20, // space before displaying the next/prev btns.
91
91
  current = 0, // current slide
92
92
  slidesToScroll = 3, itemsLength = items.length, itemSize = items[0].offsetWidth, sliderSize = itemsLength * itemSize, sliderWrapperSize = sliderWrap.offsetWidth, sliderInvisibleSize = sliderSize - sliderWrapperSize, isRTL = document.body.classList.contains('rtl') ? true : false;
93
93
  if (sliderInvisibleSize > sliderNavMargin)
94
- nexBtn.classList.add('s-offer-btn-is-active');
94
+ nexBtn.classList.add('s-offer-modal-btn-is-active');
95
95
  window.onresize = function () {
96
96
  sliderWrapperSize = sliderWrap.offsetWidth;
97
97
  sliderInvisibleSize = sliderSize - sliderWrapperSize;
@@ -101,23 +101,23 @@ const SallaOffer = class {
101
101
  let sliderEndOffset = sliderInvisibleSize - sliderNavMargin;
102
102
  // show & hide the navigation btns depending on scroll position
103
103
  if (sliderPosition <= sliderNavMargin) {
104
- nexBtn.classList.add('s-offer-btn-is-active');
105
- prevBtn.classList.remove('s-offer-btn-is-active');
104
+ nexBtn.classList.add('s-offer-modal-btn-is-active');
105
+ prevBtn.classList.remove('s-offer-modal-btn-is-active');
106
106
  }
107
107
  else if (sliderPosition < sliderEndOffset) {
108
108
  // show both btns in the middle
109
- nexBtn.classList.add('s-offer-btn-is-active');
110
- prevBtn.classList.add('s-offer-btn-is-active');
109
+ nexBtn.classList.add('s-offer-modal-btn-is-active');
110
+ prevBtn.classList.add('s-offer-modal-btn-is-active');
111
111
  }
112
112
  else if (sliderPosition >= sliderEndOffset) {
113
- nexBtn.classList.remove('s-offer-btn-is-active');
114
- prevBtn.classList.add('s-offer-btn-is-active');
113
+ nexBtn.classList.remove('s-offer-modal-btn-is-active');
114
+ prevBtn.classList.add('s-offer-modal-btn-is-active');
115
115
  }
116
116
  });
117
117
  // Navigation
118
118
  navButtons.forEach(btn => {
119
119
  btn.addEventListener('click', function () {
120
- btn.classList.contains('s-offer-next-btn') ? current++ : current--;
120
+ btn.classList.contains('s-offer-modal-next-btn') ? current++ : current--;
121
121
  slider.scrollTo({
122
122
  top: 0,
123
123
  left: itemSize * slidesToScroll * current * (isRTL ? -1 : 1),
@@ -129,6 +129,6 @@ const SallaOffer = class {
129
129
  }
130
130
  get host() { return getElement(this); }
131
131
  };
132
- SallaOffer.style = sallaOfferCss;
132
+ SallaOfferModal.style = sallaOfferModalCss;
133
133
 
134
- export { SallaOffer as salla_offer };
134
+ export { SallaOfferModal as salla_offer_modal };
@@ -1,9 +1,9 @@
1
1
  import { r as registerInstance, h, H as Host, g as getElement } from './index-8b97d225.js';
2
2
  import { H as Helper } from './Helper-7162a06c.js';
3
3
 
4
- const sallaRatingCss = "#s-rating .unicode{unicode-bidi:plaintext}";
4
+ const sallaRatingModalCss = "#s-rating-modal .unicode{unicode-bidi:plaintext}";
5
5
 
6
- const SallaRating = class {
6
+ const SallaRatingModal = class {
7
7
  constructor(hostRef) {
8
8
  registerInstance(this, hostRef);
9
9
  this.stepsCount = 0;
@@ -56,11 +56,11 @@ const SallaRating = class {
56
56
  initiateRating() {
57
57
  this.handleWizard();
58
58
  this.highlightSelectedStars();
59
- salla.document.event.onSubmit('.s-rating-stars-element', function (event) {
59
+ salla.document.event.onSubmit('.s-rating-modal-stars-element', function (event) {
60
60
  // Prevent form from submitting
61
61
  event.preventDefault();
62
62
  // Get the selected star - activeElement is not supported in safari
63
- let activeStars = event.target.querySelectorAll('.s-rating-btn-star.s-rating-hovered');
63
+ let activeStars = event.target.querySelectorAll('.s-rating-modal-btn-star.s-rating-modal-hovered');
64
64
  let selected = activeStars[activeStars.length - 1];
65
65
  if (!selected)
66
66
  return;
@@ -69,29 +69,29 @@ const SallaRating = class {
69
69
  // Get all stars in this form (only search in the form, not the whole document)
70
70
  // Loop through each star, and add or remove the `.selected` class to toggle highlighting
71
71
  event.target
72
- .querySelectorAll('.s-rating-btn-star')
73
- .forEach((star, index) => Helper.toggleElement(star, 's-rating-selected', 's-rating-un-selected', () => index < selectedIndex));
72
+ .querySelectorAll('.s-rating-modal-btn-star')
73
+ .forEach((star, index) => Helper.toggleElement(star, 's-rating-modal-selected', 's-rating-modal-un-selected', () => index < selectedIndex));
74
74
  // Remove aria-pressed from any previously selected star
75
- event.target.querySelectorAll('.s-rating-btn-star[aria-pressed="true"]').forEach(star => star.removeAttribute('aria-pressed'));
75
+ event.target.querySelectorAll('.s-rating-modal-btn-star[aria-pressed="true"]').forEach(star => star.removeAttribute('aria-pressed'));
76
76
  // Add aria-pressed role to the selected button
77
77
  selected.setAttribute('aria-pressed', '');
78
78
  });
79
79
  }
80
80
  // handle wizard
81
81
  handleWizard() {
82
- this.steps = this.host.querySelectorAll(".s-rating-step");
83
- this.dots = this.host.querySelectorAll(".s-rating-step-dot");
82
+ this.steps = this.host.querySelectorAll(".s-rating-modal-step");
83
+ this.dots = this.host.querySelectorAll(".s-rating-modal-step-dot");
84
84
  this.showActiveStep();
85
85
  }
86
86
  showActiveStep(current = null) {
87
87
  var _a;
88
88
  this.currentTab = current || this.steps[this.currentIndex];
89
- Helper.toggle('.s-rating-step-dot', 's-rating-bg-gray', 's-rating-bg-primary', dot => dot != this.dots[this.currentIndex])
90
- .toggle('.s-rating-step', 's-rating-active', 's-rating-hidden', tab => tab == this.currentTab);
89
+ Helper.toggle('.s-rating-modal-step-dot', 's-rating-modal-bg-gray', 's-rating-modal-bg-primary', dot => dot != this.dots[this.currentIndex])
90
+ .toggle('.s-rating-modal-step', 's-rating-modal-active', 's-rating-modal-hidden', tab => tab == this.currentTab);
91
91
  if (this.currentIndex != 0) {
92
92
  // the animation
93
- Helper.toggleElement(this.currentTab, 's-rating-unactive', 's-rating-hidden', () => true);
94
- setTimeout(() => Helper.toggleElement(this.currentTab, 's-rating-active', 's-rating-unactive', () => true), 300);
93
+ Helper.toggleElement(this.currentTab, 's-rating-modal-unactive', 's-rating-modal-hidden', () => true);
94
+ setTimeout(() => Helper.toggleElement(this.currentTab, 's-rating-modal-active', 's-rating-modal-unactive', () => true), 300);
95
95
  }
96
96
  // Btn text
97
97
  let nextType = (_a = this.steps[this.currentIndex + 1]) === null || _a === void 0 ? void 0 : _a.dataset.type;
@@ -100,9 +100,9 @@ const SallaRating = class {
100
100
  setTimeout(() => { var _a; return this.body.setAttribute('style', 'height:' + ((_a = this.currentTab) === null || _a === void 0 ? void 0 : _a.scrollHeight) + 'px'); });
101
101
  }
102
102
  highlightSelectedStars() {
103
- let hover = ['s-rating-hovered'];
104
- Helper.all('.s-rating-stars-element', el => {
105
- let starElements = el.querySelectorAll('.s-rating-btn-star');
103
+ let hover = ['s-rating-modal-hovered'];
104
+ Helper.all('.s-rating-modal-stars-element', el => {
105
+ let starElements = el.querySelectorAll('.s-rating-modal-btn-star');
106
106
  // remove hovered state from stars ---
107
107
  el.addEventListener('mouseout', () => starElements.forEach(star => star.classList.remove(...hover)));
108
108
  starElements.forEach((starElement, index) => {
@@ -123,7 +123,7 @@ const SallaRating = class {
123
123
  }
124
124
  previousTab() {
125
125
  this.currentIndex > 0 && this.currentIndex--;
126
- Helper.toggleElement(this.backBtn, 's-rating-unvisiable', 'block', () => this.currentIndex == 0);
126
+ Helper.toggleElement(this.backBtn, 's-rating-modal-unvisiable', 'block', () => this.currentIndex == 0);
127
127
  this.showActiveStep();
128
128
  }
129
129
  submit() {
@@ -131,10 +131,10 @@ const SallaRating = class {
131
131
  salla.config.canLeave = false;
132
132
  this.nextBtn.load()
133
133
  .then(() => this.submittedBefore() || this.sendFeedback())
134
- .then(() => this.currentTab.querySelectorAll('[name],.s-rating-btn-star').forEach(el => el.setAttribute('disabled', '')))
134
+ .then(() => this.currentTab.querySelectorAll('[name],.s-rating-modal-btn-star').forEach(el => el.setAttribute('disabled', '')))
135
135
  .then(() => this.currentIndex < this.stepsCount && this.currentIndex++)
136
136
  .then(() => this.showActiveStep())
137
- .then(() => Helper.toggle('#prev-btn', 'block', 's-rating-unvisiable', () => true))
137
+ .then(() => Helper.toggle('#prev-btn', 'block', 's-rating-modal-unvisiable', () => true))
138
138
  .finally(() => {
139
139
  this.nextBtn.stop();
140
140
  salla.config.canLeave = true;
@@ -151,8 +151,8 @@ const SallaRating = class {
151
151
  }
152
152
  rating = rating || this.currentTab;
153
153
  let stars = rating.querySelector('.rating_hidden_input').value;
154
- let comment = rating.querySelector('.s-rating-comment');
155
- let validationMessage = rating.querySelector('.s-rating-validation-msg');
154
+ let comment = rating.querySelector('.s-rating-modal-comment');
155
+ let validationMessage = rating.querySelector('.s-rating-modal-validation-msg');
156
156
  if (stars && comment.value && comment.value.length > 3) {
157
157
  comment.classList.remove('s-has-error');
158
158
  validationMessage.innerHTML = '';
@@ -190,25 +190,25 @@ const SallaRating = class {
190
190
  this.thanksTime.remove();
191
191
  this.hide().then(() => window.location.reload());
192
192
  }, 1000);
193
- this.host.querySelector('.s-rating-footer').classList.add('s-rating-unvisiable');
193
+ this.host.querySelector('.s-rating-modal-footer').classList.add('s-rating-modal-unvisiable');
194
194
  this.showActiveStep(this.thanksTab);
195
195
  }
196
196
  renderRatingStars(size, name = 'rating') {
197
- return (h("form", { class: "s-rating-stars-element" }, h("input", { type: "hidden", class: "rating_hidden_input", name: name, value: "" }), [1, 2, 3, 4, 5].map(star => h("button", { type: "submit", class: `s-rating-btn-star s-rating-btn-star-` + size, "data-star": star }, h("i", { class: "sicon-star2" })))));
197
+ return (h("form", { class: "s-rating-modal-stars-element" }, h("input", { type: "hidden", class: "rating_hidden_input", name: name, value: "" }), [1, 2, 3, 4, 5].map(star => h("button", { type: "submit", class: `s-rating-modal-btn-star s-rating-modal-btn-star-` + size, "data-star": star }, h("i", { class: "sicon-star2" })))));
198
198
  }
199
199
  // render
200
200
  render() {
201
201
  return (h(Host, { id: "s-rating" }, h("salla-modal", { isLoading: true, width: "md", ref: modal => this.modal = modal }, this.order
202
- ? [h("div", { class: "s-rating-wrapper", ref: el => this.body = el }, this.order.testimonials_enabled ?
203
- h("div", { class: "rating-outer-form s-rating-step-wrap s-rating-step s-rating-hidden", "data-type": "store" }, h("div", { class: "s-rating-rounded-icon" }, h("img", { src: salla.config.get('store.logo', 'https://assets.salla.sa/cp/assets/images/logo-new.png'), alt: "store name", class: "s-rating-store-logo" })), h("h2", { class: "s-rating-title" }, this.rate_the_store), h("div", { class: "s-rating-stars-company" }, " ", this.renderRatingStars('large')), h("textarea", { id: "storeReview", name: "comment", class: "s-rating-comment", placeholder: this.write_store_rate }), h("small", { class: "s-rating-validation-msg" }))
202
+ ? [h("div", { class: "s-rating-modal-wrapper", ref: el => this.body = el }, this.order.testimonials_enabled ?
203
+ h("div", { class: "rating-outer-form s-rating-modal-step-wrap s-rating-modal-step s-rating-modal-hidden", "data-type": "store" }, h("div", { class: "s-rating-modal-rounded-icon" }, h("img", { src: salla.config.get('store.logo', 'https://assets.salla.sa/cp/assets/images/logo-new.png'), alt: "store name", class: "s-rating-modal-store-logo" })), h("h2", { class: "s-rating-modal-title" }, this.rate_the_store), h("div", { class: "s-rating-modal-stars-company" }, " ", this.renderRatingStars('large')), h("textarea", { id: "storeReview", name: "comment", class: "s-rating-modal-comment", placeholder: this.write_store_rate }), h("small", { class: "s-rating-modal-validation-msg" }))
204
204
  : '', this.order.products_enabled
205
- ? 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": this.rate_product_stars }, h("img", { src: item.product.thumbnail, alt: item.product.name, class: "s-rating-product-img" }), h("div", { class: "s-rating-product-details" }, h("h3", { class: "s-rating-product-title" }, " ", item.product.name), h("div", { class: "s-rating-stars-product" }, " ", this.renderRatingStars('small', `products[${index}][rating]`)), h("input", { type: "hidden", name: `products[${index}][product_id]`, value: item.product.id }), h("textarea", { placeholder: this.write_product_rate, name: `products[${index}][comment]`, class: "s-rating-comment" }), h("small", { class: "s-rating-validation-msg" })))))
205
+ ? h("section", { class: "s-rating-modal-step s-rating-modal-hidden", "data-type": "products" }, this.order.products.map((item, index) => h("div", { class: "rating-outer-form s-rating-modal-product", "data-stars-error": this.rate_product_stars }, h("img", { src: item.product.thumbnail, alt: item.product.name, class: "s-rating-modal-product-img" }), h("div", { class: "s-rating-modal-product-details" }, h("h3", { class: "s-rating-modal-product-title" }, " ", item.product.name), h("div", { class: "s-rating-modal-stars-product" }, " ", this.renderRatingStars('small', `products[${index}][rating]`)), h("input", { type: "hidden", name: `products[${index}][product_id]`, value: item.product.id }), h("textarea", { placeholder: this.write_product_rate, name: `products[${index}][comment]`, class: "s-rating-modal-comment" }), h("small", { class: "s-rating-modal-validation-msg" })))))
206
206
  : '', this.order.shipping_enabled
207
- ? h("div", { class: "rating-outer-form s-rating-step-wrap s-rating-step s-rating-hidden", "data-type": "shipping" }, h("input", { type: "hidden", name: "shipping_company_id", value: this.order.shipping.company.id }), this.order.shipping.company.logo
208
- ? h("div", { class: "s-rating-rounded-icon" }, h("img", { src: this.order.shipping.company.logo, class: "s-rating-shipping-logo", alt: this.order.shipping.company.name }))
209
- : h("span", { class: "s-rating-icon sicon-shipping-fast" }), h("div", { class: "s-rating-title" }, " ", this.rate_shipping + ' ' + this.order.shipping.company.name), h("div", { class: "s-rating-stars-company" }, this.renderRatingStars('large')), h("textarea", { name: "comment", class: "s-rating-comment", placeholder: this.write_shipping_rate }), h("small", { class: "s-rating-validation-msg" }))
210
- : '', h("div", { class: "s-rating-thanks s-rating-hidden", ref: el => this.thanksTab = el }, h("span", { class: "s-rating-icon sicon-check-circle2" }), h("h3", { class: "s-rating-thanks-title" }, this.thanks), h("div", { class: "s-rating-thanks-msg", innerHTML: this.order.thanks_message }), h("time", { class: "s-rating-thanks-time", ref: el => this.thanksTime = el }))),
211
- h("div", { class: "s-rating-footer" }, h("button", { ref: el => this.backBtn = el, onClick: () => this.previousTab(), class: "s-rating-btn s-rating-unvisiable" }, this.back), 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' }))) : '', h("salla-button", { "loader-position": 'center', ref: el => this.nextBtn = el, onClick: () => this.submit() }, this.next)),]
207
+ ? h("div", { class: "rating-outer-form s-rating-modal-step-wrap s-rating-modal-step s-rating-modal-hidden", "data-type": "shipping" }, h("input", { type: "hidden", name: "shipping_company_id", value: this.order.shipping.company.id }), this.order.shipping.company.logo
208
+ ? h("div", { class: "s-rating-modal-rounded-icon" }, h("img", { src: this.order.shipping.company.logo, class: "s-rating-modal-shipping-logo", alt: this.order.shipping.company.name }))
209
+ : h("span", { class: "s-rating-modal-icon sicon-shipping-fast" }), h("div", { class: "s-rating-modal-title" }, " ", this.rate_shipping + ' ' + this.order.shipping.company.name), h("div", { class: "s-rating-modal-stars-company" }, this.renderRatingStars('large')), h("textarea", { name: "comment", class: "s-rating-modal-comment", placeholder: this.write_shipping_rate }), h("small", { class: "s-rating-modal-validation-msg" }))
210
+ : '', h("div", { class: "s-rating-modal-thanks s-rating-modal-hidden", ref: el => this.thanksTab = el }, h("span", { class: "s-rating-modal-icon sicon-check-circle2" }), h("h3", { class: "s-rating-modal-thanks-title" }, this.thanks), h("div", { class: "s-rating-modal-thanks-msg", innerHTML: this.order.thanks_message }), h("time", { class: "s-rating-modal-thanks-time", ref: el => this.thanksTime = el }))),
211
+ h("div", { class: "s-rating-modal-footer" }, h("button", { ref: el => this.backBtn = el, onClick: () => this.previousTab(), class: "s-rating-modal-btn s-rating-modal-unvisiable" }, this.back), this.stepsCount > 1 ? h("ul", { class: "s-rating-modal-dots" }, [0, 1, 2].slice(0, this.stepsCount).map(() => h("li", { class: 's-rating-modal-bg-gray s-rating-modal-step-dot' }))) : '', h("salla-button", { "loader-position": 'center', ref: el => this.nextBtn = el, onClick: () => this.submit() }, this.next)),]
212
212
  : '')));
213
213
  }
214
214
  componentDidRender() {
@@ -220,6 +220,6 @@ const SallaRating = class {
220
220
  }
221
221
  get host() { return getElement(this); }
222
222
  };
223
- SallaRating.style = sallaRatingCss;
223
+ SallaRatingModal.style = sallaRatingModalCss;
224
224
 
225
- export { SallaRating as salla_rating };
225
+ export { SallaRatingModal as salla_rating_modal };