@trii/types 2.10.757 → 2.10.758

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.
Files changed (175) hide show
  1. package/dist/Automations/Events/Event.d.ts +3 -3
  2. package/dist/Contacts/CommunicationEndpoint.d.ts +8 -8
  3. package/dist/Conversations/Classifications/ConversationClassificationEvents.d.ts +2 -2
  4. package/dist/Conversations/Conversation.d.ts +8 -8
  5. package/dist/Conversations/Routing.d.ts +10 -10
  6. package/dist/Events/DomainEventTypes.d.ts +23 -23
  7. package/dist/Tickets/Group.d.ts +74 -0
  8. package/dist/Tickets/index.d.ts +1 -0
  9. package/dist/Tickets/index.js +1 -0
  10. package/dist/src/Common/Channels/Channel.d.ts +1 -26
  11. package/dist/src/Contacts/contacts.d.ts +2 -2
  12. package/dist/src/Conversations/Conversation.d.ts +48 -241
  13. package/dist/src/Conversations/Conversation.js +34 -14
  14. package/dist/src/Conversations/DashBoard/dashboard.d.ts +2 -2
  15. package/dist/src/Conversations/DashBoard/dashboardForms.d.ts +44 -0
  16. package/dist/src/Conversations/DashBoard/dashboardForms.js +24 -0
  17. package/dist/src/Conversations/Flows/Workflows/Workflow.d.ts +123 -280
  18. package/dist/src/Conversations/Flows/Workflows/Workflow.js +35 -85
  19. package/dist/src/Conversations/Groups/Group.d.ts +8 -2
  20. package/dist/src/Conversations/Groups/Group.js +6 -0
  21. package/dist/src/Conversations/Label.d.ts +1 -1
  22. package/dist/src/Conversations/WebHook.d.ts +1 -1
  23. package/dist/src/Conversations/index.d.ts +1 -9
  24. package/dist/src/Conversations/index.js +1 -9
  25. package/dist/src/Tickets/Category.d.ts +0 -18
  26. package/dist/src/Tickets/Dashboard.d.ts +0 -77
  27. package/dist/src/Tickets/Dashboard.js +1 -13
  28. package/dist/src/Tickets/Fields.d.ts +0 -1
  29. package/dist/src/Tickets/Layouts.d.ts +1 -3
  30. package/dist/src/Tickets/Workflow.d.ts +0 -20
  31. package/dist/src/Users/UserTrii.d.ts +0 -10
  32. package/dist/src/Users/UserTrii.js +1 -8
  33. package/dist/src/index.d.ts +0 -3
  34. package/dist/src/index.js +1 -4
  35. package/package.json +1 -1
  36. package/dist/AI/MapPolygon.d.ts +0 -22
  37. package/dist/Conversations/Flows/Nodes/NodeAIChatBot.d.ts +0 -0
  38. package/dist/Conversations/Flows/Nodes/NodeAIChatBot.js +0 -0
  39. package/dist/Conversations/Flows/Nodes/NodeApi.d.ts +0 -2
  40. package/dist/Conversations/Flows/Nodes/NodeApi.js +0 -183
  41. package/dist/Conversations/Flows/Nodes/NodeBotIA.d.ts +0 -15
  42. package/dist/Conversations/Flows/Nodes/NodeBotIA.js +0 -6
  43. package/dist/Conversations/Flows/Nodes/NodeChatBotIA.d.ts +0 -15
  44. package/dist/Conversations/Flows/Nodes/NodeChatBotIA.js +0 -6
  45. package/dist/Conversations/Flows/Nodes/NodeConditional.d.ts +0 -0
  46. package/dist/Conversations/Flows/Nodes/NodeConditional.js +0 -0
  47. package/dist/Conversations/Flows/Nodes/NodeContactSearch.d.ts +0 -0
  48. package/dist/Conversations/Flows/Nodes/NodeContactSearch.js +0 -0
  49. package/dist/Conversations/Flows/Nodes/NodeContactUpdate.d.ts +0 -0
  50. package/dist/Conversations/Flows/Nodes/NodeContactUpdate.js +0 -0
  51. package/dist/Conversations/Flows/Nodes/NodeConversationAssignTo.d.ts +0 -0
  52. package/dist/Conversations/Flows/Nodes/NodeConversationAssignTo.js +0 -0
  53. package/dist/Conversations/Flows/Nodes/NodeConversationFinalize.d.ts +0 -0
  54. package/dist/Conversations/Flows/Nodes/NodeConversationFinalize.js +0 -0
  55. package/dist/Conversations/Flows/Nodes/NodeConversationUpdate.d.ts +0 -0
  56. package/dist/Conversations/Flows/Nodes/NodeConversationUpdate.js +0 -0
  57. package/dist/Conversations/Flows/Nodes/NodeFillForm.d.ts +0 -0
  58. package/dist/Conversations/Flows/Nodes/NodeFillForm.js +0 -0
  59. package/dist/Conversations/Flows/Nodes/NodeFillTicket.d.ts +0 -1
  60. package/dist/Conversations/Flows/Nodes/NodeFillTicket.js +0 -9
  61. package/dist/Conversations/Flows/Nodes/NodeGoogleCalendar.d.ts +0 -20
  62. package/dist/Conversations/Flows/Nodes/NodeGoogleCalendar.js +0 -2
  63. package/dist/Conversations/Flows/Nodes/NodeGoogleMaps copy.d.ts +0 -12
  64. package/dist/Conversations/Flows/Nodes/NodeGoogleMaps copy.js +0 -6
  65. package/dist/Conversations/Flows/Nodes/NodeGoogleMaps.d.ts +0 -15
  66. package/dist/Conversations/Flows/Nodes/NodeGoogleMaps.js +0 -2
  67. package/dist/Conversations/Flows/Nodes/NodeMsgReply.d.ts +0 -0
  68. package/dist/Conversations/Flows/Nodes/NodeMsgReply.js +0 -0
  69. package/dist/Conversations/Flows/Nodes/NodeMsgSend.d.ts +0 -0
  70. package/dist/Conversations/Flows/Nodes/NodeMsgSend.js +0 -0
  71. package/dist/Conversations/Flows/Nodes/NodeMsgText.d.ts +0 -1
  72. package/dist/Conversations/Flows/Nodes/NodeMsgText.js +0 -27
  73. package/dist/Conversations/Flows/Nodes/NodeMsgWaitResponse.d.ts +0 -0
  74. package/dist/Conversations/Flows/Nodes/NodeMsgWaitResponse.js +0 -0
  75. package/dist/Conversations/Flows/Nodes/NodeRedirect.d.ts +0 -0
  76. package/dist/Conversations/Flows/Nodes/NodeRedirect.js +0 -0
  77. package/dist/Conversations/Flows/Nodes/NodeSendEmail.d.ts +0 -0
  78. package/dist/Conversations/Flows/Nodes/NodeSendEmail.js +0 -0
  79. package/dist/Conversations/Flows/Nodes/NodeSqlQuery.d.ts +0 -0
  80. package/dist/Conversations/Flows/Nodes/NodeSqlQuery.js +0 -0
  81. package/dist/Conversations/Flows/Nodes/NodeStart.d.ts +0 -0
  82. package/dist/Conversations/Flows/Nodes/NodeStart.js +0 -0
  83. package/dist/Conversations/Flows/Nodes/NodeTimeScheduleControl.d.ts +0 -0
  84. package/dist/Conversations/Flows/Nodes/NodeTimeScheduleControl.js +0 -0
  85. package/dist/Conversations/Flows/Nodes/NodeTimeTimer.d.ts +0 -0
  86. package/dist/Conversations/Flows/Nodes/NodeTimeTimer.js +0 -0
  87. package/dist/Conversations/Flows/Nodes/NodeTimeWaitUntil.d.ts +0 -0
  88. package/dist/Conversations/Flows/Nodes/NodeTimeWaitUntil.js +0 -0
  89. package/dist/Conversations/Flows/Nodes/NodeToolCalculator.d.ts +0 -2
  90. package/dist/Conversations/Flows/Nodes/NodeToolCalculator.js +0 -37
  91. package/dist/Conversations/Flows/Nodes/NodeToolContacts.d.ts +0 -2
  92. package/dist/Conversations/Flows/Nodes/NodeToolContacts.js +0 -59
  93. package/dist/Conversations/Flows/Nodes/NodeToolFunction.d.ts +0 -2
  94. package/dist/Conversations/Flows/Nodes/NodeToolFunction.js +0 -45
  95. package/dist/Conversations/Flows/Nodes/NodeToolGoogleCalendar.d.ts +0 -2
  96. package/dist/Conversations/Flows/Nodes/NodeToolGoogleCalendar.js +0 -87
  97. package/dist/Conversations/Flows/Nodes/NodeToolGoogleMaps.d.ts +0 -1
  98. package/dist/Conversations/Flows/Nodes/NodeToolGoogleMaps.js +0 -2
  99. package/dist/Conversations/Flows/Nodes/NodeToolKnowledge.d.ts +0 -2
  100. package/dist/Conversations/Flows/Nodes/NodeToolKnowledge.js +0 -52
  101. package/dist/Conversations/Flows/Nodes/NodeToolMapsCheckPolygon.d.ts +0 -2
  102. package/dist/Conversations/Flows/Nodes/NodeToolMapsCheckPolygon.js +0 -59
  103. package/dist/Conversations/Flows/Nodes/NodeToolMcpClient.d.ts +0 -2
  104. package/dist/Conversations/Flows/Nodes/NodeToolMcpClient.js +0 -45
  105. package/dist/Conversations/Flows/Nodes/NodeToolShoppingCart.d.ts +0 -2
  106. package/dist/Conversations/Flows/Nodes/NodeToolShoppingCart.js +0 -81
  107. package/dist/Conversations/Flows/Nodes/index.d.ts +0 -24
  108. package/dist/Conversations/Flows/Nodes/index.js +0 -40
  109. package/dist/Presence/ChannelRoutingState.d.ts +0 -17
  110. package/dist/Presence/ChannelRoutingState.js +0 -9
  111. package/dist/Tickets/AccessLevel.d.ts +0 -5
  112. package/dist/Tickets/AccessLevel.js +0 -9
  113. package/dist/src/Automations/Capabilities/Capability.d.ts +0 -48
  114. package/dist/src/Automations/Capabilities/Capability.js +0 -9
  115. package/dist/src/Automations/Capabilities/index.d.ts +0 -1
  116. package/dist/src/Automations/Capabilities/index.js +0 -17
  117. package/dist/src/Automations/Common.d.ts +0 -47
  118. package/dist/src/Automations/Common.js +0 -18
  119. package/dist/src/Automations/Events/Event.d.ts +0 -41
  120. package/dist/src/Automations/Events/Event.js +0 -2
  121. package/dist/src/Automations/Events/index.d.ts +0 -1
  122. package/dist/src/Automations/Events/index.js +0 -17
  123. package/dist/src/Automations/Executions/Execution.d.ts +0 -114
  124. package/dist/src/Automations/Executions/Execution.js +0 -23
  125. package/dist/src/Automations/Executions/index.d.ts +0 -1
  126. package/dist/src/Automations/Executions/index.js +0 -17
  127. package/dist/src/Automations/Flows/Canvas.d.ts +0 -86
  128. package/dist/src/Automations/Flows/Canvas.js +0 -34
  129. package/dist/src/Automations/Flows/Flow.d.ts +0 -102
  130. package/dist/src/Automations/Flows/Flow.js +0 -34
  131. package/dist/src/Automations/Flows/Requests.d.ts +0 -71
  132. package/dist/src/Automations/Flows/Requests.js +0 -2
  133. package/dist/src/Automations/Flows/Validation.d.ts +0 -28
  134. package/dist/src/Automations/Flows/Validation.js +0 -9
  135. package/dist/src/Automations/Flows/index.d.ts +0 -4
  136. package/dist/src/Automations/Flows/index.js +0 -20
  137. package/dist/src/Automations/Nodes/Node.d.ts +0 -75
  138. package/dist/src/Automations/Nodes/Node.js +0 -18
  139. package/dist/src/Automations/Nodes/index.d.ts +0 -1
  140. package/dist/src/Automations/Nodes/index.js +0 -17
  141. package/dist/src/Automations/index.d.ts +0 -6
  142. package/dist/src/Automations/index.js +0 -22
  143. package/dist/src/Chats/Chat.d.ts +0 -61
  144. package/dist/src/Chats/Chat.js +0 -28
  145. package/dist/src/Conversations/Assignment.d.ts +0 -81
  146. package/dist/src/Conversations/Assignment.js +0 -4
  147. package/dist/src/Conversations/Outbox.d.ts +0 -24
  148. package/dist/src/Conversations/Outbox.js +0 -4
  149. package/dist/src/Conversations/Queue.d.ts +0 -107
  150. package/dist/src/Conversations/Queue.js +0 -4
  151. package/dist/src/Conversations/Routing.d.ts +0 -164
  152. package/dist/src/Conversations/Routing.js +0 -2
  153. package/dist/src/Conversations/Sla.d.ts +0 -227
  154. package/dist/src/Conversations/Sla.js +0 -6
  155. package/dist/src/Conversations/Transfer.d.ts +0 -73
  156. package/dist/src/Conversations/Transfer.js +0 -2
  157. package/dist/src/Forms/API.d.ts +0 -53
  158. package/dist/src/Forms/API.js +0 -2
  159. package/dist/src/Forms/SubmittedForm.d.ts +0 -56
  160. package/dist/src/Forms/SubmittedForm.js +0 -9
  161. package/dist/src/Forms/index.d.ts +0 -2
  162. package/dist/src/Forms/index.js +0 -18
  163. package/dist/src/Presence/AgentPause.d.ts +0 -24
  164. package/dist/src/Presence/AgentPause.js +0 -19
  165. package/dist/src/Presence/QueueParticipation.d.ts +0 -17
  166. package/dist/src/Presence/QueueParticipation.js +0 -2
  167. package/dist/src/Presence/QueueRoutingState.d.ts +0 -27
  168. package/dist/src/Presence/QueueRoutingState.js +0 -9
  169. package/dist/src/Presence/index.d.ts +0 -3
  170. package/dist/src/Presence/index.js +0 -19
  171. /package/dist/{src/Conversations → Conversations}/InboxMongo.d.ts +0 -0
  172. /package/dist/{src/Conversations → Conversations}/InboxMongo.js +0 -0
  173. /package/dist/{src/Conversations → Conversations}/InboxProjection.d.ts +0 -0
  174. /package/dist/{src/Conversations → Conversations}/InboxProjection.js +0 -0
  175. /package/dist/{AI/MapPolygon.js → Tickets/Group.js} +0 -0
@@ -1,107 +0,0 @@
1
- import { ID } from './Conversation';
2
- import { QueueRoutingPolicy } from './Routing';
3
- export declare const CONVERSATION_QUEUES_COLLECTION = "conversation_queues";
4
- export type QueueSlaTransferBehavior = 'preserve' | 'restart' | 'recalculate';
5
- export type ConversationQueueSlaConfig = {
6
- enabled: false;
7
- policyId?: never;
8
- policyVersion?: never;
9
- onTransferIn?: never;
10
- } | {
11
- enabled: true;
12
- policyId: ID;
13
- policyVersion: number;
14
- onTransferIn: QueueSlaTransferBehavior;
15
- };
16
- /**
17
- * distribution:
18
- * visibility follows shared, manual_pull or exclusive routing semantics.
19
- * all_current:
20
- * all authorized queue members can see current queue conversations.
21
- */
22
- export type QueueMemberAudienceMode = 'distribution' | 'all_current' | 'none';
23
- export type QueueSupervisorAudienceMode = 'all_current' | 'sla_only' | 'escalations_only' | 'none';
24
- export interface ConversationQueueAudienceConfig {
25
- members: {
26
- mode: QueueMemberAudienceMode;
27
- requireActiveParticipation: boolean;
28
- includeResolved: boolean;
29
- };
30
- supervisors: {
31
- mode: QueueSupervisorAudienceMode;
32
- includeResolved: boolean;
33
- };
34
- }
35
- export interface ConversationQueueInfo {
36
- id: ID;
37
- name: string;
38
- color?: string;
39
- enabled: boolean;
40
- }
41
- /**
42
- * Conversation routing, supervision and reporting boundary.
43
- * Groups only provide user membership; they never own conversations.
44
- */
45
- export interface ConversationQueue {
46
- id: ID;
47
- spaceId: ID;
48
- name: string;
49
- description?: string;
50
- color?: string;
51
- enabled: boolean;
52
- /**
53
- * Higher values are evaluated first when multiple queues match.
54
- */
55
- priority: number;
56
- memberGroupIds: ID[];
57
- supervisorGroupIds: ID[];
58
- routing: QueueRoutingPolicy;
59
- sla: ConversationQueueSlaConfig;
60
- audience: ConversationQueueAudienceConfig;
61
- version: number;
62
- createdAt: Date;
63
- createdByUserId?: ID;
64
- updatedAt: Date;
65
- updatedByUserId?: ID;
66
- }
67
- /**
68
- * Editable Queue definition sent by clients.
69
- *
70
- * It excludes id, version and audit fields controlled by the backend. Nested
71
- * routing, SLA and audience objects use full-replacement semantics.
72
- */
73
- export interface ConversationQueueDefinitionInput {
74
- name: string;
75
- description?: string;
76
- color?: string;
77
- enabled: boolean;
78
- priority: number;
79
- memberGroupIds: ID[];
80
- supervisorGroupIds: ID[];
81
- routing: QueueRoutingPolicy;
82
- sla: ConversationQueueSlaConfig;
83
- audience: ConversationQueueAudienceConfig;
84
- }
85
- /**
86
- * Creates a Queue. commandId makes retries idempotent. The backend assigns
87
- * queue id, version and audit fields.
88
- */
89
- export interface CreateConversationQueueRequest {
90
- commandId: ID;
91
- spaceId: ID;
92
- definition: ConversationQueueDefinitionInput;
93
- }
94
- /**
95
- * Replaces the editable definition of an existing Queue.
96
- *
97
- * expectedVersion is the version loaded by the client; it is not incremented
98
- * by the client. The backend rejects stale writes and returns the updated
99
- * ConversationQueue with its new version and audit fields.
100
- */
101
- export interface UpdateConversationQueueRequest {
102
- commandId: ID;
103
- spaceId: ID;
104
- queueId: ID;
105
- expectedVersion: number;
106
- definition: ConversationQueueDefinitionInput;
107
- }
@@ -1,4 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CONVERSATION_QUEUES_COLLECTION = void 0;
4
- exports.CONVERSATION_QUEUES_COLLECTION = 'conversation_queues';
@@ -1,164 +0,0 @@
1
- import { ChannelType } from '../Common/Channels/ChannelType';
2
- interface QueueRoutingPolicyBase {
3
- requiredSkills?: string[];
4
- optionalSkills?: string[];
5
- acceptedChannelTypes: ChannelType[];
6
- requireActiveParticipation: boolean;
7
- requireAvailablePresence: boolean;
8
- requireAcceptance: boolean;
9
- capacityPolicy: {
10
- maxConcurrentByChannelType: Partial<Record<ChannelType, number>>;
11
- weightByChannelType: Partial<Record<ChannelType, number>>;
12
- };
13
- fallback: {
14
- action: 'keep_queued' | 'overflow_queue' | 'assign_supervisor';
15
- overflowQueueId?: string;
16
- timeoutSeconds?: number;
17
- };
18
- }
19
- /**
20
- * Resolves the ownerUserId of the contact or business associated with the
21
- * conversation. The resolved user is still subject to every Queue eligibility
22
- * rule.
23
- */
24
- export interface PartyOwnerAssigneeResolver {
25
- type: 'party_owner';
26
- mode: 'prefer' | 'required';
27
- }
28
- export type QueueOwnerAssigneeResolver = PartyOwnerAssigneeResolver;
29
- export type QueueRoutingPolicy = (QueueRoutingPolicyBase & {
30
- distributionMode: 'shared';
31
- strategy?: never;
32
- ownerResolver?: never;
33
- }) | (QueueRoutingPolicyBase & {
34
- distributionMode: 'manual_pull';
35
- strategy?: never;
36
- ownerResolver?: never;
37
- }) | (QueueRoutingPolicyBase & {
38
- distributionMode: 'exclusive';
39
- strategy: QueueRoutingStrategy;
40
- ownerResolver?: undefined | (PartyOwnerAssigneeResolver & {
41
- mode: 'prefer';
42
- });
43
- }) | (QueueRoutingPolicyBase & {
44
- distributionMode: 'exclusive';
45
- strategy?: never;
46
- ownerResolver: PartyOwnerAssigneeResolver & {
47
- mode: 'required';
48
- };
49
- });
50
- export type QueueRoutingConfig = QueueRoutingPolicy & {
51
- queueId: string;
52
- spaceId: string;
53
- version: number;
54
- updatedAt: Date;
55
- };
56
- export type QueueDistributionMode = 'shared' | 'exclusive' | 'manual_pull';
57
- export type QueueRoutingStrategy = 'round_robin' | 'least_busy' | 'random' | 'highest_capacity' | 'skills' | 'account_affinity' | 'longest_idle' | 'manual';
58
- export interface RoutingCandidate {
59
- userId: string;
60
- queueId: string;
61
- authorized: boolean;
62
- participating: boolean;
63
- available: boolean;
64
- channelEligible: boolean;
65
- capacityUsed: number;
66
- capacityTotal: number;
67
- lastAssignedAt?: Date;
68
- idleSince?: Date;
69
- skills: string[];
70
- accountAffinityScore?: number;
71
- }
72
- export type RoutingPartyType = 'contact' | 'business';
73
- /**
74
- * Snapshot resolved by the command producer. The routing worker must not read
75
- * Contacts again to obtain ownerUserId.
76
- */
77
- export type RoutingPartyContext = {
78
- status: 'not_found';
79
- partyType: RoutingPartyType;
80
- partyId?: string;
81
- ownerUserId?: never;
82
- } | {
83
- status: 'without_owner';
84
- partyType: RoutingPartyType;
85
- partyId: string;
86
- ownerUserId?: never;
87
- } | {
88
- status: 'resolved';
89
- partyType: RoutingPartyType;
90
- partyId: string;
91
- ownerUserId: string;
92
- };
93
- /**
94
- * Idempotent request for routing a queued conversation.
95
- *
96
- * contact/business ownership is captured in party by the producer so the
97
- * routing worker can evaluate it against candidates without another read.
98
- */
99
- export interface RouteConversationCommand {
100
- commandId: string;
101
- sourceEventId: string;
102
- spaceId: string;
103
- conversationId: string;
104
- queueId: string;
105
- expectedConversationVersion: number;
106
- queueConfigVersion: number;
107
- party: RoutingPartyContext;
108
- requestedAt: Date;
109
- }
110
- export type RoutingSelectionSource = 'party_owner' | 'strategy' | 'fallback';
111
- export type PartyOwnerResolutionFailure = 'party_not_found' | 'party_without_owner' | 'owner_user_not_found' | 'not_authorized' | 'not_participating' | 'unavailable' | 'channel_ineligible' | 'capacity_exhausted';
112
- type FailedPartyOwnerEvaluation = {
113
- party: Extract<RoutingPartyContext, {
114
- status: 'not_found';
115
- }>;
116
- outcome: 'party_not_found';
117
- } | {
118
- party: Extract<RoutingPartyContext, {
119
- status: 'without_owner';
120
- }>;
121
- outcome: 'party_without_owner';
122
- } | {
123
- party: Extract<RoutingPartyContext, {
124
- status: 'resolved';
125
- }>;
126
- outcome: Exclude<PartyOwnerResolutionFailure, 'party_not_found' | 'party_without_owner'>;
127
- };
128
- export type PartyOwnerAssigneeEvaluation = {
129
- type: 'party_owner';
130
- mode: PartyOwnerAssigneeResolver['mode'];
131
- party: Extract<RoutingPartyContext, {
132
- status: 'resolved';
133
- }>;
134
- outcome: 'selected';
135
- nextStep?: never;
136
- } | (FailedPartyOwnerEvaluation & {
137
- type: 'party_owner';
138
- mode: 'prefer';
139
- nextStep: 'strategy';
140
- }) | (FailedPartyOwnerEvaluation & {
141
- type: 'party_owner';
142
- mode: 'required';
143
- nextStep: 'fallback';
144
- });
145
- export interface RoutingDecision {
146
- decisionId: string;
147
- spaceId: string;
148
- conversationId: string;
149
- queueId: string;
150
- distributionMode: QueueDistributionMode;
151
- strategy?: QueueRoutingStrategy;
152
- eligibleUserIds: string[];
153
- selectedUserId?: string;
154
- selectionSource?: RoutingSelectionSource;
155
- ownerEvaluation?: PartyOwnerAssigneeEvaluation;
156
- rejected: Array<{
157
- userId: string;
158
- reasons: string[];
159
- }>;
160
- queueConfigVersion: number;
161
- conversationVersion: number;
162
- createdAt: Date;
163
- }
164
- export {};
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,227 +0,0 @@
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
- /**
29
- * Threshold received by the SLA policy write API.
30
- *
31
- * Existing thresholds keep their id. New thresholds may omit it so the
32
- * backend can assign the canonical identifier returned in
33
- * ConversationSlaPolicy.
34
- */
35
- export interface ConversationSlaWarningThresholdInput {
36
- id?: ID;
37
- percentage: number;
38
- }
39
- /**
40
- * Target received by the SLA policy write API.
41
- * durationSeconds is stored as seconds regardless of the unit used by the UI.
42
- */
43
- export interface ConversationSlaTargetInput {
44
- metric: ConversationSlaMetric;
45
- durationSeconds: number;
46
- warningThresholds: ConversationSlaWarningThresholdInput[];
47
- }
48
- export type ConversationSlaResumeBehavior = 'continue' | 'restart' | 'recalculate';
49
- export type ConversationSlaReopenBehavior = 'preserve' | 'restart' | 'recalculate' | 'do_not_start';
50
- export interface ConversationSlaClockBehavior {
51
- /**
52
- * Conversation statuses that pause every running SLA cycle.
53
- *
54
- * Entering one of these statuses pauses the clock. Leaving all of them
55
- * resumes it according to onResume. An empty array means that conversation
56
- * status changes never pause the SLA clock.
57
- */
58
- pauseOnStatuses: ConversationStatus[];
59
- /**
60
- * Behavior applied when the conversation leaves the last status included
61
- * in pauseOnStatuses.
62
- *
63
- * continue: keeps the current cycle and its consumed/remaining time.
64
- * restart: resets the current cycle from the resume timestamp.
65
- * recalculate: keeps the applied policy snapshot and recalculates the
66
- * schedule-derived warnings/deadline. It does not select another policy
67
- * version.
68
- */
69
- onResume: ConversationSlaResumeBehavior;
70
- /**
71
- * Behavior applied when a resolved/finalized conversation is reopened.
72
- * Reopening is independent from resuming a status-paused clock.
73
- *
74
- * preserve: preserves the previous cycle state.
75
- * restart: starts a new cycle from the reopen timestamp.
76
- * recalculate: recalculates the cycle using the applied policy snapshot.
77
- * do_not_start: does not start an SLA cycle because of the reopen action.
78
- */
79
- onReopen: ConversationSlaReopenBehavior;
80
- }
81
- /**
82
- * Immutable, versioned policy referenced by ConversationQueue.sla.
83
- * Editing a published policy creates a new version.
84
- */
85
- export interface ConversationSlaPolicy {
86
- id: ID;
87
- spaceId: ID;
88
- name: string;
89
- description?: string;
90
- enabled: boolean;
91
- version: number;
92
- timeCalculation: ConversationSlaTimeCalculation;
93
- targets: ConversationSlaTarget[];
94
- clockBehavior: ConversationSlaClockBehavior;
95
- createdAt: Date;
96
- createdByUserId?: ID;
97
- updatedAt: Date;
98
- updatedByUserId?: ID;
99
- }
100
- /**
101
- * Editable definition sent by clients.
102
- *
103
- * It intentionally excludes policy id/version and audit fields controlled by
104
- * the backend. targets is full-replacement: omitted metrics are disabled in
105
- * the newly published policy version.
106
- */
107
- export interface ConversationSlaPolicyDefinitionInput {
108
- name: string;
109
- description?: string;
110
- enabled: boolean;
111
- timeCalculation: ConversationSlaTimeCalculation;
112
- targets: ConversationSlaTargetInput[];
113
- clockBehavior: ConversationSlaClockBehavior;
114
- }
115
- /**
116
- * Creates the first immutable version of an SLA policy.
117
- *
118
- * commandId provides idempotency for retries. The authenticated backend
119
- * context supplies createdByUserId and the audit timestamps.
120
- */
121
- export interface CreateConversationSlaPolicyRequest {
122
- commandId: ID;
123
- spaceId: ID;
124
- definition: ConversationSlaPolicyDefinitionInput;
125
- }
126
- /**
127
- * Publishes a new immutable version of an existing SLA policy.
128
- *
129
- * expectedVersion implements optimistic concurrency. The backend rejects the
130
- * request when another version was published after the client loaded it.
131
- * version, updatedAt and updatedByUserId are always assigned by the backend.
132
- */
133
- export interface PublishConversationSlaPolicyVersionRequest {
134
- commandId: ID;
135
- spaceId: ID;
136
- policyId: ID;
137
- expectedVersion: number;
138
- definition: ConversationSlaPolicyDefinitionInput;
139
- }
140
- export type ConversationSlaClockAction = 'start' | 'evaluate' | 'pause' | 'resume' | 'complete' | 'recalculate' | 'cancel';
141
- export type ConversationSlaClockReason = 'conversation_created' | 'conversation_enqueued' | 'customer_message' | 'agent_response' | 'assignment_changed' | 'status_changed' | 'queue_transfer' | 'conversation_reopened' | 'deadline_due' | 'policy_override';
142
- /**
143
- * Idempotent input for the conversation-sla-worker.
144
- * policyId/policyVersion identify the immutable policy snapshot to apply.
145
- */
146
- export interface SlaClockCommand {
147
- commandId: ID;
148
- sourceEventId: ID;
149
- spaceId: ID;
150
- conversationId: ID;
151
- expectedConversationVersion: number;
152
- action: ConversationSlaClockAction;
153
- reason: ConversationSlaClockReason;
154
- metric?: ConversationSlaMetric;
155
- policyId: ID;
156
- policyVersion: number;
157
- queueId?: ID;
158
- occurredAt: Date;
159
- requestedAt: Date;
160
- }
161
- export type ConversationSlaCycleStatus = 'running' | 'paused' | 'met' | 'breached' | 'cancelled';
162
- export interface ConversationSlaPausePeriod {
163
- startedAt: Date;
164
- endedAt?: Date;
165
- reason: ConversationSlaClockReason;
166
- sourceEventId: ID;
167
- }
168
- /**
169
- * Durable metric cycle. The target and time calculation are copied from the
170
- * selected policy version so later policy edits cannot alter active history.
171
- */
172
- export interface ConversationSlaCycle {
173
- id: ID;
174
- spaceId: ID;
175
- conversationId: ID;
176
- metric: ConversationSlaMetric;
177
- sequence: number;
178
- status: ConversationSlaCycleStatus;
179
- policyId: ID;
180
- policyVersion: number;
181
- timeCalculation: ConversationSlaTimeCalculation;
182
- target: ConversationSlaTarget;
183
- startedAt: Date;
184
- deadlineAt?: Date;
185
- nextWarningAt?: Date;
186
- pausedAt?: Date;
187
- completedAt?: Date;
188
- breachedAt?: Date;
189
- cancelledAt?: Date;
190
- elapsedSeconds: number;
191
- pausedSeconds: number;
192
- pausePeriods: ConversationSlaPausePeriod[];
193
- startedByEventId: ID;
194
- completedByEventId?: ID;
195
- version: number;
196
- updatedAt: Date;
197
- }
198
- export type ConversationSlaEventType = Extract<ConversationEventType, 'sla_started' | 'sla_paused' | 'sla_resumed' | 'sla_warning' | 'sla_breached' | 'sla_met' | 'sla_overridden'>;
199
- /**
200
- * Immutable SLA event. Corrections are represented by a later event.
201
- */
202
- export interface ConversationSlaEvent {
203
- eventId: ID;
204
- sourceEventId: ID;
205
- type: ConversationSlaEventType;
206
- schemaVersion: 1;
207
- spaceId: ID;
208
- conversationId: ID;
209
- conversationVersion: number;
210
- cycleId: ID;
211
- metric: ConversationSlaMetric;
212
- policyId: ID;
213
- policyVersion: number;
214
- status: ConversationSlaCycleStatus;
215
- deadlineAt?: Date;
216
- warningThresholdId?: ID;
217
- reason: ConversationSlaClockReason;
218
- correlationId: ID;
219
- causationId: ID;
220
- occurredAt: Date;
221
- recordedAt: Date;
222
- }
223
- export type ConversationSlaOutboxEvent = OutboxEvent<ConversationSlaEvent> & {
224
- aggregateType: 'conversation';
225
- eventType: `conversation.${ConversationSlaEventType}`;
226
- schemaVersion: 1;
227
- };
@@ -1,6 +0,0 @@
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';
@@ -1,73 +0,0 @@
1
- import { OutboxEvent } from './Outbox';
2
- import { AssignmentActorReference, AssignmentStateReference, ConversationAssignmentReason } from './Assignment';
3
- import { ID } from './Conversation';
4
- export type TransferConversationReason = Extract<ConversationAssignmentReason, 'manual_transfer' | 'flow_routing' | 'sla_escalation' | 'system_recovery'>;
5
- export type TransferConversationTarget = {
6
- type: 'queue';
7
- queueId: ID;
8
- } | {
9
- type: 'user';
10
- queueId: ID;
11
- userId: ID;
12
- };
13
- export interface TransferConversationCommand {
14
- commandId: ID;
15
- spaceId: ID;
16
- conversationId: ID;
17
- target: TransferConversationTarget;
18
- expectedConversationVersion: number;
19
- actor: AssignmentActorReference;
20
- reason: TransferConversationReason;
21
- requestedAt: Date;
22
- }
23
- export type TransferConversationRejectionCode = 'conversation_not_found' | 'target_queue_not_found' | 'target_queue_disabled' | 'target_user_not_found' | 'target_user_not_authorized' | 'target_user_not_available' | 'target_user_has_no_capacity' | 'channel_not_supported' | 'same_queue' | 'same_owner' | 'actor_not_authorized' | 'conversation_not_transferable';
24
- export type TransferConversationResult = {
25
- status: 'transferred';
26
- commandId: ID;
27
- conversationId: ID;
28
- previousVersion: number;
29
- conversationVersion: number;
30
- previous: AssignmentStateReference;
31
- current: AssignmentStateReference;
32
- assignmentEventId: ID;
33
- outboxEventId: ID;
34
- } | {
35
- status: 'already_applied';
36
- commandId: ID;
37
- conversationId: ID;
38
- conversationVersion: number;
39
- assignmentEventId: ID;
40
- outboxEventId: ID;
41
- } | {
42
- status: 'version_conflict';
43
- commandId: ID;
44
- conversationId: ID;
45
- expectedVersion: number;
46
- currentVersion: number;
47
- } | {
48
- status: 'rejected';
49
- commandId: ID;
50
- conversationId: ID;
51
- code: TransferConversationRejectionCode;
52
- };
53
- export interface ConversationAssignmentChanged {
54
- eventId: ID;
55
- sourceEventId: ID;
56
- type: 'conversation.assignment.changed';
57
- schemaVersion: 1;
58
- spaceId: ID;
59
- conversationId: ID;
60
- conversationVersion: number;
61
- reason: ConversationAssignmentReason;
62
- previous?: AssignmentStateReference;
63
- current: AssignmentStateReference;
64
- actor: AssignmentActorReference;
65
- correlationId: ID;
66
- causationId: ID;
67
- occurredAt: Date;
68
- }
69
- export type ConversationAssignmentChangedOutboxEvent = OutboxEvent<ConversationAssignmentChanged> & {
70
- aggregateType: 'conversation';
71
- eventType: 'conversation.assignment.changed';
72
- schemaVersion: 1;
73
- };
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,53 +0,0 @@
1
- import { FormItemType } from "../Common/Channels/Form";
2
- import { FormAnswerV2, FormTag } from "./SubmittedForm";
3
- export interface RequestInfo {
4
- formId: string;
5
- timeStart: Date | null;
6
- timeEnd: Date | null;
7
- skip: number | null;
8
- limit: number | null;
9
- }
10
- export interface SummaryInfo {
11
- formId: string;
12
- timeStart: Date | null;
13
- timeEnd: Date | null;
14
- completedForms: number;
15
- records: QuestionSummary[];
16
- }
17
- export interface QuestionSummary {
18
- questionId: string;
19
- question: string;
20
- type: FormItemType;
21
- fieldType: string;
22
- count: number;
23
- responses: ResponseSummary[];
24
- }
25
- export interface ResponseSummary {
26
- count: number;
27
- responseTitle: string;
28
- }
29
- export interface SubmittedFormsInfo {
30
- formId: string;
31
- timeStart: Date | null;
32
- timeEnd: Date | null;
33
- completedForms: number;
34
- records: SubmittedFormRecord[];
35
- }
36
- export interface SubmittedFormRecord {
37
- id: string;
38
- tags: FormTag[];
39
- responses: SubmittedFormResponse[];
40
- expireAt: Date | null;
41
- createdAt: Date;
42
- completedAt: Date | null;
43
- contractVersion: number;
44
- formRevision: number;
45
- }
46
- export interface SubmittedFormResponse {
47
- type: FormItemType;
48
- fieldType: string;
49
- questionId: string;
50
- question: string;
51
- response: unknown | null;
52
- answer?: FormAnswerV2 | null;
53
- }
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });