@masterteam/delegations 0.0.38 → 0.0.40

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.38",
3
+ "version": "0.0.40",
4
4
  "publishConfig": {
5
5
  "directory": "../../../dist/masterteam/delegations",
6
6
  "linkDirectory": false,
@@ -20,9 +20,9 @@
20
20
  "tailwindcss": "^4.2.2",
21
21
  "tailwindcss-primeui": "^0.6.1",
22
22
  "@ngxs/store": "^20.1.0",
23
- "@masterteam/forms": "^0.0.81",
23
+ "@masterteam/components": "^0.0.179",
24
24
  "@masterteam/icons": "^0.0.15",
25
- "@masterteam/components": "^0.0.179"
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,7 +404,8 @@ 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;
407
+ /** Per-instance guard; the persisted `facade.prompted()` guards across refresh. */
408
+ private localPrompted;
409
409
  protected readonly mode: _angular_core.Signal<"active" | "candidates" | "hidden">;
410
410
  constructor();
411
411
  ngOnInit(): void;
@@ -802,6 +802,13 @@ declare class ScopePicker {
802
802
  protected trackVisible(_index: number, item: {
803
803
  node: DelegationScopeTreeNode;
804
804
  }): string;
805
+ /**
806
+ * Template keys (open by default) plus the ancestor keys of every selected
807
+ * operation, so an edit's saved selection is expanded into view. Only valid
808
+ * grants (those matching an option node) contribute — invalid saved grants
809
+ * have no node and are simply ignored.
810
+ */
811
+ private collectExpansion;
805
812
  protected toggleAccessibility(key: string): void;
806
813
  protected isAccessibilitySelected(key: string): boolean;
807
814
  private accessibilityFacts;
@@ -1048,6 +1055,12 @@ declare enum DelegationSessionActionKey {
1048
1055
  interface DelegationSessionStateModel extends LoadingStateShape<DelegationSessionActionKey> {
1049
1056
  active: ActiveDelegationSession | null;
1050
1057
  candidates: DelegationRow[];
1058
+ /**
1059
+ * Whether the post-login "delegations available" prompt has already been
1060
+ * shown for the current login. Reset on login so the prompt appears once,
1061
+ * then never again on plain refreshes (persisted with the slice).
1062
+ */
1063
+ prompted: boolean;
1051
1064
  }
1052
1065
 
1053
1066
  /** Fetch the active delegations the current user may start (user/activedelegations). */
@@ -1072,6 +1085,12 @@ declare class SwitchDelegationSession {
1072
1085
  static readonly type = "[DelegationSession] Switch";
1073
1086
  constructor(delegation: DelegationRow);
1074
1087
  }
1088
+ /** Set whether the post-login candidates prompt has been shown for this login. */
1089
+ declare class MarkDelegationPrompted {
1090
+ prompted: boolean;
1091
+ static readonly type = "[DelegationSession] Mark Prompted";
1092
+ constructor(prompted?: boolean);
1093
+ }
1075
1094
 
1076
1095
  declare class DelegationSessionState {
1077
1096
  private http;
@@ -1080,22 +1099,35 @@ declare class DelegationSessionState {
1080
1099
  constructor();
1081
1100
  static getActive(state: DelegationSessionStateModel): ActiveDelegationSession | null;
1082
1101
  static getCandidates(state: DelegationSessionStateModel): DelegationRow[];
1102
+ static getPrompted(state: DelegationSessionStateModel): boolean;
1083
1103
  static isDelegated(state: DelegationSessionStateModel): boolean;
1084
1104
  static getLoadingActive(state: DelegationSessionStateModel): string[];
1085
1105
  static getErrors(state: DelegationSessionStateModel): Record<string, string | null | undefined>;
1086
1106
  loadCandidates(ctx: StateContext<DelegationSessionStateModel>): rxjs.Observable<Response<DelegationPage<DelegationRow>>>;
1087
1107
  start(ctx: StateContext<DelegationSessionStateModel>, { delegation }: StartDelegationSession): rxjs.Observable<Response<string>>;
1088
1108
  end(ctx: StateContext<DelegationSessionStateModel>, { reason }: EndDelegationSession): rxjs.Observable<never>;
1109
+ markPrompted(ctx: StateContext<DelegationSessionStateModel>, { prompted }: MarkDelegationPrompted): rxjs.Observable<never>;
1089
1110
  switch(ctx: StateContext<DelegationSessionStateModel>, { delegation }: SwitchDelegationSession): rxjs.Observable<void>;
1090
1111
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<DelegationSessionState, never>;
1091
1112
  static ɵprov: _angular_core.ɵɵInjectableDeclaration<DelegationSessionState>;
1092
1113
  }
1093
1114
 
1115
+ /**
1116
+ * When true (default), the app reloads after a delegated session starts /
1117
+ * switches / ends so every subsequent request is re-fetched under the new
1118
+ * delegation context (the SPA otherwise keeps the previous actor's loaded data).
1119
+ * Consumers that drive their own refresh can provide `false` to opt out.
1120
+ */
1121
+ declare const DELEGATION_RELOAD_ON_SESSION_CHANGE: InjectionToken<boolean>;
1094
1122
  declare class DelegationSessionFacade {
1095
1123
  private readonly store;
1124
+ private readonly document;
1125
+ private readonly reloadOnSessionChange;
1096
1126
  readonly active: _angular_core.Signal<_masterteam_delegations.ActiveDelegationSession | null>;
1097
1127
  readonly candidates: _angular_core.Signal<DelegationRow[]>;
1098
1128
  readonly isDelegated: _angular_core.Signal<boolean>;
1129
+ /** Whether the post-login candidates prompt was already shown this login. */
1130
+ readonly prompted: _angular_core.Signal<boolean>;
1099
1131
  private readonly loadingActive;
1100
1132
  /** Raw delegation token for the `app-delegation` header. */
1101
1133
  readonly token: _angular_core.Signal<string | null>;
@@ -1107,12 +1139,19 @@ declare class DelegationSessionFacade {
1107
1139
  readonly isStarting: _angular_core.Signal<boolean>;
1108
1140
  readonly isLoadingCandidates: _angular_core.Signal<boolean>;
1109
1141
  loadCandidates(): rxjs.Observable<void>;
1142
+ markPrompted(prompted?: boolean): rxjs.Observable<void>;
1110
1143
  startSession(delegation: DelegationRow): rxjs.Observable<void>;
1111
1144
  switchSession(delegation: DelegationRow): rxjs.Observable<void>;
1112
1145
  endSession(reason?: DelegationSessionInvalidationReason): rxjs.Observable<void>;
1146
+ /**
1147
+ * Reload so all data refetches under the new delegation context. The session
1148
+ * slice is persisted, so the (new/cleared) session restores after reload.
1149
+ * Deferred a tick to let NGXS storage flush first.
1150
+ */
1151
+ private reloadAfterSessionChange;
1113
1152
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<DelegationSessionFacade, never>;
1114
1153
  static ɵprov: _angular_core.ɵɵInjectableDeclaration<DelegationSessionFacade>;
1115
1154
  }
1116
1155
 
1117
- 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 };
1156
+ 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 };
1118
1157
  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 };