@focus-reactive/payload-plugin-comments 1.1.1 → 1.2.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 (157) hide show
  1. package/dist/api/mutations/useAddCommentMutation.d.ts +18 -0
  2. package/dist/api/mutations/useAddCommentMutation.d.ts.map +1 -0
  3. package/dist/api/mutations/useAddCommentMutation.js +52 -0
  4. package/dist/api/mutations/useAddCommentMutation.js.map +1 -0
  5. package/dist/api/mutations/useDeleteCommentMutation.d.ts +11 -0
  6. package/dist/api/mutations/useDeleteCommentMutation.d.ts.map +1 -0
  7. package/dist/api/mutations/useDeleteCommentMutation.js +31 -0
  8. package/dist/api/mutations/useDeleteCommentMutation.js.map +1 -0
  9. package/dist/api/mutations/useResolveCommentMutation.d.ts +13 -0
  10. package/dist/api/mutations/useResolveCommentMutation.d.ts.map +1 -0
  11. package/dist/api/mutations/useResolveCommentMutation.js +41 -0
  12. package/dist/api/mutations/useResolveCommentMutation.js.map +1 -0
  13. package/dist/api/queries/useCommentsQuery.d.ts +3 -0
  14. package/dist/api/queries/useCommentsQuery.d.ts.map +1 -0
  15. package/dist/api/queries/useCommentsQuery.js +40 -0
  16. package/dist/api/queries/useCommentsQuery.js.map +1 -0
  17. package/dist/api/queries/useDocumentTitlesQuery.d.ts +3 -0
  18. package/dist/api/queries/useDocumentTitlesQuery.d.ts.map +1 -0
  19. package/dist/api/queries/useDocumentTitlesQuery.js +32 -0
  20. package/dist/api/queries/useDocumentTitlesQuery.js.map +1 -0
  21. package/dist/api/queries/useFieldLabelsQuery.d.ts +3 -0
  22. package/dist/api/queries/useFieldLabelsQuery.d.ts.map +1 -0
  23. package/dist/api/queries/useFieldLabelsQuery.js +23 -0
  24. package/dist/api/queries/useFieldLabelsQuery.js.map +1 -0
  25. package/dist/api/queries/useMentionableUsersQuery.d.ts +2 -0
  26. package/dist/api/queries/useMentionableUsersQuery.d.ts.map +1 -0
  27. package/dist/api/queries/useMentionableUsersQuery.js +25 -0
  28. package/dist/api/queries/useMentionableUsersQuery.js.map +1 -0
  29. package/dist/api/queryKeys.d.ts +23 -0
  30. package/dist/api/queryKeys.d.ts.map +1 -0
  31. package/dist/api/queryKeys.js +40 -0
  32. package/dist/api/queryKeys.js.map +1 -0
  33. package/dist/components/CommentEditor/index.d.ts.map +1 -1
  34. package/dist/components/CommentEditor/index.js +5 -3
  35. package/dist/components/CommentEditor/index.js.map +1 -1
  36. package/dist/components/CommentItem/StrikethoroughOverlay/clamp.d.ts +2 -0
  37. package/dist/components/CommentItem/StrikethoroughOverlay/clamp.d.ts.map +1 -0
  38. package/dist/components/CommentItem/StrikethoroughOverlay/clamp.js +7 -0
  39. package/dist/components/CommentItem/StrikethoroughOverlay/clamp.js.map +1 -0
  40. package/dist/components/CommentItem/StrikethoroughOverlay/index.d.ts +8 -0
  41. package/dist/components/CommentItem/StrikethoroughOverlay/index.d.ts.map +1 -0
  42. package/dist/components/CommentItem/StrikethoroughOverlay/index.js +24 -0
  43. package/dist/components/CommentItem/StrikethoroughOverlay/index.js.map +1 -0
  44. package/dist/components/CommentItem/StrikethoroughOverlay/measureLineRects.d.ts +3 -0
  45. package/dist/components/CommentItem/StrikethoroughOverlay/measureLineRects.d.ts.map +1 -0
  46. package/dist/components/CommentItem/StrikethoroughOverlay/measureLineRects.js +29 -0
  47. package/dist/components/CommentItem/StrikethoroughOverlay/measureLineRects.js.map +1 -0
  48. package/dist/components/CommentItem/StrikethoroughOverlay/useStrikethroughAnimation.d.ts +7 -0
  49. package/dist/components/CommentItem/StrikethoroughOverlay/useStrikethroughAnimation.d.ts.map +1 -0
  50. package/dist/components/CommentItem/StrikethoroughOverlay/useStrikethroughAnimation.js +114 -0
  51. package/dist/components/CommentItem/StrikethoroughOverlay/useStrikethroughAnimation.js.map +1 -0
  52. package/dist/components/CommentItem/index.d.ts.map +1 -1
  53. package/dist/components/CommentItem/index.js +37 -18
  54. package/dist/components/CommentItem/index.js.map +1 -1
  55. package/dist/components/CommentsDrawer/components/Header.d.ts.map +1 -1
  56. package/dist/components/CommentsDrawer/components/Header.js +4 -33
  57. package/dist/components/CommentsDrawer/components/Header.js.map +1 -1
  58. package/dist/components/CommentsHeaderButton/index.js +2 -2
  59. package/dist/components/CommentsHeaderButton/index.js.map +1 -1
  60. package/dist/components/CommentsPanel/components/CollapsibleGroup.d.ts +7 -2
  61. package/dist/components/CommentsPanel/components/CollapsibleGroup.d.ts.map +1 -1
  62. package/dist/components/CommentsPanel/components/CollapsibleGroup.js +7 -2
  63. package/dist/components/CommentsPanel/components/CollapsibleGroup.js.map +1 -1
  64. package/dist/components/CommentsPanel/components/DocumentView.d.ts.map +1 -1
  65. package/dist/components/CommentsPanel/components/DocumentView.js +11 -17
  66. package/dist/components/CommentsPanel/components/DocumentView.js.map +1 -1
  67. package/dist/components/CommentsPanel/components/FieldGroupSection.d.ts.map +1 -1
  68. package/dist/components/CommentsPanel/components/FieldGroupSection.js +44 -22
  69. package/dist/components/CommentsPanel/components/FieldGroupSection.js.map +1 -1
  70. package/dist/components/CommentsPanel/components/GlobalDocumentView.d.ts.map +1 -1
  71. package/dist/components/CommentsPanel/components/GlobalDocumentView.js +3 -9
  72. package/dist/components/CommentsPanel/components/GlobalDocumentView.js.map +1 -1
  73. package/dist/components/CommentsPanel/components/GlobalView.d.ts.map +1 -1
  74. package/dist/components/CommentsPanel/components/GlobalView.js +38 -41
  75. package/dist/components/CommentsPanel/components/GlobalView.js.map +1 -1
  76. package/dist/components/CommentsPanel/hooks/useCollapseState.d.ts +1 -1
  77. package/dist/components/CommentsPanel/hooks/useCollapseState.d.ts.map +1 -1
  78. package/dist/components/CommentsPanel/hooks/useCollapseState.js +4 -1
  79. package/dist/components/CommentsPanel/hooks/useCollapseState.js.map +1 -1
  80. package/dist/components/CommentsPanel/index.d.ts.map +1 -1
  81. package/dist/components/CommentsPanel/index.js +14 -11
  82. package/dist/components/CommentsPanel/index.js.map +1 -1
  83. package/dist/components/FieldCommentLabel/hooks/useFieldBreadcrumb.d.ts +2 -0
  84. package/dist/components/FieldCommentLabel/hooks/useFieldBreadcrumb.d.ts.map +1 -0
  85. package/dist/components/FieldCommentLabel/hooks/useFieldBreadcrumb.js +52 -0
  86. package/dist/components/FieldCommentLabel/hooks/useFieldBreadcrumb.js.map +1 -0
  87. package/dist/components/FieldCommentLabel/index.d.ts.map +1 -1
  88. package/dist/components/FieldCommentLabel/index.js +53 -41
  89. package/dist/components/FieldCommentLabel/index.js.map +1 -1
  90. package/dist/components/FieldCommentLabel/utils/exludeComments.js +2 -2
  91. package/dist/components/FieldCommentLabel/utils/exludeComments.js.map +1 -1
  92. package/dist/constants.d.ts +1 -0
  93. package/dist/constants.d.ts.map +1 -1
  94. package/dist/constants.js +3 -4
  95. package/dist/constants.js.map +1 -1
  96. package/dist/plugin.d.ts.map +1 -1
  97. package/dist/plugin.js +6 -2
  98. package/dist/plugin.js.map +1 -1
  99. package/dist/providers/CommentsDrawerProvider/index.d.ts +8 -0
  100. package/dist/providers/CommentsDrawerProvider/index.d.ts.map +1 -1
  101. package/dist/providers/CommentsDrawerProvider/index.js +22 -6
  102. package/dist/providers/CommentsDrawerProvider/index.js.map +1 -1
  103. package/dist/providers/CommentsProvider/index.d.ts +7 -17
  104. package/dist/providers/CommentsProvider/index.d.ts.map +1 -1
  105. package/dist/providers/CommentsProvider/index.js +105 -196
  106. package/dist/providers/CommentsProvider/index.js.map +1 -1
  107. package/dist/providers/CommentsProviderWrapper/index.d.ts +1 -1
  108. package/dist/providers/CommentsProviderWrapper/index.d.ts.map +1 -1
  109. package/dist/providers/CommentsProviderWrapper/index.js +11 -1
  110. package/dist/providers/CommentsProviderWrapper/index.js.map +1 -1
  111. package/dist/services/findAllComments.d.ts +4 -1
  112. package/dist/services/findAllComments.d.ts.map +1 -1
  113. package/dist/services/findAllComments.js +36 -10
  114. package/dist/services/findAllComments.js.map +1 -1
  115. package/dist/styles.css +1 -1
  116. package/dist/translations/en.d.ts.map +1 -1
  117. package/dist/translations/en.js +3 -7
  118. package/dist/translations/en.js.map +1 -1
  119. package/dist/translations/types.d.ts +2 -6
  120. package/dist/translations/types.d.ts.map +1 -1
  121. package/dist/types/general.d.ts +0 -2
  122. package/dist/types/general.d.ts.map +1 -1
  123. package/dist/types/index.d.ts +3 -2
  124. package/dist/types/index.d.ts.map +1 -1
  125. package/dist/types/query.d.ts +11 -0
  126. package/dist/types/query.d.ts.map +1 -0
  127. package/dist/types/query.js +1 -0
  128. package/dist/types/query.js.map +1 -0
  129. package/dist/utils/query/toQueryContext.d.ts +3 -0
  130. package/dist/utils/query/toQueryContext.d.ts.map +1 -0
  131. package/dist/utils/query/toQueryContext.js +20 -0
  132. package/dist/utils/query/toQueryContext.js.map +1 -0
  133. package/package.json +2 -5
  134. package/dist/components/CommentsPanel/constants.d.ts +0 -3
  135. package/dist/components/CommentsPanel/constants.d.ts.map +0 -1
  136. package/dist/components/CommentsPanel/constants.js +0 -9
  137. package/dist/components/CommentsPanel/constants.js.map +0 -1
  138. package/dist/components/CommentsPanel/utils/filterComments.d.ts +0 -9
  139. package/dist/components/CommentsPanel/utils/filterComments.d.ts.map +0 -1
  140. package/dist/components/CommentsPanel/utils/filterComments.js +0 -17
  141. package/dist/components/CommentsPanel/utils/filterComments.js.map +0 -1
  142. package/dist/components/FieldCommentLabel/AddCommentPopup.d.ts +0 -8
  143. package/dist/components/FieldCommentLabel/AddCommentPopup.d.ts.map +0 -1
  144. package/dist/components/FieldCommentLabel/AddCommentPopup.js +0 -50
  145. package/dist/components/FieldCommentLabel/AddCommentPopup.js.map +0 -1
  146. package/dist/providers/GlobalCommentsLoader/GlobalCommentsHydrator.d.ts +0 -13
  147. package/dist/providers/GlobalCommentsLoader/GlobalCommentsHydrator.d.ts.map +0 -1
  148. package/dist/providers/GlobalCommentsLoader/GlobalCommentsHydrator.js +0 -22
  149. package/dist/providers/GlobalCommentsLoader/GlobalCommentsHydrator.js.map +0 -1
  150. package/dist/providers/GlobalCommentsLoader/index.d.ts +0 -10
  151. package/dist/providers/GlobalCommentsLoader/index.d.ts.map +0 -1
  152. package/dist/providers/GlobalCommentsLoader/index.js +0 -31
  153. package/dist/providers/GlobalCommentsLoader/index.js.map +0 -1
  154. package/dist/services/syncAllCommentsData.d.ts +0 -12
  155. package/dist/services/syncAllCommentsData.d.ts.map +0 -1
  156. package/dist/services/syncAllCommentsData.js +0 -48
  157. package/dist/services/syncAllCommentsData.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/providers/CommentsProvider/index.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n createContext,\n type Dispatch,\n type ReactNode,\n type SetStateAction,\n useCallback,\n useContext,\n useOptimistic,\n useState,\n} from \"react\";\nimport { useAuth, useLocale } from \"@payloadcms/ui\";\nimport { usePathname } from \"next/navigation\";\nimport type { Comment, EntityLabelsMap, User } from \"../../types\";\nimport { createComment } from \"../../services/createComment\";\nimport { deleteComment } from \"../../services/deleteComment\";\nimport { resolveComment as resolveCommentService } from \"../../services/resolveComment\";\nimport { syncAllCommentsData } from \"../../services/syncAllCommentsData\";\nimport type { FilterMode, GlobalFieldLabelRegistry, LoadingStatus, DocumentTitles, Mode } from \"../../types\";\nimport { parseMentionIds } from \"../../utils/mention/parseMentionIds\";\nimport { defineModeByPathname } from \"../../utils/mode/defineModeByPathname\";\nimport { extractVisibleComments } from \"../../utils/comment/extractVisibleComments\";\n\ntype OptimisticAction =\n | { type: \"add\"; comment: Comment }\n | { type: \"remove\"; id: string | number }\n | { type: \"update\"; comment: Comment };\n\nfunction optimisticReducer(state: Comment[], action: OptimisticAction) {\n switch (action.type) {\n case \"add\":\n return [action.comment, ...state];\n case \"remove\":\n return state.filter(({ id }) => id !== action.id);\n case \"update\":\n return state.map((c) => (c.id === action.comment.id ? action.comment : c));\n }\n}\n\ninterface MutationResult {\n success: boolean;\n error?: string;\n}\n\ninterface CommentsContextProps {\n allComments: Comment[];\n visibleComments: Comment[];\n documentTitles: DocumentTitles;\n collectionLabels: EntityLabelsMap;\n globalLabels: EntityLabelsMap;\n mode: Mode;\n collectionSlug: string | null | undefined;\n documentId: number | null | undefined;\n globalSlug: string | null;\n mentionUsers: User[];\n loadError: boolean;\n filter: FilterMode;\n fieldLabelRegistry: GlobalFieldLabelRegistry;\n syncCommentsStatus: LoadingStatus;\n usernameFieldPath: string | undefined;\n setFilter: Dispatch<SetStateAction<FilterMode>>;\n hydrateComments: (\n incoming?: Comment[],\n incomingTitles?: DocumentTitles,\n incomingMentionUsers?: User[],\n fieldLabels?: GlobalFieldLabelRegistry,\n incomingCollectionLabels?: EntityLabelsMap,\n nextLoadError?: boolean,\n incomingGlobalLabels?: EntityLabelsMap,\n ) => void;\n syncComments: () => Promise<void>;\n addComment: (\n text: string,\n fieldPath?: string | null,\n documentId?: number,\n collectionSlug?: string,\n locale?: string | null,\n globalSlugOverride?: string,\n ) => Promise<MutationResult>;\n removeComment: (id: string | number) => Promise<MutationResult>;\n resolveComment: (id: string | number, resolved: boolean) => Promise<MutationResult>;\n updateDocumentTitle: (collectionSlug: string, documentId: string, value: string) => void;\n}\n\nconst CommentsContext = createContext<CommentsContextProps | null>(null);\n\ninterface Props {\n children: ReactNode;\n usernameFieldPath?: string;\n}\n\nexport function CommentsProvider({ children, usernameFieldPath }: Props) {\n const { user } = useAuth();\n const pathname = usePathname();\n const { code: currentLocale } = useLocale();\n\n const [allComments, setAllComments] = useState<Comment[]>([]);\n const [optimisticComments, applyOptimistic] = useOptimistic<Comment[], OptimisticAction>(\n allComments,\n optimisticReducer,\n );\n\n const [documentTitles, setDocumentTitles] = useState<DocumentTitles>({});\n const [collectionLabels, setCollectionLabels] = useState<EntityLabelsMap>({});\n const [globalLabels, setGlobalLabels] = useState<EntityLabelsMap>({});\n const [mentionUsers, setMentionUsers] = useState<User[]>([]);\n const [fieldLabelRegistry, setFieldLabelRegistry] = useState<GlobalFieldLabelRegistry>({});\n const [filter, setFilter] = useState<FilterMode>(\"open\");\n const [loadError, setLoadError] = useState(false);\n const [syncCommentsStatus, setSyncCommentsStatus] = useState<LoadingStatus>(\"idle\");\n\n const { mode, collectionSlug, documentId, globalSlug } = defineModeByPathname(pathname);\n\n const visibleComments = extractVisibleComments({\n comments: optimisticComments,\n mode,\n collectionSlug,\n documentId,\n globalSlug,\n currentLocale,\n });\n\n const hydrateComments = useCallback(\n (\n incoming?: Comment[],\n incomingTitles?: DocumentTitles,\n incomingMentionUsers?: User[],\n fieldLabels?: GlobalFieldLabelRegistry,\n incomingCollectionLabels?: EntityLabelsMap,\n nextLoadError = false,\n incomingGlobalLabels?: EntityLabelsMap,\n ) => {\n if (incoming !== undefined) {\n setAllComments(incoming);\n }\n\n if (incomingTitles) {\n setDocumentTitles(incomingTitles);\n }\n\n if (incomingMentionUsers) {\n setMentionUsers(incomingMentionUsers);\n }\n\n if (fieldLabels) {\n setFieldLabelRegistry(fieldLabels);\n }\n\n if (incomingCollectionLabels) {\n setCollectionLabels(incomingCollectionLabels);\n }\n\n if (incomingGlobalLabels) {\n setGlobalLabels(incomingGlobalLabels);\n }\n\n setLoadError(nextLoadError);\n },\n [],\n );\n\n const addComment = async (\n text: string,\n fieldPath?: string | null,\n documentIdOverride?: number,\n collectionSlugOverride?: string,\n locale?: string | null,\n globalSlugOverride?: string,\n ): Promise<MutationResult> => {\n const resolvedGlobalSlug = globalSlugOverride ?? (mode === \"global-document\" ? globalSlug : null);\n const resolvedDocId = documentIdOverride ?? documentId;\n const resolvedSlug = collectionSlugOverride ?? collectionSlug;\n\n if (!resolvedGlobalSlug && (!resolvedDocId || !resolvedSlug)) {\n return {\n success: false,\n error: \"No document registered\",\n };\n }\n\n const tempId = -Date.now();\n\n const mentionIds = parseMentionIds(text);\n const selectedMentionUsers = mentionUsers.filter(({ id }) => mentionIds.includes(id));\n const mentions = selectedMentionUsers.map((user) => ({ id: null, user }));\n\n const optimisticComment: Comment = {\n id: tempId,\n text,\n fieldPath,\n locale: locale ?? null,\n documentId: resolvedGlobalSlug ? null : resolvedDocId,\n collectionSlug: resolvedGlobalSlug ? null : resolvedSlug,\n globalSlug: resolvedGlobalSlug ?? null,\n isResolved: false,\n mentions,\n createdAt: new Date().toISOString(),\n updatedAt: new Date().toISOString(),\n author: user as Comment[\"author\"],\n };\n\n applyOptimistic({ type: \"add\", comment: optimisticComment });\n\n const result = await createComment({\n documentId: resolvedGlobalSlug ? null : resolvedDocId,\n collectionSlug: resolvedGlobalSlug ? null : resolvedSlug,\n globalSlug: resolvedGlobalSlug,\n text,\n fieldPath,\n mentionIds,\n locale,\n });\n\n if (result.success) {\n applyOptimistic({ type: \"remove\", id: tempId });\n setAllComments((prev) => [result.data, ...prev.filter((c) => c.id !== tempId)]);\n\n return { success: true };\n }\n\n return {\n success: false,\n error: result.error,\n };\n };\n\n const removeComment = async (id: string | number): Promise<MutationResult> => {\n applyOptimistic({ type: \"remove\", id });\n\n const result = await deleteComment(id);\n\n if (result.success) {\n setAllComments((prev) => prev.filter((c) => c.id !== id));\n\n return { success: true };\n }\n\n return {\n success: false,\n error: result.error,\n };\n };\n\n const syncComments = async () => {\n setSyncCommentsStatus(\"loading\");\n\n const allCommentsDataResult = await syncAllCommentsData({ locale: currentLocale });\n\n if (!allCommentsDataResult.success) {\n setSyncCommentsStatus(\"error\");\n\n return;\n }\n\n const {\n comments,\n documentTitles,\n mentionUsers,\n fieldLabels,\n collectionLabels: syncedLabels,\n globalLabels: syncedGlobalLabels,\n } = allCommentsDataResult.data;\n\n setAllComments((prev) => {\n const serverIds = new Set(comments.map((c) => c.id));\n const localOnly = prev.filter((c) => c.id > 0 && !serverIds.has(c.id));\n\n return [...localOnly, ...comments];\n });\n setDocumentTitles(documentTitles);\n setMentionUsers(mentionUsers);\n setFieldLabelRegistry(fieldLabels);\n setCollectionLabels(syncedLabels);\n setGlobalLabels(syncedGlobalLabels);\n setSyncCommentsStatus(\"success\");\n };\n\n const resolveComment = async (id: string | number, resolved: boolean): Promise<MutationResult> => {\n const existing = optimisticComments.find((c) => c.id === id);\n\n if (existing) {\n applyOptimistic({\n type: \"update\",\n comment: {\n ...existing,\n isResolved: resolved,\n },\n });\n }\n\n const result = await resolveCommentService(id, resolved);\n\n if (result.success) {\n setAllComments((prev) => prev.map((c) => (c.id === id ? result.data : c)));\n\n return { success: true };\n }\n\n return {\n success: false,\n error: result.error,\n };\n };\n\n const updateDocumentTitle = (collectionSlug: string, documentId: string, value: string) => {\n setDocumentTitles((prev) => ({\n ...prev,\n [collectionSlug]: {\n ...prev[collectionSlug],\n [documentId]: value,\n },\n }));\n };\n\n return (\n <CommentsContext.Provider\n value={{\n allComments: optimisticComments,\n visibleComments,\n documentTitles,\n collectionLabels,\n globalLabels,\n mode,\n collectionSlug,\n documentId,\n globalSlug,\n mentionUsers,\n loadError,\n filter,\n fieldLabelRegistry,\n syncCommentsStatus,\n usernameFieldPath,\n setFilter,\n hydrateComments,\n syncComments,\n addComment,\n removeComment,\n resolveComment,\n updateDocumentTitle,\n }}>\n {children}\n </CommentsContext.Provider>\n );\n}\n\nexport function useComments() {\n const context = useContext(CommentsContext);\n\n if (!context) throw new Error(\"useComments must be used within a CommentsProvider\");\n\n return context;\n}\n"],"mappings":";AA4TI;AA1TJ;AAAA,EACE;AAAA,EAIA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,SAAS,iBAAiB;AACnC,SAAS,mBAAmB;AAE5B,SAAS,qBAAqB;AAC9B,SAAS,qBAAqB;AAC9B,SAAS,kBAAkB,6BAA6B;AACxD,SAAS,2BAA2B;AAEpC,SAAS,uBAAuB;AAChC,SAAS,4BAA4B;AACrC,SAAS,8BAA8B;AAOvC,SAAS,kBAAkB,OAAkB,QAA0B;AACrE,UAAQ,OAAO,MAAM;AAAA,IACnB,KAAK;AACH,aAAO,CAAC,OAAO,SAAS,GAAG,KAAK;AAAA,IAClC,KAAK;AACH,aAAO,MAAM,OAAO,CAAC,EAAE,GAAG,MAAM,OAAO,OAAO,EAAE;AAAA,IAClD,KAAK;AACH,aAAO,MAAM,IAAI,CAAC,MAA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A,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MACF;AAAA,MACC;AAAA;AAAA,EACH;AAEJ;AAEO,SAAS,cAAc;AAC5B,QAAM,UAAU,WAAW,eAAe;AAE1C,MAAI,CAAC,QAAS,OAAM,IAAI,MAAM,oDAAoD;AAElF,SAAO;AACT;","names":["user","documentTitles","mentionUsers","collectionSlug","documentId"]}
1
+ {"version":3,"sources":["../../../src/providers/CommentsProvider/index.tsx"],"sourcesContent":["\"use client\";\n\nimport { createContext, type ReactNode, useCallback, useContext } from \"react\";\nimport { useAuth, useConfig } from \"@payloadcms/ui\";\nimport { usePathname } from \"next/navigation\";\nimport type { EntityLabelsMap, Comment, CommentsPluginConfigStorage } from \"../../types\";\nimport type { QueryContext } from \"../../types\";\nimport { toQueryContext } from \"../../utils/query/toQueryContext\";\nimport { defineModeByPathname } from \"../../utils/mode/defineModeByPathname\";\nimport { getEntitiesLabels } from \"../../services/getEntitiesLabels\";\nimport type { EntityConfig } from \"../../types\";\nimport { parseMentionIds } from \"../../utils/mention/parseMentionIds\";\nimport { getDefaultErrorMessage } from \"../../utils/error/getDefaultErrorMessage\";\nimport { useAddCommentMutation } from \"../../api/mutations/useAddCommentMutation\";\nimport { useDeleteCommentMutation } from \"../../api/mutations/useDeleteCommentMutation\";\nimport { useResolveCommentMutation } from \"../../api/mutations/useResolveCommentMutation\";\nimport type { Mode } from \"../../types\";\n\ninterface MutationResult {\n success: boolean;\n error?: string;\n}\n\ninterface CommentsContextProps {\n mode: Mode;\n collectionSlug: string | null | undefined;\n documentId: number | null | undefined;\n globalSlug: string | null;\n queryContext: QueryContext;\n collectionLabels: EntityLabelsMap;\n globalLabels: EntityLabelsMap;\n usernameFieldPath: string | undefined;\n addComment: (\n text: string,\n fieldPath?: string | null,\n documentId?: number,\n collectionSlug?: string,\n locale?: string | null,\n globalSlugOverride?: string,\n ) => Promise<MutationResult>;\n removeComment: (id: string | number) => Promise<MutationResult>;\n resolveComment: (id: string | number, resolved: boolean) => Promise<MutationResult>;\n}\n\nconst CommentsContext = createContext<CommentsContextProps | null>(null);\n\ninterface Props {\n children: ReactNode;\n usernameFieldPath?: string;\n}\n\nexport function CommentsProvider({ children, usernameFieldPath }: Props) {\n const { user } = useAuth();\n const pathname = usePathname();\n const { config } = useConfig();\n\n const { mode, collectionSlug, documentId, globalSlug } = defineModeByPathname(pathname);\n const queryContext = toQueryContext(mode, collectionSlug, documentId, globalSlug);\n\n const pluginConfig = config.admin?.custom?.commentsPlugin as CommentsPluginConfigStorage | undefined;\n const collectionLabels = getEntitiesLabels(\n (config.collections ?? []) as unknown as EntityConfig[],\n pluginConfig?.collections ?? [],\n );\n const globalLabels = getEntitiesLabels(\n (config.globals ?? []) as unknown as EntityConfig[],\n pluginConfig?.globals ?? [],\n );\n\n const addMutation = useAddCommentMutation();\n const deleteMutation = useDeleteCommentMutation();\n const resolveMutation = useResolveCommentMutation();\n\n const addComment = useCallback(\n async (\n text: string,\n fieldPath?: string | null,\n documentIdOverride?: number,\n collectionSlugOverride?: string,\n locale?: string | null,\n globalSlugOverride?: string,\n ): Promise<MutationResult> => {\n const resolvedGlobalSlug = globalSlugOverride ?? (mode === \"global-document\" ? globalSlug : null);\n const resolvedDocId = documentIdOverride ?? documentId;\n const resolvedSlug = collectionSlugOverride ?? collectionSlug;\n\n if (!resolvedGlobalSlug && (!resolvedDocId || !resolvedSlug)) {\n return {\n success: false,\n error: \"No document registered\",\n };\n }\n\n try {\n const res = await addMutation.mutateAsync({\n ctx: queryContext,\n text,\n fieldPath: fieldPath ?? null,\n documentId: resolvedGlobalSlug ? null : resolvedDocId,\n collectionSlug: resolvedGlobalSlug ? null : resolvedSlug,\n globalSlug: resolvedGlobalSlug ?? null,\n locale: locale ?? null,\n mentionIds: parseMentionIds(text),\n currentUser: user as Comment[\"author\"],\n });\n\n if (!res.success)\n return {\n success: false,\n error: res.error,\n };\n\n return { success: true };\n } catch (e) {\n return {\n success: false,\n error: getDefaultErrorMessage(e),\n };\n }\n },\n [addMutation, mode, globalSlug, documentId, collectionSlug, queryContext, user],\n );\n\n const removeComment = useCallback(\n async (id: string | number): Promise<MutationResult> => {\n try {\n const res = await deleteMutation.mutateAsync({\n ctx: queryContext,\n commentId: id,\n });\n\n if (!res.success)\n return {\n success: false,\n error: res.error,\n };\n\n return { success: true };\n } catch (e) {\n return {\n success: false,\n error: getDefaultErrorMessage(e),\n };\n }\n },\n [deleteMutation, queryContext],\n );\n\n const resolveComment = useCallback(\n async (id: string | number, resolved: boolean): Promise<MutationResult> => {\n try {\n const res = await resolveMutation.mutateAsync({\n ctx: queryContext,\n commentId: id,\n resolved,\n currentUser: user as Comment[\"author\"],\n });\n\n if (!res.success)\n return {\n success: false,\n error: res.error,\n };\n\n return { success: true };\n } catch (e) {\n return {\n success: false,\n error: getDefaultErrorMessage(e),\n };\n }\n },\n [resolveMutation, queryContext, user],\n );\n\n return (\n <CommentsContext.Provider\n value={{\n mode,\n collectionSlug,\n documentId,\n globalSlug,\n queryContext,\n collectionLabels,\n globalLabels,\n usernameFieldPath,\n addComment,\n removeComment,\n resolveComment,\n }}>\n {children}\n </CommentsContext.Provider>\n );\n}\n\nexport function useComments() {\n const context = useContext(CommentsContext);\n\n if (!context) throw new Error(\"useComments must be used within a CommentsProvider\");\n\n return context;\n}\n"],"mappings":";AAgLI;AA9KJ,SAAS,eAA+B,aAAa,kBAAkB;AACvE,SAAS,SAAS,iBAAiB;AACnC,SAAS,mBAAmB;AAG5B,SAAS,sBAAsB;AAC/B,SAAS,4BAA4B;AACrC,SAAS,yBAAyB;AAElC,SAAS,uBAAuB;AAChC,SAAS,8BAA8B;AACvC,SAAS,6BAA6B;AACtC,SAAS,gCAAgC;AACzC,SAAS,iCAAiC;AA6B1C,MAAM,kBAAkB,cAA2C,IAAI;AAOhE,SAAS,iBAAiB,EAAE,UAAU,kBAAkB,GAAU;AACvE,QAAM,EAAE,KAAK,IAAI,QAAQ;AACzB,QAAM,WAAW,YAAY;AAC7B,QAAM,EAAE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AAc;AAC5B,QAAM,UAAU,WAAW,eAAe;AAE1C,MAAI,CAAC,QAAS,OAAM,IAAI,MAAM,oDAAoD;AAElF,SAAO;AACT;","names":[]}
@@ -1,4 +1,4 @@
1
- import type { ReactNode } from "react";
1
+ import { type ReactNode } from "react";
2
2
  interface Props {
3
3
  children: ReactNode;
4
4
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/providers/CommentsProviderWrapper/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAMvC,UAAU,KAAK;IACb,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED,wBAAgB,uBAAuB,CAAC,EAAE,QAAQ,EAAE,EAAE,KAAK,2CAY1D"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/providers/CommentsProviderWrapper/index.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAY,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAOjD,UAAU,KAAK;IACb,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED,wBAAgB,uBAAuB,CAAC,EAAE,QAAQ,EAAE,EAAE,KAAK,2CAuB1D"}
@@ -1,14 +1,24 @@
1
1
  "use client";
2
2
  import { jsx } from "react/jsx-runtime";
3
+ import { useState } from "react";
4
+ import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
3
5
  import { useConfig } from "@payloadcms/ui";
4
6
  import { CommentsDrawerProvider } from "../CommentsDrawerProvider";
5
7
  import { CommentsProvider } from "../CommentsProvider";
6
8
  function CommentsProviderWrapper({ children }) {
7
9
  const { config } = useConfig();
10
+ const [queryClient] = useState(
11
+ () => new QueryClient({
12
+ defaultOptions: {
13
+ queries: { retry: 1 },
14
+ mutations: { retry: 0 }
15
+ }
16
+ })
17
+ );
8
18
  const pluginConfig = config.admin?.custom?.commentsPlugin;
9
19
  const usernameFieldRawPath = pluginConfig?.usernameFieldPath;
10
20
  const usernameFieldPath = usernameFieldRawPath === "" ? void 0 : usernameFieldRawPath;
11
- return /* @__PURE__ */ jsx(CommentsProvider, { usernameFieldPath, children: /* @__PURE__ */ jsx(CommentsDrawerProvider, { children }) });
21
+ return /* @__PURE__ */ jsx(QueryClientProvider, { client: queryClient, children: /* @__PURE__ */ jsx(CommentsProvider, { usernameFieldPath, children: /* @__PURE__ */ jsx(CommentsDrawerProvider, { children }) }) });
12
22
  }
13
23
  export {
14
24
  CommentsProviderWrapper
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/providers/CommentsProviderWrapper/index.tsx"],"sourcesContent":["\"use client\";\n\nimport type { ReactNode } from \"react\";\nimport { useConfig } from \"@payloadcms/ui\";\nimport { CommentsDrawerProvider } from \"../CommentsDrawerProvider\";\nimport { CommentsProvider } from \"../CommentsProvider\";\nimport type { CommentsPluginConfigStorage } from \"../../types\";\n\ninterface Props {\n children: ReactNode;\n}\n\nexport function CommentsProviderWrapper({ children }: Props) {\n const { config } = useConfig();\n\n const pluginConfig = config.admin?.custom?.commentsPlugin as CommentsPluginConfigStorage | undefined;\n const usernameFieldRawPath = pluginConfig?.usernameFieldPath;\n const usernameFieldPath = usernameFieldRawPath === \"\" ? undefined : usernameFieldRawPath;\n\n return (\n <CommentsProvider usernameFieldPath={usernameFieldPath}>\n <CommentsDrawerProvider>{children}</CommentsDrawerProvider>\n </CommentsProvider>\n );\n}\n"],"mappings":";AAqBM;AAlBN,SAAS,iBAAiB;AAC1B,SAAS,8BAA8B;AACvC,SAAS,wBAAwB;AAO1B,SAAS,wBAAwB,EAAE,SAAS,GAAU;AAC3D,QAAM,EAAE,OAAO,IAAI,UAAU;AAE7B,QAAM,eAAe,OAAO,OAAO,QAAQ;AAC3C,QAAM,uBAAuB,cAAc;AAC3C,QAAM,oBAAoB,yBAAyB,KAAK,SAAY;AAEpE,SACE,oBAAC,oBAAiB,mBAChB,8BAAC,0BAAwB,UAAS,GACpC;AAEJ;","names":[]}
1
+ {"version":3,"sources":["../../../src/providers/CommentsProviderWrapper/index.tsx"],"sourcesContent":["\"use client\";\n\nimport { useState, type ReactNode } from \"react\";\nimport { QueryClient, QueryClientProvider } from \"@tanstack/react-query\";\nimport { useConfig } from \"@payloadcms/ui\";\nimport { CommentsDrawerProvider } from \"../CommentsDrawerProvider\";\nimport { CommentsProvider } from \"../CommentsProvider\";\nimport type { CommentsPluginConfigStorage } from \"../../types\";\n\ninterface Props {\n children: ReactNode;\n}\n\nexport function CommentsProviderWrapper({ children }: Props) {\n const { config } = useConfig();\n const [queryClient] = useState(\n () =>\n new QueryClient({\n defaultOptions: {\n queries: { retry: 1 },\n mutations: { retry: 0 },\n },\n }),\n );\n\n const pluginConfig = config.admin?.custom?.commentsPlugin as CommentsPluginConfigStorage | undefined;\n const usernameFieldRawPath = pluginConfig?.usernameFieldPath;\n const usernameFieldPath = usernameFieldRawPath === \"\" ? undefined : usernameFieldRawPath;\n\n return (\n <QueryClientProvider client={queryClient}>\n <CommentsProvider usernameFieldPath={usernameFieldPath}>\n <CommentsDrawerProvider>{children}</CommentsDrawerProvider>\n </CommentsProvider>\n </QueryClientProvider>\n );\n}\n"],"mappings":";AAgCQ;AA9BR,SAAS,gBAAgC;AACzC,SAAS,aAAa,2BAA2B;AACjD,SAAS,iBAAiB;AAC1B,SAAS,8BAA8B;AACvC,SAAS,wBAAwB;AAO1B,SAAS,wBAAwB,EAAE,SAAS,GAAU;AAC3D,QAAM,EAAE,OAAO,IAAI,UAAU;AAC7B,QAAM,CAAC,WAAW,IAAI;AAAA,IACpB,MACE,IAAI,YAAY;AAAA,MACd,gBAAgB;AAAA,QACd,SAAS,EAAE,OAAO,EAAE;AAAA,QACpB,WAAW,EAAE,OAAO,EAAE;AAAA,MACxB;AAAA,IACF,CAAC;AAAA,EACL;AAEA,QAAM,eAAe,OAAO,OAAO,QAAQ;AAC3C,QAAM,uBAAuB,cAAc;AAC3C,QAAM,oBAAoB,yBAAyB,KAAK,SAAY;AAEpE,SACE,oBAAC,uBAAoB,QAAQ,aAC3B,8BAAC,oBAAiB,mBAChB,8BAAC,0BAAwB,UAAS,GACpC,GACF;AAEJ;","names":[]}
@@ -5,7 +5,10 @@ interface Props {
5
5
  enabledGlobals?: string[];
6
6
  user?: TypedUser | null;
7
7
  options?: BaseServiceOptions;
8
+ docId?: string | number;
9
+ filterCollectionSlug?: string;
10
+ filterGlobalSlug?: string;
8
11
  }
9
- export declare function findAllComments({ enabledCollections, enabledGlobals, options }?: Props): Promise<Response<Comment[]>>;
12
+ export declare function findAllComments({ enabledCollections, enabledGlobals, options, docId, filterCollectionSlug, filterGlobalSlug, }?: Props): Promise<Response<Comment[]>>;
10
13
  export {};
11
14
  //# sourceMappingURL=findAllComments.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"findAllComments.d.ts","sourceRoot":"","sources":["../../src/services/findAllComments.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAS,MAAM,SAAS,CAAC;AAIhD,OAAO,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAGtE,UAAU,KAAK;IACb,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC9B,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,IAAI,CAAC,EAAE,SAAS,GAAG,IAAI,CAAC;IACxB,OAAO,CAAC,EAAE,kBAAkB,CAAC;CAC9B;AAED,wBAAsB,eAAe,CAAC,EAAE,kBAAkB,EAAE,cAAc,EAAE,OAAO,EAAE,GAAE,KAAU,GAAG,OAAO,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC,CA6C/H"}
1
+ {"version":3,"file":"findAllComments.d.ts","sourceRoot":"","sources":["../../src/services/findAllComments.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAS,MAAM,SAAS,CAAC;AAIhD,OAAO,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAGtE,UAAU,KAAK;IACb,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC9B,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,IAAI,CAAC,EAAE,SAAS,GAAG,IAAI,CAAC;IACxB,OAAO,CAAC,EAAE,kBAAkB,CAAC;IAC7B,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED,wBAAsB,eAAe,CAAC,EACpC,kBAAkB,EAClB,cAAc,EACd,OAAO,EACP,KAAK,EACL,oBAAoB,EACpB,gBAAgB,GACjB,GAAE,KAAU,GAAG,OAAO,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC,CAkE3C"}
@@ -3,23 +3,49 @@ import { extractPayload } from "../utils/payload/extractPayload";
3
3
  import { DEFAULT_COLLECTION_SLUG } from "../constants";
4
4
  import { getDefaultErrorMessage } from "../utils/error/getDefaultErrorMessage";
5
5
  import { getCurrentTenantId } from "./getCurrentTenantId";
6
- async function findAllComments({ enabledCollections, enabledGlobals, options } = {}) {
6
+ async function findAllComments({
7
+ enabledCollections,
8
+ enabledGlobals,
9
+ options,
10
+ docId,
11
+ filterCollectionSlug,
12
+ filterGlobalSlug
13
+ } = {}) {
7
14
  try {
8
15
  const payload = await extractPayload(options?.payload);
9
16
  const tenantId = await getCurrentTenantId(payload);
10
17
  const where = {};
11
- const hasCollections = (enabledCollections?.length ?? 0) > 0;
12
- const hasGlobals = (enabledGlobals?.length ?? 0) > 0;
13
- if (hasCollections || hasGlobals) {
14
- where.or = [
15
- ...hasCollections ? [{ collectionSlug: { in: enabledCollections } }] : [],
16
- ...hasGlobals ? [{ globalSlug: { in: enabledGlobals } }] : []
18
+ if (docId && filterCollectionSlug) {
19
+ where.and = [
20
+ {
21
+ documentId: { equals: docId }
22
+ },
23
+ {
24
+ collectionSlug: { equals: filterCollectionSlug }
25
+ }
17
26
  ];
27
+ } else if (filterGlobalSlug) {
28
+ where.globalSlug = { equals: filterGlobalSlug };
29
+ } else {
30
+ const hasCollections = (enabledCollections?.length ?? 0) > 0;
31
+ const hasGlobals = (enabledGlobals?.length ?? 0) > 0;
32
+ if (hasCollections || hasGlobals) {
33
+ where.or = [
34
+ ...hasCollections ? [
35
+ {
36
+ collectionSlug: { in: enabledCollections }
37
+ }
38
+ ] : [],
39
+ ...hasGlobals ? [
40
+ {
41
+ globalSlug: { in: enabledGlobals }
42
+ }
43
+ ] : []
44
+ ];
45
+ }
18
46
  }
19
47
  if (tenantId) {
20
- where.tenant = {
21
- equals: tenantId
22
- };
48
+ where.tenant = { equals: tenantId };
23
49
  }
24
50
  const { docs: comments } = await payload.find({
25
51
  collection: DEFAULT_COLLECTION_SLUG,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/services/findAllComments.ts"],"sourcesContent":["\"use server\";\n\nimport type { TypedUser, Where } from \"payload\";\nimport { extractPayload } from \"../utils/payload/extractPayload\";\nimport { DEFAULT_COLLECTION_SLUG } from \"../constants\";\nimport { getDefaultErrorMessage } from \"../utils/error/getDefaultErrorMessage\";\nimport type { Response, Comment, BaseServiceOptions } from \"../types\";\nimport { getCurrentTenantId } from \"./getCurrentTenantId\";\n\ninterface Props {\n enabledCollections?: string[];\n enabledGlobals?: string[];\n user?: TypedUser | null;\n options?: BaseServiceOptions;\n}\n\nexport async function findAllComments({ enabledCollections, enabledGlobals, options }: Props = {}): Promise<Response<Comment[]>> {\n try {\n const payload = await extractPayload(options?.payload);\n\n const tenantId = await getCurrentTenantId(payload);\n\n const where: Where = {};\n\n const hasCollections = (enabledCollections?.length ?? 0) > 0;\n const hasGlobals = (enabledGlobals?.length ?? 0) > 0;\n\n if (hasCollections || hasGlobals) {\n where.or = [\n ...(hasCollections ? [{ collectionSlug: { in: enabledCollections } }] : []),\n ...(hasGlobals ? [{ globalSlug: { in: enabledGlobals } }] : []),\n ];\n }\n\n if (tenantId) {\n where.tenant = {\n equals: tenantId,\n };\n }\n\n const { docs: comments } = await payload.find({\n collection: DEFAULT_COLLECTION_SLUG,\n where: Object.keys(where).length ? where : undefined,\n sort: \"createdAt\",\n limit: 200,\n depth: 1,\n overrideAccess: true,\n });\n\n return {\n success: true,\n data: comments as unknown as Comment[],\n };\n } catch (e) {\n console.error(\"findAllComments failed:\", e);\n\n return {\n success: false,\n error: getDefaultErrorMessage(e),\n };\n }\n}\n"],"mappings":";AAGA,SAAS,sBAAsB;AAC/B,SAAS,+BAA+B;AACxC,SAAS,8BAA8B;AAEvC,SAAS,0BAA0B;AASnC,eAAsB,gBAAgB,EAAE,oBAAoB,gBAAgB,QAAQ,IAAW,CAAC,GAAiC;AAC/H,MAAI;AACF,UAAM,UAAU,MAAM,eAAe,SAAS,OAAO;AAErD,UAAM,WAAW,MAAM,mBAAmB,OAAO;AAEjD,UAAM,QAAe,CAAC;AAEtB,UAAM,kBAAkB,oBAAoB,UAAU,KAAK;AAC3D,UAAM,cAAc,gBAAgB,UAAU,KAAK;AAEnD,QAAI,kBAAkB,YAAY;AAChC,YAAM,KAAK;AAAA,QACT,GAAI,iBAAiB,CAAC,EAAE,gBAAgB,EAAE,IAAI,mBAAmB,EAAE,CAAC,IAAI,CAAC;AAAA,QACzE,GAAI,aAAa,CAAC,EAAE,YAAY,EAAE,IAAI,eAAe,EAAE,CAAC,IAAI,CAAC;AAAA,MAC/D;AAAA,IACF;AAEA,QAAI,UAAU;AACZ,YAAM,SAAS;AAAA,QACb,QAAQ;AAAA,MACV;AAAA,IACF;AAEA,UAAM,EAAE,MAAM,SAAS,IAAI,MAAM,QAAQ,KAAK;AAAA,MAC5C,YAAY;AAAA,MACZ,OAAO,OAAO,KAAK,KAAK,EAAE,SAAS,QAAQ;AAAA,MAC3C,MAAM;AAAA,MACN,OAAO;AAAA,MACP,OAAO;AAAA,MACP,gBAAgB;AAAA,IAClB,CAAC;AAED,WAAO;AAAA,MACL,SAAS;AAAA,MACT,MAAM;AAAA,IACR;AAAA,EACF,SAAS,GAAG;AACV,YAAQ,MAAM,2BAA2B,CAAC;AAE1C,WAAO;AAAA,MACL,SAAS;AAAA,MACT,OAAO,uBAAuB,CAAC;AAAA,IACjC;AAAA,EACF;AACF;","names":[]}
1
+ {"version":3,"sources":["../../src/services/findAllComments.ts"],"sourcesContent":["\"use server\";\n\nimport type { TypedUser, Where } from \"payload\";\nimport { extractPayload } from \"../utils/payload/extractPayload\";\nimport { DEFAULT_COLLECTION_SLUG } from \"../constants\";\nimport { getDefaultErrorMessage } from \"../utils/error/getDefaultErrorMessage\";\nimport type { Response, Comment, BaseServiceOptions } from \"../types\";\nimport { getCurrentTenantId } from \"./getCurrentTenantId\";\n\ninterface Props {\n enabledCollections?: string[];\n enabledGlobals?: string[];\n user?: TypedUser | null;\n options?: BaseServiceOptions;\n docId?: string | number;\n filterCollectionSlug?: string;\n filterGlobalSlug?: string;\n}\n\nexport async function findAllComments({\n enabledCollections,\n enabledGlobals,\n options,\n docId,\n filterCollectionSlug,\n filterGlobalSlug,\n}: Props = {}): Promise<Response<Comment[]>> {\n try {\n const payload = await extractPayload(options?.payload);\n const tenantId = await getCurrentTenantId(payload);\n\n const where: Where = {};\n\n if (docId && filterCollectionSlug) {\n where.and = [\n {\n documentId: { equals: docId },\n },\n {\n collectionSlug: { equals: filterCollectionSlug },\n },\n ];\n } else if (filterGlobalSlug) {\n where.globalSlug = { equals: filterGlobalSlug };\n } else {\n const hasCollections = (enabledCollections?.length ?? 0) > 0;\n const hasGlobals = (enabledGlobals?.length ?? 0) > 0;\n\n if (hasCollections || hasGlobals) {\n where.or = [\n ...(hasCollections ?\n [\n {\n collectionSlug: { in: enabledCollections },\n },\n ]\n : []),\n ...(hasGlobals ?\n [\n {\n globalSlug: { in: enabledGlobals },\n },\n ]\n : []),\n ];\n }\n }\n\n if (tenantId) {\n where.tenant = { equals: tenantId };\n }\n\n const { docs: comments } = await payload.find({\n collection: DEFAULT_COLLECTION_SLUG,\n where: Object.keys(where).length ? where : undefined,\n sort: \"createdAt\",\n limit: 200,\n depth: 1,\n overrideAccess: true,\n });\n\n return {\n success: true,\n data: comments as unknown as Comment[],\n };\n } catch (e) {\n console.error(\"findAllComments failed:\", e);\n return {\n success: false,\n error: getDefaultErrorMessage(e),\n };\n }\n}\n"],"mappings":";AAGA,SAAS,sBAAsB;AAC/B,SAAS,+BAA+B;AACxC,SAAS,8BAA8B;AAEvC,SAAS,0BAA0B;AAYnC,eAAsB,gBAAgB;AAAA,EACpC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,IAAW,CAAC,GAAiC;AAC3C,MAAI;AACF,UAAM,UAAU,MAAM,eAAe,SAAS,OAAO;AACrD,UAAM,WAAW,MAAM,mBAAmB,OAAO;AAEjD,UAAM,QAAe,CAAC;AAEtB,QAAI,SAAS,sBAAsB;AACjC,YAAM,MAAM;AAAA,QACV;AAAA,UACE,YAAY,EAAE,QAAQ,MAAM;AAAA,QAC9B;AAAA,QACA;AAAA,UACE,gBAAgB,EAAE,QAAQ,qBAAqB;AAAA,QACjD;AAAA,MACF;AAAA,IACF,WAAW,kBAAkB;AAC3B,YAAM,aAAa,EAAE,QAAQ,iBAAiB;AAAA,IAChD,OAAO;AACL,YAAM,kBAAkB,oBAAoB,UAAU,KAAK;AAC3D,YAAM,cAAc,gBAAgB,UAAU,KAAK;AAEnD,UAAI,kBAAkB,YAAY;AAChC,cAAM,KAAK;AAAA,UACT,GAAI,iBACF;AAAA,YACE;AAAA,cACE,gBAAgB,EAAE,IAAI,mBAAmB;AAAA,YAC3C;AAAA,UACF,IACA,CAAC;AAAA,UACH,GAAI,aACF;AAAA,YACE;AAAA,cACE,YAAY,EAAE,IAAI,eAAe;AAAA,YACnC;AAAA,UACF,IACA,CAAC;AAAA,QACL;AAAA,MACF;AAAA,IACF;AAEA,QAAI,UAAU;AACZ,YAAM,SAAS,EAAE,QAAQ,SAAS;AAAA,IACpC;AAEA,UAAM,EAAE,MAAM,SAAS,IAAI,MAAM,QAAQ,KAAK;AAAA,MAC5C,YAAY;AAAA,MACZ,OAAO,OAAO,KAAK,KAAK,EAAE,SAAS,QAAQ;AAAA,MAC3C,MAAM;AAAA,MACN,OAAO;AAAA,MACP,OAAO;AAAA,MACP,gBAAgB;AAAA,IAClB,CAAC;AAED,WAAO;AAAA,MACL,SAAS;AAAA,MACT,MAAM;AAAA,IACR;AAAA,EACF,SAAS,GAAG;AACV,YAAQ,MAAM,2BAA2B,CAAC;AAC1C,WAAO;AAAA,MACL,SAAS;AAAA,MACT,OAAO,uBAAuB,CAAC;AAAA,IACjC;AAAA,EACF;AACF;","names":[]}
package/dist/styles.css CHANGED
@@ -1,2 +1,2 @@
1
1
  /*! tailwindcss v4.2.1 | MIT License | https://tailwindcss.com */
2
- @layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-border-style:solid;--tw-leading:initial;--tw-font-weight:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-duration:initial;--tw-content:""}}}:root,:host{--color-black:#000;--spacing:.25rem;--text-2xl:1.5rem;--text-2xl--line-height:calc(2 / 1.5);--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--leading-normal:1.5;--radius-sm:.25rem;--radius-md:.375rem;--animate-spin:spin 1s linear infinite;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1)}.pointer-events-none{pointer-events:none}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.sticky{position:sticky}.inset-0{inset:calc(var(--spacing) * 0)}.start{inset-inline-start:var(--spacing)}.top-0{top:calc(var(--spacing) * 0)}.top-3{top:calc(var(--spacing) * 3)}.right-3{right:calc(var(--spacing) * 3)}.z-29{z-index:29}.m-0{margin:calc(var(--spacing) * 0)}.mb-1{margin-bottom:calc(var(--spacing) * 1)}.mb-3{margin-bottom:calc(var(--spacing) * 3)}.ml-auto{margin-left:auto}.box-border{box-sizing:border-box}.block{display:block}.flex{display:flex}.hidden{display:none}.h-4{height:calc(var(--spacing) * 4)}.h-9{height:calc(var(--spacing) * 9)}.h-\[20px\]{height:20px}.h-\[24px\]{height:24px}.min-h-5{min-height:calc(var(--spacing) * 5)}.w-4{width:calc(var(--spacing) * 4)}.w-9{width:calc(var(--spacing) * 9)}.w-80{width:calc(var(--spacing) * 80)}.w-\[20px\]{width:20px}.w-\[24px\]{width:24px}.w-auto{width:auto}.w-full{width:100%}.w-px{width:1px}.max-w-150{max-width:calc(var(--spacing) * 150)}.flex-1{flex:1}.shrink-0{flex-shrink:0}.-rotate-90{rotate:-90deg}.transform{transform:var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,)}.animate-spin{animation:var(--animate-spin)}.cursor-pointer{cursor:pointer}.flex-col{flex-direction:column}.items-center{align-items:center}.items-start{align-items:flex-start}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.gap-1{gap:calc(var(--spacing) * 1)}.gap-1\.5{gap:calc(var(--spacing) * 1.5)}.gap-2{gap:calc(var(--spacing) * 2)}.gap-2\.5{gap:calc(var(--spacing) * 2.5)}.gap-3{gap:calc(var(--spacing) * 3)}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.rounded{border-radius:.25rem}.rounded-full{border-radius:3.40282e38px}.rounded-md{border-radius:var(--radius-md)}.rounded-sm{border-radius:var(--radius-sm)}.border{border-style:var(--tw-border-style);border-width:1px}.border-l-2{border-left-style:var(--tw-border-style);border-left-width:2px}.border-none{--tw-border-style:none;border-style:none}.border-\(--theme-elevation-100\){border-color:var(--theme-elevation-100)}.border-transparent{border-color:#0000}.bg-\(--theme-bg\){background-color:var(--theme-bg)}.bg-\(--theme-elevation-0\){background-color:var(--theme-elevation-0)}.bg-\(--theme-elevation-100\){background-color:var(--theme-elevation-100)}.bg-\(--theme-elevation-150\){background-color:var(--theme-elevation-150)}.bg-\(--theme-elevation-1000\){background-color:var(--theme-elevation-1000)}.bg-\[\#36c5f021\]{background-color:#36c5f021}.bg-\[\#f0be3621\]{background-color:#f0be3621}.bg-black\/50{background-color:#00000080}@supports (color:color-mix(in lab, red, red)){.bg-black\/50{background-color:color-mix(in oklab, var(--color-black) 50%, transparent)}}.bg-transparent{background-color:#0000}.p-0{padding:calc(var(--spacing) * 0)}.p-1{padding:calc(var(--spacing) * 1)}.px-0\.5{padding-inline:calc(var(--spacing) * .5)}.px-1{padding-inline:calc(var(--spacing) * 1)}.px-2\.5{padding-inline:calc(var(--spacing) * 2.5)}.px-3{padding-inline:calc(var(--spacing) * 3)}.py-1\.5{padding-block:calc(var(--spacing) * 1.5)}.py-2{padding-block:calc(var(--spacing) * 2)}.py-5{padding-block:calc(var(--spacing) * 5)}.py-6{padding-block:calc(var(--spacing) * 6)}.pt-2{padding-top:calc(var(--spacing) * 2)}.pb-1\.25{padding-bottom:calc(var(--spacing) * 1.25)}.pb-5{padding-bottom:calc(var(--spacing) * 5)}.pl-3{padding-left:calc(var(--spacing) * 3)}.text-center{text-align:center}.text-2xl{font-size:var(--text-2xl);line-height:var(--tw-leading,var(--text-2xl--line-height))}.text-\[11px\]{font-size:11px}.text-\[12px\]{font-size:12px}.text-\[13px\]{font-size:13px}.text-\[14px\]{font-size:14px}.leading-5{--tw-leading:calc(var(--spacing) * 5);line-height:calc(var(--spacing) * 5)}.leading-none{--tw-leading:1;line-height:1}.leading-normal{--tw-leading:var(--leading-normal);line-height:var(--leading-normal)}.font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.wrap-break-word{overflow-wrap:break-word}.whitespace-pre-wrap{white-space:pre-wrap}.text-\(--theme-elevation-0\){color:var(--theme-elevation-0)}.text-\(--theme-elevation-450\){color:var(--theme-elevation-450)}.text-\(--theme-elevation-500\){color:var(--theme-elevation-500)}.text-\(--theme-elevation-600\){color:var(--theme-elevation-600)}.text-\(--theme-text\){color:var(--theme-text)}.text-\[\#1264a3\]{color:#1264a3}.text-\[\#a36e12\]{color:#a36e12}.opacity-0{opacity:0}.opacity-100{opacity:1}.shadow-\[0_-2px_16px_-2px_rgba\(0\,0\,0\,0\.2\)\]{--tw-shadow:0 -2px 16px -2px var(--tw-shadow-color,#0003);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.filter{filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-opacity{transition-property:opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-transform{transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.duration-150{--tw-duration:.15s;transition-duration:.15s}.outline-none{--tw-outline-style:none;outline-style:none}.select-none{-webkit-user-select:none;user-select:none}.group-focus-within\:flex:is(:where(.group):focus-within *){display:flex}@media (hover:hover){.group-hover\:pointer-events-auto:is(:where(.group):hover *){pointer-events:auto}.group-hover\:opacity-100:is(:where(.group):hover *){opacity:1}}.focus-within\:border-\(--theme-elevation-150\):focus-within{border-color:var(--theme-elevation-150)}@media (hover:hover){.hover\:bg-\(--theme-elevation-50\):hover{background-color:var(--theme-elevation-50)}.hover\:bg-\(--theme-elevation-150\):hover{background-color:var(--theme-elevation-150)}.hover\:bg-\(--theme-elevation-800\):hover{background-color:var(--theme-elevation-800)}.hover\:text-\(--theme-text\):hover{color:var(--theme-text)}}.\[\&\.is-empty\]\:before\:pointer-events-none.is-empty:before{content:var(--tw-content);pointer-events:none}.\[\&\.is-empty\]\:before\:absolute.is-empty:before{content:var(--tw-content);position:absolute}.\[\&\.is-empty\]\:before\:text-\(--theme-elevation-450\).is-empty:before{content:var(--tw-content);color:var(--theme-elevation-450)}.\[\&\.is-empty\]\:before\:content-\[attr\(data-placeholder\)\].is-empty:before{--tw-content:attr(data-placeholder);content:var(--tw-content)}.comments-drawer .gutter{padding:0 20px!important}.comments-drawer .drawer__content{--gutter-h:1px}.comments-drawer header .rs__control{min-width:120px;min-height:0;padding:2px 4px;font-size:13px}.comments-drawer header .rs__single-value,.comments-drawer header .rs__option{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-duration{syntax:"*";inherits:false}@property --tw-content{syntax:"*";inherits:false;initial-value:""}@keyframes spin{to{transform:rotate(360deg)}}
2
+ @layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-border-style:solid;--tw-leading:initial;--tw-font-weight:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-duration:initial;--tw-content:""}}}:root,:host{--color-green-500:oklch(72.3% .219 149.579);--color-black:#000;--spacing:.25rem;--text-2xl:1.5rem;--text-2xl--line-height:calc(2 / 1.5);--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--leading-normal:1.5;--radius-sm:.25rem;--radius-md:.375rem;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1)}.pointer-events-none{pointer-events:none}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.sticky{position:sticky}.inset-0{inset:calc(var(--spacing) * 0)}.start{inset-inline-start:var(--spacing)}.top-0{top:calc(var(--spacing) * 0)}.top-3{top:calc(var(--spacing) * 3)}.right-3{right:calc(var(--spacing) * 3)}.z-10{z-index:10}.z-29{z-index:29}.m-0{margin:calc(var(--spacing) * 0)}.mb-1{margin-bottom:calc(var(--spacing) * 1)}.ml-auto{margin-left:auto}.box-border{box-sizing:border-box}.block{display:block}.flex{display:flex}.hidden{display:none}.h-4{height:calc(var(--spacing) * 4)}.h-9{height:calc(var(--spacing) * 9)}.h-\[20px\]{height:20px}.h-\[24px\]{height:24px}.h-px{height:1px}.max-h-32{max-height:calc(var(--spacing) * 32)}.min-h-5{min-height:calc(var(--spacing) * 5)}.w-4{width:calc(var(--spacing) * 4)}.w-9{width:calc(var(--spacing) * 9)}.w-\[20px\]{width:20px}.w-\[24px\]{width:24px}.w-auto{width:auto}.w-full{width:100%}.w-px{width:1px}.max-w-150{max-width:calc(var(--spacing) * 150)}.min-w-0{min-width:calc(var(--spacing) * 0)}.flex-1{flex:1}.shrink-0{flex-shrink:0}.-rotate-90{rotate:-90deg}.transform{transform:var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,)}.cursor-pointer{cursor:pointer}.flex-col{flex-direction:column}.items-center{align-items:center}.items-start{align-items:flex-start}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.gap-1{gap:calc(var(--spacing) * 1)}.gap-1\.5{gap:calc(var(--spacing) * 1.5)}.gap-2{gap:calc(var(--spacing) * 2)}.gap-2\.5{gap:calc(var(--spacing) * 2.5)}.gap-3{gap:calc(var(--spacing) * 3)}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-y-auto{overflow-y:auto}.rounded{border-radius:.25rem}.rounded-full{border-radius:3.40282e38px}.rounded-md{border-radius:var(--radius-md)}.rounded-sm{border-radius:var(--radius-sm)}.border{border-style:var(--tw-border-style);border-width:1px}.border-l-2{border-left-style:var(--tw-border-style);border-left-width:2px}.border-none{--tw-border-style:none;border-style:none}.border-\(--theme-elevation-100\){border-color:var(--theme-elevation-100)}.border-transparent{border-color:#0000}.bg-\(--theme-bg\){background-color:var(--theme-bg)}.bg-\(--theme-elevation-0\){background-color:var(--theme-elevation-0)}.bg-\(--theme-elevation-100\){background-color:var(--theme-elevation-100)}.bg-\(--theme-elevation-150\){background-color:var(--theme-elevation-150)}.bg-\(--theme-elevation-1000\){background-color:var(--theme-elevation-1000)}.bg-\[\#36c5f021\]{background-color:#36c5f021}.bg-\[\#f0be3621\]{background-color:#f0be3621}.bg-black\/50{background-color:#00000080}@supports (color:color-mix(in lab, red, red)){.bg-black\/50{background-color:color-mix(in oklab, var(--color-black) 50%, transparent)}}.bg-current{background-color:currentColor}.bg-transparent{background-color:#0000}.p-0{padding:calc(var(--spacing) * 0)}.p-1{padding:calc(var(--spacing) * 1)}.px-0\.5{padding-inline:calc(var(--spacing) * .5)}.px-1{padding-inline:calc(var(--spacing) * 1)}.px-2\.5{padding-inline:calc(var(--spacing) * 2.5)}.px-3{padding-inline:calc(var(--spacing) * 3)}.py-1\.5{padding-block:calc(var(--spacing) * 1.5)}.py-2{padding-block:calc(var(--spacing) * 2)}.py-5{padding-block:calc(var(--spacing) * 5)}.py-6{padding-block:calc(var(--spacing) * 6)}.pt-2{padding-top:calc(var(--spacing) * 2)}.pb-1\.25{padding-bottom:calc(var(--spacing) * 1.25)}.pb-5{padding-bottom:calc(var(--spacing) * 5)}.pl-3{padding-left:calc(var(--spacing) * 3)}.text-center{text-align:center}.text-2xl{font-size:var(--text-2xl);line-height:var(--tw-leading,var(--text-2xl--line-height))}.text-\[11px\]{font-size:11px}.text-\[12px\]{font-size:12px}.text-\[13px\]{font-size:13px}.text-\[14px\]{font-size:14px}.leading-none{--tw-leading:1;line-height:1}.leading-normal{--tw-leading:var(--leading-normal);line-height:var(--leading-normal)}.font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.wrap-break-word{overflow-wrap:break-word}.whitespace-pre-wrap{white-space:pre-wrap}.text-\(--theme-elevation-0\){color:var(--theme-elevation-0)}.text-\(--theme-elevation-450\){color:var(--theme-elevation-450)}.text-\(--theme-elevation-500\){color:var(--theme-elevation-500)}.text-\(--theme-elevation-600\){color:var(--theme-elevation-600)}.text-\(--theme-text\){color:var(--theme-text)}.text-\[\#1264a3\]{color:#1264a3}.text-\[\#a36e12\]{color:#a36e12}.text-green-500{color:var(--color-green-500)}.opacity-0{opacity:0}.opacity-60{opacity:.6}.shadow-\[0_-2px_16px_-2px_rgba\(0\,0\,0\,0\.2\)\]{--tw-shadow:0 -2px 16px -2px var(--tw-shadow-color,#0003);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.blur{--tw-blur:blur(8px);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.filter{filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-opacity{transition-property:opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-transform{transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.duration-150{--tw-duration:.15s;transition-duration:.15s}.outline-none{--tw-outline-style:none;outline-style:none}.select-none{-webkit-user-select:none;user-select:none}.group-focus-within\:flex:is(:where(.group):focus-within *){display:flex}@media (hover:hover){.group-hover\:pointer-events-auto:is(:where(.group):hover *){pointer-events:auto}.group-hover\:opacity-100:is(:where(.group):hover *){opacity:1}}.focus-within\:border-\(--theme-elevation-150\):focus-within{border-color:var(--theme-elevation-150)}@media (hover:hover){.hover\:bg-\(--theme-elevation-50\):hover{background-color:var(--theme-elevation-50)}.hover\:bg-\(--theme-elevation-150\):hover{background-color:var(--theme-elevation-150)}.hover\:bg-\(--theme-elevation-800\):hover{background-color:var(--theme-elevation-800)}.hover\:text-\(--theme-text\):hover{color:var(--theme-text)}}@media (prefers-reduced-motion:reduce){.motion-reduce\:transition-none{transition-property:none}}.\[\&\.is-empty\]\:before\:pointer-events-none.is-empty:before{content:var(--tw-content);pointer-events:none}.\[\&\.is-empty\]\:before\:absolute.is-empty:before{content:var(--tw-content);position:absolute}.\[\&\.is-empty\]\:before\:text-\(--theme-elevation-450\).is-empty:before{content:var(--tw-content);color:var(--theme-elevation-450)}.\[\&\.is-empty\]\:before\:content-\[attr\(data-placeholder\)\].is-empty:before{--tw-content:attr(data-placeholder);content:var(--tw-content)}@media (hover:none){.\[\@media\(hover\:none\)\]\:opacity-100{opacity:1}}.comments-drawer .gutter{padding:0 20px!important}.comments-drawer .drawer__content{--gutter-h:1px}.comments-drawer .drawer__blur-bg{display:none}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-duration{syntax:"*";inherits:false}@property --tw-content{syntax:"*";inherits:false;initial-value:""}
@@ -1 +1 @@
1
- {"version":3,"file":"en.d.ts","sourceRoot":"","sources":["../../src/translations/en.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAEpD,eAAO,MAAM,EAAE,EAAE;IAAE,QAAQ,EAAE,oBAAoB,CAAA;CA+BhD,CAAC"}
1
+ {"version":3,"file":"en.d.ts","sourceRoot":"","sources":["../../src/translations/en.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAEpD,eAAO,MAAM,EAAE,EAAE;IAAE,QAAQ,EAAE,oBAAoB,CAAA;CA2BhD,CAAC"}
@@ -10,6 +10,7 @@ const en = {
10
10
  posting: "Posting\u2026",
11
11
  resolve: "Resolve",
12
12
  reopen: "Reopen",
13
+ resolved: "Resolved",
13
14
  delete: "Delete",
14
15
  general: "General",
15
16
  close: "Close",
@@ -21,13 +22,8 @@ const en = {
21
22
  failedToAdd: "Failed to add comment",
22
23
  unknownAuthor: "Unknown",
23
24
  deletedUser: "Deleted user",
24
- noOpenComments: "No open comments",
25
- noResolvedComments: "No resolved comments",
26
- noMentionedComments: "No comments mentioning you",
27
- filterOpen: "Open",
28
- filterResolved: "Resolved",
29
- filterMentioned: "Mentioned me",
30
- noMentionMatches: "No matches"
25
+ noMentionMatches: "No matches",
26
+ loadingComments: "Loading comments\u2026"
31
27
  }
32
28
  };
33
29
  export {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/translations/en.ts"],"sourcesContent":["import type { CommentsTranslations } from \"./types\";\n\nexport const en: { comments: CommentsTranslations } = {\n comments: {\n label: \"Comments\",\n openComments_one: \"{{count}} open comment\",\n openComments_other: \"{{count}} open comments\",\n add: \"Add comment\",\n writeComment: \"Write a comment\",\n comment: \"Comment\",\n cancel: \"Cancel\",\n posting: \"Posting…\",\n resolve: \"Resolve\",\n reopen: \"Reopen\",\n delete: \"Delete\",\n general: \"General\",\n close: \"Close\",\n syncingComments: \"Syncing comments\",\n openCommentsAria: \"Open comments\",\n failedToPost: \"Failed to post comment\",\n failedToUpdate: \"Failed to update comment\",\n failedToDelete: \"Failed to delete comment\",\n failedToAdd: \"Failed to add comment\",\n unknownAuthor: \"Unknown\",\n deletedUser: \"Deleted user\",\n noOpenComments: \"No open comments\",\n noResolvedComments: \"No resolved comments\",\n noMentionedComments: \"No comments mentioning you\",\n filterOpen: \"Open\",\n filterResolved: \"Resolved\",\n filterMentioned: \"Mentioned me\",\n noMentionMatches: \"No matches\",\n },\n};\n"],"mappings":"AAEO,MAAM,KAAyC;AAAA,EACpD,UAAU;AAAA,IACR,OAAO;AAAA,IACP,kBAAkB;AAAA,IAClB,oBAAoB;AAAA,IACpB,KAAK;AAAA,IACL,cAAc;AAAA,IACd,SAAS;AAAA,IACT,QAAQ;AAAA,IACR,SAAS;AAAA,IACT,SAAS;AAAA,IACT,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR,SAAS;AAAA,IACT,OAAO;AAAA,IACP,iBAAiB;AAAA,IACjB,kBAAkB;AAAA,IAClB,cAAc;AAAA,IACd,gBAAgB;AAAA,IAChB,gBAAgB;AAAA,IAChB,aAAa;AAAA,IACb,eAAe;AAAA,IACf,aAAa;AAAA,IACb,gBAAgB;AAAA,IAChB,oBAAoB;AAAA,IACpB,qBAAqB;AAAA,IACrB,YAAY;AAAA,IACZ,gBAAgB;AAAA,IAChB,iBAAiB;AAAA,IACjB,kBAAkB;AAAA,EACpB;AACF;","names":[]}
1
+ {"version":3,"sources":["../../src/translations/en.ts"],"sourcesContent":["import type { CommentsTranslations } from \"./types\";\n\nexport const en: { comments: CommentsTranslations } = {\n comments: {\n label: \"Comments\",\n openComments_one: \"{{count}} open comment\",\n openComments_other: \"{{count}} open comments\",\n add: \"Add comment\",\n writeComment: \"Write a comment\",\n comment: \"Comment\",\n cancel: \"Cancel\",\n posting: \"Posting…\",\n resolve: \"Resolve\",\n reopen: \"Reopen\",\n resolved: \"Resolved\",\n delete: \"Delete\",\n general: \"General\",\n close: \"Close\",\n syncingComments: \"Syncing comments\",\n openCommentsAria: \"Open comments\",\n failedToPost: \"Failed to post comment\",\n failedToUpdate: \"Failed to update comment\",\n failedToDelete: \"Failed to delete comment\",\n failedToAdd: \"Failed to add comment\",\n unknownAuthor: \"Unknown\",\n deletedUser: \"Deleted user\",\n noMentionMatches: \"No matches\",\n loadingComments: \"Loading comments…\",\n },\n};\n"],"mappings":"AAEO,MAAM,KAAyC;AAAA,EACpD,UAAU;AAAA,IACR,OAAO;AAAA,IACP,kBAAkB;AAAA,IAClB,oBAAoB;AAAA,IACpB,KAAK;AAAA,IACL,cAAc;AAAA,IACd,SAAS;AAAA,IACT,QAAQ;AAAA,IACR,SAAS;AAAA,IACT,SAAS;AAAA,IACT,QAAQ;AAAA,IACR,UAAU;AAAA,IACV,QAAQ;AAAA,IACR,SAAS;AAAA,IACT,OAAO;AAAA,IACP,iBAAiB;AAAA,IACjB,kBAAkB;AAAA,IAClB,cAAc;AAAA,IACd,gBAAgB;AAAA,IAChB,gBAAgB;AAAA,IAChB,aAAa;AAAA,IACb,eAAe;AAAA,IACf,aAAa;AAAA,IACb,kBAAkB;AAAA,IAClB,iBAAiB;AAAA,EACnB;AACF;","names":[]}
@@ -9,6 +9,7 @@ export interface CommentsTranslations {
9
9
  posting: string;
10
10
  resolve: string;
11
11
  reopen: string;
12
+ resolved: string;
12
13
  delete: string;
13
14
  general: string;
14
15
  close: string;
@@ -20,13 +21,8 @@ export interface CommentsTranslations {
20
21
  failedToAdd: string;
21
22
  unknownAuthor: string;
22
23
  deletedUser: string;
23
- noOpenComments: string;
24
- noResolvedComments: string;
25
- noMentionedComments: string;
26
- filterOpen: string;
27
- filterResolved: string;
28
- filterMentioned: string;
29
24
  noMentionMatches: string;
25
+ loadingComments: string;
30
26
  }
31
27
  export type Translations = Record<string, Partial<CommentsTranslations>>;
32
28
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/translations/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,oBAAoB;IACnC,KAAK,EAAE,MAAM,CAAC;IACd,gBAAgB,EAAE,MAAM,CAAC;IACzB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,eAAe,EAAE,MAAM,CAAC;IACxB,gBAAgB,EAAE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E,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,gBAAgB,EAAE,MAAM,CAAC;IACzB,eAAe,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,oBAAoB,CAAC,CAAC,CAAC"}
@@ -1,5 +1,3 @@
1
- export type FilterMode = "open" | "resolved" | "mentioned";
2
- export type LoadingStatus = "idle" | "loading" | "error" | "success";
3
1
  export type Response<T> = {
4
2
  success: true;
5
3
  data: T;
@@ -1 +1 @@
1
- {"version":3,"file":"general.d.ts","sourceRoot":"","sources":["../../src/types/general.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,UAAU,GAAG,WAAW,CAAC;AAE3D,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,CAAC;AAErE,MAAM,MAAM,QAAQ,CAAC,CAAC,IAClB;IACE,OAAO,EAAE,IAAI,CAAC;IACd,IAAI,EAAE,CAAC,CAAC;CACT,GACD;IACE,OAAO,EAAE,KAAK,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;CACf,CAAC"}
1
+ {"version":3,"file":"general.d.ts","sourceRoot":"","sources":["../../src/types/general.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,QAAQ,CAAC,CAAC,IAClB;IACE,OAAO,EAAE,IAAI,CAAC;IACd,IAAI,EAAE,CAAC,CAAC;CACT,GACD;IACE,OAAO,EAAE,KAAK,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;CACf,CAAC"}
@@ -2,7 +2,8 @@ export type { BaseServiceOptions, BaseDocument } from "./base";
2
2
  export type { CommentMention, Comment } from "./comment";
3
3
  export type { CollectionEntry, TenantPluginConfig, CommentsPluginConfig, CommentsPluginConfigStorage } from "./config";
4
4
  export type { User } from "./user";
5
- export type { FilterMode, LoadingStatus, Response } from "./general";
5
+ export type { Response } from "./general";
6
6
  export type { DocumentTitles } from "./collection";
7
- export type { EntityConfig, EntityLabel, EntityLabelsMap, FieldLabelSegment, GlobalFieldLabelRegistry, Mode } from "./entity";
7
+ export type { EntityConfig, EntityLabel, EntityLabelsMap, FieldLabelSegment, GlobalFieldLabelRegistry, Mode, } from "./entity";
8
+ export type { QueryContext } from "./query";
8
9
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAC/D,YAAY,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACzD,YAAY,EAAE,eAAe,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,2BAA2B,EAAE,MAAM,UAAU,CAAC;AACvH,YAAY,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AACnC,YAAY,EAAE,UAAU,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrE,YAAY,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AACnD,YAAY,EAAE,YAAY,EAAE,WAAW,EAAE,eAAe,EAAE,iBAAiB,EAAE,wBAAwB,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAC/D,YAAY,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACzD,YAAY,EAAE,eAAe,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,2BAA2B,EAAE,MAAM,UAAU,CAAC;AACvH,YAAY,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AACnC,YAAY,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAC1C,YAAY,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AACnD,YAAY,EACV,YAAY,EACZ,WAAW,EACX,eAAe,EACf,iBAAiB,EACjB,wBAAwB,EACxB,IAAI,GACL,MAAM,UAAU,CAAC;AAClB,YAAY,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC"}
@@ -0,0 +1,11 @@
1
+ export type QueryContext = {
2
+ mode: "doc";
3
+ collectionSlug: string;
4
+ docId: string;
5
+ } | {
6
+ mode: "global-doc";
7
+ globalSlug: string;
8
+ } | {
9
+ mode: "global";
10
+ };
11
+ //# sourceMappingURL=query.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"query.d.ts","sourceRoot":"","sources":["../../src/types/query.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,YAAY,GACpB;IACE,IAAI,EAAE,KAAK,CAAC;IACZ,cAAc,EAAE,MAAM,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;CACf,GACD;IACE,IAAI,EAAE,YAAY,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;CACpB,GACD;IAAE,IAAI,EAAE,QAAQ,CAAA;CAAE,CAAC"}
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=query.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,3 @@
1
+ import type { QueryContext } from "../../types";
2
+ export declare function toQueryContext(mode: "document" | "global-document" | "global", collectionSlug: string | null | undefined, documentId: number | null | undefined, globalSlug: string | null): QueryContext;
3
+ //# sourceMappingURL=toQueryContext.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"toQueryContext.d.ts","sourceRoot":"","sources":["../../../src/utils/query/toQueryContext.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEhD,wBAAgB,cAAc,CAC5B,IAAI,EAAE,UAAU,GAAG,iBAAiB,GAAG,QAAQ,EAC/C,cAAc,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EACzC,UAAU,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EACrC,UAAU,EAAE,MAAM,GAAG,IAAI,GACxB,YAAY,CAiBd"}
@@ -0,0 +1,20 @@
1
+ function toQueryContext(mode, collectionSlug, documentId, globalSlug) {
2
+ if (mode === "document" && collectionSlug && documentId) {
3
+ return {
4
+ mode: "doc",
5
+ collectionSlug,
6
+ docId: String(documentId)
7
+ };
8
+ }
9
+ if (mode === "global-document" && globalSlug) {
10
+ return {
11
+ mode: "global-doc",
12
+ globalSlug
13
+ };
14
+ }
15
+ return { mode: "global" };
16
+ }
17
+ export {
18
+ toQueryContext
19
+ };
20
+ //# sourceMappingURL=toQueryContext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/utils/query/toQueryContext.ts"],"sourcesContent":["import type { QueryContext } from \"../../types\";\n\nexport function toQueryContext(\n mode: \"document\" | \"global-document\" | \"global\",\n collectionSlug: string | null | undefined,\n documentId: number | null | undefined,\n globalSlug: string | null,\n): QueryContext {\n if (mode === \"document\" && collectionSlug && documentId) {\n return {\n mode: \"doc\",\n collectionSlug,\n docId: String(documentId),\n };\n }\n\n if (mode === \"global-document\" && globalSlug) {\n return {\n mode: \"global-doc\",\n globalSlug,\n };\n }\n\n return { mode: \"global\" };\n}\n"],"mappings":"AAEO,SAAS,eACd,MACA,gBACA,YACA,YACc;AACd,MAAI,SAAS,cAAc,kBAAkB,YAAY;AACvD,WAAO;AAAA,MACL,MAAM;AAAA,MACN;AAAA,MACA,OAAO,OAAO,UAAU;AAAA,IAC1B;AAAA,EACF;AAEA,MAAI,SAAS,qBAAqB,YAAY;AAC5C,WAAO;AAAA,MACL,MAAM;AAAA,MACN;AAAA,IACF;AAAA,EACF;AAEA,SAAO,EAAE,MAAM,SAAS;AAC1B;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@focus-reactive/payload-plugin-comments",
3
- "version": "1.1.1",
3
+ "version": "1.2.0",
4
4
  "license": "MIT",
5
5
  "author": "FocusReactive <ship@focusreactive.com>",
6
6
  "keywords": [
@@ -48,10 +48,6 @@
48
48
  "import": "./dist/providers/CommentsProviderWrapper/index.js",
49
49
  "types": "./dist/providers/CommentsProviderWrapper/index.d.ts"
50
50
  },
51
- "./providers/GlobalCommentsLoader": {
52
- "import": "./dist/providers/GlobalCommentsLoader/index.js",
53
- "types": "./dist/providers/GlobalCommentsLoader/index.d.ts"
54
- },
55
51
  "./styles.css": "./dist/styles.css"
56
52
  },
57
53
  "scripts": {
@@ -64,6 +60,7 @@
64
60
  "format:check": "prettier --check src/"
65
61
  },
66
62
  "dependencies": {
63
+ "@tanstack/react-query": "^5.0.0",
67
64
  "class-variance-authority": "^0.7.1",
68
65
  "clsx": "^2.1.1",
69
66
  "lucide-react": "^0.577.0",
@@ -1,3 +0,0 @@
1
- import type { FilterMode } from "../../types";
2
- export declare const FILTER_NO_COMMENTS_KEYS: Record<FilterMode, string>;
3
- //# sourceMappingURL=constants.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/components/CommentsPanel/constants.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C,eAAO,MAAM,uBAAuB,EAAE,MAAM,CAAC,UAAU,EAAE,MAAM,CAI9D,CAAC"}
@@ -1,9 +0,0 @@
1
- const FILTER_NO_COMMENTS_KEYS = {
2
- open: "comments:noOpenComments",
3
- resolved: "comments:noResolvedComments",
4
- mentioned: "comments:noMentionedComments"
5
- };
6
- export {
7
- FILTER_NO_COMMENTS_KEYS
8
- };
9
- //# sourceMappingURL=constants.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/components/CommentsPanel/constants.ts"],"sourcesContent":["import type { FilterMode } from \"../../types\";\n\nexport const FILTER_NO_COMMENTS_KEYS: Record<FilterMode, string> = {\n open: \"comments:noOpenComments\",\n resolved: \"comments:noResolvedComments\",\n mentioned: \"comments:noMentionedComments\",\n};\n"],"mappings":"AAEO,MAAM,0BAAsD;AAAA,EACjE,MAAM;AAAA,EACN,UAAU;AAAA,EACV,WAAW;AACb;","names":[]}
@@ -1,9 +0,0 @@
1
- import type { Comment, FilterMode } from "../../../types";
2
- interface Props {
3
- comments: Comment[];
4
- filter: FilterMode;
5
- currentUserId?: number | null;
6
- }
7
- export declare function filterComments({ comments, filter, currentUserId }: Props): Comment[];
8
- export {};
9
- //# sourceMappingURL=filterComments.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"filterComments.d.ts","sourceRoot":"","sources":["../../../../src/components/CommentsPanel/utils/filterComments.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE1D,UAAU,KAAK;IACb,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,MAAM,EAAE,UAAU,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC/B;AAED,wBAAgB,cAAc,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,aAAa,EAAE,EAAE,KAAK,aAkBxE"}
@@ -1,17 +0,0 @@
1
- function filterComments({ comments, filter, currentUserId }) {
2
- return comments.filter((comment) => {
3
- if (filter === "open") return !comment.isResolved;
4
- if (filter === "resolved") return comment.isResolved;
5
- if (filter === "mentioned") {
6
- return comment.mentions?.some(({ user: mentionUser }) => {
7
- if (typeof mentionUser === "number") return mentionUser === currentUserId;
8
- return mentionUser.id === currentUserId;
9
- }) ?? false;
10
- }
11
- return false;
12
- });
13
- }
14
- export {
15
- filterComments
16
- };
17
- //# sourceMappingURL=filterComments.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../src/components/CommentsPanel/utils/filterComments.ts"],"sourcesContent":["import type { Comment, FilterMode } from \"../../../types\";\n\ninterface Props {\n comments: Comment[];\n filter: FilterMode;\n currentUserId?: number | null;\n}\n\nexport function filterComments({ comments, filter, currentUserId }: Props) {\n return comments.filter((comment) => {\n if (filter === \"open\") return !comment.isResolved;\n\n if (filter === \"resolved\") return comment.isResolved;\n\n if (filter === \"mentioned\") {\n return (\n comment.mentions?.some(({ user: mentionUser }) => {\n if (typeof mentionUser === \"number\") return mentionUser === currentUserId;\n\n return mentionUser.id === currentUserId;\n }) ?? false\n );\n }\n\n return false;\n });\n}\n"],"mappings":"AAQO,SAAS,eAAe,EAAE,UAAU,QAAQ,cAAc,GAAU;AACzE,SAAO,SAAS,OAAO,CAAC,YAAY;AAClC,QAAI,WAAW,OAAQ,QAAO,CAAC,QAAQ;AAEvC,QAAI,WAAW,WAAY,QAAO,QAAQ;AAE1C,QAAI,WAAW,aAAa;AAC1B,aACE,QAAQ,UAAU,KAAK,CAAC,EAAE,MAAM,YAAY,MAAM;AAChD,YAAI,OAAO,gBAAgB,SAAU,QAAO,gBAAgB;AAE5D,eAAO,YAAY,OAAO;AAAA,MAC5B,CAAC,KAAK;AAAA,IAEV;AAEA,WAAO;AAAA,EACT,CAAC;AACH;","names":[]}
@@ -1,8 +0,0 @@
1
- interface Props {
2
- fieldPath: string;
3
- showTrigger: boolean;
4
- onToggle: (isOpen: boolean) => void;
5
- }
6
- export declare function AddCommentPopup({ fieldPath, showTrigger, onToggle }: Props): import("react/jsx-runtime").JSX.Element;
7
- export {};
8
- //# sourceMappingURL=AddCommentPopup.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AddCommentPopup.d.ts","sourceRoot":"","sources":["../../../src/components/FieldCommentLabel/AddCommentPopup.tsx"],"names":[],"mappings":"AAUA,UAAU,KAAK;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,OAAO,CAAC;IACrB,QAAQ,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;CACrC;AAED,wBAAgB,eAAe,CAAC,EAAE,SAAS,EAAE,WAAW,EAAE,QAAQ,EAAE,EAAE,KAAK,2CAyC1E"}
@@ -1,50 +0,0 @@
1
- "use client";
2
- import { jsx, jsxs } from "react/jsx-runtime";
3
- import { Popup, useTranslation } from "@payloadcms/ui";
4
- import { IconButton } from "../IconButton";
5
- import { cn } from "../../utils/general/cn";
6
- import { MessageSquarePlus } from "lucide-react";
7
- import { CommentEditor } from "../CommentEditor";
8
- import { useComments } from "../../providers/CommentsProvider";
9
- import { useRef } from "react";
10
- function AddCommentPopup({ fieldPath, showTrigger, onToggle }) {
11
- const { t } = useTranslation();
12
- const { mode, globalSlug } = useComments();
13
- const editorAPI = useRef(null);
14
- const trigger = /* @__PURE__ */ jsx(IconButton, { className: cn(showTrigger ? "opacity-100" : "opacity-0"), size: "sm", title: t("comments:add"), children: /* @__PURE__ */ jsx(MessageSquarePlus, { size: 14 }) });
15
- return /* @__PURE__ */ jsx(
16
- Popup,
17
- {
18
- buttonType: "custom",
19
- button: trigger,
20
- horizontalAlign: "right",
21
- size: "fit-content",
22
- onToggleOpen: (active) => {
23
- onToggle(active);
24
- setTimeout(() => editorAPI.current?.focus());
25
- },
26
- onToggleClose: () => {
27
- onToggle(false);
28
- editorAPI.current?.clear();
29
- },
30
- render: ({ close }) => /* @__PURE__ */ jsxs("div", { className: "w-80", children: [
31
- /* @__PURE__ */ jsx("p", { className: "m-0 mb-3 text-[14px] font-semibold text-(--theme-text)", children: t("comments:add") }),
32
- /* @__PURE__ */ jsx(
33
- CommentEditor,
34
- {
35
- ref: editorAPI,
36
- fieldPath,
37
- globalSlug: mode === "global-document" ? globalSlug ?? void 0 : void 0,
38
- onSuccessAddComment: close,
39
- onEscapePress: close,
40
- placeholder: `${t("comments:writeComment")}\u2026`
41
- }
42
- )
43
- ] })
44
- }
45
- );
46
- }
47
- export {
48
- AddCommentPopup
49
- };
50
- //# sourceMappingURL=AddCommentPopup.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/components/FieldCommentLabel/AddCommentPopup.tsx"],"sourcesContent":["\"use client\";\n\nimport { Popup, useTranslation } from \"@payloadcms/ui\";\nimport { IconButton } from \"../IconButton\";\nimport { cn } from \"../../utils/general/cn\";\nimport { MessageSquarePlus } from \"lucide-react\";\nimport { CommentEditor, type CommentEditorHandle } from \"../CommentEditor\";\nimport { useComments } from \"../../providers/CommentsProvider\";\nimport { useRef } from \"react\";\n\ninterface Props {\n fieldPath: string;\n showTrigger: boolean;\n onToggle: (isOpen: boolean) => void;\n}\n\nexport function AddCommentPopup({ fieldPath, showTrigger, onToggle }: Props) {\n const { t } = useTranslation();\n const { mode, globalSlug } = useComments();\n const editorAPI = useRef<CommentEditorHandle | null>(null);\n\n const trigger = (\n <IconButton className={cn(showTrigger ? \"opacity-100\" : \"opacity-0\")} size=\"sm\" title={t(\"comments:add\" as never)}>\n <MessageSquarePlus size={14} />\n </IconButton>\n );\n\n return (\n <Popup\n buttonType=\"custom\"\n button={trigger}\n horizontalAlign=\"right\"\n size=\"fit-content\"\n onToggleOpen={(active: boolean) => {\n onToggle(active);\n setTimeout(() => editorAPI.current?.focus());\n }}\n onToggleClose={() => {\n onToggle(false);\n editorAPI.current?.clear();\n }}\n render={({ close }) => (\n <div className=\"w-80\">\n <p className=\"m-0 mb-3 text-[14px] font-semibold text-(--theme-text)\">{t(\"comments:add\" as never)}</p>\n\n <CommentEditor\n ref={editorAPI}\n fieldPath={fieldPath}\n globalSlug={mode === \"global-document\" ? (globalSlug ?? undefined) : undefined}\n onSuccessAddComment={close}\n onEscapePress={close}\n placeholder={`${t(\"comments:writeComment\" as never)}…`}\n />\n </div>\n )}\n />\n );\n}\n"],"mappings":";AAuBM,cAmBE,YAnBF;AArBN,SAAS,OAAO,sBAAsB;AACtC,SAAS,kBAAkB;AAC3B,SAAS,UAAU;AACnB,SAAS,yBAAyB;AAClC,SAAS,qBAA+C;AACxD,SAAS,mBAAmB;AAC5B,SAAS,cAAc;AAQhB,SAAS,gBAAgB,EAAE,WAAW,aAAa,SAAS,GAAU;AAC3E,QAAM,EAAE,EAAE,IAAI,eAAe;AAC7B,QAAM,EAAE,MAAM,WAAW,IAAI,YAAY;AACzC,QAAM,YAAY,OAAmC,IAAI;AAEzD,QAAM,UACJ,oBAAC,cAAW,WAAW,GAAG,cAAc,gBAAgB,WAAW,GAAG,MAAK,MAAK,OAAO,EAAE,cAAuB,GAC9G,8BAAC,qBAAkB,MAAM,IAAI,GAC/B;AAGF,SACE;AAAA,IAAC;AAAA;AAAA,MACC,YAAW;AAAA,MACX,QAAQ;AAAA,MACR,iBAAgB;AAAA,MAChB,MAAK;AAAA,MACL,cAAc,CAAC,WAAoB;AACjC,iBAAS,MAAM;AACf,mBAAW,MAAM,UAAU,SAAS,MAAM,CAAC;AAAA,MAC7C;AAAA,MACA,eAAe,MAAM;AACnB,iBAAS,KAAK;AACd,kBAAU,SAAS,MAAM;AAAA,MAC3B;AAAA,MACA,QAAQ,CAAC,EAAE,MAAM,MACf,qBAAC,SAAI,WAAU,QACb;AAAA,4BAAC,OAAE,WAAU,0DAA0D,YAAE,cAAuB,GAAE;AAAA,QAElG;AAAA,UAAC;AAAA;AAAA,YACC,KAAK;AAAA,YACL;AAAA,YACA,YAAY,SAAS,oBAAqB,cAAc,SAAa;AAAA,YACrE,qBAAqB;AAAA,YACrB,eAAe;AAAA,YACf,aAAa,GAAG,EAAE,uBAAgC,CAAC;AAAA;AAAA,QACrD;AAAA,SACF;AAAA;AAAA,EAEJ;AAEJ;","names":[]}