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

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 (124) hide show
  1. package/dist/cjs/{index-ccab76e9.js → index-a7bec25d.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-3020d26f.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-1cc8829f.js → index-3020d26f.js} +2 -2
  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-0db2b810.entry.js +4 -0
  74. package/dist/twilight/{p-2b8f1167.entry.js → p-10ac9c79.entry.js} +1 -1
  75. package/dist/twilight/{p-06ecc027.entry.js → p-13129ac9.entry.js} +1 -1
  76. package/dist/twilight/{p-f0415183.system.entry.js → p-1914490f.system.entry.js} +1 -1
  77. package/dist/twilight/p-24e726cc.system.entry.js +34 -0
  78. package/dist/twilight/{p-3feb37f5.system.entry.js → p-26a23097.system.entry.js} +1 -1
  79. package/dist/twilight/p-48b393ab.js +24 -0
  80. package/dist/twilight/{p-092ad6d4.entry.js → p-521b6fde.entry.js} +1 -1
  81. package/dist/twilight/p-65c324c0.system.js +24 -0
  82. package/dist/twilight/{p-bac267ae.entry.js → p-97daba27.entry.js} +1 -1
  83. package/dist/twilight/{p-a1cd00a6.system.entry.js → p-a7caaba3.system.entry.js} +1 -1
  84. package/dist/twilight/{p-20584294.entry.js → p-bbc94b9b.entry.js} +1 -1
  85. package/dist/twilight/p-ca68752d.js +5 -0
  86. package/dist/twilight/p-ce3e3fa2.system.entry.js +4 -0
  87. package/dist/twilight/p-d64f3123.entry.js +22 -0
  88. package/dist/twilight/p-db0ba553.system.js +5 -0
  89. package/dist/twilight/{p-f7bb47ef.system.entry.js → p-dd9b3c90.system.entry.js} +1 -1
  90. package/dist/twilight/{p-a82f8d33.system.entry.js → p-f610b6bf.system.entry.js} +1 -1
  91. package/dist/twilight/p-f6171fb9.system.js +4 -0
  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/salla-button_29.entry.js +0 -34
  114. package/dist/twilight/p-2bdd14ea.entry.js +0 -22
  115. package/dist/twilight/p-a058465b.system.js +0 -24
  116. package/dist/twilight/p-a2cc9062.entry.js +0 -4
  117. package/dist/twilight/p-b95c5d8c.system.entry.js +0 -34
  118. package/dist/twilight/p-c571b40b.js +0 -5
  119. package/dist/twilight/p-ca961962.system.js +0 -5
  120. package/dist/twilight/p-ee91a41b.system.js +0 -4
  121. package/dist/twilight/p-f59fe82e.js +0 -24
  122. package/dist/twilight/p-f99821d3.system.entry.js +0 -4
  123. package/dist/types/components/salla-cart-summary/salla-cart-summary.d.ts +0 -6
  124. package/dist/types/components/salla-user-settings/salla-user-settings.d.ts +0 -18
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import { r as registerInstance, h, H as Host, g as getElement, c as createEvent } from './index-03197930.js';
4
+ import { r as registerInstance, h, H as Host, g as getElement, c as createEvent } from './index-0ce70ad2.js';
5
5
  import { a as createCommonjsModule, c as commonjsGlobal, g as getDefaultExportFromCjs } from './_commonjsHelpers-1415ffd3.js';
6
6
  import { S as Search } from './search-19ea3313.js';
7
7
 
@@ -114,31 +114,6 @@ const SallaButton = class {
114
114
  };
115
115
  SallaButton.style = sallaButtonCss;
116
116
 
117
- const CartIcon = `<!-- Generated by IcoMoon.io -->
118
- <svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="30" height="32" viewBox="0 0 30 32">
119
- <title>cart</title>
120
- <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>
121
- </svg>
122
- `;
123
-
124
- const sallaCartSummaryCss = ":host{display:block}";
125
-
126
- const SallaCartSummary = class {
127
- constructor(hostRef) {
128
- registerInstance(this, hostRef);
129
- this.cartSummaryCount = 0;
130
- this.cartSummaryTotal = 0;
131
- salla.cart.event.onUpdated(() => {
132
- this.cartSummaryCount = salla.storage.get('cart.summary.count');
133
- this.cartSummaryCount = salla.storage.get('cart.summary.total');
134
- });
135
- }
136
- render() {
137
- return (h(Host, null, h("a", { class: "s-cart-summary", href: salla.url.get('cart') }, h("slot", { name: "icon" }, h("i", { class: "s-cart-summary-icon", innerHTML: CartIcon })), h("span", { class: "s-cart-summary-count" }, salla.helpers.number(this.cartSummaryCount)), h("b", { class: "s-cart-summary-total" }, salla.money(this.cartSummaryTotal)))));
138
- }
139
- };
140
- SallaCartSummary.style = sallaCartSummaryCss;
141
-
142
117
  var HOOKS = [
143
118
  "onChange",
144
119
  "onClose",
@@ -18876,10 +18851,6 @@ const SallaGifting = class {
18876
18851
  * Show the gifting modal window
18877
18852
  */
18878
18853
  async open() {
18879
- if (salla.config.isGuest()) {
18880
- salla.event.dispatch('login::open');
18881
- return;
18882
- }
18883
18854
  this.modal.open();
18884
18855
  return await salla.api.withoutNotifier(() => salla.product.getGiftDetails(this.productId))
18885
18856
  .then((response) => {
@@ -18888,7 +18859,7 @@ const SallaGifting = class {
18888
18859
  })
18889
18860
  .catch(e => {
18890
18861
  var _a, _b, _c, _d;
18891
- this.hasError = true;
18862
+ this.hasError = false;
18892
18863
  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);
18893
18864
  })
18894
18865
  .finally(() => this.modal.stopLoading());
@@ -19156,12 +19127,12 @@ const SallaGifting = class {
19156
19127
  var _a, _b;
19157
19128
  return [
19158
19129
  h("div", null, h("salla-list-tile", { class: "s-gifting-widget" }, h("div", { slot: "title" }, h("h3", null, this.sectionTitle)), h("div", { slot: "subtitle" }, h("div", null, this.sectionSubtitle)), h("div", { slot: "action" }, h("salla-button", { class: "s-gifting-widget-action", color: "gray", onClick: () => this.open() }, h("span", { innerHTML: GiftSharing }), " \u00A0", h("span", null, this.sectionBtnText)))), h("salla-modal", { id: 'salla-gifting-modal', isLoading: true, class: "s-gifting-modal", width: "sm", ref: modal => this.modal = modal }, h("div", { slot: "loading" }, h("div", { class: "s-gifting-skeleton" }, h("div", { class: "s-gifting-modal-header" }, h("salla-skeleton", { type: 'circle', height: '5rem', width: '5rem' }), h("h2", { class: "s-gifting-modal-title" }, h("div", { class: "s-gifting-modal-badge-wrapper" }, h("salla-skeleton", { height: '15px', width: '150px' })))), h("div", { class: "s-gifting-skeleton-content" }, h("salla-skeleton", { height: '10px', width: '150px' }), h("salla-skeleton", { height: '230px' }), h("salla-skeleton", { height: '10px', width: '150px' }), h("salla-skeleton", { height: '30px' }), h("salla-skeleton", { height: '40px' })))), h("slot", { name: "header" }), !!this.hasError ?
19159
- h("salla-placeholder", { alignment: "center" }, h("span", { slot: "title" }, this.errorMessage || salla.lang.get('common.errors.empty_results')), h("span", { slot: "description" }, " "))
19130
+ h("salla-placeholder", { alignment: "center" }, h("span", { slot: "description" }, this.errorMessage))
19160
19131
  :
19161
19132
  [
19162
19133
  h("div", { class: "s-gifting-modal-header" }, h("span", { class: "s-gifting-modal-icon" }, h("span", { innerHTML: GiftSharing })), h("h2", { class: "s-gifting-modal-title" }, h("div", { class: "s-gifting-modal-badge-wrapper" }, h("div", { class: "s-gifting-modal-badge" }, h("span", null, h("span", null, this.currentStep), "/2")), h("span", null, this.giftDetails)))),
19163
19134
  h("div", { class: "s-gifting-steps-wrapper steps-wrapper" }, h("div", { class: "s-gifting-step-one gift-step-1" }, h("div", { class: "s-gifting-modal-uploader-title anime-item" }, this.selectImageForYourGift), h("div", { class: "s-gifting-modal-uploader anime-item" }, h("span", { class: "s-gifting-remove-preview", onClick: () => this.removePreview(), innerHTML: Cancel }), this.selectImageOrUpload && h("salla-file-upload", { "instant-upload": true, labelIdle: this.getFilepondPlaceholder(), serverConfig: this.getServerConfig(), onRemove: () => this.handleRemoveImage() }, " ")), h("div", { class: "anime-item" }, !this.uploadedImage && !!this.gift && this.gift.gift_images.length > 0 ?
19164
- h("salla-swiper", { "space-between-items": "10" }, (_a = this.gift) === null || _a === void 0 ? void 0 : _a.gift_images.map((item) => h("img", { class: "s-gifting-image s-gifting-clickable", src: item.url, onClick: () => this.setPreview(item), alt: `${item.id}` })))
19135
+ 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) => h("img", { class: "s-gifting-image s-gifting-clickable", src: item.url, onClick: () => this.setPreview(item), alt: `${item.id}` })))
19165
19136
  : ""), h("div", { class: "anime-item" }, h("div", { class: "s-form-group s-gifting-selectText" }, h("label", { htmlFor: "gift-text-selection", class: "s-form-label" }, this.selectGiftMessage), h("select", { id: "gift-text-selection", name: "gift-text-selection", class: "s-form-control s-gifting-select", onChange: e => this.toggleGiftText(e) }, h("option", { "data-id": null, selected: true }, this.selectGiftMessage), (_b = this.gift) === null || _b === void 0 ? void 0 :
19166
19137
  _b.gift_texts.map((txt) => h("option", { "data-id": txt.id, value: txt.text, key: txt.id }, txt.text)), h("option", { "data-id": "custom" }, this.giftCustomText))), h("div", { class: this.showGiftText ? "s-form-group s-gifting-textarea shown" : "s-form-group s-gifting-textarea hide" }, h("label", { htmlFor: "gift-custom-text", class: "s-form-label" }, this.giftCustomText), h("div", { class: "mt-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" })))), h("div", { class: "anime-item" }, h("salla-button", { color: "primary", width: "wide", onClick: () => this.goToStep2() }, h("span", null, this.nextStep)))), h("div", { class: "s-gifting-step-two gift-step-2" }, 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" }, h("label", { htmlFor: "sender_name", class: "s-form-label" }, this.senderNameLabel), 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'] ? h("span", { class: "text-danger text-xs" }, this.errors['sender_name']) : ''), 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" }, h("label", { htmlFor: "receiver_name", class: "s-form-label" }, this.receiverNameFieldLabel), 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'] ? h("span", { class: "text-danger text-xs" }, this.errors['receiver.name']) : ''), 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" }, h("label", { class: "s-form-label" }, this.receiverMobileFieldLabel), 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'] ? h("span", { class: "text-danger text-xs" }, this.errors['receiver.mobile']) : ''), h("div", { class: "anime-item opacity-0" }, h("label", { class: "s-gifting-schedule s-gifting-clickable", htmlFor: "schedule" }, h("input", { type: "checkbox", name: 'schedule', id: 'schedule', onChange: () => this.toggleCalendar(), class: "s-checkbox" }), h("span", { class: "s-form-label" }, " ", this.sendLater, " "))), h("div", { class: this.getCalendarClasses() }, h("label", { class: "s-form-label" }, this.selectSendDateAndTime), 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) }), h("span", { class: "s-gifting-calendar-hint" }, this.canNotEditOrderAfterSelectDate)), h("div", { class: "s-gifting-step-two-footer anime-item opacity-0" }, h("a", { href: "#!", innerHTML: this.currentLang == 'ar' ? ArrowRightIcon : ArrowLeftIcon, onClick: () => this.goToStep1() }), h("salla-button", { onClick: () => this.submitForm(), color: "primary", width: 'wide' }, h("span", null, this.sendGift)))))
19167
19138
  ], h("slot", { name: "footer" })))
@@ -19170,31 +19141,24 @@ const SallaGifting = class {
19170
19141
  };
19171
19142
  SallaGifting.style = sallaGiftingCss;
19172
19143
 
19173
- //TODO::check why there are too much listeners for languages::translations.loaded
19174
- salla.event.setMaxListeners(20);
19175
- class Helper {
19176
- toggleElementClassIf(element, classes1, classes2, callback) {
19177
- classes1 = Array.isArray(classes1) ? classes1 : classes1.split(' ');
19178
- classes2 = Array.isArray(classes2) ? classes2 : classes2.split(' ');
19179
- let isClasses1 = callback(element);
19180
- element === null || element === void 0 ? void 0 : element.classList.remove(...(isClasses1 ? classes2 : classes1));
19181
- element === null || element === void 0 ? void 0 : element.classList.add(...(isClasses1 ? classes1 : classes2));
19182
- return this;
19144
+ class Helper extends salla.AppHelpers {
19145
+ setHost(host) {
19146
+ // @ts-ignore
19147
+ this.host = host;
19183
19148
  }
19184
- toggleClassIf(selector, classes1, classes2, callback) {
19185
- document.querySelectorAll(selector).forEach(element => this.toggleElementClassIf(element, classes1, classes2, callback));
19186
- return this;
19149
+ getElement(selector) {
19150
+ // @ts-ignore
19151
+ return this.host.querySelector(selector);
19187
19152
  }
19188
- isValidEmail(email) {
19189
- 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,}))$/;
19190
- return re.test(String(email).toLowerCase());
19153
+ getAttribute(selector, attribute) {
19154
+ var _a;
19155
+ return (_a = this.getElement(selector)) === null || _a === void 0 ? void 0 : _a.getAttribute(attribute);
19191
19156
  }
19192
- debounce(fn, ...data) {
19193
- if (!this.debounce_) {
19194
- this.debounce_ = Salla.helpers.debounce((callback, ...innerData) => callback(...innerData), 500);
19195
- }
19196
- //@ts-ignore
19197
- return this.debounce_(fn, ...data);
19157
+ val(selector) {
19158
+ return this.getAttribute(selector, 'value');
19159
+ }
19160
+ isUser() {
19161
+ return salla.config.get('user.type') === 'user';
19198
19162
  }
19199
19163
  }
19200
19164
  const Helper$1 = new Helper;
@@ -19220,6 +19184,7 @@ const SallaInfiniteScroll = class {
19220
19184
  * Class selector to know list items
19221
19185
  */
19222
19186
  this.item = 'salla-infinite-scroll > *';
19187
+ Helper$1.setHost(this.host);
19223
19188
  this.status = document.createElement('div');
19224
19189
  this.status.className = 's-infinite-scroll-wrapper';
19225
19190
  this.status.innerHTML = `<div class="s-infinite-scroll-status" style="display:none">
@@ -19352,6 +19317,7 @@ const SallaLocalizationModal = class {
19352
19317
  * Current currency (existing or newly selected)
19353
19318
  */
19354
19319
  this.currency = salla.config.get('user.currency_code');
19320
+ Helper$1.setHost(this.host);
19355
19321
  salla.event.on('localization::open', () => this.open());
19356
19322
  salla.lang.onLoaded(() => {
19357
19323
  this.translationLoaded = true;
@@ -19365,8 +19331,8 @@ const SallaLocalizationModal = class {
19365
19331
  * Because scoped templates not supported in stencil );
19366
19332
  * we made a workaround to pass language & currency attributes, then replace names in rendering
19367
19333
  */
19368
- 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>';
19369
- 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>';
19334
+ 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>';
19335
+ 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>';
19370
19336
  }
19371
19337
  /**
19372
19338
  * open the component
@@ -19469,7 +19435,7 @@ const PhoneIcon = `<!-- Generated by IcoMoon.io -->
19469
19435
  </svg>
19470
19436
  `;
19471
19437
 
19472
- const MailIcon = `<!-- Generated by IcoMoon.io -->
19438
+ const email = `<!-- Generated by IcoMoon.io -->
19473
19439
  <svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">
19474
19440
  <title>mail</title>
19475
19441
  <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>
@@ -19691,7 +19657,7 @@ const SallaLoginModal = class {
19691
19657
  // @ts-ignore
19692
19658
  // @ts-ignore
19693
19659
  return (h("salla-modal", { class: "s-login-modal", "modal-title": this.title, ref: modal => this.modal = modal, width: "xs" }, h("span", { slot: 'icon', class: "s-login-modal-header-icon", innerHTML: UserIcon }), h("div", { class: "s-login-modal-wrapper" }, this.isEmailAllowed && this.isMobileAllowed ?
19694
- h("div", { class: this.generateTabClasses('home'), "data-name": "home", ref: tab => this.homeTab = tab }, h("p", { class: "s-login-modal-sub-title" }, salla.lang.get('blocks.header.select_login_way')), h("slot", { name: "before-login-type" }), h("a", { href: "#", class: "s-login-modal-main-btn", onClick: (evt) => this.showTab(this.mobileTab, evt) }, h("span", { class: "s-login-modal-main-btn-icon", innerHTML: PhoneIcon }), h("span", { class: "s-login-modal-main-btn-text" }, salla.lang.get('blocks.header.sms')), h("span", { class: "s-login-modal-main-btn-arrow", innerHTML: KeyboardArrowRightIcon })), h("a", { href: "#", class: "s-login-modal-main-btn", onClick: (evt) => this.showTab(this.emailTab, evt) }, h("span", { class: "s-login-modal-main-btn-icon", innerHTML: MailIcon }), h("span", { class: "s-login-modal-main-btn-text" }, salla.lang.get('common.elements.email')), h("span", { class: "s-login-modal-main-btn-arrow", innerHTML: KeyboardArrowRightIcon })), h("slot", { name: "after-login-type" }))
19660
+ h("div", { class: this.generateTabClasses('home'), "data-name": "home", ref: tab => this.homeTab = tab }, h("p", { class: "s-login-modal-sub-title" }, salla.lang.get('blocks.header.select_login_way')), h("slot", { name: "before-login-type" }), h("a", { href: "#", class: "s-login-modal-main-btn", onClick: (evt) => this.showTab(this.mobileTab, evt) }, h("span", { class: "s-login-modal-main-btn-icon", innerHTML: PhoneIcon }), h("span", { class: "s-login-modal-main-btn-text" }, salla.lang.get('blocks.header.sms')), h("span", { class: "s-login-modal-main-btn-arrow", innerHTML: KeyboardArrowRightIcon })), h("a", { href: "#", class: "s-login-modal-main-btn", onClick: (evt) => this.showTab(this.emailTab, evt) }, h("span", { class: "s-login-modal-main-btn-icon", innerHTML: email }), h("span", { class: "s-login-modal-main-btn-text" }, salla.lang.get('common.elements.email')), h("span", { class: "s-login-modal-main-btn-arrow", innerHTML: KeyboardArrowRightIcon })), h("slot", { name: "after-login-type" }))
19695
19661
  : '', this.isMobileAllowed ?
19696
19662
  h("div", { class: this.generateTabClasses('login-phone'), "data-name": "login-phone", ref: tab => this.mobileTab = tab }, h("slot", { name: "before-login-mobile" }), h("form", { onSubmit: () => this.loginBySMS(event), method: "POST" }, h("label", { class: "s-login-modal-label" }, salla.lang.get('common.elements.mobile')), h("salla-tel-input", { tabindex: "0", ref: el => this.loginTelInput = el, onKeyDown: e => this.typing(e, this.loginBySMS) }), h("salla-button", { type: "submit", "loader-position": 'center', width: "wide", ref: b => this.smsBtn = b }, salla.lang.get('blocks.header.enter'))), this.isEmailAllowed ?
19697
19663
  h("a", { href: "#", onClick: () => this.showTab(this.emailTab), class: "s-login-modal-link" }, salla.lang.get('blocks.header.login_by_email')) : '', h("slot", { name: "after-login-mobile" })) : '', this.isEmailAllowed ?
@@ -20000,9 +19966,12 @@ const SallaModal = class {
20000
19966
  * Set the style of the header icon.
20001
19967
  */
20002
19968
  this.iconStyle = undefined;
19969
+ Helper$1.setHost(this.host);
20003
19970
  salla.event.on('modal::open', target => target == this.host.id && this.open());
20004
19971
  salla.event.on('modal::close', target => target == this.host.id && this.close());
20005
19972
  this.modalTitle = this.host.getAttribute('modal-title');
19973
+ // close modal on Escape button clicked
19974
+ Helper$1.onKeyUp(document.body, e => e.keyCode === 27 && this.closeModal());
20006
19975
  }
20007
19976
  handleVisible(newValue) {
20008
19977
  if (!newValue) {
@@ -20014,11 +19983,6 @@ const SallaModal = class {
20014
19983
  this.host.classList.remove('s-hidden');
20015
19984
  setTimeout(() => this.toggleModal(true)); //small amont of time to running toggle After adding hidden
20016
19985
  }
20017
- handleKeyUp(ev) {
20018
- if (ev.key === "KeyUp") {
20019
- this.closeModal();
20020
- }
20021
- }
20022
19986
  /**
20023
19987
  * Open the modal
20024
19988
  */
@@ -20086,15 +20050,15 @@ const SallaModal = class {
20086
20050
  render() {
20087
20051
  this.host.id = this.host.id || 'salla-modal';
20088
20052
  if (this.isLoading) {
20089
- return (h(Host, { class: 'salla-modal s-modal s-modal-container s-hidden', "aria-modal": "true", role: "dialog", onKeyUp: e => this.handleKeyUp(e) }, h("div", { class: "s-modal-overlay", ref: el => this.overlay = el, onClick: () => this.closeModal() }), h("div", { class: "s-modal-wrapper" }, h("span", { class: 's-modal-spacer s-modal-align-' + this.position }, "\u200B"), h("div", { class: 's-modal-body ' + 's-modal-align-' + this.position + ' s-modal-' + this.getWidth() + (this.noPadding ? ' s-modal-nopadding' : ' s-modal-padding') }, h("slot", { name: "loading" }, h("salla-loading", null)), h("div", { class: "s-hidden" }, h("slot", null))))));
20053
+ return (h(Host, { class: 'salla-modal s-modal s-modal-container s-hidden', "aria-modal": "true", role: "dialog" }, h("div", { class: "s-modal-overlay", ref: el => this.overlay = el, onClick: () => this.closeModal() }), h("div", { class: "s-modal-wrapper" }, h("span", { class: 's-modal-spacer s-modal-align-' + this.position }, "\u200B"), h("div", { class: 's-modal-body ' + 's-modal-align-' + this.position + ' s-modal-' + this.getWidth() + (this.noPadding ? ' s-modal-nopadding' : ' s-modal-padding') }, h("slot", { name: "loading" }, h("salla-loading", null)), h("div", { class: "s-hidden" }, h("slot", null))))));
20090
20054
  }
20091
20055
  return (h(Host, { class: 'salla-modal s-modal s-modal-container s-hidden', "aria-modal": "true", role: "dialog" }, h("div", { class: "s-modal-overlay", ref: el => this.overlay = el, onClick: () => this.closeModal() }), h("div", { class: "s-modal-wrapper" }, h("span", { class: 's-modal-spacer s-modal-align-' + this.position }, "\u200B"), h("div", { class: 's-modal-body ' + 's-modal-align-' + this.position + ' s-modal-' + this.getWidth() + (this.noPadding ? ' s-modal-nopadding' : ' s-modal-padding') }, h("div", { class: { 's-modal-header': true, 's-modal-is-center': this.centered } }, this.isClosable ?
20092
20056
  h("button", { class: "s-modal-close", onClick: () => this.closeModal(), type: "button" }, h("span", { innerHTML: Cancel }))
20093
20057
  : '', this.modalTitle || this.subTitle ?
20094
20058
  h("div", { class: "s-modal-header-inner" }, h("slot", { name: 'icon' }, !!this.iconStyle ?
20095
20059
  h("div", { class: this.iconBlockClasses(), innerHTML: this.iconStyle == 'error' ? AlertEngineIcon : CheckCircle2 })
20096
- : ''), h("div", { class: "s-modal-header-content" }, this.modalTitle ? h("div", { class: { 's-modal-title': true, 's-modal-title-below': this.subTitleFirst }, innerHTML: this.modalTitle }) : '', this.subTitle ? h("p", { class: { 's-modal-sub-title': true }, innerHTML: this.subTitle }) : ''))
20097
- : ''), h("slot", null), h("slot", { name: "footer" })))));
20060
+ : ''), h("div", { class: "s-modal-header-content" }, h("div", { class: { 's-modal-title': true, 's-modal-title-below': this.subTitleFirst }, innerHTML: this.modalTitle }), h("p", { class: { 's-modal-sub-title': true }, innerHTML: this.subTitle })))
20061
+ : ""), h("slot", null), h("slot", { name: "footer" })))));
20098
20062
  }
20099
20063
  //move the modal as root dom, because we need the model to be outside the forms
20100
20064
  componentDidLoad() {
@@ -20143,15 +20107,13 @@ const SallaOfferModal = class {
20143
20107
  this.offer = null;
20144
20108
  this.hasError = false;
20145
20109
  this.translationLoaded = false;
20146
- this.addToCartLabel = salla.lang.get("pages.cart.add_to_cart");
20147
- salla.event.on('offer-modal::open', product_id => this.open(product_id));
20110
+ Helper$1.setHost(this.host);
20111
+ salla.event.on('offer-modal::open', (product_id) => this.open(product_id));
20148
20112
  salla.lang.onLoaded(() => {
20149
- this.addToCartLabel = salla.lang.get("pages.cart.add_to_cart");
20150
20113
  this.translationLoaded = true;
20151
20114
  });
20152
- 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>`;
20153
- this.productSlot = ((_b = this.host.querySelector('[slot="product"]')) === null || _b === void 0 ? void 0 : _b.innerHTML) || this.defaultProductSlot();
20154
- salla.event.on('offer-modal::open', product_id => this.open(product_id));
20115
+ 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>`;
20116
+ this.productSlot = ((_b = Helper$1.getElement('[slot="product"]')) === null || _b === void 0 ? void 0 : _b.innerHTML) || this.defaultProductSlot();
20155
20117
  salla.product.event.onOfferExisted(offer => {
20156
20118
  if (salla.storage.get('remember-offer-' + offer.id)) {
20157
20119
  salla.log('User selected to don\'t show this offer again.');
@@ -20165,7 +20127,6 @@ const SallaOfferModal = class {
20165
20127
  * @param product_id
20166
20128
  */
20167
20129
  async open(product_id) {
20168
- this.productID = product_id;
20169
20130
  //TODO:: make sure there is only one offer
20170
20131
  this.modal.open();
20171
20132
  return salla.api.withoutNotifier(() => salla.product.offers(product_id))
@@ -20190,35 +20151,6 @@ const SallaOfferModal = class {
20190
20151
  rememberMe(event) {
20191
20152
  salla.storage.set('remember-offer-' + this.offer.id, event.target.checked);
20192
20153
  }
20193
- addToCart(qty) {
20194
- //todo:: add enhancement, to cover the previous quantity, because if the discount to add two, user already added one before.
20195
- salla.api.withoutNotifier(() => salla.cart.quickAdd(this.productID, qty)).then(() => this.modal.close());
20196
- }
20197
- getOfferContent() {
20198
- var _a, _b, _c, _d;
20199
- if ((_a = this.offer.get.products) === null || _a === void 0 ? void 0 : _a.length) {
20200
- return h("div", { class: "s-offer-modal-scrolled-slider-wrap" }, 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 => h("div", { class: {
20201
- "s-offer-modal-product": true,
20202
- "s-offer-modal-slider-item": true,
20203
- "s-offer-modal-not-available": !product.is_available
20204
- }, id: 'product_' + product.id, innerHTML: this.productSlot
20205
- .replace(/\{name\}/g, product.name)
20206
- .replace(/\{url\}/g, product.url)
20207
- .replace(/\{image\}/g, product.thumbnail)
20208
- .replace(/\{price\}/g, product.has_special_price
20209
- ? salla.money(product.price) + '<span class="s-offer-modal-product-old-price">' + salla.money(product.regular_price) + '</span>'
20210
- : salla.money(product.price)) }, h("div", { class: "s-offer-modal-btn-wrap" }, 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')))))), h("div", { class: "s-offer-modal-slider-nav" }, h("button", { class: "s-offer-modal-nav-btn s-offer-modal-prev-btn" }, h("span", { class: "s-offer-modal-nav-btn-icon", innerHTML: KeyboardArrowLeftIcon })), h("button", { class: "s-offer-modal-nav-btn s-offer-modal-next-btn" }, h("span", { class: "s-offer-modal-nav-btn-icon", innerHTML: KeyboardArrowRightIcon }))));
20211
- }
20212
- else if ((_c = this.offer.get.categories) === null || _c === void 0 ? void 0 : _c.length) {
20213
- return h("div", { class: "s-offer-modal-scrolled-slider-wrap" }, h("div", { class: "s-offer-modal-body s-offer-modal-scrolled-slider" }, this.offer.get.categories.map(category => h("a", { href: category.urls.customer, class: "s-offer-modal-badge s-offer-modal-slider-item", innerHTML: this.categorySlot
20214
- .replace(/\{tagIcon\}/g, Tag)
20215
- .replace(/\{name\}/g, category.name)
20216
- .replace(/\{url\}/g, category.urls.customer) }))), h("div", { class: "s-offer-modal-slider-nav" }, h("button", { class: "s-offer-modal-nav-btn s-offer-modal-prev-btn" }, h("span", { class: "s-offer-modal-nav-btn-icon", innerHTML: KeyboardArrowLeftIcon })), h("button", { class: "s-offer-modal-nav-btn s-offer-modal-next-btn" }, h("span", { class: "s-offer-modal-nav-btn-icon", innerHTML: KeyboardArrowRightIcon }))));
20217
- }
20218
- else if (this.offer.get.discounts_table) {
20219
- return h("div", { class: "s-offer-modal-discount-table" }, h("table", null, h("tbody", null, (_d = this.offer.get.discounts_table) === null || _d === void 0 ? void 0 : _d.map(discount => h("tr", null, h("td", null, discount.text), h("td", { class: "s-offer-modal-discount-table-cell" }, h("salla-button", { fill: "outline", shape: "btn", color: "primary", size: "medium", width: "normal", onClick: () => this.addToCart(discount.quantity) }, this.addToCartLabel)))))));
20220
- }
20221
- }
20222
20154
  //todo:: pass event then use sallaButton from it
20223
20155
  addItem() {
20224
20156
  // this here, is sallaButton
@@ -20235,17 +20167,28 @@ const SallaOfferModal = class {
20235
20167
  '</div>';
20236
20168
  }
20237
20169
  render() {
20170
+ var _a, _b;
20238
20171
  return h("salla-modal", { "sub-title-first": true, "has-skeleton": true, "sub-title": this.offer_message, ref: modal => this.modal = modal, isLoading: true }, h("div", { slot: 'loading' }, h("div", { class: "s-offer-modal-skeleton" }, h("div", { class: "s-offer-modal-skeleton-header" }, h("salla-skeleton", { type: 'circle', height: '80px', width: '80px' }), h("salla-skeleton", { height: '15px', width: '50%' }), h("salla-skeleton", { height: '10px', width: '30%' })), h("div", { class: "s-offer-modal-skeleton-items" }, [...Array(3)].map(() => h("div", { class: "s-offer-modal-skeleton-item" }, h("salla-skeleton", { height: '9rem' }), h("div", { class: "s-offer-modal-skeleton-item-title" }, h("salla-skeleton", { height: '15px', width: '100%' })), h("div", { class: "s-offer-modal-skeleton-item-subtitle" }, h("salla-skeleton", { height: '9px', width: '50%' }), h("div", { innerHTML: Cart2 }))))), h("div", { class: "s-offer-modal-skeleton-footer" }, h("salla-skeleton", { height: '15px', width: '50%' }), h("salla-skeleton", { height: '15px', width: '30%' })))), !this.hasError && this.offer !== null
20239
- ? [h("span", { slot: 'icon', class: "s-offer-modal-header-icon", innerHTML: SpecialDiscountIcon }), this.getOfferContent(), h("div", { class: "s-offer-modal-footer", slot: "footer" }, this.offer.formatted_date ?
20172
+ ? [h("span", { slot: 'icon', class: "s-offer-modal-header-icon", innerHTML: SpecialDiscountIcon }), h("div", { class: "s-offer-modal-scrolled-slider-wrap" }, h("div", { class: "s-offer-modal-body s-offer-modal-scrolled-slider" }, ((_a = this.offer.get.categories) === null || _a === void 0 ? void 0 : _a.length) > 0
20173
+ ? this.offer.get.categories.map(category => h("a", { href: category.urls.customer, class: "s-offer-modal-badge s-offer-modal-slider-item", innerHTML: this.categorySlot
20174
+ .replace(/\{tagIcon\}/g, Tag)
20175
+ .replace(/\{name\}/g, category.name)
20176
+ .replace(/\{url\}/g, category.urls.customer) }))
20177
+ : (_b = this.offer.get.products) === null || _b === void 0 ? void 0 : _b.map(product => 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
20178
+ .replace(/\{name\}/g, product.name)
20179
+ .replace(/\{url\}/g, product.url)
20180
+ .replace(/\{image\}/g, product.thumbnail)
20181
+ .replace(/\{price\}/g, product.has_special_price
20182
+ ? salla.money(product.price) + '<span class="s-offer-modal-product-old-price">' + salla.money(product.regular_price) + '</span>'
20183
+ : salla.money(product.price)) }, h("div", { class: "s-offer-modal-btn-wrap" }, 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')))))), h("div", { class: "s-offer-modal-slider-nav" }, h("button", { class: "s-offer-modal-nav-btn s-offer-modal-prev-btn" }, h("span", { class: "s-offer-modal-nav-btn-icon", innerHTML: KeyboardArrowLeftIcon })), h("button", { class: "s-offer-modal-nav-btn s-offer-modal-next-btn" }, h("span", { class: "s-offer-modal-nav-btn-icon", innerHTML: KeyboardArrowRightIcon })))), h("div", { class: "s-offer-modal-footer", slot: "footer" }, this.offer.formatted_date ?
20240
20184
  h("p", { class: "s-offer-modal-expiry" }, salla.lang.get('pages.products.offer_expires_in'), " ", this.offer.formatted_date)
20241
20185
  : '', h("label", { class: "s-offer-modal-remember-label" }, h("input", { type: "checkbox", onChange: e => this.rememberMe(e), class: "s-offer-modal-remember-input" }), "\u00A0 ", salla.lang.get('common.elements.remember_my_choice'))),
20242
20186
  ] :
20243
20187
  h("salla-placeholder", { class: "s-loyalty-placeholder", alignment: "center" }, !!this.errorMessage ? h("span", { slot: "description" }, this.errorMessage) : ''));
20244
20188
  }
20245
20189
  componentDidRender() {
20246
- var _a, _b;
20247
20190
  // Sooo mini Slider
20248
- 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) {
20191
+ if (this.offer && window.screen.width > 639) {
20249
20192
  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.
20250
20193
  current = 0, // current slide
20251
20194
  slidesToScroll = 3, itemsLength = items.length;
@@ -20306,7 +20249,7 @@ const SallaPlaceholder = class {
20306
20249
  registerInstance(this, hostRef);
20307
20250
  this.translationLoaded = false;
20308
20251
  /**
20309
- * Custom icon to display, defaults to [`Inbox`], can be any valid svg icon or inline element with font icon
20252
+ * Custom icon to display, defaults to [`sicon-inbox`]
20310
20253
  */
20311
20254
  this.icon = Inbox;
20312
20255
  /**
@@ -20314,7 +20257,7 @@ const SallaPlaceholder = class {
20314
20257
  */
20315
20258
  this.alignment = 'left';
20316
20259
  /**
20317
- * The size of the icon. Defaults to [`md`] = 45px for font icon & width/height: 3.5rem for svg icon
20260
+ * The size of the icon. Defaults to [`md`]
20318
20261
  */
20319
20262
  this.iconSize = 'md';
20320
20263
  salla.lang.onLoaded(() => {
@@ -20347,7 +20290,7 @@ const sallaProductAvailabilityCss = "";
20347
20290
  const SallaProductAvailability = class {
20348
20291
  constructor(hostRef) {
20349
20292
  registerInstance(this, hostRef);
20350
- this.isUser = salla.config.isUser();
20293
+ this.isUser = Helper$1.isUser();
20351
20294
  this.translationLoaded = false;
20352
20295
  /**
20353
20296
  * product id that can visitor subscribe to its availability notification
@@ -20452,19 +20395,13 @@ const SallaProductAvailability = class {
20452
20395
  };
20453
20396
  SallaProductAvailability.style = sallaProductAvailabilityCss;
20454
20397
 
20455
- const PencilRuler = `<!-- Generated by IcoMoon.io -->
20456
- <svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">
20457
- <title>pencil-ruler</title>
20458
- <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>
20459
- </svg>
20460
- `;
20461
-
20462
20398
  const sallaProductSizeGuideCss = "";
20463
20399
 
20464
20400
  const SallaProductSizeGuide = class {
20465
20401
  constructor(hostRef) {
20466
20402
  registerInstance(this, hostRef);
20467
20403
  this.hasError = false;
20404
+ Helper$1.setHost(document);
20468
20405
  salla.event.on('size-guide::open', (product_id) => this.open(product_id));
20469
20406
  salla.lang.onLoaded(() => {
20470
20407
  this.placeholder_title = salla.lang.get('pages.products.size_guide_placeholder');
@@ -20502,11 +20439,9 @@ const SallaProductSizeGuide = class {
20502
20439
  return h("salla-placeholder", { alignment: "center", iconSize: "xl" }, h("div", { slot: "title" }, this.placeholder_title), h("div", { slot: "description" }, this.placeholder_description));
20503
20440
  }
20504
20441
  render() {
20505
- return (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 }, h("span", { slot: 'icon', class: "s-product-size-guide-header-icon", innerHTML: PencilRuler }), h("div", { slot: "loading" }, h("div", { class: "s-product-size-guide-skeleton" }, h("salla-skeleton", { height: '15px', width: '25%' }), h("div", { class: "s-product-size-guide-skeleton-header" }, h("salla-skeleton", { height: '40px' }), h("salla-skeleton", { height: '40px' }), h("salla-skeleton", { height: '40px' }), h("salla-skeleton", { height: '40px' })), h("div", { class: "s-product-size-guide-skeleton-content" }, h("salla-skeleton", { height: '15px', width: '25%' }), h("salla-skeleton", { height: '10px', width: '75%' }), h("salla-skeleton", { height: '10px', width: '50%' }), h("salla-skeleton", { height: '10px', width: '75%' }), h("salla-skeleton", { height: '10px', width: '100%' }), h("salla-skeleton", { height: '10px', width: '25%' }), h("salla-skeleton", { height: '10px', width: '60%' }), h("salla-skeleton", { height: '10px', width: '45%' }), h("salla-skeleton", { height: '10px', width: '30%' })))), h("slot", { name: "header" }), !this.hasError && !!this.guides ?
20506
- [
20507
- h("salla-tabs", null, this.guides.map((guide) => h("salla-tab-header", { slot: "header", name: guide.name }, h("span", null, guide.name))), this.guides.map((guide) => h("salla-tab-content", { slot: "content", name: guide.name }, h("div", { innerHTML: guide.description }))))
20508
- ]
20509
- : this.showPlaceholder(), h("slot", { name: "footer" })));
20442
+ return (h(Host, { class: "s-product-size-guide-block" }, h("salla-modal", { id: 'salla-product-size-guide-modal', isLoading: true, "has-skeleton": true, width: "md", ref: modal => this.modal = modal }, h("div", { slot: "loading" }, h("div", { class: "s-product-size-guide-skeleton" }, h("salla-skeleton", { height: '15px', width: '25%' }), h("div", { class: "s-product-size-guide-skeleton-header" }, h("salla-skeleton", { height: '40px' }), h("salla-skeleton", { height: '40px' }), h("salla-skeleton", { height: '40px' }), h("salla-skeleton", { height: '40px' })), h("div", { class: "s-product-size-guide-skeleton-content" }, h("salla-skeleton", { height: '15px', width: '25%' }), h("salla-skeleton", { height: '10px', width: '75%' }), h("salla-skeleton", { height: '10px', width: '50%' }), h("salla-skeleton", { height: '10px', width: '75%' }), h("salla-skeleton", { height: '10px', width: '100%' }), h("salla-skeleton", { height: '10px', width: '25%' }), h("salla-skeleton", { height: '10px', width: '60%' }), h("salla-skeleton", { height: '10px', width: '45%' }), h("salla-skeleton", { height: '10px', width: '30%' })))), h("slot", { name: "header" }), !this.hasError && !!this.guides ?
20443
+ [h("div", { class: "container px-8" }, h("salla-tabs", null, this.guides.map((guide) => h("salla-tab-header", { slot: "header", name: guide.name }, h("span", null, guide.name))), this.guides.map((guide) => h("salla-tab-content", { slot: "content", name: guide.name }, h("div", { innerHTML: guide.description })))))]
20444
+ : this.showPlaceholder(), h("slot", { name: "footer" }))));
20510
20445
  }
20511
20446
  get host() { return getElement(this); }
20512
20447
  };
@@ -20630,6 +20565,7 @@ const SallaRatingModal = class {
20630
20565
  */
20631
20566
  this.orderId = salla.config.get('page.id');
20632
20567
  this.translationLoaded = false;
20568
+ Helper$1.setHost(document);
20633
20569
  salla.event.on('rating::open', () => this.open());
20634
20570
  salla.lang.onLoaded(() => {
20635
20571
  this.translationLoaded = true;
@@ -20639,17 +20575,22 @@ const SallaRatingModal = class {
20639
20575
  * Show the rating modal
20640
20576
  */
20641
20577
  async open() {
20642
- return this.modal.open()
20643
- .then(() => this.order || salla.api.withoutNotifier(() => salla.rating.api.order(this.orderId)).then(res => this.order = res.data))
20644
- .then(() => this.modal.setTitle(salla.lang.get('pages.rating.rate_order') + ' <span class="unicode">(#' + this.order.id + ')</span>'))
20645
- .then(() => this.modal.stopLoading())
20646
- .then(() => this.stepsCount = [this.order.testimonials_enabled, this.order.products_enabled, this.order.shipping_enabled].filter(enabled => enabled).length)
20647
- .then(() => setTimeout(() => this.handleWizard(), 100))
20578
+ this.modal.open();
20579
+ return await salla.api.withoutNotifier(() => salla.rating.api.order(this.orderId))
20580
+ .then(res => this.order = res.data)
20648
20581
  .catch(e => {
20649
20582
  var _a, _b, _c, _d;
20650
20583
  this.hasError = true;
20651
20584
  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);
20652
- this.modal.stopLoading();
20585
+ })
20586
+ .finally(() => {
20587
+ var _a, _b, _c;
20588
+ this.modal.setTitle(`${salla.lang.get('pages.rating.rate_order')} <span class="unicode">${!!this.order ? `(#${this.order.id})` : ''}</span>`);
20589
+ 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;
20590
+ setTimeout(() => this.handleWizard(), 100);
20591
+ setTimeout(() => {
20592
+ this.modal.stopLoading();
20593
+ }, 1000);
20653
20594
  });
20654
20595
  }
20655
20596
  /**
@@ -20678,7 +20619,7 @@ const SallaRatingModal = class {
20678
20619
  let nextType = (_a = this.steps[this.currentIndex + 1]) === null || _a === void 0 ? void 0 : _a.dataset.type;
20679
20620
  (_b = this.nextBtn) === null || _b === void 0 ? void 0 : _b.setText(nextType ? salla.lang.get('pages.rating.rate') + ' ' + salla.lang.get('pages.rating.' + nextType)
20680
20621
  : salla.lang.get('pages.rating.send_ratings'));
20681
- 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'); });
20622
+ 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'); });
20682
20623
  }
20683
20624
  previousTab() {
20684
20625
  this.currentIndex > 0 && this.currentIndex--;
@@ -20764,7 +20705,7 @@ const SallaRatingModal = class {
20764
20705
  ? h("div", { class: "s-rating-modal-rounded-icon" }, h("img", { src: this.order.shipping.company.logo, class: "s-rating-modal-shipping-logo", alt: this.order.shipping.company.name }))
20765
20706
  : h("span", { class: "s-rating-modal-icon", innerHTML: ShippingFast }), h("div", { class: "s-rating-modal-title" }, " ", salla.lang.get('pages.rating.rate_shipping') + ' ' + this.order.shipping.company.name), h("div", { class: "s-rating-modal-stars-company" }, h("salla-rating-stars", { size: "large" })), h("textarea", { name: "comment", class: "s-rating-modal-comment", placeholder: salla.lang.get('pages.rating.write_shipping_rate') }), h("small", { class: "s-rating-modal-validation-msg" }))
20766
20707
  : '', h("div", { class: "s-rating-modal-thanks s-rating-modal-hidden", ref: el => this.thanksTab = el }, h("span", { class: "s-rating-modal-icon", innerHTML: CheckCircle2 }), h("h3", { class: "s-rating-modal-thanks-title" }, salla.lang.get('pages.rating.thanks')), h("div", { class: "s-rating-modal-thanks-msg", innerHTML: this.order.thanks_message }), h("time", { class: "s-rating-modal-thanks-time", ref: el => this.thanksTime = el }))), h("div", { class: "s-rating-modal-footer" }, h("button", { ref: el => this.backBtn = el, onClick: () => this.previousTab(), class: "s-rating-modal-btn s-rating-modal-unvisiable" }, salla.lang.get('common.elements.back')), this.stepsCount > 1 ? h("ul", { class: "s-rating-modal-dots" }, [0, 1, 2].slice(0, this.stepsCount).map(() => h("li", { class: 's-rating-modal-bg-gray s-rating-modal-step-dot' }))) : '', h("salla-button", { "loader-position": 'center', ref: el => this.nextBtn = el, onClick: () => this.submit() }, salla.lang.get('common.elements.next'))),]
20767
- : h("salla-placeholder", { alignment: "center" }))));
20708
+ : '')));
20768
20709
  }
20769
20710
  componentDidLoad() {
20770
20711
  salla.event.dispatch('rating::ready', this);
@@ -20867,7 +20808,8 @@ const SallaSearch = class {
20867
20808
  * Sets the height of the input
20868
20809
  */
20869
20810
  this.height = 60;
20870
- this.productSlot = ((_a = this.host.querySelector('[slot="product"]')) === null || _a === void 0 ? void 0 : _a.innerHTML) || this.getDefaultProductSlot();
20811
+ Helper$1.setHost(this.host);
20812
+ this.productSlot = ((_a = Helper$1.getElement('[slot="product"]')) === null || _a === void 0 ? void 0 : _a.innerHTML) || this.getDefaultProductSlot();
20871
20813
  salla.event.on('search::open', () => this.open());
20872
20814
  salla.lang.onLoaded(() => {
20873
20815
  this.translationLoaded = true;
@@ -20917,7 +20859,7 @@ const SallaSearch = class {
20917
20859
  }
20918
20860
  }
20919
20861
  search(val) {
20920
- this.noResults.style.display = 'none';
20862
+ Helper$1.hideElement(this.noResults);
20921
20863
  //run loading spinner or stop it
20922
20864
  this.loading = true;
20923
20865
  salla.product.search(val)
@@ -21038,7 +20980,7 @@ const SallaSocialShare = class {
21038
20980
  registerInstance(this, hostRef);
21039
20981
  this.opened = false;
21040
20982
  this.allPlatforms = [Socials.WHATSAPP, Socials.FACEBOOK, Socials.TWITTER, Socials.EMAIL, Socials.COPY_LINK];
21041
- 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 }];
20983
+ 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 }];
21042
20984
  /**
21043
20985
  * page url that will be shared custom | current page url
21044
20986
  */
@@ -26098,7 +26040,6 @@ const SallaSwiper = class {
26098
26040
  }
26099
26041
  initSwiper() {
26100
26042
  for (const slide of this.swiperWrapper.children) {
26101
- //todo:: use `s-swiper-slide`
26102
26043
  slide.classList.add('swiper-slide');
26103
26044
  }
26104
26045
  this.swiper = new Swiper(this.swiperContainer, {
@@ -27638,7 +27579,7 @@ const SallaTelInput = class {
27638
27579
  /**
27639
27580
  * Current country_code
27640
27581
  */
27641
- this.countryCode = salla.config.get('user.country_code', 'SA') || 'SA';
27582
+ this.countryCode = salla.config.get('user.country_code', 'SA');
27642
27583
  this.countryCodeLabel = salla.lang.get('common.country_code');
27643
27584
  this.mobileLabel = salla.lang.get('common.elements.mobile');
27644
27585
  this.tooShort = salla.lang.get('common.errors.too_short', { attribute: this.mobileLabel });
@@ -27646,6 +27587,7 @@ const SallaTelInput = class {
27646
27587
  this.invalidCountryCode = salla.lang.get('common.errors.invalid_value', { attribute: this.countryCodeLabel });
27647
27588
  this.invalidNumber = salla.lang.get('common.errors.invalid_value', { attribute: this.mobileLabel });
27648
27589
  this.errorMap = [this.invalidNumber, this.invalidCountryCode, this.tooShort, this.tooLong, this.invalidNumber];
27590
+ Helper$1.setHost(this.host);
27649
27591
  salla.lang.onLoaded(() => {
27650
27592
  this.mobileLabel = salla.lang.get('common.elements.mobile');
27651
27593
  this.countryCodeLabel = salla.lang.get('common.elements.country_code');
@@ -27732,64 +27674,6 @@ const SallaTelInput = class {
27732
27674
  };
27733
27675
  SallaTelInput.style = sallaTelInputCss;
27734
27676
 
27735
- const Bullhorn = `<!-- Generated by IcoMoon.io -->
27736
- <svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">
27737
- <title>bullhorn</title>
27738
- <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>
27739
- </svg>
27740
- `;
27741
-
27742
- const UserOff = `<!-- Generated by IcoMoon.io -->
27743
- <svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">
27744
- <title>user-off</title>
27745
- <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>
27746
- </svg>
27747
- `;
27748
-
27749
- const sallaUserSettingsCss = "";
27750
-
27751
- const SallaUserSettings = class {
27752
- constructor(hostRef) {
27753
- registerInstance(this, hostRef);
27754
- // Texts
27755
- this.deactivateAccount = salla.lang.get('pages.profile.deactivate_account');
27756
- this.promotionalMsgs = salla.lang.get('pages.profile.promotional_messages');
27757
- this.deactivateDesc = salla.lang.get('pages.profile.deactivate_account_description');
27758
- this.promotionalMsgsDesc = salla.lang.get('pages.profile.promotional_messages_description');
27759
- this.sorryForLeavingText = salla.lang.get('pages.profile.warning_for_deactivate');
27760
- this.warningText = salla.lang.get('pages.profile.sorry_for_leaving');
27761
- this.keepAccount = salla.lang.get('pages.profile.keep_account');
27762
- this.buttonLoading = false;
27763
- this.isNotifiable = false;
27764
- salla.lang.onLoaded(() => {
27765
- this.deactivateAccount = salla.lang.get('pages.profile.deactivate_account');
27766
- this.promotionalMsgs = salla.lang.get('pages.profile.promotional_messages');
27767
- this.deactivateDesc = salla.lang.get('pages.profile.deactivate_account_description');
27768
- this.promotionalMsgsDesc = salla.lang.get('pages.profile.promotional_messages_description');
27769
- this.warningText = salla.lang.get('pages.profile.warning_for_deactivate');
27770
- this.sorryForLeavingText = salla.lang.get('pages.profile.sorry_for_leaving');
27771
- this.keepAccount = salla.lang.get('pages.profile.keep_account');
27772
- });
27773
- }
27774
- toggleNotification(event) {
27775
- salla.profile.updateSettings({ is_notifiable: event.target.checked });
27776
- }
27777
- capitalizeText(str) {
27778
- return str.charAt(0).toUpperCase() + str.slice(1);
27779
- }
27780
- openDeactivateModal() {
27781
- this.confirmationModal.setTitle(this.capitalizeText(this.deactivateAccount));
27782
- this.confirmationModal.open();
27783
- }
27784
- async deleteAccount() {
27785
- await salla.profile.delete().finally(() => this.confirmationModal.close());
27786
- }
27787
- render() {
27788
- return (h(Host, { class: "s-user-settings-wrapper" }, h("div", { class: "s-user-settings-section" }, h("salla-list-tile", null, h("div", { slot: "icon", class: "s-user-settings-section-icon" }, h("span", { innerHTML: Bullhorn })), h("div", { slot: "title", class: "s-user-settings-section-title" }, this.capitalizeText(this.promotionalMsgs)), h("div", { slot: "subtitle", class: "s-user-settings-section-subtitle" }, this.capitalizeText(this.promotionalMsgsDesc)), h("div", { slot: 'action', class: "s-user-settings-section-action" }, h("label", { class: "s-toggle" }, h("input", { class: "s-toggle-input", checked: this.isNotifiable, onChange: (e) => this.toggleNotification(e), type: "checkbox" }), h("div", { class: "s-toggle-switcher" }))))), h("div", { class: "s-user-settings-section" }, h("salla-list-tile", null, h("div", { slot: "icon", class: "s-user-settings-section-icon" }, h("span", { innerHTML: UserOff })), h("div", { slot: "title", class: "s-user-settings-section-title" }, this.capitalizeText(this.deactivateAccount)), h("div", { slot: "subtitle", class: "s-user-settings-section-subtitle" }, this.capitalizeText(this.deactivateDesc)), h("div", { slot: 'action', class: "s-user-settings-section-action" }, h("salla-button", { fill: "outline", color: "danger", shape: "btn", size: "medium", width: "normal", onClick: () => this.openDeactivateModal() }, this.capitalizeText(this.deactivateAccount))))), h("salla-modal", { width: "sm", subTitle: this.capitalizeText(this.sorryForLeavingText), ref: modal => this.confirmationModal = modal }, h("span", { slot: 'icon', class: "s-user-settings-confirmation-icon", innerHTML: UserOff }), h("div", { class: "s-user-settings-confirmation" }, h("div", { class: "s-user-settings-confirmation-warning" }, this.capitalizeText(this.warningText)), h("div", { class: "s-user-settings-confirmation-actions" }, h("salla-button", { width: "wide", onClick: () => this.confirmationModal.close() }, this.capitalizeText(this.keepAccount)), h("salla-button", { fill: 'outline', loading: this.buttonLoading, width: "wide", onClick: () => this.deleteAccount() }, this.capitalizeText(this.deactivateAccount)))))));
27789
- }
27790
- };
27791
- SallaUserSettings.style = sallaUserSettingsCss;
27792
-
27793
27677
  const AndroidPhoneIcon = `<!-- Generated by IcoMoon.io -->
27794
27678
  <svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">
27795
27679
  <title>android-phone</title>
@@ -27803,6 +27687,7 @@ const SallaVerify = class {
27803
27687
  constructor(hostRef) {
27804
27688
  registerInstance(this, hostRef);
27805
27689
  this.verified = createEvent(this, "verified", 7);
27690
+ this.initiated = false;
27806
27691
  this.translationLoaded = false;
27807
27692
  /**
27808
27693
  * Should render component without modal
@@ -27825,6 +27710,7 @@ const SallaVerify = class {
27825
27710
  * to use: `salla.api.auth.verify` or `salla.profile.verify`
27826
27711
  */
27827
27712
  this.isProfileVerify = false;
27713
+ // Helper.setHost(this.host);
27828
27714
  salla.lang.onLoaded(() => {
27829
27715
  var _a;
27830
27716
  this.translationLoaded = true;
@@ -27847,30 +27733,6 @@ const SallaVerify = class {
27847
27733
  this.timer.innerHTML = '30 : 00';
27848
27734
  });
27849
27735
  }
27850
- handleKeyUp(ev) {
27851
- var _a, _b, _c, _d;
27852
- if (['Alt', 'Shift', 'Control', 'AltGraph', 'Ctrl'].includes(ev.key)) {
27853
- return;
27854
- }
27855
- let key = ev.keyCode || ev.charCode;
27856
- if (ev.target.value) {
27857
- (_a = ev.target.nextElementSibling) === null || _a === void 0 ? void 0 : _a.focus();
27858
- (_b = ev.target.nextElementSibling) === null || _b === void 0 ? void 0 : _b.select();
27859
- }
27860
- else if ([8, 46].includes(key)) {
27861
- (_c = ev.target.previousElementSibling) === null || _c === void 0 ? void 0 : _c.focus();
27862
- (_d = ev.target.previousElementSibling) === null || _d === void 0 ? void 0 : _d.select();
27863
- }
27864
- this.toggleOTPSubmit();
27865
- }
27866
- handlePaste(ev) {
27867
- let text = salla.helpers.number(ev.clipboardData.getData('text'))
27868
- .replace(/[^0-9.]/g, '')
27869
- .replace('..', '.');
27870
- this.otpInputs.forEach((input, i) => input.value = text[i] || '');
27871
- this.toggleOTPSubmit();
27872
- setTimeout(() => this.otpInputs[3].focus(), 100);
27873
- }
27874
27736
  /**
27875
27737
  * Get current code
27876
27738
  * @return {string}
@@ -27889,6 +27751,30 @@ const SallaVerify = class {
27889
27751
  this.type = this.data.type;
27890
27752
  this.resendTimer();
27891
27753
  this.otpInputs = this.body.querySelectorAll('.s-verify-input');
27754
+ if (!this.initiated) {
27755
+ Helper$1.on('input', '.s-verify-input', e => salla.helpers.inputDigitsOnly(e.target));
27756
+ Helper$1.onKeyUp('.s-verify-input', event => {
27757
+ var _a, _b, _c, _d;
27758
+ let key = event.keyCode || event.charCode;
27759
+ if (event.target.value) {
27760
+ (_a = event.target.nextElementSibling) === null || _a === void 0 ? void 0 : _a.focus();
27761
+ (_b = event.target.nextElementSibling) === null || _b === void 0 ? void 0 : _b.select();
27762
+ }
27763
+ else if ([8, 46].includes(key)) {
27764
+ (_c = event.target.previousElementSibling) === null || _c === void 0 ? void 0 : _c.focus();
27765
+ (_d = event.target.previousElementSibling) === null || _d === void 0 ? void 0 : _d.select();
27766
+ }
27767
+ this.toggleOTPSubmit();
27768
+ });
27769
+ Helper$1.on('paste', '.s-verify-input', event => {
27770
+ let text = salla.helpers.number(event.clipboardData.getData('text')).replace(/[^0-9.]/g, '').replace('..', '.');
27771
+ this.otpInputs.forEach((input, i) => input.value = text[i] || '');
27772
+ this.toggleOTPSubmit();
27773
+ setTimeout(() => this.otpInputs[3].focus(), 100);
27774
+ });
27775
+ // return this.modal.open();
27776
+ this.initiated = true;
27777
+ }
27892
27778
  this.reset();
27893
27779
  this.display == 'modal' && ((_a = this.modal) === null || _a === void 0 ? void 0 : _a.setTitle(this.title));
27894
27780
  this.modal.open();
@@ -27912,14 +27798,12 @@ const SallaVerify = class {
27912
27798
  this.otpInputs[0].focus();
27913
27799
  }
27914
27800
  resendTimer() {
27915
- this.resendMessage.style.display = 'block';
27916
- this.resend.style.display = 'none';
27801
+ Helper$1.showElement(this.resendMessage).hideElement(this.resend);
27917
27802
  this.resendAfter = 30;
27918
27803
  let timerId = setInterval(() => {
27919
27804
  if (this.resendAfter <= 0) {
27920
27805
  clearInterval(timerId);
27921
- this.resend.style.display = 'block';
27922
- this.resendMessage.style.display = 'none';
27806
+ Helper$1.hideElement(this.resendMessage).showElement(this.resend);
27923
27807
  }
27924
27808
  else {
27925
27809
  this.timer.innerHTML = `${this.resendAfter >= 10 ? this.resendAfter : '0' + this.resendAfter} : 00`;
@@ -27938,12 +27822,6 @@ const SallaVerify = class {
27938
27822
  .finally(() => this.resendTimer());
27939
27823
  }
27940
27824
  submit() {
27941
- //if code not 4 digits, focus on the after filled input,
27942
- if (this.code.value.length < 4) {
27943
- this.otpInputs[this.code.value.length].focus();
27944
- salla.log('Trying to submit without 4 digits!');
27945
- return;
27946
- }
27947
27825
  let data = Object.assign({ code: this.code.value }, this.data);
27948
27826
  return this.btn.load()
27949
27827
  .then(() => this.btn.disable())
@@ -27959,13 +27837,13 @@ const SallaVerify = class {
27959
27837
  }
27960
27838
  render() {
27961
27839
  return this.display == 'inline' ? h(Host, null, this.myBody()) :
27962
- h("salla-modal", { width: "xs", class: "s-verify", ref: modal => this.modal = modal, "modal-title": this.title }, h("span", { slot: 'icon', innerHTML: this.type == "mobile" ? AndroidPhoneIcon : MailIcon }), this.myBody());
27840
+ h("salla-modal", { width: "xs", class: "s-verify", ref: modal => this.modal = modal, "modal-title": this.title }, h("span", { slot: 'icon', innerHTML: AndroidPhoneIcon }), this.myBody());
27963
27841
  }
27964
27842
  myBody() {
27965
- return (h("div", { class: "s-verify-body", ref: body => this.body = body }, h("div", { class: "s-verify-message", innerHTML: salla.lang.get('pages.profile.verify_message') }), h("input", { type: "hidden", name: "code", maxlength: "4", required: true, ref: code => this.code = code }), h("div", { class: "s-verify-codes", dir: "ltr" }, [1, 2, 3, 4].map(() => 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 }))), h("div", { slot: "footer", class: "s-verify-footer" }, 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')), h("p", { class: "s-verify-resend-message", ref: el => this.resendMessage = el }, salla.lang.get('blocks.header.resend_after'), h("b", { class: "s-verify-timer", ref: el => this.timer = el })), h("a", { href: "#", class: "s-verify-resend", onClick: () => this.resendCode(), ref: el => this.resend = el }, salla.lang.get('blocks.comments.submit'))), h("slot", { name: "after-footer" })));
27843
+ return (h("div", { class: "s-verify-body", ref: body => this.body = body }, h("div", { class: "s-verify-message", innerHTML: salla.lang.get('pages.profile.verify_message') }), h("input", { type: "hidden", name: "code", maxlength: "4", required: true, ref: code => this.code = code }), h("div", { class: "s-verify-codes", dir: "ltr" }, [1, 2, 3, 4].map(() => h("input", { type: "tel", autocomplete: "one-time-code", pattern: "[0-9]*", inputmode: "numeric", maxlength: "1", class: "s-verify-input", required: true }))), h("div", { slot: "footer", class: "s-verify-footer" }, 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')), h("p", { class: "s-verify-resend-message", ref: el => this.resendMessage = el }, salla.lang.get('blocks.header.resend_after'), h("b", { class: "s-verify-timer", ref: el => this.timer = el }), " "), h("a", { href: "#", class: "s-verify-resend", onClick: () => this.resendCode(), ref: el => this.resend = el }, salla.lang.get('blocks.comments.submit'))), h("slot", { name: "after-footer" })));
27966
27844
  }
27967
27845
  get host() { return getElement(this); }
27968
27846
  };
27969
27847
  SallaVerify.style = sallaVerifyCss;
27970
27848
 
27971
- export { SallaButton as salla_button, SallaCartSummary as salla_cart_summary, SallaDatetimePicker as salla_datetime_picker, SallaFileUpload as salla_file_upload, SallaGifting as salla_gifting, SallaInfiniteScroll as salla_infinite_scroll, SallaListTile as salla_list_tile, SallaLoading as salla_loading, SallaLocalizationModal as salla_localization_modal, SallaLoginModal as salla_login_modal, SallaLoyalty as salla_loyalty, SallaModal as salla_modal, SallaOfferModal as salla_offer_modal, SallaPlaceholder as salla_placeholder, SallaProductAvailability as salla_product_availability, SallaProductSizeGuide as salla_product_size_guide, SallaQuantityInput as salla_quantity_input, SallaRatingModal as salla_rating_modal, SallaRatingStars as salla_rating_stars, SallaSearch as salla_search, SallaSkeleton as salla_skeleton, SallaSocialShare as salla_social_share, SallaSwiper as salla_swiper, SallaTabContent as salla_tab_content, SallaTabHeader as salla_tab_header, SallaTabs as salla_tabs, SallaTelInput as salla_tel_input, SallaUserSettings as salla_user_settings, SallaVerify as salla_verify };
27849
+ export { SallaButton as salla_button, SallaDatetimePicker as salla_datetime_picker, SallaFileUpload as salla_file_upload, SallaGifting as salla_gifting, SallaInfiniteScroll as salla_infinite_scroll, SallaListTile as salla_list_tile, SallaLoading as salla_loading, SallaLocalizationModal as salla_localization_modal, SallaLoginModal as salla_login_modal, SallaLoyalty as salla_loyalty, SallaModal as salla_modal, SallaOfferModal as salla_offer_modal, SallaPlaceholder as salla_placeholder, SallaProductAvailability as salla_product_availability, SallaProductSizeGuide as salla_product_size_guide, SallaQuantityInput as salla_quantity_input, SallaRatingModal as salla_rating_modal, SallaRatingStars as salla_rating_stars, SallaSearch as salla_search, SallaSkeleton as salla_skeleton, SallaSocialShare as salla_social_share, SallaSwiper as salla_swiper, SallaTabContent as salla_tab_content, SallaTabHeader as salla_tab_header, SallaTabs as salla_tabs, SallaTelInput as salla_tel_input, SallaVerify as salla_verify };