@trii/types 2.10.679 → 2.10.681
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.
|
@@ -4,10 +4,13 @@ import { GroupInfo } from "./Groups/Group";
|
|
|
4
4
|
import { Channels } from "../Common/index";
|
|
5
5
|
import { IContactAddress, IContactInfo } from "../Contacts/contacts";
|
|
6
6
|
import { IEnding } from "./Ending";
|
|
7
|
+
import { ChatType } from "../Chats/Chat";
|
|
7
8
|
export interface IConversation {
|
|
8
9
|
id: string;
|
|
9
10
|
spaceId: string;
|
|
10
11
|
version: number;
|
|
12
|
+
/** @deprecated Use assignment.owner. */
|
|
13
|
+
type: ChatType;
|
|
11
14
|
/**only for Front-End */
|
|
12
15
|
chatName: string;
|
|
13
16
|
chatImage: string;
|
|
@@ -21,6 +24,8 @@ export interface IConversation {
|
|
|
21
24
|
status: ConversationStatus;
|
|
22
25
|
priority: 'low' | 'normal' | 'high' | 'urgent';
|
|
23
26
|
assignment: ConversationAssignmentSnapshot;
|
|
27
|
+
/** @deprecated Use owner and assignment.*/
|
|
28
|
+
assignedTo?: ConversationAssigned;
|
|
24
29
|
sla: {
|
|
25
30
|
status: 'none' | 'running' | 'warning' | 'breached' | 'met';
|
|
26
31
|
deadlineAt?: Date;
|
|
@@ -36,7 +41,13 @@ export interface IConversation {
|
|
|
36
41
|
lastAgentActivityAt?: Date;
|
|
37
42
|
labels: ILabel[];
|
|
38
43
|
pinned: boolean;
|
|
44
|
+
/** @deprecated A transfer is represented by an event and the resulting current state. */
|
|
45
|
+
transferBy?: string;
|
|
46
|
+
/** @deprecated A transfer is represented by an event and the resulting current state. */
|
|
47
|
+
transferTo?: ConversationAssigned;
|
|
39
48
|
expired: boolean;
|
|
49
|
+
/** @deprecated Expiration does not own a separate assignment snapshot.*/
|
|
50
|
+
expiredAssignedTo: ConversationAssigned;
|
|
40
51
|
participants: UserInfo[];
|
|
41
52
|
archived: boolean;
|
|
42
53
|
spam: boolean;
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import type { ISchedule } from '../Common/Schedules/Schedules';
|
|
2
|
+
import type { ConversationEventType, ConversationStatus, ID } from './Conversation';
|
|
3
|
+
import type { OutboxEvent } from './Outbox';
|
|
4
|
+
export declare const CONVERSATION_SLA_POLICIES_COLLECTION = "conversation_sla_policies";
|
|
5
|
+
export declare const CONVERSATION_SLA_CYCLES_COLLECTION = "conversation_sla_cycles";
|
|
6
|
+
export declare const CONVERSATION_SLA_EVENTS_COLLECTION = "conversation_sla_events";
|
|
7
|
+
export type ConversationSlaMetric = 'first_response' | 'next_response' | 'assignment' | 'acceptance' | 'resolution';
|
|
8
|
+
/**
|
|
9
|
+
* continuous counts natural elapsed time, including nights and holidays.
|
|
10
|
+
* schedule counts only ranges allowed by the referenced customer ISchedule.
|
|
11
|
+
*/
|
|
12
|
+
export type ConversationSlaTimeCalculation = {
|
|
13
|
+
mode: 'continuous';
|
|
14
|
+
scheduleId?: never;
|
|
15
|
+
} | {
|
|
16
|
+
mode: 'schedule';
|
|
17
|
+
scheduleId: Exclude<ISchedule['id'], null>;
|
|
18
|
+
};
|
|
19
|
+
export interface ConversationSlaWarningThreshold {
|
|
20
|
+
id: ID;
|
|
21
|
+
percentage: number;
|
|
22
|
+
}
|
|
23
|
+
export interface ConversationSlaTarget {
|
|
24
|
+
metric: ConversationSlaMetric;
|
|
25
|
+
durationSeconds: number;
|
|
26
|
+
warningThresholds: ConversationSlaWarningThreshold[];
|
|
27
|
+
}
|
|
28
|
+
export type ConversationSlaResumeBehavior = 'continue' | 'restart' | 'recalculate';
|
|
29
|
+
export type ConversationSlaReopenBehavior = 'preserve' | 'restart' | 'recalculate' | 'do_not_start';
|
|
30
|
+
export interface ConversationSlaClockBehavior {
|
|
31
|
+
pauseOnStatuses: ConversationStatus[];
|
|
32
|
+
onResume: ConversationSlaResumeBehavior;
|
|
33
|
+
onReopen: ConversationSlaReopenBehavior;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Immutable, versioned policy referenced by ConversationQueue.sla.
|
|
37
|
+
* Editing a published policy creates a new version.
|
|
38
|
+
*/
|
|
39
|
+
export interface ConversationSlaPolicy {
|
|
40
|
+
id: ID;
|
|
41
|
+
spaceId: ID;
|
|
42
|
+
name: string;
|
|
43
|
+
description?: string;
|
|
44
|
+
enabled: boolean;
|
|
45
|
+
version: number;
|
|
46
|
+
timeCalculation: ConversationSlaTimeCalculation;
|
|
47
|
+
targets: ConversationSlaTarget[];
|
|
48
|
+
clockBehavior: ConversationSlaClockBehavior;
|
|
49
|
+
createdAt: Date;
|
|
50
|
+
createdByUserId?: ID;
|
|
51
|
+
updatedAt: Date;
|
|
52
|
+
updatedByUserId?: ID;
|
|
53
|
+
}
|
|
54
|
+
export type ConversationSlaClockAction = 'start' | 'evaluate' | 'pause' | 'resume' | 'complete' | 'recalculate' | 'cancel';
|
|
55
|
+
export type ConversationSlaClockReason = 'conversation_created' | 'conversation_enqueued' | 'customer_message' | 'agent_response' | 'assignment_changed' | 'status_changed' | 'queue_transfer' | 'conversation_reopened' | 'deadline_due' | 'policy_override';
|
|
56
|
+
/**
|
|
57
|
+
* Idempotent input for the conversation-sla-worker.
|
|
58
|
+
* policyId/policyVersion identify the immutable policy snapshot to apply.
|
|
59
|
+
*/
|
|
60
|
+
export interface SlaClockCommand {
|
|
61
|
+
commandId: ID;
|
|
62
|
+
sourceEventId: ID;
|
|
63
|
+
spaceId: ID;
|
|
64
|
+
conversationId: ID;
|
|
65
|
+
expectedConversationVersion: number;
|
|
66
|
+
action: ConversationSlaClockAction;
|
|
67
|
+
reason: ConversationSlaClockReason;
|
|
68
|
+
metric?: ConversationSlaMetric;
|
|
69
|
+
policyId: ID;
|
|
70
|
+
policyVersion: number;
|
|
71
|
+
queueId?: ID;
|
|
72
|
+
occurredAt: Date;
|
|
73
|
+
requestedAt: Date;
|
|
74
|
+
}
|
|
75
|
+
export type ConversationSlaCycleStatus = 'running' | 'paused' | 'met' | 'breached' | 'cancelled';
|
|
76
|
+
export interface ConversationSlaPausePeriod {
|
|
77
|
+
startedAt: Date;
|
|
78
|
+
endedAt?: Date;
|
|
79
|
+
reason: ConversationSlaClockReason;
|
|
80
|
+
sourceEventId: ID;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Durable metric cycle. The target and time calculation are copied from the
|
|
84
|
+
* selected policy version so later policy edits cannot alter active history.
|
|
85
|
+
*/
|
|
86
|
+
export interface ConversationSlaCycle {
|
|
87
|
+
id: ID;
|
|
88
|
+
spaceId: ID;
|
|
89
|
+
conversationId: ID;
|
|
90
|
+
metric: ConversationSlaMetric;
|
|
91
|
+
sequence: number;
|
|
92
|
+
status: ConversationSlaCycleStatus;
|
|
93
|
+
policyId: ID;
|
|
94
|
+
policyVersion: number;
|
|
95
|
+
timeCalculation: ConversationSlaTimeCalculation;
|
|
96
|
+
target: ConversationSlaTarget;
|
|
97
|
+
startedAt: Date;
|
|
98
|
+
deadlineAt?: Date;
|
|
99
|
+
nextWarningAt?: Date;
|
|
100
|
+
pausedAt?: Date;
|
|
101
|
+
completedAt?: Date;
|
|
102
|
+
breachedAt?: Date;
|
|
103
|
+
cancelledAt?: Date;
|
|
104
|
+
elapsedSeconds: number;
|
|
105
|
+
pausedSeconds: number;
|
|
106
|
+
pausePeriods: ConversationSlaPausePeriod[];
|
|
107
|
+
startedByEventId: ID;
|
|
108
|
+
completedByEventId?: ID;
|
|
109
|
+
version: number;
|
|
110
|
+
updatedAt: Date;
|
|
111
|
+
}
|
|
112
|
+
export type ConversationSlaEventType = Extract<ConversationEventType, 'sla_started' | 'sla_paused' | 'sla_resumed' | 'sla_warning' | 'sla_breached' | 'sla_met' | 'sla_overridden'>;
|
|
113
|
+
/**
|
|
114
|
+
* Immutable SLA event. Corrections are represented by a later event.
|
|
115
|
+
*/
|
|
116
|
+
export interface ConversationSlaEvent {
|
|
117
|
+
eventId: ID;
|
|
118
|
+
sourceEventId: ID;
|
|
119
|
+
type: ConversationSlaEventType;
|
|
120
|
+
schemaVersion: 1;
|
|
121
|
+
spaceId: ID;
|
|
122
|
+
conversationId: ID;
|
|
123
|
+
conversationVersion: number;
|
|
124
|
+
cycleId: ID;
|
|
125
|
+
metric: ConversationSlaMetric;
|
|
126
|
+
policyId: ID;
|
|
127
|
+
policyVersion: number;
|
|
128
|
+
status: ConversationSlaCycleStatus;
|
|
129
|
+
deadlineAt?: Date;
|
|
130
|
+
warningThresholdId?: ID;
|
|
131
|
+
reason: ConversationSlaClockReason;
|
|
132
|
+
correlationId: ID;
|
|
133
|
+
causationId: ID;
|
|
134
|
+
occurredAt: Date;
|
|
135
|
+
recordedAt: Date;
|
|
136
|
+
}
|
|
137
|
+
export type ConversationSlaOutboxEvent = OutboxEvent<ConversationSlaEvent> & {
|
|
138
|
+
aggregateType: 'conversation';
|
|
139
|
+
eventType: `conversation.${ConversationSlaEventType}`;
|
|
140
|
+
schemaVersion: 1;
|
|
141
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CONVERSATION_SLA_EVENTS_COLLECTION = exports.CONVERSATION_SLA_CYCLES_COLLECTION = exports.CONVERSATION_SLA_POLICIES_COLLECTION = void 0;
|
|
4
|
+
exports.CONVERSATION_SLA_POLICIES_COLLECTION = 'conversation_sla_policies';
|
|
5
|
+
exports.CONVERSATION_SLA_CYCLES_COLLECTION = 'conversation_sla_cycles';
|
|
6
|
+
exports.CONVERSATION_SLA_EVENTS_COLLECTION = 'conversation_sla_events';
|
|
@@ -56,4 +56,5 @@ __exportStar(require("./DashBoard/dashboardMessages"), exports);
|
|
|
56
56
|
__exportStar(require("./Survey"), exports);
|
|
57
57
|
__exportStar(require("./Queue"), exports);
|
|
58
58
|
__exportStar(require("./Routing"), exports);
|
|
59
|
+
__exportStar(require("./Sla"), exports);
|
|
59
60
|
__exportStar(require("./Transfer"), exports);
|