@trii/types 2.10.754 → 2.10.755
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/dist/Conversations/Conversation.d.ts +27 -3
- package/dist/Conversations/Conversation.js +1 -0
- package/dist/Conversations/ConversationAutomationState.d.ts +27 -0
- package/dist/Conversations/ConversationAutomationState.js +2 -0
- package/dist/Conversations/ConversationSlaClockState.d.ts +21 -0
- package/dist/Conversations/Sla.d.ts +13 -1
- package/dist/Conversations/index.d.ts +1 -0
- package/dist/Conversations/index.js +1 -0
- package/package.json +1 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { UserInfo } from "../Users/UserTrii";
|
|
2
2
|
import type { ConversationReadState } from './ConversationReadState';
|
|
3
|
+
import type { ConversationAutomationState } from './ConversationAutomationState';
|
|
3
4
|
import type { ConversationPendingTransfer } from './ConversationPendingTransfer';
|
|
4
5
|
import type { ConversationSlaSnapshot, ConversationSlaStatus } from './ConversationSlaClockState';
|
|
5
6
|
import { ILabel } from "./Label";
|
|
@@ -65,9 +66,22 @@ export interface IConversation {
|
|
|
65
66
|
archived: boolean;
|
|
66
67
|
spam: boolean;
|
|
67
68
|
externalMessagingWindowEndAt?: Date;
|
|
69
|
+
/**
|
|
70
|
+
* Automatización que controla la conversación; null si no hay ejecución registrada.
|
|
71
|
+
* Actualizar con control de version y executionId para rechazar eventos antiguos.
|
|
72
|
+
*/
|
|
73
|
+
automation?: ConversationAutomationState | null;
|
|
74
|
+
/** @deprecated Id de ejecución legacy. Usar automation.executionId. */
|
|
68
75
|
workflowId?: string;
|
|
76
|
+
/** @deprecated Usar automation.status; con automation presente no controla SLA. */
|
|
69
77
|
botStatus: ConversationBotStatus;
|
|
70
|
-
|
|
78
|
+
/**
|
|
79
|
+
* Datos relevantes para atender esta conversación, de solo lectura en el CRM.
|
|
80
|
+
* No almacena variables internas del flujo ni reemplaza datos de Contact.
|
|
81
|
+
* Cada key es única: publicar nuevamente la misma clave actualiza el dato.
|
|
82
|
+
* Se conservan al finalizar la automatización.
|
|
83
|
+
*/
|
|
84
|
+
contextFields: ConversationContextField[];
|
|
71
85
|
metadata: IConversationMetadata;
|
|
72
86
|
/** Domain objects discussed or served by this conversation. */
|
|
73
87
|
finalizedOnWebChat: Date;
|
|
@@ -146,6 +160,7 @@ export interface IConversationMetadata {
|
|
|
146
160
|
sessionId?: string;
|
|
147
161
|
screenResolution?: string;
|
|
148
162
|
}
|
|
163
|
+
/** @deprecated Estado legacy. Usar ConversationAutomationStatus para ejecuciones nuevas. */
|
|
149
164
|
export declare enum ConversationBotStatus {
|
|
150
165
|
NONE = 0,
|
|
151
166
|
WAITING = 1,
|
|
@@ -153,9 +168,18 @@ export declare enum ConversationBotStatus {
|
|
|
153
168
|
FINALIZED = 4,
|
|
154
169
|
CANCELED = 5
|
|
155
170
|
}
|
|
156
|
-
|
|
157
|
-
|
|
171
|
+
/** Dato publicado explícitamente para la atención de la conversación. */
|
|
172
|
+
export interface ConversationContextField {
|
|
173
|
+
/** Clave estable y única dentro de la conversación. Ejemplo: motivo_consulta. */
|
|
174
|
+
key: string;
|
|
175
|
+
/** Etiqueta visible para el usuario del CRM. */
|
|
176
|
+
label: string;
|
|
177
|
+
/** Valor de texto preparado para mostrar. */
|
|
158
178
|
value: string;
|
|
179
|
+
/** Fecha UTC de la última actualización del dato. */
|
|
180
|
+
updatedAt: Date;
|
|
181
|
+
/** Ejecución que lo publicó; null para otro origen. Se conserva al terminar o cambiar la ejecución. */
|
|
182
|
+
automationExecutionId?: string | null;
|
|
159
183
|
}
|
|
160
184
|
/**
|
|
161
185
|
* @deprecated Legacy channel assignment configuration. Use QueueRoutingConfig.
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ConversationStatus = exports.AssignMethod = exports.ConversationDirection = exports.ConversationBotStatus = void 0;
|
|
4
|
+
/** @deprecated Estado legacy. Usar ConversationAutomationStatus para ejecuciones nuevas. */
|
|
4
5
|
var ConversationBotStatus;
|
|
5
6
|
(function (ConversationBotStatus) {
|
|
6
7
|
ConversationBotStatus[ConversationBotStatus["NONE"] = 0] = "NONE";
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export type ConversationAutomationStatus = 'running' | 'completed' | 'cancelled' | 'failed';
|
|
2
|
+
/**
|
|
3
|
+
* Automatización que controla la conversación, como máximo una a la vez.
|
|
4
|
+
* No representa tareas auxiliares en segundo plano ni su historial.
|
|
5
|
+
* running incluye esperas internas y reintentos; failed significa fallo terminal.
|
|
6
|
+
*/
|
|
7
|
+
export interface ConversationAutomationState {
|
|
8
|
+
/**
|
|
9
|
+
* Id de ejecución (WorkFlow.id), no de definición del flujo.
|
|
10
|
+
* Una ejecución nueva reemplaza este objeto con otro executionId.
|
|
11
|
+
* Eventos de otra ejecución no pueden modificar el estado ni reanudar sus SLA.
|
|
12
|
+
*/
|
|
13
|
+
workflowId: string;
|
|
14
|
+
/**
|
|
15
|
+
* Solo running pausa SLA humanos de respuesta. completed incluye la derivación efectiva
|
|
16
|
+
* a un humano. Ningún estado terminal finaliza por sí solo la conversación.
|
|
17
|
+
*/
|
|
18
|
+
status: ConversationAutomationStatus;
|
|
19
|
+
/** Fecha efectiva UTC en que tomó el control, no la recepción del evento. */
|
|
20
|
+
startedAt: Date;
|
|
21
|
+
/**
|
|
22
|
+
* Null mientras running; obligatoria en estados terminales y no anterior a startedAt.
|
|
23
|
+
* Fecha efectiva UTC de devolución del control. Conservar el objeto terminal hasta
|
|
24
|
+
* la siguiente ejecución permite reconocer eventos atrasados.
|
|
25
|
+
*/
|
|
26
|
+
endedAt?: Date | null;
|
|
27
|
+
}
|
|
@@ -22,6 +22,13 @@ export interface ConversationSlaClockState {
|
|
|
22
22
|
warningAt?: Date | null;
|
|
23
23
|
/** Current pause only; clear on resume. */
|
|
24
24
|
pausedAt?: Date | null;
|
|
25
|
+
/**
|
|
26
|
+
* Causas activas, no historial. Un reloj pendiente permanece paused mientras alguna sea true.
|
|
27
|
+
* Actualizar con status, pausedAt, deadlines y resumen en la misma escritura.
|
|
28
|
+
* Completar/cancelar limpia las causas. Un paused legacy sin causas requiere migración;
|
|
29
|
+
* no asumir pausa de automatización ni reanudarlo automáticamente.
|
|
30
|
+
*/
|
|
31
|
+
pauseReasons: ConversationSlaPauseReasons;
|
|
25
32
|
/** Chargeable seconds through elapsedCalculatedAt, within JS safe integer range. */
|
|
26
33
|
elapsedSeconds: number;
|
|
27
34
|
/** Accounting watermark; on resume reset to resume time preserving consumed seconds. */
|
|
@@ -30,6 +37,20 @@ export interface ConversationSlaClockState {
|
|
|
30
37
|
completedAt?: Date | null;
|
|
31
38
|
cancelledAt?: Date | null;
|
|
32
39
|
}
|
|
40
|
+
/** Las causas pueden coexistir; cada operación agrega o retira únicamente la suya. */
|
|
41
|
+
export interface ConversationSlaPauseReasons {
|
|
42
|
+
/** Se retira solo por una reanudación manual autorizada. */
|
|
43
|
+
manual: boolean;
|
|
44
|
+
/** La política pauseOnStatuses exige pausa en el estado actual de Conversation. */
|
|
45
|
+
conversationStatus: boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Solo first_response/next_response mientras automation.status sea running,
|
|
48
|
+
* incluidos relojes que nacen durante la ejecución. Al terminar, retirar esta causa
|
|
49
|
+
* conservando ciclo, consumo y breachedAt, aunque onResume sea restart.
|
|
50
|
+
* Si queda otra causa, continúa pausado. No afecta assignment/acceptance/resolution.
|
|
51
|
+
*/
|
|
52
|
+
automation: boolean;
|
|
53
|
+
}
|
|
33
54
|
/** Summary updated atomically with clocks; never an independent state source. */
|
|
34
55
|
export interface ConversationSlaSnapshot {
|
|
35
56
|
/** Precedence: breached, active warning, running, paused, met, cancelled, none. */
|
|
@@ -135,7 +135,13 @@ export interface PublishConversationSlaPolicyVersionRequest {
|
|
|
135
135
|
definition: ConversationSlaPolicyDefinitionInput;
|
|
136
136
|
}
|
|
137
137
|
export type ConversationSlaClockAction = 'start' | 'evaluate' | 'pause' | 'resume' | 'complete' | 'recalculate' | 'cancel';
|
|
138
|
-
export type ConversationSlaClockReason = 'conversation_created' | 'conversation_enqueued' | 'customer_message'
|
|
138
|
+
export type ConversationSlaClockReason = 'conversation_created' | 'conversation_enqueued' | 'customer_message'
|
|
139
|
+
/** Solo respuesta humana aceptada por el proveedor; IA, flujos y notas internas no califican. */
|
|
140
|
+
| 'agent_response' | 'assignment_changed' | 'status_changed' | 'queue_transfer' | 'conversation_reopened' | 'deadline_due' | 'policy_override'
|
|
141
|
+
/** La ejecución toma control; pausa solo first_response/next_response. */
|
|
142
|
+
| 'automation_started'
|
|
143
|
+
/** Fin, cancelación, fallo terminal o derivación; retira solo la pausa de automatización. */
|
|
144
|
+
| 'automation_finished';
|
|
139
145
|
/**
|
|
140
146
|
* Idempotent input for the conversation-sla-worker.
|
|
141
147
|
* policyId/policyVersion identify the immutable policy snapshot to apply.
|
|
@@ -152,6 +158,12 @@ export interface SlaClockCommand {
|
|
|
152
158
|
policyId: ID;
|
|
153
159
|
policyVersion: number;
|
|
154
160
|
queueId?: ID;
|
|
161
|
+
/**
|
|
162
|
+
* Obligatorio para automation_started/automation_finished; null para otros motivos.
|
|
163
|
+
* Debe coincidir con Conversation.automation.executionId; descartar eventos de otra ejecución.
|
|
164
|
+
* occurredAt es la fecha efectiva del cambio; el fin conserva el tiempo SLA consumido.
|
|
165
|
+
*/
|
|
166
|
+
automationExecutionId?: ID | null;
|
|
155
167
|
occurredAt: Date;
|
|
156
168
|
requestedAt: Date;
|
|
157
169
|
}
|
|
@@ -2,6 +2,7 @@ export * as Flows from './Flows/index';
|
|
|
2
2
|
export * as Groups from './Groups/Group';
|
|
3
3
|
export * from './Assignment';
|
|
4
4
|
export * from './Conversation';
|
|
5
|
+
export * from './ConversationAutomationState';
|
|
5
6
|
export * from './InboxQueries';
|
|
6
7
|
export * from './ConversationReadState';
|
|
7
8
|
export * from './ConversationPendingTransfer';
|
|
@@ -41,6 +41,7 @@ exports.Flows = __importStar(require("./Flows/index"));
|
|
|
41
41
|
exports.Groups = __importStar(require("./Groups/Group"));
|
|
42
42
|
__exportStar(require("./Assignment"), exports);
|
|
43
43
|
__exportStar(require("./Conversation"), exports);
|
|
44
|
+
__exportStar(require("./ConversationAutomationState"), exports);
|
|
44
45
|
__exportStar(require("./InboxQueries"), exports);
|
|
45
46
|
__exportStar(require("./ConversationReadState"), exports);
|
|
46
47
|
__exportStar(require("./ConversationPendingTransfer"), exports);
|