@d-id/client-sdk 1.0.18-beta.9 → 1.0.19

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.
@@ -1,35 +1,39 @@
1
1
  import { SupportedStreamScipt } from '../../../types/StreamScript';
2
2
  import { Auth } from '../../auth';
3
- import { SendStreamPayloadResponse, StreamingState } from '../../stream';
3
+ import { SendStreamPayloadResponse, SlimRTCStatsReport, StreamingState } from '../../stream';
4
4
  import { Agent } from './agent';
5
5
  import { ChatResponse, Message, RatingEntity, RatingPayload } from './chat';
6
6
  /**
7
7
  * Types of events provided in Chat Progress Callback
8
8
  */
9
- declare enum ChatProgress {
9
+ export declare enum ChatProgress {
10
10
  /**
11
11
  * Chat was successfully embedded
12
12
  */
13
- Embed = 0,
13
+ Embed = "embed",
14
14
  /**
15
15
  * Server processing chat message
16
16
  */
17
- Query = 1,
17
+ Query = "query",
18
+ /**
19
+ * Server returns a part of the message
20
+ */
21
+ Partial = "partial",
18
22
  /**
19
23
  * Server processed message and returned response
20
24
  */
21
- Answer = 2,
25
+ Answer = "answer",
22
26
  /**
23
27
  * Chat was closed
24
28
  */
25
- Complete = 3
29
+ Complete = "done"
26
30
  }
27
- export type ChatProgressCallback = (progress: ChatProgress) => void;
31
+ export type ChatProgressCallback = (progress: ChatProgress, data: string) => void;
28
32
  export type ConnectionStateChangeCallback = (state: RTCIceConnectionState) => void;
29
- export type VideoStateChangeCallback = (state: StreamingState) => void;
33
+ export type VideoStateChangeCallback = (state: StreamingState, stats?: SlimRTCStatsReport[]) => void;
30
34
  interface ManagerCallbacks {
31
35
  /**
32
- * This callback will be triggered each time the RTC connection changes state
36
+ * Optional callback will be triggered each time the RTC connection changes state
33
37
  * @param state
34
38
  */
35
39
  onConnectionStateChange?(state: RTCIceConnectionState): void;
@@ -51,7 +55,7 @@ interface ManagerCallbacks {
51
55
  * Optional callback function that will be triggered each time any changes happen in the chat
52
56
  * @param progress
53
57
  */
54
- onChatEvents?(progress: ChatProgress): void;
58
+ onChatEvents?(progress: ChatProgress, data: any): void;
55
59
  }
56
60
  export interface AgentManagerOptions {
57
61
  callbacks: ManagerCallbacks;
@@ -59,7 +63,7 @@ export interface AgentManagerOptions {
59
63
  debug?: boolean;
60
64
  auth: Auth;
61
65
  }
62
- export interface AgentsManager {
66
+ export interface AgentManager {
63
67
  /**
64
68
  * Agent instance you are working with.
65
69
  * To know more about agents go to https://docs.d-id.com/reference/agents
@@ -84,12 +88,16 @@ export interface AgentsManager {
84
88
  */
85
89
  chat: (messages: Message[]) => Promise<ChatResponse>;
86
90
  /**
87
- * This method provides you the possibility to rate your chat experience
88
- * TODO asks Sagi how it's work
91
+ * Method to rate the answer in chat
89
92
  * @param payload
90
93
  * @param id - id of Rating entity. Leave it empty to create a new, one or pass it to work with the existing one
91
94
  */
92
95
  rate: (payload: RatingPayload, id?: string) => Promise<RatingEntity>;
96
+ /**
97
+ * Method to delete rating from answer in chat
98
+ * @param id - id of Rating entity.
99
+ */
100
+ deleteRate: (id: string) => Promise<RatingEntity>;
93
101
  /**
94
102
  * Method to make your agent read the text you provide or reproduce sound
95
103
  * @param payload
@@ -99,16 +107,6 @@ export interface AgentsManager {
99
107
  * Optional callback function that will be triggered each time any changes happen in the chat
100
108
  * @param callback
101
109
  */
102
- onChatEvents: (callback: ChatProgressCallback) => void;
103
- /**
104
- * Optional callback function that will be triggered each time the RTC connection gets new status
105
- * @param callback
106
- */
107
- onConnectionEvents: (callback: ConnectionStateChangeCallback) => void;
108
- /**
109
- * Optional callback function that will be triggered each time video events happen
110
- * @param callback
111
- */
112
- onVideoEvents: (callback: VideoStateChangeCallback) => void;
110
+ getStarterMessages: () => Promise<string[]>;
113
111
  }
114
112
  export {};
@@ -16,7 +16,7 @@ export declare enum StreamEvents {
16
16
  export interface ManagerCallbacks {
17
17
  onMessage?: (event: string, data: string) => void;
18
18
  onConnectionStateChange?: (state: RTCIceConnectionState) => void;
19
- onVideoStateChange?: (state: StreamingState) => void;
19
+ onVideoStateChange?: (state: StreamingState, stats?: SlimRTCStatsReport[]) => void;
20
20
  onSrcObjectReady?: (value: MediaStream) => void;
21
21
  }
22
22
  export type ManagerCallbackKeys = keyof ManagerCallbacks;
@@ -41,3 +41,14 @@ export interface StreamingManagerOptions {
41
41
  debug?: boolean;
42
42
  auth: Auth;
43
43
  }
44
+ export interface SlimRTCStatsReport {
45
+ index: number;
46
+ timestamp: any;
47
+ bytesReceived: any;
48
+ packetsReceived: any;
49
+ packetsLost: any;
50
+ jitter: any;
51
+ frameWidth: any;
52
+ frameHeight: any;
53
+ frameRate: any;
54
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@d-id/client-sdk",
3
3
  "private": false,
4
- "version": "1.0.18-beta.9",
4
+ "version": "1.0.19",
5
5
  "type": "module",
6
6
  "description": "d-id client sdk",
7
7
  "repository": {