impact-chatbot 2.0.0

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.
Files changed (86) hide show
  1. package/README.md +321 -0
  2. package/dist/components/ChatFooter.d.ts +55 -0
  3. package/dist/components/ChatInput.d.ts +27 -0
  4. package/dist/components/ChatLayout.d.ts +44 -0
  5. package/dist/components/ChatPlaceholder.d.ts +3 -0
  6. package/dist/components/HighlightedRenderer.d.ts +14 -0
  7. package/dist/components/LinkRenderer.d.ts +4 -0
  8. package/dist/components/LoadingOverlay.d.ts +2 -0
  9. package/dist/components/ModuleSelection.d.ts +28 -0
  10. package/dist/components/RedirectLink.d.ts +5 -0
  11. package/dist/components/SavedChat.d.ts +2 -0
  12. package/dist/components/SelectedModule.d.ts +7 -0
  13. package/dist/components/TextRenderer.d.ts +7 -0
  14. package/dist/components/chatbot-input/components/FilterValueInput.d.ts +15 -0
  15. package/dist/components/chatbot-input/hooks/useMentionState.d.ts +33 -0
  16. package/dist/components/chatbot-input/index.d.ts +3 -0
  17. package/dist/components/chatbot-input/index_new.d.ts +3 -0
  18. package/dist/components/chatbot-input/index_old_backup.d.ts +3 -0
  19. package/dist/components/chatbot-input/utils/apiHelpers.d.ts +50 -0
  20. package/dist/components/chatbot-input/utils/domHelpers.d.ts +82 -0
  21. package/dist/components/chatbot-input/utils/mentionHelpers.d.ts +48 -0
  22. package/dist/components/memory-modal/components/Memories.d.ts +2 -0
  23. package/dist/components/memory-modal/index.d.ts +2 -0
  24. package/dist/components/memory-modal/service.d.ts +3 -0
  25. package/dist/components/memory-modal/styling.d.ts +1 -0
  26. package/dist/components/message-template/components/message-actions/LikeDislikeActions.d.ts +7 -0
  27. package/dist/components/message-template/components/message-content/ButtonContent.d.ts +4 -0
  28. package/dist/components/message-template/components/message-content/CheckboxContent.d.ts +4 -0
  29. package/dist/components/message-template/components/message-content/ChipsContent.d.ts +5 -0
  30. package/dist/components/message-template/components/message-content/CombinedContent.d.ts +5 -0
  31. package/dist/components/message-template/components/message-content/DatePickerContent.d.ts +4 -0
  32. package/dist/components/message-template/components/message-content/GraphContent.d.ts +4 -0
  33. package/dist/components/message-template/components/message-content/InputContent.d.ts +4 -0
  34. package/dist/components/message-template/components/message-content/QuestionsContent.d.ts +5 -0
  35. package/dist/components/message-template/components/message-content/RadioContent.d.ts +4 -0
  36. package/dist/components/message-template/components/message-content/SelectContent.d.ts +4 -0
  37. package/dist/components/message-template/components/message-content/SelectableChips.d.ts +7 -0
  38. package/dist/components/message-template/components/message-content/SliderContent.d.ts +4 -0
  39. package/dist/components/message-template/components/message-content/TableContent.d.ts +4 -0
  40. package/dist/components/message-template/components/message-content/TextContent.d.ts +5 -0
  41. package/dist/components/message-template/components/message-content/tabular-content/components/AgentResponse.d.ts +4 -0
  42. package/dist/components/message-template/components/message-content/tabular-content/components/Steps.d.ts +4 -0
  43. package/dist/components/message-template/components/message-content/tabular-content/index.d.ts +6 -0
  44. package/dist/components/message-template/components/message-types/BotMessage.d.ts +7 -0
  45. package/dist/components/message-template/components/message-types/LoaderMessage.d.ts +4 -0
  46. package/dist/components/message-template/components/message-types/UserMessage.d.ts +4 -0
  47. package/dist/components/message-template/components/message-types/streamed-content/AxiosEventSource.d.ts +17 -0
  48. package/dist/components/message-template/components/message-types/streamed-content/StreamedContent.d.ts +16 -0
  49. package/dist/components/message-template/components/message-types/streamed-content/ThinkinHeaderInfo.d.ts +2 -0
  50. package/dist/components/message-template/components/message-types/streamed-content/ThinkingIndicator.d.ts +9 -0
  51. package/dist/components/message-template/components/message-types/streamed-content/steps-response-tab/StepsResponseTab.d.ts +2 -0
  52. package/dist/components/message-template/components/message-types/streamed-content/steps-response-tab/components/AgentResponse.d.ts +2 -0
  53. package/dist/components/message-template/components/message-types/streamed-content/steps-response-tab/components/Steps.d.ts +12 -0
  54. package/dist/components/message-template/components/message-types/streamed-content/styling.d.ts +1 -0
  55. package/dist/components/message-template/index.d.ts +2 -0
  56. package/dist/components/message-template/reference.d.ts +2 -0
  57. package/dist/components/message-template/utils.d.ts +4 -0
  58. package/dist/components/upload-modal/index.d.ts +2 -0
  59. package/dist/constants.d.ts +17 -0
  60. package/dist/core/constants/index.d.ts +5 -0
  61. package/dist/core/styles/colours.d.ts +213 -0
  62. package/dist/core/styles/globalStyles.d.ts +2 -0
  63. package/dist/core/utils/functions.d.ts +7 -0
  64. package/dist/core/utils/replaceSpecialCharacter.d.ts +1 -0
  65. package/dist/hooks/useAgentFlow.d.ts +5 -0
  66. package/dist/hooks/useBotConfiguration.d.ts +5 -0
  67. package/dist/hooks/useChatFlow.d.ts +16 -0
  68. package/dist/hooks/useChatSession.d.ts +8 -0
  69. package/dist/hooks/useChatState.d.ts +134 -0
  70. package/dist/hooks/useConversationManagement.d.ts +10 -0
  71. package/dist/hooks/useDragAndDrop.d.ts +6 -0
  72. package/dist/impact-ui-components/ConfirmationDialog/index.d.ts +24 -0
  73. package/dist/index.cjs.css +360 -0
  74. package/dist/index.cjs.js +9950 -0
  75. package/dist/index.cjs.js.map +1 -0
  76. package/dist/index.d.ts +2 -0
  77. package/dist/index.esm.css +360 -0
  78. package/dist/index.esm.js +9928 -0
  79. package/dist/index.esm.js.map +1 -0
  80. package/dist/services/chatbot-services.d.ts +14 -0
  81. package/dist/services/conversation-service.d.ts +6 -0
  82. package/dist/styling.d.ts +2 -0
  83. package/dist/temp.d.ts +65 -0
  84. package/dist/utils/coreUtils.d.ts +25 -0
  85. package/dist/utlis.d.ts +56 -0
  86. package/package.json +68 -0
@@ -0,0 +1,14 @@
1
+ export declare const resolveChatQuery: (body: any, flowType: any) => any;
2
+ export declare const fetchRelatedQuestions: (flowType: any, screen_name: any) => any;
3
+ export declare const getSmartBotVisibilityData: () => any;
4
+ export declare const refreshAndUpdateUserManualApi: (body: any) => Promise<any>;
5
+ export declare const fetchScreensForModule: (flowType: any) => Promise<any>;
6
+ export declare const likeDislikeComment: (payload: any) => Promise<any>;
7
+ export declare const fetchIntentApiResponse: (input?: string) => Promise<any>;
8
+ export declare const fetchAgentsInfo: (baseUrl: any) => Promise<any>;
9
+ export declare const initiateAgent: (payload: any, baseUrl: any) => Promise<any>;
10
+ export declare const fetchCustomBotConfig: (baseUrl: any) => Promise<any>;
11
+ export declare const uploadFile: (payload: any) => Promise<any>;
12
+ export declare const triggerRefresh: (baseUrl: any) => Promise<any>;
13
+ export declare const fetchChatbotFilterConfig: (dimension?: string) => Promise<any>;
14
+ export declare const getFilterOptions: (postBody: any) => () => Promise<any>;
@@ -0,0 +1,6 @@
1
+ export declare const fetchConversations: (currentMode: any) => Promise<any>;
2
+ export declare const fetchConversationChats: (conversationId: any) => Promise<any>;
3
+ export declare const createConversation: (payload: any) => Promise<any>;
4
+ export declare const updateConversation: (conversationId: any, payload: any) => Promise<any>;
5
+ export declare const deleteConversation: (conversationId: any) => Promise<any>;
6
+ export declare const saveChat: (payload: any) => Promise<any>;
@@ -0,0 +1,2 @@
1
+ export declare const useStyles: any;
2
+ export declare const StyledRefreshIcon: any;
package/dist/temp.d.ts ADDED
@@ -0,0 +1,65 @@
1
+ declare let chatbotFilterConfig: {
2
+ total: any;
3
+ page: any;
4
+ count: any;
5
+ status: boolean;
6
+ data: {
7
+ fc_code: any;
8
+ type: string;
9
+ display_type: string;
10
+ level: any;
11
+ dimension: string;
12
+ is_mandatory: boolean;
13
+ is_multiple_selection: boolean;
14
+ range_min: any;
15
+ range_max: any;
16
+ default_value: any;
17
+ is_disabled: boolean;
18
+ is_clearable: boolean;
19
+ display_order: any;
20
+ is_required: boolean;
21
+ extra: any;
22
+ is_deleted: boolean;
23
+ column_name: string;
24
+ label: string;
25
+ }[];
26
+ message: string;
27
+ previous: any;
28
+ next: any;
29
+ offset: any;
30
+ sub_offset: any;
31
+ download_rows: any;
32
+ };
33
+ export declare let chatbotFilterCustomConfig: {
34
+ total: any;
35
+ page: any;
36
+ count: any;
37
+ status: boolean;
38
+ data: {
39
+ fc_code: any;
40
+ type: string;
41
+ display_type: string;
42
+ level: any;
43
+ dimension: string;
44
+ is_mandatory: boolean;
45
+ is_multiple_selection: boolean;
46
+ range_min: any;
47
+ range_max: any;
48
+ default_value: any;
49
+ is_disabled: boolean;
50
+ is_clearable: boolean;
51
+ display_order: any;
52
+ is_required: boolean;
53
+ extra: {};
54
+ is_deleted: boolean;
55
+ column_name: string;
56
+ label: string;
57
+ }[];
58
+ message: string;
59
+ previous: any;
60
+ next: any;
61
+ offset: any;
62
+ sub_offset: any;
63
+ download_rows: any;
64
+ };
65
+ export default chatbotFilterConfig;
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Core utility functions copied from core/Utils/functions/utils
3
+ * These are internalized to make chatbot-v2 self-contained
4
+ */
5
+ /**
6
+ * pxToRem function will convert the px value to rem value
7
+ */
8
+ export declare const pxToRem: (pxValue: number) => string;
9
+ /**
10
+ * Replace special characters in a string
11
+ */
12
+ export declare const replaceSpecialCharacter: (str: any) => any;
13
+ /**
14
+ * Fetch base URL from tenant config
15
+ * This is a stub - the actual implementation should be passed as a prop
16
+ */
17
+ export declare const fetchBaseUrl: () => Promise<string | null>;
18
+ /**
19
+ * Fetch application code
20
+ * This is a stub - the actual implementation should be passed as a prop
21
+ */
22
+ export declare const fetchApplicationCode: () => Promise<{
23
+ applicationCode: string;
24
+ applicationCodesList: string[];
25
+ }>;
@@ -0,0 +1,56 @@
1
+ /**
2
+ * Returns a time-based greeting message
3
+ * @returns {string} Greeting message based on current time
4
+ */
5
+ export declare const getTimeBasedGreeting: () => "Good morning" | "Good afternoon" | "Good evening";
6
+ /**
7
+ * Utility object type definition for parseResponse
8
+ */
9
+ interface UtilityObject {
10
+ thinkingResponse?: any;
11
+ [key: string]: any;
12
+ }
13
+ /**
14
+ * Method to parse API response into chat format
15
+ * @param {object} data - API response data
16
+ * @param {string} type - Response type (text/questions)
17
+ * @returns {object} Formatted chat message
18
+ */
19
+ export declare const parseResponse: (data: any, type: string, agentId?: string, currentMode?: string, disableTimeAndName?: boolean, sessionId?: string, utilityData?: any, inputBody?: any, utilityObject?: UtilityObject) => any;
20
+ /**
21
+ * Method to like/dislike messages
22
+ * @param {string} question
23
+ * @param {boolean} liked - true if response was liked / false if disliked
24
+ * @param {function} setLoadingState
25
+ * @param {function} displaySnackMessages
26
+ * @param {object} templateData
27
+ * @returns
28
+ */
29
+ export declare const handleMessageLike: (question: any, liked: any, setLoadingState: any, displaySnackMessages: any, templateData: any, activeConversationId: any, answer: any, chatDataInfoRef: any, chatIndex: any, setChatDataState: any) => Promise<boolean>;
30
+ export declare const ensureConversationExists: (mode: any, conversationId: any, chatDataRef: any) => void;
31
+ export declare const removeAfterLastDash: (str: any) => any;
32
+ export declare const transformValues: (data: any) => any[];
33
+ export declare const getCurrentDateTimeString: (dateFormat: any) => any;
34
+ export declare const getFormattedTableConfig: (tableConfig: any) => any;
35
+ /**
36
+ * Dynamically imports a function from a specified path
37
+ * @param {string} path - Path to the module containing the function
38
+ * @param {string} functionName - Name of the function to import
39
+ * @returns {Promise<Function>} - The imported function
40
+ */
41
+ export declare const getDynamicFunction: (path: any, functionName: any) => Promise<any>;
42
+ /**
43
+ * Generates a conversation object structure with empty messages array and current timestamp
44
+ * @returns {object} - The conversation object structure
45
+ */
46
+ export declare const generateConversationObject: () => {
47
+ conversations: {
48
+ 1: {
49
+ id: number;
50
+ name: string;
51
+ timestamp: string;
52
+ messages: any[];
53
+ };
54
+ };
55
+ };
56
+ export {};
package/package.json ADDED
@@ -0,0 +1,68 @@
1
+ {
2
+ "name": "impact-chatbot",
3
+ "version": "2.0.0",
4
+ "description": "Standalone chatbot library - 1:1 copy of smartBot converted to TypeScript",
5
+ "main": "dist/index.cjs.js",
6
+ "module": "dist/index.esm.js",
7
+ "types": "dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "import": "./dist/index.esm.js",
11
+ "require": "./dist/index.cjs.js",
12
+ "types": "./dist/index.d.ts"
13
+ },
14
+ "./dist/index.esm.css": "./dist/index.esm.css",
15
+ "./dist/index.cjs.css": "./dist/index.cjs.css",
16
+ "./styles.css": "./dist/index.esm.css"
17
+ },
18
+ "files": [
19
+ "dist"
20
+ ],
21
+ "scripts": {
22
+ "build": "rollup -c",
23
+ "build:types": "tsc --emitDeclarationOnly",
24
+ "clean": "rm -rf dist",
25
+ "prepublishOnly": "npm run clean && npm run build",
26
+ "typecheck": "tsc --noEmit"
27
+ },
28
+ "peerDependencies": {
29
+ "@mui/material": "^5.0.0",
30
+ "@mui/styles": "^5.0.0",
31
+ "axios": "^1.0.0",
32
+ "impact-ui-chatbot": "*",
33
+ "lodash": "^4.0.0",
34
+ "react": "^17.0.0 || ^18.0.0",
35
+ "react-dom": "^17.0.0 || ^18.0.0",
36
+ "react-redux": "^8.0.0",
37
+ "redux": "^4.0.0"
38
+ },
39
+ "devDependencies": {
40
+ "@rollup/plugin-commonjs": "^25.0.0",
41
+ "@rollup/plugin-node-resolve": "^15.0.0",
42
+ "@rollup/plugin-typescript": "^11.0.0",
43
+ "@rollup/plugin-url": "^8.0.2",
44
+ "@svgr/rollup": "^8.1.0",
45
+ "@types/lodash": "^4.14.0",
46
+ "@types/react": "^18.0.0",
47
+ "@types/react-dom": "^18.0.0",
48
+ "postcss": "^8.4.0",
49
+ "rollup": "^3.0.0",
50
+ "rollup-plugin-peer-deps-external": "^2.2.4",
51
+ "rollup-plugin-postcss": "^4.0.2",
52
+ "rollup-plugin-url": "^3.0.1",
53
+ "sass": "^1.69.0",
54
+ "typescript": "^5.0.0"
55
+ },
56
+ "keywords": [
57
+ "chatbot",
58
+ "smartbot",
59
+ "react",
60
+ "typescript"
61
+ ],
62
+ "author": "Impact Analytics",
63
+ "license": "UNLICENSED",
64
+ "repository": {
65
+ "type": "git",
66
+ "url": ""
67
+ }
68
+ }