@vapi-ai/web 1.0.180 → 1.0.182

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.
package/README.md CHANGED
@@ -47,6 +47,31 @@ vapi.stop();
47
47
 
48
48
  This will stop the recording and close the connection.
49
49
 
50
+ ## Events
51
+
52
+ You can listen to the following events:
53
+
54
+ ```javascript
55
+ vapi.on('speech-start', () => {
56
+ console.log('Speech has started');
57
+ });
58
+
59
+ vapi.on('speech-end', () => {
60
+ console.log('Speech has ended');
61
+ });
62
+
63
+ vapi.on('call-start', () => {
64
+ console.log('Call has started');
65
+ });
66
+
67
+ vapi.on('call-end', () => {
68
+ console.log('Call has stopped');
69
+ });
70
+ ```
71
+
72
+ These events allow you to react to changes in the state of the call or speech.
73
+
74
+
50
75
  ## License
51
76
 
52
77
  ```
package/dist/vapi.js CHANGED
@@ -43,12 +43,16 @@ class Vapi extends events_1.default {
43
43
  });
44
44
  (_a = this.call.iframe()) === null || _a === void 0 ? void 0 : _a.style.setProperty("display", "none");
45
45
  this.call.on("joined-meeting", () => {
46
- this.emit("call-started");
46
+ this.emit("call-start");
47
47
  });
48
48
  this.call.on("left-meeting", () => {
49
- this.emit("call-stopped");
49
+ this.emit("call-end");
50
50
  });
51
- yield this.call.join({ url });
51
+ setTimeout(() => {
52
+ if (!this.call)
53
+ return;
54
+ this.call.join({ url });
55
+ }, 7000);
52
56
  this.call.startRemoteParticipantsAudioLevelObserver();
53
57
  this.call.on("remote-participants-audio-level", (e) => this.handleRemoteParticipantsAudioLevel(e));
54
58
  }))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vapi-ai/web",
3
- "version": "1.0.180",
3
+ "version": "1.0.182",
4
4
  "description": "",
5
5
  "main": "dist/vapi.js",
6
6
  "types": "dist/vapi.d.ts",
package/vapi.ts CHANGED
@@ -41,13 +41,16 @@ export default class Vapi extends EventEmitter {
41
41
  this.call.iframe()?.style.setProperty("display", "none");
42
42
 
43
43
  this.call.on("joined-meeting", () => {
44
- this.emit("call-started");
44
+ this.emit("call-start");
45
45
  });
46
46
  this.call.on("left-meeting", () => {
47
- this.emit("call-stopped");
47
+ this.emit("call-end");
48
48
  });
49
49
 
50
- await this.call.join({ url });
50
+ setTimeout(() => {
51
+ if (!this.call) return;
52
+ this.call.join({ url });
53
+ }, 7000);
51
54
 
52
55
  this.call.startRemoteParticipantsAudioLevelObserver();
53
56
  this.call.on("remote-participants-audio-level", (e) =>