@internetarchive/collection-browser 2.15.1-alpha-webdev7667.3 → 2.16.1-webdev-7558.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.
Files changed (107) hide show
  1. package/.editorconfig +29 -29
  2. package/.husky/pre-commit +4 -4
  3. package/LICENSE +661 -661
  4. package/README.md +83 -83
  5. package/dist/src/app-root.js +6 -0
  6. package/dist/src/app-root.js.map +1 -1
  7. package/dist/src/collection-browser.d.ts +0 -17
  8. package/dist/src/collection-browser.js +3 -70
  9. package/dist/src/collection-browser.js.map +1 -1
  10. package/dist/src/collection-facets/more-facets-content.d.ts +2 -1
  11. package/dist/src/collection-facets/more-facets-content.js +6 -3
  12. package/dist/src/collection-facets/more-facets-content.js.map +1 -1
  13. package/dist/src/collection-facets/smart-facets/smart-facet-bar.js +1 -1
  14. package/dist/src/collection-facets/smart-facets/smart-facet-bar.js.map +1 -1
  15. package/dist/src/collection-facets.d.ts +9 -3
  16. package/dist/src/collection-facets.js +85 -41
  17. package/dist/src/collection-facets.js.map +1 -1
  18. package/dist/src/data-source/collection-browser-data-source-interface.d.ts +8 -3
  19. package/dist/src/data-source/collection-browser-data-source-interface.js.map +1 -1
  20. package/dist/src/data-source/collection-browser-data-source.d.ts +5 -1
  21. package/dist/src/data-source/collection-browser-data-source.js +25 -8
  22. package/dist/src/data-source/collection-browser-data-source.js.map +1 -1
  23. package/dist/src/data-source/models.d.ts +4 -0
  24. package/dist/src/data-source/models.js.map +1 -1
  25. package/dist/src/expanded-date-picker.d.ts +4 -0
  26. package/dist/src/expanded-date-picker.js +10 -0
  27. package/dist/src/expanded-date-picker.js.map +1 -1
  28. package/dist/src/models.d.ts +0 -7
  29. package/dist/src/models.js +0 -31
  30. package/dist/src/models.js.map +1 -1
  31. package/dist/src/tiles/base-tile-component.d.ts +0 -1
  32. package/dist/src/tiles/base-tile-component.js +0 -4
  33. package/dist/src/tiles/base-tile-component.js.map +1 -1
  34. package/dist/src/tiles/grid/account-tile.js +0 -2
  35. package/dist/src/tiles/grid/account-tile.js.map +1 -1
  36. package/dist/src/tiles/grid/collection-tile.js +0 -2
  37. package/dist/src/tiles/grid/collection-tile.js.map +1 -1
  38. package/dist/src/tiles/grid/item-tile.js +0 -2
  39. package/dist/src/tiles/grid/item-tile.js.map +1 -1
  40. package/dist/src/tiles/grid/search-tile.js +0 -2
  41. package/dist/src/tiles/grid/search-tile.js.map +1 -1
  42. package/dist/src/tiles/hover/hover-pane-controller.d.ts +0 -1
  43. package/dist/src/tiles/hover/hover-pane-controller.js +12 -7
  44. package/dist/src/tiles/hover/hover-pane-controller.js.map +1 -1
  45. package/dist/src/tiles/hover/tile-hover-pane.d.ts +0 -1
  46. package/dist/src/tiles/hover/tile-hover-pane.js +0 -5
  47. package/dist/src/tiles/hover/tile-hover-pane.js.map +1 -1
  48. package/dist/src/tiles/image-block.d.ts +0 -1
  49. package/dist/src/tiles/image-block.js +0 -7
  50. package/dist/src/tiles/image-block.js.map +1 -1
  51. package/dist/src/tiles/item-image.d.ts +0 -1
  52. package/dist/src/tiles/item-image.js +2 -7
  53. package/dist/src/tiles/item-image.js.map +1 -1
  54. package/dist/src/tiles/list/tile-list-compact-header.js +0 -1
  55. package/dist/src/tiles/list/tile-list-compact-header.js.map +1 -1
  56. package/dist/src/tiles/list/tile-list-compact.js +0 -2
  57. package/dist/src/tiles/list/tile-list-compact.js.map +1 -1
  58. package/dist/src/tiles/list/tile-list.js +0 -2
  59. package/dist/src/tiles/list/tile-list.js.map +1 -1
  60. package/dist/src/tiles/tile-dispatcher.js +0 -7
  61. package/dist/src/tiles/tile-dispatcher.js.map +1 -1
  62. package/dist/test/collection-browser.test.js +44 -1
  63. package/dist/test/collection-browser.test.js.map +1 -1
  64. package/dist/test/collection-facets.test.js +24 -14
  65. package/dist/test/collection-facets.test.js.map +1 -1
  66. package/dist/test/mocks/mock-search-responses.d.ts +2 -0
  67. package/dist/test/mocks/mock-search-responses.js +92 -0
  68. package/dist/test/mocks/mock-search-responses.js.map +1 -1
  69. package/dist/test/mocks/mock-search-service.d.ts +1 -0
  70. package/dist/test/mocks/mock-search-service.js +6 -1
  71. package/dist/test/mocks/mock-search-service.js.map +1 -1
  72. package/dist/test/tiles/hover/hover-pane-controller.test.js +0 -1
  73. package/dist/test/tiles/hover/hover-pane-controller.test.js.map +1 -1
  74. package/local.archive.org.cert +86 -86
  75. package/local.archive.org.key +27 -27
  76. package/package.json +3 -3
  77. package/renovate.json +6 -6
  78. package/src/app-root.ts +6 -0
  79. package/src/collection-browser.ts +3 -68
  80. package/src/collection-facets/more-facets-content.ts +5 -2
  81. package/src/collection-facets/smart-facets/smart-facet-bar.ts +2 -1
  82. package/src/collection-facets.ts +109 -40
  83. package/src/data-source/collection-browser-data-source-interface.ts +13 -3
  84. package/src/data-source/collection-browser-data-source.ts +30 -9
  85. package/src/data-source/models.ts +5 -0
  86. package/src/expanded-date-picker.ts +10 -0
  87. package/src/models.ts +0 -36
  88. package/src/tiles/base-tile-component.ts +0 -2
  89. package/src/tiles/grid/account-tile.ts +0 -2
  90. package/src/tiles/grid/collection-tile.ts +0 -2
  91. package/src/tiles/grid/item-tile.ts +0 -2
  92. package/src/tiles/grid/search-tile.ts +0 -2
  93. package/src/tiles/hover/hover-pane-controller.ts +7 -2
  94. package/src/tiles/hover/tile-hover-pane.ts +0 -3
  95. package/src/tiles/image-block.ts +0 -5
  96. package/src/tiles/item-image.ts +2 -6
  97. package/src/tiles/list/tile-list-compact-header.ts +0 -1
  98. package/src/tiles/list/tile-list-compact.ts +0 -2
  99. package/src/tiles/list/tile-list.ts +0 -2
  100. package/src/tiles/tile-dispatcher.ts +0 -7
  101. package/test/collection-browser.test.ts +68 -1
  102. package/test/collection-facets.test.ts +24 -14
  103. package/test/mocks/mock-search-responses.ts +100 -0
  104. package/test/mocks/mock-search-service.ts +10 -0
  105. package/test/tiles/hover/hover-pane-controller.test.ts +0 -1
  106. package/web-dev-server.config.mjs +30 -30
  107. package/web-test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UlQYG1NBYQFrCAcBEf8PWtqSLA+YnOh6gD4R3
23
+ ZoWfGNQwFnoKF4HugU/Q6LYwk7TiR5B/zs30urQWzSOGT9rF8wyW5OJIR2kkZ373
24
+ WmKgrQKBgGaw32CMejz3wBpzOAXsYJcMsVfNCMD4bJ2EbXhYuY8HB8IEEv6wqMsp
25
+ wtXIgHJubfIiA3MlVsfaUkRdtHMHbN+Us1oynu6nByLhYlAMKpOsJFzPVHHwGB/1
26
+ g3WtzfFk5eOoZltJBm5K41zjS7lyr1t05648pT6niy9snu6LaF94
27
+ -----END RSA PRIVATE KEY-----
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.15.1-alpha-webdev7667.3",
6
+ "version": "2.16.1-webdev-7558.0",
7
7
  "main": "dist/index.js",
8
8
  "module": "dist/index.js",
9
9
  "scripts": {
@@ -26,13 +26,13 @@
26
26
  "@internetarchive/analytics-manager": "^0.1.4",
27
27
  "@internetarchive/feature-feedback": "^1.0.0",
28
28
  "@internetarchive/field-parsers": "^1.0.0",
29
- "@internetarchive/histogram-date-range": "^1.2.1",
29
+ "@internetarchive/histogram-date-range": "^1.3.0",
30
30
  "@internetarchive/ia-activity-indicator": "^0.0.6",
31
31
  "@internetarchive/ia-dropdown": "^1.3.10",
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.4.1-alpha-webdev7667.0",
35
+ "@internetarchive/search-service": "2.4.1-webdev-7558.3",
36
36
  "@internetarchive/shared-resize-observer": "^0.2.0",
37
37
  "@lit/localize": "^0.12.2",
38
38
  "dompurify": "^3.2.4",
package/renovate.json CHANGED
@@ -1,6 +1,6 @@
1
- {
2
- "extends": [
3
- "config:base",
4
- ":preserveSemverRanges"
5
- ]
6
- }
1
+ {
2
+ "extends": [
3
+ "config:base",
4
+ ":preserveSemverRanges"
5
+ ]
6
+ }
package/src/app-root.ts CHANGED
@@ -665,6 +665,9 @@ export class AppRoot extends LitElement {
665
665
  });
666
666
  return searchResponse;
667
667
  },
668
+ async itemDetails(identifier: string) {
669
+ return SearchService.default.itemDetails(identifier);
670
+ },
668
671
  };
669
672
  } else {
670
673
  // Restore the default seach service
@@ -697,6 +700,9 @@ export class AppRoot extends LitElement {
697
700
  });
698
701
  return searchResponse;
699
702
  },
703
+ async itemDetails(identifier: string) {
704
+ return SearchService.default.itemDetails(identifier);
705
+ },
700
706
  };
701
707
  } else {
702
708
  // Restore the default seach service
@@ -318,10 +318,6 @@ export class CollectionBrowser
318
318
 
319
319
  @state() private mobileView = false;
320
320
 
321
- @state() private tileBlurPreference = true;
322
-
323
- @state() private tileBlurOverride?: boolean;
324
-
325
321
  @state() private collapsibleFacetsVisible = false;
326
322
 
327
323
  @state() private contentWidth?: number;
@@ -805,7 +801,6 @@ export class CollectionBrowser
805
801
  @titleLetterChanged=${this.titleLetterSelected}
806
802
  @creatorLetterChanged=${this.creatorLetterSelected}
807
803
  >
808
- ${this.tileBlurCheckboxTemplate}
809
804
  <slot name="sort-options-left" slot="sort-options-left"></slot>
810
805
  <slot name="sort-options" slot="sort-options"></slot>
811
806
  <slot name="sort-options-right" slot="sort-options-right"></slot>
@@ -813,31 +808,6 @@ export class CollectionBrowser
813
808
  `;
814
809
  }
815
810
 
816
- /**
817
- * Template for the Blurring toggle for admins to enable/disable blurring of
818
- * sensitive content in result tiles.
819
- */
820
- private get tileBlurCheckboxTemplate(): TemplateResult | typeof nothing {
821
- // Only show the checkbox for @archive.org users
822
- if (!this.dataSource.sessionContext?.is_archive_user) return nothing;
823
-
824
- return html`
825
- <label
826
- id="tile-blur-label"
827
- for="tile-blur-check"
828
- slot="sort-options-right"
829
- >
830
- ${msg('Blurring')}
831
- <input
832
- id="tile-blur-check"
833
- type="checkbox"
834
- ?checked=${this.shouldBlurTiles}
835
- @change=${this.tileBlurCheckboxChanged}
836
- />
837
- </label>
838
- `;
839
- }
840
-
841
811
  /**
842
812
  * Template for the manage bar UI that appears atop the search results when we are
843
813
  * showing the management view. This generally replaces the sort bar when present.
@@ -931,29 +901,6 @@ export class CollectionBrowser
931
901
  this.dataSource.removeCheckedTiles();
932
902
  }
933
903
 
934
- /**
935
- * Handler for when the tile blurring checkbox state is toggled
936
- */
937
- private tileBlurCheckboxChanged(e: Event): void {
938
- const { checked } = e.target as HTMLInputElement;
939
- this.tileBlurOverride = checked;
940
- this.infiniteScroller?.refreshAllVisibleCells();
941
- }
942
-
943
- /**
944
- * Whether result tiles that contain sensitive content should be blurred.
945
- * First considers the `tileBlurOverride` if set, falling back to the setting in
946
- * user preferences if not.
947
- */
948
- private get shouldBlurTiles(): boolean {
949
- const { sessionContext } = this.dataSource;
950
- const userPrefs = sessionContext?.pps_relevant_user_preferences;
951
- const blurringPref = userPrefs?.display__blur_moderated_content;
952
- const blurringPrefState =
953
- blurringPref === undefined ? undefined : blurringPref === 'on';
954
- return this.tileBlurOverride ?? blurringPrefState ?? true;
955
- }
956
-
957
904
  /**
958
905
  * Handler for when the user changes the selected sort option or direction.
959
906
  */
@@ -1191,13 +1138,13 @@ export class CollectionBrowser
1191
1138
  .resizeObserver=${this.resizeObserver}
1192
1139
  .searchType=${this.searchType}
1193
1140
  .aggregations=${this.dataSource.aggregations}
1194
- .fullYearsHistogramAggregation=${this.dataSource
1195
- .yearHistogramAggregation}
1141
+ .histogramAggregation=${this.dataSource.histogramAggregation}
1196
1142
  .minSelectedDate=${this.minSelectedDate}
1197
1143
  .maxSelectedDate=${this.maxSelectedDate}
1198
1144
  .selectedFacets=${this.selectedFacets}
1199
1145
  .baseNavigationUrl=${this.baseNavigationUrl}
1200
1146
  .collectionTitles=${this.dataSource.collectionTitles}
1147
+ .tvChannelAliases=${this.dataSource.tvChannelAliases}
1201
1148
  .showHistogramDatePicker=${this.showHistogramDatePicker}
1202
1149
  .allowExpandingDatePicker=${!this.mobileView}
1203
1150
  .allowDatePickerMonths=${shouldUseTvInterface}
@@ -1211,7 +1158,7 @@ export class CollectionBrowser
1211
1158
  .isTvSearch=${shouldUseTvInterface}
1212
1159
  ?collapsableFacets=${this.mobileView}
1213
1160
  ?facetsLoading=${this.facetsLoading}
1214
- ?fullYearAggregationLoading=${this.facetsLoading}
1161
+ ?histogramAggregationLoading=${this.facetsLoading}
1215
1162
  ?suppressMediatypeFacets=${this.suppressMediatypeFacets}
1216
1163
  @facetClick=${this.facetClickHandler}
1217
1164
  @facetsChanged=${this.facetsChanged}
@@ -1291,7 +1238,6 @@ export class CollectionBrowser
1291
1238
  .defaultSortParam=${this.defaultSortParam}
1292
1239
  .mobileBreakpoint=${this.mobileBreakpoint}
1293
1240
  .loggedIn=${this.loggedIn}
1294
- .suppressBlurring=${!this.shouldBlurTiles}
1295
1241
  >
1296
1242
  </tile-dispatcher>
1297
1243
  </div>
@@ -2212,7 +2158,6 @@ export class CollectionBrowser
2212
2158
  .creatorFilter=${this.selectedCreatorFilter}
2213
2159
  .mobileBreakpoint=${this.mobileBreakpoint}
2214
2160
  .loggedIn=${this.loggedIn}
2215
- .suppressBlurring=${!this.shouldBlurTiles}
2216
2161
  .isManageView=${this.isManageView}
2217
2162
  ?showTvClips=${this.isTVCollection || this.searchType === SearchType.TV}
2218
2163
  ?enableHoverPane=${true}
@@ -2605,16 +2550,6 @@ export class CollectionBrowser
2605
2550
  padding-top: 50px;
2606
2551
  }
2607
2552
 
2608
- #tile-blur-label {
2609
- display: flex;
2610
- align-items: center;
2611
- column-gap: 5px;
2612
- }
2613
-
2614
- #tile-blur-check {
2615
- margin: 0 5px 0 0;
2616
- }
2617
-
2618
2553
  circular-activity-indicator {
2619
2554
  width: 30px;
2620
2555
  height: 30px;
@@ -32,11 +32,11 @@ import {
32
32
  defaultFacetSort,
33
33
  getDefaultSelectedFacets,
34
34
  FacetEventDetails,
35
- tvChannelFacetLabels,
36
35
  } from '../models';
37
36
  import type {
38
37
  CollectionTitles,
39
38
  PageSpecifierParams,
39
+ TVChannelAliases,
40
40
  } from '../data-source/models';
41
41
  import '@internetarchive/ia-activity-indicator';
42
42
  import './more-facets-pagination';
@@ -68,6 +68,9 @@ export class MoreFacetsContent extends LitElement {
68
68
  @property({ type: Object })
69
69
  collectionTitles?: CollectionTitles;
70
70
 
71
+ @property({ type: Object })
72
+ tvChannelAliases?: TVChannelAliases;
73
+
71
74
  /**
72
75
  * Maximum number of facets to show per page within the modal.
73
76
  */
@@ -287,7 +290,7 @@ export class MoreFacetsContent extends LitElement {
287
290
  bucketsWithCount.forEach(b => {
288
291
  b.displayText = (b.displayText ?? b.key)?.toLocaleUpperCase();
289
292
 
290
- const channelLabel = tvChannelFacetLabels[b.displayText];
293
+ const channelLabel = this.tvChannelAliases?.get(b.displayText);
291
294
  if (channelLabel && channelLabel !== b.displayText) {
292
295
  b.extraNote = `(${channelLabel})`;
293
296
  }
@@ -193,7 +193,8 @@ export class SmartFacetBar extends LitElement {
193
193
  const agg = this.lastAggregations[key];
194
194
  if (!agg) continue;
195
195
  if (agg.buckets.length === 0) continue;
196
- if (['lending', 'year_histogram'].includes(key)) continue;
196
+ if (['lending', 'year_histogram', 'date_histogram'].includes(key))
197
+ continue;
197
198
  if (typeof agg.buckets[0] === 'number') continue;
198
199
 
199
200
  if (
@@ -29,6 +29,7 @@ import type { FeatureFeedbackServiceInterface } from '@internetarchive/feature-f
29
29
  import type { RecaptchaManagerInterface } from '@internetarchive/recaptcha-manager';
30
30
  import type { AnalyticsManagerInterface } from '@internetarchive/analytics-manager';
31
31
  import type { SharedResizeObserverInterface } from '@internetarchive/shared-resize-observer';
32
+ import type { BinSnappingInterval } from '@internetarchive/histogram-date-range';
32
33
  import chevronIcon from './assets/img/icons/chevron';
33
34
  import expandIcon from './assets/img/icons/expand';
34
35
  import {
@@ -44,16 +45,12 @@ import {
44
45
  suppressedCollections,
45
46
  defaultFacetSort,
46
47
  FacetEventDetails,
47
- tvChannelFacetLabels,
48
48
  } from './models';
49
49
  import type {
50
50
  CollectionTitles,
51
51
  PageSpecifierParams,
52
+ TVChannelAliases,
52
53
  } from './data-source/models';
53
- import './collection-facets/more-facets-content';
54
- import './collection-facets/facets-template';
55
- import './collection-facets/facet-tombstone-row';
56
- import './expanded-date-picker';
57
54
  import {
58
55
  analyticsActions,
59
56
  analyticsCategories,
@@ -65,6 +62,12 @@ import {
65
62
  updateSelectedFacetBucket,
66
63
  } from './utils/facet-utils';
67
64
 
65
+ import '@internetarchive/histogram-date-range';
66
+ import './collection-facets/more-facets-content';
67
+ import './collection-facets/facets-template';
68
+ import './collection-facets/facet-tombstone-row';
69
+ import './expanded-date-picker';
70
+
68
71
  @customElement('collection-facets')
69
72
  export class CollectionFacets extends LitElement {
70
73
  @property({ type: Object }) searchService?: SearchServiceInterface;
@@ -73,7 +76,7 @@ export class CollectionFacets extends LitElement {
73
76
 
74
77
  @property({ type: Object }) aggregations?: Record<string, Aggregation>;
75
78
 
76
- @property({ type: Object }) fullYearsHistogramAggregation?: Aggregation;
79
+ @property({ type: Object }) histogramAggregation?: Aggregation;
77
80
 
78
81
  @property({ type: String }) minSelectedDate?: string;
79
82
 
@@ -83,7 +86,7 @@ export class CollectionFacets extends LitElement {
83
86
 
84
87
  @property({ type: Boolean }) facetsLoading = false;
85
88
 
86
- @property({ type: Boolean }) fullYearAggregationLoading = false;
89
+ @property({ type: Boolean }) histogramAggregationLoading = false;
87
90
 
88
91
  @property({ type: Object }) selectedFacets?: SelectedFacets;
89
92
 
@@ -134,6 +137,9 @@ export class CollectionFacets extends LitElement {
134
137
  @property({ type: Object, attribute: false })
135
138
  collectionTitles?: CollectionTitles;
136
139
 
140
+ @property({ type: Object, attribute: false })
141
+ tvChannelAliases?: TVChannelAliases;
142
+
137
143
  @state() openFacets: Record<FacetOption, boolean> = {
138
144
  subject: false,
139
145
  lending: false,
@@ -164,7 +170,7 @@ export class CollectionFacets extends LitElement {
164
170
  return html`
165
171
  <div id="container" class=${containerClasses}>
166
172
  ${this.showHistogramDatePicker &&
167
- (this.fullYearsHistogramAggregation || this.fullYearAggregationLoading)
173
+ (this.histogramAggregation || this.histogramAggregationLoading)
168
174
  ? html`
169
175
  <section
170
176
  class="facet-group"
@@ -230,15 +236,63 @@ export class CollectionFacets extends LitElement {
230
236
  });
231
237
  }
232
238
 
239
+ /**
240
+ * Properties to pass into the date-picker histogram component
241
+ */
242
+ private get histogramProps() {
243
+ const { histogramAggregation: aggregation } = this;
244
+ if (!aggregation) return undefined;
245
+
246
+ // Normalize some properties from the raw aggregation
247
+ const firstYear =
248
+ aggregation.first_bucket_year ?? aggregation.first_bucket_key;
249
+ const lastYear =
250
+ aggregation.last_bucket_year ?? aggregation.last_bucket_key;
251
+ if (firstYear == null || lastYear == null) return undefined; // We at least need a start/end year defined
252
+
253
+ const firstMonth = aggregation.first_bucket_month ?? 1;
254
+ const lastMonth = aggregation.last_bucket_month ?? 12;
255
+
256
+ const yearInterval = aggregation.interval ?? 1;
257
+ const monthInterval = aggregation.interval_in_months ?? 12;
258
+
259
+ const zeroPadMonth = (month: number) => month.toString().padStart(2, '0');
260
+
261
+ // Format the min/max dates appropriately
262
+ const minDate = this.isTvSearch
263
+ ? `${firstYear}-${zeroPadMonth(firstMonth)}`
264
+ : `${firstYear}`;
265
+
266
+ const maxDate = this.isTvSearch
267
+ ? `${lastYear}-${zeroPadMonth(lastMonth + monthInterval - 1)}`
268
+ : `${lastYear + yearInterval - 1}`;
269
+
270
+ const hasMonths = this.isTvSearch && monthInterval < 12;
271
+ return {
272
+ buckets: aggregation.buckets as number[],
273
+ dateFormat: this.isTvSearch ? 'YYYY-MM' : 'YYYY',
274
+ tooltipDateFormat: hasMonths ? 'MMM YYYY' : 'YYYY',
275
+ binSnapping: (hasMonths ? 'month' : 'year') as BinSnappingInterval,
276
+ minDate,
277
+ maxDate,
278
+ };
279
+ }
280
+
233
281
  /**
234
282
  * Opens a modal dialog containing an enlarged version of the date picker.
235
283
  */
236
284
  private showDatePickerModal(): void {
237
- const { fullYearsHistogramAggregation } = this;
238
- const minDate = fullYearsHistogramAggregation?.first_bucket_key;
239
- const maxDate = fullYearsHistogramAggregation?.last_bucket_key;
240
- const buckets = fullYearsHistogramAggregation?.buckets as number[];
241
- const dateFormat = this.isTvSearch ? 'YYYY-MM' : 'YYYY';
285
+ const { histogramProps } = this;
286
+ if (!histogramProps) return;
287
+
288
+ const {
289
+ buckets,
290
+ dateFormat,
291
+ tooltipDateFormat,
292
+ binSnapping,
293
+ minDate,
294
+ maxDate,
295
+ } = histogramProps;
242
296
 
243
297
  // Because the modal manager does not clear its DOM content after being closed,
244
298
  // it may try to render the exact same date picker template when it is reopened.
@@ -264,6 +318,8 @@ export class CollectionFacets extends LitElement {
264
318
  .minSelectedDate=${this.minSelectedDate}
265
319
  .maxSelectedDate=${this.maxSelectedDate}
266
320
  .dateFormat=${dateFormat}
321
+ .tooltipDateFormat=${tooltipDateFormat}
322
+ .binSnapping=${binSnapping}
267
323
  .buckets=${buckets}
268
324
  .modalManager=${this.modalManager}
269
325
  .analyticsHandler=${this.analyticsHandler}
@@ -328,30 +384,42 @@ export class CollectionFacets extends LitElement {
328
384
  : nothing;
329
385
  }
330
386
 
331
- private get histogramTemplate() {
332
- const { fullYearsHistogramAggregation } = this;
333
- const minDate = fullYearsHistogramAggregation?.first_bucket_key;
334
- const maxDate = fullYearsHistogramAggregation?.last_bucket_key;
335
- const dateFormat = this.isTvSearch ? 'YYYY-MM' : 'YYYY';
336
- return this.fullYearAggregationLoading
337
- ? html`<div class="histogram-loading-indicator">&hellip;</div>` // Ellipsis block
338
- : html`
339
- <histogram-date-range
340
- class=${this.isTvSearch ? 'wide-inputs' : nothing}
341
- .minDate=${minDate}
342
- .maxDate=${maxDate}
343
- .minSelectedDate=${this.minSelectedDate ?? minDate}
344
- .maxSelectedDate=${this.maxSelectedDate ?? maxDate}
345
- .updateDelay=${100}
346
- .dateFormat=${dateFormat}
347
- missingDataMessage="..."
348
- .width=${this.collapsableFacets && this.contentWidth
349
- ? this.contentWidth
350
- : 180}
351
- .bins=${fullYearsHistogramAggregation?.buckets as number[]}
352
- @histogramDateRangeUpdated=${this.histogramDateRangeUpdated}
353
- ></histogram-date-range>
354
- `;
387
+ private get histogramTemplate(): TemplateResult | typeof nothing {
388
+ if (this.histogramAggregationLoading) {
389
+ return html` <div class="histogram-loading-indicator">&hellip;</div> `;
390
+ }
391
+
392
+ const { histogramProps } = this;
393
+ if (!histogramProps) return nothing;
394
+
395
+ const {
396
+ buckets,
397
+ dateFormat,
398
+ tooltipDateFormat,
399
+ binSnapping,
400
+ minDate,
401
+ maxDate,
402
+ } = histogramProps;
403
+
404
+ return html`
405
+ <histogram-date-range
406
+ class=${this.isTvSearch ? 'wide-inputs' : nothing}
407
+ .minDate=${minDate}
408
+ .maxDate=${maxDate}
409
+ .minSelectedDate=${this.minSelectedDate ?? minDate}
410
+ .maxSelectedDate=${this.maxSelectedDate ?? maxDate}
411
+ .updateDelay=${100}
412
+ .dateFormat=${dateFormat}
413
+ .tooltipDateFormat=${tooltipDateFormat}
414
+ .binSnapping=${binSnapping}
415
+ .bins=${buckets}
416
+ missingDataMessage="..."
417
+ .width=${this.collapsableFacets && this.contentWidth
418
+ ? this.contentWidth
419
+ : 180}
420
+ @histogramDateRangeUpdated=${this.histogramDateRangeUpdated}
421
+ ></histogram-date-range>
422
+ `;
355
423
  }
356
424
 
357
425
  /**
@@ -471,7 +539,7 @@ export class CollectionFacets extends LitElement {
471
539
  bucketsWithCount.forEach(b => {
472
540
  b.displayText = (b.displayText ?? b.key)?.toLocaleUpperCase();
473
541
 
474
- const channelLabel = tvChannelFacetLabels[b.displayText];
542
+ const channelLabel = this.tvChannelAliases?.get(b.displayText);
475
543
  if (channelLabel && channelLabel !== b.displayText) {
476
544
  b.extraNote = `(${channelLabel})`;
477
545
  }
@@ -533,8 +601,8 @@ export class CollectionFacets extends LitElement {
533
601
  private get aggregationFacetGroups(): FacetGroup[] {
534
602
  const facetGroups: FacetGroup[] = [];
535
603
  Object.entries(this.aggregations ?? []).forEach(([key, aggregation]) => {
536
- // the year_histogram data is in a different format so can't be handled here
537
- if (key === 'year_histogram') return;
604
+ // the year_histogram and date_histogram data is in a different format so can't be handled here
605
+ if (['year_histogram', 'date_histogram'].includes(key)) return;
538
606
 
539
607
  const option = key as FacetOption;
540
608
  const title = facetTitles[option];
@@ -707,6 +775,7 @@ export class CollectionFacets extends LitElement {
707
775
  .searchService=${this.searchService}
708
776
  .searchType=${this.searchType}
709
777
  .collectionTitles=${this.collectionTitles}
778
+ .tvChannelAliases=${this.tvChannelAliases}
710
779
  .selectedFacets=${this.selectedFacets}
711
780
  .sortedBy=${sortedBy}
712
781
  .isTvSearch=${this.isTvSearch}
@@ -12,7 +12,11 @@ import type {
12
12
  PrefixFilterCounts,
13
13
  TileModel,
14
14
  } from '../models';
15
- import type { PageSpecifierParams, CollectionTitles } from './models';
15
+ import type {
16
+ PageSpecifierParams,
17
+ CollectionTitles,
18
+ TVChannelAliases,
19
+ } from './models';
16
20
 
17
21
  export interface CollectionBrowserDataSourceInterface
18
22
  extends ReactiveController {
@@ -78,9 +82,9 @@ export interface CollectionBrowserDataSourceInterface
78
82
  readonly aggregations?: Record<string, Aggregation>;
79
83
 
80
84
  /**
81
- * The `year_histogram` aggregation retrieved for the current search.
85
+ * The `year_histogram` or `date_histogram` aggregation retrieved for the current search.
82
86
  */
83
- readonly yearHistogramAggregation?: Aggregation;
87
+ readonly histogramAggregation?: Aggregation;
84
88
 
85
89
  /**
86
90
  * A map from collection identifiers that appear on hits or aggregations for the
@@ -88,6 +92,12 @@ export interface CollectionBrowserDataSourceInterface
88
92
  */
89
93
  readonly collectionTitles: CollectionTitles;
90
94
 
95
+ /**
96
+ * A map from TV channel names appearing in `creator` aggregations, to their
97
+ * more human-readable network names.
98
+ */
99
+ readonly tvChannelAliases: TVChannelAliases;
100
+
91
101
  /**
92
102
  * The "extra info" package provided by the PPS for collection pages, including details
93
103
  * used to populate the target collection header & About tab content.