Feat: CRM v2, Richer synthetic data, Canvas JSON Components
This commit is contained in:
@@ -13,6 +13,9 @@ import type {
|
||||
ImportProposal,
|
||||
ImportReviewDecision,
|
||||
QdScoreEntry,
|
||||
OracleClientDataListItem,
|
||||
OracleClientDataDetail,
|
||||
OracleClientTimelineItem,
|
||||
} from '@/types/crmTypes';
|
||||
import { VELOCITY_TOKEN_KEY } from '@/lib/velocityPlatformClient';
|
||||
|
||||
@@ -218,3 +221,41 @@ export async function commitImportBatch(batchId: string): Promise<{
|
||||
}>(`/api/crm/imports/${batchId}/commit`, { method: 'POST' });
|
||||
return res.data;
|
||||
}
|
||||
|
||||
export async function fetchOracleClientData(params?: {
|
||||
search?: string;
|
||||
limit?: number;
|
||||
offset?: number;
|
||||
}): Promise<{ items: OracleClientDataListItem[]; count: number }> {
|
||||
const qs = new URLSearchParams();
|
||||
if (params?.search) qs.set('search', params.search);
|
||||
if (params?.limit != null) qs.set('limit', String(params.limit));
|
||||
if (params?.offset != null) qs.set('offset', String(params.offset));
|
||||
const res = await apiFetch<{ status: string; data: OracleClientDataListItem[]; meta?: { count?: number } }>(
|
||||
`/api/crm/client-data?${qs}`,
|
||||
);
|
||||
return { items: res.data, count: res.meta?.count ?? res.data.length };
|
||||
}
|
||||
|
||||
export async function fetchOracleClientDataDetail(personId: string): Promise<OracleClientDataDetail> {
|
||||
const res = await apiFetch<{ status: string; data: OracleClientDataDetail }>(`/api/crm/client-data/${personId}`);
|
||||
return res.data;
|
||||
}
|
||||
|
||||
export async function patchOracleClientData(
|
||||
personId: string,
|
||||
patch: Record<string, string | null>,
|
||||
): Promise<{ person_id: string; updated: string[] }> {
|
||||
const res = await apiFetch<{ status: string; data: { person_id: string; updated: string[] } }>(
|
||||
`/api/crm/client-data/${personId}`,
|
||||
{ method: 'PATCH', body: JSON.stringify(patch) },
|
||||
);
|
||||
return res.data;
|
||||
}
|
||||
|
||||
export async function fetchOracleClientTimeline(personId: string): Promise<OracleClientTimelineItem[]> {
|
||||
const res = await apiFetch<{ status: string; data: OracleClientTimelineItem[] }>(
|
||||
`/api/crm/client-data/${personId}/timeline`,
|
||||
);
|
||||
return res.data;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user