@seniorsistemas/angular-components 17.26.9-bugfix-sds-309-1338ba18 → 17.26.9-bugfix-sds-309-f709bce3

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 (21) hide show
  1. package/bundles/seniorsistemas-angular-components.umd.js +47 -34
  2. package/bundles/seniorsistemas-angular-components.umd.js.map +1 -1
  3. package/bundles/seniorsistemas-angular-components.umd.min.js +2 -2
  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 +2 -0
  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 +37 -19
  9. package/esm2015/components/speech-recognition/speech-recognition.service.js +5 -1
  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/esm5/components/speech-recognition/speech-recognition/speech-recognition.component.js +42 -18
  13. package/esm5/components/speech-recognition/speech-recognition.service.js +5 -1
  14. package/esm5/components/speech-recognition/text-to-speech.service.js +1 -1
  15. package/esm5/components/text-area/text-area/text-area.component.js +3 -18
  16. package/fesm2015/seniorsistemas-angular-components.js +42 -31
  17. package/fesm2015/seniorsistemas-angular-components.js.map +1 -1
  18. package/fesm5/seniorsistemas-angular-components.js +47 -34
  19. package/fesm5/seniorsistemas-angular-components.js.map +1 -1
  20. package/package.json +1 -1
  21. package/seniorsistemas-angular-components.metadata.json +1 -1
@@ -10624,6 +10624,7 @@ let SpeechRecognitionService = class SpeechRecognitionService {
10624
10624
  this.translateService = translateService;
10625
10625
  this.hasSupportSpeechRecognition = false;
10626
10626
  this.isListening = false;
10627
+ this.microphoneStatus$ = new Subject();
10627
10628
  this.TIMEOUT_NO_MESSAGE = 3000;
10628
10629
  this.setRecognition();
10629
10630
  }
@@ -10638,6 +10639,7 @@ let SpeechRecognitionService = class SpeechRecognitionService {
10638
10639
  speechSubject.error('Microphone access is disabled');
10639
10640
  return;
10640
10641
  }
10642
+ this.microphoneStatus$.next('active');
10641
10643
  this.isListening = true;
10642
10644
  this.recognition.continuous = true;
10643
10645
  this.recognition.interimResults = true;
@@ -10677,6 +10679,7 @@ let SpeechRecognitionService = class SpeechRecognitionService {
10677
10679
  }
10678
10680
  this.isListening = false;
10679
10681
  speechSubject.error('Speech recognition error');
10682
+ this.microphoneStatus$.next('inactive');
10680
10683
  });
10681
10684
  };
10682
10685
  this.recognition.onend = () => {
@@ -10687,6 +10690,7 @@ let SpeechRecognitionService = class SpeechRecognitionService {
10687
10690
  speechSubject.next({ text: fullTranscript + interimTranscript, isFinal: true });
10688
10691
  this.isListening = false;
10689
10692
  speechSubject.complete();
10693
+ this.microphoneStatus$.next('inactive');
10690
10694
  });
10691
10695
  };
10692
10696
  this.recognition.start();
@@ -12660,17 +12664,6 @@ let TextAreaComponent = TextAreaComponent_1 = class TextAreaComponent {
12660
12664
  this.cdr.detectChanges();
12661
12665
  });
12662
12666
  }
12663
- get placeholder() {
12664
- return this._placeholder;
12665
- }
12666
- set placeholder(value) {
12667
- if (value) {
12668
- this._placeholder = value;
12669
- }
12670
- else {
12671
- this._placeholder = '';
12672
- }
12673
- }
12674
12667
  get inputStyle() {
12675
12668
  return this._inputStyle;
12676
12669
  }
@@ -12731,7 +12724,7 @@ __decorate([
12731
12724
  ], TextAreaComponent.prototype, "maxLength", void 0);
12732
12725
  __decorate([
12733
12726
  Input()
12734
- ], TextAreaComponent.prototype, "placeholder", null);
12727
+ ], TextAreaComponent.prototype, "placeholder", void 0);
12735
12728
  __decorate([
12736
12729
  Input()
12737
12730
  ], TextAreaComponent.prototype, "inputStyle", null);
@@ -12741,7 +12734,7 @@ __decorate([
12741
12734
  TextAreaComponent = TextAreaComponent_1 = __decorate([
12742
12735
  Component({
12743
12736
  selector: 's-textarea',
12744
- 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",
12745
12738
  providers: [
12746
12739
  {
12747
12740
  provide: NG_VALUE_ACCESSOR,
@@ -12831,7 +12824,8 @@ TextToSpeechService = __decorate([
12831
12824
  })
12832
12825
  ], TextToSpeechService);
12833
12826
 
12834
- let SpeechRecognitionComponent = class SpeechRecognitionComponent {
12827
+ var SpeechRecognitionComponent_1;
12828
+ let SpeechRecognitionComponent = SpeechRecognitionComponent_1 = class SpeechRecognitionComponent {
12835
12829
  constructor(speechRecognitionService, textToSpeechService, translateService) {
12836
12830
  this.speechRecognitionService = speechRecognitionService;
12837
12831
  this.textToSpeechService = textToSpeechService;
@@ -12840,7 +12834,7 @@ let SpeechRecognitionComponent = class SpeechRecognitionComponent {
12840
12834
  this.speechRecognitionPlaceholder = '';
12841
12835
  this._recognizedText = '';
12842
12836
  this.originalTextAreaElementText = '';
12843
- this.isDoneSpeaking = false;
12837
+ this.isDoneTextToSpeech = false;
12844
12838
  this.onDestroy$ = new Subject();
12845
12839
  this.VOICE_SPEEDS = [0.5, 1, 1.5, 2];
12846
12840
  this.keydownEventListener = (event) => {
@@ -12849,7 +12843,7 @@ let SpeechRecognitionComponent = class SpeechRecognitionComponent {
12849
12843
  }
12850
12844
  };
12851
12845
  this.disabled = false;
12852
- this.isSpeaking = false;
12846
+ this.isListeningUserVoice = false;
12853
12847
  this.voiceSpeed = 1;
12854
12848
  this.isDisabledMicrophone = false;
12855
12849
  this.canRenderMicrophone = true;
@@ -12870,17 +12864,25 @@ let SpeechRecognitionComponent = class SpeechRecognitionComponent {
12870
12864
  }
12871
12865
  this.textAreaElement.placeholder = this.speechRecognitionPlaceholder ? this.speechRecognitionPlaceholder : this.translateService.instant("platform.angular_components.text_area_speech_recognition_placeholder");
12872
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
+ });
12873
12872
  }
12874
12873
  onListen() {
12875
12874
  if (this.isDisabledMicrophone || this.isListening) {
12876
12875
  return;
12877
12876
  }
12877
+ // if (this.isPlayingTextToSpeech) {
12878
+ // this.onCloseToolbar();
12879
+ // }
12878
12880
  this.disabled = true;
12879
12881
  this.canRenderMicrophone = false;
12880
12882
  this.canRenderListeningText = true;
12881
12883
  this.originalTextAreaElementText = this.textAreaElement.value;
12882
12884
  this.textAreaElement.value = '';
12883
- this.isSpeaking = true;
12885
+ this.isListeningUserVoice = true;
12884
12886
  this.speechRecognitionService.listen()
12885
12887
  .pipe(takeUntil(this.onDestroy$))
12886
12888
  .subscribe(({ text, isFinal }) => {
@@ -12891,10 +12893,10 @@ let SpeechRecognitionComponent = class SpeechRecognitionComponent {
12891
12893
  this.canRenderAprove = true;
12892
12894
  this.canRenderDiscard = true;
12893
12895
  this.canRenderListeningText = false;
12894
- this.isSpeaking = false;
12896
+ this.isListeningUserVoice = false;
12895
12897
  }
12896
12898
  }, () => {
12897
- this.isSpeaking = false;
12899
+ this.isListeningUserVoice = false;
12898
12900
  this.canRenderMicrophone = true;
12899
12901
  this.isDisabledMicrophone = false;
12900
12902
  this.canRenderListeningText = false;
@@ -12912,15 +12914,15 @@ let SpeechRecognitionComponent = class SpeechRecognitionComponent {
12912
12914
  }
12913
12915
  this.canRenderTextToSpeechToolbar = true;
12914
12916
  this.canRenderTextToSpeech = false;
12915
- this.isPlayingTextToSpeech = true;
12917
+ SpeechRecognitionComponent_1.TOOLBAR_ACTIVE = true;
12916
12918
  this.speak();
12917
12919
  }
12918
12920
  onCloseToolbar() {
12919
12921
  this.canRenderTextToSpeechToolbar = false;
12920
12922
  this.canRenderTextToSpeech = true;
12921
- this.isPlayingTextToSpeech = false;
12922
- this.textToSpeechService.cancel();
12923
+ this.stopTextToSpeech();
12923
12924
  this.voiceSpeed = 1;
12925
+ SpeechRecognitionComponent_1.TOOLBAR_ACTIVE = false;
12924
12926
  }
12925
12927
  onDiscard() {
12926
12928
  this.canRenderAprove = false;
@@ -12931,7 +12933,8 @@ let SpeechRecognitionComponent = class SpeechRecognitionComponent {
12931
12933
  this._recognizedText = '';
12932
12934
  this.setTextAreaValue(this.originalTextAreaElementText);
12933
12935
  this.disabled = false;
12934
- this.textToSpeechService.cancel();
12936
+ this.stopTextToSpeech();
12937
+ SpeechRecognitionComponent_1.TOOLBAR_ACTIVE = false;
12935
12938
  }
12936
12939
  onAprove() {
12937
12940
  this.canRenderAprove = false;
@@ -12961,7 +12964,7 @@ let SpeechRecognitionComponent = class SpeechRecognitionComponent {
12961
12964
  this.textToSpeechService.pause();
12962
12965
  }
12963
12966
  else {
12964
- if (this.isDoneSpeaking) {
12967
+ if (this.isDoneTextToSpeech) {
12965
12968
  this.speak();
12966
12969
  }
12967
12970
  else {
@@ -12971,7 +12974,6 @@ let SpeechRecognitionComponent = class SpeechRecognitionComponent {
12971
12974
  this.isPlayingTextToSpeech = !this.isPlayingTextToSpeech;
12972
12975
  }
12973
12976
  restartTextToSpeech() {
12974
- this.isPlayingTextToSpeech = true;
12975
12977
  this.textToSpeechService.cancel();
12976
12978
  this.speak();
12977
12979
  }
@@ -12993,19 +12995,28 @@ let SpeechRecognitionComponent = class SpeechRecognitionComponent {
12993
12995
  }
12994
12996
  get isDisabledTextToSpeech() {
12995
12997
  const hasTextToSpeechVoice = this.textToSpeechService.hasVoice;
12996
- return !this._recognizedText || !hasTextToSpeechVoice || this.isListening;
12998
+ return !this.textToSpeech || !hasTextToSpeechVoice || this.isListening || SpeechRecognitionComponent_1.TOOLBAR_ACTIVE;
12997
12999
  }
12998
13000
  setTextAreaValue(value) {
12999
13001
  this.textAreaElement.value = value;
13000
13002
  }
13003
+ stopTextToSpeech() {
13004
+ this.isPlayingTextToSpeech = false;
13005
+ this.textToSpeechService.cancel();
13006
+ }
13001
13007
  speak() {
13002
- this.isDoneSpeaking = false;
13003
- 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(() => {
13004
13011
  this.isPlayingTextToSpeech = false;
13005
- this.isDoneSpeaking = true;
13012
+ this.isDoneTextToSpeech = true;
13006
13013
  });
13007
13014
  }
13015
+ get textToSpeech() {
13016
+ return this.textAreaElement.value;
13017
+ }
13008
13018
  };
13019
+ SpeechRecognitionComponent.TOOLBAR_ACTIVE = false;
13009
13020
  SpeechRecognitionComponent.ctorParameters = () => [
13010
13021
  { type: SpeechRecognitionService },
13011
13022
  { type: TextToSpeechService },
@@ -13023,10 +13034,10 @@ __decorate([
13023
13034
  __decorate([
13024
13035
  Output()
13025
13036
  ], SpeechRecognitionComponent.prototype, "recognizedText", void 0);
13026
- SpeechRecognitionComponent = __decorate([
13037
+ SpeechRecognitionComponent = SpeechRecognitionComponent_1 = __decorate([
13027
13038
  Component({
13028
13039
  selector: 's-speech-recognition',
13029
- 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",
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",
13030
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}.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}"]
13031
13042
  })
13032
13043
  ], SpeechRecognitionComponent);