impact-chatbot 3.0.0 → 3.1.0
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/dist/components/allocation-detail-panel/AllocationDetailPanel.d.ts +2 -0
- package/dist/components/allocation-detail-panel/AllocationPlanCard.d.ts +4 -0
- package/dist/components/allocation-detail-panel/components/PanelHeader.d.ts +8 -0
- package/dist/components/allocation-detail-panel/components/PanelSection.d.ts +4 -0
- package/dist/components/allocation-detail-panel/components/ReportSummaryCard.d.ts +4 -0
- package/dist/components/allocation-detail-panel/components/StructuredComparison.d.ts +4 -0
- package/dist/components/allocation-detail-panel/styles.d.ts +1 -0
- package/dist/components/message-template/components/message-content/SurfaceFrameContent.d.ts +37 -0
- package/dist/components/message-template/components/message-content/surfaceWidgets.d.ts +22 -0
- package/dist/index.cjs.js +1034 -28
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +1035 -29
- package/dist/index.esm.js.map +1 -1
- package/dist/services/chatbot-services.d.ts +3 -0
- package/package.json +22 -8
package/dist/index.esm.js
CHANGED
|
@@ -16,7 +16,7 @@ import DOMPurify from 'dompurify';
|
|
|
16
16
|
import { useNavigate, useLocation } from 'react-router-dom-v5-compat';
|
|
17
17
|
import RefreshIcon from '@mui/icons-material/Refresh';
|
|
18
18
|
import styled from 'styled-components';
|
|
19
|
-
import { CircularProgress, Typography, Grid } from '@mui/material';
|
|
19
|
+
import { CircularProgress, Typography, Grid, Box, IconButton, Accordion, AccordionSummary, AccordionDetails } from '@mui/material';
|
|
20
20
|
import { Button, Modal, Slider, Select, DatePicker, DateRangePicker, Checkbox, RadioButtonGroup, Input, Tabs, Loader, Prompt, Tooltip, ChatBotComponent } from 'impact-ui-v3';
|
|
21
21
|
import isArray$2 from 'lodash/isArray';
|
|
22
22
|
import isEmpty$2 from 'lodash/isEmpty';
|
|
@@ -38,10 +38,19 @@ import 'highcharts/esm/modules/heatmap.js';
|
|
|
38
38
|
import 'highcharts/esm/modules/pareto.js';
|
|
39
39
|
import makeStyles$1 from '@mui/styles/makeStyles';
|
|
40
40
|
import ChevronRightIcon$1 from '@mui/icons-material/ChevronRight';
|
|
41
|
+
import DescriptionOutlinedIcon from '@mui/icons-material/DescriptionOutlined';
|
|
42
|
+
import OpenInNewIcon from '@mui/icons-material/OpenInNew';
|
|
41
43
|
import FormatListBulletedOutlinedIcon from '@mui/icons-material/FormatListBulletedOutlined';
|
|
42
44
|
import PsychologyOutlinedIcon from '@mui/icons-material/PsychologyOutlined';
|
|
43
45
|
import SaveOutlinedIcon from '@mui/icons-material/SaveOutlined';
|
|
44
46
|
import 'react-dates/lib/css/_datepicker.css';
|
|
47
|
+
import { createPortal } from 'react-dom';
|
|
48
|
+
import VisibilityOutlinedIcon from '@mui/icons-material/VisibilityOutlined';
|
|
49
|
+
import OpenInFullIcon from '@mui/icons-material/OpenInFull';
|
|
50
|
+
import CloseFullscreenIcon from '@mui/icons-material/CloseFullscreen';
|
|
51
|
+
import CloseIcon from '@mui/icons-material/Close';
|
|
52
|
+
import ExpandMoreIcon from '@mui/icons-material/ExpandMore';
|
|
53
|
+
import ArrowForwardIcon from '@mui/icons-material/ArrowForward';
|
|
45
54
|
|
|
46
55
|
/**
|
|
47
56
|
* Internal HTTP client module for impact-chatbot.
|
|
@@ -811,6 +820,21 @@ const getTableRecords = async (payload, baseUrl, tableName) => {
|
|
|
811
820
|
return null;
|
|
812
821
|
}
|
|
813
822
|
};
|
|
823
|
+
/** A read for a generated surface (frame protocol iui:query): the agent runs one read tool as the signed-in
|
|
824
|
+
* user and answers {rows, total}. */
|
|
825
|
+
const postUiQuery = async (payload, baseUrl) => {
|
|
826
|
+
try {
|
|
827
|
+
return axiosInstance({
|
|
828
|
+
url: `${baseUrl}/chatbot/agent/ui-query`,
|
|
829
|
+
method: 'POST',
|
|
830
|
+
data: payload,
|
|
831
|
+
});
|
|
832
|
+
}
|
|
833
|
+
catch (error) {
|
|
834
|
+
console.error('postUiQuery error:', error);
|
|
835
|
+
return null;
|
|
836
|
+
}
|
|
837
|
+
};
|
|
814
838
|
const getTableRecordsByUrl = async (payload, url) => {
|
|
815
839
|
try {
|
|
816
840
|
return httpRequest({
|
|
@@ -1433,6 +1457,7 @@ const parseResponse = (data, type, agentId = "", currentMode = "", disableTimeAn
|
|
|
1433
1457
|
isDisabled: data?.data?.isDisabled,
|
|
1434
1458
|
orientation: data?.data?.orientation,
|
|
1435
1459
|
options: data?.data?.options,
|
|
1460
|
+
defaultSelected: data?.data?.defaultSelected,
|
|
1436
1461
|
paramName: data?.data?.param_name
|
|
1437
1462
|
}
|
|
1438
1463
|
};
|
|
@@ -1512,6 +1537,17 @@ const parseResponse = (data, type, agentId = "", currentMode = "", disableTimeAn
|
|
|
1512
1537
|
bodyType: "html",
|
|
1513
1538
|
bodyText: { content: data?.data?.content || "" },
|
|
1514
1539
|
};
|
|
1540
|
+
case "allocation_plan_card":
|
|
1541
|
+
return {
|
|
1542
|
+
...data,
|
|
1543
|
+
timeStamp: timeString,
|
|
1544
|
+
userType: "bot",
|
|
1545
|
+
userName: userName,
|
|
1546
|
+
headerTitle: "",
|
|
1547
|
+
noShowHeaderTitle: true,
|
|
1548
|
+
bodyType: "allocation_plan_card",
|
|
1549
|
+
bodyText: data?.data || data,
|
|
1550
|
+
};
|
|
1515
1551
|
case "image":
|
|
1516
1552
|
return {
|
|
1517
1553
|
...data,
|
|
@@ -1539,6 +1575,18 @@ const parseResponse = (data, type, agentId = "", currentMode = "", disableTimeAn
|
|
|
1539
1575
|
thinkingResponse: utilityObject?.thinkingResponse,
|
|
1540
1576
|
enableLikes: true
|
|
1541
1577
|
};
|
|
1578
|
+
case "surface_frame":
|
|
1579
|
+
// A generated UI surface drawn by the UI service's renderer page (Impact UI 5), which SurfaceFrameContent embeds
|
|
1580
|
+
return {
|
|
1581
|
+
...data,
|
|
1582
|
+
agentId: agentId,
|
|
1583
|
+
timeStamp: timeString,
|
|
1584
|
+
userType: "bot",
|
|
1585
|
+
userName: userName,
|
|
1586
|
+
headerTitle: data?.data?.surface?.title || "",
|
|
1587
|
+
bodyType: "surface_frame",
|
|
1588
|
+
bodyText: data?.data,
|
|
1589
|
+
};
|
|
1542
1590
|
default:
|
|
1543
1591
|
return null;
|
|
1544
1592
|
}
|
|
@@ -2801,6 +2849,10 @@ const useAgentFlow = (dateFormat, chatDataRef, currentMode, setShowChatPlacehold
|
|
|
2801
2849
|
answer_mode: data?.answerMode || "auto",
|
|
2802
2850
|
...(!isEmpty(utilityObjectData?.additionalArgs) ? utilityObjectData.additionalArgs : {}),
|
|
2803
2851
|
};
|
|
2852
|
+
if (data?.uiContext && typeof data.uiContext === "object") {
|
|
2853
|
+
// a follow-up asked from a generated surface: which surface, and its input values
|
|
2854
|
+
payload.ui_context = data.uiContext;
|
|
2855
|
+
}
|
|
2804
2856
|
// Handle @ filter mentions - user_explicit_input contains filter values
|
|
2805
2857
|
if (!isEmpty(data?.userExplicitInput)) {
|
|
2806
2858
|
payload.user_explicit_input = data?.userExplicitInput;
|
|
@@ -3261,9 +3313,16 @@ const useChatFlow = (chatDataRef, setLoader, setFlowType, setScreenName, setUser
|
|
|
3261
3313
|
else if (data.actionType === "indirect") {
|
|
3262
3314
|
setUserInput(data.displayText);
|
|
3263
3315
|
}
|
|
3264
|
-
else {
|
|
3316
|
+
else if (data.screen_name) {
|
|
3265
3317
|
fetchUserResultsFromQuery(data, true, "", activeConversationId);
|
|
3266
3318
|
}
|
|
3319
|
+
else {
|
|
3320
|
+
// No screen_name (e.g. suggested follow-up chips from navigation-v2):
|
|
3321
|
+
// treat the chip's displayText as a regular user query so it flows
|
|
3322
|
+
// through the navigation streaming endpoint instead of the
|
|
3323
|
+
// fetchRelatedQuestions screen-based endpoint.
|
|
3324
|
+
fetchUserResultsFromQuery(data, false, data.displayText, activeConversationId);
|
|
3325
|
+
}
|
|
3267
3326
|
}, [activeConversationId, baseUrl]);
|
|
3268
3327
|
const fetchUserResultsFromQuery = useCallback(async (refObject, fetchQuestions = false, inputValue = userInput, conversationId = activeConversationId) => {
|
|
3269
3328
|
let flowType = refObject?.flow_type ? refObject?.flow_type : currentMode;
|
|
@@ -5995,6 +6054,73 @@ const QuestionsContent = ({ bodyText, props }) => {
|
|
|
5995
6054
|
}) }));
|
|
5996
6055
|
};
|
|
5997
6056
|
|
|
6057
|
+
/**
|
|
6058
|
+
* One widget per generated surface in a stream: the agent may send a surface more than once (a placeholder
|
|
6059
|
+
* while it is composed, `status: "pending"`, version 0; then the surface, version 1; or its withdrawal), and
|
|
6060
|
+
* frame protocol 1 replaces a surface by its id (agent-ui-service-ssr docs/chat-frame-widget.md, rule 4).
|
|
6061
|
+
* No imports: the stream reader (AxiosEventSource) uses it too. Ported from core's smartBot
|
|
6062
|
+
* (insideinsight/core feat/iui-surface, e386f8f0).
|
|
6063
|
+
*/
|
|
6064
|
+
/** A surface's version; one when it gives none. */
|
|
6065
|
+
const surfaceVersion = (surface) => (Number.isFinite(surface?.version) ? surface.version : 1);
|
|
6066
|
+
const surfaceIdOf = (widget) => (widget?.type === "surface_frame" ? widget?.data?.surface?.id : undefined);
|
|
6067
|
+
/** A stream's widgets with these added: a surface_frame widget whose surface the list already holds replaces
|
|
6068
|
+
* it in place (a lower version is dropped); any other widget is added at the end. */
|
|
6069
|
+
const mergeSurfaceWidgets = (previous, incoming) => {
|
|
6070
|
+
const merged = Array.isArray(previous) ? previous.slice() : previous ? [previous] : [];
|
|
6071
|
+
for (const widget of Array.isArray(incoming) ? incoming : [incoming]) {
|
|
6072
|
+
const id = surfaceIdOf(widget);
|
|
6073
|
+
const at = id === undefined ? -1 : merged.findIndex((w) => surfaceIdOf(w) === id);
|
|
6074
|
+
if (at < 0)
|
|
6075
|
+
merged.push(widget);
|
|
6076
|
+
else if (surfaceVersion(widget.data.surface) >= surfaceVersion(merged[at].data.surface))
|
|
6077
|
+
merged[at] = widget;
|
|
6078
|
+
}
|
|
6079
|
+
return merged;
|
|
6080
|
+
};
|
|
6081
|
+
/*
|
|
6082
|
+
* Across the chat's messages (one page per surface): a surface revised in a later turn is shown, newest
|
|
6083
|
+
* version, where that turn put it; each earlier widget of it collapses to a line. Every SurfaceFrameContent
|
|
6084
|
+
* says which version it shows; a widget whose surface another widget shows in a higher version collapses.
|
|
6085
|
+
* Placeholders and withdrawn surfaces take no part. Equal versions (the same surface drawn in two places)
|
|
6086
|
+
* both show.
|
|
6087
|
+
*/
|
|
6088
|
+
const shownVersions = new Map(); // surface id -> Map(widget token -> version)
|
|
6089
|
+
const watchers = new Set();
|
|
6090
|
+
let lastToken = 0;
|
|
6091
|
+
/** A token for one widget. */
|
|
6092
|
+
const surfaceToken = () => {
|
|
6093
|
+
lastToken += 1;
|
|
6094
|
+
return lastToken;
|
|
6095
|
+
};
|
|
6096
|
+
const notify = () => watchers.forEach((watch) => watch());
|
|
6097
|
+
/** This widget shows `version` of surface `id`. */
|
|
6098
|
+
const showSurface = (id, token, version) => {
|
|
6099
|
+
if (!shownVersions.has(id))
|
|
6100
|
+
shownVersions.set(id, new Map());
|
|
6101
|
+
shownVersions.get(id).set(token, version);
|
|
6102
|
+
notify();
|
|
6103
|
+
};
|
|
6104
|
+
/** This widget no longer shows surface `id`. */
|
|
6105
|
+
const hideSurface = (id, token) => {
|
|
6106
|
+
const versions = shownVersions.get(id);
|
|
6107
|
+
if (!versions)
|
|
6108
|
+
return;
|
|
6109
|
+
versions.delete(token);
|
|
6110
|
+
if (versions.size === 0)
|
|
6111
|
+
shownVersions.delete(id);
|
|
6112
|
+
notify();
|
|
6113
|
+
};
|
|
6114
|
+
/** Whether another widget shows surface `id` in a version higher than `version`. */
|
|
6115
|
+
const newerShown = (id, version) => [...(shownVersions.get(id)?.values() ?? [])].some((v) => v > version);
|
|
6116
|
+
/** Calls `watch` whenever a widget starts or stops showing a surface; returns the unsubscribe. */
|
|
6117
|
+
const watchSurfaces = (watch) => {
|
|
6118
|
+
watchers.add(watch);
|
|
6119
|
+
return () => {
|
|
6120
|
+
watchers.delete(watch);
|
|
6121
|
+
};
|
|
6122
|
+
};
|
|
6123
|
+
|
|
5998
6124
|
// Utility: check whether a string is a likely complete JSON value
|
|
5999
6125
|
const isLikelyCompleteJson = (message) => {
|
|
6000
6126
|
try {
|
|
@@ -6202,10 +6328,8 @@ const sseevent = (message, messageToStoreRef) => {
|
|
|
6202
6328
|
let previousWidgetData = isArray$1(messageToStoreRef.current.appendedData)
|
|
6203
6329
|
? messageToStoreRef.current.appendedData
|
|
6204
6330
|
: [messageToStoreRef.current.appendedData];
|
|
6205
|
-
|
|
6206
|
-
|
|
6207
|
-
...finalWidgetData,
|
|
6208
|
-
];
|
|
6331
|
+
// a surface sent again (placeholder, then the surface) replaces its widget in place
|
|
6332
|
+
messageToStoreRef.current.appendedData = mergeSurfaceWidgets(previousWidgetData, finalWidgetData);
|
|
6209
6333
|
messageToStoreRef.current.sessionId = parsedData.session_id;
|
|
6210
6334
|
messageToStoreRef.current.uniqueChatId = parsedData?.chat_id
|
|
6211
6335
|
? parsedData.chat_id
|
|
@@ -6245,10 +6369,8 @@ const sseevent = (message, messageToStoreRef) => {
|
|
|
6245
6369
|
let previousWidgetData = isArray$1(messageToStoreRef.current.appendedData)
|
|
6246
6370
|
? messageToStoreRef.current.appendedData
|
|
6247
6371
|
: [messageToStoreRef.current.appendedData];
|
|
6248
|
-
|
|
6249
|
-
|
|
6250
|
-
...finalWidgetData,
|
|
6251
|
-
];
|
|
6372
|
+
// a surface sent again (placeholder, then the surface) replaces its widget in place
|
|
6373
|
+
messageToStoreRef.current.appendedData = mergeSurfaceWidgets(previousWidgetData, finalWidgetData);
|
|
6252
6374
|
messageToStoreRef.current.additionalArgs = parsedData?.additional_args
|
|
6253
6375
|
? parsedData.additional_args
|
|
6254
6376
|
: {};
|
|
@@ -9155,13 +9277,36 @@ const CheckboxGroupContent = ({ bodyText, isFormDisabled = false, messageIndex }
|
|
|
9155
9277
|
const RadioContent = ({ bodyText, isFormDisabled = false, messageIndex }) => {
|
|
9156
9278
|
const formKey = `${messageIndex}_${bodyText?.paramName}`;
|
|
9157
9279
|
const classes = useStyles$b();
|
|
9158
|
-
const { label, isDisabled, orientation, options } = bodyText;
|
|
9280
|
+
const { label, isDisabled, orientation, options, defaultSelected } = bodyText;
|
|
9159
9281
|
const chatbotContext = useSelector((state) => state.smartBotReducer.chatbotContext);
|
|
9160
9282
|
const chatbotContextRef = useRef(chatbotContext);
|
|
9161
9283
|
chatbotContextRef.current = chatbotContext;
|
|
9162
9284
|
const persistedFormValues = useSelector((state) => state.smartBotReducer.persistedFormValues);
|
|
9163
9285
|
const dispatch = useDispatch();
|
|
9164
|
-
const [selectedOption, setSelectedOption] = useState(persistedFormValues[formKey] ?? null);
|
|
9286
|
+
const [selectedOption, setSelectedOption] = useState(persistedFormValues[formKey] ?? defaultSelected ?? null);
|
|
9287
|
+
// When a defaultSelected value is provided and nothing was previously persisted,
|
|
9288
|
+
// seed Redux state so submit-validation and context are aware of the pre-selection.
|
|
9289
|
+
// Uses getState inside a thunk to read the latest chatbotContext at dispatch time,
|
|
9290
|
+
// avoiding stale-ref overwrites when multiple radio widgets mount in the same flush.
|
|
9291
|
+
useEffect(() => {
|
|
9292
|
+
if (defaultSelected && !persistedFormValues[formKey]) {
|
|
9293
|
+
dispatch((dispatchAction, getState) => {
|
|
9294
|
+
const currentContext = getState().smartBotReducer.chatbotContext;
|
|
9295
|
+
dispatchAction({
|
|
9296
|
+
type: "SET_CHATBOT_CONTEXT",
|
|
9297
|
+
payload: {
|
|
9298
|
+
...currentContext,
|
|
9299
|
+
[bodyText?.paramName]: {
|
|
9300
|
+
...currentContext?.[bodyText?.paramName],
|
|
9301
|
+
[bodyText?.paramName]: defaultSelected,
|
|
9302
|
+
updated: true,
|
|
9303
|
+
},
|
|
9304
|
+
},
|
|
9305
|
+
});
|
|
9306
|
+
});
|
|
9307
|
+
dispatch(setPersistedFormValues({ [formKey]: defaultSelected }));
|
|
9308
|
+
}
|
|
9309
|
+
}, []);
|
|
9165
9310
|
if (isEmpty$1(bodyText))
|
|
9166
9311
|
return null;
|
|
9167
9312
|
const handleChange = (selectedOption) => {
|
|
@@ -9239,6 +9384,183 @@ const ImageContent = ({ bodyText }) => {
|
|
|
9239
9384
|
} })), caption && (jsx("div", { children: jsx(TextRenderer, { text: caption }) }))] }));
|
|
9240
9385
|
};
|
|
9241
9386
|
|
|
9387
|
+
const SUBMIT = { buttons: [{ label: "Submit", variant: "primary" }] };
|
|
9388
|
+
/** A follow-up's limits: longer ones are ignored. */
|
|
9389
|
+
const PROMPT_TEXT_MAX = 1000;
|
|
9390
|
+
const PROMPT_CONTEXT_MAX = 16000;
|
|
9391
|
+
/** The window event the chat listens to for a follow-up asked from a surface. */
|
|
9392
|
+
const PROMPT_EVENT = "iris:prompt";
|
|
9393
|
+
/** The source a surface names for this temp table, if it names it: the only tables its page may ask pages
|
|
9394
|
+
* of, and the endpoint address the agent gave (the page's own copy of the source is not trusted for it). */
|
|
9395
|
+
const sourceOf = (surface, table) => Object.values(surface?.data || {}).map((entry) => entry?.source).find((source) => typeof source?.table === "string" && source.table === table);
|
|
9396
|
+
/** Whether the surface binds this tool: the only tools its page may ask to read again. */
|
|
9397
|
+
const bindsTool = (surface, tool) => typeof tool === "string" && tool !== "rows" && Object.values(surface?.data || {}).some((entry) => entry?.tool === tool);
|
|
9398
|
+
const baseUrl = () => sessionStorage.getItem("stepForm_baseUrl") || "";
|
|
9399
|
+
/** One page of a source, from the agent's paging endpoint (its pages hold at most 10 rows): at the address
|
|
9400
|
+
* the agent gave, as TableContent does with temp_table_url, else under the stream's base URL. `search`: a
|
|
9401
|
+
* filter Control over the kept rows (catalog 0.3), each `{field, value}` an exact match the endpoint applies. */
|
|
9402
|
+
const pageOf = async ({ source, page, pageSize, sort, search }) => {
|
|
9403
|
+
const payload = {
|
|
9404
|
+
limit: { page, page_size: pageSize },
|
|
9405
|
+
search: (Array.isArray(search) ? search : [])
|
|
9406
|
+
.filter((s) => s && typeof s.field === "string" && s.value !== undefined && s.value !== null)
|
|
9407
|
+
.slice(0, 5)
|
|
9408
|
+
.map((s) => ({ column: s.field, pattern: String(s.value), search_type: "equals" })),
|
|
9409
|
+
sort: (Array.isArray(sort) ? sort : []).map((s) => ({ column: s.field, order: s.order === "desc" ? "desc" : "asc" })),
|
|
9410
|
+
};
|
|
9411
|
+
const response = source.url
|
|
9412
|
+
? await getTableRecordsByUrl(payload, source.url)
|
|
9413
|
+
: await getTableRecords(payload, baseUrl(), source.table);
|
|
9414
|
+
const rows = response?.data?.data;
|
|
9415
|
+
const total = response?.data?.total_count;
|
|
9416
|
+
if (!Array.isArray(rows) || !Number.isFinite(total))
|
|
9417
|
+
throw new Error("no rows");
|
|
9418
|
+
return { rows, total };
|
|
9419
|
+
};
|
|
9420
|
+
/** A read tool the surface binds, run again by the agent with these arguments. */
|
|
9421
|
+
const readOf = async ({ surface, tool, args }) => {
|
|
9422
|
+
const response = await postUiQuery({ surface, tool, args: args && typeof args === "object" ? args : {} }, baseUrl());
|
|
9423
|
+
const rows = response?.data?.rows;
|
|
9424
|
+
const total = response?.data?.total;
|
|
9425
|
+
if (!Array.isArray(rows) || !Number.isFinite(total))
|
|
9426
|
+
throw new Error(response?.data?.error || "no rows");
|
|
9427
|
+
return { rows, total };
|
|
9428
|
+
};
|
|
9429
|
+
/** The page's origin, for http(s) addresses only; anything else is refused. */
|
|
9430
|
+
const frameOrigin = (src) => {
|
|
9431
|
+
try {
|
|
9432
|
+
const url = new URL(src, window.location.href);
|
|
9433
|
+
return url.protocol === "https:" || url.protocol === "http:" ? url.origin : null;
|
|
9434
|
+
}
|
|
9435
|
+
catch {
|
|
9436
|
+
return null;
|
|
9437
|
+
}
|
|
9438
|
+
};
|
|
9439
|
+
/** A follow-up within the limits, or null. */
|
|
9440
|
+
const promptOf = (data, surfaceId) => {
|
|
9441
|
+
const text = typeof data?.text === "string" ? data.text.trim() : "";
|
|
9442
|
+
const context = data?.context && typeof data.context === "object" ? { ...data.context, surface: surfaceId } : { surface: surfaceId };
|
|
9443
|
+
let size = Infinity;
|
|
9444
|
+
try {
|
|
9445
|
+
size = JSON.stringify(context).length;
|
|
9446
|
+
}
|
|
9447
|
+
catch {
|
|
9448
|
+
// a context that cannot be sent is not sent
|
|
9449
|
+
}
|
|
9450
|
+
if (!text || text.length > PROMPT_TEXT_MAX || size > PROMPT_CONTEXT_MAX)
|
|
9451
|
+
return null;
|
|
9452
|
+
return { text, uiContext: context };
|
|
9453
|
+
};
|
|
9454
|
+
const SurfaceFrameContent = ({ frame, isFormDisabled = false, messageIndex = 0 }) => {
|
|
9455
|
+
const dispatch = useDispatch();
|
|
9456
|
+
const chatbotContext = useSelector((state) => state.smartBotReducer.chatbotContext);
|
|
9457
|
+
const contextRef = useRef(chatbotContext);
|
|
9458
|
+
contextRef.current = chatbotContext;
|
|
9459
|
+
const iframeRef = useRef(null);
|
|
9460
|
+
const ready = useRef(false);
|
|
9461
|
+
const [height, setHeight] = useState(120);
|
|
9462
|
+
const [form, setForm] = useState({ values: {}, inputs: [], missing: [] });
|
|
9463
|
+
const formRef = useRef(form);
|
|
9464
|
+
formRef.current = form;
|
|
9465
|
+
const src = frame?.src;
|
|
9466
|
+
const incoming = frame?.surface;
|
|
9467
|
+
// the surface shown: a newer version of the same surface replaces it, a lower one is ignored
|
|
9468
|
+
const [surface, setSurface] = useState(incoming);
|
|
9469
|
+
useEffect(() => {
|
|
9470
|
+
if (incoming && (!surface || incoming.id !== surface.id || surfaceVersion(incoming) >= surfaceVersion(surface)))
|
|
9471
|
+
setSurface(incoming);
|
|
9472
|
+
}, [incoming]); // eslint-disable-line react-hooks/exhaustive-deps
|
|
9473
|
+
const origin = useMemo(() => frameOrigin(src), [src]);
|
|
9474
|
+
const ask = surface?.mode === "ask";
|
|
9475
|
+
// which version of its surface each widget shows, across the chat's messages
|
|
9476
|
+
const token = useRef(null);
|
|
9477
|
+
if (token.current === null)
|
|
9478
|
+
token.current = surfaceToken();
|
|
9479
|
+
const [, setShownChange] = useState(0);
|
|
9480
|
+
useEffect(() => watchSurfaces(() => setShownChange((n) => n + 1)), []);
|
|
9481
|
+
useEffect(() => {
|
|
9482
|
+
if (!surface?.id || surface.status === "pending" || surface.status === "withdrawn")
|
|
9483
|
+
return undefined;
|
|
9484
|
+
showSurface(surface.id, token.current, surfaceVersion(surface));
|
|
9485
|
+
return () => hideSurface(surface.id, token.current);
|
|
9486
|
+
}, [surface?.id, surface?.version, surface?.status]); // eslint-disable-line react-hooks/exhaustive-deps
|
|
9487
|
+
const send = (target, values) => target?.postMessage({ type: "iui:surface", surface, values, disabled: Boolean(isFormDisabled), query: true, ...(ask ? { submit: false } : {}) }, origin);
|
|
9488
|
+
useEffect(() => {
|
|
9489
|
+
if (!origin || !surface)
|
|
9490
|
+
return undefined;
|
|
9491
|
+
const onMessage = (event) => {
|
|
9492
|
+
const target = iframeRef.current?.contentWindow;
|
|
9493
|
+
if (!target || event.source !== target || event.origin !== origin)
|
|
9494
|
+
return;
|
|
9495
|
+
const data = event.data || {};
|
|
9496
|
+
// every message but iui:ready and iui:height names its surface: this widget answers for its own only
|
|
9497
|
+
const own = data.surface === undefined || data.surface === surface.id;
|
|
9498
|
+
if (data.type === "iui:ready") {
|
|
9499
|
+
ready.current = true;
|
|
9500
|
+
send(target, undefined);
|
|
9501
|
+
}
|
|
9502
|
+
else if (data.type === "iui:height" && Number.isFinite(data.height))
|
|
9503
|
+
setHeight(Math.max(40, Math.ceil(data.height)));
|
|
9504
|
+
else if (data.type === "iui:query" && own) {
|
|
9505
|
+
const reply = (body) => target.postMessage({ type: "iui:data", surface: surface.id, id: data.id, ...body }, origin);
|
|
9506
|
+
const args = data.args || {};
|
|
9507
|
+
if (data.tool === "rows") {
|
|
9508
|
+
const source = sourceOf(surface, args.source?.table);
|
|
9509
|
+
if (!source)
|
|
9510
|
+
reply({ error: "not a table of this answer" });
|
|
9511
|
+
else
|
|
9512
|
+
pageOf({ ...args, source }).then(reply, () => reply({ error: "the rows could not be loaded" }));
|
|
9513
|
+
}
|
|
9514
|
+
else if (bindsTool(surface, data.tool)) {
|
|
9515
|
+
readOf({ surface: surface.id, tool: data.tool, args }).then(reply, () => reply({ error: "the data could not be loaded" }));
|
|
9516
|
+
}
|
|
9517
|
+
else
|
|
9518
|
+
reply({ error: "not a tool of this answer" });
|
|
9519
|
+
}
|
|
9520
|
+
else if (data.type === "iui:prompt" && data.surface === surface.id) {
|
|
9521
|
+
const prompt = promptOf(data, surface.id);
|
|
9522
|
+
if (prompt)
|
|
9523
|
+
window.dispatchEvent(new CustomEvent(PROMPT_EVENT, { detail: prompt }));
|
|
9524
|
+
}
|
|
9525
|
+
else if (data.type === "iui:change" && ask && own) {
|
|
9526
|
+
const values = data.values || {};
|
|
9527
|
+
setForm({ values, inputs: Array.isArray(data.inputs) ? data.inputs : Object.keys(values), missing: Array.isArray(data.missing) ? data.missing : [] });
|
|
9528
|
+
// as this chat's own inputs record their values, for the step form's Submit (ButtonContent)
|
|
9529
|
+
const context = { ...contextRef.current };
|
|
9530
|
+
for (const [name, value] of Object.entries(values)) {
|
|
9531
|
+
const empty = value === "" || value === null || value === undefined || (Array.isArray(value) && value.length === 0);
|
|
9532
|
+
context[name] = { ...context[name], [name]: value, updated: !empty };
|
|
9533
|
+
}
|
|
9534
|
+
dispatch(setChatbotContext(context));
|
|
9535
|
+
// only what was filled in: ButtonContent sends a persisted value even when it is empty
|
|
9536
|
+
const filled = Object.entries(values).filter(([name]) => context[name].updated);
|
|
9537
|
+
dispatch(setPersistedFormValues(Object.fromEntries(filled.map(([name, value]) => [`${messageIndex}_${name}`, value]))));
|
|
9538
|
+
}
|
|
9539
|
+
// anything else: a message type this chat does not know, ignored
|
|
9540
|
+
};
|
|
9541
|
+
window.addEventListener("message", onMessage);
|
|
9542
|
+
return () => window.removeEventListener("message", onMessage);
|
|
9543
|
+
}, [origin, surface, isFormDisabled, ask, messageIndex]); // eslint-disable-line react-hooks/exhaustive-deps
|
|
9544
|
+
// a newer version of the surface goes into the page that shows it
|
|
9545
|
+
useEffect(() => {
|
|
9546
|
+
if (ready.current)
|
|
9547
|
+
send(iframeRef.current?.contentWindow, undefined);
|
|
9548
|
+
}, [surface]); // eslint-disable-line react-hooks/exhaustive-deps
|
|
9549
|
+
// a submitted form is posted again, disabled, with what was filled in
|
|
9550
|
+
useEffect(() => {
|
|
9551
|
+
if (isFormDisabled && ask)
|
|
9552
|
+
send(iframeRef.current?.contentWindow, formRef.current.values);
|
|
9553
|
+
}, [isFormDisabled]); // eslint-disable-line react-hooks/exhaustive-deps
|
|
9554
|
+
// a surface that will not come after all (its composition failed): nothing to draw
|
|
9555
|
+
if (!origin || !surface || surface.status === "withdrawn")
|
|
9556
|
+
return null;
|
|
9557
|
+
// a later message shows this surface revised: one line here, the surface there
|
|
9558
|
+
if (newerShown(surface.id, surfaceVersion(surface))) {
|
|
9559
|
+
return (jsx(Box, { "data-iui-host": "surface-frame", "data-iui-superseded": surface.id, my: 1, sx: { fontSize: 13, color: "text.secondary" }, children: `Revised below${surface.title ? `: ${surface.title}` : ""}.` }));
|
|
9560
|
+
}
|
|
9561
|
+
return (jsxs(Box, { "data-iui-host": "surface-frame", my: 1, children: [jsx("iframe", { ref: iframeRef, src: src, title: surface.title || "Generated answer", sandbox: "allow-scripts allow-same-origin", referrerPolicy: "no-referrer", style: { width: "100%", height, border: 0, display: "block" } }), ask ? (jsx(ButtonContent, { bodyText: SUBMIT, isFormDisabled: isFormDisabled, isStepFormSubmit: true, isFormValid: form.inputs.length > 0 && form.missing.length === 0, formParamNames: form.inputs, messageIndex: messageIndex })) : null] }));
|
|
9562
|
+
};
|
|
9563
|
+
|
|
9242
9564
|
// Key used to persist timeout state in sessionStorage (survives component remounts from tab switches)
|
|
9243
9565
|
const STEP_FORM_TIMEOUT_KEY = "__stepFormTimedOut";
|
|
9244
9566
|
/**
|
|
@@ -9668,11 +9990,17 @@ const StepFormContent = ({ formData, messageIndex = 0, isFormDisabled = false, s
|
|
|
9668
9990
|
case "radio":
|
|
9669
9991
|
return jsx(RadioContent, { bodyText: parsedData.bodyText, isFormDisabled: formFieldsDisabled, messageIndex: messageIndex }, key);
|
|
9670
9992
|
case "button":
|
|
9993
|
+
// A form in the renderer page has its Submit drawn by SurfaceFrameContent, which knows the page's inputs
|
|
9994
|
+
if (formData.some((item) => item?.type === "surface_frame"))
|
|
9995
|
+
return null;
|
|
9671
9996
|
return jsx(ButtonContent, { bodyText: parsedData.bodyText, isFormDisabled: isFormDisabled || isFormSubmitted || isTimedOut, isStepFormSubmit: true, isFormValid: requiredFieldsFilled && checkboxGroupsValid, formParamNames: formParamNames, messageIndex: messageIndex }, key);
|
|
9672
9997
|
case "input":
|
|
9673
9998
|
return jsx(InputContent, { bodyText: parsedData.bodyText, isFormDisabled: formFieldsDisabled, messageIndex: messageIndex }, key);
|
|
9674
9999
|
case "image":
|
|
9675
10000
|
return jsx(ImageContent, { bodyText: parsedData.bodyText }, key);
|
|
10001
|
+
case "surface_frame":
|
|
10002
|
+
// The whole form in the renderer page; the widget draws this form's Submit (its inputs are in the page)
|
|
10003
|
+
return jsx(SurfaceFrameContent, { frame: parsedData.bodyText, isFormDisabled: isFormDisabled || isFormSubmitted || isTimedOut, messageIndex: messageIndex }, parsedData.bodyText?.surface?.id || key);
|
|
9676
10004
|
default:
|
|
9677
10005
|
return null;
|
|
9678
10006
|
}
|
|
@@ -10068,7 +10396,7 @@ const ProgressBarItem$1 = ({ question, questionSteps, isLast, classes, formData,
|
|
|
10068
10396
|
const [isExpanded, setIsExpanded] = useState(true);
|
|
10069
10397
|
const dotClass = status === "completed"
|
|
10070
10398
|
? "completed"
|
|
10071
|
-
: status === "in-progress"
|
|
10399
|
+
: status === "in-progress" || status === "not-started"
|
|
10072
10400
|
? "in-progress"
|
|
10073
10401
|
: status === "error"
|
|
10074
10402
|
? "error"
|
|
@@ -10189,6 +10517,479 @@ const Steps$1 = ({ steps, setSteps, done, setTabValue, setDone, finalStepDone, s
|
|
|
10189
10517
|
}, children: jsx(ProgressBarItem$1, { question: "Thinking", questionSteps: [{ header: "", sub_header: "", step_status: "not-completed" }], isLast: true, classes: classes, formData: null, isFormDisabled: isFormDisabled }) }))] }));
|
|
10190
10518
|
};
|
|
10191
10519
|
|
|
10520
|
+
const useAllocationPanelStyles = makeStyles((theme) => ({
|
|
10521
|
+
// AllocationPlanCard styles (inside chatbot)
|
|
10522
|
+
planCard: {
|
|
10523
|
+
border: "1.5px solid #e2e8f0",
|
|
10524
|
+
borderRadius: "14px",
|
|
10525
|
+
padding: "14px 16px",
|
|
10526
|
+
display: "flex",
|
|
10527
|
+
alignItems: "center",
|
|
10528
|
+
gap: "14px",
|
|
10529
|
+
cursor: "pointer",
|
|
10530
|
+
position: "relative",
|
|
10531
|
+
overflow: "hidden",
|
|
10532
|
+
transition: "border-color 0.25s ease, box-shadow 0.25s ease, background 0.25s ease",
|
|
10533
|
+
background: "#fafbff",
|
|
10534
|
+
"&:hover": {
|
|
10535
|
+
borderColor: "#b4beff",
|
|
10536
|
+
boxShadow: "0 2px 12px rgba(66, 89, 238, 0.10)",
|
|
10537
|
+
background: "linear-gradient(135deg, #f5f7ff 0%, #eef1ff 60%, #e8ecff 100%)",
|
|
10538
|
+
},
|
|
10539
|
+
},
|
|
10540
|
+
planCardIcon: {
|
|
10541
|
+
width: "48px",
|
|
10542
|
+
height: "48px",
|
|
10543
|
+
borderRadius: "12px",
|
|
10544
|
+
background: "linear-gradient(135deg, #e8edff 0%, #dbe1ff 100%)",
|
|
10545
|
+
display: "flex",
|
|
10546
|
+
alignItems: "center",
|
|
10547
|
+
justifyContent: "center",
|
|
10548
|
+
flexShrink: 0,
|
|
10549
|
+
"& svg": {
|
|
10550
|
+
color: "#4259EE",
|
|
10551
|
+
fontSize: "22px",
|
|
10552
|
+
},
|
|
10553
|
+
},
|
|
10554
|
+
planCardContent: {
|
|
10555
|
+
flex: 1,
|
|
10556
|
+
minWidth: 0,
|
|
10557
|
+
},
|
|
10558
|
+
planCardTitle: {
|
|
10559
|
+
fontSize: "14px",
|
|
10560
|
+
fontWeight: 700,
|
|
10561
|
+
color: "#1e293b",
|
|
10562
|
+
lineHeight: 1.4,
|
|
10563
|
+
marginBottom: "4px",
|
|
10564
|
+
},
|
|
10565
|
+
planCardLinks: {
|
|
10566
|
+
display: "flex",
|
|
10567
|
+
alignItems: "center",
|
|
10568
|
+
gap: "4px",
|
|
10569
|
+
flexWrap: "wrap",
|
|
10570
|
+
fontSize: "13px",
|
|
10571
|
+
color: "#64748b",
|
|
10572
|
+
},
|
|
10573
|
+
planCardLink: {
|
|
10574
|
+
color: "#64748b",
|
|
10575
|
+
cursor: "pointer",
|
|
10576
|
+
textDecoration: "none",
|
|
10577
|
+
transition: "color 0.2s ease",
|
|
10578
|
+
"&:hover": {
|
|
10579
|
+
color: "#4259EE",
|
|
10580
|
+
},
|
|
10581
|
+
},
|
|
10582
|
+
planCardLinkSeparator: {
|
|
10583
|
+
color: "#94a3b8",
|
|
10584
|
+
margin: "0 3px",
|
|
10585
|
+
},
|
|
10586
|
+
planCardOpenIcon: {
|
|
10587
|
+
flexShrink: 0,
|
|
10588
|
+
color: "#94a3b8",
|
|
10589
|
+
fontSize: "20px !important",
|
|
10590
|
+
padding: "6px",
|
|
10591
|
+
borderRadius: "8px",
|
|
10592
|
+
border: "1px solid #e2e8f0",
|
|
10593
|
+
background: "#ffffff",
|
|
10594
|
+
transition: "border-color 0.25s ease, color 0.25s ease",
|
|
10595
|
+
"$planCard:hover &": {
|
|
10596
|
+
borderColor: "#b4beff",
|
|
10597
|
+
color: "#4259EE",
|
|
10598
|
+
},
|
|
10599
|
+
},
|
|
10600
|
+
|
|
10601
|
+
// PanelHeader styles
|
|
10602
|
+
panelHeader: {
|
|
10603
|
+
display: "flex",
|
|
10604
|
+
alignItems: "center",
|
|
10605
|
+
justifyContent: "space-between",
|
|
10606
|
+
padding: "16px",
|
|
10607
|
+
borderBottom: "1px solid #f0f0f0",
|
|
10608
|
+
flexShrink: 0,
|
|
10609
|
+
},
|
|
10610
|
+
panelHeaderLeft: {
|
|
10611
|
+
display: "flex",
|
|
10612
|
+
alignItems: "center",
|
|
10613
|
+
gap: "8px",
|
|
10614
|
+
flex: 1,
|
|
10615
|
+
minWidth: 0,
|
|
10616
|
+
},
|
|
10617
|
+
panelHeaderIcon: {
|
|
10618
|
+
color: "#666",
|
|
10619
|
+
fontSize: "20px",
|
|
10620
|
+
cursor: "pointer",
|
|
10621
|
+
},
|
|
10622
|
+
panelTitle: {
|
|
10623
|
+
fontSize: "14px",
|
|
10624
|
+
fontWeight: 600,
|
|
10625
|
+
color: "#1a1a1a",
|
|
10626
|
+
lineHeight: 1.4,
|
|
10627
|
+
overflow: "hidden",
|
|
10628
|
+
textOverflow: "ellipsis",
|
|
10629
|
+
whiteSpace: "nowrap",
|
|
10630
|
+
},
|
|
10631
|
+
panelHeaderActions: {
|
|
10632
|
+
display: "flex",
|
|
10633
|
+
alignItems: "center",
|
|
10634
|
+
gap: "6px",
|
|
10635
|
+
flexShrink: 0,
|
|
10636
|
+
},
|
|
10637
|
+
panelHeaderActionBtn: {
|
|
10638
|
+
width: "28px !important",
|
|
10639
|
+
height: "28px !important",
|
|
10640
|
+
borderRadius: "8px !important",
|
|
10641
|
+
background: "#f1f5f9 !important",
|
|
10642
|
+
color: "#475569 !important",
|
|
10643
|
+
padding: "0 !important",
|
|
10644
|
+
"&:hover": {
|
|
10645
|
+
background: "#e2e8f0 !important",
|
|
10646
|
+
color: "#1e293b !important",
|
|
10647
|
+
},
|
|
10648
|
+
},
|
|
10649
|
+
|
|
10650
|
+
// ReportSummaryCard styles
|
|
10651
|
+
reportSummaryCard: {
|
|
10652
|
+
border: "1px solid #f0c36d",
|
|
10653
|
+
borderRadius: "8px",
|
|
10654
|
+
padding: "14px",
|
|
10655
|
+
margin: "16px 0",
|
|
10656
|
+
background: "#fffdf5",
|
|
10657
|
+
},
|
|
10658
|
+
reportBadge: {
|
|
10659
|
+
display: "inline-block",
|
|
10660
|
+
fontSize: "11px",
|
|
10661
|
+
fontWeight: 500,
|
|
10662
|
+
padding: "3px 8px",
|
|
10663
|
+
borderRadius: "4px",
|
|
10664
|
+
marginBottom: "8px",
|
|
10665
|
+
border: "1px solid #f0c36d",
|
|
10666
|
+
color: "#8b6914",
|
|
10667
|
+
background: "transparent",
|
|
10668
|
+
},
|
|
10669
|
+
reportDescription: {
|
|
10670
|
+
fontSize: "12px",
|
|
10671
|
+
lineHeight: 1.6,
|
|
10672
|
+
color: "#333",
|
|
10673
|
+
marginBottom: "10px",
|
|
10674
|
+
},
|
|
10675
|
+
baselinePlanRow: {
|
|
10676
|
+
fontSize: "12px",
|
|
10677
|
+
color: "#666",
|
|
10678
|
+
display: "flex",
|
|
10679
|
+
alignItems: "center",
|
|
10680
|
+
gap: "4px",
|
|
10681
|
+
},
|
|
10682
|
+
baselinePlanLink: {
|
|
10683
|
+
color: "#2563eb",
|
|
10684
|
+
textDecoration: "underline",
|
|
10685
|
+
cursor: "pointer",
|
|
10686
|
+
wordBreak: "break-all",
|
|
10687
|
+
},
|
|
10688
|
+
|
|
10689
|
+
// PanelSection (Accordion) styles
|
|
10690
|
+
sectionAccordion: {
|
|
10691
|
+
boxShadow: "none !important",
|
|
10692
|
+
border: "none !important",
|
|
10693
|
+
borderRadius: "12px !important",
|
|
10694
|
+
marginBottom: "10px !important",
|
|
10695
|
+
background: "#f8fafc !important",
|
|
10696
|
+
"&:before": {
|
|
10697
|
+
display: "none !important",
|
|
10698
|
+
content: "none !important",
|
|
10699
|
+
background: "none !important",
|
|
10700
|
+
width: "0 !important",
|
|
10701
|
+
height: "0 !important",
|
|
10702
|
+
},
|
|
10703
|
+
"&.Mui-expanded": {
|
|
10704
|
+
margin: "0 0 10px 0 !important",
|
|
10705
|
+
background: "#ffffff !important",
|
|
10706
|
+
boxShadow: "0 1px 8px rgba(0, 0, 0, 0.06) !important",
|
|
10707
|
+
border: "1px solid #e2e8f0 !important",
|
|
10708
|
+
},
|
|
10709
|
+
},
|
|
10710
|
+
sectionSummary: {
|
|
10711
|
+
minHeight: "48px !important",
|
|
10712
|
+
padding: "0 16px !important",
|
|
10713
|
+
border: "none !important",
|
|
10714
|
+
flexDirection: "row-reverse !important",
|
|
10715
|
+
gap: "10px",
|
|
10716
|
+
"&:before": {
|
|
10717
|
+
display: "none !important",
|
|
10718
|
+
content: "none !important",
|
|
10719
|
+
background: "none !important",
|
|
10720
|
+
width: "0 !important",
|
|
10721
|
+
height: "0 !important",
|
|
10722
|
+
},
|
|
10723
|
+
"& .MuiAccordionSummary-content": {
|
|
10724
|
+
margin: "12px 0 !important",
|
|
10725
|
+
},
|
|
10726
|
+
"& .MuiAccordionSummary-expandIconWrapper": {
|
|
10727
|
+
color: "#64748b",
|
|
10728
|
+
transform: "rotate(-90deg)",
|
|
10729
|
+
padding: "0 !important",
|
|
10730
|
+
marginRight: "0 !important",
|
|
10731
|
+
"&.Mui-expanded": {
|
|
10732
|
+
transform: "rotate(0deg)",
|
|
10733
|
+
},
|
|
10734
|
+
},
|
|
10735
|
+
},
|
|
10736
|
+
sectionTitle: {
|
|
10737
|
+
fontSize: "14px",
|
|
10738
|
+
fontWeight: 600,
|
|
10739
|
+
color: "#1e293b",
|
|
10740
|
+
},
|
|
10741
|
+
sectionDetails: {
|
|
10742
|
+
padding: "0 16px 16px !important",
|
|
10743
|
+
border: "none !important",
|
|
10744
|
+
"&:before": {
|
|
10745
|
+
display: "none !important",
|
|
10746
|
+
content: "none !important",
|
|
10747
|
+
background: "none !important",
|
|
10748
|
+
width: "0 !important",
|
|
10749
|
+
height: "0 !important",
|
|
10750
|
+
},
|
|
10751
|
+
},
|
|
10752
|
+
|
|
10753
|
+
// StructuredComparison styles
|
|
10754
|
+
comparisonSubtitle: {
|
|
10755
|
+
fontSize: "12px",
|
|
10756
|
+
color: "#666",
|
|
10757
|
+
marginBottom: "12px",
|
|
10758
|
+
lineHeight: 1.5,
|
|
10759
|
+
},
|
|
10760
|
+
scenarioLabel: {
|
|
10761
|
+
fontSize: "12px",
|
|
10762
|
+
fontWeight: 500,
|
|
10763
|
+
color: "#1a1a1a",
|
|
10764
|
+
padding: "8px 12px",
|
|
10765
|
+
background: "#f8f9fa",
|
|
10766
|
+
borderRadius: "6px",
|
|
10767
|
+
marginBottom: "12px",
|
|
10768
|
+
},
|
|
10769
|
+
comparisonCard: {
|
|
10770
|
+
background: "#f8f9fa",
|
|
10771
|
+
borderRadius: "8px",
|
|
10772
|
+
padding: "12px",
|
|
10773
|
+
marginBottom: "10px",
|
|
10774
|
+
},
|
|
10775
|
+
comparisonParamRow: {
|
|
10776
|
+
display: "flex",
|
|
10777
|
+
alignItems: "center",
|
|
10778
|
+
gap: "8px",
|
|
10779
|
+
marginBottom: "10px",
|
|
10780
|
+
},
|
|
10781
|
+
comparisonParamName: {
|
|
10782
|
+
fontSize: "13px",
|
|
10783
|
+
fontWeight: 600,
|
|
10784
|
+
color: "#1a1a1a",
|
|
10785
|
+
},
|
|
10786
|
+
comparisonTag: {
|
|
10787
|
+
display: "inline-block",
|
|
10788
|
+
fontSize: "10px",
|
|
10789
|
+
fontWeight: 500,
|
|
10790
|
+
padding: "2px 6px",
|
|
10791
|
+
borderRadius: "4px",
|
|
10792
|
+
color: "#2563eb",
|
|
10793
|
+
border: "1px solid #bfdbfe",
|
|
10794
|
+
background: "#eff6ff",
|
|
10795
|
+
},
|
|
10796
|
+
comparisonValues: {
|
|
10797
|
+
display: "flex",
|
|
10798
|
+
alignItems: "center",
|
|
10799
|
+
gap: "8px",
|
|
10800
|
+
},
|
|
10801
|
+
comparisonValueBox: {
|
|
10802
|
+
flex: 1,
|
|
10803
|
+
background: theme.palette.common.white,
|
|
10804
|
+
borderRadius: "6px",
|
|
10805
|
+
padding: "8px 10px",
|
|
10806
|
+
border: "1px solid #e8e8e8",
|
|
10807
|
+
},
|
|
10808
|
+
comparisonValueLabel: {
|
|
10809
|
+
fontSize: "10px",
|
|
10810
|
+
color: "#999",
|
|
10811
|
+
marginBottom: "2px",
|
|
10812
|
+
},
|
|
10813
|
+
comparisonValueText: {
|
|
10814
|
+
fontSize: "12px",
|
|
10815
|
+
fontWeight: 600,
|
|
10816
|
+
color: "#1a1a1a",
|
|
10817
|
+
},
|
|
10818
|
+
comparisonArrow: {
|
|
10819
|
+
color: "#999",
|
|
10820
|
+
fontSize: "16px",
|
|
10821
|
+
flexShrink: 0,
|
|
10822
|
+
},
|
|
10823
|
+
|
|
10824
|
+
// Panel-specific HTML content wrapper (font size/line-height for panel context)
|
|
10825
|
+
panelHtmlContainer: {
|
|
10826
|
+
fontSize: "12px",
|
|
10827
|
+
lineHeight: 1.6,
|
|
10828
|
+
},
|
|
10829
|
+
|
|
10830
|
+
// Slide-in keyframes for panel entry
|
|
10831
|
+
"@keyframes panelSlideIn": {
|
|
10832
|
+
"0%": {
|
|
10833
|
+
transform: "translateX(100%)",
|
|
10834
|
+
opacity: 0,
|
|
10835
|
+
},
|
|
10836
|
+
"100%": {
|
|
10837
|
+
transform: "translateX(0)",
|
|
10838
|
+
opacity: 1,
|
|
10839
|
+
},
|
|
10840
|
+
},
|
|
10841
|
+
// AllocationDetailPanel container (portaled)
|
|
10842
|
+
panelContainer: {
|
|
10843
|
+
position: "fixed",
|
|
10844
|
+
top: 56,
|
|
10845
|
+
right: 0,
|
|
10846
|
+
width: "calc(50vw - 32px)",
|
|
10847
|
+
maxWidth: "520px",
|
|
10848
|
+
height: "calc(100vh - 56px)",
|
|
10849
|
+
zIndex: 99999,
|
|
10850
|
+
display: "flex",
|
|
10851
|
+
flexDirection: "column",
|
|
10852
|
+
background: "#ffffff",
|
|
10853
|
+
boxShadow: "-4px 0 16px rgba(0, 0, 0, 0.15)",
|
|
10854
|
+
borderLeft: "1px solid #e8e8e8",
|
|
10855
|
+
borderRadius: "12px 0 0 12px",
|
|
10856
|
+
overflow: "hidden",
|
|
10857
|
+
animation: "$panelSlideIn 0.3s ease forwards",
|
|
10858
|
+
transition: "width 0.3s ease, max-width 0.3s ease, border-radius 0.3s ease",
|
|
10859
|
+
},
|
|
10860
|
+
// Expanded / maximized panel — covers the chatbot area too
|
|
10861
|
+
panelExpanded: {
|
|
10862
|
+
width: "calc(100vw - 4rem)",
|
|
10863
|
+
maxWidth: "calc(100vw - 4rem)",
|
|
10864
|
+
borderRadius: "0",
|
|
10865
|
+
},
|
|
10866
|
+
panelScrollBody: {
|
|
10867
|
+
flex: 1,
|
|
10868
|
+
overflowY: "auto",
|
|
10869
|
+
padding: "0 16px 24px",
|
|
10870
|
+
},
|
|
10871
|
+
|
|
10872
|
+
// Footer
|
|
10873
|
+
panelFooter: {
|
|
10874
|
+
display: "flex",
|
|
10875
|
+
justifyContent: "flex-end",
|
|
10876
|
+
alignItems: "center",
|
|
10877
|
+
gap: "10px",
|
|
10878
|
+
padding: "12px 16px",
|
|
10879
|
+
borderTop: "1px solid #e2e8f0",
|
|
10880
|
+
background: "#ffffff",
|
|
10881
|
+
flexShrink: 0,
|
|
10882
|
+
position: "relative",
|
|
10883
|
+
},
|
|
10884
|
+
footerBtnOutlined: {
|
|
10885
|
+
display: "inline-flex",
|
|
10886
|
+
alignItems: "center",
|
|
10887
|
+
justifyContent: "center",
|
|
10888
|
+
height: "32px",
|
|
10889
|
+
padding: "0 12px",
|
|
10890
|
+
fontSize: "14px",
|
|
10891
|
+
fontWeight: 600,
|
|
10892
|
+
fontFamily: "Manrope, sans-serif",
|
|
10893
|
+
lineHeight: 1,
|
|
10894
|
+
borderRadius: "8px",
|
|
10895
|
+
border: "1px solid #d1d5db",
|
|
10896
|
+
background: "#ffffff",
|
|
10897
|
+
color: "#1e293b",
|
|
10898
|
+
cursor: "pointer",
|
|
10899
|
+
textTransform: "none",
|
|
10900
|
+
},
|
|
10901
|
+
footerBtnPrimary: {
|
|
10902
|
+
display: "inline-flex",
|
|
10903
|
+
alignItems: "center",
|
|
10904
|
+
justifyContent: "center",
|
|
10905
|
+
height: "32px",
|
|
10906
|
+
padding: "0 12px",
|
|
10907
|
+
fontSize: "14px",
|
|
10908
|
+
fontWeight: 600,
|
|
10909
|
+
fontFamily: "Manrope, sans-serif",
|
|
10910
|
+
lineHeight: 1,
|
|
10911
|
+
borderRadius: "8px",
|
|
10912
|
+
border: "1px solid #4259EE",
|
|
10913
|
+
background: "#4259EE",
|
|
10914
|
+
color: "#ffffff",
|
|
10915
|
+
cursor: "pointer",
|
|
10916
|
+
textTransform: "none",
|
|
10917
|
+
},
|
|
10918
|
+
|
|
10919
|
+
// Footer options popover
|
|
10920
|
+
optionsCard: {
|
|
10921
|
+
position: "absolute",
|
|
10922
|
+
bottom: "100%",
|
|
10923
|
+
right: 0,
|
|
10924
|
+
marginBottom: "8px",
|
|
10925
|
+
background: "#ffffff",
|
|
10926
|
+
borderRadius: "12px",
|
|
10927
|
+
boxShadow: "0 4px 20px rgba(0, 0, 0, 0.12)",
|
|
10928
|
+
border: "1px solid #e2e8f0",
|
|
10929
|
+
padding: "8px",
|
|
10930
|
+
minWidth: "280px",
|
|
10931
|
+
zIndex: 1,
|
|
10932
|
+
},
|
|
10933
|
+
optionRow: {
|
|
10934
|
+
display: "flex",
|
|
10935
|
+
alignItems: "center",
|
|
10936
|
+
gap: "10px",
|
|
10937
|
+
padding: "10px 12px",
|
|
10938
|
+
borderRadius: "8px",
|
|
10939
|
+
cursor: "pointer",
|
|
10940
|
+
fontSize: "13px",
|
|
10941
|
+
fontWeight: 500,
|
|
10942
|
+
color: "#1e293b",
|
|
10943
|
+
background: "#f8fafc",
|
|
10944
|
+
marginBottom: "4px",
|
|
10945
|
+
border: "none",
|
|
10946
|
+
width: "100%",
|
|
10947
|
+
textAlign: "left",
|
|
10948
|
+
fontFamily: "Manrope, sans-serif",
|
|
10949
|
+
"&:hover": {
|
|
10950
|
+
background: "#eef2ff",
|
|
10951
|
+
},
|
|
10952
|
+
"&:last-child": {
|
|
10953
|
+
marginBottom: 0,
|
|
10954
|
+
},
|
|
10955
|
+
},
|
|
10956
|
+
optionIcon: {
|
|
10957
|
+
color: "#6366f1",
|
|
10958
|
+
fontSize: "16px",
|
|
10959
|
+
},
|
|
10960
|
+
}));
|
|
10961
|
+
|
|
10962
|
+
const AllocationPlanCard = ({ bodyText }) => {
|
|
10963
|
+
const classes = useAllocationPanelStyles();
|
|
10964
|
+
const title = bodyText?.title || "Allocation Plan";
|
|
10965
|
+
const links = bodyText?.links || [];
|
|
10966
|
+
const panelData = bodyText?.panel_data || null;
|
|
10967
|
+
const handleCardClick = (target) => {
|
|
10968
|
+
if (!panelData)
|
|
10969
|
+
return;
|
|
10970
|
+
const openPanel = () => {
|
|
10971
|
+
window.dispatchEvent(new CustomEvent("openAllocationDetailPanel", {
|
|
10972
|
+
detail: { panelData, activeSection: target || null },
|
|
10973
|
+
}));
|
|
10974
|
+
};
|
|
10975
|
+
// Check if the chatbot is in a collapsed/minimized state by looking for
|
|
10976
|
+
// the "Expand chatbot" button (present only when collapsed)
|
|
10977
|
+
const expandBtn = document.querySelector('button[aria-label="Expand chatbot"]');
|
|
10978
|
+
if (expandBtn) {
|
|
10979
|
+
// Maximize first, then open the panel after chatbot finishes expanding
|
|
10980
|
+
window.dispatchEvent(new CustomEvent("smartBotMaximize"));
|
|
10981
|
+
setTimeout(openPanel, 350);
|
|
10982
|
+
}
|
|
10983
|
+
else {
|
|
10984
|
+
openPanel();
|
|
10985
|
+
}
|
|
10986
|
+
};
|
|
10987
|
+
return (jsxs("div", { className: classes.planCard, onClick: () => handleCardClick(links[0]?.target), children: [jsx("div", { className: classes.planCardIcon, children: jsx(DescriptionOutlinedIcon, {}) }), jsxs("div", { className: classes.planCardContent, children: [jsx("div", { className: classes.planCardTitle, children: title }), jsx("div", { className: classes.planCardLinks, children: links.map((link, index) => (jsxs("span", { children: [index > 0 && (jsx("span", { className: classes.planCardLinkSeparator, children: "\u00B7" })), jsx("span", { className: classes.planCardLink, onClick: (e) => {
|
|
10988
|
+
e.stopPropagation();
|
|
10989
|
+
handleCardClick(link.target);
|
|
10990
|
+
}, children: link.label })] }, link.target || index))) })] }), jsx(OpenInNewIcon, { className: classes.planCardOpenIcon })] }));
|
|
10991
|
+
};
|
|
10992
|
+
|
|
10192
10993
|
const renderWidgetItem = (item, index, isFormDisabled) => {
|
|
10193
10994
|
try {
|
|
10194
10995
|
const parsedData = parseResponse(item, item.type, "", "", true);
|
|
@@ -10225,6 +11026,10 @@ const renderWidgetItem = (item, index, isFormDisabled) => {
|
|
|
10225
11026
|
return jsx(DateRangePickerContent, { bodyText: parsedData.bodyText, isFormDisabled: isFormDisabled }, key);
|
|
10226
11027
|
case "html":
|
|
10227
11028
|
return jsx(HtmlContent, { bodyText: parsedData.bodyText }, key);
|
|
11029
|
+
case "surface_frame":
|
|
11030
|
+
return jsx(SurfaceFrameContent, { frame: parsedData.bodyText }, parsedData.bodyText?.surface?.id || key);
|
|
11031
|
+
case "allocation_plan_card":
|
|
11032
|
+
return jsx(AllocationPlanCard, { bodyText: parsedData.bodyText }, key);
|
|
10228
11033
|
default:
|
|
10229
11034
|
return null;
|
|
10230
11035
|
}
|
|
@@ -11097,7 +11902,8 @@ const StreamedContent = ({ botData, botProps }) => {
|
|
|
11097
11902
|
const widgetItems = isArray(data.widget_data)
|
|
11098
11903
|
? data.widget_data
|
|
11099
11904
|
: [data.widget_data];
|
|
11100
|
-
|
|
11905
|
+
// a surface sent again (placeholder, then the surface) replaces its widget in place
|
|
11906
|
+
setStreamingWidgetData((prev) => mergeSurfaceWidgets(prev, widgetItems));
|
|
11101
11907
|
}
|
|
11102
11908
|
else if (data.message !== "[DONE]") {
|
|
11103
11909
|
if (!thinkingDoneRef?.current && currentMode === "agent") {
|
|
@@ -12267,6 +13073,8 @@ const TabularContent = ({ steps: initialSteps, currentTabValue, children, questi
|
|
|
12267
13073
|
return jsx(TableContent, { bodyText: parsedData.bodyText }, parsedData.bodyText?.table_name || key);
|
|
12268
13074
|
case "graph":
|
|
12269
13075
|
return jsx(GraphContent, { bodyText: parsedData.bodyText }, key);
|
|
13076
|
+
case "surface_frame":
|
|
13077
|
+
return jsx(SurfaceFrameContent, { frame: parsedData.bodyText }, parsedData.bodyText?.surface?.id || key);
|
|
12270
13078
|
case "radio":
|
|
12271
13079
|
return jsx(RadioContent, { bodyText: parsedData.bodyText, isFormDisabled: isFormDisabled }, key);
|
|
12272
13080
|
case "checkbox":
|
|
@@ -12346,7 +13154,8 @@ const TabularContent = ({ steps: initialSteps, currentTabValue, children, questi
|
|
|
12346
13154
|
}
|
|
12347
13155
|
});
|
|
12348
13156
|
if (newWidgets.length > 0) {
|
|
12349
|
-
|
|
13157
|
+
// a surface sent again (placeholder, then the surface) replaces its widget in place
|
|
13158
|
+
setWidgetContent((prev) => mergeSurfaceWidgets(prev, newWidgets));
|
|
12350
13159
|
}
|
|
12351
13160
|
return;
|
|
12352
13161
|
}
|
|
@@ -12477,7 +13286,7 @@ const TabularContent = ({ steps: initialSteps, currentTabValue, children, questi
|
|
|
12477
13286
|
let newQuestions = [...questionsRef.current];
|
|
12478
13287
|
let newQuestionsStepsMap = cloneDeep(questionsStepsMapRef.current);
|
|
12479
13288
|
let newStepFormDataMap = cloneDeep(stepFormDataMapRef.current);
|
|
12480
|
-
|
|
13289
|
+
let newWidgets = [];
|
|
12481
13290
|
chunks.forEach((data) => {
|
|
12482
13291
|
if (data.status === "questions") {
|
|
12483
13292
|
const incomingQuestions = data.widget_data?.[0]?.questions || [];
|
|
@@ -12574,10 +13383,8 @@ const TabularContent = ({ steps: initialSteps, currentTabValue, children, questi
|
|
|
12574
13383
|
}
|
|
12575
13384
|
if (data.status === "widget") {
|
|
12576
13385
|
const widgetItems = isArray$2(data.widget_data) ? data.widget_data : [data.widget_data];
|
|
12577
|
-
|
|
12578
|
-
|
|
12579
|
-
newWidgets.push(item);
|
|
12580
|
-
});
|
|
13386
|
+
// a surface sent again (placeholder, then the surface) replaces its widget in place
|
|
13387
|
+
newWidgets = mergeSurfaceWidgets(newWidgets, widgetItems.filter(Boolean));
|
|
12581
13388
|
}
|
|
12582
13389
|
if (data.status === "content" && data.message) {
|
|
12583
13390
|
newWidgets.push({ type: "text", response: data.message });
|
|
@@ -12704,6 +13511,10 @@ const CombinedContent = ({ botData, props }) => {
|
|
|
12704
13511
|
return jsx(ImageContent, { bodyText: parsedData.bodyText }, key);
|
|
12705
13512
|
case "html":
|
|
12706
13513
|
return jsx(HtmlContent, { bodyText: parsedData.bodyText }, key);
|
|
13514
|
+
case "surface_frame":
|
|
13515
|
+
return jsx(SurfaceFrameContent, { frame: parsedData.bodyText }, parsedData.bodyText?.surface?.id || key);
|
|
13516
|
+
case "allocation_plan_card":
|
|
13517
|
+
return jsx(AllocationPlanCard, { bodyText: parsedData.bodyText }, key);
|
|
12707
13518
|
default:
|
|
12708
13519
|
return null;
|
|
12709
13520
|
}
|
|
@@ -12782,6 +13593,8 @@ const BotMessage = ({ botData, state, handleLikeDislike, props }) => {
|
|
|
12782
13593
|
return jsx(TableContent, { bodyText: botData.bodyText });
|
|
12783
13594
|
case "graph":
|
|
12784
13595
|
return jsx(GraphContent, { bodyText: botData.bodyText });
|
|
13596
|
+
case "surface_frame":
|
|
13597
|
+
return jsx(SurfaceFrameContent, { frame: botData.bodyText });
|
|
12785
13598
|
case "slider":
|
|
12786
13599
|
return jsx(SliderContent, { bodyText: botData.bodyText, isFormDisabled: botData.isFormDisabled, messageIndex: botData.messageIndex });
|
|
12787
13600
|
case "select":
|
|
@@ -12804,6 +13617,8 @@ const BotMessage = ({ botData, state, handleLikeDislike, props }) => {
|
|
|
12804
13617
|
return jsx(ImageContent, { bodyText: botData.bodyText });
|
|
12805
13618
|
case "html":
|
|
12806
13619
|
return jsx(HtmlContent, { bodyText: botData.bodyText });
|
|
13620
|
+
case "allocation_plan_card":
|
|
13621
|
+
return jsx(AllocationPlanCard, { bodyText: botData.bodyText });
|
|
12807
13622
|
case "combined":
|
|
12808
13623
|
return jsx(CombinedContent, { botData: botData, props: props });
|
|
12809
13624
|
case "dynamic":
|
|
@@ -14401,6 +15216,7 @@ const ChatbotInput = (props) => {
|
|
|
14401
15216
|
const isTransitioningStageRef = useRef(false);
|
|
14402
15217
|
const shouldClearCacheRef = useRef(false);
|
|
14403
15218
|
const allFilterValuesRef = useRef([]);
|
|
15219
|
+
const initialValueOptionsRef = useRef([]);
|
|
14404
15220
|
const windowStartRef = useRef(0);
|
|
14405
15221
|
const INITIAL_DISPLAY_COUNT = 500;
|
|
14406
15222
|
const LOAD_MORE_COUNT = 100;
|
|
@@ -14945,6 +15761,7 @@ const ChatbotInput = (props) => {
|
|
|
14945
15761
|
setSelectionStage("values");
|
|
14946
15762
|
setSelectedFilter(filterConfig);
|
|
14947
15763
|
setCurrentOptions([]);
|
|
15764
|
+
initialValueOptionsRef.current = [];
|
|
14948
15765
|
setSelectedOptions([]);
|
|
14949
15766
|
setShowMentionSelect(true);
|
|
14950
15767
|
setIsSelectOpen(true);
|
|
@@ -14974,10 +15791,13 @@ const ChatbotInput = (props) => {
|
|
|
14974
15791
|
windowStartRef.current = 0;
|
|
14975
15792
|
if (allValues.length > 2000) {
|
|
14976
15793
|
allFilterValuesRef.current = allValues;
|
|
14977
|
-
|
|
15794
|
+
const initialSlice = allValues.slice(0, INITIAL_DISPLAY_COUNT);
|
|
15795
|
+
initialValueOptionsRef.current = initialSlice;
|
|
15796
|
+
setCurrentOptions(initialSlice);
|
|
14978
15797
|
}
|
|
14979
15798
|
else {
|
|
14980
15799
|
allFilterValuesRef.current = [];
|
|
15800
|
+
initialValueOptionsRef.current = allValues;
|
|
14981
15801
|
setCurrentOptions(allValues);
|
|
14982
15802
|
}
|
|
14983
15803
|
// Update dropdown position again after values are loaded (DOM might have shifted)
|
|
@@ -15730,7 +16550,7 @@ const ChatbotInput = (props) => {
|
|
|
15730
16550
|
zIndex: 10000,
|
|
15731
16551
|
}, children: selectionStage === "filter" ? (
|
|
15732
16552
|
// Stage 1: Filter selection - always use Select
|
|
15733
|
-
jsx(Select, { currentOptions: currentOptions.length > 0 ? currentOptions : [], setCurrentOptions: setCurrentOptions, initialOptions:
|
|
16553
|
+
jsx(Select, { currentOptions: currentOptions.length > 0 ? currentOptions : [], setCurrentOptions: setCurrentOptions, initialOptions: formattedFilterOptions.length > 0 ? formattedFilterOptions : [], placeholder: "Select a filter...", handleChange: handleMentionSelect, isOpen: isSelectOpen, setIsOpen: setIsSelectOpen, selectedOptions: selectedOptions, setSelectedOptions: setSelectedOptions, isCloseWhenClickOutside: false, isWithSearch: true, isMulti: false, disabled: false, isLoading: false, emptyMessage: "No filters available" })) : selectionStage === "values" && selectedFilter?.display_type &&
|
|
15734
16554
|
selectedFilter.display_type !== "dropdown" &&
|
|
15735
16555
|
selectedFilter.display_type !== "autocompleteDropdown" &&
|
|
15736
16556
|
selectedFilter.display_type !== "list" ? (
|
|
@@ -15817,7 +16637,7 @@ const ChatbotInput = (props) => {
|
|
|
15817
16637
|
cursor: "pointer"
|
|
15818
16638
|
}, children: "Cancel" })] })] })) : (
|
|
15819
16639
|
// Stage 2: Value selection with dropdown - use Select
|
|
15820
|
-
jsx(Select, { currentOptions: currentOptions.length > 0 ? currentOptions : [], setCurrentOptions: setCurrentOptions, initialOptions:
|
|
16640
|
+
jsx(Select, { currentOptions: currentOptions.length > 0 ? currentOptions : [], setCurrentOptions: setCurrentOptions, initialOptions: initialValueOptionsRef.current.length > 0 ? initialValueOptionsRef.current : currentOptions, placeholder: isLoadingValues
|
|
15821
16641
|
? "Loading values..."
|
|
15822
16642
|
: "Select values...", handleChange: handleMentionSelect, isOpen: isSelectOpen, setIsOpen: setIsSelectOpen, selectedOptions: selectedOptions, setSelectedOptions: setSelectedOptions, isCloseWhenClickOutside: false, isWithSearch: true, onMenuScrollToBottom: () => {
|
|
15823
16643
|
const allValues = allFilterValuesRef.current;
|
|
@@ -16972,6 +17792,146 @@ const MinimizedChatWidget = ({ onExpand }) => {
|
|
|
16972
17792
|
return (jsxs("div", { className: classes.widgetContainer, onClick: handleExpandClick, children: [jsxs("div", { className: classes.widgetHeader, children: [jsxs("div", { className: classes.headerLeft, children: [jsx("div", { className: !isCompleted ? classes.headerIconLogoSpin : classes.headerIconLogo, children: jsx(SvgMimimizedIconLogo, {}) }), jsx("span", { className: classes.headerText, children: isCompleted ? "Action completed" : actionLabel }), !isCompleted && (jsx("div", { className: classes.warningIcon, children: jsx(SvgStepError, {}) }))] }), jsx("button", { className: classes.minimizeBtn, onClick: handleMinimizeClick, "aria-label": "Minimize", children: jsx(SvgMinimizeDashIcon, {}) })] }), jsx("div", { className: classes.widgetContent, children: jsxs("div", { className: stepStatus === "step_form" ? classes.innerContentStepForm : classes.innerContent, children: [jsxs("div", { className: classes.innerFirstRow, children: [jsx("span", { className: classes.stepHeaderText, title: stepHeader, children: stepHeader }), jsx("button", { className: classes.expandBtn, onClick: handleExpandClick, "aria-label": "Expand chatbot", children: jsx(SvgExpandFullscreenIcon, {}) })] }), stepSubHeader && (jsxs("div", { className: classes.innerSecondRow, children: [jsxs("div", { className: stepStatus === "step_form" ? classes.subHeaderPillStepForm : classes.subHeaderPill, children: [stepStatus === "step_form" ? (jsx("div", { className: classes.exclamationIcon, children: jsx(SvgExclamationIcon, {}) })) : !isCompleted && (jsx("div", { className: classes.loaderIcon, children: jsx(SvgLoadingCircle, {}) })), jsx("span", { className: classes.subHeaderText, title: stepSubHeader, children: stepSubHeader })] }), elapsedTime && (jsx("span", { className: classes.timeText, children: elapsedTime }))] }))] }) })] }));
|
|
16973
17793
|
};
|
|
16974
17794
|
|
|
17795
|
+
const PanelHeader = ({ title, actions = {}, onClose, isExpanded, onToggleExpand }) => {
|
|
17796
|
+
const classes = useAllocationPanelStyles();
|
|
17797
|
+
return (jsxs("div", { className: classes.panelHeader, children: [jsxs("div", { className: classes.panelHeaderLeft, children: [actions.preview && (jsx(VisibilityOutlinedIcon, { className: classes.panelHeaderIcon })), jsx("span", { className: classes.panelTitle, title: title, children: title })] }), jsxs("div", { className: classes.panelHeaderActions, children: [actions.expand_fullscreen && (jsx(IconButton, { className: classes.panelHeaderActionBtn, size: "small", onClick: onToggleExpand, children: isExpanded ? (jsx(CloseFullscreenIcon, { sx: { fontSize: 16 } })) : (jsx(OpenInFullIcon, { sx: { fontSize: 16 } })) })), jsx(IconButton, { className: classes.panelHeaderActionBtn, size: "small", onClick: onClose, children: jsx(CloseIcon, { sx: { fontSize: 16 } }) })] })] }));
|
|
17798
|
+
};
|
|
17799
|
+
|
|
17800
|
+
const ReportSummaryCard = ({ reportSummary }) => {
|
|
17801
|
+
const classes = useAllocationPanelStyles();
|
|
17802
|
+
if (!reportSummary)
|
|
17803
|
+
return null;
|
|
17804
|
+
const { badge, description, baseline_plan } = reportSummary;
|
|
17805
|
+
return (jsxs("div", { className: classes.reportSummaryCard, children: [badge && (jsx("span", { className: classes.reportBadge, children: badge.label })), description && (jsx("div", { className: classes.reportDescription, children: description })), baseline_plan && (jsxs("div", { className: classes.baselinePlanRow, children: [jsxs("span", { children: [baseline_plan.label, ":"] }), baseline_plan.link_url ? (jsx("span", { className: classes.baselinePlanLink, onClick: () => {
|
|
17806
|
+
if (baseline_plan.link_url) {
|
|
17807
|
+
window.open(baseline_plan.link_url, "_blank");
|
|
17808
|
+
}
|
|
17809
|
+
}, children: baseline_plan.value })) : (jsx("span", { children: baseline_plan.value }))] }))] }));
|
|
17810
|
+
};
|
|
17811
|
+
|
|
17812
|
+
const StructuredComparison = ({ content }) => {
|
|
17813
|
+
const classes = useAllocationPanelStyles();
|
|
17814
|
+
if (!content)
|
|
17815
|
+
return null;
|
|
17816
|
+
const { subtitle, scenario_groups = [] } = content;
|
|
17817
|
+
return (jsxs("div", { children: [subtitle && (jsx("div", { className: classes.comparisonSubtitle, children: subtitle })), scenario_groups.map((group, groupIndex) => (jsxs("div", { children: [jsx("div", { className: classes.scenarioLabel, children: group.scenario_label }), (group.comparisons || []).map((comparison, compIndex) => (jsxs("div", { className: classes.comparisonCard, children: [jsxs("div", { className: classes.comparisonParamRow, children: [jsx("span", { className: classes.comparisonParamName, children: comparison.parameter_name }), (comparison.tags || []).map((tag, tagIndex) => (jsx("span", { className: classes.comparisonTag, children: tag.label }, `tag-${tagIndex}`)))] }), jsxs("div", { className: classes.comparisonValues, children: [jsxs("div", { className: classes.comparisonValueBox, children: [jsx("div", { className: classes.comparisonValueLabel, children: comparison.baseline?.label }), jsx("div", { className: classes.comparisonValueText, children: comparison.baseline?.value })] }), jsx(ArrowForwardIcon, { className: classes.comparisonArrow }), jsxs("div", { className: classes.comparisonValueBox, children: [jsx("div", { className: classes.comparisonValueLabel, children: comparison.new_value?.label }), jsx("div", { className: classes.comparisonValueText, children: comparison.new_value?.value })] })] })] }, `comp-${groupIndex}-${compIndex}`)))] }, `group-${groupIndex}`)))] }));
|
|
17818
|
+
};
|
|
17819
|
+
|
|
17820
|
+
const PanelSection = ({ section }) => {
|
|
17821
|
+
const classes = useAllocationPanelStyles();
|
|
17822
|
+
if (!section)
|
|
17823
|
+
return null;
|
|
17824
|
+
const renderContent = () => {
|
|
17825
|
+
switch (section.content_type) {
|
|
17826
|
+
case "html":
|
|
17827
|
+
case "custom_html":
|
|
17828
|
+
return (jsx("div", { className: classes.panelHtmlContainer, children: jsx(HtmlContent, { bodyText: { content: section.content } }) }));
|
|
17829
|
+
case "structured":
|
|
17830
|
+
return jsx(StructuredComparison, { content: section.content });
|
|
17831
|
+
default:
|
|
17832
|
+
return null;
|
|
17833
|
+
}
|
|
17834
|
+
};
|
|
17835
|
+
return (jsxs(Accordion, { defaultExpanded: section.default_expanded, className: classes.sectionAccordion, disableGutters: true, children: [jsx(AccordionSummary, { expandIcon: jsx(ExpandMoreIcon, {}), className: classes.sectionSummary, children: jsx("span", { className: classes.sectionTitle, children: section.title }) }), jsx(AccordionDetails, { className: classes.sectionDetails, children: renderContent() })] }));
|
|
17836
|
+
};
|
|
17837
|
+
|
|
17838
|
+
const shiftChatbot = (panelEl) => {
|
|
17839
|
+
const chatbot = document.querySelector(".chatbot-component-container");
|
|
17840
|
+
if (!chatbot)
|
|
17841
|
+
return;
|
|
17842
|
+
const panelWidth = panelEl ? panelEl.offsetWidth : 0;
|
|
17843
|
+
const currentLeft = parseFloat(chatbot.style.left) || 0;
|
|
17844
|
+
chatbot.dataset.origLeft = chatbot.style.left;
|
|
17845
|
+
chatbot.style.transition = "left 0.3s ease";
|
|
17846
|
+
chatbot.style.left = (currentLeft - panelWidth) + "px";
|
|
17847
|
+
};
|
|
17848
|
+
const restoreChatbot = () => {
|
|
17849
|
+
const chatbot = document.querySelector(".chatbot-component-container");
|
|
17850
|
+
if (!chatbot)
|
|
17851
|
+
return;
|
|
17852
|
+
if (chatbot.dataset.origLeft) {
|
|
17853
|
+
chatbot.style.transition = "left 0.3s ease";
|
|
17854
|
+
chatbot.style.left = chatbot.dataset.origLeft;
|
|
17855
|
+
delete chatbot.dataset.origLeft;
|
|
17856
|
+
// Clean up transition after animation completes
|
|
17857
|
+
const onEnd = () => {
|
|
17858
|
+
chatbot.style.transition = "";
|
|
17859
|
+
chatbot.removeEventListener("transitionend", onEnd);
|
|
17860
|
+
};
|
|
17861
|
+
chatbot.addEventListener("transitionend", onEnd);
|
|
17862
|
+
}
|
|
17863
|
+
};
|
|
17864
|
+
const AllocationDetailPanel = () => {
|
|
17865
|
+
const classes = useAllocationPanelStyles();
|
|
17866
|
+
const [panelData, setPanelData] = useState(null);
|
|
17867
|
+
const [activeFooterAction, setActiveFooterAction] = useState(null);
|
|
17868
|
+
const [isExpanded, setIsExpanded] = useState(false);
|
|
17869
|
+
const panelRef = useRef(null);
|
|
17870
|
+
const handleOpen = useCallback((e) => {
|
|
17871
|
+
const { panelData: data } = e.detail || {};
|
|
17872
|
+
if (data) {
|
|
17873
|
+
setPanelData(data);
|
|
17874
|
+
}
|
|
17875
|
+
}, []);
|
|
17876
|
+
const handleClose = useCallback(() => {
|
|
17877
|
+
restoreChatbot();
|
|
17878
|
+
setPanelData(null);
|
|
17879
|
+
setIsExpanded(false);
|
|
17880
|
+
}, []);
|
|
17881
|
+
useEffect(() => {
|
|
17882
|
+
window.addEventListener("openAllocationDetailPanel", handleOpen);
|
|
17883
|
+
window.addEventListener("closeAllocationDetailPanel", handleClose);
|
|
17884
|
+
return () => {
|
|
17885
|
+
window.removeEventListener("openAllocationDetailPanel", handleOpen);
|
|
17886
|
+
window.removeEventListener("closeAllocationDetailPanel", handleClose);
|
|
17887
|
+
};
|
|
17888
|
+
}, [handleOpen, handleClose]);
|
|
17889
|
+
// Shift the chatbot once the panel has rendered
|
|
17890
|
+
useEffect(() => {
|
|
17891
|
+
if (panelData && panelRef.current) {
|
|
17892
|
+
// Use requestAnimationFrame to ensure the panel is laid out
|
|
17893
|
+
requestAnimationFrame(() => {
|
|
17894
|
+
shiftChatbot(panelRef.current);
|
|
17895
|
+
});
|
|
17896
|
+
}
|
|
17897
|
+
}, [panelData]);
|
|
17898
|
+
// Listen for direct clicks on the impact-ui collapse button
|
|
17899
|
+
useEffect(() => {
|
|
17900
|
+
if (!panelData)
|
|
17901
|
+
return;
|
|
17902
|
+
const collapseBtn = document.querySelector('button[aria-label="Collapse chatbot"]');
|
|
17903
|
+
if (!collapseBtn)
|
|
17904
|
+
return;
|
|
17905
|
+
const onCollapse = () => handleClose();
|
|
17906
|
+
collapseBtn.addEventListener("click", onCollapse);
|
|
17907
|
+
return () => collapseBtn.removeEventListener("click", onCollapse);
|
|
17908
|
+
}, [panelData, handleClose]);
|
|
17909
|
+
if (!panelData)
|
|
17910
|
+
return null;
|
|
17911
|
+
const footerActions = panelData.footer_actions || [
|
|
17912
|
+
{ label: "Purge", variant: "outlined", action: "purge", options: [] },
|
|
17913
|
+
{ label: "Finalize Plan", variant: "primary", action: "finalize", options: [] },
|
|
17914
|
+
];
|
|
17915
|
+
const handleOptionClick = (option) => {
|
|
17916
|
+
setActiveFooterAction(null);
|
|
17917
|
+
window.dispatchEvent(new CustomEvent("allocationPanelAction", {
|
|
17918
|
+
detail: { value: option.value, label: option.label },
|
|
17919
|
+
}));
|
|
17920
|
+
};
|
|
17921
|
+
const handleFooterBtnClick = (btn) => {
|
|
17922
|
+
if (btn.options && btn.options.length > 0) {
|
|
17923
|
+
setActiveFooterAction(activeFooterAction === btn.action ? null : btn.action);
|
|
17924
|
+
}
|
|
17925
|
+
else {
|
|
17926
|
+
console.log("[AllocationPanel] footer action:", btn.action);
|
|
17927
|
+
}
|
|
17928
|
+
};
|
|
17929
|
+
const panel = (jsxs("div", { ref: panelRef, className: `${classes.panelContainer} ${isExpanded ? classes.panelExpanded : ""}`, "data-testid": "allocation-detail-panel", children: [jsx(PanelHeader, { title: panelData.title, actions: panelData.actions || {}, onClose: handleClose, isExpanded: isExpanded, onToggleExpand: () => setIsExpanded((prev) => !prev) }), jsxs("div", { className: classes.panelScrollBody, children: [jsx(ReportSummaryCard, { reportSummary: panelData.report_summary }), (panelData.sections || []).map((section) => (jsx(PanelSection, { section: section }, section.id)))] }), jsxs("div", { className: classes.panelFooter, children: [activeFooterAction && (jsx("div", { className: classes.optionsCard, children: footerActions
|
|
17930
|
+
.find((a) => a.action === activeFooterAction)
|
|
17931
|
+
?.options?.map((opt, idx) => (jsxs("button", { className: classes.optionRow, onClick: () => handleOptionClick(opt), children: [jsx("span", { className: classes.optionIcon, children: "\u2606" }), opt.label] }, idx))) })), footerActions.map((btn, idx) => (jsx("button", { className: btn.variant === "primary" ? classes.footerBtnPrimary : classes.footerBtnOutlined, onClick: () => handleFooterBtnClick(btn), children: btn.label }, idx)))] })] }));
|
|
17932
|
+
return createPortal(panel, document.body);
|
|
17933
|
+
};
|
|
17934
|
+
|
|
16975
17935
|
/**
|
|
16976
17936
|
* SmartBot Redux reducer.
|
|
16977
17937
|
* State shape and behaviour match the consumer's core/reducers/smartBotReducer.js exactly.
|
|
@@ -17163,6 +18123,7 @@ const SmartBot = (props) => {
|
|
|
17163
18123
|
// Minimize the chat window when the user follows an in-app link from a bot response
|
|
17164
18124
|
const handleMinimizeRequest = () => {
|
|
17165
18125
|
setPartialClose(true);
|
|
18126
|
+
window.dispatchEvent(new CustomEvent("closeAllocationDetailPanel"));
|
|
17166
18127
|
};
|
|
17167
18128
|
window.addEventListener("stepFormStreamStart", handleStepFormStreamStart);
|
|
17168
18129
|
window.addEventListener("stepFormStreamEnd", handleStepFormStreamEnd);
|
|
@@ -17820,7 +18781,7 @@ const SmartBot = (props) => {
|
|
|
17820
18781
|
fetchLegacyAgentInfo(); //Disabled temporarily since this was causing issue on homepage first render
|
|
17821
18782
|
}
|
|
17822
18783
|
}, [location]);
|
|
17823
|
-
const handleSendMessage = async (userInput, userExplicitInput = {}, textWithColumnNames = "") => {
|
|
18784
|
+
const handleSendMessage = async (userInput, userExplicitInput = {}, textWithColumnNames = "", uiContext = null) => {
|
|
17824
18785
|
try {
|
|
17825
18786
|
// if (localStorage.getItem("isStreaming") === "true") {
|
|
17826
18787
|
// displaySnackMessages(
|
|
@@ -17884,6 +18845,7 @@ const SmartBot = (props) => {
|
|
|
17884
18845
|
userExplicitInput: userExplicitInput,
|
|
17885
18846
|
textWithColumnNames: textWithColumnNames,
|
|
17886
18847
|
answerMode: answerMode,
|
|
18848
|
+
...(uiContext ? { uiContext } : {}),
|
|
17887
18849
|
};
|
|
17888
18850
|
// if(!isEmpty(userInput)) {
|
|
17889
18851
|
// Clear the previous response's completed state so the incoming
|
|
@@ -17933,12 +18895,25 @@ const SmartBot = (props) => {
|
|
|
17933
18895
|
sessionStorage.removeItem("stepForm_chatId");
|
|
17934
18896
|
// dispatch(setChatbotContext({}));
|
|
17935
18897
|
setUserInput(params?.text);
|
|
17936
|
-
handleSendMessage(params?.text, params?.userExplicitInput, params?.textWithColumnNames);
|
|
18898
|
+
handleSendMessage(params?.text, params?.userExplicitInput, params?.textWithColumnNames, params?.uiContext);
|
|
17937
18899
|
}
|
|
17938
18900
|
catch (error) {
|
|
17939
18901
|
console.error("onSendIconClick error", error);
|
|
17940
18902
|
}
|
|
17941
18903
|
};
|
|
18904
|
+
// A follow-up asked from a generated surface (SurfaceFrameContent's "iris:prompt"): sent as the user's next
|
|
18905
|
+
// message, with the surface's context as ui_context. Not while a turn runs or a form waits for its Submit.
|
|
18906
|
+
const surfacePromptRef = useRef(null);
|
|
18907
|
+
surfacePromptRef.current = (detail) => {
|
|
18908
|
+
if (!detail?.text || isStop || !isEmpty$1(chatbotContext))
|
|
18909
|
+
return;
|
|
18910
|
+
onSendIconClick({ text: detail.text, uiContext: detail.uiContext });
|
|
18911
|
+
};
|
|
18912
|
+
useEffect(() => {
|
|
18913
|
+
const onSurfacePrompt = (event) => surfacePromptRef.current?.(event.detail);
|
|
18914
|
+
window.addEventListener("iris:prompt", onSurfacePrompt);
|
|
18915
|
+
return () => window.removeEventListener("iris:prompt", onSurfacePrompt);
|
|
18916
|
+
}, []);
|
|
17942
18917
|
const onStopIconClick = (params) => {
|
|
17943
18918
|
try {
|
|
17944
18919
|
setIsStop(false);
|
|
@@ -18172,9 +19147,35 @@ const SmartBot = (props) => {
|
|
|
18172
19147
|
if (!root)
|
|
18173
19148
|
return;
|
|
18174
19149
|
const collapseBtn = root.querySelector('button[aria-label="Collapse chatbot"]');
|
|
18175
|
-
if (collapseBtn)
|
|
19150
|
+
if (collapseBtn) {
|
|
18176
19151
|
collapseBtn.click();
|
|
19152
|
+
window.dispatchEvent(new CustomEvent("closeAllocationDetailPanel"));
|
|
19153
|
+
}
|
|
19154
|
+
}, []);
|
|
19155
|
+
// Expand the chatbot to its full docked view by programmatically clicking
|
|
19156
|
+
// impact-ui's "Expand chatbot" button. Used when the allocation panel opens
|
|
19157
|
+
// from minimized state.
|
|
19158
|
+
const expandChatBotIfCollapsed = useCallback(() => {
|
|
19159
|
+
setShowModal(true);
|
|
19160
|
+
setPartialClose(false);
|
|
19161
|
+
// Use a short delay so the chatbot DOM renders before we look for the button
|
|
19162
|
+
setTimeout(() => {
|
|
19163
|
+
const root = smartBotWrapperRef.current;
|
|
19164
|
+
if (!root)
|
|
19165
|
+
return;
|
|
19166
|
+
const expandBtn = root.querySelector('button[aria-label="Expand chatbot"]');
|
|
19167
|
+
if (expandBtn) {
|
|
19168
|
+
expandBtn.click();
|
|
19169
|
+
}
|
|
19170
|
+
}, 100);
|
|
18177
19171
|
}, []);
|
|
19172
|
+
// Listen for smartBotMaximize events (e.g. from allocation plan card)
|
|
19173
|
+
useEffect(() => {
|
|
19174
|
+
window.addEventListener("smartBotMaximize", expandChatBotIfCollapsed);
|
|
19175
|
+
return () => {
|
|
19176
|
+
window.removeEventListener("smartBotMaximize", expandChatBotIfCollapsed);
|
|
19177
|
+
};
|
|
19178
|
+
}, [expandChatBotIfCollapsed]);
|
|
18178
19179
|
// Auto-collapse to draggable mode when the user interacts outside the bot.
|
|
18179
19180
|
useEffect(() => {
|
|
18180
19181
|
const handleOutsideInteraction = (e) => {
|
|
@@ -18196,6 +19197,9 @@ const SmartBot = (props) => {
|
|
|
18196
19197
|
// Ignore clicks inside the expanded table modal portal
|
|
18197
19198
|
if (e.target.closest?.(".test-modal"))
|
|
18198
19199
|
return;
|
|
19200
|
+
// Ignore clicks inside the allocation detail panel
|
|
19201
|
+
if (e.target.closest?.('[data-testid="allocation-detail-panel"]'))
|
|
19202
|
+
return;
|
|
18199
19203
|
collapseChatBotIfExpanded();
|
|
18200
19204
|
};
|
|
18201
19205
|
document.addEventListener("mousedown", handleOutsideInteraction, true);
|
|
@@ -18216,7 +19220,7 @@ const SmartBot = (props) => {
|
|
|
18216
19220
|
return (jsxs(Fragment, { children: [partialClose && (minimizedStreamData?.isStreaming || minimizedStreamData?.stepStatus === "step_form") && (jsx(MinimizedChatWidget, { onExpand: () => {
|
|
18217
19221
|
setShowModal(true);
|
|
18218
19222
|
setPartialClose(false);
|
|
18219
|
-
} })), jsxs("div", { ref: smartBotWrapperRef, className: `${classes.agentStyleOverride} ${partialClose || !(showModal || forceOpen) ? classes.hideBotStyle : ""} `, children: [jsx(RenameModal, { open: renameOpen, renameValue: renameValue, setRenameValue: setRenameValue, onConfirm: handleRenameConfirm, onCancel: handleRenameCancel }), jsx(DeleteConfirmModal, { open: deleteOpen, onConfirm: handleDeleteConfirm, onCancel: handleDeleteCancel }), jsx(MemoryModal, { isModalOpen: isModalOpen, setIsModalOpen: setIsModalOpen, displaySnackMessages: displaySnackMessages }), jsx(UploadModal, { isUploadModalOpen: isUploadModalOpen, setIsUploadModalOpen: setIsUploadModalOpen, displaySnackMessages: displaySnackMessages }), jsx(ChatBotComponent, { isFullWidth: forceOpen, userName: userName, showHistoryPanel: enableMultiChat, customInputComponent: currentMode === "agent" && !showSavedFilters ? (jsx(ChatbotInput, { newChatScreen: newChatScreen, inputValue: userInput, setInputValue: setUserInput, isStopIcon: isStop, onSendIconClick: onSendIconClick, onStopIconClick: onStopIconClick, currentMode: currentMode, filterOptions: filterOptions,
|
|
19223
|
+
} })), jsxs("div", { ref: smartBotWrapperRef, className: `${classes.agentStyleOverride} ${partialClose || !(showModal || forceOpen) ? classes.hideBotStyle : ""} `, children: [jsx(RenameModal, { open: renameOpen, renameValue: renameValue, setRenameValue: setRenameValue, onConfirm: handleRenameConfirm, onCancel: handleRenameCancel }), jsx(DeleteConfirmModal, { open: deleteOpen, onConfirm: handleDeleteConfirm, onCancel: handleDeleteCancel }), jsx(MemoryModal, { isModalOpen: isModalOpen, setIsModalOpen: setIsModalOpen, displaySnackMessages: displaySnackMessages }), jsx(UploadModal, { isUploadModalOpen: isUploadModalOpen, setIsUploadModalOpen: setIsUploadModalOpen, displaySnackMessages: displaySnackMessages }), jsx(ChatBotComponent, { isFullWidth: forceOpen, userName: userName, showHistoryPanel: enableMultiChat, isConversationLoading: conversationLoading, customInputComponent: currentMode === "agent" && !showSavedFilters ? (jsx(ChatbotInput, { newChatScreen: newChatScreen, inputValue: userInput, setInputValue: setUserInput, isStopIcon: isStop, onSendIconClick: onSendIconClick, onStopIconClick: onStopIconClick, currentMode: currentMode, filterOptions: filterOptions,
|
|
18220
19224
|
// onSaveClick={saveCurrentChat}
|
|
18221
19225
|
savedFilterSets: savedFilterSets, selectedFilterSet: selectedFilterSet, onFilterSetSelect: (filterSet) => setSelectedFilterSet(filterSet), onClearFilterSet: () => setSelectedFilterSet(null), onTriggerRefresh: triggerRefreshAction, answerMode: answerMode, setAnswerMode: setAnswerMode })) : showSavedFilters ? jsx(Fragment, {}) : null, isChatBotOpen: showModal || forceOpen, historyPanelData: historyPanelData, onHistorySearchChange: (params) => { console.log("History Search Change", params); }, onHistorySelectConversation: (params) => {
|
|
18222
19226
|
const convId = params?.conversation_id;
|
|
@@ -18322,6 +19326,7 @@ const SmartBot = (props) => {
|
|
|
18322
19326
|
dispatch(setMinimizedStreamData(null));
|
|
18323
19327
|
}
|
|
18324
19328
|
setPartialClose(true);
|
|
19329
|
+
window.dispatchEvent(new CustomEvent("closeAllocationDetailPanel"));
|
|
18325
19330
|
}
|
|
18326
19331
|
},
|
|
18327
19332
|
// assistantChats={assistantChats}
|
|
@@ -18331,7 +19336,7 @@ const SmartBot = (props) => {
|
|
|
18331
19336
|
}, moduleList: modules, tabList: tabList, utilityList: utilityList, isAssistantThinking: false, isCustomScreen: showChatPlaceholder ? showChatPlaceholder : showSavedFilters, customScreenJsx: showChatPlaceholder ?
|
|
18332
19337
|
jsx(ChatPlaceholder, { dateFormat: dateFormat, chatDataRef: chatDataRef, currentMode: currentMode, setShowChatPlaceholder: setShowChatPlaceholder, setLoader: setLoader, setCurrentAgentId: setCurrentAgentId, baseUrl: baseUrl, setBaseUrl: setBaseUrl, setCurrentSessionId: setCurrentSessionId, customChatConfig: customChatConfig, chatDataInfoRef: chatDataInfoRef, setChatDataState: setChatDataState, userInput: userInput, legacyAgentScreen: legacyAgentScreen, activeConversationId: activeConversationId, chatBodyRef: chatBodyRef, chatbotContext: chatbotContext, setInitValue: setInitValue, setSessionId: setSessionId, thinkingContent: thinkingContext?.thinkingContent, setThinkingContent: setThinkingContent, isThinking: isThinking, setIsThinking: setIsThinking, chatId: chatId, setChatId: setChatId, isStop: isStop, setIsStop: setIsStop, functionsRef: functionsRef, functionsState: functionsState, setFunctionsState: setFunctionsState, thinkingHeaderMessage: thinkingContext?.thinkingHeaderMessage, setThinkingHeaderMessage: setThinkingHeaderMessage, uniqueChatId: uniqueChatId, setUniqueChatId: setUniqueChatId, fieldNumber: fieldNumber, setFieldNumber: setFieldNumber, setAdditionalArgs: setAdditionalArgs, displayQuestions: displayQuestions, questions: questions, setActiveConversationId: setActiveConversationId, selectedFilterSet: selectedFilterSet, answerMode: answerMode })
|
|
18333
19338
|
:
|
|
18334
|
-
components?.FilterComponent ? jsx(components.FilterComponent, { savedFilterSets: savedFilterSets, partialClose: partialClose, chatBotWidth: chatBotWidth, onSetFilterConfiguration: callbacks?.onSetFilterConfiguration }) : null, inputText: userInput, threadList: ["Home"], hideMenuArrow:
|
|
19339
|
+
components?.FilterComponent ? jsx(components.FilterComponent, { savedFilterSets: savedFilterSets, partialClose: partialClose, chatBotWidth: chatBotWidth, onSetFilterConfiguration: callbacks?.onSetFilterConfiguration }) : null, inputText: userInput, threadList: ["Home"], hideMenuArrow: true, newChatScreen: newChatScreen, isModuleListLoading: modulesLoading, suggestionBanner: {
|
|
18335
19340
|
freeTextHeading: "Try adding more details :",
|
|
18336
19341
|
freeTextContent: "Iris works better when you provide more context and pointed questions",
|
|
18337
19342
|
}, isStopIcon: isStop, onStopIconClick: onStopIconClick, footerText: "AI-generated responses may contain errors\u2014please verify important information", showSuggestionBanner: showSavedFilters ? false : showSuggestionBanner, onCloseSuggestionBanner: () => {
|
|
@@ -18352,7 +19357,8 @@ const SmartBot = (props) => {
|
|
|
18352
19357
|
setChatBotWidth(params);
|
|
18353
19358
|
}, onMinimiseChatBot: () => {
|
|
18354
19359
|
setPartialClose(true);
|
|
18355
|
-
|
|
19360
|
+
window.dispatchEvent(new CustomEvent("closeAllocationDetailPanel"));
|
|
19361
|
+
} })] }), jsx(AllocationDetailPanel, {})] }));
|
|
18356
19362
|
};
|
|
18357
19363
|
|
|
18358
19364
|
export { ChatbotProvider, clearPersistedFormValues, SmartBot as default, setChatbotContext, setChatbotFilterOptions, setCurrentAgentChatId, setHierarchyKeyValue, setIsSmartBotRestricted, setMinimizedStreamData, setPersistedFormValues, setSavedFilterSets, setSmartBotActive, setStepFormRestreamPayload, setStepFormStreamData, setThinkingContext, smartBotInitialState, smartBotReducer, useChatbotDeps };
|