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 Webflow's set-up isn't finished until a collection is saved (#1601)

Cihan6f6419d49dde
diff --git a/web/messages/en.json b/web/messages/en.json
index b08ee52ce..98e00f3b5 100644
--- a/web/messages/en.json
+++ b/web/messages/en.json
@@ -7957,12 +7957,13 @@
"unavailable": "Couldn't read the Webflow connection right now.",
"notConfigured": "Webflow isn't set up on this server yet.",
"connected": "Connected",
+ "setupNotFinished": "Setup not finished",
"refused": "Token refused",
"site": "Site: {site}",
"notConnectedMember": "Not connected. Admins and managers can connect Webflow.",
"refusedMember": "Webflow refused the token. Pages can't go there until an admin or manager pastes a new one.",
"pagesGoTo": "Pages go to {collection}.",
- "noCollection": "No collection picked yet.",
+ "noCollection": "No collection picked yet. Pages can't go to Webflow until an admin or manager finishes the setup.",
"tokenLabel": "Site token",
"tokenPlaceholder": "Paste the site token",
"tokenSteps": {
@@ -7976,6 +7977,7 @@
"connect": "Connect",
"connecting": "Connecting…",
"connectedToast": "Webflow connected",
+ "connectedSetupToast": "Webflow connected. Now pick a collection and save.",
"refusedNote": "Webflow refused the saved token. Paste a new one to send pages again.",
"replaceToken": "Replace token",
"cancel": "Cancel",
@@ -7985,6 +7987,7 @@
"disconnected": "Webflow disconnected",
"siteLabel": "Site",
"sitePlaceholder": "Pick a site",
+ "setupStep": "Last step: pick the collection your pages go to, check which field takes what, then Save. Pages can't be sent to Webflow until then.",
"collectionLabel": "Collection",
"collectionPlaceholder": "Pick a collection",
"loadingCollections": "Reading the site's collections…",
diff --git a/web/src/components/settings/webflow-card.test.tsx b/web/src/components/settings/webflow-card.test.tsx
index 76f4dbb5c..b62fd5d49 100644
--- a/web/src/components/settings/webflow-card.test.tsx
+++ b/web/src/components/settings/webflow-card.test.tsx
@@ -73,6 +73,11 @@ const picker = (label: string) => {
const name = [...container.querySelectorAll('label')].find((l) => l.textContent === label);
return container.querySelector(`[id="${name!.htmlFor}"]`)!;
};
+/** The badges by the card's title. */
+const badges = () =>
+ [...container.querySelectorAll('[data-slot="badge"]')].map((b) => b.textContent);
+const SETUP_STEP =
+ "Last step: pick the collection your pages go to, check which field takes what, then Save. Pages can't be sent to Webflow until then.";
const option = (text: string) =>
[...document.querySelectorAll<HTMLElement>('[role="option"]')].find(
(o) => o.textContent === text,
@@ -144,10 +149,55 @@ describe('WebflowCard', () => {
);
await typeToken(' wf-token-123 ');
expect(client.connectWebflow).toHaveBeenCalledWith('b1', 'wf-token-123');
- expect(toast.success).toHaveBeenCalledWith('Webflow connected');
+ expect(toast.success).toHaveBeenCalledWith(
+ 'Webflow connected. Now pick a collection and save.',
+ );
expect(container.querySelector('input[type="password"]')).toBeNull();
expect(client.listWebflowCollections).toHaveBeenCalledWith('b1', 's1');
- expect(container.textContent).toContain('Collection');
+ // The setup's last step: the collection picker, focused.
+ expect(document.activeElement).toBe(picker('Collection'));
+ });
+
+ it('says the setup isn’t finished until a collection is saved', async () => {
+ client.readWebflow.mockResolvedValue({
+ ok: true,
+ configured: true,
+ connection: { ...CONNECTED, collectionId: null, collectionName: null, fieldMap: {} },
+ });
+ await render();
+ expect(badges()).toEqual(['Setup not finished']);
+ expect(container.textContent).toContain(SETUP_STEP);
+ // Read on opening the page, the picker isn't focused: only right after connecting.
+ expect(document.activeElement).not.toBe(picker('Collection'));
+
+ await click(picker('Collection'));
+ const blog = option('Blog Posts')!;
+ await act(async () => {
+ blog.dispatchEvent(new MouseEvent('mousemove', { bubbles: true }));
+ });
+ await click(blog);
+ expect(container.textContent).toContain(SETUP_STEP);
+ await click(button('Save'));
+ expect(client.saveWebflowSettings).toHaveBeenCalledWith('b1', {
+ siteId: 's1',
+ collectionId: 'c1',
+ fieldMap: { body: 'post-body' },
+ });
+ expect(badges()).toEqual(['Connected']);
+ expect(container.textContent).not.toContain(SETUP_STEP);
+ });
+
+ it('keeps the setup a new token for the same site keeps', async () => {
+ client.readWebflow.mockResolvedValue({ ok: true, configured: true, connection: CONNECTED });
+ client.connectWebflow.mockResolvedValue({ ok: true, connection: CONNECTED, sites: [] });
+ await render();
+ expect(badges()).toEqual(['Connected']);
+ expect(container.textContent).not.toContain(SETUP_STEP);
+ await click(button('Replace token'));
+ await typeToken('wf-token-456');
+ expect(toast.success).toHaveBeenCalledWith('Webflow connected');
+ expect(badges()).toEqual(['Connected']);
+ expect(document.activeElement).not.toBe(picker('Collection'));
});
it('says how to make the token, step by step above its field, and that it’s shown once', async () => {
@@ -235,6 +285,21 @@ describe('WebflowCard', () => {
root = createRoot(container);
await render();
expect(container.textContent).toContain('Admins and managers can connect Webflow.');
+
+ // Connected, no collection saved: pages can't go yet.
+ client.readWebflow.mockResolvedValue({
+ ok: true,
+ configured: true,
+ connection: { ...CONNECTED, collectionId: null, collectionName: null, fieldMap: {} },
+ });
+ act(() => root.unmount());
+ root = createRoot(container);
+ await render();
+ expect(badges()).toEqual(['Setup not finished']);
+ expect(container.textContent).toContain(
+ "No collection picked yet. Pages can't go to Webflow until an admin or manager finishes the setup.",
+ );
+ expect(container.textContent).not.toContain(SETUP_STEP);
});
it('disconnects after asking', async () => {
diff --git a/web/src/components/settings/webflow-card.tsx b/web/src/components/settings/webflow-card.tsx
index 6e4741c2c..3930c38de 100644
--- a/web/src/components/settings/webflow-card.tsx
+++ b/web/src/components/settings/webflow-card.tsx
@@ -88,6 +88,8 @@ export function WebflowCard() {
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 token refused or replaced meanwhile.
const [reads, setReads] = useState(0);
@@ -139,7 +141,7 @@ export function WebflowCard() {
<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"
@@ -147,6 +149,15 @@ export function WebflowCard() {
{t('connected')}
</Badge>
)}
+ {/* Connected, but nothing goes to Webflow 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"
@@ -236,6 +247,7 @@ export function WebflowCard() {
onCancel={replacing ? () => setReplacingFor(null) : undefined}
onConnected={(next) => {
setReplacingFor(null);
+ setSettingUpFor(next.collectionId ? null : activeBrandId);
setConnection(next);
}}
/>
@@ -245,7 +257,11 @@ export function WebflowCard() {
key={activeBrandId}
brandId={activeBrandId}
connection={connection}
- onSaved={setConnection}
+ focusCollection={settingUpFor === activeBrandId}
+ onSaved={(next) => {
+ setSettingUpFor(null);
+ setConnection(next);
+ }}
onStale={() => setReads((n) => n + 1)}
/>
)}
@@ -279,7 +295,8 @@ function TokenForm({
return;
}
setToken('');
- toast.success(t('connectedToast'));
+ // A new token for the same site keeps its collection; else the setup's last step is left.
+ toast.success(t(result.connection.collectionId ? 'connectedToast' : 'connectedSetupToast'));
onConnected(result.connection);
};
@@ -340,11 +357,14 @@ function TokenForm({
function WebflowMapping({
brandId,
connection,
+ focusCollection,
onSaved,
onStale,
}: {
brandId: string;
connection: WebflowConnection;
+ /** Just connected: the collection picker, the setup's last step, takes the focus. */
+ focusCollection: boolean;
onSaved: (connection: WebflowConnection) => void;
/** The connection changed (a token refused, replaced or removed): read it again. */
onStale: () => void;
@@ -478,6 +498,12 @@ function WebflowMapping({
return (
<div className="space-y-4">
+ {!connection.collectionId && (
+ <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>
+ )}
{sites.length > 1 && (
<Picker
label={t('siteLabel')}
@@ -506,6 +532,7 @@ function WebflowMapping({
items={collectionItems}
value={collectionId}
placeholder={t('collectionPlaceholder')}
+ autoFocus={focusCollection}
onChange={(value) => {
if (value === collectionId) return;
setCollectionId(value);
@@ -601,12 +628,15 @@ function Picker({
items,
value,
placeholder,
+ autoFocus,
onChange,
}: {
label: string;
items: { value: string; label: string }[];
value: string | null;
placeholder: string;
+ /** Focused when it shows (and so scrolled into view). */
+ autoFocus?: boolean;
onChange: (value: string | null) => void;
}) {
const id = useId();
@@ -616,7 +646,7 @@ function Picker({
{label}
</Label>
<Select items={items} value={value} onValueChange={(v) => onChange(v ?? null)}>
- <SelectTrigger id={id} className="h-8 w-64 max-w-full text-xs">
+ <SelectTrigger id={id} autoFocus={autoFocus} className="h-8 w-64 max-w-full text-xs">
<SelectValue placeholder={placeholder} />
</SelectTrigger>
<SelectContent>