Contact Fact Provenance & Suggestion (crm/facts.tsx)

mperkins0155/crm · crm, CRM / Leads, react, client, fact, suggestion

Client components that show a contact fact’s source details and let users accept or dismiss suggested facts, updating the CRM cache.

// Source: https://github.com/mperkins0155/crm | License: MIT | Copyright 2026 Comp AI
// Provided via justclaw.it.com; keep this notice with the code.
"use client";

import { Provenance } from "@crm/ui/components/sourced-value";
import { Suggestion } from "@crm/ui/components/suggestion";
import { useMutation } from "@tanstack/react-query";
import { toast } from "sonner";
import { LocalDateTime } from "@/components/local-date-time";
import type { ContactFact } from "@/lib/contact-facts";
import { useCrmCache } from "@/lib/trpc/cache";
import { useTRPC } from "@/lib/trpc/client";

export function FactProvenance({ fact }: { fact: ContactFact }) {
	return (
		<Provenance
			claim={fact.value}
			reasons={fact.evidence.map((item) => item.detail)}
			observedAt={
				<LocalDateTime
					date={f

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search 40K more like it.

Get a free API key