@doolehealth/service-lib 0.0.1 → 0.0.2

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.
@@ -1,21 +1,21 @@
1
1
  import * as i0 from '@angular/core';
2
2
  import { Component, InjectionToken, NgModule, Injectable, Inject, PLATFORM_ID, ViewChild } from '@angular/core';
3
- import * as i2$2 from '@angular/common';
3
+ import * as i2$1 from '@angular/common';
4
4
  import { CommonModule, DatePipe } from '@angular/common';
5
- import { BehaviorSubject, Subject, Observable, merge, of, fromEvent } from 'rxjs';
5
+ import { BehaviorSubject, Subject, Observable, merge, of, fromEvent, ReplaySubject, combineLatest } from 'rxjs';
6
6
  import { Preferences } from '@capacitor/preferences';
7
- import { map, tap, catchError, mapTo } from 'rxjs/operators';
7
+ import { map, tap, catchError, mapTo, delay, startWith } from 'rxjs/operators';
8
8
  import * as i1 from '@angular/common/http';
9
9
  import { HttpErrorResponse, HttpClient, HttpParams, HttpHeaders } from '@angular/common/http';
10
- import * as i6 from '@angular/router';
10
+ import * as i4 from '@angular/router';
11
11
  import { RouterOutlet, NavigationEnd } from '@angular/router';
12
- import * as i1$1 from '@ngx-translate/core';
12
+ import * as i2$2 from '@ngx-translate/core';
13
13
  import { TranslateService } from '@ngx-translate/core';
14
14
  import { Capacitor } from '@capacitor/core';
15
15
  import * as CryptoJS from 'crypto-js';
16
- import * as i2 from '@ionic/angular';
16
+ import * as i1$1 from '@ionic/angular';
17
17
  import * as i5 from '@angular/fire/compat/auth';
18
- import * as i2$1 from '@awesome-cordova-plugins/file-transfer/ngx';
18
+ import * as i2 from '@awesome-cordova-plugins/file-transfer/ngx';
19
19
  import * as i3 from '@awesome-cordova-plugins/file/ngx';
20
20
  import moment from 'moment';
21
21
  import * as HighCharts from 'highcharts';
@@ -25,6 +25,7 @@ import { MatSnackBarConfig } from '@angular/material/snack-bar';
25
25
  import * as i1$3 from '@awesome-cordova-plugins/network/ngx';
26
26
  import { CallCapacitor } from '@doole/videocall-notications-plugins';
27
27
  import { FirebaseAnalytics } from '@capacitor-community/firebase-analytics';
28
+ import 'zone.js';
28
29
 
29
30
  class ServiceLibComponent {
30
31
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.10", ngImport: i0, type: ServiceLibComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
@@ -685,7 +686,7 @@ class AuthenticationService {
685
686
  console.log("Booelan: ", value);
686
687
  return value !== null ? JSON.parse(value) : false;
687
688
  }
688
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.10", ngImport: i0, type: AuthenticationService, deps: [{ token: PLATFORM_ID }, { token: i1.HttpClient }, { token: TokenService }, { token: ApiEndpointsService }, { token: i2.Platform }, { token: i5.AngularFireAuth }, { token: i6.Router }, { token: i2.AlertController }, { token: i0.Injector }, { token: ChangeEndpointsService }], target: i0.ɵɵFactoryTarget.Injectable }); }
689
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.10", ngImport: i0, type: AuthenticationService, deps: [{ token: PLATFORM_ID }, { token: i1.HttpClient }, { token: TokenService }, { token: ApiEndpointsService }, { token: i1$1.Platform }, { token: i5.AngularFireAuth }, { token: i4.Router }, { token: i1$1.AlertController }, { token: i0.Injector }, { token: ChangeEndpointsService }], target: i0.ɵɵFactoryTarget.Injectable }); }
689
690
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.10", ngImport: i0, type: AuthenticationService, providedIn: 'root' }); }
690
691
  }
691
692
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.10", ngImport: i0, type: AuthenticationService, decorators: [{
@@ -696,7 +697,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.10", ngImpo
696
697
  }], ctorParameters: () => [{ type: undefined, decorators: [{
697
698
  type: Inject,
698
699
  args: [PLATFORM_ID]
699
- }] }, { type: i1.HttpClient }, { type: TokenService }, { type: ApiEndpointsService }, { type: i2.Platform }, { type: i5.AngularFireAuth }, { type: i6.Router }, { type: i2.AlertController }, { type: i0.Injector }, { type: ChangeEndpointsService }], propDecorators: { outlet: [{
700
+ }] }, { type: i1.HttpClient }, { type: TokenService }, { type: ApiEndpointsService }, { type: i1$1.Platform }, { type: i5.AngularFireAuth }, { type: i4.Router }, { type: i1$1.AlertController }, { type: i0.Injector }, { type: ChangeEndpointsService }], propDecorators: { outlet: [{
700
701
  type: ViewChild,
701
702
  args: [RouterOutlet]
702
703
  }] } });
@@ -2154,7 +2155,7 @@ class DooleService {
2154
2155
  return res;
2155
2156
  }));
2156
2157
  }
2157
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.10", ngImport: i0, type: DooleService, deps: [{ token: AuthenticationService }, { token: i2$1.FileTransfer }, { token: i3.File }, { token: HttpService }, { token: ApiEndpointsService }, { token: Events }, { token: i2.Platform }, { token: i6.Router }, { token: i2.AlertController }], target: i0.ɵɵFactoryTarget.Injectable }); }
2158
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.10", ngImport: i0, type: DooleService, deps: [{ token: AuthenticationService }, { token: i2.FileTransfer }, { token: i3.File }, { token: HttpService }, { token: ApiEndpointsService }, { token: Events }, { token: i1$1.Platform }, { token: i4.Router }, { token: i1$1.AlertController }], target: i0.ɵɵFactoryTarget.Injectable }); }
2158
2159
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.10", ngImport: i0, type: DooleService, providedIn: 'root' }); }
2159
2160
  }
2160
2161
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.10", ngImport: i0, type: DooleService, decorators: [{
@@ -2162,7 +2163,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.10", ngImpo
2162
2163
  args: [{
2163
2164
  providedIn: 'root'
2164
2165
  }]
2165
- }], ctorParameters: () => [{ type: AuthenticationService }, { type: i2$1.FileTransfer }, { type: i3.File }, { type: HttpService }, { type: ApiEndpointsService }, { type: Events }, { type: i2.Platform }, { type: i6.Router }, { type: i2.AlertController }] });
2166
+ }], ctorParameters: () => [{ type: AuthenticationService }, { type: i2.FileTransfer }, { type: i3.File }, { type: HttpService }, { type: ApiEndpointsService }, { type: Events }, { type: i1$1.Platform }, { type: i4.Router }, { type: i1$1.AlertController }] });
2166
2167
 
2167
2168
  class NavigationService {
2168
2169
  constructor(router, location) {
@@ -2190,7 +2191,7 @@ class NavigationService {
2190
2191
  else
2191
2192
  this.back();
2192
2193
  }
2193
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.10", ngImport: i0, type: NavigationService, deps: [{ token: i6.Router }, { token: i2$2.Location }], target: i0.ɵɵFactoryTarget.Injectable }); }
2194
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.10", ngImport: i0, type: NavigationService, deps: [{ token: i4.Router }, { token: i2$1.Location }], target: i0.ɵɵFactoryTarget.Injectable }); }
2194
2195
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.10", ngImport: i0, type: NavigationService, providedIn: 'root' }); }
2195
2196
  }
2196
2197
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.10", ngImport: i0, type: NavigationService, decorators: [{
@@ -2198,7 +2199,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.10", ngImpo
2198
2199
  args: [{
2199
2200
  providedIn: 'root'
2200
2201
  }]
2201
- }], ctorParameters: () => [{ type: i6.Router }, { type: i2$2.Location }] });
2202
+ }], ctorParameters: () => [{ type: i4.Router }, { type: i2$1.Location }] });
2202
2203
 
2203
2204
  class LanguageService {
2204
2205
  constructor(translate) {
@@ -2225,7 +2226,7 @@ class LanguageService {
2225
2226
  this.changeLanguage(language);
2226
2227
  localStorage.setItem('language', language);
2227
2228
  }
2228
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.10", ngImport: i0, type: LanguageService, deps: [{ token: i1$1.TranslateService }], target: i0.ɵɵFactoryTarget.Injectable }); }
2229
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.10", ngImport: i0, type: LanguageService, deps: [{ token: i2$2.TranslateService }], target: i0.ɵɵFactoryTarget.Injectable }); }
2229
2230
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.10", ngImport: i0, type: LanguageService, providedIn: 'root' }); }
2230
2231
  }
2231
2232
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.10", ngImport: i0, type: LanguageService, decorators: [{
@@ -2233,7 +2234,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.10", ngImpo
2233
2234
  args: [{
2234
2235
  providedIn: 'root'
2235
2236
  }]
2236
- }], ctorParameters: () => [{ type: i1$1.TranslateService }] });
2237
+ }], ctorParameters: () => [{ type: i2$2.TranslateService }] });
2237
2238
 
2238
2239
  class DateService {
2239
2240
  constructor(datePipe, translate) {
@@ -2638,7 +2639,7 @@ class DateService {
2638
2639
  let date = localISOTime; // this.dateService.selectedDateFormat(localISOTime);
2639
2640
  return new Date(Date.now() - tzoffset).getTime().toLocaleString();
2640
2641
  }
2641
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.10", ngImport: i0, type: DateService, deps: [{ token: i2$2.DatePipe }, { token: i1$1.TranslateService }], target: i0.ɵɵFactoryTarget.Injectable }); }
2642
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.10", ngImport: i0, type: DateService, deps: [{ token: i2$1.DatePipe }, { token: i2$2.TranslateService }], target: i0.ɵɵFactoryTarget.Injectable }); }
2642
2643
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.10", ngImport: i0, type: DateService, providedIn: 'root' }); }
2643
2644
  }
2644
2645
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.10", ngImport: i0, type: DateService, decorators: [{
@@ -2646,7 +2647,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.10", ngImpo
2646
2647
  args: [{
2647
2648
  providedIn: 'root',
2648
2649
  }]
2649
- }], ctorParameters: () => [{ type: i2$2.DatePipe }, { type: i1$1.TranslateService }] });
2650
+ }], ctorParameters: () => [{ type: i2$1.DatePipe }, { type: i2$2.TranslateService }] });
2650
2651
 
2651
2652
  highchartsMore(HighCharts);
2652
2653
  class HighchartsService {
@@ -3767,7 +3768,7 @@ class NotificationService {
3767
3768
  break;
3768
3769
  }
3769
3770
  }
3770
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.10", ngImport: i0, type: NotificationService, deps: [{ token: i1$2.MatSnackBar }, { token: i0.NgZone }, { token: i2.AlertController }, { token: i1$1.TranslateService }, { token: i2.ToastController }, { token: i0.NgZone }, { token: i2.Platform }, { token: i6.Router }], target: i0.ɵɵFactoryTarget.Injectable }); }
3771
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.10", ngImport: i0, type: NotificationService, deps: [{ token: i1$2.MatSnackBar }, { token: i0.NgZone }, { token: i1$1.AlertController }, { token: i2$2.TranslateService }, { token: i1$1.ToastController }, { token: i0.NgZone }, { token: i1$1.Platform }, { token: i4.Router }], target: i0.ɵɵFactoryTarget.Injectable }); }
3771
3772
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.10", ngImport: i0, type: NotificationService, providedIn: 'root' }); }
3772
3773
  }
3773
3774
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.10", ngImport: i0, type: NotificationService, decorators: [{
@@ -3775,7 +3776,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.10", ngImpo
3775
3776
  args: [{
3776
3777
  providedIn: 'root'
3777
3778
  }]
3778
- }], ctorParameters: () => [{ type: i1$2.MatSnackBar }, { type: i0.NgZone }, { type: i2.AlertController }, { type: i1$1.TranslateService }, { type: i2.ToastController }, { type: i0.NgZone }, { type: i2.Platform }, { type: i6.Router }] });
3779
+ }], ctorParameters: () => [{ type: i1$2.MatSnackBar }, { type: i0.NgZone }, { type: i1$1.AlertController }, { type: i2$2.TranslateService }, { type: i1$1.ToastController }, { type: i0.NgZone }, { type: i1$1.Platform }, { type: i4.Router }] });
3779
3780
 
3780
3781
  class NetworkService {
3781
3782
  constructor(network, platform) {
@@ -3802,7 +3803,7 @@ class NetworkService {
3802
3803
  getNetworkStatus() {
3803
3804
  return this.online$;
3804
3805
  }
3805
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.10", ngImport: i0, type: NetworkService, deps: [{ token: i1$3.Network }, { token: i2.Platform }], target: i0.ɵɵFactoryTarget.Injectable }); }
3806
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.10", ngImport: i0, type: NetworkService, deps: [{ token: i1$3.Network }, { token: i1$1.Platform }], target: i0.ɵɵFactoryTarget.Injectable }); }
3806
3807
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.10", ngImport: i0, type: NetworkService, providedIn: 'root' }); }
3807
3808
  }
3808
3809
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.10", ngImport: i0, type: NetworkService, decorators: [{
@@ -3810,7 +3811,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.10", ngImpo
3810
3811
  args: [{
3811
3812
  providedIn: 'root'
3812
3813
  }]
3813
- }], ctorParameters: () => [{ type: i1$3.Network }, { type: i2.Platform }] });
3814
+ }], ctorParameters: () => [{ type: i1$3.Network }, { type: i1$1.Platform }] });
3814
3815
 
3815
3816
  class LoadingService {
3816
3817
  constructor() {
@@ -3868,7 +3869,7 @@ class LoggingService {
3868
3869
  }
3869
3870
  return;
3870
3871
  }
3871
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.10", ngImport: i0, type: LoggingService, deps: [{ token: i2.Platform }], target: i0.ɵɵFactoryTarget.Injectable }); }
3872
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.10", ngImport: i0, type: LoggingService, deps: [{ token: i1$1.Platform }], target: i0.ɵɵFactoryTarget.Injectable }); }
3872
3873
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.10", ngImport: i0, type: LoggingService, providedIn: 'root' }); }
3873
3874
  }
3874
3875
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.10", ngImport: i0, type: LoggingService, decorators: [{
@@ -3876,7 +3877,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.10", ngImpo
3876
3877
  args: [{
3877
3878
  providedIn: 'root'
3878
3879
  }]
3879
- }], ctorParameters: () => [{ type: i2.Platform }] });
3880
+ }], ctorParameters: () => [{ type: i1$1.Platform }] });
3880
3881
 
3881
3882
  class ErrorService {
3882
3883
  constructor() { }
@@ -4000,7 +4001,7 @@ class AnalyticsService {
4000
4001
  };
4001
4002
  return setCollectionEnabled;
4002
4003
  }
4003
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.10", ngImport: i0, type: AnalyticsService, deps: [{ token: FIREBASE_CONFIG_TOKEN }, { token: i2.Platform }], target: i0.ɵɵFactoryTarget.Injectable }); }
4004
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.10", ngImport: i0, type: AnalyticsService, deps: [{ token: FIREBASE_CONFIG_TOKEN }, { token: i1$1.Platform }], target: i0.ɵɵFactoryTarget.Injectable }); }
4004
4005
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.10", ngImport: i0, type: AnalyticsService, providedIn: 'root' }); }
4005
4006
  }
4006
4007
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.10", ngImport: i0, type: AnalyticsService, decorators: [{
@@ -4011,7 +4012,437 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.10", ngImpo
4011
4012
  }], ctorParameters: () => [{ type: undefined, decorators: [{
4012
4013
  type: Inject,
4013
4014
  args: [FIREBASE_CONFIG_TOKEN]
4014
- }] }, { type: i2.Platform }] });
4015
+ }] }, { type: i1$1.Platform }] });
4016
+
4017
+ const NAME_BIND$3 = 'App\\Events\\ScreenMessage';
4018
+ class PusherAlarmService {
4019
+ constructor(notification) {
4020
+ this.notification = notification;
4021
+ }
4022
+ subscribeChannel(pusherService, idUser) {
4023
+ this.idUser = idUser;
4024
+ console.log('[PusherAlarmService] idUser()', this.idUser);
4025
+ this.nameChanel = 'private-ScreenMessage.User.' + this.idUser;
4026
+ this.pusher = pusherService;
4027
+ this.channel = this.pusher.subscribe(this.nameChanel);
4028
+ console.log('[PusherAlarmService] subscribeChannel()', this.channel);
4029
+ }
4030
+ init() {
4031
+ this.channel?.bind(NAME_BIND$3, (data) => {
4032
+ console.log('[PusherAlarmService] getPusherAlarm()', data);
4033
+ if (data?.message)
4034
+ this.notification.confirmAllNotification(data?.message);
4035
+ });
4036
+ }
4037
+ unsubscribeChannel(pusherService) {
4038
+ console.log('[PusherAlarmService] subscribeChannel()', this.channel);
4039
+ }
4040
+ unsubscribePusher() {
4041
+ this.channel = this.pusher.unsubscribe(this.nameChanel);
4042
+ }
4043
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.10", ngImport: i0, type: PusherAlarmService, deps: [{ token: NotificationService }], target: i0.ɵɵFactoryTarget.Injectable }); }
4044
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.10", ngImport: i0, type: PusherAlarmService, providedIn: 'root' }); }
4045
+ }
4046
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.10", ngImport: i0, type: PusherAlarmService, decorators: [{
4047
+ type: Injectable,
4048
+ args: [{
4049
+ providedIn: 'root'
4050
+ }]
4051
+ }], ctorParameters: () => [{ type: NotificationService }] });
4052
+
4053
+ const NAME_BIND$2 = 'App\\Events\\LevelAccomplishmentCompleted';
4054
+ class PusherChallengeNotificationsService {
4055
+ constructor(alertController, translate) {
4056
+ this.alertController = alertController;
4057
+ this.translate = translate;
4058
+ this.handlerMessage = '';
4059
+ this.roleMessage = '';
4060
+ this.isModalShowing = false;
4061
+ }
4062
+ subscribeChannel(pusherService, idUser) {
4063
+ this.idUser = idUser;
4064
+ this.nameChanel = 'private-LevelAccomplishmentCompleted.' + this.idUser;
4065
+ console.log('[PusherChallengeNotificationsService] this.nameChanel()', this.nameChanel);
4066
+ this.pusher = pusherService;
4067
+ this.channel = this.pusher.subscribe(this.nameChanel);
4068
+ console.log('[PusherChallengeNotificationsService] subscribeChannel()', this.channel);
4069
+ }
4070
+ unsubscribePusher() {
4071
+ this.channel = this.pusher?.unsubscribe(this.nameChanel);
4072
+ }
4073
+ init() {
4074
+ console.log('[PusherChallengeNotificationsService] init()');
4075
+ this.channel?.bind(NAME_BIND$2, (data) => {
4076
+ console.log('[PusherChallengeNotificationsService] getPusher()', data);
4077
+ if (!this.isModalShowing) {
4078
+ this.presentChallengeNotification(data);
4079
+ }
4080
+ else {
4081
+ this.pendingNotification = { show: true, data: data };
4082
+ }
4083
+ });
4084
+ }
4085
+ // async presentChallengeNotification() {
4086
+ // let message = '';
4087
+ // message = `<div class="pyro">
4088
+ // <div class="before"></div>
4089
+ // <ion-row><ion-col class="text-align-center"><img src="assets/images/duly_champ.gif" class="card-alert"></img><ion-text>`+ this.translate.instant('health_path.level_accomplished') + `</ion-text></ion-col></ion-row>
4090
+ // <div class="after"></div>
4091
+ // </div>`;
4092
+ // const alert = await this.alertController.create({
4093
+ // header: this.translate.instant('health_path.level_congratulations'),
4094
+ // cssClass: 'challenge-alert',
4095
+ // message: message,
4096
+ // buttons: [
4097
+ // {
4098
+ // text: this.translate.instant('info.button'),
4099
+ // role: 'confirm',
4100
+ // handler: () => {
4101
+ // this.handlerMessage = 'Alert confirmed';
4102
+ // },
4103
+ // },
4104
+ // ],
4105
+ // });
4106
+ // this.pendingNotification = { show: false, data: null };
4107
+ // await alert.present();
4108
+ // const { role } = await alert.onDidDismiss();
4109
+ // this.roleMessage = `Dismissed with role: ${role}`;
4110
+ // }
4111
+ async presentChallengeNotification(notification) {
4112
+ let message = '';
4113
+ let header = '';
4114
+ if (notification?.isChallengeCompleted) {
4115
+ message = `<div class="pyro">
4116
+ <div class="before"></div>
4117
+ <ion-row><ion-col class="text-align-center"><img src="assets/images/trofeo.png" class="card-alert"></img></ion-col></ion-row>
4118
+ <div class="after"></div>
4119
+ </div>`;
4120
+ header = this.translate.instant('health_path.congratulation');
4121
+ }
4122
+ else {
4123
+ message = `<div class="pyro">
4124
+ <div class="before"></div>
4125
+ <ion-row><ion-col class="text-align-center"><img src="assets/images/duly_champ.gif" class="card-alert"></img></ion-col></ion-row>
4126
+ <div class="after"></div>
4127
+ </div>`;
4128
+ let name_level = notification?.levelDetail?.name ? notification?.levelDetail?.name : '';
4129
+ header = this.translate.instant('health_path.congratulation_level') + ' ' + name_level;
4130
+ }
4131
+ const alert = await this.alertController.create({
4132
+ header: header,
4133
+ cssClass: 'challenge-alert',
4134
+ message: message,
4135
+ buttons: [
4136
+ {
4137
+ text: this.translate.instant('info.button'),
4138
+ role: 'confirm',
4139
+ handler: () => {
4140
+ this.handlerMessage = 'Alert confirmed';
4141
+ },
4142
+ },
4143
+ ],
4144
+ });
4145
+ await alert.present();
4146
+ const { role } = await alert.onDidDismiss();
4147
+ this.roleMessage = `Dismissed with role: ${role}`;
4148
+ }
4149
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.10", ngImport: i0, type: PusherChallengeNotificationsService, deps: [{ token: i1$1.AlertController }, { token: i2$2.TranslateService }], target: i0.ɵɵFactoryTarget.Injectable }); }
4150
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.10", ngImport: i0, type: PusherChallengeNotificationsService, providedIn: 'root' }); }
4151
+ }
4152
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.10", ngImport: i0, type: PusherChallengeNotificationsService, decorators: [{
4153
+ type: Injectable,
4154
+ args: [{
4155
+ providedIn: 'root'
4156
+ }]
4157
+ }], ctorParameters: () => [{ type: i1$1.AlertController }, { type: i2$2.TranslateService }] });
4158
+
4159
+ const NAME_BIND$1 = 'Illuminate\\Notifications\\Events\\BroadcastNotificationCreated';
4160
+ class PusherNotificationService {
4161
+ constructor(alertController, authService, translate, router, modalCtrl, pusherChallenge, _zone) {
4162
+ this.alertController = alertController;
4163
+ this.authService = authService;
4164
+ this.translate = translate;
4165
+ this.router = router;
4166
+ this.modalCtrl = modalCtrl;
4167
+ this.pusherChallenge = pusherChallenge;
4168
+ this._zone = _zone;
4169
+ this.NAME_BIND = 'Illuminate\\Notifications\\Events\\BroadcastNotificationCreated';
4170
+ this.handlerMessage = '';
4171
+ this.roleMessage = '';
4172
+ }
4173
+ subscribeChannel(pusherService, idUser) {
4174
+ this.idUser = idUser;
4175
+ this.nameChanel = 'private-App.User.' + this.idUser;
4176
+ console.log('[PusherNotificationService] this.nameChanel ()', this.nameChanel);
4177
+ this.pusher = pusherService;
4178
+ this.channel = this.pusher.subscribe(this.nameChanel);
4179
+ console.log('[PusherNotificationService] subscribeChannel()', this.channel);
4180
+ }
4181
+ unsubscribePusher() {
4182
+ this.channel = this.pusher?.unsubscribe(this.nameChanel);
4183
+ }
4184
+ init() {
4185
+ return this.channel;
4186
+ }
4187
+ // public init2(){
4188
+ // this.channel?.bind(NAME_BIND, (data) => {
4189
+ // console.log('[PusherNotificationService] getPusher()', data);
4190
+ // this.presentPromoteNotification(data);
4191
+ // });
4192
+ // }
4193
+ async presentPromoteNotification(data) {
4194
+ let [message, component] = this.getNotificationMessage(data);
4195
+ if (message) {
4196
+ message = `<ion-row><ion-col class="text-align-center"><img src="assets/images/duly_reading.gif" class="card-alert"></img><ion-text>` + message + `</ion-text></ion-col></ion-row>`;
4197
+ const alert = await this.alertController.create({
4198
+ cssClass: 'challenge-alert',
4199
+ message: message,
4200
+ buttons: [
4201
+ {
4202
+ text: this.translate.instant('alert.button_not_now'),
4203
+ role: 'cancel',
4204
+ handler: () => {
4205
+ this.handlerMessage = 'Alert canceled';
4206
+ },
4207
+ },
4208
+ {
4209
+ text: this.translate.instant('alert.button_ok'),
4210
+ role: 'confirm',
4211
+ handler: () => {
4212
+ this.openModal(data, component);
4213
+ },
4214
+ }
4215
+ ],
4216
+ });
4217
+ await alert.present();
4218
+ const { role } = await alert.onDidDismiss();
4219
+ this.roleMessage = `Dismissed with role: ${role}`;
4220
+ }
4221
+ else
4222
+ console.error("Notification type not found");
4223
+ }
4224
+ getNotificationMessage(data) {
4225
+ let message = '';
4226
+ let component = null;
4227
+ switch (data?.type) {
4228
+ case "App\\Notifications\\AdviceCreated":
4229
+ message = this.translate.instant('health_path.advice') + '<b>' + data?.advice?.name + '</b>';
4230
+ //component = AdvicesDetailPage;
4231
+ break;
4232
+ case "App\\Notifications\\NewsNotification":
4233
+ message = this.translate.instant('health_path.news') + '<b>' + data?.news?.name + '</b>';
4234
+ //component = NewDetailPage;
4235
+ break;
4236
+ case "App\\Notifications\\DietCreated":
4237
+ message = this.translate.instant('health_path.diet') + '<b>' + data?.diet?.name + '</b>';
4238
+ //component = DietsDetailPage;
4239
+ //TODO
4240
+ break;
4241
+ case "App\\Notifications\\GameCreated":
4242
+ message = this.translate.instant('health_path.game') + '<b>' + data?.game?.name + '</b>';
4243
+ break;
4244
+ default:
4245
+ break;
4246
+ }
4247
+ return [message, component];
4248
+ }
4249
+ async openModal(data, pageComponent) {
4250
+ console.log('model component:', pageComponent);
4251
+ const modal = await this.modalCtrl.create({
4252
+ component: pageComponent,
4253
+ componentProps: { id: data?.model_id },
4254
+ cssClass: "modal-custom-class"
4255
+ });
4256
+ await modal.present();
4257
+ }
4258
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.10", ngImport: i0, type: PusherNotificationService, deps: [{ token: i1$1.AlertController }, { token: AuthenticationService }, { token: i2$2.TranslateService }, { token: i4.Router }, { token: i1$1.ModalController }, { token: PusherChallengeNotificationsService }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Injectable }); }
4259
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.10", ngImport: i0, type: PusherNotificationService, providedIn: 'root' }); }
4260
+ }
4261
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.10", ngImport: i0, type: PusherNotificationService, decorators: [{
4262
+ type: Injectable,
4263
+ args: [{
4264
+ providedIn: 'root'
4265
+ }]
4266
+ }], ctorParameters: () => [{ type: i1$1.AlertController }, { type: AuthenticationService }, { type: i2$2.TranslateService }, { type: i4.Router }, { type: i1$1.ModalController }, { type: PusherChallengeNotificationsService }, { type: i0.NgZone }] });
4267
+
4268
+ class PusherConnectionService {
4269
+ constructor(endpoints, pusherNotification, pusherAlarm, pusherChallenge) {
4270
+ this.endpoints = endpoints;
4271
+ this.pusherNotification = pusherNotification;
4272
+ this.pusherAlarm = pusherAlarm;
4273
+ this.pusherChallenge = pusherChallenge;
4274
+ }
4275
+ subscribePusher(token, idUser) {
4276
+ this.setPusher(token);
4277
+ //Subscribo todos los pusher excepto los de mensajería
4278
+ //porque se requiere el id del canal de mensajería y no el id del usuario
4279
+ this.pusherNotification.subscribeChannel(this.pusher, idUser);
4280
+ this.pusherAlarm.subscribeChannel(this.pusher, idUser);
4281
+ this.pusherChallenge.subscribeChannel(this.pusher, idUser);
4282
+ }
4283
+ setPusher(token) {
4284
+ let params = this.endpoints._ENVIROMENT.pusher_key;
4285
+ this.pusher = new Pusher(params.key, {
4286
+ cluster: params.cluster,
4287
+ authEndpoint: this.endpoints.API_ENDPOINT + '/broadcasting/auth',
4288
+ auth: {
4289
+ headers: {
4290
+ Authorization: `Bearer ${token}`
4291
+ }
4292
+ },
4293
+ encrypted: true,
4294
+ });
4295
+ console.log('[PusherConnectionService] setPusher()', this.pusher);
4296
+ }
4297
+ /**
4298
+ * setChannel
4299
+ */
4300
+ setChannel(nameChanel) {
4301
+ return this.pusher.subscribe(nameChanel);
4302
+ }
4303
+ // public unsubscribePusher(){
4304
+ // this.pusherAlarm.unsubscribePusher()
4305
+ // this.pusherNotification.unsubscribePusher()
4306
+ // this.pusher?.disconnect();
4307
+ // }
4308
+ isConnectedPusher() {
4309
+ console.log('[PusherConnectionService] isConnectedPusher()', this.pusher);
4310
+ if (this.pusher?.connection?.state === "connected")
4311
+ return true;
4312
+ return false;
4313
+ }
4314
+ isNullPusher() {
4315
+ if (this.pusher)
4316
+ return false;
4317
+ return true;
4318
+ }
4319
+ unsubscribePusher() {
4320
+ this.pusher?.unsubscribe(this.pusherAlarm.nameChanel);
4321
+ this.pusher?.unsubscribe(this.pusherNotification.nameChanel);
4322
+ this.pusher?.unsubscribe(this.pusherChallenge.nameChanel);
4323
+ this.pusher?.disconnect();
4324
+ }
4325
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.10", ngImport: i0, type: PusherConnectionService, deps: [{ token: ChangeEndpointsService }, { token: PusherNotificationService }, { token: PusherAlarmService }, { token: PusherChallengeNotificationsService }], target: i0.ɵɵFactoryTarget.Injectable }); }
4326
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.10", ngImport: i0, type: PusherConnectionService, providedIn: 'root' }); }
4327
+ }
4328
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.10", ngImport: i0, type: PusherConnectionService, decorators: [{
4329
+ type: Injectable,
4330
+ args: [{
4331
+ providedIn: 'root'
4332
+ }]
4333
+ }], ctorParameters: () => [{ type: ChangeEndpointsService }, { type: PusherNotificationService }, { type: PusherAlarmService }, { type: PusherChallengeNotificationsService }] });
4334
+
4335
+ const NAME_BIND = 'App\\Events\\MessageCreated';
4336
+ class PusherMessageService {
4337
+ constructor(pusherConnection) {
4338
+ this.pusherConnection = pusherConnection;
4339
+ this.nameChanel = 'presence-MessageCreated.';
4340
+ }
4341
+ init(idChannel) {
4342
+ this.channel = this.pusherConnection.setChannel(this.nameChanel + idChannel);
4343
+ console.log('[PusherMessageService] init()', this.channel);
4344
+ return this.channel;
4345
+ }
4346
+ unsubscribePusher(idChannel) {
4347
+ this.channel.unsubscribe(this.nameChanel + idChannel);
4348
+ }
4349
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.10", ngImport: i0, type: PusherMessageService, deps: [{ token: PusherConnectionService }], target: i0.ɵɵFactoryTarget.Injectable }); }
4350
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.10", ngImport: i0, type: PusherMessageService, providedIn: 'root' }); }
4351
+ }
4352
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.10", ngImport: i0, type: PusherMessageService, decorators: [{
4353
+ type: Injectable,
4354
+ args: [{
4355
+ providedIn: 'root'
4356
+ }]
4357
+ }], ctorParameters: () => [{ type: PusherConnectionService }] });
4358
+
4359
+ // This file can be replaced during build by using the `fileReplacements` array.
4360
+ // `ng build --prod` replaces `environment.ts` with `environment.prod.ts`.
4361
+ // The list of file replacements can be found in `angular.json`.
4362
+ const environment = {
4363
+ production: false,
4364
+ appShellConfig: {
4365
+ debug: false,
4366
+ networkDelay: 500
4367
+ },
4368
+ firebase: {
4369
+ apiKey: "AIzaSyDqlLbR0uBI7JM6XgCxL0vbLO8Mv1zfFrc",
4370
+ authDomain: "deneb-65a05.firebaseapp.com",
4371
+ databaseURL: "https://deneb-65a05-default-rtdb.firebaseio.com",
4372
+ projectId: "deneb-65a05",
4373
+ storageBucket: "deneb-65a05.appspot.com",
4374
+ messagingSenderId: "429887824166",
4375
+ appId: "1:429887824166:web:8ae6abb69c876697d121e7",
4376
+ measurementId: "G-QQ3CM8YL1S"
4377
+ }
4378
+ };
4379
+
4380
+ class ShellModel {
4381
+ constructor() {
4382
+ this.isShell = false;
4383
+ }
4384
+ }
4385
+ class DataStore {
4386
+ constructor(shellModel) {
4387
+ this.shellModel = shellModel;
4388
+ // We wait on purpose 2 secs on local environment when fetching from json to simulate the backend roundtrip.
4389
+ // However, in production you should set this delay to 0 in the environment.prod file.
4390
+ // tslint:disable-next-line:max-line-length
4391
+ this.networkDelay = (environment.appShellConfig && environment.appShellConfig.networkDelay) ? environment.appShellConfig.networkDelay : 0;
4392
+ this.timeline = new ReplaySubject(1);
4393
+ }
4394
+ // Static function with generics
4395
+ // (ref: https://stackoverflow.com/a/24293088/1116959)
4396
+ // Append a shell (T & ShellModel) to every value (T) emmited to the timeline
4397
+ static AppendShell(dataObservable, shellModel, networkDelay = 400) {
4398
+ const delayObservable = of(true).pipe(delay(networkDelay));
4399
+ // Assign shell flag accordingly
4400
+ // (ref: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign)
4401
+ return combineLatest([
4402
+ delayObservable,
4403
+ dataObservable
4404
+ ]).pipe(
4405
+ // Dismiss unnecessary delayValue
4406
+ map(([delayValue, dataValue]) => Object.assign(dataValue, { isShell: false })),
4407
+ // Set the shell model as the initial value
4408
+ startWith(Object.assign(shellModel, { isShell: true })));
4409
+ }
4410
+ load(dataSourceObservable, networkDelay) {
4411
+ // tslint:disable-next-line:no-shadowed-variable
4412
+ const delay = (typeof networkDelay === 'number') ? networkDelay : this.networkDelay;
4413
+ let processedDataSource;
4414
+ // If no network delay, then don't show shell
4415
+ if (delay === 0) {
4416
+ processedDataSource = dataSourceObservable;
4417
+ }
4418
+ else {
4419
+ processedDataSource = DataStore.AppendShell(dataSourceObservable, this.shellModel, delay);
4420
+ }
4421
+ processedDataSource
4422
+ .subscribe((dataValue) => {
4423
+ this.timeline.next(dataValue);
4424
+ });
4425
+ }
4426
+ get state() {
4427
+ return this.timeline.asObservable();
4428
+ }
4429
+ }
4430
+
4431
+ class ShellRecipientModel extends ShellModel {
4432
+ constructor() {
4433
+ super();
4434
+ }
4435
+ }
4436
+ class ShellMessageModel extends ShellModel {
4437
+ constructor() {
4438
+ super();
4439
+ }
4440
+ }
4441
+ class ShellChatModel extends ShellModel {
4442
+ constructor() {
4443
+ super();
4444
+ }
4445
+ }
4015
4446
 
4016
4447
  /*
4017
4448
  * Public API Surface of service-lib
@@ -4021,5 +4452,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.10", ngImpo
4021
4452
  * Generated bundle index. Do not edit.
4022
4453
  */
4023
4454
 
4024
- export { AnalyticsService, ApiEndpointsService, AuthenticationService, ChangeEndpointsService, ComponentsApp, DateService, DooleService, EncryptionService, ErrorService, Events, HighchartsService, HttpService, LanguageService, LoadingService, LoggingService, NavigationService, NetworkService, NotificationService, OpentokService, RolesService, ServiceLibComponent, ServiceLibModule, StorageService, TokenService, User, _INDEX_ENPOINT };
4455
+ export { AnalyticsService, ApiEndpointsService, AuthenticationService, ChangeEndpointsService, ComponentsApp, DataStore, DateService, DooleService, EncryptionService, ErrorService, Events, HighchartsService, HttpService, LanguageService, LoadingService, LoggingService, NavigationService, NetworkService, NotificationService, OpentokService, PusherAlarmService, PusherChallengeNotificationsService, PusherConnectionService, PusherMessageService, PusherNotificationService, RolesService, ServiceLibComponent, ServiceLibModule, ShellChatModel, ShellMessageModel, ShellModel, ShellRecipientModel, StorageService, TokenService, User, _INDEX_ENPOINT };
4025
4456
  //# sourceMappingURL=doolehealth-service-lib.mjs.map