@trii/types 2.10.824 → 2.11.0

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.
@@ -49,6 +49,7 @@ interface IChannelInfo {
49
49
  interface ChannelConversationRoutingConfig {
50
50
  /** Stable id of a ConversationQueue in the same space as the channel. */
51
51
  defaultQueueId: string;
52
+ defaultOwnerUserId?: string | null;
52
53
  }
53
54
  interface IChannel {
54
55
  id?: string | null;
@@ -1,5 +1,5 @@
1
1
  import { IEventType } from "../../Calendar/Event";
2
- import { IContactAddress } from "../../Contacts/contacts";
2
+ import { IChannelIdentity } from "../../Contacts/contacts";
3
3
  import { UserInfo } from "../../Users/UserTrii";
4
4
  import { IChannelInfo } from "../Channels/Channel";
5
5
  export interface CommentData {
@@ -189,11 +189,11 @@ export interface MessageEmail {
189
189
  /**Remitente del correo */
190
190
  from: string;
191
191
  /**Lista de destinatarios (puede ser uno o varios) */
192
- to: IContactAddress[];
192
+ to: IChannelIdentity[];
193
193
  /**Lista de destinatarios en copia (opcional) */
194
- cc?: IContactAddress[];
194
+ cc?: IChannelIdentity[];
195
195
  /**Lista de destinatarios en copia oculta (opcional) */
196
- bcc?: IContactAddress[];
196
+ bcc?: IChannelIdentity[];
197
197
  /**Asunto del correo */
198
198
  subject: string;
199
199
  preHeader: string;
@@ -4,7 +4,7 @@ export interface IContactInfo {
4
4
  name: string;
5
5
  imageUrl?: string;
6
6
  isBusiness: boolean | false;
7
- contactAddresses: IContactAddress[];
7
+ contactAddresses: IChannelIdentity[];
8
8
  businessName?: string;
9
9
  businessId?: string;
10
10
  }
@@ -17,15 +17,15 @@ export interface IBusiness {
17
17
  ownerUserId?: string;
18
18
  membersId: string[];
19
19
  members: IContactInfo[];
20
- phones: IContactAddress[];
21
- emails: IContactAddress[];
22
- ims_instagram: IContactAddress[];
23
- ims_facebook: IContactAddress[];
24
- ims_webchat: IContactAddress[];
25
- ims_whatsapp: IContactAddress[];
26
- ims_mercadolibre: IContactAddress[];
27
- ims_rcs: IContactAddress[];
28
- ims_openmessaging: IContactAddress[];
20
+ phones: IChannelIdentity[];
21
+ emails: IChannelIdentity[];
22
+ ims_instagram: IChannelIdentity[];
23
+ ims_facebook: IChannelIdentity[];
24
+ ims_webchat: IChannelIdentity[];
25
+ ims_whatsapp: IChannelIdentity[];
26
+ ims_mercadolibre: IChannelIdentity[];
27
+ ims_rcs: IChannelIdentity[];
28
+ ims_openmessaging: IChannelIdentity[];
29
29
  address1: IContactPostalAddress;
30
30
  address2: IContactPostalAddress;
31
31
  tags: IContactTag[];
@@ -58,17 +58,17 @@ export interface IContact {
58
58
  ownerUserId?: string;
59
59
  businessId?: string;
60
60
  businessName?: string;
61
- phones: IContactAddress[];
62
- emails: IContactAddress[];
61
+ phones: IChannelIdentity[];
62
+ emails: IChannelIdentity[];
63
63
  /** Email the contact uses to log in to the customer portal. */
64
64
  customerPortalLogin?: string;
65
- ims_instagram: IContactAddress[];
66
- ims_facebook: IContactAddress[];
67
- ims_webchat: IContactAddress[];
68
- ims_whatsapp: IContactAddress[];
69
- ims_mercadolibre: IContactAddress[];
70
- ims_rcs: IContactAddress[];
71
- ims_openmessaging: IContactAddress[];
65
+ ims_instagram: IChannelIdentity[];
66
+ ims_facebook: IChannelIdentity[];
67
+ ims_webchat: IChannelIdentity[];
68
+ ims_whatsapp: IChannelIdentity[];
69
+ ims_mercadolibre: IChannelIdentity[];
70
+ ims_rcs: IChannelIdentity[];
71
+ ims_openmessaging: IChannelIdentity[];
72
72
  address1: IContactPostalAddress;
73
73
  address2: IContactPostalAddress;
74
74
  tags: IContactTag[];
@@ -168,7 +168,14 @@ export declare enum ContactField_type {
168
168
  LIST_SINGLE = 31,
169
169
  LIST_OBJECT = 32
170
170
  }
171
- export interface IContactAddress {
171
+ /**
172
+ * ChannelIdentity = identidad externa en un canal (email, teléfono, PSID de FB, IGSID, bsuid de WhatsApp…).
173
+ * Existe sin contacto y puede estar vinculada a 0..N contactos.
174
+ * Antes IContactAddress: se renombró solo el tipo; la colección Mongo ("ContactAddresses") y los nombres de
175
+ * propiedades que la referencian (contactAddresses, contactAddress, contactAddressId, emails, phones, ims_*)
176
+ * no cambian.
177
+ */
178
+ export interface IChannelIdentity {
172
179
  id: string;
173
180
  channelType: Common.Channels.ChannelType;
174
181
  /**
@@ -6,7 +6,7 @@ import type { ConversationSlaSnapshot, ConversationSlaStatus } from './Conversat
6
6
  import { ILabel } from "./Label";
7
7
  import { GroupInfo } from "./Groups/Group";
8
8
  import { Channels } from "../Common/index";
9
- import { IContactAddress, IContactInfo } from "../Contacts/contacts";
9
+ import { IChannelIdentity, IContactInfo } from "../Contacts/contacts";
10
10
  import { IEnding } from "./Ending";
11
11
  import { ChatType } from "../Chats/Chat";
12
12
  import { TransferConversationCommand, TransferConversationResult } from "./Transfer";
@@ -48,6 +48,20 @@ export interface IConversation {
48
48
  * Dato interno de resolución: las APIs de lectura del frontend no lo exponen.
49
49
  */
50
50
  externalThread?: ConversationExternalThread | null;
51
+ /**
52
+ * Direcciones externas del hilo (remitente, Para y CC externos; nunca CCO).
53
+ * Ausente o vacía en conversaciones anteriores: usar remoteAddress/contactInfo.
54
+ */
55
+ addresses?: ConversationAddress[];
56
+ /** true si se dejaron de agregar direcciones por superar CONVERSATION_MAX_ADDRESSES. */
57
+ addressesTruncated?: boolean;
58
+ /**
59
+ * Contactos asociados (0..N). Independientes de addresses.
60
+ * contactInfo es la proyección legada: solo con exactamente un contacto.
61
+ */
62
+ contacts?: ConversationContact[];
63
+ /** Contactos descartados por un agente; no se vuelven a sugerir ni asociar. Solo en el detalle. */
64
+ dismissedContactIds?: string[];
51
65
  channelInfo: Channels.IChannelInfo;
52
66
  status: ConversationStatus;
53
67
  priority: 'low' | 'normal' | 'high' | 'urgent';
@@ -121,6 +135,36 @@ export interface IConversation {
121
135
  lastCommentId?: string | null;
122
136
  }
123
137
  export type InteractionKind = 'private' | 'wall_post' | 'comment' | 'mention';
138
+ /** Límite de direcciones por conversación. */
139
+ export declare const CONVERSATION_MAX_ADDRESSES = 50;
140
+ /** Límite de contactos por conversación. */
141
+ export declare const CONVERSATION_MAX_CONTACTS = 50;
142
+ export type ConversationContactOrigin = 'auto_match' | 'manual' | 'migration';
143
+ /** Dirección externa que participa del hilo. Snapshot de IChannelIdentity. */
144
+ export interface ConversationAddress {
145
+ /** IChannelIdentity.id (colección "ContactAddresses"). */
146
+ channelIdentityId: string;
147
+ channelType: Channels.ChannelType;
148
+ /** Normalizada; clave de búsqueda. Email: completa en minúsculas. */
149
+ address: string;
150
+ /** Texto recibido, para mostrar. */
151
+ originalAddress?: string | null;
152
+ displayName?: string | null;
153
+ /** Cuándo la dirección entró a esta conversación. Se escribe una vez; la actividad vive en IChannelIdentity. */
154
+ addedAt: Date;
155
+ }
156
+ /** Contacto del CRM asociado a la conversación. */
157
+ export interface ConversationContact {
158
+ contactId: string;
159
+ name?: string | null;
160
+ imageUrl?: string | null;
161
+ origin: ConversationContactOrigin | (string & {});
162
+ /** Direcciones por las que se asoció; vacía en asociación manual sin coincidencia. */
163
+ viaChannelIdentityIds: string[];
164
+ associatedAt: Date;
165
+ /** userId del agente; null para auto_match y migración. */
166
+ associatedBy?: string | null;
167
+ }
124
168
  /** Límite de claves en ConversationExternalThread.keys. */
125
169
  export declare const CONVERSATION_EXTERNAL_THREAD_MAX_KEYS = 200;
126
170
  /**
@@ -153,7 +197,7 @@ export interface IWhatsAppGroupInfo {
153
197
  description: string;
154
198
  }
155
199
  export interface IWhatsAppGroupMember {
156
- contactAddress: IContactAddress;
200
+ contactAddress: IChannelIdentity;
157
201
  contactId: string;
158
202
  name: string;
159
203
  contactInfo: IContactInfo;
@@ -354,6 +398,7 @@ export type ConversationAssignmentSnapshot = {
354
398
  acceptedAt?: never;
355
399
  } | QueuedConversationAssignmentBase & {
356
400
  status: 'queued' | 'routing';
401
+ initialChannelOwnerUserId?: ID;
357
402
  owner: NoConversationOwner;
358
403
  offeredAt?: never;
359
404
  offerExpiresAt?: never;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ConversationStatus = exports.AssignMethod = exports.ConversationDirection = exports.ConversationBotStatus = exports.CONVERSATION_EXTERNAL_THREAD_MAX_KEYS = void 0;
3
+ exports.ConversationStatus = exports.AssignMethod = exports.ConversationDirection = exports.ConversationBotStatus = exports.CONVERSATION_EXTERNAL_THREAD_MAX_KEYS = exports.CONVERSATION_MAX_CONTACTS = exports.CONVERSATION_MAX_ADDRESSES = void 0;
4
4
  // export enum ConversationContextType {
5
5
  // TICKET = 'TICKET',
6
6
  // CONVERSATION = 'CONVERSATION',
@@ -14,6 +14,10 @@ exports.ConversationStatus = exports.AssignMethod = exports.ConversationDirectio
14
14
  // linkedAt: Date;
15
15
  // linkedBy?: string;
16
16
  // }
17
+ /** Límite de direcciones por conversación. */
18
+ exports.CONVERSATION_MAX_ADDRESSES = 50;
19
+ /** Límite de contactos por conversación. */
20
+ exports.CONVERSATION_MAX_CONTACTS = 50;
17
21
  /** Límite de claves en ConversationExternalThread.keys. */
18
22
  exports.CONVERSATION_EXTERNAL_THREAD_MAX_KEYS = 200;
19
23
  /** @deprecated Estado legacy. Usar ConversationAutomationStatus para ejecuciones nuevas. */
@@ -102,7 +102,7 @@ export interface RouteConversationCommand {
102
102
  party: RoutingPartyContext;
103
103
  requestedAt: Date;
104
104
  }
105
- export type RoutingSelectionSource = 'party_owner' | 'strategy' | 'fallback';
105
+ export type RoutingSelectionSource = 'channel_owner' | 'party_owner' | 'strategy' | 'fallback';
106
106
  export type PartyOwnerResolutionFailure = 'party_not_found' | 'party_without_owner' | 'owner_user_not_found' | 'not_authorized' | 'not_participating' | 'unavailable' | 'channel_ineligible' | 'capacity_exhausted';
107
107
  type FailedPartyOwnerEvaluation = {
108
108
  party: Extract<RoutingPartyContext, {
@@ -41,7 +41,7 @@ export interface ISubscriberSubscription {
41
41
  }
42
42
  export interface ISubscriberContactLink {
43
43
  contactId: string;
44
- /** IContactAddress.id de la dirección. */
44
+ /** IChannelIdentity.id de la dirección. */
45
45
  contactAddressId: string;
46
46
  linkedAt: CampaignTimestamp;
47
47
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trii/types",
3
- "version": "2.10.824",
3
+ "version": "2.11.0",
4
4
  "description": "Types definitions for Trii projects - ",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",