valtech-components 4.0.248 → 4.0.250
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/esm2022/lib/components/molecules/usage-meters/types.mjs +5 -0
- package/esm2022/lib/components/molecules/usage-meters/usage-meters.component.mjs +124 -0
- package/esm2022/lib/services/usage/usage.service.mjs +87 -0
- package/esm2022/lib/services/workflows/workflow.service.mjs +8 -1
- package/esm2022/lib/version.mjs +2 -2
- package/esm2022/public-api.mjs +4 -1
- package/fesm2022/valtech-components.mjs +215 -2
- package/fesm2022/valtech-components.mjs.map +1 -1
- package/lib/components/molecules/usage-meters/types.d.ts +24 -0
- package/lib/components/molecules/usage-meters/usage-meters.component.d.ts +26 -0
- package/lib/services/usage/usage.service.d.ts +25 -0
- package/lib/services/workflows/workflow.service.d.ts +13 -0
- package/lib/version.d.ts +1 -1
- package/package.json +1 -1
- package/public-api.d.ts +3 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export interface UsageMetric {
|
|
2
|
+
/** Clave de la métrica (ej. "emails_month"). */
|
|
3
|
+
key: string;
|
|
4
|
+
/** Etiqueta visible ya resuelta por el consumer (ej. "Emails / mes"). */
|
|
5
|
+
label: string;
|
|
6
|
+
/** Consumo del período. */
|
|
7
|
+
used: number;
|
|
8
|
+
/** Tope; -1 = ilimitado. */
|
|
9
|
+
limit: number;
|
|
10
|
+
/** true si el tope es ilimitado (-1). */
|
|
11
|
+
unlimited: boolean;
|
|
12
|
+
}
|
|
13
|
+
export interface UsageMetersMetadata {
|
|
14
|
+
/** Título de la sección (opcional). */
|
|
15
|
+
title?: string;
|
|
16
|
+
/** Nombre de la app a la que pertenece este bloque (para vista multi-app). */
|
|
17
|
+
appName?: string;
|
|
18
|
+
/** Tier del plan, para mostrar como badge (ej. "Pro"). */
|
|
19
|
+
plan?: string;
|
|
20
|
+
/** Período (ej. "2026-06"). */
|
|
21
|
+
period?: string;
|
|
22
|
+
/** Métricas a mostrar. */
|
|
23
|
+
metrics: UsageMetric[];
|
|
24
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { UsageMetersMetadata } from './types';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
interface MeterRow {
|
|
4
|
+
key: string;
|
|
5
|
+
label: string;
|
|
6
|
+
usedLabel: string;
|
|
7
|
+
pct: number;
|
|
8
|
+
unlimited: boolean;
|
|
9
|
+
over: boolean;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* val-usage-meters — bloque de consumo (uso vs tope por métrica) para el
|
|
13
|
+
* dashboard de monetización (ADR-046 D3). Presentacional: recibe los datos ya
|
|
14
|
+
* resueltos (UsageService los arma desde Firestore). Reutilizable single-app o
|
|
15
|
+
* por sección en multi-app (myvaltech account).
|
|
16
|
+
*/
|
|
17
|
+
export declare class UsageMetersComponent {
|
|
18
|
+
private i18n;
|
|
19
|
+
readonly props: import("@angular/core").InputSignal<UsageMetersMetadata>;
|
|
20
|
+
constructor();
|
|
21
|
+
readonly rows: import("@angular/core").Signal<MeterRow[]>;
|
|
22
|
+
t(key: string): string;
|
|
23
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<UsageMetersComponent, never>;
|
|
24
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<UsageMetersComponent, "val-usage-meters", never, { "props": { "alias": "props"; "required": true; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
25
|
+
}
|
|
26
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Observable } from 'rxjs';
|
|
2
|
+
import { UsageMetersMetadata } from '../../components/molecules/usage-meters/types';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
/**
|
|
5
|
+
* UsageService — lee el resumen de consumo (uso + límites + plan) en vivo desde
|
|
6
|
+
* Firestore y lo mapea a `UsageMetersMetadata` para `<val-usage-meters>`.
|
|
7
|
+
* (ADR-046 D3). Firestore es la fuente única (el backend proyecta usage+limits).
|
|
8
|
+
* Granular por app: `watch(appId, orgId)`. Multi-app: una suscripción por app.
|
|
9
|
+
*/
|
|
10
|
+
export declare class UsageService {
|
|
11
|
+
private firestore;
|
|
12
|
+
private i18n;
|
|
13
|
+
constructor();
|
|
14
|
+
/** Período actual `YYYY-MM` (UTC), igual que el backend. */
|
|
15
|
+
currentPeriod(): string;
|
|
16
|
+
/**
|
|
17
|
+
* Observa el consumo de (org, app) en vivo. Lee el path absoluto
|
|
18
|
+
* `apps/{appId}/orgs/{orgId}/usage/{period}` (sin auto-prefix de la app actual,
|
|
19
|
+
* para soportar la vista multi-app desde account).
|
|
20
|
+
*/
|
|
21
|
+
watch(appId: string, orgId: string, appName?: string, period?: string): Observable<UsageMetersMetadata>;
|
|
22
|
+
private toMetadata;
|
|
23
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<UsageService, never>;
|
|
24
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<UsageService>;
|
|
25
|
+
}
|
|
@@ -25,6 +25,17 @@ export interface WorkflowExecution extends FirestoreDocument {
|
|
|
25
25
|
startedAt?: string;
|
|
26
26
|
stoppedAt?: string;
|
|
27
27
|
}
|
|
28
|
+
/** Estado por-paso de una ejecución (vista "en acción"). */
|
|
29
|
+
export interface WorkflowStep {
|
|
30
|
+
name: string;
|
|
31
|
+
status: 'pending' | 'running' | 'succeeded' | 'failed';
|
|
32
|
+
retries: number;
|
|
33
|
+
}
|
|
34
|
+
/** Resumen del historial de una ejecución. */
|
|
35
|
+
export interface WorkflowHistory {
|
|
36
|
+
status: WorkflowStatus;
|
|
37
|
+
steps: WorkflowStep[];
|
|
38
|
+
}
|
|
28
39
|
/**
|
|
29
40
|
* WorkflowService (ADR-045) — arranca state machines de Step Functions registradas
|
|
30
41
|
* y observa su ejecución en tiempo real (Firestore). Reusable por cualquier app.
|
|
@@ -41,6 +52,8 @@ export declare class WorkflowService {
|
|
|
41
52
|
constructor(config: ValtechAuthConfig | null);
|
|
42
53
|
private get appIdHeader();
|
|
43
54
|
start(name: string, input?: Record<string, unknown>): Observable<WorkflowStartResult>;
|
|
55
|
+
/** Resumen por-paso del historial de una ejecución (para mostrar el progreso). */
|
|
56
|
+
history(executionArn: string): Observable<WorkflowHistory>;
|
|
44
57
|
watch(executionName: string): Observable<WorkflowExecution | null>;
|
|
45
58
|
static ɵfac: i0.ɵɵFactoryDeclaration<WorkflowService, [{ optional: true; }]>;
|
|
46
59
|
static ɵprov: i0.ɵɵInjectableDeclaration<WorkflowService>;
|
package/lib/version.d.ts
CHANGED
package/package.json
CHANGED
package/public-api.d.ts
CHANGED
|
@@ -182,6 +182,9 @@ export * from './lib/components/molecules/media-object/media-object.component';
|
|
|
182
182
|
export * from './lib/components/molecules/media-object/types';
|
|
183
183
|
export * from './lib/components/molecules/stats-bar/stats-bar.component';
|
|
184
184
|
export * from './lib/components/molecules/stats-bar/types';
|
|
185
|
+
export * from './lib/components/molecules/usage-meters/usage-meters.component';
|
|
186
|
+
export * from './lib/components/molecules/usage-meters/types';
|
|
187
|
+
export * from './lib/services/usage/usage.service';
|
|
185
188
|
export * from './lib/components/molecules/article-card/article-card.component';
|
|
186
189
|
export * from './lib/components/molecules/article-card/types';
|
|
187
190
|
export * from './lib/components/molecules/cta-card/cta-card.component';
|