@salla.sa/twilight-components 2.14.549 → 2.14.551

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 (341) hide show
  1. package/dist/cjs/{Helper-6RI07gZo.js → Helper-D1YsoJud.js} +46 -0
  2. package/dist/cjs/{filepond-COUccQWv.js → filepond-C99K1KEB.js} +1 -1
  3. package/dist/cjs/{filepond-plugin-file-poster-B_yyvbJ6.js → filepond-plugin-file-poster-CggRjTNg.js} +1 -1
  4. package/dist/cjs/{filepond-plugin-file-validate-size-KDZtJpSs.js → filepond-plugin-file-validate-size-B009kdAV.js} +1 -1
  5. package/dist/cjs/{filepond-plugin-file-validate-type-Dbm_-1V2.js → filepond-plugin-file-validate-type-DZs9-bai.js} +1 -1
  6. package/dist/cjs/{filepond-plugin-image-edit-C-q8yFXi.js → filepond-plugin-image-edit-DNNheErX.js} +1 -1
  7. package/dist/cjs/{filepond-plugin-image-exif-orientation-C2Q2chpj.js → filepond-plugin-image-exif-orientation-ChN0IpOy.js} +1 -1
  8. package/dist/cjs/{filepond-plugin-image-preview-DVK8eIMv.js → filepond-plugin-image-preview-BZo2ftGo.js} +1 -1
  9. package/dist/cjs/{index-CSq9uCjw.js → index-0JUvtl0d.js} +6 -2
  10. package/dist/cjs/{intlTelInput-NQOLNYxO.js → intlTelInput-D84-rI5D.js} +1 -1
  11. package/dist/cjs/loader.cjs.js +2 -2
  12. package/dist/cjs/salla-accordion-body_2.cjs.entry.js +1 -1
  13. package/dist/cjs/salla-accordion_6.cjs.entry.js +2 -2
  14. package/dist/cjs/salla-add-product-button_5.cjs.entry.js +2 -2
  15. package/dist/cjs/salla-advertisement.cjs.entry.js +1 -1
  16. package/dist/cjs/salla-alert_2.cjs.entry.js +1 -1
  17. package/dist/cjs/salla-app-install-alert.cjs.entry.js +1 -1
  18. package/dist/cjs/salla-applied-filters.cjs.entry.js +175 -0
  19. package/dist/cjs/salla-apps-icons.cjs.entry.js +1 -1
  20. package/dist/cjs/salla-attachment-view_9.cjs.entry.js +11 -11
  21. package/dist/cjs/salla-badge.cjs.entry.js +1 -1
  22. package/dist/cjs/salla-basket-gap.cjs.entry.js +1 -1
  23. package/dist/cjs/salla-bullet-delivery_2.cjs.entry.js +1 -1
  24. package/dist/cjs/salla-cart-coupons.cjs.entry.js +1 -1
  25. package/dist/cjs/salla-cart-item-offers_2.cjs.entry.js +1 -1
  26. package/dist/cjs/salla-cart-summary-card.cjs.entry.js +1 -1
  27. package/dist/cjs/salla-cashback-banner.cjs.entry.js +1 -1
  28. package/dist/cjs/salla-comment-factors.cjs.entry.js +1 -1
  29. package/dist/cjs/salla-comment-form_9.cjs.entry.js +2 -2
  30. package/dist/cjs/salla-conditional-offer.cjs.entry.js +1 -1
  31. package/dist/cjs/salla-contacts.cjs.entry.js +1 -1
  32. package/dist/cjs/salla-cookies-bar.cjs.entry.js +1 -1
  33. package/dist/cjs/salla-count-down.cjs.entry.js +1 -1
  34. package/dist/cjs/salla-custom-fields.cjs.entry.js +1 -1
  35. package/dist/cjs/salla-delivery-promise.cjs.entry.js +1 -1
  36. package/dist/cjs/salla-edit-order-button.cjs.entry.js +1 -1
  37. package/dist/cjs/salla-filters-widget.cjs.entry.js +10 -11
  38. package/dist/cjs/salla-filters.cjs.entry.js +14 -79
  39. package/dist/cjs/salla-fulfillment-methods.cjs.entry.js +1 -1
  40. package/dist/cjs/salla-gifting.cjs.entry.js +1 -1
  41. package/dist/cjs/salla-hook.cjs.entry.js +1 -1
  42. package/dist/cjs/salla-infinite-scroll.cjs.entry.js +2 -2
  43. package/dist/cjs/salla-installment.cjs.entry.js +1 -1
  44. package/dist/cjs/salla-list-tile.cjs.entry.js +1 -1
  45. package/dist/cjs/salla-localization-modal.cjs.entry.js +1 -1
  46. package/dist/cjs/salla-login-modal.cjs.entry.js +1 -1
  47. package/dist/cjs/salla-loyalty-banner_10.cjs.entry.js +1 -1
  48. package/dist/cjs/salla-loyalty-exchange-product-card.cjs.entry.js +1 -1
  49. package/dist/cjs/salla-loyalty-points-banner.cjs.entry.js +1 -1
  50. package/dist/cjs/salla-loyalty-points-history.cjs.entry.js +1 -1
  51. package/dist/cjs/salla-loyalty-prize-item.cjs.entry.js +1 -1
  52. package/dist/cjs/salla-loyalty.cjs.entry.js +1 -1
  53. package/dist/cjs/salla-maintenance-alert.cjs.entry.js +1 -1
  54. package/dist/cjs/salla-map_2.cjs.entry.js +1 -1
  55. package/dist/cjs/salla-menu.cjs.entry.js +1 -1
  56. package/dist/cjs/salla-metadata.cjs.entry.js +1 -1
  57. package/dist/cjs/salla-multiple-bundle-product-cart_2.cjs.entry.js +1 -1
  58. package/dist/cjs/salla-multiple-bundle-product-options-modal_2.cjs.entry.js +1 -1
  59. package/dist/cjs/salla-multiple-bundle-product.cjs.entry.js +1 -1
  60. package/dist/cjs/salla-next-order-coupon.cjs.entry.js +1 -1
  61. package/dist/cjs/salla-notification-item_2.cjs.entry.js +2 -2
  62. package/dist/cjs/salla-offer-modal.cjs.entry.js +1 -1
  63. package/dist/cjs/salla-offer.cjs.entry.js +1 -1
  64. package/dist/cjs/salla-order-branch.cjs.entry.js +1 -1
  65. package/dist/cjs/salla-order-cancel.cjs.entry.js +1 -1
  66. package/dist/cjs/salla-order-details-multiple-bundle-product.cjs.entry.js +1 -1
  67. package/dist/cjs/salla-order-details-options.cjs.entry.js +1 -1
  68. package/dist/cjs/salla-order-details.cjs.entry.js +1 -1
  69. package/dist/cjs/salla-order-edit-item.cjs.entry.js +1 -1
  70. package/dist/cjs/salla-order-edit-product-card.cjs.entry.js +1 -1
  71. package/dist/cjs/salla-order-edit.cjs.entry.js +1 -1
  72. package/dist/cjs/salla-order-options-modal_2.cjs.entry.js +1 -1
  73. package/dist/cjs/salla-order-shipments.cjs.entry.js +1 -1
  74. package/dist/cjs/salla-order-summary.cjs.entry.js +1 -1
  75. package/dist/cjs/salla-order-totals-card.cjs.entry.js +1 -1
  76. package/dist/cjs/salla-orders.cjs.entry.js +2 -2
  77. package/dist/cjs/salla-payments.cjs.entry.js +1 -1
  78. package/dist/cjs/salla-placeholder.cjs.entry.js +1 -1
  79. package/dist/cjs/salla-price-range.cjs.entry.js +1 -1
  80. package/dist/cjs/salla-product-card-embed.cjs.entry.js +1 -1
  81. package/dist/cjs/salla-product-size-guide.cjs.entry.js +1 -1
  82. package/dist/cjs/salla-products-list.cjs.entry.js +2 -2
  83. package/dist/cjs/salla-products-slider.cjs.entry.js +2 -2
  84. package/dist/cjs/salla-quick-order.cjs.entry.js +1 -1
  85. package/dist/cjs/salla-rating-modal-v2.cjs.entry.js +2 -2
  86. package/dist/cjs/salla-rating-modal.cjs.entry.js +2 -2
  87. package/dist/cjs/salla-review-factors-tags.cjs.entry.js +1 -1
  88. package/dist/cjs/salla-review-order-item.cjs.entry.js +1 -1
  89. package/dist/cjs/salla-scopes.cjs.entry.js +1 -1
  90. package/dist/cjs/salla-search.cjs.entry.js +2 -2
  91. package/dist/cjs/salla-skeleton.cjs.entry.js +1 -1
  92. package/dist/cjs/salla-slider.cjs.entry.js +1 -1
  93. package/dist/cjs/salla-social-share.cjs.entry.js +1 -1
  94. package/dist/cjs/salla-social.cjs.entry.js +1 -1
  95. package/dist/cjs/salla-tab-content_3.cjs.entry.js +1 -1
  96. package/dist/cjs/salla-tiered-offer.cjs.entry.js +1 -1
  97. package/dist/cjs/salla-tooltip.cjs.entry.js +1 -1
  98. package/dist/cjs/salla-trust-badges.cjs.entry.js +1 -1
  99. package/dist/cjs/salla-user-menu.cjs.entry.js +1 -1
  100. package/dist/cjs/salla-user-profile.cjs.entry.js +1 -1
  101. package/dist/cjs/salla-user-settings.cjs.entry.js +1 -1
  102. package/dist/cjs/salla-verify.cjs.entry.js +1 -1
  103. package/dist/cjs/salla-wallet.cjs.entry.js +1 -1
  104. package/dist/cjs/salla-wishlist-actions.cjs.entry.js +1 -1
  105. package/dist/cjs/twilight.cjs.js +2 -2
  106. package/dist/cjs/{vanilla-picker-My41190Y.js → vanilla-picker-D8r5xyK7.js} +1 -1
  107. package/dist/collection/Helpers/Helper.js +28 -0
  108. package/dist/collection/collection-manifest.json +1 -0
  109. package/dist/collection/components/salla-applied-filters/salla-applied-filters.css +115 -0
  110. package/dist/collection/components/salla-applied-filters/salla-applied-filters.js +185 -0
  111. package/dist/collection/components/salla-filters/salla-filters.css +0 -119
  112. package/dist/collection/components/salla-filters/salla-filters.js +27 -73
  113. package/dist/components/Helper.js +47 -1
  114. package/dist/components/index.js +2 -2
  115. package/dist/components/salla-applied-filters.d.ts +11 -0
  116. package/dist/components/salla-applied-filters.js +195 -0
  117. package/dist/components/salla-filters-widget2.js +2 -21
  118. package/dist/components/salla-filters.js +10 -76
  119. package/dist/esm/{Helper-CBmYxrzX.js → Helper-DsjZ6kte.js} +47 -1
  120. package/dist/esm/{filepond-CA4TWKuz.js → filepond-DuMUHI7t.js} +1 -1
  121. package/dist/esm/{filepond-plugin-file-poster-C4_NyGjO.js → filepond-plugin-file-poster-Dv25V2UU.js} +1 -1
  122. package/dist/esm/{filepond-plugin-file-validate-size-DVV7mZ-K.js → filepond-plugin-file-validate-size-Dxl4yPm6.js} +1 -1
  123. package/dist/esm/{filepond-plugin-file-validate-type-DT1IX9KM.js → filepond-plugin-file-validate-type-C602myuq.js} +1 -1
  124. package/dist/esm/{filepond-plugin-image-edit-RrqhOPfq.js → filepond-plugin-image-edit-DLd3ht_R.js} +1 -1
  125. package/dist/esm/{filepond-plugin-image-exif-orientation-Dc9_Qlva.js → filepond-plugin-image-exif-orientation-BaQ5DNLu.js} +1 -1
  126. package/dist/esm/{filepond-plugin-image-preview-Iu7ULzAy.js → filepond-plugin-image-preview-C-RFNs7l.js} +1 -1
  127. package/dist/esm/{index-C0qiFNJn.js → index-BsIeN-bg.js} +6 -2
  128. package/dist/esm/{intlTelInput-CrkMI_sC.js → intlTelInput-Cf6zBu5Y.js} +1 -1
  129. package/dist/esm/loader.js +3 -3
  130. package/dist/esm/salla-accordion-body_2.entry.js +1 -1
  131. package/dist/esm/salla-accordion_6.entry.js +2 -2
  132. package/dist/esm/salla-add-product-button_5.entry.js +2 -2
  133. package/dist/esm/salla-advertisement.entry.js +1 -1
  134. package/dist/esm/salla-alert_2.entry.js +1 -1
  135. package/dist/esm/salla-app-install-alert.entry.js +1 -1
  136. package/dist/esm/salla-applied-filters.entry.js +173 -0
  137. package/dist/esm/salla-apps-icons.entry.js +1 -1
  138. package/dist/esm/salla-attachment-view_9.entry.js +11 -11
  139. package/dist/esm/salla-badge.entry.js +1 -1
  140. package/dist/esm/salla-basket-gap.entry.js +1 -1
  141. package/dist/esm/salla-bullet-delivery_2.entry.js +1 -1
  142. package/dist/esm/salla-cart-coupons.entry.js +1 -1
  143. package/dist/esm/salla-cart-item-offers_2.entry.js +1 -1
  144. package/dist/esm/salla-cart-summary-card.entry.js +1 -1
  145. package/dist/esm/salla-cashback-banner.entry.js +1 -1
  146. package/dist/esm/salla-comment-factors.entry.js +1 -1
  147. package/dist/esm/salla-comment-form_9.entry.js +2 -2
  148. package/dist/esm/salla-conditional-offer.entry.js +1 -1
  149. package/dist/esm/salla-contacts.entry.js +1 -1
  150. package/dist/esm/salla-cookies-bar.entry.js +1 -1
  151. package/dist/esm/salla-count-down.entry.js +1 -1
  152. package/dist/esm/salla-custom-fields.entry.js +1 -1
  153. package/dist/esm/salla-delivery-promise.entry.js +1 -1
  154. package/dist/esm/salla-edit-order-button.entry.js +1 -1
  155. package/dist/esm/salla-filters-widget.entry.js +2 -3
  156. package/dist/esm/salla-filters.entry.js +8 -73
  157. package/dist/esm/salla-fulfillment-methods.entry.js +1 -1
  158. package/dist/esm/salla-gifting.entry.js +1 -1
  159. package/dist/esm/salla-hook.entry.js +1 -1
  160. package/dist/esm/salla-infinite-scroll.entry.js +2 -2
  161. package/dist/esm/salla-installment.entry.js +1 -1
  162. package/dist/esm/salla-list-tile.entry.js +1 -1
  163. package/dist/esm/salla-localization-modal.entry.js +1 -1
  164. package/dist/esm/salla-login-modal.entry.js +1 -1
  165. package/dist/esm/salla-loyalty-banner_10.entry.js +1 -1
  166. package/dist/esm/salla-loyalty-exchange-product-card.entry.js +1 -1
  167. package/dist/esm/salla-loyalty-points-banner.entry.js +1 -1
  168. package/dist/esm/salla-loyalty-points-history.entry.js +1 -1
  169. package/dist/esm/salla-loyalty-prize-item.entry.js +1 -1
  170. package/dist/esm/salla-loyalty.entry.js +1 -1
  171. package/dist/esm/salla-maintenance-alert.entry.js +1 -1
  172. package/dist/esm/salla-map_2.entry.js +1 -1
  173. package/dist/esm/salla-menu.entry.js +1 -1
  174. package/dist/esm/salla-metadata.entry.js +1 -1
  175. package/dist/esm/salla-multiple-bundle-product-cart_2.entry.js +1 -1
  176. package/dist/esm/salla-multiple-bundle-product-options-modal_2.entry.js +1 -1
  177. package/dist/esm/salla-multiple-bundle-product.entry.js +1 -1
  178. package/dist/esm/salla-next-order-coupon.entry.js +1 -1
  179. package/dist/esm/salla-notification-item_2.entry.js +2 -2
  180. package/dist/esm/salla-offer-modal.entry.js +1 -1
  181. package/dist/esm/salla-offer.entry.js +1 -1
  182. package/dist/esm/salla-order-branch.entry.js +1 -1
  183. package/dist/esm/salla-order-cancel.entry.js +1 -1
  184. package/dist/esm/salla-order-details-multiple-bundle-product.entry.js +1 -1
  185. package/dist/esm/salla-order-details-options.entry.js +1 -1
  186. package/dist/esm/salla-order-details.entry.js +1 -1
  187. package/dist/esm/salla-order-edit-item.entry.js +1 -1
  188. package/dist/esm/salla-order-edit-product-card.entry.js +1 -1
  189. package/dist/esm/salla-order-edit.entry.js +1 -1
  190. package/dist/esm/salla-order-options-modal_2.entry.js +1 -1
  191. package/dist/esm/salla-order-shipments.entry.js +1 -1
  192. package/dist/esm/salla-order-summary.entry.js +1 -1
  193. package/dist/esm/salla-order-totals-card.entry.js +1 -1
  194. package/dist/esm/salla-orders.entry.js +2 -2
  195. package/dist/esm/salla-payments.entry.js +1 -1
  196. package/dist/esm/salla-placeholder.entry.js +1 -1
  197. package/dist/esm/salla-price-range.entry.js +1 -1
  198. package/dist/esm/salla-product-card-embed.entry.js +1 -1
  199. package/dist/esm/salla-product-size-guide.entry.js +1 -1
  200. package/dist/esm/salla-products-list.entry.js +2 -2
  201. package/dist/esm/salla-products-slider.entry.js +2 -2
  202. package/dist/esm/salla-quick-order.entry.js +1 -1
  203. package/dist/esm/salla-rating-modal-v2.entry.js +2 -2
  204. package/dist/esm/salla-rating-modal.entry.js +2 -2
  205. package/dist/esm/salla-review-factors-tags.entry.js +1 -1
  206. package/dist/esm/salla-review-order-item.entry.js +1 -1
  207. package/dist/esm/salla-scopes.entry.js +1 -1
  208. package/dist/esm/salla-search.entry.js +2 -2
  209. package/dist/esm/salla-skeleton.entry.js +1 -1
  210. package/dist/esm/salla-slider.entry.js +1 -1
  211. package/dist/esm/salla-social-share.entry.js +1 -1
  212. package/dist/esm/salla-social.entry.js +1 -1
  213. package/dist/esm/salla-tab-content_3.entry.js +1 -1
  214. package/dist/esm/salla-tiered-offer.entry.js +1 -1
  215. package/dist/esm/salla-tooltip.entry.js +1 -1
  216. package/dist/esm/salla-trust-badges.entry.js +1 -1
  217. package/dist/esm/salla-user-menu.entry.js +1 -1
  218. package/dist/esm/salla-user-profile.entry.js +1 -1
  219. package/dist/esm/salla-user-settings.entry.js +1 -1
  220. package/dist/esm/salla-verify.entry.js +1 -1
  221. package/dist/esm/salla-wallet.entry.js +1 -1
  222. package/dist/esm/salla-wishlist-actions.entry.js +1 -1
  223. package/dist/esm/twilight.js +3 -3
  224. package/dist/esm/{vanilla-picker-Cf9pEgos.js → vanilla-picker-S7qZ7YZm.js} +1 -1
  225. package/dist/twilight/{p-2a64e50b.entry.js → p-01406425.entry.js} +1 -1
  226. package/dist/twilight/{p-i-tkvIE0.js → p-035DwuUC.js} +1 -1
  227. package/dist/twilight/{p-bbd2cb8c.entry.js → p-07adeb89.entry.js} +1 -1
  228. package/dist/twilight/{p-e806b976.entry.js → p-0944d367.entry.js} +1 -1
  229. package/dist/twilight/{p-e190e1cf.entry.js → p-0a332226.entry.js} +1 -1
  230. package/dist/twilight/{p-adbf6324.entry.js → p-0e3d72ab.entry.js} +1 -1
  231. package/dist/twilight/{p-368beadc.entry.js → p-1118bee2.entry.js} +1 -1
  232. package/dist/twilight/{p-a37a692a.entry.js → p-13c4b450.entry.js} +1 -1
  233. package/dist/twilight/{p-e36310e2.entry.js → p-18639885.entry.js} +1 -1
  234. package/dist/twilight/{p-dc7f11e4.entry.js → p-18a604c5.entry.js} +1 -1
  235. package/dist/twilight/{p-5364f42e.entry.js → p-1abe8321.entry.js} +1 -1
  236. package/dist/twilight/{p-27b6fd51.entry.js → p-1bf18c56.entry.js} +1 -1
  237. package/dist/twilight/{p-c3bed022.entry.js → p-211324e6.entry.js} +1 -1
  238. package/dist/twilight/p-22cb8a9c.entry.js +4 -0
  239. package/dist/twilight/{p-c2005d4a.entry.js → p-2331e63a.entry.js} +1 -1
  240. package/dist/twilight/{p-ab86dc29.entry.js → p-27456209.entry.js} +1 -1
  241. package/dist/twilight/{p-c72a1861.entry.js → p-2a3d30d1.entry.js} +1 -1
  242. package/dist/twilight/{p-4d149e9e.entry.js → p-2a683382.entry.js} +1 -1
  243. package/dist/twilight/{p-7e26332e.entry.js → p-2bef08e8.entry.js} +1 -1
  244. package/dist/twilight/{p-73db9793.entry.js → p-2c48bb97.entry.js} +1 -1
  245. package/dist/twilight/p-2df31e90.entry.js +4 -0
  246. package/dist/twilight/{p-7122a097.entry.js → p-2ff7bb22.entry.js} +1 -1
  247. package/dist/twilight/{p-ed5d8787.entry.js → p-357b5593.entry.js} +1 -1
  248. package/dist/twilight/{p-8c086859.entry.js → p-3aa6fa7d.entry.js} +1 -1
  249. package/dist/twilight/{p-a5185029.entry.js → p-3c2cc4fe.entry.js} +1 -1
  250. package/dist/twilight/{p-c15eeb62.entry.js → p-3fb485a6.entry.js} +1 -1
  251. package/dist/twilight/{p-e4c3ca60.entry.js → p-43f8f33b.entry.js} +1 -1
  252. package/dist/twilight/{p-354da069.entry.js → p-47713dd1.entry.js} +1 -1
  253. package/dist/twilight/{p-86cec54b.entry.js → p-49738042.entry.js} +1 -1
  254. package/dist/twilight/{p-499ccb8b.entry.js → p-49f9e536.entry.js} +1 -1
  255. package/dist/twilight/{p-945b3f38.entry.js → p-4ef06a6f.entry.js} +1 -1
  256. package/dist/twilight/{p-55c716a4.entry.js → p-501c0798.entry.js} +1 -1
  257. package/dist/twilight/{p-a5f477fd.entry.js → p-523572e9.entry.js} +1 -1
  258. package/dist/twilight/{p-f3bd1c09.entry.js → p-54974d98.entry.js} +1 -1
  259. package/dist/twilight/{p-a9554697.entry.js → p-56845467.entry.js} +1 -1
  260. package/dist/twilight/{p-3c99951e.entry.js → p-569c6d6c.entry.js} +1 -1
  261. package/dist/twilight/{p-14f2c393.entry.js → p-56f164bb.entry.js} +1 -1
  262. package/dist/twilight/{p-8fa81b10.entry.js → p-5918dd8d.entry.js} +1 -1
  263. package/dist/twilight/{p-95117a08.entry.js → p-5ba2eb55.entry.js} +1 -1
  264. package/dist/twilight/{p-28efc3a8.entry.js → p-5cd4b67f.entry.js} +1 -1
  265. package/dist/twilight/{p-bf9cc549.entry.js → p-5dfd449d.entry.js} +1 -1
  266. package/dist/twilight/{p-a30ae3e6.entry.js → p-683db553.entry.js} +1 -1
  267. package/dist/twilight/{p-d322a3e8.entry.js → p-68d754be.entry.js} +1 -1
  268. package/dist/twilight/{p-84181d45.entry.js → p-6a746b8a.entry.js} +1 -1
  269. package/dist/twilight/{p-0357b501.entry.js → p-6c5a1ded.entry.js} +1 -1
  270. package/dist/twilight/{p-4358c48e.entry.js → p-6d787fa0.entry.js} +1 -1
  271. package/dist/twilight/{p-6da4a9b3.entry.js → p-6edd1008.entry.js} +1 -1
  272. package/dist/twilight/{p-7bdf543a.entry.js → p-6f3516a1.entry.js} +1 -1
  273. package/dist/twilight/{p-a72bf47b.entry.js → p-6f58ac6a.entry.js} +1 -1
  274. package/dist/twilight/{p-4cfccc31.entry.js → p-704553fb.entry.js} +1 -1
  275. package/dist/twilight/{p-f51a1326.entry.js → p-709c2184.entry.js} +1 -1
  276. package/dist/twilight/{p-453f92f9.entry.js → p-83a5b8a4.entry.js} +1 -1
  277. package/dist/twilight/{p-c0d89d74.entry.js → p-847cdd79.entry.js} +1 -1
  278. package/dist/twilight/p-84cffb13.entry.js +4 -0
  279. package/dist/twilight/{p-dc51e991.entry.js → p-869fe4c0.entry.js} +1 -1
  280. package/dist/twilight/{p-32af49cd.entry.js → p-8711224a.entry.js} +1 -1
  281. package/dist/twilight/{p-ee7530fe.entry.js → p-8ebb86ce.entry.js} +1 -1
  282. package/dist/twilight/{p-875beddd.entry.js → p-9025e5d9.entry.js} +1 -1
  283. package/dist/twilight/{p-4a8b3e89.entry.js → p-906b36e3.entry.js} +1 -1
  284. package/dist/twilight/{p-a9b9deb9.entry.js → p-90f29c99.entry.js} +1 -1
  285. package/dist/twilight/{p-42efd1b1.entry.js → p-9dd126e2.entry.js} +1 -1
  286. package/dist/twilight/{p-a909aff5.entry.js → p-9f431f78.entry.js} +1 -1
  287. package/dist/twilight/{p-5be5be8b.entry.js → p-9fdbe8a0.entry.js} +1 -1
  288. package/dist/twilight/{p-CW2JQnYK.js → p-B3oo4tIx.js} +1 -1
  289. package/dist/twilight/p-BRZVMxhy.js +9 -0
  290. package/dist/twilight/{p-C0qiFNJn.js → p-BsIeN-bg.js} +1 -1
  291. package/dist/twilight/{p-ClV-F79e.js → p-CPiqlSTo.js} +1 -1
  292. package/dist/twilight/{p-CyO2XGkr.js → p-CaCiueRc.js} +1 -1
  293. package/dist/twilight/p-D6rFREuQ.js +4 -0
  294. package/dist/twilight/{p-BeFR_h3q.js → p-DNS31w5e.js} +1 -1
  295. package/dist/twilight/{p-l7Rr63jq.js → p-DeX830vG.js} +1 -1
  296. package/dist/twilight/{p-b5028411.entry.js → p-a01f64e7.entry.js} +1 -1
  297. package/dist/twilight/{p-344f751a.entry.js → p-a037e47d.entry.js} +1 -1
  298. package/dist/twilight/{p-709af483.entry.js → p-a0ed97f5.entry.js} +1 -1
  299. package/dist/twilight/{p-8f2f8693.entry.js → p-a30390a7.entry.js} +1 -1
  300. package/dist/twilight/{p-b3ba53c5.entry.js → p-a344db00.entry.js} +1 -1
  301. package/dist/twilight/{p-b6d259be.entry.js → p-a3579980.entry.js} +1 -1
  302. package/dist/twilight/{p-7a1169f6.entry.js → p-a46a9d28.entry.js} +1 -1
  303. package/dist/twilight/{p-33c2f3bc.entry.js → p-a64771f7.entry.js} +1 -1
  304. package/dist/twilight/{p-a243d3cc.entry.js → p-a8316527.entry.js} +1 -1
  305. package/dist/twilight/{p-e2d501f5.entry.js → p-a9ef3c52.entry.js} +1 -1
  306. package/dist/twilight/{p-ecaf7d87.entry.js → p-aa8962f8.entry.js} +1 -1
  307. package/dist/twilight/{p-0dea4239.entry.js → p-aa91a230.entry.js} +1 -1
  308. package/dist/twilight/{p-b2662a4f.entry.js → p-af348a67.entry.js} +1 -1
  309. package/dist/twilight/{p-1adf1893.entry.js → p-b1e0bc90.entry.js} +1 -1
  310. package/dist/twilight/{p-0d44c47f.entry.js → p-b238c74b.entry.js} +1 -1
  311. package/dist/twilight/{p-6da0b2b3.entry.js → p-b5a2342c.entry.js} +1 -1
  312. package/dist/twilight/{p-b73b7e15.entry.js → p-be0ac755.entry.js} +1 -1
  313. package/dist/twilight/{p-6bedb896.entry.js → p-cdba9d35.entry.js} +1 -1
  314. package/dist/twilight/{p-fba13fd5.entry.js → p-d5215891.entry.js} +1 -1
  315. package/dist/twilight/{p-a8561cc8.entry.js → p-e3e2baa2.entry.js} +1 -1
  316. package/dist/twilight/{p-7f11af86.entry.js → p-e875f53e.entry.js} +1 -1
  317. package/dist/twilight/{p-ae96e338.entry.js → p-ea968ba3.entry.js} +1 -1
  318. package/dist/twilight/{p-88148fed.entry.js → p-eb3a095b.entry.js} +1 -1
  319. package/dist/twilight/{p-c82b8aa7.entry.js → p-ebc6ba28.entry.js} +1 -1
  320. package/dist/twilight/{p-b8da968d.entry.js → p-ecdbd18f.entry.js} +1 -1
  321. package/dist/twilight/{p-4ebdef90.entry.js → p-ef145c1e.entry.js} +1 -1
  322. package/dist/twilight/{p-5d71c16a.entry.js → p-efe6493f.entry.js} +1 -1
  323. package/dist/twilight/{p-5d261682.entry.js → p-f037e508.entry.js} +1 -1
  324. package/dist/twilight/{p-34889d17.entry.js → p-f4f355e5.entry.js} +1 -1
  325. package/dist/twilight/{p-862f7fda.entry.js → p-fed3efba.entry.js} +1 -1
  326. package/dist/twilight/{p-b217fea1.entry.js → p-ff37c2af.entry.js} +1 -1
  327. package/dist/twilight/{p-yV2X3Oc1.js → p-mgSPapOV.js} +1 -1
  328. package/dist/twilight/{p-C7NprL2x.js → p-wqmCmzsY.js} +1 -1
  329. package/dist/twilight/twilight.esm.js +1 -1
  330. package/dist/types/Helpers/Helper.d.ts +10 -0
  331. package/dist/types/components/salla-applied-filters/salla-applied-filters.d.ts +37 -0
  332. package/dist/types/components/salla-filters/salla-filters.d.ts +3 -11
  333. package/dist/types/components.d.ts +17 -0
  334. package/package.json +5 -5
  335. package/dist/cjs/interfaces-DZDQwN6-.js +0 -23
  336. package/dist/esm/interfaces-DL4h2bc3.js +0 -23
  337. package/dist/twilight/p-01b52f2f.entry.js +0 -4
  338. package/dist/twilight/p-B3th5No1.js +0 -9
  339. package/dist/twilight/p-DL4h2bc3.js +0 -4
  340. package/dist/twilight/p-DOBDDG4K.js +0 -4
  341. package/dist/twilight/p-c55c576c.entry.js +0 -4
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r as e,h as t,H as s}from"./p-C0qiFNJn.js";const i=class{constructor(t){e(this,t),this.otpInputs=[],this.deletePendingDays=null,this.currentStep="confirm",this.isDeletePending=!1,this.otpType="email",this.otpHasError=!1,this.otpErrorMessage="",this.isSubmitting=!1,this.isVerifyingOtp=!1,this.isSwitchingChannel=!1,this.resendAfter=30,this.showResendLink=!1,this.canHideName=salla.config.get("store.settings.rating.can_customer_hide_name"),this.translationDefaults={"pages.profile.delete_account":{ar:"حذف الحساب",en:"Delete account"},"pages.profile.delete_account_description":{ar:"سيُحذف حسابك وبياناتك من المتجر نهائيًا، بما في ذلك سجل طلباتك.",en:"Your account and data will be permanently deleted from the store, including your order history."},"pages.profile.delete_account_confirm_title":{ar:"هل تريد حذف حسابك؟",en:"Do you want to delete your account?"},"pages.profile.delete_account_warning":{ar:"بعد الحذف، ستفقد الوصول إلى بياناتك، بما في ذلك سجل الطلبات، وقائمة الأمنيات، وأي نقاط ولاء أو رصيد متاح في المحفظة.",en:"After deletion, you will lose access to your data, including order history, wishlist, and any loyalty points or wallet balance."},"pages.profile.cancel":{ar:"إلغاء",en:"Cancel"},"pages.profile.delete_account_otp_title":{ar:"تأكيد حذف الحساب",en:"Confirm account deletion"},"pages.profile.delete_account_otp_instruction":{ar:"للمتابعة، أدخل رمز التحقٌّق المرسل إلى:",en:"To continue, enter the verification code sent to:"},"pages.profile.delete_account_confirm_otp":{ar:"تأكيد الحذف",en:"Confirm deletion"},"pages.profile.delete_account_otp_required":{ar:"يرجى إدخال رمز التحقٌّق",en:"Please enter the verification code"},"pages.profile.delete_account_send_via_phone":{ar:"إرسال عبر الهاتف",en:"Send via phone"},"pages.profile.delete_account_send_via_email":{ar:"إرسال عبر البريد الإلكتروني",en:"Send via email"},"pages.profile.delete_account_success_title":{ar:"أُرسل طلب حذف الحساب",en:"Account deletion request submitted"},"pages.profile.delete_account_success_message":{ar:"سيُحذف حسابك خلال 30 يومًا. يمكنك إلغاء الطلب بتسجيل الدخول مرة أخرى قبل اكتمال الحذف.",en:"Your account will be deleted within 30 days. You can cancel the request by signing in again before deletion is complete."},"pages.profile.ok":{ar:"موافق",en:"OK"},"pages.profile.cancel_deletion_request":{ar:"تراجع عن الحذف",en:"Withdraw deletion"},"pages.profile.delete_account_pending":{ar:"حسابك مجدول للحذف نهائيًا من المتجر خلال :days يومًا. يمكنك التراجع عن الحذف قبل انقضاء المدة.",en:"Your account will be deleted permanently from the store within :days days. You can withdraw the deletion before the deadline."},"pages.profile.delete_request_cancelled":{ar:"تم إلغاء طلب الحذف",en:"Deletion request cancelled"}},this.registerTranslationDefaults(),this.loadTranslations(),salla.onReady((()=>{this.isHiddenName=salla.config.get("user.is_hidden_name"),this.isNotifiable=salla.config.get("user.is_notifiable"),this.canHideName=salla.config.get("store.settings.rating.can_customer_hide_name"),this.fetchDeleteRequestStatus(),this.isNotifiable&&this.isHiddenName||salla.event.on("profile::info.fetched",(e=>{this.isHiddenName=e.data.is_hidden_name,this.isNotifiable=e.data.is_notifiable}))})),salla.lang.onLoaded((()=>{this.registerTranslationDefaults(),this.loadTranslations()}))}getDaysUntilExecution(e){return Math.max(0,Math.ceil(((e>1e12?e:1e3*e)-Date.now())/864e5))}applyPendingMessage(){const e=salla.lang.get("pages.profile.delete_account_pending");this.deleteAccountPending=null!=this.deletePendingDays?e.replace(/:days/g,String(salla.helpers.number(this.deletePendingDays))):e}async fetchDeleteRequestStatus(){try{const e=await salla.profile.getDeleteRequest(),t=e?.data??null,s=t?.data_request||t,i=s?.status;this.isDeletePending="pending"===i;const r=s?.execution_at;this.deletePendingDays=null==r||Number.isNaN(Number(r))?null:this.getDaysUntilExecution(Number(r)),this.applyPendingMessage()}catch{}}registerTranslationDefaults(){if(!salla?.lang?.addBulk)return;const e=Object.entries(this.translationDefaults).reduce(((e,[t,s])=>(salla.lang.get(t)===t&&(e[t]=s),e)),{});Object.keys(e).length&&salla.lang.addBulk(e)}loadTranslations(){this.deleteAccount=salla.lang.get("pages.profile.delete_account"),this.deleteAccountDesc=salla.lang.get("pages.profile.delete_account_description"),this.deleteConfirmTitle=salla.lang.get("pages.profile.delete_account_confirm_title"),this.deleteAccountWarning=salla.lang.get("pages.profile.delete_account_warning"),this.cancelLabel=salla.lang.get("pages.profile.cancel"),this.deleteOtpTitle=salla.lang.get("pages.profile.delete_account_otp_title"),this.deleteOtpInstruction=salla.lang.get("pages.profile.delete_account_otp_instruction"),this.deleteConfirmOtp=salla.lang.get("pages.profile.delete_account_confirm_otp"),this.sendViaPhone=salla.lang.get("pages.profile.delete_account_send_via_phone"),this.sendViaEmail=salla.lang.get("pages.profile.delete_account_send_via_email"),this.deleteSuccessTitle=salla.lang.get("pages.profile.delete_account_success_title"),this.deleteSuccessMessage=salla.lang.get("pages.profile.delete_account_success_message"),this.okLabel=salla.lang.get("pages.profile.ok"),this.cancelDeletionRequest=salla.lang.get("pages.profile.cancel_deletion_request"),this.applyPendingMessage(),this.resendAfterLabel=salla.lang.get("blocks.header.resend_after"),this.resendLabel=salla.lang.get("blocks.comments.submit"),this.promotionalMsgs=salla.lang.get("pages.profile.promotional_messages"),this.hideMyName=salla.lang.get("pages.profile.hide_my_name"),this.hideMyNameDesc=salla.lang.get("pages.profile.hide_my_name_desc"),this.promotionalMsgsDesc=salla.lang.get("pages.profile.promotional_messages_description")}toggleSetting(e,t){salla.profile.updateSettings({name:e,value:t.target.checked})}capitalizeText(e){return e?e.charAt(0).toUpperCase()+e.slice(1):""}getOtpTarget(){return"email"===this.otpType?salla.config.get("user.email")||"":salla.config.get("user.mobile")||""}updateModalForStep(){if(this.confirmationModal)switch(this.currentStep){case"confirm":this.confirmationModal.setTitle(this.capitalizeText(this.deleteConfirmTitle));break;case"otp":this.confirmationModal.setTitle(this.capitalizeText(this.deleteOtpTitle));break;case"success":this.confirmationModal.setTitle(this.capitalizeText(this.deleteSuccessTitle))}}openDeleteModal(){this.currentStep="confirm",this.otpType="email",this.resetOtpInputs(),this.clearResendTimer(),this.updateModalForStep(),this.confirmationModal.open()}closeDeleteModal(){this.clearResendTimer(),this.confirmationModal?.close()}goBackFromOtp(){this.clearResendTimer(),this.resetOtpInputs(),this.resetOtpError(),this.currentStep="confirm",this.updateModalForStep()}async handleModalVisibilityChanged(e){if(e.detail)return;this.clearResendTimer();const t="success"===this.currentStep;t&&(this.isDeletePending=!0),this.currentStep="confirm",this.resetOtpInputs(),t&&await this.fetchDeleteRequestStatus()}formatResendTimer(e){return"00 : "+(e>=10?`${e}`:`0${e}`)}updateResendTimerDisplay(){this.timerEl&&(this.timerEl.innerHTML=this.formatResendTimer(this.resendAfter))}isDeleteRequestInFlight(){return this.isSubmitting||this.isSwitchingChannel||this.isVerifyingOtp}async initiateDeleteRequest(e="confirm"){if(!this.isDeleteRequestInFlight()){"switch"===e||"resend"===e?this.isSwitchingChannel=!0:this.isSubmitting=!0;try{await salla.profile.initiateDeleteRequest(this.otpType),this.currentStep="otp",this.updateModalForStep(),this.resetOtpInputs(),this.startResendTimer(),setTimeout((()=>this.otpInputs[0]?.focus()),100)}catch(e){salla.notify?.error?.(e.response?.data?.error?.message||salla.lang.get("common.errors.error_occurred"))}finally{"switch"===e||"resend"===e?this.isSwitchingChannel=!1:this.isSubmitting=!1}}}async switchOtpChannel(){this.isDeleteRequestInFlight()||(this.otpType="email"===this.otpType?"mobile":"email",await this.initiateDeleteRequest("switch"))}async resendOtp(){this.showResendLink&&!this.isDeleteRequestInFlight()&&await this.initiateDeleteRequest("resend")}collectOtpCode(){const e=salla.helpers.number(this.otpInputs.map((e=>e?.value||"")).join(""),!0).replace(/[^0-9]/g,"");return this.hiddenCodeInput&&(this.hiddenCodeInput.value=e),e}resetOtpError(){this.otpHasError=!1,this.otpErrorMessage=""}setOtpError(e){this.otpHasError=!0,this.otpErrorMessage=e}async verifyDeleteOtp(){if(this.isVerifyingOtp||this.isSwitchingChannel)return;const e=this.collectOtpCode();if(e.length<4)return this.setOtpError(salla.lang.get("pages.profile.delete_account_otp_required")),void this.otpInputs[e.length]?.focus();this.resetOtpError(),this.isVerifyingOtp=!0;try{const t=await salla.profile.verifyDeleteRequest({type:this.otpType,code:e});this.deleteSuccessMessage=t?.data?.message||salla.lang.get("pages.profile.delete_account_success_message"),this.clearResendTimer(),this.resetOtpInputs(),this.otpInputs=[],this.currentStep="success",this.updateModalForStep()}catch(e){this.setOtpError(e.response?.data?.error?.message||salla.lang.get("common.errors.error_occurred")),this.resetOtpInputs()}finally{this.isVerifyingOtp=!1}}async confirmSuccess(){this.isDeletePending=!0,this.closeDeleteModal(),this.currentStep="confirm",await this.fetchDeleteRequestStatus()}async cancelDeleteRequest(){if(!this.isSubmitting){this.isSubmitting=!0;try{const e=(await salla.profile.cancelDeleteRequest()).message||salla.lang.get("pages.profile.delete_request_cancelled");this.isDeletePending=!1,salla.notify?.success?.(e)}catch(e){salla.notify?.error?.(e.response?.data?.error?.message||salla.lang.get("common.errors.error_occurred"))}finally{this.isSubmitting=!1}}}resetOtpInputs(){this.otpInputs.forEach((e=>{e&&(e.value="")})),this.hiddenCodeInput&&(this.hiddenCodeInput.value="")}modifyNextOtpInput(e,t){e.value=t[0],t=t.substring(1),e.nextElementSibling&&t.length?this.modifyNextOtpInput(e.nextElementSibling,t):e.nextElementSibling||0!==t.length?e.nextElementSibling&&0===t.length&&e.nextElementSibling.focus():e.focus()}splitOtpNumber(e){const t=salla.helpers.number(e.data||e.target.value||"",!0).replace(/[^0-9]/g,"");t&&1!==t.length&&this.modifyNextOtpInput(e.target,t)}allOtpInputsFilled(){return this.otpInputs.every((e=>e?.value))}handleOtpInput(e){this.resetOtpError(),e.target.value=salla.helpers.number(e.target.value||"",!0),salla.helpers.inputDigitsOnly(e.target),this.allOtpInputsFilled()&&setTimeout((()=>this.verifyDeleteOtp()),100)}handleOtpKeyUp(e){if(this.resetOtpError(),["Alt","Shift","Control","AltGraph","Ctrl"].includes(e.key))return;const t=e.keyCode||e.charCode;e.target.value?(e.target.nextElementSibling?.focus(),e.target.nextElementSibling?.select()):[8,46].includes(t)&&(e.target.previousElementSibling?.focus(),e.target.previousElementSibling?.select()),e.target.value.length>1&&this.splitOtpNumber(e)}handleOtpPaste(e){this.resetOtpError();const t=salla.helpers.number(e.clipboardData.getData("text")||"",!0).replace(/[^0-9]/g,"").substring(0,this.otpInputs.length);this.otpInputs.forEach((e=>e.value="")),this.otpInputs[0]&&this.modifyNextOtpInput(this.otpInputs[0],t)}handleOtpFocus(e){e.target!==this.otpInputs[0]&&(""===this.otpInputs[0]?.value&&this.otpInputs[0].focus(),""===e.target.previousElementSibling?.value&&e.target.previousElementSibling.focus())}startResendTimer(){this.clearResendTimer(),this.resendAfter=30,this.showResendLink=!1,this.updateResendTimerDisplay(),this.resendTimerId=setInterval((()=>{if(this.resendAfter--,this.resendAfter<=0)return this.clearResendTimer(),void(this.showResendLink=!0);this.updateResendTimerDisplay()}),1e3)}clearResendTimer(){this.resendTimerId&&(clearInterval(this.resendTimerId),this.resendTimerId=null),this.showResendLink=!1}renderUserDeleteIcon(){return t("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"24",height:"24",color:"currentColor",fill:"none",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},t("path",{d:"M14.5 8C14.5 5.23858 12.2614 3 9.5 3C6.73858 3 4.5 5.23858 4.5 8C4.5 10.7614 6.73858 13 9.5 13C12.2614 13 14.5 10.7614 14.5 8Z"}),t("path",{d:"M15.5 21L18.5 18M18.5 18L21.5 15M18.5 18L15.5 15M18.5 18L21.5 21"}),t("path",{d:"M2.5 20C2.5 16.134 5.63401 13 9.5 13C10.775 13 11.9704 13.3409 13 13.9365"}))}renderConfirmStep(){return t("div",{class:"s-user-settings-delete-body"},t("p",{class:"s-user-settings-delete-warning"},this.deleteAccountWarning),t("div",{class:"s-user-settings-delete-actions s-user-settings-delete-actions--row"},t("salla-button",{width:"wide",fill:"outline",color:"danger",onClick:()=>this.closeDeleteModal()},this.capitalizeText(this.cancelLabel)),t("salla-button",{width:"wide",color:"primary",loading:this.isSubmitting,onClick:()=>this.initiateDeleteRequest()},this.capitalizeText(this.deleteAccount))))}renderOtpStep(){return t("div",{class:"s-user-settings-delete-body"},t("p",{class:"s-user-settings-delete-otp-instruction"},this.deleteOtpInstruction),t("p",{class:"s-user-settings-delete-otp-target"},this.getOtpTarget()),t("input",{type:"hidden",name:"code",maxlength:"4",ref:e=>this.hiddenCodeInput=e}),t("div",{class:{"s-user-settings-delete-otp-codes":!0,"has-error":this.otpHasError},dir:"ltr"},[1,2,3,4].map((e=>t("input",{type:"text",autocomplete:"one-time-code",pattern:"[0-9]*",inputmode:"numeric",maxlength:"1",id:`delete-otp-${e}`,class:{"s-user-settings-delete-otp-input":!0,"s-has-error":this.otpHasError},onInput:e=>this.handleOtpInput(e),onPaste:e=>this.handleOtpPaste(e),onKeyUp:e=>this.handleOtpKeyUp(e),onFocus:e=>this.handleOtpFocus(e),ref:t=>this.otpInputs[e-1]=t,required:!0})))),this.otpHasError&&this.otpErrorMessage?t("span",{class:"s-user-settings-delete-otp-error"},this.otpErrorMessage):"",t("div",{class:"s-user-settings-delete-actions s-user-settings-delete-actions--stack"},t("salla-button",{width:"wide",color:"primary",disabled:this.isSwitchingChannel,onClick:()=>this.verifyDeleteOtp()},this.capitalizeText(this.deleteConfirmOtp)),t("salla-button",{width:"wide",fill:"outline",color:"primary",disabled:this.isVerifyingOtp,onClick:()=>this.switchOtpChannel()},this.capitalizeText("email"===this.otpType?this.sendViaPhone:this.sendViaEmail))),t("p",{class:"s-user-settings-delete-otp-resend",style:{display:this.showResendLink?"none":"block"}},this.resendAfterLabel,t("b",{class:"s-user-settings-delete-otp-timer mx-1 font-bold",ref:e=>this.timerEl=e})),t("a",{href:"#",class:"s-user-settings-delete-otp-resend-link",style:{display:this.showResendLink?"block":"none"},onClick:e=>{e.preventDefault(),this.resendOtp()}},this.resendLabel))}renderSuccessStep(){return t("div",{class:"s-user-settings-delete-body"},t("p",{class:"s-user-settings-delete-success-body"},this.deleteSuccessMessage),t("div",{class:"s-user-settings-delete-actions s-user-settings-delete-actions--stack"},t("salla-button",{class:"s-user-settings-delete-success-btn",width:"wide",color:"primary",onClick:()=>this.confirmSuccess()},this.capitalizeText(this.okLabel))))}renderDeleteStep(){switch(this.currentStep){case"otp":return this.renderOtpStep();case"success":return this.renderSuccessStep();default:return this.renderConfirmStep()}}renderDeleteSectionAction(){return this.isDeletePending?t("salla-button",{fill:"outline",color:"danger",shape:"btn",size:"medium",width:"normal",loading:this.isSubmitting,onClick:()=>this.cancelDeleteRequest()},this.capitalizeText(this.cancelDeletionRequest)):t("salla-button",{fill:"outline",color:"danger",shape:"btn",size:"medium",width:"normal",onClick:()=>this.openDeleteModal()},this.capitalizeText(this.deleteAccount))}render(){return t(s,{key:"64356c5b57d826fce8c29cc319a9762464c7fe51",class:"s-user-settings-wrapper"},this.canHideName&&t("div",{key:"4f7b3eb703f89e4a758fca54ba1b214f6724aaea",class:"s-user-settings-section"},t("salla-list-tile",{key:"7ad109e36b278fe81a314d51e1ab68030dd96cdc"},t("div",{key:"c789b7e2c541e25aaaf336e052d1986f6429da71",slot:"icon",class:"s-user-settings-section-icon"},t("span",{key:"5d7b377aefb80139527d8814ee2c636fa9c73e0f",innerHTML:'\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>user-cancel</title>\n<path d="M29.885 16l1.724-1.724c0.521-0.521 0.521-1.364 0-1.885s-1.364-0.521-1.885 0l-1.724 1.724-1.724-1.724c-0.521-0.521-1.364-0.521-1.885 0s-0.521 1.364 0 1.885l1.724 1.724-1.724 1.724c-0.521 0.521-0.521 1.364 0 1.885 0.26 0.26 0.601 0.391 0.943 0.391s0.683-0.131 0.943-0.391l1.724-1.724 1.724 1.724c0.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.885zM10.667 16c4.043 0 7.333-3.289 7.333-7.333s-3.291-7.333-7.333-7.333-7.333 3.289-7.333 7.333 3.291 7.333 7.333 7.333zM10.667 4c2.573 0 4.667 2.093 4.667 4.667s-2.093 4.667-4.667 4.667-4.667-2.093-4.667-4.667 2.093-4.667 4.667-4.667zM10.667 18.667c-5.881 0-10.667 3.813-10.667 8.5v2.167c0 0.736 0.596 1.333 1.333 1.333s1.333-0.597 1.333-1.333v-2.167c0-3.217 3.588-5.833 8-5.833s8 2.616 8 5.833v2.167c0 0.736 0.596 1.333 1.333 1.333s1.333-0.597 1.333-1.333v-2.167c0-4.687-4.785-8.5-10.667-8.5z"></path>\n</svg>\n'})),t("div",{key:"fdb9d6130ef27cffbe4e2ef06e7b9155d0d04c2b",slot:"title",class:"s-user-settings-section-title"},this.capitalizeText(this.hideMyName)),t("div",{key:"bd8592a487c79926355eeea25a5e1429bca0fd80",slot:"subtitle",class:"s-user-settings-section-subtitle"},this.capitalizeText(this.hideMyNameDesc)),t("div",{key:"cf21ed12bb38dc3a613efac6d017a72aab38780b",slot:"action",class:"s-user-settings-section-action"},t("label",{key:"160140e25cf8e6c4556e52c0b36ba5769618b419",class:"s-toggle"},t("input",{key:"369a694fabbd42e6c239b23c26d68f858775ffe2",class:"s-toggle-input",checked:this.isHiddenName,onChange:e=>this.toggleSetting("is_hidden_name",e),type:"checkbox"}),t("div",{key:"5952ec01913ef95d888eeb3aace14123ffd3ef6f",class:"s-toggle-switcher"}))))),t("div",{key:"885355f8435759c9359a3d9eb95d5637b1c74751",class:"s-user-settings-section"},t("salla-list-tile",{key:"93b607850b20add5384a3b28e4e58fbfcb181d53"},t("div",{key:"c795aabfdc6df0beb9c0bfcf73ad87625eb7f51b",slot:"icon",class:"s-user-settings-section-icon"},t("span",{key:"a59ede027c4466a1e84e8e8b4c649c7b418dd0a3",innerHTML:'\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>bullhorn</title>\n<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>\n</svg>\n'})),t("div",{key:"e7af96b6f919a8be8bb126237cb3977e72a7c089",slot:"title",class:"s-user-settings-section-title"},this.capitalizeText(this.promotionalMsgs)),t("div",{key:"dab7b270443b6eddccd7df739c2bee82eb7706af",slot:"subtitle",class:"s-user-settings-section-subtitle"},this.capitalizeText(this.promotionalMsgsDesc)),t("div",{key:"56a6f18c788891fe9215a57d0fcaa5cf98bd3aa5",slot:"action",class:"s-user-settings-section-action"},t("label",{key:"1fc28780fe779099eaed7916f31cbbb681c10fe9",class:"s-toggle"},t("input",{key:"832edd6e5b806171bb913163b7d5c19dbb0833f5",class:"s-toggle-input",checked:this.isNotifiable,onChange:e=>this.toggleSetting("is_notifiable",e),type:"checkbox"}),t("div",{key:"54260d8cca19ca6914cdd3bf15093b9669fef44a",class:"s-toggle-switcher"}))))),t("div",{key:"549bae1159a55b035952a12c8dc9d2b9d660f5bf",class:"s-user-settings-section s-user-settings-section-delete-user"},t("salla-list-tile",{key:"7969327e863cd998a120f27d61621d83ef8e57d5"},t("div",{key:"acf14b5e6ce76657fe0016aa63e26851e7688cd5",slot:"icon",class:"s-user-settings-section-icon"},this.renderUserDeleteIcon()),t("div",{key:"4a38cf9d0510e784317b0eb4db2fd4589a9f71d4",slot:"title",class:"s-user-settings-section-title"},this.capitalizeText(this.deleteAccount)),t("div",{key:"054f6a6c30f2eb9794f83a0998f20e208c7ed85a",slot:"subtitle",class:"s-user-settings-section-subtitle"},this.capitalizeText(this.isDeletePending?this.deleteAccountPending:this.deleteAccountDesc)),t("div",{key:"00d392a300b986d5d3e6f6711e6996df9731962d",slot:"action",class:"s-user-settings-section-action"},this.renderDeleteSectionAction()))),t("salla-modal",{key:"d4e8006e57d9c35267177f07b60e510ea3e53400",id:"salla-user-settings-delete-modal",width:"xs",centered:!0,showBack:"otp"===this.currentStep,isClosable:"success"!==this.currentStep,iconStyle:"success"===this.currentStep?"success":void 0,onModalVisibilityChanged:e=>this.handleModalVisibilityChanged(e),onModalBack:()=>this.goBackFromOtp(),ref:e=>this.confirmationModal=e},"success"!==this.currentStep?t("span",{slot:"icon",class:"s-user-settings-delete-icon"},this.renderUserDeleteIcon()):null,t("div",{key:this.currentStep,class:"s-user-settings-delete-step"},this.renderDeleteStep())))}};i.style='/*!twlt*/.s-modal-header-inner{display:flex;flex-direction:column !important;align-items:center !important;justify-content:center !important}.s-modal-header-content{text-align:center !important}.s-user-settings-delete-body{text-align:center}.s-user-settings-delete-icon{display:inline-flex;align-items:center;justify-content:center;width:4rem;height:4rem;border-radius:9999px;border:1px solid var(--infinte-color);color:var(--infinte-color);margin:0 auto 1rem}.s-user-settings-delete-icon svg{width:1.5rem;height:1.5rem}.s-user-settings-delete-warning{color:#6b7280;font-size:0.875rem;line-height:1.625;margin-bottom:1.25rem}.s-user-settings-delete-actions--row{display:flex;gap:0.75rem;justify-content:center}.s-user-settings-delete-actions--row salla-button{flex:1}.s-user-settings-delete-actions--stack{display:flex;flex-direction:column;gap:0.75rem;margin-top:1.25rem}.s-user-settings-delete-otp-instruction{color:#6b7280;font-size:0.875rem}.s-user-settings-delete-otp-target{color:#6b7280;direction:ltr;margin-bottom:1.25rem}.s-user-settings-delete-otp-codes{display:flex;justify-content:stretch;gap:0.75rem;direction:ltr;margin-bottom:0.75rem;width:100%}.s-user-settings-delete-otp-codes.has-error{margin-bottom:0}.s-user-settings-delete-otp-input{flex:1 1 0;min-width:0;width:100%;height:3.5rem;text-align:center;border:1px solid #d1d5db;border-radius:0.5rem;font-size:1.25rem;font-weight:600;color:#111827;outline:none}.s-user-settings-delete-otp-input:focus{border-color:#004956;box-shadow:0 0 0 1px #004956}.s-user-settings-delete-otp-input.s-has-error{border-color:#ef4444 !important}.s-user-settings-delete-otp-input.s-has-error:focus{border-color:#ef4444 !important;box-shadow:0 0 0 1px #ef4444}.s-user-settings-delete-otp-input::-webkit-outer-spin-button,.s-user-settings-delete-otp-input::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}.s-user-settings-delete-otp-input[type=text]{-moz-appearance:textfield}.s-user-settings-delete-otp-error{display:block;color:#ef4444;font-size:0.75rem;text-align:center;padding-top:0.75rem;margin-bottom:1.25rem}.s-user-settings-delete-otp-resend{color:#6b7280;font-size:0.75rem;margin-top:1rem;text-align:center}.s-user-settings-delete-otp-timer{font-weight:600;direction:ltr;display:inline-block}.s-user-settings-delete-otp-resend-link{display:block;color:#004956;font-size:0.875rem;margin-top:1rem;text-align:center;text-decoration:underline;cursor:pointer}.s-user-settings-delete-success-body{color:#6b7280;font-size:0.875rem;line-height:1.625;margin-bottom:1.25rem}.s-user-settings-delete-success-btn{--s-button-color:#004956}.mx-1{margin-left:0.25rem;margin-right:0.25rem}.block{display:block}.hidden{display:none}.font-bold{font-weight:700}.outline{outline-style:solid}.s-has-error{--tw-border-opacity:1;border-color:rgb(248 113 113 / var(--tw-border-opacity, 1))}.s-has-error:focus{--tw-border-opacity:1;border-color:rgb(239 68 68 / var(--tw-border-opacity, 1))}.btn{display:inline-flex;flex:1 1 0%;align-items:center;justify-content:center;white-space:nowrap;border-radius:0.375rem;padding-left:1.5rem;padding-right:1.5rem;padding-bottom:0.625rem;padding-top:0.5rem;font-size:0.875rem;line-height:1.25rem;font-weight:700;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:300ms}.btn:hover{opacity:0.8}.has-error .s-form-label{color:#ff443a}.has-error .s-form-control,.has-error .s-tel-input-control,.has-error .s-datetime-picker-input{border-color:#ff443a;color:#ff443a}.toggle-checkbox .s-toggle-input{position:absolute;visibility:hidden}.toggle-checkbox .s-toggle-switcher{display:inline-block;background:#ccc;border-radius:16px;width:40px;height:25px;position:relative;vertical-align:middle;transition:background 0.25s}.toggle-checkbox .s-toggle-switcher:before,.toggle-checkbox .s-toggle-switcher:after{content:""}.toggle-checkbox .s-toggle-switcher:before{display:block;background:#fff;border-radius:50%;box-shadow:0 0 0 1px rgba(0,0,0,0.25);width:20px;height:21px;position:absolute;top:2.2px;left:1px;transition:left 0.25s}.toggle-checkbox .s-toggle-input:checked+div{background:#30D158}.toggle-checkbox .s-toggle-input:checked+div:before{left:18px}.s-has-error{--tw-border-opacity:1 !important;border-color:rgb(239 68 68 / var(--tw-border-opacity, 1)) !important;--tw-text-opacity:1 !important;color:rgb(239 68 68 / var(--tw-text-opacity, 1)) !important}.s-toggle{cursor:pointer;display:inline-block}.s-toggle .s-toggle-input{position:absolute;visibility:hidden}.s-toggle .s-toggle-label{margin-left:5px;position:relative;top:2px}.s-toggle .s-toggle-switcher{display:inline-block;background:#ccc;border-radius:16px;width:40px;height:25px;position:relative;vertical-align:middle;transition:background 0.25s}.s-toggle .s-toggle-switcher:before,.s-toggle .s-toggle-switcher:after{content:""}.s-toggle .s-toggle-switcher:before{display:block;background:#fff;border-radius:50%;box-shadow:0 0 0 1px rgba(0,0,0,0.25);width:20px;height:21px;position:absolute;top:2.2px;left:1px;transition:left 0.25s}.s-toggle .s-toggle-input:checked+div{background:#30D158}.s-toggle .s-toggle-input:checked+div:before{left:18px}.s-user-settings-section{border-bottom-width:1px;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1));--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.s-user-settings-section:first-child{border-bottom-right-radius:0px;border-bottom-left-radius:0px;border-top-left-radius:0.375rem;border-top-right-radius:0.375rem}.s-user-settings-section:last-child{border-bottom-right-radius:0.375rem;border-bottom-left-radius:0.375rem;border-top-left-radius:0px;border-top-right-radius:0px;border-bottom-width:0px}.s-user-settings-section .s-list-tile-item{align-items:flex-start;background-color:transparent;padding:1.25rem}@media (min-width: 768px){.s-user-settings-section .s-list-tile-item{align-items:center}}.s-user-settings-section .s-list-tile-item-action{margin-left:auto}.s-user-settings-section .s-list-tile-item-action:where([dir="rtl"],[dir="rtl"] *){margin-right:auto;margin-left:0px}.s-user-settings-section .s-list-tile-item-action button{width:100%;padding:10px}.s-user-settings-section-delete-user .s-list-tile-item{flex-wrap:wrap}@media (min-width: 768px){.s-user-settings-section-delete-user .s-list-tile-item{flex-wrap:nowrap}}.s-user-settings-section-delete-user .s-list-tile-item-icon{position:relative;top:5px}@media (min-width: 768px){.s-user-settings-section-delete-user .s-list-tile-item-icon{top:0px}}@media (max-width: 768px){.s-user-settings-section-delete-user .s-list-tile-item-content{flex:1 0 85%}.s-user-settings-section-delete-user .s-list-tile-item-action{flex:1 1 100%;margin-top:1rem}}.s-user-settings-section-title{font-size:1rem;line-height:1.5rem;--tw-text-opacity:1;color:rgb(17 24 39 / var(--tw-text-opacity, 1))}.s-user-settings-section-subtitle{font-size:0.75rem;line-height:1rem;--tw-text-opacity:1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.s-user-settings-section-icon svg{height:1.25rem;width:1.25rem}.s-user-settings-confirmation{text-align:center}.s-user-settings-confirmation svg{text-align:center}.s-user-settings-confirmation-icon{display:inline-flex;height:3rem;width:3rem;align-items:center;justify-content:center;border-radius:9999px;border-width:1px;border-style:solid;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1))}@media (min-width: 640px){.s-user-settings-confirmation-icon{margin-left:auto;margin-right:auto;margin-bottom:1rem;height:5rem;width:5rem}}.s-user-settings-confirmation-icon:where([dir="ltr"],[dir="ltr"] *){margin-right:0.5rem}@media (min-width: 640px){.s-user-settings-confirmation-icon:where([dir="ltr"],[dir="ltr"] *){margin-right:0px}}.s-user-settings-confirmation-icon:where([dir="rtl"],[dir="rtl"] *){margin-left:0.5rem}@media (min-width: 640px){.s-user-settings-confirmation-icon:where([dir="rtl"],[dir="rtl"] *){margin-left:0px}}.s-user-settings-confirmation-icon svg{height:1.25rem;width:1.25rem;flex-shrink:0;fill:#9ca3af}.s-user-settings-confirmation-warning{font-size:0.75rem;line-height:1rem;--tw-text-opacity:1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.s-user-settings-confirmation-actions{margin-top:1.25rem;display:flex;align-items:center;justify-content:space-between}.s-user-settings-confirmation-actions>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-right:calc(1.25rem * var(--tw-space-x-reverse));margin-left:calc(1.25rem * calc(1 - var(--tw-space-x-reverse)))}.s-user-settings-confirmation-actions:where([dir="rtl"],[dir="rtl"] *)>:not([hidden])~:not([hidden]){--tw-space-x-reverse:1}';export{i as salla_user_settings}
4
+ import{r as e,h as t,H as s}from"./p-BsIeN-bg.js";const i=class{constructor(t){e(this,t),this.otpInputs=[],this.deletePendingDays=null,this.currentStep="confirm",this.isDeletePending=!1,this.otpType="email",this.otpHasError=!1,this.otpErrorMessage="",this.isSubmitting=!1,this.isVerifyingOtp=!1,this.isSwitchingChannel=!1,this.resendAfter=30,this.showResendLink=!1,this.canHideName=salla.config.get("store.settings.rating.can_customer_hide_name"),this.translationDefaults={"pages.profile.delete_account":{ar:"حذف الحساب",en:"Delete account"},"pages.profile.delete_account_description":{ar:"سيُحذف حسابك وبياناتك من المتجر نهائيًا، بما في ذلك سجل طلباتك.",en:"Your account and data will be permanently deleted from the store, including your order history."},"pages.profile.delete_account_confirm_title":{ar:"هل تريد حذف حسابك؟",en:"Do you want to delete your account?"},"pages.profile.delete_account_warning":{ar:"بعد الحذف، ستفقد الوصول إلى بياناتك، بما في ذلك سجل الطلبات، وقائمة الأمنيات، وأي نقاط ولاء أو رصيد متاح في المحفظة.",en:"After deletion, you will lose access to your data, including order history, wishlist, and any loyalty points or wallet balance."},"pages.profile.cancel":{ar:"إلغاء",en:"Cancel"},"pages.profile.delete_account_otp_title":{ar:"تأكيد حذف الحساب",en:"Confirm account deletion"},"pages.profile.delete_account_otp_instruction":{ar:"للمتابعة، أدخل رمز التحقٌّق المرسل إلى:",en:"To continue, enter the verification code sent to:"},"pages.profile.delete_account_confirm_otp":{ar:"تأكيد الحذف",en:"Confirm deletion"},"pages.profile.delete_account_otp_required":{ar:"يرجى إدخال رمز التحقٌّق",en:"Please enter the verification code"},"pages.profile.delete_account_send_via_phone":{ar:"إرسال عبر الهاتف",en:"Send via phone"},"pages.profile.delete_account_send_via_email":{ar:"إرسال عبر البريد الإلكتروني",en:"Send via email"},"pages.profile.delete_account_success_title":{ar:"أُرسل طلب حذف الحساب",en:"Account deletion request submitted"},"pages.profile.delete_account_success_message":{ar:"سيُحذف حسابك خلال 30 يومًا. يمكنك إلغاء الطلب بتسجيل الدخول مرة أخرى قبل اكتمال الحذف.",en:"Your account will be deleted within 30 days. You can cancel the request by signing in again before deletion is complete."},"pages.profile.ok":{ar:"موافق",en:"OK"},"pages.profile.cancel_deletion_request":{ar:"تراجع عن الحذف",en:"Withdraw deletion"},"pages.profile.delete_account_pending":{ar:"حسابك مجدول للحذف نهائيًا من المتجر خلال :days يومًا. يمكنك التراجع عن الحذف قبل انقضاء المدة.",en:"Your account will be deleted permanently from the store within :days days. You can withdraw the deletion before the deadline."},"pages.profile.delete_request_cancelled":{ar:"تم إلغاء طلب الحذف",en:"Deletion request cancelled"}},this.registerTranslationDefaults(),this.loadTranslations(),salla.onReady((()=>{this.isHiddenName=salla.config.get("user.is_hidden_name"),this.isNotifiable=salla.config.get("user.is_notifiable"),this.canHideName=salla.config.get("store.settings.rating.can_customer_hide_name"),this.fetchDeleteRequestStatus(),this.isNotifiable&&this.isHiddenName||salla.event.on("profile::info.fetched",(e=>{this.isHiddenName=e.data.is_hidden_name,this.isNotifiable=e.data.is_notifiable}))})),salla.lang.onLoaded((()=>{this.registerTranslationDefaults(),this.loadTranslations()}))}getDaysUntilExecution(e){return Math.max(0,Math.ceil(((e>1e12?e:1e3*e)-Date.now())/864e5))}applyPendingMessage(){const e=salla.lang.get("pages.profile.delete_account_pending");this.deleteAccountPending=null!=this.deletePendingDays?e.replace(/:days/g,String(salla.helpers.number(this.deletePendingDays))):e}async fetchDeleteRequestStatus(){try{const e=await salla.profile.getDeleteRequest(),t=e?.data??null,s=t?.data_request||t,i=s?.status;this.isDeletePending="pending"===i;const r=s?.execution_at;this.deletePendingDays=null==r||Number.isNaN(Number(r))?null:this.getDaysUntilExecution(Number(r)),this.applyPendingMessage()}catch{}}registerTranslationDefaults(){if(!salla?.lang?.addBulk)return;const e=Object.entries(this.translationDefaults).reduce(((e,[t,s])=>(salla.lang.get(t)===t&&(e[t]=s),e)),{});Object.keys(e).length&&salla.lang.addBulk(e)}loadTranslations(){this.deleteAccount=salla.lang.get("pages.profile.delete_account"),this.deleteAccountDesc=salla.lang.get("pages.profile.delete_account_description"),this.deleteConfirmTitle=salla.lang.get("pages.profile.delete_account_confirm_title"),this.deleteAccountWarning=salla.lang.get("pages.profile.delete_account_warning"),this.cancelLabel=salla.lang.get("pages.profile.cancel"),this.deleteOtpTitle=salla.lang.get("pages.profile.delete_account_otp_title"),this.deleteOtpInstruction=salla.lang.get("pages.profile.delete_account_otp_instruction"),this.deleteConfirmOtp=salla.lang.get("pages.profile.delete_account_confirm_otp"),this.sendViaPhone=salla.lang.get("pages.profile.delete_account_send_via_phone"),this.sendViaEmail=salla.lang.get("pages.profile.delete_account_send_via_email"),this.deleteSuccessTitle=salla.lang.get("pages.profile.delete_account_success_title"),this.deleteSuccessMessage=salla.lang.get("pages.profile.delete_account_success_message"),this.okLabel=salla.lang.get("pages.profile.ok"),this.cancelDeletionRequest=salla.lang.get("pages.profile.cancel_deletion_request"),this.applyPendingMessage(),this.resendAfterLabel=salla.lang.get("blocks.header.resend_after"),this.resendLabel=salla.lang.get("blocks.comments.submit"),this.promotionalMsgs=salla.lang.get("pages.profile.promotional_messages"),this.hideMyName=salla.lang.get("pages.profile.hide_my_name"),this.hideMyNameDesc=salla.lang.get("pages.profile.hide_my_name_desc"),this.promotionalMsgsDesc=salla.lang.get("pages.profile.promotional_messages_description")}toggleSetting(e,t){salla.profile.updateSettings({name:e,value:t.target.checked})}capitalizeText(e){return e?e.charAt(0).toUpperCase()+e.slice(1):""}getOtpTarget(){return"email"===this.otpType?salla.config.get("user.email")||"":salla.config.get("user.mobile")||""}updateModalForStep(){if(this.confirmationModal)switch(this.currentStep){case"confirm":this.confirmationModal.setTitle(this.capitalizeText(this.deleteConfirmTitle));break;case"otp":this.confirmationModal.setTitle(this.capitalizeText(this.deleteOtpTitle));break;case"success":this.confirmationModal.setTitle(this.capitalizeText(this.deleteSuccessTitle))}}openDeleteModal(){this.currentStep="confirm",this.otpType="email",this.resetOtpInputs(),this.clearResendTimer(),this.updateModalForStep(),this.confirmationModal.open()}closeDeleteModal(){this.clearResendTimer(),this.confirmationModal?.close()}goBackFromOtp(){this.clearResendTimer(),this.resetOtpInputs(),this.resetOtpError(),this.currentStep="confirm",this.updateModalForStep()}async handleModalVisibilityChanged(e){if(e.detail)return;this.clearResendTimer();const t="success"===this.currentStep;t&&(this.isDeletePending=!0),this.currentStep="confirm",this.resetOtpInputs(),t&&await this.fetchDeleteRequestStatus()}formatResendTimer(e){return"00 : "+(e>=10?`${e}`:`0${e}`)}updateResendTimerDisplay(){this.timerEl&&(this.timerEl.innerHTML=this.formatResendTimer(this.resendAfter))}isDeleteRequestInFlight(){return this.isSubmitting||this.isSwitchingChannel||this.isVerifyingOtp}async initiateDeleteRequest(e="confirm"){if(!this.isDeleteRequestInFlight()){"switch"===e||"resend"===e?this.isSwitchingChannel=!0:this.isSubmitting=!0;try{await salla.profile.initiateDeleteRequest(this.otpType),this.currentStep="otp",this.updateModalForStep(),this.resetOtpInputs(),this.startResendTimer(),setTimeout((()=>this.otpInputs[0]?.focus()),100)}catch(e){salla.notify?.error?.(e.response?.data?.error?.message||salla.lang.get("common.errors.error_occurred"))}finally{"switch"===e||"resend"===e?this.isSwitchingChannel=!1:this.isSubmitting=!1}}}async switchOtpChannel(){this.isDeleteRequestInFlight()||(this.otpType="email"===this.otpType?"mobile":"email",await this.initiateDeleteRequest("switch"))}async resendOtp(){this.showResendLink&&!this.isDeleteRequestInFlight()&&await this.initiateDeleteRequest("resend")}collectOtpCode(){const e=salla.helpers.number(this.otpInputs.map((e=>e?.value||"")).join(""),!0).replace(/[^0-9]/g,"");return this.hiddenCodeInput&&(this.hiddenCodeInput.value=e),e}resetOtpError(){this.otpHasError=!1,this.otpErrorMessage=""}setOtpError(e){this.otpHasError=!0,this.otpErrorMessage=e}async verifyDeleteOtp(){if(this.isVerifyingOtp||this.isSwitchingChannel)return;const e=this.collectOtpCode();if(e.length<4)return this.setOtpError(salla.lang.get("pages.profile.delete_account_otp_required")),void this.otpInputs[e.length]?.focus();this.resetOtpError(),this.isVerifyingOtp=!0;try{const t=await salla.profile.verifyDeleteRequest({type:this.otpType,code:e});this.deleteSuccessMessage=t?.data?.message||salla.lang.get("pages.profile.delete_account_success_message"),this.clearResendTimer(),this.resetOtpInputs(),this.otpInputs=[],this.currentStep="success",this.updateModalForStep()}catch(e){this.setOtpError(e.response?.data?.error?.message||salla.lang.get("common.errors.error_occurred")),this.resetOtpInputs()}finally{this.isVerifyingOtp=!1}}async confirmSuccess(){this.isDeletePending=!0,this.closeDeleteModal(),this.currentStep="confirm",await this.fetchDeleteRequestStatus()}async cancelDeleteRequest(){if(!this.isSubmitting){this.isSubmitting=!0;try{const e=(await salla.profile.cancelDeleteRequest()).message||salla.lang.get("pages.profile.delete_request_cancelled");this.isDeletePending=!1,salla.notify?.success?.(e)}catch(e){salla.notify?.error?.(e.response?.data?.error?.message||salla.lang.get("common.errors.error_occurred"))}finally{this.isSubmitting=!1}}}resetOtpInputs(){this.otpInputs.forEach((e=>{e&&(e.value="")})),this.hiddenCodeInput&&(this.hiddenCodeInput.value="")}modifyNextOtpInput(e,t){e.value=t[0],t=t.substring(1),e.nextElementSibling&&t.length?this.modifyNextOtpInput(e.nextElementSibling,t):e.nextElementSibling||0!==t.length?e.nextElementSibling&&0===t.length&&e.nextElementSibling.focus():e.focus()}splitOtpNumber(e){const t=salla.helpers.number(e.data||e.target.value||"",!0).replace(/[^0-9]/g,"");t&&1!==t.length&&this.modifyNextOtpInput(e.target,t)}allOtpInputsFilled(){return this.otpInputs.every((e=>e?.value))}handleOtpInput(e){this.resetOtpError(),e.target.value=salla.helpers.number(e.target.value||"",!0),salla.helpers.inputDigitsOnly(e.target),this.allOtpInputsFilled()&&setTimeout((()=>this.verifyDeleteOtp()),100)}handleOtpKeyUp(e){if(this.resetOtpError(),["Alt","Shift","Control","AltGraph","Ctrl"].includes(e.key))return;const t=e.keyCode||e.charCode;e.target.value?(e.target.nextElementSibling?.focus(),e.target.nextElementSibling?.select()):[8,46].includes(t)&&(e.target.previousElementSibling?.focus(),e.target.previousElementSibling?.select()),e.target.value.length>1&&this.splitOtpNumber(e)}handleOtpPaste(e){this.resetOtpError();const t=salla.helpers.number(e.clipboardData.getData("text")||"",!0).replace(/[^0-9]/g,"").substring(0,this.otpInputs.length);this.otpInputs.forEach((e=>e.value="")),this.otpInputs[0]&&this.modifyNextOtpInput(this.otpInputs[0],t)}handleOtpFocus(e){e.target!==this.otpInputs[0]&&(""===this.otpInputs[0]?.value&&this.otpInputs[0].focus(),""===e.target.previousElementSibling?.value&&e.target.previousElementSibling.focus())}startResendTimer(){this.clearResendTimer(),this.resendAfter=30,this.showResendLink=!1,this.updateResendTimerDisplay(),this.resendTimerId=setInterval((()=>{if(this.resendAfter--,this.resendAfter<=0)return this.clearResendTimer(),void(this.showResendLink=!0);this.updateResendTimerDisplay()}),1e3)}clearResendTimer(){this.resendTimerId&&(clearInterval(this.resendTimerId),this.resendTimerId=null),this.showResendLink=!1}renderUserDeleteIcon(){return t("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"24",height:"24",color:"currentColor",fill:"none",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},t("path",{d:"M14.5 8C14.5 5.23858 12.2614 3 9.5 3C6.73858 3 4.5 5.23858 4.5 8C4.5 10.7614 6.73858 13 9.5 13C12.2614 13 14.5 10.7614 14.5 8Z"}),t("path",{d:"M15.5 21L18.5 18M18.5 18L21.5 15M18.5 18L15.5 15M18.5 18L21.5 21"}),t("path",{d:"M2.5 20C2.5 16.134 5.63401 13 9.5 13C10.775 13 11.9704 13.3409 13 13.9365"}))}renderConfirmStep(){return t("div",{class:"s-user-settings-delete-body"},t("p",{class:"s-user-settings-delete-warning"},this.deleteAccountWarning),t("div",{class:"s-user-settings-delete-actions s-user-settings-delete-actions--row"},t("salla-button",{width:"wide",fill:"outline",color:"danger",onClick:()=>this.closeDeleteModal()},this.capitalizeText(this.cancelLabel)),t("salla-button",{width:"wide",color:"primary",loading:this.isSubmitting,onClick:()=>this.initiateDeleteRequest()},this.capitalizeText(this.deleteAccount))))}renderOtpStep(){return t("div",{class:"s-user-settings-delete-body"},t("p",{class:"s-user-settings-delete-otp-instruction"},this.deleteOtpInstruction),t("p",{class:"s-user-settings-delete-otp-target"},this.getOtpTarget()),t("input",{type:"hidden",name:"code",maxlength:"4",ref:e=>this.hiddenCodeInput=e}),t("div",{class:{"s-user-settings-delete-otp-codes":!0,"has-error":this.otpHasError},dir:"ltr"},[1,2,3,4].map((e=>t("input",{type:"text",autocomplete:"one-time-code",pattern:"[0-9]*",inputmode:"numeric",maxlength:"1",id:`delete-otp-${e}`,class:{"s-user-settings-delete-otp-input":!0,"s-has-error":this.otpHasError},onInput:e=>this.handleOtpInput(e),onPaste:e=>this.handleOtpPaste(e),onKeyUp:e=>this.handleOtpKeyUp(e),onFocus:e=>this.handleOtpFocus(e),ref:t=>this.otpInputs[e-1]=t,required:!0})))),this.otpHasError&&this.otpErrorMessage?t("span",{class:"s-user-settings-delete-otp-error"},this.otpErrorMessage):"",t("div",{class:"s-user-settings-delete-actions s-user-settings-delete-actions--stack"},t("salla-button",{width:"wide",color:"primary",disabled:this.isSwitchingChannel,onClick:()=>this.verifyDeleteOtp()},this.capitalizeText(this.deleteConfirmOtp)),t("salla-button",{width:"wide",fill:"outline",color:"primary",disabled:this.isVerifyingOtp,onClick:()=>this.switchOtpChannel()},this.capitalizeText("email"===this.otpType?this.sendViaPhone:this.sendViaEmail))),t("p",{class:"s-user-settings-delete-otp-resend",style:{display:this.showResendLink?"none":"block"}},this.resendAfterLabel,t("b",{class:"s-user-settings-delete-otp-timer mx-1 font-bold",ref:e=>this.timerEl=e})),t("a",{href:"#",class:"s-user-settings-delete-otp-resend-link",style:{display:this.showResendLink?"block":"none"},onClick:e=>{e.preventDefault(),this.resendOtp()}},this.resendLabel))}renderSuccessStep(){return t("div",{class:"s-user-settings-delete-body"},t("p",{class:"s-user-settings-delete-success-body"},this.deleteSuccessMessage),t("div",{class:"s-user-settings-delete-actions s-user-settings-delete-actions--stack"},t("salla-button",{class:"s-user-settings-delete-success-btn",width:"wide",color:"primary",onClick:()=>this.confirmSuccess()},this.capitalizeText(this.okLabel))))}renderDeleteStep(){switch(this.currentStep){case"otp":return this.renderOtpStep();case"success":return this.renderSuccessStep();default:return this.renderConfirmStep()}}renderDeleteSectionAction(){return this.isDeletePending?t("salla-button",{fill:"outline",color:"danger",shape:"btn",size:"medium",width:"normal",loading:this.isSubmitting,onClick:()=>this.cancelDeleteRequest()},this.capitalizeText(this.cancelDeletionRequest)):t("salla-button",{fill:"outline",color:"danger",shape:"btn",size:"medium",width:"normal",onClick:()=>this.openDeleteModal()},this.capitalizeText(this.deleteAccount))}render(){return t(s,{key:"64356c5b57d826fce8c29cc319a9762464c7fe51",class:"s-user-settings-wrapper"},this.canHideName&&t("div",{key:"4f7b3eb703f89e4a758fca54ba1b214f6724aaea",class:"s-user-settings-section"},t("salla-list-tile",{key:"7ad109e36b278fe81a314d51e1ab68030dd96cdc"},t("div",{key:"c789b7e2c541e25aaaf336e052d1986f6429da71",slot:"icon",class:"s-user-settings-section-icon"},t("span",{key:"5d7b377aefb80139527d8814ee2c636fa9c73e0f",innerHTML:'\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>user-cancel</title>\n<path d="M29.885 16l1.724-1.724c0.521-0.521 0.521-1.364 0-1.885s-1.364-0.521-1.885 0l-1.724 1.724-1.724-1.724c-0.521-0.521-1.364-0.521-1.885 0s-0.521 1.364 0 1.885l1.724 1.724-1.724 1.724c-0.521 0.521-0.521 1.364 0 1.885 0.26 0.26 0.601 0.391 0.943 0.391s0.683-0.131 0.943-0.391l1.724-1.724 1.724 1.724c0.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.885zM10.667 16c4.043 0 7.333-3.289 7.333-7.333s-3.291-7.333-7.333-7.333-7.333 3.289-7.333 7.333 3.291 7.333 7.333 7.333zM10.667 4c2.573 0 4.667 2.093 4.667 4.667s-2.093 4.667-4.667 4.667-4.667-2.093-4.667-4.667 2.093-4.667 4.667-4.667zM10.667 18.667c-5.881 0-10.667 3.813-10.667 8.5v2.167c0 0.736 0.596 1.333 1.333 1.333s1.333-0.597 1.333-1.333v-2.167c0-3.217 3.588-5.833 8-5.833s8 2.616 8 5.833v2.167c0 0.736 0.596 1.333 1.333 1.333s1.333-0.597 1.333-1.333v-2.167c0-4.687-4.785-8.5-10.667-8.5z"></path>\n</svg>\n'})),t("div",{key:"fdb9d6130ef27cffbe4e2ef06e7b9155d0d04c2b",slot:"title",class:"s-user-settings-section-title"},this.capitalizeText(this.hideMyName)),t("div",{key:"bd8592a487c79926355eeea25a5e1429bca0fd80",slot:"subtitle",class:"s-user-settings-section-subtitle"},this.capitalizeText(this.hideMyNameDesc)),t("div",{key:"cf21ed12bb38dc3a613efac6d017a72aab38780b",slot:"action",class:"s-user-settings-section-action"},t("label",{key:"160140e25cf8e6c4556e52c0b36ba5769618b419",class:"s-toggle"},t("input",{key:"369a694fabbd42e6c239b23c26d68f858775ffe2",class:"s-toggle-input",checked:this.isHiddenName,onChange:e=>this.toggleSetting("is_hidden_name",e),type:"checkbox"}),t("div",{key:"5952ec01913ef95d888eeb3aace14123ffd3ef6f",class:"s-toggle-switcher"}))))),t("div",{key:"885355f8435759c9359a3d9eb95d5637b1c74751",class:"s-user-settings-section"},t("salla-list-tile",{key:"93b607850b20add5384a3b28e4e58fbfcb181d53"},t("div",{key:"c795aabfdc6df0beb9c0bfcf73ad87625eb7f51b",slot:"icon",class:"s-user-settings-section-icon"},t("span",{key:"a59ede027c4466a1e84e8e8b4c649c7b418dd0a3",innerHTML:'\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>bullhorn</title>\n<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>\n</svg>\n'})),t("div",{key:"e7af96b6f919a8be8bb126237cb3977e72a7c089",slot:"title",class:"s-user-settings-section-title"},this.capitalizeText(this.promotionalMsgs)),t("div",{key:"dab7b270443b6eddccd7df739c2bee82eb7706af",slot:"subtitle",class:"s-user-settings-section-subtitle"},this.capitalizeText(this.promotionalMsgsDesc)),t("div",{key:"56a6f18c788891fe9215a57d0fcaa5cf98bd3aa5",slot:"action",class:"s-user-settings-section-action"},t("label",{key:"1fc28780fe779099eaed7916f31cbbb681c10fe9",class:"s-toggle"},t("input",{key:"832edd6e5b806171bb913163b7d5c19dbb0833f5",class:"s-toggle-input",checked:this.isNotifiable,onChange:e=>this.toggleSetting("is_notifiable",e),type:"checkbox"}),t("div",{key:"54260d8cca19ca6914cdd3bf15093b9669fef44a",class:"s-toggle-switcher"}))))),t("div",{key:"549bae1159a55b035952a12c8dc9d2b9d660f5bf",class:"s-user-settings-section s-user-settings-section-delete-user"},t("salla-list-tile",{key:"7969327e863cd998a120f27d61621d83ef8e57d5"},t("div",{key:"acf14b5e6ce76657fe0016aa63e26851e7688cd5",slot:"icon",class:"s-user-settings-section-icon"},this.renderUserDeleteIcon()),t("div",{key:"4a38cf9d0510e784317b0eb4db2fd4589a9f71d4",slot:"title",class:"s-user-settings-section-title"},this.capitalizeText(this.deleteAccount)),t("div",{key:"054f6a6c30f2eb9794f83a0998f20e208c7ed85a",slot:"subtitle",class:"s-user-settings-section-subtitle"},this.capitalizeText(this.isDeletePending?this.deleteAccountPending:this.deleteAccountDesc)),t("div",{key:"00d392a300b986d5d3e6f6711e6996df9731962d",slot:"action",class:"s-user-settings-section-action"},this.renderDeleteSectionAction()))),t("salla-modal",{key:"d4e8006e57d9c35267177f07b60e510ea3e53400",id:"salla-user-settings-delete-modal",width:"xs",centered:!0,showBack:"otp"===this.currentStep,isClosable:"success"!==this.currentStep,iconStyle:"success"===this.currentStep?"success":void 0,onModalVisibilityChanged:e=>this.handleModalVisibilityChanged(e),onModalBack:()=>this.goBackFromOtp(),ref:e=>this.confirmationModal=e},"success"!==this.currentStep?t("span",{slot:"icon",class:"s-user-settings-delete-icon"},this.renderUserDeleteIcon()):null,t("div",{key:this.currentStep,class:"s-user-settings-delete-step"},this.renderDeleteStep())))}};i.style='/*!twlt*/.s-modal-header-inner{display:flex;flex-direction:column !important;align-items:center !important;justify-content:center !important}.s-modal-header-content{text-align:center !important}.s-user-settings-delete-body{text-align:center}.s-user-settings-delete-icon{display:inline-flex;align-items:center;justify-content:center;width:4rem;height:4rem;border-radius:9999px;border:1px solid var(--infinte-color);color:var(--infinte-color);margin:0 auto 1rem}.s-user-settings-delete-icon svg{width:1.5rem;height:1.5rem}.s-user-settings-delete-warning{color:#6b7280;font-size:0.875rem;line-height:1.625;margin-bottom:1.25rem}.s-user-settings-delete-actions--row{display:flex;gap:0.75rem;justify-content:center}.s-user-settings-delete-actions--row salla-button{flex:1}.s-user-settings-delete-actions--stack{display:flex;flex-direction:column;gap:0.75rem;margin-top:1.25rem}.s-user-settings-delete-otp-instruction{color:#6b7280;font-size:0.875rem}.s-user-settings-delete-otp-target{color:#6b7280;direction:ltr;margin-bottom:1.25rem}.s-user-settings-delete-otp-codes{display:flex;justify-content:stretch;gap:0.75rem;direction:ltr;margin-bottom:0.75rem;width:100%}.s-user-settings-delete-otp-codes.has-error{margin-bottom:0}.s-user-settings-delete-otp-input{flex:1 1 0;min-width:0;width:100%;height:3.5rem;text-align:center;border:1px solid #d1d5db;border-radius:0.5rem;font-size:1.25rem;font-weight:600;color:#111827;outline:none}.s-user-settings-delete-otp-input:focus{border-color:#004956;box-shadow:0 0 0 1px #004956}.s-user-settings-delete-otp-input.s-has-error{border-color:#ef4444 !important}.s-user-settings-delete-otp-input.s-has-error:focus{border-color:#ef4444 !important;box-shadow:0 0 0 1px #ef4444}.s-user-settings-delete-otp-input::-webkit-outer-spin-button,.s-user-settings-delete-otp-input::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}.s-user-settings-delete-otp-input[type=text]{-moz-appearance:textfield}.s-user-settings-delete-otp-error{display:block;color:#ef4444;font-size:0.75rem;text-align:center;padding-top:0.75rem;margin-bottom:1.25rem}.s-user-settings-delete-otp-resend{color:#6b7280;font-size:0.75rem;margin-top:1rem;text-align:center}.s-user-settings-delete-otp-timer{font-weight:600;direction:ltr;display:inline-block}.s-user-settings-delete-otp-resend-link{display:block;color:#004956;font-size:0.875rem;margin-top:1rem;text-align:center;text-decoration:underline;cursor:pointer}.s-user-settings-delete-success-body{color:#6b7280;font-size:0.875rem;line-height:1.625;margin-bottom:1.25rem}.s-user-settings-delete-success-btn{--s-button-color:#004956}.mx-1{margin-left:0.25rem;margin-right:0.25rem}.block{display:block}.hidden{display:none}.font-bold{font-weight:700}.outline{outline-style:solid}.s-has-error{--tw-border-opacity:1;border-color:rgb(248 113 113 / var(--tw-border-opacity, 1))}.s-has-error:focus{--tw-border-opacity:1;border-color:rgb(239 68 68 / var(--tw-border-opacity, 1))}.btn{display:inline-flex;flex:1 1 0%;align-items:center;justify-content:center;white-space:nowrap;border-radius:0.375rem;padding-left:1.5rem;padding-right:1.5rem;padding-bottom:0.625rem;padding-top:0.5rem;font-size:0.875rem;line-height:1.25rem;font-weight:700;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:300ms}.btn:hover{opacity:0.8}.has-error .s-form-label{color:#ff443a}.has-error .s-form-control,.has-error .s-tel-input-control,.has-error .s-datetime-picker-input{border-color:#ff443a;color:#ff443a}.toggle-checkbox .s-toggle-input{position:absolute;visibility:hidden}.toggle-checkbox .s-toggle-switcher{display:inline-block;background:#ccc;border-radius:16px;width:40px;height:25px;position:relative;vertical-align:middle;transition:background 0.25s}.toggle-checkbox .s-toggle-switcher:before,.toggle-checkbox .s-toggle-switcher:after{content:""}.toggle-checkbox .s-toggle-switcher:before{display:block;background:#fff;border-radius:50%;box-shadow:0 0 0 1px rgba(0,0,0,0.25);width:20px;height:21px;position:absolute;top:2.2px;left:1px;transition:left 0.25s}.toggle-checkbox .s-toggle-input:checked+div{background:#30D158}.toggle-checkbox .s-toggle-input:checked+div:before{left:18px}.s-has-error{--tw-border-opacity:1 !important;border-color:rgb(239 68 68 / var(--tw-border-opacity, 1)) !important;--tw-text-opacity:1 !important;color:rgb(239 68 68 / var(--tw-text-opacity, 1)) !important}.s-toggle{cursor:pointer;display:inline-block}.s-toggle .s-toggle-input{position:absolute;visibility:hidden}.s-toggle .s-toggle-label{margin-left:5px;position:relative;top:2px}.s-toggle .s-toggle-switcher{display:inline-block;background:#ccc;border-radius:16px;width:40px;height:25px;position:relative;vertical-align:middle;transition:background 0.25s}.s-toggle .s-toggle-switcher:before,.s-toggle .s-toggle-switcher:after{content:""}.s-toggle .s-toggle-switcher:before{display:block;background:#fff;border-radius:50%;box-shadow:0 0 0 1px rgba(0,0,0,0.25);width:20px;height:21px;position:absolute;top:2.2px;left:1px;transition:left 0.25s}.s-toggle .s-toggle-input:checked+div{background:#30D158}.s-toggle .s-toggle-input:checked+div:before{left:18px}.s-user-settings-section{border-bottom-width:1px;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1));--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.s-user-settings-section:first-child{border-bottom-right-radius:0px;border-bottom-left-radius:0px;border-top-left-radius:0.375rem;border-top-right-radius:0.375rem}.s-user-settings-section:last-child{border-bottom-right-radius:0.375rem;border-bottom-left-radius:0.375rem;border-top-left-radius:0px;border-top-right-radius:0px;border-bottom-width:0px}.s-user-settings-section .s-list-tile-item{align-items:flex-start;background-color:transparent;padding:1.25rem}@media (min-width: 768px){.s-user-settings-section .s-list-tile-item{align-items:center}}.s-user-settings-section .s-list-tile-item-action{margin-left:auto}.s-user-settings-section .s-list-tile-item-action:where([dir="rtl"],[dir="rtl"] *){margin-right:auto;margin-left:0px}.s-user-settings-section .s-list-tile-item-action button{width:100%;padding:10px}.s-user-settings-section-delete-user .s-list-tile-item{flex-wrap:wrap}@media (min-width: 768px){.s-user-settings-section-delete-user .s-list-tile-item{flex-wrap:nowrap}}.s-user-settings-section-delete-user .s-list-tile-item-icon{position:relative;top:5px}@media (min-width: 768px){.s-user-settings-section-delete-user .s-list-tile-item-icon{top:0px}}@media (max-width: 768px){.s-user-settings-section-delete-user .s-list-tile-item-content{flex:1 0 85%}.s-user-settings-section-delete-user .s-list-tile-item-action{flex:1 1 100%;margin-top:1rem}}.s-user-settings-section-title{font-size:1rem;line-height:1.5rem;--tw-text-opacity:1;color:rgb(17 24 39 / var(--tw-text-opacity, 1))}.s-user-settings-section-subtitle{font-size:0.75rem;line-height:1rem;--tw-text-opacity:1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.s-user-settings-section-icon svg{height:1.25rem;width:1.25rem}.s-user-settings-confirmation{text-align:center}.s-user-settings-confirmation svg{text-align:center}.s-user-settings-confirmation-icon{display:inline-flex;height:3rem;width:3rem;align-items:center;justify-content:center;border-radius:9999px;border-width:1px;border-style:solid;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1))}@media (min-width: 640px){.s-user-settings-confirmation-icon{margin-left:auto;margin-right:auto;margin-bottom:1rem;height:5rem;width:5rem}}.s-user-settings-confirmation-icon:where([dir="ltr"],[dir="ltr"] *){margin-right:0.5rem}@media (min-width: 640px){.s-user-settings-confirmation-icon:where([dir="ltr"],[dir="ltr"] *){margin-right:0px}}.s-user-settings-confirmation-icon:where([dir="rtl"],[dir="rtl"] *){margin-left:0.5rem}@media (min-width: 640px){.s-user-settings-confirmation-icon:where([dir="rtl"],[dir="rtl"] *){margin-left:0px}}.s-user-settings-confirmation-icon svg{height:1.25rem;width:1.25rem;flex-shrink:0;fill:#9ca3af}.s-user-settings-confirmation-warning{font-size:0.75rem;line-height:1rem;--tw-text-opacity:1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.s-user-settings-confirmation-actions{margin-top:1.25rem;display:flex;align-items:center;justify-content:space-between}.s-user-settings-confirmation-actions>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-right:calc(1.25rem * var(--tw-space-x-reverse));margin-left:calc(1.25rem * calc(1 - var(--tw-space-x-reverse)))}.s-user-settings-confirmation-actions:where([dir="rtl"],[dir="rtl"] *)>:not([hidden])~:not([hidden]){--tw-space-x-reverse:1}';export{i as salla_user_settings}
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r as e,c as a,h as t,H as i}from"./p-C0qiFNJn.js";const s=class{constructor(t){e(this,t),this.prizeItemSelected=a(this,"prizeItemSelected")}onPrizeItemClick(){this.prizeItemSelected.emit(this.item)}render(){return t(i,{key:"1a3463c51bf3e3e250f62b65d3a81815ec465923"},t("div",{key:"03bf4d3e35b10d17a325ca4ef280cb384f3a76f4",onClick:this.onPrizeItemClick.bind(this)},t("img",{key:"a4d319b2daec5cdfec1c85910edea10bc1d1ab6c",class:"s-loyalty-prize-item-image",src:this.item.image,alt:this.item.name}),t("div",{key:"52059fafc318c1f5a6b0289669083476650f8761",class:"s-loyalty-prize-item-title"},this.item.name),t("div",{key:"a3e14e2d1bd86dc3e7dbd2e6c5115e119af965e5",class:"s-loyalty-prize-item-subtitle"},this.item.description),t("div",{key:"55df95c028748c0387dc75dc4ad35c7285c907af",class:"s-loyalty-prize-item-points"},this.item.cost_points," ",salla.lang.get("pages.loyalty_program.point"))))}};s.style="salla-loyalty-prize-item:hover{box-shadow:0 5px 15px 1px rgba(0, 0, 0, 0.04) !important}";export{s as salla_loyalty_prize_item}
4
+ import{r as e,c as a,h as t,H as s}from"./p-BsIeN-bg.js";const i=class{constructor(t){e(this,t),this.prizeItemSelected=a(this,"prizeItemSelected")}onPrizeItemClick(){this.prizeItemSelected.emit(this.item)}render(){return t(s,{key:"1a3463c51bf3e3e250f62b65d3a81815ec465923"},t("div",{key:"03bf4d3e35b10d17a325ca4ef280cb384f3a76f4",onClick:this.onPrizeItemClick.bind(this)},t("img",{key:"a4d319b2daec5cdfec1c85910edea10bc1d1ab6c",class:"s-loyalty-prize-item-image",src:this.item.image,alt:this.item.name}),t("div",{key:"52059fafc318c1f5a6b0289669083476650f8761",class:"s-loyalty-prize-item-title"},this.item.name),t("div",{key:"a3e14e2d1bd86dc3e7dbd2e6c5115e119af965e5",class:"s-loyalty-prize-item-subtitle"},this.item.description),t("div",{key:"55df95c028748c0387dc75dc4ad35c7285c907af",class:"s-loyalty-prize-item-points"},this.item.cost_points," ",salla.lang.get("pages.loyalty_program.point"))))}};i.style="salla-loyalty-prize-item:hover{box-shadow:0 5px 15px 1px rgba(0, 0, 0, 0.04) !important}";export{i as salla_loyalty_prize_item}
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r,h as t,a as e}from"./p-C0qiFNJn.js";import{S as a}from"./p-BscTeWDc.js";import{H as i}from"./p-DOBDDG4K.js";import"./p-CgtvEd63.js";const s=class{constructor(t){r(this,t),this.inputValue="",this.translationLoaded=!1,this.loading=!1,this.typing=!1,this.debounce=setTimeout((()=>""),1e3),this.placeholder=!1,this.inline=!1,this.oval=!1,this.height=60,this.maxWords=5,this.showAction=!1,this.productSlot=this.host.querySelector('[slot="product"]')?.innerHTML||this.getDefaultProductSlot(),salla.event.on("search::open",(()=>this.open())),salla.lang.onLoaded((()=>{this.translationLoaded=!0})),salla.event.on("modalClosed",(()=>this.onModalClose()))}async open(){this.inline||await this.modal.open().then((()=>setTimeout((()=>this.searchInput.focus()),300)))}onModalClose(){this.searchInput.value="",this.results=void 0,this.afterSearching(),this.container.classList.remove("s-search-no-results")}handleKeyDown(r){"Enter"===r.key&&this.search_term?.length&&(window.location.href=salla.url.get("search?q="+encodeURI(this.search_term)))}getDefaultProductSlot(){return'<div class="s-search-product-image-container"> <img class="s-search-product-image" src="{image}" alt="{name}"/></div><div class="s-search-product-details"> <div class="s-search-product-title">{name}</div> <div class="s-search-product-price">{price} <span class="s-search-product-regular-price">{regular_price}</span></div></div>'}debounceSearch(r){this.typing=!0,clearTimeout(this.debounce),this.debounce=setTimeout((()=>{this.typing=!1,this.search_term=r.target.value}),700)}limitWordsAndSearch(r){const t=r.target.value.trim().split(/\s+/);if(t.length>this.maxWords){const r=t.slice(0,this.maxWords).join(" ");this.searchInput.value=r}this.debounceSearch(r)}getQueryParam(r){return new URLSearchParams(window.location.search).get(r)}handleActionClick(){if(this.search_term&&this.search_term.length>2)return this.search(this.search_term)}handleSearch(r){this.inputValue=r,r.length>2?this.search(r):(this.results=void 0,this.afterSearching())}search(r){this.noResults.style.display="none",this.loading=!0,salla.product.fetch({source:"search",source_value:r}).then((t=>{this.results=t,salla.event.emit("Products Searched",r)})).catch((r=>"Query is same as previous one!"!==r?this.results=void 0:null)).finally((()=>this.afterSearching(!1)))}afterSearching(r=!0){this.noResults.style.display=r||this.results?.data.length>0?"none":"block",i.toggleElementClassIf(this.container,"s-search-container-open","s-search-no-results",(()=>this.results?.data.length)),this.loading=!1,salla.product.api.previousQuery="",this.inputValue.length<3&&this.container.classList.remove("s-search-no-results")}render(){const r=t("div",{key:"ca8dec5eb90cd0893a1a3364df34ba0ee4d60891",class:{"s-search-container":!0,"s-search-inline":this.inline},ref:r=>this.container=r},t("div",{key:"212f8180ecca220a8b89231311dec6cdf3ef0b06",class:"s-search-input-wrapper"},t("span",{key:"51fb0f9a2e342afd35eb82b57f55471aa9e1519f",class:"s-search-icon-wrap"},t("span",{key:"e75117068c51c6d200e8e20fa0f00ca02ed0c61d",class:"s-search-icon",innerHTML:this.loading?'<i class="s-search-spinner-loader"/>':a})),t("input",{key:"442b1704b75a33e8c9e02da8200151a1d8e8db72",type:"search",enterkeyhint:"search",autocomplete:"off",class:"s-search-input",placeholder:salla.lang.get("blocks.header.search_placeholder"),onInput:r=>this.limitWordsAndSearch(r),onKeyDown:r=>this.handleKeyDown(r),ref:r=>this.searchInput=r,style:{height:this.height+"px",borderRadius:this.oval?this.height/2+"px":""}}),this.showAction?t("salla-button",{loading:this.loading,class:{"s-search-action":!0,"s-search-action-oval":this.oval},onClick:()=>this.handleActionClick()},!this.loading&&t("span",{innerHTML:a})):null),t("div",{key:"f3b40ce4ec24678f6d8421f3da8ac9e1bd631c3a",class:"s-search-results"},this.results?.data.map((r=>t("a",{href:r.url+"?from=search-bar",class:{"s-search-product":!0,"s-search-product-not-available":!r.is_available},innerHTML:this.productSlot.replace(/\{name\}/g,r.name).replace(/\{price\}/g,r.price?salla.money(r.price):"").replace(/\{regular_price\}/g,r.is_on_sale&&r.regular_price?salla.money(r.regular_price):"").replace(/\{image\}/g,r.image.url)}))),t("p",{key:"fdbb21061c599a59c6d828eec80e8d591a708cca",ref:r=>this.noResults=r,class:"s-search-no-results-placeholder"},salla.lang.get("common.elements.no_options")))),e=t("salla-modal",{key:"ca90aea3fb92d1ba7d8270c26e2ecd82d5018784",position:"top",class:"s-search-modal",ref:r=>this.modal=r},r),i=t("div",{key:"73333ce51cabadc4963a9fe9d1372bb7d63925c8",class:"s-search-placeholder-wrapper s-search-inline"},t("div",{key:"77a66e9bba504557160c8c50d91f1216cc68f253",class:"s-search-input-wrapper"},t("span",{key:"18fb5ce6e3e72874e76dd1ef2c6db8718a68f778",class:"s-search-icon-wrap"},t("span",{key:"63b9e9af1c51647df734cc4d5cf7a825b922ce38",class:"s-search-icon",innerHTML:a})),t("button",{key:"b70169ed2d80ec2ad6b09952ad104824610212df",type:"button",class:"s-search-input s-search-placeholder-trigger",onClick:()=>this.open(),style:{height:this.height+"px",borderRadius:this.oval?this.height/2+"px":""}},salla.lang.get("blocks.header.search_placeholder"))),e);return this.placeholder?i:this.inline?t("div",{class:"s-search-modal"},r):e}componentDidLoad(){this.afterSearching(),this.searchInput.value=this.getQueryParam("q")}get host(){return e(this)}static get watchers(){return{search_term:["handleSearch"]}}};s.style='/*!twlt*/.s-search-placeholder-wrapper{position:relative;display:inline-block}.s-search-input-wrapper{position:relative}.s-search-placeholder-trigger{cursor:pointer;appearance:none;text-align:start}.block{display:block}.inline{display:inline}.border{border-width:1px}.s-search-container{position:relative;z-index:99;max-height:14rem;border-radius:0.375rem;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms}.s-search-oval{border-radius:20px}.s-search-inline{min-width:220px}.s-search-container-open{max-height:24rem;border-radius:0px !important}.s-search-container-open .s-search-input{border-top-left-radius:0.375rem !important;border-top-right-radius:0.375rem !important;border-bottom-right-radius:0px !important;border-bottom-left-radius:0px !important;border-width:1px;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1))}.s-search-no-results .s-search-input{border-bottom-right-radius:0px;border-bottom-left-radius:0px;border-width:1px;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1))}.s-search-input{height:2.5rem;width:100%;border-radius:0.375rem;--tw-border-opacity:1;border-color:rgb(243 244 246 / var(--tw-border-opacity, 1));--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1));padding-top:0px;padding-bottom:0.125rem;font-size:0.875rem;line-height:1.25rem;--tw-text-opacity:1;color:rgb(75 85 99 / var(--tw-text-opacity, 1));transition-property:color, background-color, border-color, text-decoration-color, fill, stroke;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:300ms}.s-search-input:focus{--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1));--tw-ring-color:transparent}.s-search-input:where([dir="ltr"],[dir="ltr"] *){padding-left:2.5rem}.s-search-input:where([dir="rtl"],[dir="rtl"] *){padding-right:2.5rem}.s-search-icon-wrap{position:absolute;top:50%;--tw-translate-y:-50%;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));line-height:1;--tw-text-opacity:1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.s-search-icon-wrap:where([dir="ltr"],[dir="ltr"] *){left:1rem}.s-search-icon-wrap:where([dir="rtl"],[dir="rtl"] *){right:1rem}.s-search-icon svg{height:1rem;width:1rem;fill:#9ca3af}.s-search-spinner-loader{display:block;height:1rem;width:1rem}@keyframes spin{to{transform:rotate(360deg)}}.s-search-spinner-loader{animation:spin 1s linear infinite;border-radius:9999px;border-width:2px;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1));border-right-color:var(--color-primary)}.s-search-results{position:absolute;margin:auto;max-height:24rem;width:100%;max-width:100%;overflow-y:auto;border-bottom-right-radius:0.375rem;border-bottom-left-radius:0.375rem;--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1));--tw-shadow:0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);--tw-shadow-colored:0 20px 25px -5px var(--tw-shadow-color), 0 8px 10px -6px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}.s-search-no-results{border-bottom-right-radius:0px !important;border-bottom-left-radius:0px !important}.s-search-no-results-placeholder{padding:1rem;text-align:center;font-size:0.875rem;line-height:1.25rem;--tw-text-opacity:1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.s-search-product{display:flex;height:100%;justify-content:space-around;overflow:hidden;border-bottom-width:1px;--tw-border-opacity:1;border-color:rgb(243 244 246 / var(--tw-border-opacity, 1));background-color:transparent;padding-left:1rem;padding-right:1rem;padding-top:0.75rem;padding-bottom:0.75rem;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:300ms}.s-search-product:last-child{border-bottom-width:0px}.s-search-product:hover{--tw-bg-opacity:1;background-color:rgb(249 250 251 / var(--tw-bg-opacity, 1))}@media (min-width: 480px){.s-search-product{padding-left:1.25rem;padding-right:1.25rem}}.s-search-product-image-container{position:relative;height:3.5rem;width:5rem;overflow:hidden;border-radius:0.375rem;--tw-bg-opacity:1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.s-search-product-image{position:relative;height:100%;width:100%;object-fit:cover;font-size:0px}.s-search-product-image::before{position:absolute;top:0px;left:0px;height:100%;width:100%;--tw-bg-opacity:1;background-color:rgb(229 231 235 / var(--tw-bg-opacity, 1));--tw-content:\'\';content:var(--tw-content)}.s-search-product-details{flex:1 1 0%;padding-top:0.25rem}.s-search-product-details:where([dir="ltr"],[dir="ltr"] *){padding-left:1rem}@media (min-width: 480px){.s-search-product-details:where([dir="ltr"],[dir="ltr"] *){padding-left:1.25rem}}.s-search-product-details:where([dir="rtl"],[dir="rtl"] *){padding-right:1rem}@media (min-width: 480px){.s-search-product-details:where([dir="rtl"],[dir="rtl"] *){padding-right:1.25rem}}.s-search-product-title{margin-bottom:0.375rem;display:flex;flex-direction:column;align-items:baseline;justify-content:flex-start;font-size:0.875rem;font-weight:700;line-height:1.5rem;--tw-text-opacity:1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.s-search-product-price{display:flex;width:100%;align-items:center;font-size:0.875rem;line-height:1.25rem;font-weight:700;color:var(--color-primary)}.s-search-product-regular-price{padding-left:0.75rem;padding-right:0.75rem;font-weight:500;--tw-text-opacity:1;color:rgb(156 163 175 / var(--tw-text-opacity, 1));text-decoration-line:line-through}.s-search-product-not-available{--tw-grayscale:grayscale(100%);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.s-search-action{position:absolute;height:100%}.s-search-action:where([dir="ltr"],[dir="ltr"] *){right:0px}.s-search-action:where([dir="rtl"],[dir="rtl"] *){left:0px;border-top-right-radius:0px;border-bottom-right-radius:0px}.s-search-action-oval:where([dir="ltr"],[dir="ltr"] *){border-top-right-radius:9999px;border-bottom-right-radius:9999px}.s-search-action-oval:where([dir="rtl"],[dir="rtl"] *){border-top-left-radius:9999px;border-bottom-left-radius:9999px}.s-search-input-wrapper{position:relative;display:flex;flex-grow:1;align-items:center}.s-search-modal .s-modal-wrapper{align-items:flex-start;padding:0}.s-search-modal .s-modal-spacer{display:inline}.s-search-modal .s-modal-body{padding:0;width:700px;max-width:90%;margin-top:3.2rem;border-radius:0.5rem;background:transparent;overflow:visible;position:relative !important}.s-search-modal .s-modal-close{top:50%;transform:translateY(-50%)}';export{s as salla_search}
4
+ import{r,h as t,a as e}from"./p-BsIeN-bg.js";import{S as a}from"./p-BscTeWDc.js";import{H as i}from"./p-D6rFREuQ.js";import"./p-CgtvEd63.js";const s=class{constructor(t){r(this,t),this.inputValue="",this.translationLoaded=!1,this.loading=!1,this.typing=!1,this.debounce=setTimeout((()=>""),1e3),this.placeholder=!1,this.inline=!1,this.oval=!1,this.height=60,this.maxWords=5,this.showAction=!1,this.productSlot=this.host.querySelector('[slot="product"]')?.innerHTML||this.getDefaultProductSlot(),salla.event.on("search::open",(()=>this.open())),salla.lang.onLoaded((()=>{this.translationLoaded=!0})),salla.event.on("modalClosed",(()=>this.onModalClose()))}async open(){this.inline||await this.modal.open().then((()=>setTimeout((()=>this.searchInput.focus()),300)))}onModalClose(){this.searchInput.value="",this.results=void 0,this.afterSearching(),this.container.classList.remove("s-search-no-results")}handleKeyDown(r){"Enter"===r.key&&this.search_term?.length&&(window.location.href=salla.url.get("search?q="+encodeURI(this.search_term)))}getDefaultProductSlot(){return'<div class="s-search-product-image-container"> <img class="s-search-product-image" src="{image}" alt="{name}"/></div><div class="s-search-product-details"> <div class="s-search-product-title">{name}</div> <div class="s-search-product-price">{price} <span class="s-search-product-regular-price">{regular_price}</span></div></div>'}debounceSearch(r){this.typing=!0,clearTimeout(this.debounce),this.debounce=setTimeout((()=>{this.typing=!1,this.search_term=r.target.value}),700)}limitWordsAndSearch(r){const t=r.target.value.trim().split(/\s+/);if(t.length>this.maxWords){const r=t.slice(0,this.maxWords).join(" ");this.searchInput.value=r}this.debounceSearch(r)}getQueryParam(r){return new URLSearchParams(window.location.search).get(r)}handleActionClick(){if(this.search_term&&this.search_term.length>2)return this.search(this.search_term)}handleSearch(r){this.inputValue=r,r.length>2?this.search(r):(this.results=void 0,this.afterSearching())}search(r){this.noResults.style.display="none",this.loading=!0,salla.product.fetch({source:"search",source_value:r}).then((t=>{this.results=t,salla.event.emit("Products Searched",r)})).catch((r=>"Query is same as previous one!"!==r?this.results=void 0:null)).finally((()=>this.afterSearching(!1)))}afterSearching(r=!0){this.noResults.style.display=r||this.results?.data.length>0?"none":"block",i.toggleElementClassIf(this.container,"s-search-container-open","s-search-no-results",(()=>this.results?.data.length)),this.loading=!1,salla.product.api.previousQuery="",this.inputValue.length<3&&this.container.classList.remove("s-search-no-results")}render(){const r=t("div",{key:"ca8dec5eb90cd0893a1a3364df34ba0ee4d60891",class:{"s-search-container":!0,"s-search-inline":this.inline},ref:r=>this.container=r},t("div",{key:"212f8180ecca220a8b89231311dec6cdf3ef0b06",class:"s-search-input-wrapper"},t("span",{key:"51fb0f9a2e342afd35eb82b57f55471aa9e1519f",class:"s-search-icon-wrap"},t("span",{key:"e75117068c51c6d200e8e20fa0f00ca02ed0c61d",class:"s-search-icon",innerHTML:this.loading?'<i class="s-search-spinner-loader"/>':a})),t("input",{key:"442b1704b75a33e8c9e02da8200151a1d8e8db72",type:"search",enterkeyhint:"search",autocomplete:"off",class:"s-search-input",placeholder:salla.lang.get("blocks.header.search_placeholder"),onInput:r=>this.limitWordsAndSearch(r),onKeyDown:r=>this.handleKeyDown(r),ref:r=>this.searchInput=r,style:{height:this.height+"px",borderRadius:this.oval?this.height/2+"px":""}}),this.showAction?t("salla-button",{loading:this.loading,class:{"s-search-action":!0,"s-search-action-oval":this.oval},onClick:()=>this.handleActionClick()},!this.loading&&t("span",{innerHTML:a})):null),t("div",{key:"f3b40ce4ec24678f6d8421f3da8ac9e1bd631c3a",class:"s-search-results"},this.results?.data.map((r=>t("a",{href:r.url+"?from=search-bar",class:{"s-search-product":!0,"s-search-product-not-available":!r.is_available},innerHTML:this.productSlot.replace(/\{name\}/g,r.name).replace(/\{price\}/g,r.price?salla.money(r.price):"").replace(/\{regular_price\}/g,r.is_on_sale&&r.regular_price?salla.money(r.regular_price):"").replace(/\{image\}/g,r.image.url)}))),t("p",{key:"fdbb21061c599a59c6d828eec80e8d591a708cca",ref:r=>this.noResults=r,class:"s-search-no-results-placeholder"},salla.lang.get("common.elements.no_options")))),e=t("salla-modal",{key:"ca90aea3fb92d1ba7d8270c26e2ecd82d5018784",position:"top",class:"s-search-modal",ref:r=>this.modal=r},r),i=t("div",{key:"73333ce51cabadc4963a9fe9d1372bb7d63925c8",class:"s-search-placeholder-wrapper s-search-inline"},t("div",{key:"77a66e9bba504557160c8c50d91f1216cc68f253",class:"s-search-input-wrapper"},t("span",{key:"18fb5ce6e3e72874e76dd1ef2c6db8718a68f778",class:"s-search-icon-wrap"},t("span",{key:"63b9e9af1c51647df734cc4d5cf7a825b922ce38",class:"s-search-icon",innerHTML:a})),t("button",{key:"b70169ed2d80ec2ad6b09952ad104824610212df",type:"button",class:"s-search-input s-search-placeholder-trigger",onClick:()=>this.open(),style:{height:this.height+"px",borderRadius:this.oval?this.height/2+"px":""}},salla.lang.get("blocks.header.search_placeholder"))),e);return this.placeholder?i:this.inline?t("div",{class:"s-search-modal"},r):e}componentDidLoad(){this.afterSearching(),this.searchInput.value=this.getQueryParam("q")}get host(){return e(this)}static get watchers(){return{search_term:["handleSearch"]}}};s.style='/*!twlt*/.s-search-placeholder-wrapper{position:relative;display:inline-block}.s-search-input-wrapper{position:relative}.s-search-placeholder-trigger{cursor:pointer;appearance:none;text-align:start}.block{display:block}.inline{display:inline}.border{border-width:1px}.s-search-container{position:relative;z-index:99;max-height:14rem;border-radius:0.375rem;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms}.s-search-oval{border-radius:20px}.s-search-inline{min-width:220px}.s-search-container-open{max-height:24rem;border-radius:0px !important}.s-search-container-open .s-search-input{border-top-left-radius:0.375rem !important;border-top-right-radius:0.375rem !important;border-bottom-right-radius:0px !important;border-bottom-left-radius:0px !important;border-width:1px;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1))}.s-search-no-results .s-search-input{border-bottom-right-radius:0px;border-bottom-left-radius:0px;border-width:1px;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1))}.s-search-input{height:2.5rem;width:100%;border-radius:0.375rem;--tw-border-opacity:1;border-color:rgb(243 244 246 / var(--tw-border-opacity, 1));--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1));padding-top:0px;padding-bottom:0.125rem;font-size:0.875rem;line-height:1.25rem;--tw-text-opacity:1;color:rgb(75 85 99 / var(--tw-text-opacity, 1));transition-property:color, background-color, border-color, text-decoration-color, fill, stroke;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:300ms}.s-search-input:focus{--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1));--tw-ring-color:transparent}.s-search-input:where([dir="ltr"],[dir="ltr"] *){padding-left:2.5rem}.s-search-input:where([dir="rtl"],[dir="rtl"] *){padding-right:2.5rem}.s-search-icon-wrap{position:absolute;top:50%;--tw-translate-y:-50%;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));line-height:1;--tw-text-opacity:1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.s-search-icon-wrap:where([dir="ltr"],[dir="ltr"] *){left:1rem}.s-search-icon-wrap:where([dir="rtl"],[dir="rtl"] *){right:1rem}.s-search-icon svg{height:1rem;width:1rem;fill:#9ca3af}.s-search-spinner-loader{display:block;height:1rem;width:1rem}@keyframes spin{to{transform:rotate(360deg)}}.s-search-spinner-loader{animation:spin 1s linear infinite;border-radius:9999px;border-width:2px;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1));border-right-color:var(--color-primary)}.s-search-results{position:absolute;margin:auto;max-height:24rem;width:100%;max-width:100%;overflow-y:auto;border-bottom-right-radius:0.375rem;border-bottom-left-radius:0.375rem;--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1));--tw-shadow:0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);--tw-shadow-colored:0 20px 25px -5px var(--tw-shadow-color), 0 8px 10px -6px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}.s-search-no-results{border-bottom-right-radius:0px !important;border-bottom-left-radius:0px !important}.s-search-no-results-placeholder{padding:1rem;text-align:center;font-size:0.875rem;line-height:1.25rem;--tw-text-opacity:1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.s-search-product{display:flex;height:100%;justify-content:space-around;overflow:hidden;border-bottom-width:1px;--tw-border-opacity:1;border-color:rgb(243 244 246 / var(--tw-border-opacity, 1));background-color:transparent;padding-left:1rem;padding-right:1rem;padding-top:0.75rem;padding-bottom:0.75rem;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:300ms}.s-search-product:last-child{border-bottom-width:0px}.s-search-product:hover{--tw-bg-opacity:1;background-color:rgb(249 250 251 / var(--tw-bg-opacity, 1))}@media (min-width: 480px){.s-search-product{padding-left:1.25rem;padding-right:1.25rem}}.s-search-product-image-container{position:relative;height:3.5rem;width:5rem;overflow:hidden;border-radius:0.375rem;--tw-bg-opacity:1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.s-search-product-image{position:relative;height:100%;width:100%;object-fit:cover;font-size:0px}.s-search-product-image::before{position:absolute;top:0px;left:0px;height:100%;width:100%;--tw-bg-opacity:1;background-color:rgb(229 231 235 / var(--tw-bg-opacity, 1));--tw-content:\'\';content:var(--tw-content)}.s-search-product-details{flex:1 1 0%;padding-top:0.25rem}.s-search-product-details:where([dir="ltr"],[dir="ltr"] *){padding-left:1rem}@media (min-width: 480px){.s-search-product-details:where([dir="ltr"],[dir="ltr"] *){padding-left:1.25rem}}.s-search-product-details:where([dir="rtl"],[dir="rtl"] *){padding-right:1rem}@media (min-width: 480px){.s-search-product-details:where([dir="rtl"],[dir="rtl"] *){padding-right:1.25rem}}.s-search-product-title{margin-bottom:0.375rem;display:flex;flex-direction:column;align-items:baseline;justify-content:flex-start;font-size:0.875rem;font-weight:700;line-height:1.5rem;--tw-text-opacity:1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.s-search-product-price{display:flex;width:100%;align-items:center;font-size:0.875rem;line-height:1.25rem;font-weight:700;color:var(--color-primary)}.s-search-product-regular-price{padding-left:0.75rem;padding-right:0.75rem;font-weight:500;--tw-text-opacity:1;color:rgb(156 163 175 / var(--tw-text-opacity, 1));text-decoration-line:line-through}.s-search-product-not-available{--tw-grayscale:grayscale(100%);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.s-search-action{position:absolute;height:100%}.s-search-action:where([dir="ltr"],[dir="ltr"] *){right:0px}.s-search-action:where([dir="rtl"],[dir="rtl"] *){left:0px;border-top-right-radius:0px;border-bottom-right-radius:0px}.s-search-action-oval:where([dir="ltr"],[dir="ltr"] *){border-top-right-radius:9999px;border-bottom-right-radius:9999px}.s-search-action-oval:where([dir="rtl"],[dir="rtl"] *){border-top-left-radius:9999px;border-bottom-left-radius:9999px}.s-search-input-wrapper{position:relative;display:flex;flex-grow:1;align-items:center}.s-search-modal .s-modal-wrapper{align-items:flex-start;padding:0}.s-search-modal .s-modal-spacer{display:inline}.s-search-modal .s-modal-body{padding:0;width:700px;max-width:90%;margin-top:3.2rem;border-radius:0.5rem;background:transparent;overflow:visible;position:relative !important}.s-search-modal .s-modal-close{top:50%;transform:translateY(-50%)}';export{s as salla_search}
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r as a,h as t,H as l,a as n}from"./p-C0qiFNJn.js";const s=class{constructor(t){a(this,t),this.pointsData=null,this.productId=null}async componentWillLoad(){try{if(await salla.onReady(),await salla.lang.onLoaded(),this.productId=this.host.dataset.productId||salla.config.get("page.id"),!this.productId)return;const a=await salla.api.request(`/loyalty/products/${this.productId}/points`).catch((()=>null));this.pointsData=a?.data||null}catch(a){salla?.logger?.warn?.("salla-loyalty-points-banner: init failed",a)}}render(){return this.productId&&this.pointsData?.points?t(l,null,t("div",{class:"s-loyalty-points-banner-container"},t("div",{class:"s-loyalty-points-banner-icon"},t("span",{class:"s-loyalty-points-banner-inner-icon",innerHTML:'<svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M8.76604 2.86201C9.31804 2.61001 9.93304 2.41501 10.611 2.27701C11.289 2.13901 12 2.07001 12.744 2.07001C13.572 2.07001 14.364 2.15401 15.12 2.32201C15.84 2.49001 16.356 2.81401 16.668 3.29401C16.932 3.70201 17.064 4.26001 17.064 4.96801V13.032C17.064 13.416 16.95 13.752 16.722 14.04C16.506 14.304 16.227 14.493 15.885 14.607C15.543 14.721 15.204 14.742 14.868 14.67C14.196 14.514 13.488 14.436 12.744 14.436C12.084 14.436 11.442 14.502 10.818 14.634C10.23 14.754 9.70204 14.922 9.23404 15.138C8.68204 15.39 8.06704 15.585 7.38904 15.723C6.71104 15.861 6.00004 15.93 5.25604 15.93C4.42804 15.93 3.63604 15.846 2.88004 15.678C2.18404 15.522 1.68004 15.21 1.36804 14.742C1.08004 14.322 0.936035 13.752 0.936035 13.032V4.96801C0.936035 4.58401 1.05004 4.24801 1.27804 3.96001C1.49404 3.69601 1.77304 3.50701 2.11504 3.39301C2.45704 3.27901 2.79604 3.25801 3.13204 3.33001C3.80404 3.48601 4.51204 3.56401 5.25604 3.56401C5.91604 3.56401 6.55804 3.49801 7.18204 3.36601C7.77004 3.24601 8.29804 3.07801 8.76604 2.86201ZM11.25 9.00001C11.25 8.59201 11.148 8.21701 10.944 7.87501C10.74 7.53301 10.467 7.26001 10.125 7.05601C9.78304 6.85201 9.40804 6.75001 9.00004 6.75001C8.59204 6.75001 8.21704 6.85201 7.87504 7.05601C7.53304 7.26001 7.26004 7.53301 7.05604 7.87501C6.85204 8.21701 6.75004 8.59201 6.75004 9.00001C6.75004 9.40801 6.85204 9.78301 7.05604 10.125C7.26004 10.467 7.53304 10.74 7.87504 10.944C8.21704 11.148 8.59204 11.25 9.00004 11.25C9.40804 11.25 9.78304 11.148 10.125 10.944C10.467 10.74 10.74 10.467 10.944 10.125C11.148 9.78301 11.25 9.40801 11.25 9.00001ZM14.328 7.79401C14.076 7.75801 13.812 7.73401 13.536 7.72201C13.38 7.71001 13.245 7.75501 13.131 7.85701C13.017 7.95901 12.954 8.08801 12.942 8.24401C12.93 8.40001 12.975 8.53501 13.077 8.64901C13.179 8.76301 13.308 8.82601 13.464 8.83801C13.704 8.85001 13.938 8.87401 14.166 8.91001C14.322 8.93401 14.463 8.90101 14.589 8.81101C14.715 8.72101 14.787 8.59801 14.805 8.44201C14.823 8.28601 14.787 8.14501 14.697 8.01901C14.607 7.89301 14.484 7.81801 14.328 7.79401ZM4.53604 9.16201C4.29604 9.15001 4.06204 9.12601 3.83404 9.09001C3.67804 9.06601 3.53704 9.09901 3.41104 9.18901C3.28504 9.27901 3.21304 9.40201 3.19504 9.55801C3.17704 9.71401 3.21304 9.85501 3.30304 9.98101C3.39304 10.107 3.51604 10.182 3.67204 10.206C3.92404 10.242 4.18804 10.266 4.46404 10.278C4.62004 10.29 4.75504 10.245 4.86904 10.143C4.98304 10.041 5.04604 9.91201 5.05804 9.75601C5.07004 9.60001 5.02504 9.46501 4.92304 9.35101C4.82104 9.23701 4.69204 9.17401 4.53604 9.16201Z" fill="white"/>\n</svg>\n'})),t("p",null,t("span",{class:"s-loyalty-points-banner-label"},salla.lang.get("pages.loyalty_program.earn")," "),t("span",{class:"s-loyalty-points-banner-label"},`+${this.pointsData.points}`," "),t("span",{class:"s-loyalty-points-banner-label"},salla.lang.get("pages.loyalty_program.loyalty_point")," "),t("span",{class:"s-loyalty-points-banner-description"},salla.lang.get("pages.loyalty_program.on_order_total_when_purchase"))))):null}get host(){return n(this)}};s.style="/*!twlt*/.s-loyalty-points-banner-container{margin-bottom:0.75rem;display:flex;width:100%;align-items:center;gap:0.5rem;border-radius:0.5rem;background-color:rgb(209 180 76 / var(--tw-bg-opacity, 1));--tw-bg-opacity:0.1;padding-left:0.75rem;padding-right:0.75rem;padding-top:0.5rem;padding-bottom:0.5rem}.s-loyalty-points-banner-icon{display:flex;height:2rem;width:2rem;flex-shrink:0;align-items:center;justify-content:center;border-radius:9999px;--tw-bg-opacity:1;background-color:rgb(209 180 76 / var(--tw-bg-opacity, 1))}.s-loyalty-points-banner-label{font-size:0.875rem;line-height:1.25rem;font-weight:700;--tw-text-opacity:1;color:rgb(209 180 76 / var(--tw-text-opacity, 1))}.s-loyalty-points-banner-description{font-size:0.875rem;line-height:1.25rem}";export{s as salla_loyalty_points_banner}
4
+ import{r as a,h as t,H as l,a as n}from"./p-BsIeN-bg.js";const s=class{constructor(t){a(this,t),this.pointsData=null,this.productId=null}async componentWillLoad(){try{if(await salla.onReady(),await salla.lang.onLoaded(),this.productId=this.host.dataset.productId||salla.config.get("page.id"),!this.productId)return;const a=await salla.api.request(`/loyalty/products/${this.productId}/points`).catch((()=>null));this.pointsData=a?.data||null}catch(a){salla?.logger?.warn?.("salla-loyalty-points-banner: init failed",a)}}render(){return this.productId&&this.pointsData?.points?t(l,null,t("div",{class:"s-loyalty-points-banner-container"},t("div",{class:"s-loyalty-points-banner-icon"},t("span",{class:"s-loyalty-points-banner-inner-icon",innerHTML:'<svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M8.76604 2.86201C9.31804 2.61001 9.93304 2.41501 10.611 2.27701C11.289 2.13901 12 2.07001 12.744 2.07001C13.572 2.07001 14.364 2.15401 15.12 2.32201C15.84 2.49001 16.356 2.81401 16.668 3.29401C16.932 3.70201 17.064 4.26001 17.064 4.96801V13.032C17.064 13.416 16.95 13.752 16.722 14.04C16.506 14.304 16.227 14.493 15.885 14.607C15.543 14.721 15.204 14.742 14.868 14.67C14.196 14.514 13.488 14.436 12.744 14.436C12.084 14.436 11.442 14.502 10.818 14.634C10.23 14.754 9.70204 14.922 9.23404 15.138C8.68204 15.39 8.06704 15.585 7.38904 15.723C6.71104 15.861 6.00004 15.93 5.25604 15.93C4.42804 15.93 3.63604 15.846 2.88004 15.678C2.18404 15.522 1.68004 15.21 1.36804 14.742C1.08004 14.322 0.936035 13.752 0.936035 13.032V4.96801C0.936035 4.58401 1.05004 4.24801 1.27804 3.96001C1.49404 3.69601 1.77304 3.50701 2.11504 3.39301C2.45704 3.27901 2.79604 3.25801 3.13204 3.33001C3.80404 3.48601 4.51204 3.56401 5.25604 3.56401C5.91604 3.56401 6.55804 3.49801 7.18204 3.36601C7.77004 3.24601 8.29804 3.07801 8.76604 2.86201ZM11.25 9.00001C11.25 8.59201 11.148 8.21701 10.944 7.87501C10.74 7.53301 10.467 7.26001 10.125 7.05601C9.78304 6.85201 9.40804 6.75001 9.00004 6.75001C8.59204 6.75001 8.21704 6.85201 7.87504 7.05601C7.53304 7.26001 7.26004 7.53301 7.05604 7.87501C6.85204 8.21701 6.75004 8.59201 6.75004 9.00001C6.75004 9.40801 6.85204 9.78301 7.05604 10.125C7.26004 10.467 7.53304 10.74 7.87504 10.944C8.21704 11.148 8.59204 11.25 9.00004 11.25C9.40804 11.25 9.78304 11.148 10.125 10.944C10.467 10.74 10.74 10.467 10.944 10.125C11.148 9.78301 11.25 9.40801 11.25 9.00001ZM14.328 7.79401C14.076 7.75801 13.812 7.73401 13.536 7.72201C13.38 7.71001 13.245 7.75501 13.131 7.85701C13.017 7.95901 12.954 8.08801 12.942 8.24401C12.93 8.40001 12.975 8.53501 13.077 8.64901C13.179 8.76301 13.308 8.82601 13.464 8.83801C13.704 8.85001 13.938 8.87401 14.166 8.91001C14.322 8.93401 14.463 8.90101 14.589 8.81101C14.715 8.72101 14.787 8.59801 14.805 8.44201C14.823 8.28601 14.787 8.14501 14.697 8.01901C14.607 7.89301 14.484 7.81801 14.328 7.79401ZM4.53604 9.16201C4.29604 9.15001 4.06204 9.12601 3.83404 9.09001C3.67804 9.06601 3.53704 9.09901 3.41104 9.18901C3.28504 9.27901 3.21304 9.40201 3.19504 9.55801C3.17704 9.71401 3.21304 9.85501 3.30304 9.98101C3.39304 10.107 3.51604 10.182 3.67204 10.206C3.92404 10.242 4.18804 10.266 4.46404 10.278C4.62004 10.29 4.75504 10.245 4.86904 10.143C4.98304 10.041 5.04604 9.91201 5.05804 9.75601C5.07004 9.60001 5.02504 9.46501 4.92304 9.35101C4.82104 9.23701 4.69204 9.17401 4.53604 9.16201Z" fill="white"/>\n</svg>\n'})),t("p",null,t("span",{class:"s-loyalty-points-banner-label"},salla.lang.get("pages.loyalty_program.earn")," "),t("span",{class:"s-loyalty-points-banner-label"},`+${this.pointsData.points}`," "),t("span",{class:"s-loyalty-points-banner-label"},salla.lang.get("pages.loyalty_program.loyalty_point")," "),t("span",{class:"s-loyalty-points-banner-description"},salla.lang.get("pages.loyalty_program.on_order_total_when_purchase"))))):null}get host(){return n(this)}};s.style="/*!twlt*/.s-loyalty-points-banner-container{margin-bottom:0.75rem;display:flex;width:100%;align-items:center;gap:0.5rem;border-radius:0.5rem;background-color:rgb(209 180 76 / var(--tw-bg-opacity, 1));--tw-bg-opacity:0.1;padding-left:0.75rem;padding-right:0.75rem;padding-top:0.5rem;padding-bottom:0.5rem}.s-loyalty-points-banner-icon{display:flex;height:2rem;width:2rem;flex-shrink:0;align-items:center;justify-content:center;border-radius:9999px;--tw-bg-opacity:1;background-color:rgb(209 180 76 / var(--tw-bg-opacity, 1))}.s-loyalty-points-banner-label{font-size:0.875rem;line-height:1.25rem;font-weight:700;--tw-text-opacity:1;color:rgb(209 180 76 / var(--tw-text-opacity, 1))}.s-loyalty-points-banner-description{font-size:0.875rem;line-height:1.25rem}";export{s as salla_loyalty_points_banner}
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r as e,h as t,H as s}from"./p-C0qiFNJn.js";const r=class{constructor(t){e(this,t),this.type="normal",this.width="100%",this.height="100%"}render(){return t(s,{key:"7b36da96585cfefe9aa96df6262be14f6a03c585",class:"s-skeleton-wrapper",style:{width:this.width,height:this.height}},t("div",{key:"568ae1bc0aeae182bb32468b19601c0245e9617d",class:{"s-skeleton-item":!0,"s-skeleton-item-circular":"circle"==this.type}}," "))}};r.style="/*!twlt*/:host{display:block}.s-loyalty-skeleton .s-loyalty-prize-item .s-skeleton-wrapper{margin-left:auto;margin-right:auto}.s-skeleton-wrapper{display:block}@keyframes pulse{50%{opacity:.5}}.s-skeleton-wrapper{animation:pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite}.s-skeleton-item{height:100%;width:100%;border-radius:0.375rem;--tw-bg-opacity:1;background-color:rgb(229 231 235 / var(--tw-bg-opacity, 1))}.s-skeleton-item:is(.dark *){--tw-bg-opacity:1;background-color:rgb(55 65 81 / var(--tw-bg-opacity, 1))}.s-skeleton-item-circular{border-radius:9999px}";export{r as salla_skeleton}
4
+ import{r as e,h as t,H as s}from"./p-BsIeN-bg.js";const r=class{constructor(t){e(this,t),this.type="normal",this.width="100%",this.height="100%"}render(){return t(s,{key:"7b36da96585cfefe9aa96df6262be14f6a03c585",class:"s-skeleton-wrapper",style:{width:this.width,height:this.height}},t("div",{key:"568ae1bc0aeae182bb32468b19601c0245e9617d",class:{"s-skeleton-item":!0,"s-skeleton-item-circular":"circle"==this.type}}," "))}};r.style="/*!twlt*/:host{display:block}.s-loyalty-skeleton .s-loyalty-prize-item .s-skeleton-wrapper{margin-left:auto;margin-right:auto}.s-skeleton-wrapper{display:block}@keyframes pulse{50%{opacity:.5}}.s-skeleton-wrapper{animation:pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite}.s-skeleton-item{height:100%;width:100%;border-radius:0.375rem;--tw-bg-opacity:1;background-color:rgb(229 231 235 / var(--tw-bg-opacity, 1))}.s-skeleton-item:is(.dark *){--tw-bg-opacity:1;background-color:rgb(55 65 81 / var(--tw-bg-opacity, 1))}.s-skeleton-item-circular{border-radius:9999px}";export{r as salla_skeleton}
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r as t,h as a,H as r,a as e}from"./p-C0qiFNJn.js";const i=class{constructor(a){t(this,a),this.loading=!1,this.hasError=!1,this.productData=null}async componentWillLoad(){await salla.onReady(),await this.fetchProduct()}componentDidLoad(){this.ensureParentContainsFloats()}componentDidRender(){this.renderCardNode()}ensureParentContainsFloats(){if("left"!==this.align&&"right"!==this.align)return;const t=this.hostEl?.parentElement;if(!t)return;const a=getComputedStyle(t);"block"===a.display&&"visible"===a.overflow&&"none"===a.float&&(t.style.display="flow-root")}fetchProduct(){return this.productId?(this.loading=!0,this.hasError=!1,salla.api.withoutNotifier((()=>salla.product.api.getDetails(this.productId))).then((t=>{const a=t.data;this.productData=a??null,this.hasError=!a})).catch((()=>{this.productData=null,this.hasError=!0})).finally((()=>{this.loading=!1}))):(this.productData=null,this.loading=!1,void(this.hasError=!1))}renderCardNode(){if(!this.cardContainer)return;if(this.cardContainer.textContent="",!this.productData||this.loading||this.hasError)return;const t=window.customElements.get("custom-salla-product-card")?"custom-salla-product-card":"salla-product-card",a=document.createElement(t),r=this.source||"embed-card";a.setAttribute("source",r),a.product={...this.productData,url:this.withViewedSource(this.productData.url,r)},this.cardContainer.appendChild(a)}withViewedSource(t,a){if(!t)return t;try{const r=new URL(t,window.location.origin);return r.searchParams.set("_svs",a),r.toString()}catch{return t}}render(){const t={"s-product-card-embed-card":!0,"s-product-card-embed-card-align-left":"left"===this.align,"s-product-card-embed-card-align-right":"right"===this.align,"s-product-card-embed-card-align-center":"center"===this.align};return a(r,{key:"3d9fb0dc8473e0959bbe13b4f8c8eea7a51830ea"},this.hasError&&a("span",{key:"25228d6d007d7dcda5e5767e14d2c363abfdab3e",class:"s-product-card-embed-fallback"}),a("div",{key:"d66d592bfad1468b745f3a954c335f72ecda1e08",class:t,ref:t=>{this.cardContainer=t}}))}get hostEl(){return e(this)}};i.style="/*!twlt*/@charset \"UTF-8\";:host{display:inline-block;vertical-align:top;max-width:12rem}:host([align=left]){float:inline-start;margin-block-end:1em;margin-inline-end:1em;shape-outside:margin-box}:host([align=right]){float:inline-end;margin-block-end:1em;margin-inline-start:1em;shape-outside:margin-box}:host([align=center]){display:block;clear:both;margin-block:1em;margin-inline:auto}.s-product-card-embed-card{display:block}.visible{visibility:visible}.block{display:block}.flow-root{display:flow-root}.s-product-card-embed-card{display:block;max-width:12rem;shape-outside:margin-box}.s-product-card-embed-card custom-salla-product-card{--tw-shadow:0 0 28px 0px rgba(0 0 0 / .1);--tw-shadow-colored:0 0 28px 0px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}.s-product-card-embed-card-align-center{margin-left:auto;margin-right:auto}.s-product-card-embed-card-align-left{float:left;margin-right:1ch}.s-product-card-embed-card-align-right{float:right;margin-left:1ch}.s-product-card-embed-fallback{display:block}article:has(salla-product-card-embed)::after{clear:both;display:block;--tw-content:'';content:var(--tw-content)}";export{i as salla_product_card_embed}
4
+ import{r as t,h as a,H as r,a as e}from"./p-BsIeN-bg.js";const i=class{constructor(a){t(this,a),this.loading=!1,this.hasError=!1,this.productData=null}async componentWillLoad(){await salla.onReady(),await this.fetchProduct()}componentDidLoad(){this.ensureParentContainsFloats()}componentDidRender(){this.renderCardNode()}ensureParentContainsFloats(){if("left"!==this.align&&"right"!==this.align)return;const t=this.hostEl?.parentElement;if(!t)return;const a=getComputedStyle(t);"block"===a.display&&"visible"===a.overflow&&"none"===a.float&&(t.style.display="flow-root")}fetchProduct(){return this.productId?(this.loading=!0,this.hasError=!1,salla.api.withoutNotifier((()=>salla.product.api.getDetails(this.productId))).then((t=>{const a=t.data;this.productData=a??null,this.hasError=!a})).catch((()=>{this.productData=null,this.hasError=!0})).finally((()=>{this.loading=!1}))):(this.productData=null,this.loading=!1,void(this.hasError=!1))}renderCardNode(){if(!this.cardContainer)return;if(this.cardContainer.textContent="",!this.productData||this.loading||this.hasError)return;const t=window.customElements.get("custom-salla-product-card")?"custom-salla-product-card":"salla-product-card",a=document.createElement(t),r=this.source||"embed-card";a.setAttribute("source",r),a.product={...this.productData,url:this.withViewedSource(this.productData.url,r)},this.cardContainer.appendChild(a)}withViewedSource(t,a){if(!t)return t;try{const r=new URL(t,window.location.origin);return r.searchParams.set("_svs",a),r.toString()}catch{return t}}render(){const t={"s-product-card-embed-card":!0,"s-product-card-embed-card-align-left":"left"===this.align,"s-product-card-embed-card-align-right":"right"===this.align,"s-product-card-embed-card-align-center":"center"===this.align};return a(r,{key:"3d9fb0dc8473e0959bbe13b4f8c8eea7a51830ea"},this.hasError&&a("span",{key:"25228d6d007d7dcda5e5767e14d2c363abfdab3e",class:"s-product-card-embed-fallback"}),a("div",{key:"d66d592bfad1468b745f3a954c335f72ecda1e08",class:t,ref:t=>{this.cardContainer=t}}))}get hostEl(){return e(this)}};i.style="/*!twlt*/@charset \"UTF-8\";:host{display:inline-block;vertical-align:top;max-width:12rem}:host([align=left]){float:inline-start;margin-block-end:1em;margin-inline-end:1em;shape-outside:margin-box}:host([align=right]){float:inline-end;margin-block-end:1em;margin-inline-start:1em;shape-outside:margin-box}:host([align=center]){display:block;clear:both;margin-block:1em;margin-inline:auto}.s-product-card-embed-card{display:block}.visible{visibility:visible}.block{display:block}.flow-root{display:flow-root}.s-product-card-embed-card{display:block;max-width:12rem;shape-outside:margin-box}.s-product-card-embed-card custom-salla-product-card{--tw-shadow:0 0 28px 0px rgba(0 0 0 / .1);--tw-shadow-colored:0 0 28px 0px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}.s-product-card-embed-card-align-center{margin-left:auto;margin-right:auto}.s-product-card-embed-card-align-left{float:left;margin-right:1ch}.s-product-card-embed-card-align-right{float:right;margin-left:1ch}.s-product-card-embed-fallback{display:block}article:has(salla-product-card-embed)::after{clear:both;display:block;--tw-content:'';content:var(--tw-content)}";export{i as salla_product_card_embed}
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r,c as t,h as e,H as i,a as s}from"./p-C0qiFNJn.js";import{I as o}from"./p-Z7udRKSZ.js";import{M as a}from"./p-DmgxDvXL.js";import{C as n}from"./p-BsLF_HK7.js";const l=class{constructor(e){r(this,e),this.quickOrderSubmited=t(this,"quickOrderSubmited"),this.quickOrderTitle="ليش تنتظر؟",this.subTitle="احصل على المنتج مباشرة الآن",this.payButtonTitle="اطلب المنتج",this.confirmPayButtonTitle="اشتر الآن",this.agreementText=salla.lang.get("pages.checkout.show_full_agreement"),this.isEmailRequired=!1,this.quickOrderStyle="default",this.isAvailable=!1,this.oneClick=!1,this.expanded=!1,this.isTermsRequired=!1,this.countryCode=salla.config.get("user.country_code","SA")||"SA",this.submitSucess=!1,this.placeHolderEmail=salla.lang.get("common.elements.email"),this.emailOptional=salla.lang.get("common.elements.optional"),this.agreementShowText=salla.lang.get("pages.checkout.show_full_agreement"),this.agreementModalHead=salla.lang.get("pages.checkout.full_agreement"),this.userNameLabel=salla.lang.get("pages.products.your_name"),this.termsChecked=!1,salla.onReady((()=>{this.productId=this.productId||salla.config.get("page.id")})),salla.lang.onLoaded((()=>{this.placeHolderEmail=salla.lang.get("common.elements.email"),this.emailOptional=salla.lang.get("common.elements.optional"),this.agreementShowText=salla.lang.get("pages.checkout.show_full_agreement"),this.agreementModalHead=salla.lang.get("pages.checkout.full_agreement"),this.userNameLabel=salla.lang.get("pages.products.your_name")}))}getBtnColor(){return"default"===this.quickOrderStyle?"light":"primary"}getErrorMessage(r,t){return"terms"==t?salla.lang.get("pages.checkout.check_agreement"):salla.lang.get(`common.errors.${r}`,{attribute:"name"==t?this.userNameLabel:this.placeHolderEmail})}handleInvalidInput(r){let t,e=r.target,i=e.validity;i.valueMissing?(t=this.getErrorMessage("field_required",e.name),console.log(this.getErrorMessage("field_required",e.name))):i.typeMismatch&&(t=this.getErrorMessage("invalid_value",e.name)),e.setCustomValidity(t)}async setWrapperHeight(){let r=this.host.querySelector(".s-quick-order-expandable");setTimeout((()=>{r.style.maxHeight=r.style.maxHeight||this.oneClick?null:r.scrollHeight+"px"}),50)}getDarkOrLight(){return"default"===this.quickOrderStyle&&salla.config.get("theme.color.is_dark")?"dark":"light"}getStyleColor(){return{gray:"#f3f3f3",white:"#ffffff",default:salla.config.get("theme.color.primary")}[this.quickOrderStyle]||"#f3f3f3"}async submit(r,t=!1){return r.preventDefault(),t&&!this.oneClick?(this.expanded=!this.expanded,void this.setWrapperHeight()):this.submitBtn.load().then((()=>this.getPayload())).then((r=>salla.api.cart.createQuickOrder(r))).then((()=>{setTimeout((()=>{this.submitBtn.stop(),this.submitSucess=!0,this.quickOrderSubmited.emit()}),200)})).catch((r=>r&&(console.error(r),this.submitBtn.stop())))}async getPayload(){return this.oneClick?{product_ids:[this.productId],agreement:!0}:{product_ids:[this.productId],email:this.emailInput?.value,phone:Number((await(this.phoneInput?.getValues()))?.phone),country_code:(await(this.phoneInput?.getValues()))?.countryCode||this.countryCode,name:this.nameInput?.value,agreement:this.termsChecked}}formatAgreementText(r,t=150){return r?r.length<=t?r:(new DOMParser).parseFromString(r,"text/html").documentElement.innerText.substring(0,t)+"...":""}loadQuickOrderSettings(){let r=salla.config.get("store.settings.quick_order");return r?(this.user=salla.config.get("user")||salla.storage.get("user")||{},this.countryCode=this.user?.country_code||this.countryCode,this.isEmailRequired=!this.user?.email&&this.isEmailRequired,this.oneClick=this.user?.email,this.initComponentData(r),Promise.resolve()):Promise.resolve()}initComponentData(r){this.quickOrderTitle=r.title,this.subTitle=r.sub_title,this.payButtonTitle=r.order_now_button,this.isEmailRequired=r.is_email_required,this.isTermsRequired=r.show_agreement,this.agreementText=r.agreement,this.confirmPayButtonTitle=r.confirm_button,this.thanksMessage=r.thanks_message,this.quickOrderStyle=r.style,this.isAvailable=!0,this.oneClick=this.oneClick&&!this.isTermsRequired}componentWillLoad(){return new Promise((r=>salla.onReady((()=>this.loadQuickOrderSettings().then(r)))))}render(){if(this.isAvailable)return this.submitSucess?e(i,{class:"s-quick-order"},e("div",{class:"s-quick-order-confirm",style:{backgroundColor:salla.config.get("theme.color.primary")+"10",borderColor:salla.config.get("theme.color.primary")+"10",color:salla.config.get("theme.color.primary")}},e("i",{innerHTML:'\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>party-horn</title>\n<path fill="currentColor" d="M5.333 4.013c0.736 0 1.333-0.596 1.333-1.333v-0.013c0-0.737-0.597-1.327-1.333-1.327s-1.333 0.603-1.333 1.34 0.597 1.333 1.333 1.333zM11.333 10c0.341 0 0.683-0.131 0.943-0.391 1.541-1.54 2.391-3.589 2.391-5.771v-2.505c0-0.737-0.597-1.333-1.333-1.333s-1.333 0.596-1.333 1.333v2.505c0 1.468-0.572 2.848-1.609 3.885-0.521 0.521-0.521 1.364 0 1.885 0.26 0.26 0.601 0.391 0.943 0.391zM18.667 9.993c0.319 0 0.639-0.115 0.895-0.345 0.383-0.347 0.684-0.325 1.497-0.22 0.923 0.124 2.319 0.307 3.636-0.887 1.293-1.172 1.303-2.54 1.308-3.539 0.005-0.887 0.043-1.228 0.432-1.581 0.361-0.327 0.621-0.335 1.493-0.216 0.923 0.12 2.317 0.307 3.635-0.884 0.545-0.495 0.587-1.337 0.093-1.883-0.493-0.547-1.336-0.589-1.884-0.093-0.361 0.325-0.621 0.333-1.493 0.216-0.921-0.119-2.317-0.305-3.635 0.884-1.293 1.173-1.303 2.541-1.308 3.54-0.005 0.885-0.043 1.227-0.432 1.58-0.383 0.348-0.683 0.327-1.497 0.22-0.924-0.124-2.32-0.305-3.636 0.887-0.545 0.495-0.587 1.339-0.092 1.884 0.264 0.291 0.625 0.437 0.988 0.437zM18.667 16.013c0.736 0 1.333-0.596 1.333-1.333v-0.013c0-0.737-0.597-1.327-1.333-1.327s-1.333 0.603-1.333 1.34 0.597 1.333 1.333 1.333zM30.667 17.333h-2.505c-2.179 0-4.228 0.849-5.771 2.391-0.521 0.521-0.521 1.364 0 1.885 0.26 0.26 0.603 0.391 0.944 0.391s0.683-0.131 0.943-0.391c1.023-1.023 2.439-1.609 3.884-1.609h2.505c0.736 0 1.333-0.596 1.333-1.333s-0.597-1.333-1.333-1.333zM30.667 10.66c-0.736 0-1.333 0.603-1.333 1.34s0.597 1.333 1.333 1.333 1.333-0.596 1.333-1.333v-0.013c0-0.736-0.597-1.327-1.333-1.327zM29.333 26.66c-0.736 0-1.333 0.603-1.333 1.34s0.597 1.333 1.333 1.333 1.333-0.596 1.333-1.333v-0.013c0-0.736-0.597-1.327-1.333-1.327zM7.456 11.057c-0.327-0.327-0.799-0.46-1.249-0.356-0.449 0.107-0.812 0.439-0.959 0.876l-5.036 15.113c-0.487 1.457-0.113 3.037 0.973 4.125 0.772 0.771 1.792 1.183 2.84 1.183 0.428 0 0.861-0.068 1.284-0.209l15.112-5.037c0.439-0.145 0.769-0.508 0.876-0.959 0.107-0.449-0.028-0.921-0.355-1.249zM4.467 29.259c-0.503 0.163-1.023 0.043-1.395-0.329-0.373-0.373-0.497-0.896-0.329-1.396l4.355-13.065 10.436 10.435z"></path>\n</svg>\n'}),e("span",null,this.thanksMessage))):e(i,{class:`s-quick-order s-quick-order-${this.getDarkOrLight()}`},e("div",{class:`s-quick-order-container s-quick-order-${this.quickOrderStyle}`,style:{backgroundColor:this.getStyleColor()}},e("div",{class:"s-quick-order-button-cont"},e("div",null,e("h3",null,this.quickOrderTitle),e("p",null,this.subTitle)),e("salla-button",{class:this.expanded?"s-quick-order-btn-close":"",onClick:r=>this.submit(r,!0),color:this.getBtnColor()},this.oneClick?this.confirmPayButtonTitle:this.expanded?e("i",{innerHTML:n}):this.confirmPayButtonTitle)),e("form",{onSubmit:r=>this.submit(r),class:"s-quick-order-expandable "+(this.expanded?"s-quick-order-shown":"")},Salla.config.isGuest()&&[e("div",{class:"s-form-group"},e("span",{innerHTML:'\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>portrait</title>\n<path d="M24 1.333h-16c-3.676 0-6.667 2.991-6.667 6.667v16c0 3.028 2.041 5.561 4.811 6.371 0.004 0.001 0.008 0.003 0.012 0.004 0.591 0.172 1.2 0.292 1.844 0.292h16c0.644 0 1.253-0.12 1.843-0.292 0.004-0.001 0.008-0.003 0.012-0.004 2.771-0.809 4.812-3.343 4.812-6.371v-16c0-3.676-2.991-6.667-6.667-6.667zM8.012 28c0.121-1.915 3.363-4 7.988-4s7.868 2.085 7.988 4zM28 24c0 1.24-0.579 2.335-1.467 3.069-0.768-3.288-5.112-5.736-10.533-5.736s-9.765 2.448-10.533 5.736c-0.888-0.735-1.467-1.829-1.467-3.069v-16c0-2.205 1.795-4 4-4h16c2.205 0 4 1.795 4 4zM16 6.667c-3.308 0-6 2.692-6 6s2.692 6 6 6 6-2.692 6-6-2.692-6-6-6zM16 16c-1.839 0-3.333-1.495-3.333-3.333s1.495-3.333 3.333-3.333 3.333 1.495 3.333 3.333-1.495 3.333-3.333 3.333z"></path>\n</svg>\n'}),e("input",{type:"text",required:!0,class:"s-form-control s-quick-order-phone-field",name:"name",placeholder:this.userNameLabel,ref:r=>this.nameInput=r})),e("div",{class:"s-quick-order-flex-input"},e("div",{class:"s-form-group"},e("span",{innerHTML:o}),e("salla-tel-input",{ref:r=>this.phoneInput=r})),e("div",{class:"s-form-group"},e("span",{innerHTML:a}),e("input",{type:"email",class:"s-form-control s-quick-order-email-field",name:"email",required:this.isEmailRequired,placeholder:this.placeHolderEmail+" "+(this.isEmailRequired?"":this.emailOptional),ref:r=>this.emailInput=r})))],this.isTermsRequired&&e("label",{htmlFor:"terms",class:"s-quick-order-terms"},e("input",{type:"checkbox",required:!0,name:"terms",id:"terms",ref:r=>this.termsInput=r,onChange:()=>this.termsChecked=this.termsInput.checked,class:"s-checkbox"}),e("span",{class:"s-form-label"}," ",e("div",{innerHTML:this.formatAgreementText(this.agreementText,150)},this.agreementText.length>150&&e("salla-button",{shape:"link",onClick:()=>this.agreementModal.open()},this.agreementShowText))," ")),e("salla-button",{type:"submit",color:this.getBtnColor(),width:"wide",ref:r=>this.submitBtn=r},this.payButtonTitle)),e("salla-modal",{"modal-title":this.agreementModalHead,ref:r=>this.agreementModal=r},e("article",{innerHTML:this.agreementText}))))}componentDidLoad(){this.host.querySelectorAll("input").forEach((r=>{r.addEventListener("invalid",(r=>{this.handleInvalidInput(r)})),r.addEventListener("input",(()=>{r.setCustomValidity(""),r.reportValidity()}))}))}get host(){return s(this)}};l.style='/*!twlt*/.s-quick-order-expandable:not(.s-quick-order-shown){overflow:hidden}.has-error .s-form-label{color:#ff443a}.has-error .s-form-control,.has-error .s-tel-input-control,.has-error .s-datetime-picker-input{border-color:#ff443a;color:#ff443a}.s-form-control{display:block;width:100%;border-radius:var(--s-radius, 0.25rem);border-width:1px;--tw-border-opacity:1;border-color:rgb(209 213 219 / var(--tw-border-opacity, 1));--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1));padding:0.5rem;font-size:0.875rem;line-height:1.25rem;--tw-text-opacity:1;color:rgb(17 24 39 / var(--tw-text-opacity, 1))}.s-form-control:focus{border-color:var(--color-primary);--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000)}.s-form-label{margin-bottom:0.25rem;display:block;font-size:0.875rem;line-height:1.25rem;font-weight:500;--tw-text-opacity:1;color:rgb(17 24 39 / var(--tw-text-opacity, 1))}.s-form-group{margin-top:0.75rem;margin-bottom:0.75rem}.s-checkbox{cursor:pointer;--tw-border-opacity:1;border-color:rgb(209 213 219 / var(--tw-border-opacity, 1));appearance:none;background-color:#fff;margin:0;width:18px;height:18px;border-width:1px;border-radius:4px;display:grid;place-content:center}.s-checkbox:before{width:10px;height:10px;clip-path:polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);transform:scale(0);transform-origin:bottom left;transition:120ms transform ease-in-out;box-shadow:inset 1em 1em #444;background-color:#444}.s-checkbox:checked:before{transform:scale(1)}.s-checkbox::before{--tw-content:\'\';content:var(--tw-content)}.s-quick-order-dark h1,.s-quick-order-dark p{color:#fff}.s-quick-order-container{margin-top:0.5rem;margin-bottom:0.5rem;border-radius:var(--s-radius, 0.25rem);padding:1rem}.s-quick-order-button-cont{margin-top:0.5rem;margin-bottom:0.5rem;display:flex;justify-content:space-between}.s-quick-order-checkbox-container{margin-top:0.5rem;margin-bottom:0.5rem;display:flex}.s-quick-order-checkbox-container input{margin-bottom:0.5rem;margin-left:0.5rem;height:2.5rem;width:100%;border-radius:var(--s-radius, 0.25rem);border-width:1px;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1));padding:0.5rem}.s-quick-order-expandable{max-height:0px;opacity:0;transition-property:all;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:100ms;transition-timing-function:cubic-bezier(0, 0, 0.2, 1)}.s-quick-order-expandable:not(.s-quick-order-shown){overflow:hidden}.s-quick-order-expandable.s-quick-order-shown{opacity:1}.s-quick-order-expandable .s-form-group{position:relative;flex-grow:1}.s-quick-order-expandable .s-form-group input{padding-left:35px}.s-quick-order-expandable .s-form-group input:where([dir="rtl"],[dir="rtl"] *){padding-right:35px}.s-quick-order-expandable .s-form-group>span{position:absolute;left:10px;top:30%;z-index:10}.s-quick-order-expandable .s-form-group>span:where([dir="rtl"],[dir="rtl"] *){left:auto;right:10px}.s-quick-order-expandable .s-form-group span svg{height:1rem;width:1rem;fill:#919191}.s-quick-order-flex-input{display:flex}.s-quick-order-flex-input>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-right:calc(0.5rem * var(--tw-space-x-reverse));margin-left:calc(0.5rem * calc(1 - var(--tw-space-x-reverse)))}.s-quick-order-flex-input:where([dir="rtl"],[dir="rtl"] *)>:not([hidden])~:not([hidden]){--tw-space-x-reverse:1}.s-quick-order-flex-input salla-tel-input{height:2.5rem;width:100%}.s-quick-order-errors p{font-size:0.875rem;line-height:1.25rem;--tw-text-opacity:1;color:rgb(185 28 28 / var(--tw-text-opacity, 1))}.s-quick-order-confirm{display:flex;align-items:center;justify-content:center;border-radius:var(--s-radius, 0.25rem);border-width:1px;padding:0.5rem}.s-quick-order-confirm span{margin-left:0.5rem;margin-right:0.5rem}.s-quick-order-confirm svg{height:1rem;width:1rem;fill:var(--color-primary)}.s-quick-order-terms .s-form-label{margin-bottom:0px !important;cursor:pointer}.s-quick-order-terms{margin-bottom:1rem;display:flex;align-items:center;justify-content:flex-start}.s-quick-order-terms>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-right:calc(0.375rem * var(--tw-space-x-reverse));margin-left:calc(0.375rem * calc(1 - var(--tw-space-x-reverse)))}.s-quick-order-terms:where([dir="rtl"],[dir="rtl"] *)>:not([hidden])~:not([hidden]){--tw-space-x-reverse:1}.s-quick-order-terms .s-checkbox::before{background-color:transparent;content:var(--tw-content);--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}.s-quick-order-terms .s-checkbox:focus{outline:2px solid transparent;outline-offset:2px;--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000);--tw-ring-offset-width:0px}.s-quick-order-btn-close button{border-radius:var(--s-radius, 0.25rem);padding:0.5rem !important}.s-quick-order-phone-field:where([dir="ltr"],[dir="ltr"] *){padding-left:28px !important;padding-right:87px}.s-quick-order-phone-field:where([dir="rtl"],[dir="rtl"] *){padding-right:28px !important;padding-left:87px}.s-quick-order-email-field:where([dir="ltr"],[dir="ltr"] *){padding-right:0px !important}.s-quick-order-email-field:where([dir="rtl"],[dir="rtl"] *){padding-left:0px !important}';export{l as salla_quick_order}
4
+ import{r,c as t,h as e,H as i,a as s}from"./p-BsIeN-bg.js";import{I as o}from"./p-Z7udRKSZ.js";import{M as a}from"./p-DmgxDvXL.js";import{C as n}from"./p-BsLF_HK7.js";const l=class{constructor(e){r(this,e),this.quickOrderSubmited=t(this,"quickOrderSubmited"),this.quickOrderTitle="ليش تنتظر؟",this.subTitle="احصل على المنتج مباشرة الآن",this.payButtonTitle="اطلب المنتج",this.confirmPayButtonTitle="اشتر الآن",this.agreementText=salla.lang.get("pages.checkout.show_full_agreement"),this.isEmailRequired=!1,this.quickOrderStyle="default",this.isAvailable=!1,this.oneClick=!1,this.expanded=!1,this.isTermsRequired=!1,this.countryCode=salla.config.get("user.country_code","SA")||"SA",this.submitSucess=!1,this.placeHolderEmail=salla.lang.get("common.elements.email"),this.emailOptional=salla.lang.get("common.elements.optional"),this.agreementShowText=salla.lang.get("pages.checkout.show_full_agreement"),this.agreementModalHead=salla.lang.get("pages.checkout.full_agreement"),this.userNameLabel=salla.lang.get("pages.products.your_name"),this.termsChecked=!1,salla.onReady((()=>{this.productId=this.productId||salla.config.get("page.id")})),salla.lang.onLoaded((()=>{this.placeHolderEmail=salla.lang.get("common.elements.email"),this.emailOptional=salla.lang.get("common.elements.optional"),this.agreementShowText=salla.lang.get("pages.checkout.show_full_agreement"),this.agreementModalHead=salla.lang.get("pages.checkout.full_agreement"),this.userNameLabel=salla.lang.get("pages.products.your_name")}))}getBtnColor(){return"default"===this.quickOrderStyle?"light":"primary"}getErrorMessage(r,t){return"terms"==t?salla.lang.get("pages.checkout.check_agreement"):salla.lang.get(`common.errors.${r}`,{attribute:"name"==t?this.userNameLabel:this.placeHolderEmail})}handleInvalidInput(r){let t,e=r.target,i=e.validity;i.valueMissing?(t=this.getErrorMessage("field_required",e.name),console.log(this.getErrorMessage("field_required",e.name))):i.typeMismatch&&(t=this.getErrorMessage("invalid_value",e.name)),e.setCustomValidity(t)}async setWrapperHeight(){let r=this.host.querySelector(".s-quick-order-expandable");setTimeout((()=>{r.style.maxHeight=r.style.maxHeight||this.oneClick?null:r.scrollHeight+"px"}),50)}getDarkOrLight(){return"default"===this.quickOrderStyle&&salla.config.get("theme.color.is_dark")?"dark":"light"}getStyleColor(){return{gray:"#f3f3f3",white:"#ffffff",default:salla.config.get("theme.color.primary")}[this.quickOrderStyle]||"#f3f3f3"}async submit(r,t=!1){return r.preventDefault(),t&&!this.oneClick?(this.expanded=!this.expanded,void this.setWrapperHeight()):this.submitBtn.load().then((()=>this.getPayload())).then((r=>salla.api.cart.createQuickOrder(r))).then((()=>{setTimeout((()=>{this.submitBtn.stop(),this.submitSucess=!0,this.quickOrderSubmited.emit()}),200)})).catch((r=>r&&(console.error(r),this.submitBtn.stop())))}async getPayload(){return this.oneClick?{product_ids:[this.productId],agreement:!0}:{product_ids:[this.productId],email:this.emailInput?.value,phone:Number((await(this.phoneInput?.getValues()))?.phone),country_code:(await(this.phoneInput?.getValues()))?.countryCode||this.countryCode,name:this.nameInput?.value,agreement:this.termsChecked}}formatAgreementText(r,t=150){return r?r.length<=t?r:(new DOMParser).parseFromString(r,"text/html").documentElement.innerText.substring(0,t)+"...":""}loadQuickOrderSettings(){let r=salla.config.get("store.settings.quick_order");return r?(this.user=salla.config.get("user")||salla.storage.get("user")||{},this.countryCode=this.user?.country_code||this.countryCode,this.isEmailRequired=!this.user?.email&&this.isEmailRequired,this.oneClick=this.user?.email,this.initComponentData(r),Promise.resolve()):Promise.resolve()}initComponentData(r){this.quickOrderTitle=r.title,this.subTitle=r.sub_title,this.payButtonTitle=r.order_now_button,this.isEmailRequired=r.is_email_required,this.isTermsRequired=r.show_agreement,this.agreementText=r.agreement,this.confirmPayButtonTitle=r.confirm_button,this.thanksMessage=r.thanks_message,this.quickOrderStyle=r.style,this.isAvailable=!0,this.oneClick=this.oneClick&&!this.isTermsRequired}componentWillLoad(){return new Promise((r=>salla.onReady((()=>this.loadQuickOrderSettings().then(r)))))}render(){if(this.isAvailable)return this.submitSucess?e(i,{class:"s-quick-order"},e("div",{class:"s-quick-order-confirm",style:{backgroundColor:salla.config.get("theme.color.primary")+"10",borderColor:salla.config.get("theme.color.primary")+"10",color:salla.config.get("theme.color.primary")}},e("i",{innerHTML:'\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>party-horn</title>\n<path fill="currentColor" d="M5.333 4.013c0.736 0 1.333-0.596 1.333-1.333v-0.013c0-0.737-0.597-1.327-1.333-1.327s-1.333 0.603-1.333 1.34 0.597 1.333 1.333 1.333zM11.333 10c0.341 0 0.683-0.131 0.943-0.391 1.541-1.54 2.391-3.589 2.391-5.771v-2.505c0-0.737-0.597-1.333-1.333-1.333s-1.333 0.596-1.333 1.333v2.505c0 1.468-0.572 2.848-1.609 3.885-0.521 0.521-0.521 1.364 0 1.885 0.26 0.26 0.601 0.391 0.943 0.391zM18.667 9.993c0.319 0 0.639-0.115 0.895-0.345 0.383-0.347 0.684-0.325 1.497-0.22 0.923 0.124 2.319 0.307 3.636-0.887 1.293-1.172 1.303-2.54 1.308-3.539 0.005-0.887 0.043-1.228 0.432-1.581 0.361-0.327 0.621-0.335 1.493-0.216 0.923 0.12 2.317 0.307 3.635-0.884 0.545-0.495 0.587-1.337 0.093-1.883-0.493-0.547-1.336-0.589-1.884-0.093-0.361 0.325-0.621 0.333-1.493 0.216-0.921-0.119-2.317-0.305-3.635 0.884-1.293 1.173-1.303 2.541-1.308 3.54-0.005 0.885-0.043 1.227-0.432 1.58-0.383 0.348-0.683 0.327-1.497 0.22-0.924-0.124-2.32-0.305-3.636 0.887-0.545 0.495-0.587 1.339-0.092 1.884 0.264 0.291 0.625 0.437 0.988 0.437zM18.667 16.013c0.736 0 1.333-0.596 1.333-1.333v-0.013c0-0.737-0.597-1.327-1.333-1.327s-1.333 0.603-1.333 1.34 0.597 1.333 1.333 1.333zM30.667 17.333h-2.505c-2.179 0-4.228 0.849-5.771 2.391-0.521 0.521-0.521 1.364 0 1.885 0.26 0.26 0.603 0.391 0.944 0.391s0.683-0.131 0.943-0.391c1.023-1.023 2.439-1.609 3.884-1.609h2.505c0.736 0 1.333-0.596 1.333-1.333s-0.597-1.333-1.333-1.333zM30.667 10.66c-0.736 0-1.333 0.603-1.333 1.34s0.597 1.333 1.333 1.333 1.333-0.596 1.333-1.333v-0.013c0-0.736-0.597-1.327-1.333-1.327zM29.333 26.66c-0.736 0-1.333 0.603-1.333 1.34s0.597 1.333 1.333 1.333 1.333-0.596 1.333-1.333v-0.013c0-0.736-0.597-1.327-1.333-1.327zM7.456 11.057c-0.327-0.327-0.799-0.46-1.249-0.356-0.449 0.107-0.812 0.439-0.959 0.876l-5.036 15.113c-0.487 1.457-0.113 3.037 0.973 4.125 0.772 0.771 1.792 1.183 2.84 1.183 0.428 0 0.861-0.068 1.284-0.209l15.112-5.037c0.439-0.145 0.769-0.508 0.876-0.959 0.107-0.449-0.028-0.921-0.355-1.249zM4.467 29.259c-0.503 0.163-1.023 0.043-1.395-0.329-0.373-0.373-0.497-0.896-0.329-1.396l4.355-13.065 10.436 10.435z"></path>\n</svg>\n'}),e("span",null,this.thanksMessage))):e(i,{class:`s-quick-order s-quick-order-${this.getDarkOrLight()}`},e("div",{class:`s-quick-order-container s-quick-order-${this.quickOrderStyle}`,style:{backgroundColor:this.getStyleColor()}},e("div",{class:"s-quick-order-button-cont"},e("div",null,e("h3",null,this.quickOrderTitle),e("p",null,this.subTitle)),e("salla-button",{class:this.expanded?"s-quick-order-btn-close":"",onClick:r=>this.submit(r,!0),color:this.getBtnColor()},this.oneClick?this.confirmPayButtonTitle:this.expanded?e("i",{innerHTML:n}):this.confirmPayButtonTitle)),e("form",{onSubmit:r=>this.submit(r),class:"s-quick-order-expandable "+(this.expanded?"s-quick-order-shown":"")},Salla.config.isGuest()&&[e("div",{class:"s-form-group"},e("span",{innerHTML:'\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>portrait</title>\n<path d="M24 1.333h-16c-3.676 0-6.667 2.991-6.667 6.667v16c0 3.028 2.041 5.561 4.811 6.371 0.004 0.001 0.008 0.003 0.012 0.004 0.591 0.172 1.2 0.292 1.844 0.292h16c0.644 0 1.253-0.12 1.843-0.292 0.004-0.001 0.008-0.003 0.012-0.004 2.771-0.809 4.812-3.343 4.812-6.371v-16c0-3.676-2.991-6.667-6.667-6.667zM8.012 28c0.121-1.915 3.363-4 7.988-4s7.868 2.085 7.988 4zM28 24c0 1.24-0.579 2.335-1.467 3.069-0.768-3.288-5.112-5.736-10.533-5.736s-9.765 2.448-10.533 5.736c-0.888-0.735-1.467-1.829-1.467-3.069v-16c0-2.205 1.795-4 4-4h16c2.205 0 4 1.795 4 4zM16 6.667c-3.308 0-6 2.692-6 6s2.692 6 6 6 6-2.692 6-6-2.692-6-6-6zM16 16c-1.839 0-3.333-1.495-3.333-3.333s1.495-3.333 3.333-3.333 3.333 1.495 3.333 3.333-1.495 3.333-3.333 3.333z"></path>\n</svg>\n'}),e("input",{type:"text",required:!0,class:"s-form-control s-quick-order-phone-field",name:"name",placeholder:this.userNameLabel,ref:r=>this.nameInput=r})),e("div",{class:"s-quick-order-flex-input"},e("div",{class:"s-form-group"},e("span",{innerHTML:o}),e("salla-tel-input",{ref:r=>this.phoneInput=r})),e("div",{class:"s-form-group"},e("span",{innerHTML:a}),e("input",{type:"email",class:"s-form-control s-quick-order-email-field",name:"email",required:this.isEmailRequired,placeholder:this.placeHolderEmail+" "+(this.isEmailRequired?"":this.emailOptional),ref:r=>this.emailInput=r})))],this.isTermsRequired&&e("label",{htmlFor:"terms",class:"s-quick-order-terms"},e("input",{type:"checkbox",required:!0,name:"terms",id:"terms",ref:r=>this.termsInput=r,onChange:()=>this.termsChecked=this.termsInput.checked,class:"s-checkbox"}),e("span",{class:"s-form-label"}," ",e("div",{innerHTML:this.formatAgreementText(this.agreementText,150)},this.agreementText.length>150&&e("salla-button",{shape:"link",onClick:()=>this.agreementModal.open()},this.agreementShowText))," ")),e("salla-button",{type:"submit",color:this.getBtnColor(),width:"wide",ref:r=>this.submitBtn=r},this.payButtonTitle)),e("salla-modal",{"modal-title":this.agreementModalHead,ref:r=>this.agreementModal=r},e("article",{innerHTML:this.agreementText}))))}componentDidLoad(){this.host.querySelectorAll("input").forEach((r=>{r.addEventListener("invalid",(r=>{this.handleInvalidInput(r)})),r.addEventListener("input",(()=>{r.setCustomValidity(""),r.reportValidity()}))}))}get host(){return s(this)}};l.style='/*!twlt*/.s-quick-order-expandable:not(.s-quick-order-shown){overflow:hidden}.has-error .s-form-label{color:#ff443a}.has-error .s-form-control,.has-error .s-tel-input-control,.has-error .s-datetime-picker-input{border-color:#ff443a;color:#ff443a}.s-form-control{display:block;width:100%;border-radius:var(--s-radius, 0.25rem);border-width:1px;--tw-border-opacity:1;border-color:rgb(209 213 219 / var(--tw-border-opacity, 1));--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1));padding:0.5rem;font-size:0.875rem;line-height:1.25rem;--tw-text-opacity:1;color:rgb(17 24 39 / var(--tw-text-opacity, 1))}.s-form-control:focus{border-color:var(--color-primary);--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000)}.s-form-label{margin-bottom:0.25rem;display:block;font-size:0.875rem;line-height:1.25rem;font-weight:500;--tw-text-opacity:1;color:rgb(17 24 39 / var(--tw-text-opacity, 1))}.s-form-group{margin-top:0.75rem;margin-bottom:0.75rem}.s-checkbox{cursor:pointer;--tw-border-opacity:1;border-color:rgb(209 213 219 / var(--tw-border-opacity, 1));appearance:none;background-color:#fff;margin:0;width:18px;height:18px;border-width:1px;border-radius:4px;display:grid;place-content:center}.s-checkbox:before{width:10px;height:10px;clip-path:polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);transform:scale(0);transform-origin:bottom left;transition:120ms transform ease-in-out;box-shadow:inset 1em 1em #444;background-color:#444}.s-checkbox:checked:before{transform:scale(1)}.s-checkbox::before{--tw-content:\'\';content:var(--tw-content)}.s-quick-order-dark h1,.s-quick-order-dark p{color:#fff}.s-quick-order-container{margin-top:0.5rem;margin-bottom:0.5rem;border-radius:var(--s-radius, 0.25rem);padding:1rem}.s-quick-order-button-cont{margin-top:0.5rem;margin-bottom:0.5rem;display:flex;justify-content:space-between}.s-quick-order-checkbox-container{margin-top:0.5rem;margin-bottom:0.5rem;display:flex}.s-quick-order-checkbox-container input{margin-bottom:0.5rem;margin-left:0.5rem;height:2.5rem;width:100%;border-radius:var(--s-radius, 0.25rem);border-width:1px;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1));padding:0.5rem}.s-quick-order-expandable{max-height:0px;opacity:0;transition-property:all;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:100ms;transition-timing-function:cubic-bezier(0, 0, 0.2, 1)}.s-quick-order-expandable:not(.s-quick-order-shown){overflow:hidden}.s-quick-order-expandable.s-quick-order-shown{opacity:1}.s-quick-order-expandable .s-form-group{position:relative;flex-grow:1}.s-quick-order-expandable .s-form-group input{padding-left:35px}.s-quick-order-expandable .s-form-group input:where([dir="rtl"],[dir="rtl"] *){padding-right:35px}.s-quick-order-expandable .s-form-group>span{position:absolute;left:10px;top:30%;z-index:10}.s-quick-order-expandable .s-form-group>span:where([dir="rtl"],[dir="rtl"] *){left:auto;right:10px}.s-quick-order-expandable .s-form-group span svg{height:1rem;width:1rem;fill:#919191}.s-quick-order-flex-input{display:flex}.s-quick-order-flex-input>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-right:calc(0.5rem * var(--tw-space-x-reverse));margin-left:calc(0.5rem * calc(1 - var(--tw-space-x-reverse)))}.s-quick-order-flex-input:where([dir="rtl"],[dir="rtl"] *)>:not([hidden])~:not([hidden]){--tw-space-x-reverse:1}.s-quick-order-flex-input salla-tel-input{height:2.5rem;width:100%}.s-quick-order-errors p{font-size:0.875rem;line-height:1.25rem;--tw-text-opacity:1;color:rgb(185 28 28 / var(--tw-text-opacity, 1))}.s-quick-order-confirm{display:flex;align-items:center;justify-content:center;border-radius:var(--s-radius, 0.25rem);border-width:1px;padding:0.5rem}.s-quick-order-confirm span{margin-left:0.5rem;margin-right:0.5rem}.s-quick-order-confirm svg{height:1rem;width:1rem;fill:var(--color-primary)}.s-quick-order-terms .s-form-label{margin-bottom:0px !important;cursor:pointer}.s-quick-order-terms{margin-bottom:1rem;display:flex;align-items:center;justify-content:flex-start}.s-quick-order-terms>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-right:calc(0.375rem * var(--tw-space-x-reverse));margin-left:calc(0.375rem * calc(1 - var(--tw-space-x-reverse)))}.s-quick-order-terms:where([dir="rtl"],[dir="rtl"] *)>:not([hidden])~:not([hidden]){--tw-space-x-reverse:1}.s-quick-order-terms .s-checkbox::before{background-color:transparent;content:var(--tw-content);--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}.s-quick-order-terms .s-checkbox:focus{outline:2px solid transparent;outline-offset:2px;--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000);--tw-ring-offset-width:0px}.s-quick-order-btn-close button{border-radius:var(--s-radius, 0.25rem);padding:0.5rem !important}.s-quick-order-phone-field:where([dir="ltr"],[dir="ltr"] *){padding-left:28px !important;padding-right:87px}.s-quick-order-phone-field:where([dir="rtl"],[dir="rtl"] *){padding-right:28px !important;padding-left:87px}.s-quick-order-email-field:where([dir="ltr"],[dir="ltr"] *){padding-right:0px !important}.s-quick-order-email-field:where([dir="rtl"],[dir="rtl"] *){padding-left:0px !important}';export{l as salla_quick_order}
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r as a,h as t,H as s,a as e}from"./p-C0qiFNJn.js";const r=class{constructor(t){a(this,t),this.cashbackData=void 0,this.productId=null,this.handlePriceUpdated=(a,t)=>{if(String(t)!==String(this.productId))return;const s=a?.data?.cashback;void 0!==s&&(this.cashbackData=s)}}async componentWillLoad(){try{if(this.productId=this.host.dataset.productId||salla.config.get("page.id"),this.productId&&salla.event.on("product::price.updated",this.handlePriceUpdated),await salla.onReady(),await salla.lang.onLoaded(),!this.productId)return;const a=await salla.api.request(`/products/${this.productId}/cashback-offer`).catch((()=>null));void 0===this.cashbackData&&(this.cashbackData=a?.data??null)}catch(a){salla?.logger?.warn?.("salla-cashback-banner: init failed",a)}}disconnectedCallback(){salla.event.off("product::price.updated",this.handlePriceUpdated)}getPaymentMethodsText(a=[]){return a.map((a=>String(a||"").trim())).filter(Boolean).map((a=>salla.lang.get(`pages.checkout.${a}`)||a)).join(", ")}getCashbackMessage(){const a=this.cashbackData?.payment_method_restrictions?.included??[];return a.length?salla.lang.get("pages.loyalty_program.cashback_when_buying_product_payment_method",{payment_method:this.getPaymentMethodsText(a)}):salla.lang.get("pages.loyalty_program.cashback_when_buying_product")}render(){const a=this.cashbackData;if(!this.productId||!a||!Number(a.amount))return null;const e=a.amount,r=a.currency,n=this.getCashbackMessage(),i=a.offer_type;return t(s,null,t("div",{class:"s-cashback-banner-container"},t("div",{class:"s-cashback-banner-icon"},t("span",{class:"s-cashback-banner-inner-icon",innerHTML:'<svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg">\n<g clip-path="url(#clip0_5667_2008)">\n<path d="M9.00003 0.935974C9.37203 0.935974 9.72003 1.06797 10.044 1.33197C10.344 1.57197 10.596 1.90797 10.8 2.33997L12.114 5.00397C12.174 5.09997 12.27 5.19897 12.402 5.30097C12.534 5.40297 12.66 5.46597 12.78 5.48997L15.174 5.88597C15.618 5.95797 15.996 6.10197 16.308 6.31797C16.644 6.54597 16.869 6.83697 16.983 7.19097C17.097 7.54497 17.082 7.91397 16.938 8.29797C16.806 8.64597 16.578 8.98797 16.254 9.32397L14.4 11.196C14.316 11.28 14.247 11.409 14.193 11.583C14.139 11.757 14.13 11.91 14.166 12.042L14.688 14.364C14.808 14.88 14.832 15.342 14.76 15.75C14.676 16.206 14.475 16.551 14.157 16.785C13.839 17.019 13.452 17.106 12.996 17.046C12.588 16.998 12.156 16.836 11.7 16.56L9.45003 15.21C9.34203 15.15 9.19203 15.12 9.00003 15.12C8.80803 15.12 8.65803 15.15 8.55003 15.21L6.30003 16.56C5.84403 16.836 5.41203 16.998 5.00403 17.046C4.54803 17.106 4.16103 17.016 3.84303 16.776C3.52503 16.536 3.32403 16.194 3.24003 15.75C3.16803 15.342 3.19203 14.88 3.31203 14.364L3.83403 12.042C3.85803 11.91 3.84603 11.757 3.79803 11.583C3.75003 11.409 3.68403 11.28 3.60003 11.196L1.74603 9.32397C1.41003 8.98797 1.18203 8.64597 1.06203 8.29797C0.918027 7.91397 0.900027 7.54497 1.00803 7.19097C1.11603 6.83697 1.34403 6.54597 1.69203 6.31797C1.99203 6.10197 2.37003 5.95797 2.82603 5.88597L5.22003 5.48997C5.32803 5.46597 5.45103 5.40297 5.58903 5.30097C5.72703 5.19897 5.82003 5.09997 5.86803 5.00397L7.18203 2.33997C7.39803 1.90797 7.65603 1.57197 7.95603 1.33197C8.28003 1.06797 8.62803 0.935974 9.00003 0.935974Z" fill="white"/>\n</g>\n<defs>\n<clipPath id="clip0_5667_2008">\n<rect width="18" height="18" fill="white"/>\n</clipPath>\n</defs>\n</svg>\n'})),t("p",null,t("span",{class:"s-cashback-banner-label"},salla.lang.get("pages.loyalty_program.earn")," "),t("span",{class:"s-cashback-banner-value"},"percentage"===i?"+":"",e," ",["SAR","ر.س"].includes(r)?t("i",{class:"sicon-sar"}):r," "),t("span",{class:"s-cashback-banner-label"},n))))}get host(){return e(this)}};r.style="/*!twlt*/.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.s-cashback-banner-container{margin-bottom:0.75rem;display:flex;width:100%;align-items:center;gap:0.5rem;border-radius:0.5rem;background-color:rgb(46 16 101 / var(--tw-bg-opacity, 1));--tw-bg-opacity:0.1;padding-left:0.75rem;padding-right:0.75rem;padding-top:0.5rem;padding-bottom:0.5rem}.s-cashback-banner-icon{display:flex;height:2rem;width:2rem;flex-shrink:0;align-items:center;justify-content:center;border-radius:9999px;--tw-bg-opacity:1;background-color:rgb(46 16 101 / var(--tw-bg-opacity, 1))}.s-cashback-banner-label{font-size:0.875rem;line-height:1.25rem}.s-cashback-banner-value{font-size:0.875rem;line-height:1.25rem;font-weight:700;--tw-text-opacity:1;color:rgb(46 16 101 / var(--tw-text-opacity, 1))}";export{r as salla_cashback_banner}
4
+ import{r as a,h as t,H as s,a as e}from"./p-BsIeN-bg.js";const r=class{constructor(t){a(this,t),this.cashbackData=void 0,this.productId=null,this.handlePriceUpdated=(a,t)=>{if(String(t)!==String(this.productId))return;const s=a?.data?.cashback;void 0!==s&&(this.cashbackData=s)}}async componentWillLoad(){try{if(this.productId=this.host.dataset.productId||salla.config.get("page.id"),this.productId&&salla.event.on("product::price.updated",this.handlePriceUpdated),await salla.onReady(),await salla.lang.onLoaded(),!this.productId)return;const a=await salla.api.request(`/products/${this.productId}/cashback-offer`).catch((()=>null));void 0===this.cashbackData&&(this.cashbackData=a?.data??null)}catch(a){salla?.logger?.warn?.("salla-cashback-banner: init failed",a)}}disconnectedCallback(){salla.event.off("product::price.updated",this.handlePriceUpdated)}getPaymentMethodsText(a=[]){return a.map((a=>String(a||"").trim())).filter(Boolean).map((a=>salla.lang.get(`pages.checkout.${a}`)||a)).join(", ")}getCashbackMessage(){const a=this.cashbackData?.payment_method_restrictions?.included??[];return a.length?salla.lang.get("pages.loyalty_program.cashback_when_buying_product_payment_method",{payment_method:this.getPaymentMethodsText(a)}):salla.lang.get("pages.loyalty_program.cashback_when_buying_product")}render(){const a=this.cashbackData;if(!this.productId||!a||!Number(a.amount))return null;const e=a.amount,r=a.currency,n=this.getCashbackMessage(),i=a.offer_type;return t(s,null,t("div",{class:"s-cashback-banner-container"},t("div",{class:"s-cashback-banner-icon"},t("span",{class:"s-cashback-banner-inner-icon",innerHTML:'<svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg">\n<g clip-path="url(#clip0_5667_2008)">\n<path d="M9.00003 0.935974C9.37203 0.935974 9.72003 1.06797 10.044 1.33197C10.344 1.57197 10.596 1.90797 10.8 2.33997L12.114 5.00397C12.174 5.09997 12.27 5.19897 12.402 5.30097C12.534 5.40297 12.66 5.46597 12.78 5.48997L15.174 5.88597C15.618 5.95797 15.996 6.10197 16.308 6.31797C16.644 6.54597 16.869 6.83697 16.983 7.19097C17.097 7.54497 17.082 7.91397 16.938 8.29797C16.806 8.64597 16.578 8.98797 16.254 9.32397L14.4 11.196C14.316 11.28 14.247 11.409 14.193 11.583C14.139 11.757 14.13 11.91 14.166 12.042L14.688 14.364C14.808 14.88 14.832 15.342 14.76 15.75C14.676 16.206 14.475 16.551 14.157 16.785C13.839 17.019 13.452 17.106 12.996 17.046C12.588 16.998 12.156 16.836 11.7 16.56L9.45003 15.21C9.34203 15.15 9.19203 15.12 9.00003 15.12C8.80803 15.12 8.65803 15.15 8.55003 15.21L6.30003 16.56C5.84403 16.836 5.41203 16.998 5.00403 17.046C4.54803 17.106 4.16103 17.016 3.84303 16.776C3.52503 16.536 3.32403 16.194 3.24003 15.75C3.16803 15.342 3.19203 14.88 3.31203 14.364L3.83403 12.042C3.85803 11.91 3.84603 11.757 3.79803 11.583C3.75003 11.409 3.68403 11.28 3.60003 11.196L1.74603 9.32397C1.41003 8.98797 1.18203 8.64597 1.06203 8.29797C0.918027 7.91397 0.900027 7.54497 1.00803 7.19097C1.11603 6.83697 1.34403 6.54597 1.69203 6.31797C1.99203 6.10197 2.37003 5.95797 2.82603 5.88597L5.22003 5.48997C5.32803 5.46597 5.45103 5.40297 5.58903 5.30097C5.72703 5.19897 5.82003 5.09997 5.86803 5.00397L7.18203 2.33997C7.39803 1.90797 7.65603 1.57197 7.95603 1.33197C8.28003 1.06797 8.62803 0.935974 9.00003 0.935974Z" fill="white"/>\n</g>\n<defs>\n<clipPath id="clip0_5667_2008">\n<rect width="18" height="18" fill="white"/>\n</clipPath>\n</defs>\n</svg>\n'})),t("p",null,t("span",{class:"s-cashback-banner-label"},salla.lang.get("pages.loyalty_program.earn")," "),t("span",{class:"s-cashback-banner-value"},"percentage"===i?"+":"",e," ",["SAR","ر.س"].includes(r)?t("i",{class:"sicon-sar"}):r," "),t("span",{class:"s-cashback-banner-label"},n))))}get host(){return e(this)}};r.style="/*!twlt*/.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.s-cashback-banner-container{margin-bottom:0.75rem;display:flex;width:100%;align-items:center;gap:0.5rem;border-radius:0.5rem;background-color:rgb(46 16 101 / var(--tw-bg-opacity, 1));--tw-bg-opacity:0.1;padding-left:0.75rem;padding-right:0.75rem;padding-top:0.5rem;padding-bottom:0.5rem}.s-cashback-banner-icon{display:flex;height:2rem;width:2rem;flex-shrink:0;align-items:center;justify-content:center;border-radius:9999px;--tw-bg-opacity:1;background-color:rgb(46 16 101 / var(--tw-bg-opacity, 1))}.s-cashback-banner-label{font-size:0.875rem;line-height:1.25rem}.s-cashback-banner-value{font-size:0.875rem;line-height:1.25rem;font-weight:700;--tw-text-opacity:1;color:rgb(46 16 101 / var(--tw-text-opacity, 1))}";export{r as salla_cashback_banner}
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r as t,h as o,H as r,a}from"./p-C0qiFNJn.js";const s=class{constructor(o){t(this,o),this.availableCoupons=[],this.cartTotal=0,this.cartTotalReady=!1,this.currentCoupon="",this.couponInputValue="",this.couponError="",this.isApplying=!1,this.appliedCoupons=[],this.multiCoupon=!1,this.isHandlingInternalError=!1,this.cartUpdatedHandler=t=>{this.syncCartTotal(t),(this.multiCoupon?Array.isArray(t?.coupons):t&&"coupon"in t)&&this.syncAppliedFromCart(t),this.couponError=""},this.couponAddedHandler=()=>{this.isApplying||this.isHandlingInternalError||this.refreshFromServer()},this.couponAdditionFailedHandler=t=>{this.isApplying||this.isHandlingInternalError||this.showCouponError(t?.message||salla.lang.get("pages.cart.coupon_application_error"))},this.couponDeletedHandler=()=>{this.isApplying||this.isHandlingInternalError||this.refreshFromServer()},this.onKeyUp=t=>{"Enter"===t.key&&this.couponButtonRef?.click(),this.couponError=""},this.onInput=t=>{this.couponInputValue=t.target.value}}async componentWillLoad(){await Salla.onReady(),await Salla.lang.onLoaded(),this.multiCoupon=!!salla.config.get("store.settings.cart.multi_coupon"),this.loadCouponsData(),this.seedFromStorage(),this.loadCartTotal(),this.setupCartEventListeners()}setupCartEventListeners(){salla.event.on("cart::updated",this.cartUpdatedHandler),salla.event.on("cart::coupon.added",this.couponAddedHandler),salla.event.on("cart::coupon.addition.failed",this.couponAdditionFailedHandler),salla.event.on("cart::coupon.deleted",this.couponDeletedHandler)}disconnectedCallback(){salla.event.off("cart::updated",this.cartUpdatedHandler),salla.event.off("cart::coupon.added",this.couponAddedHandler),salla.event.off("cart::coupon.addition.failed",this.couponAdditionFailedHandler),salla.event.off("cart::coupon.deleted",this.couponDeletedHandler)}async selectCoupon(t){const o=this.availableCoupons.find((o=>o.code===t));if(o){if(!this.isEligible(o))throw new Error("Coupon not eligible: minimum cart amount not met");try{await this.applyCoupon(t),this.host.dispatchEvent(new CustomEvent("salla::cart-coupons.coupon.selected",{detail:o,bubbles:!0}))}catch(t){throw t}}return o}async loadCouponsData(){try{const t=await salla.api.request("coupons"),o=t?.data,r=Array.isArray(o)?o:Array.isArray(o?.data)?o.data:[];this.availableCoupons=r}catch(t){console.warn("Failed to load coupons:",t),this.availableCoupons=[]}}async loadCartTotal(){await this.refreshFromServer()}seedFromStorage(){if(this.multiCoupon)return;const t=salla.storage.get("cart");t&&"object"==typeof t&&"coupon"in t&&this.applyCart(t),this.seedTotalsFromSummaryStorage()}seedTotalsFromSummaryStorage(){const t=salla.storage.get("cart.summary");t&&"object"==typeof t&&null!=t.sub_total&&(this.cartTotal=Number(t.sub_total),this.cartTotalReady=!0)}syncCartTotal(t){const o=t?.summary?.sub_total??t?.sub_total??t?.total;null!=o&&(this.cartTotal=Number(o),this.cartTotalReady=!0)}async refreshFromServer(){try{const t=await salla.cart.details(),o=t?.data?.cart??t?.data??t;if(o&&"object"==typeof o&&(Array.isArray(o.coupons)||"coupon"in o))return void this.applyCart(o)}catch(t){}const t=salla.storage.get("cart");t&&this.applyCart(t),this.seedTotalsFromSummaryStorage()}applyCart(t){this.syncCartTotal(t),this.syncAppliedFromCart(t)}syncAppliedFromCart(t){this.currentCoupon=t?.coupon||"",this.multiCoupon?this.appliedCoupons=Array.isArray(t?.coupons)?t.coupons.filter(Boolean):this.currentCoupon?[this.currentCoupon]:[]:(this.couponInputValue=this.currentCoupon,this.appliedCoupons=this.currentCoupon?[this.currentCoupon]:[])}async handleApplyClick(){if(this.isApplying)return;const t=this.couponInputValue.trim();if(t){this.isApplying=!0,this.isHandlingInternalError=!0;try{await salla.cart.addCoupon(t),await this.refreshFromServer(),this.couponInputValue=""}catch(t){this.showCouponError(t.response?.data?.error?.message||salla.lang.get("pages.cart.coupon_application_error"))}finally{this.isApplying=!1,setTimeout((()=>{this.isHandlingInternalError=!1}),100)}}else this.showCouponError(salla.lang.get("pages.cart.enter_coupon_code"))}async handleCouponButtonClick(){if(this.isApplying)return;const t=!!this.currentCoupon;if(t||this.couponInputValue.trim()){this.isApplying=!0,this.isHandlingInternalError=!0;try{t?await salla.cart.deleteCoupon():await salla.cart.addCoupon(this.couponInputValue.trim()),await this.refreshFromServer()}catch(t){this.showCouponError(t.response?.data?.error?.message||salla.lang.get("pages.cart.coupon_application_error"))}finally{this.isApplying=!1,setTimeout((()=>{this.isHandlingInternalError=!1}),100)}}else this.showCouponError(salla.lang.get("pages.cart.enter_coupon_code"))}async removeCoupon(t){if(!this.isApplying){this.isApplying=!0,this.isHandlingInternalError=!0;try{this.multiCoupon?await salla.cart.deleteCoupon(t):await salla.cart.deleteCoupon(),await this.refreshFromServer()}catch(t){this.showCouponError(t.response?.data?.error?.message||salla.lang.get("pages.cart.coupon_application_error"))}finally{this.isApplying=!1,setTimeout((()=>{this.isHandlingInternalError=!1}),100)}}}showCouponError(t){this.couponError=t}handleCouponClick(t){this.applyCoupon(t.code,!1).catch((()=>{}))}async applyCoupon(t,o=!0){if(this.isApplying){if(o)throw new Error("Coupon application already in progress")}else{this.couponInputValue=t,this.couponError="",this.isApplying=!0,this.isHandlingInternalError=!0;try{await salla.cart.addCoupon(t.trim()),await this.refreshFromServer(),this.multiCoupon&&(this.couponInputValue="")}catch(t){if(this.showCouponError(t.response?.data?.error?.message||salla.lang.get("pages.cart.coupon_application_error")),o)throw t}finally{this.isApplying=!1,setTimeout((()=>{this.isHandlingInternalError=!1}),100)}}}formatMainAmount(t){if("percentage"===t.type)return`${salla.helpers.number("object"==typeof t.amount?t.amount.amount:t.amount)}%`;{const r="object"==typeof t.amount?t.amount:{amount:t.amount,currency:t.minimum_amount?.currency||salla.config.get("store.currency.code","SAR")};return o("span",{innerHTML:salla.money(r.amount,r.currency)})}}isEligible(t){return!this.cartTotalReady||!t.minimum_amount||this.cartTotal>=parseFloat(t.minimum_amount.amount)}renderCouponCard(t){const r=this.isEligible(t);return o("div",{class:"s-cart-coupons-slide-one-fourth swiper-slide"},o("div",{class:"s-cart-coupons-card "+(!r||this.isApplying?"s-cart-coupons-disabled":""),onClick:()=>r&&!this.isApplying&&this.handleCouponClick(t)},o("div",{class:"s-cart-coupons-top-section"},o("div",{class:"s-cart-coupons-discount-values"},o("div",{class:"s-cart-coupons-main-amount"},this.formatMainAmount(t)),t.free_shipping?o("div",{class:"s-cart-coupons-secondary-info"},"+ ",salla.lang.get("pages.cart.free_shipping")):t.maximum_amount&&o("div",{class:"s-cart-coupons-secondary-info"},salla.lang.get("pages.cart.up_to")," ",o("span",{innerHTML:salla.money(t.maximum_amount.amount,t.maximum_amount.currency)}))),o("div",{class:"s-cart-coupons-code"},t.code)),o("div",{class:"s-cart-coupons-divider"}),o("div",{class:"s-cart-coupons-bottom-section"},o("div",{class:"s-cart-coupons-terms"},null!=t.remaining_days&&o("div",{class:"s-cart-coupons-expiry "+(t.remaining_days<=3?"s-cart-coupons-expiry-warning":"")},0===t.remaining_days?salla.lang.get("pages.cart.expires_today"):`${salla.lang.get("pages.cart.expires_after")} ${t.remaining_days} ${salla.lang.get("pages.cart.day")}`),t.minimum_amount&&parseFloat(t.minimum_amount.amount)>0&&o("div",{class:"s-cart-coupons-minimum"},salla.lang.get("pages.cart.minimum")," ",o("span",{innerHTML:salla.money(t.minimum_amount.amount,t.minimum_amount.currency)}))),o("div",{class:"s-cart-coupons-action"},r?salla.lang.get("pages.cart.save_coupon"):salla.lang.get("pages.cart.coupon_not_compatible")))))}render(){return o(r,{key:"e3bed8f1f2019db5e1c5ca4280696933913e3081"},o("div",{key:"9c6a7c383394f9bd19107db9b8e76fd9129648e3",class:"s-cart-coupons-wrapper"},o("div",{key:"1e7f74969e709062c36aa19ff4ec27bde0bb10df",class:"s-cart-coupons-input-section"},o("label",{key:"f3bc1f4ffa9c8a64bee8af273597d6f8ff1f8fd0",htmlFor:"coupon-input",class:"s-cart-coupons-coupon-label"},salla.lang.get("pages.cart.have_coupon")),o("div",{key:"7abbdbd41cf6e65b6c08928bb10a68bfb2677d85",class:"s-cart-coupons-coupon-input-container"},this.multiCoupon?[o("input",{type:"text",id:"coupon-input",name:"coupon",class:"form-input "+(this.couponError?"s-coupon-input-error":""),placeholder:salla.lang.get("pages.cart.coupon_placeholder"),value:this.couponInputValue,disabled:this.isApplying,onInput:this.onInput,onKeyUp:this.onKeyUp,"aria-label":salla.lang.get("pages.cart.apply_coupon"),key:"coupon-input"}),o("salla-button",{ref:t=>this.couponButtonRef=t,class:"s-cart-coupons-coupon-button s-cart-coupons-coupon-button-apply",color:"primary",loading:this.isApplying,"loader-position":"center",onClick:()=>this.handleApplyClick(),key:"apply-button"},o("span",null,salla.lang.get("pages.cart.save_coupon")))]:[o("input",{type:"text",id:"coupon-input",name:"coupon",class:"form-input "+(this.couponError?"s-coupon-input-error":""),placeholder:salla.lang.get("pages.cart.coupon_placeholder"),value:this.couponInputValue,disabled:!!this.currentCoupon||this.isApplying,onInput:this.onInput,onKeyUp:this.onKeyUp,"aria-label":salla.lang.get("pages.cart.apply_coupon"),key:"coupon-input"}),o("salla-button",{ref:t=>this.couponButtonRef=t,class:"s-cart-coupons-coupon-button "+(this.currentCoupon?"s-cart-coupons-coupon-button-remove":"s-cart-coupons-coupon-button-apply"),color:this.currentCoupon?"danger":"primary",loading:this.isApplying,"loader-position":"center",onClick:()=>this.handleCouponButtonClick(),key:"apply-button"},this.currentCoupon?o("i",{class:"sicon-cancel"}):o("span",null,salla.lang.get("pages.cart.save_coupon")))]),this.couponError&&o("span",{key:"6c259fbca7a2a3c2ece3d4c335707c833be5f8d6",class:"s-cart-coupons-coupon-error"},this.couponError),this.multiCoupon&&this.appliedCoupons.length>0&&o("div",{key:"87335fd875279e97fc7a02c9f3519af51a953a7b",class:"s-cart-coupons-applied-list"},this.appliedCoupons.map((t=>o("div",{class:"s-cart-coupons-applied-item",key:t},o("span",{class:"s-cart-coupons-applied-code"},t),o("button",{type:"button",class:"s-cart-coupons-applied-remove","aria-label":`${salla.lang.get("pages.cart.delete")} ${t}`,disabled:this.isApplying,onClick:()=>this.removeCoupon(t)},o("i",{class:"sicon-cancel"}))))))),this.availableCoupons&&this.availableCoupons.length>0&&o("salla-slider",{key:"86c665d3135fa8bc393c4b7ad9daca3ce87bed50",type:"carousel",showControls:!1,class:"s-cart-coupons-slider"},o("div",{key:"45ddccd7e0c5d38e9b98f42862a6d64f6040c942",slot:"items"},this.availableCoupons.map((t=>this.renderCouponCard(t)))))))}get host(){return a(this)}};s.style='/*!twlt*/.s-cart-coupons-applied-list{display:flex;flex-direction:column;gap:8px;margin-top:12px}.s-cart-coupons-applied-item{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:10px 12px;background:#fff;border:1px solid #e5e7eb;border-radius:10px;border-inline-start:3px solid #10b981}.s-cart-coupons-applied-code{display:inline-flex;align-items:center;gap:6px;font-size:13px;font-weight:700;color:#111827}.s-cart-coupons-applied-code::before{content:"";width:7px;height:7px;border-radius:9999px;background:#10b981}.s-cart-coupons-applied-remove{display:inline-flex;align-items:center;justify-content:center;width:26px;height:26px;color:#ef4444;background:transparent;border:0;border-radius:9999px;cursor:pointer;transition:background-color 0.15s ease, color 0.15s ease}.s-cart-coupons-applied-remove:hover{background:#fef2f2}.s-cart-coupons-applied-remove:disabled{opacity:0.5;cursor:not-allowed}.visible{visibility:visible}.fixed{position:fixed}.shrink{flex-shrink:1}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.form-input{height:2.5rem;width:100%;border-radius:0.375rem;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1));transition-property:color, background-color, border-color, text-decoration-color, fill, stroke;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:300ms}.form-input:focus{border-color:var(--color-primary);--tw-ring-color:transparent}.form-input:is(.dark *){--tw-border-opacity:1;border-color:rgb(75 85 99 / var(--tw-border-opacity, 1));--tw-bg-opacity:1;background-color:rgb(75 85 99 / var(--tw-bg-opacity, 1))}.form-input:focus:is(.dark *){border-color:var(--color-primary)}@media (min-width: 640px){.form-input{font-size:0.875rem;line-height:1.25rem}}.s-cart-coupons-wrapper{display:block;width:100%;padding-top:1.25rem;padding-bottom:1.25rem}.s-cart-coupons-input-section{margin-bottom:0.625rem}.s-cart-coupons-coupon-label{margin-bottom:0.625rem;display:block;font-size:0.875rem;line-height:1.25rem;--tw-text-opacity:1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.s-cart-coupons-coupon-input-container{position:relative;display:flex;align-items:stretch}.s-cart-coupons-coupon-input-container .form-input{height:auto;flex:1 1 0%}.s-cart-coupons-coupon-input-container .form-input:where([dir="ltr"],[dir="ltr"] *){border-top-left-radius:0.5rem;border-bottom-left-radius:0.5rem;border-top-right-radius:0px !important;border-bottom-right-radius:0px !important;border-right-width:0px}.s-cart-coupons-coupon-input-container .form-input:where([dir="rtl"],[dir="rtl"] *){border-top-right-radius:0.5rem;border-bottom-right-radius:0.5rem;border-top-left-radius:0px !important;border-bottom-left-radius:0px !important;border-left-width:0px}.s-cart-coupons-coupon-input-container .form-input:focus{position:relative;z-index:10}.s-cart-coupons-coupon-button:where([dir="ltr"],[dir="ltr"] *){border-top-right-radius:0.5rem;border-bottom-right-radius:0.5rem;border-top-left-radius:0px;border-bottom-left-radius:0px}.s-cart-coupons-coupon-button:where([dir="rtl"],[dir="rtl"] *){border-top-left-radius:0.5rem;border-bottom-left-radius:0.5rem;border-top-right-radius:0px;border-bottom-right-radius:0px}.s-cart-coupons-coupon-button-remove:where([dir="ltr"],[dir="ltr"] *){border-top-right-radius:0.5rem;border-bottom-right-radius:0.5rem;border-top-left-radius:0px !important;border-bottom-left-radius:0px !important}.s-cart-coupons-coupon-button-remove:where([dir="rtl"],[dir="rtl"] *){border-top-left-radius:0.5rem;border-bottom-left-radius:0.5rem;border-top-right-radius:0px !important;border-bottom-right-radius:0px !important}.s-cart-coupons-coupon-button-apply:where([dir="ltr"],[dir="ltr"] *){border-top-right-radius:0.5rem !important;border-bottom-right-radius:0.5rem !important;border-top-left-radius:0px !important;border-bottom-left-radius:0px !important}.s-cart-coupons-coupon-button-apply:where([dir="rtl"],[dir="rtl"] *){border-top-left-radius:0.5rem !important;border-bottom-left-radius:0.5rem !important;border-top-right-radius:0px !important;border-bottom-right-radius:0px !important}.s-cart-coupons-coupon-error{margin-top:0.5rem;display:block;font-size:10px;line-height:1rem;--tw-text-opacity:1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.s-cart-coupons-slider{width:100%;overflow:hidden;padding-left:0.375rem;padding-right:0.375rem}.s-cart-coupons-card{position:relative;cursor:pointer;overflow:hidden;--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1));transition-property:all;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:300ms}.s-cart-coupons-card:is(.dark *){--tw-bg-opacity:1;background-color:rgb(31 41 55 / var(--tw-bg-opacity, 1))}.s-cart-coupons-card:hover{--tw-translate-y:-0.125rem;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.s-cart-coupons-disabled{cursor:not-allowed;opacity:0.5}.s-cart-coupons-disabled:hover{transform:none;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1));--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}.s-cart-coupons-top-section{display:flex;height:60px;flex-direction:row;align-items:center;justify-content:space-between;border-top-left-radius:0.75rem;border-top-right-radius:0.75rem;border-width:1px;border-bottom-width:0px;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1));padding-top:1rem;padding-bottom:1rem;padding-left:0.75rem;padding-right:0.75rem}.s-cart-coupons-discount-values{display:flex;flex-direction:column;align-items:flex-start}.s-cart-coupons-discount-values .s-cart-coupons-main-amount{display:flex;align-items:center;gap:0.25rem;white-space:nowrap;font-size:1.25rem;line-height:1.75rem;font-weight:900;line-height:1;--tw-text-opacity:1;color:rgb(0 0 0 / var(--tw-text-opacity, 1))}.s-cart-coupons-discount-values .s-cart-coupons-secondary-info{margin:0px;font-size:10px;line-height:1rem}.s-cart-coupons-code{font-size:10px;font-weight:700;--tw-text-opacity:1;color:rgb(17 24 39 / var(--tw-text-opacity, 1))}.s-cart-coupons-divider{position:relative;z-index:10;margin:0px;border-bottom-width:1px;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1))}.s-cart-coupons-bottom-section{display:flex;min-height:44px;flex-direction:row;align-items:center;justify-content:space-between;border-bottom-right-radius:0.75rem;border-bottom-left-radius:0.75rem;border-width:1px;border-top-width:0px;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1));--tw-bg-opacity:1;background-color:rgb(249 250 251 / var(--tw-bg-opacity, 1));padding-top:0.25rem;padding-bottom:0.25rem;padding-left:0.75rem;padding-right:0.75rem}.s-cart-coupons-terms{display:flex;flex-direction:column;align-items:flex-start}.s-cart-coupons-terms .s-cart-coupons-expiry{margin:0px;font-size:10px;line-height:16px;--tw-text-opacity:1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.s-cart-coupons-terms .s-cart-coupons-minimum{margin:0px;font-size:10px;line-height:16px;--tw-text-opacity:1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.s-cart-coupons-terms .s-cart-coupons-expiry.s-cart-coupons-expiry-warning{font-weight:500;--tw-text-opacity:1;color:rgb(220 38 38 / var(--tw-text-opacity, 1))}.s-cart-coupons-action{cursor:pointer;white-space:nowrap;border-width:0px;background-color:transparent;padding:0px;font-size:9px;font-weight:700;--tw-text-opacity:1;color:rgb(17 24 39 / var(--tw-text-opacity, 1));transition-property:color, background-color, border-color, text-decoration-color, fill, stroke;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms}.s-cart-coupons-action:hover{--tw-text-opacity:1;color:rgb(59 130 246 / var(--tw-text-opacity, 1))}.s-cart-coupons-slide-one-fourth{width:calc(75% - 10px);min-width:200px !important;padding-left:5px !important;padding-right:5px !important;padding-top:2px !important}@media (min-width: 1024px){.s-cart-coupons-slide-one-fourth{width:calc(40% - 10px) !important}}.s-cart-coupons-card:before{pointer-events:none;position:absolute;right:-10px;top:60px;z-index:20;height:1.25rem;width:1.25rem;--tw-translate-y:-50%;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));border-radius:9999px;border-width:1px;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1));--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1));--tw-content:\'\';content:var(--tw-content)}.s-cart-coupons-card:is(.dark *):before{--tw-bg-opacity:1;background-color:rgb(31 41 55 / var(--tw-bg-opacity, 1))}.s-cart-coupons-card:after{pointer-events:none;position:absolute;left:-10px;top:60px;z-index:20;height:1.25rem;width:1.25rem;--tw-translate-y:-50%;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));border-radius:9999px;border-width:1px;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1));--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1));--tw-content:\'\';content:var(--tw-content)}.s-cart-coupons-card:is(.dark *):after{--tw-bg-opacity:1;background-color:rgb(31 41 55 / var(--tw-bg-opacity, 1))}.s-cart-coupons-coupon-input-container .form-input.s-coupon-input-error{--tw-shadow:0 0 0 3px rgba(239,68,68,0.1) !important;--tw-shadow-colored:0 0 0 3px var(--tw-shadow-color) !important;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow) !important}';export{s as salla_cart_coupons}
4
+ import{r as t,h as o,H as r,a}from"./p-BsIeN-bg.js";const s=class{constructor(o){t(this,o),this.availableCoupons=[],this.cartTotal=0,this.cartTotalReady=!1,this.currentCoupon="",this.couponInputValue="",this.couponError="",this.isApplying=!1,this.appliedCoupons=[],this.multiCoupon=!1,this.isHandlingInternalError=!1,this.cartUpdatedHandler=t=>{this.syncCartTotal(t),(this.multiCoupon?Array.isArray(t?.coupons):t&&"coupon"in t)&&this.syncAppliedFromCart(t),this.couponError=""},this.couponAddedHandler=()=>{this.isApplying||this.isHandlingInternalError||this.refreshFromServer()},this.couponAdditionFailedHandler=t=>{this.isApplying||this.isHandlingInternalError||this.showCouponError(t?.message||salla.lang.get("pages.cart.coupon_application_error"))},this.couponDeletedHandler=()=>{this.isApplying||this.isHandlingInternalError||this.refreshFromServer()},this.onKeyUp=t=>{"Enter"===t.key&&this.couponButtonRef?.click(),this.couponError=""},this.onInput=t=>{this.couponInputValue=t.target.value}}async componentWillLoad(){await Salla.onReady(),await Salla.lang.onLoaded(),this.multiCoupon=!!salla.config.get("store.settings.cart.multi_coupon"),this.loadCouponsData(),this.seedFromStorage(),this.loadCartTotal(),this.setupCartEventListeners()}setupCartEventListeners(){salla.event.on("cart::updated",this.cartUpdatedHandler),salla.event.on("cart::coupon.added",this.couponAddedHandler),salla.event.on("cart::coupon.addition.failed",this.couponAdditionFailedHandler),salla.event.on("cart::coupon.deleted",this.couponDeletedHandler)}disconnectedCallback(){salla.event.off("cart::updated",this.cartUpdatedHandler),salla.event.off("cart::coupon.added",this.couponAddedHandler),salla.event.off("cart::coupon.addition.failed",this.couponAdditionFailedHandler),salla.event.off("cart::coupon.deleted",this.couponDeletedHandler)}async selectCoupon(t){const o=this.availableCoupons.find((o=>o.code===t));if(o){if(!this.isEligible(o))throw new Error("Coupon not eligible: minimum cart amount not met");try{await this.applyCoupon(t),this.host.dispatchEvent(new CustomEvent("salla::cart-coupons.coupon.selected",{detail:o,bubbles:!0}))}catch(t){throw t}}return o}async loadCouponsData(){try{const t=await salla.api.request("coupons"),o=t?.data,r=Array.isArray(o)?o:Array.isArray(o?.data)?o.data:[];this.availableCoupons=r}catch(t){console.warn("Failed to load coupons:",t),this.availableCoupons=[]}}async loadCartTotal(){await this.refreshFromServer()}seedFromStorage(){if(this.multiCoupon)return;const t=salla.storage.get("cart");t&&"object"==typeof t&&"coupon"in t&&this.applyCart(t),this.seedTotalsFromSummaryStorage()}seedTotalsFromSummaryStorage(){const t=salla.storage.get("cart.summary");t&&"object"==typeof t&&null!=t.sub_total&&(this.cartTotal=Number(t.sub_total),this.cartTotalReady=!0)}syncCartTotal(t){const o=t?.summary?.sub_total??t?.sub_total??t?.total;null!=o&&(this.cartTotal=Number(o),this.cartTotalReady=!0)}async refreshFromServer(){try{const t=await salla.cart.details(),o=t?.data?.cart??t?.data??t;if(o&&"object"==typeof o&&(Array.isArray(o.coupons)||"coupon"in o))return void this.applyCart(o)}catch(t){}const t=salla.storage.get("cart");t&&this.applyCart(t),this.seedTotalsFromSummaryStorage()}applyCart(t){this.syncCartTotal(t),this.syncAppliedFromCart(t)}syncAppliedFromCart(t){this.currentCoupon=t?.coupon||"",this.multiCoupon?this.appliedCoupons=Array.isArray(t?.coupons)?t.coupons.filter(Boolean):this.currentCoupon?[this.currentCoupon]:[]:(this.couponInputValue=this.currentCoupon,this.appliedCoupons=this.currentCoupon?[this.currentCoupon]:[])}async handleApplyClick(){if(this.isApplying)return;const t=this.couponInputValue.trim();if(t){this.isApplying=!0,this.isHandlingInternalError=!0;try{await salla.cart.addCoupon(t),await this.refreshFromServer(),this.couponInputValue=""}catch(t){this.showCouponError(t.response?.data?.error?.message||salla.lang.get("pages.cart.coupon_application_error"))}finally{this.isApplying=!1,setTimeout((()=>{this.isHandlingInternalError=!1}),100)}}else this.showCouponError(salla.lang.get("pages.cart.enter_coupon_code"))}async handleCouponButtonClick(){if(this.isApplying)return;const t=!!this.currentCoupon;if(t||this.couponInputValue.trim()){this.isApplying=!0,this.isHandlingInternalError=!0;try{t?await salla.cart.deleteCoupon():await salla.cart.addCoupon(this.couponInputValue.trim()),await this.refreshFromServer()}catch(t){this.showCouponError(t.response?.data?.error?.message||salla.lang.get("pages.cart.coupon_application_error"))}finally{this.isApplying=!1,setTimeout((()=>{this.isHandlingInternalError=!1}),100)}}else this.showCouponError(salla.lang.get("pages.cart.enter_coupon_code"))}async removeCoupon(t){if(!this.isApplying){this.isApplying=!0,this.isHandlingInternalError=!0;try{this.multiCoupon?await salla.cart.deleteCoupon(t):await salla.cart.deleteCoupon(),await this.refreshFromServer()}catch(t){this.showCouponError(t.response?.data?.error?.message||salla.lang.get("pages.cart.coupon_application_error"))}finally{this.isApplying=!1,setTimeout((()=>{this.isHandlingInternalError=!1}),100)}}}showCouponError(t){this.couponError=t}handleCouponClick(t){this.applyCoupon(t.code,!1).catch((()=>{}))}async applyCoupon(t,o=!0){if(this.isApplying){if(o)throw new Error("Coupon application already in progress")}else{this.couponInputValue=t,this.couponError="",this.isApplying=!0,this.isHandlingInternalError=!0;try{await salla.cart.addCoupon(t.trim()),await this.refreshFromServer(),this.multiCoupon&&(this.couponInputValue="")}catch(t){if(this.showCouponError(t.response?.data?.error?.message||salla.lang.get("pages.cart.coupon_application_error")),o)throw t}finally{this.isApplying=!1,setTimeout((()=>{this.isHandlingInternalError=!1}),100)}}}formatMainAmount(t){if("percentage"===t.type)return`${salla.helpers.number("object"==typeof t.amount?t.amount.amount:t.amount)}%`;{const r="object"==typeof t.amount?t.amount:{amount:t.amount,currency:t.minimum_amount?.currency||salla.config.get("store.currency.code","SAR")};return o("span",{innerHTML:salla.money(r.amount,r.currency)})}}isEligible(t){return!this.cartTotalReady||!t.minimum_amount||this.cartTotal>=parseFloat(t.minimum_amount.amount)}renderCouponCard(t){const r=this.isEligible(t);return o("div",{class:"s-cart-coupons-slide-one-fourth swiper-slide"},o("div",{class:"s-cart-coupons-card "+(!r||this.isApplying?"s-cart-coupons-disabled":""),onClick:()=>r&&!this.isApplying&&this.handleCouponClick(t)},o("div",{class:"s-cart-coupons-top-section"},o("div",{class:"s-cart-coupons-discount-values"},o("div",{class:"s-cart-coupons-main-amount"},this.formatMainAmount(t)),t.free_shipping?o("div",{class:"s-cart-coupons-secondary-info"},"+ ",salla.lang.get("pages.cart.free_shipping")):t.maximum_amount&&o("div",{class:"s-cart-coupons-secondary-info"},salla.lang.get("pages.cart.up_to")," ",o("span",{innerHTML:salla.money(t.maximum_amount.amount,t.maximum_amount.currency)}))),o("div",{class:"s-cart-coupons-code"},t.code)),o("div",{class:"s-cart-coupons-divider"}),o("div",{class:"s-cart-coupons-bottom-section"},o("div",{class:"s-cart-coupons-terms"},null!=t.remaining_days&&o("div",{class:"s-cart-coupons-expiry "+(t.remaining_days<=3?"s-cart-coupons-expiry-warning":"")},0===t.remaining_days?salla.lang.get("pages.cart.expires_today"):`${salla.lang.get("pages.cart.expires_after")} ${t.remaining_days} ${salla.lang.get("pages.cart.day")}`),t.minimum_amount&&parseFloat(t.minimum_amount.amount)>0&&o("div",{class:"s-cart-coupons-minimum"},salla.lang.get("pages.cart.minimum")," ",o("span",{innerHTML:salla.money(t.minimum_amount.amount,t.minimum_amount.currency)}))),o("div",{class:"s-cart-coupons-action"},r?salla.lang.get("pages.cart.save_coupon"):salla.lang.get("pages.cart.coupon_not_compatible")))))}render(){return o(r,{key:"e3bed8f1f2019db5e1c5ca4280696933913e3081"},o("div",{key:"9c6a7c383394f9bd19107db9b8e76fd9129648e3",class:"s-cart-coupons-wrapper"},o("div",{key:"1e7f74969e709062c36aa19ff4ec27bde0bb10df",class:"s-cart-coupons-input-section"},o("label",{key:"f3bc1f4ffa9c8a64bee8af273597d6f8ff1f8fd0",htmlFor:"coupon-input",class:"s-cart-coupons-coupon-label"},salla.lang.get("pages.cart.have_coupon")),o("div",{key:"7abbdbd41cf6e65b6c08928bb10a68bfb2677d85",class:"s-cart-coupons-coupon-input-container"},this.multiCoupon?[o("input",{type:"text",id:"coupon-input",name:"coupon",class:"form-input "+(this.couponError?"s-coupon-input-error":""),placeholder:salla.lang.get("pages.cart.coupon_placeholder"),value:this.couponInputValue,disabled:this.isApplying,onInput:this.onInput,onKeyUp:this.onKeyUp,"aria-label":salla.lang.get("pages.cart.apply_coupon"),key:"coupon-input"}),o("salla-button",{ref:t=>this.couponButtonRef=t,class:"s-cart-coupons-coupon-button s-cart-coupons-coupon-button-apply",color:"primary",loading:this.isApplying,"loader-position":"center",onClick:()=>this.handleApplyClick(),key:"apply-button"},o("span",null,salla.lang.get("pages.cart.save_coupon")))]:[o("input",{type:"text",id:"coupon-input",name:"coupon",class:"form-input "+(this.couponError?"s-coupon-input-error":""),placeholder:salla.lang.get("pages.cart.coupon_placeholder"),value:this.couponInputValue,disabled:!!this.currentCoupon||this.isApplying,onInput:this.onInput,onKeyUp:this.onKeyUp,"aria-label":salla.lang.get("pages.cart.apply_coupon"),key:"coupon-input"}),o("salla-button",{ref:t=>this.couponButtonRef=t,class:"s-cart-coupons-coupon-button "+(this.currentCoupon?"s-cart-coupons-coupon-button-remove":"s-cart-coupons-coupon-button-apply"),color:this.currentCoupon?"danger":"primary",loading:this.isApplying,"loader-position":"center",onClick:()=>this.handleCouponButtonClick(),key:"apply-button"},this.currentCoupon?o("i",{class:"sicon-cancel"}):o("span",null,salla.lang.get("pages.cart.save_coupon")))]),this.couponError&&o("span",{key:"6c259fbca7a2a3c2ece3d4c335707c833be5f8d6",class:"s-cart-coupons-coupon-error"},this.couponError),this.multiCoupon&&this.appliedCoupons.length>0&&o("div",{key:"87335fd875279e97fc7a02c9f3519af51a953a7b",class:"s-cart-coupons-applied-list"},this.appliedCoupons.map((t=>o("div",{class:"s-cart-coupons-applied-item",key:t},o("span",{class:"s-cart-coupons-applied-code"},t),o("button",{type:"button",class:"s-cart-coupons-applied-remove","aria-label":`${salla.lang.get("pages.cart.delete")} ${t}`,disabled:this.isApplying,onClick:()=>this.removeCoupon(t)},o("i",{class:"sicon-cancel"}))))))),this.availableCoupons&&this.availableCoupons.length>0&&o("salla-slider",{key:"86c665d3135fa8bc393c4b7ad9daca3ce87bed50",type:"carousel",showControls:!1,class:"s-cart-coupons-slider"},o("div",{key:"45ddccd7e0c5d38e9b98f42862a6d64f6040c942",slot:"items"},this.availableCoupons.map((t=>this.renderCouponCard(t)))))))}get host(){return a(this)}};s.style='/*!twlt*/.s-cart-coupons-applied-list{display:flex;flex-direction:column;gap:8px;margin-top:12px}.s-cart-coupons-applied-item{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:10px 12px;background:#fff;border:1px solid #e5e7eb;border-radius:10px;border-inline-start:3px solid #10b981}.s-cart-coupons-applied-code{display:inline-flex;align-items:center;gap:6px;font-size:13px;font-weight:700;color:#111827}.s-cart-coupons-applied-code::before{content:"";width:7px;height:7px;border-radius:9999px;background:#10b981}.s-cart-coupons-applied-remove{display:inline-flex;align-items:center;justify-content:center;width:26px;height:26px;color:#ef4444;background:transparent;border:0;border-radius:9999px;cursor:pointer;transition:background-color 0.15s ease, color 0.15s ease}.s-cart-coupons-applied-remove:hover{background:#fef2f2}.s-cart-coupons-applied-remove:disabled{opacity:0.5;cursor:not-allowed}.visible{visibility:visible}.fixed{position:fixed}.shrink{flex-shrink:1}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.form-input{height:2.5rem;width:100%;border-radius:0.375rem;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1));transition-property:color, background-color, border-color, text-decoration-color, fill, stroke;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:300ms}.form-input:focus{border-color:var(--color-primary);--tw-ring-color:transparent}.form-input:is(.dark *){--tw-border-opacity:1;border-color:rgb(75 85 99 / var(--tw-border-opacity, 1));--tw-bg-opacity:1;background-color:rgb(75 85 99 / var(--tw-bg-opacity, 1))}.form-input:focus:is(.dark *){border-color:var(--color-primary)}@media (min-width: 640px){.form-input{font-size:0.875rem;line-height:1.25rem}}.s-cart-coupons-wrapper{display:block;width:100%;padding-top:1.25rem;padding-bottom:1.25rem}.s-cart-coupons-input-section{margin-bottom:0.625rem}.s-cart-coupons-coupon-label{margin-bottom:0.625rem;display:block;font-size:0.875rem;line-height:1.25rem;--tw-text-opacity:1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.s-cart-coupons-coupon-input-container{position:relative;display:flex;align-items:stretch}.s-cart-coupons-coupon-input-container .form-input{height:auto;flex:1 1 0%}.s-cart-coupons-coupon-input-container .form-input:where([dir="ltr"],[dir="ltr"] *){border-top-left-radius:0.5rem;border-bottom-left-radius:0.5rem;border-top-right-radius:0px !important;border-bottom-right-radius:0px !important;border-right-width:0px}.s-cart-coupons-coupon-input-container .form-input:where([dir="rtl"],[dir="rtl"] *){border-top-right-radius:0.5rem;border-bottom-right-radius:0.5rem;border-top-left-radius:0px !important;border-bottom-left-radius:0px !important;border-left-width:0px}.s-cart-coupons-coupon-input-container .form-input:focus{position:relative;z-index:10}.s-cart-coupons-coupon-button:where([dir="ltr"],[dir="ltr"] *){border-top-right-radius:0.5rem;border-bottom-right-radius:0.5rem;border-top-left-radius:0px;border-bottom-left-radius:0px}.s-cart-coupons-coupon-button:where([dir="rtl"],[dir="rtl"] *){border-top-left-radius:0.5rem;border-bottom-left-radius:0.5rem;border-top-right-radius:0px;border-bottom-right-radius:0px}.s-cart-coupons-coupon-button-remove:where([dir="ltr"],[dir="ltr"] *){border-top-right-radius:0.5rem;border-bottom-right-radius:0.5rem;border-top-left-radius:0px !important;border-bottom-left-radius:0px !important}.s-cart-coupons-coupon-button-remove:where([dir="rtl"],[dir="rtl"] *){border-top-left-radius:0.5rem;border-bottom-left-radius:0.5rem;border-top-right-radius:0px !important;border-bottom-right-radius:0px !important}.s-cart-coupons-coupon-button-apply:where([dir="ltr"],[dir="ltr"] *){border-top-right-radius:0.5rem !important;border-bottom-right-radius:0.5rem !important;border-top-left-radius:0px !important;border-bottom-left-radius:0px !important}.s-cart-coupons-coupon-button-apply:where([dir="rtl"],[dir="rtl"] *){border-top-left-radius:0.5rem !important;border-bottom-left-radius:0.5rem !important;border-top-right-radius:0px !important;border-bottom-right-radius:0px !important}.s-cart-coupons-coupon-error{margin-top:0.5rem;display:block;font-size:10px;line-height:1rem;--tw-text-opacity:1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.s-cart-coupons-slider{width:100%;overflow:hidden;padding-left:0.375rem;padding-right:0.375rem}.s-cart-coupons-card{position:relative;cursor:pointer;overflow:hidden;--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1));transition-property:all;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:300ms}.s-cart-coupons-card:is(.dark *){--tw-bg-opacity:1;background-color:rgb(31 41 55 / var(--tw-bg-opacity, 1))}.s-cart-coupons-card:hover{--tw-translate-y:-0.125rem;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.s-cart-coupons-disabled{cursor:not-allowed;opacity:0.5}.s-cart-coupons-disabled:hover{transform:none;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1));--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}.s-cart-coupons-top-section{display:flex;height:60px;flex-direction:row;align-items:center;justify-content:space-between;border-top-left-radius:0.75rem;border-top-right-radius:0.75rem;border-width:1px;border-bottom-width:0px;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1));padding-top:1rem;padding-bottom:1rem;padding-left:0.75rem;padding-right:0.75rem}.s-cart-coupons-discount-values{display:flex;flex-direction:column;align-items:flex-start}.s-cart-coupons-discount-values .s-cart-coupons-main-amount{display:flex;align-items:center;gap:0.25rem;white-space:nowrap;font-size:1.25rem;line-height:1.75rem;font-weight:900;line-height:1;--tw-text-opacity:1;color:rgb(0 0 0 / var(--tw-text-opacity, 1))}.s-cart-coupons-discount-values .s-cart-coupons-secondary-info{margin:0px;font-size:10px;line-height:1rem}.s-cart-coupons-code{font-size:10px;font-weight:700;--tw-text-opacity:1;color:rgb(17 24 39 / var(--tw-text-opacity, 1))}.s-cart-coupons-divider{position:relative;z-index:10;margin:0px;border-bottom-width:1px;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1))}.s-cart-coupons-bottom-section{display:flex;min-height:44px;flex-direction:row;align-items:center;justify-content:space-between;border-bottom-right-radius:0.75rem;border-bottom-left-radius:0.75rem;border-width:1px;border-top-width:0px;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1));--tw-bg-opacity:1;background-color:rgb(249 250 251 / var(--tw-bg-opacity, 1));padding-top:0.25rem;padding-bottom:0.25rem;padding-left:0.75rem;padding-right:0.75rem}.s-cart-coupons-terms{display:flex;flex-direction:column;align-items:flex-start}.s-cart-coupons-terms .s-cart-coupons-expiry{margin:0px;font-size:10px;line-height:16px;--tw-text-opacity:1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.s-cart-coupons-terms .s-cart-coupons-minimum{margin:0px;font-size:10px;line-height:16px;--tw-text-opacity:1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.s-cart-coupons-terms .s-cart-coupons-expiry.s-cart-coupons-expiry-warning{font-weight:500;--tw-text-opacity:1;color:rgb(220 38 38 / var(--tw-text-opacity, 1))}.s-cart-coupons-action{cursor:pointer;white-space:nowrap;border-width:0px;background-color:transparent;padding:0px;font-size:9px;font-weight:700;--tw-text-opacity:1;color:rgb(17 24 39 / var(--tw-text-opacity, 1));transition-property:color, background-color, border-color, text-decoration-color, fill, stroke;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms}.s-cart-coupons-action:hover{--tw-text-opacity:1;color:rgb(59 130 246 / var(--tw-text-opacity, 1))}.s-cart-coupons-slide-one-fourth{width:calc(75% - 10px);min-width:200px !important;padding-left:5px !important;padding-right:5px !important;padding-top:2px !important}@media (min-width: 1024px){.s-cart-coupons-slide-one-fourth{width:calc(40% - 10px) !important}}.s-cart-coupons-card:before{pointer-events:none;position:absolute;right:-10px;top:60px;z-index:20;height:1.25rem;width:1.25rem;--tw-translate-y:-50%;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));border-radius:9999px;border-width:1px;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1));--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1));--tw-content:\'\';content:var(--tw-content)}.s-cart-coupons-card:is(.dark *):before{--tw-bg-opacity:1;background-color:rgb(31 41 55 / var(--tw-bg-opacity, 1))}.s-cart-coupons-card:after{pointer-events:none;position:absolute;left:-10px;top:60px;z-index:20;height:1.25rem;width:1.25rem;--tw-translate-y:-50%;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));border-radius:9999px;border-width:1px;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1));--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1));--tw-content:\'\';content:var(--tw-content)}.s-cart-coupons-card:is(.dark *):after{--tw-bg-opacity:1;background-color:rgb(31 41 55 / var(--tw-bg-opacity, 1))}.s-cart-coupons-coupon-input-container .form-input.s-coupon-input-error{--tw-shadow:0 0 0 3px rgba(239,68,68,0.1) !important;--tw-shadow-colored:0 0 0 3px var(--tw-shadow-color) !important;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow) !important}';export{s as salla_cart_coupons}