@snf/qa-bot-core 0.3.2 → 0.4.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.
@@ -1,4 +1,3 @@
1
- import React from 'react';
2
1
  import type { BotControllerHandle } from '../config';
3
2
  interface BotControllerProps {
4
3
  embedded: boolean;
@@ -12,5 +11,5 @@ interface BotControllerProps {
12
11
  * Handles the integration between react-chatbotify hooks and the imperative API.
13
12
  * This component must be rendered inside ChatBotProvider to access the hooks.
14
13
  */
15
- declare const BotController: React.ForwardRefExoticComponent<BotControllerProps & React.RefAttributes<BotControllerHandle>>;
14
+ declare const BotController: import("react").ForwardRefExoticComponent<BotControllerProps & import("react").RefAttributes<BotControllerHandle>>;
16
15
  export default BotController;
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ declare const MarkdownContent: ({ children }: {
3
+ children: React.ReactNode;
4
+ }) => React.JSX.Element;
5
+ export default MarkdownContent;
@@ -14,10 +14,19 @@
14
14
  * before firing events. We use extractTextFromJsx() to recover the text content
15
15
  * from bot messages so they appear in restored sessions.
16
16
  *
17
+ * Two events are tracked because answers arrive two different ways:
18
+ * - rcb-pre-inject-message: messages added via injectMessage() (user input,
19
+ * RAG-direct/JSON answers, custom-flow messages).
20
+ * - rcb-stop-stream-message: the finalized message after a streamed answer.
21
+ * Streaming (streamMessage/endStreamMessage) never fires the inject event,
22
+ * so without this listener streamed bot answers were never persisted and
23
+ * were missing from restored sessions (only the user's queries survived).
24
+ *
17
25
  * IMPORTANT: For custom flow messages to be tracked, use the withHistory()
18
26
  * helper function. See utils/with-history.ts for details.
19
27
  *
20
- * Deduplication is handled by session-utils (checks message ID).
28
+ * Deduplication is handled by session-utils (checks message ID), so a
29
+ * message that somehow surfaces in both events is only stored once.
21
30
  *
22
31
  * Must be rendered inside ChatBotProvider.
23
32
  */
@@ -7,7 +7,7 @@
7
7
  * Usage for consumers:
8
8
  * localStorage.setItem('QA_BOT_DEBUG', 'true'); // Enable debug logs + version
9
9
  */
10
- export declare const LIB_VERSION = "0.2.35";
10
+ export declare const LIB_VERSION = "0.4.0";
11
11
  export declare function isDebugEnabled(): boolean;
12
12
  export declare const logger: {
13
13
  version: () => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@snf/qa-bot-core",
3
- "version": "0.3.2",
3
+ "version": "0.4.0",
4
4
  "description": "A configurable chatbot setup for quick integration of RAG-powered Q&A and rating system",
5
5
  "main": "./dist/qa-bot-core.umd.cjs",
6
6
  "module": "./dist/qa-bot-core.js",
@@ -24,6 +24,8 @@
24
24
  "@rcb-plugins/input-validator": "^0.3.0",
25
25
  "@rcb-plugins/markdown-renderer": "^0.3.1",
26
26
  "react-chatbotify": "^2.5.0",
27
+ "react-markdown": "^9.1.0",
28
+ "remark-gfm": "^4.0.1",
27
29
  "uuid": "^11.1.0"
28
30
  },
29
31
  "peerDependencies": {
@@ -42,7 +44,9 @@
42
44
  "@rollup/plugin-replace": "^5.0.7",
43
45
  "@rollup/plugin-terser": "^0.4.4",
44
46
  "@rollup/plugin-typescript": "^11.1.6",
47
+ "@testing-library/jest-dom": "^6.9.1",
45
48
  "@testing-library/react": "^13.4.0",
49
+ "@types/jest": "^27.5.2",
46
50
  "@types/react": "^18.2.0",
47
51
  "@types/react-dom": "^18.2.0",
48
52
  "@types/uuid": "^9.0.0",
@@ -65,6 +69,20 @@
65
69
  "prepublishOnly": "npm run build:lib",
66
70
  "test": "react-app-rewired test"
67
71
  },
72
+ "eslintConfig": {
73
+ "extends": "react-app",
74
+ "overrides": [
75
+ {
76
+ "files": [
77
+ "*.ts",
78
+ "*.tsx"
79
+ ],
80
+ "plugins": [
81
+ "@typescript-eslint"
82
+ ]
83
+ }
84
+ ]
85
+ },
68
86
  "browserslist": {
69
87
  "production": [
70
88
  ">0.2%",