@seniorsistemas/angular-components 17.26.9 → 17.26.11

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.
Files changed (23) hide show
  1. package/bundles/seniorsistemas-angular-components.umd.js +118 -80
  2. package/bundles/seniorsistemas-angular-components.umd.js.map +1 -1
  3. package/bundles/seniorsistemas-angular-components.umd.min.js +1 -1
  4. package/bundles/seniorsistemas-angular-components.umd.min.js.map +1 -1
  5. package/components/speech-recognition/speech-recognition/speech-recognition.component.d.ts +5 -2
  6. package/components/speech-recognition/speech-recognition.service.d.ts +3 -2
  7. package/components/text-area/text-area/text-area.component.d.ts +1 -3
  8. package/esm2015/components/speech-recognition/speech-recognition/speech-recognition.component.js +35 -20
  9. package/esm2015/components/speech-recognition/speech-recognition.service.js +41 -22
  10. package/esm2015/components/speech-recognition/text-to-speech.service.js +1 -1
  11. package/esm2015/components/text-area/text-area/text-area.component.js +3 -14
  12. package/esm2015/components/tooltip/tooltip.component.js +1 -1
  13. package/esm5/components/speech-recognition/speech-recognition/speech-recognition.component.js +40 -19
  14. package/esm5/components/speech-recognition/speech-recognition.service.js +78 -46
  15. package/esm5/components/speech-recognition/text-to-speech.service.js +1 -1
  16. package/esm5/components/text-area/text-area/text-area.component.js +3 -18
  17. package/esm5/components/tooltip/tooltip.component.js +1 -1
  18. package/fesm2015/seniorsistemas-angular-components.js +76 -53
  19. package/fesm2015/seniorsistemas-angular-components.js.map +1 -1
  20. package/fesm5/seniorsistemas-angular-components.js +118 -80
  21. package/fesm5/seniorsistemas-angular-components.js.map +1 -1
  22. package/package.json +1 -1
  23. 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;position:fixed;transform:translateX(-50%);text-align:center;max-width:220px;word-wrap:break-word;z-index:99999}.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)}"]
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,9 +11359,8 @@ var SpeechRecognitionService = /** @class */ (function () {
11359
11359
  this.translateService = translateService;
11360
11360
  this.hasSupportSpeechRecognition = false;
11361
11361
  this.isListening = false;
11362
- this.hasMicrophoneAccess = false;
11362
+ this.microphoneStatus$ = new Subject();
11363
11363
  this.TIMEOUT_NO_MESSAGE = 3000;
11364
- this.verifyMicrophoneState();
11365
11364
  this.setRecognition();
11366
11365
  }
11367
11366
  SpeechRecognitionService.prototype.listen = function () {
@@ -11370,82 +11369,73 @@ var SpeechRecognitionService = /** @class */ (function () {
11370
11369
  if (this.isListening) {
11371
11370
  speechSubject.error('Already listening');
11372
11371
  }
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);
11372
+ this.hasMicrophoneAccess.then(function (hasAccess) {
11373
+ if (!hasAccess) {
11374
+ _this.toastService.show({ severity: 'error', text: _this.translateService.instant('platform.angular_components.no_microphone_permission') });
11375
+ speechSubject.error('Microphone access is disabled');
11376
+ return;
11377
+ }
11378
+ _this.microphoneStatus$.next('active');
11379
+ _this.isListening = true;
11380
+ _this.recognition.continuous = true;
11381
+ _this.recognition.interimResults = true;
11382
+ _this.recognition.maxAlternatives = 1;
11383
+ var silenceTimer;
11384
+ var restartSilenceTimer = function () {
11385
+ if (silenceTimer !== undefined) {
11386
+ clearTimeout(silenceTimer);
11387
11387
  }
11388
- silenceTimer_1 = setTimeout(function () {
11388
+ silenceTimer = setTimeout(function () {
11389
11389
  _this.recognition.stop();
11390
11390
  }, _this.TIMEOUT_NO_MESSAGE);
11391
11391
  };
11392
- var fullTranscript_1 = '';
11393
- var interimTranscript_1 = '';
11394
- this.recognition.onresult = function (event) {
11392
+ var fullTranscript = '';
11393
+ var interimTranscript = '';
11394
+ _this.recognition.onresult = function (event) {
11395
11395
  _this.ngZone.run(function () {
11396
- restartSilenceTimer_1();
11396
+ restartSilenceTimer();
11397
11397
  var interimTranscript = '';
11398
11398
  for (var i = event.resultIndex; i < event.results.length; ++i) {
11399
11399
  var transcript = event.results[i][0].transcript;
11400
11400
  if (event.results[i].isFinal) {
11401
- fullTranscript_1 += transcript + '\n';
11401
+ fullTranscript += transcript + '\n';
11402
11402
  }
11403
11403
  else {
11404
11404
  interimTranscript += transcript;
11405
11405
  }
11406
11406
  }
11407
11407
  interimTranscript = interimTranscript;
11408
- speechSubject.next({ text: fullTranscript_1 + interimTranscript, isFinal: false });
11408
+ speechSubject.next({ text: fullTranscript + interimTranscript, isFinal: false });
11409
11409
  });
11410
11410
  };
11411
- this.recognition.onerror = function () {
11411
+ _this.recognition.onerror = function () {
11412
11412
  _this.ngZone.run(function () {
11413
- if (silenceTimer_1 !== undefined) {
11414
- clearTimeout(silenceTimer_1);
11413
+ if (silenceTimer !== undefined) {
11414
+ clearTimeout(silenceTimer);
11415
11415
  }
11416
11416
  _this.isListening = false;
11417
11417
  speechSubject.error('Speech recognition error');
11418
+ _this.microphoneStatus$.next('inactive');
11418
11419
  });
11419
11420
  };
11420
- this.recognition.onend = function () {
11421
+ _this.recognition.onend = function () {
11421
11422
  _this.ngZone.run(function () {
11422
- if (silenceTimer_1 !== undefined) {
11423
- clearTimeout(silenceTimer_1);
11423
+ if (silenceTimer !== undefined) {
11424
+ clearTimeout(silenceTimer);
11424
11425
  }
11425
- speechSubject.next({ text: fullTranscript_1 + interimTranscript_1, isFinal: true });
11426
+ speechSubject.next({ text: fullTranscript + interimTranscript, isFinal: true });
11426
11427
  _this.isListening = false;
11427
11428
  speechSubject.complete();
11429
+ _this.microphoneStatus$.next('inactive');
11428
11430
  });
11429
11431
  };
11430
- this.recognition.start();
11431
- }
11432
+ _this.recognition.start();
11433
+ });
11432
11434
  return speechSubject;
11433
11435
  };
11434
11436
  SpeechRecognitionService.prototype.stop = function () {
11435
11437
  this.recognition.stop();
11436
11438
  };
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
- };
11449
11439
  SpeechRecognitionService.prototype.setRecognition = function () {
11450
11440
  var _this = this;
11451
11441
  var _a;
@@ -11461,6 +11451,48 @@ var SpeechRecognitionService = /** @class */ (function () {
11461
11451
  this.recognition.maxAlternatives = 1;
11462
11452
  this.localeService.getLocale().subscribe(function (locale) { return _this.recognition.lang = locale; });
11463
11453
  };
11454
+ Object.defineProperty(SpeechRecognitionService.prototype, "hasMicrophoneAccess", {
11455
+ get: function () {
11456
+ var _this = this;
11457
+ return new Promise(function (resolve) { return __awaiter(_this, void 0, void 0, function () {
11458
+ var permission;
11459
+ var _this = this;
11460
+ return __generator(this, function (_a) {
11461
+ switch (_a.label) {
11462
+ case 0: return [4 /*yield*/, navigator.permissions.query({ name: 'microphone' })];
11463
+ case 1:
11464
+ permission = _a.sent();
11465
+ if (permission.state === 'denied') {
11466
+ resolve(false);
11467
+ }
11468
+ else if (permission.state === 'granted') {
11469
+ resolve(true);
11470
+ }
11471
+ else if (permission.state === 'prompt') {
11472
+ try {
11473
+ navigator.mediaDevices.getUserMedia({ audio: true }).then(function (stream) {
11474
+ stream.getTracks().forEach(function (t) { return t.stop(); });
11475
+ }).catch(function () {
11476
+ resolve(false);
11477
+ });
11478
+ permission.onchange = function () {
11479
+ _this.ngZone.run(function () {
11480
+ resolve(permission.state === 'granted' ? true : false);
11481
+ });
11482
+ };
11483
+ }
11484
+ catch (error) {
11485
+ resolve(false);
11486
+ }
11487
+ }
11488
+ return [2 /*return*/];
11489
+ }
11490
+ });
11491
+ }); });
11492
+ },
11493
+ enumerable: true,
11494
+ configurable: true
11495
+ });
11464
11496
  SpeechRecognitionService.ctorParameters = function () { return [
11465
11497
  { type: LocaleService },
11466
11498
  { type: NgZone },
@@ -13478,21 +13510,6 @@ var TextAreaComponent = /** @class */ (function () {
13478
13510
  enumerable: true,
13479
13511
  configurable: true
13480
13512
  });
13481
- Object.defineProperty(TextAreaComponent.prototype, "placeholder", {
13482
- get: function () {
13483
- return this._placeholder;
13484
- },
13485
- set: function (value) {
13486
- if (value) {
13487
- this._placeholder = value;
13488
- }
13489
- else {
13490
- this._placeholder = '';
13491
- }
13492
- },
13493
- enumerable: true,
13494
- configurable: true
13495
- });
13496
13513
  Object.defineProperty(TextAreaComponent.prototype, "inputStyle", {
13497
13514
  get: function () {
13498
13515
  return this._inputStyle;
@@ -13557,7 +13574,7 @@ var TextAreaComponent = /** @class */ (function () {
13557
13574
  ], TextAreaComponent.prototype, "maxLength", void 0);
13558
13575
  __decorate([
13559
13576
  Input()
13560
- ], TextAreaComponent.prototype, "placeholder", null);
13577
+ ], TextAreaComponent.prototype, "placeholder", void 0);
13561
13578
  __decorate([
13562
13579
  Input()
13563
13580
  ], TextAreaComponent.prototype, "inputStyle", null);
@@ -13567,7 +13584,7 @@ var TextAreaComponent = /** @class */ (function () {
13567
13584
  TextAreaComponent = TextAreaComponent_1 = __decorate([
13568
13585
  Component({
13569
13586
  selector: 's-textarea',
13570
- template: "<textarea\n *ngIf=\"keyFilter\"\n #textArea\n class=\"textarea\"\n [pKeyFilter]=\"keyFilter\"\n [id]=\"inputId\"\n [rows]=\"rows\"\n [(ngModel)]=\"value\"\n [disabled]=\"disabled\"\n [ngStyle]=\"inputStyle\"\n [readOnly]=\"readOnly\"\n [placeholder]=\"placeholder\"\n [maxlength]=\"maxLength\"\n (ngModelChange)=\"setValue($event)\">\n</textarea>\n\n<textarea\n *ngIf=\"!keyFilter\"\n #textArea\n class=\"textarea\"\n [id]=\"inputId\"\n [rows]=\"rows\"\n [(ngModel)]=\"value\"\n [disabled]=\"disabled\"\n [ngStyle]=\"inputStyle\"\n [readOnly]=\"readOnly\"\n [placeholder]=\"placeholder\"\n [maxlength]=\"maxLength\"\n (ngModelChange)=\"setValue($event)\">\n</textarea>\n\n<s-speech-recognition\n *ngIf=\"speechRecognition && renderTextArea\"\n [textAreaElement]=\"textAreaElement.nativeElement\"\n [keepContext]=\"keepContext\"\n [speechRecognitionPlaceholder]=\"speechRecognitionPlaceholder\"\n (recognizedText)=\"handleRecognizedText($event)\">\n</s-speech-recognition>\n",
13587
+ template: "<textarea\n *ngIf=\"keyFilter\"\n #textArea\n class=\"textarea\"\n [pKeyFilter]=\"keyFilter\"\n [id]=\"inputId\"\n [rows]=\"rows\"\n [(ngModel)]=\"value\"\n [disabled]=\"disabled\"\n [ngStyle]=\"inputStyle\"\n [readOnly]=\"readOnly\"\n [placeholder]=\"placeholder ? placeholder : ''\"\n [maxlength]=\"maxLength\"\n (ngModelChange)=\"setValue($event)\">\n</textarea>\n\n<textarea\n *ngIf=\"!keyFilter\"\n #textArea\n class=\"textarea\"\n [id]=\"inputId\"\n [rows]=\"rows\"\n [(ngModel)]=\"value\"\n [disabled]=\"disabled\"\n [ngStyle]=\"inputStyle\"\n [readOnly]=\"readOnly\"\n [placeholder]=\"placeholder ? placeholder : ''\"\n [maxlength]=\"maxLength\"\n (ngModelChange)=\"setValue($event)\">\n</textarea>\n\n<s-speech-recognition\n *ngIf=\"speechRecognition && renderTextArea\"\n [textAreaElement]=\"textAreaElement.nativeElement\"\n [keepContext]=\"keepContext\"\n [speechRecognitionPlaceholder]=\"speechRecognitionPlaceholder\"\n (recognizedText)=\"handleRecognizedText($event)\">\n</s-speech-recognition>\n",
13571
13588
  providers: [
13572
13589
  {
13573
13590
  provide: NG_VALUE_ACCESSOR,
@@ -13677,7 +13694,7 @@ var SpeechRecognitionComponent = /** @class */ (function () {
13677
13694
  this.speechRecognitionPlaceholder = '';
13678
13695
  this._recognizedText = '';
13679
13696
  this.originalTextAreaElementText = '';
13680
- this.isDoneSpeaking = false;
13697
+ this.isDoneTextToSpeech = false;
13681
13698
  this.onDestroy$ = new Subject();
13682
13699
  this.VOICE_SPEEDS = [0.5, 1, 1.5, 2];
13683
13700
  this.keydownEventListener = function (event) {
@@ -13686,7 +13703,7 @@ var SpeechRecognitionComponent = /** @class */ (function () {
13686
13703
  }
13687
13704
  };
13688
13705
  this.disabled = false;
13689
- this.isSpeaking = false;
13706
+ this.isListeningUserVoice = false;
13690
13707
  this.voiceSpeed = 1;
13691
13708
  this.isDisabledMicrophone = false;
13692
13709
  this.canRenderMicrophone = true;
@@ -13698,7 +13715,9 @@ var SpeechRecognitionComponent = /** @class */ (function () {
13698
13715
  this.isPlayingTextToSpeech = false;
13699
13716
  this.recognizedText = new EventEmitter();
13700
13717
  }
13718
+ SpeechRecognitionComponent_1 = SpeechRecognitionComponent;
13701
13719
  SpeechRecognitionComponent.prototype.ngOnInit = function () {
13720
+ var _this = this;
13702
13721
  if (!this.hasSpeechRecognitionBrowserApi) {
13703
13722
  return;
13704
13723
  }
@@ -13707,6 +13726,11 @@ var SpeechRecognitionComponent = /** @class */ (function () {
13707
13726
  }
13708
13727
  this.textAreaElement.placeholder = this.speechRecognitionPlaceholder ? this.speechRecognitionPlaceholder : this.translateService.instant("platform.angular_components.text_area_speech_recognition_placeholder");
13709
13728
  this.textAreaElement.addEventListener('keydown', this.keydownEventListener);
13729
+ this.speechRecognitionService.microphoneStatus$.pipe(takeUntil(this.onDestroy$)).subscribe(function (status) {
13730
+ if (status === 'active') {
13731
+ _this.onCloseToolbar();
13732
+ }
13733
+ });
13710
13734
  };
13711
13735
  SpeechRecognitionComponent.prototype.onListen = function () {
13712
13736
  var _this = this;
@@ -13718,7 +13742,7 @@ var SpeechRecognitionComponent = /** @class */ (function () {
13718
13742
  this.canRenderListeningText = true;
13719
13743
  this.originalTextAreaElementText = this.textAreaElement.value;
13720
13744
  this.textAreaElement.value = '';
13721
- this.isSpeaking = true;
13745
+ this.isListeningUserVoice = true;
13722
13746
  this.speechRecognitionService.listen()
13723
13747
  .pipe(takeUntil(this.onDestroy$))
13724
13748
  .subscribe(function (_a) {
@@ -13730,10 +13754,10 @@ var SpeechRecognitionComponent = /** @class */ (function () {
13730
13754
  _this.canRenderAprove = true;
13731
13755
  _this.canRenderDiscard = true;
13732
13756
  _this.canRenderListeningText = false;
13733
- _this.isSpeaking = false;
13757
+ _this.isListeningUserVoice = false;
13734
13758
  }
13735
13759
  }, function () {
13736
- _this.isSpeaking = false;
13760
+ _this.isListeningUserVoice = false;
13737
13761
  _this.canRenderMicrophone = true;
13738
13762
  _this.isDisabledMicrophone = false;
13739
13763
  _this.canRenderListeningText = false;
@@ -13752,15 +13776,15 @@ var SpeechRecognitionComponent = /** @class */ (function () {
13752
13776
  }
13753
13777
  this.canRenderTextToSpeechToolbar = true;
13754
13778
  this.canRenderTextToSpeech = false;
13755
- this.isPlayingTextToSpeech = true;
13779
+ SpeechRecognitionComponent_1.TOOLBAR_ACTIVE = true;
13756
13780
  this.speak();
13757
13781
  };
13758
13782
  SpeechRecognitionComponent.prototype.onCloseToolbar = function () {
13759
13783
  this.canRenderTextToSpeechToolbar = false;
13760
13784
  this.canRenderTextToSpeech = true;
13761
- this.isPlayingTextToSpeech = false;
13762
- this.textToSpeechService.cancel();
13785
+ this.stopTextToSpeech();
13763
13786
  this.voiceSpeed = 1;
13787
+ SpeechRecognitionComponent_1.TOOLBAR_ACTIVE = false;
13764
13788
  };
13765
13789
  SpeechRecognitionComponent.prototype.onDiscard = function () {
13766
13790
  this.canRenderAprove = false;
@@ -13771,7 +13795,8 @@ var SpeechRecognitionComponent = /** @class */ (function () {
13771
13795
  this._recognizedText = '';
13772
13796
  this.setTextAreaValue(this.originalTextAreaElementText);
13773
13797
  this.disabled = false;
13774
- this.textToSpeechService.cancel();
13798
+ this.stopTextToSpeech();
13799
+ SpeechRecognitionComponent_1.TOOLBAR_ACTIVE = false;
13775
13800
  };
13776
13801
  SpeechRecognitionComponent.prototype.onAprove = function () {
13777
13802
  this.canRenderAprove = false;
@@ -13801,7 +13826,7 @@ var SpeechRecognitionComponent = /** @class */ (function () {
13801
13826
  this.textToSpeechService.pause();
13802
13827
  }
13803
13828
  else {
13804
- if (this.isDoneSpeaking) {
13829
+ if (this.isDoneTextToSpeech) {
13805
13830
  this.speak();
13806
13831
  }
13807
13832
  else {
@@ -13811,7 +13836,6 @@ var SpeechRecognitionComponent = /** @class */ (function () {
13811
13836
  this.isPlayingTextToSpeech = !this.isPlayingTextToSpeech;
13812
13837
  };
13813
13838
  SpeechRecognitionComponent.prototype.restartTextToSpeech = function () {
13814
- this.isPlayingTextToSpeech = true;
13815
13839
  this.textToSpeechService.cancel();
13816
13840
  this.speak();
13817
13841
  };
@@ -13842,7 +13866,7 @@ var SpeechRecognitionComponent = /** @class */ (function () {
13842
13866
  Object.defineProperty(SpeechRecognitionComponent.prototype, "isDisabledTextToSpeech", {
13843
13867
  get: function () {
13844
13868
  var hasTextToSpeechVoice = this.textToSpeechService.hasVoice;
13845
- return !this._recognizedText || !hasTextToSpeechVoice || this.isListening;
13869
+ return !this.textToSpeech || !hasTextToSpeechVoice || this.isListening || SpeechRecognitionComponent_1.TOOLBAR_ACTIVE;
13846
13870
  },
13847
13871
  enumerable: true,
13848
13872
  configurable: true
@@ -13850,14 +13874,28 @@ var SpeechRecognitionComponent = /** @class */ (function () {
13850
13874
  SpeechRecognitionComponent.prototype.setTextAreaValue = function (value) {
13851
13875
  this.textAreaElement.value = value;
13852
13876
  };
13877
+ SpeechRecognitionComponent.prototype.stopTextToSpeech = function () {
13878
+ this.isPlayingTextToSpeech = false;
13879
+ this.textToSpeechService.cancel();
13880
+ };
13853
13881
  SpeechRecognitionComponent.prototype.speak = function () {
13854
13882
  var _this = this;
13855
- this.isDoneSpeaking = false;
13856
- this.textToSpeechService.speak(this._recognizedText, this.voiceSpeed).then(function () {
13883
+ this.isDoneTextToSpeech = false;
13884
+ this.isPlayingTextToSpeech = true;
13885
+ this.textToSpeechService.speak(this.textToSpeech, this.voiceSpeed).then(function () {
13857
13886
  _this.isPlayingTextToSpeech = false;
13858
- _this.isDoneSpeaking = true;
13887
+ _this.isDoneTextToSpeech = true;
13859
13888
  });
13860
13889
  };
13890
+ Object.defineProperty(SpeechRecognitionComponent.prototype, "textToSpeech", {
13891
+ get: function () {
13892
+ return this.textAreaElement.value;
13893
+ },
13894
+ enumerable: true,
13895
+ configurable: true
13896
+ });
13897
+ var SpeechRecognitionComponent_1;
13898
+ SpeechRecognitionComponent.TOOLBAR_ACTIVE = false;
13861
13899
  SpeechRecognitionComponent.ctorParameters = function () { return [
13862
13900
  { type: SpeechRecognitionService },
13863
13901
  { type: TextToSpeechService },
@@ -13875,11 +13913,11 @@ var SpeechRecognitionComponent = /** @class */ (function () {
13875
13913
  __decorate([
13876
13914
  Output()
13877
13915
  ], SpeechRecognitionComponent.prototype, "recognizedText", void 0);
13878
- SpeechRecognitionComponent = __decorate([
13916
+ SpeechRecognitionComponent = SpeechRecognitionComponent_1 = __decorate([
13879
13917
  Component({
13880
13918
  selector: 's-speech-recognition',
13881
- template: "<section class=\"speech-recognition\" *ngIf=\"hasSpeechRecognitionBrowserApi\">\n <div class=\"speech-recognition-text\">\n <ng-container *ngIf=\"canRenderMicrophone\">\n {{ 'platform.angular_components.text_area_before_speech' | translate }}\n </ng-container>\n\n <ng-container *ngIf=\"isSpeaking\">\n {{ 'platform.angular_components.text_area_while_speech' | translate }}\n </ng-container>\n\n <ng-container *ngIf=\"canRenderAprove && canRenderDiscard\">\n {{ 'platform.angular_components.text_area_end_speech' | translate }}\n </ng-container>\n </div>\n <div class=\"speech-recognition-buttons\">\n <span\n *ngIf=\"canRenderListeningText\"\n (click)=\"stopListening()\"\n class=\"speech-recognition-item speech-recognition-item-regular\">\n <i class=\"far fa-ellipsis-h\"></i>\n </span>\n\n <span\n *ngIf=\"canRenderMicrophone\"\n (click)=\"onListen()\"\n class=\"speech-recognition-item speech-recognition-item-microphone\"\n [class.speech-recognition-item-disabled]=\"isDisabledMicrophone || isListening || disabled\">\n <i class=\"fas fa-microphone\"></i>\n </span>\n\n <span\n *ngIf=\"canRenderAprove\"\n (click)=\"onAprove()\"\n class=\"speech-recognition-item speech-recognition-item-aprove\">\n <i class=\"fas fa-check\"></i>\n </span>\n\n <span *ngIf=\"canRenderDiscard\"\n (click)=\"onDiscard()\"\n class=\"speech-recognition-item speech-recognition-item-discard\">\n <i class=\"fas fa-times\"></i>\n </span>\n\n <span\n *ngIf=\"canRenderTextToSpeech\"\n (click)=\"onOpenToolbar()\"\n class=\"speech-recognition-item speech-recognition-item-regular\"\n [class.speech-recognition-item-disabled]=\"isDisabledTextToSpeech\">\n <i class=\"fas fa-volume-down\"></i>\n </span>\n\n <span\n *ngIf=\"canRenderTextToSpeechToolbar\"\n class=\"speech-recognition-item-toolbar\">\n <i class=\"fas\" [class.fa-pause]=\"isPlayingTextToSpeech\" [class.fa-play]=\"!isPlayingTextToSpeech\"\n (click)=\"toggleTextToSpeech()\"></i>\n <i class=\"fas fa-backward\" (click)=\"restartTextToSpeech()\"></i>\n <span (click)=\"updateVoiceSpeed()\">\n {{ voiceSpeed }}x\n </span>\n <i class=\"fas fa-times\" (click)=\"onCloseToolbar()\"></i>\n </span>\n </div>\n</section>\n",
13882
- styles: [".speech-recognition{display:-ms-flexbox;display:flex;gap:10px;-ms-flex-pack:justify;justify-content:space-between;width:100%}.speech-recognition-buttons{display:-ms-flexbox;display:flex;gap:10px;position:relative;bottom:15px;margin-right:16px}.speech-recognition-item{display:-ms-inline-flexbox;display:inline-flex;height:25px;padding:4px 12px;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center;gap:8px;border-radius:15px;cursor:pointer;transition:background .1s ease-in}.speech-recognition-item i,.speech-recognition-item span{color:#fff}.speech-recognition-item-disabled{cursor:default!important}.speech-recognition-item-disabled *{opacity:.5}.speech-recognition-item-microphone{background:#428bca}.speech-recognition-item-microphone:not(.speech-recognition-item-disabled):hover{background:#063951}.speech-recognition-item-regular{background:#7892a1}.speech-recognition-item-regular:not(.speech-recognition-item-disabled):hover{background:#697882}.speech-recognition-item-aprove{background:#0c9348}.speech-recognition-item-aprove:not(.speech-recognition-item-disabled):hover{background:#063951}.speech-recognition-item-discard{background:#c13018}.speech-recognition-item-discard:not(.speech-recognition-item-disabled):hover{background:#063951}.speech-recognition-item-toolbar{background:#7892a1;display:-ms-flexbox;display:flex;border-radius:15px;-ms-flex-align:center;align-items:center;color:#fff}.speech-recognition-item-toolbar i,.speech-recognition-item-toolbar span{cursor:pointer}.speech-recognition-item-toolbar i:not(:first-child),.speech-recognition-item-toolbar i:not(:last-child){padding:6px}.speech-recognition-item-toolbar i:first-child{padding-left:10px}.speech-recognition-item-toolbar i:last-child{padding-right:10px}.speech-recognition-item-toolbar span{height:25px}.speech-recognition-text{color:#212533;font-size:12px;font-style:normal;font-weight:400;word-break:break-word}"]
13919
+ template: "<section class=\"speech-recognition\" *ngIf=\"hasSpeechRecognitionBrowserApi\">\n <div class=\"speech-recognition-text\">\n <ng-container *ngIf=\"canRenderMicrophone\">\n {{ 'platform.angular_components.text_area_before_speech' | translate }}\n </ng-container>\n\n <ng-container *ngIf=\"isListeningUserVoice\">\n {{ 'platform.angular_components.text_area_while_speech' | translate }}\n </ng-container>\n\n <ng-container *ngIf=\"canRenderAprove && canRenderDiscard\">\n {{ 'platform.angular_components.text_area_end_speech' | translate }}\n </ng-container>\n </div>\n <div class=\"speech-recognition-buttons\">\n <span\n *ngIf=\"canRenderListeningText\"\n (click)=\"stopListening()\"\n class=\"speech-recognition-item speech-recognition-item-regular\">\n <i class=\"far fa-ellipsis-h\"></i>\n </span>\n\n <span\n *ngIf=\"canRenderMicrophone\"\n (click)=\"onListen()\"\n class=\"speech-recognition-item speech-recognition-item-microphone\"\n [class.speech-recognition-item-disabled]=\"isDisabledMicrophone || isListening || disabled\">\n <i class=\"fas fa-microphone\"></i>\n </span>\n\n <span\n *ngIf=\"canRenderAprove\"\n (click)=\"onAprove()\"\n class=\"speech-recognition-item speech-recognition-item-aprove\">\n <i class=\"fas fa-check\"></i>\n </span>\n\n <span *ngIf=\"canRenderDiscard\"\n (click)=\"onDiscard()\"\n class=\"speech-recognition-item speech-recognition-item-discard\">\n <i class=\"fas fa-times\"></i>\n </span>\n\n <span\n *ngIf=\"canRenderTextToSpeech\"\n (click)=\"onOpenToolbar()\"\n class=\"speech-recognition-item speech-recognition-item-regular\"\n [class.speech-recognition-item-disabled]=\"isDisabledTextToSpeech\">\n <i class=\"fas fa-volume-down\"></i>\n </span>\n\n <span\n *ngIf=\"canRenderTextToSpeechToolbar\"\n class=\"speech-recognition-item-toolbar\">\n <i class=\"fas\" [class.fa-pause]=\"isPlayingTextToSpeech\" [class.fa-play]=\"!isPlayingTextToSpeech\"\n (click)=\"toggleTextToSpeech()\"></i>\n <i class=\"fas fa-backward\" (click)=\"restartTextToSpeech()\"></i>\n <span (click)=\"updateVoiceSpeed()\">\n {{ voiceSpeed }}x\n </span>\n <i class=\"fas fa-times\" (click)=\"onCloseToolbar()\"></i>\n </span>\n </div>\n</section>\n",
13920
+ styles: [".speech-recognition{display:-ms-flexbox;display:flex;gap:10px;-ms-flex-pack:justify;justify-content:space-between;width:100%}.speech-recognition-buttons{display:-ms-flexbox;display:flex;gap:10px;position:relative;bottom:15px;margin-right:16px}.speech-recognition-item{display:-ms-inline-flexbox;display:inline-flex;height:25px;padding:4px 12px;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center;gap:8px;border-radius:15px;cursor:pointer;transition:background .1s ease-in}.speech-recognition-item i,.speech-recognition-item span{color:#fff}.speech-recognition-item-disabled{cursor:default!important}.speech-recognition-item-disabled *{opacity:.5}.speech-recognition-item-microphone{background:#428bca}.speech-recognition-item-microphone:not(.speech-recognition-item-disabled):hover{background:#063951}.speech-recognition-item-regular{background:#7892a1}.speech-recognition-item-regular:not(.speech-recognition-item-disabled):hover{background:#697882}.speech-recognition-item-aprove{background:#0c9348}.speech-recognition-item-aprove:not(.speech-recognition-item-disabled):hover{background:#063951}.speech-recognition-item-discard{background:#c13018}.speech-recognition-item-discard:not(.speech-recognition-item-disabled):hover{background:#063951}.speech-recognition-item-toolbar{background:#7892a1;display:-ms-flexbox;display:flex;border-radius:15px;-ms-flex-align:center;align-items:center;color:#fff;height:25px}.speech-recognition-item-toolbar i,.speech-recognition-item-toolbar span{cursor:pointer}.speech-recognition-item-toolbar i:not(:first-child),.speech-recognition-item-toolbar i:not(:last-child){padding:6px}.speech-recognition-item-toolbar i:first-child{padding-left:10px}.speech-recognition-item-toolbar i:last-child{padding-right:10px}.speech-recognition-text{color:#212533;font-size:12px;font-style:normal;font-weight:400;word-break:break-word}"]
13883
13921
  })
13884
13922
  ], SpeechRecognitionComponent);
13885
13923
  return SpeechRecognitionComponent;