@internetarchive/collection-browser 2.18.1 → 2.18.2-webdev-7743.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  import type { TemplateResult } from 'lit';
2
2
  import type { MediaType } from '@internetarchive/field-parsers';
3
- import { AggregationSortType, HitType, Review, SearchResult, SortDirection } from '@internetarchive/search-service';
3
+ import { AggregationSortType, HitType, SearchReview, SearchResult, SortDirection } from '@internetarchive/search-service';
4
4
  /**
5
5
  * Different types of tile overlays, corresponding to the above flags.
6
6
  */
@@ -57,7 +57,7 @@ export declare class TileModel {
57
57
  issue?: string;
58
58
  itemCount: number;
59
59
  mediatype: MediaType;
60
- review?: Review;
60
+ review?: SearchReview;
61
61
  source?: string;
62
62
  snippets?: string[];
63
63
  subjects: string[];
@@ -1 +1 @@
1
- {"version":3,"file":"models.js","sourceRoot":"","sources":["../../src/models.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAEpC,OAAO,EACL,mBAAmB,GAKpB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,sBAAsB,EAAE,MAAM,kCAAkC,CAAC;AAC1E,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAE7D,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AACtE,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAe/D,MAAM,CAAC,MAAM,iBAAiB,GAAoC;IAChE,gBAAgB,EAAE,GAAG,CAAC,0BAA0B,CAAC;IACjD,iBAAiB,EAAE,GAAG,CAAC,8BAA8B,CAAC;CACvD,CAAC;AAEF,MAAM,CAAC,MAAM,kBAAkB,GAA4C;IACzE,gBAAgB,EAAE,iBAAiB;IACnC,iBAAiB,EAAE,cAAc;CAClC,CAAC;AAeF;;GAEG;AACH,MAAM,OAAO,SAAS;IA2FpB,YACE,MAAoB,EACpB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AC1E,WAAW,EAAE,IAAI;IACjB,aAAa,EAAE,KAAK;IACpB,mBAAmB,EAAE,IAAI;IACzB,YAAY,EAAE,KAAK;IACnB,mBAAmB,EAAE,KAAK;IAC1B,WAAW,EAAE,IAAI;IACjB,qBAAqB,EAAE,KAAK;CAC7B,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAEjC;IACF,WAAW,EAAE,iBAAiB;IAC9B,mBAAmB,EAAE,gBAAgB;IACrC,WAAW,EAAE,kBAAkB;CAChC,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAA4B;IAC5D,WAAW,EAAE,IAAI;IACjB,SAAS,EAAE,IAAI;IACf,WAAW,EAAE,IAAI;IACjB,YAAY,EAAE,IAAI;IAClB,eAAe,EAAE,IAAI;IACrB,aAAa,EAAE,IAAI;IACnB,gBAAgB,EAAE,IAAI;IACtB,wBAAwB,EAAE,IAAI;IAC9B,KAAK,EAAE,IAAI;IACX,SAAS,EAAE,IAAI;IACf,OAAO,EAAE,IAAI;CACd,CAAC","sourcesContent":["import type { TemplateResult } from 'lit';\nimport { msg } from '@lit/localize';\nimport type { MediaType } from '@internetarchive/field-parsers';\nimport {\n AggregationSortType,\n HitType,\n Review,\n SearchResult,\n SortDirection,\n} from '@internetarchive/search-service';\nimport { collapseRepeatedQuotes } from './utils/collapse-repeated-quotes';\nimport { resolveMediatype } from './utils/resolve-mediatype';\n\nimport { loginRequiredIcon } from './assets/img/icons/login-required';\nimport { restrictedIcon } from './assets/img/icons/restricted';\n\n/**\n * Flags that can affect the visibility of content on a tile\n */\ninterface TileFlags {\n loginRequired: boolean;\n contentWarning: boolean;\n}\n\n/**\n * Different types of tile overlays, corresponding to the above flags.\n */\nexport type TileOverlayType = 'login-required' | 'content-warning';\n\nexport const TILE_OVERLAY_TEXT: Record<TileOverlayType, string> = {\n 'login-required': msg('Log in to view this item'),\n 'content-warning': msg('Content may be inappropriate'),\n};\n\nexport const TILE_OVERLAY_ICONS: Record<TileOverlayType, TemplateResult> = {\n 'login-required': loginRequiredIcon,\n 'content-warning': restrictedIcon,\n};\n\n/**\n * What type of request produced a given set of hits:\n * - `search_query`: Hits produced by an explicit user query and/or applied filters on any page\n * - `collection_members`: Hits produced for a collection page without any query or filters\n * - `profile_tab`: Hits produced for a tab of the profile page without any query or filters\n * - `unknown`: Hits produced via any other means\n */\nexport type HitRequestSource =\n | 'search_query'\n | 'collection_members'\n | 'profile_tab'\n | 'unknown';\n\n/**\n * Class for converting & storing raw search results in the correct format for UI tiles.\n */\nexport class TileModel {\n /** For TV hits. List of identifiers for any commercials contained. */\n adIds?: string[];\n\n averageRating?: number;\n\n /** For Web Archive hits on profile pages. List of capture dates for the current URL. */\n captureDates?: Date[];\n\n /** Whether this tile is currently checked for item management functions */\n checked: boolean;\n\n collectionIdentifier?: string;\n\n collectionName?: string;\n\n collectionFilesCount: number;\n\n collections: string[];\n\n collectionSize: number;\n\n commentCount: number;\n\n creator?: string;\n\n creators: string[];\n\n /** A string representation of the publication date, used strictly for passing preformatted dates to the parent */\n dateStr?: string;\n\n /** Date added to public search (software-defined) [from MD field: addeddate] */\n dateAdded?: Date;\n\n /** Date archived (software-defined) item created on archive.org [from MD field: publicdate] */\n dateArchived?: Date;\n\n /** Date work published in the world (user-defined) [from MD field: date] */\n datePublished?: Date;\n\n /** Date reviewed (user-created) most recent review [from MD field: reviewdate] */\n dateReviewed?: Date;\n\n description?: string;\n\n /** For TV hits. List of URLs for any fact-checks of the contained clips. */\n factChecks?: string[];\n\n favCount: number;\n\n hitRequestSource: HitRequestSource;\n\n hitType?: HitType;\n\n href?: string;\n\n identifier?: string;\n\n /** Whether this model represents a TV clip */\n isClip?: boolean;\n\n issue?: string;\n\n itemCount: number;\n\n mediatype: MediaType;\n\n review?: Review;\n\n source?: string;\n\n snippets?: string[];\n\n subjects: string[];\n\n thumbnailUrl?: string;\n\n title: string;\n\n tvClipCount?: number;\n\n viewCount?: number;\n\n volume?: string;\n\n weeklyViewCount?: number;\n\n loginRequired: boolean;\n\n contentWarning: boolean;\n\n constructor(\n result: SearchResult,\n hitRequestSource: HitRequestSource = 'unknown',\n ) {\n const flags = this.getFlags(result);\n\n this.adIds = result.ad_id?.values;\n this.averageRating = result.avg_rating?.value;\n this.captureDates = result.capture_dates?.values;\n this.checked = false;\n this.collections = result.collection?.values ?? [];\n this.collectionFilesCount = result.collection_files_count?.value ?? 0;\n this.collectionSize = result.collection_size?.value ?? 0;\n this.commentCount = result.num_reviews?.value ?? 0;\n this.creator = result.creator?.value;\n this.creators = result.creator?.values ?? [];\n this.dateAdded = result.addeddate?.value;\n this.dateArchived = result.publicdate?.value;\n this.datePublished = result.date?.value;\n this.dateReviewed = result.reviewdate?.value;\n this.description = result.description?.values.join('\\n');\n this.factChecks = result.factcheck?.values;\n this.favCount = result.num_favorites?.value ?? 0;\n this.hitRequestSource = hitRequestSource;\n this.hitType = result.rawMetadata?.hit_type;\n this.href = collapseRepeatedQuotes(\n result.review?.__href__ ?? result.__href__?.value,\n );\n this.identifier = TileModel.cleanIdentifier(result.identifier);\n this.isClip = result.is_clip?.value;\n this.issue = result.issue?.value;\n this.itemCount = result.item_count?.value ?? 0;\n this.mediatype = resolveMediatype(result);\n this.review = result.review;\n this.snippets = result.highlight?.values ?? [];\n this.source = result.source?.value;\n this.subjects = result.subject?.values ?? [];\n this.thumbnailUrl = result.__img__?.value;\n this.title = result.title?.value ?? '';\n this.tvClipCount = result.num_clips?.value ?? 0;\n this.volume = result.volume?.value;\n this.viewCount = result.downloads?.value;\n this.weeklyViewCount = result.week?.value;\n this.loginRequired = flags.loginRequired;\n this.contentWarning = flags.contentWarning;\n }\n\n /**\n * Copies the contents of this TileModel onto a new instance\n */\n clone(): TileModel {\n const cloned = new TileModel({});\n cloned.adIds = this.adIds;\n cloned.averageRating = this.averageRating;\n cloned.captureDates = this.captureDates;\n cloned.checked = this.checked;\n cloned.collections = this.collections;\n cloned.collectionFilesCount = this.collectionFilesCount;\n cloned.collectionSize = this.collectionSize;\n cloned.commentCount = this.commentCount;\n cloned.creator = this.creator;\n cloned.creators = this.creators;\n cloned.dateStr = this.dateStr;\n cloned.dateAdded = this.dateAdded;\n cloned.dateArchived = this.dateArchived;\n cloned.datePublished = this.datePublished;\n cloned.dateReviewed = this.dateReviewed;\n cloned.description = this.description;\n cloned.factChecks = this.factChecks;\n cloned.favCount = this.favCount;\n cloned.hitRequestSource = this.hitRequestSource;\n cloned.hitType = this.hitType;\n cloned.href = this.href;\n cloned.identifier = this.identifier;\n cloned.isClip = this.isClip;\n cloned.issue = this.issue;\n cloned.itemCount = this.itemCount;\n cloned.mediatype = this.mediatype;\n cloned.snippets = this.snippets;\n cloned.source = this.source;\n cloned.subjects = this.subjects;\n cloned.thumbnailUrl = this.thumbnailUrl;\n cloned.title = this.title;\n cloned.tvClipCount = this.tvClipCount;\n cloned.volume = this.volume;\n cloned.viewCount = this.viewCount;\n cloned.weeklyViewCount = this.weeklyViewCount;\n cloned.loginRequired = this.loginRequired;\n cloned.contentWarning = this.contentWarning;\n return cloned;\n }\n\n /**\n * Whether this model represents the result of a TV search query.\n */\n get isTvSearchResult(): boolean {\n return (\n this.hitType === 'tv_clip' && this.hitRequestSource === 'search_query'\n );\n }\n\n /**\n * Determines the appropriate tile flags for the given search result\n * (login required and/or content warning)\n */\n private getFlags(result: SearchResult): TileFlags {\n const flags: TileFlags = {\n loginRequired: false,\n contentWarning: false,\n };\n\n // Check if item and item in \"modifying\" collection, setting above flags\n if (\n result.collection?.values.length &&\n result.mediatype?.value !== 'collection'\n ) {\n for (const collection of result.collection?.values ?? []) {\n if (collection === 'loggedin') {\n flags.loginRequired = true;\n if (flags.contentWarning) break;\n }\n if (collection === 'no-preview') {\n flags.contentWarning = true;\n if (flags.loginRequired) break;\n }\n }\n }\n\n return flags;\n }\n\n private static cleanIdentifier(\n identifier: string | undefined,\n ): string | undefined {\n // Some identifiers (e.g., from Whisper) represent documents rather than items, and\n // are suffixed with values that need to be stripped. Those values are separated\n // from the item identifier itself with '|'.\n const barIndex = identifier?.indexOf('|') ?? -1;\n const cleaned = barIndex > 0 ? identifier?.slice(0, barIndex) : identifier;\n return cleaned;\n }\n}\n\nexport type RequestKind = 'full' | 'hits' | 'aggregations';\n\nexport type CollectionDisplayMode = 'grid' | 'list-compact' | 'list-detail';\n\nexport type TileDisplayMode =\n | 'grid'\n | 'list-compact'\n | 'list-detail'\n | 'list-header';\n\n/**\n * This is mainly used to set the cookies for the collection display mode.\n *\n * It allows the user to set different modes for different contexts (collection page, search page, profile page etc).\n */\nexport type CollectionBrowserContext = 'collection' | 'search' | 'profile';\n\n/**\n * The sort fields shown in the sort filter bar\n */\nexport enum SortField {\n 'default' = 'default',\n 'unrecognized' = 'unrecognized',\n 'relevance' = 'relevance',\n 'alltimeview' = 'alltimeview',\n 'weeklyview' = 'weeklyview',\n 'title' = 'title',\n 'date' = 'date',\n 'datearchived' = 'datearchived',\n 'datereviewed' = 'datereviewed',\n 'dateadded' = 'dateadded',\n 'datefavorited' = 'datefavorited',\n 'creator' = 'creator',\n}\n\nexport interface SortOption {\n /**\n * The SortField enum member corresponding to this option.\n */\n field: SortField;\n\n /**\n * The default sort direction to apply when this sort option is first selected.\n */\n defaultSortDirection: SortDirection | null;\n\n /**\n * Whether this sort option allows its sort direction to be changed from the default.\n */\n canSetDirection: boolean;\n\n /**\n * Whether this sort option may appear in the sort bar.\n */\n shownInSortBar: boolean;\n\n /**\n * Whether this sort option should be saved to the URL.\n * If false, then no `sort` param will be added to the URL when this sort option\n * is selected.\n */\n shownInURL: boolean;\n\n /**\n * Whether this sort option is passed to the search service.\n * If false, then no sort param will be passed to the search service at all when\n * this sort option is selected.\n */\n handledBySearchService: boolean;\n\n /**\n * The string identifying this sort field to the search service & backend API.\n */\n searchServiceKey?: string;\n\n /**\n * The human-readable name to use for this option in the sort bar (if applicable).\n */\n displayName: string;\n\n /**\n * A list of URL param keys that should be mapped to this sort option.\n * E.g., both `title` and `titleSorter` in the URL map to the `SortField.title` option.\n */\n urlNames: (string | null | undefined)[];\n}\n\nexport const SORT_OPTIONS: Record<SortField, SortOption> = {\n // Default sort is the case where the user has not specified a sort option via the sort bar or URL.\n // In these cases, we defer to whatever sort the backend chooses.\n // For the search page, the default is always relevance sort.\n // For collection pages _without a query_, the default is usually weekly views, but this can be\n // overridden by the collection's `sort-by` metadata entry. If a query _is_ specified, then the\n // default is again relevance sort.\n // For fav-* collections only, the default is instead sorting by date favorited.\n [SortField.default]: {\n field: SortField.default,\n defaultSortDirection: null,\n canSetDirection: false,\n shownInSortBar: false,\n shownInURL: false,\n handledBySearchService: false, // We rely on the PPS default sort handling in these cases\n displayName: '',\n urlNames: ['', null, undefined], // Empty or nullish sort params result in default sorting\n },\n // Unrecognized sort is the case where the user has specified a sort in the URL, but it is not\n // one of the options listed in this map. We still want these unrecognized sorts to be applied\n // when searching, but they are not displayed in the sort bar and we do not actively manage\n // their URL param beyond flipping the direction as needed.\n [SortField.unrecognized]: {\n field: SortField.unrecognized,\n defaultSortDirection: null,\n canSetDirection: true,\n shownInSortBar: false,\n shownInURL: false,\n handledBySearchService: true, // The unrecognized sort param is passed along as-is\n displayName: '',\n urlNames: [],\n },\n // Relevance sort is unique in that it does not produce a URL param when it is set.\n // It is only available when there is a user-specified query that relevancy can be scored against.\n // Therefore, it does not appear as a sort bar option when browsing a collection with no query set.\n [SortField.relevance]: {\n field: SortField.relevance,\n defaultSortDirection: null,\n canSetDirection: false,\n shownInSortBar: true,\n shownInURL: false,\n handledBySearchService: false,\n displayName: 'Relevance',\n urlNames: ['_score'],\n },\n [SortField.alltimeview]: {\n field: SortField.alltimeview,\n defaultSortDirection: 'desc',\n canSetDirection: true,\n shownInSortBar: true,\n shownInURL: true,\n handledBySearchService: true,\n searchServiceKey: 'downloads',\n displayName: 'All-time views',\n urlNames: ['downloads'],\n },\n [SortField.weeklyview]: {\n field: SortField.weeklyview,\n defaultSortDirection: 'desc',\n canSetDirection: true,\n shownInSortBar: true,\n shownInURL: true,\n handledBySearchService: true,\n searchServiceKey: 'week',\n displayName: 'Weekly views',\n urlNames: ['week'],\n },\n [SortField.title]: {\n field: SortField.title,\n defaultSortDirection: 'asc',\n canSetDirection: true,\n shownInSortBar: true,\n shownInURL: true,\n handledBySearchService: true,\n searchServiceKey: 'titleSorter',\n displayName: 'Title',\n urlNames: ['title', 'titleSorter'],\n },\n [SortField.date]: {\n field: SortField.date,\n defaultSortDirection: 'desc',\n canSetDirection: true,\n shownInSortBar: true,\n shownInURL: true,\n handledBySearchService: true,\n searchServiceKey: 'date',\n displayName: 'Date published',\n urlNames: ['date'],\n },\n [SortField.datearchived]: {\n field: SortField.datearchived,\n defaultSortDirection: 'desc',\n canSetDirection: true,\n shownInSortBar: true,\n shownInURL: true,\n handledBySearchService: true,\n searchServiceKey: 'publicdate',\n displayName: 'Date archived',\n urlNames: ['publicdate'],\n },\n [SortField.datereviewed]: {\n field: SortField.datereviewed,\n defaultSortDirection: 'desc',\n canSetDirection: true,\n shownInSortBar: true,\n shownInURL: true,\n handledBySearchService: true,\n searchServiceKey: 'reviewdate',\n displayName: 'Date reviewed',\n urlNames: ['reviewdate'],\n },\n [SortField.dateadded]: {\n field: SortField.dateadded,\n defaultSortDirection: 'desc',\n canSetDirection: true,\n shownInSortBar: true,\n shownInURL: true,\n handledBySearchService: true,\n searchServiceKey: 'addeddate',\n displayName: 'Date added',\n urlNames: ['addeddate'],\n },\n [SortField.datefavorited]: {\n field: SortField.datefavorited,\n defaultSortDirection: 'desc',\n canSetDirection: false,\n shownInSortBar: true, // But only when viewing fav-* collections\n shownInURL: false,\n handledBySearchService: false,\n searchServiceKey: 'favoritedate',\n displayName: 'Date favorited',\n urlNames: ['favoritedate'],\n },\n [SortField.creator]: {\n field: SortField.creator,\n defaultSortDirection: 'asc',\n canSetDirection: true,\n shownInSortBar: true,\n shownInURL: true,\n handledBySearchService: true,\n searchServiceKey: 'creatorSorter',\n displayName: 'Creator',\n urlNames: ['creator', 'creatorSorter'],\n },\n};\n\n/**\n * Returns the SortOption corresponding to the given API sort name, or\n * the \"unrecognized\" SortOption if none matches.\n */\nexport function sortOptionFromAPIString(sortName?: string | null): SortOption {\n return (\n Object.values(SORT_OPTIONS).find(opt =>\n opt.urlNames.some(name => sortName === name),\n ) ?? SORT_OPTIONS[SortField.unrecognized]\n );\n}\n\nexport const defaultProfileElementSorts: Record<\n string,\n Exclude<SortField, SortField.default>\n> = {\n uploads: SortField.datearchived,\n reviews: SortField.datereviewed,\n collections: SortField.datearchived,\n web_archives: SortField.datearchived,\n};\n\n/** A union of the fields that permit prefix filtering (e.g., alphabetical filtering) */\nexport type PrefixFilterType = 'title' | 'creator';\n\n/** A map from prefixes (e.g., initial letters) to the number of items matching that prefix */\nexport type PrefixFilterCounts = Record<string, number>;\n\n/**\n * A map from prefix filter types to the corresponding aggregation keys\n * that are needed to fetch the filter counts from the backend.\n */\nexport const prefixFilterAggregationKeys: Record<PrefixFilterType, string> = {\n title: 'firstTitle',\n creator: 'firstCreator',\n};\n\n/**\n * Different facet loading strategies that can be used with collection browser.\n * - `eager`: Facet data is always loaded as soon as a search is performed\n * - `lazy-mobile`: In the desktop layout, functions exactly as `eager`.\n * In the mobile layout, facet data will only be loaded once the \"Filters\" accordion is opened.\n * - `opt-in-or-login`: Same as `opt-in` for guest users not logged into an account, but same as `eager` for\n * any logged in user.\n * - `opt-in`: In the desktop layout, facet data will only be loaded after the user presses a \"Load Facets\" button.\n * In the mobile layout, functions exactly as `lazy-mobile`.\n * - `off`: Facet data will never be loaded, and a message will be displayed in place of facets\n * indicating that they are unavailable.\n */\nexport type FacetLoadStrategy =\n | 'eager'\n | 'lazy-mobile'\n | 'opt-in-or-login'\n | 'opt-in'\n | 'off';\n\n/**\n * Union of the facet types that are available in the sidebar.\n */\nexport type FacetOption =\n | 'subject'\n | 'lending'\n | 'mediatype'\n | 'language'\n | 'creator'\n | 'collection'\n | 'year'\n // TV-specific facet options:\n | 'program'\n | 'person'\n | 'sponsor';\n\nexport type SelectedFacetState = 'selected' | 'hidden';\n\nexport type FacetState = SelectedFacetState | 'none';\n\nexport interface FacetBucket {\n key: string;\n count: number;\n state: FacetState;\n // for some facets, we augment the key with a display value\n displayText?: string;\n // for TV channel facets, we add a parenthesized secondary name\n extraNote?: string;\n}\n\nexport interface FacetGroup {\n title: string;\n key: FacetOption;\n buckets: FacetBucket[];\n}\n\n/**\n * Information about a user interaction event on a facet.\n */\nexport type FacetEventDetails = {\n /**\n * The type of facet that was interacted with (e.g., 'mediatype', 'language', ...).\n */\n facetType: FacetOption;\n /**\n * The bucket corresponding to the facet that was interacted with, including the\n * updated state of the facet after the interaction.\n */\n bucket: FacetBucket;\n /**\n * Whether the interaction occurred on a negative facet.\n */\n negative: boolean;\n};\n\nexport type FacetValue = string;\n\nexport type SelectedFacets = Partial<\n Record<FacetOption, Record<FacetValue, FacetBucket>>\n>;\n\nexport const getDefaultSelectedFacets = (): Required<SelectedFacets> => ({\n subject: {},\n lending: {},\n mediatype: {},\n language: {},\n creator: {},\n collection: {},\n year: {},\n program: {},\n person: {},\n sponsor: {},\n});\n\n/**\n * For TV search results, what types of TV clips to restrict the results to.\n */\nexport type TvClipFilterType = 'all' | 'commercials' | 'factchecks' | 'quotes';\n\n/**\n * Map from TV clip filter types to their corresponding URL params\n */\nexport const tvClipFiltersToURLParams: Record<TvClipFilterType, string> = {\n all: '',\n commercials: 'only_commercials',\n factchecks: 'only_factchecks',\n quotes: 'only_quotes',\n};\n\n/**\n * Map from allowed TV filtering parameters in the URL to their corresponding filter type\n */\nexport const tvClipURLParamsToFilters: Record<string, TvClipFilterType> = {\n only_commercials: 'commercials',\n only_factchecks: 'factchecks',\n only_quotes: 'quotes',\n};\n\n/**\n * Facet display order when presenting results for all search types *except* TV (see below).\n */\nexport const defaultFacetDisplayOrder: FacetOption[] = [\n 'mediatype',\n // 'lending', Commenting this out removes the lending facet from the sidebar for now\n 'year',\n 'subject',\n 'collection',\n 'creator',\n 'language',\n];\n\n/**\n * Specialized facet ordering when displaying TV search results\n */\nexport const tvFacetDisplayOrder: FacetOption[] = [\n 'program',\n 'creator',\n 'year',\n 'subject',\n 'collection',\n 'person',\n 'sponsor',\n 'language',\n];\n\n/**\n * Human-readable titles for each facet group.\n */\nexport const facetTitles: Record<FacetOption, string> = {\n subject: 'Subject',\n lending: 'Availability',\n mediatype: 'Media Type',\n language: 'Language',\n creator: 'Creator',\n collection: 'Collection',\n year: 'Year',\n program: 'Program',\n person: 'Person',\n sponsor: 'Sponsor',\n};\n\n/**\n * The default sort type to use for each facet type\n */\nexport const defaultFacetSort: Record<FacetOption, AggregationSortType> = {\n subject: AggregationSortType.COUNT,\n lending: AggregationSortType.COUNT,\n mediatype: AggregationSortType.COUNT,\n language: AggregationSortType.COUNT,\n creator: AggregationSortType.COUNT,\n collection: AggregationSortType.COUNT,\n year: AggregationSortType.NUMERIC, // Year facets are ordered by their numeric value by default\n program: AggregationSortType.COUNT,\n person: AggregationSortType.COUNT,\n sponsor: AggregationSortType.COUNT,\n};\n\n/**\n * The sort type corresponding to facet bucket values, for each facet type\n * (i.e., the opposite of \"sort by count\" for that type).\n */\nexport const valueFacetSort: Record<FacetOption, AggregationSortType> = {\n subject: AggregationSortType.ALPHABETICAL,\n lending: AggregationSortType.ALPHABETICAL,\n mediatype: AggregationSortType.ALPHABETICAL,\n language: AggregationSortType.ALPHABETICAL,\n creator: AggregationSortType.ALPHABETICAL,\n collection: AggregationSortType.ALPHABETICAL,\n year: AggregationSortType.NUMERIC, // Year facets' values should be compared numerically, not lexicographically (year 2001 > year 3)\n program: AggregationSortType.ALPHABETICAL,\n person: AggregationSortType.ALPHABETICAL,\n sponsor: AggregationSortType.ALPHABETICAL,\n};\n\nexport type LendingFacetKey =\n | 'is_lendable'\n | 'is_borrowable'\n | 'available_to_borrow'\n | 'is_browsable'\n | 'available_to_browse'\n | 'is_readable'\n | 'available_to_waitlist';\n\n/**\n * Maps valid lending keys to whether they should be visible in the facet sidebar\n */\nexport const lendingFacetKeysVisibility: Record<LendingFacetKey, boolean> = {\n is_lendable: true,\n is_borrowable: false,\n available_to_borrow: true,\n is_browsable: false,\n available_to_browse: false,\n is_readable: true,\n available_to_waitlist: false,\n};\n\n/**\n * Maps valid, visible lending keys to their facet sidebar display text\n */\nexport const lendingFacetDisplayNames: Partial<\n Record<LendingFacetKey, string>\n> = {\n is_lendable: 'Lending Library',\n available_to_borrow: 'Borrow 14 Days',\n is_readable: 'Always Available',\n};\n\n/**\n * A record of which admin-only collections should be suppressed from being displayed\n * as facets or in an item's list of collections.\n */\nexport const suppressedCollections: Record<string, boolean> = {\n deemphasize: true,\n community: true,\n stream_only: true,\n samples_only: true,\n test_collection: true,\n printdisabled: true,\n 'openlibrary-ol': true,\n nationalemergencylibrary: true,\n china: true,\n americana: true,\n toronto: true,\n};\n\n/**\n * A record of manageable item\n */\nexport interface ManageableItem {\n identifier: string;\n title?: string;\n dateStr?: string;\n date?: string;\n}\n\n/**\n * Possible states for whether & how the user has overridden their user preference\n * for blurring behavior on tiles with sensitive content.\n * - `no-override`: The user has not overridden their user preference, so simply\n * respect the preference as given.\n * - `on`: The user has overridden their preference and wants tile blurring enabled.\n * - `off`: The user has overridden their preference and wants tile blurring disabled.\n */\nexport type TileBlurOverrideState = 'no-override' | 'on' | 'off';\n"]}
1
+ {"version":3,"file":"models.js","sourceRoot":"","sources":["../../src/models.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAEpC,OAAO,EACL,mBAAmB,GAKpB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,sBAAsB,EAAE,MAAM,kCAAkC,CAAC;AAC1E,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAE7D,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AACtE,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAe/D,MAAM,CAAC,MAAM,iBAAiB,GAAoC;IAChE,gBAAgB,EAAE,GAAG,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CAAC,YAAY;IAC5C,IAAI,EAAE,mBAAmB,CAAC,OAAO,EAAE,iGAAiG;IACpI,OAAO,EAAE,mBAAmB,CAAC,YAAY;IACzC,MAAM,EAAE,mBAAmB,CAAC,YAAY;IACxC,OAAO,EAAE,mBAAmB,CAAC,YAAY;CAC1C,CAAC;AAWF;;GAEG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAqC;IAC1E,WAAW,EAAE,IAAI;IACjB,aAAa,EAAE,KAAK;IACpB,mBAAmB,EAAE,IAAI;IACzB,YAAY,EAAE,KAAK;IACnB,mBAAmB,EAAE,KAAK;IAC1B,WAAW,EAAE,IAAI;IACjB,qBAAqB,EAAE,KAAK;CAC7B,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAEjC;IACF,WAAW,EAAE,iBAAiB;IAC9B,mBAAmB,EAAE,gBAAgB;IACrC,WAAW,EAAE,kBAAkB;CAChC,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAA4B;IAC5D,WAAW,EAAE,IAAI;IACjB,SAAS,EAAE,IAAI;IACf,WAAW,EAAE,IAAI;IACjB,YAAY,EAAE,IAAI;IAClB,eAAe,EAAE,IAAI;IACrB,aAAa,EAAE,IAAI;IACnB,gBAAgB,EAAE,IAAI;IACtB,wBAAwB,EAAE,IAAI;IAC9B,KAAK,EAAE,IAAI;IACX,SAAS,EAAE,IAAI;IACf,OAAO,EAAE,IAAI;CACd,CAAC","sourcesContent":["import type { TemplateResult } from 'lit';\nimport { msg } from '@lit/localize';\nimport type { MediaType } from '@internetarchive/field-parsers';\nimport {\n AggregationSortType,\n HitType,\n SearchReview,\n SearchResult,\n SortDirection,\n} from '@internetarchive/search-service';\nimport { collapseRepeatedQuotes } from './utils/collapse-repeated-quotes';\nimport { resolveMediatype } from './utils/resolve-mediatype';\n\nimport { loginRequiredIcon } from './assets/img/icons/login-required';\nimport { restrictedIcon } from './assets/img/icons/restricted';\n\n/**\n * Flags that can affect the visibility of content on a tile\n */\ninterface TileFlags {\n loginRequired: boolean;\n contentWarning: boolean;\n}\n\n/**\n * Different types of tile overlays, corresponding to the above flags.\n */\nexport type TileOverlayType = 'login-required' | 'content-warning';\n\nexport const TILE_OVERLAY_TEXT: Record<TileOverlayType, string> = {\n 'login-required': msg('Log in to view this item'),\n 'content-warning': msg('Content may be inappropriate'),\n};\n\nexport const TILE_OVERLAY_ICONS: Record<TileOverlayType, TemplateResult> = {\n 'login-required': loginRequiredIcon,\n 'content-warning': restrictedIcon,\n};\n\n/**\n * What type of request produced a given set of hits:\n * - `search_query`: Hits produced by an explicit user query and/or applied filters on any page\n * - `collection_members`: Hits produced for a collection page without any query or filters\n * - `profile_tab`: Hits produced for a tab of the profile page without any query or filters\n * - `unknown`: Hits produced via any other means\n */\nexport type HitRequestSource =\n | 'search_query'\n | 'collection_members'\n | 'profile_tab'\n | 'unknown';\n\n/**\n * Class for converting & storing raw search results in the correct format for UI tiles.\n */\nexport class TileModel {\n /** For TV hits. List of identifiers for any commercials contained. */\n adIds?: string[];\n\n averageRating?: number;\n\n /** For Web Archive hits on profile pages. List of capture dates for the current URL. */\n captureDates?: Date[];\n\n /** Whether this tile is currently checked for item management functions */\n checked: boolean;\n\n collectionIdentifier?: string;\n\n collectionName?: string;\n\n collectionFilesCount: number;\n\n collections: string[];\n\n collectionSize: number;\n\n commentCount: number;\n\n creator?: string;\n\n creators: string[];\n\n /** A string representation of the publication date, used strictly for passing preformatted dates to the parent */\n dateStr?: string;\n\n /** Date added to public search (software-defined) [from MD field: addeddate] */\n dateAdded?: Date;\n\n /** Date archived (software-defined) item created on archive.org [from MD field: publicdate] */\n dateArchived?: Date;\n\n /** Date work published in the world (user-defined) [from MD field: date] */\n datePublished?: Date;\n\n /** Date reviewed (user-created) most recent review [from MD field: reviewdate] */\n dateReviewed?: Date;\n\n description?: string;\n\n /** For TV hits. List of URLs for any fact-checks of the contained clips. */\n factChecks?: string[];\n\n favCount: number;\n\n hitRequestSource: HitRequestSource;\n\n hitType?: HitType;\n\n href?: string;\n\n identifier?: string;\n\n /** Whether this model represents a TV clip */\n isClip?: boolean;\n\n issue?: string;\n\n itemCount: number;\n\n mediatype: MediaType;\n\n review?: SearchReview;\n\n source?: string;\n\n snippets?: string[];\n\n subjects: string[];\n\n thumbnailUrl?: string;\n\n title: string;\n\n tvClipCount?: number;\n\n viewCount?: number;\n\n volume?: string;\n\n weeklyViewCount?: number;\n\n loginRequired: boolean;\n\n contentWarning: boolean;\n\n constructor(\n result: SearchResult,\n hitRequestSource: HitRequestSource = 'unknown',\n ) {\n const flags = this.getFlags(result);\n\n this.adIds = result.ad_id?.values;\n this.averageRating = result.avg_rating?.value;\n this.captureDates = result.capture_dates?.values;\n this.checked = false;\n this.collections = result.collection?.values ?? [];\n this.collectionFilesCount = result.collection_files_count?.value ?? 0;\n this.collectionSize = result.collection_size?.value ?? 0;\n this.commentCount = result.num_reviews?.value ?? 0;\n this.creator = result.creator?.value;\n this.creators = result.creator?.values ?? [];\n this.dateAdded = result.addeddate?.value;\n this.dateArchived = result.publicdate?.value;\n this.datePublished = result.date?.value;\n this.dateReviewed = result.reviewdate?.value;\n this.description = result.description?.values.join('\\n');\n this.factChecks = result.factcheck?.values;\n this.favCount = result.num_favorites?.value ?? 0;\n this.hitRequestSource = hitRequestSource;\n this.hitType = result.rawMetadata?.hit_type;\n this.href = collapseRepeatedQuotes(\n result.review?.__href__ ?? result.__href__?.value,\n );\n this.identifier = TileModel.cleanIdentifier(result.identifier);\n this.isClip = result.is_clip?.value;\n this.issue = result.issue?.value;\n this.itemCount = result.item_count?.value ?? 0;\n this.mediatype = resolveMediatype(result);\n this.review = result.review;\n this.snippets = result.highlight?.values ?? [];\n this.source = result.source?.value;\n this.subjects = result.subject?.values ?? [];\n this.thumbnailUrl = result.__img__?.value;\n this.title = result.title?.value ?? '';\n this.tvClipCount = result.num_clips?.value ?? 0;\n this.volume = result.volume?.value;\n this.viewCount = result.downloads?.value;\n this.weeklyViewCount = result.week?.value;\n this.loginRequired = flags.loginRequired;\n this.contentWarning = flags.contentWarning;\n }\n\n /**\n * Copies the contents of this TileModel onto a new instance\n */\n clone(): TileModel {\n const cloned = new TileModel({});\n cloned.adIds = this.adIds;\n cloned.averageRating = this.averageRating;\n cloned.captureDates = this.captureDates;\n cloned.checked = this.checked;\n cloned.collections = this.collections;\n cloned.collectionFilesCount = this.collectionFilesCount;\n cloned.collectionSize = this.collectionSize;\n cloned.commentCount = this.commentCount;\n cloned.creator = this.creator;\n cloned.creators = this.creators;\n cloned.dateStr = this.dateStr;\n cloned.dateAdded = this.dateAdded;\n cloned.dateArchived = this.dateArchived;\n cloned.datePublished = this.datePublished;\n cloned.dateReviewed = this.dateReviewed;\n cloned.description = this.description;\n cloned.factChecks = this.factChecks;\n cloned.favCount = this.favCount;\n cloned.hitRequestSource = this.hitRequestSource;\n cloned.hitType = this.hitType;\n cloned.href = this.href;\n cloned.identifier = this.identifier;\n cloned.isClip = this.isClip;\n cloned.issue = this.issue;\n cloned.itemCount = this.itemCount;\n cloned.mediatype = this.mediatype;\n cloned.snippets = this.snippets;\n cloned.source = this.source;\n cloned.subjects = this.subjects;\n cloned.thumbnailUrl = this.thumbnailUrl;\n cloned.title = this.title;\n cloned.tvClipCount = this.tvClipCount;\n cloned.volume = this.volume;\n cloned.viewCount = this.viewCount;\n cloned.weeklyViewCount = this.weeklyViewCount;\n cloned.loginRequired = this.loginRequired;\n cloned.contentWarning = this.contentWarning;\n return cloned;\n }\n\n /**\n * Whether this model represents the result of a TV search query.\n */\n get isTvSearchResult(): boolean {\n return (\n this.hitType === 'tv_clip' && this.hitRequestSource === 'search_query'\n );\n }\n\n /**\n * Determines the appropriate tile flags for the given search result\n * (login required and/or content warning)\n */\n private getFlags(result: SearchResult): TileFlags {\n const flags: TileFlags = {\n loginRequired: false,\n contentWarning: false,\n };\n\n // Check if item and item in \"modifying\" collection, setting above flags\n if (\n result.collection?.values.length &&\n result.mediatype?.value !== 'collection'\n ) {\n for (const collection of result.collection?.values ?? []) {\n if (collection === 'loggedin') {\n flags.loginRequired = true;\n if (flags.contentWarning) break;\n }\n if (collection === 'no-preview') {\n flags.contentWarning = true;\n if (flags.loginRequired) break;\n }\n }\n }\n\n return flags;\n }\n\n private static cleanIdentifier(\n identifier: string | undefined,\n ): string | undefined {\n // Some identifiers (e.g., from Whisper) represent documents rather than items, and\n // are suffixed with values that need to be stripped. Those values are separated\n // from the item identifier itself with '|'.\n const barIndex = identifier?.indexOf('|') ?? -1;\n const cleaned = barIndex > 0 ? identifier?.slice(0, barIndex) : identifier;\n return cleaned;\n }\n}\n\nexport type RequestKind = 'full' | 'hits' | 'aggregations';\n\nexport type CollectionDisplayMode = 'grid' | 'list-compact' | 'list-detail';\n\nexport type TileDisplayMode =\n | 'grid'\n | 'list-compact'\n | 'list-detail'\n | 'list-header';\n\n/**\n * This is mainly used to set the cookies for the collection display mode.\n *\n * It allows the user to set different modes for different contexts (collection page, search page, profile page etc).\n */\nexport type CollectionBrowserContext = 'collection' | 'search' | 'profile';\n\n/**\n * The sort fields shown in the sort filter bar\n */\nexport enum SortField {\n 'default' = 'default',\n 'unrecognized' = 'unrecognized',\n 'relevance' = 'relevance',\n 'alltimeview' = 'alltimeview',\n 'weeklyview' = 'weeklyview',\n 'title' = 'title',\n 'date' = 'date',\n 'datearchived' = 'datearchived',\n 'datereviewed' = 'datereviewed',\n 'dateadded' = 'dateadded',\n 'datefavorited' = 'datefavorited',\n 'creator' = 'creator',\n}\n\nexport interface SortOption {\n /**\n * The SortField enum member corresponding to this option.\n */\n field: SortField;\n\n /**\n * The default sort direction to apply when this sort option is first selected.\n */\n defaultSortDirection: SortDirection | null;\n\n /**\n * Whether this sort option allows its sort direction to be changed from the default.\n */\n canSetDirection: boolean;\n\n /**\n * Whether this sort option may appear in the sort bar.\n */\n shownInSortBar: boolean;\n\n /**\n * Whether this sort option should be saved to the URL.\n * If false, then no `sort` param will be added to the URL when this sort option\n * is selected.\n */\n shownInURL: boolean;\n\n /**\n * Whether this sort option is passed to the search service.\n * If false, then no sort param will be passed to the search service at all when\n * this sort option is selected.\n */\n handledBySearchService: boolean;\n\n /**\n * The string identifying this sort field to the search service & backend API.\n */\n searchServiceKey?: string;\n\n /**\n * The human-readable name to use for this option in the sort bar (if applicable).\n */\n displayName: string;\n\n /**\n * A list of URL param keys that should be mapped to this sort option.\n * E.g., both `title` and `titleSorter` in the URL map to the `SortField.title` option.\n */\n urlNames: (string | null | undefined)[];\n}\n\nexport const SORT_OPTIONS: Record<SortField, SortOption> = {\n // Default sort is the case where the user has not specified a sort option via the sort bar or URL.\n // In these cases, we defer to whatever sort the backend chooses.\n // For the search page, the default is always relevance sort.\n // For collection pages _without a query_, the default is usually weekly views, but this can be\n // overridden by the collection's `sort-by` metadata entry. If a query _is_ specified, then the\n // default is again relevance sort.\n // For fav-* collections only, the default is instead sorting by date favorited.\n [SortField.default]: {\n field: SortField.default,\n defaultSortDirection: null,\n canSetDirection: false,\n shownInSortBar: false,\n shownInURL: false,\n handledBySearchService: false, // We rely on the PPS default sort handling in these cases\n displayName: '',\n urlNames: ['', null, undefined], // Empty or nullish sort params result in default sorting\n },\n // Unrecognized sort is the case where the user has specified a sort in the URL, but it is not\n // one of the options listed in this map. We still want these unrecognized sorts to be applied\n // when searching, but they are not displayed in the sort bar and we do not actively manage\n // their URL param beyond flipping the direction as needed.\n [SortField.unrecognized]: {\n field: SortField.unrecognized,\n defaultSortDirection: null,\n canSetDirection: true,\n shownInSortBar: false,\n shownInURL: false,\n handledBySearchService: true, // The unrecognized sort param is passed along as-is\n displayName: '',\n urlNames: [],\n },\n // Relevance sort is unique in that it does not produce a URL param when it is set.\n // It is only available when there is a user-specified query that relevancy can be scored against.\n // Therefore, it does not appear as a sort bar option when browsing a collection with no query set.\n [SortField.relevance]: {\n field: SortField.relevance,\n defaultSortDirection: null,\n canSetDirection: false,\n shownInSortBar: true,\n shownInURL: false,\n handledBySearchService: false,\n displayName: 'Relevance',\n urlNames: ['_score'],\n },\n [SortField.alltimeview]: {\n field: SortField.alltimeview,\n defaultSortDirection: 'desc',\n canSetDirection: true,\n shownInSortBar: true,\n shownInURL: true,\n handledBySearchService: true,\n searchServiceKey: 'downloads',\n displayName: 'All-time views',\n urlNames: ['downloads'],\n },\n [SortField.weeklyview]: {\n field: SortField.weeklyview,\n defaultSortDirection: 'desc',\n canSetDirection: true,\n shownInSortBar: true,\n shownInURL: true,\n handledBySearchService: true,\n searchServiceKey: 'week',\n displayName: 'Weekly views',\n urlNames: ['week'],\n },\n [SortField.title]: {\n field: SortField.title,\n defaultSortDirection: 'asc',\n canSetDirection: true,\n shownInSortBar: true,\n shownInURL: true,\n handledBySearchService: true,\n searchServiceKey: 'titleSorter',\n displayName: 'Title',\n urlNames: ['title', 'titleSorter'],\n },\n [SortField.date]: {\n field: SortField.date,\n defaultSortDirection: 'desc',\n canSetDirection: true,\n shownInSortBar: true,\n shownInURL: true,\n handledBySearchService: true,\n searchServiceKey: 'date',\n displayName: 'Date published',\n urlNames: ['date'],\n },\n [SortField.datearchived]: {\n field: SortField.datearchived,\n defaultSortDirection: 'desc',\n canSetDirection: true,\n shownInSortBar: true,\n shownInURL: true,\n handledBySearchService: true,\n searchServiceKey: 'publicdate',\n displayName: 'Date archived',\n urlNames: ['publicdate'],\n },\n [SortField.datereviewed]: {\n field: SortField.datereviewed,\n defaultSortDirection: 'desc',\n canSetDirection: true,\n shownInSortBar: true,\n shownInURL: true,\n handledBySearchService: true,\n searchServiceKey: 'reviewdate',\n displayName: 'Date reviewed',\n urlNames: ['reviewdate'],\n },\n [SortField.dateadded]: {\n field: SortField.dateadded,\n defaultSortDirection: 'desc',\n canSetDirection: true,\n shownInSortBar: true,\n shownInURL: true,\n handledBySearchService: true,\n searchServiceKey: 'addeddate',\n displayName: 'Date added',\n urlNames: ['addeddate'],\n },\n [SortField.datefavorited]: {\n field: SortField.datefavorited,\n defaultSortDirection: 'desc',\n canSetDirection: false,\n shownInSortBar: true, // But only when viewing fav-* collections\n shownInURL: false,\n handledBySearchService: false,\n searchServiceKey: 'favoritedate',\n displayName: 'Date favorited',\n urlNames: ['favoritedate'],\n },\n [SortField.creator]: {\n field: SortField.creator,\n defaultSortDirection: 'asc',\n canSetDirection: true,\n shownInSortBar: true,\n shownInURL: true,\n handledBySearchService: true,\n searchServiceKey: 'creatorSorter',\n displayName: 'Creator',\n urlNames: ['creator', 'creatorSorter'],\n },\n};\n\n/**\n * Returns the SortOption corresponding to the given API sort name, or\n * the \"unrecognized\" SortOption if none matches.\n */\nexport function sortOptionFromAPIString(sortName?: string | null): SortOption {\n return (\n Object.values(SORT_OPTIONS).find(opt =>\n opt.urlNames.some(name => sortName === name),\n ) ?? SORT_OPTIONS[SortField.unrecognized]\n );\n}\n\nexport const defaultProfileElementSorts: Record<\n string,\n Exclude<SortField, SortField.default>\n> = {\n uploads: SortField.datearchived,\n reviews: SortField.datereviewed,\n collections: SortField.datearchived,\n web_archives: SortField.datearchived,\n};\n\n/** A union of the fields that permit prefix filtering (e.g., alphabetical filtering) */\nexport type PrefixFilterType = 'title' | 'creator';\n\n/** A map from prefixes (e.g., initial letters) to the number of items matching that prefix */\nexport type PrefixFilterCounts = Record<string, number>;\n\n/**\n * A map from prefix filter types to the corresponding aggregation keys\n * that are needed to fetch the filter counts from the backend.\n */\nexport const prefixFilterAggregationKeys: Record<PrefixFilterType, string> = {\n title: 'firstTitle',\n creator: 'firstCreator',\n};\n\n/**\n * Different facet loading strategies that can be used with collection browser.\n * - `eager`: Facet data is always loaded as soon as a search is performed\n * - `lazy-mobile`: In the desktop layout, functions exactly as `eager`.\n * In the mobile layout, facet data will only be loaded once the \"Filters\" accordion is opened.\n * - `opt-in-or-login`: Same as `opt-in` for guest users not logged into an account, but same as `eager` for\n * any logged in user.\n * - `opt-in`: In the desktop layout, facet data will only be loaded after the user presses a \"Load Facets\" button.\n * In the mobile layout, functions exactly as `lazy-mobile`.\n * - `off`: Facet data will never be loaded, and a message will be displayed in place of facets\n * indicating that they are unavailable.\n */\nexport type FacetLoadStrategy =\n | 'eager'\n | 'lazy-mobile'\n | 'opt-in-or-login'\n | 'opt-in'\n | 'off';\n\n/**\n * Union of the facet types that are available in the sidebar.\n */\nexport type FacetOption =\n | 'subject'\n | 'lending'\n | 'mediatype'\n | 'language'\n | 'creator'\n | 'collection'\n | 'year'\n // TV-specific facet options:\n | 'program'\n | 'person'\n | 'sponsor';\n\nexport type SelectedFacetState = 'selected' | 'hidden';\n\nexport type FacetState = SelectedFacetState | 'none';\n\nexport interface FacetBucket {\n key: string;\n count: number;\n state: FacetState;\n // for some facets, we augment the key with a display value\n displayText?: string;\n // for TV channel facets, we add a parenthesized secondary name\n extraNote?: string;\n}\n\nexport interface FacetGroup {\n title: string;\n key: FacetOption;\n buckets: FacetBucket[];\n}\n\n/**\n * Information about a user interaction event on a facet.\n */\nexport type FacetEventDetails = {\n /**\n * The type of facet that was interacted with (e.g., 'mediatype', 'language', ...).\n */\n facetType: FacetOption;\n /**\n * The bucket corresponding to the facet that was interacted with, including the\n * updated state of the facet after the interaction.\n */\n bucket: FacetBucket;\n /**\n * Whether the interaction occurred on a negative facet.\n */\n negative: boolean;\n};\n\nexport type FacetValue = string;\n\nexport type SelectedFacets = Partial<\n Record<FacetOption, Record<FacetValue, FacetBucket>>\n>;\n\nexport const getDefaultSelectedFacets = (): Required<SelectedFacets> => ({\n subject: {},\n lending: {},\n mediatype: {},\n language: {},\n creator: {},\n collection: {},\n year: {},\n program: {},\n person: {},\n sponsor: {},\n});\n\n/**\n * For TV search results, what types of TV clips to restrict the results to.\n */\nexport type TvClipFilterType = 'all' | 'commercials' | 'factchecks' | 'quotes';\n\n/**\n * Map from TV clip filter types to their corresponding URL params\n */\nexport const tvClipFiltersToURLParams: Record<TvClipFilterType, string> = {\n all: '',\n commercials: 'only_commercials',\n factchecks: 'only_factchecks',\n quotes: 'only_quotes',\n};\n\n/**\n * Map from allowed TV filtering parameters in the URL to their corresponding filter type\n */\nexport const tvClipURLParamsToFilters: Record<string, TvClipFilterType> = {\n only_commercials: 'commercials',\n only_factchecks: 'factchecks',\n only_quotes: 'quotes',\n};\n\n/**\n * Facet display order when presenting results for all search types *except* TV (see below).\n */\nexport const defaultFacetDisplayOrder: FacetOption[] = [\n 'mediatype',\n // 'lending', Commenting this out removes the lending facet from the sidebar for now\n 'year',\n 'subject',\n 'collection',\n 'creator',\n 'language',\n];\n\n/**\n * Specialized facet ordering when displaying TV search results\n */\nexport const tvFacetDisplayOrder: FacetOption[] = [\n 'program',\n 'creator',\n 'year',\n 'subject',\n 'collection',\n 'person',\n 'sponsor',\n 'language',\n];\n\n/**\n * Human-readable titles for each facet group.\n */\nexport const facetTitles: Record<FacetOption, string> = {\n subject: 'Subject',\n lending: 'Availability',\n mediatype: 'Media Type',\n language: 'Language',\n creator: 'Creator',\n collection: 'Collection',\n year: 'Year',\n program: 'Program',\n person: 'Person',\n sponsor: 'Sponsor',\n};\n\n/**\n * The default sort type to use for each facet type\n */\nexport const defaultFacetSort: Record<FacetOption, AggregationSortType> = {\n subject: AggregationSortType.COUNT,\n lending: AggregationSortType.COUNT,\n mediatype: AggregationSortType.COUNT,\n language: AggregationSortType.COUNT,\n creator: AggregationSortType.COUNT,\n collection: AggregationSortType.COUNT,\n year: AggregationSortType.NUMERIC, // Year facets are ordered by their numeric value by default\n program: AggregationSortType.COUNT,\n person: AggregationSortType.COUNT,\n sponsor: AggregationSortType.COUNT,\n};\n\n/**\n * The sort type corresponding to facet bucket values, for each facet type\n * (i.e., the opposite of \"sort by count\" for that type).\n */\nexport const valueFacetSort: Record<FacetOption, AggregationSortType> = {\n subject: AggregationSortType.ALPHABETICAL,\n lending: AggregationSortType.ALPHABETICAL,\n mediatype: AggregationSortType.ALPHABETICAL,\n language: AggregationSortType.ALPHABETICAL,\n creator: AggregationSortType.ALPHABETICAL,\n collection: AggregationSortType.ALPHABETICAL,\n year: AggregationSortType.NUMERIC, // Year facets' values should be compared numerically, not lexicographically (year 2001 > year 3)\n program: AggregationSortType.ALPHABETICAL,\n person: AggregationSortType.ALPHABETICAL,\n sponsor: AggregationSortType.ALPHABETICAL,\n};\n\nexport type LendingFacetKey =\n | 'is_lendable'\n | 'is_borrowable'\n | 'available_to_borrow'\n | 'is_browsable'\n | 'available_to_browse'\n | 'is_readable'\n | 'available_to_waitlist';\n\n/**\n * Maps valid lending keys to whether they should be visible in the facet sidebar\n */\nexport const lendingFacetKeysVisibility: Record<LendingFacetKey, boolean> = {\n is_lendable: true,\n is_borrowable: false,\n available_to_borrow: true,\n is_browsable: false,\n available_to_browse: false,\n is_readable: true,\n available_to_waitlist: false,\n};\n\n/**\n * Maps valid, visible lending keys to their facet sidebar display text\n */\nexport const lendingFacetDisplayNames: Partial<\n Record<LendingFacetKey, string>\n> = {\n is_lendable: 'Lending Library',\n available_to_borrow: 'Borrow 14 Days',\n is_readable: 'Always Available',\n};\n\n/**\n * A record of which admin-only collections should be suppressed from being displayed\n * as facets or in an item's list of collections.\n */\nexport const suppressedCollections: Record<string, boolean> = {\n deemphasize: true,\n community: true,\n stream_only: true,\n samples_only: true,\n test_collection: true,\n printdisabled: true,\n 'openlibrary-ol': true,\n nationalemergencylibrary: true,\n china: true,\n americana: true,\n toronto: true,\n};\n\n/**\n * A record of manageable item\n */\nexport interface ManageableItem {\n identifier: string;\n title?: string;\n dateStr?: string;\n date?: string;\n}\n\n/**\n * Possible states for whether & how the user has overridden their user preference\n * for blurring behavior on tiles with sensitive content.\n * - `no-override`: The user has not overridden their user preference, so simply\n * respect the preference as given.\n * - `on`: The user has overridden their preference and wants tile blurring enabled.\n * - `off`: The user has overridden their preference and wants tile blurring disabled.\n */\nexport type TileBlurOverrideState = 'no-override' | 'on' | 'off';\n"]}
@@ -150,13 +150,13 @@ let ItemTile = class ItemTile extends BaseTileComponent {
150
150
  var _a;
151
151
  if (!((_a = this.model) === null || _a === void 0 ? void 0 : _a.review))
152
152
  return nothing;
153
- const { title, body, stars } = this.model.review;
153
+ const { reviewtitle, reviewbody, stars } = this.model.review;
154
154
  return html `
155
155
  <review-block
156
156
  viewsize="grid"
157
- .title=${title}
158
- .body=${body}
159
- .starRating=${stars}
157
+ title=${ifDefined(reviewtitle)}
158
+ body=${ifDefined(reviewbody)}
159
+ starRating=${ifDefined(stars)}
160
160
  >
161
161
  </review-block>
162
162
  `;
@@ -1 +1 @@
1
- {"version":3,"file":"item-tile.js","sourceRoot":"","sources":["../../../../src/tiles/grid/item-tile.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAkB,IAAI,EAAE,OAAO,EAAkB,MAAM,KAAK,CAAC;AACzE,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAGpC,OAAO,EAAc,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,EAAE,2BAA2B,EAAE,MAAM,iCAAiC,CAAC;AAC9E,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAElE,OAAO,gBAAgB,CAAC;AACxB,OAAO,iBAAiB,CAAC;AACzB,OAAO,uBAAuB,CAAC;AAC/B,OAAO,eAAe,CAAC;AACvB,OAAO,wBAAwB,CAAC;AAChC,OAAO,cAAc,CAAC;AAIf,IAAM,QAAQ,GAAd,MAAM,QAAS,SAAQ,iBAAiB;IAAxC;QACL;;;;;;;;;;;;;;WAcG;;QAE0B,mBAAc,GAAG,KAAK,CAAC;QAEvB,gBAAW,GAAG,KAAK,CAAC;QAErB,qBAAgB,GAAqB,MAAM,CAAC;IAuS1E,CAAC;IArSC,MAAM;;QACJ,MAAM,SAAS,GAAG,MAAA,IAAI,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CAAC;IACxC,CAAC;IAEO,iBAAiB,CAAC,CAAe;QACvC,CAAC,CAAC,cAAc,EAAE,CAAC;QACnB,MAAM,KAAK,GAAG,IAAI,WAAW,CAC3B,mBAAmB,EACnB,EAAE,MAAM,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,EAAE,CAAC,CAAC,OAAO,EAAE,EAAE,CAC3C,CAAC;QACF,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;IAC5B,CAAC;IAED;;OAEG;IACH,MAAM,KAAK,MAAM;QACf,MAAM,eAAe,GAAG,GAAG,CAAA,iCAAiC,CAAC;QAE7D,OAAO;YACL,cAAc;YACd,GAAG,CAAA;;;;;;;;;;8BAUqB,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA8CtC;SACF,CAAC;IACJ,CAAC;CACF,CAAA;AA3S8B;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;gDAAwB;AAEvB;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;6CAAqB;AAErB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;kDAA6C;AArB7D,QAAQ;IADpB,aAAa,CAAC,WAAW,CAAC;GACd,QAAQ,CA4TpB","sourcesContent":["import { css, CSSResultGroup, html, nothing, TemplateResult } from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { map } from 'lit/directives/map.js';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { msg } from '@lit/localize';\n\nimport type { SortParam } from '@internetarchive/search-service';\nimport { DateFormat, formatDate } from '../../utils/format-date';\nimport { isFirstMillisecondOfUTCYear } from '../../utils/local-date-from-utc';\nimport { BaseTileComponent } from '../base-tile-component';\nimport { baseTileStyles } from './styles/tile-grid-shared-styles';\n\nimport '../image-block';\nimport '../review-block';\nimport '../text-snippet-block';\nimport '../item-image';\nimport '../tile-mediatype-icon';\nimport './tile-stats';\nimport { SimpleLayoutType } from '../models';\n\n@customElement('item-tile')\nexport class ItemTile extends BaseTileComponent {\n /*\n * Reactive properties inherited from BaseTileComponent:\n * - model?: TileModel;\n * - currentWidth?: number;\n * - currentHeight?: number;\n * - baseNavigationUrl?: string;\n * - baseImageUrl?: string;\n * - collectionPagePath?: string;\n * - sortParam: SortParam | null = null;\n * - defaultSortParam: SortParam | null = null;\n * - creatorFilter?: string;\n * - mobileBreakpoint?: number;\n * - loggedIn = false;\n * - suppressBlurring = false;\n */\n\n @property({ type: Boolean }) showInfoButton = false;\n\n @property({ type: Boolean }) showTvClips = false;\n\n @property({ type: String }) simpleLayoutType: SimpleLayoutType = 'none';\n\n render() {\n const itemTitle = this.model?.title;\n const containerClasses = classMap({\n container: true,\n simple: this.simpleLayoutType !== 'none',\n 'stats-only': this.simpleLayoutType === 'stats-only',\n 'snippets-only': this.simpleLayoutType === 'snippets-only',\n });\n\n return html`\n <div class=${containerClasses}>\n ${this.infoButtonTemplate}\n <div class=\"tile-details\">\n <div class=\"item-info\">\n ${this.imageBlockTemplate}\n\n <div id=\"title\">\n <h4 class=\"truncated\" title=${ifDefined(itemTitle)}>\n ${itemTitle}\n </h4>\n </div>\n\n ${this.volumeIssueTemplate}\n ${this.isSortedByDate\n ? this.sortedDateInfoTemplate\n : this.creatorTemplate}\n ${this.webArchivesCaptureDatesTemplate} ${this.textSnippetsTemplate}\n ${this.reviewBlockTemplate}\n </div>\n\n ${this.tileStatsTemplate}\n </div>\n </div>\n `;\n }\n\n /**\n * Templates\n */\n private get creatorTemplate(): TemplateResult | typeof nothing {\n const displayedCreator =\n this.displayValueProvider.firstCreatorMatchingFilter;\n if (!displayedCreator) return nothing;\n\n return html`\n <div class=\"created-by\">\n <span class=\"truncated\" title=${displayedCreator}>\n by&nbsp;${displayedCreator}\n </span>\n </div>\n `;\n }\n\n private get imageBlockTemplate(): TemplateResult {\n return html`\n <image-block\n .model=${this.model}\n .baseImageUrl=${this.baseImageUrl}\n .loggedIn=${this.loggedIn}\n .suppressBlurring=${this.suppressBlurring}\n .isCompactTile=${false}\n .isListTile=${false}\n .viewSize=${'grid'}\n >\n </image-block>\n `;\n }\n\n private get sortedDateInfoTemplate() {\n let sortedValue;\n let format: DateFormat = 'long';\n switch (this.effectiveSort?.field) {\n case 'date': {\n const datePublished = this.model?.datePublished;\n sortedValue = { field: 'published', value: datePublished };\n if (isFirstMillisecondOfUTCYear(datePublished)) {\n format = 'year-only';\n }\n break;\n }\n case 'reviewdate':\n sortedValue = { field: 'reviewed', value: this.model?.dateReviewed };\n break;\n case 'addeddate':\n sortedValue = { field: 'added', value: this.model?.dateAdded };\n break;\n case 'publicdate':\n sortedValue = { field: 'archived', value: this.model?.dateArchived };\n break;\n default:\n break;\n }\n\n if (!sortedValue?.value) {\n return nothing;\n }\n return html`\n <div class=\"date-sorted-by truncated\">\n <span>\n ${sortedValue?.field} ${formatDate(sortedValue?.value, format)}\n </span>\n </div>\n `;\n }\n\n private get infoButtonTemplate(): TemplateResult | typeof nothing {\n // &#9432; is an information icon\n return this.showInfoButton\n ? html`<button class=\"info-button\" @click=${this.infoButtonPressed}>\n &#9432;\n <span class=\"sr-only\">${msg('More info')}</span>\n </button>`\n : nothing;\n }\n\n private get reviewBlockTemplate(): TemplateResult | typeof nothing {\n if (!this.model?.review) return nothing;\n\n const { title, body, stars } = this.model.review;\n return html`\n <review-block\n viewsize=\"grid\"\n .title=${title}\n .body=${body}\n .starRating=${stars}\n >\n </review-block>\n `;\n }\n\n private get textSnippetsTemplate(): TemplateResult | typeof nothing {\n if (!this.hasSnippets || this.simpleLayoutType === 'stats-only')\n return nothing;\n\n return html`\n <text-snippet-block viewsize=\"grid\" .snippets=${this.model?.snippets}>\n </text-snippet-block>\n `;\n }\n\n private get volumeIssueTemplate(): TemplateResult | typeof nothing {\n if (!this.model?.volume || !this.model?.issue) return nothing;\n\n return html`\n <div class=\"volume-issue\">\n <span class=\"truncated\" title=\"volume|issue\">\n Volume&nbsp;${this.model?.volume}, Issue&nbsp;${this.model?.issue}\n </span>\n </div>\n `;\n }\n\n private get webArchivesCaptureDatesTemplate():\n | TemplateResult\n | typeof nothing {\n if (!this.model?.captureDates || !this.model.title) return nothing;\n\n return html`\n <ul class=\"capture-dates\">\n ${map(\n this.model.captureDates,\n date =>\n html`<li>\n ${this.displayValueProvider.webArchivesCaptureLink(\n this.model!.title,\n date,\n )}\n </li>`,\n )}\n </ul>\n `;\n }\n\n /**\n * Template for the stats row along the bottom of the tile.\n */\n private get tileStatsTemplate(): TemplateResult | typeof nothing {\n if (this.simpleLayoutType === 'snippets-only') return nothing;\n\n const effectiveSort = this.sortParam ?? this.defaultSortParam;\n const [viewCount, viewLabel] =\n effectiveSort?.field === 'week'\n ? [this.model?.weeklyViewCount, 'weekly views']\n : [this.model?.viewCount, 'all-time views'];\n\n return html`\n <tile-stats\n .model=${this.model}\n .mediatype=${this.model?.mediatype}\n .viewCount=${viewCount}\n .viewLabel=${viewLabel}\n .favCount=${this.model?.favCount}\n .commentCount=${this.model?.commentCount}\n .tvClipCount=${this.model?.tvClipCount}\n .showTvClips=${this.showTvClips}\n >\n </tile-stats>\n `;\n }\n\n private get isSortedByDate(): boolean {\n return ['date', 'reviewdate', 'addeddate', 'publicdate'].includes(\n this.effectiveSort?.field as string,\n );\n }\n\n /**\n * Returns the active sort param if one is set, or the default sort param otherwise.\n */\n private get effectiveSort(): SortParam | null {\n return this.sortParam ?? this.defaultSortParam;\n }\n\n private get hasSnippets(): boolean {\n return !!this.model?.snippets?.length;\n }\n\n private infoButtonPressed(e: PointerEvent): void {\n e.preventDefault();\n const event = new CustomEvent<{ x: number; y: number }>(\n 'infoButtonPressed',\n { detail: { x: e.clientX, y: e.clientY } },\n );\n this.dispatchEvent(event);\n }\n\n /**\n * CSS\n */\n static get styles(): CSSResultGroup {\n const tileBorderColor = css`var(--tileBorderColor, #dddddd)`;\n\n return [\n baseTileStyles,\n css`\n a:link {\n text-decoration: none;\n color: var(--ia-theme-link-color, #4b64ff);\n }\n a:hover {\n text-decoration: underline;\n }\n\n .container {\n border: 1px solid ${tileBorderColor};\n }\n\n .simple #title > .truncated {\n -webkit-line-clamp: 2;\n }\n\n .simple .created-by > .truncated,\n .simple .date-sorted-by > .truncated,\n .simple .volume-issue > .truncated {\n -webkit-line-clamp: 1;\n }\n\n .simple.snippets-only .item-info {\n padding-bottom: 5px;\n }\n\n .simple.snippets-only text-snippet-block {\n margin-top: auto; /* Force the snippets to the bottom of the tile */\n }\n\n .capture-dates {\n margin: 0;\n padding: 0 5px;\n list-style-type: none;\n }\n\n review-block,\n text-snippet-block {\n --containerLeftMargin: 5px;\n --containerTopMargin: 5px;\n }\n\n /**\n * iOS Safari long-press on tiles (to bring up hover pane)\n * gets messy without this\n */\n @media screen and (pointer: coarse) and (hover: none) {\n .container {\n -webkit-touch-callout: none;\n }\n\n .truncated {\n -webkit-touch-callout: default;\n }\n }\n `,\n ];\n }\n}\n"]}
1
+ {"version":3,"file":"item-tile.js","sourceRoot":"","sources":["../../../../src/tiles/grid/item-tile.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAkB,IAAI,EAAE,OAAO,EAAkB,MAAM,KAAK,CAAC;AACzE,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAGpC,OAAO,EAAc,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,EAAE,2BAA2B,EAAE,MAAM,iCAAiC,CAAC;AAC9E,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EA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AE,IAAI,EAAE,MAAM,EAAE,CAAC;kDAA6C;AArB7D,QAAQ;IADpB,aAAa,CAAC,WAAW,CAAC;GACd,QAAQ,CA4TpB","sourcesContent":["import { css, CSSResultGroup, html, nothing, TemplateResult } from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { map } from 'lit/directives/map.js';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { msg } from '@lit/localize';\n\nimport type { SortParam } from '@internetarchive/search-service';\nimport { DateFormat, formatDate } from '../../utils/format-date';\nimport { isFirstMillisecondOfUTCYear } from '../../utils/local-date-from-utc';\nimport { BaseTileComponent } from '../base-tile-component';\nimport { baseTileStyles } from './styles/tile-grid-shared-styles';\n\nimport '../image-block';\nimport '../review-block';\nimport '../text-snippet-block';\nimport '../item-image';\nimport '../tile-mediatype-icon';\nimport './tile-stats';\nimport { SimpleLayoutType } from '../models';\n\n@customElement('item-tile')\nexport class ItemTile extends BaseTileComponent {\n /*\n * Reactive properties inherited from BaseTileComponent:\n * - model?: TileModel;\n * - currentWidth?: number;\n * - currentHeight?: number;\n * - baseNavigationUrl?: string;\n * - baseImageUrl?: string;\n * - collectionPagePath?: string;\n * - sortParam: SortParam | null = null;\n * - defaultSortParam: SortParam | null = null;\n * - creatorFilter?: string;\n * - mobileBreakpoint?: number;\n * - loggedIn = false;\n * - suppressBlurring = false;\n */\n\n @property({ type: Boolean }) showInfoButton = false;\n\n @property({ type: Boolean }) showTvClips = false;\n\n @property({ type: String }) simpleLayoutType: SimpleLayoutType = 'none';\n\n render() {\n const itemTitle = this.model?.title;\n const containerClasses = classMap({\n container: true,\n simple: this.simpleLayoutType !== 'none',\n 'stats-only': this.simpleLayoutType === 'stats-only',\n 'snippets-only': this.simpleLayoutType === 'snippets-only',\n });\n\n return html`\n <div class=${containerClasses}>\n ${this.infoButtonTemplate}\n <div class=\"tile-details\">\n <div class=\"item-info\">\n ${this.imageBlockTemplate}\n\n <div id=\"title\">\n <h4 class=\"truncated\" title=${ifDefined(itemTitle)}>\n ${itemTitle}\n </h4>\n </div>\n\n ${this.volumeIssueTemplate}\n ${this.isSortedByDate\n ? this.sortedDateInfoTemplate\n : this.creatorTemplate}\n ${this.webArchivesCaptureDatesTemplate} ${this.textSnippetsTemplate}\n ${this.reviewBlockTemplate}\n </div>\n\n ${this.tileStatsTemplate}\n </div>\n </div>\n `;\n }\n\n /**\n * Templates\n */\n private get creatorTemplate(): TemplateResult | typeof nothing {\n const displayedCreator =\n this.displayValueProvider.firstCreatorMatchingFilter;\n if (!displayedCreator) return nothing;\n\n return html`\n <div class=\"created-by\">\n <span class=\"truncated\" title=${displayedCreator}>\n by&nbsp;${displayedCreator}\n </span>\n </div>\n `;\n }\n\n private get imageBlockTemplate(): TemplateResult {\n return html`\n <image-block\n .model=${this.model}\n .baseImageUrl=${this.baseImageUrl}\n .loggedIn=${this.loggedIn}\n .suppressBlurring=${this.suppressBlurring}\n .isCompactTile=${false}\n .isListTile=${false}\n .viewSize=${'grid'}\n >\n </image-block>\n `;\n }\n\n private get sortedDateInfoTemplate() {\n let sortedValue;\n let format: DateFormat = 'long';\n switch (this.effectiveSort?.field) {\n case 'date': {\n const datePublished = this.model?.datePublished;\n sortedValue = { field: 'published', value: datePublished };\n if (isFirstMillisecondOfUTCYear(datePublished)) {\n format = 'year-only';\n }\n break;\n }\n case 'reviewdate':\n sortedValue = { field: 'reviewed', value: this.model?.dateReviewed };\n break;\n case 'addeddate':\n sortedValue = { field: 'added', value: this.model?.dateAdded };\n break;\n case 'publicdate':\n sortedValue = { field: 'archived', value: this.model?.dateArchived };\n break;\n default:\n break;\n }\n\n if (!sortedValue?.value) {\n return nothing;\n }\n return html`\n <div class=\"date-sorted-by truncated\">\n <span>\n ${sortedValue?.field} ${formatDate(sortedValue?.value, format)}\n </span>\n </div>\n `;\n }\n\n private get infoButtonTemplate(): TemplateResult | typeof nothing {\n // &#9432; is an information icon\n return this.showInfoButton\n ? html`<button class=\"info-button\" @click=${this.infoButtonPressed}>\n &#9432;\n <span class=\"sr-only\">${msg('More info')}</span>\n </button>`\n : nothing;\n }\n\n private get reviewBlockTemplate(): TemplateResult | typeof nothing {\n if (!this.model?.review) return nothing;\n\n const { reviewtitle, reviewbody, stars } = this.model.review;\n return html`\n <review-block\n viewsize=\"grid\"\n title=${ifDefined(reviewtitle)}\n body=${ifDefined(reviewbody)}\n starRating=${ifDefined(stars)}\n >\n </review-block>\n `;\n }\n\n private get textSnippetsTemplate(): TemplateResult | typeof nothing {\n if (!this.hasSnippets || this.simpleLayoutType === 'stats-only')\n return nothing;\n\n return html`\n <text-snippet-block viewsize=\"grid\" .snippets=${this.model?.snippets}>\n </text-snippet-block>\n `;\n }\n\n private get volumeIssueTemplate(): TemplateResult | typeof nothing {\n if (!this.model?.volume || !this.model?.issue) return nothing;\n\n return html`\n <div class=\"volume-issue\">\n <span class=\"truncated\" title=\"volume|issue\">\n Volume&nbsp;${this.model?.volume}, Issue&nbsp;${this.model?.issue}\n </span>\n </div>\n `;\n }\n\n private get webArchivesCaptureDatesTemplate():\n | TemplateResult\n | typeof nothing {\n if (!this.model?.captureDates || !this.model.title) return nothing;\n\n return html`\n <ul class=\"capture-dates\">\n ${map(\n this.model.captureDates,\n date =>\n html`<li>\n ${this.displayValueProvider.webArchivesCaptureLink(\n this.model!.title,\n date,\n )}\n </li>`,\n )}\n </ul>\n `;\n }\n\n /**\n * Template for the stats row along the bottom of the tile.\n */\n private get tileStatsTemplate(): TemplateResult | typeof nothing {\n if (this.simpleLayoutType === 'snippets-only') return nothing;\n\n const effectiveSort = this.sortParam ?? this.defaultSortParam;\n const [viewCount, viewLabel] =\n effectiveSort?.field === 'week'\n ? [this.model?.weeklyViewCount, 'weekly views']\n : [this.model?.viewCount, 'all-time views'];\n\n return html`\n <tile-stats\n .model=${this.model}\n .mediatype=${this.model?.mediatype}\n .viewCount=${viewCount}\n .viewLabel=${viewLabel}\n .favCount=${this.model?.favCount}\n .commentCount=${this.model?.commentCount}\n .tvClipCount=${this.model?.tvClipCount}\n .showTvClips=${this.showTvClips}\n >\n </tile-stats>\n `;\n }\n\n private get isSortedByDate(): boolean {\n return ['date', 'reviewdate', 'addeddate', 'publicdate'].includes(\n this.effectiveSort?.field as string,\n );\n }\n\n /**\n * Returns the active sort param if one is set, or the default sort param otherwise.\n */\n private get effectiveSort(): SortParam | null {\n return this.sortParam ?? this.defaultSortParam;\n }\n\n private get hasSnippets(): boolean {\n return !!this.model?.snippets?.length;\n }\n\n private infoButtonPressed(e: PointerEvent): void {\n e.preventDefault();\n const event = new CustomEvent<{ x: number; y: number }>(\n 'infoButtonPressed',\n { detail: { x: e.clientX, y: e.clientY } },\n );\n this.dispatchEvent(event);\n }\n\n /**\n * CSS\n */\n static get styles(): CSSResultGroup {\n const tileBorderColor = css`var(--tileBorderColor, #dddddd)`;\n\n return [\n baseTileStyles,\n css`\n a:link {\n text-decoration: none;\n color: var(--ia-theme-link-color, #4b64ff);\n }\n a:hover {\n text-decoration: underline;\n }\n\n .container {\n border: 1px solid ${tileBorderColor};\n }\n\n .simple #title > .truncated {\n -webkit-line-clamp: 2;\n }\n\n .simple .created-by > .truncated,\n .simple .date-sorted-by > .truncated,\n .simple .volume-issue > .truncated {\n -webkit-line-clamp: 1;\n }\n\n .simple.snippets-only .item-info {\n padding-bottom: 5px;\n }\n\n .simple.snippets-only text-snippet-block {\n margin-top: auto; /* Force the snippets to the bottom of the tile */\n }\n\n .capture-dates {\n margin: 0;\n padding: 0 5px;\n list-style-type: none;\n }\n\n review-block,\n text-snippet-block {\n --containerLeftMargin: 5px;\n --containerTopMargin: 5px;\n }\n\n /**\n * iOS Safari long-press on tiles (to bring up hover pane)\n * gets messy without this\n */\n @media screen and (pointer: coarse) and (hover: none) {\n .container {\n -webkit-touch-callout: none;\n }\n\n .truncated {\n -webkit-touch-callout: default;\n }\n }\n `,\n ];\n }\n}\n"]}
@@ -257,13 +257,13 @@ let TileList = class TileList extends BaseTileComponent {
257
257
  var _a;
258
258
  if (!((_a = this.model) === null || _a === void 0 ? void 0 : _a.review))
259
259
  return nothing;
260
- const { title, body, stars } = this.model.review;
260
+ const { reviewtitle, reviewbody, stars } = this.model.review;
261
261
  return html `
262
262
  <review-block
263
263
  viewsize="list"
264
- .title=${title}
265
- .body=${body}
266
- .starRating=${stars}
264
+ title=${ifDefined(reviewtitle)}
265
+ body=${ifDefined(reviewbody)}
266
+ starRating=${ifDefined(stars)}
267
267
  >
268
268
  </review-block>
269
269
  `;
@@ -1 +1 @@
1
- {"version":3,"file":"tile-list.js","sourceRoot":"","sources":["../../../../src/tiles/list/tile-list.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAkC,MAAM,KAAK,CAAC;AACzE,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAC9C,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AACpC,OAAO,SAAS,MAAM,WAAW,CAAC;AAGlC,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAErD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAE3D,OAAO,EAAE,WAAW,EAAgB,MAAM,0BAA0B,CAAC;AACrE,OAAO,EAAE,UAAU,EAAc,MAAM,yBAAyB,CAAC;AACjE,OAAO,EAAE,2BAA2B,EAAE,MAAM,iCAAiC,CAAC;AAE9E,OAAO,gBAAgB,CAAC;AACxB,OAAO,iBAAiB,CAAC;AACzB,OAAO,uBAAuB,CAAC;AAC/B,OAAO,wBAAwB,CAAC;AAGzB,IAAM,QAAQ,GAAd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,CAAC;QAClB,CAAC;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,IAAY,UAAU;QACpB,IACE,IAAI,CAAC,gBAAgB;YACrB,IAAI,CAAC,YAAY;YACjB,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,gBAAgB,EACzC,CAAC;YACD,OAAO,OAAO,CAAC;QACjB,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,MAAM,KAAK,MAAM;QACf,OAAO,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAwLT,CAAC;IACJ,CAAC;CACF,CAAA;AAroBC;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;kDACS;AAEnB;IAAhB,KAAK,EAAE;iDAAmE;AApBhE,QAAQ;IADpB,aAAa,CAAC,WAAW,CAAC;GACd,QAAQ,CAupBpB","sourcesContent":["import { css, html, nothing, PropertyValues, TemplateResult } from 'lit';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { join } from 'lit/directives/join.js';\nimport { map } from 'lit/directives/map.js';\nimport { unsafeHTML } from 'lit/directives/unsafe-html.js';\nimport { customElement, property, state } from 'lit/decorators.js';\nimport { msg } from '@lit/localize';\nimport DOMPurify from 'dompurify';\n\nimport type { SortParam } from '@internetarchive/search-service';\nimport { suppressedCollections } from '../../models';\nimport type { CollectionTitles } from '../../data-source/models';\nimport { BaseTileComponent } from '../base-tile-component';\n\nimport { formatCount, NumberFormat } from '../../utils/format-count';\nimport { formatDate, DateFormat } from '../../utils/format-date';\nimport { isFirstMillisecondOfUTCYear } from '../../utils/local-date-from-utc';\n\nimport '../image-block';\nimport '../review-block';\nimport '../text-snippet-block';\nimport '../tile-mediatype-icon';\n\n@customElement('tile-list')\nexport class TileList extends BaseTileComponent {\n /*\n * Reactive properties inherited from BaseTileComponent:\n * - model?: TileModel;\n * - currentWidth?: number;\n * - currentHeight?: number;\n * - baseNavigationUrl?: string;\n * - baseImageUrl?: string;\n * - collectionPagePath?: string;\n * - sortParam: SortParam | null = null;\n * - defaultSortParam: SortParam | null = null;\n * - creatorFilter?: string;\n * - mobileBreakpoint?: number;\n * - loggedIn = false;\n * - suppressBlurring = false;\n */\n\n @property({ type: Object })\n collectionTitles?: CollectionTitles;\n\n @state() private collectionLinks: (TemplateResult | typeof nothing)[] = [];\n\n render() {\n return html`\n <div id=\"list-line\" class=\"${this.classSize}\">\n ${this.classSize === 'mobile'\n ? this.mobileTemplate\n : this.desktopTemplate}\n </div>\n `;\n }\n\n /**\n * Templates\n */\n private get mobileTemplate() {\n return html`\n <div id=\"list-line-top\">\n <div id=\"list-line-left\">${this.imageBlockTemplate}</div>\n <div id=\"list-line-right\">\n <div id=\"title-line\">\n <div id=\"title\">${this.titleTemplate}</div>\n ${this.iconRightTemplate}\n </div>\n </div>\n </div>\n <div id=\"list-line-bottom\">${this.detailsTemplate}</div>\n `;\n }\n\n private get desktopTemplate() {\n return html`\n <div id=\"list-line-left\">${this.imageBlockTemplate}</div>\n <div id=\"list-line-right\">\n <div id=\"title-line\">\n <div id=\"title\">${this.titleTemplate}</div>\n ${this.iconRightTemplate}\n </div>\n ${this.detailsTemplate}\n </div>\n `;\n }\n\n private get imageBlockTemplate() {\n if (!this.model) return nothing;\n\n const isCollection = this.model.mediatype === 'collection';\n const href = this.displayValueProvider.itemPageUrl(\n this.model.identifier,\n isCollection,\n );\n\n return html`<a href=${href}>\n <image-block\n .model=${this.model}\n .baseImageUrl=${this.baseImageUrl}\n .isCompactTile=${false}\n .isListTile=${true}\n .viewSize=${this.classSize}\n .loggedIn=${this.loggedIn}\n .suppressBlurring=${this.suppressBlurring}\n >\n </image-block>\n </a> `;\n }\n\n private get detailsTemplate() {\n return html`\n ${this.itemLineTemplate} ${this.creatorTemplate}\n <div id=\"dates-line\">\n ${this.datePublishedTemplate} ${this.dateSortByTemplate}\n ${this.webArchivesCaptureDatesTemplate}\n </div>\n <div id=\"views-line\">\n ${this.viewsTemplate} ${this.ratingTemplate} ${this.reviewsTemplate}\n </div>\n ${this.topicsTemplate} ${this.collectionsTemplate}\n ${this.descriptionTemplate} ${this.textSnippetsTemplate}\n ${this.reviewBlockTemplate}\n `;\n }\n\n // Data templates\n private get iconRightTemplate() {\n return html`\n <a id=\"icon-right\" href=${this.mediatypeURL}>\n <tile-mediatype-icon .model=${this.model}> </tile-mediatype-icon>\n </a>\n `;\n }\n\n private get titleTemplate() {\n if (!this.model?.title) {\n return nothing;\n }\n\n // If the model has a server-specified href, use it\n // Otherwise construct a details link using the identifier\n return this.model?.href\n ? html`<a href=\"${this.baseNavigationUrl}${this.model.href}\"\n >${this.model.title ?? this.model.identifier}</a\n >`\n : this.detailsLink(\n this.model.identifier,\n this.model.title,\n this.model.mediatype === 'collection',\n );\n }\n\n private get itemLineTemplate() {\n const source = this.sourceTemplate;\n const volume = this.volumeTemplate;\n const issue = this.issueTemplate;\n if (!source && !volume && !issue) {\n return nothing;\n }\n return html` <div id=\"item-line\">${source} ${volume} ${issue}</div> `;\n }\n\n private get sourceTemplate() {\n if (!this.model?.source) {\n return nothing;\n }\n return html`\n <div id=\"source\" class=\"metadata\">\n ${this.labelTemplate(msg('Source'))}\n ${this.searchLink('source', this.model.source)}\n </div>\n `;\n }\n\n private get volumeTemplate() {\n return this.metadataTemplate(this.model?.volume, msg('Volume'));\n }\n\n private get issueTemplate() {\n return this.metadataTemplate(this.model?.issue, msg('Issue'));\n }\n\n private get creatorTemplate() {\n // \"Archivist since\" if account\n if (this.model?.mediatype === 'account') {\n return html`\n <div id=\"creator\" class=\"metadata\">\n <span class=\"label\"\n >${this.displayValueProvider.accountLabel ?? nothing}</span\n >\n </div>\n `;\n }\n // \"Creator\" if not account tile\n if (!this.model?.creators || this.model.creators.length === 0) {\n return nothing;\n }\n return html`\n <div id=\"creator\" class=\"metadata\">\n ${this.labelTemplate(msg('By'))}\n ${join(\n map(this.model.creators, id => this.searchLink('creator', id)),\n ', ',\n )}\n </div>\n `;\n }\n\n private get datePublishedTemplate() {\n // If we're showing a date published of Jan 1 at midnight, only show the year.\n // This is because items with only a year for their publication date are normalized to\n // Jan 1 at midnight timestamps in the search engine documents.\n const date: Date | undefined = this.model?.datePublished;\n let format: DateFormat = 'long';\n if (isFirstMillisecondOfUTCYear(date)) {\n format = 'year-only';\n }\n\n return this.metadataTemplate(formatDate(date, format), msg('Published'));\n }\n\n // Show date label/value when sorted by date type\n // Except datePublished which is always shown\n private get dateSortByTemplate() {\n if (\n this.effectiveSort &&\n (this.effectiveSort.field === 'addeddate' ||\n this.effectiveSort.field === 'reviewdate' ||\n this.effectiveSort.field === 'publicdate')\n ) {\n return this.metadataTemplate(\n formatDate(this.date, 'long'),\n this.displayValueProvider.dateLabel,\n );\n }\n return nothing;\n }\n\n private get viewsTemplate() {\n const viewCount =\n this.effectiveSort?.field === 'week'\n ? this.model?.weeklyViewCount // weekly views\n : this.model?.viewCount; // all-time views\n if (viewCount == null) return nothing;\n\n // when its a search-tile, we don't have any stats to show\n if (this.model?.mediatype === 'search') {\n return this.metadataTemplate('(Favorited search query)', '');\n }\n\n return this.metadataTemplate(\n `${formatCount(viewCount, this.formatSize)}`,\n msg('Views'),\n );\n }\n\n private get ratingTemplate() {\n return this.metadataTemplate(this.model?.averageRating, msg('Avg Rating'));\n }\n\n private get reviewsTemplate() {\n return this.metadataTemplate(this.model?.commentCount, msg('Reviews'));\n }\n\n private get topicsTemplate() {\n if (!this.model?.subjects || this.model.subjects.length === 0) {\n return nothing;\n }\n return html`\n <div id=\"topics\" class=\"metadata\">\n ${this.labelTemplate(msg('Topics'))}\n ${join(\n map(this.model.subjects, id => this.searchLink('subject', id)),\n ', ',\n )}\n </div>\n `;\n }\n\n private get collectionsTemplate() {\n if (!this.collectionLinks || this.collectionLinks.length === 0) {\n return nothing;\n }\n return html`\n <div id=\"collections\" class=\"metadata\">\n ${this.labelTemplate(msg('Collections'))}\n ${join(this.collectionLinks, ', ')}\n </div>\n `;\n }\n\n private get descriptionTemplate() {\n return this.metadataTemplate(\n // Sanitize away any HTML tags and convert line breaks to spaces.\n unsafeHTML(\n DOMPurify.sanitize(this.model?.description?.replace(/\\n/g, ' ') ?? ''),\n ),\n '',\n 'description',\n );\n }\n\n private get reviewBlockTemplate(): TemplateResult | typeof nothing {\n if (!this.model?.review) return nothing;\n\n const { title, body, stars } = this.model.review;\n return html`\n <review-block\n viewsize=\"list\"\n .title=${title}\n .body=${body}\n .starRating=${stars}\n >\n </review-block>\n `;\n }\n\n private get textSnippetsTemplate(): TemplateResult | typeof nothing {\n if (!this.hasSnippets) return nothing;\n\n return html`<text-snippet-block\n viewsize=\"list\"\n .snippets=${this.model?.snippets}\n ></text-snippet-block>`;\n }\n\n private get hasSnippets(): boolean {\n return !!this.model?.snippets?.length;\n }\n\n private get webArchivesCaptureDatesTemplate():\n | TemplateResult\n | typeof nothing {\n if (!this.model?.captureDates || !this.model.title) return nothing;\n\n return html`\n <ul class=\"capture-dates\">\n ${map(\n this.model.captureDates,\n date =>\n html`<li>\n ${this.displayValueProvider.webArchivesCaptureLink(\n this.model!.title,\n date,\n )}\n </li>`,\n )}\n </ul>\n `;\n }\n\n // Utility functions\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n private metadataTemplate(text: any, label = '', id?: string) {\n if (!text) return nothing;\n return html`\n <div id=${ifDefined(id)} class=\"metadata\">\n ${this.labelTemplate(label)} ${text}\n </div>\n `;\n }\n\n private labelTemplate(label: string) {\n return html` ${label\n ? html`<span class=\"label\">${label}: </span>`\n : nothing}`;\n }\n\n private searchLink(field: string, searchTerm: string) {\n if (!field || !searchTerm) {\n return nothing;\n }\n const query = encodeURIComponent(`${field}:\"${searchTerm}\"`);\n // No whitespace after closing tag\n // Note: single ' for href='' to wrap \" in query var gets changed back by yarn format\n return html`<a\n href=\"${this.baseNavigationUrl}/search?query=${query}\"\n rel=\"nofollow\"\n >\n ${DOMPurify.sanitize(searchTerm)}</a\n >`;\n }\n\n private detailsLink(\n identifier?: string,\n text?: string,\n isCollection = false,\n ): TemplateResult | typeof nothing {\n if (!identifier) return nothing;\n\n const linkText = text ?? identifier;\n const linkHref = this.displayValueProvider.itemPageUrl(\n identifier,\n isCollection,\n );\n\n return html`<a href=${linkHref}> ${DOMPurify.sanitize(linkText)} </a>`;\n }\n\n /** The URL of this item's mediatype collection, if defined. */\n private get mediatypeURL(): string | typeof nothing {\n // NB: baseNavigationUrl can be an empty string\n if (this.baseNavigationUrl === undefined || !this.model?.mediatype)\n return nothing;\n\n // Need special handling for certain mediatypes that don't have a top-level collection page\n switch (this.model.mediatype) {\n case 'collection':\n return `${this.baseNavigationUrl}/search?query=mediatype:collection&sort=-downloads`;\n case 'account':\n return nothing;\n default:\n return this.displayValueProvider.itemPageUrl(\n this.model.mediatype,\n true,\n );\n }\n }\n\n protected updated(changed: PropertyValues): void {\n if (changed.has('model') || changed.has('collectionTitles')) {\n this.buildCollectionLinks();\n }\n }\n\n private async buildCollectionLinks() {\n if (!this.model?.collections || this.model.collections.length === 0) {\n return;\n }\n\n // Note: quirk of Lit: need to replace collectionLinks array,\n // otherwise it will not re-render. Can't simply alter the array.\n this.collectionLinks = [];\n const newCollectionLinks: (TemplateResult | typeof nothing)[] = [];\n for (const collection of this.model.collections) {\n // Don't include favorites or collections that are meant to be suppressed\n if (\n !suppressedCollections[collection] &&\n !collection.startsWith('fav-')\n ) {\n newCollectionLinks.push(\n this.detailsLink(\n collection,\n this.collectionTitles?.get(collection) ?? collection,\n true,\n ),\n );\n }\n }\n this.collectionLinks = newCollectionLinks;\n }\n\n /*\n * TODO: fix field names to match model in src/collection-browser.ts\n * private get dateSortSelector()\n * @see src/models.ts\n */\n private get date(): Date | undefined {\n switch (this.effectiveSort?.field) {\n case 'date':\n return this.model?.datePublished;\n case 'reviewdate':\n return this.model?.dateReviewed;\n case 'addeddate':\n return this.model?.dateAdded;\n default:\n return this.model?.dateArchived; // publicdate\n }\n }\n\n /**\n * Returns the active sort param if one is set, or the default sort param otherwise.\n */\n private get effectiveSort(): SortParam | null {\n return this.sortParam ?? this.defaultSortParam;\n }\n\n private get classSize(): string {\n if (\n this.mobileBreakpoint &&\n this.currentWidth &&\n this.currentWidth < this.mobileBreakpoint\n ) {\n return 'mobile';\n }\n return 'desktop';\n }\n\n private get formatSize(): NumberFormat {\n if (\n this.mobileBreakpoint &&\n this.currentWidth &&\n this.currentWidth < this.mobileBreakpoint\n ) {\n return 'short';\n }\n return 'long';\n }\n\n static get styles() {\n return css`\n html {\n font-size: unset;\n }\n\n div {\n font-size: 14px;\n }\n\n div a {\n text-decoration: none;\n }\n\n div a:link {\n color: var(--ia-theme-link-color, #4b64ff);\n }\n\n .label {\n font-weight: bold;\n }\n\n #list-line.mobile {\n --infiniteScrollerRowGap: 20px;\n --infiniteScrollerRowHeight: auto;\n }\n\n #list-line.desktop {\n --infiniteScrollerRowGap: 30px;\n --infiniteScrollerRowHeight: auto;\n }\n\n /* fields */\n #icon-right {\n width: 20px;\n padding-top: 5px;\n --iconHeight: 20px;\n --iconWidth: 20px;\n --iconTextAlign: right;\n margin-top: -8px;\n text-align: right;\n }\n\n #title {\n color: #4b64ff;\n text-decoration: none;\n font-size: 22px;\n font-weight: bold;\n /* align top of text with image */\n line-height: 25px;\n margin-top: -4px;\n padding-bottom: 2px;\n flex-grow: 1;\n\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 3;\n overflow: hidden;\n overflow-wrap: anywhere;\n }\n\n .metadata {\n line-height: 20px;\n }\n\n #description,\n #creator,\n #topics,\n #source {\n text-align: left;\n overflow: hidden;\n text-overflow: ellipsis;\n -webkit-box-orient: vertical;\n display: -webkit-box;\n word-break: break-word;\n -webkit-line-clamp: 3; /* number of lines to show */\n line-clamp: 3;\n\n /*\n * Safari doesn't always respect the line-clamping rules above,\n * so we add this to ensure these fields still get truncated\n */\n max-height: 60px;\n }\n\n #collections {\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 3;\n overflow: hidden;\n overflow-wrap: anywhere;\n }\n\n #collections > a {\n display: inline-block;\n }\n\n #icon {\n padding-top: 5px;\n }\n\n #description {\n padding-top: 10px;\n }\n\n /* Top level container */\n #list-line {\n display: flex;\n }\n\n #list-line.mobile {\n flex-direction: column;\n }\n\n #list-line.desktop {\n column-gap: 10px;\n }\n\n #list-line-top {\n display: flex;\n column-gap: 7px;\n }\n\n #list-line-bottom {\n padding-top: 4px;\n }\n\n #list-line-right,\n #list-line-top,\n #list-line-bottom {\n width: 100%;\n }\n\n /*\n * If the container becomes very tiny, don't let the thumbnail side take\n * up too much space. Shouldn't make a difference on ordinary viewport sizes.\n */\n #list-line-left {\n max-width: 25%;\n\n display: flex;\n flex-direction: column;\n row-gap: 5px;\n }\n\n div a:hover {\n text-decoration: underline;\n }\n\n /* Lines containing multiple div as row */\n #item-line,\n #dates-line,\n #views-line,\n #title-line {\n display: flex;\n flex-direction: row;\n column-gap: 10px;\n }\n\n /*\n * With the exception of the title line, allow these to wrap if\n * the space becomes too small to accommodate them together.\n *\n * The title line is excluded because it contains the mediatype icon\n * which we don't want to wrap.\n */\n #item-line,\n #dates-line,\n #views-line {\n flex-wrap: wrap;\n }\n\n .capture-dates {\n margin: 0;\n padding: 0;\n list-style-type: none;\n }\n\n .capture-dates a:link {\n text-decoration: none;\n color: var(--ia-theme-link-color, #4b64ff);\n }\n .capture-dates a:hover {\n text-decoration: underline;\n }\n `;\n }\n}\n"]}
1
+ {"version":3,"file":"tile-list.js","sourceRoot":"","sources":["../../../../src/tiles/list/tile-list.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAkC,MAAM,KAAK,CAAC;AACzE,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAwLT,CAAC;IACJ,CAAC;CACF,CAAA;AAroBC;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;kDACS;AAEnB;IAAhB,KAAK,EAAE;iDAAmE;AApBhE,QAAQ;IADpB,aAAa,CAAC,WAAW,CAAC;GACd,QAAQ,CAupBpB","sourcesContent":["import { css, html, nothing, PropertyValues, TemplateResult } from 'lit';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { join } from 'lit/directives/join.js';\nimport { map } from 'lit/directives/map.js';\nimport { unsafeHTML } from 'lit/directives/unsafe-html.js';\nimport { customElement, property, state } from 'lit/decorators.js';\nimport { msg } from '@lit/localize';\nimport DOMPurify from 'dompurify';\n\nimport type { SortParam } from '@internetarchive/search-service';\nimport { suppressedCollections } from '../../models';\nimport type { CollectionTitles } from '../../data-source/models';\nimport { BaseTileComponent } from '../base-tile-component';\n\nimport { formatCount, NumberFormat } from '../../utils/format-count';\nimport { formatDate, DateFormat } from '../../utils/format-date';\nimport { isFirstMillisecondOfUTCYear } from '../../utils/local-date-from-utc';\n\nimport '../image-block';\nimport '../review-block';\nimport '../text-snippet-block';\nimport '../tile-mediatype-icon';\n\n@customElement('tile-list')\nexport class TileList extends BaseTileComponent {\n /*\n * Reactive properties inherited from BaseTileComponent:\n * - model?: TileModel;\n * - currentWidth?: number;\n * - currentHeight?: number;\n * - baseNavigationUrl?: string;\n * - baseImageUrl?: string;\n * - collectionPagePath?: string;\n * - sortParam: SortParam | null = null;\n * - defaultSortParam: SortParam | null = null;\n * - creatorFilter?: string;\n * - mobileBreakpoint?: number;\n * - loggedIn = false;\n * - suppressBlurring = false;\n */\n\n @property({ type: Object })\n collectionTitles?: CollectionTitles;\n\n @state() private collectionLinks: (TemplateResult | typeof nothing)[] = [];\n\n render() {\n return html`\n <div id=\"list-line\" class=\"${this.classSize}\">\n ${this.classSize === 'mobile'\n ? this.mobileTemplate\n : this.desktopTemplate}\n </div>\n `;\n }\n\n /**\n * Templates\n */\n private get mobileTemplate() {\n return html`\n <div id=\"list-line-top\">\n <div id=\"list-line-left\">${this.imageBlockTemplate}</div>\n <div id=\"list-line-right\">\n <div id=\"title-line\">\n <div id=\"title\">${this.titleTemplate}</div>\n ${this.iconRightTemplate}\n </div>\n </div>\n </div>\n <div id=\"list-line-bottom\">${this.detailsTemplate}</div>\n `;\n }\n\n private get desktopTemplate() {\n return html`\n <div id=\"list-line-left\">${this.imageBlockTemplate}</div>\n <div id=\"list-line-right\">\n <div id=\"title-line\">\n <div id=\"title\">${this.titleTemplate}</div>\n ${this.iconRightTemplate}\n </div>\n ${this.detailsTemplate}\n </div>\n `;\n }\n\n private get imageBlockTemplate() {\n if (!this.model) return nothing;\n\n const isCollection = this.model.mediatype === 'collection';\n const href = this.displayValueProvider.itemPageUrl(\n this.model.identifier,\n isCollection,\n );\n\n return html`<a href=${href}>\n <image-block\n .model=${this.model}\n .baseImageUrl=${this.baseImageUrl}\n .isCompactTile=${false}\n .isListTile=${true}\n .viewSize=${this.classSize}\n .loggedIn=${this.loggedIn}\n .suppressBlurring=${this.suppressBlurring}\n >\n </image-block>\n </a> `;\n }\n\n private get detailsTemplate() {\n return html`\n ${this.itemLineTemplate} ${this.creatorTemplate}\n <div id=\"dates-line\">\n ${this.datePublishedTemplate} ${this.dateSortByTemplate}\n ${this.webArchivesCaptureDatesTemplate}\n </div>\n <div id=\"views-line\">\n ${this.viewsTemplate} ${this.ratingTemplate} ${this.reviewsTemplate}\n </div>\n ${this.topicsTemplate} ${this.collectionsTemplate}\n ${this.descriptionTemplate} ${this.textSnippetsTemplate}\n ${this.reviewBlockTemplate}\n `;\n }\n\n // Data templates\n private get iconRightTemplate() {\n return html`\n <a id=\"icon-right\" href=${this.mediatypeURL}>\n <tile-mediatype-icon .model=${this.model}> </tile-mediatype-icon>\n </a>\n `;\n }\n\n private get titleTemplate() {\n if (!this.model?.title) {\n return nothing;\n }\n\n // If the model has a server-specified href, use it\n // Otherwise construct a details link using the identifier\n return this.model?.href\n ? html`<a href=\"${this.baseNavigationUrl}${this.model.href}\"\n >${this.model.title ?? this.model.identifier}</a\n >`\n : this.detailsLink(\n this.model.identifier,\n this.model.title,\n this.model.mediatype === 'collection',\n );\n }\n\n private get itemLineTemplate() {\n const source = this.sourceTemplate;\n const volume = this.volumeTemplate;\n const issue = this.issueTemplate;\n if (!source && !volume && !issue) {\n return nothing;\n }\n return html` <div id=\"item-line\">${source} ${volume} ${issue}</div> `;\n }\n\n private get sourceTemplate() {\n if (!this.model?.source) {\n return nothing;\n }\n return html`\n <div id=\"source\" class=\"metadata\">\n ${this.labelTemplate(msg('Source'))}\n ${this.searchLink('source', this.model.source)}\n </div>\n `;\n }\n\n private get volumeTemplate() {\n return this.metadataTemplate(this.model?.volume, msg('Volume'));\n }\n\n private get issueTemplate() {\n return this.metadataTemplate(this.model?.issue, msg('Issue'));\n }\n\n private get creatorTemplate() {\n // \"Archivist since\" if account\n if (this.model?.mediatype === 'account') {\n return html`\n <div id=\"creator\" class=\"metadata\">\n <span class=\"label\"\n >${this.displayValueProvider.accountLabel ?? nothing}</span\n >\n </div>\n `;\n }\n // \"Creator\" if not account tile\n if (!this.model?.creators || this.model.creators.length === 0) {\n return nothing;\n }\n return html`\n <div id=\"creator\" class=\"metadata\">\n ${this.labelTemplate(msg('By'))}\n ${join(\n map(this.model.creators, id => this.searchLink('creator', id)),\n ', ',\n )}\n </div>\n `;\n }\n\n private get datePublishedTemplate() {\n // If we're showing a date published of Jan 1 at midnight, only show the year.\n // This is because items with only a year for their publication date are normalized to\n // Jan 1 at midnight timestamps in the search engine documents.\n const date: Date | undefined = this.model?.datePublished;\n let format: DateFormat = 'long';\n if (isFirstMillisecondOfUTCYear(date)) {\n format = 'year-only';\n }\n\n return this.metadataTemplate(formatDate(date, format), msg('Published'));\n }\n\n // Show date label/value when sorted by date type\n // Except datePublished which is always shown\n private get dateSortByTemplate() {\n if (\n this.effectiveSort &&\n (this.effectiveSort.field === 'addeddate' ||\n this.effectiveSort.field === 'reviewdate' ||\n this.effectiveSort.field === 'publicdate')\n ) {\n return this.metadataTemplate(\n formatDate(this.date, 'long'),\n this.displayValueProvider.dateLabel,\n );\n }\n return nothing;\n }\n\n private get viewsTemplate() {\n const viewCount =\n this.effectiveSort?.field === 'week'\n ? this.model?.weeklyViewCount // weekly views\n : this.model?.viewCount; // all-time views\n if (viewCount == null) return nothing;\n\n // when its a search-tile, we don't have any stats to show\n if (this.model?.mediatype === 'search') {\n return this.metadataTemplate('(Favorited search query)', '');\n }\n\n return this.metadataTemplate(\n `${formatCount(viewCount, this.formatSize)}`,\n msg('Views'),\n );\n }\n\n private get ratingTemplate() {\n return this.metadataTemplate(this.model?.averageRating, msg('Avg Rating'));\n }\n\n private get reviewsTemplate() {\n return this.metadataTemplate(this.model?.commentCount, msg('Reviews'));\n }\n\n private get topicsTemplate() {\n if (!this.model?.subjects || this.model.subjects.length === 0) {\n return nothing;\n }\n return html`\n <div id=\"topics\" class=\"metadata\">\n ${this.labelTemplate(msg('Topics'))}\n ${join(\n map(this.model.subjects, id => this.searchLink('subject', id)),\n ', ',\n )}\n </div>\n `;\n }\n\n private get collectionsTemplate() {\n if (!this.collectionLinks || this.collectionLinks.length === 0) {\n return nothing;\n }\n return html`\n <div id=\"collections\" class=\"metadata\">\n ${this.labelTemplate(msg('Collections'))}\n ${join(this.collectionLinks, ', ')}\n </div>\n `;\n }\n\n private get descriptionTemplate() {\n return this.metadataTemplate(\n // Sanitize away any HTML tags and convert line breaks to spaces.\n unsafeHTML(\n DOMPurify.sanitize(this.model?.description?.replace(/\\n/g, ' ') ?? ''),\n ),\n '',\n 'description',\n );\n }\n\n private get reviewBlockTemplate(): TemplateResult | typeof nothing {\n if (!this.model?.review) return nothing;\n\n const { reviewtitle, reviewbody, stars } = this.model.review;\n return html`\n <review-block\n viewsize=\"list\"\n title=${ifDefined(reviewtitle)}\n body=${ifDefined(reviewbody)}\n starRating=${ifDefined(stars)}\n >\n </review-block>\n `;\n }\n\n private get textSnippetsTemplate(): TemplateResult | typeof nothing {\n if (!this.hasSnippets) return nothing;\n\n return html`<text-snippet-block\n viewsize=\"list\"\n .snippets=${this.model?.snippets}\n ></text-snippet-block>`;\n }\n\n private get hasSnippets(): boolean {\n return !!this.model?.snippets?.length;\n }\n\n private get webArchivesCaptureDatesTemplate():\n | TemplateResult\n | typeof nothing {\n if (!this.model?.captureDates || !this.model.title) return nothing;\n\n return html`\n <ul class=\"capture-dates\">\n ${map(\n this.model.captureDates,\n date =>\n html`<li>\n ${this.displayValueProvider.webArchivesCaptureLink(\n this.model!.title,\n date,\n )}\n </li>`,\n )}\n </ul>\n `;\n }\n\n // Utility functions\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n private metadataTemplate(text: any, label = '', id?: string) {\n if (!text) return nothing;\n return html`\n <div id=${ifDefined(id)} class=\"metadata\">\n ${this.labelTemplate(label)} ${text}\n </div>\n `;\n }\n\n private labelTemplate(label: string) {\n return html` ${label\n ? html`<span class=\"label\">${label}: </span>`\n : nothing}`;\n }\n\n private searchLink(field: string, searchTerm: string) {\n if (!field || !searchTerm) {\n return nothing;\n }\n const query = encodeURIComponent(`${field}:\"${searchTerm}\"`);\n // No whitespace after closing tag\n // Note: single ' for href='' to wrap \" in query var gets changed back by yarn format\n return html`<a\n href=\"${this.baseNavigationUrl}/search?query=${query}\"\n rel=\"nofollow\"\n >\n ${DOMPurify.sanitize(searchTerm)}</a\n >`;\n }\n\n private detailsLink(\n identifier?: string,\n text?: string,\n isCollection = false,\n ): TemplateResult | typeof nothing {\n if (!identifier) return nothing;\n\n const linkText = text ?? identifier;\n const linkHref = this.displayValueProvider.itemPageUrl(\n identifier,\n isCollection,\n );\n\n return html`<a href=${linkHref}> ${DOMPurify.sanitize(linkText)} </a>`;\n }\n\n /** The URL of this item's mediatype collection, if defined. */\n private get mediatypeURL(): string | typeof nothing {\n // NB: baseNavigationUrl can be an empty string\n if (this.baseNavigationUrl === undefined || !this.model?.mediatype)\n return nothing;\n\n // Need special handling for certain mediatypes that don't have a top-level collection page\n switch (this.model.mediatype) {\n case 'collection':\n return `${this.baseNavigationUrl}/search?query=mediatype:collection&sort=-downloads`;\n case 'account':\n return nothing;\n default:\n return this.displayValueProvider.itemPageUrl(\n this.model.mediatype,\n true,\n );\n }\n }\n\n protected updated(changed: PropertyValues): void {\n if (changed.has('model') || changed.has('collectionTitles')) {\n this.buildCollectionLinks();\n }\n }\n\n private async buildCollectionLinks() {\n if (!this.model?.collections || this.model.collections.length === 0) {\n return;\n }\n\n // Note: quirk of Lit: need to replace collectionLinks array,\n // otherwise it will not re-render. Can't simply alter the array.\n this.collectionLinks = [];\n const newCollectionLinks: (TemplateResult | typeof nothing)[] = [];\n for (const collection of this.model.collections) {\n // Don't include favorites or collections that are meant to be suppressed\n if (\n !suppressedCollections[collection] &&\n !collection.startsWith('fav-')\n ) {\n newCollectionLinks.push(\n this.detailsLink(\n collection,\n this.collectionTitles?.get(collection) ?? collection,\n true,\n ),\n );\n }\n }\n this.collectionLinks = newCollectionLinks;\n }\n\n /*\n * TODO: fix field names to match model in src/collection-browser.ts\n * private get dateSortSelector()\n * @see src/models.ts\n */\n private get date(): Date | undefined {\n switch (this.effectiveSort?.field) {\n case 'date':\n return this.model?.datePublished;\n case 'reviewdate':\n return this.model?.dateReviewed;\n case 'addeddate':\n return this.model?.dateAdded;\n default:\n return this.model?.dateArchived; // publicdate\n }\n }\n\n /**\n * Returns the active sort param if one is set, or the default sort param otherwise.\n */\n private get effectiveSort(): SortParam | null {\n return this.sortParam ?? this.defaultSortParam;\n }\n\n private get classSize(): string {\n if (\n this.mobileBreakpoint &&\n this.currentWidth &&\n this.currentWidth < this.mobileBreakpoint\n ) {\n return 'mobile';\n }\n return 'desktop';\n }\n\n private get formatSize(): NumberFormat {\n if (\n this.mobileBreakpoint &&\n this.currentWidth &&\n this.currentWidth < this.mobileBreakpoint\n ) {\n return 'short';\n }\n return 'long';\n }\n\n static get styles() {\n return css`\n html {\n font-size: unset;\n }\n\n div {\n font-size: 14px;\n }\n\n div a {\n text-decoration: none;\n }\n\n div a:link {\n color: var(--ia-theme-link-color, #4b64ff);\n }\n\n .label {\n font-weight: bold;\n }\n\n #list-line.mobile {\n --infiniteScrollerRowGap: 20px;\n --infiniteScrollerRowHeight: auto;\n }\n\n #list-line.desktop {\n --infiniteScrollerRowGap: 30px;\n --infiniteScrollerRowHeight: auto;\n }\n\n /* fields */\n #icon-right {\n width: 20px;\n padding-top: 5px;\n --iconHeight: 20px;\n --iconWidth: 20px;\n --iconTextAlign: right;\n margin-top: -8px;\n text-align: right;\n }\n\n #title {\n color: #4b64ff;\n text-decoration: none;\n font-size: 22px;\n font-weight: bold;\n /* align top of text with image */\n line-height: 25px;\n margin-top: -4px;\n padding-bottom: 2px;\n flex-grow: 1;\n\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 3;\n overflow: hidden;\n overflow-wrap: anywhere;\n }\n\n .metadata {\n line-height: 20px;\n }\n\n #description,\n #creator,\n #topics,\n #source {\n text-align: left;\n overflow: hidden;\n text-overflow: ellipsis;\n -webkit-box-orient: vertical;\n display: -webkit-box;\n word-break: break-word;\n -webkit-line-clamp: 3; /* number of lines to show */\n line-clamp: 3;\n\n /*\n * Safari doesn't always respect the line-clamping rules above,\n * so we add this to ensure these fields still get truncated\n */\n max-height: 60px;\n }\n\n #collections {\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 3;\n overflow: hidden;\n overflow-wrap: anywhere;\n }\n\n #collections > a {\n display: inline-block;\n }\n\n #icon {\n padding-top: 5px;\n }\n\n #description {\n padding-top: 10px;\n }\n\n /* Top level container */\n #list-line {\n display: flex;\n }\n\n #list-line.mobile {\n flex-direction: column;\n }\n\n #list-line.desktop {\n column-gap: 10px;\n }\n\n #list-line-top {\n display: flex;\n column-gap: 7px;\n }\n\n #list-line-bottom {\n padding-top: 4px;\n }\n\n #list-line-right,\n #list-line-top,\n #list-line-bottom {\n width: 100%;\n }\n\n /*\n * If the container becomes very tiny, don't let the thumbnail side take\n * up too much space. Shouldn't make a difference on ordinary viewport sizes.\n */\n #list-line-left {\n max-width: 25%;\n\n display: flex;\n flex-direction: column;\n row-gap: 5px;\n }\n\n div a:hover {\n text-decoration: underline;\n }\n\n /* Lines containing multiple div as row */\n #item-line,\n #dates-line,\n #views-line,\n #title-line {\n display: flex;\n flex-direction: row;\n column-gap: 10px;\n }\n\n /*\n * With the exception of the title line, allow these to wrap if\n * the space becomes too small to accommodate them together.\n *\n * The title line is excluded because it contains the mediatype icon\n * which we don't want to wrap.\n */\n #item-line,\n #dates-line,\n #views-line {\n flex-wrap: wrap;\n }\n\n .capture-dates {\n margin: 0;\n padding: 0;\n list-style-type: none;\n }\n\n .capture-dates a:link {\n text-decoration: none;\n color: var(--ia-theme-link-color, #4b64ff);\n }\n .capture-dates a:hover {\n text-decoration: underline;\n }\n `;\n }\n}\n"]}
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "The Internet Archive Collection Browser.",
4
4
  "license": "AGPL-3.0-only",
5
5
  "author": "Internet Archive",
6
- "version": "2.18.1",
6
+ "version": "2.18.2-webdev-7743.1",
7
7
  "main": "dist/index.js",
8
8
  "module": "dist/index.js",
9
9
  "scripts": {
@@ -32,7 +32,7 @@
32
32
  "@internetarchive/iaux-item-metadata": "^1.0.5",
33
33
  "@internetarchive/infinite-scroller": "^1.0.1",
34
34
  "@internetarchive/modal-manager": "^2.0.1",
35
- "@internetarchive/search-service": "^2.5.1",
35
+ "@internetarchive/search-service": "2.5.2-webdev-7743.0",
36
36
  "@internetarchive/shared-resize-observer": "^0.2.0",
37
37
  "@lit/localize": "^0.12.2",
38
38
  "dompurify": "^3.2.4",
package/src/models.ts CHANGED
@@ -4,7 +4,7 @@ import type { MediaType } from '@internetarchive/field-parsers';
4
4
  import {
5
5
  AggregationSortType,
6
6
  HitType,
7
- Review,
7
+ SearchReview,
8
8
  SearchResult,
9
9
  SortDirection,
10
10
  } from '@internetarchive/search-service';
@@ -120,7 +120,7 @@ export class TileModel {
120
120
 
121
121
  mediatype: MediaType;
122
122
 
123
- review?: Review;
123
+ review?: SearchReview;
124
124
 
125
125
  source?: string;
126
126
 
@@ -161,13 +161,13 @@ export class ItemTile extends BaseTileComponent {
161
161
  private get reviewBlockTemplate(): TemplateResult | typeof nothing {
162
162
  if (!this.model?.review) return nothing;
163
163
 
164
- const { title, body, stars } = this.model.review;
164
+ const { reviewtitle, reviewbody, stars } = this.model.review;
165
165
  return html`
166
166
  <review-block
167
167
  viewsize="grid"
168
- .title=${title}
169
- .body=${body}
170
- .starRating=${stars}
168
+ title=${ifDefined(reviewtitle)}
169
+ body=${ifDefined(reviewbody)}
170
+ starRating=${ifDefined(stars)}
171
171
  >
172
172
  </review-block>
173
173
  `;
@@ -304,13 +304,13 @@ export class TileList extends BaseTileComponent {
304
304
  private get reviewBlockTemplate(): TemplateResult | typeof nothing {
305
305
  if (!this.model?.review) return nothing;
306
306
 
307
- const { title, body, stars } = this.model.review;
307
+ const { reviewtitle, reviewbody, stars } = this.model.review;
308
308
  return html`
309
309
  <review-block
310
310
  viewsize="list"
311
- .title=${title}
312
- .body=${body}
313
- .starRating=${stars}
311
+ title=${ifDefined(reviewtitle)}
312
+ body=${ifDefined(reviewbody)}
313
+ starRating=${ifDefined(stars)}
314
314
  >
315
315
  </review-block>
316
316
  `;