@seniorsistemas/angular-components 17.26.9-bugfix-sds-309-cfd66723 → 17.26.9-bugfix-sds-307-c6084396
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/bundles/seniorsistemas-angular-components.umd.js +45 -68
- package/bundles/seniorsistemas-angular-components.umd.js.map +1 -1
- package/bundles/seniorsistemas-angular-components.umd.min.js +2 -2
- package/bundles/seniorsistemas-angular-components.umd.min.js.map +1 -1
- package/components/speech-recognition/speech-recognition.service.d.ts +2 -1
- package/esm2015/components/speech-recognition/speech-recognition/speech-recognition.component.js +1 -1
- package/esm2015/components/speech-recognition/speech-recognition.service.js +22 -36
- package/esm2015/components/tooltip/tooltip.component.js +1 -1
- package/esm5/components/speech-recognition/speech-recognition/speech-recognition.component.js +1 -1
- package/esm5/components/speech-recognition/speech-recognition.service.js +46 -69
- package/esm5/components/tooltip/tooltip.component.js +1 -1
- package/fesm2015/seniorsistemas-angular-components.js +21 -35
- package/fesm2015/seniorsistemas-angular-components.js.map +1 -1
- package/fesm5/seniorsistemas-angular-components.js +45 -68
- package/fesm5/seniorsistemas-angular-components.js.map +1 -1
- package/package.json +1 -1
- package/seniorsistemas-angular-components.metadata.json +1 -1
|
@@ -389,7 +389,7 @@ var TooltipComponent = /** @class */ (function () {
|
|
|
389
389
|
TooltipComponent = __decorate([
|
|
390
390
|
Component({
|
|
391
391
|
template: "<div\n id=\"tooltip\"\n class=\"tooltip\"\n [ngClass]=\"['tooltip--' + position]\"\n [class.tooltip--visible]=\"visible\"\n [ngStyle]=\"{\n 'left': left + 'px',\n 'top': top + 'px'\n }\">\n <ng-template\n *ngIf=\"escape;\n then escapeTemplate;\n else noEscapeTemplate\">\n </ng-template> \n</div>\n\n<ng-template #noEscapeTemplate>\n <span\n class=\"tooltip__content\"\n [innerHTML]=\"tooltip\">\n </span>\n</ng-template>\n\n<ng-template #escapeTemplate>\n <span class=\"tooltip__content\">\n {{ tooltip }}\n </span>\n</ng-template>",
|
|
392
|
-
styles: [".tooltip{background-color:#000;border-radius:2px;color:#fff;font-family:\"Open Sans\",sans-serif;font-size:14px;font-weight:400;line-height:21px;opacity:0;padding:8px;
|
|
392
|
+
styles: [".tooltip{background-color:#000;border-radius:2px;color:#fff;font-family:\"Open Sans\",sans-serif;font-size:14px;font-weight:400;line-height:21px;opacity:0;padding:8px;transform:translateX(-50%);text-align:center;max-width:220px;word-wrap:break-word;z-index:99999;position:absolute}.tooltip--visible{opacity:1;transition:opacity .3s}.tooltip::before{content:\"\";height:0;position:absolute;width:0}.tooltip--bottom{margin-top:5px;transform:translateX(-50%)}.tooltip--bottom::before{border:5px solid transparent;border-bottom:5px solid #000;left:calc(50% - 5px);top:-10px}.tooltip--top{margin-bottom:5px;transform:translate(-50%,-100%)}.tooltip--top::before{border:5px solid transparent;border-top:5px solid #000;left:calc(50% - 5px);bottom:-10px}.tooltip--left{margin-right:28px;transform:translate(calc(-100% - 7px),-50%)}.tooltip--left::before{border:5px solid transparent;border-left:5px solid #000;right:-10px;bottom:calc(50% - 5px)}.tooltip--right{margin-left:7px;transform:translateY(-50%)}.tooltip--right::before{border:5px solid transparent;border-right:5px solid #000;left:-10px;bottom:calc(50% - 5px)}"]
|
|
393
393
|
})
|
|
394
394
|
], TooltipComponent);
|
|
395
395
|
return TooltipComponent;
|
|
@@ -11359,7 +11359,9 @@ var SpeechRecognitionService = /** @class */ (function () {
|
|
|
11359
11359
|
this.translateService = translateService;
|
|
11360
11360
|
this.hasSupportSpeechRecognition = false;
|
|
11361
11361
|
this.isListening = false;
|
|
11362
|
+
this.hasMicrophoneAccess = false;
|
|
11362
11363
|
this.TIMEOUT_NO_MESSAGE = 3000;
|
|
11364
|
+
this.verifyMicrophoneState();
|
|
11363
11365
|
this.setRecognition();
|
|
11364
11366
|
}
|
|
11365
11367
|
SpeechRecognitionService.prototype.listen = function () {
|
|
@@ -11368,70 +11370,82 @@ var SpeechRecognitionService = /** @class */ (function () {
|
|
|
11368
11370
|
if (this.isListening) {
|
|
11369
11371
|
speechSubject.error('Already listening');
|
|
11370
11372
|
}
|
|
11371
|
-
this.hasMicrophoneAccess
|
|
11372
|
-
|
|
11373
|
-
|
|
11374
|
-
|
|
11375
|
-
|
|
11376
|
-
|
|
11377
|
-
|
|
11378
|
-
|
|
11379
|
-
|
|
11380
|
-
|
|
11381
|
-
var
|
|
11382
|
-
var
|
|
11383
|
-
if (
|
|
11384
|
-
clearTimeout(
|
|
11373
|
+
else if (!this.hasMicrophoneAccess) {
|
|
11374
|
+
this.isListening = false;
|
|
11375
|
+
this.toastService.show({ severity: 'error', text: this.translateService.instant('platform.angular_components.no_microphone_permission') });
|
|
11376
|
+
speechSubject.error('Microphone access is disabled');
|
|
11377
|
+
}
|
|
11378
|
+
else {
|
|
11379
|
+
this.isListening = true;
|
|
11380
|
+
this.recognition.continuous = true;
|
|
11381
|
+
this.recognition.interimResults = true;
|
|
11382
|
+
this.recognition.maxAlternatives = 1;
|
|
11383
|
+
var silenceTimer_1;
|
|
11384
|
+
var restartSilenceTimer_1 = function () {
|
|
11385
|
+
if (silenceTimer_1 !== undefined) {
|
|
11386
|
+
clearTimeout(silenceTimer_1);
|
|
11385
11387
|
}
|
|
11386
|
-
|
|
11388
|
+
silenceTimer_1 = setTimeout(function () {
|
|
11387
11389
|
_this.recognition.stop();
|
|
11388
11390
|
}, _this.TIMEOUT_NO_MESSAGE);
|
|
11389
11391
|
};
|
|
11390
|
-
var
|
|
11391
|
-
var
|
|
11392
|
-
|
|
11392
|
+
var fullTranscript_1 = '';
|
|
11393
|
+
var interimTranscript_1 = '';
|
|
11394
|
+
this.recognition.onresult = function (event) {
|
|
11393
11395
|
_this.ngZone.run(function () {
|
|
11394
|
-
|
|
11396
|
+
restartSilenceTimer_1();
|
|
11395
11397
|
var interimTranscript = '';
|
|
11396
11398
|
for (var i = event.resultIndex; i < event.results.length; ++i) {
|
|
11397
11399
|
var transcript = event.results[i][0].transcript;
|
|
11398
11400
|
if (event.results[i].isFinal) {
|
|
11399
|
-
|
|
11401
|
+
fullTranscript_1 += transcript + '\n';
|
|
11400
11402
|
}
|
|
11401
11403
|
else {
|
|
11402
11404
|
interimTranscript += transcript;
|
|
11403
11405
|
}
|
|
11404
11406
|
}
|
|
11405
11407
|
interimTranscript = interimTranscript;
|
|
11406
|
-
speechSubject.next({ text:
|
|
11408
|
+
speechSubject.next({ text: fullTranscript_1 + interimTranscript, isFinal: false });
|
|
11407
11409
|
});
|
|
11408
11410
|
};
|
|
11409
|
-
|
|
11411
|
+
this.recognition.onerror = function () {
|
|
11410
11412
|
_this.ngZone.run(function () {
|
|
11411
|
-
if (
|
|
11412
|
-
clearTimeout(
|
|
11413
|
+
if (silenceTimer_1 !== undefined) {
|
|
11414
|
+
clearTimeout(silenceTimer_1);
|
|
11413
11415
|
}
|
|
11414
11416
|
_this.isListening = false;
|
|
11415
11417
|
speechSubject.error('Speech recognition error');
|
|
11416
11418
|
});
|
|
11417
11419
|
};
|
|
11418
|
-
|
|
11420
|
+
this.recognition.onend = function () {
|
|
11419
11421
|
_this.ngZone.run(function () {
|
|
11420
|
-
if (
|
|
11421
|
-
clearTimeout(
|
|
11422
|
+
if (silenceTimer_1 !== undefined) {
|
|
11423
|
+
clearTimeout(silenceTimer_1);
|
|
11422
11424
|
}
|
|
11423
|
-
speechSubject.next({ text:
|
|
11425
|
+
speechSubject.next({ text: fullTranscript_1 + interimTranscript_1, isFinal: true });
|
|
11424
11426
|
_this.isListening = false;
|
|
11425
11427
|
speechSubject.complete();
|
|
11426
11428
|
});
|
|
11427
11429
|
};
|
|
11428
|
-
|
|
11429
|
-
}
|
|
11430
|
+
this.recognition.start();
|
|
11431
|
+
}
|
|
11430
11432
|
return speechSubject;
|
|
11431
11433
|
};
|
|
11432
11434
|
SpeechRecognitionService.prototype.stop = function () {
|
|
11433
11435
|
this.recognition.stop();
|
|
11434
11436
|
};
|
|
11437
|
+
SpeechRecognitionService.prototype.verifyMicrophoneState = function () {
|
|
11438
|
+
var _this = this;
|
|
11439
|
+
navigator.permissions.query({ name: 'microphone' }).then(function (result) {
|
|
11440
|
+
var microphoneResultState = result.state;
|
|
11441
|
+
_this.hasMicrophoneAccess = microphoneResultState === 'granted';
|
|
11442
|
+
result.onchange = function () {
|
|
11443
|
+
_this.ngZone.run(function () {
|
|
11444
|
+
_this.hasMicrophoneAccess = result.state === 'granted';
|
|
11445
|
+
});
|
|
11446
|
+
};
|
|
11447
|
+
});
|
|
11448
|
+
};
|
|
11435
11449
|
SpeechRecognitionService.prototype.setRecognition = function () {
|
|
11436
11450
|
var _this = this;
|
|
11437
11451
|
var _a;
|
|
@@ -11447,43 +11461,6 @@ var SpeechRecognitionService = /** @class */ (function () {
|
|
|
11447
11461
|
this.recognition.maxAlternatives = 1;
|
|
11448
11462
|
this.localeService.getLocale().subscribe(function (locale) { return _this.recognition.lang = locale; });
|
|
11449
11463
|
};
|
|
11450
|
-
SpeechRecognitionService.prototype.hasMicrophoneAccess = function () {
|
|
11451
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
11452
|
-
var permission, stream, _a, _b;
|
|
11453
|
-
return __generator(this, function (_c) {
|
|
11454
|
-
switch (_c.label) {
|
|
11455
|
-
case 0:
|
|
11456
|
-
_c.trys.push([0, 6, , 7]);
|
|
11457
|
-
return [4 /*yield*/, navigator.permissions.query({ name: 'microphone' })];
|
|
11458
|
-
case 1:
|
|
11459
|
-
permission = _c.sent();
|
|
11460
|
-
if (permission.state === 'denied') {
|
|
11461
|
-
return [2 /*return*/, false];
|
|
11462
|
-
}
|
|
11463
|
-
if (permission.state === 'granted') {
|
|
11464
|
-
return [2 /*return*/, true];
|
|
11465
|
-
}
|
|
11466
|
-
if (!(permission.state === 'prompt')) return [3 /*break*/, 5];
|
|
11467
|
-
_c.label = 2;
|
|
11468
|
-
case 2:
|
|
11469
|
-
_c.trys.push([2, 4, , 5]);
|
|
11470
|
-
return [4 /*yield*/, navigator.mediaDevices.getUserMedia({ audio: true })];
|
|
11471
|
-
case 3:
|
|
11472
|
-
stream = _c.sent();
|
|
11473
|
-
stream.getTracks().forEach(function (t) { return t.stop(); });
|
|
11474
|
-
return [2 /*return*/, true];
|
|
11475
|
-
case 4:
|
|
11476
|
-
_a = _c.sent();
|
|
11477
|
-
return [2 /*return*/, false];
|
|
11478
|
-
case 5: return [2 /*return*/, false];
|
|
11479
|
-
case 6:
|
|
11480
|
-
_b = _c.sent();
|
|
11481
|
-
return [2 /*return*/, false];
|
|
11482
|
-
case 7: return [2 /*return*/];
|
|
11483
|
-
}
|
|
11484
|
-
});
|
|
11485
|
-
});
|
|
11486
|
-
};
|
|
11487
11464
|
SpeechRecognitionService.ctorParameters = function () { return [
|
|
11488
11465
|
{ type: LocaleService },
|
|
11489
11466
|
{ type: NgZone },
|