impact-chatbot 2.3.31 → 2.3.33
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 +73 -7
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +73 -7
- package/dist/index.esm.js.map +1 -1
- package/dist/services/chatbot-services.d.ts +1 -0
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -210,6 +210,18 @@ const getFilterOptions = (postBody) => async () => {
|
|
|
210
210
|
data: postBody,
|
|
211
211
|
});
|
|
212
212
|
};
|
|
213
|
+
const getTableRecords = async (baseUrl, tableName, page, pageSize) => {
|
|
214
|
+
try {
|
|
215
|
+
return axiosInstance({
|
|
216
|
+
url: `${baseUrl}/chatbot/agent/tabular-data/${tableName}?page=${page}&page_size=${pageSize}`,
|
|
217
|
+
method: 'GET',
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
catch (error) {
|
|
221
|
+
console.error('getTableRecords error:', error);
|
|
222
|
+
return null;
|
|
223
|
+
}
|
|
224
|
+
};
|
|
213
225
|
|
|
214
226
|
const useBotConfiguration = (setRefreshLoader, setEnableRefreshAction, dispatch) => {
|
|
215
227
|
const displaySnackMessages = useCallback((message, variant) => {
|
|
@@ -5085,6 +5097,13 @@ const sseevent = (message, messageToStoreRef) => {
|
|
|
5085
5097
|
? parsedData.additional_args
|
|
5086
5098
|
: {};
|
|
5087
5099
|
}
|
|
5100
|
+
if (parsedData?.status === "notification") {
|
|
5101
|
+
messageToStoreRef.current.notificationData = {
|
|
5102
|
+
message: parsedData?.message || "",
|
|
5103
|
+
chat_id: parsedData?.chat_id || "",
|
|
5104
|
+
session_id: parsedData?.session_id || "",
|
|
5105
|
+
};
|
|
5106
|
+
}
|
|
5088
5107
|
if (parsedData?.status === "completed" ||
|
|
5089
5108
|
parsedData?.status === "follow-up") {
|
|
5090
5109
|
messageToStoreRef.current.initValue = true;
|
|
@@ -5384,7 +5403,7 @@ const TableContent = ({ bodyText }) => {
|
|
|
5384
5403
|
if (isEmpty$1(bodyText)) {
|
|
5385
5404
|
return null;
|
|
5386
5405
|
}
|
|
5387
|
-
const { table_config, row_data, display_name = "", unique_id, select_all_component, table_name, hide_table_setting = false, } = bodyText;
|
|
5406
|
+
const { table_config, row_data, display_name = "", unique_id, select_all_component, table_name, hide_table_setting = false, is_server_side = false, page_size = 10, } = bodyText;
|
|
5388
5407
|
const [columns, setColumns] = useState([]);
|
|
5389
5408
|
const [rowData, setRowData] = useState([]);
|
|
5390
5409
|
const [isModalOpen, setIsModalOpen] = useState(false);
|
|
@@ -5398,10 +5417,27 @@ const TableContent = ({ bodyText }) => {
|
|
|
5398
5417
|
}
|
|
5399
5418
|
}, [table_config]);
|
|
5400
5419
|
useEffect(() => {
|
|
5401
|
-
if (isEmpty$1(rowData)) {
|
|
5420
|
+
if (!is_server_side && isEmpty$1(rowData)) {
|
|
5402
5421
|
setRowData(row_data);
|
|
5403
5422
|
}
|
|
5404
5423
|
}, [row_data]);
|
|
5424
|
+
const serverSideManualCallBack = async (manualbody, pageIndex, params) => {
|
|
5425
|
+
try {
|
|
5426
|
+
const baseUrl = localStorage.getItem("stepForm_baseUrl") || "";
|
|
5427
|
+
const response = await getTableRecords(baseUrl, table_name, pageIndex + 1, page_size);
|
|
5428
|
+
return {
|
|
5429
|
+
data: response?.data?.data || [],
|
|
5430
|
+
totalCount: response?.data?.total_count || 0,
|
|
5431
|
+
};
|
|
5432
|
+
}
|
|
5433
|
+
catch (error) {
|
|
5434
|
+
console.error("Error in serverSideManualCallBack", error);
|
|
5435
|
+
return {
|
|
5436
|
+
data: [],
|
|
5437
|
+
totalCount: 0,
|
|
5438
|
+
};
|
|
5439
|
+
}
|
|
5440
|
+
};
|
|
5405
5441
|
const onSelectionChanged = (event) => {
|
|
5406
5442
|
try {
|
|
5407
5443
|
const selectedList = event.api.getSelectedRows();
|
|
@@ -5420,7 +5456,17 @@ const TableContent = ({ bodyText }) => {
|
|
|
5420
5456
|
const handleModalClose = () => {
|
|
5421
5457
|
setIsModalOpen(false);
|
|
5422
5458
|
};
|
|
5423
|
-
return (jsxs(Fragment, { children: [jsx(Modal, { className: "test-modal", onClose: handleModalClose, onPrimaryButtonClick: () => { }, onSecondaryButtonClick: handleModalClose, open: isModalOpen, size: "large", title: "", children: jsx("div", { style: { width: '100%', height: '70vh' }, children: jsx(AgGridComponent, { columns: columns, rowdata:
|
|
5459
|
+
return (jsxs(Fragment, { children: [jsx(Modal, { className: "test-modal", onClose: handleModalClose, onPrimaryButtonClick: () => { }, onSecondaryButtonClick: handleModalClose, open: isModalOpen, size: "large", title: "", children: jsx("div", { style: { width: '100%', height: '70vh' }, children: jsx(AgGridComponent, { columns: columns, rowdata: is_server_side ? undefined : rowData, pagination: true, paginationPageSize: is_server_side ? page_size : 20, suppressFieldDotNotation: true, domLayout: "normal", sizeColumnsToFitFlag: true, showSaveTableConfig: false, showSearchModalBtn: false, hideFormatSideBar: true, uniqueRowId: unique_id, selectAllHeaderComponent: select_all_component, onSelectionChanged: onSelectionChanged, hideTableSetting: hide_table_setting, downloadAsExcel: true, tableHeader: display_name, ...(is_server_side && {
|
|
5460
|
+
manualCallBack: serverSideManualCallBack,
|
|
5461
|
+
rowModelType: "serverSide",
|
|
5462
|
+
serverSideStoreType: "partial",
|
|
5463
|
+
cacheBlockSize: page_size,
|
|
5464
|
+
}) }) }) }), jsx("div", { style: { width: '100%', marginTop: '10px' }, children: jsx(AgGridComponent, { columns: columns, rowdata: is_server_side ? undefined : rowData, pagination: true, paginationPageSize: is_server_side ? page_size : 10, suppressFieldDotNotation: true, domLayout: "autoHeight", customClass: "bot_table_auto_height", sizeColumnsToFitFlag: true, showSaveTableConfig: false, showSearchModalBtn: false, hideFormatSideBar: true, uniqueRowId: unique_id, selectAllHeaderComponent: select_all_component, onSelectionChanged: onSelectionChanged, hideTableSetting: hide_table_setting, customSystemButton: getTopRightOptions(), customSystemButtonWithDownload: true, topRightOptions: null, downloadAsExcel: true, tableHeader: display_name, ...(is_server_side && {
|
|
5465
|
+
manualCallBack: serverSideManualCallBack,
|
|
5466
|
+
rowModelType: "serverSide",
|
|
5467
|
+
serverSideStoreType: "partial",
|
|
5468
|
+
cacheBlockSize: page_size,
|
|
5469
|
+
}) }) })] }));
|
|
5424
5470
|
};
|
|
5425
5471
|
|
|
5426
5472
|
const GraphContent = ({ bodyText }) => {
|
|
@@ -5730,7 +5776,7 @@ const SelectContent = ({ bodyText, isFormDisabled = false, messageIndex }) => {
|
|
|
5730
5776
|
|
|
5731
5777
|
const DatePickerContent = ({ bodyText, isFormDisabled = false, messageIndex }) => {
|
|
5732
5778
|
const formKey = `${messageIndex}_${bodyText?.paramName}`;
|
|
5733
|
-
const { displayFormat, label, isRequired, labelOrientation, placeholder, minDate, maxDate, isDisabled, } = bodyText;
|
|
5779
|
+
const { displayFormat, label, isRequired, labelOrientation, placeholder, minDate, maxDate, isDisabled, minStartDate, } = bodyText;
|
|
5734
5780
|
const chatbotContext = useSelector((state) => state.smartBotReducer.chatbotContext);
|
|
5735
5781
|
const persistedFormValues = useSelector((state) => state.smartBotReducer.persistedFormValues);
|
|
5736
5782
|
const dispatch = useDispatch();
|
|
@@ -5752,7 +5798,11 @@ const DatePickerContent = ({ bodyText, isFormDisabled = false, messageIndex }) =
|
|
|
5752
5798
|
console.error("Error in datepicker handleChange", error);
|
|
5753
5799
|
}
|
|
5754
5800
|
};
|
|
5755
|
-
return (jsx("div", { style: { width: "100%", marginTop: "10px" }, children: jsx(DatePicker, { displayFormat: displayFormat, label: label, required: isRequired, labelOrientation: labelOrientation, placeholder: placeholder,
|
|
5801
|
+
return (jsx("div", { style: { width: "100%", marginTop: "10px" }, children: jsx(DatePicker, { displayFormat: displayFormat, label: label, required: isRequired, labelOrientation: labelOrientation, placeholder: placeholder, isOutsideRange: (day) => {
|
|
5802
|
+
// Disable dates before minStartDate
|
|
5803
|
+
const minimumStartDate = moment(minStartDate, displayFormat);
|
|
5804
|
+
return day <= minimumStartDate;
|
|
5805
|
+
},
|
|
5756
5806
|
// minDate={minDate}
|
|
5757
5807
|
// maxDate={maxDate}
|
|
5758
5808
|
isDisabled: isDisabled || isFormDisabled, setSelectedDate: (date) => handleDateChange(date),
|
|
@@ -5763,7 +5813,7 @@ const DatePickerContent = ({ bodyText, isFormDisabled = false, messageIndex }) =
|
|
|
5763
5813
|
|
|
5764
5814
|
const DateRangePickerContent = ({ bodyText, isFormDisabled = false, messageIndex }) => {
|
|
5765
5815
|
const formKey = `${messageIndex}_${bodyText?.paramName}`;
|
|
5766
|
-
const { displayFormat, label, isRequired, labelOrientation, minDate, maxDate, isDisabled, showMonthYearSelect, } = bodyText;
|
|
5816
|
+
const { displayFormat, label, isRequired, labelOrientation, minDate, maxDate, isDisabled, showMonthYearSelect, minStartDate, } = bodyText;
|
|
5767
5817
|
const chatbotContext = useSelector((state) => state.smartBotReducer.chatbotContext);
|
|
5768
5818
|
const persistedFormValues = useSelector((state) => state.smartBotReducer.persistedFormValues);
|
|
5769
5819
|
const dispatch = useDispatch();
|
|
@@ -5790,7 +5840,14 @@ const DateRangePickerContent = ({ bodyText, isFormDisabled = false, messageIndex
|
|
|
5790
5840
|
console.error("Error in dateRangePicker handleDatesChange", error);
|
|
5791
5841
|
}
|
|
5792
5842
|
};
|
|
5793
|
-
return (jsx("div", { style: { width: "100%", marginTop: "10px" }, children: jsx(DateRangePicker, { displayFormat: displayFormat, label: label, isRequired: isRequired, labelOrientation: labelOrientation || "top",
|
|
5843
|
+
return (jsx("div", { style: { width: "100%", marginTop: "10px" }, children: jsx(DateRangePicker, { displayFormat: displayFormat, label: label, isRequired: isRequired, labelOrientation: labelOrientation || "top", isOutsideRange: (day) => {
|
|
5844
|
+
// Disable dates before minStartDate
|
|
5845
|
+
const minimumStartDate = moment(minStartDate, displayFormat);
|
|
5846
|
+
return day <= minimumStartDate;
|
|
5847
|
+
},
|
|
5848
|
+
// minDate={minDate}
|
|
5849
|
+
// maxDate={maxDate}
|
|
5850
|
+
isDisabled: isDisabled || isFormDisabled, startDate: startDate, setStartDate: setStartDate, endDate: endDate, setEndDate: setEndDate, showMonthYearSelect: showMonthYearSelect, handleDatesChange: handleDatesChange, onPrimaryButtonClick: () => handleDatesChange(startDate, endDate), onSecondaryButtonClick: () => {
|
|
5794
5851
|
setStartDate(null);
|
|
5795
5852
|
setEndDate(null);
|
|
5796
5853
|
}, onResetClick: () => {
|
|
@@ -6602,6 +6659,15 @@ const StreamedContent = ({ botData }) => {
|
|
|
6602
6659
|
thinkingStartTimeRef.current = Date.now();
|
|
6603
6660
|
}
|
|
6604
6661
|
const data = JSON.parse(event.data);
|
|
6662
|
+
if (data?.status === "notification") {
|
|
6663
|
+
window.dispatchEvent(new CustomEvent("agent-notification", {
|
|
6664
|
+
detail: {
|
|
6665
|
+
message: data?.message || "",
|
|
6666
|
+
chat_id: data?.chat_id || "",
|
|
6667
|
+
session_id: data?.session_id || "",
|
|
6668
|
+
},
|
|
6669
|
+
}));
|
|
6670
|
+
}
|
|
6605
6671
|
if (data?.message || data?.status === "step" || data?.status === "step_form" || data?.status === "thinking" || data?.status === "questions") {
|
|
6606
6672
|
if (data.status === "questions") {
|
|
6607
6673
|
const incomingQuestions = data.widget_data?.[0]?.questions || [];
|