@masterteam/delegations 0.0.17 → 0.0.19

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.17",
3
+ "version": "0.0.19",
4
4
  "publishConfig": {
5
5
  "directory": "../../../dist/masterteam/delegations",
6
6
  "linkDirectory": false,
@@ -20,9 +20,9 @@
20
20
  "tailwindcss": "^4.2.2",
21
21
  "tailwindcss-primeui": "^0.6.1",
22
22
  "@ngxs/store": "^20.1.0",
23
+ "@masterteam/components": "^0.0.175",
23
24
  "@masterteam/icons": "^0.0.15",
24
- "@masterteam/forms": "^0.0.80",
25
- "@masterteam/components": "^0.0.174"
25
+ "@masterteam/forms": "^0.0.80"
26
26
  },
27
27
  "sideEffects": false,
28
28
  "exports": {
@@ -20,6 +20,13 @@ type DelegationEffectiveStatus = 'PendingApproval' | 'Scheduled' | 'Active' | 'I
20
20
  type DelegationApprovalStatus = 'NotRequired' | 'Pending' | 'Approved' | 'Rejected';
21
21
  type DelegationAllowedAction = 'View' | 'Edit' | 'Approve' | 'Reject' | 'Cancel' | 'StartSession' | 'EndSession';
22
22
  type DelegationDayRuleMode = 'FullRange' | 'SpecificDays';
23
+ type DelegationDisplayValue = string | {
24
+ ar?: string | null;
25
+ en?: string | null;
26
+ defaultAr?: string | null;
27
+ defaultEn?: string | null;
28
+ [locale: string]: unknown;
29
+ } | null;
23
30
  interface DelegationParty {
24
31
  userId: string;
25
32
  displayName: string;
@@ -50,7 +57,7 @@ interface DelegationRow {
50
57
  approval: DelegationApprovalInfo;
51
58
  cancellation: DelegationCancellationInfo;
52
59
  allowedActions: DelegationAllowedAction[];
53
- scopeSummary: string;
60
+ scopeSummary: DelegationDisplayValue;
54
61
  rowVersion: string;
55
62
  }
56
63
  interface DelegationPage<T> {
@@ -71,33 +78,73 @@ interface DelegationScopeTarget {
71
78
  moduleKey?: string | null;
72
79
  permissionModuleType?: string | null;
73
80
  permissionTargetId?: number | null;
74
- displayName?: string | null;
81
+ displayName?: DelegationDisplayValue;
82
+ displayLabel?: DelegationDisplayValue;
83
+ label?: DelegationDisplayValue;
75
84
  }
76
85
  interface DelegationScopeAction {
77
86
  applicationKey: string;
78
87
  operationKey: string;
79
88
  operationKind: string;
89
+ displayName?: DelegationDisplayValue;
90
+ displayLabel?: DelegationDisplayValue;
91
+ operationDisplayName?: DelegationDisplayValue;
92
+ operationLabel?: DelegationDisplayValue;
93
+ label?: DelegationDisplayValue;
80
94
  permissionCommand?: string | null;
81
95
  businessActionCode?: string | null;
82
96
  isHighRisk?: boolean;
83
97
  isDelegableSnapshot?: boolean;
84
98
  }
99
+ interface DelegationScopeFact {
100
+ key?: string | null;
101
+ code?: string | null;
102
+ id?: string | number | null;
103
+ displayName?: DelegationDisplayValue;
104
+ displayLabel?: DelegationDisplayValue;
105
+ label?: DelegationDisplayValue;
106
+ [extra: string]: unknown;
107
+ }
85
108
  interface DelegationGrant {
86
109
  /** Optional backend-provided stable grant identity; preferred for de-dup when present. */
87
110
  key?: string;
88
111
  applicationKey: string;
89
112
  target: DelegationScopeTarget;
90
113
  action: DelegationScopeAction;
91
- accessibilities: unknown[];
92
- dataFilters: unknown[];
93
- constraints: unknown[];
114
+ accessibilities: DelegationScopeFact[];
115
+ dataFilters: DelegationScopeFact[];
116
+ constraints: DelegationScopeFact[];
94
117
  }
95
118
  interface DelegationScopeSelection {
96
119
  grants: DelegationGrant[];
97
120
  metadata: Record<string, unknown>;
98
121
  }
99
- /** `scope/options` returns the grantable set in the same grants shape. */
100
- type DelegationScopeOptions = DelegationScopeSelection;
122
+ interface DelegationScopeCombinationRule {
123
+ applicationKey?: string | null;
124
+ targetType: string;
125
+ targetKey: string;
126
+ operationKey: string;
127
+ accessibilityKeys?: string[] | null;
128
+ dataFilterKeys?: string[] | null;
129
+ constraintKeys?: string[] | null;
130
+ [extra: string]: unknown;
131
+ }
132
+ /**
133
+ * `scope/options` may come back either as legacy `grants[]` or as the newer
134
+ * catalog facts (`targets + operations + combinationRules`).
135
+ */
136
+ interface DelegationScopeOptions {
137
+ grants?: DelegationGrant[] | null;
138
+ metadata?: Record<string, unknown>;
139
+ targets?: DelegationScopeTarget[] | null;
140
+ operations?: DelegationScopeAction[] | null;
141
+ accessibilities?: DelegationScopeFact[] | null;
142
+ presets?: Record<string, unknown>[] | null;
143
+ combinationRules?: DelegationScopeCombinationRule[] | null;
144
+ nonDelegableOperations?: (string | DelegationScopeFact)[] | null;
145
+ dataFilters?: DelegationScopeFact[] | null;
146
+ constraints?: DelegationScopeFact[] | null;
147
+ }
101
148
  interface DelegationScopeWarning {
102
149
  code?: string;
103
150
  message: string;
@@ -114,7 +161,7 @@ interface DelegationScopePreview {
114
161
  isValid: boolean;
115
162
  normalizedScope: DelegationScopeSelection;
116
163
  scopeHash: string;
117
- summary: string;
164
+ summary: DelegationDisplayValue;
118
165
  warnings: DelegationScopeWarning[];
119
166
  deniedItems: DelegationScopeDeniedItem[];
120
167
  }
@@ -240,6 +287,7 @@ declare class TopbarDelegationMenu {
240
287
  protected readonly onBehalfOf: _angular_core.Signal<_masterteam_delegations.DelegationParty | null>;
241
288
  protected readonly executedBy: _angular_core.Signal<_masterteam_delegations.DelegationParty | null>;
242
289
  protected readonly mode: _angular_core.Signal<"active" | "candidates" | "hidden">;
290
+ protected formatScopeSummary(summary: DelegationRow['scopeSummary']): string;
243
291
  togglePopover(event: Event): void;
244
292
  start(row: DelegationRow, event: MouseEvent): void;
245
293
  switchTo(row: DelegationRow, event: MouseEvent): void;
@@ -270,8 +318,11 @@ declare class StartSessionDialog {
270
318
  readonly intent: _angular_core.InputSignal<"start" | "switch">;
271
319
  private readonly ref;
272
320
  private readonly facade;
321
+ private readonly toast;
322
+ private readonly transloco;
273
323
  protected readonly isBusy: _angular_core.Signal<boolean>;
274
324
  protected readonly bodyKey: _angular_core.Signal<"delegations.session.switchConfirmBody" | "delegations.session.startConfirmBody">;
325
+ protected formatScopeSummary(summary: DelegationRow['scopeSummary']): string;
275
326
  confirm(): void;
276
327
  cancel(): void;
277
328
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<StartSessionDialog, never>;
@@ -349,7 +400,7 @@ declare class DelegationsList implements OnInit {
349
400
  label: string;
350
401
  }[]>;
351
402
  protected readonly isLoading: _angular_core.Signal<boolean>;
352
- protected readonly scopeOptions: _angular_core.Signal<_masterteam_delegations.DelegationScopeSelection | null>;
403
+ protected readonly scopeOptions: _angular_core.Signal<_masterteam_delegations.DelegationScopeOptions | null>;
353
404
  protected readonly rows: _angular_core.Signal<DelegationRow[]>;
354
405
  statusCol: _angular_core.Signal<TemplateRef<unknown>>;
355
406
  userCol: _angular_core.Signal<TemplateRef<unknown>>;
@@ -367,6 +418,7 @@ declare class DelegationsList implements OnInit {
367
418
  private reloadCurrentTab;
368
419
  protected has(row: DelegationRow, action: DelegationAllowedAction): boolean;
369
420
  protected formatDays(row: DelegationRow): string;
421
+ protected formatScopeSummary(value: DelegationRow['scopeSummary']): string;
370
422
  private viewDetails;
371
423
  private openForm;
372
424
  private approve;
@@ -447,6 +499,9 @@ declare class DelegationDetailDrawer implements OnInit {
447
499
  ngOnInit(): void;
448
500
  protected setTab(tab: DetailTab): void;
449
501
  protected approvalLabel(): string;
502
+ protected getScopeTargetLabel(target: DelegationScopeTarget): string;
503
+ protected getScopeActionLabel(action: DelegationScopeAction): string;
504
+ protected formatScopeSummary(summary: DelegationDisplayValue | undefined): string;
450
505
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<DelegationDetailDrawer, never>;
451
506
  static ɵcmp: _angular_core.ɵɵComponentDeclaration<DelegationDetailDrawer, "mt-delegation-detail-drawer", never, { "delegationId": { "alias": "delegationId"; "required": true; "isSignal": true; }; }, {}, never, never, true, never>;
452
507
  }
@@ -475,10 +530,12 @@ declare class ScopePicker {
475
530
  */
476
531
  readonly delegatorUserId: _angular_core.InputSignal<string | undefined>;
477
532
  private readonly facade;
478
- protected readonly options: _angular_core.Signal<DelegationScopeSelection | null>;
533
+ private readonly transloco;
534
+ protected readonly options: _angular_core.Signal<_masterteam_delegations.DelegationScopeOptions | null>;
479
535
  protected readonly preview: _angular_core.Signal<_masterteam_delegations.DelegationScopePreview | null>;
480
536
  protected readonly isLoadingOptions: _angular_core.Signal<boolean>;
481
537
  protected readonly isPreviewing: _angular_core.Signal<boolean>;
538
+ protected readonly errorOptions: _angular_core.Signal<string | null>;
482
539
  /** Grantable options grouped by target. */
483
540
  protected readonly groups: _angular_core.Signal<TargetGroup[]>;
484
541
  /** Selected grant keys for O(1) checkbox state. */
@@ -488,8 +545,14 @@ declare class ScopePicker {
488
545
  protected isExpanded(group: TargetGroup): boolean;
489
546
  protected toggleAccordion(group: TargetGroup): void;
490
547
  protected isSelected(grant: DelegationGrant): boolean;
548
+ protected getTargetLabel(target: DelegationScopeTarget): string;
549
+ protected getActionLabel(grant: DelegationGrant): string;
550
+ protected getPreviewSummary(summary: DelegationDisplayValue | undefined): string;
551
+ protected formatDeniedOperation(value?: string | null): string;
552
+ protected formatDeniedTarget(value?: string | null): string;
491
553
  protected toggleGrant(grant: DelegationGrant): void;
492
554
  protected selectedCount(group: TargetGroup): number;
555
+ private currentLanguage;
493
556
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<ScopePicker, never>;
494
557
  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>;
495
558
  }
@@ -611,7 +674,7 @@ declare class DelegationsState {
611
674
  getActive(ctx: StateContext<DelegationsStateModel>, { query }: GetActiveAssignedDelegations): rxjs.Observable<Response<DelegationPage<DelegationRow>>>;
612
675
  getDetail(ctx: StateContext<DelegationsStateModel>, { id }: GetDelegationDetail): rxjs.Observable<Response<DelegationDetail>>;
613
676
  clearDetail(ctx: StateContext<DelegationsStateModel>): void;
614
- getScopeOptions(ctx: StateContext<DelegationsStateModel>, { delegatorUserId }: GetScopeOptions): rxjs.Observable<Response<_masterteam_delegations.DelegationScopeSelection>>;
677
+ getScopeOptions(ctx: StateContext<DelegationsStateModel>, { delegatorUserId }: GetScopeOptions): rxjs.Observable<Response<DelegationScopeOptions>>;
615
678
  previewScope(ctx: StateContext<DelegationsStateModel>, { scope }: PreviewScope): rxjs.Observable<Response<DelegationScopePreview>>;
616
679
  clearScopePreview(ctx: StateContext<DelegationsStateModel>): void;
617
680
  createLegacy(ctx: StateContext<DelegationsStateModel>, { request }: CreateDelegationLegacy): rxjs.Observable<Response<DelegationDto>>;
@@ -631,7 +694,7 @@ declare class DelegationsFacade {
631
694
  readonly assignedPage: _angular_core.Signal<_masterteam_delegations.DelegationPage<_masterteam_delegations.DelegationRow> | null>;
632
695
  readonly activePage: _angular_core.Signal<_masterteam_delegations.DelegationPage<_masterteam_delegations.DelegationRow> | null>;
633
696
  readonly detail: _angular_core.Signal<_masterteam_delegations.DelegationDetail | null>;
634
- readonly scopeOptions: _angular_core.Signal<DelegationScopeSelection | null>;
697
+ readonly scopeOptions: _angular_core.Signal<_masterteam_delegations.DelegationScopeOptions | null>;
635
698
  readonly scopePreview: _angular_core.Signal<_masterteam_delegations.DelegationScopePreview | null>;
636
699
  private readonly loadingActive;
637
700
  private readonly errors;
@@ -651,6 +714,7 @@ declare class DelegationsFacade {
651
714
  readonly errorMy: _angular_core.Signal<string | null>;
652
715
  readonly errorAssigned: _angular_core.Signal<string | null>;
653
716
  readonly errorDetail: _angular_core.Signal<string | null>;
717
+ readonly errorScopeOptions: _angular_core.Signal<string | null>;
654
718
  readonly errorSave: _angular_core.Signal<string | null>;
655
719
  getMy(query?: DelegationListQuery): rxjs.Observable<void>;
656
720
  getAssigned(query?: DelegationListQuery): rxjs.Observable<void>;
@@ -758,4 +822,4 @@ declare class DelegationSessionFacade {
758
822
  }
759
823
 
760
824
  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 };
761
- 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 };
825
+ 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 };