uneeq-js 2.46.3 → 2.46.4
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/index.js +8 -8
- package/dist/src/service/locale-detector.d.ts +1 -1
- package/dist/umd/index.js +176 -11
- package/package.json +1 -1
- package/readme.md +3 -0
package/dist/umd/index.js
CHANGED
|
@@ -18173,7 +18173,7 @@ function zipAll(project) {
|
|
|
18173
18173
|
/* 224 */
|
|
18174
18174
|
/***/ (function(module) {
|
|
18175
18175
|
|
|
18176
|
-
module.exports = JSON.parse("{\"name\":\"uneeq-js\",\"version\":\"2.46.
|
|
18176
|
+
module.exports = JSON.parse("{\"name\":\"uneeq-js\",\"version\":\"2.46.4\",\"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\"}}");
|
|
18177
18177
|
|
|
18178
18178
|
/***/ }),
|
|
18179
18179
|
/* 225 */
|
|
@@ -32957,11 +32957,15 @@ class LocaleDetector {
|
|
|
32957
32957
|
*/
|
|
32958
32958
|
static validateOrDetectSpeechLocales(options) {
|
|
32959
32959
|
let speechToTextLocales = options.speechToTextLocales;
|
|
32960
|
-
// validate config language locales match
|
|
32960
|
+
// validate config language locales match supported list and are not null or undefined
|
|
32961
32961
|
if (speechToTextLocales && speechToTextLocales.length > 0) {
|
|
32962
|
-
|
|
32963
|
-
|
|
32964
|
-
|
|
32962
|
+
let arrayOfLocales = speechToTextLocales.split(':');
|
|
32963
|
+
arrayOfLocales.forEach((locale) => {
|
|
32964
|
+
if (!this.sttSupportedLocales[locale]) {
|
|
32965
|
+
console.error(`UneeQ: Speech to text not supported for: ${locale}. Defaulting to en-US`);
|
|
32966
|
+
speechToTextLocales = this.defaultLocale;
|
|
32967
|
+
}
|
|
32968
|
+
});
|
|
32965
32969
|
if (speechToTextLocales === 'undefined' || speechToTextLocales === 'null') {
|
|
32966
32970
|
speechToTextLocales = this.defaultLocale;
|
|
32967
32971
|
}
|
|
@@ -32969,27 +32973,37 @@ class LocaleDetector {
|
|
|
32969
32973
|
// Get the user's language preferences from the browser
|
|
32970
32974
|
const userLanguages = window.navigator.languages || [window.navigator.language];
|
|
32971
32975
|
// Map two-letter language locales to four-letter language locales
|
|
32976
|
+
// Chinese is unusual for our STT so requires special manipulation
|
|
32972
32977
|
const filteredUserLanguages = userLanguages.map((lang) => {
|
|
32973
|
-
if (lang.length < 5) {
|
|
32974
|
-
|
|
32978
|
+
if (lang.length < 5 || lang === 'zh-CN') {
|
|
32979
|
+
lang = this.localeMappings[lang] || null;
|
|
32980
|
+
}
|
|
32981
|
+
if (lang && !this.sttSupportedLocales[lang]) {
|
|
32982
|
+
console.warn(`UneeQ: Speech to text not supported for one of the detected languages: ${lang}. Replacing with en-US.`);
|
|
32983
|
+
lang = this.defaultLocale;
|
|
32975
32984
|
}
|
|
32976
32985
|
return lang;
|
|
32977
32986
|
});
|
|
32978
32987
|
// Truncate the array to a maximum of 4 elements
|
|
32979
|
-
const truncatedUserLanguages = filteredUserLanguages.slice(0, 4);
|
|
32988
|
+
const truncatedUserLanguages = filteredUserLanguages.slice(0, 4).filter(notEmpty).filter((v, i, a) => a.indexOf(v) === i);
|
|
32980
32989
|
// Join the filtered and truncated user's language preferences into a string separated by colons
|
|
32981
|
-
let userLanguageLocales = truncatedUserLanguages.join(':');
|
|
32990
|
+
let userLanguageLocales = truncatedUserLanguages.join(':').replace(/:\s*$/, "");
|
|
32982
32991
|
if (!userLanguageLocales || userLanguageLocales.length === 0) {
|
|
32983
32992
|
// If the user's language preferences are empty, default to en-US
|
|
32984
32993
|
userLanguageLocales = this.defaultLocale;
|
|
32985
32994
|
}
|
|
32995
|
+
if (speechToTextLocales && speechToTextLocales.length > 0) {
|
|
32996
|
+
console.debug(`UneeQ: Configured speech to text languages: ${speechToTextLocales}`);
|
|
32997
|
+
}
|
|
32998
|
+
else {
|
|
32999
|
+
console.warn(`UneeQ: Detected speechToText languages from browser: ${userLanguageLocales}`);
|
|
33000
|
+
}
|
|
32986
33001
|
// Return the concatenated language locales string if config has not supplied any
|
|
32987
33002
|
return speechToTextLocales || userLanguageLocales;
|
|
32988
33003
|
}
|
|
32989
33004
|
}
|
|
32990
33005
|
exports.LocaleDetector = LocaleDetector;
|
|
32991
33006
|
LocaleDetector.defaultLocale = 'en-US';
|
|
32992
|
-
LocaleDetector.localesRegEx = /^([a-z]{2}(-[A-Z]{2}))(:[a-z]{2}(-[A-Z]{2})?)*$/;
|
|
32993
33007
|
// Map two-letter language locales to four-letter language locales
|
|
32994
33008
|
LocaleDetector.localeMappings = {
|
|
32995
33009
|
en: 'en-US',
|
|
@@ -32998,7 +33012,7 @@ LocaleDetector.localeMappings = {
|
|
|
32998
33012
|
ja: 'ja-JP',
|
|
32999
33013
|
de: 'de-DE',
|
|
33000
33014
|
ko: 'ko-KR',
|
|
33001
|
-
zh: '
|
|
33015
|
+
zh: 'cmn-Hans-CN',
|
|
33002
33016
|
it: 'it-IT',
|
|
33003
33017
|
pt: 'pt-PT',
|
|
33004
33018
|
nl: 'nl-NL',
|
|
@@ -33019,7 +33033,158 @@ LocaleDetector.localeMappings = {
|
|
|
33019
33033
|
vi: 'vi-VN',
|
|
33020
33034
|
uk: 'uk-UA',
|
|
33021
33035
|
hi: 'hi-IN',
|
|
33036
|
+
'zh-CN': 'cmn-Hans-CN',
|
|
33022
33037
|
};
|
|
33038
|
+
LocaleDetector.sttSupportedLocales = {
|
|
33039
|
+
"af-ZA": true,
|
|
33040
|
+
"sq-AL": true,
|
|
33041
|
+
"am-ET": true,
|
|
33042
|
+
"ar-DZ": true,
|
|
33043
|
+
"ar-BH": true,
|
|
33044
|
+
"ar-EG": true,
|
|
33045
|
+
"ar-IQ": true,
|
|
33046
|
+
"ar-IL": true,
|
|
33047
|
+
"ar-JO": true,
|
|
33048
|
+
"ar-KW": true,
|
|
33049
|
+
"ar-LB": true,
|
|
33050
|
+
"ar-MR": true,
|
|
33051
|
+
"ar-MA": true,
|
|
33052
|
+
"ar-OM": true,
|
|
33053
|
+
"ar-QA": true,
|
|
33054
|
+
"ar-SA": true,
|
|
33055
|
+
"ar-PS": true,
|
|
33056
|
+
"ar-TN": true,
|
|
33057
|
+
"ar-AE": true,
|
|
33058
|
+
"ar-YE": true,
|
|
33059
|
+
"hy-AM": true,
|
|
33060
|
+
"az-AZ": true,
|
|
33061
|
+
"eu-ES": true,
|
|
33062
|
+
"bn-BD": true,
|
|
33063
|
+
"bn-IN": true,
|
|
33064
|
+
"bs-BA": true,
|
|
33065
|
+
"bg-BG": true,
|
|
33066
|
+
"my-MM": true,
|
|
33067
|
+
"ca-ES": true,
|
|
33068
|
+
"yue-Hant-HK": true,
|
|
33069
|
+
"cmn-Hans-CN": true,
|
|
33070
|
+
"cmn-Hant-TW": true,
|
|
33071
|
+
"hr-HR": true,
|
|
33072
|
+
"cs-CZ": true,
|
|
33073
|
+
"da-DK": true,
|
|
33074
|
+
"nl-BE": true,
|
|
33075
|
+
"nl-NL": true,
|
|
33076
|
+
"en-AU": true,
|
|
33077
|
+
"en-CA": true,
|
|
33078
|
+
"en-GH": true,
|
|
33079
|
+
"en-HK": true,
|
|
33080
|
+
"en-IN": true,
|
|
33081
|
+
"en-IE": true,
|
|
33082
|
+
"en-KE": true,
|
|
33083
|
+
"en-NZ": true,
|
|
33084
|
+
"en-NG": true,
|
|
33085
|
+
"en-PK": true,
|
|
33086
|
+
"en-PH": true,
|
|
33087
|
+
"en-SG": true,
|
|
33088
|
+
"en-ZA": true,
|
|
33089
|
+
"en-TZ": true,
|
|
33090
|
+
"en-GB": true,
|
|
33091
|
+
"en-US": true,
|
|
33092
|
+
"et-EE": true,
|
|
33093
|
+
"fil-PH": true,
|
|
33094
|
+
"fi-FI": true,
|
|
33095
|
+
"fr-BE": true,
|
|
33096
|
+
"fr-CA": true,
|
|
33097
|
+
"fr-FR": true,
|
|
33098
|
+
"fr-CH": true,
|
|
33099
|
+
"gl-ES": true,
|
|
33100
|
+
"ka-GE": true,
|
|
33101
|
+
"de-AT": true,
|
|
33102
|
+
"de-DE": true,
|
|
33103
|
+
"de-CH": true,
|
|
33104
|
+
"el-GR": true,
|
|
33105
|
+
"gu-IN": true,
|
|
33106
|
+
"iw-IL": true,
|
|
33107
|
+
"hi-IN": true,
|
|
33108
|
+
"hu-HU": true,
|
|
33109
|
+
"is-IS": true,
|
|
33110
|
+
"id-ID": true,
|
|
33111
|
+
"it-IT": true,
|
|
33112
|
+
"it-CH": true,
|
|
33113
|
+
"ja-JP": true,
|
|
33114
|
+
"jv-ID": true,
|
|
33115
|
+
"kn-IN": true,
|
|
33116
|
+
"kk-KZ": true,
|
|
33117
|
+
"km-KH": true,
|
|
33118
|
+
"ko-KR": true,
|
|
33119
|
+
"lo-LA": true,
|
|
33120
|
+
"lv-LV": true,
|
|
33121
|
+
"lt-LT": true,
|
|
33122
|
+
"mk-MK": true,
|
|
33123
|
+
"ms-MY": true,
|
|
33124
|
+
"ml-IN": true,
|
|
33125
|
+
"mr-IN": true,
|
|
33126
|
+
"mn-MN": true,
|
|
33127
|
+
"ne-NP": true,
|
|
33128
|
+
"no-NO": true,
|
|
33129
|
+
"fa-IR": true,
|
|
33130
|
+
"pl-PL": true,
|
|
33131
|
+
"pt-BR": true,
|
|
33132
|
+
"pt-PT": true,
|
|
33133
|
+
"pa-Guru-IN": true,
|
|
33134
|
+
"ro-RO": true,
|
|
33135
|
+
"ru-RU": true,
|
|
33136
|
+
"rw-RW": true,
|
|
33137
|
+
"sr-RS": true,
|
|
33138
|
+
"si-LK": true,
|
|
33139
|
+
"sk-SK": true,
|
|
33140
|
+
"sl-SI": true,
|
|
33141
|
+
"ss-latn-za": true,
|
|
33142
|
+
"st-ZA": true,
|
|
33143
|
+
"es-AR": true,
|
|
33144
|
+
"es-BO": true,
|
|
33145
|
+
"es-CL": true,
|
|
33146
|
+
"es-CO": true,
|
|
33147
|
+
"es-CR": true,
|
|
33148
|
+
"es-DO": true,
|
|
33149
|
+
"es-EC": true,
|
|
33150
|
+
"es-SV": true,
|
|
33151
|
+
"es-GT": true,
|
|
33152
|
+
"es-HN": true,
|
|
33153
|
+
"es-MX": true,
|
|
33154
|
+
"es-NI": true,
|
|
33155
|
+
"es-PA": true,
|
|
33156
|
+
"es-PY": true,
|
|
33157
|
+
"es-PE": true,
|
|
33158
|
+
"es-PR": true,
|
|
33159
|
+
"es-ES": true,
|
|
33160
|
+
"es-US": true,
|
|
33161
|
+
"es-UY": true,
|
|
33162
|
+
"es-VE": true,
|
|
33163
|
+
"su-ID": true,
|
|
33164
|
+
"sw-KE": true,
|
|
33165
|
+
"sw-TZ": true,
|
|
33166
|
+
"sv-SE": true,
|
|
33167
|
+
"ta-IN": true,
|
|
33168
|
+
"ta-MY": true,
|
|
33169
|
+
"ta-SG": true,
|
|
33170
|
+
"ta-LK": true,
|
|
33171
|
+
"te-IN": true,
|
|
33172
|
+
"th-TH": true,
|
|
33173
|
+
"tn-latn-za": true,
|
|
33174
|
+
"tr-TR": true,
|
|
33175
|
+
"ts-ZA": true,
|
|
33176
|
+
"uk-UA": true,
|
|
33177
|
+
"ur-IN": true,
|
|
33178
|
+
"ur-PK": true,
|
|
33179
|
+
"uz-UZ": true,
|
|
33180
|
+
"ve-ZA": true,
|
|
33181
|
+
"vi-VN": true,
|
|
33182
|
+
"xh-ZA": true,
|
|
33183
|
+
"zu-ZA": true,
|
|
33184
|
+
};
|
|
33185
|
+
function notEmpty(value) {
|
|
33186
|
+
return value !== null && value !== undefined;
|
|
33187
|
+
}
|
|
33023
33188
|
|
|
33024
33189
|
|
|
33025
33190
|
/***/ }),
|
package/package.json
CHANGED
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.46.4
|
|
12
|
+
* Improve locale detection to ensure we fall back to supported speech to text languages
|
|
13
|
+
|
|
11
14
|
#### 2.46.3
|
|
12
15
|
* Fix for sessions to start without localStorage availability.
|
|
13
16
|
|