@salla.sa/twilight-components 2.14.548 → 2.14.550

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 (340) hide show
  1. package/dist/cjs/{Helper-6RI07gZo.js → Helper-D1YsoJud.js} +46 -0
  2. package/dist/cjs/{filepond-CGA4aTUA.js → filepond-B-8syvXC.js} +1 -1
  3. package/dist/cjs/{filepond-plugin-file-poster-DyVz7vP9.js → filepond-plugin-file-poster-DxfU_d7d.js} +1 -1
  4. package/dist/cjs/{filepond-plugin-file-validate-size-CgzYDBcU.js → filepond-plugin-file-validate-size-C0XIW0bl.js} +1 -1
  5. package/dist/cjs/{filepond-plugin-file-validate-type-Dx2CbMZ9.js → filepond-plugin-file-validate-type-BHyBHLOg.js} +1 -1
  6. package/dist/cjs/{filepond-plugin-image-edit-D3aTsFmD.js → filepond-plugin-image-edit-Dnni9gl-.js} +1 -1
  7. package/dist/cjs/{filepond-plugin-image-exif-orientation-BW3usWts.js → filepond-plugin-image-exif-orientation-C7pHXy9M.js} +1 -1
  8. package/dist/cjs/{filepond-plugin-image-preview-Bb7_UNPY.js → filepond-plugin-image-preview-CFttWV9E.js} +1 -1
  9. package/dist/cjs/{index-BssNhL-x.js → index-CHvvKGJc.js} +7 -3
  10. package/dist/cjs/{intlTelInput-B7QYiZ0d.js → intlTelInput--yv-lZaU.js} +1 -1
  11. package/dist/cjs/loader.cjs.js +2 -2
  12. package/dist/cjs/salla-accordion-body_2.cjs.entry.js +1 -1
  13. package/dist/cjs/salla-accordion_6.cjs.entry.js +2 -2
  14. package/dist/cjs/salla-add-product-button_5.cjs.entry.js +2 -2
  15. package/dist/cjs/salla-advertisement.cjs.entry.js +1 -1
  16. package/dist/cjs/salla-alert_2.cjs.entry.js +1 -1
  17. package/dist/cjs/salla-app-install-alert.cjs.entry.js +1 -1
  18. package/dist/cjs/salla-applied-filters.cjs.entry.js +175 -0
  19. package/dist/cjs/salla-apps-icons.cjs.entry.js +1 -1
  20. package/dist/cjs/salla-attachment-view_9.cjs.entry.js +11 -11
  21. package/dist/cjs/salla-badge.cjs.entry.js +1 -1
  22. package/dist/cjs/salla-basket-gap.cjs.entry.js +1 -1
  23. package/dist/cjs/salla-bullet-delivery_2.cjs.entry.js +1 -1
  24. package/dist/cjs/salla-cart-coupons.cjs.entry.js +1 -1
  25. package/dist/cjs/salla-cart-item-offers_2.cjs.entry.js +1 -1
  26. package/dist/cjs/salla-cart-summary-card.cjs.entry.js +1 -1
  27. package/dist/cjs/salla-cashback-banner.cjs.entry.js +1 -1
  28. package/dist/cjs/salla-comment-factors.cjs.entry.js +1 -1
  29. package/dist/cjs/salla-comment-form_9.cjs.entry.js +2 -2
  30. package/dist/cjs/salla-conditional-offer.cjs.entry.js +1 -1
  31. package/dist/cjs/salla-contacts.cjs.entry.js +1 -1
  32. package/dist/cjs/salla-cookies-bar.cjs.entry.js +1 -1
  33. package/dist/cjs/salla-count-down.cjs.entry.js +1 -1
  34. package/dist/cjs/salla-custom-fields.cjs.entry.js +1 -1
  35. package/dist/cjs/salla-delivery-promise.cjs.entry.js +1 -1
  36. package/dist/cjs/salla-edit-order-button.cjs.entry.js +1 -1
  37. package/dist/cjs/salla-filters-widget.cjs.entry.js +10 -11
  38. package/dist/cjs/salla-filters.cjs.entry.js +14 -79
  39. package/dist/cjs/salla-fulfillment-methods.cjs.entry.js +1 -1
  40. package/dist/cjs/salla-gifting.cjs.entry.js +1 -1
  41. package/dist/cjs/salla-hook.cjs.entry.js +1 -1
  42. package/dist/cjs/salla-infinite-scroll.cjs.entry.js +2 -2
  43. package/dist/cjs/salla-installment.cjs.entry.js +1 -1
  44. package/dist/cjs/salla-list-tile.cjs.entry.js +1 -1
  45. package/dist/cjs/salla-localization-modal.cjs.entry.js +1 -1
  46. package/dist/cjs/salla-login-modal.cjs.entry.js +1 -1
  47. package/dist/cjs/salla-loyalty-banner_10.cjs.entry.js +1 -1
  48. package/dist/cjs/salla-loyalty-exchange-product-card.cjs.entry.js +1 -1
  49. package/dist/cjs/salla-loyalty-points-banner.cjs.entry.js +1 -1
  50. package/dist/cjs/salla-loyalty-points-history.cjs.entry.js +1 -1
  51. package/dist/cjs/salla-loyalty-prize-item.cjs.entry.js +1 -1
  52. package/dist/cjs/salla-loyalty.cjs.entry.js +1 -1
  53. package/dist/cjs/salla-maintenance-alert.cjs.entry.js +1 -1
  54. package/dist/cjs/salla-map_2.cjs.entry.js +1 -1
  55. package/dist/cjs/salla-menu.cjs.entry.js +1 -1
  56. package/dist/cjs/salla-metadata.cjs.entry.js +1 -1
  57. package/dist/cjs/salla-multiple-bundle-product-cart_2.cjs.entry.js +1 -1
  58. package/dist/cjs/salla-multiple-bundle-product-options-modal_2.cjs.entry.js +1 -1
  59. package/dist/cjs/salla-multiple-bundle-product.cjs.entry.js +1 -1
  60. package/dist/cjs/salla-next-order-coupon.cjs.entry.js +1 -1
  61. package/dist/cjs/salla-notification-item_2.cjs.entry.js +2 -2
  62. package/dist/cjs/salla-offer-modal.cjs.entry.js +1 -1
  63. package/dist/cjs/salla-offer.cjs.entry.js +1 -1
  64. package/dist/cjs/salla-order-branch.cjs.entry.js +1 -1
  65. package/dist/cjs/salla-order-cancel.cjs.entry.js +1 -1
  66. package/dist/cjs/salla-order-details-multiple-bundle-product.cjs.entry.js +1 -1
  67. package/dist/cjs/salla-order-details-options.cjs.entry.js +1 -1
  68. package/dist/cjs/salla-order-details.cjs.entry.js +1 -1
  69. package/dist/cjs/salla-order-edit-item.cjs.entry.js +1 -1
  70. package/dist/cjs/salla-order-edit-product-card.cjs.entry.js +1 -1
  71. package/dist/cjs/salla-order-edit.cjs.entry.js +1 -1
  72. package/dist/cjs/salla-order-options-modal_2.cjs.entry.js +1 -1
  73. package/dist/cjs/salla-order-shipments.cjs.entry.js +1 -1
  74. package/dist/cjs/salla-order-summary.cjs.entry.js +1 -1
  75. package/dist/cjs/salla-order-totals-card.cjs.entry.js +1 -1
  76. package/dist/cjs/salla-orders.cjs.entry.js +2 -2
  77. package/dist/cjs/salla-payments.cjs.entry.js +1 -1
  78. package/dist/cjs/salla-placeholder.cjs.entry.js +1 -1
  79. package/dist/cjs/salla-price-range.cjs.entry.js +1 -1
  80. package/dist/cjs/salla-product-card-embed.cjs.entry.js +1 -1
  81. package/dist/cjs/salla-product-size-guide.cjs.entry.js +1 -1
  82. package/dist/cjs/salla-products-list.cjs.entry.js +2 -2
  83. package/dist/cjs/salla-products-slider.cjs.entry.js +2 -2
  84. package/dist/cjs/salla-quick-order.cjs.entry.js +1 -1
  85. package/dist/cjs/salla-rating-modal-v2.cjs.entry.js +2 -2
  86. package/dist/cjs/salla-rating-modal.cjs.entry.js +2 -2
  87. package/dist/cjs/salla-review-factors-tags.cjs.entry.js +1 -1
  88. package/dist/cjs/salla-review-order-item.cjs.entry.js +1 -1
  89. package/dist/cjs/salla-scopes.cjs.entry.js +1 -1
  90. package/dist/cjs/salla-search.cjs.entry.js +2 -2
  91. package/dist/cjs/salla-skeleton.cjs.entry.js +1 -1
  92. package/dist/cjs/salla-slider.cjs.entry.js +1 -1
  93. package/dist/cjs/salla-social-share.cjs.entry.js +1 -1
  94. package/dist/cjs/salla-social.cjs.entry.js +1 -1
  95. package/dist/cjs/salla-tab-content_3.cjs.entry.js +1 -1
  96. package/dist/cjs/salla-tiered-offer.cjs.entry.js +1 -1
  97. package/dist/cjs/salla-tooltip.cjs.entry.js +1 -1
  98. package/dist/cjs/salla-trust-badges.cjs.entry.js +1 -1
  99. package/dist/cjs/salla-user-menu.cjs.entry.js +1 -1
  100. package/dist/cjs/salla-user-profile.cjs.entry.js +1 -1
  101. package/dist/cjs/salla-user-settings.cjs.entry.js +1 -1
  102. package/dist/cjs/salla-verify.cjs.entry.js +1 -1
  103. package/dist/cjs/salla-wallet.cjs.entry.js +1 -1
  104. package/dist/cjs/salla-wishlist-actions.cjs.entry.js +1 -1
  105. package/dist/cjs/twilight.cjs.js +2 -2
  106. package/dist/cjs/{vanilla-picker-H1di5S1s.js → vanilla-picker-D-X0hQ7w.js} +1 -1
  107. package/dist/collection/Helpers/Helper.js +28 -0
  108. package/dist/collection/collection-manifest.json +1 -0
  109. package/dist/collection/components/salla-applied-filters/salla-applied-filters.css +115 -0
  110. package/dist/collection/components/salla-applied-filters/salla-applied-filters.js +185 -0
  111. package/dist/collection/components/salla-filters/salla-filters.css +0 -119
  112. package/dist/collection/components/salla-filters/salla-filters.js +27 -73
  113. package/dist/components/Helper.js +47 -1
  114. package/dist/components/index.js +3 -3
  115. package/dist/components/salla-applied-filters.d.ts +11 -0
  116. package/dist/components/salla-applied-filters.js +195 -0
  117. package/dist/components/salla-filters-widget2.js +2 -21
  118. package/dist/components/salla-filters.js +10 -76
  119. package/dist/esm/{Helper-CBmYxrzX.js → Helper-DsjZ6kte.js} +47 -1
  120. package/dist/esm/{filepond-plugin-file-poster-DrmkMK37.js → filepond-plugin-file-poster-bfSOezL4.js} +1 -1
  121. package/dist/esm/{filepond-plugin-file-validate-size-fRXLDtKY.js → filepond-plugin-file-validate-size-DagZiT3e.js} +1 -1
  122. package/dist/esm/{filepond-plugin-file-validate-type-9x4CtZKy.js → filepond-plugin-file-validate-type-Cf4JwDq-.js} +1 -1
  123. package/dist/esm/{filepond-plugin-image-edit-BTjvSjn9.js → filepond-plugin-image-edit-DWZ8nbdr.js} +1 -1
  124. package/dist/esm/{filepond-plugin-image-exif-orientation-CnSOx2Lm.js → filepond-plugin-image-exif-orientation-NHp2unXf.js} +1 -1
  125. package/dist/esm/{filepond-plugin-image-preview-Cy0Nd8Xr.js → filepond-plugin-image-preview-BSi_AIFs.js} +1 -1
  126. package/dist/esm/{filepond-CXmbiROU.js → filepond-rGVsy4ep.js} +1 -1
  127. package/dist/esm/{index-B64o_70M.js → index-Bf2Z6A1M.js} +7 -3
  128. package/dist/esm/{intlTelInput-FF2eKbuC.js → intlTelInput-DLtsxnoY.js} +1 -1
  129. package/dist/esm/loader.js +3 -3
  130. package/dist/esm/salla-accordion-body_2.entry.js +1 -1
  131. package/dist/esm/salla-accordion_6.entry.js +2 -2
  132. package/dist/esm/salla-add-product-button_5.entry.js +2 -2
  133. package/dist/esm/salla-advertisement.entry.js +1 -1
  134. package/dist/esm/salla-alert_2.entry.js +1 -1
  135. package/dist/esm/salla-app-install-alert.entry.js +1 -1
  136. package/dist/esm/salla-applied-filters.entry.js +173 -0
  137. package/dist/esm/salla-apps-icons.entry.js +1 -1
  138. package/dist/esm/salla-attachment-view_9.entry.js +11 -11
  139. package/dist/esm/salla-badge.entry.js +1 -1
  140. package/dist/esm/salla-basket-gap.entry.js +1 -1
  141. package/dist/esm/salla-bullet-delivery_2.entry.js +1 -1
  142. package/dist/esm/salla-cart-coupons.entry.js +1 -1
  143. package/dist/esm/salla-cart-item-offers_2.entry.js +1 -1
  144. package/dist/esm/salla-cart-summary-card.entry.js +1 -1
  145. package/dist/esm/salla-cashback-banner.entry.js +1 -1
  146. package/dist/esm/salla-comment-factors.entry.js +1 -1
  147. package/dist/esm/salla-comment-form_9.entry.js +2 -2
  148. package/dist/esm/salla-conditional-offer.entry.js +1 -1
  149. package/dist/esm/salla-contacts.entry.js +1 -1
  150. package/dist/esm/salla-cookies-bar.entry.js +1 -1
  151. package/dist/esm/salla-count-down.entry.js +1 -1
  152. package/dist/esm/salla-custom-fields.entry.js +1 -1
  153. package/dist/esm/salla-delivery-promise.entry.js +1 -1
  154. package/dist/esm/salla-edit-order-button.entry.js +1 -1
  155. package/dist/esm/salla-filters-widget.entry.js +2 -3
  156. package/dist/esm/salla-filters.entry.js +8 -73
  157. package/dist/esm/salla-fulfillment-methods.entry.js +1 -1
  158. package/dist/esm/salla-gifting.entry.js +1 -1
  159. package/dist/esm/salla-hook.entry.js +1 -1
  160. package/dist/esm/salla-infinite-scroll.entry.js +2 -2
  161. package/dist/esm/salla-installment.entry.js +1 -1
  162. package/dist/esm/salla-list-tile.entry.js +1 -1
  163. package/dist/esm/salla-localization-modal.entry.js +1 -1
  164. package/dist/esm/salla-login-modal.entry.js +1 -1
  165. package/dist/esm/salla-loyalty-banner_10.entry.js +1 -1
  166. package/dist/esm/salla-loyalty-exchange-product-card.entry.js +1 -1
  167. package/dist/esm/salla-loyalty-points-banner.entry.js +1 -1
  168. package/dist/esm/salla-loyalty-points-history.entry.js +1 -1
  169. package/dist/esm/salla-loyalty-prize-item.entry.js +1 -1
  170. package/dist/esm/salla-loyalty.entry.js +1 -1
  171. package/dist/esm/salla-maintenance-alert.entry.js +1 -1
  172. package/dist/esm/salla-map_2.entry.js +1 -1
  173. package/dist/esm/salla-menu.entry.js +1 -1
  174. package/dist/esm/salla-metadata.entry.js +1 -1
  175. package/dist/esm/salla-multiple-bundle-product-cart_2.entry.js +1 -1
  176. package/dist/esm/salla-multiple-bundle-product-options-modal_2.entry.js +1 -1
  177. package/dist/esm/salla-multiple-bundle-product.entry.js +1 -1
  178. package/dist/esm/salla-next-order-coupon.entry.js +1 -1
  179. package/dist/esm/salla-notification-item_2.entry.js +2 -2
  180. package/dist/esm/salla-offer-modal.entry.js +1 -1
  181. package/dist/esm/salla-offer.entry.js +1 -1
  182. package/dist/esm/salla-order-branch.entry.js +1 -1
  183. package/dist/esm/salla-order-cancel.entry.js +1 -1
  184. package/dist/esm/salla-order-details-multiple-bundle-product.entry.js +1 -1
  185. package/dist/esm/salla-order-details-options.entry.js +1 -1
  186. package/dist/esm/salla-order-details.entry.js +1 -1
  187. package/dist/esm/salla-order-edit-item.entry.js +1 -1
  188. package/dist/esm/salla-order-edit-product-card.entry.js +1 -1
  189. package/dist/esm/salla-order-edit.entry.js +1 -1
  190. package/dist/esm/salla-order-options-modal_2.entry.js +1 -1
  191. package/dist/esm/salla-order-shipments.entry.js +1 -1
  192. package/dist/esm/salla-order-summary.entry.js +1 -1
  193. package/dist/esm/salla-order-totals-card.entry.js +1 -1
  194. package/dist/esm/salla-orders.entry.js +2 -2
  195. package/dist/esm/salla-payments.entry.js +1 -1
  196. package/dist/esm/salla-placeholder.entry.js +1 -1
  197. package/dist/esm/salla-price-range.entry.js +1 -1
  198. package/dist/esm/salla-product-card-embed.entry.js +1 -1
  199. package/dist/esm/salla-product-size-guide.entry.js +1 -1
  200. package/dist/esm/salla-products-list.entry.js +2 -2
  201. package/dist/esm/salla-products-slider.entry.js +2 -2
  202. package/dist/esm/salla-quick-order.entry.js +1 -1
  203. package/dist/esm/salla-rating-modal-v2.entry.js +2 -2
  204. package/dist/esm/salla-rating-modal.entry.js +2 -2
  205. package/dist/esm/salla-review-factors-tags.entry.js +1 -1
  206. package/dist/esm/salla-review-order-item.entry.js +1 -1
  207. package/dist/esm/salla-scopes.entry.js +1 -1
  208. package/dist/esm/salla-search.entry.js +2 -2
  209. package/dist/esm/salla-skeleton.entry.js +1 -1
  210. package/dist/esm/salla-slider.entry.js +1 -1
  211. package/dist/esm/salla-social-share.entry.js +1 -1
  212. package/dist/esm/salla-social.entry.js +1 -1
  213. package/dist/esm/salla-tab-content_3.entry.js +1 -1
  214. package/dist/esm/salla-tiered-offer.entry.js +1 -1
  215. package/dist/esm/salla-tooltip.entry.js +1 -1
  216. package/dist/esm/salla-trust-badges.entry.js +1 -1
  217. package/dist/esm/salla-user-menu.entry.js +1 -1
  218. package/dist/esm/salla-user-profile.entry.js +1 -1
  219. package/dist/esm/salla-user-settings.entry.js +1 -1
  220. package/dist/esm/salla-verify.entry.js +1 -1
  221. package/dist/esm/salla-wallet.entry.js +1 -1
  222. package/dist/esm/salla-wishlist-actions.entry.js +1 -1
  223. package/dist/esm/twilight.js +3 -3
  224. package/dist/esm/{vanilla-picker-DMNociUd.js → vanilla-picker-AjTapsL5.js} +1 -1
  225. package/dist/twilight/{p-fa0467a7.entry.js → p-018456c8.entry.js} +1 -1
  226. package/dist/twilight/{p-441ee14a.entry.js → p-03db1fe6.entry.js} +1 -1
  227. package/dist/twilight/p-0739e769.entry.js +4 -0
  228. package/dist/twilight/{p-5273dbb2.entry.js → p-09c1d9c8.entry.js} +1 -1
  229. package/dist/twilight/{p-b8cd26a7.entry.js → p-0c4c4419.entry.js} +1 -1
  230. package/dist/twilight/{p-3b7cbf05.entry.js → p-0ccba871.entry.js} +1 -1
  231. package/dist/twilight/{p-cacf3c75.entry.js → p-0d199866.entry.js} +1 -1
  232. package/dist/twilight/{p-5f9b8ada.entry.js → p-0da8a64f.entry.js} +1 -1
  233. package/dist/twilight/{p-2f64c3b3.entry.js → p-0dc61077.entry.js} +1 -1
  234. package/dist/twilight/{p-0dfd760b.entry.js → p-0e12c9ca.entry.js} +1 -1
  235. package/dist/twilight/{p-522fb030.entry.js → p-0fb44a3c.entry.js} +1 -1
  236. package/dist/twilight/{p-1edbb249.entry.js → p-12d74e96.entry.js} +1 -1
  237. package/dist/twilight/{p-55cbacd7.entry.js → p-13fb9b74.entry.js} +1 -1
  238. package/dist/twilight/{p-440687a4.entry.js → p-1653256e.entry.js} +1 -1
  239. package/dist/twilight/{p-f12f8db3.entry.js → p-17c30aa6.entry.js} +1 -1
  240. package/dist/twilight/{p-f99550d8.entry.js → p-1c662f1d.entry.js} +1 -1
  241. package/dist/twilight/{p-233b9115.entry.js → p-2607ac8e.entry.js} +1 -1
  242. package/dist/twilight/{p-63a2ee05.entry.js → p-27396f6f.entry.js} +1 -1
  243. package/dist/twilight/{p-c9b1ad01.entry.js → p-277f3a46.entry.js} +1 -1
  244. package/dist/twilight/{p-6cd863b9.entry.js → p-2c212d54.entry.js} +1 -1
  245. package/dist/twilight/p-2f2771de.entry.js +4 -0
  246. package/dist/twilight/{p-309f771b.entry.js → p-33842645.entry.js} +1 -1
  247. package/dist/twilight/{p-be916b5f.entry.js → p-34240222.entry.js} +1 -1
  248. package/dist/twilight/{p-5c9e4502.entry.js → p-3615a99b.entry.js} +1 -1
  249. package/dist/twilight/{p-647832d9.entry.js → p-3627d945.entry.js} +1 -1
  250. package/dist/twilight/{p-b4fda5f4.entry.js → p-38b4dfa9.entry.js} +1 -1
  251. package/dist/twilight/{p-5ab11313.entry.js → p-3a4160c2.entry.js} +1 -1
  252. package/dist/twilight/{p-74a1a32f.entry.js → p-434f3557.entry.js} +1 -1
  253. package/dist/twilight/{p-63acbca7.entry.js → p-44ee3af8.entry.js} +1 -1
  254. package/dist/twilight/{p-6451e759.entry.js → p-4d3e018b.entry.js} +1 -1
  255. package/dist/twilight/{p-569ad58b.entry.js → p-4df5f9a0.entry.js} +1 -1
  256. package/dist/twilight/{p-b17c6f84.entry.js → p-4f1102f8.entry.js} +1 -1
  257. package/dist/twilight/{p-52607d64.entry.js → p-5256180e.entry.js} +1 -1
  258. package/dist/twilight/{p-9dbf3ff4.entry.js → p-5383a324.entry.js} +1 -1
  259. package/dist/twilight/{p-c26f1183.entry.js → p-57b7cd9f.entry.js} +1 -1
  260. package/dist/twilight/{p-77fa0f9f.entry.js → p-581eeaf8.entry.js} +1 -1
  261. package/dist/twilight/{p-8e293878.entry.js → p-5a4f7313.entry.js} +1 -1
  262. package/dist/twilight/{p-b16264a3.entry.js → p-649ced48.entry.js} +1 -1
  263. package/dist/twilight/{p-897b8824.entry.js → p-69d75b45.entry.js} +1 -1
  264. package/dist/twilight/{p-e0f3e985.entry.js → p-6e78cc02.entry.js} +1 -1
  265. package/dist/twilight/{p-c8dae54b.entry.js → p-785cee9b.entry.js} +1 -1
  266. package/dist/twilight/{p-e354292f.entry.js → p-7b6fa77f.entry.js} +1 -1
  267. package/dist/twilight/{p-2ddabee9.entry.js → p-7e101885.entry.js} +1 -1
  268. package/dist/twilight/{p-971b8ff5.entry.js → p-7e9d98c3.entry.js} +1 -1
  269. package/dist/twilight/{p-13978ff2.entry.js → p-8838ad5c.entry.js} +1 -1
  270. package/dist/twilight/{p-db4dc7cc.entry.js → p-8cf65dbf.entry.js} +1 -1
  271. package/dist/twilight/{p-40d4ccbb.entry.js → p-8e0bdbbc.entry.js} +1 -1
  272. package/dist/twilight/{p-991fa4ad.entry.js → p-95a3b9b9.entry.js} +1 -1
  273. package/dist/twilight/{p-c5d1b2e4.entry.js → p-97136699.entry.js} +1 -1
  274. package/dist/twilight/{p-1485dedd.entry.js → p-9ae3a15c.entry.js} +1 -1
  275. package/dist/twilight/{p-b4f2f280.entry.js → p-9cbc4733.entry.js} +1 -1
  276. package/dist/twilight/{p-8e631629.entry.js → p-9e702ebb.entry.js} +1 -1
  277. package/dist/twilight/p-9ee1e01c.entry.js +4 -0
  278. package/dist/twilight/{p-66ece3d6.entry.js → p-9f1d1b76.entry.js} +1 -1
  279. package/dist/twilight/{p-b4d47e7c.entry.js → p-9fdb6380.entry.js} +1 -1
  280. package/dist/twilight/{p-UxfFm_QX.js → p-B-Q5WD6p.js} +1 -1
  281. package/dist/twilight/{p-DBnECOny.js → p-B59qdBmY.js} +2 -2
  282. package/dist/twilight/{p-GwasjFLA.js → p-BdsgfewR.js} +1 -1
  283. package/dist/twilight/{p-B64o_70M.js → p-Bf2Z6A1M.js} +1 -1
  284. package/dist/twilight/{p-Bh11vKua.js → p-BlDax_46.js} +1 -1
  285. package/dist/twilight/{p-0MyCcOKI.js → p-CG1Rwy3q.js} +1 -1
  286. package/dist/twilight/{p-BK166pHQ.js → p-CMQ7Gxqu.js} +1 -1
  287. package/dist/twilight/{p-DWqu98fW.js → p-CPqpCDCi.js} +1 -1
  288. package/dist/twilight/p-D6rFREuQ.js +4 -0
  289. package/dist/twilight/{p-DrJZdc5M.js → p-DfIHi_xi.js} +1 -1
  290. package/dist/twilight/{p-87227eb2.entry.js → p-a3eb15e4.entry.js} +1 -1
  291. package/dist/twilight/{p-ba32a9d2.entry.js → p-a818352a.entry.js} +1 -1
  292. package/dist/twilight/{p-63cebaef.entry.js → p-a8d6804c.entry.js} +1 -1
  293. package/dist/twilight/{p-b0a87a8d.entry.js → p-aa71f393.entry.js} +1 -1
  294. package/dist/twilight/{p-7c2a0a8b.entry.js → p-b017b72e.entry.js} +1 -1
  295. package/dist/twilight/{p-9a617c41.entry.js → p-b19102f6.entry.js} +1 -1
  296. package/dist/twilight/{p-5f860460.entry.js → p-b2380c6b.entry.js} +1 -1
  297. package/dist/twilight/{p-9ae25175.entry.js → p-b452c8a0.entry.js} +1 -1
  298. package/dist/twilight/{p-7eca6506.entry.js → p-b603a180.entry.js} +1 -1
  299. package/dist/twilight/{p-ace041b9.entry.js → p-b7b4231f.entry.js} +1 -1
  300. package/dist/twilight/{p-0c7bdda5.entry.js → p-bc595ee3.entry.js} +1 -1
  301. package/dist/twilight/{p-56e553e4.entry.js → p-bd3fef37.entry.js} +1 -1
  302. package/dist/twilight/{p-e4db462b.entry.js → p-bded58cb.entry.js} +1 -1
  303. package/dist/twilight/{p-26c750c8.entry.js → p-be95b40b.entry.js} +1 -1
  304. package/dist/twilight/{p-1ad71324.entry.js → p-c0c561b9.entry.js} +1 -1
  305. package/dist/twilight/{p-1628c63c.entry.js → p-c24f6325.entry.js} +1 -1
  306. package/dist/twilight/{p-d0847af9.entry.js → p-c31b966f.entry.js} +1 -1
  307. package/dist/twilight/{p-3eb853f9.entry.js → p-c56725b9.entry.js} +1 -1
  308. package/dist/twilight/{p-1ce848ab.entry.js → p-c818e0eb.entry.js} +1 -1
  309. package/dist/twilight/{p-840dd411.entry.js → p-cd51e722.entry.js} +1 -1
  310. package/dist/twilight/{p-923a35da.entry.js → p-cf21323d.entry.js} +1 -1
  311. package/dist/twilight/{p-660a552a.entry.js → p-cfac0aa1.entry.js} +1 -1
  312. package/dist/twilight/{p-a5199e7d.entry.js → p-cfbf287b.entry.js} +1 -1
  313. package/dist/twilight/{p-49c7dc56.entry.js → p-d2556680.entry.js} +1 -1
  314. package/dist/twilight/{p-04cc5898.entry.js → p-d2c204f4.entry.js} +1 -1
  315. package/dist/twilight/{p-177e9071.entry.js → p-d63ca8bb.entry.js} +1 -1
  316. package/dist/twilight/{p-37b73a97.entry.js → p-d65a6462.entry.js} +1 -1
  317. package/dist/twilight/{p-b0500232.entry.js → p-dfaf0617.entry.js} +1 -1
  318. package/dist/twilight/{p-cb02e6db.entry.js → p-e284728d.entry.js} +1 -1
  319. package/dist/twilight/{p-7ce5c2cd.entry.js → p-e54cc4f8.entry.js} +1 -1
  320. package/dist/twilight/{p-19b03612.entry.js → p-e8a1c501.entry.js} +1 -1
  321. package/dist/twilight/{p-e826d3aa.entry.js → p-e8b220e1.entry.js} +1 -1
  322. package/dist/twilight/{p-a867beee.entry.js → p-ebb73bcc.entry.js} +1 -1
  323. package/dist/twilight/{p-003648b5.entry.js → p-efa79191.entry.js} +1 -1
  324. package/dist/twilight/{p-d7e4f0f8.entry.js → p-f1322c8e.entry.js} +1 -1
  325. package/dist/twilight/{p-a0e8ca67.entry.js → p-f2e5f1fd.entry.js} +1 -1
  326. package/dist/twilight/{p-602e632c.entry.js → p-f586c239.entry.js} +1 -1
  327. package/dist/twilight/{p-74c7cc02.entry.js → p-fc587040.entry.js} +1 -1
  328. package/dist/twilight/{p-BcGXp0zm.js → p-uOF6Cufg.js} +1 -1
  329. package/dist/twilight/twilight.esm.js +1 -1
  330. package/dist/types/Helpers/Helper.d.ts +10 -0
  331. package/dist/types/components/salla-applied-filters/salla-applied-filters.d.ts +37 -0
  332. package/dist/types/components/salla-filters/salla-filters.d.ts +3 -11
  333. package/dist/types/components.d.ts +17 -0
  334. package/package.json +5 -5
  335. package/dist/cjs/interfaces-DZDQwN6-.js +0 -23
  336. package/dist/esm/interfaces-DL4h2bc3.js +0 -23
  337. package/dist/twilight/p-3f460184.entry.js +0 -4
  338. package/dist/twilight/p-DL4h2bc3.js +0 -4
  339. package/dist/twilight/p-DOBDDG4K.js +0 -4
  340. package/dist/twilight/p-a7fccb9c.entry.js +0 -4
@@ -0,0 +1,4 @@
1
+ /*!
2
+ * Crafted with ❤ by Salla
3
+ */
4
+ import{a as e}from"./p-CgtvEd63.js";var t,a;!function(e){e.VALUES="values",e.VARIANTS="variants",e.MINIMUM="minimum",e.RANGE="range"}(t||(t={})),function(e){e.VALUES="values",e.VARIANT="variants",e.RANGE="range"}(a||(a={})),salla.event.setMaxListeners(100);var r=new class{setIncludes(e){return this.includes=e,this}toggleElementClassIf(e,t,a,r){t=Array.isArray(t)?t:t.split(" "),a=Array.isArray(a)?a:a.split(" ");let s=r(e);return e?.classList.remove(...s?a:t),e?.classList.add(...s?t:a),this}toggleClassIf(e,t,a,r){return document.querySelectorAll(e).forEach((e=>this.toggleElementClassIf(e,t,a,r))),this}isValidEmail(e){return/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(String(e).toLowerCase())}filterEmojies(e){return e.replace(/(?:[\u2700-\u27bf]|(?:\ud83c[\udde6-\uddff]){2}|[\ud800-\udbff][\udc00-\udfff]|[\u0023-\u0039]\ufe0f?\u20e3|\u3299|\u3297|\u303d|\u3030|\u24c2|\ud83c[\udd70-\udd71]|\ud83c[\udd7e-\udd7f]|\ud83c\udd8e|\ud83c[\udd91-\udd9a]|\ud83c[\udde6-\uddff]|\ud83c[\ude01-\ude02]|\ud83c\ude1a|\ud83c\ude2f|\ud83c[\ude32-\ude3a]|\ud83c[\ude50-\ude51]|\u203c|\u2049|[\u25aa-\u25ab]|\u25b6|\u25c0|[\u25fb-\u25fe]|\u00a9|\u00ae|\u2122|\u2139|\ud83c\udc04|[\u2600-\u26FF]|\u2b05|\u2b06|\u2b07|\u2b1b|\u2b1c|\u2b50|\u2b55|\u231a|\u231b|\u2328|\u23cf|[\u23e9-\u23f3]|[\u23f8-\u23fa]|\ud83c\udccf|\u2934|\u2935|[\u2190-\u21ff])/g,"")}debounce(e,...t){return this.debounce_||(this.debounce_=salla.helpers.debounce(((e,...t)=>e(...t)),500)),this.debounce_(e,...t)}getProductsSource(e){return{"brands.single":"brands","product.index":"categories","product.index.latest":"latest","product.index.offers":"offers","product.index.search":"search","customer.wishlist":"wishlist","landing-page":"landing-page","product.index.tag":"tags","product.index.sales":"sales","components.most_sales_products":"sales"}[e||salla.config.get("page.slug")]||e||"latest"}getApiSource(e){return{recently:"selected"}[e]||e}getPageTitleForSource(e){return(e={brands:"common.titles.brands",latest:"blocks.home.latest_products",offers:"common.titles.discounts",reorder:"common.titles.products",sales:"common.titles.most_sales"}[e])?salla.lang.get(e):""}getProductsSourceValue(e,t){const a=this.getProductsSource(e);let r=null;if(t)try{r="string"==typeof t?JSON.parse(t):t}catch(e){console.error("Failed to parse JSON string in sourceValue:",e)}if(!["search","json","offers","latest","sales","related"].includes(a)){if(Array.isArray(r)&&r.length)return r;if(Array.isArray(r)&&!r.length)return"";if("number"==typeof r)return[r];if(!t&&["categories","tags","brands"].includes(e))return[salla.config.get("page.id")]}return r||t?r||t:"search"===a?new URLSearchParams(window.location.search).get("q")||"":salla.config.get("page.id")}extractFiltersFromUrl(e){let t={};return e.forEach(((e,a)=>{const r=a.match(/^filters\[(.*?)\](\[(.*?)\])?$/u);if(r){const a=r[1],s=r[3];""===s||/^\d+$/.test(s)?(t[a]=Array.isArray(t[a])?t[a]:[],t[a].push(e)):s?(t[a]=t[a]||{},t[a][s]=e):t[a]=e}else{const r=a.match(/^(.*?)$/u);r&&(t[r[1]]=e)}})),t}resolveFilterLabels(e){return e.map((e=>{const a={...e};if(a.label={category_id:salla.lang.get("common.titles.categories"),brand_id:salla.lang.get("common.titles.brands"),rating:salla.lang.get("pages.categories.filter_rating"),price:salla.lang.get("pages.categories.filter_price")}[a.key]||a.label,"rating"==a.key){a.type=t.VALUES;const{max:r,min:s}=e.values;a.values=[5,4,3,2,1].filter((e=>e>=s||e<=r))}return a}))}async injectExtraFieldsToResponse(e){if(!e||!this.includes)return e;const t=e.data.map((e=>e.id));try{const{data:a}=await this.fetchImagesAndOptions(t);if(this.injectOptionsAndImages(e.data,a),!this.includes.includes("metadata"))return e;const r=await salla.api.metadata.fetchValues("product",t);return e.data.forEach((e=>{e.metadata=r.data.find((t=>parseInt(t.entity_id)===parseInt(e.id)))})),e}catch(e){throw console.error("Error in injectExtraFieldsToResponse:",e),e}}fetchImagesAndOptions(e){return this.productsIncludes().length?salla.api.product.fetchOptions(e,{with:this.productsIncludes()}):Promise.resolve({data:[]})}injectOptionsAndImages(e,t){return t.length?e.map((e=>(this.includes.filter((e=>"metadata"!==e)).forEach((a=>{const r=t.find((t=>parseInt(t.id)===parseInt(e.id)));e[a]=r?r[a]:null})),e))):null}productsIncludes(){return this.includes?.filter((e=>"metadata"!=e))}saveSource(e,t){if(t)try{sessionStorage.setItem(e,t)}catch(e){salla.logger.warn("Error saving source to session storage")}}saveProductSource(e){this.saveSource("s-viewed-source",e)}saveProductPosition(e){if(null!=e&&""!==e)try{sessionStorage.setItem("s-viewed-position",String(e))}catch(e){salla.logger.warn("Error saving position to session storage")}}saveAddToCartSource(e){this.saveSource("s-add-to-cart-source",e)}parseJson(e){if("string"!=typeof e)return e;try{return JSON.parse(e)}catch(e){salla.logger.error("Failed to parse includes as JSON:",e)}return null}getProductSchemaMarkupScript(e){const t=document.createElement("script");return t.type="application/ld+json",t.text=JSON.stringify({"@context":"http://schema.org","@type":"Product",name:e?.name,image:e?.image?.url||e?.thumbnail,description:e?.description,brand:{"@type":"Brand",logo:e?.brand?.logo},offers:{"@type":"Offer",price:e?.price}}),t}createProductSchema(e,t){let a={productID:`${e.id}`,"@type":"Product",name:e.name,url:e.url,image:e.image.url||e.image,description:e.description||e.subtitle||e.name,...e.sku&&e.sku.length>0&&{sku:e.sku},offers:{"@type":"Offer",url:e.url,priceCurrency:e.currency,price:e.price,itemCondition:"NewCondition",availability:e.is_available?"InStock":"OutOfStock",priceValidUntil:e.discount_ends||new Date((new Date).setDate((new Date).getDate()+7)).toISOString().split("T")[0],priceSpecification:{"@type":"PriceSpecification",price:e.regular_price,priceCurrency:e.currency,valueAddedTaxIncluded:e.is_taxable},seller:{"@type":"Organization",name:salla.config.get("store.name")},shippingDetails:{"@type":"OfferShippingDetails",shippingRate:{"@type":"MonetaryAmount",value:"0",currency:e.currency||"SAR"},deliveryTime:{"@type":"ShippingDeliveryTime",businessDays:{"@type":"OpeningHoursSpecification",dayOfWeek:["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"]},cutoffTime:"14:00"}},hasMerchantReturnPolicy:{"@type":"MerchantReturnPolicy",returnPolicyCategory:"https://schema.org/MerchantReturnFiniteReturnWindow",merchantReturnDays:30,returnMethod:"https://schema.org/ReturnByMail",returnFees:"https://schema.org/FreeReturn"}}};return e.rating?.stars&&(a.aggregateRating={"@type":"AggregateRating",ratingValue:e.rating.stars,reviewCount:e.rating.count}),{"@type":"ListItem",position:t,item:a}}generateProductSchema(e){const t="salla-product-schema-script";if(document.getElementById(t))return void salla.logger.warn(`already added schema-script with id (${t})!`);const a=document.createElement("script");a.type="application/ld+json",a.id=t;const r={"@context":"https://schema.org","@type":"ItemList",name:salla.config.get("page.title"),itemListElement:e.map(((e,t)=>this.createProductSchema(e,t+1)))};a.textContent=JSON.stringify(r),document.head.appendChild(a)}formatDateFromString(e,t,a="en"){const r={en:"Invalid Date",ar:"تاريخ غير صالح"};if(!e||"string"!=typeof e||""===e.trim())return r[a];let s;if(/^\d+$/.test(e)){const t=parseInt(e);s=new Date(t>1e12?t:1e3*t)}else s=new Date(e);return isNaN(s.getTime())?r[a]:`${{en:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],ar:["الأحد","الاثنين","الثلاثاء","الأربعاء","الخميس","الجمعة","السبت"]}[a][s.getDay()]} ${t(s.getDate(),"en"===a)} ${{en:["January","February","March","April","May","June","July","August","September","October","November","December"],ar:["يناير","فبراير","مارس","أبريل","مايو","يونيو","يوليو","أغسطس","سبتمبر","أكتوبر","نوفمبر","ديسمبر"]}[a][s.getMonth()]} ${t(s.getFullYear(),"en"===a)}`}copyToClipboard(e){var t=e.target.innerText;navigator.clipboard.writeText(t).then((()=>{console.log("Text copied to clipboard: "+t)})).catch((e=>{console.error("Unable to copy text to clipboard",e)}))}animateItems(t){t&&e({targets:t,opacity:[0,1],duration:1200,translateY:[20,0],delay:function(e,t){return 100*t},easing:"easeOutExpo",complete:function(){t.forEach((e=>{e.classList.add("animated")}))}})}createReviewObject(e){return{"@type":"Review",author:{"@type":"Person",name:e.name},reviewBody:e.content,reviewRating:{"@type":"Rating",bestRating:"5",ratingValue:e.stars,worstRating:"1"}}}generateReviewSchema(e){const t=document.createElement("script");t.type="application/ld+json";const a={"@context":"http://schema.org/","@type":"Store",name:salla.config.get("store.name"),url:salla.config.get("store.url"),address:"الرياض",review:e.map((e=>this.createReviewObject(e))),aggregateRating:{"@type":"AggregateRating",ratingValue:e.reduce(((e,t)=>e+t.stars),0)/e.length,reviewCount:e.length}};t.textContent=JSON.stringify(a),document.head.appendChild(t)}availabilityChannels(){let e=salla.config.get("store.settings.product.availability_notify");if(!e)return"";let t=[];return e.email&&t.push("email"),(e.sms||e.mobile||e.whatsapp)&&t.push("sms"),t.join(",")}syncWishlistIcons(e,t){e?.querySelectorAll(t).forEach((e=>{const t=e.product?.id,a="number"==typeof t?t:Number(t);if(Number.isNaN(a))return;const r=salla.wishlist.api.has(a);e.querySelectorAll(".s-product-card-wishlist-btn, .btn--wishlist").forEach((e=>{e.classList.toggle("s-product-card-wishlist-added",r),e.classList.toggle("wishlist-added",r)}))}))}};export{t as F,r as H}
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{d as e}from"./p-B64o_70M.js";function t(e,t){return t.forEach((function(t){t&&"string"!=typeof t&&!Array.isArray(t)&&Object.keys(t).forEach((function(n){if("default"!==n&&!(n in e)){var i=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,i.get?i:{enumerable:!0,get:function(){return t[n]}})}}))})),Object.freeze(e)}var n,i,E={exports:{}},r=n?E.exports:(n=1,E.exports=(i=function(e){var t=e.addFilter,n=e.utils,i=n.Type,E=n.isString,r=n.replaceInString,T=n.guesstimateMimeType,o=n.getExtensionFromFilename,u=n.getFilenameFromURL,_=function(e,t){return e.some((function(e){return/\*$/.test(e)?(n=e,(/^[^/]+/.exec(t)||[]).pop()===n.slice(0,-2)):e===t;var n}))},a=function(e,t,n){if(0===t.length)return!0;var i=function(e){var t="";if(E(e)){var n=u(e),i=o(n);i&&(t=T(i))}else t=e.type;return t}(e);return n?new Promise((function(E,r){n(e,i).then((function(e){_(t,e)?E():r()})).catch(r)})):_(t,i)};return t("SET_ATTRIBUTE_TO_OPTION_MAP",(function(e){return Object.assign(e,{accept:"acceptedFileTypes"})})),t("ALLOW_HOPPER_ITEM",(function(e,t){var n=t.query;return!n("GET_ALLOW_FILE_TYPE_VALIDATION")||a(e,n("GET_ACCEPTED_FILE_TYPES"))})),t("LOAD_FILE",(function(e,t){var n=t.query;return new Promise((function(t,i){if(n("GET_ALLOW_FILE_TYPE_VALIDATION")){var E=n("GET_ACCEPTED_FILE_TYPES"),T=n("GET_FILE_VALIDATE_TYPE_DETECT_TYPE"),o=a(e,E,T),u=function(){var e,t=E.map((e=n("GET_FILE_VALIDATE_TYPE_LABEL_EXPECTED_TYPES_MAP"),function(t){return null!==e[t]&&(e[t]||t)})).filter((function(e){return!1!==e})),T=t.filter((function(e,n){return t.indexOf(e)===n}));i({status:{main:n("GET_LABEL_FILE_TYPE_NOT_ALLOWED"),sub:r(n("GET_FILE_VALIDATE_TYPE_LABEL_EXPECTED_TYPES"),{allTypes:T.join(", "),allButLastType:T.slice(0,-1).join(", "),lastType:T[T.length-1]})}})};if("boolean"==typeof o)return o?t(e):u();o.then((function(){t(e)})).catch(u)}else t(e)}))})),{options:{allowFileTypeValidation:[!0,i.BOOLEAN],acceptedFileTypes:[[],i.ARRAY],labelFileTypeNotAllowed:["File is of invalid type",i.STRING],fileValidateTypeLabelExpectedTypes:["Expects {allButLastType} or {lastType}",i.STRING],fileValidateTypeLabelExpectedTypesMap:[{},i.OBJECT],fileValidateTypeDetectType:[null,i.FUNCTION]}}},"undefined"!=typeof window&&void 0!==window.document&&document.dispatchEvent(new CustomEvent("FilePond:pluginloaded",{detail:i})),i)),T=t({__proto__:null,default:e(r)},[r]);
4
+ import{d as e}from"./p-Bf2Z6A1M.js";function t(e,t){return t.forEach((function(t){t&&"string"!=typeof t&&!Array.isArray(t)&&Object.keys(t).forEach((function(n){if("default"!==n&&!(n in e)){var i=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,i.get?i:{enumerable:!0,get:function(){return t[n]}})}}))})),Object.freeze(e)}var n,i,E={exports:{}},r=n?E.exports:(n=1,E.exports=(i=function(e){var t=e.addFilter,n=e.utils,i=n.Type,E=n.isString,r=n.replaceInString,T=n.guesstimateMimeType,u=n.getExtensionFromFilename,o=n.getFilenameFromURL,_=function(e,t){return e.some((function(e){return/\*$/.test(e)?(n=e,(/^[^/]+/.exec(t)||[]).pop()===n.slice(0,-2)):e===t;var n}))},a=function(e,t,n){if(0===t.length)return!0;var i=function(e){var t="";if(E(e)){var n=o(e),i=u(n);i&&(t=T(i))}else t=e.type;return t}(e);return n?new Promise((function(E,r){n(e,i).then((function(e){_(t,e)?E():r()})).catch(r)})):_(t,i)};return t("SET_ATTRIBUTE_TO_OPTION_MAP",(function(e){return Object.assign(e,{accept:"acceptedFileTypes"})})),t("ALLOW_HOPPER_ITEM",(function(e,t){var n=t.query;return!n("GET_ALLOW_FILE_TYPE_VALIDATION")||a(e,n("GET_ACCEPTED_FILE_TYPES"))})),t("LOAD_FILE",(function(e,t){var n=t.query;return new Promise((function(t,i){if(n("GET_ALLOW_FILE_TYPE_VALIDATION")){var E=n("GET_ACCEPTED_FILE_TYPES"),T=n("GET_FILE_VALIDATE_TYPE_DETECT_TYPE"),u=a(e,E,T),o=function(){var e,t=E.map((e=n("GET_FILE_VALIDATE_TYPE_LABEL_EXPECTED_TYPES_MAP"),function(t){return null!==e[t]&&(e[t]||t)})).filter((function(e){return!1!==e})),T=t.filter((function(e,n){return t.indexOf(e)===n}));i({status:{main:n("GET_LABEL_FILE_TYPE_NOT_ALLOWED"),sub:r(n("GET_FILE_VALIDATE_TYPE_LABEL_EXPECTED_TYPES"),{allTypes:T.join(", "),allButLastType:T.slice(0,-1).join(", "),lastType:T[T.length-1]})}})};if("boolean"==typeof u)return u?t(e):o();u.then((function(){t(e)})).catch(o)}else t(e)}))})),{options:{allowFileTypeValidation:[!0,i.BOOLEAN],acceptedFileTypes:[[],i.ARRAY],labelFileTypeNotAllowed:["File is of invalid type",i.STRING],fileValidateTypeLabelExpectedTypes:["Expects {allButLastType} or {lastType}",i.STRING],fileValidateTypeLabelExpectedTypesMap:[{},i.OBJECT],fileValidateTypeDetectType:[null,i.FUNCTION]}}},"undefined"!=typeof window&&void 0!==window.document&&document.dispatchEvent(new CustomEvent("FilePond:pluginloaded",{detail:i})),i)),T=t({__proto__:null,default:e(r)},[r]);
5
5
  /*!
6
6
  * FilePondPluginFileValidateType 1.2.9
7
7
  * Licensed under MIT, https://opensource.org/licenses/MIT/
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r as s,h as e,H as t}from"./p-B64o_70M.js";import{S as o}from"./p-BscTeWDc.js";var i;!function(s){s.DEFAULT="default",s.AVAILABILITY="availability"}(i||(i={}));const r=class{constructor(e){s(this,e),this.loadedScopes={[i.DEFAULT]:null,[i.AVAILABILITY]:null},this.translationLoaded=!1,this.mode=i.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===i.DEFAULT?salla.lang.get(s?"blocks.scope.shopping_from_another_market":"blocks.scope.shopping_from_another_branch"):salla.lang.get("blocks.scope.search_for_availability_in_other_branches")},salla.event.on("scopes::open",(({mode:s=null,product_id:e=null}={})=>{this.open(s,e)})),salla.lang.onLoaded((()=>{this.translationLoaded=!0}))}get isNativeApp(){return!!salla.mobile?.isSpaWebview?.()}async close(){return await(this.modal?.close())}async open(s=i.DEFAULT,e=null){return this.isNativeApp?(salla.log("SallaScope:: delegated open to native app"),void salla.mobile?.openScopes?.()):(this.hasError=!1,this.mode=[i.AVAILABILITY,i.DEFAULT].includes(s)?s:i.DEFAULT,this.loading=!this.loadedScopes[this.mode],this.setScopeValues([]),salla.log("SallaScope:: opened"),this.modal.open(),this.loading?await salla.api.withoutNotifier((()=>s==i.AVAILABILITY?salla.scope.getProductAvailability(e):salla.scope.get())).then((e=>{if(s==i.AVAILABILITY)return this.setScopeValues(this.loadedScopes[i.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 e("salla-placeholder",{alignment:"center",class:"s-scopes-placeholder"},e("span",{slot:"title"},salla.lang.get("blocks.scope.branch_looking_for_not_found")),e("span",{slot:"description"},salla.lang.get("blocks.scope.our_services_not_available_in_this_branch")))}defaultContent(){return[e("div",{class:"s-scopes-container s-scrollbar"},this.scopes?.map((s=>e("div",{class:"s-scopes-input-wrap","data-selection":this.selection},e("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}),e("label",{htmlFor:`${this.selection} + '_scope_' + ${s.id}`,class:"s-scopes-label s-scopes-clickable"},e("span",null,s.name)))))),this.footerContent()]}availabilityContent(){return e("div",{class:"s-scopes-container"},this.scopes?.map((s=>e("div",{class:"s-scopes-input-wrap","data-selection":this.selection},e("h2",{class:{"s-scopes-label":!0,"s-scopes-clickable":this.mode===i.DEFAULT}},e("span",null,s.name)),e("h2",{style:{color:s?.availability?.color},class:`s-scopes-${s?.availability?.key}`},s?.availability?.label)))))}footerContent(){return e("div",{class:"s-scopes-footer"},e("slot",{name:"footer"},e("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:e(t,null,e("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?e("div",{slot:"loading"},e("div",{class:"s-scopes-skeleton"},e("salla-list-tile",{class:"s-scopes-header"},e("div",{slot:"icon",class:"s-scopes-header-icon"},e("salla-skeleton",{type:"circle"})),e("div",{slot:"title",class:"s-scopes-header-title mb-5"},e("salla-skeleton",{height:"15px",width:"50%"})),e("div",{slot:"subtitle",class:"s-scopes-header-subtitle"},e("salla-skeleton",{height:"10px"}),e("salla-skeleton",{height:"10px",width:"75%"}))),e("div",{class:"s-scopes-skeleton-search"},e("salla-skeleton",{height:"10px",width:"50%"}),e("salla-skeleton",{height:"30px",width:"100%"})),e("div",{class:"s-scopes-skeleton-scopes"},e("salla-skeleton",{height:"10px",width:"30%"}),e("salla-skeleton",{height:"10px",width:"25%"}),e("salla-skeleton",{height:"10px",width:"30%"}),e("salla-skeleton",{height:"10px",width:"25%"}),e("salla-skeleton",{height:"10px",width:"30%"}),e("salla-skeleton",{height:"10px",width:"25%"}),e("salla-skeleton",{height:"10px",width:"30%"}),e("salla-skeleton",{height:"10px",width:"25%"})),e("div",{class:"s-scopes-skeleton-btn"},e("salla-skeleton",{height:"40px",width:"100%"})))):[e("salla-list-tile",{class:this.originalScopesList?.length?"s-scopes-header block":"s-hidden"},e("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'}),e("div",{slot:"title",class:"s-scopes-header-title"},salla.lang.get("blocks.scope.you_are_browse_store_from")),e("div",{slot:"subtitle",class:"s-scopes-header-subtitle"},this.selected_scope?this.selected_scope.name:"")),e("div",{class:"s-scopes-wrap"},!!this.originalScopesList?.length&&e("h4",{class:"s-scopes-title"},this.getFormTitle()),this.originalScopesList?.length>this.searchDisplayLimit?e("div",{class:"s-scopes-search-wrapper"},e("div",{class:"s-scopes-search-icon",innerHTML:o}),e("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!==i.AVAILABILITY?this.placeholderContent():this.mode===i.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()}};r.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-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{r as salla_scopes}
4
+ import{r as s,h as e,H as t}from"./p-Bf2Z6A1M.js";import{S as o}from"./p-BscTeWDc.js";var i;!function(s){s.DEFAULT="default",s.AVAILABILITY="availability"}(i||(i={}));const r=class{constructor(e){s(this,e),this.loadedScopes={[i.DEFAULT]:null,[i.AVAILABILITY]:null},this.translationLoaded=!1,this.mode=i.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===i.DEFAULT?salla.lang.get(s?"blocks.scope.shopping_from_another_market":"blocks.scope.shopping_from_another_branch"):salla.lang.get("blocks.scope.search_for_availability_in_other_branches")},salla.event.on("scopes::open",(({mode:s=null,product_id:e=null}={})=>{this.open(s,e)})),salla.lang.onLoaded((()=>{this.translationLoaded=!0}))}get isNativeApp(){return!!salla.mobile?.isSpaWebview?.()}async close(){return await(this.modal?.close())}async open(s=i.DEFAULT,e=null){return this.isNativeApp?(salla.log("SallaScope:: delegated open to native app"),void salla.mobile?.openScopes?.()):(this.hasError=!1,this.mode=[i.AVAILABILITY,i.DEFAULT].includes(s)?s:i.DEFAULT,this.loading=!this.loadedScopes[this.mode],this.setScopeValues([]),salla.log("SallaScope:: opened"),this.modal.open(),this.loading?await salla.api.withoutNotifier((()=>s==i.AVAILABILITY?salla.scope.getProductAvailability(e):salla.scope.get())).then((e=>{if(s==i.AVAILABILITY)return this.setScopeValues(this.loadedScopes[i.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 e("salla-placeholder",{alignment:"center",class:"s-scopes-placeholder"},e("span",{slot:"title"},salla.lang.get("blocks.scope.branch_looking_for_not_found")),e("span",{slot:"description"},salla.lang.get("blocks.scope.our_services_not_available_in_this_branch")))}defaultContent(){return[e("div",{class:"s-scopes-container s-scrollbar"},this.scopes?.map((s=>e("div",{class:"s-scopes-input-wrap","data-selection":this.selection},e("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}),e("label",{htmlFor:`${this.selection} + '_scope_' + ${s.id}`,class:"s-scopes-label s-scopes-clickable"},e("span",null,s.name)))))),this.footerContent()]}availabilityContent(){return e("div",{class:"s-scopes-container"},this.scopes?.map((s=>e("div",{class:"s-scopes-input-wrap","data-selection":this.selection},e("h2",{class:{"s-scopes-label":!0,"s-scopes-clickable":this.mode===i.DEFAULT}},e("span",null,s.name)),e("h2",{style:{color:s?.availability?.color},class:`s-scopes-${s?.availability?.key}`},s?.availability?.label)))))}footerContent(){return e("div",{class:"s-scopes-footer"},e("slot",{name:"footer"},e("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:e(t,null,e("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?e("div",{slot:"loading"},e("div",{class:"s-scopes-skeleton"},e("salla-list-tile",{class:"s-scopes-header"},e("div",{slot:"icon",class:"s-scopes-header-icon"},e("salla-skeleton",{type:"circle"})),e("div",{slot:"title",class:"s-scopes-header-title mb-5"},e("salla-skeleton",{height:"15px",width:"50%"})),e("div",{slot:"subtitle",class:"s-scopes-header-subtitle"},e("salla-skeleton",{height:"10px"}),e("salla-skeleton",{height:"10px",width:"75%"}))),e("div",{class:"s-scopes-skeleton-search"},e("salla-skeleton",{height:"10px",width:"50%"}),e("salla-skeleton",{height:"30px",width:"100%"})),e("div",{class:"s-scopes-skeleton-scopes"},e("salla-skeleton",{height:"10px",width:"30%"}),e("salla-skeleton",{height:"10px",width:"25%"}),e("salla-skeleton",{height:"10px",width:"30%"}),e("salla-skeleton",{height:"10px",width:"25%"}),e("salla-skeleton",{height:"10px",width:"30%"}),e("salla-skeleton",{height:"10px",width:"25%"}),e("salla-skeleton",{height:"10px",width:"30%"}),e("salla-skeleton",{height:"10px",width:"25%"})),e("div",{class:"s-scopes-skeleton-btn"},e("salla-skeleton",{height:"40px",width:"100%"})))):[e("salla-list-tile",{class:this.originalScopesList?.length?"s-scopes-header block":"s-hidden"},e("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'}),e("div",{slot:"title",class:"s-scopes-header-title"},salla.lang.get("blocks.scope.you_are_browse_store_from")),e("div",{slot:"subtitle",class:"s-scopes-header-subtitle"},this.selected_scope?this.selected_scope.name:"")),e("div",{class:"s-scopes-wrap"},!!this.originalScopesList?.length&&e("h4",{class:"s-scopes-title"},this.getFormTitle()),this.originalScopesList?.length>this.searchDisplayLimit?e("div",{class:"s-scopes-search-wrapper"},e("div",{class:"s-scopes-search-icon",innerHTML:o}),e("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!==i.AVAILABILITY?this.placeholderContent():this.mode===i.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()}};r.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-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{r as salla_scopes}
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r as t,h as e,H as a}from"./p-B64o_70M.js";const l=class{constructor(e){t(this,e),this.transactionsArray=[],this.isLoading=!1,this.nextPageUrl="",this.handleClick=()=>{this.loadMoreTransactions()}}componentWillLoad(){return salla.onReady().then((()=>this.loadTransactions()))}normalizeTransactions(t){if(Array.isArray(t))return{list:t,nextPageUrl:""};const e=t?.current_page??1,a=e<(t?.last_page??e)?`/balance/wallet?per_page=${t?.per_page??10}&page=${e+1}`:"";return{list:t?.data??[],nextPageUrl:a}}async loadTransactions(){this.isLoading=!0;try{let t="/balance/wallet?per_page=10&page=1",e=await salla.api.request(t);const{list:a,nextPageUrl:l}=this.normalizeTransactions(e.data.transactions);this.nextPageUrl=l,this.transactionsArray=a,this.balance=e.data.balance}catch(t){console.error("Error loading wallet transactions",t)}finally{this.isLoading=!1}}async loadMoreTransactions(){this.isLoading=!0;try{let t=this.nextPageUrl||"/balance/wallet?page=2&per_page=10",e=await salla.api.request(t);const{list:a,nextPageUrl:l}=this.normalizeTransactions(e.data.transactions);this.nextPageUrl=l,this.transactionsArray=[...this.transactionsArray,...a],this.balance=e.data.balance}catch(t){console.error("Error loading wallet transactions",t)}finally{this.isLoading=!1}}render(){return this.transactionsArray.length>0?e(a,null,e("table",{class:"s-wallet-table"},e("tbody",{class:"s-wallet-table-tbody"},e("tr",{class:"s-table__tr"},e("td",null,e("div",{class:"s-wallet-table-balance-container"},e("i",{class:"s-wallet-table-balance-icon sicon-wallet"}),e("div",null,e("div",{innerHTML:salla.money(this.balance)}),e("div",{class:"font-normal text-gray-400"}," ",salla.lang.get("pages.wallet.balance")))))))),e("h2",{style:{"margin-top":"32px"}},salla.lang.get("pages.wallet.title")),e("table",{class:"s-wallet-table"},e("thead",{class:"s-wallet-table-head"},e("tr",{class:"s-wallet-table-head-tr"},e("th",{scope:"col"},salla.lang.get("pages.wallet.transaction_number")),e("th",{scope:"col",class:"s-wallet-table-head-tr-th"},salla.lang.get("pages.wallet.amount")),e("th",{scope:"col",class:"s-wallet-table-head-tr-th"},salla.lang.get("pages.wallet.date")),e("th",{scope:"col",class:"s-wallet-table-head-tr-th"},salla.lang.get("pages.wallet.order_no")),e("th",{scope:"col",class:"s-wallet-table-head-tr-th"},salla.lang.get("pages.wallet.expiry_date")),e("th",{scope:"col",class:"s-wallet-table-head-tr-th"},salla.lang.get("pages.wallet.transaction_type")," "))),e("tbody",{class:"s-wallet-table-tbody"},this.transactionsArray.map((t=>e("tr",{class:"s-wallet-table-tbody-tr s-wallet-table-tbody-tr-shadow animated"},e("td",{class:"s-wallet-table-tbody-tr-td"},e("div",{class:"s-wallet-table-tbody-tr-td-content"},e("span",{class:"s-wallet-mobile-title"},salla.lang.get("pages.wallet.transaction_number"),":"),t.id&&e("span",{class:"hidden md:inline-block"},"#",t.id),e("div",{class:"flex items-center md:hidden"},e("salla-button",{class:"relative",color:"dark",shape:"link","data-content":t.order_id},t.order_id&&e("span",null,"#",t.order_id))))),e("td",{id:"main123",class:"s-wallet-table-tbody-tr-td"},e("div",{id:"main124",class:"s-wallet-table-tbody-tr-td-content"},e("span",{id:"main125",class:"s-wallet-mobile-title"},salla.lang.get("pages.wallet.amount"),":"),e("div",{innerHTML:salla.money(t.amount)}))),e("td",{class:"s-wallet-table-tbody-tr-td"},e("div",{class:"s-wallet-table-tbody-tr-td-content"},e("span",{class:"s-wallet-mobile-title"},salla.lang.get("pages.wallet.date"),":"),t.created_at&&new Date(1e3*t.created_at).toLocaleDateString(salla.lang.locale,{weekday:"long",year:"numeric",month:"long",day:"numeric",hour:"numeric"}))),e("td",{id:"main133",class:"s-wallet-table-tbody-tr-td"},e("div",{id:"main134",class:"s-wallet-table-tbody-tr-td-content"},e("span",{id:"main135",class:"s-wallet-mobile-title"},salla.lang.get("pages.wallet.order_no"),":"),e("span",{class:"rtl:mr-auto ltr:ml-auto md:mx-0"},t.order_id&&e("span",null,"#",t.order_id)))),e("td",{id:"main143",class:"s-wallet-table-tbody-tr-td"},e("div",{id:"main144",class:"s-wallet-table-tbody-tr-td-content"},e("span",{id:"main145",class:"s-wallet-mobile-title"},salla.lang.get("pages.wallet.expiry_date"),":"),e("span",null,t.expired_at&&new Date(1e3*t.expired_at).toLocaleDateString(salla.lang.locale,{weekday:"long",year:"numeric",month:"long",day:"numeric",hour:"numeric"})))),e("td",{class:"s-wallet-table-tbody-tr-td"},e("div",{class:"s-wallet-table-tbody-tr-td-content"},e("div",null,e("span",{class:"s-wallet-mobile-title"},salla.lang.get("pages.wallet.transaction_type"),":")),e("div",{class:{"s-wallet-table-transaction-status-default":!0,"s-wallet-table-transaction-status-cashback":"cashback"===t.action_type,"s-wallet-table-transaction-status-refund":"refund"===t.action_type,"s-wallet-table-transaction-status-purchase":"purchase_by_wallet"===t.action_type}},!!t.description&&e("i",{id:t.id.toString(),class:"sicon-information text-lg rtl:ml-4 ltr:mr-4 s-wallet-table-transaction-status-icon-success"}),!!t.description&&e("salla-tooltip",{text:t.description,targetId:t.id.toString()}),e("span",null,t.title))))))))),e("div",{class:"s-infinite-scroll-wrapper"},!!this.nextPageUrl&&e("salla-button",{onClick:this.handleClick,loading:this.isLoading},salla.lang.get("common.elements.load_more")))):e(a,null,e("h2",{style:{"margin-top":"32px"}},salla.lang.get("pages.wallet.title")),e("div",{class:"s-wallet-table-empty-state"},e("i",{class:"sicon-full-wallet"}),e("div",{class:"text-center p-3 text-xl font-bold "},salla.lang.get("pages.wallet.no_transactions")),e("div",{class:"text-center text-gray-400 text-sm font-normal "},salla.lang.get("pages.wallet.zero_balance")," ")))}};l.style='/*!twlt*/.s-wallet-table{min-width:100%}.s-wallet-table-balance-container{display:flex !important;align-items:center !important;justify-content:flex-start !important;gap:1rem}.s-wallet-table-balance-icon{border-radius:50%;width:52px;height:52px;font-size:25px;padding:16px 13px;background:var(--color-primary-reverse);color:var(--color-primary)}.s-wallet-table-empty-state{display:flex;flex-direction:column;align-items:center}.s-wallet-table-empty-state i{font-size:80px;margin:4rem 0 2rem;color:var(--infinte-color)}.s-wallet-table-transaction-status{padding:6px 19px !important;border-radius:20px;width:max-content;display:flex;align-items:center}.s-wallet-table-transaction-status-default{background:#fff6eb;color:#a46f29}.s-wallet-table-transaction-status-cashback{background:#effbf6;color:#00af6c}.s-wallet-table-transaction-status-refund{background:#ecf3fe;color:#5196f3}.s-wallet-table-transaction-status-purchase{background:#feecec;color:#f55157}.s-wallet-table-transaction-status-icons-success{color:#00af6c}.absolute{position:absolute}.relative{position:relative}.flex{display:flex}.table{display:table}.hidden{display:none}.items-center{align-items:center}.p-3{padding:0.75rem}.text-center{text-align:center}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:0.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.font-bold{font-weight:700}.font-normal{font-weight:400}.text-gray-400{--tw-text-opacity:1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.s-wallet-container>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(0.625rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(0.625rem * var(--tw-space-y-reverse))}@media (min-width: 768px){.s-wallet-container>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(1.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.25rem * var(--tw-space-y-reverse))}}.s-wallet-mobile-title{display:inline-block;width:8rem;font-weight:400;--tw-text-opacity:1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}@media (min-width: 768px){.s-wallet-mobile-title{display:none}}.s-wallet-reference-id{display:none}@media (min-width: 768px){.s-wallet-reference-id{display:inline-block}}.s-wallet-buy-as-gift-icon{margin-left:0.25rem;margin-right:0.25rem;display:inline-block;color:var(--color-primary)}.s-wallet-copy-to-clipboard-button{display:flex;align-items:center}@media (min-width: 768px){.s-wallet-copy-to-clipboard-button{display:none}}.s-wallet-copy-to-clipboard-button salla-button{position:relative}.s-wallet-copy-to-clipboard-button-icon{pointer-events:none;font-size:0.75rem;line-height:1rem}.s-wallet-copy-to-clipboard-button-icon:where([dir="ltr"],[dir="ltr"] *){margin-left:0.25rem}.s-wallet-copy-to-clipboard-button-icon:where([dir="rtl"],[dir="rtl"] *){margin-right:0.25rem}@media (min-width: 768px){.s-wallet-status-container{margin-left:0px;margin-right:0px}}.s-wallet-status-container:where([dir="ltr"],[dir="ltr"] *){margin-left:auto}.s-wallet-status-container:where([dir="rtl"],[dir="rtl"] *){margin-right:auto}.s-wallet-status-container i{margin-top:0.25rem}.s-wallet-status-container i:where([dir="ltr"],[dir="ltr"] *){margin-right:0.25rem}.s-wallet-status-container i:where([dir="rtl"],[dir="rtl"] *){margin-left:0.25rem}.s-wallet-rated-text{--tw-text-opacity:1;color:rgb(251 191 36 / var(--tw-text-opacity, 1))}.s-wallet-unrated-text{--tw-text-opacity:1;color:rgb(229 231 235 / var(--tw-text-opacity, 1))}.s-wallet-no-content{display:flex;height:100%;flex-direction:column;align-items:center;justify-content:center;padding-top:2.5rem;padding-bottom:5rem;--tw-text-opacity:1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.s-wallet-no-content .icon{margin-bottom:1rem;display:flex;height:8rem;width:8rem;align-items:center;justify-content:center;border-radius:9999px;--tw-bg-opacity:1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1));font-size:3rem;line-height:1;--tw-text-opacity:1;color:rgb(209 213 219 / var(--tw-text-opacity, 1))}.s-wallet-no-content p{margin-bottom:1rem;font-size:1rem;line-height:1.5rem;--tw-text-opacity:1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.s-wallet-table{min-width:100%;border-collapse:separate}@media (min-width: 768px){.s-wallet-table{margin-bottom:-0.75rem;--tw-border-spacing-y:1.25rem;border-spacing:var(--tw-border-spacing-x) var(--tw-border-spacing-y)}}.s-wallet-table-head{margin-bottom:1.25rem;display:none;--tw-bg-opacity:1;background-color:rgb(249 250 251 / var(--tw-bg-opacity, 1))}@media (min-width: 768px){.s-wallet-table-head{display:table-header-group}}.s-wallet-table-head-tr-th{padding-left:1.5rem;padding-right:1.5rem;text-align:start;font-size:0.875rem;line-height:1.25rem;font-weight:500;text-transform:uppercase;letter-spacing:0.05em}.s-wallet-table-head-tr-th:where([dir="ltr"],[dir="ltr"] *){text-align:left}.s-wallet-table-head-tr-th:last-child:where([dir="ltr"],[dir="ltr"] *){text-align:right}.s-wallet-table-head-tr-th:where([dir="rtl"],[dir="rtl"] *){text-align:right}.s-wallet-table-head-tr-th:last-child:where([dir="rtl"],[dir="rtl"] *){text-align:left}.s-wallet-table-tbody-tr{position:relative;display:flex;flex-direction:row;flex-wrap:wrap;overflow:hidden;border-radius:var(--s-radius, 0.25rem);border-bottom-width:8px;border-top-width:8px;--tw-border-opacity:1;border-color:rgb(249 250 251 / var(--tw-border-opacity, 1));--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1));padding:0.5rem;transition-property:box-shadow;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:500ms}@media (min-width: 768px){.s-wallet-table-tbody-tr{display:table-row;flex-direction:row;flex-wrap:nowrap;padding:0px}}.s-wallet-table-tbody-tr-td{width:100%;white-space:nowrap;font-size:0.875rem;line-height:1.25rem}.s-wallet-table-tbody-tr-td:first-child{font-weight:700}@media (min-width: 768px){.s-wallet-table-tbody-tr-td{height:5rem;width:auto}.s-wallet-table-tbody-tr-td:last-child{text-align:end}.s-wallet-table-tbody-tr-td:first-child:where([dir="ltr"],[dir="ltr"] *){border-top-left-radius:0.375rem;border-bottom-left-radius:0.375rem}.s-wallet-table-tbody-tr-td:first-child:where([dir="rtl"],[dir="rtl"] *){border-top-right-radius:0.375rem;border-bottom-right-radius:0.375rem}}.s-wallet-table-tbody-tr-td:first-child{font-weight:700}.s-wallet-table-tbody-tr-td-content{position:relative;display:flex;align-items:center;justify-content:space-between;padding-left:0.5rem;padding-right:0.5rem;padding-top:0.25rem;padding-bottom:0.25rem;font-size:0.75rem;line-height:1rem}@media (min-width: 768px){.s-wallet-table-tbody-tr-td-content{padding-left:1.5rem;padding-right:1.5rem;padding-top:1.5rem;padding-bottom:1.5rem}}.s-wallet-table-tbody-tr-td-content:where([dir="ltr"],[dir="ltr"] *){padding-right:0.5rem}.s-wallet-table-tbody-tr-td-content:where([dir="rtl"],[dir="rtl"] *){padding-left:0.5rem}.s-wallet-table-tbody-tr a{position:absolute;top:0px;bottom:0px;display:block;width:100%}.s-wallet-table-tbody-tr a:where([dir="ltr"],[dir="ltr"] *){left:0px}.s-wallet-table-tbody-tr a:where([dir="rtl"],[dir="rtl"] *){right:0px}@media (min-width: 768px){.md\\:mx-0{margin-left:0px;margin-right:0px}.md\\:inline-block{display:inline-block}.md\\:hidden{display:none}}.ltr\\:ml-auto:where([dir="ltr"],[dir="ltr"] *){margin-left:auto}.ltr\\:mr-4:where([dir="ltr"],[dir="ltr"] *){margin-right:1rem}.rtl\\:ml-4:where([dir="rtl"],[dir="rtl"] *){margin-left:1rem}.rtl\\:mr-auto:where([dir="rtl"],[dir="rtl"] *){margin-right:auto}/*!twlt*/.s-button-btn{position:relative;display:inline-flex;flex:1 1 0%;user-select:none;flex-direction:row-reverse;align-items:center;justify-content:center;white-space:nowrap;border-radius:var(--s-radius, 0.25rem);border-style:solid;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}.s-button-btn:hover{opacity:0.8}.s-button-primary{border-width:1px;border-color:var(--color-primary);background-color:var(--color-primary);color:var(--color-primary-reverse)}.s-button-primary:hover{background-color:var(--color-primary-dark)}.s-button-text{pointer-events:none;align-items:center;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;transition-property:opacity;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:300ms}.s-button-loader{margin-left:0.5rem;margin-right:0.5rem;display:flex;align-items:center;justify-content:center;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms}.s-button-loader::before{display:inline-block;height:1rem;content:var(--tw-content);width:1rem}@keyframes spin{to{content:var(--tw-content);transform:rotate(360deg)}}.s-button-loader::before{animation:spin 1s linear infinite;border-radius:9999px;border-width:2px;border-style:solid;border-top-color:var(--color-primary);border-left-color:var(--color-primary);border-bottom-color:rgb(243 244 246 / var(--tw-border-opacity, 1));--tw-border-opacity:1;border-right-color:rgb(243 244 246 / var(--tw-border-opacity, 1));--tw-content:\'\';content:var(--tw-content)}.s-button-loader-center .s-button-loader{position:absolute;top:50%;left:50%;margin:0px !important;--tw-translate-y:-50%;--tw-translate-x:-50%;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.s-comments-item-like-btn .s-button-text{display:flex;flex-direction:row-reverse;gap:0.5rem}.s-infinite-scroll-wrapper{margin-top:1rem;text-align:center}.s-infinite-scroll-last{margin:0px;text-align:center}.s-infinite-scroll-error{margin:0px;text-align:center}';export{l as salla_wallet}
4
+ import{r as t,h as e,H as a}from"./p-Bf2Z6A1M.js";const l=class{constructor(e){t(this,e),this.transactionsArray=[],this.isLoading=!1,this.nextPageUrl="",this.handleClick=()=>{this.loadMoreTransactions()}}componentWillLoad(){return salla.onReady().then((()=>this.loadTransactions()))}normalizeTransactions(t){if(Array.isArray(t))return{list:t,nextPageUrl:""};const e=t?.current_page??1,a=e<(t?.last_page??e)?`/balance/wallet?per_page=${t?.per_page??10}&page=${e+1}`:"";return{list:t?.data??[],nextPageUrl:a}}async loadTransactions(){this.isLoading=!0;try{let t="/balance/wallet?per_page=10&page=1",e=await salla.api.request(t);const{list:a,nextPageUrl:l}=this.normalizeTransactions(e.data.transactions);this.nextPageUrl=l,this.transactionsArray=a,this.balance=e.data.balance}catch(t){console.error("Error loading wallet transactions",t)}finally{this.isLoading=!1}}async loadMoreTransactions(){this.isLoading=!0;try{let t=this.nextPageUrl||"/balance/wallet?page=2&per_page=10",e=await salla.api.request(t);const{list:a,nextPageUrl:l}=this.normalizeTransactions(e.data.transactions);this.nextPageUrl=l,this.transactionsArray=[...this.transactionsArray,...a],this.balance=e.data.balance}catch(t){console.error("Error loading wallet transactions",t)}finally{this.isLoading=!1}}render(){return this.transactionsArray.length>0?e(a,null,e("table",{class:"s-wallet-table"},e("tbody",{class:"s-wallet-table-tbody"},e("tr",{class:"s-table__tr"},e("td",null,e("div",{class:"s-wallet-table-balance-container"},e("i",{class:"s-wallet-table-balance-icon sicon-wallet"}),e("div",null,e("div",{innerHTML:salla.money(this.balance)}),e("div",{class:"font-normal text-gray-400"}," ",salla.lang.get("pages.wallet.balance")))))))),e("h2",{style:{"margin-top":"32px"}},salla.lang.get("pages.wallet.title")),e("table",{class:"s-wallet-table"},e("thead",{class:"s-wallet-table-head"},e("tr",{class:"s-wallet-table-head-tr"},e("th",{scope:"col"},salla.lang.get("pages.wallet.transaction_number")),e("th",{scope:"col",class:"s-wallet-table-head-tr-th"},salla.lang.get("pages.wallet.amount")),e("th",{scope:"col",class:"s-wallet-table-head-tr-th"},salla.lang.get("pages.wallet.date")),e("th",{scope:"col",class:"s-wallet-table-head-tr-th"},salla.lang.get("pages.wallet.order_no")),e("th",{scope:"col",class:"s-wallet-table-head-tr-th"},salla.lang.get("pages.wallet.expiry_date")),e("th",{scope:"col",class:"s-wallet-table-head-tr-th"},salla.lang.get("pages.wallet.transaction_type")," "))),e("tbody",{class:"s-wallet-table-tbody"},this.transactionsArray.map((t=>e("tr",{class:"s-wallet-table-tbody-tr s-wallet-table-tbody-tr-shadow animated"},e("td",{class:"s-wallet-table-tbody-tr-td"},e("div",{class:"s-wallet-table-tbody-tr-td-content"},e("span",{class:"s-wallet-mobile-title"},salla.lang.get("pages.wallet.transaction_number"),":"),t.id&&e("span",{class:"hidden md:inline-block"},"#",t.id),e("div",{class:"flex items-center md:hidden"},e("salla-button",{class:"relative",color:"dark",shape:"link","data-content":t.order_id},t.order_id&&e("span",null,"#",t.order_id))))),e("td",{id:"main123",class:"s-wallet-table-tbody-tr-td"},e("div",{id:"main124",class:"s-wallet-table-tbody-tr-td-content"},e("span",{id:"main125",class:"s-wallet-mobile-title"},salla.lang.get("pages.wallet.amount"),":"),e("div",{innerHTML:salla.money(t.amount)}))),e("td",{class:"s-wallet-table-tbody-tr-td"},e("div",{class:"s-wallet-table-tbody-tr-td-content"},e("span",{class:"s-wallet-mobile-title"},salla.lang.get("pages.wallet.date"),":"),t.created_at&&new Date(1e3*t.created_at).toLocaleDateString(salla.lang.locale,{weekday:"long",year:"numeric",month:"long",day:"numeric",hour:"numeric"}))),e("td",{id:"main133",class:"s-wallet-table-tbody-tr-td"},e("div",{id:"main134",class:"s-wallet-table-tbody-tr-td-content"},e("span",{id:"main135",class:"s-wallet-mobile-title"},salla.lang.get("pages.wallet.order_no"),":"),e("span",{class:"rtl:mr-auto ltr:ml-auto md:mx-0"},t.order_id&&e("span",null,"#",t.order_id)))),e("td",{id:"main143",class:"s-wallet-table-tbody-tr-td"},e("div",{id:"main144",class:"s-wallet-table-tbody-tr-td-content"},e("span",{id:"main145",class:"s-wallet-mobile-title"},salla.lang.get("pages.wallet.expiry_date"),":"),e("span",null,t.expired_at&&new Date(1e3*t.expired_at).toLocaleDateString(salla.lang.locale,{weekday:"long",year:"numeric",month:"long",day:"numeric",hour:"numeric"})))),e("td",{class:"s-wallet-table-tbody-tr-td"},e("div",{class:"s-wallet-table-tbody-tr-td-content"},e("div",null,e("span",{class:"s-wallet-mobile-title"},salla.lang.get("pages.wallet.transaction_type"),":")),e("div",{class:{"s-wallet-table-transaction-status-default":!0,"s-wallet-table-transaction-status-cashback":"cashback"===t.action_type,"s-wallet-table-transaction-status-refund":"refund"===t.action_type,"s-wallet-table-transaction-status-purchase":"purchase_by_wallet"===t.action_type}},!!t.description&&e("i",{id:t.id.toString(),class:"sicon-information text-lg rtl:ml-4 ltr:mr-4 s-wallet-table-transaction-status-icon-success"}),!!t.description&&e("salla-tooltip",{text:t.description,targetId:t.id.toString()}),e("span",null,t.title))))))))),e("div",{class:"s-infinite-scroll-wrapper"},!!this.nextPageUrl&&e("salla-button",{onClick:this.handleClick,loading:this.isLoading},salla.lang.get("common.elements.load_more")))):e(a,null,e("h2",{style:{"margin-top":"32px"}},salla.lang.get("pages.wallet.title")),e("div",{class:"s-wallet-table-empty-state"},e("i",{class:"sicon-full-wallet"}),e("div",{class:"text-center p-3 text-xl font-bold "},salla.lang.get("pages.wallet.no_transactions")),e("div",{class:"text-center text-gray-400 text-sm font-normal "},salla.lang.get("pages.wallet.zero_balance")," ")))}};l.style='/*!twlt*/.s-wallet-table{min-width:100%}.s-wallet-table-balance-container{display:flex !important;align-items:center !important;justify-content:flex-start !important;gap:1rem}.s-wallet-table-balance-icon{border-radius:50%;width:52px;height:52px;font-size:25px;padding:16px 13px;background:var(--color-primary-reverse);color:var(--color-primary)}.s-wallet-table-empty-state{display:flex;flex-direction:column;align-items:center}.s-wallet-table-empty-state i{font-size:80px;margin:4rem 0 2rem;color:var(--infinte-color)}.s-wallet-table-transaction-status{padding:6px 19px !important;border-radius:20px;width:max-content;display:flex;align-items:center}.s-wallet-table-transaction-status-default{background:#fff6eb;color:#a46f29}.s-wallet-table-transaction-status-cashback{background:#effbf6;color:#00af6c}.s-wallet-table-transaction-status-refund{background:#ecf3fe;color:#5196f3}.s-wallet-table-transaction-status-purchase{background:#feecec;color:#f55157}.s-wallet-table-transaction-status-icons-success{color:#00af6c}.absolute{position:absolute}.relative{position:relative}.flex{display:flex}.table{display:table}.hidden{display:none}.items-center{align-items:center}.p-3{padding:0.75rem}.text-center{text-align:center}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:0.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.font-bold{font-weight:700}.font-normal{font-weight:400}.text-gray-400{--tw-text-opacity:1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.s-wallet-container>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(0.625rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(0.625rem * var(--tw-space-y-reverse))}@media (min-width: 768px){.s-wallet-container>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(1.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.25rem * var(--tw-space-y-reverse))}}.s-wallet-mobile-title{display:inline-block;width:8rem;font-weight:400;--tw-text-opacity:1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}@media (min-width: 768px){.s-wallet-mobile-title{display:none}}.s-wallet-reference-id{display:none}@media (min-width: 768px){.s-wallet-reference-id{display:inline-block}}.s-wallet-buy-as-gift-icon{margin-left:0.25rem;margin-right:0.25rem;display:inline-block;color:var(--color-primary)}.s-wallet-copy-to-clipboard-button{display:flex;align-items:center}@media (min-width: 768px){.s-wallet-copy-to-clipboard-button{display:none}}.s-wallet-copy-to-clipboard-button salla-button{position:relative}.s-wallet-copy-to-clipboard-button-icon{pointer-events:none;font-size:0.75rem;line-height:1rem}.s-wallet-copy-to-clipboard-button-icon:where([dir="ltr"],[dir="ltr"] *){margin-left:0.25rem}.s-wallet-copy-to-clipboard-button-icon:where([dir="rtl"],[dir="rtl"] *){margin-right:0.25rem}@media (min-width: 768px){.s-wallet-status-container{margin-left:0px;margin-right:0px}}.s-wallet-status-container:where([dir="ltr"],[dir="ltr"] *){margin-left:auto}.s-wallet-status-container:where([dir="rtl"],[dir="rtl"] *){margin-right:auto}.s-wallet-status-container i{margin-top:0.25rem}.s-wallet-status-container i:where([dir="ltr"],[dir="ltr"] *){margin-right:0.25rem}.s-wallet-status-container i:where([dir="rtl"],[dir="rtl"] *){margin-left:0.25rem}.s-wallet-rated-text{--tw-text-opacity:1;color:rgb(251 191 36 / var(--tw-text-opacity, 1))}.s-wallet-unrated-text{--tw-text-opacity:1;color:rgb(229 231 235 / var(--tw-text-opacity, 1))}.s-wallet-no-content{display:flex;height:100%;flex-direction:column;align-items:center;justify-content:center;padding-top:2.5rem;padding-bottom:5rem;--tw-text-opacity:1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.s-wallet-no-content .icon{margin-bottom:1rem;display:flex;height:8rem;width:8rem;align-items:center;justify-content:center;border-radius:9999px;--tw-bg-opacity:1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1));font-size:3rem;line-height:1;--tw-text-opacity:1;color:rgb(209 213 219 / var(--tw-text-opacity, 1))}.s-wallet-no-content p{margin-bottom:1rem;font-size:1rem;line-height:1.5rem;--tw-text-opacity:1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.s-wallet-table{min-width:100%;border-collapse:separate}@media (min-width: 768px){.s-wallet-table{margin-bottom:-0.75rem;--tw-border-spacing-y:1.25rem;border-spacing:var(--tw-border-spacing-x) var(--tw-border-spacing-y)}}.s-wallet-table-head{margin-bottom:1.25rem;display:none;--tw-bg-opacity:1;background-color:rgb(249 250 251 / var(--tw-bg-opacity, 1))}@media (min-width: 768px){.s-wallet-table-head{display:table-header-group}}.s-wallet-table-head-tr-th{padding-left:1.5rem;padding-right:1.5rem;text-align:start;font-size:0.875rem;line-height:1.25rem;font-weight:500;text-transform:uppercase;letter-spacing:0.05em}.s-wallet-table-head-tr-th:where([dir="ltr"],[dir="ltr"] *){text-align:left}.s-wallet-table-head-tr-th:last-child:where([dir="ltr"],[dir="ltr"] *){text-align:right}.s-wallet-table-head-tr-th:where([dir="rtl"],[dir="rtl"] *){text-align:right}.s-wallet-table-head-tr-th:last-child:where([dir="rtl"],[dir="rtl"] *){text-align:left}.s-wallet-table-tbody-tr{position:relative;display:flex;flex-direction:row;flex-wrap:wrap;overflow:hidden;border-radius:var(--s-radius, 0.25rem);border-bottom-width:8px;border-top-width:8px;--tw-border-opacity:1;border-color:rgb(249 250 251 / var(--tw-border-opacity, 1));--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1));padding:0.5rem;transition-property:box-shadow;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:500ms}@media (min-width: 768px){.s-wallet-table-tbody-tr{display:table-row;flex-direction:row;flex-wrap:nowrap;padding:0px}}.s-wallet-table-tbody-tr-td{width:100%;white-space:nowrap;font-size:0.875rem;line-height:1.25rem}.s-wallet-table-tbody-tr-td:first-child{font-weight:700}@media (min-width: 768px){.s-wallet-table-tbody-tr-td{height:5rem;width:auto}.s-wallet-table-tbody-tr-td:last-child{text-align:end}.s-wallet-table-tbody-tr-td:first-child:where([dir="ltr"],[dir="ltr"] *){border-top-left-radius:0.375rem;border-bottom-left-radius:0.375rem}.s-wallet-table-tbody-tr-td:first-child:where([dir="rtl"],[dir="rtl"] *){border-top-right-radius:0.375rem;border-bottom-right-radius:0.375rem}}.s-wallet-table-tbody-tr-td:first-child{font-weight:700}.s-wallet-table-tbody-tr-td-content{position:relative;display:flex;align-items:center;justify-content:space-between;padding-left:0.5rem;padding-right:0.5rem;padding-top:0.25rem;padding-bottom:0.25rem;font-size:0.75rem;line-height:1rem}@media (min-width: 768px){.s-wallet-table-tbody-tr-td-content{padding-left:1.5rem;padding-right:1.5rem;padding-top:1.5rem;padding-bottom:1.5rem}}.s-wallet-table-tbody-tr-td-content:where([dir="ltr"],[dir="ltr"] *){padding-right:0.5rem}.s-wallet-table-tbody-tr-td-content:where([dir="rtl"],[dir="rtl"] *){padding-left:0.5rem}.s-wallet-table-tbody-tr a{position:absolute;top:0px;bottom:0px;display:block;width:100%}.s-wallet-table-tbody-tr a:where([dir="ltr"],[dir="ltr"] *){left:0px}.s-wallet-table-tbody-tr a:where([dir="rtl"],[dir="rtl"] *){right:0px}@media (min-width: 768px){.md\\:mx-0{margin-left:0px;margin-right:0px}.md\\:inline-block{display:inline-block}.md\\:hidden{display:none}}.ltr\\:ml-auto:where([dir="ltr"],[dir="ltr"] *){margin-left:auto}.ltr\\:mr-4:where([dir="ltr"],[dir="ltr"] *){margin-right:1rem}.rtl\\:ml-4:where([dir="rtl"],[dir="rtl"] *){margin-left:1rem}.rtl\\:mr-auto:where([dir="rtl"],[dir="rtl"] *){margin-right:auto}/*!twlt*/.s-button-btn{position:relative;display:inline-flex;flex:1 1 0%;user-select:none;flex-direction:row-reverse;align-items:center;justify-content:center;white-space:nowrap;border-radius:var(--s-radius, 0.25rem);border-style:solid;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}.s-button-btn:hover{opacity:0.8}.s-button-primary{border-width:1px;border-color:var(--color-primary);background-color:var(--color-primary);color:var(--color-primary-reverse)}.s-button-primary:hover{background-color:var(--color-primary-dark)}.s-button-text{pointer-events:none;align-items:center;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;transition-property:opacity;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:300ms}.s-button-loader{margin-left:0.5rem;margin-right:0.5rem;display:flex;align-items:center;justify-content:center;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms}.s-button-loader::before{display:inline-block;height:1rem;content:var(--tw-content);width:1rem}@keyframes spin{to{content:var(--tw-content);transform:rotate(360deg)}}.s-button-loader::before{animation:spin 1s linear infinite;border-radius:9999px;border-width:2px;border-style:solid;border-top-color:var(--color-primary);border-left-color:var(--color-primary);border-bottom-color:rgb(243 244 246 / var(--tw-border-opacity, 1));--tw-border-opacity:1;border-right-color:rgb(243 244 246 / var(--tw-border-opacity, 1));--tw-content:\'\';content:var(--tw-content)}.s-button-loader-center .s-button-loader{position:absolute;top:50%;left:50%;margin:0px !important;--tw-translate-y:-50%;--tw-translate-x:-50%;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.s-comments-item-like-btn .s-button-text{display:flex;flex-direction:row-reverse;gap:0.5rem}.s-infinite-scroll-wrapper{margin-top:1rem;text-align:center}.s-infinite-scroll-last{margin:0px;text-align:center}.s-infinite-scroll-error{margin:0px;text-align:center}';export{l as salla_wallet}
@@ -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-B64o_70M.js";const i=class{constructor(t){e(this,t),this.otpInputs=[],this.deletePendingDays=null,this.currentStep="confirm",this.isDeletePending=!1,this.otpType="email",this.otpHasError=!1,this.otpErrorMessage="",this.isSubmitting=!1,this.isVerifyingOtp=!1,this.isSwitchingChannel=!1,this.resendAfter=30,this.showResendLink=!1,this.canHideName=salla.config.get("store.settings.rating.can_customer_hide_name"),this.translationDefaults={"pages.profile.delete_account":{ar:"حذف الحساب",en:"Delete account"},"pages.profile.delete_account_description":{ar:"سيُحذف حسابك وبياناتك من المتجر نهائيًا، بما في ذلك سجل طلباتك.",en:"Your account and data will be permanently deleted from the store, including your order history."},"pages.profile.delete_account_confirm_title":{ar:"هل تريد حذف حسابك؟",en:"Do you want to delete your account?"},"pages.profile.delete_account_warning":{ar:"بعد الحذف، ستفقد الوصول إلى بياناتك، بما في ذلك سجل الطلبات، وقائمة الأمنيات، وأي نقاط ولاء أو رصيد متاح في المحفظة.",en:"After deletion, you will lose access to your data, including order history, wishlist, and any loyalty points or wallet balance."},"pages.profile.cancel":{ar:"إلغاء",en:"Cancel"},"pages.profile.delete_account_otp_title":{ar:"تأكيد حذف الحساب",en:"Confirm account deletion"},"pages.profile.delete_account_otp_instruction":{ar:"للمتابعة، أدخل رمز التحقٌّق المرسل إلى:",en:"To continue, enter the verification code sent to:"},"pages.profile.delete_account_confirm_otp":{ar:"تأكيد الحذف",en:"Confirm deletion"},"pages.profile.delete_account_otp_required":{ar:"يرجى إدخال رمز التحقٌّق",en:"Please enter the verification code"},"pages.profile.delete_account_send_via_phone":{ar:"إرسال عبر الهاتف",en:"Send via phone"},"pages.profile.delete_account_send_via_email":{ar:"إرسال عبر البريد الإلكتروني",en:"Send via email"},"pages.profile.delete_account_success_title":{ar:"أُرسل طلب حذف الحساب",en:"Account deletion request submitted"},"pages.profile.delete_account_success_message":{ar:"سيُحذف حسابك خلال 30 يومًا. يمكنك إلغاء الطلب بتسجيل الدخول مرة أخرى قبل اكتمال الحذف.",en:"Your account will be deleted within 30 days. You can cancel the request by signing in again before deletion is complete."},"pages.profile.ok":{ar:"موافق",en:"OK"},"pages.profile.cancel_deletion_request":{ar:"تراجع عن الحذف",en:"Withdraw deletion"},"pages.profile.delete_account_pending":{ar:"حسابك مجدول للحذف نهائيًا من المتجر خلال :days يومًا. يمكنك التراجع عن الحذف قبل انقضاء المدة.",en:"Your account will be deleted permanently from the store within :days days. You can withdraw the deletion before the deadline."},"pages.profile.delete_request_cancelled":{ar:"تم إلغاء طلب الحذف",en:"Deletion request cancelled"}},this.registerTranslationDefaults(),this.loadTranslations(),salla.onReady((()=>{this.isHiddenName=salla.config.get("user.is_hidden_name"),this.isNotifiable=salla.config.get("user.is_notifiable"),this.canHideName=salla.config.get("store.settings.rating.can_customer_hide_name"),this.fetchDeleteRequestStatus(),this.isNotifiable&&this.isHiddenName||salla.event.on("profile::info.fetched",(e=>{this.isHiddenName=e.data.is_hidden_name,this.isNotifiable=e.data.is_notifiable}))})),salla.lang.onLoaded((()=>{this.registerTranslationDefaults(),this.loadTranslations()}))}getDaysUntilExecution(e){return Math.max(0,Math.ceil(((e>1e12?e:1e3*e)-Date.now())/864e5))}applyPendingMessage(){const e=salla.lang.get("pages.profile.delete_account_pending");this.deleteAccountPending=null!=this.deletePendingDays?e.replace(/:days/g,String(salla.helpers.number(this.deletePendingDays))):e}async fetchDeleteRequestStatus(){try{const e=await salla.profile.getDeleteRequest(),t=e?.data??null,s=t?.data_request||t,i=s?.status;this.isDeletePending="pending"===i;const r=s?.execution_at;this.deletePendingDays=null==r||Number.isNaN(Number(r))?null:this.getDaysUntilExecution(Number(r)),this.applyPendingMessage()}catch{}}registerTranslationDefaults(){if(!salla?.lang?.addBulk)return;const e=Object.entries(this.translationDefaults).reduce(((e,[t,s])=>(salla.lang.get(t)===t&&(e[t]=s),e)),{});Object.keys(e).length&&salla.lang.addBulk(e)}loadTranslations(){this.deleteAccount=salla.lang.get("pages.profile.delete_account"),this.deleteAccountDesc=salla.lang.get("pages.profile.delete_account_description"),this.deleteConfirmTitle=salla.lang.get("pages.profile.delete_account_confirm_title"),this.deleteAccountWarning=salla.lang.get("pages.profile.delete_account_warning"),this.cancelLabel=salla.lang.get("pages.profile.cancel"),this.deleteOtpTitle=salla.lang.get("pages.profile.delete_account_otp_title"),this.deleteOtpInstruction=salla.lang.get("pages.profile.delete_account_otp_instruction"),this.deleteConfirmOtp=salla.lang.get("pages.profile.delete_account_confirm_otp"),this.sendViaPhone=salla.lang.get("pages.profile.delete_account_send_via_phone"),this.sendViaEmail=salla.lang.get("pages.profile.delete_account_send_via_email"),this.deleteSuccessTitle=salla.lang.get("pages.profile.delete_account_success_title"),this.deleteSuccessMessage=salla.lang.get("pages.profile.delete_account_success_message"),this.okLabel=salla.lang.get("pages.profile.ok"),this.cancelDeletionRequest=salla.lang.get("pages.profile.cancel_deletion_request"),this.applyPendingMessage(),this.resendAfterLabel=salla.lang.get("blocks.header.resend_after"),this.resendLabel=salla.lang.get("blocks.comments.submit"),this.promotionalMsgs=salla.lang.get("pages.profile.promotional_messages"),this.hideMyName=salla.lang.get("pages.profile.hide_my_name"),this.hideMyNameDesc=salla.lang.get("pages.profile.hide_my_name_desc"),this.promotionalMsgsDesc=salla.lang.get("pages.profile.promotional_messages_description")}toggleSetting(e,t){salla.profile.updateSettings({name:e,value:t.target.checked})}capitalizeText(e){return e?e.charAt(0).toUpperCase()+e.slice(1):""}getOtpTarget(){return"email"===this.otpType?salla.config.get("user.email")||"":salla.config.get("user.mobile")||""}updateModalForStep(){if(this.confirmationModal)switch(this.currentStep){case"confirm":this.confirmationModal.setTitle(this.capitalizeText(this.deleteConfirmTitle));break;case"otp":this.confirmationModal.setTitle(this.capitalizeText(this.deleteOtpTitle));break;case"success":this.confirmationModal.setTitle(this.capitalizeText(this.deleteSuccessTitle))}}openDeleteModal(){this.currentStep="confirm",this.otpType="email",this.resetOtpInputs(),this.clearResendTimer(),this.updateModalForStep(),this.confirmationModal.open()}closeDeleteModal(){this.clearResendTimer(),this.confirmationModal?.close()}goBackFromOtp(){this.clearResendTimer(),this.resetOtpInputs(),this.resetOtpError(),this.currentStep="confirm",this.updateModalForStep()}async handleModalVisibilityChanged(e){if(e.detail)return;this.clearResendTimer();const t="success"===this.currentStep;t&&(this.isDeletePending=!0),this.currentStep="confirm",this.resetOtpInputs(),t&&await this.fetchDeleteRequestStatus()}formatResendTimer(e){return"00 : "+(e>=10?`${e}`:`0${e}`)}updateResendTimerDisplay(){this.timerEl&&(this.timerEl.innerHTML=this.formatResendTimer(this.resendAfter))}isDeleteRequestInFlight(){return this.isSubmitting||this.isSwitchingChannel||this.isVerifyingOtp}async initiateDeleteRequest(e="confirm"){if(!this.isDeleteRequestInFlight()){"switch"===e||"resend"===e?this.isSwitchingChannel=!0:this.isSubmitting=!0;try{await salla.profile.initiateDeleteRequest(this.otpType),this.currentStep="otp",this.updateModalForStep(),this.resetOtpInputs(),this.startResendTimer(),setTimeout((()=>this.otpInputs[0]?.focus()),100)}catch(e){salla.notify?.error?.(e.response?.data?.error?.message||salla.lang.get("common.errors.error_occurred"))}finally{"switch"===e||"resend"===e?this.isSwitchingChannel=!1:this.isSubmitting=!1}}}async switchOtpChannel(){this.isDeleteRequestInFlight()||(this.otpType="email"===this.otpType?"mobile":"email",await this.initiateDeleteRequest("switch"))}async resendOtp(){this.showResendLink&&!this.isDeleteRequestInFlight()&&await this.initiateDeleteRequest("resend")}collectOtpCode(){const e=salla.helpers.number(this.otpInputs.map((e=>e?.value||"")).join(""),!0).replace(/[^0-9]/g,"");return this.hiddenCodeInput&&(this.hiddenCodeInput.value=e),e}resetOtpError(){this.otpHasError=!1,this.otpErrorMessage=""}setOtpError(e){this.otpHasError=!0,this.otpErrorMessage=e}async verifyDeleteOtp(){if(this.isVerifyingOtp||this.isSwitchingChannel)return;const e=this.collectOtpCode();if(e.length<4)return this.setOtpError(salla.lang.get("pages.profile.delete_account_otp_required")),void this.otpInputs[e.length]?.focus();this.resetOtpError(),this.isVerifyingOtp=!0;try{const t=await salla.profile.verifyDeleteRequest({type:this.otpType,code:e});this.deleteSuccessMessage=t?.data?.message||salla.lang.get("pages.profile.delete_account_success_message"),this.clearResendTimer(),this.resetOtpInputs(),this.otpInputs=[],this.currentStep="success",this.updateModalForStep()}catch(e){this.setOtpError(e.response?.data?.error?.message||salla.lang.get("common.errors.error_occurred")),this.resetOtpInputs()}finally{this.isVerifyingOtp=!1}}async confirmSuccess(){this.isDeletePending=!0,this.closeDeleteModal(),this.currentStep="confirm",await this.fetchDeleteRequestStatus()}async cancelDeleteRequest(){if(!this.isSubmitting){this.isSubmitting=!0;try{const e=(await salla.profile.cancelDeleteRequest()).message||salla.lang.get("pages.profile.delete_request_cancelled");this.isDeletePending=!1,salla.notify?.success?.(e)}catch(e){salla.notify?.error?.(e.response?.data?.error?.message||salla.lang.get("common.errors.error_occurred"))}finally{this.isSubmitting=!1}}}resetOtpInputs(){this.otpInputs.forEach((e=>{e&&(e.value="")})),this.hiddenCodeInput&&(this.hiddenCodeInput.value="")}modifyNextOtpInput(e,t){e.value=t[0],t=t.substring(1),e.nextElementSibling&&t.length?this.modifyNextOtpInput(e.nextElementSibling,t):e.nextElementSibling||0!==t.length?e.nextElementSibling&&0===t.length&&e.nextElementSibling.focus():e.focus()}splitOtpNumber(e){const t=salla.helpers.number(e.data||e.target.value||"",!0).replace(/[^0-9]/g,"");t&&1!==t.length&&this.modifyNextOtpInput(e.target,t)}allOtpInputsFilled(){return this.otpInputs.every((e=>e?.value))}handleOtpInput(e){this.resetOtpError(),e.target.value=salla.helpers.number(e.target.value||"",!0),salla.helpers.inputDigitsOnly(e.target),this.allOtpInputsFilled()&&setTimeout((()=>this.verifyDeleteOtp()),100)}handleOtpKeyUp(e){if(this.resetOtpError(),["Alt","Shift","Control","AltGraph","Ctrl"].includes(e.key))return;const t=e.keyCode||e.charCode;e.target.value?(e.target.nextElementSibling?.focus(),e.target.nextElementSibling?.select()):[8,46].includes(t)&&(e.target.previousElementSibling?.focus(),e.target.previousElementSibling?.select()),e.target.value.length>1&&this.splitOtpNumber(e)}handleOtpPaste(e){this.resetOtpError();const t=salla.helpers.number(e.clipboardData.getData("text")||"",!0).replace(/[^0-9]/g,"").substring(0,this.otpInputs.length);this.otpInputs.forEach((e=>e.value="")),this.otpInputs[0]&&this.modifyNextOtpInput(this.otpInputs[0],t)}handleOtpFocus(e){e.target!==this.otpInputs[0]&&(""===this.otpInputs[0]?.value&&this.otpInputs[0].focus(),""===e.target.previousElementSibling?.value&&e.target.previousElementSibling.focus())}startResendTimer(){this.clearResendTimer(),this.resendAfter=30,this.showResendLink=!1,this.updateResendTimerDisplay(),this.resendTimerId=setInterval((()=>{if(this.resendAfter--,this.resendAfter<=0)return this.clearResendTimer(),void(this.showResendLink=!0);this.updateResendTimerDisplay()}),1e3)}clearResendTimer(){this.resendTimerId&&(clearInterval(this.resendTimerId),this.resendTimerId=null),this.showResendLink=!1}renderUserDeleteIcon(){return t("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"24",height:"24",color:"currentColor",fill:"none",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},t("path",{d:"M14.5 8C14.5 5.23858 12.2614 3 9.5 3C6.73858 3 4.5 5.23858 4.5 8C4.5 10.7614 6.73858 13 9.5 13C12.2614 13 14.5 10.7614 14.5 8Z"}),t("path",{d:"M15.5 21L18.5 18M18.5 18L21.5 15M18.5 18L15.5 15M18.5 18L21.5 21"}),t("path",{d:"M2.5 20C2.5 16.134 5.63401 13 9.5 13C10.775 13 11.9704 13.3409 13 13.9365"}))}renderConfirmStep(){return t("div",{class:"s-user-settings-delete-body"},t("p",{class:"s-user-settings-delete-warning"},this.deleteAccountWarning),t("div",{class:"s-user-settings-delete-actions s-user-settings-delete-actions--row"},t("salla-button",{width:"wide",fill:"outline",color:"danger",onClick:()=>this.closeDeleteModal()},this.capitalizeText(this.cancelLabel)),t("salla-button",{width:"wide",color:"primary",loading:this.isSubmitting,onClick:()=>this.initiateDeleteRequest()},this.capitalizeText(this.deleteAccount))))}renderOtpStep(){return t("div",{class:"s-user-settings-delete-body"},t("p",{class:"s-user-settings-delete-otp-instruction"},this.deleteOtpInstruction),t("p",{class:"s-user-settings-delete-otp-target"},this.getOtpTarget()),t("input",{type:"hidden",name:"code",maxlength:"4",ref:e=>this.hiddenCodeInput=e}),t("div",{class:{"s-user-settings-delete-otp-codes":!0,"has-error":this.otpHasError},dir:"ltr"},[1,2,3,4].map((e=>t("input",{type:"text",autocomplete:"one-time-code",pattern:"[0-9]*",inputmode:"numeric",maxlength:"1",id:`delete-otp-${e}`,class:{"s-user-settings-delete-otp-input":!0,"s-has-error":this.otpHasError},onInput:e=>this.handleOtpInput(e),onPaste:e=>this.handleOtpPaste(e),onKeyUp:e=>this.handleOtpKeyUp(e),onFocus:e=>this.handleOtpFocus(e),ref:t=>this.otpInputs[e-1]=t,required:!0})))),this.otpHasError&&this.otpErrorMessage?t("span",{class:"s-user-settings-delete-otp-error"},this.otpErrorMessage):"",t("div",{class:"s-user-settings-delete-actions s-user-settings-delete-actions--stack"},t("salla-button",{width:"wide",color:"primary",disabled:this.isSwitchingChannel,onClick:()=>this.verifyDeleteOtp()},this.capitalizeText(this.deleteConfirmOtp)),t("salla-button",{width:"wide",fill:"outline",color:"primary",disabled:this.isVerifyingOtp,onClick:()=>this.switchOtpChannel()},this.capitalizeText("email"===this.otpType?this.sendViaPhone:this.sendViaEmail))),t("p",{class:"s-user-settings-delete-otp-resend",style:{display:this.showResendLink?"none":"block"}},this.resendAfterLabel,t("b",{class:"s-user-settings-delete-otp-timer mx-1 font-bold",ref:e=>this.timerEl=e})),t("a",{href:"#",class:"s-user-settings-delete-otp-resend-link",style:{display:this.showResendLink?"block":"none"},onClick:e=>{e.preventDefault(),this.resendOtp()}},this.resendLabel))}renderSuccessStep(){return t("div",{class:"s-user-settings-delete-body"},t("p",{class:"s-user-settings-delete-success-body"},this.deleteSuccessMessage),t("div",{class:"s-user-settings-delete-actions s-user-settings-delete-actions--stack"},t("salla-button",{class:"s-user-settings-delete-success-btn",width:"wide",color:"primary",onClick:()=>this.confirmSuccess()},this.capitalizeText(this.okLabel))))}renderDeleteStep(){switch(this.currentStep){case"otp":return this.renderOtpStep();case"success":return this.renderSuccessStep();default:return this.renderConfirmStep()}}renderDeleteSectionAction(){return this.isDeletePending?t("salla-button",{fill:"outline",color:"danger",shape:"btn",size:"medium",width:"normal",loading:this.isSubmitting,onClick:()=>this.cancelDeleteRequest()},this.capitalizeText(this.cancelDeletionRequest)):t("salla-button",{fill:"outline",color:"danger",shape:"btn",size:"medium",width:"normal",onClick:()=>this.openDeleteModal()},this.capitalizeText(this.deleteAccount))}render(){return t(s,{key:"64356c5b57d826fce8c29cc319a9762464c7fe51",class:"s-user-settings-wrapper"},this.canHideName&&t("div",{key:"4f7b3eb703f89e4a758fca54ba1b214f6724aaea",class:"s-user-settings-section"},t("salla-list-tile",{key:"7ad109e36b278fe81a314d51e1ab68030dd96cdc"},t("div",{key:"c789b7e2c541e25aaaf336e052d1986f6429da71",slot:"icon",class:"s-user-settings-section-icon"},t("span",{key:"5d7b377aefb80139527d8814ee2c636fa9c73e0f",innerHTML:'\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>user-cancel</title>\n<path d="M29.885 16l1.724-1.724c0.521-0.521 0.521-1.364 0-1.885s-1.364-0.521-1.885 0l-1.724 1.724-1.724-1.724c-0.521-0.521-1.364-0.521-1.885 0s-0.521 1.364 0 1.885l1.724 1.724-1.724 1.724c-0.521 0.521-0.521 1.364 0 1.885 0.26 0.26 0.601 0.391 0.943 0.391s0.683-0.131 0.943-0.391l1.724-1.724 1.724 1.724c0.26 0.26 0.601 0.391 0.943 0.391s0.683-0.131 0.943-0.391c0.521-0.521 0.521-1.364 0-1.885zM10.667 16c4.043 0 7.333-3.289 7.333-7.333s-3.291-7.333-7.333-7.333-7.333 3.289-7.333 7.333 3.291 7.333 7.333 7.333zM10.667 4c2.573 0 4.667 2.093 4.667 4.667s-2.093 4.667-4.667 4.667-4.667-2.093-4.667-4.667 2.093-4.667 4.667-4.667zM10.667 18.667c-5.881 0-10.667 3.813-10.667 8.5v2.167c0 0.736 0.596 1.333 1.333 1.333s1.333-0.597 1.333-1.333v-2.167c0-3.217 3.588-5.833 8-5.833s8 2.616 8 5.833v2.167c0 0.736 0.596 1.333 1.333 1.333s1.333-0.597 1.333-1.333v-2.167c0-4.687-4.785-8.5-10.667-8.5z"></path>\n</svg>\n'})),t("div",{key:"fdb9d6130ef27cffbe4e2ef06e7b9155d0d04c2b",slot:"title",class:"s-user-settings-section-title"},this.capitalizeText(this.hideMyName)),t("div",{key:"bd8592a487c79926355eeea25a5e1429bca0fd80",slot:"subtitle",class:"s-user-settings-section-subtitle"},this.capitalizeText(this.hideMyNameDesc)),t("div",{key:"cf21ed12bb38dc3a613efac6d017a72aab38780b",slot:"action",class:"s-user-settings-section-action"},t("label",{key:"160140e25cf8e6c4556e52c0b36ba5769618b419",class:"s-toggle"},t("input",{key:"369a694fabbd42e6c239b23c26d68f858775ffe2",class:"s-toggle-input",checked:this.isHiddenName,onChange:e=>this.toggleSetting("is_hidden_name",e),type:"checkbox"}),t("div",{key:"5952ec01913ef95d888eeb3aace14123ffd3ef6f",class:"s-toggle-switcher"}))))),t("div",{key:"885355f8435759c9359a3d9eb95d5637b1c74751",class:"s-user-settings-section"},t("salla-list-tile",{key:"93b607850b20add5384a3b28e4e58fbfcb181d53"},t("div",{key:"c795aabfdc6df0beb9c0bfcf73ad87625eb7f51b",slot:"icon",class:"s-user-settings-section-icon"},t("span",{key:"a59ede027c4466a1e84e8e8b4c649c7b418dd0a3",innerHTML:'\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>bullhorn</title>\n<path d="M30.129 0.264c-0.339-0.252-0.776-0.328-1.179-0.208l-24.951 7.485v-0.216c0-0.736-0.597-1.333-1.333-1.333s-1.333 0.597-1.333 1.333v14.667c0 0.736 0.597 1.333 1.333 1.333s1.333-0.597 1.333-1.333v-0.112l3.448 1.207-0.595 1.704c-0.321 1.019-0.227 2.103 0.267 3.051s1.327 1.647 2.345 1.968l6.359 2.004c0.399 0.127 0.804 0.187 1.201 0.187 1.699 0 3.277-1.091 3.812-2.785l0.423-1.295 7.633 2.672c0.143 0.049 0.292 0.075 0.44 0.075 0.273 0 0.543-0.084 0.772-0.247 0.352-0.249 0.561-0.655 0.561-1.087v-28c0-0.421-0.199-0.819-0.537-1.069zM18.297 28.4c-0.221 0.701-0.973 1.089-1.673 0.871l-6.357-2.004c-0.34-0.108-0.617-0.34-0.781-0.656s-0.196-0.676-0.101-0.977l0.581-1.665 8.777 3.072zM28 27.453l-24-8.4v-8.728l24-7.2z"></path>\n</svg>\n'})),t("div",{key:"e7af96b6f919a8be8bb126237cb3977e72a7c089",slot:"title",class:"s-user-settings-section-title"},this.capitalizeText(this.promotionalMsgs)),t("div",{key:"dab7b270443b6eddccd7df739c2bee82eb7706af",slot:"subtitle",class:"s-user-settings-section-subtitle"},this.capitalizeText(this.promotionalMsgsDesc)),t("div",{key:"56a6f18c788891fe9215a57d0fcaa5cf98bd3aa5",slot:"action",class:"s-user-settings-section-action"},t("label",{key:"1fc28780fe779099eaed7916f31cbbb681c10fe9",class:"s-toggle"},t("input",{key:"832edd6e5b806171bb913163b7d5c19dbb0833f5",class:"s-toggle-input",checked:this.isNotifiable,onChange:e=>this.toggleSetting("is_notifiable",e),type:"checkbox"}),t("div",{key:"54260d8cca19ca6914cdd3bf15093b9669fef44a",class:"s-toggle-switcher"}))))),t("div",{key:"549bae1159a55b035952a12c8dc9d2b9d660f5bf",class:"s-user-settings-section s-user-settings-section-delete-user"},t("salla-list-tile",{key:"7969327e863cd998a120f27d61621d83ef8e57d5"},t("div",{key:"acf14b5e6ce76657fe0016aa63e26851e7688cd5",slot:"icon",class:"s-user-settings-section-icon"},this.renderUserDeleteIcon()),t("div",{key:"4a38cf9d0510e784317b0eb4db2fd4589a9f71d4",slot:"title",class:"s-user-settings-section-title"},this.capitalizeText(this.deleteAccount)),t("div",{key:"054f6a6c30f2eb9794f83a0998f20e208c7ed85a",slot:"subtitle",class:"s-user-settings-section-subtitle"},this.capitalizeText(this.isDeletePending?this.deleteAccountPending:this.deleteAccountDesc)),t("div",{key:"00d392a300b986d5d3e6f6711e6996df9731962d",slot:"action",class:"s-user-settings-section-action"},this.renderDeleteSectionAction()))),t("salla-modal",{key:"d4e8006e57d9c35267177f07b60e510ea3e53400",id:"salla-user-settings-delete-modal",width:"xs",centered:!0,showBack:"otp"===this.currentStep,isClosable:"success"!==this.currentStep,iconStyle:"success"===this.currentStep?"success":void 0,onModalVisibilityChanged:e=>this.handleModalVisibilityChanged(e),onModalBack:()=>this.goBackFromOtp(),ref:e=>this.confirmationModal=e},"success"!==this.currentStep?t("span",{slot:"icon",class:"s-user-settings-delete-icon"},this.renderUserDeleteIcon()):null,t("div",{key:this.currentStep,class:"s-user-settings-delete-step"},this.renderDeleteStep())))}};i.style='/*!twlt*/.s-modal-header-inner{display:flex;flex-direction:column !important;align-items:center !important;justify-content:center !important}.s-modal-header-content{text-align:center !important}.s-user-settings-delete-body{text-align:center}.s-user-settings-delete-icon{display:inline-flex;align-items:center;justify-content:center;width:4rem;height:4rem;border-radius:9999px;border:1px solid var(--infinte-color);color:var(--infinte-color);margin:0 auto 1rem}.s-user-settings-delete-icon svg{width:1.5rem;height:1.5rem}.s-user-settings-delete-warning{color:#6b7280;font-size:0.875rem;line-height:1.625;margin-bottom:1.25rem}.s-user-settings-delete-actions--row{display:flex;gap:0.75rem;justify-content:center}.s-user-settings-delete-actions--row salla-button{flex:1}.s-user-settings-delete-actions--stack{display:flex;flex-direction:column;gap:0.75rem;margin-top:1.25rem}.s-user-settings-delete-otp-instruction{color:#6b7280;font-size:0.875rem}.s-user-settings-delete-otp-target{color:#6b7280;direction:ltr;margin-bottom:1.25rem}.s-user-settings-delete-otp-codes{display:flex;justify-content:stretch;gap:0.75rem;direction:ltr;margin-bottom:0.75rem;width:100%}.s-user-settings-delete-otp-codes.has-error{margin-bottom:0}.s-user-settings-delete-otp-input{flex:1 1 0;min-width:0;width:100%;height:3.5rem;text-align:center;border:1px solid #d1d5db;border-radius:0.5rem;font-size:1.25rem;font-weight:600;color:#111827;outline:none}.s-user-settings-delete-otp-input:focus{border-color:#004956;box-shadow:0 0 0 1px #004956}.s-user-settings-delete-otp-input.s-has-error{border-color:#ef4444 !important}.s-user-settings-delete-otp-input.s-has-error:focus{border-color:#ef4444 !important;box-shadow:0 0 0 1px #ef4444}.s-user-settings-delete-otp-input::-webkit-outer-spin-button,.s-user-settings-delete-otp-input::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}.s-user-settings-delete-otp-input[type=text]{-moz-appearance:textfield}.s-user-settings-delete-otp-error{display:block;color:#ef4444;font-size:0.75rem;text-align:center;padding-top:0.75rem;margin-bottom:1.25rem}.s-user-settings-delete-otp-resend{color:#6b7280;font-size:0.75rem;margin-top:1rem;text-align:center}.s-user-settings-delete-otp-timer{font-weight:600;direction:ltr;display:inline-block}.s-user-settings-delete-otp-resend-link{display:block;color:#004956;font-size:0.875rem;margin-top:1rem;text-align:center;text-decoration:underline;cursor:pointer}.s-user-settings-delete-success-body{color:#6b7280;font-size:0.875rem;line-height:1.625;margin-bottom:1.25rem}.s-user-settings-delete-success-btn{--s-button-color:#004956}.mx-1{margin-left:0.25rem;margin-right:0.25rem}.block{display:block}.hidden{display:none}.font-bold{font-weight:700}.outline{outline-style:solid}.s-has-error{--tw-border-opacity:1;border-color:rgb(248 113 113 / var(--tw-border-opacity, 1))}.s-has-error:focus{--tw-border-opacity:1;border-color:rgb(239 68 68 / var(--tw-border-opacity, 1))}.btn{display:inline-flex;flex:1 1 0%;align-items:center;justify-content:center;white-space:nowrap;border-radius:0.375rem;padding-left:1.5rem;padding-right:1.5rem;padding-bottom:0.625rem;padding-top:0.5rem;font-size:0.875rem;line-height:1.25rem;font-weight:700;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:300ms}.btn:hover{opacity:0.8}.has-error .s-form-label{color:#ff443a}.has-error .s-form-control,.has-error .s-tel-input-control,.has-error .s-datetime-picker-input{border-color:#ff443a;color:#ff443a}.toggle-checkbox .s-toggle-input{position:absolute;visibility:hidden}.toggle-checkbox .s-toggle-switcher{display:inline-block;background:#ccc;border-radius:16px;width:40px;height:25px;position:relative;vertical-align:middle;transition:background 0.25s}.toggle-checkbox .s-toggle-switcher:before,.toggle-checkbox .s-toggle-switcher:after{content:""}.toggle-checkbox .s-toggle-switcher:before{display:block;background:#fff;border-radius:50%;box-shadow:0 0 0 1px rgba(0,0,0,0.25);width:20px;height:21px;position:absolute;top:2.2px;left:1px;transition:left 0.25s}.toggle-checkbox .s-toggle-input:checked+div{background:#30D158}.toggle-checkbox .s-toggle-input:checked+div:before{left:18px}.s-has-error{--tw-border-opacity:1 !important;border-color:rgb(239 68 68 / var(--tw-border-opacity, 1)) !important;--tw-text-opacity:1 !important;color:rgb(239 68 68 / var(--tw-text-opacity, 1)) !important}.s-toggle{cursor:pointer;display:inline-block}.s-toggle .s-toggle-input{position:absolute;visibility:hidden}.s-toggle .s-toggle-label{margin-left:5px;position:relative;top:2px}.s-toggle .s-toggle-switcher{display:inline-block;background:#ccc;border-radius:16px;width:40px;height:25px;position:relative;vertical-align:middle;transition:background 0.25s}.s-toggle .s-toggle-switcher:before,.s-toggle .s-toggle-switcher:after{content:""}.s-toggle .s-toggle-switcher:before{display:block;background:#fff;border-radius:50%;box-shadow:0 0 0 1px rgba(0,0,0,0.25);width:20px;height:21px;position:absolute;top:2.2px;left:1px;transition:left 0.25s}.s-toggle .s-toggle-input:checked+div{background:#30D158}.s-toggle .s-toggle-input:checked+div:before{left:18px}.s-user-settings-section{border-bottom-width:1px;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1));--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.s-user-settings-section:first-child{border-bottom-right-radius:0px;border-bottom-left-radius:0px;border-top-left-radius:0.375rem;border-top-right-radius:0.375rem}.s-user-settings-section:last-child{border-bottom-right-radius:0.375rem;border-bottom-left-radius:0.375rem;border-top-left-radius:0px;border-top-right-radius:0px;border-bottom-width:0px}.s-user-settings-section .s-list-tile-item{align-items:flex-start;background-color:transparent;padding:1.25rem}@media (min-width: 768px){.s-user-settings-section .s-list-tile-item{align-items:center}}.s-user-settings-section .s-list-tile-item-action{margin-left:auto}.s-user-settings-section .s-list-tile-item-action:where([dir="rtl"],[dir="rtl"] *){margin-right:auto;margin-left:0px}.s-user-settings-section .s-list-tile-item-action button{width:100%;padding:10px}.s-user-settings-section-delete-user .s-list-tile-item{flex-wrap:wrap}@media (min-width: 768px){.s-user-settings-section-delete-user .s-list-tile-item{flex-wrap:nowrap}}.s-user-settings-section-delete-user .s-list-tile-item-icon{position:relative;top:5px}@media (min-width: 768px){.s-user-settings-section-delete-user .s-list-tile-item-icon{top:0px}}@media (max-width: 768px){.s-user-settings-section-delete-user .s-list-tile-item-content{flex:1 0 85%}.s-user-settings-section-delete-user .s-list-tile-item-action{flex:1 1 100%;margin-top:1rem}}.s-user-settings-section-title{font-size:1rem;line-height:1.5rem;--tw-text-opacity:1;color:rgb(17 24 39 / var(--tw-text-opacity, 1))}.s-user-settings-section-subtitle{font-size:0.75rem;line-height:1rem;--tw-text-opacity:1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.s-user-settings-section-icon svg{height:1.25rem;width:1.25rem}.s-user-settings-confirmation{text-align:center}.s-user-settings-confirmation svg{text-align:center}.s-user-settings-confirmation-icon{display:inline-flex;height:3rem;width:3rem;align-items:center;justify-content:center;border-radius:9999px;border-width:1px;border-style:solid;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1))}@media (min-width: 640px){.s-user-settings-confirmation-icon{margin-left:auto;margin-right:auto;margin-bottom:1rem;height:5rem;width:5rem}}.s-user-settings-confirmation-icon:where([dir="ltr"],[dir="ltr"] *){margin-right:0.5rem}@media (min-width: 640px){.s-user-settings-confirmation-icon:where([dir="ltr"],[dir="ltr"] *){margin-right:0px}}.s-user-settings-confirmation-icon:where([dir="rtl"],[dir="rtl"] *){margin-left:0.5rem}@media (min-width: 640px){.s-user-settings-confirmation-icon:where([dir="rtl"],[dir="rtl"] *){margin-left:0px}}.s-user-settings-confirmation-icon svg{height:1.25rem;width:1.25rem;flex-shrink:0;fill:#9ca3af}.s-user-settings-confirmation-warning{font-size:0.75rem;line-height:1rem;--tw-text-opacity:1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.s-user-settings-confirmation-actions{margin-top:1.25rem;display:flex;align-items:center;justify-content:space-between}.s-user-settings-confirmation-actions>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-right:calc(1.25rem * var(--tw-space-x-reverse));margin-left:calc(1.25rem * calc(1 - var(--tw-space-x-reverse)))}.s-user-settings-confirmation-actions:where([dir="rtl"],[dir="rtl"] *)>:not([hidden])~:not([hidden]){--tw-space-x-reverse:1}';export{i as salla_user_settings}
4
+ import{r as e,h as t,H as s}from"./p-Bf2Z6A1M.js";const i=class{constructor(t){e(this,t),this.otpInputs=[],this.deletePendingDays=null,this.currentStep="confirm",this.isDeletePending=!1,this.otpType="email",this.otpHasError=!1,this.otpErrorMessage="",this.isSubmitting=!1,this.isVerifyingOtp=!1,this.isSwitchingChannel=!1,this.resendAfter=30,this.showResendLink=!1,this.canHideName=salla.config.get("store.settings.rating.can_customer_hide_name"),this.translationDefaults={"pages.profile.delete_account":{ar:"حذف الحساب",en:"Delete account"},"pages.profile.delete_account_description":{ar:"سيُحذف حسابك وبياناتك من المتجر نهائيًا، بما في ذلك سجل طلباتك.",en:"Your account and data will be permanently deleted from the store, including your order history."},"pages.profile.delete_account_confirm_title":{ar:"هل تريد حذف حسابك؟",en:"Do you want to delete your account?"},"pages.profile.delete_account_warning":{ar:"بعد الحذف، ستفقد الوصول إلى بياناتك، بما في ذلك سجل الطلبات، وقائمة الأمنيات، وأي نقاط ولاء أو رصيد متاح في المحفظة.",en:"After deletion, you will lose access to your data, including order history, wishlist, and any loyalty points or wallet balance."},"pages.profile.cancel":{ar:"إلغاء",en:"Cancel"},"pages.profile.delete_account_otp_title":{ar:"تأكيد حذف الحساب",en:"Confirm account deletion"},"pages.profile.delete_account_otp_instruction":{ar:"للمتابعة، أدخل رمز التحقٌّق المرسل إلى:",en:"To continue, enter the verification code sent to:"},"pages.profile.delete_account_confirm_otp":{ar:"تأكيد الحذف",en:"Confirm deletion"},"pages.profile.delete_account_otp_required":{ar:"يرجى إدخال رمز التحقٌّق",en:"Please enter the verification code"},"pages.profile.delete_account_send_via_phone":{ar:"إرسال عبر الهاتف",en:"Send via phone"},"pages.profile.delete_account_send_via_email":{ar:"إرسال عبر البريد الإلكتروني",en:"Send via email"},"pages.profile.delete_account_success_title":{ar:"أُرسل طلب حذف الحساب",en:"Account deletion request submitted"},"pages.profile.delete_account_success_message":{ar:"سيُحذف حسابك خلال 30 يومًا. يمكنك إلغاء الطلب بتسجيل الدخول مرة أخرى قبل اكتمال الحذف.",en:"Your account will be deleted within 30 days. You can cancel the request by signing in again before deletion is complete."},"pages.profile.ok":{ar:"موافق",en:"OK"},"pages.profile.cancel_deletion_request":{ar:"تراجع عن الحذف",en:"Withdraw deletion"},"pages.profile.delete_account_pending":{ar:"حسابك مجدول للحذف نهائيًا من المتجر خلال :days يومًا. يمكنك التراجع عن الحذف قبل انقضاء المدة.",en:"Your account will be deleted permanently from the store within :days days. You can withdraw the deletion before the deadline."},"pages.profile.delete_request_cancelled":{ar:"تم إلغاء طلب الحذف",en:"Deletion request cancelled"}},this.registerTranslationDefaults(),this.loadTranslations(),salla.onReady((()=>{this.isHiddenName=salla.config.get("user.is_hidden_name"),this.isNotifiable=salla.config.get("user.is_notifiable"),this.canHideName=salla.config.get("store.settings.rating.can_customer_hide_name"),this.fetchDeleteRequestStatus(),this.isNotifiable&&this.isHiddenName||salla.event.on("profile::info.fetched",(e=>{this.isHiddenName=e.data.is_hidden_name,this.isNotifiable=e.data.is_notifiable}))})),salla.lang.onLoaded((()=>{this.registerTranslationDefaults(),this.loadTranslations()}))}getDaysUntilExecution(e){return Math.max(0,Math.ceil(((e>1e12?e:1e3*e)-Date.now())/864e5))}applyPendingMessage(){const e=salla.lang.get("pages.profile.delete_account_pending");this.deleteAccountPending=null!=this.deletePendingDays?e.replace(/:days/g,String(salla.helpers.number(this.deletePendingDays))):e}async fetchDeleteRequestStatus(){try{const e=await salla.profile.getDeleteRequest(),t=e?.data??null,s=t?.data_request||t,i=s?.status;this.isDeletePending="pending"===i;const r=s?.execution_at;this.deletePendingDays=null==r||Number.isNaN(Number(r))?null:this.getDaysUntilExecution(Number(r)),this.applyPendingMessage()}catch{}}registerTranslationDefaults(){if(!salla?.lang?.addBulk)return;const e=Object.entries(this.translationDefaults).reduce(((e,[t,s])=>(salla.lang.get(t)===t&&(e[t]=s),e)),{});Object.keys(e).length&&salla.lang.addBulk(e)}loadTranslations(){this.deleteAccount=salla.lang.get("pages.profile.delete_account"),this.deleteAccountDesc=salla.lang.get("pages.profile.delete_account_description"),this.deleteConfirmTitle=salla.lang.get("pages.profile.delete_account_confirm_title"),this.deleteAccountWarning=salla.lang.get("pages.profile.delete_account_warning"),this.cancelLabel=salla.lang.get("pages.profile.cancel"),this.deleteOtpTitle=salla.lang.get("pages.profile.delete_account_otp_title"),this.deleteOtpInstruction=salla.lang.get("pages.profile.delete_account_otp_instruction"),this.deleteConfirmOtp=salla.lang.get("pages.profile.delete_account_confirm_otp"),this.sendViaPhone=salla.lang.get("pages.profile.delete_account_send_via_phone"),this.sendViaEmail=salla.lang.get("pages.profile.delete_account_send_via_email"),this.deleteSuccessTitle=salla.lang.get("pages.profile.delete_account_success_title"),this.deleteSuccessMessage=salla.lang.get("pages.profile.delete_account_success_message"),this.okLabel=salla.lang.get("pages.profile.ok"),this.cancelDeletionRequest=salla.lang.get("pages.profile.cancel_deletion_request"),this.applyPendingMessage(),this.resendAfterLabel=salla.lang.get("blocks.header.resend_after"),this.resendLabel=salla.lang.get("blocks.comments.submit"),this.promotionalMsgs=salla.lang.get("pages.profile.promotional_messages"),this.hideMyName=salla.lang.get("pages.profile.hide_my_name"),this.hideMyNameDesc=salla.lang.get("pages.profile.hide_my_name_desc"),this.promotionalMsgsDesc=salla.lang.get("pages.profile.promotional_messages_description")}toggleSetting(e,t){salla.profile.updateSettings({name:e,value:t.target.checked})}capitalizeText(e){return e?e.charAt(0).toUpperCase()+e.slice(1):""}getOtpTarget(){return"email"===this.otpType?salla.config.get("user.email")||"":salla.config.get("user.mobile")||""}updateModalForStep(){if(this.confirmationModal)switch(this.currentStep){case"confirm":this.confirmationModal.setTitle(this.capitalizeText(this.deleteConfirmTitle));break;case"otp":this.confirmationModal.setTitle(this.capitalizeText(this.deleteOtpTitle));break;case"success":this.confirmationModal.setTitle(this.capitalizeText(this.deleteSuccessTitle))}}openDeleteModal(){this.currentStep="confirm",this.otpType="email",this.resetOtpInputs(),this.clearResendTimer(),this.updateModalForStep(),this.confirmationModal.open()}closeDeleteModal(){this.clearResendTimer(),this.confirmationModal?.close()}goBackFromOtp(){this.clearResendTimer(),this.resetOtpInputs(),this.resetOtpError(),this.currentStep="confirm",this.updateModalForStep()}async handleModalVisibilityChanged(e){if(e.detail)return;this.clearResendTimer();const t="success"===this.currentStep;t&&(this.isDeletePending=!0),this.currentStep="confirm",this.resetOtpInputs(),t&&await this.fetchDeleteRequestStatus()}formatResendTimer(e){return"00 : "+(e>=10?`${e}`:`0${e}`)}updateResendTimerDisplay(){this.timerEl&&(this.timerEl.innerHTML=this.formatResendTimer(this.resendAfter))}isDeleteRequestInFlight(){return this.isSubmitting||this.isSwitchingChannel||this.isVerifyingOtp}async initiateDeleteRequest(e="confirm"){if(!this.isDeleteRequestInFlight()){"switch"===e||"resend"===e?this.isSwitchingChannel=!0:this.isSubmitting=!0;try{await salla.profile.initiateDeleteRequest(this.otpType),this.currentStep="otp",this.updateModalForStep(),this.resetOtpInputs(),this.startResendTimer(),setTimeout((()=>this.otpInputs[0]?.focus()),100)}catch(e){salla.notify?.error?.(e.response?.data?.error?.message||salla.lang.get("common.errors.error_occurred"))}finally{"switch"===e||"resend"===e?this.isSwitchingChannel=!1:this.isSubmitting=!1}}}async switchOtpChannel(){this.isDeleteRequestInFlight()||(this.otpType="email"===this.otpType?"mobile":"email",await this.initiateDeleteRequest("switch"))}async resendOtp(){this.showResendLink&&!this.isDeleteRequestInFlight()&&await this.initiateDeleteRequest("resend")}collectOtpCode(){const e=salla.helpers.number(this.otpInputs.map((e=>e?.value||"")).join(""),!0).replace(/[^0-9]/g,"");return this.hiddenCodeInput&&(this.hiddenCodeInput.value=e),e}resetOtpError(){this.otpHasError=!1,this.otpErrorMessage=""}setOtpError(e){this.otpHasError=!0,this.otpErrorMessage=e}async verifyDeleteOtp(){if(this.isVerifyingOtp||this.isSwitchingChannel)return;const e=this.collectOtpCode();if(e.length<4)return this.setOtpError(salla.lang.get("pages.profile.delete_account_otp_required")),void this.otpInputs[e.length]?.focus();this.resetOtpError(),this.isVerifyingOtp=!0;try{const t=await salla.profile.verifyDeleteRequest({type:this.otpType,code:e});this.deleteSuccessMessage=t?.data?.message||salla.lang.get("pages.profile.delete_account_success_message"),this.clearResendTimer(),this.resetOtpInputs(),this.otpInputs=[],this.currentStep="success",this.updateModalForStep()}catch(e){this.setOtpError(e.response?.data?.error?.message||salla.lang.get("common.errors.error_occurred")),this.resetOtpInputs()}finally{this.isVerifyingOtp=!1}}async confirmSuccess(){this.isDeletePending=!0,this.closeDeleteModal(),this.currentStep="confirm",await this.fetchDeleteRequestStatus()}async cancelDeleteRequest(){if(!this.isSubmitting){this.isSubmitting=!0;try{const e=(await salla.profile.cancelDeleteRequest()).message||salla.lang.get("pages.profile.delete_request_cancelled");this.isDeletePending=!1,salla.notify?.success?.(e)}catch(e){salla.notify?.error?.(e.response?.data?.error?.message||salla.lang.get("common.errors.error_occurred"))}finally{this.isSubmitting=!1}}}resetOtpInputs(){this.otpInputs.forEach((e=>{e&&(e.value="")})),this.hiddenCodeInput&&(this.hiddenCodeInput.value="")}modifyNextOtpInput(e,t){e.value=t[0],t=t.substring(1),e.nextElementSibling&&t.length?this.modifyNextOtpInput(e.nextElementSibling,t):e.nextElementSibling||0!==t.length?e.nextElementSibling&&0===t.length&&e.nextElementSibling.focus():e.focus()}splitOtpNumber(e){const t=salla.helpers.number(e.data||e.target.value||"",!0).replace(/[^0-9]/g,"");t&&1!==t.length&&this.modifyNextOtpInput(e.target,t)}allOtpInputsFilled(){return this.otpInputs.every((e=>e?.value))}handleOtpInput(e){this.resetOtpError(),e.target.value=salla.helpers.number(e.target.value||"",!0),salla.helpers.inputDigitsOnly(e.target),this.allOtpInputsFilled()&&setTimeout((()=>this.verifyDeleteOtp()),100)}handleOtpKeyUp(e){if(this.resetOtpError(),["Alt","Shift","Control","AltGraph","Ctrl"].includes(e.key))return;const t=e.keyCode||e.charCode;e.target.value?(e.target.nextElementSibling?.focus(),e.target.nextElementSibling?.select()):[8,46].includes(t)&&(e.target.previousElementSibling?.focus(),e.target.previousElementSibling?.select()),e.target.value.length>1&&this.splitOtpNumber(e)}handleOtpPaste(e){this.resetOtpError();const t=salla.helpers.number(e.clipboardData.getData("text")||"",!0).replace(/[^0-9]/g,"").substring(0,this.otpInputs.length);this.otpInputs.forEach((e=>e.value="")),this.otpInputs[0]&&this.modifyNextOtpInput(this.otpInputs[0],t)}handleOtpFocus(e){e.target!==this.otpInputs[0]&&(""===this.otpInputs[0]?.value&&this.otpInputs[0].focus(),""===e.target.previousElementSibling?.value&&e.target.previousElementSibling.focus())}startResendTimer(){this.clearResendTimer(),this.resendAfter=30,this.showResendLink=!1,this.updateResendTimerDisplay(),this.resendTimerId=setInterval((()=>{if(this.resendAfter--,this.resendAfter<=0)return this.clearResendTimer(),void(this.showResendLink=!0);this.updateResendTimerDisplay()}),1e3)}clearResendTimer(){this.resendTimerId&&(clearInterval(this.resendTimerId),this.resendTimerId=null),this.showResendLink=!1}renderUserDeleteIcon(){return t("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"24",height:"24",color:"currentColor",fill:"none",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},t("path",{d:"M14.5 8C14.5 5.23858 12.2614 3 9.5 3C6.73858 3 4.5 5.23858 4.5 8C4.5 10.7614 6.73858 13 9.5 13C12.2614 13 14.5 10.7614 14.5 8Z"}),t("path",{d:"M15.5 21L18.5 18M18.5 18L21.5 15M18.5 18L15.5 15M18.5 18L21.5 21"}),t("path",{d:"M2.5 20C2.5 16.134 5.63401 13 9.5 13C10.775 13 11.9704 13.3409 13 13.9365"}))}renderConfirmStep(){return t("div",{class:"s-user-settings-delete-body"},t("p",{class:"s-user-settings-delete-warning"},this.deleteAccountWarning),t("div",{class:"s-user-settings-delete-actions s-user-settings-delete-actions--row"},t("salla-button",{width:"wide",fill:"outline",color:"danger",onClick:()=>this.closeDeleteModal()},this.capitalizeText(this.cancelLabel)),t("salla-button",{width:"wide",color:"primary",loading:this.isSubmitting,onClick:()=>this.initiateDeleteRequest()},this.capitalizeText(this.deleteAccount))))}renderOtpStep(){return t("div",{class:"s-user-settings-delete-body"},t("p",{class:"s-user-settings-delete-otp-instruction"},this.deleteOtpInstruction),t("p",{class:"s-user-settings-delete-otp-target"},this.getOtpTarget()),t("input",{type:"hidden",name:"code",maxlength:"4",ref:e=>this.hiddenCodeInput=e}),t("div",{class:{"s-user-settings-delete-otp-codes":!0,"has-error":this.otpHasError},dir:"ltr"},[1,2,3,4].map((e=>t("input",{type:"text",autocomplete:"one-time-code",pattern:"[0-9]*",inputmode:"numeric",maxlength:"1",id:`delete-otp-${e}`,class:{"s-user-settings-delete-otp-input":!0,"s-has-error":this.otpHasError},onInput:e=>this.handleOtpInput(e),onPaste:e=>this.handleOtpPaste(e),onKeyUp:e=>this.handleOtpKeyUp(e),onFocus:e=>this.handleOtpFocus(e),ref:t=>this.otpInputs[e-1]=t,required:!0})))),this.otpHasError&&this.otpErrorMessage?t("span",{class:"s-user-settings-delete-otp-error"},this.otpErrorMessage):"",t("div",{class:"s-user-settings-delete-actions s-user-settings-delete-actions--stack"},t("salla-button",{width:"wide",color:"primary",disabled:this.isSwitchingChannel,onClick:()=>this.verifyDeleteOtp()},this.capitalizeText(this.deleteConfirmOtp)),t("salla-button",{width:"wide",fill:"outline",color:"primary",disabled:this.isVerifyingOtp,onClick:()=>this.switchOtpChannel()},this.capitalizeText("email"===this.otpType?this.sendViaPhone:this.sendViaEmail))),t("p",{class:"s-user-settings-delete-otp-resend",style:{display:this.showResendLink?"none":"block"}},this.resendAfterLabel,t("b",{class:"s-user-settings-delete-otp-timer mx-1 font-bold",ref:e=>this.timerEl=e})),t("a",{href:"#",class:"s-user-settings-delete-otp-resend-link",style:{display:this.showResendLink?"block":"none"},onClick:e=>{e.preventDefault(),this.resendOtp()}},this.resendLabel))}renderSuccessStep(){return t("div",{class:"s-user-settings-delete-body"},t("p",{class:"s-user-settings-delete-success-body"},this.deleteSuccessMessage),t("div",{class:"s-user-settings-delete-actions s-user-settings-delete-actions--stack"},t("salla-button",{class:"s-user-settings-delete-success-btn",width:"wide",color:"primary",onClick:()=>this.confirmSuccess()},this.capitalizeText(this.okLabel))))}renderDeleteStep(){switch(this.currentStep){case"otp":return this.renderOtpStep();case"success":return this.renderSuccessStep();default:return this.renderConfirmStep()}}renderDeleteSectionAction(){return this.isDeletePending?t("salla-button",{fill:"outline",color:"danger",shape:"btn",size:"medium",width:"normal",loading:this.isSubmitting,onClick:()=>this.cancelDeleteRequest()},this.capitalizeText(this.cancelDeletionRequest)):t("salla-button",{fill:"outline",color:"danger",shape:"btn",size:"medium",width:"normal",onClick:()=>this.openDeleteModal()},this.capitalizeText(this.deleteAccount))}render(){return t(s,{key:"64356c5b57d826fce8c29cc319a9762464c7fe51",class:"s-user-settings-wrapper"},this.canHideName&&t("div",{key:"4f7b3eb703f89e4a758fca54ba1b214f6724aaea",class:"s-user-settings-section"},t("salla-list-tile",{key:"7ad109e36b278fe81a314d51e1ab68030dd96cdc"},t("div",{key:"c789b7e2c541e25aaaf336e052d1986f6429da71",slot:"icon",class:"s-user-settings-section-icon"},t("span",{key:"5d7b377aefb80139527d8814ee2c636fa9c73e0f",innerHTML:'\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>user-cancel</title>\n<path d="M29.885 16l1.724-1.724c0.521-0.521 0.521-1.364 0-1.885s-1.364-0.521-1.885 0l-1.724 1.724-1.724-1.724c-0.521-0.521-1.364-0.521-1.885 0s-0.521 1.364 0 1.885l1.724 1.724-1.724 1.724c-0.521 0.521-0.521 1.364 0 1.885 0.26 0.26 0.601 0.391 0.943 0.391s0.683-0.131 0.943-0.391l1.724-1.724 1.724 1.724c0.26 0.26 0.601 0.391 0.943 0.391s0.683-0.131 0.943-0.391c0.521-0.521 0.521-1.364 0-1.885zM10.667 16c4.043 0 7.333-3.289 7.333-7.333s-3.291-7.333-7.333-7.333-7.333 3.289-7.333 7.333 3.291 7.333 7.333 7.333zM10.667 4c2.573 0 4.667 2.093 4.667 4.667s-2.093 4.667-4.667 4.667-4.667-2.093-4.667-4.667 2.093-4.667 4.667-4.667zM10.667 18.667c-5.881 0-10.667 3.813-10.667 8.5v2.167c0 0.736 0.596 1.333 1.333 1.333s1.333-0.597 1.333-1.333v-2.167c0-3.217 3.588-5.833 8-5.833s8 2.616 8 5.833v2.167c0 0.736 0.596 1.333 1.333 1.333s1.333-0.597 1.333-1.333v-2.167c0-4.687-4.785-8.5-10.667-8.5z"></path>\n</svg>\n'})),t("div",{key:"fdb9d6130ef27cffbe4e2ef06e7b9155d0d04c2b",slot:"title",class:"s-user-settings-section-title"},this.capitalizeText(this.hideMyName)),t("div",{key:"bd8592a487c79926355eeea25a5e1429bca0fd80",slot:"subtitle",class:"s-user-settings-section-subtitle"},this.capitalizeText(this.hideMyNameDesc)),t("div",{key:"cf21ed12bb38dc3a613efac6d017a72aab38780b",slot:"action",class:"s-user-settings-section-action"},t("label",{key:"160140e25cf8e6c4556e52c0b36ba5769618b419",class:"s-toggle"},t("input",{key:"369a694fabbd42e6c239b23c26d68f858775ffe2",class:"s-toggle-input",checked:this.isHiddenName,onChange:e=>this.toggleSetting("is_hidden_name",e),type:"checkbox"}),t("div",{key:"5952ec01913ef95d888eeb3aace14123ffd3ef6f",class:"s-toggle-switcher"}))))),t("div",{key:"885355f8435759c9359a3d9eb95d5637b1c74751",class:"s-user-settings-section"},t("salla-list-tile",{key:"93b607850b20add5384a3b28e4e58fbfcb181d53"},t("div",{key:"c795aabfdc6df0beb9c0bfcf73ad87625eb7f51b",slot:"icon",class:"s-user-settings-section-icon"},t("span",{key:"a59ede027c4466a1e84e8e8b4c649c7b418dd0a3",innerHTML:'\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>bullhorn</title>\n<path d="M30.129 0.264c-0.339-0.252-0.776-0.328-1.179-0.208l-24.951 7.485v-0.216c0-0.736-0.597-1.333-1.333-1.333s-1.333 0.597-1.333 1.333v14.667c0 0.736 0.597 1.333 1.333 1.333s1.333-0.597 1.333-1.333v-0.112l3.448 1.207-0.595 1.704c-0.321 1.019-0.227 2.103 0.267 3.051s1.327 1.647 2.345 1.968l6.359 2.004c0.399 0.127 0.804 0.187 1.201 0.187 1.699 0 3.277-1.091 3.812-2.785l0.423-1.295 7.633 2.672c0.143 0.049 0.292 0.075 0.44 0.075 0.273 0 0.543-0.084 0.772-0.247 0.352-0.249 0.561-0.655 0.561-1.087v-28c0-0.421-0.199-0.819-0.537-1.069zM18.297 28.4c-0.221 0.701-0.973 1.089-1.673 0.871l-6.357-2.004c-0.34-0.108-0.617-0.34-0.781-0.656s-0.196-0.676-0.101-0.977l0.581-1.665 8.777 3.072zM28 27.453l-24-8.4v-8.728l24-7.2z"></path>\n</svg>\n'})),t("div",{key:"e7af96b6f919a8be8bb126237cb3977e72a7c089",slot:"title",class:"s-user-settings-section-title"},this.capitalizeText(this.promotionalMsgs)),t("div",{key:"dab7b270443b6eddccd7df739c2bee82eb7706af",slot:"subtitle",class:"s-user-settings-section-subtitle"},this.capitalizeText(this.promotionalMsgsDesc)),t("div",{key:"56a6f18c788891fe9215a57d0fcaa5cf98bd3aa5",slot:"action",class:"s-user-settings-section-action"},t("label",{key:"1fc28780fe779099eaed7916f31cbbb681c10fe9",class:"s-toggle"},t("input",{key:"832edd6e5b806171bb913163b7d5c19dbb0833f5",class:"s-toggle-input",checked:this.isNotifiable,onChange:e=>this.toggleSetting("is_notifiable",e),type:"checkbox"}),t("div",{key:"54260d8cca19ca6914cdd3bf15093b9669fef44a",class:"s-toggle-switcher"}))))),t("div",{key:"549bae1159a55b035952a12c8dc9d2b9d660f5bf",class:"s-user-settings-section s-user-settings-section-delete-user"},t("salla-list-tile",{key:"7969327e863cd998a120f27d61621d83ef8e57d5"},t("div",{key:"acf14b5e6ce76657fe0016aa63e26851e7688cd5",slot:"icon",class:"s-user-settings-section-icon"},this.renderUserDeleteIcon()),t("div",{key:"4a38cf9d0510e784317b0eb4db2fd4589a9f71d4",slot:"title",class:"s-user-settings-section-title"},this.capitalizeText(this.deleteAccount)),t("div",{key:"054f6a6c30f2eb9794f83a0998f20e208c7ed85a",slot:"subtitle",class:"s-user-settings-section-subtitle"},this.capitalizeText(this.isDeletePending?this.deleteAccountPending:this.deleteAccountDesc)),t("div",{key:"00d392a300b986d5d3e6f6711e6996df9731962d",slot:"action",class:"s-user-settings-section-action"},this.renderDeleteSectionAction()))),t("salla-modal",{key:"d4e8006e57d9c35267177f07b60e510ea3e53400",id:"salla-user-settings-delete-modal",width:"xs",centered:!0,showBack:"otp"===this.currentStep,isClosable:"success"!==this.currentStep,iconStyle:"success"===this.currentStep?"success":void 0,onModalVisibilityChanged:e=>this.handleModalVisibilityChanged(e),onModalBack:()=>this.goBackFromOtp(),ref:e=>this.confirmationModal=e},"success"!==this.currentStep?t("span",{slot:"icon",class:"s-user-settings-delete-icon"},this.renderUserDeleteIcon()):null,t("div",{key:this.currentStep,class:"s-user-settings-delete-step"},this.renderDeleteStep())))}};i.style='/*!twlt*/.s-modal-header-inner{display:flex;flex-direction:column !important;align-items:center !important;justify-content:center !important}.s-modal-header-content{text-align:center !important}.s-user-settings-delete-body{text-align:center}.s-user-settings-delete-icon{display:inline-flex;align-items:center;justify-content:center;width:4rem;height:4rem;border-radius:9999px;border:1px solid var(--infinte-color);color:var(--infinte-color);margin:0 auto 1rem}.s-user-settings-delete-icon svg{width:1.5rem;height:1.5rem}.s-user-settings-delete-warning{color:#6b7280;font-size:0.875rem;line-height:1.625;margin-bottom:1.25rem}.s-user-settings-delete-actions--row{display:flex;gap:0.75rem;justify-content:center}.s-user-settings-delete-actions--row salla-button{flex:1}.s-user-settings-delete-actions--stack{display:flex;flex-direction:column;gap:0.75rem;margin-top:1.25rem}.s-user-settings-delete-otp-instruction{color:#6b7280;font-size:0.875rem}.s-user-settings-delete-otp-target{color:#6b7280;direction:ltr;margin-bottom:1.25rem}.s-user-settings-delete-otp-codes{display:flex;justify-content:stretch;gap:0.75rem;direction:ltr;margin-bottom:0.75rem;width:100%}.s-user-settings-delete-otp-codes.has-error{margin-bottom:0}.s-user-settings-delete-otp-input{flex:1 1 0;min-width:0;width:100%;height:3.5rem;text-align:center;border:1px solid #d1d5db;border-radius:0.5rem;font-size:1.25rem;font-weight:600;color:#111827;outline:none}.s-user-settings-delete-otp-input:focus{border-color:#004956;box-shadow:0 0 0 1px #004956}.s-user-settings-delete-otp-input.s-has-error{border-color:#ef4444 !important}.s-user-settings-delete-otp-input.s-has-error:focus{border-color:#ef4444 !important;box-shadow:0 0 0 1px #ef4444}.s-user-settings-delete-otp-input::-webkit-outer-spin-button,.s-user-settings-delete-otp-input::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}.s-user-settings-delete-otp-input[type=text]{-moz-appearance:textfield}.s-user-settings-delete-otp-error{display:block;color:#ef4444;font-size:0.75rem;text-align:center;padding-top:0.75rem;margin-bottom:1.25rem}.s-user-settings-delete-otp-resend{color:#6b7280;font-size:0.75rem;margin-top:1rem;text-align:center}.s-user-settings-delete-otp-timer{font-weight:600;direction:ltr;display:inline-block}.s-user-settings-delete-otp-resend-link{display:block;color:#004956;font-size:0.875rem;margin-top:1rem;text-align:center;text-decoration:underline;cursor:pointer}.s-user-settings-delete-success-body{color:#6b7280;font-size:0.875rem;line-height:1.625;margin-bottom:1.25rem}.s-user-settings-delete-success-btn{--s-button-color:#004956}.mx-1{margin-left:0.25rem;margin-right:0.25rem}.block{display:block}.hidden{display:none}.font-bold{font-weight:700}.outline{outline-style:solid}.s-has-error{--tw-border-opacity:1;border-color:rgb(248 113 113 / var(--tw-border-opacity, 1))}.s-has-error:focus{--tw-border-opacity:1;border-color:rgb(239 68 68 / var(--tw-border-opacity, 1))}.btn{display:inline-flex;flex:1 1 0%;align-items:center;justify-content:center;white-space:nowrap;border-radius:0.375rem;padding-left:1.5rem;padding-right:1.5rem;padding-bottom:0.625rem;padding-top:0.5rem;font-size:0.875rem;line-height:1.25rem;font-weight:700;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:300ms}.btn:hover{opacity:0.8}.has-error .s-form-label{color:#ff443a}.has-error .s-form-control,.has-error .s-tel-input-control,.has-error .s-datetime-picker-input{border-color:#ff443a;color:#ff443a}.toggle-checkbox .s-toggle-input{position:absolute;visibility:hidden}.toggle-checkbox .s-toggle-switcher{display:inline-block;background:#ccc;border-radius:16px;width:40px;height:25px;position:relative;vertical-align:middle;transition:background 0.25s}.toggle-checkbox .s-toggle-switcher:before,.toggle-checkbox .s-toggle-switcher:after{content:""}.toggle-checkbox .s-toggle-switcher:before{display:block;background:#fff;border-radius:50%;box-shadow:0 0 0 1px rgba(0,0,0,0.25);width:20px;height:21px;position:absolute;top:2.2px;left:1px;transition:left 0.25s}.toggle-checkbox .s-toggle-input:checked+div{background:#30D158}.toggle-checkbox .s-toggle-input:checked+div:before{left:18px}.s-has-error{--tw-border-opacity:1 !important;border-color:rgb(239 68 68 / var(--tw-border-opacity, 1)) !important;--tw-text-opacity:1 !important;color:rgb(239 68 68 / var(--tw-text-opacity, 1)) !important}.s-toggle{cursor:pointer;display:inline-block}.s-toggle .s-toggle-input{position:absolute;visibility:hidden}.s-toggle .s-toggle-label{margin-left:5px;position:relative;top:2px}.s-toggle .s-toggle-switcher{display:inline-block;background:#ccc;border-radius:16px;width:40px;height:25px;position:relative;vertical-align:middle;transition:background 0.25s}.s-toggle .s-toggle-switcher:before,.s-toggle .s-toggle-switcher:after{content:""}.s-toggle .s-toggle-switcher:before{display:block;background:#fff;border-radius:50%;box-shadow:0 0 0 1px rgba(0,0,0,0.25);width:20px;height:21px;position:absolute;top:2.2px;left:1px;transition:left 0.25s}.s-toggle .s-toggle-input:checked+div{background:#30D158}.s-toggle .s-toggle-input:checked+div:before{left:18px}.s-user-settings-section{border-bottom-width:1px;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1));--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.s-user-settings-section:first-child{border-bottom-right-radius:0px;border-bottom-left-radius:0px;border-top-left-radius:0.375rem;border-top-right-radius:0.375rem}.s-user-settings-section:last-child{border-bottom-right-radius:0.375rem;border-bottom-left-radius:0.375rem;border-top-left-radius:0px;border-top-right-radius:0px;border-bottom-width:0px}.s-user-settings-section .s-list-tile-item{align-items:flex-start;background-color:transparent;padding:1.25rem}@media (min-width: 768px){.s-user-settings-section .s-list-tile-item{align-items:center}}.s-user-settings-section .s-list-tile-item-action{margin-left:auto}.s-user-settings-section .s-list-tile-item-action:where([dir="rtl"],[dir="rtl"] *){margin-right:auto;margin-left:0px}.s-user-settings-section .s-list-tile-item-action button{width:100%;padding:10px}.s-user-settings-section-delete-user .s-list-tile-item{flex-wrap:wrap}@media (min-width: 768px){.s-user-settings-section-delete-user .s-list-tile-item{flex-wrap:nowrap}}.s-user-settings-section-delete-user .s-list-tile-item-icon{position:relative;top:5px}@media (min-width: 768px){.s-user-settings-section-delete-user .s-list-tile-item-icon{top:0px}}@media (max-width: 768px){.s-user-settings-section-delete-user .s-list-tile-item-content{flex:1 0 85%}.s-user-settings-section-delete-user .s-list-tile-item-action{flex:1 1 100%;margin-top:1rem}}.s-user-settings-section-title{font-size:1rem;line-height:1.5rem;--tw-text-opacity:1;color:rgb(17 24 39 / var(--tw-text-opacity, 1))}.s-user-settings-section-subtitle{font-size:0.75rem;line-height:1rem;--tw-text-opacity:1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.s-user-settings-section-icon svg{height:1.25rem;width:1.25rem}.s-user-settings-confirmation{text-align:center}.s-user-settings-confirmation svg{text-align:center}.s-user-settings-confirmation-icon{display:inline-flex;height:3rem;width:3rem;align-items:center;justify-content:center;border-radius:9999px;border-width:1px;border-style:solid;--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1))}@media (min-width: 640px){.s-user-settings-confirmation-icon{margin-left:auto;margin-right:auto;margin-bottom:1rem;height:5rem;width:5rem}}.s-user-settings-confirmation-icon:where([dir="ltr"],[dir="ltr"] *){margin-right:0.5rem}@media (min-width: 640px){.s-user-settings-confirmation-icon:where([dir="ltr"],[dir="ltr"] *){margin-right:0px}}.s-user-settings-confirmation-icon:where([dir="rtl"],[dir="rtl"] *){margin-left:0.5rem}@media (min-width: 640px){.s-user-settings-confirmation-icon:where([dir="rtl"],[dir="rtl"] *){margin-left:0px}}.s-user-settings-confirmation-icon svg{height:1.25rem;width:1.25rem;flex-shrink:0;fill:#9ca3af}.s-user-settings-confirmation-warning{font-size:0.75rem;line-height:1rem;--tw-text-opacity:1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.s-user-settings-confirmation-actions{margin-top:1.25rem;display:flex;align-items:center;justify-content:space-between}.s-user-settings-confirmation-actions>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-right:calc(1.25rem * var(--tw-space-x-reverse));margin-left:calc(1.25rem * calc(1 - var(--tw-space-x-reverse)))}.s-user-settings-confirmation-actions:where([dir="rtl"],[dir="rtl"] *)>:not([hidden])~:not([hidden]){--tw-space-x-reverse:1}';export{i as salla_user_settings}
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r as t,h as a,F as s,a as e}from"./p-B64o_70M.js";const i=class{constructor(a){t(this,a),this.isMobileAllowed=!0,this.isEmailRequired=!1,this.supportWebAuth=!0,this.withoutReload=!1,this.source="",this.htmlElement=document.documentElement,this.messages=[],this.isClosable=!0,this.iframeLoaded=!1,this.scrolling="no",this.direction=document.dir,this.canRenderIframe=!1,salla.event.on("login::open",(t=>this.onLoginOpen(t))),salla.event.on("modal::close",(t=>{this.iframe&&this.sendMessageToIframe({source:"login",type:"modal_closed",data:t})})),salla.onReady((()=>{this.api=salla.config.get("store.api"),this.storeId=salla.config.get("store.id")}))}onLoginOpen(t){salla.mobile?.isNativeLoginEnabled?.()||(this.isEmailAllowed||this.isMobileAllowed?(this.source=t?.source??!1,this.withoutReload=t?.withoutReload??this.withoutReload,this.open(t),this.openModal()):salla.logger.warn("Please enable atleast one login type to use this component."))}componentDidLoad(){window.addEventListener("message",(t=>{if(!this.isTrustedMessage(t)||"login"!=t.data?.source)return;if(!this.inline&&!this.canRenderIframe)return;salla.log("salla-account:: recived an event",t.data);let a=t.data?.type?.replace("iframe::",""),s=t.data.message;if("ready"==a)return s.isPasskeyPage?void this.createPassKey.postMessage({source:"login",type:"init_passkey_page",data:{token:salla.storage.get("token"),store_id:salla.config.get("store.id"),locale:salla.config.get("user.language_code"),redirect:salla.config.get("store.url")}},salla.config.get("login.url")):void this.handleIframeReadyAction();if("height"==a)return this.iframe.height=s?.height+"px";if("storage"==a)return this.handleIframeStorageAction(s);if("scrolling"==a)return this.scrolling=s,void(this.isClosable=!1);if("direction"==a)return document.dir=this.direction=s?"rtl":"ltr";if("notify"==a)return salla.notify[s.type](s.message);if("authenticated"==a||"authenticated_web_auth"==a)return!s?.withoutClose&&this.close(),salla.auth.api.handlAfterAuthenticatedResponse(s,this.supportWebAuth).then((()=>!(s?.withoutReload||this.withoutReload)&&setTimeout((()=>window.location.reload()),1e3)));if("dispatchEvent"!=a||"auth::verified"!=s.event){if("dispatchEvent"==a)return salla.event.emit(s.event,...s.payload);if("reload"==a)return s?.withClose&&this.modal.close(),window.location.reload();if("open_page"===a){if(!this.isSafeUrl(s?.url))return;return window.location.href=s.url}if("open_passkey_page"!==a)return"guest-checkout"===a?this.handleGuestCheckout():void("close"==a&&this.close());this.createPassKey=window.open(`${salla.config.get("login.url")}/create-passkey`)}else salla.log("Ignored dispatchEvent `auth::verified` from iframe")})),this.observeDarkModeChanges(),setTimeout((()=>Salla.event.emit("salla-login::ready")),1)}async open(t=null){return Salla.config.isGuest()?this.modal.open():this.withoutReload?void 0:location.reload()}close(){Salla.event.emit("salla-login::closing"),this.modal.close(),this.iframeLoaded=!1,this.canRenderIframe=!1,this.host.dispatchEvent(new CustomEvent("salla-login:closed",{cancelable:!0,bubbles:!0,detail:null})),Salla.event.emit("salla-login::closed")}handleIframeReadyAction(){this.sendInitMessage(),this.sendMessageToIframe({source:"login",type:"width",data:document.body.clientWidth})}observeDarkModeChanges(){new MutationObserver((t=>{t.forEach((t=>{"class"===t.attributeName&&this.sendMessageToIframe({source:"login",type:"darkMode",data:{isDark:!!this.htmlElement.classList.contains("dark")}})}))})).observe(this.htmlElement,{attributes:!0})}async handleIframeStorageAction(t){let a,s=salla.storage.get("cart.user_id"),e=!1;if(Object.entries(t).filter((t=>!Salla.storage.get(t[0]))).forEach((([t,i])=>{salla.log("Shared storage from accounts domain",t,i);let l="string"==typeof i?i?.replace(/^"|"$/g,""):i;salla.storage.set(t,l),"token"===t&&(a=l),"user"===t&&s&&l.id!==s&&(e=!0)})),a){this.modal.close(),Salla.auth.event.tokenFetched(a);try{await Salla.api.cart.assign()}catch(t){Salla.log("Error on assign after handle iframe",t)}e&&Salla.cart.reset();try{!Salla.auth.api.isSessionless()&&await Salla.auth.api.request("auth/jwt"),Salla.auth.api.canRedirect()?setTimeout((()=>window.location.reload()),100):await Salla.auth.event.loggedIn({data:{token:a}}).then((()=>Salla.auth.api.afterUserLogin()))}catch(t){this.modal.open(),Salla.log("Error on request auth/jwt after handle iframe",t)}}else e&&Salla.cart.reset()}isTrustedMessage(t){if(!(this.iframe&&t.source===this.iframe.contentWindow||this.createPassKey&&t.source===this.createPassKey))return!1;let a;try{a=new URL(salla.config.get("login.url","https://accounts.salla.com")).origin}catch(t){a="https://accounts.salla.com"}return t.origin===a}isSafeUrl(t){if("string"!=typeof t||!t)return!1;try{const{protocol:a}=new URL(t,location.href);return"https:"===a||"http:"===a}catch(t){return!1}}sendMessageToIframe(t){if(this.iframe)return this.iframe.contentWindow.postMessage(t,"*")}sendInitMessage(){let t=this.headers;try{t="string"==typeof t?JSON.parse(t):t}catch(a){console.error("Failed to parse headers!",this.headers,a),t=void 0}const a={user:salla.storage.get("user"),s_translations:salla.storage.get("s_translations"),token:salla.storage.get("token")};a.user||delete a.user,a.s_translations||delete a.s_translations,a.token||delete a.token,this.sendMessageToIframe({source:"login",type:"init",data:{id:this.storeId,lang:salla.lang.locale,isDark:!!this.htmlElement.classList.contains("dark"),apiUrl:this.api?.replace(/\/+$/,""),supportWebAuth:this.supportWebAuth,withoutReload:this.withoutReload,inline:this.inline,settings:salla.config.all(),headers:t,storage:a}})}async handleGuestCheckout(){if(this.modal.close(),salla.config.isGuest())return salla.cart.submit(!1,!0)}openModal(){this.canRenderIframe||(this.canRenderIframe=!0),this.modal.open()}render(){if(!Salla.config.isUser())return this.inline?this.getLoginDom():a("salla-modal",{class:"s-login-modal",ref:t=>this.modal=t,width:"xs"},this.getLoginDom())}getLoginDom(){if(this.canRenderIframe)return a(s,null,a("iframe",{src:`${salla.config.get("login.url","https://accounts.salla.com")}?src=${this.source}&version=${salla.config.get("login.version","0.1.78")}`,title:"Salla Login",class:"hide-scroll",loading:"lazy",ref:t=>{this.iframe=t},allow:"publickey-credentials-get; publickey-credentials-create",scrolling:this.scrolling,frameborder:"0",width:"100%"}))}get host(){return e(this)}};i.style="/*!twlt*/iframe{-moz-transition:height 0.3s;-ms-transition:height 0.3s;-o-transition:height 0.3s;-webkit-transition:height 0.3s;transition:height 0.3s;width:100%}.inline{display:inline}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}";export{i as salla_login_modal}
4
+ import{r as t,h as a,F as s,a as e}from"./p-Bf2Z6A1M.js";const i=class{constructor(a){t(this,a),this.isMobileAllowed=!0,this.isEmailRequired=!1,this.supportWebAuth=!0,this.withoutReload=!1,this.source="",this.htmlElement=document.documentElement,this.messages=[],this.isClosable=!0,this.iframeLoaded=!1,this.scrolling="no",this.direction=document.dir,this.canRenderIframe=!1,salla.event.on("login::open",(t=>this.onLoginOpen(t))),salla.event.on("modal::close",(t=>{this.iframe&&this.sendMessageToIframe({source:"login",type:"modal_closed",data:t})})),salla.onReady((()=>{this.api=salla.config.get("store.api"),this.storeId=salla.config.get("store.id")}))}onLoginOpen(t){salla.mobile?.isNativeLoginEnabled?.()||(this.isEmailAllowed||this.isMobileAllowed?(this.source=t?.source??!1,this.withoutReload=t?.withoutReload??this.withoutReload,this.open(t),this.openModal()):salla.logger.warn("Please enable atleast one login type to use this component."))}componentDidLoad(){window.addEventListener("message",(t=>{if(!this.isTrustedMessage(t)||"login"!=t.data?.source)return;if(!this.inline&&!this.canRenderIframe)return;salla.log("salla-account:: recived an event",t.data);let a=t.data?.type?.replace("iframe::",""),s=t.data.message;if("ready"==a)return s.isPasskeyPage?void this.createPassKey.postMessage({source:"login",type:"init_passkey_page",data:{token:salla.storage.get("token"),store_id:salla.config.get("store.id"),locale:salla.config.get("user.language_code"),redirect:salla.config.get("store.url")}},salla.config.get("login.url")):void this.handleIframeReadyAction();if("height"==a)return this.iframe.height=s?.height+"px";if("storage"==a)return this.handleIframeStorageAction(s);if("scrolling"==a)return this.scrolling=s,void(this.isClosable=!1);if("direction"==a)return document.dir=this.direction=s?"rtl":"ltr";if("notify"==a)return salla.notify[s.type](s.message);if("authenticated"==a||"authenticated_web_auth"==a)return!s?.withoutClose&&this.close(),salla.auth.api.handlAfterAuthenticatedResponse(s,this.supportWebAuth).then((()=>!(s?.withoutReload||this.withoutReload)&&setTimeout((()=>window.location.reload()),1e3)));if("dispatchEvent"!=a||"auth::verified"!=s.event){if("dispatchEvent"==a)return salla.event.emit(s.event,...s.payload);if("reload"==a)return s?.withClose&&this.modal.close(),window.location.reload();if("open_page"===a){if(!this.isSafeUrl(s?.url))return;return window.location.href=s.url}if("open_passkey_page"!==a)return"guest-checkout"===a?this.handleGuestCheckout():void("close"==a&&this.close());this.createPassKey=window.open(`${salla.config.get("login.url")}/create-passkey`)}else salla.log("Ignored dispatchEvent `auth::verified` from iframe")})),this.observeDarkModeChanges(),setTimeout((()=>Salla.event.emit("salla-login::ready")),1)}async open(t=null){return Salla.config.isGuest()?this.modal.open():this.withoutReload?void 0:location.reload()}close(){Salla.event.emit("salla-login::closing"),this.modal.close(),this.iframeLoaded=!1,this.canRenderIframe=!1,this.host.dispatchEvent(new CustomEvent("salla-login:closed",{cancelable:!0,bubbles:!0,detail:null})),Salla.event.emit("salla-login::closed")}handleIframeReadyAction(){this.sendInitMessage(),this.sendMessageToIframe({source:"login",type:"width",data:document.body.clientWidth})}observeDarkModeChanges(){new MutationObserver((t=>{t.forEach((t=>{"class"===t.attributeName&&this.sendMessageToIframe({source:"login",type:"darkMode",data:{isDark:!!this.htmlElement.classList.contains("dark")}})}))})).observe(this.htmlElement,{attributes:!0})}async handleIframeStorageAction(t){let a,s=salla.storage.get("cart.user_id"),e=!1;if(Object.entries(t).filter((t=>!Salla.storage.get(t[0]))).forEach((([t,i])=>{salla.log("Shared storage from accounts domain",t,i);let l="string"==typeof i?i?.replace(/^"|"$/g,""):i;salla.storage.set(t,l),"token"===t&&(a=l),"user"===t&&s&&l.id!==s&&(e=!0)})),a){this.modal.close(),Salla.auth.event.tokenFetched(a);try{await Salla.api.cart.assign()}catch(t){Salla.log("Error on assign after handle iframe",t)}e&&Salla.cart.reset();try{!Salla.auth.api.isSessionless()&&await Salla.auth.api.request("auth/jwt"),Salla.auth.api.canRedirect()?setTimeout((()=>window.location.reload()),100):await Salla.auth.event.loggedIn({data:{token:a}}).then((()=>Salla.auth.api.afterUserLogin()))}catch(t){this.modal.open(),Salla.log("Error on request auth/jwt after handle iframe",t)}}else e&&Salla.cart.reset()}isTrustedMessage(t){if(!(this.iframe&&t.source===this.iframe.contentWindow||this.createPassKey&&t.source===this.createPassKey))return!1;let a;try{a=new URL(salla.config.get("login.url","https://accounts.salla.com")).origin}catch(t){a="https://accounts.salla.com"}return t.origin===a}isSafeUrl(t){if("string"!=typeof t||!t)return!1;try{const{protocol:a}=new URL(t,location.href);return"https:"===a||"http:"===a}catch(t){return!1}}sendMessageToIframe(t){if(this.iframe)return this.iframe.contentWindow.postMessage(t,"*")}sendInitMessage(){let t=this.headers;try{t="string"==typeof t?JSON.parse(t):t}catch(a){console.error("Failed to parse headers!",this.headers,a),t=void 0}const a={user:salla.storage.get("user"),s_translations:salla.storage.get("s_translations"),token:salla.storage.get("token")};a.user||delete a.user,a.s_translations||delete a.s_translations,a.token||delete a.token,this.sendMessageToIframe({source:"login",type:"init",data:{id:this.storeId,lang:salla.lang.locale,isDark:!!this.htmlElement.classList.contains("dark"),apiUrl:this.api?.replace(/\/+$/,""),supportWebAuth:this.supportWebAuth,withoutReload:this.withoutReload,inline:this.inline,settings:salla.config.all(),headers:t,storage:a}})}async handleGuestCheckout(){if(this.modal.close(),salla.config.isGuest())return salla.cart.submit(!1,!0)}openModal(){this.canRenderIframe||(this.canRenderIframe=!0),this.modal.open()}render(){if(!Salla.config.isUser())return this.inline?this.getLoginDom():a("salla-modal",{class:"s-login-modal",ref:t=>this.modal=t,width:"xs"},this.getLoginDom())}getLoginDom(){if(this.canRenderIframe)return a(s,null,a("iframe",{src:`${salla.config.get("login.url","https://accounts.salla.com")}?src=${this.source}&version=${salla.config.get("login.version","0.1.78")}`,title:"Salla Login",class:"hide-scroll",loading:"lazy",ref:t=>{this.iframe=t},allow:"publickey-credentials-get; publickey-credentials-create",scrolling:this.scrolling,frameborder:"0",width:"100%"}))}get host(){return e(this)}};i.style="/*!twlt*/iframe{-moz-transition:height 0.3s;-ms-transition:height 0.3s;-o-transition:height 0.3s;-webkit-transition:height 0.3s;transition:height 0.3s;width:100%}.inline{display:inline}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}";export{i as salla_login_modal}
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r as t,h as e,H as s,a as l,F as i}from"./p-B64o_70M.js";const n=class{constructor(e){t(this,e),this.sections=[],this.itemNumber=""}deleteItem(t,e){const s=this.host.closest("form");if(s){const l=s.getAttribute("id");if(l&&"string"==typeof l){const s=l.match(/item-(\d+)/)?.[1];this.itemNumber=s||"";const i=this.host.querySelector(`#accordion-${e.id}`);salla.cart.deleteItem(`${this.itemNumber}?product_id=${e.id}&section_id=${t}`).then((()=>i?.remove()))}}}renderRemoveButton(t,s,l=!1){return e("salla-button",{type:"button",shape:l?"btn":"icon",fill:l?"outline":"solid",size:"small",color:"danger","aria-label":"Remove from the cart",onClick:()=>this.deleteItem(t,s)},l?salla.lang.get("common.elements.delete"):e("i",{class:"sicon-cancel"}))}renderAccordionHeader(t,s){const l=s?.options&&s?.options?.length>0;return e("div",{slot:"html",class:"s-multiple-bundle-product-cart-header-wrapper"},e("div",{class:"s-multiple-bundle-product-cart-header "+(l?"":"s-multiple-bundle-product-cart-header-no-options")},e("div",{class:"s-multiple-bundle-product-cart-header-content"},e("a",{href:s?.url,class:"s-multiple-bundle-product-cart-header-image-wrapper"},e("img",{src:s?.image?.url,alt:s?.image?.alt||s?.name,class:"s-multiple-bundle-product-cart-header-image"})),e("div",{class:"s-multiple-bundle-product-cart-header-content-details"},e("h2",{class:"s-multiple-bundle-product-cart-header-content-details-title"},e("a",{href:s?.url,class:"s-multiple-bundle-product-cart-header-content-details-title-link"},s?.name)),e("div",{class:"s-multiple-bundle-product-cart-header-content-details-price"},e("span",{class:"s-multiple-bundle-product-cart-header-content-details-price-regular"},e("span",{innerHTML:s?.price?salla.money(s?.price):""})),s?.sale_price>0&&e("span",{class:"s-multiple-bundle-product-cart-header-content-details-price-sale"},e("span",{innerHTML:salla.money(s?.sale_price)}))),s?.quantity_in_group>0&&0!==s?.quantity&&e("p",{class:"s-multiple-bundle-product-cart-header-content-details-quantity"},e("span",null,salla.lang.get("pages.products.number_of_pieces")),e("span",null,s?.quantity_in_group)))),!l&&e("div",{class:"s-multiple-bundle-product-cart-header-remove-button"},this.renderRemoveButton(t,s,!1))))}render(){return e(s,{key:"78be7c4a3be811adb01cb1437473fcd9f1c17b41",class:"s-multiple-bundle-product-wrapper"},e("div",{key:"9b0439dffc9a2dd8d31f56dacb5d835cde903e71",class:"s-multiple-bundle-product-wrapper-sections"},this.sections.map(((t,s)=>t.products.map((l=>{const i={sectionId:t.id,sectionIndex:s,productId:l.id};return e("salla-accordion",{key:l.id,collapsed:!1,bordered:!0,collapsible:!!(l.options&&l.options.length>0),size:"sm",id:`accordion-${l.id}`},e("salla-accordion-head",null,this.renderAccordionHeader(String(t.id),l)),l.options&&l.options.length>0&&e("salla-accordion-body",null,e("salla-product-options",{options:JSON.stringify(l.options),key:`${l.id}-persistent`,"product-id":l.id,"bundle-context":JSON.stringify(i)}),e("div",{class:"s-multiple-bundle-product-cart-body-remove-button"},this.renderRemoveButton(String(t.id),l,!0))))}))))))}get host(){return l(this)}};n.style="";const c=class{constructor(e){t(this,e),this.sections=[],this.selectedProducts={},this.productSelectedHandler=null,this.onSelectProduct=(t,e)=>{const s=e.id,l=this.selectedProducts[t]?.has(s)??!1,i=this.sections.find((e=>e.id==t));if(!(l&&i&&this.isProductSelectionLocked(i))){if(!l){if(!i)return;if(1!==this.getEffectiveMax(i)&&this.isAtSelectionLimit(i))return}this.selectedProducts={...this.selectedProducts,[t]:new Set(this.selectedProducts[t]||[])},l?(this.selectedProducts[t].delete(s),this.clearProductFormData(s,t),this.clearProductModalOptions(s,t)):1===this.getEffectiveMax(i)?this.syncSectionSelection(t,s):this.selectedProducts[t].add(s),this.selectedProducts={...this.selectedProducts},salla.event.dispatch("on-bundle-product-selected",{id:e.id,name:e.name,options:e.options,wasSelected:l,isSelected:!l})}},this.ensureProductSelected=(t,e)=>{this.selectedProducts={...this.selectedProducts,[t]:new Set(this.selectedProducts[t]||[])};const s=e.id;if(this.selectedProducts[t].has(s))return;const l=this.sections.find((e=>e.id==t));if(!l)return;const i=this.getEffectiveMax(l);if(1===i)this.syncSectionSelection(t,s);else{if(i>1&&this.isAtSelectionLimit(l))return;this.selectedProducts[t].add(s)}this.selectedProducts={...this.selectedProducts},salla.event.dispatch("on-bundle-product-selected",{id:e.id,name:e.name,options:e.options})},this.onSelectProductOptions=(t,e)=>{const s=this.sections.find((t=>t.id==e));if(!s||!this.canSelectProductInSection(s,t.id))return;const l=this.sections.findIndex((t=>t.id==e)),i=s.products?.findIndex((e=>e.id==t.id))??0,n=this.selectedProducts[e]?.has(t.id)??!1;salla.event.dispatch("multiple-bundle-product-modal::open",{product:t,sectionId:e,sectionIndex:l,productIndex:i,isProductAlreadySelected:n})},this.handleBundleSliderProductSelected=t=>{const{product:e,sectionId:s}=t.detail;this.onSelectProduct(s,e)},this.handleBundleSliderProductOptionsSelected=t=>{const{product:e,sectionId:s}=t.detail;this.onSelectProductOptions(e,s)}}isSingleProductSection(t){return 1===(t.products?.length??0)}getObligatoryMin(t){const e=t.obligatory_products;if(null==e)return 0;const s=Number(e);return Number.isNaN(s)?0:s}isProductSelectionLocked(t){return this.isSingleProductSection(t)&&1===this.getObligatoryMin(t)}getEffectiveMax(t){const e=t.products?.length??0,s=t.max_obligatory_products;return null!=s&&s>0?Math.min(s,e):e}getSelectedCount(t){return this.selectedProducts[t]?.size??0}isAtSelectionLimit(t){return this.getSelectedCount(t.id)>=this.getEffectiveMax(t)}canSelectProductInSection(t,e){return!!this.selectedProducts[t.id]?.has(e)||1===this.getEffectiveMax(t)||!this.isAtSelectionLimit(t)}async canSelectBundleProduct(t,e){const s=this.sections.find((e=>e.id==t));return!!s&&this.canSelectProductInSection(s,e)}queryProductCheckbox(t,e){const s=`input.s-multiple-bundle-product-checkbox[name="bundle[${t}][${e}][id]"]`,l=this.host.closest("form"),i=l?.querySelector(s);if(i)return i;for(const t of this.host.querySelectorAll("salla-multiple-bundle-product-slider")){const e=(t.shadowRoot??t).querySelector(s);if(e)return e}return null}dispatchBubblingChange(t){requestAnimationFrame((()=>{t.dispatchEvent(new window.Event("change",{bubbles:!0}))}))}clearSectionProductSlot(t,e,s){const l=this.queryProductCheckbox(t,s);l&&(l.checked=!1);const i=this.host.closest("form");if(i){const e=`bundle[${t}][${s}]`;Array.from(i.querySelectorAll("input")).forEach((t=>{t.name?.startsWith(e)&&("checkbox"===t.type&&t.name?.endsWith("][id]")?t.checked=!1:t.remove())}))}this.clearProductModalOptions(e,t)}syncSectionSelection(t,e){const s=this.sections.find((e=>e.id==t));s?.products?.forEach(((s,l)=>{s.id!=e&&this.clearSectionProductSlot(t,s.id,l)})),this.selectedProducts[t]=new Set([e]);const l=s?.products?.findIndex((t=>t.id==e))??-1,i=l>=0?this.queryProductCheckbox(t,l):null;i&&(i.checked=!0,this.dispatchBubblingChange(i))}autoSelectSingleProductSections(){if(!this.sections?.length)return;const t={...this.selectedProducts};let e=!1;const s=[];for(const l of this.sections){if(!this.isProductSelectionLocked(l))continue;const i=l.products?.[0];if(!i||!i.unlimited_quantity&&(i.quantity??0)<=0)continue;const n=l.id,c=new Set(t[n]||[]);c.has(i.id)||(c.add(i.id),t[n]=c,e=!0,s.push({product:i}))}e&&(this.selectedProducts=t,s.forEach((({product:t})=>{salla.event.dispatch("on-bundle-product-selected",{id:t.id,name:t.name,options:t.options})})))}clearProductFormData(t,e){if(null!=e){const s=this.sections.find((t=>t.id==e)),l=s?.products?.findIndex((e=>e.id==t))??-1;if(l>=0)return void this.clearSectionProductSlot(e,t,l)}const s=this.host.closest("form");s&&s.querySelectorAll(`[data-product-id="${t}"]`).forEach((t=>t.remove()))}clearProductModalOptions(t,e){let s=null,l=null;if(null!=e&&(s=this.sections.findIndex((t=>t.id==e)),s>-1)){const e=this.sections[s];if(e){const s=e.products?.findIndex((e=>e.id==t));l="number"==typeof s&&s>-1?s:null}}salla.event.dispatch("multiple-bundle-product-modal::clear-options",{productId:t,sectionId:e,sectionIndex:s,productIndex:l})}getProgressStatus(t){const e=this.getSelectedCount(t.id),s=this.getEffectiveMax(t);return s>0?`${e}/${s}`:"0"}getSectionSelectionNote(t){const e=this.getObligatoryMin(t),s=Number(t.max_obligatory_products)||0,l=e>0,i=s>0;return l||i?l&&i?e===s?salla.lang.getWithDefault("pages.products.bundle_select_exact",`اختر ${e} منتجات`,{count:e}):salla.lang.getWithDefault("pages.products.bundle_select_range",`اختر من ${e} إلى ${s} منتجات`,{min:e,max:s}):l?salla.lang.getWithDefault("pages.products.bundle_select_min",`اختر على الأقل ${e} منتجات`,{min:e}):salla.lang.getWithDefault("pages.products.bundle_select_max",`اختر حتى ${s} منتجات`,{max:s}):null}handleSectionsChange(){this.autoSelectSingleProductSections()}componentWillLoad(){this.autoSelectSingleProductSections()}renderAccordionHeader(t){const s=this.getSectionSelectionNote(t);return e(i,null,e("h2",{slot:"title"},t?.name),s?e("span",{slot:"note"},s):null,e("span",{slot:"progress"},this.getProgressStatus(t)))}componentDidLoad(){const t=this.host.querySelector("salla-multiple-bundle-product-options-modal");t&&(this.productSelectedHandler=t=>{const{productId:e,sectionId:s,product:l,fromModal:i}=t.detail;i?this.ensureProductSelected(s,l||{id:e}):this.onSelectProduct(s,l||{id:e})},t.addEventListener("productSelected",this.productSelectedHandler))}disconnectedCallback(){if(this.productSelectedHandler){const t=this.host.querySelector("salla-multiple-bundle-product-options-modal");t&&t.removeEventListener("productSelected",this.productSelectedHandler),this.productSelectedHandler=null}}render(){return e(s,{key:"1ba2cde8fad73b16cfc2ccdd5e68331a9e3fdb7a",class:"s-multiple-bundle-product-wrapper"},e("div",{key:"a72d9fc9f3df30616d3d0696c755db4e76c9a153",class:"s-multiple-bundle-product-wrapper-sections"},this.sections.map(((t,s)=>e("salla-accordion",{key:t.id,collapsed:0!==s},e("salla-accordion-head",null,this.renderAccordionHeader(t)),e("salla-accordion-body",null,e("salla-multiple-bundle-product-slider",{section:t,sectionIndex:s,selectedProducts:this.selectedProducts,selectionLimit:this.getEffectiveMax(t),isSelectionLocked:this.isProductSelectionLocked(t),onProductSelected:this.handleBundleSliderProductSelected,onProductOptionsSelected:this.handleBundleSliderProductOptionsSelected})))))),e("salla-multiple-bundle-product-options-modal",{key:"1e2f996c2d995c62ae29dedc90826a1f1d0a1320"}))}get host(){return l(this)}static get watchers(){return{sections:["handleSectionsChange"]}}};c.style="";export{n as salla_multiple_bundle_product_cart,c as salla_multiple_bundle_product_details}
4
+ import{r as t,h as e,H as s,a as l,F as i}from"./p-Bf2Z6A1M.js";const n=class{constructor(e){t(this,e),this.sections=[],this.itemNumber=""}deleteItem(t,e){const s=this.host.closest("form");if(s){const l=s.getAttribute("id");if(l&&"string"==typeof l){const s=l.match(/item-(\d+)/)?.[1];this.itemNumber=s||"";const i=this.host.querySelector(`#accordion-${e.id}`);salla.cart.deleteItem(`${this.itemNumber}?product_id=${e.id}&section_id=${t}`).then((()=>i?.remove()))}}}renderRemoveButton(t,s,l=!1){return e("salla-button",{type:"button",shape:l?"btn":"icon",fill:l?"outline":"solid",size:"small",color:"danger","aria-label":"Remove from the cart",onClick:()=>this.deleteItem(t,s)},l?salla.lang.get("common.elements.delete"):e("i",{class:"sicon-cancel"}))}renderAccordionHeader(t,s){const l=s?.options&&s?.options?.length>0;return e("div",{slot:"html",class:"s-multiple-bundle-product-cart-header-wrapper"},e("div",{class:"s-multiple-bundle-product-cart-header "+(l?"":"s-multiple-bundle-product-cart-header-no-options")},e("div",{class:"s-multiple-bundle-product-cart-header-content"},e("a",{href:s?.url,class:"s-multiple-bundle-product-cart-header-image-wrapper"},e("img",{src:s?.image?.url,alt:s?.image?.alt||s?.name,class:"s-multiple-bundle-product-cart-header-image"})),e("div",{class:"s-multiple-bundle-product-cart-header-content-details"},e("h2",{class:"s-multiple-bundle-product-cart-header-content-details-title"},e("a",{href:s?.url,class:"s-multiple-bundle-product-cart-header-content-details-title-link"},s?.name)),e("div",{class:"s-multiple-bundle-product-cart-header-content-details-price"},e("span",{class:"s-multiple-bundle-product-cart-header-content-details-price-regular"},e("span",{innerHTML:s?.price?salla.money(s?.price):""})),s?.sale_price>0&&e("span",{class:"s-multiple-bundle-product-cart-header-content-details-price-sale"},e("span",{innerHTML:salla.money(s?.sale_price)}))),s?.quantity_in_group>0&&0!==s?.quantity&&e("p",{class:"s-multiple-bundle-product-cart-header-content-details-quantity"},e("span",null,salla.lang.get("pages.products.number_of_pieces")),e("span",null,s?.quantity_in_group)))),!l&&e("div",{class:"s-multiple-bundle-product-cart-header-remove-button"},this.renderRemoveButton(t,s,!1))))}render(){return e(s,{key:"78be7c4a3be811adb01cb1437473fcd9f1c17b41",class:"s-multiple-bundle-product-wrapper"},e("div",{key:"9b0439dffc9a2dd8d31f56dacb5d835cde903e71",class:"s-multiple-bundle-product-wrapper-sections"},this.sections.map(((t,s)=>t.products.map((l=>{const i={sectionId:t.id,sectionIndex:s,productId:l.id};return e("salla-accordion",{key:l.id,collapsed:!1,bordered:!0,collapsible:!!(l.options&&l.options.length>0),size:"sm",id:`accordion-${l.id}`},e("salla-accordion-head",null,this.renderAccordionHeader(String(t.id),l)),l.options&&l.options.length>0&&e("salla-accordion-body",null,e("salla-product-options",{options:JSON.stringify(l.options),key:`${l.id}-persistent`,"product-id":l.id,"bundle-context":JSON.stringify(i)}),e("div",{class:"s-multiple-bundle-product-cart-body-remove-button"},this.renderRemoveButton(String(t.id),l,!0))))}))))))}get host(){return l(this)}};n.style="";const c=class{constructor(e){t(this,e),this.sections=[],this.selectedProducts={},this.productSelectedHandler=null,this.onSelectProduct=(t,e)=>{const s=e.id,l=this.selectedProducts[t]?.has(s)??!1,i=this.sections.find((e=>e.id==t));if(!(l&&i&&this.isProductSelectionLocked(i))){if(!l){if(!i)return;if(1!==this.getEffectiveMax(i)&&this.isAtSelectionLimit(i))return}this.selectedProducts={...this.selectedProducts,[t]:new Set(this.selectedProducts[t]||[])},l?(this.selectedProducts[t].delete(s),this.clearProductFormData(s,t),this.clearProductModalOptions(s,t)):1===this.getEffectiveMax(i)?this.syncSectionSelection(t,s):this.selectedProducts[t].add(s),this.selectedProducts={...this.selectedProducts},salla.event.dispatch("on-bundle-product-selected",{id:e.id,name:e.name,options:e.options,wasSelected:l,isSelected:!l})}},this.ensureProductSelected=(t,e)=>{this.selectedProducts={...this.selectedProducts,[t]:new Set(this.selectedProducts[t]||[])};const s=e.id;if(this.selectedProducts[t].has(s))return;const l=this.sections.find((e=>e.id==t));if(!l)return;const i=this.getEffectiveMax(l);if(1===i)this.syncSectionSelection(t,s);else{if(i>1&&this.isAtSelectionLimit(l))return;this.selectedProducts[t].add(s)}this.selectedProducts={...this.selectedProducts},salla.event.dispatch("on-bundle-product-selected",{id:e.id,name:e.name,options:e.options})},this.onSelectProductOptions=(t,e)=>{const s=this.sections.find((t=>t.id==e));if(!s||!this.canSelectProductInSection(s,t.id))return;const l=this.sections.findIndex((t=>t.id==e)),i=s.products?.findIndex((e=>e.id==t.id))??0,n=this.selectedProducts[e]?.has(t.id)??!1;salla.event.dispatch("multiple-bundle-product-modal::open",{product:t,sectionId:e,sectionIndex:l,productIndex:i,isProductAlreadySelected:n})},this.handleBundleSliderProductSelected=t=>{const{product:e,sectionId:s}=t.detail;this.onSelectProduct(s,e)},this.handleBundleSliderProductOptionsSelected=t=>{const{product:e,sectionId:s}=t.detail;this.onSelectProductOptions(e,s)}}isSingleProductSection(t){return 1===(t.products?.length??0)}getObligatoryMin(t){const e=t.obligatory_products;if(null==e)return 0;const s=Number(e);return Number.isNaN(s)?0:s}isProductSelectionLocked(t){return this.isSingleProductSection(t)&&1===this.getObligatoryMin(t)}getEffectiveMax(t){const e=t.products?.length??0,s=t.max_obligatory_products;return null!=s&&s>0?Math.min(s,e):e}getSelectedCount(t){return this.selectedProducts[t]?.size??0}isAtSelectionLimit(t){return this.getSelectedCount(t.id)>=this.getEffectiveMax(t)}canSelectProductInSection(t,e){return!!this.selectedProducts[t.id]?.has(e)||1===this.getEffectiveMax(t)||!this.isAtSelectionLimit(t)}async canSelectBundleProduct(t,e){const s=this.sections.find((e=>e.id==t));return!!s&&this.canSelectProductInSection(s,e)}queryProductCheckbox(t,e){const s=`input.s-multiple-bundle-product-checkbox[name="bundle[${t}][${e}][id]"]`,l=this.host.closest("form"),i=l?.querySelector(s);if(i)return i;for(const t of this.host.querySelectorAll("salla-multiple-bundle-product-slider")){const e=(t.shadowRoot??t).querySelector(s);if(e)return e}return null}dispatchBubblingChange(t){requestAnimationFrame((()=>{t.dispatchEvent(new window.Event("change",{bubbles:!0}))}))}clearSectionProductSlot(t,e,s){const l=this.queryProductCheckbox(t,s);l&&(l.checked=!1);const i=this.host.closest("form");if(i){const e=`bundle[${t}][${s}]`;Array.from(i.querySelectorAll("input")).forEach((t=>{t.name?.startsWith(e)&&("checkbox"===t.type&&t.name?.endsWith("][id]")?t.checked=!1:t.remove())}))}this.clearProductModalOptions(e,t)}syncSectionSelection(t,e){const s=this.sections.find((e=>e.id==t));s?.products?.forEach(((s,l)=>{s.id!=e&&this.clearSectionProductSlot(t,s.id,l)})),this.selectedProducts[t]=new Set([e]);const l=s?.products?.findIndex((t=>t.id==e))??-1,i=l>=0?this.queryProductCheckbox(t,l):null;i&&(i.checked=!0,this.dispatchBubblingChange(i))}autoSelectSingleProductSections(){if(!this.sections?.length)return;const t={...this.selectedProducts};let e=!1;const s=[];for(const l of this.sections){if(!this.isProductSelectionLocked(l))continue;const i=l.products?.[0];if(!i||!i.unlimited_quantity&&(i.quantity??0)<=0)continue;const n=l.id,c=new Set(t[n]||[]);c.has(i.id)||(c.add(i.id),t[n]=c,e=!0,s.push({product:i}))}e&&(this.selectedProducts=t,s.forEach((({product:t})=>{salla.event.dispatch("on-bundle-product-selected",{id:t.id,name:t.name,options:t.options})})))}clearProductFormData(t,e){if(null!=e){const s=this.sections.find((t=>t.id==e)),l=s?.products?.findIndex((e=>e.id==t))??-1;if(l>=0)return void this.clearSectionProductSlot(e,t,l)}const s=this.host.closest("form");s&&s.querySelectorAll(`[data-product-id="${t}"]`).forEach((t=>t.remove()))}clearProductModalOptions(t,e){let s=null,l=null;if(null!=e&&(s=this.sections.findIndex((t=>t.id==e)),s>-1)){const e=this.sections[s];if(e){const s=e.products?.findIndex((e=>e.id==t));l="number"==typeof s&&s>-1?s:null}}salla.event.dispatch("multiple-bundle-product-modal::clear-options",{productId:t,sectionId:e,sectionIndex:s,productIndex:l})}getProgressStatus(t){const e=this.getSelectedCount(t.id),s=this.getEffectiveMax(t);return s>0?`${e}/${s}`:"0"}getSectionSelectionNote(t){const e=this.getObligatoryMin(t),s=Number(t.max_obligatory_products)||0,l=e>0,i=s>0;return l||i?l&&i?e===s?salla.lang.getWithDefault("pages.products.bundle_select_exact",`اختر ${e} منتجات`,{count:e}):salla.lang.getWithDefault("pages.products.bundle_select_range",`اختر من ${e} إلى ${s} منتجات`,{min:e,max:s}):l?salla.lang.getWithDefault("pages.products.bundle_select_min",`اختر على الأقل ${e} منتجات`,{min:e}):salla.lang.getWithDefault("pages.products.bundle_select_max",`اختر حتى ${s} منتجات`,{max:s}):null}handleSectionsChange(){this.autoSelectSingleProductSections()}componentWillLoad(){this.autoSelectSingleProductSections()}renderAccordionHeader(t){const s=this.getSectionSelectionNote(t);return e(i,null,e("h2",{slot:"title"},t?.name),s?e("span",{slot:"note"},s):null,e("span",{slot:"progress"},this.getProgressStatus(t)))}componentDidLoad(){const t=this.host.querySelector("salla-multiple-bundle-product-options-modal");t&&(this.productSelectedHandler=t=>{const{productId:e,sectionId:s,product:l,fromModal:i}=t.detail;i?this.ensureProductSelected(s,l||{id:e}):this.onSelectProduct(s,l||{id:e})},t.addEventListener("productSelected",this.productSelectedHandler))}disconnectedCallback(){if(this.productSelectedHandler){const t=this.host.querySelector("salla-multiple-bundle-product-options-modal");t&&t.removeEventListener("productSelected",this.productSelectedHandler),this.productSelectedHandler=null}}render(){return e(s,{key:"1ba2cde8fad73b16cfc2ccdd5e68331a9e3fdb7a",class:"s-multiple-bundle-product-wrapper"},e("div",{key:"a72d9fc9f3df30616d3d0696c755db4e76c9a153",class:"s-multiple-bundle-product-wrapper-sections"},this.sections.map(((t,s)=>e("salla-accordion",{key:t.id,collapsed:0!==s},e("salla-accordion-head",null,this.renderAccordionHeader(t)),e("salla-accordion-body",null,e("salla-multiple-bundle-product-slider",{section:t,sectionIndex:s,selectedProducts:this.selectedProducts,selectionLimit:this.getEffectiveMax(t),isSelectionLocked:this.isProductSelectionLocked(t),onProductSelected:this.handleBundleSliderProductSelected,onProductOptionsSelected:this.handleBundleSliderProductOptionsSelected})))))),e("salla-multiple-bundle-product-options-modal",{key:"1e2f996c2d995c62ae29dedc90826a1f1d0a1320"}))}get host(){return l(this)}static get watchers(){return{sections:["handleSectionsChange"]}}};c.style="";export{n as salla_multiple_bundle_product_cart,c as salla_multiple_bundle_product_details}