Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

fix(crm): make manual record removal discoverable (#8837)

gbirman0f31bb44faa7
diff --git a/apps/web/AGENTS.md b/apps/web/AGENTS.md
index 524b8e0201..2569ea807e 100644
--- a/apps/web/AGENTS.md
+++ b/apps/web/AGENTS.md
@@ -343,6 +343,9 @@ not to account-wide paired runtime count; a user can pair several computers.
### General
+- Keep CRM removal and restoration visible on company/contact Overview pages;
+ use the existing hidden mutations and confirm company contact/email-sync effects.
+
- Keep selection controls on shared `Checkbox`, `ToggleSwitch`, and `RadioGroup`;
preserve their native input semantics and use root sizing instead of internal
control/glyph overrides. See the [selection-control contract](../../.agents/rules/web/ui-primitives.md#selection-controls).
diff --git a/apps/web/src/features/crm/README.md b/apps/web/src/features/crm/README.md
index 05a1d3b353..0537cd72eb 100644
--- a/apps/web/src/features/crm/README.md
+++ b/apps/web/src/features/crm/README.md
@@ -48,6 +48,15 @@ CRM supplies row/header/empty state slots, filter choices, grouping policy, and
its own collection state to the shared collection renderer. Shared collection code must not acquire CRM hooks or
CRM-specific state again.
+Company and contact Overview pages expose `RecordVisibilityAction` for removal
+and restoration through the existing hidden mutations. Keep admin/owner checks,
+confirmation of the company-wide contact cascade, and the restore action on the
+open record. The information panel's visibility checkbox uses the same state.
+Both hidden mutations emit `crm.visibility_change` through request and cache
+refresh completion, with the opaque record ID, record type, requested hidden
+state, and outcome. `crm.visibility_change.refresh` times cache invalidation and
+the dependent query refreshes before the mutation stops being pending.
+
`task-composer.ts` owns the CRM task preset: Companies/Contacts are visible,
Status remains a task default but is not initially shown. CRM registers live
`{ task: TaskComposerContext }` values with the provider in
diff --git a/apps/web/src/features/crm/browser-test/visibility.browser.e2e.ts b/apps/web/src/features/crm/browser-test/visibility.browser.e2e.ts
new file mode 100644
index 0000000000..90799565f7
--- /dev/null
+++ b/apps/web/src/features/crm/browser-test/visibility.browser.e2e.ts
@@ -0,0 +1,100 @@
+import { expect, test } from '@playwright/test';
+
+declare global {
+ interface Window {
+ finishVisibilitySave(success: boolean): void;
+ switchVisibilityRecord(): void;
+ }
+}
+
+for (const device of [
+ { name: 'desktop', width: 1280, height: 800, hasTouch: false },
+ { name: 'phone', width: 390, height: 844, hasTouch: true },
+ { name: 'tablet', width: 1024, height: 768, hasTouch: true },
+]) {
+ test.describe(device.name, () => {
+ // The first page compiles the production UI dependencies on a cold server.
+ test.setTimeout(180_000);
+ test.use({
+ viewport: { width: device.width, height: device.height },
+ hasTouch: device.hasTouch,
+ });
+ test.beforeEach(async ({ page }) => {
+ await page.routeWebSocket('**', (socket) => socket.close());
+ await page.route('https://**', (route) => route.abort());
+ await page.route('**/__macro_dev/**', (route) => route.abort());
+ });
+
+ for (const kind of ['company', 'contact']) {
+ test(`${kind} removal can cancel, retry and restore`, async ({
+ page,
+ }, testInfo) => {
+ await page.goto(
+ `/src/features/crm/browser-test/visibility.html?kind=${kind}`
+ );
+ const remove = page.getByRole('button', {
+ name: 'Remove from CRM',
+ exact: true,
+ });
+ await remove.click();
+ const dialog = page.getByRole('dialog');
+ await expect(dialog).toBeVisible();
+ await expect(dialog).toBeInViewport({ ratio: 1 });
+ await expect(dialog).not.toHaveAttribute('data-transitioning');
+ await page.keyboard.press('Escape');
+ await expect(dialog).not.toBeVisible();
+ await expect(page.getByLabel('Visibility writes')).toHaveText('0');
+
+ await remove.click();
+ await expect(dialog).toBeInViewport({ ratio: 1 });
+ await expect(dialog).not.toHaveAttribute('data-transitioning');
+ await page.screenshot({
+ path: testInfo.outputPath(`${kind}-${device.name}.png`),
+ });
+ const confirm = dialog.getByRole('button', {
+ name: 'Remove from CRM',
+ exact: true,
+ });
+ await confirm.click();
+ await expect(confirm).toBeDisabled();
+ await expect(page.getByLabel('Visibility writes')).toHaveText('1');
+ await page.evaluate(() => window.finishVisibilitySave(false));
+ await expect(dialog).toBeVisible();
+ await confirm.click();
+ await page.evaluate(() => window.finishVisibilitySave(true));
+ await expect(dialog).not.toBeVisible();
+ await expect(page.getByLabel('Visibility writes')).toHaveText('2');
+
+ await page
+ .getByRole('button', { name: 'Restore to CRM', exact: true })
+ .click();
+ await expect(dialog).toBeInViewport({ ratio: 1 });
+ await expect(dialog).not.toHaveAttribute('data-transitioning');
+ await dialog
+ .getByRole('button', { name: 'Restore to CRM', exact: true })
+ .click();
+ await page.evaluate(() => window.finishVisibilitySave(true));
+ await expect(dialog).not.toBeVisible();
+ await expect(remove).toBeEnabled();
+ await expect(page.getByLabel('Visibility writes')).toHaveText('3');
+ await page.getByRole('button', { name: 'Toggle admin role' }).click();
+ await expect(remove).toBeDisabled();
+ });
+ }
+
+ test('record navigation discards an open confirmation', async ({
+ page,
+ }) => {
+ await page.goto('/src/features/crm/browser-test/visibility.html');
+ await page
+ .getByRole('button', { name: 'Remove from CRM', exact: true })
+ .click();
+ await expect(page.getByRole('dialog')).toBeVisible();
+ await page.evaluate(() => window.switchVisibilityRecord());
+ await expect(page.getByRole('dialog')).not.toBeVisible();
+ await page.evaluate(() => window.switchVisibilityRecord());
+ await expect(page.getByRole('dialog')).not.toBeVisible();
+ await expect(page.getByLabel('Visibility writes')).toHaveText('0');
+ });
+ });
+}
diff --git a/apps/web/src/features/crm/browser-test/visibility.html b/apps/web/src/features/crm/browser-test/visibility.html
new file mode 100644
index 0000000000..f0b228b0e7
--- /dev/null
+++ b/apps/web/src/features/crm/browser-test/visibility.html
@@ -0,0 +1,5 @@
+<!doctype html>
+<html>
+ <head><meta charset="UTF-8" /><meta name="viewport" content="width=device-width, initial-scale=1" /><title>CRM removal</title></head>
+ <body><div id="root"></div><script type="module" src="./visibility.tsx"></script></body>
+</html>
diff --git a/apps/web/src/features/crm/browser-test/visibility.tsx b/apps/web/src/features/crm/browser-test/visibility.tsx
new file mode 100644
index 0000000000..55c0f731c8
--- /dev/null
+++ b/apps/web/src/features/crm/browser-test/visibility.tsx
@@ -0,0 +1,64 @@
+import '@app/index.css';
+import { isTouchDevice } from '@core/mobile/isTouchDevice';
+import { Button } from '@ui';
+import { createSignal } from 'solid-js';
+import { render } from 'solid-js/web';
+import { RecordOverview } from '../components/record-overview';
+import { RecordVisibilityAction } from '../components/record-visibility-action';
+
+// Local mutation completion controls exercise pending and failed saves without
+// changing hosted CRM data. The action and responsive confirmation are production UI.
+document.documentElement.dataset.touchDevice = String(isTouchDevice());
+const params = new URLSearchParams(location.search);
+const kind = params.get('kind') === 'contact' ? 'contact' : 'company';
+
+function Fixture() {
+ const [recordId, setRecordId] = createSignal('first');
+ const [hidden, setHidden] = createSignal(false);
+ const [pending, setPending] = createSignal(false);
+ const [canManage, setCanManage] = createSignal(true);
+ const [writes, setWrites] = createSignal(0);
+ let finish: ((success: boolean) => void) | undefined;
+ Object.assign(window, {
+ finishVisibilitySave(success: boolean) {
+ finish?.(success);
+ },
+ switchVisibilityRecord() {
+ setRecordId((id) => (id === 'first' ? 'second' : 'first'));
+ },
+ });
+
+ return (
+ <main class="flex h-dvh flex-col bg-panel text-ink">
+ <RecordOverview>
+ <h1 class="text-2xl font-semibold">
+ {kind === 'company' ? 'Acme' : 'Maya Chen'}
+ </h1>
+ <RecordVisibilityAction
+ recordId={recordId()}
+ kind={kind}
+ name={kind === 'company' ? 'Acme' : 'Maya Chen'}
+ hidden={hidden()}
+ pending={pending()}
+ canManage={canManage()}
+ onChange={(value, onSuccess) => {
+ setPending(true);
+ setWrites((count) => count + 1);
+ finish = (success) => {
+ finish = undefined;
+ setPending(false);
+ if (!success) return;
+ setHidden(value);
+ onSuccess();
+ };
+ }}
+ />
+ <output aria-label="Visibility writes">{writes()}</output>
+ <Button onClick={() => setCanManage((value) => !value)}>
+ Toggle admin role
+ </Button>
+ </RecordOverview>
+ </main>
+ );
+}
+render(Fixture, document.getElementById('root')!);
diff --git a/apps/web/src/features/crm/components/record-visibility-action.tsx b/apps/web/src/features/crm/components/record-visibility-action.tsx
new file mode 100644
index 0000000000..babfa1560c
--- /dev/null
+++ b/apps/web/src/features/crm/components/record-visibility-action.tsx
@@ -0,0 +1,95 @@
+import EyeIcon from '@icon/system/regular/eye.svg';
+import EyeSlashIcon from '@icon/system/regular/eye-slash.svg';
+import { Button, ConfirmDialog } from '@ui';
+import { createSignal, Show } from 'solid-js';
+
+type RecordVisibilityActionProps = {
+ recordId: string;
+ kind: 'company' | 'contact';
+ name: string;
+ hidden: boolean;
+ canManage: boolean;
+ pending: boolean;
+ onChange: (hidden: boolean, onSuccess: () => void) => void;
+};
+
+/** Removal uses the existing reversible, team-wide hidden state. */
+export function RecordVisibilityAction(props: RecordVisibilityActionProps) {
+ return (
+ <Show when={props.recordId} keyed>
+ {(recordId) => <VisibilityControl {...props} recordId={recordId} />}
+ </Show>
+ );
+}
+
+function VisibilityControl(props: RecordVisibilityActionProps) {
+ const [confirming, setConfirming] = createSignal(false);
+ const label = () => (props.hidden ? 'Restore to CRM' : 'Remove from CRM');
+
+ return (
+ <div class="flex flex-col items-start gap-2">
+ <Button
+ variant="secondary"
+ disabled={!props.canManage || props.pending}
+ onClick={() => setConfirming(true)}
+ >
+ <Show when={props.hidden} fallback={<EyeSlashIcon class="size-4" />}>
+ <EyeIcon class="size-4" />
+ </Show>
+ {label()}
+ </Button>
+ <Show when={props.hidden}>
+ <p class="text-xs text-ink-muted">
+ This {props.kind === 'company' ? 'company' : 'person'} is hidden from
+ your team's CRM lists.
+ </p>
+ </Show>
+ <Show when={!props.canManage}>
+ <p class="text-xs text-ink-muted">
+ Ask a team admin or owner to remove or restore this record.
+ </p>
+ </Show>
+ <ConfirmDialog
+ open={confirming()}
+ onOpenChange={setConfirming}
+ title={`${label()}?`}
+ confirmLabel={label()}
+ pending={props.pending}
+ onConfirm={() => {
+ if (!props.canManage || props.pending) return;
+ props.onChange(!props.hidden, () => setConfirming(false));
+ }}
+ body={
+ <Show
+ when={props.hidden}
+ fallback={
+ <>
+ Hide <span class="font-medium text-ink">{props.name}</span> from
+ your team's CRM lists. This does not permanently delete the
+ record. You can restore it from this page.
+ <Show when={props.kind === 'company'}>
+ {' '}
+ All of its contacts will also be hidden, and team email sync
+ will be turned off.
+ </Show>
+ </>
+ }
+ >
+ Show <span class="font-medium text-ink">{props.name}</span> in your
+ team's CRM lists again.
+ <Show when={props.kind === 'company'}>
+ {' '}
+ All of its contacts will also be restored, including any hidden
+ individually. Team email sync will stay off until you enable it
+ separately.
+ </Show>
+ <Show when={props.kind === 'contact'}>
+ {' '}
+ Their company must also be visible for them to appear in People.
+ </Show>
+ </Show>
+ }
+ />
+ </div>
+ );
+}
diff --git a/apps/web/src/features/crm/queries/companies.ts b/apps/web/src/features/crm/queries/companies.ts
index 67cbb8b156..efd5c93cec 100644
--- a/apps/web/src/features/crm/queries/companies.ts
+++ b/apps/web/src/features/crm/queries/companies.ts
@@ -310,17 +310,40 @@ export function useSetCompanyHiddenMutation(deps: CrmRecordDependencies) {
companyId: string;
hidden: boolean;
}) =>
- throwOnErr(() => deps.storage.setCompanyHidden({ companyId, hidden })),
- onSuccess: async (_data, { companyId }) => {
- await invalidateCachedCrmContacts();
- wipeCompanyEmailCache(deps, companyId);
- return Promise.all([
- deps.client.invalidateQueries({ queryKey: soupKeys._def }),
- deps.client.invalidateQueries({
- queryKey: crmKeys.company(companyId).queryKey,
- }),
- ]);
- },
+ Telemetry.span('crm.visibility_change', async (span) => {
+ span.setAttr('crm.record_type', 'company');
+ span.setAttr('crm.record_id', companyId);
+ span.setAttr('crm.hidden', hidden);
+ try {
+ const result = await throwOnErr(() =>
+ deps.storage.setCompanyHidden({ companyId, hidden })
+ );
+ await span.span(
+ 'crm.visibility_change.refresh',
+ async (refresh) => {
+ try {
+ await invalidateCachedCrmContacts();
+ wipeCompanyEmailCache(deps, companyId);
+ await Promise.all([
+ deps.client.invalidateQueries({ queryKey: soupKeys._def }),
+ deps.client.invalidateQueries({
+ queryKey: crmKeys.company(companyId).queryKey,
+ }),
+ ]);
+ } catch (error) {
+ refresh.error('Company visibility refresh failed');
+ throw error;
+ }
+ }
+ );
+ span.setAttr('crm.visibility.outcome', 'success');
+ return result;
+ } catch (error) {
+ span.setAttr('crm.visibility.outcome', 'error');
+ span.error('Company visibility update failed');
+ throw error;
+ }
+ }),
}),
() => deps.client
);
diff --git a/apps/web/src/features/crm/queries/contacts.ts b/apps/web/src/features/crm/queries/contacts.ts
index 4e9daa13f4..f64be8b057 100644
--- a/apps/web/src/features/crm/queries/contacts.ts
+++ b/apps/web/src/features/crm/queries/contacts.ts
@@ -1,4 +1,5 @@
import { throwOnErr } from '@core/util/result';
+import { Telemetry } from '@macro-inc/observability';
import { soupKeys } from '@queries/soup/keys';
import { invalidateCachedCrmContacts } from '@service-storage/crm-contacts';
import type { CrmContactResponse } from '@service-storage/generated/schemas/crmContactResponse';
@@ -145,7 +146,7 @@ export function useSetContactNameMutation(deps: CrmRecordDependencies) {
* Hidden contacts disappear from the parent company's contact list
* (non-admin view) and from any soup surface that filters them.
*
- * Returns the invalidation promise from `onSuccess` so the mutation
+ * Awaits cache invalidation in the visibility trace so the mutation
* stays pending until both the contact query and the soup queries
* refetch — the toggle state and any dependent UI all flip in one beat.
*/
@@ -159,16 +160,39 @@ export function useSetContactHiddenMutation(deps: CrmRecordDependencies) {
contactId: string;
hidden: boolean;
}) =>
- throwOnErr(() => deps.storage.setContactHidden({ contactId, hidden })),
- onSuccess: async (_data, { contactId }) => {
- await invalidateCachedCrmContacts(contactId);
- return Promise.all([
- deps.client.invalidateQueries({ queryKey: soupKeys._def }),
- deps.client.invalidateQueries({
- queryKey: crmKeys.contact(contactId).queryKey,
- }),
- ]);
- },
+ Telemetry.span('crm.visibility_change', async (span) => {
+ span.setAttr('crm.record_type', 'contact');
+ span.setAttr('crm.record_id', contactId);
+ span.setAttr('crm.hidden', hidden);
+ try {
+ const result = await throwOnErr(() =>
+ deps.storage.setContactHidden({ contactId, hidden })
+ );
+ await span.span(
+ 'crm.visibility_change.refresh',
+ async (refresh) => {
+ try {
+ await invalidateCachedCrmContacts(contactId);
+ await Promise.all([
+ deps.client.invalidateQueries({ queryKey: soupKeys._def }),
+ deps.client.invalidateQueries({
+ queryKey: crmKeys.contact(contactId).queryKey,
+ }),
+ ]);
+ } catch (error) {
+ refresh.error('Contact visibility refresh failed');
+ throw error;
+ }
+ }
+ );
+ span.setAttr('crm.visibility.outcome', 'success');
+ return result;
+ } catch (error) {
+ span.setAttr('crm.visibility.outcome', 'error');
+ span.error('Contact visibility update failed');
+ throw error;
+ }
+ }),
}),
() => deps.client
);
diff --git a/apps/web/src/features/crm/views/company-detail.tsx b/apps/web/src/features/crm/views/company-detail.tsx
index 293e8d6ea8..78b4e1e2bd 100644
--- a/apps/web/src/features/crm/views/company-detail.tsx
+++ b/apps/web/src/features/crm/views/company-detail.tsx
@@ -3,6 +3,7 @@ import { SidePanel } from '@components/app/side-panel';
import { createMemo, Match, onCleanup, Show, Suspense, Switch } from 'solid-js';
import { CrmListSkeleton } from '../components/list-state';
import { RecordOverview } from '../components/record-overview';
+import { RecordVisibilityAction } from '../components/record-visibility-action';
import { useCrmContext } from '../context/crm-context';
import type { CrmContact as CompanyContact } from '../core/contact';
import {
@@ -23,7 +24,11 @@ import {
RecordFilesSection,
RecordReferencesSection,
} from './record-associations';
-import { useCompanyQuery } from './use-crm';
+import {
+ useCompanyQuery,
+ useIsTeamAdmin,
+ useSetCompanyHiddenMutation,
+} from './use-crm';
/**
* Root of the company detail view, laid out like a project: the host's top
@@ -68,6 +73,8 @@ function CompanyContent(props: CompanyProps) {
const pipelinesEnabled = context.pipelinesEnabled();
const { company, contacts, query } = useCompanyQuery(() => props.companyId);
usePending('crm.record', () => query.isLoading);
+ const isTeamAdmin = useIsTeamAdmin();
+ const hiddenMutation = useSetCompanyHiddenMutation();
const section = () => props.section ?? 'overview';
const scope = createMemo(
(): CrmRecordScope | undefined => {
@@ -95,6 +102,37 @@ function CompanyContent(props: CompanyProps) {
<Match when={section() === 'overview'}>
<RecordOverview>
<CompanyHeader company={company()} />
+ <Show when={company()}>
+ {(current) => (
+ <RecordVisibilityAction
+ recordId={current().id}
+ kind="company"
+ name={current().name}
+ hidden={current().hidden}
+ canManage={isTeamAdmin()}
+ pending={hiddenMutation.isPending}
+ onChange={(hidden, onSuccess) =>
+ hiddenMutation.mutate(
+ { companyId: current().id, hidden },
+ {
+ onSuccess: () => {
+ onSuccess();
+ context.feedback.success(
+ hidden
+ ? 'Company removed from CRM'
+ : 'Company restored to CRM'
+ );
+ },
+ onError: () =>
+ context.feedback.failure(
+ 'Could not update company visibility'
+ ),
+ }
+ )
+ }
+ />
+ )}
+ </Show>
<Show when={pipelinesEnabled()}>
<context.PipelineEntries
record={{ type: 'company', id: props.companyId }}
diff --git a/apps/web/src/features/crm/views/contact-detail.tsx b/apps/web/src/features/crm/views/contact-detail.tsx
index f614d8e615..c76e403220 100644
--- a/apps/web/src/features/crm/views/contact-detail.tsx
+++ b/apps/web/src/features/crm/views/contact-detail.tsx
@@ -3,6 +3,7 @@ import { SidePanel } from '@components/app/side-panel';
import { createMemo, Match, onCleanup, Show, Suspense, Switch } from 'solid-js';
import { CrmListSkeleton } from '../components/list-state';
import { RecordOverview } from '../components/record-overview';
+import { RecordVisibilityAction } from '../components/record-visibility-action';
import { useCrmContext } from '../context/crm-context';
import {
type ContactSection,
@@ -19,7 +20,11 @@ import {
RecordFilesSection,
RecordReferencesSection,
} from './record-associations';
-import { useContactQuery, useIsTeamAdmin } from './use-crm';
+import {
+ useContactQuery,
+ useIsTeamAdmin,
+ useSetContactHiddenMutation,
+} from './use-crm';
/**
* Root of the contact detail view, laid out like a project: the host's top
@@ -64,6 +69,7 @@ function ContactContent(props: ContactProps) {
}))
);
const isTeamAdmin = useIsTeamAdmin();
+ const hiddenMutation = useSetContactHiddenMutation();
const section = () => props.section ?? 'overview';
const scope = createMemo(
(): CrmRecordScope | undefined => {
@@ -95,6 +101,37 @@ function ContactContent(props: ContactProps) {
contact={contact()}
onOpenCompany={props.onOpenCompany}
/>
+ <Show when={contact()}>
+ {(current) => (
+ <RecordVisibilityAction
+ recordId={current().id}
+ kind="contact"
+ name={current().name ?? current().email}
+ hidden={current().hidden}
+ canManage={isTeamAdmin()}
+ pending={hiddenMutation.isPending}
+ onChange={(hidden, onSuccess) =>
+ hiddenMutation.mutate(
+ { contactId: current().id, hidden },
+ {
+ onSuccess: () => {
+ onSuccess();
+ context.feedback.success(
+ hidden
+ ? 'Person removed from CRM'
+ : 'Person restored to CRM'
+ );
+ },
+ onError: () =>
+ context.feedback.failure(
+ 'Could not update contact visibility'
+ ),
+ }
+ )
+ }
+ />
+ )}
+ </Show>
<Show when={pipelinesEnabled()}>
<context.PipelineEntries
record={{ type: 'contact', id: props.contactId }}
diff --git a/apps/web/src/features/crm/views/record-detail.test.tsx b/apps/web/src/features/crm/views/record-detail.test.tsx
index bcdf6cd503..2a825e4441 100644
--- a/apps/web/src/features/crm/views/record-detail.test.tsx
+++ b/apps/web/src/features/crm/views/record-detail.test.tsx
@@ -92,6 +92,8 @@ vi.mock('./use-crm', () => ({
: undefined,
}),
useIsTeamAdmin: () => () => false,
+ useSetCompanyHiddenMutation: () => ({ isPending: false, mutate: vi.fn() }),
+ useSetContactHiddenMutation: () => ({ isPending: false, mutate: vi.fn() }),
}));
vi.mock('@solidjs/router', () => ({ useSearchParams: () => [{}] }));
vi.mock('./company-detail', async () => {
diff --git a/docs/agent-guide/crm.md b/docs/agent-guide/crm.md
index acc639c55e..c6878c6753 100644
--- a/docs/agent-guide/crm.md
+++ b/docs/agent-guide/crm.md
@@ -214,6 +214,30 @@ title with the unavailable-state message when the flag is off, without database
queries or creation actions. Copy-link islands are 40px square on touch with
a 24px icon. Verify both record types, section changes, dismissal, copy feedback,
and header fit at phone and tablet widths.
+
+To remove a company or person manually, open its **Overview**, choose **Remove
+from CRM** below its details, and confirm. On phones the confirmation is a bottom
+sheet. Only team admins and owners can remove or restore records; other members
+see a disabled action and an explanation. Removal hides the record from the
+team's CRM lists without permanently deleting it. The page stays open and offers
+**Restore to CRM**; admins can also reopen the record's direct link to restore it.
+Hiding a company hides all its contacts and turns off team email sync. Restoring
+the company restores every contact, including individually hidden ones, but leaves
+email sync off; re-enable **Sync Emails** under the information panel's **Sharing**
+section if needed. Admins can still inspect hidden contacts in a company's Team
+tab. The existing **Sharing → Visible in CRM** checkbox and company row **Hide /
+Unhide** actions control the same state.
+Restoring a person under a hidden company does not make them appear in People
+until that company is restored too.
+
+The backend-free browser check is
+`bunx playwright test --config src/features/crm/browser-test/playwright.config.ts visibility.browser.e2e.ts`
+from `apps/web`. It exercises cancellation, pending/error handling, restoration,
+permissions, and changing records with an open confirmation on desktop, phone,
+and tablet.
+Fixture screenshots: [company confirmation on desktop](media/crm-removal/company-desktop.png)
+and [person confirmation on phone](media/crm-removal/contact-phone.png).
+
Their information panel starts closed and opens as a floating bubble at every
width, without shrinking the record content. Click outside the bubble or use
the toggle to dismiss it; the open state is not restored on a later visit.
diff --git a/docs/agent-guide/media/crm-removal/company-desktop.png b/docs/agent-guide/media/crm-removal/company-desktop.png
new file mode 100644
index 0000000000..258af54fcc
Binary files /dev/null and b/docs/agent-guide/media/crm-removal/company-desktop.png differ
diff --git a/docs/agent-guide/media/crm-removal/contact-phone.png b/docs/agent-guide/media/crm-removal/contact-phone.png
new file mode 100644
index 0000000000..cd0488e8e9
Binary files /dev/null and b/docs/agent-guide/media/crm-removal/contact-phone.png differ