@masterteam/delegations 0.0.12 → 0.0.13

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,299 @@
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
 
26
- interface DelegationUser {
27
- id: string;
19
+ type DelegationEffectiveStatus = 'PendingApproval' | 'Scheduled' | 'Active' | 'InactiveToday' | 'Expired' | 'Rejected' | 'Cancelled';
20
+ type DelegationApprovalStatus = 'NotRequired' | 'Pending' | 'Approved' | 'Rejected';
21
+ type DelegationAllowedAction = 'View' | 'Edit' | 'Approve' | 'Reject' | 'Cancel' | 'StartSession' | 'EndSession';
22
+ type DelegationDayRuleMode = 'FullRange' | 'SpecificDays';
23
+ interface DelegationParty {
28
24
  userId: string;
29
25
  displayName: string;
30
- mobile: string;
31
- userName: string;
32
- email: string;
33
- photo: string;
34
- }
35
- interface DelegationDateTime {
36
- displayValue: string;
37
- actualValue: string;
38
- }
39
- interface Delegation {
40
- id?: number;
41
- delegateFrom?: DelegationUser;
42
- delegateTo?: DelegationUser;
43
- delegateFromDateTime?: DelegationDateTime;
44
- delegateToDateTime?: DelegationDateTime;
45
- delegationStatus?: boolean;
46
- isActive?: boolean;
26
+ email?: string | null;
27
+ }
28
+ interface DelegationApprovalInfo {
29
+ requiresApproval: boolean;
30
+ approvalStatus: DelegationApprovalStatus;
31
+ }
32
+ interface DelegationCancellationInfo {
33
+ cancelledBy?: DelegationParty | null;
34
+ cancelledAtUtc?: string | null;
35
+ cancellationReason?: string | null;
36
+ }
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;
55
+ }
56
+ interface DelegationPage<T> {
57
+ items: T[];
58
+ page: number;
59
+ pageSize: number;
60
+ totalCount: number;
61
+ }
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;
78
+ operationKey: string;
79
+ operationKind: string;
80
+ permissionCommand?: string | null;
81
+ businessActionCode?: string | null;
82
+ isHighRisk?: boolean;
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;
102
+ }
103
+ interface DelegationScopeDeniedItem {
104
+ applicationKey: string;
105
+ targetType: string;
106
+ targetKey: string;
107
+ operationKey: string;
108
+ permissionCommand?: string;
109
+ reasonCode: string;
110
+ }
111
+ interface DelegationScopePreview {
112
+ isValid: boolean;
113
+ normalizedScope: DelegationScopeSelection;
114
+ scopeHash: string;
115
+ summary: string;
116
+ warnings: DelegationScopeWarning[];
117
+ deniedItems: DelegationScopeDeniedItem[];
118
+ }
119
+ interface DelegationStatusInfo {
120
+ effectiveStatus: DelegationEffectiveStatus;
121
+ reasonCode: string;
122
+ calculatedAtUtc: string;
123
+ }
124
+ interface DelegationDetail {
125
+ row: DelegationRow;
126
+ scope: DelegationScopeSelection;
127
+ status: DelegationStatusInfo;
128
+ }
129
+ interface DelegationDto {
130
+ id: number;
131
+ fromUserId: string;
132
+ toUserId: string;
47
133
  description?: string;
48
- delegationDaysType?: 'FullRange' | 'SpecificDays';
49
- specificDays?: number[] | null;
134
+ isActive?: boolean;
135
+ delegationDaysType: DelegationDayRuleMode;
136
+ specificDays: number[];
137
+ applicationId?: number;
138
+ requiresApproval?: boolean;
139
+ effectiveStatus: DelegationEffectiveStatus;
140
+ statusReasonCode: string;
141
+ allowedActions: DelegationAllowedAction[];
142
+ rowVersion: string;
143
+ [extra: string]: unknown;
144
+ }
145
+ type DelegationSortDirection = 'asc' | 'ascending' | 'desc' | 'descending';
146
+ interface DelegationListQuery {
147
+ activeOnly?: boolean;
148
+ status?: DelegationEffectiveStatus;
149
+ search?: string;
150
+ fromUtc?: string;
151
+ toUtc?: string;
152
+ sortBy?: string;
153
+ sortDirection?: DelegationSortDirection;
154
+ page?: number;
155
+ pageSize?: number;
156
+ delegatorUserId?: string;
157
+ delegatedUserId?: string;
50
158
  }
51
- interface DelegationFormData {
159
+ interface CreateDelegationLegacyRequest {
160
+ delegateFrom?: string | null;
52
161
  delegateTo: string;
162
+ description?: string;
53
163
  delegateFromDateTime: string;
54
164
  delegateToDateTime: string;
55
- delegateFrom: string;
56
- description?: string;
57
- delegationDaysType?: 'FullRange' | 'SpecificDays';
165
+ accessibilityIds?: number[];
166
+ moduleIds?: number[];
167
+ delegationDaysType: DelegationDayRuleMode;
58
168
  specificDays?: number[];
59
169
  isActive?: boolean;
170
+ requiresApproval?: boolean;
60
171
  }
61
- declare enum DelegationsActionKey {
62
- GetDelegations = "getDelegations",
63
- AddDelegation = "addDelegation",
64
- UpdateDelegation = "updateDelegation",
65
- DeleteDelegation = "deleteDelegation",
66
- GetDelegationForm = "getDelegationForm"
67
- }
68
- interface DelegationsStateModel extends LoadingStateShape<DelegationsActionKey> {
69
- allDelegations: Delegation[];
70
- selectedDelegation: Delegation | null;
71
- }
72
-
73
- declare class GetDelegations {
74
- static readonly type = "[Delegations] Get Delegations";
172
+ interface CreateDelegationV2Request {
173
+ delegateFrom?: string | null;
174
+ delegateTo: string;
175
+ description?: string;
176
+ delegateFromDateTime: string;
177
+ delegateToDateTime: string;
178
+ delegationDaysType: DelegationDayRuleMode;
179
+ specificDays?: number[];
180
+ requiresApproval: boolean;
181
+ scope: DelegationScopeSelection;
75
182
  }
76
- declare class AddDelegation {
77
- delegation: DelegationFormData;
78
- static readonly type = "[Delegations] Add Delegation";
79
- constructor(delegation: DelegationFormData);
183
+ type UpdateDelegationLegacyRequest = CreateDelegationLegacyRequest & {
184
+ rowVersion: string;
185
+ };
186
+ type UpdateDelegationV2Request = CreateDelegationV2Request & {
187
+ rowVersion: string;
188
+ };
189
+ interface ApproveDelegationRequest {
190
+ rowVersion: string;
191
+ reason?: string;
80
192
  }
81
- declare class UpdateDelegation {
82
- id: number;
83
- delegation: DelegationFormData;
84
- static readonly type = "[Delegations] Update Delegation";
85
- constructor(id: number, delegation: DelegationFormData);
193
+ interface RejectDelegationRequest {
194
+ rowVersion: string;
195
+ reason: string;
86
196
  }
87
- declare class DeleteDelegation {
88
- id: number;
89
- static readonly type = "[Delegations] Delete Delegation";
90
- constructor(id: number);
197
+ declare enum DelegationsActionKey {
198
+ GetMy = "getMy",
199
+ GetAssigned = "getAssigned",
200
+ GetActive = "getActive",
201
+ GetDetail = "getDetail",
202
+ GetScopeOptions = "getScopeOptions",
203
+ PreviewScope = "previewScope",
204
+ Create = "create",
205
+ Update = "update",
206
+ Approve = "approve",
207
+ Reject = "reject",
208
+ Cancel = "cancel"
91
209
  }
92
- declare class GetDelegation {
93
- id: number;
94
- static readonly type = "[Delegations] Get Delegation";
95
- constructor(id: number);
210
+ interface DelegationsStateModel extends LoadingStateShape<DelegationsActionKey> {
211
+ my: DelegationPage<DelegationRow> | null;
212
+ assigned: DelegationPage<DelegationRow> | null;
213
+ active: DelegationPage<DelegationRow> | null;
214
+ detail: DelegationDetail | null;
215
+ scopeOptions: DelegationScopeOptions | null;
216
+ scopePreview: DelegationScopePreview | null;
96
217
  }
97
- declare class ClearSelectedDelegation {
98
- static readonly type = "[Delegations] Clear Selected Delegation";
218
+
219
+ /**
220
+ * Topbar surface for the delegation runtime (doc 05, 09).
221
+ *
222
+ * State A — no candidates, no active session: renders nothing.
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.
226
+ */
227
+ declare class TopbarDelegationMenu {
228
+ /** Path to the management page, e.g. `/control-panel/delegations` or `/delegations`. */
229
+ readonly managePath: _angular_core.InputSignal<string>;
230
+ readonly compact: _angular_core.InputSignal<boolean>;
231
+ private readonly facade;
232
+ private readonly modal;
233
+ private readonly transloco;
234
+ protected readonly popover: _angular_core.Signal<Popover>;
235
+ protected readonly active: _angular_core.Signal<_masterteam_delegations.ActiveDelegationSession | null>;
236
+ protected readonly candidates: _angular_core.Signal<DelegationRow[]>;
237
+ protected readonly hasCandidates: _angular_core.Signal<boolean>;
238
+ protected readonly onBehalfOf: _angular_core.Signal<_masterteam_delegations.DelegationParty | null>;
239
+ protected readonly executedBy: _angular_core.Signal<_masterteam_delegations.DelegationParty | null>;
240
+ protected readonly mode: _angular_core.Signal<"active" | "candidates" | "hidden">;
241
+ togglePopover(event: Event): void;
242
+ start(row: DelegationRow, event: MouseEvent): void;
243
+ switchTo(row: DelegationRow, event: MouseEvent): void;
244
+ endSession(event: MouseEvent): void;
245
+ private openConfirm;
246
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<TopbarDelegationMenu, never>;
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>;
99
248
  }
100
249
 
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;
250
+ interface StatusVisual {
251
+ i18nKey: string;
252
+ styleClass: string;
253
+ }
254
+ declare class DelegationStatusChip {
255
+ readonly status: _angular_core.InputSignal<DelegationEffectiveStatus>;
256
+ protected readonly visual: _angular_core.Signal<StatusVisual>;
257
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<DelegationStatusChip, never>;
258
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<DelegationStatusChip, "mt-delegation-status-chip", never, { "status": { "alias": "status"; "required": true; "isSignal": true; }; }, {}, never, never, true, never>;
110
259
  }
111
260
 
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>;
261
+ /**
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.
265
+ */
266
+ declare class StartSessionDialog {
267
+ readonly delegation: _angular_core.InputSignal<DelegationRow>;
268
+ readonly intent: _angular_core.InputSignal<"start" | "switch">;
269
+ private readonly ref;
270
+ private readonly facade;
271
+ protected readonly isBusy: _angular_core.Signal<boolean>;
272
+ protected readonly bodyKey: _angular_core.Signal<"delegations.session.switchConfirmBody" | "delegations.session.startConfirmBody">;
273
+ confirm(): void;
274
+ cancel(): void;
275
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<StartSessionDialog, 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>;
126
277
  }
127
278
 
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>;
279
+ declare class Delegations {
280
+ private readonly router;
281
+ goBack(): void;
282
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<Delegations, never>;
283
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<Delegations, "mt-delegations", never, {}, {}, never, never, true, never>;
154
284
  }
155
285
 
286
+ type DelegationTab = 'my' | 'assigned';
287
+ /**
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`.
291
+ */
156
292
  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
293
  private readonly facade;
162
- readonly modal: ModalService;
163
- private readonly translocoService;
164
- breadcrumbItems: _angular_core.WritableSignal<({
294
+ private readonly modal;
295
+ private readonly transloco;
296
+ protected readonly breadcrumbItems: _angular_core.WritableSignal<({
165
297
  label: string;
166
298
  icon: string;
167
299
  routerLink: string;
@@ -174,55 +306,401 @@ declare class DelegationsList implements OnInit {
174
306
  icon?: undefined;
175
307
  routerLink?: undefined;
176
308
  })[]>;
177
- delegations: _angular_core.Signal<Delegation[]>;
178
- tabs: _angular_core.WritableSignal<{
309
+ protected readonly activeTab: _angular_core.WritableSignal<DelegationTab>;
310
+ protected readonly tabs: _angular_core.WritableSignal<{
311
+ value: DelegationTab;
179
312
  label: string;
180
- value: string;
181
313
  }[]>;
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;
314
+ protected readonly isLoading: _angular_core.Signal<boolean>;
315
+ protected readonly rows: _angular_core.Signal<DelegationRow[]>;
316
+ statusCol: _angular_core.Signal<TemplateRef<unknown>>;
317
+ userCol: _angular_core.Signal<TemplateRef<unknown>>;
318
+ scopeCol: _angular_core.Signal<TemplateRef<unknown>>;
319
+ daysCol: _angular_core.Signal<TemplateRef<unknown>>;
320
+ protected readonly tableActions: _angular_core.WritableSignal<TableAction[]>;
321
+ protected readonly rowActions: _angular_core.WritableSignal<TableAction[]>;
322
+ protected readonly tableColumns: _angular_core.WritableSignal<ColumnDef[]>;
323
+ private readonly busyIds;
191
324
  private readonly weekdayKeys;
192
325
  ngOnInit(): void;
193
- formatDelegationDays(row: Delegation): string;
194
- addDelegationDialog(delegation?: any | null): void;
326
+ protected switchTab(tab: DelegationTab): void;
327
+ private loadCurrentTab;
328
+ private reloadCurrentTab;
329
+ protected has(row: DelegationRow, action: DelegationAllowedAction): boolean;
330
+ protected formatDays(row: DelegationRow): string;
331
+ private viewDetails;
332
+ private openForm;
333
+ private approve;
334
+ private reject;
335
+ private cancel;
336
+ private startSession;
337
+ private mark;
195
338
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<DelegationsList, never>;
196
339
  static ɵcmp: _angular_core.ɵɵComponentDeclaration<DelegationsList, "mt-delegations-list", never, {}, {}, never, never, true, never>;
197
340
  }
198
341
 
342
+ /**
343
+ * Delegation create/edit form (doc 04). Uses the v2 explicit-scope endpoints so
344
+ * the persisted `DelegationScopeSelection` matches what scope/preview validated.
345
+ *
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.
349
+ */
199
350
  declare class DelegationForm implements OnInit {
200
- private readonly halfWidthFieldClass;
201
- private readonly fullWidthFieldClass;
351
+ readonly delegationForEdit: _angular_core.InputSignal<DelegationRow | null>;
352
+ readonly readonly: _angular_core.InputSignal<boolean>;
353
+ private readonly halfWidth;
354
+ private readonly fullWidth;
202
355
  modal: ModalService;
203
356
  ref: ModalRef;
204
- delegationForEdit: _angular_core.InputSignal<Delegation | null>;
205
- private readonly translocoService;
357
+ private readonly transloco;
206
358
  private readonly facade;
207
- selectedDelegation: _angular_core.Signal<Delegation | null>;
208
359
  delegationFormControl: FormControl<any>;
209
360
  formValue: _angular_core.Signal<any>;
210
- getDelegationFormLoading: _angular_core.Signal<boolean>;
211
- isAddingDelegation: _angular_core.Signal<boolean>;
212
- isUpdatingDelegation: _angular_core.Signal<boolean>;
361
+ detail: _angular_core.Signal<_masterteam_delegations.DelegationDetail | null>;
362
+ isDetailLoading: _angular_core.Signal<boolean>;
363
+ isSaving: _angular_core.Signal<boolean>;
213
364
  context: HttpContext;
214
- isDelegatingToSelf: _angular_core.Signal<boolean>;
215
- specificDaysOptions: _angular_core.WritableSignal<{
365
+ protected readonly scope: _angular_core.WritableSignal<DelegationScopeSelection>;
366
+ protected readonly specificDaysOptions: _angular_core.WritableSignal<{
216
367
  label: string;
217
368
  value: number;
218
369
  }[]>;
219
- delegationFormConfig: _angular_core.Signal<DynamicFormConfig>;
370
+ protected readonly formConfig: _angular_core.Signal<DynamicFormConfig>;
220
371
  constructor();
221
372
  ngOnInit(): void;
373
+ protected readonly canSubmit: _angular_core.Signal<boolean>;
222
374
  onSubmit(): void;
223
375
  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>;
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>;
377
+ }
378
+
379
+ type DetailTab = 'overview' | 'scope';
380
+ /**
381
+ * Read-only drawer that shows the full `DelegationDetail` ({ row, scope, status }).
382
+ */
383
+ declare class DelegationDetailDrawer implements OnInit {
384
+ readonly delegationId: _angular_core.InputSignal<number>;
385
+ private readonly facade;
386
+ private readonly transloco;
387
+ protected readonly ref: ModalRef;
388
+ protected readonly tabs: {
389
+ key: DetailTab;
390
+ i18n: string;
391
+ }[];
392
+ protected readonly activeTab: _angular_core.WritableSignal<DetailTab>;
393
+ protected readonly isLoading: _angular_core.Signal<boolean>;
394
+ protected readonly detail: _angular_core.Signal<_masterteam_delegations.DelegationDetail | null>;
395
+ protected readonly row: _angular_core.Signal<_masterteam_delegations.DelegationRow | null>;
396
+ ngOnInit(): void;
397
+ protected setTab(tab: DetailTab): void;
398
+ protected approvalLabel(): string;
399
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<DelegationDetailDrawer, never>;
400
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<DelegationDetailDrawer, "mt-delegation-detail-drawer", never, { "delegationId": { "alias": "delegationId"; "required": true; "isSignal": true; }; }, {}, never, never, true, never>;
401
+ }
402
+
403
+ interface TargetGroup {
404
+ key: string;
405
+ target: DelegationScopeTarget;
406
+ grants: DelegationGrant[];
407
+ }
408
+ /**
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.
413
+ *
414
+ * `[(scope)]` two-way binds a `DelegationScopeSelection`. The component never
415
+ * invents permission metadata — it only echoes grants returned by options.
416
+ */
417
+ declare class ScopePicker implements OnInit {
418
+ readonly scope: _angular_core.ModelSignal<DelegationScopeSelection>;
419
+ readonly readonly: _angular_core.InputSignal<boolean>;
420
+ readonly delegatorUserId: _angular_core.InputSignal<string | undefined>;
421
+ private readonly facade;
422
+ protected readonly options: _angular_core.Signal<DelegationScopeSelection | null>;
423
+ protected readonly preview: _angular_core.Signal<_masterteam_delegations.DelegationScopePreview | null>;
424
+ protected readonly isLoadingOptions: _angular_core.Signal<boolean>;
425
+ protected readonly isPreviewing: _angular_core.Signal<boolean>;
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>>;
430
+ private readonly expanded;
431
+ ngOnInit(): void;
432
+ constructor();
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;
438
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<ScopePicker, never>;
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>;
440
+ }
441
+
442
+ /**
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.
446
+ */
447
+ declare const appDelegationInterceptor: HttpInterceptorFn;
448
+
449
+ declare class GetMyDelegations {
450
+ query: DelegationListQuery;
451
+ static readonly type = "[Delegations] Get My Delegations";
452
+ constructor(query?: DelegationListQuery);
453
+ }
454
+ declare class GetAssignedDelegations {
455
+ query: DelegationListQuery;
456
+ static readonly type = "[Delegations] Get Assigned Delegations";
457
+ constructor(query?: DelegationListQuery);
458
+ }
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 {
465
+ id: number;
466
+ static readonly type = "[Delegations] Get Delegation Detail";
467
+ constructor(id: number);
468
+ }
469
+ declare class ClearDelegationDetail {
470
+ static readonly type = "[Delegations] Clear Delegation Detail";
471
+ }
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);
494
+ }
495
+ declare class UpdateDelegationLegacy {
496
+ id: number;
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);
506
+ }
507
+ declare class ApproveDelegation {
508
+ id: number;
509
+ request: ApproveDelegationRequest;
510
+ static readonly type = "[Delegations] Approve Delegation";
511
+ constructor(id: number, request: ApproveDelegationRequest);
512
+ }
513
+ declare class RejectDelegation {
514
+ id: number;
515
+ request: RejectDelegationRequest;
516
+ static readonly type = "[Delegations] Reject Delegation";
517
+ constructor(id: number, request: RejectDelegationRequest);
518
+ }
519
+ declare class CancelDelegation {
520
+ id: number;
521
+ rowVersion: string;
522
+ asAdmin: boolean;
523
+ static readonly type = "[Delegations] Cancel Delegation";
524
+ constructor(id: number, rowVersion: string, asAdmin?: boolean);
525
+ }
526
+
527
+ interface ApiErrorBody {
528
+ code: string;
529
+ message: string;
530
+ details?: Record<string, unknown> | null;
531
+ }
532
+ interface Response<T> {
533
+ endpoint: string;
534
+ status: number;
535
+ code: number;
536
+ locale: string;
537
+ message?: string | null;
538
+ errors?: ApiErrorBody | null;
539
+ data: T;
540
+ cacheSession?: string | null;
541
+ correlationId?: string | null;
542
+ }
543
+
544
+ declare class DelegationsState {
545
+ private http;
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;
550
+ static getScopeOptions(state: DelegationsStateModel): DelegationScopeOptions | null;
551
+ static getScopePreview(state: DelegationsStateModel): DelegationScopePreview | null;
552
+ static getLoadingActive(state: DelegationsStateModel): string[];
553
+ static getErrors(state: DelegationsStateModel): Record<string, string | null | undefined>;
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>>;
560
+ previewScope(ctx: StateContext<DelegationsStateModel>, { scope }: PreviewScope): rxjs.Observable<Response<DelegationScopePreview>>;
561
+ clearScopePreview(ctx: StateContext<DelegationsStateModel>): void;
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>>;
569
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<DelegationsState, never>;
570
+ static ɵprov: _angular_core.ɵɵInjectableDeclaration<DelegationsState>;
571
+ }
572
+
573
+ declare class DelegationsFacade {
574
+ private readonly store;
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>;
580
+ readonly scopePreview: _angular_core.Signal<_masterteam_delegations.DelegationScopePreview | null>;
581
+ private readonly loadingActive;
582
+ private readonly errors;
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[]>;
586
+ readonly isLoadingMy: _angular_core.Signal<boolean>;
587
+ readonly isLoadingAssigned: _angular_core.Signal<boolean>;
588
+ readonly isLoadingActive: _angular_core.Signal<boolean>;
589
+ readonly isLoadingDetail: _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>;
593
+ readonly isApproving: _angular_core.Signal<boolean>;
594
+ readonly isRejecting: _angular_core.Signal<boolean>;
595
+ readonly isCancelling: _angular_core.Signal<boolean>;
596
+ readonly errorMy: _angular_core.Signal<string | null>;
597
+ readonly errorAssigned: _angular_core.Signal<string | null>;
598
+ readonly errorDetail: _angular_core.Signal<string | null>;
599
+ readonly errorSave: _angular_core.Signal<string | null>;
600
+ getMy(query?: DelegationListQuery): rxjs.Observable<void>;
601
+ getAssigned(query?: DelegationListQuery): rxjs.Observable<void>;
602
+ getActive(query?: DelegationListQuery): rxjs.Observable<void>;
603
+ getDetail(id: number): rxjs.Observable<void>;
604
+ clearDetail(): rxjs.Observable<void>;
605
+ loadScopeOptions(delegatorUserId?: string): rxjs.Observable<void>;
606
+ previewScope(scope: DelegationScopeSelection): rxjs.Observable<void>;
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>;
615
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<DelegationsFacade, never>;
616
+ static ɵprov: _angular_core.ɵɵInjectableDeclaration<DelegationsFacade>;
617
+ }
618
+
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
+ */
627
+ interface ActiveDelegationSession {
628
+ token: string;
629
+ delegation: DelegationRow;
630
+ }
631
+ type DelegationSessionInvalidationReason = 'TokenInvalid' | 'SessionMismatch' | 'ScopeChanged' | 'Forbidden' | 'Logout' | 'UserSwitch' | 'Manual';
632
+ declare enum DelegationSessionActionKey {
633
+ LoadCandidates = "loadCandidates",
634
+ StartSession = "startSession"
635
+ }
636
+ interface DelegationSessionStateModel extends LoadingStateShape<DelegationSessionActionKey> {
637
+ active: ActiveDelegationSession | null;
638
+ candidates: DelegationRow[];
639
+ }
640
+
641
+ /** Fetch the active delegations the current user may start (user/activedelegations). */
642
+ declare class LoadDelegationCandidates {
643
+ static readonly type = "[DelegationSession] Load Candidates";
644
+ }
645
+ /** Start a delegated session for the given assignment row. */
646
+ declare class StartDelegationSession {
647
+ delegation: DelegationRow;
648
+ static readonly type = "[DelegationSession] Start";
649
+ constructor(delegation: DelegationRow);
650
+ }
651
+ /** End the current delegated session. Client-local only (doc 05). */
652
+ declare class EndDelegationSession {
653
+ reason: DelegationSessionInvalidationReason;
654
+ static readonly type = "[DelegationSession] End";
655
+ constructor(reason?: DelegationSessionInvalidationReason);
656
+ }
657
+ /** Switch directly from the current session to another delegation. */
658
+ declare class SwitchDelegationSession {
659
+ delegation: DelegationRow;
660
+ static readonly type = "[DelegationSession] Switch";
661
+ constructor(delegation: DelegationRow);
662
+ }
663
+
664
+ declare class DelegationSessionState {
665
+ private http;
666
+ private actions$;
667
+ private store;
668
+ constructor();
669
+ static getActive(state: DelegationSessionStateModel): ActiveDelegationSession | null;
670
+ static getCandidates(state: DelegationSessionStateModel): DelegationRow[];
671
+ static isDelegated(state: DelegationSessionStateModel): boolean;
672
+ static getLoadingActive(state: DelegationSessionStateModel): string[];
673
+ static getErrors(state: DelegationSessionStateModel): Record<string, string | null | undefined>;
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>;
678
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<DelegationSessionState, never>;
679
+ static ɵprov: _angular_core.ɵɵInjectableDeclaration<DelegationSessionState>;
680
+ }
681
+
682
+ declare class DelegationSessionFacade {
683
+ private readonly store;
684
+ readonly active: _angular_core.Signal<_masterteam_delegations.ActiveDelegationSession | null>;
685
+ readonly candidates: _angular_core.Signal<DelegationRow[]>;
686
+ readonly isDelegated: _angular_core.Signal<boolean>;
687
+ private readonly loadingActive;
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>;
694
+ readonly hasCandidates: _angular_core.Signal<boolean>;
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>;
701
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<DelegationSessionFacade, never>;
702
+ static ɵprov: _angular_core.ɵɵInjectableDeclaration<DelegationSessionFacade>;
225
703
  }
226
704
 
227
- export { AddDelegation, ClearSelectedDelegation, DelegationForm, Delegations, DelegationsActionKey, DelegationsFacade, DelegationsList, DelegationsState, DeleteDelegation, GetDelegation, GetDelegations, UpdateDelegation };
228
- export type { Delegation, DelegationDateTime, DelegationFormData, DelegationUser, DelegationsStateModel };
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 };