@cccsaurora/clue-ui 1.1.0-dev.55 → 1.1.0-dev.89
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.
- package/{ActionForm-BnJ5oGNK.js → ActionForm-ByeOzpc4.js} +146 -30
- package/{AnnotationDetails-fsvrH3_v.js → AnnotationDetails-DknbKDyl.js} +1 -1
- package/{AnnotationPreview-biAV6uKB.js → AnnotationPreview-CQwKs8se.js} +1 -1
- package/{ClueEnrichContext-C4hjLcHp.js → ClueEnrichContext-6NJfXpUB.js} +1 -1
- package/components/AnnotationDetailPopover.js +1 -1
- package/components/AnnotationDetails.js +2 -2
- package/components/AnnotationPreview.js +1 -1
- package/components/EnrichedCard.js +1 -1
- package/components/EnrichedChip.js +1 -1
- package/components/EnrichedTypography.js +1 -1
- package/components/actions/ActionForm.js +1 -1
- package/components/actions/ResultModal.js +12 -39
- package/components/enrichment/EnrichPopover.js +1 -1
- package/components/group/GroupControl.js +1 -1
- package/hooks/ClueActionContext.d.ts +26 -0
- package/hooks/ClueActionContext.js +4 -3
- package/hooks/ClueEnrichContext.js +2 -2
- package/hooks/ClueFetcherContext.js +1 -1
- package/hooks/CluePopupContext.js +2 -2
- package/hooks/ClueProvider.js +3 -3
- package/hooks/selectors.js +2 -2
- package/hooks/useActionResult.d.ts +14 -0
- package/hooks/useActionResult.js +5 -0
- package/hooks/useAnnotations.js +1 -1
- package/hooks/useClue.js +1 -1
- package/hooks/useClueActions.js +1 -1
- package/hooks/useClueTypeConfig.js +1 -1
- package/icons/Action.js +2 -2
- package/icons/Assessment.js +1 -1
- package/icons/Context.js +1 -1
- package/icons/Opinion.js +1 -1
- package/main.js +4 -4
- package/package.json +1 -1
- package/types/RunningActionData.d.ts +4 -3
- package/types/action.d.ts +10 -1
- package/{useClueTypeConfig-HmNKKYHY.js → useClueTypeConfig-XvGvIw2S.js} +21 -4
|
@@ -1,23 +1,27 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { materialRenderers, materialCells } from "@jsonforms/material-renderers";
|
|
3
3
|
import { JsonForms } from "@jsonforms/react";
|
|
4
|
-
import {
|
|
4
|
+
import { Modal, Paper, Stack, Typography, Divider, LinearProgress, Button, IconButton, Box, CircularProgress, Collapse } from "@mui/material";
|
|
5
5
|
import Iconified from "./components/display/icons/Iconified.js";
|
|
6
6
|
import { J as JSONViewer } from "./index-Bi21Wb23.js";
|
|
7
7
|
import { ClueComponentContext } from "./hooks/ClueComponentContext.js";
|
|
8
8
|
import { A as Ajv } from "./index-CC12Ux-9.js";
|
|
9
|
-
import { a as api } from "./useClueTypeConfig-
|
|
9
|
+
import { a as api } from "./useClueTypeConfig-XvGvIw2S.js";
|
|
10
10
|
import { d as toString } from "./_baseGet-BSK_nnoz.js";
|
|
11
11
|
import { b as baseSlice } from "./_baseSlice-GAv_YFTT.js";
|
|
12
12
|
import { i as isEqual } from "./utils-7OtvGnmf.js";
|
|
13
|
-
import { useState,
|
|
14
|
-
import {
|
|
13
|
+
import { useState, useRef, useMemo, useEffect, memo, useCallback } from "react";
|
|
14
|
+
import { u as useContextSelector, c as createContext, a as useContext } from "./index-BDVjGvMI.js";
|
|
15
15
|
import ErrorBoundary from "./components/ErrorBoundary.js";
|
|
16
16
|
import { adaptSchema } from "./components/actions/form/schemaAdapter.js";
|
|
17
|
-
import
|
|
17
|
+
import { I as Icon } from "./iconify-CXMreGTg.js";
|
|
18
|
+
import Markdown from "./components/display/markdown/index.js";
|
|
19
|
+
import ClassificationChip from "./components/ClassificationChip.js";
|
|
18
20
|
import { SNACKBAR_EVENT_ID } from "./data/event.js";
|
|
21
|
+
import { dayjs } from "./utils/time.js";
|
|
19
22
|
import { safeDispatchEvent } from "./utils/window.js";
|
|
20
23
|
import useClue from "./hooks/useClue.js";
|
|
24
|
+
import { i as isNil } from "./isNil-CIubwp4T.js";
|
|
21
25
|
function castSlice(array, start, end) {
|
|
22
26
|
var length = array.length;
|
|
23
27
|
end = end === void 0 ? length : end;
|
|
@@ -55,16 +59,92 @@ var upperFirst = createCaseFirst("toUpperCase");
|
|
|
55
59
|
function capitalize(string) {
|
|
56
60
|
return upperFirst(toString(string).toLowerCase());
|
|
57
61
|
}
|
|
62
|
+
const useActionResult = (resultWithData, interval = 2e3) => {
|
|
63
|
+
const [result, setResult] = useState(resultWithData);
|
|
64
|
+
const timeoutRef = useRef(null);
|
|
65
|
+
const { getActionStatus } = useClueActions();
|
|
66
|
+
const taskId = useMemo(() => resultWithData == null ? void 0 : resultWithData.task_id, [resultWithData == null ? void 0 : resultWithData.task_id]);
|
|
67
|
+
const actionId = useMemo(() => resultWithData == null ? void 0 : resultWithData.actionId, [resultWithData == null ? void 0 : resultWithData.actionId]);
|
|
68
|
+
useEffect(() => {
|
|
69
|
+
if ((resultWithData == null ? void 0 : resultWithData.outcome) !== "pending" || !taskId) return;
|
|
70
|
+
let cancelled = false;
|
|
71
|
+
const poll = async () => {
|
|
72
|
+
const res = await getActionStatus(actionId, taskId);
|
|
73
|
+
if (!res) {
|
|
74
|
+
setResult({ outcome: "failure", done: true });
|
|
75
|
+
} else if (res.outcome === "success" || res.outcome === "failure") {
|
|
76
|
+
setResult({ ...res, done: true });
|
|
77
|
+
} else {
|
|
78
|
+
if (cancelled) return;
|
|
79
|
+
setResult({ ...res });
|
|
80
|
+
timeoutRef.current = setTimeout(poll, interval);
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
poll();
|
|
84
|
+
return () => {
|
|
85
|
+
cancelled = true;
|
|
86
|
+
if (timeoutRef.current) clearTimeout(timeoutRef.current);
|
|
87
|
+
};
|
|
88
|
+
}, [actionId, getActionStatus, interval, resultWithData == null ? void 0 : resultWithData.outcome, taskId]);
|
|
89
|
+
useEffect(() => {
|
|
90
|
+
setResult(resultWithData);
|
|
91
|
+
}, [resultWithData]);
|
|
92
|
+
return useMemo(
|
|
93
|
+
() => resultWithData || result ? { ...resultWithData, ...result } : void 0,
|
|
94
|
+
[resultWithData, result]
|
|
95
|
+
);
|
|
96
|
+
};
|
|
97
|
+
const ResultModal = ({ result: _result, onClose, show = false }) => {
|
|
98
|
+
var _a, _b;
|
|
99
|
+
const { t } = useContextSelector(ClueComponentContext, (ctx) => ctx.i18next);
|
|
100
|
+
const result = useActionResult(_result);
|
|
101
|
+
if (!result) {
|
|
102
|
+
return null;
|
|
103
|
+
}
|
|
104
|
+
return /* @__PURE__ */ jsx(Modal, { open: show, sx: { display: "flex", alignItems: "center", justifyContent: "center" }, onClose, children: /* @__PURE__ */ jsx(Paper, { sx: { maxHeight: "80%", maxWidth: "80%", height: "100%", p: 2, minWidth: "750px" }, children: /* @__PURE__ */ jsx(ErrorBoundary, { children: /* @__PURE__ */ jsxs(Stack, { spacing: 1, height: "100%", children: [
|
|
105
|
+
/* @__PURE__ */ jsxs(Stack, { direction: "row", spacing: 1, alignItems: "center", children: [
|
|
106
|
+
result.action.action_icon && /* @__PURE__ */ jsx(Icon, { height: "1.5rem", icon: result.action.action_icon }),
|
|
107
|
+
/* @__PURE__ */ jsx(Typography, { variant: "h5", children: result.action.name }),
|
|
108
|
+
result.action.supported_types && /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "text.secondary", children: result.action.supported_types.map((type) => type.toUpperCase()).join(", ") }),
|
|
109
|
+
/* @__PURE__ */ jsx("div", { style: { flex: 1 } }),
|
|
110
|
+
/* @__PURE__ */ jsx(ClassificationChip, { size: "small", classification: result.action.classification })
|
|
111
|
+
] }),
|
|
112
|
+
/* @__PURE__ */ jsx(Typography, { variant: "body1", children: result.action.summary }),
|
|
113
|
+
/* @__PURE__ */ jsx(Divider, { flexItem: true }),
|
|
114
|
+
result.done ? /* @__PURE__ */ jsx(ErrorBoundary, { children: result.format === "markdown" ? /* @__PURE__ */ jsx(Markdown, { md: result.output }) : result.format === "json" ? /* @__PURE__ */ jsx(JSONViewer, { data: result.output, collapse: true, forceCompact: true }) : /* @__PURE__ */ jsxs(Stack, { sx: { overflowY: "auto" }, children: [
|
|
115
|
+
/* @__PURE__ */ jsx(Markdown, { md: "`" + result.format + "` is not recognized as a format in this application." }),
|
|
116
|
+
/* @__PURE__ */ jsx(JSONViewer, { data: result, collapse: true, forceCompact: true })
|
|
117
|
+
] }) }) : /* @__PURE__ */ jsxs(Stack, { flex: 1, sx: { pt: 2, alignItems: "center" }, spacing: 1, children: [
|
|
118
|
+
result.summary && /* @__PURE__ */ jsx(Typography, { variant: "caption", children: result.summary }),
|
|
119
|
+
/* @__PURE__ */ jsx(
|
|
120
|
+
LinearProgress,
|
|
121
|
+
{
|
|
122
|
+
variant: ((_a = result.output) == null ? void 0 : _a.progress) ? "determinate" : "indeterminate",
|
|
123
|
+
value: ((_b = result.output) == null ? void 0 : _b.progress) * 100,
|
|
124
|
+
sx: { maxWidth: 500, width: "100%", borderRadius: (theme) => theme.shape.borderRadius }
|
|
125
|
+
}
|
|
126
|
+
)
|
|
127
|
+
] }),
|
|
128
|
+
/* @__PURE__ */ jsx("div", { style: { flex: 1 } }),
|
|
129
|
+
/* @__PURE__ */ jsxs(Stack, { direction: "row", spacing: 1, children: [
|
|
130
|
+
/* @__PURE__ */ jsx("div", { style: { flex: 1 } }),
|
|
131
|
+
result.link && /* @__PURE__ */ jsx(Button, { variant: "outlined", component: "a", target: "_blank", href: result.link, children: t("details.open") }),
|
|
132
|
+
/* @__PURE__ */ jsx(Button, { variant: "outlined", color: "error", onClick: onClose, children: t("close") })
|
|
133
|
+
] })
|
|
134
|
+
] }) }) }) });
|
|
135
|
+
};
|
|
136
|
+
const ResultModal$1 = memo(ResultModal);
|
|
58
137
|
const AJV = new Ajv({ removeAdditional: true, coerceTypes: true, strict: false });
|
|
59
138
|
const ClueActionContext = createContext(null);
|
|
60
139
|
const ClueActionProvider = ({
|
|
61
140
|
baseURL,
|
|
62
141
|
children,
|
|
63
142
|
classification: defaultClassification,
|
|
143
|
+
includeContext: defaultIncludeContext,
|
|
64
144
|
getToken,
|
|
65
145
|
onNetworkCall
|
|
66
146
|
}) => {
|
|
67
|
-
const { t } = useContextSelector(ClueComponentContext, (ctx) => ctx.i18next);
|
|
147
|
+
const { t, i18n } = useContextSelector(ClueComponentContext, (ctx) => ctx.i18next);
|
|
68
148
|
const { ready } = useClue();
|
|
69
149
|
const [runningActionData, setRunningActionData] = useState(null);
|
|
70
150
|
const [actionResults, setActionResults] = useState({});
|
|
@@ -72,25 +152,25 @@ const ClueActionProvider = ({
|
|
|
72
152
|
const [lastResult, setLastResult] = useState(null);
|
|
73
153
|
const [loading, setLoading] = useState(false);
|
|
74
154
|
const [availableActions, setAvailableActions] = useState({});
|
|
75
|
-
const
|
|
76
|
-
if (!ready) {
|
|
77
|
-
return;
|
|
78
|
-
}
|
|
155
|
+
const requestConfig = useMemo(() => {
|
|
79
156
|
const headers = {};
|
|
80
157
|
const token = getToken == null ? void 0 : getToken();
|
|
81
158
|
if (token) {
|
|
82
159
|
headers.Authorization = `Bearer ${token}`;
|
|
83
160
|
}
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
161
|
+
const baseConfig = { baseURL, headers };
|
|
162
|
+
return onNetworkCall ? onNetworkCall(baseConfig) : { baseURL, headers };
|
|
163
|
+
}, [baseURL, getToken, onNetworkCall]);
|
|
164
|
+
const refreshActions = useCallback(async () => {
|
|
165
|
+
if (!ready) {
|
|
166
|
+
return;
|
|
87
167
|
}
|
|
88
168
|
const _actions = await api.actions.get(requestConfig);
|
|
89
169
|
if (_actions) {
|
|
90
170
|
setAvailableActions(_actions);
|
|
91
171
|
}
|
|
92
172
|
return _actions;
|
|
93
|
-
}, [
|
|
173
|
+
}, [ready, requestConfig]);
|
|
94
174
|
useEffect(() => {
|
|
95
175
|
refreshActions();
|
|
96
176
|
}, [baseURL, ready]);
|
|
@@ -100,18 +180,15 @@ const ClueActionProvider = ({
|
|
|
100
180
|
);
|
|
101
181
|
const executeAction = useCallback(
|
|
102
182
|
async (actionId, selectors, params, options) => {
|
|
103
|
-
const { forceMenu, onComplete, skipMenu, timeout } = {
|
|
183
|
+
const { forceMenu, onComplete, skipMenu, skipResultModal, timeout, includeContext, extraContext } = {
|
|
104
184
|
forceMenu: false,
|
|
105
185
|
skipMenu: false,
|
|
106
186
|
onComplete: null,
|
|
107
187
|
timeout: null,
|
|
188
|
+
includeContext: defaultIncludeContext ?? false,
|
|
189
|
+
extraContext: null,
|
|
108
190
|
...options
|
|
109
191
|
};
|
|
110
|
-
const headers = {};
|
|
111
|
-
const token = getToken == null ? void 0 : getToken();
|
|
112
|
-
if (token) {
|
|
113
|
-
headers.Authorization = `Bearer ${token}`;
|
|
114
|
-
}
|
|
115
192
|
if (!Object.keys(availableActions).includes(actionId)) {
|
|
116
193
|
throw new Error("Invalid action id");
|
|
117
194
|
}
|
|
@@ -121,6 +198,20 @@ const ClueActionProvider = ({
|
|
|
121
198
|
const actionToRun = availableActions[actionId];
|
|
122
199
|
const validator = AJV.compile(actionToRun.params);
|
|
123
200
|
const validatedParams = { selectors: stringifiedSelectors, ...params };
|
|
201
|
+
let context2 = null;
|
|
202
|
+
if (includeContext) {
|
|
203
|
+
context2 = {
|
|
204
|
+
timestamp: dayjs().toISOString(),
|
|
205
|
+
url: window.location,
|
|
206
|
+
language: (i18n == null ? void 0 : i18n.language) ?? "en"
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
if (!isNil(extraContext)) {
|
|
210
|
+
context2 = {
|
|
211
|
+
...context2 ?? {},
|
|
212
|
+
...extraContext
|
|
213
|
+
};
|
|
214
|
+
}
|
|
124
215
|
setLoading(true);
|
|
125
216
|
if (!validator(validatedParams) || forceMenu) {
|
|
126
217
|
if (skipMenu && !forceMenu) {
|
|
@@ -143,20 +234,18 @@ const ClueActionProvider = ({
|
|
|
143
234
|
action: actionToRun,
|
|
144
235
|
selectors,
|
|
145
236
|
params: validatedParams ?? {},
|
|
237
|
+
context: context2,
|
|
146
238
|
onComplete,
|
|
147
239
|
timeout
|
|
148
240
|
});
|
|
149
241
|
return;
|
|
150
242
|
}
|
|
151
243
|
try {
|
|
152
|
-
let requestConfig = { baseURL, headers };
|
|
153
|
-
if (onNetworkCall) {
|
|
154
|
-
requestConfig = onNetworkCall(requestConfig);
|
|
155
|
-
}
|
|
156
244
|
const actionResult = await api.actions.post(
|
|
157
245
|
actionId,
|
|
158
246
|
stringifiedSelectors,
|
|
159
247
|
validatedParams ?? {},
|
|
248
|
+
context2,
|
|
160
249
|
{ timeout },
|
|
161
250
|
requestConfig
|
|
162
251
|
);
|
|
@@ -183,7 +272,7 @@ const ClueActionProvider = ({
|
|
|
183
272
|
actionResult.link && /* @__PURE__ */ jsx(IconButton, { component: "a", href: actionResult.link, size: "small", target: "_blank", children: /* @__PURE__ */ jsx(Iconified, { icon: "ic:baseline-open-in-new", fontSize: "small" }) })
|
|
184
273
|
] }),
|
|
185
274
|
timeout: actionResult.link ? null : 5e3,
|
|
186
|
-
level: actionResult.outcome === "success" ? "success" : "error",
|
|
275
|
+
level: actionResult.outcome === "success" ? "success" : actionResult.outcome === "pending" ? "info" : "error",
|
|
187
276
|
options: {
|
|
188
277
|
style: {
|
|
189
278
|
minWidth: 0
|
|
@@ -200,9 +289,15 @@ const ClueActionProvider = ({
|
|
|
200
289
|
if (actionResult.outcome === "success") {
|
|
201
290
|
setRunningActionData(null);
|
|
202
291
|
}
|
|
292
|
+
if (actionResult.outcome === "pending") {
|
|
293
|
+
setLastResult({ ...actionResult, actionId, action: actionToRun });
|
|
294
|
+
if (!skipResultModal) {
|
|
295
|
+
setShowResultModal(true);
|
|
296
|
+
}
|
|
297
|
+
}
|
|
203
298
|
if (actionResult.format) {
|
|
204
299
|
setLastResult({ ...actionResult, actionId, action: actionToRun });
|
|
205
|
-
if (actionResult.format !== "pivot") {
|
|
300
|
+
if (actionResult.format !== "pivot" && !skipResultModal) {
|
|
206
301
|
setShowResultModal(true);
|
|
207
302
|
} else {
|
|
208
303
|
window.open(actionResult.output, "_blank", "noreferrer");
|
|
@@ -221,7 +316,25 @@ const ClueActionProvider = ({
|
|
|
221
316
|
setLoading(false);
|
|
222
317
|
}
|
|
223
318
|
},
|
|
224
|
-
[availableActions,
|
|
319
|
+
[availableActions, defaultIncludeContext, getHashKey, i18n == null ? void 0 : i18n.language, requestConfig, runningActionData == null ? void 0 : runningActionData.id, t]
|
|
320
|
+
);
|
|
321
|
+
const getActionStatus = useCallback(
|
|
322
|
+
async (actionId, taskId) => {
|
|
323
|
+
try {
|
|
324
|
+
const res = await api.actions.status.get(actionId, taskId, {}, requestConfig);
|
|
325
|
+
return res;
|
|
326
|
+
} catch (e) {
|
|
327
|
+
safeDispatchEvent(
|
|
328
|
+
new CustomEvent(SNACKBAR_EVENT_ID, {
|
|
329
|
+
detail: {
|
|
330
|
+
message: e.toString(),
|
|
331
|
+
level: "error"
|
|
332
|
+
}
|
|
333
|
+
})
|
|
334
|
+
);
|
|
335
|
+
}
|
|
336
|
+
},
|
|
337
|
+
[requestConfig]
|
|
225
338
|
);
|
|
226
339
|
const cancelAction = useCallback(() => {
|
|
227
340
|
setRunningActionData(null);
|
|
@@ -236,18 +349,19 @@ const ClueActionProvider = ({
|
|
|
236
349
|
availableActions,
|
|
237
350
|
executeAction,
|
|
238
351
|
cancelAction,
|
|
352
|
+
getActionStatus,
|
|
239
353
|
getActionResults,
|
|
240
354
|
loading,
|
|
241
355
|
refreshActions
|
|
242
356
|
}),
|
|
243
|
-
[availableActions, cancelAction, executeAction, getActionResults, loading, refreshActions]
|
|
357
|
+
[availableActions, cancelAction, executeAction, getActionResults, getActionStatus, loading, refreshActions]
|
|
244
358
|
);
|
|
245
359
|
return /* @__PURE__ */ jsxs(ClueActionContext.Provider, { value: context, children: [
|
|
246
360
|
children,
|
|
247
361
|
/* @__PURE__ */ jsxs(ErrorBoundary, { children: [
|
|
248
362
|
runningActionData && /* @__PURE__ */ jsx(ActionForm$1, { runningActionData }),
|
|
249
363
|
/* @__PURE__ */ jsx(
|
|
250
|
-
ResultModal,
|
|
364
|
+
ResultModal$1,
|
|
251
365
|
{
|
|
252
366
|
show: showResultModal && !!lastResult,
|
|
253
367
|
result: lastResult,
|
|
@@ -433,7 +547,9 @@ const ActionForm$1 = memo(ActionForm);
|
|
|
433
547
|
export {
|
|
434
548
|
ActionForm$1 as A,
|
|
435
549
|
ClueActionProvider as C,
|
|
550
|
+
ResultModal$1 as R,
|
|
436
551
|
ClueActionContext as a,
|
|
552
|
+
useActionResult as b,
|
|
437
553
|
capitalize as c,
|
|
438
554
|
useClueActions as u
|
|
439
555
|
};
|
|
@@ -10,7 +10,7 @@ import useErrors from "./hooks/useErrors.js";
|
|
|
10
10
|
import { ICON_MAP } from "./icons/iconMap.js";
|
|
11
11
|
import { safeDispatchEvent } from "./utils/window.js";
|
|
12
12
|
import { g as groupBy } from "./groupBy-DC2oOuBN.js";
|
|
13
|
-
import { u as uniq } from "./ClueEnrichContext-
|
|
13
|
+
import { u as uniq } from "./ClueEnrichContext-6NJfXpUB.js";
|
|
14
14
|
import { memo, useState, useMemo, useCallback, useEffect } from "react";
|
|
15
15
|
import { u as useContextSelector } from "./index-BDVjGvMI.js";
|
|
16
16
|
import ExecutePopover from "./components/actions/ExecutePopover.js";
|
|
@@ -8,7 +8,7 @@ import { useState, useRef, useCallback, useEffect, useMemo } from "react";
|
|
|
8
8
|
import { c as createContext, u as useContextSelector } from "./index-BDVjGvMI.js";
|
|
9
9
|
import { SHOW_EVENT_ID, HIDE_EVENT_ID } from "./data/event.js";
|
|
10
10
|
import { safeDispatchEvent, safeAddEventListener } from "./utils/window.js";
|
|
11
|
-
import { i as isNull } from "./AnnotationDetails-
|
|
11
|
+
import { i as isNull } from "./AnnotationDetails-DknbKDyl.js";
|
|
12
12
|
const CluePopupContext = createContext(null);
|
|
13
13
|
const CluePopupProvider = ({ children }) => {
|
|
14
14
|
const [popupType, setPopupType] = useState(null);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { a as addAPIProvider } from "./iconify-CXMreGTg.js";
|
|
3
|
-
import { u as useClueTypeConfig, a as api, p as post } from "./useClueTypeConfig-
|
|
3
|
+
import { u as useClueTypeConfig, a as api, p as post } from "./useClueTypeConfig-XvGvIw2S.js";
|
|
4
4
|
import { clueDebugLogger } from "./utils/loggerUtil.js";
|
|
5
5
|
import { b as baseSlice } from "./_baseSlice-GAv_YFTT.js";
|
|
6
6
|
import { t as toFinite } from "./toFinite-Bc55msYj.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { Popover } from "@mui/material";
|
|
3
3
|
import React__default, { useRef, useState, useEffect } from "react";
|
|
4
|
-
import { A as AnnotationDetails } from "../AnnotationDetails-
|
|
4
|
+
import { A as AnnotationDetails } from "../AnnotationDetails-DknbKDyl.js";
|
|
5
5
|
const AnnotationDetailPopover = React__default.memo(({ anchorEl, enrichRequest, open, onClose, ...otherProps }) => {
|
|
6
6
|
var _a, _b, _c;
|
|
7
7
|
const actionRef = useRef();
|
|
@@ -10,8 +10,8 @@ import "../hooks/useErrors.js";
|
|
|
10
10
|
import "../icons/iconMap.js";
|
|
11
11
|
import "../utils/window.js";
|
|
12
12
|
import "../groupBy-DC2oOuBN.js";
|
|
13
|
-
import { A } from "../AnnotationDetails-
|
|
14
|
-
import "../ClueEnrichContext-
|
|
13
|
+
import { A } from "../AnnotationDetails-DknbKDyl.js";
|
|
14
|
+
import "../ClueEnrichContext-6NJfXpUB.js";
|
|
15
15
|
import "react";
|
|
16
16
|
import "../index-BDVjGvMI.js";
|
|
17
17
|
import "./actions/ExecutePopover.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "react/jsx-runtime";
|
|
2
2
|
import "../iconify-CXMreGTg.js";
|
|
3
3
|
import "@mui/material";
|
|
4
|
-
import { A } from "../AnnotationPreview-
|
|
4
|
+
import { A } from "../AnnotationPreview-CQwKs8se.js";
|
|
5
5
|
import "../hooks/useAnnotations.js";
|
|
6
6
|
import "../utils-7OtvGnmf.js";
|
|
7
7
|
import "react";
|
|
@@ -10,7 +10,7 @@ import ContextIcon from "../icons/Context.js";
|
|
|
10
10
|
import OpinionIcon from "../icons/Opinion.js";
|
|
11
11
|
import { ICON_MAP } from "../icons/iconMap.js";
|
|
12
12
|
import FrequencyText from "../text/Frequency.js";
|
|
13
|
-
import { u as uniq } from "../ClueEnrichContext-
|
|
13
|
+
import { u as uniq } from "../ClueEnrichContext-6NJfXpUB.js";
|
|
14
14
|
import { memo, useState, useMemo, useCallback } from "react";
|
|
15
15
|
import { u as useContextSelector } from "../index-BDVjGvMI.js";
|
|
16
16
|
import AnnotationEntry from "./AnnotationEntry.js";
|
|
@@ -3,7 +3,7 @@ import { Chip, Tooltip, Box, Stack, CircularProgress } from "@mui/material";
|
|
|
3
3
|
import Iconified from "./display/icons/Iconified.js";
|
|
4
4
|
import { ClueComponentContext } from "../hooks/ClueComponentContext.js";
|
|
5
5
|
import { ClueGroupContext } from "../hooks/ClueGroupContext.js";
|
|
6
|
-
import { C as CluePopupContext } from "../AnnotationPreview-
|
|
6
|
+
import { C as CluePopupContext } from "../AnnotationPreview-CQwKs8se.js";
|
|
7
7
|
import { useClueEnrichSelector } from "../hooks/selectors.js";
|
|
8
8
|
import useAnnotations from "../hooks/useAnnotations.js";
|
|
9
9
|
import ActionIcon from "../icons/Action.js";
|
|
@@ -3,7 +3,7 @@ import { useTheme, Stack, CircularProgress, Tooltip, IconButton } from "@mui/mat
|
|
|
3
3
|
import Iconified from "./display/icons/Iconified.js";
|
|
4
4
|
import { ClueComponentContext } from "../hooks/ClueComponentContext.js";
|
|
5
5
|
import { ClueGroupContext } from "../hooks/ClueGroupContext.js";
|
|
6
|
-
import { C as CluePopupContext } from "../AnnotationPreview-
|
|
6
|
+
import { C as CluePopupContext } from "../AnnotationPreview-CQwKs8se.js";
|
|
7
7
|
import { useClueEnrichSelector } from "../hooks/selectors.js";
|
|
8
8
|
import useAnnotations from "../hooks/useAnnotations.js";
|
|
9
9
|
import ActionIcon from "../icons/Action.js";
|
|
@@ -5,7 +5,7 @@ import "@mui/material";
|
|
|
5
5
|
import "../display/icons/Iconified.js";
|
|
6
6
|
import "../../index-Bi21Wb23.js";
|
|
7
7
|
import "../../hooks/ClueComponentContext.js";
|
|
8
|
-
import { A } from "../../ActionForm-
|
|
8
|
+
import { A } from "../../ActionForm-ByeOzpc4.js";
|
|
9
9
|
import "../../utils-7OtvGnmf.js";
|
|
10
10
|
import "react";
|
|
11
11
|
import "../../index-BDVjGvMI.js";
|
|
@@ -1,41 +1,14 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
|
|
12
|
-
const { t } = useContextSelector(ClueComponentContext, (ctx) => ctx.i18next);
|
|
13
|
-
if (!result) {
|
|
14
|
-
return null;
|
|
15
|
-
}
|
|
16
|
-
return /* @__PURE__ */ jsx(Modal, { open: show, sx: { display: "flex", alignItems: "center", justifyContent: "center" }, onClose, children: /* @__PURE__ */ jsx(Paper, { sx: { maxHeight: "80%", maxWidth: "80%", height: "100%", p: 2, minWidth: "750px" }, children: /* @__PURE__ */ jsx(ErrorBoundary, { children: /* @__PURE__ */ jsxs(Stack, { spacing: 1, height: "100%", children: [
|
|
17
|
-
/* @__PURE__ */ jsxs(Stack, { direction: "row", spacing: 1, alignItems: "center", children: [
|
|
18
|
-
result.action.action_icon && /* @__PURE__ */ jsx(Icon, { height: "1.5rem", icon: result.action.action_icon }),
|
|
19
|
-
/* @__PURE__ */ jsx(Typography, { variant: "h5", children: result.action.name }),
|
|
20
|
-
result.action.supported_types && /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "text.secondary", children: result.action.supported_types.map((type) => type.toUpperCase()).join(", ") }),
|
|
21
|
-
/* @__PURE__ */ jsx("div", { style: { flex: 1 } }),
|
|
22
|
-
/* @__PURE__ */ jsx(ClassificationChip, { size: "small", classification: result.action.classification })
|
|
23
|
-
] }),
|
|
24
|
-
/* @__PURE__ */ jsx(Typography, { variant: "body1", children: result.action.summary }),
|
|
25
|
-
/* @__PURE__ */ jsx(Divider, { flexItem: true }),
|
|
26
|
-
/* @__PURE__ */ jsxs(ErrorBoundary, { children: [
|
|
27
|
-
result.format === "markdown" && /* @__PURE__ */ jsx(Markdown, { md: result.output }),
|
|
28
|
-
result.format === "json" && /* @__PURE__ */ jsx(JSONViewer, { data: result.output, collapse: true, forceCompact: true })
|
|
29
|
-
] }),
|
|
30
|
-
/* @__PURE__ */ jsx("div", { style: { flex: 1 } }),
|
|
31
|
-
/* @__PURE__ */ jsxs(Stack, { direction: "row", spacing: 1, children: [
|
|
32
|
-
/* @__PURE__ */ jsx("div", { style: { flex: 1 } }),
|
|
33
|
-
result.link && /* @__PURE__ */ jsx(Button, { variant: "outlined", component: "a", target: "_blank", href: result.link, children: t("details.open") }),
|
|
34
|
-
/* @__PURE__ */ jsx(Button, { variant: "outlined", color: "error", onClick: onClose, children: t("close") })
|
|
35
|
-
] })
|
|
36
|
-
] }) }) }) });
|
|
37
|
-
};
|
|
38
|
-
const ResultModal$1 = memo(ResultModal);
|
|
1
|
+
import "react/jsx-runtime";
|
|
2
|
+
import "../../iconify-CXMreGTg.js";
|
|
3
|
+
import "@mui/material";
|
|
4
|
+
import "../../index-Bi21Wb23.js";
|
|
5
|
+
import "../display/markdown/index.js";
|
|
6
|
+
import "../../hooks/ClueComponentContext.js";
|
|
7
|
+
import { R } from "../../ActionForm-ByeOzpc4.js";
|
|
8
|
+
import "react";
|
|
9
|
+
import "../../index-BDVjGvMI.js";
|
|
10
|
+
import "../ClassificationChip.js";
|
|
11
|
+
import "../ErrorBoundary.js";
|
|
39
12
|
export {
|
|
40
|
-
|
|
13
|
+
R as default
|
|
41
14
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useTheme, Tooltip, IconButton, CircularProgress, Button, Popover, Paper, Stack, Box, Typography, Divider } from "@mui/material";
|
|
3
3
|
import { useClueComponentSelector, useClueEnrichSelector } from "../../hooks/selectors.js";
|
|
4
|
-
import { c as capitalize } from "../../ActionForm-
|
|
4
|
+
import { c as capitalize } from "../../ActionForm-ByeOzpc4.js";
|
|
5
5
|
import { useState, useRef, useCallback, useEffect } from "react";
|
|
6
6
|
import Iconified from "../display/icons/Iconified.js";
|
|
7
7
|
const EnrichPopover = ({ show = false, size = "small", selector }) => {
|
|
@@ -6,7 +6,7 @@ import { SNACKBAR_EVENT_ID } from "../../data/event.js";
|
|
|
6
6
|
import { ClueGroupContext } from "../../hooks/ClueGroupContext.js";
|
|
7
7
|
import { useClueComponentSelector, useClueEnrichSelector } from "../../hooks/selectors.js";
|
|
8
8
|
import { safeDispatchEvent } from "../../utils/window.js";
|
|
9
|
-
import { c as capitalize } from "../../ActionForm-
|
|
9
|
+
import { c as capitalize } from "../../ActionForm-ByeOzpc4.js";
|
|
10
10
|
import { useState, useMemo, useCallback } from "react";
|
|
11
11
|
import { u as useContextSelector } from "../../index-BDVjGvMI.js";
|
|
12
12
|
import ExecutePopover from "../actions/ExecutePopover.js";
|
|
@@ -33,6 +33,10 @@ export interface ClueActionContextType {
|
|
|
33
33
|
* Should the function raise an exception instead of showing the menu if the form is not completed?
|
|
34
34
|
*/
|
|
35
35
|
skipMenu?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Should the result modal be shown?
|
|
38
|
+
*/
|
|
39
|
+
skipResultModal?: boolean;
|
|
36
40
|
/**
|
|
37
41
|
* Callback for post-execution.
|
|
38
42
|
* @param result
|
|
@@ -43,6 +47,18 @@ export interface ClueActionContextType {
|
|
|
43
47
|
* how long should the action have to respond?
|
|
44
48
|
*/
|
|
45
49
|
timeout?: number;
|
|
50
|
+
/**
|
|
51
|
+
* Should contextual information about the source of the action be included?
|
|
52
|
+
*
|
|
53
|
+
* This information includes:
|
|
54
|
+
* - Exact execution time
|
|
55
|
+
* - Current URL on execution
|
|
56
|
+
*/
|
|
57
|
+
includeContext?: boolean;
|
|
58
|
+
/**
|
|
59
|
+
* Additional context information to include on execution. Useful for tight connections between actions and the UI.
|
|
60
|
+
*/
|
|
61
|
+
extraContext?: Record<string, any>;
|
|
46
62
|
}) => Promise<void>;
|
|
47
63
|
/**
|
|
48
64
|
* Cancel an action pending user input.
|
|
@@ -56,6 +72,12 @@ export interface ClueActionContextType {
|
|
|
56
72
|
* @returns the list of results for a given selector
|
|
57
73
|
*/
|
|
58
74
|
getActionResults: (type: string, value: string, classification?: string) => WithActionData<ActionResult>[];
|
|
75
|
+
/**
|
|
76
|
+
* Get the status of an ongoing action
|
|
77
|
+
* @param actionId The ID of the action to get the status of
|
|
78
|
+
* @param taskId The task id to get the status of
|
|
79
|
+
*/
|
|
80
|
+
getActionStatus: (actionId: string, taskId: string) => Promise<WithActionData<ActionResult>>;
|
|
59
81
|
/**
|
|
60
82
|
* Is there currently an action executing?
|
|
61
83
|
*/
|
|
@@ -71,6 +93,10 @@ export interface ClueActionProps {
|
|
|
71
93
|
* What should the default classification be when executing actions?
|
|
72
94
|
*/
|
|
73
95
|
classification?: string;
|
|
96
|
+
/**
|
|
97
|
+
* Should basic context information (execution time, current url) be included when executing an action?
|
|
98
|
+
*/
|
|
99
|
+
includeContext?: boolean;
|
|
74
100
|
/**
|
|
75
101
|
* Get an access token for the clue API.
|
|
76
102
|
*
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
import "react/jsx-runtime";
|
|
2
2
|
import "@mui/material";
|
|
3
3
|
import "../index-CC12Ux-9.js";
|
|
4
|
-
import "../useClueTypeConfig-
|
|
5
|
-
import { a, C } from "../ActionForm-
|
|
6
|
-
import "../components/actions/ResultModal.js";
|
|
4
|
+
import "../useClueTypeConfig-XvGvIw2S.js";
|
|
5
|
+
import { a, C } from "../ActionForm-ByeOzpc4.js";
|
|
7
6
|
import "../components/display/icons/Iconified.js";
|
|
8
7
|
import "../components/ErrorBoundary.js";
|
|
9
8
|
import "../data/event.js";
|
|
9
|
+
import "../utils/time.js";
|
|
10
10
|
import "../utils/window.js";
|
|
11
11
|
import "react";
|
|
12
12
|
import "../index-BDVjGvMI.js";
|
|
13
13
|
import "./ClueComponentContext.js";
|
|
14
14
|
import "./useClue.js";
|
|
15
|
+
import "../isNil-CIubwp4T.js";
|
|
15
16
|
export {
|
|
16
17
|
a as ClueActionContext,
|
|
17
18
|
C as ClueActionProvider
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import "react/jsx-runtime";
|
|
2
2
|
import "../iconify-CXMreGTg.js";
|
|
3
|
-
import "../useClueTypeConfig-
|
|
3
|
+
import "../useClueTypeConfig-XvGvIw2S.js";
|
|
4
4
|
import "../utils/loggerUtil.js";
|
|
5
|
-
import { C, a } from "../ClueEnrichContext-
|
|
5
|
+
import { C, a } from "../ClueEnrichContext-6NJfXpUB.js";
|
|
6
6
|
import "../debounce-bV0h5FC5.js";
|
|
7
7
|
import "../groupBy-DC2oOuBN.js";
|
|
8
8
|
import "react";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { a as api } from "../useClueTypeConfig-
|
|
2
|
+
import { a as api } from "../useClueTypeConfig-XvGvIw2S.js";
|
|
3
3
|
import { useState, useRef, useCallback, useEffect, useMemo } from "react";
|
|
4
4
|
import { c as createContext } from "../index-BDVjGvMI.js";
|
|
5
5
|
import useClue from "./useClue.js";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import "react/jsx-runtime";
|
|
2
2
|
import "../components/AnnotationDetailPopover.js";
|
|
3
|
-
import { C, a } from "../AnnotationPreview-
|
|
3
|
+
import { C, a } from "../AnnotationPreview-CQwKs8se.js";
|
|
4
4
|
import "../data/event.js";
|
|
5
5
|
import "../utils/window.js";
|
|
6
|
-
import "../AnnotationDetails-
|
|
6
|
+
import "../AnnotationDetails-DknbKDyl.js";
|
|
7
7
|
import "react";
|
|
8
8
|
import "../index-BDVjGvMI.js";
|
|
9
9
|
export {
|
package/hooks/ClueProvider.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { C as ClueActionProvider } from "../ActionForm-
|
|
2
|
+
import { C as ClueActionProvider } from "../ActionForm-ByeOzpc4.js";
|
|
3
3
|
import { ClueComponentProvider } from "./ClueComponentContext.js";
|
|
4
4
|
import { ClueConfigProvider } from "./ClueConfigProvider.js";
|
|
5
5
|
import { ClueDatabaseProvider } from "./ClueDatabaseContext.js";
|
|
6
|
-
import { a as ClueEnrichProvider } from "../ClueEnrichContext-
|
|
6
|
+
import { a as ClueEnrichProvider } from "../ClueEnrichContext-6NJfXpUB.js";
|
|
7
7
|
import { ClueFetcherProvider } from "./ClueFetcherContext.js";
|
|
8
|
-
import { a as CluePopupProvider } from "../AnnotationPreview-
|
|
8
|
+
import { a as CluePopupProvider } from "../AnnotationPreview-CQwKs8se.js";
|
|
9
9
|
const ClueProvider = ({ children, ...props }) => {
|
|
10
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
11
|
};
|
package/hooks/selectors.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { a as ClueActionContext } from "../ActionForm-
|
|
1
|
+
import { a as ClueActionContext } from "../ActionForm-ByeOzpc4.js";
|
|
2
2
|
import { ClueComponentContext } from "./ClueComponentContext.js";
|
|
3
|
-
import { C as ClueEnrichContext } from "../ClueEnrichContext-
|
|
3
|
+
import { C as ClueEnrichContext } from "../ClueEnrichContext-6NJfXpUB.js";
|
|
4
4
|
import { ClueFetcherContext } from "./ClueFetcherContext.js";
|
|
5
5
|
import { u as useContextSelector } from "../index-BDVjGvMI.js";
|
|
6
6
|
const useClueFetcherSelector = (selector) => {
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ActionResult } from "../types/action";
|
|
2
|
+
import { WithActionData } from "../types/WithActionData";
|
|
3
|
+
|
|
4
|
+
export declare const useActionResult: (resultWithData: WithActionData<ActionResult>, interval?: number) => {
|
|
5
|
+
outcome: "success" | "failure" | "pending";
|
|
6
|
+
summary?: string;
|
|
7
|
+
output?: any;
|
|
8
|
+
format?: string;
|
|
9
|
+
link?: string;
|
|
10
|
+
done?: boolean;
|
|
11
|
+
task_id?: string;
|
|
12
|
+
actionId: string;
|
|
13
|
+
action: import("../types/action").ActionDefinition;
|
|
14
|
+
};
|
package/hooks/useAnnotations.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { b as uniqBy } from "../ClueEnrichContext-
|
|
1
|
+
import { b as uniqBy } from "../ClueEnrichContext-6NJfXpUB.js";
|
|
2
2
|
import { useContext, useMemo, useState, useEffect } from "react";
|
|
3
3
|
import { ClueDatabaseContext } from "./ClueDatabaseContext.js";
|
|
4
4
|
import { useClueEnrichSelector } from "./selectors.js";
|
package/hooks/useClue.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { a as useContext } from "../index-BDVjGvMI.js";
|
|
2
|
-
import { C as ClueEnrichContext } from "../ClueEnrichContext-
|
|
2
|
+
import { C as ClueEnrichContext } from "../ClueEnrichContext-6NJfXpUB.js";
|
|
3
3
|
const useClue = () => {
|
|
4
4
|
return useContext(ClueEnrichContext);
|
|
5
5
|
};
|
package/hooks/useClueActions.js
CHANGED
package/icons/Action.js
CHANGED
|
@@ -2,8 +2,8 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { I as Icon } from "../iconify-CXMreGTg.js";
|
|
3
3
|
import { useTheme, Stack, Divider, Typography } from "@mui/material";
|
|
4
4
|
import CountBadge from "../components/CountBadge.js";
|
|
5
|
-
import { C as CluePopupContext } from "../AnnotationPreview-
|
|
6
|
-
import { u as useClueActions } from "../ActionForm-
|
|
5
|
+
import { C as CluePopupContext } from "../AnnotationPreview-CQwKs8se.js";
|
|
6
|
+
import { u as useClueActions } from "../ActionForm-ByeOzpc4.js";
|
|
7
7
|
import { g as groupBy } from "../groupBy-DC2oOuBN.js";
|
|
8
8
|
import { memo, useRef, useMemo, useEffect } from "react";
|
|
9
9
|
import { u as useContextSelector } from "../index-BDVjGvMI.js";
|
package/icons/Assessment.js
CHANGED
|
@@ -2,7 +2,7 @@ import { jsxs, jsx, Fragment } from "react/jsx-runtime";
|
|
|
2
2
|
import { I as Icon } from "../iconify-CXMreGTg.js";
|
|
3
3
|
import { useTheme, Stack, Chip, Divider, Grid, Tooltip } from "@mui/material";
|
|
4
4
|
import CountBadge from "../components/CountBadge.js";
|
|
5
|
-
import { C as CluePopupContext } from "../AnnotationPreview-
|
|
5
|
+
import { C as CluePopupContext } from "../AnnotationPreview-CQwKs8se.js";
|
|
6
6
|
import { g as groupBy } from "../groupBy-DC2oOuBN.js";
|
|
7
7
|
import { l as last } from "../last-CUCl67Im.js";
|
|
8
8
|
import { m as maxBy, s as sortBy } from "../sortBy-B-UKp4GT.js";
|
package/icons/Context.js
CHANGED
|
@@ -4,7 +4,7 @@ import { Stack, Divider } from "@mui/material";
|
|
|
4
4
|
import AnnotationEntry from "../components/AnnotationEntry.js";
|
|
5
5
|
import CountBadge from "../components/CountBadge.js";
|
|
6
6
|
import Iconified from "../components/display/icons/Iconified.js";
|
|
7
|
-
import { C as CluePopupContext } from "../AnnotationPreview-
|
|
7
|
+
import { C as CluePopupContext } from "../AnnotationPreview-CQwKs8se.js";
|
|
8
8
|
import { g as groupBy } from "../groupBy-DC2oOuBN.js";
|
|
9
9
|
import { memo, useRef, useMemo, useEffect } from "react";
|
|
10
10
|
import { u as useContextSelector } from "../index-BDVjGvMI.js";
|
package/icons/Opinion.js
CHANGED
|
@@ -2,7 +2,7 @@ import { jsxs, jsx, Fragment } from "react/jsx-runtime";
|
|
|
2
2
|
import { I as Icon } from "../iconify-CXMreGTg.js";
|
|
3
3
|
import { useTheme, Stack, Chip, Divider, Grid } from "@mui/material";
|
|
4
4
|
import CountBadge from "../components/CountBadge.js";
|
|
5
|
-
import { C as CluePopupContext } from "../AnnotationPreview-
|
|
5
|
+
import { C as CluePopupContext } from "../AnnotationPreview-CQwKs8se.js";
|
|
6
6
|
import chain from "../utils/chain.js";
|
|
7
7
|
import { g as groupBy } from "../groupBy-DC2oOuBN.js";
|
|
8
8
|
import { s as sortBy } from "../sortBy-B-UKp4GT.js";
|
package/main.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { A, u } from "./ActionForm-
|
|
1
|
+
import { A, u } from "./ActionForm-ByeOzpc4.js";
|
|
2
2
|
import { default as default2 } from "./components/AnnotationDetailPopover.js";
|
|
3
|
-
import { A as A2 } from "./AnnotationDetails-
|
|
3
|
+
import { A as A2 } from "./AnnotationDetails-DknbKDyl.js";
|
|
4
4
|
import { default as default3 } from "./components/AnnotationEntry.js";
|
|
5
|
-
import { A as A3, C } from "./AnnotationPreview-
|
|
5
|
+
import { A as A3, C } from "./AnnotationPreview-CQwKs8se.js";
|
|
6
6
|
import { default as default4 } from "./components/CountBadge.js";
|
|
7
7
|
import { default as default5 } from "./components/EnrichedCard.js";
|
|
8
8
|
import { default as default6 } from "./components/EnrichedChip.js";
|
|
@@ -18,7 +18,7 @@ import { b } from "./index-CC12Ux-9.js";
|
|
|
18
18
|
import { ClueComponentContext } from "./hooks/ClueComponentContext.js";
|
|
19
19
|
import { ClueConfigContext } from "./hooks/ClueConfigProvider.js";
|
|
20
20
|
import { ClueDatabaseContext } from "./hooks/ClueDatabaseContext.js";
|
|
21
|
-
import { C as C2 } from "./ClueEnrichContext-
|
|
21
|
+
import { C as C2 } from "./ClueEnrichContext-6NJfXpUB.js";
|
|
22
22
|
import { ClueProvider } from "./hooks/ClueProvider.js";
|
|
23
23
|
import { useClueActionsSelector, useClueEnrichSelector, useClueFetcherSelector } from "./hooks/selectors.js";
|
|
24
24
|
import { default as default14 } from "./hooks/useClue.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ActionDefinition, ActionResult } from "../
|
|
2
|
-
import { Selector } from
|
|
3
|
-
import {
|
|
1
|
+
import { ActionContextInformation, ActionDefinition, ActionResult } from "../types/action";
|
|
2
|
+
import { Selector } from "../types/lookup";
|
|
3
|
+
import { WithActionData } from './WithActionData';
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
interface RunningActionData {
|
|
@@ -8,6 +8,7 @@ interface RunningActionData {
|
|
|
8
8
|
action: ActionDefinition;
|
|
9
9
|
selectors: Selector[];
|
|
10
10
|
params: { [index: string]: any };
|
|
11
|
+
context?: ActionContextInformation;
|
|
11
12
|
onComplete?: (result: WithActionData<ActionResult>) => void;
|
|
12
13
|
timeout?: number;
|
|
13
14
|
}
|
package/types/action.d.ts
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
import { JSONSchema7 } from 'json-schema';
|
|
2
2
|
|
|
3
3
|
|
|
4
|
+
export interface ActionContextInformation {
|
|
5
|
+
url?: string;
|
|
6
|
+
timestamp?: string;
|
|
7
|
+
language?: string;
|
|
8
|
+
[key: string]: any;
|
|
9
|
+
}
|
|
10
|
+
|
|
4
11
|
export interface ActionDefinition {
|
|
5
12
|
accept_multiple?: boolean;
|
|
6
13
|
action_icon?: string;
|
|
@@ -15,11 +22,13 @@ export interface ActionDefinition {
|
|
|
15
22
|
}
|
|
16
23
|
|
|
17
24
|
export interface ActionResult<T = any> {
|
|
18
|
-
outcome: 'success' | 'failure';
|
|
25
|
+
outcome: 'success' | 'failure' | 'pending';
|
|
19
26
|
summary?: string;
|
|
20
27
|
output?: T;
|
|
21
28
|
format?: string;
|
|
22
29
|
link?: string;
|
|
30
|
+
done?: boolean;
|
|
31
|
+
task_id?: string;
|
|
23
32
|
}
|
|
24
33
|
|
|
25
34
|
export type ActionDefinitionsResponse = { [type: string]: ActionDefinition };
|
|
@@ -8,13 +8,28 @@ import { getAxiosCache, setAxiosCache } from "./utils/sessionStorage.js";
|
|
|
8
8
|
import { clueDebugLogger } from "./utils/loggerUtil.js";
|
|
9
9
|
import { i as isEmpty } from "./isEmpty-BQkZubqU.js";
|
|
10
10
|
import { useState, useEffect } from "react";
|
|
11
|
+
const get$8 = (actionId, taskId, options = { timeout: null }, config) => {
|
|
12
|
+
const searchParams = [];
|
|
13
|
+
if (!isNil(options.timeout)) {
|
|
14
|
+
searchParams.push(`max_timeout=${options.timeout}`);
|
|
15
|
+
}
|
|
16
|
+
return hget(
|
|
17
|
+
joinUri(uri$c(), `${actionId.replace(".", "/")}/status/${taskId}`),
|
|
18
|
+
searchParams.length > 0 ? new URLSearchParams(searchParams.join("&")) : null,
|
|
19
|
+
config
|
|
20
|
+
);
|
|
21
|
+
};
|
|
22
|
+
const status = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
23
|
+
__proto__: null,
|
|
24
|
+
get: get$8
|
|
25
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
11
26
|
const uri$c = () => {
|
|
12
27
|
return joinUri(uri(), "actions");
|
|
13
28
|
};
|
|
14
29
|
const get$7 = (config) => {
|
|
15
30
|
return hget(uri$c(), null, config);
|
|
16
31
|
};
|
|
17
|
-
const post$3 = (actionId, selectors, params, options = { timeout: null }, config) => {
|
|
32
|
+
const post$3 = (actionId, selectors, params, context, options = { timeout: null }, config) => {
|
|
18
33
|
const searchParams = [];
|
|
19
34
|
if (!isNil(options.timeout)) {
|
|
20
35
|
searchParams.push(`max_timeout=${options.timeout}`);
|
|
@@ -29,6 +44,7 @@ const post$3 = (actionId, selectors, params, options = { timeout: null }, config
|
|
|
29
44
|
} else {
|
|
30
45
|
payload.selectors = selectors;
|
|
31
46
|
}
|
|
47
|
+
payload.context = context ?? null;
|
|
32
48
|
return hpost(
|
|
33
49
|
joinUri(
|
|
34
50
|
joinUri(uri$c(), "execute"),
|
|
@@ -43,6 +59,7 @@ const actions = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePrope
|
|
|
43
59
|
__proto__: null,
|
|
44
60
|
get: get$7,
|
|
45
61
|
post: post$3,
|
|
62
|
+
status,
|
|
46
63
|
uri: uri$c
|
|
47
64
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
48
65
|
const uri$b = (searchParams) => {
|
|
@@ -1084,8 +1101,8 @@ const defaults = {
|
|
|
1084
1101
|
FormData: platform.classes.FormData,
|
|
1085
1102
|
Blob: platform.classes.Blob
|
|
1086
1103
|
},
|
|
1087
|
-
validateStatus: function validateStatus(
|
|
1088
|
-
return
|
|
1104
|
+
validateStatus: function validateStatus(status2) {
|
|
1105
|
+
return status2 >= 200 && status2 < 300;
|
|
1089
1106
|
},
|
|
1090
1107
|
headers: {
|
|
1091
1108
|
common: {
|
|
@@ -2921,7 +2938,7 @@ class AxiosClient {
|
|
|
2921
2938
|
constructor() {
|
|
2922
2939
|
__publicField(this, "client");
|
|
2923
2940
|
this.client = axios.create({
|
|
2924
|
-
validateStatus: (
|
|
2941
|
+
validateStatus: (status2) => status2 >= 200 && status2 < 300 || status2 === 304
|
|
2925
2942
|
});
|
|
2926
2943
|
new AxiosCache(this.client);
|
|
2927
2944
|
axiosRetry(this.client, {
|