@salla.sa/twilight-components 1.0.74 → 1.0.76

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 (86) hide show
  1. package/dist/cjs/loader.cjs.js +1 -1
  2. package/dist/cjs/salla-add-product-button_6.cjs.entry.js +40 -37
  3. package/dist/cjs/salla-branches.cjs.entry.js +3 -3
  4. package/dist/cjs/salla-infinite-scroll.cjs.entry.js +6 -10
  5. package/dist/cjs/salla-installment.cjs.entry.js +1 -1
  6. package/dist/cjs/salla-localization-modal.cjs.entry.js +8 -8
  7. package/dist/cjs/salla-login-modal.cjs.entry.js +10 -10
  8. package/dist/cjs/salla-offer-modal.cjs.entry.js +4 -4
  9. package/dist/cjs/salla-rating-modal.cjs.entry.js +7 -7
  10. package/dist/cjs/salla-verify-modal.cjs.entry.js +25 -19
  11. package/dist/cjs/twilight-components.cjs.js +1 -1
  12. package/dist/collection/components/salla-add-product-button/salla-add-product-button.css +4 -0
  13. package/dist/collection/components/salla-add-product-button/salla-add-product-button.js +13 -17
  14. package/dist/collection/components/salla-branches/salla-branches.js +3 -3
  15. package/dist/collection/components/salla-button/salla-button.js +7 -5
  16. package/dist/collection/components/salla-infinite-scroll/salla-infinite-scroll.js +10 -14
  17. package/dist/collection/components/salla-installment/salla-installment.css +9 -1
  18. package/dist/collection/components/salla-localization-modal/salla-localization-modal.js +11 -11
  19. package/dist/collection/components/salla-login-modal/salla-login-modal.js +12 -12
  20. package/dist/collection/components/salla-modal/salla-modal.js +12 -12
  21. package/dist/collection/components/salla-offer-modal/salla-offer-modal.js +5 -5
  22. package/dist/collection/components/salla-product-availability/salla-product-availability.js +7 -8
  23. package/dist/collection/components/salla-rating-modal/salla-rating-modal.js +9 -9
  24. package/dist/collection/components/salla-search/salla-search.js +2 -2
  25. package/dist/collection/components/salla-tel-input/salla-tel-input.js +29 -7
  26. package/dist/collection/components/salla-verify-modal/salla-verify-modal.js +29 -39
  27. package/dist/components/salla-add-product-button.js +13 -16
  28. package/dist/components/salla-branches.js +3 -3
  29. package/dist/components/salla-button2.js +4 -1
  30. package/dist/components/salla-infinite-scroll.js +7 -11
  31. package/dist/components/salla-installment.js +1 -1
  32. package/dist/components/salla-localization-modal.js +10 -10
  33. package/dist/components/salla-login-modal.js +11 -11
  34. package/dist/components/salla-modal2.js +9 -9
  35. package/dist/components/salla-offer-modal.js +5 -5
  36. package/dist/components/salla-product-availability2.js +7 -8
  37. package/dist/components/salla-rating-modal.js +9 -9
  38. package/dist/components/salla-search.js +2 -2
  39. package/dist/components/salla-tel-input2.js +9 -4
  40. package/dist/components/salla-verify-modal2.js +27 -21
  41. package/dist/esm/loader.js +1 -1
  42. package/dist/esm/salla-add-product-button_6.entry.js +40 -37
  43. package/dist/esm/salla-branches.entry.js +3 -3
  44. package/dist/esm/salla-infinite-scroll.entry.js +6 -10
  45. package/dist/esm/salla-installment.entry.js +1 -1
  46. package/dist/esm/salla-localization-modal.entry.js +8 -8
  47. package/dist/esm/salla-login-modal.entry.js +10 -10
  48. package/dist/esm/salla-offer-modal.entry.js +4 -4
  49. package/dist/esm/salla-rating-modal.entry.js +7 -7
  50. package/dist/esm/salla-verify-modal.entry.js +25 -19
  51. package/dist/esm/twilight-components.js +1 -1
  52. package/dist/twilight-components/p-05c60bb8.entry.js +4 -0
  53. package/dist/twilight-components/p-0ed349dd.entry.js +4 -0
  54. package/dist/twilight-components/p-34abe2be.entry.js +4 -0
  55. package/dist/twilight-components/p-4f37512b.entry.js +4 -0
  56. package/dist/twilight-components/p-8d60c7c0.entry.js +4 -0
  57. package/dist/twilight-components/p-ca52e3ed.entry.js +4 -0
  58. package/dist/twilight-components/p-d0b5970c.entry.js +4 -0
  59. package/dist/twilight-components/p-d82b45e3.entry.js +4 -0
  60. package/dist/twilight-components/p-f61388fb.entry.js +4 -0
  61. package/dist/twilight-components/twilight-components.esm.js +1 -1
  62. package/dist/types/components/salla-add-product-button/salla-add-product-button.d.ts +5 -5
  63. package/dist/types/components/salla-button/salla-button.d.ts +1 -0
  64. package/dist/types/components/salla-infinite-scroll/salla-infinite-scroll.d.ts +1 -2
  65. package/dist/types/components/salla-localization-modal/salla-localization-modal.d.ts +3 -3
  66. package/dist/types/components/salla-login-modal/salla-login-modal.d.ts +2 -2
  67. package/dist/types/components/salla-modal/salla-modal.d.ts +5 -5
  68. package/dist/types/components/salla-offer-modal/salla-offer-modal.d.ts +1 -1
  69. package/dist/types/components/salla-rating-modal/salla-rating-modal.d.ts +2 -2
  70. package/dist/types/components/salla-tel-input/salla-tel-input.d.ts +6 -2
  71. package/dist/types/components/salla-verify-modal/salla-verify-modal.d.ts +7 -7
  72. package/dist/types/components.d.ts +42 -42
  73. package/example/dist/demo.js +11 -2
  74. package/example/dist/tailwind.css +83 -38
  75. package/example/index.html +120 -29
  76. package/example/infinit-scroll.html +5 -5
  77. package/package.json +1 -1
  78. package/dist/twilight-components/p-0cd25a03.entry.js +0 -4
  79. package/dist/twilight-components/p-20a8492d.entry.js +0 -4
  80. package/dist/twilight-components/p-35b0d8f6.entry.js +0 -4
  81. package/dist/twilight-components/p-50502ca8.entry.js +0 -4
  82. package/dist/twilight-components/p-69b8ebc1.entry.js +0 -4
  83. package/dist/twilight-components/p-94d96cef.entry.js +0 -4
  84. package/dist/twilight-components/p-a6a4a2bd.entry.js +0 -4
  85. package/dist/twilight-components/p-f8e1ea72.entry.js +0 -4
  86. package/dist/twilight-components/p-fa55e3ea.entry.js +0 -4
@@ -17,7 +17,7 @@ const patchEsm = () => {
17
17
  const defineCustomElements = (win, options) => {
18
18
  if (typeof window === 'undefined') return Promise.resolve();
19
19
  return patchEsm().then(() => {
20
- return index.bootstrapLazy([["salla-add-product-button_6.cjs",[[4,"salla-add-product-button",{"channels":[513],"quantity":[514],"donatingAmount":[514,"donating-amount"],"productId":[520,"product-id"],"productStatus":[513,"product-status"],"productType":[513,"product-type"],"disabled":[516]}],[0,"salla-search",{"inline":[4],"oval":[4],"height":[2],"results":[32],"placeholder":[32],"noResultsText":[32]},[[0,"modalOpened","onModalOpen"],[0,"modalClosed","onModalClose"]]],[0,"salla-product-availability",{"channels":[1],"productId":[2,"product-id"],"isSubscribed":[1028,"is-subscribed"],"subTitle":[32],"mobileLabel":[32],"emailLabel":[32],"emailPlaceholder":[32],"subscribedMessage":[32],"title_":[32],"emailErrorMsg":[32],"isVisitorSubscribed":[32]}],[0,"salla-tel-input",{"mobile":[1025],"countryCode":[1025,"country-code"],"mobileRequired":[32],"countryCodeLabel":[32],"mobileLabel":[32],"tooShort":[32],"tooLong":[32],"invalidCountryCode":[32],"invalidNumber":[32],"errorMap":[32],"getValues":[64],"isValid":[64]}],[4,"salla-button",{"shape":[513],"color":[513],"fill":[513],"size":[513],"width":[513],"loading":[516],"disabled":[516],"loaderPosition":[1,"loader-position"],"wide":[4],"href":[1],"load":[64],"stop":[64],"setText":[64],"disable":[64],"enable":[64]}],[4,"salla-modal",{"isClosable":[1028,"is-closable"],"width":[513],"position":[513],"visible":[516],"isLoading":[1540,"is-loading"],"subTitleFirst":[4,"sub-title-first"],"noPadding":[4,"no-padding"],"subTitle":[1,"sub-title"],"icon":[1],"iconStyle":[1,"icon-style"],"imageIcon":[1,"image-icon"],"modalTitle":[32],"show":[64],"hide":[64],"setTitle":[64],"loading":[64],"stopLoading":[64]}]]],["salla-login-modal.cjs",[[4,"salla-login-modal",{"isEmailAllowed":[1028,"is-email-allowed"],"isMobileAllowed":[1028,"is-mobile-allowed"],"isEmailRequired":[1028,"is-email-required"],"title":[32],"loginTypeTitle":[32],"loginText":[32],"smsLabel":[32],"mobileLabel":[32],"emailLabel":[32],"enterText":[32],"bySMSText":[32],"byEmailText":[32],"emailErrorMsg":[32],"firstNameLabel":[32],"lastNameLabel":[32],"firstNameErrorMsg":[32],"lastNameErrorMsg":[32],"show":[64]},[[0,"verified","onVerified"]]]]],["salla-rating-modal.cjs",[[0,"salla-rating-modal",{"orderId":[2,"order-id"],"order":[32],"show":[64],"hide":[64]}]]],["salla-branches.cjs",[[4,"salla-branches",{"position":[1],"displayAs":[1,"display-as"],"browseProductsFrom":[1,"browse-products-from"],"branches":[16],"current":[1026],"open":[32],"selected":[32],"isOpenedBefore":[32],"show":[64],"hide":[64]}]]],["salla-localization-modal.cjs",[[0,"salla-localization-modal",{"language":[1537],"currency":[1537],"languages":[32],"currencies":[32],"languagesTitle":[32],"currenciesTitle":[32],"isLoading":[32],"show":[64],"hide":[64],"submit":[64]}]]],["salla-offer-modal.cjs",[[0,"salla-offer-modal",{"offer":[32],"offer_name":[32],"offer_message":[32],"offer_expires_in":[32],"remember_my_choice":[32],"add_to_cart":[32],"out_of_stock":[32],"show":[64],"showOffer":[64]}]]],["salla-conditional-fields.cjs",[[4,"salla-conditional-fields",null,[[0,"change","changeHandler"]]]]],["salla-infinite-scroll.cjs",[[4,"salla-infinite-scroll",{"nextPage":[1,"next-page"],"nextPageAutoload":[1028,"next-page-autoload"],"container":[1],"item":[1],"loadMore":[32],"noMore":[32],"failedToLoad":[32]}]]],["salla-installment.cjs",[[0,"salla-installment",{"price":[1],"language":[1],"currency":[1],"tamaraIsActive":[32],"tabbyIsActive":[32],"spotiiIsActive":[32]}]]],["salla-quantity-input.cjs",[[4,"salla-quantity-input",{"quantity":[32],"decrease":[64],"increase":[64],"setValue":[64]}]]],["salla-verify-modal.cjs",[[4,"salla-verify-modal",{"withoutModal":[4,"without-modal"],"url":[513],"type":[1],"autoReload":[4,"auto-reload"],"title":[32],"getCode":[64],"show":[64]}]]],["salla-rating-stars.cjs",[[0,"salla-rating-stars",{"name":[1],"size":[1],"value":[2]}]]]], options);
20
+ return index.bootstrapLazy([["salla-add-product-button_6.cjs",[[4,"salla-add-product-button",{"channels":[513],"quantity":[514],"donatingAmount":[514,"donating-amount"],"productId":[520,"product-id"],"productStatus":[513,"product-status"],"productType":[513,"product-type"],"disabled":[516]}],[0,"salla-search",{"inline":[4],"oval":[4],"height":[2],"results":[32],"placeholder":[32],"noResultsText":[32]},[[0,"modalOpened","onModalOpen"],[0,"modalClosed","onModalClose"]]],[0,"salla-product-availability",{"channels":[1],"productId":[2,"product-id"],"isSubscribed":[1028,"is-subscribed"],"subTitle":[32],"mobileLabel":[32],"emailLabel":[32],"emailPlaceholder":[32],"subscribedMessage":[32],"title_":[32],"emailErrorMsg":[32],"isVisitorSubscribed":[32]}],[0,"salla-tel-input",{"phone":[1025],"name":[1],"countryCode":[1025,"country-code"],"mobileRequired":[32],"countryCodeLabel":[32],"mobileLabel":[32],"tooShort":[32],"tooLong":[32],"invalidCountryCode":[32],"invalidNumber":[32],"errorMap":[32],"getValues":[64],"isValid":[64]}],[4,"salla-button",{"shape":[513],"color":[513],"fill":[513],"size":[513],"width":[513],"loading":[516],"disabled":[516],"loaderPosition":[1,"loader-position"],"wide":[4],"href":[1],"load":[64],"stop":[64],"setText":[64],"disable":[64],"enable":[64]}],[4,"salla-modal",{"isClosable":[1028,"is-closable"],"width":[513],"position":[513],"visible":[516],"isLoading":[1540,"is-loading"],"subTitleFirst":[4,"sub-title-first"],"noPadding":[4,"no-padding"],"subTitle":[1,"sub-title"],"icon":[1],"iconStyle":[1,"icon-style"],"imageIcon":[1,"image-icon"],"modalTitle":[32],"open":[64],"close":[64],"setTitle":[64],"loading":[64],"stopLoading":[64]}]]],["salla-login-modal.cjs",[[4,"salla-login-modal",{"isEmailAllowed":[1028,"is-email-allowed"],"isMobileAllowed":[1028,"is-mobile-allowed"],"isEmailRequired":[1028,"is-email-required"],"title":[32],"loginTypeTitle":[32],"loginText":[32],"smsLabel":[32],"mobileLabel":[32],"emailLabel":[32],"enterText":[32],"bySMSText":[32],"byEmailText":[32],"emailErrorMsg":[32],"firstNameLabel":[32],"lastNameLabel":[32],"firstNameErrorMsg":[32],"lastNameErrorMsg":[32],"open":[64]},[[0,"verified","onVerified"]]]]],["salla-rating-modal.cjs",[[0,"salla-rating-modal",{"orderId":[2,"order-id"],"order":[32],"open":[64],"close":[64]}]]],["salla-branches.cjs",[[4,"salla-branches",{"position":[1],"displayAs":[1,"display-as"],"browseProductsFrom":[1,"browse-products-from"],"branches":[16],"current":[1026],"open":[32],"selected":[32],"isOpenedBefore":[32],"show":[64],"hide":[64]}]]],["salla-localization-modal.cjs",[[0,"salla-localization-modal",{"language":[1537],"currency":[1537],"languages":[32],"currencies":[32],"languagesTitle":[32],"currenciesTitle":[32],"isLoading":[32],"open":[64],"close":[64],"submit":[64]}]]],["salla-offer-modal.cjs",[[0,"salla-offer-modal",{"offer":[32],"offer_name":[32],"offer_message":[32],"offer_expires_in":[32],"remember_my_choice":[32],"add_to_cart":[32],"out_of_stock":[32],"open":[64],"showOffer":[64]}]]],["salla-conditional-fields.cjs",[[4,"salla-conditional-fields",null,[[0,"change","changeHandler"]]]]],["salla-infinite-scroll.cjs",[[4,"salla-infinite-scroll",{"nextPage":[1,"next-page"],"autoload":[1028],"container":[1],"item":[1],"loadMore":[32],"noMore":[32],"failedToLoad":[32]}]]],["salla-installment.cjs",[[0,"salla-installment",{"price":[1],"language":[1],"currency":[1],"tamaraIsActive":[32],"tabbyIsActive":[32],"spotiiIsActive":[32]}]]],["salla-quantity-input.cjs",[[4,"salla-quantity-input",{"quantity":[32],"decrease":[64],"increase":[64],"setValue":[64]}]]],["salla-verify-modal.cjs",[[4,"salla-verify-modal",{"withoutModal":[4,"without-modal"],"type":[1],"autoReload":[4,"auto-reload"],"title":[32],"isProfileVerify":[32],"getCode":[64],"open":[64]}]]],["salla-rating-stars.cjs",[[0,"salla-rating-stars",{"name":[1],"size":[1],"value":[2]}]]]], options);
21
21
  });
22
22
  };
23
23
 
@@ -8,7 +8,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
8
8
  const index = require('./index-c0f5bb97.js');
9
9
  const Helper = require('./Helper-8ae6a805.js');
10
10
 
11
- const sallaAddProductButtonCss = ":host{display:block}";
11
+ const sallaAddProductButtonCss = ":host{display:block}salla-add-product-button[width=wide]{width:100%}";
12
12
 
13
13
  const SallaAddProductButton = class {
14
14
  constructor(hostRef) {
@@ -16,7 +16,7 @@ const SallaAddProductButton = class {
16
16
  this.success = index.createEvent(this, "success", 7);
17
17
  this.failed = index.createEvent(this, "failed", 7);
18
18
  this.hostAttributes = {};
19
- this.hasNotText = false;
19
+ this.hasLabel = false;
20
20
  this.channels = null;
21
21
  this.quantity = 0;
22
22
  this.donatingAmount = 0;
@@ -31,22 +31,12 @@ const SallaAddProductButton = class {
31
31
  if (this.productStatus === 'sale') {
32
32
  return salla.lang.get('pages.cart.add_to_cart');
33
33
  }
34
- if (this.productType === 'product') {
34
+ if (this.productType !== 'donating') {
35
35
  return salla.lang.get('pages.products.out_of_stock');
36
36
  }
37
37
  // donating
38
38
  return salla.lang.get('pages.products.donation_exceed');
39
39
  }
40
- componentWillLoad() {
41
- this.hasNotText = !this.host.innerHTML || this.host.innerHTML === '' || this.host.innerHTML.trim().replace(/\s/g, '').localeCompare('<!---->') === 0;
42
- }
43
- componentDidRender() {
44
- if (this.buttonLabel && this.hasNotText) {
45
- salla.event.once('languages::translations.loaded', () => {
46
- this.buttonLabel.innerHTML = this.getLabel() || 'اضافة للسلة';
47
- });
48
- }
49
- }
50
40
  addProductToCart(event) {
51
41
  // we want to ignore the click action when the type of button is submit a form
52
42
  if (this.hostAttributes['type'] === 'submit') {
@@ -54,8 +44,8 @@ const SallaAddProductButton = class {
54
44
  }
55
45
  event.preventDefault();
56
46
  /**
57
- * by defailt the quick add is just an alias for add item function
58
- * but its work onlu when the id is the only value is passed via the object
47
+ * by default the quick add is just an alias for add item function
48
+ * but its work only when the id is the only value is passed via the object
59
49
  * so we will filter the object entities to remove null and zero values in case we don't want the normal add item action
60
50
  */
61
51
  return salla.cart.quickAdd(Object.entries({
@@ -74,10 +64,17 @@ const SallaAddProductButton = class {
74
64
  }
75
65
  return this.hostAttributes;
76
66
  }
67
+ componentWillLoad() {
68
+ this.hasLabel = !!this.host.innerHTML.replace('<!---->', '').trim();
69
+ }
77
70
  render() {
78
71
  return (index.h(index.Host, null, this.productStatus === 'out-and-notify' && this.channels ?
79
72
  index.h("salla-product-availability", Object.assign({}, this.getBtnAttributes()), index.h("slot", null)) :
80
- index.h("salla-button", Object.assign({ onClick: (event) => this.addProductToCart(event), type: "button", fill: this.productStatus === 'sale' ? 'solid' : 'outline', color: this.productStatus === 'sale' ? 'primary' : 'light', "loader-position": "center" }, this.getBtnAttributes(), { disabled: this.productStatus !== 'sale' }), index.h("slot", null), index.h("span", { ref: (el) => this.buttonLabel = el }))));
73
+ index.h("salla-button", Object.assign({ ref: btn => this.btn = btn, onClick: event => this.addProductToCart(event), type: "button", fill: this.productStatus === 'sale' ? 'solid' : 'outline', color: this.productStatus === 'sale' ? 'primary' : 'light', "loader-position": "center" }, this.getBtnAttributes(), { disabled: this.productStatus !== 'sale' }), index.h("slot", null))));
74
+ }
75
+ componentDidRender() {
76
+ //if label not passed, get label
77
+ this.hasLabel || salla.lang.onLoaded(() => this.btn.setText(this.getLabel() || 'اضافة للسلة'));
81
78
  }
82
79
  get host() { return index.getElement(this); }
83
80
  };
@@ -188,8 +185,11 @@ const SallaButton = class {
188
185
  + (this.shape == 'icon' ? ' s-button-loader-center' : ' s-button-loader-' + this.loaderPosition);
189
186
  return this.hostAttributes;
190
187
  }
188
+ button() {
189
+ return (index.h("button", Object.assign({}, this.getBtnAttributes(), { disabled: this.disabled }), index.h("span", { class: "s-button-text", ref: el => this.text = el }, index.h("slot", null)), this.loading ? index.h("span", { class: "s-button-loader" }) : ''));
190
+ }
191
191
  render() {
192
- return (index.h(index.Host, { class: "s-button-wrap" }, index.h("button", Object.assign({}, this.getBtnAttributes(), { disabled: this.disabled }), index.h("span", { class: "s-button-text", ref: el => this.text = el }, index.h("slot", null)), this.loading ? index.h("span", { class: "s-button-loader" }) : '')));
192
+ return (index.h(index.Host, { class: "s-button-wrap" }, this.href ? index.h("a", { href: this.href }, this.button()) : this.button()));
193
193
  }
194
194
  get host() { return index.getElement(this); }
195
195
  };
@@ -212,7 +212,7 @@ const SallaModal = class {
212
212
  */
213
213
  this.position = 'middle';
214
214
  /**
215
- * Show the modal on rendering
215
+ * open the modal on rendering
216
216
  */
217
217
  this.visible = false;
218
218
  /**
@@ -232,8 +232,8 @@ const SallaModal = class {
232
232
  */
233
233
  this.imageIcon = '';
234
234
  Helper.Helper.setHost(this.host);
235
- salla.event.on('modal::open', btn => btn.dataset.target == this.host.id && this.show());
236
- salla.event.on('modal::close', btn => btn.dataset.target == this.host.id && this.hide());
235
+ salla.event.on('modal::open', btn => btn.dataset.target == this.host.id && this.open());
236
+ salla.event.on('modal::close', btn => btn.dataset.target == this.host.id && this.close());
237
237
  this.modalTitle = this.host.getAttribute('modal-title');
238
238
  }
239
239
  handleVisible(newValue) {
@@ -247,16 +247,16 @@ const SallaModal = class {
247
247
  this.modalOpened.emit();
248
248
  }
249
249
  /**
250
- * Show the modal
250
+ * Open the modal
251
251
  */
252
- async show() {
252
+ async open() {
253
253
  this.host.setAttribute('visible', '');
254
254
  return this.host;
255
255
  }
256
256
  /**
257
- * hide the modal
257
+ * close the modal
258
258
  */
259
- async hide() {
259
+ async close() {
260
260
  this.host.removeAttribute('visible');
261
261
  return this.host;
262
262
  }
@@ -344,7 +344,6 @@ const SallaProductAvailability = class {
344
344
  constructor(hostRef) {
345
345
  index.registerInstance(this, hostRef);
346
346
  this.isUser = Helper.Helper.isUser();
347
- this.mobileLabel = '555555555';
348
347
  this.emailPlaceholder = 'your@email.com';
349
348
  /**
350
349
  * product id that can visitor subscribe to its availability notification
@@ -362,9 +361,9 @@ const SallaProductAvailability = class {
362
361
  }
363
362
  let data = { id: this.productId };
364
363
  if (this.channels_.includes('sms')) {
365
- let { mobile, countryCode } = await this.mobileInput.getValues();
364
+ let { phone, countryCode } = await this.mobileInput.getValues();
366
365
  data['country_code'] = countryCode;
367
- data['mobile'] = mobile;
366
+ data['mobile'] = phone; //todo:: change it to `phone`
368
367
  }
369
368
  if (this.channels_.includes('email')) {
370
369
  this.email.value !== '' && (data['email'] = this.email.value);
@@ -378,7 +377,7 @@ const SallaProductAvailability = class {
378
377
  salla.storage.set(`product-${this.productId}-subscribed`, true);
379
378
  }) //no need to wait until finishing alert animation
380
379
  .then(() => this.btn.stop())
381
- .then(() => this.modal.hide())
380
+ .then(() => this.modal.close())
382
381
  .catch(() => this.btn.stop() && this.btn.enable());
383
382
  };
384
383
  // helpers
@@ -388,13 +387,13 @@ const SallaProductAvailability = class {
388
387
  (error === null || error === void 0 ? void 0 : error.classList.contains('s-product-availability-error-msg')) && (error.innerText = '');
389
388
  e.key == 'Enter' && submitMethod();
390
389
  };
391
- salla.event.on('languages::translations.loaded', () => {
390
+ salla.lang.onLoaded(() => {
392
391
  var _a, _b, _c, _d;
393
392
  // console.log('translations:', salla.lang);
394
393
  this.subscribedMessage = salla.lang.get('pages.products.notify_availability_success');
395
394
  this.title_ = this.host.title || salla.lang.get('pages.products.notify_availability_title');
396
395
  this.subTitle = salla.lang.get('pages.products.notify_availability_subtitle');
397
- this.mobileLabel = salla.lang.get('common.elements.mobile') || '555555555';
396
+ this.mobileLabel = salla.lang.get('common.elements.mobile');
398
397
  this.emailLabel = salla.lang.get('common.elements.email');
399
398
  this.emailPlaceholder = salla.lang.get('common.elements.email_placeholder') || 'your@email.com';
400
399
  this.emailErrorMsg = salla.lang.get('common.elements.email_is_valid');
@@ -435,7 +434,7 @@ const SallaProductAvailability = class {
435
434
  return (index.h(index.Host, { class: "s-product-availability-wrap" }, this.isSubscribed || this.isVisitorSubscribed
436
435
  ? index.h("div", { class: "s-product-availability-subscribed" }, index.h("i", { class: "sicon-bell-ring s-product-availability-subs-icon" }), " ", this.subscribedMessage)
437
436
  :
438
- index.h("salla-button", { width: "wide", onClick: () => this.isUser ? this.submit() : this.modal.show(), ref: btn => this.inlineBtn = btn }, salla.lang.get('pages.products.notify_availability')), this.isUser || this.isSubscribed || this.isVisitorSubscribed ? '' : this.renderModal()));
437
+ index.h("salla-button", { width: "wide", onClick: () => this.isUser ? this.submit() : this.modal.open(), ref: btn => this.inlineBtn = btn }, salla.lang.get('pages.products.notify_availability')), this.isUser || this.isSubscribed || this.isVisitorSubscribed ? '' : this.renderModal()));
439
438
  }
440
439
  renderModal() {
441
440
  return (index.h("salla-modal", { ref: modal => this.modal = modal, "modal-title": this.title_, subTitle: this.subTitle, icon: "sicon-bell-ring", width: "sm" }, index.h("div", { class: "s-product-availability-body" }, this.channels_.includes('email') ? [
@@ -445,7 +444,7 @@ const SallaProductAvailability = class {
445
444
  ] : '', this.channels_.includes('sms') ? [
446
445
  index.h("label", { class: "s-product-availability-label" }, this.mobileLabel),
447
446
  index.h("salla-tel-input", { ref: el => this.mobileInput = el, onKeyDown: e => this.typing(e, this.submit) })
448
- ] : ''), index.h("div", { slot: "footer", class: "s-product-availability-footer" }, index.h("salla-button", { width: "wide", color: "light", fill: "outline", onClick: () => this.modal.hide(), ref: btn => this.cancelBtn = btn }, salla.lang.get('common.elements.cancel')), index.h("salla-button", { "loader-position": 'center', width: "wide", ref: btn => this.btn = btn, onClick: () => this.submit() }, salla.lang.get('common.elements.submit')))));
447
+ ] : ''), index.h("div", { slot: "footer", class: "s-product-availability-footer" }, index.h("salla-button", { width: "wide", color: "light", fill: "outline", onClick: () => this.modal.close(), ref: btn => this.cancelBtn = btn }, salla.lang.get('common.elements.cancel')), index.h("salla-button", { "loader-position": 'center', width: "wide", ref: btn => this.btn = btn, onClick: () => this.submit() }, salla.lang.get('common.elements.submit')))));
449
448
  }
450
449
  get host() { return index.getElement(this); }
451
450
  static get watchers() { return {
@@ -466,8 +465,8 @@ const SallaSearch = class {
466
465
  this.height = 60;
467
466
  Helper.Helper.setHost(this.host);
468
467
  this.productSlot = ((_a = Helper.Helper.getElement('[slot="product"]')) === null || _a === void 0 ? void 0 : _a.innerHTML) || this.getDefaultProductSlot();
469
- salla.event.on('search::show', () => this.modal.show());
470
- salla.event.on('languages::translations.loaded', () => {
468
+ salla.event.on('search::open', () => this.modal.open());
469
+ salla.lang.onLoaded(() => {
471
470
  this.placeholder = salla.lang.get('blocks.header.search_placeholder');
472
471
  this.noResultsText = salla.lang.get('common.elements.no_options');
473
472
  });
@@ -1917,6 +1916,10 @@ const SallaTelInput = class {
1917
1916
  constructor(hostRef) {
1918
1917
  index.registerInstance(this, hostRef);
1919
1918
  this.enterClicked = index.createEvent(this, "enterClicked", 7);
1919
+ /**
1920
+ * input name
1921
+ */
1922
+ this.name = 'phone';
1920
1923
  /**
1921
1924
  * Current country_code
1922
1925
  */
@@ -1929,7 +1932,7 @@ const SallaTelInput = class {
1929
1932
  this.invalidNumber = salla.lang.get('common.errors.invalid_value', { attribute: this.mobileLabel });
1930
1933
  this.errorMap = [this.invalidNumber, this.invalidCountryCode, this.tooShort, this.tooLong, this.invalidNumber];
1931
1934
  Helper.Helper.setHost(this.host);
1932
- salla.event.on('languages::translations.loaded', () => {
1935
+ salla.lang.onLoaded(() => {
1933
1936
  this.mobileLabel = salla.lang.get('common.elements.mobile');
1934
1937
  this.countryCodeLabel = salla.lang.get('common.country_code');
1935
1938
  this.invalidNumber = salla.lang.get('common.errors.invalid_value', { attribute: this.mobileLabel });
@@ -1946,7 +1949,7 @@ const SallaTelInput = class {
1946
1949
  */
1947
1950
  async getValues() {
1948
1951
  return {
1949
- mobile: this.mobile = this.phoneInput.value,
1952
+ [this.name]: this.phone = this.phoneInput.value,
1950
1953
  countryCode: this.countryCode = this.countryCodeInput.value
1951
1954
  };
1952
1955
  }
@@ -1996,7 +1999,7 @@ const SallaTelInput = class {
1996
1999
  }
1997
2000
  ;
1998
2001
  render() {
1999
- return (index.h(index.Host, { id: "s-tel-input" }, index.h("input", { type: "tel", name: "mobile", value: this.mobile, ref: el => this.phoneInput = el, class: "s-tel-input-control tel-input s-ltr" }), index.h("span", { class: "s-tel-input-error-msg", ref: el => this.errorMsg = el }), index.h("input", { type: "hidden", name: "country_code", value: this.countryCode, ref: el => this.countryCodeInput = el, class: "country_code" })));
2002
+ return (index.h(index.Host, { id: "s-tel-input" }, index.h("input", { type: "tel", name: this.name, value: this.phone, ref: el => this.phoneInput = el, class: "s-tel-input-control tel-input s-ltr" }), index.h("span", { class: "s-tel-input-error-msg", ref: el => this.errorMsg = el }), index.h("input", { type: "hidden", name: "country_code", value: this.countryCode, ref: el => this.countryCodeInput = el, class: "country_code" })));
2000
2003
  }
2001
2004
  componentDidLoad() {
2002
2005
  this.initTelInput();
@@ -42,14 +42,14 @@ const SallaBranches = class {
42
42
  : 'التسوق من فرع آخر';
43
43
  };
44
44
  salla.event.on('branches::show', btn => btn.dataset.target == this.host.id && this.show());
45
- salla.event.on('languages::translations.loaded', () => { var _a; return (_a = this.btn) === null || _a === void 0 ? void 0 : _a.setText(salla.lang.get('common.elements.ok')); });
45
+ salla.lang.onLoaded(() => { var _a; return (_a = this.btn) === null || _a === void 0 ? void 0 : _a.setText(salla.lang.get('common.elements.ok')); });
46
46
  }
47
47
  //todo:: add description for all @methods
48
48
  async show() {
49
- return this.modal.show();
49
+ return this.modal.open();
50
50
  }
51
51
  async hide() {
52
- return this.modal.hide();
52
+ return this.modal.close();
53
53
  }
54
54
  handelChange(event) {
55
55
  this.selected = event.target.value;
@@ -20,15 +20,15 @@ const SallaInfiniteScroll = class {
20
20
  /**
21
21
  * Is there is need to autoload next page when scroll `next-page-autoload|next-page.autoload`
22
22
  */
23
- this.nextPageAutoload = false;
23
+ this.autoload = false;
24
24
  /**
25
25
  * Class selector to know the container if it's not the host `<salla-infinite-scroll>`
26
26
  */
27
- this.container = '.s-infinite-scroll-container';
27
+ this.container = 'salla-infinite-scroll';
28
28
  /**
29
29
  * Class selector to know list items
30
30
  */
31
- this.item = '.list-block';
31
+ this.item = 'salla-infinite-scroll > *';
32
32
  Helper.Helper.setHost(this.host);
33
33
  this.status = document.createElement('div');
34
34
  this.status.className = 's-infinite-scroll-wrapper';
@@ -41,7 +41,7 @@ const SallaInfiniteScroll = class {
41
41
  <span class="s-button-loader s-button-loader-center s-infinite-scroll-btn-loader" style="display: none"></span>
42
42
  </a>`;
43
43
  this.btnLoader = this.status.querySelector('.s-button-loader');
44
- salla.event.on('languages::translations.loaded', () => {
44
+ salla.lang.onLoaded(() => {
45
45
  this.status.querySelector('.s-button-text').innerHTML = salla.lang.get('common.elements.load_more');
46
46
  this.status.querySelector('.s-infinite-scroll-last').innerHTML = salla.lang.get('common.elements.end_of_content');
47
47
  this.status.querySelector('.s-infinite-scroll-error').innerHTML = salla.lang.get('common.elements.failed_to_load_more');
@@ -52,10 +52,6 @@ const SallaInfiniteScroll = class {
52
52
  Helper.Helper.toggleElementClassIf(btnText, 's-button-hide', 's-button-show', () => isLoading);
53
53
  this.btnLoader.style.display = isLoading ? 'inherit' : 'none';
54
54
  }
55
- componentWillLoad() {
56
- var _a;
57
- this.nextPageAutoload = ['', 'true'].includes((_a = this.host.getAttribute('next-page.autoload')) === null || _a === void 0 ? void 0 : _a.toLowerCase());
58
- }
59
55
  render() {
60
56
  return this.nextPage.length > 1 ?
61
57
  index.h(index.Host, { class: "s-infinite-scroll-container" }, index.h("slot", null)) : '';
@@ -67,8 +63,8 @@ const SallaInfiniteScroll = class {
67
63
  this.host.insertAdjacentElement('afterend', this.status);
68
64
  let that = this;
69
65
  let infScroll = salla.infiniteScroll.initiate(this.container, {
70
- history: this.nextPageAutoload ? 'push' : false,
71
- scrollThreshold: this.nextPageAutoload ? 400 : false,
66
+ history: this.autoload ? 'push' : false,
67
+ scrollThreshold: this.autoload ? 400 : false,
72
68
  nextPage: this.nextPage,
73
69
  checkLastPage: 'salla-infinite-scroll[next-page*=":"],salla-infinite-scroll[next-page*="."]',
74
70
  status: '.s-infinite-scroll-status',
@@ -7,7 +7,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
7
7
 
8
8
  const index = require('./index-c0f5bb97.js');
9
9
 
10
- const sallaInstallmentCss = "#tabbyPromoWrapper{background:white;border-radius:0.375rem;transition:box-shadow 0.5s cubic-bezier(0.4, 0, 0.2, 1);margin-bottom:20px}#tabbyPromoWrapper:hover{box-shadow:0 0 #0000, 0 0 #0000, 5px 10px 30px #2B2D340D}#tabbyPromoWrapper #tabbyPromo *{font-family:var(--font-main)}#tabbyPromoWrapper #tabbyPromo>div>div{max-width:none;padding:15px;box-shadow:none;border:none}#tabbyPromoWrapper #tabbyPromo .tabby-promo-snippet{max-width:100%;min-height:100px;padding:18px 20px;border:none}#tabbyPromoWrapper #tabbyPromo .tabby-promo-snippet__text,#tabbyPromoWrapper #tabbyPromo .tabby-promo-snippet__link{font-size:var(--font-sm);color:var(--color-text) !important}#tabbyPromoWrapper #tabbyPromo .tabby-promo-snippet__link{font-weight:bold}.tabby-promo-wrapper #tabby-promo{font-family:var(--font-main) !important}.tabby-promo-wrapper #tabby-promo .tabby-promo__feature-title{font-size:var(--font-md)}.tabby-promo-wrapper #tabby-promo .tabby-promo__feature-desc{font-size:var(--font-sm);line-height:20px}.tamara-product-widget{margin-bottom:20px}.tamara-product-widget,.spotii-wrapper{min-height:100px;position:relative;color:var(--color-text);font-size:var(--font-sm);line-height:1.25;border:1px solid var(--color-grey-dark);padding:18px 20px 18px 100px !important;background:white;border-radius:0.375rem;transition:box-shadow 0.5s cubic-bezier(0.4, 0, 0.2, 1)}.tamara-product-widget:hover,.spotii-wrapper:hover{box-shadow:0 0 #0000, 0 0 #0000, 5px 10px 30px #2B2D340D}.spotii-wrapper .spotii-promo{font-size:var(--font-md)}.spotii-wrapper .spotii-product-widget{font-size:var(--font-sm);margin-top:10px}.tamara-product-widget .tamara-logo{position:absolute;left:20px;top:18px;margin:0 !important}.ltr .tamara-product-widget .tamara-logo{right:20px;left:auto}.tamara-product-widget span{font-family:var(--font-main);font-size:var(--font-sm);color:var(--color-text)}.tamara-product-widget span:last-child{display:block;position:relative;margin-top:8px}.tamara-popup__wrap{overflow:auto !important}";
10
+ const sallaInstallmentCss = "#tabbyPromoWrapper{background:white;border-radius:0.375rem;transition:box-shadow 0.5s cubic-bezier(0.4, 0, 0.2, 1);margin-bottom:20px}.salla-y #tabbyPromoWrapper{border:1px solid var(--color-grey-dark);border-radius:12px}#tabbyPromoWrapper:hover{box-shadow:0 0 #0000, 0 0 #0000, 5px 10px 30px #2B2D340D}#tabbyPromoWrapper #tabbyPromo *{font-family:var(--font-main)}#tabbyPromoWrapper #tabbyPromo>div>div{max-width:none;padding:15px;box-shadow:none;border:none}#tabbyPromoWrapper #tabbyPromo .tabby-promo-snippet{max-width:100%;min-height:100px;padding:18px 20px;border:none}#tabbyPromoWrapper #tabbyPromo .tabby-promo-snippet__text,#tabbyPromoWrapper #tabbyPromo .tabby-promo-snippet__link{font-size:var(--font-sm);color:var(--color-text) !important}#tabbyPromoWrapper #tabbyPromo .tabby-promo-snippet__link{font-weight:bold}.tabby-promo-wrapper #tabby-promo{font-family:var(--font-main) !important}.tabby-promo-wrapper #tabby-promo .tabby-promo__feature-title{font-size:var(--font-md)}.tabby-promo-wrapper #tabby-promo .tabby-promo__feature-desc{font-size:var(--font-sm);line-height:20px}.tamara-product-widget{margin-bottom:20px}.tamara-product-widget,.spotii-wrapper{min-height:100px;position:relative;color:var(--color-text);font-size:var(--font-sm);line-height:1.25;padding:18px 20px 18px 100px !important;background:white;border-radius:0.375rem;transition:box-shadow 0.5s cubic-bezier(0.4, 0, 0.2, 1)}.salla-y .tamara-product-widget,.salla-y .spotii-wrapper{border-radius:12px;border:1px solid var(--color-grey-dark)}.tamara-product-widget:hover,.spotii-wrapper:hover{box-shadow:0 0 #0000, 0 0 #0000, 5px 10px 30px #2B2D340D}.spotii-wrapper .spotii-promo{font-size:var(--font-md)}.spotii-wrapper .spotii-product-widget{font-size:var(--font-sm);margin-top:10px}.tamara-product-widget .tamara-logo{position:absolute;left:20px;top:18px;margin:0 !important}.ltr .tamara-product-widget .tamara-logo{right:20px;left:auto}.tamara-product-widget span{font-family:var(--font-main);font-size:var(--font-sm);color:var(--color-text)}.tamara-product-widget span:last-child{display:block;position:relative;margin-top:8px}.tamara-popup__wrap{overflow:auto !important}";
11
11
 
12
12
  const SallaInstallment = class {
13
13
  constructor(hostRef) {
@@ -20,8 +20,8 @@ const SallaLocalizationModal = class {
20
20
  this.language = salla.config.get('user.language_code');
21
21
  this.currency = salla.config.get('user.currency_code');
22
22
  Helper.Helper.setHost(this.host);
23
- salla.event.on('localization::show', () => this.show());
24
- salla.event.on('languages::translations.loaded', () => {
23
+ salla.event.on('localization::open', () => this.open());
24
+ salla.lang.onLoaded(() => {
25
25
  var _a;
26
26
  this.languagesTitle = salla.lang.get('common.titles.language');
27
27
  this.currenciesTitle = salla.lang.get('common.titles.currency');
@@ -40,10 +40,10 @@ const SallaLocalizationModal = class {
40
40
  this.currencySlot = ((_b = Helper.Helper.getElement('[slot="currency"]')) === null || _b === void 0 ? void 0 : _b.innerHTML) || '<label class="s-localization-modal-label" for="currency-{code}"><span>{name}</span><small class="s-localization-modal-currency">{code}</small></label>';
41
41
  }
42
42
  /**
43
- * Show the component
43
+ * open the component
44
44
  */
45
- async show() {
46
- return this.modal.show()
45
+ async open() {
46
+ return this.modal.open()
47
47
  .then(() => this.getLanguages())
48
48
  .then(() => this.getCurrencies())
49
49
  .then(() => this.isLoading = false);
@@ -51,8 +51,8 @@ const SallaLocalizationModal = class {
51
51
  /**
52
52
  * Hide the component
53
53
  */
54
- async hide() {
55
- return this.modal.hide();
54
+ async close() {
55
+ return this.modal.close();
56
56
  }
57
57
  async getLanguages() {
58
58
  this.language = this.language || salla.config.get('user.language_code');
@@ -84,7 +84,7 @@ const SallaLocalizationModal = class {
84
84
  })
85
85
  .then(() => this.language === salla.config.get('user.language_code', 'ar') || (url = salla.helpers.addParamToUrl('lang', this.language)))
86
86
  .then(() => this.btn.stop())
87
- .then(() => this.hide())
87
+ .then(() => this.close())
88
88
  .then(() => url && (window.location.href = url));
89
89
  }
90
90
  render() {
@@ -47,11 +47,11 @@ const SallaLoginModal = class {
47
47
  e.key == 'Enter' && submitMethod();
48
48
  };
49
49
  this.loginBySMS = async () => {
50
- const { mobile, countryCode } = await this.loginTelInput.getValues();
50
+ const { phone, countryCode } = await this.loginTelInput.getValues();
51
51
  const isPhoneValid = await this.loginTelInput.isValid();
52
52
  if (!isPhoneValid)
53
53
  return;
54
- this.login(this.smsBtn, { type: 'mobile', phone: mobile, country_code: countryCode });
54
+ this.login(this.smsBtn, { type: 'mobile', phone: phone, country_code: countryCode });
55
55
  };
56
56
  this.loginByEmail = () => {
57
57
  if (!Helper.Helper.isValidEmail(this.loginEmail.value)) {
@@ -62,14 +62,14 @@ const SallaLoginModal = class {
62
62
  };
63
63
  this.newUser = async () => {
64
64
  var _a;
65
- const { mobile: regPhone, countryCode } = this.regType == "email" ? await this.regTelInput.getValues() : await this.loginTelInput.getValues(), emailValue = this.regEmail.value || ((_a = this.loginEmail) === null || _a === void 0 ? void 0 : _a.value);
65
+ const { phone: regPhone, countryCode } = this.regType == "email" ? await this.regTelInput.getValues() : await this.loginTelInput.getValues(), emailValue = this.regEmail.value || ((_a = this.loginEmail) === null || _a === void 0 ? void 0 : _a.value);
66
66
  await this.newUserValidation();
67
67
  await this.regBtn.load();
68
68
  await this.regBtn.disable();
69
69
  let data = {
70
70
  first_name: this.firstName.value,
71
71
  last_name: this.lastName.value,
72
- phone: regPhone || this.loginTelInput.mobile,
72
+ phone: regPhone || this.loginTelInput.phone,
73
73
  country_code: countryCode,
74
74
  verified_by: this.regType,
75
75
  };
@@ -81,7 +81,7 @@ const SallaLoginModal = class {
81
81
  };
82
82
  this.title = this.host.title || salla.lang.get('blocks.header.login');
83
83
  this.host.removeAttribute('title');
84
- salla.event.on('languages::translations.loaded', () => {
84
+ salla.lang.onLoaded(() => {
85
85
  var _a, _b, _c, _d;
86
86
  this.title = salla.lang.get('blocks.header.login');
87
87
  this.loginTypeTitle = salla.lang.get('blocks.header.select_login_way');
@@ -104,7 +104,7 @@ const SallaLoginModal = class {
104
104
  salla.auth.event.onVerificationFailed(() => {
105
105
  //
106
106
  });
107
- salla.event.on('login::show', () => this.show());
107
+ salla.event.on('login::open', () => this.open());
108
108
  salla.event.on('twilight::initiated', () => {
109
109
  this.isEmailAllowed = salla.config.get('store.settings.auth.email_allowed', !!this.isEmailAllowed);
110
110
  this.isMobileAllowed = salla.config.get('store.settings.auth.mobile_allowed', !!this.isMobileAllowed);
@@ -132,9 +132,9 @@ const SallaLoginModal = class {
132
132
  window.location.reload();
133
133
  }
134
134
  /**
135
- * Show login component
135
+ * Open login component
136
136
  */
137
- async show() {
137
+ async open() {
138
138
  if (this.isEmailAllowed && this.isMobileAllowed) {
139
139
  this.showTab(this.homeTab);
140
140
  }
@@ -144,7 +144,7 @@ const SallaLoginModal = class {
144
144
  else if (this.isMobileAllowed) {
145
145
  this.showTab(this.mobileTab);
146
146
  }
147
- return this.modal.show();
147
+ return this.modal.open();
148
148
  }
149
149
  showTab(tab, evt) {
150
150
  var _a, _b;
@@ -171,7 +171,7 @@ const SallaLoginModal = class {
171
171
  .then(() => salla.auth.api.login(data))
172
172
  .then(() => btn.stop() && btn.enable())
173
173
  .then(() => this.showTab(this.verifyTab))
174
- .then(() => this.verifyTab.show(data));
174
+ .then(() => this.verifyTab.open(data));
175
175
  }
176
176
  async newUserValidation() {
177
177
  const isLogByPhone = this.regType == "phone", isLogByEmail = this.regType == "email", emailValue = this.regEmail.value || (isLogByEmail && this.loginEmail.value), isEmailValid = Helper.Helper.isValidEmail(emailValue), isFirstNameValid = this.firstName.value.length > 0, isLastNameValid = this.lastName.value.length > 0, isPhoneValid = await this.regTelInput.isValid() || isLogByPhone && await this.loginTelInput.isValid(), emailValidation = (emailValue && isEmailValid) || (!emailValue && !this.isEmailRequired);
@@ -20,7 +20,7 @@ const SallaOfferModal = class {
20
20
  this.add_to_cart = salla.lang.get('pages.cart.add_to_cart');
21
21
  this.out_of_stock = salla.lang.get('pages.products.out_of_stock');
22
22
  Helper.Helper.setHost(this.host);
23
- salla.event.on('languages::translations.loaded', () => {
23
+ salla.lang.onLoaded(() => {
24
24
  this.offer_expires_in = salla.lang.get('pages.products.offer_expires_in');
25
25
  this.remember_my_choice = salla.lang.get('common.remember_my_choice');
26
26
  this.add_to_cart = salla.lang.get('pages.cart.add_to_cart');
@@ -33,14 +33,14 @@ const SallaOfferModal = class {
33
33
  salla.log('User selected to don\'t show this offer again.');
34
34
  return;
35
35
  }
36
- this.show(offer.product_id);
36
+ this.open(offer.product_id);
37
37
  });
38
38
  }
39
39
  /**
40
40
  * Show the available offers for the product
41
41
  * @param product_id
42
42
  */
43
- async show(product_id) {
43
+ async open(product_id) {
44
44
  //TODO:: make sure there is only one offer
45
45
  return salla.api.offer.details(product_id)
46
46
  .then(response => this.showOffer(response.data[0]));
@@ -54,7 +54,7 @@ const SallaOfferModal = class {
54
54
  this.offer_name = offer.name;
55
55
  this.offer_message = offer.message;
56
56
  this.modal.setTitle(this.offer_name);
57
- return this.modal.show();
57
+ return this.modal.open();
58
58
  }
59
59
  rememberMe(event) {
60
60
  salla.storage.set('remember-offer-' + this.offer.id, event.target.checked);
@@ -30,8 +30,8 @@ const SallaRatingModal = class {
30
30
  this.back = salla.lang.get('common.elements.back');
31
31
  this.next = salla.lang.get('common.elements.next');
32
32
  Helper.Helper.setHost(this.host);
33
- salla.event.on('rating::show', () => this.show());
34
- salla.event.on('languages::translations.loaded', () => {
33
+ salla.event.on('rating::open', () => this.open());
34
+ salla.lang.onLoaded(() => {
35
35
  this.rate_the_store = salla.lang.get('pages.rating.rate_the_store');
36
36
  this.write_store_rate = salla.lang.get('pages.rating.write_store_rate');
37
37
  this.rate_product_stars = salla.lang.get('pages.rating.rate_product_stars');
@@ -46,8 +46,8 @@ const SallaRatingModal = class {
46
46
  /**
47
47
  * Show the rating modal
48
48
  */
49
- async show() {
50
- return this.modal.show()
49
+ async open() {
50
+ return this.modal.open()
51
51
  .then(() => this.order || salla.rating.api.order(this.orderId).then(res => this.order = res.data))
52
52
  .then(() => this.modal.setTitle(salla.lang.get('pages.rating.rate_order') + ' <span class="unicode">(#' + this.order.id + ')</span>'))
53
53
  .then(() => this.modal.stopLoading())
@@ -57,8 +57,8 @@ const SallaRatingModal = class {
57
57
  /**
58
58
  * Show the rating modal
59
59
  */
60
- async hide() {
61
- return this.modal.hide();
60
+ async close() {
61
+ return this.modal.close();
62
62
  }
63
63
  // handle wizard
64
64
  handleWizard() {
@@ -149,7 +149,7 @@ const SallaRatingModal = class {
149
149
  }
150
150
  clearInterval(timeToClose);
151
151
  this.thanksTime.remove();
152
- this.hide().then(() => window.location.reload());
152
+ this.close().then(() => window.location.reload());
153
153
  }, 1000);
154
154
  this.host.querySelector('.s-rating-modal-footer').classList.add('s-rating-modal-unvisiable');
155
155
  this.showActiveStep(this.thanksTab);