@onecx/angular-integration-interface 4.43.0 → 5.0.0
Sign up to get free protection for your applications and to get access to all the features.
- package/{esm2020 → esm2022}/lib/services/app-state.service.mjs +4 -4
- package/esm2022/lib/services/configuration.service.mjs +79 -0
- package/esm2022/lib/services/initialize-module-guard.service.mjs +60 -0
- package/esm2022/lib/services/portal-message.service.mjs +49 -0
- package/{esm2020 → esm2022}/lib/services/remote-components.service.mjs +4 -4
- package/{esm2020 → esm2022}/lib/services/theme.service.mjs +5 -5
- package/esm2022/lib/services/user.service.mjs +86 -0
- package/esm2022/lib/services/workspace.service.mjs +124 -0
- package/esm2022/lib/utils/add-initialize-module-guard.utils.mjs +17 -0
- package/{esm2020 → esm2022}/mocks/app-state-service-mock.mjs +4 -4
- package/esm2022/mocks/fake-topic.mjs +25 -0
- package/{fesm2015 → fesm2022}/onecx-angular-integration-interface-mocks.mjs +3 -3
- package/{fesm2015 → fesm2022}/onecx-angular-integration-interface-mocks.mjs.map +1 -1
- package/{fesm2020 → fesm2022}/onecx-angular-integration-interface.mjs +38 -33
- package/fesm2022/onecx-angular-integration-interface.mjs.map +1 -0
- package/lib/services/portal-message.service.d.ts +3 -1
- package/package.json +10 -18
- package/esm2020/lib/services/configuration.service.mjs +0 -79
- package/esm2020/lib/services/initialize-module-guard.service.mjs +0 -60
- package/esm2020/lib/services/portal-message.service.mjs +0 -44
- package/esm2020/lib/services/user.service.mjs +0 -86
- package/esm2020/lib/services/workspace.service.mjs +0 -124
- package/esm2020/lib/utils/add-initialize-module-guard.utils.mjs +0 -17
- package/esm2020/mocks/fake-topic.mjs +0 -25
- package/fesm2015/onecx-angular-integration-interface.mjs +0 -533
- package/fesm2015/onecx-angular-integration-interface.mjs.map +0 -1
- package/fesm2020/onecx-angular-integration-interface-mocks.mjs +0 -71
- package/fesm2020/onecx-angular-integration-interface-mocks.mjs.map +0 -1
- package/fesm2020/onecx-angular-integration-interface.mjs.map +0 -1
- /package/{esm2020 → esm2022}/index.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/api/constants.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/api/iauth.service.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/api/injection-tokens.mjs +0 -0
- /package/{esm2020 → esm2022}/lib/model/config-key.model.mjs +0 -0
- /package/{esm2020 → esm2022}/mocks/index.mjs +0 -0
- /package/{esm2020 → esm2022}/mocks/mock-user-service.mjs +0 -0
- /package/{esm2020 → esm2022}/mocks/onecx-angular-integration-interface-mocks.mjs +0 -0
- /package/{esm2020 → esm2022}/onecx-angular-integration-interface.mjs +0 -0
@@ -35,11 +35,11 @@ export class AppStateService {
|
|
35
35
|
this.currentWorkspace$.destroy();
|
36
36
|
this.isAuthenticated$.destroy();
|
37
37
|
}
|
38
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: AppStateService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
39
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: AppStateService, providedIn: 'root' }); }
|
38
40
|
}
|
39
|
-
|
40
|
-
AppStateService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: AppStateService, providedIn: 'root' });
|
41
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: AppStateService, decorators: [{
|
41
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: AppStateService, decorators: [{
|
42
42
|
type: Injectable,
|
43
43
|
args: [{ providedIn: 'root' }]
|
44
44
|
}] });
|
45
|
-
//# sourceMappingURL=data:application/json;base64,
|
45
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXBwLXN0YXRlLnNlcnZpY2UuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uL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zdHJveSgpXG4gICAgdGhpcy5pc0F1dGhlbnRpY2F0ZWQkLmRlc3Ryb3koKVxuICB9XG59XG4iXX0=
|
@@ -0,0 +1,79 @@
|
|
1
|
+
import { HttpClient } from '@angular/common/http';
|
2
|
+
import { Inject, Injectable, Optional } from '@angular/core';
|
3
|
+
import { firstValueFrom } from 'rxjs';
|
4
|
+
import { ConfigurationTopic } from '@onecx/integration-interface';
|
5
|
+
import { APP_CONFIG } from '../api/injection-tokens';
|
6
|
+
import { CONFIG_KEY } from '../model/config-key.model';
|
7
|
+
import * as i0 from "@angular/core";
|
8
|
+
import * as i1 from "@angular/common/http";
|
9
|
+
export class ConfigurationService {
|
10
|
+
constructor(http, defaultConfig) {
|
11
|
+
this.http = http;
|
12
|
+
this.defaultConfig = defaultConfig;
|
13
|
+
this.config$ = new ConfigurationTopic();
|
14
|
+
}
|
15
|
+
ngOnDestroy() {
|
16
|
+
this.config$.destroy();
|
17
|
+
}
|
18
|
+
init() {
|
19
|
+
return new Promise((resolve, reject) => {
|
20
|
+
const skipRemoteConfigLoad = this.defaultConfig && this.defaultConfig['skipRemoteConfigLoad'];
|
21
|
+
let loadConfigPromise;
|
22
|
+
const inlinedConfig = window['APP_CONFIG'];
|
23
|
+
if (inlinedConfig) {
|
24
|
+
console.log(`ENV resolved from injected config`);
|
25
|
+
loadConfigPromise = Promise.resolve(inlinedConfig);
|
26
|
+
}
|
27
|
+
else {
|
28
|
+
if (skipRemoteConfigLoad) {
|
29
|
+
console.log('📢 TKA001: Remote config load is disabled. To enable it, remove the "skipRemoteConfigLoad" key in your environment.json');
|
30
|
+
loadConfigPromise = Promise.resolve(this.defaultConfig || {});
|
31
|
+
}
|
32
|
+
else {
|
33
|
+
loadConfigPromise = firstValueFrom(this.http.get((this.defaultConfig && this.defaultConfig['remoteConfigURL']) || 'assets/env.json'));
|
34
|
+
}
|
35
|
+
}
|
36
|
+
loadConfigPromise
|
37
|
+
.then(async (config) => {
|
38
|
+
if (config) {
|
39
|
+
await this.config$.publish({ ...this.defaultConfig, ...config }).then(() => {
|
40
|
+
resolve(true);
|
41
|
+
});
|
42
|
+
}
|
43
|
+
})
|
44
|
+
.catch((e) => {
|
45
|
+
console.log(`Failed to load env configuration`);
|
46
|
+
reject(e);
|
47
|
+
});
|
48
|
+
});
|
49
|
+
}
|
50
|
+
get isInitialized() {
|
51
|
+
return this.config$.isInitialized;
|
52
|
+
}
|
53
|
+
getProperty(key) {
|
54
|
+
if (!Object.values(CONFIG_KEY).includes(key)) {
|
55
|
+
console.error('Invalid config key ', key);
|
56
|
+
}
|
57
|
+
return this.config$.getValue()?.[key];
|
58
|
+
}
|
59
|
+
async setProperty(key, val) {
|
60
|
+
const currentValues = await firstValueFrom(this.config$.asObservable());
|
61
|
+
currentValues[key] = val;
|
62
|
+
await this.config$.publish(currentValues);
|
63
|
+
}
|
64
|
+
getConfig() {
|
65
|
+
return this.config$.getValue();
|
66
|
+
}
|
67
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: ConfigurationService, deps: [{ token: i1.HttpClient }, { token: APP_CONFIG, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
68
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: ConfigurationService, providedIn: 'root' }); }
|
69
|
+
}
|
70
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: ConfigurationService, decorators: [{
|
71
|
+
type: Injectable,
|
72
|
+
args: [{ providedIn: 'root' }]
|
73
|
+
}], ctorParameters: () => [{ type: i1.HttpClient }, { type: undefined, decorators: [{
|
74
|
+
type: Optional
|
75
|
+
}, {
|
76
|
+
type: Inject,
|
77
|
+
args: [APP_CONFIG]
|
78
|
+
}] }] });
|
79
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29uZmlndXJhd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uZGVmYXVsdENvbmZpZyB8fCB7fSlcbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICBsb2FkQ29uZmlnUHJvbWlzZSA9IGZpcnN0VmFsdWVGcm9tKFxuICAgICAgICAgICAgdGhpcy5odHRwLmdldDxDb25maWc+KCh0aGlzLmRlZmF1bHRDb25maWcgJiYgdGhpcy5kZWZhdWx0Q29uZmlnWydyZW1vdGVDb25maWdVUkwnXSkgfHwgJ2Fzc2V0cy9lbnYuanNvbicpXG4gICAgICAgICAgKVxuICAgICAgICB9XG4gICAgICB9XG5cbiAgICAgIGxvYWRDb25maWdQcm9taXNlXG4gICAgICAgIC50aGVuKGFzeW5jIChjb25maWcpID0+IHtcbiAgICAgICAgICBpZiAoY29uZmlnKSB7XG4gICAgICAgICAgICBhd2FpdCB0aGlzLmNvbmZpZyQucHVibGlzaCh7IC4uLnRoaXMuZGVmYXVsdENvbmZpZywgLi4uY29uZmlnIH0pLnRoZW4oKCkgPT4ge1xuICAgICAgICAgICAgICByZXNvbHZlKHRydWUpXG4gICAgICAgICAgICB9KVxuICAgICAgICAgIH1cbiAgICAgICAgfSlcbiAgICAgICAgLmNhdGNoKChlKSA9PiB7XG4gICAgICAgICAgY29uc29sZS5sb2coYEZhaWxlZCB0byBsb2FkIGVudiBjb25maWd1cmF0aW9uYClcbiAgICAgICAgICByZWplY3QoZSlcbiAgICAgICAgfSlcbiAgICB9KVxuICB9XG5cbiAgZ2V0IGlzSW5pdGlhbGl6ZWQoKTogUHJvbWlzZTx2b2lkPiB7XG4gICAgcmV0dXJuIHRoaXMuY29uZmlnJC5pc0luaXRpYWxpemVkXG4gIH1cblxuICBwdWJsaWMgZ2V0UHJvcGVydHkoa2V5OiBDT05GSUdfS0VZKTogc3RyaW5nIHwgdW5kZWZpbmVkIHtcbiAgICBpZiAoIU9iamVjdC52YWx1ZXMoQ09ORklHX0tFWSkuaW5jbHVkZXMoa2V5KSkge1xuICAgICAgY29uc29sZS5lcnJvcignSW52YWxpZCBjb25maWcga2V5ICcsIGtleSlcbiAgICB9XG4gICAgcmV0dXJuIHRoaXMuY29uZmlnJC5nZXRWYWx1ZSgpPy5ba2V5XVxuICB9XG5cbiAgcHVibGljIGFzeW5jIHNldFByb3BlcnR5KGtleTogc3RyaW5nLCB2YWw6IHN0cmluZykge1xuICAgIGNvbnN0IGN1cnJlbnRWYWx1ZXMgPSBhd2FpdCBmaXJzdFZhbHVlRnJvbSh0aGlzLmNvbmZpZyQuYXNPYnNlcnZhYmxlKCkpXG4gICAgY3VycmVudFZhbHVlc1trZXldID0gdmFsXG4gICAgYXdhaXQgdGhpcy5jb25maWckLnB1Ymxpc2goY3VycmVudFZhbHVlcylcbiAgfVxuXG4gIHB1YmxpYyBnZXRDb25maWcoKTogQ29uZmlnIHwgdW5kZWZpbmVkIHtcbiAgICByZXR1cm4gdGhpcy5jb25maWckLmdldFZhbHVlKClcbiAgfVxufVxuIl19
|
@@ -0,0 +1,60 @@
|
|
1
|
+
import { Injectable } from '@angular/core';
|
2
|
+
import { TranslateService } from '@ngx-translate/core';
|
3
|
+
import { filter, from, isObservable, map, mergeMap, of, tap, zip } from 'rxjs';
|
4
|
+
import { AppStateService } from './app-state.service';
|
5
|
+
import { ConfigurationService } from './configuration.service';
|
6
|
+
import { UserService } from './user.service';
|
7
|
+
import * as i0 from "@angular/core";
|
8
|
+
import * as i1 from "@ngx-translate/core";
|
9
|
+
import * as i2 from "./configuration.service";
|
10
|
+
import * as i3 from "./app-state.service";
|
11
|
+
import * as i4 from "./user.service";
|
12
|
+
export class InitializeModuleGuard {
|
13
|
+
constructor(translateService, configService, appStateService, userService) {
|
14
|
+
this.translateService = translateService;
|
15
|
+
this.configService = configService;
|
16
|
+
this.appStateService = appStateService;
|
17
|
+
this.userService = userService;
|
18
|
+
this.SUPPORTED_LANGS = ['en', 'de'];
|
19
|
+
this.DEFAULT_LANG = 'en';
|
20
|
+
}
|
21
|
+
canActivate(_route, _state) {
|
22
|
+
console.time('InitializeModuleGuard');
|
23
|
+
return zip([
|
24
|
+
this.loadTranslations(),
|
25
|
+
from(this.configService.isInitialized),
|
26
|
+
from(this.userService.isInitialized),
|
27
|
+
from(this.appStateService.currentWorkspace$.isInitialized),
|
28
|
+
]).pipe(tap(() => {
|
29
|
+
console.timeEnd('InitializeModuleGuard');
|
30
|
+
}), map(() => true));
|
31
|
+
}
|
32
|
+
getBestMatchLanguage(lang) {
|
33
|
+
if (this.SUPPORTED_LANGS.includes(lang)) {
|
34
|
+
return lang;
|
35
|
+
}
|
36
|
+
else {
|
37
|
+
console.log(`${lang} is not supported. Using ${this.DEFAULT_LANG} as a fallback.`);
|
38
|
+
}
|
39
|
+
return this.DEFAULT_LANG;
|
40
|
+
}
|
41
|
+
loadTranslations() {
|
42
|
+
return this.userService.lang$.pipe(filter((v) => v !== undefined), mergeMap((lang) => {
|
43
|
+
const bestMatchLang = this.getBestMatchLanguage(lang);
|
44
|
+
return this.translateService.use(bestMatchLang);
|
45
|
+
}), mergeMap(() => of(true)));
|
46
|
+
}
|
47
|
+
toObservable(canActivateResult) {
|
48
|
+
if (isObservable(canActivateResult)) {
|
49
|
+
return canActivateResult;
|
50
|
+
}
|
51
|
+
return from(Promise.resolve(canActivateResult));
|
52
|
+
}
|
53
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: InitializeModuleGuard, deps: [{ token: i1.TranslateService }, { token: i2.ConfigurationService }, { token: i3.AppStateService }, { token: i4.UserService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
54
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: InitializeModuleGuard, providedIn: 'any' }); }
|
55
|
+
}
|
56
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: InitializeModuleGuard, decorators: [{
|
57
|
+
type: Injectable,
|
58
|
+
args: [{ providedIn: 'any' }]
|
59
|
+
}], ctorParameters: () => [{ type: i1.TranslateService }, { type: i2.ConfigurationService }, { type: i3.AppStateService }, { type: i4.UserService }] });
|
60
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5pdGlhbGl6ZS1tb2R1bGUtZ3VhcmQuc2VydmljZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uL2xpYnMvYW5ndWxhci1pbnRlZ3JhdGlvbi1pbnRlcmZhY2Uvc3JjL2xpYi9zZXJ2aWNlcy9pbml0aWFsaXplLW1vZHVsZS1ndWFyZC5zZXJ2aWNlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxVQUFVLEVBQUUsTUFBTSxlQUFlLENBQUE7QUFFMUMsT0FBTyxFQUFFLGdCQUFnQixFQUFFLE1BQU0scUJBQXFCLENBQUE7QUFDdEQsT0FBTyxFQUFFLE1BQU0sRUFBRSxJQUFJLEVBQUUsWUFBWSxFQUFFLEdBQUcsRUFBRSxRQUFRLEVBQWMsRUFBRSxFQUFFLEdBQUcsRUFBRSxHQUFHLEVBQUUsTUFBTSxNQUFNLENBQUE7QUFDMUYsT0FBTyxFQUFFLGVBQWUsRUFBRSxNQUFNLHFCQUFxQixDQUFDO0FBQ3RELE9BQU8sRUFBRSxvQkFBb0IsRUFBRSxNQUFNLHlCQUF5QixDQUFDO0FBQy9ELE9BQU8sRUFBRSxXQUFXLEVBQUUsTUFBTSxnQkFBZ0IsQ0FBQzs7Ozs7O0FBRzdDLE1BQU0sT0FBTyxxQkFBcUI7SUFHaEMsWUFDWSxnQkFBa0MsRUFDbEMsYUFBbUMsRUFDbkMsZUFBZ0MsRUFDaEMsV0FBd0I7UUFIeEIscUJBQWdCLEdBQWhCLGdCQUFnQixDQUFrQjtRQUNsQyxrQkFBYSxHQUFiLGFBQWEsQ0FBc0I7UUFDbkMsb0JBQWUsR0F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2VyU2VydmljZS5sYW5nJC5waXBlKFxuICAgICAgZmlsdGVyKCh2KSA9PiB2ICE9PSB1bmRlZmluZWQpLFxuICAgICAgbWVyZ2VNYXAoKGxhbmcpID0+IHtcbiAgICAgICAgY29uc3QgYmVzdE1hdGNoTGFuZyA9IHRoaXMuZ2V0QmVzdE1hdGNoTGFuZ3VhZ2UobGFuZyBhcyBzdHJpbmcpXG4gICAgICAgIHJldHVybiB0aGlzLnRyYW5zbGF0ZVNlcnZpY2UudXNlKGJlc3RNYXRjaExhbmcpXG4gICAgICB9KSxcbiAgICAgIG1lcmdlTWFwKCgpID0+IG9mKHRydWUpKVxuICAgIClcbiAgfVxuXG4gIHByb3RlY3RlZCB0b09ic2VydmFibGUoXG4gICAgY2FuQWN0aXZhdGVSZXN1bHQ6IE9ic2VydmFibGU8Ym9vbGVhbiB8IFVybFRyZWU+IHwgUHJvbWlzZTxib29sZWFuIHwgVXJsVHJlZT4gfCBib29sZWFuIHwgVXJsVHJlZVxuICApOiBPYnNlcnZhYmxlPGJvb2xlYW4gfCBVcmxUcmVlPiB7XG4gICAgaWYgKGlzT2JzZXJ2YWJsZShjYW5BY3RpdmF0ZVJlc3VsdCkpIHtcbiAgICAgIHJldHVybiBjYW5BY3RpdmF0ZVJlc3VsdFxuICAgIH1cbiAgICByZXR1cm4gZnJvbShQcm9taXNlLnJlc29sdmUoY2FuQWN0aXZhdGVSZXN1bHQpKVxuICB9XG59XG4iXX0=
|
@@ -0,0 +1,49 @@
|
|
1
|
+
import { Injectable } from '@angular/core';
|
2
|
+
import { TranslateService } from '@ngx-translate/core';
|
3
|
+
import { combineLatest, first, of } from 'rxjs';
|
4
|
+
import { MessageTopic } from '@onecx/integration-interface';
|
5
|
+
import * as i0 from "@angular/core";
|
6
|
+
import * as i1 from "@ngx-translate/core";
|
7
|
+
export class PortalMessageService {
|
8
|
+
constructor(translateService) {
|
9
|
+
this.translateService = translateService;
|
10
|
+
this.message$ = new MessageTopic();
|
11
|
+
}
|
12
|
+
success(msg) {
|
13
|
+
this.addTranslated('success', msg);
|
14
|
+
}
|
15
|
+
info(msg) {
|
16
|
+
this.addTranslated('info', msg);
|
17
|
+
}
|
18
|
+
error(msg) {
|
19
|
+
this.addTranslated('error', msg);
|
20
|
+
}
|
21
|
+
warning(msg) {
|
22
|
+
this.addTranslated('warning', msg);
|
23
|
+
}
|
24
|
+
addTranslated(severity, msg) {
|
25
|
+
combineLatest([
|
26
|
+
msg.summaryKey ? this.translateService.get(msg.summaryKey || '', msg.summaryParameters) : of(undefined),
|
27
|
+
msg.detailKey ? this.translateService.get(msg.detailKey, msg.detailParameters) : of(undefined),
|
28
|
+
])
|
29
|
+
.pipe(first())
|
30
|
+
.subscribe(([summaryTranslation, detailTranslation]) => {
|
31
|
+
this.message$.publish({
|
32
|
+
...msg,
|
33
|
+
severity: severity,
|
34
|
+
summary: summaryTranslation,
|
35
|
+
detail: detailTranslation,
|
36
|
+
});
|
37
|
+
});
|
38
|
+
}
|
39
|
+
ngOnDestroy() {
|
40
|
+
this.message$.destroy();
|
41
|
+
}
|
42
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: PortalMessageService, deps: [{ token: i1.TranslateService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
43
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: PortalMessageService, providedIn: 'any' }); }
|
44
|
+
}
|
45
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: PortalMessageService, decorators: [{
|
46
|
+
type: Injectable,
|
47
|
+
args: [{ providedIn: 'any' }]
|
48
|
+
}], ctorParameters: () => [{ type: i1.TranslateService }] });
|
49
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicG9ydGFsLW1lc3NhZ2Uuc2VydmljZS5qcyIsInNvdXJjZVJvb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gICB9KVxuICB9XG5cbiAgbmdPbkRlc3Ryb3koKTogdm9pZCB7XG4gICAgdGhpcy5tZXNzYWdlJC5kZXN0cm95KClcbiAgfVxufVxuIl19
|
@@ -8,11 +8,11 @@ export class RemoteComponentsService {
|
|
8
8
|
ngOnDestroy() {
|
9
9
|
this.remoteComponents$.destroy();
|
10
10
|
}
|
11
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: RemoteComponentsService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
12
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: RemoteComponentsService, providedIn: 'root' }); }
|
11
13
|
}
|
12
|
-
|
13
|
-
RemoteComponentsService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: RemoteComponentsService, providedIn: 'root' });
|
14
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: RemoteComponentsService, decorators: [{
|
14
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: RemoteComponentsService, decorators: [{
|
15
15
|
type: Injectable,
|
16
16
|
args: [{ providedIn: 'root' }]
|
17
17
|
}] });
|
18
|
-
//# sourceMappingURL=data:application/json;base64,
|
18
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicmVtb3RlLWNvbXBvbmVudHMuc2VydmljZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uL2xpYnMvYW5ndWxhci1pbnRlZ3JhdGlvbi1pbnRlcmZhY2Uvc3JjL2xpYi9zZXJ2aWNlcy9yZW1vdGUtY29tcG9uZW50cy5zZXJ2aWNlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxVQUFVLEVBQWEsTUFBTSxlQUFlLENBQUE7QUFDckQsT0FBTyxFQUFFLHFCQUFxQixFQUFFLE1BQU0sOEJBQThCLENBQUE7O0FBR3BFLE1BQU0sT0FBTyx1QkFBdUI7SUFEcEM7UUFFRSxzQkFBaUIsR0FBRyxJQUFJLHFCQUFxQixFQUFFLENBQUE7S0FLaEQ7SUFIQyxXQUFXO1FBQ1QsSUFBSSxDQUFDLGlCQUFpQixDQUFDLE9BQU8sRUFBRSxDQUFBO0lBQ2xDLENBQUM7OEdBTFUsdUJBQXVCO2tIQUF2Qix1QkFBdUIsY0FEVixNQUFNOzsyRkFDbkIsdUJBQXVCO2tCQURuQyxVQUFVO21CQUFDLEVBQUUsVUFBVSxFQUFFLE1BQU0sRUFBRSIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IEluamVjdGFibGUsIE9uRGVzdHJveSB9IGZyb20gJ0Bhbmd1bGFyL2NvcmUnXG5pbXBvcnQgeyBSZW1vdGVDb21wb25lbnRzVG9waWMgfSBmcm9tICdAb25lY3gvaW50ZWdyYXRpb24taW50ZXJmYWNlJ1xuXG5ASW5qZWN0YWJsZSh7IHByb3ZpZGVkSW46ICdyb290JyB9KVxuZXhwb3J0IGNsYXNzIFJlbW90ZUNvbXBvbmVudHNTZXJ2aWNlIGltcGxlbWVudHMgT25EZXN0cm95IHtcbiAgcmVtb3RlQ29tcG9uZW50cyQgPSBuZXcgUmVtb3RlQ29tcG9uZW50c1RvcGljKClcblxuICBuZ09uRGVzdHJveSgpOiB2b2lkIHtcbiAgICB0aGlzLnJlbW90ZUNvbXBvbmVudHMkLmRlc3Ryb3koKVxuICB9XG59XG4iXX0=
|
@@ -38,11 +38,11 @@ export class ThemeService {
|
|
38
38
|
ngOnDestroy() {
|
39
39
|
this.currentTheme$.destroy();
|
40
40
|
}
|
41
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: ThemeService, deps: [{ token: i1.ConfigurationService }, { token: i2.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
42
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: ThemeService, providedIn: 'root' }); }
|
41
43
|
}
|
42
|
-
|
43
|
-
ThemeService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ThemeService, providedIn: 'root' });
|
44
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ThemeService, decorators: [{
|
44
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: ThemeService, decorators: [{
|
45
45
|
type: Injectable,
|
46
46
|
args: [{ providedIn: 'root' }]
|
47
|
-
}], ctorParameters:
|
48
|
-
//# sourceMappingURL=data:application/json;base64,
|
47
|
+
}], ctorParameters: () => [{ type: i1.ConfigurationService }, { type: i2.HttpClient }] });
|
48
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGhlbWUuc2VydmljZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uL2xpYnMvYW5ndWxhci1pbnRlZ3JhdGlvbi1pbnRlcmZhY2Uvc3JjL2xpYi9zZXJ2aWNlcy90aGVtZS5zZXJ2aWNlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxVQUFVLEVBQUUsTUFBTSxzQkFBc0IsQ0FBQTtBQUNqRCxPQUFPLEVBQUUsVUFBVSxFQUFhLE1BQU0sZUFBZSxDQUFBO0FBQ3JELE9BQU8sRUFBRSxJQUFJLEVBQUUsR0FBRyxFQUFFLFFBQVEsRUFBRSxNQUFNLE1BQU0sQ0FBQTtBQUMxQyxPQUFPLEVB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|
+
import { BehaviorSubject, map, filter, firstValueFrom, skip } from 'rxjs';
|
3
|
+
import { PermissionsTopic, UserProfileTopic } from '@onecx/integration-interface';
|
4
|
+
import { DEFAULT_LANG } from '../api/constants';
|
5
|
+
import * as i0 from "@angular/core";
|
6
|
+
export class UserService {
|
7
|
+
constructor() {
|
8
|
+
this.profile$ = new UserProfileTopic();
|
9
|
+
this.permissions$ = new BehaviorSubject([]);
|
10
|
+
this.lang$ = new BehaviorSubject(this.determineLanguage() ?? DEFAULT_LANG);
|
11
|
+
this.permissionsTopic$ = new PermissionsTopic();
|
12
|
+
this.profile$
|
13
|
+
.pipe(map((profile) => profile.accountSettings?.localeAndTimeSettings?.locale ?? this.determineLanguage() ?? DEFAULT_LANG))
|
14
|
+
.subscribe(this.lang$);
|
15
|
+
this.oldStylePermissionsInitialized = firstValueFrom(this.permissions$.pipe(skip(1)));
|
16
|
+
this.profile$
|
17
|
+
.pipe(map((profile) => this.extractPermissions(profile)), filter((permissions) => !!permissions))
|
18
|
+
.subscribe(this.permissions$);
|
19
|
+
}
|
20
|
+
ngOnDestroy() {
|
21
|
+
this.profile$.destroy();
|
22
|
+
}
|
23
|
+
hasPermission(permissionKey) {
|
24
|
+
const oldConceptResult = this.permissions$.getValue()
|
25
|
+
? this.permissions$.getValue()?.includes(permissionKey)
|
26
|
+
: false;
|
27
|
+
const result = this.permissionsTopic$.getValue()
|
28
|
+
? this.permissionsTopic$.getValue()?.includes(permissionKey)
|
29
|
+
: oldConceptResult;
|
30
|
+
if (!result) {
|
31
|
+
console.log(`👮♀️ No permission for: ${permissionKey}`);
|
32
|
+
}
|
33
|
+
return !!result;
|
34
|
+
}
|
35
|
+
determineLanguage() {
|
36
|
+
if (typeof window === 'undefined' || typeof window.navigator === 'undefined') {
|
37
|
+
return undefined;
|
38
|
+
}
|
39
|
+
let browserLang = window.navigator.languages ? window.navigator.languages[0] : null;
|
40
|
+
browserLang = browserLang || window.navigator.language;
|
41
|
+
if (typeof browserLang === 'undefined') {
|
42
|
+
return undefined;
|
43
|
+
}
|
44
|
+
if (browserLang.indexOf('-') !== -1) {
|
45
|
+
browserLang = browserLang.split('-')[0];
|
46
|
+
}
|
47
|
+
if (browserLang.indexOf('_') !== -1) {
|
48
|
+
browserLang = browserLang.split('_')[0];
|
49
|
+
}
|
50
|
+
return browserLang;
|
51
|
+
}
|
52
|
+
extractPermissions(userProfile) {
|
53
|
+
if (userProfile) {
|
54
|
+
if (userProfile.memberships) {
|
55
|
+
const permissions = [];
|
56
|
+
userProfile.memberships.forEach((m) => {
|
57
|
+
m.roleMemberships?.forEach((r) => {
|
58
|
+
r.permissions?.forEach((p) => {
|
59
|
+
if (p) {
|
60
|
+
if (p.key !== undefined) {
|
61
|
+
permissions.push(p.key);
|
62
|
+
}
|
63
|
+
}
|
64
|
+
});
|
65
|
+
});
|
66
|
+
});
|
67
|
+
return permissions;
|
68
|
+
}
|
69
|
+
}
|
70
|
+
return null;
|
71
|
+
}
|
72
|
+
get isInitialized() {
|
73
|
+
return Promise.all([
|
74
|
+
Promise.race([this.permissionsTopic$.isInitialized, this.oldStylePermissionsInitialized]),
|
75
|
+
this.profile$.isInitialized,
|
76
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
77
|
+
]).then(() => { });
|
78
|
+
}
|
79
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: UserService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
80
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: UserService, providedIn: 'root' }); }
|
81
|
+
}
|
82
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: UserService, decorators: [{
|
83
|
+
type: Injectable,
|
84
|
+
args: [{ providedIn: 'root' }]
|
85
|
+
}], ctorParameters: () => [] });
|
86
|
+
//# sourceMappingURL=data:application/json;base64,eyJ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dfJykgIT09IC0xKSB7XG4gICAgICBicm93c2VyTGFuZyA9IGJyb3dzZXJMYW5nLnNwbGl0KCdfJylbMF1cbiAgICB9XG5cbiAgICByZXR1cm4gYnJvd3NlckxhbmdcbiAgfVxuXG4gIHByaXZhdGUgZXh0cmFjdFBlcm1pc3Npb25zKHVzZXJQcm9maWxlOiBVc2VyUHJvZmlsZSkge1xuICAgIGlmICh1c2VyUHJvZmlsZSkge1xuICAgICAgaWYgKHVzZXJQcm9maWxlLm1lbWJlcnNoaXBzKSB7XG4gICAgICAgIGNvbnN0IHBlcm1pc3Npb25zOiBzdHJpbmdbXSA9IFtdXG4gICAgICAgIHVzZXJQcm9maWxlLm1lbWJlcnNoaXBzLmZvckVhY2goKG0pID0+IHtcbiAgICAgICAgICBtLnJvbGVNZW1iZXJzaGlwcz8uZm9yRWFjaCgocikgPT4ge1xuICAgICAgICAgICAgci5wZXJtaXNzaW9ucz8uZm9yRWFjaCgocCkgPT4ge1xuICAgICAgICAgICAgICBpZiAocCkge1xuICAgICAgICAgICAgICAgIGlmIChwLmtleSAhPT0gdW5kZWZpbmVkKSB7XG4gICAgICAgICAgICAgICAgICBwZXJtaXNzaW9ucy5wdXNoKHAua2V5KVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSlcbiAgICAgICAgICB9KVxuICAgICAgICB9KVxuICAgICAgICByZXR1cm4gcGVybWlzc2lvbnNcbiAgICAgIH1cbiAgICB9XG4gICAgcmV0dXJuIG51bGxcbiAgfVxuXG4gIGdldCBpc0luaXRpYWxpemVkKCk6IFByb21pc2U8dm9pZD4ge1xuICAgIHJldHVybiBQcm9taXNlLmFsbChbXG4gICAgICBQcm9taXNlLnJhY2UoW3RoaXMucGVybWlzc2lvbnNUb3BpYyQuaXNJbml0aWFsaXplZCwgdGhpcy5vbGRTdHlsZVBlcm1pc3Npb25zSW5pdGlhbGl6ZWRdKSxcbiAgICAgIHRoaXMucHJvZmlsZSQuaXNJbml0aWFsaXplZCxcbiAgICAgIC8vIGVzbGludC1kaXNhYmxlLW5leHQtbGluZSBAdHlwZXNjcmlwdC1lc2xpbnQvbm8tZW1wdHktZnVuY3Rpb25cbiAgICBdKS50aGVuKCgpID0+IHt9KVxuICB9XG59XG4iXX0=
|
@@ -0,0 +1,124 @@
|
|
1
|
+
import { Injectable } from '@angular/core';
|
2
|
+
import { AppStateService } from './app-state.service';
|
3
|
+
import { map } from 'rxjs';
|
4
|
+
import { Location } from '@angular/common';
|
5
|
+
import * as i0 from "@angular/core";
|
6
|
+
import * as i1 from "./app-state.service";
|
7
|
+
export class WorkspaceService {
|
8
|
+
constructor(appStateService) {
|
9
|
+
this.appStateService = appStateService;
|
10
|
+
this.aliasStart = '[[';
|
11
|
+
this.aliasEnd = ']]';
|
12
|
+
this.paramStart = '{';
|
13
|
+
this.paramEnd = '}';
|
14
|
+
}
|
15
|
+
getUrl(appId, productName, endpointName, params = {}) {
|
16
|
+
return this.appStateService.currentWorkspace$.pipe(map((workspace) => {
|
17
|
+
const finalUrl = this.constructRouteUrl(workspace, appId, productName, endpointName, params);
|
18
|
+
return finalUrl;
|
19
|
+
}));
|
20
|
+
}
|
21
|
+
constructBaseUrlFromWorkspace(workspace) {
|
22
|
+
if (workspace.baseUrl === undefined) {
|
23
|
+
console.log('WARNING: There was no baseUrl for received workspace.');
|
24
|
+
return '';
|
25
|
+
}
|
26
|
+
return workspace.baseUrl;
|
27
|
+
}
|
28
|
+
constructRouteUrl(workspace, appId, productName, endpointName, params) {
|
29
|
+
const route = this.filterRouteFromList(workspace.routes, appId, productName);
|
30
|
+
let url = this.constructBaseUrlFromWorkspace(workspace);
|
31
|
+
if (!route) {
|
32
|
+
console.log(`WARNING: No route.baseUrl could be found for given appId "${appId}" and productName "${productName}"`);
|
33
|
+
return url;
|
34
|
+
}
|
35
|
+
if (route.baseUrl !== undefined && route.baseUrl.length > 0) {
|
36
|
+
url = route.baseUrl;
|
37
|
+
}
|
38
|
+
url = Location.joinWithSlash(url, this.constructEndpointUrl(route, endpointName, params));
|
39
|
+
return url;
|
40
|
+
}
|
41
|
+
constructEndpointUrl(route, endpointName, params) {
|
42
|
+
if (!route.endpoints) {
|
43
|
+
return '';
|
44
|
+
}
|
45
|
+
const finalEndpoint = this.dissolveEndpoint(endpointName, route.endpoints);
|
46
|
+
if (!finalEndpoint || finalEndpoint.path === undefined) {
|
47
|
+
console.log('WARNING: No endpoint or endpoint.path could be found');
|
48
|
+
return '';
|
49
|
+
}
|
50
|
+
const paramsFilled = this.fillParamsForPath(finalEndpoint.path, params);
|
51
|
+
if (paramsFilled === undefined) {
|
52
|
+
console.log('WARNING: Params could not be filled correctly');
|
53
|
+
return '';
|
54
|
+
}
|
55
|
+
return paramsFilled;
|
56
|
+
}
|
57
|
+
filterRouteFromList(routes, appId, productName) {
|
58
|
+
if (!routes) {
|
59
|
+
return undefined;
|
60
|
+
}
|
61
|
+
const productRoutes = routes.filter((route) => route.appId === appId && route.productName === productName);
|
62
|
+
if (productRoutes.length === 0) {
|
63
|
+
return undefined;
|
64
|
+
}
|
65
|
+
if (productRoutes.length > 1) {
|
66
|
+
console.log('WARNING: There were more than one route. First route has been used.');
|
67
|
+
}
|
68
|
+
return productRoutes[0];
|
69
|
+
}
|
70
|
+
dissolveEndpoint(endpointName, endpoints) {
|
71
|
+
let endpoint = endpoints.find((ep) => ep.name === endpointName);
|
72
|
+
if (!endpoint) {
|
73
|
+
return undefined;
|
74
|
+
}
|
75
|
+
while (endpoint.path?.includes(this.aliasStart)) {
|
76
|
+
const path = endpoint.path;
|
77
|
+
const startIdx = path.indexOf(this.aliasStart) + this.aliasStart.length;
|
78
|
+
const endIdx = path.lastIndexOf(this.aliasEnd);
|
79
|
+
if (endIdx <= startIdx) {
|
80
|
+
return undefined;
|
81
|
+
}
|
82
|
+
const aliasName = path.substring(startIdx, endIdx);
|
83
|
+
endpoint = endpoints.find((ep) => ep.name === aliasName);
|
84
|
+
if (!endpoint) {
|
85
|
+
return undefined;
|
86
|
+
}
|
87
|
+
}
|
88
|
+
return endpoint;
|
89
|
+
}
|
90
|
+
fillParamsForPath(path, params) {
|
91
|
+
while (path.includes(this.paramStart)) {
|
92
|
+
const paramName = path.substring(path.indexOf(this.paramStart) + this.paramStart.length, path.indexOf(this.paramEnd));
|
93
|
+
const paramValue = this.getStringFromUnknown(params[paramName]);
|
94
|
+
if (paramValue != undefined && paramValue.length > 0) {
|
95
|
+
path = path.replace(this.paramStart.concat(paramName).concat(this.paramEnd), paramValue);
|
96
|
+
}
|
97
|
+
else {
|
98
|
+
console.log(`WARNING: Searched param "${paramName}" was not found in given param list `);
|
99
|
+
return '';
|
100
|
+
}
|
101
|
+
}
|
102
|
+
return path;
|
103
|
+
}
|
104
|
+
getStringFromUnknown(value) {
|
105
|
+
if (value === null || value === undefined) {
|
106
|
+
return '';
|
107
|
+
}
|
108
|
+
else if (typeof value === 'string') {
|
109
|
+
return value;
|
110
|
+
}
|
111
|
+
else {
|
112
|
+
return String(value);
|
113
|
+
}
|
114
|
+
}
|
115
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: WorkspaceService, deps: [{ token: i1.AppStateService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
116
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: WorkspaceService, providedIn: 'root' }); }
|
117
|
+
}
|
118
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: WorkspaceService, decorators: [{
|
119
|
+
type: Injectable,
|
120
|
+
args: [{
|
121
|
+
providedIn: 'root',
|
122
|
+
}]
|
123
|
+
}], ctorParameters: () => [{ type: i1.AppStateService }] });
|
124
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoid29ya3NwYWNlLnNlcnZpY2UuanMiLCJzb3VyY2VSb290IjoiIiwic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ICAgICBjb25zb2xlLmxvZyhgV0FSTklORzogU2VhcmNoZWQgcGFyYW0gXCIke3BhcmFtTmFtZX1cIiB3YXMgbm90IGZvdW5kIGluIGdpdmVuIHBhcmFtIGxpc3QgYClcbiAgICAgICAgcmV0dXJuICcnXG4gICAgICB9XG4gICAgfVxuICAgIHJldHVybiBwYXRoXG4gIH1cblxuICBwcml2YXRlIGdldFN0cmluZ0Zyb21Vbmtub3duKHZhbHVlOiB1bmtub3duKTogc3RyaW5nIHtcbiAgICBpZiAodmFsdWUgPT09IG51bGwgfHwgdmFsdWUgPT09IHVuZGVmaW5lZCkge1xuICAgICAgcmV0dXJuICcnXG4gICAgfSBlbHNlIGlmICh0eXBlb2YgdmFsdWUgPT09ICdzdHJpbmcnKSB7XG4gICAgICByZXR1cm4gdmFsdWVcbiAgICB9IGVsc2Uge1xuICAgICAgcmV0dXJuIFN0cmluZyh2YWx1ZSlcbiAgICB9XG4gIH1cbn1cbiJdfQ==
|
@@ -0,0 +1,17 @@
|
|
1
|
+
import { InitializeModuleGuard } from '../services/initialize-module-guard.service';
|
2
|
+
export function addInitializeModuleGuard(routes, initializeModuleGuard = InitializeModuleGuard) {
|
3
|
+
return routes.map((r) => {
|
4
|
+
if (r.redirectTo) {
|
5
|
+
return r;
|
6
|
+
}
|
7
|
+
const route = {
|
8
|
+
canActivate: [],
|
9
|
+
...r,
|
10
|
+
};
|
11
|
+
if (!route.canActivate.includes(initializeModuleGuard)) {
|
12
|
+
route.canActivate.push(initializeModuleGuard);
|
13
|
+
}
|
14
|
+
return route;
|
15
|
+
});
|
16
|
+
}
|
17
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYWRkLWluaXRpYWxpemUtbW9kdWxlLWd1YXJkLnV0aWxzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vbGlicy9hbmd1bGFyLWludGVncmF0aW9uLWludGVyZmFjZS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mQ6IHR5cGVvZiBJbml0aWFsaXplTW9kdWxlR3VhcmQgfCBDYW5BY3RpdmF0ZUZuID0gSW5pdGlhbGl6ZU1vZHVsZUd1YXJkXG4pOiBSb3V0ZVtdIHtcbiAgcmV0dXJuIHJvdXRlcy5tYXAoKHIpID0+IHtcbiAgICBpZiAoci5yZWRpcmVjdFRvKSB7XG4gICAgICByZXR1cm4gclxuICAgIH1cbiAgICBjb25zdCByb3V0ZSA9IHtcbiAgICAgIGNhbkFjdGl2YXRlOiBbXSxcbiAgICAgIC4uLnIsXG4gICAgfVxuICAgIGlmICghcm91dGUuY2FuQWN0aXZhdGUuaW5jbHVkZXMoaW5pdGlhbGl6ZU1vZHVsZUd1YXJkKSkge1xuICAgICAgcm91dGUuY2FuQWN0aXZhdGUucHVzaChpbml0aWFsaXplTW9kdWxlR3VhcmQpXG4gICAgfVxuICAgIHJldHVybiByb3V0ZVxuICB9KVxufSJdfQ==
|
@@ -22,10 +22,10 @@ export class AppStateServiceMock {
|
|
22
22
|
this.currentWorkspace$ = new FakeTopic({ baseUrl: '/', microfrontendRegistrations: [], portalName: 'Test workspace', workspaceName: 'Test workspace' });
|
23
23
|
this.isAuthenticated$ = new FakeTopic(null);
|
24
24
|
}
|
25
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: AppStateServiceMock, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
26
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: AppStateServiceMock }); }
|
25
27
|
}
|
26
|
-
|
27
|
-
AppStateServiceMock.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: AppStateServiceMock });
|
28
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: AppStateServiceMock, decorators: [{
|
28
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.5", ngImport: i0, type: AppStateServiceMock, decorators: [{
|
29
29
|
type: Injectable
|
30
30
|
}] });
|
31
|
-
//# sourceMappingURL=data:application/json;base64,
|
31
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXBwLXN0YXRlLXNlcnZpY2UtbW9jay5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uL2xpYnMvYW5ndWxhci1pbnRlZ3JhdGlvbi1pbnRlcmZhY2UvbW9ja3MvYXBwLXN0YXRlLXNlcnZpY2UtbW9jay50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsVUFBVSxFQUFFLE1BQU0sZUFBZSxDQUFBO0FBRTFDLDJCQUEyQjtBQUMzQixPQUFPLEVBQUUsZUFBZSxFQUFFLE1BQU0sc0NBQXNDLENBQUE7QUFDdEUsT0FBTyxFQUFFLFNBQVMsRUFBRSxNQUFNLGNBQWMsQ0FBQTs7QUFFeEM7O0dBRUc7QUFDSCxNQUFNLFVBQVUscUJBQXFCO0lBQ25DLE9BQU8sMEJBQTBCLEVBQUUsQ0FBQTtBQUNyQyxDQUFDO0FBRUQsTUFBTSxVQUFVLDBCQUEwQjtJQUN4QyxPQUFPLENBQUMsbUJBQW1CLEVBQUUsRUFBRSxPQUFPLEVBQUUsZUFBZSxFQUFFLFdBQVcsRUFBRSxtQkFBbUIsRUFBRSxDQUFDLENBQUE7QUFDOUYsQ0FBQztBQUdELE1BQU0sT0FBTyxtQkFBbUI7SUFEaEM7UUFFRSxpQkFBWSxHQUFHLElBQUksU0FBUyxFQUFFLENBQUE7UUFDOUIsbUJBQWMsR0FBRyxJQUFJLFNBQVMsQ0FBQyxLQUFLLENBQUMsQ0FBQTtRQUNyQyxnQkFBVyxHQUFHLElBQUksU0FBUyxDQUFDLEVBQUUsU0FBUyxFQUFFLE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