@snf/qa-bot-core 0.1.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 (46) hide show
  1. package/README.md +183 -0
  2. package/build/asset-manifest.json +15 -0
  3. package/build/chat-icon.svg +3 -0
  4. package/build/favicon.ico +0 -0
  5. package/build/index.html +1 -0
  6. package/build/logo192.png +0 -0
  7. package/build/logo512.png +0 -0
  8. package/build/manifest.json +25 -0
  9. package/build/robots.txt +3 -0
  10. package/build/static/css/main.css +2 -0
  11. package/build/static/css/main.css.map +1 -0
  12. package/build/static/js/453.chunk.js +2 -0
  13. package/build/static/js/453.chunk.js.map +1 -0
  14. package/build/static/js/main.js +3 -0
  15. package/build/static/js/main.js.LICENSE.txt +67 -0
  16. package/build/static/js/main.js.map +1 -0
  17. package/dist/qa-bot-core.js +9 -0
  18. package/dist/qa-bot-core.js.map +1 -0
  19. package/dist/qa-bot-core.standalone.js +37 -0
  20. package/dist/qa-bot-core.standalone.js.map +1 -0
  21. package/dist/qa-bot-core.umd.cjs +9 -0
  22. package/dist/qa-bot-core.umd.cjs.map +1 -0
  23. package/dist/types/components/BotController.d.ts +14 -0
  24. package/dist/types/components/NewChatButton.d.ts +3 -0
  25. package/dist/types/components/QABot.d.ts +7 -0
  26. package/dist/types/components/icons/BaseIcon.d.ts +9 -0
  27. package/dist/types/components/icons/RefreshIcon.d.ts +3 -0
  28. package/dist/types/config/constants.d.ts +66 -0
  29. package/dist/types/config/defaults.d.ts +118 -0
  30. package/dist/types/config/index.d.ts +11 -0
  31. package/dist/types/config/types.d.ts +150 -0
  32. package/dist/types/config.d.ts +47 -0
  33. package/dist/types/hooks/useChatBotSettings.d.ts +13 -0
  34. package/dist/types/hooks/useFocusableSendButton.d.ts +5 -0
  35. package/dist/types/hooks/useKeyboardNavigation.d.ts +6 -0
  36. package/dist/types/hooks/useThemeColors.d.ts +12 -0
  37. package/dist/types/lib.d.ts +44 -0
  38. package/dist/types/standalone.d.ts +8 -0
  39. package/dist/types/utils/create-bot-flow.d.ts +12 -0
  40. package/dist/types/utils/deep-merge.d.ts +10 -0
  41. package/dist/types/utils/flow-merger.d.ts +14 -0
  42. package/dist/types/utils/flows/qa-flow.d.ts +25 -0
  43. package/dist/types/utils/getProcessedText.d.ts +4 -0
  44. package/dist/types/utils/session-utils.d.ts +2 -0
  45. package/dist/types/utils/validation-utils.d.ts +19 -0
  46. package/package.json +78 -0
@@ -0,0 +1,14 @@
1
+ import React from 'react';
2
+ import type { BotControllerHandle } from '../config';
3
+ interface BotControllerProps {
4
+ embedded: boolean;
5
+ currentOpen?: boolean;
6
+ }
7
+ /**
8
+ * BotController Component
9
+ *
10
+ * Handles the integration between react-chatbotify hooks and the imperative API.
11
+ * This component must be rendered inside ChatBotProvider to access the hooks.
12
+ */
13
+ declare const BotController: React.ForwardRefExoticComponent<BotControllerProps & React.RefAttributes<BotControllerHandle>>;
14
+ export default BotController;
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ declare const NewChatButton: React.FC;
3
+ export default NewChatButton;
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ import { type QABotProps, type BotControllerHandle } from '../config';
3
+ /**
4
+ * Q&A Bot Component - A pre-configured react-chatbotify wrapper with business logic
5
+ */
6
+ declare const QABot: React.ForwardRefExoticComponent<QABotProps & React.RefAttributes<BotControllerHandle>>;
7
+ export default QABot;
@@ -0,0 +1,9 @@
1
+ export default BaseIcon;
2
+ declare function BaseIcon({ width, height, color, children, ...props }: {
3
+ [x: string]: any;
4
+ width?: number;
5
+ height?: number;
6
+ color?: string;
7
+ children: any;
8
+ }): React.JSX.Element;
9
+ import React from 'react';
@@ -0,0 +1,3 @@
1
+ export default RefreshIcon;
2
+ declare function RefreshIcon(props: any): React.JSX.Element;
3
+ import React from 'react';
@@ -0,0 +1,66 @@
1
+ /**
2
+ * QA Bot Core - Runtime Constants and Usage Examples
3
+ *
4
+ * This file contains runtime constants and documentation that was previously
5
+ * in the large api-reference.js file. TypeScript interfaces are now in types.ts.
6
+ */
7
+ import { CONSTANTS } from './types';
8
+ export { CONSTANTS };
9
+ /**
10
+ * ===========================================
11
+ * USAGE EXAMPLES & PATTERNS
12
+ * ===========================================
13
+ */
14
+ export declare const USAGE_EXAMPLES: {
15
+ readonly SIMPLE: {
16
+ readonly name: "Level 1: Simple Usage";
17
+ readonly description: "Just business logic props - everything else uses sensible defaults";
18
+ readonly code: "\n<QABot\n apiKey=\"your-key\"\n endpoints={{ qa: 'https://your-api.com/chat' }}\n/>";
19
+ readonly requiredProps: readonly ["apiKey", "endpoints"];
20
+ readonly optionalProps: readonly ["userEmail", "welcomeMessage"];
21
+ };
22
+ readonly COMPLEX: {
23
+ readonly name: "Level 2: Complex Usage";
24
+ readonly description: "Business logic props + full react-chatbotify settings control";
25
+ readonly code: "\n<QABot\n apiKey=\"your-key\"\n endpoints={{ qa: 'https://your-api.com/chat' }}\n welcomeMessage=\"Custom welcome!\"\n settings={{\n general: { primaryColor: '#brand-color' },\n header: { title: 'Support Bot' }\n }}\n/>";
26
+ readonly props: readonly ["...businessProps", "settings", "plugins", "...reactChatbotifyProps"];
27
+ };
28
+ readonly WRAPPER: {
29
+ readonly name: "Level 3: Wrapper Pattern";
30
+ readonly description: "Create organizational bots with pre-configured defaults";
31
+ readonly code: "\nfunction MyOrgBot({ settings = {}, ...props }: WrapperProps) {\n return (\n <QABot\n endpoints={{ qa: 'https://org.com/api' }}\n settings={{\n general: { primaryColor: '#org-blue' },\n ...settings\n }}\n {...props}\n />\n );\n}";
32
+ };
33
+ };
34
+ /**
35
+ * ===========================================
36
+ * CUSTOM FLOWS EXAMPLES
37
+ * ===========================================
38
+ */
39
+ export declare const FLOW_EXAMPLES: {
40
+ readonly description: "Examples of custom conversation flows";
41
+ readonly simple: "\nconst customFlows = {\n start: {\n message: \"How can I help you?\",\n options: [\"Ask Question\", \"Create Ticket\"],\n paths: [\"qa_loop\", \"ticket_flow\"]\n },\n\n ticket_flow: {\n message: \"Please describe your issue:\",\n function: async (params) => {\n const ticket = await createTicket(params.userInput);\n return `Ticket #${ticket.id} created!`;\n }\n }\n};";
42
+ readonly advanced: "\nconst advancedFlows = {\n start: {\n message: \"Welcome! What would you like to do?\",\n options: [\"General Q&A\", \"Create Support Ticket\", \"Report Security Issue\"],\n paths: [\"qa_loop\", \"ticket_flow\", \"security_flow\"]\n },\n\n security_flow: {\n message: \"Security reports are taken seriously. Please describe the issue:\",\n function: async (params) => {\n await createSecurityReport({\n description: params.userInput,\n userEmail: params.userEmail,\n timestamp: new Date(),\n sessionId: params.sessionId\n });\n return \"Thank you for the security report. Our team has been notified.\";\n }\n }\n};";
43
+ };
44
+ /**
45
+ * ===========================================
46
+ * MIGRATION GUIDE
47
+ * ===========================================
48
+ */
49
+ export declare const MIGRATION_FROM_CONFIG_SYSTEM: {
50
+ readonly description: "How to migrate from the old config-based system to the new prop-based system";
51
+ readonly mappings: {
52
+ readonly 'config.core.auth.apiKey': "apiKey prop";
53
+ readonly 'config.core.endpoints.qa': "endpoints.qa prop";
54
+ readonly 'config.core.endpoints.rating': "endpoints.rating prop";
55
+ readonly 'config.user.email': "userEmail prop";
56
+ readonly 'config.user.name': "userName prop";
57
+ readonly 'config.user.loginUrl': "loginUrl prop";
58
+ readonly 'config.flows.welcomeMessage': "welcomeMessage prop";
59
+ readonly 'config.flows.customFlows': "customFlows prop";
60
+ readonly 'config.general.*': "settings.general.*";
61
+ readonly 'config.header.*': "settings.header.*";
62
+ readonly 'config.chatInput.*': "settings.chatInput.*";
63
+ };
64
+ readonly before: "\n// Old config-based system\n<QABot\n config={{\n core: {\n auth: { apiKey: 'key' },\n endpoints: { qa: '/api' }\n },\n flows: { welcomeMessage: 'Hi!' },\n general: { primaryColor: '#blue' }\n }}\n embedded={true} // Prop override confusion\n/>";
65
+ readonly after: "\n// New prop-based system\n<QABot\n apiKey=\"key\"\n endpoints={{ qa: '/api' }}\n welcomeMessage=\"Hi!\"\n settings={{\n general: {\n primaryColor: '#blue',\n embedded: true\n }\n }}\n/>";
66
+ };
@@ -0,0 +1,118 @@
1
+ /**
2
+ * Default react-chatbotify settings for QA Bot Core
3
+ *
4
+ * These are sensible defaults that provide a good out-of-the-box experience.
5
+ * Users can override any of these by passing their own settings object.
6
+ */
7
+ import React from 'react';
8
+ import type { CustomFlows } from './types';
9
+ export interface ReactChatbotifySettings {
10
+ general?: {
11
+ primaryColor?: string;
12
+ secondaryColor?: string;
13
+ fontFamily?: string;
14
+ embedded?: boolean;
15
+ showHeader?: boolean;
16
+ showFooter?: boolean;
17
+ };
18
+ device?: {
19
+ desktopEnabled?: boolean;
20
+ mobileEnabled?: boolean;
21
+ applyMobileOptimizations?: boolean;
22
+ };
23
+ chatHistory?: {
24
+ disabled?: boolean;
25
+ };
26
+ chatButton?: {
27
+ icon?: string;
28
+ };
29
+ audio?: {
30
+ disabled?: boolean;
31
+ };
32
+ emoji?: {
33
+ disabled?: boolean;
34
+ };
35
+ fileAttachment?: {
36
+ disabled?: boolean;
37
+ };
38
+ notification?: {
39
+ disabled?: boolean;
40
+ };
41
+ footer?: {
42
+ text?: React.ReactElement;
43
+ buttons?: React.ReactElement[];
44
+ };
45
+ event?: {
46
+ rcbToggleChatWindow?: boolean;
47
+ };
48
+ tooltip?: {
49
+ mode?: 'CLOSE' | 'ALWAYS' | 'NEVER';
50
+ text?: string;
51
+ };
52
+ header?: {
53
+ title?: string | React.ReactElement;
54
+ showAvatar?: boolean;
55
+ avatar?: string;
56
+ buttons?: any[];
57
+ };
58
+ chatInput?: {
59
+ disabled?: boolean;
60
+ enabledPlaceholderText?: string;
61
+ disabledPlaceholderText?: string;
62
+ characterLimit?: number;
63
+ showCharacterCount?: boolean;
64
+ allowNewline?: boolean;
65
+ sendButtonStyle?: any;
66
+ sendButtonAriaLabel?: string;
67
+ ariaLabel?: string;
68
+ ariaDescribedBy?: string;
69
+ };
70
+ chatWindow?: {
71
+ defaultOpen?: boolean;
72
+ showScrollbar?: boolean;
73
+ };
74
+ botBubble?: {
75
+ simulateStream?: boolean;
76
+ streamSpeed?: number;
77
+ showAvatar?: boolean;
78
+ allowNewline?: boolean;
79
+ dangerouslySetInnerHTML?: boolean;
80
+ renderHtml?: boolean;
81
+ ariaLabel?: string;
82
+ role?: string;
83
+ };
84
+ userBubble?: {
85
+ showAvatar?: boolean;
86
+ };
87
+ }
88
+ export declare const defaultReactChatbotifySettings: ReactChatbotifySettings;
89
+ /**
90
+ * Default welcome message for Q&A flows
91
+ */
92
+ export declare const defaultWelcomeMessage: string;
93
+ /**
94
+ * Default business configuration structure
95
+ * Used internally for flow generation and business logic
96
+ */
97
+ export interface BusinessConfig {
98
+ core: {
99
+ endpoints: {
100
+ qa?: string;
101
+ rating?: string;
102
+ };
103
+ auth: {
104
+ apiKey?: string;
105
+ };
106
+ };
107
+ user: {
108
+ email?: string;
109
+ name?: string;
110
+ loginUrl?: string;
111
+ };
112
+ flows: {
113
+ welcomeMessage: string;
114
+ customFlows?: CustomFlows;
115
+ };
116
+ }
117
+ export type { FlowStep, FlowParams } from './types';
118
+ export declare const defaultBusinessConfig: BusinessConfig;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * QA Bot Core - Configuration Exports
3
+ *
4
+ * Central export point for all configuration, types, and constants.
5
+ * This replaces the old complex api-reference.js system.
6
+ */
7
+ export type { QABotProps, QABotBusinessProps, EndpointsConfig, BrandingConfig, MessagesConfig, ReactChatbotifyFlow, ReactChatbotifyPlugin, ReactChatbotifyStyles, SimpleUsageProps, ThemeColors, BotControllerHandle, TooltipMode, FlowPath } from './types';
8
+ export type { ReactChatbotifySettings, BusinessConfig } from './defaults';
9
+ export type { CustomFlows, FlowStep, FlowParams } from './types';
10
+ export { defaultReactChatbotifySettings, defaultWelcomeMessage, defaultBusinessConfig } from './defaults';
11
+ export { CONSTANTS } from './types';
@@ -0,0 +1,150 @@
1
+ /**
2
+ * QA Bot Core - TypeScript Type Definitions
3
+ *
4
+ * SINGLE SOURCE OF TRUTH for all TypeScript interfaces and types.
5
+ * This replaces the old api-reference.js with proper type definitions.
6
+ */
7
+ export interface CustomFlows {
8
+ [stepName: string]: FlowStep;
9
+ }
10
+ export interface FlowStep {
11
+ message: string;
12
+ options?: string[];
13
+ path?: string | ((input: string) => string | Promise<string>);
14
+ paths?: string[];
15
+ function?: (params: FlowParams) => string | Promise<string>;
16
+ }
17
+ export interface FlowParams {
18
+ userInput: string;
19
+ sessionId: string;
20
+ injectMessage: (message: string) => void;
21
+ }
22
+ /**
23
+ * ===========================================
24
+ * SIMPLE CONFIGURATION (For out-of-the-box users)
25
+ * ===========================================
26
+ */
27
+ export interface BrandingConfig {
28
+ /** Logo/avatar URL for the chatbot header */
29
+ logo?: string;
30
+ /** Primary color for buttons, highlights (e.g., "#007bff") */
31
+ primaryColor?: string;
32
+ /** Secondary color for hover states (e.g., "#0056b3") */
33
+ secondaryColor?: string;
34
+ /** Primary font family for the chat interface */
35
+ primaryFont?: string;
36
+ /** Secondary font family for special text (code, etc.) */
37
+ secondaryFont?: string;
38
+ /** Name displayed in the chat header */
39
+ botName?: string;
40
+ }
41
+ export interface MessagesConfig {
42
+ /** Initial greeting message from the bot */
43
+ welcome?: string;
44
+ /** Placeholder text in the input field */
45
+ placeholder?: string;
46
+ /** Error message when something goes wrong */
47
+ error?: string;
48
+ /** Message shown when chat is disabled */
49
+ disabled?: string;
50
+ }
51
+ /**
52
+ * ===========================================
53
+ * BUSINESS LOGIC PROPS (QA Bot Core Specific)
54
+ * ===========================================
55
+ */
56
+ export interface EndpointsConfig {
57
+ /** Q&A endpoint URL (e.g., "https://your-api.com/chat") */
58
+ qa: string;
59
+ /** Optional rating/feedback endpoint URL */
60
+ rating?: string;
61
+ }
62
+ export interface QABotBusinessProps {
63
+ /** API key for authenticating with your Q&A service */
64
+ apiKey?: string;
65
+ /** API endpoints for Q&A and rating services */
66
+ endpoints?: EndpointsConfig;
67
+ /** URL to redirect users for login/authentication */
68
+ loginUrl?: string;
69
+ /** Initial greeting message from the bot */
70
+ welcomeMessage?: string;
71
+ /** Custom conversation flow definitions */
72
+ customFlows?: CustomFlows;
73
+ /** Simple branding configuration */
74
+ branding?: BrandingConfig;
75
+ /** Simple message customization */
76
+ messages?: MessagesConfig;
77
+ }
78
+ /**
79
+ * ===========================================
80
+ * REACT-CHATBOTIFY INTEGRATION
81
+ * ===========================================
82
+ */
83
+ export interface ReactChatbotifyFlow {
84
+ [stepName: string]: any;
85
+ }
86
+ export type ReactChatbotifyPlugin = (...args: unknown[]) => {
87
+ name: string;
88
+ settings?: any;
89
+ styles?: any;
90
+ };
91
+ export interface ReactChatbotifyStyles {
92
+ [key: string]: any;
93
+ }
94
+ /**
95
+ * ===========================================
96
+ * COMPLETE QABOT PROPS
97
+ * ===========================================
98
+ */
99
+ export interface QABotProps extends QABotBusinessProps {
100
+ }
101
+ /**
102
+ * ===========================================
103
+ * USAGE TYPES (SIMPLIFIED)
104
+ * ===========================================
105
+ */
106
+ export interface SimpleUsageProps {
107
+ apiKey: string;
108
+ endpoints: EndpointsConfig;
109
+ welcomeMessage?: string;
110
+ }
111
+ /**
112
+ * ===========================================
113
+ * INTERNAL TYPES
114
+ * ===========================================
115
+ */
116
+ export interface ThemeColors {
117
+ primaryColor?: string;
118
+ secondaryColor?: string;
119
+ fontFamily?: string;
120
+ }
121
+ export interface BotControllerHandle {
122
+ addMessage: (message: string) => void;
123
+ openChat: () => void;
124
+ closeChat: () => void;
125
+ toggleChat: () => void;
126
+ setBotEnabled: (enabled: boolean) => void;
127
+ }
128
+ /**
129
+ * ===========================================
130
+ * CONSTANTS & ENUMS
131
+ * ===========================================
132
+ */
133
+ export declare const CONSTANTS: {
134
+ readonly DEFAULT_WELCOME_MESSAGE: "Hello! What can I help you with?";
135
+ readonly DEFAULT_PRIMARY_COLOR: "#1a5b6e";
136
+ readonly DEFAULT_SECONDARY_COLOR: "#107180";
137
+ readonly DEFAULT_FONT_FAMILY: "Arial, sans-serif";
138
+ readonly DEFAULT_AVATAR: "/default-chat-icon.svg";
139
+ readonly DEFAULT_CHARACTER_LIMIT: 1000;
140
+ readonly DEFAULT_STREAM_SPEED: 10;
141
+ readonly TOOLTIP_MODES: readonly ["CLOSE", "ALWAYS", "NEVER"];
142
+ readonly FLOW_PATHS: {
143
+ readonly QA_LOOP: "qa_loop";
144
+ readonly QA_START: "qa_start";
145
+ readonly RATING: "rating";
146
+ readonly START: "start";
147
+ };
148
+ };
149
+ export type TooltipMode = typeof CONSTANTS.TOOLTIP_MODES[number];
150
+ export type FlowPath = typeof CONSTANTS.FLOW_PATHS[keyof typeof CONSTANTS.FLOW_PATHS];
@@ -0,0 +1,47 @@
1
+ import type { Settings } from 'react-chatbotify';
2
+ export interface QABotProps {
3
+ apiKey: string;
4
+ qaEndpoint: string;
5
+ welcomeMessage: string;
6
+ ratingEndpoint?: string;
7
+ primaryColor?: string;
8
+ secondaryColor?: string;
9
+ botName?: string;
10
+ logo?: string;
11
+ placeholder?: string;
12
+ errorMessage?: string;
13
+ embedded?: boolean;
14
+ footerText?: string;
15
+ footerLink?: string;
16
+ tooltipText?: string;
17
+ }
18
+ /**
19
+ * Default values for overridable props
20
+ */
21
+ export declare const defaultValues: {
22
+ primaryColor: string;
23
+ secondaryColor: string;
24
+ fontFamily: string;
25
+ botName: string;
26
+ avatar: string;
27
+ placeholder: string;
28
+ errorMessage: string;
29
+ embedded: boolean;
30
+ tooltipText: string;
31
+ };
32
+ /**
33
+ * Fixed react-chatbotify settings
34
+ */
35
+ export declare const fixedReactChatbotifySettings: Settings;
36
+ export interface ThemeColors {
37
+ primaryColor?: string;
38
+ secondaryColor?: string;
39
+ fontFamily?: string;
40
+ }
41
+ export interface BotControllerHandle {
42
+ addMessage: (message: string) => void;
43
+ openChat: () => void;
44
+ closeChat: () => void;
45
+ toggleChat: () => void;
46
+ setBotEnabled: (enabled: boolean) => void;
47
+ }
@@ -0,0 +1,13 @@
1
+ import type { Settings } from 'react-chatbotify';
2
+ import type { ThemeColors } from '../config';
3
+ interface UseChatBotSettingsProps {
4
+ settings: Settings;
5
+ themeColors: ThemeColors;
6
+ footerText?: string;
7
+ footerLink?: string;
8
+ }
9
+ /**
10
+ * Custom hook to apply theme colors and accessibility enhancements
11
+ */
12
+ declare const useChatBotSettings: ({ settings, themeColors, footerText, footerLink }: UseChatBotSettingsProps) => void;
13
+ export default useChatBotSettings;
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Hook to make the send button focusable and keyboard accessible
3
+ */
4
+ declare const useFocusableSendButton: () => void;
5
+ export default useFocusableSendButton;
@@ -0,0 +1,6 @@
1
+ export default useKeyboardNavigation;
2
+ /**
3
+ * Custom hook for keyboard navigation in chatbot options
4
+ * Provides arrow key navigation, Enter/Space selection, and accessibility features
5
+ */
6
+ declare function useKeyboardNavigation(): any;
@@ -0,0 +1,12 @@
1
+ import { RefObject } from 'react';
2
+ import type { ThemeColors } from '../config';
3
+ interface ThemeConfig {
4
+ primaryColor?: string;
5
+ secondaryColor?: string;
6
+ fontFamily?: string;
7
+ }
8
+ /**
9
+ * Custom hook to get theme colors from CSS variables
10
+ */
11
+ declare const useThemeColors: (containerRef: RefObject<HTMLDivElement>, themeConfig?: ThemeConfig) => ThemeColors;
12
+ export default useThemeColors;
@@ -0,0 +1,44 @@
1
+ import QABot from './components/QABot';
2
+ import './styles/index.css';
3
+ export { QABot };
4
+ export type { QABotProps, BotControllerHandle } from './config';
5
+ /**
6
+ * ===========================================
7
+ * PROGRAMMATIC API TYPES
8
+ * ===========================================
9
+ */
10
+ interface QABotConfig {
11
+ target: HTMLElement;
12
+ apiKey: string;
13
+ qaEndpoint: string;
14
+ ratingEndpoint?: string;
15
+ defaultOpen?: boolean;
16
+ embedded?: boolean;
17
+ enabled?: boolean;
18
+ welcomeMessage: string;
19
+ primaryColor?: string;
20
+ secondaryColor?: string;
21
+ botName?: string;
22
+ logo?: string;
23
+ placeholder?: string;
24
+ errorMessage?: string;
25
+ footerText?: string;
26
+ footerLink?: string;
27
+ tooltipText?: string;
28
+ }
29
+ interface QABotInstance {
30
+ addMessage: (message: string) => void;
31
+ setBotEnabled: (status: boolean) => void;
32
+ openChat: () => void;
33
+ closeChat: () => void;
34
+ toggleChat: () => void;
35
+ destroy: () => void;
36
+ }
37
+ /**
38
+ * JavaScript API function - creates a QA Bot instance programmatically
39
+ *
40
+ * @param config Configuration object for the bot
41
+ * @returns QABot instance with control methods
42
+ */
43
+ export declare function qaBot(config: QABotConfig): QABotInstance | undefined;
44
+ export default qaBot;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Standalone build entry point for QA Bot Core
3
+ *
4
+ * This creates a standalone UMD bundle that includes React (via Preact).
5
+ * Used when loading the bot via script tag in vanilla HTML/JS environments.
6
+ */
7
+ import qaBot from './lib';
8
+ export default qaBot;
@@ -0,0 +1,12 @@
1
+ import type { BusinessConfig, CustomFlows, ReactChatbotifyFlow } from '../config';
2
+ interface CreateBotFlowParams {
3
+ config: BusinessConfig;
4
+ customFlows?: CustomFlows;
5
+ sessionId: string;
6
+ }
7
+ /**
8
+ * Creates the bot conversation flow
9
+ * Supports both basic Q&A and custom flows via plugins
10
+ */
11
+ export declare function createBotFlow({ config, customFlows, sessionId }: CreateBotFlowParams): ReactChatbotifyFlow;
12
+ export {};
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Deep merge utility for nested configuration objects
3
+ * Handles proper merging of nested objects while preserving arrays and other types
4
+ */
5
+ export declare function deepMerge(target: any, source: any): any;
6
+ /**
7
+ * Merge multiple objects with deep merging
8
+ * Objects are merged left-to-right (later objects have higher priority)
9
+ */
10
+ export declare function deepMergeAll(...objects: any[]): any;
@@ -0,0 +1,14 @@
1
+ import type { Flow } from 'react-chatbotify';
2
+ import type { CustomFlows } from '../config';
3
+ /**
4
+ * Merges custom flows with the base Q&A flow
5
+ * Custom flows can:
6
+ * - Override existing flow steps
7
+ * - Add new flow paths
8
+ * - Integrate with Q&A loop via 'qa_loop' path
9
+ */
10
+ export declare function mergeFlows(baseFlow: Flow, customFlows?: CustomFlows): Flow;
11
+ /**
12
+ * Creates a flow that integrates custom flows with Q&A
13
+ */
14
+ export declare function createIntegratedFlow(qaFlow: Flow, customFlows?: CustomFlows, welcomeMessage?: string): Flow;
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Creates the basic Q&A conversation flow
3
+ * Handles questions, responses, and optional ratings
4
+ *
5
+ * @param {Object} params Configuration
6
+ * @param {string} params.endpoint Q&A API endpoint (required)
7
+ * @param {string} params.ratingEndpoint Rating API endpoint (optional)
8
+ * @param {string} params.apiKey API key for authentication (optional)
9
+ * @param {string} params.sessionId Session ID for tracking
10
+ * @returns {Object} Q&A flow configuration
11
+ */
12
+ export declare const createQAFlow: ({ endpoint, ratingEndpoint, apiKey, sessionId }: {
13
+ endpoint: any;
14
+ ratingEndpoint: any;
15
+ apiKey: any;
16
+ sessionId: any;
17
+ }) => {
18
+ qa_loop: {
19
+ message: (chatState: any) => Promise<"Thanks for the feedback! Feel free to ask another question." | "I apologize, but I'm having trouble processing your question. Please try again later.">;
20
+ options: (chatState: any) => string[];
21
+ renderMarkdown: string[];
22
+ chatDisabled: boolean;
23
+ path: string;
24
+ };
25
+ };
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Processes text to convert bare URLs into markdown hyperlinks while preserving existing links
3
+ */
4
+ export declare const getProcessedText: (text: string) => string;
@@ -0,0 +1,2 @@
1
+ export declare const generateSessionId: () => string;
2
+ export declare const getOrCreateSessionId: () => string;
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Email validation utility functions
3
+ */
4
+ /**
5
+ * Validates email format using a comprehensive regex pattern
6
+ */
7
+ export declare const isValidEmail: (email: string) => boolean;
8
+ interface ValidationResult {
9
+ success: boolean;
10
+ promptContent?: string;
11
+ promptDuration?: number;
12
+ promptType?: string;
13
+ highlightTextArea?: boolean;
14
+ }
15
+ /**
16
+ * Creates email validation for chat bot flows
17
+ */
18
+ export declare const validateEmail: (email: string) => ValidationResult;
19
+ export {};