valtech-components 2.0.1021 → 2.0.1023

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.
@@ -25,6 +25,9 @@ export declare class MemberDetailModalComponent implements OnInit, OnDestroy {
25
25
  private errors;
26
26
  private i18n;
27
27
  private confirmDialog;
28
+ private catalog;
29
+ /** Labeler de permisos con la SSOT del backend (catálogo). Se llena al cargar. */
30
+ private readonly permLabeler;
28
31
  /** Inyectado por `ModalService.open` — referencia para cerrar desde dentro. */
29
32
  _modalRef?: {
30
33
  dismiss: (data?: unknown, role?: string) => void;
@@ -56,7 +59,6 @@ export declare class MemberDetailModalComponent implements OnInit, OnDestroy {
56
59
  constructor();
57
60
  ngOnInit(): void;
58
61
  permissionLabel(perm: string): string;
59
- private humanizeCode;
60
62
  private onChangeRole;
61
63
  onRemove(): Promise<void>;
62
64
  roleLabel(roleIdOrName: string): string;
@@ -103,7 +103,6 @@ export declare class OrganizationViewComponent {
103
103
  private enrichWithProfiles;
104
104
  loadRoles(): void;
105
105
  roleLabel(roleIdOrName: string): string;
106
- permissionLabel(perm: string): string;
107
106
  onViewMember(member: MemberDetail): void;
108
107
  protected tt(key: string): string;
109
108
  static ɵfac: i0.ɵɵFactoryDeclaration<OrganizationViewComponent, never>;
@@ -64,7 +64,6 @@ export declare class PermissionsViewComponent {
64
64
  protected tt(key: string): string;
65
65
  appLabel(appId: string): string;
66
66
  roleLabel(name: string): string;
67
- permLabel(resource: string, action: string): string;
68
67
  static ɵfac: i0.ɵɵFactoryDeclaration<PermissionsViewComponent, never>;
69
68
  static ɵcmp: i0.ɵɵComponentDeclaration<PermissionsViewComponent, "val-permissions-view", never, { "config": { "alias": "config"; "required": false; }; }, {}, never, never, true, never>;
70
69
  }
@@ -38,3 +38,20 @@ export declare class PermissionCatalogService {
38
38
  static ɵfac: i0.ɵɵFactoryDeclaration<PermissionCatalogService, never>;
39
39
  static ɵprov: i0.ɵɵInjectableDeclaration<PermissionCatalogService>;
40
40
  }
41
+ /** Función que resuelve un permiso `resource:action` a su label legible. */
42
+ export type PermissionLabeler = (perm: string) => string;
43
+ /**
44
+ * Construye el resolvedor de labels de permisos a partir del catálogo del backend
45
+ * (fuente única de verdad de los labels, ADR-024). Los consumers (permissions-view,
46
+ * organization-view, member-detail-modal) usan esto en vez de duplicar mapas
47
+ * hardcodeados `resource→key`/`action→key`.
48
+ *
49
+ * - Recurso → `permissions[].label[locale]`; acción → `actionLabels[action][locale]`.
50
+ * - Wildcards (`*:*`, `resource:*`, `*`) usan `allLabel` (el catálogo no modela el
51
+ * comodín; el consumer pasa su string i18n, p.ej. "Todos los permisos").
52
+ * - Fallback humanizado si el catálogo no trae label (evita salidas vacías como
53
+ * ": Gestionar" ante un recurso/acción nuevo aún sin etiqueta en el backend).
54
+ */
55
+ export declare function createPermissionLabeler(catalog: Pick<PermissionCatalogResponse, 'permissions' | 'actionLabels'>, locale: string, opts?: {
56
+ allLabel?: string;
57
+ }): PermissionLabeler;
package/lib/version.d.ts CHANGED
@@ -2,4 +2,4 @@
2
2
  * Current version of valtech-components.
3
3
  * This is automatically updated during the publish process.
4
4
  */
5
- export declare const VERSION = "2.0.1021";
5
+ export declare const VERSION = "2.0.1023";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "valtech-components",
3
- "version": "2.0.1021",
3
+ "version": "2.0.1023",
4
4
  "private": false,
5
5
  "bin": {
6
6
  "valtech-firebase-config": "./src/lib/services/firebase/scripts/generate-sw-config.js"