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(shopping): don't ask for Merchant Center where the server doesn't offer it (#1747)

Cihan86784d5438a3
diff --git a/server/src/routes/integrations-config.test.js b/server/src/routes/integrations-config.test.js
new file mode 100644
index 000000000..66395e5af
--- /dev/null
+++ b/server/src/routes/integrations-config.test.js
@@ -0,0 +1,37 @@
+import { describe, expect, it, vi } from 'vitest';
+
+/**
+ * Which integrations this deployment has credentials for: what GET
+ * /api/integrations/config answers a member and the internal endpoint the
+ * MCP layer reads (Product Visibility asks for Merchant Center only where
+ * it is offered). Booleans only.
+ */
+
+const configured = vi.hoisted(() => new Set());
+vi.mock('../config/supabase.js', () => ({ default: {} }));
+vi.mock('../lib/composio.js', () => ({
+ isComposioConfigured: (provider) => configured.has(provider),
+}));
+vi.mock('../lib/ga-sync.js', () => ({ runGaSync: vi.fn() }));
+vi.mock('../lib/gsc-sync.js', () => ({ runGscSync: vi.fn() }));
+vi.mock('../lib/page-opportunities.js', () => ({ detectPageOpportunitiesInWindow: vi.fn() }));
+vi.mock('../lib/access.js', () => ({ assertBrandAccess: vi.fn() }));
+
+const { integrationsConfig } = await import('./integrations.js');
+
+describe('integrationsConfig', () => {
+ it('says Merchant Center is offered only with its auth config', () => {
+ expect(integrationsConfig()).toMatchObject({
+ googleSearchConsole: false,
+ googleAnalytics: false,
+ googleMerchantCenter: false,
+ });
+ configured.add('google-merchant-center');
+ configured.add('google-search-console');
+ expect(integrationsConfig()).toMatchObject({
+ googleSearchConsole: true,
+ googleAnalytics: false,
+ googleMerchantCenter: true,
+ });
+ });
+});
diff --git a/server/src/routes/integrations.js b/server/src/routes/integrations.js
index 69297d1b2..51965221b 100644
--- a/server/src/routes/integrations.js
+++ b/server/src/routes/integrations.js
@@ -85,13 +85,17 @@ function notConfigured(res, provider) {
* should be able to check rather than assume. Booleans only, never the
* credentials themselves.
*/
-router.get('/config', async (_req, res) => {
- return res.json({
+export function integrationsConfig() {
+ return {
googleSearchConsole: isComposioConfigured(GSC),
googleAnalytics: isComposioConfigured(GA),
googleMerchantCenter: isComposioConfigured(GMC),
dataForSeo: Boolean(process.env.DATAFORSEO_LOGIN && process.env.DATAFORSEO_PASSWORD),
- });
+ };
+}
+
+router.get('/config', async (_req, res) => {
+ return res.json(integrationsConfig());
});
// ─── Shared connect / status / disconnect ────────────────────────────────────
diff --git a/server/src/server.js b/server/src/server.js
index 6d0449b66..58e441e46 100644
--- a/server/src/server.js
+++ b/server/src/server.js
@@ -56,6 +56,7 @@ import { sendTrafficDigests } from './lib/traffic-digest/engine.js';
import { runPageOpportunityDetection } from './lib/page-opportunities.js';
import { runPulseCatchUp } from './lib/pulse/engine.js';
import { runSignalCatchUp } from './lib/signals/pass.js';
+import { integrationsConfig } from './routes/integrations.js';
import { sweepTaskExecution } from './lib/action-center/execution/run.js';
import { sweepActionTasks } from './lib/action-center/task-writer/index.js';
import { sweepTaskChecks } from './lib/action-center/task-checks.js';
@@ -565,6 +566,19 @@ app.get('/api/internal/ai-usage', async (req, res) => {
}
});
+// --- Internal integrations config (CRON_SECRET auth, called by web MCP layer) ---
+// Which integrations this deployment has credentials for, as GET
+// /api/integrations/config answers a member: the MCP tools have no member
+// session to ask with (Product Visibility's readiness checks Merchant Center
+// only where it is offered). Booleans only.
+app.get('/api/internal/integrations-config', (req, res) => {
+ const secret = req.headers.authorization?.replace('Bearer ', '');
+ if (!process.env.CRON_SECRET || secret !== process.env.CRON_SECRET) {
+ return res.status(401).json({ success: false, message: 'Unauthorized' });
+ }
+ return res.json({ success: true, config: integrationsConfig() });
+});
+
// --- Internal Improve send endpoint (CRON_SECRET auth, called by web MCP layer) ---
// The web MCP layer verifies the caller's `ans_` API key org owns the prompt
// before reaching here and passes the key's user, so this endpoint trusts the
diff --git a/web/messages/en.json b/web/messages/en.json
index 23b534524..c5ac72d06 100644
--- a/web/messages/en.json
+++ b/web/messages/en.json
@@ -8251,7 +8251,7 @@
"channelsLabel": "AI shopping channels",
"market": {
"us": "Market: United States. In the US, ChatGPT picks products from OpenAI's own product index, built from feeds.",
- "europe": "Market: Europe. In Europe, ChatGPT still takes products from Google Shopping, so your Merchant Center feed decides ChatGPT too."
+ "europe": "Market: Europe. In Europe, ChatGPT still takes products from Google Shopping, so what Google Shopping has of yours (a Merchant Center feed or your pages' product schema) decides ChatGPT too."
},
"channels": {
"showing": "Showing your products",
diff --git a/web/src/app/[locale]/(dashboard)/dashboard/shopping/_data-strip.test.tsx b/web/src/app/[locale]/(dashboard)/dashboard/shopping/_data-strip.test.tsx
index 6750c276a..0bee34986 100644
--- a/web/src/app/[locale]/(dashboard)/dashboard/shopping/_data-strip.test.tsx
+++ b/web/src/app/[locale]/(dashboard)/dashboard/shopping/_data-strip.test.tsx
@@ -67,7 +67,12 @@ const source = (over: Partial<CatalogSource>): CatalogSource => ({
...over,
});
-function render(catalog: CatalogSource[] | null, canConnect = true, loaded = true) {
+function render(
+ catalog: CatalogSource[] | null,
+ canConnect = true,
+ loaded = true,
+ merchantCenterOffered = true,
+) {
act(() => {
root.render(
<NextIntlClientProvider locale="en" messages={messages} timeZone="UTC">
@@ -76,6 +81,7 @@ function render(catalog: CatalogSource[] | null, canConnect = true, loaded = tru
loaded,
catalog,
google: { snippetLastVisitAt: null, ga: off, gsc: off },
+ merchantCenterOffered,
reload: () => {},
}}
domain="shop.example"
@@ -129,6 +135,13 @@ describe('ProductDataStrip', () => {
expect(chip('merchant_center')).toBe('GGoogle Merchant CenterNot connected');
});
+ it("calls Merchant Center Soon where this server doesn't offer it, unless the brand has it", () => {
+ render([source({})], true, true, false);
+ expect(chip('merchant_center')).toBe('GGoogle Merchant CenterSoon');
+ render([source({ kind: 'merchant_center' })], true, true, false);
+ expect(chip('merchant_center')).toBe('GGoogle Merchant CenterConnected');
+ });
+
it("says when the catalog couldn't be read, and waits while it loads", () => {
expect(render(null)).toContain("Couldn't be read right now");
render(null, true, false);
diff --git a/web/src/app/[locale]/(dashboard)/dashboard/shopping/_data-strip.tsx b/web/src/app/[locale]/(dashboard)/dashboard/shopping/_data-strip.tsx
index 7264e0fbb..b7f269e1f 100644
--- a/web/src/app/[locale]/(dashboard)/dashboard/shopping/_data-strip.tsx
+++ b/web/src/app/[locale]/(dashboard)/dashboard/shopping/_data-strip.tsx
@@ -8,6 +8,7 @@ import { Skeleton } from '@/components/ui/skeleton';
import { cn } from '@/lib/utils';
import { formatRelative } from '@/lib/format-relative';
import { listCatalogSources } from '@/lib/actions/catalog';
+import { getMerchantCenterOffered } from '@/lib/actions/integrations';
import { getTrafficSources, type TrafficSources } from '@/lib/actions/traffic';
import type { CatalogSource } from '@/lib/catalog';
import { CATALOG_SETTINGS_PATH } from '@/lib/content/feed-match';
@@ -19,6 +20,11 @@ export interface ProductSources {
/** Null while loading, or when it couldn't be read. */
catalog: CatalogSource[] | null;
google: TrafficSources | null;
+ /**
+ * Whether this deployment can connect Google Merchant Center. Where it
+ * can't and the brand has none, the page doesn't ask for one.
+ */
+ merchantCenterOffered: boolean;
}
/** The brand's sources, read once per brand and again after a connection made on the page. */
@@ -27,6 +33,7 @@ export function useProductSources(brandId: string | null) {
brandId: null,
catalog: null,
google: null,
+ merchantCenterOffered: false,
});
const [attempt, setAttempt] = useState(0);
useEffect(() => {
@@ -35,8 +42,9 @@ export function useProductSources(brandId: string | null) {
void Promise.all([
listCatalogSources(brandId).catch(() => null),
getTrafficSources(brandId).catch(() => null),
- ]).then(([catalog, google]) => {
- if (!cancelled) setSources({ brandId, catalog, google });
+ getMerchantCenterOffered(),
+ ]).then(([catalog, google, merchantCenterOffered]) => {
+ if (!cancelled) setSources({ brandId, catalog, google, merchantCenterOffered });
});
return () => {
cancelled = true;
@@ -44,11 +52,15 @@ export function useProductSources(brandId: string | null) {
}, [brandId, attempt]);
const reload = useCallback(() => setAttempt((n) => n + 1), []);
// A read for another brand (just switched) counts as still loading.
- const current = sources.brandId === brandId ? sources : { catalog: null, google: null };
+ const current =
+ sources.brandId === brandId
+ ? sources
+ : { catalog: null, google: null, merchantCenterOffered: false };
return {
loaded: sources.brandId === brandId,
catalog: current.catalog,
google: current.google,
+ merchantCenterOffered: current.merchantCenterOffered,
reload,
};
}
@@ -56,7 +68,8 @@ export function useProductSources(brandId: string | null) {
/**
* The marketplaces and feeds a brand's products also sell through (ECOM-spec
* §3.0). Google Merchant Center connects in Settings › Integrations, as a
- * catalog source; the marketplaces have no connector yet.
+ * catalog source, where the deployment offers it; else it is Soon, as the
+ * marketplaces with no connector yet.
*/
const MARKETPLACES = [
{ id: 'merchant_center', name: 'Google Merchant Center', mark: 'G' },
@@ -70,9 +83,13 @@ const MARKETPLACES = [
type ChipState = 'connected' | 'connect' | 'soon';
-function chipState(id: string, catalog: CatalogSource[]): ChipState {
+function chipState(
+ id: string,
+ catalog: CatalogSource[],
+ merchantCenterOffered: boolean,
+): ChipState {
if (catalog.some((source) => source.kind === id)) return 'connected';
- return id === 'merchant_center' ? 'connect' : 'soon';
+ return id === 'merchant_center' && merchantCenterOffered ? 'connect' : 'soon';
}
/** The newest sync of the brand's sources, or null when none has synced. */
@@ -188,7 +205,7 @@ export function ProductDataStrip({
<div className="flex flex-wrap items-center gap-1.5">
<span className="mr-1 text-xs font-medium text-muted-foreground">{t('marketplaces')}</span>
{MARKETPLACES.map((place) => {
- const state = chipState(place.id, catalog);
+ const state = chipState(place.id, catalog, sources.merchantCenterOffered);
return (
<span
key={place.id}
diff --git a/web/src/app/[locale]/(dashboard)/dashboard/shopping/page.tsx b/web/src/app/[locale]/(dashboard)/dashboard/shopping/page.tsx
index b6a1bd135..ce1824a7e 100644
--- a/web/src/app/[locale]/(dashboard)/dashboard/shopping/page.tsx
+++ b/web/src/app/[locale]/(dashboard)/dashboard/shopping/page.tsx
@@ -642,6 +642,7 @@ export default function ShoppingPage() {
{...readinessChecklist({
market: shoppingMarket.shown ?? 'us',
catalog: sources.catalog,
+ merchantCenterOffered: sources.merchantCenterOffered,
products: catalogTable && catalogTable !== 'failed' ? catalogTable.rows : null,
openAi: showOpenAiIndex ? openAiIndex.read : null,
cheaperResellers: destinationsLoading ? null : destinations.priceAlerts.length,
diff --git a/web/src/lib/actions/integrations.ts b/web/src/lib/actions/integrations.ts
index 6ad2ce0ca..c17cd352f 100644
--- a/web/src/lib/actions/integrations.ts
+++ b/web/src/lib/actions/integrations.ts
@@ -30,6 +30,25 @@ async function authHeaders(): Promise<Record<string, string>> {
};
}
+/**
+ * Whether this deployment can connect Google Merchant Center (the API has its
+ * Composio auth config): where it can't, Product Visibility doesn't ask for
+ * it. False when it can't be read: a claim of nothing.
+ */
+export async function getMerchantCenterOffered(): Promise<boolean> {
+ try {
+ const res = await fetch(`${API_BASE_URL}/api/integrations/config`, {
+ headers: await authHeaders(),
+ cache: 'no-store',
+ });
+ if (!res.ok) return false;
+ const config = (await res.json()) as { googleMerchantCenter?: boolean };
+ return Boolean(config.googleMerchantCenter);
+ } catch {
+ return false;
+ }
+}
+
export async function getIntegrationStatus(
provider: IntegrationProvider,
): Promise<IntegrationStatusResult> {
diff --git a/web/src/lib/mcp/product-visibility.test.ts b/web/src/lib/mcp/product-visibility.test.ts
index 6e004651d..e630b9477 100644
--- a/web/src/lib/mcp/product-visibility.test.ts
+++ b/web/src/lib/mcp/product-visibility.test.ts
@@ -399,6 +399,39 @@ describe('get_shopping_readiness', () => {
regions: [],
});
shopping.getShoppingOwnChannels.mockImplementation(loader(() => ['google-aimode']));
+ // The API offers Merchant Center (its internal config, read with the cron secret).
+ vi.stubEnv('CRON_SECRET', 'cron-secret');
+ vi.stubGlobal(
+ 'fetch',
+ vi.fn(async () => Response.json({ success: true, config: { googleMerchantCenter: true } })),
+ );
+ });
+
+ afterEach(() => {
+ vi.unstubAllGlobals();
+ });
+
+ it("neither lists nor scores Merchant Center where the API doesn't offer it, or can't say", async () => {
+ vi.stubGlobal(
+ 'fetch',
+ vi.fn(async () => Response.json({ success: true, config: { googleMerchantCenter: false } })),
+ );
+ let read = await getShoppingReadinessFor(auth, { brandId: BRAND });
+ if (!read || read === NOT_IN_PLAN || !('checks' in read)) throw new Error('no readiness');
+ expect(read.checks.map((c) => c.key)).not.toContain('merchantCenter');
+ vi.stubGlobal(
+ 'fetch',
+ vi.fn(async () => {
+ throw new Error('down');
+ }),
+ );
+ read = await getShoppingReadinessFor(auth, { brandId: BRAND });
+ if (!read || read === NOT_IN_PLAN || !('checks' in read)) throw new Error('no readiness');
+ expect(read.checks.map((c) => c.key)).not.toContain('merchantCenter');
+ expect(fetch).toHaveBeenCalledWith(
+ expect.stringContaining('/api/internal/integrations-config'),
+ expect.objectContaining({ headers: { Authorization: 'Bearer cron-secret' } }),
+ );
});
it('checks the catalog as the Readiness tab does, in its words, with where each fix starts', async () => {
diff --git a/web/src/lib/mcp/product-visibility.ts b/web/src/lib/mcp/product-visibility.ts
index 5fcde0665..e75ef31c9 100644
--- a/web/src/lib/mcp/product-visibility.ts
+++ b/web/src/lib/mcp/product-visibility.ts
@@ -1,5 +1,6 @@
import { createTranslator } from 'next-intl';
import messages from '../../../messages/en.json';
+import { API_BASE_URL } from '@/config/api';
import {
getProductAiSays,
getResellerPriceAlerts,
@@ -278,6 +279,27 @@ export interface McpReadiness {
unread: ('sources' | 'products' | 'channels')[];
}
+/**
+ * Whether this deployment can connect Google Merchant Center, as the page
+ * asks the API (/api/integrations/config), through the CRON_SECRET internal
+ * endpoint: the MCP has no member session. False when it can't be read.
+ */
+export async function merchantCenterOffered(): Promise<boolean> {
+ const cronSecret = process.env.CRON_SECRET;
+ if (!cronSecret) return false;
+ try {
+ const res = await fetch(`${API_BASE_URL}/api/internal/integrations-config`, {
+ headers: { Authorization: `Bearer ${cronSecret}` },
+ cache: 'no-store',
+ });
+ if (!res.ok) return false;
+ const body = (await res.json()) as { config?: { googleMerchantCenter?: boolean } };
+ return Boolean(body.config?.googleMerchantCenter);
+ } catch {
+ return false;
+ }
+}
+
/** A read the checklist can do without: null, logged, when it fails. */
const orNull = <T>(what: string, read: Promise<T>): Promise<T | null> =>
read.catch((err: unknown) => {
@@ -298,26 +320,29 @@ export async function getShoppingReadinessFor(
const own = await marketOf(brandId, params.market);
const market = own ?? 'us';
const filters: ShoppingFilters = { datePreset: period, chatgptMarket: own ?? undefined };
- const [sources, products, openAi, cheaper, amazonDrop, options, ownOn] = await Promise.all([
- orNull('catalog sources', readCatalogSources(supabaseAdmin, brandId)),
- getShoppingProducts(brandId, filters).then(
- (read) => read?.rows ?? null,
- (err: unknown) => {
- console.error('[mcp] Readiness: failed to read the products:', err);
- return 'failed' as const;
- },
- ),
- // As on the page: only for a brand in the US market, not one that just falls back to it.
- own === 'us' ? orNull('the OpenAI index', getOpenAiIndexRead(brandId, period)) : null,
- orNull('reseller prices', getResellerPriceAlerts(brandId, filters)),
- orNull('the Amazon share', getShoppingAmazonShareDropAlert(brandId)),
- getShoppingFilterOptions(brandId),
- // Which channels hold its products: one row a channel, not every card on the shelves.
- orNull('the channels', getShoppingOwnChannels(brandId, filters)),
- ]);
+ const [sources, products, openAi, cheaper, amazonDrop, options, ownOn, gmcOffered] =
+ await Promise.all([
+ orNull('catalog sources', readCatalogSources(supabaseAdmin, brandId)),
+ getShoppingProducts(brandId, filters).then(
+ (read) => read?.rows ?? null,
+ (err: unknown) => {
+ console.error('[mcp] Readiness: failed to read the products:', err);
+ return 'failed' as const;
+ },
+ ),
+ // As on the page: only for a brand in the US market, not one that just falls back to it.
+ own === 'us' ? orNull('the OpenAI index', getOpenAiIndexRead(brandId, period)) : null,
+ orNull('reseller prices', getResellerPriceAlerts(brandId, filters)),
+ orNull('the Amazon share', getShoppingAmazonShareDropAlert(brandId)),
+ getShoppingFilterOptions(brandId),
+ // Which channels hold its products: one row a channel, not every card on the shelves.
+ orNull('the channels', getShoppingOwnChannels(brandId, filters)),
+ merchantCenterOffered(),
+ ]);
const { score, items } = readinessChecklist({
market,
catalog: sources,
+ merchantCenterOffered: gmcOffered,
products: products === 'failed' ? null : products,
openAi,
cheaperResellers: cheaper?.length ?? null,
diff --git a/web/src/lib/mcp/server.ts b/web/src/lib/mcp/server.ts
index 1347d49c1..e00867bd4 100644
--- a/web/src/lib/mcp/server.ts
+++ b/web/src/lib/mcp/server.ts
@@ -2237,7 +2237,7 @@ export function createMcpServer(auth: McpAuthContext): McpServer {
{
title: 'Product Visibility readiness',
description:
- "Product Visibility's Readiness: how ready the brand is for AI shopping, as the Readiness tab checks it, scored 0–100 over the checks that can be made (`score`; null when its catalog's sources or products couldn't be read, listed in `unread`). Each check has its `key` (catalog, merchantCenter, openAiIndex and verifiedSeller in the US, firstWords, feedFields, feedLinks, wrongPrice, resellerCheaper, amazonShare), its `state` (pass, warn, fail, or unknown when it can't be made), its `title` and `detail` as the page writes them, and `fix`: where it starts (products = the Products tab, settings = Settings › Integrations › Catalog). `channels` says for each AI channel (chatgpt-shopping, google-aio, google-aimode, gemini-web, copilot-web) whether the brand's products are on its shelves (showing), its shelves are read without them (notShowing), or it isn't tracked (notTracked). Needs a plan with Product Visibility (Growth and above): on Starter it answers plan_limit.",
+ "Product Visibility's Readiness: how ready the brand is for AI shopping, as the Readiness tab checks it, scored 0–100 over the checks that can be made (`score`; null when its catalog's sources or products couldn't be read, listed in `unread`). Each check has its `key` (catalog, merchantCenter where this server offers Google Merchant Center or the brand has it connected, openAiIndex and verifiedSeller in the US, firstWords, feedFields, feedLinks, wrongPrice, resellerCheaper, amazonShare), its `state` (pass, warn, fail, or unknown when it can't be made), its `title` and `detail` as the page writes them, and `fix`: where it starts (products = the Products tab, settings = Settings › Integrations › Catalog). `channels` says for each AI channel (chatgpt-shopping, google-aio, google-aimode, gemini-web, copilot-web) whether the brand's products are on its shelves (showing), its shelves are read without them (notShowing), or it isn't tracked (notTracked). Needs a plan with Product Visibility (Growth and above): on Starter it answers plan_limit.",
inputSchema: {
brand_id: relaxedUuid.describe('Brand UUID, from list_brands.'),
period: periodInput,
diff --git a/web/src/lib/shopping/readiness.test.ts b/web/src/lib/shopping/readiness.test.ts
index 0d4c8c63d..19debb1c0 100644
--- a/web/src/lib/shopping/readiness.test.ts
+++ b/web/src/lib/shopping/readiness.test.ts
@@ -41,6 +41,7 @@ describe('readinessChecklist', () => {
const { score, items } = readinessChecklist({
market: 'europe',
catalog: [source('feed_url'), source('merchant_center')],
+ merchantCenterOffered: true,
products: rows,
openAi: null,
cheaperResellers: 0,
@@ -83,6 +84,7 @@ describe('readinessChecklist', () => {
const { score, items } = readinessChecklist({
market: 'us',
catalog: [source('feed_url')],
+ merchantCenterOffered: true,
products: rows,
openAi: { directFeed: false, ownCards: 3 },
cheaperResellers: 2,
@@ -118,6 +120,7 @@ describe('readinessChecklist', () => {
readinessChecklist({
market: 'us',
catalog: [source('shopify')],
+ merchantCenterOffered: true,
products: productRows(products, [], []),
openAi: null,
cheaperResellers: null,
@@ -140,6 +143,7 @@ describe('readinessChecklist', () => {
const { items } = readinessChecklist({
market: 'europe',
catalog: [],
+ merchantCenterOffered: true,
products: null,
openAi: null,
cheaperResellers: null,
@@ -155,6 +159,7 @@ describe('readinessChecklist', () => {
const { items } = readinessChecklist({
market: 'europe',
catalog: null,
+ merchantCenterOffered: true,
products: null,
openAi: null,
cheaperResellers: null,
@@ -165,6 +170,44 @@ describe('readinessChecklist', () => {
['merchantCenter', 'unknown', undefined],
]);
});
+
+ describe('where Merchant Center is not offered', () => {
+ const base = {
+ market: 'us' as const,
+ products: null,
+ openAi: null,
+ cheaperResellers: null,
+ amazonDrop: null,
+ merchantCenterOffered: false,
+ };
+
+ it('neither lists nor scores it, in the US and in Europe', () => {
+ for (const market of ['us', 'europe'] as const) {
+ const { score, items } = readinessChecklist({
+ ...base,
+ market,
+ catalog: [source('feed_url')],
+ });
+ expect(items.map((item) => item.key)).not.toContain('merchantCenter');
+ // The catalog connected is the one check made: 100, not pulled down.
+ expect(score).toBe(100);
+ }
+ expect(
+ readinessChecklist({ ...base, catalog: null }).items.map((item) => item.key),
+ ).not.toContain('merchantCenter');
+ });
+
+ it('still says a Merchant Center source connected before is', () => {
+ const { items } = readinessChecklist({
+ ...base,
+ catalog: [source('merchant_center')],
+ });
+ expect(items.find((item) => item.key === 'merchantCenter')).toMatchObject({
+ state: 'pass',
+ action: undefined,
+ });
+ });
+ });
});
describe('channelState', () => {
diff --git a/web/src/lib/shopping/readiness.ts b/web/src/lib/shopping/readiness.ts
index 8368d6f96..060c630c9 100644
--- a/web/src/lib/shopping/readiness.ts
+++ b/web/src/lib/shopping/readiness.ts
@@ -41,6 +41,12 @@ export interface ReadinessInput {
market: ShoppingMarket;
/** The brand's catalog sources; null when they couldn't be read. */
catalog: CatalogSource[] | null;
+ /**
+ * Whether this deployment can connect Google Merchant Center. Where it
+ * can't and the brand has no Merchant Center source, the check isn't
+ * listed, nor scored: nothing the brand can do about it here.
+ */
+ merchantCenterOffered: boolean;
/** The catalog's products; null without a catalog, or while unread. */
products: ProductRow[] | null;
/** OpenAI's product index (US); null when not read. */
@@ -77,20 +83,22 @@ export function readinessChecklist(input: ReadinessInput): {
action: catalog.length ? undefined : 'settings',
});
const merchantCenter = catalog.some((source) => source.kind === 'merchant_center');
- items.push({
- key: 'merchantCenter',
- // In Europe the Merchant Center feed decides ChatGPT too (§3.4b). Sources
- // that couldn't be read say nothing either way.
- state:
- input.catalog === null
- ? 'unknown'
- : merchantCenter
- ? 'pass'
- : input.market === 'europe'
- ? 'fail'
- : 'warn',
- action: merchantCenter || input.catalog === null ? undefined : 'settings',
- });
+ if (merchantCenter || input.merchantCenterOffered) {
+ items.push({
+ key: 'merchantCenter',
+ // In Europe the Merchant Center feed decides ChatGPT too (§3.4b). Sources
+ // that couldn't be read say nothing either way.
+ state:
+ input.catalog === null
+ ? 'unknown'
+ : merchantCenter
+ ? 'pass'
+ : input.market === 'europe'
+ ? 'fail'
+ : 'warn',
+ action: merchantCenter || input.catalog === null ? undefined : 'settings',
+ });
+ }
if (input.market === 'us') {
if (input.openAi) {
const status = openAiIndexStatus(input.openAi);