monkey-front-core 0.0.598 → 0.0.599

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.
@@ -4207,7 +4207,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImpor
4207
4207
 
4208
4208
  /* eslint-disable no-console */
4209
4209
  class MonkeyEcxGTMConfigService {
4210
- constructor() {
4210
+ constructor(config) {
4211
+ this.config = config;
4211
4212
  // not to do
4212
4213
  }
4213
4214
  handleCode(key) {
@@ -4237,22 +4238,27 @@ class MonkeyEcxGTMConfigService {
4237
4238
  console.error('GTM Configuration Error!');
4238
4239
  }
4239
4240
  }
4240
- apply(environment) {
4241
- const { gtm } = environment;
4242
- const { enabled, key } = gtm || { enabled: false, key: '' };
4243
- if (enabled && environment.environment !== 'dev') {
4241
+ async apply(environment) {
4242
+ const data = await this.config
4243
+ .config()
4244
+ .pipe(first((val) => {
4245
+ return !!val && JSON.stringify(val) !== '{}';
4246
+ }))
4247
+ .toPromise();
4248
+ const { enabled, key } = data?.gtm || environment?.gtm || { enabled: false, key: '' };
4249
+ if (enabled) {
4244
4250
  this.handleCode(key);
4245
4251
  }
4246
4252
  }
4247
4253
  }
4248
- MonkeyEcxGTMConfigService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxGTMConfigService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
4254
+ MonkeyEcxGTMConfigService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxGTMConfigService, deps: [{ token: MonkeyEcxConfigService }], target: i0.ɵɵFactoryTarget.Injectable });
4249
4255
  MonkeyEcxGTMConfigService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxGTMConfigService, providedIn: 'root' });
4250
4256
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxGTMConfigService, decorators: [{
4251
4257
  type: Injectable,
4252
4258
  args: [{
4253
4259
  providedIn: 'root'
4254
4260
  }]
4255
- }], ctorParameters: function () { return []; } });
4261
+ }], ctorParameters: function () { return [{ type: MonkeyEcxConfigService }]; } });
4256
4262
 
4257
4263
  const moment = moment_;
4258
4264
  class MonkeyEcxAlertsConfigService {