@onecx/angular-integration-interface 8.0.0-rc.1 → 8.0.0-rc.11

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.
Files changed (33) hide show
  1. package/README.md +13 -4
  2. package/fesm2022/onecx-angular-integration-interface-mocks.mjs +23 -26
  3. package/fesm2022/onecx-angular-integration-interface-mocks.mjs.map +1 -1
  4. package/fesm2022/onecx-angular-integration-interface.mjs +179 -232
  5. package/fesm2022/onecx-angular-integration-interface.mjs.map +1 -1
  6. package/package.json +7 -12
  7. package/{mocks/index.d.ts → types/onecx-angular-integration-interface-mocks.d.ts} +0 -1
  8. package/{index.d.ts → types/onecx-angular-integration-interface.d.ts} +74 -47
  9. package/migrations/index.d.ts +0 -5
  10. package/migrations/index.js +0 -9
  11. package/migrations/index.js.map +0 -1
  12. package/migrations/test-utils/test-setup.d.ts +0 -1
  13. package/migrations/test-utils/test-setup.js +0 -6
  14. package/migrations/test-utils/test-setup.js.map +0 -1
  15. package/migrations/v6/migrate-onecx-to-v6.d.ts +0 -2
  16. package/migrations/v6/migrate-onecx-to-v6.js +0 -8
  17. package/migrations/v6/migrate-onecx-to-v6.js.map +0 -1
  18. package/migrations/v6/remove-add-initialize-module-guard.d.ts +0 -2
  19. package/migrations/v6/remove-add-initialize-module-guard.js +0 -29
  20. package/migrations/v6/remove-add-initialize-module-guard.js.map +0 -1
  21. package/migrations/v6/remove-auth-service.d.ts +0 -2
  22. package/migrations/v6/remove-auth-service.js +0 -28
  23. package/migrations/v6/remove-auth-service.js.map +0 -1
  24. package/migrations/v6/replace-provide-app-service-mock.d.ts +0 -2
  25. package/migrations/v6/replace-provide-app-service-mock.js +0 -14
  26. package/migrations/v6/replace-provide-app-service-mock.js.map +0 -1
  27. package/migrations/v6/utils/remove-and-track-import.d.ts +0 -2
  28. package/migrations/v6/utils/remove-and-track-import.js +0 -14
  29. package/migrations/v6/utils/remove-and-track-import.js.map +0 -1
  30. package/migrations/v6/warn-removed-properties-from-theme-service.d.ts +0 -3
  31. package/migrations/v6/warn-removed-properties-from-theme-service.js +0 -24
  32. package/migrations/v6/warn-removed-properties-from-theme-service.js.map +0 -1
  33. package/migrations.json +0 -58
@@ -3,14 +3,19 @@ import { HttpClient } from '@angular/common/http';
3
3
  import * as i0 from '@angular/core';
4
4
  import { inject, Injectable, InjectionToken } from '@angular/core';
5
5
  import { BehaviorSubject, firstValueFrom, map, combineLatest, of, first } from 'rxjs';
6
- import { GlobalErrorTopic, GlobalLoadingTopic, CurrentMfeTopic, CurrentLocationTopic, CurrentPageTopic, CurrentWorkspaceTopic, IsAuthenticatedTopic, ConfigurationTopic, PermissionsTopic, UserProfileTopic, MessageTopic, CurrentThemeTopic, RemoteComponentsTopic, ImageRepositoryService as ImageRepositoryService$1 } from '@onecx/integration-interface';
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';
7
9
  import Semaphore from 'ts-semaphore';
8
- import { getNormalizedBrowserLocales } from '@onecx/accelerator';
9
10
  import { TranslateService } from '@ngx-translate/core';
10
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
+
11
15
  class AppConfigService {
12
16
  constructor() {
13
17
  this.http = inject(HttpClient);
18
+ this.logger = createLogger('AppConfigService');
14
19
  this.config$ = new BehaviorSubject({});
15
20
  }
16
21
  init(baseUrl) {
@@ -24,7 +29,7 @@ class AppConfigService {
24
29
  }
25
30
  })
26
31
  .catch((e) => {
27
- console.log(`Failed to load env configuration`);
32
+ this.logger.error('Failed to load env configuration', e);
28
33
  reject(e);
29
34
  });
30
35
  });
@@ -38,10 +43,10 @@ class AppConfigService {
38
43
  getConfig() {
39
44
  return this.config$.getValue();
40
45
  }
41
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: AppConfigService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
42
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: AppConfigService }); }
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 }); }
43
48
  }
44
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: AppConfigService, decorators: [{
49
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: AppConfigService, decorators: [{
45
50
  type: Injectable
46
51
  }] });
47
52
 
@@ -108,10 +113,10 @@ class AppStateService {
108
113
  this._currentWorkspace$?.destroy();
109
114
  this._isAuthenticated$?.destroy();
110
115
  }
111
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: AppStateService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
112
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: AppStateService, providedIn: 'root' }); }
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' }); }
113
118
  }
114
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: AppStateService, decorators: [{
119
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: AppStateService, decorators: [{
115
120
  type: Injectable,
116
121
  args: [{ providedIn: 'root' }]
117
122
  }] });
@@ -134,6 +139,10 @@ var CONFIG_KEY;
134
139
  CONFIG_KEY["KEYCLOAK_ENABLE_SILENT_SSO"] = "KEYCLOAK_ENABLE_SILENT_SSO";
135
140
  CONFIG_KEY["KEYCLOAK_URL"] = "KEYCLOAK_URL";
136
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";
137
146
  CONFIG_KEY["ONECX_PORTAL_FAVORITES_DISABLED"] = "ONECX_PORTAL_FAVORITES_DISABLED";
138
147
  CONFIG_KEY["ONECX_PORTAL_FEEDBACK_DISABLED"] = "ONECX_PORTAL_FEEDBACK_DISABLED";
139
148
  CONFIG_KEY["ONECX_PORTAL_SEARCH_DISABLED"] = "ONECX_PORTAL_SEARCH_DISABLED";
@@ -150,6 +159,8 @@ var CONFIG_KEY;
150
159
  CONFIG_KEY["AUTH_SERVICE_CUSTOM_URL"] = "AUTH_SERVICE_CUSTOM_URL";
151
160
  CONFIG_KEY["AUTH_SERVICE_CUSTOM_MODULE_NAME"] = "AUTH_SERVICE_CUSTOM_MODULE_NAME";
152
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";
153
164
  })(CONFIG_KEY || (CONFIG_KEY = {}));
154
165
  var POLYFILL_SCOPE_MODE;
155
166
  (function (POLYFILL_SCOPE_MODE) {
@@ -160,6 +171,7 @@ var POLYFILL_SCOPE_MODE;
160
171
  class ConfigurationService {
161
172
  constructor() {
162
173
  this.http = inject(HttpClient);
174
+ this.logger = createLogger('ConfigurationService');
163
175
  this.defaultConfig = inject(APP_CONFIG, { optional: true });
164
176
  this.semaphore = new Semaphore(1);
165
177
  }
@@ -175,30 +187,27 @@ class ConfigurationService {
175
187
  }
176
188
  init() {
177
189
  return new Promise((resolve, reject) => {
178
- const skipRemoteConfigLoad = this.defaultConfig && this.defaultConfig['skipRemoteConfigLoad'];
179
- let loadConfigPromise;
180
- const inlinedConfig = window['APP_CONFIG'];
181
- if (inlinedConfig) {
182
- console.log(`ENV resolved from injected config`);
183
- loadConfigPromise = Promise.resolve(inlinedConfig);
184
- }
185
- else {
186
- if (skipRemoteConfigLoad) {
187
- console.log('📢 TKA001: Remote config load is disabled. To enable it, remove the "skipRemoteConfigLoad" key in your environment.json');
188
- loadConfigPromise = Promise.resolve(this.defaultConfig || {});
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');
189
201
  }
190
- else {
191
- loadConfigPromise = firstValueFrom(this.http.get((this.defaultConfig && this.defaultConfig['remoteConfigURL']) || 'assets/env.json'));
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');
192
204
  }
193
- }
194
- loadConfigPromise
195
- .then(async (config) => {
196
205
  await this.config$.publish({ ...this.defaultConfig, ...(config ?? {}) }).then(() => {
197
206
  resolve(true);
198
207
  });
199
208
  })
200
209
  .catch((e) => {
201
- console.log(`Failed to load env configuration`);
210
+ this.logger.error('Failed to load env configuration', e);
202
211
  reject(e);
203
212
  });
204
213
  });
@@ -208,7 +217,7 @@ class ConfigurationService {
208
217
  }
209
218
  async getProperty(key) {
210
219
  if (!Object.values(CONFIG_KEY).includes(key)) {
211
- console.error('Invalid config key ', key);
220
+ this.logger.error('Invalid config key ', key);
212
221
  }
213
222
  return firstValueFrom(this.config$.pipe(map((config) => config[key])));
214
223
  }
@@ -222,10 +231,10 @@ class ConfigurationService {
222
231
  async getConfig() {
223
232
  return firstValueFrom(this.config$.asObservable());
224
233
  }
225
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: ConfigurationService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
226
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: ConfigurationService, providedIn: 'root' }); }
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' }); }
227
236
  }
228
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: ConfigurationService, decorators: [{
237
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: ConfigurationService, decorators: [{
229
238
  type: Injectable,
230
239
  args: [{ providedIn: 'root' }]
231
240
  }] });
@@ -233,6 +242,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImpo
233
242
  const API_PREFIX = 'portal-api';
234
243
  const DEFAULT_LANG = 'en';
235
244
 
245
+ const logger = createLogger('UserService');
236
246
  class UserService {
237
247
  get permissionsTopic$() {
238
248
  this._permissionsTopic$ ??= new PermissionsTopic();
@@ -243,21 +253,10 @@ class UserService {
243
253
  }
244
254
  constructor() {
245
255
  this.profile$ = new UserProfileTopic();
246
- this.lang$ = new BehaviorSubject(this.determineLanguage() ?? DEFAULT_LANG);
256
+ this.lang$ = new BehaviorSubject(determineBrowserLanguage() ?? DEFAULT_LANG);
247
257
  this.profile$
248
258
  .pipe(map((profile) => {
249
- let locales = profile.settings?.locales;
250
- if (!locales) {
251
- return this.useOldLangSetting(profile);
252
- }
253
- if (locales.length === 0) {
254
- locales = getNormalizedBrowserLocales();
255
- }
256
- // the lang$ should contain the first language, because locales is an ordered list
257
- // length of 2 is checked because we need the general language
258
- // never choose 'en-US', but choose 'en'
259
- const firstLang = locales.find((l) => l.length === 2) ?? DEFAULT_LANG;
260
- return firstLang;
259
+ return resolveProfileLanguage(profile, DEFAULT_LANG, getNormalizedBrowserLocales);
261
260
  }))
262
261
  .subscribe(this.lang$);
263
262
  }
@@ -266,7 +265,7 @@ class UserService {
266
265
  this._permissionsTopic$?.destroy();
267
266
  }
268
267
  useOldLangSetting(profile) {
269
- return profile.accountSettings?.localeAndTimeSettings?.locale ?? this.determineLanguage() ?? DEFAULT_LANG;
268
+ return resolveLegacyLanguage(profile, DEFAULT_LANG, determineBrowserLanguage);
270
269
  }
271
270
  getPermissions() {
272
271
  return this.permissionsTopic$.asObservable();
@@ -281,28 +280,11 @@ class UserService {
281
280
  return firstValueFrom(this.permissionsTopic$.pipe(map((permissions) => {
282
281
  const result = permissions.includes(permissionKey);
283
282
  if (!result) {
284
- console.log(`👮‍♀️ No permission for: ${permissionKey}`);
283
+ logger.debug(`No permission for: ${permissionKey}`);
285
284
  }
286
285
  return !!result;
287
286
  })));
288
287
  }
289
- determineLanguage() {
290
- if (typeof window === 'undefined' || typeof window.navigator === 'undefined') {
291
- return undefined;
292
- }
293
- let browserLang = window.navigator.languages ? window.navigator.languages[0] : null;
294
- browserLang = browserLang || window.navigator.language;
295
- if (typeof browserLang === 'undefined') {
296
- return undefined;
297
- }
298
- if (browserLang.indexOf('-') !== -1) {
299
- browserLang = browserLang.split('-')[0];
300
- }
301
- if (browserLang.indexOf('_') !== -1) {
302
- browserLang = browserLang.split('_')[0];
303
- }
304
- return browserLang;
305
- }
306
288
  get isInitialized() {
307
289
  return Promise.all([
308
290
  this.permissionsTopic$.isInitialized,
@@ -310,14 +292,64 @@ class UserService {
310
292
  // eslint-disable-next-line @typescript-eslint/no-empty-function
311
293
  ]).then(() => { });
312
294
  }
313
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: UserService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
314
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: UserService, providedIn: 'root' }); }
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' }); }
315
297
  }
316
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: UserService, decorators: [{
298
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: UserService, decorators: [{
317
299
  type: Injectable,
318
300
  args: [{ providedIn: 'root' }]
319
301
  }], ctorParameters: () => [] });
320
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
+
321
353
  class PortalMessageService {
322
354
  constructor() {
323
355
  this.translateService = inject(TranslateService);
@@ -348,21 +380,16 @@ class PortalMessageService {
348
380
  ])
349
381
  .pipe(first())
350
382
  .subscribe(([summaryTranslation, detailTranslation]) => {
351
- this.message$.publish({
352
- ...msg,
353
- severity: severity,
354
- summary: summaryTranslation,
355
- detail: detailTranslation,
356
- });
383
+ this.message$.publish(buildPortalMessagePayload(severity, msg, summaryTranslation, detailTranslation));
357
384
  });
358
385
  }
359
386
  ngOnDestroy() {
360
387
  this._message$?.destroy();
361
388
  }
362
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: PortalMessageService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
363
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: PortalMessageService, providedIn: 'any' }); }
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' }); }
364
391
  }
365
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: PortalMessageService, decorators: [{
392
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: PortalMessageService, decorators: [{
366
393
  type: Injectable,
367
394
  args: [{ providedIn: 'any' }]
368
395
  }] });
@@ -378,10 +405,10 @@ class ThemeService {
378
405
  ngOnDestroy() {
379
406
  this._currentTheme$?.destroy();
380
407
  }
381
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: ThemeService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
382
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: ThemeService, providedIn: 'root' }); }
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' }); }
383
410
  }
384
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: ThemeService, decorators: [{
411
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: ThemeService, decorators: [{
385
412
  type: Injectable,
386
413
  args: [{ providedIn: 'root' }]
387
414
  }] });
@@ -397,10 +424,10 @@ class RemoteComponentsService {
397
424
  ngOnDestroy() {
398
425
  this._remoteComponents$?.destroy();
399
426
  }
400
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: RemoteComponentsService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
401
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: RemoteComponentsService, providedIn: 'root' }); }
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' }); }
402
429
  }
403
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: RemoteComponentsService, decorators: [{
430
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: RemoteComponentsService, decorators: [{
404
431
  type: Injectable,
405
432
  args: [{ providedIn: 'root' }]
406
433
  }] });
@@ -408,164 +435,27 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImpo
408
435
  class WorkspaceService {
409
436
  constructor() {
410
437
  this.appStateService = inject(AppStateService);
411
- this.aliasStart = '[[';
412
- this.aliasEnd = ']]';
413
- this.paramStart = '{';
414
- this.paramEnd = '}';
438
+ this.logger = createLogger('WorkspaceService');
415
439
  }
416
440
  getUrl(productName, appId, endpointName, endpointParameters) {
417
441
  return this.appStateService.currentWorkspace$.pipe(map((workspace) => {
418
- const finalUrl = this.constructRouteUrl(workspace, appId, productName, endpointName, endpointParameters);
442
+ const finalUrl = constructRouteUrl(workspace, appId, productName, endpointName, endpointParameters, this.logger.warn);
419
443
  return finalUrl;
420
444
  }));
421
445
  }
422
446
  doesUrlExistFor(productName, appId, endpointName) {
423
- return this.appStateService.currentWorkspace$.pipe(map((workspace) => {
424
- const checkEndpoint = endpointName !== undefined && endpointName.length > 0;
425
- if (workspace.routes == undefined) {
426
- return false;
427
- }
428
- const route = this.filterRouteFromList(workspace.routes, appId, productName);
429
- if (checkEndpoint) {
430
- if (!route || route.endpoints === undefined || route.endpoints.length == 0) {
431
- return false;
432
- }
433
- const endpoint = route.endpoints.find((ep) => ep.name === endpointName);
434
- return !!(endpoint && endpoint.path && endpoint.path.length > 0);
435
- }
436
- else {
437
- return !!(route && route.baseUrl && route.baseUrl.length > 0);
438
- }
439
- }));
440
- }
441
- constructBaseUrlFromWorkspace(workspace) {
442
- if (workspace.baseUrl === undefined) {
443
- console.log('WARNING: There was no baseUrl for received workspace.');
444
- return '';
445
- }
446
- return workspace.baseUrl;
447
- }
448
- constructRouteUrl(workspace, appId, productName, endpointName, endpointParameters) {
449
- const route = this.filterRouteFromList(workspace.routes, appId, productName);
450
- let url = this.constructBaseUrlFromWorkspace(workspace);
451
- if (!route) {
452
- console.log(`WARNING: No route.baseUrl could be found for given appId "${appId}" and productName "${productName}"`);
453
- return url;
454
- }
455
- if (route.baseUrl !== undefined && route.baseUrl.length > 0) {
456
- url = route.baseUrl;
457
- }
458
- if (endpointName == undefined) {
459
- return url;
460
- }
461
- url = Location.joinWithSlash(url, this.constructEndpointUrl(route, endpointName, endpointParameters));
462
- return url;
463
- }
464
- constructEndpointUrl(route, endpointName, endpointParameters = {}) {
465
- if (!route.endpoints) {
466
- return '';
467
- }
468
- const finalEndpoint = this.dissolveEndpoint(endpointName, route.endpoints);
469
- if (!finalEndpoint || finalEndpoint.path === undefined) {
470
- console.log('WARNING: No endpoint or endpoint.path could be found');
471
- return '';
472
- }
473
- const paramsFilled = this.fillParamsForPath(finalEndpoint.path, endpointParameters);
474
- if (paramsFilled === undefined) {
475
- console.log('WARNING: Params could not be filled correctly');
476
- return '';
477
- }
478
- return paramsFilled;
479
- }
480
- filterRouteFromList(routes, appId, productName) {
481
- if (!routes) {
482
- return undefined;
483
- }
484
- const productRoutes = routes.filter((route) => route.appId === appId && route.productName === productName);
485
- if (productRoutes.length === 0) {
486
- return undefined;
487
- }
488
- if (productRoutes.length > 1) {
489
- console.log('WARNING: There were more than one route. First route has been used.');
490
- }
491
- return productRoutes[0];
447
+ return this.appStateService.currentWorkspace$.pipe(map((workspace) => doesUrlExistForWorkspace(workspace, productName, appId, endpointName, this.logger.warn)));
492
448
  }
493
- dissolveEndpoint(endpointName, endpoints) {
494
- let endpoint = endpoints.find((ep) => ep.name === endpointName);
495
- if (!endpoint) {
496
- return undefined;
497
- }
498
- while (endpoint.path?.includes(this.aliasStart)) {
499
- const path = endpoint.path;
500
- const startIdx = path.indexOf(this.aliasStart) + this.aliasStart.length;
501
- const endIdx = path.lastIndexOf(this.aliasEnd);
502
- if (endIdx <= startIdx) {
503
- return undefined;
504
- }
505
- const aliasName = path.substring(startIdx, endIdx);
506
- endpoint = endpoints.find((ep) => ep.name === aliasName);
507
- if (!endpoint) {
508
- return undefined;
509
- }
510
- }
511
- return endpoint;
512
- }
513
- fillParamsForPath(path, endpointParameters) {
514
- while (path.includes(this.paramStart)) {
515
- const paramName = path.substring(path.indexOf(this.paramStart) + this.paramStart.length, path.indexOf(this.paramEnd));
516
- const paramValue = this.getStringFromUnknown(endpointParameters[paramName]);
517
- if (paramValue != undefined && paramValue.length > 0) {
518
- path = path.replace(this.paramStart.concat(paramName).concat(this.paramEnd), paramValue);
519
- }
520
- else {
521
- console.log(`WARNING: Searched param "${paramName}" was not found in given param list `);
522
- return '';
523
- }
524
- }
525
- return path;
526
- }
527
- getStringFromUnknown(value) {
528
- if (value === null || value === undefined) {
529
- return '';
530
- }
531
- else if (typeof value === 'string') {
532
- return value;
533
- }
534
- else {
535
- return String(value);
536
- }
537
- }
538
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: WorkspaceService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
539
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: WorkspaceService, providedIn: 'root' }); }
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' }); }
540
451
  }
541
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: WorkspaceService, decorators: [{
452
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: WorkspaceService, decorators: [{
542
453
  type: Injectable,
543
454
  args: [{
544
455
  providedIn: 'root',
545
456
  }]
546
457
  }] });
547
458
 
548
- var Capability;
549
- (function (Capability) {
550
- Capability["CURRENT_LOCATION_TOPIC"] = "currentLocationTopic";
551
- Capability["PARAMETERS_TOPIC"] = "parametersTopic";
552
- Capability["ACTIVENESS_AWARE_MENUS"] = "activenessAwareMenus";
553
- })(Capability || (Capability = {}));
554
- class ShellCapabilityService {
555
- static setCapabilities(capabilities) {
556
- window['onecx-shell-capabilities'] = capabilities;
557
- }
558
- hasCapability(capability) {
559
- return window['onecx-shell-capabilities']?.includes(capability) ?? false;
560
- }
561
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: ShellCapabilityService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
562
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: ShellCapabilityService, providedIn: 'root' }); }
563
- }
564
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: ShellCapabilityService, decorators: [{
565
- type: Injectable,
566
- args: [{ providedIn: 'root' }]
567
- }] });
568
-
569
459
  class ImageRepositoryService {
570
460
  constructor() {
571
461
  this.imageRepositoryInterface = new ImageRepositoryService$1();
@@ -573,9 +463,6 @@ class ImageRepositoryService {
573
463
  get imageRepositoryTopic() {
574
464
  return this.imageRepositoryInterface.imageRepositoryTopic;
575
465
  }
576
- set imageRepositoryTopic(source) {
577
- this.imageRepositoryInterface.imageRepositoryTopic = source;
578
- }
579
466
  async getUrl(names, fallbackUrl) {
580
467
  if (fallbackUrl) {
581
468
  return this.imageRepositoryInterface.getUrl(names, fallbackUrl);
@@ -585,13 +472,73 @@ class ImageRepositoryService {
585
472
  ngOnDestroy() {
586
473
  this.imageRepositoryInterface.destroy();
587
474
  }
588
- destroy() {
589
- this.ngOnDestroy();
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) {
494
+ return this.iconServiceInterface.requestIconAsync(name, type);
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();
590
537
  }
591
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: ImageRepositoryService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
592
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: ImageRepositoryService, providedIn: 'root' }); }
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' }); }
593
540
  }
594
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: ImageRepositoryService, decorators: [{
541
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: NotificationService, decorators: [{
595
542
  type: Injectable,
596
543
  args: [{ providedIn: 'root' }]
597
544
  }] });
@@ -602,5 +549,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImpo
602
549
  * Generated bundle index. Do not edit.
603
550
  */
604
551
 
605
- export { APPLICATION_NAME, APP_CONFIG, AppConfigService, AppStateService, CONFIG_KEY, Capability, ConfigurationService, ImageRepositoryService, POLYFILL_SCOPE_MODE, PortalMessageService, RemoteComponentsService, SANITY_CHECK, ShellCapabilityService, ThemeService, UserService, WorkspaceService };
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 };
606
553
  //# sourceMappingURL=onecx-angular-integration-interface.mjs.map