UNPKG

react-native-kore-botsdk-test

Version:

Description of your library

930 lines (920 loc) 27.2 kB
import * as React from 'react'; import { RefObject } from 'react'; import { BotConfigModel } from 'react-native-kore-bot-socket-dev'; declare const MAX_SOURCE_LIMIT = 1; declare const LIMIT_MESSAGE: string; declare const MAX_FILE_NAME_LENGTH = 24; declare const FILE_CONTEXT: string; declare const attach_menu_buttons: { id: number; title: string; }[]; declare const HeaderIconsId: { BACK: string; HELP: string; LIVE_AGENT: string; MINIMISE: string; CLOSE: string; THREE_DOTS: string; RECONNECT: string; EXPAND: string; }; declare const ChatHeaderType: { COMPACT: string; LARGE: string; MEDIUM: string; REGULAR: string; }; declare const SHOW_BUTTONS_LIMIT: number; declare const MAX_INPUT_TEXT_LENGTH: number; declare const MIN_COMPOSER_HEIGHT: number | undefined; declare const MIN_TOOL_BAR_HEIGHT: number | undefined; declare const MAX_TOOL_BAR_HEIGHT: number | undefined; declare const MIN_HEADER_HEIGHT: number | undefined; declare const BRANDING_RESPONSE_FILE = "branding"; declare const MAX_COMPOSER_HEIGHT = 200; declare const DEFAULT_PLACEHOLDER = "Type a message"; declare const DATE_FORMAT = "ll"; declare const TIME_FORMAT = "LT, ddd"; declare const BOT_ICON_URL = "BOT_ICON_URL"; declare const URL_VERSION = "/1.1"; declare const TEMPLATE_TYPES: { TEXT: string; BUTTON: string; CUSTOM: string; OTHER: string; AUDIO_MESSAGE: string; VIDEO_MESSAGE: string; LINK_MESSAGE: string; IMAGE_MESSAGE: string; CARD_TEMPLATE: string; LIST_TEMPLATE: string; IMAGE_TEMPLATE: string; TABLE_TEMPLATE: string; QUICK_REPLIES: string; HIDDEN_DIALOG: string; ERROR_TEMPLATE: string; CAROUSEL_TEMPLATE: string; LIVE_AGENT_TEMPLATE: string; START_TIMER: string; ADVANCED_LIST_TEMPLATE: string; MINI_TABLE_TEMPLATE: string; BAR_CHART_TEMPLATE: string; PIE_CHART_TEMPLATE: string; LINE_CHART_TEMPLATE: string; DATE_TEMPLATE: string; DATE_RANGE_TEMPLATE: string; TABLE_LIST_TEMPLATE: string; ADVANCED_MULTI_SELECT_TEMPLATE: string; MULTI_SELECT_TEMPLATE: string; RADIO_OPTION_TEMPLATE: string; LIST_VIEW_TEMPLATE: string; DROPDOWN_TEMPLATE: string; FEEDBACK_TEMPLATE: string; FORM_TEMPLATE: string; CLOCK_TEMPLATE: string; LISTWIDGET_TEMPLATE: string; USER_ATTACHEMENT_TEMPLATE: string; }; declare const RENDER_KORA_BUBBLE = "RENDER_KORA_BUBBLE"; declare const KORA_ITEM_CLICK = "KORA_ITEM_CLICK"; interface ButtonTheme { ACTIVE_BG_COLOR: any; ACTIVE_TXT_COLOR: any; INACTIVE_BG_COLOR: any; INACTIVE_TXT_COLOR: any; } interface HEADER_ICON { ICON_1: 'icon-1'; ICON_2: 'icon-2'; ICON_3: 'icon-3'; ICON_4: 'icon-4'; } interface BubbleTheme { BUBBLE_LEFT_BG_COLOR: any; BUBBLE_LEFT_TEXT_COLOR: any; BUBBLE_RIGHT_BG_COLOR: any; BUBBLE_RIGHT_TEXT_COLOR: any; } declare const WelcomeHeaderConstants: { COMPACT: string; LARGE: string; MEDIUM: string; REGULAR: string; }; interface ThemeType { _id?: string; streamId?: string; __v?: number; activeTheme?: boolean; createdBy?: string; createdOn?: string; defaultTheme?: boolean; lastModifiedBy?: string; lastModifiedOn?: string; refId?: string; state?: string; themeName?: string; v3?: { general?: { bot_icon?: string; size?: string; themeType?: string; colors?: { primary?: string; secondary?: string; primary_text?: string; secondary_text?: string; useColorPaletteOnly?: boolean; }; }; chat_bubble?: { style?: string; icon?: { icon_url?: string; size?: string; type?: string; }; minimise?: { icon?: string; theme?: string; type?: string; }; sound?: string; alignment?: string; animation?: string; expand_animation?: string; primary_color?: string; secondary_color?: string; }; welcome_screen?: { show?: boolean; layout?: string; logo?: { logo_url?: string; }; title?: { name?: string; }; sub_title?: { name?: string; }; note?: { name?: string; }; background?: { type?: string; color?: string; img?: string; }; top_fonts?: { color?: string; }; bottom_background?: { color?: string; }; templates?: any; starter_box?: { show?: boolean; icon?: { show?: boolean; }; title?: string; sub_text?: string; start_conv_button?: { color?: string; }; start_conv_text?: { color?: string; }; quick_start_buttons?: { show?: boolean; style?: string; buttons?: any; input?: string; action?: { type?: string; value?: string; }; }; }; static_links?: { show?: boolean; layout?: string; links?: any; }; promotional_content?: { show?: boolean; promotions?: any; }; }; header?: { bg_color?: string; size?: string; icon?: { show?: boolean; icon_url?: string; type?: string; }; icons_color?: string; title?: { name?: string; color?: string; }; sub_title?: { name?: string; color?: string; }; buttons?: { close?: { show?: boolean; icon?: string; }; minimise?: { show?: boolean; icon?: string; }; expand?: { show?: boolean; icon?: string; }; reconnect?: { show?: boolean; icon?: string; }; threeDots?: { show?: boolean; icon?: string; }; help?: { show?: boolean; action?: { type?: string; value?: string; icon?: string; }; }; live_agent?: { show?: boolean; action?: { type?: string; value?: string; icon?: string; }; }; }; }; footer?: { bg_color?: string; layout?: string; compose_bar?: { bg_color?: string; 'outline-color'?: string; placeholder?: string; }; icons_color?: string; buttons?: { menu?: { show?: boolean; icon_color?: string; actions?: any; }; emoji?: { show?: boolean; icon?: string; }; microphone?: { show?: boolean; icon?: string; }; attachment?: { show?: boolean; icon?: string; }; }; }; body?: { background?: { type?: string; color?: string; img?: string; }; font?: { family?: string; size?: string; style?: string; }; user_message?: { bg_color?: string; color?: string; }; bot_message?: { bg_color?: string; color?: string; }; agent_message?: { bg_color?: string; color?: string; separator?: string; icon?: { show?: string; icon_url?: string; }; title?: { name?: string; color?: string; }; sub_title?: { name?: string; color?: string; }; }; time_stamp?: { show?: boolean; show_type?: string; position?: string; separator?: string; color?: string; }; icon?: { show?: boolean; user_icon?: boolean; bot_icon?: boolean; agent_icon?: boolean; }; buttons?: { bg_color?: string; color?: string; }; bubble_style?: string; primaryColor?: string; primaryHoverColor?: string; secondaryColor?: string; secondaryHoverColor?: string; img?: string; }; }; version?: string; } interface IThemeType extends ThemeType { _id?: string; streamId?: string; __v?: number; activeTheme?: boolean; createdBy?: string; createdOn?: string; defaultTheme?: boolean; lastModifiedBy?: string; lastModifiedOn?: string; refId?: string; state?: string; themeName?: string; v3?: { general?: { bot_icon?: string; size?: string; themeType?: string; colors?: { primary?: string; secondary?: string; primary_text?: string; secondary_text?: string; useColorPaletteOnly?: boolean; }; }; chat_bubble?: { style?: string; icon?: { icon_url?: string; size?: string; type?: string; }; minimise?: { icon?: string; theme?: string; type?: string; }; sound?: string; alignment?: string; animation?: string; expand_animation?: string; primary_color?: string; secondary_color?: string; }; welcome_screen?: { show?: boolean; layout?: string; logo?: { logo_url?: string; }; title?: { name?: string; }; sub_title?: { name?: string; }; note?: { name?: string; }; background?: { type?: string; color?: string; img?: string; }; top_fonts?: { color?: string; }; bottom_background?: { color?: string; }; templates?: any; starter_box?: { show?: boolean; icon?: { show?: boolean; }; title?: string; sub_text?: string; start_conv_button?: { color?: string; }; start_conv_text?: { color?: string; }; quick_start_buttons?: { show?: boolean; style?: string; buttons?: any; input?: string; action?: { type?: string; value?: string; }; }; }; static_links?: { show?: boolean; layout?: string; links?: any; }; promotional_content?: { show?: boolean; promotions?: any; }; }; header?: { bg_color?: string; size?: string; icon?: { show?: boolean; icon_url?: string; type?: string; }; icons_color?: string; title?: { name?: string; color?: string; }; sub_title?: { name?: string; color?: string; }; buttons?: { close?: { show?: boolean; icon?: string; }; minimise?: { show?: boolean; icon?: string; }; expand?: { show?: boolean; icon?: string; }; reconnect?: { show?: boolean; icon?: string; }; help?: { show?: boolean; action?: { type?: string; value?: string; icon?: string; }; }; live_agent?: { show?: boolean; action?: { type?: string; value?: string; icon?: string; }; }; }; }; footer?: { bg_color?: string; layout?: string; compose_bar?: { bg_color?: string; 'outline-color'?: string; placeholder?: string; }; icons_color?: string; buttons?: { menu?: { show?: boolean; icon_color?: string; actions?: any; }; emoji?: { show?: boolean; icon?: string; }; microphone?: { show?: boolean; icon?: string; }; attachment?: { show?: boolean; icon?: string; icon_color?: string; }; }; }; body?: { background?: { type?: string; color?: string; img?: string; }; font?: { family?: string; size?: 'small' | 'medium' | 'large'; style?: string; }; user_message?: { bg_color?: string; color?: string; }; bot_message?: { bg_color?: string; color?: string; }; agent_message?: { bg_color?: string; color?: string; separator?: string; icon?: { show?: string; icon_url?: string; }; title?: { name?: string; color?: string; }; sub_title?: { name?: string; color?: string; }; }; time_stamp?: { show?: boolean; show_type?: string; position?: string; separator?: string; color?: string; }; icon?: { show?: boolean; user_icon?: boolean; bot_icon?: boolean; agent_icon?: boolean; }; buttons?: { bg_color?: string; color?: string; }; bubble_style?: 'balloon' | 'rounded' | 'rectangle'; primaryColor?: string; primaryHoverColor?: string; secondaryColor?: string; secondaryHoverColor?: string; img?: string; }; }; version?: string; } interface BotTemplateProps { templateType: string; textContainerStyle?: any; payload?: any; theme?: IThemeType; renderMessageText?: (props: any) => React.ReactNode; currentMessage?: { message?: any; pending: any; received: any; sent: any; text?: any; createdOn?: any | null; image?: any | null; user: { _id: string; name: string; }; }; messageTextProps?: any; onListItemClick?: any; } interface BotTemplateState { } interface onListItemClickProps { templateType: string; item?: any; } declare class BotTemplate extends React.Component<BotTemplateProps, BotTemplateState> { static defaultProps: { currentMessage: null; }; private renderBubbleViews; private renderMessageText; private renderBotText; render(): string | number | boolean | Iterable<React.ReactNode> | React.JSX.Element | null | undefined; } interface BaseViewProps { position?: 'left' | 'right' | 'center'; payload?: any; theme?: IThemeType; } interface BaseViewState { } declare class BaseView<T extends BaseViewProps, S extends BaseViewState> extends React.Component<T, S> { static contextType: React.Context<ThemeType | undefined>; static propTypes: { payload: {}; }; constructor(props: T); static defaultProps: { position: 'left'; }; protected isViewDisable: () => boolean; } interface CustomViewProps extends BaseViewProps { payload: any; isLastMessage: boolean; onListItemClick: any; } interface CustomViewState extends BaseViewState { } declare class CustomTemplate<T extends CustomViewProps, S extends CustomViewState> extends BaseView<T, S> { static contextType: React.Context<ThemeType | undefined>; static propTypes: { payload: {}; }; constructor(props: T); } interface KoraChatProps { messages?: any[]; messagesContainerStyle?: any; text?: string | null; actionSheet: any; _actionSheetRef?: any; inverted: any; locale: string; isTyping?: boolean; onDragList: any; onSend: any; onInputTextChanged: any; renderSuggestionsView: any; renderMediaView: any; initialText?: any; minComposerHeight: number; textInputProps: any; maxInputLength: number; renderInputToolbar: any; renderComposer: any; renderSend: any; renderChatFooter: any; renderLoading: any; renderTypingIndicator: any; wrapInSafeArea: any; parsePatterns?: any; alignTop: boolean; alwaysShowSend?: boolean; scrollToBottom?: boolean; style?: any; onListItemClick?: any; onLongPress?: any; botConfig: BotConfigModel; renderQuickRepliesView?: any; renderChatHeader?: any; onHeaderActionsClick?: any; navigation?: any; route?: any; templateInjection?: Map<string, CustomTemplate<CustomViewProps, CustomViewState>>; } interface KoraChatState { isInitialized: boolean; composerHeight: number; messagesContainerHeight: number | null; typingDisabled: boolean; text: string | null | undefined; messages: any[]; isNetConnected?: boolean; showLoader?: boolean; quickReplies?: any; modalVisible?: boolean; viewMoreObj?: any; isBotResponseLoading?: boolean; menuItems?: any[]; progressObj?: any; isShowProgress?: boolean; mediaPayload?: any; onSTTValue?: any; currentTemplate?: any; currentTemplateData?: any; activetheme?: any; wlcomeModalVisible?: boolean; currentTemplateHeading?: any; } declare class KoreChat extends React.Component<KoraChatProps, KoraChatState> { _messageContainerRef: RefObject<any>; textInput: any; _isFirstLayout: boolean; _locale: string; invertibleScrollViewProps: {}; _unsubscribeConn: any; static defaultProps: { messagesContainerStyle: null; text: null; placeholder: string; disableComposer: boolean; messageIdGenerator: () => string | number[]; user: {}; onSend: undefined; timeFormat: string; dateFormat: string; loadEarlier: boolean; onLoadEarlier: () => void; isLoadingEarlier: boolean; renderLoading: null; renderLoadEarlier: null; renderAvatar: null; showUserAvatar: boolean; actionSheet: null; onPressAvatar: null; onLongPressAvatar: null; renderUsernameOnMessage: boolean; renderAvatarOnTop: boolean; onLongPress: null; renderMessage: null; renderMessageText: null; imageProps: {}; videoProps: {}; audioProps: {}; lightboxProps: {}; textInputProps: {}; listViewProps: {}; renderCustomView: null; isCustomViewBottom: boolean; renderDay: null; renderTime: null; renderFooter: null; renderChatEmpty: null; renderChatFooter: null; renderInputToolbar: null; renderComposer: null; renderActions: any; renderSend: null; renderAccessory: null; isKeyboardInternallyHandled: boolean; onPressActionButton: null; bottomOffset: number; minInputToolbarHeight: number; keyboardShouldPersistTaps: string; onInputTextChanged: null; maxInputLength: null; forceGetKeyboardHeight: boolean; inverted: boolean; extraData: null; minComposerHeight: number | undefined; maxComposerHeight: number; wrapInSafeArea: boolean; renderSuggestionsView: null; renderMediaView: null; Suggestions: never[]; renderQuickRepliesView: null; onFormAction: null; renderTypingIndicator: null; renderSpeechToText: null; clickSpeechToText: null; onDragList: null; _actionSheetRef: null; locale: 'en'; alignTop: boolean; initialText: undefined; onListItemClick: undefined; menuItems: []; }; private _isChatMounted; private attachedBottomSheetRef; private menuBottomSheetRef; private seeMoreBottomSheetRef; private fileUploadQueue?; private themApi; constructor(props: KoraChatProps); private init; private saveThemeData; private getThemeData; static append(currentMessages: any, messages: any): any; componentDidMount(): void; private clickedQuickReply; componentWillUnmount(): void; componentDidUpdate(prevProps: KoraChatProps): void; private setBotClientListeners; private isQuickReplies; private processMessage; private initLocale; private setLocale; private getLocale; private setTextFromProp; private getTextFromProp; private setMessages; private getMessages; private setIsFirstLayout; private getIsFirstLayout; private setIsTypingDisabled; private getIsTypingDisabled; private setIsBotResponseLoading; private getIsBotResponseLoading; private setisChatMounted; private getisChatMounted; private scrollToBottom; private renderMessages; onSendPlainText: (message?: any) => void; private getAttachmentPayload; onSendText: (message: any, shouldResetInputToolbar?: boolean, data_type?: string) => void; private renderQuickRepliesView; private renderMediaView; private getFileType; private renderInternalMediaView; private clearQuickReplies; private onSend; private computePostBack; private onListItemClick; private getDateRangeText; private resetInputToolbar; private focusTextInput; private onInputSizeChanged; private onInputTextChanged; private notifyInputTextReset; private onInitialLayoutViewLayout; private onMainViewLayout; private isMediaAddedToSend; private renderInputToolbar; private renderChatFooter; private renderLoading; private renderTypingIndicator; renderSTTview(value: any): React.ReactNode; private refreshView; private getViewMoreView; private openFullScreenDialog; private renderAttachedBottomSheet; private renderMenuBottomSheet; private renderSeeMorePopupComponent; private renderSemoreBottomSheet; private renderMenuPopupComponent; private renderAssetPopupComponent; private onAttachItemClick; private pickDocument; private getBeforeLoadingList; private computeMediaResult; private showCustomToast; private onHeaderActionsClick; private renderHeader; private renderLoader; private renderWelcomeComponent; private renderWelcomeScreenModel; render(): React.JSX.Element; } interface QuickProps extends BaseViewProps { quick_replies: any; itemClick?: any; isVertical?: boolean; quick_container_style?: any; quck_text_style?: any; quick_image_style?: any; } interface QuickState extends BaseViewState { isClickedItem?: boolean; } declare class QuickReplies extends BaseView<QuickProps, QuickState> { constructor(props: QuickProps); componentDidUpdate(prevProps: Readonly<QuickProps>, _prevState: Readonly<QuickState>, _snapshot?: any): void; private renderQuickRepliesView; render(): React.JSX.Element; } export { BOT_ICON_URL, BRANDING_RESPONSE_FILE, BotTemplate, type BotTemplateProps, type BotTemplateState, type BubbleTheme, type ButtonTheme, ChatHeaderType, CustomTemplate, type CustomViewProps, type CustomViewState, DATE_FORMAT, DEFAULT_PLACEHOLDER, FILE_CONTEXT, type HEADER_ICON, HeaderIconsId, type IThemeType, KORA_ITEM_CLICK, LIMIT_MESSAGE, MAX_COMPOSER_HEIGHT, MAX_FILE_NAME_LENGTH, MAX_INPUT_TEXT_LENGTH, MAX_SOURCE_LIMIT, MAX_TOOL_BAR_HEIGHT, MIN_COMPOSER_HEIGHT, MIN_HEADER_HEIGHT, MIN_TOOL_BAR_HEIGHT, QuickReplies, RENDER_KORA_BUBBLE, SHOW_BUTTONS_LIMIT, TEMPLATE_TYPES, TIME_FORMAT, URL_VERSION, WelcomeHeaderConstants, attach_menu_buttons, KoreChat as default, type onListItemClickProps };