@salla.sa/twilight-components 2.14.488 → 2.14.490

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 (402) hide show
  1. package/dist/cjs/{filepond-05NO31dc.js → filepond-DMNwZGDe.js} +1 -1
  2. package/dist/cjs/{filepond-plugin-file-poster-BSzyn1DL.js → filepond-plugin-file-poster-CwJqn9cv.js} +1 -1
  3. package/dist/cjs/{filepond-plugin-file-validate-size-DJKsosMa.js → filepond-plugin-file-validate-size-D8HCq_yt.js} +1 -1
  4. package/dist/cjs/{filepond-plugin-file-validate-type-C0xLud1P.js → filepond-plugin-file-validate-type-DZHIztrf.js} +1 -1
  5. package/dist/cjs/{filepond-plugin-image-edit-Dq1zXDYS.js → filepond-plugin-image-edit-DtW6aab5.js} +1 -1
  6. package/dist/cjs/{filepond-plugin-image-exif-orientation-B84Q7JSN.js → filepond-plugin-image-exif-orientation-DlHuggE7.js} +1 -1
  7. package/dist/cjs/{filepond-plugin-image-preview-BaE9P79l.js → filepond-plugin-image-preview-rSt0R5Fs.js} +1 -1
  8. package/dist/cjs/{functions-B-_Pnqnt.js → functions-Cl4vQLXn.js} +1 -1
  9. package/dist/cjs/{index-f6loD1zL.js → index-CfrGmYJa.js} +17 -5
  10. package/dist/cjs/{index-BsvV4QQg.js → index-CrTL2nRh.js} +1 -1
  11. package/dist/cjs/loader.cjs.js +2 -2
  12. package/dist/cjs/salla-accordion-body_2.cjs.entry.js +1 -1
  13. package/dist/cjs/salla-accordion_6.cjs.entry.js +1 -1
  14. package/dist/cjs/salla-add-product-button_5.cjs.entry.js +1 -1
  15. package/dist/cjs/salla-advertisement.cjs.entry.js +1 -1
  16. package/dist/cjs/salla-alert_2.cjs.entry.js +1 -1
  17. package/dist/cjs/salla-app-install-alert.cjs.entry.js +1 -1
  18. package/dist/cjs/salla-apps-icons.cjs.entry.js +1 -1
  19. package/dist/cjs/salla-badge.cjs.entry.js +1 -1
  20. package/dist/cjs/salla-booking-field_7.cjs.entry.js +11 -11
  21. package/dist/cjs/salla-bullet-delivery_2.cjs.entry.js +5 -5
  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 +45 -0
  27. package/dist/cjs/salla-comment-form_8.cjs.entry.js +112 -30
  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 +1060 -0
  86. package/dist/cjs/salla-rating-modal.cjs.entry.js +38 -14
  87. package/dist/cjs/salla-review-factors-tags.cjs.entry.js +127 -0
  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 +6 -6
  91. package/dist/cjs/salla-skeleton.cjs.entry.js +2 -2
  92. package/dist/cjs/salla-slider.cjs.entry.js +1 -1
  93. package/dist/cjs/salla-social-share.cjs.entry.js +2 -2
  94. package/dist/cjs/salla-social.cjs.entry.js +2 -2
  95. package/dist/cjs/salla-tab-content_3.cjs.entry.js +4 -4
  96. package/dist/cjs/salla-tiered-offer.cjs.entry.js +1 -1
  97. package/dist/cjs/salla-tooltip.cjs.entry.js +2 -2
  98. package/dist/cjs/salla-trust-badges.cjs.entry.js +1 -1
  99. package/dist/cjs/salla-user-menu.cjs.entry.js +3 -3
  100. package/dist/cjs/salla-user-profile.cjs.entry.js +1 -1
  101. package/dist/cjs/salla-user-settings.cjs.entry.js +2 -2
  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 +2 -2
  105. package/dist/cjs/shipping-fast-CsqEQE78.js +13 -0
  106. package/dist/{esm/star-ZT7ehBBk.js → cjs/star-DMzrN05M.js} +4 -2
  107. package/dist/cjs/{tracked-promise-We1h_qB4.js → tracked-promise-ClJBjg9o.js} +1 -1
  108. package/dist/cjs/twilight.cjs.js +2 -2
  109. package/dist/cjs/{vanilla-picker-Ck8OFt14.js → vanilla-picker-um8NlppX.js} +1 -1
  110. package/dist/collection/collection-manifest.json +3 -0
  111. package/dist/collection/components/salla-comments/salla-comment-factors.js +76 -0
  112. package/dist/collection/components/salla-comments/salla-comment-item.js +20 -6
  113. package/dist/collection/components/salla-comments/salla-comments.css +110 -0
  114. package/dist/collection/components/salla-rating-modal/salla-rating-modal-v2.js +1203 -0
  115. package/dist/collection/components/salla-rating-modal/salla-rating-modal.css +112 -1
  116. package/dist/collection/components/salla-rating-modal/salla-rating-modal.js +33 -2
  117. package/dist/collection/components/salla-rating-stars/salla-rating-stars.css +34 -1
  118. package/dist/collection/components/salla-rating-stars/salla-rating-stars.js +117 -16
  119. package/dist/collection/components/salla-review-factors-tags/helpers.js +86 -0
  120. package/dist/collection/components/salla-review-factors-tags/interfaces.js +1 -0
  121. package/dist/collection/components/salla-review-factors-tags/salla-review-factors-tags.css +41 -0
  122. package/dist/collection/components/salla-review-factors-tags/salla-review-factors-tags.js +135 -0
  123. package/dist/collection/components/salla-reviews/salla-reviews.js +1 -1
  124. package/dist/collection/components/salla-reviews-page/salla-reviews-page.js +1 -1
  125. package/dist/collection/components/salla-reviews-summary/salla-reviews-summary.css +60 -0
  126. package/dist/collection/components/salla-reviews-summary/salla-reviews-summary.js +12 -2
  127. package/dist/collection/components/salla-search/salla-search.js +5 -5
  128. package/dist/collection/components/salla-searchable-dropdown/salla-searchable-dropdown.js +4 -4
  129. package/dist/collection/components/salla-skeleton/salla-skeleton.js +1 -1
  130. package/dist/collection/components/salla-social/salla-social.js +1 -1
  131. package/dist/collection/components/salla-social-share/salla-social-share.js +1 -1
  132. package/dist/collection/components/salla-tabs/salla-tab-content.js +1 -1
  133. package/dist/collection/components/salla-tabs/salla-tab-header.js +1 -1
  134. package/dist/collection/components/salla-tabs/salla-tabs.js +1 -1
  135. package/dist/collection/components/salla-tel-input/salla-tel-input.js +1 -1
  136. package/dist/collection/components/salla-tooltip/salla-tooltip.js +1 -1
  137. package/dist/collection/components/salla-user-settings/salla-user-settings.js +1 -1
  138. package/dist/collection/components/salla-wishlist-actions/salla-wishlist-actions.js +1 -1
  139. package/dist/components/index.js +3 -3
  140. package/dist/components/salla-comment-factors.d.ts +11 -0
  141. package/dist/components/salla-comment-factors.js +9 -0
  142. package/dist/components/salla-comment-factors2.js +66 -0
  143. package/dist/components/salla-comment-item2.js +29 -9
  144. package/dist/components/salla-comments.js +9 -3
  145. package/dist/components/salla-rating-modal-v2.d.ts +11 -0
  146. package/dist/components/salla-rating-modal-v2.js +9 -0
  147. package/dist/components/salla-rating-modal-v22.js +1149 -0
  148. package/dist/components/salla-rating-modal.js +49 -19
  149. package/dist/components/salla-rating-stars2.js +80 -17
  150. package/dist/components/salla-review-factors-tags.d.ts +11 -0
  151. package/dist/components/salla-review-factors-tags.js +149 -0
  152. package/dist/components/salla-reviews-page.js +1 -1
  153. package/dist/components/salla-reviews-summary2.js +13 -3
  154. package/dist/components/salla-reviews.js +1 -1
  155. package/dist/components/salla-search.js +5 -5
  156. package/dist/components/salla-searchable-dropdown2.js +4 -4
  157. package/dist/components/salla-skeleton2.js +1 -1
  158. package/dist/components/salla-social-share2.js +1 -1
  159. package/dist/components/salla-social.js +1 -1
  160. package/dist/components/salla-tab-content2.js +1 -1
  161. package/dist/components/salla-tab-header2.js +1 -1
  162. package/dist/components/salla-tabs2.js +1 -1
  163. package/dist/components/salla-tel-input2.js +1 -1
  164. package/dist/components/salla-tooltip2.js +1 -1
  165. package/dist/components/salla-user-settings.js +1 -1
  166. package/dist/components/salla-wishlist-actions.js +1 -1
  167. package/dist/esm/{filepond-2lHD_yVt.js → filepond-Cg7o_vnN.js} +1 -1
  168. package/dist/esm/{filepond-plugin-file-poster-DIjVVIwh.js → filepond-plugin-file-poster-BJ1q5i_Q.js} +1 -1
  169. package/dist/esm/{filepond-plugin-file-validate-size-CfcICNJA.js → filepond-plugin-file-validate-size-KAp2gG4p.js} +1 -1
  170. package/dist/esm/{filepond-plugin-file-validate-type-DsvYMiJr.js → filepond-plugin-file-validate-type-D6KC6aKt.js} +1 -1
  171. package/dist/esm/{filepond-plugin-image-edit-B7K5Ib7q.js → filepond-plugin-image-edit-CsviUA8z.js} +1 -1
  172. package/dist/esm/{filepond-plugin-image-exif-orientation-9iz6i-up.js → filepond-plugin-image-exif-orientation-DORQxh2z.js} +1 -1
  173. package/dist/esm/{filepond-plugin-image-preview-C89IBH1s.js → filepond-plugin-image-preview-DiN_MPtQ.js} +1 -1
  174. package/dist/esm/{functions-CJdqLH4P.js → functions-ChcWts7Y.js} +1 -1
  175. package/dist/esm/{index-K0OclOPO.js → index-DkTbP5UX.js} +17 -5
  176. package/dist/esm/{index-D1YskPUH.js → index-nv62Rr6s.js} +1 -1
  177. package/dist/esm/loader.js +3 -3
  178. package/dist/esm/salla-accordion-body_2.entry.js +1 -1
  179. package/dist/esm/salla-accordion_6.entry.js +1 -1
  180. package/dist/esm/salla-add-product-button_5.entry.js +1 -1
  181. package/dist/esm/salla-advertisement.entry.js +1 -1
  182. package/dist/esm/salla-alert_2.entry.js +1 -1
  183. package/dist/esm/salla-app-install-alert.entry.js +1 -1
  184. package/dist/esm/salla-apps-icons.entry.js +1 -1
  185. package/dist/esm/salla-badge.entry.js +1 -1
  186. package/dist/esm/salla-booking-field_7.entry.js +11 -11
  187. package/dist/esm/salla-bullet-delivery_2.entry.js +5 -5
  188. package/dist/esm/salla-cart-coupons.entry.js +1 -1
  189. package/dist/esm/salla-cart-item-offers_2.entry.js +1 -1
  190. package/dist/esm/salla-cart-summary-card.entry.js +1 -1
  191. package/dist/esm/salla-cashback-banner.entry.js +1 -1
  192. package/dist/esm/salla-comment-factors.entry.js +43 -0
  193. package/dist/esm/salla-comment-form_8.entry.js +112 -30
  194. package/dist/esm/salla-conditional-offer.entry.js +1 -1
  195. package/dist/esm/salla-contacts.entry.js +1 -1
  196. package/dist/esm/salla-cookies-bar.entry.js +1 -1
  197. package/dist/esm/salla-count-down.entry.js +1 -1
  198. package/dist/esm/salla-custom-fields.entry.js +1 -1
  199. package/dist/esm/salla-delivery-promise.entry.js +1 -1
  200. package/dist/esm/salla-edit-order-button.entry.js +1 -1
  201. package/dist/esm/salla-filters-widget.entry.js +1 -1
  202. package/dist/esm/salla-filters.entry.js +1 -1
  203. package/dist/esm/salla-fulfillment-methods.entry.js +1 -1
  204. package/dist/esm/salla-gifting.entry.js +1 -1
  205. package/dist/esm/salla-hook.entry.js +1 -1
  206. package/dist/esm/salla-infinite-scroll.entry.js +1 -1
  207. package/dist/esm/salla-installment.entry.js +1 -1
  208. package/dist/esm/salla-list-tile.entry.js +1 -1
  209. package/dist/esm/salla-localization-modal.entry.js +1 -1
  210. package/dist/esm/salla-login-modal.entry.js +1 -1
  211. package/dist/esm/salla-loyalty-banner.entry.js +2 -2
  212. package/dist/esm/salla-loyalty-hero_2.entry.js +2 -2
  213. package/dist/esm/salla-loyalty-panel.entry.js +3 -3
  214. package/dist/esm/salla-loyalty-points-banner.entry.js +1 -1
  215. package/dist/esm/salla-loyalty-points-history.entry.js +1 -1
  216. package/dist/esm/salla-loyalty-prize-item.entry.js +1 -1
  217. package/dist/esm/salla-loyalty-program.entry.js +3 -3
  218. package/dist/esm/salla-loyalty-reward.entry.js +2 -2
  219. package/dist/esm/salla-loyalty.entry.js +1 -1
  220. package/dist/esm/salla-maintenance-alert.entry.js +1 -1
  221. package/dist/esm/salla-map_2.entry.js +1 -1
  222. package/dist/esm/salla-menu.entry.js +1 -1
  223. package/dist/esm/salla-metadata.entry.js +1 -1
  224. package/dist/esm/salla-multiple-bundle-product-cart_2.entry.js +1 -1
  225. package/dist/esm/salla-multiple-bundle-product-options-modal_2.entry.js +1 -1
  226. package/dist/esm/salla-multiple-bundle-product.entry.js +1 -1
  227. package/dist/esm/salla-next-order-coupon.entry.js +1 -1
  228. package/dist/esm/salla-notification-item.entry.js +1 -1
  229. package/dist/esm/salla-notifications.entry.js +1 -1
  230. package/dist/esm/salla-offer-modal.entry.js +1 -1
  231. package/dist/esm/salla-offer.entry.js +1 -1
  232. package/dist/esm/salla-order-branch.entry.js +1 -1
  233. package/dist/esm/salla-order-cancel.entry.js +1 -1
  234. package/dist/esm/salla-order-details-multiple-bundle-product.entry.js +1 -1
  235. package/dist/esm/salla-order-details-options.entry.js +1 -1
  236. package/dist/esm/salla-order-details.entry.js +1 -1
  237. package/dist/esm/salla-order-edit-item.entry.js +1 -1
  238. package/dist/esm/salla-order-edit-product-card.entry.js +1 -1
  239. package/dist/esm/salla-order-edit.entry.js +1 -1
  240. package/dist/esm/salla-order-options-modal_3.entry.js +1 -1
  241. package/dist/esm/salla-order-summary.entry.js +1 -1
  242. package/dist/esm/salla-order-totals-card.entry.js +1 -1
  243. package/dist/esm/salla-orders.entry.js +1 -1
  244. package/dist/esm/salla-payments.entry.js +1 -1
  245. package/dist/esm/salla-placeholder.entry.js +1 -1
  246. package/dist/esm/salla-price-range.entry.js +1 -1
  247. package/dist/esm/salla-product-card-embed.entry.js +1 -1
  248. package/dist/esm/salla-product-size-guide.entry.js +1 -1
  249. package/dist/esm/salla-products-list.entry.js +1 -1
  250. package/dist/esm/salla-quick-order.entry.js +1 -1
  251. package/dist/esm/salla-rating-modal-v2.entry.js +1058 -0
  252. package/dist/esm/salla-rating-modal.entry.js +36 -12
  253. package/dist/esm/salla-review-factors-tags.entry.js +125 -0
  254. package/dist/esm/salla-reward-action_4.entry.js +3 -3
  255. package/dist/esm/salla-scopes.entry.js +1 -1
  256. package/dist/esm/salla-search.entry.js +6 -6
  257. package/dist/esm/salla-skeleton.entry.js +2 -2
  258. package/dist/esm/salla-slider.entry.js +1 -1
  259. package/dist/esm/salla-social-share.entry.js +2 -2
  260. package/dist/esm/salla-social.entry.js +2 -2
  261. package/dist/esm/salla-tab-content_3.entry.js +4 -4
  262. package/dist/esm/salla-tiered-offer.entry.js +1 -1
  263. package/dist/esm/salla-tooltip.entry.js +2 -2
  264. package/dist/esm/salla-trust-badges.entry.js +1 -1
  265. package/dist/esm/salla-user-menu.entry.js +5 -5
  266. package/dist/esm/salla-user-profile.entry.js +1 -1
  267. package/dist/esm/salla-user-settings.entry.js +2 -2
  268. package/dist/esm/salla-verify.entry.js +1 -1
  269. package/dist/esm/salla-wallet.entry.js +1 -1
  270. package/dist/esm/salla-wishlist-actions.entry.js +2 -2
  271. package/dist/esm/shipping-fast-lMgMt31Q.js +11 -0
  272. package/dist/{cjs/star-DGcH7Yso.js → esm/star-CeFAfcTv.js} +2 -4
  273. package/dist/esm/{tracked-promise-yWzlErXb.js → tracked-promise-BhGtlRVb.js} +1 -1
  274. package/dist/esm/twilight.js +3 -3
  275. package/dist/esm/{vanilla-picker-Bwq5IBwq.js → vanilla-picker-CBI_4fLe.js} +1 -1
  276. package/dist/twilight/{p-997a1fdf.entry.js → p-01240db4.entry.js} +1 -1
  277. package/dist/twilight/{p-4df90b34.entry.js → p-01cd2407.entry.js} +1 -1
  278. package/dist/twilight/{p-917bae25.entry.js → p-02b365bd.entry.js} +1 -1
  279. package/dist/twilight/p-03ab9920.entry.js +4 -0
  280. package/dist/twilight/{p-1ec309ad.entry.js → p-03cc6665.entry.js} +1 -1
  281. package/dist/twilight/{p-416e7ea9.entry.js → p-0a32b0d6.entry.js} +1 -1
  282. package/dist/twilight/{p-52df99a3.entry.js → p-0de58301.entry.js} +1 -1
  283. package/dist/twilight/{p-c6026f2e.entry.js → p-0e0db003.entry.js} +1 -1
  284. package/dist/twilight/p-0f853d19.entry.js +4 -0
  285. package/dist/twilight/{p-0f6a9e5e.entry.js → p-0f859745.entry.js} +1 -1
  286. package/dist/twilight/{p-680e0dca.entry.js → p-0ff0a5cd.entry.js} +1 -1
  287. package/dist/twilight/{p-b2a12062.entry.js → p-111e8bd4.entry.js} +1 -1
  288. package/dist/twilight/{p-bd50d1c4.entry.js → p-1182a8df.entry.js} +1 -1
  289. package/dist/twilight/{p-eeb0e354.entry.js → p-121dc015.entry.js} +1 -1
  290. package/dist/twilight/{p-df6739de.entry.js → p-15bc19e7.entry.js} +1 -1
  291. package/dist/twilight/{p-387e06ce.entry.js → p-18dada14.entry.js} +1 -1
  292. package/dist/twilight/{p-c1e7fe98.entry.js → p-1a3e548c.entry.js} +1 -1
  293. package/dist/twilight/{p-12d485db.entry.js → p-1f43ed62.entry.js} +1 -1
  294. package/dist/twilight/{p-ccbf4eea.entry.js → p-2414aef5.entry.js} +1 -1
  295. package/dist/twilight/{p-363417b6.entry.js → p-25bfec19.entry.js} +1 -1
  296. package/dist/twilight/{p-8a274920.entry.js → p-26211933.entry.js} +1 -1
  297. package/dist/twilight/{p-f97717b9.entry.js → p-2656742a.entry.js} +1 -1
  298. package/dist/twilight/{p-8b45c13a.entry.js → p-26594c13.entry.js} +1 -1
  299. package/dist/twilight/{p-5dbdf0e7.entry.js → p-271b69a0.entry.js} +1 -1
  300. package/dist/twilight/{p-c01100d0.entry.js → p-27ae0022.entry.js} +1 -1
  301. package/dist/twilight/{p-9efc4b59.entry.js → p-28318fdf.entry.js} +1 -1
  302. package/dist/twilight/{p-9dc6f28e.entry.js → p-28636b6b.entry.js} +1 -1
  303. package/dist/twilight/{p-28eea468.entry.js → p-2b6f45d9.entry.js} +1 -1
  304. package/dist/twilight/{p-04612ed4.entry.js → p-2bcfed29.entry.js} +1 -1
  305. package/dist/twilight/{p-95c6ca83.entry.js → p-2e2d9a86.entry.js} +1 -1
  306. package/dist/twilight/{p-72bc40b3.entry.js → p-31c63840.entry.js} +1 -1
  307. package/dist/twilight/{p-8878ec9e.entry.js → p-38e6442f.entry.js} +1 -1
  308. package/dist/twilight/p-3956807e.entry.js +4 -0
  309. package/dist/twilight/{p-CJRTPVPy.js → p-495aeIVH.js} +1 -1
  310. package/dist/twilight/{p-c497fa37.entry.js → p-4b659dd8.entry.js} +1 -1
  311. package/dist/twilight/{p-5dc0f3c0.entry.js → p-51be1247.entry.js} +1 -1
  312. package/dist/twilight/{p-f6c20f25.entry.js → p-556550d6.entry.js} +1 -1
  313. package/dist/twilight/{p-507e04b3.entry.js → p-57926552.entry.js} +1 -1
  314. package/dist/twilight/{p-cd11cafc.entry.js → p-583b37a5.entry.js} +1 -1
  315. package/dist/twilight/{p-fe6e676c.entry.js → p-5932a5aa.entry.js} +1 -1
  316. package/dist/twilight/{p-2ea6c5c6.entry.js → p-5cd89a8e.entry.js} +1 -1
  317. package/dist/twilight/{p-3cee41e1.entry.js → p-6c74b5a4.entry.js} +1 -1
  318. package/dist/twilight/{p-8f204414.entry.js → p-7092d5e9.entry.js} +1 -1
  319. package/dist/twilight/{p-75345728.entry.js → p-7331a7d0.entry.js} +1 -1
  320. package/dist/twilight/{p-0be72b27.entry.js → p-75b9780f.entry.js} +1 -1
  321. package/dist/twilight/{p-44819d23.entry.js → p-75d071f5.entry.js} +1 -1
  322. package/dist/twilight/{p-868b6dcc.entry.js → p-78364b26.entry.js} +1 -1
  323. package/dist/twilight/{p-d6ace1e8.entry.js → p-7869e2b4.entry.js} +1 -1
  324. package/dist/twilight/{p-62e99802.entry.js → p-789ede46.entry.js} +1 -1
  325. package/dist/twilight/{p-168bfefc.entry.js → p-7cb04076.entry.js} +1 -1
  326. package/dist/twilight/{p-1abccd80.entry.js → p-7fa40598.entry.js} +1 -1
  327. package/dist/twilight/{p-f4b040f0.entry.js → p-8430e33c.entry.js} +1 -1
  328. package/dist/twilight/p-8549ed85.entry.js +4 -0
  329. package/dist/twilight/{p-d1b3e98b.entry.js → p-88bc9aff.entry.js} +1 -1
  330. package/dist/twilight/{p-8ba7b32d.entry.js → p-8d83987b.entry.js} +1 -1
  331. package/dist/twilight/{p-54047fdd.entry.js → p-956be35f.entry.js} +1 -1
  332. package/dist/twilight/{p-d5bbdd47.entry.js → p-9c27c468.entry.js} +1 -1
  333. package/dist/twilight/{p-4Xs3NevL.js → p-B4xPvvKC.js} +1 -1
  334. package/dist/twilight/{p-BgI56yKL.js → p-Bp81rq7T.js} +1 -1
  335. package/dist/twilight/{p-ZT7ehBBk.js → p-CeFAfcTv.js} +1 -1
  336. package/dist/twilight/{p-BF7QVpUp.js → p-CszkocSp.js} +2 -2
  337. package/dist/twilight/{p-3Yh5uCQZ.js → p-CvcP7d1k.js} +1 -1
  338. package/dist/twilight/{p-DTwxTvVu.js → p-D1tp_3zr.js} +1 -1
  339. package/dist/twilight/{p-6iwUgroX.js → p-D3lg7_WR.js} +1 -1
  340. package/dist/twilight/{p-Bnnviqjp.js → p-D68AOZPQ.js} +1 -1
  341. package/dist/twilight/{p-K0OclOPO.js → p-DkTbP5UX.js} +2 -2
  342. package/dist/twilight/{p-327d33c2.entry.js → p-a104a885.entry.js} +1 -1
  343. package/dist/twilight/{p-8b2fb172.entry.js → p-a5310ab5.entry.js} +1 -1
  344. package/dist/twilight/{p-30796ada.entry.js → p-ab8ffcbf.entry.js} +1 -1
  345. package/dist/twilight/{p-9d51f43d.entry.js → p-acf6a8f0.entry.js} +1 -1
  346. package/dist/twilight/{p-4bdd0eab.entry.js → p-ad8111fa.entry.js} +1 -1
  347. package/dist/twilight/{p-fb9f7001.entry.js → p-af41ebe4.entry.js} +1 -1
  348. package/dist/twilight/{p-cdfe32c9.entry.js → p-b4fc5871.entry.js} +1 -1
  349. package/dist/twilight/{p-f5242092.entry.js → p-b7916db2.entry.js} +1 -1
  350. package/dist/twilight/{p-c19cdf96.entry.js → p-b87ac43c.entry.js} +1 -1
  351. package/dist/twilight/{p-7cfe5dbf.entry.js → p-bdca0d7a.entry.js} +1 -1
  352. package/dist/twilight/{p-6e6f4879.entry.js → p-be44f2e4.entry.js} +1 -1
  353. package/dist/twilight/{p-18c99d79.entry.js → p-bf50723d.entry.js} +1 -1
  354. package/dist/twilight/{p-283b7a09.entry.js → p-c0dd76e3.entry.js} +1 -1
  355. package/dist/twilight/{p-7ab11977.entry.js → p-c3c9b136.entry.js} +1 -1
  356. package/dist/twilight/{p-cb475d27.entry.js → p-c583ab13.entry.js} +1 -1
  357. package/dist/twilight/p-c71a6e9c.entry.js +4 -0
  358. package/dist/twilight/{p-24eb59ac.entry.js → p-c774a729.entry.js} +1 -1
  359. package/dist/twilight/p-c80b8b30.entry.js +4 -0
  360. package/dist/twilight/{p-76f06b0a.entry.js → p-c9dcf28b.entry.js} +1 -1
  361. package/dist/twilight/{p-DZu6rifA.js → p-cUujZ85s.js} +1 -1
  362. package/dist/twilight/{p-5effd85b.entry.js → p-ca1c1c50.entry.js} +2 -2
  363. package/dist/twilight/{p-e9439252.entry.js → p-cbbfec66.entry.js} +1 -1
  364. package/dist/twilight/{p-3f1913e0.entry.js → p-ce0d56c1.entry.js} +1 -1
  365. package/dist/twilight/{p-906dfda7.entry.js → p-d0eb0e3d.entry.js} +1 -1
  366. package/dist/twilight/{p-7a738892.entry.js → p-d27c3758.entry.js} +1 -1
  367. package/dist/twilight/p-d617bb3f.entry.js +4 -0
  368. package/dist/twilight/{p-e30f415c.entry.js → p-d7633d87.entry.js} +1 -1
  369. package/dist/twilight/{p-bb7d240f.entry.js → p-d981255b.entry.js} +1 -1
  370. package/dist/twilight/{p-2368ab21.entry.js → p-d9e7a2a9.entry.js} +1 -1
  371. package/dist/twilight/{p-cb9501dc.entry.js → p-dca909c8.entry.js} +1 -1
  372. package/dist/twilight/{p-90976775.entry.js → p-df9267ca.entry.js} +1 -1
  373. package/dist/twilight/{p-44ed9315.entry.js → p-eba770b4.entry.js} +1 -1
  374. package/dist/twilight/{p-9cb07624.entry.js → p-ee67787c.entry.js} +1 -1
  375. package/dist/twilight/{p-c1b56f08.entry.js → p-f303739b.entry.js} +1 -1
  376. package/dist/twilight/{p-3e9bba4f.entry.js → p-f834ded2.entry.js} +1 -1
  377. package/dist/twilight/{p-b69cc47d.entry.js → p-f855ad35.entry.js} +1 -1
  378. package/dist/twilight/{p-1695dd23.entry.js → p-faf369b8.entry.js} +1 -1
  379. package/dist/twilight/{p-4e16be16.entry.js → p-fc26088c.entry.js} +1 -1
  380. package/dist/twilight/{p-BHY6Sj5y.js → p-jgiIvZFz.js} +1 -1
  381. package/dist/twilight/p-lMgMt31Q.js +4 -0
  382. package/dist/twilight/{p-BZ24UYWJ.js → p-qT0_dvbw.js} +1 -1
  383. package/dist/twilight/twilight.esm.js +1 -1
  384. package/dist/types/components/salla-comments/interfaces.d.ts +6 -0
  385. package/dist/types/components/salla-comments/salla-comment-factors.d.ts +6 -0
  386. package/dist/types/components/salla-comments/salla-comment-item.d.ts +3 -0
  387. package/dist/types/components/salla-comments/salla-comments.d.ts +2 -2
  388. package/dist/types/components/salla-rating-modal/order-feedback-response.d.ts +32 -0
  389. package/dist/types/components/salla-rating-modal/salla-rating-modal-v2.d.ts +151 -0
  390. package/dist/types/components/salla-rating-modal/salla-rating-modal.d.ts +5 -1
  391. package/dist/types/components/salla-rating-stars/salla-rating-stars.d.ts +13 -0
  392. package/dist/types/components/salla-review-factors-tags/helpers.d.ts +16 -0
  393. package/dist/types/components/salla-review-factors-tags/interfaces.d.ts +17 -0
  394. package/dist/types/components/salla-review-factors-tags/salla-review-factors-tags.d.ts +24 -0
  395. package/dist/types/components/salla-reviews-summary/interfaces.d.ts +5 -0
  396. package/dist/types/components/salla-reviews-summary/salla-reviews-summary.d.ts +2 -0
  397. package/dist/types/components.d.ts +114 -2
  398. package/package.json +5 -5
  399. package/dist/twilight/p-38c82b5b.entry.js +0 -4
  400. package/dist/twilight/p-db3da75c.entry.js +0 -4
  401. package/dist/twilight/p-e10eed6e.entry.js +0 -4
  402. package/dist/twilight/p-e52bbc5f.entry.js +0 -4
@@ -0,0 +1,1149 @@
1
+ /*!
2
+ * Crafted with ❤ by Salla
3
+ */
4
+ import { proxyCustomElement, HTMLElement, forceUpdate, h, Host } from '@stencil/core/internal/client';
5
+ import { W as WishListIcon } from './star.js';
6
+ import { C as CheckCircle2 } from './check-circle2.js';
7
+ import { H as Helper } from './Helper.js';
8
+ import { I as ImageIcon } from './image.js';
9
+ import { W as WhatsappIcon } from './whatsapp2.js';
10
+ import { M as MailIcon } from './mail.js';
11
+ import { d as defineCustomElement$7 } from './salla-button2.js';
12
+ import { d as defineCustomElement$6 } from './salla-file-upload2.js';
13
+ import { d as defineCustomElement$5 } from './salla-loading2.js';
14
+ import { d as defineCustomElement$4 } from './salla-modal2.js';
15
+ import { d as defineCustomElement$3 } from './salla-placeholder2.js';
16
+ import { d as defineCustomElement$2 } from './salla-rating-stars2.js';
17
+ import { d as defineCustomElement$1 } from './salla-skeleton2.js';
18
+
19
+ var ShippingFast = `<!-- Generated by IcoMoon.io -->
20
+ <svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">
21
+ <title>shipping-fast</title>
22
+ <path d="M10.667 14.667c0-0.737-0.597-1.333-1.333-1.333h-8c-0.736 0-1.333 0.596-1.333 1.333s0.597 1.333 1.333 1.333h8c0.736 0 1.333-0.596 1.333-1.333zM9.333 18.667c-2.941 0-5.333 2.392-5.333 5.333s2.392 5.333 5.333 5.333 5.333-2.392 5.333-5.333-2.392-5.333-5.333-5.333zM9.333 26.667c-1.471 0-2.667-1.196-2.667-2.667s1.196-2.667 2.667-2.667 2.667 1.196 2.667 2.667-1.196 2.667-2.667 2.667zM1.333 10.667h5.333c0.736 0 1.333-0.596 1.333-1.333s-0.597-1.333-1.333-1.333h-5.333c-0.736 0-1.333 0.596-1.333 1.333s0.597 1.333 1.333 1.333zM31.123 13.103l-3.147-3.935c-1.273-1.589-3.171-2.501-5.205-2.501h-1.437c0-2.205-1.795-4-4-4h-13.333c-0.736 0-1.333 0.596-1.333 1.333s0.597 1.333 1.333 1.333h13.333c0.735 0 1.333 0.597 1.333 1.333v1.333c0 0.248 0.087 0.468 0.204 0.667-0.117 0.199-0.204 0.419-0.204 0.667v5.333c0 0.737 0.597 1.333 1.333 1.333h9.333v6.667h-1.333c-0.063 0-0.117 0.028-0.179 0.036-0.583-2.313-2.664-4.036-5.155-4.036-2.941 0-5.333 2.392-5.333 5.333s2.392 5.333 5.333 5.333c2.491 0 4.572-1.723 5.155-4.036 0.061 0.008 0.116 0.036 0.179 0.036h2.667c0.736 0 1.333-0.596 1.333-1.333v-8.399c0-0.905-0.311-1.792-0.877-2.499zM21.333 13.333v-4h1.437c1.221 0 2.36 0.547 3.124 1.501l1.997 2.499zM22.667 26.667c-1.471 0-2.667-1.196-2.667-2.667s1.196-2.667 2.667-2.667 2.667 1.196 2.667 2.667-1.196 2.667-2.667 2.667z"></path>
23
+ </svg>
24
+ `;
25
+
26
+ const sallaRatingModalCss = ".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}";
27
+
28
+ const SallaRatingModalV2 = /*@__PURE__*/ proxyCustomElement(class SallaRatingModalV2 extends HTMLElement {
29
+ constructor() {
30
+ super();
31
+ this.__registerHost();
32
+ this.hasError = false;
33
+ this.showContactWidget = true;
34
+ this.images = [];
35
+ this.productImages = {};
36
+ this.editItemImages = [];
37
+ this.productReviewFactors = {};
38
+ this.editFactorRatings = {};
39
+ this.productMainRatings = {};
40
+ this.productFactorRatings = {};
41
+ this.contact_body = (store, id, customer) => salla.lang.get('pages.rating.contact_subject', { store, id, customer });
42
+ this.editMode = false;
43
+ this.defaultMode = false;
44
+ this.deleteMode = false;
45
+ this.shouldOpenDeleteModal = false;
46
+ this.editItem = null;
47
+ this.allowAttachImages = false;
48
+ this.allowContactSupport = false;
49
+ this.dragAndDropFilesLabel = salla.lang.get('common.uploader.drag_and_drop_files');
50
+ this.contactSubjectLabel = salla.lang.get('pages.rating.contact_subject');
51
+ this.editReviewLabel = salla.lang.get('pages.rating.edit_review');
52
+ this.allowedImagesTypesLabel = salla.lang.get('common.uploader.allowed_images_types');
53
+ this.threeImagesMax = salla.lang.get('common.uploader.max_three_images');
54
+ this.areYouSureLabel = salla.lang.get('pages.rating.are_you_sure_you_want_to_delete_review');
55
+ this.confirmDeletionLabel = salla.lang.get('pages.rating.confirm_deletion');
56
+ this.cancelLabel = salla.lang.get('common.elements.cancel');
57
+ this.confirmDeleteBtn = salla.lang.get('common.elements.confirm_delete');
58
+ this.updatedSuccessfullyLabel = salla.lang.get('pages.rating.review_updated_successfully');
59
+ this.deletedSuccessfullyLabel = salla.lang.get('pages.rating.review_deleted_successfully');
60
+ this.contactUsLabel = salla.lang.get('blocks.footer.social');
61
+ this.requiredFactorsLabel = salla.lang.get('pages.rating.rate_required_factors');
62
+ this.overallProductRatingLabel = salla.lang.get('pages.rating.overall_product_rating');
63
+ this.contentRefs = [];
64
+ this.hiddenInputs = [];
65
+ this.userFilledFactorKeys = {};
66
+ this.boundRatingRows = new WeakSet();
67
+ this.stepsCount = 0;
68
+ this.currentIndex = 0;
69
+ this.submitted = [];
70
+ this.MAX_UPLOAD_LIMIT = 3;
71
+ this.thanksCountdownInterval = null;
72
+ this.scheduleWizardSetup = false;
73
+ salla.lang.onLoaded(() => {
74
+ this.contactUsLabel = salla.lang.get('blocks.footer.social');
75
+ const setNestedAsync = (lang, key, value) => {
76
+ return new Promise(resolve => {
77
+ salla.helpers.setNested(salla.lang.messages[lang], key, value);
78
+ resolve(true);
79
+ });
80
+ };
81
+ const setTranslations = async () => {
82
+ await setNestedAsync('ar.trans', 'common.uploader.drag_and_drop_files', 'اسحب الملفات وأفلتها هنا');
83
+ await setNestedAsync('en.trans', 'common.uploader.drag_and_drop_files', 'Drag and drop files here');
84
+ await setNestedAsync('ar.trans', 'common.uploader.allowed_images_types', ' .jpg أو jpeg أو png يُسمح بإضافة صور بصيغة');
85
+ await setNestedAsync('en.trans', 'common.uploader.allowed_images_types', 'Images in jpg, jpeg, or png format are allowed.');
86
+ await setNestedAsync('ar.trans', 'pages.rating.add_images', 'اضافة صور');
87
+ await setNestedAsync('en.trans', 'pages.rating.add_images', 'Add Images');
88
+ await setNestedAsync('ar.trans', 'pages.rating.edit_images', 'تعديل الصور');
89
+ await setNestedAsync('en.trans', 'pages.rating.edit_images', 'Edit Images');
90
+ await setNestedAsync('ar.trans', 'pages.rating.edit_review', 'تعديل التقييم');
91
+ await setNestedAsync('en.trans', 'pages.rating.edit_review', 'Edit review');
92
+ await setNestedAsync('ar.trans', 'pages.rating.confirm_deletion', 'تأكيد حذف التقييم');
93
+ await setNestedAsync('en.trans', 'pages.rating.confirm_deletion', 'Confirm review deletion');
94
+ await setNestedAsync('ar.trans', 'pages.rating.are_you_sure_you_want_to_delete_review', 'هل أنت متأكد من حذف تقييمك؟');
95
+ await setNestedAsync('en.trans', 'pages.rating.are_you_sure_you_want_to_delete_review', 'Are you sure you want to delete your review?');
96
+ await setNestedAsync('ar.trans', 'pages.rating.review_updated_successfully', 'تم تعديل التقييم بنجاح');
97
+ await setNestedAsync('en.trans', 'pages.rating.review_updated_successfully', 'The review has been successfully updated.');
98
+ await setNestedAsync('ar.trans', 'pages.rating.review_deleted_successfully', 'تم حذف التقييم بنجاح');
99
+ await setNestedAsync('en.trans', 'pages.rating.review_deleted_successfully', 'The review has been successfully deleted.');
100
+ await setNestedAsync('ar.trans', 'pages.rating.images_count', 'الصور ( :current من أصل :total )');
101
+ await setNestedAsync('en.trans', 'pages.rating.images_count', 'Images ( :current of :total )');
102
+ await setNestedAsync('ar.trans', 'common.uploader.max_three_images', `.أضف ${this.MAX_UPLOAD_LIMIT} صور كحد أقصى`);
103
+ await setNestedAsync('en.trans', 'common.uploader.max_three_images', `Add up to ${this.MAX_UPLOAD_LIMIT} images maximum.`);
104
+ await setNestedAsync('ar.trans', 'common.elements.confirm_delete', 'تأكيد الحذف');
105
+ await setNestedAsync('en.trans', 'common.elements.confirm_delete', 'Confirm deletion');
106
+ await setNestedAsync('ar.trans', 'pages.rating.rate_required_factors', 'يرجى تقييم جميع المعايير لإتمام مراجعتك.');
107
+ await setNestedAsync('en.trans', 'pages.rating.rate_required_factors', 'Please rate all required factors to complete your review.');
108
+ await setNestedAsync('ar.trans', 'pages.rating.overall_product_rating', 'التقييم العام للمنتج');
109
+ await setNestedAsync('en.trans', 'pages.rating.overall_product_rating', 'Overall product rating');
110
+ this.dragAndDropFilesLabel = salla.lang.get('common.uploader.drag_and_drop_files');
111
+ this.allowedImagesTypesLabel = salla.lang.get('common.uploader.allowed_images_types');
112
+ this.threeImagesMax = salla.lang.get('common.uploader.max_three_images');
113
+ this.contactSubjectLabel = salla.lang.get('pages.rating.contact_subject');
114
+ this.editReviewLabel = salla.lang.get('pages.rating.edit_review');
115
+ this.areYouSureLabel = salla.lang.get('pages.rating.are_you_sure_you_want_to_delete_review');
116
+ this.confirmDeletionLabel = salla.lang.get('pages.rating.confirm_deletion');
117
+ this.cancelLabel = salla.lang.get('common.elements.cancel');
118
+ this.updatedSuccessfullyLabel = salla.lang.get('pages.rating.review_updated_successfully');
119
+ this.deletedSuccessfullyLabel = salla.lang.get('pages.rating.review_deleted_successfully');
120
+ this.confirmDeleteBtn = salla.lang.get('common.elements.confirm_delete');
121
+ this.requiredFactorsLabel = salla.lang.get('pages.rating.rate_required_factors');
122
+ this.overallProductRatingLabel = salla.lang.get('pages.rating.overall_product_rating');
123
+ this.contact_body = (store, id, customer) => salla.lang.get('pages.rating.contact_body', { store, id, customer });
124
+ };
125
+ setTranslations();
126
+ });
127
+ }
128
+ /**
129
+ * Show the rating modal
130
+ */
131
+ syncStoreSettings() {
132
+ if (!this.orderId) {
133
+ this.orderId = salla.config.get('page.id');
134
+ }
135
+ this.allowAttachImages = !!salla.config.get('store.settings.rating.allow_attach_images');
136
+ this.allowContactSupport = !!salla.config.get('store.settings.rating.allow_contact_support');
137
+ }
138
+ /** Encrypted order id from page config / prop — used to fetch order details. */
139
+ getRatingOrderId() {
140
+ return this.orderId || salla.config.get('page.id');
141
+ }
142
+ /** Numeric order id from API response — used when submitting ratings. */
143
+ getSubmitOrderId() {
144
+ return this.orderId;
145
+ }
146
+ isCustomerOrderShape(value) {
147
+ if (!value || typeof value !== 'object') {
148
+ return false;
149
+ }
150
+ const record = value;
151
+ return (!!record.rating &&
152
+ (Array.isArray(record.items) ||
153
+ Array.isArray(record.products) ||
154
+ Array.isArray(record.rating?.product) ||
155
+ Array.isArray(record.rating?.products)));
156
+ }
157
+ getBootstrapOrder() {
158
+ const page = salla.config.get('page');
159
+ if (this.isCustomerOrderShape(page)) {
160
+ return page;
161
+ }
162
+ if (page && typeof page === 'object') {
163
+ const pageRecord = page;
164
+ if (Array.isArray(pageRecord.products)) {
165
+ return page;
166
+ }
167
+ const nestedOrder = pageRecord.order;
168
+ if (this.isCustomerOrderShape(nestedOrder)) {
169
+ return nestedOrder;
170
+ }
171
+ }
172
+ return undefined;
173
+ }
174
+ async loadCustomerOrderForEdit() {
175
+ const bootstrapOrder = this.getBootstrapOrder();
176
+ if (bootstrapOrder?.rating?.product || bootstrapOrder?.rating?.products) {
177
+ this.order = bootstrapOrder;
178
+ return;
179
+ }
180
+ try {
181
+ const response = await salla.api.withoutNotifier(() => salla.order.api.getDetails(this.getRatingOrderId()));
182
+ if (response?.data) {
183
+ this.order = response.data;
184
+ }
185
+ }
186
+ catch (_error) {
187
+ if (!this.order) {
188
+ const orderResponse = await salla.api.withoutNotifier(() => salla.rating.api.order(this.getRatingOrderId()));
189
+ this.order = orderResponse.data;
190
+ }
191
+ }
192
+ }
193
+ getOrderProductRatings(order = this.order) {
194
+ if (!order?.rating) {
195
+ return [];
196
+ }
197
+ return [
198
+ ...this.normalizeToArray(order.rating.product),
199
+ ...this.normalizeToArray(order.rating.products),
200
+ ];
201
+ }
202
+ getMatchedProductRating(order = this.order, productId, feedbackId) {
203
+ return this.getOrderProductRatings(order).find(entry => Number(entry?.id ?? entry?.feedback_id) === Number(feedbackId) ||
204
+ Number(entry?.product_id ?? entry?.product?.id) === Number(productId));
205
+ }
206
+ hasRatingFeedback(feedback) {
207
+ const rating = feedback?.rating;
208
+ return rating !== undefined && rating !== null && rating !== '' && Number(rating) > 0;
209
+ }
210
+ isTestimonialsEnabled(order = this.order) {
211
+ if (order?.testimonials_enabled === false) {
212
+ return false;
213
+ }
214
+ if (this.hasRatingFeedback(order?.store?.feedback)) {
215
+ return false;
216
+ }
217
+ if (order?.testimonials_enabled === true) {
218
+ return true;
219
+ }
220
+ return !!order?.allowed_ratings?.testimonials_enabled;
221
+ }
222
+ isProductsEnabled(order = this.order) {
223
+ if (order?.products_enabled === false) {
224
+ return false;
225
+ }
226
+ return this.getRateableProducts(order).length > 0;
227
+ }
228
+ isShippingEnabled(order = this.order) {
229
+ if (order?.shipping_enabled === false) {
230
+ return false;
231
+ }
232
+ if (this.hasRatingFeedback(order?.shipping?.feedback)) {
233
+ return false;
234
+ }
235
+ if (!order?.shipping?.company) {
236
+ return false;
237
+ }
238
+ if (order?.shipping_enabled === true) {
239
+ return true;
240
+ }
241
+ return !!order?.allowed_ratings?.shipping_enabled;
242
+ }
243
+ getOrderProducts(order = this.order) {
244
+ if (!Array.isArray(order?.products)) {
245
+ return [];
246
+ }
247
+ return order.products.filter(item => item?.product?.id);
248
+ }
249
+ getRateableProducts(order = this.order) {
250
+ return this.getOrderProducts(order).filter(item => !this.hasRatingFeedback(item?.feedback));
251
+ }
252
+ getStepsCount(order = this.order) {
253
+ if (!order) {
254
+ return 0;
255
+ }
256
+ let count = 0;
257
+ if (this.isTestimonialsEnabled(order)) {
258
+ count++;
259
+ }
260
+ if (this.isProductsEnabled(order)) {
261
+ count += this.getRateableProducts(order).length;
262
+ }
263
+ if (this.isShippingEnabled(order) && order.shipping?.company) {
264
+ count++;
265
+ }
266
+ return count;
267
+ }
268
+ afterOrderLoaded() {
269
+ this.stepsCount = this.getStepsCount();
270
+ this.scheduleWizardSetup = true;
271
+ forceUpdate(this);
272
+ }
273
+ async open() {
274
+ await salla.onReady();
275
+ this.syncStoreSettings();
276
+ this.defaultMode = true;
277
+ this.currentIndex = 0;
278
+ this.submitted = [];
279
+ return new Promise(resolve => {
280
+ setTimeout(() => {
281
+ this.modal
282
+ .open()
283
+ .then(() => this.order ||
284
+ salla.api
285
+ .withoutNotifier(() => salla.rating.api.order(this.getRatingOrderId()))
286
+ .then(async (res) => {
287
+ this.order = res.data;
288
+ this.productReviewFactors = await this.fetchAllProductReviewFactors(res.data);
289
+ }))
290
+ .then(() => this.modal.setTitle(`${salla.lang.get('pages.rating.rate_order')} <span class="unicode">(#${this.order.id})</span>`))
291
+ .then(() => {
292
+ // Initialize productImages for all products
293
+ const initialImages = {};
294
+ for (const item of this.getRateableProducts()) {
295
+ initialImages[item.product.id] = [];
296
+ }
297
+ this.productImages = initialImages;
298
+ })
299
+ .then(() => this.modal.stopLoading())
300
+ .then(() => this.afterOrderLoaded())
301
+ .catch(e => {
302
+ resolve(false);
303
+ this.hasError = true;
304
+ this.errorMessage = e.response?.data?.error?.message || e.response?.data;
305
+ this.modal.stopLoading();
306
+ });
307
+ resolve(true);
308
+ }, 50);
309
+ });
310
+ }
311
+ async openEditModal(params) {
312
+ await salla.onReady();
313
+ this.syncStoreSettings();
314
+ this.defaultMode = false;
315
+ this.editMode = true;
316
+ this.editType = params.type;
317
+ this.editFeedbackId = params.feedback_id;
318
+ try {
319
+ await this.fetchEditItem(params.feedback_id);
320
+ if (this.editType === 'product' && this.editItem?.product?.id) {
321
+ await this.loadCustomerOrderForEdit();
322
+ await this.ensureProductFactorsLoaded(this.editItem.product.id);
323
+ this.editFactorRatings = { ...this.buildEditFactorRatings(this.editItem.product.id) };
324
+ this.markExistingFactorRatingsAsUserFilled(this.editItem.product.id, this.editFactorRatings);
325
+ }
326
+ this.editModal.open();
327
+ }
328
+ catch (e) {
329
+ this.hasError = true;
330
+ this.errorMessage = e.response?.data?.error?.message || e.response?.data;
331
+ }
332
+ }
333
+ async fetchEditItem(feedbackId) {
334
+ const endpoint = `rating/${feedbackId}/show`;
335
+ const response = await salla.api.request(endpoint);
336
+ this.editItem = response.data;
337
+ if (this.allowAttachImages && this.editType == 'product' && this.editItem.images.length) {
338
+ this.editItemImages = this.editItem.images.map(img => {
339
+ return { id: `${Math.floor(100 + Math.random() * 900)}`, url: img };
340
+ });
341
+ }
342
+ }
343
+ async editReview() {
344
+ const endpoint = `rating/${this.editFeedbackId}`;
345
+ let data;
346
+ if (this.editType === 'product') {
347
+ const container = this.editModal.querySelector('[data-type="products"]') || this.currentTab;
348
+ data = this.buildProductRatingPayload(this.collectFormData(container), container);
349
+ if (!data.product_id && this.editItem?.product?.id) {
350
+ data.product_id = String(this.editItem.product.id);
351
+ }
352
+ }
353
+ else {
354
+ data = this.collectFormData(this.editModal);
355
+ data.images && (data.images = data.images.split(','));
356
+ }
357
+ await salla.api.request(endpoint, data, 'put').then(res => {
358
+ this.editModal.close();
359
+ salla.notify.success(res.message || this.updatedSuccessfullyLabel);
360
+ setTimeout(() => {
361
+ window.location.reload();
362
+ }, 500);
363
+ });
364
+ }
365
+ async openDeleteModal(params) {
366
+ this.defaultMode = false;
367
+ this.deleteMode = true;
368
+ this.deleteFeedbackId = params.feedback_id;
369
+ this.shouldOpenDeleteModal = true;
370
+ return new Promise(resolve => {
371
+ setTimeout(() => {
372
+ this.deleteModal.open().then(() => resolve(true));
373
+ }, 50);
374
+ });
375
+ }
376
+ async deleteReview() {
377
+ const endpoint = `rating/${this.deleteFeedbackId}`;
378
+ await salla.api.request(endpoint, null, 'delete').then(() => {
379
+ this.deleteModal.close();
380
+ salla.notify.success(this.deletedSuccessfullyLabel);
381
+ setTimeout(() => {
382
+ window.location.reload();
383
+ }, 500);
384
+ });
385
+ }
386
+ /**
387
+ * Show the rating modal
388
+ */
389
+ async close() {
390
+ return this.modal.close();
391
+ }
392
+ // handle wizard
393
+ handleWizard() {
394
+ this.steps = this.modal.querySelectorAll('.s-rating-modal-step');
395
+ this.dots = this.modal.querySelectorAll('.s-rating-modal-step-dot');
396
+ if (this.stepsCount === 0) {
397
+ this.showThankYou();
398
+ return;
399
+ }
400
+ this.showActiveStep();
401
+ }
402
+ refreshWizardRefs() {
403
+ if (!this.modal) {
404
+ return;
405
+ }
406
+ this.steps = this.modal.querySelectorAll('.s-rating-modal-step');
407
+ this.dots = this.modal.querySelectorAll('.s-rating-modal-step-dot');
408
+ }
409
+ showActiveStep(current = null) {
410
+ this.refreshWizardRefs();
411
+ this.currentTab = current || this.steps[this.currentIndex];
412
+ if (!this.currentTab) {
413
+ return;
414
+ }
415
+ Helper.toggleClassIf('.s-rating-modal-step-dot', 's-rating-modal-bg-gray', 's-rating-modal-bg-primary', dot => dot != this.dots[this.currentIndex]).toggleClassIf('.s-rating-modal-step', 's-rating-modal-active', 's-rating-modal-hidden', tab => tab == this.currentTab);
416
+ if (this.currentIndex !== 0) {
417
+ // the animation
418
+ Helper.toggleElementClassIf(this.currentTab, 's-rating-modal-unactive', 's-rating-modal-hidden', () => true);
419
+ setTimeout(() => Helper.toggleElementClassIf(this.currentTab, 's-rating-modal-active', 's-rating-modal-unactive', () => true), 300);
420
+ }
421
+ // Btn text
422
+ const nextType = this.steps[this.currentIndex + 1]?.dataset.type;
423
+ this.nextBtn?.setText(nextType
424
+ ? `${salla.lang.get('pages.rating.rate')} ${salla.lang.get(`pages.rating.${nextType}`)}`
425
+ : salla.lang.get('pages.rating.send_ratings'));
426
+ setTimeout(() => this.updateBodyHeight(), 0);
427
+ setTimeout(() => this.updateBodyHeight(), 150);
428
+ }
429
+ updateBodyHeight() {
430
+ if (!this.body || !this.currentTab) {
431
+ return;
432
+ }
433
+ // Product step contains async uploader mount; keep height auto to prevent clipping.
434
+ if (this.currentTab.dataset.type === 'products') {
435
+ this.body.style.height = 'auto';
436
+ return;
437
+ }
438
+ const extraHeight = this.editMode ? 60 : 0;
439
+ this.body.style.height = `${this.currentTab.offsetHeight + extraHeight}px`;
440
+ }
441
+ previousTab() {
442
+ this.currentIndex > 0 && this.currentIndex--;
443
+ Helper.toggleElementClassIf(this.backBtn, 's-rating-modal-unvisiable', 'block', () => this.currentIndex == 0);
444
+ this.showActiveStep();
445
+ }
446
+ async submit() {
447
+ this.refreshWizardRefs();
448
+ try {
449
+ if (!this.submittedBefore()) {
450
+ this.validate();
451
+ }
452
+ salla.config.canLeave = false;
453
+ await this.nextBtn.load();
454
+ if (!this.submittedBefore()) {
455
+ await this.sendFeedback();
456
+ }
457
+ this.currentTab
458
+ ?.querySelectorAll('[name],.s-rating-modal-btn-star')
459
+ .forEach(el => el.setAttribute('disabled', ''));
460
+ if (this.currentIndex < this.stepsCount) {
461
+ this.currentIndex++;
462
+ }
463
+ this.showActiveStep();
464
+ Helper.toggleClassIf('#prev-btn', 'block', 's-rating-modal-unvisiable', () => true);
465
+ if (this.currentIndex === this.stepsCount) {
466
+ this.showThankYou();
467
+ this.showContactWidget = false;
468
+ }
469
+ }
470
+ finally {
471
+ this.nextBtn.stop();
472
+ salla.config.canLeave = true;
473
+ }
474
+ }
475
+ submittedBefore() {
476
+ return this.submitted.includes(this.currentIndex);
477
+ }
478
+ getRatingHiddenInput(container) {
479
+ const element = container;
480
+ const directInput = element.querySelector?.('.rating_hidden_input');
481
+ if (directInput?.name) {
482
+ return directInput;
483
+ }
484
+ const starsComponent = element.querySelector?.('salla-rating-stars');
485
+ return (starsComponent?.shadowRoot?.querySelector('.rating_hidden_input') ||
486
+ null);
487
+ }
488
+ collectNamedInputs(container) {
489
+ const seen = new Set();
490
+ const inputs = [];
491
+ const addInput = (input) => {
492
+ if (!input?.name || seen.has(input)) {
493
+ return;
494
+ }
495
+ seen.add(input);
496
+ inputs.push(input);
497
+ };
498
+ container.querySelectorAll('[name]').forEach((input) => {
499
+ addInput(input);
500
+ });
501
+ container.querySelectorAll('salla-rating-stars').forEach((stars) => {
502
+ addInput(this.getRatingHiddenInput(stars));
503
+ });
504
+ return inputs;
505
+ }
506
+ normalizeFactorsList(factors) {
507
+ if (!factors) {
508
+ return [];
509
+ }
510
+ if (Array.isArray(factors)) {
511
+ return factors;
512
+ }
513
+ if (typeof factors === 'object') {
514
+ return Object.values(factors).filter(entry => entry && typeof entry === 'object');
515
+ }
516
+ return [];
517
+ }
518
+ validate(rating = null, type = null) {
519
+ if (!rating && this.currentTab.dataset.type === 'products') {
520
+ const ratingForms = this.currentTab.querySelectorAll('.rating-outer-form');
521
+ ratingForms.forEach(ratingForm => this.validate(ratingForm, 'product'));
522
+ return;
523
+ }
524
+ rating = rating || this.currentTab;
525
+ const mainRatingRow = rating.querySelector('.s-rating-modal-product-rating-row-main');
526
+ const mainRatingInput = this.getRatingHiddenInput(mainRatingRow || rating);
527
+ const stars = mainRatingInput?.value;
528
+ const validationMessage = rating.querySelector('.s-rating-modal-validation-msg');
529
+ type = type || rating.dataset.type;
530
+ if (!stars) {
531
+ validationMessage.innerHTML = salla.lang
532
+ .get(`pages.rating.rate_${type}_stars`)
533
+ .replace(' (:item)', '');
534
+ throw new Error(validationMessage.innerHTML);
535
+ }
536
+ if (type === 'product') {
537
+ const requiredFactorRows = Array.from(rating.querySelectorAll('.s-rating-modal-product-factor-row[data-required="true"]'));
538
+ const hasMissingRequiredFactor = requiredFactorRows.some((row) => {
539
+ const factorStarsInput = this.getRatingHiddenInput(row);
540
+ return !factorStarsInput?.value;
541
+ });
542
+ if (hasMissingRequiredFactor) {
543
+ validationMessage.innerHTML = this.requiredFactorsLabel;
544
+ throw new Error(validationMessage.innerHTML);
545
+ }
546
+ }
547
+ validationMessage.innerHTML = '';
548
+ }
549
+ collectFormData(container = this.currentTab) {
550
+ const data = {};
551
+ this.collectNamedInputs(container).forEach((input) => {
552
+ const inputData = salla.helpers.inputData(input.name, input.value, data);
553
+ data[inputData.name] = inputData.value;
554
+ });
555
+ return data;
556
+ }
557
+ buildProductRatingPayload(data, container = this.currentTab) {
558
+ if (!data.rating) {
559
+ const mainRatingRow = container.querySelector('.s-rating-modal-product-rating-row-main');
560
+ const mainRatingInput = this.getRatingHiddenInput(mainRatingRow || container);
561
+ if (mainRatingInput?.value) {
562
+ data.rating = mainRatingInput.value;
563
+ }
564
+ }
565
+ const productId = Number(data.product_id);
566
+ let images = [];
567
+ if (data.images) {
568
+ images =
569
+ typeof data.images === 'string' ? data.images.split(',').filter(Boolean) : data.images;
570
+ }
571
+ else if (this.editMode && this.allowAttachImages && productId) {
572
+ images = this.editItemImages.map(img => img.url);
573
+ }
574
+ else if (this.allowAttachImages && productId) {
575
+ images = (this.productImages[productId] || []).map(img => img.url);
576
+ }
577
+ const factors = this.normalizeFactorsList(data.factors)
578
+ .filter(factor => factor?.id && factor?.rating)
579
+ .map(factor => ({
580
+ id: String(factor.id),
581
+ rating: String(factor.rating),
582
+ }));
583
+ return {
584
+ order_id: this.getSubmitOrderId(),
585
+ product_id: String(data.product_id),
586
+ rating: String(data.rating),
587
+ comment: data.comment || data.content || '',
588
+ images,
589
+ factors,
590
+ type: 'products',
591
+ };
592
+ }
593
+ async sendFeedback() {
594
+ this.refreshWizardRefs();
595
+ const stepType = this.currentTab?.dataset?.type;
596
+ if (stepType === 'products') {
597
+ const data = this.collectFormData(this.currentTab);
598
+ const payload = this.buildProductRatingPayload(data, this.currentTab);
599
+ if (!payload.product_id || !payload.rating) {
600
+ throw new Error('Missing product rating data');
601
+ }
602
+ const res = await salla.rating.api.products(payload);
603
+ this.submitted.push(this.currentIndex);
604
+ return res;
605
+ }
606
+ const data = this.collectFormData(this.currentTab);
607
+ if (Object.keys(data).length === 0) {
608
+ return;
609
+ }
610
+ data.order_id = this.getSubmitOrderId();
611
+ data.type = stepType;
612
+ const res = await salla.rating.api[stepType](data);
613
+ this.submitted.push(this.currentIndex);
614
+ return res;
615
+ }
616
+ clearThanksCountdown() {
617
+ if (this.thanksCountdownInterval !== null) {
618
+ clearInterval(this.thanksCountdownInterval);
619
+ this.thanksCountdownInterval = null;
620
+ }
621
+ }
622
+ showThankYou() {
623
+ let seconds = 10;
624
+ this.clearThanksCountdown();
625
+ this.thanksCountdownInterval = setInterval(() => {
626
+ this.thanksTime.innerHTML = `00:0${seconds--}`;
627
+ if (seconds > 0) {
628
+ return;
629
+ }
630
+ this.clearThanksCountdown();
631
+ this.thanksTime.remove();
632
+ this.close().then(() => window.location.reload());
633
+ }, 1000);
634
+ this.modal.querySelector('.s-rating-modal-footer').classList.add('s-rating-modal-unvisiable');
635
+ this.showActiveStep(this.thanksTab);
636
+ }
637
+ getFilepondPlaceholder() {
638
+ return `<div class="s-rating-modal-filepond-placeholder"><span class="s-rating-modal-filepond-placeholder-icon">${ImageIcon}</span><p class="s-rating-modal-filepond-placeholder-text">${this.dragAndDropFilesLabel}<br>
639
+ <span> ${this.allowedImagesTypesLabel} <br> ${this.threeImagesMax} </span></p></div>`;
640
+ }
641
+ getCustomerName() {
642
+ let firstName = salla.config.get('user.first_name') || salla.storage.get('user.first_name') || '';
643
+ let lasName = salla.config.get('user.last_name') || salla.storage.get('user.last_name') || '';
644
+ return `${firstName} ${lasName}`;
645
+ }
646
+ normalizeReviewFactorsPayload(payload) {
647
+ const data = payload?.data ?? payload?.factors;
648
+ if (!Array.isArray(data)) {
649
+ return [];
650
+ }
651
+ return data.flatMap(entry => {
652
+ const items = Array.isArray(entry?.items) ? [...entry.items] : null;
653
+ // Nested form shape: only use items[].id, ignore parent entry id
654
+ if (items?.length) {
655
+ items.sort((a, b) => (Number(a?.sort) || 0) - (Number(b?.sort) || 0));
656
+ const isRequired = !!entry?.is_required;
657
+ return items
658
+ .filter(item => item?.id != null && item?.id !== '')
659
+ .map(item => ({
660
+ id: item.id,
661
+ name: item?.name,
662
+ required: isRequired,
663
+ }));
664
+ }
665
+ // Legacy flat shape (no items array)
666
+ if (entry?.id == null || entry?.id === '') {
667
+ return [];
668
+ }
669
+ return [
670
+ {
671
+ id: entry.id,
672
+ name: entry?.name,
673
+ required: entry?.required ?? entry?.is_required ?? false,
674
+ },
675
+ ];
676
+ });
677
+ }
678
+ async fetchProductReviewFactors(productId) {
679
+ try {
680
+ const response = await salla.api.request(`review/factors/${productId}/form`);
681
+ return this.normalizeReviewFactorsPayload(response);
682
+ }
683
+ catch (_error) {
684
+ return [];
685
+ }
686
+ }
687
+ async fetchAllProductReviewFactors(order) {
688
+ const products = this.getRateableProducts(order);
689
+ if (!products.length) {
690
+ return {};
691
+ }
692
+ const pairs = await Promise.all(products.map(async (item) => {
693
+ const factors = await this.fetchProductReviewFactors(item.product.id);
694
+ return [item.product.id, factors];
695
+ }));
696
+ return Object.fromEntries(pairs);
697
+ }
698
+ async ensureProductFactorsLoaded(productId) {
699
+ if (!productId || this.productReviewFactors[productId]) {
700
+ return;
701
+ }
702
+ const factors = await this.fetchProductReviewFactors(productId);
703
+ this.productReviewFactors = {
704
+ ...this.productReviewFactors,
705
+ [productId]: factors,
706
+ };
707
+ }
708
+ getFactorFieldName(prefix, factorIndex, field) {
709
+ return prefix
710
+ ? `${prefix}[factors][${factorIndex}][${field}]`
711
+ : `factors[${factorIndex}][${field}]`;
712
+ }
713
+ normalizeToArray(value) {
714
+ if (value === null || value === undefined) {
715
+ return [];
716
+ }
717
+ return Array.isArray(value) ? value : [value];
718
+ }
719
+ isFactorReviewsList(value) {
720
+ return (Array.isArray(value) &&
721
+ value.length > 0 &&
722
+ value.every(item => item &&
723
+ typeof item === 'object' &&
724
+ (item['rating'] !== undefined ||
725
+ item['stars'] !== undefined ||
726
+ item['value'] !== undefined)));
727
+ }
728
+ getFactorReviewsFromRecord(record) {
729
+ if (!record) {
730
+ return [];
731
+ }
732
+ for (const key of ['factor_reviews', 'review_factors', 'factors']) {
733
+ const value = record[key];
734
+ if (this.isFactorReviewsList(value)) {
735
+ return value;
736
+ }
737
+ }
738
+ return [];
739
+ }
740
+ getEditFactorReviewsList(productId) {
741
+ const orderSources = [this.order, this.getBootstrapOrder()].filter(Boolean);
742
+ for (const order of orderSources) {
743
+ const matchedRating = this.getMatchedProductRating(order, productId, this.editFeedbackId);
744
+ const reviews = this.getFactorReviewsFromRecord(matchedRating);
745
+ if (reviews.length) {
746
+ return reviews;
747
+ }
748
+ }
749
+ const matchedOrderProduct = this.getOrderProducts(this.order).find(item => Number(item.product?.id) === Number(productId));
750
+ const sources = [
751
+ this.editItem?.factor_reviews,
752
+ this.editItem?.review_factors,
753
+ this.editItem?.product?.review_factors,
754
+ this.editItem?.product?.factor_reviews,
755
+ this.editItem?.factors,
756
+ matchedOrderProduct?.factor_reviews,
757
+ matchedOrderProduct?.review_factors,
758
+ matchedOrderProduct?.feedback?.factor_reviews,
759
+ ];
760
+ for (const source of sources) {
761
+ if (Array.isArray(source) && source.length > 0) {
762
+ return source;
763
+ }
764
+ }
765
+ return [];
766
+ }
767
+ getFactorKey(factor, factorIndex) {
768
+ if (factor.id !== undefined && factor.id !== null && factor.id !== '') {
769
+ return `id:${factor.id}`;
770
+ }
771
+ if (factor.name) {
772
+ return `name:${factor.name.trim()}`;
773
+ }
774
+ return `index:${factorIndex}`;
775
+ }
776
+ getFactorRatingsForProduct(productId) {
777
+ return this.editMode ? this.editFactorRatings : this.productFactorRatings[productId] || {};
778
+ }
779
+ setFactorRatingsForProduct(productId, ratings) {
780
+ if (this.editMode) {
781
+ this.editFactorRatings = ratings;
782
+ return;
783
+ }
784
+ this.productFactorRatings = { ...this.productFactorRatings, [productId]: ratings };
785
+ }
786
+ markExistingFactorRatingsAsUserFilled(productId, factorRatings) {
787
+ const factors = this.productReviewFactors[productId] || [];
788
+ const userFilled = new Set();
789
+ factors.forEach((factor, index) => {
790
+ const key = this.getFactorKey(factor, index);
791
+ const byId = factor.id !== undefined ? factorRatings[String(factor.id)] : undefined;
792
+ const byName = factor.name ? factorRatings[factor.name.trim()] : undefined;
793
+ const byIndex = factorRatings[`__index_${index}`];
794
+ if (byId !== undefined || byName !== undefined || byIndex !== undefined) {
795
+ userFilled.add(key);
796
+ }
797
+ });
798
+ this.userFilledFactorKeys[productId] = userFilled;
799
+ }
800
+ shouldAutofillFactors(mainRating) {
801
+ return mainRating === 4 || mainRating === 5;
802
+ }
803
+ autofillUnfilledFactors(productId, mainRating) {
804
+ const factors = this.productReviewFactors[productId] || [];
805
+ if (!factors.length) {
806
+ return;
807
+ }
808
+ const userFilled = this.userFilledFactorKeys[productId] || new Set();
809
+ const currentRatings = { ...this.getFactorRatingsForProduct(productId) };
810
+ const shouldAutofill = this.shouldAutofillFactors(mainRating);
811
+ let updated = false;
812
+ factors.forEach((factor, index) => {
813
+ const key = this.getFactorKey(factor, index);
814
+ if (userFilled.has(key)) {
815
+ return;
816
+ }
817
+ if (shouldAutofill) {
818
+ if (factor.id !== undefined) {
819
+ currentRatings[String(factor.id)] = mainRating;
820
+ }
821
+ if (factor.name) {
822
+ currentRatings[factor.name.trim()] = mainRating;
823
+ }
824
+ currentRatings[`__index_${index}`] = mainRating;
825
+ updated = true;
826
+ return;
827
+ }
828
+ if (factor.id !== undefined && currentRatings[String(factor.id)] !== undefined) {
829
+ delete currentRatings[String(factor.id)];
830
+ updated = true;
831
+ }
832
+ if (factor.name && currentRatings[factor.name.trim()] !== undefined) {
833
+ delete currentRatings[factor.name.trim()];
834
+ updated = true;
835
+ }
836
+ if (currentRatings[`__index_${index}`] !== undefined) {
837
+ delete currentRatings[`__index_${index}`];
838
+ updated = true;
839
+ }
840
+ });
841
+ if (updated) {
842
+ this.setFactorRatingsForProduct(productId, currentRatings);
843
+ }
844
+ }
845
+ handleMainRatingChange(productId, rating) {
846
+ if (this.editMode) {
847
+ this.editMainRating = rating;
848
+ }
849
+ else {
850
+ this.productMainRatings = { ...this.productMainRatings, [productId]: rating };
851
+ }
852
+ this.autofillUnfilledFactors(productId, rating);
853
+ }
854
+ handleFactorRatingChange(productId, factorKey, rating) {
855
+ if (!this.userFilledFactorKeys[productId]) {
856
+ this.userFilledFactorKeys[productId] = new Set();
857
+ }
858
+ this.userFilledFactorKeys[productId].add(factorKey);
859
+ const factors = this.productReviewFactors[productId] || [];
860
+ const factorIndex = factors.findIndex((factor, index) => this.getFactorKey(factor, index) === factorKey);
861
+ if (factorIndex < 0) {
862
+ return;
863
+ }
864
+ const factor = factors[factorIndex];
865
+ const currentRatings = { ...this.getFactorRatingsForProduct(productId) };
866
+ if (factor.id !== undefined) {
867
+ currentRatings[String(factor.id)] = rating;
868
+ }
869
+ if (factor.name) {
870
+ currentRatings[factor.name.trim()] = rating;
871
+ }
872
+ currentRatings[`__index_${factorIndex}`] = rating;
873
+ this.setFactorRatingsForProduct(productId, currentRatings);
874
+ }
875
+ setupProductRatingAutofill(container, productId) {
876
+ if (!container || this.boundRatingRows.has(container)) {
877
+ return;
878
+ }
879
+ this.boundRatingRows.add(container);
880
+ container.addEventListener('click', event => {
881
+ const target = event.target;
882
+ if (!target.closest('.s-rating-stars-btn-star')) {
883
+ return;
884
+ }
885
+ const mainRow = target.closest('.s-rating-modal-product-rating-row-main');
886
+ const factorRow = target.closest('.s-rating-modal-product-factor-row');
887
+ requestAnimationFrame(() => {
888
+ if (mainRow && container.contains(mainRow)) {
889
+ const rating = Number(this.getRatingHiddenInput(mainRow)?.value);
890
+ if (rating > 0) {
891
+ this.handleMainRatingChange(productId, rating);
892
+ }
893
+ return;
894
+ }
895
+ if (factorRow && container.contains(factorRow)) {
896
+ const factorKey = factorRow.getAttribute('data-factor-key');
897
+ const rating = Number(this.getRatingHiddenInput(factorRow)?.value);
898
+ if (factorKey && rating > 0) {
899
+ this.handleFactorRatingChange(productId, factorKey, rating);
900
+ }
901
+ }
902
+ });
903
+ });
904
+ }
905
+ buildEditFactorRatings(productId) {
906
+ const factorReviews = this.getEditFactorReviewsList(productId);
907
+ return factorReviews.reduce((acc, factor, index) => {
908
+ const rating = Number(factor?.rating ?? factor?.stars ?? factor?.value);
909
+ if (Number.isNaN(rating)) {
910
+ return acc;
911
+ }
912
+ const factorId = factor?.id ?? factor?.factor_id;
913
+ if (factorId !== undefined && factorId !== null && factorId !== '') {
914
+ acc[String(factorId)] = rating;
915
+ }
916
+ if (factor?.name) {
917
+ acc[factor.name.trim()] = rating;
918
+ }
919
+ acc[`__index_${index}`] = rating;
920
+ return acc;
921
+ }, {});
922
+ }
923
+ renderProductStep(item, index) {
924
+ return (h("section", { class: "s-rating-modal-step s-rating-modal-hidden", "data-type": "products", "data-product-id": item.product.id, key: item.product.id }, h("div", { class: "s-rating-modal-product" }, h("div", { class: "rating-outer-form", "data-stars-error": salla.lang.get('pages.rating.rate_product_stars') }, h("div", { class: "s-rating-modal-product-details" }, h("div", { class: "s-rating-modal-product-info-row" }, h("div", { class: "s-rating-modal-product-img-wrap" }, h("img", { src: item.product.thumbnail, alt: item.product.name, class: "s-rating-modal-product-img" })), h("h3", { class: "s-rating-modal-product-title" }, item.product.name)), this.renderProductReviewFactors(item.product.id, 0, { fieldPrefix: '' }), h("input", { type: "hidden", name: "product_id", value: item.product.id }), h("textarea", { placeholder: salla.lang.get('pages.rating.write_product_rate'), name: "comment", class: "s-rating-modal-comment" }), h("small", { class: "s-rating-modal-validation-msg" }))), this.allowAttachImages && (h("div", { class: "s-rating-modal-uploader is-opened", ref: el => (this.contentRefs[index] = el) }, h("salla-file-upload", { name: "image", maxFilesCount: this.MAX_UPLOAD_LIMIT, imagePreviewHeight: 117, "instant-upload": true, type: "feedback", payloadName: "files[]", id: `file-${item.product.id}`, title: item.product.name, allowMultiple: true, instantUpload: true, accept: "image/png, image/jpeg, image/jpg", url: salla.url.api('upload'), onUploaded: e => {
925
+ this.productImages = {
926
+ ...this.productImages,
927
+ [item.product.id]: [...(this.productImages[item.product.id] || []), e.detail],
928
+ };
929
+ this.hiddenInputs[index].value = this.productImages[item.product.id]
930
+ .map(img => img.url)
931
+ .join(',');
932
+ }, onRemoved: e => {
933
+ const removedId = e.detail;
934
+ if (!removedId || !this.productImages[item.product.id])
935
+ return;
936
+ this.productImages = {
937
+ ...this.productImages,
938
+ [item.product.id]: this.productImages[item.product.id].filter(img => img.id !== removedId),
939
+ };
940
+ this.hiddenInputs[index].value = this.productImages[item.product.id]
941
+ .map(img => img.url)
942
+ .join(',');
943
+ }, labelIdle: this.getFilepondPlaceholder() }), h("input", { type: "hidden", name: "images", value: (this.productImages[item.product.id] || []).map(img => img.url).join(','), ref: el => (this.hiddenInputs[index] = el) }), this.renderUploadedImagesCount(item.product.id))))));
944
+ }
945
+ renderProductReviewFactors(productId, index, options = {}) {
946
+ const factors = this.productReviewFactors[productId] || [];
947
+ const fieldPrefix = options.fieldPrefix ?? `products[${index}]`;
948
+ const mainRatingName = fieldPrefix ? `${fieldPrefix}[rating]` : 'rating';
949
+ const factorRatings = {
950
+ ...(this.editMode ? {} : this.productFactorRatings[productId] || {}),
951
+ ...(options.factorRatings || {}),
952
+ };
953
+ const normalizedMainRating = Number(options.mainRating ??
954
+ (this.editMode ? this.editMainRating : this.productMainRatings[productId]));
955
+ const hasMainRating = !Number.isNaN(normalizedMainRating);
956
+ const getPrefilledFactorRating = (factor, factorIndex) => {
957
+ const byId = factor.id !== undefined ? factorRatings[String(factor.id)] : undefined;
958
+ const byName = factor.name ? factorRatings[factor.name.trim()] : undefined;
959
+ const byIndex = factorRatings[`__index_${factorIndex}`];
960
+ const normalized = Number(byId ?? byName ?? byIndex);
961
+ return Number.isNaN(normalized) ? undefined : normalized;
962
+ };
963
+ return (h("div", { class: "s-rating-modal-product-rating-rows", ref: el => this.setupProductRatingAutofill(el, productId) }, h("div", { class: "s-rating-modal-product-rating-row s-rating-modal-product-rating-row-main" }, h("span", { class: "s-rating-modal-product-factor-name" }, this.overallProductRatingLabel, h("span", { class: "s-rating-modal-product-factor-required" }, "*")), h("salla-rating-stars", { size: "medium", name: mainRatingName, key: hasMainRating ? `main-rating-${normalizedMainRating}` : 'main-rating-empty', value: hasMainRating ? normalizedMainRating : undefined, editable: hasMainRating, withLabel: true, labelBeforeStars: true, tag: false })), factors.map((factor, factorIndex) => (h("div", { class: "s-rating-modal-product-rating-row s-rating-modal-product-factor-row px-3", "data-required": factor.required ? 'true' : 'false', "data-factor-key": this.getFactorKey(factor, factorIndex) }, h("input", { type: "hidden", name: this.getFactorFieldName(fieldPrefix, factorIndex, 'name'), value: factor.name }), !!factor.id && (h("input", { type: "hidden", name: this.getFactorFieldName(fieldPrefix, factorIndex, 'id'), value: String(factor.id) })), h("span", { class: "s-rating-modal-product-factor-name" }, factor.name, factor.required ? h("span", { class: "s-rating-modal-product-factor-required" }, "*") : ''), h("salla-rating-stars", { size: "medium", name: this.getFactorFieldName(fieldPrefix, factorIndex, 'rating'), key: `factor-rating-${factor.id ?? factorIndex}-${getPrefilledFactorRating(factor, factorIndex) ?? 0}`, value: getPrefilledFactorRating(factor, factorIndex), editable: options.alwaysEditable ||
964
+ typeof getPrefilledFactorRating(factor, factorIndex) === 'number', withLabel: true, labelBeforeStars: true, tag: false }))))));
965
+ }
966
+ handleSendEmail() {
967
+ const subject = `${this.contactSubjectLabel} #${this.order.id}`;
968
+ const body = this.contact_body(salla.config.get('store.name'), this.order.id, this.getCustomerName());
969
+ const mailtoLink = `mailto:${salla.config.get('store.contacts.email')}?subject=${encodeURIComponent(subject)}&body=${encodeURIComponent(body)}`;
970
+ window.open(mailtoLink, '_blank');
971
+ }
972
+ handleSendWhatsApp() {
973
+ const body = this.contact_body(salla.config.get('store.name'), this.order.id, this.getCustomerName());
974
+ const whatsappLink = `https://wa.me/${salla.config.get('store.contacts.whatsapp')}?text=${encodeURIComponent(body)}`;
975
+ window.open(whatsappLink, '_blank');
976
+ }
977
+ resetData(isOpen) {
978
+ if (isOpen.detail) {
979
+ return;
980
+ }
981
+ this.clearThanksCountdown();
982
+ this.modal?.close();
983
+ this.editItem = null;
984
+ this.editItemImages = [];
985
+ this.editFactorRatings = {};
986
+ this.productMainRatings = {};
987
+ this.productFactorRatings = {};
988
+ this.editMainRating = undefined;
989
+ this.userFilledFactorKeys = {};
990
+ this.hiddenInputs[1] && (this.hiddenInputs[1].value = '');
991
+ this.deleteFeedbackId = null;
992
+ this.editFeedbackId = null;
993
+ this.shouldOpenDeleteModal = false;
994
+ this.editMode = false;
995
+ this.deleteMode = false;
996
+ this.defaultMode = false;
997
+ this.currentIndex = 0;
998
+ this.submitted = [];
999
+ this.scheduleWizardSetup = false;
1000
+ }
1001
+ getDeleteModal() {
1002
+ return (h("salla-modal", { ref: modal => (this.deleteModal = modal), width: "xs", onModalVisibilityChanged: isOpen => this.resetData(isOpen) }, h("div", { class: "s-rating-modal-delete-wrapper", ref: el => (this.body = el) }, h("h3", null, this.confirmDeletionLabel), h("p", null, this.areYouSureLabel), h("div", { class: "s-rating-modal-delete-actions" }, h("salla-button", { loaderPosition: "center", onClick: () => this.deleteReview() }, this.confirmDeleteBtn), h("salla-button", { color: "danger", fill: "outline", onClick: () => this.deleteModal.close() }, this.cancelLabel)))));
1003
+ }
1004
+ renderUploadedImagesCount(productId) {
1005
+ // In edit mode, use editItemImages; in default mode, use productImages
1006
+ const imageCount = this.editMode
1007
+ ? this.editItemImages.length
1008
+ : (this.productImages[productId] || []).length;
1009
+ return (h("span", { class: "s-rating-modal-upload-count" }, salla.lang.choice('pages.rating.images_count', imageCount, {
1010
+ current: imageCount,
1011
+ total: this.MAX_UPLOAD_LIMIT,
1012
+ })));
1013
+ }
1014
+ getEditModal() {
1015
+ return (h("salla-modal", { ref: modal => (this.editModal = modal), width: "md", onModalVisibilityChanged: isOpen => this.resetData(isOpen) }, h("div", { class: "s-rating-modal-edit-wrapper", ref: el => (this.body = el) }, this.editType === 'store' && this.editItem ? (h("div", { class: "rating-outer-form s-rating-modal-step-wrap s-rating-modal-step", "data-type": "store", ref: currentTab => (this.currentTab = currentTab) }, h("div", { class: "s-rating-modal-rounded-icon" }, h("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" })), h("h2", { class: "s-rating-modal-title" }, salla.lang.get('pages.rating.rate_the_store')), h("div", { class: "s-rating-modal-stars-company" }, h("salla-rating-stars", { withLabel: true, size: "large", editable: true, value: this.editItem.stars })), h("textarea", { name: "content", value: this.editItem.content, class: "s-rating-modal-comment", placeholder: salla.lang.get('pages.rating.write_store_rate') }), h("small", { class: "s-rating-modal-validation-msg" }))) : null, this.editType === 'shipping' && this.editItem ? (h("div", { class: "rating-outer-form s-rating-modal-step-wrap s-rating-modal-step", "data-type": "shipping", ref: currentTab => (this.currentTab = currentTab) }, this.editItem.shipping.logo ? (h("div", { class: "s-rating-modal-rounded-icon" }, h("img", { src: this.editItem.shipping.logo, class: "s-rating-modal-shipping-logo", alt: this.editItem.shipping.name }))) : (h("span", { class: "s-rating-modal-icon", innerHTML: ShippingFast })), h("div", { class: "s-rating-modal-title" }, ' ', `${salla.lang.get('pages.rating.rate_shipping')} ${this.editItem.shipping.name}`), h("div", { class: "s-rating-modal-stars-company" }, h("salla-rating-stars", { withLabel: true, size: "large", editable: true, value: this.editItem.stars })), h("textarea", { name: "content", class: "s-rating-modal-comment", value: this.editItem.content, placeholder: salla.lang.get('pages.rating.write_shipping_rate') }), h("small", { class: "s-rating-modal-validation-msg" }))) : null, this.editType == 'product' && this.editItem ? (h("section", { class: "s-rating-modal-step", "data-type": "products", ref: currentTab => (this.currentTab = currentTab) }, h("div", { class: "s-rating-modal-product" }, h("div", { class: "rating-outer-form", "data-stars-error": salla.lang.get('pages.rating.rate_product_stars') }, h("div", { class: "s-rating-modal-product-details" }, h("div", { class: "s-rating-modal-product-info-row" }, h("div", { class: "s-rating-modal-product-img-wrap" }, h("img", { src: this.editItem.product.image.url, alt: this.editItem.product.name, class: "s-rating-modal-product-img" })), h("h3", { class: "s-rating-modal-product-title" }, this.editItem.product.name)), this.renderProductReviewFactors(this.editItem.product.id, 0, {
1016
+ fieldPrefix: '',
1017
+ mainRating: this.editMainRating ?? Number(this.editItem.stars ?? this.editItem.rating),
1018
+ factorRatings: this.editFactorRatings,
1019
+ alwaysEditable: true,
1020
+ }), h("input", { type: "hidden", name: "product_id", value: this.editItem.product.id }), h("textarea", { value: this.editItem.content, placeholder: salla.lang.get('pages.rating.write_product_rate'), name: "comment", class: "s-rating-modal-comment" }), h("small", { class: "s-rating-modal-validation-msg" }))), this.allowAttachImages && (h("div", { class: "s-rating-modal-uploader is-opened", ref: el => (this.contentRefs[1] = el) }, h("salla-file-upload", { name: "images", allowMultiple: true, maxFilesCount: this.MAX_UPLOAD_LIMIT, imagePreviewHeight: 117, filePosterHeight: 117, "instant-upload": true, type: "feedback", files: JSON.stringify(this.editItemImages), payloadName: "files[]", id: `file-${this.editItem.product.id}`, title: this.editItem.product.name, instantUpload: true, accept: "image/png, image/jpeg, image/jpg", url: salla.url.api('upload'), onUploaded: e => {
1021
+ this.editItemImages = [
1022
+ ...this.editItemImages,
1023
+ e.detail,
1024
+ ];
1025
+ this.hiddenInputs[1].value = this.editItemImages.map(img => img.url).join();
1026
+ }, onRemoved: e => {
1027
+ const removedId = e.detail;
1028
+ if (!removedId)
1029
+ return;
1030
+ this.editItemImages = this.editItemImages.filter(img => img.id !== removedId);
1031
+ this.hiddenInputs[1].value = this.editItemImages.map(img => img.url).join();
1032
+ }, labelIdle: this.getFilepondPlaceholder() }), h("input", { type: "hidden", name: "images", value: this.editItemImages.map(img => img.url).join(','), ref: el => (this.hiddenInputs[1] = el) }), this.renderUploadedImagesCount(this.editItem.product.id)))))) : null, h("div", { class: "s-rating-modal-footer s-rating-modal-footer-end" }, h("salla-button", { "loader-position": "center", onClick: () => this.editReview() }, this.editReviewLabel)))));
1033
+ }
1034
+ render() {
1035
+ if (this.deleteMode) {
1036
+ return h(Host, { class: "s-rating-modal" }, this.getDeleteModal());
1037
+ }
1038
+ if (this.editMode) {
1039
+ return h(Host, { class: "s-rating-modal" }, this.getEditModal());
1040
+ }
1041
+ if (this.defaultMode) {
1042
+ return (h(Host, { class: "s-rating-modal" }, h("salla-modal", { class: "s-rating-modal-wrap", onModalVisibilityChanged: isOpen => this.resetData(isOpen), isLoading: true, width: "md", ref: modal => (this.modal = modal) }, h("div", { slot: "loading" }, h("div", { class: "s-rating-modal-skeleton" }, h("salla-skeleton", { type: "circle", height: "80px", width: "80px" }), h("salla-skeleton", { height: "15px", width: "60%" }), h("salla-skeleton", { height: "10px", width: "30%" }), h("div", { class: "s-rating-modal-skeleton-stars" }, [...Array(5)].map(v => (h("div", { key: v, innerHTML: WishListIcon })))), h("salla-skeleton", { height: "100px", width: "100%" }), h("div", { class: "s-rating-modal-skeleton-footer" }, h("salla-skeleton", { height: "40px", width: "30%" })))), !this.hasError && this.order ? ([
1043
+ h("div", { class: "s-rating-modal-wrapper", ref: el => (this.body = el) }, this.isTestimonialsEnabled() ? (h("div", { class: "rating-outer-form s-rating-modal-step-wrap s-rating-modal-step s-rating-modal-hidden", "data-type": "store" }, h("div", { class: "s-rating-modal-rounded-icon" }, h("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" })), h("h2", { class: "s-rating-modal-title" }, salla.lang.get('pages.rating.rate_the_store')), h("div", { class: "s-rating-modal-stars-company" }, h("salla-rating-stars", { withLabel: true, size: "large" })), h("textarea", { name: "comment", class: "s-rating-modal-comment", placeholder: salla.lang.get('pages.rating.write_store_rate') }), h("small", { class: "s-rating-modal-validation-msg" }))) : (''), this.isProductsEnabled() &&
1044
+ this.getRateableProducts().map((item, index) => this.renderProductStep(item, index)), this.isShippingEnabled() && this.order.shipping?.company ? (h("div", { class: "rating-outer-form s-rating-modal-step-wrap s-rating-modal-step s-rating-modal-hidden", "data-type": "shipping" }, h("input", { type: "hidden", name: "shipping_company_id", value: this.order.shipping.company.id }), this.order.shipping.company.logo ? (h("div", { class: "s-rating-modal-rounded-icon" }, h("img", { src: this.order.shipping.company.logo, class: "s-rating-modal-shipping-logo", alt: this.order.shipping.company.name }))) : (h("span", { class: "s-rating-modal-icon", innerHTML: ShippingFast })), h("div", { class: "s-rating-modal-title" }, ' ', `${salla.lang.get('pages.rating.rate_shipping')} ${this.order.shipping.company.name}`), h("div", { class: "s-rating-modal-stars-company" }, h("salla-rating-stars", { withLabel: true, size: "large" })), h("textarea", { name: "comment", class: "s-rating-modal-comment", placeholder: salla.lang.get('pages.rating.write_shipping_rate') }), h("small", { class: "s-rating-modal-validation-msg" }))) : (''), h("div", { class: "s-rating-modal-thanks s-rating-modal-hidden", ref: el => (this.thanksTab = el) }, h("span", { class: "s-rating-modal-icon", innerHTML: CheckCircle2 }), h("h3", { class: "s-rating-modal-thanks-title" }, salla.lang.get('pages.rating.thanks')), h("div", { class: "s-rating-modal-thanks-msg", innerHTML: this.order.thanks_message }), h("time", { class: "s-rating-modal-thanks-time", ref: el => (this.thanksTime = el) }))),
1045
+ this.allowContactSupport &&
1046
+ this.showContactWidget &&
1047
+ (salla.config.get('store.contacts.whatsapp') ||
1048
+ salla.config.get('store.contacts.email')) ? (h("div", { class: "s-rating-modal-contact" }, h("p", null, this.contactUsLabel), h("div", { class: "s-rating-modal-contact-icons" }, salla.config.get('store.contacts.whatsapp') && (h("span", { onClick: () => this.handleSendWhatsApp(), innerHTML: WhatsappIcon })), salla.config.get('store.contacts.email') && (h("span", { onClick: () => this.handleSendEmail(), innerHTML: MailIcon }))))) : (''),
1049
+ h("div", { class: "s-rating-modal-footer" }, h("button", { ref: el => (this.backBtn = el), onClick: () => this.previousTab(), class: "s-rating-modal-btn s-rating-modal-unvisiable" }, salla.lang.get('common.elements.back')), this.stepsCount > 1 ? (h("ul", { class: "s-rating-modal-dots" }, [...Array(this.stepsCount)].map((_, v) => (h("li", { key: v, class: "s-rating-modal-bg-gray s-rating-modal-step-dot" }))))) : (''), h("salla-button", { "loader-position": "center", ref: el => (this.nextBtn = el), onClick: () => this.submit() }, salla.lang.get('common.elements.next'))),
1050
+ ]) : (h("salla-placeholder", { alignment: "center" })))));
1051
+ }
1052
+ }
1053
+ async componentWillLoad() {
1054
+ await salla.onReady();
1055
+ this.syncStoreSettings();
1056
+ }
1057
+ componentDidRender() {
1058
+ if (!this.scheduleWizardSetup || !this.defaultMode || !this.order) {
1059
+ return;
1060
+ }
1061
+ this.scheduleWizardSetup = false;
1062
+ requestAnimationFrame(() => this.handleWizard());
1063
+ }
1064
+ disconnectedCallback() {
1065
+ this.clearThanksCountdown();
1066
+ }
1067
+ get host() { return this; }
1068
+ static get style() { return sallaRatingModalCss; }
1069
+ }, [0, "salla-rating-modal-v2", {
1070
+ "orderId": [2, "order-id"],
1071
+ "order": [32],
1072
+ "hasError": [32],
1073
+ "showContactWidget": [32],
1074
+ "errorMessage": [32],
1075
+ "images": [32],
1076
+ "productImages": [32],
1077
+ "editItemImages": [32],
1078
+ "productReviewFactors": [32],
1079
+ "editFactorRatings": [32],
1080
+ "productMainRatings": [32],
1081
+ "productFactorRatings": [32],
1082
+ "editMainRating": [32],
1083
+ "contact_body": [32],
1084
+ "editMode": [32],
1085
+ "defaultMode": [32],
1086
+ "deleteMode": [32],
1087
+ "shouldOpenDeleteModal": [32],
1088
+ "editType": [32],
1089
+ "editFeedbackId": [32],
1090
+ "deleteFeedbackId": [32],
1091
+ "editItem": [32],
1092
+ "allowAttachImages": [32],
1093
+ "allowContactSupport": [32],
1094
+ "open": [64],
1095
+ "openEditModal": [64],
1096
+ "openDeleteModal": [64],
1097
+ "close": [64]
1098
+ }]);
1099
+ function defineCustomElement() {
1100
+ if (typeof customElements === "undefined") {
1101
+ return;
1102
+ }
1103
+ const components = ["salla-rating-modal-v2", "salla-button", "salla-file-upload", "salla-loading", "salla-modal", "salla-placeholder", "salla-rating-stars", "salla-skeleton"];
1104
+ components.forEach(tagName => { switch (tagName) {
1105
+ case "salla-rating-modal-v2":
1106
+ if (!customElements.get(tagName)) {
1107
+ customElements.define(tagName, SallaRatingModalV2);
1108
+ }
1109
+ break;
1110
+ case "salla-button":
1111
+ if (!customElements.get(tagName)) {
1112
+ defineCustomElement$7();
1113
+ }
1114
+ break;
1115
+ case "salla-file-upload":
1116
+ if (!customElements.get(tagName)) {
1117
+ defineCustomElement$6();
1118
+ }
1119
+ break;
1120
+ case "salla-loading":
1121
+ if (!customElements.get(tagName)) {
1122
+ defineCustomElement$5();
1123
+ }
1124
+ break;
1125
+ case "salla-modal":
1126
+ if (!customElements.get(tagName)) {
1127
+ defineCustomElement$4();
1128
+ }
1129
+ break;
1130
+ case "salla-placeholder":
1131
+ if (!customElements.get(tagName)) {
1132
+ defineCustomElement$3();
1133
+ }
1134
+ break;
1135
+ case "salla-rating-stars":
1136
+ if (!customElements.get(tagName)) {
1137
+ defineCustomElement$2();
1138
+ }
1139
+ break;
1140
+ case "salla-skeleton":
1141
+ if (!customElements.get(tagName)) {
1142
+ defineCustomElement$1();
1143
+ }
1144
+ break;
1145
+ } });
1146
+ }
1147
+ defineCustomElement();
1148
+
1149
+ export { ShippingFast as S, SallaRatingModalV2 as a, defineCustomElement as d };