@salla.sa/twilight-components 1.6.15-alpha.20 → 1.6.15-alpha.3

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 (125) hide show
  1. package/dist/cjs/{index-ccab76e9.js → index-98e1eea0.js} +2 -2
  2. package/dist/cjs/{index-2d91726c.js → index-cac2fd59.js} +10 -89
  3. package/dist/cjs/loader.cjs.js +3 -3
  4. package/dist/cjs/salla-add-product-button.cjs.entry.js +1 -1
  5. package/dist/cjs/{salla-button_29.cjs.entry.js → salla-button_27.cjs.entry.js} +107 -231
  6. package/dist/cjs/salla-conditional-fields.cjs.entry.js +1 -1
  7. package/dist/cjs/salla-installment.cjs.entry.js +9 -4
  8. package/dist/cjs/salla-loyalty-prize-item.cjs.entry.js +1 -1
  9. package/dist/cjs/salla-scopes.cjs.entry.js +1 -1
  10. package/dist/cjs/salla-select.cjs.entry.js +1 -1
  11. package/dist/cjs/twilight.cjs.js +3 -3
  12. package/dist/collection/Helpers/Helper.js +15 -22
  13. package/dist/collection/collection-manifest.json +0 -2
  14. package/dist/collection/components/salla-gifting/salla-gifting.js +3 -9
  15. package/dist/collection/components/salla-infinite-scroll/salla-infinite-scroll.js +2 -1
  16. package/dist/collection/components/salla-installment/salla-installment.css +0 -3
  17. package/dist/collection/components/salla-installment/salla-installment.js +7 -2
  18. package/dist/collection/components/salla-localization-modal/salla-localization-modal.js +4 -2
  19. package/dist/collection/components/salla-login-modal/salla-login-modal.js +1 -1
  20. package/dist/collection/components/salla-modal/salla-modal.js +9 -18
  21. package/dist/collection/components/salla-offer-modal/salla-offer-modal.js +28 -61
  22. package/dist/collection/components/salla-placeholder/salla-placeholder.js +6 -6
  23. package/dist/collection/components/salla-product-availability/salla-product-availability.js +2 -2
  24. package/dist/collection/components/salla-product-size-guide/salla-product-size-guide.js +32 -32
  25. package/dist/collection/components/salla-quantity-input/salla-quantity-input.js +1 -1
  26. package/dist/collection/components/salla-rating-modal/salla-rating-modal.js +18 -15
  27. package/dist/collection/components/salla-rating-stars/salla-rating-stars.js +1 -1
  28. package/dist/collection/components/salla-search/salla-search.js +4 -3
  29. package/dist/collection/components/salla-swiper/salla-swiper.js +0 -1
  30. package/dist/collection/components/salla-tel-input/salla-tel-input.js +4 -2
  31. package/dist/collection/components/salla-verify/salla-verify.js +33 -38
  32. package/dist/components/Helper.js +15 -22
  33. package/dist/components/index.d.ts +0 -2
  34. package/dist/components/index.js +2 -4
  35. package/dist/components/salla-gifting.js +3 -7
  36. package/dist/components/salla-infinite-scroll.js +1 -0
  37. package/dist/components/salla-installment.js +8 -3
  38. package/dist/components/salla-localization-modal.js +4 -2
  39. package/dist/components/salla-login-modal.js +1 -1
  40. package/dist/components/salla-modal2.js +8 -10
  41. package/dist/components/salla-offer-modal.js +19 -41
  42. package/dist/components/salla-placeholder2.js +2 -2
  43. package/dist/components/salla-product-availability2.js +1 -1
  44. package/dist/components/salla-product-size-guide.js +6 -13
  45. package/dist/components/salla-rating-modal.js +21 -21
  46. package/dist/components/salla-rating-stars2.js +1 -1
  47. package/dist/components/salla-search.js +4 -3
  48. package/dist/components/salla-swiper2.js +0 -1
  49. package/dist/components/salla-tel-input2.js +3 -1
  50. package/dist/components/salla-verify2.js +31 -37
  51. package/dist/esm/{index-03197930.js → index-0ce70ad2.js} +10 -89
  52. package/dist/esm/{index-1cc8829f.js → index-294a3ac7.js} +2 -2
  53. package/dist/esm/loader.js +3 -3
  54. package/dist/esm/salla-add-product-button.entry.js +1 -1
  55. package/dist/esm/{salla-button_29.entry.js → salla-button_27.entry.js} +108 -230
  56. package/dist/esm/salla-conditional-fields.entry.js +1 -1
  57. package/dist/esm/salla-installment.entry.js +9 -4
  58. package/dist/esm/salla-loyalty-prize-item.entry.js +1 -1
  59. package/dist/esm/salla-scopes.entry.js +1 -1
  60. package/dist/esm/salla-select.entry.js +1 -1
  61. package/dist/esm/twilight.js +3 -3
  62. package/dist/esm-es5/index-0ce70ad2.js +4 -0
  63. package/dist/esm-es5/index-294a3ac7.js +24 -0
  64. package/dist/esm-es5/loader.js +1 -1
  65. package/dist/esm-es5/salla-add-product-button.entry.js +1 -1
  66. package/dist/esm-es5/salla-button_27.entry.js +34 -0
  67. package/dist/esm-es5/salla-conditional-fields.entry.js +1 -1
  68. package/dist/esm-es5/salla-installment.entry.js +1 -1
  69. package/dist/esm-es5/salla-loyalty-prize-item.entry.js +1 -1
  70. package/dist/esm-es5/salla-scopes.entry.js +1 -1
  71. package/dist/esm-es5/salla-select.entry.js +1 -1
  72. package/dist/esm-es5/twilight.js +1 -1
  73. package/dist/twilight/p-05eb9983.system.js +24 -0
  74. package/dist/twilight/p-0db2b810.entry.js +4 -0
  75. package/dist/twilight/{p-2b8f1167.entry.js → p-10ac9c79.entry.js} +1 -1
  76. package/dist/twilight/{p-06ecc027.entry.js → p-13129ac9.entry.js} +1 -1
  77. package/dist/twilight/{p-f0415183.system.entry.js → p-1914490f.system.entry.js} +1 -1
  78. package/dist/twilight/p-24e726cc.system.entry.js +34 -0
  79. package/dist/twilight/{p-3feb37f5.system.entry.js → p-26a23097.system.entry.js} +1 -1
  80. package/dist/twilight/p-44829812.system.js +4 -0
  81. package/dist/twilight/{p-092ad6d4.entry.js → p-521b6fde.entry.js} +1 -1
  82. package/dist/twilight/p-5b6fe797.js +24 -0
  83. package/dist/twilight/{p-bac267ae.entry.js → p-97daba27.entry.js} +1 -1
  84. package/dist/twilight/{p-a1cd00a6.system.entry.js → p-a7caaba3.system.entry.js} +1 -1
  85. package/dist/twilight/{p-20584294.entry.js → p-bbc94b9b.entry.js} +1 -1
  86. package/dist/twilight/p-ca68752d.js +5 -0
  87. package/dist/twilight/p-ce3e3fa2.system.entry.js +4 -0
  88. package/dist/twilight/p-d64f3123.entry.js +22 -0
  89. package/dist/twilight/p-db0ba553.system.js +5 -0
  90. package/dist/twilight/{p-f7bb47ef.system.entry.js → p-dd9b3c90.system.entry.js} +1 -1
  91. package/dist/twilight/{p-a82f8d33.system.entry.js → p-f610b6bf.system.entry.js} +1 -1
  92. package/dist/twilight/twilight.esm.js +1 -1
  93. package/dist/twilight/twilight.js +1 -1
  94. package/dist/types/Helpers/Helper.d.ts +6 -6
  95. package/dist/types/components/salla-installment/salla-installment.d.ts +2 -1
  96. package/dist/types/components/salla-modal/salla-modal.d.ts +0 -1
  97. package/dist/types/components/salla-offer-modal/offer-schema.d.ts +0 -1
  98. package/dist/types/components/salla-offer-modal/salla-offer-modal.d.ts +0 -4
  99. package/dist/types/components/salla-placeholder/salla-placeholder.d.ts +3 -3
  100. package/dist/types/components/salla-rating-modal/salla-rating-modal.d.ts +1 -2
  101. package/dist/types/components/salla-verify/salla-verify.d.ts +1 -2
  102. package/dist/types/components.d.ts +7 -35
  103. package/package.json +4 -4
  104. package/dist/collection/components/salla-cart-summary/salla-cart-summary.css +0 -3
  105. package/dist/collection/components/salla-cart-summary/salla-cart-summary.js +0 -35
  106. package/dist/collection/components/salla-user-settings/salla-user-settings.css +0 -0
  107. package/dist/collection/components/salla-user-settings/salla-user-settings.js +0 -107
  108. package/dist/components/salla-cart-summary.d.ts +0 -11
  109. package/dist/components/salla-cart-summary.js +0 -53
  110. package/dist/components/salla-user-settings.d.ts +0 -11
  111. package/dist/components/salla-user-settings.js +0 -116
  112. package/dist/esm-es5/index-03197930.js +0 -4
  113. package/dist/esm-es5/index-1cc8829f.js +0 -24
  114. package/dist/esm-es5/salla-button_29.entry.js +0 -34
  115. package/dist/twilight/p-2bdd14ea.entry.js +0 -22
  116. package/dist/twilight/p-a058465b.system.js +0 -24
  117. package/dist/twilight/p-a2cc9062.entry.js +0 -4
  118. package/dist/twilight/p-b95c5d8c.system.entry.js +0 -34
  119. package/dist/twilight/p-c571b40b.js +0 -5
  120. package/dist/twilight/p-ca961962.system.js +0 -5
  121. package/dist/twilight/p-ee91a41b.system.js +0 -4
  122. package/dist/twilight/p-f59fe82e.js +0 -24
  123. package/dist/twilight/p-f99821d3.system.entry.js +0 -4
  124. package/dist/types/components/salla-cart-summary/salla-cart-summary.d.ts +0 -6
  125. package/dist/types/components/salla-user-settings/salla-user-settings.d.ts +0 -18
@@ -5,7 +5,7 @@
5
5
 
6
6
  Object.defineProperty(exports, '__esModule', { value: true });
7
7
 
8
- const index$1 = require('./index-2d91726c.js');
8
+ const index$1 = require('./index-cac2fd59.js');
9
9
  const _commonjsHelpers = require('./_commonjsHelpers-691dd63b.js');
10
10
  const search = require('./search-b487cc49.js');
11
11
 
@@ -118,31 +118,6 @@ const SallaButton = class {
118
118
  };
119
119
  SallaButton.style = sallaButtonCss;
120
120
 
121
- const CartIcon = `<!-- Generated by IcoMoon.io -->
122
- <svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="30" height="32" viewBox="0 0 30 32">
123
- <title>cart</title>
124
- <path d="M15.426 28.084c0-1.412-0.85-2.684-2.156-3.226-1.305-0.54-2.807-0.241-3.805 0.758-0.999 0.998-1.298 2.5-0.758 3.805 0.54 1.303 1.815 2.155 3.226 2.155 1.928-0.003 3.49-1.564 3.492-3.492h0.001zM10.597 28.084h0.001c0-0.54 0.326-1.027 0.825-1.235 0.498-0.206 1.074-0.091 1.455 0.29 0.383 0.382 0.497 0.957 0.29 1.456-0.208 0.5-0.695 0.825-1.235 0.825-0.355 0-0.695-0.142-0.944-0.391-0.251-0.251-0.392-0.591-0.392-0.946h-0.001l0.001 0.001zM28.23 28.084c0-1.412-0.85-2.684-2.155-3.226-1.305-0.54-2.807-0.241-3.806 0.758s-1.297 2.5-0.756 3.805c0.54 1.303 1.813 2.155 3.226 2.155 1.927-0.003 3.49-1.564 3.491-3.492zM23.401 28.084c0-0.54 0.326-1.027 0.825-1.235 0.5-0.206 1.075-0.091 1.457 0.29s0.497 0.957 0.289 1.456c-0.206 0.5-0.693 0.825-1.233 0.825-0.738 0-1.337-0.599-1.337-1.337l-0.001 0.001zM1.953 0.234l-0.342-0.059c-0.29-0.064-0.594-0.004-0.839 0.166-0.247 0.169-0.414 0.436-0.463 0.734-0.050 0.3 0.023 0.607 0.201 0.85s0.444 0.402 0.738 0.44l0.341 0.059c1.825 0.324 3.248 1.794 3.548 3.662l1.981 12.369h-0.001c0.218 1.387 0.913 2.651 1.96 3.563s2.379 1.412 3.754 1.41h14.242c0.601 0 1.088-0.498 1.088-1.112s-0.487-1.112-1.088-1.112h-14.242c-1.679-0.001-3.139-1.183-3.525-2.854h11.463c1.614 0.004 3.188-0.518 4.493-1.49 1.305-0.973 2.271-2.346 2.762-3.918l1.298-4.136c0.145-0.455 0.065-0.953-0.213-1.336-0.278-0.385-0.72-0.608-1.187-0.602h-20.467l-0.181-1.141c-0.218-1.367-0.849-2.631-1.802-3.615-0.954-0.983-2.184-1.64-3.518-1.878h-0.001zM26.946 9.096l-0.993 3.169v-0.001c-0.353 1.122-1.044 2.101-1.975 2.796s-2.056 1.067-3.208 1.067h-11.833l-1.125-7.042 19.134 0.011z"></path>
125
- </svg>
126
- `;
127
-
128
- const sallaCartSummaryCss = ":host{display:block}";
129
-
130
- const SallaCartSummary = class {
131
- constructor(hostRef) {
132
- index$1.registerInstance(this, hostRef);
133
- this.cartSummaryCount = 0;
134
- this.cartSummaryTotal = 0;
135
- salla.cart.event.onUpdated(() => {
136
- this.cartSummaryCount = salla.storage.get('cart.summary.count');
137
- this.cartSummaryCount = salla.storage.get('cart.summary.total');
138
- });
139
- }
140
- render() {
141
- return (index$1.h(index$1.Host, null, index$1.h("a", { class: "s-cart-summary", href: salla.url.get('cart') }, index$1.h("slot", { name: "icon" }, index$1.h("i", { class: "s-cart-summary-icon", innerHTML: CartIcon })), index$1.h("span", { class: "s-cart-summary-count" }, salla.helpers.number(this.cartSummaryCount)), index$1.h("b", { class: "s-cart-summary-total" }, salla.money(this.cartSummaryTotal)))));
142
- }
143
- };
144
- SallaCartSummary.style = sallaCartSummaryCss;
145
-
146
121
  var HOOKS = [
147
122
  "onChange",
148
123
  "onClose",
@@ -18880,10 +18855,6 @@ const SallaGifting = class {
18880
18855
  * Show the gifting modal window
18881
18856
  */
18882
18857
  async open() {
18883
- if (salla.config.isGuest()) {
18884
- salla.event.dispatch('login::open');
18885
- return;
18886
- }
18887
18858
  this.modal.open();
18888
18859
  return await salla.api.withoutNotifier(() => salla.product.getGiftDetails(this.productId))
18889
18860
  .then((response) => {
@@ -18892,7 +18863,7 @@ const SallaGifting = class {
18892
18863
  })
18893
18864
  .catch(e => {
18894
18865
  var _a, _b, _c, _d;
18895
- this.hasError = true;
18866
+ this.hasError = false;
18896
18867
  this.errorMessage = ((_c = (_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.error) === null || _c === void 0 ? void 0 : _c.message) || ((_d = e.response) === null || _d === void 0 ? void 0 : _d.data);
18897
18868
  })
18898
18869
  .finally(() => this.modal.stopLoading());
@@ -19160,12 +19131,12 @@ const SallaGifting = class {
19160
19131
  var _a, _b;
19161
19132
  return [
19162
19133
  index$1.h("div", null, index$1.h("salla-list-tile", { class: "s-gifting-widget" }, index$1.h("div", { slot: "title" }, index$1.h("h3", null, this.sectionTitle)), index$1.h("div", { slot: "subtitle" }, index$1.h("div", null, this.sectionSubtitle)), index$1.h("div", { slot: "action" }, index$1.h("salla-button", { class: "s-gifting-widget-action", color: "gray", onClick: () => this.open() }, index$1.h("span", { innerHTML: GiftSharing }), " \u00A0", index$1.h("span", null, this.sectionBtnText)))), index$1.h("salla-modal", { id: 'salla-gifting-modal', isLoading: true, class: "s-gifting-modal", width: "sm", ref: modal => this.modal = modal }, index$1.h("div", { slot: "loading" }, index$1.h("div", { class: "s-gifting-skeleton" }, index$1.h("div", { class: "s-gifting-modal-header" }, index$1.h("salla-skeleton", { type: 'circle', height: '5rem', width: '5rem' }), index$1.h("h2", { class: "s-gifting-modal-title" }, index$1.h("div", { class: "s-gifting-modal-badge-wrapper" }, index$1.h("salla-skeleton", { height: '15px', width: '150px' })))), index$1.h("div", { class: "s-gifting-skeleton-content" }, index$1.h("salla-skeleton", { height: '10px', width: '150px' }), index$1.h("salla-skeleton", { height: '230px' }), index$1.h("salla-skeleton", { height: '10px', width: '150px' }), index$1.h("salla-skeleton", { height: '30px' }), index$1.h("salla-skeleton", { height: '40px' })))), index$1.h("slot", { name: "header" }), !!this.hasError ?
19163
- index$1.h("salla-placeholder", { alignment: "center" }, index$1.h("span", { slot: "title" }, this.errorMessage || salla.lang.get('common.errors.empty_results')), index$1.h("span", { slot: "description" }, " "))
19134
+ index$1.h("salla-placeholder", { alignment: "center" }, index$1.h("span", { slot: "description" }, this.errorMessage))
19164
19135
  :
19165
19136
  [
19166
19137
  index$1.h("div", { class: "s-gifting-modal-header" }, index$1.h("span", { class: "s-gifting-modal-icon" }, index$1.h("span", { innerHTML: GiftSharing })), index$1.h("h2", { class: "s-gifting-modal-title" }, index$1.h("div", { class: "s-gifting-modal-badge-wrapper" }, index$1.h("div", { class: "s-gifting-modal-badge" }, index$1.h("span", null, index$1.h("span", null, this.currentStep), "/2")), index$1.h("span", null, this.giftDetails)))),
19167
19138
  index$1.h("div", { class: "s-gifting-steps-wrapper steps-wrapper" }, index$1.h("div", { class: "s-gifting-step-one gift-step-1" }, index$1.h("div", { class: "s-gifting-modal-uploader-title anime-item" }, this.selectImageForYourGift), index$1.h("div", { class: "s-gifting-modal-uploader anime-item" }, index$1.h("span", { class: "s-gifting-remove-preview", onClick: () => this.removePreview(), innerHTML: Cancel }), this.selectImageOrUpload && index$1.h("salla-file-upload", { "instant-upload": true, labelIdle: this.getFilepondPlaceholder(), serverConfig: this.getServerConfig(), onRemove: () => this.handleRemoveImage() }, " ")), index$1.h("div", { class: "anime-item" }, !this.uploadedImage && !!this.gift && this.gift.gift_images.length > 0 ?
19168
- index$1.h("salla-swiper", { "space-between-items": "10" }, (_a = this.gift) === null || _a === void 0 ? void 0 : _a.gift_images.map((item) => index$1.h("img", { class: "s-gifting-image s-gifting-clickable", src: item.url, onClick: () => this.setPreview(item), alt: `${item.id}` })))
19139
+ index$1.h("salla-swiper", { "space-between-items": "10", "item-per-view": "4" }, (_a = this.gift) === null || _a === void 0 ? void 0 : _a.gift_images.map((item) => index$1.h("img", { class: "s-gifting-image s-gifting-clickable", src: item.url, onClick: () => this.setPreview(item), alt: `${item.id}` })))
19169
19140
  : ""), index$1.h("div", { class: "anime-item" }, index$1.h("div", { class: "s-form-group s-gifting-selectText" }, index$1.h("label", { htmlFor: "gift-text-selection", class: "s-form-label" }, this.selectGiftMessage), index$1.h("select", { id: "gift-text-selection", name: "gift-text-selection", class: "s-form-control s-gifting-select", onChange: e => this.toggleGiftText(e) }, index$1.h("option", { "data-id": null, selected: true }, this.selectGiftMessage), (_b = this.gift) === null || _b === void 0 ? void 0 :
19170
19141
  _b.gift_texts.map((txt) => index$1.h("option", { "data-id": txt.id, value: txt.text, key: txt.id }, txt.text)), index$1.h("option", { "data-id": "custom" }, this.giftCustomText))), index$1.h("div", { class: this.showGiftText ? "s-form-group s-gifting-textarea shown" : "s-form-group s-gifting-textarea hide" }, index$1.h("label", { htmlFor: "gift-custom-text", class: "s-form-label" }, this.giftCustomText), index$1.h("div", { class: "mt-1" }, index$1.h("textarea", { onInput: (event) => this.handleTextAreaChange(event), rows: 4, ref: (el) => this.textArea = el, name: "gift-custom-text", id: "gift-custom-text", class: "s-form-control" })))), index$1.h("div", { class: "anime-item" }, index$1.h("salla-button", { color: "primary", width: "wide", onClick: () => this.goToStep2() }, index$1.h("span", null, this.nextStep)))), index$1.h("div", { class: "s-gifting-step-two gift-step-2" }, index$1.h("div", { class: this.errors && this.errors['sender_name'] ? "s-form-group s-form-has-error anime-item opacity-0" : "s-form-group anime-item opacity-0" }, index$1.h("label", { htmlFor: "sender_name", class: "s-form-label" }, this.senderNameLabel), index$1.h("input", { type: "text", class: "s-form-control", name: "sender_name", id: "sender_name", value: this.senderName, onInput: (event) => this.handleSenderName(event), placeholder: "" }), this.errors && this.errors['sender_name'] ? index$1.h("span", { class: "text-danger text-xs" }, this.errors['sender_name']) : ''), index$1.h("div", { class: this.errors && this.errors['receiver.name'] ? "s-form-group s-form-has-error anime-item opacity-0" : "s-form-group anime-item opacity-0" }, index$1.h("label", { htmlFor: "receiver_name", class: "s-form-label" }, this.receiverNameFieldLabel), index$1.h("input", { type: "text", class: "s-form-control", name: "receiver_name", id: "receiver_name", value: "", onInput: (event) => this.handleReceiverName(event), placeholder: "" }), this.errors && this.errors['receiver.name'] ? index$1.h("span", { class: "text-danger text-xs" }, this.errors['receiver.name']) : ''), index$1.h("div", { class: this.errors && this.errors['receiver.mobile'] ? "s-form-group s-form-has-error anime-item opacity-0" : "s-form-group anime-item opacity-0" }, index$1.h("label", { class: "s-form-label" }, this.receiverMobileFieldLabel), index$1.h("salla-tel-input", { class: "s-gifting-tel-input", phone: this.receiverMobile, countryCode: this.receiverCountryCode, onPhoneEntered: (e) => this.handlePhoneInputChange(e) }), this.errors && this.errors['receiver.mobile'] ? index$1.h("span", { class: "text-danger text-xs" }, this.errors['receiver.mobile']) : ''), index$1.h("div", { class: "anime-item opacity-0" }, index$1.h("label", { class: "s-gifting-schedule s-gifting-clickable", htmlFor: "schedule" }, index$1.h("input", { type: "checkbox", name: 'schedule', id: 'schedule', onChange: () => this.toggleCalendar(), class: "s-checkbox" }), index$1.h("span", { class: "s-form-label" }, " ", this.sendLater, " "))), index$1.h("div", { class: this.getCalendarClasses() }, index$1.h("label", { class: "s-form-label" }, this.selectSendDateAndTime), index$1.h("salla-datetime-picker", { value: this.deliveryDate, placeholder: this.selectSendDateAndTime, "enable-time": true, "date-format": "Y-m-d h:i K", onPicked: (event) => this.handleDateTimePicker(event) }), index$1.h("span", { class: "s-gifting-calendar-hint" }, this.canNotEditOrderAfterSelectDate)), index$1.h("div", { class: "s-gifting-step-two-footer anime-item opacity-0" }, index$1.h("a", { href: "#!", innerHTML: this.currentLang == 'ar' ? ArrowRightIcon : ArrowLeftIcon, onClick: () => this.goToStep1() }), index$1.h("salla-button", { onClick: () => this.submitForm(), color: "primary", width: 'wide' }, index$1.h("span", null, this.sendGift)))))
19171
19142
  ], index$1.h("slot", { name: "footer" })))
@@ -19174,31 +19145,24 @@ const SallaGifting = class {
19174
19145
  };
19175
19146
  SallaGifting.style = sallaGiftingCss;
19176
19147
 
19177
- //TODO::check why there are too much listeners for languages::translations.loaded
19178
- salla.event.setMaxListeners(20);
19179
- class Helper {
19180
- toggleElementClassIf(element, classes1, classes2, callback) {
19181
- classes1 = Array.isArray(classes1) ? classes1 : classes1.split(' ');
19182
- classes2 = Array.isArray(classes2) ? classes2 : classes2.split(' ');
19183
- let isClasses1 = callback(element);
19184
- element === null || element === void 0 ? void 0 : element.classList.remove(...(isClasses1 ? classes2 : classes1));
19185
- element === null || element === void 0 ? void 0 : element.classList.add(...(isClasses1 ? classes1 : classes2));
19186
- return this;
19148
+ class Helper extends salla.AppHelpers {
19149
+ setHost(host) {
19150
+ // @ts-ignore
19151
+ this.host = host;
19187
19152
  }
19188
- toggleClassIf(selector, classes1, classes2, callback) {
19189
- document.querySelectorAll(selector).forEach(element => this.toggleElementClassIf(element, classes1, classes2, callback));
19190
- return this;
19153
+ getElement(selector) {
19154
+ // @ts-ignore
19155
+ return this.host.querySelector(selector);
19191
19156
  }
19192
- isValidEmail(email) {
19193
- const re = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
19194
- return re.test(String(email).toLowerCase());
19157
+ getAttribute(selector, attribute) {
19158
+ var _a;
19159
+ return (_a = this.getElement(selector)) === null || _a === void 0 ? void 0 : _a.getAttribute(attribute);
19195
19160
  }
19196
- debounce(fn, ...data) {
19197
- if (!this.debounce_) {
19198
- this.debounce_ = Salla.helpers.debounce((callback, ...innerData) => callback(...innerData), 500);
19199
- }
19200
- //@ts-ignore
19201
- return this.debounce_(fn, ...data);
19161
+ val(selector) {
19162
+ return this.getAttribute(selector, 'value');
19163
+ }
19164
+ isUser() {
19165
+ return salla.config.get('user.type') === 'user';
19202
19166
  }
19203
19167
  }
19204
19168
  const Helper$1 = new Helper;
@@ -19224,6 +19188,7 @@ const SallaInfiniteScroll = class {
19224
19188
  * Class selector to know list items
19225
19189
  */
19226
19190
  this.item = 'salla-infinite-scroll > *';
19191
+ Helper$1.setHost(this.host);
19227
19192
  this.status = document.createElement('div');
19228
19193
  this.status.className = 's-infinite-scroll-wrapper';
19229
19194
  this.status.innerHTML = `<div class="s-infinite-scroll-status" style="display:none">
@@ -19356,6 +19321,7 @@ const SallaLocalizationModal = class {
19356
19321
  * Current currency (existing or newly selected)
19357
19322
  */
19358
19323
  this.currency = salla.config.get('user.currency_code');
19324
+ Helper$1.setHost(this.host);
19359
19325
  salla.event.on('localization::open', () => this.open());
19360
19326
  salla.lang.onLoaded(() => {
19361
19327
  this.translationLoaded = true;
@@ -19369,8 +19335,8 @@ const SallaLocalizationModal = class {
19369
19335
  * Because scoped templates not supported in stencil );
19370
19336
  * we made a workaround to pass language & currency attributes, then replace names in rendering
19371
19337
  */
19372
- this.languageSlot = ((_a = this.host.querySelector('[slot="language"]')) === null || _a === void 0 ? void 0 : _a.innerHTML) || '<label class="s-localization-modal-label" for="lang-{code}"><span>{name}</span><div class="s-localization-modal-flag flag iti__flag iti__{country_code}"></div></label>';
19373
- this.currencySlot = ((_b = this.host.querySelector('[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>';
19338
+ this.languageSlot = ((_a = Helper$1.getElement('[slot="language"]')) === null || _a === void 0 ? void 0 : _a.innerHTML) || '<label class="s-localization-modal-label" for="lang-{code}"><span>{name}</span><div class="s-localization-modal-flag flag iti__flag iti__{country_code}"></div></label>';
19339
+ this.currencySlot = ((_b = Helper$1.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>';
19374
19340
  }
19375
19341
  /**
19376
19342
  * open the component
@@ -19473,7 +19439,7 @@ const PhoneIcon = `<!-- Generated by IcoMoon.io -->
19473
19439
  </svg>
19474
19440
  `;
19475
19441
 
19476
- const MailIcon = `<!-- Generated by IcoMoon.io -->
19442
+ const email = `<!-- Generated by IcoMoon.io -->
19477
19443
  <svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">
19478
19444
  <title>mail</title>
19479
19445
  <path d="M28 2.667h-24c-2.205 0-4 1.795-4 4v18.667c0 2.205 1.795 4 4 4h24c2.205 0 4-1.795 4-4v-18.667c0-2.205-1.795-4-4-4zM29.333 25.333c0 0.735-0.599 1.333-1.333 1.333h-24c-0.735 0-1.333-0.599-1.333-1.333v-12.685l10.54 4.865c0.888 0.409 1.84 0.613 2.793 0.613s1.907-0.204 2.793-0.615l10.54-4.864zM29.333 9.711l-11.657 5.38c-1.065 0.492-2.288 0.492-3.353 0l-11.656-5.38v-3.044c0-0.735 0.599-1.333 1.333-1.333h24c0.735 0 1.333 0.599 1.333 1.333z"></path>
@@ -19695,7 +19661,7 @@ const SallaLoginModal = class {
19695
19661
  // @ts-ignore
19696
19662
  // @ts-ignore
19697
19663
  return (index$1.h("salla-modal", { class: "s-login-modal", "modal-title": this.title, ref: modal => this.modal = modal, width: "xs" }, index$1.h("span", { slot: 'icon', class: "s-login-modal-header-icon", innerHTML: UserIcon }), index$1.h("div", { class: "s-login-modal-wrapper" }, this.isEmailAllowed && this.isMobileAllowed ?
19698
- index$1.h("div", { class: this.generateTabClasses('home'), "data-name": "home", ref: tab => this.homeTab = tab }, index$1.h("p", { class: "s-login-modal-sub-title" }, salla.lang.get('blocks.header.select_login_way')), index$1.h("slot", { name: "before-login-type" }), index$1.h("a", { href: "#", class: "s-login-modal-main-btn", onClick: (evt) => this.showTab(this.mobileTab, evt) }, index$1.h("span", { class: "s-login-modal-main-btn-icon", innerHTML: PhoneIcon }), index$1.h("span", { class: "s-login-modal-main-btn-text" }, salla.lang.get('blocks.header.sms')), index$1.h("span", { class: "s-login-modal-main-btn-arrow", innerHTML: KeyboardArrowRightIcon })), index$1.h("a", { href: "#", class: "s-login-modal-main-btn", onClick: (evt) => this.showTab(this.emailTab, evt) }, index$1.h("span", { class: "s-login-modal-main-btn-icon", innerHTML: MailIcon }), index$1.h("span", { class: "s-login-modal-main-btn-text" }, salla.lang.get('common.elements.email')), index$1.h("span", { class: "s-login-modal-main-btn-arrow", innerHTML: KeyboardArrowRightIcon })), index$1.h("slot", { name: "after-login-type" }))
19664
+ index$1.h("div", { class: this.generateTabClasses('home'), "data-name": "home", ref: tab => this.homeTab = tab }, index$1.h("p", { class: "s-login-modal-sub-title" }, salla.lang.get('blocks.header.select_login_way')), index$1.h("slot", { name: "before-login-type" }), index$1.h("a", { href: "#", class: "s-login-modal-main-btn", onClick: (evt) => this.showTab(this.mobileTab, evt) }, index$1.h("span", { class: "s-login-modal-main-btn-icon", innerHTML: PhoneIcon }), index$1.h("span", { class: "s-login-modal-main-btn-text" }, salla.lang.get('blocks.header.sms')), index$1.h("span", { class: "s-login-modal-main-btn-arrow", innerHTML: KeyboardArrowRightIcon })), index$1.h("a", { href: "#", class: "s-login-modal-main-btn", onClick: (evt) => this.showTab(this.emailTab, evt) }, index$1.h("span", { class: "s-login-modal-main-btn-icon", innerHTML: email }), index$1.h("span", { class: "s-login-modal-main-btn-text" }, salla.lang.get('common.elements.email')), index$1.h("span", { class: "s-login-modal-main-btn-arrow", innerHTML: KeyboardArrowRightIcon })), index$1.h("slot", { name: "after-login-type" }))
19699
19665
  : '', this.isMobileAllowed ?
19700
19666
  index$1.h("div", { class: this.generateTabClasses('login-phone'), "data-name": "login-phone", ref: tab => this.mobileTab = tab }, index$1.h("slot", { name: "before-login-mobile" }), index$1.h("form", { onSubmit: () => this.loginBySMS(event), method: "POST" }, index$1.h("label", { class: "s-login-modal-label" }, salla.lang.get('common.elements.mobile')), index$1.h("salla-tel-input", { tabindex: "0", ref: el => this.loginTelInput = el, onKeyDown: e => this.typing(e, this.loginBySMS) }), index$1.h("salla-button", { type: "submit", "loader-position": 'center', width: "wide", ref: b => this.smsBtn = b }, salla.lang.get('blocks.header.enter'))), this.isEmailAllowed ?
19701
19667
  index$1.h("a", { href: "#", onClick: () => this.showTab(this.emailTab), class: "s-login-modal-link" }, salla.lang.get('blocks.header.login_by_email')) : '', index$1.h("slot", { name: "after-login-mobile" })) : '', this.isEmailAllowed ?
@@ -20004,9 +19970,12 @@ const SallaModal = class {
20004
19970
  * Set the style of the header icon.
20005
19971
  */
20006
19972
  this.iconStyle = undefined;
19973
+ Helper$1.setHost(this.host);
20007
19974
  salla.event.on('modal::open', target => target == this.host.id && this.open());
20008
19975
  salla.event.on('modal::close', target => target == this.host.id && this.close());
20009
19976
  this.modalTitle = this.host.getAttribute('modal-title');
19977
+ // close modal on Escape button clicked
19978
+ Helper$1.onKeyUp(document.body, e => e.keyCode === 27 && this.closeModal());
20010
19979
  }
20011
19980
  handleVisible(newValue) {
20012
19981
  if (!newValue) {
@@ -20018,11 +19987,6 @@ const SallaModal = class {
20018
19987
  this.host.classList.remove('s-hidden');
20019
19988
  setTimeout(() => this.toggleModal(true)); //small amont of time to running toggle After adding hidden
20020
19989
  }
20021
- handleKeyUp(ev) {
20022
- if (ev.key === "KeyUp") {
20023
- this.closeModal();
20024
- }
20025
- }
20026
19990
  /**
20027
19991
  * Open the modal
20028
19992
  */
@@ -20090,15 +20054,15 @@ const SallaModal = class {
20090
20054
  render() {
20091
20055
  this.host.id = this.host.id || 'salla-modal';
20092
20056
  if (this.isLoading) {
20093
- return (index$1.h(index$1.Host, { class: 'salla-modal s-modal s-modal-container s-hidden', "aria-modal": "true", role: "dialog", onKeyUp: e => this.handleKeyUp(e) }, index$1.h("div", { class: "s-modal-overlay", ref: el => this.overlay = el, onClick: () => this.closeModal() }), index$1.h("div", { class: "s-modal-wrapper" }, index$1.h("span", { class: 's-modal-spacer s-modal-align-' + this.position }, "\u200B"), index$1.h("div", { class: 's-modal-body ' + 's-modal-align-' + this.position + ' s-modal-' + this.getWidth() + (this.noPadding ? ' s-modal-nopadding' : ' s-modal-padding') }, index$1.h("slot", { name: "loading" }, index$1.h("salla-loading", null)), index$1.h("div", { class: "s-hidden" }, index$1.h("slot", null))))));
20057
+ return (index$1.h(index$1.Host, { class: 'salla-modal s-modal s-modal-container s-hidden', "aria-modal": "true", role: "dialog" }, index$1.h("div", { class: "s-modal-overlay", ref: el => this.overlay = el, onClick: () => this.closeModal() }), index$1.h("div", { class: "s-modal-wrapper" }, index$1.h("span", { class: 's-modal-spacer s-modal-align-' + this.position }, "\u200B"), index$1.h("div", { class: 's-modal-body ' + 's-modal-align-' + this.position + ' s-modal-' + this.getWidth() + (this.noPadding ? ' s-modal-nopadding' : ' s-modal-padding') }, index$1.h("slot", { name: "loading" }, index$1.h("salla-loading", null)), index$1.h("div", { class: "s-hidden" }, index$1.h("slot", null))))));
20094
20058
  }
20095
20059
  return (index$1.h(index$1.Host, { class: 'salla-modal s-modal s-modal-container s-hidden', "aria-modal": "true", role: "dialog" }, index$1.h("div", { class: "s-modal-overlay", ref: el => this.overlay = el, onClick: () => this.closeModal() }), index$1.h("div", { class: "s-modal-wrapper" }, index$1.h("span", { class: 's-modal-spacer s-modal-align-' + this.position }, "\u200B"), index$1.h("div", { class: 's-modal-body ' + 's-modal-align-' + this.position + ' s-modal-' + this.getWidth() + (this.noPadding ? ' s-modal-nopadding' : ' s-modal-padding') }, index$1.h("div", { class: { 's-modal-header': true, 's-modal-is-center': this.centered } }, this.isClosable ?
20096
20060
  index$1.h("button", { class: "s-modal-close", onClick: () => this.closeModal(), type: "button" }, index$1.h("span", { innerHTML: Cancel }))
20097
20061
  : '', this.modalTitle || this.subTitle ?
20098
20062
  index$1.h("div", { class: "s-modal-header-inner" }, index$1.h("slot", { name: 'icon' }, !!this.iconStyle ?
20099
20063
  index$1.h("div", { class: this.iconBlockClasses(), innerHTML: this.iconStyle == 'error' ? AlertEngineIcon : CheckCircle2 })
20100
- : ''), index$1.h("div", { class: "s-modal-header-content" }, this.modalTitle ? index$1.h("div", { class: { 's-modal-title': true, 's-modal-title-below': this.subTitleFirst }, innerHTML: this.modalTitle }) : '', this.subTitle ? index$1.h("p", { class: { 's-modal-sub-title': true }, innerHTML: this.subTitle }) : ''))
20101
- : ''), index$1.h("slot", null), index$1.h("slot", { name: "footer" })))));
20064
+ : ''), index$1.h("div", { class: "s-modal-header-content" }, index$1.h("div", { class: { 's-modal-title': true, 's-modal-title-below': this.subTitleFirst }, innerHTML: this.modalTitle }), index$1.h("p", { class: { 's-modal-sub-title': true }, innerHTML: this.subTitle })))
20065
+ : ""), index$1.h("slot", null), index$1.h("slot", { name: "footer" })))));
20102
20066
  }
20103
20067
  //move the modal as root dom, because we need the model to be outside the forms
20104
20068
  componentDidLoad() {
@@ -20147,15 +20111,13 @@ const SallaOfferModal = class {
20147
20111
  this.offer = null;
20148
20112
  this.hasError = false;
20149
20113
  this.translationLoaded = false;
20150
- this.addToCartLabel = salla.lang.get("pages.cart.add_to_cart");
20151
- salla.event.on('offer-modal::open', product_id => this.open(product_id));
20114
+ Helper$1.setHost(this.host);
20115
+ salla.event.on('offer-modal::open', (product_id) => this.open(product_id));
20152
20116
  salla.lang.onLoaded(() => {
20153
- this.addToCartLabel = salla.lang.get("pages.cart.add_to_cart");
20154
20117
  this.translationLoaded = true;
20155
20118
  });
20156
- this.categorySlot = ((_a = this.host.querySelector('[slot="category"]')) === null || _a === void 0 ? void 0 : _a.innerHTML) || `<span class="s-offer-modal-badge-icon">{tagIcon}</span><span class="s-offer-modal-badge-text">{name}</span>`;
20157
- this.productSlot = ((_b = this.host.querySelector('[slot="product"]')) === null || _b === void 0 ? void 0 : _b.innerHTML) || this.defaultProductSlot();
20158
- salla.event.on('offer-modal::open', product_id => this.open(product_id));
20119
+ this.categorySlot = ((_a = Helper$1.getElement('[slot="category"]')) === null || _a === void 0 ? void 0 : _a.innerHTML) || `<span class="s-offer-modal-badge-icon">{tagIcon}</span><span class="s-offer-modal-badge-text">{name}</span>`;
20120
+ this.productSlot = ((_b = Helper$1.getElement('[slot="product"]')) === null || _b === void 0 ? void 0 : _b.innerHTML) || this.defaultProductSlot();
20159
20121
  salla.product.event.onOfferExisted(offer => {
20160
20122
  if (salla.storage.get('remember-offer-' + offer.id)) {
20161
20123
  salla.log('User selected to don\'t show this offer again.');
@@ -20169,7 +20131,6 @@ const SallaOfferModal = class {
20169
20131
  * @param product_id
20170
20132
  */
20171
20133
  async open(product_id) {
20172
- this.productID = product_id;
20173
20134
  //TODO:: make sure there is only one offer
20174
20135
  this.modal.open();
20175
20136
  return salla.api.withoutNotifier(() => salla.product.offers(product_id))
@@ -20194,35 +20155,6 @@ const SallaOfferModal = class {
20194
20155
  rememberMe(event) {
20195
20156
  salla.storage.set('remember-offer-' + this.offer.id, event.target.checked);
20196
20157
  }
20197
- addToCart(qty) {
20198
- //todo:: add enhancement, to cover the previous quantity, because if the discount to add two, user already added one before.
20199
- salla.api.withoutNotifier(() => salla.cart.quickAdd(this.productID, qty)).then(() => this.modal.close());
20200
- }
20201
- getOfferContent() {
20202
- var _a, _b, _c, _d;
20203
- if ((_a = this.offer.get.products) === null || _a === void 0 ? void 0 : _a.length) {
20204
- return index$1.h("div", { class: "s-offer-modal-scrolled-slider-wrap" }, index$1.h("div", { class: "s-offer-modal-body s-offer-modal-scrolled-slider" }, (_b = this.offer.get.products) === null || _b === void 0 ? void 0 : _b.map(product => index$1.h("div", { class: {
20205
- "s-offer-modal-product": true,
20206
- "s-offer-modal-slider-item": true,
20207
- "s-offer-modal-not-available": !product.is_available
20208
- }, id: 'product_' + product.id, innerHTML: this.productSlot
20209
- .replace(/\{name\}/g, product.name)
20210
- .replace(/\{url\}/g, product.url)
20211
- .replace(/\{image\}/g, product.thumbnail)
20212
- .replace(/\{price\}/g, product.has_special_price
20213
- ? salla.money(product.price) + '<span class="s-offer-modal-product-old-price">' + salla.money(product.regular_price) + '</span>'
20214
- : salla.money(product.price)) }, index$1.h("div", { class: "s-offer-modal-btn-wrap" }, index$1.h("salla-button", { width: "wide", fill: 'outline', "data-id": product.id, disabled: !product.is_available, "loader-position": "center", onClick: this.addItem }, product.is_available ? salla.lang.get('pages.cart.add_to_cart') : salla.lang.get('pages.products.out_of_stock')))))), index$1.h("div", { class: "s-offer-modal-slider-nav" }, index$1.h("button", { class: "s-offer-modal-nav-btn s-offer-modal-prev-btn" }, index$1.h("span", { class: "s-offer-modal-nav-btn-icon", innerHTML: KeyboardArrowLeftIcon })), index$1.h("button", { class: "s-offer-modal-nav-btn s-offer-modal-next-btn" }, index$1.h("span", { class: "s-offer-modal-nav-btn-icon", innerHTML: KeyboardArrowRightIcon }))));
20215
- }
20216
- else if ((_c = this.offer.get.categories) === null || _c === void 0 ? void 0 : _c.length) {
20217
- return index$1.h("div", { class: "s-offer-modal-scrolled-slider-wrap" }, index$1.h("div", { class: "s-offer-modal-body s-offer-modal-scrolled-slider" }, this.offer.get.categories.map(category => index$1.h("a", { href: category.urls.customer, class: "s-offer-modal-badge s-offer-modal-slider-item", innerHTML: this.categorySlot
20218
- .replace(/\{tagIcon\}/g, Tag)
20219
- .replace(/\{name\}/g, category.name)
20220
- .replace(/\{url\}/g, category.urls.customer) }))), index$1.h("div", { class: "s-offer-modal-slider-nav" }, index$1.h("button", { class: "s-offer-modal-nav-btn s-offer-modal-prev-btn" }, index$1.h("span", { class: "s-offer-modal-nav-btn-icon", innerHTML: KeyboardArrowLeftIcon })), index$1.h("button", { class: "s-offer-modal-nav-btn s-offer-modal-next-btn" }, index$1.h("span", { class: "s-offer-modal-nav-btn-icon", innerHTML: KeyboardArrowRightIcon }))));
20221
- }
20222
- else if (this.offer.get.discounts_table) {
20223
- return index$1.h("div", { class: "s-offer-modal-discount-table" }, index$1.h("table", null, index$1.h("tbody", null, (_d = this.offer.get.discounts_table) === null || _d === void 0 ? void 0 : _d.map(discount => index$1.h("tr", null, index$1.h("td", null, discount.text), index$1.h("td", { class: "s-offer-modal-discount-table-cell" }, index$1.h("salla-button", { fill: "outline", shape: "btn", color: "primary", size: "medium", width: "normal", onClick: () => this.addToCart(discount.quantity) }, this.addToCartLabel)))))));
20224
- }
20225
- }
20226
20158
  //todo:: pass event then use sallaButton from it
20227
20159
  addItem() {
20228
20160
  // this here, is sallaButton
@@ -20239,17 +20171,28 @@ const SallaOfferModal = class {
20239
20171
  '</div>';
20240
20172
  }
20241
20173
  render() {
20174
+ var _a, _b;
20242
20175
  return index$1.h("salla-modal", { "sub-title-first": true, "has-skeleton": true, "sub-title": this.offer_message, ref: modal => this.modal = modal, isLoading: true }, index$1.h("div", { slot: 'loading' }, index$1.h("div", { class: "s-offer-modal-skeleton" }, index$1.h("div", { class: "s-offer-modal-skeleton-header" }, index$1.h("salla-skeleton", { type: 'circle', height: '80px', width: '80px' }), index$1.h("salla-skeleton", { height: '15px', width: '50%' }), index$1.h("salla-skeleton", { height: '10px', width: '30%' })), index$1.h("div", { class: "s-offer-modal-skeleton-items" }, [...Array(3)].map(() => index$1.h("div", { class: "s-offer-modal-skeleton-item" }, index$1.h("salla-skeleton", { height: '9rem' }), index$1.h("div", { class: "s-offer-modal-skeleton-item-title" }, index$1.h("salla-skeleton", { height: '15px', width: '100%' })), index$1.h("div", { class: "s-offer-modal-skeleton-item-subtitle" }, index$1.h("salla-skeleton", { height: '9px', width: '50%' }), index$1.h("div", { innerHTML: Cart2 }))))), index$1.h("div", { class: "s-offer-modal-skeleton-footer" }, index$1.h("salla-skeleton", { height: '15px', width: '50%' }), index$1.h("salla-skeleton", { height: '15px', width: '30%' })))), !this.hasError && this.offer !== null
20243
- ? [index$1.h("span", { slot: 'icon', class: "s-offer-modal-header-icon", innerHTML: SpecialDiscountIcon }), this.getOfferContent(), index$1.h("div", { class: "s-offer-modal-footer", slot: "footer" }, this.offer.formatted_date ?
20176
+ ? [index$1.h("span", { slot: 'icon', class: "s-offer-modal-header-icon", innerHTML: SpecialDiscountIcon }), index$1.h("div", { class: "s-offer-modal-scrolled-slider-wrap" }, index$1.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
20177
+ ? this.offer.get.categories.map(category => index$1.h("a", { href: category.urls.customer, class: "s-offer-modal-badge s-offer-modal-slider-item", innerHTML: this.categorySlot
20178
+ .replace(/\{tagIcon\}/g, Tag)
20179
+ .replace(/\{name\}/g, category.name)
20180
+ .replace(/\{url\}/g, category.urls.customer) }))
20181
+ : (_b = this.offer.get.products) === null || _b === void 0 ? void 0 : _b.map(product => index$1.h("div", { class: { "s-offer-modal-product": true, "s-offer-modal-slider-item": true, "s-offer-modal-not-available": !product.is_available }, id: 'product_' + product.id, innerHTML: this.productSlot
20182
+ .replace(/\{name\}/g, product.name)
20183
+ .replace(/\{url\}/g, product.url)
20184
+ .replace(/\{image\}/g, product.thumbnail)
20185
+ .replace(/\{price\}/g, product.has_special_price
20186
+ ? salla.money(product.price) + '<span class="s-offer-modal-product-old-price">' + salla.money(product.regular_price) + '</span>'
20187
+ : salla.money(product.price)) }, index$1.h("div", { class: "s-offer-modal-btn-wrap" }, index$1.h("salla-button", { width: "wide", fill: 'outline', "data-id": product.id, disabled: !product.is_available, "loader-position": "center", onClick: this.addItem }, product.is_available ? salla.lang.get('pages.cart.add_to_cart') : salla.lang.get('pages.products.out_of_stock')))))), index$1.h("div", { class: "s-offer-modal-slider-nav" }, index$1.h("button", { class: "s-offer-modal-nav-btn s-offer-modal-prev-btn" }, index$1.h("span", { class: "s-offer-modal-nav-btn-icon", innerHTML: KeyboardArrowLeftIcon })), index$1.h("button", { class: "s-offer-modal-nav-btn s-offer-modal-next-btn" }, index$1.h("span", { class: "s-offer-modal-nav-btn-icon", innerHTML: KeyboardArrowRightIcon })))), index$1.h("div", { class: "s-offer-modal-footer", slot: "footer" }, this.offer.formatted_date ?
20244
20188
  index$1.h("p", { class: "s-offer-modal-expiry" }, salla.lang.get('pages.products.offer_expires_in'), " ", this.offer.formatted_date)
20245
20189
  : '', index$1.h("label", { class: "s-offer-modal-remember-label" }, index$1.h("input", { type: "checkbox", onChange: e => this.rememberMe(e), class: "s-offer-modal-remember-input" }), "\u00A0 ", salla.lang.get('common.elements.remember_my_choice'))),
20246
20190
  ] :
20247
20191
  index$1.h("salla-placeholder", { class: "s-loyalty-placeholder", alignment: "center" }, !!this.errorMessage ? index$1.h("span", { slot: "description" }, this.errorMessage) : ''));
20248
20192
  }
20249
20193
  componentDidRender() {
20250
- var _a, _b;
20251
20194
  // Sooo mini Slider
20252
- if (this.offer && (((_a = this.offer.get.products) === null || _a === void 0 ? void 0 : _a.length) || ((_b = this.offer.get.categories) === null || _b === void 0 ? void 0 : _b.length)) && window.screen.width > 639) {
20195
+ if (this.offer && window.screen.width > 639) {
20253
20196
  let sliderWrap = this.modal.querySelector('.s-offer-modal-scrolled-slider-wrap'), slider = this.modal.querySelector('.s-offer-modal-scrolled-slider'), navButtons = this.modal.querySelectorAll('.s-offer-modal-nav-btn'), nexBtn = this.modal.querySelector('.s-offer-modal-next-btn'), prevBtn = this.modal.querySelector('.s-offer-modal-prev-btn'), items = this.modal.querySelectorAll('.s-offer-modal-slider-item'), sliderNavMargin = 20, // space before displaying the next/prev btns.
20254
20197
  current = 0, // current slide
20255
20198
  slidesToScroll = 3, itemsLength = items.length;
@@ -20310,7 +20253,7 @@ const SallaPlaceholder = class {
20310
20253
  index$1.registerInstance(this, hostRef);
20311
20254
  this.translationLoaded = false;
20312
20255
  /**
20313
- * Custom icon to display, defaults to [`Inbox`], can be any valid svg icon or inline element with font icon
20256
+ * Custom icon to display, defaults to [`sicon-inbox`]
20314
20257
  */
20315
20258
  this.icon = Inbox;
20316
20259
  /**
@@ -20318,7 +20261,7 @@ const SallaPlaceholder = class {
20318
20261
  */
20319
20262
  this.alignment = 'left';
20320
20263
  /**
20321
- * The size of the icon. Defaults to [`md`] = 45px for font icon & width/height: 3.5rem for svg icon
20264
+ * The size of the icon. Defaults to [`md`]
20322
20265
  */
20323
20266
  this.iconSize = 'md';
20324
20267
  salla.lang.onLoaded(() => {
@@ -20351,7 +20294,7 @@ const sallaProductAvailabilityCss = "";
20351
20294
  const SallaProductAvailability = class {
20352
20295
  constructor(hostRef) {
20353
20296
  index$1.registerInstance(this, hostRef);
20354
- this.isUser = salla.config.isUser();
20297
+ this.isUser = Helper$1.isUser();
20355
20298
  this.translationLoaded = false;
20356
20299
  /**
20357
20300
  * product id that can visitor subscribe to its availability notification
@@ -20456,19 +20399,13 @@ const SallaProductAvailability = class {
20456
20399
  };
20457
20400
  SallaProductAvailability.style = sallaProductAvailabilityCss;
20458
20401
 
20459
- const PencilRuler = `<!-- Generated by IcoMoon.io -->
20460
- <svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">
20461
- <title>pencil-ruler</title>
20462
- <path d="M3.057 11.609c0.26 0.26 0.601 0.391 0.943 0.391s0.683-0.131 0.943-0.391l6.667-6.667c0.521-0.521 0.521-1.364 0-1.885l-1.285-1.285c-1.143-1.143-2.661-1.772-4.276-1.772-1.616 0-3.135 0.629-4.276 1.772-1.143 1.141-1.772 2.66-1.772 4.276 0 1.615 0.629 3.135 1.772 4.276zM3.657 3.657c1.277-1.277 3.504-1.277 4.781 0l0.343 0.343-4.781 4.781-0.343-0.343c-0.639-0.639-0.991-1.488-0.991-2.391s0.352-1.752 0.991-2.391zM29.317 20.972c-0.2-0.707-0.932-1.119-1.645-0.921-0.709 0.2-1.121 0.937-0.921 1.645l1.987 7.041-7.041-1.987c-0.707-0.195-1.444 0.213-1.645 0.921-0.2 0.708 0.212 1.445 0.921 1.645l9.333 2.633c0.119 0.032 0.24 0.049 0.361 0.049 0.349 0 0.689-0.137 0.943-0.391 0.341-0.341 0.472-0.84 0.34-1.305zM31.609 8.772l-8.381-8.381c-0.5-0.5-1.385-0.5-1.885 0l-8.171 8.171s-0.001 0-0.001 0.001 0 0.001-0.001 0.001l-4.607 4.607s0 0-0.001 0 0 0 0 0.001l-8.171 8.171c-0.251 0.249-0.391 0.588-0.391 0.943 0 0.353 0.14 0.693 0.391 0.943l8.381 8.381c0.249 0.251 0.589 0.391 0.943 0.391s0.693-0.14 0.943-0.391l20.952-20.952c0.521-0.521 0.521-1.365 0-1.885zM9.715 28.781l-6.495-6.496 1.676-1.676 1.851 1.851c0.26 0.26 0.601 0.391 0.943 0.391s0.683-0.131 0.943-0.391c0.521-0.521 0.521-1.364 0-1.885l-1.851-1.851 2.724-2.724 3.008 3.008c0.26 0.26 0.601 0.391 0.943 0.391s0.683-0.131 0.943-0.391c0.521-0.521 0.521-1.364 0-1.885l-3.008-3.008 2.724-2.724 1.851 1.851c0.26 0.26 0.601 0.391 0.943 0.391s0.683-0.131 0.943-0.391c0.521-0.52 0.521-1.364 0-1.885l-1.851-1.851 2.724-2.724 3.008 3.008c0.26 0.26 0.601 0.391 0.943 0.391s0.683-0.131 0.943-0.391c0.521-0.521 0.521-1.365 0-1.885l-3.008-3.008 1.677-1.677 6.496 6.496z"></path>
20463
- </svg>
20464
- `;
20465
-
20466
20402
  const sallaProductSizeGuideCss = "";
20467
20403
 
20468
20404
  const SallaProductSizeGuide = class {
20469
20405
  constructor(hostRef) {
20470
20406
  index$1.registerInstance(this, hostRef);
20471
20407
  this.hasError = false;
20408
+ Helper$1.setHost(document);
20472
20409
  salla.event.on('size-guide::open', (product_id) => this.open(product_id));
20473
20410
  salla.lang.onLoaded(() => {
20474
20411
  this.placeholder_title = salla.lang.get('pages.products.size_guide_placeholder');
@@ -20506,11 +20443,9 @@ const SallaProductSizeGuide = class {
20506
20443
  return index$1.h("salla-placeholder", { alignment: "center", iconSize: "xl" }, index$1.h("div", { slot: "title" }, this.placeholder_title), index$1.h("div", { slot: "description" }, this.placeholder_description));
20507
20444
  }
20508
20445
  render() {
20509
- return (index$1.h("salla-modal", { class: "s-product-size-guide-wrapper", id: 'salla-product-size-guide-modal', isLoading: true, "has-skeleton": true, width: "md", ref: modal => this.modal = modal }, index$1.h("span", { slot: 'icon', class: "s-product-size-guide-header-icon", innerHTML: PencilRuler }), index$1.h("div", { slot: "loading" }, index$1.h("div", { class: "s-product-size-guide-skeleton" }, index$1.h("salla-skeleton", { height: '15px', width: '25%' }), index$1.h("div", { class: "s-product-size-guide-skeleton-header" }, index$1.h("salla-skeleton", { height: '40px' }), index$1.h("salla-skeleton", { height: '40px' }), index$1.h("salla-skeleton", { height: '40px' }), index$1.h("salla-skeleton", { height: '40px' })), index$1.h("div", { class: "s-product-size-guide-skeleton-content" }, index$1.h("salla-skeleton", { height: '15px', width: '25%' }), index$1.h("salla-skeleton", { height: '10px', width: '75%' }), index$1.h("salla-skeleton", { height: '10px', width: '50%' }), index$1.h("salla-skeleton", { height: '10px', width: '75%' }), index$1.h("salla-skeleton", { height: '10px', width: '100%' }), index$1.h("salla-skeleton", { height: '10px', width: '25%' }), index$1.h("salla-skeleton", { height: '10px', width: '60%' }), index$1.h("salla-skeleton", { height: '10px', width: '45%' }), index$1.h("salla-skeleton", { height: '10px', width: '30%' })))), index$1.h("slot", { name: "header" }), !this.hasError && !!this.guides ?
20510
- [
20511
- index$1.h("salla-tabs", null, this.guides.map((guide) => index$1.h("salla-tab-header", { slot: "header", name: guide.name }, index$1.h("span", null, guide.name))), this.guides.map((guide) => index$1.h("salla-tab-content", { slot: "content", name: guide.name }, index$1.h("div", { innerHTML: guide.description }))))
20512
- ]
20513
- : this.showPlaceholder(), index$1.h("slot", { name: "footer" })));
20446
+ return (index$1.h(index$1.Host, { class: "s-product-size-guide-block" }, index$1.h("salla-modal", { id: 'salla-product-size-guide-modal', isLoading: true, "has-skeleton": true, width: "md", ref: modal => this.modal = modal }, index$1.h("div", { slot: "loading" }, index$1.h("div", { class: "s-product-size-guide-skeleton" }, index$1.h("salla-skeleton", { height: '15px', width: '25%' }), index$1.h("div", { class: "s-product-size-guide-skeleton-header" }, index$1.h("salla-skeleton", { height: '40px' }), index$1.h("salla-skeleton", { height: '40px' }), index$1.h("salla-skeleton", { height: '40px' }), index$1.h("salla-skeleton", { height: '40px' })), index$1.h("div", { class: "s-product-size-guide-skeleton-content" }, index$1.h("salla-skeleton", { height: '15px', width: '25%' }), index$1.h("salla-skeleton", { height: '10px', width: '75%' }), index$1.h("salla-skeleton", { height: '10px', width: '50%' }), index$1.h("salla-skeleton", { height: '10px', width: '75%' }), index$1.h("salla-skeleton", { height: '10px', width: '100%' }), index$1.h("salla-skeleton", { height: '10px', width: '25%' }), index$1.h("salla-skeleton", { height: '10px', width: '60%' }), index$1.h("salla-skeleton", { height: '10px', width: '45%' }), index$1.h("salla-skeleton", { height: '10px', width: '30%' })))), index$1.h("slot", { name: "header" }), !this.hasError && !!this.guides ?
20447
+ [index$1.h("div", { class: "container px-8" }, index$1.h("salla-tabs", null, this.guides.map((guide) => index$1.h("salla-tab-header", { slot: "header", name: guide.name }, index$1.h("span", null, guide.name))), this.guides.map((guide) => index$1.h("salla-tab-content", { slot: "content", name: guide.name }, index$1.h("div", { innerHTML: guide.description })))))]
20448
+ : this.showPlaceholder(), index$1.h("slot", { name: "footer" }))));
20514
20449
  }
20515
20450
  get host() { return index$1.getElement(this); }
20516
20451
  };
@@ -20634,6 +20569,7 @@ const SallaRatingModal = class {
20634
20569
  */
20635
20570
  this.orderId = salla.config.get('page.id');
20636
20571
  this.translationLoaded = false;
20572
+ Helper$1.setHost(document);
20637
20573
  salla.event.on('rating::open', () => this.open());
20638
20574
  salla.lang.onLoaded(() => {
20639
20575
  this.translationLoaded = true;
@@ -20643,17 +20579,22 @@ const SallaRatingModal = class {
20643
20579
  * Show the rating modal
20644
20580
  */
20645
20581
  async open() {
20646
- return this.modal.open()
20647
- .then(() => this.order || salla.api.withoutNotifier(() => salla.rating.api.order(this.orderId)).then(res => this.order = res.data))
20648
- .then(() => this.modal.setTitle(salla.lang.get('pages.rating.rate_order') + ' <span class="unicode">(#' + this.order.id + ')</span>'))
20649
- .then(() => this.modal.stopLoading())
20650
- .then(() => this.stepsCount = [this.order.testimonials_enabled, this.order.products_enabled, this.order.shipping_enabled].filter(enabled => enabled).length)
20651
- .then(() => setTimeout(() => this.handleWizard(), 100))
20582
+ this.modal.open();
20583
+ return await salla.api.withoutNotifier(() => salla.rating.api.order(this.orderId))
20584
+ .then(res => this.order = res.data)
20652
20585
  .catch(e => {
20653
20586
  var _a, _b, _c, _d;
20654
20587
  this.hasError = true;
20655
20588
  this.errorMessage = ((_c = (_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.error) === null || _c === void 0 ? void 0 : _c.message) || ((_d = e.response) === null || _d === void 0 ? void 0 : _d.data);
20656
- this.modal.stopLoading();
20589
+ })
20590
+ .finally(() => {
20591
+ var _a, _b, _c;
20592
+ this.modal.setTitle(`${salla.lang.get('pages.rating.rate_order')} <span class="unicode">${!!this.order ? `(#${this.order.id})` : ''}</span>`);
20593
+ this.stepsCount = [(_a = this.order) === null || _a === void 0 ? void 0 : _a.testimonials_enabled, (_b = this.order) === null || _b === void 0 ? void 0 : _b.products_enabled, (_c = this.order) === null || _c === void 0 ? void 0 : _c.shipping_enabled].filter(enabled => enabled).length;
20594
+ setTimeout(() => this.handleWizard(), 100);
20595
+ setTimeout(() => {
20596
+ this.modal.stopLoading();
20597
+ }, 1000);
20657
20598
  });
20658
20599
  }
20659
20600
  /**
@@ -20682,7 +20623,7 @@ const SallaRatingModal = class {
20682
20623
  let nextType = (_a = this.steps[this.currentIndex + 1]) === null || _a === void 0 ? void 0 : _a.dataset.type;
20683
20624
  (_b = this.nextBtn) === null || _b === void 0 ? void 0 : _b.setText(nextType ? salla.lang.get('pages.rating.rate') + ' ' + salla.lang.get('pages.rating.' + nextType)
20684
20625
  : salla.lang.get('pages.rating.send_ratings'));
20685
- setTimeout(() => { var _a, _b; return (_a = this.body) === null || _a === void 0 ? void 0 : _a.setAttribute('style', 'height:' + ((_b = this.currentTab) === null || _b === void 0 ? void 0 : _b.offsetHeight) + 'px'); });
20626
+ setTimeout(() => { var _a, _b; return (_a = this.body) === null || _a === void 0 ? void 0 : _a.setAttribute('style', 'height:' + ((_b = this.currentTab) === null || _b === void 0 ? void 0 : _b.scrollHeight) + 'px'); });
20686
20627
  }
20687
20628
  previousTab() {
20688
20629
  this.currentIndex > 0 && this.currentIndex--;
@@ -20768,7 +20709,7 @@ const SallaRatingModal = class {
20768
20709
  ? index$1.h("div", { class: "s-rating-modal-rounded-icon" }, index$1.h("img", { src: this.order.shipping.company.logo, class: "s-rating-modal-shipping-logo", alt: this.order.shipping.company.name }))
20769
20710
  : index$1.h("span", { class: "s-rating-modal-icon", innerHTML: ShippingFast }), index$1.h("div", { class: "s-rating-modal-title" }, " ", salla.lang.get('pages.rating.rate_shipping') + ' ' + this.order.shipping.company.name), index$1.h("div", { class: "s-rating-modal-stars-company" }, index$1.h("salla-rating-stars", { size: "large" })), index$1.h("textarea", { name: "comment", class: "s-rating-modal-comment", placeholder: salla.lang.get('pages.rating.write_shipping_rate') }), index$1.h("small", { class: "s-rating-modal-validation-msg" }))
20770
20711
  : '', index$1.h("div", { class: "s-rating-modal-thanks s-rating-modal-hidden", ref: el => this.thanksTab = el }, index$1.h("span", { class: "s-rating-modal-icon", innerHTML: CheckCircle2 }), index$1.h("h3", { class: "s-rating-modal-thanks-title" }, salla.lang.get('pages.rating.thanks')), index$1.h("div", { class: "s-rating-modal-thanks-msg", innerHTML: this.order.thanks_message }), index$1.h("time", { class: "s-rating-modal-thanks-time", ref: el => this.thanksTime = el }))), index$1.h("div", { class: "s-rating-modal-footer" }, index$1.h("button", { ref: el => this.backBtn = el, onClick: () => this.previousTab(), class: "s-rating-modal-btn s-rating-modal-unvisiable" }, salla.lang.get('common.elements.back')), this.stepsCount > 1 ? index$1.h("ul", { class: "s-rating-modal-dots" }, [0, 1, 2].slice(0, this.stepsCount).map(() => index$1.h("li", { class: 's-rating-modal-bg-gray s-rating-modal-step-dot' }))) : '', index$1.h("salla-button", { "loader-position": 'center', ref: el => this.nextBtn = el, onClick: () => this.submit() }, salla.lang.get('common.elements.next'))),]
20771
- : index$1.h("salla-placeholder", { alignment: "center" }))));
20712
+ : '')));
20772
20713
  }
20773
20714
  componentDidLoad() {
20774
20715
  salla.event.dispatch('rating::ready', this);
@@ -20871,7 +20812,8 @@ const SallaSearch = class {
20871
20812
  * Sets the height of the input
20872
20813
  */
20873
20814
  this.height = 60;
20874
- this.productSlot = ((_a = this.host.querySelector('[slot="product"]')) === null || _a === void 0 ? void 0 : _a.innerHTML) || this.getDefaultProductSlot();
20815
+ Helper$1.setHost(this.host);
20816
+ this.productSlot = ((_a = Helper$1.getElement('[slot="product"]')) === null || _a === void 0 ? void 0 : _a.innerHTML) || this.getDefaultProductSlot();
20875
20817
  salla.event.on('search::open', () => this.open());
20876
20818
  salla.lang.onLoaded(() => {
20877
20819
  this.translationLoaded = true;
@@ -20921,7 +20863,7 @@ const SallaSearch = class {
20921
20863
  }
20922
20864
  }
20923
20865
  search(val) {
20924
- this.noResults.style.display = 'none';
20866
+ Helper$1.hideElement(this.noResults);
20925
20867
  //run loading spinner or stop it
20926
20868
  this.loading = true;
20927
20869
  salla.product.search(val)
@@ -21042,7 +20984,7 @@ const SallaSocialShare = class {
21042
20984
  index$1.registerInstance(this, hostRef);
21043
20985
  this.opened = false;
21044
20986
  this.allPlatforms = [Socials.WHATSAPP, Socials.FACEBOOK, Socials.TWITTER, Socials.EMAIL, Socials.COPY_LINK];
21045
- this.platformIcons = [{ icon: whatsapp, name: Socials.WHATSAPP }, { icon: facebook, name: Socials.FACEBOOK }, { icon: twitter, name: Socials.TWITTER }, { icon: MailIcon, name: Socials.EMAIL }, { icon: copy_link, name: Socials.COPY_LINK }];
20987
+ this.platformIcons = [{ icon: whatsapp, name: Socials.WHATSAPP }, { icon: facebook, name: Socials.FACEBOOK }, { icon: twitter, name: Socials.TWITTER }, { icon: email, name: Socials.EMAIL }, { icon: copy_link, name: Socials.COPY_LINK }];
21046
20988
  /**
21047
20989
  * page url that will be shared custom | current page url
21048
20990
  */
@@ -26102,7 +26044,6 @@ const SallaSwiper = class {
26102
26044
  }
26103
26045
  initSwiper() {
26104
26046
  for (const slide of this.swiperWrapper.children) {
26105
- //todo:: use `s-swiper-slide`
26106
26047
  slide.classList.add('swiper-slide');
26107
26048
  }
26108
26049
  this.swiper = new Swiper(this.swiperContainer, {
@@ -27642,7 +27583,7 @@ const SallaTelInput = class {
27642
27583
  /**
27643
27584
  * Current country_code
27644
27585
  */
27645
- this.countryCode = salla.config.get('user.country_code', 'SA') || 'SA';
27586
+ this.countryCode = salla.config.get('user.country_code', 'SA');
27646
27587
  this.countryCodeLabel = salla.lang.get('common.country_code');
27647
27588
  this.mobileLabel = salla.lang.get('common.elements.mobile');
27648
27589
  this.tooShort = salla.lang.get('common.errors.too_short', { attribute: this.mobileLabel });
@@ -27650,6 +27591,7 @@ const SallaTelInput = class {
27650
27591
  this.invalidCountryCode = salla.lang.get('common.errors.invalid_value', { attribute: this.countryCodeLabel });
27651
27592
  this.invalidNumber = salla.lang.get('common.errors.invalid_value', { attribute: this.mobileLabel });
27652
27593
  this.errorMap = [this.invalidNumber, this.invalidCountryCode, this.tooShort, this.tooLong, this.invalidNumber];
27594
+ Helper$1.setHost(this.host);
27653
27595
  salla.lang.onLoaded(() => {
27654
27596
  this.mobileLabel = salla.lang.get('common.elements.mobile');
27655
27597
  this.countryCodeLabel = salla.lang.get('common.elements.country_code');
@@ -27736,64 +27678,6 @@ const SallaTelInput = class {
27736
27678
  };
27737
27679
  SallaTelInput.style = sallaTelInputCss;
27738
27680
 
27739
- const Bullhorn = `<!-- Generated by IcoMoon.io -->
27740
- <svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">
27741
- <title>bullhorn</title>
27742
- <path d="M30.129 0.264c-0.339-0.252-0.776-0.328-1.179-0.208l-24.951 7.485v-0.216c0-0.736-0.597-1.333-1.333-1.333s-1.333 0.597-1.333 1.333v14.667c0 0.736 0.597 1.333 1.333 1.333s1.333-0.597 1.333-1.333v-0.112l3.448 1.207-0.595 1.704c-0.321 1.019-0.227 2.103 0.267 3.051s1.327 1.647 2.345 1.968l6.359 2.004c0.399 0.127 0.804 0.187 1.201 0.187 1.699 0 3.277-1.091 3.812-2.785l0.423-1.295 7.633 2.672c0.143 0.049 0.292 0.075 0.44 0.075 0.273 0 0.543-0.084 0.772-0.247 0.352-0.249 0.561-0.655 0.561-1.087v-28c0-0.421-0.199-0.819-0.537-1.069zM18.297 28.4c-0.221 0.701-0.973 1.089-1.673 0.871l-6.357-2.004c-0.34-0.108-0.617-0.34-0.781-0.656s-0.196-0.676-0.101-0.977l0.581-1.665 8.777 3.072zM28 27.453l-24-8.4v-8.728l24-7.2z"></path>
27743
- </svg>
27744
- `;
27745
-
27746
- const UserOff = `<!-- Generated by IcoMoon.io -->
27747
- <svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">
27748
- <title>user-off</title>
27749
- <path d="M10.837 19.309c-4.963 1.284-8.171 4.303-8.171 7.691v3.667c0 0.736 0.597 1.333 1.333 1.333s1.333-0.597 1.333-1.333v-3.667c0-2.101 2.48-4.155 6.172-5.109 0.713-0.184 1.141-0.912 0.957-1.625-0.184-0.711-0.908-1.137-1.625-0.956zM12.859 3.715c0.933-0.685 2.020-1.048 3.141-1.048 2.941 0 5.333 2.392 5.333 5.333 0 1.121-0.363 2.208-1.048 3.141-0.436 0.593-0.308 1.428 0.284 1.864 0.239 0.175 0.515 0.259 0.788 0.259 0.411 0 0.815-0.188 1.076-0.544 1.025-1.393 1.567-3.025 1.567-4.72 0-4.412-3.588-8-8-8-1.695 0-3.327 0.541-4.721 1.567-0.592 0.435-0.72 1.269-0.284 1.864 0.436 0.593 1.269 0.721 1.864 0.284zM31.609 29.724l-29.333-29.333c-0.521-0.521-1.364-0.521-1.885 0s-0.521 1.364 0 1.885l29.333 29.333c0.26 0.26 0.601 0.391 0.943 0.391s0.683-0.131 0.943-0.391c0.521-0.521 0.521-1.364 0-1.885z"></path>
27750
- </svg>
27751
- `;
27752
-
27753
- const sallaUserSettingsCss = "";
27754
-
27755
- const SallaUserSettings = class {
27756
- constructor(hostRef) {
27757
- index$1.registerInstance(this, hostRef);
27758
- // Texts
27759
- this.deactivateAccount = salla.lang.get('pages.profile.deactivate_account');
27760
- this.promotionalMsgs = salla.lang.get('pages.profile.promotional_messages');
27761
- this.deactivateDesc = salla.lang.get('pages.profile.deactivate_account_description');
27762
- this.promotionalMsgsDesc = salla.lang.get('pages.profile.promotional_messages_description');
27763
- this.sorryForLeavingText = salla.lang.get('pages.profile.warning_for_deactivate');
27764
- this.warningText = salla.lang.get('pages.profile.sorry_for_leaving');
27765
- this.keepAccount = salla.lang.get('pages.profile.keep_account');
27766
- this.buttonLoading = false;
27767
- this.isNotifiable = false;
27768
- salla.lang.onLoaded(() => {
27769
- this.deactivateAccount = salla.lang.get('pages.profile.deactivate_account');
27770
- this.promotionalMsgs = salla.lang.get('pages.profile.promotional_messages');
27771
- this.deactivateDesc = salla.lang.get('pages.profile.deactivate_account_description');
27772
- this.promotionalMsgsDesc = salla.lang.get('pages.profile.promotional_messages_description');
27773
- this.warningText = salla.lang.get('pages.profile.warning_for_deactivate');
27774
- this.sorryForLeavingText = salla.lang.get('pages.profile.sorry_for_leaving');
27775
- this.keepAccount = salla.lang.get('pages.profile.keep_account');
27776
- });
27777
- }
27778
- toggleNotification(event) {
27779
- salla.profile.updateSettings({ is_notifiable: event.target.checked });
27780
- }
27781
- capitalizeText(str) {
27782
- return str.charAt(0).toUpperCase() + str.slice(1);
27783
- }
27784
- openDeactivateModal() {
27785
- this.confirmationModal.setTitle(this.capitalizeText(this.deactivateAccount));
27786
- this.confirmationModal.open();
27787
- }
27788
- async deleteAccount() {
27789
- await salla.profile.delete().finally(() => this.confirmationModal.close());
27790
- }
27791
- render() {
27792
- return (index$1.h(index$1.Host, { class: "s-user-settings-wrapper" }, index$1.h("div", { class: "s-user-settings-section" }, index$1.h("salla-list-tile", null, index$1.h("div", { slot: "icon", class: "s-user-settings-section-icon" }, index$1.h("span", { innerHTML: Bullhorn })), index$1.h("div", { slot: "title", class: "s-user-settings-section-title" }, this.capitalizeText(this.promotionalMsgs)), index$1.h("div", { slot: "subtitle", class: "s-user-settings-section-subtitle" }, this.capitalizeText(this.promotionalMsgsDesc)), index$1.h("div", { slot: 'action', class: "s-user-settings-section-action" }, index$1.h("label", { class: "s-toggle" }, index$1.h("input", { class: "s-toggle-input", checked: this.isNotifiable, onChange: (e) => this.toggleNotification(e), type: "checkbox" }), index$1.h("div", { class: "s-toggle-switcher" }))))), index$1.h("div", { class: "s-user-settings-section" }, index$1.h("salla-list-tile", null, index$1.h("div", { slot: "icon", class: "s-user-settings-section-icon" }, index$1.h("span", { innerHTML: UserOff })), index$1.h("div", { slot: "title", class: "s-user-settings-section-title" }, this.capitalizeText(this.deactivateAccount)), index$1.h("div", { slot: "subtitle", class: "s-user-settings-section-subtitle" }, this.capitalizeText(this.deactivateDesc)), index$1.h("div", { slot: 'action', class: "s-user-settings-section-action" }, index$1.h("salla-button", { fill: "outline", color: "danger", shape: "btn", size: "medium", width: "normal", onClick: () => this.openDeactivateModal() }, this.capitalizeText(this.deactivateAccount))))), index$1.h("salla-modal", { width: "sm", subTitle: this.capitalizeText(this.sorryForLeavingText), ref: modal => this.confirmationModal = modal }, index$1.h("span", { slot: 'icon', class: "s-user-settings-confirmation-icon", innerHTML: UserOff }), index$1.h("div", { class: "s-user-settings-confirmation" }, index$1.h("div", { class: "s-user-settings-confirmation-warning" }, this.capitalizeText(this.warningText)), index$1.h("div", { class: "s-user-settings-confirmation-actions" }, index$1.h("salla-button", { width: "wide", onClick: () => this.confirmationModal.close() }, this.capitalizeText(this.keepAccount)), index$1.h("salla-button", { fill: 'outline', loading: this.buttonLoading, width: "wide", onClick: () => this.deleteAccount() }, this.capitalizeText(this.deactivateAccount)))))));
27793
- }
27794
- };
27795
- SallaUserSettings.style = sallaUserSettingsCss;
27796
-
27797
27681
  const AndroidPhoneIcon = `<!-- Generated by IcoMoon.io -->
27798
27682
  <svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">
27799
27683
  <title>android-phone</title>
@@ -27807,6 +27691,7 @@ const SallaVerify = class {
27807
27691
  constructor(hostRef) {
27808
27692
  index$1.registerInstance(this, hostRef);
27809
27693
  this.verified = index$1.createEvent(this, "verified", 7);
27694
+ this.initiated = false;
27810
27695
  this.translationLoaded = false;
27811
27696
  /**
27812
27697
  * Should render component without modal
@@ -27829,6 +27714,7 @@ const SallaVerify = class {
27829
27714
  * to use: `salla.api.auth.verify` or `salla.profile.verify`
27830
27715
  */
27831
27716
  this.isProfileVerify = false;
27717
+ // Helper.setHost(this.host);
27832
27718
  salla.lang.onLoaded(() => {
27833
27719
  var _a;
27834
27720
  this.translationLoaded = true;
@@ -27851,30 +27737,6 @@ const SallaVerify = class {
27851
27737
  this.timer.innerHTML = '30 : 00';
27852
27738
  });
27853
27739
  }
27854
- handleKeyUp(ev) {
27855
- var _a, _b, _c, _d;
27856
- if (['Alt', 'Shift', 'Control', 'AltGraph', 'Ctrl'].includes(ev.key)) {
27857
- return;
27858
- }
27859
- let key = ev.keyCode || ev.charCode;
27860
- if (ev.target.value) {
27861
- (_a = ev.target.nextElementSibling) === null || _a === void 0 ? void 0 : _a.focus();
27862
- (_b = ev.target.nextElementSibling) === null || _b === void 0 ? void 0 : _b.select();
27863
- }
27864
- else if ([8, 46].includes(key)) {
27865
- (_c = ev.target.previousElementSibling) === null || _c === void 0 ? void 0 : _c.focus();
27866
- (_d = ev.target.previousElementSibling) === null || _d === void 0 ? void 0 : _d.select();
27867
- }
27868
- this.toggleOTPSubmit();
27869
- }
27870
- handlePaste(ev) {
27871
- let text = salla.helpers.number(ev.clipboardData.getData('text'))
27872
- .replace(/[^0-9.]/g, '')
27873
- .replace('..', '.');
27874
- this.otpInputs.forEach((input, i) => input.value = text[i] || '');
27875
- this.toggleOTPSubmit();
27876
- setTimeout(() => this.otpInputs[3].focus(), 100);
27877
- }
27878
27740
  /**
27879
27741
  * Get current code
27880
27742
  * @return {string}
@@ -27893,6 +27755,30 @@ const SallaVerify = class {
27893
27755
  this.type = this.data.type;
27894
27756
  this.resendTimer();
27895
27757
  this.otpInputs = this.body.querySelectorAll('.s-verify-input');
27758
+ if (!this.initiated) {
27759
+ Helper$1.on('input', '.s-verify-input', e => salla.helpers.inputDigitsOnly(e.target));
27760
+ Helper$1.onKeyUp('.s-verify-input', event => {
27761
+ var _a, _b, _c, _d;
27762
+ let key = event.keyCode || event.charCode;
27763
+ if (event.target.value) {
27764
+ (_a = event.target.nextElementSibling) === null || _a === void 0 ? void 0 : _a.focus();
27765
+ (_b = event.target.nextElementSibling) === null || _b === void 0 ? void 0 : _b.select();
27766
+ }
27767
+ else if ([8, 46].includes(key)) {
27768
+ (_c = event.target.previousElementSibling) === null || _c === void 0 ? void 0 : _c.focus();
27769
+ (_d = event.target.previousElementSibling) === null || _d === void 0 ? void 0 : _d.select();
27770
+ }
27771
+ this.toggleOTPSubmit();
27772
+ });
27773
+ Helper$1.on('paste', '.s-verify-input', event => {
27774
+ let text = salla.helpers.number(event.clipboardData.getData('text')).replace(/[^0-9.]/g, '').replace('..', '.');
27775
+ this.otpInputs.forEach((input, i) => input.value = text[i] || '');
27776
+ this.toggleOTPSubmit();
27777
+ setTimeout(() => this.otpInputs[3].focus(), 100);
27778
+ });
27779
+ // return this.modal.open();
27780
+ this.initiated = true;
27781
+ }
27896
27782
  this.reset();
27897
27783
  this.display == 'modal' && ((_a = this.modal) === null || _a === void 0 ? void 0 : _a.setTitle(this.title));
27898
27784
  this.modal.open();
@@ -27916,14 +27802,12 @@ const SallaVerify = class {
27916
27802
  this.otpInputs[0].focus();
27917
27803
  }
27918
27804
  resendTimer() {
27919
- this.resendMessage.style.display = 'block';
27920
- this.resend.style.display = 'none';
27805
+ Helper$1.showElement(this.resendMessage).hideElement(this.resend);
27921
27806
  this.resendAfter = 30;
27922
27807
  let timerId = setInterval(() => {
27923
27808
  if (this.resendAfter <= 0) {
27924
27809
  clearInterval(timerId);
27925
- this.resend.style.display = 'block';
27926
- this.resendMessage.style.display = 'none';
27810
+ Helper$1.hideElement(this.resendMessage).showElement(this.resend);
27927
27811
  }
27928
27812
  else {
27929
27813
  this.timer.innerHTML = `${this.resendAfter >= 10 ? this.resendAfter : '0' + this.resendAfter} : 00`;
@@ -27942,12 +27826,6 @@ const SallaVerify = class {
27942
27826
  .finally(() => this.resendTimer());
27943
27827
  }
27944
27828
  submit() {
27945
- //if code not 4 digits, focus on the after filled input,
27946
- if (this.code.value.length < 4) {
27947
- this.otpInputs[this.code.value.length].focus();
27948
- salla.log('Trying to submit without 4 digits!');
27949
- return;
27950
- }
27951
27829
  let data = Object.assign({ code: this.code.value }, this.data);
27952
27830
  return this.btn.load()
27953
27831
  .then(() => this.btn.disable())
@@ -27963,17 +27841,16 @@ const SallaVerify = class {
27963
27841
  }
27964
27842
  render() {
27965
27843
  return this.display == 'inline' ? index$1.h(index$1.Host, null, this.myBody()) :
27966
- index$1.h("salla-modal", { width: "xs", class: "s-verify", ref: modal => this.modal = modal, "modal-title": this.title }, index$1.h("span", { slot: 'icon', innerHTML: this.type == "mobile" ? AndroidPhoneIcon : MailIcon }), this.myBody());
27844
+ index$1.h("salla-modal", { width: "xs", class: "s-verify", ref: modal => this.modal = modal, "modal-title": this.title }, index$1.h("span", { slot: 'icon', innerHTML: AndroidPhoneIcon }), this.myBody());
27967
27845
  }
27968
27846
  myBody() {
27969
- return (index$1.h("div", { class: "s-verify-body", ref: body => this.body = body }, index$1.h("div", { class: "s-verify-message", innerHTML: salla.lang.get('pages.profile.verify_message') }), index$1.h("input", { type: "hidden", name: "code", maxlength: "4", required: true, ref: code => this.code = code }), index$1.h("div", { class: "s-verify-codes", dir: "ltr" }, [1, 2, 3, 4].map(() => index$1.h("input", { type: "tel", autocomplete: "one-time-code", pattern: "[0-9]*", inputmode: "numeric", maxlength: "1", class: "s-verify-input", onInput: e => salla.helpers.inputDigitsOnly(e.target), onPaste: e => this.handlePaste(e), onKeyUp: e => this.handleKeyUp(e), required: true }))), index$1.h("div", { slot: "footer", class: "s-verify-footer" }, index$1.h("salla-button", { class: "s-verify-submit", "loader-position": 'center', disabled: true, onClick: () => this.submit(), ref: b => this.btn = b }, salla.lang.get('pages.profile.verify')), index$1.h("p", { class: "s-verify-resend-message", ref: el => this.resendMessage = el }, salla.lang.get('blocks.header.resend_after'), index$1.h("b", { class: "s-verify-timer", ref: el => this.timer = el })), index$1.h("a", { href: "#", class: "s-verify-resend", onClick: () => this.resendCode(), ref: el => this.resend = el }, salla.lang.get('blocks.comments.submit'))), index$1.h("slot", { name: "after-footer" })));
27847
+ return (index$1.h("div", { class: "s-verify-body", ref: body => this.body = body }, index$1.h("div", { class: "s-verify-message", innerHTML: salla.lang.get('pages.profile.verify_message') }), index$1.h("input", { type: "hidden", name: "code", maxlength: "4", required: true, ref: code => this.code = code }), index$1.h("div", { class: "s-verify-codes", dir: "ltr" }, [1, 2, 3, 4].map(() => index$1.h("input", { type: "tel", autocomplete: "one-time-code", pattern: "[0-9]*", inputmode: "numeric", maxlength: "1", class: "s-verify-input", required: true }))), index$1.h("div", { slot: "footer", class: "s-verify-footer" }, index$1.h("salla-button", { class: "s-verify-submit", "loader-position": 'center', disabled: true, onClick: () => this.submit(), ref: b => this.btn = b }, salla.lang.get('pages.profile.verify')), index$1.h("p", { class: "s-verify-resend-message", ref: el => this.resendMessage = el }, salla.lang.get('blocks.header.resend_after'), index$1.h("b", { class: "s-verify-timer", ref: el => this.timer = el }), " "), index$1.h("a", { href: "#", class: "s-verify-resend", onClick: () => this.resendCode(), ref: el => this.resend = el }, salla.lang.get('blocks.comments.submit'))), index$1.h("slot", { name: "after-footer" })));
27970
27848
  }
27971
27849
  get host() { return index$1.getElement(this); }
27972
27850
  };
27973
27851
  SallaVerify.style = sallaVerifyCss;
27974
27852
 
27975
27853
  exports.salla_button = SallaButton;
27976
- exports.salla_cart_summary = SallaCartSummary;
27977
27854
  exports.salla_datetime_picker = SallaDatetimePicker;
27978
27855
  exports.salla_file_upload = SallaFileUpload;
27979
27856
  exports.salla_gifting = SallaGifting;
@@ -27999,5 +27876,4 @@ exports.salla_tab_content = SallaTabContent;
27999
27876
  exports.salla_tab_header = SallaTabHeader;
28000
27877
  exports.salla_tabs = SallaTabs;
28001
27878
  exports.salla_tel_input = SallaTelInput;
28002
- exports.salla_user_settings = SallaUserSettings;
28003
27879
  exports.salla_verify = SallaVerify;