@robylon/web-react-sdk 1.1.28-staging.7 → 1.1.28

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 (110) hide show
  1. package/README.md +402 -34
  2. package/dist/cjs/index.js +1 -5534
  3. package/dist/cjs/index.js.map +1 -1
  4. package/dist/cjs/types/components/ChatbotContainer/ChatbotContainer.d.ts +12 -0
  5. package/dist/cjs/types/components/ChatbotContainer/index.d.ts +1 -0
  6. package/dist/cjs/types/config.d.ts +1 -1
  7. package/dist/cjs/types/constants/fontStyles.d.ts +2 -0
  8. package/dist/cjs/types/core/api.d.ts +6 -54
  9. package/dist/cjs/types/core/config.d.ts +34 -0
  10. package/dist/cjs/types/core/events.d.ts +22 -0
  11. package/dist/cjs/types/core/index.d.ts +4 -0
  12. package/dist/cjs/types/core/state.d.ts +34 -0
  13. package/dist/cjs/types/index.d.ts +5 -9
  14. package/dist/cjs/types/types.d.ts +34 -9
  15. package/dist/cjs/types/utils/fetchData.d.ts +16 -0
  16. package/dist/cjs/types/vanilla/components/ChatbotContainer.d.ts +45 -0
  17. package/dist/cjs/types/vanilla/components/ChatbotFloatingButton.d.ts +69 -0
  18. package/dist/cjs/types/vanilla/components/ChatbotIframe.d.ts +71 -0
  19. package/dist/cjs/types/vanilla/index.d.ts +15 -29
  20. package/dist/esm/index.js +1 -5527
  21. package/dist/esm/index.js.map +1 -1
  22. package/dist/esm/types/components/ChatbotContainer/ChatbotContainer.d.ts +12 -0
  23. package/dist/esm/types/components/ChatbotContainer/index.d.ts +1 -0
  24. package/dist/esm/types/config.d.ts +1 -1
  25. package/dist/esm/types/constants/fontStyles.d.ts +2 -0
  26. package/dist/esm/types/core/api.d.ts +6 -54
  27. package/dist/esm/types/core/config.d.ts +34 -0
  28. package/dist/esm/types/core/events.d.ts +22 -0
  29. package/dist/esm/types/core/index.d.ts +4 -0
  30. package/dist/esm/types/core/state.d.ts +34 -0
  31. package/dist/esm/types/index.d.ts +5 -9
  32. package/dist/esm/types/types.d.ts +34 -9
  33. package/dist/esm/types/utils/fetchData.d.ts +16 -0
  34. package/dist/esm/types/vanilla/components/ChatbotContainer.d.ts +45 -0
  35. package/dist/esm/types/vanilla/components/ChatbotFloatingButton.d.ts +69 -0
  36. package/dist/esm/types/vanilla/components/ChatbotIframe.d.ts +71 -0
  37. package/dist/esm/types/vanilla/index.d.ts +15 -29
  38. package/dist/index.d.ts +101 -77
  39. package/dist/umd/robylon-chatbot.js +2 -0
  40. package/dist/umd/robylon-chatbot.js.map +1 -0
  41. package/dist/umd/types/components/ChatbotContainer/ChatbotContainer.d.ts +12 -0
  42. package/dist/umd/types/components/ChatbotContainer/index.d.ts +1 -0
  43. package/dist/umd/types/config.d.ts +1 -1
  44. package/dist/umd/types/constants/fontStyles.d.ts +2 -0
  45. package/dist/umd/types/core/api.d.ts +6 -54
  46. package/dist/umd/types/core/config.d.ts +34 -0
  47. package/dist/umd/types/core/events.d.ts +22 -0
  48. package/dist/umd/types/core/index.d.ts +4 -0
  49. package/dist/umd/types/core/state.d.ts +34 -0
  50. package/dist/umd/types/index.d.ts +5 -9
  51. package/dist/umd/types/types.d.ts +34 -9
  52. package/dist/umd/types/utils/fetchData.d.ts +16 -0
  53. package/dist/umd/types/vanilla/components/ChatbotContainer.d.ts +45 -0
  54. package/dist/umd/types/vanilla/components/ChatbotFloatingButton.d.ts +69 -0
  55. package/dist/umd/types/vanilla/components/ChatbotIframe.d.ts +71 -0
  56. package/dist/umd/types/vanilla/index.d.ts +15 -29
  57. package/package.json +30 -82
  58. package/dist/cjs/legacy.js +0 -2
  59. package/dist/cjs/legacy.js.map +0 -1
  60. package/dist/cjs/react.js +0 -2
  61. package/dist/cjs/react.js.map +0 -1
  62. package/dist/cjs/types/core/chatbotEmbed.d.ts +0 -59
  63. package/dist/cjs/types/core/utils/color.d.ts +0 -1
  64. package/dist/cjs/types/core/utils/cookies.d.ts +0 -30
  65. package/dist/cjs/types/core/utils/environment.d.ts +0 -19
  66. package/dist/cjs/types/core/utils/logger.d.ts +0 -37
  67. package/dist/cjs/types/core/utils/system.d.ts +0 -22
  68. package/dist/cjs/types/index.legacy.d.ts +0 -7
  69. package/dist/cjs/types/index.react.d.ts +0 -9
  70. package/dist/cjs/types/index.vanilla.d.ts +0 -32
  71. package/dist/cjs/types/react/components/Chatbot.d.ts +0 -34
  72. package/dist/cjs/types/react/components/ErrorBoundary.d.ts +0 -18
  73. package/dist/cjs/types/types/config.d.ts +0 -33
  74. package/dist/cjs/types/types/index.d.ts +0 -16
  75. package/dist/esm/legacy.js +0 -2
  76. package/dist/esm/legacy.js.map +0 -1
  77. package/dist/esm/react.js +0 -2
  78. package/dist/esm/react.js.map +0 -1
  79. package/dist/esm/types/core/chatbotEmbed.d.ts +0 -59
  80. package/dist/esm/types/core/utils/color.d.ts +0 -1
  81. package/dist/esm/types/core/utils/cookies.d.ts +0 -30
  82. package/dist/esm/types/core/utils/environment.d.ts +0 -19
  83. package/dist/esm/types/core/utils/logger.d.ts +0 -37
  84. package/dist/esm/types/core/utils/system.d.ts +0 -22
  85. package/dist/esm/types/index.legacy.d.ts +0 -7
  86. package/dist/esm/types/index.react.d.ts +0 -9
  87. package/dist/esm/types/index.vanilla.d.ts +0 -32
  88. package/dist/esm/types/react/components/Chatbot.d.ts +0 -34
  89. package/dist/esm/types/react/components/ErrorBoundary.d.ts +0 -18
  90. package/dist/esm/types/types/config.d.ts +0 -33
  91. package/dist/esm/types/types/index.d.ts +0 -16
  92. package/dist/legacy.d.ts +0 -160
  93. package/dist/react.d.ts +0 -49
  94. package/dist/umd/robylon.js +0 -5545
  95. package/dist/umd/robylon.js.map +0 -1
  96. package/dist/umd/robylon.min.js +0 -20
  97. package/dist/umd/robylon.min.js.map +0 -1
  98. package/dist/umd/types/core/chatbotEmbed.d.ts +0 -59
  99. package/dist/umd/types/core/utils/color.d.ts +0 -1
  100. package/dist/umd/types/core/utils/cookies.d.ts +0 -30
  101. package/dist/umd/types/core/utils/environment.d.ts +0 -19
  102. package/dist/umd/types/core/utils/logger.d.ts +0 -37
  103. package/dist/umd/types/core/utils/system.d.ts +0 -22
  104. package/dist/umd/types/index.legacy.d.ts +0 -7
  105. package/dist/umd/types/index.react.d.ts +0 -9
  106. package/dist/umd/types/index.vanilla.d.ts +0 -32
  107. package/dist/umd/types/react/components/Chatbot.d.ts +0 -34
  108. package/dist/umd/types/react/components/ErrorBoundary.d.ts +0 -18
  109. package/dist/umd/types/types/config.d.ts +0 -33
  110. package/dist/umd/types/types/index.d.ts +0 -16
@@ -0,0 +1,12 @@
1
+ import React from "react";
2
+ import { ChatbotConfig } from "../../types";
3
+ interface ChatbotContainerProps {
4
+ children: React.ReactNode;
5
+ config: ChatbotConfig;
6
+ }
7
+ /**
8
+ * Container component that wraps the floating button and iframe
9
+ * to allow styling them as a single unit
10
+ */
11
+ declare const ChatbotContainer: React.FC<ChatbotContainerProps>;
12
+ export default ChatbotContainer;
@@ -0,0 +1 @@
1
+ export { default } from "./ChatbotContainer";
@@ -1,5 +1,5 @@
1
1
  export declare const CONFIG: {
2
2
  readonly copilotUrl: string | undefined;
3
3
  readonly environment: string | undefined;
4
- readonly apiUrl: string;
4
+ readonly apiUrl: string | undefined;
5
5
  };
@@ -0,0 +1,2 @@
1
+ export declare const FONT_FAMILY = "system-ui, Inter, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'";
2
+ export declare const FONT_LINE_HEIGHT = "21px";
@@ -1,56 +1,8 @@
1
1
  /**
2
- * Error codes for API operations
2
+ * Fetches the chatbot configuration from the API
3
+ * @param apiKey The API key for the chatbot
4
+ * @param userId The user ID (optional)
5
+ * @param userToken The user token (optional)
6
+ * @returns The chatbot configuration
3
7
  */
4
- export declare enum ApiErrorCode {
5
- NETWORK_ERROR = "NETWORK_ERROR",
6
- API_REQUEST_FAILED = "API_REQUEST_FAILED",
7
- INVALID_RESPONSE = "INVALID_RESPONSE",
8
- MISSING_API_KEY = "MISSING_API_KEY"
9
- }
10
- /**
11
- * Response from the chatbot API
12
- */
13
- export interface ChatbotApiResponse {
14
- user: {
15
- token: string;
16
- user_info: {
17
- email: string;
18
- user_id: string;
19
- name: string;
20
- };
21
- org_info: {
22
- org_id: string;
23
- org_name: string;
24
- role: string;
25
- auth_status: string;
26
- domain: string;
27
- brand_config: {
28
- display_name: string;
29
- redirect_url: string;
30
- colors?: {
31
- brand_color: string;
32
- title_bar_color?: string;
33
- };
34
- launcher_logo_url?: string;
35
- welcome_message: string;
36
- image_url: string;
37
- };
38
- };
39
- };
40
- }
41
- /**
42
- * API error class for better error handling
43
- */
44
- export declare class ApiError extends Error {
45
- code: ApiErrorCode;
46
- context: Record<string, any>;
47
- constructor(message: string, code: ApiErrorCode, context?: Record<string, any>);
48
- }
49
- /**
50
- * Fetch chatbot configuration from API
51
- */
52
- export declare const fetchChatbotConfig: (chatbotId: string, userId: string | null | number, token?: string) => Promise<ChatbotApiResponse>;
53
- /**
54
- * Record event logs with the API
55
- */
56
- export declare const recordEventLog: (apiKey: string, userId: string | null | number, eventType: string, eventData?: Record<string, any>, userProfile?: Record<string, any>) => Promise<boolean>;
8
+ export declare const fetchChatbotConfig: (apiKey: string, userId?: string, userToken?: string) => Promise<any>;
@@ -0,0 +1,34 @@
1
+ import { ChatbotConfig } from "../types";
2
+ /**
3
+ * Normalizes the configuration properties
4
+ * @param props The configuration properties
5
+ * @returns Normalized configuration properties
6
+ */
7
+ export declare const normalizeProps: (props: {
8
+ api_key: string;
9
+ user_id?: string | null | number;
10
+ user_token?: string;
11
+ user_profile?: Record<string, any>;
12
+ }) => {
13
+ api_key: string;
14
+ user_id: string | null;
15
+ user_token: string | undefined;
16
+ user_profile: Record<string, any>;
17
+ };
18
+ /**
19
+ * Normalizes the user profile by filtering allowed keys and converting values
20
+ * @param userProfile The user profile object
21
+ * @returns Normalized user profile
22
+ */
23
+ export declare const normalizeUserProfile: (userProfile?: Record<string, any>) => any;
24
+ /**
25
+ * Initializes the chatbot configuration
26
+ * @param props The configuration properties
27
+ * @returns The initialized chatbot configuration
28
+ */
29
+ export declare const initializeChatbotConfig: (props: {
30
+ api_key: string;
31
+ user_id?: string | null | number;
32
+ user_token?: string;
33
+ user_profile?: Record<string, any>;
34
+ }) => Promise<ChatbotConfig>;
@@ -0,0 +1,22 @@
1
+ import { ChatbotEvent, ChatbotEventType, AllEventTypes } from "../types/events";
2
+ /**
3
+ * Event emitter interface for handling chatbot events
4
+ */
5
+ export interface EventEmitter {
6
+ emit: (eventType: ChatbotEventType, data?: any) => void;
7
+ onInternalEvent: (eventType: AllEventTypes, additionalData?: Record<string, any>) => void;
8
+ }
9
+ /**
10
+ * Creates an event emitter for handling chatbot events
11
+ * @param props Configuration for the event emitter
12
+ * @returns An event emitter object
13
+ */
14
+ export declare const createEventEmitter: (props: {
15
+ api_key: string;
16
+ user_profile?: Record<string, any>;
17
+ onEvent?: (event: ChatbotEvent) => void;
18
+ chatbotConfig?: {
19
+ isAnonymous?: boolean;
20
+ userId?: string | null | number;
21
+ } | null;
22
+ }) => EventEmitter;
@@ -0,0 +1,4 @@
1
+ export * from "./api";
2
+ export * from "./config";
3
+ export * from "./events";
4
+ export * from "./state";
@@ -0,0 +1,34 @@
1
+ import { ChatbotConfig } from "../types";
2
+ /**
3
+ * Interface for the chatbot state
4
+ */
5
+ export interface ChatbotState {
6
+ isInitialized: boolean;
7
+ isInitializing: boolean;
8
+ error: string | null;
9
+ chatbotConfig: ChatbotConfig | null;
10
+ isIframeVisible: boolean;
11
+ }
12
+ /**
13
+ * Interface for the chatbot state manager
14
+ */
15
+ export interface ChatbotStateManager {
16
+ getState: () => ChatbotState;
17
+ initialize: () => Promise<void>;
18
+ toggleIframeVisibility: () => void;
19
+ closeIframe: () => void;
20
+ updateState: (partialState: Partial<ChatbotState>) => void;
21
+ subscribe: (listener: (state: ChatbotState) => void) => () => void;
22
+ unsubscribe: (listener: (state: ChatbotState) => void) => void;
23
+ }
24
+ /**
25
+ * Creates a state manager for the chatbot
26
+ * @param props Configuration properties
27
+ * @returns A state manager object
28
+ */
29
+ export declare const createChatbotStateManager: (props: {
30
+ api_key: string;
31
+ user_id?: string | null | number;
32
+ user_token?: string;
33
+ user_profile?: Record<string, any>;
34
+ }) => ChatbotStateManager;
@@ -1,9 +1,5 @@
1
- import { Chatbot as RobylonChatbot } from "./react/components/Chatbot";
2
- export declare const Chatbot: import("node_modules/@types/react").FC<import("./react/components/Chatbot").ChatbotProps>;
3
- export default RobylonChatbot;
4
- export type { ChatbotProps } from "./react/components/Chatbot";
5
- export declare const init: (config: Record<string, string>) => void;
6
- export declare const logging: {
7
- setEnabled: (enabled: boolean) => void;
8
- setLevel: (level: "debug" | "info" | "warn" | "error" | "none") => void;
9
- };
1
+ export { Chatbot } from "./components/RobylonChatbot";
2
+ export * from "./types";
3
+ export * from "./hooks/useChatbot";
4
+ import RobylonChatbot from "./vanilla";
5
+ export { RobylonChatbot };
@@ -1,12 +1,22 @@
1
- export * from "./types/events";
2
- export * from "./types/config";
3
- export * from "./types/state";
4
- import { ChatbotEvent } from "./core/chatbotEmbed";
5
- export type { ChatbotEvent };
6
- import { ChatbotProps } from "./react/components/Chatbot";
7
- export type { ChatbotProps };
8
- import { RobylonConfig, RobylonInstance } from "./vanilla";
9
- export type { RobylonConfig, RobylonInstance };
1
+ export declare enum ChatbotInterfaceType {
2
+ WIDGET = "WIDGET",
3
+ POPOVER = "POPOVER",
4
+ EMBED = "EMBED"
5
+ }
6
+ export declare enum WidgetPositionEnums {
7
+ RIGHT = "Right",
8
+ LEFT = "Left"
9
+ }
10
+ export interface WidgetInterfaceProperties {
11
+ position: WidgetPositionEnums;
12
+ side_spacing?: number;
13
+ bottom_spacing?: number;
14
+ }
15
+ export declare enum LauncherType {
16
+ TEXT = "TEXT",
17
+ IMAGE = "IMAGE",
18
+ TEXTUAL_IMAGE = "TEXTUAL_IMAGE"
19
+ }
10
20
  export interface ChatbotConfig {
11
21
  chatbotId: string;
12
22
  userId: string | null | number;
@@ -17,8 +27,22 @@ export interface ChatbotConfig {
17
27
  image_url?: string;
18
28
  chat_interface_config?: {
19
29
  chat_bubble_prompts?: string[];
30
+ display_name?: string;
31
+ welcome_message?: string;
32
+ redirect_url?: string;
20
33
  };
21
34
  isAnonymous?: boolean;
35
+ interface_type?: ChatbotInterfaceType;
36
+ interface_properties?: WidgetInterfaceProperties;
37
+ launcher_type: LauncherType;
38
+ launcher_properties: {
39
+ text?: string;
40
+ };
41
+ images: {
42
+ launcher_image_url?: {
43
+ url: string;
44
+ };
45
+ };
22
46
  }
23
47
  interface RobylonSdkConfig {
24
48
  chatbot_id: string;
@@ -44,3 +68,4 @@ declare global {
44
68
  initializeRobylonSdk: (config: RobylonSdkConfig) => void;
45
69
  }
46
70
  }
71
+ export {};
@@ -1,3 +1,4 @@
1
+ import { ChatbotInterfaceType, LauncherType, WidgetPositionEnums } from "../types";
1
2
  interface ChatbotResponse {
2
3
  user: {
3
4
  token: string;
@@ -22,6 +23,21 @@ interface ChatbotResponse {
22
23
  launcher_logo_url?: string;
23
24
  welcome_message: string;
24
25
  image_url: string;
26
+ interface_properties: {
27
+ position: WidgetPositionEnums;
28
+ side_spacing: number;
29
+ bottom_spacing: number;
30
+ };
31
+ interface_type: ChatbotInterfaceType;
32
+ launcher_type: LauncherType;
33
+ launcher_properties: {
34
+ text: string;
35
+ };
36
+ images: {
37
+ launcher_image_url: {
38
+ url: string;
39
+ };
40
+ };
25
41
  };
26
42
  };
27
43
  };
@@ -0,0 +1,45 @@
1
+ import { ChatbotConfig } from "../../types";
2
+ /**
3
+ * Class representing the ChatbotContainer component
4
+ * Container component that wraps the floating button and iframe
5
+ * to allow styling them as a single unit
6
+ */
7
+ export declare class ChatbotContainer {
8
+ private containerElement;
9
+ private resizeObserver;
10
+ private handleResizeFunction;
11
+ private config;
12
+ /**
13
+ * Creates a new ChatbotContainer
14
+ */
15
+ constructor(config: ChatbotConfig);
16
+ /**
17
+ * Renders the container element
18
+ */
19
+ private render;
20
+ /**
21
+ * Apply styles based on screen width
22
+ */
23
+ private applyStyles;
24
+ /**
25
+ * Handle resize event
26
+ */
27
+ private handleResize;
28
+ /**
29
+ * Set up resize listener to adjust styles on window resize
30
+ */
31
+ private setupResizeListener;
32
+ /**
33
+ * Mounts the container to the DOM
34
+ */
35
+ private mount;
36
+ /**
37
+ * Gets the container element
38
+ * @returns The container element
39
+ */
40
+ getElement(): HTMLDivElement;
41
+ /**
42
+ * Unmounts and destroys the container
43
+ */
44
+ destroy(): void;
45
+ }
@@ -0,0 +1,69 @@
1
+ import { ChatbotConfig } from "../../types";
2
+ import { ChatbotEventType, AllEventTypes } from "../../types/events";
3
+ /**
4
+ * Interface for the ChatbotFloatingButton configuration
5
+ */
6
+ interface ChatbotFloatingButtonConfig {
7
+ config: ChatbotConfig;
8
+ toggleIframe: () => void;
9
+ isIframeVisible: boolean;
10
+ onEvent?: (event: {
11
+ type: ChatbotEventType;
12
+ timestamp: number;
13
+ data?: any;
14
+ }) => void;
15
+ onInternalEvent: (eventType: AllEventTypes, additionalData?: Record<string, any>) => void;
16
+ }
17
+ /**
18
+ * Class representing the ChatbotFloatingButton component
19
+ */
20
+ export declare class ChatbotFloatingButton {
21
+ private buttonElement;
22
+ private config;
23
+ private resizeObserver;
24
+ private handleResizeFunction;
25
+ /**
26
+ * Creates a new ChatbotFloatingButton
27
+ * @param config The button configuration
28
+ */
29
+ constructor(config: ChatbotFloatingButtonConfig);
30
+ /**
31
+ * Renders the button element
32
+ */
33
+ private render;
34
+ private createLauncherElement;
35
+ private createTextLauncher;
36
+ private createTextualImageLauncher;
37
+ /**
38
+ * Apply responsive styles based on screen width
39
+ * @param baseStyles The base styles to apply
40
+ */
41
+ private applyResponsiveStyles;
42
+ /**
43
+ * Handle resize event
44
+ */
45
+ private handleResize;
46
+ /**
47
+ * Set up resize listener to adjust styles on window resize
48
+ */
49
+ private setupResizeListener;
50
+ /**
51
+ * Gets the button element
52
+ * @returns The button element
53
+ */
54
+ getElement(): HTMLDivElement;
55
+ /**
56
+ * Mounts the button to the DOM
57
+ */
58
+ private mount;
59
+ /**
60
+ * Updates the button with new configuration
61
+ * @param config The new configuration
62
+ */
63
+ update(config: Partial<ChatbotFloatingButtonConfig>): void;
64
+ /**
65
+ * Unmounts and destroys the button
66
+ */
67
+ destroy(): void;
68
+ }
69
+ export {};
@@ -0,0 +1,71 @@
1
+ import { ChatbotConfig } from "../../types";
2
+ import { ChatbotEventType, AllEventTypes } from "../../types/events";
3
+ /**
4
+ * Interface for the ChatbotIframe configuration
5
+ */
6
+ interface ChatbotIframeConfig {
7
+ config: ChatbotConfig;
8
+ isVisible: boolean;
9
+ onClose: () => void;
10
+ onEvent?: (event: {
11
+ type: ChatbotEventType;
12
+ timestamp: number;
13
+ data?: any;
14
+ }) => void;
15
+ onInternalEvent: (eventType: AllEventTypes, additionalData?: Record<string, any>) => void;
16
+ }
17
+ /**
18
+ * Class representing the ChatbotIframe component
19
+ */
20
+ export declare class ChatbotIframe {
21
+ private iframeElement;
22
+ private config;
23
+ private isInitialized;
24
+ private hasRegistered;
25
+ private resizeHandler;
26
+ /**
27
+ * Creates a new ChatbotIframe
28
+ * @param config The iframe configuration
29
+ */
30
+ constructor(config: ChatbotIframeConfig);
31
+ /**
32
+ * Gets the iframe element
33
+ * @returns The iframe element
34
+ */
35
+ getElement(): HTMLIFrameElement;
36
+ /**
37
+ * Renders the iframe element
38
+ */
39
+ private render;
40
+ /**
41
+ * Applies responsive styles based on window width
42
+ */
43
+ private applyResponsiveStyles;
44
+ /**
45
+ * Initializes the iframe
46
+ */
47
+ private initialize;
48
+ /**
49
+ * Sets up event listeners
50
+ */
51
+ private setupEventListeners;
52
+ /**
53
+ * Handles messages from the iframe
54
+ */
55
+ private handleMessage;
56
+ /**
57
+ * Updates the iframe visibility
58
+ * @param isVisible Whether the iframe should be visible
59
+ */
60
+ updateVisibility(isVisible: boolean): void;
61
+ /**
62
+ * Updates the iframe with new configuration
63
+ * @param config The new configuration
64
+ */
65
+ update(config: Partial<ChatbotIframeConfig>): void;
66
+ /**
67
+ * Unmounts and destroys the iframe
68
+ */
69
+ destroy(): void;
70
+ }
71
+ export {};
@@ -1,8 +1,8 @@
1
- import { ChatbotEvent } from "../core/chatbotEmbed";
1
+ import { ChatbotEvent } from "../types/events";
2
2
  /**
3
- * Robylon SDK configuration interface
3
+ * Interface for the RobylonChatbot configuration
4
4
  */
5
- export interface RobylonConfig {
5
+ export interface RobylonChatbotConfig {
6
6
  api_key: string;
7
7
  user_id?: string | null | number;
8
8
  user_token?: string;
@@ -10,37 +10,23 @@ export interface RobylonConfig {
10
10
  onEvent?: (event: ChatbotEvent) => void;
11
11
  }
12
12
  /**
13
- * Public API for the chatbot instance
13
+ * RobylonChatbot instance interface
14
14
  */
15
- export interface RobylonInstance {
16
- /**
17
- * Show the chatbot
18
- */
15
+ export interface RobylonChatbotInstance {
19
16
  show: () => void;
20
- /**
21
- * Hide the chatbot
22
- */
23
17
  hide: () => void;
24
- /**
25
- * Toggle the chatbot visibility
26
- */
27
18
  toggle: () => void;
28
- /**
29
- * Update the chatbot configuration
30
- */
31
- update: (config: Partial<RobylonConfig>) => void;
32
- /**
33
- * Destroy the chatbot instance and clean up
34
- */
35
19
  destroy: () => void;
20
+ getState: () => string;
36
21
  }
37
22
  /**
38
- * Initialize the SDK with custom environment settings
39
- * @internal This is primarily for internal use and advanced debugging.
40
- * Normal users should not need to call this function.
23
+ * Creates a new RobylonChatbot instance
24
+ * @param config The chatbot configuration
25
+ * @returns A RobylonChatbot instance
41
26
  */
42
- export declare function init(config: Record<string, string>): void;
43
- /**
44
- * Create a new Robylon chatbot instance
45
- */
46
- export declare function create(config: RobylonConfig): Promise<RobylonInstance>;
27
+ export declare function create(config: RobylonChatbotConfig): RobylonChatbotInstance;
28
+ declare const _default: {
29
+ create: typeof create;
30
+ getState: () => string;
31
+ };
32
+ export default _default;