@replyke/core 5.1.6-beta.30 → 5.1.6-beta.32
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/config/axios.d.ts +3 -0
- package/dist/cjs/config/axios.js +17 -0
- package/dist/cjs/config/axios.js.map +1 -0
- package/dist/cjs/config/useAxiosPrivate.d.ts +2 -0
- package/dist/cjs/config/useAxiosPrivate.js +82 -0
- package/dist/cjs/config/useAxiosPrivate.js.map +1 -0
- package/dist/cjs/constants/reportReasons.d.ts +12 -0
- package/dist/cjs/constants/reportReasons.js +15 -0
- package/dist/cjs/constants/reportReasons.js.map +1 -0
- package/dist/cjs/context/comment-section-context.d.ts +9 -0
- package/dist/cjs/context/comment-section-context.js +28 -0
- package/dist/cjs/context/comment-section-context.js.map +1 -0
- package/dist/cjs/context/entity-context.d.ts +9 -0
- package/dist/cjs/context/entity-context.js +38 -0
- package/dist/cjs/context/entity-context.js.map +1 -0
- package/dist/cjs/context/index.d.ts +4 -0
- package/dist/cjs/context/index.js +12 -0
- package/dist/cjs/context/index.js.map +1 -0
- package/dist/cjs/context/replyke-context.d.ts +10 -0
- package/dist/cjs/context/replyke-context.js +23 -0
- package/dist/cjs/context/replyke-context.js.map +1 -0
- package/dist/cjs/context/replyke-store-context.d.ts +13 -0
- package/dist/cjs/context/replyke-store-context.js +37 -0
- package/dist/cjs/context/replyke-store-context.js.map +1 -0
- package/dist/cjs/helpers/addCommentsToTree.d.ts +3 -0
- package/dist/cjs/helpers/addCommentsToTree.js +61 -0
- package/dist/cjs/helpers/addCommentsToTree.js.map +1 -0
- package/dist/cjs/helpers/addNotificationsMessages.d.ts +3 -0
- package/dist/cjs/helpers/addNotificationsMessages.js +91 -0
- package/dist/cjs/helpers/addNotificationsMessages.js.map +1 -0
- package/dist/cjs/helpers/getPublicFileUrl.d.ts +2 -0
- package/dist/cjs/helpers/getPublicFileUrl.js +10 -0
- package/dist/cjs/helpers/getPublicFileUrl.js.map +1 -0
- package/dist/cjs/helpers/getUserName.d.ts +2 -0
- package/dist/cjs/helpers/getUserName.js +23 -0
- package/dist/cjs/helpers/getUserName.js.map +1 -0
- package/dist/cjs/helpers/markCommentAsFailed.d.ts +2 -0
- package/dist/cjs/helpers/markCommentAsFailed.js +29 -0
- package/dist/cjs/helpers/markCommentAsFailed.js.map +1 -0
- package/dist/cjs/helpers/removeCommentFromTree.d.ts +2 -0
- package/dist/cjs/helpers/removeCommentFromTree.js +44 -0
- package/dist/cjs/helpers/removeCommentFromTree.js.map +1 -0
- package/dist/cjs/helpers/safeMergeStyleProps.d.ts +1 -0
- package/dist/cjs/helpers/safeMergeStyleProps.js +23 -0
- package/dist/cjs/helpers/safeMergeStyleProps.js.map +1 -0
- package/dist/cjs/hooks/app-notifications/index.d.ts +3 -0
- package/dist/cjs/hooks/app-notifications/index.js +12 -0
- package/dist/cjs/hooks/app-notifications/index.js.map +1 -0
- package/dist/cjs/hooks/app-notifications/useAppNotifications.d.ts +21 -0
- package/dist/cjs/hooks/app-notifications/useAppNotifications.js +108 -0
- package/dist/cjs/hooks/app-notifications/useAppNotifications.js.map +1 -0
- package/dist/cjs/hooks/app-notifications/useAppNotificationsActions.d.ts +13 -0
- package/dist/cjs/hooks/app-notifications/useAppNotificationsActions.js +266 -0
- package/dist/cjs/hooks/app-notifications/useAppNotificationsActions.js.map +1 -0
- package/dist/cjs/hooks/auth/index.d.ts +1 -0
- package/dist/cjs/hooks/auth/index.js +9 -0
- package/dist/cjs/hooks/auth/index.js.map +1 -0
- package/dist/cjs/hooks/auth/useAuth.d.ts +32 -0
- package/dist/cjs/hooks/auth/useAuth.js +180 -0
- package/dist/cjs/hooks/auth/useAuth.js.map +1 -0
- package/dist/cjs/hooks/comments/index.d.ts +12 -0
- package/dist/cjs/hooks/comments/index.js +31 -0
- package/dist/cjs/hooks/comments/index.js.map +1 -0
- package/dist/cjs/hooks/comments/useCommentSection.d.ts +2 -0
- package/dist/cjs/hooks/comments/useCommentSection.js +9 -0
- package/dist/cjs/hooks/comments/useCommentSection.js.map +1 -0
- package/dist/cjs/hooks/comments/useCommentSectionData.d.ts +60 -0
- package/dist/cjs/hooks/comments/useCommentSectionData.js +407 -0
- package/dist/cjs/hooks/comments/useCommentSectionData.js.map +1 -0
- package/dist/cjs/hooks/comments/useCommentVotes.d.ts +11 -0
- package/dist/cjs/hooks/comments/useCommentVotes.js +234 -0
- package/dist/cjs/hooks/comments/useCommentVotes.js.map +1 -0
- package/dist/cjs/hooks/comments/useCreateComment.d.ts +14 -0
- package/dist/cjs/hooks/comments/useCreateComment.js +90 -0
- package/dist/cjs/hooks/comments/useCreateComment.js.map +1 -0
- package/dist/cjs/hooks/comments/useDeleteComment.d.ts +4 -0
- package/dist/cjs/hooks/comments/useDeleteComment.js +70 -0
- package/dist/cjs/hooks/comments/useDeleteComment.js.map +1 -0
- package/dist/cjs/hooks/comments/useDownvoteComment.d.ts +5 -0
- package/dist/cjs/hooks/comments/useDownvoteComment.js +71 -0
- package/dist/cjs/hooks/comments/useDownvoteComment.js.map +1 -0
- package/dist/cjs/hooks/comments/useEntityComments.d.ts +22 -0
- package/dist/cjs/hooks/comments/useEntityComments.js +196 -0
- package/dist/cjs/hooks/comments/useEntityComments.js.map +1 -0
- package/dist/cjs/hooks/comments/useFetchComment.d.ts +9 -0
- package/dist/cjs/hooks/comments/useFetchComment.js +74 -0
- package/dist/cjs/hooks/comments/useFetchComment.js.map +1 -0
- package/dist/cjs/hooks/comments/useFetchCommentByForeignId.d.ts +9 -0
- package/dist/cjs/hooks/comments/useFetchCommentByForeignId.js +75 -0
- package/dist/cjs/hooks/comments/useFetchCommentByForeignId.js.map +1 -0
- package/dist/cjs/hooks/comments/useFetchManyComments.d.ts +12 -0
- package/dist/cjs/hooks/comments/useFetchManyComments.js +88 -0
- package/dist/cjs/hooks/comments/useFetchManyComments.js.map +1 -0
- package/dist/cjs/hooks/comments/useGroupReplies.d.ts +8 -0
- package/dist/cjs/hooks/comments/useGroupReplies.js +24 -0
- package/dist/cjs/hooks/comments/useGroupReplies.js.map +1 -0
- package/dist/cjs/hooks/comments/useProfileComments.d.ts +18 -0
- package/dist/cjs/hooks/comments/useProfileComments.js +179 -0
- package/dist/cjs/hooks/comments/useProfileComments.js.map +1 -0
- package/dist/cjs/hooks/comments/useRemoveCommentDownvote.d.ts +5 -0
- package/dist/cjs/hooks/comments/useRemoveCommentDownvote.js +71 -0
- package/dist/cjs/hooks/comments/useRemoveCommentDownvote.js.map +1 -0
- package/dist/cjs/hooks/comments/useRemoveCommentUpvote.d.ts +5 -0
- package/dist/cjs/hooks/comments/useRemoveCommentUpvote.js +71 -0
- package/dist/cjs/hooks/comments/useRemoveCommentUpvote.js.map +1 -0
- package/dist/cjs/hooks/comments/useReplies.d.ts +13 -0
- package/dist/cjs/hooks/comments/useReplies.js +107 -0
- package/dist/cjs/hooks/comments/useReplies.js.map +1 -0
- package/dist/cjs/hooks/comments/useUpdateComment.d.ts +6 -0
- package/dist/cjs/hooks/comments/useUpdateComment.js +73 -0
- package/dist/cjs/hooks/comments/useUpdateComment.js.map +1 -0
- package/dist/cjs/hooks/comments/useUpvoteComment.d.ts +5 -0
- package/dist/cjs/hooks/comments/useUpvoteComment.js +71 -0
- package/dist/cjs/hooks/comments/useUpvoteComment.js.map +1 -0
- package/dist/cjs/hooks/crypto/index.d.ts +1 -0
- package/dist/cjs/hooks/crypto/index.js +9 -0
- package/dist/cjs/hooks/crypto/index.js.map +1 -0
- package/dist/cjs/hooks/crypto/useSignTestingJwt.d.ts +6 -0
- package/dist/cjs/hooks/crypto/useSignTestingJwt.js +74 -0
- package/dist/cjs/hooks/crypto/useSignTestingJwt.js.map +1 -0
- package/dist/cjs/hooks/entities/index.d.ts +10 -0
- package/dist/cjs/hooks/entities/index.js +27 -0
- package/dist/cjs/hooks/entities/index.js.map +1 -0
- package/dist/cjs/hooks/entities/useCreateEntity.d.ts +18 -0
- package/dist/cjs/hooks/entities/useCreateEntity.js +79 -0
- package/dist/cjs/hooks/entities/useCreateEntity.js.map +1 -0
- package/dist/cjs/hooks/entities/useDeleteEntity.d.ts +4 -0
- package/dist/cjs/hooks/entities/useDeleteEntity.js +72 -0
- package/dist/cjs/hooks/entities/useDeleteEntity.js.map +1 -0
- package/dist/cjs/hooks/entities/useDownvoteEntity.d.ts +5 -0
- package/dist/cjs/hooks/entities/useDownvoteEntity.js +71 -0
- package/dist/cjs/hooks/entities/useDownvoteEntity.js.map +1 -0
- package/dist/cjs/hooks/entities/useEntity.d.ts +2 -0
- package/dist/cjs/hooks/entities/useEntity.js +9 -0
- package/dist/cjs/hooks/entities/useEntity.js.map +1 -0
- package/dist/cjs/hooks/entities/useEntityData.d.ts +24 -0
- package/dist/cjs/hooks/entities/useEntityData.js +246 -0
- package/dist/cjs/hooks/entities/useEntityData.js.map +1 -0
- package/dist/cjs/hooks/entities/useEntityVotes.d.ts +11 -0
- package/dist/cjs/hooks/entities/useEntityVotes.js +241 -0
- package/dist/cjs/hooks/entities/useEntityVotes.js.map +1 -0
- package/dist/cjs/hooks/entities/useFetchEntity.d.ts +5 -0
- package/dist/cjs/hooks/entities/useFetchEntity.js +70 -0
- package/dist/cjs/hooks/entities/useFetchEntity.js.map +1 -0
- package/dist/cjs/hooks/entities/useFetchEntityByForeignId.d.ts +6 -0
- package/dist/cjs/hooks/entities/useFetchEntityByForeignId.js +75 -0
- package/dist/cjs/hooks/entities/useFetchEntityByForeignId.js.map +1 -0
- package/dist/cjs/hooks/entities/useFetchEntityByShortId.d.ts +5 -0
- package/dist/cjs/hooks/entities/useFetchEntityByShortId.js +74 -0
- package/dist/cjs/hooks/entities/useFetchEntityByShortId.js.map +1 -0
- package/dist/cjs/hooks/entities/useIncrementEntityViews.d.ts +5 -0
- package/dist/cjs/hooks/entities/useIncrementEntityViews.js +73 -0
- package/dist/cjs/hooks/entities/useIncrementEntityViews.js.map +1 -0
- package/dist/cjs/hooks/entities/useRemoveEntityDownvote.d.ts +5 -0
- package/dist/cjs/hooks/entities/useRemoveEntityDownvote.js +71 -0
- package/dist/cjs/hooks/entities/useRemoveEntityDownvote.js.map +1 -0
- package/dist/cjs/hooks/entities/useRemoveEntityUpvote.d.ts +5 -0
- package/dist/cjs/hooks/entities/useRemoveEntityUpvote.js +71 -0
- package/dist/cjs/hooks/entities/useRemoveEntityUpvote.js.map +1 -0
- package/dist/cjs/hooks/entities/useUpdateEntity.d.ts +19 -0
- package/dist/cjs/hooks/entities/useUpdateEntity.js +77 -0
- package/dist/cjs/hooks/entities/useUpdateEntity.js.map +1 -0
- package/dist/cjs/hooks/entities/useUpvoteEntity.d.ts +5 -0
- package/dist/cjs/hooks/entities/useUpvoteEntity.js +71 -0
- package/dist/cjs/hooks/entities/useUpvoteEntity.js.map +1 -0
- package/dist/cjs/hooks/entity-lists/index.d.ts +4 -0
- package/dist/cjs/hooks/entity-lists/index.js +11 -0
- package/dist/cjs/hooks/entity-lists/index.js.map +1 -0
- package/dist/cjs/hooks/entity-lists/useEntityList.d.ts +53 -0
- package/dist/cjs/hooks/entity-lists/useEntityList.js +359 -0
- package/dist/cjs/hooks/entity-lists/useEntityList.js.map +1 -0
- package/dist/cjs/hooks/entity-lists/useEntityListActions.d.ts +51 -0
- package/dist/cjs/hooks/entity-lists/useEntityListActions.js +198 -0
- package/dist/cjs/hooks/entity-lists/useEntityListActions.js.map +1 -0
- package/dist/cjs/hooks/entity-lists/useInfusedData.d.ts +8 -0
- package/dist/cjs/hooks/entity-lists/useInfusedData.js +130 -0
- package/dist/cjs/hooks/entity-lists/useInfusedData.js.map +1 -0
- package/dist/cjs/hooks/lists/index.d.ts +3 -0
- package/dist/cjs/hooks/lists/index.js +14 -0
- package/dist/cjs/hooks/lists/index.js.map +1 -0
- package/dist/cjs/hooks/lists/useIsEntitySaved.d.ts +5 -0
- package/dist/cjs/hooks/lists/useIsEntitySaved.js +83 -0
- package/dist/cjs/hooks/lists/useIsEntitySaved.js.map +1 -0
- package/dist/cjs/hooks/lists/useLists.d.ts +36 -0
- package/dist/cjs/hooks/lists/useLists.js +239 -0
- package/dist/cjs/hooks/lists/useLists.js.map +1 -0
- package/dist/cjs/hooks/lists/useListsActions.d.ts +21 -0
- package/dist/cjs/hooks/lists/useListsActions.js +341 -0
- package/dist/cjs/hooks/lists/useListsActions.js.map +1 -0
- package/dist/cjs/hooks/projects/index.d.ts +2 -0
- package/dist/cjs/hooks/projects/index.js +11 -0
- package/dist/cjs/hooks/projects/index.js.map +1 -0
- package/dist/cjs/hooks/projects/useProject.d.ts +2 -0
- package/dist/cjs/hooks/projects/useProject.js +9 -0
- package/dist/cjs/hooks/projects/useProject.js.map +1 -0
- package/dist/cjs/hooks/projects/useProjectData.d.ts +10 -0
- package/dist/cjs/hooks/projects/useProjectData.js +78 -0
- package/dist/cjs/hooks/projects/useProjectData.js.map +1 -0
- package/dist/cjs/hooks/reports/index.d.ts +1 -0
- package/dist/cjs/hooks/reports/index.js +9 -0
- package/dist/cjs/hooks/reports/index.js.map +1 -0
- package/dist/cjs/hooks/reports/useCreateReport.d.ts +14 -0
- package/dist/cjs/hooks/reports/useCreateReport.js +108 -0
- package/dist/cjs/hooks/reports/useCreateReport.js.map +1 -0
- package/dist/cjs/hooks/storage/index.d.ts +1 -0
- package/dist/cjs/hooks/storage/index.js +9 -0
- package/dist/cjs/hooks/storage/index.js.map +1 -0
- package/dist/cjs/hooks/storage/useUploadFile.d.ts +14 -0
- package/dist/cjs/hooks/storage/useUploadFile.js +95 -0
- package/dist/cjs/hooks/storage/useUploadFile.js.map +1 -0
- package/dist/cjs/hooks/user/index.d.ts +2 -0
- package/dist/cjs/hooks/user/index.js +12 -0
- package/dist/cjs/hooks/user/index.js.map +1 -0
- package/dist/cjs/hooks/user/useUser.d.ts +18 -0
- package/dist/cjs/hooks/user/useUser.js +116 -0
- package/dist/cjs/hooks/user/useUser.js.map +1 -0
- package/dist/cjs/hooks/user/useUserActions.d.ts +12 -0
- package/dist/cjs/hooks/user/useUserActions.js +125 -0
- package/dist/cjs/hooks/user/useUserActions.js.map +1 -0
- package/dist/cjs/hooks/users/follows/index.d.ts +4 -0
- package/dist/cjs/hooks/users/follows/index.js +15 -0
- package/dist/cjs/hooks/users/follows/index.js.map +1 -0
- package/dist/cjs/hooks/users/follows/useFetchFollow.d.ts +6 -0
- package/dist/cjs/hooks/users/follows/useFetchFollow.js +81 -0
- package/dist/cjs/hooks/users/follows/useFetchFollow.js.map +1 -0
- package/dist/cjs/hooks/users/follows/useFollowManager.d.ts +9 -0
- package/dist/cjs/hooks/users/follows/useFollowManager.js +122 -0
- package/dist/cjs/hooks/users/follows/useFollowManager.js.map +1 -0
- package/dist/cjs/hooks/users/follows/useFollowUser.d.ts +4 -0
- package/dist/cjs/hooks/users/follows/useFollowUser.js +71 -0
- package/dist/cjs/hooks/users/follows/useFollowUser.js.map +1 -0
- package/dist/cjs/hooks/users/follows/useUnfollowUser.d.ts +4 -0
- package/dist/cjs/hooks/users/follows/useUnfollowUser.js +81 -0
- package/dist/cjs/hooks/users/follows/useUnfollowUser.js.map +1 -0
- package/dist/cjs/hooks/users/index.d.ts +9 -0
- package/dist/cjs/hooks/users/index.js +28 -0
- package/dist/cjs/hooks/users/index.js.map +1 -0
- package/dist/cjs/hooks/users/useCheckUsernameAvailability.d.ts +6 -0
- package/dist/cjs/hooks/users/useCheckUsernameAvailability.js +72 -0
- package/dist/cjs/hooks/users/useCheckUsernameAvailability.js.map +1 -0
- package/dist/cjs/hooks/users/useFetchUser.d.ts +5 -0
- package/dist/cjs/hooks/users/useFetchUser.js +70 -0
- package/dist/cjs/hooks/users/useFetchUser.js.map +1 -0
- package/dist/cjs/hooks/users/useFetchUserByForeignId.d.ts +5 -0
- package/dist/cjs/hooks/users/useFetchUserByForeignId.js +72 -0
- package/dist/cjs/hooks/users/useFetchUserByForeignId.js.map +1 -0
- package/dist/cjs/hooks/users/useFetchUserFollowersCount.d.ts +6 -0
- package/dist/cjs/hooks/users/useFetchUserFollowersCount.js +71 -0
- package/dist/cjs/hooks/users/useFetchUserFollowersCount.js.map +1 -0
- package/dist/cjs/hooks/users/useFetchUserFollowingCount.d.ts +6 -0
- package/dist/cjs/hooks/users/useFetchUserFollowingCount.js +71 -0
- package/dist/cjs/hooks/users/useFetchUserFollowingCount.js.map +1 -0
- package/dist/cjs/hooks/users/useFetchUserSuggestions.d.ts +5 -0
- package/dist/cjs/hooks/users/useFetchUserSuggestions.js +72 -0
- package/dist/cjs/hooks/users/useFetchUserSuggestions.js.map +1 -0
- package/dist/cjs/hooks/users/useMentions.d.ts +18 -0
- package/dist/cjs/hooks/users/useMentions.js +185 -0
- package/dist/cjs/hooks/users/useMentions.js.map +1 -0
- package/dist/cjs/hooks/users/useUpdateUser.d.ts +19 -0
- package/dist/cjs/hooks/users/useUpdateUser.js +73 -0
- package/dist/cjs/hooks/users/useUpdateUser.js.map +1 -0
- package/dist/cjs/hooks/utils/index.d.ts +1 -0
- package/dist/cjs/hooks/utils/index.js +9 -0
- package/dist/cjs/hooks/utils/index.js.map +1 -0
- package/dist/cjs/hooks/utils/useGetMetadata.d.ts +4 -0
- package/dist/cjs/hooks/utils/useGetMetadata.js +79 -0
- package/dist/cjs/hooks/utils/useGetMetadata.js.map +1 -0
- package/dist/cjs/index.d.ts +32 -0
- package/dist/cjs/index.js +142 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/interfaces/CommentsSortByOptions.d.ts +1 -0
- package/dist/cjs/interfaces/CommentsSortByOptions.js +3 -0
- package/dist/cjs/interfaces/CommentsSortByOptions.js.map +1 -0
- package/dist/cjs/interfaces/EntityCommentsTree.d.ts +13 -0
- package/dist/cjs/interfaces/EntityCommentsTree.js +3 -0
- package/dist/cjs/interfaces/EntityCommentsTree.js.map +1 -0
- package/dist/cjs/interfaces/EntityListSortByOptions.d.ts +1 -0
- package/dist/cjs/interfaces/EntityListSortByOptions.js +3 -0
- package/dist/cjs/interfaces/EntityListSortByOptions.js.map +1 -0
- package/dist/cjs/interfaces/TimeFrame.d.ts +1 -0
- package/dist/cjs/interfaces/TimeFrame.js +3 -0
- package/dist/cjs/interfaces/TimeFrame.js.map +1 -0
- package/dist/cjs/interfaces/entity-filters/AttachmentsFilters.d.ts +3 -0
- package/dist/cjs/interfaces/entity-filters/AttachmentsFilters.js +3 -0
- package/dist/cjs/interfaces/entity-filters/AttachmentsFilters.js.map +1 -0
- package/dist/cjs/interfaces/entity-filters/ContentFilters.d.ts +5 -0
- package/dist/cjs/interfaces/entity-filters/ContentFilters.js +3 -0
- package/dist/cjs/interfaces/entity-filters/ContentFilters.js.map +1 -0
- package/dist/cjs/interfaces/entity-filters/KeywordsFilters.d.ts +4 -0
- package/dist/cjs/interfaces/entity-filters/KeywordsFilters.js +3 -0
- package/dist/cjs/interfaces/entity-filters/KeywordsFilters.js.map +1 -0
- package/dist/cjs/interfaces/entity-filters/LocationFilters.d.ts +5 -0
- package/dist/cjs/interfaces/entity-filters/LocationFilters.js +3 -0
- package/dist/cjs/interfaces/entity-filters/LocationFilters.js.map +1 -0
- package/dist/cjs/interfaces/entity-filters/MetadataFilters.d.ts +7 -0
- package/dist/cjs/interfaces/entity-filters/MetadataFilters.js +3 -0
- package/dist/cjs/interfaces/entity-filters/MetadataFilters.js.map +1 -0
- package/dist/cjs/interfaces/entity-filters/TitleFilters.d.ts +5 -0
- package/dist/cjs/interfaces/entity-filters/TitleFilters.js +3 -0
- package/dist/cjs/interfaces/entity-filters/TitleFilters.js.map +1 -0
- package/dist/cjs/interfaces/models/AppNotification.d.ts +140 -0
- package/dist/cjs/interfaces/models/AppNotification.js +3 -0
- package/dist/cjs/interfaces/models/AppNotification.js.map +1 -0
- package/dist/cjs/interfaces/models/Comment.d.ts +32 -0
- package/dist/cjs/interfaces/models/Comment.js +3 -0
- package/dist/cjs/interfaces/models/Comment.js.map +1 -0
- package/dist/cjs/interfaces/models/Entity.d.ts +37 -0
- package/dist/cjs/interfaces/models/Entity.js +3 -0
- package/dist/cjs/interfaces/models/Entity.js.map +1 -0
- package/dist/cjs/interfaces/models/Follow.d.ts +5 -0
- package/dist/cjs/interfaces/models/Follow.js +3 -0
- package/dist/cjs/interfaces/models/Follow.js.map +1 -0
- package/dist/cjs/interfaces/models/List.d.ts +12 -0
- package/dist/cjs/interfaces/models/List.js +3 -0
- package/dist/cjs/interfaces/models/List.js.map +1 -0
- package/dist/cjs/interfaces/models/Mention.d.ts +4 -0
- package/dist/cjs/interfaces/models/Mention.js +3 -0
- package/dist/cjs/interfaces/models/Mention.js.map +1 -0
- package/dist/cjs/interfaces/models/Project.d.ts +14 -0
- package/dist/cjs/interfaces/models/Project.js +3 -0
- package/dist/cjs/interfaces/models/Project.js.map +1 -0
- package/dist/cjs/interfaces/models/User.d.ts +33 -0
- package/dist/cjs/interfaces/models/User.js +3 -0
- package/dist/cjs/interfaces/models/User.js.map +1 -0
- package/dist/cjs/store/api/appNotificationsApi.d.ts +2024 -0
- package/dist/cjs/store/api/appNotificationsApi.js +224 -0
- package/dist/cjs/store/api/appNotificationsApi.js.map +1 -0
- package/dist/cjs/store/api/baseApi.d.ts +1 -0
- package/dist/cjs/store/api/baseApi.js +43 -0
- package/dist/cjs/store/api/baseApi.js.map +1 -0
- package/dist/cjs/store/api/entityListsApi.d.ts +1719 -0
- package/dist/cjs/store/api/entityListsApi.js +237 -0
- package/dist/cjs/store/api/entityListsApi.js.map +1 -0
- package/dist/cjs/store/api/index.d.ts +4 -0
- package/dist/cjs/store/api/index.js +29 -0
- package/dist/cjs/store/api/index.js.map +1 -0
- package/dist/cjs/store/api/listsApi.d.ts +3044 -0
- package/dist/cjs/store/api/listsApi.js +288 -0
- package/dist/cjs/store/api/listsApi.js.map +1 -0
- package/dist/cjs/store/api/userApi.d.ts +183 -0
- package/dist/cjs/store/api/userApi.js +38 -0
- package/dist/cjs/store/api/userApi.js.map +1 -0
- package/dist/cjs/store/index.d.ts +21 -0
- package/dist/cjs/store/index.js +73 -0
- package/dist/cjs/store/index.js.map +1 -0
- package/dist/cjs/store/middleware.d.ts +4 -0
- package/dist/cjs/store/middleware.js +43 -0
- package/dist/cjs/store/middleware.js.map +1 -0
- package/dist/cjs/store/rootReducer.d.ts +16 -0
- package/dist/cjs/store/rootReducer.js +26 -0
- package/dist/cjs/store/rootReducer.js.map +1 -0
- package/dist/cjs/store/slices/appNotificationsSlice.d.ts +58 -0
- package/dist/cjs/store/slices/appNotificationsSlice.js +135 -0
- package/dist/cjs/store/slices/appNotificationsSlice.js.map +1 -0
- package/dist/cjs/store/slices/authSlice.d.ts +24 -0
- package/dist/cjs/store/slices/authSlice.js +79 -0
- package/dist/cjs/store/slices/authSlice.js.map +1 -0
- package/dist/cjs/store/slices/authThunks.d.ts +40 -0
- package/dist/cjs/store/slices/authThunks.js +363 -0
- package/dist/cjs/store/slices/authThunks.js.map +1 -0
- package/dist/cjs/store/slices/entityListsSlice.d.ts +364 -0
- package/dist/cjs/store/slices/entityListsSlice.js +295 -0
- package/dist/cjs/store/slices/entityListsSlice.js.map +1 -0
- package/dist/cjs/store/slices/index.d.ts +0 -0
- package/dist/cjs/store/slices/index.js +7 -0
- package/dist/cjs/store/slices/index.js.map +1 -0
- package/dist/cjs/store/slices/listsSlice.d.ts +147 -0
- package/dist/cjs/store/slices/listsSlice.js +211 -0
- package/dist/cjs/store/slices/listsSlice.js.map +1 -0
- package/dist/cjs/store/slices/userSlice.d.ts +29 -0
- package/dist/cjs/store/slices/userSlice.js +87 -0
- package/dist/cjs/store/slices/userSlice.js.map +1 -0
- package/dist/cjs/store/types/index.d.ts +8 -0
- package/dist/cjs/store/types/index.js +3 -0
- package/dist/cjs/store/types/index.js.map +1 -0
- package/dist/cjs/utils/constants.d.ts +1 -0
- package/dist/cjs/utils/constants.js +5 -0
- package/dist/cjs/utils/constants.js.map +1 -0
- package/dist/cjs/utils/env.d.ts +19 -0
- package/dist/cjs/utils/env.js +102 -0
- package/dist/cjs/utils/env.js.map +1 -0
- package/dist/cjs/utils/handleError.d.ts +1 -0
- package/dist/cjs/utils/handleError.js +24 -0
- package/dist/cjs/utils/handleError.js.map +1 -0
- package/dist/cjs/utils/isAbsoluteUrl.d.ts +1 -0
- package/dist/cjs/utils/isAbsoluteUrl.js +9 -0
- package/dist/cjs/utils/isAbsoluteUrl.js.map +1 -0
- package/dist/cjs/utils/isReactNative.d.ts +1 -0
- package/dist/cjs/utils/isReactNative.js +8 -0
- package/dist/cjs/utils/isReactNative.js.map +1 -0
- package/dist/cjs/utils/isUUID.d.ts +1 -0
- package/dist/cjs/utils/isUUID.js +8 -0
- package/dist/cjs/utils/isUUID.js.map +1 -0
- package/dist/cjs/utils/keywordHelpers.d.ts +30 -0
- package/dist/cjs/utils/keywordHelpers.js +101 -0
- package/dist/cjs/utils/keywordHelpers.js.map +1 -0
- package/dist/esm/hooks/entity-lists/useEntityList.js +4 -3
- package/dist/esm/hooks/entity-lists/useEntityList.js.map +1 -1
- package/dist/esm/hooks/entity-lists/useEntityListActions.d.ts +1 -1
- package/dist/esm/hooks/entity-lists/useEntityListActions.js +12 -10
- package/dist/esm/hooks/entity-lists/useEntityListActions.js.map +1 -1
- package/dist/esm/hooks/users/follows/useFollowManager.js +4 -2
- package/dist/esm/hooks/users/follows/useFollowManager.js.map +1 -1
- package/dist/esm/store/api/entityListsApi.d.ts +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
14
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
15
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
16
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
17
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
18
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
19
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
23
|
+
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);
|
|
24
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
25
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
26
|
+
function step(op) {
|
|
27
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
28
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
29
|
+
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;
|
|
30
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
31
|
+
switch (op[0]) {
|
|
32
|
+
case 0: case 1: t = op; break;
|
|
33
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
34
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
35
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
36
|
+
default:
|
|
37
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
38
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
39
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
40
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
41
|
+
if (t[2]) _.ops.pop();
|
|
42
|
+
_.trys.pop(); continue;
|
|
43
|
+
}
|
|
44
|
+
op = body.call(thisArg, _);
|
|
45
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
46
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
50
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
51
|
+
if (ar || !(i in from)) {
|
|
52
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
53
|
+
ar[i] = from[i];
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
57
|
+
};
|
|
58
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
59
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
60
|
+
};
|
|
61
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
62
|
+
var react_1 = require("react");
|
|
63
|
+
var handleError_1 = require("../../utils/handleError");
|
|
64
|
+
var user_1 = require("../user");
|
|
65
|
+
// Import the communication hooks
|
|
66
|
+
var useUpvoteComment_1 = __importDefault(require("./useUpvoteComment"));
|
|
67
|
+
var useRemoveCommentUpvote_1 = __importDefault(require("./useRemoveCommentUpvote"));
|
|
68
|
+
var useDownvoteComment_1 = __importDefault(require("./useDownvoteComment"));
|
|
69
|
+
var useRemoveCommentDownvote_1 = __importDefault(require("./useRemoveCommentDownvote"));
|
|
70
|
+
function useCommentVotes(props) {
|
|
71
|
+
var _this = this;
|
|
72
|
+
var user = (0, user_1.useUser)().user;
|
|
73
|
+
var comment = props.comment, setComment = props.setComment;
|
|
74
|
+
// Save the previous state in case we need to revert
|
|
75
|
+
var _a = (0, react_1.useState)(comment), previousComment = _a[0], setPreviousComment = _a[1];
|
|
76
|
+
var _b = (0, react_1.useState)(false), isUpdating = _b[0], setIsUpdating = _b[1];
|
|
77
|
+
// Helper to update state and remember the previous value
|
|
78
|
+
var updateCommentState = function (newCommentState) {
|
|
79
|
+
setPreviousComment(comment);
|
|
80
|
+
setComment(newCommentState);
|
|
81
|
+
};
|
|
82
|
+
var revertToPreviousState = (0, react_1.useCallback)(function () {
|
|
83
|
+
setComment(previousComment);
|
|
84
|
+
}, [previousComment, setComment]);
|
|
85
|
+
// Get our request functions from the extracted hooks
|
|
86
|
+
var upvoteCommentRequest = (0, useUpvoteComment_1.default)();
|
|
87
|
+
var removeUpvoteRequest = (0, useRemoveCommentUpvote_1.default)();
|
|
88
|
+
var downvoteCommentRequest = (0, useDownvoteComment_1.default)();
|
|
89
|
+
var removeDownvoteRequest = (0, useRemoveCommentDownvote_1.default)();
|
|
90
|
+
var handleUpvote = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
91
|
+
var updatedComment, err_1;
|
|
92
|
+
return __generator(this, function (_a) {
|
|
93
|
+
switch (_a.label) {
|
|
94
|
+
case 0:
|
|
95
|
+
if (!user)
|
|
96
|
+
throw new Error("No authenticated user");
|
|
97
|
+
if (isUpdating)
|
|
98
|
+
return [2 /*return*/];
|
|
99
|
+
// Optimistic update: add upvote and remove any downvote from the user
|
|
100
|
+
updateCommentState(__assign(__assign({}, comment), { upvotes: __spreadArray(__spreadArray([], comment.upvotes, true), [user.id], false), downvotes: comment.downvotes.filter(function (id) { return id !== user.id; }) }));
|
|
101
|
+
setIsUpdating(true);
|
|
102
|
+
_a.label = 1;
|
|
103
|
+
case 1:
|
|
104
|
+
_a.trys.push([1, 3, 4, 5]);
|
|
105
|
+
return [4 /*yield*/, upvoteCommentRequest({
|
|
106
|
+
commentId: comment.id,
|
|
107
|
+
})];
|
|
108
|
+
case 2:
|
|
109
|
+
updatedComment = _a.sent();
|
|
110
|
+
setComment(updatedComment);
|
|
111
|
+
return [3 /*break*/, 5];
|
|
112
|
+
case 3:
|
|
113
|
+
err_1 = _a.sent();
|
|
114
|
+
revertToPreviousState();
|
|
115
|
+
(0, handleError_1.handleError)(err_1, "Failed to update comment vote: ");
|
|
116
|
+
return [3 /*break*/, 5];
|
|
117
|
+
case 4:
|
|
118
|
+
setIsUpdating(false);
|
|
119
|
+
return [7 /*endfinally*/];
|
|
120
|
+
case 5: return [2 /*return*/];
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
}); };
|
|
124
|
+
var handleRemoveUpvote = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
125
|
+
var updatedComment, err_2;
|
|
126
|
+
return __generator(this, function (_a) {
|
|
127
|
+
switch (_a.label) {
|
|
128
|
+
case 0:
|
|
129
|
+
if (!user)
|
|
130
|
+
throw new Error("No authenticated user");
|
|
131
|
+
if (isUpdating)
|
|
132
|
+
return [2 /*return*/];
|
|
133
|
+
// Optimistic update: remove the user's upvote
|
|
134
|
+
updateCommentState(__assign(__assign({}, comment), { upvotes: comment.upvotes.filter(function (id) { return id !== user.id; }) }));
|
|
135
|
+
setIsUpdating(true);
|
|
136
|
+
_a.label = 1;
|
|
137
|
+
case 1:
|
|
138
|
+
_a.trys.push([1, 3, 4, 5]);
|
|
139
|
+
return [4 /*yield*/, removeUpvoteRequest({
|
|
140
|
+
commentId: comment.id,
|
|
141
|
+
})];
|
|
142
|
+
case 2:
|
|
143
|
+
updatedComment = _a.sent();
|
|
144
|
+
setComment(updatedComment);
|
|
145
|
+
return [3 /*break*/, 5];
|
|
146
|
+
case 3:
|
|
147
|
+
err_2 = _a.sent();
|
|
148
|
+
revertToPreviousState();
|
|
149
|
+
(0, handleError_1.handleError)(err_2, "Failed to remove upvote from comment: ");
|
|
150
|
+
return [3 /*break*/, 5];
|
|
151
|
+
case 4:
|
|
152
|
+
setIsUpdating(false);
|
|
153
|
+
return [7 /*endfinally*/];
|
|
154
|
+
case 5: return [2 /*return*/];
|
|
155
|
+
}
|
|
156
|
+
});
|
|
157
|
+
}); };
|
|
158
|
+
var handleDownvote = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
159
|
+
var updatedComment, err_3;
|
|
160
|
+
return __generator(this, function (_a) {
|
|
161
|
+
switch (_a.label) {
|
|
162
|
+
case 0:
|
|
163
|
+
if (!user)
|
|
164
|
+
throw new Error("No authenticated user");
|
|
165
|
+
if (isUpdating)
|
|
166
|
+
return [2 /*return*/];
|
|
167
|
+
// Optimistic update: add downvote and remove any upvote from the user
|
|
168
|
+
updateCommentState(__assign(__assign({}, comment), { downvotes: __spreadArray(__spreadArray([], comment.downvotes, true), [user.id], false), upvotes: comment.upvotes.filter(function (id) { return id !== user.id; }) }));
|
|
169
|
+
setIsUpdating(true);
|
|
170
|
+
_a.label = 1;
|
|
171
|
+
case 1:
|
|
172
|
+
_a.trys.push([1, 3, 4, 5]);
|
|
173
|
+
return [4 /*yield*/, downvoteCommentRequest({
|
|
174
|
+
commentId: comment.id,
|
|
175
|
+
})];
|
|
176
|
+
case 2:
|
|
177
|
+
updatedComment = _a.sent();
|
|
178
|
+
setComment(updatedComment);
|
|
179
|
+
return [3 /*break*/, 5];
|
|
180
|
+
case 3:
|
|
181
|
+
err_3 = _a.sent();
|
|
182
|
+
revertToPreviousState();
|
|
183
|
+
(0, handleError_1.handleError)(err_3, "Failed to update comment vote: ");
|
|
184
|
+
return [3 /*break*/, 5];
|
|
185
|
+
case 4:
|
|
186
|
+
setIsUpdating(false);
|
|
187
|
+
return [7 /*endfinally*/];
|
|
188
|
+
case 5: return [2 /*return*/];
|
|
189
|
+
}
|
|
190
|
+
});
|
|
191
|
+
}); };
|
|
192
|
+
var handleRemoveDownvote = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
193
|
+
var updatedComment, err_4;
|
|
194
|
+
return __generator(this, function (_a) {
|
|
195
|
+
switch (_a.label) {
|
|
196
|
+
case 0:
|
|
197
|
+
if (!user)
|
|
198
|
+
throw new Error("No authenticated user");
|
|
199
|
+
if (isUpdating)
|
|
200
|
+
return [2 /*return*/];
|
|
201
|
+
// Optimistic update: remove the user's downvote
|
|
202
|
+
updateCommentState(__assign(__assign({}, comment), { downvotes: comment.downvotes.filter(function (id) { return id !== user.id; }) }));
|
|
203
|
+
setIsUpdating(true);
|
|
204
|
+
_a.label = 1;
|
|
205
|
+
case 1:
|
|
206
|
+
_a.trys.push([1, 3, 4, 5]);
|
|
207
|
+
return [4 /*yield*/, removeDownvoteRequest({
|
|
208
|
+
commentId: comment.id,
|
|
209
|
+
})];
|
|
210
|
+
case 2:
|
|
211
|
+
updatedComment = _a.sent();
|
|
212
|
+
setComment(updatedComment);
|
|
213
|
+
return [3 /*break*/, 5];
|
|
214
|
+
case 3:
|
|
215
|
+
err_4 = _a.sent();
|
|
216
|
+
revertToPreviousState();
|
|
217
|
+
(0, handleError_1.handleError)(err_4, "Failed to remove downvote from comment: ");
|
|
218
|
+
return [3 /*break*/, 5];
|
|
219
|
+
case 4:
|
|
220
|
+
setIsUpdating(false);
|
|
221
|
+
return [7 /*endfinally*/];
|
|
222
|
+
case 5: return [2 /*return*/];
|
|
223
|
+
}
|
|
224
|
+
});
|
|
225
|
+
}); };
|
|
226
|
+
return {
|
|
227
|
+
upvoteComment: handleUpvote,
|
|
228
|
+
removeCommentUpvote: handleRemoveUpvote,
|
|
229
|
+
downvoteComment: handleDownvote,
|
|
230
|
+
removeCommentDownvote: handleRemoveDownvote,
|
|
231
|
+
};
|
|
232
|
+
}
|
|
233
|
+
exports.default = useCommentVotes;
|
|
234
|
+
//# sourceMappingURL=useCommentVotes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useCommentVotes.js","sourceRoot":"","sources":["../../../../src/hooks/comments/useCommentVotes.tsx"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Comment, GifData } from "../../interfaces/models/Comment";
|
|
2
|
+
import { Mention } from "../../interfaces/models/Mention";
|
|
3
|
+
declare function useCreateComment(): (props: {
|
|
4
|
+
entityId: string;
|
|
5
|
+
foreignId?: string | null | undefined;
|
|
6
|
+
parentCommentId?: string | null | undefined;
|
|
7
|
+
content?: string;
|
|
8
|
+
gif?: GifData;
|
|
9
|
+
mentions?: Mention[];
|
|
10
|
+
referencedCommentId?: string | null | undefined;
|
|
11
|
+
attachments?: Record<string, any>[];
|
|
12
|
+
metadata?: Record<string, any>;
|
|
13
|
+
}) => Promise<Comment>;
|
|
14
|
+
export default useCreateComment;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
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);
|
|
13
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
+
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;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
39
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
40
|
+
};
|
|
41
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
+
var react_1 = require("react");
|
|
43
|
+
var useAxiosPrivate_1 = __importDefault(require("../../config/useAxiosPrivate"));
|
|
44
|
+
var useProject_1 = __importDefault(require("../projects/useProject"));
|
|
45
|
+
var user_1 = require("../user");
|
|
46
|
+
// Hook for adding a comment
|
|
47
|
+
function useCreateComment() {
|
|
48
|
+
var _this = this;
|
|
49
|
+
var axios = (0, useAxiosPrivate_1.default)();
|
|
50
|
+
var projectId = (0, useProject_1.default)().projectId;
|
|
51
|
+
var user = (0, user_1.useUser)().user;
|
|
52
|
+
var createComment = (0, react_1.useCallback)(function (props) { return __awaiter(_this, void 0, void 0, function () {
|
|
53
|
+
var entityId, foreignId, parentCommentId, content, gif, mentions, referencedCommentId, attachments, metadata, response;
|
|
54
|
+
return __generator(this, function (_a) {
|
|
55
|
+
switch (_a.label) {
|
|
56
|
+
case 0:
|
|
57
|
+
entityId = props.entityId, foreignId = props.foreignId, parentCommentId = props.parentCommentId, content = props.content, gif = props.gif, mentions = props.mentions, referencedCommentId = props.referencedCommentId, attachments = props.attachments, metadata = props.metadata;
|
|
58
|
+
if (!projectId) {
|
|
59
|
+
throw new Error("No project specified");
|
|
60
|
+
}
|
|
61
|
+
if (!entityId) {
|
|
62
|
+
throw new Error("No entity ID was provided");
|
|
63
|
+
}
|
|
64
|
+
if (!user) {
|
|
65
|
+
throw new Error("No authenticated user");
|
|
66
|
+
}
|
|
67
|
+
if (!content && !gif) {
|
|
68
|
+
throw new Error("No content was provided");
|
|
69
|
+
}
|
|
70
|
+
return [4 /*yield*/, axios.post("/".concat(projectId, "/comments"), {
|
|
71
|
+
entityId: entityId,
|
|
72
|
+
foreignId: foreignId,
|
|
73
|
+
content: content,
|
|
74
|
+
gif: gif,
|
|
75
|
+
mentions: mentions,
|
|
76
|
+
parentId: parentCommentId,
|
|
77
|
+
referencedCommentId: referencedCommentId,
|
|
78
|
+
attachments: attachments,
|
|
79
|
+
metadata: metadata,
|
|
80
|
+
})];
|
|
81
|
+
case 1:
|
|
82
|
+
response = _a.sent();
|
|
83
|
+
return [2 /*return*/, response.data];
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
}); }, [projectId, user, axios]);
|
|
87
|
+
return createComment;
|
|
88
|
+
}
|
|
89
|
+
exports.default = useCreateComment;
|
|
90
|
+
//# sourceMappingURL=useCreateComment.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useCreateComment.js","sourceRoot":"","sources":["../../../../src/hooks/comments/useCreateComment.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+BAAoC;AACpC,iFAA2D;AAC3D,sEAAgD;AAGhD,gCAAkC;AAElC,4BAA4B;AAC5B,SAAS,gBAAgB;IAAzB,iBA6DC;IA5DC,IAAM,KAAK,GAAG,IAAA,yBAAe,GAAE,CAAC;IACxB,IAAA,SAAS,GAAK,IAAA,oBAAU,GAAE,UAAjB,CAAkB;IAC3B,IAAA,IAAI,GAAK,IAAA,cAAO,GAAE,KAAd,CAAe;IAE3B,IAAM,aAAa,GAAG,IAAA,mBAAW,EAC/B,UAAO,KAUN;;;;;oBAEG,QAAQ,GASN,KAAK,SATC,EACR,SAAS,GAQP,KAAK,UARE,EACT,eAAe,GAOb,KAAK,gBAPQ,EACf,OAAO,GAML,KAAK,QANA,EACP,GAAG,GAKD,KAAK,IALJ,EACH,QAAQ,GAIN,KAAK,SAJC,EACR,mBAAmB,GAGjB,KAAK,oBAHY,EACnB,WAAW,GAET,KAAK,YAFI,EACX,QAAQ,GACN,KAAK,SADC,CACA;oBACV,IAAI,CAAC,SAAS,EAAE,CAAC;wBACf,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC;oBAC1C,CAAC;oBAED,IAAI,CAAC,QAAQ,EAAE,CAAC;wBACd,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC;oBAC/C,CAAC;oBAED,IAAI,CAAC,IAAI,EAAE,CAAC;wBACV,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;oBAC3C,CAAC;oBAED,IAAI,CAAC,OAAO,IAAI,CAAC,GAAG,EAAE,CAAC;wBACrB,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;oBAC7C,CAAC;oBAEgB,qBAAM,KAAK,CAAC,IAAI,CAAC,WAAI,SAAS,cAAW,EAAE;4BAC1D,QAAQ,UAAA;4BACR,SAAS,WAAA;4BACT,OAAO,SAAA;4BACP,GAAG,KAAA;4BACH,QAAQ,UAAA;4BACR,QAAQ,EAAE,eAAe;4BACzB,mBAAmB,qBAAA;4BACnB,WAAW,aAAA;4BACX,QAAQ,UAAA;yBACT,CAAC,EAAA;;oBAVI,QAAQ,GAAG,SAUf;oBACF,sBAAO,QAAQ,CAAC,IAAe,EAAC;;;SACjC,EACD,CAAC,SAAS,EAAE,IAAI,EAAE,KAAK,CAAC,CACzB,CAAC;IAEF,OAAO,aAAa,CAAC;AACvB,CAAC;AAED,kBAAe,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
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);
|
|
13
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
+
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;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
39
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
40
|
+
};
|
|
41
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
+
var react_1 = require("react");
|
|
43
|
+
var useAxiosPrivate_1 = __importDefault(require("../../config/useAxiosPrivate"));
|
|
44
|
+
var useProject_1 = __importDefault(require("../projects/useProject"));
|
|
45
|
+
function useDeleteComment() {
|
|
46
|
+
var _this = this;
|
|
47
|
+
var axios = (0, useAxiosPrivate_1.default)();
|
|
48
|
+
var projectId = (0, useProject_1.default)().projectId;
|
|
49
|
+
var deleteComment = (0, react_1.useCallback)(function (_a) { return __awaiter(_this, [_a], void 0, function (_b) {
|
|
50
|
+
var commentId = _b.commentId;
|
|
51
|
+
return __generator(this, function (_c) {
|
|
52
|
+
switch (_c.label) {
|
|
53
|
+
case 0:
|
|
54
|
+
if (!commentId) {
|
|
55
|
+
throw new Error("No comment ID passed");
|
|
56
|
+
}
|
|
57
|
+
if (!projectId) {
|
|
58
|
+
throw new Error("No project specified");
|
|
59
|
+
}
|
|
60
|
+
return [4 /*yield*/, axios.delete("/".concat(projectId, "/comments/").concat(commentId))];
|
|
61
|
+
case 1:
|
|
62
|
+
_c.sent();
|
|
63
|
+
return [2 /*return*/];
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
}); }, [axios, projectId]);
|
|
67
|
+
return deleteComment;
|
|
68
|
+
}
|
|
69
|
+
exports.default = useDeleteComment;
|
|
70
|
+
//# sourceMappingURL=useDeleteComment.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDeleteComment.js","sourceRoot":"","sources":["../../../../src/hooks/comments/useDeleteComment.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+BAAoC;AACpC,iFAA2D;AAC3D,sEAAgD;AAEhD,SAAS,gBAAgB;IAAzB,iBAmBC;IAlBC,IAAM,KAAK,GAAG,IAAA,yBAAe,GAAE,CAAC;IACxB,IAAA,SAAS,GAAK,IAAA,oBAAU,GAAE,UAAjB,CAAkB;IAEnC,IAAM,aAAa,GAAG,IAAA,mBAAW,EAC/B,gEAAO,EAAoC;YAAlC,SAAS,eAAA;;;;oBAChB,IAAI,CAAC,SAAS,EAAE,CAAC;wBACf,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC;oBAC1C,CAAC;oBAED,IAAI,CAAC,SAAS,EAAE,CAAC;wBACf,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC;oBAC1C,CAAC;oBAED,qBAAM,KAAK,CAAC,MAAM,CAAC,WAAI,SAAS,uBAAa,SAAS,CAAE,CAAC,EAAA;;oBAAzD,SAAyD,CAAC;;;;SAC3D,EACD,CAAC,KAAK,EAAE,SAAS,CAAC,CACnB,CAAC;IACF,OAAO,aAAa,CAAC;AACvB,CAAC;AAED,kBAAe,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
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);
|
|
13
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
+
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;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
39
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
40
|
+
};
|
|
41
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
+
var react_1 = require("react");
|
|
43
|
+
var useAxiosPrivate_1 = __importDefault(require("../../config/useAxiosPrivate"));
|
|
44
|
+
var useProject_1 = __importDefault(require("../projects/useProject"));
|
|
45
|
+
function useDownvoteComment() {
|
|
46
|
+
var _this = this;
|
|
47
|
+
var axios = (0, useAxiosPrivate_1.default)();
|
|
48
|
+
var projectId = (0, useProject_1.default)().projectId;
|
|
49
|
+
var downvoteComment = (0, react_1.useCallback)(function (_a) { return __awaiter(_this, [_a], void 0, function (_b) {
|
|
50
|
+
var response;
|
|
51
|
+
var commentId = _b.commentId;
|
|
52
|
+
return __generator(this, function (_c) {
|
|
53
|
+
switch (_c.label) {
|
|
54
|
+
case 0:
|
|
55
|
+
if (!commentId) {
|
|
56
|
+
throw new Error("No comment ID passed");
|
|
57
|
+
}
|
|
58
|
+
if (!projectId) {
|
|
59
|
+
throw new Error("No project specified");
|
|
60
|
+
}
|
|
61
|
+
return [4 /*yield*/, axios.patch("/".concat(projectId, "/comments/").concat(commentId, "/downvote"))];
|
|
62
|
+
case 1:
|
|
63
|
+
response = _c.sent();
|
|
64
|
+
return [2 /*return*/, response.data];
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
}); }, [axios, projectId]);
|
|
68
|
+
return downvoteComment;
|
|
69
|
+
}
|
|
70
|
+
exports.default = useDownvoteComment;
|
|
71
|
+
//# sourceMappingURL=useDownvoteComment.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDownvoteComment.js","sourceRoot":"","sources":["../../../../src/hooks/comments/useDownvoteComment.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+BAAoC;AACpC,iFAA2D;AAC3D,sEAAgD;AAGhD,SAAS,kBAAkB;IAA3B,iBAqBC;IApBC,IAAM,KAAK,GAAG,IAAA,yBAAe,GAAE,CAAC;IACxB,IAAA,SAAS,GAAK,IAAA,oBAAU,GAAE,UAAjB,CAAkB;IAEnC,IAAM,eAAe,GAAG,IAAA,mBAAW,EACjC,gEAAO,EAAoC;;YAAlC,SAAS,eAAA;;;;oBAChB,IAAI,CAAC,SAAS,EAAE,CAAC;wBACf,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC;oBAC1C,CAAC;oBACD,IAAI,CAAC,SAAS,EAAE,CAAC;wBACf,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC;oBAC1C,CAAC;oBACgB,qBAAM,KAAK,CAAC,KAAK,CAChC,WAAI,SAAS,uBAAa,SAAS,cAAW,CAC/C,EAAA;;oBAFK,QAAQ,GAAG,SAEhB;oBACD,sBAAO,QAAQ,CAAC,IAAe,EAAC;;;SACjC,EACD,CAAC,KAAK,EAAE,SAAS,CAAC,CACnB,CAAC;IAEF,OAAO,eAAe,CAAC;AACzB,CAAC;AAED,kBAAe,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Comment } from "../../interfaces/models/Comment";
|
|
2
|
+
import { CommentsSortByOptions } from "../../interfaces/CommentsSortByOptions";
|
|
3
|
+
import { EntityCommentsTree } from "../../interfaces/EntityCommentsTree";
|
|
4
|
+
export interface UseEntityCommentsDataProps {
|
|
5
|
+
entityId: string | undefined | null;
|
|
6
|
+
limit?: number;
|
|
7
|
+
defaultSortBy?: CommentsSortByOptions;
|
|
8
|
+
}
|
|
9
|
+
export interface UseEntityCommentsDataValues {
|
|
10
|
+
entityCommentsTree: EntityCommentsTree;
|
|
11
|
+
comments: Comment[];
|
|
12
|
+
newComments: Comment[];
|
|
13
|
+
loading: boolean;
|
|
14
|
+
hasMore: boolean;
|
|
15
|
+
sortBy: CommentsSortByOptions | null;
|
|
16
|
+
setSortBy: (newSortBy: CommentsSortByOptions) => void;
|
|
17
|
+
loadMore: () => void;
|
|
18
|
+
addCommentsToTree: (newComments: Comment[] | undefined, newlyAdded?: boolean) => void;
|
|
19
|
+
removeCommentFromTree: (commentId: string) => void;
|
|
20
|
+
}
|
|
21
|
+
declare function useEntityComments(props: UseEntityCommentsDataProps): UseEntityCommentsDataValues;
|
|
22
|
+
export default useEntityComments;
|