mesauth-angular 1.7.1 → 1.8.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mesauth-angular",
3
- "version": "1.7.1",
3
+ "version": "1.8.1",
4
4
  "description": "Angular helper library to connect to a backend API and SignalR hub to surface the current logged-in user and incoming notifications with dark/light theme support",
5
5
  "keywords": [
6
6
  "angular",
@@ -1,5 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
- import { InjectionToken, NgZone, EnvironmentProviders, OnDestroy, OnInit, EventEmitter, ChangeDetectorRef, AfterViewInit, ElementRef } from '@angular/core';
2
+ import { InjectionToken, NgZone, EnvironmentProviders, OnDestroy, OnInit, EventEmitter, ChangeDetectorRef, AfterViewInit, ElementRef, OnChanges, SimpleChanges } from '@angular/core';
3
3
  import { HttpClient, HttpInterceptorFn, HttpResponse, HttpParams } from '@angular/common/http';
4
4
  import { Observable, OperatorFunction } from 'rxjs';
5
5
  import { Router } from '@angular/router';
@@ -9,6 +9,12 @@ interface MesAuthConfig {
9
9
  apiBaseUrl: string;
10
10
  withCredentials?: boolean;
11
11
  userBaseUrl?: string;
12
+ /**
13
+ * Base URL for hosted UI assets (CSS themes, icons, manifest).
14
+ * Defaults to `{apiBaseUrl}/mesauth-angular/v1` when omitted.
15
+ * Allows updating themes, icons, and labels without republishing the npm package.
16
+ */
17
+ uiAssetsUrl?: string;
12
18
  }
13
19
  /** Injection token for MesAuth configuration */
14
20
  declare const MES_AUTH_CONFIG: InjectionToken<MesAuthConfig>;
@@ -136,6 +142,7 @@ declare class MesAuthService {
136
142
  private ngZone;
137
143
  constructor();
138
144
  init(config: MesAuthConfig, httpClient: HttpClient, router?: Router, ngZone?: NgZone): void;
145
+ private injectThemeStylesheet;
139
146
  getConfig(): MesAuthConfig | null;
140
147
  private fetchCurrentUser;
141
148
  getUnreadCount(): Observable<any>;
@@ -597,7 +604,6 @@ declare class MaArvContainerComponent implements OnInit, OnDestroy {
597
604
  title: string;
598
605
  description?: string;
599
606
  referenceId: string;
600
- templateId?: number;
601
607
  templateIds?: number[];
602
608
  callbackUrl?: string;
603
609
  deadlineHours?: number;
@@ -653,7 +659,7 @@ declare class MaArvContainerComponent implements OnInit, OnDestroy {
653
659
  private captureThumbnail;
654
660
  private getStyleProperties;
655
661
  static ɵfac: i0.ɵɵFactoryDeclaration<MaArvContainerComponent, never>;
656
- static ɵcmp: i0.ɵɵComponentDeclaration<MaArvContainerComponent, "ma-arv-container", never, { "title": { "alias": "title"; "required": false; }; "description": { "alias": "description"; "required": false; }; "referenceId": { "alias": "referenceId"; "required": false; }; "templateId": { "alias": "templateId"; "required": false; }; "templateIds": { "alias": "templateIds"; "required": false; }; "callbackUrl": { "alias": "callbackUrl"; "required": false; }; "deadlineHours": { "alias": "deadlineHours"; "required": false; }; }, { "approvalSubmitted": "approvalSubmitted"; "approvalSubmitting": "approvalSubmitting"; "cancelled": "cancelled"; }, never, ["*"], true, never>;
662
+ static ɵcmp: i0.ɵɵComponentDeclaration<MaArvContainerComponent, "ma-arv-container", never, { "title": { "alias": "title"; "required": false; }; "description": { "alias": "description"; "required": false; }; "referenceId": { "alias": "referenceId"; "required": false; }; "templateIds": { "alias": "templateIds"; "required": false; }; "callbackUrl": { "alias": "callbackUrl"; "required": false; }; "deadlineHours": { "alias": "deadlineHours"; "required": false; }; }, { "approvalSubmitted": "approvalSubmitted"; "approvalSubmitting": "approvalSubmitting"; "cancelled": "cancelled"; }, never, ["*"], true, never>;
657
663
  }
658
664
 
659
665
  interface PermissionHeader {
@@ -676,5 +682,107 @@ declare function xMaResource<T>(request: () => RequestConfig): i0.ResourceRef<{
676
682
  allowedActions: string[];
677
683
  }>;
678
684
 
679
- export { ALL_ACTIONS, ApprovalActionType, ApprovalDocumentStatus, ApprovalStepMode, ApprovalStepStatus, MES_AUTH_CONFIG, MaApprovalPanelComponent, MaApprovalService, MaArvContainerComponent, MaUserComponent, MesAuthModule, MesAuthService, NotificationBadgeComponent, NotificationPanelComponent, NotificationType, ThemeService, ToastContainerComponent, ToastService, UserProfileComponent, extractXMaPerm, mesAuthInterceptor, provideMesAuth, withXMaPerm, xMaResource };
680
- export type { ApprovalDashboardDto, ApprovalDocumentDto, ApprovalDocumentSummaryDto, ApprovalHistoryDto, ApprovalReferenceDto, ApprovalStepDto, ApprovalStepRequest, ApprovalSubmitResult, ApprovalTemplateDto, ApprovalTemplateStepDto, ApprovalTemplateSummaryDto, ApproveRejectRequest, CreateApprovalRequest, CreateApprovalResponseDto, CreateApprovalTemplateRequest, DelegateRequest, FrontEndRoute, IUser, MesAuthConfig, NotificationDto, PagedList, PermissionHeader, RealTimeNotificationDto, RequestConfig, RolePreviewUserDto, StepRoleDto, Theme, Toast, UpdateApprovalTemplateRequest, UserFrontEndRoutesGrouped };
685
+ interface MaUiManifest {
686
+ /** Version of the package that created this manifest. */
687
+ version: string;
688
+ /** Latest published package version — library logs a warning if installed version is older. */
689
+ latestPackageVersion?: string;
690
+ /** Set true to show an upgrade banner inside components. */
691
+ updateRequired?: boolean;
692
+ /** URL override for the theme CSS (defaults to themes/default.css relative to assetsUrl). */
693
+ themeUrl?: string;
694
+ /** URL override for the SVG icon sprite. */
695
+ iconSpriteUrl?: string;
696
+ /** UI string overrides — keys match component label identifiers. */
697
+ labels?: Record<string, string>;
698
+ /** Feature flags read by components at runtime. */
699
+ features?: Record<string, boolean>;
700
+ }
701
+ /**
702
+ * Provides server-driven UI configuration loaded from the hosted manifest.
703
+ * Components read `labels()` and `features()` signals instead of hardcoded strings.
704
+ * Update manifest.json on the server to change labels or toggle features without
705
+ * republishing the npm package.
706
+ */
707
+ declare class MaUiConfigService {
708
+ private _labels;
709
+ private _features;
710
+ private _updateRequired;
711
+ /** Reactive map of UI string overrides from the server manifest. */
712
+ readonly labels: i0.Signal<Record<string, string>>;
713
+ /** Reactive map of feature flags from the server manifest. */
714
+ readonly features: i0.Signal<Record<string, boolean>>;
715
+ /** True when the server signals that a package upgrade is needed. */
716
+ readonly updateRequired: i0.Signal<boolean>;
717
+ /**
718
+ * Returns a label by key, falling back to `defaultValue` when the server
719
+ * manifest has not provided an override.
720
+ */
721
+ label(key: string, defaultValue: string): string;
722
+ /**
723
+ * Returns a feature flag by key, falling back to `defaultValue`.
724
+ */
725
+ feature(key: string, defaultValue?: boolean): boolean;
726
+ /**
727
+ * Called by MesAuthService.init() — fetches the manifest and applies any
728
+ * label/feature overrides. Failures are silently ignored so the library
729
+ * works without a manifest endpoint.
730
+ */
731
+ loadManifest(assetsUrl: string, http: HttpClient): void;
732
+ static ɵfac: i0.ɵɵFactoryDeclaration<MaUiConfigService, never>;
733
+ static ɵprov: i0.ɵɵInjectableDeclaration<MaUiConfigService>;
734
+ }
735
+
736
+ /**
737
+ * MaIconComponent
738
+ * Renders an SVG icon from the server-hosted sprite.
739
+ * The sprite URL is derived from the stylesheet link injected by MesAuthService,
740
+ * so changing the sprite on the server updates icons without a package rebuild.
741
+ *
742
+ * Selector: <ma-icon name="bell" [size]="20" />
743
+ *
744
+ * When the sprite is not available, falls back to inline SVG definitions
745
+ * for the icons used internally by the library (bell, check, close, etc.).
746
+ *
747
+ * This component is intentionally lightweight — it is the single place where
748
+ * icon SVG is defined, replacing the repeated inline <svg> blocks that were
749
+ * scattered across every component template.
750
+ */
751
+ declare class MaIconComponent implements OnChanges {
752
+ name: string;
753
+ size: number;
754
+ stroke: string;
755
+ strokeWidth: number;
756
+ svgContent: SafeHtml;
757
+ private sanitizer;
758
+ ngOnChanges(changes: SimpleChanges): void;
759
+ private buildSvg;
760
+ static ɵfac: i0.ɵɵFactoryDeclaration<MaIconComponent, never>;
761
+ static ɵcmp: i0.ɵɵComponentDeclaration<MaIconComponent, "ma-icon", never, { "name": { "alias": "name"; "required": false; }; "size": { "alias": "size"; "required": false; }; "stroke": { "alias": "stroke"; "required": false; }; "strokeWidth": { "alias": "strokeWidth"; "required": false; }; }, {}, never, never, true, never>;
762
+ }
763
+
764
+ /**
765
+ * MaThemeDirective
766
+ * Apply `maTheme` to any element or component that needs automatic theme-class binding.
767
+ * Adds `theme-light` or `theme-dark` to the host element's class list and keeps it
768
+ * in sync with ThemeService, replacing the duplicated @HostBinding + subscription
769
+ * pattern that was repeated in every component.
770
+ *
771
+ * Usage:
772
+ * <div maTheme> ... </div>
773
+ *
774
+ * Or as a hostDirective in a component:
775
+ * @Component({ hostDirectives: [MaThemeDirective], ... })
776
+ */
777
+ declare class MaThemeDirective implements OnInit, OnDestroy {
778
+ themeClass: string;
779
+ private themeService;
780
+ private destroy$;
781
+ ngOnInit(): void;
782
+ ngOnDestroy(): void;
783
+ static ɵfac: i0.ɵɵFactoryDeclaration<MaThemeDirective, never>;
784
+ static ɵdir: i0.ɵɵDirectiveDeclaration<MaThemeDirective, "[maTheme]", never, {}, {}, never, never, true, never>;
785
+ }
786
+
787
+ export { ALL_ACTIONS, ApprovalActionType, ApprovalDocumentStatus, ApprovalStepMode, ApprovalStepStatus, MES_AUTH_CONFIG, MaApprovalPanelComponent, MaApprovalService, MaArvContainerComponent, MaIconComponent, MaThemeDirective, MaUiConfigService, MaUserComponent, MesAuthModule, MesAuthService, NotificationBadgeComponent, NotificationPanelComponent, NotificationType, ThemeService, ToastContainerComponent, ToastService, UserProfileComponent, extractXMaPerm, mesAuthInterceptor, provideMesAuth, withXMaPerm, xMaResource };
788
+ export type { ApprovalDashboardDto, ApprovalDocumentDto, ApprovalDocumentSummaryDto, ApprovalHistoryDto, ApprovalReferenceDto, ApprovalStepDto, ApprovalStepRequest, ApprovalSubmitResult, ApprovalTemplateDto, ApprovalTemplateStepDto, ApprovalTemplateSummaryDto, ApproveRejectRequest, CreateApprovalRequest, CreateApprovalResponseDto, CreateApprovalTemplateRequest, DelegateRequest, FrontEndRoute, IUser, MaUiManifest, MesAuthConfig, NotificationDto, PagedList, PermissionHeader, RealTimeNotificationDto, RequestConfig, RolePreviewUserDto, StepRoleDto, Theme, Toast, UpdateApprovalTemplateRequest, UserFrontEndRoutesGrouped };