@onecx/angular-integration-interface 9.0.0-rc.8 → 9.0.0

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.
@@ -1,553 +1,809 @@
1
- import { Location } from '@angular/common';
2
- import { HttpClient } from '@angular/common/http';
3
- import * as i0 from '@angular/core';
4
- import { inject, Injectable, InjectionToken } from '@angular/core';
5
- import { BehaviorSubject, firstValueFrom, map, combineLatest, of, first } from 'rxjs';
6
- import { createLoggerFactory, getNormalizedBrowserLocales } from '@onecx/accelerator';
7
- import { GlobalErrorTopic, GlobalLoadingTopic, CurrentMfeTopic, CurrentLocationTopic, CurrentPageTopic, CurrentWorkspaceTopic, IsAuthenticatedTopic, ConfigurationTopic, resolveConfigPayload, PermissionsTopic, UserProfileTopic, determineBrowserLanguage, resolveProfileLanguage, resolveLegacyLanguage, setShellCapabilities, hasShellCapability, ParametersTopic, ShellCapability, findParameterValue, MessageTopic, buildPortalMessagePayload, CurrentThemeTopic, RemoteComponentsTopic, constructRouteUrl, doesUrlExistForWorkspace, ImageRepositoryService as ImageRepositoryService$1, IconService as IconService$1, DynamicTranslationService as DynamicTranslationService$1, NotificationService as NotificationService$1 } from '@onecx/integration-interface';
8
- export { ShellCapability as Capability } from '@onecx/integration-interface';
9
- import Semaphore from 'ts-semaphore';
10
- import { TranslateService } from '@ngx-translate/core';
11
-
12
- // This file is not planned to be in the index.ts so it is private to this lib
13
- const createLogger = createLoggerFactory('@onecx/angular-integration-interface');
14
-
15
- class AppConfigService {
16
- constructor() {
17
- this.http = inject(HttpClient);
18
- this.logger = createLogger('AppConfigService');
19
- this.config$ = new BehaviorSubject({});
20
- }
21
- init(baseUrl) {
22
- return new Promise((resolve, reject) => {
23
- const loadConfigPromise = firstValueFrom(this.http.get(Location.joinWithSlash(baseUrl, 'assets/env.json')));
24
- loadConfigPromise
25
- .then(async (config) => {
26
- if (config) {
27
- this.config$.next(config);
28
- resolve();
29
- }
30
- })
31
- .catch((e) => {
32
- this.logger.error('Failed to load env configuration', e);
33
- reject(e);
34
- });
35
- });
36
- }
37
- getProperty(key) {
38
- return this.config$.getValue()?.[key];
39
- }
40
- setProperty(key, val) {
41
- this.config$.next({ ...this.config$.value, [key]: val });
42
- }
43
- getConfig() {
44
- return this.config$.getValue();
45
- }
46
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: AppConfigService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
47
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: AppConfigService }); }
48
- }
49
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: AppConfigService, decorators: [{
50
- type: Injectable
51
- }] });
52
-
53
- class AppStateService {
54
- get globalError$() {
55
- this._globalError$ ??= new GlobalErrorTopic();
56
- return this._globalError$;
57
- }
58
- set globalError$(source) {
59
- this._globalError$ = source;
60
- }
61
- get globalLoading$() {
62
- this._globalLoading$ ??= new GlobalLoadingTopic();
63
- return this._globalLoading$;
64
- }
65
- set globalLoading$(source) {
66
- this._globalLoading$ = source;
67
- }
68
- get currentMfe$() {
69
- this._currentMfe$ ??= new CurrentMfeTopic();
70
- return this._currentMfe$;
71
- }
72
- set currentMfe$(source) {
73
- this._currentMfe$ = source;
74
- }
75
- get currentLocation$() {
76
- this._currentLocation$ ??= new CurrentLocationTopic();
77
- return this._currentLocation$;
78
- }
79
- set currentLocation$(source) {
80
- this._currentLocation$ = source;
81
- }
82
- /**
83
- * This topic will only fire when pageInfo.path matches document.location.pathname,
84
- * if not it will fire undefined.
85
- */
86
- get currentPage$() {
87
- this._currentPage$ ??= new CurrentPageTopic();
88
- return this._currentPage$;
89
- }
90
- set currentPage$(source) {
91
- this._currentPage$ = source;
92
- }
93
- get currentWorkspace$() {
94
- this._currentWorkspace$ ??= new CurrentWorkspaceTopic();
95
- return this._currentWorkspace$;
96
- }
97
- set currentWorkspace$(source) {
98
- this._currentWorkspace$ = source;
99
- }
100
- get isAuthenticated$() {
101
- this._isAuthenticated$ ??= new IsAuthenticatedTopic();
102
- return this._isAuthenticated$;
103
- }
104
- set isAuthenticated$(source) {
105
- this._isAuthenticated$ = source;
106
- }
107
- ngOnDestroy() {
108
- this._globalError$?.destroy();
109
- this._globalLoading$?.destroy();
110
- this._currentMfe$?.destroy();
111
- this._currentPage$?.destroy();
112
- this._currentLocation$?.destroy();
113
- this._currentWorkspace$?.destroy();
114
- this._isAuthenticated$?.destroy();
115
- }
116
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: AppStateService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
117
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: AppStateService, providedIn: 'root' }); }
118
- }
119
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: AppStateService, decorators: [{
120
- type: Injectable,
121
- args: [{ providedIn: 'root' }]
122
- }] });
123
-
124
- const APP_CONFIG = new InjectionToken('APP_CONFIG');
125
- const SANITY_CHECK = new InjectionToken('OCXSANITY_CHECK');
126
- const APPLICATION_NAME = new InjectionToken('APPLICATION_NAME');
127
-
1
+ import { Location } from "@angular/common";
2
+ import { HttpClient } from "@angular/common/http";
3
+ import * as i0 from "@angular/core";
4
+ import { Injectable, InjectionToken, inject } from "@angular/core";
5
+ import { BehaviorSubject, combineLatest, first, firstValueFrom, map, of } from "rxjs";
6
+ import { createLoggerFactory, getNormalizedBrowserLocales } from "@onecx/accelerator";
7
+ import { ConfigurationTopic, CurrentLocationTopic, CurrentMfeTopic, CurrentPageTopic, CurrentThemeTopic, CurrentWorkspaceTopic, DynamicTranslationService as DynamicTranslationService$1, GlobalErrorTopic, GlobalLoadingTopic, IconService as IconService$1, ImageRepositoryService as ImageRepositoryService$1, IsAuthenticatedTopic, MessageTopic, NotificationService as NotificationService$1, ParametersTopic, PermissionsTopic, RemoteComponentsTopic, ShellCapability, ShellCapability as Capability, UserProfileTopic, buildPortalMessagePayload, constructRouteUrl, determineBrowserLanguage, doesUrlExistForWorkspace, findParameterValue, hasShellCapability, resolveConfigPayload, resolveLegacyLanguage, resolveProfileLanguage, setShellCapabilities } from "@onecx/integration-interface";
8
+ import Semaphore from "ts-semaphore";
9
+ import { TranslateService } from "@ngx-translate/core";
10
+ const createLogger = createLoggerFactory("@onecx/angular-integration-interface");
11
+ var AppConfigService = class AppConfigService {
12
+ constructor() {
13
+ this.http = inject(HttpClient);
14
+ this.logger = createLogger("AppConfigService");
15
+ this.config$ = new BehaviorSubject({});
16
+ }
17
+ init(baseUrl) {
18
+ return new Promise((resolve, reject) => {
19
+ firstValueFrom(this.http.get(Location.joinWithSlash(baseUrl, "assets/env.json"))).then(async (config) => {
20
+ if (config) {
21
+ this.config$.next(config);
22
+ resolve();
23
+ }
24
+ }).catch((e) => {
25
+ this.logger.error("Failed to load env configuration", e);
26
+ reject(e);
27
+ });
28
+ });
29
+ }
30
+ getProperty(key) {
31
+ return this.config$.getValue()?.[key];
32
+ }
33
+ setProperty(key, val) {
34
+ this.config$.next({
35
+ ...this.config$.value,
36
+ [key]: val
37
+ });
38
+ }
39
+ getConfig() {
40
+ return this.config$.getValue();
41
+ }
42
+ static {
43
+ this.ɵfac = i0.ɵɵngDeclareFactory({
44
+ minVersion: "12.0.0",
45
+ version: "22.2.0",
46
+ ngImport: i0,
47
+ type: AppConfigService,
48
+ deps: [],
49
+ target: i0.ɵɵFactoryTarget.Injectable
50
+ });
51
+ }
52
+ static {
53
+ this.ɵprov = i0.ɵɵngDeclareInjectable({
54
+ minVersion: "12.0.0",
55
+ version: "22.2.0",
56
+ ngImport: i0,
57
+ type: AppConfigService
58
+ });
59
+ }
60
+ };
61
+ i0.ɵɵngDeclareClassMetadata({
62
+ minVersion: "12.0.0",
63
+ version: "22.2.0",
64
+ ngImport: i0,
65
+ type: AppConfigService,
66
+ decorators: [{ type: Injectable }]
67
+ });
68
+ var AppStateService = class AppStateService {
69
+ get globalError$() {
70
+ this._globalError$ ??= new GlobalErrorTopic();
71
+ return this._globalError$;
72
+ }
73
+ set globalError$(source) {
74
+ this._globalError$ = source;
75
+ }
76
+ get globalLoading$() {
77
+ this._globalLoading$ ??= new GlobalLoadingTopic();
78
+ return this._globalLoading$;
79
+ }
80
+ set globalLoading$(source) {
81
+ this._globalLoading$ = source;
82
+ }
83
+ get currentMfe$() {
84
+ this._currentMfe$ ??= new CurrentMfeTopic();
85
+ return this._currentMfe$;
86
+ }
87
+ set currentMfe$(source) {
88
+ this._currentMfe$ = source;
89
+ }
90
+ get currentLocation$() {
91
+ this._currentLocation$ ??= new CurrentLocationTopic();
92
+ return this._currentLocation$;
93
+ }
94
+ set currentLocation$(source) {
95
+ this._currentLocation$ = source;
96
+ }
97
+ get currentPage$() {
98
+ this._currentPage$ ??= new CurrentPageTopic();
99
+ return this._currentPage$;
100
+ }
101
+ set currentPage$(source) {
102
+ this._currentPage$ = source;
103
+ }
104
+ get currentWorkspace$() {
105
+ this._currentWorkspace$ ??= new CurrentWorkspaceTopic();
106
+ return this._currentWorkspace$;
107
+ }
108
+ set currentWorkspace$(source) {
109
+ this._currentWorkspace$ = source;
110
+ }
111
+ get isAuthenticated$() {
112
+ this._isAuthenticated$ ??= new IsAuthenticatedTopic();
113
+ return this._isAuthenticated$;
114
+ }
115
+ set isAuthenticated$(source) {
116
+ this._isAuthenticated$ = source;
117
+ }
118
+ ngOnDestroy() {
119
+ this._globalError$?.destroy();
120
+ this._globalLoading$?.destroy();
121
+ this._currentMfe$?.destroy();
122
+ this._currentPage$?.destroy();
123
+ this._currentLocation$?.destroy();
124
+ this._currentWorkspace$?.destroy();
125
+ this._isAuthenticated$?.destroy();
126
+ }
127
+ static {
128
+ this.ɵfac = i0.ɵɵngDeclareFactory({
129
+ minVersion: "12.0.0",
130
+ version: "22.2.0",
131
+ ngImport: i0,
132
+ type: AppStateService,
133
+ deps: [],
134
+ target: i0.ɵɵFactoryTarget.Injectable
135
+ });
136
+ }
137
+ static {
138
+ this.ɵprov = i0.ɵɵngDeclareInjectable({
139
+ minVersion: "12.0.0",
140
+ version: "22.2.0",
141
+ ngImport: i0,
142
+ type: AppStateService,
143
+ providedIn: "root"
144
+ });
145
+ }
146
+ };
147
+ i0.ɵɵngDeclareClassMetadata({
148
+ minVersion: "12.0.0",
149
+ version: "22.2.0",
150
+ ngImport: i0,
151
+ type: AppStateService,
152
+ decorators: [{
153
+ type: Injectable,
154
+ args: [{ providedIn: "root" }]
155
+ }]
156
+ });
157
+ const APP_CONFIG = new InjectionToken("APP_CONFIG");
158
+ const SANITY_CHECK = new InjectionToken("OCXSANITY_CHECK");
159
+ const APPLICATION_NAME = new InjectionToken("APPLICATION_NAME");
160
+ const DYNAMIC_CONTAINER = new InjectionToken("DYNAMIC_CONTAINER");
128
161
  var CONFIG_KEY;
129
- (function (CONFIG_KEY) {
130
- CONFIG_KEY["TKIT_PORTAL_DEFAULT_THEME"] = "TKIT_PORTAL_DEFAULT_THEME";
131
- CONFIG_KEY["TKIT_PORTAL_DISABLE_THEME_MANAGEMENT"] = "TKIT_PORTAL_DISABLE_THEME_MANAGEMENT";
132
- CONFIG_KEY["TKIT_PORTAL_THEME_SERVER_URL"] = "TKIT_PORTAL_THEME_SERVER_URL";
133
- CONFIG_KEY["TKIT_TOKEN_ROLE_CLAIM_NAME"] = "TKIT_TOKEN_ROLE_CLAIM_NAME";
134
- CONFIG_KEY["TKIT_PORTAL_ID"] = "TKIT_PORTAL_ID";
135
- CONFIG_KEY["TKIT_SUPPORTED_LANGUAGES"] = "TKIT_SUPPORTED_LANGUAGES";
136
- CONFIG_KEY["TKIT_SEARCH_BASE_URL"] = "TKIT_SEARCH_BASE_URL";
137
- CONFIG_KEY["APP_BASE_HREF"] = "APP_BASE_HREF";
138
- CONFIG_KEY["KEYCLOAK_REALM"] = "KEYCLOAK_REALM";
139
- CONFIG_KEY["KEYCLOAK_ENABLE_SILENT_SSO"] = "KEYCLOAK_ENABLE_SILENT_SSO";
140
- CONFIG_KEY["KEYCLOAK_URL"] = "KEYCLOAK_URL";
141
- CONFIG_KEY["KEYCLOAK_CLIENT_ID"] = "KEYCLOAK_CLIENT_ID";
142
- CONFIG_KEY["KEYCLOAK_TIME_SKEW"] = "KEYCLOAK_TIME_SKEW";
143
- CONFIG_KEY["KEYCLOAK_UPDATE_TOKEN_MIN_VALIDITY"] = "KEYCLOAK_UPDATE_TOKEN_MIN_VALIDITY";
144
- CONFIG_KEY["KEYCLOAK_ON_TOKEN_EXPIRED_ENABLED"] = "KEYCLOAK_ON_TOKEN_EXPIRED_ENABLED";
145
- CONFIG_KEY["KEYCLOAK_ON_AUTH_REFRESH_ERROR_ENABLED"] = "KEYCLOAK_ON_AUTH_REFRESH_ERROR_ENABLED";
146
- CONFIG_KEY["ONECX_PORTAL_FAVORITES_DISABLED"] = "ONECX_PORTAL_FAVORITES_DISABLED";
147
- CONFIG_KEY["ONECX_PORTAL_FEEDBACK_DISABLED"] = "ONECX_PORTAL_FEEDBACK_DISABLED";
148
- CONFIG_KEY["ONECX_PORTAL_SEARCH_DISABLED"] = "ONECX_PORTAL_SEARCH_DISABLED";
149
- CONFIG_KEY["ONECX_PORTAL_SUPPORT_TICKET_DISABLED"] = "ONECX_PORTAL_SUPPORT_TICKET_DISABLED";
150
- CONFIG_KEY["ONECX_PORTAL_ANNOUNCEMENTS_DISABLED"] = "ONECX_PORTAL_ANNOUNCEMENTS_DISABLED";
151
- CONFIG_KEY["ONECX_PORTAL_PASSWORD_CHANGE_DISABLED"] = "ONECX_PORTAL_PASSWORD_CHANGE_DISABLED";
152
- CONFIG_KEY["ONECX_PORTAL_SETTINGS_DISABLED"] = "ONECX_PORTAL_SETTINGS_DISABLED";
153
- CONFIG_KEY["ONECX_PORTAL_MY_ROLES_PERMISSIONS_DISABLED"] = "ONECX_PORTAL_MY_ROLES_PERMISSIONS_DISABLED";
154
- CONFIG_KEY["ONECX_PORTAL_HELP_DISABLED"] = "ONECX_PORTAL_HELP_DISABLED";
155
- CONFIG_KEY["ONECX_PORTAL_SEARCH_BUTTONS_REVERSED"] = "ONECX_PORTAL_SEARCH_BUTTONS_REVERSED";
156
- CONFIG_KEY["APP_VERSION"] = "APP_VERSION";
157
- CONFIG_KEY["IS_SHELL"] = "IS_SHELL";
158
- CONFIG_KEY["AUTH_SERVICE"] = "AUTH_SERVICE";
159
- CONFIG_KEY["AUTH_SERVICE_CUSTOM_URL"] = "AUTH_SERVICE_CUSTOM_URL";
160
- CONFIG_KEY["AUTH_SERVICE_CUSTOM_MODULE_NAME"] = "AUTH_SERVICE_CUSTOM_MODULE_NAME";
161
- CONFIG_KEY["POLYFILL_SCOPE_MODE"] = "POLYFILL_SCOPE_MODE";
162
- CONFIG_KEY["KEYBOARD_FOCUSABLE_SELECTOR"] = "KEYBOARD_FOCUSABLE_SELECTOR";
163
- CONFIG_KEY["CUSTOM_AUTH_SHARE_SCOPE"] = "CUSTOM_AUTH_SHARE_SCOPE";
162
+ (function(CONFIG_KEY) {
163
+ CONFIG_KEY["TKIT_PORTAL_DEFAULT_THEME"] = "TKIT_PORTAL_DEFAULT_THEME";
164
+ CONFIG_KEY["TKIT_PORTAL_DISABLE_THEME_MANAGEMENT"] = "TKIT_PORTAL_DISABLE_THEME_MANAGEMENT";
165
+ CONFIG_KEY["TKIT_PORTAL_THEME_SERVER_URL"] = "TKIT_PORTAL_THEME_SERVER_URL";
166
+ CONFIG_KEY["TKIT_TOKEN_ROLE_CLAIM_NAME"] = "TKIT_TOKEN_ROLE_CLAIM_NAME";
167
+ CONFIG_KEY["TKIT_PORTAL_ID"] = "TKIT_PORTAL_ID";
168
+ CONFIG_KEY["TKIT_SUPPORTED_LANGUAGES"] = "TKIT_SUPPORTED_LANGUAGES";
169
+ CONFIG_KEY["TKIT_SEARCH_BASE_URL"] = "TKIT_SEARCH_BASE_URL";
170
+ CONFIG_KEY["APP_BASE_HREF"] = "APP_BASE_HREF";
171
+ CONFIG_KEY["KEYCLOAK_REALM"] = "KEYCLOAK_REALM";
172
+ CONFIG_KEY["KEYCLOAK_ENABLE_SILENT_SSO"] = "KEYCLOAK_ENABLE_SILENT_SSO";
173
+ CONFIG_KEY["KEYCLOAK_URL"] = "KEYCLOAK_URL";
174
+ CONFIG_KEY["KEYCLOAK_CLIENT_ID"] = "KEYCLOAK_CLIENT_ID";
175
+ CONFIG_KEY["KEYCLOAK_TIME_SKEW"] = "KEYCLOAK_TIME_SKEW";
176
+ CONFIG_KEY["KEYCLOAK_UPDATE_TOKEN_MIN_VALIDITY"] = "KEYCLOAK_UPDATE_TOKEN_MIN_VALIDITY";
177
+ CONFIG_KEY["KEYCLOAK_ON_TOKEN_EXPIRED_ENABLED"] = "KEYCLOAK_ON_TOKEN_EXPIRED_ENABLED";
178
+ CONFIG_KEY["KEYCLOAK_ON_AUTH_REFRESH_ERROR_ENABLED"] = "KEYCLOAK_ON_AUTH_REFRESH_ERROR_ENABLED";
179
+ CONFIG_KEY["ONECX_PORTAL_FAVORITES_DISABLED"] = "ONECX_PORTAL_FAVORITES_DISABLED";
180
+ CONFIG_KEY["ONECX_PORTAL_FEEDBACK_DISABLED"] = "ONECX_PORTAL_FEEDBACK_DISABLED";
181
+ CONFIG_KEY["ONECX_PORTAL_SEARCH_DISABLED"] = "ONECX_PORTAL_SEARCH_DISABLED";
182
+ CONFIG_KEY["ONECX_PORTAL_SUPPORT_TICKET_DISABLED"] = "ONECX_PORTAL_SUPPORT_TICKET_DISABLED";
183
+ CONFIG_KEY["ONECX_PORTAL_ANNOUNCEMENTS_DISABLED"] = "ONECX_PORTAL_ANNOUNCEMENTS_DISABLED";
184
+ CONFIG_KEY["ONECX_PORTAL_PASSWORD_CHANGE_DISABLED"] = "ONECX_PORTAL_PASSWORD_CHANGE_DISABLED";
185
+ CONFIG_KEY["ONECX_PORTAL_SETTINGS_DISABLED"] = "ONECX_PORTAL_SETTINGS_DISABLED";
186
+ CONFIG_KEY["ONECX_PORTAL_MY_ROLES_PERMISSIONS_DISABLED"] = "ONECX_PORTAL_MY_ROLES_PERMISSIONS_DISABLED";
187
+ CONFIG_KEY["ONECX_PORTAL_HELP_DISABLED"] = "ONECX_PORTAL_HELP_DISABLED";
188
+ CONFIG_KEY["ONECX_PORTAL_SEARCH_BUTTONS_REVERSED"] = "ONECX_PORTAL_SEARCH_BUTTONS_REVERSED";
189
+ CONFIG_KEY["APP_VERSION"] = "APP_VERSION";
190
+ CONFIG_KEY["IS_SHELL"] = "IS_SHELL";
191
+ CONFIG_KEY["AUTH_SERVICE"] = "AUTH_SERVICE";
192
+ CONFIG_KEY["AUTH_SERVICE_CUSTOM_URL"] = "AUTH_SERVICE_CUSTOM_URL";
193
+ CONFIG_KEY["AUTH_SERVICE_CUSTOM_MODULE_NAME"] = "AUTH_SERVICE_CUSTOM_MODULE_NAME";
194
+ CONFIG_KEY["POLYFILL_SCOPE_MODE"] = "POLYFILL_SCOPE_MODE";
195
+ CONFIG_KEY["KEYBOARD_FOCUSABLE_SELECTOR"] = "KEYBOARD_FOCUSABLE_SELECTOR";
196
+ CONFIG_KEY["CUSTOM_AUTH_SHARE_SCOPE"] = "CUSTOM_AUTH_SHARE_SCOPE";
164
197
  })(CONFIG_KEY || (CONFIG_KEY = {}));
165
198
  var POLYFILL_SCOPE_MODE;
166
- (function (POLYFILL_SCOPE_MODE) {
167
- POLYFILL_SCOPE_MODE["PERFORMANCE"] = "PERFORMANCE";
168
- POLYFILL_SCOPE_MODE["PRECISION"] = "PRECISION";
199
+ (function(POLYFILL_SCOPE_MODE) {
200
+ POLYFILL_SCOPE_MODE["PERFORMANCE"] = "PERFORMANCE";
201
+ POLYFILL_SCOPE_MODE["PRECISION"] = "PRECISION";
169
202
  })(POLYFILL_SCOPE_MODE || (POLYFILL_SCOPE_MODE = {}));
203
+ var ConfigurationService = class ConfigurationService {
204
+ constructor() {
205
+ this.http = inject(HttpClient);
206
+ this.logger = createLogger("ConfigurationService");
207
+ this.defaultConfig = inject(APP_CONFIG, { optional: true });
208
+ this.semaphore = new Semaphore(1);
209
+ }
210
+ get config$() {
211
+ this._config$ ??= new ConfigurationTopic();
212
+ return this._config$;
213
+ }
214
+ set config$(source) {
215
+ this._config$ = source;
216
+ }
217
+ ngOnDestroy() {
218
+ this._config$?.destroy();
219
+ }
220
+ init() {
221
+ return new Promise((resolve, reject) => {
222
+ const skipRemoteConfigLoad = this.defaultConfig?.["skipRemoteConfigLoad"];
223
+ const remoteConfigURL = this.defaultConfig?.["remoteConfigURL"] ?? void 0;
224
+ resolveConfigPayload({
225
+ defaultConfig: this.defaultConfig ?? {},
226
+ skipRemoteConfigLoad: !!skipRemoteConfigLoad,
227
+ remoteConfigURL,
228
+ loadRemoteConfig: (url) => firstValueFrom(this.http.get(url))
229
+ }).then(async ({ config, source }) => {
230
+ if (source === "inlined") this.logger.info("ENV resolved from injected config");
231
+ if (source === "default" && skipRemoteConfigLoad) this.logger.info("📢 TKA001: Remote config load is disabled. To enable it, remove the \"skipRemoteConfigLoad\" key in your environment.json");
232
+ await this.config$.publish({
233
+ ...this.defaultConfig,
234
+ ...config ?? {}
235
+ }).then(() => {
236
+ resolve(true);
237
+ });
238
+ }).catch((e) => {
239
+ this.logger.error("Failed to load env configuration", e);
240
+ reject(e);
241
+ });
242
+ });
243
+ }
244
+ get isInitialized() {
245
+ return this.config$.isInitialized;
246
+ }
247
+ async getProperty(key) {
248
+ if (!Object.values(CONFIG_KEY).includes(key)) this.logger.error("Invalid config key ", key);
249
+ return firstValueFrom(this.config$.pipe(map((config) => config[key])));
250
+ }
251
+ async setProperty(key, val) {
252
+ return this.semaphore.use(async () => {
253
+ const currentValues = await firstValueFrom(this.config$.asObservable());
254
+ currentValues[key] = val;
255
+ await this.config$.publish(currentValues);
256
+ });
257
+ }
258
+ async getConfig() {
259
+ return firstValueFrom(this.config$.asObservable());
260
+ }
261
+ static {
262
+ this.ɵfac = i0.ɵɵngDeclareFactory({
263
+ minVersion: "12.0.0",
264
+ version: "22.2.0",
265
+ ngImport: i0,
266
+ type: ConfigurationService,
267
+ deps: [],
268
+ target: i0.ɵɵFactoryTarget.Injectable
269
+ });
270
+ }
271
+ static {
272
+ this.ɵprov = i0.ɵɵngDeclareInjectable({
273
+ minVersion: "12.0.0",
274
+ version: "22.2.0",
275
+ ngImport: i0,
276
+ type: ConfigurationService,
277
+ providedIn: "root"
278
+ });
279
+ }
280
+ };
281
+ i0.ɵɵngDeclareClassMetadata({
282
+ minVersion: "12.0.0",
283
+ version: "22.2.0",
284
+ ngImport: i0,
285
+ type: ConfigurationService,
286
+ decorators: [{
287
+ type: Injectable,
288
+ args: [{ providedIn: "root" }]
289
+ }]
290
+ });
291
+ const logger = createLogger("UserService");
292
+ var UserService = class UserService {
293
+ get permissionsTopic$() {
294
+ this._permissionsTopic$ ??= new PermissionsTopic();
295
+ return this._permissionsTopic$;
296
+ }
297
+ set permissionsTopic$(source) {
298
+ this._permissionsTopic$ = source;
299
+ }
300
+ constructor() {
301
+ this.profile$ = new UserProfileTopic();
302
+ this.lang$ = new BehaviorSubject(determineBrowserLanguage() ?? "en");
303
+ this.profile$.pipe(map((profile) => {
304
+ return resolveProfileLanguage(profile, "en", getNormalizedBrowserLocales);
305
+ })).subscribe(this.lang$);
306
+ }
307
+ ngOnDestroy() {
308
+ this.profile$.destroy();
309
+ this._permissionsTopic$?.destroy();
310
+ }
311
+ useOldLangSetting(profile) {
312
+ return resolveLegacyLanguage(profile, "en", determineBrowserLanguage);
313
+ }
314
+ getPermissions() {
315
+ return this.permissionsTopic$.asObservable();
316
+ }
317
+ async hasPermission(permissionKey) {
318
+ if (!permissionKey) return true;
319
+ if (Array.isArray(permissionKey)) return (await Promise.all(permissionKey.map((key) => this.hasPermission(key)))).every((hasPermission) => hasPermission);
320
+ return firstValueFrom(this.permissionsTopic$.pipe(map((permissions) => {
321
+ const result = permissions.includes(permissionKey);
322
+ if (!result) logger.debug(`No permission for: ${permissionKey}`);
323
+ return !!result;
324
+ })));
325
+ }
326
+ get isInitialized() {
327
+ return Promise.all([this.permissionsTopic$.isInitialized, this.profile$.isInitialized]).then(() => {});
328
+ }
329
+ static {
330
+ this.ɵfac = i0.ɵɵngDeclareFactory({
331
+ minVersion: "12.0.0",
332
+ version: "22.2.0",
333
+ ngImport: i0,
334
+ type: UserService,
335
+ deps: [],
336
+ target: i0.ɵɵFactoryTarget.Injectable
337
+ });
338
+ }
339
+ static {
340
+ this.ɵprov = i0.ɵɵngDeclareInjectable({
341
+ minVersion: "12.0.0",
342
+ version: "22.2.0",
343
+ ngImport: i0,
344
+ type: UserService,
345
+ providedIn: "root"
346
+ });
347
+ }
348
+ };
349
+ i0.ɵɵngDeclareClassMetadata({
350
+ minVersion: "12.0.0",
351
+ version: "22.2.0",
352
+ ngImport: i0,
353
+ type: UserService,
354
+ decorators: [{
355
+ type: Injectable,
356
+ args: [{ providedIn: "root" }]
357
+ }],
358
+ ctorParameters: () => []
359
+ });
360
+ var ShellCapabilityService = class ShellCapabilityService {
361
+ static setCapabilities(capabilities) {
362
+ setShellCapabilities(capabilities);
363
+ }
364
+ hasCapability(capability) {
365
+ return hasShellCapability(capability);
366
+ }
367
+ static {
368
+ this.ɵfac = i0.ɵɵngDeclareFactory({
369
+ minVersion: "12.0.0",
370
+ version: "22.2.0",
371
+ ngImport: i0,
372
+ type: ShellCapabilityService,
373
+ deps: [],
374
+ target: i0.ɵɵFactoryTarget.Injectable
375
+ });
376
+ }
377
+ static {
378
+ this.ɵprov = i0.ɵɵngDeclareInjectable({
379
+ minVersion: "12.0.0",
380
+ version: "22.2.0",
381
+ ngImport: i0,
382
+ type: ShellCapabilityService,
383
+ providedIn: "root"
384
+ });
385
+ }
386
+ };
387
+ i0.ɵɵngDeclareClassMetadata({
388
+ minVersion: "12.0.0",
389
+ version: "22.2.0",
390
+ ngImport: i0,
391
+ type: ShellCapabilityService,
392
+ decorators: [{
393
+ type: Injectable,
394
+ args: [{ providedIn: "root" }]
395
+ }]
396
+ });
397
+ var ParametersService = class ParametersService {
398
+ constructor() {
399
+ this.shellCapabilityService = inject(ShellCapabilityService);
400
+ this.appStateService = inject(AppStateService);
401
+ }
402
+ get parameters$() {
403
+ this._parameters$ ??= new ParametersTopic();
404
+ return this._parameters$;
405
+ }
406
+ set parameters$(source) {
407
+ this._parameters$ = source;
408
+ }
409
+ ngOnDestroy() {
410
+ this._parameters$?.destroy();
411
+ }
412
+ async get(key, defaultValue, productName = void 0, appId = void 0) {
413
+ if (!this.shellCapabilityService.hasCapability(ShellCapability.PARAMETERS_TOPIC)) return defaultValue;
414
+ if (!productName) productName = await firstValueFrom(this.appStateService.currentMfe$.pipe(map((mfe) => mfe.productName)));
415
+ if (!appId) appId = await firstValueFrom(this.appStateService.currentMfe$.pipe(map((mfe) => mfe.appId)));
416
+ return firstValueFrom(this.parameters$.pipe(map((payload) => findParameterValue(payload, key, productName, appId)))).then((value) => value ?? defaultValue);
417
+ }
418
+ static {
419
+ this.ɵfac = i0.ɵɵngDeclareFactory({
420
+ minVersion: "12.0.0",
421
+ version: "22.2.0",
422
+ ngImport: i0,
423
+ type: ParametersService,
424
+ deps: [],
425
+ target: i0.ɵɵFactoryTarget.Injectable
426
+ });
427
+ }
428
+ static {
429
+ this.ɵprov = i0.ɵɵngDeclareInjectable({
430
+ minVersion: "12.0.0",
431
+ version: "22.2.0",
432
+ ngImport: i0,
433
+ type: ParametersService,
434
+ providedIn: "root"
435
+ });
436
+ }
437
+ };
438
+ i0.ɵɵngDeclareClassMetadata({
439
+ minVersion: "12.0.0",
440
+ version: "22.2.0",
441
+ ngImport: i0,
442
+ type: ParametersService,
443
+ decorators: [{
444
+ type: Injectable,
445
+ args: [{ providedIn: "root" }]
446
+ }]
447
+ });
448
+ var PortalMessageService = class PortalMessageService {
449
+ constructor() {
450
+ this.translateService = inject(TranslateService);
451
+ }
452
+ get message$() {
453
+ this._message$ ??= new MessageTopic();
454
+ return this._message$;
455
+ }
456
+ set message$(source) {
457
+ this._message$ = source;
458
+ }
459
+ success(msg) {
460
+ this.addTranslated("success", msg);
461
+ }
462
+ info(msg) {
463
+ this.addTranslated("info", msg);
464
+ }
465
+ error(msg) {
466
+ this.addTranslated("error", msg);
467
+ }
468
+ warning(msg) {
469
+ this.addTranslated("warn", msg);
470
+ }
471
+ addTranslated(severity, msg) {
472
+ combineLatest([msg.summaryKey ? this.translateService.get(msg.summaryKey || "", msg.summaryParameters) : of(void 0), msg.detailKey ? this.translateService.get(msg.detailKey, msg.detailParameters) : of(void 0)]).pipe(first()).subscribe(([summaryTranslation, detailTranslation]) => {
473
+ this.message$.publish(buildPortalMessagePayload(severity, msg, summaryTranslation, detailTranslation));
474
+ });
475
+ }
476
+ ngOnDestroy() {
477
+ this._message$?.destroy();
478
+ }
479
+ static {
480
+ this.ɵfac = i0.ɵɵngDeclareFactory({
481
+ minVersion: "12.0.0",
482
+ version: "22.2.0",
483
+ ngImport: i0,
484
+ type: PortalMessageService,
485
+ deps: [],
486
+ target: i0.ɵɵFactoryTarget.Injectable
487
+ });
488
+ }
489
+ static {
490
+ this.ɵprov = i0.ɵɵngDeclareInjectable({
491
+ minVersion: "12.0.0",
492
+ version: "22.2.0",
493
+ ngImport: i0,
494
+ type: PortalMessageService,
495
+ providedIn: "any"
496
+ });
497
+ }
498
+ };
499
+ i0.ɵɵngDeclareClassMetadata({
500
+ minVersion: "12.0.0",
501
+ version: "22.2.0",
502
+ ngImport: i0,
503
+ type: PortalMessageService,
504
+ decorators: [{
505
+ type: Injectable,
506
+ args: [{ providedIn: "any" }]
507
+ }]
508
+ });
509
+ var ThemeService = class ThemeService {
510
+ get currentTheme$() {
511
+ this._currentTheme$ ??= new CurrentThemeTopic();
512
+ return this._currentTheme$;
513
+ }
514
+ set currentTheme$(source) {
515
+ this._currentTheme$ = source;
516
+ }
517
+ ngOnDestroy() {
518
+ this._currentTheme$?.destroy();
519
+ }
520
+ static {
521
+ this.ɵfac = i0.ɵɵngDeclareFactory({
522
+ minVersion: "12.0.0",
523
+ version: "22.2.0",
524
+ ngImport: i0,
525
+ type: ThemeService,
526
+ deps: [],
527
+ target: i0.ɵɵFactoryTarget.Injectable
528
+ });
529
+ }
530
+ static {
531
+ this.ɵprov = i0.ɵɵngDeclareInjectable({
532
+ minVersion: "12.0.0",
533
+ version: "22.2.0",
534
+ ngImport: i0,
535
+ type: ThemeService,
536
+ providedIn: "root"
537
+ });
538
+ }
539
+ };
540
+ i0.ɵɵngDeclareClassMetadata({
541
+ minVersion: "12.0.0",
542
+ version: "22.2.0",
543
+ ngImport: i0,
544
+ type: ThemeService,
545
+ decorators: [{
546
+ type: Injectable,
547
+ args: [{ providedIn: "root" }]
548
+ }]
549
+ });
550
+ var RemoteComponentsService = class RemoteComponentsService {
551
+ get remoteComponents$() {
552
+ this._remoteComponents$ ??= new RemoteComponentsTopic();
553
+ return this._remoteComponents$;
554
+ }
555
+ set remoteComponents$(source) {
556
+ this._remoteComponents$ = source;
557
+ }
558
+ ngOnDestroy() {
559
+ this._remoteComponents$?.destroy();
560
+ }
561
+ static {
562
+ this.ɵfac = i0.ɵɵngDeclareFactory({
563
+ minVersion: "12.0.0",
564
+ version: "22.2.0",
565
+ ngImport: i0,
566
+ type: RemoteComponentsService,
567
+ deps: [],
568
+ target: i0.ɵɵFactoryTarget.Injectable
569
+ });
570
+ }
571
+ static {
572
+ this.ɵprov = i0.ɵɵngDeclareInjectable({
573
+ minVersion: "12.0.0",
574
+ version: "22.2.0",
575
+ ngImport: i0,
576
+ type: RemoteComponentsService,
577
+ providedIn: "root"
578
+ });
579
+ }
580
+ };
581
+ i0.ɵɵngDeclareClassMetadata({
582
+ minVersion: "12.0.0",
583
+ version: "22.2.0",
584
+ ngImport: i0,
585
+ type: RemoteComponentsService,
586
+ decorators: [{
587
+ type: Injectable,
588
+ args: [{ providedIn: "root" }]
589
+ }]
590
+ });
591
+ var WorkspaceService = class WorkspaceService {
592
+ constructor() {
593
+ this.appStateService = inject(AppStateService);
594
+ this.logger = createLogger("WorkspaceService");
595
+ }
596
+ getUrl(productName, appId, endpointName, endpointParameters) {
597
+ return this.appStateService.currentWorkspace$.pipe(map((workspace) => {
598
+ return constructRouteUrl(workspace, appId, productName, endpointName, endpointParameters, this.logger.warn);
599
+ }));
600
+ }
601
+ doesUrlExistFor(productName, appId, endpointName) {
602
+ return this.appStateService.currentWorkspace$.pipe(map((workspace) => doesUrlExistForWorkspace(workspace, productName, appId, endpointName, this.logger.warn)));
603
+ }
604
+ static {
605
+ this.ɵfac = i0.ɵɵngDeclareFactory({
606
+ minVersion: "12.0.0",
607
+ version: "22.2.0",
608
+ ngImport: i0,
609
+ type: WorkspaceService,
610
+ deps: [],
611
+ target: i0.ɵɵFactoryTarget.Injectable
612
+ });
613
+ }
614
+ static {
615
+ this.ɵprov = i0.ɵɵngDeclareInjectable({
616
+ minVersion: "12.0.0",
617
+ version: "22.2.0",
618
+ ngImport: i0,
619
+ type: WorkspaceService,
620
+ providedIn: "root"
621
+ });
622
+ }
623
+ };
624
+ i0.ɵɵngDeclareClassMetadata({
625
+ minVersion: "12.0.0",
626
+ version: "22.2.0",
627
+ ngImport: i0,
628
+ type: WorkspaceService,
629
+ decorators: [{
630
+ type: Injectable,
631
+ args: [{ providedIn: "root" }]
632
+ }]
633
+ });
634
+ var ImageRepositoryService = class ImageRepositoryService {
635
+ constructor() {
636
+ this.imageRepositoryInterface = new ImageRepositoryService$1();
637
+ }
638
+ get imageRepositoryTopic() {
639
+ return this.imageRepositoryInterface.imageRepositoryTopic;
640
+ }
641
+ async getUrl(names, fallbackUrl) {
642
+ if (fallbackUrl) return this.imageRepositoryInterface.getUrl(names, fallbackUrl);
643
+ return this.imageRepositoryInterface.getUrl(names);
644
+ }
645
+ ngOnDestroy() {
646
+ this.imageRepositoryInterface.destroy();
647
+ }
648
+ static {
649
+ this.ɵfac = i0.ɵɵngDeclareFactory({
650
+ minVersion: "12.0.0",
651
+ version: "22.2.0",
652
+ ngImport: i0,
653
+ type: ImageRepositoryService,
654
+ deps: [],
655
+ target: i0.ɵɵFactoryTarget.Injectable
656
+ });
657
+ }
658
+ static {
659
+ this.ɵprov = i0.ɵɵngDeclareInjectable({
660
+ minVersion: "12.0.0",
661
+ version: "22.2.0",
662
+ ngImport: i0,
663
+ type: ImageRepositoryService,
664
+ providedIn: "root"
665
+ });
666
+ }
667
+ };
668
+ i0.ɵɵngDeclareClassMetadata({
669
+ minVersion: "12.0.0",
670
+ version: "22.2.0",
671
+ ngImport: i0,
672
+ type: ImageRepositoryService,
673
+ decorators: [{
674
+ type: Injectable,
675
+ args: [{ providedIn: "root" }]
676
+ }]
677
+ });
678
+ var IconService = class IconService {
679
+ constructor() {
680
+ this.iconServiceInterface = new IconService$1();
681
+ }
682
+ get iconTopic() {
683
+ return this.iconServiceInterface.iconTopic;
684
+ }
685
+ requestIcon(name, type) {
686
+ return this.iconServiceInterface.requestIcon(name, type);
687
+ }
688
+ requestIconAsync(name, type, fallbackClass) {
689
+ return this.iconServiceInterface.requestIconAsync(name, type, fallbackClass);
690
+ }
691
+ ngOnDestroy() {
692
+ this.iconServiceInterface.destroy();
693
+ }
694
+ static {
695
+ this.ɵfac = i0.ɵɵngDeclareFactory({
696
+ minVersion: "12.0.0",
697
+ version: "22.2.0",
698
+ ngImport: i0,
699
+ type: IconService,
700
+ deps: [],
701
+ target: i0.ɵɵFactoryTarget.Injectable
702
+ });
703
+ }
704
+ static {
705
+ this.ɵprov = i0.ɵɵngDeclareInjectable({
706
+ minVersion: "12.0.0",
707
+ version: "22.2.0",
708
+ ngImport: i0,
709
+ type: IconService,
710
+ providedIn: "root"
711
+ });
712
+ }
713
+ };
714
+ i0.ɵɵngDeclareClassMetadata({
715
+ minVersion: "12.0.0",
716
+ version: "22.2.0",
717
+ ngImport: i0,
718
+ type: IconService,
719
+ decorators: [{
720
+ type: Injectable,
721
+ args: [{ providedIn: "root" }]
722
+ }]
723
+ });
724
+ var DynamicTranslationService = class DynamicTranslationService {
725
+ constructor() {
726
+ this.dynamicTranslationInterface = new DynamicTranslationService$1();
727
+ }
728
+ get dynamicTranslationsTopic$() {
729
+ return this.dynamicTranslationInterface.dynamicTranslationsTopic$;
730
+ }
731
+ getTranslations(lang, contexts) {
732
+ return this.dynamicTranslationInterface.getTranslations(lang, contexts);
733
+ }
734
+ ngOnDestroy() {
735
+ this.dynamicTranslationInterface.destroy();
736
+ }
737
+ static {
738
+ this.ɵfac = i0.ɵɵngDeclareFactory({
739
+ minVersion: "12.0.0",
740
+ version: "22.2.0",
741
+ ngImport: i0,
742
+ type: DynamicTranslationService,
743
+ deps: [],
744
+ target: i0.ɵɵFactoryTarget.Injectable
745
+ });
746
+ }
747
+ static {
748
+ this.ɵprov = i0.ɵɵngDeclareInjectable({
749
+ minVersion: "12.0.0",
750
+ version: "22.2.0",
751
+ ngImport: i0,
752
+ type: DynamicTranslationService,
753
+ providedIn: "root"
754
+ });
755
+ }
756
+ };
757
+ i0.ɵɵngDeclareClassMetadata({
758
+ minVersion: "12.0.0",
759
+ version: "22.2.0",
760
+ ngImport: i0,
761
+ type: DynamicTranslationService,
762
+ decorators: [{
763
+ type: Injectable,
764
+ args: [{ providedIn: "root" }]
765
+ }]
766
+ });
767
+ var NotificationService = class NotificationService {
768
+ constructor() {
769
+ this.notificationService = new NotificationService$1();
770
+ }
771
+ get notificationTopic() {
772
+ return this.notificationService.notificationTopic;
773
+ }
774
+ ngOnDestroy() {
775
+ this.notificationService.destroy();
776
+ }
777
+ static {
778
+ this.ɵfac = i0.ɵɵngDeclareFactory({
779
+ minVersion: "12.0.0",
780
+ version: "22.2.0",
781
+ ngImport: i0,
782
+ type: NotificationService,
783
+ deps: [],
784
+ target: i0.ɵɵFactoryTarget.Injectable
785
+ });
786
+ }
787
+ static {
788
+ this.ɵprov = i0.ɵɵngDeclareInjectable({
789
+ minVersion: "12.0.0",
790
+ version: "22.2.0",
791
+ ngImport: i0,
792
+ type: NotificationService,
793
+ providedIn: "root"
794
+ });
795
+ }
796
+ };
797
+ i0.ɵɵngDeclareClassMetadata({
798
+ minVersion: "12.0.0",
799
+ version: "22.2.0",
800
+ ngImport: i0,
801
+ type: NotificationService,
802
+ decorators: [{
803
+ type: Injectable,
804
+ args: [{ providedIn: "root" }]
805
+ }]
806
+ });
807
+ export { APPLICATION_NAME, APP_CONFIG, AppConfigService, AppStateService, CONFIG_KEY, Capability, ConfigurationService, DYNAMIC_CONTAINER, DynamicTranslationService, IconService, ImageRepositoryService, NotificationService, POLYFILL_SCOPE_MODE, ParametersService, PortalMessageService, RemoteComponentsService, SANITY_CHECK, ShellCapabilityService, ThemeService, UserService, WorkspaceService };
170
808
 
171
- class ConfigurationService {
172
- constructor() {
173
- this.http = inject(HttpClient);
174
- this.logger = createLogger('ConfigurationService');
175
- this.defaultConfig = inject(APP_CONFIG, { optional: true });
176
- this.semaphore = new Semaphore(1);
177
- }
178
- get config$() {
179
- this._config$ ??= new ConfigurationTopic();
180
- return this._config$;
181
- }
182
- set config$(source) {
183
- this._config$ = source;
184
- }
185
- ngOnDestroy() {
186
- this._config$?.destroy();
187
- }
188
- init() {
189
- return new Promise((resolve, reject) => {
190
- const skipRemoteConfigLoad = this.defaultConfig?.['skipRemoteConfigLoad'];
191
- const remoteConfigURL = this.defaultConfig?.['remoteConfigURL'] ?? undefined;
192
- resolveConfigPayload({
193
- defaultConfig: this.defaultConfig ?? {},
194
- skipRemoteConfigLoad: !!skipRemoteConfigLoad,
195
- remoteConfigURL,
196
- loadRemoteConfig: (url) => firstValueFrom(this.http.get(url)),
197
- })
198
- .then(async ({ config, source }) => {
199
- if (source === 'inlined') {
200
- this.logger.info('ENV resolved from injected config');
201
- }
202
- if (source === 'default' && skipRemoteConfigLoad) {
203
- this.logger.info('📢 TKA001: Remote config load is disabled. To enable it, remove the "skipRemoteConfigLoad" key in your environment.json');
204
- }
205
- await this.config$.publish({ ...this.defaultConfig, ...(config ?? {}) }).then(() => {
206
- resolve(true);
207
- });
208
- })
209
- .catch((e) => {
210
- this.logger.error('Failed to load env configuration', e);
211
- reject(e);
212
- });
213
- });
214
- }
215
- get isInitialized() {
216
- return this.config$.isInitialized;
217
- }
218
- async getProperty(key) {
219
- if (!Object.values(CONFIG_KEY).includes(key)) {
220
- this.logger.error('Invalid config key ', key);
221
- }
222
- return firstValueFrom(this.config$.pipe(map((config) => config[key])));
223
- }
224
- async setProperty(key, val) {
225
- return this.semaphore.use(async () => {
226
- const currentValues = await firstValueFrom(this.config$.asObservable());
227
- currentValues[key] = val;
228
- await this.config$.publish(currentValues);
229
- });
230
- }
231
- async getConfig() {
232
- return firstValueFrom(this.config$.asObservable());
233
- }
234
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: ConfigurationService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
235
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: ConfigurationService, providedIn: 'root' }); }
236
- }
237
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: ConfigurationService, decorators: [{
238
- type: Injectable,
239
- args: [{ providedIn: 'root' }]
240
- }] });
241
-
242
- const API_PREFIX = 'portal-api';
243
- const DEFAULT_LANG = 'en';
244
-
245
- const logger = createLogger('UserService');
246
- class UserService {
247
- get permissionsTopic$() {
248
- this._permissionsTopic$ ??= new PermissionsTopic();
249
- return this._permissionsTopic$;
250
- }
251
- set permissionsTopic$(source) {
252
- this._permissionsTopic$ = source;
253
- }
254
- constructor() {
255
- this.profile$ = new UserProfileTopic();
256
- this.lang$ = new BehaviorSubject(determineBrowserLanguage() ?? DEFAULT_LANG);
257
- this.profile$
258
- .pipe(map((profile) => {
259
- return resolveProfileLanguage(profile, DEFAULT_LANG, getNormalizedBrowserLocales);
260
- }))
261
- .subscribe(this.lang$);
262
- }
263
- ngOnDestroy() {
264
- this.profile$.destroy();
265
- this._permissionsTopic$?.destroy();
266
- }
267
- useOldLangSetting(profile) {
268
- return resolveLegacyLanguage(profile, DEFAULT_LANG, determineBrowserLanguage);
269
- }
270
- getPermissions() {
271
- return this.permissionsTopic$.asObservable();
272
- }
273
- async hasPermission(permissionKey) {
274
- if (!permissionKey)
275
- return true;
276
- if (Array.isArray(permissionKey)) {
277
- const permissions = await Promise.all(permissionKey.map((key) => this.hasPermission(key)));
278
- return permissions.every((hasPermission) => hasPermission);
279
- }
280
- return firstValueFrom(this.permissionsTopic$.pipe(map((permissions) => {
281
- const result = permissions.includes(permissionKey);
282
- if (!result) {
283
- logger.debug(`No permission for: ${permissionKey}`);
284
- }
285
- return !!result;
286
- })));
287
- }
288
- get isInitialized() {
289
- return Promise.all([
290
- this.permissionsTopic$.isInitialized,
291
- this.profile$.isInitialized,
292
- // eslint-disable-next-line @typescript-eslint/no-empty-function
293
- ]).then(() => { });
294
- }
295
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: UserService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
296
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: UserService, providedIn: 'root' }); }
297
- }
298
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: UserService, decorators: [{
299
- type: Injectable,
300
- args: [{ providedIn: 'root' }]
301
- }], ctorParameters: () => [] });
302
-
303
- class ShellCapabilityService {
304
- static setCapabilities(capabilities) {
305
- setShellCapabilities(capabilities);
306
- }
307
- hasCapability(capability) {
308
- return hasShellCapability(capability);
309
- }
310
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: ShellCapabilityService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
311
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: ShellCapabilityService, providedIn: 'root' }); }
312
- }
313
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: ShellCapabilityService, decorators: [{
314
- type: Injectable,
315
- args: [{ providedIn: 'root' }]
316
- }] });
317
-
318
- class ParametersService {
319
- constructor() {
320
- this.shellCapabilityService = inject(ShellCapabilityService);
321
- this.appStateService = inject(AppStateService);
322
- }
323
- get parameters$() {
324
- this._parameters$ ??= new ParametersTopic();
325
- return this._parameters$;
326
- }
327
- set parameters$(source) {
328
- this._parameters$ = source;
329
- }
330
- ngOnDestroy() {
331
- this._parameters$?.destroy();
332
- }
333
- async get(key, defaultValue, productName = undefined, appId = undefined) {
334
- if (!this.shellCapabilityService.hasCapability(ShellCapability.PARAMETERS_TOPIC)) {
335
- return defaultValue;
336
- }
337
- if (!productName) {
338
- productName = await firstValueFrom(this.appStateService.currentMfe$.pipe(map((mfe) => mfe.productName)));
339
- }
340
- if (!appId) {
341
- appId = await firstValueFrom(this.appStateService.currentMfe$.pipe(map((mfe) => mfe.appId)));
342
- }
343
- return firstValueFrom(this.parameters$.pipe(map((payload) => findParameterValue(payload, key, productName, appId)))).then((value) => value ?? defaultValue);
344
- }
345
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: ParametersService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
346
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: ParametersService, providedIn: 'root' }); }
347
- }
348
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: ParametersService, decorators: [{
349
- type: Injectable,
350
- args: [{ providedIn: 'root' }]
351
- }] });
352
-
353
- class PortalMessageService {
354
- constructor() {
355
- this.translateService = inject(TranslateService);
356
- }
357
- get message$() {
358
- this._message$ ??= new MessageTopic();
359
- return this._message$;
360
- }
361
- set message$(source) {
362
- this._message$ = source;
363
- }
364
- success(msg) {
365
- this.addTranslated('success', msg);
366
- }
367
- info(msg) {
368
- this.addTranslated('info', msg);
369
- }
370
- error(msg) {
371
- this.addTranslated('error', msg);
372
- }
373
- warning(msg) {
374
- this.addTranslated('warning', msg);
375
- }
376
- addTranslated(severity, msg) {
377
- combineLatest([
378
- msg.summaryKey ? this.translateService.get(msg.summaryKey || '', msg.summaryParameters) : of(undefined),
379
- msg.detailKey ? this.translateService.get(msg.detailKey, msg.detailParameters) : of(undefined),
380
- ])
381
- .pipe(first())
382
- .subscribe(([summaryTranslation, detailTranslation]) => {
383
- this.message$.publish(buildPortalMessagePayload(severity, msg, summaryTranslation, detailTranslation));
384
- });
385
- }
386
- ngOnDestroy() {
387
- this._message$?.destroy();
388
- }
389
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: PortalMessageService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
390
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: PortalMessageService, providedIn: 'any' }); }
391
- }
392
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: PortalMessageService, decorators: [{
393
- type: Injectable,
394
- args: [{ providedIn: 'any' }]
395
- }] });
396
-
397
- class ThemeService {
398
- get currentTheme$() {
399
- this._currentTheme$ ??= new CurrentThemeTopic();
400
- return this._currentTheme$;
401
- }
402
- set currentTheme$(source) {
403
- this._currentTheme$ = source;
404
- }
405
- ngOnDestroy() {
406
- this._currentTheme$?.destroy();
407
- }
408
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: ThemeService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
409
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: ThemeService, providedIn: 'root' }); }
410
- }
411
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: ThemeService, decorators: [{
412
- type: Injectable,
413
- args: [{ providedIn: 'root' }]
414
- }] });
415
-
416
- class RemoteComponentsService {
417
- get remoteComponents$() {
418
- this._remoteComponents$ ??= new RemoteComponentsTopic();
419
- return this._remoteComponents$;
420
- }
421
- set remoteComponents$(source) {
422
- this._remoteComponents$ = source;
423
- }
424
- ngOnDestroy() {
425
- this._remoteComponents$?.destroy();
426
- }
427
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: RemoteComponentsService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
428
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: RemoteComponentsService, providedIn: 'root' }); }
429
- }
430
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: RemoteComponentsService, decorators: [{
431
- type: Injectable,
432
- args: [{ providedIn: 'root' }]
433
- }] });
434
-
435
- class WorkspaceService {
436
- constructor() {
437
- this.appStateService = inject(AppStateService);
438
- this.logger = createLogger('WorkspaceService');
439
- }
440
- getUrl(productName, appId, endpointName, endpointParameters) {
441
- return this.appStateService.currentWorkspace$.pipe(map((workspace) => {
442
- const finalUrl = constructRouteUrl(workspace, appId, productName, endpointName, endpointParameters, this.logger.warn);
443
- return finalUrl;
444
- }));
445
- }
446
- doesUrlExistFor(productName, appId, endpointName) {
447
- return this.appStateService.currentWorkspace$.pipe(map((workspace) => doesUrlExistForWorkspace(workspace, productName, appId, endpointName, this.logger.warn)));
448
- }
449
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: WorkspaceService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
450
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: WorkspaceService, providedIn: 'root' }); }
451
- }
452
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: WorkspaceService, decorators: [{
453
- type: Injectable,
454
- args: [{
455
- providedIn: 'root',
456
- }]
457
- }] });
458
-
459
- class ImageRepositoryService {
460
- constructor() {
461
- this.imageRepositoryInterface = new ImageRepositoryService$1();
462
- }
463
- get imageRepositoryTopic() {
464
- return this.imageRepositoryInterface.imageRepositoryTopic;
465
- }
466
- async getUrl(names, fallbackUrl) {
467
- if (fallbackUrl) {
468
- return this.imageRepositoryInterface.getUrl(names, fallbackUrl);
469
- }
470
- return this.imageRepositoryInterface.getUrl(names);
471
- }
472
- ngOnDestroy() {
473
- this.imageRepositoryInterface.destroy();
474
- }
475
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: ImageRepositoryService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
476
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: ImageRepositoryService, providedIn: 'root' }); }
477
- }
478
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: ImageRepositoryService, decorators: [{
479
- type: Injectable,
480
- args: [{ providedIn: 'root' }]
481
- }] });
482
-
483
- class IconService {
484
- constructor() {
485
- this.iconServiceInterface = new IconService$1();
486
- }
487
- get iconTopic() {
488
- return this.iconServiceInterface.iconTopic;
489
- }
490
- requestIcon(name, type) {
491
- return this.iconServiceInterface.requestIcon(name, type);
492
- }
493
- requestIconAsync(name, type, fallbackClass) {
494
- return this.iconServiceInterface.requestIconAsync(name, type, fallbackClass);
495
- }
496
- ngOnDestroy() {
497
- this.iconServiceInterface.destroy();
498
- }
499
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: IconService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
500
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: IconService, providedIn: 'root' }); }
501
- }
502
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: IconService, decorators: [{
503
- type: Injectable,
504
- args: [{ providedIn: 'root' }]
505
- }] });
506
-
507
- class DynamicTranslationService {
508
- constructor() {
509
- this.dynamicTranslationInterface = new DynamicTranslationService$1();
510
- }
511
- get dynamicTranslationsTopic$() {
512
- return this.dynamicTranslationInterface.dynamicTranslationsTopic$;
513
- }
514
- getTranslations(lang, contexts) {
515
- return this.dynamicTranslationInterface.getTranslations(lang, contexts);
516
- }
517
- ngOnDestroy() {
518
- this.dynamicTranslationInterface.destroy();
519
- }
520
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: DynamicTranslationService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
521
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: DynamicTranslationService, providedIn: 'root' }); }
522
- }
523
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: DynamicTranslationService, decorators: [{
524
- type: Injectable,
525
- args: [{ providedIn: 'root' }]
526
- }] });
527
-
528
- class NotificationService {
529
- constructor() {
530
- this.notificationService = new NotificationService$1();
531
- }
532
- get notificationTopic() {
533
- return this.notificationService.notificationTopic;
534
- }
535
- ngOnDestroy() {
536
- this.notificationService.destroy();
537
- }
538
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: NotificationService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
539
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: NotificationService, providedIn: 'root' }); }
540
- }
541
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: NotificationService, decorators: [{
542
- type: Injectable,
543
- args: [{ providedIn: 'root' }]
544
- }] });
545
-
546
- // services
547
-
548
- /**
549
- * Generated bundle index. Do not edit.
550
- */
551
-
552
- export { APPLICATION_NAME, APP_CONFIG, AppConfigService, AppStateService, CONFIG_KEY, ConfigurationService, DynamicTranslationService, IconService, ImageRepositoryService, NotificationService, POLYFILL_SCOPE_MODE, ParametersService, PortalMessageService, RemoteComponentsService, SANITY_CHECK, ShellCapabilityService, ThemeService, UserService, WorkspaceService };
553
- //# sourceMappingURL=onecx-angular-integration-interface.mjs.map
809
+ //# sourceMappingURL=onecx-angular-integration-interface.mjs.map