@trii/types 2.10.822 → 2.10.824

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,4 +1,16 @@
1
- export interface IDevice {
1
+ export type DeviceClientKind = 'web' | 'mobileApp';
2
+ /** Optional installation details as reported by the client, when available. */
3
+ export interface DeviceClientInfo {
4
+ clientKind?: DeviceClientKind | null;
5
+ deviceModel?: string | null;
6
+ osName?: string | null;
7
+ osVersion?: string | null;
8
+ browserName?: string | null;
9
+ browserVersion?: string | null;
10
+ /** Version of the Trii client, independent of the browser version. */
11
+ appVersion?: string | null;
12
+ }
13
+ export interface IDevice extends DeviceClientInfo {
2
14
  id: string;
3
15
  uid: string;
4
16
  /** Generated once per client installation and reused when the push token changes. */
@@ -12,7 +24,7 @@ export interface IDevice {
12
24
  updatedAt?: string | null;
13
25
  }
14
26
  /** Payload for device registration. Older clients may send only the token. */
15
- export type DeviceRegistration = Pick<IDevice, 'token' | 'installationId'>;
27
+ export type DeviceRegistration = Pick<IDevice, 'token' | 'installationId'> & DeviceClientInfo;
16
28
  export declare enum DeviceType {
17
29
  MOBILE_ANDROID = 11,
18
30
  MOBILE_IOS = 12,
@@ -210,9 +210,19 @@ export interface MessageEmail {
210
210
  isSpam?: boolean;
211
211
  /**Puntuación de spam (opcional) */
212
212
  spamScore?: number;
213
+ /** Correo importado en la sincronización inicial de la casilla. */
214
+ isInitialSync?: boolean;
215
+ /** Id inmutable del proveedor (Gmail id, Graph id, "{uidValidity}:{uid}" IMAP). No es Message-ID. */
216
+ providerMessageId?: string | null;
217
+ /** Legado: copias por destinatario del envío actual. No usar para hilos. */
218
+ relatedMessages?: MessageEmailRelated[];
213
219
  bodyJson?: string;
214
220
  projectData?: string;
215
221
  }
222
+ export interface MessageEmailRelated {
223
+ messageId: string;
224
+ shardKey: string;
225
+ }
216
226
  export interface EmailDocument {
217
227
  id: string;
218
228
  /**The name for the file*/
@@ -554,6 +564,12 @@ export interface IMessage {
554
564
  */
555
565
  references?: MessageRelatedResource[];
556
566
  messageReference?: MessageReference;
567
+ /**
568
+ * Identidad del mensaje dentro de su hilo y evidencia para resolver la conversación.
569
+ * Común a todos los canales. Ausente en mensajes anteriores al contrato.
570
+ * La autoridad sigue siendo conversationId; no reemplaza a references.
571
+ */
572
+ thread?: MessageThread | null;
557
573
  /**
558
574
  * Selección realizada por el usuario, como un botón o una opción de lista.
559
575
  * Conserva el valor devuelto por el proveedor y el texto visible.
@@ -571,6 +587,34 @@ export interface IMessage {
571
587
  updatedAt?: Date;
572
588
  updatedBy?: UserInfo;
573
589
  }
590
+ export type MessageThreadResolutionMethod = "provided" | "in_reply_to" | "references" | "external_thread" | "channel_rule" | "new_conversation" | "conflict";
591
+ /**
592
+ * Identidad de un mensaje dentro de su hilo (Conversation).
593
+ * Email: key = Message-ID, inReplyTo = In-Reply-To, references = References.
594
+ * WhatsApp: key = wamid, inReplyTo = context.id.
595
+ */
596
+ export interface MessageThread {
597
+ /** Clave con la que otros mensajes del mismo canal referencian a este. Única dentro de spaceId + canal. */
598
+ key?: string | null;
599
+ /** false: clave generada por Trii no confirmada por el proveedor. */
600
+ keyConfirmed?: boolean | null;
601
+ /** Claves del mensaje respondido. */
602
+ inReplyTo: string[];
603
+ /** Cadena de claves del hilo, más antigua primero. */
604
+ references: string[];
605
+ /** Id del hilo en el proveedor, en el namespace del canal. */
606
+ externalThreadId?: string | null;
607
+ /** Lo escribe message-processor al resolver conversationId. */
608
+ resolution?: MessageThreadResolution | null;
609
+ }
610
+ export interface MessageThreadResolution {
611
+ method: MessageThreadResolutionMethod | (string & {});
612
+ matchedKey?: string | null;
613
+ /** Solo con method = conflict. */
614
+ conflictingConversationIds?: string[] | null;
615
+ reopened: boolean;
616
+ resolvedAt: Date;
617
+ }
574
618
  export interface MessageInteraction {
575
619
  type: "button_reply" | "list_reply";
576
620
  value: string;
@@ -43,6 +43,11 @@ export interface IConversation {
43
43
  externalThreadId?: string | null;
44
44
  /** OpenMessaging: datos del hilo que mantiene channel-openmessaging. Null en los demás canales. */
45
45
  openMessaging?: IConversationOpenMessaging | null;
46
+ /**
47
+ * Referencias del hilo del proveedor para resolver próximos mensajes del mismo canal.
48
+ * Dato interno de resolución: las APIs de lectura del frontend no lo exponen.
49
+ */
50
+ externalThread?: ConversationExternalThread | null;
46
51
  channelInfo: Channels.IChannelInfo;
47
52
  status: ConversationStatus;
48
53
  priority: 'low' | 'normal' | 'high' | 'urgent';
@@ -116,6 +121,22 @@ export interface IConversation {
116
121
  lastCommentId?: string | null;
117
122
  }
118
123
  export type InteractionKind = 'private' | 'wall_post' | 'comment' | 'mention';
124
+ /** Límite de claves en ConversationExternalThread.keys. */
125
+ export declare const CONVERSATION_EXTERNAL_THREAD_MAX_KEYS = 200;
126
+ /**
127
+ * Referencias del hilo del proveedor guardadas en la conversación.
128
+ * Búsqueda siempre dentro de spaceId + channelInfo.id.
129
+ */
130
+ export interface ConversationExternalThread {
131
+ /** Id del hilo en el proveedor. Generaliza externalThreadId. */
132
+ threadId?: string | null;
133
+ /** Primera clave conocida del hilo. Nunca se descarta. */
134
+ rootKey?: string | null;
135
+ /** Claves de mensajes (Message.thread.key), más recientes al final. Solo canales con hilo real (email). */
136
+ keys: string[];
137
+ keysTruncated: boolean;
138
+ updatedAt: Date;
139
+ }
119
140
  /** Hilo de OpenMessaging. Lo escribe channel-openmessaging al crear la conversación. */
120
141
  export interface IConversationOpenMessaging {
121
142
  /** Usuario de la app dueño del hilo; no cambia. Es el contacto de la conversación. */
@@ -1,6 +1,21 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ConversationStatus = exports.AssignMethod = exports.ConversationDirection = exports.ConversationBotStatus = void 0;
3
+ exports.ConversationStatus = exports.AssignMethod = exports.ConversationDirection = exports.ConversationBotStatus = exports.CONVERSATION_EXTERNAL_THREAD_MAX_KEYS = void 0;
4
+ // export enum ConversationContextType {
5
+ // TICKET = 'TICKET',
6
+ // CONVERSATION = 'CONVERSATION',
7
+ // LEAD = 'LEAD',
8
+ // DEBT = 'DEBT',
9
+ // }
10
+ // export interface IConversationContextReference {
11
+ // entityType: ConversationContextType;
12
+ // entityId: string;
13
+ // role?: string;
14
+ // linkedAt: Date;
15
+ // linkedBy?: string;
16
+ // }
17
+ /** Límite de claves en ConversationExternalThread.keys. */
18
+ exports.CONVERSATION_EXTERNAL_THREAD_MAX_KEYS = 200;
4
19
  /** @deprecated Estado legacy. Usar ConversationAutomationStatus para ejecuciones nuevas. */
5
20
  var ConversationBotStatus;
6
21
  (function (ConversationBotStatus) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trii/types",
3
- "version": "2.10.822",
3
+ "version": "2.10.824",
4
4
  "description": "Types definitions for Trii projects - ",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",