@seniorsistemas/angular-components 17.26.9-bugfix-sds-307-c6084396 → 17.26.9-bugfix-sds-309-85a29221

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 +121 -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 +38 -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 +43 -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 +79 -53
  19. package/fesm2015/seniorsistemas-angular-components.js.map +1 -1
  20. package/fesm5/seniorsistemas-angular-components.js +121 -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
@@ -13,7 +13,7 @@ var TooltipComponent = /** @class */ (function () {
13
13
  TooltipComponent = __decorate([
14
14
  Component({
15
15
  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>",
16
- 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)}"]
16
+ 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)}"]
17
17
  })
18
18
  ], TooltipComponent);
19
19
  return TooltipComponent;
@@ -376,7 +376,7 @@ let TooltipComponent = class TooltipComponent {
376
376
  TooltipComponent = __decorate([
377
377
  Component({
378
378
  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>",
379
- 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)}"]
379
+ 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)}"]
380
380
  })
381
381
  ], TooltipComponent);
382
382
 
@@ -10624,9 +10624,8 @@ let SpeechRecognitionService = class SpeechRecognitionService {
10624
10624
  this.translateService = translateService;
10625
10625
  this.hasSupportSpeechRecognition = false;
10626
10626
  this.isListening = false;
10627
- this.hasMicrophoneAccess = false;
10627
+ this.microphoneStatus$ = new Subject();
10628
10628
  this.TIMEOUT_NO_MESSAGE = 3000;
10629
- this.verifyMicrophoneState();
10630
10629
  this.setRecognition();
10631
10630
  }
10632
10631
  listen() {
@@ -10634,12 +10633,13 @@ let SpeechRecognitionService = class SpeechRecognitionService {
10634
10633
  if (this.isListening) {
10635
10634
  speechSubject.error('Already listening');
10636
10635
  }
10637
- else if (!this.hasMicrophoneAccess) {
10638
- this.isListening = false;
10639
- this.toastService.show({ severity: 'error', text: this.translateService.instant('platform.angular_components.no_microphone_permission') });
10640
- speechSubject.error('Microphone access is disabled');
10641
- }
10642
- else {
10636
+ this.hasMicrophoneAccess.then((hasAccess) => {
10637
+ if (!hasAccess) {
10638
+ this.toastService.show({ severity: 'error', text: this.translateService.instant('platform.angular_components.no_microphone_permission') });
10639
+ speechSubject.error('Microphone access is disabled');
10640
+ return;
10641
+ }
10642
+ this.microphoneStatus$.next('active');
10643
10643
  this.isListening = true;
10644
10644
  this.recognition.continuous = true;
10645
10645
  this.recognition.interimResults = true;
@@ -10679,6 +10679,7 @@ let SpeechRecognitionService = class SpeechRecognitionService {
10679
10679
  }
10680
10680
  this.isListening = false;
10681
10681
  speechSubject.error('Speech recognition error');
10682
+ this.microphoneStatus$.next('inactive');
10682
10683
  });
10683
10684
  };
10684
10685
  this.recognition.onend = () => {
@@ -10689,26 +10690,16 @@ let SpeechRecognitionService = class SpeechRecognitionService {
10689
10690
  speechSubject.next({ text: fullTranscript + interimTranscript, isFinal: true });
10690
10691
  this.isListening = false;
10691
10692
  speechSubject.complete();
10693
+ this.microphoneStatus$.next('inactive');
10692
10694
  });
10693
10695
  };
10694
10696
  this.recognition.start();
10695
- }
10697
+ });
10696
10698
  return speechSubject;
10697
10699
  }
10698
10700
  stop() {
10699
10701
  this.recognition.stop();
10700
10702
  }
10701
- verifyMicrophoneState() {
10702
- navigator.permissions.query({ name: 'microphone' }).then((result) => {
10703
- const microphoneResultState = result.state;
10704
- this.hasMicrophoneAccess = microphoneResultState === 'granted';
10705
- result.onchange = () => {
10706
- this.ngZone.run(() => {
10707
- this.hasMicrophoneAccess = result.state === 'granted';
10708
- });
10709
- };
10710
- });
10711
- }
10712
10703
  setRecognition() {
10713
10704
  var _a;
10714
10705
  const SpeechRecognitionConstructor = window.SpeechRecognition || window.webkitSpeechRecognition;
@@ -10723,6 +10714,34 @@ let SpeechRecognitionService = class SpeechRecognitionService {
10723
10714
  this.recognition.maxAlternatives = 1;
10724
10715
  this.localeService.getLocale().subscribe(locale => this.recognition.lang = locale);
10725
10716
  }
10717
+ get hasMicrophoneAccess() {
10718
+ return new Promise((resolve) => __awaiter(this, void 0, void 0, function* () {
10719
+ const permission = yield navigator.permissions.query({ name: 'microphone' });
10720
+ if (permission.state === 'denied') {
10721
+ resolve(false);
10722
+ }
10723
+ else if (permission.state === 'granted') {
10724
+ resolve(true);
10725
+ }
10726
+ else if (permission.state === 'prompt') {
10727
+ try {
10728
+ navigator.mediaDevices.getUserMedia({ audio: true }).then((stream) => {
10729
+ stream.getTracks().forEach(t => t.stop());
10730
+ }).catch(() => {
10731
+ resolve(false);
10732
+ });
10733
+ permission.onchange = () => {
10734
+ this.ngZone.run(() => {
10735
+ resolve(permission.state === 'granted' ? true : false);
10736
+ });
10737
+ };
10738
+ }
10739
+ catch (error) {
10740
+ resolve(false);
10741
+ }
10742
+ }
10743
+ }));
10744
+ }
10726
10745
  };
10727
10746
  SpeechRecognitionService.ctorParameters = () => [
10728
10747
  { type: LocaleService },
@@ -12645,17 +12664,6 @@ let TextAreaComponent = TextAreaComponent_1 = class TextAreaComponent {
12645
12664
  this.cdr.detectChanges();
12646
12665
  });
12647
12666
  }
12648
- get placeholder() {
12649
- return this._placeholder;
12650
- }
12651
- set placeholder(value) {
12652
- if (value) {
12653
- this._placeholder = value;
12654
- }
12655
- else {
12656
- this._placeholder = '';
12657
- }
12658
- }
12659
12667
  get inputStyle() {
12660
12668
  return this._inputStyle;
12661
12669
  }
@@ -12716,7 +12724,7 @@ __decorate([
12716
12724
  ], TextAreaComponent.prototype, "maxLength", void 0);
12717
12725
  __decorate([
12718
12726
  Input()
12719
- ], TextAreaComponent.prototype, "placeholder", null);
12727
+ ], TextAreaComponent.prototype, "placeholder", void 0);
12720
12728
  __decorate([
12721
12729
  Input()
12722
12730
  ], TextAreaComponent.prototype, "inputStyle", null);
@@ -12726,7 +12734,7 @@ __decorate([
12726
12734
  TextAreaComponent = TextAreaComponent_1 = __decorate([
12727
12735
  Component({
12728
12736
  selector: 's-textarea',
12729
- 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",
12737
+ 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",
12730
12738
  providers: [
12731
12739
  {
12732
12740
  provide: NG_VALUE_ACCESSOR,
@@ -12816,7 +12824,8 @@ TextToSpeechService = __decorate([
12816
12824
  })
12817
12825
  ], TextToSpeechService);
12818
12826
 
12819
- let SpeechRecognitionComponent = class SpeechRecognitionComponent {
12827
+ var SpeechRecognitionComponent_1;
12828
+ let SpeechRecognitionComponent = SpeechRecognitionComponent_1 = class SpeechRecognitionComponent {
12820
12829
  constructor(speechRecognitionService, textToSpeechService, translateService) {
12821
12830
  this.speechRecognitionService = speechRecognitionService;
12822
12831
  this.textToSpeechService = textToSpeechService;
@@ -12825,7 +12834,7 @@ let SpeechRecognitionComponent = class SpeechRecognitionComponent {
12825
12834
  this.speechRecognitionPlaceholder = '';
12826
12835
  this._recognizedText = '';
12827
12836
  this.originalTextAreaElementText = '';
12828
- this.isDoneSpeaking = false;
12837
+ this.isDoneTextToSpeech = false;
12829
12838
  this.onDestroy$ = new Subject();
12830
12839
  this.VOICE_SPEEDS = [0.5, 1, 1.5, 2];
12831
12840
  this.keydownEventListener = (event) => {
@@ -12834,7 +12843,7 @@ let SpeechRecognitionComponent = class SpeechRecognitionComponent {
12834
12843
  }
12835
12844
  };
12836
12845
  this.disabled = false;
12837
- this.isSpeaking = false;
12846
+ this.isListeningUserVoice = false;
12838
12847
  this.voiceSpeed = 1;
12839
12848
  this.isDisabledMicrophone = false;
12840
12849
  this.canRenderMicrophone = true;
@@ -12855,17 +12864,25 @@ let SpeechRecognitionComponent = class SpeechRecognitionComponent {
12855
12864
  }
12856
12865
  this.textAreaElement.placeholder = this.speechRecognitionPlaceholder ? this.speechRecognitionPlaceholder : this.translateService.instant("platform.angular_components.text_area_speech_recognition_placeholder");
12857
12866
  this.textAreaElement.addEventListener('keydown', this.keydownEventListener);
12867
+ this.speechRecognitionService.microphoneStatus$.pipe(takeUntil(this.onDestroy$)).subscribe((status) => {
12868
+ if (status === 'active') {
12869
+ this.onCloseToolbar();
12870
+ }
12871
+ });
12858
12872
  }
12859
12873
  onListen() {
12860
12874
  if (this.isDisabledMicrophone || this.isListening) {
12861
12875
  return;
12862
12876
  }
12877
+ // if (this.isPlayingTextToSpeech) {
12878
+ // this.onCloseToolbar();
12879
+ // }
12863
12880
  this.disabled = true;
12864
12881
  this.canRenderMicrophone = false;
12865
12882
  this.canRenderListeningText = true;
12866
12883
  this.originalTextAreaElementText = this.textAreaElement.value;
12867
12884
  this.textAreaElement.value = '';
12868
- this.isSpeaking = true;
12885
+ this.isListeningUserVoice = true;
12869
12886
  this.speechRecognitionService.listen()
12870
12887
  .pipe(takeUntil(this.onDestroy$))
12871
12888
  .subscribe(({ text, isFinal }) => {
@@ -12876,10 +12893,10 @@ let SpeechRecognitionComponent = class SpeechRecognitionComponent {
12876
12893
  this.canRenderAprove = true;
12877
12894
  this.canRenderDiscard = true;
12878
12895
  this.canRenderListeningText = false;
12879
- this.isSpeaking = false;
12896
+ this.isListeningUserVoice = false;
12880
12897
  }
12881
12898
  }, () => {
12882
- this.isSpeaking = false;
12899
+ this.isListeningUserVoice = false;
12883
12900
  this.canRenderMicrophone = true;
12884
12901
  this.isDisabledMicrophone = false;
12885
12902
  this.canRenderListeningText = false;
@@ -12897,15 +12914,15 @@ let SpeechRecognitionComponent = class SpeechRecognitionComponent {
12897
12914
  }
12898
12915
  this.canRenderTextToSpeechToolbar = true;
12899
12916
  this.canRenderTextToSpeech = false;
12900
- this.isPlayingTextToSpeech = true;
12917
+ SpeechRecognitionComponent_1.TOOLBAR_ACTIVE = true;
12901
12918
  this.speak();
12902
12919
  }
12903
12920
  onCloseToolbar() {
12904
12921
  this.canRenderTextToSpeechToolbar = false;
12905
12922
  this.canRenderTextToSpeech = true;
12906
- this.isPlayingTextToSpeech = false;
12907
- this.textToSpeechService.cancel();
12923
+ this.stopTextToSpeech();
12908
12924
  this.voiceSpeed = 1;
12925
+ SpeechRecognitionComponent_1.TOOLBAR_ACTIVE = false;
12909
12926
  }
12910
12927
  onDiscard() {
12911
12928
  this.canRenderAprove = false;
@@ -12916,7 +12933,8 @@ let SpeechRecognitionComponent = class SpeechRecognitionComponent {
12916
12933
  this._recognizedText = '';
12917
12934
  this.setTextAreaValue(this.originalTextAreaElementText);
12918
12935
  this.disabled = false;
12919
- this.textToSpeechService.cancel();
12936
+ this.stopTextToSpeech();
12937
+ SpeechRecognitionComponent_1.TOOLBAR_ACTIVE = false;
12920
12938
  }
12921
12939
  onAprove() {
12922
12940
  this.canRenderAprove = false;
@@ -12946,7 +12964,7 @@ let SpeechRecognitionComponent = class SpeechRecognitionComponent {
12946
12964
  this.textToSpeechService.pause();
12947
12965
  }
12948
12966
  else {
12949
- if (this.isDoneSpeaking) {
12967
+ if (this.isDoneTextToSpeech) {
12950
12968
  this.speak();
12951
12969
  }
12952
12970
  else {
@@ -12956,7 +12974,6 @@ let SpeechRecognitionComponent = class SpeechRecognitionComponent {
12956
12974
  this.isPlayingTextToSpeech = !this.isPlayingTextToSpeech;
12957
12975
  }
12958
12976
  restartTextToSpeech() {
12959
- this.isPlayingTextToSpeech = true;
12960
12977
  this.textToSpeechService.cancel();
12961
12978
  this.speak();
12962
12979
  }
@@ -12978,19 +12995,28 @@ let SpeechRecognitionComponent = class SpeechRecognitionComponent {
12978
12995
  }
12979
12996
  get isDisabledTextToSpeech() {
12980
12997
  const hasTextToSpeechVoice = this.textToSpeechService.hasVoice;
12981
- return !this._recognizedText || !hasTextToSpeechVoice || this.isListening;
12998
+ return !this.textToSpeech || !hasTextToSpeechVoice || this.isListening || SpeechRecognitionComponent_1.TOOLBAR_ACTIVE;
12982
12999
  }
12983
13000
  setTextAreaValue(value) {
12984
13001
  this.textAreaElement.value = value;
12985
13002
  }
13003
+ stopTextToSpeech() {
13004
+ this.isPlayingTextToSpeech = false;
13005
+ this.textToSpeechService.cancel();
13006
+ }
12986
13007
  speak() {
12987
- this.isDoneSpeaking = false;
12988
- this.textToSpeechService.speak(this._recognizedText, this.voiceSpeed).then(() => {
13008
+ this.isDoneTextToSpeech = false;
13009
+ this.isPlayingTextToSpeech = true;
13010
+ this.textToSpeechService.speak(this.textToSpeech, this.voiceSpeed).then(() => {
12989
13011
  this.isPlayingTextToSpeech = false;
12990
- this.isDoneSpeaking = true;
13012
+ this.isDoneTextToSpeech = true;
12991
13013
  });
12992
13014
  }
13015
+ get textToSpeech() {
13016
+ return this.textAreaElement.value;
13017
+ }
12993
13018
  };
13019
+ SpeechRecognitionComponent.TOOLBAR_ACTIVE = false;
12994
13020
  SpeechRecognitionComponent.ctorParameters = () => [
12995
13021
  { type: SpeechRecognitionService },
12996
13022
  { type: TextToSpeechService },
@@ -13008,11 +13034,11 @@ __decorate([
13008
13034
  __decorate([
13009
13035
  Output()
13010
13036
  ], SpeechRecognitionComponent.prototype, "recognizedText", void 0);
13011
- SpeechRecognitionComponent = __decorate([
13037
+ SpeechRecognitionComponent = SpeechRecognitionComponent_1 = __decorate([
13012
13038
  Component({
13013
13039
  selector: 's-speech-recognition',
13014
- 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",
13015
- 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}"]
13040
+ 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",
13041
+ 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}"]
13016
13042
  })
13017
13043
  ], SpeechRecognitionComponent);
13018
13044