@cccsaurora/howler-ui 2.17.0-dev.420 → 2.17.0-dev.473

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 (57) hide show
  1. package/commons/components/app/hooks/useAppConfigs.d.ts +1 -1
  2. package/components/app/providers/HitSearchProvider.d.ts +0 -1
  3. package/components/app/providers/HitSearchProvider.js +4 -6
  4. package/components/app/providers/HitSearchProvider.test.js +1 -1
  5. package/components/app/providers/ParameterProvider.js +3 -3
  6. package/components/app/providers/ViewProvider.d.ts +1 -1
  7. package/components/app/providers/ViewProvider.js +3 -6
  8. package/components/app/providers/ViewProvider.test.js +1 -1
  9. package/components/elements/PluginChip.d.ts +2 -0
  10. package/components/elements/PluginChip.js +2 -1
  11. package/components/elements/PluginTypography.d.ts +4 -3
  12. package/components/elements/PluginTypography.js +4 -3
  13. package/components/elements/display/modals/RationaleModal.js +1 -1
  14. package/components/elements/display/modals/RationaleModal.test.js +1 -1
  15. package/components/elements/hit/HitBanner.js +2 -2
  16. package/components/elements/hit/HitDetails.js +9 -9
  17. package/components/elements/hit/outlines/DefaultOutline.js +1 -1
  18. package/components/routes/hits/search/ViewLink.js +1 -1
  19. package/components/routes/hits/search/ViewLink.test.js +3 -3
  20. package/components/routes/hits/search/grid/EnhancedCell.d.ts +2 -0
  21. package/components/routes/hits/search/grid/EnhancedCell.js +2 -2
  22. package/components/routes/hits/search/grid/HitRow.js +1 -1
  23. package/components/routes/views/ViewComposer.js +2 -2
  24. package/index.js +5 -0
  25. package/locales/en/translation.json +1 -0
  26. package/locales/fr/translation.json +1 -0
  27. package/models/entities/generated/Analytic.d.ts +2 -2
  28. package/models/entities/generated/ApiType.d.ts +2 -1
  29. package/models/entities/generated/Clue.d.ts +8 -0
  30. package/models/entities/generated/Hit.d.ts +2 -20
  31. package/models/entities/generated/Labels.d.ts +1 -0
  32. package/models/entities/generated/Type.d.ts +7 -0
  33. package/package.json +135 -126
  34. package/plugins/HowlerPlugin.js +1 -0
  35. package/plugins/clue/Provider.d.ts +3 -0
  36. package/plugins/clue/Provider.js +13 -0
  37. package/plugins/clue/components/ClueChip.d.ts +3 -0
  38. package/plugins/clue/components/ClueChip.js +29 -0
  39. package/plugins/clue/components/ClueLeadForm.d.ts +4 -0
  40. package/plugins/clue/components/ClueLeadForm.js +24 -0
  41. package/plugins/clue/components/CluePivot.d.ts +3 -0
  42. package/plugins/clue/components/CluePivot.js +145 -0
  43. package/plugins/clue/components/CluePivotForm.d.ts +21 -0
  44. package/plugins/clue/components/CluePivotForm.js +270 -0
  45. package/plugins/clue/components/ClueTypography.d.ts +3 -0
  46. package/plugins/clue/components/ClueTypography.js +53 -0
  47. package/plugins/clue/helpers.d.ts +3 -0
  48. package/plugins/clue/helpers.js +196 -0
  49. package/plugins/clue/index.d.ts +21 -0
  50. package/plugins/clue/index.js +66 -0
  51. package/plugins/clue/locales/clue.en.json +8 -0
  52. package/plugins/clue/locales/clue.fr.json +8 -0
  53. package/plugins/clue/setup.d.ts +2 -0
  54. package/plugins/clue/setup.js +46 -0
  55. package/plugins/clue/utils.d.ts +2 -0
  56. package/plugins/clue/utils.js +19 -0
  57. package/plugins/store.js +3 -0
@@ -0,0 +1,8 @@
1
+ {
2
+ "markdown.helpers.clue.arguments": "Vous devez fournir au moins deux arguments : type et valeur.",
3
+ "route.dossiers.manager.clue": "ID du sélecteur Clue",
4
+ "route.dossiers.manager.clue.type": "Type de sélecteur",
5
+ "route.dossiers.manager.clue.value": "Valeur du sélecteur",
6
+ "route.dossiers.manager.clue.value.custom": "Valeur du sélecteur personnalisé",
7
+ "route.dossiers.manager.clue.value.description": "Vous pouvez utiliser la notation « handlebars » pour insérer des champs à partir de l'alerte correspondante (c'est-à-dire {{howler.id}})."
8
+ }
@@ -0,0 +1,2 @@
1
+ declare const useSetup: () => void;
2
+ export default useSetup;
@@ -0,0 +1,46 @@
1
+ import { SNACKBAR_EVENT_ID } from '@cccsaurora/clue-ui/data/event';
2
+ import useClue from '@cccsaurora/clue-ui/hooks/useClue';
3
+ import { useAppUser } from '@cccsaurora/howler-ui/commons/components/app/hooks/useAppUser';
4
+ import { ApiConfigContext } from '@cccsaurora/howler-ui/components/app/providers/ApiConfigProvider';
5
+ import useMySnackbar from '@cccsaurora/howler-ui/components/hooks/useMySnackbar';
6
+ import { useContext, useEffect } from 'react';
7
+ const useSetup = () => {
8
+ const clue = useClue();
9
+ const appUser = useAppUser();
10
+ const { config } = useContext(ApiConfigContext);
11
+ const { showSuccessMessage, showErrorMessage, showInfoMessage, showWarningMessage } = useMySnackbar();
12
+ const features = config.configuration?.features ?? {};
13
+ useEffect(() => {
14
+ // eslint-disable-next-line no-console
15
+ console.debug('Initializing clue snackbar event handler');
16
+ const handleMessage = (event) => {
17
+ const { detail } = event;
18
+ if (detail.level === 'success') {
19
+ showSuccessMessage(detail.message, detail.timeout, detail.options);
20
+ }
21
+ else if (detail.level === 'error') {
22
+ showErrorMessage(detail.message, detail.timeout, detail.options);
23
+ }
24
+ else if (detail.level === 'info') {
25
+ showInfoMessage(detail.message, detail.timeout, detail.options);
26
+ }
27
+ else if (detail.level === 'warning') {
28
+ showWarningMessage(detail.message, detail.timeout, detail.options);
29
+ }
30
+ };
31
+ window.addEventListener(SNACKBAR_EVENT_ID, handleMessage);
32
+ return () => {
33
+ window.removeEventListener(SNACKBAR_EVENT_ID, handleMessage);
34
+ };
35
+ }, [showErrorMessage, showInfoMessage, showSuccessMessage, showWarningMessage]);
36
+ useEffect(() => {
37
+ if (!appUser.isReady()) {
38
+ return;
39
+ }
40
+ if (features.borealis || features.clue) {
41
+ clue.setReady(true);
42
+ }
43
+ // eslint-disable-next-line react-hooks/exhaustive-deps
44
+ }, [features, appUser.isReady()]);
45
+ };
46
+ export default useSetup;
@@ -0,0 +1,2 @@
1
+ import type { Hit } from '@cccsaurora/howler-ui/models/entities/generated/Hit';
2
+ export declare const useType: (hit?: Hit, field?: string, value?: string) => any;
@@ -0,0 +1,19 @@
1
+ import { useClueEnrichSelector } from '@cccsaurora/clue-ui';
2
+ import { ApiConfigContext } from '@cccsaurora/howler-ui/components/app/providers/ApiConfigProvider';
3
+ import { useContext } from 'react';
4
+ export const useType = (hit, field, value) => {
5
+ const guessType = useClueEnrichSelector(ctx => ctx.guessType);
6
+ const { config } = useContext(ApiConfigContext);
7
+ const typeFromHit = hit?.clue?.types?.find(mapping => mapping.field === field)?.type;
8
+ if (typeFromHit) {
9
+ return typeFromHit;
10
+ }
11
+ const typeFromConfig = config.configuration?.mapping?.[field];
12
+ if (typeFromConfig) {
13
+ return typeFromConfig;
14
+ }
15
+ if (value) {
16
+ return guessType(value.toString());
17
+ }
18
+ return null;
19
+ };
package/plugins/store.js CHANGED
@@ -24,6 +24,9 @@ class HowlerPluginStore {
24
24
  _routes = [];
25
25
  _sitemaps = [];
26
26
  install(plugin) {
27
+ if (this.plugins.includes(plugin.name)) {
28
+ return;
29
+ }
27
30
  console.log(`Installing plugin ${plugin.getPluginName()} by ${plugin.author}`);
28
31
  this.plugins.push(plugin.name);
29
32
  this.pluginStore.install(plugin);