@masterteam/delegations 0.0.12 → 0.1.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.
@@ -1,167 +1,407 @@
1
+ import * as _masterteam_delegations from '@masterteam/delegations';
1
2
  import * as _angular_core from '@angular/core';
2
3
  import { OnInit, TemplateRef } from '@angular/core';
4
+ import { Popover } from 'primeng/popover';
3
5
  import { TableAction, ColumnDef } from '@masterteam/components/table';
4
- import { ModalService } from '@masterteam/components/modal';
5
6
  import { FormControl } from '@angular/forms';
7
+ import { HttpContext, HttpInterceptorFn } from '@angular/common/http';
8
+ import { DynamicFormConfig } from '@masterteam/components';
6
9
  import { ModalRef } from '@masterteam/components/dialog';
7
- import * as _masterteam_components from '@masterteam/components';
8
- import { CrudStateBase, DynamicFormConfig } from '@masterteam/components';
9
- import { HttpContext } from '@angular/common/http';
10
+ import { ModalService } from '@masterteam/components/modal';
10
11
  import * as rxjs from 'rxjs';
11
12
  import { StateContext } from '@ngxs/store';
12
- import * as _masterteam_delegations from '@masterteam/delegations';
13
-
14
- declare class Delegations {
15
- private readonly router;
16
- goBack(): void;
17
- static ɵfac: _angular_core.ɵɵFactoryDeclaration<Delegations, never>;
18
- static ɵcmp: _angular_core.ɵɵComponentDeclaration<Delegations, "mt-delegations", never, {}, {}, never, never, true, never>;
19
- }
20
13
 
21
14
  interface LoadingStateShape<L extends string = string> {
22
15
  loadingActive: L[];
23
16
  errors: Partial<Record<L, string>>;
24
17
  }
25
18
 
19
+ type DelegationStatus = 'PendingApproval' | 'Scheduled' | 'Active' | 'Expired' | 'Rejected' | 'Cancelled';
20
+ type DelegationApprovalStatus = 'NotRequired' | 'Pending' | 'Approved' | 'Rejected';
21
+ type DelegationActivationState = 'ApprovalRequired' | 'NotStarted' | 'OutsideAllowedDay' | 'Started';
22
+ type DelegationAllowedAction = 'View' | 'Edit' | 'Cancel' | 'Approve' | 'Reject' | 'GenerateToken' | 'StartSession' | 'Clone';
26
23
  interface DelegationUser {
27
24
  id: string;
28
- userId: string;
29
25
  displayName: string;
30
- mobile: string;
31
- userName: string;
32
- email: string;
33
- photo: string;
26
+ email?: string;
27
+ photo?: string;
34
28
  }
35
- interface DelegationDateTime {
36
- displayValue: string;
37
- actualValue: string;
29
+ interface DelegationDayRules {
30
+ type: 'FullRange' | 'SpecificDays';
31
+ specificDays: number[];
32
+ specificDayLabels?: string[];
38
33
  }
39
- interface Delegation {
40
- id?: number;
41
- delegateFrom?: DelegationUser;
42
- delegateTo?: DelegationUser;
43
- delegateFromDateTime?: DelegationDateTime;
44
- delegateToDateTime?: DelegationDateTime;
45
- delegationStatus?: boolean;
46
- isActive?: boolean;
47
- description?: string;
48
- delegationDaysType?: 'FullRange' | 'SpecificDays';
49
- specificDays?: number[] | null;
50
- }
51
- interface DelegationFormData {
52
- delegateTo: string;
53
- delegateFromDateTime: string;
54
- delegateToDateTime: string;
55
- delegateFrom: string;
56
- description?: string;
57
- delegationDaysType?: 'FullRange' | 'SpecificDays';
58
- specificDays?: number[];
59
- isActive?: boolean;
34
+ interface DelegationApprovalMeta {
35
+ status: DelegationApprovalStatus;
36
+ approvedBy?: DelegationUser | null;
37
+ approvedAtUtc?: string | null;
38
+ rejectedBy?: DelegationUser | null;
39
+ rejectedAtUtc?: string | null;
40
+ rejectionReason?: string | null;
60
41
  }
61
- declare enum DelegationsActionKey {
62
- GetDelegations = "getDelegations",
63
- AddDelegation = "addDelegation",
64
- UpdateDelegation = "updateDelegation",
65
- DeleteDelegation = "deleteDelegation",
66
- GetDelegationForm = "getDelegationForm"
42
+ interface DelegationCancellationMeta {
43
+ cancelledBy?: DelegationUser | null;
44
+ cancelledAtUtc?: string | null;
45
+ cancellationReason?: string | null;
67
46
  }
68
- interface DelegationsStateModel extends LoadingStateShape<DelegationsActionKey> {
69
- allDelegations: Delegation[];
70
- selectedDelegation: Delegation | null;
47
+ type DelegationTargetType = 'Level' | 'LevelModule' | 'ServiceModule' | 'ProcessStep' | 'Report' | 'SystemAction';
48
+ type DelegationPermissionModuleType = 'Level' | 'LevelModule';
49
+ type DelegationReadPolicy = 'ImplicitReadForSelectedActions' | 'ExplicitReadOnly' | 'NoReadUnlessOwnPermission';
50
+ interface DelegationScopeOperation {
51
+ operationKey: string;
52
+ permissionCommand: string;
53
+ displayName: string;
54
+ isHighRisk?: boolean;
71
55
  }
72
-
73
- declare class GetDelegations {
74
- static readonly type = "[Delegations] Get Delegations";
56
+ interface DelegationScopeTarget {
57
+ targetType: DelegationTargetType;
58
+ targetId?: number;
59
+ displayName: string;
60
+ levelId?: number;
61
+ levelName?: string;
62
+ levelModuleId?: number;
63
+ domainModuleId?: number;
64
+ moduleKey: string;
65
+ moduleName?: string;
66
+ permissionModuleType?: DelegationPermissionModuleType;
67
+ permissionTargetId?: number;
68
+ operations: DelegationScopeOperation[];
69
+ dataFilter?: unknown;
70
+ constraints?: unknown;
75
71
  }
76
- declare class AddDelegation {
77
- delegation: DelegationFormData;
78
- static readonly type = "[Delegations] Add Delegation";
79
- constructor(delegation: DelegationFormData);
72
+ interface DelegationScopeAccessibility {
73
+ appAccessibilityId: number;
74
+ accessibilityGroupId: number;
75
+ moduleKey: string;
76
+ moduleName: string;
77
+ groupName: string;
80
78
  }
81
- declare class UpdateDelegation {
79
+ interface DelegationScopeWarning {
80
+ code: string;
81
+ message: string;
82
+ }
83
+ interface DelegationScope {
84
+ mode: 'Explicit';
85
+ summary: string;
86
+ readPolicy: DelegationReadPolicy;
87
+ accessibilities: DelegationScopeAccessibility[];
88
+ targets: DelegationScopeTarget[];
89
+ warnings: DelegationScopeWarning[];
90
+ }
91
+ interface DelegationScopeOperationOption {
92
+ operationKey: string;
93
+ permissionCommand: string;
94
+ displayName: string;
95
+ isDelegable: boolean;
96
+ isHighRisk?: boolean;
97
+ reason?: string;
98
+ }
99
+ interface DelegationScopeTargetOption {
100
+ targetType: DelegationTargetType;
101
+ targetId?: number;
102
+ displayName: string;
103
+ levelId?: number;
104
+ levelName?: string;
105
+ levelModuleId?: number;
106
+ domainModuleId?: number;
107
+ moduleKey: string;
108
+ moduleName?: string;
109
+ permissionModuleType?: DelegationPermissionModuleType;
110
+ permissionTargetId?: number;
111
+ operations: DelegationScopeOperationOption[];
112
+ }
113
+ interface DelegationScopeAccessibilityOption {
114
+ appAccessibilityId: number;
115
+ moduleKey: string;
116
+ moduleName: string;
117
+ groups: {
118
+ accessibilityGroupId: number;
119
+ name: string;
120
+ }[];
121
+ }
122
+ interface DelegationScopeReadPolicyOption {
123
+ key: DelegationReadPolicy;
124
+ isDefault: boolean;
125
+ }
126
+ interface DelegationScopePreset {
127
+ key: string;
128
+ displayName: string;
129
+ description: string;
130
+ }
131
+ interface DelegationScopeOptions {
132
+ delegator: DelegationUser;
133
+ scopeModes: 'Explicit'[];
134
+ readPolicies: DelegationScopeReadPolicyOption[];
135
+ accessibilities: DelegationScopeAccessibilityOption[];
136
+ targets: DelegationScopeTargetOption[];
137
+ recommendedPresets: DelegationScopePreset[];
138
+ }
139
+ interface DelegationScopeRequestTargetOperation {
140
+ operationKey: string;
141
+ permissionCommand: string;
142
+ }
143
+ interface DelegationScopeRequestTarget {
144
+ targetType: DelegationTargetType;
145
+ targetId?: number;
146
+ levelId?: number;
147
+ levelModuleId?: number;
148
+ domainModuleId?: number;
149
+ moduleKey: string;
150
+ permissionModuleType?: DelegationPermissionModuleType;
151
+ permissionTargetId?: number;
152
+ operations: DelegationScopeRequestTargetOperation[];
153
+ dataFilter?: unknown;
154
+ constraints?: unknown;
155
+ }
156
+ interface DelegationScopeRequest {
157
+ mode: 'Explicit';
158
+ readPolicy: DelegationReadPolicy;
159
+ accessibilityGroupIds: number[];
160
+ targets: DelegationScopeRequestTarget[];
161
+ }
162
+ interface DelegationScopePreviewDeniedItem {
163
+ targetType: DelegationTargetType;
164
+ targetId?: number;
165
+ operationKey: string;
166
+ permissionCommand: string;
167
+ reasonCode: string;
168
+ message: string;
169
+ }
170
+ interface DelegationScopePreview {
171
+ isValid: boolean;
172
+ normalizedScope?: DelegationScope;
173
+ summary?: string | null;
174
+ warnings: DelegationScopeWarning[];
175
+ deniedItems: DelegationScopePreviewDeniedItem[];
176
+ }
177
+ interface Delegation {
82
178
  id: number;
83
- delegation: DelegationFormData;
84
- static readonly type = "[Delegations] Update Delegation";
85
- constructor(id: number, delegation: DelegationFormData);
179
+ delegator: DelegationUser;
180
+ delegatedUser: DelegationUser;
181
+ description?: string;
182
+ startDateUtc: string;
183
+ endDateUtc: string;
184
+ timeZoneId: string;
185
+ dayRules: DelegationDayRules;
186
+ status: DelegationStatus;
187
+ statusReason: string;
188
+ activationState: DelegationActivationState;
189
+ isUsableNow: boolean;
190
+ requiresApproval: boolean;
191
+ approval: DelegationApprovalMeta;
192
+ cancellation: DelegationCancellationMeta;
193
+ createdBy: DelegationUser;
194
+ createdAtUtc: string;
195
+ updatedBy?: DelegationUser | null;
196
+ updatedAtUtc?: string | null;
197
+ allowedActions: DelegationAllowedAction[];
198
+ scope: DelegationScope;
199
+ token: {
200
+ canGenerate: boolean;
201
+ reason?: string;
202
+ };
203
+ rowVersion: string;
204
+ calculatedAtUtc: string;
86
205
  }
87
- declare class DeleteDelegation {
206
+ interface DelegationStatusHistoryEntry {
88
207
  id: number;
89
- static readonly type = "[Delegations] Delete Delegation";
90
- constructor(id: number);
208
+ fromStatus?: DelegationStatus | null;
209
+ toStatus: DelegationStatus;
210
+ fromApprovalStatus?: DelegationApprovalStatus | null;
211
+ toApprovalStatus?: DelegationApprovalStatus | null;
212
+ actor: DelegationUser;
213
+ action: string;
214
+ reason?: string | null;
215
+ createdAtUtc: string;
91
216
  }
92
- declare class GetDelegation {
217
+ interface DelegationDetail extends Delegation {
218
+ statusHistory?: DelegationStatusHistoryEntry[];
219
+ }
220
+ /** Minimal shape returned by login + topbar candidate listing. */
221
+ interface DelegationSummary {
93
222
  id: number;
94
- static readonly type = "[Delegations] Get Delegation";
95
- constructor(id: number);
223
+ delegator: DelegationUser;
224
+ delegatedUser: DelegationUser;
225
+ status: DelegationStatus;
226
+ allowedActions: DelegationAllowedAction[];
227
+ startDateUtc: string;
228
+ endDateUtc: string;
229
+ scopeSummary?: string;
96
230
  }
97
- declare class ClearSelectedDelegation {
98
- static readonly type = "[Delegations] Clear Selected Delegation";
231
+ interface DelegationListQuery {
232
+ page?: number;
233
+ pageSize?: number;
234
+ status?: DelegationStatus[];
235
+ q?: string;
236
+ startFrom?: string;
237
+ startTo?: string;
238
+ endFrom?: string;
239
+ endTo?: string;
240
+ activeOn?: string;
241
+ approvalStatus?: DelegationApprovalStatus;
242
+ moduleId?: number;
243
+ accessibilityGroupId?: number;
244
+ sortBy?: 'createdAt' | 'startDate' | 'endDate' | 'status' | 'delegatorName' | 'delegatedUserName';
245
+ sortDir?: 'asc' | 'desc';
246
+ }
247
+ interface PagedResult<T> {
248
+ items: T[];
249
+ page: number;
250
+ pageSize: number;
251
+ totalCount: number;
252
+ totalPages: number;
253
+ hasNextPage: boolean;
254
+ hasPreviousPage: boolean;
255
+ serverTimeUtc: string;
256
+ }
257
+ interface CreateDelegationRequest {
258
+ delegatedUserId: string;
259
+ description?: string;
260
+ startDateUtc: string;
261
+ endDateUtc: string;
262
+ timeZoneId: string;
263
+ dayRules: DelegationDayRules;
264
+ requiresApproval: boolean;
265
+ scope: DelegationScopeRequest;
266
+ }
267
+ interface UpdateDelegationRequest {
268
+ rowVersion: string;
269
+ description?: string;
270
+ startDateUtc: string;
271
+ endDateUtc: string;
272
+ timeZoneId: string;
273
+ dayRules: DelegationDayRules;
274
+ requiresApproval?: boolean;
275
+ scope: DelegationScopeRequest;
276
+ }
277
+ interface ApproveDelegationRequest {
278
+ rowVersion: string;
279
+ comment?: string;
280
+ }
281
+ interface RejectDelegationRequest {
282
+ rowVersion: string;
283
+ reason: string;
284
+ }
285
+ interface CancelDelegationRequest {
286
+ rowVersion: string;
287
+ reason: string;
288
+ }
289
+ interface DelegationTokenPair {
290
+ accessToken: string;
291
+ accessTokenExpiresAtUtc: string;
292
+ refreshToken: string;
293
+ refreshTokenExpiresAtUtc: string;
294
+ delegation: DelegationSummary;
295
+ }
296
+ declare enum DelegationsActionKey {
297
+ GetMyDelegations = "getMyDelegations",
298
+ GetAssignedDelegations = "getAssignedDelegations",
299
+ GetDelegation = "getDelegation",
300
+ CreateDelegation = "createDelegation",
301
+ UpdateDelegation = "updateDelegation",
302
+ ApproveDelegation = "approveDelegation",
303
+ RejectDelegation = "rejectDelegation",
304
+ CancelDelegation = "cancelDelegation",
305
+ GetScopeOptions = "getScopeOptions",
306
+ PreviewScope = "previewScope"
307
+ }
308
+ interface DelegationsStateModel extends LoadingStateShape<DelegationsActionKey> {
309
+ my: PagedResult<Delegation> | null;
310
+ assigned: PagedResult<Delegation> | null;
311
+ selected: DelegationDetail | null;
312
+ scopeOptions: DelegationScopeOptions | null;
313
+ scopePreview: DelegationScopePreview | null;
99
314
  }
100
315
 
101
- interface Response<T> {
102
- endpoint: string;
103
- status: number;
104
- code: number;
105
- locale: string;
106
- message?: string | null;
107
- errors?: any | null;
108
- data: T;
109
- cacheSession?: string;
316
+ /**
317
+ * Topbar surface for the delegation runtime.
318
+ *
319
+ * State A — no candidates, no active session: renders nothing.
320
+ * State B — candidates exist, no active session: shows a "Switch identity" affordance.
321
+ * State C — active delegation session: shows the delegator name + back/switch.
322
+ *
323
+ * Designed to be projected into a host topbar's `[actions]` slot (alongside the
324
+ * existing user popover) — it does NOT replace the user dropdown.
325
+ */
326
+ declare class TopbarDelegationMenu {
327
+ /** Path to the management page, e.g. `/control-panel/delegations` or `/delegations`. */
328
+ readonly managePath: _angular_core.InputSignal<string>;
329
+ /** Compact mode hides the inline delegator name next to the button. */
330
+ readonly compact: _angular_core.InputSignal<boolean>;
331
+ private readonly facade;
332
+ private readonly modal;
333
+ private readonly transloco;
334
+ protected readonly popover: _angular_core.Signal<Popover>;
335
+ protected readonly active: _angular_core.Signal<_masterteam_delegations.ActiveDelegationSession | null>;
336
+ protected readonly candidates: _angular_core.Signal<DelegationSummary[]>;
337
+ protected readonly hasCandidates: _angular_core.Signal<boolean>;
338
+ protected readonly isStarting: _angular_core.Signal<boolean>;
339
+ protected readonly isEnding: _angular_core.Signal<boolean>;
340
+ protected readonly delegatorName: _angular_core.Signal<string>;
341
+ /** State machine: which UI to render. */
342
+ protected readonly mode: _angular_core.Signal<"active" | "candidates" | "hidden">;
343
+ togglePopover(event: Event): void;
344
+ startCandidate(candidate: DelegationSummary, event: MouseEvent): void;
345
+ switchTo(candidate: DelegationSummary, event: MouseEvent): void;
346
+ endSession(event: MouseEvent): void;
347
+ private openConfirmation;
348
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<TopbarDelegationMenu, never>;
349
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<TopbarDelegationMenu, "mt-topbar-delegation-menu", never, { "managePath": { "alias": "managePath"; "required": false; "isSignal": true; }; "compact": { "alias": "compact"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
110
350
  }
111
351
 
112
- declare class DelegationsState extends CrudStateBase<Delegation, DelegationsStateModel, DelegationsActionKey> {
113
- private http;
114
- static getAllDelegations(state: DelegationsStateModel): Delegation[];
115
- static getSelectedDelegation(state: DelegationsStateModel): Delegation | null;
116
- static getLoadingActive(state: DelegationsStateModel): string[];
117
- static getErrors(state: DelegationsStateModel): Record<string, string | null>;
118
- getDelegations(ctx: StateContext<DelegationsStateModel>): rxjs.Observable<Response<Delegation[]>>;
119
- getDelegation(ctx: StateContext<DelegationsStateModel>, { id }: GetDelegation): rxjs.Observable<Response<Delegation>>;
120
- addDelegation(ctx: StateContext<DelegationsStateModel>, { delegation }: AddDelegation): rxjs.Observable<_masterteam_components.Response<Delegation>>;
121
- updateDelegation(ctx: StateContext<DelegationsStateModel>, { id, delegation }: UpdateDelegation): rxjs.Observable<_masterteam_components.Response<Delegation>>;
122
- deleteDelegation(ctx: StateContext<DelegationsStateModel>, { id }: DeleteDelegation): rxjs.Observable<_masterteam_components.Response<void>>;
123
- clearSelectedDelegation(ctx: StateContext<DelegationsStateModel>): void;
124
- static ɵfac: _angular_core.ɵɵFactoryDeclaration<DelegationsState, never>;
125
- static ɵprov: _angular_core.ɵɵInjectableDeclaration<DelegationsState>;
352
+ interface StatusVisual {
353
+ i18nKey: string;
354
+ styleClass: string;
355
+ }
356
+ declare class DelegationStatusChip {
357
+ readonly status: _angular_core.InputSignal<DelegationStatus>;
358
+ protected readonly visual: _angular_core.Signal<StatusVisual>;
359
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<DelegationStatusChip, never>;
360
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<DelegationStatusChip, "mt-delegation-status-chip", never, { "status": { "alias": "status"; "required": true; "isSignal": true; }; }, {}, never, never, true, never>;
126
361
  }
127
362
 
128
- declare class DelegationsFacade {
129
- private readonly store;
130
- readonly allDelegations: _angular_core.Signal<_masterteam_delegations.Delegation[]>;
131
- readonly selectedDelegation: _angular_core.Signal<_masterteam_delegations.Delegation | null>;
132
- private readonly loadingActive;
133
- private readonly errors;
134
- readonly isLoadingDelegations: _angular_core.Signal<boolean>;
135
- readonly isLoadingDelegation: _angular_core.Signal<boolean>;
136
- readonly isAddingDelegation: _angular_core.Signal<boolean>;
137
- readonly isUpdatingDelegation: _angular_core.Signal<boolean>;
138
- readonly isDeletingDelegation: _angular_core.Signal<boolean>;
139
- readonly delegationsError: _angular_core.Signal<string | null>;
140
- readonly delegationError: _angular_core.Signal<string | null>;
141
- readonly addDelegationError: _angular_core.Signal<string | null>;
142
- readonly updateDelegationError: _angular_core.Signal<string | null>;
143
- readonly deleteDelegationError: _angular_core.Signal<string | null>;
144
- readonly activeDelegations: _angular_core.Signal<_masterteam_delegations.Delegation[]>;
145
- readonly inactiveDelegations: _angular_core.Signal<_masterteam_delegations.Delegation[]>;
146
- getDelegations(): rxjs.Observable<void>;
147
- addDelegation(delegation: DelegationFormData): rxjs.Observable<void>;
148
- updateDelegation(id: number, delegation: DelegationFormData): rxjs.Observable<void>;
149
- deleteDelegation(id: number): rxjs.Observable<void>;
150
- loadDelegation(id: number): rxjs.Observable<void>;
151
- clearSelectedDelegation(): rxjs.Observable<void>;
152
- static ɵfac: _angular_core.ɵɵFactoryDeclaration<DelegationsFacade, never>;
153
- static ɵprov: _angular_core.ɵɵInjectableDeclaration<DelegationsFacade>;
363
+ /**
364
+ * Confirmation dialog opened by the topbar menu before starting (or switching to)
365
+ * a delegated session. Calls the facade and closes itself on success.
366
+ */
367
+ declare class StartSessionDialog {
368
+ readonly candidate: _angular_core.InputSignal<DelegationSummary>;
369
+ readonly intent: _angular_core.InputSignal<"start" | "switch">;
370
+ private readonly ref;
371
+ private readonly facade;
372
+ protected readonly isBusy: _angular_core.Signal<boolean>;
373
+ protected readonly title: _angular_core.Signal<"delegations.switch-session-confirm-title" | "delegations.start-session-confirm-title">;
374
+ protected readonly body: _angular_core.Signal<"delegations.switch-session-confirm-body" | "delegations.start-session-confirm-body">;
375
+ confirm(): void;
376
+ cancel(): void;
377
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<StartSessionDialog, never>;
378
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<StartSessionDialog, "mt-start-session-dialog", never, { "candidate": { "alias": "candidate"; "required": true; "isSignal": true; }; "intent": { "alias": "intent"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
379
+ }
380
+
381
+ declare class Delegations {
382
+ private readonly router;
383
+ goBack(): void;
384
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<Delegations, never>;
385
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<Delegations, "mt-delegations", never, {}, {}, never, never, true, never>;
154
386
  }
155
387
 
388
+ type DelegationTab = 'my' | 'assigned';
389
+ /**
390
+ * DelegationsPage — replaces the legacy single-list CRUD view with the target
391
+ * two-list portal contract: "My Delegations" (I am delegator) and "Delegated To Me".
392
+ *
393
+ * - Rows render the BE-returned `allowedActions` only (never inferred).
394
+ * - Lifecycle actions (Approve/Reject/Cancel/Edit/StartSession) dispatch through
395
+ * the facade and the row is replaced in place from the response.
396
+ * - Scope/detail drawer and full scope-picker form are still incremental work;
397
+ * the form drawer here covers Edit/Create with the core fields.
398
+ */
156
399
  declare class DelegationsList implements OnInit {
157
- statusCol: _angular_core.Signal<TemplateRef<any>>;
158
- userCol: _angular_core.Signal<TemplateRef<any>>;
159
- userCol2: _angular_core.Signal<TemplateRef<any>>;
160
- daysCol: _angular_core.Signal<TemplateRef<any>>;
161
400
  private readonly facade;
162
- readonly modal: ModalService;
163
- private readonly translocoService;
164
- breadcrumbItems: _angular_core.WritableSignal<({
401
+ private readonly session;
402
+ private readonly modal;
403
+ private readonly transloco;
404
+ protected readonly breadcrumbItems: _angular_core.WritableSignal<({
165
405
  label: string;
166
406
  icon: string;
167
407
  routerLink: string;
@@ -174,55 +414,434 @@ declare class DelegationsList implements OnInit {
174
414
  icon?: undefined;
175
415
  routerLink?: undefined;
176
416
  })[]>;
177
- delegations: _angular_core.Signal<Delegation[]>;
178
- tabs: _angular_core.WritableSignal<{
417
+ protected readonly activeTab: _angular_core.WritableSignal<DelegationTab>;
418
+ protected readonly tabs: _angular_core.WritableSignal<{
419
+ value: DelegationTab;
179
420
  label: string;
180
- value: string;
181
421
  }[]>;
182
- activeTab: _angular_core.WritableSignal<string>;
183
- tableActions: _angular_core.WritableSignal<TableAction[]>;
184
- deletingRowIds: _angular_core.WritableSignal<any[]>;
185
- rowActions: _angular_core.WritableSignal<TableAction[]>;
186
- tableColumns: _angular_core.WritableSignal<ColumnDef[]>;
187
- loading: _angular_core.Signal<boolean>;
188
- private allDelegations;
189
- private activeDelegations;
190
- private inactiveDelegations;
422
+ protected readonly isLoading: _angular_core.Signal<boolean>;
423
+ protected readonly rows: _angular_core.Signal<Delegation[]>;
424
+ statusCol: _angular_core.Signal<TemplateRef<unknown>>;
425
+ userCol: _angular_core.Signal<TemplateRef<unknown>>;
426
+ scopeCol: _angular_core.Signal<TemplateRef<unknown>>;
427
+ daysCol: _angular_core.Signal<TemplateRef<unknown>>;
428
+ protected readonly tableActions: _angular_core.WritableSignal<TableAction[]>;
429
+ protected readonly rowActions: _angular_core.WritableSignal<TableAction[]>;
430
+ protected readonly tableColumns: _angular_core.WritableSignal<ColumnDef[]>;
431
+ private readonly busyIds;
191
432
  private readonly weekdayKeys;
192
433
  ngOnInit(): void;
193
- formatDelegationDays(row: Delegation): string;
194
- addDelegationDialog(delegation?: any | null): void;
434
+ protected switchTab(tab: DelegationTab): void;
435
+ private loadCurrentTab;
436
+ protected has(row: Delegation, action: DelegationAllowedAction): boolean;
437
+ protected formatDays(row: Delegation): string;
438
+ private viewDetails;
439
+ private openForm;
440
+ private approve;
441
+ private reject;
442
+ private cancel;
443
+ private startSession;
444
+ private mark;
195
445
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<DelegationsList, never>;
196
446
  static ɵcmp: _angular_core.ɵɵComponentDeclaration<DelegationsList, "mt-delegations-list", never, {}, {}, never, never, true, never>;
197
447
  }
198
448
 
449
+ /**
450
+ * Delegation create/edit form, target-shape compliant.
451
+ *
452
+ * - Delegator is server-derived from the authenticated principal — not collected
453
+ * here (admin "create on behalf of" lives behind a separate flag).
454
+ * - `isActive` no longer exists; status is server-calculated.
455
+ * - Scope is collected by `<mt-scope-picker>` (loaded from `/scope/options`)
456
+ * and validated via `/scope/preview` on every change. Edit mode rehydrates
457
+ * the scope from the loaded delegation.
458
+ */
199
459
  declare class DelegationForm implements OnInit {
200
- private readonly halfWidthFieldClass;
201
- private readonly fullWidthFieldClass;
460
+ readonly delegationForEdit: _angular_core.InputSignal<Delegation | null>;
461
+ readonly readonly: _angular_core.InputSignal<boolean>;
462
+ private readonly halfWidth;
463
+ private readonly fullWidth;
202
464
  modal: ModalService;
203
465
  ref: ModalRef;
204
- delegationForEdit: _angular_core.InputSignal<Delegation | null>;
205
- private readonly translocoService;
466
+ private readonly transloco;
206
467
  private readonly facade;
207
- selectedDelegation: _angular_core.Signal<Delegation | null>;
208
468
  delegationFormControl: FormControl<any>;
209
469
  formValue: _angular_core.Signal<any>;
210
- getDelegationFormLoading: _angular_core.Signal<boolean>;
211
- isAddingDelegation: _angular_core.Signal<boolean>;
212
- isUpdatingDelegation: _angular_core.Signal<boolean>;
470
+ selected: _angular_core.Signal<_masterteam_delegations.DelegationDetail | null>;
471
+ isDetailLoading: _angular_core.Signal<boolean>;
472
+ isSaving: _angular_core.Signal<boolean>;
213
473
  context: HttpContext;
214
- isDelegatingToSelf: _angular_core.Signal<boolean>;
215
- specificDaysOptions: _angular_core.WritableSignal<{
474
+ protected readonly isDelegatingToSelf: _angular_core.Signal<boolean>;
475
+ protected readonly scope: _angular_core.WritableSignal<DelegationScopeRequest>;
476
+ protected readonly specificDaysOptions: _angular_core.WritableSignal<{
216
477
  label: string;
217
478
  value: number;
218
479
  }[]>;
219
- delegationFormConfig: _angular_core.Signal<DynamicFormConfig>;
480
+ protected readonly delegationFormConfig: _angular_core.Signal<DynamicFormConfig>;
220
481
  constructor();
221
482
  ngOnInit(): void;
222
483
  onSubmit(): void;
223
484
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<DelegationForm, never>;
224
- static ɵcmp: _angular_core.ɵɵComponentDeclaration<DelegationForm, "mt-delegation-form", never, { "delegationForEdit": { "alias": "delegationForEdit"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
485
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<DelegationForm, "mt-delegation-form", never, { "delegationForEdit": { "alias": "delegationForEdit"; "required": false; "isSignal": true; }; "readonly": { "alias": "readonly"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
486
+ }
487
+
488
+ type DetailTab = 'overview' | 'scope' | 'history';
489
+ /**
490
+ * Read-only drawer that shows the full server DTO of a delegation, including
491
+ * its status history. Triggered from the row's "View details" action.
492
+ */
493
+ declare class DelegationDetailDrawer implements OnInit {
494
+ /** Delegation id passed in via the modal's inputValues. */
495
+ readonly delegationId: _angular_core.InputSignal<number>;
496
+ private readonly facade;
497
+ private readonly transloco;
498
+ protected readonly ref: ModalRef;
499
+ protected readonly tabs: {
500
+ key: DetailTab;
501
+ i18n: string;
502
+ }[];
503
+ protected readonly activeTab: _angular_core.WritableSignal<DetailTab>;
504
+ protected readonly isLoading: _angular_core.Signal<boolean>;
505
+ protected readonly detail: _angular_core.Signal<DelegationDetail | null>;
506
+ protected readonly statusHistory: _angular_core.Signal<DelegationStatusHistoryEntry[]>;
507
+ ngOnInit(): void;
508
+ protected setTab(tab: DetailTab): void;
509
+ protected approvalLabel(): string;
510
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<DelegationDetailDrawer, never>;
511
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<DelegationDetailDrawer, "mt-delegation-detail-drawer", never, { "delegationId": { "alias": "delegationId"; "required": true; "isSignal": true; }; }, {}, never, never, true, never>;
512
+ }
513
+
514
+ interface AccessibilityGroupOption {
515
+ appAccessibilityId: number;
516
+ accessibilityGroupId: number;
517
+ moduleName: string;
518
+ groupName: string;
519
+ }
520
+ /**
521
+ * Scope picker driven entirely by Identity-provided options.
522
+ *
523
+ * - `[(scope)]` two-way binds a normalized `DelegationScopeRequest`.
524
+ * - Loads options via `DelegationsFacade.loadScopeOptions()` on init.
525
+ * - Calls `/scope/preview` (debounced) so the user sees the server-built summary
526
+ * and denied items before they save.
527
+ * - Non-delegable operations render disabled with the BE-supplied `reason`.
528
+ */
529
+ declare class ScopePicker implements OnInit {
530
+ /** Two-way bound — the form drives initial value and reads updates back. */
531
+ readonly scope: _angular_core.ModelSignal<DelegationScopeRequest>;
532
+ readonly readonly: _angular_core.InputSignal<boolean>;
533
+ /** Admin scope-as-another-user — passed through to the options endpoint. */
534
+ readonly delegatorUserId: _angular_core.InputSignal<string | undefined>;
535
+ private readonly facade;
536
+ private readonly transloco;
537
+ protected readonly options: _angular_core.Signal<_masterteam_delegations.DelegationScopeOptions | null>;
538
+ protected readonly preview: _angular_core.Signal<_masterteam_delegations.DelegationScopePreview | null>;
539
+ protected readonly isLoadingOptions: _angular_core.Signal<boolean>;
540
+ protected readonly isPreviewing: _angular_core.Signal<boolean>;
541
+ /** Set of accordion target keys currently expanded. */
542
+ private readonly expanded;
543
+ protected readonly readPolicies: _angular_core.Signal<_masterteam_delegations.DelegationScopeReadPolicyOption[]>;
544
+ /** Flat list of accessibility group options (across modules). */
545
+ protected readonly accessibilityGroups: _angular_core.Signal<AccessibilityGroupOption[]>;
546
+ /** Targets grouped by `targetType` for the accordion UI. */
547
+ protected readonly groupedTargets: _angular_core.Signal<{
548
+ type: string;
549
+ items: DelegationScopeTargetOption[];
550
+ }[]>;
551
+ /** O(1) lookup: is this accessibility group selected? */
552
+ protected readonly selectedAccessibilityIds: _angular_core.Signal<Set<number>>;
553
+ /** O(1) lookup: which targets are picked, and which ops per target? */
554
+ protected readonly selectedTargetMap: _angular_core.Signal<Map<string, Set<string>>>;
555
+ ngOnInit(): void;
556
+ constructor();
557
+ protected setReadPolicy(policy: DelegationReadPolicy): void;
558
+ protected toggleAccessibility(group: AccessibilityGroupOption): void;
559
+ protected isAccessibilitySelected(group: AccessibilityGroupOption): boolean;
560
+ protected toggleAccordion(target: DelegationScopeTargetOption): void;
561
+ protected isExpanded(target: DelegationScopeTargetOption): boolean;
562
+ protected toggleOperation(target: DelegationScopeTargetOption, op: DelegationScopeOperationOption): void;
563
+ protected isOperationSelected(target: DelegationScopeTargetOption, op: DelegationScopeOperationOption): boolean;
564
+ protected selectedOpsCount(target: DelegationScopeTargetOption): number;
565
+ protected reasonLabel(op: DelegationScopeOperationOption): string;
566
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<ScopePicker, never>;
567
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<ScopePicker, "mt-scope-picker", never, { "scope": { "alias": "scope"; "required": false; "isSignal": true; }; "readonly": { "alias": "readonly"; "required": false; "isSignal": true; }; "delegatorUserId": { "alias": "delegatorUserId"; "required": false; "isSignal": true; }; }, { "scope": "scopeChange"; }, never, never, true, never>;
568
+ }
569
+
570
+ /**
571
+ * Adds `app-delegation: Bearer <token>` to outgoing requests when a delegation
572
+ * session is active. Token-management endpoints are excluded.
573
+ *
574
+ * Register AFTER the gateway-auth interceptor (so `Authorization` is set first)
575
+ * and BEFORE the message interceptor (so 403s still flow through toast handling).
576
+ */
577
+ declare const appDelegationInterceptor: HttpInterceptorFn;
578
+
579
+ declare class GetMyDelegations {
580
+ query: DelegationListQuery;
581
+ static readonly type = "[Delegations] Get My Delegations";
582
+ constructor(query?: DelegationListQuery);
583
+ }
584
+ declare class GetAssignedDelegations {
585
+ query: DelegationListQuery;
586
+ static readonly type = "[Delegations] Get Assigned Delegations";
587
+ constructor(query?: DelegationListQuery);
588
+ }
589
+ declare class GetDelegation {
590
+ id: number;
591
+ includeStatusHistory: boolean;
592
+ static readonly type = "[Delegations] Get Delegation";
593
+ constructor(id: number, includeStatusHistory?: boolean);
594
+ }
595
+ declare class ClearSelectedDelegation {
596
+ static readonly type = "[Delegations] Clear Selected Delegation";
597
+ }
598
+ declare class CreateDelegation {
599
+ request: CreateDelegationRequest;
600
+ static readonly type = "[Delegations] Create Delegation";
601
+ constructor(request: CreateDelegationRequest);
602
+ }
603
+ declare class UpdateDelegation {
604
+ id: number;
605
+ request: UpdateDelegationRequest;
606
+ static readonly type = "[Delegations] Update Delegation";
607
+ constructor(id: number, request: UpdateDelegationRequest);
608
+ }
609
+ declare class ApproveDelegation {
610
+ id: number;
611
+ request: ApproveDelegationRequest;
612
+ static readonly type = "[Delegations] Approve Delegation";
613
+ constructor(id: number, request: ApproveDelegationRequest);
614
+ }
615
+ declare class RejectDelegation {
616
+ id: number;
617
+ request: RejectDelegationRequest;
618
+ static readonly type = "[Delegations] Reject Delegation";
619
+ constructor(id: number, request: RejectDelegationRequest);
620
+ }
621
+ declare class CancelDelegation {
622
+ id: number;
623
+ request: CancelDelegationRequest;
624
+ static readonly type = "[Delegations] Cancel Delegation";
625
+ constructor(id: number, request: CancelDelegationRequest);
626
+ }
627
+ declare class GetScopeOptions {
628
+ delegatorUserId?: string | undefined;
629
+ static readonly type = "[Delegations] Get Scope Options";
630
+ /** Admin-only override; ignored for normal users. */
631
+ constructor(delegatorUserId?: string | undefined);
632
+ }
633
+ declare class PreviewScope {
634
+ scope: DelegationScopeRequest;
635
+ static readonly type = "[Delegations] Preview Scope";
636
+ constructor(scope: DelegationScopeRequest);
637
+ }
638
+ declare class ClearScopePreview {
639
+ static readonly type = "[Delegations] Clear Scope Preview";
640
+ }
641
+
642
+ interface Response<T> {
643
+ endpoint: string;
644
+ status: number;
645
+ code: number;
646
+ locale: string;
647
+ message?: string | null;
648
+ errors?: any | null;
649
+ data: T;
650
+ cacheSession?: string;
651
+ }
652
+
653
+ declare class DelegationsState {
654
+ private http;
655
+ static getMyPage(state: DelegationsStateModel): PagedResult<Delegation> | null;
656
+ static getAssignedPage(state: DelegationsStateModel): PagedResult<Delegation> | null;
657
+ static getSelected(state: DelegationsStateModel): DelegationDetail | null;
658
+ static getScopeOptions(state: DelegationsStateModel): DelegationScopeOptions | null;
659
+ static getScopePreview(state: DelegationsStateModel): DelegationScopePreview | null;
660
+ static getLoadingActive(state: DelegationsStateModel): string[];
661
+ static getErrors(state: DelegationsStateModel): Record<string, string | null | undefined>;
662
+ getMyDelegations(ctx: StateContext<DelegationsStateModel>, { query }: GetMyDelegations): rxjs.Observable<Response<PagedResult<Delegation>>>;
663
+ getAssignedDelegations(ctx: StateContext<DelegationsStateModel>, { query }: GetAssignedDelegations): rxjs.Observable<Response<PagedResult<Delegation>>>;
664
+ getDelegation(ctx: StateContext<DelegationsStateModel>, { id, includeStatusHistory }: GetDelegation): rxjs.Observable<Response<DelegationDetail>>;
665
+ clearSelectedDelegation(ctx: StateContext<DelegationsStateModel>): void;
666
+ createDelegation(ctx: StateContext<DelegationsStateModel>, { request }: CreateDelegation): rxjs.Observable<Response<Delegation>>;
667
+ updateDelegation(ctx: StateContext<DelegationsStateModel>, { id, request }: UpdateDelegation): rxjs.Observable<Response<Delegation>>;
668
+ approveDelegation(ctx: StateContext<DelegationsStateModel>, { id, request }: ApproveDelegation): rxjs.Observable<Response<Delegation>>;
669
+ rejectDelegation(ctx: StateContext<DelegationsStateModel>, { id, request }: RejectDelegation): rxjs.Observable<Response<Delegation>>;
670
+ cancelDelegation(ctx: StateContext<DelegationsStateModel>, { id, request }: CancelDelegation): rxjs.Observable<Response<Delegation>>;
671
+ getScopeOptions(ctx: StateContext<DelegationsStateModel>, { delegatorUserId }: GetScopeOptions): rxjs.Observable<Response<DelegationScopeOptions>>;
672
+ previewScope(ctx: StateContext<DelegationsStateModel>, { scope }: PreviewScope): rxjs.Observable<Response<DelegationScopePreview>>;
673
+ clearScopePreview(ctx: StateContext<DelegationsStateModel>): void;
674
+ private applyLifecycleResult;
675
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<DelegationsState, never>;
676
+ static ɵprov: _angular_core.ɵɵInjectableDeclaration<DelegationsState>;
677
+ }
678
+
679
+ declare class DelegationsFacade {
680
+ private readonly store;
681
+ readonly myPage: _angular_core.Signal<_masterteam_delegations.PagedResult<_masterteam_delegations.Delegation> | null>;
682
+ readonly assignedPage: _angular_core.Signal<_masterteam_delegations.PagedResult<_masterteam_delegations.Delegation> | null>;
683
+ readonly selected: _angular_core.Signal<_masterteam_delegations.DelegationDetail | null>;
684
+ readonly scopeOptions: _angular_core.Signal<_masterteam_delegations.DelegationScopeOptions | null>;
685
+ readonly scopePreview: _angular_core.Signal<_masterteam_delegations.DelegationScopePreview | null>;
686
+ private readonly loadingActive;
687
+ private readonly errors;
688
+ readonly myItems: _angular_core.Signal<_masterteam_delegations.Delegation[]>;
689
+ readonly assignedItems: _angular_core.Signal<_masterteam_delegations.Delegation[]>;
690
+ readonly isLoadingMy: _angular_core.Signal<boolean>;
691
+ readonly isLoadingAssigned: _angular_core.Signal<boolean>;
692
+ readonly isLoadingDetail: _angular_core.Signal<boolean>;
693
+ readonly isCreating: _angular_core.Signal<boolean>;
694
+ readonly isUpdating: _angular_core.Signal<boolean>;
695
+ readonly isApproving: _angular_core.Signal<boolean>;
696
+ readonly isRejecting: _angular_core.Signal<boolean>;
697
+ readonly isCancelling: _angular_core.Signal<boolean>;
698
+ readonly isLoadingScopeOptions: _angular_core.Signal<boolean>;
699
+ readonly isPreviewingScope: _angular_core.Signal<boolean>;
700
+ readonly errorMy: _angular_core.Signal<string | null>;
701
+ readonly errorAssigned: _angular_core.Signal<string | null>;
702
+ readonly errorDetail: _angular_core.Signal<string | null>;
703
+ readonly errorCreate: _angular_core.Signal<string | null>;
704
+ readonly errorUpdate: _angular_core.Signal<string | null>;
705
+ readonly errorApprove: _angular_core.Signal<string | null>;
706
+ readonly errorReject: _angular_core.Signal<string | null>;
707
+ readonly errorCancel: _angular_core.Signal<string | null>;
708
+ getMy(query?: DelegationListQuery): rxjs.Observable<void>;
709
+ getAssigned(query?: DelegationListQuery): rxjs.Observable<void>;
710
+ getOne(id: number, includeStatusHistory?: boolean): rxjs.Observable<void>;
711
+ clearSelected(): rxjs.Observable<void>;
712
+ create(request: CreateDelegationRequest): rxjs.Observable<void>;
713
+ update(id: number, request: UpdateDelegationRequest): rxjs.Observable<void>;
714
+ approve(id: number, request: ApproveDelegationRequest): rxjs.Observable<void>;
715
+ reject(id: number, request: RejectDelegationRequest): rxjs.Observable<void>;
716
+ cancel(id: number, request: CancelDelegationRequest): rxjs.Observable<void>;
717
+ loadScopeOptions(delegatorUserId?: string): rxjs.Observable<void>;
718
+ previewScope(scope: DelegationScopeRequest): rxjs.Observable<void>;
719
+ clearScopePreview(): rxjs.Observable<void>;
720
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<DelegationsFacade, never>;
721
+ static ɵprov: _angular_core.ɵɵInjectableDeclaration<DelegationsFacade>;
722
+ }
723
+
724
+ declare const DELEGATION_SESSION_STORAGE_KEY = "mt.delegation.session.v1";
725
+ interface ActiveDelegationSession {
726
+ accessToken: string;
727
+ accessTokenExpiresAtUtc: string;
728
+ refreshToken: string;
729
+ refreshTokenExpiresAtUtc: string;
730
+ delegation: DelegationSummary;
731
+ }
732
+ declare function toActiveSession(pair: DelegationTokenPair): ActiveDelegationSession;
733
+ declare enum DelegationSessionActionKey {
734
+ Bootstrap = "bootstrap",
735
+ StartSession = "startSession",
736
+ EndSession = "endSession",
737
+ RefreshSession = "refreshSession",
738
+ GetSession = "getSession"
739
+ }
740
+ interface DelegationSessionStateModel extends LoadingStateShape<DelegationSessionActionKey> {
741
+ active: ActiveDelegationSession | null;
742
+ candidates: DelegationSummary[];
743
+ }
744
+
745
+ /** Reads sessionStorage + login candidates, restores any tab-local active session. */
746
+ declare class BootstrapDelegationSession {
747
+ static readonly type = "[DelegationSession] Bootstrap";
748
+ }
749
+ /** Replaces the candidate pool (called after LoginSuccess or when user.delegations changes). */
750
+ declare class SetDelegationCandidates {
751
+ candidates: DelegationSummary[];
752
+ static readonly type = "[DelegationSession] Set Candidates";
753
+ constructor(candidates: DelegationSummary[]);
754
+ }
755
+ /** Start a delegated session for the given assignment. */
756
+ declare class StartDelegationSession {
757
+ delegationId: number;
758
+ static readonly type = "[DelegationSession] Start";
759
+ constructor(delegationId: number);
760
+ }
761
+ /** End the current delegated session (server + local). */
762
+ declare class EndDelegationSession {
763
+ options: {
764
+ silent?: boolean;
765
+ };
766
+ static readonly type = "[DelegationSession] End";
767
+ constructor(options?: {
768
+ silent?: boolean;
769
+ });
770
+ }
771
+ /** Atomically end current + start another. */
772
+ declare class SwitchDelegationSession {
773
+ delegationId: number;
774
+ static readonly type = "[DelegationSession] Switch";
775
+ constructor(delegationId: number);
776
+ }
777
+ /** Refresh the delegation access token via refresh-token rotation. */
778
+ declare class RefreshDelegationSession {
779
+ static readonly type = "[DelegationSession] Refresh";
780
+ }
781
+ /** Verify the current session against the server (used after bootstrap). */
782
+ declare class VerifyDelegationSession {
783
+ static readonly type = "[DelegationSession] Verify";
784
+ }
785
+ /** Surface a recoverable session error from any pipeline (e.g. 403 codes). */
786
+ declare class DelegationSessionInvalidated {
787
+ reason: 'TokenPrincipalMismatch' | 'NotActive' | 'ScopeDenied' | 'Expired' | 'Unknown';
788
+ static readonly type = "[DelegationSession] Invalidated";
789
+ constructor(reason: 'TokenPrincipalMismatch' | 'NotActive' | 'ScopeDenied' | 'Expired' | 'Unknown');
790
+ }
791
+
792
+ /**
793
+ * Filters a delegation list to "candidates the user could activate".
794
+ * Active + StartSession in allowedActions is the runtime gate.
795
+ */
796
+ declare function pickCandidates(delegations: DelegationSummary[] | undefined | null): DelegationSummary[];
797
+ declare class DelegationSessionState {
798
+ private http;
799
+ private actions$;
800
+ private store;
801
+ constructor();
802
+ static getActive(state: DelegationSessionStateModel): ActiveDelegationSession | null;
803
+ static getCandidates(state: DelegationSessionStateModel): DelegationSummary[];
804
+ static isDelegated(state: DelegationSessionStateModel): boolean;
805
+ static getLoadingActive(state: DelegationSessionStateModel): string[];
806
+ static getErrors(state: DelegationSessionStateModel): Record<string, string | null | undefined>;
807
+ bootstrap(ctx: StateContext<DelegationSessionStateModel>): void;
808
+ setCandidates(ctx: StateContext<DelegationSessionStateModel>, { candidates }: SetDelegationCandidates): void;
809
+ verify(ctx: StateContext<DelegationSessionStateModel>): rxjs.Observable<Response<DelegationSummary | null>>;
810
+ start(ctx: StateContext<DelegationSessionStateModel>, { delegationId }: StartDelegationSession): rxjs.Observable<Response<DelegationTokenPair>>;
811
+ end(ctx: StateContext<DelegationSessionStateModel>, { options }: EndDelegationSession): rxjs.Observable<Response<void>>;
812
+ switch(ctx: StateContext<DelegationSessionStateModel>, { delegationId }: SwitchDelegationSession): rxjs.Observable<void>;
813
+ refresh(ctx: StateContext<DelegationSessionStateModel>): rxjs.Observable<Response<DelegationTokenPair>>;
814
+ invalidated(ctx: StateContext<DelegationSessionStateModel>): rxjs.Observable<never>;
815
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<DelegationSessionState, never>;
816
+ static ɵprov: _angular_core.ɵɵInjectableDeclaration<DelegationSessionState>;
817
+ }
818
+
819
+ declare class DelegationSessionFacade {
820
+ private readonly store;
821
+ readonly active: _angular_core.Signal<_masterteam_delegations.ActiveDelegationSession | null>;
822
+ readonly candidates: _angular_core.Signal<DelegationSummary[]>;
823
+ readonly isDelegated: _angular_core.Signal<boolean>;
824
+ private readonly loadingActive;
825
+ readonly delegator: _angular_core.Signal<_masterteam_delegations.DelegationUser | null>;
826
+ readonly accessToken: _angular_core.Signal<string | null>;
827
+ readonly accessTokenExpiresAtUtc: _angular_core.Signal<string | null>;
828
+ readonly hasCandidates: _angular_core.Signal<boolean>;
829
+ readonly isStartingSession: _angular_core.Signal<boolean>;
830
+ readonly isEndingSession: _angular_core.Signal<boolean>;
831
+ readonly isRefreshingSession: _angular_core.Signal<boolean>;
832
+ bootstrap(): rxjs.Observable<void>;
833
+ setCandidates(candidates: DelegationSummary[]): rxjs.Observable<void>;
834
+ startSession(delegationId: number): rxjs.Observable<void>;
835
+ endSession(opts?: {
836
+ silent?: boolean;
837
+ }): rxjs.Observable<void>;
838
+ switchSession(delegationId: number): rxjs.Observable<void>;
839
+ refreshSession(): rxjs.Observable<void>;
840
+ verifySession(): rxjs.Observable<void>;
841
+ invalidate(reason?: 'TokenPrincipalMismatch' | 'NotActive' | 'ScopeDenied' | 'Expired' | 'Unknown'): rxjs.Observable<void>;
842
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<DelegationSessionFacade, never>;
843
+ static ɵprov: _angular_core.ɵɵInjectableDeclaration<DelegationSessionFacade>;
225
844
  }
226
845
 
227
- export { AddDelegation, ClearSelectedDelegation, DelegationForm, Delegations, DelegationsActionKey, DelegationsFacade, DelegationsList, DelegationsState, DeleteDelegation, GetDelegation, GetDelegations, UpdateDelegation };
228
- export type { Delegation, DelegationDateTime, DelegationFormData, DelegationUser, DelegationsStateModel };
846
+ export { ApproveDelegation, BootstrapDelegationSession, CancelDelegation, ClearScopePreview, ClearSelectedDelegation, CreateDelegation, DELEGATION_SESSION_STORAGE_KEY, DelegationDetailDrawer, DelegationForm, DelegationSessionActionKey, DelegationSessionFacade, DelegationSessionInvalidated, DelegationSessionState, DelegationStatusChip, Delegations, DelegationsActionKey, DelegationsFacade, DelegationsList, DelegationsState, EndDelegationSession, GetAssignedDelegations, GetDelegation, GetMyDelegations, GetScopeOptions, PreviewScope, RefreshDelegationSession, RejectDelegation, ScopePicker, SetDelegationCandidates, StartDelegationSession, StartSessionDialog, SwitchDelegationSession, TopbarDelegationMenu, UpdateDelegation, VerifyDelegationSession, appDelegationInterceptor, pickCandidates, toActiveSession };
847
+ export type { ActiveDelegationSession, ApproveDelegationRequest, CancelDelegationRequest, CreateDelegationRequest, Delegation, DelegationActivationState, DelegationAllowedAction, DelegationApprovalMeta, DelegationApprovalStatus, DelegationCancellationMeta, DelegationDayRules, DelegationDetail, DelegationListQuery, DelegationPermissionModuleType, DelegationReadPolicy, DelegationScope, DelegationScopeAccessibility, DelegationScopeAccessibilityOption, DelegationScopeOperation, DelegationScopeOperationOption, DelegationScopeOptions, DelegationScopePreset, DelegationScopePreview, DelegationScopePreviewDeniedItem, DelegationScopeReadPolicyOption, DelegationScopeRequest, DelegationScopeRequestTarget, DelegationScopeRequestTargetOperation, DelegationScopeTarget, DelegationScopeTargetOption, DelegationScopeWarning, DelegationSessionStateModel, DelegationStatus, DelegationStatusHistoryEntry, DelegationSummary, DelegationTargetType, DelegationTokenPair, DelegationUser, DelegationsStateModel, PagedResult, RejectDelegationRequest, UpdateDelegationRequest };