@internetarchive/collection-browser 1.11.1-alpha.2 → 1.12.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 +1 -0
- package/dist/src/collection-browser.js +14 -6
- package/dist/src/collection-browser.js.map +1 -1
- package/dist/src/collection-facets.d.ts +5 -1
- package/dist/src/collection-facets.js +66 -1
- package/dist/src/collection-facets.js.map +1 -1
- package/dist/src/empty-placeholder.d.ts +1 -3
- package/dist/src/empty-placeholder.js +0 -14
- package/dist/src/empty-placeholder.js.map +1 -1
- package/dist/src/utils/analytics-events.d.ts +1 -0
- package/dist/src/utils/analytics-events.js +1 -0
- package/dist/src/utils/analytics-events.js.map +1 -1
- package/dist/test/collection-browser.test.js +12 -0
- package/dist/test/collection-browser.test.js.map +1 -1
- package/dist/test/collection-facets.test.js +50 -0
- package/dist/test/collection-facets.test.js.map +1 -1
- package/dist/test/mocks/mock-search-responses.d.ts +1 -0
- package/dist/test/mocks/mock-search-responses.js +42 -0
- package/dist/test/mocks/mock-search-responses.js.map +1 -1
- package/dist/test/mocks/mock-search-service.js +2 -1
- package/dist/test/mocks/mock-search-service.js.map +1 -1
- package/package.json +1 -1
- package/src/collection-browser.ts +12 -3
- package/src/collection-facets.ts +66 -1
- package/src/empty-placeholder.ts +0 -17
- package/src/utils/analytics-events.ts +1 -0
- package/test/collection-browser.test.ts +17 -0
- package/test/collection-facets.test.ts +66 -0
- package/test/mocks/mock-search-responses.ts +46 -0
- package/test/mocks/mock-search-service.ts +2 -0
|
@@ -38,6 +38,7 @@ export declare class CollectionBrowser extends LitElement implements InfiniteScr
|
|
|
38
38
|
showHistogramDatePicker: boolean;
|
|
39
39
|
collectionPagePath: string;
|
|
40
40
|
collectionInfo?: CollectionExtraInfo;
|
|
41
|
+
parentCollections: string[];
|
|
41
42
|
/** describes where this component is being used */
|
|
42
43
|
searchContext: string;
|
|
43
44
|
collectionNameCache?: CollectionNameCacheInterface;
|
|
@@ -31,6 +31,7 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
|
|
|
31
31
|
this.pageSize = 50;
|
|
32
32
|
this.showHistogramDatePicker = false;
|
|
33
33
|
this.collectionPagePath = '/details/';
|
|
34
|
+
this.parentCollections = [];
|
|
34
35
|
/** describes where this component is being used */
|
|
35
36
|
this.searchContext = analyticsCategories.default;
|
|
36
37
|
this.pageContext = 'search';
|
|
@@ -279,8 +280,7 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
|
|
|
279
280
|
!hasQuery && isCollection ? 'empty-collection' : 'no-results';
|
|
280
281
|
}
|
|
281
282
|
if (this.queryErrorMessage) {
|
|
282
|
-
this.placeholderType =
|
|
283
|
-
!hasQuery && isCollection ? 'collection-error' : 'query-error';
|
|
283
|
+
this.placeholderType = 'query-error';
|
|
284
284
|
}
|
|
285
285
|
}
|
|
286
286
|
get emptyPlaceholderTemplate() {
|
|
@@ -576,6 +576,7 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
|
|
|
576
576
|
@facetsChanged=${this.facetsChanged}
|
|
577
577
|
@histogramDateRangeUpdated=${this.histogramDateRangeUpdated}
|
|
578
578
|
.collectionPagePath=${this.collectionPagePath}
|
|
579
|
+
.parentCollections=${this.parentCollections}
|
|
579
580
|
.withinCollection=${this.withinCollection}
|
|
580
581
|
.searchService=${this.searchService}
|
|
581
582
|
.featureFeedbackService=${this.featureFeedbackService}
|
|
@@ -587,6 +588,7 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
|
|
|
587
588
|
.minSelectedDate=${this.minSelectedDate}
|
|
588
589
|
.maxSelectedDate=${this.maxSelectedDate}
|
|
589
590
|
.selectedFacets=${this.selectedFacets}
|
|
591
|
+
.baseNavigationUrl=${this.baseNavigationUrl}
|
|
590
592
|
.collectionNameCache=${this.collectionNameCache}
|
|
591
593
|
.showHistogramDatePicker=${this.showHistogramDatePicker}
|
|
592
594
|
.allowExpandingDatePicker=${!this.mobileView}
|
|
@@ -1320,7 +1322,7 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
|
|
|
1320
1322
|
* if `pageNumber != 1`, defaulting to a single page.
|
|
1321
1323
|
*/
|
|
1322
1324
|
async fetchPage(pageNumber, numInitialPages = 1) {
|
|
1323
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
1325
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
1324
1326
|
const trimmedQuery = (_a = this.baseQuery) === null || _a === void 0 ? void 0 : _a.trim();
|
|
1325
1327
|
if (!this.canPerformSearch)
|
|
1326
1328
|
return;
|
|
@@ -1381,14 +1383,17 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
|
|
|
1381
1383
|
this.collectionInfo = success.response.collectionExtraInfo;
|
|
1382
1384
|
// For collections, we want the UI to respect the default sort option
|
|
1383
1385
|
// which can be specified in metadata, or otherwise assumed to be week:desc
|
|
1384
|
-
this.applyDefaultCollectionSort(
|
|
1386
|
+
this.applyDefaultCollectionSort(this.collectionInfo);
|
|
1387
|
+
if (this.collectionInfo) {
|
|
1388
|
+
this.parentCollections = [].concat((_l = (_k = this.collectionInfo.public_metadata) === null || _k === void 0 ? void 0 : _k.collection) !== null && _l !== void 0 ? _l : []);
|
|
1389
|
+
}
|
|
1385
1390
|
}
|
|
1386
1391
|
const { results, collectionTitles } = success.response;
|
|
1387
1392
|
if (results && results.length > 0) {
|
|
1388
1393
|
// Load any collection titles present on the response into the cache,
|
|
1389
1394
|
// or queue up preload fetches for them if none were present.
|
|
1390
1395
|
if (collectionTitles) {
|
|
1391
|
-
(
|
|
1396
|
+
(_m = this.collectionNameCache) === null || _m === void 0 ? void 0 : _m.addKnownTitles(collectionTitles);
|
|
1392
1397
|
}
|
|
1393
1398
|
else {
|
|
1394
1399
|
this.preloadCollectionNames(results);
|
|
@@ -1411,7 +1416,7 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
|
|
|
1411
1416
|
}
|
|
1412
1417
|
}
|
|
1413
1418
|
for (let i = 0; i < numPages; i += 1) {
|
|
1414
|
-
(
|
|
1419
|
+
(_o = this.pageFetchesInProgress[pageFetchQueryKey]) === null || _o === void 0 ? void 0 : _o.delete(pageNumber + i);
|
|
1415
1420
|
}
|
|
1416
1421
|
}
|
|
1417
1422
|
preloadCollectionNames(results) {
|
|
@@ -2117,6 +2122,9 @@ __decorate([
|
|
|
2117
2122
|
__decorate([
|
|
2118
2123
|
property({ type: Object })
|
|
2119
2124
|
], CollectionBrowser.prototype, "collectionInfo", void 0);
|
|
2125
|
+
__decorate([
|
|
2126
|
+
property({ type: Array })
|
|
2127
|
+
], CollectionBrowser.prototype, "parentCollections", void 0);
|
|
2120
2128
|
__decorate([
|
|
2121
2129
|
property({ type: String, reflect: true })
|
|
2122
2130
|
], CollectionBrowser.prototype, "searchContext", void 0);
|