valtech-components 2.0.1023 → 2.0.1024

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.
Files changed (25) hide show
  1. package/esm2022/lib/components/molecules/pill/pill.component.mjs +3 -3
  2. package/esm2022/lib/components/molecules/update-banner/update-banner.component.mjs +3 -3
  3. package/esm2022/lib/components/organisms/api-key-create-modal/api-key-create-modal.component.mjs +290 -0
  4. package/esm2022/lib/components/organisms/api-keys-view/api-keys-view.component.mjs +316 -0
  5. package/esm2022/lib/components/organisms/api-keys-view/api-keys-view.i18n.mjs +59 -0
  6. package/esm2022/lib/components/organisms/api-keys-view/api-keys.routes.mjs +27 -0
  7. package/esm2022/lib/components/organisms/api-keys-view/types.mjs +2 -0
  8. package/esm2022/lib/components/organisms/organization-view/organization-view.component.mjs +6 -12
  9. package/esm2022/lib/components/organisms/organization-view/organization-view.i18n.mjs +3 -3
  10. package/esm2022/lib/components/organisms/organization-view/types.mjs +1 -1
  11. package/esm2022/lib/components/organisms/settings-hub/settings.routes.mjs +4 -1
  12. package/esm2022/lib/version.mjs +2 -2
  13. package/esm2022/public-api.mjs +5 -1
  14. package/fesm2022/valtech-components.mjs +2897 -2248
  15. package/fesm2022/valtech-components.mjs.map +1 -1
  16. package/lib/components/organisms/api-key-create-modal/api-key-create-modal.component.d.ts +56 -0
  17. package/lib/components/organisms/api-keys-view/api-keys-view.component.d.ts +58 -0
  18. package/lib/components/organisms/api-keys-view/api-keys-view.i18n.d.ts +6 -0
  19. package/lib/components/organisms/api-keys-view/api-keys.routes.d.ts +22 -0
  20. package/lib/components/organisms/api-keys-view/types.d.ts +8 -0
  21. package/lib/components/organisms/organization-view/types.d.ts +6 -0
  22. package/lib/components/organisms/settings-hub/settings.routes.d.ts +5 -0
  23. package/lib/version.d.ts +1 -1
  24. package/package.json +1 -1
  25. package/public-api.d.ts +4 -0
@@ -0,0 +1,56 @@
1
+ import { OnInit, EventEmitter } from '@angular/core';
2
+ import { FormMetadata, FormSubmit } from '../../types';
3
+ import { ClientApiKeyWithSecret } from '../../../services/apikeys/types';
4
+ import { LocalizedLabel, PermissionResource } from '../../../services/org/permission-catalog.service';
5
+ import * as i0 from "@angular/core";
6
+ /**
7
+ * `val-api-key-create-modal` — modal SÓLO para crear una Client API Key.
8
+ *
9
+ * Extraído de `val-api-keys-modal` bajo el proceso de ADR-021: la gestión (lista +
10
+ * revoke) vive ahora en la vista `val-api-keys-view`, y la creación en este modal,
11
+ * que `api-keys-view` abre vía `ModalService`. Header canónico (Regla #5): título en
12
+ * el body, botón Cerrar en el toolbar.
13
+ *
14
+ * Flujo: selector de permisos (filtrado por org/app) + form (nombre + expiración) →
15
+ * crea → muestra el secreto UNA vez con copia. Emite `(created)` al terminar (para
16
+ * que la vista refresque la lista) y `(dismissed)` al cerrar.
17
+ */
18
+ export declare class ApiKeyCreateModalComponent implements OnInit {
19
+ private i18n;
20
+ private apiKeys;
21
+ private catalog;
22
+ private auth;
23
+ /** Inyectado por `ModalService.open` — referencia para cerrar desde dentro. */
24
+ _modalRef?: {
25
+ dismiss: (data?: unknown, role?: string) => void;
26
+ };
27
+ /** Namespace i18n (comparte el de `val-api-keys-modal`). */
28
+ i18nNamespace: string;
29
+ /** Callback tras crear una key (pasado por `componentProps` — refresca la lista). */
30
+ onCreated?: () => void;
31
+ readonly catalogPermissions: import("@angular/core").WritableSignal<PermissionResource[]>;
32
+ readonly actionLabels: import("@angular/core").WritableSignal<Record<string, LocalizedLabel>>;
33
+ readonly selectedPerms: import("@angular/core").WritableSignal<string[]>;
34
+ readonly submitting: import("@angular/core").WritableSignal<boolean>;
35
+ readonly errorMsg: import("@angular/core").WritableSignal<string>;
36
+ readonly secret: import("@angular/core").WritableSignal<ClientApiKeyWithSecret>;
37
+ readonly copied: import("@angular/core").WritableSignal<boolean>;
38
+ /** Emite cuando se creó una key (además del callback `onCreated`). */
39
+ created: EventEmitter<void>;
40
+ readonly createForm: import("@angular/core").Signal<FormMetadata>;
41
+ constructor();
42
+ ngOnInit(): void;
43
+ /**
44
+ * Carga el catálogo y lo filtra a lo asignable a una API Key de la org: descarta
45
+ * `internal` (el backend ya los omite para no-staff) y los permisos de OTRAS apps.
46
+ */
47
+ private loadCatalog;
48
+ private activeOrgId;
49
+ onCreateSubmit(event: FormSubmit): void;
50
+ copy(secret: string): Promise<void>;
51
+ finishSecret(): void;
52
+ dismiss(): void;
53
+ t(key: string): string;
54
+ static ɵfac: i0.ɵɵFactoryDeclaration<ApiKeyCreateModalComponent, never>;
55
+ static ɵcmp: i0.ɵɵComponentDeclaration<ApiKeyCreateModalComponent, "val-api-key-create-modal", never, { "_modalRef": { "alias": "_modalRef"; "required": false; }; "i18nNamespace": { "alias": "i18nNamespace"; "required": false; }; "onCreated": { "alias": "onCreated"; "required": false; }; }, { "created": "created"; }, never, never, true, never>;
56
+ }
@@ -0,0 +1,58 @@
1
+ import { EmptyStateMetadata } from '../../molecules/empty-state/types';
2
+ import { ButtonMetadata } from '../../types';
3
+ import { ClientApiKey } from '../../../services/apikeys/types';
4
+ import { ApiKeysViewConfig } from './types';
5
+ import * as i0 from "@angular/core";
6
+ /** Key enriquecida con el perfil público (handle/avatar/name) de su creador. */
7
+ interface ApiKeyRow extends ClientApiKey {
8
+ creatorName?: string;
9
+ creatorHandle?: string;
10
+ creatorAvatar?: string;
11
+ }
12
+ /**
13
+ * `val-api-keys-view` — vista full-feature de gestión de Client API Keys (ADR-021).
14
+ *
15
+ * Reemplaza al `val-api-keys-modal` como pantalla propia: ofrece **crear** arriba
16
+ * (CTA que abre `val-api-key-create-modal`) y **lista** abajo, con quién la creó
17
+ * (avatar + handle, resuelto de `/profiles`) y la fecha de creación. Revocar con
18
+ * confirmación destructiva. Estados loading / error / empty (Capa 4).
19
+ *
20
+ * NO renderiza ion-content — vive dentro de `val-page-wrapper`. Header vía
21
+ * `NavigationService.setBackHeader`. i18n auto-registrado bajo `i18nNamespace`.
22
+ */
23
+ export declare class ApiKeysViewComponent {
24
+ private i18n;
25
+ private auth;
26
+ private apiKeys;
27
+ private firestore;
28
+ private nav;
29
+ private modalService;
30
+ private toast;
31
+ private confirmDialog;
32
+ private errors;
33
+ private route;
34
+ /** Config vía @Input (object-first); fallback al route data `apiKeysConfig`. */
35
+ config?: ApiKeysViewConfig;
36
+ readonly resolvedConfig: import("@angular/core").Signal<Required<ApiKeysViewConfig>>;
37
+ private get ns();
38
+ readonly keys: import("@angular/core").WritableSignal<ApiKeyRow[]>;
39
+ readonly loading: import("@angular/core").WritableSignal<boolean>;
40
+ readonly loadError: import("@angular/core").WritableSignal<unknown>;
41
+ readonly activeOrgId: import("@angular/core").Signal<string>;
42
+ readonly newKeyButton: import("@angular/core").Signal<Partial<ButtonMetadata>>;
43
+ readonly errorState: import("@angular/core").Signal<EmptyStateMetadata>;
44
+ readonly emptyState: import("@angular/core").Signal<EmptyStateMetadata>;
45
+ constructor();
46
+ revokeButton(k: ApiKeyRow): Partial<ButtonMetadata>;
47
+ load(): void;
48
+ /** Resuelve handle/avatar/name del creador (`createdBy`) desde `/profiles`. */
49
+ private enrichWithCreators;
50
+ creatorLabel(k: ApiKeyRow): string;
51
+ formatDate(iso?: string): string;
52
+ openCreate(): void;
53
+ revoke(k: ApiKeyRow): Promise<void>;
54
+ protected tt(key: string): string;
55
+ static ɵfac: i0.ɵɵFactoryDeclaration<ApiKeysViewComponent, never>;
56
+ static ɵcmp: i0.ɵɵComponentDeclaration<ApiKeysViewComponent, "val-api-keys-view", never, { "config": { "alias": "config"; "required": false; }; }, {}, never, never, true, never>;
57
+ }
58
+ export {};
@@ -0,0 +1,6 @@
1
+ import { LanguagesContent } from '../../../services/i18n/types';
2
+ /**
3
+ * Defaults i18n (es/en) de `val-api-keys-view`. Auto-registrados si el consumer no
4
+ * proveyó el namespace `Settings.ApiKeys`.
5
+ */
6
+ export declare const API_KEYS_VIEW_I18N: LanguagesContent;
@@ -0,0 +1,22 @@
1
+ import { Routes } from '@angular/router';
2
+ import { ApiKeysViewConfig } from './types';
3
+ /**
4
+ * Helper para montar la vista de Client API Keys (`val-api-keys-view`) como ruta
5
+ * en una app del factory. El `config` se pasa por route `data` (`apiKeysConfig`) y
6
+ * el componente lo lee como fallback de su `@Input() config`.
7
+ *
8
+ * @example
9
+ * ```ts
10
+ * // settings.routes.ts
11
+ * import { provideValtechApiKeysRoutes } from 'valtech-components';
12
+ *
13
+ * export const settingsRoutes: Routes = [
14
+ * ...provideValtechApiKeysRoutes(), // → /app/settings/api-keys
15
+ * // ...provideValtechApiKeysRoutes({ path: 'integrations/keys' }),
16
+ * ];
17
+ * ```
18
+ */
19
+ export declare function provideValtechApiKeysRoutes(opts?: {
20
+ path?: string;
21
+ config?: ApiKeysViewConfig;
22
+ }): Routes;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Config acotada de `val-api-keys-view` (ADR-021: una vista full-feature no abre
3
+ * slots arbitrarios; si falta algo, se promueve un nuevo punto de extensión).
4
+ */
5
+ export interface ApiKeysViewConfig {
6
+ /** Namespace i18n de los textos de la vista. Default `Settings.ApiKeys`. */
7
+ i18nNamespace?: string;
8
+ }
@@ -45,6 +45,12 @@ export interface OrganizationViewConfig {
45
45
  * "Ver roles y permisos"). Default `'/app/settings/permissions'`.
46
46
  */
47
47
  viewPermissionsRoute?: string;
48
+ /**
49
+ * Ruta a la que navegar al gestionar las API Keys (botón "Gestionar" de la
50
+ * sección Integraciones). Apunta a `val-api-keys-view`
51
+ * (`provideValtechApiKeysRoutes`). Default `'/app/settings/api-keys'`.
52
+ */
53
+ apiKeysRoute?: string;
48
54
  /**
49
55
  * Ruta a la que redirigir tras salir de la organización.
50
56
  * Default `'/app/settings/account'`.
@@ -5,6 +5,7 @@ import { SecurityViewConfig } from '../security-view/types';
5
5
  import { AccountViewConfig } from '../account-view/types';
6
6
  import { OrganizationViewConfig } from '../organization-view/types';
7
7
  import { NotificationPreferencesViewConfig } from '../notification-preferences-view/types';
8
+ import { ApiKeysViewConfig } from '../api-keys-view/types';
8
9
  import { PermissionsViewConfig } from '../permissions-view/types';
9
10
  import { SettingsHubConfig } from './types';
10
11
  /**
@@ -58,6 +59,10 @@ export interface ValtechSettingsRoutesOptions {
58
59
  includeNotificationPreferences?: boolean;
59
60
  /** Monta la ruta `permissions`. Default `true`. */
60
61
  includePermissions?: boolean;
62
+ /** Monta la ruta `api-keys` (`val-api-keys-view`). Default `false` (opt-in). */
63
+ includeApiKeys?: boolean;
64
+ /** Config de la vista API Keys (pass-through a `provideValtechApiKeysRoutes`). */
65
+ apiKeysConfig?: ApiKeysViewConfig;
61
66
  /** Path de la vista Preferencias. Default `'preferences'`. */
62
67
  preferencesPath?: string;
63
68
  /** Path de la vista Preferencias de notificaciones push. Default `'notifications'`. */
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.1023";
5
+ export declare const VERSION = "2.0.1024";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "valtech-components",
3
- "version": "2.0.1023",
3
+ "version": "2.0.1024",
4
4
  "private": false,
5
5
  "bin": {
6
6
  "valtech-firebase-config": "./src/lib/services/firebase/scripts/generate-sw-config.js"
package/public-api.d.ts CHANGED
@@ -309,6 +309,10 @@ export * from './lib/components/organisms/member-detail-modal/member-detail-moda
309
309
  export * from './lib/components/organisms/member-detail-modal/types';
310
310
  export * from './lib/components/organisms/member-import-modal/member-import-modal.component';
311
311
  export * from './lib/components/organisms/api-keys-modal/api-keys-modal.component';
312
+ export * from './lib/components/organisms/api-key-create-modal/api-key-create-modal.component';
313
+ export * from './lib/components/organisms/api-keys-view/api-keys-view.component';
314
+ export * from './lib/components/organisms/api-keys-view/types';
315
+ export * from './lib/components/organisms/api-keys-view/api-keys.routes';
312
316
  export * from './lib/components/organisms/edit-org-modal/edit-org-modal.component';
313
317
  export * from './lib/components/organisms/transfer-ownership-modal/transfer-ownership-modal.component';
314
318
  export * from './lib/components/organisms/transfer-ownership-modal/types';