@salla.sa/twilight-components 2.14.443 → 2.14.445

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 (315) hide show
  1. package/dist/cjs/{filepond-DUuldyqf.js → filepond-DHzf3TcL.js} +1 -1
  2. package/dist/cjs/{filepond-plugin-file-poster-DCILZbgm.js → filepond-plugin-file-poster-BXm87rQo.js} +1 -1
  3. package/dist/cjs/{filepond-plugin-file-validate-size-DGRAQ0sm.js → filepond-plugin-file-validate-size-C5UIq4A2.js} +1 -1
  4. package/dist/cjs/{filepond-plugin-file-validate-type-DYFEU9Tu.js → filepond-plugin-file-validate-type-DuhBUbfK.js} +1 -1
  5. package/dist/cjs/{filepond-plugin-image-edit-BfFPad0T.js → filepond-plugin-image-edit-B9-VYsWc.js} +1 -1
  6. package/dist/cjs/{filepond-plugin-image-exif-orientation-OL_9sX5A.js → filepond-plugin-image-exif-orientation-DMpSTznq.js} +1 -1
  7. package/dist/cjs/{filepond-plugin-image-preview-CJE7WqjM.js → filepond-plugin-image-preview-CMGkdkZi.js} +1 -1
  8. package/dist/cjs/{functions-CPtrW5R0.js → functions-9Nj0nrLx.js} +1 -1
  9. package/dist/cjs/{index-DTMl6O1v.js → index-DQZXng_4.js} +2 -2
  10. package/dist/cjs/{index-C39fe6Fg.js → index-rElwQMYM.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 +1 -1
  14. package/dist/cjs/salla-add-product-button_5.cjs.entry.js +1 -1
  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-apps-icons.cjs.entry.js +1 -1
  19. package/dist/cjs/salla-badge.cjs.entry.js +1 -1
  20. package/dist/cjs/salla-booking-field_7.cjs.entry.js +10 -10
  21. package/dist/cjs/salla-bullet-delivery_2.cjs.entry.js +58 -42
  22. package/dist/cjs/salla-cart-coupons.cjs.entry.js +1 -1
  23. package/dist/cjs/salla-cart-item-offers_2.cjs.entry.js +1 -1
  24. package/dist/cjs/salla-cashback-banner.cjs.entry.js +1 -1
  25. package/dist/cjs/salla-comment-form_8.cjs.entry.js +1 -1
  26. package/dist/cjs/salla-conditional-offer.cjs.entry.js +1 -1
  27. package/dist/cjs/salla-contacts.cjs.entry.js +1 -1
  28. package/dist/cjs/salla-cookies-bar.cjs.entry.js +1 -1
  29. package/dist/cjs/salla-count-down.cjs.entry.js +1 -1
  30. package/dist/cjs/salla-custom-fields.cjs.entry.js +1 -1
  31. package/dist/cjs/salla-delivery-promise.cjs.entry.js +1 -1
  32. package/dist/cjs/salla-edit-order-button.cjs.entry.js +1 -1
  33. package/dist/cjs/salla-filters-widget.cjs.entry.js +1 -1
  34. package/dist/cjs/salla-filters.cjs.entry.js +1 -1
  35. package/dist/cjs/salla-fulfillment-methods.cjs.entry.js +1 -1
  36. package/dist/cjs/salla-gifting.cjs.entry.js +144 -38
  37. package/dist/cjs/salla-hook.cjs.entry.js +1 -1
  38. package/dist/cjs/salla-infinite-scroll.cjs.entry.js +1 -1
  39. package/dist/cjs/salla-installment.cjs.entry.js +1 -1
  40. package/dist/cjs/salla-list-tile.cjs.entry.js +1 -1
  41. package/dist/cjs/salla-localization-modal.cjs.entry.js +1 -1
  42. package/dist/cjs/salla-login-modal.cjs.entry.js +1 -1
  43. package/dist/cjs/salla-loyalty-banner.cjs.entry.js +2 -2
  44. package/dist/cjs/salla-loyalty-hero_2.cjs.entry.js +2 -2
  45. package/dist/cjs/salla-loyalty-panel.cjs.entry.js +3 -3
  46. package/dist/cjs/salla-loyalty-points-banner.cjs.entry.js +1 -1
  47. package/dist/cjs/salla-loyalty-prize-item.cjs.entry.js +1 -1
  48. package/dist/cjs/salla-loyalty-program.cjs.entry.js +3 -3
  49. package/dist/cjs/salla-loyalty-reward.cjs.entry.js +2 -2
  50. package/dist/cjs/salla-loyalty.cjs.entry.js +1 -1
  51. package/dist/cjs/salla-maintenance-alert.cjs.entry.js +1 -1
  52. package/dist/cjs/salla-map.cjs.entry.js +1 -1
  53. package/dist/cjs/salla-menu.cjs.entry.js +1 -1
  54. package/dist/cjs/salla-metadata.cjs.entry.js +1 -1
  55. package/dist/cjs/salla-multiple-bundle-product-cart_2.cjs.entry.js +1 -1
  56. package/dist/cjs/salla-multiple-bundle-product-options-modal_2.cjs.entry.js +1 -1
  57. package/dist/cjs/salla-multiple-bundle-product.cjs.entry.js +1 -1
  58. package/dist/cjs/salla-next-order-coupon.cjs.entry.js +1 -1
  59. package/dist/cjs/salla-notification-item.cjs.entry.js +1 -1
  60. package/dist/cjs/salla-notifications.cjs.entry.js +1 -1
  61. package/dist/cjs/salla-offer-modal.cjs.entry.js +1 -1
  62. package/dist/cjs/salla-offer.cjs.entry.js +1 -1
  63. package/dist/cjs/salla-order-details-multiple-bundle-product.cjs.entry.js +1 -1
  64. package/dist/cjs/salla-order-details-options.cjs.entry.js +1 -1
  65. package/dist/cjs/salla-order-details.cjs.entry.js +1 -1
  66. package/dist/cjs/salla-order-edit-item.cjs.entry.js +1 -1
  67. package/dist/cjs/salla-order-edit-product-card.cjs.entry.js +1 -1
  68. package/dist/cjs/salla-order-edit.cjs.entry.js +15 -4
  69. package/dist/cjs/salla-order-summary.cjs.entry.js +1 -1
  70. package/dist/cjs/salla-order-totals-card.cjs.entry.js +1 -1
  71. package/dist/cjs/salla-orders.cjs.entry.js +1 -1
  72. package/dist/cjs/salla-payments.cjs.entry.js +1 -1
  73. package/dist/cjs/salla-placeholder.cjs.entry.js +1 -1
  74. package/dist/cjs/salla-price-range.cjs.entry.js +1 -1
  75. package/dist/cjs/salla-product-card-embed.cjs.entry.js +1 -1
  76. package/dist/cjs/salla-product-card_2.cjs.entry.js +1 -1
  77. package/dist/cjs/salla-product-size-guide.cjs.entry.js +1 -1
  78. package/dist/cjs/salla-products-list.cjs.entry.js +1 -1
  79. package/dist/cjs/salla-progress-bar.cjs.entry.js +1 -1
  80. package/dist/cjs/salla-quick-order.cjs.entry.js +1 -1
  81. package/dist/cjs/salla-rating-modal.cjs.entry.js +1 -1
  82. package/dist/cjs/salla-reward-action_4.cjs.entry.js +3 -3
  83. package/dist/cjs/salla-scopes.cjs.entry.js +1 -1
  84. package/dist/cjs/salla-search.cjs.entry.js +1 -1
  85. package/dist/cjs/salla-skeleton.cjs.entry.js +1 -1
  86. package/dist/cjs/salla-slider.cjs.entry.js +1 -1
  87. package/dist/cjs/salla-social-share.cjs.entry.js +1 -1
  88. package/dist/cjs/salla-social.cjs.entry.js +1 -1
  89. package/dist/cjs/salla-tab-content_3.cjs.entry.js +1 -1
  90. package/dist/cjs/salla-tiered-offer.cjs.entry.js +1 -1
  91. package/dist/cjs/salla-tooltip.cjs.entry.js +1 -1
  92. package/dist/cjs/salla-trust-badges.cjs.entry.js +1 -1
  93. package/dist/cjs/salla-user-menu.cjs.entry.js +1 -1
  94. package/dist/cjs/salla-user-profile.cjs.entry.js +1 -1
  95. package/dist/cjs/salla-user-settings.cjs.entry.js +1 -1
  96. package/dist/cjs/salla-verify.cjs.entry.js +1 -1
  97. package/dist/cjs/salla-wallet.cjs.entry.js +1 -1
  98. package/dist/cjs/{tracked-promise-Bxh4OHr8.js → tracked-promise-YvbHmmFp.js} +1 -1
  99. package/dist/cjs/twilight.cjs.js +2 -2
  100. package/dist/cjs/{vanilla-picker-BT7MIz0v.js → vanilla-picker-C02drqC1.js} +1 -1
  101. package/dist/collection/components/salla-gifting/salla-gifting.css +15 -0
  102. package/dist/collection/components/salla-gifting/salla-gifting.js +149 -36
  103. package/dist/collection/components/salla-order-edit/salla-order-edit.js +16 -4
  104. package/dist/collection/components/salla-searchable-dropdown/salla-searchable-dropdown.js +97 -41
  105. package/dist/components/index.js +2 -2
  106. package/dist/components/salla-gifting.js +170 -51
  107. package/dist/components/salla-order-edit.js +16 -4
  108. package/dist/components/salla-searchable-dropdown2.js +59 -41
  109. package/dist/esm/{filepond-CzVc7z2L.js → filepond-D3RXwxDJ.js} +1 -1
  110. package/dist/esm/{filepond-plugin-file-poster-DCAos-M-.js → filepond-plugin-file-poster-Bn0h-4qC.js} +1 -1
  111. package/dist/esm/{filepond-plugin-file-validate-size-QIZfch1N.js → filepond-plugin-file-validate-size-CN-3nZup.js} +1 -1
  112. package/dist/esm/{filepond-plugin-file-validate-type-DkQ2Tjmm.js → filepond-plugin-file-validate-type-BbLjL14b.js} +1 -1
  113. package/dist/esm/{filepond-plugin-image-edit-BYTzgZli.js → filepond-plugin-image-edit-Dr_0Kpj1.js} +1 -1
  114. package/dist/esm/{filepond-plugin-image-exif-orientation-BShml-fP.js → filepond-plugin-image-exif-orientation-Bo8gf--w.js} +1 -1
  115. package/dist/esm/{filepond-plugin-image-preview-BZSvWS5P.js → filepond-plugin-image-preview-CkgdmQBn.js} +1 -1
  116. package/dist/esm/{functions-BRYRoVDu.js → functions-CsLl2GF-.js} +1 -1
  117. package/dist/esm/{index-8AfwlDks.js → index-BZR5x5kv.js} +1 -1
  118. package/dist/esm/{index-C1Q9TkIB.js → index-DNtvpIPH.js} +2 -2
  119. package/dist/esm/loader.js +3 -3
  120. package/dist/esm/salla-accordion-body_2.entry.js +1 -1
  121. package/dist/esm/salla-accordion_6.entry.js +1 -1
  122. package/dist/esm/salla-add-product-button_5.entry.js +1 -1
  123. package/dist/esm/salla-advertisement.entry.js +1 -1
  124. package/dist/esm/salla-alert_2.entry.js +1 -1
  125. package/dist/esm/salla-app-install-alert.entry.js +1 -1
  126. package/dist/esm/salla-apps-icons.entry.js +1 -1
  127. package/dist/esm/salla-badge.entry.js +1 -1
  128. package/dist/esm/salla-booking-field_7.entry.js +10 -10
  129. package/dist/esm/salla-bullet-delivery_2.entry.js +58 -42
  130. package/dist/esm/salla-cart-coupons.entry.js +1 -1
  131. package/dist/esm/salla-cart-item-offers_2.entry.js +1 -1
  132. package/dist/esm/salla-cashback-banner.entry.js +1 -1
  133. package/dist/esm/salla-comment-form_8.entry.js +1 -1
  134. package/dist/esm/salla-conditional-offer.entry.js +1 -1
  135. package/dist/esm/salla-contacts.entry.js +1 -1
  136. package/dist/esm/salla-cookies-bar.entry.js +1 -1
  137. package/dist/esm/salla-count-down.entry.js +1 -1
  138. package/dist/esm/salla-custom-fields.entry.js +1 -1
  139. package/dist/esm/salla-delivery-promise.entry.js +1 -1
  140. package/dist/esm/salla-edit-order-button.entry.js +1 -1
  141. package/dist/esm/salla-filters-widget.entry.js +1 -1
  142. package/dist/esm/salla-filters.entry.js +1 -1
  143. package/dist/esm/salla-fulfillment-methods.entry.js +1 -1
  144. package/dist/esm/salla-gifting.entry.js +144 -38
  145. package/dist/esm/salla-hook.entry.js +1 -1
  146. package/dist/esm/salla-infinite-scroll.entry.js +1 -1
  147. package/dist/esm/salla-installment.entry.js +1 -1
  148. package/dist/esm/salla-list-tile.entry.js +1 -1
  149. package/dist/esm/salla-localization-modal.entry.js +1 -1
  150. package/dist/esm/salla-login-modal.entry.js +1 -1
  151. package/dist/esm/salla-loyalty-banner.entry.js +2 -2
  152. package/dist/esm/salla-loyalty-hero_2.entry.js +2 -2
  153. package/dist/esm/salla-loyalty-panel.entry.js +3 -3
  154. package/dist/esm/salla-loyalty-points-banner.entry.js +1 -1
  155. package/dist/esm/salla-loyalty-prize-item.entry.js +1 -1
  156. package/dist/esm/salla-loyalty-program.entry.js +3 -3
  157. package/dist/esm/salla-loyalty-reward.entry.js +2 -2
  158. package/dist/esm/salla-loyalty.entry.js +1 -1
  159. package/dist/esm/salla-maintenance-alert.entry.js +1 -1
  160. package/dist/esm/salla-map.entry.js +1 -1
  161. package/dist/esm/salla-menu.entry.js +1 -1
  162. package/dist/esm/salla-metadata.entry.js +1 -1
  163. package/dist/esm/salla-multiple-bundle-product-cart_2.entry.js +1 -1
  164. package/dist/esm/salla-multiple-bundle-product-options-modal_2.entry.js +1 -1
  165. package/dist/esm/salla-multiple-bundle-product.entry.js +1 -1
  166. package/dist/esm/salla-next-order-coupon.entry.js +1 -1
  167. package/dist/esm/salla-notification-item.entry.js +1 -1
  168. package/dist/esm/salla-notifications.entry.js +1 -1
  169. package/dist/esm/salla-offer-modal.entry.js +1 -1
  170. package/dist/esm/salla-offer.entry.js +1 -1
  171. package/dist/esm/salla-order-details-multiple-bundle-product.entry.js +1 -1
  172. package/dist/esm/salla-order-details-options.entry.js +1 -1
  173. package/dist/esm/salla-order-details.entry.js +1 -1
  174. package/dist/esm/salla-order-edit-item.entry.js +1 -1
  175. package/dist/esm/salla-order-edit-product-card.entry.js +1 -1
  176. package/dist/esm/salla-order-edit.entry.js +15 -4
  177. package/dist/esm/salla-order-summary.entry.js +1 -1
  178. package/dist/esm/salla-order-totals-card.entry.js +1 -1
  179. package/dist/esm/salla-orders.entry.js +1 -1
  180. package/dist/esm/salla-payments.entry.js +1 -1
  181. package/dist/esm/salla-placeholder.entry.js +1 -1
  182. package/dist/esm/salla-price-range.entry.js +1 -1
  183. package/dist/esm/salla-product-card-embed.entry.js +1 -1
  184. package/dist/esm/salla-product-card_2.entry.js +1 -1
  185. package/dist/esm/salla-product-size-guide.entry.js +1 -1
  186. package/dist/esm/salla-products-list.entry.js +1 -1
  187. package/dist/esm/salla-progress-bar.entry.js +1 -1
  188. package/dist/esm/salla-quick-order.entry.js +1 -1
  189. package/dist/esm/salla-rating-modal.entry.js +1 -1
  190. package/dist/esm/salla-reward-action_4.entry.js +3 -3
  191. package/dist/esm/salla-scopes.entry.js +1 -1
  192. package/dist/esm/salla-search.entry.js +1 -1
  193. package/dist/esm/salla-skeleton.entry.js +1 -1
  194. package/dist/esm/salla-slider.entry.js +1 -1
  195. package/dist/esm/salla-social-share.entry.js +1 -1
  196. package/dist/esm/salla-social.entry.js +1 -1
  197. package/dist/esm/salla-tab-content_3.entry.js +1 -1
  198. package/dist/esm/salla-tiered-offer.entry.js +1 -1
  199. package/dist/esm/salla-tooltip.entry.js +1 -1
  200. package/dist/esm/salla-trust-badges.entry.js +1 -1
  201. package/dist/esm/salla-user-menu.entry.js +1 -1
  202. package/dist/esm/salla-user-profile.entry.js +1 -1
  203. package/dist/esm/salla-user-settings.entry.js +1 -1
  204. package/dist/esm/salla-verify.entry.js +1 -1
  205. package/dist/esm/salla-wallet.entry.js +1 -1
  206. package/dist/esm/{tracked-promise-D1Ypxmkl.js → tracked-promise-BnC5Z9K7.js} +1 -1
  207. package/dist/esm/twilight.js +3 -3
  208. package/dist/esm/{vanilla-picker-Cydv9qqB.js → vanilla-picker-CF_W6ne1.js} +1 -1
  209. package/dist/twilight/{p-210fbf19.entry.js → p-007bf4b3.entry.js} +1 -1
  210. package/dist/twilight/{p-de41db95.entry.js → p-0418d2eb.entry.js} +1 -1
  211. package/dist/twilight/{p-ad400441.entry.js → p-058d72ba.entry.js} +1 -1
  212. package/dist/twilight/{p-fb7e9c2d.entry.js → p-062e5544.entry.js} +1 -1
  213. package/dist/twilight/p-06496953.entry.js +4 -0
  214. package/dist/twilight/{p-5f46564c.entry.js → p-08344e0e.entry.js} +1 -1
  215. package/dist/twilight/{p-a4ef1f08.entry.js → p-09aa60ca.entry.js} +1 -1
  216. package/dist/twilight/{p-7cc2c0cd.entry.js → p-0aea9987.entry.js} +1 -1
  217. package/dist/twilight/{p-13a48390.entry.js → p-108fff84.entry.js} +1 -1
  218. package/dist/twilight/{p-af72751b.entry.js → p-13cbd6eb.entry.js} +1 -1
  219. package/dist/twilight/{p-11c60244.entry.js → p-14b4b77f.entry.js} +1 -1
  220. package/dist/twilight/{p-0ea66318.entry.js → p-16e2e0a8.entry.js} +1 -1
  221. package/dist/twilight/p-185b629e.entry.js +4 -0
  222. package/dist/twilight/{p-615f0b05.entry.js → p-186df566.entry.js} +1 -1
  223. package/dist/twilight/{p-9f06e865.entry.js → p-2134195f.entry.js} +1 -1
  224. package/dist/twilight/{p-62721a71.entry.js → p-2282abc4.entry.js} +1 -1
  225. package/dist/twilight/{p-04ba55fb.entry.js → p-28e39ff0.entry.js} +1 -1
  226. package/dist/twilight/{p-50d27e92.entry.js → p-2b9deb4c.entry.js} +1 -1
  227. package/dist/twilight/{p-7b75d598.entry.js → p-2fb3d665.entry.js} +1 -1
  228. package/dist/twilight/{p-7af51165.entry.js → p-318e0847.entry.js} +1 -1
  229. package/dist/twilight/{p-30500443.entry.js → p-34c2e75f.entry.js} +1 -1
  230. package/dist/twilight/{p-5345526d.entry.js → p-38c677fb.entry.js} +1 -1
  231. package/dist/twilight/{p-75999cff.entry.js → p-3953d2cc.entry.js} +1 -1
  232. package/dist/twilight/{p-21f59e1c.entry.js → p-3af39ede.entry.js} +1 -1
  233. package/dist/twilight/{p-34d5d254.entry.js → p-3da82405.entry.js} +1 -1
  234. package/dist/twilight/{p-e9da3cc7.entry.js → p-4168d56d.entry.js} +1 -1
  235. package/dist/twilight/{p-d0927e70.entry.js → p-42e59b60.entry.js} +1 -1
  236. package/dist/twilight/{p-62c763dc.entry.js → p-43e90789.entry.js} +1 -1
  237. package/dist/twilight/{p-122be9b9.entry.js → p-455c6c0b.entry.js} +1 -1
  238. package/dist/twilight/{p-359c71aa.entry.js → p-45f78030.entry.js} +1 -1
  239. package/dist/twilight/{p-a5938402.entry.js → p-46bd695f.entry.js} +1 -1
  240. package/dist/twilight/{p-a01d05bb.entry.js → p-46f82b50.entry.js} +1 -1
  241. package/dist/twilight/{p-25ca9226.entry.js → p-52686e7d.entry.js} +1 -1
  242. package/dist/twilight/{p-025d82e1.entry.js → p-52d2d246.entry.js} +1 -1
  243. package/dist/twilight/{p-3a4490d0.entry.js → p-53c2b30e.entry.js} +1 -1
  244. package/dist/twilight/{p-d35b5154.entry.js → p-554e905e.entry.js} +1 -1
  245. package/dist/twilight/{p-a145f277.entry.js → p-561b7f43.entry.js} +1 -1
  246. package/dist/twilight/{p-53ac52d4.entry.js → p-564007ad.entry.js} +1 -1
  247. package/dist/twilight/{p-e15350fe.entry.js → p-56bdf925.entry.js} +1 -1
  248. package/dist/twilight/{p-b3e2e0f9.entry.js → p-589b4b5e.entry.js} +1 -1
  249. package/dist/twilight/{p-2474d970.entry.js → p-5da3194a.entry.js} +1 -1
  250. package/dist/twilight/{p-5c13a891.entry.js → p-67a36054.entry.js} +1 -1
  251. package/dist/twilight/{p-de845af5.entry.js → p-68fa49cc.entry.js} +1 -1
  252. package/dist/twilight/{p-28116325.entry.js → p-69498df8.entry.js} +1 -1
  253. package/dist/twilight/{p-Cxg0Hl1d.js → p-6Cm0Ixpa.js} +2 -2
  254. package/dist/twilight/{p-570c0f6a.entry.js → p-6c45e8fa.entry.js} +1 -1
  255. package/dist/twilight/{p-35f34856.entry.js → p-717782f4.entry.js} +1 -1
  256. package/dist/twilight/{p-bf76e5f6.entry.js → p-73409575.entry.js} +1 -1
  257. package/dist/twilight/{p-34cfcc10.entry.js → p-788c870c.entry.js} +1 -1
  258. package/dist/twilight/{p-f07ac09e.entry.js → p-7f805c47.entry.js} +1 -1
  259. package/dist/twilight/{p-74c7cb5c.entry.js → p-7ffd3938.entry.js} +1 -1
  260. package/dist/twilight/{p-2161e61b.entry.js → p-819992c7.entry.js} +1 -1
  261. package/dist/twilight/{p-eac567f1.entry.js → p-83a08f07.entry.js} +1 -1
  262. package/dist/twilight/{p-ac016389.entry.js → p-86be6cee.entry.js} +1 -1
  263. package/dist/twilight/{p-6d82f2f9.entry.js → p-87978156.entry.js} +1 -1
  264. package/dist/twilight/{p-afc9bc1b.entry.js → p-89bdd5e6.entry.js} +1 -1
  265. package/dist/twilight/{p-27cb91ff.entry.js → p-8d942086.entry.js} +1 -1
  266. package/dist/twilight/{p-37eeaeb6.entry.js → p-8f0d2c32.entry.js} +1 -1
  267. package/dist/twilight/{p-4af1f3ce.entry.js → p-9b4d472b.entry.js} +1 -1
  268. package/dist/twilight/{p-58542677.entry.js → p-9e1f454d.entry.js} +1 -1
  269. package/dist/twilight/{p-IxTdugtx.js → p-BGCZ19oG.js} +2 -2
  270. package/dist/twilight/{p-BJfi8_pj.js → p-Bc7fLLSC.js} +1 -1
  271. package/dist/twilight/{p-enKcXa72.js → p-BxtnkpUH.js} +1 -1
  272. package/dist/twilight/{p-CZJ4UGhE.js → p-C5-SqAXv.js} +1 -1
  273. package/dist/twilight/{p-CYG9gX2n.js → p-CCzp4vsg.js} +1 -1
  274. package/dist/twilight/p-D9eZofcJ.js +4 -0
  275. package/dist/twilight/{p-BFfL9VhE.js → p-DEbQVTrF.js} +1 -1
  276. package/dist/twilight/{p-C1Q9TkIB.js → p-DNtvpIPH.js} +1 -1
  277. package/dist/twilight/{p-Cu-SiRkr.js → p-D_Gt_HbS.js} +1 -1
  278. package/dist/twilight/{p-puRoZ09D.js → p-J5XAqGwq.js} +1 -1
  279. package/dist/twilight/{p-C0FpaBLL.js → p-NWWejksc.js} +1 -1
  280. package/dist/twilight/{p-5f1500d1.entry.js → p-a8aea13b.entry.js} +1 -1
  281. package/dist/twilight/{p-7aaafd56.entry.js → p-ab4d2172.entry.js} +1 -1
  282. package/dist/twilight/{p-afd7c751.entry.js → p-ab565608.entry.js} +1 -1
  283. package/dist/twilight/{p-3b0acf67.entry.js → p-ada82ecc.entry.js} +1 -1
  284. package/dist/twilight/{p-746f7ce5.entry.js → p-b25fd2a3.entry.js} +1 -1
  285. package/dist/twilight/{p-f28c99c0.entry.js → p-bb2ecab7.entry.js} +1 -1
  286. package/dist/twilight/{p-da208949.entry.js → p-be76e4e7.entry.js} +1 -1
  287. package/dist/twilight/{p-77aa75ab.entry.js → p-beb60b7e.entry.js} +1 -1
  288. package/dist/twilight/{p-451c925f.entry.js → p-c583a907.entry.js} +1 -1
  289. package/dist/twilight/{p-35d5a652.entry.js → p-c81203f3.entry.js} +1 -1
  290. package/dist/twilight/{p-b3d0e539.entry.js → p-c86c3e12.entry.js} +1 -1
  291. package/dist/twilight/{p-ef49690b.entry.js → p-ccf623d3.entry.js} +1 -1
  292. package/dist/twilight/{p-6c31c5c9.entry.js → p-d34e48ce.entry.js} +1 -1
  293. package/dist/twilight/{p-29485f8d.entry.js → p-d618c0ee.entry.js} +1 -1
  294. package/dist/twilight/{p-df483458.entry.js → p-d6dba947.entry.js} +1 -1
  295. package/dist/twilight/{p-46410329.entry.js → p-d8c3e606.entry.js} +1 -1
  296. package/dist/twilight/{p-1f532744.entry.js → p-db06baf6.entry.js} +1 -1
  297. package/dist/twilight/{p-9fa76038.entry.js → p-dd706055.entry.js} +1 -1
  298. package/dist/twilight/{p-346415be.entry.js → p-df7d2c53.entry.js} +1 -1
  299. package/dist/twilight/{p-49f4ac59.entry.js → p-dfc9dac3.entry.js} +1 -1
  300. package/dist/twilight/{p-1a1430f4.entry.js → p-e902b0b4.entry.js} +1 -1
  301. package/dist/twilight/{p-90a0eff7.entry.js → p-eb8a0d2f.entry.js} +1 -1
  302. package/dist/twilight/{p-44c8c901.entry.js → p-ecb8c538.entry.js} +1 -1
  303. package/dist/twilight/{p-eaa97e2d.entry.js → p-ed107904.entry.js} +1 -1
  304. package/dist/twilight/{p-a7fd1a3a.entry.js → p-ee83c195.entry.js} +1 -1
  305. package/dist/twilight/{p-51dd8f52.entry.js → p-f48a00a8.entry.js} +1 -1
  306. package/dist/twilight/{p-bc668ee7.entry.js → p-fa350b8c.entry.js} +1 -1
  307. package/dist/twilight/twilight.esm.js +1 -1
  308. package/dist/types/components/salla-gifting/salla-gifting.d.ts +23 -4
  309. package/dist/types/components/salla-order-edit/salla-order-edit.d.ts +4 -0
  310. package/dist/types/components/salla-searchable-dropdown/salla-searchable-dropdown.d.ts +8 -0
  311. package/dist/types/components.d.ts +18 -0
  312. package/package.json +5 -5
  313. package/dist/twilight/p-91076ee7.entry.js +0 -4
  314. package/dist/twilight/p-PQgQPBDL.js +0 -4
  315. package/dist/twilight/p-dec0d8c2.entry.js +0 -4
@@ -7,6 +7,7 @@ import { OrderEditPayloadState } from './helpers';
7
7
  * as an editable card with quantity controls, editable options, and an order summary.
8
8
  */
9
9
  export declare class SallaOrderEdit {
10
+ constructor();
10
11
  /** The order ID to edit */
11
12
  orderId: string | number;
12
13
  /** Pre-loaded order data (JSON string). */
@@ -30,6 +31,7 @@ export declare class SallaOrderEdit {
30
31
  addProductConfirmLoading: boolean;
31
32
  mobileProductsModalMounted: boolean;
32
33
  isMobileViewport: boolean;
34
+ isRTL: boolean;
33
35
  private mobileProductsModal;
34
36
  private mobileProductsListLoading;
35
37
  private addProductDrawer;
@@ -88,6 +90,8 @@ export declare class SallaOrderEdit {
88
90
  private saveOrder;
89
91
  private navigateToOrder;
90
92
  private handleConfirm;
93
+ private returnToOrderDetails;
94
+ private getConfirmButtonIconClass;
91
95
  private cancelEditSession;
92
96
  private renderProductsPanel;
93
97
  private renderProductsPickerContent;
@@ -15,6 +15,13 @@ export declare class SallaSearchableDropdown {
15
15
  searchQuery: string;
16
16
  clientSearch: boolean;
17
17
  dropUp: boolean;
18
+ searchable: boolean;
19
+ /**
20
+ * When true, the dropdown will NOT override the nearest scrollable ancestor's
21
+ * `overflow` to `visible` while open. Use this when the host (e.g. a modal
22
+ * body) needs to keep its own scrolling intact while the dropdown is open.
23
+ */
24
+ keepParentScroll: boolean;
18
25
  isOpen: boolean;
19
26
  focusedIndex: number;
20
27
  clientSearchQuery: string;
@@ -40,6 +47,7 @@ export declare class SallaSearchableDropdown {
40
47
  private handleTriggerKeyDown;
41
48
  private handleSearchInputChange;
42
49
  private handleSearchKeyDown;
50
+ private navigateItems;
43
51
  private scrollFocusedIntoView;
44
52
  private selectItem;
45
53
  render(): any;
@@ -2716,6 +2716,11 @@ export namespace Components {
2716
2716
  * @default []
2717
2717
  */
2718
2718
  "items": DropdownItem[];
2719
+ /**
2720
+ * When true, the dropdown will NOT override the nearest scrollable ancestor's `overflow` to `visible` while open. Use this when the host (e.g. a modal body) needs to keep its own scrolling intact while the dropdown is open.
2721
+ * @default false
2722
+ */
2723
+ "keepParentScroll": boolean;
2719
2724
  "label": string;
2720
2725
  /**
2721
2726
  * @default false
@@ -2737,6 +2742,10 @@ export namespace Components {
2737
2742
  * @default ''
2738
2743
  */
2739
2744
  "searchQuery": string;
2745
+ /**
2746
+ * @default true
2747
+ */
2748
+ "searchable": boolean;
2740
2749
  /**
2741
2750
  * @default false
2742
2751
  */
@@ -7287,6 +7296,11 @@ declare namespace LocalJSX {
7287
7296
  * @default []
7288
7297
  */
7289
7298
  "items"?: DropdownItem[];
7299
+ /**
7300
+ * When true, the dropdown will NOT override the nearest scrollable ancestor's `overflow` to `visible` while open. Use this when the host (e.g. a modal body) needs to keep its own scrolling intact while the dropdown is open.
7301
+ * @default false
7302
+ */
7303
+ "keepParentScroll"?: boolean;
7290
7304
  "label"?: string;
7291
7305
  /**
7292
7306
  * @default false
@@ -7312,6 +7326,10 @@ declare namespace LocalJSX {
7312
7326
  * @default ''
7313
7327
  */
7314
7328
  "searchQuery"?: string;
7329
+ /**
7330
+ * @default true
7331
+ */
7332
+ "searchable"?: boolean;
7315
7333
  /**
7316
7334
  * @default false
7317
7335
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salla.sa/twilight-components",
3
- "version": "2.14.443",
3
+ "version": "2.14.445",
4
4
  "license": "GPL-3.0",
5
5
  "author": "Salla Team <support@salla.dev> (https://salla.dev)",
6
6
  "bugs": {
@@ -79,9 +79,9 @@
79
79
  "typescript": "^5.4.5"
80
80
  },
81
81
  "dependencies": {
82
- "@salla.sa/applepay": "2.14.443",
83
- "@salla.sa/twilight": "2.14.443",
84
- "@salla.sa/twilight-tailwind-theme": "2.14.443",
82
+ "@salla.sa/applepay": "2.14.445",
83
+ "@salla.sa/twilight": "2.14.445",
84
+ "@salla.sa/twilight-tailwind-theme": "2.14.445",
85
85
  "@types/node": "^20.4.8",
86
86
  "animejs": "^3.2.2",
87
87
  "class-variance-authority": "0.7.0",
@@ -100,5 +100,5 @@
100
100
  "vanilla-lazyload": "^17.8.5",
101
101
  "vanilla-picker": "^2.12.2"
102
102
  },
103
- "gitHead": "fe062bd6fd77482b62b24ce4c27d511fa6515fe4"
103
+ "gitHead": "095fc7664cdf13a0778d73575eaaa0105f6e654c"
104
104
  }
@@ -1,4 +0,0 @@
1
- /*!
2
- * Crafted with ❤ by Salla
3
- */
4
- import{r as s,h as t}from"./p-C1Q9TkIB.js";import{a as i}from"./p-CgtvEd63.js";import{a as e}from"./p-BedNk7k1.js";import{S as a}from"./p-8Tsmrwno.js";import{S as l}from"./p-0-eTJXSD.js";const o=class{constructor(t){s(this,t),this.defaultEvent="gifting:open",this.selectImageForYourGift=salla.lang.get("blocks.buy_as_gift.select_image_or_upload"),this.currentStep=1,this.showCalendar=!1,this.showGiftText=!1,this.currentLang="",this.parentClass="is-current-step-1",this.errors={},this.gift=void 0,this.selectedGiftTextOption=void 0,this.selectedCountryId=void 0,this.selectedCountryCode=void 0,this.loadingCities=!1,this.loadingRegions=!1,this.regions=[],this.selectedRegionId=void 0,this.isKSA=!1,this.step2Animated=!1,this.showTextArea=!1,this.selectedImage=void 0,this.uploadedImage=void 0,this.selectedText=void 0,this.hasError=!1,this.timeZone=null,this.receiverCountryCode=salla.config.get("store.scope.countries")?.[0]||salla.config.get("store.store_country")||"SA",this.hostId=`salla-gifting-${Math.random().toString(36).slice(2,10)}`,this.formSelector="form.product-form, form.form--product-options",salla.lang.onLoaded((()=>{this.selectImageOrUpload=salla.lang.get("blocks.buy_as_gift.select_image_or_upload"),this.selectImageForYourGift=salla.lang.get("blocks.buy_as_gift.select_image_for_your_gift"),this.sectionTitle=salla.lang.get("blocks.buy_as_gift.gift_the_one_you_love"),this.sectionSubtitle=salla.lang.get("blocks.buy_as_gift.gift_the_one_you_love_message"),this.sectionBtnText=salla.lang.get("blocks.buy_as_gift.send_as_a_gift"),this.giftDetails=salla.lang.get("blocks.buy_as_gift.gift_details"),this.selectGiftMessage=salla.lang.get("blocks.buy_as_gift.select_gift_message"),this.giftCustomText=salla.lang.get("blocks.buy_as_gift.gift_custom_text"),this.textId=salla.lang.get("blocks.buy_as_gift.text_id"),this.incorrectGiftText=salla.lang.get("blocks.buy_as_gift.incorrect_gift_text"),this.nextStep=salla.lang.get("blocks.buy_as_gift.next_step"),this.senderNameLabel=salla.lang.get("blocks.buy_as_gift.sender_name"),this.receiverNameFieldLabel=salla.lang.get("blocks.buy_as_gift.receiver_name"),this.receiverMobileFieldLabel=salla.lang.get("blocks.buy_as_gift.receiver_mobile"),this.receiverCountryFieldLabel=salla.lang.get("blocks.buy_as_gift.receiver_country"),this.ksa=salla.lang.get("pages.checkout.ksa"),this.selectCity=salla.lang.get("pages.checkout.select_city"),this.selectCountry=salla.lang.get("pages.checkout.select_country"),this.selectCityInfo=salla.lang.get("blocks.buy_as_gift.city_info"),this.receiverCityFieldLabel=salla.lang.get("blocks.buy_as_gift.receiver_city"),this.receiverRegionFieldLabel=salla.lang.get("blocks.buy_as_gift.receiver_region")||salla.lang.get("pages.checkout.region"),this.selectRegion=salla.lang.get("pages.checkout.select_region"),this.receiverEmailFieldLabel=salla.lang.get("blocks.buy_as_gift.receiver_email"),this.emailPlaceholder=salla.lang.get("common.elements.email_placeholder"),this.sendLater=salla.lang.get("blocks.buy_as_gift.send_later"),this.selectSendDateAndTime=salla.lang.get("blocks.buy_as_gift.select_send_date_and_time"),this.canNotEditOrderAfterSelectDate=salla.lang.get("blocks.buy_as_gift.can_not_edit_order_after_select_date"),this.sendGift=salla.lang.get("blocks.buy_as_gift.send_gift"),this.donationRequired=salla.lang.get("pages.products.donation_amount_required"),this.currentLang=salla.lang.locale})),salla.event.on(this.defaultEvent,(()=>{this.open()}))}isPhysical(){return this.physicalProducts||this.physical}componentDidLoad(){salla.event.product.onPriceUpdated((()=>{const s=document.querySelector(".s-quantity-input-input");this.quantity=s?.value}))}getFormDataFromForm(){if(!this.formSelector)return null;const s=document.querySelector(this.formSelector);return s?new FormData(s):null}mergeObjectToFormData(s,t,i){for(let e in s){if(!s.hasOwnProperty(e)||null==s[e])continue;const a=i?`${i}[${e}]`:e;"object"!=typeof s[e]||null===s[e]||s[e]instanceof File?t.set(a,s[e]):this.mergeObjectToFormData(s[e],t,a)}return t}async open(){if(salla.config.isGuest())return salla.api.auth.setAfterLoginEvent(this.defaultEvent),void salla.event.dispatch("login::open",{withoutReload:!0});await this.modal.open();const s=this.productId?()=>salla.product.getGiftProductDetails(this.productId):()=>salla.cart.getGiftCartDetails();return await salla.api.withoutNotifier(s).then((s=>{this.gift=s.data,this.senderName=this.gift.sender_name})).catch((s=>{this.hasError=!0,this.errorMessage=s.response?.data?.error?.message||s.response?.data})).finally((()=>this.modal.stopLoading()))}async close(){return this.modal.close()}async setWrapperHeight(s=1,t=250,i=0,e=0){let a=document.querySelector(`#${this.hostId} .gift-step-${s}`);const l=()=>{this.stepsWrapper.style.height=e?`${e}px`:a.offsetHeight+i+"px"};this.step2Animated&&2===s?requestAnimationFrame(l):setTimeout(l,t)}toggleCalendar(){this.showCalendar=!this.showCalendar,this.setWrapperHeight(2,150,0)}toggleGiftText(s){this.textSelect?.classList.remove("s-form-has-error");let t=s.target.children[s.target.selectedIndex].getAttribute("data-id"),i="custom"==t;this.showGiftText=i,t?(this.selectedGiftTextOption=t,this.selectedText=i?void 0:s.target.value,this.setWrapperHeight(1,150,5)):(this.textArea.value="",this.selectedText=void 0,this.selectedGiftTextOption=void 0,this.setWrapperHeight(1,150,-15))}async goToStep2(){return this.selectedGiftTextOption?"custom"!=this.selectedGiftTextOption||this.selectedText?(this.textSelect.classList.remove("s-form-has-error"),this.customTextArea.classList.remove("s-form-has-error"),this.setWrapperHeight(2,600,0),(new i.timeline).add({targets:this.step1Elems.querySelectorAll(`#${this.hostId} .anime-item`),opacity:[1,0],translateX:[0,50],delay:i.stagger(70),duration:1200}).add({targets:".gift-step-2",translateX:["-110%",0],opacity:[0,1]},"-=1800").add({targets:this.step2Elems.querySelectorAll(`#${this.hostId} .anime-item`),opacity:[0,1],translateX:[-50,0],delay:i.stagger(70),duration:1200,complete:()=>{this.step2Elems.querySelectorAll(`#${this.hostId} .anime-item`).forEach((s=>{s.classList.remove("opacity-0"),s.removeAttribute("style")})),this.step2Animated=!0}},"-=1200"),this.currentStep=2,void(this.parentClass=`is-current-step-${this.currentStep}`)):(this.textSelect.classList.remove("s-form-has-error"),void this.customTextArea.classList.add("s-form-has-error")):(this.textSelect.classList.add("s-form-has-error"),void this.customTextArea.classList.remove("s-form-has-error"))}goToStep1(s){s.preventDefault();let t=new i.timeline({autoplay:!1});t.add({targets:this.step2Elems.querySelectorAll(`#${this.hostId} .anime-item`),opacity:[1,0],translateX:[0,-50],delay:i.stagger(70),duration:1200}).add({targets:".gift-step-1",translateX:["110%",0],opacity:[0,1]},"-=1800").add({targets:this.step1Elems.querySelectorAll(`#${this.hostId} .anime-item`),opacity:[0,1],translateX:[50,0],delay:i.stagger(70),duration:1200,complete:()=>{this.step1Elems.querySelectorAll(`#${this.hostId} .anime-item`).forEach((s=>{s.classList.remove("opacity-0"),s.removeAttribute("style")}))}},"-=1200"),t.play(),this.step2Animated=!1,this.setWrapperHeight(1,600,0),this.currentStep=1,this.parentClass=`is-current-step-${this.currentStep}`}getFilepondPlaceholder(){return`<div class="s-gifting-filepond-placeholder"><span class="s-gifting-filepond-placeholder-icon"><svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>images</title>\n<path d="M22.667 29.333h-13.333c-3.676 0-6.667-2.991-6.667-6.667v-13.333c0-0.737-0.597-1.333-1.333-1.333s-1.333 0.596-1.333 1.333v13.333c0 5.145 4.187 9.333 9.333 9.333h13.333c0.736 0 1.333-0.596 1.333-1.333s-0.597-1.333-1.333-1.333zM22.667 5.333c-2.205 0-4 1.795-4 4s1.795 4 4 4 4-1.795 4-4-1.795-4-4-4zM22.667 10.667c-0.735 0-1.333-0.597-1.333-1.333s0.599-1.333 1.333-1.333 1.333 0.597 1.333 1.333-0.599 1.333-1.333 1.333zM25.333 0h-13.333c-3.676 0-6.667 2.991-6.667 6.667v13.333c0 1.055 0.268 2.040 0.707 2.927 0.039 0.099 0.088 0.188 0.151 0.277 1.137 2.053 3.301 3.463 5.809 3.463h13.333c3.676 0 6.667-2.991 6.667-6.667v-13.333c0-3.676-2.991-6.667-6.667-6.667zM12 24c-1.244 0-2.344-0.583-3.077-1.476l5.721-7.047 6.629 8.523zM29.333 20c0 2.205-1.795 4-4 4h-0.68l-8.933-11.485c-0.251-0.32-0.633-0.511-1.039-0.515h-0.015c-0.401 0-0.781 0.181-1.035 0.492l-5.632 6.935v-12.76c0-2.205 1.795-4 4-4h13.333c2.205 0 4 1.795 4 4z"></path>\n</svg>\n</span><p class="s-gifting-filepond-placeholder-text">${this.selectImageOrUpload?this.selectImageOrUpload:""}</p></div>`}setPreview(s){this.uploader?.classList.add("has-bg");var t=document.querySelector(`#${this.hostId}.filepond-bg`)?document.querySelector(`#${this.hostId} .filepond-bg`):document.createElement("div");t.classList.add("filepond-bg"),t.classList.remove("s-hidden"),t.style.backgroundImage="url('"+s.url+"')",this.uploader?.querySelector(".filepond--root")?.appendChild(t),this.uploadedImage=s.url,this.gift&&this.gift.gift_images.length&&this.setWrapperHeight(1,150,0)}removePreview(){this.uploader.classList.remove("has-bg");let s=document.querySelector(`#${this.hostId} .filepond-bg`);s.removeAttribute("style"),s.classList.add("s-hidden"),this.handleRemoveImage()}handleTextAreaChange(s){this.selectedText=s.target.value,this.customTextArea.classList.remove("s-form-has-error")}clearError(s){if(this.errors?.[s]){const{[s]:t,...i}=this.errors;this.errors=i}}handleSenderName(s){this.senderName=s.target.value,this.clearError("sender_name")}handleReceiverName(s){this.receiverName=s.target.value,this.clearError("receiver.name")}handleReceiverCity(s){this.receiverCity=s.target.value,this.clearError("receiver.city_id")}async handleCountryChange(s){const t=Number(s.target.value);this.selectedCountryId=t,this.clearError("receiver.country");const i=this.gift?.countries?.find((s=>s.id==t));if(this.selectedCountryCode=i?.country_code,this.isKSA="SA"===i?.country_code,this.regions=[],this.selectedRegionId=void 0,this.gift={...this.gift,cities:[]},this.receiverCity=void 0,!t||0===this.gift?.countries?.length)return this.selectedCountryCode=void 0,this.isKSA=!1,void this.setWrapperHeight(2,0,0);if(this.isKSA){this.loadingRegions=!0,this.setWrapperHeight(2,0,0);try{const s=await salla.api.request(`shipping/countries/${t}/regions`);s&&s.data&&(this.regions=s.data)}catch(s){console.error("Error fetching regions:",s)}finally{this.loadingRegions=!1,this.setWrapperHeight(2,0,0)}}else{this.loadingCities=!0,this.setWrapperHeight(2,0,0);try{const s=await salla.api.request(`shipping/cities?for_branch=0&country_id=${t}`);s&&s.data&&(this.gift={...this.gift,cities:s.data})}catch(s){console.error("Error fetching cities:",s)}finally{this.loadingCities=!1}}}async handleRegionChange(s){const t=Number(s.target.value);if(this.selectedRegionId=t,this.clearError("receiver.region"),this.gift={...this.gift,cities:[]},this.receiverCity=void 0,t){this.loadingCities=!0;try{const s=await salla.api.request(`shipping/cities?for_branch=0&country_id=${this.selectedCountryId}&region_id=${t}`);s&&s.data&&(this.gift={...this.gift,cities:s.data})}catch(s){console.error("Error fetching cities:",s)}finally{this.loadingCities=!1,this.setWrapperHeight(2,0,0)}}}handleUploadImage(s){this.uploadedImage=s,this.gift&&this.gift.gift_images.length&&this.setWrapperHeight(1,150,0)}handleRemoveImage(){this.uploadedImage="",this.gift&&this.gift.gift_images.length&&this.setWrapperHeight(1,150,0)}handlePhoneInputChange(s){let t=s.detail;this.receiverMobile=t.number,this.receiverCountryCode=t.country_code,this.clearError("receiver.mobile")}handleDateTimePicker(s){this.deliveryDate=s.detail}getCalendarClasses(){return{"s-form-group":!0,"anime-item":!0,"s-gifting-calendar":!0,shown:this.showCalendar,hide:!this.showCalendar,"s-form-has-error":!!this.errors&&this.errors.deliver_at}}async submitForm(){const s=document.querySelector("#donating-amount")?.value;if(this.calendarFormGroup.classList.remove("s-form-has-error"),this.errors&&(this.errors={},this.setWrapperHeight(2,150,0)),this.showCalendar&&!this.deliveryDate)return void this.calendarFormGroup.classList.add("s-form-has-error");const t=[{key:"sender_name",value:this.senderName,label:this.senderNameLabel},{key:"receiver.name",value:this.receiverName,label:this.receiverNameFieldLabel},{key:"receiver.mobile",value:this.receiverMobile,label:this.receiverMobileFieldLabel},...this.isPhysical()?[{key:"receiver.country",value:this.selectedCountryId,label:this.receiverCountryFieldLabel},...this.isKSA?[{key:"receiver.region",value:this.selectedRegionId,label:this.receiverRegionFieldLabel}]:[],{key:"receiver.city_id",value:this.receiverCity,label:this.receiverCityFieldLabel}]:[]],i={};if(t.forEach((({key:s,value:t,label:e})=>{t||(i[s]=salla.lang.get("common.errors.field_required",{attribute:e}))})),Object.keys(i).length)return this.errors=i,void this.setWrapperHeight(2,150,0);const e={text:this.selectedText,sender_name:this.senderName,quantity:this.quantity,deliver_at:this.showCalendar?this.deliveryDate:null,image_url:this.uploadedImage??this.selectedImage,donation_amount:s||null,receiver:{name:this.receiverName,mobile_country_code:this.receiverCountryCode,mobile:this.receiverMobile,...this.isPhysical()&&this.selectedCountryCode?{country_code:this.selectedCountryCode}:{},...this.isPhysical()&&this.selectedRegionId?{region_id:this.selectedRegionId}:{},...this.receiverCity&&this.isPhysical()?{city_id:this.receiverCity}:{}},has_apple_pay:salla.helpers.hasApplePay()};let a;this.productId&&this.formSelector&&(a=this.getFormDataFromForm()||new FormData,a=this.mergeObjectToFormData(e,a));const l=this.productId?()=>salla.product.addProductGiftToCart(this.productId,a,!0):()=>salla.cart.addCartGiftToCart(e,!0);return await l().then((()=>this.modal.close())).catch((s=>{s.response&&422==s.response.status?this.errors=s.response.data.error.fields:console.log(s),this.setWrapperHeight(2,150,0)}))}step2ItemClass(s=""){const t="anime-item"+(this.step2Animated?"":" opacity-0");return s?`${s} ${t}`:t}generateClass(){return{"s-gifting-widget":!0,"s-gifting-widget-vertical":!!this.vertical,"s-gifting-widget-horizontal":!this.vertical}}async handleGiftButtonClick(){if(this.productId&&this.formSelector){const s=document.querySelector(this.formSelector);if(!s)return void console.error("SallaGifting:: Form not found in the document!");if(!(s instanceof HTMLFormElement))return void console.error("SallaGifting:: The specified selector does not correspond to a form tag!");if(!s.reportValidity())return console.error("SallaGifting:: Form is not valid!"),void salla.error(salla.lang.get("common.messages.required_fields"))}const s=document.querySelector(`salla-product-options[product-id="${this.productId}"]`);!s||await s.reportValidity()?this.open():salla.error(salla.lang.get("common.messages.required_fields"))}render(){return[t("div",{key:"2bc4ff1b223c9b1f2e50e36c7f6e6f0448f5a51d"},t("salla-list-tile",{key:"b5cf74b6d00c292a1c654c695d316a0a34e70c30",class:this.generateClass()},t("div",{key:"2e229e46039a9bbf071bc65534733c9da61545f8",slot:"title"},this.vertical?t("span",{innerHTML:l}):"",t("h3",{key:"b067244c213dd0c3c64f795f07b4c27f57c661f5"},this.widgetTitle?this.widgetTitle:this.sectionTitle)),t("div",{key:"a8804b65526bfde36bbb82302d667bc10052ff4b",slot:"subtitle"},t("div",{key:"cf2ca350ab3884baa192ce1c043719eb8f9a0120"},this.widgetSubtitle?this.widgetSubtitle:this.sectionSubtitle)),t("div",{key:"f68182d4324c4b56893b63e046e4298c519e449e",slot:"action"},t("salla-button",{key:"6cf71ec0311dfe7804f4634ae1203e0ae65150be",color:"primary",fill:"outline",width:"wide",class:"s-gifting-widget-action",onClick:()=>this.handleGiftButtonClick()},t("slot",{key:"9b00d0c0c7a594e7e9635a79a6b4a472da73ebe3",name:"widget-btn-content"},t("div",{key:"a73ed9d6322c4484180f68e7c8fb7a3b4e5bdb8a",class:"s-gifting-widget-action-content"},t("span",{key:"0ce7ec753ab1ec30269127a8426a36d55d983a6e",innerHTML:l}),"  ",t("span",{key:"ae35a5669a30e7abb61e5d540224c2be5baae82a"},this.sectionBtnText)))))),t("salla-modal",{key:"dee19984ecc71f6e10c330121361359d00408448",id:this.hostId,isLoading:!0,class:"s-gifting-modal",width:"sm",ref:s=>this.modal=s},t("div",{key:"10eee2481652b157c44b16d34097ffcce9325d81",slot:"loading"},t("div",{key:"325446006a0bf5d6d480c8935912fe976ccd453d",class:"s-gifting-skeleton"},t("div",{key:"f256cc302b946906262450f0bb023912d034aa13",class:"s-gifting-modal-header"},t("salla-skeleton",{key:"75bf0e81841a4c41e4105f19bd3e4fbf67ece325",type:"circle",height:"5rem",width:"5rem"}),t("h2",{key:"64661720e2f94f6d8b86087d3a03538a1a419202",class:"s-gifting-modal-title"},t("div",{key:"d5000d6903f5a7b61beb6a0a88291953e1344ba3",class:"s-gifting-modal-badge-wrapper"},t("salla-skeleton",{key:"07efd33b877468df617bab4cd2f1b73e73f2d284",height:"15px",width:"150px"})))),t("div",{key:"6fb9d9abf7e211a6ecc45ee50283d37d1755b220",class:"s-gifting-skeleton-content"},t("salla-skeleton",{key:"ed76848f4c017334dea4f12c07ec6556646c397f",height:"10px",width:"150px"}),t("salla-skeleton",{key:"cfe3e107536dac9e5b1524770eb6990ab3b6460b",height:"230px"}),t("salla-skeleton",{key:"a35af25d98f5758bf442759841536fed09f6cdd2",height:"10px",width:"150px"}),t("salla-skeleton",{key:"6950704fb24a07807542723f2752b6a734090d42",height:"30px"}),t("salla-skeleton",{key:"bd65f98a07ee8d041434b9b475ce4c355318f586",height:"40px"})))),t("slot",{key:"e946b5c7a4146d0118d321d860d332d17c3f931e",name:"header"}),this.hasError?t("salla-placeholder",{alignment:"center"},t("span",{slot:"title"},this.errorMessage||salla.lang.get("common.errors.empty_results")),t("span",{slot:"description"}," ")):[t("div",{class:"s-gifting-modal-header"},t("span",{class:"s-gifting-modal-icon"},t("span",{innerHTML:l})),t("h2",{class:"s-gifting-modal-title"},t("div",{class:"s-gifting-modal-badge-wrapper"},t("div",{class:"s-gifting-modal-badge"},t("span",null,t("span",null,this.currentStep),"/2")),t("span",null,this.giftDetails)))),t("div",{class:"s-gifting-steps-wrapper "+this.parentClass,ref:s=>this.stepsWrapper=s},t("div",{class:"s-gifting-step-one gift-step-1",ref:s=>this.step1Elems=s},t("div",{class:"s-gifting-modal-uploader-title anime-item"},this.selectImageForYourGift),t("div",{class:"s-gifting-modal-uploader anime-item",ref:s=>this.uploader=s},t("span",{class:"s-gifting-remove-preview",onClick:()=>this.removePreview(),innerHTML:a}),this.selectImageOrUpload&&t("salla-file-upload",{"instant-upload":!0,name:"image_url",url:salla.url.api(salla.product.api.getUrl("giftImage")),onUploaded:s=>this.handleUploadImage(s.detail),labelIdle:this.getFilepondPlaceholder(),onRemoved:()=>this.handleRemoveImage()})),t("div",{class:"anime-item"},!this.uploadedImage&&this.gift&&this.gift.gift_images&&this.gift.gift_images.length>0?t("salla-slider",{id:"gifting-slider",loop:!1,"controls-outer":!0,class:"s-gifting-slider",type:"carousel"},t("div",{slot:"items"},this.gift&&this.gift.gift_images?this.gift?.gift_images.map((s=>t("a",{class:"s-gifting-clickable s-gifting-image",onClick:()=>this.setPreview(s)},t("img",{style:{width:"120px"},src:s.url,alt:`${s.id}`})))):"")):""),t("div",{class:"anime-item"},t("div",{class:"s-form-group s-gifting-selectText",ref:s=>this.textSelect=s},t("select",{id:"gift-text-selection",name:"gift-text-selection",class:"s-form-control s-gifting-select",onChange:s=>this.toggleGiftText(s)},t("option",{"data-id":null,selected:!0},this.selectGiftMessage),this.gift&&this.gift.gift_texts?this.gift?.gift_texts.map((s=>t("option",{"data-id":s.id,value:s.text,key:s.id},s.text))):"",t("option",{"data-id":"custom"},this.giftCustomText))),t("div",{class:this.showGiftText?"s-form-group s-gifting-textarea shown":"s-form-group s-gifting-textarea hide",ref:s=>this.customTextArea=s},t("label",{htmlFor:"gift-custom-text",class:"s-form-label"},this.giftCustomText),t("div",{class:"mt-1"},t("textarea",{onInput:s=>this.handleTextAreaChange(s),rows:4,ref:s=>this.textArea=s,name:"gift-custom-text",id:"gift-custom-text",class:"s-form-control"})))),t("div",{class:"anime-item"},t("salla-button",{color:"primary",width:"wide",onClick:()=>this.goToStep2()},t("span",null,this.nextStep)))),t("div",{class:"s-gifting-step-two gift-step-2",ref:s=>this.step2Elems=s},t("div",{class:this.step2ItemClass(this.errors?.sender_name?"s-form-group s-form-has-error":"s-form-group")},t("label",{htmlFor:"sender_name",class:"s-form-label"},this.senderNameLabel),t("input",{type:"text",class:"s-form-control",name:"sender_name",id:"sender_name",value:this.senderName,onInput:s=>this.handleSenderName(s),placeholder:""}),this.errors&&this.errors.sender_name?t("span",{class:"s-gifting-error"},this.errors.sender_name):""),t("div",{class:this.step2ItemClass(this.errors?.["receiver.name"]?"s-form-group s-form-has-error":"s-form-group")},t("label",{htmlFor:"receiver_name",class:"s-form-label"},this.receiverNameFieldLabel),t("input",{type:"text",class:"s-form-control",name:"receiver_name",id:"receiver_name",value:"",onInput:s=>this.handleReceiverName(s),placeholder:""}),this.errors&&this.errors["receiver.name"]?t("span",{class:"s-gifting-error"},this.errors["receiver.name"]):""),t("div",{class:this.step2ItemClass(this.errors?.["receiver.mobile"]?"s-form-group s-form-has-error":"s-form-group")},t("label",{class:"s-form-label"},this.receiverMobileFieldLabel),t("salla-tel-input",{class:"s-gifting-tel-input",phone:this.receiverMobile,countryCode:this.receiverCountryCode,onPhoneEntered:s=>this.handlePhoneInputChange(s)}),this.errors&&this.errors["receiver.mobile"]?t("span",{class:"s-gifting-error"},this.errors["receiver.mobile"]):""),this.isPhysical()&&t("div",{class:this.step2ItemClass(this.errors?.["receiver.country"]?"s-form-group s-form-has-error":"s-form-group")},t("label",{class:"s-form-label"},this.receiverCountryFieldLabel),t("select",{name:"country",class:"s-form-control",onChange:s=>this.handleCountryChange(s),required:!0},t("option",{value:""},this.selectCountry),this.gift?.countries?.map((s=>t("option",{value:s.id},s.name)))),this.errors&&this.errors["receiver.country"]?t("span",{class:"s-gifting-error"},this.errors["receiver.country"]):""),this.isPhysical()&&this.isKSA&&t("div",{class:this.step2ItemClass(this.errors?.["receiver.region"]?"s-form-group s-form-has-error":"s-form-group")},t("label",{class:"s-form-label"},this.receiverRegionFieldLabel),t("select",{name:"region",class:"s-form-control",onChange:s=>this.handleRegionChange(s),disabled:this.loadingRegions},t("option",{value:"",selected:!0},this.loadingRegions?salla.lang.get("common.elements.loading"):this.selectRegion),this.regions?.map((s=>t("option",{value:s.id},s.name)))),this.errors&&this.errors["receiver.region"]?t("span",{class:"s-gifting-error"},this.errors["receiver.region"]):""),this.isPhysical()&&t("div",{class:this.step2ItemClass(this.errors?.["receiver.city_id"]?"s-form-group s-form-has-error":"s-form-group")},t("label",{class:"s-form-label"},this.receiverCityFieldLabel),t("select",{name:"city","aria-label":salla.lang.get("blocks.buy_as_gift.select_city"),class:"s-form-control",onChange:s=>this.handleReceiverCity(s),disabled:this.loadingCities||this.isKSA&&!this.selectedRegionId},t("option",{value:"",selected:!0},this.loadingCities?salla.lang.get("common.elements.loading"):this.selectCity),this.gift?.cities?.map((s=>t("option",{value:s.id},s.name)))),this.errors&&this.errors["receiver.city_id"]?t("span",{class:"s-gifting-error"},this.errors["receiver.city_id"]):""),this.isPhysical()&&t("div",{class:this.step2ItemClass("s-gifting-info")},t("span",{innerHTML:'\x3c!-- Generated by IcoMoon.io --\x3e\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n<title>alert</title>\n<path d="M16 13.333c-0.736 0-1.333 0.597-1.333 1.333v8c0 0.736 0.597 1.333 1.333 1.333s1.333-0.597 1.333-1.333v-8c0-0.736-0.597-1.333-1.333-1.333zM16 9.327c-0.736 0-1.333 0.604-1.333 1.34s0.597 1.333 1.333 1.333 1.333-0.597 1.333-1.333v-0.013c0-0.736-0.597-1.327-1.333-1.327zM27.313 4.687c-6.237-6.237-16.389-6.239-22.628 0-6.237 6.239-6.237 16.389 0 22.628 3.119 3.119 7.216 4.679 11.313 4.679s8.195-1.559 11.313-4.679c6.24-6.239 6.24-16.391 0.001-22.628zM25.428 25.428c-5.199 5.197-13.657 5.197-18.857 0-5.197-5.199-5.197-13.659 0-18.857 5.199-5.197 13.659-5.197 18.857 0 5.199 5.2 5.199 13.659 0 18.857z"></path>\n</svg>\n'}),t("span",null,this.selectCityInfo)),!this.isPhysical()&&t("div",{class:this.step2ItemClass()},t("label",{class:"s-gifting-schedule s-gifting-clickable",htmlFor:`schedule-${this.hostId}`},t("input",{type:"checkbox",name:"schedule",id:`schedule-${this.hostId}`,onChange:()=>this.toggleCalendar(),class:"s-checkbox"}),t("span",{class:"s-form-label"}," ",this.sendLater," "))),t("div",{class:this.getCalendarClasses(),ref:s=>this.calendarFormGroup=s},t("label",{class:"s-form-label"},this.selectSendDateAndTime),t("salla-datetime-picker",{value:this.deliveryDate,placeholder:this.selectSendDateAndTime,"enable-time":!0,"date-format":"Y-m-d h:i K",onPicked:s=>this.handleDateTimePicker(s)}),t("span",{class:"s-gifting-calendar-hint"},this.canNotEditOrderAfterSelectDate)),t("div",{class:this.step2ItemClass("s-gifting-step-two-footer")},t("a",{href:"#!",innerHTML:e,onClick:s=>this.goToStep1(s)}),t("salla-button",{onClick:()=>this.submitForm(),color:"primary",width:"wide"},t("span",null,this.sendGift)))))],t("slot",{key:"579cbbcc59818051def887c38e4d0eed6e690737",name:"footer"})))]}};o.style=".s-gifting-steps-wrapper{transition:0.2s cubic-bezier(0.55, 0, 0.1, 1) 0s}.s-gifting-select{background-image:url(\"data:image/svg+xml;utf8,<svg version='1.1' fill='gray' xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'><title>keyboard_arrow_down</title><path d='M9.875 11.104l6.125 6.125 6.125-6.125 1.875 1.875-8 8-8-8z'></path></svg>\");background-size:24px;background-repeat:no-repeat;background-position:99%;appearance:none}[dir=rtl] .s-gifting-select{background-position:5px}.s-gifting-widget-vertical .s-list-tile-item [slot=title]{display:flex;align-items:center;gap:1.5rem}.s-gifting-widget-vertical .s-list-tile-item-content{width:100%}";export{o as salla_gifting}
@@ -1,4 +0,0 @@
1
- /*!
2
- * Crafted with ❤ by Salla
3
- */
4
- import{h as n}from"./p-C1Q9TkIB.js";function a(n,a=(window.matchMedia("(min-width: 768px)").matches?3:2)){return n<a?n:n-n%a}function t(n=null){for(const n of document.querySelectorAll("salla-modal"))n.close();n&&requestAnimationFrame(n)}function o(n){const a=(n.prizes||[]).map((n=>({...n,items:(n.items||[]).map((a=>({...a,group_title:n.title,group_type:n.type})))}))),t={type:"all",title:salla.lang.get("pages.loyalty_program.all"),items:a.reduce(((n,a)=>n.concat(a.items)),[])};return a.unshift(t),{...n,prizes:a,prizes_count:t.items.length,points:n.points??[]}}function l(n){return[n.name.replace(/\s/g,"-"),`brand-${n.id}`].join("/")}function r(a){return"number"==typeof a?n("span",null,a," ",salla.lang.get("pages.loyalty_program.point")):function(n){for(const a of n.conditions??[])if(a.key?.endsWith("_FOR_UNIT"))return!0;return!1}(a)?n("span",null,"1 ",salla.config.currency().symbol," = ",a.points," ",salla.lang.get("pages.loyalty_program.point")):n("span",null,a.points," ",salla.lang.get("pages.loyalty_program.point"))}export{a,l as b,t as c,r as f,o as n}
@@ -1,4 +0,0 @@
1
- /*!
2
- * Crafted with ❤ by Salla
3
- */
4
- import{r as s,h as t,H as i}from"./p-C1Q9TkIB.js";import{g as e,a,c as r,u as d,r as o,m as l,b as n,f as h,d as c,e as u,h as m,i as p}from"./p-C8xwacGT.js";import"./p-CoQJOPRz.js";const f=class{constructor(t){s(this,t),this.loading=!0,this.saveLoading=!1,this.payload={items:{update:[],remove:[],add:[]}},this.expired=!1,this.editPreview=null,this.productSearchQuery="",this.productsListKey=0,this.productsListSource="latest",this.productsListSourceValue="",this.selectedProductToAdd=null,this.addProductQuantity=1,this.addProductLoading=!1,this.addProductConfirmLoading=!1,this.mobileProductsModalMounted=!1,this.isMobileViewport=!1,this.mobileProductsListLoading=!1,this.confirming=!1,this.handleMobileProductSelected=s=>{s.stopPropagation(),this.handleProductSelected(s)},this.productsPanelMobileQuery="(max-width: 768px)",this.handleProductsPanelViewportChange=s=>{this.isMobileViewport=s.matches},this.hasProductTypeFilter=s=>{const t=s.indexOf("?"),i=(t>=0?s.slice(t+1):s).split("#")[0];return Array.from(new URLSearchParams(i)).some((([s,t])=>"product"===t&&/^filters\[types\](?:\[(?:\d*)\])?$/.test(s)))},this.hasExcludedCategoriesFilter=s=>{const t=s.indexOf("?"),i=(t>=0?s.slice(t+1):s).split("#")[0];return Array.from(new URLSearchParams(i)).some((([s])=>/^filters(?:\[|%5B)excluded_categories(?:\]|%5D)(?:\[|%5B)(?:\d*)(?:\]|%5D)$/.test(s)))},this.normalizeProductsListArrayParams=s=>s.replace(/(^|[?&])(includes|source_value|filters(?:\[|%5B)[^&=\]%]+?(?:\]|%5D))(\[|%5B)\d+(\]|%5D)(?==)/gi,((s,t,i,e,a)=>`${t}${i}${e}${a}`)),this.handleBeforeBuildListUrl=s=>{if("salla-order-edit-product-card"!==s.component?.productCardComponent||"string"!=typeof s.url)return;s.url=this.normalizeProductsListArrayParams(s.url),this.hasProductTypeFilter(s.url)||(s.url+=(s.url.includes("?")?"&":"?")+"filters[types][]=product");const t=this.getParsedExcludedCategories();if(t.length>0&&!this.hasExcludedCategoriesFilter(s.url)){const i=t.map((s=>`filters[excluded_categories][]=${encodeURIComponent(s)}`)).join("&");s.url+=`${s.url.includes("?")?"&":"?"}${i}`}},this.defaultProductsListSource="latest",this.debouncedProductSearch=salla.helpers.debounce((s=>this.applyProductSearch(s)),500)}getParsedExcludedCategories(){if(!this.excludedCategories)return[];try{const s="string"==typeof this.excludedCategories?JSON.parse(this.excludedCategories):this.excludedCategories;return Array.isArray(s)?s.filter((s=>Number.isInteger(s)&&s>0)):[]}catch{return[]}}async componentWillLoad(){this.setupProductsPanelViewportQuery(),await salla.onReady(),this.unregisterBeforeBuildListUrlHook=salla.hooks.registerHook("salla-products-list","beforeBuildListUrl",this.handleBeforeBuildListUrl),this.loadFromProp(),this.startExpiryCheck()}disconnectedCallback(){clearInterval(this.expiryInterval),this.unregisterBeforeBuildListUrlHook?.(),this.productsPanelViewportQuery?.removeEventListener("change",this.handleProductsPanelViewportChange),this.mobileProductsModal?.removeEventListener("orderEditProductSelected",this.handleMobileProductSelected)}setupProductsPanelViewportQuery(){"undefined"!=typeof window&&"function"==typeof window.matchMedia&&(this.productsPanelViewportQuery=window.matchMedia(this.productsPanelMobileQuery),this.isMobileViewport=this.productsPanelViewportQuery.matches,this.productsPanelViewportQuery.addEventListener("change",this.handleProductsPanelViewportChange))}startExpiryCheck(){const s=this.order?.customer_editing_session?.ends_at;if(!s)return;const t=()=>new Date(`${s.replace(" ","T")}+03:00`).getTime()<=Date.now();t()?this.expired=!0:this.expiryInterval=setInterval((()=>{t()&&(this.expired=!0,clearInterval(this.expiryInterval))}),1e3)}loadFromProp(){try{if(!this.orderData)return void(this.error=salla.lang.getWithDefault("pages.orders.order_not_found","الطلب غير موجود"));const s="string"==typeof this.orderData?JSON.parse(this.orderData):this.orderData;this.order={...s,items:s.items.map((s=>({...s,selectedOptions:e(s)})))}}catch(s){this.error=salla.lang.getWithDefault("pages.orders.order_not_found","الطلب غير موجود")}finally{this.loading=!1}}applyProductSearch(s){const t=s?.trim()||"",i=t?"search":this.defaultProductsListSource,e="search"===i?JSON.stringify(t):"";this.productsListSource===i&&this.productsListSourceValue===e||(this.productsListSource=i,this.productsListSourceValue=e,this.productsListKey+=1)}handleProductSearch(s){const t=s.target?.value||"";this.productSearchQuery=t,this.debouncedProductSearch(t)}getProductsListKey(s){return`${s}-${this.productsListSource}-${this.productsListSourceValue}-${this.productsListKey}`}handleMobileProductsScroll(s){const t=s.currentTarget;if(t.scrollHeight-t.scrollTop-t.clientHeight>200||this.mobileProductsListLoading)return;const i=t.querySelector("salla-products-list");i&&(this.mobileProductsListLoading=!0,i.loadMore().finally((()=>{this.mobileProductsListLoading=!1})))}waitForNextFrame(){return new Promise((s=>requestAnimationFrame((()=>s(void 0)))))}async openMobileProductsModal(){this.mobileProductsModalMounted||(this.mobileProductsModalMounted=!0,await this.waitForNextFrame()),await(this.mobileProductsModal?.open?.())}setMobileProductsModal(s){this.mobileProductsModal!==s&&(this.mobileProductsModal?.removeEventListener("orderEditProductSelected",this.handleMobileProductSelected),this.mobileProductsModal=s,this.mobileProductsModal?.addEventListener("orderEditProductSelected",this.handleMobileProductSelected))}resetAddProductDrawer(){this.selectedProductToAdd=null,this.addProductQuantity=1,this.addProductLoading=!1,this.addProductConfirmLoading=!1,this.addProductOptions=null}getAddProductMaxQuantity(s=this.selectedProductToAdd){return a(s)}clampAddProductQuantity(s,t=this.selectedProductToAdd){return r(s,this.getAddProductMaxQuantity(t))}getApiErrorMessage(s){return s?.response?.data?.error?.message||s?.response?.data?.message}notifyApiError(s){const t=this.getApiErrorMessage(s);t&&salla.notify.error(t)}async validateAddProductOptions(){return!this.selectedProductToAdd?.options?.length||!!this.addProductOptions&&(await(this.addProductOptions.validateAndScroll?.())??await(this.addProductOptions.reportValidity?.())??!1)}updateLocalOrderItem(s,t,i,e){this.order={...this.order,items:d(this.order.items,s,t,i,e)}}removeLocalOrderItem(s){this.order={...this.order,items:o(this.order.items,s)}}setPayloadItems(s){this.payload={...this.payload,items:l(this.payload.items,s)}}handleAddProductQuantityChange(s){const t=s.detail,i=t?.quantity??parseInt(s.target?.value,10);isNaN(i)||i<1||(this.addProductQuantity=this.clampAddProductQuantity(i))}async handleProductSelected(s){const t=s.detail?.product;if(t?.id&&!this.addProductLoading){this.addProductLoading=!0;try{this.selectedProductToAdd=n(t),this.addProductQuantity=1,await(this.mobileProductsModal?.close?.()),await this.waitForNextFrame(),await(this.addProductDrawer?.open?.())}catch(s){this.notifyApiError(s)}finally{this.addProductLoading=!1}}}async confirmAddProduct(){if(this.selectedProductToAdd?.id&&!this.addProductConfirmLoading){this.addProductConfirmLoading=!0;try{const s=this.getAddProductMaxQuantity(),t=this.clampAddProductQuantity(this.addProductQuantity);t!==this.addProductQuantity&&(this.addProductQuantity=t);const i=this.addProductOptions;if(!await this.validateAddProductOptions())return void salla.notify.error(salla.lang.getWithDefault("common.messages.required_fields","يرجى تعبئة الحقول المطلوبة"));const e=await(i?.getSelectedOptionsData?.())||{},a=await(i?.getOptionsData?.())||this.selectedProductToAdd.options||[],d=h(this.order?.items,this.selectedProductToAdd.id,e);if(d){const i=r(d.quantity+t,s);return this.updateLocalOrderItem(d.id,i,a,e),this.setPayloadItems(d.isNew?{add:c(this.payload.items.add,d.id,i,e)}:{update:u(this.payload.items.update,d.id,i,e)}),void await(this.addProductDrawer?.close?.())}const o=m(this.selectedProductToAdd,t,a,e),l={itemId:o.id,product_id:this.selectedProductToAdd.id,quantity:t,options:e};this.order={...this.order,items:[...this.order.items,o]},this.setPayloadItems({add:[...this.payload.items.add,l]}),await(this.addProductDrawer?.close?.())}catch(s){this.notifyApiError(s)}finally{this.addProductConfirmLoading=!1}}}handleItemUpdated(s){if(!this.order)return;const{itemId:t,quantity:i,options:e,optionDefinitions:d}=s.detail,o=this.order.items.find((s=>s.id===t));if(!o)return;const l=r(i,a(o.product));if(o.isNew)return this.setPayloadItems({add:c(this.payload.items.add,t,l,e)}),void this.updateLocalOrderItem(t,l,d,e);this.setPayloadItems({update:u(this.payload.items.update,t,l,e??{})}),this.updateLocalOrderItem(t,l,d,e)}handleItemRemoved(s){if(!this.order)return;if(this.order.items.length<=1)return void salla.notify.error(salla.lang.getWithDefault("pages.orders.order_cannot_be_empty","لا يمكن إزالة جميع المنتجات من الطلب"));const{itemId:t}=s.detail,i=this.order.items.find((s=>s.id===t));if(i){if(i.isNew)return this.setPayloadItems({add:this.payload.items.add.filter((s=>s.itemId!==t))}),void this.removeLocalOrderItem(t);this.setPayloadItems({update:this.payload.items.update.filter((s=>s.id!==t)),remove:[...this.payload.items.remove,t]}),this.removeLocalOrderItem(t)}}get hasChanges(){return this.payload.items.update.length>0||this.payload.items.remove.length>0||this.payload.items.add.length>0}async saveOrder(){if(this.hasChanges){this.saveLoading=!0;try{const s=await salla.order.api.editOrder(this.orderId,p(this.payload));this.editPreview=s?.data?.data||s?.data,await(this.saveModal?.open?.())}catch(s){this.notifyApiError(s)}finally{this.saveLoading=!1}}}navigateToOrder(){const s=new URL(window.location.href);s.pathname=s.pathname.replace(/\/edit\/?$/,""),s.search="",window.location.href=s.href}handleConfirm(){this.confirming=!0,this.editPreview?.payment?.required&&this.editPreview.payment.payment_url?window.location.href=this.editPreview.payment.payment_url:this.navigateToOrder()}async cancelEditSession(){try{await salla.order.api.cancelEditSession(this.orderId),this.navigateToOrder()}catch(s){this.notifyApiError(s)}}renderProductsPanel(){const s=salla.lang.getWithDefault("pages.orders.add_product_to_order","أضف منتج للطلب");return t("section",{class:"s-order-edit-products-panel"},t("div",{class:"s-order-edit-products-header"},t("h2",{class:"s-order-edit-products-title"},s)),this.renderProductsPickerContent("panel"))}renderProductsPickerContent(s){return t("div",{class:{"s-order-edit-products-picker":!0,"s-order-edit-products-modal-content":"modal"===s}},t("label",{class:"s-order-edit-products-search"},t("i",{class:"sicon-search"}),t("input",{type:"search",class:"s-order-edit-products-search-input",placeholder:salla.lang.getWithDefault("pages.products.search_for_product","ابحث عن منتج"),value:this.productSearchQuery,onInput:s=>this.handleProductSearch(s)})),t("div",{class:"s-order-edit-products-list",onScroll:"modal"===s?s=>this.handleMobileProductsScroll(s):void 0},t("salla-products-list",{key:this.getProductsListKey(s),includes:["options"],source:this.productsListSource,"source-value":this.productsListSourceValue,autoload:!0,"product-card-component":"salla-order-edit-product-card"})))}renderMobileProductsModal(){return t("salla-modal",{ref:s=>this.setMobileProductsModal(s),width:"md",class:"s-order-edit-mobile-products-modal","modal-title":salla.lang.getWithDefault("pages.orders.add_product_to_order","أضف منتج للطلب"),onModalVisibilityChanged:s=>{s.detail||(this.mobileProductsModalMounted=!1)}},this.mobileProductsModalMounted?this.renderProductsPickerContent("modal"):null)}renderAddProductDrawer(){const s=this.selectedProductToAdd,i=s?.name||salla.lang.getWithDefault("common.elements.product","منتج"),e=s?.price,a=this.getAddProductMaxQuantity(s),r=s?`order-edit-add-${s.id}`:"order-edit-add",d={value:this.clampAddProductQuantity(this.addProductQuantity,s)};return a&&(d.max=a),t("salla-modal",{ref:s=>this.addProductDrawer=s,width:"md","modal-title":salla.lang.getWithDefault("pages.orders.add_product_to_order","أضف منتج للطلب"),onModalVisibilityChanged:s=>{s.detail||this.resetAddProductDrawer()}},t("div",{class:"s-order-edit-add-modal"},this.addProductLoading?t("div",{class:"s-order-edit-add-modal-loading"},t("salla-loading",null)):s?t("div",{class:"s-order-edit-add-modal-content"},t("div",{class:"s-order-edit-add-modal-header"},t("div",{class:"s-order-edit-add-modal-media"},s.image?.url&&t("img",{src:s.image.url,alt:s.image.alt||i,class:"s-order-edit-add-modal-image"}),t("div",{class:"s-order-edit-add-modal-details"},t("h3",{class:"s-order-edit-add-modal-name"},i),null!=e&&t("span",{class:"s-order-edit-add-modal-price",innerHTML:salla.money(e)})))),t("div",{class:"s-order-edit-add-modal-quantity"},t("h3",{class:"s-order-edit-add-modal-section-title"},salla.lang.getWithDefault("common.elements.quantity","الكمية")),t("div",{class:"s-order-edit-add-modal-quantity-input"},t("salla-quantity-input",{...d,onChange:s=>this.handleAddProductQuantityChange(s)}))),s.options?.length>0&&t("form",{onSubmit:s=>s.preventDefault()},t("salla-product-options",{ref:s=>this.addProductOptions=s,"product-id":s.id,"unique-key":r,options:JSON.stringify(s.options),key:`${r}-options`})),t("div",{class:"s-order-edit-add-modal-actions"},t("salla-button",{onClick:()=>this.confirmAddProduct(),loading:this.addProductConfirmLoading},salla.lang.getWithDefault("common.elements.confirm","تأكيد")),t("salla-button",{color:"gray",fill:"outline",onClick:()=>this.addProductDrawer?.close?.()},salla.lang.getWithDefault("common.elements.cancel","الغاء")))):null))}renderSaveModal(){const s=this.editPreview,i=s?.totals?.remaining_amount?.amount>0,e=s?.totals?.refund_amount?.amount>0,a=s?.totals?.tax?.amount?.amount;return t("salla-modal",{ref:s=>this.saveModal=s,width:"md",onModalVisibilityChanged:async s=>{s.detail||(this.editPreview=null,this.confirming||await this.cancelEditSession(),this.confirming=!1)}},t("div",{class:"s-order-edit-modal"},t("h2",{class:"s-order-edit-modal-title"},salla.lang.getWithDefault("pages.orders.edit_summary_title","ملخص الطلب بعد التعديل")),s?.items?.length>0&&t("div",{class:"s-order-edit-modal-items"},s.items.map((s=>{const i=this.order?.items?.find((t=>t.id==s.id)),e=i?.product?.image?.url,a=s.options?.join("/ ");return t("div",{class:"s-order-edit-modal-item"},t("div",{class:"s-order-edit-modal-item-start"},e&&t("img",{src:e,alt:s.name,class:"s-order-edit-modal-item-image"}),t("div",null,t("p",{class:"s-order-edit-modal-item-name"},s.name),a&&t("span",{class:"s-order-edit-modal-item-options"},a))),t("div",{class:"s-order-edit-modal-item-end"},t("span",{class:"s-order-edit-modal-item-quantity",dir:"ltr",innerHTML:s.quantity+" x "+s.price.amount}),t("span",{class:"s-order-edit-modal-item-price",innerHTML:salla.money(s.price.amount*s.quantity)})))}))),s?.totals?.updated_products_total&&t("div",{class:"s-order-edit-modal-row"},t("span",{class:"s-order-edit-modal-row-label"},salla.lang.getWithDefault("pages.orders.modified_products_total","مجموع المنتجات المعدلة")),t("span",{class:"s-order-edit-modal-row-value",innerHTML:salla.money(s.totals.updated_products_total.amount)})),a>0&&t("div",{class:"s-order-edit-modal-row"},t("span",{class:"s-order-edit-modal-tax-label"},t("i",{class:"sicon-info-circle s-order-edit-modal-tax-icon"}),salla.lang.getWithDefault("pages.orders.vat","ضريبة القيمة المضافة")),t("span",{class:"s-order-edit-modal-row-value",innerHTML:salla.money(a)})),s?.totals?.total&&t("div",{class:"s-order-edit-modal-total"},t("span",{class:"s-order-edit-modal-total-label"},salla.lang.getWithDefault("pages.orders.order_total","اجمالي الطلب")),t("span",{class:"s-order-edit-modal-total-value",innerHTML:salla.money(s.totals.total.amount)})),e&&t("div",{class:"s-order-edit-modal-refund"},t("i",{class:"sicon-info-circle s-order-edit-modal-refund-icon"}),t("p",{class:"s-order-edit-modal-refund-text"},salla.lang.getWithDefault("pages.orders.refund_message","سيتم تحويل فارق المبلغ على نفس وسيلة الدفع"))),t("div",{class:"s-order-edit-modal-btn-wrapper"},t("salla-button",{onClick:()=>this.handleConfirm()},i?salla.lang.getWithDefault("pages.orders.pay_difference","دفع فارق المبلغ"):e?salla.lang.getWithDefault("pages.orders.confirm_and_receive_difference","تأكيد واستلام فارق المبلغ"):salla.lang.getWithDefault("pages.orders.confirm_changes","تأكيد التعديلات"),t("i",{class:"sicon-keyboard_arrow_left s-order-edit-modal-btn-icon"})))))}render(){if(this.loading)return t(i,null,t("salla-loading",null));if(this.expired)return t(i,null,t("div",{class:"s-order-edit-expired"},t("p",null,salla.lang.getWithDefault("pages.orders.edit_session_expired","انتهت مدة التعديل المتاحة")),t("salla-button",{onClick:()=>this.navigateToOrder()},salla.lang.getWithDefault("pages.orders.back_to_order","العودة إلى تفاصيل الطلب"))));if(this.error||!this.order)return t(i,null,t("div",{class:"s-order-edit-no-content-placeholder"},t("i",{class:"sicon-shopping-bag icon"}),t("p",null,this.error)));const s=this.order.items&&this.order.items.length>0,e=this.order.customer_editing_session?.ends_at;return t(i,null,e&&t("div",{class:"s-order-edit-timer-wrapper"},t("salla-count-down",{prefixText:salla.lang.getWithDefault("pages.orders.edit_within","يمكنك التعديل خلال"),date:e,horizontal:!0,withButton:!0,autoSegments:!0,labeled:!1,size:"sm",color:"primary"})),t("div",{class:"s-order-edit-layout"},this.isMobileViewport?null:this.renderProductsPanel(),t("section",{class:"s-order-edit-order-panel"},t("div",{class:"s-order-edit-items-wrapper"},t("h2",{class:"s-order-edit-items-title"},salla.lang.getWithDefault("pages.orders.order_products","منتجات الطلب")),s?this.order.items.map(((s,i)=>[t("salla-order-edit-item",{key:s.id,item:s,orderId:this.orderId}),i<this.order.items.length-1?t("div",{class:"s-order-edit-items-divider"}):null])):t("div",{class:"s-order-edit-no-content-placeholder"},t("i",{class:"sicon-shopping-bag icon"}),t("p",null,salla.lang.getWithDefault("common.elements.no_items","لا توجد عناصر")))),t("div",{class:"s-order-edit-actions"},t("salla-button",{class:"s-order-edit-mobile-products-trigger",color:"gray",size:"small",fill:"outline",onClick:()=>this.openMobileProductsModal()},t("i",{class:"sicon-add s-order-edit-mobile-products-trigger-icon"}),salla.lang.getWithDefault("pages.orders.add_product","إضافة منتج")),t("salla-button",{onClick:()=>this.saveOrder(),loading:this.saveLoading,size:"small",disabled:!this.hasChanges},salla.lang.getWithDefault("pages.orders.save_changes","حفظ التعديلات")),t("salla-button",{size:"small",color:"gray",fill:"outline",onClick:()=>this.cancelEditSession()},salla.lang.getWithDefault("common.elements.cancel","الغاء"))))),this.renderMobileProductsModal(),this.renderAddProductDrawer(),this.renderSaveModal())}};f.style=":host{display:block}";export{f as salla_order_edit}