oip-common 0.1.3 → 0.1.5

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.
@@ -7,7 +7,7 @@ import * as i2$4 from '@ngx-translate/core';
7
7
  import { TranslateService, TranslatePipe, TranslateModule } from '@ngx-translate/core';
8
8
  import * as i1$3 from '@angular/router';
9
9
  import { ActivatedRoute, Router, RouterModule, NavigationEnd, RouterLinkActive, RouterLink } from '@angular/router';
10
- import { lastValueFrom, BehaviorSubject, Subject, filter as filter$1, combineLatest, of, map as map$1, Observable } from 'rxjs';
10
+ import { lastValueFrom, BehaviorSubject, Subject, ReplaySubject, merge, filter as filter$1, combineLatest, of, map as map$1, Observable } from 'rxjs';
11
11
  import { Title, DomSanitizer } from '@angular/platform-browser';
12
12
  import * as i1 from 'primeng/multiselect';
13
13
  import { MultiSelectModule } from 'primeng/multiselect';
@@ -29,7 +29,7 @@ import { PrimeNG } from 'primeng/config';
29
29
  import * as i3 from 'primeng/selectbutton';
30
30
  import { SelectButtonModule } from 'primeng/selectbutton';
31
31
  import { OidcSecurityService, PublicEventsService, EventTypes, StsConfigHttpLoader } from 'angular-auth-oidc-client';
32
- import { filter, map, distinctUntilChanged, switchMap, catchError } from 'rxjs/operators';
32
+ import { filter, distinctUntilChanged, map, switchMap, catchError } from 'rxjs/operators';
33
33
  import { Tabs, TabList, Tab } from 'primeng/tabs';
34
34
  import * as i2$2 from 'primeng/avatar';
35
35
  import { AvatarModule } from 'primeng/avatar';
@@ -1479,10 +1479,16 @@ class KeycloakSecurityService extends OidcSecurityService {
1479
1479
  * Stores user-specific data from the login response.
1480
1480
  */
1481
1481
  this.currentUser = new BehaviorSubject(null);
1482
+ /**
1483
+ * Emits access token updates from initial auth check, manual refresh,
1484
+ * and library authentication events.
1485
+ */
1486
+ this.accessToken = new ReplaySubject(1);
1482
1487
  this.publicEventsService
1483
1488
  .registerForEvents()
1484
1489
  .pipe(filter((event) => event.type === EventTypes.NewAuthenticationResult))
1485
1490
  .subscribe(() => {
1491
+ super.getAccessToken().subscribe(token => { this.accessToken.next(token); });
1486
1492
  this.auth();
1487
1493
  });
1488
1494
  }
@@ -1496,8 +1502,8 @@ class KeycloakSecurityService extends OidcSecurityService {
1496
1502
  * Returns the ID token for the sign-in.
1497
1503
  * @returns A string with the id token.
1498
1504
  */
1499
- getAccessToken() {
1500
- return super.getAccessToken();
1505
+ getAccessToken(configId) {
1506
+ return merge(super.getAccessToken(configId), this.accessToken.asObservable()).pipe(distinctUntilChanged());
1501
1507
  }
1502
1508
  /**
1503
1509
  * Indicates whether the current user has the 'admin' role.
@@ -1736,101 +1742,101 @@ class AppTopbar {
1736
1742
  }
1737
1743
  }
1738
1744
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: AppTopbar, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1739
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.16", type: AppTopbar, isStandalone: true, selector: "app-topbar", ngImport: i0, template: ` <div class="layout-topbar">
1740
- <div class="layout-topbar-logo-container">
1741
- <button class="layout-menu-button layout-topbar-action" (click)="layoutService.onMenuToggle()">
1742
- <i class="pi pi-bars"></i>
1743
- </button>
1744
- <a class="layout-topbar-logo" id="oip-app-topbar-logo-link" routerLink="">
1745
- <ng-container
1746
- *ngComponentOutlet="logoService.getLogoComponent(); inputs: { width: 36, height: 36 }"></ng-container>
1747
- <span>{{ 'app-info.title' | translate }}</span>
1748
- </a>
1749
- </div>
1750
-
1751
- @if (securityService.isAdmin() && topBarService.topBarItems.length > 0) {
1752
- <p-tabs class="layout-topbar-tabs ml-2" [(value)]="topBarService.activeId">
1753
- <p-tablist>
1754
- @for (tab of topBarService.availableTopBarItems; track tab.id) {
1755
- <p-tab id="oip-app-topbar-tab-{{ tab.id }}" [value]="tab.id">
1756
- <i class="pi {{ tab.icon }}"></i>
1757
- <span class="ml-2">{{ tab.caption }}</span>
1758
- </p-tab>
1759
- }
1760
- </p-tablist>
1761
- </p-tabs>
1762
- }
1763
- <div class="layout-topbar-actions">
1764
- <div class="layout-config-menu">
1765
- <p-button
1766
- class="layout-topbar-action"
1767
- id="oip-app-topbar-theme-button"
1768
- severity="secondary"
1769
- type="button"
1770
- [rounded]="true"
1771
- [text]="true"
1772
- (click)="toggleDarkMode()">
1773
- <i
1774
- class="pi"
1775
- [ngClass]="{
1776
- 'pi-moon': layoutService.isDarkTheme(),
1777
- 'pi-sun': !layoutService.isDarkTheme()
1778
- }"></i>
1779
- </p-button>
1780
- <div class="relative">
1781
- <p-button
1782
- class="layout-topbar-action layout-topbar-action-highlight"
1783
- enterActiveClass="animate-scalein"
1784
- enterFromClass="hidden"
1785
- id="oip-app-topbar-palette-button"
1786
- leaveActiveClass="animate-fadeout"
1787
- leaveToClass="hidden"
1788
- pStyleClass="@next"
1789
- [hideOnOutsideClick]="true"
1790
- [rounded]="true">
1791
- <i class="pi pi-palette"></i>
1792
- </p-button>
1793
- <app-configurator />
1794
- </div>
1795
- </div>
1796
-
1797
- <button
1798
- class="layout-topbar-menu-button layout-topbar-action"
1799
- enterActiveClass="animate-scalein"
1800
- enterFromClass="hidden"
1801
- id="oip-app-topbar-menu-expand-button"
1802
- leaveActiveClass="animate-fadeout"
1803
- leaveToClass="hidden"
1804
- pStyleClass="@next"
1805
- [hideOnOutsideClick]="true">
1806
- <i class="pi pi-ellipsis-v"></i>
1807
- </button>
1808
-
1809
- <div class="layout-topbar-menu hidden lg:block">
1810
- <div class="layout-topbar-menu-content">
1811
- <button
1812
- class="layout-topbar-action"
1813
- id="oip-app-topbar-logout-button"
1814
- type="button"
1815
- (click)="securityService.logout()"
1816
- (keydown)="logoutKeyDown($event)">
1817
- <i class="pi pi-sign-out"></i>
1818
- <span>{{ 'topbar.logout' | translate }}</span>
1819
- </button>
1820
- <button class="layout-topbar-action" routerLink="config">
1821
- <p-avatar
1822
- class="p-link flex align-items-center"
1823
- id="oip-app-topbar-user-avatar"
1824
- shape="circle"
1825
- size="normal"
1826
- [image]="userService.photoLoaded ? userService.photo : null"
1827
- >{{ !userService.photoLoaded ? userService.shortLabel : null }}
1828
- </p-avatar>
1829
- <span class="ml-2">{{ 'topbar.profile' | translate }}</span>
1830
- </button>
1831
- </div>
1832
- </div>
1833
- </div>
1745
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.16", type: AppTopbar, isStandalone: true, selector: "app-topbar", ngImport: i0, template: ` <div class="layout-topbar">
1746
+ <div class="layout-topbar-logo-container">
1747
+ <button class="layout-menu-button layout-topbar-action" (click)="layoutService.onMenuToggle()">
1748
+ <i class="pi pi-bars"></i>
1749
+ </button>
1750
+ <a class="layout-topbar-logo" id="oip-app-topbar-logo-link" routerLink="">
1751
+ <ng-container
1752
+ *ngComponentOutlet="logoService.getLogoComponent(); inputs: { width: 36, height: 36 }"></ng-container>
1753
+ <span>{{ 'app-info.title' | translate }}</span>
1754
+ </a>
1755
+ </div>
1756
+
1757
+ @if (securityService.isAdmin() && topBarService.topBarItems.length > 0) {
1758
+ <p-tabs class="layout-topbar-tabs ml-2" [(value)]="topBarService.activeId">
1759
+ <p-tablist>
1760
+ @for (tab of topBarService.availableTopBarItems; track tab.id) {
1761
+ <p-tab id="oip-app-topbar-tab-{{ tab.id }}" [value]="tab.id">
1762
+ <i class="pi {{ tab.icon }}"></i>
1763
+ <span class="ml-2">{{ tab.caption }}</span>
1764
+ </p-tab>
1765
+ }
1766
+ </p-tablist>
1767
+ </p-tabs>
1768
+ }
1769
+ <div class="layout-topbar-actions">
1770
+ <div class="layout-config-menu">
1771
+ <p-button
1772
+ class="layout-topbar-action"
1773
+ id="oip-app-topbar-theme-button"
1774
+ severity="secondary"
1775
+ type="button"
1776
+ [rounded]="true"
1777
+ [text]="true"
1778
+ (click)="toggleDarkMode()">
1779
+ <i
1780
+ class="pi"
1781
+ [ngClass]="{
1782
+ 'pi-moon': layoutService.isDarkTheme(),
1783
+ 'pi-sun': !layoutService.isDarkTheme()
1784
+ }"></i>
1785
+ </p-button>
1786
+ <div class="relative">
1787
+ <p-button
1788
+ class="layout-topbar-action layout-topbar-action-highlight"
1789
+ enterActiveClass="animate-scalein"
1790
+ enterFromClass="hidden"
1791
+ id="oip-app-topbar-palette-button"
1792
+ leaveActiveClass="animate-fadeout"
1793
+ leaveToClass="hidden"
1794
+ pStyleClass="@next"
1795
+ [hideOnOutsideClick]="true"
1796
+ [rounded]="true">
1797
+ <i class="pi pi-palette"></i>
1798
+ </p-button>
1799
+ <app-configurator />
1800
+ </div>
1801
+ </div>
1802
+
1803
+ <button
1804
+ class="layout-topbar-menu-button layout-topbar-action"
1805
+ enterActiveClass="animate-scalein"
1806
+ enterFromClass="hidden"
1807
+ id="oip-app-topbar-menu-expand-button"
1808
+ leaveActiveClass="animate-fadeout"
1809
+ leaveToClass="hidden"
1810
+ pStyleClass="@next"
1811
+ [hideOnOutsideClick]="true">
1812
+ <i class="pi pi-ellipsis-v"></i>
1813
+ </button>
1814
+
1815
+ <div class="layout-topbar-menu hidden lg:block">
1816
+ <div class="layout-topbar-menu-content">
1817
+ <button
1818
+ class="layout-topbar-action"
1819
+ id="oip-app-topbar-logout-button"
1820
+ type="button"
1821
+ (click)="securityService.logout()"
1822
+ (keydown)="logoutKeyDown($event)">
1823
+ <i class="pi pi-sign-out"></i>
1824
+ <span>{{ 'topbar.logout' | translate }}</span>
1825
+ </button>
1826
+ <button class="layout-topbar-action" routerLink="config">
1827
+ <p-avatar
1828
+ class="p-link flex align-items-center"
1829
+ id="oip-app-topbar-user-avatar"
1830
+ shape="circle"
1831
+ size="normal"
1832
+ [image]="userService.photoLoaded ? userService.photo : null"
1833
+ >{{ !userService.photoLoaded ? userService.shortLabel : null }}
1834
+ </p-avatar>
1835
+ <span class="ml-2">{{ 'topbar.profile' | translate }}</span>
1836
+ </button>
1837
+ </div>
1838
+ </div>
1839
+ </div>
1834
1840
  </div>`, isInline: true, dependencies: [{ kind: "ngmodule", type: RouterModule }, { kind: "directive", type: i1$3.RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }, { kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i2$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2$1.NgComponentOutlet, selector: "[ngComponentOutlet]", inputs: ["ngComponentOutlet", "ngComponentOutletInputs", "ngComponentOutletInjector", "ngComponentOutletEnvironmentInjector", "ngComponentOutletContent", "ngComponentOutletNgModule", "ngComponentOutletNgModuleFactory"], exportAs: ["ngComponentOutlet"] }, { kind: "ngmodule", type: StyleClassModule }, { kind: "directive", type: i3$1.StyleClass, selector: "[pStyleClass]", inputs: ["pStyleClass", "enterFromClass", "enterActiveClass", "enterToClass", "leaveFromClass", "leaveActiveClass", "leaveToClass", "hideOnOutsideClick", "toggleClass", "hideOnEscape", "hideOnResize", "resizeSelector"] }, { kind: "component", type: AppConfiguratorComponent, selector: "app-configurator" }, { kind: "component", type: Tabs, selector: "p-tabs", inputs: ["value", "scrollable", "lazy", "selectOnFocus", "showNavigators", "tabindex"], outputs: ["valueChange"] }, { kind: "component", type: TabList, selector: "p-tablist" }, { kind: "component", type: Tab, selector: "p-tab", inputs: ["value", "disabled"], outputs: ["valueChange"] }, { kind: "ngmodule", type: AvatarModule }, { kind: "component", type: i2$2.Avatar, selector: "p-avatar", inputs: ["label", "icon", "image", "size", "shape", "styleClass", "ariaLabel", "ariaLabelledBy"], outputs: ["onImageError"] }, { kind: "ngmodule", type: ButtonModule }, { kind: "component", type: i1$2.Button, selector: "p-button", inputs: ["hostName", "type", "badge", "disabled", "raised", "rounded", "text", "plain", "outlined", "link", "tabindex", "size", "variant", "style", "styleClass", "badgeClass", "badgeSeverity", "ariaLabel", "autofocus", "iconPos", "icon", "label", "loading", "loadingIcon", "severity", "buttonProps", "fluid"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "pipe", type: TranslatePipe, name: "translate" }] }); }
1835
1841
  }
1836
1842
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: AppTopbar, decorators: [{
@@ -1850,101 +1856,101 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImpo
1850
1856
  ButtonModule,
1851
1857
  TranslatePipe
1852
1858
  ],
1853
- template: ` <div class="layout-topbar">
1854
- <div class="layout-topbar-logo-container">
1855
- <button class="layout-menu-button layout-topbar-action" (click)="layoutService.onMenuToggle()">
1856
- <i class="pi pi-bars"></i>
1857
- </button>
1858
- <a class="layout-topbar-logo" id="oip-app-topbar-logo-link" routerLink="">
1859
- <ng-container
1860
- *ngComponentOutlet="logoService.getLogoComponent(); inputs: { width: 36, height: 36 }"></ng-container>
1861
- <span>{{ 'app-info.title' | translate }}</span>
1862
- </a>
1863
- </div>
1864
-
1865
- @if (securityService.isAdmin() && topBarService.topBarItems.length > 0) {
1866
- <p-tabs class="layout-topbar-tabs ml-2" [(value)]="topBarService.activeId">
1867
- <p-tablist>
1868
- @for (tab of topBarService.availableTopBarItems; track tab.id) {
1869
- <p-tab id="oip-app-topbar-tab-{{ tab.id }}" [value]="tab.id">
1870
- <i class="pi {{ tab.icon }}"></i>
1871
- <span class="ml-2">{{ tab.caption }}</span>
1872
- </p-tab>
1873
- }
1874
- </p-tablist>
1875
- </p-tabs>
1876
- }
1877
- <div class="layout-topbar-actions">
1878
- <div class="layout-config-menu">
1879
- <p-button
1880
- class="layout-topbar-action"
1881
- id="oip-app-topbar-theme-button"
1882
- severity="secondary"
1883
- type="button"
1884
- [rounded]="true"
1885
- [text]="true"
1886
- (click)="toggleDarkMode()">
1887
- <i
1888
- class="pi"
1889
- [ngClass]="{
1890
- 'pi-moon': layoutService.isDarkTheme(),
1891
- 'pi-sun': !layoutService.isDarkTheme()
1892
- }"></i>
1893
- </p-button>
1894
- <div class="relative">
1895
- <p-button
1896
- class="layout-topbar-action layout-topbar-action-highlight"
1897
- enterActiveClass="animate-scalein"
1898
- enterFromClass="hidden"
1899
- id="oip-app-topbar-palette-button"
1900
- leaveActiveClass="animate-fadeout"
1901
- leaveToClass="hidden"
1902
- pStyleClass="@next"
1903
- [hideOnOutsideClick]="true"
1904
- [rounded]="true">
1905
- <i class="pi pi-palette"></i>
1906
- </p-button>
1907
- <app-configurator />
1908
- </div>
1909
- </div>
1910
-
1911
- <button
1912
- class="layout-topbar-menu-button layout-topbar-action"
1913
- enterActiveClass="animate-scalein"
1914
- enterFromClass="hidden"
1915
- id="oip-app-topbar-menu-expand-button"
1916
- leaveActiveClass="animate-fadeout"
1917
- leaveToClass="hidden"
1918
- pStyleClass="@next"
1919
- [hideOnOutsideClick]="true">
1920
- <i class="pi pi-ellipsis-v"></i>
1921
- </button>
1922
-
1923
- <div class="layout-topbar-menu hidden lg:block">
1924
- <div class="layout-topbar-menu-content">
1925
- <button
1926
- class="layout-topbar-action"
1927
- id="oip-app-topbar-logout-button"
1928
- type="button"
1929
- (click)="securityService.logout()"
1930
- (keydown)="logoutKeyDown($event)">
1931
- <i class="pi pi-sign-out"></i>
1932
- <span>{{ 'topbar.logout' | translate }}</span>
1933
- </button>
1934
- <button class="layout-topbar-action" routerLink="config">
1935
- <p-avatar
1936
- class="p-link flex align-items-center"
1937
- id="oip-app-topbar-user-avatar"
1938
- shape="circle"
1939
- size="normal"
1940
- [image]="userService.photoLoaded ? userService.photo : null"
1941
- >{{ !userService.photoLoaded ? userService.shortLabel : null }}
1942
- </p-avatar>
1943
- <span class="ml-2">{{ 'topbar.profile' | translate }}</span>
1944
- </button>
1945
- </div>
1946
- </div>
1947
- </div>
1859
+ template: ` <div class="layout-topbar">
1860
+ <div class="layout-topbar-logo-container">
1861
+ <button class="layout-menu-button layout-topbar-action" (click)="layoutService.onMenuToggle()">
1862
+ <i class="pi pi-bars"></i>
1863
+ </button>
1864
+ <a class="layout-topbar-logo" id="oip-app-topbar-logo-link" routerLink="">
1865
+ <ng-container
1866
+ *ngComponentOutlet="logoService.getLogoComponent(); inputs: { width: 36, height: 36 }"></ng-container>
1867
+ <span>{{ 'app-info.title' | translate }}</span>
1868
+ </a>
1869
+ </div>
1870
+
1871
+ @if (securityService.isAdmin() && topBarService.topBarItems.length > 0) {
1872
+ <p-tabs class="layout-topbar-tabs ml-2" [(value)]="topBarService.activeId">
1873
+ <p-tablist>
1874
+ @for (tab of topBarService.availableTopBarItems; track tab.id) {
1875
+ <p-tab id="oip-app-topbar-tab-{{ tab.id }}" [value]="tab.id">
1876
+ <i class="pi {{ tab.icon }}"></i>
1877
+ <span class="ml-2">{{ tab.caption }}</span>
1878
+ </p-tab>
1879
+ }
1880
+ </p-tablist>
1881
+ </p-tabs>
1882
+ }
1883
+ <div class="layout-topbar-actions">
1884
+ <div class="layout-config-menu">
1885
+ <p-button
1886
+ class="layout-topbar-action"
1887
+ id="oip-app-topbar-theme-button"
1888
+ severity="secondary"
1889
+ type="button"
1890
+ [rounded]="true"
1891
+ [text]="true"
1892
+ (click)="toggleDarkMode()">
1893
+ <i
1894
+ class="pi"
1895
+ [ngClass]="{
1896
+ 'pi-moon': layoutService.isDarkTheme(),
1897
+ 'pi-sun': !layoutService.isDarkTheme()
1898
+ }"></i>
1899
+ </p-button>
1900
+ <div class="relative">
1901
+ <p-button
1902
+ class="layout-topbar-action layout-topbar-action-highlight"
1903
+ enterActiveClass="animate-scalein"
1904
+ enterFromClass="hidden"
1905
+ id="oip-app-topbar-palette-button"
1906
+ leaveActiveClass="animate-fadeout"
1907
+ leaveToClass="hidden"
1908
+ pStyleClass="@next"
1909
+ [hideOnOutsideClick]="true"
1910
+ [rounded]="true">
1911
+ <i class="pi pi-palette"></i>
1912
+ </p-button>
1913
+ <app-configurator />
1914
+ </div>
1915
+ </div>
1916
+
1917
+ <button
1918
+ class="layout-topbar-menu-button layout-topbar-action"
1919
+ enterActiveClass="animate-scalein"
1920
+ enterFromClass="hidden"
1921
+ id="oip-app-topbar-menu-expand-button"
1922
+ leaveActiveClass="animate-fadeout"
1923
+ leaveToClass="hidden"
1924
+ pStyleClass="@next"
1925
+ [hideOnOutsideClick]="true">
1926
+ <i class="pi pi-ellipsis-v"></i>
1927
+ </button>
1928
+
1929
+ <div class="layout-topbar-menu hidden lg:block">
1930
+ <div class="layout-topbar-menu-content">
1931
+ <button
1932
+ class="layout-topbar-action"
1933
+ id="oip-app-topbar-logout-button"
1934
+ type="button"
1935
+ (click)="securityService.logout()"
1936
+ (keydown)="logoutKeyDown($event)">
1937
+ <i class="pi pi-sign-out"></i>
1938
+ <span>{{ 'topbar.logout' | translate }}</span>
1939
+ </button>
1940
+ <button class="layout-topbar-action" routerLink="config">
1941
+ <p-avatar
1942
+ class="p-link flex align-items-center"
1943
+ id="oip-app-topbar-user-avatar"
1944
+ shape="circle"
1945
+ size="normal"
1946
+ [image]="userService.photoLoaded ? userService.photo : null"
1947
+ >{{ !userService.photoLoaded ? userService.shortLabel : null }}
1948
+ </p-avatar>
1949
+ <span class="ml-2">{{ 'topbar.profile' | translate }}</span>
1950
+ </button>
1951
+ </div>
1952
+ </div>
1953
+ </div>
1948
1954
  </div>`
1949
1955
  }]
1950
1956
  }] });