@trtc/calls-uikit-react 4.2.4 → 4.4.0

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 (26) hide show
  1. package/package.json +3 -3
  2. package/src/Components/TUICallKit/TUICallKit.tsx +2 -0
  3. package/src/Components/components/common/AIAssistant/AIAssistant.ts +132 -0
  4. package/src/Components/components/common/AIAssistant/AISubtitle.tsx +89 -0
  5. package/src/Components/components/common/AIAssistant/index.ts +10 -0
  6. package/src/Components/components/common/AIAssistant/utils/index.ts +5 -0
  7. package/src/Components/components/common/AIAssistant/utils/mitt.ts +85 -0
  8. package/src/TUICallService/CallService/AIAssistant.ts +51 -0
  9. package/src/TUICallService/CallService/index.ts +16 -1
  10. package/src/TUICallService/locales/en.ts +2 -0
  11. package/src/TUICallService/locales/ja_JP.ts +2 -0
  12. package/src/TUICallService/locales/zh-cn.ts +2 -0
  13. package/src/TUICallService/utils/common-utils.ts +1 -1
  14. package/src/index.ts +1 -1
  15. package/tuicall-uikit-react.es.js +3561 -3377
  16. package/tuicall-uikit-react.umd.js +11 -11
  17. package/types/Components/components/common/AIAssistant/AIAssistant.d.ts +40 -0
  18. package/types/Components/components/common/AIAssistant/AISubtitle.d.ts +7 -0
  19. package/types/Components/components/common/AIAssistant/index.d.ts +4 -0
  20. package/types/Components/components/common/AIAssistant/utils/index.d.ts +2 -0
  21. package/types/Components/components/common/AIAssistant/utils/mitt.d.ts +16 -0
  22. package/types/TUICallService/CallService/AIAssistant.d.ts +15 -0
  23. package/types/TUICallService/CallService/index.d.ts +1 -0
  24. package/types/TUICallService/locales/en.d.ts +2 -0
  25. package/types/TUICallService/locales/ja_JP.d.ts +2 -0
  26. package/types/TUICallService/locales/zh-cn.d.ts +2 -0
@@ -0,0 +1,40 @@
1
+ interface IInitASRParams {
2
+ trtcCloudInstance: any;
3
+ getNickName?: (userId: string) => Promise<userInfo>;
4
+ }
5
+ interface ITranslationContent {
6
+ language: string;
7
+ content: string;
8
+ }
9
+ interface ITranslationInfo {
10
+ roundId: string;
11
+ sender: string;
12
+ nick?: string;
13
+ text: string;
14
+ end: boolean;
15
+ translation: ITranslationContent[];
16
+ }
17
+ export declare const ASREvent: {
18
+ TRANSCRIPTION: string;
19
+ };
20
+ interface userInfo {
21
+ userId: string;
22
+ nick: string;
23
+ avatar?: string;
24
+ [key: string]: any;
25
+ }
26
+ export default class AIAssistant {
27
+ emitter: any;
28
+ trtcCloudInstance: any;
29
+ getNickName: (userId: string) => Promise<userInfo>;
30
+ translationInfoList: ITranslationInfo[];
31
+ constructor();
32
+ initASR(params: IInitASRParams): void;
33
+ on(type: string, handler: (event: any) => void): void;
34
+ emit(type: string, events: any): void;
35
+ off(type: string, handler: (event: any) => void): void;
36
+ destroyASR(): void;
37
+ handleAIMessage: (data: any) => void;
38
+ handleCustomMessage: (userId: string, cmdId: number, seq: number, data: any) => void;
39
+ }
40
+ export {};
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ interface AISubtitleProps {
3
+ customClass?: string;
4
+ customStyle?: React.CSSProperties;
5
+ }
6
+ declare const AISubtitle: React.FC<AISubtitleProps>;
7
+ export default AISubtitle;
@@ -0,0 +1,4 @@
1
+ import AIAssistant, { ASREvent } from "./AIAssistant";
2
+ import AISubtitle from "./AISubtitle";
3
+ declare const aiAssistant: AIAssistant;
4
+ export { aiAssistant, ASREvent, AISubtitle, };
@@ -0,0 +1,2 @@
1
+ import mitt from './mitt';
2
+ export { mitt, };
@@ -0,0 +1,16 @@
1
+ export type EventType = string | symbol;
2
+ export type Handler<T = unknown> = (event: T) => void;
3
+ export type WildcardHandler<T = Record<string, unknown>> = (type: keyof T, event: T[keyof T]) => void;
4
+ export type EventHandlerList<T = unknown> = Array<Handler<T>>;
5
+ export type WildCardEventHandlerList<T = Record<string, unknown>> = Array<WildcardHandler<T>>;
6
+ export type EventHandlerMap<Events extends Record<EventType, unknown>> = Map<keyof Events | '*', EventHandlerList<Events[keyof Events]> | WildCardEventHandlerList<Events>>;
7
+ export interface Emitter<Events extends Record<EventType, unknown>> {
8
+ all: EventHandlerMap<Events>;
9
+ on<Key extends keyof Events>(type: Key, handler: Handler<Events[Key]>): void;
10
+ on(type: '*', handler: WildcardHandler<Events>): void;
11
+ off<Key extends keyof Events>(type: Key, handler?: Handler<Events[Key]>): void;
12
+ off(type: '*', handler: WildcardHandler<Events>): void;
13
+ emit<Key extends keyof Events>(type: Key, event: Events[Key]): void;
14
+ emit<Key extends keyof Events>(type: undefined extends Events[Key] ? Key : never): void;
15
+ }
16
+ export default function mitt<Events extends Record<EventType, unknown>>(all?: EventHandlerMap<Events>): Emitter<Events>;
@@ -0,0 +1,15 @@
1
+ interface IAIAssistant {
2
+ enableAISubtitle: (enable: boolean) => void;
3
+ setEngineInstance: (engineInstance: any) => void;
4
+ setImInstance: (imInstance: any) => void;
5
+ }
6
+ export declare class AIAssistant implements IAIAssistant {
7
+ static instance: IAIAssistant;
8
+ private _tuiCallEngine;
9
+ private _imInstance;
10
+ static getInstance(): IAIAssistant;
11
+ enableAISubtitle(enable: boolean): void;
12
+ setEngineInstance(engineInstance: any): void;
13
+ setImInstance(imInstance: any): void;
14
+ }
15
+ export {};
@@ -46,6 +46,7 @@ export default class TUICallService {
46
46
  setRemoteViewBackgroundImage(userId: string, url: string): void;
47
47
  setLayoutMode(layoutMode: LayoutMode): void;
48
48
  setCameraDefaultState(isOpen: boolean): void;
49
+ enableAISubtitle(enable: boolean): void;
49
50
  callExperimentalAPI(jsonStr: string): void;
50
51
  accept(): Promise<void>;
51
52
  hangup(): Promise<void>;
@@ -61,6 +61,8 @@ export declare const en: {
61
61
  "The network is poor during your current call": string;
62
62
  "The other user network is poor during the current call": string;
63
63
  "TUICallKit init is not complete": string;
64
+ "auto play failed": string;
65
+ "click to resume": string;
64
66
  "Video call": string;
65
67
  "Voice call": string;
66
68
  "Call End": string;
@@ -71,6 +71,8 @@ export declare const ja_JP: {
71
71
  "The network is poor during your current call": string;
72
72
  "The other user network is poor during the current call": string;
73
73
  "TUICallKit init is not complete": string;
74
+ "auto play failed": string;
75
+ "click to resume": string;
74
76
  timeout: string;
75
77
  'kick out': string;
76
78
  'Invited group call': string;
@@ -61,6 +61,8 @@ export declare const zh: {
61
61
  "The network is poor during your current call": string;
62
62
  "The other user network is poor during the current call": string;
63
63
  "TUICallKit init is not complete": string;
64
+ "auto play failed": string;
65
+ "click to resume": string;
64
66
  "Video call": string;
65
67
  "Voice call": string;
66
68
  "Call End": string;