@salla.sa/twilight-components 2.14.598 → 2.14.600

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 (385) hide show
  1. package/dist/cjs/{filepond-Yrcu23Ew.js → filepond-DVmQ7csb.js} +1 -1
  2. package/dist/cjs/{filepond-plugin-file-poster-DRez16xM.js → filepond-plugin-file-poster-DMSpzTqe.js} +1 -1
  3. package/dist/cjs/{filepond-plugin-file-validate-size-H6Ijvhk2.js → filepond-plugin-file-validate-size-D_ptbEIk.js} +1 -1
  4. package/dist/cjs/{filepond-plugin-file-validate-type-ozbX9Tb-.js → filepond-plugin-file-validate-type-0yFqmcfN.js} +1 -1
  5. package/dist/cjs/{filepond-plugin-image-edit-CynCgK8H.js → filepond-plugin-image-edit-E7sYYAWn.js} +1 -1
  6. package/dist/cjs/{filepond-plugin-image-exif-orientation-C18fCqoh.js → filepond-plugin-image-exif-orientation-DbrEAQoa.js} +1 -1
  7. package/dist/cjs/{filepond-plugin-image-preview-FiRPNiZp.js → filepond-plugin-image-preview-DO_tpcG1.js} +1 -1
  8. package/dist/cjs/{index-CpkvCUQ3.js → index-Bw9ZFzBG.js} +2 -2
  9. package/dist/cjs/{intlTelInput-dW1ObsSS.js → intlTelInput-DxYQu3W_.js} +1 -1
  10. package/dist/cjs/loader.cjs.js +2 -2
  11. package/dist/cjs/salla-accordion-body_2.cjs.entry.js +4 -4
  12. package/dist/cjs/salla-accordion_6.cjs.entry.js +2 -2
  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 +2 -2
  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 +50 -19
  19. package/dist/cjs/salla-attachment-view_9.cjs.entry.js +22 -13
  20. package/dist/cjs/salla-badge.cjs.entry.js +2 -2
  21. package/dist/cjs/salla-basket-gap.cjs.entry.js +1 -1
  22. package/dist/cjs/salla-bullet-delivery_3.cjs.entry.js +1 -1
  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 +1 -1
  29. package/dist/cjs/salla-conditional-offer.cjs.entry.js +1 -1
  30. package/dist/cjs/salla-contacts.cjs.entry.js +60 -29
  31. package/dist/cjs/salla-cookies-bar.cjs.entry.js +1 -1
  32. package/dist/cjs/salla-count-down.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-gift-card-redeem_2.cjs.entry.js +1 -1
  40. package/dist/cjs/salla-gifting.cjs.entry.js +1 -1
  41. package/dist/cjs/salla-hook.cjs.entry.js +1 -1
  42. package/dist/cjs/salla-infinite-scroll.cjs.entry.js +1 -1
  43. package/dist/cjs/salla-installment.cjs.entry.js +1 -1
  44. package/dist/cjs/salla-list-tile.cjs.entry.js +1 -1
  45. package/dist/cjs/salla-localization-modal.cjs.entry.js +1 -1
  46. package/dist/cjs/salla-login-modal.cjs.entry.js +1 -1
  47. package/dist/cjs/salla-loyalty-banner_10.cjs.entry.js +1 -1
  48. package/dist/cjs/salla-loyalty-exchange-product-card.cjs.entry.js +1 -1
  49. package/dist/cjs/salla-loyalty-points-banner.cjs.entry.js +1 -1
  50. package/dist/cjs/salla-loyalty-points-history.cjs.entry.js +1 -1
  51. package/dist/cjs/salla-loyalty-prize-item.cjs.entry.js +1 -1
  52. package/dist/cjs/salla-loyalty.cjs.entry.js +1 -1
  53. package/dist/cjs/salla-maintenance-alert.cjs.entry.js +1 -1
  54. package/dist/cjs/salla-map_3.cjs.entry.js +1 -1
  55. package/dist/cjs/salla-menu.cjs.entry.js +1 -1
  56. package/dist/cjs/salla-metadata.cjs.entry.js +1 -1
  57. package/dist/cjs/salla-multiple-bundle-product-cart_2.cjs.entry.js +1 -1
  58. package/dist/cjs/salla-multiple-bundle-product-options-modal_2.cjs.entry.js +1 -1
  59. package/dist/cjs/salla-multiple-bundle-product.cjs.entry.js +1 -1
  60. package/dist/cjs/salla-next-order-coupon.cjs.entry.js +1 -1
  61. package/dist/cjs/salla-notification-item_2.cjs.entry.js +1 -1
  62. package/dist/cjs/salla-offer-modal.cjs.entry.js +1 -1
  63. package/dist/cjs/salla-offer.cjs.entry.js +1 -1
  64. package/dist/cjs/salla-order-branch.cjs.entry.js +1 -1
  65. package/dist/cjs/salla-order-cancel.cjs.entry.js +1 -1
  66. package/dist/cjs/salla-order-details-multiple-bundle-product.cjs.entry.js +1 -1
  67. package/dist/cjs/salla-order-details-options.cjs.entry.js +1 -1
  68. package/dist/cjs/salla-order-details.cjs.entry.js +1 -1
  69. package/dist/cjs/salla-order-edit-item.cjs.entry.js +1 -1
  70. package/dist/cjs/salla-order-edit-product-card.cjs.entry.js +1 -1
  71. package/dist/cjs/salla-order-edit.cjs.entry.js +1 -1
  72. package/dist/cjs/salla-order-options-modal.cjs.entry.js +5 -5
  73. package/dist/cjs/salla-order-shipments.cjs.entry.js +1 -1
  74. package/dist/cjs/salla-order-summary.cjs.entry.js +1 -1
  75. package/dist/cjs/salla-order-totals-card.cjs.entry.js +49 -7
  76. package/dist/cjs/salla-orders.cjs.entry.js +1 -1
  77. package/dist/cjs/salla-payments.cjs.entry.js +1 -1
  78. package/dist/cjs/salla-placeholder.cjs.entry.js +1 -1
  79. package/dist/cjs/salla-price-range.cjs.entry.js +1 -1
  80. package/dist/cjs/salla-product-card-embed.cjs.entry.js +1 -1
  81. package/dist/cjs/salla-product-card.cjs.entry.js +1 -1
  82. package/dist/cjs/salla-product-size-guide.cjs.entry.js +1 -1
  83. package/dist/cjs/salla-products-list.cjs.entry.js +1 -1
  84. package/dist/cjs/salla-products-slider.cjs.entry.js +1 -1
  85. package/dist/cjs/salla-quick-order.cjs.entry.js +1 -1
  86. package/dist/cjs/salla-rating-modal-v2.cjs.entry.js +1 -1
  87. package/dist/cjs/salla-rating-modal.cjs.entry.js +1 -1
  88. package/dist/cjs/salla-review-factors-tags.cjs.entry.js +1 -1
  89. package/dist/cjs/salla-review-order-item.cjs.entry.js +1 -1
  90. package/dist/cjs/salla-scopes.cjs.entry.js +3 -3
  91. package/dist/cjs/salla-search-product-card.cjs.entry.js +1 -1
  92. package/dist/cjs/salla-search.cjs.entry.js +12 -2
  93. package/dist/cjs/salla-skeleton.cjs.entry.js +1 -1
  94. package/dist/cjs/salla-social-share.cjs.entry.js +1 -1
  95. package/dist/cjs/salla-social.cjs.entry.js +1 -1
  96. package/dist/cjs/salla-tab-content_3.cjs.entry.js +24 -8
  97. package/dist/cjs/salla-tiered-offer.cjs.entry.js +1 -1
  98. package/dist/cjs/salla-trust-badges.cjs.entry.js +1 -1
  99. package/dist/cjs/salla-user-menu.cjs.entry.js +1 -1
  100. package/dist/cjs/salla-user-profile.cjs.entry.js +1 -1
  101. package/dist/cjs/salla-user-settings.cjs.entry.js +1 -1
  102. package/dist/cjs/salla-verify.cjs.entry.js +1 -1
  103. package/dist/cjs/salla-wallet.cjs.entry.js +1 -1
  104. package/dist/cjs/salla-wishlist-actions.cjs.entry.js +1 -1
  105. package/dist/cjs/salla-wishlist-summary.cjs.entry.js +1 -1
  106. package/dist/cjs/ssr-helpers-BjD2_F8m.js +48 -0
  107. package/dist/cjs/twilight.cjs.js +2 -2
  108. package/dist/cjs/{vanilla-picker-CSaDVE6R.js → vanilla-picker-CcRVM0uV.js} +1 -1
  109. package/dist/collection/collection-manifest.json +1 -1
  110. package/dist/collection/components/salla-accordion/salla-accordion-body.js +1 -1
  111. package/dist/collection/components/salla-accordion/salla-accordion-head.js +2 -2
  112. package/dist/collection/components/salla-accordion/salla-accordion.js +1 -1
  113. package/dist/collection/components/salla-alert/salla-alert.js +1 -1
  114. package/dist/collection/components/salla-apps-icons/salla-apps-icons.css +3 -0
  115. package/dist/collection/components/salla-apps-icons/salla-apps-icons.js +108 -32
  116. package/dist/collection/components/salla-apps-icons/salla-apps-icons.types.js +1 -0
  117. package/dist/collection/components/salla-badge/salla-badge.js +1 -1
  118. package/dist/collection/components/salla-booking-field/salla-booking-field.js +21 -6
  119. package/dist/collection/components/salla-contacts/salla-contacts.js +114 -37
  120. package/dist/collection/components/salla-contacts/salla-contacts.types.js +1 -0
  121. package/dist/collection/components/salla-datetime-picker/salla-datetime-picker.js +1 -1
  122. package/dist/collection/components/salla-order-options-modal/salla-order-options-modal.js +4 -4
  123. package/dist/collection/components/salla-order-totals-card/salla-order-totals-card.js +76 -7
  124. package/dist/collection/components/salla-scopes/salla-scopes.css +14 -0
  125. package/dist/collection/components/salla-scopes/salla-scopes.js +1 -1
  126. package/dist/collection/components/salla-search/salla-search.js +11 -1
  127. package/dist/collection/components/salla-tabs/salla-tab-content.js +9 -2
  128. package/dist/collection/components/salla-tabs/salla-tabs.js +36 -8
  129. package/dist/collection/utils/ssr-helpers.js +105 -0
  130. package/dist/components/index.js +2 -2
  131. package/dist/components/salla-accordion-body2.js +1 -1
  132. package/dist/components/salla-accordion-head2.js +2 -2
  133. package/dist/components/salla-accordion2.js +1 -1
  134. package/dist/components/salla-alert.js +1 -1
  135. package/dist/components/salla-apps-icons.js +53 -20
  136. package/dist/components/salla-badge2.js +1 -1
  137. package/dist/components/salla-booking-field2.js +12 -3
  138. package/dist/components/salla-contacts.js +62 -30
  139. package/dist/components/salla-order-options-modal2.js +4 -4
  140. package/dist/components/salla-order-totals-card.js +50 -6
  141. package/dist/components/salla-scopes.js +2 -2
  142. package/dist/components/salla-search.js +11 -1
  143. package/dist/components/salla-tab-content2.js +8 -1
  144. package/dist/components/salla-tabs2.js +17 -7
  145. package/dist/components/ssr-helpers.js +46 -0
  146. package/dist/docs.json +255 -34
  147. package/dist/esm/{filepond-Cqatu146.js → filepond-CMtCLsIc.js} +1 -1
  148. package/dist/esm/{filepond-plugin-file-poster-DbVXhgv4.js → filepond-plugin-file-poster-OjOFU-jw.js} +1 -1
  149. package/dist/esm/{filepond-plugin-file-validate-size-BpJPambh.js → filepond-plugin-file-validate-size-BFCz_KY1.js} +1 -1
  150. package/dist/esm/{filepond-plugin-file-validate-type-3Qrskyxw.js → filepond-plugin-file-validate-type-BaPcxnrR.js} +1 -1
  151. package/dist/esm/{filepond-plugin-image-edit-Cjy7cOV1.js → filepond-plugin-image-edit-D_tfXMIg.js} +1 -1
  152. package/dist/esm/{filepond-plugin-image-exif-orientation-DYM12Yp-.js → filepond-plugin-image-exif-orientation-DS2k4xg9.js} +1 -1
  153. package/dist/esm/{filepond-plugin-image-preview-C9nMEHVX.js → filepond-plugin-image-preview-B6bJkNCH.js} +1 -1
  154. package/dist/esm/{index-noRE1pbw.js → index-C670SYee.js} +2 -2
  155. package/dist/esm/{intlTelInput-CiinYrbq.js → intlTelInput-BUOxAmWZ.js} +1 -1
  156. package/dist/esm/loader.js +3 -3
  157. package/dist/esm/salla-accordion-body_2.entry.js +4 -4
  158. package/dist/esm/salla-accordion_6.entry.js +2 -2
  159. package/dist/esm/salla-add-product-button_5.entry.js +1 -1
  160. package/dist/esm/salla-advertisement.entry.js +1 -1
  161. package/dist/esm/salla-alert_2.entry.js +2 -2
  162. package/dist/esm/salla-app-install-alert.entry.js +1 -1
  163. package/dist/esm/salla-applied-filters.entry.js +1 -1
  164. package/dist/esm/salla-apps-icons.entry.js +50 -19
  165. package/dist/esm/salla-attachment-view_9.entry.js +22 -13
  166. package/dist/esm/salla-badge.entry.js +2 -2
  167. package/dist/esm/salla-basket-gap.entry.js +1 -1
  168. package/dist/esm/salla-bullet-delivery_3.entry.js +1 -1
  169. package/dist/esm/salla-cart-coupons.entry.js +1 -1
  170. package/dist/esm/salla-cart-item-offers_2.entry.js +1 -1
  171. package/dist/esm/salla-cart-summary-card.entry.js +1 -1
  172. package/dist/esm/salla-cashback-banner.entry.js +1 -1
  173. package/dist/esm/salla-comment-factors.entry.js +1 -1
  174. package/dist/esm/salla-comment-form_9.entry.js +1 -1
  175. package/dist/esm/salla-conditional-offer.entry.js +1 -1
  176. package/dist/esm/salla-contacts.entry.js +60 -29
  177. package/dist/esm/salla-cookies-bar.entry.js +1 -1
  178. package/dist/esm/salla-count-down.entry.js +1 -1
  179. package/dist/esm/salla-custom-fields.entry.js +1 -1
  180. package/dist/esm/salla-delivery-promise.entry.js +1 -1
  181. package/dist/esm/salla-edit-order-button.entry.js +1 -1
  182. package/dist/esm/salla-filters-widget.entry.js +1 -1
  183. package/dist/esm/salla-filters.entry.js +1 -1
  184. package/dist/esm/salla-fulfillment-methods.entry.js +1 -1
  185. package/dist/esm/salla-gift-card-redeem_2.entry.js +1 -1
  186. package/dist/esm/salla-gifting.entry.js +1 -1
  187. package/dist/esm/salla-hook.entry.js +1 -1
  188. package/dist/esm/salla-infinite-scroll.entry.js +1 -1
  189. package/dist/esm/salla-installment.entry.js +1 -1
  190. package/dist/esm/salla-list-tile.entry.js +1 -1
  191. package/dist/esm/salla-localization-modal.entry.js +1 -1
  192. package/dist/esm/salla-login-modal.entry.js +1 -1
  193. package/dist/esm/salla-loyalty-banner_10.entry.js +1 -1
  194. package/dist/esm/salla-loyalty-exchange-product-card.entry.js +1 -1
  195. package/dist/esm/salla-loyalty-points-banner.entry.js +1 -1
  196. package/dist/esm/salla-loyalty-points-history.entry.js +1 -1
  197. package/dist/esm/salla-loyalty-prize-item.entry.js +1 -1
  198. package/dist/esm/salla-loyalty.entry.js +1 -1
  199. package/dist/esm/salla-maintenance-alert.entry.js +1 -1
  200. package/dist/esm/salla-map_3.entry.js +1 -1
  201. package/dist/esm/salla-menu.entry.js +1 -1
  202. package/dist/esm/salla-metadata.entry.js +1 -1
  203. package/dist/esm/salla-multiple-bundle-product-cart_2.entry.js +1 -1
  204. package/dist/esm/salla-multiple-bundle-product-options-modal_2.entry.js +1 -1
  205. package/dist/esm/salla-multiple-bundle-product.entry.js +1 -1
  206. package/dist/esm/salla-next-order-coupon.entry.js +1 -1
  207. package/dist/esm/salla-notification-item_2.entry.js +1 -1
  208. package/dist/esm/salla-offer-modal.entry.js +1 -1
  209. package/dist/esm/salla-offer.entry.js +1 -1
  210. package/dist/esm/salla-order-branch.entry.js +1 -1
  211. package/dist/esm/salla-order-cancel.entry.js +1 -1
  212. package/dist/esm/salla-order-details-multiple-bundle-product.entry.js +1 -1
  213. package/dist/esm/salla-order-details-options.entry.js +1 -1
  214. package/dist/esm/salla-order-details.entry.js +1 -1
  215. package/dist/esm/salla-order-edit-item.entry.js +1 -1
  216. package/dist/esm/salla-order-edit-product-card.entry.js +1 -1
  217. package/dist/esm/salla-order-edit.entry.js +1 -1
  218. package/dist/esm/salla-order-options-modal.entry.js +5 -5
  219. package/dist/esm/salla-order-shipments.entry.js +1 -1
  220. package/dist/esm/salla-order-summary.entry.js +1 -1
  221. package/dist/esm/salla-order-totals-card.entry.js +49 -7
  222. package/dist/esm/salla-orders.entry.js +1 -1
  223. package/dist/esm/salla-payments.entry.js +1 -1
  224. package/dist/esm/salla-placeholder.entry.js +1 -1
  225. package/dist/esm/salla-price-range.entry.js +1 -1
  226. package/dist/esm/salla-product-card-embed.entry.js +1 -1
  227. package/dist/esm/salla-product-card.entry.js +1 -1
  228. package/dist/esm/salla-product-size-guide.entry.js +1 -1
  229. package/dist/esm/salla-products-list.entry.js +1 -1
  230. package/dist/esm/salla-products-slider.entry.js +1 -1
  231. package/dist/esm/salla-quick-order.entry.js +1 -1
  232. package/dist/esm/salla-rating-modal-v2.entry.js +1 -1
  233. package/dist/esm/salla-rating-modal.entry.js +1 -1
  234. package/dist/esm/salla-review-factors-tags.entry.js +1 -1
  235. package/dist/esm/salla-review-order-item.entry.js +1 -1
  236. package/dist/esm/salla-scopes.entry.js +3 -3
  237. package/dist/esm/salla-search-product-card.entry.js +1 -1
  238. package/dist/esm/salla-search.entry.js +12 -2
  239. package/dist/esm/salla-skeleton.entry.js +1 -1
  240. package/dist/esm/salla-social-share.entry.js +1 -1
  241. package/dist/esm/salla-social.entry.js +1 -1
  242. package/dist/esm/salla-tab-content_3.entry.js +24 -8
  243. package/dist/esm/salla-tiered-offer.entry.js +1 -1
  244. package/dist/esm/salla-trust-badges.entry.js +1 -1
  245. package/dist/esm/salla-user-menu.entry.js +1 -1
  246. package/dist/esm/salla-user-profile.entry.js +1 -1
  247. package/dist/esm/salla-user-settings.entry.js +1 -1
  248. package/dist/esm/salla-verify.entry.js +1 -1
  249. package/dist/esm/salla-wallet.entry.js +1 -1
  250. package/dist/esm/salla-wishlist-actions.entry.js +1 -1
  251. package/dist/esm/salla-wishlist-summary.entry.js +1 -1
  252. package/dist/esm/ssr-helpers-BJN-DTdN.js +46 -0
  253. package/dist/esm/twilight.js +3 -3
  254. package/dist/esm/{vanilla-picker-BWBrgMJQ.js → vanilla-picker-vQxevRSA.js} +1 -1
  255. package/dist/twilight/{p-8e248aa7.entry.js → p-0116fc35.entry.js} +1 -1
  256. package/dist/twilight/{p-c589a326.entry.js → p-02946cf5.entry.js} +1 -1
  257. package/dist/twilight/{p-341a7ab8.entry.js → p-07453f6c.entry.js} +1 -1
  258. package/dist/twilight/{p-5110433d.entry.js → p-0c6290e0.entry.js} +1 -1
  259. package/dist/twilight/{p-fc717703.entry.js → p-0cb5d9c6.entry.js} +1 -1
  260. package/dist/twilight/{p-2eea4245.entry.js → p-0f68e660.entry.js} +1 -1
  261. package/dist/twilight/{p-a2de7999.entry.js → p-132d9742.entry.js} +1 -1
  262. package/dist/twilight/p-157873ee.entry.js +4 -0
  263. package/dist/twilight/{p-4d482ee4.entry.js → p-161fce7a.entry.js} +1 -1
  264. package/dist/twilight/{p-3b4f66d3.entry.js → p-167a9c58.entry.js} +1 -1
  265. package/dist/twilight/{p-f03f893c.entry.js → p-19b7fccb.entry.js} +1 -1
  266. package/dist/twilight/{p-88f650da.entry.js → p-19d9b193.entry.js} +1 -1
  267. package/dist/twilight/{p-6e53afc6.entry.js → p-1c75de1e.entry.js} +1 -1
  268. package/dist/twilight/p-1c7999c9.entry.js +4 -0
  269. package/dist/twilight/{p-a8408d51.entry.js → p-1ea04494.entry.js} +1 -1
  270. package/dist/twilight/{p-5360d082.entry.js → p-1f3d5e3e.entry.js} +1 -1
  271. package/dist/twilight/{p-03e89cb1.entry.js → p-22fc1505.entry.js} +1 -1
  272. package/dist/twilight/{p-ce120ce6.entry.js → p-27d94a42.entry.js} +1 -1
  273. package/dist/twilight/{p-be7dcc25.entry.js → p-2a865b0b.entry.js} +1 -1
  274. package/dist/twilight/{p-221e47a5.entry.js → p-2bb95112.entry.js} +1 -1
  275. package/dist/twilight/{p-7f0bdf0e.entry.js → p-2d8d9829.entry.js} +1 -1
  276. package/dist/twilight/{p-9fcc7eeb.entry.js → p-2df4e63a.entry.js} +1 -1
  277. package/dist/twilight/{p-64158678.entry.js → p-316be8a7.entry.js} +1 -1
  278. package/dist/twilight/{p-0859fe23.entry.js → p-321022f5.entry.js} +1 -1
  279. package/dist/twilight/{p-1fe92c36.entry.js → p-34ab84e2.entry.js} +1 -1
  280. package/dist/twilight/{p-454b32f0.entry.js → p-36ddb8db.entry.js} +1 -1
  281. package/dist/twilight/{p-c41c1eff.entry.js → p-3b45e21a.entry.js} +1 -1
  282. package/dist/twilight/{p-826ed1c6.entry.js → p-3eface57.entry.js} +1 -1
  283. package/dist/twilight/{p-856ed222.entry.js → p-46334bbe.entry.js} +1 -1
  284. package/dist/twilight/{p-16072449.entry.js → p-4678b6d7.entry.js} +1 -1
  285. package/dist/twilight/{p-52a7dbb7.entry.js → p-4ea3a8a1.entry.js} +1 -1
  286. package/dist/twilight/{p-cab2f22a.entry.js → p-56d064c0.entry.js} +1 -1
  287. package/dist/twilight/{p-1930b915.entry.js → p-57768c0e.entry.js} +1 -1
  288. package/dist/twilight/{p-0b54834f.entry.js → p-57ddfcfe.entry.js} +1 -1
  289. package/dist/twilight/{p-87dcc9d8.entry.js → p-60e920c6.entry.js} +1 -1
  290. package/dist/twilight/{p-3f730d01.entry.js → p-62690afe.entry.js} +1 -1
  291. package/dist/twilight/{p-6f66a0f2.entry.js → p-6339c31f.entry.js} +1 -1
  292. package/dist/twilight/{p-138d6214.entry.js → p-660271f5.entry.js} +1 -1
  293. package/dist/twilight/{p-88d64b87.entry.js → p-6b28397a.entry.js} +1 -1
  294. package/dist/twilight/{p-40c8b553.entry.js → p-6bacaa30.entry.js} +1 -1
  295. package/dist/twilight/{p-517807b2.entry.js → p-6cfb6628.entry.js} +1 -1
  296. package/dist/twilight/{p-4962d869.entry.js → p-6cffd732.entry.js} +1 -1
  297. package/dist/twilight/{p-0ca1a782.entry.js → p-6eb365f3.entry.js} +1 -1
  298. package/dist/twilight/{p-c5d4682b.entry.js → p-73125aab.entry.js} +1 -1
  299. package/dist/twilight/{p-ce981b2f.entry.js → p-73189ed2.entry.js} +1 -1
  300. package/dist/twilight/{p-5a6c4fdf.entry.js → p-744c8337.entry.js} +1 -1
  301. package/dist/twilight/{p-4d1582f8.entry.js → p-82430d31.entry.js} +1 -1
  302. package/dist/twilight/{p-2636c473.entry.js → p-8359286c.entry.js} +1 -1
  303. package/dist/twilight/{p-27712ed1.entry.js → p-84ed92e9.entry.js} +1 -1
  304. package/dist/twilight/p-84ee1884.entry.js +4 -0
  305. package/dist/twilight/{p-07dc637e.entry.js → p-87feddeb.entry.js} +1 -1
  306. package/dist/twilight/{p-d986aa18.entry.js → p-8d119291.entry.js} +1 -1
  307. package/dist/twilight/{p-5ac2e6ab.entry.js → p-8f1789f7.entry.js} +1 -1
  308. package/dist/twilight/{p-950634d1.entry.js → p-90765c65.entry.js} +1 -1
  309. package/dist/twilight/{p-d09b6b8c.entry.js → p-94f18d97.entry.js} +1 -1
  310. package/dist/twilight/p-9a7da6d0.entry.js +4 -0
  311. package/dist/twilight/{p-d13f5256.entry.js → p-9ab10a2f.entry.js} +1 -1
  312. package/dist/twilight/{p-53bf1d54.entry.js → p-9ace9fc5.entry.js} +1 -1
  313. package/dist/twilight/{p-141218a3.entry.js → p-9b9c2adf.entry.js} +1 -1
  314. package/dist/twilight/p-BJN-DTdN.js +4 -0
  315. package/dist/twilight/{p-noRE1pbw.js → p-C670SYee.js} +1 -1
  316. package/dist/twilight/{p-B867dk1j.js → p-CcijNXaY.js} +1 -1
  317. package/dist/twilight/{p-D98H4WeK.js → p-D-pGRpnm.js} +1 -1
  318. package/dist/twilight/{p-CyV163V_.js → p-D33qIToB.js} +1 -1
  319. package/dist/twilight/{p-CbJEogz0.js → p-DEtbzT0x.js} +1 -1
  320. package/dist/twilight/{p-CADeV7A-.js → p-DIJHCILO.js} +1 -1
  321. package/dist/twilight/{p-DomdkzLW.js → p-DOJsGUE-.js} +1 -1
  322. package/dist/twilight/{p-DWkNp24H.js → p-DYkb22mH.js} +1 -1
  323. package/dist/twilight/p-Kqe2HSSB.js +9 -0
  324. package/dist/twilight/{p-475d01e2.entry.js → p-af525459.entry.js} +1 -1
  325. package/dist/twilight/{p-d306b947.entry.js → p-afc17688.entry.js} +1 -1
  326. package/dist/twilight/{p-78b86647.entry.js → p-b124899c.entry.js} +1 -1
  327. package/dist/twilight/{p-18aff2d5.entry.js → p-b13efdf9.entry.js} +1 -1
  328. package/dist/twilight/{p-b1a35349.entry.js → p-b2da9ea7.entry.js} +1 -1
  329. package/dist/twilight/{p-f5f0246f.entry.js → p-b3f0b7e3.entry.js} +1 -1
  330. package/dist/twilight/{p-3c45c49f.entry.js → p-b40466ae.entry.js} +1 -1
  331. package/dist/twilight/p-b59eab4f.entry.js +4 -0
  332. package/dist/twilight/{p-c631e2cd.entry.js → p-b6674eab.entry.js} +1 -1
  333. package/dist/twilight/{p-c6af4f05.entry.js → p-b7f5a180.entry.js} +1 -1
  334. package/dist/twilight/p-bf95f806.entry.js +4 -0
  335. package/dist/twilight/{p-9ce917a6.entry.js → p-c6f677aa.entry.js} +1 -1
  336. package/dist/twilight/{p-8876efa6.entry.js → p-c7728312.entry.js} +1 -1
  337. package/dist/twilight/{p-4ce97595.entry.js → p-c840c67c.entry.js} +1 -1
  338. package/dist/twilight/{p-f6f633fc.entry.js → p-cba57487.entry.js} +1 -1
  339. package/dist/twilight/{p-919dd049.entry.js → p-ccd75cf6.entry.js} +1 -1
  340. package/dist/twilight/{p-87b3c231.entry.js → p-ce8bdea8.entry.js} +1 -1
  341. package/dist/twilight/{p-ba76a96a.entry.js → p-d2b41e2d.entry.js} +1 -1
  342. package/dist/twilight/{p-82d59bf3.entry.js → p-d897273e.entry.js} +1 -1
  343. package/dist/twilight/{p-ba9ee435.entry.js → p-d923ecda.entry.js} +1 -1
  344. package/dist/twilight/{p-9e084610.entry.js → p-da9b84ee.entry.js} +1 -1
  345. package/dist/twilight/p-de0ce00a.entry.js +4 -0
  346. package/dist/twilight/{p-76d11b5c.entry.js → p-dfcb0978.entry.js} +1 -1
  347. package/dist/twilight/{p-0c9f5232.entry.js → p-dff87ddc.entry.js} +1 -1
  348. package/dist/twilight/{p-7f882abf.entry.js → p-e1b853b2.entry.js} +1 -1
  349. package/dist/twilight/{p-16b2f58b.entry.js → p-e4ba8208.entry.js} +1 -1
  350. package/dist/twilight/{p-9ed52621.entry.js → p-e506fbee.entry.js} +1 -1
  351. package/dist/twilight/p-e80bc0ce.entry.js +4 -0
  352. package/dist/twilight/{p-4333c630.entry.js → p-e8f7ed7b.entry.js} +1 -1
  353. package/dist/twilight/{p-67ecb74a.entry.js → p-ea4e6f55.entry.js} +1 -1
  354. package/dist/twilight/{p-721819ee.entry.js → p-ea82cbb3.entry.js} +1 -1
  355. package/dist/twilight/{p-15b8fa7f.entry.js → p-ef9567bd.entry.js} +1 -1
  356. package/dist/twilight/{p-f9fbcb8d.entry.js → p-f106d1e8.entry.js} +1 -1
  357. package/dist/twilight/{p-15f5d424.entry.js → p-f37cc89b.entry.js} +1 -1
  358. package/dist/twilight/p-f52c49c8.entry.js +4 -0
  359. package/dist/twilight/{p-1cbbdcea.entry.js → p-f5f448b7.entry.js} +1 -1
  360. package/dist/twilight/{p-BT5AJCX9.js → p-r8T0WY8a.js} +1 -1
  361. package/dist/twilight/twilight.esm.js +1 -1
  362. package/dist/types/components/salla-apps-icons/salla-apps-icons.d.ts +26 -13
  363. package/dist/types/components/salla-apps-icons/salla-apps-icons.types.d.ts +4 -0
  364. package/dist/types/components/salla-booking-field/salla-booking-field.d.ts +5 -1
  365. package/dist/types/components/salla-contacts/salla-contacts.d.ts +26 -14
  366. package/dist/types/components/salla-contacts/salla-contacts.types.d.ts +7 -0
  367. package/dist/types/components/salla-order-totals-card/interfaces.d.ts +27 -0
  368. package/dist/types/components/salla-order-totals-card/salla-order-totals-card.d.ts +12 -4
  369. package/dist/types/components/salla-scopes/interfaces.d.ts +1 -0
  370. package/dist/types/components/salla-search/salla-search.d.ts +3 -1
  371. package/dist/types/components/salla-tabs/salla-tab-content.d.ts +3 -2
  372. package/dist/types/components/salla-tabs/salla-tabs.d.ts +8 -3
  373. package/dist/types/components.d.ts +90 -22
  374. package/dist/types/utils/ssr-helpers.d.ts +73 -0
  375. package/package.json +5 -5
  376. package/dist/twilight/p-0cb548be.entry.js +0 -4
  377. package/dist/twilight/p-3263103c.entry.js +0 -4
  378. package/dist/twilight/p-540a7588.entry.js +0 -4
  379. package/dist/twilight/p-DN2opqoB.js +0 -9
  380. package/dist/twilight/p-a030da8e.entry.js +0 -4
  381. package/dist/twilight/p-aabc57e3.entry.js +0 -4
  382. package/dist/twilight/p-c8d269df.entry.js +0 -4
  383. package/dist/twilight/p-e4c88bee.entry.js +0 -4
  384. package/dist/twilight/p-e7fc0d63.entry.js +0 -4
  385. package/dist/twilight/p-eef846fa.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-noRE1pbw.js";import{i as t}from"./p-DgRxTSyJ.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-C670SYee.js";import{i as t}from"./p-DgRxTSyJ.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 c,c as t,h as r,H as e}from"./p-noRE1pbw.js";const d=class{constructor(r){c(this,r),this.orderEditProductSelected=t(this,"orderEditProductSelected")}get productData(){if(!this.product)return{};if("object"==typeof this.product)return this.product;try{return JSON.parse(this.product)}catch(c){return{}}}handleSelectProduct(){this.orderEditProductSelected.emit({product:this.productData})}render(){const c=this.productData,t=c?.name||salla.lang.getWithDefault("common.elements.product","منتج"),d=c?.price;return r(e,{key:"f70bbfb59e4308bc1b7ab7866f5840f650006058"},r("button",{key:"7755b197eba043f81b147b89c9ac52e0a5149363",type:"button",class:"s-order-edit-product-card",onClick:()=>this.handleSelectProduct()},r("div",{key:"c0df83535c35b3f9bcf4d29a827507a4437d4e01",class:"s-order-edit-product-card-media"},c?.image?.url?r("img",{src:c.image.url,alt:c.image.alt||t,class:"s-order-edit-product-card-image"}):r("div",{class:"s-order-edit-product-card-placeholder"},r("i",{class:"sicon-shopping-bag"}))),r("div",{key:"41a9b99545c8ec2f93ccaba3cc458522d3fd55c8",class:"s-order-edit-product-card-content"},r("h3",{key:"416517b0d53bca3488aa8c4ba49484be0fe39bab",class:"s-order-edit-product-card-title"},t),null!=d&&r("p",{key:"cb05807b4d51a1b5acff02169e4cf9691348c9be",class:"s-order-edit-product-card-price",innerHTML:salla.money(d)}))))}};d.style=":host{display:block;min-width:0}";export{d as salla_order_edit_product_card}
4
+ import{r as c,c as t,h as e,H as r}from"./p-C670SYee.js";const d=class{constructor(e){c(this,e),this.orderEditProductSelected=t(this,"orderEditProductSelected")}get productData(){if(!this.product)return{};if("object"==typeof this.product)return this.product;try{return JSON.parse(this.product)}catch(c){return{}}}handleSelectProduct(){this.orderEditProductSelected.emit({product:this.productData})}render(){const c=this.productData,t=c?.name||salla.lang.getWithDefault("common.elements.product","منتج"),d=c?.price;return e(r,{key:"f70bbfb59e4308bc1b7ab7866f5840f650006058"},e("button",{key:"7755b197eba043f81b147b89c9ac52e0a5149363",type:"button",class:"s-order-edit-product-card",onClick:()=>this.handleSelectProduct()},e("div",{key:"c0df83535c35b3f9bcf4d29a827507a4437d4e01",class:"s-order-edit-product-card-media"},c?.image?.url?e("img",{src:c.image.url,alt:c.image.alt||t,class:"s-order-edit-product-card-image"}):e("div",{class:"s-order-edit-product-card-placeholder"},e("i",{class:"sicon-shopping-bag"}))),e("div",{key:"41a9b99545c8ec2f93ccaba3cc458522d3fd55c8",class:"s-order-edit-product-card-content"},e("h3",{key:"416517b0d53bca3488aa8c4ba49484be0fe39bab",class:"s-order-edit-product-card-title"},t),null!=d&&e("p",{key:"cb05807b4d51a1b5acff02169e4cf9691348c9be",class:"s-order-edit-product-card-price",innerHTML:salla.money(d)}))))}};d.style=":host{display:block;min-width:0}";export{d as salla_order_edit_product_card}
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r as e,h as o}from"./p-noRE1pbw.js";import{T as t}from"./p-CJUR4sUM.js";import{i as r}from"./p-DqDX5na4.js";const n=class{constructor(o){e(this,o),this.coupon=null,this.isLoading=!0,this.titlePercentTpl="",this.titleFixedTpl="",this.badgeLabel="",this.minSpendTpl="",this.expiresTpl="",this.shopNowLabel="",this.copyLabel="",this.copiedLabel=""}componentWillLoad(){Salla.onReady().then((()=>Salla.lang.onLoaded())).then((()=>(this.loadTranslations(),this.loadCoupon()))).catch((()=>{this.isLoading=!1}))}loadTranslations(){this.titlePercentTpl=Salla.lang.get("pages.thank_you.next_order_coupon_title_percent")||"",this.titleFixedTpl=Salla.lang.get("pages.thank_you.next_order_coupon_title_fixed")||"",this.badgeLabel=Salla.lang.get("pages.thank_you.next_order_coupon_badge")||"",this.minSpendTpl=Salla.lang.get("pages.thank_you.next_order_coupon_min_spend")||"",this.expiresTpl=Salla.lang.get("pages.thank_you.next_order_coupon_expires")||"",this.shopNowLabel=Salla.lang.get("pages.thank_you.next_order_coupon_shop_now")||"",this.copyLabel=Salla.lang.get("common.elements.copy")||"",this.copiedLabel=Salla.lang.get("pages.thank_you.next_order_coupon_copied")||""}async loadCoupon(){try{const e=await salla.api.request("coupons",{params:{type:"thankyou"}}),o=e?.data,t=Array.isArray(o)?o:Array.isArray(o?.data)?o.data:[];this.coupon=t[0]??null}catch{this.coupon=null}finally{this.isLoading=!1}}async copyCode(){if(this.coupon)try{await navigator.clipboard.writeText(this.coupon.code),salla.notify.success(this.copiedLabel),salla.event.dispatch("salla::next-order-coupon.code.copied",{code:this.coupon.code})}catch{}}isPercentage(){return"P"===this.coupon?.type||"percentage"===this.coupon?.type}formatAmount(){if(!this.coupon)return"";if(this.isPercentage())return`${salla.helpers.number(this.coupon.amount)}%`;const e=this.coupon.amount;return o("span","object"==typeof e&&e.amount?{innerHTML:salla.money(e.amount,e.currency)}:{innerHTML:salla.money(e)})}formatMinSpend(){const e=this.coupon?.minimum_amount;return e&&("object"!=typeof e||e.amount)?"string"==typeof e?e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;"):salla.money(e.amount,e.currency):""}formatExpiry(){const e=this.coupon?.expiry_date;return e?new Date(e).toLocaleDateString(Salla.lang.locale||"en-GB"):""}renderSkeleton(){return o("div",{class:"s-next-order-coupon-wrapper s-next-order-coupon-skeleton"},o("div",{class:"s-next-order-coupon-inner"},o("div",{class:"s-next-order-coupon-info"},o("salla-skeleton",{type:"normal",width:"48px",height:"48px"}),o("div",{class:"s-next-order-coupon-details"},o("salla-skeleton",{height:"14px",width:"220px"}),o("salla-skeleton",{height:"12px",width:"140px"}))),o("div",{class:"s-next-order-coupon-actions"},o("salla-skeleton",{height:"40px",width:"140px"}),o("salla-skeleton",{height:"40px",width:"100px"}))))}renderTitle(){const e=this.formatAmount(),t=this.isPercentage()?this.titlePercentTpl:this.titleFixedTpl,r=this.isPercentage()?":amount%":":amount",n=t.split(r);return o("p",{class:"s-next-order-coupon-title"},n[0],o("span",{class:"s-next-order-coupon-amount"},e),n[1]||"")}render(){if(this.isLoading)return this.renderSkeleton();if(!this.coupon)return null;const e=this.formatMinSpend(),n=this.formatExpiry();return o("div",{class:"s-next-order-coupon-wrapper"},o("div",{class:"s-next-order-coupon-inner"},o("div",{class:"s-next-order-coupon-info"},o("div",{class:"s-next-order-coupon-icon-wrap"},o("span",{class:"s-next-order-coupon-icon-bg"}),o("span",{class:"s-next-order-coupon-icon",innerHTML:t})),o("div",{class:"s-next-order-coupon-details"},o("div",{class:"s-next-order-coupon-title-row"},this.renderTitle(),o("span",{class:"s-next-order-coupon-badge"},o("span",{class:"s-next-order-coupon-badge-bg"}),o("span",{class:"s-next-order-coupon-badge-text"},this.badgeLabel))),(e||n)&&o("p",{class:"s-next-order-coupon-meta"},e&&o("span",{innerHTML:this.minSpendTpl.replace(":amount",e)}),n&&o("span",null,this.expiresTpl.replace(":date",n))))),o("div",{class:"s-next-order-coupon-actions"},o("div",{class:"s-next-order-coupon-code-box"},o("span",{class:"s-next-order-coupon-code-text"},this.coupon.code),o("salla-button",{shape:"link",class:"s-next-order-coupon-copy-btn",title:this.copyLabel,onClick:()=>this.copyCode()},o("span",{class:"s-next-order-coupon-copy-icon",innerHTML:r}))),o("salla-button",{href:salla.url.get(""),class:"s-next-order-coupon-shop-btn"},this.shopNowLabel))))}};n.style="/*!twlt*/:host{display:block}.fixed{position:fixed}.s-next-order-coupon-wrapper{margin-bottom:1.5rem;border-radius:0.375rem;--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1));padding-left:1rem;padding-right:1rem;padding-top:1rem;padding-bottom:1rem}@media (min-width: 768px){.s-next-order-coupon-wrapper{margin-bottom:2rem;padding-left:2rem;padding-right:2rem}}.s-next-order-coupon-inner{display:flex;flex-direction:column;gap:1rem}@media (min-width: 768px){.s-next-order-coupon-inner{flex-direction:row;align-items:center;justify-content:space-between}}.s-next-order-coupon-info{display:flex;min-width:0px;flex:1 1 0%;align-items:center;gap:0.75rem}.s-next-order-coupon-icon-wrap{position:relative;display:flex;height:3rem;width:3rem;flex-shrink:0;align-items:center;justify-content:center;border-radius:var(--s-radius, 0.25rem)}.s-next-order-coupon-icon-bg{position:absolute;inset:0px;border-radius:var(--s-radius, 0.25rem);background-color:var(--color-primary);opacity:0.25}.s-next-order-coupon-icon{position:relative;color:var(--color-primary)}.s-next-order-coupon-icon svg{height:1.5rem;width:1.75rem;fill:currentColor}.s-next-order-coupon-details{display:flex;min-width:0px;flex-direction:column;gap:0.5rem}.s-next-order-coupon-title-row{display:flex;flex-wrap:wrap;align-items:center;gap:0.375rem}.s-next-order-coupon-title{font-size:1rem;line-height:1.5rem;font-weight:700;line-height:1.375}.s-next-order-coupon-amount{color:var(--color-primary)}.s-next-order-coupon-badge{position:relative;display:inline-flex;height:1.5rem;align-items:center;border-radius:9999px;padding-left:0.75rem;padding-right:0.75rem;font-size:0.75rem;line-height:1rem;color:var(--color-primary)}.s-next-order-coupon-badge-bg{position:absolute;inset:0px;border-radius:9999px;background-color:var(--color-primary);opacity:0.25}.s-next-order-coupon-badge-text{position:relative}.s-next-order-coupon-meta{display:flex;flex-wrap:wrap;column-gap:0.25rem;font-size:0.875rem;line-height:1.25rem;line-height:1.375;--tw-text-opacity:1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.s-next-order-coupon-actions{display:flex;flex-direction:column;gap:0.75rem}@media (min-width: 768px){.s-next-order-coupon-actions{flex-shrink:0;flex-direction:row;align-items:center}}.s-next-order-coupon-code-box{display:flex;height:2.5rem;width:100%;align-items:center;justify-content:center;gap:0.5rem;border-radius:0.375rem;border-width:1px;border-style:dashed;border-color:var(--color-primary);padding-left:1rem;padding-right:1rem}@media (min-width: 768px){.s-next-order-coupon-code-box{width:auto}}.s-next-order-coupon-code-text{font-size:1rem;line-height:1.5rem;line-height:1;letter-spacing:0.025em}.s-next-order-coupon-copy-btn{display:flex;height:auto !important;align-items:center;padding:0px !important}.s-next-order-coupon-copy-icon{pointer-events:none;color:var(--color-primary)}.s-next-order-coupon-copy-icon svg{height:1rem;width:1rem;fill:currentColor}.s-next-order-coupon-shop-btn{width:100%;white-space:nowrap;text-align:center}@media (min-width: 768px){.s-next-order-coupon-shop-btn{width:auto}}@keyframes pulse{50%{opacity:.5}}.s-next-order-coupon-skeleton{animation:pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite}";export{n as salla_next_order_coupon}
4
+ import{r as e,h as o}from"./p-C670SYee.js";import{T as t}from"./p-CJUR4sUM.js";import{i as r}from"./p-DqDX5na4.js";const n=class{constructor(o){e(this,o),this.coupon=null,this.isLoading=!0,this.titlePercentTpl="",this.titleFixedTpl="",this.badgeLabel="",this.minSpendTpl="",this.expiresTpl="",this.shopNowLabel="",this.copyLabel="",this.copiedLabel=""}componentWillLoad(){Salla.onReady().then((()=>Salla.lang.onLoaded())).then((()=>(this.loadTranslations(),this.loadCoupon()))).catch((()=>{this.isLoading=!1}))}loadTranslations(){this.titlePercentTpl=Salla.lang.get("pages.thank_you.next_order_coupon_title_percent")||"",this.titleFixedTpl=Salla.lang.get("pages.thank_you.next_order_coupon_title_fixed")||"",this.badgeLabel=Salla.lang.get("pages.thank_you.next_order_coupon_badge")||"",this.minSpendTpl=Salla.lang.get("pages.thank_you.next_order_coupon_min_spend")||"",this.expiresTpl=Salla.lang.get("pages.thank_you.next_order_coupon_expires")||"",this.shopNowLabel=Salla.lang.get("pages.thank_you.next_order_coupon_shop_now")||"",this.copyLabel=Salla.lang.get("common.elements.copy")||"",this.copiedLabel=Salla.lang.get("pages.thank_you.next_order_coupon_copied")||""}async loadCoupon(){try{const e=await salla.api.request("coupons",{params:{type:"thankyou"}}),o=e?.data,t=Array.isArray(o)?o:Array.isArray(o?.data)?o.data:[];this.coupon=t[0]??null}catch{this.coupon=null}finally{this.isLoading=!1}}async copyCode(){if(this.coupon)try{await navigator.clipboard.writeText(this.coupon.code),salla.notify.success(this.copiedLabel),salla.event.dispatch("salla::next-order-coupon.code.copied",{code:this.coupon.code})}catch{}}isPercentage(){return"P"===this.coupon?.type||"percentage"===this.coupon?.type}formatAmount(){if(!this.coupon)return"";if(this.isPercentage())return`${salla.helpers.number(this.coupon.amount)}%`;const e=this.coupon.amount;return o("span","object"==typeof e&&e.amount?{innerHTML:salla.money(e.amount,e.currency)}:{innerHTML:salla.money(e)})}formatMinSpend(){const e=this.coupon?.minimum_amount;return e&&("object"!=typeof e||e.amount)?"string"==typeof e?e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;"):salla.money(e.amount,e.currency):""}formatExpiry(){const e=this.coupon?.expiry_date;return e?new Date(e).toLocaleDateString(Salla.lang.locale||"en-GB"):""}renderSkeleton(){return o("div",{class:"s-next-order-coupon-wrapper s-next-order-coupon-skeleton"},o("div",{class:"s-next-order-coupon-inner"},o("div",{class:"s-next-order-coupon-info"},o("salla-skeleton",{type:"normal",width:"48px",height:"48px"}),o("div",{class:"s-next-order-coupon-details"},o("salla-skeleton",{height:"14px",width:"220px"}),o("salla-skeleton",{height:"12px",width:"140px"}))),o("div",{class:"s-next-order-coupon-actions"},o("salla-skeleton",{height:"40px",width:"140px"}),o("salla-skeleton",{height:"40px",width:"100px"}))))}renderTitle(){const e=this.formatAmount(),t=this.isPercentage()?this.titlePercentTpl:this.titleFixedTpl,r=this.isPercentage()?":amount%":":amount",n=t.split(r);return o("p",{class:"s-next-order-coupon-title"},n[0],o("span",{class:"s-next-order-coupon-amount"},e),n[1]||"")}render(){if(this.isLoading)return this.renderSkeleton();if(!this.coupon)return null;const e=this.formatMinSpend(),n=this.formatExpiry();return o("div",{class:"s-next-order-coupon-wrapper"},o("div",{class:"s-next-order-coupon-inner"},o("div",{class:"s-next-order-coupon-info"},o("div",{class:"s-next-order-coupon-icon-wrap"},o("span",{class:"s-next-order-coupon-icon-bg"}),o("span",{class:"s-next-order-coupon-icon",innerHTML:t})),o("div",{class:"s-next-order-coupon-details"},o("div",{class:"s-next-order-coupon-title-row"},this.renderTitle(),o("span",{class:"s-next-order-coupon-badge"},o("span",{class:"s-next-order-coupon-badge-bg"}),o("span",{class:"s-next-order-coupon-badge-text"},this.badgeLabel))),(e||n)&&o("p",{class:"s-next-order-coupon-meta"},e&&o("span",{innerHTML:this.minSpendTpl.replace(":amount",e)}),n&&o("span",null,this.expiresTpl.replace(":date",n))))),o("div",{class:"s-next-order-coupon-actions"},o("div",{class:"s-next-order-coupon-code-box"},o("span",{class:"s-next-order-coupon-code-text"},this.coupon.code),o("salla-button",{shape:"link",class:"s-next-order-coupon-copy-btn",title:this.copyLabel,onClick:()=>this.copyCode()},o("span",{class:"s-next-order-coupon-copy-icon",innerHTML:r}))),o("salla-button",{href:salla.url.get(""),class:"s-next-order-coupon-shop-btn"},this.shopNowLabel))))}};n.style="/*!twlt*/:host{display:block}.fixed{position:fixed}.s-next-order-coupon-wrapper{margin-bottom:1.5rem;border-radius:0.375rem;--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1));padding-left:1rem;padding-right:1rem;padding-top:1rem;padding-bottom:1rem}@media (min-width: 768px){.s-next-order-coupon-wrapper{margin-bottom:2rem;padding-left:2rem;padding-right:2rem}}.s-next-order-coupon-inner{display:flex;flex-direction:column;gap:1rem}@media (min-width: 768px){.s-next-order-coupon-inner{flex-direction:row;align-items:center;justify-content:space-between}}.s-next-order-coupon-info{display:flex;min-width:0px;flex:1 1 0%;align-items:center;gap:0.75rem}.s-next-order-coupon-icon-wrap{position:relative;display:flex;height:3rem;width:3rem;flex-shrink:0;align-items:center;justify-content:center;border-radius:var(--s-radius, 0.25rem)}.s-next-order-coupon-icon-bg{position:absolute;inset:0px;border-radius:var(--s-radius, 0.25rem);background-color:var(--color-primary);opacity:0.25}.s-next-order-coupon-icon{position:relative;color:var(--color-primary)}.s-next-order-coupon-icon svg{height:1.5rem;width:1.75rem;fill:currentColor}.s-next-order-coupon-details{display:flex;min-width:0px;flex-direction:column;gap:0.5rem}.s-next-order-coupon-title-row{display:flex;flex-wrap:wrap;align-items:center;gap:0.375rem}.s-next-order-coupon-title{font-size:1rem;line-height:1.5rem;font-weight:700;line-height:1.375}.s-next-order-coupon-amount{color:var(--color-primary)}.s-next-order-coupon-badge{position:relative;display:inline-flex;height:1.5rem;align-items:center;border-radius:9999px;padding-left:0.75rem;padding-right:0.75rem;font-size:0.75rem;line-height:1rem;color:var(--color-primary)}.s-next-order-coupon-badge-bg{position:absolute;inset:0px;border-radius:9999px;background-color:var(--color-primary);opacity:0.25}.s-next-order-coupon-badge-text{position:relative}.s-next-order-coupon-meta{display:flex;flex-wrap:wrap;column-gap:0.25rem;font-size:0.875rem;line-height:1.25rem;line-height:1.375;--tw-text-opacity:1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.s-next-order-coupon-actions{display:flex;flex-direction:column;gap:0.75rem}@media (min-width: 768px){.s-next-order-coupon-actions{flex-shrink:0;flex-direction:row;align-items:center}}.s-next-order-coupon-code-box{display:flex;height:2.5rem;width:100%;align-items:center;justify-content:center;gap:0.5rem;border-radius:0.375rem;border-width:1px;border-style:dashed;border-color:var(--color-primary);padding-left:1rem;padding-right:1rem}@media (min-width: 768px){.s-next-order-coupon-code-box{width:auto}}.s-next-order-coupon-code-text{font-size:1rem;line-height:1.5rem;line-height:1;letter-spacing:0.025em}.s-next-order-coupon-copy-btn{display:flex;height:auto !important;align-items:center;padding:0px !important}.s-next-order-coupon-copy-icon{pointer-events:none;color:var(--color-primary)}.s-next-order-coupon-copy-icon svg{height:1rem;width:1rem;fill:currentColor}.s-next-order-coupon-shop-btn{width:100%;white-space:nowrap;text-align:center}@media (min-width: 768px){.s-next-order-coupon-shop-btn{width:auto}}@keyframes pulse{50%{opacity:.5}}.s-next-order-coupon-skeleton{animation:pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite}";export{n as salla_next_order_coupon}
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r as t,c as s,h as i,H as e,a as n}from"./p-noRE1pbw.js";import{A as o,a as l}from"./p-Vqpj4CWE.js";const d=class{constructor(i){t(this,i),this.optionsSaved=s(this,"optionsSaved"),this.productSelected=s(this,"productSelected"),this.product=null,this.sectionId=null,this.sectionIndex=0,this.productIndex=0,this.selectedOptions={},this.optionsResetTokens={},this.isLoading=!1,this.hasUnsavedChanges=!1,this.validationErrors=[],this.isProductAlreadySelected=!1}generateCacheKey(t,s,i){return`${t||"unknown"}-${s||0}-${i||"unknown"}`}handleProductChange(t){setTimeout((()=>{this.modal&&t&&this.modal.setTitle(t.name||"")}),100),this.validationErrors=[],this.hasUnsavedChanges=!1}async open(){this.modal?(this.isLoading=!0,this.product?.name&&this.modal.setTitle(this.product.name),this.modal.open(),setTimeout((async()=>{this.product?.id&&await this.initializeSelectedOptions(),this.product?.name&&this.modal.setTitle(this.product.name),this.modal.stopLoading(),this.isLoading=!1}),300)):requestAnimationFrame((()=>this.open()))}async close(){this.modal&&this.modal.close()}async refreshOptionsState(){this.selectedOptions={...this.selectedOptions}}componentDidLoad(){this.modalOpenListener=t=>{this.product=t.product,this.sectionId=t.sectionId||null,this.sectionIndex=t.sectionIndex||0,this.productIndex=t.productIndex||0,this.isProductAlreadySelected=!!t.isProductAlreadySelected,this.open()},salla.event.on("multiple-bundle-product-modal::open",this.modalOpenListener),this.clearOptionsListener=t=>{t&&t.productId&&this.clearProductOptions(t.productId,t.sectionId,t.productIndex)},salla.event.on("multiple-bundle-product-modal::clear-options",this.clearOptionsListener),this.optionChangeListener=t=>{const s=t.detail||t,{option:i,detail:e}=s,n=i||s.option_id&&this.product?.options?.find((t=>t.id===s.option_id||String(t.id)===String(s.option_id))),o=e||(s.id?s:null);this.product?.id&&n&&this.handleOptionChange(Number(this.product.id),n,o)},salla.event.on("product-options::change",this.optionChangeListener),this.checkboxChangeListener=t=>{const s=t.target;if(s&&"checkbox"===s.type&&s.name&&s.name.includes("bundle[")&&s.name.includes("][id]")){const t=s.name.match(/^bundle\[([^\]]+)\]\[([^\]]+)\]\[id\]$/);if(t&&!s.checked){if("true"===s.getAttribute("data-selection-locked"))return void(s.checked=!0);const[,i,e]=t,n=s.value,o=this.host.closest("form");this.cleanupProductDeselection({sectionId:i,productIndex:parseInt(e,10),productId:n,form:o,uncheckedInput:s})}}},document.addEventListener("change",this.checkboxChangeListener)}disconnectedCallback(){this.checkboxChangeListener&&document.removeEventListener("change",this.checkboxChangeListener),this.optionChangeListener&&salla.event.off("product-options::change",this.optionChangeListener),this.modalOpenListener&&salla.event.off("multiple-bundle-product-modal::open",this.modalOpenListener),this.clearOptionsListener&&salla.event.off("multiple-bundle-product-modal::clear-options",this.clearOptionsListener)}cleanupProductDeselection(t){const{sectionId:s,productIndex:i,productId:e,form:n,uncheckedInput:o}=t;if(this.clearProductOptions(e,s,i),n){const t=`bundle[${s}][${i}]`;Array.from(n.querySelectorAll(`input[name^="${t}"]`)).forEach((s=>{if(s===o)return;const i="hidden"===s.type,n=s.getAttribute("data-product-id")===String(e)&&s.name?.startsWith(t);(i||n)&&s.remove()})),requestAnimationFrame((()=>{const t=new window.Event("change",{bubbles:!0});n.dispatchEvent(t)}))}}generateFormInputName(t,s,i){return`bundle[${t}][${s}][options][${i}]`}async initializeSelectedOptions(){if(!this.product?.id)return;const t=this.product.id,s=this.generateCacheKey(this.sectionId,this.productIndex,t),i=document.querySelector(`salla-product-options[product-id="${t}"]`);if(i)try{const t=await i.getSelectedOptions();t&&t.length>0&&(this.selectedOptions={...this.selectedOptions,[s]:t})}catch(t){console.warn("Could not initialize selected options:",t)}}clearProductOptions(t,s,i){const e={...this.selectedOptions};if(null==s||null==i||Number.isNaN(i)){const s=`-${String(t)}`,i=[];Object.keys(e).forEach((t=>{t.endsWith(s)&&(delete e[t],i.push(t))})),i.forEach((t=>this.bumpOptionsResetToken(t)))}else{const n=this.generateCacheKey(s,i,t);delete e[n],this.bumpOptionsResetToken(n)}this.selectedOptions=e,this.validationErrors=[],this.hasUnsavedChanges=!1}bumpOptionsResetToken(t){t&&(this.optionsResetTokens={...this.optionsResetTokens,[t]:(this.optionsResetTokens[t]||0)+1})}async handleOptionChange(t,s,i){const e=this.generateCacheKey(this.sectionId,this.productIndex,t),n=document.querySelector(`salla-product-options[product-id="${t}"]`);let o=[];if(n)try{o=await n.getSelectedOptions()||[]}catch(t){console.warn("Could not get current selections from component:",t)}if(o.length>0)this.selectedOptions={...this.selectedOptions,[e]:o};else if(this.selectedOptions[e]&&this.selectedOptions[e].length>0){const t=[...this.selectedOptions[e]||[]],n=t.findIndex((t=>t.option_id===s.id));n>-1?i&&null!=i.id?t[n]={...i,option_id:s.id}:t.splice(n,1):i&&null!=i.id&&t.push({...i,option_id:s.id}),this.selectedOptions={...this.selectedOptions,[e]:t}}else i&&null!=i.id&&(this.selectedOptions={...this.selectedOptions,[e]:[{...i,option_id:s.id}]});this.hasUnsavedChanges=!0,this.validationErrors=[]}async validateOptions(){if(!this.product?.options)return!0;const t=[],s=this.product.id,i=this.generateCacheKey(this.sectionId,this.productIndex,s),e=document.querySelector(`salla-product-options[product-id="${s}"]`);let n=[];if(e)try{n=await e.getSelectedOptions()||[];const t=this.selectedOptions[i]||[];(t.length>n.length||0===n.length&&t.length>0)&&(n=t)}catch(t){n=this.selectedOptions[i]||[]}else n=this.selectedOptions[i]||[];return 0===n.length&&t.push(salla.lang.get("pages.products.no_options_selected")),this.product.options.forEach((s=>{s.required&&(n.some((t=>t.option_id==s.id))||t.push(salla.lang.get("pages.products.required_option_missing",{option:s.name})))})),this.validationErrors=t,0===t.length}async onSave(t){t.preventDefault();const s=this.product?.id;if(!s)return;const i=this.generateCacheKey(this.sectionId,this.productIndex,s);if(await new Promise((t=>setTimeout(t,100))),await this.validateOptions()){if(!this.isProductAlreadySelected&&null!=this.sectionId){const t=this.host.closest("salla-multiple-bundle-product-details");if(!await(t?.canSelectBundleProduct(this.sectionId,s)))return void salla.notify.error(salla.lang.getWithDefault("pages.products.bundle_selection_limit_reached","لا يمكنك اختيار المزيد من المنتجات في هذا القسم"))}this.isLoading=!0;try{const t=document.querySelector(`salla-product-options[product-id="${s}"]`);let e=await(t?.getSelectedOptions());if((!e||0===e.length)&&this.selectedOptions[i]?.length>0&&(e=this.selectedOptions[i]),!e||0===e.length)return void(this.isLoading=!1);this.selectedOptions={...this.selectedOptions,[i]:e};const n=this.host.closest("form");if(!n)return void(this.isLoading=!1);const o=`bundle[${this.sectionId}][${this.productIndex}]`;Array.from(n.querySelectorAll(`input[name^="${o}"][type="hidden"]`)).forEach((t=>t.remove())),Array.from(n.querySelectorAll(`[data-product-id="${s}"][name^="${o}"]`)).forEach((t=>t.remove()));const l=`bundle[${this.sectionId}][${this.productIndex}][id]`,d=document.getElementById(l);if(d)d.checked=!0;else{const t=document.createElement("input");t.type="hidden",t.name=`bundle[${this.sectionId}][${this.productIndex}][id]`,t.value=String(s),t.dataset.productId=String(s),n.appendChild(t)}e.forEach((t=>{const i=t.option_id,e=document.createElement("input");e.type="hidden",e.name=this.generateFormInputName(this.sectionId,this.productIndex??0,i),e.value=String(t.id),e.dataset.productId=String(s),n.appendChild(e)}));const a=new window.Event("change",{bubbles:!0});n.dispatchEvent(a),this.optionsSaved.emit({productId:Number(s),selectedOptions:e,sectionId:this.sectionId,productIndex:this.productIndex}),this.sectionId&&this.productSelected.emit({productId:Number(s),sectionId:this.sectionId,product:this.product,fromModal:!0}),salla.notify.success(salla.lang.get("pages.products.options_saved")),this.hasUnsavedChanges=!1,this.validationErrors=[],this.modal.close()}catch(t){salla.notify.error(salla.lang.get("pages.products.options_save_error"))}finally{this.isLoading=!1}}else salla.notify.error(this.validationErrors.join(", "))}getOptionsWithSelectedState(){if(!this.product?.options)return[];const t=this.generateCacheKey(this.sectionId,this.productIndex,this.product.id),s=this.selectedOptions[t]||[];return this.product.options.map((t=>({...t,details:t.details.map((t=>{const i=s.some((s=>s.id===t.id));return{...t,is_selected:i}}))})))}render(){const t=this.product?.id,s=this.getOptionsWithSelectedState(),n=this.generateCacheKey(this.sectionId,this.productIndex,t),o=this.optionsResetTokens[n]||0,l=this.isLoading||s.some((t=>t.details.some((t=>t.is_selected&&!0===t.is_out))));return i(e,{key:"80217a97bc81ba7eb770cfa88347530b5cc0850d"},i("salla-modal",{key:"f23a97440cdb8418a0f8cf129328fb8c0a0a4fc5",isLoading:this.isLoading,ref:t=>this.modal=t,width:"md",centered:!1,id:`s-multiple-bundle-product-options-modal-options-${t}`,class:"s-multiple-bundle-product-options-modal-wrapper"},i("div",{key:"06dfaf9708dd142dd0e44b6846cc0ca49be39bb6",slot:"loading"},i("salla-skeleton",{key:"a5d348f9a5158ee85d418f30f302a929f0a4dbdd",height:"100%",width:"100%"})),this.product?.images&&this.product?.images.length>0&&i("salla-slider",{key:"d3b1a1bb86708a807ee0c3a0168440f9d38b1eb8",id:`details-slider-${this.product?.id}`,type:"thumbs",loop:!1,"auto-height":!0,"listen-to-thumbnails-option":!0,showThumbsControls:!1,controlsOuter:!1,showControls:!1,class:"s-multiple-bundle-product-options-modal-slider",verticalThumbs:!0,thumbsConfig:{centeredSlides:!0,centeredSlidesBounds:!0,slidesPerView:Math.min(5,Math.max(1,this.product?.images.length)),watchOverflow:!0,watchSlidesProgress:!0,direction:"vertical",spaceBetween:10}},i("div",{key:"b7d04522efcb3f0a85ac78a9bf6f654973f6c777",slot:"items"},this.product?.images&&this.product?.images.map(((t,s)=>i("div",{key:s,class:"swiper-slide"},i("img",{src:t.url,alt:t.alt||`${this.product?.name} - Image ${s+1}`,loading:"lazy",onError:t=>{t.target.style.display="none"}}))))),this.product?.images&&this.product?.images.length>1&&i("div",{key:"3751a38d528780bb5f6ede2eb74365eefd5d42c7",slot:"thumbs"},this.product?.images&&this.product?.images.map(((t,s)=>i("div",{key:s,"data-caption":`${this.product?.name} - Image ${s+1}`},i("img",{src:t.url,loading:"eager",class:"s-multiple-bundle-product-options-modal-slider-thumb",title:`${this.product?.name} - ${s+1}`,alt:t.alt||`${this.product?.name} - ${s+1}`,onError:t=>{t.target.style.display="none"}})))))),i("salla-product-options",{options:JSON.stringify(s),key:`${n}-reset-${o}`,"product-id":t,"unique-key":`${n}-reset-${o}`}),i("div",{key:"68d6671c68f3753edd92f3c8ea8c91774038da59",slot:"footer"},i("div",{key:"f980914dbdbbea3aa02f6c816e2372f7bb09009e",class:"s-multiple-bundle-product-options-modal-footer"},i("salla-button",{key:"5d67dc612aa88fbc6eb11bcd5be0fc6d77a15aba",onClick:t=>this.onSave(t),loading:this.isLoading,disabled:l},this.isLoading?salla.lang.get("common.elements.saving"):salla.lang.get("common.elements.save"))))))}get host(){return n(this)}static get watchers(){return{product:["handleProductChange"]}}};d.style=":host{display:block}";const a=class{constructor(i){t(this,i),this.productSelected=s(this,"productSelected"),this.productOptionsSelected=s(this,"productOptionsSelected"),this.selectedProducts={},this.isSelectionLocked=!1,this.selectionLimit=0,this.savedOptionsByInstance={},this.handleProductClick=(t,s)=>{const i=this.selectedProducts[this.section.id]?.has(t.id)||!1,e=this.getCheckbox(this.section.id,s);if(i&&this.isSelectionLocked)return void(e&&(e.checked=!0));if(!i&&this.isMaxSelectionReached()&&1!==this.selectionLimit)return;if(1===this.selectionLimit&&!i)return void this.productSelected.emit({product:t,sectionId:this.section.id});if(!e)return;const n=!e.checked;n||(this.dispatchClearOptionsEvent(t,s),this.clearSavedOptionsState(this.section.id,s)),e.checked=n,requestAnimationFrame((()=>{const t=new window.Event("change",{bubbles:!0});e.dispatchEvent(t)})),this.productSelected.emit({product:t,sectionId:this.section.id})},this.handleOptionsClick=t=>{!this.selectedProducts[this.section.id]?.has(t.id)&&this.isMaxSelectionReached()&&1!==this.selectionLimit||this.productOptionsSelected.emit({product:t,sectionId:this.section.id})}}getSelectedCount(){return this.selectedProducts[this.section?.id]?.size??0}isMaxSelectionReached(){return this.selectionLimit>1&&this.getSelectedCount()>=this.selectionLimit}isProductSelectionDisabled(t,s){return 0===t.quantity||!s&&this.isMaxSelectionReached()}getProductInstanceKey(t,s){return`${t}::${s}`}dispatchClearOptionsEvent(t,s){salla.event.dispatch("multiple-bundle-product-modal::clear-options",{productId:t.id,sectionId:this.section.id,sectionIndex:this.sectionIndex,productIndex:s})}handleOptionsSaved(t){const s=t.detail;if(!s)return;const{sectionId:i,productIndex:e,selectedOptions:n}=s;if(null==i||i!==this.section?.id)return;if(null==e||Number.isNaN(e))return;const o=this.getProductInstanceKey(i,e);if(n?.length)this.savedOptionsByInstance={...this.savedOptionsByInstance,[o]:!0};else if(this.savedOptionsByInstance[o]){const t={...this.savedOptionsByInstance};delete t[o],this.savedOptionsByInstance=t}}clearSavedOptionsState(t,s){const i=this.getProductInstanceKey(t,s);if(!this.savedOptionsByInstance[i])return;const e={...this.savedOptionsByInstance};delete e[i],this.savedOptionsByInstance=e}generateEventName(t,s){return`bundle[${t}][${s}][id]`}getCheckbox(t,s){const i=this.generateEventName(t,s);return this.host.querySelector(`input.s-multiple-bundle-product-checkbox[name="${i}"]`)}preventLockedDeselect(t,s){if(!this.isSelectionLocked||!s)return;t.preventDefault(),t.stopPropagation();const i=t.target;"checkbox"===i?.type&&(i.checked=!0)}render(){return i(e,{key:"84a2765b8e57fa7d4d757c7e0c8a634199e7f121"},i("salla-slider",{key:"67d1748a2c19adca4db056bd3b5e5de6813aa367",type:"carousel",controlsOuter:!1,showControls:!1,id:`accordion-multiple-bundle-product-${this.section.id}`,pagination:!0,class:"s-multiple-bundle-product-wrapper-slider",sliderConfig:{spaceBetween:0}},i("div",{key:"04547e4a998d15377a2d5573bd0c4d8d33a93af7",slot:"items"},this?.section?.products?.map(((t,s)=>{const e=this.selectedProducts[this.section.id]?.has(t.id)||!1,n=e&&this.isSelectionLocked,d=this.isProductSelectionDisabled(t,e),a=this.savedOptionsByInstance[this.getProductInstanceKey(this.section.id,s)]?salla.lang.getWithDefault("pages.products.edit_selected_options","تعديل الخيارات"):salla.lang.get("pages.products.choose_from_options");let c=salla.config.get("theme.is_rtl",!0)?o:l;return i("div",{class:"s-multiple-bundle-product-slide-one-third"+(d?" s-multiple-bundle-product-slide-one-third-disabled":""),key:t.id},i("div",{class:"s-multiple-bundle-product-card"},i("div",{class:"s-multiple-bundle-product-image-wrapper",onClick:()=>this.handleProductClick(t,s)},i("input",{id:this.generateEventName(this.section.id,s),type:"checkbox",class:"s-multiple-bundle-product-checkbox",checked:e,"data-selection-locked":n?"true":void 0,name:this.generateEventName(this.section.id,s),value:t.id,onClick:t=>this.preventLockedDeselect(t,e),onChange:t=>this.preventLockedDeselect(t,e)}),i("img",{src:t.image.url||salla.url.cdn("images/s-empty.png"),loading:"lazy",alt:t.image.alt||t.name,class:"s-multiple-bundle-product-image"})),i("div",{class:"s-multiple-bundle-product-content-wrapper"},i("div",{class:"s-multiple-bundle-product-content"},i("div",{class:"s-multiple-bundle-product-details"},i("div",{class:"s-multiple-bundle-product-title-wrapper"},i("h2",{class:"s-multiple-bundle-product-title"},i("a",{href:t?.url||"#",target:"_blank",rel:"noopener noreferrer"},t.name))),i("div",{class:"s-multiple-bundle-product-price-wrapper"},i("span",{class:"s-multiple-bundle-product-price"},i("span",{innerHTML:salla.money(t.price)})),t.sale_price>0&&i("span",{class:"s-multiple-bundle-product-price-discount"},i("span",{innerHTML:salla.money(t.regular_price)})))),t.quantity_in_group>0&&0!==t.quantity&&i("span",{class:"s-multiple-bundle-product-badge"},salla.lang.get("pages.products.pieces"),i("span",null,t.quantity_in_group)),0===t.quantity&&i("span",{class:"s-multiple-bundle-product-badge"},salla.lang.get("pages.products.quantity_in_group_finished"))),t.options?.length>0&&i("button",{class:"s-multiple-bundle-product-button",onClick:()=>this.handleOptionsClick(t),type:"button"},a,i("span",{class:"s-multiple-bundle-product-button-icon",innerHTML:c})))))})))))}get host(){return n(this)}};a.style="";export{d as salla_multiple_bundle_product_options_modal,a as salla_multiple_bundle_product_slider}
4
+ import{r as t,c as s,h as i,H as e,a as n}from"./p-C670SYee.js";import{A as o,a as l}from"./p-Vqpj4CWE.js";const d=class{constructor(i){t(this,i),this.optionsSaved=s(this,"optionsSaved"),this.productSelected=s(this,"productSelected"),this.product=null,this.sectionId=null,this.sectionIndex=0,this.productIndex=0,this.selectedOptions={},this.optionsResetTokens={},this.isLoading=!1,this.hasUnsavedChanges=!1,this.validationErrors=[],this.isProductAlreadySelected=!1}generateCacheKey(t,s,i){return`${t||"unknown"}-${s||0}-${i||"unknown"}`}handleProductChange(t){setTimeout((()=>{this.modal&&t&&this.modal.setTitle(t.name||"")}),100),this.validationErrors=[],this.hasUnsavedChanges=!1}async open(){this.modal?(this.isLoading=!0,this.product?.name&&this.modal.setTitle(this.product.name),this.modal.open(),setTimeout((async()=>{this.product?.id&&await this.initializeSelectedOptions(),this.product?.name&&this.modal.setTitle(this.product.name),this.modal.stopLoading(),this.isLoading=!1}),300)):requestAnimationFrame((()=>this.open()))}async close(){this.modal&&this.modal.close()}async refreshOptionsState(){this.selectedOptions={...this.selectedOptions}}componentDidLoad(){this.modalOpenListener=t=>{this.product=t.product,this.sectionId=t.sectionId||null,this.sectionIndex=t.sectionIndex||0,this.productIndex=t.productIndex||0,this.isProductAlreadySelected=!!t.isProductAlreadySelected,this.open()},salla.event.on("multiple-bundle-product-modal::open",this.modalOpenListener),this.clearOptionsListener=t=>{t&&t.productId&&this.clearProductOptions(t.productId,t.sectionId,t.productIndex)},salla.event.on("multiple-bundle-product-modal::clear-options",this.clearOptionsListener),this.optionChangeListener=t=>{const s=t.detail||t,{option:i,detail:e}=s,n=i||s.option_id&&this.product?.options?.find((t=>t.id===s.option_id||String(t.id)===String(s.option_id))),o=e||(s.id?s:null);this.product?.id&&n&&this.handleOptionChange(Number(this.product.id),n,o)},salla.event.on("product-options::change",this.optionChangeListener),this.checkboxChangeListener=t=>{const s=t.target;if(s&&"checkbox"===s.type&&s.name&&s.name.includes("bundle[")&&s.name.includes("][id]")){const t=s.name.match(/^bundle\[([^\]]+)\]\[([^\]]+)\]\[id\]$/);if(t&&!s.checked){if("true"===s.getAttribute("data-selection-locked"))return void(s.checked=!0);const[,i,e]=t,n=s.value,o=this.host.closest("form");this.cleanupProductDeselection({sectionId:i,productIndex:parseInt(e,10),productId:n,form:o,uncheckedInput:s})}}},document.addEventListener("change",this.checkboxChangeListener)}disconnectedCallback(){this.checkboxChangeListener&&document.removeEventListener("change",this.checkboxChangeListener),this.optionChangeListener&&salla.event.off("product-options::change",this.optionChangeListener),this.modalOpenListener&&salla.event.off("multiple-bundle-product-modal::open",this.modalOpenListener),this.clearOptionsListener&&salla.event.off("multiple-bundle-product-modal::clear-options",this.clearOptionsListener)}cleanupProductDeselection(t){const{sectionId:s,productIndex:i,productId:e,form:n,uncheckedInput:o}=t;if(this.clearProductOptions(e,s,i),n){const t=`bundle[${s}][${i}]`;Array.from(n.querySelectorAll(`input[name^="${t}"]`)).forEach((s=>{if(s===o)return;const i="hidden"===s.type,n=s.getAttribute("data-product-id")===String(e)&&s.name?.startsWith(t);(i||n)&&s.remove()})),requestAnimationFrame((()=>{const t=new window.Event("change",{bubbles:!0});n.dispatchEvent(t)}))}}generateFormInputName(t,s,i){return`bundle[${t}][${s}][options][${i}]`}async initializeSelectedOptions(){if(!this.product?.id)return;const t=this.product.id,s=this.generateCacheKey(this.sectionId,this.productIndex,t),i=document.querySelector(`salla-product-options[product-id="${t}"]`);if(i)try{const t=await i.getSelectedOptions();t&&t.length>0&&(this.selectedOptions={...this.selectedOptions,[s]:t})}catch(t){console.warn("Could not initialize selected options:",t)}}clearProductOptions(t,s,i){const e={...this.selectedOptions};if(null==s||null==i||Number.isNaN(i)){const s=`-${String(t)}`,i=[];Object.keys(e).forEach((t=>{t.endsWith(s)&&(delete e[t],i.push(t))})),i.forEach((t=>this.bumpOptionsResetToken(t)))}else{const n=this.generateCacheKey(s,i,t);delete e[n],this.bumpOptionsResetToken(n)}this.selectedOptions=e,this.validationErrors=[],this.hasUnsavedChanges=!1}bumpOptionsResetToken(t){t&&(this.optionsResetTokens={...this.optionsResetTokens,[t]:(this.optionsResetTokens[t]||0)+1})}async handleOptionChange(t,s,i){const e=this.generateCacheKey(this.sectionId,this.productIndex,t),n=document.querySelector(`salla-product-options[product-id="${t}"]`);let o=[];if(n)try{o=await n.getSelectedOptions()||[]}catch(t){console.warn("Could not get current selections from component:",t)}if(o.length>0)this.selectedOptions={...this.selectedOptions,[e]:o};else if(this.selectedOptions[e]&&this.selectedOptions[e].length>0){const t=[...this.selectedOptions[e]||[]],n=t.findIndex((t=>t.option_id===s.id));n>-1?i&&null!=i.id?t[n]={...i,option_id:s.id}:t.splice(n,1):i&&null!=i.id&&t.push({...i,option_id:s.id}),this.selectedOptions={...this.selectedOptions,[e]:t}}else i&&null!=i.id&&(this.selectedOptions={...this.selectedOptions,[e]:[{...i,option_id:s.id}]});this.hasUnsavedChanges=!0,this.validationErrors=[]}async validateOptions(){if(!this.product?.options)return!0;const t=[],s=this.product.id,i=this.generateCacheKey(this.sectionId,this.productIndex,s),e=document.querySelector(`salla-product-options[product-id="${s}"]`);let n=[];if(e)try{n=await e.getSelectedOptions()||[];const t=this.selectedOptions[i]||[];(t.length>n.length||0===n.length&&t.length>0)&&(n=t)}catch(t){n=this.selectedOptions[i]||[]}else n=this.selectedOptions[i]||[];return 0===n.length&&t.push(salla.lang.get("pages.products.no_options_selected")),this.product.options.forEach((s=>{s.required&&(n.some((t=>t.option_id==s.id))||t.push(salla.lang.get("pages.products.required_option_missing",{option:s.name})))})),this.validationErrors=t,0===t.length}async onSave(t){t.preventDefault();const s=this.product?.id;if(!s)return;const i=this.generateCacheKey(this.sectionId,this.productIndex,s);if(await new Promise((t=>setTimeout(t,100))),await this.validateOptions()){if(!this.isProductAlreadySelected&&null!=this.sectionId){const t=this.host.closest("salla-multiple-bundle-product-details");if(!await(t?.canSelectBundleProduct(this.sectionId,s)))return void salla.notify.error(salla.lang.getWithDefault("pages.products.bundle_selection_limit_reached","لا يمكنك اختيار المزيد من المنتجات في هذا القسم"))}this.isLoading=!0;try{const t=document.querySelector(`salla-product-options[product-id="${s}"]`);let e=await(t?.getSelectedOptions());if((!e||0===e.length)&&this.selectedOptions[i]?.length>0&&(e=this.selectedOptions[i]),!e||0===e.length)return void(this.isLoading=!1);this.selectedOptions={...this.selectedOptions,[i]:e};const n=this.host.closest("form");if(!n)return void(this.isLoading=!1);const o=`bundle[${this.sectionId}][${this.productIndex}]`;Array.from(n.querySelectorAll(`input[name^="${o}"][type="hidden"]`)).forEach((t=>t.remove())),Array.from(n.querySelectorAll(`[data-product-id="${s}"][name^="${o}"]`)).forEach((t=>t.remove()));const l=`bundle[${this.sectionId}][${this.productIndex}][id]`,d=document.getElementById(l);if(d)d.checked=!0;else{const t=document.createElement("input");t.type="hidden",t.name=`bundle[${this.sectionId}][${this.productIndex}][id]`,t.value=String(s),t.dataset.productId=String(s),n.appendChild(t)}e.forEach((t=>{const i=t.option_id,e=document.createElement("input");e.type="hidden",e.name=this.generateFormInputName(this.sectionId,this.productIndex??0,i),e.value=String(t.id),e.dataset.productId=String(s),n.appendChild(e)}));const a=new window.Event("change",{bubbles:!0});n.dispatchEvent(a),this.optionsSaved.emit({productId:Number(s),selectedOptions:e,sectionId:this.sectionId,productIndex:this.productIndex}),this.sectionId&&this.productSelected.emit({productId:Number(s),sectionId:this.sectionId,product:this.product,fromModal:!0}),salla.notify.success(salla.lang.get("pages.products.options_saved")),this.hasUnsavedChanges=!1,this.validationErrors=[],this.modal.close()}catch(t){salla.notify.error(salla.lang.get("pages.products.options_save_error"))}finally{this.isLoading=!1}}else salla.notify.error(this.validationErrors.join(", "))}getOptionsWithSelectedState(){if(!this.product?.options)return[];const t=this.generateCacheKey(this.sectionId,this.productIndex,this.product.id),s=this.selectedOptions[t]||[];return this.product.options.map((t=>({...t,details:t.details.map((t=>{const i=s.some((s=>s.id===t.id));return{...t,is_selected:i}}))})))}render(){const t=this.product?.id,s=this.getOptionsWithSelectedState(),n=this.generateCacheKey(this.sectionId,this.productIndex,t),o=this.optionsResetTokens[n]||0,l=this.isLoading||s.some((t=>t.details.some((t=>t.is_selected&&!0===t.is_out))));return i(e,{key:"80217a97bc81ba7eb770cfa88347530b5cc0850d"},i("salla-modal",{key:"f23a97440cdb8418a0f8cf129328fb8c0a0a4fc5",isLoading:this.isLoading,ref:t=>this.modal=t,width:"md",centered:!1,id:`s-multiple-bundle-product-options-modal-options-${t}`,class:"s-multiple-bundle-product-options-modal-wrapper"},i("div",{key:"06dfaf9708dd142dd0e44b6846cc0ca49be39bb6",slot:"loading"},i("salla-skeleton",{key:"a5d348f9a5158ee85d418f30f302a929f0a4dbdd",height:"100%",width:"100%"})),this.product?.images&&this.product?.images.length>0&&i("salla-slider",{key:"d3b1a1bb86708a807ee0c3a0168440f9d38b1eb8",id:`details-slider-${this.product?.id}`,type:"thumbs",loop:!1,"auto-height":!0,"listen-to-thumbnails-option":!0,showThumbsControls:!1,controlsOuter:!1,showControls:!1,class:"s-multiple-bundle-product-options-modal-slider",verticalThumbs:!0,thumbsConfig:{centeredSlides:!0,centeredSlidesBounds:!0,slidesPerView:Math.min(5,Math.max(1,this.product?.images.length)),watchOverflow:!0,watchSlidesProgress:!0,direction:"vertical",spaceBetween:10}},i("div",{key:"b7d04522efcb3f0a85ac78a9bf6f654973f6c777",slot:"items"},this.product?.images&&this.product?.images.map(((t,s)=>i("div",{key:s,class:"swiper-slide"},i("img",{src:t.url,alt:t.alt||`${this.product?.name} - Image ${s+1}`,loading:"lazy",onError:t=>{t.target.style.display="none"}}))))),this.product?.images&&this.product?.images.length>1&&i("div",{key:"3751a38d528780bb5f6ede2eb74365eefd5d42c7",slot:"thumbs"},this.product?.images&&this.product?.images.map(((t,s)=>i("div",{key:s,"data-caption":`${this.product?.name} - Image ${s+1}`},i("img",{src:t.url,loading:"eager",class:"s-multiple-bundle-product-options-modal-slider-thumb",title:`${this.product?.name} - ${s+1}`,alt:t.alt||`${this.product?.name} - ${s+1}`,onError:t=>{t.target.style.display="none"}})))))),i("salla-product-options",{options:JSON.stringify(s),key:`${n}-reset-${o}`,"product-id":t,"unique-key":`${n}-reset-${o}`}),i("div",{key:"68d6671c68f3753edd92f3c8ea8c91774038da59",slot:"footer"},i("div",{key:"f980914dbdbbea3aa02f6c816e2372f7bb09009e",class:"s-multiple-bundle-product-options-modal-footer"},i("salla-button",{key:"5d67dc612aa88fbc6eb11bcd5be0fc6d77a15aba",onClick:t=>this.onSave(t),loading:this.isLoading,disabled:l},this.isLoading?salla.lang.get("common.elements.saving"):salla.lang.get("common.elements.save"))))))}get host(){return n(this)}static get watchers(){return{product:["handleProductChange"]}}};d.style=":host{display:block}";const a=class{constructor(i){t(this,i),this.productSelected=s(this,"productSelected"),this.productOptionsSelected=s(this,"productOptionsSelected"),this.selectedProducts={},this.isSelectionLocked=!1,this.selectionLimit=0,this.savedOptionsByInstance={},this.handleProductClick=(t,s)=>{const i=this.selectedProducts[this.section.id]?.has(t.id)||!1,e=this.getCheckbox(this.section.id,s);if(i&&this.isSelectionLocked)return void(e&&(e.checked=!0));if(!i&&this.isMaxSelectionReached()&&1!==this.selectionLimit)return;if(1===this.selectionLimit&&!i)return void this.productSelected.emit({product:t,sectionId:this.section.id});if(!e)return;const n=!e.checked;n||(this.dispatchClearOptionsEvent(t,s),this.clearSavedOptionsState(this.section.id,s)),e.checked=n,requestAnimationFrame((()=>{const t=new window.Event("change",{bubbles:!0});e.dispatchEvent(t)})),this.productSelected.emit({product:t,sectionId:this.section.id})},this.handleOptionsClick=t=>{!this.selectedProducts[this.section.id]?.has(t.id)&&this.isMaxSelectionReached()&&1!==this.selectionLimit||this.productOptionsSelected.emit({product:t,sectionId:this.section.id})}}getSelectedCount(){return this.selectedProducts[this.section?.id]?.size??0}isMaxSelectionReached(){return this.selectionLimit>1&&this.getSelectedCount()>=this.selectionLimit}isProductSelectionDisabled(t,s){return 0===t.quantity||!s&&this.isMaxSelectionReached()}getProductInstanceKey(t,s){return`${t}::${s}`}dispatchClearOptionsEvent(t,s){salla.event.dispatch("multiple-bundle-product-modal::clear-options",{productId:t.id,sectionId:this.section.id,sectionIndex:this.sectionIndex,productIndex:s})}handleOptionsSaved(t){const s=t.detail;if(!s)return;const{sectionId:i,productIndex:e,selectedOptions:n}=s;if(null==i||i!==this.section?.id)return;if(null==e||Number.isNaN(e))return;const o=this.getProductInstanceKey(i,e);if(n?.length)this.savedOptionsByInstance={...this.savedOptionsByInstance,[o]:!0};else if(this.savedOptionsByInstance[o]){const t={...this.savedOptionsByInstance};delete t[o],this.savedOptionsByInstance=t}}clearSavedOptionsState(t,s){const i=this.getProductInstanceKey(t,s);if(!this.savedOptionsByInstance[i])return;const e={...this.savedOptionsByInstance};delete e[i],this.savedOptionsByInstance=e}generateEventName(t,s){return`bundle[${t}][${s}][id]`}getCheckbox(t,s){const i=this.generateEventName(t,s);return this.host.querySelector(`input.s-multiple-bundle-product-checkbox[name="${i}"]`)}preventLockedDeselect(t,s){if(!this.isSelectionLocked||!s)return;t.preventDefault(),t.stopPropagation();const i=t.target;"checkbox"===i?.type&&(i.checked=!0)}render(){return i(e,{key:"84a2765b8e57fa7d4d757c7e0c8a634199e7f121"},i("salla-slider",{key:"67d1748a2c19adca4db056bd3b5e5de6813aa367",type:"carousel",controlsOuter:!1,showControls:!1,id:`accordion-multiple-bundle-product-${this.section.id}`,pagination:!0,class:"s-multiple-bundle-product-wrapper-slider",sliderConfig:{spaceBetween:0}},i("div",{key:"04547e4a998d15377a2d5573bd0c4d8d33a93af7",slot:"items"},this?.section?.products?.map(((t,s)=>{const e=this.selectedProducts[this.section.id]?.has(t.id)||!1,n=e&&this.isSelectionLocked,d=this.isProductSelectionDisabled(t,e),a=this.savedOptionsByInstance[this.getProductInstanceKey(this.section.id,s)]?salla.lang.getWithDefault("pages.products.edit_selected_options","تعديل الخيارات"):salla.lang.get("pages.products.choose_from_options");let c=salla.config.get("theme.is_rtl",!0)?o:l;return i("div",{class:"s-multiple-bundle-product-slide-one-third"+(d?" s-multiple-bundle-product-slide-one-third-disabled":""),key:t.id},i("div",{class:"s-multiple-bundle-product-card"},i("div",{class:"s-multiple-bundle-product-image-wrapper",onClick:()=>this.handleProductClick(t,s)},i("input",{id:this.generateEventName(this.section.id,s),type:"checkbox",class:"s-multiple-bundle-product-checkbox",checked:e,"data-selection-locked":n?"true":void 0,name:this.generateEventName(this.section.id,s),value:t.id,onClick:t=>this.preventLockedDeselect(t,e),onChange:t=>this.preventLockedDeselect(t,e)}),i("img",{src:t.image.url||salla.url.cdn("images/s-empty.png"),loading:"lazy",alt:t.image.alt||t.name,class:"s-multiple-bundle-product-image"})),i("div",{class:"s-multiple-bundle-product-content-wrapper"},i("div",{class:"s-multiple-bundle-product-content"},i("div",{class:"s-multiple-bundle-product-details"},i("div",{class:"s-multiple-bundle-product-title-wrapper"},i("h2",{class:"s-multiple-bundle-product-title"},i("a",{href:t?.url||"#",target:"_blank",rel:"noopener noreferrer"},t.name))),i("div",{class:"s-multiple-bundle-product-price-wrapper"},i("span",{class:"s-multiple-bundle-product-price"},i("span",{innerHTML:salla.money(t.price)})),t.sale_price>0&&i("span",{class:"s-multiple-bundle-product-price-discount"},i("span",{innerHTML:salla.money(t.regular_price)})))),t.quantity_in_group>0&&0!==t.quantity&&i("span",{class:"s-multiple-bundle-product-badge"},salla.lang.get("pages.products.pieces"),i("span",null,t.quantity_in_group)),0===t.quantity&&i("span",{class:"s-multiple-bundle-product-badge"},salla.lang.get("pages.products.quantity_in_group_finished"))),t.options?.length>0&&i("button",{class:"s-multiple-bundle-product-button",onClick:()=>this.handleOptionsClick(t),type:"button"},a,i("span",{class:"s-multiple-bundle-product-button-icon",innerHTML:c})))))})))))}get host(){return n(this)}};a.style="";export{d as salla_multiple_bundle_product_options_modal,a as salla_multiple_bundle_product_slider}
@@ -0,0 +1,4 @@
1
+ /*!
2
+ * Crafted with ❤ by Salla
3
+ */
4
+ import{r as s,f as e,h as t,H as i}from"./p-C670SYee.js";import{S as o}from"./p-BscTeWDc.js";var r;!function(s){s.DEFAULT="default",s.AVAILABILITY="availability"}(r||(r={}));const a=class{constructor(e){s(this,e),this.loadedScopes={[r.DEFAULT]:null,[r.AVAILABILITY]:null},this.translationLoaded=!1,this.mode=r.DEFAULT,this.scopes=[],this.originalScopesList=[],this.isOpenedBefore=salla.storage.get("branch-choosed-before"),this.hasError=!1,this.loading=!1,this.selection="optional",this.searchDisplayLimit=6,this.getFormTitle=()=>{if(this.originalScopesList?.length<2)return"";const s=salla.config.get("store.features")?.includes("multi-countries");return this.mode===r.DEFAULT?salla.lang.get(s?"blocks.scope.shopping_from_another_market":"blocks.scope.shopping_from_another_branch"):salla.lang.get(s?"blocks.scope.search_for_availability_in_other_markets":"blocks.scope.search_for_availability_in_other_branches")},salla.event.on("scopes::open",(({mode:s=null,product_id:e=null}={})=>{this.open(s,e)}))}connectedCallback(){this.langUnsubscribe=salla.lang.subscribe((()=>{this.translationLoaded=!0,e(this)}))}disconnectedCallback(){this.langUnsubscribe?.()}get isNativeApp(){return!!salla.mobile?.isSpaWebview?.()}async close(){return await(this.modal?.close())}async open(s=r.DEFAULT,e=null){return this.isNativeApp?(salla.log("SallaScope:: delegated open to native app"),void salla.mobile?.openScopes?.()):(this.hasError=!1,this.mode=[r.AVAILABILITY,r.DEFAULT].includes(s)?s:r.DEFAULT,this.loading=!this.loadedScopes[this.mode],this.setScopeValues([]),salla.log("SallaScope:: opened"),this.modal.open(),this.loading?await salla.api.withoutNotifier((()=>s==r.AVAILABILITY?salla.scope.getProductAvailability(e):salla.scope.get())).then((e=>{if(s==r.AVAILABILITY)return this.setScopeValues(this.loadedScopes[r.AVAILABILITY]=e.data);this.setScopeValues(this.loadedScopes[this.mode]=e.data.scopes)})).catch((s=>{console.log(s),this.hasError=!0})).finally((()=>{this.modal.stopLoading(),this.loading=!1})):(this.setScopeValues(this.loadedScopes[this.mode]),this.modal.stopLoading()))}async handleSubmit(){let s={id:this.current_scope.id};return this.changeBtn.load(),await salla.scope.change(s).then((()=>{salla.storage.set("branch-choosed-before",!0),salla.storage.set("scope",{type:this.current_scope.type,id:this.current_scope.id}),salla.cart.reset(),window.location.replace(salla.helpers.addParamToUrl("scope",this.current_scope.id))})).catch((s=>console.log(s))).finally((()=>{this.changeBtn.stop()}))}setScopeValues(s){this.scopes=s,this.originalScopesList=s,1==s?.length?(this.current_scope=s[0],this.selected_scope=s[0],this.scopes=[s[0]]):(this.current_scope=s?.find((s=>s.selected)),this.selected_scope=s?.find((s=>s.selected)))}handleSearchFieldTyping(s){let e=s.target.value.toLocaleLowerCase();this.scopes=e?this.originalScopesList.filter((s=>s.name.toLowerCase().includes(e))):this.originalScopesList}handleScopeSelection(s){this.current_scope=this.scopes?.find((e=>e.id==s.target.value))}placeholderContent(){return t("salla-placeholder",{alignment:"center",class:"s-scopes-placeholder"},t("span",{slot:"title"},salla.lang.get("blocks.scope.branch_looking_for_not_found")),t("span",{slot:"description"},salla.lang.get("blocks.scope.our_services_not_available_in_this_branch")))}defaultContent(){return[t("div",{class:"s-scopes-container s-scrollbar"},this.scopes?.map((s=>t("div",{class:"s-scopes-input-wrap","data-selection":this.selection},t("input",{id:`${this.selection} + '_scope_' + ${s.id}`,name:"lang",type:"radio",value:s.id,onChange:s=>this.handleScopeSelection(s),class:"s-scopes-input",checked:!!this.current_scope&&this.current_scope.id==s.id}),t("label",{htmlFor:`${this.selection} + '_scope_' + ${s.id}`,class:"s-scopes-label s-scopes-clickable"},t("span",null,s.icon&&t("img",{src:s.icon,alt:"",loading:"lazy",class:"s-scopes-icon"}),s.name)))))),this.footerContent()]}availabilityContent(){return t("div",{class:"s-scopes-container"},this.scopes?.map((s=>t("div",{class:"s-scopes-input-wrap","data-selection":this.selection},t("h2",{class:{"s-scopes-label":!0,"s-scopes-clickable":this.mode===r.DEFAULT}},t("span",null,s.name)),t("h2",{style:{color:s?.availability?.color},class:`s-scopes-${s?.availability?.key}`},s?.availability?.label)))))}footerContent(){return t("div",{class:"s-scopes-footer"},t("slot",{name:"footer"},t("salla-button",{ref:s=>this.changeBtn=s,disabled:!this.current_scope,onClick:()=>this.handleSubmit(),class:"s-scopes-submit","loader-position":"center",width:"wide"},salla.lang.get("common.elements.confirm"))))}componentWillLoad(){return salla.onReady()}render(){return this.isNativeApp?null:t(i,null,t("salla-modal",{ref:s=>this.modal=s,isClosable:!(!this.isOpenedBefore&&"optional"!=this.selection),class:"s-scopes-modal",isLoading:this.loading,"has-skeleton":!0},this.loading?t("div",{slot:"loading"},t("div",{class:"s-scopes-skeleton"},t("salla-list-tile",{class:"s-scopes-header"},t("div",{slot:"icon",class:"s-scopes-header-icon"},t("salla-skeleton",{type:"circle"})),t("div",{slot:"title",class:"s-scopes-header-title mb-5"},t("salla-skeleton",{height:"15px",width:"50%"})),t("div",{slot:"subtitle",class:"s-scopes-header-subtitle"},t("salla-skeleton",{height:"10px"}),t("salla-skeleton",{height:"10px",width:"75%"}))),t("div",{class:"s-scopes-skeleton-search"},t("salla-skeleton",{height:"10px",width:"50%"}),t("salla-skeleton",{height:"30px",width:"100%"})),t("div",{class:"s-scopes-skeleton-scopes"},t("salla-skeleton",{height:"10px",width:"30%"}),t("salla-skeleton",{height:"10px",width:"25%"}),t("salla-skeleton",{height:"10px",width:"30%"}),t("salla-skeleton",{height:"10px",width:"25%"}),t("salla-skeleton",{height:"10px",width:"30%"}),t("salla-skeleton",{height:"10px",width:"25%"}),t("salla-skeleton",{height:"10px",width:"30%"}),t("salla-skeleton",{height:"10px",width:"25%"})),t("div",{class:"s-scopes-skeleton-btn"},t("salla-skeleton",{height:"40px",width:"100%"})))):[t("salla-list-tile",{class:this.originalScopesList?.length?"s-scopes-header block":"s-hidden"},t("div",{slot:"icon",class:"s-scopes-header-icon",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>store-alt</title>\n<path d="M6.667 24h5.333c0.736 0 1.333-0.596 1.333-1.333s-0.597-1.333-1.333-1.333h-5.333c-0.736 0-1.333 0.596-1.333 1.333s0.597 1.333 1.333 1.333zM31.86 10.071l-4-8c-0.227-0.452-0.688-0.737-1.193-0.737h-21.333c-0.505 0-0.967 0.285-1.193 0.737l-4 8c-0.092 0.184-0.14 0.389-0.14 0.596v18.667c0 0.737 0.597 1.333 1.333 1.333h29.333c0.736 0 1.333-0.596 1.333-1.333v-18.667c0-0.207-0.048-0.412-0.14-0.596zM6.157 4h19.685l3.333 6.667h-26.352zM24 28h-5.333v-9.333h5.333zM29.333 28h-2.667v-10.667c0-0.737-0.597-1.333-1.333-1.333h-8c-0.736 0-1.333 0.596-1.333 1.333v10.667h-13.333v-14.667h26.667zM6.667 18.667h5.333c0.736 0 1.333-0.596 1.333-1.333s-0.597-1.333-1.333-1.333h-5.333c-0.736 0-1.333 0.596-1.333 1.333s0.597 1.333 1.333 1.333z"></path>\n</svg>\n'}),t("div",{slot:"title",class:"s-scopes-header-title"},salla.lang.get("blocks.scope.you_are_browse_store_from")),t("div",{slot:"subtitle",class:"s-scopes-header-subtitle"},this.selected_scope?this.selected_scope.name:"")),t("div",{class:"s-scopes-wrap"},!!this.originalScopesList?.length&&t("h4",{class:"s-scopes-title"},this.getFormTitle()),this.originalScopesList?.length>this.searchDisplayLimit?t("div",{class:"s-scopes-search-wrapper"},t("div",{class:"s-scopes-search-icon",innerHTML:o}),t("input",{type:"text",class:"s-scopes-search-input",onInput:s=>this.handleSearchFieldTyping(s),enterkeyhint:"search",placeholder:salla.lang.get("blocks.scope.searching_for_a_branch")})):"",this.hasError||!this.originalScopesList?.length&&this.mode!==r.AVAILABILITY?this.placeholderContent():this.mode===r.DEFAULT?this.defaultContent():this.availabilityContent())]))}async componentDidLoad(){await Salla.hooks.registerComponent("salla-scopes",this),salla.config.isMobileApp()||this.isNativeApp||this.isOpenedBefore||"mandatory"!=this.selection||this.open()}};a.style='/*!twlt*/.s-scopes-availability-content{display:flex;justify-content:center;align-items:center}.s-scopes-placeholder{flex:0 0 85%}.mb-5{margin-bottom:1.25rem}.block{display:block}.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-hidden{display:none}.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}.s-hidden{display:none}.s-scrollbar::-webkit-scrollbar{width:5px}.s-scrollbar::-webkit-scrollbar-track{background-color:#eee}.s-scrollbar::-webkit-scrollbar-thumb{background-color:var(--color-primary);border-radius:10px;-webkit-border-radius:10px;-moz-border-radius:10px;-ms-border-radius:10px;-o-border-radius:10px}.s-scopes-title{margin-bottom:0.75rem}.s-scopes-header{margin-bottom:0.5rem;display:block;text-align:center}.s-scopes-header-icon{margin:auto;display:flex;height:5rem;width:5rem;align-items:center;justify-content:center;border-radius:9999px;border-width:1px;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1));--tw-bg-opacity:1;background-color:rgb(252 252 252 / var(--tw-bg-opacity, 1))}.s-scopes-header-icon svg{height:2rem;fill:var(--color-primary)}.s-scopes-header-title{font-size:1.125rem;line-height:1.75rem;--tw-text-opacity:1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.s-scopes-header-subtitle{text-align:left;font-size:1.25rem;line-height:1.75rem}.s-scopes-header-subtitle:where([dir="rtl"],[dir="rtl"] *){text-align:right}.s-scopes-search-wrapper{position:relative;width:100%}.s-scopes-search-icon{pointer-events:none;position:absolute;top:0px;bottom:0px;left:0px;display:flex;align-items:center;padding-left:0.75rem}.s-scopes-search-icon:where([dir="rtl"],[dir="rtl"] *){left:auto;right:0px;padding-left:0px;padding-right:0.75rem}.s-scopes-search-icon svg{height:1.25rem;width:1.25rem;fill:#9ca3af}.s-scopes-search-input{display:block;width:100%;border-radius:var(--s-radius, 0.25rem);border-width:1px;--tw-border-opacity:1;border-color:rgb(209 213 219 / var(--tw-border-opacity, 1));--tw-bg-opacity:1;background-color:rgb(249 250 251 / var(--tw-bg-opacity, 1));padding:0.625rem;padding-left:2.5rem;font-size:0.875rem;line-height:1.25rem;--tw-text-opacity:1;color:rgb(17 24 39 / var(--tw-text-opacity, 1))}.s-scopes-search-input:focus{--tw-ring-color:var(--color-primary)}.s-scopes-search-input:where([dir="rtl"],[dir="rtl"] *){padding-left:0px;padding-right:2.5rem}.s-scopes-input-wrap{margin-bottom:1.25rem;display:flex;align-items:center}.s-scopes-input-wrap:last-child{margin-bottom:0px}.s-scopes-input{height:1rem;width:1rem;--tw-border-opacity:1;border-color:rgb(209 213 219 / var(--tw-border-opacity, 1));color:var(--color-primary)}.s-scopes-input:focus{--tw-ring-color:var(--color-primary)}.s-scopes-input:where([dir="ltr"],[dir="ltr"] *){margin-right:0.75rem}.s-scopes-input:where([dir="rtl"],[dir="rtl"] *){margin-left:0.75rem}.s-scopes-icon{display:inline-block;height:2rem;width:2rem;border-radius:var(--s-radius, 0.25rem);object-fit:contain;vertical-align:middle}.s-scopes-icon:where([dir="ltr"],[dir="ltr"] *){margin-right:0.75rem}.s-scopes-icon:where([dir="rtl"],[dir="rtl"] *){margin-left:0.75rem}.s-scopes-label{display:flex;flex-grow:1;align-items:center;justify-content:space-between;font-size:1rem;line-height:1.5rem;font-weight:500;--tw-text-opacity:1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.s-scopes-select{height:2.5rem;width:100%;appearance:none;border-radius:0.375rem;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1));padding-left:1rem;padding-right:1rem;font-size:0.875rem;line-height:1.25rem;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:300ms}.s-scopes-select:focus{border-color:var(--color-primary)}.s-scopes-container{margin-top:1.25rem;max-height:300px;overflow-y:auto;padding-left:0.5rem}.s-scopes-container:where([dir="rtl"],[dir="rtl"] *){padding-left:0px;padding-right:0.5rem}.s-scopes-sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0, 0, 0, 0);white-space:nowrap;border-width:0}.s-scopes-is-closed{opacity:0.5}.s-scopes-closed-badge{--tw-text-opacity:1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.s-scopes-clickable{cursor:pointer}.s-scopes-submit{margin-top:1.5rem;height:auto}.s-scopes-color-red{--tw-text-opacity:1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.s-scopes-color-green{--tw-text-opacity:1;color:rgb(34 197 94 / var(--tw-text-opacity, 1))}.s-scopes-color-gray{--tw-text-opacity:1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.s-scopes-hidden{display:none}.s-scopes-input-wrap.is-hidden-branch{display:none}.s-scopes-wrap{display:flex;max-height:350px;flex-direction:column}.s-scopes-wrap .s-placeholder-wrapper{display:flex;height:12rem;flex-direction:column;align-items:center;justify-content:center}.s-scopes-footer{margin-top:auto}.s-scopes-modal .s-modal-header{display:block !important}.s-scopes-skeleton .s-list-tile-item-content{display:block;width:100%}.s-scopes-skeleton .s-scopes-header-title>salla-skeleton{margin-top:0.75rem;margin-bottom:0.75rem;display:block}.s-scopes-skeleton .s-scopes-header-subtitle>salla-skeleton{margin-bottom:0.75rem;display:block}.s-scopes-skeleton .s-scopes-skeleton-scopes>salla-skeleton{margin-bottom:1.25rem;display:block}.s-scopes-skeleton .s-scopes-skeleton-search{margin-top:2rem;margin-bottom:2rem}.s-scopes-skeleton .s-scopes-skeleton-search>salla-skeleton{margin-bottom:0.75rem;display:block}.s-scopes-skeleton .s-list-tile-item-icon{margin-right:2rem}.s-scopes-skeleton .s-list-tile-item-icon:where([dir="rtl"],[dir="rtl"] *){margin-right:0px;margin-left:2rem}.s-scopes-skeleton-btn{margin-top:2rem}';export{a as salla_scopes}
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r as e,h as s,H as r}from"./p-noRE1pbw.js";import{s as t}from"./p-CxrJQ3Jf.js";const a=class{constructor(s){e(this,s),this.dark=!1,this.commercialRegisterLabel="",this.freelanceLabel=""}connectedCallback(){this.initializeTranslations()}disconnectedCallback(){this.langUnsubscribe?.()}isVisibilityEnforced(){return"SA"===salla.config.get("store.store_country")}initializeTranslations(){this.langUnsubscribe=salla.lang.subscribe((()=>{const e=(e,s,r)=>{t(e,s,r)};e("ar.trans","blocks.footer.commercial_register","السجل التجاري"),e("en.trans","blocks.footer.commercial_register","Commercial Register"),e("ar.trans","blocks.footer.freelance","وثيقة العمل الحر"),e("en.trans","blocks.footer.freelance","Freelance Certificate"),this.commercialRegisterLabel=salla.lang.getWithDefault("blocks.footer.commercial_register","السجل التجاري"),this.freelanceLabel=salla.lang.getWithDefault("blocks.footer.freelance","وثيقة العمل الحر")}))}getBadgeData(){const e=salla.config.get("store.settings.commercial_number"),s=salla.config.get("store.settings.freelance_number");return e?{number:e,label:this.commercialRegisterLabel||"السجل التجاري",imageUrl:salla.url.cdn("images/commercial-register.png",70,70),type:"commercial"}:s?{number:s,label:this.freelanceLabel||"وثيقة العمل الحر",imageUrl:this.dark?salla.url.cdn("images/freelance-white.png"):salla.url.cdn("images/freelance.png"),type:"freelance"}:null}render(){const e=this.getBadgeData();return e?s(r,{class:"s-trust-badges-wrapper "+(this.dark?"dark":"")},this.isVisibilityEnforced()?s("img",{class:"s-trust-badges-image",width:"55",height:"55",src:e.imageUrl,alt:e.label}):null,s("div",{class:"s-trust-badges-content"},s("p",{class:"s-trust-badges-label"},e.label),s("b",{class:"s-trust-badges-number"},e.number))):null}};a.style='/*!twlt*/.s-trust-badges-image{width:55px;height:55px;flex-shrink:0}.s-trust-badges-wrapper{display:flex;align-items:center}.s-trust-badges-wrapper>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-right:calc(0.5rem * var(--tw-space-x-reverse));margin-left:calc(0.5rem * calc(1 - var(--tw-space-x-reverse)))}.s-trust-badges-wrapper:where([dir="rtl"],[dir="rtl"] *)>:not([hidden])~:not([hidden]){--tw-space-x-reverse:1}.s-trust-badges-label{margin-bottom:0.25rem;font-size:0.875rem;line-height:1.25rem}.s-trust-badges-number{font-size:0.875rem;line-height:1.25rem}';export{a as salla_trust_badges}
4
+ import{r as e,h as s,H as r}from"./p-C670SYee.js";import{s as t}from"./p-CxrJQ3Jf.js";const a=class{constructor(s){e(this,s),this.dark=!1,this.commercialRegisterLabel="",this.freelanceLabel=""}connectedCallback(){this.initializeTranslations()}disconnectedCallback(){this.langUnsubscribe?.()}isVisibilityEnforced(){return"SA"===salla.config.get("store.store_country")}initializeTranslations(){this.langUnsubscribe=salla.lang.subscribe((()=>{const e=(e,s,r)=>{t(e,s,r)};e("ar.trans","blocks.footer.commercial_register","السجل التجاري"),e("en.trans","blocks.footer.commercial_register","Commercial Register"),e("ar.trans","blocks.footer.freelance","وثيقة العمل الحر"),e("en.trans","blocks.footer.freelance","Freelance Certificate"),this.commercialRegisterLabel=salla.lang.getWithDefault("blocks.footer.commercial_register","السجل التجاري"),this.freelanceLabel=salla.lang.getWithDefault("blocks.footer.freelance","وثيقة العمل الحر")}))}getBadgeData(){const e=salla.config.get("store.settings.commercial_number"),s=salla.config.get("store.settings.freelance_number");return e?{number:e,label:this.commercialRegisterLabel||"السجل التجاري",imageUrl:salla.url.cdn("images/commercial-register.png",70,70),type:"commercial"}:s?{number:s,label:this.freelanceLabel||"وثيقة العمل الحر",imageUrl:this.dark?salla.url.cdn("images/freelance-white.png"):salla.url.cdn("images/freelance.png"),type:"freelance"}:null}render(){const e=this.getBadgeData();return e?s(r,{class:"s-trust-badges-wrapper "+(this.dark?"dark":"")},this.isVisibilityEnforced()?s("img",{class:"s-trust-badges-image",width:"55",height:"55",src:e.imageUrl,alt:e.label}):null,s("div",{class:"s-trust-badges-content"},s("p",{class:"s-trust-badges-label"},e.label),s("b",{class:"s-trust-badges-number"},e.number))):null}};a.style='/*!twlt*/.s-trust-badges-image{width:55px;height:55px;flex-shrink:0}.s-trust-badges-wrapper{display:flex;align-items:center}.s-trust-badges-wrapper>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-right:calc(0.5rem * var(--tw-space-x-reverse));margin-left:calc(0.5rem * calc(1 - var(--tw-space-x-reverse)))}.s-trust-badges-wrapper:where([dir="rtl"],[dir="rtl"] *)>:not([hidden])~:not([hidden]){--tw-space-x-reverse:1}.s-trust-badges-label{margin-bottom:0.25rem;font-size:0.875rem;line-height:1.25rem}.s-trust-badges-number{font-size:0.875rem;line-height:1.25rem}';export{a as salla_trust_badges}
@@ -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-noRE1pbw.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}))}))}connectedCallback(){this.langUnsubscribe=salla.lang.subscribe((()=>{this.registerTranslationDefaults(),this.loadTranslations()}))}disconnectedCallback(){this.langUnsubscribe?.()}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:"371350c4fcfd92a9434000b1390cb5ab01a92cc5",class:"s-user-settings-wrapper"},this.canHideName&&t("div",{key:"4e4ade371cc81d7e4c5750f5341f30bfcfc082a6",class:"s-user-settings-section"},t("salla-list-tile",{key:"fd23340814c525c686f9c94e17bc6a3d2182ac1e"},t("div",{key:"d0cfc9df3a6072335133ac2817ed9afa34ea489e",slot:"icon",class:"s-user-settings-section-icon"},t("span",{key:"17546bf4c7931fafdb769168c6cb1788303a6312",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:"09ec636514d69b741a3cd1a91d5599d0ff34cca1",slot:"title",class:"s-user-settings-section-title"},this.capitalizeText(this.hideMyName)),t("div",{key:"f69abae297492ed509475590b2623745efb30f03",slot:"subtitle",class:"s-user-settings-section-subtitle"},this.capitalizeText(this.hideMyNameDesc)),t("div",{key:"17c0191aae2401b8a1cd22942a5acecc0dfe1c62",slot:"action",class:"s-user-settings-section-action"},t("label",{key:"6b55ddc3ec0a01767f870e279ae7bfad9f43663e",class:"s-toggle"},t("input",{key:"18af334c71b48528543de61a9c3a71a73dc054b5",class:"s-toggle-input",checked:this.isHiddenName,onChange:e=>this.toggleSetting("is_hidden_name",e),type:"checkbox"}),t("div",{key:"c90548df6ff7dc5beceeb2347545923ea4de096e",class:"s-toggle-switcher"}))))),t("div",{key:"c471b3a73abbfbc1a894e5f2c9fcb8af4ea085f5",class:"s-user-settings-section"},t("salla-list-tile",{key:"a906c43c0b227d6f757ec919047cfade9192cdc4"},t("div",{key:"7e4c1375e64883c3465393f855a9faa987137bc1",slot:"icon",class:"s-user-settings-section-icon"},t("span",{key:"5d8ee4cb69ddf765ddb6c108594c7de4cbedd078",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:"4e0e5b84822e98234be621eab4150c48581e104b",slot:"title",class:"s-user-settings-section-title"},this.capitalizeText(this.promotionalMsgs)),t("div",{key:"ac8521a039e4e869cb1aeea7213df8b70ce87bb7",slot:"subtitle",class:"s-user-settings-section-subtitle"},this.capitalizeText(this.promotionalMsgsDesc)),t("div",{key:"6caa3b3d1fe8eadc194ad44a4e2299f9a95018ea",slot:"action",class:"s-user-settings-section-action"},t("label",{key:"37a26623047ef4cb98f7bbdb8715b515488c5ac0",class:"s-toggle"},t("input",{key:"f74fbb125afb8743fc981672ffa56b129c4ed2ed",class:"s-toggle-input",checked:this.isNotifiable,onChange:e=>this.toggleSetting("is_notifiable",e),type:"checkbox"}),t("div",{key:"45b367693d63424e859d4dce5538a2ee37ff76a7",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-C670SYee.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}))}))}connectedCallback(){this.langUnsubscribe=salla.lang.subscribe((()=>{this.registerTranslationDefaults(),this.loadTranslations()}))}disconnectedCallback(){this.langUnsubscribe?.()}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:"371350c4fcfd92a9434000b1390cb5ab01a92cc5",class:"s-user-settings-wrapper"},this.canHideName&&t("div",{key:"4e4ade371cc81d7e4c5750f5341f30bfcfc082a6",class:"s-user-settings-section"},t("salla-list-tile",{key:"fd23340814c525c686f9c94e17bc6a3d2182ac1e"},t("div",{key:"d0cfc9df3a6072335133ac2817ed9afa34ea489e",slot:"icon",class:"s-user-settings-section-icon"},t("span",{key:"17546bf4c7931fafdb769168c6cb1788303a6312",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:"09ec636514d69b741a3cd1a91d5599d0ff34cca1",slot:"title",class:"s-user-settings-section-title"},this.capitalizeText(this.hideMyName)),t("div",{key:"f69abae297492ed509475590b2623745efb30f03",slot:"subtitle",class:"s-user-settings-section-subtitle"},this.capitalizeText(this.hideMyNameDesc)),t("div",{key:"17c0191aae2401b8a1cd22942a5acecc0dfe1c62",slot:"action",class:"s-user-settings-section-action"},t("label",{key:"6b55ddc3ec0a01767f870e279ae7bfad9f43663e",class:"s-toggle"},t("input",{key:"18af334c71b48528543de61a9c3a71a73dc054b5",class:"s-toggle-input",checked:this.isHiddenName,onChange:e=>this.toggleSetting("is_hidden_name",e),type:"checkbox"}),t("div",{key:"c90548df6ff7dc5beceeb2347545923ea4de096e",class:"s-toggle-switcher"}))))),t("div",{key:"c471b3a73abbfbc1a894e5f2c9fcb8af4ea085f5",class:"s-user-settings-section"},t("salla-list-tile",{key:"a906c43c0b227d6f757ec919047cfade9192cdc4"},t("div",{key:"7e4c1375e64883c3465393f855a9faa987137bc1",slot:"icon",class:"s-user-settings-section-icon"},t("span",{key:"5d8ee4cb69ddf765ddb6c108594c7de4cbedd078",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:"4e0e5b84822e98234be621eab4150c48581e104b",slot:"title",class:"s-user-settings-section-title"},this.capitalizeText(this.promotionalMsgs)),t("div",{key:"ac8521a039e4e869cb1aeea7213df8b70ce87bb7",slot:"subtitle",class:"s-user-settings-section-subtitle"},this.capitalizeText(this.promotionalMsgsDesc)),t("div",{key:"6caa3b3d1fe8eadc194ad44a4e2299f9a95018ea",slot:"action",class:"s-user-settings-section-action"},t("label",{key:"37a26623047ef4cb98f7bbdb8715b515488c5ac0",class:"s-toggle"},t("input",{key:"f74fbb125afb8743fc981672ffa56b129c4ed2ed",class:"s-toggle-input",checked:this.isNotifiable,onChange:e=>this.toggleSetting("is_notifiable",e),type:"checkbox"}),t("div",{key:"45b367693d63424e859d4dce5538a2ee37ff76a7",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}
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r as e,f as t,h as l,H as i}from"./p-noRE1pbw.js";const a=class{constructor(t){e(this,t),this.translationLoaded=!1,this.icon='\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>inbox</title>\n<path d="M31.984 19.797l-2.667-17.333c-0.1-0.651-0.659-1.131-1.317-1.131h-24c-0.659 0-1.217 0.48-1.317 1.131l-2.667 17.333c-0.011 0.067-0.016 0.135-0.016 0.203v6.667c0 2.205 1.795 4 4 4h24c2.205 0 4-1.795 4-4v-6.667c0-0.068-0.005-0.136-0.016-0.203zM5.144 4h21.712l2.256 14.667h-9.112c-0.736 0-1.333 0.596-1.333 1.333 0 1.471-1.196 2.667-2.667 2.667s-2.667-1.196-2.667-2.667c0-0.737-0.597-1.333-1.333-1.333h-9.112zM29.333 26.667c0 0.736-0.599 1.333-1.333 1.333h-24c-0.735 0-1.333-0.597-1.333-1.333v-5.333h8.168c0.593 2.299 2.684 4 5.165 4s4.571-1.701 5.165-4h8.168z"></path>\n</svg>\n',this.alignment="left",this.iconSize="md"}connectedCallback(){this.langUnsubscribe=salla.lang.subscribe((()=>{this.translationLoaded=!0,t(this)}))}disconnectedCallback(){this.langUnsubscribe?.()}alignmentClass(){return{"s-placeholder-wrapper":!0,"s-placeholder-align-left":"left"==this.alignment,"s-placeholder-align-center":"center"==this.alignment,"s-placeholder-align-right":"right"==this.alignment}}render(){return l(i,{key:"e0ddbbcae1f1770e0aa1fde820b80f010b837c70",class:this.alignmentClass()},l("div",{key:"42aaa39f4b5ff6e854d8752fd8b7f51967a61640",class:`s-placeholder-icon s-placeholder-icon-${this.iconSize}`,innerHTML:this.icon}),l("div",{key:"89b58694c6e8e52df2a6cfcf53f928e8e1be65cc",class:"s-placeholder-title"},l("slot",{key:"810a0cbc0338a430f48e0478d855baef78368d30",name:"title"},l("span",{key:"29f370d5460607afd3ad8971afb8387e3ab8ccd7"},salla.lang.get("common.elements.no_options")))),l("div",{key:"daabc9a39c770605c2b0a18a8e32c9b77cd28387",class:"s-placeholder-description"},l("slot",{key:"b318ca5417191c0e78eaab5e814dbc393679b416",name:"description"},l("span",{key:"1f616f82f63bbe79d7f88ae83544ce0ab97aa9fb"},salla.lang.get("common.errors.empty_results")))))}};a.style='/*!twlt*/.inline{display:inline}.contents{display:contents}.s-bullet-delivery-placeholder.s-placeholder-wrapper{margin-top:1rem !important;margin-bottom:1rem !important}.s-loyalty-confirmation-modal-content .s-placeholder-title{margin-bottom:0.75rem}.s-loyalty-confirmation-modal-content .s-placeholder-icon svg b{--tw-text-opacity:1;color:rgb(251 146 60 / var(--tw-text-opacity, 1))}.s-loyalty-confirmation-modal-content .s-placeholder-description{padding-left:1.25rem;padding-right:1.25rem}.s-placeholder-title{margin-bottom:0.25rem;font-size:1rem;line-height:1.5rem;--tw-text-opacity:1;color:rgb(17 24 39 / var(--tw-text-opacity, 1))}.s-placeholder-description{font-size:0.875rem;line-height:1.25rem;--tw-text-opacity:1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.s-placeholder-icon{margin-bottom:1rem;fill:#e5e7eb}.s-placeholder-align-left{text-align:left}.s-placeholder-align-center{text-align:center}.s-placeholder-align-right{text-align:right}.s-placeholder-align-right>.s-placeholder-icon{display:flex;align-items:center;justify-content:flex-end}.s-placeholder-align-right>.s-placeholder-icon:where([dir="rtl"],[dir="rtl"] *){justify-content:flex-start}.s-placeholder-align-center>.s-placeholder-icon{display:flex;align-items:center;justify-content:center}.s-placeholder-icon-xs>svg{height:1.5rem;width:1.5rem}.s-placeholder-icon-sm>svg{height:2.5rem;width:2.5rem}.s-placeholder-icon-md>svg{height:3.5rem;width:3.5rem}.s-placeholder-icon-lg>svg{height:4rem;width:4rem}.s-placeholder-icon-xl>svg{height:5rem;width:5rem}.s-placeholder-icon-xxl>svg{height:6rem;width:6rem}.s-placeholder-icon-xxxl>svg{height:7rem;width:7rem}.s-placeholder-icon-xs>i{font-size:20px}.s-placeholder-icon-sm>i{font-size:35px}.s-placeholder-icon-md>i{font-size:45px}.s-placeholder-icon-lg>i{font-size:58px}.s-placeholder-icon-xl>i{font-size:75px}.s-placeholder-icon-xxl>i{font-size:85px}.s-placeholder-icon-xxxl>i{font-size:100px}.s-placeholder-wrapper{margin-top:3rem;margin-bottom:3rem;display:block}.s-scopes-wrap .s-placeholder-wrapper{display:flex;height:12rem;flex-direction:column;align-items:center;justify-content:center}';export{a as salla_placeholder}
4
+ import{r as e,f as t,h as l,H as i}from"./p-C670SYee.js";const a=class{constructor(t){e(this,t),this.translationLoaded=!1,this.icon='\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>inbox</title>\n<path d="M31.984 19.797l-2.667-17.333c-0.1-0.651-0.659-1.131-1.317-1.131h-24c-0.659 0-1.217 0.48-1.317 1.131l-2.667 17.333c-0.011 0.067-0.016 0.135-0.016 0.203v6.667c0 2.205 1.795 4 4 4h24c2.205 0 4-1.795 4-4v-6.667c0-0.068-0.005-0.136-0.016-0.203zM5.144 4h21.712l2.256 14.667h-9.112c-0.736 0-1.333 0.596-1.333 1.333 0 1.471-1.196 2.667-2.667 2.667s-2.667-1.196-2.667-2.667c0-0.737-0.597-1.333-1.333-1.333h-9.112zM29.333 26.667c0 0.736-0.599 1.333-1.333 1.333h-24c-0.735 0-1.333-0.597-1.333-1.333v-5.333h8.168c0.593 2.299 2.684 4 5.165 4s4.571-1.701 5.165-4h8.168z"></path>\n</svg>\n',this.alignment="left",this.iconSize="md"}connectedCallback(){this.langUnsubscribe=salla.lang.subscribe((()=>{this.translationLoaded=!0,t(this)}))}disconnectedCallback(){this.langUnsubscribe?.()}alignmentClass(){return{"s-placeholder-wrapper":!0,"s-placeholder-align-left":"left"==this.alignment,"s-placeholder-align-center":"center"==this.alignment,"s-placeholder-align-right":"right"==this.alignment}}render(){return l(i,{key:"e0ddbbcae1f1770e0aa1fde820b80f010b837c70",class:this.alignmentClass()},l("div",{key:"42aaa39f4b5ff6e854d8752fd8b7f51967a61640",class:`s-placeholder-icon s-placeholder-icon-${this.iconSize}`,innerHTML:this.icon}),l("div",{key:"89b58694c6e8e52df2a6cfcf53f928e8e1be65cc",class:"s-placeholder-title"},l("slot",{key:"810a0cbc0338a430f48e0478d855baef78368d30",name:"title"},l("span",{key:"29f370d5460607afd3ad8971afb8387e3ab8ccd7"},salla.lang.get("common.elements.no_options")))),l("div",{key:"daabc9a39c770605c2b0a18a8e32c9b77cd28387",class:"s-placeholder-description"},l("slot",{key:"b318ca5417191c0e78eaab5e814dbc393679b416",name:"description"},l("span",{key:"1f616f82f63bbe79d7f88ae83544ce0ab97aa9fb"},salla.lang.get("common.errors.empty_results")))))}};a.style='/*!twlt*/.inline{display:inline}.contents{display:contents}.s-bullet-delivery-placeholder.s-placeholder-wrapper{margin-top:1rem !important;margin-bottom:1rem !important}.s-loyalty-confirmation-modal-content .s-placeholder-title{margin-bottom:0.75rem}.s-loyalty-confirmation-modal-content .s-placeholder-icon svg b{--tw-text-opacity:1;color:rgb(251 146 60 / var(--tw-text-opacity, 1))}.s-loyalty-confirmation-modal-content .s-placeholder-description{padding-left:1.25rem;padding-right:1.25rem}.s-placeholder-title{margin-bottom:0.25rem;font-size:1rem;line-height:1.5rem;--tw-text-opacity:1;color:rgb(17 24 39 / var(--tw-text-opacity, 1))}.s-placeholder-description{font-size:0.875rem;line-height:1.25rem;--tw-text-opacity:1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.s-placeholder-icon{margin-bottom:1rem;fill:#e5e7eb}.s-placeholder-align-left{text-align:left}.s-placeholder-align-center{text-align:center}.s-placeholder-align-right{text-align:right}.s-placeholder-align-right>.s-placeholder-icon{display:flex;align-items:center;justify-content:flex-end}.s-placeholder-align-right>.s-placeholder-icon:where([dir="rtl"],[dir="rtl"] *){justify-content:flex-start}.s-placeholder-align-center>.s-placeholder-icon{display:flex;align-items:center;justify-content:center}.s-placeholder-icon-xs>svg{height:1.5rem;width:1.5rem}.s-placeholder-icon-sm>svg{height:2.5rem;width:2.5rem}.s-placeholder-icon-md>svg{height:3.5rem;width:3.5rem}.s-placeholder-icon-lg>svg{height:4rem;width:4rem}.s-placeholder-icon-xl>svg{height:5rem;width:5rem}.s-placeholder-icon-xxl>svg{height:6rem;width:6rem}.s-placeholder-icon-xxxl>svg{height:7rem;width:7rem}.s-placeholder-icon-xs>i{font-size:20px}.s-placeholder-icon-sm>i{font-size:35px}.s-placeholder-icon-md>i{font-size:45px}.s-placeholder-icon-lg>i{font-size:58px}.s-placeholder-icon-xl>i{font-size:75px}.s-placeholder-icon-xxl>i{font-size:85px}.s-placeholder-icon-xxxl>i{font-size:100px}.s-placeholder-wrapper{margin-top:3rem;margin-bottom:3rem;display:block}.s-scopes-wrap .s-placeholder-wrapper{display:flex;height:12rem;flex-direction:column;align-items:center;justify-content:center}';export{a as salla_placeholder}