@masterteam/delegations 0.0.18 → 0.0.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@masterteam/delegations",
3
- "version": "0.0.18",
3
+ "version": "0.0.20",
4
4
  "publishConfig": {
5
5
  "directory": "../../../dist/masterteam/delegations",
6
6
  "linkDirectory": false,
@@ -21,8 +21,8 @@
21
21
  "tailwindcss-primeui": "^0.6.1",
22
22
  "@ngxs/store": "^20.1.0",
23
23
  "@masterteam/components": "^0.0.175",
24
- "@masterteam/forms": "^0.0.80",
25
- "@masterteam/icons": "^0.0.15"
24
+ "@masterteam/icons": "^0.0.15",
25
+ "@masterteam/forms": "^0.0.80"
26
26
  },
27
27
  "sideEffects": false,
28
28
  "exports": {
@@ -2,6 +2,7 @@ import * as _masterteam_delegations from '@masterteam/delegations';
2
2
  import * as _angular_core from '@angular/core';
3
3
  import { OnInit, TemplateRef } from '@angular/core';
4
4
  import { Popover } from 'primeng/popover';
5
+ import { PageHeaderTab } from '@masterteam/components/page-header';
5
6
  import { TableAction, ColumnDef } from '@masterteam/components/table';
6
7
  import { FormControl } from '@angular/forms';
7
8
  import { HttpContext, HttpInterceptorFn } from '@angular/common/http';
@@ -20,6 +21,13 @@ type DelegationEffectiveStatus = 'PendingApproval' | 'Scheduled' | 'Active' | 'I
20
21
  type DelegationApprovalStatus = 'NotRequired' | 'Pending' | 'Approved' | 'Rejected';
21
22
  type DelegationAllowedAction = 'View' | 'Edit' | 'Approve' | 'Reject' | 'Cancel' | 'StartSession' | 'EndSession';
22
23
  type DelegationDayRuleMode = 'FullRange' | 'SpecificDays';
24
+ type DelegationDisplayValue = string | {
25
+ ar?: string | null;
26
+ en?: string | null;
27
+ defaultAr?: string | null;
28
+ defaultEn?: string | null;
29
+ [locale: string]: unknown;
30
+ } | null;
23
31
  interface DelegationParty {
24
32
  userId: string;
25
33
  displayName: string;
@@ -50,7 +58,7 @@ interface DelegationRow {
50
58
  approval: DelegationApprovalInfo;
51
59
  cancellation: DelegationCancellationInfo;
52
60
  allowedActions: DelegationAllowedAction[];
53
- scopeSummary: string;
61
+ scopeSummary: DelegationDisplayValue;
54
62
  rowVersion: string;
55
63
  }
56
64
  interface DelegationPage<T> {
@@ -71,38 +79,73 @@ interface DelegationScopeTarget {
71
79
  moduleKey?: string | null;
72
80
  permissionModuleType?: string | null;
73
81
  permissionTargetId?: number | null;
74
- displayName?: string | null;
82
+ displayName?: DelegationDisplayValue;
83
+ displayLabel?: DelegationDisplayValue;
84
+ label?: DelegationDisplayValue;
75
85
  }
76
86
  interface DelegationScopeAction {
77
87
  applicationKey: string;
78
88
  operationKey: string;
79
89
  operationKind: string;
80
- displayName?: string | null;
81
- displayLabel?: string | null;
82
- operationDisplayName?: string | null;
83
- operationLabel?: string | null;
84
- label?: string | null;
90
+ displayName?: DelegationDisplayValue;
91
+ displayLabel?: DelegationDisplayValue;
92
+ operationDisplayName?: DelegationDisplayValue;
93
+ operationLabel?: DelegationDisplayValue;
94
+ label?: DelegationDisplayValue;
85
95
  permissionCommand?: string | null;
86
96
  businessActionCode?: string | null;
87
97
  isHighRisk?: boolean;
88
98
  isDelegableSnapshot?: boolean;
89
99
  }
100
+ interface DelegationScopeFact {
101
+ key?: string | null;
102
+ code?: string | null;
103
+ id?: string | number | null;
104
+ displayName?: DelegationDisplayValue;
105
+ displayLabel?: DelegationDisplayValue;
106
+ label?: DelegationDisplayValue;
107
+ [extra: string]: unknown;
108
+ }
90
109
  interface DelegationGrant {
91
110
  /** Optional backend-provided stable grant identity; preferred for de-dup when present. */
92
111
  key?: string;
93
112
  applicationKey: string;
94
113
  target: DelegationScopeTarget;
95
114
  action: DelegationScopeAction;
96
- accessibilities: unknown[];
97
- dataFilters: unknown[];
98
- constraints: unknown[];
115
+ accessibilities: DelegationScopeFact[];
116
+ dataFilters: DelegationScopeFact[];
117
+ constraints: DelegationScopeFact[];
99
118
  }
100
119
  interface DelegationScopeSelection {
101
120
  grants: DelegationGrant[];
102
121
  metadata: Record<string, unknown>;
103
122
  }
104
- /** `scope/options` returns the grantable set in the same grants shape. */
105
- type DelegationScopeOptions = DelegationScopeSelection;
123
+ interface DelegationScopeCombinationRule {
124
+ applicationKey?: string | null;
125
+ targetType: string;
126
+ targetKey: string;
127
+ operationKey: string;
128
+ accessibilityKeys?: string[] | null;
129
+ dataFilterKeys?: string[] | null;
130
+ constraintKeys?: string[] | null;
131
+ [extra: string]: unknown;
132
+ }
133
+ /**
134
+ * `scope/options` may come back either as legacy `grants[]` or as the newer
135
+ * catalog facts (`targets + operations + combinationRules`).
136
+ */
137
+ interface DelegationScopeOptions {
138
+ grants?: DelegationGrant[] | null;
139
+ metadata?: Record<string, unknown>;
140
+ targets?: DelegationScopeTarget[] | null;
141
+ operations?: DelegationScopeAction[] | null;
142
+ accessibilities?: DelegationScopeFact[] | null;
143
+ presets?: Record<string, unknown>[] | null;
144
+ combinationRules?: DelegationScopeCombinationRule[] | null;
145
+ nonDelegableOperations?: (string | DelegationScopeFact)[] | null;
146
+ dataFilters?: DelegationScopeFact[] | null;
147
+ constraints?: DelegationScopeFact[] | null;
148
+ }
106
149
  interface DelegationScopeWarning {
107
150
  code?: string;
108
151
  message: string;
@@ -119,7 +162,7 @@ interface DelegationScopePreview {
119
162
  isValid: boolean;
120
163
  normalizedScope: DelegationScopeSelection;
121
164
  scopeHash: string;
122
- summary: string;
165
+ summary: DelegationDisplayValue;
123
166
  warnings: DelegationScopeWarning[];
124
167
  deniedItems: DelegationScopeDeniedItem[];
125
168
  }
@@ -245,6 +288,7 @@ declare class TopbarDelegationMenu {
245
288
  protected readonly onBehalfOf: _angular_core.Signal<_masterteam_delegations.DelegationParty | null>;
246
289
  protected readonly executedBy: _angular_core.Signal<_masterteam_delegations.DelegationParty | null>;
247
290
  protected readonly mode: _angular_core.Signal<"active" | "candidates" | "hidden">;
291
+ protected formatScopeSummary(summary: DelegationRow['scopeSummary']): string;
248
292
  togglePopover(event: Event): void;
249
293
  start(row: DelegationRow, event: MouseEvent): void;
250
294
  switchTo(row: DelegationRow, event: MouseEvent): void;
@@ -279,6 +323,7 @@ declare class StartSessionDialog {
279
323
  private readonly transloco;
280
324
  protected readonly isBusy: _angular_core.Signal<boolean>;
281
325
  protected readonly bodyKey: _angular_core.Signal<"delegations.session.switchConfirmBody" | "delegations.session.startConfirmBody">;
326
+ protected formatScopeSummary(summary: DelegationRow['scopeSummary']): string;
282
327
  confirm(): void;
283
328
  cancel(): void;
284
329
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<StartSessionDialog, never>;
@@ -306,9 +351,18 @@ declare class RejectDelegationDialog {
306
351
  static ɵcmp: _angular_core.ɵɵComponentDeclaration<RejectDelegationDialog, "mt-reject-delegation-dialog", never, { "delegation": { "alias": "delegation"; "required": true; "isSignal": true; }; }, {}, never, never, true, never>;
307
352
  }
308
353
 
309
- declare class Delegations {
354
+ declare class Delegations implements OnInit {
355
+ private readonly route;
310
356
  private readonly router;
357
+ private readonly transloco;
358
+ protected readonly tabs: _angular_core.WritableSignal<PageHeaderTab[]>;
359
+ protected readonly activeTab: _angular_core.WritableSignal<string>;
360
+ constructor();
361
+ ngOnInit(): void;
311
362
  goBack(): void;
363
+ protected onTabChange(value: string | number): void;
364
+ private syncSelectedTabFromRoute;
365
+ private getRouteTabs;
312
366
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<Delegations, never>;
313
367
  static ɵcmp: _angular_core.ɵɵComponentDeclaration<Delegations, "mt-delegations", never, {}, {}, never, never, true, never>;
314
368
  }
@@ -356,7 +410,7 @@ declare class DelegationsList implements OnInit {
356
410
  label: string;
357
411
  }[]>;
358
412
  protected readonly isLoading: _angular_core.Signal<boolean>;
359
- protected readonly scopeOptions: _angular_core.Signal<_masterteam_delegations.DelegationScopeSelection | null>;
413
+ protected readonly scopeOptions: _angular_core.Signal<_masterteam_delegations.DelegationScopeOptions | null>;
360
414
  protected readonly rows: _angular_core.Signal<DelegationRow[]>;
361
415
  statusCol: _angular_core.Signal<TemplateRef<unknown>>;
362
416
  userCol: _angular_core.Signal<TemplateRef<unknown>>;
@@ -374,6 +428,7 @@ declare class DelegationsList implements OnInit {
374
428
  private reloadCurrentTab;
375
429
  protected has(row: DelegationRow, action: DelegationAllowedAction): boolean;
376
430
  protected formatDays(row: DelegationRow): string;
431
+ protected formatScopeSummary(value: DelegationRow['scopeSummary']): string;
377
432
  private viewDetails;
378
433
  private openForm;
379
434
  private approve;
@@ -456,6 +511,7 @@ declare class DelegationDetailDrawer implements OnInit {
456
511
  protected approvalLabel(): string;
457
512
  protected getScopeTargetLabel(target: DelegationScopeTarget): string;
458
513
  protected getScopeActionLabel(action: DelegationScopeAction): string;
514
+ protected formatScopeSummary(summary: DelegationDisplayValue | undefined): string;
459
515
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<DelegationDetailDrawer, never>;
460
516
  static ɵcmp: _angular_core.ɵɵComponentDeclaration<DelegationDetailDrawer, "mt-delegation-detail-drawer", never, { "delegationId": { "alias": "delegationId"; "required": true; "isSignal": true; }; }, {}, never, never, true, never>;
461
517
  }
@@ -484,7 +540,8 @@ declare class ScopePicker {
484
540
  */
485
541
  readonly delegatorUserId: _angular_core.InputSignal<string | undefined>;
486
542
  private readonly facade;
487
- protected readonly options: _angular_core.Signal<DelegationScopeSelection | null>;
543
+ private readonly transloco;
544
+ protected readonly options: _angular_core.Signal<_masterteam_delegations.DelegationScopeOptions | null>;
488
545
  protected readonly preview: _angular_core.Signal<_masterteam_delegations.DelegationScopePreview | null>;
489
546
  protected readonly isLoadingOptions: _angular_core.Signal<boolean>;
490
547
  protected readonly isPreviewing: _angular_core.Signal<boolean>;
@@ -500,10 +557,12 @@ declare class ScopePicker {
500
557
  protected isSelected(grant: DelegationGrant): boolean;
501
558
  protected getTargetLabel(target: DelegationScopeTarget): string;
502
559
  protected getActionLabel(grant: DelegationGrant): string;
560
+ protected getPreviewSummary(summary: DelegationDisplayValue | undefined): string;
503
561
  protected formatDeniedOperation(value?: string | null): string;
504
562
  protected formatDeniedTarget(value?: string | null): string;
505
563
  protected toggleGrant(grant: DelegationGrant): void;
506
564
  protected selectedCount(group: TargetGroup): number;
565
+ private currentLanguage;
507
566
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<ScopePicker, never>;
508
567
  static ɵcmp: _angular_core.ɵɵComponentDeclaration<ScopePicker, "mt-scope-picker", never, { "scope": { "alias": "scope"; "required": false; "isSignal": true; }; "readonly": { "alias": "readonly"; "required": false; "isSignal": true; }; "delegatorUserId": { "alias": "delegatorUserId"; "required": false; "isSignal": true; }; }, { "scope": "scopeChange"; }, never, never, true, never>;
509
568
  }
@@ -625,7 +684,7 @@ declare class DelegationsState {
625
684
  getActive(ctx: StateContext<DelegationsStateModel>, { query }: GetActiveAssignedDelegations): rxjs.Observable<Response<DelegationPage<DelegationRow>>>;
626
685
  getDetail(ctx: StateContext<DelegationsStateModel>, { id }: GetDelegationDetail): rxjs.Observable<Response<DelegationDetail>>;
627
686
  clearDetail(ctx: StateContext<DelegationsStateModel>): void;
628
- getScopeOptions(ctx: StateContext<DelegationsStateModel>, { delegatorUserId }: GetScopeOptions): rxjs.Observable<Response<_masterteam_delegations.DelegationScopeSelection>>;
687
+ getScopeOptions(ctx: StateContext<DelegationsStateModel>, { delegatorUserId }: GetScopeOptions): rxjs.Observable<Response<DelegationScopeOptions>>;
629
688
  previewScope(ctx: StateContext<DelegationsStateModel>, { scope }: PreviewScope): rxjs.Observable<Response<DelegationScopePreview>>;
630
689
  clearScopePreview(ctx: StateContext<DelegationsStateModel>): void;
631
690
  createLegacy(ctx: StateContext<DelegationsStateModel>, { request }: CreateDelegationLegacy): rxjs.Observable<Response<DelegationDto>>;
@@ -645,7 +704,7 @@ declare class DelegationsFacade {
645
704
  readonly assignedPage: _angular_core.Signal<_masterteam_delegations.DelegationPage<_masterteam_delegations.DelegationRow> | null>;
646
705
  readonly activePage: _angular_core.Signal<_masterteam_delegations.DelegationPage<_masterteam_delegations.DelegationRow> | null>;
647
706
  readonly detail: _angular_core.Signal<_masterteam_delegations.DelegationDetail | null>;
648
- readonly scopeOptions: _angular_core.Signal<DelegationScopeSelection | null>;
707
+ readonly scopeOptions: _angular_core.Signal<_masterteam_delegations.DelegationScopeOptions | null>;
649
708
  readonly scopePreview: _angular_core.Signal<_masterteam_delegations.DelegationScopePreview | null>;
650
709
  private readonly loadingActive;
651
710
  private readonly errors;
@@ -773,4 +832,4 @@ declare class DelegationSessionFacade {
773
832
  }
774
833
 
775
834
  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, RejectDelegationDialog, ScopePicker, StartDelegationSession, StartSessionDialog, SwitchDelegationSession, TopbarDelegationMenu, UpdateDelegationLegacy, UpdateDelegationV2, appDelegationInterceptor };
776
- 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 };
835
+ export type { ActiveDelegationSession, ApproveDelegationRequest, CreateDelegationLegacyRequest, CreateDelegationV2Request, DelegationAllowedAction, DelegationApprovalInfo, DelegationApprovalStatus, DelegationCancellationInfo, DelegationDayRuleMode, DelegationDetail, DelegationDisplayValue, DelegationDto, DelegationEffectiveStatus, DelegationGrant, DelegationListQuery, DelegationPage, DelegationParty, DelegationRow, DelegationScopeAction, DelegationScopeCombinationRule, DelegationScopeDeniedItem, DelegationScopeFact, DelegationScopeOptions, DelegationScopePreview, DelegationScopeSelection, DelegationScopeTarget, DelegationScopeWarning, DelegationSessionInvalidationReason, DelegationSessionStateModel, DelegationSortDirection, DelegationStatusInfo, DelegationsStateModel, RejectDelegationRequest, UpdateDelegationLegacyRequest, UpdateDelegationV2Request };