impact-chatbot 3.1.5 → 3.1.7
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/index.cjs.js +55 -31
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +55 -31
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -9345,7 +9345,10 @@ const SurfaceFrameContent = ({ frame, isFormDisabled = false, messageIndex = 0 }
|
|
|
9345
9345
|
if (prompt)
|
|
9346
9346
|
window.dispatchEvent(new CustomEvent(PROMPT_EVENT, { detail: prompt }));
|
|
9347
9347
|
}
|
|
9348
|
-
else if (data.type === "iui:change" && ask && own) {
|
|
9348
|
+
else if (data.type === "iui:change" && ask && own && !isFormDisabled) {
|
|
9349
|
+
// only while the form waits: once it is submitted or timed out, its page repeats its values every time
|
|
9350
|
+
// the surface is posted into it (disabled after Submit, again on each step of the run), and in
|
|
9351
|
+
// chatbotContext those would be sent in place of the next message the user types
|
|
9349
9352
|
const values = data.values || {};
|
|
9350
9353
|
setForm({ values, inputs: Array.isArray(data.inputs) ? data.inputs : Object.keys(values), missing: Array.isArray(data.missing) ? data.missing : [] });
|
|
9351
9354
|
// as this chat's own inputs record their values, for the step form's Submit (ButtonContent)
|
|
@@ -15146,7 +15149,7 @@ const useMentionState = () => {
|
|
|
15146
15149
|
};
|
|
15147
15150
|
|
|
15148
15151
|
const ChatbotInput = (props) => {
|
|
15149
|
-
const { newChatScreen, inputValue, setInputValue, isStopIcon, handleMicClick, handleRefresh, onSendIconClick, onStopIconClick, currentMode, filterOptions, onSaveClick, savedFilterSets, onFilterSetSelect, onTriggerRefresh, selectedFilterSet, onClearFilterSet, answerMode, setAnswerMode, } = props;
|
|
15152
|
+
const { newChatScreen, inputValue, setInputValue, isStopIcon, handleMicClick, handleRefresh, onSendIconClick, onStopIconClick, currentMode, filterOptions, onSaveClick, savedFilterSets, onFilterSetSelect, onTriggerRefresh, onUploadDocument, onUploadSkill, selectedFilterSet, onClearFilterSet, answerMode, setAnswerMode, } = props;
|
|
15150
15153
|
const { components } = useChatbotDeps();
|
|
15151
15154
|
const hasFilterComponent = !!components?.FilterComponent;
|
|
15152
15155
|
const editorRef = useRef(null);
|
|
@@ -16349,27 +16352,36 @@ const ChatbotInput = (props) => {
|
|
|
16349
16352
|
document.removeEventListener("mousedown", handleClickOutside);
|
|
16350
16353
|
};
|
|
16351
16354
|
}, [showMentionSelect]);
|
|
16352
|
-
// Build filter set menu options with suboptions (for the + button dropdown)
|
|
16355
|
+
// Build filter set menu options with suboptions (for the + button dropdown).
|
|
16356
|
+
// Filter Set is only offered when the host provides FilterComponent.
|
|
16353
16357
|
const filterSetMenuOptions = useMemo(() => {
|
|
16354
|
-
const
|
|
16355
|
-
|
|
16356
|
-
|
|
16357
|
-
label:
|
|
16358
|
-
|
|
16359
|
-
|
|
16360
|
-
|
|
16361
|
-
|
|
16362
|
-
|
|
16358
|
+
const options = [];
|
|
16359
|
+
if (hasFilterComponent) {
|
|
16360
|
+
const filterSetChildren = [
|
|
16361
|
+
{ label: "None (Default)", value: "__none__" },
|
|
16362
|
+
...(savedFilterSets || []).map((f) => ({
|
|
16363
|
+
label: f.name || f.label,
|
|
16364
|
+
value: f.fuc_code || f.name || f.label,
|
|
16365
|
+
})),
|
|
16366
|
+
];
|
|
16367
|
+
options.push({
|
|
16363
16368
|
children: filterSetChildren,
|
|
16364
16369
|
label: "Filter Set",
|
|
16365
16370
|
value: "filter_set",
|
|
16366
|
-
}
|
|
16367
|
-
|
|
16368
|
-
|
|
16369
|
-
|
|
16370
|
-
|
|
16371
|
-
|
|
16372
|
-
|
|
16371
|
+
});
|
|
16372
|
+
}
|
|
16373
|
+
options.push({
|
|
16374
|
+
label: "Upload Document",
|
|
16375
|
+
value: "__upload_document__",
|
|
16376
|
+
}, {
|
|
16377
|
+
label: "Upload Skill",
|
|
16378
|
+
value: "__upload_skill__",
|
|
16379
|
+
}, {
|
|
16380
|
+
label: "Trigger Refresh",
|
|
16381
|
+
value: "__trigger_refresh__",
|
|
16382
|
+
});
|
|
16383
|
+
return options;
|
|
16384
|
+
}, [savedFilterSets, hasFilterComponent]);
|
|
16373
16385
|
// Build selectedOptions for the filter set Select to highlight the currently selected filter
|
|
16374
16386
|
const filterSetSelectedOptions = useMemo(() => {
|
|
16375
16387
|
if (!selectedFilterSet)
|
|
@@ -16391,6 +16403,18 @@ const ChatbotInput = (props) => {
|
|
|
16391
16403
|
setIsFilterSetMenuOpen(false);
|
|
16392
16404
|
return;
|
|
16393
16405
|
}
|
|
16406
|
+
if (selectedOption.value === "__upload_document__") {
|
|
16407
|
+
onUploadDocument?.();
|
|
16408
|
+
setShowFilterSetMenu(false);
|
|
16409
|
+
setIsFilterSetMenuOpen(false);
|
|
16410
|
+
return;
|
|
16411
|
+
}
|
|
16412
|
+
if (selectedOption.value === "__upload_skill__") {
|
|
16413
|
+
onUploadSkill?.();
|
|
16414
|
+
setShowFilterSetMenu(false);
|
|
16415
|
+
setIsFilterSetMenuOpen(false);
|
|
16416
|
+
return;
|
|
16417
|
+
}
|
|
16394
16418
|
// When a suboption is selected, impact-ui-v3 Select passes the parent
|
|
16395
16419
|
// with the selected child in children array, e.g.:
|
|
16396
16420
|
// { label: "Filter Set", value: "filter_set", children: [{ label: "mk47", value: "mk47" }] }
|
|
@@ -16460,12 +16484,12 @@ const ChatbotInput = (props) => {
|
|
|
16460
16484
|
!target.closest(".answer-mode-wrapper")) {
|
|
16461
16485
|
editorRef.current.focus();
|
|
16462
16486
|
}
|
|
16463
|
-
}, children: jsxs("div", { className: `chat-input-wrapper ${isFixed ? "stacked" : ""} ${selectedFilterSet ? "has-filter-selected" : ""} ${(!isFixed || inputValue === "") && !newChatScreen && !selectedFilterSet ? "empty" : ""} ${!newChatScreen && !isFixed && !selectedFilterSet ? "single-line-textarea" : ""}`, style: { height }, children: [
|
|
16464
|
-
|
|
16465
|
-
|
|
16466
|
-
|
|
16467
|
-
|
|
16468
|
-
|
|
16487
|
+
}, children: jsxs("div", { className: `chat-input-wrapper ${isFixed ? "stacked" : ""} ${selectedFilterSet ? "has-filter-selected" : ""} ${(!isFixed || inputValue === "") && !newChatScreen && !selectedFilterSet ? "empty" : ""} ${!newChatScreen && !isFixed && !selectedFilterSet ? "single-line-textarea" : ""}`, style: { height }, children: [jsxs("div", { className: "chat-input-left-actions", children: [jsxs("div", { className: "filter-set-trigger-wrapper", ref: filterSetSelectRef, children: [jsx("button", { type: "button", className: `filter-set-plus-btn${hasMentionsInEditor || showMentionSelect ? " disabled" : ""}`, onClick: () => {
|
|
16488
|
+
if (hasMentionsInEditor || showMentionSelect)
|
|
16489
|
+
return;
|
|
16490
|
+
setShowFilterSetMenu(!showFilterSetMenu);
|
|
16491
|
+
setIsFilterSetMenuOpen(!showFilterSetMenu);
|
|
16492
|
+
}, children: jsx(SvgAddFilter, {}) }), showFilterSetMenu && (jsx("div", { className: "filter-set-select-dropdown", children: jsx(Select, { currentOptions: filterSetMenuOptions, setCurrentOptions: () => { }, initialOptions: filterSetMenuOptions, placeholder: "Select...", handleChange: handleFilterSetMenuChange, isOpen: isFilterSetMenuOpen, setIsOpen: setIsFilterSetMenuOpen, selectedOptions: filterSetSelectedOptions, setSelectedOptions: () => { }, isCloseWhenClickOutside: false, isWithSearch: false, isMulti: false, disabled: false, isLoading: false, emptyMessage: "No options" }) }))] }), selectedFilterSet && (jsxs("div", { className: "filter-set-chip", children: [jsx(SvgFilterFolder, { className: "filter-set-chip-icon" }), jsx("span", { className: "filter-set-chip-label", children: selectedFilterSet.name || selectedFilterSet.label }), jsx("button", { type: "button", className: "filter-set-chip-clear", onClick: () => onClearFilterSet?.(), children: jsx(SvgClearFilter, {}) })] }))] }), jsx("div", { ref: editorRef, className: "chat-input-editor", contentEditable: true, tabIndex: 0, role: "textbox", "aria-label": "Ask anything...", "aria-multiline": "true", "data-placeholder": "Ask anything...", onInput: handleInput, onKeyDown: (e) => {
|
|
16469
16493
|
if (e.key === "Escape") {
|
|
16470
16494
|
// Don't handle Escape for date range picker - it has its own Cancel button
|
|
16471
16495
|
if (showMentionSelect) {
|
|
@@ -19542,9 +19566,9 @@ const SmartBot = (props) => {
|
|
|
19542
19566
|
return;
|
|
19543
19567
|
if (root.contains(e.target))
|
|
19544
19568
|
return; // interaction inside the bot → ignore
|
|
19545
|
-
// The Rename / Delete modals render in a
|
|
19546
|
-
// subtree, so clicks in them look "outside". Don't collapse while open.
|
|
19547
|
-
if (renameOpen || deleteOpen)
|
|
19569
|
+
// The Rename / Delete / Upload modals render in a portal outside the bot's
|
|
19570
|
+
// DOM subtree, so clicks in them look "outside". Don't collapse while open.
|
|
19571
|
+
if (renameOpen || deleteOpen || isUploadModalOpen || isSkillUploadOpen)
|
|
19548
19572
|
return;
|
|
19549
19573
|
// Ignore clicks inside the expanded table modal portal
|
|
19550
19574
|
if (e.target.closest?.(".test-modal"))
|
|
@@ -19564,7 +19588,7 @@ const SmartBot = (props) => {
|
|
|
19564
19588
|
};
|
|
19565
19589
|
// collapseChatBotIfExpanded is a stable callback (empty deps).
|
|
19566
19590
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
19567
|
-
}, [renameOpen, deleteOpen]);
|
|
19591
|
+
}, [renameOpen, deleteOpen, isUploadModalOpen, isSkillUploadOpen]);
|
|
19568
19592
|
// Auto-collapse on route changes (skip the initial mount so freshly opening
|
|
19569
19593
|
// the bot doesn't immediately collapse it).
|
|
19570
19594
|
const hasMountedForCollapseRef = useRef(false);
|
|
@@ -19580,9 +19604,9 @@ const SmartBot = (props) => {
|
|
|
19580
19604
|
return (jsxs(Fragment, { children: [partialClose && (minimizedStreamData?.isStreaming || minimizedStreamData?.stepStatus === "step_form") && (jsx(MinimizedChatWidget, { onExpand: () => {
|
|
19581
19605
|
setShowModal(true);
|
|
19582
19606
|
setPartialClose(false);
|
|
19583
|
-
} })), jsxs("div", { ref: smartBotWrapperRef, className: `${classes.agentStyleOverride} ${partialClose || !(showModal || forceOpen) ? classes.hideBotStyle : ""} ${!enableMultiChat ? classes.hideIrisMenu : ""}`, 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 }),
|
|
19607
|
+
} })), jsxs("div", { ref: smartBotWrapperRef, className: `${classes.agentStyleOverride} ${partialClose || !(showModal || forceOpen) ? classes.hideBotStyle : ""} ${!enableMultiChat ? classes.hideIrisMenu : ""}`, 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(SkillUploadModal, { isOpen: isSkillUploadOpen, setIsOpen: setIsSkillUploadOpen, baseUrl: baseUrl, displaySnackMessages: displaySnackMessages, onUseText: (text) => setUserInput(text) }), jsx(ChatBotComponent, { isFullWidth: forceOpen, userName: userName, isConversationLoading: conversationLoading, customInputComponent: currentMode === "agent" && !showSavedFilters ? (jsx(ChatbotInput, { newChatScreen: isEmptyChat, inputValue: userInput, setInputValue: setUserInput, isStopIcon: isStop, onSendIconClick: onSendIconClick, onStopIconClick: onStopIconClick, currentMode: currentMode, filterOptions: filterOptions,
|
|
19584
19608
|
// onSaveClick={saveCurrentChat}
|
|
19585
|
-
savedFilterSets: savedFilterSets, selectedFilterSet: selectedFilterSet, onFilterSetSelect: (filterSet) => setSelectedFilterSet(filterSet), onClearFilterSet: () => setSelectedFilterSet(null), onTriggerRefresh: triggerRefreshAction, answerMode: answerMode, setAnswerMode: setAnswerMode })) : showSavedFilters ? jsx(Fragment, {}) : null, isChatBotOpen: showModal || forceOpen, ...(enableMultiChat
|
|
19609
|
+
savedFilterSets: savedFilterSets, selectedFilterSet: selectedFilterSet, onFilterSetSelect: (filterSet) => setSelectedFilterSet(filterSet), onClearFilterSet: () => setSelectedFilterSet(null), onTriggerRefresh: triggerRefreshAction, onUploadDocument: () => setIsUploadModalOpen(true), onUploadSkill: () => setIsSkillUploadOpen(true), answerMode: answerMode, setAnswerMode: setAnswerMode })) : showSavedFilters ? jsx(Fragment, {}) : null, isChatBotOpen: showModal || forceOpen, ...(enableMultiChat
|
|
19586
19610
|
? {
|
|
19587
19611
|
historyPanelData,
|
|
19588
19612
|
onHistorySelectConversation: (params) => {
|