monkey-front-core 0.0.438 → 0.0.440
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 +14 -10
- package/esm2020/lib/core/services/config/monkeyecx-i18n-config.service.mjs +62 -2
- package/fesm2015/monkey-front-core.mjs +77 -11
- package/fesm2015/monkey-front-core.mjs.map +1 -1
- package/fesm2020/monkey-front-core.mjs +74 -10
- package/fesm2020/monkey-front-core.mjs.map +1 -1
- package/lib/core/services/config/monkeyecx-i18n-config.service.d.ts +4 -3
- package/monkey-front-core-0.0.440.tgz +0 -0
- package/package.json +1 -1
- package/monkey-front-core-0.0.438.tgz +0 -0
|
@@ -3307,6 +3307,56 @@ class MonkeyEcxi18nConfigService extends MonkeyEcxCommonsService {
|
|
|
3307
3307
|
this.translateService.setDefaultLang('pt-BR');
|
|
3308
3308
|
this.translateService.use('pt-BR');
|
|
3309
3309
|
}
|
|
3310
|
+
async applyWithSync(params, environment, change = false, call) {
|
|
3311
|
+
const { monkeyecxService, monkeyecxCookieStorageService, monkeyecxErrorConfigService } = this;
|
|
3312
|
+
let { i18n } = params;
|
|
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
|
+
}
|
|
3321
|
+
try {
|
|
3322
|
+
const externali18nPaths = params?.i18n?.paths || [];
|
|
3323
|
+
const services = externali18nPaths?.map((url) => {
|
|
3324
|
+
return monkeyecxService?.get(`${url}/${i18n?.lang}.json`).pipe(take(1)).toPromise();
|
|
3325
|
+
});
|
|
3326
|
+
if (!services?.length)
|
|
3327
|
+
return;
|
|
3328
|
+
const externali18nData = await Promise.all(services);
|
|
3329
|
+
externali18nData?.forEach((config) => {
|
|
3330
|
+
const { lang } = config;
|
|
3331
|
+
const { data } = config;
|
|
3332
|
+
this.translateService.setTranslation('pt-BR', data, true);
|
|
3333
|
+
this.translateService.setTranslation(lang, data, true);
|
|
3334
|
+
});
|
|
3335
|
+
}
|
|
3336
|
+
catch (err) {
|
|
3337
|
+
// not to do
|
|
3338
|
+
}
|
|
3339
|
+
try {
|
|
3340
|
+
const currenti18n = await monkeyecxService?.get(`${environment.localAssets}/i18n/${i18n?.lang}.json`).pipe(take(1)).toPromise();
|
|
3341
|
+
const { lang } = currenti18n;
|
|
3342
|
+
let { data } = currenti18n;
|
|
3343
|
+
if (currentExternali18n) {
|
|
3344
|
+
data = {
|
|
3345
|
+
...data,
|
|
3346
|
+
EXTERNAL: currentExternali18n
|
|
3347
|
+
};
|
|
3348
|
+
}
|
|
3349
|
+
this.translateService.setTranslation('pt-BR', data, true);
|
|
3350
|
+
this.translateService.setTranslation(lang, data, true);
|
|
3351
|
+
this.translateService.use(lang);
|
|
3352
|
+
}
|
|
3353
|
+
catch (err) {
|
|
3354
|
+
console.error(`i18n ${i18n?.lang} not found!`);
|
|
3355
|
+
monkeyecxErrorConfigService.apply('i18n');
|
|
3356
|
+
throwError(err);
|
|
3357
|
+
}
|
|
3358
|
+
call?.();
|
|
3359
|
+
}
|
|
3310
3360
|
async apply(params, environment, change = false) {
|
|
3311
3361
|
const { monkeyecxService, monkeyecxCookieStorageService, monkeyecxErrorConfigService } = this;
|
|
3312
3362
|
let { i18n } = params;
|
|
@@ -3359,6 +3409,16 @@ class MonkeyEcxi18nConfigService extends MonkeyEcxCommonsService {
|
|
|
3359
3409
|
}
|
|
3360
3410
|
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 });
|
|
3361
3411
|
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);
|
|
3362
3422
|
__decorate([
|
|
3363
3423
|
MonkeyEcxCoreService({
|
|
3364
3424
|
httpResponse: {
|
|
@@ -3374,7 +3434,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.1.1", ngImpor
|
|
|
3374
3434
|
args: [{
|
|
3375
3435
|
providedIn: 'root'
|
|
3376
3436
|
}]
|
|
3377
|
-
}], ctorParameters: function () { return [{ type: MonkeyEcxService }, { type: i1$1.TranslateService }, { type: MonkeyEcxCookieStorageService }, { type: MonkeyEcxErrorConfigService }]; }, propDecorators: { apply: [] } });
|
|
3437
|
+
}], ctorParameters: function () { return [{ type: MonkeyEcxService }, { type: i1$1.TranslateService }, { type: MonkeyEcxCookieStorageService }, { type: MonkeyEcxErrorConfigService }]; }, propDecorators: { applyWithSync: [], apply: [] } });
|
|
3378
3438
|
|
|
3379
3439
|
class MonkeyEcxLogsConfigService {
|
|
3380
3440
|
apply(params, configBootstrap, environment, identifyCode) {
|
|
@@ -3696,27 +3756,31 @@ class MonkeyEcxConfigService extends MonkeyEcxCommonsService {
|
|
|
3696
3756
|
this.configSubject$ = new BehaviorSubject({});
|
|
3697
3757
|
this.configBootstrapSubject$ = new BehaviorSubject({});
|
|
3698
3758
|
}
|
|
3699
|
-
internalValidations(...args) {
|
|
3700
|
-
const { monkeyecxServiceWorkerConfigService, monkeyecxSecurityConsoleConfigService, monkeyecxMaintenanceConfigService } = this;
|
|
3759
|
+
async internalValidations(...args) {
|
|
3760
|
+
const { monkeyecxServiceWorkerConfigService, monkeyecxSecurityConsoleConfigService, monkeyecxMaintenanceConfigService, monkeyecxi18nConfigService } = this;
|
|
3701
3761
|
const configBootstrap = args[0];
|
|
3702
3762
|
const callback = args[1];
|
|
3703
|
-
|
|
3704
|
-
|
|
3705
|
-
|
|
3706
|
-
|
|
3763
|
+
const environment = args[2];
|
|
3764
|
+
const config = args[3];
|
|
3765
|
+
const call = () => {
|
|
3766
|
+
monkeyecxSecurityConsoleConfigService.apply();
|
|
3767
|
+
monkeyecxServiceWorkerConfigService.apply(configBootstrap);
|
|
3768
|
+
monkeyecxMaintenanceConfigService.apply(configBootstrap);
|
|
3769
|
+
callback(configBootstrap);
|
|
3770
|
+
};
|
|
3771
|
+
await monkeyecxi18nConfigService.applyWithSync(config, environment, false, call);
|
|
3707
3772
|
}
|
|
3708
3773
|
getWhiteLabelSettings(monkeyecxCode, configBootstrap, callback, environment, identifyCode) {
|
|
3709
|
-
const { monkeyecxService,
|
|
3774
|
+
const { monkeyecxService, configSubject$, monkeyStyleGuideSettingsService, monkeyecxLogsConfigService, monkeyecxErrorConfigService, monkeyEcxFeatureToggleService, monkeyGTMConfigService, monkeyEcxAlertsConfigService, internalValidations } = this;
|
|
3710
3775
|
const url = `${environment.urlAssets}/${monkeyecxCode.toLowerCase()}`;
|
|
3711
3776
|
monkeyecxService
|
|
3712
3777
|
?.get(`${url}/white-label.json`)
|
|
3713
3778
|
?.subscribe(async (config) => {
|
|
3714
|
-
await monkeyecxi18nConfigService.apply(config, environment);
|
|
3715
3779
|
monkeyecxLogsConfigService.apply(config, configBootstrap, environment, identifyCode);
|
|
3716
3780
|
monkeyEcxFeatureToggleService.apply(configSubject$, environment);
|
|
3717
3781
|
monkeyGTMConfigService.apply(environment);
|
|
3718
3782
|
monkeyEcxAlertsConfigService.apply(config);
|
|
3719
|
-
monkeyStyleGuideSettingsService.bootstrap(`${url}/monkey-style-guide-settings.json`, internalValidations.bind(this, configBootstrap, callback, environment));
|
|
3783
|
+
monkeyStyleGuideSettingsService.bootstrap(`${url}/monkey-style-guide-settings.json`, internalValidations.bind(this, configBootstrap, callback, environment, config));
|
|
3720
3784
|
configSubject$.next(config);
|
|
3721
3785
|
}, (err) => {
|
|
3722
3786
|
monkeyecxErrorConfigService.apply('theme');
|