@replyke/core 6.1.1 → 6.2.0-beta.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.
- package/dist/cjs/context/index.d.ts +1 -0
- package/dist/cjs/context/index.js +3 -1
- package/dist/cjs/context/index.js.map +1 -1
- package/dist/cjs/context/space-context.d.ts +9 -0
- package/dist/cjs/context/space-context.js +35 -0
- package/dist/cjs/context/space-context.js.map +1 -0
- package/dist/cjs/hooks/crypto/useSignTestingJwt.d.ts +1 -2
- package/dist/cjs/hooks/crypto/useSignTestingJwt.js +17 -10
- package/dist/cjs/hooks/crypto/useSignTestingJwt.js.map +1 -1
- package/dist/cjs/hooks/projects/useProjectData.js +1 -1
- package/dist/cjs/hooks/projects/useProjectData.js.map +1 -1
- package/dist/cjs/hooks/reports/index.d.ts +3 -0
- package/dist/cjs/hooks/reports/index.js +7 -1
- package/dist/cjs/hooks/reports/index.js.map +1 -1
- package/dist/cjs/hooks/reports/useFetchSpaceReports.d.ts +38 -0
- package/dist/cjs/hooks/reports/useFetchSpaceReports.js +96 -0
- package/dist/cjs/hooks/reports/useFetchSpaceReports.js.map +1 -0
- package/dist/cjs/hooks/reports/useHandleSpaceCommentReport.d.ts +30 -0
- package/dist/cjs/hooks/reports/useHandleSpaceCommentReport.js +92 -0
- package/dist/cjs/hooks/reports/useHandleSpaceCommentReport.js.map +1 -0
- package/dist/cjs/hooks/reports/useHandleSpaceEntityReport.d.ts +32 -0
- package/dist/cjs/hooks/reports/useHandleSpaceEntityReport.js +94 -0
- package/dist/cjs/hooks/reports/useHandleSpaceEntityReport.js.map +1 -0
- package/dist/cjs/hooks/space-lists/index.d.ts +3 -0
- package/dist/cjs/hooks/space-lists/index.js +11 -0
- package/dist/cjs/hooks/space-lists/index.js.map +1 -0
- package/dist/cjs/hooks/space-lists/useSpaceList.d.ts +36 -0
- package/dist/cjs/hooks/space-lists/useSpaceList.js +293 -0
- package/dist/cjs/hooks/space-lists/useSpaceList.js.map +1 -0
- package/dist/cjs/hooks/space-lists/useSpaceListActions.d.ts +33 -0
- package/dist/cjs/hooks/space-lists/useSpaceListActions.js +210 -0
- package/dist/cjs/hooks/space-lists/useSpaceListActions.js.map +1 -0
- package/dist/cjs/hooks/spaces/index.d.ts +22 -0
- package/dist/cjs/hooks/spaces/index.js +51 -0
- package/dist/cjs/hooks/spaces/index.js.map +1 -0
- package/dist/cjs/hooks/spaces/useApproveMember.d.ts +7 -0
- package/dist/cjs/hooks/spaces/useApproveMember.js +71 -0
- package/dist/cjs/hooks/spaces/useApproveMember.js.map +1 -0
- package/dist/cjs/hooks/spaces/useCreateSpace.d.ts +15 -0
- package/dist/cjs/hooks/spaces/useCreateSpace.js +70 -0
- package/dist/cjs/hooks/spaces/useCreateSpace.js.map +1 -0
- package/dist/cjs/hooks/spaces/useDeclineMember.d.ts +7 -0
- package/dist/cjs/hooks/spaces/useDeclineMember.js +71 -0
- package/dist/cjs/hooks/spaces/useDeclineMember.js.map +1 -0
- package/dist/cjs/hooks/spaces/useDeleteSpace.d.ts +5 -0
- package/dist/cjs/hooks/spaces/useDeleteSpace.js +71 -0
- package/dist/cjs/hooks/spaces/useDeleteSpace.js.map +1 -0
- package/dist/cjs/hooks/spaces/useFetchMySpaces.d.ts +8 -0
- package/dist/cjs/hooks/spaces/useFetchMySpaces.js +85 -0
- package/dist/cjs/hooks/spaces/useFetchMySpaces.js.map +1 -0
- package/dist/cjs/hooks/spaces/useFetchSpace.d.ts +5 -0
- package/dist/cjs/hooks/spaces/useFetchSpace.js +71 -0
- package/dist/cjs/hooks/spaces/useFetchSpace.js.map +1 -0
- package/dist/cjs/hooks/spaces/useFetchSpaceBreadcrumb.d.ts +5 -0
- package/dist/cjs/hooks/spaces/useFetchSpaceBreadcrumb.js +71 -0
- package/dist/cjs/hooks/spaces/useFetchSpaceBreadcrumb.js.map +1 -0
- package/dist/cjs/hooks/spaces/useFetchSpaceByShortId.d.ts +5 -0
- package/dist/cjs/hooks/spaces/useFetchSpaceByShortId.js +71 -0
- package/dist/cjs/hooks/spaces/useFetchSpaceByShortId.js.map +1 -0
- package/dist/cjs/hooks/spaces/useFetchSpaceBySlug.d.ts +5 -0
- package/dist/cjs/hooks/spaces/useFetchSpaceBySlug.js +71 -0
- package/dist/cjs/hooks/spaces/useFetchSpaceBySlug.js.map +1 -0
- package/dist/cjs/hooks/spaces/useFetchSpaceChildren.d.ts +8 -0
- package/dist/cjs/hooks/spaces/useFetchSpaceChildren.js +70 -0
- package/dist/cjs/hooks/spaces/useFetchSpaceChildren.js.map +1 -0
- package/dist/cjs/hooks/spaces/useFetchSpaceMembers.d.ts +10 -0
- package/dist/cjs/hooks/spaces/useFetchSpaceMembers.js +82 -0
- package/dist/cjs/hooks/spaces/useFetchSpaceMembers.js.map +1 -0
- package/dist/cjs/hooks/spaces/useJoinSpace.d.ts +5 -0
- package/dist/cjs/hooks/spaces/useJoinSpace.js +71 -0
- package/dist/cjs/hooks/spaces/useJoinSpace.js.map +1 -0
- package/dist/cjs/hooks/spaces/useLeaveSpace.d.ts +5 -0
- package/dist/cjs/hooks/spaces/useLeaveSpace.js +71 -0
- package/dist/cjs/hooks/spaces/useLeaveSpace.js.map +1 -0
- package/dist/cjs/hooks/spaces/useRemoveMember.d.ts +9 -0
- package/dist/cjs/hooks/spaces/useRemoveMember.js +71 -0
- package/dist/cjs/hooks/spaces/useRemoveMember.js.map +1 -0
- package/dist/cjs/hooks/spaces/useSpace.d.ts +3 -0
- package/dist/cjs/hooks/spaces/useSpace.js +13 -0
- package/dist/cjs/hooks/spaces/useSpace.js.map +1 -0
- package/dist/cjs/hooks/spaces/useSpaceData.d.ts +32 -0
- package/dist/cjs/hooks/spaces/useSpaceData.js +358 -0
- package/dist/cjs/hooks/spaces/useSpaceData.js.map +1 -0
- package/dist/cjs/hooks/spaces/useSpacePermissions.d.ts +18 -0
- package/dist/cjs/hooks/spaces/useSpacePermissions.js +53 -0
- package/dist/cjs/hooks/spaces/useSpacePermissions.js.map +1 -0
- package/dist/cjs/hooks/spaces/useUpdateMemberRole.d.ts +9 -0
- package/dist/cjs/hooks/spaces/useUpdateMemberRole.js +71 -0
- package/dist/cjs/hooks/spaces/useUpdateMemberRole.js.map +1 -0
- package/dist/cjs/hooks/spaces/useUpdateSpace.d.ts +17 -0
- package/dist/cjs/hooks/spaces/useUpdateSpace.js +71 -0
- package/dist/cjs/hooks/spaces/useUpdateSpace.js.map +1 -0
- package/dist/cjs/index.d.ts +10 -1
- package/dist/cjs/index.js +35 -2
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/interfaces/SpaceBreadcrumb.d.ts +5 -0
- package/dist/cjs/interfaces/SpaceBreadcrumb.js +3 -0
- package/dist/cjs/interfaces/SpaceBreadcrumb.js.map +1 -0
- package/dist/cjs/interfaces/SpaceListSortByOptions.d.ts +7 -0
- package/dist/cjs/interfaces/SpaceListSortByOptions.js +3 -0
- package/dist/cjs/interfaces/SpaceListSortByOptions.js.map +1 -0
- package/dist/cjs/interfaces/models/Space.d.ts +122 -0
- package/dist/cjs/interfaces/models/Space.js +3 -0
- package/dist/cjs/interfaces/models/Space.js.map +1 -0
- package/dist/cjs/interfaces/models/SpaceMember.d.ts +27 -0
- package/dist/cjs/interfaces/models/SpaceMember.js +3 -0
- package/dist/cjs/interfaces/models/SpaceMember.js.map +1 -0
- package/dist/cjs/interfaces/models/User.d.ts +1 -1
- package/dist/cjs/store/api/appNotificationsApi.d.ts +741 -221
- package/dist/cjs/store/api/baseApi.d.ts +1 -1
- package/dist/cjs/store/api/baseApi.js +2 -0
- package/dist/cjs/store/api/baseApi.js.map +1 -1
- package/dist/cjs/store/api/entityListsApi.d.ts +387 -127
- package/dist/cjs/store/api/listsApi.d.ts +786 -266
- package/dist/cjs/store/api/spacesApi.d.ts +10750 -0
- package/dist/cjs/store/api/spacesApi.js +501 -0
- package/dist/cjs/store/api/spacesApi.js.map +1 -0
- package/dist/cjs/store/api/userApi.d.ts +3 -3
- package/dist/cjs/store/index.d.ts +4 -2
- package/dist/cjs/store/rootReducer.d.ts +4 -2
- package/dist/cjs/store/rootReducer.js +2 -0
- package/dist/cjs/store/rootReducer.js.map +1 -1
- package/dist/cjs/store/slices/appNotificationsSlice.d.ts +2365 -11
- package/dist/cjs/store/slices/entityListsSlice.d.ts +1608 -12
- package/dist/cjs/store/slices/listsSlice.d.ts +1414 -14
- package/dist/cjs/store/slices/spaceListsSlice.d.ts +850 -0
- package/dist/cjs/store/slices/spaceListsSlice.js +226 -0
- package/dist/cjs/store/slices/spaceListsSlice.js.map +1 -0
- package/dist/cjs/store/slices/userSlice.d.ts +248 -8
- package/dist/esm/context/index.d.ts +1 -0
- package/dist/esm/context/index.js +1 -0
- package/dist/esm/context/index.js.map +1 -1
- package/dist/esm/context/space-context.d.ts +9 -0
- package/dist/esm/context/space-context.js +28 -0
- package/dist/esm/context/space-context.js.map +1 -0
- package/dist/esm/hooks/crypto/useSignTestingJwt.d.ts +1 -2
- package/dist/esm/hooks/crypto/useSignTestingJwt.js +17 -10
- package/dist/esm/hooks/crypto/useSignTestingJwt.js.map +1 -1
- package/dist/esm/hooks/projects/useProjectData.js +1 -1
- package/dist/esm/hooks/projects/useProjectData.js.map +1 -1
- package/dist/esm/hooks/reports/index.d.ts +3 -0
- package/dist/esm/hooks/reports/index.js +3 -0
- package/dist/esm/hooks/reports/index.js.map +1 -1
- package/dist/esm/hooks/reports/useFetchSpaceReports.d.ts +38 -0
- package/dist/esm/hooks/reports/useFetchSpaceReports.js +91 -0
- package/dist/esm/hooks/reports/useFetchSpaceReports.js.map +1 -0
- package/dist/esm/hooks/reports/useHandleSpaceCommentReport.d.ts +30 -0
- package/dist/esm/hooks/reports/useHandleSpaceCommentReport.js +87 -0
- package/dist/esm/hooks/reports/useHandleSpaceCommentReport.js.map +1 -0
- package/dist/esm/hooks/reports/useHandleSpaceEntityReport.d.ts +32 -0
- package/dist/esm/hooks/reports/useHandleSpaceEntityReport.js +89 -0
- package/dist/esm/hooks/reports/useHandleSpaceEntityReport.js.map +1 -0
- package/dist/esm/hooks/space-lists/index.d.ts +3 -0
- package/dist/esm/hooks/space-lists/index.js +3 -0
- package/dist/esm/hooks/space-lists/index.js.map +1 -0
- package/dist/esm/hooks/space-lists/useSpaceList.d.ts +36 -0
- package/dist/esm/hooks/space-lists/useSpaceList.js +288 -0
- package/dist/esm/hooks/space-lists/useSpaceList.js.map +1 -0
- package/dist/esm/hooks/space-lists/useSpaceListActions.d.ts +33 -0
- package/dist/esm/hooks/space-lists/useSpaceListActions.js +204 -0
- package/dist/esm/hooks/space-lists/useSpaceListActions.js.map +1 -0
- package/dist/esm/hooks/spaces/index.d.ts +22 -0
- package/dist/esm/hooks/spaces/index.js +26 -0
- package/dist/esm/hooks/spaces/index.js.map +1 -0
- package/dist/esm/hooks/spaces/useApproveMember.d.ts +7 -0
- package/dist/esm/hooks/spaces/useApproveMember.js +66 -0
- package/dist/esm/hooks/spaces/useApproveMember.js.map +1 -0
- package/dist/esm/hooks/spaces/useCreateSpace.d.ts +15 -0
- package/dist/esm/hooks/spaces/useCreateSpace.js +65 -0
- package/dist/esm/hooks/spaces/useCreateSpace.js.map +1 -0
- package/dist/esm/hooks/spaces/useDeclineMember.d.ts +7 -0
- package/dist/esm/hooks/spaces/useDeclineMember.js +66 -0
- package/dist/esm/hooks/spaces/useDeclineMember.js.map +1 -0
- package/dist/esm/hooks/spaces/useDeleteSpace.d.ts +5 -0
- package/dist/esm/hooks/spaces/useDeleteSpace.js +66 -0
- package/dist/esm/hooks/spaces/useDeleteSpace.js.map +1 -0
- package/dist/esm/hooks/spaces/useFetchMySpaces.d.ts +8 -0
- package/dist/esm/hooks/spaces/useFetchMySpaces.js +80 -0
- package/dist/esm/hooks/spaces/useFetchMySpaces.js.map +1 -0
- package/dist/esm/hooks/spaces/useFetchSpace.d.ts +5 -0
- package/dist/esm/hooks/spaces/useFetchSpace.js +66 -0
- package/dist/esm/hooks/spaces/useFetchSpace.js.map +1 -0
- package/dist/esm/hooks/spaces/useFetchSpaceBreadcrumb.d.ts +5 -0
- package/dist/esm/hooks/spaces/useFetchSpaceBreadcrumb.js +66 -0
- package/dist/esm/hooks/spaces/useFetchSpaceBreadcrumb.js.map +1 -0
- package/dist/esm/hooks/spaces/useFetchSpaceByShortId.d.ts +5 -0
- package/dist/esm/hooks/spaces/useFetchSpaceByShortId.js +66 -0
- package/dist/esm/hooks/spaces/useFetchSpaceByShortId.js.map +1 -0
- package/dist/esm/hooks/spaces/useFetchSpaceBySlug.d.ts +5 -0
- package/dist/esm/hooks/spaces/useFetchSpaceBySlug.js +66 -0
- package/dist/esm/hooks/spaces/useFetchSpaceBySlug.js.map +1 -0
- package/dist/esm/hooks/spaces/useFetchSpaceChildren.d.ts +8 -0
- package/dist/esm/hooks/spaces/useFetchSpaceChildren.js +65 -0
- package/dist/esm/hooks/spaces/useFetchSpaceChildren.js.map +1 -0
- package/dist/esm/hooks/spaces/useFetchSpaceMembers.d.ts +10 -0
- package/dist/esm/hooks/spaces/useFetchSpaceMembers.js +77 -0
- package/dist/esm/hooks/spaces/useFetchSpaceMembers.js.map +1 -0
- package/dist/esm/hooks/spaces/useJoinSpace.d.ts +5 -0
- package/dist/esm/hooks/spaces/useJoinSpace.js +66 -0
- package/dist/esm/hooks/spaces/useJoinSpace.js.map +1 -0
- package/dist/esm/hooks/spaces/useLeaveSpace.d.ts +5 -0
- package/dist/esm/hooks/spaces/useLeaveSpace.js +66 -0
- package/dist/esm/hooks/spaces/useLeaveSpace.js.map +1 -0
- package/dist/esm/hooks/spaces/useRemoveMember.d.ts +9 -0
- package/dist/esm/hooks/spaces/useRemoveMember.js +66 -0
- package/dist/esm/hooks/spaces/useRemoveMember.js.map +1 -0
- package/dist/esm/hooks/spaces/useSpace.d.ts +3 -0
- package/dist/esm/hooks/spaces/useSpace.js +11 -0
- package/dist/esm/hooks/spaces/useSpace.js.map +1 -0
- package/dist/esm/hooks/spaces/useSpaceData.d.ts +32 -0
- package/dist/esm/hooks/spaces/useSpaceData.js +353 -0
- package/dist/esm/hooks/spaces/useSpaceData.js.map +1 -0
- package/dist/esm/hooks/spaces/useSpacePermissions.d.ts +18 -0
- package/dist/esm/hooks/spaces/useSpacePermissions.js +51 -0
- package/dist/esm/hooks/spaces/useSpacePermissions.js.map +1 -0
- package/dist/esm/hooks/spaces/useUpdateMemberRole.d.ts +9 -0
- package/dist/esm/hooks/spaces/useUpdateMemberRole.js +66 -0
- package/dist/esm/hooks/spaces/useUpdateMemberRole.js.map +1 -0
- package/dist/esm/hooks/spaces/useUpdateSpace.d.ts +17 -0
- package/dist/esm/hooks/spaces/useUpdateSpace.js +66 -0
- package/dist/esm/hooks/spaces/useUpdateSpace.js.map +1 -0
- package/dist/esm/index.d.ts +10 -1
- package/dist/esm/index.js +8 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/interfaces/SpaceBreadcrumb.d.ts +5 -0
- package/dist/esm/interfaces/SpaceBreadcrumb.js +2 -0
- package/dist/esm/interfaces/SpaceBreadcrumb.js.map +1 -0
- package/dist/esm/interfaces/SpaceListSortByOptions.d.ts +7 -0
- package/dist/esm/interfaces/SpaceListSortByOptions.js +2 -0
- package/dist/esm/interfaces/SpaceListSortByOptions.js.map +1 -0
- package/dist/esm/interfaces/models/Space.d.ts +122 -0
- package/dist/esm/interfaces/models/Space.js +2 -0
- package/dist/esm/interfaces/models/Space.js.map +1 -0
- package/dist/esm/interfaces/models/SpaceMember.d.ts +27 -0
- package/dist/esm/interfaces/models/SpaceMember.js +2 -0
- package/dist/esm/interfaces/models/SpaceMember.js.map +1 -0
- package/dist/esm/interfaces/models/User.d.ts +1 -1
- package/dist/esm/store/api/appNotificationsApi.d.ts +741 -221
- package/dist/esm/store/api/baseApi.d.ts +1 -1
- package/dist/esm/store/api/baseApi.js +2 -0
- package/dist/esm/store/api/baseApi.js.map +1 -1
- package/dist/esm/store/api/entityListsApi.d.ts +387 -127
- package/dist/esm/store/api/listsApi.d.ts +786 -266
- package/dist/esm/store/api/spacesApi.d.ts +10750 -0
- package/dist/esm/store/api/spacesApi.js +498 -0
- package/dist/esm/store/api/spacesApi.js.map +1 -0
- package/dist/esm/store/api/userApi.d.ts +3 -3
- package/dist/esm/store/index.d.ts +4 -2
- package/dist/esm/store/rootReducer.d.ts +4 -2
- package/dist/esm/store/rootReducer.js +2 -0
- package/dist/esm/store/rootReducer.js.map +1 -1
- package/dist/esm/store/slices/appNotificationsSlice.d.ts +2365 -11
- package/dist/esm/store/slices/entityListsSlice.d.ts +1608 -12
- package/dist/esm/store/slices/listsSlice.d.ts +1414 -14
- package/dist/esm/store/slices/spaceListsSlice.d.ts +850 -0
- package/dist/esm/store/slices/spaceListsSlice.js +223 -0
- package/dist/esm/store/slices/spaceListsSlice.js.map +1 -0
- package/dist/esm/store/slices/userSlice.d.ts +248 -8
- package/package.json +1 -1
|
@@ -1,2 +1,5 @@
|
|
|
1
1
|
export { default as useCreateReport } from "./useCreateReport";
|
|
2
|
+
export { default as useFetchSpaceReports } from "./useFetchSpaceReports";
|
|
3
|
+
export { default as useHandleSpaceEntityReport } from "./useHandleSpaceEntityReport";
|
|
4
|
+
export { default as useHandleSpaceCommentReport } from "./useHandleSpaceCommentReport";
|
|
2
5
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/hooks/reports/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,mBAAmB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/hooks/reports/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAC/D,OAAO,EAAE,OAAO,IAAI,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AACzE,OAAO,EAAE,OAAO,IAAI,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AACrF,OAAO,EAAE,OAAO,IAAI,2BAA2B,EAAE,MAAM,+BAA+B,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
interface FetchSpaceReportsParams {
|
|
2
|
+
spaceId: string;
|
|
3
|
+
targetType?: "Comment" | "Entity";
|
|
4
|
+
sortBy?: "new" | "old";
|
|
5
|
+
page?: number;
|
|
6
|
+
limit?: number;
|
|
7
|
+
}
|
|
8
|
+
interface Report {
|
|
9
|
+
id: string;
|
|
10
|
+
projectId: string;
|
|
11
|
+
spaceId: string | null;
|
|
12
|
+
reporters: string[];
|
|
13
|
+
targetId: string;
|
|
14
|
+
targetType: "Comment" | "Entity";
|
|
15
|
+
reason: string;
|
|
16
|
+
details: string | null;
|
|
17
|
+
status: "Pending" | "On Hold" | "Escalated" | "Dismissed" | "Actioned";
|
|
18
|
+
actionTaken: string | null;
|
|
19
|
+
createdAt: Date;
|
|
20
|
+
updatedAt: Date;
|
|
21
|
+
deletedAt: Date | null;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Hook to fetch reports for a specific space
|
|
25
|
+
* Only accessible by space moderators/admins
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* const fetchSpaceReports = useFetchSpaceReports();
|
|
29
|
+
*
|
|
30
|
+
* const reports = await fetchSpaceReports({
|
|
31
|
+
* spaceId: "space-uuid",
|
|
32
|
+
* targetType: "Entity",
|
|
33
|
+
* page: 1,
|
|
34
|
+
* limit: 20
|
|
35
|
+
* });
|
|
36
|
+
*/
|
|
37
|
+
declare function useFetchSpaceReports(): ({ spaceId, targetType, sortBy, page, limit, }: FetchSpaceReportsParams) => Promise<Report[]>;
|
|
38
|
+
export default useFetchSpaceReports;
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
11
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
12
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
13
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
14
|
+
function step(op) {
|
|
15
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
16
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
17
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
18
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
19
|
+
switch (op[0]) {
|
|
20
|
+
case 0: case 1: t = op; break;
|
|
21
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
22
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
23
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
24
|
+
default:
|
|
25
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
26
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
27
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
28
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
29
|
+
if (t[2]) _.ops.pop();
|
|
30
|
+
_.trys.pop(); continue;
|
|
31
|
+
}
|
|
32
|
+
op = body.call(thisArg, _);
|
|
33
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
34
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
import { useCallback } from "react";
|
|
38
|
+
import useProject from "../projects/useProject";
|
|
39
|
+
import useAxiosPrivate from "../../config/useAxiosPrivate";
|
|
40
|
+
/**
|
|
41
|
+
* Hook to fetch reports for a specific space
|
|
42
|
+
* Only accessible by space moderators/admins
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* const fetchSpaceReports = useFetchSpaceReports();
|
|
46
|
+
*
|
|
47
|
+
* const reports = await fetchSpaceReports({
|
|
48
|
+
* spaceId: "space-uuid",
|
|
49
|
+
* targetType: "Entity",
|
|
50
|
+
* page: 1,
|
|
51
|
+
* limit: 20
|
|
52
|
+
* });
|
|
53
|
+
*/
|
|
54
|
+
function useFetchSpaceReports() {
|
|
55
|
+
var _this = this;
|
|
56
|
+
var projectId = useProject().projectId;
|
|
57
|
+
var axios = useAxiosPrivate();
|
|
58
|
+
var fetchSpaceReports = useCallback(function (_a) { return __awaiter(_this, [_a], void 0, function (_b) {
|
|
59
|
+
var queryParams, queryString, url, response;
|
|
60
|
+
var spaceId = _b.spaceId, targetType = _b.targetType, sortBy = _b.sortBy, page = _b.page, limit = _b.limit;
|
|
61
|
+
return __generator(this, function (_c) {
|
|
62
|
+
switch (_c.label) {
|
|
63
|
+
case 0:
|
|
64
|
+
if (!projectId) {
|
|
65
|
+
throw new Error("No projectId available.");
|
|
66
|
+
}
|
|
67
|
+
if (!spaceId) {
|
|
68
|
+
throw new Error("Please pass a spaceId");
|
|
69
|
+
}
|
|
70
|
+
queryParams = new URLSearchParams();
|
|
71
|
+
if (targetType)
|
|
72
|
+
queryParams.append("targetType", targetType);
|
|
73
|
+
if (sortBy)
|
|
74
|
+
queryParams.append("sortBy", sortBy);
|
|
75
|
+
if (page !== undefined)
|
|
76
|
+
queryParams.append("page", page.toString());
|
|
77
|
+
if (limit !== undefined)
|
|
78
|
+
queryParams.append("limit", limit.toString());
|
|
79
|
+
queryString = queryParams.toString();
|
|
80
|
+
url = "/".concat(projectId, "/spaces/").concat(spaceId, "/reports").concat(queryString ? "?".concat(queryString) : "");
|
|
81
|
+
return [4 /*yield*/, axios.get(url)];
|
|
82
|
+
case 1:
|
|
83
|
+
response = _c.sent();
|
|
84
|
+
return [2 /*return*/, response.data];
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
}); }, [projectId, axios]);
|
|
88
|
+
return fetchSpaceReports;
|
|
89
|
+
}
|
|
90
|
+
export default useFetchSpaceReports;
|
|
91
|
+
//# sourceMappingURL=useFetchSpaceReports.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useFetchSpaceReports.js","sourceRoot":"","sources":["../../../../src/hooks/reports/useFetchSpaceReports.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AACpC,OAAO,UAAU,MAAM,wBAAwB,CAAC;AAChD,OAAO,eAAe,MAAM,8BAA8B,CAAC;AA0B3D;;;;;;;;;;;;;GAaG;AACH,SAAS,oBAAoB;IAA7B,iBAuCC;IAtCS,IAAA,SAAS,GAAK,UAAU,EAAE,UAAjB,CAAkB;IACnC,IAAM,KAAK,GAAG,eAAe,EAAE,CAAC;IAEhC,IAAM,iBAAiB,GAAG,WAAW,CACnC,gEAAO,EAMmB;;YALxB,OAAO,aAAA,EACP,UAAU,gBAAA,EACV,MAAM,YAAA,EACN,IAAI,UAAA,EACJ,KAAK,WAAA;;;;oBAEL,IAAI,CAAC,SAAS,EAAE,CAAC;wBACf,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;oBAC7C,CAAC;oBAED,IAAI,CAAC,OAAO,EAAE,CAAC;wBACb,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;oBAC3C,CAAC;oBAEK,WAAW,GAAG,IAAI,eAAe,EAAE,CAAC;oBAC1C,IAAI,UAAU;wBAAE,WAAW,CAAC,MAAM,CAAC,YAAY,EAAE,UAAU,CAAC,CAAC;oBAC7D,IAAI,MAAM;wBAAE,WAAW,CAAC,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;oBACjD,IAAI,IAAI,KAAK,SAAS;wBAAE,WAAW,CAAC,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC;oBACpE,IAAI,KAAK,KAAK,SAAS;wBAAE,WAAW,CAAC,MAAM,CAAC,OAAO,EAAE,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC;oBAEjE,WAAW,GAAG,WAAW,CAAC,QAAQ,EAAE,CAAC;oBACrC,GAAG,GAAG,WAAI,SAAS,qBAAW,OAAO,qBACzC,WAAW,CAAC,CAAC,CAAC,WAAI,WAAW,CAAE,CAAC,CAAC,CAAC,EAAE,CACpC,CAAC;oBAEc,qBAAM,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,EAAA;;oBAA/B,QAAQ,GAAG,SAAoB;oBAErC,sBAAO,QAAQ,CAAC,IAAgB,EAAC;;;SAClC,EACD,CAAC,SAAS,EAAE,KAAK,CAAC,CACnB,CAAC;IAEF,OAAO,iBAAiB,CAAC;AAC3B,CAAC;AAED,eAAe,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
interface HandleSpaceCommentReportParams {
|
|
2
|
+
spaceId: string;
|
|
3
|
+
reportId: string;
|
|
4
|
+
commentId: string;
|
|
5
|
+
actions: Array<"delete-comment" | "ban-user" | "dismiss">;
|
|
6
|
+
summary: string;
|
|
7
|
+
userId?: string;
|
|
8
|
+
reason?: string;
|
|
9
|
+
}
|
|
10
|
+
interface HandleReportResponse {
|
|
11
|
+
message: string;
|
|
12
|
+
code: string;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Hook to handle comment reports at the space level
|
|
16
|
+
* Space moderators can: delete comment, ban user from space, dismiss
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* const handleSpaceCommentReport = useHandleSpaceCommentReport();
|
|
20
|
+
*
|
|
21
|
+
* await handleSpaceCommentReport({
|
|
22
|
+
* spaceId: "space-uuid",
|
|
23
|
+
* reportId: "report-uuid",
|
|
24
|
+
* commentId: "comment-uuid",
|
|
25
|
+
* actions: ["delete-comment"],
|
|
26
|
+
* summary: "Removed inappropriate comment"
|
|
27
|
+
* });
|
|
28
|
+
*/
|
|
29
|
+
declare function useHandleSpaceCommentReport(): ({ spaceId, reportId, commentId, actions, summary, userId, reason, }: HandleSpaceCommentReportParams) => Promise<HandleReportResponse>;
|
|
30
|
+
export default useHandleSpaceCommentReport;
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
11
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
12
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
13
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
14
|
+
function step(op) {
|
|
15
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
16
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
17
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
18
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
19
|
+
switch (op[0]) {
|
|
20
|
+
case 0: case 1: t = op; break;
|
|
21
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
22
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
23
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
24
|
+
default:
|
|
25
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
26
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
27
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
28
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
29
|
+
if (t[2]) _.ops.pop();
|
|
30
|
+
_.trys.pop(); continue;
|
|
31
|
+
}
|
|
32
|
+
op = body.call(thisArg, _);
|
|
33
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
34
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
import { useCallback } from "react";
|
|
38
|
+
import useProject from "../projects/useProject";
|
|
39
|
+
import useAxiosPrivate from "../../config/useAxiosPrivate";
|
|
40
|
+
/**
|
|
41
|
+
* Hook to handle comment reports at the space level
|
|
42
|
+
* Space moderators can: delete comment, ban user from space, dismiss
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* const handleSpaceCommentReport = useHandleSpaceCommentReport();
|
|
46
|
+
*
|
|
47
|
+
* await handleSpaceCommentReport({
|
|
48
|
+
* spaceId: "space-uuid",
|
|
49
|
+
* reportId: "report-uuid",
|
|
50
|
+
* commentId: "comment-uuid",
|
|
51
|
+
* actions: ["delete-comment"],
|
|
52
|
+
* summary: "Removed inappropriate comment"
|
|
53
|
+
* });
|
|
54
|
+
*/
|
|
55
|
+
function useHandleSpaceCommentReport() {
|
|
56
|
+
var _this = this;
|
|
57
|
+
var projectId = useProject().projectId;
|
|
58
|
+
var axios = useAxiosPrivate();
|
|
59
|
+
var handleSpaceCommentReport = useCallback(function (_a) { return __awaiter(_this, [_a], void 0, function (_b) {
|
|
60
|
+
var response;
|
|
61
|
+
var spaceId = _b.spaceId, reportId = _b.reportId, commentId = _b.commentId, actions = _b.actions, summary = _b.summary, userId = _b.userId, reason = _b.reason;
|
|
62
|
+
return __generator(this, function (_c) {
|
|
63
|
+
switch (_c.label) {
|
|
64
|
+
case 0:
|
|
65
|
+
if (!projectId) {
|
|
66
|
+
throw new Error("No projectId available.");
|
|
67
|
+
}
|
|
68
|
+
if (!spaceId || !reportId) {
|
|
69
|
+
throw new Error("spaceId and reportId are required");
|
|
70
|
+
}
|
|
71
|
+
return [4 /*yield*/, axios.patch("/".concat(projectId, "/spaces/").concat(spaceId, "/reports/comment/").concat(reportId), {
|
|
72
|
+
commentId: commentId,
|
|
73
|
+
actions: actions,
|
|
74
|
+
summary: summary,
|
|
75
|
+
userId: userId,
|
|
76
|
+
reason: reason,
|
|
77
|
+
})];
|
|
78
|
+
case 1:
|
|
79
|
+
response = _c.sent();
|
|
80
|
+
return [2 /*return*/, response.data];
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
}); }, [projectId, axios]);
|
|
84
|
+
return handleSpaceCommentReport;
|
|
85
|
+
}
|
|
86
|
+
export default useHandleSpaceCommentReport;
|
|
87
|
+
//# sourceMappingURL=useHandleSpaceCommentReport.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useHandleSpaceCommentReport.js","sourceRoot":"","sources":["../../../../src/hooks/reports/useHandleSpaceCommentReport.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AACpC,OAAO,UAAU,MAAM,wBAAwB,CAAC;AAChD,OAAO,eAAe,MAAM,8BAA8B,CAAC;AAiB3D;;;;;;;;;;;;;;GAcG;AACH,SAAS,2BAA2B;IAApC,iBAuCC;IAtCS,IAAA,SAAS,GAAK,UAAU,EAAE,UAAjB,CAAkB;IACnC,IAAM,KAAK,GAAG,eAAe,EAAE,CAAC;IAEhC,IAAM,wBAAwB,GAAG,WAAW,CAC1C,gEAAO,EAQ0B;;YAP/B,OAAO,aAAA,EACP,QAAQ,cAAA,EACR,SAAS,eAAA,EACT,OAAO,aAAA,EACP,OAAO,aAAA,EACP,MAAM,YAAA,EACN,MAAM,YAAA;;;;oBAEN,IAAI,CAAC,SAAS,EAAE,CAAC;wBACf,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;oBAC7C,CAAC;oBAED,IAAI,CAAC,OAAO,IAAI,CAAC,QAAQ,EAAE,CAAC;wBAC1B,MAAM,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAC;oBACvD,CAAC;oBAEgB,qBAAM,KAAK,CAAC,KAAK,CAChC,WAAI,SAAS,qBAAW,OAAO,8BAAoB,QAAQ,CAAE,EAC7D;4BACE,SAAS,WAAA;4BACT,OAAO,SAAA;4BACP,OAAO,SAAA;4BACP,MAAM,QAAA;4BACN,MAAM,QAAA;yBACP,CACF,EAAA;;oBATK,QAAQ,GAAG,SAShB;oBAED,sBAAO,QAAQ,CAAC,IAA4B,EAAC;;;SAC9C,EACD,CAAC,SAAS,EAAE,KAAK,CAAC,CACnB,CAAC;IAEF,OAAO,wBAAwB,CAAC;AAClC,CAAC;AAED,eAAe,2BAA2B,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
interface HandleSpaceEntityReportParams {
|
|
2
|
+
spaceId: string;
|
|
3
|
+
reportId: string;
|
|
4
|
+
entityId: string;
|
|
5
|
+
actions: Array<"delete-entity" | "ban-user" | "dismiss">;
|
|
6
|
+
summary: string;
|
|
7
|
+
userId?: string;
|
|
8
|
+
reason?: string;
|
|
9
|
+
}
|
|
10
|
+
interface HandleReportResponse {
|
|
11
|
+
message: string;
|
|
12
|
+
code: string;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Hook to handle entity reports at the space level
|
|
16
|
+
* Space moderators can: delete entity, ban user from space, dismiss
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* const handleSpaceEntityReport = useHandleSpaceEntityReport();
|
|
20
|
+
*
|
|
21
|
+
* await handleSpaceEntityReport({
|
|
22
|
+
* spaceId: "space-uuid",
|
|
23
|
+
* reportId: "report-uuid",
|
|
24
|
+
* entityId: "entity-uuid",
|
|
25
|
+
* actions: ["delete-entity", "ban-user"],
|
|
26
|
+
* summary: "Removed spam content and banned user",
|
|
27
|
+
* userId: "user-uuid",
|
|
28
|
+
* reason: "Spamming"
|
|
29
|
+
* });
|
|
30
|
+
*/
|
|
31
|
+
declare function useHandleSpaceEntityReport(): ({ spaceId, reportId, entityId, actions, summary, userId, reason, }: HandleSpaceEntityReportParams) => Promise<HandleReportResponse>;
|
|
32
|
+
export default useHandleSpaceEntityReport;
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
11
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
12
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
13
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
14
|
+
function step(op) {
|
|
15
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
16
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
17
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
18
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
19
|
+
switch (op[0]) {
|
|
20
|
+
case 0: case 1: t = op; break;
|
|
21
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
22
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
23
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
24
|
+
default:
|
|
25
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
26
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
27
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
28
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
29
|
+
if (t[2]) _.ops.pop();
|
|
30
|
+
_.trys.pop(); continue;
|
|
31
|
+
}
|
|
32
|
+
op = body.call(thisArg, _);
|
|
33
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
34
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
import { useCallback } from "react";
|
|
38
|
+
import useProject from "../projects/useProject";
|
|
39
|
+
import useAxiosPrivate from "../../config/useAxiosPrivate";
|
|
40
|
+
/**
|
|
41
|
+
* Hook to handle entity reports at the space level
|
|
42
|
+
* Space moderators can: delete entity, ban user from space, dismiss
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* const handleSpaceEntityReport = useHandleSpaceEntityReport();
|
|
46
|
+
*
|
|
47
|
+
* await handleSpaceEntityReport({
|
|
48
|
+
* spaceId: "space-uuid",
|
|
49
|
+
* reportId: "report-uuid",
|
|
50
|
+
* entityId: "entity-uuid",
|
|
51
|
+
* actions: ["delete-entity", "ban-user"],
|
|
52
|
+
* summary: "Removed spam content and banned user",
|
|
53
|
+
* userId: "user-uuid",
|
|
54
|
+
* reason: "Spamming"
|
|
55
|
+
* });
|
|
56
|
+
*/
|
|
57
|
+
function useHandleSpaceEntityReport() {
|
|
58
|
+
var _this = this;
|
|
59
|
+
var projectId = useProject().projectId;
|
|
60
|
+
var axios = useAxiosPrivate();
|
|
61
|
+
var handleSpaceEntityReport = useCallback(function (_a) { return __awaiter(_this, [_a], void 0, function (_b) {
|
|
62
|
+
var response;
|
|
63
|
+
var spaceId = _b.spaceId, reportId = _b.reportId, entityId = _b.entityId, actions = _b.actions, summary = _b.summary, userId = _b.userId, reason = _b.reason;
|
|
64
|
+
return __generator(this, function (_c) {
|
|
65
|
+
switch (_c.label) {
|
|
66
|
+
case 0:
|
|
67
|
+
if (!projectId) {
|
|
68
|
+
throw new Error("No projectId available.");
|
|
69
|
+
}
|
|
70
|
+
if (!spaceId || !reportId) {
|
|
71
|
+
throw new Error("spaceId and reportId are required");
|
|
72
|
+
}
|
|
73
|
+
return [4 /*yield*/, axios.patch("/".concat(projectId, "/spaces/").concat(spaceId, "/reports/entity/").concat(reportId), {
|
|
74
|
+
entityId: entityId,
|
|
75
|
+
actions: actions,
|
|
76
|
+
summary: summary,
|
|
77
|
+
userId: userId,
|
|
78
|
+
reason: reason,
|
|
79
|
+
})];
|
|
80
|
+
case 1:
|
|
81
|
+
response = _c.sent();
|
|
82
|
+
return [2 /*return*/, response.data];
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
}); }, [projectId, axios]);
|
|
86
|
+
return handleSpaceEntityReport;
|
|
87
|
+
}
|
|
88
|
+
export default useHandleSpaceEntityReport;
|
|
89
|
+
//# sourceMappingURL=useHandleSpaceEntityReport.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useHandleSpaceEntityReport.js","sourceRoot":"","sources":["../../../../src/hooks/reports/useHandleSpaceEntityReport.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AACpC,OAAO,UAAU,MAAM,wBAAwB,CAAC;AAChD,OAAO,eAAe,MAAM,8BAA8B,CAAC;AAiB3D;;;;;;;;;;;;;;;;GAgBG;AACH,SAAS,0BAA0B;IAAnC,iBAuCC;IAtCS,IAAA,SAAS,GAAK,UAAU,EAAE,UAAjB,CAAkB;IACnC,IAAM,KAAK,GAAG,eAAe,EAAE,CAAC;IAEhC,IAAM,uBAAuB,GAAG,WAAW,CACzC,gEAAO,EAQyB;;YAP9B,OAAO,aAAA,EACP,QAAQ,cAAA,EACR,QAAQ,cAAA,EACR,OAAO,aAAA,EACP,OAAO,aAAA,EACP,MAAM,YAAA,EACN,MAAM,YAAA;;;;oBAEN,IAAI,CAAC,SAAS,EAAE,CAAC;wBACf,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;oBAC7C,CAAC;oBAED,IAAI,CAAC,OAAO,IAAI,CAAC,QAAQ,EAAE,CAAC;wBAC1B,MAAM,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAC;oBACvD,CAAC;oBAEgB,qBAAM,KAAK,CAAC,KAAK,CAChC,WAAI,SAAS,qBAAW,OAAO,6BAAmB,QAAQ,CAAE,EAC5D;4BACE,QAAQ,UAAA;4BACR,OAAO,SAAA;4BACP,OAAO,SAAA;4BACP,MAAM,QAAA;4BACN,MAAM,QAAA;yBACP,CACF,EAAA;;oBATK,QAAQ,GAAG,SAShB;oBAED,sBAAO,QAAQ,CAAC,IAA4B,EAAC;;;SAC9C,EACD,CAAC,SAAS,EAAE,KAAK,CAAC,CACnB,CAAC;IAEF,OAAO,uBAAuB,CAAC;AACjC,CAAC;AAED,eAAe,0BAA0B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/hooks/space-lists/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAGzD,OAAO,EAAE,OAAO,IAAI,mBAAmB,EAAE,MAAM,uBAAuB,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { type SpaceListFilters, type SpaceListConfig, type SpaceListFetchOptions } from "../../store/slices/spaceListsSlice";
|
|
2
|
+
import { Space, ReadingPermission, PostingPermission } from "../../interfaces/models/Space";
|
|
3
|
+
import { SpaceListSortByOptions } from "../../interfaces/SpaceListSortByOptions";
|
|
4
|
+
export interface UseSpaceListProps {
|
|
5
|
+
listId: string;
|
|
6
|
+
}
|
|
7
|
+
export interface UseSpaceListValues {
|
|
8
|
+
spaces: Space[];
|
|
9
|
+
loading: boolean;
|
|
10
|
+
hasMore: boolean;
|
|
11
|
+
sortBy: SpaceListSortByOptions | null;
|
|
12
|
+
search: string | null;
|
|
13
|
+
readingPermission: "anyone" | "members" | null;
|
|
14
|
+
memberOf: boolean;
|
|
15
|
+
parentSpaceId: string | null;
|
|
16
|
+
fetchSpaces: (filters: Partial<SpaceListFilters>, config?: SpaceListConfig, options?: SpaceListFetchOptions) => void;
|
|
17
|
+
loadMore: () => void;
|
|
18
|
+
createSpace: (props: {
|
|
19
|
+
name: string;
|
|
20
|
+
slug?: string | null;
|
|
21
|
+
description?: string | null;
|
|
22
|
+
avatar?: string | null;
|
|
23
|
+
banner?: string | null;
|
|
24
|
+
readingPermission?: ReadingPermission;
|
|
25
|
+
postingPermission?: PostingPermission;
|
|
26
|
+
requireJoinApproval?: boolean;
|
|
27
|
+
metadata?: Record<string, any>;
|
|
28
|
+
parentSpaceId?: string | null;
|
|
29
|
+
insertPosition?: "first" | "last";
|
|
30
|
+
}) => Promise<Space | undefined>;
|
|
31
|
+
deleteSpace: (props: {
|
|
32
|
+
spaceId: string;
|
|
33
|
+
}) => Promise<void>;
|
|
34
|
+
}
|
|
35
|
+
declare function useSpaceList({ listId }: UseSpaceListProps): UseSpaceListValues;
|
|
36
|
+
export default useSpaceList;
|