@internetarchive/collection-browser 3.4.1-alpha-webdev7761.2 → 3.4.1-alpha-webdev7761.4

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 (208) hide show
  1. package/dist/src/app-root.js +19 -28
  2. package/dist/src/app-root.js.map +1 -1
  3. package/dist/src/collection-browser.d.ts +14 -10
  4. package/dist/src/collection-browser.js +870 -886
  5. package/dist/src/collection-browser.js.map +1 -1
  6. package/dist/src/collection-facets/facet-row.js +3 -4
  7. package/dist/src/collection-facets/facet-row.js.map +1 -1
  8. package/dist/src/collection-facets/models.js.map +1 -1
  9. package/dist/src/collection-facets/more-facets-content.js +145 -156
  10. package/dist/src/collection-facets/more-facets-content.js.map +1 -1
  11. package/dist/src/collection-facets/more-facets-pagination.js +6 -10
  12. package/dist/src/collection-facets/more-facets-pagination.js.map +1 -1
  13. package/dist/src/collection-facets/smart-facets/heuristics/wikidata/wikidata-heuristic.js +16 -21
  14. package/dist/src/collection-facets/smart-facets/heuristics/wikidata/wikidata-heuristic.js.map +1 -1
  15. package/dist/src/collection-facets/smart-facets/smart-facet-bar.js +7 -10
  16. package/dist/src/collection-facets/smart-facets/smart-facet-bar.js.map +1 -1
  17. package/dist/src/collection-facets/smart-facets/smart-facet-button.js +3 -2
  18. package/dist/src/collection-facets/smart-facets/smart-facet-button.js.map +1 -1
  19. package/dist/src/collection-facets/smart-facets/smart-facet-dropdown.js +9 -11
  20. package/dist/src/collection-facets/smart-facets/smart-facet-dropdown.js.map +1 -1
  21. package/dist/src/collection-facets/smart-facets/smart-facet-heuristics.js +7 -7
  22. package/dist/src/collection-facets/smart-facets/smart-facet-heuristics.js.map +1 -1
  23. package/dist/src/collection-facets/toggle-switch.js +4 -6
  24. package/dist/src/collection-facets/toggle-switch.js.map +1 -1
  25. package/dist/src/collection-facets.js +34 -50
  26. package/dist/src/collection-facets.js.map +1 -1
  27. package/dist/src/combo-box/caret-closed.js +5 -11
  28. package/dist/src/combo-box/caret-closed.js.map +1 -1
  29. package/dist/src/combo-box/caret-open.js +5 -11
  30. package/dist/src/combo-box/caret-open.js.map +1 -1
  31. package/dist/src/combo-box/clear.d.ts +2 -0
  32. package/dist/src/combo-box/clear.js +11 -0
  33. package/dist/src/combo-box/clear.js.map +1 -0
  34. package/dist/src/combo-box/ia-combo-box.d.ts +40 -9
  35. package/dist/src/combo-box/ia-combo-box.js +363 -272
  36. package/dist/src/combo-box/ia-combo-box.js.map +1 -1
  37. package/dist/src/combo-box/models.d.ts +14 -0
  38. package/dist/src/combo-box/models.js +32 -1
  39. package/dist/src/combo-box/models.js.map +1 -1
  40. package/dist/src/data-source/collection-browser-data-source.js +35 -47
  41. package/dist/src/data-source/collection-browser-data-source.js.map +1 -1
  42. package/dist/src/empty-placeholder.js +19 -18
  43. package/dist/src/empty-placeholder.js.map +1 -1
  44. package/dist/src/expanded-date-picker.js +6 -10
  45. package/dist/src/expanded-date-picker.js.map +1 -1
  46. package/dist/src/language-code-handler/language-code-handler.js +2 -2
  47. package/dist/src/language-code-handler/language-code-handler.js.map +1 -1
  48. package/dist/src/manage/manage-bar.js +86 -92
  49. package/dist/src/manage/manage-bar.js.map +1 -1
  50. package/dist/src/manage/remove-items-modal-content.js +2 -2
  51. package/dist/src/manage/remove-items-modal-content.js.map +1 -1
  52. package/dist/src/models.js +36 -40
  53. package/dist/src/models.js.map +1 -1
  54. package/dist/src/restoration-state-handler.js +9 -10
  55. package/dist/src/restoration-state-handler.js.map +1 -1
  56. package/dist/src/sort-filter-bar/alpha-bar.js +9 -14
  57. package/dist/src/sort-filter-bar/alpha-bar.js.map +1 -1
  58. package/dist/src/sort-filter-bar/sort-filter-bar.js +14 -24
  59. package/dist/src/sort-filter-bar/sort-filter-bar.js.map +1 -1
  60. package/dist/src/tiles/base-tile-component.js +1 -2
  61. package/dist/src/tiles/base-tile-component.js.map +1 -1
  62. package/dist/src/tiles/grid/account-tile.js +36 -38
  63. package/dist/src/tiles/grid/account-tile.js.map +1 -1
  64. package/dist/src/tiles/grid/collection-tile.js +79 -82
  65. package/dist/src/tiles/grid/collection-tile.js.map +1 -1
  66. package/dist/src/tiles/grid/item-tile.js +154 -164
  67. package/dist/src/tiles/grid/item-tile.js.map +1 -1
  68. package/dist/src/tiles/grid/search-tile.js +42 -43
  69. package/dist/src/tiles/grid/search-tile.js.map +1 -1
  70. package/dist/src/tiles/grid/styles/tile-grid-shared-styles.js +119 -119
  71. package/dist/src/tiles/grid/styles/tile-grid-shared-styles.js.map +1 -1
  72. package/dist/src/tiles/grid/tile-stats.js +2 -3
  73. package/dist/src/tiles/grid/tile-stats.js.map +1 -1
  74. package/dist/src/tiles/hover/hover-pane-controller.js +42 -49
  75. package/dist/src/tiles/hover/hover-pane-controller.js.map +1 -1
  76. package/dist/src/tiles/hover/tile-hover-pane.js +113 -114
  77. package/dist/src/tiles/hover/tile-hover-pane.js.map +1 -1
  78. package/dist/src/tiles/image-block.js +5 -8
  79. package/dist/src/tiles/image-block.js.map +1 -1
  80. package/dist/src/tiles/item-image.js +12 -19
  81. package/dist/src/tiles/item-image.js.map +1 -1
  82. package/dist/src/tiles/list/tile-list-compact.js +114 -122
  83. package/dist/src/tiles/list/tile-list-compact.js.map +1 -1
  84. package/dist/src/tiles/list/tile-list.js +326 -347
  85. package/dist/src/tiles/list/tile-list.js.map +1 -1
  86. package/dist/src/tiles/overlay/icon-overlay.js +1 -2
  87. package/dist/src/tiles/overlay/icon-overlay.js.map +1 -1
  88. package/dist/src/tiles/overlay/text-overlay.js +2 -4
  89. package/dist/src/tiles/overlay/text-overlay.js.map +1 -1
  90. package/dist/src/tiles/text-snippet-block.js +2 -4
  91. package/dist/src/tiles/text-snippet-block.js.map +1 -1
  92. package/dist/src/tiles/tile-dispatcher.js +233 -241
  93. package/dist/src/tiles/tile-dispatcher.js.map +1 -1
  94. package/dist/src/tiles/tile-display-value-provider.js +5 -9
  95. package/dist/src/tiles/tile-display-value-provider.js.map +1 -1
  96. package/dist/src/tiles/tile-mediatype-icon.js +12 -19
  97. package/dist/src/tiles/tile-mediatype-icon.js.map +1 -1
  98. package/dist/src/utils/collapse-repeated-quotes.js +1 -1
  99. package/dist/src/utils/collapse-repeated-quotes.js.map +1 -1
  100. package/dist/src/utils/facet-utils.js +3 -5
  101. package/dist/src/utils/facet-utils.js.map +1 -1
  102. package/dist/src/utils/format-count.js +10 -10
  103. package/dist/src/utils/format-count.js.map +1 -1
  104. package/dist/src/utils/format-date.js.map +1 -1
  105. package/dist/src/utils/resolve-mediatype.js +2 -3
  106. package/dist/src/utils/resolve-mediatype.js.map +1 -1
  107. package/dist/test/collection-browser.test.js +131 -185
  108. package/dist/test/collection-browser.test.js.map +1 -1
  109. package/dist/test/collection-facets/facet-row.test.js +60 -75
  110. package/dist/test/collection-facets/facet-row.test.js.map +1 -1
  111. package/dist/test/collection-facets/facets-template.test.js +17 -23
  112. package/dist/test/collection-facets/facets-template.test.js.map +1 -1
  113. package/dist/test/collection-facets/more-facets-content.test.js +22 -32
  114. package/dist/test/collection-facets/more-facets-content.test.js.map +1 -1
  115. package/dist/test/collection-facets/more-facets-pagination.test.js +16 -22
  116. package/dist/test/collection-facets/more-facets-pagination.test.js.map +1 -1
  117. package/dist/test/collection-facets/toggle-switch.test.js +22 -19
  118. package/dist/test/collection-facets/toggle-switch.test.js.map +1 -1
  119. package/dist/test/collection-facets.test.js +80 -97
  120. package/dist/test/collection-facets.test.js.map +1 -1
  121. package/dist/test/empty-placeholder.test.js +11 -17
  122. package/dist/test/empty-placeholder.test.js.map +1 -1
  123. package/dist/test/expanded-date-picker.test.js +8 -14
  124. package/dist/test/expanded-date-picker.test.js.map +1 -1
  125. package/dist/test/icon-overlay.test.js +7 -6
  126. package/dist/test/icon-overlay.test.js.map +1 -1
  127. package/dist/test/image-block.test.js +16 -26
  128. package/dist/test/image-block.test.js.map +1 -1
  129. package/dist/test/item-image.test.js +23 -32
  130. package/dist/test/item-image.test.js.map +1 -1
  131. package/dist/test/manage/manage-bar.test.js +21 -33
  132. package/dist/test/manage/manage-bar.test.js.map +1 -1
  133. package/dist/test/manage/remove-items-modal-content.test.js +10 -15
  134. package/dist/test/manage/remove-items-modal-content.test.js.map +1 -1
  135. package/dist/test/mocks/mock-search-service.js +2 -3
  136. package/dist/test/mocks/mock-search-service.js.map +1 -1
  137. package/dist/test/restoration-state-handler.test.js +13 -21
  138. package/dist/test/restoration-state-handler.test.js.map +1 -1
  139. package/dist/test/review-block.test.js +16 -18
  140. package/dist/test/review-block.test.js.map +1 -1
  141. package/dist/test/sort-filter-bar/alpha-bar-tooltip.test.js +2 -3
  142. package/dist/test/sort-filter-bar/alpha-bar-tooltip.test.js.map +1 -1
  143. package/dist/test/sort-filter-bar/alpha-bar.test.js +18 -24
  144. package/dist/test/sort-filter-bar/alpha-bar.test.js.map +1 -1
  145. package/dist/test/sort-filter-bar/sort-filter-bar.test.js +178 -180
  146. package/dist/test/sort-filter-bar/sort-filter-bar.test.js.map +1 -1
  147. package/dist/test/text-overlay.test.js +16 -15
  148. package/dist/test/text-overlay.test.js.map +1 -1
  149. package/dist/test/text-snippet-block.test.js +14 -19
  150. package/dist/test/text-snippet-block.test.js.map +1 -1
  151. package/dist/test/tile-stats.test.js +73 -34
  152. package/dist/test/tile-stats.test.js.map +1 -1
  153. package/dist/test/tiles/grid/account-tile.test.js +25 -25
  154. package/dist/test/tiles/grid/account-tile.test.js.map +1 -1
  155. package/dist/test/tiles/grid/collection-tile.test.js +13 -19
  156. package/dist/test/tiles/grid/collection-tile.test.js.map +1 -1
  157. package/dist/test/tiles/grid/item-tile.test.js +141 -168
  158. package/dist/test/tiles/grid/item-tile.test.js.map +1 -1
  159. package/dist/test/tiles/grid/search-tile.test.js +9 -13
  160. package/dist/test/tiles/grid/search-tile.test.js.map +1 -1
  161. package/dist/test/tiles/hover/hover-pane-controller.test.js +50 -62
  162. package/dist/test/tiles/hover/hover-pane-controller.test.js.map +1 -1
  163. package/dist/test/tiles/hover/tile-hover-pane.test.js +12 -16
  164. package/dist/test/tiles/hover/tile-hover-pane.test.js.map +1 -1
  165. package/dist/test/tiles/list/tile-list-compact.test.js +104 -118
  166. package/dist/test/tiles/list/tile-list-compact.test.js.map +1 -1
  167. package/dist/test/tiles/list/tile-list.test.js +202 -231
  168. package/dist/test/tiles/list/tile-list.test.js.map +1 -1
  169. package/dist/test/tiles/tile-dispatcher.test.js +97 -110
  170. package/dist/test/tiles/tile-dispatcher.test.js.map +1 -1
  171. package/dist/test/tiles/tile-mediatype-icon.test.js +12 -24
  172. package/dist/test/tiles/tile-mediatype-icon.test.js.map +1 -1
  173. package/dist/test/utils/format-date.test.js.map +1 -1
  174. package/index.html +1 -1
  175. package/package.json +5 -3
  176. package/src/collection-browser.ts +3060 -3030
  177. package/src/collection-facets/models.ts +10 -10
  178. package/src/collection-facets/more-facets-content.ts +639 -639
  179. package/src/collection-facets.ts +1 -1
  180. package/src/combo-box/caret-closed.ts +5 -11
  181. package/src/combo-box/caret-open.ts +5 -11
  182. package/src/combo-box/clear.ts +11 -0
  183. package/src/combo-box/ia-combo-box.ts +1288 -1180
  184. package/src/combo-box/models.ts +31 -1
  185. package/src/manage/manage-bar.ts +247 -247
  186. package/src/restoration-state-handler.ts +5 -1
  187. package/src/tiles/base-tile-component.ts +65 -65
  188. package/src/tiles/grid/account-tile.ts +113 -113
  189. package/src/tiles/grid/collection-tile.ts +163 -163
  190. package/src/tiles/grid/item-tile.ts +340 -340
  191. package/src/tiles/grid/search-tile.ts +90 -90
  192. package/src/tiles/grid/styles/tile-grid-shared-styles.ts +130 -130
  193. package/src/tiles/hover/hover-pane-controller.ts +613 -613
  194. package/src/tiles/hover/tile-hover-pane.ts +184 -184
  195. package/src/tiles/list/tile-list-compact.ts +239 -239
  196. package/src/tiles/list/tile-list.ts +700 -700
  197. package/src/tiles/tile-dispatcher.ts +517 -517
  198. package/src/utils/format-date.ts +62 -62
  199. package/test/collection-facets/facet-row.test.ts +375 -375
  200. package/test/collection-facets.test.ts +928 -928
  201. package/test/tiles/grid/item-tile.test.ts +520 -520
  202. package/test/tiles/hover/hover-pane-controller.test.ts +418 -418
  203. package/test/tiles/list/tile-list-compact.test.ts +282 -282
  204. package/test/tiles/list/tile-list.test.ts +552 -552
  205. package/test/tiles/tile-dispatcher.test.ts +283 -283
  206. package/test/utils/format-date.test.ts +89 -89
  207. package/tsconfig.json +8 -3
  208. package/vite.config.ts +29 -22
@@ -290,7 +290,6 @@ export class CollectionBrowserDataSource {
290
290
  * @inheritdoc
291
291
  */
292
292
  getTileModelAt(index) {
293
- var _a, _b;
294
293
  const offsetIndex = index + this.offset;
295
294
  const expectedPageNum = Math.floor(offsetIndex / this.pageSize) + 1;
296
295
  const expectedIndexOnPage = offsetIndex % this.pageSize;
@@ -300,7 +299,7 @@ export class CollectionBrowserDataSource {
300
299
  if (!this.pages[page]) {
301
300
  // If we encounter a missing page, either we're past all the results or the page data is sparse.
302
301
  // So just return the tile at the expected position if it exists.
303
- return (_a = this.pages[expectedPageNum]) === null || _a === void 0 ? void 0 : _a[expectedIndexOnPage];
302
+ return this.pages[expectedPageNum]?.[expectedIndexOnPage];
304
303
  }
305
304
  if (tilesSeen + this.pages[page].length > offsetIndex) {
306
305
  return this.pages[page][offsetIndex - tilesSeen];
@@ -308,7 +307,7 @@ export class CollectionBrowserDataSource {
308
307
  tilesSeen += this.pages[page].length;
309
308
  page += 1;
310
309
  }
311
- return (_b = this.pages[expectedPageNum]) === null || _b === void 0 ? void 0 : _b[expectedIndexOnPage];
310
+ return this.pages[expectedPageNum]?.[expectedIndexOnPage];
312
311
  }
313
312
  /**
314
313
  * @inheritdoc
@@ -394,7 +393,6 @@ export class CollectionBrowserDataSource {
394
393
  * (i.e., they aren't suppressed or already loading, etc.)
395
394
  */
396
395
  get canFetchFacets() {
397
- var _a;
398
396
  // Don't fetch facets if they are suppressed entirely or not required for the current profile page element
399
397
  if (this.host.facetLoadStrategy === 'off')
400
398
  return false;
@@ -405,7 +403,7 @@ export class CollectionBrowserDataSource {
405
403
  if (this.host.facetLoadStrategy !== 'eager' && !this.facetsReadyToLoad)
406
404
  return false;
407
405
  // Don't fetch facets again if they are already fetched or pending
408
- const facetsAlreadyFetched = Object.keys((_a = this.aggregations) !== null && _a !== void 0 ? _a : {}).length > 0;
406
+ const facetsAlreadyFetched = Object.keys(this.aggregations ?? {}).length > 0;
409
407
  if (this.facetsLoading || facetsAlreadyFetched)
410
408
  return false;
411
409
  return true;
@@ -451,12 +449,11 @@ export class CollectionBrowserDataSource {
451
449
  * @inheritdoc
452
450
  */
453
451
  get canPerformSearch() {
454
- var _a, _b;
455
452
  if (!this.host.searchService)
456
453
  return false;
457
- const trimmedQuery = (_a = this.host.baseQuery) === null || _a === void 0 ? void 0 : _a.trim();
454
+ const trimmedQuery = this.host.baseQuery?.trim();
458
455
  const hasNonEmptyQuery = !!trimmedQuery;
459
- const hasIdentifiers = !!((_b = this.host.identifiers) === null || _b === void 0 ? void 0 : _b.length);
456
+ const hasIdentifiers = !!this.host.identifiers?.length;
460
457
  const isCollectionSearch = !!this.host.withinCollection;
461
458
  const isProfileSearch = !!this.host.withinProfile;
462
459
  const hasProfileElement = !!this.host.profileElement;
@@ -525,11 +522,10 @@ export class CollectionBrowserDataSource {
525
522
  * no longer relevant. Not meant to be human-readable.
526
523
  */
527
524
  get pageFetchQueryKey() {
528
- var _a, _b, _c;
529
525
  const profileKey = `pf;${this.host.withinProfile}--pe;${this.host.profileElement}`;
530
- const pageTarget = (_a = this.host.withinCollection) !== null && _a !== void 0 ? _a : profileKey;
531
- const sortField = (_b = this.host.selectedSort) !== null && _b !== void 0 ? _b : 'none';
532
- const sortDirection = (_c = this.host.sortDirection) !== null && _c !== void 0 ? _c : 'none';
526
+ const pageTarget = this.host.withinCollection ?? profileKey;
527
+ const sortField = this.host.selectedSort ?? 'none';
528
+ const sortDirection = this.host.sortDirection ?? 'none';
533
529
  return `fq:${this.fullQuery}-pt:${pageTarget}-st:${this.host.searchType}-sf:${sortField}-sd:${sortDirection}`;
534
530
  }
535
531
  /**
@@ -537,9 +533,8 @@ export class CollectionBrowserDataSource {
537
533
  * are not relevant in determining aggregation queries.
538
534
  */
539
535
  get facetFetchQueryKey() {
540
- var _a;
541
536
  const profileKey = `pf;${this.host.withinProfile}--pe;${this.host.profileElement}`;
542
- const pageTarget = (_a = this.host.withinCollection) !== null && _a !== void 0 ? _a : profileKey;
537
+ const pageTarget = this.host.withinCollection ?? profileKey;
543
538
  return `facets-fq:${this.fullQuery}-pt:${pageTarget}-st:${this.host.searchType}`;
544
539
  }
545
540
  /**
@@ -596,7 +591,6 @@ export class CollectionBrowserDataSource {
596
591
  * @returns A Promise resolving to the uid to apply to the request
597
592
  */
598
593
  async requestUID(params, kind) {
599
- var _a;
600
594
  const paramsToHash = JSON.stringify({
601
595
  pageType: params.pageType,
602
596
  pageTarget: params.pageTarget,
@@ -608,7 +602,7 @@ export class CollectionBrowserDataSource {
608
602
  });
609
603
  const fullQueryHash = (await sha1(paramsToHash)).slice(0, 20); // First 80 bits of SHA-1 are plenty for this
610
604
  const sessionId = (await this.host.getSessionId()).slice(0, 20); // Likewise
611
- const page = (_a = params.page) !== null && _a !== void 0 ? _a : 0;
605
+ const page = params.page ?? 0;
612
606
  const kindPrefix = kind.charAt(0); // f = full, h = hits, a = aggregations
613
607
  const currentTime = Date.now();
614
608
  return `R:${fullQueryHash}-S:${sessionId}-P:${page}-K:${kindPrefix}-T:${currentTime}`;
@@ -617,8 +611,7 @@ export class CollectionBrowserDataSource {
617
611
  * @inheritdoc
618
612
  */
619
613
  get pageSpecifierParams() {
620
- var _a;
621
- if ((_a = this.host.identifiers) === null || _a === void 0 ? void 0 : _a.length) {
614
+ if (this.host.identifiers?.length) {
622
615
  return {
623
616
  pageType: 'client_document_fetch',
624
617
  };
@@ -644,9 +637,8 @@ export class CollectionBrowserDataSource {
644
637
  * The full query, including year facets and date range clauses
645
638
  */
646
639
  get fullQuery() {
647
- var _a;
648
640
  const parts = [];
649
- const trimmedQuery = (_a = this.host.baseQuery) === null || _a === void 0 ? void 0 : _a.trim();
641
+ const trimmedQuery = this.host.baseQuery?.trim();
650
642
  if (trimmedQuery)
651
643
  parts.push(trimmedQuery);
652
644
  if (this.host.identifiers) {
@@ -667,14 +659,13 @@ export class CollectionBrowserDataSource {
667
659
  * Example: `mediatype:("collection" OR "audio" OR -"etree") AND year:("2000" OR "2001")`
668
660
  */
669
661
  get facetQuery() {
670
- var _a;
671
662
  if (!this.host.selectedFacets)
672
663
  return undefined;
673
664
  const facetClauses = [];
674
665
  for (const [facetName, facetValues] of Object.entries(this.host.selectedFacets)) {
675
666
  facetClauses.push(this.buildFacetClause(facetName, facetValues));
676
667
  }
677
- return (_a = this.joinFacetClauses(facetClauses)) === null || _a === void 0 ? void 0 : _a.trim();
668
+ return this.joinFacetClauses(facetClauses)?.trim();
678
669
  }
679
670
  get dateRangeQueryClause() {
680
671
  if (!this.host.minSelectedDate || !this.host.maxSelectedDate) {
@@ -762,8 +753,7 @@ export class CollectionBrowserDataSource {
762
753
  * the current search state.
763
754
  */
764
755
  async fetchFacets() {
765
- var _a, _b, _c, _d, _e, _f, _g;
766
- const trimmedQuery = (_a = this.host.baseQuery) === null || _a === void 0 ? void 0 : _a.trim();
756
+ const trimmedQuery = this.host.baseQuery?.trim();
767
757
  if (!this.canPerformSearch)
768
758
  return;
769
759
  const { facetFetchQueryKey } = this;
@@ -784,8 +774,8 @@ export class CollectionBrowserDataSource {
784
774
  // The default aggregations for the search_results page type should be what we need here.
785
775
  };
786
776
  params.uid = await this.requestUID({ ...params, sort: sortParams }, 'aggregations');
787
- const searchResponse = await ((_b = this.host.searchService) === null || _b === void 0 ? void 0 : _b.search(params, this.host.searchType));
788
- const success = searchResponse === null || searchResponse === void 0 ? void 0 : searchResponse.success;
777
+ const searchResponse = await this.host.searchService?.search(params, this.host.searchType);
778
+ const success = searchResponse?.success;
789
779
  // This is checking to see if the query has changed since the data was fetched.
790
780
  // If so, we just want to discard this set of aggregations because they are
791
781
  // likely no longer valid for the newer query.
@@ -794,11 +784,11 @@ export class CollectionBrowserDataSource {
794
784
  if (queryChangedSinceFetch)
795
785
  return;
796
786
  if (!success) {
797
- const errorMsg = (_c = searchResponse === null || searchResponse === void 0 ? void 0 : searchResponse.error) === null || _c === void 0 ? void 0 : _c.message;
798
- const detailMsg = (_e = (_d = searchResponse === null || searchResponse === void 0 ? void 0 : searchResponse.error) === null || _d === void 0 ? void 0 : _d.details) === null || _e === void 0 ? void 0 : _e.message;
787
+ const errorMsg = searchResponse?.error?.message;
788
+ const detailMsg = searchResponse?.error?.details?.message;
799
789
  if (!errorMsg && !detailMsg) {
800
790
  // @ts-expect-error: Property 'Sentry' does not exist on type 'Window & typeof globalThis'
801
- (_g = (_f = window === null || window === void 0 ? void 0 : window.Sentry) === null || _f === void 0 ? void 0 : _f.captureMessage) === null || _g === void 0 ? void 0 : _g.call(_f, 'Missing or malformed facet response from backend', 'error');
791
+ window?.Sentry?.captureMessage?.('Missing or malformed facet response from backend', 'error');
802
792
  }
803
793
  this.setFacetsLoading(false);
804
794
  return;
@@ -807,8 +797,8 @@ export class CollectionBrowserDataSource {
807
797
  this.aggregations = aggregations;
808
798
  this.histogramAggregation =
809
799
  this.host.searchType === SearchType.TV
810
- ? aggregations === null || aggregations === void 0 ? void 0 : aggregations.date_histogram
811
- : aggregations === null || aggregations === void 0 ? void 0 : aggregations.year_histogram;
800
+ ? aggregations?.date_histogram
801
+ : aggregations?.year_histogram;
812
802
  if (collectionTitles) {
813
803
  for (const [id, title] of Object.entries(collectionTitles)) {
814
804
  this.collectionTitles.set(id, title);
@@ -839,8 +829,7 @@ export class CollectionBrowserDataSource {
839
829
  * if `pageNumber != 1`, defaulting to a single page.
840
830
  */
841
831
  async fetchPage(pageNumber, numInitialPages = 1) {
842
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
843
- const trimmedQuery = (_a = this.host.baseQuery) === null || _a === void 0 ? void 0 : _a.trim();
832
+ const trimmedQuery = this.host.baseQuery?.trim();
844
833
  // reset loading status
845
834
  if (!this.canPerformSearch) {
846
835
  this.setSearchResultsLoading(false);
@@ -891,9 +880,9 @@ export class CollectionBrowserDataSource {
891
880
  };
892
881
  params.uid = await this.requestUID(params, 'hits');
893
882
  // log('=== FIRING PAGE REQUEST ===', params);
894
- const searchResponse = await ((_b = this.host.searchService) === null || _b === void 0 ? void 0 : _b.search(params, this.host.searchType));
883
+ const searchResponse = await this.host.searchService?.search(params, this.host.searchType);
895
884
  // log('=== RECEIVED PAGE RESPONSE IN CB ===', searchResponse);
896
- const success = searchResponse === null || searchResponse === void 0 ? void 0 : searchResponse.success;
885
+ const success = searchResponse?.success;
897
886
  // This is checking to see if the fetch has been invalidated since it was fired off.
898
887
  // If so, we just want to discard the response since it is for an obsolete query state.
899
888
  if (!this.fetchesInProgress.has(currentPageKey))
@@ -902,13 +891,13 @@ export class CollectionBrowserDataSource {
902
891
  this.fetchesInProgress.delete(`${pageFetchQueryKey}-p:${pageNumber + i}`);
903
892
  }
904
893
  if (!success) {
905
- const errorMsg = (_c = searchResponse === null || searchResponse === void 0 ? void 0 : searchResponse.error) === null || _c === void 0 ? void 0 : _c.message;
906
- const detailMsg = (_e = (_d = searchResponse === null || searchResponse === void 0 ? void 0 : searchResponse.error) === null || _d === void 0 ? void 0 : _d.details) === null || _e === void 0 ? void 0 : _e.message;
907
- this.queryErrorMessage = `${errorMsg !== null && errorMsg !== void 0 ? errorMsg : ''}${detailMsg ? `; ${detailMsg}` : ''}`;
894
+ const errorMsg = searchResponse?.error?.message;
895
+ const detailMsg = searchResponse?.error?.details?.message;
896
+ this.queryErrorMessage = `${errorMsg ?? ''}${detailMsg ? `; ${detailMsg}` : ''}`;
908
897
  if (!this.queryErrorMessage) {
909
898
  this.queryErrorMessage = 'Missing or malformed response from backend';
910
899
  // @ts-expect-error: Property 'Sentry' does not exist on type 'Window & typeof globalThis'
911
- (_g = (_f = window === null || window === void 0 ? void 0 : window.Sentry) === null || _f === void 0 ? void 0 : _f.captureMessage) === null || _g === void 0 ? void 0 : _g.call(_f, this.queryErrorMessage, 'error');
900
+ window?.Sentry?.captureMessage?.(this.queryErrorMessage, 'error');
912
901
  }
913
902
  this.setSearchResultsLoading(false);
914
903
  this.requestHostUpdate();
@@ -929,10 +918,10 @@ export class CollectionBrowserDataSource {
929
918
  this.host.applyDefaultCollectionSort(this.collectionExtraInfo);
930
919
  }
931
920
  if (this.collectionExtraInfo) {
932
- this.parentCollections = [].concat((_j = (_h = this.collectionExtraInfo.public_metadata) === null || _h === void 0 ? void 0 : _h.collection) !== null && _j !== void 0 ? _j : []);
921
+ this.parentCollections = [].concat(this.collectionExtraInfo.public_metadata?.collection ?? []);
933
922
  // Update the TV collection status now that we know the parent collections
934
923
  this.host.isTVCollection =
935
- ((_k = this.host.withinCollection) === null || _k === void 0 ? void 0 : _k.startsWith('TV-')) ||
924
+ this.host.withinCollection?.startsWith('TV-') ||
936
925
  this.host.withinCollection === 'tvnews' ||
937
926
  this.host.withinCollection === 'tvarchive' ||
938
927
  this.parentCollections.includes('tvnews') ||
@@ -952,7 +941,7 @@ export class CollectionBrowserDataSource {
952
941
  this.collectionTitles.set(id, title);
953
942
  }
954
943
  // Also add the target collection's title if available
955
- const targetTitle = (_m = (_l = this.collectionExtraInfo) === null || _l === void 0 ? void 0 : _l.public_metadata) === null || _m === void 0 ? void 0 : _m.title;
944
+ const targetTitle = this.collectionExtraInfo?.public_metadata?.title;
956
945
  if (withinCollection && targetTitle) {
957
946
  this.collectionTitles.set(withinCollection, targetTitle);
958
947
  }
@@ -1011,7 +1000,7 @@ export class CollectionBrowserDataSource {
1011
1000
  addFetchedResultsToDataSource(pageNumber, results, needsReload = true) {
1012
1001
  const tiles = [];
1013
1002
  const requestSource = this.hitRequestSource;
1014
- results === null || results === void 0 ? void 0 : results.forEach(result => {
1003
+ results?.forEach(result => {
1015
1004
  if (!result.identifier)
1016
1005
  return;
1017
1006
  tiles.push(new TileModel(result, requestSource));
@@ -1025,8 +1014,7 @@ export class CollectionBrowserDataSource {
1025
1014
  * Fetches the aggregation buckets for the given prefix filter type.
1026
1015
  */
1027
1016
  async fetchPrefixFilterBuckets(filterType) {
1028
- var _a, _b, _c, _d, _e, _f, _g;
1029
- const trimmedQuery = (_a = this.host.baseQuery) === null || _a === void 0 ? void 0 : _a.trim();
1017
+ const trimmedQuery = this.host.baseQuery?.trim();
1030
1018
  if (!this.canPerformSearch)
1031
1019
  return [];
1032
1020
  const filterAggregationKey = prefixFilterAggregationKeys[filterType];
@@ -1043,8 +1031,8 @@ export class CollectionBrowserDataSource {
1043
1031
  aggregationsSize: 26,
1044
1032
  };
1045
1033
  params.uid = await this.requestUID({ ...params, sort: sortParams }, 'aggregations');
1046
- const searchResponse = await ((_b = this.host.searchService) === null || _b === void 0 ? void 0 : _b.search(params, this.host.searchType));
1047
- return ((_g = (_f = (_e = (_d = (_c = searchResponse === null || searchResponse === void 0 ? void 0 : searchResponse.success) === null || _c === void 0 ? void 0 : _c.response) === null || _d === void 0 ? void 0 : _d.aggregations) === null || _e === void 0 ? void 0 : _e[filterAggregationKey]) === null || _f === void 0 ? void 0 : _f.buckets) !== null && _g !== void 0 ? _g : []);
1034
+ const searchResponse = await this.host.searchService?.search(params, this.host.searchType);
1035
+ return (searchResponse?.success?.response?.aggregations?.[filterAggregationKey]?.buckets ?? []);
1048
1036
  }
1049
1037
  /**
1050
1038
  * Fetches and caches the prefix filter counts for the given filter type.