strapi-plugin-comments 2.0.11 → 2.1.1

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 (443) hide show
  1. package/README.md +165 -119
  2. package/admin/src/components/ActionButton/styles.ts +11 -0
  3. package/admin/src/components/Avatar/index.tsx +31 -0
  4. package/admin/src/components/ConfirmationDialog/index.tsx +88 -0
  5. package/admin/src/components/DiscussionStatus/index.tsx +36 -0
  6. package/admin/src/components/DiscussionThread/index.tsx +97 -0
  7. package/admin/src/components/DiscussionThreadItem/index.tsx +71 -0
  8. package/admin/src/components/DiscussionThreadItem/{styles.js → styles.ts} +8 -6
  9. package/admin/src/components/DiscussionThreadItemActions/index.tsx +365 -0
  10. package/admin/src/components/DiscussionThreadItemActions/styles.ts +9 -0
  11. package/admin/src/components/DiscussionThreadItemApprovalFlowActions/index.tsx +99 -0
  12. package/admin/src/components/DiscussionThreadItemApprovalFlowActions/styles.ts +8 -0
  13. package/admin/src/components/DiscussionThreadItemFooter/index.tsx +62 -0
  14. package/admin/src/components/DiscussionThreadItemFooter/styles.ts +15 -0
  15. package/admin/src/components/DiscussionThreadItemReviewAction/index.tsx +180 -0
  16. package/admin/src/components/FormSwitch/index.tsx +35 -0
  17. package/admin/src/components/FormSwitch/styles.ts +10 -0
  18. package/admin/src/components/IconButton/styles.ts +19 -0
  19. package/admin/src/components/Initializer/{index.js → index.tsx} +8 -6
  20. package/admin/src/components/LoadingIndicatorOverlay/index.tsx +19 -0
  21. package/admin/src/components/LoadingIndicatorOverlay/styles.ts +21 -0
  22. package/admin/src/components/Nav/index.tsx +61 -0
  23. package/admin/src/components/PluginIcon/{index.js → index.tsx} +4 -2
  24. package/admin/src/components/ReportsReviewModal/index.tsx +71 -0
  25. package/admin/src/components/ReportsReviewTable/index.tsx +233 -0
  26. package/admin/src/components/StatusBadge/index.tsx +21 -0
  27. package/admin/src/components/StatusBadge/styles.ts +19 -0
  28. package/admin/src/components/TableFilters/{index.js → index.tsx} +14 -9
  29. package/admin/src/components/TablePagination/{index.js → index.tsx} +8 -6
  30. package/admin/src/components/icons/comments.tsx +15 -0
  31. package/admin/src/components/icons/index.ts +6 -0
  32. package/admin/src/components/icons/{lock.js → lock.tsx} +17 -12
  33. package/admin/src/components/icons/review.tsx +25 -0
  34. package/admin/src/components/icons/unlock.tsx +25 -0
  35. package/admin/src/hooks/useConfig.ts +58 -0
  36. package/admin/src/{index.js → index.ts} +26 -22
  37. package/admin/src/pages/App/index.tsx +67 -0
  38. package/admin/src/pages/App/reducer/actions.ts +10 -0
  39. package/admin/src/pages/App/reducer/constants.ts +4 -0
  40. package/admin/src/pages/App/reducer/{index.js → index.ts} +8 -6
  41. package/admin/src/pages/App/reducer/init.ts +9 -0
  42. package/admin/src/pages/App/reducer/selectors.ts +32 -0
  43. package/admin/src/pages/App/utils/{api.js → api.ts} +3 -1
  44. package/admin/src/pages/ComingSoonPage/index.tsx +31 -0
  45. package/admin/src/pages/Details/components/DetailsEntity/index.tsx +106 -0
  46. package/admin/src/pages/Details/components/DetailsFilters/index.tsx +43 -0
  47. package/admin/src/pages/Details/components/DetailsFilters/styles.ts +9 -0
  48. package/admin/src/pages/Details/index.tsx +169 -0
  49. package/admin/src/pages/Discover/components/DiscoverTableRow/index.tsx +252 -0
  50. package/admin/src/pages/Discover/components/DiscoverTableRow/styles.ts +9 -0
  51. package/admin/src/pages/Discover/index.tsx +230 -0
  52. package/admin/src/pages/Discover/utils/api.ts +22 -0
  53. package/admin/src/pages/Discover/utils/filtersSchema.ts +9 -0
  54. package/admin/src/pages/Settings/components/RestartAlert/styles.ts +10 -0
  55. package/admin/src/pages/Settings/index.tsx +602 -0
  56. package/admin/src/pages/Settings/utils/{api.js → api.ts} +16 -5
  57. package/admin/src/pages/utils/api.ts +70 -0
  58. package/admin/src/permissions.ts +30 -0
  59. package/admin/src/pluginId.ts +3 -0
  60. package/admin/src/reducers.ts +8 -0
  61. package/admin/src/translations/en.json +131 -131
  62. package/admin/src/translations/pt-BR.json +130 -130
  63. package/admin/src/utils/{axiosInstance.js → axiosInstance.ts} +12 -9
  64. package/admin/src/utils/constants.ts +25 -0
  65. package/admin/src/utils/getApiUrl.ts +5 -0
  66. package/admin/src/utils/getMessage.ts +29 -0
  67. package/admin/src/utils/getRelatedGroups.ts +6 -0
  68. package/admin/src/utils/getUrl.ts +5 -0
  69. package/admin/src/utils/handleAPIError.ts +21 -0
  70. package/admin/src/utils/index.ts +11 -0
  71. package/admin/src/utils/parseRegExp.ts +9 -0
  72. package/admin/src/utils/renderEntryTitle.ts +16 -0
  73. package/admin/src/utils/renderInitials.ts +10 -0
  74. package/admin/src/utils/resolveCommentStatus.ts +37 -0
  75. package/admin/src/utils/resolveCommentStatusColor.ts +22 -0
  76. package/build/README.md +41 -5
  77. package/build/admin/src/components/ActionButton/styles.d.ts +1 -1
  78. package/build/admin/src/components/ActionButton/styles.js +5 -7
  79. package/build/admin/src/components/Avatar/index.d.ts +12 -0
  80. package/build/admin/src/components/Avatar/index.js +26 -0
  81. package/build/admin/src/components/ConfirmationDialog/index.js +23 -90
  82. package/build/admin/src/components/DiscussionStatus/index.js +13 -27
  83. package/build/admin/src/components/DiscussionThread/index.js +29 -83
  84. package/build/admin/src/components/DiscussionThreadItem/index.js +20 -59
  85. package/build/admin/src/components/DiscussionThreadItem/styles.d.ts +1 -1
  86. package/build/admin/src/components/DiscussionThreadItem/styles.js +8 -17
  87. package/build/admin/src/components/DiscussionThreadItemActions/index.js +163 -383
  88. package/build/admin/src/components/DiscussionThreadItemActions/styles.d.ts +1 -1
  89. package/build/admin/src/components/DiscussionThreadItemActions/styles.js +5 -9
  90. package/build/admin/src/components/DiscussionThreadItemApprovalFlowActions/index.js +52 -85
  91. package/build/admin/src/components/DiscussionThreadItemApprovalFlowActions/styles.d.ts +1 -1
  92. package/build/admin/src/components/DiscussionThreadItemApprovalFlowActions/styles.js +5 -8
  93. package/build/admin/src/components/DiscussionThreadItemFooter/index.js +27 -61
  94. package/build/admin/src/components/DiscussionThreadItemFooter/styles.d.ts +1 -1
  95. package/build/admin/src/components/DiscussionThreadItemFooter/styles.js +7 -14
  96. package/build/admin/src/components/DiscussionThreadItemReviewAction/index.js +91 -207
  97. package/build/admin/src/components/FormSwitch/index.d.ts +5 -9
  98. package/build/admin/src/components/FormSwitch/index.js +8 -32
  99. package/build/admin/src/components/FormSwitch/styles.d.ts +1 -1
  100. package/build/admin/src/components/FormSwitch/styles.js +5 -7
  101. package/build/admin/src/components/IconButton/styles.d.ts +1 -1
  102. package/build/admin/src/components/IconButton/styles.js +7 -13
  103. package/build/admin/src/components/Initializer/index.d.ts +4 -2
  104. package/build/admin/src/components/Initializer/index.js +7 -7
  105. package/build/admin/src/components/LoadingIndicatorOverlay/index.d.ts +1 -1
  106. package/build/admin/src/components/LoadingIndicatorOverlay/index.js +6 -12
  107. package/build/admin/src/components/LoadingIndicatorOverlay/styles.d.ts +1 -1
  108. package/build/admin/src/components/LoadingIndicatorOverlay/styles.js +7 -14
  109. package/build/admin/src/components/Nav/index.js +16 -62
  110. package/build/admin/src/components/PluginIcon/index.d.ts +1 -1
  111. package/build/admin/src/components/PluginIcon/index.js +5 -8
  112. package/build/admin/src/components/ReportsReviewModal/index.js +23 -62
  113. package/build/admin/src/components/ReportsReviewTable/index.js +112 -293
  114. package/build/admin/src/components/StatusBadge/index.d.ts +5 -9
  115. package/build/admin/src/components/StatusBadge/index.js +6 -16
  116. package/build/admin/src/components/StatusBadge/styles.d.ts +1 -1
  117. package/build/admin/src/components/StatusBadge/styles.js +5 -7
  118. package/build/admin/src/components/TableFilters/index.js +38 -91
  119. package/build/admin/src/components/TablePagination/index.d.ts +13 -11
  120. package/build/admin/src/components/TablePagination/index.js +19 -31
  121. package/build/admin/src/components/icons/comments.d.ts +4 -7
  122. package/build/admin/src/components/icons/comments.js +7 -18
  123. package/build/admin/src/components/icons/index.d.ts +1 -1
  124. package/build/admin/src/components/icons/index.js +5 -11
  125. package/build/admin/src/components/icons/lock.d.ts +5 -9
  126. package/build/admin/src/components/icons/lock.js +7 -24
  127. package/build/admin/src/components/icons/review.d.ts +5 -9
  128. package/build/admin/src/components/icons/review.js +7 -26
  129. package/build/admin/src/components/icons/unlock.d.ts +5 -9
  130. package/build/admin/src/components/icons/unlock.js +7 -24
  131. package/build/admin/src/hooks/useConfig.js +34 -42
  132. package/build/admin/src/index.js +84 -121
  133. package/build/admin/src/pages/App/index.js +23 -66
  134. package/build/admin/src/pages/App/reducer/actions.d.ts +4 -4
  135. package/build/admin/src/pages/App/reducer/actions.js +3 -3
  136. package/build/admin/src/pages/App/reducer/constants.d.ts +1 -1
  137. package/build/admin/src/pages/App/reducer/constants.js +1 -1
  138. package/build/admin/src/pages/App/reducer/index.d.ts +5 -10
  139. package/build/admin/src/pages/App/reducer/index.js +16 -19
  140. package/build/admin/src/pages/App/reducer/init.d.ts +1 -1
  141. package/build/admin/src/pages/App/reducer/init.js +4 -4
  142. package/build/admin/src/pages/App/reducer/selectors.d.ts +1 -1
  143. package/build/admin/src/pages/App/reducer/selectors.js +6 -8
  144. package/build/admin/src/pages/App/utils/api.js +8 -9
  145. package/build/admin/src/pages/ComingSoonPage/index.js +27 -62
  146. package/build/admin/src/pages/Details/components/DetailsEntity/index.js +39 -115
  147. package/build/admin/src/pages/Details/components/DetailsFilters/index.js +13 -33
  148. package/build/admin/src/pages/Details/components/DetailsFilters/styles.d.ts +1 -1
  149. package/build/admin/src/pages/Details/components/DetailsFilters/styles.js +5 -7
  150. package/build/admin/src/pages/Details/index.js +64 -183
  151. package/build/admin/src/pages/Discover/components/DiscoverTableRow/index.js +139 -314
  152. package/build/admin/src/pages/Discover/components/DiscoverTableRow/styles.d.ts +1 -1
  153. package/build/admin/src/pages/Discover/components/DiscoverTableRow/styles.js +5 -7
  154. package/build/admin/src/pages/Discover/index.js +98 -298
  155. package/build/admin/src/pages/Discover/utils/api.js +8 -15
  156. package/build/admin/src/pages/Discover/utils/filtersSchema.d.ts +8 -8
  157. package/build/admin/src/pages/Discover/utils/filtersSchema.js +6 -6
  158. package/build/admin/src/pages/Settings/components/RestartAlert/styles.d.ts +1 -1
  159. package/build/admin/src/pages/Settings/components/RestartAlert/styles.js +5 -7
  160. package/build/admin/src/pages/Settings/index.js +192 -678
  161. package/build/admin/src/pages/Settings/utils/api.js +44 -59
  162. package/build/admin/src/pages/utils/api.js +26 -51
  163. package/build/admin/src/permissions.d.ts +25 -25
  164. package/build/admin/src/permissions.js +28 -60
  165. package/build/admin/src/pluginId.d.ts +1 -1
  166. package/build/admin/src/pluginId.js +20 -41
  167. package/build/admin/src/reducers.d.ts +4 -9
  168. package/build/admin/src/reducers.js +5 -7
  169. package/build/admin/src/translations/fr.json +132 -1
  170. package/build/admin/src/utils/axiosInstance.js +15 -23
  171. package/build/admin/src/utils/constants.d.ts +17 -17
  172. package/build/admin/src/utils/constants.js +16 -20
  173. package/build/admin/src/utils/getApiUrl.d.ts +1 -1
  174. package/build/admin/src/utils/getApiUrl.js +1 -1
  175. package/build/admin/src/utils/getMessage.js +13 -17
  176. package/build/admin/src/utils/getRelatedGroups.js +2 -3
  177. package/build/admin/src/utils/getUrl.d.ts +1 -1
  178. package/build/admin/src/utils/getUrl.js +1 -1
  179. package/build/admin/src/utils/handleAPIError.js +12 -15
  180. package/build/admin/src/utils/index.js +16 -84
  181. package/build/admin/src/utils/parseRegExp.d.ts +3 -3
  182. package/build/admin/src/utils/parseRegExp.js +6 -6
  183. package/build/admin/src/utils/renderEntryTitle.js +7 -10
  184. package/build/admin/src/utils/renderInitials.d.ts +1 -1
  185. package/build/admin/src/utils/renderInitials.js +2 -3
  186. package/build/admin/src/utils/resolveCommentStatus.js +19 -25
  187. package/build/admin/src/utils/resolveCommentStatusColor.js +15 -15
  188. package/build/content-types/comment.d.ts +87 -87
  189. package/build/content-types/comment.js +87 -87
  190. package/build/content-types/index.d.ts +136 -136
  191. package/build/content-types/index.js +10 -12
  192. package/build/content-types/report.d.ts +41 -41
  193. package/build/content-types/report.js +41 -41
  194. package/build/package.json +5 -5
  195. package/build/permissions.d.ts +14 -14
  196. package/build/permissions.js +14 -14
  197. package/build/server/bootstrap.js +52 -58
  198. package/build/server/config/index.js +13 -13
  199. package/build/server/controllers/admin.js +128 -117
  200. package/build/server/controllers/client.js +15 -4
  201. package/build/server/controllers/index.js +6 -8
  202. package/build/server/controllers/utils/functions.d.ts +1 -1
  203. package/build/server/controllers/utils/parsers.d.ts +5 -10
  204. package/build/server/controllers/utils/parsers.js +46 -20
  205. package/build/server/destroy.d.ts +1 -1
  206. package/build/server/destroy.js +3 -2
  207. package/build/server/graphql/index.js +19 -29
  208. package/build/server/graphql/mutations/createAbuseReport.js +19 -23
  209. package/build/server/graphql/mutations/createComment.d.ts +1 -1
  210. package/build/server/graphql/mutations/createComment.js +19 -22
  211. package/build/server/graphql/mutations/index.js +19 -21
  212. package/build/server/graphql/mutations/removeComment.d.ts +1 -1
  213. package/build/server/graphql/mutations/removeComment.js +19 -23
  214. package/build/server/graphql/mutations/updateComment.d.ts +1 -1
  215. package/build/server/graphql/mutations/updateComment.js +19 -23
  216. package/build/server/graphql/queries/findAllFlat.d.ts +1 -1
  217. package/build/server/graphql/queries/findAllFlat.js +30 -40
  218. package/build/server/graphql/queries/findAllInHierarchy.d.ts +1 -2
  219. package/build/server/graphql/queries/findAllInHierarchy.js +25 -32
  220. package/build/server/graphql/queries/index.js +17 -19
  221. package/build/server/graphql/resolvers-config.js +10 -10
  222. package/build/server/graphql/types/comment-author.js +7 -8
  223. package/build/server/graphql/types/comment-nested.js +14 -15
  224. package/build/server/graphql/types/comment.js +13 -14
  225. package/build/server/graphql/types/create-comment-author.js +7 -8
  226. package/build/server/graphql/types/create-comment.js +7 -8
  227. package/build/server/graphql/types/create-report.js +7 -8
  228. package/build/server/graphql/types/id.js +13 -14
  229. package/build/server/graphql/types/identify-comment-author.js +4 -5
  230. package/build/server/graphql/types/index.js +21 -27
  231. package/build/server/graphql/types/remove-comment.js +6 -7
  232. package/build/server/graphql/types/report-reason.js +9 -9
  233. package/build/server/graphql/types/report.js +9 -10
  234. package/build/server/graphql/types/response-find-all.js +5 -6
  235. package/build/server/graphql/types/response-meta.js +4 -5
  236. package/build/server/graphql/types/response-pagination.js +9 -10
  237. package/build/server/graphql/types/update-comment.js +7 -8
  238. package/build/server/register.d.ts +1 -1
  239. package/build/server/register.js +3 -2
  240. package/build/server/routes/admin.d.ts +1 -1
  241. package/build/server/routes/admin.js +99 -99
  242. package/build/server/routes/client.d.ts +1 -1
  243. package/build/server/routes/client.js +79 -43
  244. package/build/server/routes/index.d.ts +4 -4
  245. package/build/server/routes/index.js +12 -14
  246. package/build/server/services/admin.js +257 -284
  247. package/build/server/services/client.js +54 -42
  248. package/build/server/services/common.js +33 -11
  249. package/build/server/services/graphql.js +113 -124
  250. package/build/server/services/utils/functions.d.ts +1 -1
  251. package/build/server/services/utils/functions.js +76 -109
  252. package/build/server/utils/constants.js +13 -14
  253. package/build/server/utils/error.d.ts +12 -16
  254. package/build/server/utils/error.js +23 -23
  255. package/build/server/utils/functions.d.ts +4 -12
  256. package/build/server/utils/functions.js +20 -34
  257. package/build/strapi-admin.js +4 -6
  258. package/build/tsconfig.tsbuildinfo +1 -1
  259. package/build/types/contentTypes.d.ts +7 -5
  260. package/content-types/comment.ts +93 -0
  261. package/content-types/index.ts +11 -0
  262. package/content-types/report.ts +50 -0
  263. package/jest.config.ts +22 -0
  264. package/package.json +45 -11
  265. package/permissions.ts +17 -0
  266. package/server/{bootstrap.js → bootstrap.ts} +12 -11
  267. package/server/config/index.ts +19 -0
  268. package/server/controllers/admin.ts +194 -0
  269. package/server/controllers/client.ts +220 -0
  270. package/server/controllers/index.ts +13 -0
  271. package/server/controllers/utils/functions.ts +27 -0
  272. package/server/controllers/utils/parsers.ts +59 -0
  273. package/server/destroy.ts +3 -0
  274. package/server/graphql/index.ts +27 -0
  275. package/server/graphql/mutations/createAbuseReport.ts +38 -0
  276. package/server/graphql/mutations/createComment.ts +41 -0
  277. package/server/graphql/mutations/index.ts +26 -0
  278. package/server/graphql/mutations/removeComment.ts +41 -0
  279. package/server/graphql/mutations/updateComment.ts +40 -0
  280. package/server/graphql/queries/findAllFlat.ts +58 -0
  281. package/server/graphql/queries/findAllInHierarchy.ts +47 -0
  282. package/server/graphql/queries/index.ts +22 -0
  283. package/server/graphql/resolvers-config.ts +13 -0
  284. package/server/graphql/types/comment-author.ts +12 -0
  285. package/server/graphql/types/comment-nested.ts +19 -0
  286. package/server/graphql/types/comment.ts +18 -0
  287. package/server/graphql/types/create-comment-author.ts +12 -0
  288. package/server/graphql/types/create-comment.ts +12 -0
  289. package/server/graphql/types/create-report.ts +12 -0
  290. package/server/graphql/types/id.ts +28 -0
  291. package/server/graphql/types/identify-comment-author.ts +9 -0
  292. package/server/graphql/types/index.ts +38 -0
  293. package/server/graphql/types/remove-comment.ts +11 -0
  294. package/server/graphql/types/report-reason.ts +12 -0
  295. package/server/graphql/types/report.ts +14 -0
  296. package/server/graphql/types/response-find-all.ts +10 -0
  297. package/server/graphql/types/response-meta.ts +9 -0
  298. package/server/graphql/types/response-pagination.ts +14 -0
  299. package/server/graphql/types/update-comment.ts +12 -0
  300. package/server/index.ts +20 -0
  301. package/server/register.ts +3 -0
  302. package/server/routes/admin.ts +118 -0
  303. package/server/routes/client.ts +95 -0
  304. package/server/routes/index.ts +25 -0
  305. package/server/services/admin.ts +406 -0
  306. package/server/services/client.ts +394 -0
  307. package/server/services/common.ts +503 -0
  308. package/server/services/{graphql.js → graphql.ts} +72 -43
  309. package/server/services/index.ts +13 -0
  310. package/server/services/utils/functions.ts +150 -0
  311. package/server/utils/constants.ts +23 -0
  312. package/server/utils/error.ts +44 -0
  313. package/server/utils/functions.ts +55 -0
  314. package/strapi-admin.ts +5 -0
  315. package/strapi-server.ts +77 -0
  316. package/tsconfig.json +38 -0
  317. package/types/common.d.ts +1 -0
  318. package/types/config.d.ts +35 -0
  319. package/types/constants.d.ts +3 -0
  320. package/types/contentTypes.ts +56 -0
  321. package/types/controllers.d.ts +125 -0
  322. package/types/graphql.d.ts +24 -0
  323. package/types/index.d.ts +7 -0
  324. package/types/services.d.ts +166 -0
  325. package/__mocks__/initSetup.js +0 -108
  326. package/admin/src/components/ActionButton/styles.js +0 -10
  327. package/admin/src/components/ConfirmationDialog/index.js +0 -56
  328. package/admin/src/components/DiscussionStatus/index.js +0 -33
  329. package/admin/src/components/DiscussionThread/index.js +0 -62
  330. package/admin/src/components/DiscussionThreadItem/index.js +0 -57
  331. package/admin/src/components/DiscussionThreadItemActions/index.js +0 -231
  332. package/admin/src/components/DiscussionThreadItemActions/styles.js +0 -7
  333. package/admin/src/components/DiscussionThreadItemApprovalFlowActions/index.js +0 -80
  334. package/admin/src/components/DiscussionThreadItemApprovalFlowActions/styles.js +0 -6
  335. package/admin/src/components/DiscussionThreadItemFooter/index.js +0 -47
  336. package/admin/src/components/DiscussionThreadItemFooter/styles.js +0 -13
  337. package/admin/src/components/DiscussionThreadItemReviewAction/index.js +0 -131
  338. package/admin/src/components/FormSwitch/index.js +0 -18
  339. package/admin/src/components/FormSwitch/styles.js +0 -8
  340. package/admin/src/components/IconButton/styles.js +0 -14
  341. package/admin/src/components/LoadingIndicatorOverlay/index.js +0 -15
  342. package/admin/src/components/LoadingIndicatorOverlay/styles.js +0 -20
  343. package/admin/src/components/Nav/index.js +0 -49
  344. package/admin/src/components/ReportsReviewModal/index.js +0 -48
  345. package/admin/src/components/ReportsReviewTable/index.js +0 -160
  346. package/admin/src/components/StatusBadge/index.js +0 -17
  347. package/admin/src/components/StatusBadge/styles.js +0 -17
  348. package/admin/src/components/icons/comments.js +0 -9
  349. package/admin/src/components/icons/index.js +0 -6
  350. package/admin/src/components/icons/review.js +0 -18
  351. package/admin/src/components/icons/unlock.js +0 -20
  352. package/admin/src/hooks/useConfig.js +0 -49
  353. package/admin/src/pages/App/index.js +0 -71
  354. package/admin/src/pages/App/reducer/actions.js +0 -8
  355. package/admin/src/pages/App/reducer/constants.js +0 -4
  356. package/admin/src/pages/App/reducer/init.js +0 -7
  357. package/admin/src/pages/App/reducer/selectors.js +0 -35
  358. package/admin/src/pages/ComingSoonPage/index.js +0 -25
  359. package/admin/src/pages/Details/components/DetailsEntity/index.js +0 -84
  360. package/admin/src/pages/Details/components/DetailsFilters/index.js +0 -35
  361. package/admin/src/pages/Details/components/DetailsFilters/styles.js +0 -8
  362. package/admin/src/pages/Details/index.js +0 -136
  363. package/admin/src/pages/Discover/components/DiscoverTableRow/index.js +0 -180
  364. package/admin/src/pages/Discover/components/DiscoverTableRow/styles.js +0 -8
  365. package/admin/src/pages/Discover/index.js +0 -173
  366. package/admin/src/pages/Discover/utils/api.js +0 -14
  367. package/admin/src/pages/Discover/utils/filtersSchema.js +0 -9
  368. package/admin/src/pages/Settings/components/RestartAlert/styles.js +0 -8
  369. package/admin/src/pages/Settings/index.js +0 -392
  370. package/admin/src/pages/utils/api.js +0 -53
  371. package/admin/src/permissions.js +0 -19
  372. package/admin/src/pluginId.js +0 -5
  373. package/admin/src/reducers.js +0 -8
  374. package/admin/src/utils/constants.js +0 -25
  375. package/admin/src/utils/getApiUrl.js +0 -5
  376. package/admin/src/utils/getMessage.js +0 -21
  377. package/admin/src/utils/getRelatedGroups.js +0 -3
  378. package/admin/src/utils/getUrl.js +0 -5
  379. package/admin/src/utils/handleAPIError.js +0 -16
  380. package/admin/src/utils/index.js +0 -11
  381. package/admin/src/utils/parseRegExp.js +0 -10
  382. package/admin/src/utils/renderEntryTitle.js +0 -14
  383. package/admin/src/utils/renderInitials.js +0 -5
  384. package/admin/src/utils/resolveCommentStatus.js +0 -30
  385. package/admin/src/utils/resolveCommentStatusColor.js +0 -22
  386. package/content-types/comment.js +0 -93
  387. package/content-types/index.js +0 -11
  388. package/content-types/report.js +0 -54
  389. package/jest.config.js +0 -7
  390. package/permissions.js +0 -19
  391. package/server/config/index.js +0 -17
  392. package/server/controllers/admin.js +0 -168
  393. package/server/controllers/client.js +0 -114
  394. package/server/controllers/index.js +0 -9
  395. package/server/controllers/utils/__tests__/functions.test.js +0 -43
  396. package/server/controllers/utils/__tests__/parsers.test.js +0 -94
  397. package/server/controllers/utils/functions.js +0 -19
  398. package/server/controllers/utils/parsers.js +0 -23
  399. package/server/destroy.js +0 -5
  400. package/server/graphql/index.js +0 -25
  401. package/server/graphql/mutations/createAbuseReport.js +0 -25
  402. package/server/graphql/mutations/createComment.js +0 -25
  403. package/server/graphql/mutations/index.js +0 -21
  404. package/server/graphql/mutations/removeComment.js +0 -25
  405. package/server/graphql/mutations/updateComment.js +0 -25
  406. package/server/graphql/queries/findAllFlat.js +0 -35
  407. package/server/graphql/queries/findAllInHierarchy.js +0 -31
  408. package/server/graphql/queries/index.js +0 -19
  409. package/server/graphql/resolvers-config.js +0 -13
  410. package/server/graphql/types/comment-author.js +0 -9
  411. package/server/graphql/types/comment-nested.js +0 -16
  412. package/server/graphql/types/comment.js +0 -15
  413. package/server/graphql/types/create-comment-author.js +0 -9
  414. package/server/graphql/types/create-comment.js +0 -9
  415. package/server/graphql/types/create-report.js +0 -9
  416. package/server/graphql/types/id.js +0 -24
  417. package/server/graphql/types/identify-comment-author.js +0 -6
  418. package/server/graphql/types/index.js +0 -19
  419. package/server/graphql/types/remove-comment.js +0 -8
  420. package/server/graphql/types/report-reason.js +0 -10
  421. package/server/graphql/types/report.js +0 -11
  422. package/server/graphql/types/response-find-all.js +0 -7
  423. package/server/graphql/types/response-meta.js +0 -6
  424. package/server/graphql/types/response-pagination.js +0 -11
  425. package/server/graphql/types/update-comment.js +0 -9
  426. package/server/index.js +0 -22
  427. package/server/register.js +0 -5
  428. package/server/routes/admin.js +0 -124
  429. package/server/routes/client.js +0 -52
  430. package/server/routes/index.js +0 -15
  431. package/server/services/__tests__/common.test.js +0 -399
  432. package/server/services/admin.js +0 -296
  433. package/server/services/client.js +0 -263
  434. package/server/services/common.js +0 -295
  435. package/server/services/index.js +0 -13
  436. package/server/services/utils/__tests__/functions.test.js +0 -53
  437. package/server/services/utils/functions.js +0 -112
  438. package/server/utils/__tests__/functions.test.js +0 -17
  439. package/server/utils/constants.js +0 -26
  440. package/server/utils/error.js +0 -24
  441. package/server/utils/functions.js +0 -19
  442. package/strapi-admin.js +0 -3
  443. package/strapi-server.js +0 -49
package/build/README.md CHANGED
@@ -32,6 +32,19 @@
32
32
 
33
33
  A plugin for [Strapi Headless CMS](https://github.com/strapi/strapi) that provides end to end comments feature with their moderation panel, bad words filtering, abuse reporting and much more.
34
34
 
35
+ ### Table of Contents
36
+
37
+ 1. [✨ Features](#-features)
38
+ 2. [⏳ Installation](#-installation)
39
+ 3. [🖐 Requirements](#-requirements)
40
+ 4. [🔧 Configuration](#-configuration)
41
+ - [Settings page](#in-v203-and-newer)
42
+ - [Plugin file](#in-v202-and-older--default-configuration-state-for-v203-and-newer)
43
+ 5. [🕸️ Public API - REST](#%EF%B8%8F-public-rest-api-specification)
44
+ 6. [🕸️ Public API - GraphQL](#%EF%B8%8F-public-graphql-specification)
45
+ 7. [🤝 Contributing](#-contributing)
46
+ 8. [👨‍💻 Community support](#-community-support)
47
+
35
48
  ## ✨ Features
36
49
 
37
50
  - **Comments Public REST + GraphQL API:** Elegant, entirely customizable and a fully extensible admin panel.
@@ -48,13 +61,23 @@ A plugin for [Strapi Headless CMS](https://github.com/strapi/strapi) that provid
48
61
 
49
62
  ## ⏳ Installation
50
63
 
64
+ ### Via Strapi Markerplace
65
+
66
+ As a ✅ **verified** plugin by Strapi team we're available on the [**Strapi Marketplace**](https://market.strapi.io/plugins/strapi-plugin-comments) as well as **In-App Marketplace** where you can follow the installation instructions.
67
+
68
+ <div style="margin: 20px 0" align="center">
69
+ <img style="width: 100%; height: auto;" src="public/assets/marketplace.png" alt="Strapi In-App Marketplace" />
70
+ </div>
71
+
72
+ ### Via command line
73
+
51
74
  (Use **yarn** to install this plugin within your Strapi project (recommended). [Install yarn with these docs](https://yarnpkg.com/lang/en/docs/install/).)
52
75
 
53
76
  ```bash
54
77
  yarn add strapi-plugin-comments@latest
55
78
  ```
56
79
 
57
- After successful installation you've to build a fresh package that includes plugin UI. To archive that simply use:
80
+ After successful installation you've to re-build your Strapi instance. To archive that simply use:
58
81
 
59
82
  ```bash
60
83
  yarn build
@@ -69,7 +92,9 @@ yarn develop --watch-admin
69
92
 
70
93
  The **Comments** plugin should appear in the **Plugins** section of Strapi sidebar after you run app again.
71
94
 
72
- Enjoy 🎉
95
+ As a next step you must configure your the plugin by the way you want to. See [**Configuration**](#🔧-configuration) section.
96
+
97
+ All done. Enjoy 🎉
73
98
 
74
99
  ### Working in development mode
75
100
 
@@ -107,7 +132,7 @@ In our minimum support we're following [official Node.js releases timelines](htt
107
132
 
108
133
  **Supported Strapi versions**:
109
134
 
110
- - Strapi v4.1.2 (recently tested)
135
+ - Strapi v4.1.7 (recently tested)
111
136
  - Strapi v4.x
112
137
 
113
138
  > This plugin is designed for **Strapi v4** and is not working with v3.x. To get version for **Strapi v3** install version [v1.x](https://github.com/VirtusLab-Open-Source/strapi-plugin-comments/tree/strapi-v3).
@@ -116,14 +141,22 @@ In our minimum support we're following [official Node.js releases timelines](htt
116
141
 
117
142
  ## 🔧 Configuration
118
143
 
119
- ### In `v2.0.3` and newest
144
+ To start your journey with **Comments plugin** you must first setup it using the dedicated Settings page (`v2.0.3` and newer) or for any version, put your configuration in `config/plugins.js`. Anyway we're recommending the click-through option where your configuration is going to be properly validated.
145
+
146
+ ### In `v2.0.3` and newer
120
147
 
121
148
  Version `2.0.3` introduce the intuitive **Settings** page which you can easly access via `Strapi Settings -> Section: Comments Plugin -> Configuration`. On dedicated page you will be able to setup all crucial properties which drives the plugin and customize each individual collection for which **Comments plugin** should be enabled.
122
149
 
150
+ On the dedicated page, you will be able to set up all crucial properties which drive the plugin and customize each individual collection for which **Comments plugin** should be enabled.
151
+
152
+ <div style="margin: 20px 0" align="center">
153
+ <img style="width: 100%; height: auto;" src="public/assets/configuration.png" alt="Plugin configuration" />
154
+ </div>
155
+
123
156
  > _Note_
124
157
  > Default configuration for your plugin is fetched from `config/plugins.js` or directly from the plugin itself. If you would like to customize the default state to which you might revert, please follow the next section.
125
158
 
126
- ### In `v2.0.2` and older + default configuration state for `v2.0.3` and newest
159
+ ### In `v2.0.2` and older + default configuration state for `v2.0.3` and newer
127
160
 
128
161
  To setup amend default plugin configuration we recommend to put following snippet as part of `config/plugins.js` or `config/<env>/plugins.js` file. If the file does not exist yet, you have to create it manually. If you've got already configurations for other plugins stores by this way, use just the `comments` part within exising `plugins` item.
129
162
 
@@ -154,6 +187,7 @@ module.exports = ({ env }) => ({
154
187
 
155
188
  ### Properties
156
189
 
190
+ - `enabledCollections` - list of Collection and Single Types for which plugin should be enabled in format like `'api::<collection name>.<content type name>'`. By default it's empty and none comments are not enabled for any of type in Strapi.
157
191
  - `badWords` - Enabled support for [bad words filtering](https://www.npmjs.com/package/bad-words). Can be turned off or overwritten using [options reference](https://www.npmjs.com/package/bad-words#constructor). Default value: `true`.
158
192
  - `moderatorRoles` - Optional list of names of roles. Users with those roles will be notified by email when a new abuse report is created. This feature requires a built-in [Strapi email plugin](https://docs.strapi.io/developer-docs/latest/plugins/email.html) configured.
159
193
  - `approvalFlow` - list of Content Types which are supporting approval flow. Values must be in format like `'api::<collection name>.<content type name>'`. For not included, posted comments are going to be immediately visible.
@@ -276,6 +310,7 @@ Return a hierarchical tree structure of comments for specified instance of Conte
276
310
 
277
311
  #### Strapi REST API properties support:
278
312
 
313
+ - [field selection](https://docs.strapi.io/developer-docs/latest/developer-resources/database-apis-reference/rest/populating-fields.html#field-selection)
279
314
  - [sorting](https://docs.strapi.io/developer-docs/latest/developer-resources/database-apis-reference/rest/sort-pagination.html#sorting)
280
315
 
281
316
  ### Get Comments (flat structure)
@@ -317,6 +352,7 @@ Return a flat structure of comments for specified instance of Content Type like
317
352
  #### Strapi REST API properties support:
318
353
 
319
354
  - [filtering](https://docs.strapi.io/developer-docs/latest/developer-resources/database-apis-reference/rest/filtering-locale-publication.html#filtering)
355
+ - [field selection](https://docs.strapi.io/developer-docs/latest/developer-resources/database-apis-reference/rest/populating-fields.html#field-selection)
320
356
  - [sorting](https://docs.strapi.io/developer-docs/latest/developer-resources/database-apis-reference/rest/sort-pagination.html#sorting)
321
357
  - [pagination](https://docs.strapi.io/developer-docs/latest/developer-resources/database-apis-reference/rest/sort-pagination.html#pagination)
322
358
 
@@ -1,2 +1,2 @@
1
1
  export declare const ActionButton: any;
2
- //# sourceMappingURL=styles.d.ts.map
2
+ //# sourceMappingURL=styles.d.ts.map
@@ -1,17 +1,15 @@
1
1
  "use strict";
2
- var __importDefault =
3
- (this && this.__importDefault) ||
4
- function (mod) {
5
- return mod && mod.__esModule ? mod : { default: mod };
6
- };
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
7
5
  Object.defineProperty(exports, "__esModule", { value: true });
8
6
  exports.ActionButton = void 0;
9
7
  const styled_components_1 = __importDefault(require("styled-components"));
10
8
  const Button_1 = require("@strapi/design-system/Button");
11
- exports.ActionButton = (0, styled_components_1.default)(Button_1.Button)`
9
+ exports.ActionButton = (0, styled_components_1.default)(Button_1.Button) `
12
10
  padding: 7px 16px;
13
11
  margin-left: ${({ isSingle }) => (isSingle ? "0" : ".5rem")};
14
12
 
15
13
  white-space: nowrap;
16
14
  `;
17
- //# sourceMappingURL=styles.js.map
15
+ //# sourceMappingURL=styles.js.map
@@ -0,0 +1,12 @@
1
+ declare const UserAvatar: {
2
+ ({ avatar, name }: {
3
+ avatar: any;
4
+ name: any;
5
+ }): any;
6
+ propTypes: {
7
+ avatar: any;
8
+ name: any;
9
+ };
10
+ };
11
+ export default UserAvatar;
12
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const react_1 = __importDefault(require("react"));
7
+ const prop_types_1 = __importDefault(require("prop-types"));
8
+ const lodash_1 = require("lodash");
9
+ const Avatar_1 = require("@strapi/design-system/Avatar");
10
+ const utils_1 = require("../../utils");
11
+ const UserAvatar = ({ avatar, name }) => {
12
+ if (avatar) {
13
+ let image = avatar;
14
+ if ((0, lodash_1.isObject)(avatar)) {
15
+ image = avatar?.formats?.thumbnail.url || avatar.url;
16
+ }
17
+ return react_1.default.createElement(Avatar_1.Avatar, { src: image, alt: name });
18
+ }
19
+ return react_1.default.createElement(Avatar_1.Initials, null, (0, utils_1.renderInitials)(name));
20
+ };
21
+ UserAvatar.propTypes = {
22
+ avatar: prop_types_1.default.oneOfType(prop_types_1.default.string, prop_types_1.default.object).isRequired,
23
+ name: prop_types_1.default.string,
24
+ };
25
+ exports.default = UserAvatar;
26
+ //# sourceMappingURL=index.js.map
@@ -1,9 +1,7 @@
1
1
  "use strict";
2
- var __importDefault =
3
- (this && this.__importDefault) ||
4
- function (mod) {
5
- return mod && mod.__esModule ? mod : { default: mod };
6
- };
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
7
5
  Object.defineProperty(exports, "__esModule", { value: true });
8
6
  const react_1 = __importDefault(require("react"));
9
7
  const prop_types_1 = __importDefault(require("prop-types"));
@@ -14,91 +12,26 @@ const Stack_1 = require("@strapi/design-system/Stack");
14
12
  const Typography_1 = require("@strapi/design-system/Typography");
15
13
  const icons_1 = require("@strapi/icons");
16
14
  const utils_1 = require("../../utils");
17
- const ConfirmationDialog = ({
18
- isVisible = false,
19
- isActionAsync = false,
20
- children,
21
- onConfirm,
22
- onCancel,
23
- header,
24
- labelCancel,
25
- labelConfirm,
26
- iconConfirm,
27
- }) =>
28
- react_1.default.createElement(
29
- Dialog_1.Dialog,
30
- {
31
- onClose: onCancel,
32
- title:
33
- header ||
34
- (0, utils_1.getMessage)(
35
- "compontents.confirmation.dialog.header",
36
- "Confirmation"
37
- ),
38
- isOpen: isVisible,
39
- },
40
- react_1.default.createElement(
41
- Dialog_1.DialogBody,
42
- {
43
- icon: react_1.default.createElement(
44
- icons_1.ExclamationMarkCircle,
45
- null
46
- ),
47
- },
48
- react_1.default.createElement(
49
- Stack_1.Stack,
50
- { size: 2 },
51
- react_1.default.createElement(
52
- Flex_1.Flex,
53
- { justifyContent: "center" },
54
- react_1.default.createElement(
55
- Typography_1.Typography,
56
- { id: "dialog-confirm-description" },
57
- children ||
58
- (0, utils_1.getMessage)(
59
- "compontents.confirmation.dialog.description"
60
- )
61
- )
62
- )
63
- )
64
- ),
65
- react_1.default.createElement(Dialog_1.DialogFooter, {
66
- startAction: react_1.default.createElement(
67
- Button_1.Button,
68
- { onClick: onCancel, variant: "tertiary", disabled: isActionAsync },
69
- labelCancel ||
70
- (0, utils_1.getMessage)(
71
- "compontents.confirmation.dialog.button.cancel",
72
- "Cancel"
73
- )
74
- ),
75
- endAction: react_1.default.createElement(
76
- Button_1.Button,
77
- {
78
- onClick: onConfirm,
79
- variant: "danger-light",
80
- startIcon:
81
- iconConfirm || react_1.default.createElement(icons_1.Check, null),
82
- disabled: isActionAsync,
83
- },
84
- labelConfirm ||
85
- (0, utils_1.getMessage)(
86
- "compontents.confirmation.dialog.button.confirm",
87
- "Confirm"
88
- )
89
- ),
90
- })
91
- );
15
+ const ConfirmationDialog = ({ isVisible = false, isActionAsync = false, children, onConfirm, onCancel, header, labelCancel, labelConfirm, iconConfirm, }) => (react_1.default.createElement(Dialog_1.Dialog, { onClose: onCancel, title: header ||
16
+ (0, utils_1.getMessage)("compontents.confirmation.dialog.header", "Confirmation"), isOpen: isVisible },
17
+ react_1.default.createElement(Dialog_1.DialogBody, { icon: react_1.default.createElement(icons_1.ExclamationMarkCircle, null) },
18
+ react_1.default.createElement(Stack_1.Stack, { size: 2 },
19
+ react_1.default.createElement(Flex_1.Flex, { justifyContent: "center" },
20
+ react_1.default.createElement(Typography_1.Typography, { id: "dialog-confirm-description" }, children ||
21
+ (0, utils_1.getMessage)("compontents.confirmation.dialog.description"))))),
22
+ react_1.default.createElement(Dialog_1.DialogFooter, { startAction: react_1.default.createElement(Button_1.Button, { onClick: onCancel, variant: "tertiary", disabled: isActionAsync }, labelCancel ||
23
+ (0, utils_1.getMessage)("compontents.confirmation.dialog.button.cancel", "Cancel")), endAction: react_1.default.createElement(Button_1.Button, { onClick: onConfirm, variant: "danger-light", startIcon: iconConfirm || react_1.default.createElement(icons_1.Check, null), disabled: isActionAsync }, labelConfirm ||
24
+ (0, utils_1.getMessage)("compontents.confirmation.dialog.button.confirm", "Confirm")) })));
92
25
  ConfirmationDialog.propTypes = {
93
- isVisible: prop_types_1.default.bool,
94
- isActionAsync: prop_types_1.default.bool,
95
- children: prop_types_1.default.array.isRequired,
96
- header: prop_types_1.default.string,
97
- labelCancel: prop_types_1.default.string,
98
- labelConfirm: prop_types_1.default.string,
99
- iconConfirm: prop_types_1.default.object,
100
- onConfirm: prop_types_1.default.func.isRequired,
101
- onCancel: prop_types_1.default.func.isRequired,
26
+ isVisible: prop_types_1.default.bool,
27
+ isActionAsync: prop_types_1.default.bool,
28
+ children: prop_types_1.default.array.isRequired,
29
+ header: prop_types_1.default.string,
30
+ labelCancel: prop_types_1.default.string,
31
+ labelConfirm: prop_types_1.default.string,
32
+ iconConfirm: prop_types_1.default.object,
33
+ onConfirm: prop_types_1.default.func.isRequired,
34
+ onCancel: prop_types_1.default.func.isRequired,
102
35
  };
103
36
  exports.default = ConfirmationDialog;
104
- //# sourceMappingURL=index.js.map
37
+ //# sourceMappingURL=index.js.map
@@ -1,9 +1,7 @@
1
1
  "use strict";
2
- var __importDefault =
3
- (this && this.__importDefault) ||
4
- function (mod) {
5
- return mod && mod.__esModule ? mod : { default: mod };
6
- };
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
7
5
  Object.defineProperty(exports, "__esModule", { value: true });
8
6
  const react_1 = __importDefault(require("react"));
9
7
  const Box_1 = require("@strapi/design-system/Box");
@@ -11,28 +9,16 @@ const Status_1 = require("@strapi/design-system/Status");
11
9
  const Typography_1 = require("@strapi/design-system/Typography");
12
10
  const utils_1 = require("../../utils");
13
11
  const DiscussionStatus = ({ blocked, blockedThread }) => {
14
- let variant = "success";
15
- return react_1.default.createElement(
16
- Box_1.Box,
17
- { styles: { marginBottom: 10 } },
18
- react_1.default.createElement(
19
- Status_1.Status,
20
- { variant: variant },
21
- react_1.default.createElement(
22
- Typography_1.Typography,
23
- null,
24
- (0, utils_1.getMessage)("page.details.panel.status", "Discussion is"),
25
- " ",
26
- react_1.default.createElement(
27
- Typography_1.Typography,
28
- { fontWeight: "bold" },
29
- (0, utils_1.getMessage)("page.details.panel.open", "OPEN"),
30
- " "
31
- )
32
- )
33
- )
34
- );
12
+ let variant = "success";
13
+ return (react_1.default.createElement(Box_1.Box, { styles: { marginBottom: 10 } },
14
+ react_1.default.createElement(Status_1.Status, { variant: variant },
15
+ react_1.default.createElement(Typography_1.Typography, null,
16
+ (0, utils_1.getMessage)("page.details.panel.status", "Discussion is"),
17
+ " ",
18
+ react_1.default.createElement(Typography_1.Typography, { fontWeight: "bold" },
19
+ (0, utils_1.getMessage)("page.details.panel.open", "OPEN"),
20
+ " ")))));
35
21
  };
36
22
  DiscussionStatus.propTypes = {};
37
23
  exports.default = DiscussionStatus;
38
- //# sourceMappingURL=index.js.map
24
+ //# sourceMappingURL=index.js.map
@@ -1,9 +1,7 @@
1
1
  "use strict";
2
- var __importDefault =
3
- (this && this.__importDefault) ||
4
- function (mod) {
5
- return mod && mod.__esModule ? mod : { default: mod };
6
- };
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
7
5
  Object.defineProperty(exports, "__esModule", { value: true });
8
6
  const react_1 = __importDefault(require("react"));
9
7
  const prop_types_1 = __importDefault(require("prop-types"));
@@ -13,87 +11,35 @@ const Flex_1 = require("@strapi/design-system/Flex");
13
11
  const Link_1 = require("@strapi/design-system/Link");
14
12
  const Typography_1 = require("@strapi/design-system/Typography");
15
13
  const icons_1 = require("@strapi/icons");
16
- const DiscussionThreadItem_1 = __importDefault(
17
- require("../DiscussionThreadItem")
18
- );
14
+ const DiscussionThreadItem_1 = __importDefault(require("../DiscussionThreadItem"));
19
15
  const utils_1 = require("../../utils");
20
- const LoadingIndicatorOverlay_1 = __importDefault(
21
- require("../LoadingIndicatorOverlay")
22
- );
16
+ const LoadingIndicatorOverlay_1 = __importDefault(require("../LoadingIndicatorOverlay"));
23
17
  const styles_1 = require("../LoadingIndicatorOverlay/styles");
24
- const DiscussionThread = ({
25
- level = [],
26
- selected = {},
27
- allowedActions,
28
- isReloading,
29
- }) => {
30
- const rootThread = selected?.threadOf;
31
- return react_1.default.createElement(
32
- styles_1.LoadingIndicatorContainer,
33
- { as: Box_1.Box, padding: 4 },
34
- isReloading &&
35
- react_1.default.createElement(LoadingIndicatorOverlay_1.default, null),
36
- react_1.default.createElement(
37
- Flex_1.Flex,
38
- {
39
- as: Box_1.Box,
40
- direction: "row",
41
- justifyContent: "space-between",
42
- marginBottom: 2,
43
- },
44
- react_1.default.createElement(
45
- Typography_1.Typography,
46
- { variant: "delta", textColor: "neutral800", id: "discussion-thread" },
47
- (0, utils_1.getMessage)("page.details.panel.discussion", "Discussion")
48
- ),
49
- rootThread &&
50
- react_1.default.createElement(
51
- Link_1.Link,
52
- {
53
- to: (0, utils_1.getUrl)(`discover/${rootThread.id}`),
54
- startIcon: react_1.default.createElement(icons_1.ArrowUp, null),
55
- },
56
- (0, utils_1.getMessage)("page.details.panel.discussion.nav.back")
57
- )
58
- ),
59
- react_1.default.createElement(
60
- Flex_1.Flex,
61
- { as: "ul", direction: "column", alignItems: "flex-start" },
62
- rootThread &&
63
- react_1.default.createElement(DiscussionThreadItem_1.default, {
64
- ...rootThread,
65
- allowedActions: allowedActions,
66
- isThreadAuthor: true,
67
- root: true,
68
- pinned: true,
69
- }),
70
- level.map((item) => {
71
- const isSelected = selected.id === item.id;
72
- const isThreadAuthor =
73
- !(0, lodash_1.isNil)(selected?.threadOf?.author?.id) &&
74
- selected?.threadOf?.author?.id === item?.author?.id;
75
- return react_1.default.createElement(DiscussionThreadItem_1.default, {
76
- key: `comment-${item.id}`,
77
- ...item,
78
- allowedActions: allowedActions,
79
- root: (0, lodash_1.isNil)(rootThread),
80
- blockedThread: rootThread?.blockedThread || item.blockedThread,
81
- isSelected: isSelected,
82
- isThreadAuthor: isThreadAuthor,
83
- });
84
- })
85
- )
86
- );
18
+ const DiscussionThread = ({ level = [], selected = {}, allowedActions, isReloading, }) => {
19
+ const rootThread = selected?.threadOf;
20
+ return (react_1.default.createElement(styles_1.LoadingIndicatorContainer, { as: Box_1.Box, padding: 4 },
21
+ isReloading && react_1.default.createElement(LoadingIndicatorOverlay_1.default, null),
22
+ react_1.default.createElement(Flex_1.Flex, { as: Box_1.Box, direction: "row", justifyContent: "space-between", marginBottom: 2 },
23
+ react_1.default.createElement(Typography_1.Typography, { variant: "delta", textColor: "neutral800", id: "discussion-thread" }, (0, utils_1.getMessage)("page.details.panel.discussion", "Discussion")),
24
+ rootThread && (react_1.default.createElement(Link_1.Link, { to: (0, utils_1.getUrl)(`discover/${rootThread.id}`), startIcon: react_1.default.createElement(icons_1.ArrowUp, null) }, (0, utils_1.getMessage)("page.details.panel.discussion.nav.back")))),
25
+ react_1.default.createElement(Flex_1.Flex, { as: "ul", direction: "column", alignItems: "flex-start" },
26
+ rootThread && (react_1.default.createElement(DiscussionThreadItem_1.default, { ...rootThread, allowedActions: allowedActions, isThreadAuthor: true, root: true, pinned: true })),
27
+ level.map((item) => {
28
+ const isSelected = selected.id === item.id;
29
+ const isThreadAuthor = !(0, lodash_1.isNil)(selected?.threadOf?.author?.id) &&
30
+ selected?.threadOf?.author?.id === item?.author?.id;
31
+ return (react_1.default.createElement(DiscussionThreadItem_1.default, { key: `comment-${item.id}`, ...item, allowedActions: allowedActions, root: (0, lodash_1.isNil)(rootThread), blockedThread: rootThread?.blockedThread || item.blockedThread, isSelected: isSelected, isThreadAuthor: isThreadAuthor }));
32
+ }))));
87
33
  };
88
34
  DiscussionThread.propTypes = {
89
- level: prop_types_1.default.array.isRequired,
90
- selected: prop_types_1.default.object.isRequired,
91
- allowedActions: prop_types_1.default.shape({
92
- canModerate: prop_types_1.default.bool,
93
- canAccessReports: prop_types_1.default.bool,
94
- canReviewReports: prop_types_1.default.bool,
95
- }),
96
- isReloading: prop_types_1.default.bool,
35
+ level: prop_types_1.default.array.isRequired,
36
+ selected: prop_types_1.default.object.isRequired,
37
+ allowedActions: prop_types_1.default.shape({
38
+ canModerate: prop_types_1.default.bool,
39
+ canAccessReports: prop_types_1.default.bool,
40
+ canReviewReports: prop_types_1.default.bool,
41
+ }),
42
+ isReloading: prop_types_1.default.bool,
97
43
  };
98
44
  exports.default = DiscussionThread;
99
- //# sourceMappingURL=index.js.map
45
+ //# sourceMappingURL=index.js.map
@@ -1,72 +1,33 @@
1
1
  "use strict";
2
- var __importDefault =
3
- (this && this.__importDefault) ||
4
- function (mod) {
5
- return mod && mod.__esModule ? mod : { default: mod };
6
- };
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
7
5
  Object.defineProperty(exports, "__esModule", { value: true });
8
6
  const react_1 = __importDefault(require("react"));
9
7
  const prop_types_1 = __importDefault(require("prop-types"));
10
8
  const Box_1 = require("@strapi/design-system/Box");
11
9
  const Flex_1 = require("@strapi/design-system/Flex");
12
10
  const Typography_1 = require("@strapi/design-system/Typography");
13
- const DiscussionThreadItemFooter_1 = __importDefault(
14
- require("../DiscussionThreadItemFooter")
15
- );
16
- const DiscussionThreadItemActions_1 = __importDefault(
17
- require("../DiscussionThreadItemActions")
18
- );
11
+ const DiscussionThreadItemFooter_1 = __importDefault(require("../DiscussionThreadItemFooter"));
12
+ const DiscussionThreadItemActions_1 = __importDefault(require("../DiscussionThreadItemActions"));
19
13
  const styles_1 = require("./styles");
20
14
  const DiscussionThreadItem = (props) => {
21
- const { as = "li", isSelected, content, root, preview, pinned } = props;
22
- return react_1.default.createElement(
23
- styles_1.DiscussionThreadFullsize,
24
- { as: as, marginBottom: preview ? 4 : 0 },
25
- react_1.default.createElement(
26
- styles_1.DiscussionThreadItemContainer,
27
- {
28
- as: Flex_1.Flex,
29
- direction: "column",
30
- alignItems: "flex-start",
31
- hasRadius: true,
32
- background: isSelected ? "neutral100" : null,
33
- paddingLeft: 2,
34
- paddingRight: 2,
35
- paddingTop: 4,
36
- paddingBottom: 4,
37
- },
38
- react_1.default.createElement(
39
- styles_1.DiscussionThreadItemContent,
40
- { as: Flex_1.Flex, paddingBottom: 2, direction: "row" },
41
- react_1.default.createElement(
42
- Box_1.Box,
43
- { as: Flex_1.Flex, grow: 1, alignItems: "center", marginTop: "6px" },
44
- react_1.default.createElement(
45
- Typography_1.Typography,
46
- { variant: "omega", textColor: "neutral800" },
47
- content
48
- )
49
- ),
50
- !preview &&
51
- react_1.default.createElement(DiscussionThreadItemActions_1.default, {
52
- ...props,
53
- root: root || pinned,
54
- preview: preview,
55
- })
56
- ),
57
- react_1.default.createElement(DiscussionThreadItemFooter_1.default, {
58
- ...props,
59
- })
60
- )
61
- );
15
+ const { as = "li", isSelected, content, root, preview, pinned } = props;
16
+ return (react_1.default.createElement(styles_1.DiscussionThreadFullsize, { as: as, marginBottom: preview ? 4 : 0 },
17
+ react_1.default.createElement(styles_1.DiscussionThreadItemContainer, { as: Flex_1.Flex, direction: "column", alignItems: "flex-start", hasRadius: true, background: isSelected ? "neutral100" : null, paddingLeft: 2, paddingRight: 2, paddingTop: 4, paddingBottom: 4 },
18
+ react_1.default.createElement(styles_1.DiscussionThreadItemContent, { as: Flex_1.Flex, paddingBottom: 2, direction: "row" },
19
+ react_1.default.createElement(Box_1.Box, { as: Flex_1.Flex, grow: 1, alignItems: "center", marginTop: "6px" },
20
+ react_1.default.createElement(Typography_1.Typography, { variant: "omega", textColor: "neutral800" }, content)),
21
+ !preview && (react_1.default.createElement(DiscussionThreadItemActions_1.default, { ...props, root: root || pinned, preview: preview }))),
22
+ react_1.default.createElement(DiscussionThreadItemFooter_1.default, { ...props }))));
62
23
  };
63
24
  DiscussionThreadItem.propTypes = {
64
- content: prop_types_1.default.string.isRequired,
65
- allowedActions: prop_types_1.default.shape({
66
- canModerate: prop_types_1.default.bool,
67
- canAccessReports: prop_types_1.default.bool,
68
- canReviewReports: prop_types_1.default.bool,
69
- }),
25
+ content: prop_types_1.default.string.isRequired,
26
+ allowedActions: prop_types_1.default.shape({
27
+ canModerate: prop_types_1.default.bool,
28
+ canAccessReports: prop_types_1.default.bool,
29
+ canReviewReports: prop_types_1.default.bool,
30
+ }),
70
31
  };
71
32
  exports.default = DiscussionThreadItem;
72
- //# sourceMappingURL=index.js.map
33
+ //# sourceMappingURL=index.js.map
@@ -1,4 +1,4 @@
1
1
  export declare const DiscussionThreadFullsize: any;
2
2
  export declare const DiscussionThreadItemContent: any;
3
3
  export declare const DiscussionThreadItemContainer: any;
4
- //# sourceMappingURL=styles.d.ts.map
4
+ //# sourceMappingURL=styles.d.ts.map
@@ -1,27 +1,18 @@
1
1
  "use strict";
2
- var __importDefault =
3
- (this && this.__importDefault) ||
4
- function (mod) {
5
- return mod && mod.__esModule ? mod : { default: mod };
6
- };
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
7
5
  Object.defineProperty(exports, "__esModule", { value: true });
8
- exports.DiscussionThreadItemContainer =
9
- exports.DiscussionThreadItemContent =
10
- exports.DiscussionThreadFullsize =
11
- void 0;
6
+ exports.DiscussionThreadItemContainer = exports.DiscussionThreadItemContent = exports.DiscussionThreadFullsize = void 0;
12
7
  const styled_components_1 = __importDefault(require("styled-components"));
13
8
  const Box_1 = require("@strapi/design-system/Box");
14
- exports.DiscussionThreadFullsize = (0, styled_components_1.default)(Box_1.Box)`
9
+ exports.DiscussionThreadFullsize = (0, styled_components_1.default)(Box_1.Box) `
15
10
  width: 100%;
16
11
  `;
17
- exports.DiscussionThreadItemContent = (0, styled_components_1.default)(
18
- exports.DiscussionThreadFullsize
19
- )`
12
+ exports.DiscussionThreadItemContent = (0, styled_components_1.default)(exports.DiscussionThreadFullsize) `
20
13
  align-items: flex-start;
21
14
  `;
22
- exports.DiscussionThreadItemContainer = (0, styled_components_1.default)(
23
- exports.DiscussionThreadFullsize
24
- )`
15
+ exports.DiscussionThreadItemContainer = (0, styled_components_1.default)(exports.DiscussionThreadFullsize) `
25
16
  align-items: flex-start;
26
17
  `;
27
- //# sourceMappingURL=styles.js.map
18
+ //# sourceMappingURL=styles.js.map