@robylon/whatsapp-react-sdk 1.0.0-staging.1
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/CONTRIBUTING.md +133 -0
- package/README.md +736 -0
- package/dist/cjs/index.js +4 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/types/components/ChatWidgetPopup.d.ts +8 -0
- package/dist/cjs/types/components/ChatbotContainer/ChatbotContainer.d.ts +15 -0
- package/dist/cjs/types/components/ChatbotContainer/index.d.ts +1 -0
- package/dist/cjs/types/components/ChatbotFloatingButton.d.ts +19 -0
- package/dist/cjs/types/components/ErrorBoundary.d.ts +15 -0
- package/dist/cjs/types/components/RobylonChatbot.d.ts +28 -0
- package/dist/cjs/types/config.d.ts +5 -0
- package/dist/cjs/types/constants/errorConstants.d.ts +60 -0
- package/dist/cjs/types/constants/fontStyles.d.ts +4 -0
- package/dist/cjs/types/core/api.d.ts +10 -0
- package/dist/cjs/types/core/config.d.ts +41 -0
- package/dist/cjs/types/core/events.d.ts +22 -0
- package/dist/cjs/types/core/index.d.ts +4 -0
- package/dist/cjs/types/core/state.d.ts +34 -0
- package/dist/cjs/types/hooks/useChatbot.d.ts +2 -0
- package/dist/cjs/types/hooks/useChatbotEvents.d.ts +12 -0
- package/dist/cjs/types/hooks/useChatbotState.d.ts +16 -0
- package/dist/cjs/types/hooks/useWhyDidYouUpdate.d.ts +5 -0
- package/dist/cjs/types/index.d.ts +6 -0
- package/dist/cjs/types/services/ErrorTrackingService.d.ts +38 -0
- package/dist/cjs/types/types/events.d.ts +29 -0
- package/dist/cjs/types/types/state.d.ts +5 -0
- package/dist/cjs/types/types.d.ts +137 -0
- package/dist/cjs/types/utils/chatbotSdk.d.ts +23 -0
- package/dist/cjs/types/utils/colorUtils.d.ts +1 -0
- package/dist/cjs/types/utils/cookieUtils.d.ts +6 -0
- package/dist/cjs/types/utils/environment.d.ts +12 -0
- package/dist/cjs/types/utils/fetchData.d.ts +53 -0
- package/dist/cjs/types/utils/launcherInfo.d.ts +11 -0
- package/dist/cjs/types/utils/logger.d.ts +6 -0
- package/dist/cjs/types/utils/misc.d.ts +1 -0
- package/dist/cjs/types/utils/originalFetchDataFile.d.ts +1 -0
- package/dist/cjs/types/utils/proactive.d.ts +25 -0
- package/dist/cjs/types/utils/sanitize.d.ts +4 -0
- package/dist/cjs/types/utils/systemInfo.d.ts +12 -0
- package/dist/cjs/types/utils/textDirection.d.ts +7 -0
- package/dist/cjs/types/utils/url.d.ts +8 -0
- package/dist/cjs/types/utils/version.d.ts +1 -0
- package/dist/cjs/types/vanilla/components/ChatWidgetPopup.d.ts +17 -0
- package/dist/cjs/types/vanilla/components/ChatbotContainer.d.ts +45 -0
- package/dist/cjs/types/vanilla/components/ChatbotFloatingButton.d.ts +83 -0
- package/dist/cjs/types/vanilla/index.d.ts +42 -0
- package/dist/esm/index.js +4 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/types/components/ChatWidgetPopup.d.ts +8 -0
- package/dist/esm/types/components/ChatbotContainer/ChatbotContainer.d.ts +15 -0
- package/dist/esm/types/components/ChatbotContainer/index.d.ts +1 -0
- package/dist/esm/types/components/ChatbotFloatingButton.d.ts +19 -0
- package/dist/esm/types/components/ErrorBoundary.d.ts +15 -0
- package/dist/esm/types/components/RobylonChatbot.d.ts +28 -0
- package/dist/esm/types/config.d.ts +5 -0
- package/dist/esm/types/constants/errorConstants.d.ts +60 -0
- package/dist/esm/types/constants/fontStyles.d.ts +4 -0
- package/dist/esm/types/core/api.d.ts +10 -0
- package/dist/esm/types/core/config.d.ts +41 -0
- package/dist/esm/types/core/events.d.ts +22 -0
- package/dist/esm/types/core/index.d.ts +4 -0
- package/dist/esm/types/core/state.d.ts +34 -0
- package/dist/esm/types/hooks/useChatbot.d.ts +2 -0
- package/dist/esm/types/hooks/useChatbotEvents.d.ts +12 -0
- package/dist/esm/types/hooks/useChatbotState.d.ts +16 -0
- package/dist/esm/types/hooks/useWhyDidYouUpdate.d.ts +5 -0
- package/dist/esm/types/index.d.ts +6 -0
- package/dist/esm/types/services/ErrorTrackingService.d.ts +38 -0
- package/dist/esm/types/types/events.d.ts +29 -0
- package/dist/esm/types/types/state.d.ts +5 -0
- package/dist/esm/types/types.d.ts +137 -0
- package/dist/esm/types/utils/chatbotSdk.d.ts +23 -0
- package/dist/esm/types/utils/colorUtils.d.ts +1 -0
- package/dist/esm/types/utils/cookieUtils.d.ts +6 -0
- package/dist/esm/types/utils/environment.d.ts +12 -0
- package/dist/esm/types/utils/fetchData.d.ts +53 -0
- package/dist/esm/types/utils/launcherInfo.d.ts +11 -0
- package/dist/esm/types/utils/logger.d.ts +6 -0
- package/dist/esm/types/utils/misc.d.ts +1 -0
- package/dist/esm/types/utils/originalFetchDataFile.d.ts +1 -0
- package/dist/esm/types/utils/proactive.d.ts +25 -0
- package/dist/esm/types/utils/sanitize.d.ts +4 -0
- package/dist/esm/types/utils/systemInfo.d.ts +12 -0
- package/dist/esm/types/utils/textDirection.d.ts +7 -0
- package/dist/esm/types/utils/url.d.ts +8 -0
- package/dist/esm/types/utils/version.d.ts +1 -0
- package/dist/esm/types/vanilla/components/ChatWidgetPopup.d.ts +17 -0
- package/dist/esm/types/vanilla/components/ChatbotContainer.d.ts +45 -0
- package/dist/esm/types/vanilla/components/ChatbotFloatingButton.d.ts +83 -0
- package/dist/esm/types/vanilla/index.d.ts +42 -0
- package/dist/index.d.ts +235 -0
- package/dist/umd/robylon-chatbot.js +2 -0
- package/dist/umd/robylon-chatbot.js.map +1 -0
- package/dist/umd/types/components/ChatWidgetPopup.d.ts +8 -0
- package/dist/umd/types/components/ChatbotContainer/ChatbotContainer.d.ts +15 -0
- package/dist/umd/types/components/ChatbotContainer/index.d.ts +1 -0
- package/dist/umd/types/components/ChatbotFloatingButton.d.ts +19 -0
- package/dist/umd/types/components/ErrorBoundary.d.ts +15 -0
- package/dist/umd/types/components/RobylonChatbot.d.ts +28 -0
- package/dist/umd/types/config.d.ts +5 -0
- package/dist/umd/types/constants/errorConstants.d.ts +60 -0
- package/dist/umd/types/constants/fontStyles.d.ts +4 -0
- package/dist/umd/types/core/api.d.ts +10 -0
- package/dist/umd/types/core/config.d.ts +41 -0
- package/dist/umd/types/core/events.d.ts +22 -0
- package/dist/umd/types/core/index.d.ts +4 -0
- package/dist/umd/types/core/state.d.ts +34 -0
- package/dist/umd/types/hooks/useChatbot.d.ts +2 -0
- package/dist/umd/types/hooks/useChatbotEvents.d.ts +12 -0
- package/dist/umd/types/hooks/useChatbotState.d.ts +16 -0
- package/dist/umd/types/hooks/useWhyDidYouUpdate.d.ts +5 -0
- package/dist/umd/types/index.d.ts +6 -0
- package/dist/umd/types/services/ErrorTrackingService.d.ts +38 -0
- package/dist/umd/types/types/events.d.ts +29 -0
- package/dist/umd/types/types/state.d.ts +5 -0
- package/dist/umd/types/types.d.ts +137 -0
- package/dist/umd/types/utils/chatbotSdk.d.ts +23 -0
- package/dist/umd/types/utils/colorUtils.d.ts +1 -0
- package/dist/umd/types/utils/cookieUtils.d.ts +6 -0
- package/dist/umd/types/utils/environment.d.ts +12 -0
- package/dist/umd/types/utils/fetchData.d.ts +53 -0
- package/dist/umd/types/utils/launcherInfo.d.ts +11 -0
- package/dist/umd/types/utils/logger.d.ts +6 -0
- package/dist/umd/types/utils/misc.d.ts +1 -0
- package/dist/umd/types/utils/originalFetchDataFile.d.ts +1 -0
- package/dist/umd/types/utils/proactive.d.ts +25 -0
- package/dist/umd/types/utils/sanitize.d.ts +4 -0
- package/dist/umd/types/utils/systemInfo.d.ts +12 -0
- package/dist/umd/types/utils/textDirection.d.ts +7 -0
- package/dist/umd/types/utils/url.d.ts +8 -0
- package/dist/umd/types/utils/version.d.ts +1 -0
- package/dist/umd/types/vanilla/components/ChatWidgetPopup.d.ts +17 -0
- package/dist/umd/types/vanilla/components/ChatbotContainer.d.ts +45 -0
- package/dist/umd/types/vanilla/components/ChatbotFloatingButton.d.ts +83 -0
- package/dist/umd/types/vanilla/index.d.ts +42 -0
- package/package.json +110 -0
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ProactiveMessage, MessageDisplayType } 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
|
+
content_id: string | null;
|
|
8
|
+
}) => void;
|
|
9
|
+
export declare const getAndClearLastClickedProactive: () => {
|
|
10
|
+
input_id: null;
|
|
11
|
+
content_string: string | null;
|
|
12
|
+
message_id: string | null;
|
|
13
|
+
content_id?: string | null;
|
|
14
|
+
} | null;
|
|
15
|
+
export interface VisibleContent {
|
|
16
|
+
messageId: string;
|
|
17
|
+
contentIndex: number;
|
|
18
|
+
html: string;
|
|
19
|
+
delayMs: number;
|
|
20
|
+
contentId: string | null;
|
|
21
|
+
messageDisplayType: MessageDisplayType;
|
|
22
|
+
messageBubbleBg?: string;
|
|
23
|
+
urlToGo?: string;
|
|
24
|
+
}
|
|
25
|
+
export declare const evaluateProactiveMessages: (messages?: ProactiveMessage[]) => VisibleContent[];
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Detects if text contains RTL (Right-to-Left) characters
|
|
3
|
+
* Supports Arabic, Hebrew, Persian/Farsi, Urdu, Yiddish, and other RTL scripts
|
|
4
|
+
* @param text - The text to analyze
|
|
5
|
+
* @returns "rtl" if RTL characters are dominant, "ltr" otherwise
|
|
6
|
+
*/
|
|
7
|
+
export declare function detectTextDirection(text?: string): 'rtl' | 'ltr';
|
|
@@ -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 {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const SDK_VERSION: string;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ChatbotConfig } from "../../types";
|
|
2
|
+
interface ChatWidgetPopupConfig {
|
|
3
|
+
config: ChatbotConfig;
|
|
4
|
+
onCtaClick: () => void;
|
|
5
|
+
}
|
|
6
|
+
export declare class ChatWidgetPopup {
|
|
7
|
+
private popupElement;
|
|
8
|
+
private config;
|
|
9
|
+
constructor(config: ChatWidgetPopupConfig);
|
|
10
|
+
private createTitleBar;
|
|
11
|
+
private createContent;
|
|
12
|
+
private render;
|
|
13
|
+
getElement(): HTMLDivElement;
|
|
14
|
+
update(config: ChatWidgetPopupConfig): void;
|
|
15
|
+
destroy(): void;
|
|
16
|
+
}
|
|
17
|
+
export {};
|
|
@@ -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,83 @@
|
|
|
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
|
+
launcher_size?: number;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Class representing the ChatbotFloatingButton component
|
|
23
|
+
*/
|
|
24
|
+
export declare class ChatbotFloatingButton {
|
|
25
|
+
private buttonElement;
|
|
26
|
+
private config;
|
|
27
|
+
private resizeObserver;
|
|
28
|
+
private handleResizeFunction;
|
|
29
|
+
private proactiveElement;
|
|
30
|
+
private urlUnsubscribe;
|
|
31
|
+
private delayTimers;
|
|
32
|
+
/**
|
|
33
|
+
* Creates a new ChatbotFloatingButton
|
|
34
|
+
* @param config The button configuration
|
|
35
|
+
*/
|
|
36
|
+
constructor(config: ChatbotFloatingButtonConfig);
|
|
37
|
+
/**
|
|
38
|
+
* Renders the button element
|
|
39
|
+
*/
|
|
40
|
+
private render;
|
|
41
|
+
private createLauncherElement;
|
|
42
|
+
private createTextLauncher;
|
|
43
|
+
private createTextualImageLauncher;
|
|
44
|
+
/**
|
|
45
|
+
* Apply responsive styles based on screen width
|
|
46
|
+
* @param baseStyles The base styles to apply
|
|
47
|
+
*/
|
|
48
|
+
private applyResponsiveStyles;
|
|
49
|
+
/**
|
|
50
|
+
* Handle resize event
|
|
51
|
+
*/
|
|
52
|
+
private handleResize;
|
|
53
|
+
/**
|
|
54
|
+
* Set up resize listener to adjust styles on window resize
|
|
55
|
+
*/
|
|
56
|
+
private setupResizeListener;
|
|
57
|
+
/**
|
|
58
|
+
* Gets the button element
|
|
59
|
+
* @returns The button element
|
|
60
|
+
*/
|
|
61
|
+
getElement(): HTMLDivElement;
|
|
62
|
+
/**
|
|
63
|
+
* Mounts the button to the DOM
|
|
64
|
+
*/
|
|
65
|
+
private mount;
|
|
66
|
+
/**
|
|
67
|
+
* Updates the button with new configuration
|
|
68
|
+
* @param config The new configuration
|
|
69
|
+
*/
|
|
70
|
+
update(config: Partial<ChatbotFloatingButtonConfig>): void;
|
|
71
|
+
/**
|
|
72
|
+
* Unmounts and destroys the button
|
|
73
|
+
*/
|
|
74
|
+
destroy(): void;
|
|
75
|
+
private clearProactiveDelays;
|
|
76
|
+
/**
|
|
77
|
+
* Hides proactive messages with animation
|
|
78
|
+
*/
|
|
79
|
+
private hideProactiveMessages;
|
|
80
|
+
private injectAnimationStyles;
|
|
81
|
+
private renderProactiveIfNeeded;
|
|
82
|
+
}
|
|
83
|
+
export {};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { ChatbotEvent } from "../types/events";
|
|
2
|
+
/**
|
|
3
|
+
* Interface for the RobylonChatbot configuration
|
|
4
|
+
*/
|
|
5
|
+
export interface RobylonChatbotConfig {
|
|
6
|
+
api_key: string;
|
|
7
|
+
user_id?: string | null | number;
|
|
8
|
+
user_token?: string;
|
|
9
|
+
user_profile?: Record<string, any>;
|
|
10
|
+
onEvent?: (event: ChatbotEvent) => void;
|
|
11
|
+
position?: "Left" | "Right" | string;
|
|
12
|
+
sideSpacing?: number | string;
|
|
13
|
+
bottomSpacing?: number | string;
|
|
14
|
+
show_launcher?: boolean | null;
|
|
15
|
+
overrides?: {
|
|
16
|
+
header_avatar?: string | null;
|
|
17
|
+
agent_avatar?: string | null;
|
|
18
|
+
header_title?: string | null;
|
|
19
|
+
};
|
|
20
|
+
launcher_size?: number;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* RobylonChatbot instance interface
|
|
24
|
+
*/
|
|
25
|
+
export interface RobylonChatbotInstance {
|
|
26
|
+
show: () => void;
|
|
27
|
+
hide: () => void;
|
|
28
|
+
toggle: () => void;
|
|
29
|
+
destroy: () => void;
|
|
30
|
+
getState: () => string;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Creates a new RobylonChatbot instance
|
|
34
|
+
* @param config The chatbot configuration
|
|
35
|
+
* @returns A RobylonChatbot instance
|
|
36
|
+
*/
|
|
37
|
+
export declare function create(config: RobylonChatbotConfig): RobylonChatbotInstance;
|
|
38
|
+
declare const _default: {
|
|
39
|
+
create: typeof create;
|
|
40
|
+
getState: () => string;
|
|
41
|
+
};
|
|
42
|
+
export default _default;
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
declare enum ChatbotEventType {
|
|
4
|
+
CHATBOT_BUTTON_LOADED = "CHATBOT_BUTTON_LOADED",// Internal SDK event
|
|
5
|
+
CHATBOT_BUTTON_CLICKED = "CHATBOT_BUTTON_CLICKED",// Internal SDK event
|
|
6
|
+
CHATBOT_OPENED = "CHATBOT_OPENED",// Internal SDK event
|
|
7
|
+
CHATBOT_CLOSED = "CHATBOT_CLOSED",// Internal SDK event
|
|
8
|
+
CHATBOT_APP_READY = "CHATBOT_APP_READY",// Internal SDK event
|
|
9
|
+
CHATBOT_LOADED = "CHATBOT_LOADED",// From Robylon Chatbot
|
|
10
|
+
CHAT_INITIALIZED = "CHAT_INITIALIZED",// From Robylon Chatbot
|
|
11
|
+
SESSION_REFRESHED = "SESSION_REFRESHED",// From Robylon Chatbot
|
|
12
|
+
CHAT_INITIALIZATION_FAILED = "CHAT_INITIALIZATION_FAILED",// From Robylon Chatbot
|
|
13
|
+
CHATBOT_READY = "CHATBOT_READY"
|
|
14
|
+
}
|
|
15
|
+
interface ChatbotEvent {
|
|
16
|
+
type: ChatbotEventType;
|
|
17
|
+
timestamp: number;
|
|
18
|
+
data?: any;
|
|
19
|
+
}
|
|
20
|
+
type ChatbotEventHandler = (event: ChatbotEvent) => void;
|
|
21
|
+
interface ChatbotRef {
|
|
22
|
+
show: () => void;
|
|
23
|
+
hide: () => void;
|
|
24
|
+
toggle: () => void;
|
|
25
|
+
isReady: boolean;
|
|
26
|
+
}
|
|
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
|
+
}
|
|
37
|
+
interface ChatbotProps {
|
|
38
|
+
api_key: string;
|
|
39
|
+
user_id?: string | null | number;
|
|
40
|
+
user_token?: string;
|
|
41
|
+
user_profile?: Record<string, any>;
|
|
42
|
+
onEvent?: ChatbotEventHandler;
|
|
43
|
+
position?: "Left" | "Right";
|
|
44
|
+
sideSpacing?: number;
|
|
45
|
+
bottomSpacing?: number;
|
|
46
|
+
show_launcher?: boolean | null;
|
|
47
|
+
launcher_type?: "TEXT" | "IMAGE" | "TEXTUAL_IMAGE";
|
|
48
|
+
launcher_properties_text?: string;
|
|
49
|
+
overrides?: Overrides;
|
|
50
|
+
launcher_size?: number;
|
|
51
|
+
}
|
|
52
|
+
declare const MemoizedRobylonChatbot: React.MemoExoticComponent<React.ForwardRefExoticComponent<ChatbotProps & React.RefAttributes<ChatbotRef>>>;
|
|
53
|
+
|
|
54
|
+
declare enum ChatbotInterfaceType {
|
|
55
|
+
WIDGET = "WIDGET",
|
|
56
|
+
POPOVER = "POPOVER",
|
|
57
|
+
EMBED = "EMBED"
|
|
58
|
+
}
|
|
59
|
+
declare enum WidgetPositionEnums {
|
|
60
|
+
RIGHT = "Right",
|
|
61
|
+
LEFT = "Left"
|
|
62
|
+
}
|
|
63
|
+
interface WidgetInterfaceProperties {
|
|
64
|
+
position: WidgetPositionEnums;
|
|
65
|
+
side_spacing?: number;
|
|
66
|
+
bottom_spacing?: number;
|
|
67
|
+
}
|
|
68
|
+
declare enum LauncherType {
|
|
69
|
+
TEXT = "TEXT",
|
|
70
|
+
IMAGE = "IMAGE",
|
|
71
|
+
TEXTUAL_IMAGE = "TEXTUAL_IMAGE"
|
|
72
|
+
}
|
|
73
|
+
interface ChatbotConfig {
|
|
74
|
+
chatbotId: string;
|
|
75
|
+
userId: string | null | number;
|
|
76
|
+
token?: string;
|
|
77
|
+
userProfile?: Record<string, any>;
|
|
78
|
+
domain: string;
|
|
79
|
+
show_launcher: boolean;
|
|
80
|
+
brand_colour: string;
|
|
81
|
+
image_url?: string;
|
|
82
|
+
chat_interface_config?: {
|
|
83
|
+
chat_bubble_prompts?: string[];
|
|
84
|
+
display_name?: string;
|
|
85
|
+
welcome_message?: string;
|
|
86
|
+
redirect_url?: string;
|
|
87
|
+
};
|
|
88
|
+
isAnonymous?: boolean;
|
|
89
|
+
interface_type?: ChatbotInterfaceType;
|
|
90
|
+
interface_properties?: WidgetInterfaceProperties;
|
|
91
|
+
launcher_type: LauncherType;
|
|
92
|
+
launcher_properties: {
|
|
93
|
+
text?: string;
|
|
94
|
+
};
|
|
95
|
+
images: {
|
|
96
|
+
launcher_image_url?: {
|
|
97
|
+
url: string;
|
|
98
|
+
};
|
|
99
|
+
};
|
|
100
|
+
proactive_message_obj?: ProactiveMessage[] | undefined;
|
|
101
|
+
launcher_delay: {
|
|
102
|
+
enabled: boolean;
|
|
103
|
+
delay: number;
|
|
104
|
+
};
|
|
105
|
+
launcher_size_multiplier?: number;
|
|
106
|
+
redirect_chat_link?: string;
|
|
107
|
+
pre_filled_message?: string;
|
|
108
|
+
widget_type?: string;
|
|
109
|
+
widget_title?: string;
|
|
110
|
+
widget_subtitle?: string;
|
|
111
|
+
title_bar_color?: string;
|
|
112
|
+
button_content?: string;
|
|
113
|
+
powered_by_robylon?: boolean;
|
|
114
|
+
}
|
|
115
|
+
interface RobylonSdkConfig {
|
|
116
|
+
chatbot_id: string;
|
|
117
|
+
user_id: string;
|
|
118
|
+
token?: string;
|
|
119
|
+
user_profile?: {
|
|
120
|
+
email?: string;
|
|
121
|
+
name?: string;
|
|
122
|
+
mobile?: string;
|
|
123
|
+
platform: string;
|
|
124
|
+
OS: string;
|
|
125
|
+
browser: string;
|
|
126
|
+
sdk_version: string;
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
interface ChatbotState {
|
|
130
|
+
isLoading: boolean;
|
|
131
|
+
isInitialized: boolean;
|
|
132
|
+
error: string | null;
|
|
133
|
+
}
|
|
134
|
+
declare global {
|
|
135
|
+
interface Window {
|
|
136
|
+
initializeRobylonSdk: (config: RobylonSdkConfig) => void;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
declare enum ProactiveSendTimeType {
|
|
140
|
+
WORKING_HOURS = "WORKING_HOURS",
|
|
141
|
+
ALWAYS = "ALWAYS"
|
|
142
|
+
}
|
|
143
|
+
declare enum DisplayAttributesType {
|
|
144
|
+
"URL" = "URL"
|
|
145
|
+
}
|
|
146
|
+
declare enum LogicalConditionType {
|
|
147
|
+
AND = "AND",
|
|
148
|
+
OR = "OR"
|
|
149
|
+
}
|
|
150
|
+
declare enum ConditionType {
|
|
151
|
+
IS = "IS",
|
|
152
|
+
IS_NOT = "IS_NOT",
|
|
153
|
+
CONTAINS = "CONTAINS",
|
|
154
|
+
DOES_NOT_CONTAIN = "DOES_NOT_CONTAIN",
|
|
155
|
+
STARTS_WITH = "STARTS_WITH",
|
|
156
|
+
ENDS_WITH = "ENDS_WITH"
|
|
157
|
+
}
|
|
158
|
+
declare enum MessageDisplayType {
|
|
159
|
+
BUTTON = "BUTTON",
|
|
160
|
+
TEXT = "TEXT"
|
|
161
|
+
}
|
|
162
|
+
interface ContentDisplayAttribute {
|
|
163
|
+
type: DisplayAttributesType;
|
|
164
|
+
value: string;
|
|
165
|
+
condition: ConditionType;
|
|
166
|
+
}
|
|
167
|
+
interface LogicalConditionAttribute {
|
|
168
|
+
logical_condition: LogicalConditionType;
|
|
169
|
+
}
|
|
170
|
+
interface ProactiveMessage {
|
|
171
|
+
message_id: string;
|
|
172
|
+
org_id: string;
|
|
173
|
+
name?: string;
|
|
174
|
+
content?: string;
|
|
175
|
+
send_time_type?: ProactiveSendTimeType | string;
|
|
176
|
+
created_by_name?: string;
|
|
177
|
+
updated_by_name?: string;
|
|
178
|
+
updated_at?: string;
|
|
179
|
+
created_at?: string;
|
|
180
|
+
delay?: number;
|
|
181
|
+
content_multiple?: {
|
|
182
|
+
message: string;
|
|
183
|
+
content_id?: string;
|
|
184
|
+
message_display_type?: MessageDisplayType;
|
|
185
|
+
message_bubble_bg?: string;
|
|
186
|
+
url_to_go?: string;
|
|
187
|
+
message_display_attributes: (ContentDisplayAttribute | LogicalConditionAttribute)[];
|
|
188
|
+
}[];
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
declare const useChatbot: (config: ChatbotConfig) => ChatbotState;
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* Interface for the RobylonChatbot configuration
|
|
195
|
+
*/
|
|
196
|
+
interface RobylonChatbotConfig {
|
|
197
|
+
api_key: string;
|
|
198
|
+
user_id?: string | null | number;
|
|
199
|
+
user_token?: string;
|
|
200
|
+
user_profile?: Record<string, any>;
|
|
201
|
+
onEvent?: (event: ChatbotEvent) => void;
|
|
202
|
+
position?: "Left" | "Right" | string;
|
|
203
|
+
sideSpacing?: number | string;
|
|
204
|
+
bottomSpacing?: number | string;
|
|
205
|
+
show_launcher?: boolean | null;
|
|
206
|
+
overrides?: {
|
|
207
|
+
header_avatar?: string | null;
|
|
208
|
+
agent_avatar?: string | null;
|
|
209
|
+
header_title?: string | null;
|
|
210
|
+
};
|
|
211
|
+
launcher_size?: number;
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* RobylonChatbot instance interface
|
|
215
|
+
*/
|
|
216
|
+
interface RobylonChatbotInstance {
|
|
217
|
+
show: () => void;
|
|
218
|
+
hide: () => void;
|
|
219
|
+
toggle: () => void;
|
|
220
|
+
destroy: () => void;
|
|
221
|
+
getState: () => string;
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* Creates a new RobylonChatbot instance
|
|
225
|
+
* @param config The chatbot configuration
|
|
226
|
+
* @returns A RobylonChatbot instance
|
|
227
|
+
*/
|
|
228
|
+
declare function create(config: RobylonChatbotConfig): RobylonChatbotInstance;
|
|
229
|
+
declare const _default: {
|
|
230
|
+
create: typeof create;
|
|
231
|
+
getState: () => string;
|
|
232
|
+
};
|
|
233
|
+
|
|
234
|
+
export { MemoizedRobylonChatbot as Chatbot, ChatbotInterfaceType, ConditionType, DisplayAttributesType, LauncherType, LogicalConditionType, MessageDisplayType, ProactiveSendTimeType, _default as RobylonChatbot, WidgetPositionEnums, useChatbot };
|
|
235
|
+
export type { ChatbotConfig, ChatbotRef, ChatbotState, ContentDisplayAttribute, LogicalConditionAttribute, ProactiveMessage, WidgetInterfaceProperties };
|