);
}
```
**2. Modify profile/page.tsx** — two targeted changes:
a) Update the DB query to fetch `agentInitialsData` alongside `agentSignatureData` (single query, one round-trip):
```typescript
// BEFORE:
columns: { agentSignatureData: true },
// AFTER:
columns: { agentSignatureData: true, agentInitialsData: true },
```
b) Add import for `AgentInitialsPanel` and a second `` below the existing Agent Signature section:
```typescript
import { AgentInitialsPanel } from '../../_components/AgentInitialsPanel';
```
Add this section after the closing `` of the Agent Signature block:
```tsx
Agent Initials
Draw your initials once. They will be embedded in any "Agent Initials" fields when you prepare a document.
```
**3. Modify FieldPlacer.tsx** — two targeted changes:
a) Add `'agent-initials'` token to `PALETTE_TOKENS` (7th entry, after `agent-signature`):
```typescript
{ id: 'agent-initials', label: 'Agent Initials', color: '#ea580c' },
```
Orange (`#ea580c`) is unused by any existing token. It visually groups with red (agent-signature) as "agent-owned" while remaining distinct from client-visible tokens.
b) Add `'agent-initials'` to the `validTypes` Set:
```typescript
// Add 'agent-initials' to the existing set — do not change any other entries
const validTypes = new Set(['client-signature', 'initials', 'text', 'checkbox', 'date', 'agent-signature', 'agent-initials']);
```
Do NOT change any other FieldPlacer logic — drag behavior, overlay rendering, and coordinate conversion all apply to agent-initials the same way they apply to agent-signature.
cd /Users/ccopeland/temp/red/teressa-copeland-homes && npx tsc --noEmit 2>&1 | head -20TypeScript compiles clean; `npm run dev` starts without error; /portal/profile shows both the Agent Signature section (unchanged) and the new Agent Initials section below it; FieldPlacer palette shows an orange "Agent Initials" token as the 7th entry; the existing purple "Initials" client token is still present and unchanged.
After both tasks complete, verify the full Plan 01 state:
1. `npx tsc --noEmit` passes with zero errors
2. `npm run dev` starts without errors
3. Migration applied: `psql -d [db] -c "SELECT column_name FROM information_schema.columns WHERE table_name='users' AND column_name='agent_initials_data';"` returns one row
4. GET /api/agent/initials returns 401 without session; returns `{ agentInitialsData: null }` with valid session
5. /portal/profile renders both sections — Agent Signature (existing, unchanged) and Agent Initials (new) — with their respective canvases
6. Agent can draw on the initials canvas and click "Save Initials" — PUT /api/agent/initials returns 200, thumbnail appears
7. Agent can click "Update Initials" — canvas reappears for redraw
8. FieldPlacer shows "Agent Initials" as a draggable orange token (7th entry); purple "Initials" client token still present
9. Placing an "Agent Initials" field on a document page saves it with `type: 'agent-initials'` in signatureFields
10. GET /api/sign/[token] does NOT return agent-initials fields (isClientVisibleField returns false)
- INIT-01: Agent can draw and save initials from /portal/profile; thumbnail shows after save
- INIT-02: "Update Initials" button replaces saved initials with a new one (same PUT route)
- INIT-03 (partial): "Agent Initials" token appears in FieldPlacer palette; placed fields have type 'agent-initials'; isClientVisibleField() excludes them from client signing session (Plan 02 completes the embedding)
- INIT-04 (confirmed): Existing purple "Initials" token still present in palette; no changes to SigningPageClient.tsx or any client-initials pipeline
- TypeScript build clean; zero new npm packages