tychat-contracts 1.6.13 → 1.6.15

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.
@@ -5,9 +5,16 @@ export type DashboardChartType = (typeof DASHBOARD_CHART_TYPES)[number];
5
5
  * Módulos de dados agregados do dashboard (cada um mapeia a permissões e a fatia do summary).
6
6
  * Manter alinhado ao `Frontend/.../lib/dashboard-data-modules.ts`.
7
7
  */
8
- export declare const DASHBOARD_DATA_MODULE_KEYS: readonly ["overview.clients_total", "overview.clients_active_inactive", "overview.units_total", "overview.revenue_totals", "overview.revenue_growth", "overview.invoice_counts", "billing.revenue_by_status", "billing.invoice_counts", "billing.recent_invoices", "billing.payment_links", "tenants.client_list", "tenants.plan_per_client", "tenants.legal_term_policy", "tenants.whatsapp_provider", "tenants.scheduled_deletion", "tenants.hostnames", "tenants.storage_usage", "limits.per_client", "limits.session_policy", "limits.extra_storage", "plans.stats", "plans.list", "ia.tokens_per_tenant", "ia.agents_per_tenant", "ia.tool_policies", "ia.models_availability", "evolution.configs_summary", "evolution.instances_totals", "evolution.connection_state", "global.platform_config", "team.panel_admins", "audit.recent_events", "audit.outcome_counts", "security.device_sessions", "security.totp_status"];
8
+ export declare const DASHBOARD_DATA_MODULE_KEYS: readonly ["overview.clients_total", "overview.clients_active_inactive", "overview.units_total", "overview.revenue_totals", "overview.revenue_growth", "overview.estimated_mrr", "overview.clients_per_plan", "overview.recent_signups", "overview.invoice_counts", "billing.revenue_by_status", "billing.invoice_status_breakdown", "billing.invoice_counts", "billing.recent_invoices", "billing.payment_links", "tenants.client_list", "tenants.plan_per_client", "tenants.legal_term_policy", "tenants.whatsapp_provider", "tenants.scheduled_deletion", "tenants.hostnames", "tenants.storage_usage", "limits.per_client", "limits.session_policy", "limits.extra_storage", "plans.stats", "plans.list", "plans.active_inactive", "ia.tokens_per_tenant", "ia.agents_per_tenant", "ia.agents_summary", "ia.tool_policies", "ia.models_availability", "evolution.configs_summary", "evolution.instances_totals", "evolution.connection_state", "global.platform_config", "team.panel_admins", "audit.recent_events", "audit.outcome_counts", "security.device_sessions", "security.totp_status"];
9
9
  export type DashboardDataModuleKey = (typeof DASHBOARD_DATA_MODULE_KEYS)[number];
10
10
  export declare function isDashboardDataModuleKey(v: string): v is DashboardDataModuleKey;
11
+ /** Posição e tamanho no painel em percentagem (0–100) relativamente ao contentor do canvas. */
12
+ export declare class DashboardCanvasRectDto {
13
+ leftPct: number;
14
+ topPct: number;
15
+ widthPct: number;
16
+ heightPct: number;
17
+ }
11
18
  export declare class DashboardWidgetDto {
12
19
  id: string;
13
20
  dataModule: DashboardDataModuleKey;
@@ -24,6 +31,8 @@ export declare class DashboardWidgetDto {
24
31
  /** Ordem de leitura (menor = primeiro). */
25
32
  order: number;
26
33
  title?: string;
34
+ /** Modo canvas: posicionamento livre (percentagens). Opcional; quando presente, o cliente deve preferir isto à grelha. */
35
+ canvas?: DashboardCanvasRectDto;
27
36
  }
28
37
  export declare class DashboardLayoutDto {
29
38
  version: number;
@@ -1 +1 @@
1
- {"version":3,"file":"dashboard-layout.dto.d.ts","sourceRoot":"","sources":["../../src/panel-rbac/dashboard-layout.dto.ts"],"names":[],"mappings":"AAgBA,oEAAoE;AACpE,eAAO,MAAM,qBAAqB,4EASxB,CAAC;AAEX,MAAM,MAAM,kBAAkB,GAAG,CAAC,OAAO,qBAAqB,CAAC,CAAC,MAAM,CAAC,CAAC;AAExE;;;GAGG;AACH,eAAO,MAAM,0BAA0B,i4BAoC7B,CAAC;AAEX,MAAM,MAAM,sBAAsB,GAAG,CAAC,OAAO,0BAA0B,CAAC,CAAC,MAAM,CAAC,CAAC;AAEjF,wBAAgB,wBAAwB,CAAC,CAAC,EAAE,MAAM,GAAG,CAAC,IAAI,sBAAsB,CAE/E;AAED,qBAAa,kBAAkB;IAG7B,EAAE,EAAE,MAAM,CAAC;IAKX,UAAU,EAAE,sBAAsB,CAAC;IAKnC,SAAS,EAAE,kBAAkB,CAAC;IAE9B,0CA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,EAAE,MAAM,CAAC;IAMd,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,0HAA0H;IAK1H,MAAM,CAAC,EAAE,sBAAsB,CAAC;CACjC;AAED,qBAAa,kBAAkB;IAK7B,OAAO,EAAE,MAAM,CAAC;IAOhB,OAAO,EAAE,kBAAkB,EAAE,CAAC;CAC/B"}
@@ -9,7 +9,7 @@ var __metadata = (this && this.__metadata) || function (k, v) {
9
9
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.DashboardLayoutDto = exports.DashboardWidgetDto = exports.DASHBOARD_DATA_MODULE_KEYS = exports.DASHBOARD_CHART_TYPES = void 0;
12
+ exports.DashboardLayoutDto = exports.DashboardWidgetDto = exports.DashboardCanvasRectDto = exports.DASHBOARD_DATA_MODULE_KEYS = exports.DASHBOARD_CHART_TYPES = void 0;
13
13
  exports.isDashboardDataModuleKey = isDashboardDataModuleKey;
14
14
  const swagger_1 = require("@nestjs/swagger");
15
15
  const class_transformer_1 = require("class-transformer");
@@ -35,8 +35,12 @@ exports.DASHBOARD_DATA_MODULE_KEYS = [
35
35
  'overview.units_total',
36
36
  'overview.revenue_totals',
37
37
  'overview.revenue_growth',
38
+ 'overview.estimated_mrr',
39
+ 'overview.clients_per_plan',
40
+ 'overview.recent_signups',
38
41
  'overview.invoice_counts',
39
42
  'billing.revenue_by_status',
43
+ 'billing.invoice_status_breakdown',
40
44
  'billing.invoice_counts',
41
45
  'billing.recent_invoices',
42
46
  'billing.payment_links',
@@ -52,8 +56,10 @@ exports.DASHBOARD_DATA_MODULE_KEYS = [
52
56
  'limits.extra_storage',
53
57
  'plans.stats',
54
58
  'plans.list',
59
+ 'plans.active_inactive',
55
60
  'ia.tokens_per_tenant',
56
61
  'ia.agents_per_tenant',
62
+ 'ia.agents_summary',
57
63
  'ia.tool_policies',
58
64
  'ia.models_availability',
59
65
  'evolution.configs_summary',
@@ -69,6 +75,46 @@ exports.DASHBOARD_DATA_MODULE_KEYS = [
69
75
  function isDashboardDataModuleKey(v) {
70
76
  return exports.DASHBOARD_DATA_MODULE_KEYS.includes(v);
71
77
  }
78
+ /** Posição e tamanho no painel em percentagem (0–100) relativamente ao contentor do canvas. */
79
+ class DashboardCanvasRectDto {
80
+ leftPct;
81
+ topPct;
82
+ widthPct;
83
+ heightPct;
84
+ }
85
+ exports.DashboardCanvasRectDto = DashboardCanvasRectDto;
86
+ __decorate([
87
+ (0, swagger_1.ApiProperty)({ minimum: 0, maximum: 100 }),
88
+ (0, class_transformer_1.Type)(() => Number),
89
+ (0, class_validator_1.IsNumber)(),
90
+ (0, class_validator_1.Min)(0),
91
+ (0, class_validator_1.Max)(100),
92
+ __metadata("design:type", Number)
93
+ ], DashboardCanvasRectDto.prototype, "leftPct", void 0);
94
+ __decorate([
95
+ (0, swagger_1.ApiProperty)({ minimum: 0, maximum: 100 }),
96
+ (0, class_transformer_1.Type)(() => Number),
97
+ (0, class_validator_1.IsNumber)(),
98
+ (0, class_validator_1.Min)(0),
99
+ (0, class_validator_1.Max)(100),
100
+ __metadata("design:type", Number)
101
+ ], DashboardCanvasRectDto.prototype, "topPct", void 0);
102
+ __decorate([
103
+ (0, swagger_1.ApiProperty)({ minimum: 0, maximum: 100 }),
104
+ (0, class_transformer_1.Type)(() => Number),
105
+ (0, class_validator_1.IsNumber)(),
106
+ (0, class_validator_1.Min)(0),
107
+ (0, class_validator_1.Max)(100),
108
+ __metadata("design:type", Number)
109
+ ], DashboardCanvasRectDto.prototype, "widthPct", void 0);
110
+ __decorate([
111
+ (0, swagger_1.ApiProperty)({ minimum: 0, maximum: 100 }),
112
+ (0, class_transformer_1.Type)(() => Number),
113
+ (0, class_validator_1.IsNumber)(),
114
+ (0, class_validator_1.Min)(0),
115
+ (0, class_validator_1.Max)(100),
116
+ __metadata("design:type", Number)
117
+ ], DashboardCanvasRectDto.prototype, "heightPct", void 0);
72
118
  class DashboardWidgetDto {
73
119
  id;
74
120
  dataModule;
@@ -85,6 +131,8 @@ class DashboardWidgetDto {
85
131
  /** Ordem de leitura (menor = primeiro). */
86
132
  order;
87
133
  title;
134
+ /** Modo canvas: posicionamento livre (percentagens). Opcional; quando presente, o cliente deve preferir isto à grelha. */
135
+ canvas;
88
136
  }
89
137
  exports.DashboardWidgetDto = DashboardWidgetDto;
90
138
  __decorate([
@@ -140,16 +188,23 @@ __decorate([
140
188
  (0, class_validator_1.MaxLength)(120),
141
189
  __metadata("design:type", String)
142
190
  ], DashboardWidgetDto.prototype, "title", void 0);
191
+ __decorate([
192
+ (0, swagger_1.ApiPropertyOptional)({ type: DashboardCanvasRectDto }),
193
+ (0, class_validator_1.IsOptional)(),
194
+ (0, class_validator_1.ValidateNested)(),
195
+ (0, class_transformer_1.Type)(() => DashboardCanvasRectDto),
196
+ __metadata("design:type", DashboardCanvasRectDto)
197
+ ], DashboardWidgetDto.prototype, "canvas", void 0);
143
198
  class DashboardLayoutDto {
144
199
  version;
145
200
  widgets;
146
201
  }
147
202
  exports.DashboardLayoutDto = DashboardLayoutDto;
148
203
  __decorate([
149
- (0, swagger_1.ApiProperty)({ default: 1 }),
204
+ (0, swagger_1.ApiProperty)({ default: 1, description: '1 = só grelha; 2 = canvas com campo canvas por widget' }),
150
205
  (0, class_validator_1.IsInt)(),
151
206
  (0, class_validator_1.Min)(1),
152
- (0, class_validator_1.Max)(1),
207
+ (0, class_validator_1.Max)(2),
153
208
  __metadata("design:type", Number)
154
209
  ], DashboardLayoutDto.prototype, "version", void 0);
155
210
  __decorate([
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tychat-contracts",
3
- "version": "1.6.13",
3
+ "version": "1.6.15",
4
4
  "description": "DTOs compartilhados com class-validator (API e microserviços)",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -5,6 +5,7 @@ import {
5
5
  IsArray,
6
6
  IsIn,
7
7
  IsInt,
8
+ IsNumber,
8
9
  IsOptional,
9
10
  IsString,
10
11
  IsUUID,
@@ -38,8 +39,12 @@ export const DASHBOARD_DATA_MODULE_KEYS = [
38
39
  'overview.units_total',
39
40
  'overview.revenue_totals',
40
41
  'overview.revenue_growth',
42
+ 'overview.estimated_mrr',
43
+ 'overview.clients_per_plan',
44
+ 'overview.recent_signups',
41
45
  'overview.invoice_counts',
42
46
  'billing.revenue_by_status',
47
+ 'billing.invoice_status_breakdown',
43
48
  'billing.invoice_counts',
44
49
  'billing.recent_invoices',
45
50
  'billing.payment_links',
@@ -55,8 +60,10 @@ export const DASHBOARD_DATA_MODULE_KEYS = [
55
60
  'limits.extra_storage',
56
61
  'plans.stats',
57
62
  'plans.list',
63
+ 'plans.active_inactive',
58
64
  'ia.tokens_per_tenant',
59
65
  'ia.agents_per_tenant',
66
+ 'ia.agents_summary',
60
67
  'ia.tool_policies',
61
68
  'ia.models_availability',
62
69
  'evolution.configs_summary',
@@ -76,6 +83,37 @@ export function isDashboardDataModuleKey(v: string): v is DashboardDataModuleKey
76
83
  return (DASHBOARD_DATA_MODULE_KEYS as readonly string[]).includes(v);
77
84
  }
78
85
 
86
+ /** Posição e tamanho no painel em percentagem (0–100) relativamente ao contentor do canvas. */
87
+ export class DashboardCanvasRectDto {
88
+ @ApiProperty({ minimum: 0, maximum: 100 })
89
+ @Type(() => Number)
90
+ @IsNumber()
91
+ @Min(0)
92
+ @Max(100)
93
+ leftPct: number;
94
+
95
+ @ApiProperty({ minimum: 0, maximum: 100 })
96
+ @Type(() => Number)
97
+ @IsNumber()
98
+ @Min(0)
99
+ @Max(100)
100
+ topPct: number;
101
+
102
+ @ApiProperty({ minimum: 0, maximum: 100 })
103
+ @Type(() => Number)
104
+ @IsNumber()
105
+ @Min(0)
106
+ @Max(100)
107
+ widthPct: number;
108
+
109
+ @ApiProperty({ minimum: 0, maximum: 100 })
110
+ @Type(() => Number)
111
+ @IsNumber()
112
+ @Min(0)
113
+ @Max(100)
114
+ heightPct: number;
115
+ }
116
+
79
117
  export class DashboardWidgetDto {
80
118
  @ApiProperty({ format: 'uuid' })
81
119
  @IsUUID('4')
@@ -128,13 +166,20 @@ export class DashboardWidgetDto {
128
166
  @IsString()
129
167
  @MaxLength(120)
130
168
  title?: string;
169
+
170
+ /** Modo canvas: posicionamento livre (percentagens). Opcional; quando presente, o cliente deve preferir isto à grelha. */
171
+ @ApiPropertyOptional({ type: DashboardCanvasRectDto })
172
+ @IsOptional()
173
+ @ValidateNested()
174
+ @Type(() => DashboardCanvasRectDto)
175
+ canvas?: DashboardCanvasRectDto;
131
176
  }
132
177
 
133
178
  export class DashboardLayoutDto {
134
- @ApiProperty({ default: 1 })
179
+ @ApiProperty({ default: 1, description: '1 = só grelha; 2 = canvas com campo canvas por widget' })
135
180
  @IsInt()
136
181
  @Min(1)
137
- @Max(1)
182
+ @Max(2)
138
183
  version: number;
139
184
 
140
185
  @ApiProperty({ type: [DashboardWidgetDto] })