uneeq-js 2.47.6 → 2.47.7

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.
@@ -29,6 +29,7 @@ export declare class API {
29
29
  setAvatarDebug(enabled: boolean): Promise<any>;
30
30
  sendMediaUnavailable(data: MediaUnavailableRequest): Promise<any>;
31
31
  getEdgeNodeId(turnServerAddress: string): Promise<any>;
32
+ getSessionJwt(personaId: string): Promise<any>;
32
33
  getTimeZone(): string;
33
34
  private makeRequest;
34
35
  private getRequest;
@@ -8,4 +8,5 @@ export interface SpeechHandlerOptions {
8
8
  assetBasePath?: string;
9
9
  hintPhrases: string;
10
10
  locales: string;
11
+ jwtToken: string;
11
12
  }
@@ -27,6 +27,7 @@ export declare class Uneeq {
27
27
  private readonly messageCallback;
28
28
  private readonly startSessionData;
29
29
  private metricsService;
30
+ private sessionJwt;
30
31
  private startSessionTime;
31
32
  private availableResponseTime;
32
33
  private streamManager;
package/dist/umd/index.js CHANGED
@@ -4031,34 +4031,41 @@ class Uneeq {
4031
4031
  });
4032
4032
  }
4033
4033
  initDeviceManager() {
4034
- if (this.options.voiceInputMode === VoiceInputMode_1.VoiceInputMode.SPEECH_RECOGNITION) {
4035
- this.speechHandler = new speech_handler_1.SpeechHandler({
4036
- api: this.api,
4037
- apiUrl: this.options.url,
4038
- sessionId: this.session.id,
4034
+ this.sessionJwt
4035
+ .then(({ token }) => {
4036
+ if (this.options.voiceInputMode === VoiceInputMode_1.VoiceInputMode.SPEECH_RECOGNITION) {
4037
+ this.speechHandler = new speech_handler_1.SpeechHandler({
4038
+ api: this.api,
4039
+ apiUrl: this.options.url,
4040
+ sessionId: this.session.id,
4041
+ messages: this.messages,
4042
+ assetBasePath: this.options.assetBasePath,
4043
+ locales: this.options.speechToTextLocales || '',
4044
+ hintPhrases: this.options.speechRecognitionHintPhrases || '',
4045
+ jwtToken: token
4046
+ });
4047
+ }
4048
+ else {
4049
+ // Legacy implementation
4050
+ // Init Voice Input Manager
4051
+ this.voiceInputManager = new voice_input_manager_1.VoiceInputManager(this.options, this.api, this.messages, (enable) => { this.enableMicrophone(enable); });
4052
+ }
4053
+ this.deviceManager = new device_manager_1.DeviceManager({
4054
+ userMessages: this.messages,
4055
+ session: this.session,
4039
4056
  messages: this.messages,
4040
- assetBasePath: this.options.assetBasePath,
4041
- locales: this.options.speechToTextLocales || '',
4042
- hintPhrases: this.options.speechRecognitionHintPhrases || ''
4043
- });
4044
- }
4045
- else {
4046
- // Legacy implementation
4047
- // Init Voice Input Manager
4048
- this.voiceInputManager = new voice_input_manager_1.VoiceInputManager(this.options, this.api, this.messages, (enable) => { this.enableMicrophone(enable); });
4049
- }
4050
- this.deviceManager = new device_manager_1.DeviceManager({
4051
- userMessages: this.messages,
4052
- session: this.session,
4053
- messages: this.messages,
4054
- internalMessages$: this.internalMessages$,
4055
- messaging: this.messaging,
4056
- uneeqOptions: this.options,
4057
- streamManager: this.streamManager,
4058
- voiceInputManager: this.voiceInputManager,
4059
- digitalHumanVideoElement: this.digitalHumanVideoElement
4060
- }, this.api);
4061
- this.messageHandler.setDeviceManager(this.deviceManager);
4057
+ internalMessages$: this.internalMessages$,
4058
+ messaging: this.messaging,
4059
+ uneeqOptions: this.options,
4060
+ streamManager: this.streamManager,
4061
+ voiceInputManager: this.voiceInputManager,
4062
+ digitalHumanVideoElement: this.digitalHumanVideoElement
4063
+ }, this.api);
4064
+ this.messageHandler.setDeviceManager(this.deviceManager);
4065
+ })
4066
+ .catch((err) => {
4067
+ this.messages.next(new MessageTypes_1.SessionErrorMessage(err));
4068
+ });
4062
4069
  }
4063
4070
  sessionLiveHandler() {
4064
4071
  // Send the SessionLive message and play welcome (optional)
@@ -4136,6 +4143,7 @@ class Uneeq {
4136
4143
  if (this.session) {
4137
4144
  this.initPromMetricsListener();
4138
4145
  this.api.callId = this.session.id;
4146
+ this.sessionJwt = this.api.getSessionJwt(this.options.conversationId);
4139
4147
  this.initAvatar();
4140
4148
  const messagingOptions = {
4141
4149
  maxReconnectAttempts: 3,
@@ -13260,7 +13268,7 @@ exports.race = race;
13260
13268
  /***/ ((module) => {
13261
13269
 
13262
13270
  "use strict";
13263
- module.exports = JSON.parse('{"name":"uneeq-js","version":"2.47.6","description":"","main":"dist/index.js","types":"dist/src/index.d.ts","scripts":{"start":"npx webpack -w","test-local":"npx karma start karma.conf.js -logLevel=DEBUG","test":"npx karma start --browsers ChromeHeadless --single-run","test:windows":"karma start karma.conf.js","build":"webpack --config webpack.config.prod.js && webpack --config webpack.config.umd.js","lint":"npx tslint -p tsconfig.json --fix","docs":"npx typedoc --options"},"files":["dist","!dist/test"],"author":"","license":"ISC","dependencies":{"@stomp/stompjs":"^6.0.0","@uehreka/seriously":"^1.0.1","fast-text-encoding":"^1.0.0","intrinsic-scale":"^3.0.4","onnxruntime-web":"^1.15.1","promjs":"^0.4.1","ring-buffer-ts":"^1.2.0","rxjs":"^7.8.1","rxjs-compat":"^6.6.7","simple-peer":"^9.11.1","webrtc-adapter":"^8.2.3"},"devDependencies":{"@types/dom-mediacapture-record":"^1.0.16","@types/jasmine":"^2.8.8","@types/node":"^10.9.4","fetch-mock":"7.7.3","ignore-styles":"^5.0.1","jasmine":"^5.1.0","jasmine-core":"^5.1.0","karma":"^6.4.2","karma-chrome-launcher":"^3.2.0","karma-firefox-launcher":"^2.1.2","karma-jasmine":"^5.1.0","karma-jasmine-html-reporter":"^2.1.0","karma-requirejs":"^1.1.0","karma-typescript":"^5.5.4","karma-typescript-es6-transform":"^5.5.4","nock":"^9.6.1","requirejs":"^2.3.6","ts-loader":"^9.4.4","ts-node":"^7.0.1","tslint":"^5.11.0","tslint-no-focused-test":"^0.5.0","typedoc":"^0.18.0","typescript":"^5.1.6","webpack":"^5.88.2","webpack-cli":"^5.1.4"}}');
13271
+ module.exports = JSON.parse('{"name":"uneeq-js","version":"2.47.7","description":"","main":"dist/index.js","types":"dist/src/index.d.ts","scripts":{"start":"npx webpack -w","test-local":"npx karma start karma.conf.js -logLevel=DEBUG","test":"npx karma start --browsers ChromeHeadless --single-run","test:windows":"karma start karma.conf.js","build":"webpack --config webpack.config.prod.js && webpack --config webpack.config.umd.js","lint":"npx tslint -p tsconfig.json --fix","docs":"npx typedoc --options"},"files":["dist","!dist/test"],"author":"","license":"ISC","dependencies":{"@stomp/stompjs":"^6.0.0","@uehreka/seriously":"^1.0.1","fast-text-encoding":"^1.0.0","intrinsic-scale":"^3.0.4","onnxruntime-web":"^1.15.1","promjs":"^0.4.1","ring-buffer-ts":"^1.2.0","rxjs":"^7.8.1","rxjs-compat":"^6.6.7","simple-peer":"^9.11.1","webrtc-adapter":"^8.2.3"},"devDependencies":{"@types/dom-mediacapture-record":"^1.0.16","@types/jasmine":"^2.8.8","@types/node":"^10.9.4","fetch-mock":"7.7.3","ignore-styles":"^5.0.1","jasmine":"^5.1.0","jasmine-core":"^5.1.0","karma":"^6.4.2","karma-chrome-launcher":"^3.2.0","karma-firefox-launcher":"^2.1.2","karma-jasmine":"^5.1.0","karma-jasmine-html-reporter":"^2.1.0","karma-requirejs":"^1.1.0","karma-typescript":"^5.5.4","karma-typescript-es6-transform":"^5.5.4","nock":"^9.6.1","requirejs":"^2.3.6","ts-loader":"^9.4.4","ts-node":"^7.0.1","tslint":"^5.11.0","tslint-no-focused-test":"^0.5.0","typedoc":"^0.18.0","typescript":"^5.1.6","webpack":"^5.88.2","webpack-cli":"^5.1.4"}}');
13264
13272
 
13265
13273
  /***/ }),
13266
13274
  /* 242 */
@@ -13336,6 +13344,19 @@ class API {
13336
13344
  });
13337
13345
  return this.makeRequest(request);
13338
13346
  }
13347
+ getSessionJwt(personaId) {
13348
+ const request = new Request(this.apiUrl + '/v1/jwt/token', {
13349
+ method: 'POST',
13350
+ headers: {
13351
+ 'Content-Type': 'application/json'
13352
+ },
13353
+ body: JSON.stringify({
13354
+ session_id: this._callId,
13355
+ persona_id: personaId
13356
+ })
13357
+ });
13358
+ return this.makeRequest(request);
13359
+ }
13339
13360
  getTimeZone() {
13340
13361
  return Intl.DateTimeFormat().resolvedOptions().timeZone;
13341
13362
  }
@@ -51271,8 +51292,8 @@ class SpeechHandler {
51271
51292
  });
51272
51293
  }
51273
51294
  initWebsocket(options) {
51274
- let connectionUrl = options.apiUrl.replace('https://api.', 'wss://speech-recognition-service.');
51275
- connectionUrl += '/ws/recognize?session_id=' + options.sessionId;
51295
+ let connectionUrl = options.apiUrl.replace('https://', 'wss://');
51296
+ connectionUrl += `/speech-recognition/ws/recognize?jwt=${options.jwtToken}&session_id=${options.sessionId}`;
51276
51297
  logger_1.logger.log(this.logPrefix + 'Initializing speech recognition websocket to ' + connectionUrl);
51277
51298
  this.ws = new WebSocket(connectionUrl);
51278
51299
  this.ws.onopen = () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "uneeq-js",
3
- "version": "2.47.6",
3
+ "version": "2.47.7",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/src/index.d.ts",
package/readme.md CHANGED
@@ -8,6 +8,9 @@ https://docs.uneeq.io/build-your-own-experience
8
8
  To use uneeq-js with a typescript version < 3.8, 'skipLibCheck' must be set to true.
9
9
 
10
10
  ## Release Notes
11
+ #### 2.47.7
12
+ * added jwt security to speech recognition
13
+
11
14
  #### 2.47.6
12
15
  * Speech Recognition: added support for pause and resume.
13
16