@snf/qa-bot-core 0.2.7 → 0.2.9
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/build/static/js/main.js +1 -1
- package/build/static/js/main.js.map +1 -1
- package/dist/qa-bot-core.js +2 -2
- package/dist/qa-bot-core.js.map +1 -1
- package/dist/qa-bot-core.standalone.js +2 -2
- package/dist/qa-bot-core.standalone.js.map +1 -1
- package/dist/qa-bot-core.umd.cjs +2 -2
- package/dist/qa-bot-core.umd.cjs.map +1 -1
- package/dist/types/components/SessionMessageTracker.d.ts +4 -0
- package/dist/types/utils/jsx-text-extractor.d.ts +15 -0
- package/dist/types/utils/logger.d.ts +1 -1
- package/package.json +1 -1
|
@@ -10,6 +10,10 @@
|
|
|
10
10
|
* the full message content in our own localStorage. The history dropdown
|
|
11
11
|
* restores sessions directly from our storage, not RCB's.
|
|
12
12
|
*
|
|
13
|
+
* Note: react-chatbotify wraps all messages (including plain strings) in JSX
|
|
14
|
+
* before firing events. We use extractTextFromJsx() to recover the text content
|
|
15
|
+
* from bot messages so they appear in restored sessions.
|
|
16
|
+
*
|
|
13
17
|
* Deduplication is handled by session-utils (checks message ID).
|
|
14
18
|
*
|
|
15
19
|
* Must be rendered inside ChatBotProvider.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Extracts plain text content from a JSX element or any value.
|
|
3
|
+
*
|
|
4
|
+
* react-chatbotify wraps bot messages in JSX before firing events,
|
|
5
|
+
* even when the flow step defines a plain string like:
|
|
6
|
+
* message: "What is your help ticket related to?"
|
|
7
|
+
*
|
|
8
|
+
* This function recursively extracts the text so we can store it
|
|
9
|
+
* in session history. Without this, bot messages would be lost
|
|
10
|
+
* when restoring sessions.
|
|
11
|
+
*
|
|
12
|
+
* @param element - Any value (string, number, JSX element, array, etc.)
|
|
13
|
+
* @returns The extracted text content, or empty string if none found
|
|
14
|
+
*/
|
|
15
|
+
export declare function extractTextFromJsx(element: unknown): string;
|
|
@@ -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.
|
|
10
|
+
export declare const LIB_VERSION = "0.2.9";
|
|
11
11
|
export declare const logger: {
|
|
12
12
|
version: () => void;
|
|
13
13
|
session: (action: string, ...args: unknown[]) => void;
|
package/package.json
CHANGED