diff --git a/package-lock.json b/package-lock.json index 69622550b..69cb6584b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@vapi-ai/web", - "version": "2.5.2", + "version": "2.5.3", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@vapi-ai/web", - "version": "2.5.2", + "version": "2.5.3", "license": "MIT", "dependencies": { "@daily-co/daily-js": "^0.85.0", diff --git a/package.json b/package.json index 4e107c9ba..56ee61309 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@vapi-ai/web", - "version": "2.5.2", + "version": "2.5.3", "description": "", "main": "dist/vapi.js", "types": "dist/vapi.d.ts", diff --git a/vapi.ts b/vapi.ts index e659313ff..d4ff1b9bc 100644 --- a/vapi.ts +++ b/vapi.ts @@ -5,7 +5,11 @@ import DailyIframe, { DailyAdvancedConfig, DailyFactoryOptions, DailyEventObjectAppMessage, + DailyEventObjectNoPayload, DailyEventObjectParticipant, + DailyEventObjectRecordingError, + DailyEventObjectRecordingStarted, + DailyEventObjectRecordingStopped, DailyEventObjectRemoteParticipantsAudioLevel, DailyParticipant, DailyVideoSendSettings, @@ -73,7 +77,12 @@ type VapiEventNames = | 'daily-participant-updated' | 'call-start-progress' | 'call-start-success' - | 'call-start-failed'; + | 'call-start-failed' + | 'recording-started' + | 'recording-stopped' + | 'recording-stats' + | 'recording-error' + | 'recording-upload-completed'; interface CallStartProgressEvent { stage: string; @@ -181,6 +190,11 @@ type VapiEventListeners = { 'call-start-progress': (event: CallStartProgressEvent) => void; 'call-start-success': (event: CallStartSuccessEvent) => void; 'call-start-failed': (event: CallStartFailedEvent) => void; + 'recording-started': (event: DailyEventObjectRecordingStarted) => void; + 'recording-stopped': (event: DailyEventObjectRecordingStopped) => void; + 'recording-stats': (event: DailyEventObjectNoPayload) => void; + 'recording-error': (event: DailyEventObjectRecordingError) => void; + 'recording-upload-completed': (event: DailyEventObjectNoPayload) => void; }; type StartCallOptions = { @@ -539,6 +553,26 @@ export default class Vapi extends VapiEventEmitter { this.emit('network-connection', event); }); + this.call.on('recording-started', (event) => { + if (event) this.emit('recording-started', event); + }); + + this.call.on('recording-stopped', (event) => { + if (event) this.emit('recording-stopped', event); + }); + + this.call.on('recording-stats', (event) => { + if (event) this.emit('recording-stats', event); + }); + + this.call.on('recording-error', (event) => { + if (event) this.emit('recording-error', event); + }); + + this.call.on('recording-upload-completed', (event) => { + if (event) this.emit('recording-upload-completed', event); + }); + this.call.on('track-started', async (e) => { if (!e || !e.participant) { return; @@ -1161,6 +1195,26 @@ export default class Vapi extends VapiEventEmitter { this.emit('network-connection', event); }); + this.call.on('recording-started', (event) => { + if (event) this.emit('recording-started', event); + }); + + this.call.on('recording-stopped', (event) => { + if (event) this.emit('recording-stopped', event); + }); + + this.call.on('recording-stats', (event) => { + if (event) this.emit('recording-stats', event); + }); + + this.call.on('recording-error', (event) => { + if (event) this.emit('recording-error', event); + }); + + this.call.on('recording-upload-completed', (event) => { + if (event) this.emit('recording-upload-completed', event); + }); + this.call.on('track-started', async (e) => { if (!e || !e.participant) { return;