58 lines
1.8 KiB
TypeScript
58 lines
1.8 KiB
TypeScript
import { queryOptions } from '@tanstack/react-query';
|
|
import {
|
|
getCurrentSetupRun,
|
|
getSetupProfiles,
|
|
getSetupReadiness,
|
|
getSetupRunReport,
|
|
getSetupTemplates,
|
|
verifySetup
|
|
} from './service';
|
|
import type { SetupVerificationPayload } from './types';
|
|
|
|
export const setupKeys = {
|
|
all: ['setup'] as const,
|
|
readiness: (profileId?: string) => [...setupKeys.all, 'readiness', profileId ?? 'crm_demo'] as const,
|
|
templates: (profileId?: string) => [...setupKeys.all, 'templates', profileId ?? 'crm_demo'] as const,
|
|
profiles: (profileId?: string) => [...setupKeys.all, 'profiles', profileId ?? 'crm_demo'] as const,
|
|
run: () => [...setupKeys.all, 'run'] as const,
|
|
report: () => [...setupKeys.all, 'run', 'report'] as const,
|
|
verification: (payload: SetupVerificationPayload = {}) =>
|
|
[...setupKeys.all, 'verification', payload] as const
|
|
};
|
|
|
|
export const setupReadinessQueryOptions = (profileId?: string) =>
|
|
queryOptions({
|
|
queryKey: setupKeys.readiness(profileId),
|
|
queryFn: () => getSetupReadiness(profileId)
|
|
});
|
|
|
|
export const setupTemplatesQueryOptions = (profileId?: string) =>
|
|
queryOptions({
|
|
queryKey: setupKeys.templates(profileId),
|
|
queryFn: () => getSetupTemplates(profileId)
|
|
});
|
|
|
|
export const setupProfilesQueryOptions = (profileId?: string) =>
|
|
queryOptions({
|
|
queryKey: setupKeys.profiles(profileId),
|
|
queryFn: () => getSetupProfiles(profileId)
|
|
});
|
|
|
|
export const setupRunQueryOptions = () =>
|
|
queryOptions({
|
|
queryKey: setupKeys.run(),
|
|
queryFn: () => getCurrentSetupRun()
|
|
});
|
|
|
|
export const setupRunReportQueryOptions = () =>
|
|
queryOptions({
|
|
queryKey: setupKeys.report(),
|
|
queryFn: () => getSetupRunReport()
|
|
});
|
|
|
|
export const setupVerificationQueryOptions = (payload: SetupVerificationPayload = {}) =>
|
|
queryOptions({
|
|
queryKey: setupKeys.verification(payload),
|
|
queryFn: () => verifySetup(payload)
|
|
});
|