monkey-front-core 0.0.440 → 0.0.442
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 +11 -14
- package/esm2020/lib/core/services/config/monkeyecx-i18n-config.service.mjs +22 -47
- package/fesm2015/monkey-front-core.mjs +30 -59
- package/fesm2015/monkey-front-core.mjs.map +1 -1
- package/fesm2020/monkey-front-core.mjs +31 -59
- package/fesm2020/monkey-front-core.mjs.map +1 -1
- package/lib/core/services/config/monkeyecx-i18n-config.service.d.ts +2 -2
- package/monkey-front-core-0.0.442.tgz +0 -0
- package/package.json +1 -1
- package/monkey-front-core-0.0.440.tgz +0 -0
|
@@ -3307,27 +3307,19 @@ class MonkeyEcxi18nConfigService extends MonkeyEcxCommonsService {
|
|
|
3307
3307
|
this.translateService.setDefaultLang('pt-BR');
|
|
3308
3308
|
this.translateService.use('pt-BR');
|
|
3309
3309
|
}
|
|
3310
|
-
async
|
|
3311
|
-
const { monkeyecxService,
|
|
3312
|
-
|
|
3313
|
-
const currentExternali18n = params?.externali18n?.[`${i18n?.lang || 'pt-BR'}`];
|
|
3314
|
-
const cookie = monkeyecxCookieStorageService.getCookie('monkey-app-locale');
|
|
3315
|
-
if (cookie && !change) {
|
|
3316
|
-
i18n = JSON.parse(atob(cookie));
|
|
3317
|
-
}
|
|
3318
|
-
else {
|
|
3319
|
-
monkeyecxCookieStorageService.setCookie('monkey-app-locale', btoa(JSON.stringify(i18n)), environment);
|
|
3320
|
-
}
|
|
3310
|
+
async apply(environment) {
|
|
3311
|
+
const { monkeyecxService, monkeyecxErrorConfigService } = this;
|
|
3312
|
+
const lang = `${environment?.lang || 'pt-BR'}`;
|
|
3321
3313
|
try {
|
|
3322
|
-
const
|
|
3323
|
-
const services =
|
|
3324
|
-
return monkeyecxService
|
|
3314
|
+
const pathName = ['alerts', 'auth', 'register', 'shared'];
|
|
3315
|
+
const services = pathName?.map((name) => {
|
|
3316
|
+
return monkeyecxService
|
|
3317
|
+
?.get(`${environment.urlAssets}/data/i18n/${name}/${lang}.json`)
|
|
3318
|
+
.pipe(take(1))
|
|
3319
|
+
.toPromise();
|
|
3325
3320
|
});
|
|
3326
|
-
if (!services?.length)
|
|
3327
|
-
return;
|
|
3328
3321
|
const externali18nData = await Promise.all(services);
|
|
3329
3322
|
externali18nData?.forEach((config) => {
|
|
3330
|
-
const { lang } = config;
|
|
3331
3323
|
const { data } = config;
|
|
3332
3324
|
this.translateService.setTranslation('pt-BR', data, true);
|
|
3333
3325
|
this.translateService.setTranslation(lang, data, true);
|
|
@@ -3337,30 +3329,24 @@ class MonkeyEcxi18nConfigService extends MonkeyEcxCommonsService {
|
|
|
3337
3329
|
// not to do
|
|
3338
3330
|
}
|
|
3339
3331
|
try {
|
|
3340
|
-
const currenti18n = await monkeyecxService
|
|
3341
|
-
|
|
3342
|
-
|
|
3343
|
-
|
|
3344
|
-
|
|
3345
|
-
...data,
|
|
3346
|
-
EXTERNAL: currentExternali18n
|
|
3347
|
-
};
|
|
3348
|
-
}
|
|
3332
|
+
const currenti18n = await monkeyecxService
|
|
3333
|
+
?.get(`${environment.localAssets}/i18n/${lang}.json`)
|
|
3334
|
+
.pipe(take(1))
|
|
3335
|
+
.toPromise();
|
|
3336
|
+
const { data } = currenti18n;
|
|
3349
3337
|
this.translateService.setTranslation('pt-BR', data, true);
|
|
3350
3338
|
this.translateService.setTranslation(lang, data, true);
|
|
3351
3339
|
this.translateService.use(lang);
|
|
3352
3340
|
}
|
|
3353
3341
|
catch (err) {
|
|
3354
|
-
console.error(`i18n ${
|
|
3342
|
+
console.error(`i18n ${lang} not found!`);
|
|
3355
3343
|
monkeyecxErrorConfigService.apply('i18n');
|
|
3356
3344
|
throwError(err);
|
|
3357
3345
|
}
|
|
3358
|
-
call?.();
|
|
3359
3346
|
}
|
|
3360
|
-
async
|
|
3361
|
-
const {
|
|
3347
|
+
async applyExternal(params, environment, change = false) {
|
|
3348
|
+
const { monkeyecxCookieStorageService, monkeyecxErrorConfigService, monkeyecxService } = this;
|
|
3362
3349
|
let { i18n } = params;
|
|
3363
|
-
const currentExternali18n = params?.externali18n?.[`${i18n?.lang || 'pt-BR'}`];
|
|
3364
3350
|
const cookie = monkeyecxCookieStorageService.getCookie('monkey-app-locale');
|
|
3365
3351
|
if (cookie && !change) {
|
|
3366
3352
|
i18n = JSON.parse(atob(cookie));
|
|
@@ -3387,12 +3373,11 @@ class MonkeyEcxi18nConfigService extends MonkeyEcxCommonsService {
|
|
|
3387
3373
|
// not to do
|
|
3388
3374
|
}
|
|
3389
3375
|
try {
|
|
3390
|
-
const
|
|
3391
|
-
const {
|
|
3392
|
-
let
|
|
3376
|
+
const lang = `${i18n?.lang || 'pt-BR'}`;
|
|
3377
|
+
const currentExternali18n = params?.externali18n?.[`${lang}`];
|
|
3378
|
+
let data = {};
|
|
3393
3379
|
if (currentExternali18n) {
|
|
3394
3380
|
data = {
|
|
3395
|
-
...data,
|
|
3396
3381
|
EXTERNAL: currentExternali18n
|
|
3397
3382
|
};
|
|
3398
3383
|
}
|
|
@@ -3409,16 +3394,6 @@ class MonkeyEcxi18nConfigService extends MonkeyEcxCommonsService {
|
|
|
3409
3394
|
}
|
|
3410
3395
|
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 });
|
|
3411
3396
|
MonkeyEcxi18nConfigService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.1.1", ngImport: i0, type: MonkeyEcxi18nConfigService, providedIn: 'root' });
|
|
3412
|
-
__decorate([
|
|
3413
|
-
MonkeyEcxCoreService({
|
|
3414
|
-
httpResponse: {
|
|
3415
|
-
httpCodeIgnore: [404]
|
|
3416
|
-
},
|
|
3417
|
-
requestInProgress: {
|
|
3418
|
-
showProgress: false
|
|
3419
|
-
}
|
|
3420
|
-
})
|
|
3421
|
-
], MonkeyEcxi18nConfigService.prototype, "applyWithSync", null);
|
|
3422
3397
|
__decorate([
|
|
3423
3398
|
MonkeyEcxCoreService({
|
|
3424
3399
|
httpResponse: {
|
|
@@ -3434,7 +3409,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImpor
|
|
|
3434
3409
|
args: [{
|
|
3435
3410
|
providedIn: 'root'
|
|
3436
3411
|
}]
|
|
3437
|
-
}], ctorParameters: function () { return [{ type: MonkeyEcxService }, { type: i1$1.TranslateService }, { type: MonkeyEcxCookieStorageService }, { type: MonkeyEcxErrorConfigService }]; }, propDecorators: {
|
|
3412
|
+
}], ctorParameters: function () { return [{ type: MonkeyEcxService }, { type: i1$1.TranslateService }, { type: MonkeyEcxCookieStorageService }, { type: MonkeyEcxErrorConfigService }]; }, propDecorators: { apply: [] } });
|
|
3438
3413
|
|
|
3439
3414
|
class MonkeyEcxLogsConfigService {
|
|
3440
3415
|
apply(params, configBootstrap, environment, identifyCode) {
|
|
@@ -3757,30 +3732,27 @@ class MonkeyEcxConfigService extends MonkeyEcxCommonsService {
|
|
|
3757
3732
|
this.configBootstrapSubject$ = new BehaviorSubject({});
|
|
3758
3733
|
}
|
|
3759
3734
|
async internalValidations(...args) {
|
|
3760
|
-
const { monkeyecxServiceWorkerConfigService, monkeyecxSecurityConsoleConfigService, monkeyecxMaintenanceConfigService
|
|
3735
|
+
const { monkeyecxServiceWorkerConfigService, monkeyecxSecurityConsoleConfigService, monkeyecxMaintenanceConfigService } = this;
|
|
3761
3736
|
const configBootstrap = args[0];
|
|
3762
3737
|
const callback = args[1];
|
|
3763
|
-
|
|
3764
|
-
|
|
3765
|
-
|
|
3766
|
-
|
|
3767
|
-
monkeyecxServiceWorkerConfigService.apply(configBootstrap);
|
|
3768
|
-
monkeyecxMaintenanceConfigService.apply(configBootstrap);
|
|
3769
|
-
callback(configBootstrap);
|
|
3770
|
-
};
|
|
3771
|
-
await monkeyecxi18nConfigService.applyWithSync(config, environment, false, call);
|
|
3738
|
+
monkeyecxSecurityConsoleConfigService.apply();
|
|
3739
|
+
monkeyecxServiceWorkerConfigService.apply(configBootstrap);
|
|
3740
|
+
monkeyecxMaintenanceConfigService.apply(configBootstrap);
|
|
3741
|
+
callback(configBootstrap);
|
|
3772
3742
|
}
|
|
3773
3743
|
getWhiteLabelSettings(monkeyecxCode, configBootstrap, callback, environment, identifyCode) {
|
|
3774
|
-
const { monkeyecxService, configSubject$, monkeyStyleGuideSettingsService, monkeyecxLogsConfigService, monkeyecxErrorConfigService, monkeyEcxFeatureToggleService, monkeyGTMConfigService, monkeyEcxAlertsConfigService, internalValidations } = this;
|
|
3744
|
+
const { monkeyecxService, configSubject$, monkeyStyleGuideSettingsService, monkeyecxLogsConfigService, monkeyecxErrorConfigService, monkeyEcxFeatureToggleService, monkeyGTMConfigService, monkeyecxi18nConfigService, monkeyEcxAlertsConfigService, internalValidations } = this;
|
|
3775
3745
|
const url = `${environment.urlAssets}/${monkeyecxCode.toLowerCase()}`;
|
|
3746
|
+
monkeyecxi18nConfigService.apply(environment);
|
|
3776
3747
|
monkeyecxService
|
|
3777
3748
|
?.get(`${url}/white-label.json`)
|
|
3778
|
-
?.subscribe(
|
|
3749
|
+
?.subscribe((config) => {
|
|
3750
|
+
monkeyecxi18nConfigService.applyExternal(config, environment);
|
|
3779
3751
|
monkeyecxLogsConfigService.apply(config, configBootstrap, environment, identifyCode);
|
|
3780
3752
|
monkeyEcxFeatureToggleService.apply(configSubject$, environment);
|
|
3781
3753
|
monkeyGTMConfigService.apply(environment);
|
|
3782
3754
|
monkeyEcxAlertsConfigService.apply(config);
|
|
3783
|
-
monkeyStyleGuideSettingsService.bootstrap(`${url}/monkey-style-guide-settings.json`, internalValidations.bind(this, configBootstrap, callback
|
|
3755
|
+
monkeyStyleGuideSettingsService.bootstrap(`${url}/monkey-style-guide-settings.json`, internalValidations.bind(this, configBootstrap, callback));
|
|
3784
3756
|
configSubject$.next(config);
|
|
3785
3757
|
}, (err) => {
|
|
3786
3758
|
monkeyecxErrorConfigService.apply('theme');
|