Skip to content

Open-source agentic AI Search Execution Platform. Track AI visibility, find opportunities, and let agents turn signals into prioritized actions and drafted fixes across ChatGPT, Claude, Gemini, Google AI Overviews, Google AI Mode, Perplexity, Grok, and Microsoft Copilot.

fix(settings): say Framer's set-up isn't finished until a collection is saved (#1719)

Cihan4210c5f248ae
diff --git a/web/messages/en.json b/web/messages/en.json
index 8f54f9972..b2e33b0ac 100644
--- a/web/messages/en.json
+++ b/web/messages/en.json
@@ -9483,6 +9483,7 @@
"unavailable": "Couldn't read the Framer connection right now.",
"notConfigured": "Framer isn't set up on this server yet.",
"connected": "Connected",
+ "setupNotFinished": "Setup not finished",
"refused": "Key refused",
"project": "Project: {project}",
"published": "published at {url}",
@@ -9490,7 +9491,7 @@
"notConnectedMember": "Not connected. Admins and managers can connect Framer.",
"refusedMember": "Framer refused the API key. Pages can't go there until an admin or manager connects it again.",
"pagesGoTo": "Pages go to {collection} as draft items.",
- "noCollection": "No collection picked yet.",
+ "noCollection": "No collection picked yet. Pages can't go to Framer until an admin or manager finishes the setup.",
"projectLabel": "Project address",
"projectPlaceholder": "https://framer.com/projects/…",
"keyLabel": "API key",
@@ -9500,6 +9501,7 @@
"connect": "Connect",
"connecting": "Checking the project…",
"connectedToast": "Framer connected",
+ "connectedSetupToast": "Framer connected. Now pick a collection and save.",
"refusedNote": "Framer refused the saved API key. Make a new one in the project and connect again to send pages.",
"replace": "Replace key",
"cancel": "Cancel",
@@ -9508,6 +9510,7 @@
"disconnectDescription": "Pages stop going to Framer. Items already sent stay in Framer. Framer doesn't let us revoke the API key: delete it in the project's Site Settings › General.",
"disconnected": "Framer disconnected",
"disconnectedNotRevoked": "Framer disconnected. Delete its API key in Framer too, in the project's Site Settings › General.",
+ "setupStep": "Last step: pick the collection your pages go to, check which field takes what, then Save. Pages can't be sent to Framer until then.",
"collectionLabel": "Collection",
"collectionPlaceholder": "Pick a collection",
"collectionBlocked": "{name} (needs fields we can't fill)",
diff --git a/web/src/components/settings/framer-card.test.tsx b/web/src/components/settings/framer-card.test.tsx
index 051f00c47..a17d47aec 100644
--- a/web/src/components/settings/framer-card.test.tsx
+++ b/web/src/components/settings/framer-card.test.tsx
@@ -162,6 +162,16 @@ async function open(label: string) {
return [...list.querySelectorAll<HTMLElement>('[role="option"]')];
}
const texts = (options: HTMLElement[]) => options.map((o) => o.textContent);
+/** The badges by the card's title. */
+const badges = () =>
+ [...container.querySelectorAll('[data-slot="badge"]')].map((b) => b.textContent);
+/** Connected to a project, with no collection saved yet. */
+const NO_COLLECTION: FramerConnection = {
+ ...CONNECTED,
+ collectionId: null,
+ collectionName: null,
+ fieldMap: {},
+};
const close = async () => {
await act(async () => {
document.dispatchEvent(new KeyboardEvent('keydown', { key: 'Escape', bubbles: true }));
@@ -235,6 +245,56 @@ describe('FramerCard', () => {
expect(container.textContent).toContain('Pages go to Blog as draft items.');
});
+ it('leaves the collection for last on connecting a project, its picker focused', async () => {
+ client.connectFramer.mockResolvedValue({ ok: true, connection: NO_COLLECTION });
+ await render();
+ await type('Project address', `https://framer.com/projects/Acme--${PROJECT_ID}`);
+ await type('API key', KEY);
+ await submit();
+ expect(toast.success).toHaveBeenCalledWith('Framer connected. Now pick a collection and save.');
+ expect(badges()).toEqual(['Setup not finished']);
+ expect(container.textContent).toContain(TEXT.setupStep);
+ // The setup's last step: the collection picker, focused.
+ expect(document.activeElement).toBe(field('Collection'));
+ });
+
+ it('says the setup isn’t finished until a collection is saved', async () => {
+ connectedWith(NO_COLLECTION);
+ client.saveFramerTarget.mockResolvedValue({ ok: true, connection: CONNECTED });
+ await render();
+ expect(badges()).toEqual(['Setup not finished']);
+ expect(container.textContent).toContain(TEXT.setupStep);
+ // Read on opening the page, the picker isn't focused: only right after connecting.
+ expect(document.activeElement).not.toBe(field('Collection'));
+
+ await pick('Collection', 'Blog');
+ expect(container.textContent).toContain(TEXT.setupStep);
+ await click(button('Save'));
+ expect(client.saveFramerTarget).toHaveBeenCalledWith(
+ 'b1',
+ expect.objectContaining({
+ collectionId: 'c1',
+ }),
+ );
+ expect(badges()).toEqual(['Connected']);
+ expect(container.textContent).not.toContain(TEXT.setupStep);
+ expect(container.textContent).toContain('Pages go to Blog as draft items.');
+ });
+
+ it('keeps the setup a new key for the same project keeps', async () => {
+ connectedWith(CONNECTED);
+ client.connectFramer.mockResolvedValue({ ok: true, connection: CONNECTED });
+ await render();
+ expect(badges()).toEqual(['Connected']);
+ await click(button('Replace key'));
+ await type('API key', KEY);
+ await submit();
+ expect(toast.success).toHaveBeenCalledWith('Framer connected');
+ expect(badges()).toEqual(['Connected']);
+ expect(container.textContent).not.toContain(TEXT.setupStep);
+ expect(document.activeElement).not.toBe(field('Collection'));
+ });
+
it('keeps Connect off until both are filled, and stops a key too short to be one', async () => {
await render();
expect(button('Connect')!.disabled).toBe(true);
@@ -395,7 +455,7 @@ describe('FramerCard', () => {
expect(client.readFramer).toHaveBeenCalledTimes(2);
expect(container.textContent).toContain('Project: Other Site');
expect(client.readFramerCollections).toHaveBeenCalledTimes(2);
- expect(container.textContent).toContain(TEXT.noCollection);
+ expect(container.textContent).toContain(TEXT.setupStep);
});
it('asks to connect again when a save finds the connection gone', async () => {
@@ -581,7 +641,7 @@ describe('FramerCard', () => {
for (const [connection, text] of [
[null, 'Not connected. Admins and managers can connect Framer.'],
[{ ...CONNECTED, status: 'auth_failed' }, TEXT.refusedMember],
- [{ ...CONNECTED, collectionId: null, collectionName: null }, TEXT.noCollection],
+ [NO_COLLECTION, TEXT.noCollection],
] as const) {
connectedWith(connection);
act(() => root.unmount());
@@ -589,6 +649,12 @@ describe('FramerCard', () => {
await render();
expect(container.textContent).toContain(text);
}
+ // Connected, no collection saved: pages can't go yet, and the step is the managers'.
+ expect(badges()).toEqual(['Setup not finished']);
+ expect(container.textContent).toContain(
+ "No collection picked yet. Pages can't go to Framer until an admin or manager finishes the setup.",
+ );
+ expect(container.textContent).not.toContain(TEXT.setupStep);
});
it('says when the server can’t keep a key, or the connection can’t be read', async () => {
diff --git a/web/src/components/settings/framer-card.tsx b/web/src/components/settings/framer-card.tsx
index 8823b0e69..8b5e8e982 100644
--- a/web/src/components/settings/framer-card.tsx
+++ b/web/src/components/settings/framer-card.tsx
@@ -78,6 +78,8 @@ export function FramerCard() {
const [replacingFor, setReplacingFor] = useState<string | null>(null);
const replacing = replacingFor !== null && replacingFor === activeBrandId;
const [disconnecting, setDisconnecting] = useState(false);
+ // Connected just now without a collection, for the brand: its picker takes the focus.
+ const [settingUpFor, setSettingUpFor] = useState<string | null>(null);
// Bumped to read the connection again: a key refused or replaced meanwhile.
const [reads, setReads] = useState(0);
@@ -141,7 +143,7 @@ export function FramerCard() {
<div className="min-w-0">
<div className="flex flex-wrap items-center gap-2">
<p className="text-sm font-medium">{t('title')}</p>
- {connection?.status === 'connected' && (
+ {connection?.status === 'connected' && connection.collectionId && (
<Badge
variant="outline"
className="border-emerald-500/30 bg-emerald-500/10 text-emerald-600 dark:text-emerald-400"
@@ -149,6 +151,15 @@ export function FramerCard() {
{t('connected')}
</Badge>
)}
+ {/* Connected, but nothing goes to Framer until a collection is saved. */}
+ {connection?.status === 'connected' && !connection.collectionId && (
+ <Badge
+ variant="outline"
+ className="border-amber-500/30 bg-amber-500/10 text-amber-700 dark:text-amber-400"
+ >
+ {t('setupNotFinished')}
+ </Badge>
+ )}
{connection?.status === 'auth_failed' && (
<Badge
variant="outline"
@@ -246,6 +257,7 @@ export function FramerCard() {
onCancel={replacing ? () => setReplacingFor(null) : undefined}
onConnected={(next) => {
setReplacingFor(null);
+ setSettingUpFor(next.collectionId ? null : activeBrandId);
setConnection(next);
}}
/>
@@ -256,7 +268,11 @@ export function FramerCard() {
key={`${activeBrandId}:${connection.projectId}`}
brandId={activeBrandId}
connection={connection}
- onSaved={setConnection}
+ focusCollection={settingUpFor === activeBrandId}
+ onSaved={(next) => {
+ setSettingUpFor(null);
+ setConnection(next);
+ }}
onStale={() => setReads((n) => n + 1)}
/>
)}
@@ -303,7 +319,8 @@ function KeyForm({
return;
}
setApiKey('');
- toast.success(t('connectedToast'));
+ // A new key for the same project keeps its collection; else the setup's last step is left.
+ toast.success(t(result.connection.collectionId ? 'connectedToast' : 'connectedSetupToast'));
onConnected(result.connection);
};
const connectProject = guard(() => void connect(), { action: tActions('connectCms') });
@@ -379,11 +396,14 @@ function KeyForm({
function FramerMapping({
brandId,
connection,
+ focusCollection,
onSaved,
onStale,
}: {
brandId: string;
connection: FramerConnection;
+ /** Just connected: the collection picker, the setup's last step, takes the focus. */
+ focusCollection: boolean;
onSaved: (connection: FramerConnection) => void;
/** The connection changed (a key refused, replaced or removed): read it again. */
onStale: () => void;
@@ -491,11 +511,16 @@ function FramerMapping({
return (
<div className="space-y-4">
- <p className="text-sm text-muted-foreground">
- {connection.collectionName
- ? t('pagesGoTo', { collection: connection.collectionName })
- : t('noCollection')}
- </p>
+ {connection.collectionId ? (
+ <p className="text-sm text-muted-foreground">
+ {t('pagesGoTo', { collection: connection.collectionName ?? connection.collectionId })}
+ </p>
+ ) : (
+ <div className="flex items-start gap-2 rounded-md border border-amber-200 bg-amber-50 p-3 text-sm text-amber-800 dark:border-amber-900/50 dark:bg-amber-950/30 dark:text-amber-300">
+ <AlertTriangle className="mt-0.5 h-4 w-4 shrink-0" />
+ <span>{t('setupStep')}</span>
+ </div>
+ )}
{listed === null ? (
<p className="flex items-center gap-2 text-xs text-muted-foreground">
<Loader2 className="h-3.5 w-3.5 animate-spin" />
@@ -511,6 +536,7 @@ function FramerMapping({
items={collectionItems}
value={collection ? collection.id : null}
placeholder={t('collectionPlaceholder')}
+ autoFocus={focusCollection}
onChange={(value) => {
const next = collections.find((c) => c.id === value);
if (!next || next.id === collectionId) return;