@focus-reactive/payload-plugin-comments 1.0.0

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 (387) hide show
  1. package/README.md +563 -0
  2. package/dist/collection/access/isAuth.d.ts +3 -0
  3. package/dist/collection/access/isAuth.d.ts.map +1 -0
  4. package/dist/collection/access/isAuth.js +8 -0
  5. package/dist/collection/access/isAuth.js.map +1 -0
  6. package/dist/collection/hooks/setAuthorBeforeCreate.d.ts +3 -0
  7. package/dist/collection/hooks/setAuthorBeforeCreate.d.ts.map +1 -0
  8. package/dist/collection/hooks/setAuthorBeforeCreate.js +10 -0
  9. package/dist/collection/hooks/setAuthorBeforeCreate.js.map +1 -0
  10. package/dist/collection/hooks/setTenantBeforeCreate.d.ts +3 -0
  11. package/dist/collection/hooks/setTenantBeforeCreate.d.ts.map +1 -0
  12. package/dist/collection/hooks/setTenantBeforeCreate.js +24 -0
  13. package/dist/collection/hooks/setTenantBeforeCreate.js.map +1 -0
  14. package/dist/collection/index.d.ts +4 -0
  15. package/dist/collection/index.d.ts.map +1 -0
  16. package/dist/collection/index.js +139 -0
  17. package/dist/collection/index.js.map +1 -0
  18. package/dist/components/Avatar/index.d.ts +11 -0
  19. package/dist/components/Avatar/index.d.ts.map +1 -0
  20. package/dist/components/Avatar/index.js +11 -0
  21. package/dist/components/Avatar/index.js.map +1 -0
  22. package/dist/components/CommentEditor/ActionPanel.d.ts +8 -0
  23. package/dist/components/CommentEditor/ActionPanel.d.ts.map +1 -0
  24. package/dist/components/CommentEditor/ActionPanel.js +17 -0
  25. package/dist/components/CommentEditor/ActionPanel.js.map +1 -0
  26. package/dist/components/CommentEditor/index.d.ts +23 -0
  27. package/dist/components/CommentEditor/index.d.ts.map +1 -0
  28. package/dist/components/CommentEditor/index.js +265 -0
  29. package/dist/components/CommentEditor/index.js.map +1 -0
  30. package/dist/components/CommentItem/ToolsPanel.d.ts +9 -0
  31. package/dist/components/CommentItem/ToolsPanel.d.ts.map +1 -0
  32. package/dist/components/CommentItem/ToolsPanel.js +22 -0
  33. package/dist/components/CommentItem/ToolsPanel.js.map +1 -0
  34. package/dist/components/CommentItem/index.d.ts +8 -0
  35. package/dist/components/CommentItem/index.d.ts.map +1 -0
  36. package/dist/components/CommentItem/index.js +65 -0
  37. package/dist/components/CommentItem/index.js.map +1 -0
  38. package/dist/components/CommentsDrawer/components/Header.d.ts +6 -0
  39. package/dist/components/CommentsDrawer/components/Header.d.ts.map +1 -0
  40. package/dist/components/CommentsDrawer/components/Header.js +46 -0
  41. package/dist/components/CommentsDrawer/components/Header.js.map +1 -0
  42. package/dist/components/CommentsDrawer/index.d.ts +6 -0
  43. package/dist/components/CommentsDrawer/index.d.ts.map +1 -0
  44. package/dist/components/CommentsDrawer/index.js +30 -0
  45. package/dist/components/CommentsDrawer/index.js.map +1 -0
  46. package/dist/components/CommentsHeaderButton/index.d.ts +2 -0
  47. package/dist/components/CommentsHeaderButton/index.d.ts.map +1 -0
  48. package/dist/components/CommentsHeaderButton/index.js +19 -0
  49. package/dist/components/CommentsHeaderButton/index.js.map +1 -0
  50. package/dist/components/CommentsPanel/components/CollapsibleGroup.d.ts +10 -0
  51. package/dist/components/CommentsPanel/components/CollapsibleGroup.d.ts.map +1 -0
  52. package/dist/components/CommentsPanel/components/CollapsibleGroup.js +68 -0
  53. package/dist/components/CommentsPanel/components/CollapsibleGroup.js.map +1 -0
  54. package/dist/components/CommentsPanel/components/DocumentView.d.ts +9 -0
  55. package/dist/components/CommentsPanel/components/DocumentView.d.ts.map +1 -0
  56. package/dist/components/CommentsPanel/components/DocumentView.js +28 -0
  57. package/dist/components/CommentsPanel/components/DocumentView.js.map +1 -0
  58. package/dist/components/CommentsPanel/components/FieldGroupSection.d.ts +11 -0
  59. package/dist/components/CommentsPanel/components/FieldGroupSection.d.ts.map +1 -0
  60. package/dist/components/CommentsPanel/components/FieldGroupSection.js +62 -0
  61. package/dist/components/CommentsPanel/components/FieldGroupSection.js.map +1 -0
  62. package/dist/components/CommentsPanel/components/GlobalDocumentView.d.ts +9 -0
  63. package/dist/components/CommentsPanel/components/GlobalDocumentView.d.ts.map +1 -0
  64. package/dist/components/CommentsPanel/components/GlobalDocumentView.js +20 -0
  65. package/dist/components/CommentsPanel/components/GlobalDocumentView.js.map +1 -0
  66. package/dist/components/CommentsPanel/components/GlobalView.d.ts +9 -0
  67. package/dist/components/CommentsPanel/components/GlobalView.d.ts.map +1 -0
  68. package/dist/components/CommentsPanel/components/GlobalView.js +62 -0
  69. package/dist/components/CommentsPanel/components/GlobalView.js.map +1 -0
  70. package/dist/components/CommentsPanel/constants.d.ts +3 -0
  71. package/dist/components/CommentsPanel/constants.d.ts.map +1 -0
  72. package/dist/components/CommentsPanel/constants.js +9 -0
  73. package/dist/components/CommentsPanel/constants.js.map +1 -0
  74. package/dist/components/CommentsPanel/hooks/useCollapseState.d.ts +2 -0
  75. package/dist/components/CommentsPanel/hooks/useCollapseState.d.ts.map +1 -0
  76. package/dist/components/CommentsPanel/hooks/useCollapseState.js +44 -0
  77. package/dist/components/CommentsPanel/hooks/useCollapseState.js.map +1 -0
  78. package/dist/components/CommentsPanel/hooks/useScrollToTargetFieldGroup.d.ts +2 -0
  79. package/dist/components/CommentsPanel/hooks/useScrollToTargetFieldGroup.d.ts.map +1 -0
  80. package/dist/components/CommentsPanel/hooks/useScrollToTargetFieldGroup.js +35 -0
  81. package/dist/components/CommentsPanel/hooks/useScrollToTargetFieldGroup.js.map +1 -0
  82. package/dist/components/CommentsPanel/index.d.ts +6 -0
  83. package/dist/components/CommentsPanel/index.d.ts.map +1 -0
  84. package/dist/components/CommentsPanel/index.js +32 -0
  85. package/dist/components/CommentsPanel/index.js.map +1 -0
  86. package/dist/components/CommentsPanel/types.d.ts +4 -0
  87. package/dist/components/CommentsPanel/types.d.ts.map +1 -0
  88. package/dist/components/CommentsPanel/types.js +1 -0
  89. package/dist/components/CommentsPanel/types.js.map +1 -0
  90. package/dist/components/CommentsPanel/utils/createCollapsibleGroupKey.d.ts +10 -0
  91. package/dist/components/CommentsPanel/utils/createCollapsibleGroupKey.d.ts.map +1 -0
  92. package/dist/components/CommentsPanel/utils/createCollapsibleGroupKey.js +15 -0
  93. package/dist/components/CommentsPanel/utils/createCollapsibleGroupKey.js.map +1 -0
  94. package/dist/components/CommentsPanel/utils/filterComments.d.ts +9 -0
  95. package/dist/components/CommentsPanel/utils/filterComments.d.ts.map +1 -0
  96. package/dist/components/CommentsPanel/utils/filterComments.js +17 -0
  97. package/dist/components/CommentsPanel/utils/filterComments.js.map +1 -0
  98. package/dist/components/CommentsPanel/utils/groupCommentsByFieldPath.d.ts +4 -0
  99. package/dist/components/CommentsPanel/utils/groupCommentsByFieldPath.d.ts.map +1 -0
  100. package/dist/components/CommentsPanel/utils/groupCommentsByFieldPath.js +14 -0
  101. package/dist/components/CommentsPanel/utils/groupCommentsByFieldPath.js.map +1 -0
  102. package/dist/components/CommentsPanel/utils/groupCommentsGlobally.d.ts +18 -0
  103. package/dist/components/CommentsPanel/utils/groupCommentsGlobally.d.ts.map +1 -0
  104. package/dist/components/CommentsPanel/utils/groupCommentsGlobally.js +58 -0
  105. package/dist/components/CommentsPanel/utils/groupCommentsGlobally.js.map +1 -0
  106. package/dist/components/CommentsPanel/utils/resolveEntityLabel.d.ts +3 -0
  107. package/dist/components/CommentsPanel/utils/resolveEntityLabel.d.ts.map +1 -0
  108. package/dist/components/CommentsPanel/utils/resolveEntityLabel.js +14 -0
  109. package/dist/components/CommentsPanel/utils/resolveEntityLabel.js.map +1 -0
  110. package/dist/components/CommentsPanel/utils/resolveFieldLabel.d.ts +11 -0
  111. package/dist/components/CommentsPanel/utils/resolveFieldLabel.d.ts.map +1 -0
  112. package/dist/components/CommentsPanel/utils/resolveFieldLabel.js +9 -0
  113. package/dist/components/CommentsPanel/utils/resolveFieldLabel.js.map +1 -0
  114. package/dist/components/CommentsPanel/utils/sortGroupsByCreatedAt.d.ts +4 -0
  115. package/dist/components/CommentsPanel/utils/sortGroupsByCreatedAt.d.ts.map +1 -0
  116. package/dist/components/CommentsPanel/utils/sortGroupsByCreatedAt.js +11 -0
  117. package/dist/components/CommentsPanel/utils/sortGroupsByCreatedAt.js.map +1 -0
  118. package/dist/components/FieldCommentLabel/AddCommentPopup.d.ts +8 -0
  119. package/dist/components/FieldCommentLabel/AddCommentPopup.d.ts.map +1 -0
  120. package/dist/components/FieldCommentLabel/AddCommentPopup.js +50 -0
  121. package/dist/components/FieldCommentLabel/AddCommentPopup.js.map +1 -0
  122. package/dist/components/FieldCommentLabel/hooks/useStablePath.d.ts +2 -0
  123. package/dist/components/FieldCommentLabel/hooks/useStablePath.d.ts.map +1 -0
  124. package/dist/components/FieldCommentLabel/hooks/useStablePath.js +12 -0
  125. package/dist/components/FieldCommentLabel/hooks/useStablePath.js.map +1 -0
  126. package/dist/components/FieldCommentLabel/index.d.ts +11 -0
  127. package/dist/components/FieldCommentLabel/index.d.ts.map +1 -0
  128. package/dist/components/FieldCommentLabel/index.js +64 -0
  129. package/dist/components/FieldCommentLabel/index.js.map +1 -0
  130. package/dist/components/FieldCommentLabel/types.d.ts +4 -0
  131. package/dist/components/FieldCommentLabel/types.d.ts.map +1 -0
  132. package/dist/components/FieldCommentLabel/types.js +1 -0
  133. package/dist/components/FieldCommentLabel/types.js.map +1 -0
  134. package/dist/components/FieldCommentLabel/utils/buildStablePath.d.ts +2 -0
  135. package/dist/components/FieldCommentLabel/utils/buildStablePath.d.ts.map +1 -0
  136. package/dist/components/FieldCommentLabel/utils/buildStablePath.js +19 -0
  137. package/dist/components/FieldCommentLabel/utils/buildStablePath.js.map +1 -0
  138. package/dist/components/FieldCommentLabel/utils/exludeComments.d.ts +3 -0
  139. package/dist/components/FieldCommentLabel/utils/exludeComments.d.ts.map +1 -0
  140. package/dist/components/FieldCommentLabel/utils/exludeComments.js +12 -0
  141. package/dist/components/FieldCommentLabel/utils/exludeComments.js.map +1 -0
  142. package/dist/components/FieldCommentLabel/utils/resolveLabel.d.ts +3 -0
  143. package/dist/components/FieldCommentLabel/utils/resolveLabel.d.ts.map +1 -0
  144. package/dist/components/FieldCommentLabel/utils/resolveLabel.js +9 -0
  145. package/dist/components/FieldCommentLabel/utils/resolveLabel.js.map +1 -0
  146. package/dist/components/IconButton/index.d.ts +12 -0
  147. package/dist/components/IconButton/index.d.ts.map +1 -0
  148. package/dist/components/IconButton/index.js +38 -0
  149. package/dist/components/IconButton/index.js.map +1 -0
  150. package/dist/components/MentionDropdown.d.ts +11 -0
  151. package/dist/components/MentionDropdown.d.ts.map +1 -0
  152. package/dist/components/MentionDropdown.js +53 -0
  153. package/dist/components/MentionDropdown.js.map +1 -0
  154. package/dist/components/MentionLabel/index.d.ts +7 -0
  155. package/dist/components/MentionLabel/index.d.ts.map +1 -0
  156. package/dist/components/MentionLabel/index.js +21 -0
  157. package/dist/components/MentionLabel/index.js.map +1 -0
  158. package/dist/config.d.ts +4 -0
  159. package/dist/config.d.ts.map +1 -0
  160. package/dist/config.js +17 -0
  161. package/dist/config.js.map +1 -0
  162. package/dist/constants.d.ts +9 -0
  163. package/dist/constants.d.ts.map +1 -0
  164. package/dist/constants.js +22 -0
  165. package/dist/constants.js.map +1 -0
  166. package/dist/hooks/useRelativeDate.d.ts +2 -0
  167. package/dist/hooks/useRelativeDate.d.ts.map +1 -0
  168. package/dist/hooks/useRelativeDate.js +11 -0
  169. package/dist/hooks/useRelativeDate.js.map +1 -0
  170. package/dist/index.d.ts +5 -0
  171. package/dist/index.d.ts.map +1 -0
  172. package/dist/index.js +7 -0
  173. package/dist/index.js.map +1 -0
  174. package/dist/plugin.d.ts +4 -0
  175. package/dist/plugin.d.ts.map +1 -0
  176. package/dist/plugin.js +60 -0
  177. package/dist/plugin.js.map +1 -0
  178. package/dist/providers/CommentsDrawerProvider/index.d.ts +14 -0
  179. package/dist/providers/CommentsDrawerProvider/index.d.ts.map +1 -0
  180. package/dist/providers/CommentsDrawerProvider/index.js +28 -0
  181. package/dist/providers/CommentsDrawerProvider/index.js.map +1 -0
  182. package/dist/providers/CommentsProvider/index.d.ts +39 -0
  183. package/dist/providers/CommentsProvider/index.d.ts.map +1 -0
  184. package/dist/providers/CommentsProvider/index.js +237 -0
  185. package/dist/providers/CommentsProvider/index.js.map +1 -0
  186. package/dist/providers/CommentsProvider/mergeDocumentTitles.d.ts +3 -0
  187. package/dist/providers/CommentsProvider/mergeDocumentTitles.d.ts.map +1 -0
  188. package/dist/providers/CommentsProvider/mergeDocumentTitles.js +10 -0
  189. package/dist/providers/CommentsProvider/mergeDocumentTitles.js.map +1 -0
  190. package/dist/providers/CommentsProviderWrapper/index.d.ts +7 -0
  191. package/dist/providers/CommentsProviderWrapper/index.d.ts.map +1 -0
  192. package/dist/providers/CommentsProviderWrapper/index.js +16 -0
  193. package/dist/providers/CommentsProviderWrapper/index.js.map +1 -0
  194. package/dist/providers/GlobalCommentsLoader/GlobalCommentsHydrator.d.ts +13 -0
  195. package/dist/providers/GlobalCommentsLoader/GlobalCommentsHydrator.d.ts.map +1 -0
  196. package/dist/providers/GlobalCommentsLoader/GlobalCommentsHydrator.js +22 -0
  197. package/dist/providers/GlobalCommentsLoader/GlobalCommentsHydrator.js.map +1 -0
  198. package/dist/providers/GlobalCommentsLoader/index.d.ts +10 -0
  199. package/dist/providers/GlobalCommentsLoader/index.d.ts.map +1 -0
  200. package/dist/providers/GlobalCommentsLoader/index.js +31 -0
  201. package/dist/providers/GlobalCommentsLoader/index.js.map +1 -0
  202. package/dist/services/createComment.d.ts +12 -0
  203. package/dist/services/createComment.d.ts.map +1 -0
  204. package/dist/services/createComment.js +83 -0
  205. package/dist/services/createComment.js.map +1 -0
  206. package/dist/services/deleteComment.d.ts +3 -0
  207. package/dist/services/deleteComment.d.ts.map +1 -0
  208. package/dist/services/deleteComment.js +34 -0
  209. package/dist/services/deleteComment.js.map +1 -0
  210. package/dist/services/fetchMentionableUsers.d.ts +3 -0
  211. package/dist/services/fetchMentionableUsers.d.ts.map +1 -0
  212. package/dist/services/fetchMentionableUsers.js +46 -0
  213. package/dist/services/fetchMentionableUsers.js.map +1 -0
  214. package/dist/services/fieldLabels/fetchFieldLabels.d.ts +3 -0
  215. package/dist/services/fieldLabels/fetchFieldLabels.d.ts.map +1 -0
  216. package/dist/services/fieldLabels/fetchFieldLabels.js +74 -0
  217. package/dist/services/fieldLabels/fetchFieldLabels.js.map +1 -0
  218. package/dist/services/fieldLabels/utils/groupFieldPathsByDocument.d.ts +5 -0
  219. package/dist/services/fieldLabels/utils/groupFieldPathsByDocument.d.ts.map +1 -0
  220. package/dist/services/fieldLabels/utils/groupFieldPathsByDocument.js +21 -0
  221. package/dist/services/fieldLabels/utils/groupFieldPathsByDocument.js.map +1 -0
  222. package/dist/services/fieldLabels/utils/resolveFieldPath.d.ts +4 -0
  223. package/dist/services/fieldLabels/utils/resolveFieldPath.d.ts.map +1 -0
  224. package/dist/services/fieldLabels/utils/resolveFieldPath.js +66 -0
  225. package/dist/services/fieldLabels/utils/resolveFieldPath.js.map +1 -0
  226. package/dist/services/fieldLabels/utils/schemaUtils.d.ts +6 -0
  227. package/dist/services/fieldLabels/utils/schemaUtils.d.ts.map +1 -0
  228. package/dist/services/fieldLabels/utils/schemaUtils.js +60 -0
  229. package/dist/services/fieldLabels/utils/schemaUtils.js.map +1 -0
  230. package/dist/services/findAllComments.d.ts +11 -0
  231. package/dist/services/findAllComments.d.ts.map +1 -0
  232. package/dist/services/findAllComments.js +47 -0
  233. package/dist/services/findAllComments.js.map +1 -0
  234. package/dist/services/getCurrentTenantId.d.ts +3 -0
  235. package/dist/services/getCurrentTenantId.d.ts.map +1 -0
  236. package/dist/services/getCurrentTenantId.js +13 -0
  237. package/dist/services/getCurrentTenantId.js.map +1 -0
  238. package/dist/services/getDocumentTitles.d.ts +3 -0
  239. package/dist/services/getDocumentTitles.d.ts.map +1 -0
  240. package/dist/services/getDocumentTitles.js +61 -0
  241. package/dist/services/getDocumentTitles.js.map +1 -0
  242. package/dist/services/getEntitiesLabels.d.ts +3 -0
  243. package/dist/services/getEntitiesLabels.d.ts.map +1 -0
  244. package/dist/services/getEntitiesLabels.js +14 -0
  245. package/dist/services/getEntitiesLabels.js.map +1 -0
  246. package/dist/services/resolveComment.d.ts +3 -0
  247. package/dist/services/resolveComment.d.ts.map +1 -0
  248. package/dist/services/resolveComment.js +41 -0
  249. package/dist/services/resolveComment.js.map +1 -0
  250. package/dist/services/sendMentionEmails.d.ts +11 -0
  251. package/dist/services/sendMentionEmails.d.ts.map +1 -0
  252. package/dist/services/sendMentionEmails.js +73 -0
  253. package/dist/services/sendMentionEmails.js.map +1 -0
  254. package/dist/services/syncAllCommentsData.d.ts +12 -0
  255. package/dist/services/syncAllCommentsData.d.ts.map +1 -0
  256. package/dist/services/syncAllCommentsData.js +48 -0
  257. package/dist/services/syncAllCommentsData.js.map +1 -0
  258. package/dist/styles.css +2 -0
  259. package/dist/translations/en.d.ts +5 -0
  260. package/dist/translations/en.d.ts.map +1 -0
  261. package/dist/translations/en.js +36 -0
  262. package/dist/translations/en.js.map +1 -0
  263. package/dist/translations/types.d.ts +32 -0
  264. package/dist/translations/types.d.ts.map +1 -0
  265. package/dist/translations/types.js +1 -0
  266. package/dist/translations/types.js.map +1 -0
  267. package/dist/types/base.d.ts +10 -0
  268. package/dist/types/base.d.ts.map +1 -0
  269. package/dist/types/base.js +1 -0
  270. package/dist/types/base.js.map +1 -0
  271. package/dist/types/collection.d.ts +2 -0
  272. package/dist/types/collection.d.ts.map +1 -0
  273. package/dist/types/collection.js +1 -0
  274. package/dist/types/collection.js.map +1 -0
  275. package/dist/types/comment.d.ts +23 -0
  276. package/dist/types/comment.d.ts.map +1 -0
  277. package/dist/types/comment.js +1 -0
  278. package/dist/types/comment.js.map +1 -0
  279. package/dist/types/config.d.ts +112 -0
  280. package/dist/types/config.d.ts.map +1 -0
  281. package/dist/types/config.js +1 -0
  282. package/dist/types/config.js.map +1 -0
  283. package/dist/types/entity.d.ts +15 -0
  284. package/dist/types/entity.d.ts.map +1 -0
  285. package/dist/types/entity.js +1 -0
  286. package/dist/types/entity.js.map +1 -0
  287. package/dist/types/general.d.ts +10 -0
  288. package/dist/types/general.d.ts.map +1 -0
  289. package/dist/types/general.js +1 -0
  290. package/dist/types/general.js.map +1 -0
  291. package/dist/types/index.d.ts +8 -0
  292. package/dist/types/index.d.ts.map +1 -0
  293. package/dist/types/index.js +1 -0
  294. package/dist/types/index.js.map +1 -0
  295. package/dist/types/user.d.ts +6 -0
  296. package/dist/types/user.d.ts.map +1 -0
  297. package/dist/types/user.js +1 -0
  298. package/dist/types/user.js.map +1 -0
  299. package/dist/utils/comment/extractVisibleComments.d.ts +13 -0
  300. package/dist/utils/comment/extractVisibleComments.d.ts.map +1 -0
  301. package/dist/utils/comment/extractVisibleComments.js +17 -0
  302. package/dist/utils/comment/extractVisibleComments.js.map +1 -0
  303. package/dist/utils/comment/filterCommentsByLocale.d.ts +3 -0
  304. package/dist/utils/comment/filterCommentsByLocale.d.ts.map +1 -0
  305. package/dist/utils/comment/filterCommentsByLocale.js +12 -0
  306. package/dist/utils/comment/filterCommentsByLocale.js.map +1 -0
  307. package/dist/utils/comment/renderCommentText.d.ts +12 -0
  308. package/dist/utils/comment/renderCommentText.d.ts.map +1 -0
  309. package/dist/utils/comment/renderCommentText.js +38 -0
  310. package/dist/utils/comment/renderCommentText.js.map +1 -0
  311. package/dist/utils/comment/serializeEditor.d.ts +2 -0
  312. package/dist/utils/comment/serializeEditor.d.ts.map +1 -0
  313. package/dist/utils/comment/serializeEditor.js +30 -0
  314. package/dist/utils/comment/serializeEditor.js.map +1 -0
  315. package/dist/utils/config/injectFieldCommentComponents.d.ts +4 -0
  316. package/dist/utils/config/injectFieldCommentComponents.d.ts.map +1 -0
  317. package/dist/utils/config/injectFieldCommentComponents.js +80 -0
  318. package/dist/utils/config/injectFieldCommentComponents.js.map +1 -0
  319. package/dist/utils/config/mergeTranslations.d.ts +3 -0
  320. package/dist/utils/config/mergeTranslations.d.ts.map +1 -0
  321. package/dist/utils/config/mergeTranslations.js +29 -0
  322. package/dist/utils/config/mergeTranslations.js.map +1 -0
  323. package/dist/utils/config/normalizeCollections.d.ts +7 -0
  324. package/dist/utils/config/normalizeCollections.d.ts.map +1 -0
  325. package/dist/utils/config/normalizeCollections.js +15 -0
  326. package/dist/utils/config/normalizeCollections.js.map +1 -0
  327. package/dist/utils/config/overrideCollections.d.ts +3 -0
  328. package/dist/utils/config/overrideCollections.d.ts.map +1 -0
  329. package/dist/utils/config/overrideCollections.js +38 -0
  330. package/dist/utils/config/overrideCollections.js.map +1 -0
  331. package/dist/utils/config/overrideCommentsCollection.d.ts +4 -0
  332. package/dist/utils/config/overrideCommentsCollection.d.ts.map +1 -0
  333. package/dist/utils/config/overrideCommentsCollection.js +14 -0
  334. package/dist/utils/config/overrideCommentsCollection.js.map +1 -0
  335. package/dist/utils/config/overrideGlobals.d.ts +3 -0
  336. package/dist/utils/config/overrideGlobals.d.ts.map +1 -0
  337. package/dist/utils/config/overrideGlobals.js +8 -0
  338. package/dist/utils/config/overrideGlobals.js.map +1 -0
  339. package/dist/utils/error/getDefaultErrorMessage.d.ts +2 -0
  340. package/dist/utils/error/getDefaultErrorMessage.d.ts.map +1 -0
  341. package/dist/utils/error/getDefaultErrorMessage.js +9 -0
  342. package/dist/utils/error/getDefaultErrorMessage.js.map +1 -0
  343. package/dist/utils/general/cn.d.ts +3 -0
  344. package/dist/utils/general/cn.d.ts.map +1 -0
  345. package/dist/utils/general/cn.js +9 -0
  346. package/dist/utils/general/cn.js.map +1 -0
  347. package/dist/utils/general/formatRelativeDate.d.ts +2 -0
  348. package/dist/utils/general/formatRelativeDate.d.ts.map +1 -0
  349. package/dist/utils/general/formatRelativeDate.js +28 -0
  350. package/dist/utils/general/formatRelativeDate.js.map +1 -0
  351. package/dist/utils/general/getURL.d.ts +2 -0
  352. package/dist/utils/general/getURL.d.ts.map +1 -0
  353. package/dist/utils/general/getURL.js +13 -0
  354. package/dist/utils/general/getURL.js.map +1 -0
  355. package/dist/utils/general/getValueByPath.d.ts +4 -0
  356. package/dist/utils/general/getValueByPath.d.ts.map +1 -0
  357. package/dist/utils/general/getValueByPath.js +19 -0
  358. package/dist/utils/general/getValueByPath.js.map +1 -0
  359. package/dist/utils/mention/isSelfMention.d.ts +4 -0
  360. package/dist/utils/mention/isSelfMention.d.ts.map +1 -0
  361. package/dist/utils/mention/isSelfMention.js +7 -0
  362. package/dist/utils/mention/isSelfMention.js.map +1 -0
  363. package/dist/utils/mention/parseMentionIds.d.ts +2 -0
  364. package/dist/utils/mention/parseMentionIds.d.ts.map +1 -0
  365. package/dist/utils/mention/parseMentionIds.js +13 -0
  366. package/dist/utils/mention/parseMentionIds.js.map +1 -0
  367. package/dist/utils/mode/defineModeByPathname.d.ts +11 -0
  368. package/dist/utils/mode/defineModeByPathname.d.ts.map +1 -0
  369. package/dist/utils/mode/defineModeByPathname.js +39 -0
  370. package/dist/utils/mode/defineModeByPathname.js.map +1 -0
  371. package/dist/utils/path/detectPluginBasePath.d.ts +2 -0
  372. package/dist/utils/path/detectPluginBasePath.d.ts.map +1 -0
  373. package/dist/utils/path/detectPluginBasePath.js +8 -0
  374. package/dist/utils/path/detectPluginBasePath.js.map +1 -0
  375. package/dist/utils/path/getComponentPath.d.ts +15 -0
  376. package/dist/utils/path/getComponentPath.d.ts.map +1 -0
  377. package/dist/utils/path/getComponentPath.js +22 -0
  378. package/dist/utils/path/getComponentPath.js.map +1 -0
  379. package/dist/utils/payload/extractPayload.d.ts +3 -0
  380. package/dist/utils/payload/extractPayload.d.ts.map +1 -0
  381. package/dist/utils/payload/extractPayload.js +9 -0
  382. package/dist/utils/payload/extractPayload.js.map +1 -0
  383. package/dist/utils/user/resolveUsername.d.ts +4 -0
  384. package/dist/utils/user/resolveUsername.d.ts.map +1 -0
  385. package/dist/utils/user/resolveUsername.js +14 -0
  386. package/dist/utils/user/resolveUsername.js.map +1 -0
  387. package/package.json +113 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"user.d.ts","sourceRoot":"","sources":["../../src/types/user.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,IAAI;IACnB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB"}
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=user.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,13 @@
1
+ import type { Comment, Mode } from "../../types";
2
+ import type { CollectionSlug } from "payload";
3
+ interface Props {
4
+ comments: Comment[];
5
+ mode: Mode;
6
+ collectionSlug?: CollectionSlug | null;
7
+ documentId?: number | null;
8
+ globalSlug?: string | null;
9
+ currentLocale?: string | null;
10
+ }
11
+ export declare function extractVisibleComments({ comments, mode, collectionSlug, documentId, globalSlug, currentLocale }: Props): Comment[];
12
+ export {};
13
+ //# sourceMappingURL=extractVisibleComments.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extractVisibleComments.d.ts","sourceRoot":"","sources":["../../../src/utils/comment/extractVisibleComments.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAG9C,UAAU,KAAK;IACb,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,IAAI,EAAE,IAAI,CAAC;IACX,cAAc,CAAC,EAAE,cAAc,GAAG,IAAI,CAAC;IACvC,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC/B;AAED,wBAAgB,sBAAsB,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,cAAc,EAAE,UAAU,EAAE,UAAU,EAAE,aAAa,EAAE,EAAE,KAAK,aActH"}
@@ -0,0 +1,17 @@
1
+ import { filterCommentsByLocale } from "./filterCommentsByLocale";
2
+ function extractVisibleComments({ comments, mode, collectionSlug, documentId, globalSlug, currentLocale }) {
3
+ const localeFilteredComments = filterCommentsByLocale(comments, currentLocale);
4
+ if (mode === "document" && collectionSlug && documentId) {
5
+ return localeFilteredComments.filter(
6
+ ({ collectionSlug: slug, documentId: id }) => slug === collectionSlug && id === documentId
7
+ );
8
+ }
9
+ if (mode === "global-document" && globalSlug) {
10
+ return localeFilteredComments.filter((c) => c.globalSlug === globalSlug);
11
+ }
12
+ return localeFilteredComments;
13
+ }
14
+ export {
15
+ extractVisibleComments
16
+ };
17
+ //# sourceMappingURL=extractVisibleComments.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/utils/comment/extractVisibleComments.ts"],"sourcesContent":["import type { Comment, Mode } from \"../../types\";\nimport type { CollectionSlug } from \"payload\";\nimport { filterCommentsByLocale } from \"./filterCommentsByLocale\";\n\ninterface Props {\n comments: Comment[];\n mode: Mode;\n collectionSlug?: CollectionSlug | null;\n documentId?: number | null;\n globalSlug?: string | null;\n currentLocale?: string | null;\n}\n\nexport function extractVisibleComments({ comments, mode, collectionSlug, documentId, globalSlug, currentLocale }: Props) {\n const localeFilteredComments = filterCommentsByLocale(comments, currentLocale);\n\n if (mode === \"document\" && collectionSlug && documentId) {\n return localeFilteredComments.filter(\n ({ collectionSlug: slug, documentId: id }) => slug === collectionSlug && id === documentId,\n );\n }\n\n if (mode === \"global-document\" && globalSlug) {\n return localeFilteredComments.filter((c) => c.globalSlug === globalSlug);\n }\n\n return localeFilteredComments;\n}\n"],"mappings":"AAEA,SAAS,8BAA8B;AAWhC,SAAS,uBAAuB,EAAE,UAAU,MAAM,gBAAgB,YAAY,YAAY,cAAc,GAAU;AACvH,QAAM,yBAAyB,uBAAuB,UAAU,aAAa;AAE7E,MAAI,SAAS,cAAc,kBAAkB,YAAY;AACvD,WAAO,uBAAuB;AAAA,MAC5B,CAAC,EAAE,gBAAgB,MAAM,YAAY,GAAG,MAAM,SAAS,kBAAkB,OAAO;AAAA,IAClF;AAAA,EACF;AAEA,MAAI,SAAS,qBAAqB,YAAY;AAC5C,WAAO,uBAAuB,OAAO,CAAC,MAAM,EAAE,eAAe,UAAU;AAAA,EACzE;AAEA,SAAO;AACT;","names":[]}
@@ -0,0 +1,3 @@
1
+ import type { Comment } from "../../types";
2
+ export declare function filterCommentsByLocale(comments: Comment[], currentLocale?: string | null): Comment[];
3
+ //# sourceMappingURL=filterCommentsByLocale.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"filterCommentsByLocale.d.ts","sourceRoot":"","sources":["../../../src/utils/comment/filterCommentsByLocale.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAU3C,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,OAAO,EAAE,EAAE,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,aAExF"}
@@ -0,0 +1,12 @@
1
+ function matchesLocale(comment, currentLocale) {
2
+ if (!comment.fieldPath) return true;
3
+ if (!comment.locale) return true;
4
+ return comment.locale === currentLocale;
5
+ }
6
+ function filterCommentsByLocale(comments, currentLocale) {
7
+ return comments.filter((c) => matchesLocale(c, currentLocale));
8
+ }
9
+ export {
10
+ filterCommentsByLocale
11
+ };
12
+ //# sourceMappingURL=filterCommentsByLocale.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/utils/comment/filterCommentsByLocale.ts"],"sourcesContent":["import type { Comment } from \"../../types\";\n\nfunction matchesLocale(comment: Comment, currentLocale?: string | null) {\n if (!comment.fieldPath) return true;\n\n if (!comment.locale) return true;\n\n return comment.locale === currentLocale;\n}\n\nexport function filterCommentsByLocale(comments: Comment[], currentLocale?: string | null) {\n return comments.filter((c) => matchesLocale(c, currentLocale));\n}\n"],"mappings":"AAEA,SAAS,cAAc,SAAkB,eAA+B;AACtE,MAAI,CAAC,QAAQ,UAAW,QAAO;AAE/B,MAAI,CAAC,QAAQ,OAAQ,QAAO;AAE5B,SAAO,QAAQ,WAAW;AAC5B;AAEO,SAAS,uBAAuB,UAAqB,eAA+B;AACzF,SAAO,SAAS,OAAO,CAAC,MAAM,cAAc,GAAG,aAAa,CAAC;AAC/D;","names":[]}
@@ -0,0 +1,12 @@
1
+ import type { ReactNode } from "react";
2
+ import type { Comment } from "../../types";
3
+ interface Props {
4
+ text: string;
5
+ mentions: Comment["mentions"];
6
+ currentUserId?: number | null;
7
+ usernameFieldPath?: string;
8
+ fallbackDeletedUsername?: string;
9
+ }
10
+ export declare function renderCommentText({ text, mentions, currentUserId, usernameFieldPath, fallbackDeletedUsername, }: Props): ReactNode;
11
+ export {};
12
+ //# sourceMappingURL=renderCommentText.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"renderCommentText.d.ts","sourceRoot":"","sources":["../../../src/utils/comment/renderCommentText.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,OAAO,EAAQ,MAAM,aAAa,CAAC;AASjD,UAAU,KAAK;IACb,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC;IAC9B,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,uBAAuB,CAAC,EAAE,MAAM,CAAC;CAClC;AAED,wBAAgB,iBAAiB,CAAC,EAChC,IAAI,EACJ,QAAQ,EACR,aAAa,EACb,iBAAiB,EACjB,uBAAuB,GACxB,EAAE,KAAK,GAAG,SAAS,CA+BnB"}
@@ -0,0 +1,38 @@
1
+ import { Fragment, jsx } from "react/jsx-runtime";
2
+ import { MentionLabel } from "../../components/MentionLabel";
3
+ import { isSelfMention } from "../mention/isSelfMention";
4
+ import { resolveUsername } from "../user/resolveUsername";
5
+ import { FALLBACK_DELETED_USERNAME } from "../../constants";
6
+ const MENTION_SPLIT = /(@\(\d+\))/;
7
+ const MENTION_EXTRACT = /^@\((\d+)\)$/;
8
+ function renderCommentText({
9
+ text,
10
+ mentions,
11
+ currentUserId,
12
+ usernameFieldPath,
13
+ fallbackDeletedUsername
14
+ }) {
15
+ const userMap = {};
16
+ if (Array.isArray(mentions)) {
17
+ for (const mention of mentions) {
18
+ const user = mention.user;
19
+ userMap[user.id] = user;
20
+ }
21
+ }
22
+ const parts = text.split(MENTION_SPLIT);
23
+ return /* @__PURE__ */ jsx(Fragment, { children: parts.map((part, i) => {
24
+ const match = MENTION_EXTRACT.exec(part);
25
+ if (match) {
26
+ const userId = Number(match[1]);
27
+ const user = userMap[userId];
28
+ const isSelf = isSelfMention(currentUserId, userId);
29
+ const name = resolveUsername(user, usernameFieldPath, fallbackDeletedUsername ?? FALLBACK_DELETED_USERNAME);
30
+ return /* @__PURE__ */ jsx(MentionLabel, { name, isSelf }, i);
31
+ }
32
+ return /* @__PURE__ */ jsx("span", { children: part }, i);
33
+ }) });
34
+ }
35
+ export {
36
+ renderCommentText
37
+ };
38
+ //# sourceMappingURL=renderCommentText.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/utils/comment/renderCommentText.tsx"],"sourcesContent":["import type { ReactNode } from \"react\";\nimport type { Comment, User } from \"../../types\";\nimport { MentionLabel } from \"../../components/MentionLabel\";\nimport { isSelfMention } from \"../mention/isSelfMention\";\nimport { resolveUsername } from \"../user/resolveUsername\";\nimport { FALLBACK_DELETED_USERNAME } from \"../../constants\";\n\nconst MENTION_SPLIT = /(@\\(\\d+\\))/;\nconst MENTION_EXTRACT = /^@\\((\\d+)\\)$/;\n\ninterface Props {\n text: string;\n mentions: Comment[\"mentions\"];\n currentUserId?: number | null;\n usernameFieldPath?: string;\n fallbackDeletedUsername?: string;\n}\n\nexport function renderCommentText({\n text,\n mentions,\n currentUserId,\n usernameFieldPath,\n fallbackDeletedUsername,\n}: Props): ReactNode {\n const userMap: Record<number, User> = {};\n\n if (Array.isArray(mentions)) {\n for (const mention of mentions) {\n const user = mention.user as User;\n\n userMap[user.id] = user;\n }\n }\n\n const parts = text.split(MENTION_SPLIT);\n\n return (\n <>\n {parts.map((part, i) => {\n const match = MENTION_EXTRACT.exec(part);\n\n if (match) {\n const userId = Number(match[1]);\n const user = userMap[userId];\n const isSelf = isSelfMention(currentUserId, userId);\n const name = resolveUsername(user, usernameFieldPath, fallbackDeletedUsername ?? FALLBACK_DELETED_USERNAME);\n\n return <MentionLabel key={i} name={name} isSelf={isSelf} />;\n }\n\n return <span key={i}>{part}</span>;\n })}\n </>\n );\n}\n"],"mappings":"AAsCI,mBAUa,WAVb;AApCJ,SAAS,oBAAoB;AAC7B,SAAS,qBAAqB;AAC9B,SAAS,uBAAuB;AAChC,SAAS,iCAAiC;AAE1C,MAAM,gBAAgB;AACtB,MAAM,kBAAkB;AAUjB,SAAS,kBAAkB;AAAA,EAChC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAAqB;AACnB,QAAM,UAAgC,CAAC;AAEvC,MAAI,MAAM,QAAQ,QAAQ,GAAG;AAC3B,eAAW,WAAW,UAAU;AAC9B,YAAM,OAAO,QAAQ;AAErB,cAAQ,KAAK,EAAE,IAAI;AAAA,IACrB;AAAA,EACF;AAEA,QAAM,QAAQ,KAAK,MAAM,aAAa;AAEtC,SACE,gCACG,gBAAM,IAAI,CAAC,MAAM,MAAM;AACtB,UAAM,QAAQ,gBAAgB,KAAK,IAAI;AAEvC,QAAI,OAAO;AACT,YAAM,SAAS,OAAO,MAAM,CAAC,CAAC;AAC9B,YAAM,OAAO,QAAQ,MAAM;AAC3B,YAAM,SAAS,cAAc,eAAe,MAAM;AAClD,YAAM,OAAO,gBAAgB,MAAM,mBAAmB,2BAA2B,yBAAyB;AAE1G,aAAO,oBAAC,gBAAqB,MAAY,UAAf,CAA+B;AAAA,IAC3D;AAEA,WAAO,oBAAC,UAAc,kBAAJ,CAAS;AAAA,EAC7B,CAAC,GACH;AAEJ;","names":[]}
@@ -0,0 +1,2 @@
1
+ export declare function serializeEditor(root: HTMLElement): string;
2
+ //# sourceMappingURL=serializeEditor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"serializeEditor.d.ts","sourceRoot":"","sources":["../../../src/utils/comment/serializeEditor.ts"],"names":[],"mappings":"AA2BA,wBAAgB,eAAe,CAAC,IAAI,EAAE,WAAW,GAAG,MAAM,CAQzD"}
@@ -0,0 +1,30 @@
1
+ const ZERO_WIDTH_SPACE = /\u200b/g;
2
+ function serializeNode(node, output) {
3
+ if (node.nodeType === Node.TEXT_NODE) {
4
+ const text = (node.textContent ?? "").replace(ZERO_WIDTH_SPACE, "");
5
+ output.push(text);
6
+ return;
7
+ }
8
+ if (node.nodeType === Node.ELEMENT_NODE) {
9
+ const element = node;
10
+ const mentionId = element.dataset.mentionId;
11
+ if (mentionId !== void 0) {
12
+ output.push(`@(${mentionId})`);
13
+ return;
14
+ }
15
+ for (const child of Array.from(element.childNodes)) {
16
+ serializeNode(child, output);
17
+ }
18
+ }
19
+ }
20
+ function serializeEditor(root) {
21
+ const parts = [];
22
+ for (const child of Array.from(root.childNodes)) {
23
+ serializeNode(child, parts);
24
+ }
25
+ return parts.join("");
26
+ }
27
+ export {
28
+ serializeEditor
29
+ };
30
+ //# sourceMappingURL=serializeEditor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/utils/comment/serializeEditor.ts"],"sourcesContent":["const ZERO_WIDTH_SPACE = /\\u200b/g;\n\nfunction serializeNode(node: ChildNode, output: string[]): void {\n if (node.nodeType === Node.TEXT_NODE) {\n const text = (node.textContent ?? \"\").replace(ZERO_WIDTH_SPACE, \"\");\n\n output.push(text);\n\n return;\n }\n\n if (node.nodeType === Node.ELEMENT_NODE) {\n const element = node as HTMLElement;\n const mentionId = element.dataset.mentionId;\n\n if (mentionId !== undefined) {\n output.push(`@(${mentionId})`);\n\n return;\n }\n\n for (const child of Array.from(element.childNodes)) {\n serializeNode(child, output);\n }\n }\n}\n\nexport function serializeEditor(root: HTMLElement): string {\n const parts: string[] = [];\n\n for (const child of Array.from(root.childNodes)) {\n serializeNode(child, parts);\n }\n\n return parts.join(\"\");\n}\n"],"mappings":"AAAA,MAAM,mBAAmB;AAEzB,SAAS,cAAc,MAAiB,QAAwB;AAC9D,MAAI,KAAK,aAAa,KAAK,WAAW;AACpC,UAAM,QAAQ,KAAK,eAAe,IAAI,QAAQ,kBAAkB,EAAE;AAElE,WAAO,KAAK,IAAI;AAEhB;AAAA,EACF;AAEA,MAAI,KAAK,aAAa,KAAK,cAAc;AACvC,UAAM,UAAU;AAChB,UAAM,YAAY,QAAQ,QAAQ;AAElC,QAAI,cAAc,QAAW;AAC3B,aAAO,KAAK,KAAK,SAAS,GAAG;AAE7B;AAAA,IACF;AAEA,eAAW,SAAS,MAAM,KAAK,QAAQ,UAAU,GAAG;AAClD,oBAAc,OAAO,MAAM;AAAA,IAC7B;AAAA,EACF;AACF;AAEO,SAAS,gBAAgB,MAA2B;AACzD,QAAM,QAAkB,CAAC;AAEzB,aAAW,SAAS,MAAM,KAAK,KAAK,UAAU,GAAG;AAC/C,kBAAc,OAAO,KAAK;AAAA,EAC5B;AAEA,SAAO,MAAM,KAAK,EAAE;AACtB;","names":[]}
@@ -0,0 +1,4 @@
1
+ import type { CollectionConfig, GlobalConfig } from "payload";
2
+ export type EntityConfig = CollectionConfig | GlobalConfig;
3
+ export declare function injectFieldCommentComponents<T extends EntityConfig>(entity: T): T;
4
+ //# sourceMappingURL=injectFieldCommentComponents.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"injectFieldCommentComponents.d.ts","sourceRoot":"","sources":["../../../src/utils/config/injectFieldCommentComponents.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAS,YAAY,EAAE,MAAM,SAAS,CAAC;AAGrE,MAAM,MAAM,YAAY,GAAG,gBAAgB,GAAG,YAAY,CAAC;AAsF3D,wBAAgB,4BAA4B,CAAC,CAAC,SAAS,YAAY,EAAE,MAAM,EAAE,CAAC,GAAG,CAAC,CAKjF"}
@@ -0,0 +1,80 @@
1
+ import { getComponentConfig } from "../path/getComponentPath";
2
+ const LABELED_FIELD_TYPES = /* @__PURE__ */ new Set([
3
+ "text",
4
+ "number",
5
+ "email",
6
+ "textarea",
7
+ "code",
8
+ "date",
9
+ "upload",
10
+ "relationship",
11
+ "select",
12
+ "radio",
13
+ "checkbox",
14
+ "richText",
15
+ "point",
16
+ "json",
17
+ "array",
18
+ "group",
19
+ "blocks"
20
+ ]);
21
+ function buildPath(parentPath, segment) {
22
+ return parentPath ? `${parentPath}.${segment}` : segment;
23
+ }
24
+ function injectIntoField(field, parentPath) {
25
+ if (field.type === "ui") return field;
26
+ const f = field;
27
+ const { name } = f;
28
+ const currentPath = name ? buildPath(parentPath, name) : parentPath;
29
+ let result = { ...f };
30
+ if (Array.isArray(result.fields)) {
31
+ result = { ...result, fields: injectIntoFields(result.fields, currentPath) };
32
+ }
33
+ if (result.type === "tabs" && Array.isArray(result.tabs)) {
34
+ result = {
35
+ ...result,
36
+ tabs: result.tabs.map((tab) => ({
37
+ ...tab,
38
+ fields: injectIntoFields(tab.fields, tab.name ? buildPath(currentPath, tab.name) : currentPath)
39
+ }))
40
+ };
41
+ }
42
+ if (result.type === "blocks" && Array.isArray(result.blocks)) {
43
+ result = {
44
+ ...result,
45
+ blocks: result.blocks.map((block) => ({
46
+ ...block,
47
+ fields: injectIntoFields(block.fields, currentPath)
48
+ }))
49
+ };
50
+ }
51
+ if (name && LABELED_FIELD_TYPES.has(result.type) && !result.admin?.components?.Label) {
52
+ result = {
53
+ ...result,
54
+ admin: {
55
+ ...result.admin,
56
+ components: {
57
+ ...result.admin?.components,
58
+ Label: getComponentConfig({
59
+ componentPath: "components/FieldCommentLabel",
60
+ componentName: "FieldCommentLabel"
61
+ })
62
+ }
63
+ }
64
+ };
65
+ }
66
+ return result;
67
+ }
68
+ function injectIntoFields(fields, parentPath) {
69
+ return fields.map((field) => injectIntoField(field, parentPath));
70
+ }
71
+ function injectFieldCommentComponents(entity) {
72
+ return {
73
+ ...entity,
74
+ fields: injectIntoFields(entity.fields, "")
75
+ };
76
+ }
77
+ export {
78
+ injectFieldCommentComponents
79
+ };
80
+ //# sourceMappingURL=injectFieldCommentComponents.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/utils/config/injectFieldCommentComponents.ts"],"sourcesContent":["import type { CollectionConfig, Field, GlobalConfig } from \"payload\";\nimport { getComponentConfig } from \"../path/getComponentPath\";\n\nexport type EntityConfig = CollectionConfig | GlobalConfig;\n\ntype BaseField = Field & {\n name?: string | null | undefined;\n};\n\nconst LABELED_FIELD_TYPES = new Set([\n \"text\",\n \"number\",\n \"email\",\n \"textarea\",\n \"code\",\n \"date\",\n \"upload\",\n \"relationship\",\n \"select\",\n \"radio\",\n \"checkbox\",\n \"richText\",\n \"point\",\n \"json\",\n \"array\",\n \"group\",\n \"blocks\",\n]);\n\nfunction buildPath(parentPath: string, segment: string): string {\n return parentPath ? `${parentPath}.${segment}` : segment;\n}\n\nfunction injectIntoField(field: Field, parentPath: string): Field {\n if (field.type === \"ui\") return field;\n\n const f = field as BaseField;\n const { name } = f;\n const currentPath = name ? buildPath(parentPath, name) : parentPath;\n\n let result: any = { ...f };\n\n if (Array.isArray(result.fields)) {\n result = { ...result, fields: injectIntoFields(result.fields, currentPath) };\n }\n\n if (result.type === \"tabs\" && Array.isArray(result.tabs)) {\n result = {\n ...result,\n tabs: result.tabs.map((tab: { name?: string; fields: Field[] }) => ({\n ...tab,\n fields: injectIntoFields(tab.fields, tab.name ? buildPath(currentPath, tab.name) : currentPath),\n })),\n };\n }\n\n if (result.type === \"blocks\" && Array.isArray(result.blocks)) {\n result = {\n ...result,\n blocks: result.blocks.map((block: { fields: Field[] }) => ({\n ...block,\n fields: injectIntoFields(block.fields, currentPath),\n })),\n };\n }\n\n if (name && LABELED_FIELD_TYPES.has(result.type) && !result.admin?.components?.Label) {\n result = {\n ...result,\n admin: {\n ...result.admin,\n components: {\n ...result.admin?.components,\n Label: getComponentConfig({\n componentPath: \"components/FieldCommentLabel\",\n componentName: \"FieldCommentLabel\",\n }),\n },\n },\n };\n }\n\n return result as Field;\n}\n\nfunction injectIntoFields(fields: Field[], parentPath: string): Field[] {\n return fields.map((field) => injectIntoField(field, parentPath));\n}\n\nexport function injectFieldCommentComponents<T extends EntityConfig>(entity: T): T {\n return {\n ...entity,\n fields: injectIntoFields(entity.fields, \"\"),\n } as T;\n}\n"],"mappings":"AACA,SAAS,0BAA0B;AAQnC,MAAM,sBAAsB,oBAAI,IAAI;AAAA,EAClC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAED,SAAS,UAAU,YAAoB,SAAyB;AAC9D,SAAO,aAAa,GAAG,UAAU,IAAI,OAAO,KAAK;AACnD;AAEA,SAAS,gBAAgB,OAAc,YAA2B;AAChE,MAAI,MAAM,SAAS,KAAM,QAAO;AAEhC,QAAM,IAAI;AACV,QAAM,EAAE,KAAK,IAAI;AACjB,QAAM,cAAc,OAAO,UAAU,YAAY,IAAI,IAAI;AAEzD,MAAI,SAAc,EAAE,GAAG,EAAE;AAEzB,MAAI,MAAM,QAAQ,OAAO,MAAM,GAAG;AAChC,aAAS,EAAE,GAAG,QAAQ,QAAQ,iBAAiB,OAAO,QAAQ,WAAW,EAAE;AAAA,EAC7E;AAEA,MAAI,OAAO,SAAS,UAAU,MAAM,QAAQ,OAAO,IAAI,GAAG;AACxD,aAAS;AAAA,MACP,GAAG;AAAA,MACH,MAAM,OAAO,KAAK,IAAI,CAAC,SAA6C;AAAA,QAClE,GAAG;AAAA,QACH,QAAQ,iBAAiB,IAAI,QAAQ,IAAI,OAAO,UAAU,aAAa,IAAI,IAAI,IAAI,WAAW;AAAA,MAChG,EAAE;AAAA,IACJ;AAAA,EACF;AAEA,MAAI,OAAO,SAAS,YAAY,MAAM,QAAQ,OAAO,MAAM,GAAG;AAC5D,aAAS;AAAA,MACP,GAAG;AAAA,MACH,QAAQ,OAAO,OAAO,IAAI,CAAC,WAAgC;AAAA,QACzD,GAAG;AAAA,QACH,QAAQ,iBAAiB,MAAM,QAAQ,WAAW;AAAA,MACpD,EAAE;AAAA,IACJ;AAAA,EACF;AAEA,MAAI,QAAQ,oBAAoB,IAAI,OAAO,IAAI,KAAK,CAAC,OAAO,OAAO,YAAY,OAAO;AACpF,aAAS;AAAA,MACP,GAAG;AAAA,MACH,OAAO;AAAA,QACL,GAAG,OAAO;AAAA,QACV,YAAY;AAAA,UACV,GAAG,OAAO,OAAO;AAAA,UACjB,OAAO,mBAAmB;AAAA,YACxB,eAAe;AAAA,YACf,eAAe;AAAA,UACjB,CAAC;AAAA,QACH;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAEA,SAAO;AACT;AAEA,SAAS,iBAAiB,QAAiB,YAA6B;AACtE,SAAO,OAAO,IAAI,CAAC,UAAU,gBAAgB,OAAO,UAAU,CAAC;AACjE;AAEO,SAAS,6BAAqD,QAAc;AACjF,SAAO;AAAA,IACL,GAAG;AAAA,IACH,QAAQ,iBAAiB,OAAO,QAAQ,EAAE;AAAA,EAC5C;AACF;","names":[]}
@@ -0,0 +1,3 @@
1
+ import type { Translations } from "../../translations/types";
2
+ export declare function mergeTranslations(incomingConfigTranslations: Record<string, object>, userTranslations: Translations): Record<string, object>;
3
+ //# sourceMappingURL=mergeTranslations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mergeTranslations.d.ts","sourceRoot":"","sources":["../../../src/utils/config/mergeTranslations.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAE7D,wBAAgB,iBAAiB,CAAC,0BAA0B,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,gBAAgB,EAAE,YAAY,0BA2BnH"}
@@ -0,0 +1,29 @@
1
+ import { en } from "../../translations/en";
2
+ function mergeTranslations(incomingConfigTranslations, userTranslations) {
3
+ const mergedTranslations = {
4
+ ...incomingConfigTranslations,
5
+ en: {
6
+ ...incomingConfigTranslations?.en ?? {},
7
+ comments: {
8
+ ...en.comments,
9
+ ...userTranslations.en ?? {}
10
+ }
11
+ }
12
+ };
13
+ const existingTranslations = incomingConfigTranslations;
14
+ for (const [locale, localeTranslations] of Object.entries(userTranslations)) {
15
+ if (locale === "en") continue;
16
+ mergedTranslations[locale] = {
17
+ ...existingTranslations?.[locale] ?? {},
18
+ comments: {
19
+ ...en.comments,
20
+ ...localeTranslations
21
+ }
22
+ };
23
+ }
24
+ return mergedTranslations;
25
+ }
26
+ export {
27
+ mergeTranslations
28
+ };
29
+ //# sourceMappingURL=mergeTranslations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/utils/config/mergeTranslations.ts"],"sourcesContent":["import { en } from \"../../translations/en\";\nimport type { Translations } from \"../../translations/types\";\n\nexport function mergeTranslations(incomingConfigTranslations: Record<string, object>, userTranslations: Translations) {\n const mergedTranslations: Record<string, object> = {\n ...incomingConfigTranslations,\n en: {\n ...((incomingConfigTranslations?.en as Record<string, object>) ?? {}),\n comments: {\n ...en.comments,\n ...(userTranslations.en ?? {}),\n },\n },\n };\n\n const existingTranslations = incomingConfigTranslations as Record<string, object> | undefined;\n\n for (const [locale, localeTranslations] of Object.entries(userTranslations)) {\n if (locale === \"en\") continue;\n\n mergedTranslations[locale] = {\n ...(existingTranslations?.[locale] ?? {}),\n comments: {\n ...en.comments,\n ...localeTranslations,\n },\n };\n }\n\n return mergedTranslations;\n}\n"],"mappings":"AAAA,SAAS,UAAU;AAGZ,SAAS,kBAAkB,4BAAoD,kBAAgC;AACpH,QAAM,qBAA6C;AAAA,IACjD,GAAG;AAAA,IACH,IAAI;AAAA,MACF,GAAK,4BAA4B,MAAiC,CAAC;AAAA,MACnE,UAAU;AAAA,QACR,GAAG,GAAG;AAAA,QACN,GAAI,iBAAiB,MAAM,CAAC;AAAA,MAC9B;AAAA,IACF;AAAA,EACF;AAEA,QAAM,uBAAuB;AAE7B,aAAW,CAAC,QAAQ,kBAAkB,KAAK,OAAO,QAAQ,gBAAgB,GAAG;AAC3E,QAAI,WAAW,KAAM;AAErB,uBAAmB,MAAM,IAAI;AAAA,MAC3B,GAAI,uBAAuB,MAAM,KAAK,CAAC;AAAA,MACvC,UAAU;AAAA,QACR,GAAG,GAAG;AAAA,QACN,GAAG;AAAA,MACL;AAAA,IACF;AAAA,EACF;AAEA,SAAO;AACT;","names":[]}
@@ -0,0 +1,7 @@
1
+ import type { CollectionEntry } from "../../types";
2
+ type NormalizedCollectionConfig = Map<string, {
3
+ titleField: string;
4
+ }>;
5
+ export declare function normalizeCollections(entries?: CollectionEntry[]): NormalizedCollectionConfig | null;
6
+ export {};
7
+ //# sourceMappingURL=normalizeCollections.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"normalizeCollections.d.ts","sourceRoot":"","sources":["../../../src/utils/config/normalizeCollections.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnD,KAAK,0BAA0B,GAAG,GAAG,CAAC,MAAM,EAAE;IAAE,UAAU,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AAItE,wBAAgB,oBAAoB,CAAC,OAAO,CAAC,EAAE,eAAe,EAAE,qCAY/D"}
@@ -0,0 +1,15 @@
1
+ const DEFAULT_TITLE_FIELD = "id";
2
+ function normalizeCollections(entries) {
3
+ if (!entries) return null;
4
+ const map = /* @__PURE__ */ new Map();
5
+ for (const entry of entries) {
6
+ map.set(entry.slug, {
7
+ titleField: entry.titleField ?? DEFAULT_TITLE_FIELD
8
+ });
9
+ }
10
+ return map;
11
+ }
12
+ export {
13
+ normalizeCollections
14
+ };
15
+ //# sourceMappingURL=normalizeCollections.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/utils/config/normalizeCollections.ts"],"sourcesContent":["import type { CollectionEntry } from \"../../types\";\n\ntype NormalizedCollectionConfig = Map<string, { titleField: string }>;\n\nconst DEFAULT_TITLE_FIELD = \"id\";\n\nexport function normalizeCollections(entries?: CollectionEntry[]) {\n if (!entries) return null;\n\n const map = new Map<string, { titleField: string }>() as NormalizedCollectionConfig;\n\n for (const entry of entries) {\n map.set(entry.slug, {\n titleField: entry.titleField ?? DEFAULT_TITLE_FIELD,\n });\n }\n\n return map;\n}\n"],"mappings":"AAIA,MAAM,sBAAsB;AAErB,SAAS,qBAAqB,SAA6B;AAChE,MAAI,CAAC,QAAS,QAAO;AAErB,QAAM,MAAM,oBAAI,IAAoC;AAEpD,aAAW,SAAS,SAAS;AAC3B,QAAI,IAAI,MAAM,MAAM;AAAA,MAClB,YAAY,MAAM,cAAc;AAAA,IAClC,CAAC;AAAA,EACH;AAEA,SAAO;AACT;","names":[]}
@@ -0,0 +1,3 @@
1
+ import type { CollectionConfig } from "payload";
2
+ export declare function overrideCollections(collections?: CollectionConfig[]): CollectionConfig[];
3
+ //# sourceMappingURL=overrideCollections.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"overrideCollections.d.ts","sourceRoot":"","sources":["../../../src/utils/config/overrideCollections.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAA6B,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAI3E,wBAAgB,mBAAmB,CAAC,WAAW,CAAC,EAAE,gBAAgB,EAAE,sBAiCnE"}
@@ -0,0 +1,38 @@
1
+ import { DEFAULT_COLLECTION_SLUG } from "../../constants";
2
+ import { injectFieldCommentComponents } from "./injectFieldCommentComponents";
3
+ function overrideCollections(collections) {
4
+ return (collections ?? []).map((collection) => {
5
+ if (collection.slug === DEFAULT_COLLECTION_SLUG) return collection;
6
+ const patchedCollection = injectFieldCommentComponents(collection);
7
+ return {
8
+ ...patchedCollection,
9
+ hooks: {
10
+ ...patchedCollection.hooks,
11
+ afterDelete: [
12
+ ...patchedCollection.hooks?.afterDelete ?? [],
13
+ (async ({ doc, req }) => {
14
+ await req.payload.delete({
15
+ collection: DEFAULT_COLLECTION_SLUG,
16
+ where: {
17
+ and: [
18
+ {
19
+ collectionSlug: { equals: collection.slug }
20
+ },
21
+ {
22
+ documentId: { equals: Number(doc.id) }
23
+ }
24
+ ]
25
+ },
26
+ req,
27
+ overrideAccess: true
28
+ });
29
+ })
30
+ ]
31
+ }
32
+ };
33
+ });
34
+ }
35
+ export {
36
+ overrideCollections
37
+ };
38
+ //# sourceMappingURL=overrideCollections.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/utils/config/overrideCollections.ts"],"sourcesContent":["import type { CollectionAfterDeleteHook, CollectionConfig } from \"payload\";\nimport { DEFAULT_COLLECTION_SLUG } from \"../../constants\";\nimport { injectFieldCommentComponents } from \"./injectFieldCommentComponents\";\n\nexport function overrideCollections(collections?: CollectionConfig[]) {\n return (collections ?? []).map((collection) => {\n if (collection.slug === DEFAULT_COLLECTION_SLUG) return collection;\n\n const patchedCollection = injectFieldCommentComponents(collection);\n\n return {\n ...patchedCollection,\n hooks: {\n ...patchedCollection.hooks,\n afterDelete: [\n ...(patchedCollection.hooks?.afterDelete ?? []),\n (async ({ doc, req }) => {\n await req.payload.delete({\n collection: DEFAULT_COLLECTION_SLUG,\n where: {\n and: [\n {\n collectionSlug: { equals: collection.slug },\n },\n {\n documentId: { equals: Number(doc.id) },\n },\n ],\n },\n req,\n overrideAccess: true,\n });\n }) satisfies CollectionAfterDeleteHook,\n ],\n },\n };\n });\n}\n"],"mappings":"AACA,SAAS,+BAA+B;AACxC,SAAS,oCAAoC;AAEtC,SAAS,oBAAoB,aAAkC;AACpE,UAAQ,eAAe,CAAC,GAAG,IAAI,CAAC,eAAe;AAC7C,QAAI,WAAW,SAAS,wBAAyB,QAAO;AAExD,UAAM,oBAAoB,6BAA6B,UAAU;AAEjE,WAAO;AAAA,MACL,GAAG;AAAA,MACH,OAAO;AAAA,QACL,GAAG,kBAAkB;AAAA,QACrB,aAAa;AAAA,UACX,GAAI,kBAAkB,OAAO,eAAe,CAAC;AAAA,WAC5C,OAAO,EAAE,KAAK,IAAI,MAAM;AACvB,kBAAM,IAAI,QAAQ,OAAO;AAAA,cACvB,YAAY;AAAA,cACZ,OAAO;AAAA,gBACL,KAAK;AAAA,kBACH;AAAA,oBACE,gBAAgB,EAAE,QAAQ,WAAW,KAAK;AAAA,kBAC5C;AAAA,kBACA;AAAA,oBACE,YAAY,EAAE,QAAQ,OAAO,IAAI,EAAE,EAAE;AAAA,kBACvC;AAAA,gBACF;AAAA,cACF;AAAA,cACA;AAAA,cACA,gBAAgB;AAAA,YAClB,CAAC;AAAA,UACH;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,EACF,CAAC;AACH;","names":[]}
@@ -0,0 +1,4 @@
1
+ import type { CollectionConfig } from "payload";
2
+ import type { CommentsPluginConfig } from "../../types";
3
+ export declare function overrideCommentsCollection(config: CollectionConfig, overrides: CommentsPluginConfig["overrides"]): CollectionConfig;
4
+ //# sourceMappingURL=overrideCommentsCollection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"overrideCommentsCollection.d.ts","sourceRoot":"","sources":["../../../src/utils/config/overrideCommentsCollection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAChD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAExD,wBAAgB,0BAA0B,CACxC,MAAM,EAAE,gBAAgB,EACxB,SAAS,EAAE,oBAAoB,CAAC,WAAW,CAAC,GAC3C,gBAAgB,CAUlB"}
@@ -0,0 +1,14 @@
1
+ function overrideCommentsCollection(config, overrides) {
2
+ const { access, admin, hooks, fields } = overrides ?? {};
3
+ return {
4
+ ...config,
5
+ access: { ...config.access, ...access },
6
+ hooks: { ...config.hooks, ...hooks },
7
+ admin: { ...config.admin, ...admin },
8
+ fields: fields ? fields(config.fields) : config.fields
9
+ };
10
+ }
11
+ export {
12
+ overrideCommentsCollection
13
+ };
14
+ //# sourceMappingURL=overrideCommentsCollection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/utils/config/overrideCommentsCollection.ts"],"sourcesContent":["import type { CollectionConfig } from \"payload\";\nimport type { CommentsPluginConfig } from \"../../types\";\n\nexport function overrideCommentsCollection(\n config: CollectionConfig,\n overrides: CommentsPluginConfig[\"overrides\"],\n): CollectionConfig {\n const { access, admin, hooks, fields } = overrides ?? {};\n\n return {\n ...config,\n access: { ...config.access, ...access },\n hooks: { ...config.hooks, ...hooks },\n admin: { ...config.admin, ...admin },\n fields: fields ? fields(config.fields) : config.fields,\n };\n}\n"],"mappings":"AAGO,SAAS,2BACd,QACA,WACkB;AAClB,QAAM,EAAE,QAAQ,OAAO,OAAO,OAAO,IAAI,aAAa,CAAC;AAEvD,SAAO;AAAA,IACL,GAAG;AAAA,IACH,QAAQ,EAAE,GAAG,OAAO,QAAQ,GAAG,OAAO;AAAA,IACtC,OAAO,EAAE,GAAG,OAAO,OAAO,GAAG,MAAM;AAAA,IACnC,OAAO,EAAE,GAAG,OAAO,OAAO,GAAG,MAAM;AAAA,IACnC,QAAQ,SAAS,OAAO,OAAO,MAAM,IAAI,OAAO;AAAA,EAClD;AACF;","names":[]}
@@ -0,0 +1,3 @@
1
+ import type { GlobalConfig } from "payload";
2
+ export declare function overrideGlobals(globals?: GlobalConfig[]): GlobalConfig[];
3
+ //# sourceMappingURL=overrideGlobals.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"overrideGlobals.d.ts","sourceRoot":"","sources":["../../../src/utils/config/overrideGlobals.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAG5C,wBAAgB,eAAe,CAAC,OAAO,CAAC,EAAE,YAAY,EAAE,kBAEvD"}
@@ -0,0 +1,8 @@
1
+ import { injectFieldCommentComponents } from "./injectFieldCommentComponents";
2
+ function overrideGlobals(globals) {
3
+ return (globals ?? []).map(injectFieldCommentComponents);
4
+ }
5
+ export {
6
+ overrideGlobals
7
+ };
8
+ //# sourceMappingURL=overrideGlobals.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/utils/config/overrideGlobals.ts"],"sourcesContent":["import type { GlobalConfig } from \"payload\";\nimport { injectFieldCommentComponents } from \"./injectFieldCommentComponents\";\n\nexport function overrideGlobals(globals?: GlobalConfig[]) {\n return (globals ?? []).map(injectFieldCommentComponents);\n}\n"],"mappings":"AACA,SAAS,oCAAoC;AAEtC,SAAS,gBAAgB,SAA0B;AACxD,UAAQ,WAAW,CAAC,GAAG,IAAI,4BAA4B;AACzD;","names":[]}
@@ -0,0 +1,2 @@
1
+ export declare function getDefaultErrorMessage(err: unknown): string;
2
+ //# sourceMappingURL=getDefaultErrorMessage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getDefaultErrorMessage.d.ts","sourceRoot":"","sources":["../../../src/utils/error/getDefaultErrorMessage.ts"],"names":[],"mappings":"AAAA,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,OAAO,UAMlD"}
@@ -0,0 +1,9 @@
1
+ function getDefaultErrorMessage(err) {
2
+ if (err instanceof Error) return err.message;
3
+ if (typeof err === "string") return err;
4
+ return "An unexpected error occurred";
5
+ }
6
+ export {
7
+ getDefaultErrorMessage
8
+ };
9
+ //# sourceMappingURL=getDefaultErrorMessage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/utils/error/getDefaultErrorMessage.ts"],"sourcesContent":["export function getDefaultErrorMessage(err: unknown) {\n if (err instanceof Error) return err.message;\n\n if (typeof err === \"string\") return err;\n\n return \"An unexpected error occurred\";\n}\n"],"mappings":"AAAO,SAAS,uBAAuB,KAAc;AACnD,MAAI,eAAe,MAAO,QAAO,IAAI;AAErC,MAAI,OAAO,QAAQ,SAAU,QAAO;AAEpC,SAAO;AACT;","names":[]}
@@ -0,0 +1,3 @@
1
+ import type { ClassValue } from "clsx";
2
+ export declare function cn(...inputs: ClassValue[]): string;
3
+ //# sourceMappingURL=cn.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cn.d.ts","sourceRoot":"","sources":["../../../src/utils/general/cn.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAIvC,wBAAgB,EAAE,CAAC,GAAG,MAAM,EAAE,UAAU,EAAE,UAEzC"}
@@ -0,0 +1,9 @@
1
+ import clsx from "clsx";
2
+ import { twMerge } from "tailwind-merge";
3
+ function cn(...inputs) {
4
+ return twMerge(clsx(inputs));
5
+ }
6
+ export {
7
+ cn
8
+ };
9
+ //# sourceMappingURL=cn.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/utils/general/cn.ts"],"sourcesContent":["import type { ClassValue } from \"clsx\";\nimport clsx from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs));\n}\n"],"mappings":"AACA,OAAO,UAAU;AACjB,SAAS,eAAe;AAEjB,SAAS,MAAM,QAAsB;AAC1C,SAAO,QAAQ,KAAK,MAAM,CAAC;AAC7B;","names":[]}
@@ -0,0 +1,2 @@
1
+ export declare function formatRelativeDate(iso: string, locale: string): string;
2
+ //# sourceMappingURL=formatRelativeDate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"formatRelativeDate.d.ts","sourceRoot":"","sources":["../../../src/utils/general/formatRelativeDate.ts"],"names":[],"mappings":"AAAA,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,UA6B7D"}
@@ -0,0 +1,28 @@
1
+ function formatRelativeDate(iso, locale) {
2
+ let date;
3
+ try {
4
+ date = new Date(iso);
5
+ if (isNaN(date.getTime())) return iso;
6
+ } catch {
7
+ return iso;
8
+ }
9
+ const elapsedMs = Date.now() - date.getTime();
10
+ const seconds = Math.round(elapsedMs / 1e3);
11
+ const rtf = new Intl.RelativeTimeFormat(locale, { numeric: "auto" });
12
+ if (seconds < 45) return rtf.format(0, "second");
13
+ if (seconds < 90) return rtf.format(-1, "minute");
14
+ if (seconds < 45 * 60) return rtf.format(-Math.round(seconds / 60), "minute");
15
+ if (seconds < 90 * 60) return rtf.format(-1, "hour");
16
+ if (seconds < 22 * 3600) return rtf.format(-Math.round(seconds / 3600), "hour");
17
+ if (seconds < 36 * 3600) return rtf.format(-1, "day");
18
+ if (seconds < 6 * 86400) return rtf.format(-Math.round(seconds / 86400), "day");
19
+ if (seconds < 10 * 86400) return rtf.format(-1, "week");
20
+ if (seconds < 45 * 86400) return rtf.format(-Math.round(seconds / (7 * 86400)), "week");
21
+ if (seconds < 345 * 86400) return rtf.format(-Math.round(seconds / (30 * 86400)), "month");
22
+ if (seconds < 545 * 86400) return rtf.format(-1, "year");
23
+ return rtf.format(-Math.round(seconds / (365 * 86400)), "year");
24
+ }
25
+ export {
26
+ formatRelativeDate
27
+ };
28
+ //# sourceMappingURL=formatRelativeDate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/utils/general/formatRelativeDate.ts"],"sourcesContent":["export function formatRelativeDate(iso: string, locale: string) {\n let date: Date;\n\n try {\n date = new Date(iso);\n\n if (isNaN(date.getTime())) return iso;\n } catch {\n return iso;\n }\n\n const elapsedMs = Date.now() - date.getTime();\n const seconds = Math.round(elapsedMs / 1000);\n\n const rtf = new Intl.RelativeTimeFormat(locale, { numeric: \"auto\" });\n\n if (seconds < 45) return rtf.format(0, \"second\");\n if (seconds < 90) return rtf.format(-1, \"minute\");\n if (seconds < 45 * 60) return rtf.format(-Math.round(seconds / 60), \"minute\");\n if (seconds < 90 * 60) return rtf.format(-1, \"hour\");\n if (seconds < 22 * 3600) return rtf.format(-Math.round(seconds / 3600), \"hour\");\n if (seconds < 36 * 3600) return rtf.format(-1, \"day\");\n if (seconds < 6 * 86400) return rtf.format(-Math.round(seconds / 86400), \"day\");\n if (seconds < 10 * 86400) return rtf.format(-1, \"week\");\n if (seconds < 45 * 86400) return rtf.format(-Math.round(seconds / (7 * 86400)), \"week\");\n if (seconds < 345 * 86400) return rtf.format(-Math.round(seconds / (30 * 86400)), \"month\");\n if (seconds < 545 * 86400) return rtf.format(-1, \"year\");\n\n return rtf.format(-Math.round(seconds / (365 * 86400)), \"year\");\n}\n"],"mappings":"AAAO,SAAS,mBAAmB,KAAa,QAAgB;AAC9D,MAAI;AAEJ,MAAI;AACF,WAAO,IAAI,KAAK,GAAG;AAEnB,QAAI,MAAM,KAAK,QAAQ,CAAC,EAAG,QAAO;AAAA,EACpC,QAAQ;AACN,WAAO;AAAA,EACT;AAEA,QAAM,YAAY,KAAK,IAAI,IAAI,KAAK,QAAQ;AAC5C,QAAM,UAAU,KAAK,MAAM,YAAY,GAAI;AAE3C,QAAM,MAAM,IAAI,KAAK,mBAAmB,QAAQ,EAAE,SAAS,OAAO,CAAC;AAEnE,MAAI,UAAU,GAAI,QAAO,IAAI,OAAO,GAAG,QAAQ;AAC/C,MAAI,UAAU,GAAI,QAAO,IAAI,OAAO,IAAI,QAAQ;AAChD,MAAI,UAAU,KAAK,GAAI,QAAO,IAAI,OAAO,CAAC,KAAK,MAAM,UAAU,EAAE,GAAG,QAAQ;AAC5E,MAAI,UAAU,KAAK,GAAI,QAAO,IAAI,OAAO,IAAI,MAAM;AACnD,MAAI,UAAU,KAAK,KAAM,QAAO,IAAI,OAAO,CAAC,KAAK,MAAM,UAAU,IAAI,GAAG,MAAM;AAC9E,MAAI,UAAU,KAAK,KAAM,QAAO,IAAI,OAAO,IAAI,KAAK;AACpD,MAAI,UAAU,IAAI,MAAO,QAAO,IAAI,OAAO,CAAC,KAAK,MAAM,UAAU,KAAK,GAAG,KAAK;AAC9E,MAAI,UAAU,KAAK,MAAO,QAAO,IAAI,OAAO,IAAI,MAAM;AACtD,MAAI,UAAU,KAAK,MAAO,QAAO,IAAI,OAAO,CAAC,KAAK,MAAM,WAAW,IAAI,MAAM,GAAG,MAAM;AACtF,MAAI,UAAU,MAAM,MAAO,QAAO,IAAI,OAAO,CAAC,KAAK,MAAM,WAAW,KAAK,MAAM,GAAG,OAAO;AACzF,MAAI,UAAU,MAAM,MAAO,QAAO,IAAI,OAAO,IAAI,MAAM;AAEvD,SAAO,IAAI,OAAO,CAAC,KAAK,MAAM,WAAW,MAAM,MAAM,GAAG,MAAM;AAChE;","names":[]}
@@ -0,0 +1,2 @@
1
+ export declare function getServerSideURL(): string;
2
+ //# sourceMappingURL=getURL.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getURL.d.ts","sourceRoot":"","sources":["../../../src/utils/general/getURL.ts"],"names":[],"mappings":"AAAA,wBAAgB,gBAAgB,IAAI,MAAM,CAUzC"}
@@ -0,0 +1,13 @@
1
+ function getServerSideURL() {
2
+ if (process.env.NEXT_PUBLIC_SERVER_URL) {
3
+ return process.env.NEXT_PUBLIC_SERVER_URL;
4
+ }
5
+ if (process.env.VERCEL_PROJECT_PRODUCTION_URL) {
6
+ return `https://${process.env.VERCEL_PROJECT_PRODUCTION_URL}`;
7
+ }
8
+ return "http://localhost:3000";
9
+ }
10
+ export {
11
+ getServerSideURL
12
+ };
13
+ //# sourceMappingURL=getURL.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/utils/general/getURL.ts"],"sourcesContent":["export function getServerSideURL(): string {\n if (process.env.NEXT_PUBLIC_SERVER_URL) {\n return process.env.NEXT_PUBLIC_SERVER_URL;\n }\n\n if (process.env.VERCEL_PROJECT_PRODUCTION_URL) {\n return `https://${process.env.VERCEL_PROJECT_PRODUCTION_URL}`;\n }\n\n return \"http://localhost:3000\";\n}\n"],"mappings":"AAAO,SAAS,mBAA2B;AACzC,MAAI,QAAQ,IAAI,wBAAwB;AACtC,WAAO,QAAQ,IAAI;AAAA,EACrB;AAEA,MAAI,QAAQ,IAAI,+BAA+B;AAC7C,WAAO,WAAW,QAAQ,IAAI,6BAA6B;AAAA,EAC7D;AAEA,SAAO;AACT;","names":[]}
@@ -0,0 +1,4 @@
1
+ type Object = Record<string, unknown>;
2
+ export declare function getValueByPath(obj: Object, path: string): string | null;
3
+ export {};
4
+ //# sourceMappingURL=getValueByPath.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getValueByPath.d.ts","sourceRoot":"","sources":["../../../src/utils/general/getValueByPath.ts"],"names":[],"mappings":"AAAA,KAAK,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;AAErC,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,iBAuBvD"}