Unified content-href authority for all embeddable surfaces — resolves content links consistently across both page views and chat surfaces using a single configurable seam. ## Key Components ### Constants - **`DEFAULT_CONTENT_SUFFIXES`** — Maps content `documentType` strings (e.g. `'product_release'`, `'blog_post'`) to their URL path segments. Mirrors the hub's `PUBLIC_URL_PATHS`; kept in sync manually across the cross-repo boundary. ### Types - **`ComposeContentUrlInput`** — Unified input for both page views (slug-based) and chat rows (ID + `externalUrl`-based). - **`ContentHrefOptions`** — Configuration for `makeComposeContentUrl`: hosted types set, hub origin fallback, optional suffix/override maps. - **`ComposeContentUrl`** — The seam function signature on `ChatRuntime`; always returns `{ href, targetPlatform }`, never null. ### Functions - **`makeComposeContentUrl(opts)`** — Factory that builds the embedder's `composeContentUrl`. Resolution order: explicit `overrides` → hosted in-app route → verbatim `externalUrl` → hub-origin fallback. - **`buildDefaultHref(basePath, slug)`** — Fallback href when no `composeContentUrl` is wired (single-platform embedders). - **`resolveContentHref(composeContentUrl, args)`** — Ternary helper used by catalog/detail views: delegates to `composeContentUrl` when wired, otherwise calls `buildDefaultHref`. ## Usage Example ```typescript import { makeComposeContentUrl, resolveContentHref, } from './content-href' // Build the embedder's composer const composeContentUrl = makeComposeContentUrl({ hostedTypes: new Set(['onboarding_guide', 'product_release']), contentOrigin: 'https://openframe.app', overrides: { author: (id) => ({ href: `/team/${id}`, targetPlatform: null }), }, }) // Page view — slug passed directly as identifier composeContentUrl({ type: 'product_release', identifier: 'my-release-v2' }) // → { href: '/releases/my-release-v2', targetPlatform: null } // Chat row — id as identifier, slug recovered from externalUrl composeContentUrl({ type: 'product_release', identifier: 'abc123', externalUrl: 'https://openframe.app/releases/my-release-v2', }) // → { href: '/releases/my-release-v2', targetPlatform: null } // Non-hosted type — opens out to hub composeContentUrl({ type: 'blog_post', identifier: 'my-post' }) // → { href: 'https://openframe.app/blog/my-post', targetPlatform: null } // Catalog/detail view helper resolveContentHref(composeContentUrl, { type: 'onboarding_guide', slug: 'getting-started', basePath: '/onboarding-guides', }) // → { href: '/onboarding-guides/getting-started', targetPlatform: null } ``` **Source:** [`content-href.ts`](https://github.com/flamingo-stack/openframe-oss-lib/blob/main/content-href.ts)