monkey-front-core 0.0.183 → 0.0.186

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.
@@ -2972,8 +2972,61 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImpor
2972
2972
  }]
2973
2973
  }], ctorParameters: function () { return []; } });
2974
2974
 
2975
+ /* eslint-disable prefer-rest-params */
2976
+ class MonkeyEcxGAConfigService {
2977
+ constructor(rt) {
2978
+ this.rt = rt;
2979
+ // not to do
2980
+ }
2981
+ apply(params, environment) {
2982
+ const { ga } = params;
2983
+ const { enabled, key } = ga || { enabled: false, key: '' };
2984
+ if (enabled && environment.environment !== 'dev') {
2985
+ const action = () => {
2986
+ window.dataLayer = window.dataLayer || [];
2987
+ window.gtag =
2988
+ window.gtag ||
2989
+ function gtag() {
2990
+ window.dataLayer.push(arguments);
2991
+ };
2992
+ window.gtag('js', new Date());
2993
+ window.gtag('config', key);
2994
+ };
2995
+ const pageChangeAction = () => {
2996
+ this.rt.events.subscribe((event) => {
2997
+ if (event instanceof NavigationEnd) {
2998
+ window.gtag('set', 'page_path', event.url);
2999
+ window.gtag('event', 'page_view');
3000
+ }
3001
+ });
3002
+ };
3003
+ const head = document.querySelector('head');
3004
+ const script = document.createElement('script');
3005
+ script.async = true;
3006
+ script.id = 'ga-settings';
3007
+ script.src = `//www.googletagmanager.com/gtag/js?id=${key}`;
3008
+ script.onload = () => {
3009
+ action();
3010
+ pageChangeAction();
3011
+ };
3012
+ script.onerror = () => {
3013
+ head?.removeChild(script);
3014
+ };
3015
+ head?.appendChild(script);
3016
+ }
3017
+ }
3018
+ }
3019
+ MonkeyEcxGAConfigService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxGAConfigService, deps: [{ token: i1$3.Router }], target: i0.ɵɵFactoryTarget.Injectable });
3020
+ MonkeyEcxGAConfigService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxGAConfigService, providedIn: 'root' });
3021
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxGAConfigService, decorators: [{
3022
+ type: Injectable,
3023
+ args: [{
3024
+ providedIn: 'root'
3025
+ }]
3026
+ }], ctorParameters: function () { return [{ type: i1$3.Router }]; } });
3027
+
2975
3028
  class MonkeyEcxConfigService extends MonkeyEcxCommonsService {
2976
- constructor(monkeyecxService, monkeyecxi18nConfigService, monkeyecxLogsConfigService, monkeyStyleGuideSettingsService, monkeyecxServiceWorkerConfigService, monkeyecxSecurityConsoleConfigService, monkeyecxMaintenanceConfigService, monkeyecxErrorConfigService, monkeyEcxFeatureToggleService) {
3029
+ constructor(monkeyecxService, monkeyecxi18nConfigService, monkeyecxLogsConfigService, monkeyStyleGuideSettingsService, monkeyecxServiceWorkerConfigService, monkeyecxSecurityConsoleConfigService, monkeyecxMaintenanceConfigService, monkeyecxErrorConfigService, monkeyEcxFeatureToggleService, monkeyGAConfigService) {
2977
3030
  super(monkeyecxService);
2978
3031
  this.monkeyecxi18nConfigService = monkeyecxi18nConfigService;
2979
3032
  this.monkeyecxLogsConfigService = monkeyecxLogsConfigService;
@@ -2983,11 +3036,12 @@ class MonkeyEcxConfigService extends MonkeyEcxCommonsService {
2983
3036
  this.monkeyecxMaintenanceConfigService = monkeyecxMaintenanceConfigService;
2984
3037
  this.monkeyecxErrorConfigService = monkeyecxErrorConfigService;
2985
3038
  this.monkeyEcxFeatureToggleService = monkeyEcxFeatureToggleService;
3039
+ this.monkeyGAConfigService = monkeyGAConfigService;
2986
3040
  this.configSubject$ = new BehaviorSubject({});
2987
3041
  this.configBoostrapSubject$ = new BehaviorSubject({});
2988
3042
  }
2989
3043
  internalValidations(...args) {
2990
- const { monkeyecxServiceWorkerConfigService, monkeyecxSecurityConsoleConfigService, monkeyecxMaintenanceConfigService, } = this;
3044
+ const { monkeyecxServiceWorkerConfigService, monkeyecxSecurityConsoleConfigService, monkeyecxMaintenanceConfigService } = this;
2991
3045
  const configBoostrap = args[0];
2992
3046
  const callback = args[1];
2993
3047
  monkeyecxSecurityConsoleConfigService.apply();
@@ -2996,15 +3050,16 @@ class MonkeyEcxConfigService extends MonkeyEcxCommonsService {
2996
3050
  callback(configBoostrap);
2997
3051
  }
2998
3052
  getWhiteLabelSettings(monkeyecxCode, configBoostrap, callback, environment, identifyCode) {
2999
- const { monkeyecxService, monkeyecxi18nConfigService, configSubject$, monkeyStyleGuideSettingsService, monkeyecxLogsConfigService, monkeyecxErrorConfigService, monkeyEcxFeatureToggleService, internalValidations, } = this;
3000
- const url = `${environment.urlAssets}`;
3053
+ const { monkeyecxService, monkeyecxi18nConfigService, configSubject$, monkeyStyleGuideSettingsService, monkeyecxLogsConfigService, monkeyecxErrorConfigService, monkeyEcxFeatureToggleService, monkeyGAConfigService, internalValidations } = this;
3054
+ const url = `${environment.urlAssets}/${monkeyecxCode.toLowerCase()}`;
3001
3055
  monkeyecxService
3002
- ?.get(`${url}/${monkeyecxCode.toLowerCase()}/white-label.json?t=${MonkeyUtils.getRandomString(30)}`)
3056
+ ?.get(`${url}/white-label.json`)
3003
3057
  ?.subscribe((config) => {
3004
3058
  monkeyecxi18nConfigService.apply(config, environment);
3005
3059
  monkeyecxLogsConfigService.apply(config, configBoostrap, environment, identifyCode);
3006
3060
  monkeyEcxFeatureToggleService.apply(configSubject$, environment);
3007
- monkeyStyleGuideSettingsService.boostrap(`${url}/${monkeyecxCode.toLowerCase()}/monkey-style-guide-settings.json?t=${MonkeyUtils.getRandomString(30)}`, internalValidations.bind(this, configBoostrap, callback, environment));
3061
+ monkeyGAConfigService.apply(config, environment);
3062
+ monkeyStyleGuideSettingsService.boostrap(`${url}/monkey-style-guide-settings.json`, internalValidations.bind(this, configBoostrap, callback, environment));
3008
3063
  configSubject$.next(config);
3009
3064
  }, (err) => {
3010
3065
  monkeyecxErrorConfigService.apply('theme');
@@ -3015,8 +3070,8 @@ class MonkeyEcxConfigService extends MonkeyEcxCommonsService {
3015
3070
  init(callback, environment, identifyCode, monkeyecxCode) {
3016
3071
  const { monkeyecxService, configBoostrapSubject$, monkeyecxErrorConfigService } = this;
3017
3072
  monkeyecxService
3018
- ?.get(`${environment.boostrapAssets}?t=${MonkeyUtils.getRandomString(30)}`, {
3019
- observe: 'response',
3073
+ ?.get(`${environment.boostrapAssets}`, {
3074
+ observe: 'response'
3020
3075
  })
3021
3076
  ?.subscribe((resp) => {
3022
3077
  const { headers, body } = resp;
@@ -3042,24 +3097,24 @@ class MonkeyEcxConfigService extends MonkeyEcxCommonsService {
3042
3097
  return this.configBoostrapSubject$.asObservable();
3043
3098
  }
3044
3099
  }
3045
- MonkeyEcxConfigService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxConfigService, deps: [{ token: MonkeyEcxService }, { token: MonkeyEcxi18nConfigService }, { token: MonkeyEcxLogsConfigService }, { token: i1.MonkeyStyleGuideSettingsService }, { token: MonkeyEcxServiceWorkerConfigService }, { token: MonkeyEcxSecurityConsoleConfigService }, { token: MonkeyEcxMaintenanceConfigService }, { token: MonkeyEcxErrorConfigService }, { token: MonkeyEcxFeatureToggleService }], target: i0.ɵɵFactoryTarget.Injectable });
3100
+ MonkeyEcxConfigService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxConfigService, deps: [{ token: MonkeyEcxService }, { token: MonkeyEcxi18nConfigService }, { token: MonkeyEcxLogsConfigService }, { token: i1.MonkeyStyleGuideSettingsService }, { token: MonkeyEcxServiceWorkerConfigService }, { token: MonkeyEcxSecurityConsoleConfigService }, { token: MonkeyEcxMaintenanceConfigService }, { token: MonkeyEcxErrorConfigService }, { token: MonkeyEcxFeatureToggleService }, { token: MonkeyEcxGAConfigService }], target: i0.ɵɵFactoryTarget.Injectable });
3046
3101
  MonkeyEcxConfigService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxConfigService, providedIn: 'root' });
3047
3102
  __decorate([
3048
3103
  MonkeyEcxCoreService({
3049
3104
  httpResponse: {
3050
- httpCodeIgnore: [404],
3105
+ httpCodeIgnore: [404]
3051
3106
  },
3052
3107
  requestInProgress: {
3053
- showProgress: false,
3054
- },
3108
+ showProgress: false
3109
+ }
3055
3110
  })
3056
3111
  ], MonkeyEcxConfigService.prototype, "init", null);
3057
3112
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxConfigService, decorators: [{
3058
3113
  type: Injectable,
3059
3114
  args: [{
3060
- providedIn: 'root',
3115
+ providedIn: 'root'
3061
3116
  }]
3062
- }], ctorParameters: function () { return [{ type: MonkeyEcxService }, { type: MonkeyEcxi18nConfigService }, { type: MonkeyEcxLogsConfigService }, { type: i1.MonkeyStyleGuideSettingsService }, { type: MonkeyEcxServiceWorkerConfigService }, { type: MonkeyEcxSecurityConsoleConfigService }, { type: MonkeyEcxMaintenanceConfigService }, { type: MonkeyEcxErrorConfigService }, { type: MonkeyEcxFeatureToggleService }]; }, propDecorators: { init: [] } });
3117
+ }], ctorParameters: function () { return [{ type: MonkeyEcxService }, { type: MonkeyEcxi18nConfigService }, { type: MonkeyEcxLogsConfigService }, { type: i1.MonkeyStyleGuideSettingsService }, { type: MonkeyEcxServiceWorkerConfigService }, { type: MonkeyEcxSecurityConsoleConfigService }, { type: MonkeyEcxMaintenanceConfigService }, { type: MonkeyEcxErrorConfigService }, { type: MonkeyEcxFeatureToggleService }, { type: MonkeyEcxGAConfigService }]; }, propDecorators: { init: [] } });
3063
3118
 
3064
3119
  class MonkeyEcxTokenStorageService {
3065
3120
  constructor(monkeyecxConfigService) {
@@ -3555,9 +3610,12 @@ class MonkeyEcxAuthGuardCompany {
3555
3610
  }
3556
3611
  canActivate() {
3557
3612
  const { monkeyecxAuthenticationService } = this;
3558
- if (monkeyecxAuthenticationService.isAuthorized() &&
3559
- monkeyecxAuthenticationService.isCompanyAuthorized()) {
3560
- return true;
3613
+ if (this.monkeyecxAuthenticationService.isAuthorized()) {
3614
+ if (monkeyecxAuthenticationService.isCompanyAuthorized()) {
3615
+ return true;
3616
+ }
3617
+ this.monkeyecxAuthenticationService.redirectApp();
3618
+ return false;
3561
3619
  }
3562
3620
  monkeyecxAuthenticationService.redirectLoginWelcomeBack();
3563
3621
  return false;