@internetarchive/collection-browser 1.5.3-alpha.1 → 1.7.0
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.
- package/dist/src/collection-browser.d.ts +2 -1
- package/dist/src/collection-browser.js +4 -0
- package/dist/src/collection-browser.js.map +1 -1
- package/dist/src/models.js.map +1 -1
- package/dist/src/tiles/list/tile-list.js +7 -3
- package/dist/src/tiles/list/tile-list.js.map +1 -1
- package/dist/test/mocks/mock-search-responses.js +135 -45
- package/dist/test/mocks/mock-search-responses.js.map +1 -1
- package/package.json +3 -3
- package/src/collection-browser.ts +4 -0
- package/src/models.ts +1 -1
- package/src/tiles/list/tile-list.ts +7 -3
- package/test/mocks/mock-search-responses.ts +135 -45
package/dist/src/models.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"models.js","sourceRoot":"","sources":["../../src/models.ts"],"names":[],"mappings":"AACA,OAAO,EACL,mBAAmB,GAEpB,MAAM,iCAAiC,CAAC;AAiDzC;;GAEG;AACH,MAAM,CAAN,IAAY,SAWX;AAXD,WAAY,SAAS;IACnB,gCAAqB,CAAA;IACrB,oCAAyB,CAAA;IACzB,wCAA6B,CAAA;IAC7B,sCAA2B,CAAA;IAC3B,4BAAiB,CAAA;IACjB,0BAAe,CAAA;IACf,0CAA+B,CAAA;IAC/B,0CAA+B,CAAA;IAC/B,oCAAyB,CAAA;IACzB,gCAAqB,CAAA;AACvB,CAAC,EAXW,SAAS,KAAT,SAAS,QAWpB;AAoBD,MAAM,CAAC,MAAM,oBAAoB,GAE7B;IACF,OAAO,EAAE,EAAE;IACX,SAAS,EAAE,WAAW;IACtB,WAAW,EAAE,gBAAgB;IAC7B,UAAU,EAAE,cAAc;IAC1B,KAAK,EAAE,OAAO;IACd,IAAI,EAAE,gBAAgB;IACtB,YAAY,EAAE,eAAe;IAC7B,YAAY,EAAE,eAAe;IAC7B,SAAS,EAAE,YAAY;IACvB,OAAO,EAAE,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X,SAAS,EAAE,IAAI;IACf,OAAO,EAAE,IAAI;CACd,CAAC","sourcesContent":["import type { MediaType } from '@internetarchive/field-parsers';\nimport {\n AggregationSortType,\n SortDirection,\n} from '@internetarchive/search-service';\n\nexport interface TileModel {\n averageRating?: number;\n collectionIdentifier?: string;\n collectionName?: string;\n collectionFilesCount: number;\n collections: string[];\n collectionSize: number;\n commentCount: number;\n creator?: string;\n creators: string[];\n dateAdded?: Date; // Date added to public search (software-defined) [from: addeddate]\n dateArchived?: Date; // Date archived (software-defined) item created on archive.org [from: publicdate]\n datePublished?: Date; // Date work published in the world (user-defined) [from: date]\n dateReviewed?: Date; // Date reviewed (user-created) most recent review [from: reviewdate]\n description?: string;\n favCount: number;\n href?: string;\n identifier: string;\n issue?: string;\n itemCount: number;\n mediatype: MediaType;\n source?: string;\n snippets?: string[];\n subjects: string[];\n title: string;\n viewCount: number;\n volume?: string;\n weeklyViewCount?: number;\n loginRequired: boolean;\n contentWarning: boolean;\n}\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, etc).\n */\nexport type CollectionBrowserContext = 'collection' | 'search';\n\n/**\n * The sort fields shown in the sort filter bar\n */\nexport enum SortField {\n 'default' = 'default',\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 'creator' = 'creator',\n}\n\n/**\n * The metadata fields we sort by that map to the SortFields above\n */\nexport type MetadataSortField =\n | 'downloads'\n | 'week'\n | 'titleSorter'\n | 'date'\n | 'creatorSorter'\n | 'publicdate'\n | 'reviewdate'\n | 'addeddate';\n\n/**\n * All sort strings recognized in search URLs\n */\nexport type URLSortField = MetadataSortField | 'title' | 'creator';\n\nexport const SortFieldDisplayName: {\n [key in SortField]: string;\n} = {\n default: '', // Use the default sorting option for the current page context, if none has been selected\n relevance: 'Relevance',\n alltimeview: 'All-time views',\n weeklyview: 'Weekly views',\n title: 'Title',\n date: 'Date published',\n datearchived: 'Date archived',\n datereviewed: 'Date reviewed',\n dateadded: 'Date added',\n creator: 'Creator',\n};\n\nexport const DefaultSortDirection: {\n [key in SortField]: SortDirection | null;\n} = {\n default: null,\n relevance: null, // Can't actually change the sort direction for relevance\n alltimeview: 'desc',\n weeklyview: 'desc',\n title: 'asc',\n date: 'desc',\n datearchived: 'desc',\n datereviewed: 'desc',\n dateadded: 'desc',\n creator: 'asc',\n};\n\n/**\n * Maps the SortField above to the corresponding Metadata field in the API.\n */\nexport const SortFieldToMetadataField: {\n [key in SortField]: MetadataSortField | null;\n} = {\n default: null,\n relevance: null,\n alltimeview: 'downloads',\n weeklyview: 'week',\n title: 'titleSorter',\n date: 'date',\n datearchived: 'publicdate',\n datereviewed: 'reviewdate',\n dateadded: 'addeddate',\n creator: 'creatorSorter',\n};\n\n/**\n * Maps the Metadata field to the corresponding SortField field in the API.\n */\nexport const MetadataFieldToSortField: {\n [key in MetadataSortField]: SortField;\n} = {\n week: SortField.weeklyview,\n downloads: SortField.alltimeview,\n titleSorter: SortField.title,\n date: SortField.date,\n publicdate: SortField.datearchived,\n reviewdate: SortField.datereviewed,\n addeddate: SortField.dateadded,\n creatorSorter: SortField.creator,\n};\n\n/**\n * Maps the Metadata fields to how they should be presented in URLs.\n */\nexport const MetadataFieldToURLField: {\n [key in MetadataSortField]: URLSortField;\n} = {\n week: 'week',\n downloads: 'downloads',\n titleSorter: 'title',\n date: 'date',\n publicdate: 'publicdate',\n reviewdate: 'reviewdate',\n addeddate: 'addeddate',\n creatorSorter: 'creator',\n};\n\n/**\n * Maps all allowable sort strings from the URL to their respective\n * sort fields.\n */\nexport const URLFieldToSortField: Record<URLSortField, SortField> = {\n week: SortField.weeklyview,\n downloads: SortField.alltimeview,\n title: SortField.title,\n titleSorter: SortField.title,\n date: SortField.date,\n publicdate: SortField.datearchived,\n reviewdate: SortField.datereviewed,\n addeddate: SortField.dateadded,\n creator: SortField.creator,\n creatorSorter: SortField.creator,\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\nexport type FacetOption =\n | 'subject'\n | 'lending'\n | 'mediatype'\n | 'language'\n | 'creator'\n | 'collection'\n | 'year';\n\nexport type SelectedFacetState = 'selected' | 'hidden';\n\nexport type FacetState = SelectedFacetState | 'none';\n\nexport interface FacetBucket {\n // for some facets, we augment the key with a display value\n displayText?: string;\n key: string;\n count: number;\n state: FacetState;\n}\n\nexport interface FacetGroup {\n title: string;\n key: FacetOption;\n buckets: FacetBucket[];\n}\n\nexport type FacetEventDetails = {\n key: FacetOption;\n state: FacetState;\n negative: boolean;\n};\n\nexport type FacetValue = string;\n\nexport type SelectedFacets = Record<\n FacetOption,\n Record<FacetValue, FacetBucket>\n>;\n\nexport const getDefaultSelectedFacets = (): SelectedFacets => ({\n subject: {},\n lending: {},\n mediatype: {},\n language: {},\n creator: {},\n collection: {},\n year: {},\n});\n\nexport const facetDisplayOrder: FacetOption[] = [\n 'mediatype',\n 'lending',\n 'year',\n 'subject',\n 'collection',\n 'creator',\n 'language',\n];\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};\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,\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,\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"]}
|
|
1
|
+
{"version":3,"file":"models.js","sourceRoot":"","sources":["../../src/models.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F;;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 { MediaType } from '@internetarchive/field-parsers';\nimport {\n AggregationSortType,\n SortDirection,\n} from '@internetarchive/search-service';\n\nexport interface TileModel {\n averageRating?: number;\n collectionIdentifier?: string;\n collectionName?: string;\n collectionFilesCount: number;\n collections: string[];\n collectionSize: number;\n commentCount: number;\n creator?: string;\n creators: string[];\n dateAdded?: Date; // Date added to public search (software-defined) [from: addeddate]\n dateArchived?: Date; // Date archived (software-defined) item created on archive.org [from: publicdate]\n datePublished?: Date; // Date work published in the world (user-defined) [from: date]\n dateReviewed?: Date; // Date reviewed (user-created) most recent review [from: reviewdate]\n description?: string;\n favCount: number;\n href?: string;\n identifier: string;\n issue?: string;\n itemCount: number;\n mediatype: MediaType;\n source?: string;\n snippets?: string[];\n subjects: string[];\n title: string;\n viewCount: number;\n volume?: string;\n weeklyViewCount?: number;\n loginRequired: boolean;\n contentWarning: boolean;\n}\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, etc).\n */\nexport type CollectionBrowserContext = 'collection' | 'search';\n\n/**\n * The sort fields shown in the sort filter bar\n */\nexport enum SortField {\n 'default' = 'default',\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 'creator' = 'creator',\n}\n\n/**\n * The metadata fields we sort by that map to the SortFields above\n */\nexport type MetadataSortField =\n | 'downloads'\n | 'week'\n | 'titleSorter'\n | 'date'\n | 'creatorSorter'\n | 'publicdate'\n | 'reviewdate'\n | 'addeddate';\n\n/**\n * All sort strings recognized in search URLs\n */\nexport type URLSortField = MetadataSortField | 'title' | 'creator';\n\nexport const SortFieldDisplayName: {\n [key in SortField]: string;\n} = {\n default: '', // Use the default sorting option for the current page context, if none has been selected\n relevance: 'Relevance',\n alltimeview: 'All-time views',\n weeklyview: 'Weekly views',\n title: 'Title',\n date: 'Date published',\n datearchived: 'Date archived',\n datereviewed: 'Date reviewed',\n dateadded: 'Date added',\n creator: 'Creator',\n};\n\nexport const DefaultSortDirection: {\n [key in SortField]: SortDirection | null;\n} = {\n default: null,\n relevance: null, // Sort direction is disabled entirely for relevance sort (user can't click the button)\n alltimeview: 'desc',\n weeklyview: 'desc',\n title: 'asc',\n date: 'desc',\n datearchived: 'desc',\n datereviewed: 'desc',\n dateadded: 'desc',\n creator: 'asc',\n};\n\n/**\n * Maps the SortField above to the corresponding Metadata field in the API.\n */\nexport const SortFieldToMetadataField: {\n [key in SortField]: MetadataSortField | null;\n} = {\n default: null,\n relevance: null,\n alltimeview: 'downloads',\n weeklyview: 'week',\n title: 'titleSorter',\n date: 'date',\n datearchived: 'publicdate',\n datereviewed: 'reviewdate',\n dateadded: 'addeddate',\n creator: 'creatorSorter',\n};\n\n/**\n * Maps the Metadata field to the corresponding SortField field in the API.\n */\nexport const MetadataFieldToSortField: {\n [key in MetadataSortField]: SortField;\n} = {\n week: SortField.weeklyview,\n downloads: SortField.alltimeview,\n titleSorter: SortField.title,\n date: SortField.date,\n publicdate: SortField.datearchived,\n reviewdate: SortField.datereviewed,\n addeddate: SortField.dateadded,\n creatorSorter: SortField.creator,\n};\n\n/**\n * Maps the Metadata fields to how they should be presented in URLs.\n */\nexport const MetadataFieldToURLField: {\n [key in MetadataSortField]: URLSortField;\n} = {\n week: 'week',\n downloads: 'downloads',\n titleSorter: 'title',\n date: 'date',\n publicdate: 'publicdate',\n reviewdate: 'reviewdate',\n addeddate: 'addeddate',\n creatorSorter: 'creator',\n};\n\n/**\n * Maps all allowable sort strings from the URL to their respective\n * sort fields.\n */\nexport const URLFieldToSortField: Record<URLSortField, SortField> = {\n week: SortField.weeklyview,\n downloads: SortField.alltimeview,\n title: SortField.title,\n titleSorter: SortField.title,\n date: SortField.date,\n publicdate: SortField.datearchived,\n reviewdate: SortField.datereviewed,\n addeddate: SortField.dateadded,\n creator: SortField.creator,\n creatorSorter: SortField.creator,\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\nexport type FacetOption =\n | 'subject'\n | 'lending'\n | 'mediatype'\n | 'language'\n | 'creator'\n | 'collection'\n | 'year';\n\nexport type SelectedFacetState = 'selected' | 'hidden';\n\nexport type FacetState = SelectedFacetState | 'none';\n\nexport interface FacetBucket {\n // for some facets, we augment the key with a display value\n displayText?: string;\n key: string;\n count: number;\n state: FacetState;\n}\n\nexport interface FacetGroup {\n title: string;\n key: FacetOption;\n buckets: FacetBucket[];\n}\n\nexport type FacetEventDetails = {\n key: FacetOption;\n state: FacetState;\n negative: boolean;\n};\n\nexport type FacetValue = string;\n\nexport type SelectedFacets = Record<\n FacetOption,\n Record<FacetValue, FacetBucket>\n>;\n\nexport const getDefaultSelectedFacets = (): SelectedFacets => ({\n subject: {},\n lending: {},\n mediatype: {},\n language: {},\n creator: {},\n collection: {},\n year: {},\n});\n\nexport const facetDisplayOrder: FacetOption[] = [\n 'mediatype',\n 'lending',\n 'year',\n 'subject',\n 'collection',\n 'creator',\n 'language',\n];\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};\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,\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,\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"]}
|
|
@@ -174,7 +174,7 @@ let TileList = class TileList extends BaseTileComponent {
|
|
|
174
174
|
return html `
|
|
175
175
|
<div id="creator" class="metadata">
|
|
176
176
|
${this.labelTemplate(msg('By'))}
|
|
177
|
-
${join(map(this.model.creators, id => this.searchLink('creator', id)),
|
|
177
|
+
${join(map(this.model.creators, id => this.searchLink('creator', id)), ', ')}
|
|
178
178
|
</div>
|
|
179
179
|
`;
|
|
180
180
|
}
|
|
@@ -224,7 +224,7 @@ let TileList = class TileList extends BaseTileComponent {
|
|
|
224
224
|
return html `
|
|
225
225
|
<div id="topics" class="metadata">
|
|
226
226
|
${this.labelTemplate(msg('Topics'))}
|
|
227
|
-
${join(map(this.model.subjects, id => this.searchLink('subject', id)),
|
|
227
|
+
${join(map(this.model.subjects, id => this.searchLink('subject', id)), ', ')}
|
|
228
228
|
</div>
|
|
229
229
|
`;
|
|
230
230
|
}
|
|
@@ -235,7 +235,7 @@ let TileList = class TileList extends BaseTileComponent {
|
|
|
235
235
|
return html `
|
|
236
236
|
<div id="collections" class="metadata">
|
|
237
237
|
${this.labelTemplate(msg('Collections'))}
|
|
238
|
-
${join(this.collectionLinks,
|
|
238
|
+
${join(this.collectionLinks, ', ')}
|
|
239
239
|
</div>
|
|
240
240
|
`;
|
|
241
241
|
}
|
|
@@ -467,6 +467,10 @@ let TileList = class TileList extends BaseTileComponent {
|
|
|
467
467
|
overflow-wrap: anywhere;
|
|
468
468
|
}
|
|
469
469
|
|
|
470
|
+
#collections > a {
|
|
471
|
+
display: inline-block;
|
|
472
|
+
}
|
|
473
|
+
|
|
470
474
|
#icon {
|
|
471
475
|
padding-top: 5px;
|
|
472
476
|
}
|
|
@@ -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;AACrD,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;AA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,WAAW;gBACd,OAAO,MAAA,IAAI,CAAC,KAAK,0CAAE,SAAS,CAAC;YAC/B;gBACE,OAAO,MAAA,IAAI,CAAC,KAAK,0CAAE,YAAY,CAAC,CAAC,aAAa;SACjD;IACH,CAAC;IAED,IAAY,SAAS;QACnB,IACE,IAAI,CAAC,gBAAgB;YACrB,IAAI,CAAC,YAAY;YACjB,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,gBAAgB,EACzC;YACA,OAAO,QAAQ,CAAC;SACjB;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;YACA,OAAO,OAAO,CAAC;SAChB;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,MAAM,KAAK,MAAM;QACf,OAAO,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAsKT,CAAC;IACJ,CAAC;CACF,CAAA;AAzkBC;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;qDACwB;AAE1C;IAAR,KAAK,EAAE;iDAAgD;AAlB7C,QAAQ;IADpB,aAAa,CAAC,WAAW,CAAC;GACd,QAAQ,CAylBpB;SAzlBY,QAAQ","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 { CollectionNameCacheInterface } from '@internetarchive/collection-name-cache';\nimport { suppressedCollections } from '../../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 '../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 * - creatorFilter?: string;\n * - mobileBreakpoint?: number;\n * - loggedIn = false;\n */\n\n @property({ type: Object })\n collectionNameCache?: CollectionNameCacheInterface;\n\n @state() private collectionLinks: TemplateResult[] = [];\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 >\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 </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 `;\n }\n\n // Data templates\n private get iconRightTemplate() {\n return html`\n <a id=\"icon-right\" href=${this.mediatypeURL}>\n <mediatype-icon\n .mediatype=${this.model?.mediatype}\n .collections=${this.model?.collections}\n >\n </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 html`, `\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.sortParam &&\n (this.sortParam.field === 'addeddate' ||\n this.sortParam.field === 'reviewdate' ||\n this.sortParam.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.sortParam?.field === 'week'\n ? this.model?.weeklyViewCount // weekly views\n : this.model?.viewCount; // all-time views\n\n return this.metadataTemplate(\n `${formatCount(viewCount ?? 0, 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 html`, `\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, html`, `)}\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 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 // Utility functions\n // eslint-disable-next-line default-param-last\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\n /* eslint-disable lit/no-invalid-html */\n return html`<a\n href=\"${this.baseNavigationUrl}/search?query=${query}\"\n rel=\"nofollow\"\n >\n ${DOMPurify.sanitize(searchTerm)}</a\n >`;\n /* eslint-enable lit/no-invalid-html */\n }\n\n private detailsLink(\n identifier: string,\n text?: string,\n isCollection = false\n ): TemplateResult {\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')) {\n this.fetchCollectionNames();\n }\n }\n\n private async fetchCollectionNames() {\n if (\n !this.model?.collections ||\n this.model.collections.length === 0 ||\n !this.collectionNameCache\n ) {\n return;\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[] = [];\n const promises: Promise<void>[] = [];\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 promises.push(\n this.collectionNameCache?.collectionNameFor(collection).then(name => {\n newCollectionLinks.push(\n this.detailsLink(collection, name ?? collection, true)\n );\n })\n );\n }\n }\n await Promise.all(promises);\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.sortParam?.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 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 #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 }\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,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;AACrD,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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d,OAAO,MAAA,IAAI,CAAC,KAAK,0CAAE,SAAS,CAAC;YAC/B;gBACE,OAAO,MAAA,IAAI,CAAC,KAAK,0CAAE,YAAY,CAAC,CAAC,aAAa;SACjD;IACH,CAAC;IAED,IAAY,SAAS;QACnB,IACE,IAAI,CAAC,gBAAgB;YACrB,IAAI,CAAC,YAAY;YACjB,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,gBAAgB,EACzC;YACA,OAAO,QAAQ,CAAC;SACjB;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;YACA,OAAO,OAAO,CAAC;SAChB;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,MAAM,KAAK,MAAM;QACf,OAAO,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA0KT,CAAC;IACJ,CAAC;CACF,CAAA;AA7kBC;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;qDACwB;AAE1C;IAAR,KAAK,EAAE;iDAAgD;AAlB7C,QAAQ;IADpB,aAAa,CAAC,WAAW,CAAC;GACd,QAAQ,CA6lBpB;SA7lBY,QAAQ","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 { CollectionNameCacheInterface } from '@internetarchive/collection-name-cache';\nimport { suppressedCollections } from '../../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 '../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 * - creatorFilter?: string;\n * - mobileBreakpoint?: number;\n * - loggedIn = false;\n */\n\n @property({ type: Object })\n collectionNameCache?: CollectionNameCacheInterface;\n\n @state() private collectionLinks: TemplateResult[] = [];\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 >\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 </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 `;\n }\n\n // Data templates\n private get iconRightTemplate() {\n return html`\n <a id=\"icon-right\" href=${this.mediatypeURL}>\n <mediatype-icon\n .mediatype=${this.model?.mediatype}\n .collections=${this.model?.collections}\n >\n </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.sortParam &&\n (this.sortParam.field === 'addeddate' ||\n this.sortParam.field === 'reviewdate' ||\n this.sortParam.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.sortParam?.field === 'week'\n ? this.model?.weeklyViewCount // weekly views\n : this.model?.viewCount; // all-time views\n\n return this.metadataTemplate(\n `${formatCount(viewCount ?? 0, 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 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 // Utility functions\n // eslint-disable-next-line default-param-last\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\n /* eslint-disable lit/no-invalid-html */\n return html`<a\n href=\"${this.baseNavigationUrl}/search?query=${query}\"\n rel=\"nofollow\"\n >\n ${DOMPurify.sanitize(searchTerm)}</a\n >`;\n /* eslint-enable lit/no-invalid-html */\n }\n\n private detailsLink(\n identifier: string,\n text?: string,\n isCollection = false\n ): TemplateResult {\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')) {\n this.fetchCollectionNames();\n }\n }\n\n private async fetchCollectionNames() {\n if (\n !this.model?.collections ||\n this.model.collections.length === 0 ||\n !this.collectionNameCache\n ) {\n return;\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[] = [];\n const promises: Promise<void>[] = [];\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 promises.push(\n this.collectionNameCache?.collectionNameFor(collection).then(name => {\n newCollectionLinks.push(\n this.detailsLink(collection, name ?? collection, true)\n );\n })\n );\n }\n }\n await Promise.all(promises);\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.sortParam?.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 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 }\n}\n"]}
|
|
@@ -3,13 +3,19 @@ import { SearchServiceErrorType } from '@internetarchive/search-service/dist/src
|
|
|
3
3
|
export const getMockSuccessSingleResult = () => ({
|
|
4
4
|
success: {
|
|
5
5
|
request: {
|
|
6
|
+
kind: 'hits',
|
|
6
7
|
clientParameters: {
|
|
7
8
|
user_query: 'collection:foo',
|
|
8
9
|
sort: [],
|
|
9
10
|
},
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
backendRequests: {
|
|
12
|
+
primary: {
|
|
13
|
+
kind: 'hits',
|
|
14
|
+
finalized_parameters: {
|
|
15
|
+
user_query: 'collection:foo',
|
|
16
|
+
sort: [],
|
|
17
|
+
},
|
|
18
|
+
},
|
|
13
19
|
},
|
|
14
20
|
},
|
|
15
21
|
rawResponse: {},
|
|
@@ -34,13 +40,19 @@ export const getMockSuccessSingleResult = () => ({
|
|
|
34
40
|
export const getMockSuccessWithYearHistogramAggs = () => ({
|
|
35
41
|
success: {
|
|
36
42
|
request: {
|
|
43
|
+
kind: 'hits',
|
|
37
44
|
clientParameters: {
|
|
38
45
|
user_query: 'years',
|
|
39
46
|
sort: [],
|
|
40
47
|
},
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
48
|
+
backendRequests: {
|
|
49
|
+
primary: {
|
|
50
|
+
kind: 'hits',
|
|
51
|
+
finalized_parameters: {
|
|
52
|
+
user_query: 'years',
|
|
53
|
+
sort: [],
|
|
54
|
+
},
|
|
55
|
+
},
|
|
44
56
|
},
|
|
45
57
|
},
|
|
46
58
|
rawResponse: {},
|
|
@@ -75,13 +87,19 @@ export const getMockSuccessWithYearHistogramAggs = () => ({
|
|
|
75
87
|
export const getMockSuccessLoggedInResult = () => ({
|
|
76
88
|
success: {
|
|
77
89
|
request: {
|
|
90
|
+
kind: 'hits',
|
|
78
91
|
clientParameters: {
|
|
79
92
|
user_query: 'loggedin',
|
|
80
93
|
sort: [],
|
|
81
94
|
},
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
95
|
+
backendRequests: {
|
|
96
|
+
primary: {
|
|
97
|
+
kind: 'hits',
|
|
98
|
+
finalized_parameters: {
|
|
99
|
+
user_query: 'loggedin',
|
|
100
|
+
sort: [],
|
|
101
|
+
},
|
|
102
|
+
},
|
|
85
103
|
},
|
|
86
104
|
},
|
|
87
105
|
rawResponse: {},
|
|
@@ -108,13 +126,19 @@ export const getMockSuccessLoggedInResult = () => ({
|
|
|
108
126
|
export const getMockSuccessNoPreviewResult = () => ({
|
|
109
127
|
success: {
|
|
110
128
|
request: {
|
|
129
|
+
kind: 'hits',
|
|
111
130
|
clientParameters: {
|
|
112
131
|
user_query: 'no-preview',
|
|
113
132
|
sort: [],
|
|
114
133
|
},
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
134
|
+
backendRequests: {
|
|
135
|
+
primary: {
|
|
136
|
+
kind: 'hits',
|
|
137
|
+
finalized_parameters: {
|
|
138
|
+
user_query: 'no-preview',
|
|
139
|
+
sort: [],
|
|
140
|
+
},
|
|
141
|
+
},
|
|
118
142
|
},
|
|
119
143
|
},
|
|
120
144
|
rawResponse: {},
|
|
@@ -139,13 +163,19 @@ export const getMockSuccessNoPreviewResult = () => ({
|
|
|
139
163
|
export const getMockSuccessLoggedInAndNoPreviewResult = () => ({
|
|
140
164
|
success: {
|
|
141
165
|
request: {
|
|
166
|
+
kind: 'hits',
|
|
142
167
|
clientParameters: {
|
|
143
168
|
user_query: 'loggedin-no-preview',
|
|
144
169
|
sort: [],
|
|
145
170
|
},
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
171
|
+
backendRequests: {
|
|
172
|
+
primary: {
|
|
173
|
+
kind: 'hits',
|
|
174
|
+
finalized_parameters: {
|
|
175
|
+
user_query: 'loggedin-no-preview',
|
|
176
|
+
sort: [],
|
|
177
|
+
},
|
|
178
|
+
},
|
|
149
179
|
},
|
|
150
180
|
},
|
|
151
181
|
rawResponse: {},
|
|
@@ -170,13 +200,19 @@ export const getMockSuccessLoggedInAndNoPreviewResult = () => ({
|
|
|
170
200
|
export const getMockSuccessFirstTitleResult = () => ({
|
|
171
201
|
success: {
|
|
172
202
|
request: {
|
|
203
|
+
kind: 'hits',
|
|
173
204
|
clientParameters: {
|
|
174
205
|
user_query: 'first-title',
|
|
175
206
|
sort: ['title', 'asc'],
|
|
176
207
|
},
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
208
|
+
backendRequests: {
|
|
209
|
+
primary: {
|
|
210
|
+
kind: 'hits',
|
|
211
|
+
finalized_parameters: {
|
|
212
|
+
user_query: 'first-title',
|
|
213
|
+
sort: ['title', 'asc'],
|
|
214
|
+
},
|
|
215
|
+
},
|
|
180
216
|
},
|
|
181
217
|
},
|
|
182
218
|
rawResponse: {},
|
|
@@ -205,13 +241,19 @@ export const getMockSuccessFirstTitleResult = () => ({
|
|
|
205
241
|
export const getMockSuccessFirstCreatorResult = () => ({
|
|
206
242
|
success: {
|
|
207
243
|
request: {
|
|
244
|
+
kind: 'hits',
|
|
208
245
|
clientParameters: {
|
|
209
246
|
user_query: 'first-creator',
|
|
210
247
|
sort: ['creator', 'asc'],
|
|
211
248
|
},
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
249
|
+
backendRequests: {
|
|
250
|
+
primary: {
|
|
251
|
+
kind: 'hits',
|
|
252
|
+
finalized_parameters: {
|
|
253
|
+
user_query: 'first-creator',
|
|
254
|
+
sort: ['creator', 'asc'],
|
|
255
|
+
},
|
|
256
|
+
},
|
|
215
257
|
},
|
|
216
258
|
},
|
|
217
259
|
rawResponse: {},
|
|
@@ -240,13 +282,19 @@ export const getMockSuccessFirstCreatorResult = () => ({
|
|
|
240
282
|
export const getMockSuccessWithCollectionTitles = () => ({
|
|
241
283
|
success: {
|
|
242
284
|
request: {
|
|
285
|
+
kind: 'hits',
|
|
243
286
|
clientParameters: {
|
|
244
287
|
user_query: 'collection:foo',
|
|
245
288
|
sort: [],
|
|
246
289
|
},
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
290
|
+
backendRequests: {
|
|
291
|
+
primary: {
|
|
292
|
+
kind: 'hits',
|
|
293
|
+
finalized_parameters: {
|
|
294
|
+
user_query: 'collection:foo',
|
|
295
|
+
sort: [],
|
|
296
|
+
},
|
|
297
|
+
},
|
|
250
298
|
},
|
|
251
299
|
},
|
|
252
300
|
rawResponse: {},
|
|
@@ -283,13 +331,19 @@ export const getMockSuccessWithCollectionTitles = () => ({
|
|
|
283
331
|
export const getMockSuccessWithCollectionAggregations = () => ({
|
|
284
332
|
success: {
|
|
285
333
|
request: {
|
|
334
|
+
kind: 'hits',
|
|
286
335
|
clientParameters: {
|
|
287
336
|
user_query: 'collection:foo',
|
|
288
337
|
sort: [],
|
|
289
338
|
},
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
339
|
+
backendRequests: {
|
|
340
|
+
primary: {
|
|
341
|
+
kind: 'hits',
|
|
342
|
+
finalized_parameters: {
|
|
343
|
+
user_query: 'collection:foo',
|
|
344
|
+
sort: [],
|
|
345
|
+
},
|
|
346
|
+
},
|
|
293
347
|
},
|
|
294
348
|
},
|
|
295
349
|
rawResponse: {},
|
|
@@ -321,13 +375,19 @@ export const getMockSuccessWithCollectionAggregations = () => ({
|
|
|
321
375
|
export const getMockSuccessSingleResultWithSort = (resultsSpy) => ({
|
|
322
376
|
success: {
|
|
323
377
|
request: {
|
|
378
|
+
kind: 'hits',
|
|
324
379
|
clientParameters: {
|
|
325
380
|
user_query: 'with-sort',
|
|
326
381
|
sort: ['foo:asc'],
|
|
327
382
|
},
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
383
|
+
backendRequests: {
|
|
384
|
+
primary: {
|
|
385
|
+
kind: 'hits',
|
|
386
|
+
finalized_parameters: {
|
|
387
|
+
user_query: 'with-sort',
|
|
388
|
+
sort: ['foo:asc'],
|
|
389
|
+
},
|
|
390
|
+
},
|
|
331
391
|
},
|
|
332
392
|
},
|
|
333
393
|
rawResponse: {},
|
|
@@ -355,13 +415,19 @@ export const getMockSuccessSingleResultWithSort = (resultsSpy) => ({
|
|
|
355
415
|
export const getMockSuccessMultipleResults = () => ({
|
|
356
416
|
success: {
|
|
357
417
|
request: {
|
|
418
|
+
kind: 'hits',
|
|
358
419
|
clientParameters: {
|
|
359
420
|
user_query: 'collection:foo',
|
|
360
421
|
sort: [],
|
|
361
422
|
},
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
423
|
+
backendRequests: {
|
|
424
|
+
primary: {
|
|
425
|
+
kind: 'hits',
|
|
426
|
+
finalized_parameters: {
|
|
427
|
+
user_query: 'collection:foo',
|
|
428
|
+
sort: [],
|
|
429
|
+
},
|
|
430
|
+
},
|
|
365
431
|
},
|
|
366
432
|
},
|
|
367
433
|
rawResponse: {},
|
|
@@ -392,13 +458,19 @@ export const getMockSuccessMultipleResults = () => ({
|
|
|
392
458
|
export const getMockSuccessMultiLineDescription = () => ({
|
|
393
459
|
success: {
|
|
394
460
|
request: {
|
|
461
|
+
kind: 'hits',
|
|
395
462
|
clientParameters: {
|
|
396
463
|
user_query: 'multi-line-description',
|
|
397
464
|
sort: [],
|
|
398
465
|
},
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
466
|
+
backendRequests: {
|
|
467
|
+
primary: {
|
|
468
|
+
kind: 'hits',
|
|
469
|
+
finalized_parameters: {
|
|
470
|
+
user_query: 'multi-line-description',
|
|
471
|
+
sort: [],
|
|
472
|
+
},
|
|
473
|
+
},
|
|
402
474
|
},
|
|
403
475
|
},
|
|
404
476
|
rawResponse: {},
|
|
@@ -424,13 +496,19 @@ export const getMockSuccessMultiLineDescription = () => ({
|
|
|
424
496
|
export const getMockSuccessExtraQuotedHref = () => ({
|
|
425
497
|
success: {
|
|
426
498
|
request: {
|
|
499
|
+
kind: 'hits',
|
|
427
500
|
clientParameters: {
|
|
428
501
|
user_query: 'extra-quoted-href',
|
|
429
502
|
sort: [],
|
|
430
503
|
},
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
504
|
+
backendRequests: {
|
|
505
|
+
primary: {
|
|
506
|
+
kind: 'hits',
|
|
507
|
+
finalized_parameters: {
|
|
508
|
+
user_query: 'extra-quoted-href',
|
|
509
|
+
sort: [],
|
|
510
|
+
},
|
|
511
|
+
},
|
|
434
512
|
},
|
|
435
513
|
},
|
|
436
514
|
rawResponse: {},
|
|
@@ -456,13 +534,19 @@ export const getMockSuccessExtraQuotedHref = () => ({
|
|
|
456
534
|
export const getMockSuccessWithDefaultSort = () => ({
|
|
457
535
|
success: {
|
|
458
536
|
request: {
|
|
537
|
+
kind: 'hits',
|
|
459
538
|
clientParameters: {
|
|
460
539
|
user_query: 'default-sort',
|
|
461
540
|
sort: [],
|
|
462
541
|
},
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
542
|
+
backendRequests: {
|
|
543
|
+
primary: {
|
|
544
|
+
kind: 'hits',
|
|
545
|
+
finalized_parameters: {
|
|
546
|
+
user_query: 'default-sort',
|
|
547
|
+
sort: ['titleSorter', 'identifier'],
|
|
548
|
+
},
|
|
549
|
+
},
|
|
466
550
|
},
|
|
467
551
|
},
|
|
468
552
|
rawResponse: {},
|
|
@@ -492,13 +576,19 @@ export const getMockSuccessWithDefaultSort = () => ({
|
|
|
492
576
|
export const getMockSuccessWithConciseDefaultSort = () => ({
|
|
493
577
|
success: {
|
|
494
578
|
request: {
|
|
579
|
+
kind: 'hits',
|
|
495
580
|
clientParameters: {
|
|
496
581
|
user_query: 'default-sort-concise',
|
|
497
582
|
sort: [],
|
|
498
583
|
},
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
584
|
+
backendRequests: {
|
|
585
|
+
primary: {
|
|
586
|
+
kind: 'hits',
|
|
587
|
+
finalized_parameters: {
|
|
588
|
+
user_query: 'default-sort-concise',
|
|
589
|
+
sort: ['addeddate:desc', 'identifier'],
|
|
590
|
+
},
|
|
591
|
+
},
|
|
502
592
|
},
|
|
503
593
|
},
|
|
504
594
|
rawResponse: {},
|