@salla.sa/twilight-components 2.14.490 → 2.14.491

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 (323) hide show
  1. package/dist/cjs/{filepond-DMNwZGDe.js → filepond-C8OgCkk4.js} +1 -1
  2. package/dist/cjs/{filepond-plugin-file-poster-CwJqn9cv.js → filepond-plugin-file-poster-W7CIIo06.js} +1 -1
  3. package/dist/cjs/{filepond-plugin-file-validate-size-D8HCq_yt.js → filepond-plugin-file-validate-size-b6owsb9D.js} +1 -1
  4. package/dist/cjs/{filepond-plugin-file-validate-type-DZHIztrf.js → filepond-plugin-file-validate-type-_rafsi9p.js} +1 -1
  5. package/dist/cjs/{filepond-plugin-image-edit-DtW6aab5.js → filepond-plugin-image-edit-7_W-TDnV.js} +1 -1
  6. package/dist/cjs/{filepond-plugin-image-exif-orientation-DlHuggE7.js → filepond-plugin-image-exif-orientation-BqHzmoQr.js} +1 -1
  7. package/dist/cjs/{filepond-plugin-image-preview-rSt0R5Fs.js → filepond-plugin-image-preview-CXYMGZyB.js} +1 -1
  8. package/dist/cjs/{functions-Cl4vQLXn.js → functions-DEYiJNeU.js} +1 -1
  9. package/dist/cjs/{index-CfrGmYJa.js → index-DFAB8ROR.js} +2 -2
  10. package/dist/cjs/{index-CrTL2nRh.js → index-DQxFCAkS.js} +1 -1
  11. package/dist/cjs/loader.cjs.js +1 -1
  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 +1 -1
  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-cart-summary-card.cjs.entry.js +1 -1
  25. package/dist/cjs/salla-cashback-banner.cjs.entry.js +1 -1
  26. package/dist/cjs/salla-comment-factors.cjs.entry.js +1 -1
  27. package/dist/cjs/salla-comment-form_8.cjs.entry.js +1 -1
  28. package/dist/cjs/salla-conditional-offer.cjs.entry.js +1 -1
  29. package/dist/cjs/salla-contacts.cjs.entry.js +1 -1
  30. package/dist/cjs/salla-cookies-bar.cjs.entry.js +1 -1
  31. package/dist/cjs/salla-count-down.cjs.entry.js +1 -1
  32. package/dist/cjs/salla-custom-fields.cjs.entry.js +1 -1
  33. package/dist/cjs/salla-delivery-promise.cjs.entry.js +1 -1
  34. package/dist/cjs/salla-edit-order-button.cjs.entry.js +1 -1
  35. package/dist/cjs/salla-filters-widget.cjs.entry.js +1 -1
  36. package/dist/cjs/salla-filters.cjs.entry.js +1 -1
  37. package/dist/cjs/salla-fulfillment-methods.cjs.entry.js +1 -1
  38. package/dist/cjs/salla-gifting.cjs.entry.js +1 -1
  39. package/dist/cjs/salla-hook.cjs.entry.js +1 -1
  40. package/dist/cjs/salla-infinite-scroll.cjs.entry.js +1 -1
  41. package/dist/cjs/salla-installment.cjs.entry.js +1 -1
  42. package/dist/cjs/salla-list-tile.cjs.entry.js +1 -1
  43. package/dist/cjs/salla-localization-modal.cjs.entry.js +1 -1
  44. package/dist/cjs/salla-login-modal.cjs.entry.js +1 -1
  45. package/dist/cjs/salla-loyalty-banner.cjs.entry.js +2 -2
  46. package/dist/cjs/salla-loyalty-hero_2.cjs.entry.js +2 -2
  47. package/dist/cjs/salla-loyalty-panel.cjs.entry.js +3 -3
  48. package/dist/cjs/salla-loyalty-points-banner.cjs.entry.js +1 -1
  49. package/dist/cjs/salla-loyalty-points-history.cjs.entry.js +1 -1
  50. package/dist/cjs/salla-loyalty-prize-item.cjs.entry.js +1 -1
  51. package/dist/cjs/salla-loyalty-program.cjs.entry.js +3 -3
  52. package/dist/cjs/salla-loyalty-reward.cjs.entry.js +2 -2
  53. package/dist/cjs/salla-loyalty.cjs.entry.js +1 -1
  54. package/dist/cjs/salla-maintenance-alert.cjs.entry.js +1 -1
  55. package/dist/cjs/salla-map_2.cjs.entry.js +1 -1
  56. package/dist/cjs/salla-menu.cjs.entry.js +1 -1
  57. package/dist/cjs/salla-metadata.cjs.entry.js +1 -1
  58. package/dist/cjs/salla-multiple-bundle-product-cart_2.cjs.entry.js +1 -1
  59. package/dist/cjs/salla-multiple-bundle-product-options-modal_2.cjs.entry.js +1 -1
  60. package/dist/cjs/salla-multiple-bundle-product.cjs.entry.js +1 -1
  61. package/dist/cjs/salla-next-order-coupon.cjs.entry.js +1 -1
  62. package/dist/cjs/salla-notification-item.cjs.entry.js +1 -1
  63. package/dist/cjs/salla-notifications.cjs.entry.js +1 -1
  64. package/dist/cjs/salla-offer-modal.cjs.entry.js +1 -1
  65. package/dist/cjs/salla-offer.cjs.entry.js +1 -1
  66. package/dist/cjs/salla-order-branch.cjs.entry.js +1 -1
  67. package/dist/cjs/salla-order-cancel.cjs.entry.js +1 -1
  68. package/dist/cjs/salla-order-details-multiple-bundle-product.cjs.entry.js +1 -1
  69. package/dist/cjs/salla-order-details-options.cjs.entry.js +1 -1
  70. package/dist/cjs/salla-order-details.cjs.entry.js +1 -1
  71. package/dist/cjs/salla-order-edit-item.cjs.entry.js +1 -1
  72. package/dist/cjs/salla-order-edit-product-card.cjs.entry.js +1 -1
  73. package/dist/cjs/salla-order-edit.cjs.entry.js +1 -1
  74. package/dist/cjs/salla-order-options-modal_3.cjs.entry.js +1 -1
  75. package/dist/cjs/salla-order-summary.cjs.entry.js +1 -1
  76. package/dist/cjs/salla-order-totals-card.cjs.entry.js +1 -1
  77. package/dist/cjs/salla-orders.cjs.entry.js +1 -1
  78. package/dist/cjs/salla-payments.cjs.entry.js +1 -1
  79. package/dist/cjs/salla-placeholder.cjs.entry.js +1 -1
  80. package/dist/cjs/salla-price-range.cjs.entry.js +1 -1
  81. package/dist/cjs/salla-product-card-embed.cjs.entry.js +1 -1
  82. package/dist/cjs/salla-product-size-guide.cjs.entry.js +1 -1
  83. package/dist/cjs/salla-products-list.cjs.entry.js +1 -1
  84. package/dist/cjs/salla-quick-order.cjs.entry.js +1 -1
  85. package/dist/cjs/salla-rating-modal-v2.cjs.entry.js +1 -1
  86. package/dist/cjs/salla-rating-modal.cjs.entry.js +1 -1
  87. package/dist/cjs/salla-review-factors-tags.cjs.entry.js +1 -1
  88. package/dist/cjs/salla-reward-action_4.cjs.entry.js +3 -3
  89. package/dist/cjs/salla-scopes.cjs.entry.js +1 -1
  90. package/dist/cjs/salla-search.cjs.entry.js +1 -1
  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/{tracked-promise-ClJBjg9o.js → tracked-promise-BFI0OYlh.js} +1 -1
  106. package/dist/cjs/twilight.cjs.js +1 -1
  107. package/dist/cjs/{vanilla-picker-um8NlppX.js → vanilla-picker-X9clH5_E.js} +1 -1
  108. package/dist/components/index.js +2 -2
  109. package/dist/esm/{filepond-Cg7o_vnN.js → filepond-DnJWzWeX.js} +1 -1
  110. package/dist/esm/{filepond-plugin-file-poster-BJ1q5i_Q.js → filepond-plugin-file-poster-CQjIyjj0.js} +1 -1
  111. package/dist/esm/{filepond-plugin-file-validate-size-KAp2gG4p.js → filepond-plugin-file-validate-size-BHmdR08m.js} +1 -1
  112. package/dist/esm/{filepond-plugin-file-validate-type-D6KC6aKt.js → filepond-plugin-file-validate-type-DKZI4Udo.js} +1 -1
  113. package/dist/esm/{filepond-plugin-image-edit-CsviUA8z.js → filepond-plugin-image-edit-BEu3qWM8.js} +1 -1
  114. package/dist/esm/{filepond-plugin-image-exif-orientation-DORQxh2z.js → filepond-plugin-image-exif-orientation-BnEErRDJ.js} +1 -1
  115. package/dist/esm/{filepond-plugin-image-preview-DiN_MPtQ.js → filepond-plugin-image-preview-C5uMnAXy.js} +1 -1
  116. package/dist/esm/{functions-ChcWts7Y.js → functions-BHv4YCak.js} +1 -1
  117. package/dist/esm/{index-DkTbP5UX.js → index-CrMCOyRb.js} +2 -2
  118. package/dist/esm/{index-nv62Rr6s.js → index-DNoSNI6q.js} +1 -1
  119. package/dist/esm/loader.js +2 -2
  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 +1 -1
  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-cart-summary-card.entry.js +1 -1
  133. package/dist/esm/salla-cashback-banner.entry.js +1 -1
  134. package/dist/esm/salla-comment-factors.entry.js +1 -1
  135. package/dist/esm/salla-comment-form_8.entry.js +1 -1
  136. package/dist/esm/salla-conditional-offer.entry.js +1 -1
  137. package/dist/esm/salla-contacts.entry.js +1 -1
  138. package/dist/esm/salla-cookies-bar.entry.js +1 -1
  139. package/dist/esm/salla-count-down.entry.js +1 -1
  140. package/dist/esm/salla-custom-fields.entry.js +1 -1
  141. package/dist/esm/salla-delivery-promise.entry.js +1 -1
  142. package/dist/esm/salla-edit-order-button.entry.js +1 -1
  143. package/dist/esm/salla-filters-widget.entry.js +1 -1
  144. package/dist/esm/salla-filters.entry.js +1 -1
  145. package/dist/esm/salla-fulfillment-methods.entry.js +1 -1
  146. package/dist/esm/salla-gifting.entry.js +1 -1
  147. package/dist/esm/salla-hook.entry.js +1 -1
  148. package/dist/esm/salla-infinite-scroll.entry.js +1 -1
  149. package/dist/esm/salla-installment.entry.js +1 -1
  150. package/dist/esm/salla-list-tile.entry.js +1 -1
  151. package/dist/esm/salla-localization-modal.entry.js +1 -1
  152. package/dist/esm/salla-login-modal.entry.js +1 -1
  153. package/dist/esm/salla-loyalty-banner.entry.js +2 -2
  154. package/dist/esm/salla-loyalty-hero_2.entry.js +2 -2
  155. package/dist/esm/salla-loyalty-panel.entry.js +3 -3
  156. package/dist/esm/salla-loyalty-points-banner.entry.js +1 -1
  157. package/dist/esm/salla-loyalty-points-history.entry.js +1 -1
  158. package/dist/esm/salla-loyalty-prize-item.entry.js +1 -1
  159. package/dist/esm/salla-loyalty-program.entry.js +3 -3
  160. package/dist/esm/salla-loyalty-reward.entry.js +2 -2
  161. package/dist/esm/salla-loyalty.entry.js +1 -1
  162. package/dist/esm/salla-maintenance-alert.entry.js +1 -1
  163. package/dist/esm/salla-map_2.entry.js +1 -1
  164. package/dist/esm/salla-menu.entry.js +1 -1
  165. package/dist/esm/salla-metadata.entry.js +1 -1
  166. package/dist/esm/salla-multiple-bundle-product-cart_2.entry.js +1 -1
  167. package/dist/esm/salla-multiple-bundle-product-options-modal_2.entry.js +1 -1
  168. package/dist/esm/salla-multiple-bundle-product.entry.js +1 -1
  169. package/dist/esm/salla-next-order-coupon.entry.js +1 -1
  170. package/dist/esm/salla-notification-item.entry.js +1 -1
  171. package/dist/esm/salla-notifications.entry.js +1 -1
  172. package/dist/esm/salla-offer-modal.entry.js +1 -1
  173. package/dist/esm/salla-offer.entry.js +1 -1
  174. package/dist/esm/salla-order-branch.entry.js +1 -1
  175. package/dist/esm/salla-order-cancel.entry.js +1 -1
  176. package/dist/esm/salla-order-details-multiple-bundle-product.entry.js +1 -1
  177. package/dist/esm/salla-order-details-options.entry.js +1 -1
  178. package/dist/esm/salla-order-details.entry.js +1 -1
  179. package/dist/esm/salla-order-edit-item.entry.js +1 -1
  180. package/dist/esm/salla-order-edit-product-card.entry.js +1 -1
  181. package/dist/esm/salla-order-edit.entry.js +1 -1
  182. package/dist/esm/salla-order-options-modal_3.entry.js +1 -1
  183. package/dist/esm/salla-order-summary.entry.js +1 -1
  184. package/dist/esm/salla-order-totals-card.entry.js +1 -1
  185. package/dist/esm/salla-orders.entry.js +1 -1
  186. package/dist/esm/salla-payments.entry.js +1 -1
  187. package/dist/esm/salla-placeholder.entry.js +1 -1
  188. package/dist/esm/salla-price-range.entry.js +1 -1
  189. package/dist/esm/salla-product-card-embed.entry.js +1 -1
  190. package/dist/esm/salla-product-size-guide.entry.js +1 -1
  191. package/dist/esm/salla-products-list.entry.js +1 -1
  192. package/dist/esm/salla-quick-order.entry.js +1 -1
  193. package/dist/esm/salla-rating-modal-v2.entry.js +1 -1
  194. package/dist/esm/salla-rating-modal.entry.js +1 -1
  195. package/dist/esm/salla-review-factors-tags.entry.js +1 -1
  196. package/dist/esm/salla-reward-action_4.entry.js +3 -3
  197. package/dist/esm/salla-scopes.entry.js +1 -1
  198. package/dist/esm/salla-search.entry.js +1 -1
  199. package/dist/esm/salla-skeleton.entry.js +1 -1
  200. package/dist/esm/salla-slider.entry.js +1 -1
  201. package/dist/esm/salla-social-share.entry.js +1 -1
  202. package/dist/esm/salla-social.entry.js +1 -1
  203. package/dist/esm/salla-tab-content_3.entry.js +1 -1
  204. package/dist/esm/salla-tiered-offer.entry.js +1 -1
  205. package/dist/esm/salla-tooltip.entry.js +1 -1
  206. package/dist/esm/salla-trust-badges.entry.js +1 -1
  207. package/dist/esm/salla-user-menu.entry.js +1 -1
  208. package/dist/esm/salla-user-profile.entry.js +1 -1
  209. package/dist/esm/salla-user-settings.entry.js +1 -1
  210. package/dist/esm/salla-verify.entry.js +1 -1
  211. package/dist/esm/salla-wallet.entry.js +1 -1
  212. package/dist/esm/salla-wishlist-actions.entry.js +1 -1
  213. package/dist/esm/{tracked-promise-BhGtlRVb.js → tracked-promise-DoP8oegK.js} +1 -1
  214. package/dist/esm/twilight.js +2 -2
  215. package/dist/esm/{vanilla-picker-CBI_4fLe.js → vanilla-picker-DHvTWQwH.js} +1 -1
  216. package/dist/twilight/{p-acf6a8f0.entry.js → p-01cd666a.entry.js} +1 -1
  217. package/dist/twilight/{p-c774a729.entry.js → p-02bda539.entry.js} +1 -1
  218. package/dist/twilight/{p-0f853d19.entry.js → p-0569fa78.entry.js} +1 -1
  219. package/dist/twilight/{p-ad8111fa.entry.js → p-0a851930.entry.js} +1 -1
  220. package/dist/twilight/{p-bdca0d7a.entry.js → p-0b6623d1.entry.js} +1 -1
  221. package/dist/twilight/{p-2e2d9a86.entry.js → p-0e9f471f.entry.js} +1 -1
  222. package/dist/twilight/{p-a104a885.entry.js → p-0f6bc387.entry.js} +1 -1
  223. package/dist/twilight/{p-dca909c8.entry.js → p-10cfb2e6.entry.js} +1 -1
  224. package/dist/twilight/{p-28318fdf.entry.js → p-1351776d.entry.js} +1 -1
  225. package/dist/twilight/{p-88bc9aff.entry.js → p-14c28037.entry.js} +1 -1
  226. package/dist/twilight/{p-789ede46.entry.js → p-158b25d6.entry.js} +1 -1
  227. package/dist/twilight/{p-f303739b.entry.js → p-180efa36.entry.js} +1 -1
  228. package/dist/twilight/{p-ce0d56c1.entry.js → p-1a89b6e6.entry.js} +1 -1
  229. package/dist/twilight/{p-8549ed85.entry.js → p-1d1598f2.entry.js} +1 -1
  230. package/dist/twilight/{p-c3c9b136.entry.js → p-24a33e42.entry.js} +1 -1
  231. package/dist/twilight/{p-4b659dd8.entry.js → p-2565c8a8.entry.js} +1 -1
  232. package/dist/twilight/{p-ee67787c.entry.js → p-27ba15f4.entry.js} +1 -1
  233. package/dist/twilight/{p-c9dcf28b.entry.js → p-2abf9e37.entry.js} +1 -1
  234. package/dist/twilight/p-2be2e677.entry.js +4 -0
  235. package/dist/twilight/{p-5cd89a8e.entry.js → p-3301eb04.entry.js} +1 -1
  236. package/dist/twilight/{p-0ff0a5cd.entry.js → p-3394398c.entry.js} +1 -1
  237. package/dist/twilight/{p-03cc6665.entry.js → p-346519c6.entry.js} +1 -1
  238. package/dist/twilight/{p-01cd2407.entry.js → p-3642805b.entry.js} +1 -1
  239. package/dist/twilight/{p-75d071f5.entry.js → p-3698e128.entry.js} +1 -1
  240. package/dist/twilight/{p-18dada14.entry.js → p-379db48e.entry.js} +1 -1
  241. package/dist/twilight/{p-fc26088c.entry.js → p-38f0b921.entry.js} +1 -1
  242. package/dist/twilight/{p-f834ded2.entry.js → p-3d3cebb9.entry.js} +1 -1
  243. package/dist/twilight/{p-2414aef5.entry.js → p-3d3f647d.entry.js} +1 -1
  244. package/dist/twilight/{p-d0eb0e3d.entry.js → p-43b6be6a.entry.js} +1 -1
  245. package/dist/twilight/{p-c80b8b30.entry.js → p-46440c88.entry.js} +1 -1
  246. package/dist/twilight/{p-121dc015.entry.js → p-484fde1d.entry.js} +1 -1
  247. package/dist/twilight/{p-51be1247.entry.js → p-4ee6b3e0.entry.js} +1 -1
  248. package/dist/twilight/{p-b4fc5871.entry.js → p-53188a50.entry.js} +1 -1
  249. package/dist/twilight/{p-7331a7d0.entry.js → p-53b388e5.entry.js} +1 -1
  250. package/dist/twilight/{p-d617bb3f.entry.js → p-5619de6e.entry.js} +1 -1
  251. package/dist/twilight/{p-38e6442f.entry.js → p-5832f8ef.entry.js} +1 -1
  252. package/dist/twilight/{p-1182a8df.entry.js → p-5c7dfd69.entry.js} +1 -1
  253. package/dist/twilight/{p-0f859745.entry.js → p-5d757ebc.entry.js} +1 -1
  254. package/dist/twilight/{p-ab8ffcbf.entry.js → p-65745dca.entry.js} +1 -1
  255. package/dist/twilight/{p-28636b6b.entry.js → p-68a0d7de.entry.js} +1 -1
  256. package/dist/twilight/{p-956be35f.entry.js → p-698202a9.entry.js} +1 -1
  257. package/dist/twilight/{p-2656742a.entry.js → p-6b0b391f.entry.js} +1 -1
  258. package/dist/twilight/{p-111e8bd4.entry.js → p-6b14b175.entry.js} +1 -1
  259. package/dist/twilight/{p-bf50723d.entry.js → p-6c03ddfd.entry.js} +1 -1
  260. package/dist/twilight/{p-d7633d87.entry.js → p-6c25d25f.entry.js} +1 -1
  261. package/dist/twilight/{p-9c27c468.entry.js → p-6c7dc86f.entry.js} +1 -1
  262. package/dist/twilight/{p-d27c3758.entry.js → p-6e7c8096.entry.js} +1 -1
  263. package/dist/twilight/{p-57926552.entry.js → p-7269d2ba.entry.js} +1 -1
  264. package/dist/twilight/{p-ca1c1c50.entry.js → p-75d546f8.entry.js} +1 -1
  265. package/dist/twilight/{p-556550d6.entry.js → p-768077d9.entry.js} +1 -1
  266. package/dist/twilight/{p-faf369b8.entry.js → p-79d53d67.entry.js} +1 -1
  267. package/dist/twilight/{p-26211933.entry.js → p-7a4328dd.entry.js} +1 -1
  268. package/dist/twilight/{p-2b6f45d9.entry.js → p-7a8f4587.entry.js} +1 -1
  269. package/dist/twilight/{p-1f43ed62.entry.js → p-7ed01fae.entry.js} +1 -1
  270. package/dist/twilight/{p-f855ad35.entry.js → p-831105b1.entry.js} +1 -1
  271. package/dist/twilight/{p-271b69a0.entry.js → p-83920e60.entry.js} +1 -1
  272. package/dist/twilight/{p-15bc19e7.entry.js → p-84ed1fe9.entry.js} +1 -1
  273. package/dist/twilight/{p-25bfec19.entry.js → p-904d61a5.entry.js} +1 -1
  274. package/dist/twilight/{p-8d83987b.entry.js → p-92212c2c.entry.js} +1 -1
  275. package/dist/twilight/{p-27ae0022.entry.js → p-92f96da3.entry.js} +1 -1
  276. package/dist/twilight/{p-d9e7a2a9.entry.js → p-95fd32d1.entry.js} +1 -1
  277. package/dist/twilight/{p-583b37a5.entry.js → p-967a0b5f.entry.js} +1 -1
  278. package/dist/twilight/{p-0a32b0d6.entry.js → p-96bc00e4.entry.js} +1 -1
  279. package/dist/twilight/{p-CvcP7d1k.js → p-B8h6YT8x.js} +1 -1
  280. package/dist/twilight/{p-B4xPvvKC.js → p-BAPngUXX.js} +1 -1
  281. package/dist/twilight/{p-D3lg7_WR.js → p-By0LfFQa.js} +1 -1
  282. package/dist/twilight/{p-qT0_dvbw.js → p-C9sdTleU.js} +1 -1
  283. package/dist/twilight/{p-CszkocSp.js → p-CEkVObpk.js} +2 -2
  284. package/dist/twilight/{p-495aeIVH.js → p-COcTJoQh.js} +1 -1
  285. package/dist/twilight/{p-Bp81rq7T.js → p-C_9dEE-y.js} +1 -1
  286. package/dist/twilight/{p-DkTbP5UX.js → p-CrMCOyRb.js} +1 -1
  287. package/dist/twilight/{p-cUujZ85s.js → p-D7kAm5HN.js} +1 -1
  288. package/dist/twilight/{p-cbbfec66.entry.js → p-a458dd2a.entry.js} +1 -1
  289. package/dist/twilight/{p-1a3e548c.entry.js → p-a67a69d6.entry.js} +1 -1
  290. package/dist/twilight/{p-af41ebe4.entry.js → p-b02b29fa.entry.js} +1 -1
  291. package/dist/twilight/{p-c583ab13.entry.js → p-b0ac8f2d.entry.js} +1 -1
  292. package/dist/twilight/{p-0de58301.entry.js → p-b6a9c958.entry.js} +1 -1
  293. package/dist/twilight/{p-03ab9920.entry.js → p-b7e45734.entry.js} +1 -1
  294. package/dist/twilight/{p-2bcfed29.entry.js → p-b82011e6.entry.js} +1 -1
  295. package/dist/twilight/{p-5932a5aa.entry.js → p-ba9d9441.entry.js} +1 -1
  296. package/dist/twilight/{p-0e0db003.entry.js → p-bc231a7f.entry.js} +1 -1
  297. package/dist/twilight/{p-02b365bd.entry.js → p-be9f3b55.entry.js} +1 -1
  298. package/dist/twilight/{p-c71a6e9c.entry.js → p-c0fdeae5.entry.js} +1 -1
  299. package/dist/twilight/{p-31c63840.entry.js → p-c1959cfa.entry.js} +1 -1
  300. package/dist/twilight/{p-8430e33c.entry.js → p-c34e8a2f.entry.js} +1 -1
  301. package/dist/twilight/{p-a5310ab5.entry.js → p-c40da673.entry.js} +1 -1
  302. package/dist/twilight/{p-7fa40598.entry.js → p-c4981fc4.entry.js} +1 -1
  303. package/dist/twilight/{p-01240db4.entry.js → p-c75169ad.entry.js} +1 -1
  304. package/dist/twilight/{p-df9267ca.entry.js → p-cd6617a2.entry.js} +1 -1
  305. package/dist/twilight/{p-b7916db2.entry.js → p-ce621f89.entry.js} +1 -1
  306. package/dist/twilight/{p-d981255b.entry.js → p-cf699819.entry.js} +1 -1
  307. package/dist/twilight/{p-c0dd76e3.entry.js → p-d8b9b23d.entry.js} +1 -1
  308. package/dist/twilight/{p-7869e2b4.entry.js → p-d90c6504.entry.js} +1 -1
  309. package/dist/twilight/{p-26594c13.entry.js → p-da875729.entry.js} +1 -1
  310. package/dist/twilight/{p-7092d5e9.entry.js → p-db885288.entry.js} +1 -1
  311. package/dist/twilight/{p-eba770b4.entry.js → p-ea7111b7.entry.js} +1 -1
  312. package/dist/twilight/{p-6c74b5a4.entry.js → p-f2a98eb7.entry.js} +1 -1
  313. package/dist/twilight/{p-75b9780f.entry.js → p-f2c185ff.entry.js} +1 -1
  314. package/dist/twilight/{p-be44f2e4.entry.js → p-f31322cc.entry.js} +1 -1
  315. package/dist/twilight/{p-78364b26.entry.js → p-f6e578f4.entry.js} +1 -1
  316. package/dist/twilight/{p-7cb04076.entry.js → p-f82bf774.entry.js} +1 -1
  317. package/dist/twilight/{p-b87ac43c.entry.js → p-fd3602a9.entry.js} +1 -1
  318. package/dist/twilight/{p-D68AOZPQ.js → p-hej0tW8f.js} +1 -1
  319. package/dist/twilight/{p-D1tp_3zr.js → p-pvcZDEed.js} +1 -1
  320. package/dist/twilight/{p-jgiIvZFz.js → p-vj4RR8x2.js} +1 -1
  321. package/dist/twilight/twilight.esm.js +1 -1
  322. package/package.json +5 -5
  323. package/dist/twilight/p-3956807e.entry.js +0 -4
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r as t,f as a,h as s,H as i,a as e}from"./p-DkTbP5UX.js";import{S as r}from"./p-CeFAfcTv.js";import{S as n}from"./p-lMgMt31Q.js";import{C as o}from"./p-BV4kqbdL.js";import{H as l}from"./p-XnA1YTjA.js";import{I as d}from"./p-C-tzSDxw.js";import{W as h}from"./p-CgR-T_ZS.js";import{e as g}from"./p-DzAIgzdz.js";import"./p-CgtvEd63.js";const c=class{constructor(a){t(this,a),this.hasError=!1,this.showContactWidget=!0,this.images=[],this.productImages={},this.editItemImages=[],this.productReviewFactors={},this.editFactorRatings={},this.productMainRatings={},this.productFactorRatings={},this.contact_body=(t,a,s)=>salla.lang.get("pages.rating.contact_subject",{store:t,id:a,customer:s}),this.editMode=!1,this.defaultMode=!1,this.deleteMode=!1,this.shouldOpenDeleteModal=!1,this.editItem=null,this.allowAttachImages=!1,this.allowContactSupport=!1,this.dragAndDropFilesLabel=salla.lang.get("common.uploader.drag_and_drop_files"),this.contactSubjectLabel=salla.lang.get("pages.rating.contact_subject"),this.editReviewLabel=salla.lang.get("pages.rating.edit_review"),this.allowedImagesTypesLabel=salla.lang.get("common.uploader.allowed_images_types"),this.threeImagesMax=salla.lang.get("common.uploader.max_three_images"),this.areYouSureLabel=salla.lang.get("pages.rating.are_you_sure_you_want_to_delete_review"),this.confirmDeletionLabel=salla.lang.get("pages.rating.confirm_deletion"),this.cancelLabel=salla.lang.get("common.elements.cancel"),this.confirmDeleteBtn=salla.lang.get("common.elements.confirm_delete"),this.updatedSuccessfullyLabel=salla.lang.get("pages.rating.review_updated_successfully"),this.deletedSuccessfullyLabel=salla.lang.get("pages.rating.review_deleted_successfully"),this.contactUsLabel=salla.lang.get("blocks.footer.social"),this.requiredFactorsLabel=salla.lang.get("pages.rating.rate_required_factors"),this.overallProductRatingLabel=salla.lang.get("pages.rating.overall_product_rating"),this.contentRefs=[],this.hiddenInputs=[],this.userFilledFactorKeys={},this.boundRatingRows=new WeakSet,this.stepsCount=0,this.currentIndex=0,this.submitted=[],this.MAX_UPLOAD_LIMIT=3,this.thanksCountdownInterval=null,this.scheduleWizardSetup=!1,salla.lang.onLoaded((()=>{this.contactUsLabel=salla.lang.get("blocks.footer.social");const t=(t,a,s)=>new Promise((i=>{salla.helpers.setNested(salla.lang.messages[t],a,s),i(!0)}));(async()=>{await t("ar.trans","common.uploader.drag_and_drop_files","اسحب الملفات وأفلتها هنا"),await t("en.trans","common.uploader.drag_and_drop_files","Drag and drop files here"),await t("ar.trans","common.uploader.allowed_images_types"," .jpg أو jpeg أو png يُسمح بإضافة صور بصيغة"),await t("en.trans","common.uploader.allowed_images_types","Images in jpg, jpeg, or png format are allowed."),await t("ar.trans","pages.rating.add_images","اضافة صور"),await t("en.trans","pages.rating.add_images","Add Images"),await t("ar.trans","pages.rating.edit_images","تعديل الصور"),await t("en.trans","pages.rating.edit_images","Edit Images"),await t("ar.trans","pages.rating.edit_review","تعديل التقييم"),await t("en.trans","pages.rating.edit_review","Edit review"),await t("ar.trans","pages.rating.confirm_deletion","تأكيد حذف التقييم"),await t("en.trans","pages.rating.confirm_deletion","Confirm review deletion"),await t("ar.trans","pages.rating.are_you_sure_you_want_to_delete_review","هل أنت متأكد من حذف تقييمك؟"),await t("en.trans","pages.rating.are_you_sure_you_want_to_delete_review","Are you sure you want to delete your review?"),await t("ar.trans","pages.rating.review_updated_successfully","تم تعديل التقييم بنجاح"),await t("en.trans","pages.rating.review_updated_successfully","The review has been successfully updated."),await t("ar.trans","pages.rating.review_deleted_successfully","تم حذف التقييم بنجاح"),await t("en.trans","pages.rating.review_deleted_successfully","The review has been successfully deleted."),await t("ar.trans","pages.rating.images_count","الصور ( :current من أصل :total )"),await t("en.trans","pages.rating.images_count","Images ( :current of :total )"),await t("ar.trans","common.uploader.max_three_images",`.أضف ${this.MAX_UPLOAD_LIMIT} صور كحد أقصى`),await t("en.trans","common.uploader.max_three_images",`Add up to ${this.MAX_UPLOAD_LIMIT} images maximum.`),await t("ar.trans","common.elements.confirm_delete","تأكيد الحذف"),await t("en.trans","common.elements.confirm_delete","Confirm deletion"),await t("ar.trans","pages.rating.rate_required_factors","يرجى تقييم جميع المعايير لإتمام مراجعتك."),await t("en.trans","pages.rating.rate_required_factors","Please rate all required factors to complete your review."),await t("ar.trans","pages.rating.overall_product_rating","التقييم العام للمنتج"),await t("en.trans","pages.rating.overall_product_rating","Overall product rating"),this.dragAndDropFilesLabel=salla.lang.get("common.uploader.drag_and_drop_files"),this.allowedImagesTypesLabel=salla.lang.get("common.uploader.allowed_images_types"),this.threeImagesMax=salla.lang.get("common.uploader.max_three_images"),this.contactSubjectLabel=salla.lang.get("pages.rating.contact_subject"),this.editReviewLabel=salla.lang.get("pages.rating.edit_review"),this.areYouSureLabel=salla.lang.get("pages.rating.are_you_sure_you_want_to_delete_review"),this.confirmDeletionLabel=salla.lang.get("pages.rating.confirm_deletion"),this.cancelLabel=salla.lang.get("common.elements.cancel"),this.updatedSuccessfullyLabel=salla.lang.get("pages.rating.review_updated_successfully"),this.deletedSuccessfullyLabel=salla.lang.get("pages.rating.review_deleted_successfully"),this.confirmDeleteBtn=salla.lang.get("common.elements.confirm_delete"),this.requiredFactorsLabel=salla.lang.get("pages.rating.rate_required_factors"),this.overallProductRatingLabel=salla.lang.get("pages.rating.overall_product_rating"),this.contact_body=(t,a,s)=>salla.lang.get("pages.rating.contact_body",{store:t,id:a,customer:s})})()}))}syncStoreSettings(){this.orderId||(this.orderId=salla.config.get("page.id")),this.allowAttachImages=!!salla.config.get("store.settings.rating.allow_attach_images"),this.allowContactSupport=!!salla.config.get("store.settings.rating.allow_contact_support")}getRatingOrderId(){return this.orderId||salla.config.get("page.id")}getSubmitOrderId(){return this.orderId}isCustomerOrderShape(t){if(!t||"object"!=typeof t)return!1;const a=t;return!!a.rating&&(Array.isArray(a.items)||Array.isArray(a.products)||Array.isArray(a.rating?.product)||Array.isArray(a.rating?.products))}getBootstrapOrder(){const t=salla.config.get("page");if(this.isCustomerOrderShape(t))return t;if(t&&"object"==typeof t){const a=t;if(Array.isArray(a.products))return t;const s=a.order;if(this.isCustomerOrderShape(s))return s}}async loadCustomerOrderForEdit(){const t=this.getBootstrapOrder();if(t?.rating?.product||t?.rating?.products)this.order=t;else try{const t=await salla.api.withoutNotifier((()=>salla.order.api.getDetails(this.getRatingOrderId())));t?.data&&(this.order=t.data)}catch(t){if(!this.order){const t=await salla.api.withoutNotifier((()=>salla.rating.api.order(this.getRatingOrderId())));this.order=t.data}}}getOrderProductRatings(t=this.order){return t?.rating?[...this.normalizeToArray(t.rating.product),...this.normalizeToArray(t.rating.products)]:[]}getMatchedProductRating(t=this.order,a,s){return this.getOrderProductRatings(t).find((t=>Number(t?.id??t?.feedback_id)===Number(s)||Number(t?.product_id??t?.product?.id)===Number(a)))}hasRatingFeedback(t){const a=t?.rating;return null!=a&&""!==a&&Number(a)>0}isTestimonialsEnabled(t=this.order){return!(!1===t?.testimonials_enabled||this.hasRatingFeedback(t?.store?.feedback)||!0!==t?.testimonials_enabled&&!t?.allowed_ratings?.testimonials_enabled)}isProductsEnabled(t=this.order){return!1!==t?.products_enabled&&this.getRateableProducts(t).length>0}isShippingEnabled(t=this.order){return!(!1===t?.shipping_enabled||this.hasRatingFeedback(t?.shipping?.feedback)||!t?.shipping?.company||!0!==t?.shipping_enabled&&!t?.allowed_ratings?.shipping_enabled)}getOrderProducts(t=this.order){return Array.isArray(t?.products)?t.products.filter((t=>t?.product?.id)):[]}getRateableProducts(t=this.order){return this.getOrderProducts(t).filter((t=>!this.hasRatingFeedback(t?.feedback)))}getStepsCount(t=this.order){if(!t)return 0;let a=0;return this.isTestimonialsEnabled(t)&&a++,this.isProductsEnabled(t)&&(a+=this.getRateableProducts(t).length),this.isShippingEnabled(t)&&t.shipping?.company&&a++,a}afterOrderLoaded(){this.stepsCount=this.getStepsCount(),this.scheduleWizardSetup=!0,a(this)}async open(){return await salla.onReady(),this.syncStoreSettings(),this.defaultMode=!0,this.currentIndex=0,this.submitted=[],new Promise((t=>{setTimeout((()=>{this.modal.open().then((()=>this.order||salla.api.withoutNotifier((()=>salla.rating.api.order(this.getRatingOrderId()))).then((async t=>{this.order=t.data,this.productReviewFactors=await this.fetchAllProductReviewFactors(t.data)})))).then((()=>this.modal.setTitle(`${salla.lang.get("pages.rating.rate_order")} <span class="unicode">(#${this.order.id})</span>`))).then((()=>{const t={};for(const a of this.getRateableProducts())t[a.product.id]=[];this.productImages=t})).then((()=>this.modal.stopLoading())).then((()=>this.afterOrderLoaded())).catch((a=>{t(!1),this.hasError=!0,this.errorMessage=a.response?.data?.error?.message||a.response?.data,this.modal.stopLoading()})),t(!0)}),50)}))}async openEditModal(t){await salla.onReady(),this.syncStoreSettings(),this.defaultMode=!1,this.editMode=!0,this.editType=t.type,this.editFeedbackId=t.feedback_id;try{await this.fetchEditItem(t.feedback_id),"product"===this.editType&&this.editItem?.product?.id&&(await this.loadCustomerOrderForEdit(),await this.ensureProductFactorsLoaded(this.editItem.product.id),this.editFactorRatings={...this.buildEditFactorRatings(this.editItem.product.id)},this.markExistingFactorRatingsAsUserFilled(this.editItem.product.id,this.editFactorRatings)),this.editModal.open()}catch(t){this.hasError=!0,this.errorMessage=t.response?.data?.error?.message||t.response?.data}}async fetchEditItem(t){const a=`rating/${t}/show`,s=await salla.api.request(a);this.editItem=s.data,this.allowAttachImages&&"product"==this.editType&&this.editItem.images.length&&(this.editItemImages=this.editItem.images.map((t=>({id:`${Math.floor(100+900*Math.random())}`,url:t}))))}async editReview(){const t=`rating/${this.editFeedbackId}`;let a;if("product"===this.editType){const t=this.editModal.querySelector('[data-type="products"]')||this.currentTab;a=this.buildProductRatingPayload(this.collectFormData(t),t),!a.product_id&&this.editItem?.product?.id&&(a.product_id=String(this.editItem.product.id))}else a=this.collectFormData(this.editModal),a.images&&(a.images=a.images.split(","));await salla.api.request(t,a,"put").then((t=>{this.editModal.close(),salla.notify.success(t.message||this.updatedSuccessfullyLabel),setTimeout((()=>{window.location.reload()}),500)}))}async openDeleteModal(t){return this.defaultMode=!1,this.deleteMode=!0,this.deleteFeedbackId=t.feedback_id,this.shouldOpenDeleteModal=!0,new Promise((t=>{setTimeout((()=>{this.deleteModal.open().then((()=>t(!0)))}),50)}))}async deleteReview(){const t=`rating/${this.deleteFeedbackId}`;await salla.api.request(t,null,"delete").then((()=>{this.deleteModal.close(),salla.notify.success(this.deletedSuccessfullyLabel),setTimeout((()=>{window.location.reload()}),500)}))}async close(){return this.modal.close()}handleWizard(){this.steps=this.modal.querySelectorAll(".s-rating-modal-step"),this.dots=this.modal.querySelectorAll(".s-rating-modal-step-dot"),0!==this.stepsCount?this.showActiveStep():this.showThankYou()}refreshWizardRefs(){this.modal&&(this.steps=this.modal.querySelectorAll(".s-rating-modal-step"),this.dots=this.modal.querySelectorAll(".s-rating-modal-step-dot"))}showActiveStep(t=null){if(this.refreshWizardRefs(),this.currentTab=t||this.steps[this.currentIndex],!this.currentTab)return;l.toggleClassIf(".s-rating-modal-step-dot","s-rating-modal-bg-gray","s-rating-modal-bg-primary",(t=>t!=this.dots[this.currentIndex])).toggleClassIf(".s-rating-modal-step","s-rating-modal-active","s-rating-modal-hidden",(t=>t==this.currentTab)),0!==this.currentIndex&&(l.toggleElementClassIf(this.currentTab,"s-rating-modal-unactive","s-rating-modal-hidden",(()=>!0)),setTimeout((()=>l.toggleElementClassIf(this.currentTab,"s-rating-modal-active","s-rating-modal-unactive",(()=>!0))),300));const a=this.steps[this.currentIndex+1]?.dataset.type;this.nextBtn?.setText(a?`${salla.lang.get("pages.rating.rate")} ${salla.lang.get(`pages.rating.${a}`)}`:salla.lang.get("pages.rating.send_ratings")),setTimeout((()=>this.updateBodyHeight()),0),setTimeout((()=>this.updateBodyHeight()),150)}updateBodyHeight(){this.body&&this.currentTab&&(this.body.style.height="products"!==this.currentTab.dataset.type?`${this.currentTab.offsetHeight+(this.editMode?60:0)}px`:"auto")}previousTab(){this.currentIndex>0&&this.currentIndex--,l.toggleElementClassIf(this.backBtn,"s-rating-modal-unvisiable","block",(()=>0==this.currentIndex)),this.showActiveStep()}async submit(){this.refreshWizardRefs();try{this.submittedBefore()||this.validate(),salla.config.canLeave=!1,await this.nextBtn.load(),this.submittedBefore()||await this.sendFeedback(),this.currentTab?.querySelectorAll("[name],.s-rating-modal-btn-star").forEach((t=>t.setAttribute("disabled",""))),this.currentIndex<this.stepsCount&&this.currentIndex++,this.showActiveStep(),l.toggleClassIf("#prev-btn","block","s-rating-modal-unvisiable",(()=>!0)),this.currentIndex===this.stepsCount&&(this.showThankYou(),this.showContactWidget=!1)}finally{this.nextBtn.stop(),salla.config.canLeave=!0}}submittedBefore(){return this.submitted.includes(this.currentIndex)}getRatingHiddenInput(t){const a=t,s=a.querySelector?.(".rating_hidden_input");if(s?.name)return s;const i=a.querySelector?.("salla-rating-stars");return i?.shadowRoot?.querySelector(".rating_hidden_input")||null}collectNamedInputs(t){const a=new Set,s=[],i=t=>{t?.name&&!a.has(t)&&(a.add(t),s.push(t))};return t.querySelectorAll("[name]").forEach((t=>{i(t)})),t.querySelectorAll("salla-rating-stars").forEach((t=>{i(this.getRatingHiddenInput(t))})),s}normalizeFactorsList(t){return t?Array.isArray(t)?t:"object"==typeof t?Object.values(t).filter((t=>t&&"object"==typeof t)):[]:[]}validate(t=null,a=null){if(!t&&"products"===this.currentTab.dataset.type)return void this.currentTab.querySelectorAll(".rating-outer-form").forEach((t=>this.validate(t,"product")));const s=(t=t||this.currentTab).querySelector(".s-rating-modal-product-rating-row-main"),i=this.getRatingHiddenInput(s||t),e=i?.value,r=t.querySelector(".s-rating-modal-validation-msg");if(a=a||t.dataset.type,!e)throw r.innerHTML=salla.lang.get(`pages.rating.rate_${a}_stars`).replace(" (:item)",""),new Error(r.innerHTML);if("product"===a&&Array.from(t.querySelectorAll('.s-rating-modal-product-factor-row[data-required="true"]')).some((t=>{const a=this.getRatingHiddenInput(t);return!a?.value})))throw r.innerHTML=this.requiredFactorsLabel,new Error(r.innerHTML);r.innerHTML=""}collectFormData(t=this.currentTab){const a={};return this.collectNamedInputs(t).forEach((t=>{const s=salla.helpers.inputData(t.name,t.value,a);a[s.name]=s.value})),a}buildProductRatingPayload(t,a=this.currentTab){if(!t.rating){const s=a.querySelector(".s-rating-modal-product-rating-row-main"),i=this.getRatingHiddenInput(s||a);i?.value&&(t.rating=i.value)}const s=Number(t.product_id);let i=[];t.images?i="string"==typeof t.images?t.images.split(",").filter(Boolean):t.images:this.editMode&&this.allowAttachImages&&s?i=this.editItemImages.map((t=>t.url)):this.allowAttachImages&&s&&(i=(this.productImages[s]||[]).map((t=>t.url)));const e=this.normalizeFactorsList(t.factors).filter((t=>t?.id&&t?.rating)).map((t=>({id:String(t.id),rating:String(t.rating)})));return{order_id:this.getSubmitOrderId(),product_id:String(t.product_id),rating:String(t.rating),comment:t.comment||t.content||"",images:i,factors:e,type:"products"}}async sendFeedback(){this.refreshWizardRefs();const t=this.currentTab?.dataset?.type;if("products"===t){const t=this.collectFormData(this.currentTab),a=this.buildProductRatingPayload(t,this.currentTab);if(!a.product_id||!a.rating)throw new Error("Missing product rating data");const s=await salla.rating.api.products(a);return this.submitted.push(this.currentIndex),s}const a=this.collectFormData(this.currentTab);if(0===Object.keys(a).length)return;a.order_id=this.getSubmitOrderId(),a.type=t;const s=await salla.rating.api[t](a);return this.submitted.push(this.currentIndex),s}clearThanksCountdown(){null!==this.thanksCountdownInterval&&(clearInterval(this.thanksCountdownInterval),this.thanksCountdownInterval=null)}showThankYou(){let t=10;this.clearThanksCountdown(),this.thanksCountdownInterval=setInterval((()=>{this.thanksTime.innerHTML="00:0"+t--,t>0||(this.clearThanksCountdown(),this.thanksTime.remove(),this.close().then((()=>window.location.reload())))}),1e3),this.modal.querySelector(".s-rating-modal-footer").classList.add("s-rating-modal-unvisiable"),this.showActiveStep(this.thanksTab)}getFilepondPlaceholder(){return`<div class="s-rating-modal-filepond-placeholder"><span class="s-rating-modal-filepond-placeholder-icon">${d}</span><p class="s-rating-modal-filepond-placeholder-text">${this.dragAndDropFilesLabel}<br>\n <span> ${this.allowedImagesTypesLabel} <br> ${this.threeImagesMax} </span></p></div>`}getCustomerName(){return`${salla.config.get("user.first_name")||salla.storage.get("user.first_name")||""} ${salla.config.get("user.last_name")||salla.storage.get("user.last_name")||""}`}normalizeReviewFactorsPayload(t){const a=t?.data??t?.factors;return Array.isArray(a)?a.flatMap((t=>{const a=Array.isArray(t?.items)?[...t.items]:null;if(a?.length){a.sort(((t,a)=>(Number(t?.sort)||0)-(Number(a?.sort)||0)));const s=!!t?.is_required;return a.filter((t=>null!=t?.id&&""!==t?.id)).map((t=>({id:t.id,name:t?.name,required:s})))}return null==t?.id||""===t?.id?[]:[{id:t.id,name:t?.name,required:t?.required??t?.is_required??!1}]})):[]}async fetchProductReviewFactors(t){try{const a=await salla.api.request(`review/factors/${t}/form`);return this.normalizeReviewFactorsPayload(a)}catch(t){return[]}}async fetchAllProductReviewFactors(t){const a=this.getRateableProducts(t);if(!a.length)return{};const s=await Promise.all(a.map((async t=>{const a=await this.fetchProductReviewFactors(t.product.id);return[t.product.id,a]})));return Object.fromEntries(s)}async ensureProductFactorsLoaded(t){if(!t||this.productReviewFactors[t])return;const a=await this.fetchProductReviewFactors(t);this.productReviewFactors={...this.productReviewFactors,[t]:a}}getFactorFieldName(t,a,s){return t?`${t}[factors][${a}][${s}]`:`factors[${a}][${s}]`}normalizeToArray(t){return null==t?[]:Array.isArray(t)?t:[t]}isFactorReviewsList(t){return Array.isArray(t)&&t.length>0&&t.every((t=>t&&"object"==typeof t&&(void 0!==t.rating||void 0!==t.stars||void 0!==t.value)))}getFactorReviewsFromRecord(t){if(!t)return[];for(const a of["factor_reviews","review_factors","factors"]){const s=t[a];if(this.isFactorReviewsList(s))return s}return[]}getEditFactorReviewsList(t){const a=[this.order,this.getBootstrapOrder()].filter(Boolean);for(const s of a){const a=this.getMatchedProductRating(s,t,this.editFeedbackId),i=this.getFactorReviewsFromRecord(a);if(i.length)return i}const s=this.getOrderProducts(this.order).find((a=>Number(a.product?.id)===Number(t))),i=[this.editItem?.factor_reviews,this.editItem?.review_factors,this.editItem?.product?.review_factors,this.editItem?.product?.factor_reviews,this.editItem?.factors,s?.factor_reviews,s?.review_factors,s?.feedback?.factor_reviews];for(const t of i)if(Array.isArray(t)&&t.length>0)return t;return[]}getFactorKey(t,a){return null!=t.id&&""!==t.id?`id:${t.id}`:t.name?`name:${t.name.trim()}`:`index:${a}`}getFactorRatingsForProduct(t){return this.editMode?this.editFactorRatings:this.productFactorRatings[t]||{}}setFactorRatingsForProduct(t,a){this.editMode?this.editFactorRatings=a:this.productFactorRatings={...this.productFactorRatings,[t]:a}}markExistingFactorRatingsAsUserFilled(t,a){const s=this.productReviewFactors[t]||[],i=new Set;s.forEach(((t,s)=>{const e=this.getFactorKey(t,s),r=void 0!==t.id?a[String(t.id)]:void 0,n=t.name?a[t.name.trim()]:void 0;void 0===r&&void 0===n&&void 0===a[`__index_${s}`]||i.add(e)})),this.userFilledFactorKeys[t]=i}shouldAutofillFactors(t){return 4===t||5===t}autofillUnfilledFactors(t,a){const s=this.productReviewFactors[t]||[];if(!s.length)return;const i=this.userFilledFactorKeys[t]||new Set,e={...this.getFactorRatingsForProduct(t)},r=this.shouldAutofillFactors(a);let n=!1;s.forEach(((t,s)=>{const o=this.getFactorKey(t,s);if(!i.has(o)){if(r)return void 0!==t.id&&(e[String(t.id)]=a),t.name&&(e[t.name.trim()]=a),e[`__index_${s}`]=a,void(n=!0);void 0!==t.id&&void 0!==e[String(t.id)]&&(delete e[String(t.id)],n=!0),t.name&&void 0!==e[t.name.trim()]&&(delete e[t.name.trim()],n=!0),void 0!==e[`__index_${s}`]&&(delete e[`__index_${s}`],n=!0)}})),n&&this.setFactorRatingsForProduct(t,e)}handleMainRatingChange(t,a){this.editMode?this.editMainRating=a:this.productMainRatings={...this.productMainRatings,[t]:a},this.autofillUnfilledFactors(t,a)}handleFactorRatingChange(t,a,s){this.userFilledFactorKeys[t]||(this.userFilledFactorKeys[t]=new Set),this.userFilledFactorKeys[t].add(a);const i=this.productReviewFactors[t]||[],e=i.findIndex(((t,s)=>this.getFactorKey(t,s)===a));if(e<0)return;const r=i[e],n={...this.getFactorRatingsForProduct(t)};void 0!==r.id&&(n[String(r.id)]=s),r.name&&(n[r.name.trim()]=s),n[`__index_${e}`]=s,this.setFactorRatingsForProduct(t,n)}setupProductRatingAutofill(t,a){t&&!this.boundRatingRows.has(t)&&(this.boundRatingRows.add(t),t.addEventListener("click",(s=>{const i=s.target;if(!i.closest(".s-rating-stars-btn-star"))return;const e=i.closest(".s-rating-modal-product-rating-row-main"),r=i.closest(".s-rating-modal-product-factor-row");requestAnimationFrame((()=>{if(e&&t.contains(e)){const t=Number(this.getRatingHiddenInput(e)?.value);t>0&&this.handleMainRatingChange(a,t)}else if(r&&t.contains(r)){const t=r.getAttribute("data-factor-key"),s=Number(this.getRatingHiddenInput(r)?.value);t&&s>0&&this.handleFactorRatingChange(a,t,s)}}))})))}buildEditFactorRatings(t){return this.getEditFactorReviewsList(t).reduce(((t,a,s)=>{const i=Number(a?.rating??a?.stars??a?.value);if(Number.isNaN(i))return t;const e=a?.id??a?.factor_id;return null!=e&&""!==e&&(t[String(e)]=i),a?.name&&(t[a.name.trim()]=i),t[`__index_${s}`]=i,t}),{})}renderProductStep(t,a){return s("section",{class:"s-rating-modal-step s-rating-modal-hidden","data-type":"products","data-product-id":t.product.id,key:t.product.id},s("div",{class:"s-rating-modal-product"},s("div",{class:"rating-outer-form","data-stars-error":salla.lang.get("pages.rating.rate_product_stars")},s("div",{class:"s-rating-modal-product-details"},s("div",{class:"s-rating-modal-product-info-row"},s("div",{class:"s-rating-modal-product-img-wrap"},s("img",{src:t.product.thumbnail,alt:t.product.name,class:"s-rating-modal-product-img"})),s("h3",{class:"s-rating-modal-product-title"},t.product.name)),this.renderProductReviewFactors(t.product.id,0,{fieldPrefix:""}),s("input",{type:"hidden",name:"product_id",value:t.product.id}),s("textarea",{placeholder:salla.lang.get("pages.rating.write_product_rate"),name:"comment",class:"s-rating-modal-comment"}),s("small",{class:"s-rating-modal-validation-msg"}))),this.allowAttachImages&&s("div",{class:"s-rating-modal-uploader is-opened",ref:t=>this.contentRefs[a]=t},s("salla-file-upload",{name:"image",maxFilesCount:this.MAX_UPLOAD_LIMIT,imagePreviewHeight:117,"instant-upload":!0,type:"feedback",payloadName:"files[]",id:`file-${t.product.id}`,title:t.product.name,allowMultiple:!0,instantUpload:!0,accept:"image/png, image/jpeg, image/jpg",url:salla.url.api("upload"),onUploaded:s=>{this.productImages={...this.productImages,[t.product.id]:[...this.productImages[t.product.id]||[],s.detail]},this.hiddenInputs[a].value=this.productImages[t.product.id].map((t=>t.url)).join(",")},onRemoved:s=>{const i=s.detail;i&&this.productImages[t.product.id]&&(this.productImages={...this.productImages,[t.product.id]:this.productImages[t.product.id].filter((t=>t.id!==i))},this.hiddenInputs[a].value=this.productImages[t.product.id].map((t=>t.url)).join(","))},labelIdle:this.getFilepondPlaceholder()}),s("input",{type:"hidden",name:"images",value:(this.productImages[t.product.id]||[]).map((t=>t.url)).join(","),ref:t=>this.hiddenInputs[a]=t}),this.renderUploadedImagesCount(t.product.id))))}renderProductReviewFactors(t,a,i={}){const e=this.productReviewFactors[t]||[],r=i.fieldPrefix??`products[${a}]`,n=r?`${r}[rating]`:"rating",o={...this.editMode?{}:this.productFactorRatings[t]||{},...i.factorRatings||{}},l=Number(i.mainRating??(this.editMode?this.editMainRating:this.productMainRatings[t])),d=!Number.isNaN(l),h=(t,a)=>{const s=void 0!==t.id?o[String(t.id)]:void 0,i=t.name?o[t.name.trim()]:void 0,e=Number(s??i??o[`__index_${a}`]);return Number.isNaN(e)?void 0:e};return s("div",{class:"s-rating-modal-product-rating-rows",ref:a=>this.setupProductRatingAutofill(a,t)},s("div",{class:"s-rating-modal-product-rating-row s-rating-modal-product-rating-row-main"},s("span",{class:"s-rating-modal-product-factor-name"},this.overallProductRatingLabel,s("span",{class:"s-rating-modal-product-factor-required"},"*")),s("salla-rating-stars",{size:"medium",name:n,key:d?`main-rating-${l}`:"main-rating-empty",value:d?l:void 0,editable:d,withLabel:!0,labelBeforeStars:!0,tag:!1})),e.map(((t,a)=>s("div",{class:"s-rating-modal-product-rating-row s-rating-modal-product-factor-row px-3","data-required":t.required?"true":"false","data-factor-key":this.getFactorKey(t,a)},s("input",{type:"hidden",name:this.getFactorFieldName(r,a,"name"),value:t.name}),!!t.id&&s("input",{type:"hidden",name:this.getFactorFieldName(r,a,"id"),value:String(t.id)}),s("span",{class:"s-rating-modal-product-factor-name"},t.name,t.required?s("span",{class:"s-rating-modal-product-factor-required"},"*"):""),s("salla-rating-stars",{size:"medium",name:this.getFactorFieldName(r,a,"rating"),key:`factor-rating-${t.id??a}-${h(t,a)??0}`,value:h(t,a),editable:i.alwaysEditable||"number"==typeof h(t,a),withLabel:!0,labelBeforeStars:!0,tag:!1})))))}handleSendEmail(){const t=`${this.contactSubjectLabel} #${this.order.id}`,a=this.contact_body(salla.config.get("store.name"),this.order.id,this.getCustomerName()),s=`mailto:${salla.config.get("store.contacts.email")}?subject=${encodeURIComponent(t)}&body=${encodeURIComponent(a)}`;window.open(s,"_blank")}handleSendWhatsApp(){const t=this.contact_body(salla.config.get("store.name"),this.order.id,this.getCustomerName()),a=`https://wa.me/${salla.config.get("store.contacts.whatsapp")}?text=${encodeURIComponent(t)}`;window.open(a,"_blank")}resetData(t){t.detail||(this.clearThanksCountdown(),this.modal?.close(),this.editItem=null,this.editItemImages=[],this.editFactorRatings={},this.productMainRatings={},this.productFactorRatings={},this.editMainRating=void 0,this.userFilledFactorKeys={},this.hiddenInputs[1]&&(this.hiddenInputs[1].value=""),this.deleteFeedbackId=null,this.editFeedbackId=null,this.shouldOpenDeleteModal=!1,this.editMode=!1,this.deleteMode=!1,this.defaultMode=!1,this.currentIndex=0,this.submitted=[],this.scheduleWizardSetup=!1)}getDeleteModal(){return s("salla-modal",{ref:t=>this.deleteModal=t,width:"xs",onModalVisibilityChanged:t=>this.resetData(t)},s("div",{class:"s-rating-modal-delete-wrapper",ref:t=>this.body=t},s("h3",null,this.confirmDeletionLabel),s("p",null,this.areYouSureLabel),s("div",{class:"s-rating-modal-delete-actions"},s("salla-button",{loaderPosition:"center",onClick:()=>this.deleteReview()},this.confirmDeleteBtn),s("salla-button",{color:"danger",fill:"outline",onClick:()=>this.deleteModal.close()},this.cancelLabel))))}renderUploadedImagesCount(t){const a=this.editMode?this.editItemImages.length:(this.productImages[t]||[]).length;return s("span",{class:"s-rating-modal-upload-count"},salla.lang.choice("pages.rating.images_count",a,{current:a,total:this.MAX_UPLOAD_LIMIT}))}getEditModal(){return s("salla-modal",{ref:t=>this.editModal=t,width:"md",onModalVisibilityChanged:t=>this.resetData(t)},s("div",{class:"s-rating-modal-edit-wrapper",ref:t=>this.body=t},"store"===this.editType&&this.editItem?s("div",{class:"rating-outer-form s-rating-modal-step-wrap s-rating-modal-step","data-type":"store",ref:t=>this.currentTab=t},s("div",{class:"s-rating-modal-rounded-icon"},s("img",{src:salla.config.get("store.logo","https://assets.salla.sa/cp/assets/images/logo-new.png"),alt:"store name",class:"s-rating-modal-store-logo"})),s("h2",{class:"s-rating-modal-title"},salla.lang.get("pages.rating.rate_the_store")),s("div",{class:"s-rating-modal-stars-company"},s("salla-rating-stars",{withLabel:!0,size:"large",editable:!0,value:this.editItem.stars})),s("textarea",{name:"content",value:this.editItem.content,class:"s-rating-modal-comment",placeholder:salla.lang.get("pages.rating.write_store_rate")}),s("small",{class:"s-rating-modal-validation-msg"})):null,"shipping"===this.editType&&this.editItem?s("div",{class:"rating-outer-form s-rating-modal-step-wrap s-rating-modal-step","data-type":"shipping",ref:t=>this.currentTab=t},this.editItem.shipping.logo?s("div",{class:"s-rating-modal-rounded-icon"},s("img",{src:this.editItem.shipping.logo,class:"s-rating-modal-shipping-logo",alt:this.editItem.shipping.name})):s("span",{class:"s-rating-modal-icon",innerHTML:n}),s("div",{class:"s-rating-modal-title"}," ",`${salla.lang.get("pages.rating.rate_shipping")} ${this.editItem.shipping.name}`),s("div",{class:"s-rating-modal-stars-company"},s("salla-rating-stars",{withLabel:!0,size:"large",editable:!0,value:this.editItem.stars})),s("textarea",{name:"content",class:"s-rating-modal-comment",value:this.editItem.content,placeholder:salla.lang.get("pages.rating.write_shipping_rate")}),s("small",{class:"s-rating-modal-validation-msg"})):null,"product"==this.editType&&this.editItem?s("section",{class:"s-rating-modal-step","data-type":"products",ref:t=>this.currentTab=t},s("div",{class:"s-rating-modal-product"},s("div",{class:"rating-outer-form","data-stars-error":salla.lang.get("pages.rating.rate_product_stars")},s("div",{class:"s-rating-modal-product-details"},s("div",{class:"s-rating-modal-product-info-row"},s("div",{class:"s-rating-modal-product-img-wrap"},s("img",{src:this.editItem.product.image.url,alt:this.editItem.product.name,class:"s-rating-modal-product-img"})),s("h3",{class:"s-rating-modal-product-title"},this.editItem.product.name)),this.renderProductReviewFactors(this.editItem.product.id,0,{fieldPrefix:"",mainRating:this.editMainRating??Number(this.editItem.stars??this.editItem.rating),factorRatings:this.editFactorRatings,alwaysEditable:!0}),s("input",{type:"hidden",name:"product_id",value:this.editItem.product.id}),s("textarea",{value:this.editItem.content,placeholder:salla.lang.get("pages.rating.write_product_rate"),name:"comment",class:"s-rating-modal-comment"}),s("small",{class:"s-rating-modal-validation-msg"}))),this.allowAttachImages&&s("div",{class:"s-rating-modal-uploader is-opened",ref:t=>this.contentRefs[1]=t},s("salla-file-upload",{name:"images",allowMultiple:!0,maxFilesCount:this.MAX_UPLOAD_LIMIT,imagePreviewHeight:117,filePosterHeight:117,"instant-upload":!0,type:"feedback",files:JSON.stringify(this.editItemImages),payloadName:"files[]",id:`file-${this.editItem.product.id}`,title:this.editItem.product.name,instantUpload:!0,accept:"image/png, image/jpeg, image/jpg",url:salla.url.api("upload"),onUploaded:t=>{this.editItemImages=[...this.editItemImages,t.detail],this.hiddenInputs[1].value=this.editItemImages.map((t=>t.url)).join()},onRemoved:t=>{const a=t.detail;a&&(this.editItemImages=this.editItemImages.filter((t=>t.id!==a)),this.hiddenInputs[1].value=this.editItemImages.map((t=>t.url)).join())},labelIdle:this.getFilepondPlaceholder()}),s("input",{type:"hidden",name:"images",value:this.editItemImages.map((t=>t.url)).join(","),ref:t=>this.hiddenInputs[1]=t}),this.renderUploadedImagesCount(this.editItem.product.id)))):null,s("div",{class:"s-rating-modal-footer s-rating-modal-footer-end"},s("salla-button",{"loader-position":"center",onClick:()=>this.editReview()},this.editReviewLabel))))}render(){return this.deleteMode?s(i,{class:"s-rating-modal"},this.getDeleteModal()):this.editMode?s(i,{class:"s-rating-modal"},this.getEditModal()):this.defaultMode?s(i,{class:"s-rating-modal"},s("salla-modal",{class:"s-rating-modal-wrap",onModalVisibilityChanged:t=>this.resetData(t),isLoading:!0,width:"md",ref:t=>this.modal=t},s("div",{slot:"loading"},s("div",{class:"s-rating-modal-skeleton"},s("salla-skeleton",{type:"circle",height:"80px",width:"80px"}),s("salla-skeleton",{height:"15px",width:"60%"}),s("salla-skeleton",{height:"10px",width:"30%"}),s("div",{class:"s-rating-modal-skeleton-stars"},[...Array(5)].map((t=>s("div",{key:t,innerHTML:r})))),s("salla-skeleton",{height:"100px",width:"100%"}),s("div",{class:"s-rating-modal-skeleton-footer"},s("salla-skeleton",{height:"40px",width:"30%"})))),!this.hasError&&this.order?[s("div",{class:"s-rating-modal-wrapper",ref:t=>this.body=t},this.isTestimonialsEnabled()?s("div",{class:"rating-outer-form s-rating-modal-step-wrap s-rating-modal-step s-rating-modal-hidden","data-type":"store"},s("div",{class:"s-rating-modal-rounded-icon"},s("img",{src:salla.config.get("store.logo","https://assets.salla.sa/cp/assets/images/logo-new.png"),alt:"store name",class:"s-rating-modal-store-logo"})),s("h2",{class:"s-rating-modal-title"},salla.lang.get("pages.rating.rate_the_store")),s("div",{class:"s-rating-modal-stars-company"},s("salla-rating-stars",{withLabel:!0,size:"large"})),s("textarea",{name:"comment",class:"s-rating-modal-comment",placeholder:salla.lang.get("pages.rating.write_store_rate")}),s("small",{class:"s-rating-modal-validation-msg"})):"",this.isProductsEnabled()&&this.getRateableProducts().map(((t,a)=>this.renderProductStep(t,a))),this.isShippingEnabled()&&this.order.shipping?.company?s("div",{class:"rating-outer-form s-rating-modal-step-wrap s-rating-modal-step s-rating-modal-hidden","data-type":"shipping"},s("input",{type:"hidden",name:"shipping_company_id",value:this.order.shipping.company.id}),this.order.shipping.company.logo?s("div",{class:"s-rating-modal-rounded-icon"},s("img",{src:this.order.shipping.company.logo,class:"s-rating-modal-shipping-logo",alt:this.order.shipping.company.name})):s("span",{class:"s-rating-modal-icon",innerHTML:n}),s("div",{class:"s-rating-modal-title"}," ",`${salla.lang.get("pages.rating.rate_shipping")} ${this.order.shipping.company.name}`),s("div",{class:"s-rating-modal-stars-company"},s("salla-rating-stars",{withLabel:!0,size:"large"})),s("textarea",{name:"comment",class:"s-rating-modal-comment",placeholder:salla.lang.get("pages.rating.write_shipping_rate")}),s("small",{class:"s-rating-modal-validation-msg"})):"",s("div",{class:"s-rating-modal-thanks s-rating-modal-hidden",ref:t=>this.thanksTab=t},s("span",{class:"s-rating-modal-icon",innerHTML:o}),s("h3",{class:"s-rating-modal-thanks-title"},salla.lang.get("pages.rating.thanks")),s("div",{class:"s-rating-modal-thanks-msg",innerHTML:this.order.thanks_message}),s("time",{class:"s-rating-modal-thanks-time",ref:t=>this.thanksTime=t}))),this.allowContactSupport&&this.showContactWidget&&(salla.config.get("store.contacts.whatsapp")||salla.config.get("store.contacts.email"))?s("div",{class:"s-rating-modal-contact"},s("p",null,this.contactUsLabel),s("div",{class:"s-rating-modal-contact-icons"},salla.config.get("store.contacts.whatsapp")&&s("span",{onClick:()=>this.handleSendWhatsApp(),innerHTML:h}),salla.config.get("store.contacts.email")&&s("span",{onClick:()=>this.handleSendEmail(),innerHTML:g}))):"",s("div",{class:"s-rating-modal-footer"},s("button",{ref:t=>this.backBtn=t,onClick:()=>this.previousTab(),class:"s-rating-modal-btn s-rating-modal-unvisiable"},salla.lang.get("common.elements.back")),this.stepsCount>1?s("ul",{class:"s-rating-modal-dots"},[...Array(this.stepsCount)].map(((t,a)=>s("li",{key:a,class:"s-rating-modal-bg-gray s-rating-modal-step-dot"})))):"",s("salla-button",{"loader-position":"center",ref:t=>this.nextBtn=t,onClick:()=>this.submit()},salla.lang.get("common.elements.next")))]:s("salla-placeholder",{alignment:"center"}))):void 0}async componentWillLoad(){await salla.onReady(),this.syncStoreSettings()}componentDidRender(){this.scheduleWizardSetup&&this.defaultMode&&this.order&&(this.scheduleWizardSetup=!1,requestAnimationFrame((()=>this.handleWizard())))}disconnectedCallback(){this.clearThanksCountdown()}get host(){return e(this)}};c.style=".s-rating-modal-product-details{padding-bottom:0.5rem}.s-rating-modal-comment{margin-top:0.35rem}.s-rating-modal-product{margin-bottom:1rem}.s-rating-modal-product-img{display:block;width:100%;height:100%;object-fit:cover}.s-rating-modal-product-title{font-size:0.95rem;font-weight:600;line-height:1.5;margin:0}.s-rating-modal-stars-product{margin-top:0.5rem}.s-rating-modal-product-details-main{display:flex;align-items:center;margin-bottom:0.5rem;padding-bottom:0;border-bottom:0}.s-rating-modal-product-info-row{display:flex;align-items:center;gap:0.6rem;margin-bottom:0.5rem;padding-bottom:0;border-bottom:0}.s-rating-modal-product-main-review{width:100%;text-align:right}.s-rating-modal-product-rating-rows{display:grid;gap:0.45rem;margin:0.2rem 0 0.7rem}.s-rating-modal-product-rating-row{display:flex;align-items:center;justify-content:space-between;gap:0.75rem;min-height:2rem}.s-rating-modal-product-rating-row salla-rating-stars{flex-shrink:0}.s-rating-modal-product-rating-row .s-rating-stars-wrapper{align-items:center;min-height:1.75rem}.s-rating-modal-product-rating-row .s-rating-stars-label,.s-rating-modal-product-rating-row .s-rating-stars-label-without-tag{min-width:auto;min-height:1.25rem;line-height:1.25rem;font-size:0.8rem;color:#5b6470;white-space:nowrap;text-align:end;transition:opacity 0.15s ease}.s-rating-modal-product-rating-row .s-rating-stars-label--empty,.s-rating-modal-product-rating-row .s-rating-stars-label-without-tag--empty{opacity:0}.s-rating-modal-product-rating-row-main{margin-bottom:0.35rem;padding:0.5rem 0.6rem;border:1px solid #d1d5db;border-radius:0.45rem;background:transparent}.s-rating-modal-product-factor-name{color:#5b6470;font-size:0.9rem;line-height:1.25}.s-rating-modal-product-rating-row-main .s-rating-modal-product-factor-name{font-size:1rem;color:#5b6470}.s-rating-modal-product-factor-required{color:#f87171;margin-inline-start:0.2rem}.s-rating-modal-product-img-wrap{width:5rem;min-width:5rem;height:3.5rem;flex-shrink:0;overflow:hidden;border-radius:0.375rem;background:#f3f4f6}.s-rating-modal-uploader.is-opened{height:auto !important;opacity:1 !important;overflow:visible !important;pointer-events:auto !important;margin-bottom:1rem}";export{c as salla_rating_modal_v2}
4
+ import{r as t,f as a,h as s,H as i,a as e}from"./p-CrMCOyRb.js";import{S as r}from"./p-CeFAfcTv.js";import{S as n}from"./p-lMgMt31Q.js";import{C as o}from"./p-BV4kqbdL.js";import{H as l}from"./p-XnA1YTjA.js";import{I as d}from"./p-C-tzSDxw.js";import{W as h}from"./p-CgR-T_ZS.js";import{e as g}from"./p-DzAIgzdz.js";import"./p-CgtvEd63.js";const c=class{constructor(a){t(this,a),this.hasError=!1,this.showContactWidget=!0,this.images=[],this.productImages={},this.editItemImages=[],this.productReviewFactors={},this.editFactorRatings={},this.productMainRatings={},this.productFactorRatings={},this.contact_body=(t,a,s)=>salla.lang.get("pages.rating.contact_subject",{store:t,id:a,customer:s}),this.editMode=!1,this.defaultMode=!1,this.deleteMode=!1,this.shouldOpenDeleteModal=!1,this.editItem=null,this.allowAttachImages=!1,this.allowContactSupport=!1,this.dragAndDropFilesLabel=salla.lang.get("common.uploader.drag_and_drop_files"),this.contactSubjectLabel=salla.lang.get("pages.rating.contact_subject"),this.editReviewLabel=salla.lang.get("pages.rating.edit_review"),this.allowedImagesTypesLabel=salla.lang.get("common.uploader.allowed_images_types"),this.threeImagesMax=salla.lang.get("common.uploader.max_three_images"),this.areYouSureLabel=salla.lang.get("pages.rating.are_you_sure_you_want_to_delete_review"),this.confirmDeletionLabel=salla.lang.get("pages.rating.confirm_deletion"),this.cancelLabel=salla.lang.get("common.elements.cancel"),this.confirmDeleteBtn=salla.lang.get("common.elements.confirm_delete"),this.updatedSuccessfullyLabel=salla.lang.get("pages.rating.review_updated_successfully"),this.deletedSuccessfullyLabel=salla.lang.get("pages.rating.review_deleted_successfully"),this.contactUsLabel=salla.lang.get("blocks.footer.social"),this.requiredFactorsLabel=salla.lang.get("pages.rating.rate_required_factors"),this.overallProductRatingLabel=salla.lang.get("pages.rating.overall_product_rating"),this.contentRefs=[],this.hiddenInputs=[],this.userFilledFactorKeys={},this.boundRatingRows=new WeakSet,this.stepsCount=0,this.currentIndex=0,this.submitted=[],this.MAX_UPLOAD_LIMIT=3,this.thanksCountdownInterval=null,this.scheduleWizardSetup=!1,salla.lang.onLoaded((()=>{this.contactUsLabel=salla.lang.get("blocks.footer.social");const t=(t,a,s)=>new Promise((i=>{salla.helpers.setNested(salla.lang.messages[t],a,s),i(!0)}));(async()=>{await t("ar.trans","common.uploader.drag_and_drop_files","اسحب الملفات وأفلتها هنا"),await t("en.trans","common.uploader.drag_and_drop_files","Drag and drop files here"),await t("ar.trans","common.uploader.allowed_images_types"," .jpg أو jpeg أو png يُسمح بإضافة صور بصيغة"),await t("en.trans","common.uploader.allowed_images_types","Images in jpg, jpeg, or png format are allowed."),await t("ar.trans","pages.rating.add_images","اضافة صور"),await t("en.trans","pages.rating.add_images","Add Images"),await t("ar.trans","pages.rating.edit_images","تعديل الصور"),await t("en.trans","pages.rating.edit_images","Edit Images"),await t("ar.trans","pages.rating.edit_review","تعديل التقييم"),await t("en.trans","pages.rating.edit_review","Edit review"),await t("ar.trans","pages.rating.confirm_deletion","تأكيد حذف التقييم"),await t("en.trans","pages.rating.confirm_deletion","Confirm review deletion"),await t("ar.trans","pages.rating.are_you_sure_you_want_to_delete_review","هل أنت متأكد من حذف تقييمك؟"),await t("en.trans","pages.rating.are_you_sure_you_want_to_delete_review","Are you sure you want to delete your review?"),await t("ar.trans","pages.rating.review_updated_successfully","تم تعديل التقييم بنجاح"),await t("en.trans","pages.rating.review_updated_successfully","The review has been successfully updated."),await t("ar.trans","pages.rating.review_deleted_successfully","تم حذف التقييم بنجاح"),await t("en.trans","pages.rating.review_deleted_successfully","The review has been successfully deleted."),await t("ar.trans","pages.rating.images_count","الصور ( :current من أصل :total )"),await t("en.trans","pages.rating.images_count","Images ( :current of :total )"),await t("ar.trans","common.uploader.max_three_images",`.أضف ${this.MAX_UPLOAD_LIMIT} صور كحد أقصى`),await t("en.trans","common.uploader.max_three_images",`Add up to ${this.MAX_UPLOAD_LIMIT} images maximum.`),await t("ar.trans","common.elements.confirm_delete","تأكيد الحذف"),await t("en.trans","common.elements.confirm_delete","Confirm deletion"),await t("ar.trans","pages.rating.rate_required_factors","يرجى تقييم جميع المعايير لإتمام مراجعتك."),await t("en.trans","pages.rating.rate_required_factors","Please rate all required factors to complete your review."),await t("ar.trans","pages.rating.overall_product_rating","التقييم العام للمنتج"),await t("en.trans","pages.rating.overall_product_rating","Overall product rating"),this.dragAndDropFilesLabel=salla.lang.get("common.uploader.drag_and_drop_files"),this.allowedImagesTypesLabel=salla.lang.get("common.uploader.allowed_images_types"),this.threeImagesMax=salla.lang.get("common.uploader.max_three_images"),this.contactSubjectLabel=salla.lang.get("pages.rating.contact_subject"),this.editReviewLabel=salla.lang.get("pages.rating.edit_review"),this.areYouSureLabel=salla.lang.get("pages.rating.are_you_sure_you_want_to_delete_review"),this.confirmDeletionLabel=salla.lang.get("pages.rating.confirm_deletion"),this.cancelLabel=salla.lang.get("common.elements.cancel"),this.updatedSuccessfullyLabel=salla.lang.get("pages.rating.review_updated_successfully"),this.deletedSuccessfullyLabel=salla.lang.get("pages.rating.review_deleted_successfully"),this.confirmDeleteBtn=salla.lang.get("common.elements.confirm_delete"),this.requiredFactorsLabel=salla.lang.get("pages.rating.rate_required_factors"),this.overallProductRatingLabel=salla.lang.get("pages.rating.overall_product_rating"),this.contact_body=(t,a,s)=>salla.lang.get("pages.rating.contact_body",{store:t,id:a,customer:s})})()}))}syncStoreSettings(){this.orderId||(this.orderId=salla.config.get("page.id")),this.allowAttachImages=!!salla.config.get("store.settings.rating.allow_attach_images"),this.allowContactSupport=!!salla.config.get("store.settings.rating.allow_contact_support")}getRatingOrderId(){return this.orderId||salla.config.get("page.id")}getSubmitOrderId(){return this.orderId}isCustomerOrderShape(t){if(!t||"object"!=typeof t)return!1;const a=t;return!!a.rating&&(Array.isArray(a.items)||Array.isArray(a.products)||Array.isArray(a.rating?.product)||Array.isArray(a.rating?.products))}getBootstrapOrder(){const t=salla.config.get("page");if(this.isCustomerOrderShape(t))return t;if(t&&"object"==typeof t){const a=t;if(Array.isArray(a.products))return t;const s=a.order;if(this.isCustomerOrderShape(s))return s}}async loadCustomerOrderForEdit(){const t=this.getBootstrapOrder();if(t?.rating?.product||t?.rating?.products)this.order=t;else try{const t=await salla.api.withoutNotifier((()=>salla.order.api.getDetails(this.getRatingOrderId())));t?.data&&(this.order=t.data)}catch(t){if(!this.order){const t=await salla.api.withoutNotifier((()=>salla.rating.api.order(this.getRatingOrderId())));this.order=t.data}}}getOrderProductRatings(t=this.order){return t?.rating?[...this.normalizeToArray(t.rating.product),...this.normalizeToArray(t.rating.products)]:[]}getMatchedProductRating(t=this.order,a,s){return this.getOrderProductRatings(t).find((t=>Number(t?.id??t?.feedback_id)===Number(s)||Number(t?.product_id??t?.product?.id)===Number(a)))}hasRatingFeedback(t){const a=t?.rating;return null!=a&&""!==a&&Number(a)>0}isTestimonialsEnabled(t=this.order){return!(!1===t?.testimonials_enabled||this.hasRatingFeedback(t?.store?.feedback)||!0!==t?.testimonials_enabled&&!t?.allowed_ratings?.testimonials_enabled)}isProductsEnabled(t=this.order){return!1!==t?.products_enabled&&this.getRateableProducts(t).length>0}isShippingEnabled(t=this.order){return!(!1===t?.shipping_enabled||this.hasRatingFeedback(t?.shipping?.feedback)||!t?.shipping?.company||!0!==t?.shipping_enabled&&!t?.allowed_ratings?.shipping_enabled)}getOrderProducts(t=this.order){return Array.isArray(t?.products)?t.products.filter((t=>t?.product?.id)):[]}getRateableProducts(t=this.order){return this.getOrderProducts(t).filter((t=>!this.hasRatingFeedback(t?.feedback)))}getStepsCount(t=this.order){if(!t)return 0;let a=0;return this.isTestimonialsEnabled(t)&&a++,this.isProductsEnabled(t)&&(a+=this.getRateableProducts(t).length),this.isShippingEnabled(t)&&t.shipping?.company&&a++,a}afterOrderLoaded(){this.stepsCount=this.getStepsCount(),this.scheduleWizardSetup=!0,a(this)}async open(){return await salla.onReady(),this.syncStoreSettings(),this.defaultMode=!0,this.currentIndex=0,this.submitted=[],new Promise((t=>{setTimeout((()=>{this.modal.open().then((()=>this.order||salla.api.withoutNotifier((()=>salla.rating.api.order(this.getRatingOrderId()))).then((async t=>{this.order=t.data,this.productReviewFactors=await this.fetchAllProductReviewFactors(t.data)})))).then((()=>this.modal.setTitle(`${salla.lang.get("pages.rating.rate_order")} <span class="unicode">(#${this.order.id})</span>`))).then((()=>{const t={};for(const a of this.getRateableProducts())t[a.product.id]=[];this.productImages=t})).then((()=>this.modal.stopLoading())).then((()=>this.afterOrderLoaded())).catch((a=>{t(!1),this.hasError=!0,this.errorMessage=a.response?.data?.error?.message||a.response?.data,this.modal.stopLoading()})),t(!0)}),50)}))}async openEditModal(t){await salla.onReady(),this.syncStoreSettings(),this.defaultMode=!1,this.editMode=!0,this.editType=t.type,this.editFeedbackId=t.feedback_id;try{await this.fetchEditItem(t.feedback_id),"product"===this.editType&&this.editItem?.product?.id&&(await this.loadCustomerOrderForEdit(),await this.ensureProductFactorsLoaded(this.editItem.product.id),this.editFactorRatings={...this.buildEditFactorRatings(this.editItem.product.id)},this.markExistingFactorRatingsAsUserFilled(this.editItem.product.id,this.editFactorRatings)),this.editModal.open()}catch(t){this.hasError=!0,this.errorMessage=t.response?.data?.error?.message||t.response?.data}}async fetchEditItem(t){const a=`rating/${t}/show`,s=await salla.api.request(a);this.editItem=s.data,this.allowAttachImages&&"product"==this.editType&&this.editItem.images.length&&(this.editItemImages=this.editItem.images.map((t=>({id:`${Math.floor(100+900*Math.random())}`,url:t}))))}async editReview(){const t=`rating/${this.editFeedbackId}`;let a;if("product"===this.editType){const t=this.editModal.querySelector('[data-type="products"]')||this.currentTab;a=this.buildProductRatingPayload(this.collectFormData(t),t),!a.product_id&&this.editItem?.product?.id&&(a.product_id=String(this.editItem.product.id))}else a=this.collectFormData(this.editModal),a.images&&(a.images=a.images.split(","));await salla.api.request(t,a,"put").then((t=>{this.editModal.close(),salla.notify.success(t.message||this.updatedSuccessfullyLabel),setTimeout((()=>{window.location.reload()}),500)}))}async openDeleteModal(t){return this.defaultMode=!1,this.deleteMode=!0,this.deleteFeedbackId=t.feedback_id,this.shouldOpenDeleteModal=!0,new Promise((t=>{setTimeout((()=>{this.deleteModal.open().then((()=>t(!0)))}),50)}))}async deleteReview(){const t=`rating/${this.deleteFeedbackId}`;await salla.api.request(t,null,"delete").then((()=>{this.deleteModal.close(),salla.notify.success(this.deletedSuccessfullyLabel),setTimeout((()=>{window.location.reload()}),500)}))}async close(){return this.modal.close()}handleWizard(){this.steps=this.modal.querySelectorAll(".s-rating-modal-step"),this.dots=this.modal.querySelectorAll(".s-rating-modal-step-dot"),0!==this.stepsCount?this.showActiveStep():this.showThankYou()}refreshWizardRefs(){this.modal&&(this.steps=this.modal.querySelectorAll(".s-rating-modal-step"),this.dots=this.modal.querySelectorAll(".s-rating-modal-step-dot"))}showActiveStep(t=null){if(this.refreshWizardRefs(),this.currentTab=t||this.steps[this.currentIndex],!this.currentTab)return;l.toggleClassIf(".s-rating-modal-step-dot","s-rating-modal-bg-gray","s-rating-modal-bg-primary",(t=>t!=this.dots[this.currentIndex])).toggleClassIf(".s-rating-modal-step","s-rating-modal-active","s-rating-modal-hidden",(t=>t==this.currentTab)),0!==this.currentIndex&&(l.toggleElementClassIf(this.currentTab,"s-rating-modal-unactive","s-rating-modal-hidden",(()=>!0)),setTimeout((()=>l.toggleElementClassIf(this.currentTab,"s-rating-modal-active","s-rating-modal-unactive",(()=>!0))),300));const a=this.steps[this.currentIndex+1]?.dataset.type;this.nextBtn?.setText(a?`${salla.lang.get("pages.rating.rate")} ${salla.lang.get(`pages.rating.${a}`)}`:salla.lang.get("pages.rating.send_ratings")),setTimeout((()=>this.updateBodyHeight()),0),setTimeout((()=>this.updateBodyHeight()),150)}updateBodyHeight(){this.body&&this.currentTab&&(this.body.style.height="products"!==this.currentTab.dataset.type?`${this.currentTab.offsetHeight+(this.editMode?60:0)}px`:"auto")}previousTab(){this.currentIndex>0&&this.currentIndex--,l.toggleElementClassIf(this.backBtn,"s-rating-modal-unvisiable","block",(()=>0==this.currentIndex)),this.showActiveStep()}async submit(){this.refreshWizardRefs();try{this.submittedBefore()||this.validate(),salla.config.canLeave=!1,await this.nextBtn.load(),this.submittedBefore()||await this.sendFeedback(),this.currentTab?.querySelectorAll("[name],.s-rating-modal-btn-star").forEach((t=>t.setAttribute("disabled",""))),this.currentIndex<this.stepsCount&&this.currentIndex++,this.showActiveStep(),l.toggleClassIf("#prev-btn","block","s-rating-modal-unvisiable",(()=>!0)),this.currentIndex===this.stepsCount&&(this.showThankYou(),this.showContactWidget=!1)}finally{this.nextBtn.stop(),salla.config.canLeave=!0}}submittedBefore(){return this.submitted.includes(this.currentIndex)}getRatingHiddenInput(t){const a=t,s=a.querySelector?.(".rating_hidden_input");if(s?.name)return s;const i=a.querySelector?.("salla-rating-stars");return i?.shadowRoot?.querySelector(".rating_hidden_input")||null}collectNamedInputs(t){const a=new Set,s=[],i=t=>{t?.name&&!a.has(t)&&(a.add(t),s.push(t))};return t.querySelectorAll("[name]").forEach((t=>{i(t)})),t.querySelectorAll("salla-rating-stars").forEach((t=>{i(this.getRatingHiddenInput(t))})),s}normalizeFactorsList(t){return t?Array.isArray(t)?t:"object"==typeof t?Object.values(t).filter((t=>t&&"object"==typeof t)):[]:[]}validate(t=null,a=null){if(!t&&"products"===this.currentTab.dataset.type)return void this.currentTab.querySelectorAll(".rating-outer-form").forEach((t=>this.validate(t,"product")));const s=(t=t||this.currentTab).querySelector(".s-rating-modal-product-rating-row-main"),i=this.getRatingHiddenInput(s||t),e=i?.value,r=t.querySelector(".s-rating-modal-validation-msg");if(a=a||t.dataset.type,!e)throw r.innerHTML=salla.lang.get(`pages.rating.rate_${a}_stars`).replace(" (:item)",""),new Error(r.innerHTML);if("product"===a&&Array.from(t.querySelectorAll('.s-rating-modal-product-factor-row[data-required="true"]')).some((t=>{const a=this.getRatingHiddenInput(t);return!a?.value})))throw r.innerHTML=this.requiredFactorsLabel,new Error(r.innerHTML);r.innerHTML=""}collectFormData(t=this.currentTab){const a={};return this.collectNamedInputs(t).forEach((t=>{const s=salla.helpers.inputData(t.name,t.value,a);a[s.name]=s.value})),a}buildProductRatingPayload(t,a=this.currentTab){if(!t.rating){const s=a.querySelector(".s-rating-modal-product-rating-row-main"),i=this.getRatingHiddenInput(s||a);i?.value&&(t.rating=i.value)}const s=Number(t.product_id);let i=[];t.images?i="string"==typeof t.images?t.images.split(",").filter(Boolean):t.images:this.editMode&&this.allowAttachImages&&s?i=this.editItemImages.map((t=>t.url)):this.allowAttachImages&&s&&(i=(this.productImages[s]||[]).map((t=>t.url)));const e=this.normalizeFactorsList(t.factors).filter((t=>t?.id&&t?.rating)).map((t=>({id:String(t.id),rating:String(t.rating)})));return{order_id:this.getSubmitOrderId(),product_id:String(t.product_id),rating:String(t.rating),comment:t.comment||t.content||"",images:i,factors:e,type:"products"}}async sendFeedback(){this.refreshWizardRefs();const t=this.currentTab?.dataset?.type;if("products"===t){const t=this.collectFormData(this.currentTab),a=this.buildProductRatingPayload(t,this.currentTab);if(!a.product_id||!a.rating)throw new Error("Missing product rating data");const s=await salla.rating.api.products(a);return this.submitted.push(this.currentIndex),s}const a=this.collectFormData(this.currentTab);if(0===Object.keys(a).length)return;a.order_id=this.getSubmitOrderId(),a.type=t;const s=await salla.rating.api[t](a);return this.submitted.push(this.currentIndex),s}clearThanksCountdown(){null!==this.thanksCountdownInterval&&(clearInterval(this.thanksCountdownInterval),this.thanksCountdownInterval=null)}showThankYou(){let t=10;this.clearThanksCountdown(),this.thanksCountdownInterval=setInterval((()=>{this.thanksTime.innerHTML="00:0"+t--,t>0||(this.clearThanksCountdown(),this.thanksTime.remove(),this.close().then((()=>window.location.reload())))}),1e3),this.modal.querySelector(".s-rating-modal-footer").classList.add("s-rating-modal-unvisiable"),this.showActiveStep(this.thanksTab)}getFilepondPlaceholder(){return`<div class="s-rating-modal-filepond-placeholder"><span class="s-rating-modal-filepond-placeholder-icon">${d}</span><p class="s-rating-modal-filepond-placeholder-text">${this.dragAndDropFilesLabel}<br>\n <span> ${this.allowedImagesTypesLabel} <br> ${this.threeImagesMax} </span></p></div>`}getCustomerName(){return`${salla.config.get("user.first_name")||salla.storage.get("user.first_name")||""} ${salla.config.get("user.last_name")||salla.storage.get("user.last_name")||""}`}normalizeReviewFactorsPayload(t){const a=t?.data??t?.factors;return Array.isArray(a)?a.flatMap((t=>{const a=Array.isArray(t?.items)?[...t.items]:null;if(a?.length){a.sort(((t,a)=>(Number(t?.sort)||0)-(Number(a?.sort)||0)));const s=!!t?.is_required;return a.filter((t=>null!=t?.id&&""!==t?.id)).map((t=>({id:t.id,name:t?.name,required:s})))}return null==t?.id||""===t?.id?[]:[{id:t.id,name:t?.name,required:t?.required??t?.is_required??!1}]})):[]}async fetchProductReviewFactors(t){try{const a=await salla.api.request(`review/factors/${t}/form`);return this.normalizeReviewFactorsPayload(a)}catch(t){return[]}}async fetchAllProductReviewFactors(t){const a=this.getRateableProducts(t);if(!a.length)return{};const s=await Promise.all(a.map((async t=>{const a=await this.fetchProductReviewFactors(t.product.id);return[t.product.id,a]})));return Object.fromEntries(s)}async ensureProductFactorsLoaded(t){if(!t||this.productReviewFactors[t])return;const a=await this.fetchProductReviewFactors(t);this.productReviewFactors={...this.productReviewFactors,[t]:a}}getFactorFieldName(t,a,s){return t?`${t}[factors][${a}][${s}]`:`factors[${a}][${s}]`}normalizeToArray(t){return null==t?[]:Array.isArray(t)?t:[t]}isFactorReviewsList(t){return Array.isArray(t)&&t.length>0&&t.every((t=>t&&"object"==typeof t&&(void 0!==t.rating||void 0!==t.stars||void 0!==t.value)))}getFactorReviewsFromRecord(t){if(!t)return[];for(const a of["factor_reviews","review_factors","factors"]){const s=t[a];if(this.isFactorReviewsList(s))return s}return[]}getEditFactorReviewsList(t){const a=[this.order,this.getBootstrapOrder()].filter(Boolean);for(const s of a){const a=this.getMatchedProductRating(s,t,this.editFeedbackId),i=this.getFactorReviewsFromRecord(a);if(i.length)return i}const s=this.getOrderProducts(this.order).find((a=>Number(a.product?.id)===Number(t))),i=[this.editItem?.factor_reviews,this.editItem?.review_factors,this.editItem?.product?.review_factors,this.editItem?.product?.factor_reviews,this.editItem?.factors,s?.factor_reviews,s?.review_factors,s?.feedback?.factor_reviews];for(const t of i)if(Array.isArray(t)&&t.length>0)return t;return[]}getFactorKey(t,a){return null!=t.id&&""!==t.id?`id:${t.id}`:t.name?`name:${t.name.trim()}`:`index:${a}`}getFactorRatingsForProduct(t){return this.editMode?this.editFactorRatings:this.productFactorRatings[t]||{}}setFactorRatingsForProduct(t,a){this.editMode?this.editFactorRatings=a:this.productFactorRatings={...this.productFactorRatings,[t]:a}}markExistingFactorRatingsAsUserFilled(t,a){const s=this.productReviewFactors[t]||[],i=new Set;s.forEach(((t,s)=>{const e=this.getFactorKey(t,s),r=void 0!==t.id?a[String(t.id)]:void 0,n=t.name?a[t.name.trim()]:void 0;void 0===r&&void 0===n&&void 0===a[`__index_${s}`]||i.add(e)})),this.userFilledFactorKeys[t]=i}shouldAutofillFactors(t){return 4===t||5===t}autofillUnfilledFactors(t,a){const s=this.productReviewFactors[t]||[];if(!s.length)return;const i=this.userFilledFactorKeys[t]||new Set,e={...this.getFactorRatingsForProduct(t)},r=this.shouldAutofillFactors(a);let n=!1;s.forEach(((t,s)=>{const o=this.getFactorKey(t,s);if(!i.has(o)){if(r)return void 0!==t.id&&(e[String(t.id)]=a),t.name&&(e[t.name.trim()]=a),e[`__index_${s}`]=a,void(n=!0);void 0!==t.id&&void 0!==e[String(t.id)]&&(delete e[String(t.id)],n=!0),t.name&&void 0!==e[t.name.trim()]&&(delete e[t.name.trim()],n=!0),void 0!==e[`__index_${s}`]&&(delete e[`__index_${s}`],n=!0)}})),n&&this.setFactorRatingsForProduct(t,e)}handleMainRatingChange(t,a){this.editMode?this.editMainRating=a:this.productMainRatings={...this.productMainRatings,[t]:a},this.autofillUnfilledFactors(t,a)}handleFactorRatingChange(t,a,s){this.userFilledFactorKeys[t]||(this.userFilledFactorKeys[t]=new Set),this.userFilledFactorKeys[t].add(a);const i=this.productReviewFactors[t]||[],e=i.findIndex(((t,s)=>this.getFactorKey(t,s)===a));if(e<0)return;const r=i[e],n={...this.getFactorRatingsForProduct(t)};void 0!==r.id&&(n[String(r.id)]=s),r.name&&(n[r.name.trim()]=s),n[`__index_${e}`]=s,this.setFactorRatingsForProduct(t,n)}setupProductRatingAutofill(t,a){t&&!this.boundRatingRows.has(t)&&(this.boundRatingRows.add(t),t.addEventListener("click",(s=>{const i=s.target;if(!i.closest(".s-rating-stars-btn-star"))return;const e=i.closest(".s-rating-modal-product-rating-row-main"),r=i.closest(".s-rating-modal-product-factor-row");requestAnimationFrame((()=>{if(e&&t.contains(e)){const t=Number(this.getRatingHiddenInput(e)?.value);t>0&&this.handleMainRatingChange(a,t)}else if(r&&t.contains(r)){const t=r.getAttribute("data-factor-key"),s=Number(this.getRatingHiddenInput(r)?.value);t&&s>0&&this.handleFactorRatingChange(a,t,s)}}))})))}buildEditFactorRatings(t){return this.getEditFactorReviewsList(t).reduce(((t,a,s)=>{const i=Number(a?.rating??a?.stars??a?.value);if(Number.isNaN(i))return t;const e=a?.id??a?.factor_id;return null!=e&&""!==e&&(t[String(e)]=i),a?.name&&(t[a.name.trim()]=i),t[`__index_${s}`]=i,t}),{})}renderProductStep(t,a){return s("section",{class:"s-rating-modal-step s-rating-modal-hidden","data-type":"products","data-product-id":t.product.id,key:t.product.id},s("div",{class:"s-rating-modal-product"},s("div",{class:"rating-outer-form","data-stars-error":salla.lang.get("pages.rating.rate_product_stars")},s("div",{class:"s-rating-modal-product-details"},s("div",{class:"s-rating-modal-product-info-row"},s("div",{class:"s-rating-modal-product-img-wrap"},s("img",{src:t.product.thumbnail,alt:t.product.name,class:"s-rating-modal-product-img"})),s("h3",{class:"s-rating-modal-product-title"},t.product.name)),this.renderProductReviewFactors(t.product.id,0,{fieldPrefix:""}),s("input",{type:"hidden",name:"product_id",value:t.product.id}),s("textarea",{placeholder:salla.lang.get("pages.rating.write_product_rate"),name:"comment",class:"s-rating-modal-comment"}),s("small",{class:"s-rating-modal-validation-msg"}))),this.allowAttachImages&&s("div",{class:"s-rating-modal-uploader is-opened",ref:t=>this.contentRefs[a]=t},s("salla-file-upload",{name:"image",maxFilesCount:this.MAX_UPLOAD_LIMIT,imagePreviewHeight:117,"instant-upload":!0,type:"feedback",payloadName:"files[]",id:`file-${t.product.id}`,title:t.product.name,allowMultiple:!0,instantUpload:!0,accept:"image/png, image/jpeg, image/jpg",url:salla.url.api("upload"),onUploaded:s=>{this.productImages={...this.productImages,[t.product.id]:[...this.productImages[t.product.id]||[],s.detail]},this.hiddenInputs[a].value=this.productImages[t.product.id].map((t=>t.url)).join(",")},onRemoved:s=>{const i=s.detail;i&&this.productImages[t.product.id]&&(this.productImages={...this.productImages,[t.product.id]:this.productImages[t.product.id].filter((t=>t.id!==i))},this.hiddenInputs[a].value=this.productImages[t.product.id].map((t=>t.url)).join(","))},labelIdle:this.getFilepondPlaceholder()}),s("input",{type:"hidden",name:"images",value:(this.productImages[t.product.id]||[]).map((t=>t.url)).join(","),ref:t=>this.hiddenInputs[a]=t}),this.renderUploadedImagesCount(t.product.id))))}renderProductReviewFactors(t,a,i={}){const e=this.productReviewFactors[t]||[],r=i.fieldPrefix??`products[${a}]`,n=r?`${r}[rating]`:"rating",o={...this.editMode?{}:this.productFactorRatings[t]||{},...i.factorRatings||{}},l=Number(i.mainRating??(this.editMode?this.editMainRating:this.productMainRatings[t])),d=!Number.isNaN(l),h=(t,a)=>{const s=void 0!==t.id?o[String(t.id)]:void 0,i=t.name?o[t.name.trim()]:void 0,e=Number(s??i??o[`__index_${a}`]);return Number.isNaN(e)?void 0:e};return s("div",{class:"s-rating-modal-product-rating-rows",ref:a=>this.setupProductRatingAutofill(a,t)},s("div",{class:"s-rating-modal-product-rating-row s-rating-modal-product-rating-row-main"},s("span",{class:"s-rating-modal-product-factor-name"},this.overallProductRatingLabel,s("span",{class:"s-rating-modal-product-factor-required"},"*")),s("salla-rating-stars",{size:"medium",name:n,key:d?`main-rating-${l}`:"main-rating-empty",value:d?l:void 0,editable:d,withLabel:!0,labelBeforeStars:!0,tag:!1})),e.map(((t,a)=>s("div",{class:"s-rating-modal-product-rating-row s-rating-modal-product-factor-row px-3","data-required":t.required?"true":"false","data-factor-key":this.getFactorKey(t,a)},s("input",{type:"hidden",name:this.getFactorFieldName(r,a,"name"),value:t.name}),!!t.id&&s("input",{type:"hidden",name:this.getFactorFieldName(r,a,"id"),value:String(t.id)}),s("span",{class:"s-rating-modal-product-factor-name"},t.name,t.required?s("span",{class:"s-rating-modal-product-factor-required"},"*"):""),s("salla-rating-stars",{size:"medium",name:this.getFactorFieldName(r,a,"rating"),key:`factor-rating-${t.id??a}-${h(t,a)??0}`,value:h(t,a),editable:i.alwaysEditable||"number"==typeof h(t,a),withLabel:!0,labelBeforeStars:!0,tag:!1})))))}handleSendEmail(){const t=`${this.contactSubjectLabel} #${this.order.id}`,a=this.contact_body(salla.config.get("store.name"),this.order.id,this.getCustomerName()),s=`mailto:${salla.config.get("store.contacts.email")}?subject=${encodeURIComponent(t)}&body=${encodeURIComponent(a)}`;window.open(s,"_blank")}handleSendWhatsApp(){const t=this.contact_body(salla.config.get("store.name"),this.order.id,this.getCustomerName()),a=`https://wa.me/${salla.config.get("store.contacts.whatsapp")}?text=${encodeURIComponent(t)}`;window.open(a,"_blank")}resetData(t){t.detail||(this.clearThanksCountdown(),this.modal?.close(),this.editItem=null,this.editItemImages=[],this.editFactorRatings={},this.productMainRatings={},this.productFactorRatings={},this.editMainRating=void 0,this.userFilledFactorKeys={},this.hiddenInputs[1]&&(this.hiddenInputs[1].value=""),this.deleteFeedbackId=null,this.editFeedbackId=null,this.shouldOpenDeleteModal=!1,this.editMode=!1,this.deleteMode=!1,this.defaultMode=!1,this.currentIndex=0,this.submitted=[],this.scheduleWizardSetup=!1)}getDeleteModal(){return s("salla-modal",{ref:t=>this.deleteModal=t,width:"xs",onModalVisibilityChanged:t=>this.resetData(t)},s("div",{class:"s-rating-modal-delete-wrapper",ref:t=>this.body=t},s("h3",null,this.confirmDeletionLabel),s("p",null,this.areYouSureLabel),s("div",{class:"s-rating-modal-delete-actions"},s("salla-button",{loaderPosition:"center",onClick:()=>this.deleteReview()},this.confirmDeleteBtn),s("salla-button",{color:"danger",fill:"outline",onClick:()=>this.deleteModal.close()},this.cancelLabel))))}renderUploadedImagesCount(t){const a=this.editMode?this.editItemImages.length:(this.productImages[t]||[]).length;return s("span",{class:"s-rating-modal-upload-count"},salla.lang.choice("pages.rating.images_count",a,{current:a,total:this.MAX_UPLOAD_LIMIT}))}getEditModal(){return s("salla-modal",{ref:t=>this.editModal=t,width:"md",onModalVisibilityChanged:t=>this.resetData(t)},s("div",{class:"s-rating-modal-edit-wrapper",ref:t=>this.body=t},"store"===this.editType&&this.editItem?s("div",{class:"rating-outer-form s-rating-modal-step-wrap s-rating-modal-step","data-type":"store",ref:t=>this.currentTab=t},s("div",{class:"s-rating-modal-rounded-icon"},s("img",{src:salla.config.get("store.logo","https://assets.salla.sa/cp/assets/images/logo-new.png"),alt:"store name",class:"s-rating-modal-store-logo"})),s("h2",{class:"s-rating-modal-title"},salla.lang.get("pages.rating.rate_the_store")),s("div",{class:"s-rating-modal-stars-company"},s("salla-rating-stars",{withLabel:!0,size:"large",editable:!0,value:this.editItem.stars})),s("textarea",{name:"content",value:this.editItem.content,class:"s-rating-modal-comment",placeholder:salla.lang.get("pages.rating.write_store_rate")}),s("small",{class:"s-rating-modal-validation-msg"})):null,"shipping"===this.editType&&this.editItem?s("div",{class:"rating-outer-form s-rating-modal-step-wrap s-rating-modal-step","data-type":"shipping",ref:t=>this.currentTab=t},this.editItem.shipping.logo?s("div",{class:"s-rating-modal-rounded-icon"},s("img",{src:this.editItem.shipping.logo,class:"s-rating-modal-shipping-logo",alt:this.editItem.shipping.name})):s("span",{class:"s-rating-modal-icon",innerHTML:n}),s("div",{class:"s-rating-modal-title"}," ",`${salla.lang.get("pages.rating.rate_shipping")} ${this.editItem.shipping.name}`),s("div",{class:"s-rating-modal-stars-company"},s("salla-rating-stars",{withLabel:!0,size:"large",editable:!0,value:this.editItem.stars})),s("textarea",{name:"content",class:"s-rating-modal-comment",value:this.editItem.content,placeholder:salla.lang.get("pages.rating.write_shipping_rate")}),s("small",{class:"s-rating-modal-validation-msg"})):null,"product"==this.editType&&this.editItem?s("section",{class:"s-rating-modal-step","data-type":"products",ref:t=>this.currentTab=t},s("div",{class:"s-rating-modal-product"},s("div",{class:"rating-outer-form","data-stars-error":salla.lang.get("pages.rating.rate_product_stars")},s("div",{class:"s-rating-modal-product-details"},s("div",{class:"s-rating-modal-product-info-row"},s("div",{class:"s-rating-modal-product-img-wrap"},s("img",{src:this.editItem.product.image.url,alt:this.editItem.product.name,class:"s-rating-modal-product-img"})),s("h3",{class:"s-rating-modal-product-title"},this.editItem.product.name)),this.renderProductReviewFactors(this.editItem.product.id,0,{fieldPrefix:"",mainRating:this.editMainRating??Number(this.editItem.stars??this.editItem.rating),factorRatings:this.editFactorRatings,alwaysEditable:!0}),s("input",{type:"hidden",name:"product_id",value:this.editItem.product.id}),s("textarea",{value:this.editItem.content,placeholder:salla.lang.get("pages.rating.write_product_rate"),name:"comment",class:"s-rating-modal-comment"}),s("small",{class:"s-rating-modal-validation-msg"}))),this.allowAttachImages&&s("div",{class:"s-rating-modal-uploader is-opened",ref:t=>this.contentRefs[1]=t},s("salla-file-upload",{name:"images",allowMultiple:!0,maxFilesCount:this.MAX_UPLOAD_LIMIT,imagePreviewHeight:117,filePosterHeight:117,"instant-upload":!0,type:"feedback",files:JSON.stringify(this.editItemImages),payloadName:"files[]",id:`file-${this.editItem.product.id}`,title:this.editItem.product.name,instantUpload:!0,accept:"image/png, image/jpeg, image/jpg",url:salla.url.api("upload"),onUploaded:t=>{this.editItemImages=[...this.editItemImages,t.detail],this.hiddenInputs[1].value=this.editItemImages.map((t=>t.url)).join()},onRemoved:t=>{const a=t.detail;a&&(this.editItemImages=this.editItemImages.filter((t=>t.id!==a)),this.hiddenInputs[1].value=this.editItemImages.map((t=>t.url)).join())},labelIdle:this.getFilepondPlaceholder()}),s("input",{type:"hidden",name:"images",value:this.editItemImages.map((t=>t.url)).join(","),ref:t=>this.hiddenInputs[1]=t}),this.renderUploadedImagesCount(this.editItem.product.id)))):null,s("div",{class:"s-rating-modal-footer s-rating-modal-footer-end"},s("salla-button",{"loader-position":"center",onClick:()=>this.editReview()},this.editReviewLabel))))}render(){return this.deleteMode?s(i,{class:"s-rating-modal"},this.getDeleteModal()):this.editMode?s(i,{class:"s-rating-modal"},this.getEditModal()):this.defaultMode?s(i,{class:"s-rating-modal"},s("salla-modal",{class:"s-rating-modal-wrap",onModalVisibilityChanged:t=>this.resetData(t),isLoading:!0,width:"md",ref:t=>this.modal=t},s("div",{slot:"loading"},s("div",{class:"s-rating-modal-skeleton"},s("salla-skeleton",{type:"circle",height:"80px",width:"80px"}),s("salla-skeleton",{height:"15px",width:"60%"}),s("salla-skeleton",{height:"10px",width:"30%"}),s("div",{class:"s-rating-modal-skeleton-stars"},[...Array(5)].map((t=>s("div",{key:t,innerHTML:r})))),s("salla-skeleton",{height:"100px",width:"100%"}),s("div",{class:"s-rating-modal-skeleton-footer"},s("salla-skeleton",{height:"40px",width:"30%"})))),!this.hasError&&this.order?[s("div",{class:"s-rating-modal-wrapper",ref:t=>this.body=t},this.isTestimonialsEnabled()?s("div",{class:"rating-outer-form s-rating-modal-step-wrap s-rating-modal-step s-rating-modal-hidden","data-type":"store"},s("div",{class:"s-rating-modal-rounded-icon"},s("img",{src:salla.config.get("store.logo","https://assets.salla.sa/cp/assets/images/logo-new.png"),alt:"store name",class:"s-rating-modal-store-logo"})),s("h2",{class:"s-rating-modal-title"},salla.lang.get("pages.rating.rate_the_store")),s("div",{class:"s-rating-modal-stars-company"},s("salla-rating-stars",{withLabel:!0,size:"large"})),s("textarea",{name:"comment",class:"s-rating-modal-comment",placeholder:salla.lang.get("pages.rating.write_store_rate")}),s("small",{class:"s-rating-modal-validation-msg"})):"",this.isProductsEnabled()&&this.getRateableProducts().map(((t,a)=>this.renderProductStep(t,a))),this.isShippingEnabled()&&this.order.shipping?.company?s("div",{class:"rating-outer-form s-rating-modal-step-wrap s-rating-modal-step s-rating-modal-hidden","data-type":"shipping"},s("input",{type:"hidden",name:"shipping_company_id",value:this.order.shipping.company.id}),this.order.shipping.company.logo?s("div",{class:"s-rating-modal-rounded-icon"},s("img",{src:this.order.shipping.company.logo,class:"s-rating-modal-shipping-logo",alt:this.order.shipping.company.name})):s("span",{class:"s-rating-modal-icon",innerHTML:n}),s("div",{class:"s-rating-modal-title"}," ",`${salla.lang.get("pages.rating.rate_shipping")} ${this.order.shipping.company.name}`),s("div",{class:"s-rating-modal-stars-company"},s("salla-rating-stars",{withLabel:!0,size:"large"})),s("textarea",{name:"comment",class:"s-rating-modal-comment",placeholder:salla.lang.get("pages.rating.write_shipping_rate")}),s("small",{class:"s-rating-modal-validation-msg"})):"",s("div",{class:"s-rating-modal-thanks s-rating-modal-hidden",ref:t=>this.thanksTab=t},s("span",{class:"s-rating-modal-icon",innerHTML:o}),s("h3",{class:"s-rating-modal-thanks-title"},salla.lang.get("pages.rating.thanks")),s("div",{class:"s-rating-modal-thanks-msg",innerHTML:this.order.thanks_message}),s("time",{class:"s-rating-modal-thanks-time",ref:t=>this.thanksTime=t}))),this.allowContactSupport&&this.showContactWidget&&(salla.config.get("store.contacts.whatsapp")||salla.config.get("store.contacts.email"))?s("div",{class:"s-rating-modal-contact"},s("p",null,this.contactUsLabel),s("div",{class:"s-rating-modal-contact-icons"},salla.config.get("store.contacts.whatsapp")&&s("span",{onClick:()=>this.handleSendWhatsApp(),innerHTML:h}),salla.config.get("store.contacts.email")&&s("span",{onClick:()=>this.handleSendEmail(),innerHTML:g}))):"",s("div",{class:"s-rating-modal-footer"},s("button",{ref:t=>this.backBtn=t,onClick:()=>this.previousTab(),class:"s-rating-modal-btn s-rating-modal-unvisiable"},salla.lang.get("common.elements.back")),this.stepsCount>1?s("ul",{class:"s-rating-modal-dots"},[...Array(this.stepsCount)].map(((t,a)=>s("li",{key:a,class:"s-rating-modal-bg-gray s-rating-modal-step-dot"})))):"",s("salla-button",{"loader-position":"center",ref:t=>this.nextBtn=t,onClick:()=>this.submit()},salla.lang.get("common.elements.next")))]:s("salla-placeholder",{alignment:"center"}))):void 0}async componentWillLoad(){await salla.onReady(),this.syncStoreSettings()}componentDidRender(){this.scheduleWizardSetup&&this.defaultMode&&this.order&&(this.scheduleWizardSetup=!1,requestAnimationFrame((()=>this.handleWizard())))}disconnectedCallback(){this.clearThanksCountdown()}get host(){return e(this)}};c.style=".s-rating-modal-product-details{padding-bottom:0.5rem}.s-rating-modal-comment{margin-top:0.35rem}.s-rating-modal-product{margin-bottom:1rem}.s-rating-modal-product-img{display:block;width:100%;height:100%;object-fit:cover}.s-rating-modal-product-title{font-size:0.95rem;font-weight:600;line-height:1.5;margin:0}.s-rating-modal-stars-product{margin-top:0.5rem}.s-rating-modal-product-details-main{display:flex;align-items:center;margin-bottom:0.5rem;padding-bottom:0;border-bottom:0}.s-rating-modal-product-info-row{display:flex;align-items:center;gap:0.6rem;margin-bottom:0.5rem;padding-bottom:0;border-bottom:0}.s-rating-modal-product-main-review{width:100%;text-align:right}.s-rating-modal-product-rating-rows{display:grid;gap:0.45rem;margin:0.2rem 0 0.7rem}.s-rating-modal-product-rating-row{display:flex;align-items:center;justify-content:space-between;gap:0.75rem;min-height:2rem}.s-rating-modal-product-rating-row salla-rating-stars{flex-shrink:0}.s-rating-modal-product-rating-row .s-rating-stars-wrapper{align-items:center;min-height:1.75rem}.s-rating-modal-product-rating-row .s-rating-stars-label,.s-rating-modal-product-rating-row .s-rating-stars-label-without-tag{min-width:auto;min-height:1.25rem;line-height:1.25rem;font-size:0.8rem;color:#5b6470;white-space:nowrap;text-align:end;transition:opacity 0.15s ease}.s-rating-modal-product-rating-row .s-rating-stars-label--empty,.s-rating-modal-product-rating-row .s-rating-stars-label-without-tag--empty{opacity:0}.s-rating-modal-product-rating-row-main{margin-bottom:0.35rem;padding:0.5rem 0.6rem;border:1px solid #d1d5db;border-radius:0.45rem;background:transparent}.s-rating-modal-product-factor-name{color:#5b6470;font-size:0.9rem;line-height:1.25}.s-rating-modal-product-rating-row-main .s-rating-modal-product-factor-name{font-size:1rem;color:#5b6470}.s-rating-modal-product-factor-required{color:#f87171;margin-inline-start:0.2rem}.s-rating-modal-product-img-wrap{width:5rem;min-width:5rem;height:3.5rem;flex-shrink:0;overflow:hidden;border-radius:0.375rem;background:#f3f4f6}.s-rating-modal-uploader.is-opened{height:auto !important;opacity:1 !important;overflow:visible !important;pointer-events:auto !important;margin-bottom:1rem}";export{c as salla_rating_modal_v2}
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r as t,h as i,H as s,a as e}from"./p-DkTbP5UX.js";const a=class{constructor(i){t(this,i),this.loading=!1,this.hasError=!1,this.productData=null}async componentWillLoad(){await salla.onReady(),await this.fetchProduct()}componentDidLoad(){this.ensureParentContainsFloats()}componentDidRender(){this.renderCardNode()}ensureParentContainsFloats(){if("left"!==this.align&&"right"!==this.align)return;const t=this.hostEl?.parentElement;if(!t)return;const i=getComputedStyle(t);"block"===i.display&&"visible"===i.overflow&&"none"===i.float&&(t.style.display="flow-root")}fetchProduct(){return this.productId?(this.loading=!0,this.hasError=!1,salla.api.withoutNotifier((()=>salla.product.api.getDetails(this.productId))).then((t=>{const i=t.data;this.productData=i??null,this.hasError=!i})).catch((()=>{this.productData=null,this.hasError=!0})).finally((()=>{this.loading=!1}))):(this.productData=null,this.loading=!1,void(this.hasError=!1))}renderCardNode(){if(!this.cardContainer)return;if(this.cardContainer.textContent="",!this.productData||this.loading||this.hasError)return;const t=window.customElements.get("custom-salla-product-card")?"custom-salla-product-card":"salla-product-card",i=document.createElement(t),s=this.source||"embed-card";i.setAttribute("source",s),i.product={...this.productData,url:this.withViewedSource(this.productData.url,s)},this.cardContainer.appendChild(i)}withViewedSource(t,i){if(!t)return t;try{const s=new URL(t,window.location.origin);return s.searchParams.set("_svs",i),s.toString()}catch{return t}}render(){const t={"s-product-card-embed-card":!0,"s-product-card-embed-card-align-left":"left"===this.align,"s-product-card-embed-card-align-right":"right"===this.align,"s-product-card-embed-card-align-center":"center"===this.align};return i(s,{key:"e8f9e90bcb0326885566a90677521bf5d9d35209"},this.hasError&&i("span",{key:"12561caa2ccc4ebdc7ceafd943ca50bcc7bf41fa",class:"s-product-card-embed-fallback"}),i("div",{key:"bfa851cfbd44ca5ca63e7b9c0d3505c901a9c344",class:t,ref:t=>{this.cardContainer=t}}))}get hostEl(){return e(this)}};a.style='@charset "UTF-8";:host{display:inline-block;vertical-align:top;max-width:12rem}:host([align=left]){float:inline-start;margin-block-end:1em;margin-inline-end:1em;shape-outside:margin-box}:host([align=right]){float:inline-end;margin-block-end:1em;margin-inline-start:1em;shape-outside:margin-box}:host([align=center]){display:block;clear:both;margin-block:1em;margin-inline:auto}.s-product-card-embed-card{display:block}';export{a as salla_product_card_embed}
4
+ import{r as t,h as i,H as s,a as e}from"./p-CrMCOyRb.js";const a=class{constructor(i){t(this,i),this.loading=!1,this.hasError=!1,this.productData=null}async componentWillLoad(){await salla.onReady(),await this.fetchProduct()}componentDidLoad(){this.ensureParentContainsFloats()}componentDidRender(){this.renderCardNode()}ensureParentContainsFloats(){if("left"!==this.align&&"right"!==this.align)return;const t=this.hostEl?.parentElement;if(!t)return;const i=getComputedStyle(t);"block"===i.display&&"visible"===i.overflow&&"none"===i.float&&(t.style.display="flow-root")}fetchProduct(){return this.productId?(this.loading=!0,this.hasError=!1,salla.api.withoutNotifier((()=>salla.product.api.getDetails(this.productId))).then((t=>{const i=t.data;this.productData=i??null,this.hasError=!i})).catch((()=>{this.productData=null,this.hasError=!0})).finally((()=>{this.loading=!1}))):(this.productData=null,this.loading=!1,void(this.hasError=!1))}renderCardNode(){if(!this.cardContainer)return;if(this.cardContainer.textContent="",!this.productData||this.loading||this.hasError)return;const t=window.customElements.get("custom-salla-product-card")?"custom-salla-product-card":"salla-product-card",i=document.createElement(t),s=this.source||"embed-card";i.setAttribute("source",s),i.product={...this.productData,url:this.withViewedSource(this.productData.url,s)},this.cardContainer.appendChild(i)}withViewedSource(t,i){if(!t)return t;try{const s=new URL(t,window.location.origin);return s.searchParams.set("_svs",i),s.toString()}catch{return t}}render(){const t={"s-product-card-embed-card":!0,"s-product-card-embed-card-align-left":"left"===this.align,"s-product-card-embed-card-align-right":"right"===this.align,"s-product-card-embed-card-align-center":"center"===this.align};return i(s,{key:"e8f9e90bcb0326885566a90677521bf5d9d35209"},this.hasError&&i("span",{key:"12561caa2ccc4ebdc7ceafd943ca50bcc7bf41fa",class:"s-product-card-embed-fallback"}),i("div",{key:"bfa851cfbd44ca5ca63e7b9c0d3505c901a9c344",class:t,ref:t=>{this.cardContainer=t}}))}get hostEl(){return e(this)}};a.style='@charset "UTF-8";:host{display:inline-block;vertical-align:top;max-width:12rem}:host([align=left]){float:inline-start;margin-block-end:1em;margin-inline-end:1em;shape-outside:margin-box}:host([align=right]){float:inline-end;margin-block-end:1em;margin-inline-start:1em;shape-outside:margin-box}:host([align=center]){display:block;clear:both;margin-block:1em;margin-inline:auto}.s-product-card-embed-card{display:block}';export{a as salla_product_card_embed}
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r as a,c as s,h as e}from"./p-DkTbP5UX.js";import{c as r}from"./p-B4xPvvKC.js";import{S as d}from"./p-CXRKXFgT.js";const t=class{constructor(e){a(this,e),this.rewardModalOpen=s(this,"rewardModalOpen"),this.confirmModalOpen=s(this,"confirmModalOpen"),this.size="md",this.isActionClickable=a=>"free_product"!==a.key?.toLowerCase()||a.is_product_available,this.handleActionArea=()=>{this.rewardModalOpen.emit(this.prize)},this.handleAction=()=>{this.isActionClickable(this.prize)&&(salla.config.isUser()?this.confirmModalOpen.emit(this.prize):r((()=>salla.event.dispatch("login::open"))))}}render(){return e("div",{key:"46da4cdcfee8e04307722a89c94ab7c3d867aec4",class:{"s-loyalty-program-reward-container":!0,"s-loyalty-program-reward-xs":"xs"===this.size}},e("div",{key:"3d4d1b1adada717d2c248e1a2287b80b370accc8",onClick:this.handleActionArea,role:"button"},e("div",{key:"2f699dcc9098adbbdec2ab1522bdb49977440663",class:"s-loyalty-program-reward-img"},e("img",{key:"9fcc993f9f010ebd5663d02849714db897321357",src:this.prize.image,class:"s-loyalty-program-rewards-img",alt:""})),e("div",{key:"d66d0be909c1f1c239a4aeb2152cd6f3850f25d4",class:"s-loyalty-program-reward-content"},e("div",{key:"10968623d1fe8815a547e7b404f58b8401eed98b",class:"s-loyalty-program-reward-points"},e("salla-badge",{key:"d677e3be9ed036091f523b51d06d64635e1426d9",size:"xs"},e("span",{key:"8b67c0112a61c5a9f224f308193dd933db6811df",innerHTML:d}),e("span",{key:"0b53d61ca1b07318a19d00c5948045385be2c877",class:"s-loyalty-program-rewards-points",innerHTML:salla.lang.choice("pages.loyalty_program.points",this.prize.cost_points)}))),e("div",{key:"5c88b91c602ddb8d81bd2537ebe32afaa13dabd7",class:"s-loyalty-program-reward-title"},e("span",{key:"9f070612c7b381cdfc11cb794a29dd3d4fad78e3"},this.group)),e("div",{key:"d2ed88971fb88f4c857970a15b08b87681225ad4",class:"s-loyalty-program-reward-name"},e("div",{key:"0818181909194a5a9d7bd8b0b0f421ee1c33cac9",class:"s-loyalty-program-rewards-name",id:`prize-${this.prize.id}`},this.prize.name)))),e("div",{key:"61a792efce0cb44e5d676a2d10fbf466fdc9926a",class:"p-4"},e("button",{key:"b2f469e2206892914e14e542fc9acf6ccc289f59",onClick:this.handleAction,disabled:!this.isActionClickable(this.prize),class:{"s-loyalty-program-rewards-action-base":!0,"s-loyalty-program-rewards-action-on":this.isActionClickable(this.prize),"s-loyalty-program-rewards-action-off":!this.isActionClickable(this.prize)}},this.isActionClickable(this.prize)?salla.lang.get("pages.loyalty_program.redeem_reward"):salla.lang.get("pages.loyalty_program.out_of_stock"))))}};t.style="";export{t as salla_loyalty_reward}
4
+ import{r as a,c as s,h as e}from"./p-CrMCOyRb.js";import{c as r}from"./p-BAPngUXX.js";import{S as d}from"./p-CXRKXFgT.js";const t=class{constructor(e){a(this,e),this.rewardModalOpen=s(this,"rewardModalOpen"),this.confirmModalOpen=s(this,"confirmModalOpen"),this.size="md",this.isActionClickable=a=>"free_product"!==a.key?.toLowerCase()||a.is_product_available,this.handleActionArea=()=>{this.rewardModalOpen.emit(this.prize)},this.handleAction=()=>{this.isActionClickable(this.prize)&&(salla.config.isUser()?this.confirmModalOpen.emit(this.prize):r((()=>salla.event.dispatch("login::open"))))}}render(){return e("div",{key:"46da4cdcfee8e04307722a89c94ab7c3d867aec4",class:{"s-loyalty-program-reward-container":!0,"s-loyalty-program-reward-xs":"xs"===this.size}},e("div",{key:"3d4d1b1adada717d2c248e1a2287b80b370accc8",onClick:this.handleActionArea,role:"button"},e("div",{key:"2f699dcc9098adbbdec2ab1522bdb49977440663",class:"s-loyalty-program-reward-img"},e("img",{key:"9fcc993f9f010ebd5663d02849714db897321357",src:this.prize.image,class:"s-loyalty-program-rewards-img",alt:""})),e("div",{key:"d66d0be909c1f1c239a4aeb2152cd6f3850f25d4",class:"s-loyalty-program-reward-content"},e("div",{key:"10968623d1fe8815a547e7b404f58b8401eed98b",class:"s-loyalty-program-reward-points"},e("salla-badge",{key:"d677e3be9ed036091f523b51d06d64635e1426d9",size:"xs"},e("span",{key:"8b67c0112a61c5a9f224f308193dd933db6811df",innerHTML:d}),e("span",{key:"0b53d61ca1b07318a19d00c5948045385be2c877",class:"s-loyalty-program-rewards-points",innerHTML:salla.lang.choice("pages.loyalty_program.points",this.prize.cost_points)}))),e("div",{key:"5c88b91c602ddb8d81bd2537ebe32afaa13dabd7",class:"s-loyalty-program-reward-title"},e("span",{key:"9f070612c7b381cdfc11cb794a29dd3d4fad78e3"},this.group)),e("div",{key:"d2ed88971fb88f4c857970a15b08b87681225ad4",class:"s-loyalty-program-reward-name"},e("div",{key:"0818181909194a5a9d7bd8b0b0f421ee1c33cac9",class:"s-loyalty-program-rewards-name",id:`prize-${this.prize.id}`},this.prize.name)))),e("div",{key:"61a792efce0cb44e5d676a2d10fbf466fdc9926a",class:"p-4"},e("button",{key:"b2f469e2206892914e14e542fc9acf6ccc289f59",onClick:this.handleAction,disabled:!this.isActionClickable(this.prize),class:{"s-loyalty-program-rewards-action-base":!0,"s-loyalty-program-rewards-action-on":this.isActionClickable(this.prize),"s-loyalty-program-rewards-action-off":!this.isActionClickable(this.prize)}},this.isActionClickable(this.prize)?salla.lang.get("pages.loyalty_program.redeem_reward"):salla.lang.get("pages.loyalty_program.out_of_stock"))))}};t.style="";export{t as salla_loyalty_reward}
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r as t,c as e,h as s,H as i,a as l}from"./p-DkTbP5UX.js";import{F as a}from"./p-DL4h2bc3.js";import{H as r}from"./p-XnA1YTjA.js";import"./p-CgtvEd63.js";const o=class{constructor(s){t(this,s),this.changed=e(this,"changed"),this.isReady=!1,this.isInitialFetch=!0,this.filtersData={},this.appliedOpen=!0,salla.event.on("filters::hidden",(()=>this.host.style.display="none")),salla.lang.onLoaded((()=>{this.apply=salla.lang.get("pages.checkout.apply"),this.reset=salla.lang.get("pages.categories.filters_reset"),this.selectedTitle=salla.lang.getWithDefault("pages.categories.selected_filters","لقد اخترت")})),salla.event.on("filters::fetched",(({filters:t})=>{this.host.style.display="";let e={};this.filters=t.map((t=>{if(t.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")}[t.key]||t.label,"rating"==t.key){t.type=a.VALUES;let{max:e,min:s}=t.values;t.values=[5,4,3,2,1].filter((t=>t>=s||t<=e))}this.filtersData.variants&&t.type==a.VARIANTS&&(e.variants=this.filtersData.variants),this.filtersData[t.key]&&t.type!==a.VARIANTS&&(e[t.key]=this.filtersData[t.key]);let s=new URLSearchParams(window.location.search),i=!1;for(let t of s.keys())if(t.includes("filters")){i=!0;break}if(this.isInitialFetch&&"product.index"==salla.config.get("page.slug")&&0==Object.keys(e).length&&!i){let t=window.location.href,s=salla.config.get("page.id"),i=-1!==t.indexOf("?")?"&":"?",l=t+i+"filters[category_id]="+s;e.category_id=s,window.history.pushState({path:l},"",l)}return t})),this.isInitialFetch=!1,this.filtersData=e,this.host.childNodes.forEach((async t=>t.setWidgetHeight&&await t.setWidgetHeight()))}))}async componentWillLoad(){try{const t=new URLSearchParams(window.location.search);this.filtersData=await r.extractFiltersFromUrl(t)}catch(t){console.warn("failed to get filters from URL",t.message)}}async getFilters(){return this.filtersData}async applyFilters(){if(!this.isReady)return;let t=Object.keys(this.filtersData).length>0;setTimeout((()=>{if(t){let t=new URL(window.location.href);for(const[e]of t.searchParams.entries())e.startsWith("filters")&&t.searchParams.delete(e);let e=this.encodeFilters(this.filtersData),s=t.search.split("&").filter((t=>!t.includes("filters"))).join("&");t.search=s?t.search.split("&filters")[0]+"&"+e:`?${e}`,window.history.pushState({},"",t.href)}else{let t=new URL(window.location.href);t.searchParams?.delete("filters"),window.history.pushState({},"",t.toString())}salla.event.emit("salla-filters::changed",this.filtersData),this.changed.emit(this.filtersData)}),300)}encodeFilters(t,e="filters"){const s=[];for(const i in t)if(Object.prototype.hasOwnProperty.call(t,i)){const l=t[i],a=e?`${e}[${i}]`:i;Array.isArray(l)?l.forEach((t=>s.push(`${a}[]=${t}`))):s.push("object"==typeof l&&null!==l?this.encodeFilters(l,a):`${a}=${l}`)}return s.join("&")}async resetFilters(){return this.removeFiltersQueryParams(),this.filtersData={},this.host.childNodes.forEach((t=>t.reset&&t.reset())),salla.event.emit("salla-filters::reset"),this.applyFilters()}removeFiltersQueryParams(){const t=new URLSearchParams(window.location.search),e=Array.from(t.keys()).filter((t=>!t.startsWith("filters["))).map((e=>`${encodeURIComponent(e)}=${encodeURIComponent(t.get(e))}`)).join("&"),s=e?`${window.location.pathname}?${e}`:window.location.pathname;window.history.pushState({},"",s)}handleOptionChange(t,e,s){e.type===a.RANGE&&(this.filtersData[e.key]=s);let i=t.target.checked;if(e.type===a.VARIANTS)this.filtersData.variants=this.filtersData.variants||{},i&&(this.filtersData.variants[e.key]=s),i||delete this.filtersData.variants[e.key];else if("radio"==t.target.type)i&&(this.filtersData[e.key]=s),i||delete this.filtersData[e.key];else if("checkbox"==t.target.type){const t=this.filtersData[e.key];this.filtersData[e.key]=Array.isArray(t)?t:null!=t?[t]:[],i?this.filtersData[e.key].push(s):this.filtersData[e.key]=this.filtersData[e.key].filter((t=>t!=s)),this.filtersData[e.key].length||delete this.filtersData[e.key]}this.filtersData={...this.filtersData},this.applyFilters()}getAppliedFilters(){const t=[],e=this.filtersData||{};for(const s of Object.keys(e)){if("variants"===s){const i=this.filters?.find((t=>t.type===a.VARIANTS));for(const l of Object.keys(e.variants||{})){const r=e.variants[l],o=i?.values?.find((t=>(t.key||t.value)==r));o&&t.push({key:s,variantKey:l,value:r,type:a.VARIANTS,groupLabel:i?.label,optionLabel:o.value})}continue}const i=this.filters?.find((t=>t.key===s));if(!i)continue;const l=e[s];if(i.type===a.RANGE||l&&"object"==typeof l&&!Array.isArray(l)){t.push({key:s,value:l,type:a.RANGE,groupLabel:i.label,optionLabel:`${l.min} - ${l.max}`});continue}if("category_id"===s&&!Array.isArray(l)&&"product.index"==salla.config.get("page.slug")&&l==salla.config.get("page.id"))continue;const r=Array.isArray(l)?l:[l];for(const e of r){const l=i.values?.find((t=>("number"==typeof t?t:t.key||t.value)==e)),a="rating"===i.key?`${e}`:l&&"number"!=typeof l?l.value:void 0;null!=a&&t.push({key:s,value:e,type:i.type,groupLabel:i.label,optionLabel:a})}}return t}removeFilter(t){if(t.type===a.VARIANTS)this.filtersData.variants&&(delete this.filtersData.variants[t.variantKey],Object.keys(this.filtersData.variants).length||delete this.filtersData.variants);else if(t.type===a.RANGE)delete this.filtersData[t.key];else{const e=this.filtersData[t.key];Array.isArray(e)?(this.filtersData[t.key]=e.filter((e=>e!=t.value)),this.filtersData[t.key].length||delete this.filtersData[t.key]):delete this.filtersData[t.key]}this.filtersData={...this.filtersData},this.applyFilters()}render(){const t=this.getAppliedFilters(),e=salla.lang.getWithDefault("common.elements.delete","Remove");return s(i,{key:"d6dacbf458eadefda7ec2b2c6845c54f553abea8"},t.length?s("div",{class:"s-filters-applied s-filters-widget-container"},s("h3",{class:"s-filters-widget-title",onClick:()=>this.appliedOpen=!this.appliedOpen},s("span",null,this.selectedTitle),s("span",{class:"s-filters-widget-plusminus "+(this.appliedOpen?"s-filters-widget-plusminus-active":"")})),s("div",{class:"s-filters-widget-content "+(this.appliedOpen?"s-filters-widget-opened":"s-filters-widget-closed")},s("div",{class:"s-filters-widget-values"},t.map((t=>s("div",{class:"s-filters-label s-filters-applied-item"},s("span",{class:"s-filters-option-name"},t.groupLabel,": ",t.optionLabel),s("button",{type:"button",class:"s-filters-applied-remove","aria-label":`${e} ${t.groupLabel}: ${t.optionLabel}`,onClick:()=>this.removeFilter(t)},s("i",{class:"sicon-cancel","aria-hidden":"true"})))))),s("div",{class:"s-filters-footer"},s("salla-button",{color:"gray",fill:"outline",onClick:()=>this.resetFilters()},this.reset)))):"",this.filters?.map((t=>s("salla-filters-widget",{option:t,filtersData:this.filtersData,onChanged:({detail:{event:t,option:e,value:s}})=>{this.handleOptionChange(t,e,s)}}))))}componentDidLoad(){this.isReady=!0}get host(){return l(this)}};o.style=":host{display:block}.s-rating-stars-small{line-height:12px}.s-filters-radio{background-image:none !important}.s-filters-applied-remove{pointer-events:auto !important;cursor:pointer}";export{o as salla_filters}
4
+ import{r as t,c as e,h as s,H as i,a as l}from"./p-CrMCOyRb.js";import{F as a}from"./p-DL4h2bc3.js";import{H as r}from"./p-XnA1YTjA.js";import"./p-CgtvEd63.js";const o=class{constructor(s){t(this,s),this.changed=e(this,"changed"),this.isReady=!1,this.isInitialFetch=!0,this.filtersData={},this.appliedOpen=!0,salla.event.on("filters::hidden",(()=>this.host.style.display="none")),salla.lang.onLoaded((()=>{this.apply=salla.lang.get("pages.checkout.apply"),this.reset=salla.lang.get("pages.categories.filters_reset"),this.selectedTitle=salla.lang.getWithDefault("pages.categories.selected_filters","لقد اخترت")})),salla.event.on("filters::fetched",(({filters:t})=>{this.host.style.display="";let e={};this.filters=t.map((t=>{if(t.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")}[t.key]||t.label,"rating"==t.key){t.type=a.VALUES;let{max:e,min:s}=t.values;t.values=[5,4,3,2,1].filter((t=>t>=s||t<=e))}this.filtersData.variants&&t.type==a.VARIANTS&&(e.variants=this.filtersData.variants),this.filtersData[t.key]&&t.type!==a.VARIANTS&&(e[t.key]=this.filtersData[t.key]);let s=new URLSearchParams(window.location.search),i=!1;for(let t of s.keys())if(t.includes("filters")){i=!0;break}if(this.isInitialFetch&&"product.index"==salla.config.get("page.slug")&&0==Object.keys(e).length&&!i){let t=window.location.href,s=salla.config.get("page.id"),i=-1!==t.indexOf("?")?"&":"?",l=t+i+"filters[category_id]="+s;e.category_id=s,window.history.pushState({path:l},"",l)}return t})),this.isInitialFetch=!1,this.filtersData=e,this.host.childNodes.forEach((async t=>t.setWidgetHeight&&await t.setWidgetHeight()))}))}async componentWillLoad(){try{const t=new URLSearchParams(window.location.search);this.filtersData=await r.extractFiltersFromUrl(t)}catch(t){console.warn("failed to get filters from URL",t.message)}}async getFilters(){return this.filtersData}async applyFilters(){if(!this.isReady)return;let t=Object.keys(this.filtersData).length>0;setTimeout((()=>{if(t){let t=new URL(window.location.href);for(const[e]of t.searchParams.entries())e.startsWith("filters")&&t.searchParams.delete(e);let e=this.encodeFilters(this.filtersData),s=t.search.split("&").filter((t=>!t.includes("filters"))).join("&");t.search=s?t.search.split("&filters")[0]+"&"+e:`?${e}`,window.history.pushState({},"",t.href)}else{let t=new URL(window.location.href);t.searchParams?.delete("filters"),window.history.pushState({},"",t.toString())}salla.event.emit("salla-filters::changed",this.filtersData),this.changed.emit(this.filtersData)}),300)}encodeFilters(t,e="filters"){const s=[];for(const i in t)if(Object.prototype.hasOwnProperty.call(t,i)){const l=t[i],a=e?`${e}[${i}]`:i;Array.isArray(l)?l.forEach((t=>s.push(`${a}[]=${t}`))):s.push("object"==typeof l&&null!==l?this.encodeFilters(l,a):`${a}=${l}`)}return s.join("&")}async resetFilters(){return this.removeFiltersQueryParams(),this.filtersData={},this.host.childNodes.forEach((t=>t.reset&&t.reset())),salla.event.emit("salla-filters::reset"),this.applyFilters()}removeFiltersQueryParams(){const t=new URLSearchParams(window.location.search),e=Array.from(t.keys()).filter((t=>!t.startsWith("filters["))).map((e=>`${encodeURIComponent(e)}=${encodeURIComponent(t.get(e))}`)).join("&"),s=e?`${window.location.pathname}?${e}`:window.location.pathname;window.history.pushState({},"",s)}handleOptionChange(t,e,s){e.type===a.RANGE&&(this.filtersData[e.key]=s);let i=t.target.checked;if(e.type===a.VARIANTS)this.filtersData.variants=this.filtersData.variants||{},i&&(this.filtersData.variants[e.key]=s),i||delete this.filtersData.variants[e.key];else if("radio"==t.target.type)i&&(this.filtersData[e.key]=s),i||delete this.filtersData[e.key];else if("checkbox"==t.target.type){const t=this.filtersData[e.key];this.filtersData[e.key]=Array.isArray(t)?t:null!=t?[t]:[],i?this.filtersData[e.key].push(s):this.filtersData[e.key]=this.filtersData[e.key].filter((t=>t!=s)),this.filtersData[e.key].length||delete this.filtersData[e.key]}this.filtersData={...this.filtersData},this.applyFilters()}getAppliedFilters(){const t=[],e=this.filtersData||{};for(const s of Object.keys(e)){if("variants"===s){const i=this.filters?.find((t=>t.type===a.VARIANTS));for(const l of Object.keys(e.variants||{})){const r=e.variants[l],o=i?.values?.find((t=>(t.key||t.value)==r));o&&t.push({key:s,variantKey:l,value:r,type:a.VARIANTS,groupLabel:i?.label,optionLabel:o.value})}continue}const i=this.filters?.find((t=>t.key===s));if(!i)continue;const l=e[s];if(i.type===a.RANGE||l&&"object"==typeof l&&!Array.isArray(l)){t.push({key:s,value:l,type:a.RANGE,groupLabel:i.label,optionLabel:`${l.min} - ${l.max}`});continue}if("category_id"===s&&!Array.isArray(l)&&"product.index"==salla.config.get("page.slug")&&l==salla.config.get("page.id"))continue;const r=Array.isArray(l)?l:[l];for(const e of r){const l=i.values?.find((t=>("number"==typeof t?t:t.key||t.value)==e)),a="rating"===i.key?`${e}`:l&&"number"!=typeof l?l.value:void 0;null!=a&&t.push({key:s,value:e,type:i.type,groupLabel:i.label,optionLabel:a})}}return t}removeFilter(t){if(t.type===a.VARIANTS)this.filtersData.variants&&(delete this.filtersData.variants[t.variantKey],Object.keys(this.filtersData.variants).length||delete this.filtersData.variants);else if(t.type===a.RANGE)delete this.filtersData[t.key];else{const e=this.filtersData[t.key];Array.isArray(e)?(this.filtersData[t.key]=e.filter((e=>e!=t.value)),this.filtersData[t.key].length||delete this.filtersData[t.key]):delete this.filtersData[t.key]}this.filtersData={...this.filtersData},this.applyFilters()}render(){const t=this.getAppliedFilters(),e=salla.lang.getWithDefault("common.elements.delete","Remove");return s(i,{key:"d6dacbf458eadefda7ec2b2c6845c54f553abea8"},t.length?s("div",{class:"s-filters-applied s-filters-widget-container"},s("h3",{class:"s-filters-widget-title",onClick:()=>this.appliedOpen=!this.appliedOpen},s("span",null,this.selectedTitle),s("span",{class:"s-filters-widget-plusminus "+(this.appliedOpen?"s-filters-widget-plusminus-active":"")})),s("div",{class:"s-filters-widget-content "+(this.appliedOpen?"s-filters-widget-opened":"s-filters-widget-closed")},s("div",{class:"s-filters-widget-values"},t.map((t=>s("div",{class:"s-filters-label s-filters-applied-item"},s("span",{class:"s-filters-option-name"},t.groupLabel,": ",t.optionLabel),s("button",{type:"button",class:"s-filters-applied-remove","aria-label":`${e} ${t.groupLabel}: ${t.optionLabel}`,onClick:()=>this.removeFilter(t)},s("i",{class:"sicon-cancel","aria-hidden":"true"})))))),s("div",{class:"s-filters-footer"},s("salla-button",{color:"gray",fill:"outline",onClick:()=>this.resetFilters()},this.reset)))):"",this.filters?.map((t=>s("salla-filters-widget",{option:t,filtersData:this.filtersData,onChanged:({detail:{event:t,option:e,value:s}})=>{this.handleOptionChange(t,e,s)}}))))}componentDidLoad(){this.isReady=!0}get host(){return l(this)}};o.style=":host{display:block}.s-rating-stars-small{line-height:12px}.s-filters-radio{background-image:none !important}.s-filters-applied-remove{pointer-events:auto !important;cursor:pointer}";export{o as salla_filters}
@@ -1,4 +1,4 @@
1
1
  /*!
2
2
  * Crafted with ❤ by Salla
3
3
  */
4
- import{r as s,h as t,H as o}from"./p-DkTbP5UX.js";const e=class{constructor(t){s(this,t),this.bordered=!0,this.placeholderImage="images/placeholder.png",this.optionsData=[]}componentWillLoad(){this.parseOptionsData()}componentWillUpdate(){this.parseOptionsData()}parseOptionsData(){if(this.options)if("string"==typeof this.options)try{this.optionsData=JSON.parse(this.options)}catch(s){this.optionsData=[]}else this.optionsData=Array.isArray(this.options)?this.options:[];else this.optionsData=[]}renderOptionValue(s){return s.is_image?t("div",{class:"s-order-details-option-image-container"},t("a",{href:s.value,target:"_blank"},t("img",{class:"s-order-details-option-image",src:s.value||this.placeholderImage,alt:s.name}))):s.color?t("span",{title:s.value,class:"s-order-details-option-color-swatch",style:{backgroundColor:s.color}}):s.is_file?t("a",{href:s.value,target:"_blank",class:"s-order-details-option-file-link"},salla.lang.get("common.elements.attachments")):s.is_color_picker?t("div",{class:"s-order-details-option-color-picker"},t("div",{class:"s-order-details-option-color-picker-content"},t("span",{class:"s-order-details-option-color-picker-text"},s.value),t("span",{class:"s-order-details-option-color-picker-swatch",style:{backgroundColor:s.value,width:"1rem"}})),t("salla-button",{onClick:t=>this.copyToClipboard(t,s.value),shape:"link",class:"s-order-details-option-color-picker-button"},t("span",{class:"s-order-details-option-color-copy-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>swap-fill</title>\n<path d="M28 10.667h-2.667c-0.736 0-1.333 0.596-1.333 1.333s0.597 1.333 1.333 1.333h2.667c0.735 0 1.333 0.597 1.333 1.333v13.333c0 0.736-0.599 1.333-1.333 1.333h-13.333c-0.735 0-1.333-0.597-1.333-1.333v-2.667c0-0.737-0.597-1.333-1.333-1.333s-1.333 0.596-1.333 1.333v2.667c0 2.205 1.795 4 4 4h13.333c2.205 0 4-1.795 4-4v-13.333c0-2.205-1.795-4-4-4zM21.333 17.333v-13.333c0-2.205-1.795-4-4-4h-13.333c-2.205 0-4 1.795-4 4v13.333c0 2.205 1.795 4 4 4h13.333c2.205 0 4-1.795 4-4zM2.667 17.333v-13.333c0-0.736 0.599-1.333 1.333-1.333h13.333c0.735 0 1.333 0.597 1.333 1.333v13.333c0 0.736-0.599 1.333-1.333 1.333h-13.333c-0.735 0-1.333-0.597-1.333-1.333z"></path>\n</svg>\n'}))):s.is_map&&s.latitude&&s.longitude?t("salla-map",{id:`location_map_${s.id}`,class:`map_${s.id}`,zoom:15,readonly:!0,lat:s.latitude,lng:s.longitude},t("div",{slot:"button"},t("button",{type:"button",class:"s-order-details-option-map-button",onClick:()=>this.openMap(s.id)},salla.lang.get("common.elements.show_location")))):t("span",{class:"s-order-details-option-default-text"},s.display_value||s.value)}copyToClipboard(s,t){s.preventDefault(),navigator.clipboard&&navigator.clipboard.writeText(t)}openMap(s){const t=document.querySelector(`salla-map.map_${s}`);t&&t.open&&t.open()}render(){if(!this.optionsData.length)return null;const s=this.bordered?"s-order-details-options-container":"s-order-details-options-container-borderless";return t(o,{class:"s-order-details-options-wrapper"},t("h2",{class:"s-order-details-options-title"},salla.lang.get("pages.cart.item_options")),t("div",{class:s},t("dl",{class:"s-order-details-options-list"},this.optionsData.map((s=>t("div",{key:s.id,class:"s-order-details-options-item"},t("dt",{class:"s-order-details-options-item-name"},s.name,":"),t("dd",{class:s.is_image?"s-order-details-options-item-value-image":"s-order-details-options-item-value-text"},this.renderOptionValue(s))))))))}};e.style="";export{e as salla_order_details_options}
4
+ import{r as s,h as t,H as o}from"./p-CrMCOyRb.js";const e=class{constructor(t){s(this,t),this.bordered=!0,this.placeholderImage="images/placeholder.png",this.optionsData=[]}componentWillLoad(){this.parseOptionsData()}componentWillUpdate(){this.parseOptionsData()}parseOptionsData(){if(this.options)if("string"==typeof this.options)try{this.optionsData=JSON.parse(this.options)}catch(s){this.optionsData=[]}else this.optionsData=Array.isArray(this.options)?this.options:[];else this.optionsData=[]}renderOptionValue(s){return s.is_image?t("div",{class:"s-order-details-option-image-container"},t("a",{href:s.value,target:"_blank"},t("img",{class:"s-order-details-option-image",src:s.value||this.placeholderImage,alt:s.name}))):s.color?t("span",{title:s.value,class:"s-order-details-option-color-swatch",style:{backgroundColor:s.color}}):s.is_file?t("a",{href:s.value,target:"_blank",class:"s-order-details-option-file-link"},salla.lang.get("common.elements.attachments")):s.is_color_picker?t("div",{class:"s-order-details-option-color-picker"},t("div",{class:"s-order-details-option-color-picker-content"},t("span",{class:"s-order-details-option-color-picker-text"},s.value),t("span",{class:"s-order-details-option-color-picker-swatch",style:{backgroundColor:s.value,width:"1rem"}})),t("salla-button",{onClick:t=>this.copyToClipboard(t,s.value),shape:"link",class:"s-order-details-option-color-picker-button"},t("span",{class:"s-order-details-option-color-copy-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>swap-fill</title>\n<path d="M28 10.667h-2.667c-0.736 0-1.333 0.596-1.333 1.333s0.597 1.333 1.333 1.333h2.667c0.735 0 1.333 0.597 1.333 1.333v13.333c0 0.736-0.599 1.333-1.333 1.333h-13.333c-0.735 0-1.333-0.597-1.333-1.333v-2.667c0-0.737-0.597-1.333-1.333-1.333s-1.333 0.596-1.333 1.333v2.667c0 2.205 1.795 4 4 4h13.333c2.205 0 4-1.795 4-4v-13.333c0-2.205-1.795-4-4-4zM21.333 17.333v-13.333c0-2.205-1.795-4-4-4h-13.333c-2.205 0-4 1.795-4 4v13.333c0 2.205 1.795 4 4 4h13.333c2.205 0 4-1.795 4-4zM2.667 17.333v-13.333c0-0.736 0.599-1.333 1.333-1.333h13.333c0.735 0 1.333 0.597 1.333 1.333v13.333c0 0.736-0.599 1.333-1.333 1.333h-13.333c-0.735 0-1.333-0.597-1.333-1.333z"></path>\n</svg>\n'}))):s.is_map&&s.latitude&&s.longitude?t("salla-map",{id:`location_map_${s.id}`,class:`map_${s.id}`,zoom:15,readonly:!0,lat:s.latitude,lng:s.longitude},t("div",{slot:"button"},t("button",{type:"button",class:"s-order-details-option-map-button",onClick:()=>this.openMap(s.id)},salla.lang.get("common.elements.show_location")))):t("span",{class:"s-order-details-option-default-text"},s.display_value||s.value)}copyToClipboard(s,t){s.preventDefault(),navigator.clipboard&&navigator.clipboard.writeText(t)}openMap(s){const t=document.querySelector(`salla-map.map_${s}`);t&&t.open&&t.open()}render(){if(!this.optionsData.length)return null;const s=this.bordered?"s-order-details-options-container":"s-order-details-options-container-borderless";return t(o,{class:"s-order-details-options-wrapper"},t("h2",{class:"s-order-details-options-title"},salla.lang.get("pages.cart.item_options")),t("div",{class:s},t("dl",{class:"s-order-details-options-list"},this.optionsData.map((s=>t("div",{key:s.id,class:"s-order-details-options-item"},t("dt",{class:"s-order-details-options-item-name"},s.name,":"),t("dd",{class:s.is_image?"s-order-details-options-item-value-image":"s-order-details-options-item-value-text"},this.renderOptionValue(s))))))))}};e.style="";export{e as salla_order_details_options}