@masterteam/delegations 0.0.11 → 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,16 +1,281 @@
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';
3
- import * as _masterteam_delegations from '@masterteam/delegations';
4
+ import { Popover } from 'primeng/popover';
4
5
  import { TableAction, ColumnDef } from '@masterteam/components/table';
5
- import { ModalService } from '@masterteam/components/modal';
6
6
  import { FormControl } from '@angular/forms';
7
+ import { HttpContext, HttpInterceptorFn } from '@angular/common/http';
8
+ import { DynamicFormConfig } from '@masterteam/components';
7
9
  import { ModalRef } from '@masterteam/components/dialog';
8
- import * as _masterteam_components from '@masterteam/components';
9
- import { CrudStateBase, DynamicFormConfig } from '@masterteam/components';
10
- import { HttpContext } from '@angular/common/http';
10
+ import { ModalService } from '@masterteam/components/modal';
11
11
  import * as rxjs from 'rxjs';
12
12
  import { StateContext } from '@ngxs/store';
13
13
 
14
+ interface LoadingStateShape<L extends string = string> {
15
+ loadingActive: L[];
16
+ errors: Partial<Record<L, string>>;
17
+ }
18
+
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 {
24
+ userId: string;
25
+ displayName: string;
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;
133
+ description?: string;
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;
158
+ }
159
+ interface CreateDelegationLegacyRequest {
160
+ delegateFrom?: string | null;
161
+ delegateTo: string;
162
+ description?: string;
163
+ delegateFromDateTime: string;
164
+ delegateToDateTime: string;
165
+ accessibilityIds?: number[];
166
+ moduleIds?: number[];
167
+ delegationDaysType: DelegationDayRuleMode;
168
+ specificDays?: number[];
169
+ isActive?: boolean;
170
+ requiresApproval?: boolean;
171
+ }
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;
182
+ }
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;
192
+ }
193
+ interface RejectDelegationRequest {
194
+ rowVersion: string;
195
+ reason: string;
196
+ }
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"
209
+ }
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;
217
+ }
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>;
248
+ }
249
+
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>;
259
+ }
260
+
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>;
277
+ }
278
+
14
279
  declare class Delegations {
15
280
  private readonly router;
16
281
  goBack(): void;
@@ -18,15 +283,17 @@ declare class Delegations {
18
283
  static ɵcmp: _angular_core.ɵɵComponentDeclaration<Delegations, "mt-delegations", never, {}, {}, never, never, true, never>;
19
284
  }
20
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
+ */
21
292
  declare class DelegationsList implements OnInit {
22
- statusCol: _angular_core.Signal<TemplateRef<any>>;
23
- userCol: _angular_core.Signal<TemplateRef<any>>;
24
- userCol2: _angular_core.Signal<TemplateRef<any>>;
25
- daysCol: _angular_core.Signal<TemplateRef<any>>;
26
293
  private readonly facade;
27
- readonly modal: ModalService;
28
- private readonly translocoService;
29
- breadcrumbItems: _angular_core.WritableSignal<({
294
+ private readonly modal;
295
+ private readonly transloco;
296
+ protected readonly breadcrumbItems: _angular_core.WritableSignal<({
30
297
  label: string;
31
298
  icon: string;
32
299
  routerLink: string;
@@ -39,188 +306,401 @@ declare class DelegationsList implements OnInit {
39
306
  icon?: undefined;
40
307
  routerLink?: undefined;
41
308
  })[]>;
42
- delegations: _angular_core.Signal<_masterteam_delegations.Delegation[]>;
43
- tabs: _angular_core.WritableSignal<{
309
+ protected readonly activeTab: _angular_core.WritableSignal<DelegationTab>;
310
+ protected readonly tabs: _angular_core.WritableSignal<{
311
+ value: DelegationTab;
44
312
  label: string;
45
- value: string;
46
313
  }[]>;
47
- activeTab: _angular_core.WritableSignal<string>;
48
- tableActions: _angular_core.WritableSignal<TableAction[]>;
49
- deletingRowIds: _angular_core.WritableSignal<any[]>;
50
- rowActions: _angular_core.WritableSignal<TableAction[]>;
51
- tableColumns: _angular_core.WritableSignal<ColumnDef[]>;
52
- loading: _angular_core.Signal<boolean>;
53
- private allDelegations;
54
- private activeDelegations;
55
- 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;
324
+ private readonly weekdayKeys;
56
325
  ngOnInit(): void;
57
- 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;
58
338
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<DelegationsList, never>;
59
339
  static ɵcmp: _angular_core.ɵɵComponentDeclaration<DelegationsList, "mt-delegations-list", never, {}, {}, never, never, true, never>;
60
340
  }
61
341
 
62
- interface LoadingStateShape<L extends string = string> {
63
- loadingActive: L[];
64
- errors: Partial<Record<L, string>>;
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
+ */
350
+ declare class DelegationForm implements OnInit {
351
+ readonly delegationForEdit: _angular_core.InputSignal<DelegationRow | null>;
352
+ readonly readonly: _angular_core.InputSignal<boolean>;
353
+ private readonly halfWidth;
354
+ private readonly fullWidth;
355
+ modal: ModalService;
356
+ ref: ModalRef;
357
+ private readonly transloco;
358
+ private readonly facade;
359
+ delegationFormControl: FormControl<any>;
360
+ formValue: _angular_core.Signal<any>;
361
+ detail: _angular_core.Signal<_masterteam_delegations.DelegationDetail | null>;
362
+ isDetailLoading: _angular_core.Signal<boolean>;
363
+ isSaving: _angular_core.Signal<boolean>;
364
+ context: HttpContext;
365
+ protected readonly scope: _angular_core.WritableSignal<DelegationScopeSelection>;
366
+ protected readonly specificDaysOptions: _angular_core.WritableSignal<{
367
+ label: string;
368
+ value: number;
369
+ }[]>;
370
+ protected readonly formConfig: _angular_core.Signal<DynamicFormConfig>;
371
+ constructor();
372
+ ngOnInit(): void;
373
+ protected readonly canSubmit: _angular_core.Signal<boolean>;
374
+ onSubmit(): void;
375
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<DelegationForm, 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>;
65
377
  }
66
378
 
67
- interface DelegationUser {
68
- id: string;
69
- userId: string;
70
- displayName: string;
71
- mobile: string;
72
- userName: string;
73
- email: string;
74
- photo: string;
75
- }
76
- interface DelegationDateTime {
77
- displayValue: string;
78
- actualValue: string;
79
- }
80
- interface Delegation {
81
- id?: number;
82
- delegateFrom?: DelegationUser;
83
- delegateTo?: DelegationUser;
84
- delegateFromDateTime?: DelegationDateTime;
85
- delegateToDateTime?: DelegationDateTime;
86
- delegationStatus?: boolean;
87
- isActive?: boolean;
88
- description?: string;
89
- delegationDaysType?: 'fullRange' | 'specificDays';
90
- specificDays?: number[];
91
- }
92
- interface DelegationFormData {
93
- delegateTo: string;
94
- delegateFromDateTime: string;
95
- delegateToDateTime: string;
96
- delegateFrom: string;
97
- description?: string;
98
- delegationDaysType?: 'fullRange' | 'specificDays';
99
- specificDays?: number[];
100
- isActive?: boolean;
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>;
101
401
  }
102
- declare enum DelegationsActionKey {
103
- GetDelegations = "getDelegations",
104
- AddDelegation = "addDelegation",
105
- UpdateDelegation = "updateDelegation",
106
- DeleteDelegation = "deleteDelegation",
107
- GetDelegationForm = "getDelegationForm"
402
+
403
+ interface TargetGroup {
404
+ key: string;
405
+ target: DelegationScopeTarget;
406
+ grants: DelegationGrant[];
108
407
  }
109
- interface DelegationsStateModel extends LoadingStateShape<DelegationsActionKey> {
110
- allDelegations: Delegation[];
111
- selectedDelegation: Delegation | null;
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>;
112
440
  }
113
441
 
114
- declare class GetDelegations {
115
- static readonly type = "[Delegations] Get Delegations";
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);
116
453
  }
117
- declare class AddDelegation {
118
- delegation: DelegationFormData;
119
- static readonly type = "[Delegations] Add Delegation";
120
- constructor(delegation: DelegationFormData);
454
+ declare class GetAssignedDelegations {
455
+ query: DelegationListQuery;
456
+ static readonly type = "[Delegations] Get Assigned Delegations";
457
+ constructor(query?: DelegationListQuery);
121
458
  }
122
- declare class UpdateDelegation {
123
- id: number;
124
- delegation: DelegationFormData;
125
- static readonly type = "[Delegations] Update Delegation";
126
- constructor(id: number, delegation: DelegationFormData);
459
+ declare class GetActiveAssignedDelegations {
460
+ query: DelegationListQuery;
461
+ static readonly type = "[Delegations] Get Active Assigned Delegations";
462
+ constructor(query?: DelegationListQuery);
127
463
  }
128
- declare class DeleteDelegation {
464
+ declare class GetDelegationDetail {
129
465
  id: number;
130
- static readonly type = "[Delegations] Delete Delegation";
466
+ static readonly type = "[Delegations] Get Delegation Detail";
131
467
  constructor(id: number);
132
468
  }
133
- declare class GetDelegation {
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 {
134
496
  id: number;
135
- static readonly type = "[Delegations] Get Delegation";
136
- constructor(id: number);
497
+ request: UpdateDelegationLegacyRequest;
498
+ static readonly type = "[Delegations] Update Delegation (legacy)";
499
+ constructor(id: number, request: UpdateDelegationLegacyRequest);
137
500
  }
138
- declare class ClearSelectedDelegation {
139
- static readonly type = "[Delegations] Clear Selected Delegation";
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);
140
525
  }
141
526
 
527
+ interface ApiErrorBody {
528
+ code: string;
529
+ message: string;
530
+ details?: Record<string, unknown> | null;
531
+ }
142
532
  interface Response<T> {
143
533
  endpoint: string;
144
534
  status: number;
145
535
  code: number;
146
536
  locale: string;
147
537
  message?: string | null;
148
- errors?: any | null;
538
+ errors?: ApiErrorBody | null;
149
539
  data: T;
150
- cacheSession?: string;
540
+ cacheSession?: string | null;
541
+ correlationId?: string | null;
151
542
  }
152
543
 
153
- declare class DelegationsState extends CrudStateBase<Delegation, DelegationsStateModel, DelegationsActionKey> {
544
+ declare class DelegationsState {
154
545
  private http;
155
- static getAllDelegations(state: DelegationsStateModel): Delegation[];
156
- static getSelectedDelegation(state: DelegationsStateModel): Delegation | 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;
550
+ static getScopeOptions(state: DelegationsStateModel): DelegationScopeOptions | null;
551
+ static getScopePreview(state: DelegationsStateModel): DelegationScopePreview | null;
157
552
  static getLoadingActive(state: DelegationsStateModel): string[];
158
- static getErrors(state: DelegationsStateModel): Record<string, string | null>;
159
- getDelegations(ctx: StateContext<DelegationsStateModel>): rxjs.Observable<Response<Delegation[]>>;
160
- getDelegation(ctx: StateContext<DelegationsStateModel>, { id }: GetDelegation): rxjs.Observable<Response<Delegation>>;
161
- addDelegation(ctx: StateContext<DelegationsStateModel>, { delegation }: AddDelegation): rxjs.Observable<_masterteam_components.Response<Delegation>>;
162
- updateDelegation(ctx: StateContext<DelegationsStateModel>, { id, delegation }: UpdateDelegation): rxjs.Observable<_masterteam_components.Response<Delegation>>;
163
- deleteDelegation(ctx: StateContext<DelegationsStateModel>, { id }: DeleteDelegation): rxjs.Observable<_masterteam_components.Response<void>>;
164
- clearSelectedDelegation(ctx: StateContext<DelegationsStateModel>): void;
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>>;
165
569
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<DelegationsState, never>;
166
570
  static ɵprov: _angular_core.ɵɵInjectableDeclaration<DelegationsState>;
167
571
  }
168
572
 
169
573
  declare class DelegationsFacade {
170
574
  private readonly store;
171
- readonly allDelegations: _angular_core.Signal<_masterteam_delegations.Delegation[]>;
172
- readonly selectedDelegation: _angular_core.Signal<_masterteam_delegations.Delegation | 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>;
580
+ readonly scopePreview: _angular_core.Signal<_masterteam_delegations.DelegationScopePreview | null>;
173
581
  private readonly loadingActive;
174
582
  private readonly errors;
175
- readonly isLoadingDelegations: _angular_core.Signal<boolean>;
176
- readonly isLoadingDelegation: _angular_core.Signal<boolean>;
177
- readonly isAddingDelegation: _angular_core.Signal<boolean>;
178
- readonly isUpdatingDelegation: _angular_core.Signal<boolean>;
179
- readonly isDeletingDelegation: _angular_core.Signal<boolean>;
180
- readonly delegationsError: _angular_core.Signal<string | null>;
181
- readonly delegationError: _angular_core.Signal<string | null>;
182
- readonly addDelegationError: _angular_core.Signal<string | null>;
183
- readonly updateDelegationError: _angular_core.Signal<string | null>;
184
- readonly deleteDelegationError: _angular_core.Signal<string | null>;
185
- readonly activeDelegations: _angular_core.Signal<_masterteam_delegations.Delegation[]>;
186
- readonly inactiveDelegations: _angular_core.Signal<_masterteam_delegations.Delegation[]>;
187
- getDelegations(): rxjs.Observable<void>;
188
- addDelegation(delegation: DelegationFormData): rxjs.Observable<void>;
189
- updateDelegation(id: number, delegation: DelegationFormData): rxjs.Observable<void>;
190
- deleteDelegation(id: number): rxjs.Observable<void>;
191
- loadDelegation(id: number): rxjs.Observable<void>;
192
- clearSelectedDelegation(): rxjs.Observable<void>;
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>;
193
615
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<DelegationsFacade, never>;
194
616
  static ɵprov: _angular_core.ɵɵInjectableDeclaration<DelegationsFacade>;
195
617
  }
196
618
 
197
- declare class DelegationForm implements OnInit {
198
- private readonly halfWidthFieldClass;
199
- private readonly fullWidthFieldClass;
200
- modal: ModalService;
201
- ref: ModalRef;
202
- delegationForEdit: _angular_core.InputSignal<Delegation | null>;
203
- private readonly translocoService;
204
- private readonly facade;
205
- selectedDelegation: _angular_core.Signal<Delegation | null>;
206
- delegationFormControl: FormControl<any>;
207
- formValue: _angular_core.Signal<any>;
208
- getDelegationFormLoading: _angular_core.Signal<boolean>;
209
- isAddingDelegation: _angular_core.Signal<boolean>;
210
- isUpdatingDelegation: _angular_core.Signal<boolean>;
211
- context: HttpContext;
212
- isDelegatingToSelf: _angular_core.Signal<boolean>;
213
- specificDaysOptions: _angular_core.WritableSignal<{
214
- label: string;
215
- value: number;
216
- }[]>;
217
- delegationFormConfig: _angular_core.Signal<DynamicFormConfig>;
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;
218
668
  constructor();
219
- ngOnInit(): void;
220
- onSubmit(): void;
221
- static ɵfac: _angular_core.ɵɵFactoryDeclaration<DelegationForm, never>;
222
- static ɵcmp: _angular_core.ɵɵComponentDeclaration<DelegationForm, "mt-delegation-form", never, { "delegationForEdit": { "alias": "delegationForEdit"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
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>;
223
703
  }
224
704
 
225
- export { AddDelegation, ClearSelectedDelegation, DelegationForm, Delegations, DelegationsActionKey, DelegationsFacade, DelegationsList, DelegationsState, DeleteDelegation, GetDelegation, GetDelegations, UpdateDelegation };
226
- 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 };