impact-chatbot 2.3.31 → 2.3.32

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.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) => {
@@ -5384,7 +5396,7 @@ const TableContent = ({ bodyText }) => {
5384
5396
  if (isEmpty$1(bodyText)) {
5385
5397
  return null;
5386
5398
  }
5387
- const { table_config, row_data, display_name = "", unique_id, select_all_component, table_name, hide_table_setting = false, } = bodyText;
5399
+ 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
5400
  const [columns, setColumns] = useState([]);
5389
5401
  const [rowData, setRowData] = useState([]);
5390
5402
  const [isModalOpen, setIsModalOpen] = useState(false);
@@ -5398,10 +5410,27 @@ const TableContent = ({ bodyText }) => {
5398
5410
  }
5399
5411
  }, [table_config]);
5400
5412
  useEffect(() => {
5401
- if (isEmpty$1(rowData)) {
5413
+ if (!is_server_side && isEmpty$1(rowData)) {
5402
5414
  setRowData(row_data);
5403
5415
  }
5404
5416
  }, [row_data]);
5417
+ const serverSideManualCallBack = async (manualbody, pageIndex, params) => {
5418
+ try {
5419
+ const baseUrl = localStorage.getItem("stepForm_baseUrl") || "";
5420
+ const response = await getTableRecords(baseUrl, table_name, pageIndex + 1, page_size);
5421
+ return {
5422
+ data: response?.data?.data || [],
5423
+ totalCount: response?.data?.total_count || 0,
5424
+ };
5425
+ }
5426
+ catch (error) {
5427
+ console.error("Error in serverSideManualCallBack", error);
5428
+ return {
5429
+ data: [],
5430
+ totalCount: 0,
5431
+ };
5432
+ }
5433
+ };
5405
5434
  const onSelectionChanged = (event) => {
5406
5435
  try {
5407
5436
  const selectedList = event.api.getSelectedRows();
@@ -5420,7 +5449,17 @@ const TableContent = ({ bodyText }) => {
5420
5449
  const handleModalClose = () => {
5421
5450
  setIsModalOpen(false);
5422
5451
  };
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: rowData, pagination: true, paginationPageSize: 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 }) }) }), jsx("div", { style: { width: '100%', marginTop: '10px' }, children: jsx(AgGridComponent, { columns: columns, rowdata: rowData, pagination: true, paginationPageSize: 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 }) })] }));
5452
+ 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 && {
5453
+ manualCallBack: serverSideManualCallBack,
5454
+ rowModelType: "serverSide",
5455
+ serverSideStoreType: "partial",
5456
+ cacheBlockSize: page_size,
5457
+ }) }) }) }), 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 && {
5458
+ manualCallBack: serverSideManualCallBack,
5459
+ rowModelType: "serverSide",
5460
+ serverSideStoreType: "partial",
5461
+ cacheBlockSize: page_size,
5462
+ }) }) })] }));
5424
5463
  };
5425
5464
 
5426
5465
  const GraphContent = ({ bodyText }) => {
@@ -5730,7 +5769,7 @@ const SelectContent = ({ bodyText, isFormDisabled = false, messageIndex }) => {
5730
5769
 
5731
5770
  const DatePickerContent = ({ bodyText, isFormDisabled = false, messageIndex }) => {
5732
5771
  const formKey = `${messageIndex}_${bodyText?.paramName}`;
5733
- const { displayFormat, label, isRequired, labelOrientation, placeholder, minDate, maxDate, isDisabled, } = bodyText;
5772
+ const { displayFormat, label, isRequired, labelOrientation, placeholder, minDate, maxDate, isDisabled, minStartDate, } = bodyText;
5734
5773
  const chatbotContext = useSelector((state) => state.smartBotReducer.chatbotContext);
5735
5774
  const persistedFormValues = useSelector((state) => state.smartBotReducer.persistedFormValues);
5736
5775
  const dispatch = useDispatch();
@@ -5752,7 +5791,11 @@ const DatePickerContent = ({ bodyText, isFormDisabled = false, messageIndex }) =
5752
5791
  console.error("Error in datepicker handleChange", error);
5753
5792
  }
5754
5793
  };
5755
- return (jsx("div", { style: { width: "100%", marginTop: "10px" }, children: jsx(DatePicker, { displayFormat: displayFormat, label: label, required: isRequired, labelOrientation: labelOrientation, placeholder: placeholder,
5794
+ return (jsx("div", { style: { width: "100%", marginTop: "10px" }, children: jsx(DatePicker, { displayFormat: displayFormat, label: label, required: isRequired, labelOrientation: labelOrientation, placeholder: placeholder, isOutsideRange: (day) => {
5795
+ // Disable dates before minStartDate
5796
+ const minimumStartDate = moment(minStartDate, displayFormat);
5797
+ return day <= minimumStartDate;
5798
+ },
5756
5799
  // minDate={minDate}
5757
5800
  // maxDate={maxDate}
5758
5801
  isDisabled: isDisabled || isFormDisabled, setSelectedDate: (date) => handleDateChange(date),
@@ -5763,7 +5806,7 @@ const DatePickerContent = ({ bodyText, isFormDisabled = false, messageIndex }) =
5763
5806
 
5764
5807
  const DateRangePickerContent = ({ bodyText, isFormDisabled = false, messageIndex }) => {
5765
5808
  const formKey = `${messageIndex}_${bodyText?.paramName}`;
5766
- const { displayFormat, label, isRequired, labelOrientation, minDate, maxDate, isDisabled, showMonthYearSelect, } = bodyText;
5809
+ const { displayFormat, label, isRequired, labelOrientation, minDate, maxDate, isDisabled, showMonthYearSelect, minStartDate, } = bodyText;
5767
5810
  const chatbotContext = useSelector((state) => state.smartBotReducer.chatbotContext);
5768
5811
  const persistedFormValues = useSelector((state) => state.smartBotReducer.persistedFormValues);
5769
5812
  const dispatch = useDispatch();
@@ -5790,7 +5833,14 @@ const DateRangePickerContent = ({ bodyText, isFormDisabled = false, messageIndex
5790
5833
  console.error("Error in dateRangePicker handleDatesChange", error);
5791
5834
  }
5792
5835
  };
5793
- return (jsx("div", { style: { width: "100%", marginTop: "10px" }, children: jsx(DateRangePicker, { displayFormat: displayFormat, label: label, isRequired: isRequired, labelOrientation: labelOrientation || "top", minDate: minDate, maxDate: maxDate, isDisabled: isDisabled || isFormDisabled, startDate: startDate, setStartDate: setStartDate, endDate: endDate, setEndDate: setEndDate, showMonthYearSelect: showMonthYearSelect, handleDatesChange: handleDatesChange, onPrimaryButtonClick: () => handleDatesChange(startDate, endDate), onSecondaryButtonClick: () => {
5836
+ return (jsx("div", { style: { width: "100%", marginTop: "10px" }, children: jsx(DateRangePicker, { displayFormat: displayFormat, label: label, isRequired: isRequired, labelOrientation: labelOrientation || "top", isOutsideRange: (day) => {
5837
+ // Disable dates before minStartDate
5838
+ const minimumStartDate = moment(minStartDate, displayFormat);
5839
+ return day <= minimumStartDate;
5840
+ },
5841
+ // minDate={minDate}
5842
+ // maxDate={maxDate}
5843
+ isDisabled: isDisabled || isFormDisabled, startDate: startDate, setStartDate: setStartDate, endDate: endDate, setEndDate: setEndDate, showMonthYearSelect: showMonthYearSelect, handleDatesChange: handleDatesChange, onPrimaryButtonClick: () => handleDatesChange(startDate, endDate), onSecondaryButtonClick: () => {
5794
5844
  setStartDate(null);
5795
5845
  setEndDate(null);
5796
5846
  }, onResetClick: () => {