@unith-ai/core-client 2.0.63 → 2.0.65

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/dist/lib.web.js CHANGED
@@ -11427,6 +11427,7 @@ registerProcessor("audio-concat-processor", AudioConcatProcessor);
11427
11427
  var _a, _b, _c, _d, _e;
11428
11428
  if (((_a = packet.value) === null || _a === void 0 ? void 0 : _a.case) !== "sipDtmf" && ((_b = packet.value) === null || _b === void 0 ? void 0 : _b.case) !== "metrics" && ((_c = packet.value) === null || _c === void 0 ? void 0 : _c.case) !== "speaker" && ((_d = packet.value) === null || _d === void 0 ? void 0 : _d.case) !== "transcription" && ((_e = packet.value) === null || _e === void 0 ? void 0 : _e.case) !== "encryptedPacket") return new EncryptedPacketPayload({ value: packet.value });
11429
11429
  }
11430
+ eventsExports.EventEmitter;
11430
11431
  var CryptorErrorReason;
11431
11432
  (function(CryptorErrorReason) {
11432
11433
  CryptorErrorReason[CryptorErrorReason["InvalidKey"] = 0] = "InvalidKey";
@@ -22274,6 +22275,8 @@ registerProcessor("audio-concat-processor", AudioConcatProcessor);
22274
22275
  CheckStatus[CheckStatus["SUCCESS"] = 3] = "SUCCESS";
22275
22276
  CheckStatus[CheckStatus["FAILED"] = 4] = "FAILED";
22276
22277
  })(CheckStatus || (CheckStatus = {}));
22278
+ eventsExports.EventEmitter;
22279
+ eventsExports.EventEmitter;
22277
22280
  function _defineProperty(e, r, t) {
22278
22281
  return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
22279
22282
  value: t,
@@ -22441,7 +22444,8 @@ registerProcessor("audio-concat-processor", AudioConcatProcessor);
22441
22444
  }
22442
22445
  };
22443
22446
  _defineProperty(JWSSignatureVerificationFailed, "code", "ERR_JWS_SIGNATURE_VERIFICATION_FAILED");
22444
- new Uint8Array(0);
22447
+ //#endregion
22448
+ //#region ../../node_modules/.pnpm/@elevenlabs+client@0.13.1_@types+dom-mediacapture-record@1.0.22/node_modules/@elevenlabs/client/dist/lib.modern.js
22445
22449
  const _ = /* @__PURE__ */ new Map();
22446
22450
  function w(e, t) {
22447
22451
  return async (n, o) => {
@@ -24118,6 +24122,12 @@ registerProcessor("audio-concat-processor", AudioConcatProcessor);
24118
24122
  this.options.onStatusChange({ status });
24119
24123
  }
24120
24124
  }
24125
+ async generateSpeechRecognitionToken() {
24126
+ if (this.options.microphoneProvider === "custom") {
24127
+ const response = await this.user.getAsrToken("elevenlabs");
24128
+ this.options.onSpeechRecognitionToken(response.token);
24129
+ } else throw new Error("Speech recognition token generation is only applicable for custom microphone provider.");
24130
+ }
24121
24131
  /**
24122
24132
  * To stop streaming response, we'll send a stop message to the BE. The BE will then stop sending audio and video frames, which will naturally end the response. This is more efficient and leads to a better user experience as it allows for a smoother transition when stopping the response.
24123
24133
  *
@@ -24177,18 +24187,11 @@ registerProcessor("audio-concat-processor", AudioConcatProcessor);
24177
24187
  }
24178
24188
  if (this.options.microphoneProvider !== "custom") this.microphone = await Microphone.initializeMicrophone(this.options.microphoneOptions, this.options.microphoneProvider, this.options.elevenLabsOptions ?? defaultElevenLabsOptions, this.user, this.headInfo, this.microphoneAccess, this.options.voiceInterruptions ?? false);
24179
24189
  else {
24180
- const token = await this.getSpeechRecognitionToken("eleven_labs");
24181
- this.options.onSpeechRecognitionToken(token);
24190
+ const response = await this.user.getAsrToken("elevenlabs");
24191
+ this.options.onSpeechRecognitionToken(response.token);
24182
24192
  }
24183
24193
  return this.connection;
24184
24194
  }
24185
- /**
24186
- * Returns token for speech recognition.
24187
- * @param provider
24188
- */
24189
- async getSpeechRecognitionToken(provider) {
24190
- return (await this.user.getAsrToken(provider === "eleven_labs" ? "elevenlabs" : "azure")).token;
24191
- }
24192
24195
  async toggleMicrophone() {
24193
24196
  if (this.options.microphoneProvider === "custom") throw new Error("Cannot toggle microphone for custom provider.");
24194
24197
  if (!this.microphone) this.microphone = await Microphone.initializeMicrophone(this.options.microphoneOptions, this.options.microphoneProvider, this.options.elevenLabsOptions ?? defaultElevenLabsOptions, this.user, this.headInfo, this.microphoneAccess, this.options.voiceInterruptions ?? false);