@internetarchive/collection-browser 2.7.7-alpha.2 → 2.7.8-alpha1

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 (304) hide show
  1. package/.github/workflows/ci.yml +3 -3
  2. package/dist/index.js +2 -0
  3. package/dist/index.js.map +1 -1
  4. package/dist/src/app-root.d.ts +9 -1
  5. package/dist/src/app-root.js +40 -6
  6. package/dist/src/app-root.js.map +1 -1
  7. package/dist/src/assets/img/icons/arrow-left.d.ts +1 -1
  8. package/dist/src/assets/img/icons/arrow-right.d.ts +1 -1
  9. package/dist/src/assets/img/icons/chevron.d.ts +1 -1
  10. package/dist/src/assets/img/icons/contract.d.ts +1 -1
  11. package/dist/src/assets/img/icons/empty-query.d.ts +1 -1
  12. package/dist/src/assets/img/icons/expand.d.ts +1 -1
  13. package/dist/src/assets/img/icons/eye-closed.d.ts +1 -1
  14. package/dist/src/assets/img/icons/eye.d.ts +1 -1
  15. package/dist/src/assets/img/icons/favorite-filled.d.ts +1 -1
  16. package/dist/src/assets/img/icons/favorite-unfilled.d.ts +1 -1
  17. package/dist/src/assets/img/icons/filter.d.ts +1 -1
  18. package/dist/src/assets/img/icons/login-required.d.ts +1 -1
  19. package/dist/src/assets/img/icons/mediatype/account.d.ts +1 -1
  20. package/dist/src/assets/img/icons/mediatype/audio.d.ts +1 -1
  21. package/dist/src/assets/img/icons/mediatype/collection.d.ts +1 -1
  22. package/dist/src/assets/img/icons/mediatype/data.d.ts +1 -1
  23. package/dist/src/assets/img/icons/mediatype/etree.d.ts +1 -1
  24. package/dist/src/assets/img/icons/mediatype/film.d.ts +1 -1
  25. package/dist/src/assets/img/icons/mediatype/images.d.ts +1 -1
  26. package/dist/src/assets/img/icons/mediatype/radio.d.ts +1 -1
  27. package/dist/src/assets/img/icons/mediatype/search.d.ts +1 -1
  28. package/dist/src/assets/img/icons/mediatype/software.d.ts +1 -1
  29. package/dist/src/assets/img/icons/mediatype/texts.d.ts +1 -1
  30. package/dist/src/assets/img/icons/mediatype/tv.d.ts +1 -1
  31. package/dist/src/assets/img/icons/mediatype/video.d.ts +1 -1
  32. package/dist/src/assets/img/icons/mediatype/web.d.ts +1 -1
  33. package/dist/src/assets/img/icons/null-result.d.ts +1 -1
  34. package/dist/src/assets/img/icons/restricted.d.ts +1 -1
  35. package/dist/src/assets/img/icons/reviews.d.ts +1 -1
  36. package/dist/src/assets/img/icons/upload.d.ts +1 -1
  37. package/dist/src/assets/img/icons/views.d.ts +1 -1
  38. package/dist/src/circular-activity-indicator.d.ts +1 -1
  39. package/dist/src/circular-activity-indicator.js.map +1 -1
  40. package/dist/src/collection-browser.d.ts +21 -1
  41. package/dist/src/collection-browser.js +60 -17
  42. package/dist/src/collection-browser.js.map +1 -1
  43. package/dist/src/collection-facets/facet-row.js.map +1 -1
  44. package/dist/src/collection-facets/facet-tombstone-row.d.ts +1 -1
  45. package/dist/src/collection-facets/facet-tombstone-row.js.map +1 -1
  46. package/dist/src/collection-facets/facets-template.js +5 -5
  47. package/dist/src/collection-facets/facets-template.js.map +1 -1
  48. package/dist/src/collection-facets/more-facets-content.d.ts +1 -1
  49. package/dist/src/collection-facets/more-facets-content.js +4 -2
  50. package/dist/src/collection-facets/more-facets-content.js.map +1 -1
  51. package/dist/src/collection-facets/more-facets-pagination.js +0 -1
  52. package/dist/src/collection-facets/more-facets-pagination.js.map +1 -1
  53. package/dist/src/collection-facets/smart-facets/dedupe.js.map +1 -1
  54. package/dist/src/collection-facets/smart-facets/heuristics/query-keywords-heuristic.js.map +1 -1
  55. package/dist/src/collection-facets/smart-facets/heuristics/wikidata-heuristic.js +1 -1
  56. package/dist/src/collection-facets/smart-facets/heuristics/wikidata-heuristic.js.map +1 -1
  57. package/dist/src/collection-facets/smart-facets/models.d.ts +2 -2
  58. package/dist/src/collection-facets/smart-facets/smart-facet-bar.js +4 -1
  59. package/dist/src/collection-facets/smart-facets/smart-facet-bar.js.map +1 -1
  60. package/dist/src/collection-facets/smart-facets/smart-facet-button.d.ts +1 -1
  61. package/dist/src/collection-facets/smart-facets/smart-facet-button.js.map +1 -1
  62. package/dist/src/collection-facets/smart-facets/smart-facet-dropdown.d.ts +1 -1
  63. package/dist/src/collection-facets/smart-facets/smart-facet-dropdown.js.map +1 -1
  64. package/dist/src/collection-facets/smart-facets/smart-facet-heuristics.js.map +1 -1
  65. package/dist/src/collection-facets/toggle-switch.d.ts +2 -2
  66. package/dist/src/collection-facets/toggle-switch.js +2 -2
  67. package/dist/src/collection-facets/toggle-switch.js.map +1 -1
  68. package/dist/src/collection-facets.js +3 -2
  69. package/dist/src/collection-facets.js.map +1 -1
  70. package/dist/src/data-source/collection-browser-data-source-interface.d.ts +4 -0
  71. package/dist/src/data-source/collection-browser-data-source-interface.js.map +1 -1
  72. package/dist/src/data-source/collection-browser-data-source.d.ts +4 -0
  73. package/dist/src/data-source/collection-browser-data-source.js +22 -8
  74. package/dist/src/data-source/collection-browser-data-source.js.map +1 -1
  75. package/dist/src/data-source/collection-browser-query-state.d.ts +1 -0
  76. package/dist/src/data-source/collection-browser-query-state.js.map +1 -1
  77. package/dist/src/data-source/models.d.ts +2 -2
  78. package/dist/src/empty-placeholder.d.ts +1 -1
  79. package/dist/src/empty-placeholder.js +11 -10
  80. package/dist/src/empty-placeholder.js.map +1 -1
  81. package/dist/src/expanded-date-picker.js.map +1 -1
  82. package/dist/src/language-code-handler/language-code-handler.js.map +1 -1
  83. package/dist/src/language-code-handler/language-code-mapping.js +86 -86
  84. package/dist/src/language-code-handler/language-code-mapping.js.map +1 -1
  85. package/dist/src/manage/manage-bar.d.ts +32 -9
  86. package/dist/src/manage/manage-bar.js +121 -27
  87. package/dist/src/manage/manage-bar.js.map +1 -1
  88. package/dist/src/manage/remove-items-modal-content.d.ts +9 -0
  89. package/dist/src/manage/remove-items-modal-content.js +104 -0
  90. package/dist/src/manage/remove-items-modal-content.js.map +1 -0
  91. package/dist/src/mediatype/mediatype-config.js +0 -1
  92. package/dist/src/mediatype/mediatype-config.js.map +1 -1
  93. package/dist/src/models.d.ts +24 -15
  94. package/dist/src/models.js +3 -3
  95. package/dist/src/models.js.map +1 -1
  96. package/dist/src/restoration-state-handler.js +1 -0
  97. package/dist/src/restoration-state-handler.js.map +1 -1
  98. package/dist/src/sort-filter-bar/alpha-bar-tooltip.d.ts +1 -1
  99. package/dist/src/sort-filter-bar/alpha-bar-tooltip.js.map +1 -1
  100. package/dist/src/sort-filter-bar/alpha-bar.js +9 -9
  101. package/dist/src/sort-filter-bar/alpha-bar.js.map +1 -1
  102. package/dist/src/sort-filter-bar/img/compact.d.ts +1 -1
  103. package/dist/src/sort-filter-bar/img/list.d.ts +1 -1
  104. package/dist/src/sort-filter-bar/img/sort-toggle-disabled.d.ts +1 -1
  105. package/dist/src/sort-filter-bar/img/sort-toggle-down.d.ts +1 -1
  106. package/dist/src/sort-filter-bar/img/sort-toggle-up.d.ts +1 -1
  107. package/dist/src/sort-filter-bar/img/sort-triangle.d.ts +1 -1
  108. package/dist/src/sort-filter-bar/img/tile.d.ts +1 -1
  109. package/dist/src/sort-filter-bar/sort-filter-bar.d.ts +1 -1
  110. package/dist/src/sort-filter-bar/sort-filter-bar.js +2 -1
  111. package/dist/src/sort-filter-bar/sort-filter-bar.js.map +1 -1
  112. package/dist/src/tiles/base-tile-component.js.map +1 -1
  113. package/dist/src/tiles/collection-browser-loading-tile.d.ts +1 -1
  114. package/dist/src/tiles/collection-browser-loading-tile.js.map +1 -1
  115. package/dist/src/tiles/grid/account-tile.js.map +1 -1
  116. package/dist/src/tiles/grid/collection-tile.js.map +1 -1
  117. package/dist/src/tiles/grid/item-tile.js +3 -2
  118. package/dist/src/tiles/grid/item-tile.js.map +1 -1
  119. package/dist/src/tiles/grid/search-tile.js.map +1 -1
  120. package/dist/src/tiles/grid/tile-stats.d.ts +1 -1
  121. package/dist/src/tiles/grid/tile-stats.js +2 -2
  122. package/dist/src/tiles/grid/tile-stats.js.map +1 -1
  123. package/dist/src/tiles/hover/hover-pane-controller.js.map +1 -1
  124. package/dist/src/tiles/hover/tile-hover-pane.d.ts +1 -1
  125. package/dist/src/tiles/hover/tile-hover-pane.js +1 -3
  126. package/dist/src/tiles/hover/tile-hover-pane.js.map +1 -1
  127. package/dist/src/tiles/image-block.d.ts +1 -1
  128. package/dist/src/tiles/image-block.js +1 -1
  129. package/dist/src/tiles/image-block.js.map +1 -1
  130. package/dist/src/tiles/item-image.d.ts +1 -1
  131. package/dist/src/tiles/item-image.js +2 -2
  132. package/dist/src/tiles/item-image.js.map +1 -1
  133. package/dist/src/tiles/list/tile-list-compact-header.d.ts +1 -1
  134. package/dist/src/tiles/list/tile-list-compact-header.js.map +1 -1
  135. package/dist/src/tiles/list/tile-list-compact.d.ts +1 -1
  136. package/dist/src/tiles/list/tile-list-compact.js.map +1 -1
  137. package/dist/src/tiles/list/tile-list.js +6 -4
  138. package/dist/src/tiles/list/tile-list.js.map +1 -1
  139. package/dist/src/tiles/mediatype-icon.d.ts +1 -1
  140. package/dist/src/tiles/mediatype-icon.js.map +1 -1
  141. package/dist/src/tiles/overlay/icon-overlay.js.map +1 -1
  142. package/dist/src/tiles/overlay/text-overlay.js.map +1 -1
  143. package/dist/src/tiles/review-block.js.map +1 -1
  144. package/dist/src/tiles/text-snippet-block.js.map +1 -1
  145. package/dist/src/tiles/tile-dispatcher.d.ts +1 -1
  146. package/dist/src/tiles/tile-dispatcher.js.map +1 -1
  147. package/dist/src/tiles/tile-display-value-provider.js.map +1 -1
  148. package/dist/src/utils/facet-utils.js.map +1 -1
  149. package/dist/src/utils/format-count.d.ts +2 -2
  150. package/dist/src/utils/format-count.js +1 -0
  151. package/dist/src/utils/format-count.js.map +1 -1
  152. package/dist/src/utils/format-date.d.ts +1 -1
  153. package/dist/src/utils/format-date.js.map +1 -1
  154. package/dist/src/utils/format-unit-size.js.map +1 -1
  155. package/dist/src/utils/log.js +3 -1
  156. package/dist/src/utils/log.js.map +1 -1
  157. package/dist/src/utils/resolve-mediatype.js.map +1 -1
  158. package/dist/test/collection-browser.test.js +17 -2
  159. package/dist/test/collection-browser.test.js.map +1 -1
  160. package/dist/test/collection-facets/facet-row.test.js +1 -4
  161. package/dist/test/collection-facets/facet-row.test.js.map +1 -1
  162. package/dist/test/collection-facets/facets-template.test.js.map +1 -1
  163. package/dist/test/collection-facets/more-facets-content.test.js +1 -0
  164. package/dist/test/collection-facets/more-facets-content.test.js.map +1 -1
  165. package/dist/test/collection-facets/more-facets-pagination.test.js +1 -0
  166. package/dist/test/collection-facets/more-facets-pagination.test.js.map +1 -1
  167. package/dist/test/collection-facets/toggle-switch.test.js +3 -12
  168. package/dist/test/collection-facets/toggle-switch.test.js.map +1 -1
  169. package/dist/test/collection-facets.test.js +1 -0
  170. package/dist/test/collection-facets.test.js.map +1 -1
  171. package/dist/test/data-source/collection-browser-data-source.test.js.map +1 -1
  172. package/dist/test/empty-placeholder.test.js +1 -0
  173. package/dist/test/empty-placeholder.test.js.map +1 -1
  174. package/dist/test/expanded-date-picker.test.js.map +1 -1
  175. package/dist/test/icon-overlay.test.js +1 -0
  176. package/dist/test/icon-overlay.test.js.map +1 -1
  177. package/dist/test/image-block.test.js +1 -0
  178. package/dist/test/image-block.test.js.map +1 -1
  179. package/dist/test/item-image.test.js +1 -0
  180. package/dist/test/item-image.test.js.map +1 -1
  181. package/dist/test/manage/manage-bar.test.d.ts +1 -0
  182. package/dist/test/manage/manage-bar.test.js +26 -10
  183. package/dist/test/manage/manage-bar.test.js.map +1 -1
  184. package/dist/test/manage/remove-items-modal-content.test.d.ts +1 -0
  185. package/dist/test/manage/remove-items-modal-content.test.js +66 -0
  186. package/dist/test/manage/remove-items-modal-content.test.js.map +1 -0
  187. package/dist/test/mocks/mock-search-responses.js.map +1 -1
  188. package/dist/test/mocks/mock-search-service.js.map +1 -1
  189. package/dist/test/restoration-state-handler.test.js.map +1 -1
  190. package/dist/test/review-block.test.js +1 -0
  191. package/dist/test/review-block.test.js.map +1 -1
  192. package/dist/test/sort-filter-bar/alpha-bar-tooltip.test.js.map +1 -1
  193. package/dist/test/sort-filter-bar/alpha-bar.test.js.map +1 -1
  194. package/dist/test/sort-filter-bar/sort-filter-bar.test.js +1 -0
  195. package/dist/test/sort-filter-bar/sort-filter-bar.test.js.map +1 -1
  196. package/dist/test/text-overlay.test.js +1 -0
  197. package/dist/test/text-overlay.test.js.map +1 -1
  198. package/dist/test/text-snippet-block.test.js +1 -0
  199. package/dist/test/text-snippet-block.test.js.map +1 -1
  200. package/dist/test/tile-stats.test.js +23 -22
  201. package/dist/test/tile-stats.test.js.map +1 -1
  202. package/dist/test/tiles/grid/account-tile.test.js +1 -0
  203. package/dist/test/tiles/grid/account-tile.test.js.map +1 -1
  204. package/dist/test/tiles/grid/collection-tile.test.js +1 -0
  205. package/dist/test/tiles/grid/collection-tile.test.js.map +1 -1
  206. package/dist/test/tiles/grid/item-tile.test.js +1 -0
  207. package/dist/test/tiles/grid/item-tile.test.js.map +1 -1
  208. package/dist/test/tiles/grid/search-tile.test.js +1 -0
  209. package/dist/test/tiles/grid/search-tile.test.js.map +1 -1
  210. package/dist/test/tiles/hover/hover-pane-controller.test.js.map +1 -1
  211. package/dist/test/tiles/hover/tile-hover-pane.test.js.map +1 -1
  212. package/dist/test/tiles/list/tile-list-compact.test.js +1 -0
  213. package/dist/test/tiles/list/tile-list-compact.test.js.map +1 -1
  214. package/dist/test/tiles/list/tile-list.test.js +1 -0
  215. package/dist/test/tiles/list/tile-list.test.js.map +1 -1
  216. package/dist/test/tiles/tile-dispatcher.test.js.map +1 -1
  217. package/dist/test/utils/format-count.test.js.map +1 -1
  218. package/dist/test/utils/format-date.test.js.map +1 -1
  219. package/dist/test/utils/local-date-from-utc.test.js.map +1 -1
  220. package/index.html +3 -0
  221. package/package.json +38 -40
  222. package/src/app-root.ts +60 -25
  223. package/src/collection-browser.ts +101 -50
  224. package/src/collection-facets/facets-template.ts +6 -7
  225. package/src/collection-facets/more-facets-content.ts +13 -11
  226. package/src/collection-facets/more-facets-pagination.ts +2 -3
  227. package/src/collection-facets/smart-facets/dedupe.ts +2 -2
  228. package/src/collection-facets/smart-facets/heuristics/query-keywords-heuristic.ts +1 -1
  229. package/src/collection-facets/smart-facets/heuristics/wikidata-heuristic.ts +6 -6
  230. package/src/collection-facets/smart-facets/smart-facet-bar.ts +8 -6
  231. package/src/collection-facets/smart-facets/smart-facet-button.ts +3 -5
  232. package/src/collection-facets/smart-facets/smart-facet-dropdown.ts +4 -4
  233. package/src/collection-facets/smart-facets/smart-facet-heuristics.ts +1 -1
  234. package/src/collection-facets/toggle-switch.ts +2 -2
  235. package/src/collection-facets.ts +19 -18
  236. package/src/data-source/collection-browser-data-source-interface.ts +6 -5
  237. package/src/data-source/collection-browser-data-source.ts +48 -37
  238. package/src/data-source/collection-browser-query-state.ts +1 -0
  239. package/src/empty-placeholder.ts +16 -19
  240. package/src/expanded-date-picker.ts +1 -1
  241. package/src/language-code-handler/language-code-handler.ts +1 -1
  242. package/src/manage/manage-bar.ts +132 -38
  243. package/src/manage/remove-items-modal-content.ts +102 -0
  244. package/src/mediatype/mediatype-config.ts +0 -1
  245. package/src/models.ts +13 -3
  246. package/src/restoration-state-handler.ts +15 -14
  247. package/src/sort-filter-bar/alpha-bar.ts +17 -16
  248. package/src/sort-filter-bar/sort-filter-bar.ts +15 -14
  249. package/src/tiles/grid/account-tile.ts +1 -1
  250. package/src/tiles/grid/collection-tile.ts +1 -1
  251. package/src/tiles/grid/item-tile.ts +9 -9
  252. package/src/tiles/grid/tile-stats.ts +4 -4
  253. package/src/tiles/hover/hover-pane-controller.ts +1 -1
  254. package/src/tiles/hover/tile-hover-pane.ts +2 -4
  255. package/src/tiles/item-image.ts +1 -1
  256. package/src/tiles/list/tile-list-compact.ts +2 -2
  257. package/src/tiles/list/tile-list.ts +24 -22
  258. package/src/tiles/tile-dispatcher.ts +5 -5
  259. package/src/tiles/tile-display-value-provider.ts +4 -4
  260. package/src/utils/facet-utils.ts +6 -6
  261. package/src/utils/format-count.ts +3 -2
  262. package/src/utils/format-date.ts +1 -1
  263. package/src/utils/format-unit-size.ts +1 -1
  264. package/src/utils/log.ts +3 -1
  265. package/test/collection-browser.test.ts +145 -123
  266. package/test/collection-facets/facet-row.test.ts +28 -31
  267. package/test/collection-facets/facets-template.test.ts +9 -9
  268. package/test/collection-facets/more-facets-content.test.ts +15 -14
  269. package/test/collection-facets/more-facets-pagination.test.ts +19 -18
  270. package/test/collection-facets/toggle-switch.test.ts +18 -28
  271. package/test/collection-facets.test.ts +37 -36
  272. package/test/data-source/collection-browser-data-source.test.ts +2 -2
  273. package/test/empty-placeholder.test.ts +7 -6
  274. package/test/expanded-date-picker.test.ts +18 -17
  275. package/test/icon-overlay.test.ts +1 -0
  276. package/test/image-block.test.ts +7 -6
  277. package/test/item-image.test.ts +1 -0
  278. package/test/manage/manage-bar.test.ts +52 -28
  279. package/test/manage/remove-items-modal-content.test.ts +82 -0
  280. package/test/mocks/mock-search-responses.ts +1 -2
  281. package/test/mocks/mock-search-service.ts +1 -1
  282. package/test/restoration-state-handler.test.ts +12 -12
  283. package/test/review-block.test.ts +2 -1
  284. package/test/sort-filter-bar/alpha-bar-tooltip.test.ts +1 -1
  285. package/test/sort-filter-bar/alpha-bar.test.ts +5 -5
  286. package/test/sort-filter-bar/sort-filter-bar.test.ts +39 -38
  287. package/test/text-overlay.test.ts +1 -0
  288. package/test/text-snippet-block.test.ts +6 -5
  289. package/test/tile-stats.test.ts +35 -26
  290. package/test/tiles/grid/account-tile.test.ts +3 -2
  291. package/test/tiles/grid/collection-tile.test.ts +4 -3
  292. package/test/tiles/grid/item-tile.test.ts +14 -13
  293. package/test/tiles/grid/search-tile.test.ts +2 -1
  294. package/test/tiles/hover/hover-pane-controller.test.ts +15 -15
  295. package/test/tiles/hover/tile-hover-pane.test.ts +5 -5
  296. package/test/tiles/list/tile-list-compact.test.ts +2 -1
  297. package/test/tiles/list/tile-list.test.ts +11 -10
  298. package/test/tiles/tile-dispatcher.test.ts +5 -5
  299. package/test/utils/format-count.test.ts +1 -1
  300. package/test/utils/format-date.test.ts +1 -1
  301. package/test/utils/local-date-from-utc.test.ts +1 -1
  302. package/tsconfig.json +1 -0
  303. package/.prettierignore +0 -1
  304. package/eslint.config.mjs +0 -53
@@ -1,3 +1,4 @@
1
+ /* eslint-disable import/no-duplicates */
1
2
  import {
2
3
  html,
3
4
  css,
@@ -56,7 +57,6 @@ import type {
56
57
  } from './data-source/collection-browser-query-state';
57
58
  import { FACETLESS_PAGE_ELEMENTS } from './data-source/models';
58
59
  import type { CollectionFacets } from './collection-facets';
59
- import type { ManageableItem } from './manage/manage-bar';
60
60
  import type { CollectionBrowserDataSourceInterface } from './data-source/collection-browser-data-source-interface';
61
61
  import {
62
62
  analyticsActions,
@@ -65,9 +65,9 @@ import {
65
65
  import chevronIcon from './assets/img/icons/chevron';
66
66
  import { srOnlyStyle } from './styles/sr-only';
67
67
  import { sha1 } from './utils/sha1';
68
- import { formatDate } from './utils/format-date';
69
68
  import { log } from './utils/log';
70
69
  import type { PlaceholderType } from './empty-placeholder';
70
+ import type { ManageBar } from './manage/manage-bar';
71
71
 
72
72
  import './empty-placeholder';
73
73
  import './tiles/tile-dispatcher';
@@ -220,10 +220,11 @@ export class CollectionBrowser
220
220
  @property({ type: String }) pageContext: CollectionBrowserContext = 'search';
221
221
 
222
222
  @property({ type: Object })
223
- restorationStateHandler: RestorationStateHandlerInterface =
224
- new RestorationStateHandler({
223
+ restorationStateHandler: RestorationStateHandlerInterface = new RestorationStateHandler(
224
+ {
225
225
  context: this.pageContext,
226
- });
226
+ }
227
+ );
227
228
 
228
229
  @property({ type: Number }) mobileBreakpoint = 600;
229
230
 
@@ -261,6 +262,12 @@ export class CollectionBrowser
261
262
  @property({ type: Object }) dataSource: CollectionBrowserDataSourceInterface =
262
263
  new CollectionBrowserDataSource(this, this.pageSize);
263
264
 
265
+ /**
266
+ * The maximum number of pages we will load when a privileged user clicks
267
+ * the "Manage" button on the search page. Limited to 15 pages.
268
+ */
269
+ maxPagesToManage = 15;
270
+
264
271
  /**
265
272
  * The page that the consumer wants to load.
266
273
  */
@@ -297,6 +304,8 @@ export class CollectionBrowser
297
304
 
298
305
  @query('collection-facets') private collectionFacets?: CollectionFacets;
299
306
 
307
+ @query('manage-bar') private manageBar?: ManageBar;
308
+
300
309
  @property({ type: Object, attribute: false })
301
310
  analyticsHandler?: AnalyticsManagerInterface;
302
311
 
@@ -385,7 +394,7 @@ export class CollectionBrowser
385
394
 
386
395
  sessionStorage?.setItem('cb-session', newSessionId);
387
396
  return newSessionId;
388
- } catch {
397
+ } catch (err) {
389
398
  // Either we can't generate the hash or we're restricted from accessing sessionStorage
390
399
  return '';
391
400
  }
@@ -772,20 +781,29 @@ export class CollectionBrowser
772
781
  * showing the management view. This generally replaces the sort bar when present.
773
782
  */
774
783
  private get manageBarTemplate(): TemplateResult {
784
+ const manageViewModalMsg =
785
+ this.profileElement === 'uploads'
786
+ ? 'Note: it may take a few minutes for these items to stop appearing in your uploads list.'
787
+ : nothing;
788
+
775
789
  return html`
776
790
  <manage-bar
777
791
  .label=${this.manageViewLabel}
778
- .pageContext=${this.pageContext}
792
+ .modalManager=${this.modalManager}
793
+ .selectedItems=${this.dataSource.checkedTileModels}
794
+ .manageViewModalMsg=${manageViewModalMsg}
779
795
  showSelectAll
780
796
  showUnselectAll
797
+ ?showItemManageButton=${this.pageContext === 'search'}
781
798
  ?removeAllowed=${this.dataSource.checkedTileModels.length !== 0}
782
799
  @removeItems=${this.handleRemoveItems}
783
- @itemsManager=${this.handleItemsManager}
800
+ @manageItems=${this.handleManageItems}
784
801
  @selectAll=${() => this.dataSource.checkAllTiles()}
785
802
  @unselectAll=${() => this.dataSource.uncheckAllTiles()}
786
803
  @cancel=${() => {
787
804
  this.isManageView = false;
788
805
  this.dataSource.uncheckAllTiles();
806
+ if (this.searchResultsLoading) this.dataSource.resetPages();
789
807
  }}
790
808
  ></manage-bar>
791
809
  `;
@@ -797,34 +815,45 @@ export class CollectionBrowser
797
815
  */
798
816
  private handleRemoveItems(): void {
799
817
  this.dispatchEvent(
800
- new CustomEvent<{ items: ManageableItem[] }>('itemRemovalRequested', {
818
+ new CustomEvent<{ items: String[] }>('itemRemovalRequested', {
801
819
  detail: {
802
- items: this.dataSource.checkedTileModels.map(model => {
803
- const cloned = model.clone();
804
- cloned.dateStr = formatDate(model.datePublished, 'long');
805
- return cloned as ManageableItem;
806
- }),
820
+ items: this.dataSource.checkedTileModels.map(model =>
821
+ model?.identifier ? model.identifier : ''
822
+ ),
807
823
  },
808
- }),
824
+ })
809
825
  );
810
826
  }
811
827
 
812
828
  /**
813
829
  * Handler when user request to bulk edit from /search/ page
814
830
  */
815
- private handleItemsManager(): void {
831
+ private handleManageItems(): void {
816
832
  this.dispatchEvent(
817
- new CustomEvent('itemManagerRequested', {
833
+ new CustomEvent<{ items: String[] }>('itemManagerRequested', {
818
834
  detail: {
819
- items: this.dataSource.checkedTileModels
820
- .map(item => item.identifier)
821
- .filter(Boolean)
822
- .join(','),
835
+ items: this.dataSource.checkedTileModels.map(model =>
836
+ model?.identifier ? model.identifier : ''
837
+ ),
823
838
  },
824
- }),
839
+ })
825
840
  );
826
841
  }
827
842
 
843
+ /**
844
+ * Handler to show processing modal while removing item
845
+ */
846
+ showRemoveItemsProcessingModal(): void {
847
+ this.manageBar?.showRemoveItemsProcessingModal();
848
+ }
849
+
850
+ /**
851
+ * Handler to show error modal when item removal failed
852
+ */
853
+ showRemoveItemsErrorModal(): void {
854
+ this.manageBar?.showRemoveItemsErrorModal();
855
+ }
856
+
828
857
  /**
829
858
  * Removes all tile models that are currently checked & adjusts the paging
830
859
  * of the data source to account for any new gaps in the data.
@@ -840,7 +869,7 @@ export class CollectionBrowser
840
869
  e: CustomEvent<{
841
870
  selectedSort: SortField;
842
871
  sortDirection: SortDirection | null;
843
- }>,
872
+ }>
844
873
  ) {
845
874
  const { selectedSort, sortDirection } = e.detail;
846
875
  this.selectedSort = selectedSort;
@@ -914,7 +943,7 @@ export class CollectionBrowser
914
943
  * Handler for when the display mode option is changed (grid/list/compact-list views).
915
944
  */
916
945
  private displayModeChanged(
917
- e: CustomEvent<{ displayMode?: CollectionDisplayMode }>,
946
+ e: CustomEvent<{ displayMode?: CollectionDisplayMode }>
918
947
  ): void {
919
948
  this.displayMode = e.detail.displayMode;
920
949
 
@@ -971,7 +1000,7 @@ export class CollectionBrowser
971
1000
  * labels: 'start-<ToLetter>' | 'clear-<FromLetter>' | '<FromLetter>-<ToLetter>'
972
1001
  */
973
1002
  private sendFilterByCreatorAnalytics(
974
- prevSelectedLetter: string | null,
1003
+ prevSelectedLetter: string | null
975
1004
  ): void {
976
1005
  if (!prevSelectedLetter && !this.selectedCreatorFilter) {
977
1006
  return;
@@ -991,7 +1020,7 @@ export class CollectionBrowser
991
1020
  * Handler for changes to which letter is selected in the title alphabet bar.
992
1021
  */
993
1022
  private titleLetterSelected(
994
- e: CustomEvent<{ selectedLetter: string | null }>,
1023
+ e: CustomEvent<{ selectedLetter: string | null }>
995
1024
  ): void {
996
1025
  this.selectedCreatorFilter = null;
997
1026
  this.selectedTitleFilter = e.detail.selectedLetter;
@@ -1001,7 +1030,7 @@ export class CollectionBrowser
1001
1030
  * Handler for changes to which letter is selected in the creator alphabet bar.
1002
1031
  */
1003
1032
  private creatorLetterSelected(
1004
- e: CustomEvent<{ selectedLetter: string | null }>,
1033
+ e: CustomEvent<{ selectedLetter: string | null }>
1005
1034
  ): void {
1006
1035
  this.selectedTitleFilter = null;
1007
1036
  this.selectedCreatorFilter = e.detail.selectedLetter;
@@ -1122,7 +1151,7 @@ export class CollectionBrowser
1122
1151
  * @param mobile Whether to style/shorten the button for mobile view
1123
1152
  */
1124
1153
  private clearFiltersBtnTemplate(
1125
- mobile: boolean,
1154
+ mobile: boolean
1126
1155
  ): TemplateResult | typeof nothing {
1127
1156
  if (!this.hasActiveFilters) return nothing;
1128
1157
 
@@ -1171,7 +1200,7 @@ export class CollectionBrowser
1171
1200
  e: CustomEvent<{
1172
1201
  minDate: string;
1173
1202
  maxDate: string;
1174
- }>,
1203
+ }>
1175
1204
  ) {
1176
1205
  const { minDate, maxDate } = e.detail;
1177
1206
  [this.minSelectedDate, this.maxSelectedDate] = [minDate, maxDate];
@@ -1201,7 +1230,7 @@ export class CollectionBrowser
1201
1230
  this.dispatchEvent(
1202
1231
  new CustomEvent<boolean>('manageModeChanged', {
1203
1232
  detail: this.isManageView,
1204
- }),
1233
+ })
1205
1234
  );
1206
1235
  }
1207
1236
 
@@ -1220,7 +1249,7 @@ export class CollectionBrowser
1220
1249
  */
1221
1250
  async installDataSourceAndQueryState(
1222
1251
  dataSource: CollectionBrowserDataSourceInterface,
1223
- queryState: CollectionBrowserQueryState,
1252
+ queryState: CollectionBrowserQueryState
1224
1253
  ): Promise<void> {
1225
1254
  log('Installing data source & query state in CB:', dataSource, queryState);
1226
1255
  if (this.dataSource) this.removeController(this.dataSource);
@@ -1379,12 +1408,12 @@ export class CollectionBrowser
1379
1408
 
1380
1409
  if (changed.has('selectedTitleFilter')) {
1381
1410
  this.sendFilterByTitleAnalytics(
1382
- changed.get('selectedTitleFilter') as string,
1411
+ changed.get('selectedTitleFilter') as string
1383
1412
  );
1384
1413
  }
1385
1414
  if (changed.has('selectedCreatorFilter')) {
1386
1415
  this.sendFilterByCreatorAnalytics(
1387
- changed.get('selectedCreatorFilter') as string,
1416
+ changed.get('selectedCreatorFilter') as string
1388
1417
  );
1389
1418
  }
1390
1419
 
@@ -1428,14 +1457,18 @@ export class CollectionBrowser
1428
1457
  }
1429
1458
 
1430
1459
  if (changed.has('isManageView')) {
1431
- if (this.isManageView) this.displayMode = 'grid';
1460
+ if (this.isManageView) {
1461
+ this.displayMode = 'grid';
1462
+ this.fetchManagableSearchResults();
1463
+ } else if (this.pageContext === 'search') this.infiniteScroller?.reload();
1464
+
1432
1465
  this.infiniteScroller?.refreshAllVisibleCells();
1433
1466
  this.emitManageModeChangedEvent();
1434
1467
  }
1435
1468
 
1436
1469
  if (changed.has('resizeObserver')) {
1437
1470
  const oldObserver = changed.get(
1438
- 'resizeObserver',
1471
+ 'resizeObserver'
1439
1472
  ) as SharedResizeObserverInterface;
1440
1473
  if (oldObserver) this.disconnectResizeObserver(oldObserver);
1441
1474
  this.setupResizeObserver();
@@ -1492,7 +1525,7 @@ export class CollectionBrowser
1492
1525
  this.setTileCount(
1493
1526
  this.dataSource.endOfDataReached
1494
1527
  ? this.dataSource.size
1495
- : this.estimatedTileCount,
1528
+ : this.estimatedTileCount
1496
1529
  );
1497
1530
  }
1498
1531
  }
@@ -1513,7 +1546,7 @@ export class CollectionBrowser
1513
1546
  // In desktop view, we are always ready to load facets *unless* we are using one of the
1514
1547
  // `opt-in` strategies and have not opted in (whether by login or UI interaction).
1515
1548
  const usingOptInStrategy = ['opt-in', 'opt-in-or-login'].includes(
1516
- this.facetLoadStrategy,
1549
+ this.facetLoadStrategy
1517
1550
  );
1518
1551
  const desktopFacetsReady =
1519
1552
  !this.mobileView && (!usingOptInStrategy || optedIn);
@@ -1523,7 +1556,7 @@ export class CollectionBrowser
1523
1556
  const mobileFacetsReady = this.mobileView && optedIn;
1524
1557
 
1525
1558
  this.dataSource.handleFacetReadinessChange(
1526
- desktopFacetsReady || mobileFacetsReady,
1559
+ desktopFacetsReady || mobileFacetsReady
1527
1560
  );
1528
1561
  }
1529
1562
 
@@ -1536,14 +1569,14 @@ export class CollectionBrowser
1536
1569
  // match the _available_ viewport height. This should generally be more
1537
1570
  // performant than listening to scroll events on the page or column.
1538
1571
  const leftColumnSentinel = this.shadowRoot?.querySelector(
1539
- '#left-column-scroll-sentinel',
1572
+ '#left-column-scroll-sentinel'
1540
1573
  );
1541
1574
  if (leftColumnSentinel) {
1542
1575
  this.leftColIntersectionObserver = new IntersectionObserver(
1543
1576
  this.updateLeftColumnHeight,
1544
1577
  {
1545
1578
  threshold: [...Array(101).keys()].map(n => n / 100), // Threshold every 1%
1546
- },
1579
+ }
1547
1580
  );
1548
1581
  this.leftColIntersectionObserver.observe(leftColumnSentinel);
1549
1582
  }
@@ -1560,11 +1593,11 @@ export class CollectionBrowser
1560
1593
  */
1561
1594
  private setupFacetsScrollListeners(): void {
1562
1595
  const facetsSentinel = this.shadowRoot?.querySelector(
1563
- '#facets-scroll-sentinel',
1596
+ '#facets-scroll-sentinel'
1564
1597
  );
1565
1598
  if (facetsSentinel) {
1566
1599
  this.facetsIntersectionObserver = new IntersectionObserver(
1567
- this.updateFacetFadeOut,
1600
+ this.updateFacetFadeOut
1568
1601
  );
1569
1602
  this.facetsIntersectionObserver.observe(facetsSentinel);
1570
1603
  }
@@ -1581,7 +1614,7 @@ export class CollectionBrowser
1581
1614
  const clientTop = this.leftColumn?.getBoundingClientRect().top;
1582
1615
  this.leftColumn?.style?.setProperty(
1583
1616
  'height',
1584
- `${window.innerHeight - (clientTop ?? 0) - 3}px`,
1617
+ `${window.innerHeight - (clientTop ?? 0) - 3}px`
1585
1618
  );
1586
1619
  }
1587
1620
  };
@@ -1605,7 +1638,7 @@ export class CollectionBrowser
1605
1638
  detail: {
1606
1639
  baseQuery: this.baseQuery,
1607
1640
  },
1608
- }),
1641
+ })
1609
1642
  );
1610
1643
  }
1611
1644
 
@@ -1617,7 +1650,7 @@ export class CollectionBrowser
1617
1650
  this.dispatchEvent(
1618
1651
  new CustomEvent<SearchType>('searchTypeChanged', {
1619
1652
  detail: this.searchType,
1620
- }),
1653
+ })
1621
1654
  );
1622
1655
  }
1623
1656
 
@@ -1642,7 +1675,7 @@ export class CollectionBrowser
1642
1675
  selectedTitleFilter: this.selectedTitleFilter,
1643
1676
  selectedCreatorFilter: this.selectedCreatorFilter,
1644
1677
  },
1645
- }),
1678
+ })
1646
1679
  );
1647
1680
  }
1648
1681
 
@@ -1655,7 +1688,7 @@ export class CollectionBrowser
1655
1688
  }
1656
1689
 
1657
1690
  private disconnectResizeObserver(
1658
- resizeObserver: SharedResizeObserverInterface,
1691
+ resizeObserver: SharedResizeObserverInterface
1659
1692
  ) {
1660
1693
  resizeObserver.removeObserver({
1661
1694
  target: this.contentContainer,
@@ -1679,7 +1712,7 @@ export class CollectionBrowser
1679
1712
  * @returns
1680
1713
  */
1681
1714
  private visibleCellsChanged(
1682
- e: CustomEvent<{ visibleCellIndices: number[] }>,
1715
+ e: CustomEvent<{ visibleCellIndices: number[] }>
1683
1716
  ) {
1684
1717
  if (this.isScrollingToCell) return;
1685
1718
  const { visibleCellIndices } = e.detail;
@@ -1827,7 +1860,7 @@ export class CollectionBrowser
1827
1860
  };
1828
1861
  this.restorationStateHandler.persistState(
1829
1862
  restorationState,
1830
- this.dataSourceInstallInProgress,
1863
+ this.dataSourceInstallInProgress
1831
1864
  );
1832
1865
  }
1833
1866
 
@@ -1841,7 +1874,7 @@ export class CollectionBrowser
1841
1874
  detail: {
1842
1875
  loading: this.searchResultsLoading,
1843
1876
  },
1844
- }),
1877
+ })
1845
1878
  );
1846
1879
  }
1847
1880
 
@@ -2064,6 +2097,24 @@ export class CollectionBrowser
2064
2097
  }
2065
2098
  }
2066
2099
 
2100
+ /**
2101
+ * Fetches search results for privileged users when in manage view
2102
+ * If total results exceed the threshold, partially resets the datasource pages
2103
+ * and fetches the first page with a limit based on the threshold
2104
+ */
2105
+ private fetchManagableSearchResults(): void {
2106
+ const maxAllowedResults = this.maxPagesToManage * this.pageSize;
2107
+ if (
2108
+ this.pageContext === 'search' &&
2109
+ this.dataSource.totalResults > maxAllowedResults &&
2110
+ !this.searchResultsLoading
2111
+ ) {
2112
+ this.dataSource.resetPages();
2113
+ this.dataSource.fetchPage(1, this.maxPagesToManage); // will fetch 750 results
2114
+ this.infiniteScroller?.reload();
2115
+ }
2116
+ }
2117
+
2067
2118
  static get styles() {
2068
2119
  return [
2069
2120
  srOnlyStyle,
@@ -44,13 +44,12 @@ export class FacetsTemplate extends LitElement {
44
44
  ${repeat(
45
45
  facetBuckets,
46
46
  bucket => `${facetGroup.key}:${bucket.key}`,
47
- bucket =>
48
- html`<facet-row
49
- .facetType=${facetGroup.key}
50
- .bucket=${bucket}
51
- .collectionTitles=${this.collectionTitles}
52
- @facetClick=${this.facetClicked}
53
- ></facet-row>`,
47
+ bucket => html`<facet-row
48
+ .facetType=${facetGroup.key}
49
+ .bucket=${bucket}
50
+ .collectionTitles=${this.collectionTitles}
51
+ @facetClick=${this.facetClicked}
52
+ ></facet-row>`
54
53
  )}
55
54
  </div>
56
55
  `;
@@ -1,3 +1,5 @@
1
+ /* eslint-disable dot-notation */
2
+ /* eslint-disable lit-a11y/click-events-have-key-events */
1
3
  import {
2
4
  css,
3
5
  CSSResultGroup,
@@ -37,7 +39,7 @@ import type {
37
39
  CollectionTitles,
38
40
  PageSpecifierParams,
39
41
  } from '../data-source/models';
40
- import '@internetarchive/ia-activity-indicator';
42
+ import '@internetarchive/ia-activity-indicator/ia-activity-indicator';
41
43
  import './more-facets-pagination';
42
44
  import './facets-template';
43
45
  import {
@@ -245,7 +247,7 @@ export class MoreFacetsContent extends LitElement {
245
247
  const bucketsWithCount =
246
248
  selectedFacetGroup?.buckets.map(bucket => {
247
249
  const selectedBucket = aggregationFacetGroup.buckets.find(
248
- b => b.key === bucket.key,
250
+ b => b.key === bucket.key
249
251
  );
250
252
  return selectedBucket
251
253
  ? {
@@ -263,7 +265,7 @@ export class MoreFacetsContent extends LitElement {
263
265
  // Append any additional buckets that were not selected
264
266
  aggregationFacetGroup.buckets.forEach(bucket => {
265
267
  const existingBucket = selectedFacetGroup?.buckets.find(
266
- b => b.key === bucket.key,
268
+ b => b.key === bucket.key
267
269
  );
268
270
  if (existingBucket) return;
269
271
  bucketsWithCount.push(bucket);
@@ -303,7 +305,7 @@ export class MoreFacetsContent extends LitElement {
303
305
  count: data?.count,
304
306
  state: data?.state,
305
307
  };
306
- },
308
+ }
307
309
  );
308
310
 
309
311
  return {
@@ -327,7 +329,7 @@ export class MoreFacetsContent extends LitElement {
327
329
 
328
330
  // Order the facets according to the current sort option
329
331
  let sortedBuckets = currentAggregation.getSortedBuckets(
330
- this.sortedBy,
332
+ this.sortedBy
331
333
  ) as Bucket[];
332
334
 
333
335
  if (this.facetKey === 'collection') {
@@ -369,7 +371,7 @@ export class MoreFacetsContent extends LitElement {
369
371
  const firstBucketIndexOnPage = (this.pageNumber - 1) * this.facetsPerPage;
370
372
  const truncatedBuckets = facetGroup.buckets.slice(
371
373
  firstBucketIndexOnPage,
372
- firstBucketIndexOnPage + this.facetsPerPage,
374
+ firstBucketIndexOnPage + this.facetsPerPage
373
375
  );
374
376
 
375
377
  return {
@@ -389,7 +391,7 @@ export class MoreFacetsContent extends LitElement {
389
391
  this.unappliedFacetChanges = updateSelectedFacetBucket(
390
392
  this.unappliedFacetChanges,
391
393
  this.facetKey,
392
- e.detail.bucket,
394
+ e.detail.bucket
393
395
  );
394
396
  }
395
397
  }}
@@ -452,7 +454,7 @@ export class MoreFacetsContent extends LitElement {
452
454
  private sortFacetAggregation(facetSortType: AggregationSortType) {
453
455
  this.sortedBy = facetSortType;
454
456
  this.dispatchEvent(
455
- new CustomEvent('sortedFacets', { detail: this.sortedBy }),
457
+ new CustomEvent('sortedFacets', { detail: this.sortedBy })
456
458
  );
457
459
  }
458
460
 
@@ -473,11 +475,11 @@ export class MoreFacetsContent extends LitElement {
473
475
  leftValue=${AggregationSortType.COUNT}
474
476
  leftLabel="Count"
475
477
  rightValue=${valueFacetSort[this.facetKey]}
476
- .rightLabel=${this.facetGroup?.title}
478
+ rightLabel=${this.facetGroup?.title}
477
479
  side=${defaultSwitchSide}
478
480
  @change=${(e: CustomEvent<string>) => {
479
481
  this.sortFacetAggregation(
480
- Number(e.detail) as AggregationSortType,
482
+ Number(e.detail) as AggregationSortType
481
483
  );
482
484
  }}
483
485
  ></toggle-switch>`
@@ -502,7 +504,7 @@ export class MoreFacetsContent extends LitElement {
502
504
  private applySearchFacetsClicked() {
503
505
  const mergedSelections = mergeSelectedFacets(
504
506
  this.selectedFacets,
505
- this.unappliedFacetChanges,
507
+ this.unappliedFacetChanges
506
508
  );
507
509
 
508
510
  const event = new CustomEvent<SelectedFacets>('facetsChanged', {
@@ -31,7 +31,6 @@ export class MoreFacetsPagination extends LitElement {
31
31
  this.observePageCount();
32
32
  }
33
33
 
34
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
35
34
  override updated(changed: Map<string, any>) {
36
35
  if (changed.has('size')) {
37
36
  this.observePageCount();
@@ -176,7 +175,7 @@ export class MoreFacetsPagination extends LitElement {
176
175
  detail: { page: this.currentPage },
177
176
  bubbles: true,
178
177
  composed: true,
179
- }),
178
+ })
180
179
  );
181
180
  }
182
181
 
@@ -220,7 +219,7 @@ export class MoreFacetsPagination extends LitElement {
220
219
  page =>
221
220
  html`${page !== 0
222
221
  ? this.getPageTemplate(page)
223
- : this.getEllipsisTemplate}`,
222
+ : this.getEllipsisTemplate}`
224
223
  )}
225
224
  `;
226
225
  }
@@ -16,7 +16,7 @@ export function dedupe<T extends SmartFacet[] | SmartFacet[][]>(facets: T): T {
16
16
  let result: SmartFacet[] = [...facetsUnnested];
17
17
  for (const curFacet of facetsUnnested) {
18
18
  result = result.filter(
19
- sf => curFacet === sf || !smartFacetEquals(curFacet, sf),
19
+ sf => curFacet === sf || !smartFacetEquals(curFacet, sf)
20
20
  );
21
21
  }
22
22
 
@@ -30,7 +30,7 @@ export function dedupe<T extends SmartFacet[] | SmartFacet[][]>(facets: T): T {
30
30
  const subresult: SmartFacet[] = [];
31
31
  for (const curFacet of curFacetArray) {
32
32
  const existing = result.find(sfa =>
33
- sfa.find(sf => smartFacetEquals(curFacet, sf)),
33
+ sfa.find(sf => smartFacetEquals(curFacet, sf))
34
34
  );
35
35
  if (!existing) subresult.push(curFacet);
36
36
  }
@@ -43,7 +43,7 @@ export class QueryKeywordsHeuristic implements SmartQueryHeuristic {
43
43
  const recommendations: SmartFacet[] = [];
44
44
 
45
45
  for (const [keyword, facets] of Object.entries(
46
- QueryKeywordsHeuristic.KEYWORDS,
46
+ QueryKeywordsHeuristic.KEYWORDS
47
47
  )) {
48
48
  if (query.includes(keyword)) {
49
49
  recommendations.push(...facets);
@@ -147,12 +147,12 @@ export class WikidataHeuristic implements SmartQueryHeuristic {
147
147
  const urlQuery = encodeURIComponent(query);
148
148
 
149
149
  const wikidataResponse = await fetch(
150
- `https://www.wikidata.org/w/api.php?action=wbsearchentities&search=${urlQuery}&format=json&language=en&uselang=en&origin=*&type=item&limit=5`,
150
+ `https://www.wikidata.org/w/api.php?action=wbsearchentities&search=${urlQuery}&format=json&language=en&uselang=en&origin=*&type=item&limit=5`
151
151
  );
152
152
  const searchResults = await wikidataResponse.json();
153
153
 
154
154
  for (const [keyword, facets] of Object.entries(
155
- WikidataHeuristic.ENTITIES,
155
+ WikidataHeuristic.ENTITIES
156
156
  )) {
157
157
  const keywordRegex = new RegExp(`\\b${keyword}\\b`);
158
158
  if (keywordRegex.test(searchResults.search[0]?.description)) {
@@ -171,20 +171,20 @@ export class WikidataHeuristic implements SmartQueryHeuristic {
171
171
  if (f.displayText) {
172
172
  replaced.displayText = replaced.displayText?.replace(
173
173
  '__QUERY',
174
- entityName,
174
+ entityName
175
175
  );
176
176
  }
177
177
 
178
178
  return replaced;
179
179
  }),
180
- }) as SmartFacet,
181
- ),
180
+ } as SmartFacet)
181
+ )
182
182
  );
183
183
  }
184
184
  }
185
185
 
186
186
  return recommendations;
187
- } catch {
187
+ } catch (err) {
188
188
  return [];
189
189
  }
190
190
  }