bigblocks
Version:
Complete Bitcoin UI component library - authentication, social, wallet, market, inscriptions, and blockchain interactions for React
17 lines • 8.3 kB
JSON
{
"name": "social-types-hooks",
"type": "registry:component",
"dependencies": [
"bmap-api-types"
],
"devDependencies": [],
"registryDependencies": [],
"files": [
{
"path": "components/social/types/hooks.ts",
"type": "registry:component",
"content": "// Hook Types for Social Functionality\nimport type { MessageTransaction } from \"bmap-api-types\";\nimport type {\n\tBroadcastResult,\n\tFeedConfig,\n\tFeedResponse,\n\tReaction,\n\tSocialError,\n\tSocialFriend,\n\tSocialNotification,\n\tUserSearchResult,\n} from \"./social.js\";\n\n// Post Hook Types\nexport interface PostMutationData {\n\tcontent: string;\n\tcontentType?: \"text/plain\" | \"text/markdown\";\n\tapp?: string;\n}\n\nexport interface ReplyMutationData extends PostMutationData {\n\tparentTxid: string;\n}\n\n// Using simplified types to avoid React Query dependency in types\nexport interface UseSocialPostResult {\n\tmutate: (variables: PostMutationData) => void;\n\tmutateAsync: (variables: PostMutationData) => Promise<BroadcastResult>;\n\tisLoading: boolean;\n\tisError: boolean;\n\tisSuccess: boolean;\n\terror: SocialError | null;\n\tdata: BroadcastResult | undefined;\n\treset: () => void;\n}\n\nexport interface UseReplyPostResult {\n\tmutate: (variables: ReplyMutationData) => void;\n\tmutateAsync: (variables: ReplyMutationData) => Promise<BroadcastResult>;\n\tisLoading: boolean;\n\tisError: boolean;\n\tisSuccess: boolean;\n\terror: SocialError | null;\n\tdata: BroadcastResult | undefined;\n\treset: () => void;\n}\n\n// Like Hook Types\nexport interface LikeMutationData {\n\ttxid: string;\n\temoji?: string;\n}\n\nexport interface UseLikePostResult {\n\tmutate: (variables: LikeMutationData) => void;\n\tmutateAsync: (variables: LikeMutationData) => Promise<BroadcastResult>;\n\tisLoading: boolean;\n\tisError: boolean;\n\tisSuccess: boolean;\n\terror: SocialError | null;\n\tdata: BroadcastResult | undefined;\n\treset: () => void;\n}\n\nexport interface UseUnlikePostResult {\n\tmutate: (variables: LikeMutationData) => void;\n\tmutateAsync: (variables: LikeMutationData) => Promise<BroadcastResult>;\n\tisLoading: boolean;\n\tisError: boolean;\n\tisSuccess: boolean;\n\terror: SocialError | null;\n\tdata: BroadcastResult | undefined;\n\treset: () => void;\n}\n\n// Follow Hook Types\nexport interface FollowMutationData {\n\tidKey: string;\n}\n\nexport interface UseFollowUserResult {\n\tmutate: (variables: FollowMutationData) => void;\n\tmutateAsync: (variables: FollowMutationData) => Promise<BroadcastResult>;\n\tisLoading: boolean;\n\tisError: boolean;\n\tisSuccess: boolean;\n\terror: SocialError | null;\n\tdata: BroadcastResult | undefined;\n\treset: () => void;\n}\n\nexport interface UseUnfollowUserResult {\n\tmutate: (variables: FollowMutationData) => void;\n\tmutateAsync: (variables: FollowMutationData) => Promise<BroadcastResult>;\n\tisLoading: boolean;\n\tisError: boolean;\n\tisSuccess: boolean;\n\terror: SocialError | null;\n\tdata: BroadcastResult | undefined;\n\treset: () => void;\n}\n\n// Message Hook Types\nexport interface MessageMutationData {\n\trecipient: string;\n\tcontent: string;\n\tencrypted?: boolean;\n\tchannel?: string;\n}\n\nexport interface UseSendMessageResult {\n\tmutate: (variables: MessageMutationData) => void;\n\tmutateAsync: (variables: MessageMutationData) => Promise<BroadcastResult>;\n\tisLoading: boolean;\n\tisError: boolean;\n\tisSuccess: boolean;\n\terror: SocialError | null;\n\tdata: BroadcastResult | undefined;\n\treset: () => void;\n}\n\n// Friend Hook Types\nexport interface FriendRequestMutationData {\n\tidKey: string;\n}\n\nexport interface UseFriendRequestResult {\n\tmutate: (variables: FriendRequestMutationData) => void;\n\tmutateAsync: (\n\t\tvariables: FriendRequestMutationData,\n\t) => Promise<BroadcastResult>;\n\tisLoading: boolean;\n\tisError: boolean;\n\tisSuccess: boolean;\n\terror: SocialError | null;\n\tdata: BroadcastResult | undefined;\n\treset: () => void;\n}\n\nexport interface UseAcceptFriendResult {\n\tmutate: (variables: FriendRequestMutationData) => void;\n\tmutateAsync: (\n\t\tvariables: FriendRequestMutationData,\n\t) => Promise<BroadcastResult>;\n\tisLoading: boolean;\n\tisError: boolean;\n\tisSuccess: boolean;\n\terror: SocialError | null;\n\tdata: BroadcastResult | undefined;\n\treset: () => void;\n}\n\nexport interface UseUnfriendResult {\n\tmutate: (variables: FriendRequestMutationData) => void;\n\tmutateAsync: (\n\t\tvariables: FriendRequestMutationData,\n\t) => Promise<BroadcastResult>;\n\tisLoading: boolean;\n\tisError: boolean;\n\tisSuccess: boolean;\n\terror: SocialError | null;\n\tdata: BroadcastResult | undefined;\n\treset: () => void;\n}\n\n// Feed Hook Types\nexport interface FeedQueryData {\n\tconfig: FeedConfig;\n}\n\nexport interface UseSocialFeedResult {\n\tdata: { pages: FeedResponse[]; pageParams: unknown[] } | undefined;\n\tisLoading: boolean;\n\tisError: boolean;\n\tisSuccess: boolean;\n\terror: SocialError | null;\n\tfetchNextPage: () => void;\n\thasNextPage: boolean;\n\tisFetchingNextPage: boolean;\n}\n\n// User Search Hook Types\nexport interface UserSearchQueryData {\n\tquery: string;\n\tlimit?: number;\n}\n\nexport interface UseBapIdSearchResult {\n\tdata: UserSearchResult | undefined;\n\tisLoading: boolean;\n\tisError: boolean;\n\tisSuccess: boolean;\n\terror: SocialError | null;\n\trefetch: () => void;\n}\n\n// Reactions Hook Types\nexport interface ReactionsQueryData {\n\ttxid: string;\n}\n\nexport interface UseReactionsResult {\n\tdata: Reaction[] | undefined;\n\tisLoading: boolean;\n\tisError: boolean;\n\tisSuccess: boolean;\n\terror: SocialError | null;\n\trefetch: () => void;\n}\n\n// Notifications Hook Types\nexport interface NotificationsQueryData {\n\tidKey: string;\n\tunreadOnly?: boolean;\n}\n\nexport interface UseNotificationsResult {\n\tdata: SocialNotification[] | undefined;\n\tisLoading: boolean;\n\tisError: boolean;\n\tisSuccess: boolean;\n\terror: SocialError | null;\n\trefetch: () => void;\n}\n\n// Friends Hook Types\nexport interface FriendsQueryData {\n\tidKey: string;\n}\n\nexport interface UseFriendsResult {\n\tdata: SocialFriend[] | undefined;\n\tisLoading: boolean;\n\tisError: boolean;\n\tisSuccess: boolean;\n\terror: SocialError | null;\n\trefetch: () => void;\n}\n\n// Messages Hook Types\nexport interface MessagesQueryData {\n\tchannel?: string;\n\trecipient?: string;\n\tlimit?: number;\n}\n\nexport interface UseMessagesResult {\n\tdata: { pages: MessageTransaction[][]; pageParams: unknown[] } | undefined;\n\tisLoading: boolean;\n\tisError: boolean;\n\tisSuccess: boolean;\n\terror: SocialError | null;\n\tfetchNextPage: () => void;\n\thasNextPage: boolean;\n\tisFetchingNextPage: boolean;\n}\n\n// Hook Configuration Interfaces\nexport interface SocialHookConfig {\n\tapiUrl?: string;\n\tbroadcaster?: string;\n\tretryCount?: number;\n\tcacheTime?: number;\n\tstaleTime?: number;\n}\n\n// Optimistic Update Types\nexport interface OptimisticLike {\n\ttxid: string;\n\temoji: string;\n\tadded: boolean; // true for like, false for unlike\n\ttimestamp: number;\n}\n\nexport interface OptimisticFollow {\n\tidKey: string;\n\tfollowing: boolean;\n\ttimestamp: number;\n}\n\nexport interface OptimisticPost {\n\ttempId: string;\n\tcontent: string;\n\tcontentType: \"text/plain\" | \"text/markdown\";\n\ttimestamp: number;\n}\n\n// Hook Return Value Helpers\nexport interface MutationHelpers<TData, TError, TVariables> {\n\tmutate: (variables: TVariables) => void;\n\tmutateAsync: (variables: TVariables) => Promise<TData>;\n\tisLoading: boolean;\n\tisError: boolean;\n\tisSuccess: boolean;\n\terror: TError | null;\n\tdata: TData | undefined;\n\treset: () => void;\n}\n\nexport interface QueryHelpers<TData, TError> {\n\tdata: TData | undefined;\n\tisLoading: boolean;\n\tisError: boolean;\n\tisSuccess: boolean;\n\terror: TError | null;\n\trefetch: () => Promise<TData>;\n\tisFetching: boolean;\n}\n\nexport interface InfiniteQueryHelpers<TData, TError>\n\textends QueryHelpers<TData, TError> {\n\tfetchNextPage: () => Promise<TData>;\n\tfetchPreviousPage: () => Promise<TData>;\n\thasNextPage: boolean;\n\thasPreviousPage: boolean;\n\tisFetchingNextPage: boolean;\n\tisFetchingPreviousPage: boolean;\n}\n",
"target": "<%- config.aliases.components %>/hooks.tsx"
}
]
}