@masterteam/delegations 0.1.0 → 0.2.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.
@@ -16,335 +16,233 @@ interface LoadingStateShape<L extends string = string> {
16
16
  errors: Partial<Record<L, string>>;
17
17
  }
18
18
 
19
- type DelegationStatus = 'PendingApproval' | 'Scheduled' | 'Active' | 'Expired' | 'Rejected' | 'Cancelled';
19
+ type DelegationEffectiveStatus = 'PendingApproval' | 'Scheduled' | 'Active' | 'InactiveToday' | 'Expired' | 'Rejected' | 'Cancelled';
20
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';
23
- interface DelegationUser {
24
- id: string;
21
+ type DelegationAllowedAction = 'View' | 'Edit' | 'Approve' | 'Reject' | 'Cancel' | 'StartSession' | 'EndSession';
22
+ type DelegationDayRuleMode = 'FullRange' | 'SpecificDays';
23
+ interface DelegationParty {
24
+ userId: string;
25
25
  displayName: string;
26
- email?: string;
27
- photo?: string;
26
+ email?: string | null;
28
27
  }
29
- interface DelegationDayRules {
30
- type: 'FullRange' | 'SpecificDays';
31
- specificDays: number[];
32
- specificDayLabels?: string[];
33
- }
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;
41
- }
42
- interface DelegationCancellationMeta {
43
- cancelledBy?: DelegationUser | null;
28
+ interface DelegationApprovalInfo {
29
+ requiresApproval: boolean;
30
+ approvalStatus: DelegationApprovalStatus;
31
+ }
32
+ interface DelegationCancellationInfo {
33
+ cancelledBy?: DelegationParty | null;
44
34
  cancelledAtUtc?: string | null;
45
35
  cancellationReason?: string | null;
46
36
  }
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;
55
- }
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;
71
- }
72
- interface DelegationScopeAccessibility {
73
- appAccessibilityId: number;
74
- accessibilityGroupId: number;
75
- moduleKey: string;
76
- moduleName: string;
77
- groupName: string;
78
- }
79
- interface DelegationScopeWarning {
80
- code: string;
81
- message: string;
37
+ interface DelegationRow {
38
+ delegationId: number;
39
+ delegator: DelegationParty;
40
+ delegatedUser: DelegationParty;
41
+ startsAtUtc: string;
42
+ endsAtUtc: string;
43
+ timeZoneId: string;
44
+ dayRuleMode: DelegationDayRuleMode;
45
+ specificDays: number[];
46
+ effectiveStatus: DelegationEffectiveStatus;
47
+ statusReasonCode: string;
48
+ createdBy: DelegationParty;
49
+ createdAtUtc: string;
50
+ approval: DelegationApprovalInfo;
51
+ cancellation: DelegationCancellationInfo;
52
+ allowedActions: DelegationAllowedAction[];
53
+ scopeSummary: string;
54
+ rowVersion: string;
82
55
  }
83
- interface DelegationScope {
84
- mode: 'Explicit';
85
- summary: string;
86
- readPolicy: DelegationReadPolicy;
87
- accessibilities: DelegationScopeAccessibility[];
88
- targets: DelegationScopeTarget[];
89
- warnings: DelegationScopeWarning[];
56
+ interface DelegationPage<T> {
57
+ items: T[];
58
+ page: number;
59
+ pageSize: number;
60
+ totalCount: number;
90
61
  }
91
- interface DelegationScopeOperationOption {
62
+ interface DelegationScopeTarget {
63
+ applicationKey: string;
64
+ targetType: string;
65
+ targetKey: string;
66
+ legacyModuleId?: number | null;
67
+ targetId?: number | null;
68
+ levelId?: number | null;
69
+ levelModuleId?: number | null;
70
+ domainModuleId?: number | null;
71
+ moduleKey?: string | null;
72
+ permissionModuleType?: string | null;
73
+ permissionTargetId?: number | null;
74
+ displayName?: string | null;
75
+ }
76
+ interface DelegationScopeAction {
77
+ applicationKey: string;
92
78
  operationKey: string;
93
- permissionCommand: string;
94
- displayName: string;
95
- isDelegable: boolean;
79
+ operationKind: string;
80
+ permissionCommand?: string | null;
81
+ businessActionCode?: string | null;
96
82
  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[];
83
+ isDelegableSnapshot?: boolean;
84
+ }
85
+ interface DelegationGrant {
86
+ applicationKey: string;
87
+ target: DelegationScopeTarget;
88
+ action: DelegationScopeAction;
89
+ accessibilities: unknown[];
90
+ dataFilters: unknown[];
91
+ constraints: unknown[];
92
+ }
93
+ interface DelegationScopeSelection {
94
+ grants: DelegationGrant[];
95
+ metadata: Record<string, unknown>;
96
+ }
97
+ /** `scope/options` returns the grantable set in the same grants shape. */
98
+ type DelegationScopeOptions = DelegationScopeSelection;
99
+ interface DelegationScopeWarning {
100
+ code?: string;
101
+ message: string;
138
102
  }
139
- interface DelegationScopeRequestTargetOperation {
103
+ interface DelegationScopeDeniedItem {
104
+ applicationKey: string;
105
+ targetType: string;
106
+ targetKey: string;
140
107
  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;
108
+ permissionCommand?: string;
167
109
  reasonCode: string;
168
- message: string;
169
110
  }
170
111
  interface DelegationScopePreview {
171
112
  isValid: boolean;
172
- normalizedScope?: DelegationScope;
173
- summary?: string | null;
113
+ normalizedScope: DelegationScopeSelection;
114
+ scopeHash: string;
115
+ summary: string;
174
116
  warnings: DelegationScopeWarning[];
175
- deniedItems: DelegationScopePreviewDeniedItem[];
117
+ deniedItems: DelegationScopeDeniedItem[];
176
118
  }
177
- interface Delegation {
178
- id: number;
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;
119
+ interface DelegationStatusInfo {
120
+ effectiveStatus: DelegationEffectiveStatus;
121
+ reasonCode: string;
204
122
  calculatedAtUtc: string;
205
123
  }
206
- interface DelegationStatusHistoryEntry {
207
- 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;
216
- }
217
- interface DelegationDetail extends Delegation {
218
- statusHistory?: DelegationStatusHistoryEntry[];
124
+ interface DelegationDetail {
125
+ row: DelegationRow;
126
+ scope: DelegationScopeSelection;
127
+ status: DelegationStatusInfo;
219
128
  }
220
- /** Minimal shape returned by login + topbar candidate listing. */
221
- interface DelegationSummary {
129
+ interface DelegationDto {
222
130
  id: number;
223
- delegator: DelegationUser;
224
- delegatedUser: DelegationUser;
225
- status: DelegationStatus;
131
+ fromUserId: string;
132
+ toUserId: string;
133
+ description?: string;
134
+ isActive?: boolean;
135
+ delegationDaysType: DelegationDayRuleMode;
136
+ specificDays: number[];
137
+ applicationId?: number;
138
+ requiresApproval?: boolean;
139
+ effectiveStatus: DelegationEffectiveStatus;
140
+ statusReasonCode: string;
226
141
  allowedActions: DelegationAllowedAction[];
227
- startDateUtc: string;
228
- endDateUtc: string;
229
- scopeSummary?: string;
142
+ rowVersion: string;
143
+ [extra: string]: unknown;
230
144
  }
145
+ type DelegationSortDirection = 'asc' | 'ascending' | 'desc' | 'descending';
231
146
  interface DelegationListQuery {
147
+ activeOnly?: boolean;
148
+ status?: DelegationEffectiveStatus;
149
+ search?: string;
150
+ fromUtc?: string;
151
+ toUtc?: string;
152
+ sortBy?: string;
153
+ sortDirection?: DelegationSortDirection;
232
154
  page?: number;
233
155
  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;
156
+ delegatorUserId?: string;
157
+ delegatedUserId?: string;
256
158
  }
257
- interface CreateDelegationRequest {
258
- delegatedUserId: string;
159
+ interface CreateDelegationLegacyRequest {
160
+ delegateFrom?: string | null;
161
+ delegateTo: string;
259
162
  description?: string;
260
- startDateUtc: string;
261
- endDateUtc: string;
262
- timeZoneId: string;
263
- dayRules: DelegationDayRules;
264
- requiresApproval: boolean;
265
- scope: DelegationScopeRequest;
163
+ delegateFromDateTime: string;
164
+ delegateToDateTime: string;
165
+ accessibilityIds?: number[];
166
+ moduleIds?: number[];
167
+ delegationDaysType: DelegationDayRuleMode;
168
+ specificDays?: number[];
169
+ isActive?: boolean;
170
+ requiresApproval?: boolean;
266
171
  }
267
- interface UpdateDelegationRequest {
268
- rowVersion: string;
172
+ interface CreateDelegationV2Request {
173
+ delegateFrom?: string | null;
174
+ delegateTo: string;
269
175
  description?: string;
270
- startDateUtc: string;
271
- endDateUtc: string;
272
- timeZoneId: string;
273
- dayRules: DelegationDayRules;
274
- requiresApproval?: boolean;
275
- scope: DelegationScopeRequest;
176
+ delegateFromDateTime: string;
177
+ delegateToDateTime: string;
178
+ delegationDaysType: DelegationDayRuleMode;
179
+ specificDays?: number[];
180
+ requiresApproval: boolean;
181
+ scope: DelegationScopeSelection;
276
182
  }
183
+ type UpdateDelegationLegacyRequest = CreateDelegationLegacyRequest & {
184
+ rowVersion: string;
185
+ };
186
+ type UpdateDelegationV2Request = CreateDelegationV2Request & {
187
+ rowVersion: string;
188
+ };
277
189
  interface ApproveDelegationRequest {
278
190
  rowVersion: string;
279
- comment?: string;
191
+ reason?: string;
280
192
  }
281
193
  interface RejectDelegationRequest {
282
194
  rowVersion: string;
283
195
  reason: string;
284
196
  }
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
197
  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",
198
+ GetMy = "getMy",
199
+ GetAssigned = "getAssigned",
200
+ GetActive = "getActive",
201
+ GetDetail = "getDetail",
305
202
  GetScopeOptions = "getScopeOptions",
306
- PreviewScope = "previewScope"
203
+ PreviewScope = "previewScope",
204
+ Create = "create",
205
+ Update = "update",
206
+ Approve = "approve",
207
+ Reject = "reject",
208
+ Cancel = "cancel"
307
209
  }
308
210
  interface DelegationsStateModel extends LoadingStateShape<DelegationsActionKey> {
309
- my: PagedResult<Delegation> | null;
310
- assigned: PagedResult<Delegation> | null;
311
- selected: DelegationDetail | null;
211
+ my: DelegationPage<DelegationRow> | null;
212
+ assigned: DelegationPage<DelegationRow> | null;
213
+ active: DelegationPage<DelegationRow> | null;
214
+ detail: DelegationDetail | null;
312
215
  scopeOptions: DelegationScopeOptions | null;
313
216
  scopePreview: DelegationScopePreview | null;
314
217
  }
315
218
 
316
219
  /**
317
- * Topbar surface for the delegation runtime.
220
+ * Topbar surface for the delegation runtime (doc 05, 09).
318
221
  *
319
222
  * 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.
223
+ * State B — candidates exist, no active session: lets the user start a session.
224
+ * State C — active delegated session: shows "Acting on behalf of {delegator}" +
225
+ * "Executed by {actual user}", plus Back / Switch.
325
226
  */
326
227
  declare class TopbarDelegationMenu {
327
228
  /** Path to the management page, e.g. `/control-panel/delegations` or `/delegations`. */
328
229
  readonly managePath: _angular_core.InputSignal<string>;
329
- /** Compact mode hides the inline delegator name next to the button. */
330
230
  readonly compact: _angular_core.InputSignal<boolean>;
331
231
  private readonly facade;
332
232
  private readonly modal;
333
233
  private readonly transloco;
334
234
  protected readonly popover: _angular_core.Signal<Popover>;
335
235
  protected readonly active: _angular_core.Signal<_masterteam_delegations.ActiveDelegationSession | null>;
336
- protected readonly candidates: _angular_core.Signal<DelegationSummary[]>;
236
+ protected readonly candidates: _angular_core.Signal<DelegationRow[]>;
337
237
  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. */
238
+ protected readonly onBehalfOf: _angular_core.Signal<_masterteam_delegations.DelegationParty | null>;
239
+ protected readonly executedBy: _angular_core.Signal<_masterteam_delegations.DelegationParty | null>;
342
240
  protected readonly mode: _angular_core.Signal<"active" | "candidates" | "hidden">;
343
241
  togglePopover(event: Event): void;
344
- startCandidate(candidate: DelegationSummary, event: MouseEvent): void;
345
- switchTo(candidate: DelegationSummary, event: MouseEvent): void;
242
+ start(row: DelegationRow, event: MouseEvent): void;
243
+ switchTo(row: DelegationRow, event: MouseEvent): void;
346
244
  endSession(event: MouseEvent): void;
347
- private openConfirmation;
245
+ private openConfirm;
348
246
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<TopbarDelegationMenu, never>;
349
247
  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>;
350
248
  }
@@ -354,28 +252,28 @@ interface StatusVisual {
354
252
  styleClass: string;
355
253
  }
356
254
  declare class DelegationStatusChip {
357
- readonly status: _angular_core.InputSignal<DelegationStatus>;
255
+ readonly status: _angular_core.InputSignal<DelegationEffectiveStatus>;
358
256
  protected readonly visual: _angular_core.Signal<StatusVisual>;
359
257
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<DelegationStatusChip, never>;
360
258
  static ɵcmp: _angular_core.ɵɵComponentDeclaration<DelegationStatusChip, "mt-delegation-status-chip", never, { "status": { "alias": "status"; "required": true; "isSignal": true; }; }, {}, never, never, true, never>;
361
259
  }
362
260
 
363
261
  /**
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.
262
+ * Confirmation dialog before starting (or switching to) a delegated session.
263
+ * Calls the facade, which POSTs to `delegationToken/{id}` and stores the raw
264
+ * token in memory only.
366
265
  */
367
266
  declare class StartSessionDialog {
368
- readonly candidate: _angular_core.InputSignal<DelegationSummary>;
267
+ readonly delegation: _angular_core.InputSignal<DelegationRow>;
369
268
  readonly intent: _angular_core.InputSignal<"start" | "switch">;
370
269
  private readonly ref;
371
270
  private readonly facade;
372
271
  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">;
272
+ protected readonly bodyKey: _angular_core.Signal<"delegations.session.switchConfirmBody" | "delegations.session.startConfirmBody">;
375
273
  confirm(): void;
376
274
  cancel(): void;
377
275
  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>;
276
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<StartSessionDialog, "mt-start-session-dialog", never, { "delegation": { "alias": "delegation"; "required": true; "isSignal": true; }; "intent": { "alias": "intent"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
379
277
  }
380
278
 
381
279
  declare class Delegations {
@@ -387,18 +285,12 @@ declare class Delegations {
387
285
 
388
286
  type DelegationTab = 'my' | 'assigned';
389
287
  /**
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.
288
+ * Delegations portal page (doc 02, 09): two lists My Delegations (current user
289
+ * is delegator) and Delegated To Me (current user is delegate). Rows render only
290
+ * the BE-returned `allowedActions`; status comes from `effectiveStatus`.
398
291
  */
399
292
  declare class DelegationsList implements OnInit {
400
293
  private readonly facade;
401
- private readonly session;
402
294
  private readonly modal;
403
295
  private readonly transloco;
404
296
  protected readonly breadcrumbItems: _angular_core.WritableSignal<({
@@ -420,7 +312,7 @@ declare class DelegationsList implements OnInit {
420
312
  label: string;
421
313
  }[]>;
422
314
  protected readonly isLoading: _angular_core.Signal<boolean>;
423
- protected readonly rows: _angular_core.Signal<Delegation[]>;
315
+ protected readonly rows: _angular_core.Signal<DelegationRow[]>;
424
316
  statusCol: _angular_core.Signal<TemplateRef<unknown>>;
425
317
  userCol: _angular_core.Signal<TemplateRef<unknown>>;
426
318
  scopeCol: _angular_core.Signal<TemplateRef<unknown>>;
@@ -433,8 +325,9 @@ declare class DelegationsList implements OnInit {
433
325
  ngOnInit(): void;
434
326
  protected switchTab(tab: DelegationTab): void;
435
327
  private loadCurrentTab;
436
- protected has(row: Delegation, action: DelegationAllowedAction): boolean;
437
- protected formatDays(row: Delegation): string;
328
+ private reloadCurrentTab;
329
+ protected has(row: DelegationRow, action: DelegationAllowedAction): boolean;
330
+ protected formatDays(row: DelegationRow): string;
438
331
  private viewDetails;
439
332
  private openForm;
440
333
  private approve;
@@ -447,17 +340,15 @@ declare class DelegationsList implements OnInit {
447
340
  }
448
341
 
449
342
  /**
450
- * Delegation create/edit form, target-shape compliant.
343
+ * Delegation create/edit form (doc 04). Uses the v2 explicit-scope endpoints so
344
+ * the persisted `DelegationScopeSelection` matches what scope/preview validated.
451
345
  *
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.
346
+ * - Delegator is server-derived; only the delegated user is collected.
347
+ * - On edit, scope grants + rowVersion come from the loaded detail.
348
+ * - Times are sent in UTC ISO; wrappers set timeZoneId = UTC.
458
349
  */
459
350
  declare class DelegationForm implements OnInit {
460
- readonly delegationForEdit: _angular_core.InputSignal<Delegation | null>;
351
+ readonly delegationForEdit: _angular_core.InputSignal<DelegationRow | null>;
461
352
  readonly readonly: _angular_core.InputSignal<boolean>;
462
353
  private readonly halfWidth;
463
354
  private readonly fullWidth;
@@ -467,31 +358,29 @@ declare class DelegationForm implements OnInit {
467
358
  private readonly facade;
468
359
  delegationFormControl: FormControl<any>;
469
360
  formValue: _angular_core.Signal<any>;
470
- selected: _angular_core.Signal<_masterteam_delegations.DelegationDetail | null>;
361
+ detail: _angular_core.Signal<_masterteam_delegations.DelegationDetail | null>;
471
362
  isDetailLoading: _angular_core.Signal<boolean>;
472
363
  isSaving: _angular_core.Signal<boolean>;
473
364
  context: HttpContext;
474
- protected readonly isDelegatingToSelf: _angular_core.Signal<boolean>;
475
- protected readonly scope: _angular_core.WritableSignal<DelegationScopeRequest>;
365
+ protected readonly scope: _angular_core.WritableSignal<DelegationScopeSelection>;
476
366
  protected readonly specificDaysOptions: _angular_core.WritableSignal<{
477
367
  label: string;
478
368
  value: number;
479
369
  }[]>;
480
- protected readonly delegationFormConfig: _angular_core.Signal<DynamicFormConfig>;
370
+ protected readonly formConfig: _angular_core.Signal<DynamicFormConfig>;
481
371
  constructor();
482
372
  ngOnInit(): void;
373
+ protected readonly canSubmit: _angular_core.Signal<boolean>;
483
374
  onSubmit(): void;
484
375
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<DelegationForm, never>;
485
376
  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
377
  }
487
378
 
488
- type DetailTab = 'overview' | 'scope' | 'history';
379
+ type DetailTab = 'overview' | 'scope';
489
380
  /**
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.
381
+ * Read-only drawer that shows the full `DelegationDetail` ({ row, scope, status }).
492
382
  */
493
383
  declare class DelegationDetailDrawer implements OnInit {
494
- /** Delegation id passed in via the modal's inputValues. */
495
384
  readonly delegationId: _angular_core.InputSignal<number>;
496
385
  private readonly facade;
497
386
  private readonly transloco;
@@ -502,8 +391,8 @@ declare class DelegationDetailDrawer implements OnInit {
502
391
  }[];
503
392
  protected readonly activeTab: _angular_core.WritableSignal<DetailTab>;
504
393
  protected readonly isLoading: _angular_core.Signal<boolean>;
505
- protected readonly detail: _angular_core.Signal<DelegationDetail | null>;
506
- protected readonly statusHistory: _angular_core.Signal<DelegationStatusHistoryEntry[]>;
394
+ protected readonly detail: _angular_core.Signal<_masterteam_delegations.DelegationDetail | null>;
395
+ protected readonly row: _angular_core.Signal<_masterteam_delegations.DelegationRow | null>;
507
396
  ngOnInit(): void;
508
397
  protected setTab(tab: DetailTab): void;
509
398
  protected approvalLabel(): string;
@@ -511,68 +400,49 @@ declare class DelegationDetailDrawer implements OnInit {
511
400
  static ɵcmp: _angular_core.ɵɵComponentDeclaration<DelegationDetailDrawer, "mt-delegation-detail-drawer", never, { "delegationId": { "alias": "delegationId"; "required": true; "isSignal": true; }; }, {}, never, never, true, never>;
512
401
  }
513
402
 
514
- interface AccessibilityGroupOption {
515
- appAccessibilityId: number;
516
- accessibilityGroupId: number;
517
- moduleName: string;
518
- groupName: string;
403
+ interface TargetGroup {
404
+ key: string;
405
+ target: DelegationScopeTarget;
406
+ grants: DelegationGrant[];
519
407
  }
520
408
  /**
521
- * Scope picker driven entirely by Identity-provided options.
409
+ * Grants-based scope picker (doc 03). Driven entirely by `scope/options`:
410
+ * - lists grantable target/action pairs returned by the backend,
411
+ * - lets the user toggle each grant,
412
+ * - calls `scope/preview` (debounced) and surfaces summary / warnings / denied.
522
413
  *
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`.
414
+ * `[(scope)]` two-way binds a `DelegationScopeSelection`. The component never
415
+ * invents permission metadata it only echoes grants returned by options.
528
416
  */
529
417
  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>;
418
+ readonly scope: _angular_core.ModelSignal<DelegationScopeSelection>;
532
419
  readonly readonly: _angular_core.InputSignal<boolean>;
533
- /** Admin scope-as-another-user — passed through to the options endpoint. */
534
420
  readonly delegatorUserId: _angular_core.InputSignal<string | undefined>;
535
421
  private readonly facade;
536
- private readonly transloco;
537
- protected readonly options: _angular_core.Signal<_masterteam_delegations.DelegationScopeOptions | null>;
422
+ protected readonly options: _angular_core.Signal<DelegationScopeSelection | null>;
538
423
  protected readonly preview: _angular_core.Signal<_masterteam_delegations.DelegationScopePreview | null>;
539
424
  protected readonly isLoadingOptions: _angular_core.Signal<boolean>;
540
425
  protected readonly isPreviewing: _angular_core.Signal<boolean>;
541
- /** Set of accordion target keys currently expanded. */
426
+ /** Grantable options grouped by target. */
427
+ protected readonly groups: _angular_core.Signal<TargetGroup[]>;
428
+ /** Selected grant keys for O(1) checkbox state. */
429
+ protected readonly selectedKeys: _angular_core.Signal<Set<string>>;
542
430
  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
431
  ngOnInit(): void;
556
432
  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;
433
+ protected isExpanded(group: TargetGroup): boolean;
434
+ protected toggleAccordion(group: TargetGroup): void;
435
+ protected isSelected(grant: DelegationGrant): boolean;
436
+ protected toggleGrant(grant: DelegationGrant): void;
437
+ protected selectedCount(group: TargetGroup): number;
566
438
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<ScopePicker, never>;
567
439
  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
440
  }
569
441
 
570
442
  /**
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).
443
+ * Adds `app-delegation: Bearer <token>` to outgoing requests while a delegated
444
+ * session is active. Register AFTER the gateway-auth interceptor (so the normal
445
+ * `Authorization` header is set first) and BEFORE the message interceptor.
576
446
  */
577
447
  declare const appDelegationInterceptor: HttpInterceptorFn;
578
448
 
@@ -586,25 +456,53 @@ declare class GetAssignedDelegations {
586
456
  static readonly type = "[Delegations] Get Assigned Delegations";
587
457
  constructor(query?: DelegationListQuery);
588
458
  }
589
- declare class GetDelegation {
459
+ declare class GetActiveAssignedDelegations {
460
+ query: DelegationListQuery;
461
+ static readonly type = "[Delegations] Get Active Assigned Delegations";
462
+ constructor(query?: DelegationListQuery);
463
+ }
464
+ declare class GetDelegationDetail {
590
465
  id: number;
591
- includeStatusHistory: boolean;
592
- static readonly type = "[Delegations] Get Delegation";
593
- constructor(id: number, includeStatusHistory?: boolean);
466
+ static readonly type = "[Delegations] Get Delegation Detail";
467
+ constructor(id: number);
594
468
  }
595
- declare class ClearSelectedDelegation {
596
- static readonly type = "[Delegations] Clear Selected Delegation";
469
+ declare class ClearDelegationDetail {
470
+ static readonly type = "[Delegations] Clear Delegation Detail";
597
471
  }
598
- declare class CreateDelegation {
599
- request: CreateDelegationRequest;
600
- static readonly type = "[Delegations] Create Delegation";
601
- constructor(request: CreateDelegationRequest);
472
+ declare class GetScopeOptions {
473
+ delegatorUserId?: string | undefined;
474
+ static readonly type = "[Delegations] Get Scope Options";
475
+ constructor(delegatorUserId?: string | undefined);
476
+ }
477
+ declare class PreviewScope {
478
+ scope: DelegationScopeSelection;
479
+ static readonly type = "[Delegations] Preview Scope";
480
+ constructor(scope: DelegationScopeSelection);
481
+ }
482
+ declare class ClearScopePreview {
483
+ static readonly type = "[Delegations] Clear Scope Preview";
484
+ }
485
+ declare class CreateDelegationLegacy {
486
+ request: CreateDelegationLegacyRequest;
487
+ static readonly type = "[Delegations] Create Delegation (legacy)";
488
+ constructor(request: CreateDelegationLegacyRequest);
489
+ }
490
+ declare class CreateDelegationV2 {
491
+ request: CreateDelegationV2Request;
492
+ static readonly type = "[Delegations] Create Delegation (v2)";
493
+ constructor(request: CreateDelegationV2Request);
602
494
  }
603
- declare class UpdateDelegation {
495
+ declare class UpdateDelegationLegacy {
604
496
  id: number;
605
- request: UpdateDelegationRequest;
606
- static readonly type = "[Delegations] Update Delegation";
607
- constructor(id: number, request: UpdateDelegationRequest);
497
+ request: UpdateDelegationLegacyRequest;
498
+ static readonly type = "[Delegations] Update Delegation (legacy)";
499
+ constructor(id: number, request: UpdateDelegationLegacyRequest);
500
+ }
501
+ declare class UpdateDelegationV2 {
502
+ id: number;
503
+ request: UpdateDelegationV2Request;
504
+ static readonly type = "[Delegations] Update Delegation (v2)";
505
+ constructor(id: number, request: UpdateDelegationV2Request);
608
506
  }
609
507
  declare class ApproveDelegation {
610
508
  id: number;
@@ -620,198 +518,163 @@ declare class RejectDelegation {
620
518
  }
621
519
  declare class CancelDelegation {
622
520
  id: number;
623
- request: CancelDelegationRequest;
521
+ rowVersion: string;
522
+ asAdmin: boolean;
624
523
  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";
524
+ constructor(id: number, rowVersion: string, asAdmin?: boolean);
640
525
  }
641
526
 
527
+ interface ApiErrorBody {
528
+ code: string;
529
+ message: string;
530
+ details?: Record<string, unknown> | null;
531
+ }
642
532
  interface Response<T> {
643
533
  endpoint: string;
644
534
  status: number;
645
535
  code: number;
646
536
  locale: string;
647
537
  message?: string | null;
648
- errors?: any | null;
538
+ errors?: ApiErrorBody | null;
649
539
  data: T;
650
- cacheSession?: string;
540
+ cacheSession?: string | null;
541
+ correlationId?: string | null;
651
542
  }
652
543
 
653
544
  declare class DelegationsState {
654
545
  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;
546
+ static getMy(state: DelegationsStateModel): DelegationPage<DelegationRow> | null;
547
+ static getAssigned(state: DelegationsStateModel): DelegationPage<DelegationRow> | null;
548
+ static getActive(state: DelegationsStateModel): DelegationPage<DelegationRow> | null;
549
+ static getDetail(state: DelegationsStateModel): DelegationDetail | null;
658
550
  static getScopeOptions(state: DelegationsStateModel): DelegationScopeOptions | null;
659
551
  static getScopePreview(state: DelegationsStateModel): DelegationScopePreview | null;
660
552
  static getLoadingActive(state: DelegationsStateModel): string[];
661
553
  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>>;
554
+ getMy(ctx: StateContext<DelegationsStateModel>, { query }: GetMyDelegations): rxjs.Observable<Response<DelegationPage<DelegationRow>>>;
555
+ getAssigned(ctx: StateContext<DelegationsStateModel>, { query }: GetAssignedDelegations): rxjs.Observable<Response<DelegationPage<DelegationRow>>>;
556
+ getActive(ctx: StateContext<DelegationsStateModel>, { query }: GetActiveAssignedDelegations): rxjs.Observable<Response<DelegationPage<DelegationRow>>>;
557
+ getDetail(ctx: StateContext<DelegationsStateModel>, { id }: GetDelegationDetail): rxjs.Observable<Response<DelegationDetail>>;
558
+ clearDetail(ctx: StateContext<DelegationsStateModel>): void;
559
+ getScopeOptions(ctx: StateContext<DelegationsStateModel>, { delegatorUserId }: GetScopeOptions): rxjs.Observable<Response<_masterteam_delegations.DelegationScopeSelection>>;
672
560
  previewScope(ctx: StateContext<DelegationsStateModel>, { scope }: PreviewScope): rxjs.Observable<Response<DelegationScopePreview>>;
673
561
  clearScopePreview(ctx: StateContext<DelegationsStateModel>): void;
674
- private applyLifecycleResult;
562
+ createLegacy(ctx: StateContext<DelegationsStateModel>, { request }: CreateDelegationLegacy): rxjs.Observable<Response<DelegationDto>>;
563
+ createV2(ctx: StateContext<DelegationsStateModel>, { request }: CreateDelegationV2): rxjs.Observable<Response<DelegationDto>>;
564
+ updateLegacy(ctx: StateContext<DelegationsStateModel>, { id, request }: UpdateDelegationLegacy): rxjs.Observable<Response<DelegationDto>>;
565
+ updateV2(ctx: StateContext<DelegationsStateModel>, { id, request }: UpdateDelegationV2): rxjs.Observable<Response<DelegationDto>>;
566
+ approve(ctx: StateContext<DelegationsStateModel>, { id, request }: ApproveDelegation): rxjs.Observable<Response<DelegationDto>>;
567
+ reject(ctx: StateContext<DelegationsStateModel>, { id, request }: RejectDelegation): rxjs.Observable<Response<DelegationDto>>;
568
+ cancel(ctx: StateContext<DelegationsStateModel>, { id, rowVersion, asAdmin }: CancelDelegation): rxjs.Observable<Response<boolean>>;
675
569
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<DelegationsState, never>;
676
570
  static ɵprov: _angular_core.ɵɵInjectableDeclaration<DelegationsState>;
677
571
  }
678
572
 
679
573
  declare class DelegationsFacade {
680
574
  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>;
575
+ readonly myPage: _angular_core.Signal<_masterteam_delegations.DelegationPage<_masterteam_delegations.DelegationRow> | null>;
576
+ readonly assignedPage: _angular_core.Signal<_masterteam_delegations.DelegationPage<_masterteam_delegations.DelegationRow> | null>;
577
+ readonly activePage: _angular_core.Signal<_masterteam_delegations.DelegationPage<_masterteam_delegations.DelegationRow> | null>;
578
+ readonly detail: _angular_core.Signal<_masterteam_delegations.DelegationDetail | null>;
579
+ readonly scopeOptions: _angular_core.Signal<DelegationScopeSelection | null>;
685
580
  readonly scopePreview: _angular_core.Signal<_masterteam_delegations.DelegationScopePreview | null>;
686
581
  private readonly loadingActive;
687
582
  private readonly errors;
688
- readonly myItems: _angular_core.Signal<_masterteam_delegations.Delegation[]>;
689
- readonly assignedItems: _angular_core.Signal<_masterteam_delegations.Delegation[]>;
583
+ readonly myItems: _angular_core.Signal<_masterteam_delegations.DelegationRow[]>;
584
+ readonly assignedItems: _angular_core.Signal<_masterteam_delegations.DelegationRow[]>;
585
+ readonly activeItems: _angular_core.Signal<_masterteam_delegations.DelegationRow[]>;
690
586
  readonly isLoadingMy: _angular_core.Signal<boolean>;
691
587
  readonly isLoadingAssigned: _angular_core.Signal<boolean>;
588
+ readonly isLoadingActive: _angular_core.Signal<boolean>;
692
589
  readonly isLoadingDetail: _angular_core.Signal<boolean>;
693
- readonly isCreating: _angular_core.Signal<boolean>;
694
- readonly isUpdating: _angular_core.Signal<boolean>;
590
+ readonly isLoadingScopeOptions: _angular_core.Signal<boolean>;
591
+ readonly isPreviewingScope: _angular_core.Signal<boolean>;
592
+ readonly isSaving: _angular_core.Signal<boolean>;
695
593
  readonly isApproving: _angular_core.Signal<boolean>;
696
594
  readonly isRejecting: _angular_core.Signal<boolean>;
697
595
  readonly isCancelling: _angular_core.Signal<boolean>;
698
- readonly isLoadingScopeOptions: _angular_core.Signal<boolean>;
699
- readonly isPreviewingScope: _angular_core.Signal<boolean>;
700
596
  readonly errorMy: _angular_core.Signal<string | null>;
701
597
  readonly errorAssigned: _angular_core.Signal<string | null>;
702
598
  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>;
599
+ readonly errorSave: _angular_core.Signal<string | null>;
708
600
  getMy(query?: DelegationListQuery): rxjs.Observable<void>;
709
601
  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>;
602
+ getActive(query?: DelegationListQuery): rxjs.Observable<void>;
603
+ getDetail(id: number): rxjs.Observable<void>;
604
+ clearDetail(): rxjs.Observable<void>;
717
605
  loadScopeOptions(delegatorUserId?: string): rxjs.Observable<void>;
718
- previewScope(scope: DelegationScopeRequest): rxjs.Observable<void>;
606
+ previewScope(scope: DelegationScopeSelection): rxjs.Observable<void>;
719
607
  clearScopePreview(): rxjs.Observable<void>;
608
+ createLegacy(request: CreateDelegationLegacyRequest): rxjs.Observable<void>;
609
+ createV2(request: CreateDelegationV2Request): rxjs.Observable<void>;
610
+ updateLegacy(id: number, request: UpdateDelegationLegacyRequest): rxjs.Observable<void>;
611
+ updateV2(id: number, request: UpdateDelegationV2Request): rxjs.Observable<void>;
612
+ approve(id: number, request: ApproveDelegationRequest): rxjs.Observable<void>;
613
+ reject(id: number, request: RejectDelegationRequest): rxjs.Observable<void>;
614
+ cancel(id: number, rowVersion: string, asAdmin?: boolean): rxjs.Observable<void>;
720
615
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<DelegationsFacade, never>;
721
616
  static ɵprov: _angular_core.ɵɵInjectableDeclaration<DelegationsFacade>;
722
617
  }
723
618
 
724
- declare const DELEGATION_SESSION_STORAGE_KEY = "mt.delegation.session.v1";
619
+ /**
620
+ * Active delegated session. Memory-only by design (doc 05):
621
+ * the delegation token is never persisted to long-lived storage.
622
+ *
623
+ * `delegation.delegatedUser` is the executed-by (actual logged-in) user and
624
+ * `delegation.delegator` is the on-behalf-of user — both already present on the
625
+ * row from the active-delegations endpoint.
626
+ */
725
627
  interface ActiveDelegationSession {
726
- accessToken: string;
727
- accessTokenExpiresAtUtc: string;
728
- refreshToken: string;
729
- refreshTokenExpiresAtUtc: string;
730
- delegation: DelegationSummary;
628
+ token: string;
629
+ delegation: DelegationRow;
731
630
  }
732
- declare function toActiveSession(pair: DelegationTokenPair): ActiveDelegationSession;
631
+ type DelegationSessionInvalidationReason = 'TokenInvalid' | 'SessionMismatch' | 'ScopeChanged' | 'Forbidden' | 'Logout' | 'UserSwitch' | 'Manual';
733
632
  declare enum DelegationSessionActionKey {
734
- Bootstrap = "bootstrap",
735
- StartSession = "startSession",
736
- EndSession = "endSession",
737
- RefreshSession = "refreshSession",
738
- GetSession = "getSession"
633
+ LoadCandidates = "loadCandidates",
634
+ StartSession = "startSession"
739
635
  }
740
636
  interface DelegationSessionStateModel extends LoadingStateShape<DelegationSessionActionKey> {
741
637
  active: ActiveDelegationSession | null;
742
- candidates: DelegationSummary[];
638
+ candidates: DelegationRow[];
743
639
  }
744
640
 
745
- /** Reads sessionStorage + login candidates, restores any tab-local active session. */
746
- declare class BootstrapDelegationSession {
747
- static readonly type = "[DelegationSession] Bootstrap";
641
+ /** Fetch the active delegations the current user may start (user/activedelegations). */
642
+ declare class LoadDelegationCandidates {
643
+ static readonly type = "[DelegationSession] Load Candidates";
748
644
  }
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. */
645
+ /** Start a delegated session for the given assignment row. */
756
646
  declare class StartDelegationSession {
757
- delegationId: number;
647
+ delegation: DelegationRow;
758
648
  static readonly type = "[DelegationSession] Start";
759
- constructor(delegationId: number);
649
+ constructor(delegation: DelegationRow);
760
650
  }
761
- /** End the current delegated session (server + local). */
651
+ /** End the current delegated session. Client-local only (doc 05). */
762
652
  declare class EndDelegationSession {
763
- options: {
764
- silent?: boolean;
765
- };
653
+ reason: DelegationSessionInvalidationReason;
766
654
  static readonly type = "[DelegationSession] End";
767
- constructor(options?: {
768
- silent?: boolean;
769
- });
655
+ constructor(reason?: DelegationSessionInvalidationReason);
770
656
  }
771
- /** Atomically end current + start another. */
657
+ /** Switch directly from the current session to another delegation. */
772
658
  declare class SwitchDelegationSession {
773
- delegationId: number;
659
+ delegation: DelegationRow;
774
660
  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');
661
+ constructor(delegation: DelegationRow);
790
662
  }
791
663
 
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
664
  declare class DelegationSessionState {
798
665
  private http;
799
666
  private actions$;
800
667
  private store;
801
668
  constructor();
802
669
  static getActive(state: DelegationSessionStateModel): ActiveDelegationSession | null;
803
- static getCandidates(state: DelegationSessionStateModel): DelegationSummary[];
670
+ static getCandidates(state: DelegationSessionStateModel): DelegationRow[];
804
671
  static isDelegated(state: DelegationSessionStateModel): boolean;
805
672
  static getLoadingActive(state: DelegationSessionStateModel): string[];
806
673
  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>;
674
+ loadCandidates(ctx: StateContext<DelegationSessionStateModel>): rxjs.Observable<Response<DelegationPage<DelegationRow>>>;
675
+ start(ctx: StateContext<DelegationSessionStateModel>, { delegation }: StartDelegationSession): rxjs.Observable<Response<string>>;
676
+ end(ctx: StateContext<DelegationSessionStateModel>): rxjs.Observable<never>;
677
+ switch(ctx: StateContext<DelegationSessionStateModel>, { delegation }: SwitchDelegationSession): rxjs.Observable<void>;
815
678
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<DelegationSessionState, never>;
816
679
  static ɵprov: _angular_core.ɵɵInjectableDeclaration<DelegationSessionState>;
817
680
  }
@@ -819,29 +682,25 @@ declare class DelegationSessionState {
819
682
  declare class DelegationSessionFacade {
820
683
  private readonly store;
821
684
  readonly active: _angular_core.Signal<_masterteam_delegations.ActiveDelegationSession | null>;
822
- readonly candidates: _angular_core.Signal<DelegationSummary[]>;
685
+ readonly candidates: _angular_core.Signal<DelegationRow[]>;
823
686
  readonly isDelegated: _angular_core.Signal<boolean>;
824
687
  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>;
688
+ /** Raw delegation token for the `app-delegation` header. */
689
+ readonly token: _angular_core.Signal<string | null>;
690
+ /** On-behalf-of (delegator). */
691
+ readonly onBehalfOf: _angular_core.Signal<_masterteam_delegations.DelegationParty | null>;
692
+ /** Executed-by (actual logged-in / delegated user). */
693
+ readonly executedBy: _angular_core.Signal<_masterteam_delegations.DelegationParty | null>;
828
694
  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>;
695
+ readonly isStarting: _angular_core.Signal<boolean>;
696
+ readonly isLoadingCandidates: _angular_core.Signal<boolean>;
697
+ loadCandidates(): rxjs.Observable<void>;
698
+ startSession(delegation: DelegationRow): rxjs.Observable<void>;
699
+ switchSession(delegation: DelegationRow): rxjs.Observable<void>;
700
+ endSession(reason?: DelegationSessionInvalidationReason): rxjs.Observable<void>;
842
701
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<DelegationSessionFacade, never>;
843
702
  static ɵprov: _angular_core.ɵɵInjectableDeclaration<DelegationSessionFacade>;
844
703
  }
845
704
 
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 };
705
+ export { ApproveDelegation, CancelDelegation, ClearDelegationDetail, ClearScopePreview, CreateDelegationLegacy, CreateDelegationV2, DelegationDetailDrawer, DelegationForm, DelegationSessionActionKey, DelegationSessionFacade, DelegationSessionState, DelegationStatusChip, Delegations, DelegationsActionKey, DelegationsFacade, DelegationsList, DelegationsState, EndDelegationSession, GetActiveAssignedDelegations, GetAssignedDelegations, GetDelegationDetail, GetMyDelegations, GetScopeOptions, LoadDelegationCandidates, PreviewScope, RejectDelegation, ScopePicker, StartDelegationSession, StartSessionDialog, SwitchDelegationSession, TopbarDelegationMenu, UpdateDelegationLegacy, UpdateDelegationV2, appDelegationInterceptor };
706
+ export type { ActiveDelegationSession, ApproveDelegationRequest, CreateDelegationLegacyRequest, CreateDelegationV2Request, DelegationAllowedAction, DelegationApprovalInfo, DelegationApprovalStatus, DelegationCancellationInfo, DelegationDayRuleMode, DelegationDetail, DelegationDto, DelegationEffectiveStatus, DelegationGrant, DelegationListQuery, DelegationPage, DelegationParty, DelegationRow, DelegationScopeAction, DelegationScopeDeniedItem, DelegationScopeOptions, DelegationScopePreview, DelegationScopeSelection, DelegationScopeTarget, DelegationScopeWarning, DelegationSessionInvalidationReason, DelegationSessionStateModel, DelegationSortDirection, DelegationStatusInfo, DelegationsStateModel, RejectDelegationRequest, UpdateDelegationLegacyRequest, UpdateDelegationV2Request };