Skip to main content

Hooks Reference

Custom hooks live in lib/hooks/ with domain-specific subdirectories. All hooks follow React conventions and use Apollo Client for GraphQL operations.

AI & Automation

HookFilePurpose
useAIAgentuseAIAgent.tsAgent CRUD (create, update, enable/disable, delete) via AI service endpoint
useAIAgentChatuseAIAgentChat.tsStreaming chat via WebSocket subscription (7 event types)
useAgentDocumentsuseAgentDocuments.tsRAG document upload, categorize, reprocess, priority
useTextRewriteuseTextRewrite.tsAI-powered text rewriting for descriptions
useTextRewriteClientuseTextRewriteClient.tsClient-side text rewriting utilities
useSkillCreationuseSkillCreation.tsCreate and manage skill definitions

CV Processing

HookFilePurpose
useCvUploadAndParseuseCvUploadAndParse.tsUpload + parse orchestration (5-min timeout)
useCvExtractionGraphQLuseCvExtractionGraphQL.tsSubscription-based extraction with real-time progress
useCvProcessorGraphQLuseCvProcessorGraphQL.tsCV processing via GraphQL subscription
useCvManageruseCvManager.tsCV lifecycle CRUD operations
useCvWithFaceExtractionuseCvWithFaceExtraction.tsCombined CV + face photo extraction
useFaceExtractionuseFaceExtraction.tsProfile photo extraction from documents
useStructuredCvMutationsuseStructuredCvMutations.tsDiff-based save orchestrator (parallel mutations)
useCreateCvuseCreateCv.tsCreate new CV from scratch or template

Payment & Billing

HookFilePurpose
useCheckoutuseCheckout.tsStripe checkout flow (company vs personal routing)
useBillingErroruseBillingError.tsError detection: INSUFFICIENT_CREDITS, PLAN_LIMIT_EXCEEDED, SUBSCRIPTION_INACTIVE
useCreditCheckuseCreditCheck.tsPre-operation balance validation
useCreditBalanceuseCreditBalance.tsCurrent credit balance (auto-routes company/personal)
useBillingConfiguseBillingConfig.tsBilling configuration and pricing
useCreditPurchaseuseCreditPurchase.tsCredit pack purchase flow
useSubscriptionStatususeSubscriptionStatus.tsSubscription status and feature eligibility

Communication

HookFilePurpose
useMessaginguseMessaging.tsFull messaging: send/edit/delete, conversations, real-time, search
useVoiceChatuseVoiceChat.tsNova Sonic voice (10 languages, recording, playback)

Job Processing

HookFilePurpose
useJobParsingSubscriptionuseJobParsingSubscription.tsJob description parsing via subscription (title, skills, requirements)
useJobExtractionWebSocketuseJobExtractionWebSocket.tsLegacy WebSocket-based job extraction
useJobsuseJobs.tsJob listing and management
useJobStatisticsuseJobStatistics.tsJob analytics and stats

Candidate & Talent Management

HookFilePurpose
useAddCandidateuseAddCandidate.tsCandidate addition with pipeline integration
useAddCandidateChanneluseAddCandidateChannel.tsAdd contact channel (email, phone)
useRemoveCandidateuseRemoveCandidate.tsRemove candidate
useAttachToTalentPooluseAttachToTalentPool.tsAttach candidate to talent pool
useApplyForJobuseApplyForJob.tsJob application workflow
useWithdrawApplicationuseWithdrawApplication.tsWithdraw submitted application
useUserJobMatchScoreuseUserJobMatchScore.tsAI compatibility score (user vs job)
useJobCandidatesjobs/useJobCandidates.tsPipeline candidates with batch score fetching
useRecommendedTalentsjobs/useRecommendedTalents.tsRecommended talents with batch scores, 70% filter, loading state
useRecommendedTalentsSafeuseRecommendedTalentsSafe.tsRecommended talents with NaN-safe error handling
useTalentsInPooluseTalentsInPool.tsList talents in a pool
useTalentPoolCollaboratorsuseTalentPoolCollaborators.tsManage pool collaborators

Candidate Subdirectory (lib/hooks/candidates/)

HookPurpose
useGetCandidatesFetch candidates with filtering and pagination
useDeleteCandidateDelete candidate
useUpdateCandidateStatusUpdate pipeline status (shortlisted, rejected, hired)
useCompanyCandidatesOnlyFilter to current company's candidates

Company & Contact Management

HookFilePurpose
useCompanyBadgeCountsuseCompanyBadgeCounts.tsCompany dashboard badge counts
useBadgeCountsuseBadgeCounts.tsGlobal badge count management
useCompanyContactsuseCompanyContacts.tsCompany contact management
useCompanyContactsDatauseCompanyContactsData.tsContact data with aggregation
useCompanyCandidatesuseCompanyCandidates.tsCompany candidate list
useCompanySharelistsuseCompanySharelists.tsShareable lists management

Subdirectory Hooks

DirectoryHooksPurpose
companies/useCreateCompanyCompany registration
contacts/useContactTypes, useDeleteContactContact types and deletion
jobs/useJobCandidates, useRecommendedTalents, useUpdateJobJob-specific operations
talents/useCompanyTalentsCompany talent management
admin/useLogStreamLive system log streaming

Score Utilities (lib/utils/score.ts)

Score normalization is centralized — never add local normalizeScore functions in pages or hooks.

ExportReturnsPurpose
normalizeScore(raw)numberClamp to 0-100, round. Returns 0 for null/NaN
normalizeScoreNullable(raw)number | nullSame, but returns null for null/NaN (distinguishes "no score" from "0%")
averageScore(entries)numberAverage an array of { score } entries, skipping non-finite values

See Matching Engine — Frontend Score Handling for full details.

UI Utilities

HookFilePurpose
useAutoPageTitleuseAutoPageTitle.tsAuto-update document title based on context
useCardHighlightuseCardHighlight.tsCard focus and highlight management
useErrorHandleruseErrorHandler.tsCentralized error handling with toast
useFileHandlinguseFileHandling.tsFile upload, validation, processing
useLocalStorageuseLocalStorage.tslocalStorage wrapper with cross-tab sync
useUnreadMessageCountuseUnreadMessageCount.tsUnread message count for badges