tychat-contracts 1.3.7 → 1.3.9

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.
@@ -1,5 +1,5 @@
1
- export declare const CONVERSATION_SESSION_TYPES: readonly ["ia", "human"];
2
- export declare const CONVERSATION_TYPES: readonly ["ia", "human"];
1
+ export declare const CONVERSATION_SESSION_TYPES: readonly ["ia", "human", "waiting"];
2
+ export declare const CONVERSATION_TYPES: readonly ["ia", "human", "waiting"];
3
3
  export type ConversationTypeDto = (typeof CONVERSATION_SESSION_TYPES)[number];
4
4
  export declare const CONVERSATION_MESSAGE_TYPES: readonly ["ia", "human", "patient"];
5
5
  export type ConversationMessageTypeDto = (typeof CONVERSATION_MESSAGE_TYPES)[number];
@@ -1 +1 @@
1
- {"version":3,"file":"conversation-type.dto.d.ts","sourceRoot":"","sources":["../../src/conversations/conversation-type.dto.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,0BAA0B,0BAA2B,CAAC;AAGnE,eAAO,MAAM,kBAAkB,0BAA6B,CAAC;AAE7D,MAAM,MAAM,mBAAmB,GAAG,CAAC,OAAO,0BAA0B,CAAC,CAAC,MAAM,CAAC,CAAC;AAI9E,eAAO,MAAM,0BAA0B,qCAAsC,CAAC;AAC9E,MAAM,MAAM,0BAA0B,GAAG,CAAC,OAAO,0BAA0B,CAAC,CAAC,MAAM,CAAC,CAAC"}
1
+ {"version":3,"file":"conversation-type.dto.d.ts","sourceRoot":"","sources":["../../src/conversations/conversation-type.dto.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,0BAA0B,qCAAsC,CAAC;AAG9E,eAAO,MAAM,kBAAkB,qCAA6B,CAAC;AAE7D,MAAM,MAAM,mBAAmB,GAAG,CAAC,OAAO,0BAA0B,CAAC,CAAC,MAAM,CAAC,CAAC;AAI9E,eAAO,MAAM,0BAA0B,qCAAsC,CAAC;AAC9E,MAAM,MAAM,0BAA0B,GAAG,CAAC,OAAO,0BAA0B,CAAC,CAAC,MAAM,CAAC,CAAC"}
@@ -4,7 +4,8 @@ exports.CONVERSATION_MESSAGE_TYPES = exports.CONVERSATION_TYPES = exports.CONVER
4
4
  // Allowed conversation session types.
5
5
  // "ia" → patient interacting with the AI.
6
6
  // "human" → human staff member responding to the patient.
7
- exports.CONVERSATION_SESSION_TYPES = ['ia', 'human'];
7
+ // "waiting" waiting queue for human handoff.
8
+ exports.CONVERSATION_SESSION_TYPES = ['ia', 'human', 'waiting'];
8
9
  // Backwards-compatible alias for session types.
9
10
  exports.CONVERSATION_TYPES = exports.CONVERSATION_SESSION_TYPES;
10
11
  // Allowed conversation message types for the `conversations` table.
@@ -33,5 +33,13 @@ export declare class FollowupConfigResponseDto {
33
33
  templateReturnSuggestion?: string;
34
34
  templateAbandonment?: string;
35
35
  enabled: boolean;
36
+ humanPatientIdleWarningDelayMinutes: number;
37
+ humanPatientIdleFinalizeDelayMinutes: number;
38
+ humanAttendantIdleRequeueDelayMinutes: number;
39
+ humanPatientIdleWarningMessage: string;
40
+ humanPatientIdleFinalizeMessage: string;
41
+ humanAttendantIdleRequeueMessage: string;
42
+ humanAfterHoursWaitingMessage: string;
43
+ humanRequestOutsideHoursMessage: string;
36
44
  }
37
45
  //# sourceMappingURL=followup-config-response.dto.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"followup-config-response.dto.d.ts","sourceRoot":"","sources":["../../src/conversations/followup-config-response.dto.ts"],"names":[],"mappings":"AAGA;;;;;GAKG;AACH,qBAAa,yBAAyB;IAIpC,EAAE,EAAE,MAAM,CAAC;IAMX,MAAM,CAAC,EAAE,MAAM,CAAC;IAYhB,2BAA2B,EAAE,MAAM,CAAC;IAKpC,qBAAqB,EAAE,MAAM,CAAC;IAK9B,qBAAqB,EAAE,MAAM,CAAC;IAK9B,qBAAqB,EAAE,MAAM,CAAC;IAK9B,qBAAqB,EAAE,MAAM,CAAC;IAK9B,qBAAqB,EAAE,MAAM,CAAC;IAS9B,yBAAyB,EAAE,MAAM,CAAC;IAIlC,mBAAmB,EAAE,OAAO,CAAC;IAS7B,+BAA+B,EAAE,MAAM,CAAC;IAIxC,0BAA0B,EAAE,OAAO,CAAC;IAKpC,gCAAgC,EAAE,MAAM,CAAC;IAIzC,2BAA2B,EAAE,OAAO,CAAC;IASrC,kBAAkB,EAAE,MAAM,CAAC;IAI3B,aAAa,EAAE,OAAO,CAAC;IASvB,yBAAyB,EAAE,MAAM,CAAC;IAIlC,oBAAoB,EAAE,OAAO,CAAC;IAS9B,4BAA4B,EAAE,MAAM,CAAC;IAIrC,uBAAuB,EAAE,OAAO,CAAC;IAYjC,+BAA+B,CAAC,EAAE,MAAM,CAAC;IAQzC,2BAA2B,CAAC,EAAE,MAAM,CAAC;IAQrC,4BAA4B,CAAC,EAAE,MAAM,CAAC;IAQtC,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAQlC,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAQ/B,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAQlC,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAQ7B,OAAO,EAAE,OAAO,CAAC;CAClB"}
1
+ {"version":3,"file":"followup-config-response.dto.d.ts","sourceRoot":"","sources":["../../src/conversations/followup-config-response.dto.ts"],"names":[],"mappings":"AAWA;;;;;GAKG;AACH,qBAAa,yBAAyB;IAIpC,EAAE,EAAE,MAAM,CAAC;IAMX,MAAM,CAAC,EAAE,MAAM,CAAC;IAYhB,2BAA2B,EAAE,MAAM,CAAC;IAKpC,qBAAqB,EAAE,MAAM,CAAC;IAK9B,qBAAqB,EAAE,MAAM,CAAC;IAK9B,qBAAqB,EAAE,MAAM,CAAC;IAK9B,qBAAqB,EAAE,MAAM,CAAC;IAK9B,qBAAqB,EAAE,MAAM,CAAC;IAS9B,yBAAyB,EAAE,MAAM,CAAC;IAIlC,mBAAmB,EAAE,OAAO,CAAC;IAS7B,+BAA+B,EAAE,MAAM,CAAC;IAIxC,0BAA0B,EAAE,OAAO,CAAC;IAKpC,gCAAgC,EAAE,MAAM,CAAC;IAIzC,2BAA2B,EAAE,OAAO,CAAC;IASrC,kBAAkB,EAAE,MAAM,CAAC;IAI3B,aAAa,EAAE,OAAO,CAAC;IASvB,yBAAyB,EAAE,MAAM,CAAC;IAIlC,oBAAoB,EAAE,OAAO,CAAC;IAS9B,4BAA4B,EAAE,MAAM,CAAC;IAIrC,uBAAuB,EAAE,OAAO,CAAC;IAYjC,+BAA+B,CAAC,EAAE,MAAM,CAAC;IAQzC,2BAA2B,CAAC,EAAE,MAAM,CAAC;IAQrC,4BAA4B,CAAC,EAAE,MAAM,CAAC;IAQtC,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAQlC,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAQ/B,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAQlC,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAQ7B,OAAO,EAAE,OAAO,CAAC;IASjB,mCAAmC,EAAE,MAAM,CAAC;IAS5C,oCAAoC,EAAE,MAAM,CAAC;IAS7C,qCAAqC,EAAE,MAAM,CAAC;IAS9C,8BAA8B,EAAE,MAAM,CAAC;IASvC,+BAA+B,EAAE,MAAM,CAAC;IASxC,gCAAgC,EAAE,MAAM,CAAC;IASzC,6BAA6B,EAAE,MAAM,CAAC;IAUtC,+BAA+B,EAAE,MAAM,CAAC;CACzC"}
@@ -71,6 +71,14 @@ class FollowupConfigResponseDto {
71
71
  // Global setting
72
72
  // ---------------------------------------------------------------------------
73
73
  enabled;
74
+ humanPatientIdleWarningDelayMinutes;
75
+ humanPatientIdleFinalizeDelayMinutes;
76
+ humanAttendantIdleRequeueDelayMinutes;
77
+ humanPatientIdleWarningMessage;
78
+ humanPatientIdleFinalizeMessage;
79
+ humanAttendantIdleRequeueMessage;
80
+ humanAfterHoursWaitingMessage;
81
+ humanRequestOutsideHoursMessage;
74
82
  }
75
83
  exports.FollowupConfigResponseDto = FollowupConfigResponseDto;
76
84
  __decorate([
@@ -259,3 +267,75 @@ __decorate([
259
267
  (0, class_validator_1.IsBoolean)(),
260
268
  __metadata("design:type", Boolean)
261
269
  ], FollowupConfigResponseDto.prototype, "enabled", void 0);
270
+ __decorate([
271
+ (0, swagger_1.ApiProperty)({
272
+ description: 'Minutes to send warning when attendant sent the last message and patient did not reply',
273
+ example: 5,
274
+ }),
275
+ (0, class_validator_1.IsInt)(),
276
+ (0, class_validator_1.Min)(1),
277
+ __metadata("design:type", Number)
278
+ ], FollowupConfigResponseDto.prototype, "humanPatientIdleWarningDelayMinutes", void 0);
279
+ __decorate([
280
+ (0, swagger_1.ApiProperty)({
281
+ description: 'Minutes after warning to finalize human attendance and return session to IA',
282
+ example: 10,
283
+ }),
284
+ (0, class_validator_1.IsInt)(),
285
+ (0, class_validator_1.Min)(1),
286
+ __metadata("design:type", Number)
287
+ ], FollowupConfigResponseDto.prototype, "humanPatientIdleFinalizeDelayMinutes", void 0);
288
+ __decorate([
289
+ (0, swagger_1.ApiProperty)({
290
+ description: 'Minutes to requeue when patient sent the last message and attendant did not reply',
291
+ example: 15,
292
+ }),
293
+ (0, class_validator_1.IsInt)(),
294
+ (0, class_validator_1.Min)(1),
295
+ __metadata("design:type", Number)
296
+ ], FollowupConfigResponseDto.prototype, "humanAttendantIdleRequeueDelayMinutes", void 0);
297
+ __decorate([
298
+ (0, swagger_1.ApiProperty)({
299
+ description: 'Message sent as warning when patient is idle during human attendance',
300
+ example: 'Ainda estamos aguardando sua resposta. Em alguns minutos, o atendimento humano sera finalizado caso nao haja retorno.',
301
+ }),
302
+ (0, class_validator_1.IsString)(),
303
+ (0, class_validator_1.MaxLength)(5000),
304
+ __metadata("design:type", String)
305
+ ], FollowupConfigResponseDto.prototype, "humanPatientIdleWarningMessage", void 0);
306
+ __decorate([
307
+ (0, swagger_1.ApiProperty)({
308
+ description: 'Message sent when human attendance is finalized due to patient inactivity',
309
+ example: 'Como nao recebemos seu retorno, encerramos o atendimento humano por agora. Se precisar, posso continuar seu atendimento por IA.',
310
+ }),
311
+ (0, class_validator_1.IsString)(),
312
+ (0, class_validator_1.MaxLength)(5000),
313
+ __metadata("design:type", String)
314
+ ], FollowupConfigResponseDto.prototype, "humanPatientIdleFinalizeMessage", void 0);
315
+ __decorate([
316
+ (0, swagger_1.ApiProperty)({
317
+ description: 'Message sent when session is requeued due to attendant inactivity',
318
+ example: 'Devido a alta demanda, outro atendente continuara seu atendimento em breve.',
319
+ }),
320
+ (0, class_validator_1.IsString)(),
321
+ (0, class_validator_1.MaxLength)(5000),
322
+ __metadata("design:type", String)
323
+ ], FollowupConfigResponseDto.prototype, "humanAttendantIdleRequeueMessage", void 0);
324
+ __decorate([
325
+ (0, swagger_1.ApiProperty)({
326
+ description: 'Message sent when clinic is closed and session remains in waiting queue',
327
+ example: 'Nosso horario de atendimento foi encerrado. Retornaremos o contato no proximo dia util.',
328
+ }),
329
+ (0, class_validator_1.IsString)(),
330
+ (0, class_validator_1.MaxLength)(5000),
331
+ __metadata("design:type", String)
332
+ ], FollowupConfigResponseDto.prototype, "humanAfterHoursWaitingMessage", void 0);
333
+ __decorate([
334
+ (0, swagger_1.ApiProperty)({
335
+ description: 'Message sent when patient requests human support outside clinic hours',
336
+ example: 'No momento estamos fora do horario de atendimento humano. Sua conversa foi para a fila e retornaremos no proximo dia util.',
337
+ }),
338
+ (0, class_validator_1.IsString)(),
339
+ (0, class_validator_1.MaxLength)(5000),
340
+ __metadata("design:type", String)
341
+ ], FollowupConfigResponseDto.prototype, "humanRequestOutsideHoursMessage", void 0);
@@ -1,3 +1,5 @@
1
+ export declare const ADMIN_NOTIFICATION_KINDS: readonly ["notification", "alert"];
2
+ export type AdminNotificationKind = (typeof ADMIN_NOTIFICATION_KINDS)[number];
1
3
  /**
2
4
  * Pedido de envio em massa de push (FCM) disparado pelo painel admin.
3
5
  * O tenant-service publica no Kafka; o notifications-service consome e envia.
@@ -9,6 +11,7 @@ export declare class AdminBroadcastPushDto {
9
11
  userIds?: string[];
10
12
  title: string;
11
13
  body: string;
14
+ notificationKind?: AdminNotificationKind;
12
15
  data?: Record<string, string>;
13
16
  }
14
17
  //# sourceMappingURL=admin-broadcast-push.dto.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"admin-broadcast-push.dto.d.ts","sourceRoot":"","sources":["../../src/notifications/admin-broadcast-push.dto.ts"],"names":[],"mappings":"AAaA;;;GAGG;AACH,qBAAa,qBAAqB;IAGhC,UAAU,EAAG,OAAO,CAAC;IAUrB,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IAIvB,QAAQ,EAAG,OAAO,CAAC;IAUnB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IAKnB,KAAK,EAAG,MAAM,CAAC;IAKf,IAAI,EAAG,MAAM,CAAC;IASd,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC/B"}
1
+ {"version":3,"file":"admin-broadcast-push.dto.d.ts","sourceRoot":"","sources":["../../src/notifications/admin-broadcast-push.dto.ts"],"names":[],"mappings":"AAcA,eAAO,MAAM,wBAAwB,oCAAqC,CAAC;AAC3E,MAAM,MAAM,qBAAqB,GAAG,CAAC,OAAO,wBAAwB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE9E;;;GAGG;AACH,qBAAa,qBAAqB;IAGhC,UAAU,EAAG,OAAO,CAAC;IAUrB,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IAIvB,QAAQ,EAAG,OAAO,CAAC;IAUnB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IAKnB,KAAK,EAAG,MAAM,CAAC;IAKf,IAAI,EAAG,MAAM,CAAC;IAUd,gBAAgB,CAAC,EAAE,qBAAqB,CAAC;IASzC,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC/B"}
@@ -9,9 +9,10 @@ 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.AdminBroadcastPushDto = void 0;
12
+ exports.AdminBroadcastPushDto = exports.ADMIN_NOTIFICATION_KINDS = void 0;
13
13
  const swagger_1 = require("@nestjs/swagger");
14
14
  const class_validator_1 = require("class-validator");
15
+ exports.ADMIN_NOTIFICATION_KINDS = ['notification', 'alert'];
15
16
  /**
16
17
  * Pedido de envio em massa de push (FCM) disparado pelo painel admin.
17
18
  * O tenant-service publica no Kafka; o notifications-service consome e envia.
@@ -23,6 +24,7 @@ class AdminBroadcastPushDto {
23
24
  userIds;
24
25
  title;
25
26
  body;
27
+ notificationKind;
26
28
  data;
27
29
  }
28
30
  exports.AdminBroadcastPushDto = AdminBroadcastPushDto;
@@ -70,6 +72,17 @@ __decorate([
70
72
  (0, class_validator_1.MaxLength)(4000),
71
73
  __metadata("design:type", String)
72
74
  ], AdminBroadcastPushDto.prototype, "body", void 0);
75
+ __decorate([
76
+ (0, swagger_1.ApiPropertyOptional)({
77
+ description: 'Categoria de entrega no app (notification = centro; alert = modal no login).',
78
+ enum: exports.ADMIN_NOTIFICATION_KINDS,
79
+ default: 'notification',
80
+ }),
81
+ (0, class_validator_1.IsOptional)(),
82
+ (0, class_validator_1.IsString)(),
83
+ (0, class_validator_1.IsIn)(exports.ADMIN_NOTIFICATION_KINDS),
84
+ __metadata("design:type", String)
85
+ ], AdminBroadcastPushDto.prototype, "notificationKind", void 0);
73
86
  __decorate([
74
87
  (0, swagger_1.ApiPropertyOptional)({
75
88
  description: 'Payload FCM `data` (valores devem ser strings)',
@@ -1,6 +1,6 @@
1
1
  export { NotificationUserCreatedEventPayload, NotificationPasswordResetRequestedEventPayload, NotificationConversationChangeToHumanEventPayload, NotificationTenantAiTokensThresholdEventPayload, } from './notifications-kafka.payloads';
2
2
  export { TOPIC_NOTIFICATIONS_FIND_ALL, TOPIC_NOTIFICATIONS_REGISTER_PUSH_TOKEN, TOPIC_NOTIFICATIONS_UPDATE_VIEWED, EVENT_NOTIFICATIONS_ADMIN_BROADCAST_PUSH, EVENT_NOTIFICATIONS_CONVERSATION_HANDOFF_PUSH, EVENT_NOTIFICATIONS_TENANT_AI_TOKENS_THRESHOLD, } from './notifications-kafka-topics';
3
- export { AdminBroadcastPushDto } from './admin-broadcast-push.dto';
3
+ export { AdminBroadcastPushDto, ADMIN_NOTIFICATION_KINDS, type AdminNotificationKind, } from './admin-broadcast-push.dto';
4
4
  export { RegisterPushTokenDto, NotificationsRegisterPushTokenKafkaDto, } from './register-push-token.dto';
5
5
  export { ListNotificationsQueryDto, NOTIFICATION_PROVIDER_FILTERS, NOTIFICATION_STATUS_FILTERS, type NotificationProviderFilterDto, type NotificationStatusFilterDto, } from './list-notifications-query.dto';
6
6
  export { NotificationsFindAllKafkaDto } from './notifications-find-all-kafka.dto';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/notifications/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mCAAmC,EACnC,8CAA8C,EAC9C,iDAAiD,EACjD,+CAA+C,GAChD,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACL,4BAA4B,EAC5B,uCAAuC,EACvC,iCAAiC,EACjC,wCAAwC,EACxC,6CAA6C,EAC7C,8CAA8C,GAC/C,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EACL,oBAAoB,EACpB,sCAAsC,GACvC,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,yBAAyB,EACzB,6BAA6B,EAC7B,2BAA2B,EAC3B,KAAK,6BAA6B,EAClC,KAAK,2BAA2B,GACjC,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,4BAA4B,EAAE,MAAM,oCAAoC,CAAC;AAClF,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EACL,2BAA2B,EAC3B,iCAAiC,GAClC,MAAM,kCAAkC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/notifications/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mCAAmC,EACnC,8CAA8C,EAC9C,iDAAiD,EACjD,+CAA+C,GAChD,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACL,4BAA4B,EAC5B,uCAAuC,EACvC,iCAAiC,EACjC,wCAAwC,EACxC,6CAA6C,EAC7C,8CAA8C,GAC/C,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,qBAAqB,EACrB,wBAAwB,EACxB,KAAK,qBAAqB,GAC3B,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,oBAAoB,EACpB,sCAAsC,GACvC,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,yBAAyB,EACzB,6BAA6B,EAC7B,2BAA2B,EAC3B,KAAK,6BAA6B,EAClC,KAAK,2BAA2B,GACjC,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,4BAA4B,EAAE,MAAM,oCAAoC,CAAC;AAClF,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EACL,2BAA2B,EAC3B,iCAAiC,GAClC,MAAM,kCAAkC,CAAC"}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.NotificationsUpdateViewedKafkaDto = exports.UpdateNotificationViewedDto = exports.NotificationListItemDto = exports.NotificationsFindAllKafkaDto = exports.NOTIFICATION_STATUS_FILTERS = exports.NOTIFICATION_PROVIDER_FILTERS = exports.ListNotificationsQueryDto = exports.NotificationsRegisterPushTokenKafkaDto = exports.RegisterPushTokenDto = exports.AdminBroadcastPushDto = exports.EVENT_NOTIFICATIONS_TENANT_AI_TOKENS_THRESHOLD = exports.EVENT_NOTIFICATIONS_CONVERSATION_HANDOFF_PUSH = exports.EVENT_NOTIFICATIONS_ADMIN_BROADCAST_PUSH = exports.TOPIC_NOTIFICATIONS_UPDATE_VIEWED = exports.TOPIC_NOTIFICATIONS_REGISTER_PUSH_TOKEN = exports.TOPIC_NOTIFICATIONS_FIND_ALL = exports.NotificationTenantAiTokensThresholdEventPayload = exports.NotificationConversationChangeToHumanEventPayload = exports.NotificationPasswordResetRequestedEventPayload = exports.NotificationUserCreatedEventPayload = void 0;
3
+ exports.NotificationsUpdateViewedKafkaDto = exports.UpdateNotificationViewedDto = exports.NotificationListItemDto = exports.NotificationsFindAllKafkaDto = exports.NOTIFICATION_STATUS_FILTERS = exports.NOTIFICATION_PROVIDER_FILTERS = exports.ListNotificationsQueryDto = exports.NotificationsRegisterPushTokenKafkaDto = exports.RegisterPushTokenDto = exports.ADMIN_NOTIFICATION_KINDS = exports.AdminBroadcastPushDto = exports.EVENT_NOTIFICATIONS_TENANT_AI_TOKENS_THRESHOLD = exports.EVENT_NOTIFICATIONS_CONVERSATION_HANDOFF_PUSH = exports.EVENT_NOTIFICATIONS_ADMIN_BROADCAST_PUSH = exports.TOPIC_NOTIFICATIONS_UPDATE_VIEWED = exports.TOPIC_NOTIFICATIONS_REGISTER_PUSH_TOKEN = exports.TOPIC_NOTIFICATIONS_FIND_ALL = exports.NotificationTenantAiTokensThresholdEventPayload = exports.NotificationConversationChangeToHumanEventPayload = exports.NotificationPasswordResetRequestedEventPayload = exports.NotificationUserCreatedEventPayload = void 0;
4
4
  var notifications_kafka_payloads_1 = require("./notifications-kafka.payloads");
5
5
  Object.defineProperty(exports, "NotificationUserCreatedEventPayload", { enumerable: true, get: function () { return notifications_kafka_payloads_1.NotificationUserCreatedEventPayload; } });
6
6
  Object.defineProperty(exports, "NotificationPasswordResetRequestedEventPayload", { enumerable: true, get: function () { return notifications_kafka_payloads_1.NotificationPasswordResetRequestedEventPayload; } });
@@ -15,6 +15,7 @@ Object.defineProperty(exports, "EVENT_NOTIFICATIONS_CONVERSATION_HANDOFF_PUSH",
15
15
  Object.defineProperty(exports, "EVENT_NOTIFICATIONS_TENANT_AI_TOKENS_THRESHOLD", { enumerable: true, get: function () { return notifications_kafka_topics_1.EVENT_NOTIFICATIONS_TENANT_AI_TOKENS_THRESHOLD; } });
16
16
  var admin_broadcast_push_dto_1 = require("./admin-broadcast-push.dto");
17
17
  Object.defineProperty(exports, "AdminBroadcastPushDto", { enumerable: true, get: function () { return admin_broadcast_push_dto_1.AdminBroadcastPushDto; } });
18
+ Object.defineProperty(exports, "ADMIN_NOTIFICATION_KINDS", { enumerable: true, get: function () { return admin_broadcast_push_dto_1.ADMIN_NOTIFICATION_KINDS; } });
18
19
  var register_push_token_dto_1 = require("./register-push-token.dto");
19
20
  Object.defineProperty(exports, "RegisterPushTokenDto", { enumerable: true, get: function () { return register_push_token_dto_1.RegisterPushTokenDto; } });
20
21
  Object.defineProperty(exports, "NotificationsRegisterPushTokenKafkaDto", { enumerable: true, get: function () { return register_push_token_dto_1.NotificationsRegisterPushTokenKafkaDto; } });
@@ -1,9 +1,11 @@
1
+ import { type AdminNotificationKind } from './admin-broadcast-push.dto';
1
2
  /** Item retornado em GET /notifications (e RPC notifications.findAll). */
2
3
  export declare class NotificationListItemDto {
3
4
  id: string;
4
5
  notificationEvent: string;
5
6
  provider: string;
6
7
  status: string;
8
+ kind: AdminNotificationKind;
7
9
  createdAt: string;
8
10
  updatedAt: string;
9
11
  viewed: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"notification-list-item.dto.d.ts","sourceRoot":"","sources":["../../src/notifications/notification-list-item.dto.ts"],"names":[],"mappings":"AAEA,0EAA0E;AAC1E,qBAAa,uBAAuB;IAElC,EAAE,EAAE,MAAM,CAAC;IAGX,iBAAiB,EAAE,MAAM,CAAC;IAG1B,QAAQ,EAAE,MAAM,CAAC;IAGjB,MAAM,EAAE,MAAM,CAAC;IAGf,SAAS,EAAE,MAAM,CAAC;IAGlB,SAAS,EAAE,MAAM,CAAC;IAMlB,MAAM,EAAE,OAAO,CAAC;IAOhB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IAOxB,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAOvB,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAOtB,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACtB"}
1
+ {"version":3,"file":"notification-list-item.dto.d.ts","sourceRoot":"","sources":["../../src/notifications/notification-list-item.dto.ts"],"names":[],"mappings":"AACA,OAAO,EAA4B,KAAK,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAElG,0EAA0E;AAC1E,qBAAa,uBAAuB;IAElC,EAAE,EAAE,MAAM,CAAC;IAGX,iBAAiB,EAAE,MAAM,CAAC;IAG1B,QAAQ,EAAE,MAAM,CAAC;IAGjB,MAAM,EAAE,MAAM,CAAC;IAOf,IAAI,EAAE,qBAAqB,CAAC;IAG5B,SAAS,EAAE,MAAM,CAAC;IAGlB,SAAS,EAAE,MAAM,CAAC;IAMlB,MAAM,EAAE,OAAO,CAAC;IAOhB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IAOxB,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAOvB,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAOtB,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACtB"}
@@ -11,12 +11,14 @@ var __metadata = (this && this.__metadata) || function (k, v) {
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.NotificationListItemDto = void 0;
13
13
  const swagger_1 = require("@nestjs/swagger");
14
+ const admin_broadcast_push_dto_1 = require("./admin-broadcast-push.dto");
14
15
  /** Item retornado em GET /notifications (e RPC notifications.findAll). */
15
16
  class NotificationListItemDto {
16
17
  id;
17
18
  notificationEvent;
18
19
  provider;
19
20
  status;
21
+ kind;
20
22
  createdAt;
21
23
  updatedAt;
22
24
  viewed;
@@ -42,6 +44,14 @@ __decorate([
42
44
  (0, swagger_1.ApiProperty)({ enum: ['pending', 'sent', 'failed'] }),
43
45
  __metadata("design:type", String)
44
46
  ], NotificationListItemDto.prototype, "status", void 0);
47
+ __decorate([
48
+ (0, swagger_1.ApiProperty)({
49
+ description: 'Categoria de exibição no app.',
50
+ enum: admin_broadcast_push_dto_1.ADMIN_NOTIFICATION_KINDS,
51
+ default: 'notification',
52
+ }),
53
+ __metadata("design:type", String)
54
+ ], NotificationListItemDto.prototype, "kind", void 0);
45
55
  __decorate([
46
56
  (0, swagger_1.ApiProperty)({ example: '2026-04-08T12:00:00.000Z' }),
47
57
  __metadata("design:type", String)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tychat-contracts",
3
- "version": "1.3.7",
3
+ "version": "1.3.9",
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",
@@ -1,7 +1,8 @@
1
1
  // Allowed conversation session types.
2
2
  // "ia" → patient interacting with the AI.
3
3
  // "human" → human staff member responding to the patient.
4
- export const CONVERSATION_SESSION_TYPES = ['ia', 'human'] as const;
4
+ // "waiting" waiting queue for human handoff.
5
+ export const CONVERSATION_SESSION_TYPES = ['ia', 'human', 'waiting'] as const;
5
6
 
6
7
  // Backwards-compatible alias for session types.
7
8
  export const CONVERSATION_TYPES = CONVERSATION_SESSION_TYPES;
@@ -1,5 +1,13 @@
1
1
  import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
2
- import { IsBoolean, IsInt, IsNotEmpty, IsOptional, IsString, Min } from 'class-validator';
2
+ import {
3
+ IsBoolean,
4
+ IsInt,
5
+ IsNotEmpty,
6
+ IsOptional,
7
+ IsString,
8
+ MaxLength,
9
+ Min,
10
+ } from 'class-validator';
3
11
 
4
12
  /**
5
13
  * Represents a follow-up timing configuration for a tenant.
@@ -197,4 +205,77 @@ export class FollowupConfigResponseDto {
197
205
  @ApiProperty({ description: 'Whether abandonment follow-up is enabled for this tenant' })
198
206
  @IsBoolean()
199
207
  enabled: boolean;
208
+
209
+ @ApiProperty({
210
+ description:
211
+ 'Minutes to send warning when attendant sent the last message and patient did not reply',
212
+ example: 5,
213
+ })
214
+ @IsInt()
215
+ @Min(1)
216
+ humanPatientIdleWarningDelayMinutes: number;
217
+
218
+ @ApiProperty({
219
+ description:
220
+ 'Minutes after warning to finalize human attendance and return session to IA',
221
+ example: 10,
222
+ })
223
+ @IsInt()
224
+ @Min(1)
225
+ humanPatientIdleFinalizeDelayMinutes: number;
226
+
227
+ @ApiProperty({
228
+ description:
229
+ 'Minutes to requeue when patient sent the last message and attendant did not reply',
230
+ example: 15,
231
+ })
232
+ @IsInt()
233
+ @Min(1)
234
+ humanAttendantIdleRequeueDelayMinutes: number;
235
+
236
+ @ApiProperty({
237
+ description: 'Message sent as warning when patient is idle during human attendance',
238
+ example:
239
+ 'Ainda estamos aguardando sua resposta. Em alguns minutos, o atendimento humano sera finalizado caso nao haja retorno.',
240
+ })
241
+ @IsString()
242
+ @MaxLength(5000)
243
+ humanPatientIdleWarningMessage: string;
244
+
245
+ @ApiProperty({
246
+ description: 'Message sent when human attendance is finalized due to patient inactivity',
247
+ example:
248
+ 'Como nao recebemos seu retorno, encerramos o atendimento humano por agora. Se precisar, posso continuar seu atendimento por IA.',
249
+ })
250
+ @IsString()
251
+ @MaxLength(5000)
252
+ humanPatientIdleFinalizeMessage: string;
253
+
254
+ @ApiProperty({
255
+ description: 'Message sent when session is requeued due to attendant inactivity',
256
+ example:
257
+ 'Devido a alta demanda, outro atendente continuara seu atendimento em breve.',
258
+ })
259
+ @IsString()
260
+ @MaxLength(5000)
261
+ humanAttendantIdleRequeueMessage: string;
262
+
263
+ @ApiProperty({
264
+ description: 'Message sent when clinic is closed and session remains in waiting queue',
265
+ example:
266
+ 'Nosso horario de atendimento foi encerrado. Retornaremos o contato no proximo dia util.',
267
+ })
268
+ @IsString()
269
+ @MaxLength(5000)
270
+ humanAfterHoursWaitingMessage: string;
271
+
272
+ @ApiProperty({
273
+ description:
274
+ 'Message sent when patient requests human support outside clinic hours',
275
+ example:
276
+ 'No momento estamos fora do horario de atendimento humano. Sua conversa foi para a fila e retornaremos no proximo dia util.',
277
+ })
278
+ @IsString()
279
+ @MaxLength(5000)
280
+ humanRequestOutsideHoursMessage: string;
200
281
  }
@@ -3,6 +3,7 @@ import {
3
3
  ArrayMinSize,
4
4
  IsArray,
5
5
  IsBoolean,
6
+ IsIn,
6
7
  IsObject,
7
8
  IsOptional,
8
9
  IsString,
@@ -11,6 +12,9 @@ import {
11
12
  ValidateIf,
12
13
  } from 'class-validator';
13
14
 
15
+ export const ADMIN_NOTIFICATION_KINDS = ['notification', 'alert'] as const;
16
+ export type AdminNotificationKind = (typeof ADMIN_NOTIFICATION_KINDS)[number];
17
+
14
18
  /**
15
19
  * Pedido de envio em massa de push (FCM) disparado pelo painel admin.
16
20
  * O tenant-service publica no Kafka; o notifications-service consome e envia.
@@ -54,6 +58,16 @@ export class AdminBroadcastPushDto {
54
58
  @MaxLength(4000)
55
59
  body!: string;
56
60
 
61
+ @ApiPropertyOptional({
62
+ description: 'Categoria de entrega no app (notification = centro; alert = modal no login).',
63
+ enum: ADMIN_NOTIFICATION_KINDS,
64
+ default: 'notification',
65
+ })
66
+ @IsOptional()
67
+ @IsString()
68
+ @IsIn(ADMIN_NOTIFICATION_KINDS)
69
+ notificationKind?: AdminNotificationKind;
70
+
57
71
  @ApiPropertyOptional({
58
72
  description: 'Payload FCM `data` (valores devem ser strings)',
59
73
  type: 'object',
@@ -12,7 +12,11 @@ export {
12
12
  EVENT_NOTIFICATIONS_CONVERSATION_HANDOFF_PUSH,
13
13
  EVENT_NOTIFICATIONS_TENANT_AI_TOKENS_THRESHOLD,
14
14
  } from './notifications-kafka-topics';
15
- export { AdminBroadcastPushDto } from './admin-broadcast-push.dto';
15
+ export {
16
+ AdminBroadcastPushDto,
17
+ ADMIN_NOTIFICATION_KINDS,
18
+ type AdminNotificationKind,
19
+ } from './admin-broadcast-push.dto';
16
20
  export {
17
21
  RegisterPushTokenDto,
18
22
  NotificationsRegisterPushTokenKafkaDto,
@@ -1,4 +1,5 @@
1
1
  import { ApiProperty } from '@nestjs/swagger';
2
+ import { ADMIN_NOTIFICATION_KINDS, type AdminNotificationKind } from './admin-broadcast-push.dto';
2
3
 
3
4
  /** Item retornado em GET /notifications (e RPC notifications.findAll). */
4
5
  export class NotificationListItemDto {
@@ -14,6 +15,13 @@ export class NotificationListItemDto {
14
15
  @ApiProperty({ enum: ['pending', 'sent', 'failed'] })
15
16
  status: string;
16
17
 
18
+ @ApiProperty({
19
+ description: 'Categoria de exibição no app.',
20
+ enum: ADMIN_NOTIFICATION_KINDS,
21
+ default: 'notification',
22
+ })
23
+ kind: AdminNotificationKind;
24
+
17
25
  @ApiProperty({ example: '2026-04-08T12:00:00.000Z' })
18
26
  createdAt: string;
19
27