@robylon/web-react-sdk 1.1.41 → 1.1.42-staging.22

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 (44) hide show
  1. package/dist/cjs/index.js +3 -1
  2. package/dist/cjs/index.js.map +1 -1
  3. package/dist/cjs/types/components/ChatbotIframe.d.ts +2 -0
  4. package/dist/cjs/types/components/RobylonChatbot.d.ts +10 -0
  5. package/dist/cjs/types/core/config.d.ts +7 -0
  6. package/dist/cjs/types/types.d.ts +30 -1
  7. package/dist/cjs/types/utils/fetchData.d.ts +1 -1
  8. package/dist/cjs/types/utils/mockProactive.d.ts +2 -0
  9. package/dist/cjs/types/utils/proactive.d.ts +16 -1
  10. package/dist/cjs/types/utils/sanitize.d.ts +4 -0
  11. package/dist/cjs/types/utils/url.d.ts +8 -0
  12. package/dist/cjs/types/vanilla/components/ChatbotFloatingButton.d.ts +8 -0
  13. package/dist/cjs/types/vanilla/components/ChatbotIframe.d.ts +11 -0
  14. package/dist/cjs/types/vanilla/index.d.ts +5 -0
  15. package/dist/esm/index.js +3 -1
  16. package/dist/esm/index.js.map +1 -1
  17. package/dist/esm/types/components/ChatbotIframe.d.ts +2 -0
  18. package/dist/esm/types/components/RobylonChatbot.d.ts +10 -0
  19. package/dist/esm/types/core/config.d.ts +7 -0
  20. package/dist/esm/types/types.d.ts +30 -1
  21. package/dist/esm/types/utils/fetchData.d.ts +1 -1
  22. package/dist/esm/types/utils/mockProactive.d.ts +2 -0
  23. package/dist/esm/types/utils/proactive.d.ts +16 -1
  24. package/dist/esm/types/utils/sanitize.d.ts +4 -0
  25. package/dist/esm/types/utils/url.d.ts +8 -0
  26. package/dist/esm/types/vanilla/components/ChatbotFloatingButton.d.ts +8 -0
  27. package/dist/esm/types/vanilla/components/ChatbotIframe.d.ts +11 -0
  28. package/dist/esm/types/vanilla/index.d.ts +5 -0
  29. package/dist/index.d.ts +46 -2
  30. package/dist/umd/robylon-chatbot.js +1 -1
  31. package/dist/umd/robylon-chatbot.js.map +1 -1
  32. package/dist/umd/types/components/ChatbotIframe.d.ts +2 -0
  33. package/dist/umd/types/components/RobylonChatbot.d.ts +10 -0
  34. package/dist/umd/types/core/config.d.ts +7 -0
  35. package/dist/umd/types/types.d.ts +30 -1
  36. package/dist/umd/types/utils/fetchData.d.ts +1 -1
  37. package/dist/umd/types/utils/mockProactive.d.ts +2 -0
  38. package/dist/umd/types/utils/proactive.d.ts +16 -1
  39. package/dist/umd/types/utils/sanitize.d.ts +4 -0
  40. package/dist/umd/types/utils/url.d.ts +8 -0
  41. package/dist/umd/types/vanilla/components/ChatbotFloatingButton.d.ts +8 -0
  42. package/dist/umd/types/vanilla/components/ChatbotIframe.d.ts +11 -0
  43. package/dist/umd/types/vanilla/index.d.ts +5 -0
  44. package/package.json +5 -3
@@ -1,6 +1,7 @@
1
1
  import React from "react";
2
2
  import { ChatbotConfig } from "../types";
3
3
  import { ChatbotEventHandler, AllEventTypes } from "../types/events";
4
+ import { Overrides } from "src/components/RobylonChatbot";
4
5
  interface ChatbotIframeProps {
5
6
  config: ChatbotConfig;
6
7
  isVisible: boolean;
@@ -9,6 +10,7 @@ interface ChatbotIframeProps {
9
10
  onInternalEvent: (eventType: AllEventTypes, additionalData?: Record<string, any>) => void;
10
11
  position?: "Left" | "Right";
11
12
  bottomSpacing?: number;
13
+ overrides?: Overrides;
12
14
  }
13
15
  declare const _default: React.NamedExoticComponent<ChatbotIframeProps>;
14
16
  export default _default;
@@ -1,5 +1,14 @@
1
1
  import React from "react";
2
2
  import { ChatbotEventHandler, ChatbotRef } from "../types/events";
3
+ export interface Overrides {
4
+ header_avatar?: string | null;
5
+ agent_avatar?: string | null;
6
+ header_title?: string | null;
7
+ header_subtitle?: string | null;
8
+ header_title_text_color?: string | null;
9
+ header_subtitle_text_color?: string | null;
10
+ header_bg?: string | null;
11
+ }
3
12
  interface ChatbotProps {
4
13
  api_key: string;
5
14
  user_id?: string | null | number;
@@ -12,6 +21,7 @@ interface ChatbotProps {
12
21
  show_launcher?: boolean | null;
13
22
  launcher_type?: "TEXT" | "IMAGE" | "TEXTUAL_IMAGE";
14
23
  launcher_properties_text?: string;
24
+ overrides?: Overrides;
15
25
  }
16
26
  declare const MemoizedRobylonChatbot: React.MemoExoticComponent<React.ForwardRefExoticComponent<ChatbotProps & React.RefAttributes<ChatbotRef>>>;
17
27
  export { MemoizedRobylonChatbot as Chatbot };
@@ -1,4 +1,5 @@
1
1
  import { ChatbotConfig } from "../types";
2
+ import { ProactiveMessage } from "src/types";
2
3
  /**
3
4
  * Normalizes the configuration properties
4
5
  * @param props The configuration properties
@@ -32,3 +33,9 @@ export declare const initializeChatbotConfig: (props: {
32
33
  user_token?: string;
33
34
  user_profile?: Record<string, any>;
34
35
  }) => Promise<ChatbotConfig>;
36
+ /**
37
+ * Normalizes proactive messages from backend to an array form, preserving order.
38
+ * - Accepts undefined, single object, or array of objects
39
+ * - Migrates legacy `content` to `content_multiple`
40
+ */
41
+ export declare const normalizeProactiveMessages: (input: any) => ProactiveMessage[] | undefined;
@@ -44,7 +44,7 @@ export interface ChatbotConfig {
44
44
  url: string;
45
45
  };
46
46
  };
47
- proactive_message_obj?: ProactiveMessage | undefined;
47
+ proactive_message_obj?: ProactiveMessage[] | undefined;
48
48
  launcher_delay: {
49
49
  enabled: boolean;
50
50
  delay: number;
@@ -78,6 +78,29 @@ export declare enum ProactiveSendTimeType {
78
78
  WORKING_HOURS = "WORKING_HOURS",
79
79
  ALWAYS = "ALWAYS"
80
80
  }
81
+ export declare enum DisplayAttributesType {
82
+ "URL" = "URL"
83
+ }
84
+ export declare enum LogicalConditionType {
85
+ AND = "AND",
86
+ OR = "OR"
87
+ }
88
+ export declare enum ConditionType {
89
+ IS = "IS",
90
+ IS_NOT = "IS_NOT",
91
+ CONTAINS = "CONTAINS",
92
+ DOES_NOT_CONTAIN = "DOES_NOT_CONTAIN",
93
+ STARTS_WITH = "STARTS_WITH",
94
+ ENDS_WITH = "ENDS_WITH"
95
+ }
96
+ export interface ContentDisplayAttribute {
97
+ type: DisplayAttributesType;
98
+ value: string;
99
+ condition: ConditionType;
100
+ }
101
+ export interface LogicalConditionAttribute {
102
+ logical_condition: LogicalConditionType;
103
+ }
81
104
  export interface ProactiveMessage {
82
105
  message_id: string;
83
106
  org_id: string;
@@ -88,5 +111,11 @@ export interface ProactiveMessage {
88
111
  updated_by_name?: string;
89
112
  updated_at?: string;
90
113
  created_at?: string;
114
+ delay?: number;
115
+ content_multiple?: {
116
+ message: string;
117
+ content_id?: string;
118
+ message_display_attributes: (ContentDisplayAttribute | LogicalConditionAttribute)[];
119
+ }[];
91
120
  }
92
121
  export {};
@@ -38,7 +38,7 @@ interface ChatbotResponse {
38
38
  url: string;
39
39
  };
40
40
  };
41
- proactive_message_obj?: ProactiveMessage;
41
+ proactive_message_obj?: ProactiveMessage | ProactiveMessage[];
42
42
  launcher_delay: {
43
43
  enabled: boolean;
44
44
  delay: number;
@@ -0,0 +1,2 @@
1
+ import { ProactiveMessage } from "src/types";
2
+ export declare const buildMockProactives: (orgId: string) => ProactiveMessage[];
@@ -1,4 +1,19 @@
1
1
  import { ProactiveMessage } from "src/types";
2
2
  export declare const hideProactiveForThisPage: () => void;
3
3
  export declare const isProactiveHiddenThisPage: () => boolean;
4
- export declare const shouldShowProactiveMessage: (message?: ProactiveMessage, now?: Date) => boolean;
4
+ export declare const setLastClickedProactive: (params: {
5
+ content_string: string | null;
6
+ message_id: string | null;
7
+ }) => void;
8
+ export declare const getAndClearLastClickedProactive: () => {
9
+ input_id: null;
10
+ content_string: string | null;
11
+ message_id: string | null;
12
+ } | null;
13
+ export interface VisibleContent {
14
+ messageId: string;
15
+ contentIndex: number;
16
+ html: string;
17
+ delayMs: number;
18
+ }
19
+ export declare const evaluateProactiveMessages: (messages?: ProactiveMessage[]) => VisibleContent[];
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Sanitizes HTML while preserving emojis and basic inline formatting.
3
+ */
4
+ export declare const sanitizeHtml: (html?: string) => string;
@@ -0,0 +1,8 @@
1
+ import { ConditionType, DisplayAttributesType } from "src/types";
2
+ type UrlChangeListener = (href: string) => void;
3
+ export declare const getCurrentHref: () => string;
4
+ export declare const buildLocationKey: () => string;
5
+ export declare const subscribeToUrlChanges: (cb: UrlChangeListener) => (() => void);
6
+ export declare const initUrlObserver: () => void;
7
+ export declare const matchCondition: (type: DisplayAttributesType, value: string, condition: ConditionType, href: string) => boolean;
8
+ export {};
@@ -26,6 +26,8 @@ export declare class ChatbotFloatingButton {
26
26
  private resizeObserver;
27
27
  private handleResizeFunction;
28
28
  private proactiveElement;
29
+ private urlUnsubscribe;
30
+ private delayTimers;
29
31
  /**
30
32
  * Creates a new ChatbotFloatingButton
31
33
  * @param config The button configuration
@@ -69,6 +71,12 @@ export declare class ChatbotFloatingButton {
69
71
  * Unmounts and destroys the button
70
72
  */
71
73
  destroy(): void;
74
+ private clearProactiveDelays;
75
+ /**
76
+ * Hides proactive messages with animation
77
+ */
78
+ private hideProactiveMessages;
79
+ private injectAnimationStyles;
72
80
  private renderProactiveIfNeeded;
73
81
  }
74
82
  export {};
@@ -1,5 +1,14 @@
1
1
  import { ChatbotConfig } from "../../types";
2
2
  import { ChatbotEventType, AllEventTypes } from "../../types/events";
3
+ interface Overrides {
4
+ header_avatar?: string | null;
5
+ agent_avatar?: string | null;
6
+ header_title?: string | null;
7
+ header_subtitle?: string | null;
8
+ header_title_text_color?: string | null;
9
+ header_subtitle_text_color?: string | null;
10
+ header_bg?: string | null;
11
+ }
3
12
  /**
4
13
  * Interface for the ChatbotIframe configuration
5
14
  */
@@ -15,6 +24,7 @@ interface ChatbotIframeConfig {
15
24
  onInternalEvent: (eventType: AllEventTypes, additionalData?: Record<string, any>) => void;
16
25
  position?: "Left" | "Right";
17
26
  bottomSpacing?: number;
27
+ overrides?: Overrides;
18
28
  }
19
29
  /**
20
30
  * Class representing the ChatbotIframe component
@@ -25,6 +35,7 @@ export declare class ChatbotIframe {
25
35
  private isInitialized;
26
36
  private hasRegistered;
27
37
  private resizeHandler;
38
+ private overridesPayloadCache;
28
39
  /**
29
40
  * Creates a new ChatbotIframe
30
41
  * @param config The iframe configuration
@@ -12,6 +12,11 @@ export interface RobylonChatbotConfig {
12
12
  sideSpacing?: number | string;
13
13
  bottomSpacing?: number | string;
14
14
  show_launcher?: boolean | null;
15
+ overrides?: {
16
+ header_avatar?: string | null;
17
+ agent_avatar?: string | null;
18
+ header_title?: string | null;
19
+ };
15
20
  }
16
21
  /**
17
22
  * RobylonChatbot instance interface
package/dist/index.d.ts CHANGED
@@ -25,6 +25,15 @@ interface ChatbotRef {
25
25
  isReady: boolean;
26
26
  }
27
27
 
28
+ interface Overrides {
29
+ header_avatar?: string | null;
30
+ agent_avatar?: string | null;
31
+ header_title?: string | null;
32
+ header_subtitle?: string | null;
33
+ header_title_text_color?: string | null;
34
+ header_subtitle_text_color?: string | null;
35
+ header_bg?: string | null;
36
+ }
28
37
  interface ChatbotProps {
29
38
  api_key: string;
30
39
  user_id?: string | null | number;
@@ -37,6 +46,7 @@ interface ChatbotProps {
37
46
  show_launcher?: boolean | null;
38
47
  launcher_type?: "TEXT" | "IMAGE" | "TEXTUAL_IMAGE";
39
48
  launcher_properties_text?: string;
49
+ overrides?: Overrides;
40
50
  }
41
51
  declare const MemoizedRobylonChatbot: React.MemoExoticComponent<React.ForwardRefExoticComponent<ChatbotProps & React.RefAttributes<ChatbotRef>>>;
42
52
 
@@ -86,7 +96,7 @@ interface ChatbotConfig {
86
96
  url: string;
87
97
  };
88
98
  };
89
- proactive_message_obj?: ProactiveMessage | undefined;
99
+ proactive_message_obj?: ProactiveMessage[] | undefined;
90
100
  launcher_delay: {
91
101
  enabled: boolean;
92
102
  delay: number;
@@ -120,6 +130,29 @@ declare enum ProactiveSendTimeType {
120
130
  WORKING_HOURS = "WORKING_HOURS",
121
131
  ALWAYS = "ALWAYS"
122
132
  }
133
+ declare enum DisplayAttributesType {
134
+ "URL" = "URL"
135
+ }
136
+ declare enum LogicalConditionType {
137
+ AND = "AND",
138
+ OR = "OR"
139
+ }
140
+ declare enum ConditionType {
141
+ IS = "IS",
142
+ IS_NOT = "IS_NOT",
143
+ CONTAINS = "CONTAINS",
144
+ DOES_NOT_CONTAIN = "DOES_NOT_CONTAIN",
145
+ STARTS_WITH = "STARTS_WITH",
146
+ ENDS_WITH = "ENDS_WITH"
147
+ }
148
+ interface ContentDisplayAttribute {
149
+ type: DisplayAttributesType;
150
+ value: string;
151
+ condition: ConditionType;
152
+ }
153
+ interface LogicalConditionAttribute {
154
+ logical_condition: LogicalConditionType;
155
+ }
123
156
  interface ProactiveMessage {
124
157
  message_id: string;
125
158
  org_id: string;
@@ -130,6 +163,12 @@ interface ProactiveMessage {
130
163
  updated_by_name?: string;
131
164
  updated_at?: string;
132
165
  created_at?: string;
166
+ delay?: number;
167
+ content_multiple?: {
168
+ message: string;
169
+ content_id?: string;
170
+ message_display_attributes: (ContentDisplayAttribute | LogicalConditionAttribute)[];
171
+ }[];
133
172
  }
134
173
 
135
174
  declare const useChatbot: (config: ChatbotConfig) => ChatbotState;
@@ -147,6 +186,11 @@ interface RobylonChatbotConfig {
147
186
  sideSpacing?: number | string;
148
187
  bottomSpacing?: number | string;
149
188
  show_launcher?: boolean | null;
189
+ overrides?: {
190
+ header_avatar?: string | null;
191
+ agent_avatar?: string | null;
192
+ header_title?: string | null;
193
+ };
150
194
  }
151
195
  /**
152
196
  * RobylonChatbot instance interface
@@ -169,4 +213,4 @@ declare const _default: {
169
213
  getState: () => string;
170
214
  };
171
215
 
172
- export { MemoizedRobylonChatbot as Chatbot, type ChatbotConfig, ChatbotInterfaceType, type ChatbotRef, type ChatbotState, LauncherType, type ProactiveMessage, ProactiveSendTimeType, _default as RobylonChatbot, type WidgetInterfaceProperties, WidgetPositionEnums, useChatbot };
216
+ export { MemoizedRobylonChatbot as Chatbot, type ChatbotConfig, ChatbotInterfaceType, type ChatbotRef, type ChatbotState, ConditionType, type ContentDisplayAttribute, DisplayAttributesType, LauncherType, type LogicalConditionAttribute, LogicalConditionType, type ProactiveMessage, ProactiveSendTimeType, _default as RobylonChatbot, type WidgetInterfaceProperties, WidgetPositionEnums, useChatbot };