@seniorsistemas/angular-components 17.26.9 → 17.26.10

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 +117 -79
  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/esm5/components/speech-recognition/speech-recognition/speech-recognition.component.js +40 -19
  13. package/esm5/components/speech-recognition/speech-recognition.service.js +78 -46
  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 +75 -52
  17. package/fesm2015/seniorsistemas-angular-components.js.map +1 -1
  18. package/fesm5/seniorsistemas-angular-components.js +117 -79
  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
@@ -11504,9 +11504,8 @@
11504
11504
  this.translateService = translateService;
11505
11505
  this.hasSupportSpeechRecognition = false;
11506
11506
  this.isListening = false;
11507
- this.hasMicrophoneAccess = false;
11507
+ this.microphoneStatus$ = new rxjs.Subject();
11508
11508
  this.TIMEOUT_NO_MESSAGE = 3000;
11509
- this.verifyMicrophoneState();
11510
11509
  this.setRecognition();
11511
11510
  }
11512
11511
  SpeechRecognitionService.prototype.listen = function () {
@@ -11515,82 +11514,73 @@
11515
11514
  if (this.isListening) {
11516
11515
  speechSubject.error('Already listening');
11517
11516
  }
11518
- else if (!this.hasMicrophoneAccess) {
11519
- this.isListening = false;
11520
- this.toastService.show({ severity: 'error', text: this.translateService.instant('platform.angular_components.no_microphone_permission') });
11521
- speechSubject.error('Microphone access is disabled');
11522
- }
11523
- else {
11524
- this.isListening = true;
11525
- this.recognition.continuous = true;
11526
- this.recognition.interimResults = true;
11527
- this.recognition.maxAlternatives = 1;
11528
- var silenceTimer_1;
11529
- var restartSilenceTimer_1 = function () {
11530
- if (silenceTimer_1 !== undefined) {
11531
- clearTimeout(silenceTimer_1);
11517
+ this.hasMicrophoneAccess.then(function (hasAccess) {
11518
+ if (!hasAccess) {
11519
+ _this.toastService.show({ severity: 'error', text: _this.translateService.instant('platform.angular_components.no_microphone_permission') });
11520
+ speechSubject.error('Microphone access is disabled');
11521
+ return;
11522
+ }
11523
+ _this.microphoneStatus$.next('active');
11524
+ _this.isListening = true;
11525
+ _this.recognition.continuous = true;
11526
+ _this.recognition.interimResults = true;
11527
+ _this.recognition.maxAlternatives = 1;
11528
+ var silenceTimer;
11529
+ var restartSilenceTimer = function () {
11530
+ if (silenceTimer !== undefined) {
11531
+ clearTimeout(silenceTimer);
11532
11532
  }
11533
- silenceTimer_1 = setTimeout(function () {
11533
+ silenceTimer = setTimeout(function () {
11534
11534
  _this.recognition.stop();
11535
11535
  }, _this.TIMEOUT_NO_MESSAGE);
11536
11536
  };
11537
- var fullTranscript_1 = '';
11538
- var interimTranscript_1 = '';
11539
- this.recognition.onresult = function (event) {
11537
+ var fullTranscript = '';
11538
+ var interimTranscript = '';
11539
+ _this.recognition.onresult = function (event) {
11540
11540
  _this.ngZone.run(function () {
11541
- restartSilenceTimer_1();
11541
+ restartSilenceTimer();
11542
11542
  var interimTranscript = '';
11543
11543
  for (var i = event.resultIndex; i < event.results.length; ++i) {
11544
11544
  var transcript = event.results[i][0].transcript;
11545
11545
  if (event.results[i].isFinal) {
11546
- fullTranscript_1 += transcript + '\n';
11546
+ fullTranscript += transcript + '\n';
11547
11547
  }
11548
11548
  else {
11549
11549
  interimTranscript += transcript;
11550
11550
  }
11551
11551
  }
11552
11552
  interimTranscript = interimTranscript;
11553
- speechSubject.next({ text: fullTranscript_1 + interimTranscript, isFinal: false });
11553
+ speechSubject.next({ text: fullTranscript + interimTranscript, isFinal: false });
11554
11554
  });
11555
11555
  };
11556
- this.recognition.onerror = function () {
11556
+ _this.recognition.onerror = function () {
11557
11557
  _this.ngZone.run(function () {
11558
- if (silenceTimer_1 !== undefined) {
11559
- clearTimeout(silenceTimer_1);
11558
+ if (silenceTimer !== undefined) {
11559
+ clearTimeout(silenceTimer);
11560
11560
  }
11561
11561
  _this.isListening = false;
11562
11562
  speechSubject.error('Speech recognition error');
11563
+ _this.microphoneStatus$.next('inactive');
11563
11564
  });
11564
11565
  };
11565
- this.recognition.onend = function () {
11566
+ _this.recognition.onend = function () {
11566
11567
  _this.ngZone.run(function () {
11567
- if (silenceTimer_1 !== undefined) {
11568
- clearTimeout(silenceTimer_1);
11568
+ if (silenceTimer !== undefined) {
11569
+ clearTimeout(silenceTimer);
11569
11570
  }
11570
- speechSubject.next({ text: fullTranscript_1 + interimTranscript_1, isFinal: true });
11571
+ speechSubject.next({ text: fullTranscript + interimTranscript, isFinal: true });
11571
11572
  _this.isListening = false;
11572
11573
  speechSubject.complete();
11574
+ _this.microphoneStatus$.next('inactive');
11573
11575
  });
11574
11576
  };
11575
- this.recognition.start();
11576
- }
11577
+ _this.recognition.start();
11578
+ });
11577
11579
  return speechSubject;
11578
11580
  };
11579
11581
  SpeechRecognitionService.prototype.stop = function () {
11580
11582
  this.recognition.stop();
11581
11583
  };
11582
- SpeechRecognitionService.prototype.verifyMicrophoneState = function () {
11583
- var _this = this;
11584
- navigator.permissions.query({ name: 'microphone' }).then(function (result) {
11585
- var microphoneResultState = result.state;
11586
- _this.hasMicrophoneAccess = microphoneResultState === 'granted';
11587
- result.onchange = function () {
11588
- _this.ngZone.run(function () {
11589
- _this.hasMicrophoneAccess = result.state === 'granted';
11590
- });
11591
- };
11592
- });
11593
- };
11594
11584
  SpeechRecognitionService.prototype.setRecognition = function () {
11595
11585
  var _this = this;
11596
11586
  var _a;
@@ -11606,6 +11596,48 @@
11606
11596
  this.recognition.maxAlternatives = 1;
11607
11597
  this.localeService.getLocale().subscribe(function (locale) { return _this.recognition.lang = locale; });
11608
11598
  };
11599
+ Object.defineProperty(SpeechRecognitionService.prototype, "hasMicrophoneAccess", {
11600
+ get: function () {
11601
+ var _this = this;
11602
+ return new Promise(function (resolve) { return __awaiter(_this, void 0, void 0, function () {
11603
+ var permission;
11604
+ var _this = this;
11605
+ return __generator(this, function (_a) {
11606
+ switch (_a.label) {
11607
+ case 0: return [4 /*yield*/, navigator.permissions.query({ name: 'microphone' })];
11608
+ case 1:
11609
+ permission = _a.sent();
11610
+ if (permission.state === 'denied') {
11611
+ resolve(false);
11612
+ }
11613
+ else if (permission.state === 'granted') {
11614
+ resolve(true);
11615
+ }
11616
+ else if (permission.state === 'prompt') {
11617
+ try {
11618
+ navigator.mediaDevices.getUserMedia({ audio: true }).then(function (stream) {
11619
+ stream.getTracks().forEach(function (t) { return t.stop(); });
11620
+ }).catch(function () {
11621
+ resolve(false);
11622
+ });
11623
+ permission.onchange = function () {
11624
+ _this.ngZone.run(function () {
11625
+ resolve(permission.state === 'granted' ? true : false);
11626
+ });
11627
+ };
11628
+ }
11629
+ catch (error) {
11630
+ resolve(false);
11631
+ }
11632
+ }
11633
+ return [2 /*return*/];
11634
+ }
11635
+ });
11636
+ }); });
11637
+ },
11638
+ enumerable: true,
11639
+ configurable: true
11640
+ });
11609
11641
  SpeechRecognitionService.ctorParameters = function () { return [
11610
11642
  { type: LocaleService },
11611
11643
  { type: core.NgZone },
@@ -13623,21 +13655,6 @@
13623
13655
  enumerable: true,
13624
13656
  configurable: true
13625
13657
  });
13626
- Object.defineProperty(TextAreaComponent.prototype, "placeholder", {
13627
- get: function () {
13628
- return this._placeholder;
13629
- },
13630
- set: function (value) {
13631
- if (value) {
13632
- this._placeholder = value;
13633
- }
13634
- else {
13635
- this._placeholder = '';
13636
- }
13637
- },
13638
- enumerable: true,
13639
- configurable: true
13640
- });
13641
13658
  Object.defineProperty(TextAreaComponent.prototype, "inputStyle", {
13642
13659
  get: function () {
13643
13660
  return this._inputStyle;
@@ -13702,7 +13719,7 @@
13702
13719
  ], TextAreaComponent.prototype, "maxLength", void 0);
13703
13720
  __decorate([
13704
13721
  core.Input()
13705
- ], TextAreaComponent.prototype, "placeholder", null);
13722
+ ], TextAreaComponent.prototype, "placeholder", void 0);
13706
13723
  __decorate([
13707
13724
  core.Input()
13708
13725
  ], TextAreaComponent.prototype, "inputStyle", null);
@@ -13712,7 +13729,7 @@
13712
13729
  TextAreaComponent = TextAreaComponent_1 = __decorate([
13713
13730
  core.Component({
13714
13731
  selector: 's-textarea',
13715
- 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",
13732
+ 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",
13716
13733
  providers: [
13717
13734
  {
13718
13735
  provide: forms.NG_VALUE_ACCESSOR,
@@ -13822,7 +13839,7 @@
13822
13839
  this.speechRecognitionPlaceholder = '';
13823
13840
  this._recognizedText = '';
13824
13841
  this.originalTextAreaElementText = '';
13825
- this.isDoneSpeaking = false;
13842
+ this.isDoneTextToSpeech = false;
13826
13843
  this.onDestroy$ = new rxjs.Subject();
13827
13844
  this.VOICE_SPEEDS = [0.5, 1, 1.5, 2];
13828
13845
  this.keydownEventListener = function (event) {
@@ -13831,7 +13848,7 @@
13831
13848
  }
13832
13849
  };
13833
13850
  this.disabled = false;
13834
- this.isSpeaking = false;
13851
+ this.isListeningUserVoice = false;
13835
13852
  this.voiceSpeed = 1;
13836
13853
  this.isDisabledMicrophone = false;
13837
13854
  this.canRenderMicrophone = true;
@@ -13843,7 +13860,9 @@
13843
13860
  this.isPlayingTextToSpeech = false;
13844
13861
  this.recognizedText = new core.EventEmitter();
13845
13862
  }
13863
+ SpeechRecognitionComponent_1 = SpeechRecognitionComponent;
13846
13864
  SpeechRecognitionComponent.prototype.ngOnInit = function () {
13865
+ var _this = this;
13847
13866
  if (!this.hasSpeechRecognitionBrowserApi) {
13848
13867
  return;
13849
13868
  }
@@ -13852,6 +13871,11 @@
13852
13871
  }
13853
13872
  this.textAreaElement.placeholder = this.speechRecognitionPlaceholder ? this.speechRecognitionPlaceholder : this.translateService.instant("platform.angular_components.text_area_speech_recognition_placeholder");
13854
13873
  this.textAreaElement.addEventListener('keydown', this.keydownEventListener);
13874
+ this.speechRecognitionService.microphoneStatus$.pipe(operators.takeUntil(this.onDestroy$)).subscribe(function (status) {
13875
+ if (status === 'active') {
13876
+ _this.onCloseToolbar();
13877
+ }
13878
+ });
13855
13879
  };
13856
13880
  SpeechRecognitionComponent.prototype.onListen = function () {
13857
13881
  var _this = this;
@@ -13863,7 +13887,7 @@
13863
13887
  this.canRenderListeningText = true;
13864
13888
  this.originalTextAreaElementText = this.textAreaElement.value;
13865
13889
  this.textAreaElement.value = '';
13866
- this.isSpeaking = true;
13890
+ this.isListeningUserVoice = true;
13867
13891
  this.speechRecognitionService.listen()
13868
13892
  .pipe(operators.takeUntil(this.onDestroy$))
13869
13893
  .subscribe(function (_a) {
@@ -13875,10 +13899,10 @@
13875
13899
  _this.canRenderAprove = true;
13876
13900
  _this.canRenderDiscard = true;
13877
13901
  _this.canRenderListeningText = false;
13878
- _this.isSpeaking = false;
13902
+ _this.isListeningUserVoice = false;
13879
13903
  }
13880
13904
  }, function () {
13881
- _this.isSpeaking = false;
13905
+ _this.isListeningUserVoice = false;
13882
13906
  _this.canRenderMicrophone = true;
13883
13907
  _this.isDisabledMicrophone = false;
13884
13908
  _this.canRenderListeningText = false;
@@ -13897,15 +13921,15 @@
13897
13921
  }
13898
13922
  this.canRenderTextToSpeechToolbar = true;
13899
13923
  this.canRenderTextToSpeech = false;
13900
- this.isPlayingTextToSpeech = true;
13924
+ SpeechRecognitionComponent_1.TOOLBAR_ACTIVE = true;
13901
13925
  this.speak();
13902
13926
  };
13903
13927
  SpeechRecognitionComponent.prototype.onCloseToolbar = function () {
13904
13928
  this.canRenderTextToSpeechToolbar = false;
13905
13929
  this.canRenderTextToSpeech = true;
13906
- this.isPlayingTextToSpeech = false;
13907
- this.textToSpeechService.cancel();
13930
+ this.stopTextToSpeech();
13908
13931
  this.voiceSpeed = 1;
13932
+ SpeechRecognitionComponent_1.TOOLBAR_ACTIVE = false;
13909
13933
  };
13910
13934
  SpeechRecognitionComponent.prototype.onDiscard = function () {
13911
13935
  this.canRenderAprove = false;
@@ -13916,7 +13940,8 @@
13916
13940
  this._recognizedText = '';
13917
13941
  this.setTextAreaValue(this.originalTextAreaElementText);
13918
13942
  this.disabled = false;
13919
- this.textToSpeechService.cancel();
13943
+ this.stopTextToSpeech();
13944
+ SpeechRecognitionComponent_1.TOOLBAR_ACTIVE = false;
13920
13945
  };
13921
13946
  SpeechRecognitionComponent.prototype.onAprove = function () {
13922
13947
  this.canRenderAprove = false;
@@ -13946,7 +13971,7 @@
13946
13971
  this.textToSpeechService.pause();
13947
13972
  }
13948
13973
  else {
13949
- if (this.isDoneSpeaking) {
13974
+ if (this.isDoneTextToSpeech) {
13950
13975
  this.speak();
13951
13976
  }
13952
13977
  else {
@@ -13956,7 +13981,6 @@
13956
13981
  this.isPlayingTextToSpeech = !this.isPlayingTextToSpeech;
13957
13982
  };
13958
13983
  SpeechRecognitionComponent.prototype.restartTextToSpeech = function () {
13959
- this.isPlayingTextToSpeech = true;
13960
13984
  this.textToSpeechService.cancel();
13961
13985
  this.speak();
13962
13986
  };
@@ -13987,7 +14011,7 @@
13987
14011
  Object.defineProperty(SpeechRecognitionComponent.prototype, "isDisabledTextToSpeech", {
13988
14012
  get: function () {
13989
14013
  var hasTextToSpeechVoice = this.textToSpeechService.hasVoice;
13990
- return !this._recognizedText || !hasTextToSpeechVoice || this.isListening;
14014
+ return !this.textToSpeech || !hasTextToSpeechVoice || this.isListening || SpeechRecognitionComponent_1.TOOLBAR_ACTIVE;
13991
14015
  },
13992
14016
  enumerable: true,
13993
14017
  configurable: true
@@ -13995,14 +14019,28 @@
13995
14019
  SpeechRecognitionComponent.prototype.setTextAreaValue = function (value) {
13996
14020
  this.textAreaElement.value = value;
13997
14021
  };
14022
+ SpeechRecognitionComponent.prototype.stopTextToSpeech = function () {
14023
+ this.isPlayingTextToSpeech = false;
14024
+ this.textToSpeechService.cancel();
14025
+ };
13998
14026
  SpeechRecognitionComponent.prototype.speak = function () {
13999
14027
  var _this = this;
14000
- this.isDoneSpeaking = false;
14001
- this.textToSpeechService.speak(this._recognizedText, this.voiceSpeed).then(function () {
14028
+ this.isDoneTextToSpeech = false;
14029
+ this.isPlayingTextToSpeech = true;
14030
+ this.textToSpeechService.speak(this.textToSpeech, this.voiceSpeed).then(function () {
14002
14031
  _this.isPlayingTextToSpeech = false;
14003
- _this.isDoneSpeaking = true;
14032
+ _this.isDoneTextToSpeech = true;
14004
14033
  });
14005
14034
  };
14035
+ Object.defineProperty(SpeechRecognitionComponent.prototype, "textToSpeech", {
14036
+ get: function () {
14037
+ return this.textAreaElement.value;
14038
+ },
14039
+ enumerable: true,
14040
+ configurable: true
14041
+ });
14042
+ var SpeechRecognitionComponent_1;
14043
+ SpeechRecognitionComponent.TOOLBAR_ACTIVE = false;
14006
14044
  SpeechRecognitionComponent.ctorParameters = function () { return [
14007
14045
  { type: SpeechRecognitionService },
14008
14046
  { type: TextToSpeechService },
@@ -14020,11 +14058,11 @@
14020
14058
  __decorate([
14021
14059
  core.Output()
14022
14060
  ], SpeechRecognitionComponent.prototype, "recognizedText", void 0);
14023
- SpeechRecognitionComponent = __decorate([
14061
+ SpeechRecognitionComponent = SpeechRecognitionComponent_1 = __decorate([
14024
14062
  core.Component({
14025
14063
  selector: 's-speech-recognition',
14026
- 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",
14027
- 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}"]
14064
+ 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",
14065
+ 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}"]
14028
14066
  })
14029
14067
  ], SpeechRecognitionComponent);
14030
14068
  return SpeechRecognitionComponent;