@doolehealth/service-lib 0.0.7 → 0.0.8

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,6 +1,6 @@
1
1
  import * as i0 from '@angular/core';
2
2
  import { Component, InjectionToken, NgModule, Inject, Injectable, PLATFORM_ID, ViewChild } from '@angular/core';
3
- import * as i2$2 from '@angular/common';
3
+ import * as i2$3 from '@angular/common';
4
4
  import { CommonModule, DatePipe, isPlatformBrowser } from '@angular/common';
5
5
  import { BehaviorSubject, Subject, Observable, throwError, of, TimeoutError, merge, fromEvent, map as map$1, ReplaySubject, combineLatest, from } from 'rxjs';
6
6
  import { Preferences } from '@capacitor/preferences';
@@ -9,7 +9,7 @@ import * as i1 from '@angular/common/http';
9
9
  import { HttpErrorResponse, HttpClient, HttpParams, HttpHeaders } from '@angular/common/http';
10
10
  import * as i6 from '@angular/router';
11
11
  import { RouterOutlet, NavigationEnd } from '@angular/router';
12
- import * as i9 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';
@@ -2531,6 +2531,14 @@ class DooleService {
2531
2531
  return res;
2532
2532
  }));
2533
2533
  }
2534
+ postCompletedExercice(params) {
2535
+ let path = `v1/patient/programable-plays/end`;
2536
+ const endpoint = this.api.getEndpoint(path);
2537
+ return this.http.post(endpoint, params).pipe(map((res) => {
2538
+ //console.log(`[DooleService] postAPIdrugIntake(${path}) res: `, res);
2539
+ return res;
2540
+ }));
2541
+ }
2534
2542
  getAPIChallenges(params) {
2535
2543
  let path = 'user/challenges';
2536
2544
  let httpParams = new HttpParams();
@@ -2615,7 +2623,7 @@ class DooleService {
2615
2623
  return res;
2616
2624
  }));
2617
2625
  }
2618
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", 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 }, { token: i9.TranslateService }], target: i0.ɵɵFactoryTarget.Injectable }); }
2626
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", 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 }, { token: i2$2.TranslateService }], target: i0.ɵɵFactoryTarget.Injectable }); }
2619
2627
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: DooleService, providedIn: 'root' }); }
2620
2628
  }
2621
2629
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: DooleService, decorators: [{
@@ -2623,7 +2631,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImpo
2623
2631
  args: [{
2624
2632
  providedIn: 'root'
2625
2633
  }]
2626
- }], 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 }, { type: i9.TranslateService }] });
2634
+ }], 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 }, { type: i2$2.TranslateService }] });
2627
2635
 
2628
2636
  var NotificationsType;
2629
2637
  (function (NotificationsType) {
@@ -3077,6 +3085,7 @@ class NavigationService {
3077
3085
  this.back();
3078
3086
  }
3079
3087
  redirecPushNotification(data, notification) {
3088
+ //console.log("ADVICES LOG: " + JSON.stringify(data))
3080
3089
  // //console.log("DATA " + data)
3081
3090
  // //console.log("Notification " + notification)
3082
3091
  switch (data.action) {
@@ -3101,8 +3110,9 @@ class NavigationService {
3101
3110
  });
3102
3111
  break;
3103
3112
  case "EXERCISE":
3113
+ let programablePlayId = data?.programable_play_id;
3104
3114
  this._zone.run(() => {
3105
- this.router.navigate([ContentTypePath.ExercisesDetail], { state: { data: data, id: data.id, programable_id: data.programable_play_id } });
3115
+ this.router.navigate([ContentTypePath.ExercisesDetail], { state: { data: data, id: data.id, programable_id: data?.id, programable_play: programablePlayId } });
3106
3116
  });
3107
3117
  break;
3108
3118
  case "FORM":
@@ -3131,7 +3141,7 @@ class NavigationService {
3131
3141
  staff = data?.origin;
3132
3142
  else
3133
3143
  staff = data?.origin ? JSON.parse(data?.origin) : null;
3134
- ////console.log('staff: ', staff);
3144
+ //console.log('staff: ', staff);
3135
3145
  this._zone.run(() => {
3136
3146
  this.router.navigate([ContentTypePath.Message], { state: { data: data, chat: data.id, staff: staff, customData: data?.user_id } });
3137
3147
  });
@@ -3162,7 +3172,7 @@ class NavigationService {
3162
3172
  break;
3163
3173
  }
3164
3174
  }
3165
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: NavigationService, deps: [{ token: i6.Router }, { token: i2$2.Location }, { token: i0.NgZone }, { token: i2.Platform }], target: i0.ɵɵFactoryTarget.Injectable }); }
3175
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: NavigationService, deps: [{ token: i6.Router }, { token: i2$3.Location }, { token: i0.NgZone }, { token: i2.Platform }], target: i0.ɵɵFactoryTarget.Injectable }); }
3166
3176
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: NavigationService, providedIn: 'root' }); }
3167
3177
  }
3168
3178
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: NavigationService, decorators: [{
@@ -3170,7 +3180,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImpo
3170
3180
  args: [{
3171
3181
  providedIn: 'root'
3172
3182
  }]
3173
- }], ctorParameters: () => [{ type: i6.Router }, { type: i2$2.Location }, { type: i0.NgZone }, { type: i2.Platform }] });
3183
+ }], ctorParameters: () => [{ type: i6.Router }, { type: i2$3.Location }, { type: i0.NgZone }, { type: i2.Platform }] });
3174
3184
 
3175
3185
  class LanguageService {
3176
3186
  constructor(translate, languagesApp) {
@@ -3203,7 +3213,7 @@ class LanguageService {
3203
3213
  removeLenguageLocalstorage() {
3204
3214
  localStorage.removeItem('language');
3205
3215
  }
3206
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: LanguageService, deps: [{ token: i9.TranslateService }, { token: LANGUAGES_CONFIG_TOKEN }], target: i0.ɵɵFactoryTarget.Injectable }); }
3216
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: LanguageService, deps: [{ token: i2$2.TranslateService }, { token: LANGUAGES_CONFIG_TOKEN }], target: i0.ɵɵFactoryTarget.Injectable }); }
3207
3217
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: LanguageService, providedIn: 'root' }); }
3208
3218
  }
3209
3219
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: LanguageService, decorators: [{
@@ -3211,7 +3221,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImpo
3211
3221
  args: [{
3212
3222
  providedIn: 'root'
3213
3223
  }]
3214
- }], ctorParameters: () => [{ type: i9.TranslateService }, { type: undefined, decorators: [{
3224
+ }], ctorParameters: () => [{ type: i2$2.TranslateService }, { type: undefined, decorators: [{
3215
3225
  type: Inject,
3216
3226
  args: [LANGUAGES_CONFIG_TOKEN]
3217
3227
  }] }] });
@@ -3264,7 +3274,7 @@ class DateService {
3264
3274
  formatSelectedDate(date) {
3265
3275
  if (date) {
3266
3276
  let day = this.transformDate(date, this.getformatSelectedDate());
3267
- ////console.log("selected Day", day);
3277
+ //console.log("selected Day", day);
3268
3278
  return day[0].toUpperCase() + day.slice(1);
3269
3279
  }
3270
3280
  return null;
@@ -3502,13 +3512,36 @@ class DateService {
3502
3512
  return null;
3503
3513
  }
3504
3514
  getDateMonDay(date) {
3515
+ let lang = this.translate.currentLang;
3505
3516
  let format = 'MMM d';
3506
3517
  if (date) {
3507
3518
  date = new Date(date);
3508
- return this.transformDate(date, format);
3519
+ return this.transformDate(date, format, lang);
3509
3520
  }
3510
3521
  return null;
3511
3522
  }
3523
+ convertLocalizedDateToEnglish(dateString) {
3524
+ // Mapea los meses abreviados en portugués a sus equivalentes en inglés
3525
+ const monthsMap = {
3526
+ // Meses en español
3527
+ 'ene': 'Jan', 'feb': 'Feb', 'mar': 'Mar', 'abr': 'Apr',
3528
+ 'may': 'May', 'jun': 'Jun', 'jul': 'Jul', 'ago': 'Aug',
3529
+ 'sep': 'Sep', 'oct': 'Oct', 'nov': 'Nov', 'dic': 'Dec',
3530
+ // Meses en portugués
3531
+ 'jan.': 'Jan', 'fev.': 'Feb', 'mar.': 'Mar', 'abr.': 'Apr',
3532
+ 'mai.': 'May', 'jun.': 'Jun', 'jul.': 'Jul', 'ago.': 'Aug',
3533
+ 'set.': 'Sep', 'out.': 'Oct', 'nov.': 'Nov', 'dez.': 'Dec'
3534
+ };
3535
+ // Busca y reemplaza el mes en portugués o español por el equivalente en inglés
3536
+ for (const [localizedMonth, enMonth] of Object.entries(monthsMap)) {
3537
+ if (dateString.includes(localizedMonth)) {
3538
+ dateString = dateString.replace(localizedMonth, enMonth);
3539
+ break;
3540
+ }
3541
+ }
3542
+ // Devuelve el string en un formato válido para el constructor de Date
3543
+ return dateString;
3544
+ }
3512
3545
  transformDateyyyyMMdd(date) {
3513
3546
  return this.datePipe.transform(date, 'yyyy-MM-dd');
3514
3547
  }
@@ -3616,8 +3649,8 @@ class DateService {
3616
3649
  return true;
3617
3650
  return false;
3618
3651
  }
3619
- transformDate(date, format) {
3620
- const datePipe = new DatePipe(this.getLocale());
3652
+ transformDate(date, format, locale) {
3653
+ const datePipe = new DatePipe(locale || this.getLocale()); // Usa locale si se pasa, o por defecto a getLocale()
3621
3654
  return datePipe.transform(date, format);
3622
3655
  }
3623
3656
  getCalendarDay(epoch) {
@@ -3656,13 +3689,13 @@ class DateService {
3656
3689
  return null;
3657
3690
  }
3658
3691
  let timeString = this.getTimeFormat();
3659
- let dateString = this.getLongFormat();
3660
3692
  let lang = this.translate.currentLang;
3661
3693
  const today = this.translate.instant('agenda.today');
3662
3694
  const yesterday = this.translate.instant('agenda.yesterday');
3663
3695
  const to = this.translate.instant('agenda.to');
3664
3696
  const m = moment;
3665
3697
  m.locale(lang);
3698
+ const dateString = 'MMM, ddd DD YYYY';
3666
3699
  return m(epoch).calendar(null, {
3667
3700
  sameDay: `[${today}] ` + `[${to}] ` + timeString,
3668
3701
  lastDay: `[${yesterday}] ` + `[${to}] ` + timeString,
@@ -3687,7 +3720,33 @@ class DateService {
3687
3720
  let date = localISOTime; // this.dateService.selectedDateFormat(localISOTime);
3688
3721
  return new Date(Date.now() - tzoffset).getTime().toLocaleString();
3689
3722
  }
3690
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: DateService, deps: [{ token: i2$2.DatePipe }, { token: i9.TranslateService }], target: i0.ɵɵFactoryTarget.Injectable }); }
3723
+ yyyyMMddHHmm1(date) {
3724
+ if (date) {
3725
+ let day = this.transformDate(date, 'yyyy-MM-dd HH:mm');
3726
+ //console.log("selected Day", day);
3727
+ return day[0].toUpperCase() + day.slice(1);
3728
+ }
3729
+ return null;
3730
+ }
3731
+ yyyyMMddHHmmss(date) {
3732
+ if (date) {
3733
+ let day = this.transformDate(date, 'yyyy-MM-dd HH:mm:ss');
3734
+ //console.log("selected Day", day);
3735
+ return day[0].toUpperCase() + day.slice(1);
3736
+ }
3737
+ return null;
3738
+ }
3739
+ formatDateHour(d) {
3740
+ var auxdate = d.split('T');
3741
+ let date = new Date(auxdate[0]);
3742
+ // d = d.replace(' ', 'T')
3743
+ // let date0 = new Date(d).toISOString();
3744
+ // let date = new Date(date0);
3745
+ date.setHours(23);
3746
+ date.setMinutes(59);
3747
+ return date;
3748
+ }
3749
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: DateService, deps: [{ token: i2$3.DatePipe }, { token: i2$2.TranslateService }], target: i0.ɵɵFactoryTarget.Injectable }); }
3691
3750
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: DateService, providedIn: 'root' }); }
3692
3751
  }
3693
3752
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: DateService, decorators: [{
@@ -3695,14 +3754,16 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImpo
3695
3754
  args: [{
3696
3755
  providedIn: 'root',
3697
3756
  }]
3698
- }], ctorParameters: () => [{ type: i2$2.DatePipe }, { type: i9.TranslateService }] });
3757
+ }], ctorParameters: () => [{ type: i2$3.DatePipe }, { type: i2$2.TranslateService }] });
3699
3758
 
3700
3759
  highchartsMore(HighCharts);
3701
3760
  class HighchartsService {
3702
- constructor(languageService) {
3761
+ constructor(languageService, translate) {
3703
3762
  this.languageService = languageService;
3763
+ this.translate = translate;
3704
3764
  this.weekdaysES = ['Domingo', 'Lunes', 'Martes', 'Miercoles', 'Jueves', 'Viernes', 'Sábado'];
3705
3765
  this.weekdaysCA = ['Diumenge', 'Dilluns', 'Dimarts', 'Dimecres', 'Dijous', 'Divendres', 'Dissabte'];
3766
+ this.weeksDay = [];
3706
3767
  this.graphData = [];
3707
3768
  this.series = [];
3708
3769
  this.withTooltip = false;
@@ -4271,7 +4332,7 @@ class HighchartsService {
4271
4332
  this.setYAxis(minY, maxY, ranges, units);
4272
4333
  this.setSeries(name, graphData, pointWidth);
4273
4334
  }
4274
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: HighchartsService, deps: [{ token: LanguageService }], target: i0.ɵɵFactoryTarget.Injectable }); }
4335
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: HighchartsService, deps: [{ token: LanguageService }, { token: i2$2.TranslateService }], target: i0.ɵɵFactoryTarget.Injectable }); }
4275
4336
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: HighchartsService, providedIn: 'root' }); }
4276
4337
  }
4277
4338
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: HighchartsService, decorators: [{
@@ -4279,7 +4340,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImpo
4279
4340
  args: [{
4280
4341
  providedIn: 'root'
4281
4342
  }]
4282
- }], ctorParameters: () => [{ type: LanguageService }] });
4343
+ }], ctorParameters: () => [{ type: LanguageService }, { type: i2$2.TranslateService }] });
4283
4344
 
4284
4345
  class ComponentsApp {
4285
4346
  constructor(goal, advices, news, agenda, reminder, diet, drug, game, element, form, chat, doc_diagnostic, contacta, medication) {
@@ -4458,7 +4519,7 @@ class NotificationService {
4458
4519
  });
4459
4520
  await alert.present();
4460
4521
  }
4461
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: NotificationService, deps: [{ token: i1$1.MatSnackBar }, { token: i0.NgZone }, { token: i2.AlertController }, { token: i9.TranslateService }, { token: i2.ToastController }], target: i0.ɵɵFactoryTarget.Injectable }); }
4522
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: NotificationService, deps: [{ token: i1$1.MatSnackBar }, { token: i0.NgZone }, { token: i2.AlertController }, { token: i2$2.TranslateService }, { token: i2.ToastController }], target: i0.ɵɵFactoryTarget.Injectable }); }
4462
4523
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: NotificationService, providedIn: 'root' }); }
4463
4524
  }
4464
4525
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: NotificationService, decorators: [{
@@ -4466,7 +4527,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImpo
4466
4527
  args: [{
4467
4528
  providedIn: 'root'
4468
4529
  }]
4469
- }], ctorParameters: () => [{ type: i1$1.MatSnackBar }, { type: i0.NgZone }, { type: i2.AlertController }, { type: i9.TranslateService }, { type: i2.ToastController }] });
4530
+ }], ctorParameters: () => [{ type: i1$1.MatSnackBar }, { type: i0.NgZone }, { type: i2.AlertController }, { type: i2$2.TranslateService }, { type: i2.ToastController }] });
4470
4531
 
4471
4532
  class NetworkService {
4472
4533
  constructor(network, platform) {
@@ -5087,7 +5148,7 @@ class HealthService {
5087
5148
  else
5088
5149
  return this.translate.instant("health-connect.error_msg");
5089
5150
  }
5090
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: HealthService, deps: [{ token: i1$3.Device }, { token: i2.Platform }, { token: DooleService }, { token: i6.Router }, { token: i9.TranslateService }, { token: LanguageService }, { token: CONFIGURACION_TOKEN }, { token: AuthenticationService }, { token: i2.AlertController }], target: i0.ɵɵFactoryTarget.Injectable }); }
5151
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: HealthService, deps: [{ token: i1$3.Device }, { token: i2.Platform }, { token: DooleService }, { token: i6.Router }, { token: i2$2.TranslateService }, { token: LanguageService }, { token: CONFIGURACION_TOKEN }, { token: AuthenticationService }, { token: i2.AlertController }], target: i0.ɵɵFactoryTarget.Injectable }); }
5091
5152
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: HealthService, providedIn: 'root' }); }
5092
5153
  }
5093
5154
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: HealthService, decorators: [{
@@ -5095,7 +5156,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImpo
5095
5156
  args: [{
5096
5157
  providedIn: 'root'
5097
5158
  }]
5098
- }], ctorParameters: () => [{ type: i1$3.Device }, { type: i2.Platform }, { type: DooleService }, { type: i6.Router }, { type: i9.TranslateService }, { type: LanguageService }, { type: undefined, decorators: [{
5159
+ }], ctorParameters: () => [{ type: i1$3.Device }, { type: i2.Platform }, { type: DooleService }, { type: i6.Router }, { type: i2$2.TranslateService }, { type: LanguageService }, { type: undefined, decorators: [{
5099
5160
  type: Inject,
5100
5161
  args: [CONFIGURACION_TOKEN]
5101
5162
  }] }, { type: AuthenticationService }, { type: i2.AlertController }] });