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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -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;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)}"]
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)}"]
380
380
  })
381
381
  ], TooltipComponent);
382
382
 
@@ -10624,7 +10624,9 @@ let SpeechRecognitionService = class SpeechRecognitionService {
10624
10624
  this.translateService = translateService;
10625
10625
  this.hasSupportSpeechRecognition = false;
10626
10626
  this.isListening = false;
10627
+ this.hasMicrophoneAccess = false;
10627
10628
  this.TIMEOUT_NO_MESSAGE = 3000;
10629
+ this.verifyMicrophoneState();
10628
10630
  this.setRecognition();
10629
10631
  }
10630
10632
  listen() {
@@ -10632,12 +10634,12 @@ let SpeechRecognitionService = class SpeechRecognitionService {
10632
10634
  if (this.isListening) {
10633
10635
  speechSubject.error('Already listening');
10634
10636
  }
10635
- this.hasMicrophoneAccess().then((hasAccess) => {
10636
- if (!hasAccess) {
10637
- this.toastService.show({ severity: 'error', text: this.translateService.instant('platform.angular_components.no_microphone_permission') });
10638
- speechSubject.error('Microphone access is disabled');
10639
- return;
10640
- }
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 {
10641
10643
  this.isListening = true;
10642
10644
  this.recognition.continuous = true;
10643
10645
  this.recognition.interimResults = true;
@@ -10690,12 +10692,23 @@ let SpeechRecognitionService = class SpeechRecognitionService {
10690
10692
  });
10691
10693
  };
10692
10694
  this.recognition.start();
10693
- });
10695
+ }
10694
10696
  return speechSubject;
10695
10697
  }
10696
10698
  stop() {
10697
10699
  this.recognition.stop();
10698
10700
  }
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
+ }
10699
10712
  setRecognition() {
10700
10713
  var _a;
10701
10714
  const SpeechRecognitionConstructor = window.SpeechRecognition || window.webkitSpeechRecognition;
@@ -10710,33 +10723,6 @@ let SpeechRecognitionService = class SpeechRecognitionService {
10710
10723
  this.recognition.maxAlternatives = 1;
10711
10724
  this.localeService.getLocale().subscribe(locale => this.recognition.lang = locale);
10712
10725
  }
10713
- hasMicrophoneAccess() {
10714
- return __awaiter(this, void 0, void 0, function* () {
10715
- try {
10716
- const permission = yield navigator.permissions.query({ name: 'microphone' });
10717
- if (permission.state === 'denied') {
10718
- return false;
10719
- }
10720
- if (permission.state === 'granted') {
10721
- return true;
10722
- }
10723
- if (permission.state === 'prompt') {
10724
- try {
10725
- const stream = yield navigator.mediaDevices.getUserMedia({ audio: true });
10726
- stream.getTracks().forEach(t => t.stop());
10727
- return true;
10728
- }
10729
- catch (_a) {
10730
- return false;
10731
- }
10732
- }
10733
- return false;
10734
- }
10735
- catch (_b) {
10736
- return false;
10737
- }
10738
- });
10739
- }
10740
10726
  };
10741
10727
  SpeechRecognitionService.ctorParameters = () => [
10742
10728
  { type: LocaleService },