@cccsaurora/clue-ui 1.2.4-patch.275 → 1.2.5-dev.298

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 (188) hide show
  1. package/ActionForm-D6gYuFRR.js +5970 -0
  2. package/AnnotationDetails-Zx4pjBiN.js +175 -0
  3. package/AnnotationPreview-Dmz7taAU.js +188 -0
  4. package/ClueEnrichContext-CJEJxrgs.js +541 -0
  5. package/FlexOne-BSYAhhtG.js +9 -0
  6. package/_MapCache-WmuDdwuH.js +222 -0
  7. package/_Uint8Array-B7JqpgFX.js +128 -0
  8. package/_baseAssignValue-CGTuELqU.js +25 -0
  9. package/_baseClone-CkNrTyhm.js +283 -0
  10. package/_baseExtremum-kob8QXyt.js +18 -0
  11. package/_baseFlatten-jIR_sN_-.js +92 -0
  12. package/_baseGet-Bx3A4Qfp.js +108 -0
  13. package/_baseIsEqual-C5OTWzTk.js +208 -0
  14. package/_baseIteratee-avi7MX2o.js +126 -0
  15. package/_baseSlice-GAv_YFTT.js +20 -0
  16. package/_baseSum-D0WC1dN0.js +13 -0
  17. package/_baseUniq-BI9GIHMF.js +115 -0
  18. package/_commonjsHelpers-DWwsNxpa.js +8 -0
  19. package/_createAggregator-QD8MzKwe.js +63 -0
  20. package/_getPrototype-CU0j_POw.js +5 -0
  21. package/_getTag-Ckxxfr88.js +126 -0
  22. package/_isIterateeCall-Ds3sw2SF.js +17 -0
  23. package/_setToArray-CaPKQhcz.js +33 -0
  24. package/cloneDeep-DJrLSw8W.js +8 -0
  25. package/components/AnnotationBody.js +49 -35
  26. package/components/AnnotationDetailPopover.js +36 -30
  27. package/components/AnnotationDetails.js +7 -7
  28. package/components/AnnotationEntry.js +35 -35
  29. package/components/AnnotationPreview.js +5 -5
  30. package/components/ClassificationChip.js +44 -23
  31. package/components/CountBadge.js +31 -26
  32. package/components/EnrichedCard.js +110 -97
  33. package/components/EnrichedChip.js +130 -105
  34. package/components/EnrichedTypography.js +133 -107
  35. package/components/ErrorBoundary.js +28 -24
  36. package/components/RetryFailedEnrichments.js +10 -9
  37. package/components/SourcePicker.js +57 -49
  38. package/components/actions/ActionForm.js +4 -4
  39. package/components/actions/ExecutePopover.js +75 -59
  40. package/components/actions/ResultModal.js +4 -4
  41. package/components/actions/form/schemaAdapter.js +39 -23
  42. package/components/actions/formats/FileResult.js +86 -59
  43. package/components/actions/formats/index.js +21 -10
  44. package/components/display/graph/ExpandMoreButton.js +10 -10
  45. package/components/display/graph/elements/NodeCard.js +111 -91
  46. package/components/display/graph/elements/NodeTag.js +15 -13
  47. package/components/display/graph/index.js +261 -202
  48. package/components/display/graph/visualizations/Leaf.js +88 -69
  49. package/components/display/graph/visualizations/cloud/index.js +98 -81
  50. package/components/display/graph/visualizations/icons/BaseIcon.js +26 -21
  51. package/components/display/graph/visualizations/icons/BugIcon.js +12 -12
  52. package/components/display/graph/visualizations/icons/HostIcon.js +12 -12
  53. package/components/display/graph/visualizations/icons/NetworkIcon.js +12 -12
  54. package/components/display/graph/visualizations/icons/ProcessIcon.js +12 -12
  55. package/components/display/graph/visualizations/icons/TargetIcon.js +13 -13
  56. package/components/display/graph/visualizations/icons/index.js +14 -13
  57. package/components/display/graph/visualizations/panels/NodePanel.js +10 -8
  58. package/components/display/graph/visualizations/tree/BundleLine.js +108 -81
  59. package/components/display/graph/visualizations/tree/Triangle.js +13 -13
  60. package/components/display/graph/visualizations/tree/index.js +408 -306
  61. package/components/display/icons/Iconified.js +27 -12
  62. package/components/display/json/index.js +4 -4
  63. package/components/display/markdown/index.js +8678 -5770
  64. package/components/enrichment/EnrichPopover.js +54 -46
  65. package/components/fetchers/Fetcher.js +158 -119
  66. package/components/fetchers/PreviewModal.js +20 -17
  67. package/components/fetchers/StatusChip.js +21 -17
  68. package/components/group/Entry.js +13 -11
  69. package/components/group/Group.js +13 -10
  70. package/components/group/GroupControl.js +76 -65
  71. package/components/stats/QueryStatus.js +43 -33
  72. package/countBy-c6S3dvSW.js +14 -0
  73. package/data/event.js +6 -4
  74. package/database/index.js +2 -2
  75. package/debounce-bV0h5FC5.js +92 -0
  76. package/get-DSsNkRQs.js +8 -0
  77. package/groupBy-xqz-n0Vd.js +14 -0
  78. package/hooks/ClueActionContext.d.ts +10 -2
  79. package/hooks/ClueActionContext.js +6 -6
  80. package/hooks/ClueComponentContext.js +29 -23
  81. package/hooks/ClueConfigProvider.js +14 -12
  82. package/hooks/ClueDatabaseContext.js +19 -13
  83. package/hooks/ClueEnrichContext.js +8 -8
  84. package/hooks/ClueFetcherContext.js +83 -56
  85. package/hooks/ClueGroupContext.js +17 -14
  86. package/hooks/CluePopupContext.js +5 -5
  87. package/hooks/ClueProvider.js +12 -10
  88. package/hooks/selectors.js +7 -7
  89. package/hooks/useActionResult.d.ts +1 -0
  90. package/hooks/useActionResult.js +3 -3
  91. package/hooks/useAnnotations.js +47 -31
  92. package/hooks/useClue.js +6 -4
  93. package/hooks/useClueActions.js +3 -3
  94. package/hooks/useClueConfig.js +6 -4
  95. package/hooks/useClueTypeConfig.js +3 -3
  96. package/hooks/useComparator.js +722 -435
  97. package/hooks/useErrors.js +22 -18
  98. package/hooks/useFetcherResult.d.ts +1 -0
  99. package/hooks/useFetcherResult.js +33 -24
  100. package/hooks/useMyHighlights.js +66 -36
  101. package/hooks/useMyLocalStorage.js +66 -37
  102. package/iconify-CXMreGTg.js +1782 -0
  103. package/icons/Action.js +66 -49
  104. package/icons/Assessment.js +85 -69
  105. package/icons/Context.js +77 -63
  106. package/icons/Opinion.js +76 -60
  107. package/icons/iconMap.js +2 -2
  108. package/identity-CPGTqrE4.js +6 -0
  109. package/index-AMfoEg_6.js +696 -0
  110. package/index-B6C2a_Lg.js +1172 -0
  111. package/index-C12gPw2W.js +17698 -0
  112. package/index-DCKkHTvx.js +15750 -0
  113. package/index-JcKyZeoY.js +465 -0
  114. package/isNil-CIubwp4T.js +6 -0
  115. package/isObject-FTY-5JQX.js +7 -0
  116. package/isObjectLike-OAgjjZye.js +48 -0
  117. package/isSymbol-Xd2FsJyp.js +8 -0
  118. package/last-CUCl67Im.js +7 -0
  119. package/main.js +60 -60
  120. package/maxBy-IKHzFrCS.js +8 -0
  121. package/package.json +1 -1
  122. package/sortBy-DfSj8IoJ.js +96 -0
  123. package/sumBy-D-hb_NY-.js +8 -0
  124. package/text/Frequency.js +42 -23
  125. package/toFinite-Bc55msYj.js +16 -0
  126. package/toNumber-DPxy1FBy.js +39 -0
  127. package/types/RunningActionData.d.ts +1 -0
  128. package/types/WithActionData.d.ts +1 -0
  129. package/useClueTypeConfig-Z1LFp01b.js +3289 -0
  130. package/utils/chain.js +92 -65
  131. package/utils/classificationParser.js +519 -256
  132. package/utils/constants.js +35 -10
  133. package/utils/graph.js +72 -45
  134. package/utils/hashUtil.js +7 -7
  135. package/utils/line.js +131 -81
  136. package/utils/loggerUtil.js +5 -3
  137. package/utils/sessionStorage.js +41 -27
  138. package/utils/time.js +423 -423
  139. package/utils/utils.js +9 -9
  140. package/utils/window.js +21 -10
  141. package/utils-HmNPuoDB.js +199 -0
  142. package/ActionForm-CwsfB99X.js +0 -4458
  143. package/AnnotationDetails-Bw2JdtTL.js +0 -160
  144. package/AnnotationPreview-BO7rVnOP.js +0 -140
  145. package/ClueEnrichContext-KqRuuWNS.js +0 -418
  146. package/FlexOne-BXWFOd1T.js +0 -6
  147. package/_MapCache-BiTi0iqu.js +0 -180
  148. package/_Uint8Array-BQNOM9Rr.js +0 -101
  149. package/_baseAssignValue-CNMLQZco.js +0 -20
  150. package/_baseClone-BnT-6pyM.js +0 -207
  151. package/_baseExtremum-Ca2EHgy2.js +0 -16
  152. package/_baseFlatten-Bfr_Molw.js +0 -72
  153. package/_baseGet-DSZygzyq.js +0 -79
  154. package/_baseIsEqual-VgvaAFZG.js +0 -147
  155. package/_baseIteratee-Dbfsw5z8.js +0 -95
  156. package/_baseSlice-M5RKzt1A.js +0 -10
  157. package/_baseSum-wEbgNeUs.js +0 -10
  158. package/_baseUniq-BJcj69PL.js +0 -79
  159. package/_commonjsHelpers-DaMA6jEr.js +0 -8
  160. package/_createAggregator-k3TuAnxT.js +0 -53
  161. package/_getPrototype-Cr1Mk7BC.js +0 -5
  162. package/_getTag-CK2Sffaq.js +0 -90
  163. package/_isIterateeCall-DkJP7Rbx.js +0 -13
  164. package/_setToArray-C7yMOeww.js +0 -29
  165. package/cloneDeep-CF8TtLHr.js +0 -8
  166. package/countBy-CdYegFSu.js +0 -8
  167. package/debounce-DryYcbJ4.js +0 -56
  168. package/get-CH7kz5Ix.js +0 -8
  169. package/groupBy-br8xmD2R.js +0 -8
  170. package/iconify-BBckr5AQ.js +0 -1263
  171. package/identity-ByMq8VxU.js +0 -6
  172. package/index-BHAe_V9n.js +0 -12768
  173. package/index-BK-zfYhR.js +0 -358
  174. package/index-CA5CUNZO.js +0 -975
  175. package/index-Dj5C04IX.js +0 -568
  176. package/index-p5_wX7q1.js +0 -11729
  177. package/isNil-CjWwlQS3.js +0 -6
  178. package/isObject-B53jY8Qg.js +0 -7
  179. package/isObjectLike-BatpeCIi.js +0 -29
  180. package/isSymbol-C3_SC0Qp.js +0 -8
  181. package/last-7CdUxN0r.js +0 -7
  182. package/maxBy-Bc0dYHcO.js +0 -8
  183. package/sortBy-DY2JBf9n.js +0 -75
  184. package/sumBy-DuMASLPd.js +0 -8
  185. package/toFinite-BMy6GObD.js +0 -14
  186. package/toNumber-YVhnnJv4.js +0 -31
  187. package/useClueTypeConfig-Ct9Ygter.js +0 -2292
  188. package/utils-DmwSUrum.js +0 -129
@@ -1,15 +1,15 @@
1
1
  import "react/jsx-runtime";
2
- import "../iconify-BBckr5AQ.js";
3
- import "../useClueTypeConfig-Ct9Ygter.js";
2
+ import "../iconify-CXMreGTg.js";
3
+ import "../useClueTypeConfig-Z1LFp01b.js";
4
4
  import "../utils/loggerUtil.js";
5
- import { C as l, a as s } from "../ClueEnrichContext-KqRuuWNS.js";
6
- import "../debounce-DryYcbJ4.js";
7
- import "../groupBy-br8xmD2R.js";
5
+ import { C, a } from "../ClueEnrichContext-CJEJxrgs.js";
6
+ import "../debounce-bV0h5FC5.js";
7
+ import "../groupBy-xqz-n0Vd.js";
8
8
  import "react";
9
- import "../index-Dj5C04IX.js";
9
+ import "../index-AMfoEg_6.js";
10
10
  import "./ClueDatabaseContext.js";
11
11
  import "./useClueConfig.js";
12
12
  export {
13
- l as ClueEnrichContext,
14
- s as ClueEnrichProvider
13
+ C as ClueEnrichContext,
14
+ a as ClueEnrichProvider
15
15
  };
@@ -1,80 +1,107 @@
1
- import { jsx as P } from "react/jsx-runtime";
2
- import { a as l } from "../useClueTypeConfig-Ct9Ygter.js";
3
- import { SNACKBAR_EVENT_ID as R } from "../data/event.js";
4
- import { safeDispatchEvent as x } from "../utils/window.js";
5
- import { useState as C, useRef as T, useMemo as F, useCallback as h, useEffect as d } from "react";
6
- import { c as _ } from "../index-Dj5C04IX.js";
7
- import j from "./useClue.js";
8
- import z from "./useClueConfig.js";
9
- const H = _(null), U = ({
10
- baseURL: c,
11
- children: N,
12
- classification: A,
13
- getToken: i,
14
- onNetworkCall: u
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { a as api } from "../useClueTypeConfig-Z1LFp01b.js";
3
+ import { SNACKBAR_EVENT_ID } from "../data/event.js";
4
+ import { safeDispatchEvent } from "../utils/window.js";
5
+ import { useState, useRef, useMemo, useCallback, useEffect } from "react";
6
+ import { c as createContext } from "../index-AMfoEg_6.js";
7
+ import useClue from "./useClue.js";
8
+ import useClueConfig from "./useClueConfig.js";
9
+ const ClueFetcherContext = createContext(null);
10
+ const ClueFetcherProvider = ({
11
+ baseURL,
12
+ children,
13
+ classification: _defaultClassification,
14
+ getToken,
15
+ onNetworkCall
15
16
  }) => {
16
- var v, y;
17
- const m = z(), { ready: p } = j(), [a, q] = C(A), [g, w] = C(!1), [E, B] = C({}), n = T({}), o = F(() => {
18
- const t = {}, e = i == null ? void 0 : i();
19
- return e && (t.Authorization = `Bearer ${e}`), u ? u({ baseURL: c, headers: t }) : { baseURL: c, headers: t };
20
- }, [c, i, u]), f = h(
21
- ({ type: t, value: e, classification: r }) => JSON.stringify({ type: t, value: e, classification: r ?? a }),
22
- [a]
23
- ), S = h(
24
- async (t, e) => {
25
- var r;
26
- if ((r = n.current[t]) != null && r[f(e)])
27
- return n.current[t][f(e)];
17
+ var _a, _b;
18
+ const clueConfig = useClueConfig();
19
+ const { ready } = useClue();
20
+ const [defaultClassification, setDefaultClasification] = useState(_defaultClassification);
21
+ const [fetchCompleted, setFetchCompleted] = useState(false);
22
+ const [fetchers, setFetchers] = useState({});
23
+ const fetchRequests = useRef({});
24
+ const requestConfig = useMemo(() => {
25
+ const headers = {};
26
+ const token = getToken == null ? void 0 : getToken();
27
+ if (token) {
28
+ headers.Authorization = `Bearer ${token}`;
29
+ }
30
+ const baseConfig = { baseURL, headers };
31
+ return onNetworkCall ? onNetworkCall(baseConfig) : { baseURL, headers };
32
+ }, [baseURL, getToken, onNetworkCall]);
33
+ const getHashKey = useCallback(
34
+ ({ type, value, classification }) => JSON.stringify({ type, value, classification: classification ?? defaultClassification }),
35
+ [defaultClassification]
36
+ );
37
+ const fetchSelector = useCallback(
38
+ async (fetcherId, selector) => {
39
+ var _a2;
40
+ if ((_a2 = fetchRequests.current[fetcherId]) == null ? void 0 : _a2[getHashKey(selector)]) {
41
+ return fetchRequests.current[fetcherId][getHashKey(selector)];
42
+ }
28
43
  try {
29
- const s = l.fetchers.post(t, e, o);
30
- return n.current[t] || (n.current[t] = {}), n.current[t][f(e)] = s, await s;
31
- } catch (s) {
32
- x(
33
- new CustomEvent(R, {
44
+ const result = api.fetchers.post(fetcherId, selector, requestConfig);
45
+ if (!fetchRequests.current[fetcherId]) {
46
+ fetchRequests.current[fetcherId] = {};
47
+ }
48
+ fetchRequests.current[fetcherId][getHashKey(selector)] = result;
49
+ return await result;
50
+ } catch (e) {
51
+ safeDispatchEvent(
52
+ new CustomEvent(SNACKBAR_EVENT_ID, {
34
53
  detail: {
35
- message: s.toString(),
54
+ message: e.toString(),
36
55
  level: "error"
37
56
  }
38
57
  })
39
58
  );
40
59
  }
41
60
  },
42
- [f, o]
43
- ), D = h(
44
- async (t, e) => {
61
+ [getHashKey, requestConfig]
62
+ );
63
+ const getFetcherStatus = useCallback(
64
+ async (fetcherId, taskId) => {
45
65
  try {
46
- return await l.fetchers.status.get(t, e, {}, o);
47
- } catch (r) {
48
- x(
49
- new CustomEvent(R, {
66
+ const res = await api.fetchers.status.get(fetcherId, taskId, {}, requestConfig);
67
+ return res;
68
+ } catch (e) {
69
+ safeDispatchEvent(
70
+ new CustomEvent(SNACKBAR_EVENT_ID, {
50
71
  detail: {
51
- message: r.toString(),
72
+ message: e.toString(),
52
73
  level: "error"
53
74
  }
54
75
  })
55
76
  );
56
77
  }
57
78
  },
58
- [o]
79
+ [requestConfig]
59
80
  );
60
- d(() => {
61
- var t, e, r, s;
62
- !a && ((e = (t = m.config) == null ? void 0 : t.c12nDef) != null && e.UNRESTRICTED) && q((s = (r = m.config) == null ? void 0 : r.c12nDef) == null ? void 0 : s.UNRESTRICTED);
63
- }, [(y = (v = m.config) == null ? void 0 : v.c12nDef) == null ? void 0 : y.UNRESTRICTED, a]), d(() => {
64
- p && l.fetchers.get(o).then(B).finally(() => w(!0));
65
- }, [c, p]);
66
- const K = F(
81
+ useEffect(() => {
82
+ var _a2, _b2, _c, _d;
83
+ if (!defaultClassification && ((_b2 = (_a2 = clueConfig.config) == null ? void 0 : _a2.c12nDef) == null ? void 0 : _b2.UNRESTRICTED)) {
84
+ setDefaultClasification((_d = (_c = clueConfig.config) == null ? void 0 : _c.c12nDef) == null ? void 0 : _d.UNRESTRICTED);
85
+ }
86
+ }, [(_b = (_a = clueConfig.config) == null ? void 0 : _a.c12nDef) == null ? void 0 : _b.UNRESTRICTED, defaultClassification]);
87
+ useEffect(() => {
88
+ if (!ready) {
89
+ return;
90
+ }
91
+ api.fetchers.get(requestConfig).then(setFetchers).finally(() => setFetchCompleted(true));
92
+ }, [baseURL, ready]);
93
+ const context = useMemo(
67
94
  () => ({
68
- fetchSelector: S,
69
- getFetcherStatus: D,
70
- fetchers: E,
71
- fetchCompleted: g
95
+ fetchSelector,
96
+ getFetcherStatus,
97
+ fetchers,
98
+ fetchCompleted
72
99
  }),
73
- [g, S, E, D]
100
+ [fetchCompleted, fetchSelector, fetchers, getFetcherStatus]
74
101
  );
75
- return /* @__PURE__ */ P(H.Provider, { value: K, children: N });
102
+ return /* @__PURE__ */ jsx(ClueFetcherContext.Provider, { value: context, children });
76
103
  };
77
104
  export {
78
- H as ClueFetcherContext,
79
- U as ClueFetcherProvider
105
+ ClueFetcherContext,
106
+ ClueFetcherProvider
80
107
  };
@@ -1,20 +1,23 @@
1
- import { jsx as l } from "react/jsx-runtime";
2
- import { useState as n, useMemo as c } from "react";
3
- import { c as m } from "../index-Dj5C04IX.js";
4
- import { b as f } from "../ActionForm-CwsfB99X.js";
5
- const C = m(null), G = ({ children: s, type: o, classification: t }) => {
6
- const e = f((i) => i.defaultClassification), [r, u] = n([]), a = c(
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { useState, useMemo } from "react";
3
+ import { c as createContext } from "../index-AMfoEg_6.js";
4
+ import { b as useClueEnrichSelector } from "../ActionForm-D6gYuFRR.js";
5
+ const ClueGroupContext = createContext(null);
6
+ const ClueGroupProvider = ({ children, type, classification }) => {
7
+ const defaultClassification = useClueEnrichSelector((ctx) => ctx.defaultClassification);
8
+ const [values, setValues] = useState([]);
9
+ const context = useMemo(
7
10
  () => ({
8
- type: o,
9
- values: r,
10
- setValues: u,
11
- classification: t ?? e
11
+ type,
12
+ values,
13
+ setValues,
14
+ classification: classification ?? defaultClassification
12
15
  }),
13
- [t, e, o, r]
16
+ [classification, defaultClassification, type, values]
14
17
  );
15
- return /* @__PURE__ */ l(C.Provider, { value: a, children: s });
18
+ return /* @__PURE__ */ jsx(ClueGroupContext.Provider, { value: context, children });
16
19
  };
17
20
  export {
18
- C as ClueGroupContext,
19
- G as ClueGroupProvider
21
+ ClueGroupContext,
22
+ ClueGroupProvider
20
23
  };
@@ -1,12 +1,12 @@
1
1
  import "react/jsx-runtime";
2
2
  import "../components/AnnotationDetailPopover.js";
3
- import { C as a, a as P } from "../AnnotationPreview-BO7rVnOP.js";
3
+ import { C, a } from "../AnnotationPreview-Dmz7taAU.js";
4
4
  import "../data/event.js";
5
5
  import "../utils/window.js";
6
- import "../AnnotationDetails-Bw2JdtTL.js";
6
+ import "../AnnotationDetails-Zx4pjBiN.js";
7
7
  import "react";
8
- import "../index-Dj5C04IX.js";
8
+ import "../index-AMfoEg_6.js";
9
9
  export {
10
- a as CluePopupContext,
11
- P as CluePopupProvider
10
+ C as CluePopupContext,
11
+ a as CluePopupProvider
12
12
  };
@@ -1,12 +1,14 @@
1
- import { jsx as r } from "react/jsx-runtime";
2
- import { C as i } from "../ActionForm-CwsfB99X.js";
3
- import { ClueComponentProvider as m } from "./ClueComponentContext.js";
4
- import { ClueConfigProvider as n } from "./ClueConfigProvider.js";
5
- import { ClueDatabaseProvider as t } from "./ClueDatabaseContext.js";
6
- import { a as d } from "../ClueEnrichContext-KqRuuWNS.js";
7
- import { ClueFetcherProvider as l } from "./ClueFetcherContext.js";
8
- import { a as c } from "../AnnotationPreview-BO7rVnOP.js";
9
- const p = ({ children: o, ...e }) => /* @__PURE__ */ r(m, { ...e, children: /* @__PURE__ */ r(n, { config: e.config, children: /* @__PURE__ */ r(t, { ...e, children: /* @__PURE__ */ r(d, { ...e, children: /* @__PURE__ */ r(l, { ...e, children: /* @__PURE__ */ r(i, { ...e, children: /* @__PURE__ */ r(c, { children: o }) }) }) }) }) }) });
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { C as ClueActionProvider } from "../ActionForm-D6gYuFRR.js";
3
+ import { ClueComponentProvider } from "./ClueComponentContext.js";
4
+ import { ClueConfigProvider } from "./ClueConfigProvider.js";
5
+ import { ClueDatabaseProvider } from "./ClueDatabaseContext.js";
6
+ import { a as ClueEnrichProvider } from "../ClueEnrichContext-CJEJxrgs.js";
7
+ import { ClueFetcherProvider } from "./ClueFetcherContext.js";
8
+ import { a as CluePopupProvider } from "../AnnotationPreview-Dmz7taAU.js";
9
+ const ClueProvider = ({ children, ...props }) => {
10
+ return /* @__PURE__ */ jsx(ClueComponentProvider, { ...props, children: /* @__PURE__ */ jsx(ClueConfigProvider, { config: props.config, children: /* @__PURE__ */ jsx(ClueDatabaseProvider, { ...props, children: /* @__PURE__ */ jsx(ClueEnrichProvider, { ...props, children: /* @__PURE__ */ jsx(ClueFetcherProvider, { ...props, children: /* @__PURE__ */ jsx(ClueActionProvider, { ...props, children: /* @__PURE__ */ jsx(CluePopupProvider, { children }) }) }) }) }) }) });
11
+ };
10
12
  export {
11
- p as ClueProvider
13
+ ClueProvider
12
14
  };
@@ -1,11 +1,11 @@
1
- import { a as l, d as u, b as i, c as m } from "../ActionForm-CwsfB99X.js";
1
+ import { a, d, b, c } from "../ActionForm-D6gYuFRR.js";
2
2
  import "./ClueComponentContext.js";
3
- import "../ClueEnrichContext-KqRuuWNS.js";
3
+ import "../ClueEnrichContext-CJEJxrgs.js";
4
4
  import "./ClueFetcherContext.js";
5
- import "../index-Dj5C04IX.js";
5
+ import "../index-AMfoEg_6.js";
6
6
  export {
7
- l as useClueActionsSelector,
8
- u as useClueComponentSelector,
9
- i as useClueEnrichSelector,
10
- m as useClueFetcherSelector
7
+ a as useClueActionsSelector,
8
+ d as useClueComponentSelector,
9
+ b as useClueEnrichSelector,
10
+ c as useClueFetcherSelector
11
11
  };
@@ -11,5 +11,6 @@ export declare const useActionResult: (resultWithData: WithActionData<ActionResu
11
11
  task_id?: string;
12
12
  actionId: string;
13
13
  action: import("../types/action").ActionDefinition;
14
+ onUpdate?: (result: WithActionData<ActionResult>) => void;
14
15
  onComplete?: (result: WithActionData<ActionResult>) => void;
15
16
  };
@@ -1,7 +1,7 @@
1
1
  import "react";
2
- import "../index-Dj5C04IX.js";
2
+ import "../index-AMfoEg_6.js";
3
3
  import "./ClueComponentContext.js";
4
- import { f as p } from "../ActionForm-CwsfB99X.js";
4
+ import { f } from "../ActionForm-D6gYuFRR.js";
5
5
  export {
6
- p as useActionResult
6
+ f as useActionResult
7
7
  };
@@ -1,60 +1,76 @@
1
- import { u as p } from "../ClueEnrichContext-KqRuuWNS.js";
2
- import { useContext as q, useMemo as d, useState as h, useEffect as u } from "react";
3
- import { ClueDatabaseContext as A } from "./ClueDatabaseContext.js";
4
- import { b as i } from "../ActionForm-CwsfB99X.js";
5
- const D = (n, o, l, { skipEnrichment: a } = { skipEnrichment: !1 }) => {
6
- const s = q(A), f = i((t) => t.defaultClassification), m = i((t) => t.ready), g = i((t) => t.availableSources), b = i((t) => t.queueEnrich), e = d(
7
- () => l ?? f,
8
- [l, f]
9
- ), [$, C] = h(!1), [S, x] = h([]), r = d(
10
- () => m && !!n && !!o && !!e,
11
- [e, m, n, o]
1
+ import { u as uniqBy } from "../ClueEnrichContext-CJEJxrgs.js";
2
+ import { useContext, useMemo, useState, useEffect } from "react";
3
+ import { ClueDatabaseContext } from "./ClueDatabaseContext.js";
4
+ import { b as useClueEnrichSelector } from "../ActionForm-D6gYuFRR.js";
5
+ const useAnnotations = (type, value, _classification, { skipEnrichment } = { skipEnrichment: false }) => {
6
+ const database = useContext(ClueDatabaseContext);
7
+ const defaultClassification = useClueEnrichSelector((ctx) => ctx.defaultClassification);
8
+ const enrichReady = useClueEnrichSelector((ctx) => ctx.ready);
9
+ const availableSources = useClueEnrichSelector((ctx) => ctx.availableSources);
10
+ const queueEnrich = useClueEnrichSelector((state) => state.queueEnrich);
11
+ const classification = useMemo(
12
+ () => _classification ?? defaultClassification,
13
+ [_classification, defaultClassification]
12
14
  );
13
- return u(() => {
14
- if (!r || !(s != null && s.status))
15
+ const [loading, setLoading] = useState(false);
16
+ const [annotations, setAnnotations] = useState([]);
17
+ const ready = useMemo(
18
+ () => enrichReady && !!type && !!value && !!classification,
19
+ [classification, enrichReady, type, value]
20
+ );
21
+ useEffect(() => {
22
+ if (!ready || !(database == null ? void 0 : database.status)) {
15
23
  return;
16
- if (s != null && s.status.closed) {
24
+ }
25
+ if (database == null ? void 0 : database.status.closed) {
17
26
  console.warn("Status collection is closed");
18
27
  return;
19
28
  }
20
- const t = s.status.count({ selector: { type: n, value: o, classification: e, status: "in-progress" } }).$.subscribe((c) => C(c > 0));
29
+ const observable = database.status.count({ selector: { type, value, classification, status: "in-progress" } }).$.subscribe((_count) => setLoading(_count > 0));
21
30
  return () => {
22
- t == null || t.unsubscribe();
31
+ observable == null ? void 0 : observable.unsubscribe();
23
32
  };
24
- }, [e, s, r, n, o]), u(() => {
25
- a || g.length < 1 || !r || b(n, o, e);
26
- }, [g.length, e, b, r, a, n, o]), u(() => {
27
- if (!r || !(s != null && s.selectors) || s.selectors.closed)
33
+ }, [classification, database, ready, type, value]);
34
+ useEffect(() => {
35
+ if (skipEnrichment || availableSources.length < 1 || !ready) {
28
36
  return;
29
- const t = s.selectors.find({
37
+ }
38
+ queueEnrich(type, value, classification);
39
+ }, [availableSources.length, classification, queueEnrich, ready, skipEnrichment, type, value]);
40
+ useEffect(() => {
41
+ if (!ready || !(database == null ? void 0 : database.selectors) || database.selectors.closed) {
42
+ return;
43
+ }
44
+ const observable = database.selectors.find({
30
45
  selector: {
31
46
  $or: [
32
47
  {
33
48
  // Use regex instead of exact value for case-insensitivity
34
- value: { $regex: `^${o}$`, $options: "i" }
49
+ value: { $regex: `^${value}$`, $options: "i" }
35
50
  },
36
51
  {
37
- value: o
52
+ value
38
53
  }
39
54
  ]
40
55
  }
41
56
  }).$.subscribe(
42
- (c) => x(
43
- p(
44
- c.flatMap((E) => E.getAnnotations()),
57
+ (result) => setAnnotations(
58
+ uniqBy(
59
+ result.flatMap((entry) => entry.getAnnotations()),
45
60
  JSON.stringify
46
61
  )
47
62
  )
48
63
  );
49
64
  return () => {
50
65
  try {
51
- t.unsubscribe();
52
- } catch (c) {
53
- console.warn(c);
66
+ observable.unsubscribe();
67
+ } catch (e) {
68
+ console.warn(e);
54
69
  }
55
70
  };
56
- }, [s, r, o]), [S, $];
71
+ }, [database, ready, value]);
72
+ return [annotations, loading];
57
73
  };
58
74
  export {
59
- D as default
75
+ useAnnotations as default
60
76
  };
package/hooks/useClue.js CHANGED
@@ -1,6 +1,8 @@
1
- import { a as t } from "../index-Dj5C04IX.js";
2
- import { C as e } from "../ClueEnrichContext-KqRuuWNS.js";
3
- const s = () => t(e);
1
+ import { a as useContext } from "../index-AMfoEg_6.js";
2
+ import { C as ClueEnrichContext } from "../ClueEnrichContext-CJEJxrgs.js";
3
+ const useClue = () => {
4
+ return useContext(ClueEnrichContext);
5
+ };
4
6
  export {
5
- s as default
7
+ useClue as default
6
8
  };
@@ -1,5 +1,5 @@
1
- import { u as a } from "../ActionForm-CwsfB99X.js";
2
- import "../index-Dj5C04IX.js";
1
+ import { u } from "../ActionForm-D6gYuFRR.js";
2
+ import "../index-AMfoEg_6.js";
3
3
  export {
4
- a as default
4
+ u as default
5
5
  };
@@ -1,6 +1,8 @@
1
- import { ClueConfigContext as o } from "./ClueConfigProvider.js";
2
- import { useContext as t } from "react";
3
- const n = () => t(o);
1
+ import { ClueConfigContext } from "./ClueConfigProvider.js";
2
+ import { useContext } from "react";
3
+ const useClueConfig = () => {
4
+ return useContext(ClueConfigContext);
5
+ };
4
6
  export {
5
- n as default
7
+ useClueConfig as default
6
8
  };
@@ -1,7 +1,7 @@
1
- import { b as i } from "../useClueTypeConfig-Ct9Ygter.js";
1
+ import { b } from "../useClueTypeConfig-Z1LFp01b.js";
2
2
  import "../utils/loggerUtil.js";
3
- import "../_baseUniq-BJcj69PL.js";
3
+ import "../_baseUniq-BI9GIHMF.js";
4
4
  import "react";
5
5
  export {
6
- i as default
6
+ b as default
7
7
  };