impact-ui 3.7.25 → 4.0.0-alpha.10
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/MIGRATION_GUIDE.md +328 -0
- package/README.md +154 -15
- package/bin/migrate-image-paths.cjs +127 -0
- package/bin/migrate.js +293 -0
- package/codemods/component-map.js +153 -0
- package/codemods/image-paths-transform.js +69 -0
- package/codemods/transform.js +136 -0
- package/dist/components/Accordion/index.js +2 -1
- package/dist/components/AccordionModern/index.js +2 -1
- package/dist/components/Alert/index.js +2 -1
- package/dist/components/Avatar/index.js +2 -1
- package/dist/components/Badge/filled/filledIconLabelBadges/index.js +2 -1
- package/dist/components/Badge/filled/filledOnlyIconBadges/index.js +2 -1
- package/dist/components/Badge/filled/filledOnlyLabelBadges/index.js +2 -1
- package/dist/components/Badge/index.js +3 -2
- package/dist/components/Badge/stroke/strokeIconLabelBadges/index.js +2 -1
- package/dist/components/Badge/stroke/strokeOnlyIconBadges/index.js +2 -1
- package/dist/components/Badge/stroke/strokeOnlyLabelBadges/index.js +2 -1
- package/dist/components/Badge/subtle/subtleIOnlyIconBadges/index.js +2 -1
- package/dist/components/Badge/subtle/subtleIconLabelBadges/index.js +2 -1
- package/dist/components/Badge/subtle/subtleOnlyLabelBadges/index.js +2 -1
- package/dist/components/BottomSheet/index.js +2 -1
- package/dist/components/Breadcrumbs/index.js +2 -1
- package/dist/components/Button/index.js +2 -1
- package/dist/components/ButtonGroup/index.js +2 -1
- package/dist/components/Card/index.js +2 -1
- package/dist/components/Chart/index.js +2 -1
- package/dist/components/Chatbot/index.js +2 -1
- package/dist/components/Checkbox/index.js +2 -1
- package/dist/components/Chips/index.js +2 -1
- package/dist/components/CreateItemFlow/index.js +2 -1
- package/dist/components/DatePicker/datePickerDropdown.js +2 -1
- package/dist/components/DatePicker/index.js +3 -2
- package/dist/components/DateRangePicker/dateRangePickerDropdown.js +2 -1
- package/dist/components/DateRangePicker/index.js +3 -2
- package/dist/components/DynamicLayout/index.js +2 -1
- package/dist/components/EmptyState/EmptyStateImage.d.ts.map +1 -1
- package/dist/components/EmptyState/EmptyStateImage.js +3 -2
- package/dist/components/EmptyState/index.js +2 -1
- package/dist/components/FileUpload/index.js +2 -1
- package/dist/components/FilterPanel/index.js +2 -1
- package/dist/components/FiltersStrip/index.js +2 -1
- package/dist/components/Header/index.js +2 -1
- package/dist/components/HomePage/index.js +2 -1
- package/dist/components/Input/index.js +2 -1
- package/dist/components/Loader/index.js +2 -1
- package/dist/components/Menu/IconMenuItem.js +2 -1
- package/dist/components/Menu/MenuHeaderInfo.js +2 -1
- package/dist/components/Menu/NestedMenuItem.js +2 -1
- package/dist/components/Menu/index.js +2 -1
- package/dist/components/Menu/nestedMenuItemsFromObject.js +2 -1
- package/dist/components/Modal/index.js +2 -1
- package/dist/components/Notification/NotificationBody/NotificationList/NotificationList.js +2 -1
- package/dist/components/Notification/index.js +2 -1
- package/dist/components/Panel/index.js +2 -1
- package/dist/components/Popover/index.js +2 -1
- package/dist/components/ProgressBar/index.js +2 -1
- package/dist/components/Prompt/index.js +2 -1
- package/dist/components/RadioButtonGroup/index.js +2 -1
- package/dist/components/Select/index.js +2 -1
- package/dist/components/Sidebar/index.js +2 -1
- package/dist/components/Slider/index.js +2 -1
- package/dist/components/Stepper/index.js +2 -1
- package/dist/components/Switch/index.js +2 -1
- package/dist/components/Table/TableImpl.js +4 -3
- package/dist/components/TableChat/EmptyContainer.js +2 -1
- package/dist/components/TableChat/TableChatSidePanel.js +2 -1
- package/dist/components/TableChat/components/ChatMessageSkeleton/ChatFooterSkeleton.js +2 -1
- package/dist/components/TableChat/components/ChatMessageSkeleton/ChatHeaderSkeleton.js +2 -1
- package/dist/components/TableChat/components/ChatMessageSkeleton/ChatMessageListSkeleton.js +2 -1
- package/dist/components/TableChat/components/ChatMessageSkeleton/ChatSkeleton.js +2 -1
- package/dist/components/TableChat/components/TableChatLeftSection/AddChatContainer/AddChatContainer.js +2 -1
- package/dist/components/TableChat/components/TableChatLeftSection/TableChatChannelHeader.js +2 -1
- package/dist/components/TableChat/components/TableChatRightSection/AvatarGroup/AvatarGroup.js +2 -1
- package/dist/components/TableChat/components/TableChatRightSection/ChatDefaultMessageType/ChatDefaultMessageType.js +2 -1
- package/dist/components/TableChat/components/TableChatRightSection/ChatDeleteMessageType/ChatDeletedMessageType.js +2 -1
- package/dist/components/TableChat/components/TableChatRightSection/ChatHeader/ChatHeader.js +2 -1
- package/dist/components/TableChat/components/TableChatRightSection/ChatInput/ChatInput.js +2 -1
- package/dist/components/TableChat/components/TableChatRightSection/ChatMessageAvatar/ChatMessageAvatar.js +2 -1
- package/dist/components/TableChat/components/TableChatRightSection/ChatMessages/ChatMessage.js +2 -1
- package/dist/components/TableChat/components/TableChatRightSection/ChatNotificationSettings/ChatNotificationSettings.js +2 -1
- package/dist/components/TableChat/components/TableChatRightSection/DateSeparator/DateSeparator.js +2 -1
- package/dist/components/TableChat/components/TableChatRightSection/PinedChatPanel/PinedChatPanel.js +2 -1
- package/dist/components/TableChat/components/TableChatRightSection/TableChatRightSection.js +2 -1
- package/dist/components/TableChat/components/TextEditor/EditorToolbar.js +2 -1
- package/dist/components/TableChat/components/TextEditor/Mention.js +2 -1
- package/dist/components/TableChat/components/TextEditor/MentionList.js +2 -1
- package/dist/components/Tabs/index.js +2 -1
- package/dist/components/Tag/index.js +2 -1
- package/dist/components/TagGroup/index.js +2 -1
- package/dist/components/TextArea/index.js +2 -1
- package/dist/components/Toast/index.js +2 -1
- package/dist/components/Tooltip/index.js +2 -1
- package/dist/components/common/HelperText/index.js +2 -1
- package/dist/components/index.d.ts +0 -1
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +0 -1
- package/dist/mcp-component-registry.json +1 -1
- package/dist/styles/entry.d.ts +2 -0
- package/dist/styles/entry.d.ts.map +1 -0
- package/dist/styles/entry.js +1 -0
- package/dist/styles/style.css +1 -1
- package/eslint-plugin/index.js +91 -0
- package/eslint-plugin/rules/no-barrel-import.js +224 -0
- package/package.json +153 -89
- package/dist/0db32db10ae1525f.svg +0 -9
- package/dist/2bc76319b1fa572e.svg +0 -9
- package/dist/39d49e4daed1a992.svg +0 -9
- package/dist/44beedf64dc29d19.svg +0 -9
- package/dist/49a4f914058314f1.svg +0 -9
- package/dist/6fc8a59d621a04a1.svg +0 -13
- package/dist/78f845dcfc981491.svg +0 -9
- package/dist/b31c0c2a19c1c19a.svg +0 -9
- package/dist/index.js +0 -308
- package/dist/index.js.map +0 -1
- package/src/components/Accordion/Accordion.styles.scss +0 -118
- package/src/components/Accordion/index.js +0 -104
- package/src/components/AccordionModern/AccordionModern.styles.scss +0 -121
- package/src/components/AccordionModern/SortableAccordionComp.js +0 -156
- package/src/components/AccordionModern/index.js +0 -103
- package/src/components/Alert/Alert.styles.scss +0 -131
- package/src/components/Alert/index.js +0 -71
- package/src/components/Avatar/Avatar.styles.scss +0 -25
- package/src/components/Avatar/index.js +0 -58
- package/src/components/Badge/Badges.style.scss +0 -55
- package/src/components/Badge/filled/filledIconLabelBadges/filledIconLabelBadges.styles.scss +0 -32
- package/src/components/Badge/filled/filledIconLabelBadges/index.js +0 -38
- package/src/components/Badge/filled/filledOnlyIconBadges/filledOnlyIconBadges.styles.scss +0 -26
- package/src/components/Badge/filled/filledOnlyIconBadges/index.js +0 -31
- package/src/components/Badge/filled/filledOnlyLabelBadges/filledOnlyLabelBadges.styles.scss +0 -66
- package/src/components/Badge/filled/filledOnlyLabelBadges/index.js +0 -31
- package/src/components/Badge/filled/index.js +0 -30
- package/src/components/Badge/index.js +0 -53
- package/src/components/Badge/stroke/index.js +0 -43
- package/src/components/Badge/stroke/strokeIconLabelBadges/index.js +0 -38
- package/src/components/Badge/stroke/strokeIconLabelBadges/strokeIconLabelBadges.styles.scss +0 -33
- package/src/components/Badge/stroke/strokeOnlyIconBadges/index.js +0 -31
- package/src/components/Badge/stroke/strokeOnlyIconBadges/strokeOnlyIconBadges.styles.scss +0 -27
- package/src/components/Badge/stroke/strokeOnlyLabelBadges/index.js +0 -31
- package/src/components/Badge/stroke/strokeOnlyLabelBadges/strokeOnlyLabelBadges.styles.scss +0 -89
- package/src/components/Badge/styles.css +0 -52
- package/src/components/Badge/subtle/index.js +0 -41
- package/src/components/Badge/subtle/subtleIOnlyIconBadges/index.js +0 -31
- package/src/components/Badge/subtle/subtleIOnlyIconBadges/subtleIOnlyIconBadges.scss +0 -26
- package/src/components/Badge/subtle/subtleIconLabelBadges/index.js +0 -38
- package/src/components/Badge/subtle/subtleIconLabelBadges/subtleIconLabelBadges.scss +0 -56
- package/src/components/Badge/subtle/subtleOnlyLabelBadges/index.js +0 -31
- package/src/components/Badge/subtle/subtleOnlyLabelBadges/subtleOnlyLabelBadges.scss +0 -70
- package/src/components/BottomSheet/BottomSheet.styles.scss +0 -46
- package/src/components/BottomSheet/index.js +0 -60
- package/src/components/Breadcrumbs/Breadcrumbs.styles.scss +0 -65
- package/src/components/Breadcrumbs/index.js +0 -121
- package/src/components/Button/Button.styles.scss +0 -345
- package/src/components/Button/index.js +0 -171
- package/src/components/ButtonGroup/ButtonGroup.styles.scss +0 -125
- package/src/components/ButtonGroup/index.js +0 -84
- package/src/components/Card/Card.styles.scss +0 -33
- package/src/components/Card/index.js +0 -21
- package/src/components/Chart/Chart.style.scss +0 -142
- package/src/components/Chart/index.js +0 -752
- package/src/components/ChatBot/bookMarkPanel.js +0 -74
- package/src/components/ChatBot/chatBot.style.scss +0 -1295
- package/src/components/ChatBot/chatBotFooter.js +0 -14
- package/src/components/ChatBot/chatBotLandingScreen.js +0 -26
- package/src/components/ChatBot/chatInput.js +0 -206
- package/src/components/ChatBot/chatbotModuleMenu.js +0 -278
- package/src/components/ChatBot/constant.js +0 -32
- package/src/components/ChatBot/conversationScreen.js +0 -281
- package/src/components/ChatBot/customScreen.js +0 -69
- package/src/components/ChatBot/historyPanel.js +0 -579
- package/src/components/ChatBot/index.js +0 -473
- package/src/components/ChatBot/newChatComponent.js +0 -105
- package/src/components/ChatBot/utils.js +0 -27
- package/src/components/Checkbox/Checkbox.styles.scss +0 -232
- package/src/components/Checkbox/dashed/index.js +0 -34
- package/src/components/Checkbox/default/index.js +0 -70
- package/src/components/Checkbox/index.js +0 -50
- package/src/components/Checkbox/withDropDown/index.js +0 -96
- package/src/components/Checkbox/withoutFormLabel/index.js +0 -46
- package/src/components/Chips/Chip.style.scss +0 -134
- package/src/components/Chips/index.js +0 -34
- package/src/components/CreateItemFlow/CreateItemFlow.styles.scss +0 -37
- package/src/components/CreateItemFlow/index.js +0 -145
- package/src/components/DatePicker/DatePicker.styles.scss +0 -519
- package/src/components/DatePicker/datePickerDropdown.js +0 -282
- package/src/components/DatePicker/datePickerFooter.js +0 -76
- package/src/components/DatePicker/datePickerInput.js +0 -333
- package/src/components/DatePicker/index.js +0 -288
- package/src/components/DatePicker/showMonthYearSelect.js +0 -119
- package/src/components/DateRangePicker/DateRangePicker.styles.scss +0 -635
- package/src/components/DateRangePicker/dateRangePickerCustom.js +0 -22
- package/src/components/DateRangePicker/dateRangePickerDropdown.js +0 -320
- package/src/components/DateRangePicker/dateRangePickerFooter.js +0 -50
- package/src/components/DateRangePicker/dateRangePickerInput.js +0 -544
- package/src/components/DateRangePicker/index.js +0 -393
- package/src/components/DateRangePicker/showMonthYearSelect.js +0 -103
- package/src/components/DateRangePicker/utils.js +0 -71
- package/src/components/DynamicLayout/DynamicLayout.styles.scss +0 -153
- package/src/components/DynamicLayout/index.js +0 -73
- package/src/components/EmptyState/EmptyState.styles.scss +0 -88
- package/src/components/EmptyState/EmptyStateImageComponent.jsx +0 -36
- package/src/components/EmptyState/index.js +0 -54
- package/src/components/FileUpload/FileUpload.styles.scss +0 -449
- package/src/components/FileUpload/index.js +0 -641
- package/src/components/FilterPanel/FilterPanel.styles.scss +0 -241
- package/src/components/FilterPanel/FilterPanelHeader.js +0 -15
- package/src/components/FilterPanel/PanelFooter.js +0 -65
- package/src/components/FilterPanel/PanelSidebar.js +0 -85
- package/src/components/FilterPanel/index.js +0 -147
- package/src/components/FiltersStrip/FiltersStrip.styles.scss +0 -343
- package/src/components/FiltersStrip/Slider/FilterSlider.styles.scss +0 -85
- package/src/components/FiltersStrip/Slider/Portal.js +0 -59
- package/src/components/FiltersStrip/Slider/index.js +0 -233
- package/src/components/FiltersStrip/appliedFilter.js +0 -180
- package/src/components/FiltersStrip/filterDropDown.js +0 -96
- package/src/components/FiltersStrip/index.js +0 -127
- package/src/components/FiltersStrip/mockData.js +0 -227
- package/src/components/Header/Header.styles.scss +0 -223
- package/src/components/Header/index.js +0 -156
- package/src/components/HomePage/HomePage.styles.scss +0 -1638
- package/src/components/HomePage/constant.js +0 -331
- package/src/components/HomePage/index.js +0 -675
- package/src/components/Input/Input.styles.scss +0 -318
- package/src/components/Input/helperText.js +0 -19
- package/src/components/Input/index.js +0 -60
- package/src/components/Input/inputWithIcon.js +0 -134
- package/src/components/Input/vanilaInput.js +0 -68
- package/src/components/Loader/Loader.styles.scss +0 -90
- package/src/components/Loader/index.js +0 -69
- package/src/components/Menu/IconMenuItem.js +0 -100
- package/src/components/Menu/Menu.styles.scss +0 -190
- package/src/components/Menu/MenuHeader.jsx +0 -84
- package/src/components/Menu/MenuHeaderInfo.jsx +0 -319
- package/src/components/Menu/MenuHeaderInfo.styles.scss +0 -123
- package/src/components/Menu/NestedMenuItem.js +0 -189
- package/src/components/Menu/index.js +0 -254
- package/src/components/Menu/nestedMenuItemsFromObject.js +0 -100
- package/src/components/Modal/Modal.styles.scss +0 -129
- package/src/components/Modal/index.js +0 -141
- package/src/components/MonthPicker/MonthPicker.styles.scss +0 -255
- package/src/components/MonthPicker/constant.js +0 -1
- package/src/components/MonthPicker/index.js +0 -373
- package/src/components/MonthRangePicker/MonthRangePicker.styles.scss +0 -383
- package/src/components/MonthRangePicker/constant.js +0 -1
- package/src/components/MonthRangePicker/index.js +0 -574
- package/src/components/Notification/Notification.styles.scss +0 -594
- package/src/components/Notification/NotificationBody/NotificationInfoList/chipsLists.js +0 -144
- package/src/components/Notification/NotificationBody/NotificationInfoList/index.js +0 -128
- package/src/components/Notification/NotificationBody/NotificationInfoList/notificationList.js +0 -165
- package/src/components/Notification/NotificationBody/NotificationPanels/chipsLists.js +0 -85
- package/src/components/Notification/NotificationBody/NotificationPanels/index.js +0 -259
- package/src/components/Notification/NotificationBody/NotificationPanels/notificationList.js +0 -637
- package/src/components/Notification/NotificationBody/index.js +0 -117
- package/src/components/Notification/index.js +0 -128
- package/src/components/Notification/mockData.js +0 -389
- package/src/components/Notification/notificationFooter.js +0 -31
- package/src/components/Notification/notificationHeader.js +0 -28
- package/src/components/Panel/Panel.styles.scss +0 -71
- package/src/components/Panel/index.js +0 -144
- package/src/components/Popover/Popover.styles.scss +0 -52
- package/src/components/Popover/index.js +0 -71
- package/src/components/Portal/index.js +0 -31
- package/src/components/ProgressBar/ProgressBar.styles.scss +0 -62
- package/src/components/ProgressBar/index.js +0 -40
- package/src/components/Prompt/Prompt.styles.scss +0 -107
- package/src/components/Prompt/index.js +0 -107
- package/src/components/RadioButtonGroup/RadioButtonGroup.styles.scss +0 -136
- package/src/components/RadioButtonGroup/index.js +0 -107
- package/src/components/Select/SearchFilter.js +0 -72
- package/src/components/Select/Select.styles.scss +0 -748
- package/src/components/Select/customGroupHeading.js +0 -24
- package/src/components/Select/dropdown.js +0 -65
- package/src/components/Select/hooks/index.js +0 -2
- package/src/components/Select/hooks/useClickOutside.js +0 -61
- package/src/components/Select/hooks/useMenuPosition.js +0 -288
- package/src/components/Select/index.js +0 -1307
- package/src/components/Select/menuList.js +0 -119
- package/src/components/Select/optionList.js +0 -215
- package/src/components/Select/selected-option-tags.js +0 -99
- package/src/components/Select/utils.js +0 -232
- package/src/components/Sidebar/Menus/childMenu.js +0 -88
- package/src/components/Sidebar/Menus/index.js +0 -130
- package/src/components/Sidebar/Menus/parentMenu.js +0 -173
- package/src/components/Sidebar/Sidebar.styles.scss +0 -411
- package/src/components/Sidebar/actions.js +0 -31
- package/src/components/Sidebar/index.js +0 -84
- package/src/components/Sidebar/mock.js +0 -202
- package/src/components/Slider/Sliders.styles.scss +0 -260
- package/src/components/Slider/index.js +0 -314
- package/src/components/Stepper/Stepper.styles.scss +0 -355
- package/src/components/Stepper/index.js +0 -101
- package/src/components/Switch/Switch.styles.scss +0 -96
- package/src/components/Switch/index.js +0 -59
- package/src/components/Table/AdvanceSearchModalItem.js +0 -392
- package/src/components/Table/AdvanceSortModal.js +0 -332
- package/src/components/Table/AgGridHeader.js +0 -1009
- package/src/components/Table/CommentsPortal.js +0 -428
- package/src/components/Table/NewAdvanceSearchModal/NewAdvanceSearchModal.js +0 -323
- package/src/components/Table/NewAdvanceSearchModal/NewAdvanceSearchModalItem.js +0 -476
- package/src/components/Table/NoComments.js +0 -295
- package/src/components/Table/Table.styles.scss +0 -3859
- package/src/components/Table/actionBar.js +0 -43
- package/src/components/Table/advanceSearchModal.js +0 -797
- package/src/components/Table/commentPanel.js +0 -421
- package/src/components/Table/filterUtils.js +0 -850
- package/src/components/Table/index.js +0 -2175
- package/src/components/Table/mockData.js +0 -1344
- package/src/components/Table/tableFunctions.js +0 -1676
- package/src/components/Table/tableHeader.js +0 -476
- package/src/components/Table/tableIcons.js +0 -61
- package/src/components/Table/tableMoreOptions.js +0 -293
- package/src/components/Table/tablePagination.js +0 -63
- package/src/components/Table/tableSettings.js +0 -287
- package/src/components/Table/withCommentIcon.js +0 -107
- package/src/components/TableChat/EmptyContainer.jsx +0 -13
- package/src/components/TableChat/README.md +0 -588
- package/src/components/TableChat/TableChatSidePanel.jsx +0 -832
- package/src/components/TableChat/TableChatSidePanel.styles.scss +0 -57
- package/src/components/TableChat/components/ChatMessageSkeleton/ChatFooterSkeleton.jsx +0 -43
- package/src/components/TableChat/components/ChatMessageSkeleton/ChatHeaderSkeleton.jsx +0 -55
- package/src/components/TableChat/components/ChatMessageSkeleton/ChatMessageListSkeleton.jsx +0 -94
- package/src/components/TableChat/components/ChatMessageSkeleton/ChatSkeleton.jsx +0 -22
- package/src/components/TableChat/components/ChatMessageSkeleton/ChatSkeleton.scss +0 -179
- package/src/components/TableChat/components/SkeletonList.jsx +0 -12
- package/src/components/TableChat/components/TableChatLeftSection/AddChatContainer/AddChatContainer.jsx +0 -171
- package/src/components/TableChat/components/TableChatLeftSection/AddChatContainer/AddChatContainer.styles.scss +0 -37
- package/src/components/TableChat/components/TableChatLeftSection/ChannelCheckbox/ChannelCheckbox.jsx +0 -28
- package/src/components/TableChat/components/TableChatLeftSection/ChatChannelItem.jsx +0 -116
- package/src/components/TableChat/components/TableChatLeftSection/ChatChannelList.jsx +0 -89
- package/src/components/TableChat/components/TableChatLeftSection/ChatHeaderButton/ChatHeaderButton.jsx +0 -27
- package/src/components/TableChat/components/TableChatLeftSection/ChatHeaderNavigation.jsx +0 -191
- package/src/components/TableChat/components/TableChatLeftSection/ChatIconButton/ChatIconButton.jsx +0 -23
- package/src/components/TableChat/components/TableChatLeftSection/TableChatChannelHeader.jsx +0 -117
- package/src/components/TableChat/components/TableChatLeftSection/TableChatChannelHeader.styles.scss +0 -469
- package/src/components/TableChat/components/TableChatLeftSection/UnreadBadge/UnreadBadge.jsx +0 -16
- package/src/components/TableChat/components/TableChatRightSection/AvatarGroup/AvatarGroup.jsx +0 -119
- package/src/components/TableChat/components/TableChatRightSection/AvatarGroup/AvatarGroup.styles.scss +0 -87
- package/src/components/TableChat/components/TableChatRightSection/ChatDefaultMessageType/ChatDefaultMessageType.jsx +0 -216
- package/src/components/TableChat/components/TableChatRightSection/ChatDefaultMessageType/ChatDefaultMessageType.styles.scss +0 -291
- package/src/components/TableChat/components/TableChatRightSection/ChatDeleteMessageType/ChatDeletedMessageType.jsx +0 -19
- package/src/components/TableChat/components/TableChatRightSection/ChatDeleteMessageType/DeletedMessage.styles.scss +0 -55
- package/src/components/TableChat/components/TableChatRightSection/ChatEditedMessageType/ChatEditedMessageType.jsx +0 -61
- package/src/components/TableChat/components/TableChatRightSection/ChatEditedMessageType/ChatEditedMessageType.styles.scss +0 -13
- package/src/components/TableChat/components/TableChatRightSection/ChatHeader/ChatHeader.jsx +0 -432
- package/src/components/TableChat/components/TableChatRightSection/ChatHeader/ChatHeaderAction.jsx +0 -365
- package/src/components/TableChat/components/TableChatRightSection/ChatHeader/ChatHeaderInfo.jsx +0 -42
- package/src/components/TableChat/components/TableChatRightSection/ChatHeader/chatHeader.styles.scss +0 -323
- package/src/components/TableChat/components/TableChatRightSection/ChatInput/ChatInput.jsx +0 -793
- package/src/components/TableChat/components/TableChatRightSection/ChatInput/ChatInput.styles.scss +0 -394
- package/src/components/TableChat/components/TableChatRightSection/ChatMessageActions/ChatMessageActions.jsx +0 -61
- package/src/components/TableChat/components/TableChatRightSection/ChatMessageActions/ChatMessageActions.styles.scss +0 -28
- package/src/components/TableChat/components/TableChatRightSection/ChatMessageAvatar/ChatMessageAvatar.jsx +0 -11
- package/src/components/TableChat/components/TableChatRightSection/ChatMessageAvatar/ChatMessageAvatar.styles.scss +0 -3
- package/src/components/TableChat/components/TableChatRightSection/ChatMessages/ChatMessage.jsx +0 -220
- package/src/components/TableChat/components/TableChatRightSection/ChatMessages/ChatMessage.styles.scss +0 -128
- package/src/components/TableChat/components/TableChatRightSection/ChatNotificationSettings/ChatNotificationSettings.jsx +0 -246
- package/src/components/TableChat/components/TableChatRightSection/ChatNotificationSettings/ChatNotificationSettings.styles.scss +0 -210
- package/src/components/TableChat/components/TableChatRightSection/DateSeparator/DateSeparator.jsx +0 -52
- package/src/components/TableChat/components/TableChatRightSection/DateSeparator/DateSeparator.styles.scss +0 -34
- package/src/components/TableChat/components/TableChatRightSection/EmojiPicker/EmojiPicker.jsx +0 -31
- package/src/components/TableChat/components/TableChatRightSection/FileUploader/FileUploader.jsx +0 -170
- package/src/components/TableChat/components/TableChatRightSection/ImageUploader/ImageUploader.jsx +0 -165
- package/src/components/TableChat/components/TableChatRightSection/PinedChatPanel/PinedChat.styles.scss +0 -587
- package/src/components/TableChat/components/TableChatRightSection/PinedChatPanel/PinedChatPanel.jsx +0 -244
- package/src/components/TableChat/components/TableChatRightSection/ReplyBadge/ReplyBadge.jsx +0 -29
- package/src/components/TableChat/components/TableChatRightSection/ReplyBadge/ReplyBadge.styles.scss +0 -47
- package/src/components/TableChat/components/TableChatRightSection/TableChatRightSection.jsx +0 -1340
- package/src/components/TableChat/components/TableChatRightSection/TableChatRightSection.styles.scss +0 -147
- package/src/components/TableChat/components/TextEditor/EditorToolbar.jsx +0 -209
- package/src/components/TableChat/components/TextEditor/EditorToolbar.styles.scss +0 -61
- package/src/components/TableChat/components/TextEditor/Mention.jsx +0 -234
- package/src/components/TableChat/components/TextEditor/MentionList.jsx +0 -118
- package/src/components/TableChat/components/TextEditor/MentionList.scss +0 -146
- package/src/components/TableChat/components/TextEditor/styles.scss +0 -278
- package/src/components/TableChat/components/TextEditor/suggestion.js +0 -124
- package/src/components/TableChat/components/chatConfig.js +0 -64
- package/src/components/TableChat/hooks/useInfiniteScroll.js +0 -256
- package/src/components/TableOld/AgGridHeader.js +0 -545
- package/src/components/TableOld/Table.styles.scss +0 -2192
- package/src/components/TableOld/actionBar.js +0 -43
- package/src/components/TableOld/index.js +0 -598
- package/src/components/TableOld/mockData.js +0 -1344
- package/src/components/TableOld/tableFunctions.js +0 -1734
- package/src/components/TableOld/tableHeader.js +0 -251
- package/src/components/TableOld/tableIcons.js +0 -61
- package/src/components/TableOld/tablePagination.js +0 -64
- package/src/components/TableOld/tableSettings.js +0 -166
- package/src/components/Tabs/Tabs.styles.scss +0 -120
- package/src/components/Tabs/index.js +0 -91
- package/src/components/Tabs/tabPanel.js +0 -38
- package/src/components/Tag/Tags.styles.scss +0 -71
- package/src/components/Tag/filled.js +0 -48
- package/src/components/Tag/index.js +0 -54
- package/src/components/Tag/solid.js +0 -47
- package/src/components/Tag/stroke.js +0 -47
- package/src/components/Tag/utils.js +0 -12
- package/src/components/TagGroup/TagGroup.styles.scss +0 -7
- package/src/components/TagGroup/index.js +0 -6
- package/src/components/TextArea/TextArea.styles.scss +0 -158
- package/src/components/TextArea/index.js +0 -121
- package/src/components/Toast/Toast.styles.scss +0 -66
- package/src/components/Toast/index.js +0 -35
- package/src/components/Tooltip/Tooltips.styles.scss +0 -111
- package/src/components/Tooltip/index.js +0 -68
- package/src/components/common/HelperText/HelperText.styles.scss +0 -18
- package/src/components/common/HelperText/index.js +0 -44
- package/src/components/common/MentionEditor/MentionEditor.styles.scss +0 -301
- package/src/components/common/MentionEditor/MentionList/MentionList.styles.scss +0 -146
- package/src/components/common/MentionEditor/MentionList/index.js +0 -130
- package/src/components/common/MentionEditor/index.js +0 -246
- package/src/components/common/MentionEditor/suggestion.js +0 -124
- package/src/components/index.js +0 -53
- package/src/stories/Accordion.stories.js +0 -151
- package/src/stories/AccordionModern.stories.js +0 -263
- package/src/stories/Alert.stories.js +0 -103
- package/src/stories/Avatar.stories.js +0 -79
- package/src/stories/Badge.stories.js +0 -112
- package/src/stories/BottomSheet.stories.js +0 -224
- package/src/stories/Breadcrumbs.stories.js +0 -143
- package/src/stories/Button.stories.js +0 -190
- package/src/stories/ButtonGroup.stories.js +0 -123
- package/src/stories/Card.stories.js +0 -73
- package/src/stories/Changelog.mdx +0 -1006
- package/src/stories/Chart.stories.js +0 -2017
- package/src/stories/ChatBot.stories.js +0 -668
- package/src/stories/Checkbox.stories.js +0 -209
- package/src/stories/Chips.stories.js +0 -106
- package/src/stories/CreateItemFlow.stories.js +0 -255
- package/src/stories/DatePicker.stories.js +0 -311
- package/src/stories/DateRangePicker.stories.js +0 -364
- package/src/stories/EmptyState.stories.js +0 -110
- package/src/stories/FileUpload.stories.js +0 -169
- package/src/stories/FilterPanel.stories.js +0 -309
- package/src/stories/FiltersStrip.stories.js +0 -244
- package/src/stories/GettingStarted.mdx +0 -153
- package/src/stories/Header.stories.js +0 -185
- package/src/stories/HomePage.stories.js +0 -201
- package/src/stories/Input.stories.js +0 -165
- package/src/stories/Loader.stories.js +0 -33
- package/src/stories/Menu.stories.js +0 -309
- package/src/stories/Modal.stories.js +0 -185
- package/src/stories/MonthPicker.stories.js +0 -313
- package/src/stories/MonthRangePicker.stories.js +0 -255
- package/src/stories/Notification.stories.js +0 -500
- package/src/stories/Panel.stories.js +0 -179
- package/src/stories/Popover.stories.js +0 -125
- package/src/stories/ProgressBar.stories.js +0 -93
- package/src/stories/Prompt.stories.js +0 -120
- package/src/stories/RadioButtonGroup.stories.js +0 -83
- package/src/stories/Select.stories.js +0 -753
- package/src/stories/Sidebar.stories.js +0 -177
- package/src/stories/Slider.stories.js +0 -226
- package/src/stories/Stepper.stories.js +0 -158
- package/src/stories/Switch.stories.js +0 -72
- package/src/stories/Table.stories.js +0 -4323
- package/src/stories/TableChat.mdx +0 -992
- package/src/stories/TableChat.stories.js +0 -1712
- package/src/stories/TableOld.stories.js +0 -954
- package/src/stories/Tabs.stories.js +0 -253
- package/src/stories/Tag.stories.js +0 -92
- package/src/stories/TagGroup.stories.js +0 -39
- package/src/stories/TextArea.stories.js +0 -148
- package/src/stories/Toast.stories.js +0 -113
- package/src/stories/Tooltip.stories.js +0 -86
- package/src/stories/storybookLinks.mdx +0 -20
|
@@ -1,992 +0,0 @@
|
|
|
1
|
-
import { Meta, Story, Canvas, Controls, Source } from '@storybook/blocks';
|
|
2
|
-
import * as TableChatStories from './TableChat.stories';
|
|
3
|
-
|
|
4
|
-
<Meta of={TableChatStories} title="Documentation/TableChat" />
|
|
5
|
-
|
|
6
|
-
# Table Chat Feature
|
|
7
|
-
|
|
8
|
-
The Table Chat feature is a comprehensive real-time messaging system integrated with the Table component. It provides a complete chat experience with channels, direct messaging, rich text editing, file sharing, and advanced message management capabilities.
|
|
9
|
-
|
|
10
|
-
## Overview
|
|
11
|
-
|
|
12
|
-
The Table Chat feature consists of several interconnected components that work together to provide a seamless messaging experience:
|
|
13
|
-
|
|
14
|
-
- **TableChatSidePanel**: Main container orchestrating the entire chat interface
|
|
15
|
-
- **TableChatRightSection**: Message display and interaction management
|
|
16
|
-
- **ChatInput**: Rich text editor with advanced formatting capabilities
|
|
17
|
-
- **ChatHeader**: Participant management and search functionality
|
|
18
|
-
- **useTableChat**: Core hook managing WebSocket connections and API interactions
|
|
19
|
-
|
|
20
|
-
## Architecture
|
|
21
|
-
|
|
22
|
-
```mermaid
|
|
23
|
-
graph TD
|
|
24
|
-
A[Table Component] --> B[TableChatSidePanel]
|
|
25
|
-
B --> C[TableChatChannelHeader]
|
|
26
|
-
B --> D[TableChatRightSection]
|
|
27
|
-
D --> E[ChatHeader]
|
|
28
|
-
D --> F[Message List]
|
|
29
|
-
D --> G[ChatInput]
|
|
30
|
-
B --> H[useTableChat Hook]
|
|
31
|
-
H --> I[WebSocket Connection]
|
|
32
|
-
H --> J[API Services]
|
|
33
|
-
H --> K[Real-time Updates]
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
## Core Components
|
|
37
|
-
|
|
38
|
-
### TableChatSidePanel
|
|
39
|
-
|
|
40
|
-
The main container component that orchestrates the entire chat interface.
|
|
41
|
-
|
|
42
|
-
**Props:**
|
|
43
|
-
```typescript
|
|
44
|
-
interface TableChatSidePanelProps {
|
|
45
|
-
isOpen: boolean; // Controls panel visibility
|
|
46
|
-
handleClose: () => void; // Panel close handler
|
|
47
|
-
chatConfiguration: ChatConfiguration; // Complete chat configuration
|
|
48
|
-
}
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
**Key Methods:**
|
|
52
|
-
|
|
53
|
-
#### `handleChatClick(chatId: string, selectedChatData: ChatObject)`
|
|
54
|
-
- **Purpose**: Handles chat selection and opens the message view
|
|
55
|
-
- **Parameters**:
|
|
56
|
-
- `chatId`: Unique identifier for the chat
|
|
57
|
-
- `selectedChatData`: Complete chat object with metadata
|
|
58
|
-
- **Flow**: Sets loading state → calls external handler → loads messages
|
|
59
|
-
- **Returns**: `Promise<void>`
|
|
60
|
-
|
|
61
|
-
#### `fetchChatList(currentActiveChannelInfo: ChannelInfo)`
|
|
62
|
-
- **Purpose**: Loads chat list for a selected channel
|
|
63
|
-
- **Parameters**:
|
|
64
|
-
- `currentActiveChannelInfo`: Channel object with id and metadata
|
|
65
|
-
- **Returns**: `Promise<ChatObject[]>`
|
|
66
|
-
- **Flow**: Calls `loadChatList` from configuration → updates state
|
|
67
|
-
|
|
68
|
-
#### `fetchChannelList()`
|
|
69
|
-
- **Purpose**: Loads available channels for the user
|
|
70
|
-
- **Returns**: `Promise<ChannelObject[]>`
|
|
71
|
-
- **Flow**: Calls `loadChannelsList` from configuration → updates state
|
|
72
|
-
|
|
73
|
-
#### `handleDeleteChat()`
|
|
74
|
-
- **Purpose**: Handles batch deletion of selected chats
|
|
75
|
-
- **Returns**: `Promise<void>`
|
|
76
|
-
- **Flow**: Validates selection → calls delete API → updates UI → handles cleanup
|
|
77
|
-
|
|
78
|
-
#### `clearnupLocalStates()`
|
|
79
|
-
- **Purpose**: Resets all local state when panel closes
|
|
80
|
-
- **Returns**: `void`
|
|
81
|
-
- **Called**: When panel closes or navigation changes
|
|
82
|
-
|
|
83
|
-
### useTableChat Hook
|
|
84
|
-
|
|
85
|
-
The core hook managing WebSocket connections, API interactions, and real-time updates.
|
|
86
|
-
|
|
87
|
-
**Parameters:**
|
|
88
|
-
```typescript
|
|
89
|
-
interface UseTableChatParams {
|
|
90
|
-
selectedRows: any[]; // Selected table rows
|
|
91
|
-
uniqueRowId: string; // Unique identifier field
|
|
92
|
-
channelName: string; // Channel name field
|
|
93
|
-
objectType?: string; // Object type (default: "promo")
|
|
94
|
-
maxReconnectAttempts?: number; // Max WebSocket reconnection attempts (default: 3)
|
|
95
|
-
appCode?: string; // Application code (default: "promosmart")
|
|
96
|
-
}
|
|
97
|
-
```
|
|
98
|
-
|
|
99
|
-
**Returns:**
|
|
100
|
-
```typescript
|
|
101
|
-
interface UseTableChatReturn {
|
|
102
|
-
// Chat state
|
|
103
|
-
isChatOpen: boolean;
|
|
104
|
-
currentTopicId: string | null;
|
|
105
|
-
isWebSocketConnected: boolean;
|
|
106
|
-
realTimeMessages: MessageObject[];
|
|
107
|
-
currentUserId: number | null;
|
|
108
|
-
|
|
109
|
-
// Chat actions
|
|
110
|
-
handleChatClick: () => Promise<void>;
|
|
111
|
-
handleChatClose: () => Promise<void>;
|
|
112
|
-
|
|
113
|
-
// API methods
|
|
114
|
-
createTopicAPI: (payload: CreateTopicPayload) => Promise<ApiResponse>;
|
|
115
|
-
deleteTopicAPI: (topicId: string) => Promise<ApiResponse>;
|
|
116
|
-
fetchAllTopicsAPI: () => Promise<ChannelObject[]>;
|
|
117
|
-
fetchChatsByObjectIdAPI: (objectType: string, objectId: string) => Promise<ChatObject[]>;
|
|
118
|
-
createMessageAPI: (payload: CreateMessagePayload) => Promise<MessageObject>;
|
|
119
|
-
updateMessageAPI: (messageId: string, payload: UpdateMessagePayload) => Promise<MessageObject>;
|
|
120
|
-
deleteMessageAPI: (messageId: string) => Promise<boolean>;
|
|
121
|
-
searchMessagesAPI: (topicId: string, queryParams: SearchParams) => Promise<MessageObject[]>;
|
|
122
|
-
|
|
123
|
-
// WebSocket methods
|
|
124
|
-
joinTopicWithWebSocket: (topicId: string) => Promise<void>;
|
|
125
|
-
leaveCurrentTopic: () => Promise<void>;
|
|
126
|
-
markTopicAsDeleted: (topicId: string) => void;
|
|
127
|
-
handleRealTimeMessageUpdate: (newMessage: MessageObject, additionalProps?: any) => void;
|
|
128
|
-
|
|
129
|
-
// Direct chat methods
|
|
130
|
-
loadChatListFromSelectedRows: (selectedRows: any[], uniqueRowId: string, objectType: string) => Promise<ChatObject[]>;
|
|
131
|
-
chatListForDirectAccess: ChatObject[];
|
|
132
|
-
setChatListForDirectAccess: (chats: ChatObject[]) => void;
|
|
133
|
-
hasDirectChatList: boolean;
|
|
134
|
-
setHasDirectChatList: (hasDirect: boolean) => void;
|
|
135
|
-
clearDirectChatListWithDisconnect: () => void;
|
|
136
|
-
}
|
|
137
|
-
```
|
|
138
|
-
|
|
139
|
-
**Key Methods:**
|
|
140
|
-
|
|
141
|
-
#### `createTopicAPI(payload: CreateTopicPayload)`
|
|
142
|
-
- **Purpose**: Creates a new chat topic
|
|
143
|
-
- **Parameters**:
|
|
144
|
-
- `payload`: Topic creation data
|
|
145
|
-
- **Returns**: `Promise<ApiResponse>`
|
|
146
|
-
- **Flow**: Calls API → sets currentTopicId → enables WebSocket connection
|
|
147
|
-
|
|
148
|
-
#### `joinTopicWithWebSocket(topicId: string)`
|
|
149
|
-
- **Purpose**: Connects to a specific topic via WebSocket
|
|
150
|
-
- **Parameters**:
|
|
151
|
-
- `topicId`: Topic identifier to connect to
|
|
152
|
-
- **Returns**: `Promise<void>`
|
|
153
|
-
- **Flow**: Disconnects previous connection → sets new topic → establishes WebSocket
|
|
154
|
-
|
|
155
|
-
#### `handleRealTimeMessageUpdate(newMessage: MessageObject, additionalProps?: any)`
|
|
156
|
-
- **Purpose**: Handles real-time message updates
|
|
157
|
-
- **Parameters**:
|
|
158
|
-
- `newMessage`: New or updated message object
|
|
159
|
-
- `additionalProps`: Additional properties to merge
|
|
160
|
-
- **Returns**: `void`
|
|
161
|
-
- **Flow**: Validates topic → updates message state → triggers UI update
|
|
162
|
-
|
|
163
|
-
#### `getCombinedMessages(topicId: string, page: number)`
|
|
164
|
-
- **Purpose**: Combines API messages with real-time messages
|
|
165
|
-
- **Parameters**:
|
|
166
|
-
- `topicId`: Topic identifier
|
|
167
|
-
- `page`: Page number for pagination
|
|
168
|
-
- **Returns**: `Promise<{messages: MessageObject[], noMoreData: boolean}>`
|
|
169
|
-
- **Flow**: Fetches API messages → merges with real-time → deduplicates → sorts chronologically
|
|
170
|
-
|
|
171
|
-
### TableChatRightSection
|
|
172
|
-
|
|
173
|
-
Manages message display, real-time updates, and user interactions.
|
|
174
|
-
|
|
175
|
-
**Props:**
|
|
176
|
-
```typescript
|
|
177
|
-
interface TableChatRightSectionProps {
|
|
178
|
-
chatId: string; // Current chat identifier
|
|
179
|
-
title: string; // Chat title
|
|
180
|
-
CreatedBy: string; // Creator information
|
|
181
|
-
messageConfig: MessageConfig; // Message configuration
|
|
182
|
-
inputChatConfig: InputConfig; // Input configuration
|
|
183
|
-
chatHeaderConfig: HeaderConfig; // Header configuration
|
|
184
|
-
showParticipantsList?: boolean; // Show participants list
|
|
185
|
-
showPinnedChat?: boolean; // Show pinned chat
|
|
186
|
-
showSearch?: boolean; // Show search functionality
|
|
187
|
-
showActionBtn?: boolean; // Show action buttons
|
|
188
|
-
handleToast: (isOpen: boolean, message: string, variant: string) => void;
|
|
189
|
-
}
|
|
190
|
-
```
|
|
191
|
-
|
|
192
|
-
**Key Methods:**
|
|
193
|
-
|
|
194
|
-
#### `fetchMoreMessages(page: number)`
|
|
195
|
-
- **Purpose**: Implements infinite scroll pagination
|
|
196
|
-
- **Parameters**:
|
|
197
|
-
- `page`: Page number to load
|
|
198
|
-
- **Returns**: `Promise<MessageObject[]>`
|
|
199
|
-
- **Features**: Handles both old format (array) and new format (object with metadata)
|
|
200
|
-
|
|
201
|
-
#### `handleSend(payload: SendMessagePayload)`
|
|
202
|
-
- **Purpose**: Sends new messages or updates existing ones
|
|
203
|
-
- **Parameters**:
|
|
204
|
-
- `payload`: Message content and metadata
|
|
205
|
-
- **Returns**: `Promise<void>`
|
|
206
|
-
- **Flow**: Validates content → calls send handler → updates UI → handles real-time sync
|
|
207
|
-
|
|
208
|
-
#### `handleUpdateMessage(updatedContent: UpdateMessagePayload)`
|
|
209
|
-
- **Purpose**: Updates existing messages
|
|
210
|
-
- **Parameters**:
|
|
211
|
-
- `updatedContent`: New message content
|
|
212
|
-
- **Returns**: `Promise<void>`
|
|
213
|
-
- **Flow**: Calls update API → handles real-time vs API message sync
|
|
214
|
-
|
|
215
|
-
#### `handleMessageDelete(messageId: string)`
|
|
216
|
-
- **Purpose**: Deletes messages with proper state management
|
|
217
|
-
- **Parameters**:
|
|
218
|
-
- `messageId`: ID of message to delete
|
|
219
|
-
- **Returns**: `Promise<void>`
|
|
220
|
-
- **Flow**: Determines message type → calls delete handler → updates local state
|
|
221
|
-
|
|
222
|
-
#### `handleSearchMessage(searchValue: string, chatId: string)`
|
|
223
|
-
- **Purpose**: Searches messages within the chat
|
|
224
|
-
- **Parameters**:
|
|
225
|
-
- `searchValue`: Search query
|
|
226
|
-
- `chatId`: Chat to search in
|
|
227
|
-
- **Returns**: `Promise<MessageObject[]>`
|
|
228
|
-
|
|
229
|
-
#### `groupMessagesByDate(messages: MessageObject[])`
|
|
230
|
-
- **Purpose**: Groups messages by date for display
|
|
231
|
-
- **Parameters**:
|
|
232
|
-
- `messages`: Array of message objects
|
|
233
|
-
- **Returns**: `Array<MessageObject | DateSeparator>`
|
|
234
|
-
|
|
235
|
-
### ChatInput
|
|
236
|
-
|
|
237
|
-
Rich text editor with advanced formatting and interaction capabilities.
|
|
238
|
-
|
|
239
|
-
**Props:**
|
|
240
|
-
```typescript
|
|
241
|
-
interface ChatInputProps {
|
|
242
|
-
placeholder: string; // Input placeholder text
|
|
243
|
-
value: string; // Current input value
|
|
244
|
-
onChange: (value: string) => void; // Value change handler
|
|
245
|
-
onSend: (payload: SendMessagePayload) => Promise<void>; // Message send handler
|
|
246
|
-
messageConfig: MessageConfig; // Configuration for mentions, etc.
|
|
247
|
-
isEditMode?: boolean; // Whether in edit mode
|
|
248
|
-
chatId: string; // Current chat ID
|
|
249
|
-
selectedQuickAction?: QuickAction; // Selected quick action
|
|
250
|
-
onQuickActionSelect?: (action: QuickAction) => void;
|
|
251
|
-
}
|
|
252
|
-
```
|
|
253
|
-
|
|
254
|
-
**Key Methods:**
|
|
255
|
-
|
|
256
|
-
#### `handleSend()`
|
|
257
|
-
- **Purpose**: Processes and sends messages
|
|
258
|
-
- **Returns**: `Promise<void>`
|
|
259
|
-
- **Flow**: Validates content → extracts mentions → calls send handler → clears input
|
|
260
|
-
|
|
261
|
-
#### `getMentionedUsers()`
|
|
262
|
-
- **Purpose**: Extracts mentioned users from rich text content
|
|
263
|
-
- **Returns**: `MentionedUser[]`
|
|
264
|
-
- **Flow**: Parses HTML content → extracts mention spans → returns user objects
|
|
265
|
-
|
|
266
|
-
#### `handleInputChange(htmlContent: string)`
|
|
267
|
-
- **Purpose**: Handles rich text content changes
|
|
268
|
-
- **Parameters**:
|
|
269
|
-
- `htmlContent`: HTML content from editor
|
|
270
|
-
- **Returns**: `void`
|
|
271
|
-
- **Flow**: Updates state → calls onChange callback
|
|
272
|
-
|
|
273
|
-
#### `handleEmojiClick(emoji: EmojiObject)`
|
|
274
|
-
- **Purpose**: Inserts emoji into the editor
|
|
275
|
-
- **Parameters**:
|
|
276
|
-
- `emoji`: Emoji object or string
|
|
277
|
-
- **Returns**: `void`
|
|
278
|
-
|
|
279
|
-
#### `handleFileUpload(file: File)`
|
|
280
|
-
- **Purpose**: Handles file upload with progress tracking
|
|
281
|
-
- **Parameters**:
|
|
282
|
-
- `file`: File object to upload
|
|
283
|
-
- **Returns**: `Promise<void>`
|
|
284
|
-
|
|
285
|
-
### ChatHeader
|
|
286
|
-
|
|
287
|
-
Header component with participant management and search functionality.
|
|
288
|
-
|
|
289
|
-
**Props:**
|
|
290
|
-
```typescript
|
|
291
|
-
interface ChatHeaderProps {
|
|
292
|
-
title: string; // Chat title
|
|
293
|
-
chatId: string; // Chat identifier
|
|
294
|
-
chatHeaderConfig: HeaderConfig; // Header configuration
|
|
295
|
-
participants: ParticipantObject[]; // Current participants
|
|
296
|
-
onPinnedClick?: (chatId: string) => Promise<MessageObject[]>;
|
|
297
|
-
}
|
|
298
|
-
```
|
|
299
|
-
|
|
300
|
-
**Key Methods:**
|
|
301
|
-
|
|
302
|
-
#### `fetchOptionsForRadio(radioValue: string)`
|
|
303
|
-
- **Purpose**: Loads participant options based on selection type
|
|
304
|
-
- **Parameters**:
|
|
305
|
-
- `radioValue`: "existing" or "new" participants
|
|
306
|
-
- **Returns**: `Promise<ParticipantObject[]>`
|
|
307
|
-
|
|
308
|
-
#### `handleRadioButtonChange(value: string)`
|
|
309
|
-
- **Purpose**: Handles participant type selection
|
|
310
|
-
- **Parameters**:
|
|
311
|
-
- `value`: Selected radio button value
|
|
312
|
-
- **Returns**: `void`
|
|
313
|
-
- **Flow**: Updates state → fetches new options
|
|
314
|
-
|
|
315
|
-
#### `handleMessageSearchChange(e: ChangeEvent<HTMLInputElement>)`
|
|
316
|
-
- **Purpose**: Handles message search with debouncing
|
|
317
|
-
- **Parameters**:
|
|
318
|
-
- `e`: Input event
|
|
319
|
-
- **Returns**: `void`
|
|
320
|
-
- **Flow**: Updates search value → calls debounced search
|
|
321
|
-
|
|
322
|
-
#### `handleParticipantsClick()`
|
|
323
|
-
- **Purpose**: Opens participant management interface
|
|
324
|
-
- **Returns**: `Promise<void>`
|
|
325
|
-
- **Flow**: Calls external handler → loads participant data
|
|
326
|
-
|
|
327
|
-
## Configuration Structure
|
|
328
|
-
|
|
329
|
-
### ChatConfiguration Object
|
|
330
|
-
|
|
331
|
-
The main configuration object that controls all chat functionality:
|
|
332
|
-
|
|
333
|
-
```typescript
|
|
334
|
-
interface ChatConfiguration {
|
|
335
|
-
// Message-related configuration
|
|
336
|
-
messageChatConfig: {
|
|
337
|
-
// Real-time messaging
|
|
338
|
-
realTimeMessages: MessageObject[];
|
|
339
|
-
isWebSocketConnected: boolean;
|
|
340
|
-
currentTopicId: string | null;
|
|
341
|
-
currentUserId: number | null;
|
|
342
|
-
onRealTimeMessageUpdate: (newMessage: MessageObject) => void;
|
|
343
|
-
|
|
344
|
-
// Message actions
|
|
345
|
-
onMessageReply: (messageId: string, message: MessageObject) => void;
|
|
346
|
-
onMessageBookmark: (messageId: string, message: MessageObject) => void;
|
|
347
|
-
onMessagePin: (messageId: string, isPinned: boolean, item: MessageObject, selectedChannelInfo: ChannelInfo, selectedChatInfo: ChatObject) => Promise<boolean>;
|
|
348
|
-
onMessageUpdate: (messageId: string, updatedData: UpdateMessagePayload) => Promise<MessageObject>;
|
|
349
|
-
onMessageDelete: (messageId: string) => Promise<boolean>;
|
|
350
|
-
onThreadClick: (messageId: string, message: MessageObject) => void;
|
|
351
|
-
|
|
352
|
-
// Data loading
|
|
353
|
-
loadThreadMessages: (parentMessageId: string) => Promise<MessageObject[]>;
|
|
354
|
-
loadPinnedMsg: () => Promise<MessageObject[]>;
|
|
355
|
-
onSearchMessage: (searchValue: string, chatId: string) => Promise<MessageObject[]>;
|
|
356
|
-
|
|
357
|
-
// Configuration
|
|
358
|
-
messageConfig: {
|
|
359
|
-
showActions: boolean;
|
|
360
|
-
priorityOptions: PriorityOption[];
|
|
361
|
-
quickActionProps: QuickAction[];
|
|
362
|
-
isMsgFormat: boolean;
|
|
363
|
-
};
|
|
364
|
-
|
|
365
|
-
// Topic management
|
|
366
|
-
leaveCurrentTopic: () => Promise<void>;
|
|
367
|
-
markTopicAsDeleted: (topicId: string) => void;
|
|
368
|
-
};
|
|
369
|
-
|
|
370
|
-
// Header configuration
|
|
371
|
-
headerChatConfig: {
|
|
372
|
-
// Participant management
|
|
373
|
-
participants: ParticipantObject[];
|
|
374
|
-
loadParticipants: (radioValue: string, selectedChannelInfo: ChannelInfo, selectedChatInfo: ChatObject) => Promise<ParticipantObject[]>;
|
|
375
|
-
loadParticipantsAvatar: (selectedRadioOption: string, chatId: string) => Promise<ParticipantObject[]>;
|
|
376
|
-
onParticipantAdd: (participant: ParticipantObject, selectedRadioOption: string, chatId: string) => Promise<ApiResponse>;
|
|
377
|
-
onParticipantRemove: (participant: ParticipantObject) => Promise<ApiResponse>;
|
|
378
|
-
|
|
379
|
-
// Search and actions
|
|
380
|
-
onSearchChange: (value: string, radioValue: string, chatId: string) => Promise<ParticipantObject[]>;
|
|
381
|
-
onPinnedClick: (chatId: string) => Promise<MessageObject[]>;
|
|
382
|
-
onNotificationSettingChange: (settings: NotificationSettings) => Promise<ApiResponse>;
|
|
383
|
-
|
|
384
|
-
// Chat actions
|
|
385
|
-
onChatClick: (chatId: string, channelId: string) => Promise<void>;
|
|
386
|
-
|
|
387
|
-
// Header settings
|
|
388
|
-
headerConfig: {
|
|
389
|
-
showSearch: boolean;
|
|
390
|
-
showParticipants: boolean;
|
|
391
|
-
showPinned: boolean;
|
|
392
|
-
showNotifications: boolean;
|
|
393
|
-
selectedRadioOptionMenu: string;
|
|
394
|
-
maxAvatars: number;
|
|
395
|
-
radioOptions: RadioOption[];
|
|
396
|
-
searchConfig: SearchConfig;
|
|
397
|
-
};
|
|
398
|
-
};
|
|
399
|
-
|
|
400
|
-
// Input configuration
|
|
401
|
-
inputChatConfig: {
|
|
402
|
-
onSend: (payload: SendMessagePayload, chatId: string) => Promise<MessageObject>;
|
|
403
|
-
onAttachFile: (file: File) => void;
|
|
404
|
-
onImageUpload: (image: File) => void;
|
|
405
|
-
onEmojiSelect: (emoji: EmojiObject) => void;
|
|
406
|
-
inputConfig: {
|
|
407
|
-
placeholder: string;
|
|
408
|
-
maxLength: number;
|
|
409
|
-
showFormatting: boolean;
|
|
410
|
-
showEmojiPicker: boolean;
|
|
411
|
-
showAttachments: boolean;
|
|
412
|
-
allowedFileTypes: string[];
|
|
413
|
-
quickActions: QuickAction[];
|
|
414
|
-
};
|
|
415
|
-
};
|
|
416
|
-
|
|
417
|
-
// Left panel configuration
|
|
418
|
-
leftPanel: {
|
|
419
|
-
leftHeaderPanel: {
|
|
420
|
-
showAddChat: boolean;
|
|
421
|
-
};
|
|
422
|
-
leftChatPanel: {
|
|
423
|
-
showCheckbox: boolean;
|
|
424
|
-
};
|
|
425
|
-
rightHeaderPanel: {
|
|
426
|
-
showParticipants: boolean;
|
|
427
|
-
showPinnedChat: boolean;
|
|
428
|
-
showChatSearch: boolean;
|
|
429
|
-
showActionBtn: boolean;
|
|
430
|
-
};
|
|
431
|
-
loadChannelsList: () => Promise<ChannelObject[]>;
|
|
432
|
-
loadChatList: (selectedChannelInfo: ChannelInfo) => Promise<ChatObject[]>;
|
|
433
|
-
handleChatName: (formData: CreateChatFormData, selectedChannel: ChannelInfo) => Promise<CreateChatResponse>;
|
|
434
|
-
deleteChat: (topicId: string) => Promise<ApiResponse>;
|
|
435
|
-
directChatList: ChatObject[];
|
|
436
|
-
hasDirectChatList: boolean;
|
|
437
|
-
clearDirectChatList: () => void;
|
|
438
|
-
};
|
|
439
|
-
|
|
440
|
-
// Right panel configuration
|
|
441
|
-
rightPanel: {
|
|
442
|
-
loadMessages: (chatId: string, selectChat: ChatObject, page: number) => Promise<MessageObject[] | {messages: MessageObject[], noMoreData: boolean}>;
|
|
443
|
-
loadOlderMessages: (channelId: string) => Promise<MessageObject[]>;
|
|
444
|
-
messagesClearedTrigger: number;
|
|
445
|
-
};
|
|
446
|
-
}
|
|
447
|
-
```
|
|
448
|
-
|
|
449
|
-
## Data Structures
|
|
450
|
-
|
|
451
|
-
### MessageObject
|
|
452
|
-
```typescript
|
|
453
|
-
interface MessageObject {
|
|
454
|
-
id: string; // Unique message identifier
|
|
455
|
-
author: "user" | "assistant" | "system"; // Message author type
|
|
456
|
-
authorName: string; // Display name
|
|
457
|
-
content: string; // HTML content
|
|
458
|
-
timestamp: string; // Display timestamp
|
|
459
|
-
date: string; // ISO date string
|
|
460
|
-
priority: "low" | "medium" | "high"; // Message priority
|
|
461
|
-
isPinned: boolean; // Pin status
|
|
462
|
-
deleted: boolean; // Deletion status
|
|
463
|
-
edited: boolean; // Edit status
|
|
464
|
-
showActions: boolean; // Show action buttons
|
|
465
|
-
showReplyBadge: boolean; // Show reply badge
|
|
466
|
-
replyText?: string; // Reply text
|
|
467
|
-
otherProps: {
|
|
468
|
-
sender_id: number; // Sender's user ID
|
|
469
|
-
created_at: string; // Creation timestamp
|
|
470
|
-
updated_at?: string; // Update timestamp
|
|
471
|
-
isRealTime?: boolean; // Real-time message flag
|
|
472
|
-
topic_id: string; // Topic identifier
|
|
473
|
-
sender_name: string; // Sender name
|
|
474
|
-
};
|
|
475
|
-
}
|
|
476
|
-
```
|
|
477
|
-
|
|
478
|
-
### ChatObject
|
|
479
|
-
```typescript
|
|
480
|
-
interface ChatObject {
|
|
481
|
-
id: string; // Unique chat identifier
|
|
482
|
-
title: string; // Chat display name
|
|
483
|
-
subtitle: string; // Chat description/preview
|
|
484
|
-
user: string; // Last message author
|
|
485
|
-
text: string; // Last message preview
|
|
486
|
-
time: string; // Last activity time
|
|
487
|
-
isChecked: boolean; // Selection status
|
|
488
|
-
isPinned: boolean; // Pin status
|
|
489
|
-
unreadCount: number; // Unread message count
|
|
490
|
-
messageCount: number; // Total message count
|
|
491
|
-
timestamp: string; // Formatted timestamp
|
|
492
|
-
otherProps: {
|
|
493
|
-
object_ids: string[]; // Related object IDs
|
|
494
|
-
object_type: string; // Object type ("deal", etc.)
|
|
495
|
-
topic_id: string; // Topic identifier
|
|
496
|
-
created_by_user: string; // Creator name
|
|
497
|
-
is_pinned: boolean; // Pin status
|
|
498
|
-
unread_count: number; // Unread count
|
|
499
|
-
message_count: number; // Message count
|
|
500
|
-
created_at: string; // Creation timestamp
|
|
501
|
-
};
|
|
502
|
-
}
|
|
503
|
-
```
|
|
504
|
-
|
|
505
|
-
### ChannelObject
|
|
506
|
-
```typescript
|
|
507
|
-
interface ChannelObject {
|
|
508
|
-
id: string; // Unique channel identifier
|
|
509
|
-
title: string; // Channel name
|
|
510
|
-
time: string; // Last activity
|
|
511
|
-
unreadCount: number; // Unread messages
|
|
512
|
-
objectType: string; // Object type
|
|
513
|
-
}
|
|
514
|
-
```
|
|
515
|
-
|
|
516
|
-
### ParticipantObject
|
|
517
|
-
```typescript
|
|
518
|
-
interface ParticipantObject {
|
|
519
|
-
id: string | number; // Unique participant identifier
|
|
520
|
-
label: string; // Display name
|
|
521
|
-
value: string | number; // Value for selection
|
|
522
|
-
role?: string; // Participant role
|
|
523
|
-
url?: string; // Avatar URL
|
|
524
|
-
status?: "online" | "offline"; // Online status
|
|
525
|
-
isPinned?: boolean; // Pin status
|
|
526
|
-
otherProps?: {
|
|
527
|
-
user_name: string; // User name
|
|
528
|
-
user_code: string | number; // User code
|
|
529
|
-
email: string; // Email address
|
|
530
|
-
user_image?: string; // User image URL
|
|
531
|
-
};
|
|
532
|
-
}
|
|
533
|
-
```
|
|
534
|
-
|
|
535
|
-
## Advanced Features
|
|
536
|
-
|
|
537
|
-
### 1. Infinite Scroll Implementation
|
|
538
|
-
|
|
539
|
-
The chat uses a custom `useInfiniteScroll` hook that:
|
|
540
|
-
|
|
541
|
-
- Triggers loading when scrolling near the top (for older messages)
|
|
542
|
-
- Handles loading states and error conditions
|
|
543
|
-
- Supports both array and object response formats
|
|
544
|
-
- Prevents duplicate message loading
|
|
545
|
-
|
|
546
|
-
```typescript
|
|
547
|
-
interface UseInfiniteScrollOptions {
|
|
548
|
-
threshold?: number; // Intersection threshold (default: 0.1)
|
|
549
|
-
rootMargin?: string; // Root margin (default: "200px 0px 0px 0px")
|
|
550
|
-
enabled?: boolean; // Enable/disable infinite scroll
|
|
551
|
-
}
|
|
552
|
-
|
|
553
|
-
interface UseInfiniteScrollReturn {
|
|
554
|
-
loadMore: () => void; // Function to load more data
|
|
555
|
-
isLoadingMore: boolean; // Loading state
|
|
556
|
-
hasMore: boolean; // Whether more data is available
|
|
557
|
-
error: string | null; // Error state
|
|
558
|
-
reset: () => void; // Reset function
|
|
559
|
-
}
|
|
560
|
-
```
|
|
561
|
-
|
|
562
|
-
### 2. Real-time Synchronization
|
|
563
|
-
|
|
564
|
-
Real-time updates are handled through:
|
|
565
|
-
|
|
566
|
-
- WebSocket connection status monitoring
|
|
567
|
-
- Message deduplication by ID
|
|
568
|
-
- Optimistic updates with rollback support
|
|
569
|
-
- Proper chronological ordering
|
|
570
|
-
|
|
571
|
-
```typescript
|
|
572
|
-
interface WebSocketMessage {
|
|
573
|
-
type: "new_message" | "message_created" | "message_updated" | "message_update" | "message_deleted" | "message_delete" | "messages_cleared";
|
|
574
|
-
action?: "message_updated" | "message_deleted" | "messages_cleared";
|
|
575
|
-
message: MessageObject;
|
|
576
|
-
topic_id?: string;
|
|
577
|
-
}
|
|
578
|
-
```
|
|
579
|
-
|
|
580
|
-
### 3. Rich Text Editor Features
|
|
581
|
-
|
|
582
|
-
The MentionEditor component provides:
|
|
583
|
-
|
|
584
|
-
- @mention autocomplete with user search
|
|
585
|
-
- Text formatting (bold, italic, links, etc.)
|
|
586
|
-
- Emoji picker integration
|
|
587
|
-
- File and image upload with preview
|
|
588
|
-
- HTML content validation
|
|
589
|
-
|
|
590
|
-
```typescript
|
|
591
|
-
interface MentionEditorProps {
|
|
592
|
-
value: string;
|
|
593
|
-
onChange: (value: string) => void;
|
|
594
|
-
placeholder?: string;
|
|
595
|
-
maxLength?: number;
|
|
596
|
-
showFormatting?: boolean;
|
|
597
|
-
showEmojiPicker?: boolean;
|
|
598
|
-
showAttachments?: boolean;
|
|
599
|
-
allowedFileTypes?: string[];
|
|
600
|
-
onMentionSearch?: (query: string) => Promise<ParticipantObject[]>;
|
|
601
|
-
onFileUpload?: (file: File) => Promise<string>;
|
|
602
|
-
onEmojiSelect?: (emoji: EmojiObject) => void;
|
|
603
|
-
}
|
|
604
|
-
```
|
|
605
|
-
|
|
606
|
-
### 4. Search Functionality
|
|
607
|
-
|
|
608
|
-
Two types of search are supported:
|
|
609
|
-
|
|
610
|
-
1. **Message Search**: Search within chat messages
|
|
611
|
-
2. **Participant Search**: Search and filter participants
|
|
612
|
-
|
|
613
|
-
Both support debouncing and async loading states.
|
|
614
|
-
|
|
615
|
-
```typescript
|
|
616
|
-
interface SearchConfig {
|
|
617
|
-
placeholder: string;
|
|
618
|
-
debounceMs: number;
|
|
619
|
-
minChars: number;
|
|
620
|
-
showAdvancedSearch?: boolean;
|
|
621
|
-
}
|
|
622
|
-
```
|
|
623
|
-
|
|
624
|
-
### 5. Message Highlighting & Auto-Scroll
|
|
625
|
-
|
|
626
|
-
The chat feature includes intelligent message highlighting and auto-scrolling capabilities for improved user experience:
|
|
627
|
-
|
|
628
|
-
#### Features:
|
|
629
|
-
|
|
630
|
-
1. **Direct Message Highlighting via Config**
|
|
631
|
-
- Set `selectedMessageId` in config to highlight a specific message on page load
|
|
632
|
-
- Automatically searches across multiple pages if message is not in current view
|
|
633
|
-
- Highlights only once per chat session (prevents re-highlighting on state changes)
|
|
634
|
-
|
|
635
|
-
2. **Pinned Message Highlighting**
|
|
636
|
-
- Click any pinned message to highlight it in the main chat area
|
|
637
|
-
- Supports re-highlighting the same message multiple times
|
|
638
|
-
- Pinned panel remains open for easy navigation between messages
|
|
639
|
-
|
|
640
|
-
3. **Smart Page Loading**
|
|
641
|
-
- Tracks current page state to prevent duplicate API calls
|
|
642
|
-
- Only loads the next unloaded page when searching for messages
|
|
643
|
-
- Example: If on page 1, searching loads page 2 only (skips if already loaded)
|
|
644
|
-
|
|
645
|
-
4. **Visual Animation**
|
|
646
|
-
- 1.5-second scale animation with pulsing border effect
|
|
647
|
-
- Smooth scroll to message position with configurable behavior
|
|
648
|
-
- Configurable highlight duration and colors
|
|
649
|
-
|
|
650
|
-
#### Configuration:
|
|
651
|
-
|
|
652
|
-
```typescript
|
|
653
|
-
interface MessageHighlightConfig {
|
|
654
|
-
// Message ID to highlight (one-time highlight on load)
|
|
655
|
-
selectedMessageId: string | null;
|
|
656
|
-
|
|
657
|
-
// Search configuration
|
|
658
|
-
maxSearchPages: number; // Max pages to search (default: 3)
|
|
659
|
-
highlightDuration: number; // Duration in ms (default: 3000)
|
|
660
|
-
|
|
661
|
-
// Scroll behavior
|
|
662
|
-
scrollBehavior: "smooth" | "auto"; // Scroll animation (default: "smooth")
|
|
663
|
-
scrollBlock: "start" | "center" | "end"; // Scroll alignment (default: "center")
|
|
664
|
-
|
|
665
|
-
// Visual customization
|
|
666
|
-
highlightColor: string | null; // Custom border color (default: primary color)
|
|
667
|
-
}
|
|
668
|
-
```
|
|
669
|
-
|
|
670
|
-
#### Usage Example:
|
|
671
|
-
|
|
672
|
-
```jsx
|
|
673
|
-
const chatConfiguration = {
|
|
674
|
-
messageChatConfig: {
|
|
675
|
-
// Highlight specific message on load (searches pages 1-3)
|
|
676
|
-
selectedMessageId: "msg-123",
|
|
677
|
-
|
|
678
|
-
// Configuration
|
|
679
|
-
maxSearchPages: 3,
|
|
680
|
-
highlightDuration: 3000,
|
|
681
|
-
scrollBehavior: "smooth",
|
|
682
|
-
scrollBlock: "center",
|
|
683
|
-
highlightColor: "#0066FF",
|
|
684
|
-
}
|
|
685
|
-
};
|
|
686
|
-
```
|
|
687
|
-
|
|
688
|
-
#### How It Works:
|
|
689
|
-
|
|
690
|
-
1. **Config-based Highlighting:**
|
|
691
|
-
- Set `selectedMessageId` in configuration
|
|
692
|
-
- On component mount, checks if message exists in loaded messages
|
|
693
|
-
- If not found, sequentially loads pages 2, 3, etc. until found or max pages reached
|
|
694
|
-
- Scrolls to message and applies highlight animation
|
|
695
|
-
- Tracks highlight to prevent re-triggering (once per chat session)
|
|
696
|
-
|
|
697
|
-
2. **Pinned Message Highlighting:**
|
|
698
|
-
- User clicks pinned message in PinnedPanel
|
|
699
|
-
- Same search logic applies if message not in current view
|
|
700
|
-
- Can re-highlight same message multiple times (useful for referencing)
|
|
701
|
-
- Panel stays open for easy navigation
|
|
702
|
-
|
|
703
|
-
3. **Efficient Page Management:**
|
|
704
|
-
- Infinite scroll tracks current page (e.g., page 2)
|
|
705
|
-
- When searching for message, starts from next page (page 3)
|
|
706
|
-
- Updates infinite scroll page state after manual load
|
|
707
|
-
- Prevents duplicate API calls for already-loaded pages
|
|
708
|
-
|
|
709
|
-
### 6. State Management
|
|
710
|
-
|
|
711
|
-
The chat feature uses a combination of:
|
|
712
|
-
|
|
713
|
-
- Local React state for UI interactions
|
|
714
|
-
- Memoized configurations to prevent re-renders
|
|
715
|
-
- External state management through configuration callbacks
|
|
716
|
-
- Cleanup functions for proper resource management
|
|
717
|
-
|
|
718
|
-
## Usage Examples
|
|
719
|
-
|
|
720
|
-
### Basic Integration
|
|
721
|
-
|
|
722
|
-
```jsx
|
|
723
|
-
import { Table } from "impact-ui-v3";
|
|
724
|
-
import useTableChat from "./customHooks/useTableChat";
|
|
725
|
-
|
|
726
|
-
function MyComponent() {
|
|
727
|
-
const [selectedRows, setSelectedRows] = useState([]);
|
|
728
|
-
|
|
729
|
-
const {
|
|
730
|
-
isChatOpen,
|
|
731
|
-
handleChatClick,
|
|
732
|
-
handleChatClose,
|
|
733
|
-
chatConfiguration
|
|
734
|
-
} = useTableChat({
|
|
735
|
-
selectedRows,
|
|
736
|
-
uniqueRowId: "id",
|
|
737
|
-
channelName: "name",
|
|
738
|
-
objectType: "deal"
|
|
739
|
-
});
|
|
740
|
-
|
|
741
|
-
return (
|
|
742
|
-
<Table
|
|
743
|
-
isChatEnabled={true}
|
|
744
|
-
isChatOpen={isChatOpen}
|
|
745
|
-
handleChatClick={handleChatClick}
|
|
746
|
-
handleChatClose={handleChatClose}
|
|
747
|
-
chatConfiguration={chatConfiguration}
|
|
748
|
-
// ... other table props
|
|
749
|
-
/>
|
|
750
|
-
);
|
|
751
|
-
}
|
|
752
|
-
```
|
|
753
|
-
|
|
754
|
-
### Custom Message Handler
|
|
755
|
-
|
|
756
|
-
```jsx
|
|
757
|
-
const chatConfiguration = {
|
|
758
|
-
messageChatConfig: {
|
|
759
|
-
onMessageUpdate: async (messageId, updatedData) => {
|
|
760
|
-
// Custom update logic
|
|
761
|
-
const response = await api.updateMessage(messageId, updatedData);
|
|
762
|
-
return response.data;
|
|
763
|
-
},
|
|
764
|
-
onMessageDelete: async (messageId) => {
|
|
765
|
-
// Custom delete logic
|
|
766
|
-
const response = await api.deleteMessage(messageId);
|
|
767
|
-
return response.success;
|
|
768
|
-
},
|
|
769
|
-
},
|
|
770
|
-
};
|
|
771
|
-
```
|
|
772
|
-
|
|
773
|
-
### Real-time Integration
|
|
774
|
-
|
|
775
|
-
```jsx
|
|
776
|
-
const chatConfiguration = {
|
|
777
|
-
messageChatConfig: {
|
|
778
|
-
realTimeMessages: webSocketMessages,
|
|
779
|
-
isWebSocketConnected: wsConnection.readyState === WebSocket.OPEN,
|
|
780
|
-
onRealTimeMessageUpdate: (newMessage) => {
|
|
781
|
-
setWebSocketMessages((prev) => [...prev, newMessage]);
|
|
782
|
-
},
|
|
783
|
-
},
|
|
784
|
-
};
|
|
785
|
-
```
|
|
786
|
-
|
|
787
|
-
### Custom Input Configuration
|
|
788
|
-
|
|
789
|
-
```jsx
|
|
790
|
-
const chatConfiguration = {
|
|
791
|
-
inputChatConfig: {
|
|
792
|
-
onSend: async (payload, chatId) => {
|
|
793
|
-
// Custom send logic
|
|
794
|
-
const response = await api.sendMessage({
|
|
795
|
-
topic_id: chatId,
|
|
796
|
-
content: payload.content,
|
|
797
|
-
tagged_users: payload.mentionedUsers,
|
|
798
|
-
priority: payload.priority
|
|
799
|
-
});
|
|
800
|
-
return response.data;
|
|
801
|
-
},
|
|
802
|
-
inputConfig: {
|
|
803
|
-
placeholder: "Type your message with @mentions...",
|
|
804
|
-
maxLength: 5000,
|
|
805
|
-
showFormatting: true,
|
|
806
|
-
showEmojiPicker: true,
|
|
807
|
-
showAttachments: true,
|
|
808
|
-
allowedFileTypes: ["image/*", "application/pdf"],
|
|
809
|
-
quickActions: [
|
|
810
|
-
{ label: "Request Review", action: "request_review" },
|
|
811
|
-
{ label: "Schedule Meeting", action: "schedule_meeting" }
|
|
812
|
-
]
|
|
813
|
-
}
|
|
814
|
-
}
|
|
815
|
-
};
|
|
816
|
-
```
|
|
817
|
-
|
|
818
|
-
## Best Practices
|
|
819
|
-
|
|
820
|
-
### 1. Performance
|
|
821
|
-
|
|
822
|
-
- Use memoized configurations to prevent unnecessary re-renders
|
|
823
|
-
- Implement proper cleanup in useEffect hooks
|
|
824
|
-
- Debounce search and input handlers
|
|
825
|
-
- Use React.memo for expensive components
|
|
826
|
-
|
|
827
|
-
```jsx
|
|
828
|
-
const memoizedMessageConfig = useMemo(() => ({
|
|
829
|
-
...chatConfiguration.messageChatConfig,
|
|
830
|
-
realTimeMessages,
|
|
831
|
-
isWebSocketConnected,
|
|
832
|
-
currentTopicId,
|
|
833
|
-
onRealTimeMessageUpdate,
|
|
834
|
-
currentUserId,
|
|
835
|
-
}), [
|
|
836
|
-
chatConfiguration.messageChatConfig,
|
|
837
|
-
realTimeMessages,
|
|
838
|
-
isWebSocketConnected,
|
|
839
|
-
currentTopicId,
|
|
840
|
-
onRealTimeMessageUpdate,
|
|
841
|
-
currentUserId,
|
|
842
|
-
]);
|
|
843
|
-
```
|
|
844
|
-
|
|
845
|
-
### 2. Error Handling
|
|
846
|
-
|
|
847
|
-
- Always wrap async operations in try-catch blocks
|
|
848
|
-
- Provide user feedback for failed operations
|
|
849
|
-
- Implement retry mechanisms for critical operations
|
|
850
|
-
|
|
851
|
-
```jsx
|
|
852
|
-
const handleSend = async (payload) => {
|
|
853
|
-
try {
|
|
854
|
-
setLoading(true);
|
|
855
|
-
const response = await onSend(payload, chatId);
|
|
856
|
-
// Handle success
|
|
857
|
-
} catch (error) {
|
|
858
|
-
console.error("Error sending message:", error);
|
|
859
|
-
handleToast(true, "Failed to send message", "error");
|
|
860
|
-
} finally {
|
|
861
|
-
setLoading(false);
|
|
862
|
-
}
|
|
863
|
-
};
|
|
864
|
-
```
|
|
865
|
-
|
|
866
|
-
### 3. State Management
|
|
867
|
-
|
|
868
|
-
- Keep local state minimal and focused
|
|
869
|
-
- Use external handlers for persistent data
|
|
870
|
-
- Implement proper cleanup when components unmount
|
|
871
|
-
|
|
872
|
-
```jsx
|
|
873
|
-
useEffect(() => {
|
|
874
|
-
return () => {
|
|
875
|
-
// Cleanup WebSocket connections
|
|
876
|
-
if (isWebSocketConnected) {
|
|
877
|
-
disconnectWebSocket();
|
|
878
|
-
}
|
|
879
|
-
// Clear timeouts
|
|
880
|
-
if (timeoutRef.current) {
|
|
881
|
-
clearTimeout(timeoutRef.current);
|
|
882
|
-
}
|
|
883
|
-
};
|
|
884
|
-
}, []);
|
|
885
|
-
```
|
|
886
|
-
|
|
887
|
-
### 4. Accessibility
|
|
888
|
-
|
|
889
|
-
- Provide proper ARIA labels for interactive elements
|
|
890
|
-
- Ensure keyboard navigation support
|
|
891
|
-
- Use semantic HTML structures
|
|
892
|
-
|
|
893
|
-
```jsx
|
|
894
|
-
<button
|
|
895
|
-
aria-label="Send message"
|
|
896
|
-
aria-describedby="message-input"
|
|
897
|
-
onClick={handleSend}
|
|
898
|
-
disabled={!messageContent.trim()}
|
|
899
|
-
>
|
|
900
|
-
Send
|
|
901
|
-
</button>
|
|
902
|
-
```
|
|
903
|
-
|
|
904
|
-
### 5. Real-time Updates
|
|
905
|
-
|
|
906
|
-
- Handle message deduplication properly
|
|
907
|
-
- Implement proper chronological ordering
|
|
908
|
-
- Provide visual feedback for connection status
|
|
909
|
-
|
|
910
|
-
```jsx
|
|
911
|
-
const handleRealTimeMessageUpdate = useCallback((newMessage) => {
|
|
912
|
-
setRealTimeMessages((prev) => {
|
|
913
|
-
// Deduplicate by ID
|
|
914
|
-
const exists = prev.some(msg => msg.id === newMessage.id);
|
|
915
|
-
if (exists) {
|
|
916
|
-
return prev.map(msg =>
|
|
917
|
-
msg.id === newMessage.id ? newMessage : msg
|
|
918
|
-
);
|
|
919
|
-
}
|
|
920
|
-
return [...prev, newMessage];
|
|
921
|
-
});
|
|
922
|
-
}, []);
|
|
923
|
-
```
|
|
924
|
-
|
|
925
|
-
## Troubleshooting
|
|
926
|
-
|
|
927
|
-
### Common Issues
|
|
928
|
-
|
|
929
|
-
1. **Messages not updating in real-time**:
|
|
930
|
-
- Check WebSocket connection status
|
|
931
|
-
- Verify `currentTopicId` matches active chat
|
|
932
|
-
- Ensure `onRealTimeMessageUpdate` is properly configured
|
|
933
|
-
|
|
934
|
-
2. **Infinite scroll not working**:
|
|
935
|
-
- Check `loadMessages` function implementation
|
|
936
|
-
- Verify page parameter handling
|
|
937
|
-
- Ensure proper return format (array or object with messages)
|
|
938
|
-
|
|
939
|
-
3. **Mentions not working**:
|
|
940
|
-
- Verify `loadParticipantsAvatar` function
|
|
941
|
-
- Check `chatId` parameter passing
|
|
942
|
-
- Ensure participant data format is correct
|
|
943
|
-
|
|
944
|
-
4. **File upload issues**:
|
|
945
|
-
- Check file type restrictions
|
|
946
|
-
- Verify upload handler implementation
|
|
947
|
-
- Ensure proper error handling
|
|
948
|
-
|
|
949
|
-
### Debug Tools
|
|
950
|
-
|
|
951
|
-
Enable debug logging by setting:
|
|
952
|
-
|
|
953
|
-
```javascript
|
|
954
|
-
window.CHAT_DEBUG = true;
|
|
955
|
-
```
|
|
956
|
-
|
|
957
|
-
This will provide detailed console logs for:
|
|
958
|
-
|
|
959
|
-
- Message state changes
|
|
960
|
-
- API calls and responses
|
|
961
|
-
- Real-time update processing
|
|
962
|
-
- Component lifecycle events
|
|
963
|
-
|
|
964
|
-
## Stories
|
|
965
|
-
|
|
966
|
-
### Basic Chat Examples
|
|
967
|
-
|
|
968
|
-
<Canvas of={TableChatStories.BasicChatFeature} />
|
|
969
|
-
|
|
970
|
-
<Canvas of={TableChatStories.DirectMessaging} />
|
|
971
|
-
|
|
972
|
-
<Canvas of={TableChatStories.RealTimeChat} />
|
|
973
|
-
|
|
974
|
-
<Canvas of={TableChatStories.RichTextChat} />
|
|
975
|
-
|
|
976
|
-
<Canvas of={TableChatStories.SearchEnabledChat} />
|
|
977
|
-
|
|
978
|
-
<Canvas of={TableChatStories.CustomMessageTypes} />
|
|
979
|
-
|
|
980
|
-
<Canvas of={TableChatStories.EmptyStateChat} />
|
|
981
|
-
|
|
982
|
-
### Message Highlighting Examples
|
|
983
|
-
|
|
984
|
-
<Canvas of={TableChatStories.MessageHighlightingPage1} />
|
|
985
|
-
|
|
986
|
-
<Canvas of={TableChatStories.MessageHighlightingPage2} />
|
|
987
|
-
|
|
988
|
-
<Canvas of={TableChatStories.PinnedMessageHighlighting} />
|
|
989
|
-
|
|
990
|
-
<Canvas of={TableChatStories.CombinedHighlighting} />
|
|
991
|
-
|
|
992
|
-
<Canvas of={TableChatStories.CustomHighlightConfiguration} />
|