@cccsaurora/howler-ui 3.0.5 → 3.0.6-dev.1470

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.
@@ -46,7 +46,7 @@ const InformationPane = ({ onClose, selected: _selected }) => {
46
46
  const { emit, open } = useContext(SocketContext);
47
47
  const { getMatchingOverview, getMatchingDossiers, getMatchingAnalytic } = useMatchers();
48
48
  const selected = useContextSelector(ParameterContext, ctx => ctx?.selected) ?? _selected;
49
- const { executeFunction } = usePluginStore();
49
+ const pluginStore = usePluginStore();
50
50
  const getRecord = useContextSelector(RecordContext, ctx => ctx.getRecord);
51
51
  const [userIds, setUserIds] = useState(new Set());
52
52
  const [analytic, setAnalytic] = useState();
@@ -64,9 +64,9 @@ const InformationPane = ({ onClose, selected: _selected }) => {
64
64
  return;
65
65
  }
66
66
  howlerPluginStore.plugins.forEach(plugin => {
67
- executeFunction(`${plugin}.on`, 'viewing');
67
+ pluginStore.executeFunction(`${plugin}.on`, 'viewing');
68
68
  });
69
- }, [executeFunction, selected]);
69
+ }, [pluginStore.executeFunction, selected]);
70
70
  useEffect(() => {
71
71
  if (!selected) {
72
72
  return;
@@ -47,7 +47,7 @@ const HitViewer = () => {
47
47
  const [orientation, setOrientation] = useMyLocalStorageItem(StorageKey.VIEWER_ORIENTATION, Orientation.VERTICAL);
48
48
  const { getMatchingOverview, getMatchingDossiers, getMatchingAnalytic } = useMatchers();
49
49
  const { emit, open } = useContext(SocketContext);
50
- const { executeFunction } = usePluginStore();
50
+ const pluginStore = usePluginStore();
51
51
  const getHit = useContextSelector(RecordContext, ctx => ctx.getRecord);
52
52
  const hit = useContextSelector(RecordContext, ctx => ctx.records[params.id]);
53
53
  const [userIds, setUserIds] = useState(new Set());
@@ -81,9 +81,9 @@ const HitViewer = () => {
81
81
  return;
82
82
  }
83
83
  howlerPluginStore.plugins.forEach(plugin => {
84
- executeFunction(`${plugin}.on`, 'viewing');
84
+ pluginStore.executeFunction(`${plugin}.on`, 'viewing');
85
85
  });
86
- }, [executeFunction, hit]);
86
+ }, [pluginStore.executeFunction, hit]);
87
87
  useEffect(() => {
88
88
  void fetchData();
89
89
  }, [params.id, fetchData, hit]);
@@ -5,7 +5,9 @@ import { RecordContext } from '@cccsaurora/howler-ui/components/app/providers/Re
5
5
  import { SocketContext } from '@cccsaurora/howler-ui/components/app/providers/SocketProvider';
6
6
  import { beforeEach, describe, expect, it, vi } from 'vitest';
7
7
  const mockEmit = vi.hoisted(() => vi.fn());
8
- const mockExecutePlugin = vi.hoisted(() => vi.fn());
8
+ const mockExecutePlugin = vi.hoisted(() => vi.fn(function () {
9
+ return this.functionArray;
10
+ }));
9
11
  const mockOpen = vi.hoisted(() => ({ current: true }));
10
12
  const mockParams = vi.hoisted(() => ({ id: 'hit-1' }));
11
13
  const mockGetHit = vi.hoisted(() => vi.fn().mockResolvedValue(undefined));
@@ -28,7 +30,7 @@ vi.mock('plugins/store', () => ({
28
30
  }
29
31
  }));
30
32
  vi.mock('react-pluggable', () => ({
31
- usePluginStore: () => ({ executeFunction: mockExecutePlugin })
33
+ usePluginStore: () => ({ executeFunction: mockExecutePlugin, functionArray: [] })
32
34
  }));
33
35
  vi.mock('react-i18next', () => ({
34
36
  useTranslation: () => ({
@@ -142,7 +144,7 @@ const createWrapper = () => {
142
144
  const renderViewer = () => render(_jsx(HitViewer, {}), { wrapper: createWrapper() });
143
145
  beforeEach(() => {
144
146
  mockEmit.mockReset();
145
- mockExecutePlugin.mockReset();
147
+ mockExecutePlugin.mockClear();
146
148
  mockOpen.current = true;
147
149
  mockParams.id = 'hit-1';
148
150
  mockUseMediaQuery.mockReset().mockReturnValue(false);
package/package.json CHANGED
@@ -93,7 +93,7 @@
93
93
  "url": "https://github.com/CybercentreCanada/howler"
94
94
  },
95
95
  "type": "module",
96
- "version": "3.0.5",
96
+ "version": "3.0.6-dev.1470",
97
97
  "exports": {
98
98
  "./i18n": "./i18n.js",
99
99
  "./index.css": "./index.css",