@salla.sa/twilight-components 2.14.559 → 2.14.561

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 (344) hide show
  1. package/dist/cjs/{filepond-vI0B-67n.js → filepond-D0D0oxUA.js} +1 -1
  2. package/dist/cjs/{filepond-plugin-file-poster-DTiAXF5c.js → filepond-plugin-file-poster-ClC4CTUY.js} +1 -1
  3. package/dist/cjs/{filepond-plugin-file-validate-size-BuMc19fV.js → filepond-plugin-file-validate-size-B8C6evDL.js} +1 -1
  4. package/dist/cjs/{filepond-plugin-file-validate-type-5CKRAI6_.js → filepond-plugin-file-validate-type-DZAbAjHY.js} +1 -1
  5. package/dist/cjs/{filepond-plugin-image-edit-CXXhiTdn.js → filepond-plugin-image-edit-hSzgTpeM.js} +1 -1
  6. package/dist/cjs/{filepond-plugin-image-exif-orientation-DvMNhQGm.js → filepond-plugin-image-exif-orientation-DjmGVpWC.js} +1 -1
  7. package/dist/cjs/{filepond-plugin-image-preview-nHwj0lr7.js → filepond-plugin-image-preview-B8CJe4pP.js} +1 -1
  8. package/dist/cjs/{index-CwneDx5o.js → index-I65DZQe1.js} +3 -3
  9. package/dist/cjs/{intlTelInput-CzMsUlkW.js → intlTelInput-B6mBUv8z.js} +1 -1
  10. package/dist/cjs/loader.cjs.js +1 -1
  11. package/dist/cjs/salla-accordion-body_2.cjs.entry.js +1 -1
  12. package/dist/cjs/salla-accordion_6.cjs.entry.js +1 -1
  13. package/dist/cjs/salla-add-product-button_5.cjs.entry.js +1 -1
  14. package/dist/cjs/salla-advertisement.cjs.entry.js +1 -1
  15. package/dist/cjs/salla-alert_2.cjs.entry.js +1 -1
  16. package/dist/cjs/salla-app-install-alert.cjs.entry.js +1 -1
  17. package/dist/cjs/salla-applied-filters.cjs.entry.js +1 -1
  18. package/dist/cjs/salla-apps-icons.cjs.entry.js +1 -1
  19. package/dist/cjs/salla-attachment-view_9.cjs.entry.js +11 -11
  20. package/dist/cjs/salla-badge.cjs.entry.js +1 -1
  21. package/dist/cjs/salla-basket-gap.cjs.entry.js +1 -1
  22. package/dist/cjs/salla-bullet-delivery_3.cjs.entry.js +5 -5
  23. package/dist/cjs/salla-cart-coupons.cjs.entry.js +1 -1
  24. package/dist/cjs/salla-cart-item-offers_2.cjs.entry.js +1 -1
  25. package/dist/cjs/salla-cart-summary-card.cjs.entry.js +1 -1
  26. package/dist/cjs/salla-cashback-banner.cjs.entry.js +1 -1
  27. package/dist/cjs/salla-comment-factors.cjs.entry.js +1 -1
  28. package/dist/cjs/salla-comment-form_9.cjs.entry.js +8 -3
  29. package/dist/cjs/salla-conditional-offer.cjs.entry.js +1 -1
  30. package/dist/cjs/salla-contacts.cjs.entry.js +1 -1
  31. package/dist/cjs/salla-cookies-bar.cjs.entry.js +1 -1
  32. package/dist/cjs/salla-count-down_2.cjs.entry.js +1 -1
  33. package/dist/cjs/salla-custom-fields.cjs.entry.js +1 -1
  34. package/dist/cjs/salla-delivery-promise.cjs.entry.js +1 -1
  35. package/dist/cjs/salla-edit-order-button.cjs.entry.js +1 -1
  36. package/dist/cjs/salla-filters-widget.cjs.entry.js +1 -1
  37. package/dist/cjs/salla-filters.cjs.entry.js +1 -1
  38. package/dist/cjs/salla-fulfillment-methods.cjs.entry.js +1 -1
  39. package/dist/cjs/salla-gifting.cjs.entry.js +1 -1
  40. package/dist/cjs/salla-hook.cjs.entry.js +1 -1
  41. package/dist/cjs/salla-infinite-scroll.cjs.entry.js +1 -1
  42. package/dist/cjs/salla-installment.cjs.entry.js +1 -1
  43. package/dist/cjs/salla-list-tile.cjs.entry.js +1 -1
  44. package/dist/cjs/salla-localization-modal.cjs.entry.js +1 -1
  45. package/dist/cjs/salla-login-modal.cjs.entry.js +1 -1
  46. package/dist/cjs/salla-loyalty-banner_10.cjs.entry.js +1 -1
  47. package/dist/cjs/salla-loyalty-exchange-product-card.cjs.entry.js +1 -1
  48. package/dist/cjs/salla-loyalty-points-banner.cjs.entry.js +1 -1
  49. package/dist/cjs/salla-loyalty-points-history.cjs.entry.js +1 -1
  50. package/dist/cjs/salla-loyalty-prize-item.cjs.entry.js +1 -1
  51. package/dist/cjs/salla-loyalty.cjs.entry.js +1 -1
  52. package/dist/cjs/salla-maintenance-alert.cjs.entry.js +1 -1
  53. package/dist/cjs/salla-map_3.cjs.entry.js +1 -1
  54. package/dist/cjs/salla-menu.cjs.entry.js +1 -1
  55. package/dist/cjs/salla-metadata.cjs.entry.js +1 -1
  56. package/dist/cjs/salla-multiple-bundle-product-cart_2.cjs.entry.js +1 -1
  57. package/dist/cjs/salla-multiple-bundle-product-options-modal_2.cjs.entry.js +1 -1
  58. package/dist/cjs/salla-multiple-bundle-product.cjs.entry.js +1 -1
  59. package/dist/cjs/salla-next-order-coupon.cjs.entry.js +1 -1
  60. package/dist/cjs/salla-notification-item_2.cjs.entry.js +1 -1
  61. package/dist/cjs/salla-offer-modal.cjs.entry.js +1 -1
  62. package/dist/cjs/salla-offer.cjs.entry.js +1 -1
  63. package/dist/cjs/salla-order-branch.cjs.entry.js +1 -1
  64. package/dist/cjs/salla-order-cancel.cjs.entry.js +1 -1
  65. package/dist/cjs/salla-order-details-multiple-bundle-product.cjs.entry.js +1 -1
  66. package/dist/cjs/salla-order-details-options.cjs.entry.js +1 -1
  67. package/dist/cjs/salla-order-details.cjs.entry.js +1 -1
  68. package/dist/cjs/salla-order-edit-item.cjs.entry.js +1 -1
  69. package/dist/cjs/salla-order-edit-product-card.cjs.entry.js +1 -1
  70. package/dist/cjs/salla-order-edit.cjs.entry.js +1 -1
  71. package/dist/cjs/salla-order-shipments.cjs.entry.js +1 -1
  72. package/dist/cjs/salla-order-summary.cjs.entry.js +1 -1
  73. package/dist/cjs/salla-order-totals-card.cjs.entry.js +1 -1
  74. package/dist/cjs/salla-orders.cjs.entry.js +1 -1
  75. package/dist/cjs/salla-payments.cjs.entry.js +1 -1
  76. package/dist/cjs/salla-placeholder.cjs.entry.js +1 -1
  77. package/dist/cjs/salla-price-range.cjs.entry.js +1 -1
  78. package/dist/cjs/salla-product-card-embed.cjs.entry.js +1 -1
  79. package/dist/cjs/salla-product-card.cjs.entry.js +1 -1
  80. package/dist/cjs/salla-product-size-guide.cjs.entry.js +1 -1
  81. package/dist/cjs/salla-products-list.cjs.entry.js +1 -1
  82. package/dist/cjs/salla-products-slider.cjs.entry.js +1 -1
  83. package/dist/cjs/salla-quick-order.cjs.entry.js +1 -1
  84. package/dist/cjs/salla-rating-modal-v2.cjs.entry.js +1 -1
  85. package/dist/cjs/salla-rating-modal.cjs.entry.js +1 -1
  86. package/dist/cjs/salla-review-factors-tags.cjs.entry.js +1 -1
  87. package/dist/cjs/salla-review-order-item.cjs.entry.js +1 -1
  88. package/dist/cjs/salla-scopes.cjs.entry.js +1 -1
  89. package/dist/cjs/salla-search.cjs.entry.js +4 -3
  90. package/dist/cjs/salla-skeleton.cjs.entry.js +2 -2
  91. package/dist/cjs/salla-social-share.cjs.entry.js +2 -2
  92. package/dist/cjs/salla-social.cjs.entry.js +2 -2
  93. package/dist/cjs/salla-tab-content_3.cjs.entry.js +4 -4
  94. package/dist/cjs/salla-tiered-offer.cjs.entry.js +1 -1
  95. package/dist/cjs/salla-tooltip.cjs.entry.js +2 -2
  96. package/dist/cjs/salla-trust-badges.cjs.entry.js +1 -1
  97. package/dist/cjs/salla-user-menu.cjs.entry.js +1 -1
  98. package/dist/cjs/salla-user-profile.cjs.entry.js +1 -1
  99. package/dist/cjs/salla-user-settings.cjs.entry.js +2 -2
  100. package/dist/cjs/salla-verify.cjs.entry.js +1 -1
  101. package/dist/cjs/salla-wallet.cjs.entry.js +1 -1
  102. package/dist/cjs/salla-wishlist-actions.cjs.entry.js +2 -2
  103. package/dist/cjs/twilight.cjs.js +1 -1
  104. package/dist/cjs/{vanilla-picker-BSGZg-Y0.js → vanilla-picker-CBoJGr0X.js} +1 -1
  105. package/dist/collection/components/salla-reviews/salla-reviews.js +6 -1
  106. package/dist/collection/components/salla-reviews-page/salla-reviews-page.js +1 -1
  107. package/dist/collection/components/salla-search/salla-search.js +3 -2
  108. package/dist/collection/components/salla-searchable-dropdown/salla-searchable-dropdown.js +4 -4
  109. package/dist/collection/components/salla-skeleton/salla-skeleton.js +1 -1
  110. package/dist/collection/components/salla-social/salla-social.js +1 -1
  111. package/dist/collection/components/salla-social-share/salla-social-share.js +1 -1
  112. package/dist/collection/components/salla-tabs/salla-tab-content.js +1 -1
  113. package/dist/collection/components/salla-tabs/salla-tab-header.js +1 -1
  114. package/dist/collection/components/salla-tabs/salla-tabs.js +1 -1
  115. package/dist/collection/components/salla-tel-input/salla-tel-input.js +1 -1
  116. package/dist/collection/components/salla-tooltip/salla-tooltip.js +1 -1
  117. package/dist/collection/components/salla-user-settings/salla-user-settings.js +1 -1
  118. package/dist/collection/components/salla-wishlist-actions/salla-wishlist-actions.js +1 -1
  119. package/dist/components/index.js +3 -3
  120. package/dist/components/salla-reviews-page.js +1 -1
  121. package/dist/components/salla-reviews.js +6 -1
  122. package/dist/components/salla-search.js +3 -2
  123. package/dist/components/salla-searchable-dropdown2.js +4 -4
  124. package/dist/components/salla-skeleton2.js +1 -1
  125. package/dist/components/salla-social-share2.js +1 -1
  126. package/dist/components/salla-social.js +1 -1
  127. package/dist/components/salla-tab-content2.js +1 -1
  128. package/dist/components/salla-tab-header2.js +1 -1
  129. package/dist/components/salla-tabs2.js +1 -1
  130. package/dist/components/salla-tel-input2.js +1 -1
  131. package/dist/components/salla-tooltip2.js +1 -1
  132. package/dist/components/salla-user-settings.js +1 -1
  133. package/dist/components/salla-wishlist-actions.js +1 -1
  134. package/dist/esm/{filepond-BkGwWgIk.js → filepond-DjuXKVOL.js} +1 -1
  135. package/dist/esm/{filepond-plugin-file-poster-TmS7u3EZ.js → filepond-plugin-file-poster-DOjrw9sE.js} +1 -1
  136. package/dist/esm/{filepond-plugin-file-validate-size-DzPOS-Ef.js → filepond-plugin-file-validate-size-DjN0Q2dG.js} +1 -1
  137. package/dist/esm/{filepond-plugin-file-validate-type-tOom5t-_.js → filepond-plugin-file-validate-type-BwoYZE9W.js} +1 -1
  138. package/dist/esm/{filepond-plugin-image-edit-F_8PCaA1.js → filepond-plugin-image-edit-DhjT7l_5.js} +1 -1
  139. package/dist/esm/{filepond-plugin-image-exif-orientation-myByjSqP.js → filepond-plugin-image-exif-orientation-BpywW_V7.js} +1 -1
  140. package/dist/esm/{filepond-plugin-image-preview-qqR31pR_.js → filepond-plugin-image-preview-DgcXW1_l.js} +1 -1
  141. package/dist/esm/{index-D6VagDRi.js → index-CinT9kfz.js} +3 -3
  142. package/dist/esm/{intlTelInput-B1ulDRaQ.js → intlTelInput-CN-EhOKa.js} +1 -1
  143. package/dist/esm/loader.js +2 -2
  144. package/dist/esm/salla-accordion-body_2.entry.js +1 -1
  145. package/dist/esm/salla-accordion_6.entry.js +1 -1
  146. package/dist/esm/salla-add-product-button_5.entry.js +1 -1
  147. package/dist/esm/salla-advertisement.entry.js +1 -1
  148. package/dist/esm/salla-alert_2.entry.js +1 -1
  149. package/dist/esm/salla-app-install-alert.entry.js +1 -1
  150. package/dist/esm/salla-applied-filters.entry.js +1 -1
  151. package/dist/esm/salla-apps-icons.entry.js +1 -1
  152. package/dist/esm/salla-attachment-view_9.entry.js +11 -11
  153. package/dist/esm/salla-badge.entry.js +1 -1
  154. package/dist/esm/salla-basket-gap.entry.js +1 -1
  155. package/dist/esm/salla-bullet-delivery_3.entry.js +5 -5
  156. package/dist/esm/salla-cart-coupons.entry.js +1 -1
  157. package/dist/esm/salla-cart-item-offers_2.entry.js +1 -1
  158. package/dist/esm/salla-cart-summary-card.entry.js +1 -1
  159. package/dist/esm/salla-cashback-banner.entry.js +1 -1
  160. package/dist/esm/salla-comment-factors.entry.js +1 -1
  161. package/dist/esm/salla-comment-form_9.entry.js +8 -3
  162. package/dist/esm/salla-conditional-offer.entry.js +1 -1
  163. package/dist/esm/salla-contacts.entry.js +1 -1
  164. package/dist/esm/salla-cookies-bar.entry.js +1 -1
  165. package/dist/esm/salla-count-down_2.entry.js +1 -1
  166. package/dist/esm/salla-custom-fields.entry.js +1 -1
  167. package/dist/esm/salla-delivery-promise.entry.js +1 -1
  168. package/dist/esm/salla-edit-order-button.entry.js +1 -1
  169. package/dist/esm/salla-filters-widget.entry.js +1 -1
  170. package/dist/esm/salla-filters.entry.js +1 -1
  171. package/dist/esm/salla-fulfillment-methods.entry.js +1 -1
  172. package/dist/esm/salla-gifting.entry.js +1 -1
  173. package/dist/esm/salla-hook.entry.js +1 -1
  174. package/dist/esm/salla-infinite-scroll.entry.js +1 -1
  175. package/dist/esm/salla-installment.entry.js +1 -1
  176. package/dist/esm/salla-list-tile.entry.js +1 -1
  177. package/dist/esm/salla-localization-modal.entry.js +1 -1
  178. package/dist/esm/salla-login-modal.entry.js +1 -1
  179. package/dist/esm/salla-loyalty-banner_10.entry.js +1 -1
  180. package/dist/esm/salla-loyalty-exchange-product-card.entry.js +1 -1
  181. package/dist/esm/salla-loyalty-points-banner.entry.js +1 -1
  182. package/dist/esm/salla-loyalty-points-history.entry.js +1 -1
  183. package/dist/esm/salla-loyalty-prize-item.entry.js +1 -1
  184. package/dist/esm/salla-loyalty.entry.js +1 -1
  185. package/dist/esm/salla-maintenance-alert.entry.js +1 -1
  186. package/dist/esm/salla-map_3.entry.js +1 -1
  187. package/dist/esm/salla-menu.entry.js +1 -1
  188. package/dist/esm/salla-metadata.entry.js +1 -1
  189. package/dist/esm/salla-multiple-bundle-product-cart_2.entry.js +1 -1
  190. package/dist/esm/salla-multiple-bundle-product-options-modal_2.entry.js +1 -1
  191. package/dist/esm/salla-multiple-bundle-product.entry.js +1 -1
  192. package/dist/esm/salla-next-order-coupon.entry.js +1 -1
  193. package/dist/esm/salla-notification-item_2.entry.js +1 -1
  194. package/dist/esm/salla-offer-modal.entry.js +1 -1
  195. package/dist/esm/salla-offer.entry.js +1 -1
  196. package/dist/esm/salla-order-branch.entry.js +1 -1
  197. package/dist/esm/salla-order-cancel.entry.js +1 -1
  198. package/dist/esm/salla-order-details-multiple-bundle-product.entry.js +1 -1
  199. package/dist/esm/salla-order-details-options.entry.js +1 -1
  200. package/dist/esm/salla-order-details.entry.js +1 -1
  201. package/dist/esm/salla-order-edit-item.entry.js +1 -1
  202. package/dist/esm/salla-order-edit-product-card.entry.js +1 -1
  203. package/dist/esm/salla-order-edit.entry.js +1 -1
  204. package/dist/esm/salla-order-shipments.entry.js +1 -1
  205. package/dist/esm/salla-order-summary.entry.js +1 -1
  206. package/dist/esm/salla-order-totals-card.entry.js +1 -1
  207. package/dist/esm/salla-orders.entry.js +1 -1
  208. package/dist/esm/salla-payments.entry.js +1 -1
  209. package/dist/esm/salla-placeholder.entry.js +1 -1
  210. package/dist/esm/salla-price-range.entry.js +1 -1
  211. package/dist/esm/salla-product-card-embed.entry.js +1 -1
  212. package/dist/esm/salla-product-card.entry.js +1 -1
  213. package/dist/esm/salla-product-size-guide.entry.js +1 -1
  214. package/dist/esm/salla-products-list.entry.js +1 -1
  215. package/dist/esm/salla-products-slider.entry.js +1 -1
  216. package/dist/esm/salla-quick-order.entry.js +1 -1
  217. package/dist/esm/salla-rating-modal-v2.entry.js +1 -1
  218. package/dist/esm/salla-rating-modal.entry.js +1 -1
  219. package/dist/esm/salla-review-factors-tags.entry.js +1 -1
  220. package/dist/esm/salla-review-order-item.entry.js +1 -1
  221. package/dist/esm/salla-scopes.entry.js +1 -1
  222. package/dist/esm/salla-search.entry.js +4 -3
  223. package/dist/esm/salla-skeleton.entry.js +2 -2
  224. package/dist/esm/salla-social-share.entry.js +2 -2
  225. package/dist/esm/salla-social.entry.js +2 -2
  226. package/dist/esm/salla-tab-content_3.entry.js +4 -4
  227. package/dist/esm/salla-tiered-offer.entry.js +1 -1
  228. package/dist/esm/salla-tooltip.entry.js +2 -2
  229. package/dist/esm/salla-trust-badges.entry.js +1 -1
  230. package/dist/esm/salla-user-menu.entry.js +1 -1
  231. package/dist/esm/salla-user-profile.entry.js +1 -1
  232. package/dist/esm/salla-user-settings.entry.js +2 -2
  233. package/dist/esm/salla-verify.entry.js +1 -1
  234. package/dist/esm/salla-wallet.entry.js +1 -1
  235. package/dist/esm/salla-wishlist-actions.entry.js +2 -2
  236. package/dist/esm/twilight.js +2 -2
  237. package/dist/esm/{vanilla-picker-DvtnWkFb.js → vanilla-picker-DunYPC8M.js} +1 -1
  238. package/dist/twilight/{p-9060cf90.entry.js → p-01d86c3f.entry.js} +1 -1
  239. package/dist/twilight/{p-a1b0bcae.entry.js → p-03fd5573.entry.js} +1 -1
  240. package/dist/twilight/p-06ffce35.entry.js +4 -0
  241. package/dist/twilight/{p-13adff5c.entry.js → p-0dd51369.entry.js} +1 -1
  242. package/dist/twilight/{p-7275e7da.entry.js → p-0e3904b1.entry.js} +1 -1
  243. package/dist/twilight/{p-54034038.entry.js → p-10d45ac1.entry.js} +1 -1
  244. package/dist/twilight/{p-b8f46367.entry.js → p-17c3ba53.entry.js} +1 -1
  245. package/dist/twilight/{p-da8c1307.entry.js → p-17ed8c78.entry.js} +1 -1
  246. package/dist/twilight/{p-b55d6ca9.entry.js → p-22427822.entry.js} +1 -1
  247. package/dist/twilight/{p-96a761f3.entry.js → p-22d17873.entry.js} +1 -1
  248. package/dist/twilight/{p-e64d3e62.entry.js → p-22fe54c4.entry.js} +1 -1
  249. package/dist/twilight/{p-9bd0780a.entry.js → p-24fed356.entry.js} +1 -1
  250. package/dist/twilight/{p-ef33b218.entry.js → p-273baeb9.entry.js} +6 -6
  251. package/dist/twilight/{p-3532893e.entry.js → p-29a40548.entry.js} +1 -1
  252. package/dist/twilight/{p-02a00a9d.entry.js → p-2b34e283.entry.js} +1 -1
  253. package/dist/twilight/{p-02153797.entry.js → p-2c32010c.entry.js} +1 -1
  254. package/dist/twilight/{p-00dfdb20.entry.js → p-2d355d15.entry.js} +1 -1
  255. package/dist/twilight/{p-5d247f18.entry.js → p-31a44746.entry.js} +1 -1
  256. package/dist/twilight/{p-61035e79.entry.js → p-32160fa2.entry.js} +1 -1
  257. package/dist/twilight/{p-5dc636e9.entry.js → p-3458e64b.entry.js} +1 -1
  258. package/dist/twilight/{p-7348f7e3.entry.js → p-36a0017e.entry.js} +1 -1
  259. package/dist/twilight/{p-19fe876a.entry.js → p-37679926.entry.js} +1 -1
  260. package/dist/twilight/{p-51429c21.entry.js → p-37fe4eee.entry.js} +1 -1
  261. package/dist/twilight/{p-77305493.entry.js → p-3b156f01.entry.js} +1 -1
  262. package/dist/twilight/{p-4dbed954.entry.js → p-3d791486.entry.js} +1 -1
  263. package/dist/twilight/{p-d25c8aeb.entry.js → p-44bb74d7.entry.js} +1 -1
  264. package/dist/twilight/{p-56425cd0.entry.js → p-44e1dbd2.entry.js} +1 -1
  265. package/dist/twilight/{p-bf0e5c4b.entry.js → p-474cc03c.entry.js} +1 -1
  266. package/dist/twilight/{p-891abd9a.entry.js → p-53258edc.entry.js} +1 -1
  267. package/dist/twilight/{p-5b22403c.entry.js → p-56966afa.entry.js} +1 -1
  268. package/dist/twilight/{p-44d7890d.entry.js → p-56e9e187.entry.js} +1 -1
  269. package/dist/twilight/{p-a07f577f.entry.js → p-5c157bfe.entry.js} +1 -1
  270. package/dist/twilight/{p-aede1dd3.entry.js → p-5fb8335f.entry.js} +1 -1
  271. package/dist/twilight/{p-17a708fc.entry.js → p-61c68432.entry.js} +1 -1
  272. package/dist/twilight/{p-890845d7.entry.js → p-6a5f1832.entry.js} +1 -1
  273. package/dist/twilight/{p-451c2f06.entry.js → p-6a82d3c6.entry.js} +1 -1
  274. package/dist/twilight/{p-b5184b83.entry.js → p-6a85aa55.entry.js} +1 -1
  275. package/dist/twilight/{p-ced0ad45.entry.js → p-6a9b81d8.entry.js} +1 -1
  276. package/dist/twilight/{p-797317f9.entry.js → p-6de0cee5.entry.js} +1 -1
  277. package/dist/twilight/{p-5381aac3.entry.js → p-6e90d5f1.entry.js} +1 -1
  278. package/dist/twilight/{p-7cfcac49.entry.js → p-7338d661.entry.js} +1 -1
  279. package/dist/twilight/{p-685b00b1.entry.js → p-78b42686.entry.js} +1 -1
  280. package/dist/twilight/{p-bcc6a2c7.entry.js → p-7de95849.entry.js} +1 -1
  281. package/dist/twilight/{p-16706fe0.entry.js → p-7f2166f4.entry.js} +1 -1
  282. package/dist/twilight/{p-cbe27157.entry.js → p-8016c874.entry.js} +1 -1
  283. package/dist/twilight/{p-b731bd2b.entry.js → p-815e561c.entry.js} +1 -1
  284. package/dist/twilight/{p-b8739111.entry.js → p-82062737.entry.js} +1 -1
  285. package/dist/twilight/{p-ef2354f0.entry.js → p-82fd57a6.entry.js} +1 -1
  286. package/dist/twilight/{p-dd6a5747.entry.js → p-84683611.entry.js} +1 -1
  287. package/dist/twilight/{p-61ad5ff4.entry.js → p-85c68263.entry.js} +1 -1
  288. package/dist/twilight/{p-7e8965c3.entry.js → p-8837989a.entry.js} +1 -1
  289. package/dist/twilight/{p-56cc9936.entry.js → p-88f99cf5.entry.js} +1 -1
  290. package/dist/twilight/{p-155ec7a7.entry.js → p-8cbe8184.entry.js} +1 -1
  291. package/dist/twilight/{p-a0ac1fbf.entry.js → p-8e9a4f2e.entry.js} +1 -1
  292. package/dist/twilight/{p-75778e67.entry.js → p-918aec2d.entry.js} +1 -1
  293. package/dist/twilight/{p-04e90ca8.entry.js → p-92951d99.entry.js} +1 -1
  294. package/dist/twilight/{p-0d8c219a.entry.js → p-92e94f61.entry.js} +1 -1
  295. package/dist/twilight/{p-738d4d73.entry.js → p-96175a23.entry.js} +1 -1
  296. package/dist/twilight/{p-466b2437.entry.js → p-9f080f93.entry.js} +1 -1
  297. package/dist/twilight/{p-CsLeYzSv.js → p-AO_se7co.js} +1 -1
  298. package/dist/twilight/{p-DoD9b-8A.js → p-BBbglXjW.js} +1 -1
  299. package/dist/twilight/p-CinT9kfz.js +5 -0
  300. package/dist/twilight/{p-DJ8VhVEV.js → p-CytyS9Yz.js} +1 -1
  301. package/dist/twilight/{p-Xs77W4g6.js → p-D0QcUfl5.js} +1 -1
  302. package/dist/twilight/p-D0lrDCNd.js +9 -0
  303. package/dist/twilight/{p-BBCnGXmN.js → p-D1RKtmlI.js} +1 -1
  304. package/dist/twilight/{p-BE6LvdyS.js → p-D8yhYee_.js} +1 -1
  305. package/dist/twilight/{p-CFzua46A.js → p-D_V3hAj-.js} +1 -1
  306. package/dist/twilight/{p-87baa963.entry.js → p-a27265dd.entry.js} +1 -1
  307. package/dist/twilight/{p-d09195ba.entry.js → p-a3885a3f.entry.js} +1 -1
  308. package/dist/twilight/{p-ab11570d.entry.js → p-a4f06127.entry.js} +1 -1
  309. package/dist/twilight/{p-18e32c1b.entry.js → p-a5d454ed.entry.js} +1 -1
  310. package/dist/twilight/{p-e01c1fb9.entry.js → p-ac75b388.entry.js} +1 -1
  311. package/dist/twilight/{p-b46fa954.entry.js → p-ad023412.entry.js} +1 -1
  312. package/dist/twilight/{p-52212098.entry.js → p-b0281b97.entry.js} +1 -1
  313. package/dist/twilight/{p-57a0bb62.entry.js → p-b2cbcc57.entry.js} +1 -1
  314. package/dist/twilight/{p-e7b32e74.entry.js → p-b5447de1.entry.js} +1 -1
  315. package/dist/twilight/{p-bb3df4d4.entry.js → p-b7b92a9f.entry.js} +1 -1
  316. package/dist/twilight/{p-06ba1041.entry.js → p-b917cc8d.entry.js} +1 -1
  317. package/dist/twilight/{p-c0c80157.entry.js → p-b9ca65f5.entry.js} +1 -1
  318. package/dist/twilight/{p-uMDizIlo.js → p-bLp_Eheb.js} +1 -1
  319. package/dist/twilight/{p-0f1abf9a.entry.js → p-cb30a541.entry.js} +1 -1
  320. package/dist/twilight/{p-4f29e469.entry.js → p-ce826ecc.entry.js} +1 -1
  321. package/dist/twilight/{p-ebfb0b99.entry.js → p-d0247b0c.entry.js} +1 -1
  322. package/dist/twilight/{p-43c67b9f.entry.js → p-d0bc7504.entry.js} +1 -1
  323. package/dist/twilight/{p-f3540850.entry.js → p-d1fc9fbe.entry.js} +1 -1
  324. package/dist/twilight/{p-3feabe9a.entry.js → p-d2410905.entry.js} +1 -1
  325. package/dist/twilight/{p-91daba79.entry.js → p-d406fe3c.entry.js} +1 -1
  326. package/dist/twilight/{p-90b20e78.entry.js → p-d5ae720f.entry.js} +1 -1
  327. package/dist/twilight/{p-de5c4eb3.entry.js → p-d5c6ad16.entry.js} +1 -1
  328. package/dist/twilight/{p-f3cbbe3e.entry.js → p-d790567b.entry.js} +1 -1
  329. package/dist/twilight/{p-879aeb99.entry.js → p-d93bc523.entry.js} +1 -1
  330. package/dist/twilight/{p-522a6125.entry.js → p-e2c90fb8.entry.js} +1 -1
  331. package/dist/twilight/{p-8fd6c03b.entry.js → p-e65b3c59.entry.js} +1 -1
  332. package/dist/twilight/{p-731ac823.entry.js → p-e96f6e1e.entry.js} +1 -1
  333. package/dist/twilight/{p-019183b8.entry.js → p-ed3c25a2.entry.js} +1 -1
  334. package/dist/twilight/{p-af61bed0.entry.js → p-ee0bae24.entry.js} +1 -1
  335. package/dist/twilight/{p-e1965ea1.entry.js → p-f0085803.entry.js} +1 -1
  336. package/dist/twilight/{p-267f1daf.entry.js → p-f45868e4.entry.js} +1 -1
  337. package/dist/twilight/{p-ce60b709.entry.js → p-f4a75c1f.entry.js} +1 -1
  338. package/dist/twilight/{p-978695b4.entry.js → p-fedf05c6.entry.js} +1 -1
  339. package/dist/twilight/{p-3cad36ef.entry.js → p-ffc0ac2e.entry.js} +1 -1
  340. package/dist/twilight/twilight.esm.js +1 -1
  341. package/package.json +5 -5
  342. package/dist/twilight/p-B8n9WvuU.js +0 -9
  343. package/dist/twilight/p-D6VagDRi.js +0 -5
  344. package/dist/twilight/p-e8393076.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 r,H as i,a as o}from"./p-D6VagDRi.js";import{i as t}from"./p-CV6uPJEJ.js";function s(e,r){localStorage.getItem("salla-delivery-promise-debug")&&(void 0!==r?console.log(e,r):console.log(e))}async function l(e,r){s("fetchCities start",{productId:e,keyword:r});const i=null!=r?`?keyword=${encodeURIComponent(r)}`:"",o=await salla.api.request(salla.url.api(`products/${e}/delivery-promises/cities${i}`));return o.success&&Array.isArray(o.data)&&0!==o.data.length?(s("fetchCities success",{count:o.data.length}),{cities:o.data}):(s("fetchCities: no data",{response:o}),{cities:[]})}function a(){const e=(Boolean(salla.config.get("store.settings.bullet_delivery.settings.remember_last_session"))?salla.storage.store:salla.storage.session).get("bullet_delivery_intent");return e&&"object"==typeof e?e:null}const d={deliveryTo:"توصيل إلى",pickupFromBranch:"الاستلام من فرع",noResults:"لا توجد نتائج",selectCity:"اختر المدينة",changeCityTitle:"تغيير المدينة",changeCitySubtitle:"",cityFieldLabel:"المدينة",modalSearchPlaceholder:"ابحث عن مدينة",confirmAddress:"تأكيد العنوان",errorDeliveryPromise:"لا يتوفر وعد تسليم لهذه المدينة",errorPickupPromise:"لا يتوفر وعد تسليم لهذا الفرع"},n="salla-bullet-delivery-override-ip",c=class{constructor(r){e(this,r),this.isDeliveryPromiseEnabled=!1,this.isLoginCycleEnabled=!1,this.canRender=!1,this.labels=d,this.selectedLabel=null,this.deliveryMessage=null,this.hasError=!1,this.errorMessage="",this.isLoadingPromises=!1,this.selectedCityLoginCycle=null,this.selectedBranchLoginCycle=null,this.cities=[],this.selectedCity=null,this.isLoadingCities=!1,this.cityPendingSelection=null,this.modalCities=[],this.isSearchingCities=!1,this.citySearchCounter=0,this.onBulletDeliveryConfirmed=()=>{this.applyBulletIntent()},this.handleCitySearch=e=>{if(clearTimeout(this.citySearchTimer),!e.trim())return this.modalCities=[...this.cities],void(this.isSearchingCities=!1);this.citySearchTimer=setTimeout((()=>this.searchCitiesRemote(e)),300)},this.handleHeaderClick=e=>{e.stopPropagation(),this.isLoginCycleEnabled?this.openBulletDeliveryModal():this.openCityChangeModal()}}async componentDidLoad(){await salla.onReady(),await salla.lang.onLoaded(),this.labels={deliveryTo:salla.lang.getWithDefault("pages.products.promise_deliver_to",d.deliveryTo),pickupFromBranch:salla.lang.getWithDefault("pages.products.promise_pickup_from_branch",d.pickupFromBranch),noResults:salla.lang.getWithDefault("common.elements.no_options",d.noResults),selectCity:salla.lang.getWithDefault("common.elements.select_city",d.selectCity),changeCityTitle:salla.lang.getWithDefault("pages.products.promise_change_city_title",d.changeCityTitle),changeCitySubtitle:salla.lang.getWithDefault("pages.products.promise_change_city_subtitle","قد تتغيّر مدة التوصيل حسب المدينة."),cityFieldLabel:salla.lang.getWithDefault("pages.products.promise_city_field",d.cityFieldLabel),modalSearchPlaceholder:salla.lang.getWithDefault("pages.products.promise_search_city",d.modalSearchPlaceholder),confirmAddress:salla.lang.getWithDefault("pages.checkout.confirm_address",d.confirmAddress),errorDeliveryPromise:salla.lang.getWithDefault("pages.products.promise_delivery_not_available",d.errorDeliveryPromise),errorPickupPromise:salla.lang.getWithDefault("pages.products.promise_pickup_not_available",d.errorPickupPromise)},this.isDeliveryPromiseEnabled=salla.config.get("store.features",[]).includes("delivery-promises"),this.isLoginCycleEnabled=salla.config.get("store.features",[]).includes("bullet-delivery-v2")&&Salla.config.get("store.settings.bullet_delivery.enabled"),this.productId=salla.config.get("page.id"),this.isDeliveryPromiseEnabled?this.isLoginCycleEnabled?await this.initLoginCycleFlow():(this.selectedLabel=`${this.labels.deliveryTo} ${this.labels.selectCity}`,await this.loadCities()):this.canRender=!1}disconnectedCallback(){window.removeEventListener("bulletDeliveryConfirmed",this.onBulletDeliveryConfirmed)}getIPDeliveryLocation(){const e="store.shipping.delivery_location",r={cityId:salla.config.get(`${e}.city_id`),cityName:salla.config.get(`${e}.city_name`)};return localStorage.getItem(n)?JSON.parse(localStorage.getItem(n)):r}async initLoginCycleFlow(){const e=this.applyBulletIntent(),{cityId:r,cityName:i}=this.getIPDeliveryLocation();s("delivery promise login cycle flow getIPDeliveryLocation",this.getIPDeliveryLocation()),r&&i&&!e&&(this.selectedLabel=`${this.labels.deliveryTo} ${i}`,await this.loadDeliveryMessage(r,"city")),this.canRender=!0,window.addEventListener("bulletDeliveryConfirmed",this.onBulletDeliveryConfirmed)}applyBulletIntent(){const e=function(){const e=a();if(!e)return null;if("address"===e.type){const r=e.address_details?.city,i=null!=r?.id?Number(r.id):null!=e.city_id?Number(e.city_id):null,o=r?.name?.trim()||"";return null!=i?{type:"address",option:{id:i,name:o}}:t(e)&&e.address_details?.formatted_address?{type:"address",option:{name:e.address_details.formatted_address}}:null}if("branch"===e.type){const r=null!=e.branch_id?Number(e.branch_id):null!=e.branch_details?.id?Number(e.branch_details.id):null,i=e.branch_details?.name?.trim()||"";return null!=r?{type:"branch",option:{id:r,name:i}}:null}return null}();return e?("address"===e.type?(this.selectedCityLoginCycle=e.option,this.selectedBranchLoginCycle=null,this.selectedLabel=`${this.labels.deliveryTo} ${e.option.name||this.labels.selectCity}`,null!=e.option.id?this.loadDeliveryMessage(e.option.id,"city"):this.deliveryMessage=null):(this.selectedBranchLoginCycle=e.option,this.selectedCityLoginCycle=null,this.selectedLabel=`${this.labels.pickupFromBranch} ${e.option.name}`,this.loadDeliveryMessage(e.option.id,"branch")),!0):(this.selectedLabel=`${this.labels.deliveryTo} ${this.labels.selectCity}`,this.selectedCityLoginCycle=null,this.selectedBranchLoginCycle=null,this.deliveryMessage=null,!1)}openBulletDeliveryModal(){salla.event.emit("salla::bullet-delivery.modal.open.requested",function(){const e=a(),r={};if("address"===e?.type&&null!=e.address_id&&(r.preselected_address_id=Number(e.address_id)),"branch"===e?.type){const i=e.branch_id??e.branch_details?.id;null!=i&&(r.preselected_branch_id=Number(i))}return r}())}async loadCities(){this.isLoadingCities=!0,this.hasError=!1;const{cityId:e,cityName:r}=this.getIPDeliveryLocation();s("delivery promise standard flow getIPDeliveryLocation",this.getIPDeliveryLocation());try{const{cities:i}=await l(this.productId);if(!i.length)return void(this.canRender=!1);if(this.cities=i,this.canRender=!0,e&&r){this.selectedLabel=`${this.labels.deliveryTo} ${r}`;const i=this.cities.find((r=>String(r.id)===String(e)));i&&(s("delivery promise standard flow autoCity found",i),this.selectedCity=i),await this.loadDeliveryMessage(e,"city")}}catch(e){this.hasError=!0,this.errorMessage=e.message||"Failed to load cities",this.canRender=!1}finally{this.isLoadingCities=!1}}async loadDeliveryMessage(e,r){this.isLoadingPromises=!0,this.hasError=!1,this.deliveryMessage=null;try{this.deliveryMessage=await async function(e,r,i,o){s("fetchDeliveryMessage start",{productId:e,id:r,optionType:i});let t="";t="city"!==i||o?`?reference_id=${r}&reference_type=${i}`:`?reference_id=${r}`;const l=await salla.api.withoutNotifier((()=>salla.api.request(salla.url.api(`products/${e}/delivery-promises${t}`))));if(!l.success)return s("fetchDeliveryMessage error",{response:l}),null;const a=l.data?.message?.trim();return s("fetchDeliveryMessage success",{message:a}),a||null}(this.productId,e,r,this.isLoginCycleEnabled)}catch(i){s("loadDeliveryMessage failed",{id:e,optionType:r,error:i}),this.deliveryMessage=null}finally{this.isLoadingPromises=!1}}async openCityChangeModal(){this.cityModalRef&&(this.cityPendingSelection=null,this.modalCities=[...this.cities],await this.cityModalRef.setTitle(this.labels.changeCityTitle),await this.cityModalRef.open())}async searchCitiesRemote(e){const r=++this.citySearchCounter;this.isSearchingCities=!0;try{const{cities:i}=await l(this.productId,e);if(r!==this.citySearchCounter)return;this.modalCities=i}catch{if(r!==this.citySearchCounter)return;this.modalCities=[]}finally{r===this.citySearchCounter&&(this.isSearchingCities=!1)}}async handleConfirmCityModal(){if(!this.cityPendingSelection)return void await(this.cityModalRef?.close());const e=this.cityPendingSelection;this.selectedCity=e,this.selectedLabel=`${this.labels.deliveryTo} ${function(e){const r=salla.config.get("user.language_code");return r&&"ar"!==r&&e.name_en?.trim()?e.name_en.trim():e.name}(e)}`,await this.loadDeliveryMessage(e.id,"city"),await(this.cityModalRef?.close())}renderLoadingSkeleton(){return r(i,{class:"s-delivery-promise-wrapper s-delivery-promise-skeleton"},r("div",{class:"s-delivery-promise-container"},r("div",{class:"s-delivery-promise-header s-delivery-promise-header-skeleton"},r("div",{class:"s-delivery-promise-location"},r("salla-skeleton",{height:"14px",width:"180px"})),r("salla-skeleton",{height:"18px",width:"18px"})),r("div",{class:"s-delivery-promise-loading"},r("salla-skeleton",{height:"20px",width:"80%"}))))}renderDeliveryMessage(){return this.isLoadingPromises?r("div",{class:"s-delivery-promise-loading"},r("salla-skeleton",{height:"20px",width:"80%"})):this.deliveryMessage?r("div",{class:"s-delivery-promise-message"},this.deliveryMessage):null}renderCityModalBody(){return r("div",{class:"s-delivery-promise-modal-body"},r("salla-searchable-dropdown",{label:this.labels.cityFieldLabel,placeholder:this.labels.modalSearchPlaceholder,items:this.modalCities,selectedItem:this.cityPendingSelection,searching:this.isSearchingCities,required:!0,noResultsText:this.labels.noResults,inputId:"s-delivery-promise-modal-search",onItemSelected:e=>{this.cityPendingSelection=e.detail},onSearchInput:e=>{this.handleCitySearch(e.detail)}}))}renderCityChangeModal(){return this.isLoginCycleEnabled?null:r("salla-modal",{id:"s-delivery-promise-city-modal",ref:e=>{this.cityModalRef=e},class:"s-delivery-promise-city-modal",isClosable:!0,width:"md","modal-title":this.labels.changeCityTitle,subTitle:this.labels.changeCitySubtitle},this.renderCityModalBody(),r("salla-button",{slot:"footer",width:"wide",disabled:!this.cityPendingSelection,onClick:()=>this.handleConfirmCityModal()},!this.isLoadingPromises&&this.labels.confirmAddress))}render(){return this.isDeliveryPromiseEnabled?this.isLoadingCities?this.renderLoadingSkeleton():this.canRender?r(i,{class:"s-delivery-promise-wrapper"},r("div",{class:"s-delivery-promise-container"},r("div",{class:"s-delivery-promise-header",onClick:this.handleHeaderClick},r("div",{class:"s-delivery-promise-location"},r("span",{class:"s-delivery-promise-title"},this.selectedLabel)),r("i",{class:"sicon-keyboard_arrow_down s-delivery-promise-arrow"})),this.hasError&&r("div",{class:"s-delivery-promise-error"},this.errorMessage),!this.hasError&&this.renderDeliveryMessage()),this.renderCityChangeModal()):null:null}get host(){return o(this)}};c.style='/*!twlt*/@charset "UTF-8";:host{display:block}.s-delivery-promise-wrapper{font-family:inherit}.s-delivery-promise-container{position:relative;background:var(--color-surface, #fff);border:1px solid var(--color-border, #e5e7eb);border-radius:8px;padding:12px 16px;margin-bottom:12px}.s-delivery-promise-header{display:flex;align-items:center;cursor:pointer;padding:4px 0}.s-delivery-promise-skeleton .s-delivery-promise-header-skeleton{cursor:default;pointer-events:none}.s-delivery-promise-skeleton .s-delivery-promise-location salla-skeleton{display:block;flex-shrink:0}.s-delivery-promise-location{display:flex;align-items:center;gap:8px}.s-delivery-promise-title{color:var(--color-text-primary, #2b2d34);font-size:14px;font-weight:bold}.s-delivery-promise-arrow{color:var(--color-text-secondary, #666);font-size:18px;transition:transform 0.2s ease}.s-delivery-promise-arrow.open{transform:rotate(180deg)}.s-delivery-promise-city-modal{}.s-delivery-promise-city-modal .s-modal-title{color:var(--color-primary, #00897b);font-weight:700}.s-delivery-promise-city-modal .s-modal-sub-title{color:var(--color-text-secondary, #5c6c7c);font-size:14px;line-height:1.45}.s-delivery-promise-city-modal .s-modal-body{overflow:visible !important}.s-delivery-promise-city-modal .s-modal-body>salla-button{position:relative;z-index:0;margin-top:16px}.s-delivery-promise-modal-body{position:relative;z-index:10;display:flex;flex-direction:column;gap:12px;text-align:start;margin-bottom:16px}.s-delivery-promise-modal-combobox{position:relative;isolation:isolate}.s-delivery-promise-modal-field-label{display:block;font-size:14px;font-weight:500;color:var(--color-text-primary, #2b2d34)}.s-delivery-promise-required{color:var(--color-danger, #dc3545)}.s-delivery-promise-modal-search{display:flex;align-items:center;gap:8px;padding:10px 12px;border:1px solid var(--color-border, #e5e7eb);border-radius:8px;background:var(--color-surface, #fff)}.s-delivery-promise-modal-search .sicon-search{flex-shrink:0;color:var(--color-text-secondary, #999);font-size:16px}.s-delivery-promise-modal-search input{flex:1;border:none;outline:none;font-size:14px;background:transparent;color:var(--color-text-primary, #333)}.s-delivery-promise-modal-search input::placeholder{color:var(--color-text-secondary, #999)}.s-delivery-promise-modal-popover{position:absolute;top:calc(100% + 4px);left:0;right:0;z-index:1;border-radius:8px;border:1px solid var(--color-border, #e5e7eb);background:var(--color-surface, #fff);box-shadow:0 8px 24px rgba(0, 0, 0, 0.12);animation:s-delivery-promise-popover-in 0.2s ease}@keyframes s-delivery-promise-popover-in{from{opacity:0;transform:translateY(-4px)}to{opacity:1;transform:translateY(0)}}.s-delivery-promise-modal-list{max-height:min(40vh, 260px);overflow-y:auto;background:var(--color-surface, #fff)}.s-delivery-promise-modal-item{display:flex;width:100%;align-items:center;justify-content:space-between;gap:8px;padding:12px 16px;margin:0;border:none;border-bottom:1px solid var(--color-border, #eee);cursor:pointer;font:inherit;text-align:inherit;background:transparent;color:var(--color-text-primary, #2b2d34);transition:background 0.15s ease}.s-delivery-promise-modal-item:last-child{border-bottom:none}.s-delivery-promise-modal-item:hover{background:var(--color-hover, #f5f5f5)}.s-delivery-promise-modal-item--selected{background:var(--color-primary-light, rgba(0, 137, 123, 0.08))}.s-delivery-promise-modal-item--selected .s-delivery-promise-modal-item-name{color:var(--color-primary, #00897b);font-weight:600}.s-delivery-promise-modal-item .sicon-check{flex-shrink:0;color:var(--color-primary, #00897b);font-size:14px}.s-delivery-promise-modal-empty{padding:24px 16px;text-align:center;color:var(--color-text-secondary, #999);font-size:14px}.s-delivery-promise-message{margin-top:8px;font-size:13px;line-height:1.5;color:var(--color-text-secondary, #2b2d34)}.s-delivery-promise-loading{margin-top:12px;padding-top:12px}.s-delivery-promise-error{margin-top:12px;padding-top:12px;font-size:14px;color:var(--color-danger, #dc3545)}.shadow{--tw-shadow:0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}.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-delivery-promise-wrapper{display:block;font-family:inherit}.s-delivery-promise-container{position:relative;margin-bottom:0.75rem;border-radius:0.5rem;border-width:1px;border-color:var(--color-border,#e5e7eb);background-color:var(--color-surface,#fff);padding-left:1rem;padding-right:1rem;padding-top:0.75rem;padding-bottom:0.75rem}.s-delivery-promise-header{display:flex;cursor:pointer;align-items:center;padding-top:0.25rem;padding-bottom:0.25rem}.s-delivery-promise-skeleton .s-delivery-promise-header-skeleton{pointer-events:none;cursor:default}.s-delivery-promise-skeleton .s-delivery-promise-location salla-skeleton{display:block;flex-shrink:0}.s-delivery-promise-location{display:flex;align-items:center;gap:0.5rem}.s-delivery-promise-title{font-size:0.875rem;line-height:1.25rem;font-weight:700;color:var(--color-text-primary,#2b2d34)}.s-delivery-promise-arrow{font-size:1.125rem;line-height:1.75rem;color:var(--color-text-secondary,#666);transition-property:transform;transition-duration:200ms;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1)}.s-delivery-promise-arrow.open{--tw-rotate:180deg;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-delivery-promise-message{margin-top:0.5rem;font-size:13px;line-height:1.5;color:var(--color-text-secondary,#2b2d34)}.s-delivery-promise-loading{margin-top:0.75rem;padding-top:0.75rem}.s-delivery-promise-error{margin-top:0.75rem;padding-top:0.75rem;font-size:0.875rem;line-height:1.25rem;color:var(--color-danger,#dc3545)}.s-delivery-promise-city-modal .s-modal-title{font-weight:700;color:var(--color-primary,#00897b)}.s-delivery-promise-city-modal .s-modal-sub-title{font-size:0.875rem;line-height:1.25rem;line-height:1.45;color:var(--color-text-secondary,#5c6c7c)}.s-delivery-promise-city-modal .s-modal-body{overflow:visible !important}.s-delivery-promise-city-modal .s-modal-body>salla-button{position:relative;z-index:0;margin-top:1rem}.s-delivery-promise-modal-body{position:relative;z-index:10;margin-bottom:1rem;display:flex;flex-direction:column;gap:0.75rem;text-align:start}.s-delivery-promise-modal-combobox{position:relative;isolation:isolate}.s-delivery-promise-modal-field-label{display:block;font-size:0.875rem;line-height:1.25rem;font-weight:500;color:var(--color-text-primary,#2b2d34)}.s-delivery-promise-modal-required{color:var(--color-danger,#dc3545)}.s-delivery-promise-modal-search{display:flex;align-items:center;gap:0.5rem;border-radius:0.5rem;border-width:1px;border-color:var(--color-border,#e5e7eb);background-color:var(--color-surface,#fff);padding-left:0.75rem;padding-right:0.75rem;padding-top:0.625rem;padding-bottom:0.625rem}.s-delivery-promise-modal-search .sicon-search{flex-shrink:0;font-size:1rem;line-height:1.5rem;color:var(--color-text-secondary,#999)}.s-delivery-promise-modal-search input{min-width:0px;flex:1 1 0%;border-width:0px;background-color:transparent;font-size:0.875rem;line-height:1.25rem;color:var(--color-text-primary,#333);outline:2px solid transparent;outline-offset:2px}.s-delivery-promise-modal-search input::placeholder{color:var(--color-text-secondary,#999)}.s-delivery-promise-modal-popover{position:absolute;left:0px;right:0px;top:calc(100% + 4px);z-index:1;border-radius:0.5rem;border-width:1px;border-color:var(--color-border,#e5e7eb);background-color:var(--color-surface,#fff);--tw-shadow:0 8px 24px rgba(0,0,0,0.12);--tw-shadow-colored:0 8px 24px 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-delivery-promise-modal-list{max-height:min(40vh, 260px);overflow-y:auto;background-color:var(--color-surface,#fff)}.s-delivery-promise-modal-item{margin:0px;display:flex;width:100%;cursor:pointer;align-items:center;justify-content:space-between;gap:0.5rem;border-width:0px;border-bottom-width:1px;border-color:var(--color-border,#eee);background-color:transparent;padding-left:1rem;padding-right:1rem;padding-top:0.75rem;padding-bottom:0.75rem;text-align:start;color:var(--color-text-primary,#2b2d34);transition-property:color, background-color, border-color, text-decoration-color, fill, stroke;transition-duration:150ms;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1)}.s-delivery-promise-modal-item:last-child{border-bottom-width:0px}.s-delivery-promise-modal-item--selected{background-color:var(--color-primary-light,rgba(0,137,123,0.08))}.s-delivery-promise-modal-item--selected .s-delivery-promise-modal-item-name{font-weight:600;color:var(--color-primary,#00897b)}.s-delivery-promise-modal-item .sicon-check{flex-shrink:0;font-size:0.875rem;line-height:1.25rem;color:var(--color-primary,#00897b)}.s-delivery-promise-modal-empty{padding-left:1rem;padding-right:1rem;padding-top:1.5rem;padding-bottom:1.5rem;text-align:center;font-size:0.875rem;line-height:1.25rem;color:var(--color-text-secondary,#999)}';export{c as salla_delivery_promise}
4
+ import{r as e,h as r,H as i,a as o}from"./p-CinT9kfz.js";import{i as t}from"./p-CV6uPJEJ.js";function s(e,r){localStorage.getItem("salla-delivery-promise-debug")&&(void 0!==r?console.log(e,r):console.log(e))}async function l(e,r){s("fetchCities start",{productId:e,keyword:r});const i=null!=r?`?keyword=${encodeURIComponent(r)}`:"",o=await salla.api.request(salla.url.api(`products/${e}/delivery-promises/cities${i}`));return o.success&&Array.isArray(o.data)&&0!==o.data.length?(s("fetchCities success",{count:o.data.length}),{cities:o.data}):(s("fetchCities: no data",{response:o}),{cities:[]})}function a(){const e=(Boolean(salla.config.get("store.settings.bullet_delivery.settings.remember_last_session"))?salla.storage.store:salla.storage.session).get("bullet_delivery_intent");return e&&"object"==typeof e?e:null}const d={deliveryTo:"توصيل إلى",pickupFromBranch:"الاستلام من فرع",noResults:"لا توجد نتائج",selectCity:"اختر المدينة",changeCityTitle:"تغيير المدينة",changeCitySubtitle:"",cityFieldLabel:"المدينة",modalSearchPlaceholder:"ابحث عن مدينة",confirmAddress:"تأكيد العنوان",errorDeliveryPromise:"لا يتوفر وعد تسليم لهذه المدينة",errorPickupPromise:"لا يتوفر وعد تسليم لهذا الفرع"},n="salla-bullet-delivery-override-ip",c=class{constructor(r){e(this,r),this.isDeliveryPromiseEnabled=!1,this.isLoginCycleEnabled=!1,this.canRender=!1,this.labels=d,this.selectedLabel=null,this.deliveryMessage=null,this.hasError=!1,this.errorMessage="",this.isLoadingPromises=!1,this.selectedCityLoginCycle=null,this.selectedBranchLoginCycle=null,this.cities=[],this.selectedCity=null,this.isLoadingCities=!1,this.cityPendingSelection=null,this.modalCities=[],this.isSearchingCities=!1,this.citySearchCounter=0,this.onBulletDeliveryConfirmed=()=>{this.applyBulletIntent()},this.handleCitySearch=e=>{if(clearTimeout(this.citySearchTimer),!e.trim())return this.modalCities=[...this.cities],void(this.isSearchingCities=!1);this.citySearchTimer=setTimeout((()=>this.searchCitiesRemote(e)),300)},this.handleHeaderClick=e=>{e.stopPropagation(),this.isLoginCycleEnabled?this.openBulletDeliveryModal():this.openCityChangeModal()}}async componentDidLoad(){await salla.onReady(),await salla.lang.onLoaded(),this.labels={deliveryTo:salla.lang.getWithDefault("pages.products.promise_deliver_to",d.deliveryTo),pickupFromBranch:salla.lang.getWithDefault("pages.products.promise_pickup_from_branch",d.pickupFromBranch),noResults:salla.lang.getWithDefault("common.elements.no_options",d.noResults),selectCity:salla.lang.getWithDefault("common.elements.select_city",d.selectCity),changeCityTitle:salla.lang.getWithDefault("pages.products.promise_change_city_title",d.changeCityTitle),changeCitySubtitle:salla.lang.getWithDefault("pages.products.promise_change_city_subtitle","قد تتغيّر مدة التوصيل حسب المدينة."),cityFieldLabel:salla.lang.getWithDefault("pages.products.promise_city_field",d.cityFieldLabel),modalSearchPlaceholder:salla.lang.getWithDefault("pages.products.promise_search_city",d.modalSearchPlaceholder),confirmAddress:salla.lang.getWithDefault("pages.checkout.confirm_address",d.confirmAddress),errorDeliveryPromise:salla.lang.getWithDefault("pages.products.promise_delivery_not_available",d.errorDeliveryPromise),errorPickupPromise:salla.lang.getWithDefault("pages.products.promise_pickup_not_available",d.errorPickupPromise)},this.isDeliveryPromiseEnabled=salla.config.get("store.features",[]).includes("delivery-promises"),this.isLoginCycleEnabled=salla.config.get("store.features",[]).includes("bullet-delivery-v2")&&Salla.config.get("store.settings.bullet_delivery.enabled"),this.productId=salla.config.get("page.id"),this.isDeliveryPromiseEnabled?this.isLoginCycleEnabled?await this.initLoginCycleFlow():(this.selectedLabel=`${this.labels.deliveryTo} ${this.labels.selectCity}`,await this.loadCities()):this.canRender=!1}disconnectedCallback(){window.removeEventListener("bulletDeliveryConfirmed",this.onBulletDeliveryConfirmed)}getIPDeliveryLocation(){const e="store.shipping.delivery_location",r={cityId:salla.config.get(`${e}.city_id`),cityName:salla.config.get(`${e}.city_name`)};return localStorage.getItem(n)?JSON.parse(localStorage.getItem(n)):r}async initLoginCycleFlow(){const e=this.applyBulletIntent(),{cityId:r,cityName:i}=this.getIPDeliveryLocation();s("delivery promise login cycle flow getIPDeliveryLocation",this.getIPDeliveryLocation()),r&&i&&!e&&(this.selectedLabel=`${this.labels.deliveryTo} ${i}`,await this.loadDeliveryMessage(r,"city")),this.canRender=!0,window.addEventListener("bulletDeliveryConfirmed",this.onBulletDeliveryConfirmed)}applyBulletIntent(){const e=function(){const e=a();if(!e)return null;if("address"===e.type){const r=e.address_details?.city,i=null!=r?.id?Number(r.id):null!=e.city_id?Number(e.city_id):null,o=r?.name?.trim()||"";return null!=i?{type:"address",option:{id:i,name:o}}:t(e)&&e.address_details?.formatted_address?{type:"address",option:{name:e.address_details.formatted_address}}:null}if("branch"===e.type){const r=null!=e.branch_id?Number(e.branch_id):null!=e.branch_details?.id?Number(e.branch_details.id):null,i=e.branch_details?.name?.trim()||"";return null!=r?{type:"branch",option:{id:r,name:i}}:null}return null}();return e?("address"===e.type?(this.selectedCityLoginCycle=e.option,this.selectedBranchLoginCycle=null,this.selectedLabel=`${this.labels.deliveryTo} ${e.option.name||this.labels.selectCity}`,null!=e.option.id?this.loadDeliveryMessage(e.option.id,"city"):this.deliveryMessage=null):(this.selectedBranchLoginCycle=e.option,this.selectedCityLoginCycle=null,this.selectedLabel=`${this.labels.pickupFromBranch} ${e.option.name}`,this.loadDeliveryMessage(e.option.id,"branch")),!0):(this.selectedLabel=`${this.labels.deliveryTo} ${this.labels.selectCity}`,this.selectedCityLoginCycle=null,this.selectedBranchLoginCycle=null,this.deliveryMessage=null,!1)}openBulletDeliveryModal(){salla.event.emit("salla::bullet-delivery.modal.open.requested",function(){const e=a(),r={};if("address"===e?.type&&null!=e.address_id&&(r.preselected_address_id=Number(e.address_id)),"branch"===e?.type){const i=e.branch_id??e.branch_details?.id;null!=i&&(r.preselected_branch_id=Number(i))}return r}())}async loadCities(){this.isLoadingCities=!0,this.hasError=!1;const{cityId:e,cityName:r}=this.getIPDeliveryLocation();s("delivery promise standard flow getIPDeliveryLocation",this.getIPDeliveryLocation());try{const{cities:i}=await l(this.productId);if(!i.length)return void(this.canRender=!1);if(this.cities=i,this.canRender=!0,e&&r){this.selectedLabel=`${this.labels.deliveryTo} ${r}`;const i=this.cities.find((r=>String(r.id)===String(e)));i&&(s("delivery promise standard flow autoCity found",i),this.selectedCity=i),await this.loadDeliveryMessage(e,"city")}}catch(e){this.hasError=!0,this.errorMessage=e.message||"Failed to load cities",this.canRender=!1}finally{this.isLoadingCities=!1}}async loadDeliveryMessage(e,r){this.isLoadingPromises=!0,this.hasError=!1,this.deliveryMessage=null;try{this.deliveryMessage=await async function(e,r,i,o){s("fetchDeliveryMessage start",{productId:e,id:r,optionType:i});let t="";t="city"!==i||o?`?reference_id=${r}&reference_type=${i}`:`?reference_id=${r}`;const l=await salla.api.withoutNotifier((()=>salla.api.request(salla.url.api(`products/${e}/delivery-promises${t}`))));if(!l.success)return s("fetchDeliveryMessage error",{response:l}),null;const a=l.data?.message?.trim();return s("fetchDeliveryMessage success",{message:a}),a||null}(this.productId,e,r,this.isLoginCycleEnabled)}catch(i){s("loadDeliveryMessage failed",{id:e,optionType:r,error:i}),this.deliveryMessage=null}finally{this.isLoadingPromises=!1}}async openCityChangeModal(){this.cityModalRef&&(this.cityPendingSelection=null,this.modalCities=[...this.cities],await this.cityModalRef.setTitle(this.labels.changeCityTitle),await this.cityModalRef.open())}async searchCitiesRemote(e){const r=++this.citySearchCounter;this.isSearchingCities=!0;try{const{cities:i}=await l(this.productId,e);if(r!==this.citySearchCounter)return;this.modalCities=i}catch{if(r!==this.citySearchCounter)return;this.modalCities=[]}finally{r===this.citySearchCounter&&(this.isSearchingCities=!1)}}async handleConfirmCityModal(){if(!this.cityPendingSelection)return void await(this.cityModalRef?.close());const e=this.cityPendingSelection;this.selectedCity=e,this.selectedLabel=`${this.labels.deliveryTo} ${function(e){const r=salla.config.get("user.language_code");return r&&"ar"!==r&&e.name_en?.trim()?e.name_en.trim():e.name}(e)}`,await this.loadDeliveryMessage(e.id,"city"),await(this.cityModalRef?.close())}renderLoadingSkeleton(){return r(i,{class:"s-delivery-promise-wrapper s-delivery-promise-skeleton"},r("div",{class:"s-delivery-promise-container"},r("div",{class:"s-delivery-promise-header s-delivery-promise-header-skeleton"},r("div",{class:"s-delivery-promise-location"},r("salla-skeleton",{height:"14px",width:"180px"})),r("salla-skeleton",{height:"18px",width:"18px"})),r("div",{class:"s-delivery-promise-loading"},r("salla-skeleton",{height:"20px",width:"80%"}))))}renderDeliveryMessage(){return this.isLoadingPromises?r("div",{class:"s-delivery-promise-loading"},r("salla-skeleton",{height:"20px",width:"80%"})):this.deliveryMessage?r("div",{class:"s-delivery-promise-message"},this.deliveryMessage):null}renderCityModalBody(){return r("div",{class:"s-delivery-promise-modal-body"},r("salla-searchable-dropdown",{label:this.labels.cityFieldLabel,placeholder:this.labels.modalSearchPlaceholder,items:this.modalCities,selectedItem:this.cityPendingSelection,searching:this.isSearchingCities,required:!0,noResultsText:this.labels.noResults,inputId:"s-delivery-promise-modal-search",onItemSelected:e=>{this.cityPendingSelection=e.detail},onSearchInput:e=>{this.handleCitySearch(e.detail)}}))}renderCityChangeModal(){return this.isLoginCycleEnabled?null:r("salla-modal",{id:"s-delivery-promise-city-modal",ref:e=>{this.cityModalRef=e},class:"s-delivery-promise-city-modal",isClosable:!0,width:"md","modal-title":this.labels.changeCityTitle,subTitle:this.labels.changeCitySubtitle},this.renderCityModalBody(),r("salla-button",{slot:"footer",width:"wide",disabled:!this.cityPendingSelection,onClick:()=>this.handleConfirmCityModal()},!this.isLoadingPromises&&this.labels.confirmAddress))}render(){return this.isDeliveryPromiseEnabled?this.isLoadingCities?this.renderLoadingSkeleton():this.canRender?r(i,{class:"s-delivery-promise-wrapper"},r("div",{class:"s-delivery-promise-container"},r("div",{class:"s-delivery-promise-header",onClick:this.handleHeaderClick},r("div",{class:"s-delivery-promise-location"},r("span",{class:"s-delivery-promise-title"},this.selectedLabel)),r("i",{class:"sicon-keyboard_arrow_down s-delivery-promise-arrow"})),this.hasError&&r("div",{class:"s-delivery-promise-error"},this.errorMessage),!this.hasError&&this.renderDeliveryMessage()),this.renderCityChangeModal()):null:null}get host(){return o(this)}};c.style='/*!twlt*/@charset "UTF-8";:host{display:block}.s-delivery-promise-wrapper{font-family:inherit}.s-delivery-promise-container{position:relative;background:var(--color-surface, #fff);border:1px solid var(--color-border, #e5e7eb);border-radius:8px;padding:12px 16px;margin-bottom:12px}.s-delivery-promise-header{display:flex;align-items:center;cursor:pointer;padding:4px 0}.s-delivery-promise-skeleton .s-delivery-promise-header-skeleton{cursor:default;pointer-events:none}.s-delivery-promise-skeleton .s-delivery-promise-location salla-skeleton{display:block;flex-shrink:0}.s-delivery-promise-location{display:flex;align-items:center;gap:8px}.s-delivery-promise-title{color:var(--color-text-primary, #2b2d34);font-size:14px;font-weight:bold}.s-delivery-promise-arrow{color:var(--color-text-secondary, #666);font-size:18px;transition:transform 0.2s ease}.s-delivery-promise-arrow.open{transform:rotate(180deg)}.s-delivery-promise-city-modal{}.s-delivery-promise-city-modal .s-modal-title{color:var(--color-primary, #00897b);font-weight:700}.s-delivery-promise-city-modal .s-modal-sub-title{color:var(--color-text-secondary, #5c6c7c);font-size:14px;line-height:1.45}.s-delivery-promise-city-modal .s-modal-body{overflow:visible !important}.s-delivery-promise-city-modal .s-modal-body>salla-button{position:relative;z-index:0;margin-top:16px}.s-delivery-promise-modal-body{position:relative;z-index:10;display:flex;flex-direction:column;gap:12px;text-align:start;margin-bottom:16px}.s-delivery-promise-modal-combobox{position:relative;isolation:isolate}.s-delivery-promise-modal-field-label{display:block;font-size:14px;font-weight:500;color:var(--color-text-primary, #2b2d34)}.s-delivery-promise-required{color:var(--color-danger, #dc3545)}.s-delivery-promise-modal-search{display:flex;align-items:center;gap:8px;padding:10px 12px;border:1px solid var(--color-border, #e5e7eb);border-radius:8px;background:var(--color-surface, #fff)}.s-delivery-promise-modal-search .sicon-search{flex-shrink:0;color:var(--color-text-secondary, #999);font-size:16px}.s-delivery-promise-modal-search input{flex:1;border:none;outline:none;font-size:14px;background:transparent;color:var(--color-text-primary, #333)}.s-delivery-promise-modal-search input::placeholder{color:var(--color-text-secondary, #999)}.s-delivery-promise-modal-popover{position:absolute;top:calc(100% + 4px);left:0;right:0;z-index:1;border-radius:8px;border:1px solid var(--color-border, #e5e7eb);background:var(--color-surface, #fff);box-shadow:0 8px 24px rgba(0, 0, 0, 0.12);animation:s-delivery-promise-popover-in 0.2s ease}@keyframes s-delivery-promise-popover-in{from{opacity:0;transform:translateY(-4px)}to{opacity:1;transform:translateY(0)}}.s-delivery-promise-modal-list{max-height:min(40vh, 260px);overflow-y:auto;background:var(--color-surface, #fff)}.s-delivery-promise-modal-item{display:flex;width:100%;align-items:center;justify-content:space-between;gap:8px;padding:12px 16px;margin:0;border:none;border-bottom:1px solid var(--color-border, #eee);cursor:pointer;font:inherit;text-align:inherit;background:transparent;color:var(--color-text-primary, #2b2d34);transition:background 0.15s ease}.s-delivery-promise-modal-item:last-child{border-bottom:none}.s-delivery-promise-modal-item:hover{background:var(--color-hover, #f5f5f5)}.s-delivery-promise-modal-item--selected{background:var(--color-primary-light, rgba(0, 137, 123, 0.08))}.s-delivery-promise-modal-item--selected .s-delivery-promise-modal-item-name{color:var(--color-primary, #00897b);font-weight:600}.s-delivery-promise-modal-item .sicon-check{flex-shrink:0;color:var(--color-primary, #00897b);font-size:14px}.s-delivery-promise-modal-empty{padding:24px 16px;text-align:center;color:var(--color-text-secondary, #999);font-size:14px}.s-delivery-promise-message{margin-top:8px;font-size:13px;line-height:1.5;color:var(--color-text-secondary, #2b2d34)}.s-delivery-promise-loading{margin-top:12px;padding-top:12px}.s-delivery-promise-error{margin-top:12px;padding-top:12px;font-size:14px;color:var(--color-danger, #dc3545)}.shadow{--tw-shadow:0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}.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-delivery-promise-wrapper{display:block;font-family:inherit}.s-delivery-promise-container{position:relative;margin-bottom:0.75rem;border-radius:0.5rem;border-width:1px;border-color:var(--color-border,#e5e7eb);background-color:var(--color-surface,#fff);padding-left:1rem;padding-right:1rem;padding-top:0.75rem;padding-bottom:0.75rem}.s-delivery-promise-header{display:flex;cursor:pointer;align-items:center;padding-top:0.25rem;padding-bottom:0.25rem}.s-delivery-promise-skeleton .s-delivery-promise-header-skeleton{pointer-events:none;cursor:default}.s-delivery-promise-skeleton .s-delivery-promise-location salla-skeleton{display:block;flex-shrink:0}.s-delivery-promise-location{display:flex;align-items:center;gap:0.5rem}.s-delivery-promise-title{font-size:0.875rem;line-height:1.25rem;font-weight:700;color:var(--color-text-primary,#2b2d34)}.s-delivery-promise-arrow{font-size:1.125rem;line-height:1.75rem;color:var(--color-text-secondary,#666);transition-property:transform;transition-duration:200ms;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1)}.s-delivery-promise-arrow.open{--tw-rotate:180deg;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-delivery-promise-message{margin-top:0.5rem;font-size:13px;line-height:1.5;color:var(--color-text-secondary,#2b2d34)}.s-delivery-promise-loading{margin-top:0.75rem;padding-top:0.75rem}.s-delivery-promise-error{margin-top:0.75rem;padding-top:0.75rem;font-size:0.875rem;line-height:1.25rem;color:var(--color-danger,#dc3545)}.s-delivery-promise-city-modal .s-modal-title{font-weight:700;color:var(--color-primary,#00897b)}.s-delivery-promise-city-modal .s-modal-sub-title{font-size:0.875rem;line-height:1.25rem;line-height:1.45;color:var(--color-text-secondary,#5c6c7c)}.s-delivery-promise-city-modal .s-modal-body{overflow:visible !important}.s-delivery-promise-city-modal .s-modal-body>salla-button{position:relative;z-index:0;margin-top:1rem}.s-delivery-promise-modal-body{position:relative;z-index:10;margin-bottom:1rem;display:flex;flex-direction:column;gap:0.75rem;text-align:start}.s-delivery-promise-modal-combobox{position:relative;isolation:isolate}.s-delivery-promise-modal-field-label{display:block;font-size:0.875rem;line-height:1.25rem;font-weight:500;color:var(--color-text-primary,#2b2d34)}.s-delivery-promise-modal-required{color:var(--color-danger,#dc3545)}.s-delivery-promise-modal-search{display:flex;align-items:center;gap:0.5rem;border-radius:0.5rem;border-width:1px;border-color:var(--color-border,#e5e7eb);background-color:var(--color-surface,#fff);padding-left:0.75rem;padding-right:0.75rem;padding-top:0.625rem;padding-bottom:0.625rem}.s-delivery-promise-modal-search .sicon-search{flex-shrink:0;font-size:1rem;line-height:1.5rem;color:var(--color-text-secondary,#999)}.s-delivery-promise-modal-search input{min-width:0px;flex:1 1 0%;border-width:0px;background-color:transparent;font-size:0.875rem;line-height:1.25rem;color:var(--color-text-primary,#333);outline:2px solid transparent;outline-offset:2px}.s-delivery-promise-modal-search input::placeholder{color:var(--color-text-secondary,#999)}.s-delivery-promise-modal-popover{position:absolute;left:0px;right:0px;top:calc(100% + 4px);z-index:1;border-radius:0.5rem;border-width:1px;border-color:var(--color-border,#e5e7eb);background-color:var(--color-surface,#fff);--tw-shadow:0 8px 24px rgba(0,0,0,0.12);--tw-shadow-colored:0 8px 24px 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-delivery-promise-modal-list{max-height:min(40vh, 260px);overflow-y:auto;background-color:var(--color-surface,#fff)}.s-delivery-promise-modal-item{margin:0px;display:flex;width:100%;cursor:pointer;align-items:center;justify-content:space-between;gap:0.5rem;border-width:0px;border-bottom-width:1px;border-color:var(--color-border,#eee);background-color:transparent;padding-left:1rem;padding-right:1rem;padding-top:0.75rem;padding-bottom:0.75rem;text-align:start;color:var(--color-text-primary,#2b2d34);transition-property:color, background-color, border-color, text-decoration-color, fill, stroke;transition-duration:150ms;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1)}.s-delivery-promise-modal-item:last-child{border-bottom-width:0px}.s-delivery-promise-modal-item--selected{background-color:var(--color-primary-light,rgba(0,137,123,0.08))}.s-delivery-promise-modal-item--selected .s-delivery-promise-modal-item-name{font-weight:600;color:var(--color-primary,#00897b)}.s-delivery-promise-modal-item .sicon-check{flex-shrink:0;font-size:0.875rem;line-height:1.25rem;color:var(--color-primary,#00897b)}.s-delivery-promise-modal-empty{padding-left:1rem;padding-right:1rem;padding-top:1.5rem;padding-bottom:1.5rem;text-align:center;font-size:0.875rem;line-height:1.25rem;color:var(--color-text-secondary,#999)}';export{c as salla_delivery_promise}
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r as t,h as a,F as s,a as i}from"./p-D6VagDRi.js";const e=class{constructor(a){t(this,a),this.isMobileAllowed=!0,this.isEmailRequired=!1,this.supportWebAuth=!0,this.withoutReload=!1,this.source="",this.htmlElement=document.documentElement,this.messages=[],this.isClosable=!0,this.iframeLoaded=!1,this.scrolling="no",this.direction=document.dir,this.canRenderIframe=!1,salla.event.on("login::open",(t=>this.onLoginOpen(t))),salla.event.on("modal::close",(t=>{this.iframe&&this.sendMessageToIframe({source:"login",type:"modal_closed",data:t})})),salla.onReady((()=>{this.api=salla.config.get("store.api"),this.storeId=salla.config.get("store.id")}))}onLoginOpen(t){salla.mobile?.isNativeLoginEnabled?.()||(this.isEmailAllowed||this.isMobileAllowed?(this.source=t?.source??!1,this.withoutReload=t?.withoutReload??this.withoutReload,this.open(t),this.openModal()):salla.logger.warn("Please enable atleast one login type to use this component."))}componentDidLoad(){window.addEventListener("message",(t=>{if(!this.isTrustedMessage(t)||"login"!=t.data?.source)return;if(!this.inline&&!this.canRenderIframe)return;salla.log("salla-account:: recived an event",t.data);let a=t.data?.type?.replace("iframe::",""),s=t.data.message;if("ready"==a)return s.isPasskeyPage?void this.createPassKey.postMessage({source:"login",type:"init_passkey_page",data:{token:salla.storage.get("token"),store_id:salla.config.get("store.id"),locale:salla.config.get("user.language_code"),redirect:salla.config.get("store.url")}},salla.config.get("login.url")):void this.handleIframeReadyAction();if("height"==a)return this.iframe.height=s?.height+"px";if("storage"==a)return this.handleIframeStorageAction(s);if("scrolling"==a)return this.scrolling=s,void(this.isClosable=!1);if("direction"==a)return document.dir=this.direction=s?"rtl":"ltr";if("notify"==a)return salla.notify[s.type](s.message);if("authenticated"==a||"authenticated_web_auth"==a)return!s?.withoutClose&&this.close(),salla.auth.api.handlAfterAuthenticatedResponse(s,this.supportWebAuth).then((()=>!(s?.withoutReload||this.withoutReload)&&setTimeout((()=>window.location.reload()),1e3)));if("dispatchEvent"!=a||"auth::verified"!=s.event){if("dispatchEvent"==a)return salla.event.emit(s.event,...s.payload);if("reload"==a)return s?.withClose&&this.modal.close(),window.location.reload();if("open_page"===a){if(!this.isSafeUrl(s?.url))return;return window.location.href=s.url}if("open_passkey_page"!==a)return"guest-checkout"===a?this.handleGuestCheckout():void("close"==a&&this.close());this.createPassKey=window.open(`${salla.config.get("login.url")}/create-passkey`)}else salla.log("Ignored dispatchEvent `auth::verified` from iframe")})),this.observeDarkModeChanges(),setTimeout((()=>Salla.event.emit("salla-login::ready")),1)}async open(t=null){return Salla.config.isGuest()?this.modal.open():this.withoutReload?void 0:location.reload()}close(){Salla.event.emit("salla-login::closing"),this.modal.close(),this.iframeLoaded=!1,this.canRenderIframe=!1,this.host.dispatchEvent(new CustomEvent("salla-login:closed",{cancelable:!0,bubbles:!0,detail:null})),Salla.event.emit("salla-login::closed")}handleIframeReadyAction(){this.sendInitMessage(),this.sendMessageToIframe({source:"login",type:"width",data:document.body.clientWidth})}observeDarkModeChanges(){new MutationObserver((t=>{t.forEach((t=>{"class"===t.attributeName&&this.sendMessageToIframe({source:"login",type:"darkMode",data:{isDark:!!this.htmlElement.classList.contains("dark")}})}))})).observe(this.htmlElement,{attributes:!0})}async handleIframeStorageAction(t){let a,s=salla.storage.get("cart.user_id"),i=!1;if(Object.entries(t).filter((t=>!Salla.storage.get(t[0]))).forEach((([t,e])=>{salla.log("Shared storage from accounts domain",t,e);let l="string"==typeof e?e?.replace(/^"|"$/g,""):e;salla.storage.set(t,l),"token"===t&&(a=l),"user"===t&&s&&l.id!==s&&(i=!0)})),a){this.modal.close(),Salla.auth.event.tokenFetched(a);try{await Salla.api.cart.assign()}catch(t){Salla.log("Error on assign after handle iframe",t)}i&&Salla.cart.reset();try{!Salla.auth.api.isSessionless()&&await Salla.auth.api.request("auth/jwt"),Salla.auth.api.canRedirect()?setTimeout((()=>window.location.reload()),100):await Salla.auth.event.loggedIn({data:{token:a}}).then((()=>Salla.auth.api.afterUserLogin()))}catch(t){this.modal.open(),Salla.log("Error on request auth/jwt after handle iframe",t)}}else i&&Salla.cart.reset()}isTrustedMessage(t){if(!(this.iframe&&t.source===this.iframe.contentWindow||this.createPassKey&&t.source===this.createPassKey))return!1;let a;try{a=new URL(salla.config.get("login.url","https://accounts.salla.com")).origin}catch(t){a="https://accounts.salla.com"}return t.origin===a}isSafeUrl(t){if("string"!=typeof t||!t)return!1;try{const{protocol:a}=new URL(t,location.href);return"https:"===a||"http:"===a}catch(t){return!1}}sendMessageToIframe(t){if(this.iframe)return this.iframe.contentWindow.postMessage(t,"*")}sendInitMessage(){let t=this.headers;try{t="string"==typeof t?JSON.parse(t):t}catch(a){console.error("Failed to parse headers!",this.headers,a),t=void 0}const a={user:salla.storage.get("user"),s_translations:salla.storage.get("s_translations"),token:salla.storage.get("token")};a.user||delete a.user,a.s_translations||delete a.s_translations,a.token||delete a.token,this.sendMessageToIframe({source:"login",type:"init",data:{id:this.storeId,lang:salla.lang.locale,isDark:!!this.htmlElement.classList.contains("dark"),apiUrl:this.api?.replace(/\/+$/,""),supportWebAuth:this.supportWebAuth,withoutReload:this.withoutReload,inline:this.inline,settings:salla.config.all(),headers:t,storage:a}})}async handleGuestCheckout(){if(this.modal.close(),salla.config.isGuest())return salla.cart.submit(!1,!0)}openModal(){this.canRenderIframe||(this.canRenderIframe=!0),this.modal.open()}render(){if(!Salla.config.isUser())return this.inline?this.getLoginDom():a("salla-modal",{class:"s-login-modal",ref:t=>this.modal=t,width:"xs"},this.getLoginDom())}getLoginDom(){if(this.canRenderIframe)return a(s,null,a("iframe",{src:`${salla.config.get("login.url","https://accounts.salla.com")}?src=${this.source}&version=${salla.config.get("login.version","0.1.78")}`,title:"Salla Login",class:"hide-scroll",loading:"lazy",ref:t=>{this.iframe=t},allow:"publickey-credentials-get; publickey-credentials-create",scrolling:this.scrolling,frameborder:"0",width:"100%"}))}get host(){return i(this)}};e.style="/*!twlt*/iframe{-moz-transition:height 0.3s;-ms-transition:height 0.3s;-o-transition:height 0.3s;-webkit-transition:height 0.3s;transition:height 0.3s;width:100%}.inline{display:inline}.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)}";export{e as salla_login_modal}
4
+ import{r as t,h as a,F as s,a as i}from"./p-CinT9kfz.js";const e=class{constructor(a){t(this,a),this.isMobileAllowed=!0,this.isEmailRequired=!1,this.supportWebAuth=!0,this.withoutReload=!1,this.source="",this.htmlElement=document.documentElement,this.messages=[],this.isClosable=!0,this.iframeLoaded=!1,this.scrolling="no",this.direction=document.dir,this.canRenderIframe=!1,salla.event.on("login::open",(t=>this.onLoginOpen(t))),salla.event.on("modal::close",(t=>{this.iframe&&this.sendMessageToIframe({source:"login",type:"modal_closed",data:t})})),salla.onReady((()=>{this.api=salla.config.get("store.api"),this.storeId=salla.config.get("store.id")}))}onLoginOpen(t){salla.mobile?.isNativeLoginEnabled?.()||(this.isEmailAllowed||this.isMobileAllowed?(this.source=t?.source??!1,this.withoutReload=t?.withoutReload??this.withoutReload,this.open(t),this.openModal()):salla.logger.warn("Please enable atleast one login type to use this component."))}componentDidLoad(){window.addEventListener("message",(t=>{if(!this.isTrustedMessage(t)||"login"!=t.data?.source)return;if(!this.inline&&!this.canRenderIframe)return;salla.log("salla-account:: recived an event",t.data);let a=t.data?.type?.replace("iframe::",""),s=t.data.message;if("ready"==a)return s.isPasskeyPage?void this.createPassKey.postMessage({source:"login",type:"init_passkey_page",data:{token:salla.storage.get("token"),store_id:salla.config.get("store.id"),locale:salla.config.get("user.language_code"),redirect:salla.config.get("store.url")}},salla.config.get("login.url")):void this.handleIframeReadyAction();if("height"==a)return this.iframe.height=s?.height+"px";if("storage"==a)return this.handleIframeStorageAction(s);if("scrolling"==a)return this.scrolling=s,void(this.isClosable=!1);if("direction"==a)return document.dir=this.direction=s?"rtl":"ltr";if("notify"==a)return salla.notify[s.type](s.message);if("authenticated"==a||"authenticated_web_auth"==a)return!s?.withoutClose&&this.close(),salla.auth.api.handlAfterAuthenticatedResponse(s,this.supportWebAuth).then((()=>!(s?.withoutReload||this.withoutReload)&&setTimeout((()=>window.location.reload()),1e3)));if("dispatchEvent"!=a||"auth::verified"!=s.event){if("dispatchEvent"==a)return salla.event.emit(s.event,...s.payload);if("reload"==a)return s?.withClose&&this.modal.close(),window.location.reload();if("open_page"===a){if(!this.isSafeUrl(s?.url))return;return window.location.href=s.url}if("open_passkey_page"!==a)return"guest-checkout"===a?this.handleGuestCheckout():void("close"==a&&this.close());this.createPassKey=window.open(`${salla.config.get("login.url")}/create-passkey`)}else salla.log("Ignored dispatchEvent `auth::verified` from iframe")})),this.observeDarkModeChanges(),setTimeout((()=>Salla.event.emit("salla-login::ready")),1)}async open(t=null){return Salla.config.isGuest()?this.modal.open():this.withoutReload?void 0:location.reload()}close(){Salla.event.emit("salla-login::closing"),this.modal.close(),this.iframeLoaded=!1,this.canRenderIframe=!1,this.host.dispatchEvent(new CustomEvent("salla-login:closed",{cancelable:!0,bubbles:!0,detail:null})),Salla.event.emit("salla-login::closed")}handleIframeReadyAction(){this.sendInitMessage(),this.sendMessageToIframe({source:"login",type:"width",data:document.body.clientWidth})}observeDarkModeChanges(){new MutationObserver((t=>{t.forEach((t=>{"class"===t.attributeName&&this.sendMessageToIframe({source:"login",type:"darkMode",data:{isDark:!!this.htmlElement.classList.contains("dark")}})}))})).observe(this.htmlElement,{attributes:!0})}async handleIframeStorageAction(t){let a,s=salla.storage.get("cart.user_id"),i=!1;if(Object.entries(t).filter((t=>!Salla.storage.get(t[0]))).forEach((([t,e])=>{salla.log("Shared storage from accounts domain",t,e);let l="string"==typeof e?e?.replace(/^"|"$/g,""):e;salla.storage.set(t,l),"token"===t&&(a=l),"user"===t&&s&&l.id!==s&&(i=!0)})),a){this.modal.close(),Salla.auth.event.tokenFetched(a);try{await Salla.api.cart.assign()}catch(t){Salla.log("Error on assign after handle iframe",t)}i&&Salla.cart.reset();try{!Salla.auth.api.isSessionless()&&await Salla.auth.api.request("auth/jwt"),Salla.auth.api.canRedirect()?setTimeout((()=>window.location.reload()),100):await Salla.auth.event.loggedIn({data:{token:a}}).then((()=>Salla.auth.api.afterUserLogin()))}catch(t){this.modal.open(),Salla.log("Error on request auth/jwt after handle iframe",t)}}else i&&Salla.cart.reset()}isTrustedMessage(t){if(!(this.iframe&&t.source===this.iframe.contentWindow||this.createPassKey&&t.source===this.createPassKey))return!1;let a;try{a=new URL(salla.config.get("login.url","https://accounts.salla.com")).origin}catch(t){a="https://accounts.salla.com"}return t.origin===a}isSafeUrl(t){if("string"!=typeof t||!t)return!1;try{const{protocol:a}=new URL(t,location.href);return"https:"===a||"http:"===a}catch(t){return!1}}sendMessageToIframe(t){if(this.iframe)return this.iframe.contentWindow.postMessage(t,"*")}sendInitMessage(){let t=this.headers;try{t="string"==typeof t?JSON.parse(t):t}catch(a){console.error("Failed to parse headers!",this.headers,a),t=void 0}const a={user:salla.storage.get("user"),s_translations:salla.storage.get("s_translations"),token:salla.storage.get("token")};a.user||delete a.user,a.s_translations||delete a.s_translations,a.token||delete a.token,this.sendMessageToIframe({source:"login",type:"init",data:{id:this.storeId,lang:salla.lang.locale,isDark:!!this.htmlElement.classList.contains("dark"),apiUrl:this.api?.replace(/\/+$/,""),supportWebAuth:this.supportWebAuth,withoutReload:this.withoutReload,inline:this.inline,settings:salla.config.all(),headers:t,storage:a}})}async handleGuestCheckout(){if(this.modal.close(),salla.config.isGuest())return salla.cart.submit(!1,!0)}openModal(){this.canRenderIframe||(this.canRenderIframe=!0),this.modal.open()}render(){if(!Salla.config.isUser())return this.inline?this.getLoginDom():a("salla-modal",{class:"s-login-modal",ref:t=>this.modal=t,width:"xs"},this.getLoginDom())}getLoginDom(){if(this.canRenderIframe)return a(s,null,a("iframe",{src:`${salla.config.get("login.url","https://accounts.salla.com")}?src=${this.source}&version=${salla.config.get("login.version","0.1.78")}`,title:"Salla Login",class:"hide-scroll",loading:"lazy",ref:t=>{this.iframe=t},allow:"publickey-credentials-get; publickey-credentials-create",scrolling:this.scrolling,frameborder:"0",width:"100%"}))}get host(){return i(this)}};e.style="/*!twlt*/iframe{-moz-transition:height 0.3s;-ms-transition:height 0.3s;-o-transition:height 0.3s;-webkit-transition:height 0.3s;transition:height 0.3s;width:100%}.inline{display:inline}.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)}";export{e as salla_login_modal}
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r as t,h as e,H as s,a as l,F as i}from"./p-D6VagDRi.js";const n=class{constructor(e){t(this,e),this.sections=[],this.itemNumber=""}deleteItem(t,e){const s=this.host.closest("form");if(s){const l=s.getAttribute("id");if(l&&"string"==typeof l){const s=l.match(/item-(\d+)/)?.[1];this.itemNumber=s||"";const i=this.host.querySelector(`#accordion-${e.id}`);salla.cart.deleteItem(`${this.itemNumber}?product_id=${e.id}&section_id=${t}`).then((()=>i?.remove()))}}}renderRemoveButton(t,s,l=!1){return e("salla-button",{type:"button",shape:l?"btn":"icon",fill:l?"outline":"solid",size:"small",color:"danger","aria-label":"Remove from the cart",onClick:()=>this.deleteItem(t,s)},l?salla.lang.get("common.elements.delete"):e("i",{class:"sicon-cancel"}))}renderAccordionHeader(t,s){const l=s?.options&&s?.options?.length>0;return e("div",{slot:"html",class:"s-multiple-bundle-product-cart-header-wrapper"},e("div",{class:"s-multiple-bundle-product-cart-header "+(l?"":"s-multiple-bundle-product-cart-header-no-options")},e("div",{class:"s-multiple-bundle-product-cart-header-content"},e("a",{href:s?.url,class:"s-multiple-bundle-product-cart-header-image-wrapper"},e("img",{src:s?.image?.url,alt:s?.image?.alt||s?.name,class:"s-multiple-bundle-product-cart-header-image"})),e("div",{class:"s-multiple-bundle-product-cart-header-content-details"},e("h2",{class:"s-multiple-bundle-product-cart-header-content-details-title"},e("a",{href:s?.url,class:"s-multiple-bundle-product-cart-header-content-details-title-link"},s?.name)),e("div",{class:"s-multiple-bundle-product-cart-header-content-details-price"},e("span",{class:"s-multiple-bundle-product-cart-header-content-details-price-regular"},e("span",{innerHTML:s?.price?salla.money(s?.price):""})),s?.sale_price>0&&e("span",{class:"s-multiple-bundle-product-cart-header-content-details-price-sale"},e("span",{innerHTML:salla.money(s?.sale_price)}))),s?.quantity_in_group>0&&0!==s?.quantity&&e("p",{class:"s-multiple-bundle-product-cart-header-content-details-quantity"},e("span",null,salla.lang.get("pages.products.number_of_pieces")),e("span",null,s?.quantity_in_group)))),!l&&e("div",{class:"s-multiple-bundle-product-cart-header-remove-button"},this.renderRemoveButton(t,s,!1))))}render(){return e(s,{key:"78be7c4a3be811adb01cb1437473fcd9f1c17b41",class:"s-multiple-bundle-product-wrapper"},e("div",{key:"9b0439dffc9a2dd8d31f56dacb5d835cde903e71",class:"s-multiple-bundle-product-wrapper-sections"},this.sections.map(((t,s)=>t.products.map((l=>{const i={sectionId:t.id,sectionIndex:s,productId:l.id};return e("salla-accordion",{key:l.id,collapsed:!1,bordered:!0,collapsible:!!(l.options&&l.options.length>0),size:"sm",id:`accordion-${l.id}`},e("salla-accordion-head",null,this.renderAccordionHeader(String(t.id),l)),l.options&&l.options.length>0&&e("salla-accordion-body",null,e("salla-product-options",{options:JSON.stringify(l.options),key:`${l.id}-persistent`,"product-id":l.id,"bundle-context":JSON.stringify(i)}),e("div",{class:"s-multiple-bundle-product-cart-body-remove-button"},this.renderRemoveButton(String(t.id),l,!0))))}))))))}get host(){return l(this)}};n.style="";const c=class{constructor(e){t(this,e),this.sections=[],this.selectedProducts={},this.productSelectedHandler=null,this.onSelectProduct=(t,e)=>{const s=e.id,l=this.selectedProducts[t]?.has(s)??!1,i=this.sections.find((e=>e.id==t));if(!(l&&i&&this.isProductSelectionLocked(i))){if(!l){if(!i)return;if(1!==this.getEffectiveMax(i)&&this.isAtSelectionLimit(i))return}this.selectedProducts={...this.selectedProducts,[t]:new Set(this.selectedProducts[t]||[])},l?(this.selectedProducts[t].delete(s),this.clearProductFormData(s,t),this.clearProductModalOptions(s,t)):1===this.getEffectiveMax(i)?this.syncSectionSelection(t,s):this.selectedProducts[t].add(s),this.selectedProducts={...this.selectedProducts},salla.event.dispatch("on-bundle-product-selected",{id:e.id,name:e.name,options:e.options,wasSelected:l,isSelected:!l})}},this.ensureProductSelected=(t,e)=>{this.selectedProducts={...this.selectedProducts,[t]:new Set(this.selectedProducts[t]||[])};const s=e.id;if(this.selectedProducts[t].has(s))return;const l=this.sections.find((e=>e.id==t));if(!l)return;const i=this.getEffectiveMax(l);if(1===i)this.syncSectionSelection(t,s);else{if(i>1&&this.isAtSelectionLimit(l))return;this.selectedProducts[t].add(s)}this.selectedProducts={...this.selectedProducts},salla.event.dispatch("on-bundle-product-selected",{id:e.id,name:e.name,options:e.options})},this.onSelectProductOptions=(t,e)=>{const s=this.sections.find((t=>t.id==e));if(!s||!this.canSelectProductInSection(s,t.id))return;const l=this.sections.findIndex((t=>t.id==e)),i=s.products?.findIndex((e=>e.id==t.id))??0,n=this.selectedProducts[e]?.has(t.id)??!1;salla.event.dispatch("multiple-bundle-product-modal::open",{product:t,sectionId:e,sectionIndex:l,productIndex:i,isProductAlreadySelected:n})},this.handleBundleSliderProductSelected=t=>{const{product:e,sectionId:s}=t.detail;this.onSelectProduct(s,e)},this.handleBundleSliderProductOptionsSelected=t=>{const{product:e,sectionId:s}=t.detail;this.onSelectProductOptions(e,s)}}isSingleProductSection(t){return 1===(t.products?.length??0)}getObligatoryMin(t){const e=t.obligatory_products;if(null==e)return 0;const s=Number(e);return Number.isNaN(s)?0:s}isProductSelectionLocked(t){return this.isSingleProductSection(t)&&1===this.getObligatoryMin(t)}getEffectiveMax(t){const e=t.products?.length??0,s=t.max_obligatory_products;return null!=s&&s>0?Math.min(s,e):e}getSelectedCount(t){return this.selectedProducts[t]?.size??0}isAtSelectionLimit(t){return this.getSelectedCount(t.id)>=this.getEffectiveMax(t)}canSelectProductInSection(t,e){return!!this.selectedProducts[t.id]?.has(e)||1===this.getEffectiveMax(t)||!this.isAtSelectionLimit(t)}async canSelectBundleProduct(t,e){const s=this.sections.find((e=>e.id==t));return!!s&&this.canSelectProductInSection(s,e)}queryProductCheckbox(t,e){const s=`input.s-multiple-bundle-product-checkbox[name="bundle[${t}][${e}][id]"]`,l=this.host.closest("form"),i=l?.querySelector(s);if(i)return i;for(const t of this.host.querySelectorAll("salla-multiple-bundle-product-slider")){const e=(t.shadowRoot??t).querySelector(s);if(e)return e}return null}dispatchBubblingChange(t){requestAnimationFrame((()=>{t.dispatchEvent(new window.Event("change",{bubbles:!0}))}))}clearSectionProductSlot(t,e,s){const l=this.queryProductCheckbox(t,s);l&&(l.checked=!1);const i=this.host.closest("form");if(i){const e=`bundle[${t}][${s}]`;Array.from(i.querySelectorAll("input")).forEach((t=>{t.name?.startsWith(e)&&("checkbox"===t.type&&t.name?.endsWith("][id]")?t.checked=!1:t.remove())}))}this.clearProductModalOptions(e,t)}syncSectionSelection(t,e){const s=this.sections.find((e=>e.id==t));s?.products?.forEach(((s,l)=>{s.id!=e&&this.clearSectionProductSlot(t,s.id,l)})),this.selectedProducts[t]=new Set([e]);const l=s?.products?.findIndex((t=>t.id==e))??-1,i=l>=0?this.queryProductCheckbox(t,l):null;i&&(i.checked=!0,this.dispatchBubblingChange(i))}autoSelectSingleProductSections(){if(!this.sections?.length)return;const t={...this.selectedProducts};let e=!1;const s=[];for(const l of this.sections){if(!this.isProductSelectionLocked(l))continue;const i=l.products?.[0];if(!i||!i.unlimited_quantity&&(i.quantity??0)<=0)continue;const n=l.id,c=new Set(t[n]||[]);c.has(i.id)||(c.add(i.id),t[n]=c,e=!0,s.push({product:i}))}e&&(this.selectedProducts=t,s.forEach((({product:t})=>{salla.event.dispatch("on-bundle-product-selected",{id:t.id,name:t.name,options:t.options})})))}clearProductFormData(t,e){if(null!=e){const s=this.sections.find((t=>t.id==e)),l=s?.products?.findIndex((e=>e.id==t))??-1;if(l>=0)return void this.clearSectionProductSlot(e,t,l)}const s=this.host.closest("form");s&&s.querySelectorAll(`[data-product-id="${t}"]`).forEach((t=>t.remove()))}clearProductModalOptions(t,e){let s=null,l=null;if(null!=e&&(s=this.sections.findIndex((t=>t.id==e)),s>-1)){const e=this.sections[s];if(e){const s=e.products?.findIndex((e=>e.id==t));l="number"==typeof s&&s>-1?s:null}}salla.event.dispatch("multiple-bundle-product-modal::clear-options",{productId:t,sectionId:e,sectionIndex:s,productIndex:l})}getProgressStatus(t){const e=this.getSelectedCount(t.id),s=this.getEffectiveMax(t);return s>0?`${e}/${s}`:"0"}getSectionSelectionNote(t){const e=this.getObligatoryMin(t),s=Number(t.max_obligatory_products)||0,l=e>0,i=s>0;return l||i?l&&i?e===s?salla.lang.getWithDefault("pages.products.bundle_select_exact",`اختر ${e} منتجات`,{count:e}):salla.lang.getWithDefault("pages.products.bundle_select_range",`اختر من ${e} إلى ${s} منتجات`,{min:e,max:s}):l?salla.lang.getWithDefault("pages.products.bundle_select_min",`اختر على الأقل ${e} منتجات`,{min:e}):salla.lang.getWithDefault("pages.products.bundle_select_max",`اختر حتى ${s} منتجات`,{max:s}):null}handleSectionsChange(){this.autoSelectSingleProductSections()}componentWillLoad(){this.autoSelectSingleProductSections()}renderAccordionHeader(t){const s=this.getSectionSelectionNote(t);return e(i,null,e("h2",{slot:"title"},t?.name),s?e("span",{slot:"note"},s):null,e("span",{slot:"progress"},this.getProgressStatus(t)))}componentDidLoad(){const t=this.host.querySelector("salla-multiple-bundle-product-options-modal");t&&(this.productSelectedHandler=t=>{const{productId:e,sectionId:s,product:l,fromModal:i}=t.detail;i?this.ensureProductSelected(s,l||{id:e}):this.onSelectProduct(s,l||{id:e})},t.addEventListener("productSelected",this.productSelectedHandler))}disconnectedCallback(){if(this.productSelectedHandler){const t=this.host.querySelector("salla-multiple-bundle-product-options-modal");t&&t.removeEventListener("productSelected",this.productSelectedHandler),this.productSelectedHandler=null}}render(){return e(s,{key:"1ba2cde8fad73b16cfc2ccdd5e68331a9e3fdb7a",class:"s-multiple-bundle-product-wrapper"},e("div",{key:"a72d9fc9f3df30616d3d0696c755db4e76c9a153",class:"s-multiple-bundle-product-wrapper-sections"},this.sections.map(((t,s)=>e("salla-accordion",{key:t.id,collapsed:0!==s},e("salla-accordion-head",null,this.renderAccordionHeader(t)),e("salla-accordion-body",null,e("salla-multiple-bundle-product-slider",{section:t,sectionIndex:s,selectedProducts:this.selectedProducts,selectionLimit:this.getEffectiveMax(t),isSelectionLocked:this.isProductSelectionLocked(t),onProductSelected:this.handleBundleSliderProductSelected,onProductOptionsSelected:this.handleBundleSliderProductOptionsSelected})))))),e("salla-multiple-bundle-product-options-modal",{key:"1e2f996c2d995c62ae29dedc90826a1f1d0a1320"}))}get host(){return l(this)}static get watchers(){return{sections:["handleSectionsChange"]}}};c.style="";export{n as salla_multiple_bundle_product_cart,c as salla_multiple_bundle_product_details}
4
+ import{r as t,h as e,H as s,a as l,F as i}from"./p-CinT9kfz.js";const n=class{constructor(e){t(this,e),this.sections=[],this.itemNumber=""}deleteItem(t,e){const s=this.host.closest("form");if(s){const l=s.getAttribute("id");if(l&&"string"==typeof l){const s=l.match(/item-(\d+)/)?.[1];this.itemNumber=s||"";const i=this.host.querySelector(`#accordion-${e.id}`);salla.cart.deleteItem(`${this.itemNumber}?product_id=${e.id}&section_id=${t}`).then((()=>i?.remove()))}}}renderRemoveButton(t,s,l=!1){return e("salla-button",{type:"button",shape:l?"btn":"icon",fill:l?"outline":"solid",size:"small",color:"danger","aria-label":"Remove from the cart",onClick:()=>this.deleteItem(t,s)},l?salla.lang.get("common.elements.delete"):e("i",{class:"sicon-cancel"}))}renderAccordionHeader(t,s){const l=s?.options&&s?.options?.length>0;return e("div",{slot:"html",class:"s-multiple-bundle-product-cart-header-wrapper"},e("div",{class:"s-multiple-bundle-product-cart-header "+(l?"":"s-multiple-bundle-product-cart-header-no-options")},e("div",{class:"s-multiple-bundle-product-cart-header-content"},e("a",{href:s?.url,class:"s-multiple-bundle-product-cart-header-image-wrapper"},e("img",{src:s?.image?.url,alt:s?.image?.alt||s?.name,class:"s-multiple-bundle-product-cart-header-image"})),e("div",{class:"s-multiple-bundle-product-cart-header-content-details"},e("h2",{class:"s-multiple-bundle-product-cart-header-content-details-title"},e("a",{href:s?.url,class:"s-multiple-bundle-product-cart-header-content-details-title-link"},s?.name)),e("div",{class:"s-multiple-bundle-product-cart-header-content-details-price"},e("span",{class:"s-multiple-bundle-product-cart-header-content-details-price-regular"},e("span",{innerHTML:s?.price?salla.money(s?.price):""})),s?.sale_price>0&&e("span",{class:"s-multiple-bundle-product-cart-header-content-details-price-sale"},e("span",{innerHTML:salla.money(s?.sale_price)}))),s?.quantity_in_group>0&&0!==s?.quantity&&e("p",{class:"s-multiple-bundle-product-cart-header-content-details-quantity"},e("span",null,salla.lang.get("pages.products.number_of_pieces")),e("span",null,s?.quantity_in_group)))),!l&&e("div",{class:"s-multiple-bundle-product-cart-header-remove-button"},this.renderRemoveButton(t,s,!1))))}render(){return e(s,{key:"78be7c4a3be811adb01cb1437473fcd9f1c17b41",class:"s-multiple-bundle-product-wrapper"},e("div",{key:"9b0439dffc9a2dd8d31f56dacb5d835cde903e71",class:"s-multiple-bundle-product-wrapper-sections"},this.sections.map(((t,s)=>t.products.map((l=>{const i={sectionId:t.id,sectionIndex:s,productId:l.id};return e("salla-accordion",{key:l.id,collapsed:!1,bordered:!0,collapsible:!!(l.options&&l.options.length>0),size:"sm",id:`accordion-${l.id}`},e("salla-accordion-head",null,this.renderAccordionHeader(String(t.id),l)),l.options&&l.options.length>0&&e("salla-accordion-body",null,e("salla-product-options",{options:JSON.stringify(l.options),key:`${l.id}-persistent`,"product-id":l.id,"bundle-context":JSON.stringify(i)}),e("div",{class:"s-multiple-bundle-product-cart-body-remove-button"},this.renderRemoveButton(String(t.id),l,!0))))}))))))}get host(){return l(this)}};n.style="";const c=class{constructor(e){t(this,e),this.sections=[],this.selectedProducts={},this.productSelectedHandler=null,this.onSelectProduct=(t,e)=>{const s=e.id,l=this.selectedProducts[t]?.has(s)??!1,i=this.sections.find((e=>e.id==t));if(!(l&&i&&this.isProductSelectionLocked(i))){if(!l){if(!i)return;if(1!==this.getEffectiveMax(i)&&this.isAtSelectionLimit(i))return}this.selectedProducts={...this.selectedProducts,[t]:new Set(this.selectedProducts[t]||[])},l?(this.selectedProducts[t].delete(s),this.clearProductFormData(s,t),this.clearProductModalOptions(s,t)):1===this.getEffectiveMax(i)?this.syncSectionSelection(t,s):this.selectedProducts[t].add(s),this.selectedProducts={...this.selectedProducts},salla.event.dispatch("on-bundle-product-selected",{id:e.id,name:e.name,options:e.options,wasSelected:l,isSelected:!l})}},this.ensureProductSelected=(t,e)=>{this.selectedProducts={...this.selectedProducts,[t]:new Set(this.selectedProducts[t]||[])};const s=e.id;if(this.selectedProducts[t].has(s))return;const l=this.sections.find((e=>e.id==t));if(!l)return;const i=this.getEffectiveMax(l);if(1===i)this.syncSectionSelection(t,s);else{if(i>1&&this.isAtSelectionLimit(l))return;this.selectedProducts[t].add(s)}this.selectedProducts={...this.selectedProducts},salla.event.dispatch("on-bundle-product-selected",{id:e.id,name:e.name,options:e.options})},this.onSelectProductOptions=(t,e)=>{const s=this.sections.find((t=>t.id==e));if(!s||!this.canSelectProductInSection(s,t.id))return;const l=this.sections.findIndex((t=>t.id==e)),i=s.products?.findIndex((e=>e.id==t.id))??0,n=this.selectedProducts[e]?.has(t.id)??!1;salla.event.dispatch("multiple-bundle-product-modal::open",{product:t,sectionId:e,sectionIndex:l,productIndex:i,isProductAlreadySelected:n})},this.handleBundleSliderProductSelected=t=>{const{product:e,sectionId:s}=t.detail;this.onSelectProduct(s,e)},this.handleBundleSliderProductOptionsSelected=t=>{const{product:e,sectionId:s}=t.detail;this.onSelectProductOptions(e,s)}}isSingleProductSection(t){return 1===(t.products?.length??0)}getObligatoryMin(t){const e=t.obligatory_products;if(null==e)return 0;const s=Number(e);return Number.isNaN(s)?0:s}isProductSelectionLocked(t){return this.isSingleProductSection(t)&&1===this.getObligatoryMin(t)}getEffectiveMax(t){const e=t.products?.length??0,s=t.max_obligatory_products;return null!=s&&s>0?Math.min(s,e):e}getSelectedCount(t){return this.selectedProducts[t]?.size??0}isAtSelectionLimit(t){return this.getSelectedCount(t.id)>=this.getEffectiveMax(t)}canSelectProductInSection(t,e){return!!this.selectedProducts[t.id]?.has(e)||1===this.getEffectiveMax(t)||!this.isAtSelectionLimit(t)}async canSelectBundleProduct(t,e){const s=this.sections.find((e=>e.id==t));return!!s&&this.canSelectProductInSection(s,e)}queryProductCheckbox(t,e){const s=`input.s-multiple-bundle-product-checkbox[name="bundle[${t}][${e}][id]"]`,l=this.host.closest("form"),i=l?.querySelector(s);if(i)return i;for(const t of this.host.querySelectorAll("salla-multiple-bundle-product-slider")){const e=(t.shadowRoot??t).querySelector(s);if(e)return e}return null}dispatchBubblingChange(t){requestAnimationFrame((()=>{t.dispatchEvent(new window.Event("change",{bubbles:!0}))}))}clearSectionProductSlot(t,e,s){const l=this.queryProductCheckbox(t,s);l&&(l.checked=!1);const i=this.host.closest("form");if(i){const e=`bundle[${t}][${s}]`;Array.from(i.querySelectorAll("input")).forEach((t=>{t.name?.startsWith(e)&&("checkbox"===t.type&&t.name?.endsWith("][id]")?t.checked=!1:t.remove())}))}this.clearProductModalOptions(e,t)}syncSectionSelection(t,e){const s=this.sections.find((e=>e.id==t));s?.products?.forEach(((s,l)=>{s.id!=e&&this.clearSectionProductSlot(t,s.id,l)})),this.selectedProducts[t]=new Set([e]);const l=s?.products?.findIndex((t=>t.id==e))??-1,i=l>=0?this.queryProductCheckbox(t,l):null;i&&(i.checked=!0,this.dispatchBubblingChange(i))}autoSelectSingleProductSections(){if(!this.sections?.length)return;const t={...this.selectedProducts};let e=!1;const s=[];for(const l of this.sections){if(!this.isProductSelectionLocked(l))continue;const i=l.products?.[0];if(!i||!i.unlimited_quantity&&(i.quantity??0)<=0)continue;const n=l.id,c=new Set(t[n]||[]);c.has(i.id)||(c.add(i.id),t[n]=c,e=!0,s.push({product:i}))}e&&(this.selectedProducts=t,s.forEach((({product:t})=>{salla.event.dispatch("on-bundle-product-selected",{id:t.id,name:t.name,options:t.options})})))}clearProductFormData(t,e){if(null!=e){const s=this.sections.find((t=>t.id==e)),l=s?.products?.findIndex((e=>e.id==t))??-1;if(l>=0)return void this.clearSectionProductSlot(e,t,l)}const s=this.host.closest("form");s&&s.querySelectorAll(`[data-product-id="${t}"]`).forEach((t=>t.remove()))}clearProductModalOptions(t,e){let s=null,l=null;if(null!=e&&(s=this.sections.findIndex((t=>t.id==e)),s>-1)){const e=this.sections[s];if(e){const s=e.products?.findIndex((e=>e.id==t));l="number"==typeof s&&s>-1?s:null}}salla.event.dispatch("multiple-bundle-product-modal::clear-options",{productId:t,sectionId:e,sectionIndex:s,productIndex:l})}getProgressStatus(t){const e=this.getSelectedCount(t.id),s=this.getEffectiveMax(t);return s>0?`${e}/${s}`:"0"}getSectionSelectionNote(t){const e=this.getObligatoryMin(t),s=Number(t.max_obligatory_products)||0,l=e>0,i=s>0;return l||i?l&&i?e===s?salla.lang.getWithDefault("pages.products.bundle_select_exact",`اختر ${e} منتجات`,{count:e}):salla.lang.getWithDefault("pages.products.bundle_select_range",`اختر من ${e} إلى ${s} منتجات`,{min:e,max:s}):l?salla.lang.getWithDefault("pages.products.bundle_select_min",`اختر على الأقل ${e} منتجات`,{min:e}):salla.lang.getWithDefault("pages.products.bundle_select_max",`اختر حتى ${s} منتجات`,{max:s}):null}handleSectionsChange(){this.autoSelectSingleProductSections()}componentWillLoad(){this.autoSelectSingleProductSections()}renderAccordionHeader(t){const s=this.getSectionSelectionNote(t);return e(i,null,e("h2",{slot:"title"},t?.name),s?e("span",{slot:"note"},s):null,e("span",{slot:"progress"},this.getProgressStatus(t)))}componentDidLoad(){const t=this.host.querySelector("salla-multiple-bundle-product-options-modal");t&&(this.productSelectedHandler=t=>{const{productId:e,sectionId:s,product:l,fromModal:i}=t.detail;i?this.ensureProductSelected(s,l||{id:e}):this.onSelectProduct(s,l||{id:e})},t.addEventListener("productSelected",this.productSelectedHandler))}disconnectedCallback(){if(this.productSelectedHandler){const t=this.host.querySelector("salla-multiple-bundle-product-options-modal");t&&t.removeEventListener("productSelected",this.productSelectedHandler),this.productSelectedHandler=null}}render(){return e(s,{key:"1ba2cde8fad73b16cfc2ccdd5e68331a9e3fdb7a",class:"s-multiple-bundle-product-wrapper"},e("div",{key:"a72d9fc9f3df30616d3d0696c755db4e76c9a153",class:"s-multiple-bundle-product-wrapper-sections"},this.sections.map(((t,s)=>e("salla-accordion",{key:t.id,collapsed:0!==s},e("salla-accordion-head",null,this.renderAccordionHeader(t)),e("salla-accordion-body",null,e("salla-multiple-bundle-product-slider",{section:t,sectionIndex:s,selectedProducts:this.selectedProducts,selectionLimit:this.getEffectiveMax(t),isSelectionLocked:this.isProductSelectionLocked(t),onProductSelected:this.handleBundleSliderProductSelected,onProductOptionsSelected:this.handleBundleSliderProductOptionsSelected})))))),e("salla-multiple-bundle-product-options-modal",{key:"1e2f996c2d995c62ae29dedc90826a1f1d0a1320"}))}get host(){return l(this)}static get watchers(){return{sections:["handleSectionsChange"]}}};c.style="";export{n as salla_multiple_bundle_product_cart,c as salla_multiple_bundle_product_details}
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r as e,h as r,F as t,H as o}from"./p-D6VagDRi.js";const i=class{constructor(r){e(this,r)}parseOrderDetailsData(e){this.parsedOrderDetailsData=e,this.parsedOrderDetailsData="string"==typeof this.orderDetails?JSON.parse(e):e}componentWillLoad(){this.parseOrderDetailsData(this.orderDetails),console.log("Parent componentWillLoad - parsedOrderDetailsData:",this.parsedOrderDetailsData)}renderOrderDetailsContent(){return this.parsedOrderDetailsData?[this.parsedOrderDetailsData.options&&this.parsedOrderDetailsData.options.length>0&&r("salla-order-details-options",{options:this.parsedOrderDetailsData.options}),this.parsedOrderDetailsData.sub_products&&this.parsedOrderDetailsData.sub_products.length>0&&r(t,null,r("h2",{class:"s-order-details-bundle-title"},salla.lang.get("pages.orders.sub_products")),r("div",{class:"s-order-details-bundle-content"},this.parsedOrderDetailsData.sub_products.map((e=>r("salla-order-details-multiple-bundle-product",{key:e?.id,productDetails:e})))))]:(console.warn("No parsedOrderDetailsData available"),null)}render(){return r(o,{key:"ffa22cae6c347b5acbe4836378f1f3843184e8f5",class:"s-order-details-wrapper"},this.renderOrderDetailsContent())}static get watchers(){return{orderDetails:["parseOrderDetailsData"]}}};i.style='/*!twlt*/.s-order-details-multiple-bundle-product{display:flex;height:auto;width:100%;flex-direction:column;align-items:flex-start;justify-content:flex-start;border-radius:0.5rem;--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1));outline:2px solid transparent;outline-offset:0px}.s-order-details-wrapper{display:block}.s-order-details-bundle-content{display:flex;flex-direction:column;gap:1rem;padding-top:1rem;padding-bottom:1rem}.s-order-details-bundle-title{margin-bottom:0.75rem;font-size:0.875rem;line-height:1.25rem;font-weight:700}.s-order-details-product{display:flex;align-items:center;justify-content:space-between;gap:0.75rem}.s-order-details-product-content{min-width:0px}.s-order-details-product-info{display:flex;flex-wrap:wrap;align-items:center;gap:0.5rem;font-size:0.75rem;line-height:1rem;--tw-text-opacity:1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.s-order-details-product-image{display:flex;height:3.5rem;width:3.5rem;flex-shrink:0;align-items:center;justify-content:center;overflow:hidden;border-radius:0.375rem;border-width:1px;--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))}.s-order-details-product-image img{height:100%;width:100%;object-fit:cover}.s-order-details-product-details{display:flex;min-width:0px;flex-grow:1;flex-direction:column;gap:0.25rem}.s-order-details-product-name{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:0.875rem;line-height:1.25rem;font-weight:600;--tw-text-opacity:1;color:rgb(55 65 81 / var(--tw-text-opacity, 1));text-decoration-line:none}.s-order-details-product-name:hover{color:var(--color-primary)}.s-order-details-product-price{font-size:0.875rem;line-height:1.25rem;font-weight:600;--tw-text-opacity:1;color:rgb(17 24 39 / var(--tw-text-opacity, 1))}.s-order-details-product-price-sale{--tw-text-opacity:1;color:rgb(220 38 38 / var(--tw-text-opacity, 1))}.s-order-details-product-regular-price{font-size:0.75rem;line-height:1rem;--tw-text-opacity:1;color:rgb(156 163 175 / var(--tw-text-opacity, 1));text-decoration-line:line-through}.s-order-details-product-quantity{font-size:0.75rem;line-height:1rem;--tw-text-opacity:1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.s-order-details-options{margin-top:1rem}.s-order-details-option{display:flex;align-items:center;justify-content:space-between;border-bottom-width:1px;--tw-border-opacity:1;border-color:rgb(243 244 246 / var(--tw-border-opacity, 1));padding-top:0.5rem;padding-bottom:0.5rem}.s-order-details-option:last-child{border-bottom-width:0px}.s-order-details-option-name{font-size:0.875rem;line-height:1.25rem;font-weight:500;--tw-text-opacity:1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.s-order-details-option-value{text-align:right;font-size:0.875rem;line-height:1.25rem;--tw-text-opacity:1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.s-order-details-option-value:where([dir="rtl"],[dir="rtl"] *){text-align:left}.s-order-details-options-title{margin-top:1.25rem;margin-bottom:0.875rem;font-size:0.875rem;line-height:1.25rem;font-weight:700}.s-order-details-options-container{margin-bottom:0.5rem;display:flow-root;border-radius:0.375rem;border-width:1px;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1));padding-left:1rem;padding-right:1rem}.s-order-details-options-container-borderless{margin-bottom:0.5rem;display:flow-root}.s-order-details-options-list>:not([hidden])~:not([hidden]){--tw-divide-y-reverse:0;border-top-width:calc(1px * calc(1 - var(--tw-divide-y-reverse)));border-bottom-width:calc(1px * var(--tw-divide-y-reverse));--tw-divide-opacity:1;border-color:rgb(243 244 246 / var(--tw-divide-opacity, 1))}.s-order-details-options-list{font-size:0.875rem;line-height:1.25rem;--tw-text-opacity:1;color:rgb(24 24 27 / var(--tw-text-opacity, 1))}.s-order-details-options-item{display:flex;align-items:center;justify-content:space-between;padding-top:0.625rem;padding-bottom:0.625rem}.s-order-details-options-item-name{margin-bottom:0.5rem}@media (min-width: 768px){.s-order-details-options-item-name{margin-bottom:0px}}.s-order-details-options-item-value{font-weight:500}.s-order-details-options-item-value-image{font-weight:500;--tw-text-opacity:1;color:rgb(17 24 39 / var(--tw-text-opacity, 1))}.s-order-details-options-item-value-text{font-size:0.75rem;line-height:1rem;font-weight:500}.s-order-details-option-image-container{display:flex}.s-order-details-option-image-container>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-right:calc(0.625rem * var(--tw-space-x-reverse));margin-left:calc(0.625rem * calc(1 - var(--tw-space-x-reverse)))}.s-order-details-option-image-container:where([dir="rtl"],[dir="rtl"] *)>:not([hidden])~:not([hidden]){--tw-space-x-reverse:1}.s-order-details-option-image{height:1.5rem;width:1.5rem;border-radius:0.375rem;object-fit:cover}.s-order-details-option-color-swatch{display:inline-block;height:1.5rem;width:1.5rem;border-radius:9999px;--tw-shadow:0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px 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-order-details-option-color-swatch:where([dir="ltr"],[dir="ltr"] *){margin-left:0.5rem}.s-order-details-option-color-swatch:where([dir="rtl"],[dir="rtl"] *){margin-right:0.5rem}.s-order-details-option-file-link{font-size:0.875rem;line-height:1.25rem;color:var(--color-primary);text-decoration-line:underline}.s-order-details-option-color-picker{display:flex;width:fit-content;border-radius:var(--s-radius, 0.25rem);border-width:1px;--tw-border-opacity:1;border-color:rgb(243 244 246 / var(--tw-border-opacity, 1))}.s-order-details-option-color-picker-content{display:flex;align-items:center;--tw-border-opacity:1;border-color:rgb(243 244 246 / var(--tw-border-opacity, 1))}.s-order-details-option-color-picker-content:where([dir="ltr"],[dir="ltr"] *){border-right-width:1px;padding-right:0.25rem}.s-order-details-option-color-picker-content:where([dir="rtl"],[dir="rtl"] *){border-left-width:1px;padding-left:0.25rem}.s-order-details-option-color-picker-text{padding-left:0.25rem;padding-right:0.25rem;font-size:0.75rem;line-height:1rem}.s-order-details-option-color-picker-swatch{display:inline-block;height:1rem;border-radius:var(--s-radius, 0.25rem);border-width:1px;--tw-border-opacity:1;border-color:rgb(243 244 246 / var(--tw-border-opacity, 1));padding:0.25rem;--tw-shadow:0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px 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-order-details-option-color-picker-swatch:where([dir="ltr"],[dir="ltr"] *){margin-left:0.25rem}.s-order-details-option-color-picker-swatch:where([dir="rtl"],[dir="rtl"] *){margin-right:0.25rem}.s-order-details-option-color-picker-button{padding-left:0.25rem;padding-right:0.25rem;padding-top:0.25rem}.s-order-details-option-color-picker-icon{pointer-events:none;font-size:0.875rem;line-height:1.25rem;--tw-text-opacity:1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.s-order-details-option-map-button{font-size:0.875rem;line-height:1.25rem;color:var(--color-primary)}.s-order-details-option-default-text{font-size:0.75rem;line-height:1rem}.s-order-details-option-color-copy-icon svg{height:1rem;width:1rem;fill:#6b7280}';export{i as salla_order_details}
4
+ import{r as e,h as r,F as t,H as o}from"./p-CinT9kfz.js";const i=class{constructor(r){e(this,r)}parseOrderDetailsData(e){this.parsedOrderDetailsData=e,this.parsedOrderDetailsData="string"==typeof this.orderDetails?JSON.parse(e):e}componentWillLoad(){this.parseOrderDetailsData(this.orderDetails),console.log("Parent componentWillLoad - parsedOrderDetailsData:",this.parsedOrderDetailsData)}renderOrderDetailsContent(){return this.parsedOrderDetailsData?[this.parsedOrderDetailsData.options&&this.parsedOrderDetailsData.options.length>0&&r("salla-order-details-options",{options:this.parsedOrderDetailsData.options}),this.parsedOrderDetailsData.sub_products&&this.parsedOrderDetailsData.sub_products.length>0&&r(t,null,r("h2",{class:"s-order-details-bundle-title"},salla.lang.get("pages.orders.sub_products")),r("div",{class:"s-order-details-bundle-content"},this.parsedOrderDetailsData.sub_products.map((e=>r("salla-order-details-multiple-bundle-product",{key:e?.id,productDetails:e})))))]:(console.warn("No parsedOrderDetailsData available"),null)}render(){return r(o,{key:"ffa22cae6c347b5acbe4836378f1f3843184e8f5",class:"s-order-details-wrapper"},this.renderOrderDetailsContent())}static get watchers(){return{orderDetails:["parseOrderDetailsData"]}}};i.style='/*!twlt*/.s-order-details-multiple-bundle-product{display:flex;height:auto;width:100%;flex-direction:column;align-items:flex-start;justify-content:flex-start;border-radius:0.5rem;--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1));outline:2px solid transparent;outline-offset:0px}.s-order-details-wrapper{display:block}.s-order-details-bundle-content{display:flex;flex-direction:column;gap:1rem;padding-top:1rem;padding-bottom:1rem}.s-order-details-bundle-title{margin-bottom:0.75rem;font-size:0.875rem;line-height:1.25rem;font-weight:700}.s-order-details-product{display:flex;align-items:center;justify-content:space-between;gap:0.75rem}.s-order-details-product-content{min-width:0px}.s-order-details-product-info{display:flex;flex-wrap:wrap;align-items:center;gap:0.5rem;font-size:0.75rem;line-height:1rem;--tw-text-opacity:1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.s-order-details-product-image{display:flex;height:3.5rem;width:3.5rem;flex-shrink:0;align-items:center;justify-content:center;overflow:hidden;border-radius:0.375rem;border-width:1px;--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))}.s-order-details-product-image img{height:100%;width:100%;object-fit:cover}.s-order-details-product-details{display:flex;min-width:0px;flex-grow:1;flex-direction:column;gap:0.25rem}.s-order-details-product-name{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:0.875rem;line-height:1.25rem;font-weight:600;--tw-text-opacity:1;color:rgb(55 65 81 / var(--tw-text-opacity, 1));text-decoration-line:none}.s-order-details-product-name:hover{color:var(--color-primary)}.s-order-details-product-price{font-size:0.875rem;line-height:1.25rem;font-weight:600;--tw-text-opacity:1;color:rgb(17 24 39 / var(--tw-text-opacity, 1))}.s-order-details-product-price-sale{--tw-text-opacity:1;color:rgb(220 38 38 / var(--tw-text-opacity, 1))}.s-order-details-product-regular-price{font-size:0.75rem;line-height:1rem;--tw-text-opacity:1;color:rgb(156 163 175 / var(--tw-text-opacity, 1));text-decoration-line:line-through}.s-order-details-product-quantity{font-size:0.75rem;line-height:1rem;--tw-text-opacity:1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.s-order-details-options{margin-top:1rem}.s-order-details-option{display:flex;align-items:center;justify-content:space-between;border-bottom-width:1px;--tw-border-opacity:1;border-color:rgb(243 244 246 / var(--tw-border-opacity, 1));padding-top:0.5rem;padding-bottom:0.5rem}.s-order-details-option:last-child{border-bottom-width:0px}.s-order-details-option-name{font-size:0.875rem;line-height:1.25rem;font-weight:500;--tw-text-opacity:1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.s-order-details-option-value{text-align:right;font-size:0.875rem;line-height:1.25rem;--tw-text-opacity:1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.s-order-details-option-value:where([dir="rtl"],[dir="rtl"] *){text-align:left}.s-order-details-options-title{margin-top:1.25rem;margin-bottom:0.875rem;font-size:0.875rem;line-height:1.25rem;font-weight:700}.s-order-details-options-container{margin-bottom:0.5rem;display:flow-root;border-radius:0.375rem;border-width:1px;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1));padding-left:1rem;padding-right:1rem}.s-order-details-options-container-borderless{margin-bottom:0.5rem;display:flow-root}.s-order-details-options-list>:not([hidden])~:not([hidden]){--tw-divide-y-reverse:0;border-top-width:calc(1px * calc(1 - var(--tw-divide-y-reverse)));border-bottom-width:calc(1px * var(--tw-divide-y-reverse));--tw-divide-opacity:1;border-color:rgb(243 244 246 / var(--tw-divide-opacity, 1))}.s-order-details-options-list{font-size:0.875rem;line-height:1.25rem;--tw-text-opacity:1;color:rgb(24 24 27 / var(--tw-text-opacity, 1))}.s-order-details-options-item{display:flex;align-items:center;justify-content:space-between;padding-top:0.625rem;padding-bottom:0.625rem}.s-order-details-options-item-name{margin-bottom:0.5rem}@media (min-width: 768px){.s-order-details-options-item-name{margin-bottom:0px}}.s-order-details-options-item-value{font-weight:500}.s-order-details-options-item-value-image{font-weight:500;--tw-text-opacity:1;color:rgb(17 24 39 / var(--tw-text-opacity, 1))}.s-order-details-options-item-value-text{font-size:0.75rem;line-height:1rem;font-weight:500}.s-order-details-option-image-container{display:flex}.s-order-details-option-image-container>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-right:calc(0.625rem * var(--tw-space-x-reverse));margin-left:calc(0.625rem * calc(1 - var(--tw-space-x-reverse)))}.s-order-details-option-image-container:where([dir="rtl"],[dir="rtl"] *)>:not([hidden])~:not([hidden]){--tw-space-x-reverse:1}.s-order-details-option-image{height:1.5rem;width:1.5rem;border-radius:0.375rem;object-fit:cover}.s-order-details-option-color-swatch{display:inline-block;height:1.5rem;width:1.5rem;border-radius:9999px;--tw-shadow:0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px 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-order-details-option-color-swatch:where([dir="ltr"],[dir="ltr"] *){margin-left:0.5rem}.s-order-details-option-color-swatch:where([dir="rtl"],[dir="rtl"] *){margin-right:0.5rem}.s-order-details-option-file-link{font-size:0.875rem;line-height:1.25rem;color:var(--color-primary);text-decoration-line:underline}.s-order-details-option-color-picker{display:flex;width:fit-content;border-radius:var(--s-radius, 0.25rem);border-width:1px;--tw-border-opacity:1;border-color:rgb(243 244 246 / var(--tw-border-opacity, 1))}.s-order-details-option-color-picker-content{display:flex;align-items:center;--tw-border-opacity:1;border-color:rgb(243 244 246 / var(--tw-border-opacity, 1))}.s-order-details-option-color-picker-content:where([dir="ltr"],[dir="ltr"] *){border-right-width:1px;padding-right:0.25rem}.s-order-details-option-color-picker-content:where([dir="rtl"],[dir="rtl"] *){border-left-width:1px;padding-left:0.25rem}.s-order-details-option-color-picker-text{padding-left:0.25rem;padding-right:0.25rem;font-size:0.75rem;line-height:1rem}.s-order-details-option-color-picker-swatch{display:inline-block;height:1rem;border-radius:var(--s-radius, 0.25rem);border-width:1px;--tw-border-opacity:1;border-color:rgb(243 244 246 / var(--tw-border-opacity, 1));padding:0.25rem;--tw-shadow:0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px 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-order-details-option-color-picker-swatch:where([dir="ltr"],[dir="ltr"] *){margin-left:0.25rem}.s-order-details-option-color-picker-swatch:where([dir="rtl"],[dir="rtl"] *){margin-right:0.25rem}.s-order-details-option-color-picker-button{padding-left:0.25rem;padding-right:0.25rem;padding-top:0.25rem}.s-order-details-option-color-picker-icon{pointer-events:none;font-size:0.875rem;line-height:1.25rem;--tw-text-opacity:1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.s-order-details-option-map-button{font-size:0.875rem;line-height:1.25rem;color:var(--color-primary)}.s-order-details-option-default-text{font-size:0.75rem;line-height:1rem}.s-order-details-option-color-copy-icon svg{height:1rem;width:1rem;fill:#6b7280}';export{i as salla_order_details}
@@ -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-D6VagDRi.js";var i='\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-off</title>\n<path d="M10.837 19.309c-4.963 1.284-8.171 4.303-8.171 7.691v3.667c0 0.736 0.597 1.333 1.333 1.333s1.333-0.597 1.333-1.333v-3.667c0-2.101 2.48-4.155 6.172-5.109 0.713-0.184 1.141-0.912 0.957-1.625-0.184-0.711-0.908-1.137-1.625-0.956zM12.859 3.715c0.933-0.685 2.020-1.048 3.141-1.048 2.941 0 5.333 2.392 5.333 5.333 0 1.121-0.363 2.208-1.048 3.141-0.436 0.593-0.308 1.428 0.284 1.864 0.239 0.175 0.515 0.259 0.788 0.259 0.411 0 0.815-0.188 1.076-0.544 1.025-1.393 1.567-3.025 1.567-4.72 0-4.412-3.588-8-8-8-1.695 0-3.327 0.541-4.721 1.567-0.592 0.435-0.72 1.269-0.284 1.864 0.436 0.593 1.269 0.721 1.864 0.284zM31.609 29.724l-29.333-29.333c-0.521-0.521-1.364-0.521-1.885 0s-0.521 1.364 0 1.885l29.333 29.333c0.26 0.26 0.601 0.391 0.943 0.391s0.683-0.131 0.943-0.391c0.521-0.521 0.521-1.364 0-1.885z"></path>\n</svg>\n';const r=class{constructor(t){e(this,t),this.otpInputs=[],this.isDeleteAccountEnabled=!!salla.config.get("store.features",[])?.includes("customer-account-deletion"),this.deactivateAccount=salla.lang.get("pages.profile.deactivate_account"),this.deactivateDesc=salla.lang.get("pages.profile.deactivate_account_description"),this.sorryForLeavingText=salla.lang.get("pages.profile.warning_for_deactivate"),this.warningText=salla.lang.get("pages.profile.sorry_for_leaving"),this.keepAccount=salla.lang.get("pages.profile.keep_account"),this.buttonLoading=!1,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.isDeleteAccountEnabled&&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.deactivateAccount=salla.lang.get("pages.profile.deactivate_account"),this.deactivateDesc=salla.lang.get("pages.profile.deactivate_account_description"),this.sorryForLeavingText=salla.lang.get("pages.profile.warning_for_deactivate"),this.warningText=salla.lang.get("pages.profile.sorry_for_leaving"),this.keepAccount=salla.lang.get("pages.profile.keep_account"),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()}openDeactivateModal(){this.confirmationModal.setTitle(this.capitalizeText(this.deactivateAccount)),this.confirmationModal.open()}async confirmDeactivateAccount(){this.buttonLoading=!0,await salla.profile.delete().finally((()=>{this.buttonLoading=!1,this.confirmationModal.close()}))}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:"ec31f48a8214240020804541d58e1745c429f2a5",class:"s-user-settings-wrapper"},this.canHideName&&t("div",{key:"1a4fb3a3e47729891772838df0dca41f52e5d017",class:"s-user-settings-section"},t("salla-list-tile",{key:"f965243eca4953d588ea6ef27a581f00839482ff"},t("div",{key:"d08fb75de39b78c02455b9ede326e0563a675762",slot:"icon",class:"s-user-settings-section-icon"},t("span",{key:"4bacfb410376c98a14c7289968293a5c06520bbd",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:"61bbccd47940a87db9faee8a6a305aff0b5f0783",slot:"title",class:"s-user-settings-section-title"},this.capitalizeText(this.hideMyName)),t("div",{key:"3b02ec766d677d37d09df8ae91fae883b3e8b35d",slot:"subtitle",class:"s-user-settings-section-subtitle"},this.capitalizeText(this.hideMyNameDesc)),t("div",{key:"da7358399c5e1e8a94082585820f44e2de9d352d",slot:"action",class:"s-user-settings-section-action"},t("label",{key:"f64e96e150cd78ed41b104d845774ae31187a33e",class:"s-toggle"},t("input",{key:"69b07baebf7c0869c37b29a920851be99dbfddc8",class:"s-toggle-input",checked:this.isHiddenName,onChange:e=>this.toggleSetting("is_hidden_name",e),type:"checkbox"}),t("div",{key:"94e8675dcb56084c0581fb26f96ce0122c8898e5",class:"s-toggle-switcher"}))))),t("div",{key:"940db4113264ca36dc5283d17597a85d85c4b5b4",class:"s-user-settings-section"},t("salla-list-tile",{key:"f6c8e5cbebb295826be0bfac8ae427df9cf692bf"},t("div",{key:"c81a3c392df36b97777d74521482266a9444a79c",slot:"icon",class:"s-user-settings-section-icon"},t("span",{key:"1a5a19818579890be2ecb12848e30cf034f8569b",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:"5849731b90184af7225d120b5e1077e49301e379",slot:"title",class:"s-user-settings-section-title"},this.capitalizeText(this.promotionalMsgs)),t("div",{key:"3aeda4ebfa9715d81272dd4be1e5b223f43d79fe",slot:"subtitle",class:"s-user-settings-section-subtitle"},this.capitalizeText(this.promotionalMsgsDesc)),t("div",{key:"60db45c279de365c10ae40ba486afd8609f5d2b2",slot:"action",class:"s-user-settings-section-action"},t("label",{key:"1b855ffd24570fe90badbd18bbab2c8032f320b7",class:"s-toggle"},t("input",{key:"9cdd0d736ed9baf0f5628803a9a4b93c5389cc51",class:"s-toggle-input",checked:this.isNotifiable,onChange:e=>this.toggleSetting("is_notifiable",e),type:"checkbox"}),t("div",{key:"35ba9556185bb4991fc91b343573e723cd888115",class:"s-toggle-switcher"}))))),this.isDeleteAccountEnabled?t("div",{class:"s-user-settings-section s-user-settings-section-delete-user"},t("salla-list-tile",null,t("div",{slot:"icon",class:"s-user-settings-section-icon"},this.renderUserDeleteIcon()),t("div",{slot:"title",class:"s-user-settings-section-title"},this.capitalizeText(this.deleteAccount)),t("div",{slot:"subtitle",class:"s-user-settings-section-subtitle"},this.capitalizeText(this.isDeletePending?this.deleteAccountPending:this.deleteAccountDesc)),t("div",{slot:"action",class:"s-user-settings-section-action"},this.renderDeleteSectionAction()))):t("div",{class:"s-user-settings-section s-user-settings-section-deactivate-user"},t("salla-list-tile",null,t("div",{slot:"icon",class:"s-user-settings-section-icon"},t("span",{innerHTML:i})),t("div",{slot:"title",class:"s-user-settings-section-title"},this.capitalizeText(this.deactivateAccount)),t("div",{slot:"subtitle",class:"s-user-settings-section-subtitle"},this.capitalizeText(this.deactivateDesc)),t("div",{slot:"action",class:"s-user-settings-section-action"},t("salla-button",{fill:"outline",color:"danger",shape:"btn",size:"medium",width:"normal",onClick:()=>this.openDeactivateModal()},this.capitalizeText(this.deactivateAccount))))),this.isDeleteAccountEnabled?t("salla-modal",{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())):t("salla-modal",{width:"sm",subTitle:this.capitalizeText(this.sorryForLeavingText),ref:e=>this.confirmationModal=e},t("span",{slot:"icon",class:"s-user-settings-confirmation-icon",innerHTML:i}),t("div",{class:"s-user-settings-confirmation"},t("div",{class:"s-user-settings-confirmation-warning"},this.capitalizeText(this.warningText)),t("div",{class:"s-user-settings-confirmation-actions"},t("salla-button",{width:"wide",onClick:()=>this.confirmationModal.close()},this.capitalizeText(this.keepAccount)),t("salla-button",{fill:"outline",loading:this.buttonLoading,width:"wide",onClick:()=>this.confirmDeactivateAccount()},this.capitalizeText(this.deactivateAccount))))))}};r.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{r as salla_user_settings}
4
+ import{r as e,h as t,H as s}from"./p-CinT9kfz.js";var i='\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-off</title>\n<path d="M10.837 19.309c-4.963 1.284-8.171 4.303-8.171 7.691v3.667c0 0.736 0.597 1.333 1.333 1.333s1.333-0.597 1.333-1.333v-3.667c0-2.101 2.48-4.155 6.172-5.109 0.713-0.184 1.141-0.912 0.957-1.625-0.184-0.711-0.908-1.137-1.625-0.956zM12.859 3.715c0.933-0.685 2.020-1.048 3.141-1.048 2.941 0 5.333 2.392 5.333 5.333 0 1.121-0.363 2.208-1.048 3.141-0.436 0.593-0.308 1.428 0.284 1.864 0.239 0.175 0.515 0.259 0.788 0.259 0.411 0 0.815-0.188 1.076-0.544 1.025-1.393 1.567-3.025 1.567-4.72 0-4.412-3.588-8-8-8-1.695 0-3.327 0.541-4.721 1.567-0.592 0.435-0.72 1.269-0.284 1.864 0.436 0.593 1.269 0.721 1.864 0.284zM31.609 29.724l-29.333-29.333c-0.521-0.521-1.364-0.521-1.885 0s-0.521 1.364 0 1.885l29.333 29.333c0.26 0.26 0.601 0.391 0.943 0.391s0.683-0.131 0.943-0.391c0.521-0.521 0.521-1.364 0-1.885z"></path>\n</svg>\n';const r=class{constructor(t){e(this,t),this.otpInputs=[],this.isDeleteAccountEnabled=!!salla.config.get("store.features",[])?.includes("customer-account-deletion"),this.deactivateAccount=salla.lang.get("pages.profile.deactivate_account"),this.deactivateDesc=salla.lang.get("pages.profile.deactivate_account_description"),this.sorryForLeavingText=salla.lang.get("pages.profile.warning_for_deactivate"),this.warningText=salla.lang.get("pages.profile.sorry_for_leaving"),this.keepAccount=salla.lang.get("pages.profile.keep_account"),this.buttonLoading=!1,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.isDeleteAccountEnabled&&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.deactivateAccount=salla.lang.get("pages.profile.deactivate_account"),this.deactivateDesc=salla.lang.get("pages.profile.deactivate_account_description"),this.sorryForLeavingText=salla.lang.get("pages.profile.warning_for_deactivate"),this.warningText=salla.lang.get("pages.profile.sorry_for_leaving"),this.keepAccount=salla.lang.get("pages.profile.keep_account"),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()}openDeactivateModal(){this.confirmationModal.setTitle(this.capitalizeText(this.deactivateAccount)),this.confirmationModal.open()}async confirmDeactivateAccount(){this.buttonLoading=!0,await salla.profile.delete().finally((()=>{this.buttonLoading=!1,this.confirmationModal.close()}))}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:"a281976a9dd190f20ddf5e1e7633cd954407d3b4",class:"s-user-settings-wrapper"},this.canHideName&&t("div",{key:"7291eaadf516b3161d9e4fde3a5dcec7a42bb609",class:"s-user-settings-section"},t("salla-list-tile",{key:"3e23e502b3031de5cfb0a49e9c8bc9756ada92af"},t("div",{key:"d426d601591da1f15c065bce33e4c7b12d0bf047",slot:"icon",class:"s-user-settings-section-icon"},t("span",{key:"e4900a0e5450bc100d22e62a22de331e96958a4c",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:"ec6110960511382dd551421ffd3a036af506109b",slot:"title",class:"s-user-settings-section-title"},this.capitalizeText(this.hideMyName)),t("div",{key:"bdfc4e7f987a7ecd0e3cf8bfeee72f055297e2d6",slot:"subtitle",class:"s-user-settings-section-subtitle"},this.capitalizeText(this.hideMyNameDesc)),t("div",{key:"fad7eb6125789cdf3230314e62552452f4c84fc3",slot:"action",class:"s-user-settings-section-action"},t("label",{key:"f5676bc70508fddad0506410089aa7879e4ef5db",class:"s-toggle"},t("input",{key:"6b57caa5797c1b7225094cf4241a95b7a521327a",class:"s-toggle-input",checked:this.isHiddenName,onChange:e=>this.toggleSetting("is_hidden_name",e),type:"checkbox"}),t("div",{key:"50073a68f078ae3592ea00581a9287f03371e122",class:"s-toggle-switcher"}))))),t("div",{key:"e87388e12354cdd7559ff16c965bc51786d52af5",class:"s-user-settings-section"},t("salla-list-tile",{key:"fc020c81a28c42c0a98fda40ee6f6ffaaa5a20d4"},t("div",{key:"aa90688fca635da561e4eb77309e447d6f5e6b8b",slot:"icon",class:"s-user-settings-section-icon"},t("span",{key:"6448e1268f3c88e72fff6259f195e4b43312253e",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:"ded7da656a1b484e4144c5d8605a55682f7de912",slot:"title",class:"s-user-settings-section-title"},this.capitalizeText(this.promotionalMsgs)),t("div",{key:"a70d94920d012ac5a1d85b17f92b9ce733179569",slot:"subtitle",class:"s-user-settings-section-subtitle"},this.capitalizeText(this.promotionalMsgsDesc)),t("div",{key:"be1325b95063cc822ee4c62d7c7a20bae08fb287",slot:"action",class:"s-user-settings-section-action"},t("label",{key:"181949e51caed49e6c05d10e1a1ae79472772ded",class:"s-toggle"},t("input",{key:"76d423655ebab9004b130adea83f89ec92a27966",class:"s-toggle-input",checked:this.isNotifiable,onChange:e=>this.toggleSetting("is_notifiable",e),type:"checkbox"}),t("div",{key:"44a1ac3c7c6b1f0ac12ccb8853d5c75317ecce2c",class:"s-toggle-switcher"}))))),this.isDeleteAccountEnabled?t("div",{class:"s-user-settings-section s-user-settings-section-delete-user"},t("salla-list-tile",null,t("div",{slot:"icon",class:"s-user-settings-section-icon"},this.renderUserDeleteIcon()),t("div",{slot:"title",class:"s-user-settings-section-title"},this.capitalizeText(this.deleteAccount)),t("div",{slot:"subtitle",class:"s-user-settings-section-subtitle"},this.capitalizeText(this.isDeletePending?this.deleteAccountPending:this.deleteAccountDesc)),t("div",{slot:"action",class:"s-user-settings-section-action"},this.renderDeleteSectionAction()))):t("div",{class:"s-user-settings-section s-user-settings-section-deactivate-user"},t("salla-list-tile",null,t("div",{slot:"icon",class:"s-user-settings-section-icon"},t("span",{innerHTML:i})),t("div",{slot:"title",class:"s-user-settings-section-title"},this.capitalizeText(this.deactivateAccount)),t("div",{slot:"subtitle",class:"s-user-settings-section-subtitle"},this.capitalizeText(this.deactivateDesc)),t("div",{slot:"action",class:"s-user-settings-section-action"},t("salla-button",{fill:"outline",color:"danger",shape:"btn",size:"medium",width:"normal",onClick:()=>this.openDeactivateModal()},this.capitalizeText(this.deactivateAccount))))),this.isDeleteAccountEnabled?t("salla-modal",{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())):t("salla-modal",{width:"sm",subTitle:this.capitalizeText(this.sorryForLeavingText),ref:e=>this.confirmationModal=e},t("span",{slot:"icon",class:"s-user-settings-confirmation-icon",innerHTML:i}),t("div",{class:"s-user-settings-confirmation"},t("div",{class:"s-user-settings-confirmation-warning"},this.capitalizeText(this.warningText)),t("div",{class:"s-user-settings-confirmation-actions"},t("salla-button",{width:"wide",onClick:()=>this.confirmationModal.close()},this.capitalizeText(this.keepAccount)),t("salla-button",{fill:"outline",loading:this.buttonLoading,width:"wide",onClick:()=>this.confirmDeactivateAccount()},this.capitalizeText(this.deactivateAccount))))))}};r.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{r as salla_user_settings}