@robylon/web-react-sdk 1.1.41-staging.5 → 1.1.41-staging.8
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.
- package/README.md +136 -19
- package/dist/cjs/index.js +3 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/components/ChatbotFloatingButton.d.ts +3 -0
- package/dist/cjs/types/components/ChatbotIframe.d.ts +2 -0
- package/dist/cjs/types/components/RobylonChatbot.d.ts +6 -3
- package/dist/cjs/types/core/config.d.ts +7 -0
- package/dist/cjs/types/index.d.ts +1 -0
- package/dist/cjs/types/types/events.d.ts +8 -1
- package/dist/cjs/types/types.d.ts +50 -0
- package/dist/cjs/types/utils/fetchData.d.ts +7 -1
- package/dist/cjs/types/utils/launcherInfo.d.ts +9 -0
- package/dist/cjs/types/utils/mockProactive.d.ts +2 -0
- package/dist/cjs/types/utils/proactive.d.ts +19 -0
- package/dist/cjs/types/utils/sanitize.d.ts +4 -0
- package/dist/cjs/types/utils/url.d.ts +8 -0
- package/dist/cjs/types/vanilla/components/ChatbotFloatingButton.d.ts +6 -0
- package/dist/cjs/types/vanilla/components/ChatbotIframe.d.ts +2 -0
- package/dist/esm/index.js +3 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/components/ChatbotFloatingButton.d.ts +3 -0
- package/dist/esm/types/components/ChatbotIframe.d.ts +2 -0
- package/dist/esm/types/components/RobylonChatbot.d.ts +6 -3
- package/dist/esm/types/core/config.d.ts +7 -0
- package/dist/esm/types/index.d.ts +1 -0
- package/dist/esm/types/types/events.d.ts +8 -1
- package/dist/esm/types/types.d.ts +50 -0
- package/dist/esm/types/utils/fetchData.d.ts +7 -1
- package/dist/esm/types/utils/launcherInfo.d.ts +9 -0
- package/dist/esm/types/utils/mockProactive.d.ts +2 -0
- package/dist/esm/types/utils/proactive.d.ts +19 -0
- package/dist/esm/types/utils/sanitize.d.ts +4 -0
- package/dist/esm/types/utils/url.d.ts +8 -0
- package/dist/esm/types/vanilla/components/ChatbotFloatingButton.d.ts +6 -0
- package/dist/esm/types/vanilla/components/ChatbotIframe.d.ts +2 -0
- package/dist/index.d.ts +63 -3
- package/dist/umd/robylon-chatbot.js +1 -1
- package/dist/umd/robylon-chatbot.js.map +1 -1
- package/dist/umd/types/components/ChatbotFloatingButton.d.ts +3 -0
- package/dist/umd/types/components/ChatbotIframe.d.ts +2 -0
- package/dist/umd/types/components/RobylonChatbot.d.ts +6 -3
- package/dist/umd/types/core/config.d.ts +7 -0
- package/dist/umd/types/index.d.ts +1 -0
- package/dist/umd/types/types/events.d.ts +8 -1
- package/dist/umd/types/types.d.ts +50 -0
- package/dist/umd/types/utils/fetchData.d.ts +7 -1
- package/dist/umd/types/utils/launcherInfo.d.ts +9 -0
- package/dist/umd/types/utils/mockProactive.d.ts +2 -0
- package/dist/umd/types/utils/proactive.d.ts +19 -0
- package/dist/umd/types/utils/sanitize.d.ts +4 -0
- package/dist/umd/types/utils/url.d.ts +8 -0
- package/dist/umd/types/vanilla/components/ChatbotFloatingButton.d.ts +6 -0
- package/dist/umd/types/vanilla/components/ChatbotIframe.d.ts +2 -0
- package/package.json +7 -5
|
@@ -10,6 +10,9 @@ interface ChatbotFloatingButtonProps {
|
|
|
10
10
|
position?: "Left" | "Right";
|
|
11
11
|
sideSpacing?: number;
|
|
12
12
|
bottomSpacing?: number;
|
|
13
|
+
launcher_type?: "TEXT" | "IMAGE" | "TEXTUAL_IMAGE";
|
|
14
|
+
launcher_properties_text?: string;
|
|
15
|
+
shouldFadeIn?: boolean;
|
|
13
16
|
}
|
|
14
17
|
declare const _default: React.NamedExoticComponent<ChatbotFloatingButtonProps>;
|
|
15
18
|
export default _default;
|
|
@@ -7,6 +7,8 @@ interface ChatbotIframeProps {
|
|
|
7
7
|
onClose: () => void;
|
|
8
8
|
onEvent?: ChatbotEventHandler;
|
|
9
9
|
onInternalEvent: (eventType: AllEventTypes, additionalData?: Record<string, any>) => void;
|
|
10
|
+
position?: "Left" | "Right";
|
|
11
|
+
bottomSpacing?: number;
|
|
10
12
|
}
|
|
11
13
|
declare const _default: React.NamedExoticComponent<ChatbotIframeProps>;
|
|
12
14
|
export default _default;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { ChatbotEventHandler } from "../types/events";
|
|
2
|
+
import { ChatbotEventHandler, ChatbotRef } from "../types/events";
|
|
3
3
|
interface ChatbotProps {
|
|
4
4
|
api_key: string;
|
|
5
5
|
user_id?: string | null | number;
|
|
@@ -9,6 +9,9 @@ interface ChatbotProps {
|
|
|
9
9
|
position?: "Left" | "Right";
|
|
10
10
|
sideSpacing?: number;
|
|
11
11
|
bottomSpacing?: number;
|
|
12
|
+
show_launcher?: boolean;
|
|
13
|
+
launcher_type?: "TEXT" | "IMAGE" | "TEXTUAL_IMAGE";
|
|
14
|
+
launcher_properties_text?: string;
|
|
12
15
|
}
|
|
13
|
-
declare const
|
|
14
|
-
export {
|
|
16
|
+
declare const MemoizedRobylonChatbot: React.MemoExoticComponent<React.ForwardRefExoticComponent<ChatbotProps & React.RefAttributes<ChatbotRef>>>;
|
|
17
|
+
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;
|
|
@@ -7,7 +7,8 @@ export declare enum ChatbotEventType {
|
|
|
7
7
|
CHATBOT_LOADED = "CHATBOT_LOADED",// From Robylon Chatbot
|
|
8
8
|
CHAT_INITIALIZED = "CHAT_INITIALIZED",// From Robylon Chatbot
|
|
9
9
|
SESSION_REFRESHED = "SESSION_REFRESHED",// From Robylon Chatbot
|
|
10
|
-
CHAT_INITIALIZATION_FAILED = "CHAT_INITIALIZATION_FAILED"
|
|
10
|
+
CHAT_INITIALIZATION_FAILED = "CHAT_INITIALIZATION_FAILED",// From Robylon Chatbot
|
|
11
|
+
CHATBOT_READY = "CHATBOT_READY"
|
|
11
12
|
}
|
|
12
13
|
export declare enum InternalEventType {
|
|
13
14
|
CHAT_MOVED = "CHAT_MOVED",// Internal only event
|
|
@@ -20,3 +21,9 @@ export interface ChatbotEvent {
|
|
|
20
21
|
data?: any;
|
|
21
22
|
}
|
|
22
23
|
export type ChatbotEventHandler = (event: ChatbotEvent) => void;
|
|
24
|
+
export interface ChatbotRef {
|
|
25
|
+
show: () => void;
|
|
26
|
+
hide: () => void;
|
|
27
|
+
toggle: () => void;
|
|
28
|
+
isReady: boolean;
|
|
29
|
+
}
|
|
@@ -23,6 +23,7 @@ export interface ChatbotConfig {
|
|
|
23
23
|
token?: string;
|
|
24
24
|
userProfile?: Record<string, any>;
|
|
25
25
|
domain: string;
|
|
26
|
+
show_launcher: boolean;
|
|
26
27
|
brand_colour: string;
|
|
27
28
|
image_url?: string;
|
|
28
29
|
chat_interface_config?: {
|
|
@@ -43,6 +44,11 @@ export interface ChatbotConfig {
|
|
|
43
44
|
url: string;
|
|
44
45
|
};
|
|
45
46
|
};
|
|
47
|
+
proactive_message_obj?: ProactiveMessage[] | undefined;
|
|
48
|
+
launcher_delay: {
|
|
49
|
+
enabled: boolean;
|
|
50
|
+
delay: number;
|
|
51
|
+
};
|
|
46
52
|
}
|
|
47
53
|
interface RobylonSdkConfig {
|
|
48
54
|
chatbot_id: string;
|
|
@@ -68,4 +74,48 @@ declare global {
|
|
|
68
74
|
initializeRobylonSdk: (config: RobylonSdkConfig) => void;
|
|
69
75
|
}
|
|
70
76
|
}
|
|
77
|
+
export declare enum ProactiveSendTimeType {
|
|
78
|
+
WORKING_HOURS = "WORKING_HOURS",
|
|
79
|
+
ALWAYS = "ALWAYS"
|
|
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
|
+
}
|
|
104
|
+
export interface ProactiveMessage {
|
|
105
|
+
message_id: string;
|
|
106
|
+
org_id: string;
|
|
107
|
+
name?: string;
|
|
108
|
+
content?: string;
|
|
109
|
+
send_time_type?: ProactiveSendTimeType | string;
|
|
110
|
+
created_by_name?: string;
|
|
111
|
+
updated_by_name?: string;
|
|
112
|
+
updated_at?: string;
|
|
113
|
+
created_at?: string;
|
|
114
|
+
delay?: number;
|
|
115
|
+
content_multiple?: {
|
|
116
|
+
message: string;
|
|
117
|
+
content_id?: string;
|
|
118
|
+
message_display_attributes: (ContentDisplayAttribute | LogicalConditionAttribute)[];
|
|
119
|
+
}[];
|
|
120
|
+
}
|
|
71
121
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ChatbotInterfaceType, LauncherType, WidgetPositionEnums } from "../types";
|
|
1
|
+
import { ChatbotInterfaceType, LauncherType, WidgetPositionEnums, ProactiveMessage } from "../types";
|
|
2
2
|
interface ChatbotResponse {
|
|
3
3
|
user: {
|
|
4
4
|
token: string;
|
|
@@ -38,7 +38,13 @@ interface ChatbotResponse {
|
|
|
38
38
|
url: string;
|
|
39
39
|
};
|
|
40
40
|
};
|
|
41
|
+
proactive_message_obj?: ProactiveMessage | ProactiveMessage[];
|
|
42
|
+
launcher_delay: {
|
|
43
|
+
enabled: boolean;
|
|
44
|
+
delay: number;
|
|
45
|
+
};
|
|
41
46
|
};
|
|
47
|
+
show_launcher: boolean;
|
|
42
48
|
};
|
|
43
49
|
};
|
|
44
50
|
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ProactiveMessage } from "src/types";
|
|
2
|
+
export declare const hideProactiveForThisPage: () => void;
|
|
3
|
+
export declare const isProactiveHiddenThisPage: () => 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,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 {};
|
|
@@ -25,6 +25,9 @@ export declare class ChatbotFloatingButton {
|
|
|
25
25
|
private config;
|
|
26
26
|
private resizeObserver;
|
|
27
27
|
private handleResizeFunction;
|
|
28
|
+
private proactiveElement;
|
|
29
|
+
private urlUnsubscribe;
|
|
30
|
+
private delayTimers;
|
|
28
31
|
/**
|
|
29
32
|
* Creates a new ChatbotFloatingButton
|
|
30
33
|
* @param config The button configuration
|
|
@@ -68,5 +71,8 @@ export declare class ChatbotFloatingButton {
|
|
|
68
71
|
* Unmounts and destroys the button
|
|
69
72
|
*/
|
|
70
73
|
destroy(): void;
|
|
74
|
+
private clearProactiveDelays;
|
|
75
|
+
private injectAnimationStyles;
|
|
76
|
+
private renderProactiveIfNeeded;
|
|
71
77
|
}
|
|
72
78
|
export {};
|
|
@@ -13,6 +13,8 @@ interface ChatbotIframeConfig {
|
|
|
13
13
|
data?: any;
|
|
14
14
|
}) => void;
|
|
15
15
|
onInternalEvent: (eventType: AllEventTypes, additionalData?: Record<string, any>) => void;
|
|
16
|
+
position?: "Left" | "Right";
|
|
17
|
+
bottomSpacing?: number;
|
|
16
18
|
}
|
|
17
19
|
/**
|
|
18
20
|
* Class representing the ChatbotIframe component
|
package/dist/index.d.ts
CHANGED
|
@@ -9,7 +9,8 @@ declare enum ChatbotEventType {
|
|
|
9
9
|
CHATBOT_LOADED = "CHATBOT_LOADED",// From Robylon Chatbot
|
|
10
10
|
CHAT_INITIALIZED = "CHAT_INITIALIZED",// From Robylon Chatbot
|
|
11
11
|
SESSION_REFRESHED = "SESSION_REFRESHED",// From Robylon Chatbot
|
|
12
|
-
CHAT_INITIALIZATION_FAILED = "CHAT_INITIALIZATION_FAILED"
|
|
12
|
+
CHAT_INITIALIZATION_FAILED = "CHAT_INITIALIZATION_FAILED",// From Robylon Chatbot
|
|
13
|
+
CHATBOT_READY = "CHATBOT_READY"
|
|
13
14
|
}
|
|
14
15
|
interface ChatbotEvent {
|
|
15
16
|
type: ChatbotEventType;
|
|
@@ -17,6 +18,12 @@ interface ChatbotEvent {
|
|
|
17
18
|
data?: any;
|
|
18
19
|
}
|
|
19
20
|
type ChatbotEventHandler = (event: ChatbotEvent) => void;
|
|
21
|
+
interface ChatbotRef {
|
|
22
|
+
show: () => void;
|
|
23
|
+
hide: () => void;
|
|
24
|
+
toggle: () => void;
|
|
25
|
+
isReady: boolean;
|
|
26
|
+
}
|
|
20
27
|
|
|
21
28
|
interface ChatbotProps {
|
|
22
29
|
api_key: string;
|
|
@@ -27,8 +34,11 @@ interface ChatbotProps {
|
|
|
27
34
|
position?: "Left" | "Right";
|
|
28
35
|
sideSpacing?: number;
|
|
29
36
|
bottomSpacing?: number;
|
|
37
|
+
show_launcher?: boolean;
|
|
38
|
+
launcher_type?: "TEXT" | "IMAGE" | "TEXTUAL_IMAGE";
|
|
39
|
+
launcher_properties_text?: string;
|
|
30
40
|
}
|
|
31
|
-
declare const
|
|
41
|
+
declare const MemoizedRobylonChatbot: React.MemoExoticComponent<React.ForwardRefExoticComponent<ChatbotProps & React.RefAttributes<ChatbotRef>>>;
|
|
32
42
|
|
|
33
43
|
declare enum ChatbotInterfaceType {
|
|
34
44
|
WIDGET = "WIDGET",
|
|
@@ -55,6 +65,7 @@ interface ChatbotConfig {
|
|
|
55
65
|
token?: string;
|
|
56
66
|
userProfile?: Record<string, any>;
|
|
57
67
|
domain: string;
|
|
68
|
+
show_launcher: boolean;
|
|
58
69
|
brand_colour: string;
|
|
59
70
|
image_url?: string;
|
|
60
71
|
chat_interface_config?: {
|
|
@@ -75,6 +86,11 @@ interface ChatbotConfig {
|
|
|
75
86
|
url: string;
|
|
76
87
|
};
|
|
77
88
|
};
|
|
89
|
+
proactive_message_obj?: ProactiveMessage[] | undefined;
|
|
90
|
+
launcher_delay: {
|
|
91
|
+
enabled: boolean;
|
|
92
|
+
delay: number;
|
|
93
|
+
};
|
|
78
94
|
}
|
|
79
95
|
interface RobylonSdkConfig {
|
|
80
96
|
chatbot_id: string;
|
|
@@ -100,6 +116,50 @@ declare global {
|
|
|
100
116
|
initializeRobylonSdk: (config: RobylonSdkConfig) => void;
|
|
101
117
|
}
|
|
102
118
|
}
|
|
119
|
+
declare enum ProactiveSendTimeType {
|
|
120
|
+
WORKING_HOURS = "WORKING_HOURS",
|
|
121
|
+
ALWAYS = "ALWAYS"
|
|
122
|
+
}
|
|
123
|
+
declare enum DisplayAttributesType {
|
|
124
|
+
"URL" = "URL"
|
|
125
|
+
}
|
|
126
|
+
declare enum LogicalConditionType {
|
|
127
|
+
AND = "AND",
|
|
128
|
+
OR = "OR"
|
|
129
|
+
}
|
|
130
|
+
declare enum ConditionType {
|
|
131
|
+
IS = "IS",
|
|
132
|
+
IS_NOT = "IS_NOT",
|
|
133
|
+
CONTAINS = "CONTAINS",
|
|
134
|
+
DOES_NOT_CONTAIN = "DOES_NOT_CONTAIN",
|
|
135
|
+
STARTS_WITH = "STARTS_WITH",
|
|
136
|
+
ENDS_WITH = "ENDS_WITH"
|
|
137
|
+
}
|
|
138
|
+
interface ContentDisplayAttribute {
|
|
139
|
+
type: DisplayAttributesType;
|
|
140
|
+
value: string;
|
|
141
|
+
condition: ConditionType;
|
|
142
|
+
}
|
|
143
|
+
interface LogicalConditionAttribute {
|
|
144
|
+
logical_condition: LogicalConditionType;
|
|
145
|
+
}
|
|
146
|
+
interface ProactiveMessage {
|
|
147
|
+
message_id: string;
|
|
148
|
+
org_id: string;
|
|
149
|
+
name?: string;
|
|
150
|
+
content?: string;
|
|
151
|
+
send_time_type?: ProactiveSendTimeType | string;
|
|
152
|
+
created_by_name?: string;
|
|
153
|
+
updated_by_name?: string;
|
|
154
|
+
updated_at?: string;
|
|
155
|
+
created_at?: string;
|
|
156
|
+
delay?: number;
|
|
157
|
+
content_multiple?: {
|
|
158
|
+
message: string;
|
|
159
|
+
content_id?: string;
|
|
160
|
+
message_display_attributes: (ContentDisplayAttribute | LogicalConditionAttribute)[];
|
|
161
|
+
}[];
|
|
162
|
+
}
|
|
103
163
|
|
|
104
164
|
declare const useChatbot: (config: ChatbotConfig) => ChatbotState;
|
|
105
165
|
|
|
@@ -137,4 +197,4 @@ declare const _default: {
|
|
|
137
197
|
getState: () => string;
|
|
138
198
|
};
|
|
139
199
|
|
|
140
|
-
export {
|
|
200
|
+
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 };
|