Dispatches canonical chat card types to their corresponding React components, serving as the lib-portable rendering layer for inline entity cards within the chat shell. ## Key Components ### Types & Interfaces - **`ChatCardDispatchExtras`** — Host-supplied builder functions for hub-dependent card props (program configs, product-release props, OG placeholder URLs) - **`ChatCardRenderOptions`** — Per-card render options including `baseRoute`, `isNewTab`, `extras`, and `discuss` action - **`CardDiscussAction`** — Action descriptor for the "Ask Mingo"/"Display" affordance in card menus ### Internal Components - **`GitHubChatCard`** — Renders GitHub activity cards (commits, PRs, PR reviews) using `MingoInfoCard` with kind-specific icons and review state color variants - **`githubKindIcon(kind)`** — Maps `GitHubActivityKind` to the appropriate icon component - **`reviewStateToVariant(state)`** — Converts PR review state to a `MingoInfoCardStatus` variant (`success`, `error`, `warning`, `grey`) ### Public Entry Points - **`renderChatInlineEntityCard(ref, opts)`** — Top-level dispatch function; hoists video refs to block cards, otherwise renders compact inline cards - **`ChatCardLoader`** — Fetch + skeleton + render component for fetch-mode entries ### Registry - **`CHAT_CARD_REGISTRY`** — Central map of document types to their card component and skeleton, enabling O(1) dispatch without nested conditionals ## Usage Example ```typescript // Rendering an inline entity card from chat context import { renderChatInlineEntityCard } from './dispatch' const card = renderChatInlineEntityCard(chatRef, { isNewTab: false, baseRoute: '/hub', extras: { buildOgPlaceholderUrl: (title) => `/api/og?title=${encodeURIComponent(title)}`, buildProductReleaseCardProps: (release) => ({ /* hub-derived props */ }), programConfigs: { podcast: podcastConfig, webinar: webinarConfig, }, }, }) ``` ## Adding a New Card Type 1. Implement a `size='sm'` branch + skeleton in `./.tsx` (pure presentation, accepts `href` + `targetPlatform`) 2. Add one entry to `CHAT_CARD_REGISTRY` ## Related Files - [`chat-ref.types.ts`](https://github.com/flamingo-stack/openframe-oss-lib/blob/main/src/types/chat-ref.types.ts) — `ChatRef` shape - [`nav-click-handler.ts`](https://github.com/flamingo-stack/openframe-oss-lib/blob/main/src/utils/nav-click-handler.ts) — `handleChatNavClick` - [`product-release-card-defaults.ts`](https://github.com/flamingo-stack/openframe-oss-lib/blob/main/src/components/cards/product-release-card-defaults.ts) — Fallback prop builder