impact-chatbot 2.3.10 → 2.3.13
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/chatbot-input/utils/apiHelpers.d.ts +4 -1
- package/dist/components/chatbot-input/utils/domHelpers.d.ts +2 -1
- package/dist/hooks/useChatFlow.d.ts +1 -1
- package/dist/hooks/useChatState.d.ts +2 -0
- package/dist/index.cjs.js +79 -18
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +79 -18
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
|
@@ -18,7 +18,10 @@ export declare const buildFilterOptionsPayload: (filterConfig: any, existingFilt
|
|
|
18
18
|
filter_type: string;
|
|
19
19
|
dimension: any;
|
|
20
20
|
display_type: any;
|
|
21
|
-
check_configuration:
|
|
21
|
+
check_configuration: {
|
|
22
|
+
checkAll: boolean;
|
|
23
|
+
meta: {};
|
|
24
|
+
}[];
|
|
22
25
|
is_mandatory: any;
|
|
23
26
|
extra: {};
|
|
24
27
|
values: any;
|
|
@@ -35,7 +35,7 @@ export declare const findTextNodeAtPosition: (editorRef: any, position: any) =>
|
|
|
35
35
|
* @param {boolean} isStage1 - Whether this is stage 1 (filter only) or stage 2 (with values)
|
|
36
36
|
* @returns {HTMLSpanElement} Mention span element
|
|
37
37
|
*/
|
|
38
|
-
export declare const createMentionSpan: (text: any, filterName: any, values: any, groupId: any, isStage1?: boolean) => HTMLSpanElement;
|
|
38
|
+
export declare const createMentionSpan: (text: any, filterName: any, values: any, groupId: any, isStage1?: boolean, checkAll?: boolean) => HTMLSpanElement;
|
|
39
39
|
/**
|
|
40
40
|
* Create +N count badge
|
|
41
41
|
* @param {number} count - Hidden count
|
|
@@ -68,6 +68,7 @@ export declare const getAllMentions: (editorRef: any) => {
|
|
|
68
68
|
filterName: any;
|
|
69
69
|
stage: any;
|
|
70
70
|
values: any;
|
|
71
|
+
checkAll: boolean;
|
|
71
72
|
text: any;
|
|
72
73
|
}[];
|
|
73
74
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const useChatFlow: (chatDataRef: any, setLoader: any, setFlowType: any, setScreenName: any, setUserInput: any, setQuestionIndex: any, setCurrentAppLink: any, flowType: any, screenName: any, questionIndex: any, userInput: any, dateFormat: any, currentMode: any, activeConversationId: any, setIsModuleChanged: any, chatBodyRef: any, filterReducerState: any, dispatch: any, navigate: any, setShowChatPlaceholder: any, baseUrl: any, setChatDataState: any, setCurrentSessionId: any, customChatConfig: any, chatDataInfoRef: any, chatbotContext: any, setInitValue: any, setSessionId: any, thinkingContent: any, setThinkingContent: any, isThinking: any, setIsThinking: any, chatId: any, setChatId: any, isStop: any, setIsStop: any, functionsRef: any, functionsState: any, setFunctionsState: any, thinkingHeaderMessage: any, setThinkingHeaderMessage: any, uniqueChatId: any, initValue: any, sessionId: any, fieldNumber: any, setFieldNumber: any) => {
|
|
1
|
+
export declare const useChatFlow: (chatDataRef: any, setLoader: any, setFlowType: any, setScreenName: any, setUserInput: any, setQuestionIndex: any, setCurrentAppLink: any, flowType: any, screenName: any, questionIndex: any, userInput: any, dateFormat: any, currentMode: any, activeConversationId: any, setIsModuleChanged: any, chatBodyRef: any, filterReducerState: any, dispatch: any, navigate: any, setShowChatPlaceholder: any, baseUrl: any, setChatDataState: any, setCurrentSessionId: any, customChatConfig: any, chatDataInfoRef: any, chatbotContext: any, setInitValue: any, setSessionId: any, thinkingContent: any, setThinkingContent: any, isThinking: any, setIsThinking: any, chatId: any, setChatId: any, isStop: any, setIsStop: any, functionsRef: any, functionsState: any, setFunctionsState: any, thinkingHeaderMessage: any, setThinkingHeaderMessage: any, uniqueChatId: any, initValue: any, sessionId: any, fieldNumber: any, setFieldNumber: any, additionalArgs: any) => {
|
|
2
2
|
setUserFlow: (data: any) => Promise<void>;
|
|
3
3
|
setUserScreenAndFlow: (data: any) => void;
|
|
4
4
|
fetchUserResultsFromQuery: (refObject: any, fetchQuestions?: boolean, inputValue?: any) => Promise<void>;
|
|
@@ -92,6 +92,8 @@ export declare const useChatState: () => {
|
|
|
92
92
|
setIsUploadModalOpen: import("react").Dispatch<import("react").SetStateAction<boolean>>;
|
|
93
93
|
isRefreshTriggered: boolean;
|
|
94
94
|
setIsRefreshTriggered: import("react").Dispatch<import("react").SetStateAction<boolean>>;
|
|
95
|
+
additionalArgs: {};
|
|
96
|
+
setAdditionalArgs: import("react").Dispatch<import("react").SetStateAction<{}>>;
|
|
95
97
|
grabPositionRef: import("react").MutableRefObject<any>;
|
|
96
98
|
chatDataRef: import("react").MutableRefObject<{
|
|
97
99
|
insights: {
|
package/dist/index.cjs.js
CHANGED
|
@@ -1230,6 +1230,7 @@ const useAgentFlow = (dateFormat, chatDataRef, currentMode, setShowChatPlacehold
|
|
|
1230
1230
|
setUniqueChatId: utilityObjectData?.setUniqueChatId,
|
|
1231
1231
|
fieldNumber: utilityObjectData?.fieldNumber,
|
|
1232
1232
|
setFieldNumber: utilityObjectData?.setFieldNumber,
|
|
1233
|
+
setAdditionalArgs: utilityObjectData?.setAdditionalArgs,
|
|
1233
1234
|
baseUrl: baseUrlTemp,
|
|
1234
1235
|
};
|
|
1235
1236
|
response = await parseResponse(null, "stream", "", currentModeValue, false, "", {}, payload, utilityObject);
|
|
@@ -1757,6 +1758,7 @@ const useAgentFlow = (dateFormat, chatDataRef, currentMode, setShowChatPlacehold
|
|
|
1757
1758
|
chat_input: data?.chatInput,
|
|
1758
1759
|
delay: 0.3,
|
|
1759
1760
|
chat_id: utilityObjectData?.uniqueChatId ? utilityObjectData?.uniqueChatId : utilityObjectData?.currentAgentChatId,
|
|
1761
|
+
...(!isEmpty(utilityObjectData?.additionalArgs) ? utilityObjectData.additionalArgs : {}),
|
|
1760
1762
|
};
|
|
1761
1763
|
// Handle @ filter mentions - user_explicit_input contains filter values
|
|
1762
1764
|
if (!isEmpty(data?.userExplicitInput)) {
|
|
@@ -1922,7 +1924,7 @@ const useAgentFlow = (dateFormat, chatDataRef, currentMode, setShowChatPlacehold
|
|
|
1922
1924
|
};
|
|
1923
1925
|
};
|
|
1924
1926
|
|
|
1925
|
-
const useChatFlow = (chatDataRef, setLoader, setFlowType, setScreenName, setUserInput, setQuestionIndex, setCurrentAppLink, flowType, screenName, questionIndex, userInput, dateFormat, currentMode, activeConversationId, setIsModuleChanged, chatBodyRef, filterReducerState, dispatch, navigate, setShowChatPlaceholder, baseUrl, setChatDataState, setCurrentSessionId, customChatConfig, chatDataInfoRef, chatbotContext, setInitValue, setSessionId, thinkingContent, setThinkingContent, isThinking, setIsThinking, chatId, setChatId, isStop, setIsStop, functionsRef, functionsState, setFunctionsState, thinkingHeaderMessage, setThinkingHeaderMessage, uniqueChatId, initValue, sessionId, fieldNumber, setFieldNumber) => {
|
|
1927
|
+
const useChatFlow = (chatDataRef, setLoader, setFlowType, setScreenName, setUserInput, setQuestionIndex, setCurrentAppLink, flowType, screenName, questionIndex, userInput, dateFormat, currentMode, activeConversationId, setIsModuleChanged, chatBodyRef, filterReducerState, dispatch, navigate, setShowChatPlaceholder, baseUrl, setChatDataState, setCurrentSessionId, customChatConfig, chatDataInfoRef, chatbotContext, setInitValue, setSessionId, thinkingContent, setThinkingContent, isThinking, setIsThinking, chatId, setChatId, isStop, setIsStop, functionsRef, functionsState, setFunctionsState, thinkingHeaderMessage, setThinkingHeaderMessage, uniqueChatId, initValue, sessionId, fieldNumber, setFieldNumber, additionalArgs) => {
|
|
1926
1928
|
const { prepareDataAndSendToAgent, setAgentFlow, processResponse, } = useAgentFlow(dateFormat, chatDataRef, currentMode, setShowChatPlaceholder, setLoader, baseUrl, setCurrentSessionId, customChatConfig, chatDataInfoRef, {
|
|
1927
1929
|
setChatDataState,
|
|
1928
1930
|
activeConversationId,
|
|
@@ -1947,6 +1949,7 @@ const useChatFlow = (chatDataRef, setLoader, setFlowType, setScreenName, setUser
|
|
|
1947
1949
|
uniqueChatId,
|
|
1948
1950
|
fieldNumber,
|
|
1949
1951
|
setFieldNumber,
|
|
1952
|
+
setAdditionalArgs: () => { },
|
|
1950
1953
|
});
|
|
1951
1954
|
const getCurrentDateTimeString = () => {
|
|
1952
1955
|
return moment().format(dateFormat);
|
|
@@ -2110,6 +2113,7 @@ const useChatFlow = (chatDataRef, setLoader, setFlowType, setScreenName, setUser
|
|
|
2110
2113
|
setSessionId: setSessionId,
|
|
2111
2114
|
setInitValue: setInitValue,
|
|
2112
2115
|
uniqueChatId: uniqueChatId,
|
|
2116
|
+
additionalArgs: additionalArgs,
|
|
2113
2117
|
});
|
|
2114
2118
|
}
|
|
2115
2119
|
else if (data.actionType === "indirect") {
|
|
@@ -3884,6 +3888,7 @@ const useChatState = () => {
|
|
|
3884
3888
|
const [isModalOpen, setIsModalOpen] = React.useState(false);
|
|
3885
3889
|
const [isUploadModalOpen, setIsUploadModalOpen] = React.useState(false);
|
|
3886
3890
|
const [isRefreshTriggered, setIsRefreshTriggered] = React.useState(false);
|
|
3891
|
+
const [additionalArgs, setAdditionalArgs] = React.useState({});
|
|
3887
3892
|
// Selectors
|
|
3888
3893
|
const filterReducerState = reactRedux.useSelector((state) => state.filterReducer);
|
|
3889
3894
|
const notificationData = reactRedux.useSelector((state) => state.notificationReducer.notificationData);
|
|
@@ -4028,6 +4033,8 @@ const useChatState = () => {
|
|
|
4028
4033
|
setIsUploadModalOpen,
|
|
4029
4034
|
isRefreshTriggered,
|
|
4030
4035
|
setIsRefreshTriggered,
|
|
4036
|
+
additionalArgs,
|
|
4037
|
+
setAdditionalArgs,
|
|
4031
4038
|
// Refs
|
|
4032
4039
|
grabPositionRef,
|
|
4033
4040
|
chatDataRef,
|
|
@@ -4452,7 +4459,7 @@ const Rectangle = ({ type, icon, title, description, onClick, hoverable }) => {
|
|
|
4452
4459
|
return (jsxRuntime.jsx("div", { className: `${classes.rectangle} ${classes[type]} ${hoverable ? classes.rectangleHoverable : ''}`, onClick: onClick, children: jsxRuntime.jsxs("div", { className: classes.textContainer, children: [jsxRuntime.jsx(material.Typography, { className: classes.title, children: title }), jsxRuntime.jsx(material.Typography, { className: classes.description, children: description })] }) }));
|
|
4453
4460
|
};
|
|
4454
4461
|
const ChatPlaceholder = (props) => {
|
|
4455
|
-
const { dateFormat, chatDataRef, currentMode, setShowChatPlaceholder, setLoader, setCurrentAgentId, baseUrl, setBaseUrl, setCurrentSessionId, customChatConfig, chatDataInfoRef, setChatDataState, userInput, legacyAgentScreen, activeConversationId, chatBodyRef, chatbotContext, setInitValue, setSessionId, thinkingContent, setThinkingContent, isThinking, setIsThinking, chatId, setChatId, isStop, setIsStop, functionsRef, functionsState, setFunctionsState, thinkingHeaderMessage, setThinkingHeaderMessage, uniqueChatId, setUniqueChatId, fieldNumber, setFieldNumber, questions, displayQuestions } = props;
|
|
4462
|
+
const { dateFormat, chatDataRef, currentMode, setShowChatPlaceholder, setLoader, setCurrentAgentId, baseUrl, setBaseUrl, setCurrentSessionId, customChatConfig, chatDataInfoRef, setChatDataState, userInput, legacyAgentScreen, activeConversationId, chatBodyRef, chatbotContext, setInitValue, setSessionId, thinkingContent, setThinkingContent, isThinking, setIsThinking, chatId, setChatId, isStop, setIsStop, functionsRef, functionsState, setFunctionsState, thinkingHeaderMessage, setThinkingHeaderMessage, uniqueChatId, setUniqueChatId, fieldNumber, setFieldNumber, setAdditionalArgs, questions, displayQuestions } = props;
|
|
4456
4463
|
const classes = useStyles$5();
|
|
4457
4464
|
globalStyles();
|
|
4458
4465
|
const [cardList, setCardList] = React.useState([]);
|
|
@@ -4482,6 +4489,7 @@ const ChatPlaceholder = (props) => {
|
|
|
4482
4489
|
setUniqueChatId,
|
|
4483
4490
|
fieldNumber,
|
|
4484
4491
|
setFieldNumber,
|
|
4492
|
+
setAdditionalArgs,
|
|
4485
4493
|
});
|
|
4486
4494
|
const getBaseUrl = async () => {
|
|
4487
4495
|
try {
|
|
@@ -5102,6 +5110,9 @@ const sseevent = (message, messageToStoreRef) => {
|
|
|
5102
5110
|
messageToStoreRef.current.uniqueChatId = parsedData?.chat_id
|
|
5103
5111
|
? parsedData.chat_id
|
|
5104
5112
|
: "";
|
|
5113
|
+
messageToStoreRef.current.additionalArgs = parsedData?.additional_args
|
|
5114
|
+
? parsedData.additional_args
|
|
5115
|
+
: {};
|
|
5105
5116
|
}
|
|
5106
5117
|
// Handle widget status - capture widget_data when status is "widget"
|
|
5107
5118
|
if (parsedData?.status === "widget" && !lodash.isEmpty(parsedData?.widget_data)) {
|
|
@@ -5122,6 +5133,9 @@ const sseevent = (message, messageToStoreRef) => {
|
|
|
5122
5133
|
: "";
|
|
5123
5134
|
messageToStoreRef.current.initValue = true;
|
|
5124
5135
|
messageToStoreRef.current.status = "completed";
|
|
5136
|
+
messageToStoreRef.current.additionalArgs = parsedData?.additional_args
|
|
5137
|
+
? parsedData.additional_args
|
|
5138
|
+
: {};
|
|
5125
5139
|
}
|
|
5126
5140
|
if (parsedData?.status === "completed" ||
|
|
5127
5141
|
parsedData?.status === "follow-up") {
|
|
@@ -5947,6 +5961,7 @@ const StreamedContent = ({ botData }) => {
|
|
|
5947
5961
|
initValue: false,
|
|
5948
5962
|
sessionId: "",
|
|
5949
5963
|
uniqueChatId: "",
|
|
5964
|
+
additionalArgs: {},
|
|
5950
5965
|
});
|
|
5951
5966
|
React.useRef(new Set()); // Tracks processed message chunks to prevent duplicates
|
|
5952
5967
|
React.useRef(""); // Tracks current content before adding new chunk
|
|
@@ -6252,6 +6267,9 @@ const StreamedContent = ({ botData }) => {
|
|
|
6252
6267
|
];
|
|
6253
6268
|
botData.utilityObject.setInitValue(messageToStoreRef.current.initValue);
|
|
6254
6269
|
botData.utilityObject.setSessionId(messageToStoreRef.current.sessionId);
|
|
6270
|
+
botData.utilityObject.setAdditionalArgs(!isEmpty(messageToStoreRef.current.additionalArgs)
|
|
6271
|
+
? messageToStoreRef.current.additionalArgs
|
|
6272
|
+
: {});
|
|
6255
6273
|
if (!wasStreamingAbortedRef.current) {
|
|
6256
6274
|
botData.utilityObject.setUniqueChatId(messageToStoreRef.current.uniqueChatId);
|
|
6257
6275
|
dispatch(smartBotActions.setCurrentAgentChatId(messageToStoreRef.current.uniqueChatId));
|
|
@@ -7910,10 +7928,10 @@ const buildFilterOptionsPayload = (filterConfig, existingFilters = [], filterOpt
|
|
|
7910
7928
|
filter_type: "cascaded",
|
|
7911
7929
|
dimension: fullFilterConfig?.dimension || "product",
|
|
7912
7930
|
display_type: fullFilterConfig?.display_type || "dropdown",
|
|
7913
|
-
check_configuration: [],
|
|
7931
|
+
check_configuration: mention.checkAll ? [{ checkAll: true, meta: {} }] : [],
|
|
7914
7932
|
is_mandatory: fullFilterConfig?.is_mandatory || false,
|
|
7915
7933
|
extra: {},
|
|
7916
|
-
values: mention.values || [],
|
|
7934
|
+
values: mention.checkAll ? [] : (mention.values || []),
|
|
7917
7935
|
attribute_name: attributeName,
|
|
7918
7936
|
operator: "in",
|
|
7919
7937
|
display_order: fullFilterConfig?.display_order || 0,
|
|
@@ -8063,7 +8081,7 @@ const findTextNodeAtPosition = (editorRef, position) => {
|
|
|
8063
8081
|
* @param {boolean} isStage1 - Whether this is stage 1 (filter only) or stage 2 (with values)
|
|
8064
8082
|
* @returns {HTMLSpanElement} Mention span element
|
|
8065
8083
|
*/
|
|
8066
|
-
const createMentionSpan = (text, filterName, values, groupId, isStage1 = false) => {
|
|
8084
|
+
const createMentionSpan = (text, filterName, values, groupId, isStage1 = false, checkAll = false) => {
|
|
8067
8085
|
const mentionSpan = document.createElement("span");
|
|
8068
8086
|
mentionSpan.className = "mention-highlight";
|
|
8069
8087
|
mentionSpan.contentEditable = "false";
|
|
@@ -8073,6 +8091,9 @@ const createMentionSpan = (text, filterName, values, groupId, isStage1 = false)
|
|
|
8073
8091
|
if (values && values.length > 0) {
|
|
8074
8092
|
mentionSpan.setAttribute("data-values", JSON.stringify(values));
|
|
8075
8093
|
}
|
|
8094
|
+
if (checkAll) {
|
|
8095
|
+
mentionSpan.setAttribute("data-check-all", "true");
|
|
8096
|
+
}
|
|
8076
8097
|
mentionSpan.textContent = text;
|
|
8077
8098
|
return mentionSpan;
|
|
8078
8099
|
};
|
|
@@ -8174,6 +8195,7 @@ const getAllMentions = (editorRef) => {
|
|
|
8174
8195
|
filterName: span.getAttribute("data-filter-name"),
|
|
8175
8196
|
stage: span.getAttribute("data-stage"),
|
|
8176
8197
|
values: JSON.parse(span.getAttribute("data-values") || "[]"),
|
|
8198
|
+
checkAll: span.getAttribute("data-check-all") === "true",
|
|
8177
8199
|
text: span.textContent,
|
|
8178
8200
|
}));
|
|
8179
8201
|
};
|
|
@@ -8219,13 +8241,10 @@ const formatMentionDisplay = (filterName, values, maxVisible = 3) => {
|
|
|
8219
8241
|
return `@${filterName}::`;
|
|
8220
8242
|
}
|
|
8221
8243
|
const visibleValues = values.slice(0, maxVisible);
|
|
8222
|
-
|
|
8244
|
+
values.length - maxVisible;
|
|
8223
8245
|
// Decode any special character codes for display purposes only.
|
|
8224
8246
|
const displayVisibleValues = visibleValues.map((v) => replaceSpecialCharacter(String(v)));
|
|
8225
8247
|
let display = `@${filterName}::${displayVisibleValues.join(",")}`;
|
|
8226
|
-
if (hiddenCount > 0) {
|
|
8227
|
-
display += `,+${hiddenCount}`;
|
|
8228
|
-
}
|
|
8229
8248
|
return display;
|
|
8230
8249
|
};
|
|
8231
8250
|
/**
|
|
@@ -8374,6 +8393,10 @@ const ChatbotInput = (props) => {
|
|
|
8374
8393
|
const isInsertingMentionRef = React.useRef(false);
|
|
8375
8394
|
const isTransitioningStageRef = React.useRef(false);
|
|
8376
8395
|
const shouldClearCacheRef = React.useRef(false);
|
|
8396
|
+
const allFilterValuesRef = React.useRef([]);
|
|
8397
|
+
const windowStartRef = React.useRef(0);
|
|
8398
|
+
const INITIAL_DISPLAY_COUNT = 500;
|
|
8399
|
+
const LOAD_MORE_COUNT = 100;
|
|
8377
8400
|
const chatbotContext = reactRedux.useSelector((state) => state.smartBotReducer.chatbotContext);
|
|
8378
8401
|
// Date range picker state
|
|
8379
8402
|
const [showDateRangePicker, setShowDateRangePicker] = React.useState(false);
|
|
@@ -8863,6 +8886,7 @@ const ChatbotInput = (props) => {
|
|
|
8863
8886
|
filterConfig?.name ||
|
|
8864
8887
|
mention.filterName,
|
|
8865
8888
|
values: mention.values,
|
|
8889
|
+
checkAll: mention.checkAll || false,
|
|
8866
8890
|
};
|
|
8867
8891
|
});
|
|
8868
8892
|
};
|
|
@@ -8936,7 +8960,16 @@ const ChatbotInput = (props) => {
|
|
|
8936
8960
|
// Fetch values for Stage 2 (with existing filters for cascading)
|
|
8937
8961
|
fetchFilterValues(filterConfig, existingFilters, filterOptions).then((valueOptions) => {
|
|
8938
8962
|
setIsLoadingValues(false);
|
|
8939
|
-
|
|
8963
|
+
const allValues = valueOptions || [];
|
|
8964
|
+
windowStartRef.current = 0;
|
|
8965
|
+
if (allValues.length > 2000) {
|
|
8966
|
+
allFilterValuesRef.current = allValues;
|
|
8967
|
+
setCurrentOptions(allValues.slice(0, INITIAL_DISPLAY_COUNT));
|
|
8968
|
+
}
|
|
8969
|
+
else {
|
|
8970
|
+
allFilterValuesRef.current = [];
|
|
8971
|
+
setCurrentOptions(allValues);
|
|
8972
|
+
}
|
|
8940
8973
|
// Update dropdown position again after values are loaded (DOM might have shifted)
|
|
8941
8974
|
if (mentionStartPos !== null) {
|
|
8942
8975
|
updateDropdownPosition(mentionStartPos);
|
|
@@ -9029,6 +9062,7 @@ const ChatbotInput = (props) => {
|
|
|
9029
9062
|
}
|
|
9030
9063
|
// Determine if this filter is multi-select
|
|
9031
9064
|
selectedFilter.isMulti !== false; // Default to true
|
|
9065
|
+
const isCheckAll = isAllSelected && allFilterValuesRef.current.length > 0;
|
|
9032
9066
|
// Format mention text (decoded for display only)
|
|
9033
9067
|
const mentionText = formatMentionDisplay(filterName, values, MAX_VISIBLE);
|
|
9034
9068
|
// Create fragment
|
|
@@ -9036,12 +9070,15 @@ const ChatbotInput = (props) => {
|
|
|
9036
9070
|
// Create mention span
|
|
9037
9071
|
values.slice(0, MAX_VISIBLE);
|
|
9038
9072
|
const hiddenValues = values.slice(MAX_VISIBLE);
|
|
9039
|
-
const mentionSpan = createMentionSpan(mentionText, filterName, values, currentMentionGroupId, false // Stage 2
|
|
9040
|
-
);
|
|
9073
|
+
const mentionSpan = createMentionSpan(mentionText, filterName, values, currentMentionGroupId, false, // Stage 2
|
|
9074
|
+
isCheckAll);
|
|
9041
9075
|
fragment.appendChild(mentionSpan);
|
|
9042
9076
|
// Add count badge if needed
|
|
9043
9077
|
if (hiddenValues.length > 0) {
|
|
9044
|
-
const
|
|
9078
|
+
const badgeCount = isCheckAll
|
|
9079
|
+
? allFilterValuesRef.current.length - MAX_VISIBLE
|
|
9080
|
+
: hiddenValues.length;
|
|
9081
|
+
const countBadge = createCountBadge(badgeCount, hiddenValues, currentMentionGroupId);
|
|
9045
9082
|
fragment.appendChild(countBadge);
|
|
9046
9083
|
}
|
|
9047
9084
|
// Add space to fragment
|
|
@@ -9626,7 +9663,28 @@ const ChatbotInput = (props) => {
|
|
|
9626
9663
|
// Stage 2: Value selection with dropdown - use Select
|
|
9627
9664
|
jsxRuntime.jsx(impactUiV3.Select, { currentOptions: currentOptions.length > 0 ? currentOptions : [], setCurrentOptions: setCurrentOptions, initialOptions: currentOptions.length > 0 ? currentOptions : [], placeholder: isLoadingValues
|
|
9628
9665
|
? "Loading values..."
|
|
9629
|
-
: "Select values...", handleChange: handleMentionSelect, isOpen: isSelectOpen, setIsOpen: setIsSelectOpen, selectedOptions: selectedOptions, setSelectedOptions: setSelectedOptions, isCloseWhenClickOutside: false, isWithSearch: true,
|
|
9666
|
+
: "Select values...", handleChange: handleMentionSelect, isOpen: isSelectOpen, setIsOpen: setIsSelectOpen, selectedOptions: selectedOptions, setSelectedOptions: setSelectedOptions, isCloseWhenClickOutside: false, isWithSearch: true, onMenuScrollToBottom: () => {
|
|
9667
|
+
const allValues = allFilterValuesRef.current;
|
|
9668
|
+
if (allValues.length > 0 && currentOptions.length < allValues.length) {
|
|
9669
|
+
const nextCount = Math.min(currentOptions.length + LOAD_MORE_COUNT, allValues.length);
|
|
9670
|
+
const nextOptions = allValues.slice(0, nextCount);
|
|
9671
|
+
setCurrentOptions(nextOptions);
|
|
9672
|
+
if (isAllSelected) {
|
|
9673
|
+
setSelectedOptions(nextOptions);
|
|
9674
|
+
}
|
|
9675
|
+
}
|
|
9676
|
+
}, onSelectAll: (e) => {
|
|
9677
|
+
if (e && e.target.checked) {
|
|
9678
|
+
setSelectedOptions([...currentOptions]);
|
|
9679
|
+
setIsAllSelected(true);
|
|
9680
|
+
}
|
|
9681
|
+
else {
|
|
9682
|
+
setSelectedOptions([]);
|
|
9683
|
+
setIsAllSelected(false);
|
|
9684
|
+
}
|
|
9685
|
+
}, customPlaceholderAfterSelect: isAllSelected && allFilterValuesRef.current.length > 0
|
|
9686
|
+
? allFilterValuesRef.current.length
|
|
9687
|
+
: null, isSelectAll: !isLoadingValues ? isAllSelected : false, setIsSelectAll: setIsAllSelected, toggleSelectAll: !isLoadingValues, isMulti: selectedFilter?.is_multiple_selection !== false, disabled: isLoadingValues, isLoading: isLoadingValues, emptyMessage: isLoadingValues ? "Loading values..." : "No options available" })) })), showDateRangePicker && (jsxRuntime.jsx("div", { className: "mention-select-wrapper", ref: dateRangePickerRef, style: {
|
|
9630
9688
|
position: "fixed",
|
|
9631
9689
|
top: `680px`,
|
|
9632
9690
|
left: `${dropdownPosition.left}px`,
|
|
@@ -9715,7 +9773,7 @@ let chatbotFilterCustomConfig = {
|
|
|
9715
9773
|
|
|
9716
9774
|
const SmartBot = (props) => {
|
|
9717
9775
|
const { userName, partialClose, setPartialClose, forceOpen, customBaseUrl = "", displayQuestions, questions = [] } = props;
|
|
9718
|
-
const { showModal, setShowModal, minimizedMode, setMinimizedMode, userInput, setUserInput, position, setPosition, flowType, setFlowType, screenName, setScreenName, questionIndex, setQuestionIndex, currentAppLink, setCurrentAppLink, loader, setLoader, enableRefreshAction, setEnableRefreshAction, refreshLoader, setRefreshLoader, chatDataState, setChatDataState, showExtendedContent, setShowExtendedContent, currentMode, setCurrentMode, selectedModule, setSelectedModule, isCardVisible, setIsCardVisible, templateData, setTemplateData, showAlert, setShowAlert, grabPositionRef, chatDataRef, chatBodyRef, minimizedBtnRef, chatDataScreenLinkRef, navigate, location, dispatch, globalClasses, classes, dateFormat, filterReducerState, activeConversationId, setActiveConversationId, isModuleChanged, setIsModuleChanged, showChatPlaceholder, setShowChatPlaceholder, currentAgentId, setCurrentAgentId, baseUrl = customBaseUrl, setBaseUrl, currentSessionId, setCurrentSessionId, notificationData, agentTaskCompleted, setAgentTaskCompleted, customChatConfig, setCustomChatConfig, setMiddleWareFunction, chatBotInfoRef, chatDataInfoRef, initValue, setInitValue, sessionId, setSessionId, thinkingContent, setThinkingContent, isThinking, setIsThinking, chatId, setChatId, isStop, setIsStop, functionsRef, functionsState, setFunctionsState, thinkingHeaderMessage, setThinkingHeaderMessage, legacyAgentScreen, setLegacyAgentScreen, uniqueChatId, setUniqueChatId, fieldNumber, setFieldNumber, thinkingContext, isModalOpen, setIsModalOpen, utilityList, setUtilityList, isUploadModalOpen, setIsUploadModalOpen, isRefreshTriggered, setIsRefreshTriggered, } = useChatState();
|
|
9776
|
+
const { showModal, setShowModal, minimizedMode, setMinimizedMode, userInput, setUserInput, position, setPosition, flowType, setFlowType, screenName, setScreenName, questionIndex, setQuestionIndex, currentAppLink, setCurrentAppLink, loader, setLoader, enableRefreshAction, setEnableRefreshAction, refreshLoader, setRefreshLoader, chatDataState, setChatDataState, showExtendedContent, setShowExtendedContent, currentMode, setCurrentMode, selectedModule, setSelectedModule, isCardVisible, setIsCardVisible, templateData, setTemplateData, showAlert, setShowAlert, grabPositionRef, chatDataRef, chatBodyRef, minimizedBtnRef, chatDataScreenLinkRef, navigate, location, dispatch, globalClasses, classes, dateFormat, filterReducerState, activeConversationId, setActiveConversationId, isModuleChanged, setIsModuleChanged, showChatPlaceholder, setShowChatPlaceholder, currentAgentId, setCurrentAgentId, baseUrl = customBaseUrl, setBaseUrl, currentSessionId, setCurrentSessionId, notificationData, agentTaskCompleted, setAgentTaskCompleted, customChatConfig, setCustomChatConfig, setMiddleWareFunction, chatBotInfoRef, chatDataInfoRef, initValue, setInitValue, sessionId, setSessionId, thinkingContent, setThinkingContent, isThinking, setIsThinking, chatId, setChatId, isStop, setIsStop, functionsRef, functionsState, setFunctionsState, thinkingHeaderMessage, setThinkingHeaderMessage, legacyAgentScreen, setLegacyAgentScreen, uniqueChatId, setUniqueChatId, fieldNumber, setFieldNumber, thinkingContext, isModalOpen, setIsModalOpen, utilityList, setUtilityList, isUploadModalOpen, setIsUploadModalOpen, isRefreshTriggered, setIsRefreshTriggered, additionalArgs, setAdditionalArgs, } = useChatState();
|
|
9719
9777
|
// Add state for confirmation dialogs
|
|
9720
9778
|
React.useState(false);
|
|
9721
9779
|
React.useState(null);
|
|
@@ -9739,7 +9797,7 @@ const SmartBot = (props) => {
|
|
|
9739
9797
|
const [isLandingScreen, setIsLandingScreen] = React.useState(true);
|
|
9740
9798
|
const [showSuggestionBanner, setShowSuggestionBanner] = React.useState(true);
|
|
9741
9799
|
const [filterOptions, setFilterOptions] = React.useState([]);
|
|
9742
|
-
const { setUserFlow, setUserScreenAndFlow, fetchUserResultsFromQuery, getCurrentDateTimeString, setLink, } = useChatFlow(chatDataRef, setLoader, setFlowType, setScreenName, setUserInput, setQuestionIndex, setCurrentAppLink, flowType, screenName, questionIndex, userInput, dateFormat, currentMode, activeConversationId, setIsModuleChanged, chatBodyRef, filterReducerState, dispatch, navigate, setShowChatPlaceholder, baseUrl, setChatDataState, setCurrentSessionId, customChatConfig, chatDataInfoRef, chatbotContext, setInitValue, setSessionId, thinkingContent, setThinkingContent, isThinking, setIsThinking, chatId, setChatId, isStop, setIsStop, functionsRef, functionsState, setFunctionsState, thinkingHeaderMessage, setThinkingHeaderMessage, uniqueChatId, initValue, sessionId, fieldNumber, setFieldNumber);
|
|
9800
|
+
const { setUserFlow, setUserScreenAndFlow, fetchUserResultsFromQuery, getCurrentDateTimeString, setLink, } = useChatFlow(chatDataRef, setLoader, setFlowType, setScreenName, setUserInput, setQuestionIndex, setCurrentAppLink, flowType, screenName, questionIndex, userInput, dateFormat, currentMode, activeConversationId, setIsModuleChanged, chatBodyRef, filterReducerState, dispatch, navigate, setShowChatPlaceholder, baseUrl, setChatDataState, setCurrentSessionId, customChatConfig, chatDataInfoRef, chatbotContext, setInitValue, setSessionId, thinkingContent, setThinkingContent, isThinking, setIsThinking, chatId, setChatId, isStop, setIsStop, functionsRef, functionsState, setFunctionsState, thinkingHeaderMessage, setThinkingHeaderMessage, uniqueChatId, initValue, sessionId, fieldNumber, setFieldNumber, additionalArgs);
|
|
9743
9801
|
const { parseSavedFlow, saveCurrentChanges, endCurrentSession, clearChatSession, initiateNewChat, hasUnsavedChanges, } = useChatSession(chatDataRef, setFlowType, setScreenName, setUserInput, setTemplateData, chatDataScreenLinkRef, setShowModal, setMinimizedMode, setSelectedModule, setChatDataState, currentMode, setUserFlow, getCurrentDateTimeString, setCurrentAppLink, selectedModule, fetchUserResultsFromQuery, props.closeBot, activeConversationId, setActiveConversationId, setShowChatPlaceholder);
|
|
9744
9802
|
const { refreshAndUpdateUserManual, configureBotActions, displaySnackMessages, } = useBotConfiguration(setRefreshLoader, setEnableRefreshAction, dispatch);
|
|
9745
9803
|
const { prepareDataAndSendToAgent } = useAgentFlow(dateFormat, chatDataRef, currentMode, setShowChatPlaceholder, setLoader, baseUrl, setCurrentSessionId, customChatConfig, chatDataInfoRef, {
|
|
@@ -9767,6 +9825,7 @@ const SmartBot = (props) => {
|
|
|
9767
9825
|
setUniqueChatId,
|
|
9768
9826
|
fieldNumber,
|
|
9769
9827
|
setFieldNumber,
|
|
9828
|
+
setAdditionalArgs,
|
|
9770
9829
|
});
|
|
9771
9830
|
const fetchCustomBotConfigurations = async () => {
|
|
9772
9831
|
try {
|
|
@@ -10133,7 +10192,8 @@ const SmartBot = (props) => {
|
|
|
10133
10192
|
setSessionId: setSessionId,
|
|
10134
10193
|
setInitValue: setInitValue,
|
|
10135
10194
|
uniqueChatId: uniqueChatId,
|
|
10136
|
-
currentAgentChatId: currentAgentChatId
|
|
10195
|
+
currentAgentChatId: currentAgentChatId,
|
|
10196
|
+
additionalArgs: lodash.isEmpty(userInput) ? additionalArgs : {}
|
|
10137
10197
|
});
|
|
10138
10198
|
setUserInput("");
|
|
10139
10199
|
}
|
|
@@ -10296,6 +10356,7 @@ const SmartBot = (props) => {
|
|
|
10296
10356
|
}));
|
|
10297
10357
|
setInitValue(true);
|
|
10298
10358
|
setSessionId("");
|
|
10359
|
+
setAdditionalArgs({});
|
|
10299
10360
|
setIsStop(false);
|
|
10300
10361
|
setUserInput("");
|
|
10301
10362
|
setUniqueChatId("");
|
|
@@ -10413,7 +10474,7 @@ const SmartBot = (props) => {
|
|
|
10413
10474
|
},
|
|
10414
10475
|
icon: jsxRuntime.jsx(SvgNavigationIcon, {}),
|
|
10415
10476
|
},
|
|
10416
|
-
], utilityList: utilityList, isAssistantThinking: loader, isCustomScreen: showChatPlaceholder, customScreenJsx: jsxRuntime.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, displayQuestions: displayQuestions, questions: questions }), inputText: userInput, threadList: ["Home"], hideMenuArrow: hideMenu, newChatScreen: newChatScreen, isModuleListLoading: modulesLoading, suggestionBanner: {
|
|
10477
|
+
], utilityList: utilityList, isAssistantThinking: loader, isCustomScreen: showChatPlaceholder, customScreenJsx: jsxRuntime.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 }), inputText: userInput, threadList: ["Home"], hideMenuArrow: hideMenu, newChatScreen: newChatScreen, isModuleListLoading: modulesLoading, suggestionBanner: {
|
|
10417
10478
|
freeTextHeading: "Try adding more details :",
|
|
10418
10479
|
freeTextContent: "Alan works better when you provide more context and pointed questions",
|
|
10419
10480
|
}, isStopIcon: isStop, onStopIconClick: onStopIconClick, footerText: "AI-generated responses may contain errors\u2014please verify important information", showSuggestionBanner: showSuggestionBanner, onCloseSuggestionBanner: () => {
|