@cccsaurora/howler-ui 2.18.0-dev.799 → 2.18.0-dev.822

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 (319) hide show
  1. package/api/index.d.ts +0 -4
  2. package/api/index.js +2 -10
  3. package/api/search/facet/hit.d.ts +3 -1
  4. package/api/search/facet/index.d.ts +1 -3
  5. package/api/search/index.d.ts +1 -2
  6. package/api/search/index.js +1 -2
  7. package/commons/components/leftnav/LeftNavDrawer.js +1 -1
  8. package/components/app/App.js +8 -36
  9. package/components/app/hooks/useMatchers.d.ts +1 -1
  10. package/components/app/hooks/useMatchers.js +11 -23
  11. package/components/app/hooks/useMatchers.test.js +22 -22
  12. package/components/app/hooks/useTitle.js +5 -5
  13. package/components/app/providers/FavouritesProvider.js +2 -2
  14. package/components/app/providers/HitProvider.d.ts +22 -0
  15. package/components/app/providers/{RecordProvider.js → HitProvider.js} +41 -41
  16. package/components/app/providers/{RecordSearchProvider.d.ts → HitSearchProvider.d.ts} +6 -6
  17. package/components/app/providers/{RecordSearchProvider.js → HitSearchProvider.js} +17 -12
  18. package/components/app/providers/{RecordSearchProvider.test.js → HitSearchProvider.test.js} +71 -52
  19. package/components/app/providers/ModalProvider.d.ts +0 -1
  20. package/components/app/providers/ParameterProvider.d.ts +2 -9
  21. package/components/app/providers/ParameterProvider.js +240 -165
  22. package/components/app/providers/ParameterProvider.test.js +94 -346
  23. package/components/app/providers/SocketProvider.d.ts +2 -11
  24. package/components/app/providers/SocketProvider.js +5 -18
  25. package/components/app/providers/UserListProvider.js +8 -28
  26. package/components/elements/PluginTypography.d.ts +1 -2
  27. package/components/elements/PluginTypography.js +2 -3
  28. package/components/elements/UserList.d.ts +2 -5
  29. package/components/elements/UserList.js +8 -18
  30. package/components/elements/addons/search/phrase/Phrase.js +1 -1
  31. package/components/elements/display/ChipPopper.d.ts +1 -1
  32. package/components/elements/display/HowlerCard.js +1 -1
  33. package/components/elements/display/Modal.js +0 -2
  34. package/components/elements/display/icons/BundleButton.d.ts +6 -0
  35. package/components/elements/display/icons/BundleButton.js +32 -0
  36. package/components/elements/hit/HitActions.js +4 -4
  37. package/components/elements/hit/HitBanner.d.ts +0 -1
  38. package/components/elements/hit/HitBanner.js +49 -29
  39. package/components/elements/hit/HitCard.d.ts +0 -2
  40. package/components/elements/hit/HitCard.js +7 -7
  41. package/components/elements/{record/RecordComments.d.ts → hit/HitComments.d.ts} +4 -5
  42. package/components/elements/{record/RecordComments.js → hit/HitComments.js} +28 -29
  43. package/components/elements/{ObjectDetails.js → hit/HitDetails.js} +17 -17
  44. package/components/elements/hit/HitLabels.js +2 -2
  45. package/components/elements/hit/HitLinks.js +1 -1
  46. package/components/elements/hit/HitOutline.d.ts +0 -1
  47. package/components/elements/hit/HitOutline.js +3 -3
  48. package/components/elements/hit/{HitPreview.d.ts → HitQuickSearch.d.ts} +3 -3
  49. package/components/elements/hit/{HitPreview.js → HitQuickSearch.js} +4 -10
  50. package/components/elements/hit/HitRelated.d.ts +6 -0
  51. package/components/elements/hit/HitRelated.js +7 -0
  52. package/components/elements/hit/HitSummary.d.ts +1 -2
  53. package/components/elements/hit/HitSummary.js +5 -6
  54. package/components/elements/{record/RecordWorklog.d.ts → hit/HitWorklog.d.ts} +3 -4
  55. package/components/elements/{record/RecordWorklog.js → hit/HitWorklog.js} +13 -15
  56. package/components/elements/hit/aggregate/HitGraph.js +8 -8
  57. package/components/elements/hit/elements/Assigned.js +3 -6
  58. package/components/elements/hit/outlines/DefaultOutline.js +1 -1
  59. package/components/elements/view/ViewTitle.d.ts +0 -1
  60. package/components/elements/view/ViewTitle.js +2 -9
  61. package/components/hooks/useHitActions.d.ts +1 -1
  62. package/components/hooks/useHitActions.js +4 -4
  63. package/components/hooks/{useRecordSelection.d.ts → useHitSelection.d.ts} +2 -2
  64. package/components/hooks/{useRecordSelection.js → useHitSelection.js} +33 -12
  65. package/components/hooks/useMyPreferences.js +1 -10
  66. package/components/hooks/useMySearch.js +2 -2
  67. package/components/hooks/useMySitemap.js +1 -4
  68. package/components/hooks/useMyTheme.js +2 -9
  69. package/components/routes/action/edit/ActionEditor.js +2 -2
  70. package/components/routes/action/useMyActionFunctions.js +22 -4
  71. package/components/routes/action/view/ActionSearch.js +1 -1
  72. package/components/routes/advanced/QueryBuilder.js +1 -1
  73. package/components/routes/advanced/QueryEditor.js +3 -3
  74. package/components/routes/advanced/historyCompletionProvider.js +3 -3
  75. package/components/routes/analytics/AnalyticDetails.js +2 -2
  76. package/components/routes/analytics/AnalyticSearch.js +1 -1
  77. package/components/routes/dossiers/DossierEditor.js +2 -2
  78. package/components/routes/dossiers/DossierEditor.test.js +1 -1
  79. package/components/routes/help/ApiDocumentation.js +1 -1
  80. package/components/routes/help/BundleDocumentation.d.ts +3 -0
  81. package/components/routes/help/BundleDocumentation.js +12 -0
  82. package/components/routes/help/HitBannerDocumentation.js +0 -1
  83. package/components/routes/help/HitDocumentation.js +3 -1
  84. package/components/routes/help/markdown/en/bundles.md.js +1 -0
  85. package/components/routes/help/markdown/fr/bundles.md.js +1 -0
  86. package/components/routes/hits/search/BundleParentMenu.d.ts +6 -0
  87. package/components/routes/hits/search/BundleParentMenu.js +32 -0
  88. package/components/routes/hits/search/BundleScroller.d.ts +2 -0
  89. package/components/routes/hits/search/BundleScroller.js +6 -0
  90. package/components/routes/hits/search/{RecordBrowser.js → HitBrowser.js} +9 -9
  91. package/components/{elements/record/RecordContextMenu.d.ts → routes/hits/search/HitContextMenu.d.ts} +3 -3
  92. package/components/routes/hits/search/HitContextMenu.js +229 -0
  93. package/components/{elements/record/RecordContextMenu.test.js → routes/hits/search/HitContextMenu.test.js} +39 -94
  94. package/components/routes/hits/search/{RecordQuery.d.ts → HitQuery.d.ts} +2 -2
  95. package/components/routes/hits/search/{RecordQuery.js → HitQuery.js} +6 -6
  96. package/components/routes/hits/search/InformationPane.d.ts +0 -1
  97. package/components/routes/hits/search/InformationPane.js +63 -50
  98. package/components/routes/hits/search/LayoutSettings.js +3 -3
  99. package/components/routes/hits/search/QuerySettings.js +1 -2
  100. package/components/routes/hits/search/QuerySettings.test.js +9 -14
  101. package/components/routes/hits/search/SearchPane.js +49 -26
  102. package/components/routes/hits/search/ViewLink.js +3 -3
  103. package/components/routes/hits/search/ViewLink.test.js +8 -8
  104. package/components/routes/hits/search/grid/AddColumnModal.js +4 -5
  105. package/components/routes/hits/search/grid/EnhancedCell.d.ts +1 -2
  106. package/components/routes/hits/search/grid/EnhancedCell.js +2 -2
  107. package/components/routes/hits/search/grid/HitGrid.js +18 -20
  108. package/components/routes/hits/search/grid/{RecordRow.d.ts → HitRow.d.ts} +2 -3
  109. package/components/routes/hits/search/grid/{RecordRow.js → HitRow.js} +8 -10
  110. package/components/routes/hits/view/HitViewer.js +13 -12
  111. package/components/routes/home/ViewCard.js +41 -47
  112. package/components/{elements/MarkdownEditor.js → routes/overviews/OverviewEditor.js} +3 -3
  113. package/components/routes/overviews/OverviewViewer.js +2 -2
  114. package/components/routes/views/ViewComposer.js +19 -46
  115. package/locales/en/translation.json +5 -110
  116. package/locales/fr/translation.json +5 -108
  117. package/models/WithMetadata.d.ts +1 -2
  118. package/models/entities/generated/{ThreatEnrichment.d.ts → Enrichment.d.ts} +1 -1
  119. package/models/entities/generated/Hit.d.ts +0 -1
  120. package/models/entities/generated/Howler.d.ts +5 -0
  121. package/models/entities/generated/Rule.d.ts +10 -2
  122. package/models/entities/generated/Threat.d.ts +2 -2
  123. package/models/entities/generated/View.d.ts +0 -1
  124. package/package.json +6 -26
  125. package/plugins/clue/components/ClueTypography.js +2 -2
  126. package/plugins/clue/utils.d.ts +1 -2
  127. package/tests/mocks.d.ts +1 -11
  128. package/tests/mocks.js +7 -12
  129. package/tests/server-handlers.js +1 -6
  130. package/tests/utils.d.ts +0 -4
  131. package/tests/utils.js +0 -20
  132. package/utils/constants.d.ts +3 -4
  133. package/utils/constants.js +0 -6
  134. package/utils/hitFunctions.d.ts +1 -2
  135. package/utils/hitFunctions.js +4 -4
  136. package/utils/socketUtils.d.ts +0 -14
  137. package/utils/socketUtils.js +1 -17
  138. package/utils/viewUtils.js +0 -3
  139. package/api/search/case.d.ts +0 -4
  140. package/api/search/case.js +0 -8
  141. package/api/socket/index.d.ts +0 -3
  142. package/api/socket/index.js +0 -6
  143. package/api/socket/viewers.d.ts +0 -2
  144. package/api/socket/viewers.js +0 -8
  145. package/api/socket/viewers.test.js +0 -44
  146. package/api/v2/case/index.d.ts +0 -8
  147. package/api/v2/case/index.js +0 -20
  148. package/api/v2/case/items.d.ts +0 -6
  149. package/api/v2/case/items.js +0 -18
  150. package/api/v2/index.d.ts +0 -4
  151. package/api/v2/index.js +0 -6
  152. package/api/v2/search/facet.d.ts +0 -3
  153. package/api/v2/search/facet.js +0 -12
  154. package/api/v2/search/index.d.ts +0 -5
  155. package/api/v2/search/index.js +0 -24
  156. package/components/app/providers/RecordProvider.d.ts +0 -23
  157. package/components/elements/ContextMenu.d.ts +0 -56
  158. package/components/elements/ContextMenu.js +0 -109
  159. package/components/elements/ContextMenu.test.d.ts +0 -1
  160. package/components/elements/ContextMenu.test.js +0 -215
  161. package/components/elements/ObjectDetails.d.ts +0 -6
  162. package/components/elements/case/CaseCard.d.ts +0 -12
  163. package/components/elements/case/CaseCard.js +0 -42
  164. package/components/elements/case/CasePreview.d.ts +0 -6
  165. package/components/elements/case/CasePreview.js +0 -17
  166. package/components/elements/case/StatusIcon.d.ts +0 -5
  167. package/components/elements/case/StatusIcon.js +0 -13
  168. package/components/elements/hit/elements/AnalyticLink.d.ts +0 -9
  169. package/components/elements/hit/elements/AnalyticLink.js +0 -22
  170. package/components/elements/hit/elements/Assigned.test.d.ts +0 -1
  171. package/components/elements/hit/elements/Assigned.test.js +0 -65
  172. package/components/elements/hit/related/RelatedRecords.js +0 -63
  173. package/components/elements/observable/ObservableCard.d.ts +0 -6
  174. package/components/elements/observable/ObservableCard.js +0 -22
  175. package/components/elements/observable/ObservablePreview.d.ts +0 -6
  176. package/components/elements/observable/ObservablePreview.js +0 -12
  177. package/components/elements/record/RecordContextMenu.js +0 -256
  178. package/components/elements/record/RecordContextMenu.test.d.ts +0 -1
  179. package/components/elements/record/RecordRelated.d.ts +0 -7
  180. package/components/elements/record/RecordRelated.js +0 -34
  181. package/components/hooks/useRelatedRecords.d.ts +0 -13
  182. package/components/hooks/useRelatedRecords.js +0 -32
  183. package/components/routes/cases/CaseViewer.d.ts +0 -2
  184. package/components/routes/cases/CaseViewer.js +0 -44
  185. package/components/routes/cases/CaseViewer.test.d.ts +0 -1
  186. package/components/routes/cases/CaseViewer.test.js +0 -133
  187. package/components/routes/cases/Cases.d.ts +0 -2
  188. package/components/routes/cases/Cases.js +0 -148
  189. package/components/routes/cases/constants.d.ts +0 -6
  190. package/components/routes/cases/constants.js +0 -6
  191. package/components/routes/cases/detail/AlertPanel.d.ts +0 -6
  192. package/components/routes/cases/detail/AlertPanel.js +0 -33
  193. package/components/routes/cases/detail/CaseAssets.d.ts +0 -11
  194. package/components/routes/cases/detail/CaseAssets.js +0 -104
  195. package/components/routes/cases/detail/CaseAssets.test.d.ts +0 -1
  196. package/components/routes/cases/detail/CaseAssets.test.js +0 -167
  197. package/components/routes/cases/detail/CaseDashboard.d.ts +0 -7
  198. package/components/routes/cases/detail/CaseDashboard.js +0 -66
  199. package/components/routes/cases/detail/CaseDetails.d.ts +0 -6
  200. package/components/routes/cases/detail/CaseDetails.js +0 -70
  201. package/components/routes/cases/detail/CaseOverview.d.ts +0 -7
  202. package/components/routes/cases/detail/CaseOverview.js +0 -43
  203. package/components/routes/cases/detail/CaseSidebar.d.ts +0 -8
  204. package/components/routes/cases/detail/CaseSidebar.js +0 -107
  205. package/components/routes/cases/detail/CaseSidebar.test.d.ts +0 -1
  206. package/components/routes/cases/detail/CaseSidebar.test.js +0 -246
  207. package/components/routes/cases/detail/CaseTask.d.ts +0 -11
  208. package/components/routes/cases/detail/CaseTask.js +0 -66
  209. package/components/routes/cases/detail/CaseTimeline.d.ts +0 -12
  210. package/components/routes/cases/detail/CaseTimeline.js +0 -106
  211. package/components/routes/cases/detail/CaseTimeline.test.d.ts +0 -1
  212. package/components/routes/cases/detail/CaseTimeline.test.js +0 -320
  213. package/components/routes/cases/detail/ItemPage.d.ts +0 -6
  214. package/components/routes/cases/detail/ItemPage.js +0 -95
  215. package/components/routes/cases/detail/RelatedCasePanel.d.ts +0 -6
  216. package/components/routes/cases/detail/RelatedCasePanel.js +0 -34
  217. package/components/routes/cases/detail/TaskPanel.d.ts +0 -7
  218. package/components/routes/cases/detail/TaskPanel.js +0 -52
  219. package/components/routes/cases/detail/aggregates/CaseAggregate.d.ts +0 -11
  220. package/components/routes/cases/detail/aggregates/CaseAggregate.js +0 -24
  221. package/components/routes/cases/detail/aggregates/SourceAggregate.d.ts +0 -6
  222. package/components/routes/cases/detail/aggregates/SourceAggregate.js +0 -26
  223. package/components/routes/cases/detail/assets/Asset.d.ts +0 -14
  224. package/components/routes/cases/detail/assets/Asset.js +0 -12
  225. package/components/routes/cases/detail/assets/Asset.test.d.ts +0 -1
  226. package/components/routes/cases/detail/assets/Asset.test.js +0 -72
  227. package/components/routes/cases/detail/sidebar/CaseFolder.d.ts +0 -20
  228. package/components/routes/cases/detail/sidebar/CaseFolder.js +0 -83
  229. package/components/routes/cases/detail/sidebar/CaseFolder.test.d.ts +0 -1
  230. package/components/routes/cases/detail/sidebar/CaseFolder.test.js +0 -295
  231. package/components/routes/cases/detail/sidebar/CaseFolderContextMenu.d.ts +0 -34
  232. package/components/routes/cases/detail/sidebar/CaseFolderContextMenu.js +0 -103
  233. package/components/routes/cases/detail/sidebar/CaseFolderContextMenu.test.d.ts +0 -1
  234. package/components/routes/cases/detail/sidebar/CaseFolderContextMenu.test.js +0 -363
  235. package/components/routes/cases/detail/sidebar/FolderEntry.d.ts +0 -25
  236. package/components/routes/cases/detail/sidebar/FolderEntry.js +0 -88
  237. package/components/routes/cases/detail/sidebar/FolderEntry.test.d.ts +0 -1
  238. package/components/routes/cases/detail/sidebar/FolderEntry.test.js +0 -206
  239. package/components/routes/cases/detail/sidebar/RootDropZone.d.ts +0 -5
  240. package/components/routes/cases/detail/sidebar/RootDropZone.js +0 -33
  241. package/components/routes/cases/detail/sidebar/types.d.ts +0 -9
  242. package/components/routes/cases/detail/sidebar/utils.d.ts +0 -3
  243. package/components/routes/cases/detail/sidebar/utils.js +0 -29
  244. package/components/routes/cases/detail/sidebar/utils.test.d.ts +0 -1
  245. package/components/routes/cases/detail/sidebar/utils.test.js +0 -82
  246. package/components/routes/cases/hooks/useCase.d.ts +0 -13
  247. package/components/routes/cases/hooks/useCase.js +0 -69
  248. package/components/routes/cases/hooks/useCase.test.d.ts +0 -1
  249. package/components/routes/cases/hooks/useCase.test.js +0 -141
  250. package/components/routes/cases/modals/AddToCaseModal.d.ts +0 -7
  251. package/components/routes/cases/modals/AddToCaseModal.js +0 -59
  252. package/components/routes/cases/modals/AddToCaseModal.test.d.ts +0 -1
  253. package/components/routes/cases/modals/AddToCaseModal.test.js +0 -313
  254. package/components/routes/cases/modals/CaseRecordRow.d.ts +0 -9
  255. package/components/routes/cases/modals/CaseRecordRow.js +0 -15
  256. package/components/routes/cases/modals/CreateCaseModal.d.ts +0 -7
  257. package/components/routes/cases/modals/CreateCaseModal.js +0 -55
  258. package/components/routes/cases/modals/CreateCaseModal.test.d.ts +0 -1
  259. package/components/routes/cases/modals/CreateCaseModal.test.js +0 -358
  260. package/components/routes/cases/modals/RenameItemModal.d.ts +0 -9
  261. package/components/routes/cases/modals/RenameItemModal.js +0 -48
  262. package/components/routes/cases/modals/ResolveModal.d.ts +0 -7
  263. package/components/routes/cases/modals/ResolveModal.js +0 -115
  264. package/components/routes/cases/modals/ResolveModal.test.d.ts +0 -1
  265. package/components/routes/cases/modals/ResolveModal.test.js +0 -384
  266. package/components/routes/cases/modals/hooks.d.ts +0 -7
  267. package/components/routes/cases/modals/hooks.js +0 -44
  268. package/components/routes/cases/modals/types.d.ts +0 -5
  269. package/components/routes/cases/search/CaseAssigneeFilter.d.ts +0 -6
  270. package/components/routes/cases/search/CaseAssigneeFilter.js +0 -33
  271. package/components/routes/cases/search/CaseAssigneeFilter.test.d.ts +0 -1
  272. package/components/routes/cases/search/CaseAssigneeFilter.test.js +0 -127
  273. package/components/routes/cases/search/CaseDateFilter.d.ts +0 -13
  274. package/components/routes/cases/search/CaseDateFilter.js +0 -26
  275. package/components/routes/cases/search/CaseDateFilter.test.d.ts +0 -1
  276. package/components/routes/cases/search/CaseDateFilter.test.js +0 -115
  277. package/components/routes/cases/search/CaseStatusFilter.d.ts +0 -6
  278. package/components/routes/cases/search/CaseStatusFilter.js +0 -13
  279. package/components/routes/cases/search/CaseStatusFilter.test.d.ts +0 -1
  280. package/components/routes/cases/search/CaseStatusFilter.test.js +0 -86
  281. package/components/routes/hits/search/shared/IndexPicker.d.ts +0 -2
  282. package/components/routes/hits/search/shared/IndexPicker.js +0 -20
  283. package/components/routes/observables/ObservableViewer.d.ts +0 -7
  284. package/components/routes/observables/ObservableViewer.js +0 -27
  285. package/models/entities/generated/AttachmentsFile.d.ts +0 -12
  286. package/models/entities/generated/Case.d.ts +0 -28
  287. package/models/entities/generated/DestinationOriginal.d.ts +0 -19
  288. package/models/entities/generated/EmailAttachment.d.ts +0 -8
  289. package/models/entities/generated/EmailParent.d.ts +0 -19
  290. package/models/entities/generated/Enrichments.d.ts +0 -7
  291. package/models/entities/generated/EnrichmentsIndicator.d.ts +0 -21
  292. package/models/entities/generated/HttpResponse.d.ts +0 -11
  293. package/models/entities/generated/Item.d.ts +0 -9
  294. package/models/entities/generated/Observable.d.ts +0 -85
  295. package/models/entities/generated/ObservableCloud.d.ts +0 -20
  296. package/models/entities/generated/ObservableDestination.d.ts +0 -23
  297. package/models/entities/generated/ObservableEmail.d.ts +0 -30
  298. package/models/entities/generated/ObservableFile.d.ts +0 -36
  299. package/models/entities/generated/ObservableHowler.d.ts +0 -42
  300. package/models/entities/generated/ObservableHttp.d.ts +0 -11
  301. package/models/entities/generated/ObservableObserver.d.ts +0 -21
  302. package/models/entities/generated/ObservableOrganization.d.ts +0 -7
  303. package/models/entities/generated/ObservableProcess.d.ts +0 -34
  304. package/models/entities/generated/ObservableSource.d.ts +0 -23
  305. package/models/entities/generated/ObservableThreat.d.ts +0 -21
  306. package/models/entities/generated/ObservableTls.d.ts +0 -12
  307. package/models/entities/generated/ObserverIngress.d.ts +0 -9
  308. package/models/entities/generated/Task.d.ts +0 -10
  309. package/models/socket/CaseUpdate.d.ts +0 -5
  310. package/models/socket/ViewersUpdate.d.ts +0 -4
  311. package/utils/socketUtils.test.d.ts +0 -1
  312. package/utils/socketUtils.test.js +0 -59
  313. package/utils/typeUtils.d.ts +0 -7
  314. package/utils/typeUtils.js +0 -27
  315. /package/{api/socket/viewers.test.d.ts → components/app/providers/HitSearchProvider.test.d.ts} +0 -0
  316. /package/components/elements/hit/{related/RelatedRecords.d.ts → HitDetails.d.ts} +0 -0
  317. /package/components/routes/hits/search/{RecordBrowser.d.ts → HitBrowser.d.ts} +0 -0
  318. /package/components/{app/providers/RecordSearchProvider.test.d.ts → routes/hits/search/HitContextMenu.test.d.ts} +0 -0
  319. /package/components/{elements/MarkdownEditor.d.ts → routes/overviews/OverviewEditor.d.ts} +0 -0
@@ -0,0 +1,2 @@
1
+ import type { FC, PropsWithChildren } from 'react';
2
+ export declare const BundleScroller: FC<PropsWithChildren>;
@@ -0,0 +1,6 @@
1
+ import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
2
+ import { useScrollRestoration } from '@cccsaurora/howler-ui/components/hooks/useScrollRestoration';
3
+ export const BundleScroller = ({ children }) => {
4
+ useScrollRestoration('hitscrollbar');
5
+ return _jsx(_Fragment, { children: children });
6
+ };
@@ -1,9 +1,9 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { ChevronLeft, Close, ManageSearch } from '@mui/icons-material';
3
3
  import { Box, Card, Checkbox, Collapse, Drawer, Fab, IconButton, Stack, Tooltip, Typography, useMediaQuery, useTheme } from '@mui/material';
4
+ import { HitContext } from '@cccsaurora/howler-ui/components/app/providers/HitProvider';
5
+ import HitSearchProvider, { HitSearchContext } from '@cccsaurora/howler-ui/components/app/providers/HitSearchProvider';
4
6
  import ParameterProvider, { ParameterContext } from '@cccsaurora/howler-ui/components/app/providers/ParameterProvider';
5
- import { RecordContext } from '@cccsaurora/howler-ui/components/app/providers/RecordProvider';
6
- import RecordSearchProvider, { RecordSearchContext } from '@cccsaurora/howler-ui/components/app/providers/RecordSearchProvider';
7
7
  import { ViewContext } from '@cccsaurora/howler-ui/components/app/providers/ViewProvider';
8
8
  import FlexOne from '@cccsaurora/howler-ui/components/elements/addons/layout/FlexOne';
9
9
  import FlexPort from '@cccsaurora/howler-ui/components/elements/addons/layout/FlexPort';
@@ -32,14 +32,14 @@ const HitBrowser = () => {
32
32
  const setQuery = useContextSelector(ParameterContext, ctx => ctx.setQuery);
33
33
  const setOffset = useContextSelector(ParameterContext, ctx => ctx.setOffset);
34
34
  const selectedViews = useContextSelector(ParameterContext, ctx => ctx.views);
35
- const selectedHits = useContextSelector(RecordContext, ctx => ctx.selectedRecords);
36
- const addHitToSelection = useContextSelector(RecordContext, ctx => ctx.addRecordToSelection);
37
- const removeHitFromSelection = useContextSelector(RecordContext, ctx => ctx.removeRecordFromSelection);
38
- const clearSelectedHits = useContextSelector(RecordContext, ctx => ctx.clearSelectedRecords);
35
+ const selectedHits = useContextSelector(HitContext, ctx => ctx.selectedHits);
36
+ const addHitToSelection = useContextSelector(HitContext, ctx => ctx.addHitToSelection);
37
+ const removeHitFromSelection = useContextSelector(HitContext, ctx => ctx.removeHitFromSelection);
38
+ const clearSelectedHits = useContextSelector(HitContext, ctx => ctx.clearSelectedHits);
39
39
  const searchPaneWidth = useMyLocalStorageItem(StorageKey.SEARCH_PANE_WIDTH, null)[0];
40
40
  const forceDrawer = useMyLocalStorageItem(StorageKey.FORCE_DRAWER, false)[0];
41
- const displayType = useContextSelector(RecordSearchContext, ctx => ctx.displayType);
42
- const response = useContextSelector(RecordSearchContext, ctx => ctx.response);
41
+ const displayType = useContextSelector(HitSearchContext, ctx => ctx.displayType);
42
+ const response = useContextSelector(HitSearchContext, ctx => ctx.response);
43
43
  const location = useLocation();
44
44
  const routeParams = useParams();
45
45
  const [show, setShow] = useState(!!selected);
@@ -128,6 +128,6 @@ const HitBrowser = () => {
128
128
  }, children: _jsx(ChevronLeft, { sx: { transition: 'rotate 250ms', rotate: show ? '180deg' : '0deg' } }) }))] }));
129
129
  };
130
130
  const HitBrowserProvider = () => {
131
- return (_jsx(ParameterProvider, { children: _jsx(RecordSearchProvider, { children: _jsx(HitBrowser, {}) }) }));
131
+ return (_jsx(ParameterProvider, { children: _jsx(HitSearchProvider, { children: _jsx(HitBrowser, {}) }) }));
132
132
  };
133
133
  export default HitBrowserProvider;
@@ -3,7 +3,7 @@ import React from 'react';
3
3
  /**
4
4
  * Props for the HitContextMenu component
5
5
  */
6
- interface RecordContextMenuProps {
6
+ interface HitContextMenuProps {
7
7
  /**
8
8
  * Function to extract the hit ID from a mouse event
9
9
  */
@@ -18,5 +18,5 @@ interface RecordContextMenuProps {
18
18
  * Provides quick access to common hit actions including assessment, voting,
19
19
  * transitions, and exclusion filters based on template fields.
20
20
  */
21
- declare const RecordContextMenu: FC<PropsWithChildren<RecordContextMenuProps>>;
22
- export default RecordContextMenu;
21
+ declare const HitContextMenu: FC<PropsWithChildren<HitContextMenuProps>>;
22
+ export default HitContextMenu;
@@ -0,0 +1,229 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { AddCircleOutline, Assignment, Edit, HowToVote, KeyboardArrowRight, OpenInNew, QueryStats, RemoveCircleOutline, SettingsSuggest, Terminal } from '@mui/icons-material';
3
+ import { Box, Divider, Fade, ListItemIcon, ListItemText, Menu, MenuItem, MenuList, Paper } from '@mui/material';
4
+ import api from '@cccsaurora/howler-ui/api';
5
+ import useMatchers from '@cccsaurora/howler-ui/components/app/hooks/useMatchers';
6
+ import { ApiConfigContext } from '@cccsaurora/howler-ui/components/app/providers/ApiConfigProvider';
7
+ import { HitContext } from '@cccsaurora/howler-ui/components/app/providers/HitProvider';
8
+ import { ParameterContext } from '@cccsaurora/howler-ui/components/app/providers/ParameterProvider';
9
+ import { TOP_ROW, VOTE_OPTIONS } from '@cccsaurora/howler-ui/components/elements/hit/actions/SharedComponents';
10
+ import useHitActions from '@cccsaurora/howler-ui/components/hooks/useHitActions';
11
+ import useMyApi from '@cccsaurora/howler-ui/components/hooks/useMyApi';
12
+ import useMyActionFunctions from '@cccsaurora/howler-ui/components/routes/action/useMyActionFunctions';
13
+ import { capitalize, get, groupBy, isEmpty, toString } from 'lodash-es';
14
+ import howlerPluginStore from '@cccsaurora/howler-ui/plugins/store';
15
+ import React, { useCallback, useContext, useEffect, useMemo, useState } from 'react';
16
+ import { useTranslation } from 'react-i18next';
17
+ import { usePluginStore } from 'react-pluggable';
18
+ import { Link } from 'react-router-dom';
19
+ import { useContextSelector } from 'use-context-selector';
20
+ import { DEFAULT_QUERY } from '@cccsaurora/howler-ui/utils/constants';
21
+ import { sanitizeLuceneQuery } from '@cccsaurora/howler-ui/utils/stringUtils';
22
+ /**
23
+ * Order in which action types should be displayed in the context menu
24
+ */
25
+ const ORDER = ['assessment', 'vote', 'action'];
26
+ /**
27
+ * The margin at the bottom of the screen by which the context menu should be inverted.
28
+ * That is, if right clicking within this many pixels of the bottom, render the context menu to the top right
29
+ * of the pointer instead of the bottom right.
30
+ */
31
+ const CONTEXTMENU_MARGIN = 350;
32
+ /**
33
+ * Icon mapping for different action types
34
+ */
35
+ const ICON_MAP = {
36
+ assessment: _jsx(Assignment, {}),
37
+ vote: _jsx(HowToVote, {}),
38
+ action: _jsx(Edit, {})
39
+ };
40
+ /**
41
+ * Context menu component for hit operations.
42
+ * Provides quick access to common hit actions including assessment, voting,
43
+ * transitions, and exclusion filters based on template fields.
44
+ */
45
+ const HitContextMenu = ({ children, getSelectedId, Component = Box }) => {
46
+ const { t } = useTranslation();
47
+ const { dispatchApi } = useMyApi();
48
+ const { executeAction } = useMyActionFunctions();
49
+ const { config } = useContext(ApiConfigContext);
50
+ const pluginStore = usePluginStore();
51
+ const { getMatchingAnalytic, getMatchingTemplate } = useMatchers();
52
+ const query = useContextSelector(ParameterContext, ctx => ctx?.query);
53
+ const setQuery = useContextSelector(ParameterContext, ctx => ctx?.setQuery);
54
+ const [id, setId] = useState(null);
55
+ const hit = useContextSelector(HitContext, ctx => ctx.hits[id]);
56
+ const selectedHits = useContextSelector(HitContext, ctx => ctx.selectedHits);
57
+ const [analytic, setAnalytic] = useState(null);
58
+ const [template, setTemplate] = useState(null);
59
+ const [anchorEl, setAnchorEl] = useState();
60
+ const [transformProps, setTransformProps] = useState({});
61
+ const [actions, setActions] = useState([]);
62
+ const [show, setShow] = useState({});
63
+ const hits = useMemo(() => (selectedHits.some(_hit => _hit.howler.id === hit?.howler.id) ? selectedHits : [hit]), [hit, selectedHits]);
64
+ const { availableTransitions, canVote, canAssess, assess, vote } = useHitActions(hits);
65
+ /**
66
+ * Handles right-click context menu events.
67
+ * Opens the context menu at the click location and loads available actions.
68
+ */
69
+ const onContextMenu = useCallback(async (event) => {
70
+ if (anchorEl) {
71
+ event.preventDefault();
72
+ setAnchorEl(null);
73
+ return;
74
+ }
75
+ event.preventDefault();
76
+ const _id = getSelectedId(event);
77
+ setId(_id);
78
+ if (window.innerHeight - event.clientY < 300) {
79
+ setTransformProps({
80
+ position: 'fixed',
81
+ bottom: `${window.innerHeight - event.clientY}px !important`,
82
+ top: 'unset !important',
83
+ left: `${event.clientX}px !important`
84
+ });
85
+ }
86
+ else {
87
+ setTransformProps({
88
+ position: 'fixed',
89
+ top: `${event.clientY}px !important`,
90
+ left: `${event.clientX}px !important`
91
+ });
92
+ }
93
+ setAnchorEl(event.target);
94
+ // TODO: Bumping the number of rows is a temporary fix - we'll need to improve this.
95
+ const _actions = (await dispatchApi(api.search.action.post({ query: 'action_id:*', rows: 100, sort: 'name asc' }), {
96
+ throwError: false
97
+ }))?.items;
98
+ if (_actions) {
99
+ setActions(_actions);
100
+ }
101
+ }, [anchorEl, dispatchApi, getSelectedId]);
102
+ const rowStatus = useMemo(() => ({
103
+ assessment: canAssess,
104
+ vote: canVote
105
+ }), [canAssess, canVote]);
106
+ const pluginActions = howlerPluginStore.plugins.flatMap(plugin => pluginStore.executeFunction(`${plugin}.actions`, hits));
107
+ /**
108
+ * Generates grouped action entries for the context menu.
109
+ * Combines transitions, plugin actions, votes, and assessments based on permissions.
110
+ */
111
+ const entries = useMemo(() => {
112
+ let _actions = [...availableTransitions, ...pluginActions];
113
+ if (canVote) {
114
+ _actions = [
115
+ ..._actions,
116
+ ...VOTE_OPTIONS.map(option => ({ ...option, actionFunction: () => vote(option.name.toLowerCase()) }))
117
+ ];
118
+ }
119
+ if (config.lookups?.['howler.assessment'] && canAssess) {
120
+ _actions = [
121
+ ..._actions,
122
+ ...config.lookups['howler.assessment']
123
+ .filter(_assessment => analytic?.triage_settings?.valid_assessments
124
+ ? analytic.triage_settings?.valid_assessments.includes(_assessment)
125
+ : true)
126
+ .sort((a, b) => +TOP_ROW.includes(b) - +TOP_ROW.includes(a))
127
+ .map(assessment => ({
128
+ type: 'assessment',
129
+ name: assessment,
130
+ actionFunction: async () => {
131
+ await assess(assessment, analytic?.triage_settings?.skip_rationale);
132
+ }
133
+ }))
134
+ ];
135
+ }
136
+ return Object.entries(groupBy(_actions, 'type')).sort(([a], [b]) => ORDER.indexOf(a) - ORDER.indexOf(b));
137
+ }, [analytic, assess, availableTransitions, canAssess, canVote, config.lookups, vote, pluginActions]);
138
+ /**
139
+ * Calculates appropriate styles for submenu positioning.
140
+ * Adjusts position based on available screen space to prevent overflow.
141
+ */
142
+ const calculateSubMenuStyles = useCallback((parent) => {
143
+ const baseStyles = { position: 'absolute', maxHeight: '300px', overflow: 'auto' };
144
+ const defaultStyles = { ...baseStyles, top: 0, left: '100%' };
145
+ if (!parent) {
146
+ return defaultStyles;
147
+ }
148
+ const parentBounds = parent.getBoundingClientRect();
149
+ if (window.innerHeight - parentBounds.y < CONTEXTMENU_MARGIN) {
150
+ return { ...baseStyles, bottom: 0, left: '100%' };
151
+ }
152
+ return defaultStyles;
153
+ }, []);
154
+ // Load analytic and template data when a hit is selected
155
+ useEffect(() => {
156
+ if (!hit?.howler.analytic) {
157
+ return;
158
+ }
159
+ getMatchingAnalytic(hit).then(setAnalytic);
160
+ getMatchingTemplate(hit).then(setTemplate);
161
+ // eslint-disable-next-line react-hooks/exhaustive-deps
162
+ }, [hit]);
163
+ // Reset menu state when context menu is closed
164
+ useEffect(() => {
165
+ if (!anchorEl) {
166
+ setShow({});
167
+ setAnalytic(null);
168
+ }
169
+ }, [anchorEl]);
170
+ return (_jsxs(Component, { id: "contextMenu", onContextMenu: onContextMenu, children: [children, _jsxs(Menu, { id: "hit-menu", open: !!anchorEl, anchorEl: anchorEl, onClose: () => setAnchorEl(null), slotProps: {
171
+ paper: {
172
+ sx: {
173
+ ...transformProps,
174
+ overflow: 'visible !important'
175
+ }
176
+ }
177
+ }, MenuListProps: { dense: true, sx: { minWidth: '250px' } }, anchorOrigin: { vertical: 'top', horizontal: 'left' }, onClick: () => setAnchorEl(null), children: [_jsxs(MenuItem, { component: Link, to: `/hits/${hit?.howler.id}`, disabled: !hit, children: [_jsx(ListItemIcon, { children: _jsx(OpenInNew, {}) }), _jsx(ListItemText, { children: t('hit.panel.open') })] }), _jsxs(MenuItem, { component: Link, to: `/analytics/${analytic?.analytic_id}`, disabled: !analytic, children: [_jsx(ListItemIcon, { children: _jsx(QueryStats, {}) }), _jsx(ListItemText, { children: t('hit.panel.analytic.open') })] }), _jsx(Divider, {}), entries.map(([type, items]) => (_jsxs(MenuItem, { id: `${type}-menu-item`, sx: { position: 'relative' }, onMouseEnter: ev => setShow(_show => ({ ..._show, [type]: ev.target })), onMouseLeave: () => setShow(_show => ({ ..._show, [type]: null })), disabled: rowStatus[type] === false, children: [_jsx(ListItemIcon, { children: ICON_MAP[type] ?? _jsx(Terminal, {}) }), _jsx(ListItemText, { sx: { flex: 1 }, children: t(`hit.details.actions.${type}`) }), rowStatus[type] !== false && (_jsx(KeyboardArrowRight, { fontSize: "small", sx: { color: 'text.secondary', mr: -1 } })), _jsx(Fade, { in: !!show[type], unmountOnExit: true, children: _jsx(Paper, { id: `${type}-submenu`, sx: calculateSubMenuStyles(show[type]), elevation: 8, children: _jsx(MenuList, { sx: { p: 0, borderTopLeftRadius: 0 }, dense: true, role: "group", children: items.map(a => (_jsx(MenuItem, { value: a.name, onClick: a.actionFunction, children: a.i18nKey ? t(a.i18nKey) : capitalize(a.name) }, a.name))) }) }) })] }, type))), _jsxs(MenuItem, { id: "actions-menu-item", sx: { position: 'relative' }, onMouseEnter: ev => setShow(_show => ({ ..._show, actions: ev.target })), onMouseLeave: () => setShow(_show => ({ ..._show, actions: null })), disabled: actions.length < 1, children: [_jsx(ListItemIcon, { children: _jsx(SettingsSuggest, {}) }), _jsx(ListItemText, { sx: { flex: 1 }, children: t('route.actions.change') }), actions.length > 0 && _jsx(KeyboardArrowRight, { fontSize: "small", sx: { color: 'text.secondary', mr: -1 } }), _jsx(Fade, { in: !!show.actions, unmountOnExit: true, children: _jsx(Paper, { id: "actions-submenu", sx: calculateSubMenuStyles(show.actions), elevation: 8, children: _jsx(MenuList, { sx: { p: 0 }, dense: true, role: "group", children: actions.map(action => (_jsx(MenuItem, { onClick: () => executeAction(action.action_id, `howler.id:${hit?.howler.id}`), children: _jsx(ListItemText, { children: action.name }) }, action.action_id))) }) }) })] }), !isEmpty(template?.keys ?? []) && setQuery && (_jsxs(_Fragment, { children: [_jsx(Divider, {}), _jsxs(MenuItem, { id: "excludes-menu-item", sx: { position: 'relative' }, onMouseEnter: ev => setShow(_show => ({ ..._show, excludes: ev.target })), onMouseLeave: () => setShow(_show => ({ ..._show, excludes: null })), children: [_jsx(ListItemIcon, { children: _jsx(RemoveCircleOutline, {}) }), _jsx(ListItemText, { sx: { flex: 1 }, children: t('hit.panel.exclude') }), _jsx(KeyboardArrowRight, { fontSize: "small", sx: { color: 'text.secondary', mr: -1 } }), _jsx(Fade, { in: !!show.excludes, unmountOnExit: true, children: _jsx(Paper, { id: "excludes-submenu", sx: calculateSubMenuStyles(show.excludes), elevation: 8, children: _jsx(MenuList, { sx: { p: 0 }, dense: true, role: "group", children: template?.keys.map(key => {
178
+ // Build exclusion query based on current query and field value
179
+ let newQuery = '';
180
+ if (query !== DEFAULT_QUERY) {
181
+ newQuery = `(${query}) AND `;
182
+ }
183
+ const value = get(hit, key);
184
+ if (!value) {
185
+ return null;
186
+ }
187
+ else if (Array.isArray(value)) {
188
+ // Handle array values by excluding all items
189
+ const sanitizedValues = value
190
+ .map(toString)
191
+ .filter(val => !!val)
192
+ .map(val => `"${sanitizeLuceneQuery(val)}"`);
193
+ if (sanitizedValues.length < 1) {
194
+ return null;
195
+ }
196
+ newQuery += `-${key}:(${sanitizedValues.join(' OR ')})`;
197
+ }
198
+ else {
199
+ // Handle single value
200
+ newQuery += `-${key}:"${sanitizeLuceneQuery(value.toString())}"`;
201
+ }
202
+ return (_jsx(MenuItem, { onClick: () => setQuery(newQuery), children: _jsx(ListItemText, { children: key }) }, key));
203
+ }) }) }) })] }), _jsxs(MenuItem, { id: "includes-menu-item", sx: { position: 'relative' }, onMouseEnter: ev => setShow(_show => ({ ..._show, includes: ev.target })), onMouseLeave: () => setShow(_show => ({ ..._show, includes: null })), children: [_jsx(ListItemIcon, { children: _jsx(AddCircleOutline, {}) }), _jsx(ListItemText, { sx: { flex: 1 }, children: t('hit.panel.include') }), _jsx(KeyboardArrowRight, { fontSize: "small", sx: { color: 'text.secondary', mr: -1 } }), _jsx(Fade, { in: !!show.includes, unmountOnExit: true, children: _jsx(Paper, { id: "includes-submenu", sx: calculateSubMenuStyles(show.includes), elevation: 8, children: _jsx(MenuList, { sx: { p: 0 }, dense: true, role: "group", children: template?.keys.map(key => {
204
+ // Build inclusion query based on current query and field
205
+ // If default, we include default query
206
+ let newQuery = `(${query}) AND `;
207
+ const value = get(hit, key);
208
+ if (!value) {
209
+ return null;
210
+ }
211
+ else if (Array.isArray(value)) {
212
+ // Handle array values by including all items
213
+ const sanitizedValues = value
214
+ .map(toString)
215
+ .filter(val => !!val)
216
+ .map(val => `"${sanitizeLuceneQuery(val)}"`);
217
+ if (sanitizedValues.length < 1) {
218
+ return null;
219
+ }
220
+ newQuery += `${key}:(${sanitizedValues.join(' OR ')})`;
221
+ }
222
+ else {
223
+ // Handle single value
224
+ newQuery += `${key}:"${sanitizeLuceneQuery(value.toString())}"`;
225
+ }
226
+ return (_jsx(MenuItem, { onClick: () => setQuery(newQuery), children: _jsx(ListItemText, { children: key }) }, key));
227
+ }) }) }) })] })] }))] })] }));
228
+ };
229
+ export default HitContextMenu;