UNPKG

umbot

Version:

Universal bot(vk, telegram, viber) or skills for Yandex.Alisa, Маруся and sber

257 lines (256 loc) 8.63 kB
export type TMessageName = 'MESSAGE_TO_SKILL' | 'RATING_RESULT' | 'SERVER_ACTION' | 'RUN_APP' | 'CLOSE_APP'; export type TSberSmartAppType = 'DIALOG' | 'WEB_APP' | 'APK' | 'CHAT_APP'; export interface ISberSmartAppDeviceInfo { platformType: string; platformVersion: string; surface: string; surfaceVersion: string; deviceId?: string; features: { appTypes: TSberSmartAppType[]; }; capabilities: { screen: { available: boolean; }; mic: { available: boolean; }; speak: { available: boolean; }; }; additionalInfo: object; } export interface ISberSmartAppAppInfo { projectId: string; applicationId: string; appversionId: string; frontendEndpoint?: string; frontendType?: TSberSmartAppType; systemName?: string; frontendStateId?: string; } export interface ISberSmartAppCharacterInfo { id: 'sber' | 'athena' | 'joy'; name: 'Сбер' | 'Афина' | 'Джой'; gender: 'male' | 'female'; appeal: 'official' | 'no_official'; } export interface ISberSmartAppMetaInfo { time: { timezone_id: string; timezone_offset_sec: number; timestamp: number; }; } export interface ISberSmartAppEntities { value?: string | number; amount?: number; currency?: string; adjectival_number?: boolean; } export interface ISberSmartAppMessageInfo { original_text: string; normalized_text: string; asr_normalized_message: string; entities?: { [key: string]: ISberSmartAppEntities; }; tokenized_elements_list: any[]; } export interface ISberSmartAppServerAction { action_id: string; parameters: any; } export interface ISberSmartAppSelectedItem { index: number; title: string; is_query_by_number: boolean; } export interface ISberSmartAppAnnotations { censor_data: { classes: ['politicians', 'obscene', 'model_response']; probas: [number, number, number]; }; text_sentiment: { classes: ['negative', 'speech', 'neutral', 'positive', 'skip']; probas: [number, number, number, number, number]; }; asr_sentiment: { classes: ['positive', 'neutral', 'negative']; probas: [number, number, number]; }; } export interface ISberRating { estimation: number; } export interface ISberRatingStatusCode { code: 1 | 101 | 104; description: 'SUCCESS' | 'SKIP BY USER' | 'FORBIDDEN'; } export interface ISberSmartAppRequestPayload { device: ISberSmartAppDeviceInfo; app_info: ISberSmartAppAppInfo; character: ISberSmartAppCharacterInfo; intent: string; original_intent: string; intent_meta: object; meta: ISberSmartAppMetaInfo; projectName: string; selected_item?: ISberSmartAppSelectedItem; new_session?: boolean; annotations: ISberSmartAppAnnotations; strategies: { happy_birthday: boolean; last_call: number; is_alice?: boolean; }; server_action?: ISberSmartAppServerAction; message: ISberSmartAppMessageInfo; rating: ISberRating; status_code: ISberRatingStatusCode; } export interface ISberSmartAppUuId { userChannel: string; sub: string; userId: string; } export interface ISberSmartAppWebhookRequest { messageName: TMessageName; sessionId: string; messageId: number; uuid: ISberSmartAppUuId; payload: ISberSmartAppRequestPayload; } export type TSberResponseMessageName = 'ANSWER_TO_USER' | 'CALL_RATING' | 'POLICY_RUN_APP' | 'NOTHING_FOUND' | 'ERROR'; export type TSberSmartAppEmotionId = 'igrivost' | 'udovolstvie' | 'podavleniye_gneva' | 'smushchennaya_ulibka' | 'simpatiya' | 'oups' | 'laugh' | 'ok_prinyato' | 'bespokoistvo' | 'predvkusheniye' | 'vinovatiy' | 'zhdu_otvet' | 'zadumalsa' | 'neznayu' | 'nedoumenie' | 'nedovolstvo' | 'nesoglasie' | 'pechal' | 'radost' | 'sochuvstvie' | 'strakh' | 'zainteresovannost'; export interface ISberSmartAppSuggestionAction { text?: string; server_action?: any; type: 'text' | 'server_action'; } export interface ISberSmartAppSuggestionButton { title: string; action?: ISberSmartAppSuggestionAction; } export type TSberSmartAppExpandPolicy = 'auto_expand' | 'force_expand' | 'preserve_panel_state'; export interface ISberSmartAppBubble { text: string; markdown?: boolean; expand_policy: TSberSmartAppExpandPolicy; } export type TSberSmartAppPadding = '0x' | '1x' | '2x' | '4x' | '5x' | '6x' | '8x' | '9x' | '10x' | '12x' | '16x'; export interface ISberSmartAppCardAction { type: 'text' | 'send_contact_phone' | 'deep_link'; text?: string; should_send_to_backend?: boolean; send_contact_phone?: number; template?: string; deep_link?: string; } export type TSberSmartAppTypeface = 'headline1' | 'headline2' | 'headline3' | 'title1' | 'title2' | 'body1' | 'body2' | 'body3' | 'text1' | 'paragraphText1' | 'paragraphText2' | 'footnote1' | 'footnote2' | 'button1' | 'button2' | 'caption'; export type TSberSmartAppTextColor = 'default' | 'secondary' | 'tertiary' | 'inverse' | 'brand' | 'warning' | 'critical' | 'link'; export interface ISberSmartAppCardText { text: string; typeface: TSberSmartAppTypeface; text_color: TSberSmartAppTextColor; margins?: ISberSmartAppCardPadding; max_lines?: number; actions?: ISberSmartAppCardAction; } export interface ISberSmartAppCardPadding { left?: TSberSmartAppPadding; top?: TSberSmartAppPadding; right?: TSberSmartAppPadding; bottom?: TSberSmartAppPadding; } export interface ISberSmartAppCardImage { url?: string; hash?: string; placeholder?: string; scale_mode?: 'scale_aspect_fill' | 'scale_aspect_fit' | 'center' | 'top' | 'bottom' | 'left' | 'right' | 'top_left' | 'top_right' | 'bottom_left' | 'bottom_right'; height?: number; placeholder_color?: 'solid_black' | 'solid_white' | 'solid_transparent' | 'solid_disabled' | 'solid_brand' | 'solid_warning' | 'solid_critical' | 'solid_action' | 'liquid_60' | 'liquid_50' | 'liquid_40' | 'liquid_30' | 'liquid_20' | 'liquid_10'; actions?: ISberSmartAppCardAction[]; size?: { width: 'small' | 'medium' | 'large' | 'resizable'; aspect_ratio: number; }; } export interface ISberSmartAppCardItem { type: 'greeting_grid_item' | 'media_gallery_item' | 'gallery_more_button_item' | 'image_cell_view' | 'text_cell_view' | 'left_right_cell_view'; top_text?: ISberSmartAppCardText; bottom_text?: ISberSmartAppCardText; margins?: ISberSmartAppCardPadding; actions?: ISberSmartAppCardAction[]; image?: ISberSmartAppCardImage; paddings?: ISberSmartAppCardPadding; left?: { type: string; icon_vertical_gravity?: string; label?: ISberSmartAppCardText; icon_and_value: { icon?: { address?: { type: string; url: string; }; size: { width: string; height: string; }; margin?: ISberSmartAppCardPadding; }; value?: ISberSmartAppCardText; }; }; right?: any; content?: ISberSmartAppCardImage | ISberSmartAppCardText; } export interface ISberSmartAppCard { paddings?: ISberSmartAppCardPadding; can_be_disabled?: boolean; type: 'gallery_card' | 'grid_card' | 'list_card'; columns?: number; item_width?: 'small' | 'medium' | 'large' | 'resizable'; items?: ISberSmartAppCardItem[]; cells?: ISberSmartAppCardItem[]; } export interface ISberSmartAppItem { card?: ISberSmartAppCard; bubble?: ISberSmartAppBubble; command?: object; } export interface ISberSmartAppResponsePayload { pronounceText: string; pronounceTextType: string; emotion?: { emotionId: TSberSmartAppEmotionId; }; items?: ISberSmartAppItem[]; suggestions?: { buttons: ISberSmartAppSuggestionButton[] | null; }; intent: string; projectName: string; device: ISberSmartAppDeviceInfo; code?: number; auto_listening?: boolean; finished?: boolean; } export interface ISberSmartAppWebhookResponse { messageName?: TSberResponseMessageName; sessionId: string; messageId: number; uuid: ISberSmartAppUuId; payload?: ISberSmartAppResponsePayload | object; } export interface ISberSmartAppSession { device: ISberSmartAppDeviceInfo; meta: ISberSmartAppMetaInfo; sessionId: string; messageId: number; uuid: ISberSmartAppUuId; projectName: string; }