@robylon/web-react-sdk 1.1.28-staging.8 → 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 (111) hide show
  1. package/README.md +402 -34
  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 +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 -1208
  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 +109 -57
  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 -85
  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 -1230
  95. package/dist/umd/robylon.js.map +0 -1
  96. package/dist/umd/robylon.min.js +0 -2
  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
  111. package/dist/vite-compat.js +0 -76
@@ -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;