monkey-front-core 0.0.562 → 0.0.564

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.
@@ -7,6 +7,7 @@ import { CommonModule, formatNumber, CurrencyPipe, DatePipe, registerLocaleData
7
7
  import * as i1$1 from '@ngx-translate/core';
8
8
  import { TranslateModule, TranslateService } from '@ngx-translate/core';
9
9
  import * as moment_ from 'moment';
10
+ import { datadogLogs } from '@datadog/browser-logs';
10
11
  import { map, catchError, filter, takeWhile, take, first, takeUntil, mergeMap, finalize } from 'rxjs/operators';
11
12
  import { throwError, BehaviorSubject, Subscription, interval, concat, Subject, of, from } from 'rxjs';
12
13
  import * as i1$2 from '@angular/common/http';
@@ -25,7 +26,6 @@ import { __decorate } from 'tslib';
25
26
  import esCL from '@angular/common/locales/es-CL';
26
27
  import esMX from '@angular/common/locales/es-MX';
27
28
  import ptBr from '@angular/common/locales/pt';
28
- import { datadogLogs } from '@datadog/browser-logs';
29
29
  import { datadogRum } from '@datadog/browser-rum';
30
30
  import * as i1$4 from '@angular/service-worker';
31
31
  import { ServiceWorkerModule } from '@angular/service-worker';
@@ -400,6 +400,7 @@ class MonkeyEcxUtils {
400
400
  const month = dateStr.slice(2, 4);
401
401
  const day = dateStr.slice(4, 6);
402
402
  const date = new Date(`20${year}-${month}-${day}`);
403
+ // eslint-disable-next-line no-restricted-globals
403
404
  return !isNaN(date.getTime());
404
405
  };
405
406
  const validateVerificationDigit = (doc) => {
@@ -567,6 +568,23 @@ class MonkeyEcxUtils {
567
568
  return ret;
568
569
  }
569
570
  }
571
+ class MonkeyEcxLogParams {
572
+ constructor() {
573
+ this.message = '';
574
+ this.type = 'error';
575
+ }
576
+ }
577
+ class MonkeyEcxLogs {
578
+ static log(params) {
579
+ try {
580
+ const { type, message, context, error } = params;
581
+ datadogLogs.logger[type](message, context, error);
582
+ }
583
+ catch (e) {
584
+ // not to do
585
+ }
586
+ }
587
+ }
570
588
  function bufferToBase64(buffer) {
571
589
  let binary = '';
572
590
  const bytes = new Uint8Array(buffer);
@@ -3927,18 +3945,20 @@ class MonkeyEcxLogsConfigService {
3927
3945
  defaultPrivacyLevel: 'mask-user-input'
3928
3946
  });
3929
3947
  datadogRum.startSessionReplayRecording();
3930
- datadogLogs.init({
3931
- clientToken: environment?.dataDogClientToken,
3932
- service: program?.token,
3933
- site: 'datadoghq.com',
3934
- env: `monkey-front-${identifyCode}-${environment.environment}`,
3935
- version: configBootstrap?.version,
3936
- trackSessionAcrossSubdomains: true,
3937
- useSecureSessionCookie: true,
3938
- forwardErrorsToLogs: true,
3939
- sessionSampleRate: 100,
3940
- forwardConsoleLogs: 'all'
3941
- });
3948
+ if (environment.dataDogBrowserLogsEnable) {
3949
+ datadogLogs.init({
3950
+ clientToken: environment?.dataDogClientToken,
3951
+ service: program?.token,
3952
+ site: 'datadoghq.com',
3953
+ env: `monkey-front-${identifyCode}-${environment.environment}`,
3954
+ version: configBootstrap?.version,
3955
+ trackSessionAcrossSubdomains: true,
3956
+ useSecureSessionCookie: true,
3957
+ forwardErrorsToLogs: true,
3958
+ sessionSampleRate: 100,
3959
+ forwardConsoleLogs: 'all'
3960
+ });
3961
+ }
3942
3962
  this.allSet = true;
3943
3963
  }
3944
3964
  this.applyInfoToDataDog(environment);