oip-common 0.4.0 → 0.5.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.
package/index.d.ts CHANGED
@@ -1,10 +1,10 @@
1
1
  import * as i0 from '@angular/core';
2
2
  import { OnDestroy, OnInit, DestroyRef, WritableSignal, OnChanges, SimpleChanges, Type, InjectionToken, Provider, EventEmitter, Renderer2, EnvironmentProviders } from '@angular/core';
3
- import { MessageService, ToastMessageOptions, ConfirmationService, MenuItem, FilterMetadata } from 'primeng/api';
4
- import { ActivatedRoute, QueryParamsHandling, IsActiveMatchOptions, Params, Router, UrlTree } from '@angular/router';
5
- import { InterpolationParameters, Translation, TranslationObject, TranslateService } from '@ngx-translate/core';
6
3
  import * as rxjs from 'rxjs';
7
4
  import { Observable, BehaviorSubject, Subscription, Subject } from 'rxjs';
5
+ import { MessageService, ToastMessageOptions, ConfirmationService, MenuItem, FilterMetadata } from 'primeng/api';
6
+ import { ActivatedRoute, QueryParamsHandling, IsActiveMatchOptions, Params, Router } from '@angular/router';
7
+ import { InterpolationParameters, Translation, TranslationObject, TranslateService } from '@ngx-translate/core';
8
8
  import { ContextMenu } from 'primeng/contextmenu';
9
9
  import { PaletteDesignToken, Preset } from '@primeuix/themes/types';
10
10
  import { PrimeNG } from 'primeng/config';
@@ -22,6 +22,8 @@ interface TopBarDto {
22
22
 
23
23
  declare class TopBarService {
24
24
  topBarItems: TopBarDto[];
25
+ private readonly activeIdSubject;
26
+ readonly activeId$: rxjs.Observable<string>;
25
27
  private _activeId;
26
28
  get availableTopBarItems(): TopBarDto[];
27
29
  get activeTopBarItem(): TopBarDto | undefined;
@@ -45,8 +47,10 @@ declare class MsgService {
45
47
  error(detail: any, summary?: any, life?: number): void;
46
48
  extractErrorMessage(error: unknown, fallback: string): string;
47
49
  private extractValidationMessage;
50
+ private extractApiExceptionMessage;
48
51
  private toValidationMessages;
49
52
  private getObjectProperty;
53
+ private getStringProperty;
50
54
  errorFromException(error: unknown, fallback: string, summary?: string, life?: number): void;
51
55
  contrast(detail: any, summary?: any, life?: number): void;
52
56
  secondary(detail: any, summary?: any, life?: number): void;
@@ -81,6 +85,7 @@ interface AppConfig {
81
85
  timeFormat: string;
82
86
  dateTimeFormat: string;
83
87
  timeZone: string;
88
+ adminMode?: boolean;
84
89
  }
85
90
  interface LayoutState {
86
91
  staticMenuDesktopInactive?: boolean;
@@ -119,6 +124,7 @@ declare class LayoutService {
119
124
  dateTimeFormat: i0.Signal<string>;
120
125
  monthFormat: i0.Signal<string>;
121
126
  timeZone: i0.Signal<string>;
127
+ adminMode: i0.Signal<boolean>;
122
128
  transitionComplete: i0.WritableSignal<boolean>;
123
129
  private initialized;
124
130
  constructor();
@@ -162,6 +168,11 @@ declare class L10nService {
162
168
  * @param component - Name of the component to load translations for
163
169
  */
164
170
  loadComponentTranslations(component: string): Observable<unknown>;
171
+ /**
172
+ * Loads translations from an explicit asset URL and merges them into the active language dictionary.
173
+ * Use this for extension modules whose assets are hosted outside the shell application.
174
+ */
175
+ loadTranslationsFromUrl(namespace: string, url: string, lang?: string): Observable<unknown>;
165
176
  /**
166
177
  * Gets the translated value of a key (or an array of keys)
167
178
  * @returns the translated key, or an object of translated keys
@@ -212,10 +223,11 @@ declare abstract class SecurityService {
212
223
  abstract forceRefreshSession(customParams?: RefreshCustomParams, configId?: string): Observable<AuthSessionRefreshResult>;
213
224
  abstract getCsrfToken(): Observable<AuthCsrfToken | null>;
214
225
  abstract isAdmin(): boolean;
215
- abstract authorize(): void;
226
+ abstract authorize(returnUrl?: string): void;
216
227
  abstract payload: BehaviorSubject<any>;
217
228
  }
218
229
  declare class BffSecurityService implements OnDestroy, SecurityService {
230
+ static readonly authorizeAfterLogoutReturnUrlKey = "oip.authorizeAfterLogoutReturnUrl";
219
231
  private readonly http;
220
232
  private readonly authenticated;
221
233
  private readonly currentUser;
@@ -231,14 +243,18 @@ declare class BffSecurityService implements OnDestroy, SecurityService {
231
243
  forceRefreshSession(): Observable<AuthSessionRefreshResult>;
232
244
  getCsrfToken(): Observable<AuthCsrfToken | null>;
233
245
  isAdmin(): boolean;
234
- authorize(): void;
246
+ authorize(returnUrl?: string): void;
235
247
  ngOnDestroy(): void;
236
248
  private applySession;
237
249
  private createCurrentUser;
238
250
  private splitDisplayName;
239
251
  private applyAnonymousSession;
240
252
  private createPostForm;
253
+ private normalizeReturnUrl;
254
+ private replaceWithUnauthorizedUrl;
255
+ private storeAuthorizeAfterLogoutReturnUrl;
241
256
  private buildUrl;
257
+ private getBaseUrl;
242
258
  static ɵfac: i0.ɵɵFactoryDeclaration<BffSecurityService, never>;
243
259
  static ɵprov: i0.ɵɵInjectableDeclaration<BffSecurityService>;
244
260
  }
@@ -512,7 +528,9 @@ declare class SecurityComponent implements OnChanges, OnInit, OnDestroy {
512
528
  declare class UserService {
513
529
  private readonly securityService;
514
530
  private readonly userProfileApi;
515
- private requestedPhotoEmail;
531
+ private readonly msgService;
532
+ private readonly translateService;
533
+ private requestedPhotoKey;
516
534
  constructor();
517
535
  /**
518
536
  * Stores the user's photo as a data URL or binary blob, depending on how it's processed.
@@ -529,10 +547,11 @@ declare class UserService {
529
547
  get shortLabel(): string;
530
548
  get userName(): string;
531
549
  /**
532
- * Initiates an HTTP request to fetch the user's photo based on their email,
550
+ * Initiates an HTTP request to fetch the current user's photo,
533
551
  * and updates the `photo` and `photoLoaded` properties accordingly.
534
552
  */
535
553
  getUserPhoto(): void;
554
+ refreshUserPhoto(): void;
536
555
  /**
537
556
  * Converts a Blob image into a Base64 data URL and stores it in the `photo` property.
538
557
  *
@@ -540,6 +559,7 @@ declare class UserService {
540
559
  */
541
560
  private createImageFromBlob;
542
561
  private getInitials;
562
+ private getCurrentUserPhotoKey;
543
563
  static ɵfac: i0.ɵɵFactoryDeclaration<UserService, never>;
544
564
  static ɵprov: i0.ɵɵInjectableDeclaration<UserService>;
545
565
  }
@@ -561,6 +581,7 @@ declare class AppTopbar {
561
581
  logoService: LogoService;
562
582
  private readonly confirmationService;
563
583
  private readonly translateService;
584
+ onActiveTabChange(value: string | number | undefined): void;
564
585
  toggleDarkMode(): void;
565
586
  logoutKeyDown($event: KeyboardEvent): void;
566
587
  confirmLogout(): void;
@@ -600,6 +621,11 @@ interface EditModuleInstanceDto {
600
621
  viewRoles?: string[] | null;
601
622
  moduleId?: number | null;
602
623
  }
624
+ interface ExistModuleDto {
625
+ moduleId?: number;
626
+ name?: string | null;
627
+ currentlyLoaded?: boolean;
628
+ }
603
629
  interface FolderModuleSettings {
604
630
  html?: string | null;
605
631
  }
@@ -610,12 +636,6 @@ interface IntKeyValueDto {
610
636
  key?: number;
611
637
  value?: string | null;
612
638
  }
613
- interface ModuleDto {
614
- moduleId?: number;
615
- name?: string | null;
616
- settings?: string | null;
617
- moduleSecurities?: ModuleSecurityDto[] | null;
618
- }
619
639
  interface ModuleInstanceDto {
620
640
  moduleInstanceId?: number;
621
641
  moduleId?: number;
@@ -631,14 +651,10 @@ interface ModuleInstanceDto {
631
651
  order?: number;
632
652
  separator?: boolean;
633
653
  }
634
- interface ModuleSecurityDto {
635
- right: string | null;
636
- role: string | null;
637
- }
638
- interface GetModuleInstanceSettingsParams {
654
+ interface GetModuleInstanceSettingsParams2 {
639
655
  id?: number;
640
656
  }
641
- interface GetModuleInstanceSettingsParams2 {
657
+ interface GetModuleInstanceSettingsParams4 {
642
658
  id?: number;
643
659
  }
644
660
  interface DeleteModuleInstanceParams {
@@ -706,11 +722,13 @@ declare class MenuService {
706
722
  private readonly resetSource;
707
723
  private readonly titleService;
708
724
  private readonly menuDataService;
725
+ private readonly layoutService;
709
726
  menuSource$: rxjs.Observable<MenuChangeEvent>;
710
727
  resetSource$: rxjs.Observable<unknown>;
711
728
  contextMenuItem: any;
712
729
  menu: ModuleInstanceDto[];
713
- adminMode: boolean;
730
+ get adminMode(): boolean;
731
+ set adminMode(value: boolean);
714
732
  loadMenu(): Promise<void>;
715
733
  /**
716
734
  * Handles changes in the menu state.
@@ -848,10 +866,10 @@ declare class NotfoundComponent {
848
866
  static ɵcmp: i0.ɵɵComponentDeclaration<NotfoundComponent, "app-notfound", never, {}, {}, never, never, true, never>;
849
867
  }
850
868
 
851
- declare class UnauthorizedComponent {
869
+ declare class UnauthorizedComponent implements OnInit {
852
870
  protected readonly securityService: SecurityService;
853
871
  private readonly route;
854
- private readonly router;
872
+ ngOnInit(): void;
855
873
  protected signIn(): void;
856
874
  static ɵfac: i0.ɵɵFactoryDeclaration<UnauthorizedComponent, never>;
857
875
  static ɵcmp: i0.ɵɵComponentDeclaration<UnauthorizedComponent, "ng-component", never, {}, {}, never, never, true, never>;
@@ -862,11 +880,40 @@ declare class ErrorComponent {
862
880
  static ɵcmp: i0.ɵɵComponentDeclaration<ErrorComponent, "app-error", never, {}, {}, never, never, true, never>;
863
881
  }
864
882
 
883
+ interface UserSettingsDto {
884
+ preset?: string | null;
885
+ primary?: string | null;
886
+ surface?: string | null;
887
+ darkTheme?: boolean;
888
+ menuMode?: string | null;
889
+ language?: string | null;
890
+ dateFormat?: string | null;
891
+ timeFormat?: string | null;
892
+ timeZone?: string | null;
893
+ }
894
+ interface GetUserPhotoByIdParams {
895
+ userId: number;
896
+ }
897
+ interface PostUserPhotoPayload {
898
+ files?: Blob;
899
+ }
900
+
901
+ declare class UserProfileApi<SecurityDataType = unknown> extends HttpClient<SecurityDataType> {
902
+ getUserPhoto: (params?: RequestParams) => Promise<Blob>;
903
+ getUserPhotoById: ({ userId, ...query }: GetUserPhotoByIdParams, params?: RequestParams) => Promise<Blob>;
904
+ postUserPhoto: (data: PostUserPhotoPayload, params?: RequestParams) => Promise<void>;
905
+ getSettings: (params?: RequestParams) => Promise<UserSettingsDto>;
906
+ setSettings: (data: UserSettingsDto, params?: RequestParams) => Promise<void>;
907
+ static ɵfac: i0.ɵɵFactoryDeclaration<UserProfileApi<any>, never>;
908
+ static ɵprov: i0.ɵɵInjectableDeclaration<UserProfileApi<any>>;
909
+ }
910
+
865
911
  declare class ProfileComponent {
866
912
  readonly userService: UserService;
867
913
  readonly msgService: MsgService;
868
914
  readonly translateService: TranslateService;
869
- onBasicUploadAuto($event: any): void;
915
+ readonly userProfileApi: UserProfileApi<any>;
916
+ uploadPhoto(event: any): Promise<void>;
870
917
  static ɵfac: i0.ɵɵFactoryDeclaration<ProfileComponent, never>;
871
918
  static ɵcmp: i0.ɵɵComponentDeclaration<ProfileComponent, "user-profile", never, {}, {}, never, never, true, never>;
872
919
  }
@@ -918,17 +965,22 @@ declare class DbMigrationComponent extends BaseModuleComponent<NoSettingsDto, No
918
965
  }
919
966
 
920
967
  declare class AppModulesComponent implements OnInit {
921
- protected modules: ModuleDto[];
968
+ protected modules: ExistModuleDto[];
922
969
  protected msgService: MsgService;
923
970
  protected confirmationService: ConfirmationService;
924
971
  protected l10nService: L10nService;
925
972
  protected titleService: AppTitleService;
973
+ protected externalModuleManifestUrl: string;
974
+ protected registeringExternalModule: boolean;
926
975
  private moduleService;
976
+ private extensionModulesService;
927
977
  private translationsReady;
928
978
  constructor();
929
979
  ngOnInit(): Promise<void>;
930
980
  refreshAction(): Promise<void>;
931
- deleteModule(module: ModuleDto): Promise<void>;
981
+ protected get canRegisterExternalModule(): boolean;
982
+ registerExternalModule(): Promise<void>;
983
+ deleteModule(module: ExistModuleDto): Promise<void>;
932
984
  t(key: string): any;
933
985
  static ɵfac: i0.ɵɵFactoryDeclaration<AppModulesComponent, never>;
934
986
  static ɵcmp: i0.ɵɵComponentDeclaration<AppModulesComponent, "app-modules", never, {}, {}, never, never, true, never>;
@@ -1255,6 +1307,39 @@ declare class IframeModuleComponent extends BaseModuleComponent<IframeModuleSett
1255
1307
  static ɵcmp: i0.ɵɵComponentDeclaration<IframeModuleComponent, "ng-component", never, {}, {}, never, never, true, never>;
1256
1308
  }
1257
1309
 
1310
+ declare class ExtensionModuleHostComponent extends BaseModuleComponent<unknown, unknown> implements OnDestroy {
1311
+ private set extensionViewContainer(value);
1312
+ private readonly injector;
1313
+ private readonly environmentInjector;
1314
+ private readonly extensionModulesApi;
1315
+ private viewContainer?;
1316
+ private extensionComponent?;
1317
+ private extensionElement?;
1318
+ private extensionMetadata?;
1319
+ private renderQueued;
1320
+ private destroyed;
1321
+ protected loadError: string | null;
1322
+ private get extensionKey();
1323
+ constructor();
1324
+ reloadExtension(): Promise<void>;
1325
+ protected onModuleInstanceChange(): Promise<void>;
1326
+ protected onSecurityRightsChange(): void;
1327
+ ngOnDestroy(): void;
1328
+ private loadExtensionMetadata;
1329
+ private renderExtension;
1330
+ private queueRenderExtension;
1331
+ private destroyExtensionComponent;
1332
+ private renderFederatedExtension;
1333
+ private loadExtensionTranslations;
1334
+ private buildExtensionI18nUrl;
1335
+ private getExtensionTranslationNamespaces;
1336
+ private toKebabCase;
1337
+ private updateExtensionContext;
1338
+ private buildUrl;
1339
+ static ɵfac: i0.ɵɵFactoryDeclaration<ExtensionModuleHostComponent, never>;
1340
+ static ɵcmp: i0.ɵɵComponentDeclaration<ExtensionModuleHostComponent, "ng-component", never, {}, {}, never, never, true, never>;
1341
+ }
1342
+
1258
1343
  declare enum ImportanceLevel {
1259
1344
  Unspecified = "Unspecified",
1260
1345
  Low = "Low",
@@ -1345,17 +1430,15 @@ declare class AppTopbarApplicationSwitcherComponent implements OnInit {
1345
1430
  */
1346
1431
  declare class AuthGuardService {
1347
1432
  private readonly oidcSecurityService;
1348
- private readonly router;
1349
1433
  /**
1350
1434
  * Checks whether the route can be activated.
1351
1435
  * - Returns `true` if the user is authenticated and the token is valid.
1352
1436
  * - Attempts to refresh the token if expired.
1353
- * - Redirects to `/unauthorized` if not authenticated or refresh fails.
1437
+ * - Starts the authorization flow if not authenticated or refresh fails.
1354
1438
  *
1355
- * @returns {Observable<boolean | UrlTree>} A stream resolving to true (allow), or UrlTree (redirect).
1439
+ * @returns {Observable<boolean>} A stream resolving to true (allow), or false after starting authorization.
1356
1440
  */
1357
- canActivate(returnUrl?: string): Observable<boolean | UrlTree>;
1358
- private getReturnUrl;
1441
+ canActivate(returnUrl?: string): Observable<boolean>;
1359
1442
  static ɵfac: i0.ɵɵFactoryDeclaration<AuthGuardService, never>;
1360
1443
  static ɵprov: i0.ɵɵInjectableDeclaration<AuthGuardService>;
1361
1444
  }
@@ -1402,6 +1485,13 @@ declare class TableFilterService {
1402
1485
  static ɵprov: i0.ɵɵInjectableDeclaration<TableFilterService>;
1403
1486
  }
1404
1487
 
1488
+ declare class ExtensionLoaderService {
1489
+ private readonly loadedScripts;
1490
+ loadScript(scriptUrl: string): Promise<void>;
1491
+ static ɵfac: i0.ɵɵFactoryDeclaration<ExtensionLoaderService, never>;
1492
+ static ɵprov: i0.ɵɵInjectableDeclaration<ExtensionLoaderService>;
1493
+ }
1494
+
1405
1495
  interface AppThemePreset {
1406
1496
  id: string;
1407
1497
  label?: string;
@@ -1420,18 +1510,93 @@ declare function provideAppThemes(themes: AppThemePreset[], options?: ProvideApp
1420
1510
  declare function mergeWithDefaults(themes: AppThemePreset[]): EnvironmentProviders;
1421
1511
  declare function replaceDefaults(themes: AppThemePreset[]): EnvironmentProviders;
1422
1512
 
1513
+ declare const defaultTheme: AppThemePreset[];
1514
+
1423
1515
  declare function provideOip(): i0.EnvironmentProviders;
1424
1516
 
1425
1517
  declare const langIntercept: HttpInterceptorFn;
1426
1518
 
1519
+ interface OipExtensionManifest {
1520
+ key: string;
1521
+ name: string;
1522
+ version: string;
1523
+ loadType?: OipExtensionLoadType;
1524
+ elementName?: string | null;
1525
+ scriptUrl?: string | null;
1526
+ remoteEntryUrl?: string | null;
1527
+ exposedModule?: string | null;
1528
+ componentName?: string | null;
1529
+ apiBaseUrl: string;
1530
+ icon?: string | null;
1531
+ description?: string | null;
1532
+ permissions?: unknown;
1533
+ settingsSchema?: unknown;
1534
+ }
1535
+ type OipExtensionLoadType = 'moduleFederation' | 'customElement';
1536
+ interface OipExtensionModuleMetadata {
1537
+ moduleId: number;
1538
+ name: string;
1539
+ settings?: string | null;
1540
+ kind: number;
1541
+ manifestUrl?: string | null;
1542
+ extensionKey?: string | null;
1543
+ loadType?: OipExtensionLoadType | null;
1544
+ elementName?: string | null;
1545
+ scriptUrl?: string | null;
1546
+ remoteEntryUrl?: string | null;
1547
+ exposedModule?: string | null;
1548
+ componentName?: string | null;
1549
+ apiBaseUrl?: string | null;
1550
+ version?: string | null;
1551
+ }
1552
+ interface OipExtensionHostContext {
1553
+ moduleInstanceId: number | undefined;
1554
+ extensionKey: string;
1555
+ apiBasePath: string;
1556
+ settings: unknown;
1557
+ locale?: string;
1558
+ theme?: unknown;
1559
+ user?: unknown;
1560
+ activeTabId?: string;
1561
+ permissions: {
1562
+ canRead: boolean;
1563
+ canEdit: boolean;
1564
+ canDelete: boolean;
1565
+ };
1566
+ }
1567
+ interface OipExtensionNotifyEvent {
1568
+ severity?: 'success' | 'info' | 'warn' | 'error';
1569
+ summary?: string;
1570
+ detail?: string;
1571
+ }
1572
+ interface OipExtensionNavigateEvent {
1573
+ commands?: unknown[];
1574
+ url?: string;
1575
+ }
1576
+
1577
+ declare const OIP_EXTENSION_EVENTS: {
1578
+ readonly contextChange: "oip:context-change";
1579
+ readonly titleChange: "oip:title-change";
1580
+ readonly settingsChange: "oip:settings-change";
1581
+ readonly notify: "oip:notify";
1582
+ readonly navigate: "oip:navigate";
1583
+ readonly error: "oip:error";
1584
+ };
1585
+ declare function emitOipTitleChange(element: HTMLElement, title: string): void;
1586
+ declare function emitOipSettingsChange(element: HTMLElement, settings: unknown): void;
1587
+ declare function emitOipNotify(element: HTMLElement, notification: OipExtensionNotifyEvent): void;
1588
+ declare function emitOipNavigate(element: HTMLElement, navigation: OipExtensionNavigateEvent): void;
1589
+ declare function emitOipError(element: HTMLElement, error: unknown): void;
1590
+ declare function emitOipContextChange(element: HTMLElement, context: OipExtensionHostContext): void;
1591
+
1427
1592
  declare class FolderModuleApi<SecurityDataType = unknown> extends HttpClient<SecurityDataType> {
1428
- getModuleInstanceSettings: (query: GetModuleInstanceSettingsParams, params?: RequestParams) => Promise<FolderModuleSettings>;
1593
+ getModuleInstanceSettings: (query: GetModuleInstanceSettingsParams2, params?: RequestParams) => Promise<FolderModuleSettings>;
1429
1594
  static ɵfac: i0.ɵɵFactoryDeclaration<FolderModuleApi<any>, never>;
1430
1595
  static ɵprov: i0.ɵɵInjectableDeclaration<FolderModuleApi<any>>;
1431
1596
  }
1432
1597
 
1433
1598
  declare class IframeModuleApi<SecurityDataType = unknown> extends HttpClient<SecurityDataType> {
1434
- getModuleInstanceSettings: (query: GetModuleInstanceSettingsParams2, params?: RequestParams) => Promise<IframeModuleSettings>;
1599
+ getModuleInstanceSettings: (query: GetModuleInstanceSettingsParams4, params?: RequestParams) => Promise<IframeModuleSettings>;
1435
1600
  static ɵfac: i0.ɵɵFactoryDeclaration<IframeModuleApi<any>, never>;
1436
1601
  static ɵprov: i0.ɵɵInjectableDeclaration<IframeModuleApi<any>>;
1437
1602
  }
@@ -1456,33 +1621,6 @@ declare class ApplicationsApi<SecurityDataType = unknown> extends HttpClient<Sec
1456
1621
  static ɵprov: i0.ɵɵInjectableDeclaration<ApplicationsApi<any>>;
1457
1622
  }
1458
1623
 
1459
- interface UserSettingsDto {
1460
- preset?: string | null;
1461
- primary?: string | null;
1462
- surface?: string | null;
1463
- darkTheme?: boolean;
1464
- menuMode?: string | null;
1465
- language?: string | null;
1466
- dateFormat?: string | null;
1467
- timeFormat?: string | null;
1468
- timeZone?: string | null;
1469
- }
1470
- interface GetUserPhotoParams {
1471
- email?: string;
1472
- }
1473
- interface PostUserPhotoPayload {
1474
- files?: File;
1475
- }
1476
-
1477
- declare class UserProfileApi<SecurityDataType = unknown> extends HttpClient<SecurityDataType> {
1478
- getUserPhoto: (query: GetUserPhotoParams, params?: RequestParams) => Promise<File>;
1479
- postUserPhoto: (data: PostUserPhotoPayload, params?: RequestParams) => Promise<void>;
1480
- getSettings: (params?: RequestParams) => Promise<UserSettingsDto>;
1481
- setSettings: (data: UserSettingsDto, params?: RequestParams) => Promise<void>;
1482
- static ɵfac: i0.ɵɵFactoryDeclaration<UserProfileApi<any>, never>;
1483
- static ɵprov: i0.ɵɵInjectableDeclaration<UserProfileApi<any>>;
1484
- }
1485
-
1486
1624
  declare function convertToPrimeNgDateFormat(dateformat: string): string;
1487
1625
 
1488
1626
  declare class NotificationApi<SecurityDataType = unknown> extends HttpClient<SecurityDataType> {
@@ -1494,5 +1632,47 @@ declare class NotificationApi<SecurityDataType = unknown> extends HttpClient<Sec
1494
1632
  static ɵprov: i0.ɵɵInjectableDeclaration<NotificationApi<any>>;
1495
1633
  }
1496
1634
 
1497
- export { APP_THEME_PRESETS, APP_THEME_PRESETS_MERGE_MODE, AppConfiguratorComponent, AppFloatingConfiguratorComponent, AppLayoutComponent, AppModulesComponent, AppTopbar, AppTopbarApplicationSwitcherComponent, ApplicationRegistryService, ApplicationsApi, ApplicationsComponent, AuthGuardService, BaseModuleComponent, BffSecurityService, ConfigComponent, ContentType, DbMigrationComponent, DiscussionComponent, ErrorComponent, FolderModuleApi, FooterComponent, HttpClient, IframeModuleApi, IframeModuleComponent, L10nService, LOGO_COMPONENT_TOKEN, LayoutService, LogoComponent, LogoService, MenuComponent, MenuService, MsgService, NotfoundComponent, NotificationApi, NotificationService, ProfileComponent, SecurityApi, SecurityComponent, SecurityService, SidebarComponent, TableFilterService, TopBarService, UnauthorizedComponent, UserNotificationsComponent, UserProfileApi, UserService, convertToPrimeNgDateFormat, langIntercept, mergeWithDefaults, provideAppThemes, provideLogoComponent, provideOip, replaceDefaults };
1498
- export type { AppConfig, AppThemePreset, AppThemePresetMergeMode, AuthCsrfToken, LanguageDto, MenuChangeEvent, NoSettingsDto, PutSecurityDto, RequestParams, SecurityDto, TopBarDto };
1635
+ declare class CustomElementExtensionModuleHostComponent extends BaseModuleComponent<unknown, unknown> implements OnDestroy {
1636
+ private set extensionContainer(value);
1637
+ private readonly extensionLoader;
1638
+ private readonly router;
1639
+ private readonly hostChangeDetectorRef;
1640
+ private readonly extensionModulesApi;
1641
+ private container?;
1642
+ private extensionElement?;
1643
+ private extensionMetadata?;
1644
+ private removeListeners;
1645
+ private renderQueued;
1646
+ private activeTabSyncQueued;
1647
+ private activeTabId;
1648
+ private destroyed;
1649
+ protected loadError: string | null;
1650
+ protected get showContent(): boolean;
1651
+ protected get showSettings(): boolean;
1652
+ protected get showSecurity(): boolean;
1653
+ private get extensionKey();
1654
+ constructor();
1655
+ protected onModuleInstanceChange(): Promise<void>;
1656
+ protected onSecurityRightsChange(): void;
1657
+ ngOnDestroy(): void;
1658
+ reloadExtension(): Promise<void>;
1659
+ private loadExtensionMetadata;
1660
+ private renderExtension;
1661
+ private queueRenderExtension;
1662
+ private isActiveTab;
1663
+ private queueActiveTabSync;
1664
+ private getCurrentActiveTabId;
1665
+ private updateExtensionContext;
1666
+ private attachListeners;
1667
+ private buildUrl;
1668
+ private loadExtensionTranslations;
1669
+ private buildExtensionI18nUrl;
1670
+ private addListener;
1671
+ private destroyExtensionElement;
1672
+ private renderCustomElementExtension;
1673
+ static ɵfac: i0.ɵɵFactoryDeclaration<CustomElementExtensionModuleHostComponent, never>;
1674
+ static ɵcmp: i0.ɵɵComponentDeclaration<CustomElementExtensionModuleHostComponent, "ng-component", never, {}, {}, never, never, true, never>;
1675
+ }
1676
+
1677
+ export { APP_THEME_PRESETS, APP_THEME_PRESETS_MERGE_MODE, AppConfiguratorComponent, AppFloatingConfiguratorComponent, AppLayoutComponent, AppModulesComponent, AppTopbar, AppTopbarApplicationSwitcherComponent, ApplicationRegistryService, ApplicationsApi, ApplicationsComponent, AuthGuardService, BaseModuleComponent, BffSecurityService, ConfigComponent, ContentType, CustomElementExtensionModuleHostComponent, DbMigrationComponent, DiscussionComponent, ErrorComponent, ExtensionLoaderService, ExtensionModuleHostComponent, FolderModuleApi, FooterComponent, HttpClient, IframeModuleApi, IframeModuleComponent, L10nService, LOGO_COMPONENT_TOKEN, LayoutService, LogoComponent, LogoService, MenuComponent, MenuService, MsgService, NotfoundComponent, NotificationApi, NotificationService, OIP_EXTENSION_EVENTS, ProfileComponent, SecurityApi, SecurityComponent, SecurityService, SidebarComponent, TableFilterService, TopBarService, UnauthorizedComponent, UserNotificationsComponent, UserProfileApi, UserService, convertToPrimeNgDateFormat, defaultTheme, emitOipContextChange, emitOipError, emitOipNavigate, emitOipNotify, emitOipSettingsChange, emitOipTitleChange, langIntercept, mergeWithDefaults, provideAppThemes, provideLogoComponent, provideOip, replaceDefaults };
1678
+ export type { AppConfig, AppThemePreset, AppThemePresetMergeMode, AuthCsrfToken, LanguageDto, MenuChangeEvent, NoSettingsDto, OipExtensionHostContext, OipExtensionLoadType, OipExtensionManifest, OipExtensionModuleMetadata, OipExtensionNavigateEvent, OipExtensionNotifyEvent, PutSecurityDto, RequestParams, SecurityDto, TopBarDto };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oip-common",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
4
4
  "description": "A template for cross-platform web applications based on sakai-ng and primeNG",
5
5
  "main": "index.js",
6
6
  "keywords": [
@@ -8,7 +8,7 @@
8
8
  "template"
9
9
  ],
10
10
  "peerDependencies": {
11
- "@fortawesome/fontawesome-free": "^7.2.0"
11
+ "@angular-architects/module-federation": "^20.0.0"
12
12
  },
13
13
  "author": "Igor Tyulyakov aka g101k",
14
14
  "license": "MIT",
@@ -67,7 +67,7 @@ let config = {
67
67
  fixInvalidTypeNamePrefix: "Type",
68
68
  fixInvalidEnumKeyPrefix: "Value",
69
69
  codeGenConstructs: (constructs) => ({
70
- ...constructs,
70
+ ...constructs
71
71
  }),
72
72
  primitiveTypeConstructs: (constructs) => ({
73
73
  ...constructs,
@@ -84,13 +84,13 @@ let config = {
84
84
  onCreateRouteName: (routeNameInfo, rawRouteInfo) => {
85
85
  const route = rawRouteInfo.route || rawRouteInfo.path || "<unknown route>";
86
86
  const method = rawRouteInfo.method || rawRouteInfo.requestMethod || "<unknown method>";
87
- const tags = Array.isArray(rawRouteInfo.tags) ? rawRouteInfo.tags.join(", ") : (rawRouteInfo.tags || "<none>");
87
+ const tags = Array.isArray(rawRouteInfo.tags) ? rawRouteInfo.tags.join(", ") : rawRouteInfo.tags || "<none>";
88
88
  const moduleName = rawRouteInfo.moduleName;
89
89
 
90
90
  if (!moduleName) {
91
91
  throw new Error(
92
92
  `Invalid API route name for ${method.toUpperCase()} ${route}. Missing moduleName. Tags: ${tags}. ` +
93
- "Add a controller tag/module name or provide explicit operationId.",
93
+ "Add a controller tag/module name or provide explicit operationId."
94
94
  );
95
95
  }
96
96
 
@@ -98,7 +98,7 @@ let config = {
98
98
  throw new Error(
99
99
  `Invalid API route name for ${method.toUpperCase()} ${route}. Generated usage "${routeNameInfo.usage}" ` +
100
100
  `equals moduleName "${moduleName}". Add an action segment in controller route, ` +
101
- `e.g. [HttpGet("get-${moduleName}")], or provide explicit operationId.`,
101
+ `e.g. [HttpGet("get-${moduleName}")], or provide explicit operationId.`
102
102
  );
103
103
  }
104
104
 
@@ -238,7 +238,10 @@ export class HttpClient<SecurityDataType = unknown> {
238
238
  }
239
239
 
240
240
  <% if (!config.disableThrowOnError) { %>
241
- if (!response.ok) throw data;
241
+ if (!response.ok) {
242
+ this.authorizeOnUnauthorized(response, path);
243
+ throw data;
244
+ }
242
245
  <% } %>
243
246
  <% if (config.unwrapResponseData) { %>
244
247
  return data.data;
@@ -248,6 +251,16 @@ export class HttpClient<SecurityDataType = unknown> {
248
251
  });
249
252
  };
250
253
 
254
+ private authorizeOnUnauthorized(response: Response, path: string): void {
255
+ if (response.status !== 401 || path.includes("/api/security/create-auth-session")) {
256
+ return;
257
+ }
258
+
259
+ this.securityService.authorize(
260
+ `${window.location.pathname}${window.location.search}${window.location.hash}`,
261
+ );
262
+ }
263
+
251
264
  private async getCsrfRequestParams(method: string | undefined, path: string): Promise<RequestParams> {
252
265
  if (!method || !["POST", "PUT", "PATCH", "DELETE"].includes(method.toUpperCase())) {
253
266
  return {};