2026-07-23 05:11:16 +02:00
|
|
|
/**
|
2026-07-23 17:17:32 +02:00
|
|
|
* hooks.ts — Re-Export Hub (Company hooks removed in Phase 1C)
|
2026-07-23 05:11:16 +02:00
|
|
|
*
|
|
|
|
|
* This file re-exports all hooks from their dedicated modules so that
|
|
|
|
|
* existing imports `from '@/api/hooks'` continue to work without change.
|
|
|
|
|
*/
|
2026-07-04 01:44:51 +00:00
|
|
|
|
2026-07-23 17:17:32 +02:00
|
|
|
import { useQuery } from '@tanstack/react-query';
|
2026-07-23 05:11:16 +02:00
|
|
|
|
|
|
|
|
// ── Re-exports from dedicated modules ──
|
|
|
|
|
export * from './types';
|
|
|
|
|
export * from './auth';
|
|
|
|
|
export * from './users';
|
|
|
|
|
export * from './contacts';
|
|
|
|
|
export * from './roles';
|
|
|
|
|
export * from './groups';
|
|
|
|
|
export * from './audit';
|
|
|
|
|
export * from './notifications';
|
|
|
|
|
export * from './plugins';
|
|
|
|
|
export * from './settings';
|
|
|
|
|
export * from './attachments';
|
|
|
|
|
export * from './unifiedContacts';
|
2026-07-23 20:00:37 +02:00
|
|
|
export * from './automation';
|
2026-07-23 05:11:16 +02:00
|
|
|
|
|
|
|
|
// ── Search hook (uses dynamic import, kept inline) ──
|
2026-07-04 01:44:51 +00:00
|
|
|
|
2026-07-25 01:32:20 +02:00
|
|
|
import type { SearchResult } from './search';
|
|
|
|
|
export type { SearchResult };
|
2026-07-04 01:44:51 +00:00
|
|
|
|
2026-07-23 05:11:16 +02:00
|
|
|
export function useGlobalSearch(query: string, entityTypes?: string[]) {
|
2026-07-04 01:44:51 +00:00
|
|
|
return useQuery({
|
2026-07-23 05:11:16 +02:00
|
|
|
queryKey: ['globalSearch', query, entityTypes],
|
|
|
|
|
queryFn: async (): Promise<SearchResult[]> => {
|
|
|
|
|
if (!query.trim()) return [];
|
|
|
|
|
const { search } = await import('@/api/search');
|
|
|
|
|
const response = await search(query, entityTypes, 20);
|
|
|
|
|
return response.results || [];
|
2026-07-04 01:44:51 +00:00
|
|
|
},
|
2026-07-23 05:11:16 +02:00
|
|
|
enabled: query.trim().length > 0,
|
|
|
|
|
staleTime: 30 * 1000,
|
2026-07-04 01:44:51 +00:00
|
|
|
});
|
|
|
|
|
}
|