uneeq-js 2.44.5 → 2.45.0

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.
@@ -3,4 +3,5 @@ export interface PersonaStartRequest {
3
3
  resumeSession?: boolean;
4
4
  backgroundImageUrl?: string;
5
5
  nameTagImageUrl?: string;
6
+ speechToTextLocales?: string;
6
7
  }
@@ -65,4 +65,13 @@ export interface UneeqOptions {
65
65
  * This option specifies the URL of the name tag image to be used when the digital human is rendered.
66
66
  */
67
67
  nameTagImageUrl?: string;
68
+ /**
69
+ * This option specifies up to four locales that the Digital Human should understand a person speaking (speech recognition)
70
+ * The locales are specified in the BCP-47 format e.g "en-US".
71
+ * The first locale is considered the primary locale.
72
+ * Locales should be separated with a colon e.g "en-US:en-GB:en-AU".
73
+ *
74
+ * Note: this is ignored if using the VOICE_ACTIVITY voiceInputMode mode.
75
+ */
76
+ speechToTextLocales?: string;
68
77
  }
@@ -3,8 +3,13 @@ import 'rxjs/add/operator/filter';
3
3
  import { UneeqOptions } from './types/types';
4
4
  import { VoiceInputMode } from './types/VoiceInputMode';
5
5
  export declare class Uneeq {
6
+ /**
7
+ * The active session id as a string. If the session has not started yet value will be null
8
+ */
9
+ get sessionId(): string | null;
6
10
  static onDataMessage: (msg: any) => void;
7
11
  static onStatMessage: (stats: any) => void;
12
+ private static localesRegEx;
8
13
  ready: BehaviorSubject<boolean>;
9
14
  version: string;
10
15
  private messages;
@@ -39,10 +44,6 @@ export declare class Uneeq {
39
44
  * should be used instead of init() when a third party conversation service is used.
40
45
  */
41
46
  initWithToken(tokenId: string): Promise<void>;
42
- /**
43
- * The active session id as a string. If the session has not started yet value will be null
44
- */
45
- get sessionId(): string | null;
46
47
  /**
47
48
  * Set a preferred camera to use in a live session. On success, SetCameraSuccessMessage
48
49
  * will be sent. DeviceNotFoundErrorMessage will be sent when the requested device is not found.
@@ -151,4 +152,10 @@ export declare class Uneeq {
151
152
  */
152
153
  private initOnlineStatusUpdateMessages;
153
154
  private initPromMetricsListener;
155
+ /**
156
+ * Validates one or more colon-separated locales
157
+ * @param locales
158
+ * @returns locales if valid, empty string otherwise
159
+ */
160
+ private validateLocales;
154
161
  }
package/dist/umd/index.js CHANGED
@@ -5789,6 +5789,7 @@ class Uneeq {
5789
5789
  this.options.enableTransparentBackground = options.enableTransparentBackground || false;
5790
5790
  this.options.backgroundImageUrl = options.backgroundImageUrl || '';
5791
5791
  this.options.nameTagImageUrl = options.nameTagImageUrl || '';
5792
+ this.options.speechToTextLocales = this.validateLocales(options.speechToTextLocales);
5792
5793
  // TODO update default mode to VOICE_ACTIVITY once we are confident in the solution.
5793
5794
  this.options.voiceInputMode = options.voiceInputMode || VoiceInputMode_1.VoiceInputMode.PUSH_TO_TALK;
5794
5795
  this.api = new api_1.API(this.options.url, this.options.apiKey);
@@ -5810,6 +5811,15 @@ class Uneeq {
5810
5811
  this.metricsService = new metrics_service_1.MetricsService(this.options, this.internalMessages$, this.messages);
5811
5812
  this.dhVideoPlayManager = new digital_human_video_play_manager_1.DigitalHumanVideoPlayManager(this.messages, () => { this.unmuteDigitalHuman(); });
5812
5813
  }
5814
+ /**
5815
+ * The active session id as a string. If the session has not started yet value will be null
5816
+ */
5817
+ get sessionId() {
5818
+ if (this.session) {
5819
+ return this.session.id;
5820
+ }
5821
+ return null;
5822
+ }
5813
5823
  /* Enable or disable logging */
5814
5824
  setLoggerEnabled(enabled) {
5815
5825
  logger_1.logger.enabled = enabled;
@@ -5860,15 +5870,6 @@ class Uneeq {
5860
5870
  }
5861
5871
  });
5862
5872
  }
5863
- /**
5864
- * The active session id as a string. If the session has not started yet value will be null
5865
- */
5866
- get sessionId() {
5867
- if (this.session) {
5868
- return this.session.id;
5869
- }
5870
- return null;
5871
- }
5872
5873
  /**
5873
5874
  * Set a preferred camera to use in a live session. On success, SetCameraSuccessMessage
5874
5875
  * will be sent. DeviceNotFoundErrorMessage will be sent when the requested device is not found.
@@ -6174,7 +6175,8 @@ class Uneeq {
6174
6175
  enableTransparentBackground: this.options.enableTransparentBackground,
6175
6176
  resumeSession: this.sessionWasResumed,
6176
6177
  backgroundImageUrl: this.options.backgroundImageUrl,
6177
- nameTagImageUrl: this.options.nameTagImageUrl
6178
+ nameTagImageUrl: this.options.nameTagImageUrl,
6179
+ speechToTextLocales: this.options.speechToTextLocales
6178
6180
  }).catch((err) => {
6179
6181
  console.error('UneeQ: Digital human could not be started. Clearing resumeSession token and ending process.', err);
6180
6182
  localStorage.removeItem('uneeqResumeSessionId');
@@ -6252,8 +6254,25 @@ class Uneeq {
6252
6254
  prom.handleMessage(message.promMsg);
6253
6255
  });
6254
6256
  }
6257
+ /**
6258
+ * Validates one or more colon-separated locales
6259
+ * @param locales
6260
+ * @returns locales if valid, empty string otherwise
6261
+ */
6262
+ validateLocales(locales = '') {
6263
+ if (locales.length > 0) {
6264
+ if (locales.match(Uneeq.localesRegEx)) {
6265
+ return locales;
6266
+ }
6267
+ else {
6268
+ console.error(`UneeQ: Invalid value for speechToTextLocales: ${locales}. Please use a valid BCP 47 language tag with multiple locales separated by colon .e.g 'en-US:ja-JP`);
6269
+ }
6270
+ }
6271
+ return '';
6272
+ }
6255
6273
  }
6256
6274
  exports.Uneeq = Uneeq;
6275
+ Uneeq.localesRegEx = /^([a-z]{2}(-[A-Z]{2})?)(:[a-z]{2}(-[A-Z]{2})?)*$/;
6257
6276
 
6258
6277
 
6259
6278
  /***/ }),
@@ -18156,7 +18175,7 @@ function zipAll(project) {
18156
18175
  /* 224 */
18157
18176
  /***/ (function(module) {
18158
18177
 
18159
- module.exports = JSON.parse("{\"name\":\"uneeq-js\",\"version\":\"2.44.5\",\"description\":\"\",\"main\":\"dist/index.js\",\"types\":\"dist/src/index.d.ts\",\"scripts\":{\"start\":\"npx webpack -w\",\"test-local\":\"./node_modules/karma/bin/karma start karma.conf.js -logLevel=DEBUG\",\"test\":\"./node_modules/karma/bin/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\":\"./node_modules/tslint/bin/tslint -p tsconfig.json --fix\",\"docs\":\"./node_modules/typedoc/bin/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\",\"promjs\":\"^0.4.1\",\"rxjs\":\"^6.2.2\",\"rxjs-compat\":\"^6.3.2\",\"simple-peer\":\"9.11.0\",\"webrtc-adapter\":\"8.1.0\"},\"devDependencies\":{\"@types/jasmine\":\"^2.8.8\",\"@types/node\":\"^10.9.4\",\"fetch-mock\":\"7.7.3\",\"ignore-styles\":\"^5.0.1\",\"jasmine\":\"^3.2.0\",\"jasmine-class-mock\":\"^1.0.1\",\"jasmine-core\":\"^3.3.0\",\"karma\":\"^5.0.0\",\"karma-chrome-launcher\":\"^2.2.0\",\"karma-firefox-launcher\":\"^1.1.0\",\"karma-jasmine\":\"^2.0.1\",\"karma-jasmine-html-reporter\":\"^1.4.0\",\"karma-requirejs\":\"^1.1.0\",\"karma-safari-launcher\":\"^1.0.0\",\"karma-typescript\":\"^5.0.0\",\"karma-typescript-es6-transform\":\"^5.0.0\",\"nock\":\"^9.6.1\",\"requirejs\":\"^2.3.6\",\"ts-loader\":\"^5.0.0\",\"ts-node\":\"^7.0.1\",\"tslint\":\"^5.11.0\",\"tslint-no-focused-test\":\"^0.5.0\",\"typedoc\":\"^0.18.0\",\"typescript\":\"^3.9.7\",\"webpack\":\"^4.17.1\",\"webpack-cli\":\"^3.1.0\"}}");
18178
+ module.exports = JSON.parse("{\"name\":\"uneeq-js\",\"version\":\"2.45.0\",\"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\",\"promjs\":\"^0.4.1\",\"rxjs\":\"^6.2.2\",\"rxjs-compat\":\"^6.3.2\",\"simple-peer\":\"9.11.0\",\"webrtc-adapter\":\"8.1.0\"},\"devDependencies\":{\"@types/jasmine\":\"^2.8.8\",\"@types/node\":\"^10.9.4\",\"fetch-mock\":\"7.7.3\",\"ignore-styles\":\"^5.0.1\",\"jasmine\":\"^3.2.0\",\"jasmine-class-mock\":\"^1.0.1\",\"jasmine-core\":\"^3.3.0\",\"karma\":\"^5.0.0\",\"karma-chrome-launcher\":\"^2.2.0\",\"karma-firefox-launcher\":\"^1.1.0\",\"karma-jasmine\":\"^2.0.1\",\"karma-jasmine-html-reporter\":\"^1.4.0\",\"karma-requirejs\":\"^1.1.0\",\"karma-safari-launcher\":\"^1.0.0\",\"karma-typescript\":\"^5.0.0\",\"karma-typescript-es6-transform\":\"^5.0.0\",\"nock\":\"^9.6.1\",\"requirejs\":\"^2.3.6\",\"ts-loader\":\"^5.0.0\",\"ts-node\":\"^7.0.1\",\"tslint\":\"^5.11.0\",\"tslint-no-focused-test\":\"^0.5.0\",\"typedoc\":\"^0.18.0\",\"typescript\":\"^3.9.7\",\"webpack\":\"^4.17.1\",\"webpack-cli\":\"^3.1.0\"}}");
18160
18179
 
18161
18180
  /***/ }),
18162
18181
  /* 225 */
@@ -51101,6 +51120,7 @@ class MessagingService {
51101
51120
  logger_1.logger.log('Disconnecting stomp client');
51102
51121
  try {
51103
51122
  this.subscriptions = {};
51123
+ this.options.autoReconnect = false; // turn off reconnection because it has been manually disconnected
51104
51124
  this.stompClient.deactivate();
51105
51125
  this.stompClient.forceDisconnect();
51106
51126
  this.state$.next(messaging_state_1.MessagingState.DISCONNECTED);
package/package.json CHANGED
@@ -1,17 +1,17 @@
1
1
  {
2
2
  "name": "uneeq-js",
3
- "version": "2.44.5",
3
+ "version": "2.45.0",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/src/index.d.ts",
7
7
  "scripts": {
8
8
  "start": "npx webpack -w",
9
- "test-local": "./node_modules/karma/bin/karma start karma.conf.js -logLevel=DEBUG",
10
- "test": "./node_modules/karma/bin/karma start --browsers ChromeHeadless --single-run",
9
+ "test-local": "npx karma start karma.conf.js -logLevel=DEBUG",
10
+ "test": "npx karma start --browsers ChromeHeadless --single-run",
11
11
  "test:windows": "karma start karma.conf.js",
12
12
  "build": "webpack --config webpack.config.prod.js && webpack --config webpack.config.umd.js",
13
- "lint": "./node_modules/tslint/bin/tslint -p tsconfig.json --fix",
14
- "docs": "./node_modules/typedoc/bin/typedoc --options"
13
+ "lint": "npx tslint -p tsconfig.json --fix",
14
+ "docs": "npx typedoc --options"
15
15
  },
16
16
  "files": [
17
17
  "dist",
package/readme.md CHANGED
@@ -8,6 +8,12 @@ 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.45.0
12
+ * Added ability to, when starting a session, specify up to four languages (using locale codes) that a Digital Human should understand
13
+
14
+ #### 2.44.6
15
+ * Fixed an issue when ending a session that would cause newly created sessions to be ended shortly after.
16
+
11
17
  #### 2.44.5
12
18
  * Fixed issue preventing Firefox based sessions from starting
13
19