top-deals.ts1012 BView on GitHub /**
* Top Deals canvas — client-side lookup helpers.
*
* The Top Deals card list is a per-user system canvas seeded server-side
* (see apps/server/src/services/canvas/top-deals-canvas.ts). It is identified by
* the same reserved marker: a `cardList` canvas titled `TOP_DEALS_CANVAS_TITLE`.
* These helpers resolve it from whatever canvases are already loaded in the store
* (canvasesById) — the base-agent default resolver reads it here rather than
* issuing its own fetch.
*/
import type { Canvas } from '@/modules/canvas/types/canvas-types';
/** Reserved title marker — must match the server's TOP_DEALS_CANVAS_TITLE. */
export const TOP_DEALS_CANVAS_TITLE = 'Deals that need attention';
/** Find the Top Deals card-list canvas among the loaded canvases, if present. */
export function findTopDealsCanvas(
canvasesById: Record<string, Canvas>,
): Canvas | undefined {
return Object.values(canvasesById).find(
(c) => c.type === 'cardList' && c.title === TOP_DEALS_CANVAS_TITLE,
);
}