catalogTitle
type CatalogFilterKind = "all" | "authors" | "series" | "narrators" | "genres" | "sources";
Client-side catalog filter categories (legacy / local lists).
type CatalogSearchField = "author" | "narrator" | "series" | "genre";
Storefront search facet passed as ?field= on /api/discover/search.
type CatalogSortKey = CatalogSearchSort;
Alias of CatalogSearchSort for Discover UI state.
type CatalogTitle = object;
Unified title shape for Discover / Wishlist detail dialogs and result rows.
asin: string | null;
authors: string | null;
available_through?: BranchAvailability[];
Branches of this library that currently list this title.
cover_path: string | null;
Same-origin path of the processed cover (see coverSrc).
cover_url: string | null;
description?: string | null;
genres?: string | null;
is_abridged?: boolean | null;
true abridged / false unabridged when known.
isbn: string | null;
language?: string | null;
length_minutes?: number | null;
narrators: string | null;
notes?: string | null;
published_at?: string | null;
publisher?: string | null;
purchase_hints?: PurchaseHint[];
rating_overall?: number | null;
Audible community overall rating (0–5), when known.
reasons?: string[];
series: string | null;
series_index?: string | null;
sources: string[];
store_editions: StoreEdition[];
subtitle?: string | null;
title: string;
wish_count?: number;
Distinct wisher count (may exceed wishers.length).
wishers?: QueueWisher[];
People who have this title on an open wishlist.
wishlist_uuid?: string | null;
Present when the title is already on the current user’s wishlist.
work_key: string;
type RuntimeBucket = "any" | "under6" | "6to12" | "12to20" | "over20";
Discover runtime length buckets for server filters.
const CATALOG_FILTER_KINDS: object[];
UI labels for CatalogFilterKind.
| Name | Type |
|---|---|
label |
string |
value |
CatalogFilterKind |
const CATALOG_LANGUAGE_ALL: "__all__" = "__all__";
Wire value for “no hard language filter” in the Discover language control.
const CATALOG_LANGUAGE_OPTIONS: object[];
Language select options for Discover (includes CATALOG_LANGUAGE_ALL).
| Name | Type |
|---|---|
label |
string |
value |
string |
const CATALOG_SORT_OPTIONS: object[];
UI labels for Discover catalog sort keys.
| Name | Type |
|---|---|
label |
string |
value |
CatalogSortKey |
const CATALOG_SOURCE_IDS: readonly ["audible", "chirp", "libro", "graphicaudio"];
Known storefront ids for prefs / empty facet fallbacks.
const RUNTIME_BUCKET_OPTIONS: object[];
UI options and minute bounds for RuntimeBucket.
| Name | Type |
|---|---|
label |
string |
max? |
number |
min? |
number |
value |
RuntimeBucket |
const VIRTUAL_VOICE_EXCLUDE: "Virtual Voice" = "Virtual Voice";
Narrator name excluded when “Hide Virtual Voice” is enabled.
function applyTitleMeta(title, meta): CatalogTitle;
Overlays public Audnexus / catalog metadata onto a sparse CatalogTitle.
An Audnexus ASIN is a trusted Audible product id (same rule as purchase-hint resolve), so a missing Audible store edition is filled in for Where-to-buy.
| Parameter | Type | Description |
|---|---|---|
title |
CatalogTitle |
Existing title. |
meta |
TitleMeta | null | undefined |
Fetched metadata (no-op when nullish). |
Merged title.
function attachWishersFromQueue(title, queue): CatalogTitle;
Copies household queue identity onto a personal wishlist title.
Personal TitleRequest rows do not include household wishers or the merged
store editions from the global queue. Discover shelves use that merged row,
so Wishlist must union the same editions or Where-to-buy diverges.
| Parameter | Type | Description |
|---|---|---|
title |
CatalogTitle |
Catalog title, typically from catalogTitleFromRequest. |
queue |
readonly GlobalQueueEntry[] |
Global request-queue entries. |
Title with wishers, identifiers, and store editions from the queue.
function attachWishlistCommerce(title, wishlist): CatalogTitle;
Unions snapshotted wishlist store editions / hints onto a Discover (or other) catalog title so Where-to-buy matches the Wishlist detail for the same work.
| Parameter | Type | Description |
|---|---|---|
title |
CatalogTitle |
Catalog title from search or shelves. |
wishlist |
readonly TitleRequest[] |
Open personal wishlist rows. |
Title with wishlist commerce merged when a row matches.
function buildCatalogSearchFilters(opts): CatalogSearchFilters;
Builds the server filter payload from UI multi-select state.
| Parameter | Type | Description |
|---|---|---|
opts |
{ authors: string[]; excludeSources?: string[]; genres: string[]; hideVirtualVoice: boolean; languages?: string[]; minRating?: number | null; narrators: string[]; runtimeBucket?: RuntimeBucket; series: string[]; sources?: string[]; } |
Include lists, exclusions, rating, and runtime bucket. |
opts.authors |
string[] |
- |
opts.excludeSources? |
string[] |
- |
opts.genres |
string[] |
- |
opts.hideVirtualVoice |
boolean |
- |
opts.languages? |
string[] |
- |
opts.minRating? |
number | null |
- |
opts.narrators |
string[] |
- |
opts.runtimeBucket? |
RuntimeBucket |
- |
opts.series |
string[] |
- |
opts.sources? |
string[] |
Deprecated prefer excludeSources |
CatalogSearchFilters for searchCatalog.
function catalogFilterValues(titles, kind): object[];
Builds distinct local filter options from a title list.
| Parameter | Type | Description |
|---|---|---|
titles |
CatalogTitle[] |
Catalog titles. |
kind |
CatalogFilterKind |
Filter category. |
object[]
Value/label pairs.
function catalogIdentityMatches(a, b): boolean;
True when two catalog identities refer to the same work (work key, ASIN, ISBN, or title).
| Parameter | Type | Description |
|---|---|---|
a |
{ asin?: string | null; isbn?: string | null; title?: string | null; work_key?: string | null; } |
First identity. |
a.asin? |
string | null |
- |
a.isbn? |
string | null |
- |
a.title? |
string | null |
- |
a.work_key? |
string | null |
- |
b |
{ asin?: string | null; isbn?: string | null; title?: string | null; work_key?: string | null; } |
Second identity. |
b.asin? |
string | null |
- |
b.isbn? |
string | null |
- |
b.title? |
string | null |
- |
b.work_key? |
string | null |
- |
boolean
Whether the rows should share store editions and wishlist state.
function catalogLanguageRank(hitLanguage, preferred?): number;
Soft language rank for ordering search hits.
| Parameter | Type | Description |
|---|---|---|
hitLanguage |
string | null | undefined |
Language on the hit. |
preferred? |
string |
Preferred language (default: browser). |
number
0 preferred, 1 unknown, 2 other.
function catalogLanguageSearchOpts(filterLanguage): object;
Maps Discover language control → hard filter / all-languages flag.
| Parameter | Type | Description |
|---|---|---|
filterLanguage |
string |
Selected language code or CATALOG_LANGUAGE_ALL. |
object
Server search language options.
| Name | Type |
|---|---|
allLanguages? |
boolean |
languages? |
string[] |
function catalogLanguageSelectOptions(preferred?): object[];
Options for the language <select>, ensuring the browser default appears.
| Parameter | Type | Description |
|---|---|---|
preferred? |
string |
Preferred BCP-47 primary tag (default: browser language). |
object[]
Value/label pairs for the control.
function catalogMatchesFilter(
title,
kind,
value
): boolean;
Returns whether a title matches a local catalog filter.
| Parameter | Type | Description |
|---|---|---|
title |
CatalogTitle |
Catalog title. |
kind |
CatalogFilterKind |
Filter category. |
value |
string |
Selected value (all / empty always matches). |
boolean
True when visible under the filter.
function catalogTitleFromHit(hit, wishlistUuid?): CatalogTitle;
Maps a catalog search hit into a CatalogTitle.
| Parameter | Type | Description |
|---|---|---|
hit |
CatalogSearchHit |
Search hit. |
wishlistUuid? |
string | null |
Optional wishlist uuid when already wished. |
Unified catalog title.
function catalogTitleFromQueueEntry(entry, wishlistUuid?): CatalogTitle;
Maps a global request-queue entry into a CatalogTitle.
| Parameter | Type | Description |
|---|---|---|
entry |
GlobalQueueEntry |
Queue entry. |
wishlistUuid? |
string | null |
Optional wishlist uuid when the current user also wished it. |
Unified catalog title.
function catalogTitleFromRec(rec, wishlistUuid?): CatalogTitle;
Maps a Discover recommendation into a CatalogTitle.
| Parameter | Type | Description |
|---|---|---|
rec |
Recommendation |
Recommendation row. |
wishlistUuid? |
string | null |
Optional wishlist uuid override. |
Unified catalog title.
function catalogTitleFromRequest(req): CatalogTitle;
Maps a wishlist title-request into a CatalogTitle.
| Parameter | Type | Description |
|---|---|---|
req |
TitleRequest |
Wishlist row. |
Unified catalog title (with wishlist_uuid set).
function defaultSortDirFor(sort): "desc" | "asc";
Default sort direction for a catalog sort key.
| Parameter | Type | Description |
|---|---|---|
sort |
CatalogSearchSort |
Catalog sort key. |
"desc" | "asc"
asc for title/author/length; otherwise desc.
function descriptionLooksComplete(raw): boolean;
Returns whether a blurb looks like a full store description, not a truncated teaser.
| Parameter | Type | Description |
|---|---|---|
raw |
string | null | undefined |
Optional HTML/plain description. |
boolean
True when length and ending look complete.
function discoverSearchFromMeta(kind, value): object;
Composes a Discover catalog search + facet filter from a title-detail meta link.
| Parameter | Type | Description |
|---|---|---|
kind |
"series" | "authors" | "narrators" | "genres" |
Metadata link kind (authors / narrators / series / genres). |
value |
string |
Linked label text. |
object
Search query, field, sort, and matching include filters.
| Name | Type |
|---|---|
authors? |
string[] |
field |
CatalogSearchField |
genres? |
string[] |
hideVirtualVoice |
boolean |
narrators? |
string[] |
q |
string |
series? |
string[] |
sort |
CatalogSearchSort |
function formatPurchasePrices(hint): string | null;
Compact purchase price line; prefers dual member/list when both exist.
| Parameter | Type | Description |
|---|---|---|
hint |
{ list_price_label?: string | null; member_price_label?: string | null; price_label?: string | null; } |
Price label fields from a purchase hint. |
hint.list_price_label? |
string | null |
- |
hint.member_price_label? |
string | null |
- |
hint.price_label? |
string | null |
- |
string | null
Display string, or null when no prices.
function formatSeriesLabel(series, seriesIndex?): string | null;
Formats series name + book number for list/card rows (Sun Eater #3).
| Parameter | Type | Description |
|---|---|---|
series |
string | null | undefined |
Series name. |
seriesIndex? |
string | null |
Optional book number. |
string | null
Label, or null when series is empty.
function formatShelfBestPrice(hint): string | null;
Single best price for shelf cards (member / primary only — no dual list).
| Parameter | Type | Description |
|---|---|---|
hint |
{ list_price_label?: string | null; member_price_label?: string | null; price_label?: string | null; } |
Price label fields from a purchase hint. |
hint.list_price_label? |
string | null |
- |
hint.member_price_label? |
string | null |
- |
hint.price_label? |
string | null |
- |
string | null
Display string, or null when no prices.
function pickBetterDescription(a, b): string | null;
Prefers richer store/Audnexus blurbs over short plain catalog teasers.
HTML descriptions win over plain text; otherwise the longer string wins.
| Parameter | Type | Description |
|---|---|---|
a |
string | null | undefined |
Current description. |
b |
string | null | undefined |
Incoming description. |
string | null
Preferred non-empty description, or null.
function preferCatalogLanguageOrder<T>(items, preferred?): T[];
Stable soft-sort: preferred language first, then unknown, then other.
| Type Parameter |
|---|
<a id="type-parameter-t"></a> T extends object |
| Parameter | Type | Description |
|---|---|---|
items |
T[] |
Rows with optional language. |
preferred? |
string |
Preferred language code. |
T[]
New array sorted by catalogLanguageRank.
function preferredCatalogLanguage(): string;
Primary BCP-47 language tag from the browser (default en).
string
Two/three-letter language code.
function runtimeBucketBounds(bucket): object;
Maps a runtime bucket to server min/max length filters.
| Parameter | Type | Description |
|---|---|---|
bucket |
RuntimeBucket |
Selected runtime bucket. |
object
Optional min_length_minutes / max_length_minutes.
| Name | Type |
|---|---|
max_length_minutes? |
number |
min_length_minutes? |
number |
function seriesChoices(names): string[];
One label per series among names that may spell it differently.
Names are grouped by seriesKey; each group shows the spelling most of its names use (the first seen on a tie).
| Parameter | Type | Description |
|---|---|---|
names |
Iterable<string> |
Series names, blanks allowed. |
string[]
The labels, sorted.
function seriesKey(name): string;
The key series names are grouped by.
Stores spell one series differently (King & Maxwell, King and Maxwell);
the key reads & as and and ignores case, accents, apostrophes,
parenthesised text and extra spaces, as the server's series filter does.
| Parameter | Type | Description |
|---|---|---|
name |
string |
A series name. |
string
The key; empty for a blank name.
function sortCatalogTitles(titles, sortKey): CatalogTitle[];
Client-sorts catalog titles for keys the server does not re-rank locally.
Relevance / popularity / rating keep input order (server ranking).
| Parameter | Type | Description |
|---|---|---|
titles |
CatalogTitle[] |
Catalog titles. |
sortKey |
CatalogSearchSort |
Sort key. |
Sorted copy or original order for server-ranked keys.
function splitMetaList(raw): string[];
Splits genre / category blobs (Fantasy; Epic / comma / pipe).
| Parameter | Type | Description |
|---|---|---|
raw |
string | null | undefined |
Combined list string. |
string[]
Trimmed non-empty parts.
function storeIconSrc(source): string | undefined;
Same-origin icon for a storefront or integration id (audible, libro, …).
Bookclerk downloads the icon the plugin names and serves a 128 px copy; the route fails when no deployed plugin has that id, so callers fall back to a monogram on error.
| Parameter | Type | Description |
|---|---|---|
source |
string |
Store id. |
string | undefined
Icon path, or undefined for an id that cannot name a plugin.
function storeLabel(source): string;
Human-readable label for a storefront plugin id in Discover filters.
Falls back to the raw id when the store is unknown so future plugins still render.
| Parameter | Type | Description |
|---|---|---|
source |
string |
Store id (audible, libro, …). |
string
Display name for UI chrome.
function titleNeedsMeta(title): boolean;
Returns whether a title still needs public metadata enrichment.
| Parameter | Type | Description |
|---|---|---|
title |
CatalogTitle |
Catalog title. |
boolean
True when core fields (description, length, publisher, narrators, series index) are incomplete.
function titleNeedsShelfMeta(title): boolean;
Returns whether a shelf card should pull title-meta (includes missing overall rating).
| Parameter | Type | Description |
|---|---|---|
title |
CatalogTitle |
Catalog title. |
boolean
True when titleNeedsMeta or rating_overall is unknown.
function withAudibleEditionFromAsin<T>(row): T;
Adds an Audible store edition when an ASIN is known and no Audible row exists.
Used by Discover shelves, Wishlist enrichment, and the shared detail modal so Where-to-buy does not depend on which surface fetched title-meta first.
| Type Parameter |
|---|
<a id="type-parameter-t-1"></a> T extends object |
| Parameter | Type | Description |
|---|---|---|
row |
T |
Title or detail fields that carry editions. |
T
The same object, or a copy with an Audible edition appended.
Generated from ui/src/lib at main · View as Markdown