@salla.sa/twilight-components 2.14.489 → 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 (401) hide show
  1. package/dist/cjs/{filepond-C-1J1qrF.js → filepond-C8OgCkk4.js} +1 -1
  2. package/dist/cjs/{filepond-plugin-file-poster-B8fUrKqJ.js → filepond-plugin-file-poster-W7CIIo06.js} +1 -1
  3. package/dist/cjs/{filepond-plugin-file-validate-size-BJ4Bw3Ju.js → filepond-plugin-file-validate-size-b6owsb9D.js} +1 -1
  4. package/dist/cjs/{filepond-plugin-file-validate-type-D_Smjf6h.js → filepond-plugin-file-validate-type-_rafsi9p.js} +1 -1
  5. package/dist/cjs/{filepond-plugin-image-edit-BDZBDL-U.js → filepond-plugin-image-edit-7_W-TDnV.js} +1 -1
  6. package/dist/cjs/{filepond-plugin-image-exif-orientation-B68mU2op.js → filepond-plugin-image-exif-orientation-BqHzmoQr.js} +1 -1
  7. package/dist/cjs/{filepond-plugin-image-preview-B2RzZ9r9.js → filepond-plugin-image-preview-CXYMGZyB.js} +1 -1
  8. package/dist/cjs/{functions-DdZX56J7.js → functions-DEYiJNeU.js} +1 -1
  9. package/dist/cjs/{index-DWea49r_.js → index-DFAB8ROR.js} +17 -5
  10. package/dist/cjs/{index-B5CW9Xve.js → index-DQxFCAkS.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-DNxhV4_1.js → tracked-promise-BFI0OYlh.js} +1 -1
  108. package/dist/cjs/twilight.cjs.js +2 -2
  109. package/dist/cjs/{vanilla-picker-ClijNDRd.js → vanilla-picker-X9clH5_E.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-z2hEBvHC.js → filepond-DnJWzWeX.js} +1 -1
  168. package/dist/esm/{filepond-plugin-file-poster-B9sxi6Yz.js → filepond-plugin-file-poster-CQjIyjj0.js} +1 -1
  169. package/dist/esm/{filepond-plugin-file-validate-size-HWpVatr_.js → filepond-plugin-file-validate-size-BHmdR08m.js} +1 -1
  170. package/dist/esm/{filepond-plugin-file-validate-type-SgpUhQB_.js → filepond-plugin-file-validate-type-DKZI4Udo.js} +1 -1
  171. package/dist/esm/{filepond-plugin-image-edit-0F90Q6lM.js → filepond-plugin-image-edit-BEu3qWM8.js} +1 -1
  172. package/dist/esm/{filepond-plugin-image-exif-orientation-CXJDp_1v.js → filepond-plugin-image-exif-orientation-BnEErRDJ.js} +1 -1
  173. package/dist/esm/{filepond-plugin-image-preview-APl1nt4k.js → filepond-plugin-image-preview-C5uMnAXy.js} +1 -1
  174. package/dist/esm/{functions-BCdJLPcs.js → functions-BHv4YCak.js} +1 -1
  175. package/dist/esm/{index-DNWyGkAx.js → index-CrMCOyRb.js} +17 -5
  176. package/dist/esm/{index-DhwQVX77.js → index-DNoSNI6q.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-CjtqaGP2.js → tracked-promise-DoP8oegK.js} +1 -1
  274. package/dist/esm/twilight.js +3 -3
  275. package/dist/esm/{vanilla-picker-DPMDb9SB.js → vanilla-picker-DHvTWQwH.js} +1 -1
  276. package/dist/twilight/{p-0a9af711.entry.js → p-01cd666a.entry.js} +1 -1
  277. package/dist/twilight/{p-ef2d94d3.entry.js → p-02bda539.entry.js} +1 -1
  278. package/dist/twilight/{p-e9cdcf2f.entry.js → p-0569fa78.entry.js} +1 -1
  279. package/dist/twilight/{p-47dd6817.entry.js → p-0a851930.entry.js} +1 -1
  280. package/dist/twilight/{p-338a55c1.entry.js → p-0b6623d1.entry.js} +1 -1
  281. package/dist/twilight/{p-082f3913.entry.js → p-0e9f471f.entry.js} +1 -1
  282. package/dist/twilight/{p-3c10826c.entry.js → p-0f6bc387.entry.js} +1 -1
  283. package/dist/twilight/{p-02e2f661.entry.js → p-10cfb2e6.entry.js} +1 -1
  284. package/dist/twilight/{p-85fc94be.entry.js → p-1351776d.entry.js} +1 -1
  285. package/dist/twilight/{p-f6d6dada.entry.js → p-14c28037.entry.js} +1 -1
  286. package/dist/twilight/{p-24127075.entry.js → p-158b25d6.entry.js} +1 -1
  287. package/dist/twilight/{p-0cd023d2.entry.js → p-180efa36.entry.js} +1 -1
  288. package/dist/twilight/{p-602df9ed.entry.js → p-1a89b6e6.entry.js} +1 -1
  289. package/dist/twilight/p-1d1598f2.entry.js +4 -0
  290. package/dist/twilight/{p-db9dc344.entry.js → p-24a33e42.entry.js} +1 -1
  291. package/dist/twilight/{p-12ccff98.entry.js → p-2565c8a8.entry.js} +1 -1
  292. package/dist/twilight/{p-c84ada78.entry.js → p-27ba15f4.entry.js} +1 -1
  293. package/dist/twilight/{p-52283d18.entry.js → p-2abf9e37.entry.js} +1 -1
  294. package/dist/twilight/p-2be2e677.entry.js +4 -0
  295. package/dist/twilight/{p-094dcf0c.entry.js → p-3301eb04.entry.js} +1 -1
  296. package/dist/twilight/{p-26faf85e.entry.js → p-3394398c.entry.js} +1 -1
  297. package/dist/twilight/{p-b5d32897.entry.js → p-346519c6.entry.js} +1 -1
  298. package/dist/twilight/{p-90534314.entry.js → p-3642805b.entry.js} +1 -1
  299. package/dist/twilight/{p-ed02b506.entry.js → p-3698e128.entry.js} +1 -1
  300. package/dist/twilight/{p-5171b440.entry.js → p-379db48e.entry.js} +1 -1
  301. package/dist/twilight/{p-b6cdfd09.entry.js → p-38f0b921.entry.js} +1 -1
  302. package/dist/twilight/{p-afc451ef.entry.js → p-3d3cebb9.entry.js} +1 -1
  303. package/dist/twilight/{p-3e7a3c6e.entry.js → p-3d3f647d.entry.js} +1 -1
  304. package/dist/twilight/{p-7bbea228.entry.js → p-43b6be6a.entry.js} +1 -1
  305. package/dist/twilight/p-46440c88.entry.js +4 -0
  306. package/dist/twilight/{p-46cd5ece.entry.js → p-484fde1d.entry.js} +1 -1
  307. package/dist/twilight/{p-43a2f42e.entry.js → p-4ee6b3e0.entry.js} +1 -1
  308. package/dist/twilight/{p-f01c12dc.entry.js → p-53188a50.entry.js} +1 -1
  309. package/dist/twilight/{p-b0d5084c.entry.js → p-53b388e5.entry.js} +1 -1
  310. package/dist/twilight/p-5619de6e.entry.js +4 -0
  311. package/dist/twilight/{p-edc4193f.entry.js → p-5832f8ef.entry.js} +1 -1
  312. package/dist/twilight/{p-160fc21e.entry.js → p-5c7dfd69.entry.js} +1 -1
  313. package/dist/twilight/{p-991b1e85.entry.js → p-5d757ebc.entry.js} +1 -1
  314. package/dist/twilight/{p-04a6cb8f.entry.js → p-65745dca.entry.js} +1 -1
  315. package/dist/twilight/{p-8fec15f8.entry.js → p-68a0d7de.entry.js} +1 -1
  316. package/dist/twilight/{p-9474d525.entry.js → p-698202a9.entry.js} +1 -1
  317. package/dist/twilight/{p-4ab4e5ea.entry.js → p-6b0b391f.entry.js} +1 -1
  318. package/dist/twilight/{p-fa5fa155.entry.js → p-6b14b175.entry.js} +1 -1
  319. package/dist/twilight/{p-5993b7d0.entry.js → p-6c03ddfd.entry.js} +1 -1
  320. package/dist/twilight/{p-cee1f87a.entry.js → p-6c25d25f.entry.js} +1 -1
  321. package/dist/twilight/{p-f2dbde1c.entry.js → p-6c7dc86f.entry.js} +1 -1
  322. package/dist/twilight/{p-08641aeb.entry.js → p-6e7c8096.entry.js} +1 -1
  323. package/dist/twilight/{p-844c6c1f.entry.js → p-7269d2ba.entry.js} +1 -1
  324. package/dist/twilight/{p-3f924fc5.entry.js → p-75d546f8.entry.js} +2 -2
  325. package/dist/twilight/{p-6ab60f90.entry.js → p-768077d9.entry.js} +1 -1
  326. package/dist/twilight/{p-39b8ffcd.entry.js → p-79d53d67.entry.js} +1 -1
  327. package/dist/twilight/{p-f14fe365.entry.js → p-7a4328dd.entry.js} +1 -1
  328. package/dist/twilight/{p-1efc0eed.entry.js → p-7a8f4587.entry.js} +1 -1
  329. package/dist/twilight/{p-7fb92e0b.entry.js → p-7ed01fae.entry.js} +1 -1
  330. package/dist/twilight/{p-ab2a5243.entry.js → p-831105b1.entry.js} +1 -1
  331. package/dist/twilight/{p-06966ed6.entry.js → p-83920e60.entry.js} +1 -1
  332. package/dist/twilight/{p-1a957d13.entry.js → p-84ed1fe9.entry.js} +1 -1
  333. package/dist/twilight/{p-3ce46edf.entry.js → p-904d61a5.entry.js} +1 -1
  334. package/dist/twilight/{p-c4c32432.entry.js → p-92212c2c.entry.js} +1 -1
  335. package/dist/twilight/{p-9fc965a7.entry.js → p-92f96da3.entry.js} +1 -1
  336. package/dist/twilight/{p-69766916.entry.js → p-95fd32d1.entry.js} +1 -1
  337. package/dist/twilight/{p-7a0d2f4d.entry.js → p-967a0b5f.entry.js} +1 -1
  338. package/dist/twilight/{p-f9192741.entry.js → p-96bc00e4.entry.js} +1 -1
  339. package/dist/twilight/{p-5wempgCB.js → p-B8h6YT8x.js} +1 -1
  340. package/dist/twilight/{p-Ca18LMTl.js → p-BAPngUXX.js} +1 -1
  341. package/dist/twilight/{p-BwggHXVj.js → p-By0LfFQa.js} +1 -1
  342. package/dist/twilight/{p-CsSICzhL.js → p-C9sdTleU.js} +1 -1
  343. package/dist/twilight/{p-DJ3ziTwG.js → p-CEkVObpk.js} +1 -1
  344. package/dist/twilight/{p-6sBYUIya.js → p-COcTJoQh.js} +1 -1
  345. package/dist/twilight/{p-C72A7Y44.js → p-C_9dEE-y.js} +1 -1
  346. package/dist/twilight/{p-ZT7ehBBk.js → p-CeFAfcTv.js} +1 -1
  347. package/dist/twilight/{p-DNWyGkAx.js → p-CrMCOyRb.js} +2 -2
  348. package/dist/twilight/{p-C5HojqDY.js → p-D7kAm5HN.js} +1 -1
  349. package/dist/twilight/{p-9273a620.entry.js → p-a458dd2a.entry.js} +1 -1
  350. package/dist/twilight/{p-14f8ba23.entry.js → p-a67a69d6.entry.js} +1 -1
  351. package/dist/twilight/{p-cbc66d20.entry.js → p-b02b29fa.entry.js} +1 -1
  352. package/dist/twilight/{p-d239611f.entry.js → p-b0ac8f2d.entry.js} +1 -1
  353. package/dist/twilight/{p-1aeeb0f0.entry.js → p-b6a9c958.entry.js} +1 -1
  354. package/dist/twilight/p-b7e45734.entry.js +4 -0
  355. package/dist/twilight/{p-6852162e.entry.js → p-b82011e6.entry.js} +1 -1
  356. package/dist/twilight/{p-c9aa80c3.entry.js → p-ba9d9441.entry.js} +1 -1
  357. package/dist/twilight/{p-da66f939.entry.js → p-bc231a7f.entry.js} +1 -1
  358. package/dist/twilight/{p-40407996.entry.js → p-be9f3b55.entry.js} +1 -1
  359. package/dist/twilight/p-c0fdeae5.entry.js +4 -0
  360. package/dist/twilight/{p-78f161f2.entry.js → p-c1959cfa.entry.js} +1 -1
  361. package/dist/twilight/{p-f8933bd5.entry.js → p-c34e8a2f.entry.js} +1 -1
  362. package/dist/twilight/{p-85c6c44f.entry.js → p-c40da673.entry.js} +1 -1
  363. package/dist/twilight/{p-6e7a6f4b.entry.js → p-c4981fc4.entry.js} +1 -1
  364. package/dist/twilight/{p-61813e83.entry.js → p-c75169ad.entry.js} +1 -1
  365. package/dist/twilight/{p-4b17c9a0.entry.js → p-cd6617a2.entry.js} +1 -1
  366. package/dist/twilight/{p-ca028945.entry.js → p-ce621f89.entry.js} +1 -1
  367. package/dist/twilight/{p-ac7c0ea4.entry.js → p-cf699819.entry.js} +1 -1
  368. package/dist/twilight/{p-a965c431.entry.js → p-d8b9b23d.entry.js} +1 -1
  369. package/dist/twilight/{p-d3f3eed5.entry.js → p-d90c6504.entry.js} +1 -1
  370. package/dist/twilight/{p-aaf7cbb1.entry.js → p-da875729.entry.js} +1 -1
  371. package/dist/twilight/{p-6891f00b.entry.js → p-db885288.entry.js} +1 -1
  372. package/dist/twilight/{p-cfc209db.entry.js → p-ea7111b7.entry.js} +1 -1
  373. package/dist/twilight/{p-56365c64.entry.js → p-f2a98eb7.entry.js} +1 -1
  374. package/dist/twilight/{p-de942889.entry.js → p-f2c185ff.entry.js} +1 -1
  375. package/dist/twilight/{p-6494c6bf.entry.js → p-f31322cc.entry.js} +1 -1
  376. package/dist/twilight/{p-5b989746.entry.js → p-f6e578f4.entry.js} +1 -1
  377. package/dist/twilight/{p-f2e9d83b.entry.js → p-f82bf774.entry.js} +1 -1
  378. package/dist/twilight/{p-e2da0555.entry.js → p-fd3602a9.entry.js} +1 -1
  379. package/dist/twilight/{p-DQUSqsnq.js → p-hej0tW8f.js} +1 -1
  380. package/dist/twilight/p-lMgMt31Q.js +4 -0
  381. package/dist/twilight/{p-Bw7P5SwX.js → p-pvcZDEed.js} +1 -1
  382. package/dist/twilight/{p-Dp4UckOj.js → p-vj4RR8x2.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-f12a28f9.entry.js +0 -4
  400. package/dist/twilight/p-f6205375.entry.js +0 -4
  401. package/dist/twilight/p-fc676125.entry.js +0 -4
@@ -0,0 +1,1203 @@
1
+ /*!
2
+ * Crafted with ❤ by Salla
3
+ */
4
+ import { h, Host, forceUpdate } from "@stencil/core";
5
+ import Star from "../../assets/svg/star.svg";
6
+ import ShippingFast from "../../assets/svg/shipping-fast.svg";
7
+ import CheckCircle2 from "../../assets/svg/check-circle2.svg";
8
+ import Helper from "../../Helpers/Helper";
9
+ import ImageIcon from "../../assets/svg/image.svg";
10
+ import WhatsappIcon from "../../assets/svg/whatsapp2.svg";
11
+ import MailIcon from "../../assets/svg/mail.svg";
12
+ export class SallaRatingModalV2 {
13
+ constructor() {
14
+ this.hasError = false;
15
+ this.showContactWidget = true;
16
+ this.images = [];
17
+ this.productImages = {};
18
+ this.editItemImages = [];
19
+ this.productReviewFactors = {};
20
+ this.editFactorRatings = {};
21
+ this.productMainRatings = {};
22
+ this.productFactorRatings = {};
23
+ this.contact_body = (store, id, customer) => salla.lang.get('pages.rating.contact_subject', { store, id, customer });
24
+ this.editMode = false;
25
+ this.defaultMode = false;
26
+ this.deleteMode = false;
27
+ this.shouldOpenDeleteModal = false;
28
+ this.editItem = null;
29
+ this.allowAttachImages = false;
30
+ this.allowContactSupport = false;
31
+ this.dragAndDropFilesLabel = salla.lang.get('common.uploader.drag_and_drop_files');
32
+ this.contactSubjectLabel = salla.lang.get('pages.rating.contact_subject');
33
+ this.editReviewLabel = salla.lang.get('pages.rating.edit_review');
34
+ this.allowedImagesTypesLabel = salla.lang.get('common.uploader.allowed_images_types');
35
+ this.threeImagesMax = salla.lang.get('common.uploader.max_three_images');
36
+ this.areYouSureLabel = salla.lang.get('pages.rating.are_you_sure_you_want_to_delete_review');
37
+ this.confirmDeletionLabel = salla.lang.get('pages.rating.confirm_deletion');
38
+ this.cancelLabel = salla.lang.get('common.elements.cancel');
39
+ this.confirmDeleteBtn = salla.lang.get('common.elements.confirm_delete');
40
+ this.updatedSuccessfullyLabel = salla.lang.get('pages.rating.review_updated_successfully');
41
+ this.deletedSuccessfullyLabel = salla.lang.get('pages.rating.review_deleted_successfully');
42
+ this.contactUsLabel = salla.lang.get('blocks.footer.social');
43
+ this.requiredFactorsLabel = salla.lang.get('pages.rating.rate_required_factors');
44
+ this.overallProductRatingLabel = salla.lang.get('pages.rating.overall_product_rating');
45
+ this.contentRefs = [];
46
+ this.hiddenInputs = [];
47
+ this.userFilledFactorKeys = {};
48
+ this.boundRatingRows = new WeakSet();
49
+ this.stepsCount = 0;
50
+ this.currentIndex = 0;
51
+ this.submitted = [];
52
+ this.MAX_UPLOAD_LIMIT = 3;
53
+ this.thanksCountdownInterval = null;
54
+ this.scheduleWizardSetup = false;
55
+ salla.lang.onLoaded(() => {
56
+ this.contactUsLabel = salla.lang.get('blocks.footer.social');
57
+ const setNestedAsync = (lang, key, value) => {
58
+ return new Promise(resolve => {
59
+ salla.helpers.setNested(salla.lang.messages[lang], key, value);
60
+ resolve(true);
61
+ });
62
+ };
63
+ const setTranslations = async () => {
64
+ await setNestedAsync('ar.trans', 'common.uploader.drag_and_drop_files', 'اسحب الملفات وأفلتها هنا');
65
+ await setNestedAsync('en.trans', 'common.uploader.drag_and_drop_files', 'Drag and drop files here');
66
+ await setNestedAsync('ar.trans', 'common.uploader.allowed_images_types', ' .jpg أو jpeg أو png يُسمح بإضافة صور بصيغة');
67
+ await setNestedAsync('en.trans', 'common.uploader.allowed_images_types', 'Images in jpg, jpeg, or png format are allowed.');
68
+ await setNestedAsync('ar.trans', 'pages.rating.add_images', 'اضافة صور');
69
+ await setNestedAsync('en.trans', 'pages.rating.add_images', 'Add Images');
70
+ await setNestedAsync('ar.trans', 'pages.rating.edit_images', 'تعديل الصور');
71
+ await setNestedAsync('en.trans', 'pages.rating.edit_images', 'Edit Images');
72
+ await setNestedAsync('ar.trans', 'pages.rating.edit_review', 'تعديل التقييم');
73
+ await setNestedAsync('en.trans', 'pages.rating.edit_review', 'Edit review');
74
+ await setNestedAsync('ar.trans', 'pages.rating.confirm_deletion', 'تأكيد حذف التقييم');
75
+ await setNestedAsync('en.trans', 'pages.rating.confirm_deletion', 'Confirm review deletion');
76
+ await setNestedAsync('ar.trans', 'pages.rating.are_you_sure_you_want_to_delete_review', 'هل أنت متأكد من حذف تقييمك؟');
77
+ await setNestedAsync('en.trans', 'pages.rating.are_you_sure_you_want_to_delete_review', 'Are you sure you want to delete your review?');
78
+ await setNestedAsync('ar.trans', 'pages.rating.review_updated_successfully', 'تم تعديل التقييم بنجاح');
79
+ await setNestedAsync('en.trans', 'pages.rating.review_updated_successfully', 'The review has been successfully updated.');
80
+ await setNestedAsync('ar.trans', 'pages.rating.review_deleted_successfully', 'تم حذف التقييم بنجاح');
81
+ await setNestedAsync('en.trans', 'pages.rating.review_deleted_successfully', 'The review has been successfully deleted.');
82
+ await setNestedAsync('ar.trans', 'pages.rating.images_count', 'الصور ( :current من أصل :total )');
83
+ await setNestedAsync('en.trans', 'pages.rating.images_count', 'Images ( :current of :total )');
84
+ await setNestedAsync('ar.trans', 'common.uploader.max_three_images', `.أضف ${this.MAX_UPLOAD_LIMIT} صور كحد أقصى`);
85
+ await setNestedAsync('en.trans', 'common.uploader.max_three_images', `Add up to ${this.MAX_UPLOAD_LIMIT} images maximum.`);
86
+ await setNestedAsync('ar.trans', 'common.elements.confirm_delete', 'تأكيد الحذف');
87
+ await setNestedAsync('en.trans', 'common.elements.confirm_delete', 'Confirm deletion');
88
+ await setNestedAsync('ar.trans', 'pages.rating.rate_required_factors', 'يرجى تقييم جميع المعايير لإتمام مراجعتك.');
89
+ await setNestedAsync('en.trans', 'pages.rating.rate_required_factors', 'Please rate all required factors to complete your review.');
90
+ await setNestedAsync('ar.trans', 'pages.rating.overall_product_rating', 'التقييم العام للمنتج');
91
+ await setNestedAsync('en.trans', 'pages.rating.overall_product_rating', 'Overall product rating');
92
+ this.dragAndDropFilesLabel = salla.lang.get('common.uploader.drag_and_drop_files');
93
+ this.allowedImagesTypesLabel = salla.lang.get('common.uploader.allowed_images_types');
94
+ this.threeImagesMax = salla.lang.get('common.uploader.max_three_images');
95
+ this.contactSubjectLabel = salla.lang.get('pages.rating.contact_subject');
96
+ this.editReviewLabel = salla.lang.get('pages.rating.edit_review');
97
+ this.areYouSureLabel = salla.lang.get('pages.rating.are_you_sure_you_want_to_delete_review');
98
+ this.confirmDeletionLabel = salla.lang.get('pages.rating.confirm_deletion');
99
+ this.cancelLabel = salla.lang.get('common.elements.cancel');
100
+ this.updatedSuccessfullyLabel = salla.lang.get('pages.rating.review_updated_successfully');
101
+ this.deletedSuccessfullyLabel = salla.lang.get('pages.rating.review_deleted_successfully');
102
+ this.confirmDeleteBtn = salla.lang.get('common.elements.confirm_delete');
103
+ this.requiredFactorsLabel = salla.lang.get('pages.rating.rate_required_factors');
104
+ this.overallProductRatingLabel = salla.lang.get('pages.rating.overall_product_rating');
105
+ this.contact_body = (store, id, customer) => salla.lang.get('pages.rating.contact_body', { store, id, customer });
106
+ };
107
+ setTranslations();
108
+ });
109
+ }
110
+ /**
111
+ * Show the rating modal
112
+ */
113
+ syncStoreSettings() {
114
+ if (!this.orderId) {
115
+ this.orderId = salla.config.get('page.id');
116
+ }
117
+ this.allowAttachImages = !!salla.config.get('store.settings.rating.allow_attach_images');
118
+ this.allowContactSupport = !!salla.config.get('store.settings.rating.allow_contact_support');
119
+ }
120
+ /** Encrypted order id from page config / prop — used to fetch order details. */
121
+ getRatingOrderId() {
122
+ return this.orderId || salla.config.get('page.id');
123
+ }
124
+ /** Numeric order id from API response — used when submitting ratings. */
125
+ getSubmitOrderId() {
126
+ return this.orderId;
127
+ }
128
+ isCustomerOrderShape(value) {
129
+ if (!value || typeof value !== 'object') {
130
+ return false;
131
+ }
132
+ const record = value;
133
+ return (!!record.rating &&
134
+ (Array.isArray(record.items) ||
135
+ Array.isArray(record.products) ||
136
+ Array.isArray(record.rating?.product) ||
137
+ Array.isArray(record.rating?.products)));
138
+ }
139
+ getBootstrapOrder() {
140
+ const page = salla.config.get('page');
141
+ if (this.isCustomerOrderShape(page)) {
142
+ return page;
143
+ }
144
+ if (page && typeof page === 'object') {
145
+ const pageRecord = page;
146
+ if (Array.isArray(pageRecord.products)) {
147
+ return page;
148
+ }
149
+ const nestedOrder = pageRecord.order;
150
+ if (this.isCustomerOrderShape(nestedOrder)) {
151
+ return nestedOrder;
152
+ }
153
+ }
154
+ return undefined;
155
+ }
156
+ async loadCustomerOrderForEdit() {
157
+ const bootstrapOrder = this.getBootstrapOrder();
158
+ if (bootstrapOrder?.rating?.product || bootstrapOrder?.rating?.products) {
159
+ this.order = bootstrapOrder;
160
+ return;
161
+ }
162
+ try {
163
+ const response = await salla.api.withoutNotifier(() => salla.order.api.getDetails(this.getRatingOrderId()));
164
+ if (response?.data) {
165
+ this.order = response.data;
166
+ }
167
+ }
168
+ catch (_error) {
169
+ if (!this.order) {
170
+ const orderResponse = await salla.api.withoutNotifier(() => salla.rating.api.order(this.getRatingOrderId()));
171
+ this.order = orderResponse.data;
172
+ }
173
+ }
174
+ }
175
+ getOrderProductRatings(order = this.order) {
176
+ if (!order?.rating) {
177
+ return [];
178
+ }
179
+ return [
180
+ ...this.normalizeToArray(order.rating.product),
181
+ ...this.normalizeToArray(order.rating.products),
182
+ ];
183
+ }
184
+ getMatchedProductRating(order = this.order, productId, feedbackId) {
185
+ return this.getOrderProductRatings(order).find(entry => Number(entry?.id ?? entry?.feedback_id) === Number(feedbackId) ||
186
+ Number(entry?.product_id ?? entry?.product?.id) === Number(productId));
187
+ }
188
+ hasRatingFeedback(feedback) {
189
+ const rating = feedback?.rating;
190
+ return rating !== undefined && rating !== null && rating !== '' && Number(rating) > 0;
191
+ }
192
+ isTestimonialsEnabled(order = this.order) {
193
+ if (order?.testimonials_enabled === false) {
194
+ return false;
195
+ }
196
+ if (this.hasRatingFeedback(order?.store?.feedback)) {
197
+ return false;
198
+ }
199
+ if (order?.testimonials_enabled === true) {
200
+ return true;
201
+ }
202
+ return !!order?.allowed_ratings?.testimonials_enabled;
203
+ }
204
+ isProductsEnabled(order = this.order) {
205
+ if (order?.products_enabled === false) {
206
+ return false;
207
+ }
208
+ return this.getRateableProducts(order).length > 0;
209
+ }
210
+ isShippingEnabled(order = this.order) {
211
+ if (order?.shipping_enabled === false) {
212
+ return false;
213
+ }
214
+ if (this.hasRatingFeedback(order?.shipping?.feedback)) {
215
+ return false;
216
+ }
217
+ if (!order?.shipping?.company) {
218
+ return false;
219
+ }
220
+ if (order?.shipping_enabled === true) {
221
+ return true;
222
+ }
223
+ return !!order?.allowed_ratings?.shipping_enabled;
224
+ }
225
+ getOrderProducts(order = this.order) {
226
+ if (!Array.isArray(order?.products)) {
227
+ return [];
228
+ }
229
+ return order.products.filter(item => item?.product?.id);
230
+ }
231
+ getRateableProducts(order = this.order) {
232
+ return this.getOrderProducts(order).filter(item => !this.hasRatingFeedback(item?.feedback));
233
+ }
234
+ getStepsCount(order = this.order) {
235
+ if (!order) {
236
+ return 0;
237
+ }
238
+ let count = 0;
239
+ if (this.isTestimonialsEnabled(order)) {
240
+ count++;
241
+ }
242
+ if (this.isProductsEnabled(order)) {
243
+ count += this.getRateableProducts(order).length;
244
+ }
245
+ if (this.isShippingEnabled(order) && order.shipping?.company) {
246
+ count++;
247
+ }
248
+ return count;
249
+ }
250
+ afterOrderLoaded() {
251
+ this.stepsCount = this.getStepsCount();
252
+ this.scheduleWizardSetup = true;
253
+ forceUpdate(this);
254
+ }
255
+ async open() {
256
+ await salla.onReady();
257
+ this.syncStoreSettings();
258
+ this.defaultMode = true;
259
+ this.currentIndex = 0;
260
+ this.submitted = [];
261
+ return new Promise(resolve => {
262
+ setTimeout(() => {
263
+ this.modal
264
+ .open()
265
+ .then(() => this.order ||
266
+ salla.api
267
+ .withoutNotifier(() => salla.rating.api.order(this.getRatingOrderId()))
268
+ .then(async (res) => {
269
+ this.order = res.data;
270
+ this.productReviewFactors = await this.fetchAllProductReviewFactors(res.data);
271
+ }))
272
+ .then(() => this.modal.setTitle(`${salla.lang.get('pages.rating.rate_order')} <span class="unicode">(#${this.order.id})</span>`))
273
+ .then(() => {
274
+ // Initialize productImages for all products
275
+ const initialImages = {};
276
+ for (const item of this.getRateableProducts()) {
277
+ initialImages[item.product.id] = [];
278
+ }
279
+ this.productImages = initialImages;
280
+ })
281
+ .then(() => this.modal.stopLoading())
282
+ .then(() => this.afterOrderLoaded())
283
+ .catch(e => {
284
+ resolve(false);
285
+ this.hasError = true;
286
+ this.errorMessage = e.response?.data?.error?.message || e.response?.data;
287
+ this.modal.stopLoading();
288
+ });
289
+ resolve(true);
290
+ }, 50);
291
+ });
292
+ }
293
+ async openEditModal(params) {
294
+ await salla.onReady();
295
+ this.syncStoreSettings();
296
+ this.defaultMode = false;
297
+ this.editMode = true;
298
+ this.editType = params.type;
299
+ this.editFeedbackId = params.feedback_id;
300
+ try {
301
+ await this.fetchEditItem(params.feedback_id);
302
+ if (this.editType === 'product' && this.editItem?.product?.id) {
303
+ await this.loadCustomerOrderForEdit();
304
+ await this.ensureProductFactorsLoaded(this.editItem.product.id);
305
+ this.editFactorRatings = { ...this.buildEditFactorRatings(this.editItem.product.id) };
306
+ this.markExistingFactorRatingsAsUserFilled(this.editItem.product.id, this.editFactorRatings);
307
+ }
308
+ this.editModal.open();
309
+ }
310
+ catch (e) {
311
+ this.hasError = true;
312
+ this.errorMessage = e.response?.data?.error?.message || e.response?.data;
313
+ }
314
+ }
315
+ async fetchEditItem(feedbackId) {
316
+ const endpoint = `rating/${feedbackId}/show`;
317
+ const response = await salla.api.request(endpoint);
318
+ this.editItem = response.data;
319
+ if (this.allowAttachImages && this.editType == 'product' && this.editItem.images.length) {
320
+ this.editItemImages = this.editItem.images.map(img => {
321
+ return { id: `${Math.floor(100 + Math.random() * 900)}`, url: img };
322
+ });
323
+ }
324
+ }
325
+ async editReview() {
326
+ const endpoint = `rating/${this.editFeedbackId}`;
327
+ let data;
328
+ if (this.editType === 'product') {
329
+ const container = this.editModal.querySelector('[data-type="products"]') || this.currentTab;
330
+ data = this.buildProductRatingPayload(this.collectFormData(container), container);
331
+ if (!data.product_id && this.editItem?.product?.id) {
332
+ data.product_id = String(this.editItem.product.id);
333
+ }
334
+ }
335
+ else {
336
+ data = this.collectFormData(this.editModal);
337
+ data.images && (data.images = data.images.split(','));
338
+ }
339
+ await salla.api.request(endpoint, data, 'put').then(res => {
340
+ this.editModal.close();
341
+ salla.notify.success(res.message || this.updatedSuccessfullyLabel);
342
+ setTimeout(() => {
343
+ window.location.reload();
344
+ }, 500);
345
+ });
346
+ }
347
+ async openDeleteModal(params) {
348
+ this.defaultMode = false;
349
+ this.deleteMode = true;
350
+ this.deleteFeedbackId = params.feedback_id;
351
+ this.shouldOpenDeleteModal = true;
352
+ return new Promise(resolve => {
353
+ setTimeout(() => {
354
+ this.deleteModal.open().then(() => resolve(true));
355
+ }, 50);
356
+ });
357
+ }
358
+ async deleteReview() {
359
+ const endpoint = `rating/${this.deleteFeedbackId}`;
360
+ await salla.api.request(endpoint, null, 'delete').then(() => {
361
+ this.deleteModal.close();
362
+ salla.notify.success(this.deletedSuccessfullyLabel);
363
+ setTimeout(() => {
364
+ window.location.reload();
365
+ }, 500);
366
+ });
367
+ }
368
+ /**
369
+ * Show the rating modal
370
+ */
371
+ async close() {
372
+ return this.modal.close();
373
+ }
374
+ // handle wizard
375
+ handleWizard() {
376
+ this.steps = this.modal.querySelectorAll('.s-rating-modal-step');
377
+ this.dots = this.modal.querySelectorAll('.s-rating-modal-step-dot');
378
+ if (this.stepsCount === 0) {
379
+ this.showThankYou();
380
+ return;
381
+ }
382
+ this.showActiveStep();
383
+ }
384
+ refreshWizardRefs() {
385
+ if (!this.modal) {
386
+ return;
387
+ }
388
+ this.steps = this.modal.querySelectorAll('.s-rating-modal-step');
389
+ this.dots = this.modal.querySelectorAll('.s-rating-modal-step-dot');
390
+ }
391
+ showActiveStep(current = null) {
392
+ this.refreshWizardRefs();
393
+ this.currentTab = current || this.steps[this.currentIndex];
394
+ if (!this.currentTab) {
395
+ return;
396
+ }
397
+ 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);
398
+ if (this.currentIndex !== 0) {
399
+ // the animation
400
+ Helper.toggleElementClassIf(this.currentTab, 's-rating-modal-unactive', 's-rating-modal-hidden', () => true);
401
+ setTimeout(() => Helper.toggleElementClassIf(this.currentTab, 's-rating-modal-active', 's-rating-modal-unactive', () => true), 300);
402
+ }
403
+ // Btn text
404
+ const nextType = this.steps[this.currentIndex + 1]?.dataset.type;
405
+ this.nextBtn?.setText(nextType
406
+ ? `${salla.lang.get('pages.rating.rate')} ${salla.lang.get(`pages.rating.${nextType}`)}`
407
+ : salla.lang.get('pages.rating.send_ratings'));
408
+ setTimeout(() => this.updateBodyHeight(), 0);
409
+ setTimeout(() => this.updateBodyHeight(), 150);
410
+ }
411
+ updateBodyHeight() {
412
+ if (!this.body || !this.currentTab) {
413
+ return;
414
+ }
415
+ // Product step contains async uploader mount; keep height auto to prevent clipping.
416
+ if (this.currentTab.dataset.type === 'products') {
417
+ this.body.style.height = 'auto';
418
+ return;
419
+ }
420
+ const extraHeight = this.editMode ? 60 : 0;
421
+ this.body.style.height = `${this.currentTab.offsetHeight + extraHeight}px`;
422
+ }
423
+ previousTab() {
424
+ this.currentIndex > 0 && this.currentIndex--;
425
+ Helper.toggleElementClassIf(this.backBtn, 's-rating-modal-unvisiable', 'block', () => this.currentIndex == 0);
426
+ this.showActiveStep();
427
+ }
428
+ async submit() {
429
+ this.refreshWizardRefs();
430
+ try {
431
+ if (!this.submittedBefore()) {
432
+ this.validate();
433
+ }
434
+ salla.config.canLeave = false;
435
+ await this.nextBtn.load();
436
+ if (!this.submittedBefore()) {
437
+ await this.sendFeedback();
438
+ }
439
+ this.currentTab
440
+ ?.querySelectorAll('[name],.s-rating-modal-btn-star')
441
+ .forEach(el => el.setAttribute('disabled', ''));
442
+ if (this.currentIndex < this.stepsCount) {
443
+ this.currentIndex++;
444
+ }
445
+ this.showActiveStep();
446
+ Helper.toggleClassIf('#prev-btn', 'block', 's-rating-modal-unvisiable', () => true);
447
+ if (this.currentIndex === this.stepsCount) {
448
+ this.showThankYou();
449
+ this.showContactWidget = false;
450
+ }
451
+ }
452
+ finally {
453
+ this.nextBtn.stop();
454
+ salla.config.canLeave = true;
455
+ }
456
+ }
457
+ submittedBefore() {
458
+ return this.submitted.includes(this.currentIndex);
459
+ }
460
+ getRatingHiddenInput(container) {
461
+ const element = container;
462
+ const directInput = element.querySelector?.('.rating_hidden_input');
463
+ if (directInput?.name) {
464
+ return directInput;
465
+ }
466
+ const starsComponent = element.querySelector?.('salla-rating-stars');
467
+ return (starsComponent?.shadowRoot?.querySelector('.rating_hidden_input') ||
468
+ null);
469
+ }
470
+ collectNamedInputs(container) {
471
+ const seen = new Set();
472
+ const inputs = [];
473
+ const addInput = (input) => {
474
+ if (!input?.name || seen.has(input)) {
475
+ return;
476
+ }
477
+ seen.add(input);
478
+ inputs.push(input);
479
+ };
480
+ container.querySelectorAll('[name]').forEach((input) => {
481
+ addInput(input);
482
+ });
483
+ container.querySelectorAll('salla-rating-stars').forEach((stars) => {
484
+ addInput(this.getRatingHiddenInput(stars));
485
+ });
486
+ return inputs;
487
+ }
488
+ normalizeFactorsList(factors) {
489
+ if (!factors) {
490
+ return [];
491
+ }
492
+ if (Array.isArray(factors)) {
493
+ return factors;
494
+ }
495
+ if (typeof factors === 'object') {
496
+ return Object.values(factors).filter(entry => entry && typeof entry === 'object');
497
+ }
498
+ return [];
499
+ }
500
+ validate(rating = null, type = null) {
501
+ if (!rating && this.currentTab.dataset.type === 'products') {
502
+ const ratingForms = this.currentTab.querySelectorAll('.rating-outer-form');
503
+ ratingForms.forEach(ratingForm => this.validate(ratingForm, 'product'));
504
+ return;
505
+ }
506
+ rating = rating || this.currentTab;
507
+ const mainRatingRow = rating.querySelector('.s-rating-modal-product-rating-row-main');
508
+ const mainRatingInput = this.getRatingHiddenInput(mainRatingRow || rating);
509
+ const stars = mainRatingInput?.value;
510
+ const validationMessage = rating.querySelector('.s-rating-modal-validation-msg');
511
+ type = type || rating.dataset.type;
512
+ if (!stars) {
513
+ validationMessage.innerHTML = salla.lang
514
+ .get(`pages.rating.rate_${type}_stars`)
515
+ .replace(' (:item)', '');
516
+ throw new Error(validationMessage.innerHTML);
517
+ }
518
+ if (type === 'product') {
519
+ const requiredFactorRows = Array.from(rating.querySelectorAll('.s-rating-modal-product-factor-row[data-required="true"]'));
520
+ const hasMissingRequiredFactor = requiredFactorRows.some((row) => {
521
+ const factorStarsInput = this.getRatingHiddenInput(row);
522
+ return !factorStarsInput?.value;
523
+ });
524
+ if (hasMissingRequiredFactor) {
525
+ validationMessage.innerHTML = this.requiredFactorsLabel;
526
+ throw new Error(validationMessage.innerHTML);
527
+ }
528
+ }
529
+ validationMessage.innerHTML = '';
530
+ }
531
+ collectFormData(container = this.currentTab) {
532
+ const data = {};
533
+ this.collectNamedInputs(container).forEach((input) => {
534
+ const inputData = salla.helpers.inputData(input.name, input.value, data);
535
+ data[inputData.name] = inputData.value;
536
+ });
537
+ return data;
538
+ }
539
+ buildProductRatingPayload(data, container = this.currentTab) {
540
+ if (!data.rating) {
541
+ const mainRatingRow = container.querySelector('.s-rating-modal-product-rating-row-main');
542
+ const mainRatingInput = this.getRatingHiddenInput(mainRatingRow || container);
543
+ if (mainRatingInput?.value) {
544
+ data.rating = mainRatingInput.value;
545
+ }
546
+ }
547
+ const productId = Number(data.product_id);
548
+ let images = [];
549
+ if (data.images) {
550
+ images =
551
+ typeof data.images === 'string' ? data.images.split(',').filter(Boolean) : data.images;
552
+ }
553
+ else if (this.editMode && this.allowAttachImages && productId) {
554
+ images = this.editItemImages.map(img => img.url);
555
+ }
556
+ else if (this.allowAttachImages && productId) {
557
+ images = (this.productImages[productId] || []).map(img => img.url);
558
+ }
559
+ const factors = this.normalizeFactorsList(data.factors)
560
+ .filter(factor => factor?.id && factor?.rating)
561
+ .map(factor => ({
562
+ id: String(factor.id),
563
+ rating: String(factor.rating),
564
+ }));
565
+ return {
566
+ order_id: this.getSubmitOrderId(),
567
+ product_id: String(data.product_id),
568
+ rating: String(data.rating),
569
+ comment: data.comment || data.content || '',
570
+ images,
571
+ factors,
572
+ type: 'products',
573
+ };
574
+ }
575
+ async sendFeedback() {
576
+ this.refreshWizardRefs();
577
+ const stepType = this.currentTab?.dataset?.type;
578
+ if (stepType === 'products') {
579
+ const data = this.collectFormData(this.currentTab);
580
+ const payload = this.buildProductRatingPayload(data, this.currentTab);
581
+ if (!payload.product_id || !payload.rating) {
582
+ throw new Error('Missing product rating data');
583
+ }
584
+ const res = await salla.rating.api.products(payload);
585
+ this.submitted.push(this.currentIndex);
586
+ return res;
587
+ }
588
+ const data = this.collectFormData(this.currentTab);
589
+ if (Object.keys(data).length === 0) {
590
+ return;
591
+ }
592
+ data.order_id = this.getSubmitOrderId();
593
+ data.type = stepType;
594
+ const res = await salla.rating.api[stepType](data);
595
+ this.submitted.push(this.currentIndex);
596
+ return res;
597
+ }
598
+ clearThanksCountdown() {
599
+ if (this.thanksCountdownInterval !== null) {
600
+ clearInterval(this.thanksCountdownInterval);
601
+ this.thanksCountdownInterval = null;
602
+ }
603
+ }
604
+ showThankYou() {
605
+ let seconds = 10;
606
+ this.clearThanksCountdown();
607
+ this.thanksCountdownInterval = setInterval(() => {
608
+ this.thanksTime.innerHTML = `00:0${seconds--}`;
609
+ if (seconds > 0) {
610
+ return;
611
+ }
612
+ this.clearThanksCountdown();
613
+ this.thanksTime.remove();
614
+ this.close().then(() => window.location.reload());
615
+ }, 1000);
616
+ this.modal.querySelector('.s-rating-modal-footer').classList.add('s-rating-modal-unvisiable');
617
+ this.showActiveStep(this.thanksTab);
618
+ }
619
+ getFilepondPlaceholder() {
620
+ 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>
621
+ <span> ${this.allowedImagesTypesLabel} <br> ${this.threeImagesMax} </span></p></div>`;
622
+ }
623
+ getCustomerName() {
624
+ let firstName = salla.config.get('user.first_name') || salla.storage.get('user.first_name') || '';
625
+ let lasName = salla.config.get('user.last_name') || salla.storage.get('user.last_name') || '';
626
+ return `${firstName} ${lasName}`;
627
+ }
628
+ normalizeReviewFactorsPayload(payload) {
629
+ const data = payload?.data ?? payload?.factors;
630
+ if (!Array.isArray(data)) {
631
+ return [];
632
+ }
633
+ return data.flatMap(entry => {
634
+ const items = Array.isArray(entry?.items) ? [...entry.items] : null;
635
+ // Nested form shape: only use items[].id, ignore parent entry id
636
+ if (items?.length) {
637
+ items.sort((a, b) => (Number(a?.sort) || 0) - (Number(b?.sort) || 0));
638
+ const isRequired = !!entry?.is_required;
639
+ return items
640
+ .filter(item => item?.id != null && item?.id !== '')
641
+ .map(item => ({
642
+ id: item.id,
643
+ name: item?.name,
644
+ required: isRequired,
645
+ }));
646
+ }
647
+ // Legacy flat shape (no items array)
648
+ if (entry?.id == null || entry?.id === '') {
649
+ return [];
650
+ }
651
+ return [
652
+ {
653
+ id: entry.id,
654
+ name: entry?.name,
655
+ required: entry?.required ?? entry?.is_required ?? false,
656
+ },
657
+ ];
658
+ });
659
+ }
660
+ async fetchProductReviewFactors(productId) {
661
+ try {
662
+ const response = await salla.api.request(`review/factors/${productId}/form`);
663
+ return this.normalizeReviewFactorsPayload(response);
664
+ }
665
+ catch (_error) {
666
+ return [];
667
+ }
668
+ }
669
+ async fetchAllProductReviewFactors(order) {
670
+ const products = this.getRateableProducts(order);
671
+ if (!products.length) {
672
+ return {};
673
+ }
674
+ const pairs = await Promise.all(products.map(async (item) => {
675
+ const factors = await this.fetchProductReviewFactors(item.product.id);
676
+ return [item.product.id, factors];
677
+ }));
678
+ return Object.fromEntries(pairs);
679
+ }
680
+ async ensureProductFactorsLoaded(productId) {
681
+ if (!productId || this.productReviewFactors[productId]) {
682
+ return;
683
+ }
684
+ const factors = await this.fetchProductReviewFactors(productId);
685
+ this.productReviewFactors = {
686
+ ...this.productReviewFactors,
687
+ [productId]: factors,
688
+ };
689
+ }
690
+ getFactorFieldName(prefix, factorIndex, field) {
691
+ return prefix
692
+ ? `${prefix}[factors][${factorIndex}][${field}]`
693
+ : `factors[${factorIndex}][${field}]`;
694
+ }
695
+ normalizeToArray(value) {
696
+ if (value === null || value === undefined) {
697
+ return [];
698
+ }
699
+ return Array.isArray(value) ? value : [value];
700
+ }
701
+ isFactorReviewsList(value) {
702
+ return (Array.isArray(value) &&
703
+ value.length > 0 &&
704
+ value.every(item => item &&
705
+ typeof item === 'object' &&
706
+ (item['rating'] !== undefined ||
707
+ item['stars'] !== undefined ||
708
+ item['value'] !== undefined)));
709
+ }
710
+ getFactorReviewsFromRecord(record) {
711
+ if (!record) {
712
+ return [];
713
+ }
714
+ for (const key of ['factor_reviews', 'review_factors', 'factors']) {
715
+ const value = record[key];
716
+ if (this.isFactorReviewsList(value)) {
717
+ return value;
718
+ }
719
+ }
720
+ return [];
721
+ }
722
+ getEditFactorReviewsList(productId) {
723
+ const orderSources = [this.order, this.getBootstrapOrder()].filter(Boolean);
724
+ for (const order of orderSources) {
725
+ const matchedRating = this.getMatchedProductRating(order, productId, this.editFeedbackId);
726
+ const reviews = this.getFactorReviewsFromRecord(matchedRating);
727
+ if (reviews.length) {
728
+ return reviews;
729
+ }
730
+ }
731
+ const matchedOrderProduct = this.getOrderProducts(this.order).find(item => Number(item.product?.id) === Number(productId));
732
+ const sources = [
733
+ this.editItem?.factor_reviews,
734
+ this.editItem?.review_factors,
735
+ this.editItem?.product?.review_factors,
736
+ this.editItem?.product?.factor_reviews,
737
+ this.editItem?.factors,
738
+ matchedOrderProduct?.factor_reviews,
739
+ matchedOrderProduct?.review_factors,
740
+ matchedOrderProduct?.feedback?.factor_reviews,
741
+ ];
742
+ for (const source of sources) {
743
+ if (Array.isArray(source) && source.length > 0) {
744
+ return source;
745
+ }
746
+ }
747
+ return [];
748
+ }
749
+ getFactorKey(factor, factorIndex) {
750
+ if (factor.id !== undefined && factor.id !== null && factor.id !== '') {
751
+ return `id:${factor.id}`;
752
+ }
753
+ if (factor.name) {
754
+ return `name:${factor.name.trim()}`;
755
+ }
756
+ return `index:${factorIndex}`;
757
+ }
758
+ getFactorRatingsForProduct(productId) {
759
+ return this.editMode ? this.editFactorRatings : this.productFactorRatings[productId] || {};
760
+ }
761
+ setFactorRatingsForProduct(productId, ratings) {
762
+ if (this.editMode) {
763
+ this.editFactorRatings = ratings;
764
+ return;
765
+ }
766
+ this.productFactorRatings = { ...this.productFactorRatings, [productId]: ratings };
767
+ }
768
+ markExistingFactorRatingsAsUserFilled(productId, factorRatings) {
769
+ const factors = this.productReviewFactors[productId] || [];
770
+ const userFilled = new Set();
771
+ factors.forEach((factor, index) => {
772
+ const key = this.getFactorKey(factor, index);
773
+ const byId = factor.id !== undefined ? factorRatings[String(factor.id)] : undefined;
774
+ const byName = factor.name ? factorRatings[factor.name.trim()] : undefined;
775
+ const byIndex = factorRatings[`__index_${index}`];
776
+ if (byId !== undefined || byName !== undefined || byIndex !== undefined) {
777
+ userFilled.add(key);
778
+ }
779
+ });
780
+ this.userFilledFactorKeys[productId] = userFilled;
781
+ }
782
+ shouldAutofillFactors(mainRating) {
783
+ return mainRating === 4 || mainRating === 5;
784
+ }
785
+ autofillUnfilledFactors(productId, mainRating) {
786
+ const factors = this.productReviewFactors[productId] || [];
787
+ if (!factors.length) {
788
+ return;
789
+ }
790
+ const userFilled = this.userFilledFactorKeys[productId] || new Set();
791
+ const currentRatings = { ...this.getFactorRatingsForProduct(productId) };
792
+ const shouldAutofill = this.shouldAutofillFactors(mainRating);
793
+ let updated = false;
794
+ factors.forEach((factor, index) => {
795
+ const key = this.getFactorKey(factor, index);
796
+ if (userFilled.has(key)) {
797
+ return;
798
+ }
799
+ if (shouldAutofill) {
800
+ if (factor.id !== undefined) {
801
+ currentRatings[String(factor.id)] = mainRating;
802
+ }
803
+ if (factor.name) {
804
+ currentRatings[factor.name.trim()] = mainRating;
805
+ }
806
+ currentRatings[`__index_${index}`] = mainRating;
807
+ updated = true;
808
+ return;
809
+ }
810
+ if (factor.id !== undefined && currentRatings[String(factor.id)] !== undefined) {
811
+ delete currentRatings[String(factor.id)];
812
+ updated = true;
813
+ }
814
+ if (factor.name && currentRatings[factor.name.trim()] !== undefined) {
815
+ delete currentRatings[factor.name.trim()];
816
+ updated = true;
817
+ }
818
+ if (currentRatings[`__index_${index}`] !== undefined) {
819
+ delete currentRatings[`__index_${index}`];
820
+ updated = true;
821
+ }
822
+ });
823
+ if (updated) {
824
+ this.setFactorRatingsForProduct(productId, currentRatings);
825
+ }
826
+ }
827
+ handleMainRatingChange(productId, rating) {
828
+ if (this.editMode) {
829
+ this.editMainRating = rating;
830
+ }
831
+ else {
832
+ this.productMainRatings = { ...this.productMainRatings, [productId]: rating };
833
+ }
834
+ this.autofillUnfilledFactors(productId, rating);
835
+ }
836
+ handleFactorRatingChange(productId, factorKey, rating) {
837
+ if (!this.userFilledFactorKeys[productId]) {
838
+ this.userFilledFactorKeys[productId] = new Set();
839
+ }
840
+ this.userFilledFactorKeys[productId].add(factorKey);
841
+ const factors = this.productReviewFactors[productId] || [];
842
+ const factorIndex = factors.findIndex((factor, index) => this.getFactorKey(factor, index) === factorKey);
843
+ if (factorIndex < 0) {
844
+ return;
845
+ }
846
+ const factor = factors[factorIndex];
847
+ const currentRatings = { ...this.getFactorRatingsForProduct(productId) };
848
+ if (factor.id !== undefined) {
849
+ currentRatings[String(factor.id)] = rating;
850
+ }
851
+ if (factor.name) {
852
+ currentRatings[factor.name.trim()] = rating;
853
+ }
854
+ currentRatings[`__index_${factorIndex}`] = rating;
855
+ this.setFactorRatingsForProduct(productId, currentRatings);
856
+ }
857
+ setupProductRatingAutofill(container, productId) {
858
+ if (!container || this.boundRatingRows.has(container)) {
859
+ return;
860
+ }
861
+ this.boundRatingRows.add(container);
862
+ container.addEventListener('click', event => {
863
+ const target = event.target;
864
+ if (!target.closest('.s-rating-stars-btn-star')) {
865
+ return;
866
+ }
867
+ const mainRow = target.closest('.s-rating-modal-product-rating-row-main');
868
+ const factorRow = target.closest('.s-rating-modal-product-factor-row');
869
+ requestAnimationFrame(() => {
870
+ if (mainRow && container.contains(mainRow)) {
871
+ const rating = Number(this.getRatingHiddenInput(mainRow)?.value);
872
+ if (rating > 0) {
873
+ this.handleMainRatingChange(productId, rating);
874
+ }
875
+ return;
876
+ }
877
+ if (factorRow && container.contains(factorRow)) {
878
+ const factorKey = factorRow.getAttribute('data-factor-key');
879
+ const rating = Number(this.getRatingHiddenInput(factorRow)?.value);
880
+ if (factorKey && rating > 0) {
881
+ this.handleFactorRatingChange(productId, factorKey, rating);
882
+ }
883
+ }
884
+ });
885
+ });
886
+ }
887
+ buildEditFactorRatings(productId) {
888
+ const factorReviews = this.getEditFactorReviewsList(productId);
889
+ return factorReviews.reduce((acc, factor, index) => {
890
+ const rating = Number(factor?.rating ?? factor?.stars ?? factor?.value);
891
+ if (Number.isNaN(rating)) {
892
+ return acc;
893
+ }
894
+ const factorId = factor?.id ?? factor?.factor_id;
895
+ if (factorId !== undefined && factorId !== null && factorId !== '') {
896
+ acc[String(factorId)] = rating;
897
+ }
898
+ if (factor?.name) {
899
+ acc[factor.name.trim()] = rating;
900
+ }
901
+ acc[`__index_${index}`] = rating;
902
+ return acc;
903
+ }, {});
904
+ }
905
+ renderProductStep(item, index) {
906
+ 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 => {
907
+ this.productImages = {
908
+ ...this.productImages,
909
+ [item.product.id]: [...(this.productImages[item.product.id] || []), e.detail],
910
+ };
911
+ this.hiddenInputs[index].value = this.productImages[item.product.id]
912
+ .map(img => img.url)
913
+ .join(',');
914
+ }, onRemoved: e => {
915
+ const removedId = e.detail;
916
+ if (!removedId || !this.productImages[item.product.id])
917
+ return;
918
+ this.productImages = {
919
+ ...this.productImages,
920
+ [item.product.id]: this.productImages[item.product.id].filter(img => img.id !== removedId),
921
+ };
922
+ this.hiddenInputs[index].value = this.productImages[item.product.id]
923
+ .map(img => img.url)
924
+ .join(',');
925
+ }, 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))))));
926
+ }
927
+ renderProductReviewFactors(productId, index, options = {}) {
928
+ const factors = this.productReviewFactors[productId] || [];
929
+ const fieldPrefix = options.fieldPrefix ?? `products[${index}]`;
930
+ const mainRatingName = fieldPrefix ? `${fieldPrefix}[rating]` : 'rating';
931
+ const factorRatings = {
932
+ ...(this.editMode ? {} : this.productFactorRatings[productId] || {}),
933
+ ...(options.factorRatings || {}),
934
+ };
935
+ const normalizedMainRating = Number(options.mainRating ??
936
+ (this.editMode ? this.editMainRating : this.productMainRatings[productId]));
937
+ const hasMainRating = !Number.isNaN(normalizedMainRating);
938
+ const getPrefilledFactorRating = (factor, factorIndex) => {
939
+ const byId = factor.id !== undefined ? factorRatings[String(factor.id)] : undefined;
940
+ const byName = factor.name ? factorRatings[factor.name.trim()] : undefined;
941
+ const byIndex = factorRatings[`__index_${factorIndex}`];
942
+ const normalized = Number(byId ?? byName ?? byIndex);
943
+ return Number.isNaN(normalized) ? undefined : normalized;
944
+ };
945
+ 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 ||
946
+ typeof getPrefilledFactorRating(factor, factorIndex) === 'number', withLabel: true, labelBeforeStars: true, tag: false }))))));
947
+ }
948
+ handleSendEmail() {
949
+ const subject = `${this.contactSubjectLabel} #${this.order.id}`;
950
+ const body = this.contact_body(salla.config.get('store.name'), this.order.id, this.getCustomerName());
951
+ const mailtoLink = `mailto:${salla.config.get('store.contacts.email')}?subject=${encodeURIComponent(subject)}&body=${encodeURIComponent(body)}`;
952
+ window.open(mailtoLink, '_blank');
953
+ }
954
+ handleSendWhatsApp() {
955
+ const body = this.contact_body(salla.config.get('store.name'), this.order.id, this.getCustomerName());
956
+ const whatsappLink = `https://wa.me/${salla.config.get('store.contacts.whatsapp')}?text=${encodeURIComponent(body)}`;
957
+ window.open(whatsappLink, '_blank');
958
+ }
959
+ resetData(isOpen) {
960
+ if (isOpen.detail) {
961
+ return;
962
+ }
963
+ this.clearThanksCountdown();
964
+ this.modal?.close();
965
+ this.editItem = null;
966
+ this.editItemImages = [];
967
+ this.editFactorRatings = {};
968
+ this.productMainRatings = {};
969
+ this.productFactorRatings = {};
970
+ this.editMainRating = undefined;
971
+ this.userFilledFactorKeys = {};
972
+ this.hiddenInputs[1] && (this.hiddenInputs[1].value = '');
973
+ this.deleteFeedbackId = null;
974
+ this.editFeedbackId = null;
975
+ this.shouldOpenDeleteModal = false;
976
+ this.editMode = false;
977
+ this.deleteMode = false;
978
+ this.defaultMode = false;
979
+ this.currentIndex = 0;
980
+ this.submitted = [];
981
+ this.scheduleWizardSetup = false;
982
+ }
983
+ getDeleteModal() {
984
+ 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)))));
985
+ }
986
+ renderUploadedImagesCount(productId) {
987
+ // In edit mode, use editItemImages; in default mode, use productImages
988
+ const imageCount = this.editMode
989
+ ? this.editItemImages.length
990
+ : (this.productImages[productId] || []).length;
991
+ return (h("span", { class: "s-rating-modal-upload-count" }, salla.lang.choice('pages.rating.images_count', imageCount, {
992
+ current: imageCount,
993
+ total: this.MAX_UPLOAD_LIMIT,
994
+ })));
995
+ }
996
+ getEditModal() {
997
+ 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, {
998
+ fieldPrefix: '',
999
+ mainRating: this.editMainRating ?? Number(this.editItem.stars ?? this.editItem.rating),
1000
+ factorRatings: this.editFactorRatings,
1001
+ alwaysEditable: true,
1002
+ }), 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 => {
1003
+ this.editItemImages = [
1004
+ ...this.editItemImages,
1005
+ e.detail,
1006
+ ];
1007
+ this.hiddenInputs[1].value = this.editItemImages.map(img => img.url).join();
1008
+ }, onRemoved: e => {
1009
+ const removedId = e.detail;
1010
+ if (!removedId)
1011
+ return;
1012
+ this.editItemImages = this.editItemImages.filter(img => img.id !== removedId);
1013
+ this.hiddenInputs[1].value = this.editItemImages.map(img => img.url).join();
1014
+ }, 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)))));
1015
+ }
1016
+ render() {
1017
+ if (this.deleteMode) {
1018
+ return h(Host, { class: "s-rating-modal" }, this.getDeleteModal());
1019
+ }
1020
+ if (this.editMode) {
1021
+ return h(Host, { class: "s-rating-modal" }, this.getEditModal());
1022
+ }
1023
+ if (this.defaultMode) {
1024
+ 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: Star })))), 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 ? ([
1025
+ 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() &&
1026
+ 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) }))),
1027
+ this.allowContactSupport &&
1028
+ this.showContactWidget &&
1029
+ (salla.config.get('store.contacts.whatsapp') ||
1030
+ 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 }))))) : (''),
1031
+ 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'))),
1032
+ ]) : (h("salla-placeholder", { alignment: "center" })))));
1033
+ }
1034
+ }
1035
+ async componentWillLoad() {
1036
+ await salla.onReady();
1037
+ this.syncStoreSettings();
1038
+ }
1039
+ componentDidRender() {
1040
+ if (!this.scheduleWizardSetup || !this.defaultMode || !this.order) {
1041
+ return;
1042
+ }
1043
+ this.scheduleWizardSetup = false;
1044
+ requestAnimationFrame(() => this.handleWizard());
1045
+ }
1046
+ disconnectedCallback() {
1047
+ this.clearThanksCountdown();
1048
+ }
1049
+ static get is() { return "salla-rating-modal-v2"; }
1050
+ static get originalStyleUrls() {
1051
+ return {
1052
+ "$": ["salla-rating-modal.scss"]
1053
+ };
1054
+ }
1055
+ static get styleUrls() {
1056
+ return {
1057
+ "$": ["salla-rating-modal.css"]
1058
+ };
1059
+ }
1060
+ static get properties() {
1061
+ return {
1062
+ "orderId": {
1063
+ "type": "number",
1064
+ "attribute": "order-id",
1065
+ "mutable": false,
1066
+ "complexType": {
1067
+ "original": "number",
1068
+ "resolved": "number",
1069
+ "references": {}
1070
+ },
1071
+ "required": false,
1072
+ "optional": false,
1073
+ "docs": {
1074
+ "tags": [],
1075
+ "text": "The order id, to rate on its products & shipping"
1076
+ },
1077
+ "getter": false,
1078
+ "setter": false,
1079
+ "reflect": false
1080
+ }
1081
+ };
1082
+ }
1083
+ static get states() {
1084
+ return {
1085
+ "order": {},
1086
+ "hasError": {},
1087
+ "showContactWidget": {},
1088
+ "errorMessage": {},
1089
+ "images": {},
1090
+ "productImages": {},
1091
+ "editItemImages": {},
1092
+ "productReviewFactors": {},
1093
+ "editFactorRatings": {},
1094
+ "productMainRatings": {},
1095
+ "productFactorRatings": {},
1096
+ "editMainRating": {},
1097
+ "contact_body": {},
1098
+ "editMode": {},
1099
+ "defaultMode": {},
1100
+ "deleteMode": {},
1101
+ "shouldOpenDeleteModal": {},
1102
+ "editType": {},
1103
+ "editFeedbackId": {},
1104
+ "deleteFeedbackId": {},
1105
+ "editItem": {},
1106
+ "allowAttachImages": {},
1107
+ "allowContactSupport": {}
1108
+ };
1109
+ }
1110
+ static get methods() {
1111
+ return {
1112
+ "open": {
1113
+ "complexType": {
1114
+ "signature": "() => Promise<unknown>",
1115
+ "parameters": [],
1116
+ "references": {
1117
+ "Promise": {
1118
+ "location": "global",
1119
+ "id": "global::Promise"
1120
+ },
1121
+ "Record": {
1122
+ "location": "global",
1123
+ "id": "global::Record"
1124
+ },
1125
+ "Array": {
1126
+ "location": "global",
1127
+ "id": "global::Array"
1128
+ }
1129
+ },
1130
+ "return": "Promise<unknown>"
1131
+ },
1132
+ "docs": {
1133
+ "text": "",
1134
+ "tags": []
1135
+ }
1136
+ },
1137
+ "openEditModal": {
1138
+ "complexType": {
1139
+ "signature": "(params: { type: \"product\" | \"store\" | \"shipping\"; feedback_id: number; }) => Promise<void>",
1140
+ "parameters": [{
1141
+ "name": "params",
1142
+ "type": "{ type: \"product\" | \"store\" | \"shipping\"; feedback_id: number; }",
1143
+ "docs": ""
1144
+ }],
1145
+ "references": {
1146
+ "Promise": {
1147
+ "location": "global",
1148
+ "id": "global::Promise"
1149
+ }
1150
+ },
1151
+ "return": "Promise<void>"
1152
+ },
1153
+ "docs": {
1154
+ "text": "",
1155
+ "tags": []
1156
+ }
1157
+ },
1158
+ "openDeleteModal": {
1159
+ "complexType": {
1160
+ "signature": "(params: any) => Promise<unknown>",
1161
+ "parameters": [{
1162
+ "name": "params",
1163
+ "type": "any",
1164
+ "docs": ""
1165
+ }],
1166
+ "references": {
1167
+ "Promise": {
1168
+ "location": "global",
1169
+ "id": "global::Promise"
1170
+ }
1171
+ },
1172
+ "return": "Promise<unknown>"
1173
+ },
1174
+ "docs": {
1175
+ "text": "",
1176
+ "tags": []
1177
+ }
1178
+ },
1179
+ "close": {
1180
+ "complexType": {
1181
+ "signature": "() => Promise<HTMLElement>",
1182
+ "parameters": [],
1183
+ "references": {
1184
+ "Promise": {
1185
+ "location": "global",
1186
+ "id": "global::Promise"
1187
+ },
1188
+ "HTMLElement": {
1189
+ "location": "global",
1190
+ "id": "global::HTMLElement"
1191
+ }
1192
+ },
1193
+ "return": "Promise<HTMLElement>"
1194
+ },
1195
+ "docs": {
1196
+ "text": "Show the rating modal",
1197
+ "tags": []
1198
+ }
1199
+ }
1200
+ };
1201
+ }
1202
+ static get elementRef() { return "host"; }
1203
+ }