@masterteam/delegations 0.0.37 → 0.0.39

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": "@masterteam/delegations",
3
- "version": "0.0.37",
3
+ "version": "0.0.39",
4
4
  "publishConfig": {
5
5
  "directory": "../../../dist/masterteam/delegations",
6
6
  "linkDirectory": false,
@@ -21,8 +21,8 @@
21
21
  "tailwindcss-primeui": "^0.6.1",
22
22
  "@ngxs/store": "^20.1.0",
23
23
  "@masterteam/components": "^0.0.179",
24
- "@masterteam/forms": "^0.0.81",
25
- "@masterteam/icons": "^0.0.15"
24
+ "@masterteam/icons": "^0.0.15",
25
+ "@masterteam/forms": "^0.0.81"
26
26
  },
27
27
  "sideEffects": false,
28
28
  "exports": {
@@ -1,6 +1,6 @@
1
1
  import * as _masterteam_delegations from '@masterteam/delegations';
2
2
  import * as _angular_core from '@angular/core';
3
- import { OnInit } from '@angular/core';
3
+ import { OnInit, InjectionToken } from '@angular/core';
4
4
  import { Popover } from 'primeng/popover';
5
5
  import * as _masterteam_components_entities from '@masterteam/components/entities';
6
6
  import { EntityUserValue } from '@masterteam/components/entities';
@@ -390,10 +390,9 @@ declare class TopbarDelegationMenu implements OnInit {
390
390
  readonly showManageLink: _angular_core.InputSignal<boolean>;
391
391
  readonly promptOnCandidates: _angular_core.InputSignal<boolean>;
392
392
  /**
393
- * Suppress the *candidates* trigger (surface them elsewhere, e.g. the user
394
- * dropdown via {@link DelegationMenuPanel}) while keeping candidate loading +
395
- * the post-login prompt. The *active* "Acting on behalf of" pill stays visible
396
- * even when headless — an active delegated session must always be obvious.
393
+ * Render no topbar UI at all (controller only) while keeping candidate
394
+ * loading + the post-login prompt. Use when the menu is surfaced elsewhere —
395
+ * e.g. embedded in the user-avatar dropdown via {@link DelegationMenuPanel}.
397
396
  */
398
397
  readonly headless: _angular_core.InputSignal<boolean>;
399
398
  private readonly facade;
@@ -405,8 +404,9 @@ declare class TopbarDelegationMenu implements OnInit {
405
404
  protected readonly hasCandidates: _angular_core.Signal<boolean>;
406
405
  protected readonly onBehalfOf: _angular_core.Signal<_masterteam_delegations.DelegationParty | null>;
407
406
  protected readonly executedBy: _angular_core.Signal<_masterteam_delegations.DelegationParty | null>;
408
- private readonly promptShown;
409
- protected readonly mode: _angular_core.Signal<"hidden" | "candidates" | "active">;
407
+ /** Per-instance guard; the persisted `facade.prompted()` guards across refresh. */
408
+ private localPrompted;
409
+ protected readonly mode: _angular_core.Signal<"active" | "candidates" | "hidden">;
410
410
  constructor();
411
411
  ngOnInit(): void;
412
412
  /** Two-letter initials for a delegator avatar (matches the user-menu pattern). */
@@ -442,7 +442,7 @@ declare class DelegationMenuPanel {
442
442
  protected readonly hasCandidates: _angular_core.Signal<boolean>;
443
443
  protected readonly onBehalfOf: _angular_core.Signal<_masterteam_delegations.DelegationParty | null>;
444
444
  protected readonly executedBy: _angular_core.Signal<_masterteam_delegations.DelegationParty | null>;
445
- protected readonly mode: _angular_core.Signal<"hidden" | "candidates" | "active">;
445
+ protected readonly mode: _angular_core.Signal<"active" | "candidates" | "hidden">;
446
446
  /** Two-letter initials for a delegator avatar (matches the user-menu pattern). */
447
447
  protected initials(party: DelegationRow['delegator'] | null | undefined): string;
448
448
  protected start(row: DelegationRow, event: MouseEvent): void;
@@ -675,6 +675,8 @@ declare class DelegationForm implements OnInit {
675
675
  value: number;
676
676
  }[]>;
677
677
  protected readonly formConfig: _angular_core.Signal<DynamicFormConfig>;
678
+ private editPrefilled;
679
+ private createInitialized;
678
680
  constructor();
679
681
  ngOnInit(): void;
680
682
  protected readonly canSubmit: _angular_core.Signal<boolean>;
@@ -764,9 +766,22 @@ declare class ScopePicker {
764
766
  /** Stable operation-node keys for the current scope grants. */
765
767
  protected readonly selectedKeys: _angular_core.Signal<Set<string>>;
766
768
  protected readonly selectedCount: _angular_core.Signal<number>;
769
+ /** Every selectable operation key (for the "select all" master toggle). */
770
+ protected readonly allLeafKeys: _angular_core.Signal<string[]>;
771
+ protected readonly selectAllState: _angular_core.Signal<NodeCheckState>;
767
772
  protected readonly searchTerm: _angular_core.WritableSignal<string>;
768
773
  protected readonly expandedKeys: _angular_core.WritableSignal<Set<string>>;
769
774
  protected readonly filteredTree: _angular_core.Signal<DelegationScopeTreeNode[]>;
775
+ /**
776
+ * Flattened list of currently-visible rows (respecting expand state + search)
777
+ * for CDK virtual scrolling — only the on-screen rows render, so large
778
+ * permission catalogs stay fast. Recomputes on tree/expand/search changes,
779
+ * NOT on selection toggles.
780
+ */
781
+ protected readonly visibleNodes: _angular_core.Signal<{
782
+ node: DelegationScopeTreeNode;
783
+ depth: number;
784
+ }[]>;
770
785
  protected readonly appAccessibilities: _angular_core.Signal<DelegationAppAccessibility[]>;
771
786
  protected readonly selectedAccessibilityKeys: _angular_core.WritableSignal<Set<string>>;
772
787
  protected readonly selectedAccessibilityCount: _angular_core.Signal<number>;
@@ -782,6 +797,11 @@ declare class ScopePicker {
782
797
  protected toggle(node: DelegationScopeTreeNode): void;
783
798
  private applySelection;
784
799
  protected clearSelection(): void;
800
+ /** Master "select all" toggle in the tree header. */
801
+ protected toggleAll(): void;
802
+ protected trackVisible(_index: number, item: {
803
+ node: DelegationScopeTreeNode;
804
+ }): string;
785
805
  protected toggleAccessibility(key: string): void;
786
806
  protected isAccessibilitySelected(key: string): boolean;
787
807
  private accessibilityFacts;
@@ -1028,6 +1048,12 @@ declare enum DelegationSessionActionKey {
1028
1048
  interface DelegationSessionStateModel extends LoadingStateShape<DelegationSessionActionKey> {
1029
1049
  active: ActiveDelegationSession | null;
1030
1050
  candidates: DelegationRow[];
1051
+ /**
1052
+ * Whether the post-login "delegations available" prompt has already been
1053
+ * shown for the current login. Reset on login so the prompt appears once,
1054
+ * then never again on plain refreshes (persisted with the slice).
1055
+ */
1056
+ prompted: boolean;
1031
1057
  }
1032
1058
 
1033
1059
  /** Fetch the active delegations the current user may start (user/activedelegations). */
@@ -1052,6 +1078,12 @@ declare class SwitchDelegationSession {
1052
1078
  static readonly type = "[DelegationSession] Switch";
1053
1079
  constructor(delegation: DelegationRow);
1054
1080
  }
1081
+ /** Set whether the post-login candidates prompt has been shown for this login. */
1082
+ declare class MarkDelegationPrompted {
1083
+ prompted: boolean;
1084
+ static readonly type = "[DelegationSession] Mark Prompted";
1085
+ constructor(prompted?: boolean);
1086
+ }
1055
1087
 
1056
1088
  declare class DelegationSessionState {
1057
1089
  private http;
@@ -1060,22 +1092,35 @@ declare class DelegationSessionState {
1060
1092
  constructor();
1061
1093
  static getActive(state: DelegationSessionStateModel): ActiveDelegationSession | null;
1062
1094
  static getCandidates(state: DelegationSessionStateModel): DelegationRow[];
1095
+ static getPrompted(state: DelegationSessionStateModel): boolean;
1063
1096
  static isDelegated(state: DelegationSessionStateModel): boolean;
1064
1097
  static getLoadingActive(state: DelegationSessionStateModel): string[];
1065
1098
  static getErrors(state: DelegationSessionStateModel): Record<string, string | null | undefined>;
1066
1099
  loadCandidates(ctx: StateContext<DelegationSessionStateModel>): rxjs.Observable<Response<DelegationPage<DelegationRow>>>;
1067
1100
  start(ctx: StateContext<DelegationSessionStateModel>, { delegation }: StartDelegationSession): rxjs.Observable<Response<string>>;
1068
1101
  end(ctx: StateContext<DelegationSessionStateModel>, { reason }: EndDelegationSession): rxjs.Observable<never>;
1102
+ markPrompted(ctx: StateContext<DelegationSessionStateModel>, { prompted }: MarkDelegationPrompted): rxjs.Observable<never>;
1069
1103
  switch(ctx: StateContext<DelegationSessionStateModel>, { delegation }: SwitchDelegationSession): rxjs.Observable<void>;
1070
1104
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<DelegationSessionState, never>;
1071
1105
  static ɵprov: _angular_core.ɵɵInjectableDeclaration<DelegationSessionState>;
1072
1106
  }
1073
1107
 
1108
+ /**
1109
+ * When true (default), the app reloads after a delegated session starts /
1110
+ * switches / ends so every subsequent request is re-fetched under the new
1111
+ * delegation context (the SPA otherwise keeps the previous actor's loaded data).
1112
+ * Consumers that drive their own refresh can provide `false` to opt out.
1113
+ */
1114
+ declare const DELEGATION_RELOAD_ON_SESSION_CHANGE: InjectionToken<boolean>;
1074
1115
  declare class DelegationSessionFacade {
1075
1116
  private readonly store;
1117
+ private readonly document;
1118
+ private readonly reloadOnSessionChange;
1076
1119
  readonly active: _angular_core.Signal<_masterteam_delegations.ActiveDelegationSession | null>;
1077
1120
  readonly candidates: _angular_core.Signal<DelegationRow[]>;
1078
1121
  readonly isDelegated: _angular_core.Signal<boolean>;
1122
+ /** Whether the post-login candidates prompt was already shown this login. */
1123
+ readonly prompted: _angular_core.Signal<boolean>;
1079
1124
  private readonly loadingActive;
1080
1125
  /** Raw delegation token for the `app-delegation` header. */
1081
1126
  readonly token: _angular_core.Signal<string | null>;
@@ -1087,12 +1132,19 @@ declare class DelegationSessionFacade {
1087
1132
  readonly isStarting: _angular_core.Signal<boolean>;
1088
1133
  readonly isLoadingCandidates: _angular_core.Signal<boolean>;
1089
1134
  loadCandidates(): rxjs.Observable<void>;
1135
+ markPrompted(prompted?: boolean): rxjs.Observable<void>;
1090
1136
  startSession(delegation: DelegationRow): rxjs.Observable<void>;
1091
1137
  switchSession(delegation: DelegationRow): rxjs.Observable<void>;
1092
1138
  endSession(reason?: DelegationSessionInvalidationReason): rxjs.Observable<void>;
1139
+ /**
1140
+ * Reload so all data refetches under the new delegation context. The session
1141
+ * slice is persisted, so the (new/cleared) session restores after reload.
1142
+ * Deferred a tick to let NGXS storage flush first.
1143
+ */
1144
+ private reloadAfterSessionChange;
1093
1145
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<DelegationSessionFacade, never>;
1094
1146
  static ɵprov: _angular_core.ɵɵInjectableDeclaration<DelegationSessionFacade>;
1095
1147
  }
1096
1148
 
1097
- export { ApproveDelegation, CancelDelegation, ClearDelegationDetail, ClearScopePreview, CreateDelegationLegacy, CreateDelegationV2, DelegationDetailDrawer, DelegationForm, DelegationMenuPanel, DelegationSessionActionKey, DelegationSessionFacade, DelegationSessionState, DelegationStatusChip, Delegations, DelegationsActionKey, DelegationsFacade, DelegationsList, DelegationsState, EndDelegationSession, GetActiveAssignedDelegations, GetAdminDelegations, GetApprovalDelegations, GetAssignedDelegations, GetDelegationDetail, GetMyDelegations, GetScopeOptions, LoadDelegationCandidates, PreviewScope, RejectDelegation, RejectDelegationDialog, ScopePicker, StartDelegationSession, StartSessionDialog, SwitchDelegationSession, TopbarDelegationMenu, UpdateDelegationLegacy, UpdateDelegationV2, appDelegationInterceptor };
1149
+ export { ApproveDelegation, CancelDelegation, ClearDelegationDetail, ClearScopePreview, CreateDelegationLegacy, CreateDelegationV2, DELEGATION_RELOAD_ON_SESSION_CHANGE, DelegationDetailDrawer, DelegationForm, DelegationMenuPanel, DelegationSessionActionKey, DelegationSessionFacade, DelegationSessionState, DelegationStatusChip, Delegations, DelegationsActionKey, DelegationsFacade, DelegationsList, DelegationsState, EndDelegationSession, GetActiveAssignedDelegations, GetAdminDelegations, GetApprovalDelegations, GetAssignedDelegations, GetDelegationDetail, GetMyDelegations, GetScopeOptions, LoadDelegationCandidates, MarkDelegationPrompted, PreviewScope, RejectDelegation, RejectDelegationDialog, ScopePicker, StartDelegationSession, StartSessionDialog, SwitchDelegationSession, TopbarDelegationMenu, UpdateDelegationLegacy, UpdateDelegationV2, appDelegationInterceptor };
1098
1150
  export type { ActiveDelegationSession, AdminCreateDelegationV2Request, AdminUpdateDelegationV2Request, ApproveDelegationRequest, CreateDelegationLegacyRequest, CreateDelegationV2Request, DelegationAllowedAction, DelegationAppAccessibility, DelegationApprovalInfo, DelegationApprovalStatus, DelegationCancellationInfo, DelegationDayRuleMode, DelegationDetail, DelegationDisplayValue, DelegationDto, DelegationEffectiveStatus, DelegationGrant, DelegationListQuery, DelegationPage, DelegationParty, DelegationRow, DelegationScopeAction, DelegationScopeCombinationRule, DelegationScopeDeniedItem, DelegationScopeFact, DelegationScopeHierarchyGroup, DelegationScopeHierarchyTarget, DelegationScopeLevelNode, DelegationScopeModuleNode, DelegationScopeOptions, DelegationScopePermissionGroup, DelegationScopePreview, DelegationScopePreviewRequest, DelegationScopeSelection, DelegationScopeTarget, DelegationScopeWarning, DelegationSessionInvalidationReason, DelegationSessionStateModel, DelegationSortDirection, DelegationStatusInfo, DelegationsStateModel, RejectDelegationRequest, UpdateDelegationLegacyRequest, UpdateDelegationV2Request };