monkey-front-core 0.0.442 → 0.0.443
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.
- package/esm2020/lib/core/services/config/monkeyecx-config.service.mjs +16 -20
- package/esm2020/lib/core/services/config/monkeyecx-i18n-config.service.mjs +41 -37
- package/fesm2015/monkey-front-core.mjs +54 -52
- package/fesm2015/monkey-front-core.mjs.map +1 -1
- package/fesm2020/monkey-front-core.mjs +55 -55
- package/fesm2020/monkey-front-core.mjs.map +1 -1
- package/lib/core/services/config/monkeyecx-config.service.d.ts +2 -2
- package/lib/core/services/config/monkeyecx-i18n-config.service.d.ts +2 -1
- package/monkey-front-core-0.0.443.tgz +0 -0
- package/package.json +1 -1
- package/monkey-front-core-0.0.442.tgz +0 -0
|
@@ -3307,9 +3307,28 @@ class MonkeyEcxi18nConfigService extends MonkeyEcxCommonsService {
|
|
|
3307
3307
|
this.translateService.setDefaultLang('pt-BR');
|
|
3308
3308
|
this.translateService.use('pt-BR');
|
|
3309
3309
|
}
|
|
3310
|
-
|
|
3310
|
+
apply(params, environment, change = false) {
|
|
3311
|
+
this.applyInternal(environment);
|
|
3312
|
+
this.applyExternal(params, environment, change);
|
|
3313
|
+
}
|
|
3314
|
+
async applyInternal(environment) {
|
|
3311
3315
|
const { monkeyecxService, monkeyecxErrorConfigService } = this;
|
|
3312
3316
|
const lang = `${environment?.lang || 'pt-BR'}`;
|
|
3317
|
+
try {
|
|
3318
|
+
const currenti18n = await monkeyecxService
|
|
3319
|
+
?.get(`${environment.localAssets}/i18n/${lang}.json`)
|
|
3320
|
+
.pipe(take(1))
|
|
3321
|
+
.toPromise();
|
|
3322
|
+
const { data } = currenti18n;
|
|
3323
|
+
this.translateService.setTranslation('pt-BR', data, true);
|
|
3324
|
+
this.translateService.setTranslation(lang, data, true);
|
|
3325
|
+
this.translateService.use(lang);
|
|
3326
|
+
}
|
|
3327
|
+
catch (err) {
|
|
3328
|
+
console.error(`i18n ${lang} not found!`);
|
|
3329
|
+
monkeyecxErrorConfigService.apply('i18n');
|
|
3330
|
+
throwError(err);
|
|
3331
|
+
}
|
|
3313
3332
|
try {
|
|
3314
3333
|
const pathName = ['alerts', 'auth', 'register', 'shared'];
|
|
3315
3334
|
const services = pathName?.map((name) => {
|
|
@@ -3328,21 +3347,6 @@ class MonkeyEcxi18nConfigService extends MonkeyEcxCommonsService {
|
|
|
3328
3347
|
catch (err) {
|
|
3329
3348
|
// not to do
|
|
3330
3349
|
}
|
|
3331
|
-
try {
|
|
3332
|
-
const currenti18n = await monkeyecxService
|
|
3333
|
-
?.get(`${environment.localAssets}/i18n/${lang}.json`)
|
|
3334
|
-
.pipe(take(1))
|
|
3335
|
-
.toPromise();
|
|
3336
|
-
const { data } = currenti18n;
|
|
3337
|
-
this.translateService.setTranslation('pt-BR', data, true);
|
|
3338
|
-
this.translateService.setTranslation(lang, data, true);
|
|
3339
|
-
this.translateService.use(lang);
|
|
3340
|
-
}
|
|
3341
|
-
catch (err) {
|
|
3342
|
-
console.error(`i18n ${lang} not found!`);
|
|
3343
|
-
monkeyecxErrorConfigService.apply('i18n');
|
|
3344
|
-
throwError(err);
|
|
3345
|
-
}
|
|
3346
3350
|
}
|
|
3347
3351
|
async applyExternal(params, environment, change = false) {
|
|
3348
3352
|
const { monkeyecxCookieStorageService, monkeyecxErrorConfigService, monkeyecxService } = this;
|
|
@@ -3354,6 +3358,24 @@ class MonkeyEcxi18nConfigService extends MonkeyEcxCommonsService {
|
|
|
3354
3358
|
else {
|
|
3355
3359
|
monkeyecxCookieStorageService.setCookie('monkey-app-locale', btoa(JSON.stringify(i18n)), environment);
|
|
3356
3360
|
}
|
|
3361
|
+
try {
|
|
3362
|
+
const lang = `${i18n?.lang || 'pt-BR'}`;
|
|
3363
|
+
const currentExternali18n = params?.externali18n?.[`${lang}`];
|
|
3364
|
+
let data = {};
|
|
3365
|
+
if (currentExternali18n) {
|
|
3366
|
+
data = {
|
|
3367
|
+
EXTERNAL: currentExternali18n
|
|
3368
|
+
};
|
|
3369
|
+
}
|
|
3370
|
+
this.translateService.setTranslation('pt-BR', data, true);
|
|
3371
|
+
this.translateService.setTranslation(`${lang}`, data, true);
|
|
3372
|
+
this.translateService.use(`${lang}`);
|
|
3373
|
+
}
|
|
3374
|
+
catch (err) {
|
|
3375
|
+
console.error(`i18n ${i18n?.lang} not found!`);
|
|
3376
|
+
monkeyecxErrorConfigService.apply('i18n');
|
|
3377
|
+
throwError(err);
|
|
3378
|
+
}
|
|
3357
3379
|
try {
|
|
3358
3380
|
const externali18nPaths = params?.i18n?.paths || [];
|
|
3359
3381
|
const services = externali18nPaths?.map((url) => {
|
|
@@ -3372,24 +3394,6 @@ class MonkeyEcxi18nConfigService extends MonkeyEcxCommonsService {
|
|
|
3372
3394
|
catch (err) {
|
|
3373
3395
|
// not to do
|
|
3374
3396
|
}
|
|
3375
|
-
try {
|
|
3376
|
-
const lang = `${i18n?.lang || 'pt-BR'}`;
|
|
3377
|
-
const currentExternali18n = params?.externali18n?.[`${lang}`];
|
|
3378
|
-
let data = {};
|
|
3379
|
-
if (currentExternali18n) {
|
|
3380
|
-
data = {
|
|
3381
|
-
EXTERNAL: currentExternali18n
|
|
3382
|
-
};
|
|
3383
|
-
}
|
|
3384
|
-
this.translateService.setTranslation('pt-BR', data, true);
|
|
3385
|
-
this.translateService.setTranslation(lang, data, true);
|
|
3386
|
-
this.translateService.use(lang);
|
|
3387
|
-
}
|
|
3388
|
-
catch (err) {
|
|
3389
|
-
console.error(`i18n ${i18n?.lang} not found!`);
|
|
3390
|
-
monkeyecxErrorConfigService.apply('i18n');
|
|
3391
|
-
throwError(err);
|
|
3392
|
-
}
|
|
3393
3397
|
}
|
|
3394
3398
|
}
|
|
3395
3399
|
MonkeyEcxi18nConfigService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxi18nConfigService, deps: [{ token: MonkeyEcxService }, { token: i1$1.TranslateService }, { token: MonkeyEcxCookieStorageService }, { token: MonkeyEcxErrorConfigService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
@@ -3403,13 +3407,13 @@ __decorate([
|
|
|
3403
3407
|
showProgress: false
|
|
3404
3408
|
}
|
|
3405
3409
|
})
|
|
3406
|
-
], MonkeyEcxi18nConfigService.prototype, "
|
|
3410
|
+
], MonkeyEcxi18nConfigService.prototype, "applyInternal", null);
|
|
3407
3411
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxi18nConfigService, decorators: [{
|
|
3408
3412
|
type: Injectable,
|
|
3409
3413
|
args: [{
|
|
3410
3414
|
providedIn: 'root'
|
|
3411
3415
|
}]
|
|
3412
|
-
}], ctorParameters: function () { return [{ type: MonkeyEcxService }, { type: i1$1.TranslateService }, { type: MonkeyEcxCookieStorageService }, { type: MonkeyEcxErrorConfigService }]; }, propDecorators: {
|
|
3416
|
+
}], ctorParameters: function () { return [{ type: MonkeyEcxService }, { type: i1$1.TranslateService }, { type: MonkeyEcxCookieStorageService }, { type: MonkeyEcxErrorConfigService }]; }, propDecorators: { applyInternal: [] } });
|
|
3413
3417
|
|
|
3414
3418
|
class MonkeyEcxLogsConfigService {
|
|
3415
3419
|
apply(params, configBootstrap, environment, identifyCode) {
|
|
@@ -3731,29 +3735,26 @@ class MonkeyEcxConfigService extends MonkeyEcxCommonsService {
|
|
|
3731
3735
|
this.configSubject$ = new BehaviorSubject({});
|
|
3732
3736
|
this.configBootstrapSubject$ = new BehaviorSubject({});
|
|
3733
3737
|
}
|
|
3734
|
-
async
|
|
3735
|
-
const {
|
|
3736
|
-
const configBootstrap = args[0];
|
|
3737
|
-
const callback = args[1];
|
|
3738
|
-
monkeyecxSecurityConsoleConfigService.apply();
|
|
3738
|
+
async getSettings(monkeyecxCode, configBootstrap, callback, environment, identifyCode) {
|
|
3739
|
+
const { monkeyecxSecurityConsoleConfigService, monkeyecxServiceWorkerConfigService, monkeyecxMaintenanceConfigService, monkeyStyleGuideSettingsService, monkeyecxi18nConfigService, monkeyGTMConfigService, getWhiteLabel } = this;
|
|
3739
3740
|
monkeyecxServiceWorkerConfigService.apply(configBootstrap);
|
|
3740
3741
|
monkeyecxMaintenanceConfigService.apply(configBootstrap);
|
|
3741
|
-
|
|
3742
|
-
|
|
3743
|
-
|
|
3744
|
-
const { monkeyecxService, configSubject$, monkeyStyleGuideSettingsService, monkeyecxLogsConfigService, monkeyecxErrorConfigService, monkeyEcxFeatureToggleService, monkeyGTMConfigService, monkeyecxi18nConfigService, monkeyEcxAlertsConfigService, internalValidations } = this;
|
|
3742
|
+
monkeyecxSecurityConsoleConfigService.apply();
|
|
3743
|
+
monkeyGTMConfigService.apply(environment);
|
|
3744
|
+
await monkeyecxi18nConfigService.applyInternal(environment);
|
|
3745
3745
|
const url = `${environment.urlAssets}/${monkeyecxCode.toLowerCase()}`;
|
|
3746
|
-
|
|
3747
|
-
|
|
3748
|
-
|
|
3749
|
-
|
|
3750
|
-
|
|
3746
|
+
monkeyStyleGuideSettingsService.bootstrap(`${url}/monkey-style-guide-settings.json`, getWhiteLabel.bind(this, configBootstrap, callback, environment, identifyCode, url));
|
|
3747
|
+
}
|
|
3748
|
+
getWhiteLabel(configBootstrap, callback, environment, identifyCode, url) {
|
|
3749
|
+
const { monkeyecxService, configSubject$, monkeyecxLogsConfigService, monkeyecxErrorConfigService, monkeyEcxFeatureToggleService, monkeyecxi18nConfigService, monkeyEcxAlertsConfigService } = this;
|
|
3750
|
+
monkeyecxService?.get(`${url}/white-label.json`)?.subscribe(async (config) => {
|
|
3751
|
+
await monkeyecxi18nConfigService.applyExternal(config, environment);
|
|
3751
3752
|
monkeyecxLogsConfigService.apply(config, configBootstrap, environment, identifyCode);
|
|
3752
3753
|
monkeyEcxFeatureToggleService.apply(configSubject$, environment);
|
|
3753
|
-
monkeyGTMConfigService.apply(environment);
|
|
3754
3754
|
monkeyEcxAlertsConfigService.apply(config);
|
|
3755
|
-
monkeyStyleGuideSettingsService.bootstrap(`${url}/monkey-style-guide-settings.json`, internalValidations.bind(this, configBootstrap, callback));
|
|
3756
3755
|
configSubject$.next(config);
|
|
3756
|
+
if (callback)
|
|
3757
|
+
callback();
|
|
3757
3758
|
}, (err) => {
|
|
3758
3759
|
monkeyecxErrorConfigService.apply('theme');
|
|
3759
3760
|
console.error('Program Configuration not found!');
|
|
@@ -3766,11 +3767,10 @@ class MonkeyEcxConfigService extends MonkeyEcxCommonsService {
|
|
|
3766
3767
|
?.get(`${environment.bootstrapAssets}`, {
|
|
3767
3768
|
observe: 'response'
|
|
3768
3769
|
})
|
|
3769
|
-
?.subscribe((
|
|
3770
|
-
const { headers, body } = resp;
|
|
3770
|
+
?.subscribe(({ headers, body }) => {
|
|
3771
3771
|
const monkeyCode = headers.get('monkey-code') || monkeyecxCode;
|
|
3772
3772
|
if (monkeyCode) {
|
|
3773
|
-
this.
|
|
3773
|
+
this.getSettings(monkeyCode, body, callback, environment, identifyCode);
|
|
3774
3774
|
configBootstrapSubject$.next(body);
|
|
3775
3775
|
}
|
|
3776
3776
|
else {
|