@robylon/web-react-sdk 1.1.28-staging.8 → 1.1.29

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 (120) hide show
  1. package/README.md +443 -32
  2. package/dist/cjs/index.js +1 -1215
  3. package/dist/cjs/index.js.map +1 -1
  4. package/dist/cjs/types/components/ChatbotContainer/ChatbotContainer.d.ts +15 -0
  5. package/dist/cjs/types/components/ChatbotContainer/index.d.ts +1 -0
  6. package/dist/cjs/types/components/ChatbotFloatingButton.d.ts +3 -0
  7. package/dist/cjs/types/components/ChatbotIframe.d.ts +2 -0
  8. package/dist/cjs/types/components/RobylonChatbot.d.ts +3 -0
  9. package/dist/cjs/types/config.d.ts +1 -1
  10. package/dist/cjs/types/constants/fontStyles.d.ts +2 -0
  11. package/dist/cjs/types/core/api.d.ts +6 -54
  12. package/dist/cjs/types/core/config.d.ts +34 -0
  13. package/dist/cjs/types/core/events.d.ts +22 -0
  14. package/dist/cjs/types/core/index.d.ts +4 -0
  15. package/dist/cjs/types/core/state.d.ts +34 -0
  16. package/dist/cjs/types/index.d.ts +5 -9
  17. package/dist/cjs/types/types.d.ts +34 -9
  18. package/dist/cjs/types/utils/fetchData.d.ts +16 -0
  19. package/dist/cjs/types/vanilla/components/ChatbotContainer.d.ts +45 -0
  20. package/dist/cjs/types/vanilla/components/ChatbotFloatingButton.d.ts +72 -0
  21. package/dist/cjs/types/vanilla/components/ChatbotIframe.d.ts +73 -0
  22. package/dist/cjs/types/vanilla/index.d.ts +18 -29
  23. package/dist/esm/index.js +1 -1208
  24. package/dist/esm/index.js.map +1 -1
  25. package/dist/esm/types/components/ChatbotContainer/ChatbotContainer.d.ts +15 -0
  26. package/dist/esm/types/components/ChatbotContainer/index.d.ts +1 -0
  27. package/dist/esm/types/components/ChatbotFloatingButton.d.ts +3 -0
  28. package/dist/esm/types/components/ChatbotIframe.d.ts +2 -0
  29. package/dist/esm/types/components/RobylonChatbot.d.ts +3 -0
  30. package/dist/esm/types/config.d.ts +1 -1
  31. package/dist/esm/types/constants/fontStyles.d.ts +2 -0
  32. package/dist/esm/types/core/api.d.ts +6 -54
  33. package/dist/esm/types/core/config.d.ts +34 -0
  34. package/dist/esm/types/core/events.d.ts +22 -0
  35. package/dist/esm/types/core/index.d.ts +4 -0
  36. package/dist/esm/types/core/state.d.ts +34 -0
  37. package/dist/esm/types/index.d.ts +5 -9
  38. package/dist/esm/types/types.d.ts +34 -9
  39. package/dist/esm/types/utils/fetchData.d.ts +16 -0
  40. package/dist/esm/types/vanilla/components/ChatbotContainer.d.ts +45 -0
  41. package/dist/esm/types/vanilla/components/ChatbotFloatingButton.d.ts +72 -0
  42. package/dist/esm/types/vanilla/components/ChatbotIframe.d.ts +73 -0
  43. package/dist/esm/types/vanilla/index.d.ts +18 -29
  44. package/dist/index.d.ts +115 -57
  45. package/dist/umd/robylon-chatbot.js +2 -0
  46. package/dist/umd/robylon-chatbot.js.map +1 -0
  47. package/dist/umd/types/components/ChatbotContainer/ChatbotContainer.d.ts +15 -0
  48. package/dist/umd/types/components/ChatbotContainer/index.d.ts +1 -0
  49. package/dist/umd/types/components/ChatbotFloatingButton.d.ts +3 -0
  50. package/dist/umd/types/components/ChatbotIframe.d.ts +2 -0
  51. package/dist/umd/types/components/RobylonChatbot.d.ts +3 -0
  52. package/dist/umd/types/config.d.ts +1 -1
  53. package/dist/umd/types/constants/fontStyles.d.ts +2 -0
  54. package/dist/umd/types/core/api.d.ts +6 -54
  55. package/dist/umd/types/core/config.d.ts +34 -0
  56. package/dist/umd/types/core/events.d.ts +22 -0
  57. package/dist/umd/types/core/index.d.ts +4 -0
  58. package/dist/umd/types/core/state.d.ts +34 -0
  59. package/dist/umd/types/index.d.ts +5 -9
  60. package/dist/umd/types/types.d.ts +34 -9
  61. package/dist/umd/types/utils/fetchData.d.ts +16 -0
  62. package/dist/umd/types/vanilla/components/ChatbotContainer.d.ts +45 -0
  63. package/dist/umd/types/vanilla/components/ChatbotFloatingButton.d.ts +72 -0
  64. package/dist/umd/types/vanilla/components/ChatbotIframe.d.ts +73 -0
  65. package/dist/umd/types/vanilla/index.d.ts +18 -29
  66. package/package.json +30 -85
  67. package/dist/cjs/legacy.js +0 -2
  68. package/dist/cjs/legacy.js.map +0 -1
  69. package/dist/cjs/react.js +0 -2
  70. package/dist/cjs/react.js.map +0 -1
  71. package/dist/cjs/types/core/chatbotEmbed.d.ts +0 -59
  72. package/dist/cjs/types/core/utils/color.d.ts +0 -1
  73. package/dist/cjs/types/core/utils/cookies.d.ts +0 -30
  74. package/dist/cjs/types/core/utils/environment.d.ts +0 -19
  75. package/dist/cjs/types/core/utils/logger.d.ts +0 -37
  76. package/dist/cjs/types/core/utils/system.d.ts +0 -22
  77. package/dist/cjs/types/index.legacy.d.ts +0 -7
  78. package/dist/cjs/types/index.react.d.ts +0 -9
  79. package/dist/cjs/types/index.vanilla.d.ts +0 -32
  80. package/dist/cjs/types/react/components/Chatbot.d.ts +0 -34
  81. package/dist/cjs/types/react/components/ErrorBoundary.d.ts +0 -18
  82. package/dist/cjs/types/types/config.d.ts +0 -33
  83. package/dist/cjs/types/types/index.d.ts +0 -16
  84. package/dist/esm/legacy.js +0 -2
  85. package/dist/esm/legacy.js.map +0 -1
  86. package/dist/esm/react.js +0 -2
  87. package/dist/esm/react.js.map +0 -1
  88. package/dist/esm/types/core/chatbotEmbed.d.ts +0 -59
  89. package/dist/esm/types/core/utils/color.d.ts +0 -1
  90. package/dist/esm/types/core/utils/cookies.d.ts +0 -30
  91. package/dist/esm/types/core/utils/environment.d.ts +0 -19
  92. package/dist/esm/types/core/utils/logger.d.ts +0 -37
  93. package/dist/esm/types/core/utils/system.d.ts +0 -22
  94. package/dist/esm/types/index.legacy.d.ts +0 -7
  95. package/dist/esm/types/index.react.d.ts +0 -9
  96. package/dist/esm/types/index.vanilla.d.ts +0 -32
  97. package/dist/esm/types/react/components/Chatbot.d.ts +0 -34
  98. package/dist/esm/types/react/components/ErrorBoundary.d.ts +0 -18
  99. package/dist/esm/types/types/config.d.ts +0 -33
  100. package/dist/esm/types/types/index.d.ts +0 -16
  101. package/dist/legacy.d.ts +0 -160
  102. package/dist/react.d.ts +0 -49
  103. package/dist/umd/robylon.js +0 -1230
  104. package/dist/umd/robylon.js.map +0 -1
  105. package/dist/umd/robylon.min.js +0 -2
  106. package/dist/umd/robylon.min.js.map +0 -1
  107. package/dist/umd/types/core/chatbotEmbed.d.ts +0 -59
  108. package/dist/umd/types/core/utils/color.d.ts +0 -1
  109. package/dist/umd/types/core/utils/cookies.d.ts +0 -30
  110. package/dist/umd/types/core/utils/environment.d.ts +0 -19
  111. package/dist/umd/types/core/utils/logger.d.ts +0 -37
  112. package/dist/umd/types/core/utils/system.d.ts +0 -22
  113. package/dist/umd/types/index.legacy.d.ts +0 -7
  114. package/dist/umd/types/index.react.d.ts +0 -9
  115. package/dist/umd/types/index.vanilla.d.ts +0 -32
  116. package/dist/umd/types/react/components/Chatbot.d.ts +0 -34
  117. package/dist/umd/types/react/components/ErrorBoundary.d.ts +0 -18
  118. package/dist/umd/types/types/config.d.ts +0 -33
  119. package/dist/umd/types/types/index.d.ts +0 -16
  120. package/dist/vite-compat.js +0 -76
@@ -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, position?: "Left" | "Right", sideSpacing?: number, bottomSpacing?: number);
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,72 @@
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
+ position?: "Left" | "Right";
17
+ sideSpacing?: number;
18
+ bottomSpacing?: number;
19
+ }
20
+ /**
21
+ * Class representing the ChatbotFloatingButton component
22
+ */
23
+ export declare class ChatbotFloatingButton {
24
+ private buttonElement;
25
+ private config;
26
+ private resizeObserver;
27
+ private handleResizeFunction;
28
+ /**
29
+ * Creates a new ChatbotFloatingButton
30
+ * @param config The button configuration
31
+ */
32
+ constructor(config: ChatbotFloatingButtonConfig);
33
+ /**
34
+ * Renders the button element
35
+ */
36
+ private render;
37
+ private createLauncherElement;
38
+ private createTextLauncher;
39
+ private createTextualImageLauncher;
40
+ /**
41
+ * Apply responsive styles based on screen width
42
+ * @param baseStyles The base styles to apply
43
+ */
44
+ private applyResponsiveStyles;
45
+ /**
46
+ * Handle resize event
47
+ */
48
+ private handleResize;
49
+ /**
50
+ * Set up resize listener to adjust styles on window resize
51
+ */
52
+ private setupResizeListener;
53
+ /**
54
+ * Gets the button element
55
+ * @returns The button element
56
+ */
57
+ getElement(): HTMLDivElement;
58
+ /**
59
+ * Mounts the button to the DOM
60
+ */
61
+ private mount;
62
+ /**
63
+ * Updates the button with new configuration
64
+ * @param config The new configuration
65
+ */
66
+ update(config: Partial<ChatbotFloatingButtonConfig>): void;
67
+ /**
68
+ * Unmounts and destroys the button
69
+ */
70
+ destroy(): void;
71
+ }
72
+ export {};
@@ -0,0 +1,73 @@
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
+ position?: "Left" | "Right";
17
+ bottomSpacing?: number;
18
+ }
19
+ /**
20
+ * Class representing the ChatbotIframe component
21
+ */
22
+ export declare class ChatbotIframe {
23
+ private iframeElement;
24
+ private config;
25
+ private isInitialized;
26
+ private hasRegistered;
27
+ private resizeHandler;
28
+ /**
29
+ * Creates a new ChatbotIframe
30
+ * @param config The iframe configuration
31
+ */
32
+ constructor(config: ChatbotIframeConfig);
33
+ /**
34
+ * Gets the iframe element
35
+ * @returns The iframe element
36
+ */
37
+ getElement(): HTMLIFrameElement;
38
+ /**
39
+ * Renders the iframe element
40
+ */
41
+ private render;
42
+ /**
43
+ * Applies responsive styles based on window width
44
+ */
45
+ private applyResponsiveStyles;
46
+ /**
47
+ * Initializes the iframe
48
+ */
49
+ private initialize;
50
+ /**
51
+ * Sets up event listeners
52
+ */
53
+ private setupEventListeners;
54
+ /**
55
+ * Handles messages from the iframe
56
+ */
57
+ private handleMessage;
58
+ /**
59
+ * Updates the iframe visibility
60
+ * @param isVisible Whether the iframe should be visible
61
+ */
62
+ updateVisibility(isVisible: boolean): void;
63
+ /**
64
+ * Updates the iframe with new configuration
65
+ * @param config The new configuration
66
+ */
67
+ update(config: Partial<ChatbotIframeConfig>): void;
68
+ /**
69
+ * Unmounts and destroys the iframe
70
+ */
71
+ destroy(): void;
72
+ }
73
+ export {};
@@ -1,46 +1,35 @@
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;
9
9
  user_profile?: Record<string, any>;
10
10
  onEvent?: (event: ChatbotEvent) => void;
11
+ position?: "Left" | "Right" | string;
12
+ sideSpacing?: number | string;
13
+ bottomSpacing?: number | string;
11
14
  }
12
15
  /**
13
- * Public API for the chatbot instance
16
+ * RobylonChatbot instance interface
14
17
  */
15
- export interface RobylonInstance {
16
- /**
17
- * Show the chatbot
18
- */
18
+ export interface RobylonChatbotInstance {
19
19
  show: () => void;
20
- /**
21
- * Hide the chatbot
22
- */
23
20
  hide: () => void;
24
- /**
25
- * Toggle the chatbot visibility
26
- */
27
21
  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
22
  destroy: () => void;
23
+ getState: () => string;
36
24
  }
37
25
  /**
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.
26
+ * Creates a new RobylonChatbot instance
27
+ * @param config The chatbot configuration
28
+ * @returns A RobylonChatbot instance
41
29
  */
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>;
30
+ export declare function create(config: RobylonChatbotConfig): RobylonChatbotInstance;
31
+ declare const _default: {
32
+ create: typeof create;
33
+ getState: () => string;
34
+ };
35
+ export default _default;