@trii/types 2.10.676 → 2.10.678

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 (32) hide show
  1. package/dist/Chats/Chat.d.ts +61 -0
  2. package/dist/Chats/Chat.js +28 -0
  3. package/dist/Common/Channels/Channel.d.ts +9 -0
  4. package/dist/Contacts/contacts.d.ts +2 -2
  5. package/dist/Conversations/Assignment.d.ts +81 -0
  6. package/dist/Conversations/Assignment.js +4 -0
  7. package/dist/Conversations/Conversation.d.ts +233 -53
  8. package/dist/Conversations/Conversation.js +14 -34
  9. package/dist/Conversations/DashBoard/dashboard.d.ts +2 -2
  10. package/dist/Conversations/Groups/Group.d.ts +2 -9
  11. package/dist/Conversations/Groups/Group.js +0 -6
  12. package/dist/Conversations/InboxMongo.d.ts +154 -0
  13. package/dist/Conversations/InboxMongo.js +128 -0
  14. package/dist/Conversations/InboxProjection.d.ts +162 -0
  15. package/dist/Conversations/InboxProjection.js +2 -0
  16. package/dist/Conversations/Label.d.ts +1 -1
  17. package/dist/Conversations/Outbox.d.ts +24 -0
  18. package/dist/Conversations/Outbox.js +4 -0
  19. package/dist/Conversations/Queue.d.ts +66 -0
  20. package/dist/Conversations/Queue.js +4 -0
  21. package/dist/Conversations/Routing.d.ts +163 -0
  22. package/dist/Conversations/Routing.js +2 -0
  23. package/dist/Conversations/Transfer.d.ts +73 -0
  24. package/dist/Conversations/Transfer.js +2 -0
  25. package/dist/Conversations/WebHook.d.ts +1 -1
  26. package/dist/Conversations/index.d.ts +7 -1
  27. package/dist/Conversations/index.js +7 -1
  28. package/dist/Presence/QueueParticipation.d.ts +2 -2
  29. package/dist/Presence/QueueRoutingState.d.ts +2 -2
  30. package/dist/Tickets/Dashboard.d.ts +17 -0
  31. package/dist/Tickets/Dashboard.js +13 -1
  32. package/package.json +1 -1
@@ -0,0 +1,163 @@
1
+ interface QueueRoutingPolicyBase {
2
+ requiredSkills?: string[];
3
+ optionalSkills?: string[];
4
+ acceptedChannels: string[];
5
+ requireActiveParticipation: boolean;
6
+ requireAvailablePresence: boolean;
7
+ requireAcceptance: boolean;
8
+ capacityPolicy: {
9
+ maxConcurrentByChannel: Record<string, number>;
10
+ weightByChannel: Record<string, number>;
11
+ };
12
+ fallback: {
13
+ action: 'keep_queued' | 'overflow_queue' | 'assign_supervisor';
14
+ overflowQueueId?: string;
15
+ timeoutSeconds?: number;
16
+ };
17
+ }
18
+ /**
19
+ * Resolves the ownerUserId of the contact or business associated with the
20
+ * conversation. The resolved user is still subject to every Queue eligibility
21
+ * rule.
22
+ */
23
+ export interface PartyOwnerAssigneeResolver {
24
+ type: 'party_owner';
25
+ mode: 'prefer' | 'required';
26
+ }
27
+ export type QueueOwnerAssigneeResolver = PartyOwnerAssigneeResolver;
28
+ export type QueueRoutingPolicy = (QueueRoutingPolicyBase & {
29
+ distributionMode: 'shared';
30
+ strategy?: never;
31
+ ownerResolver?: never;
32
+ }) | (QueueRoutingPolicyBase & {
33
+ distributionMode: 'manual_pull';
34
+ strategy?: never;
35
+ ownerResolver?: never;
36
+ }) | (QueueRoutingPolicyBase & {
37
+ distributionMode: 'exclusive';
38
+ strategy: QueueRoutingStrategy;
39
+ ownerResolver?: undefined | (PartyOwnerAssigneeResolver & {
40
+ mode: 'prefer';
41
+ });
42
+ }) | (QueueRoutingPolicyBase & {
43
+ distributionMode: 'exclusive';
44
+ strategy?: never;
45
+ ownerResolver: PartyOwnerAssigneeResolver & {
46
+ mode: 'required';
47
+ };
48
+ });
49
+ export type QueueRoutingConfig = QueueRoutingPolicy & {
50
+ queueId: string;
51
+ spaceId: string;
52
+ version: number;
53
+ updatedAt: Date;
54
+ };
55
+ export type QueueDistributionMode = 'shared' | 'exclusive' | 'manual_pull';
56
+ export type QueueRoutingStrategy = 'round_robin' | 'least_busy' | 'random' | 'highest_capacity' | 'skills' | 'account_affinity' | 'longest_idle' | 'manual';
57
+ export interface RoutingCandidate {
58
+ userId: string;
59
+ queueId: string;
60
+ authorized: boolean;
61
+ participating: boolean;
62
+ available: boolean;
63
+ channelEligible: boolean;
64
+ capacityUsed: number;
65
+ capacityTotal: number;
66
+ lastAssignedAt?: Date;
67
+ idleSince?: Date;
68
+ skills: string[];
69
+ accountAffinityScore?: number;
70
+ }
71
+ export type RoutingPartyType = 'contact' | 'business';
72
+ /**
73
+ * Snapshot resolved by the command producer. The routing worker must not read
74
+ * Contacts again to obtain ownerUserId.
75
+ */
76
+ export type RoutingPartyContext = {
77
+ status: 'not_found';
78
+ partyType: RoutingPartyType;
79
+ partyId?: string;
80
+ ownerUserId?: never;
81
+ } | {
82
+ status: 'without_owner';
83
+ partyType: RoutingPartyType;
84
+ partyId: string;
85
+ ownerUserId?: never;
86
+ } | {
87
+ status: 'resolved';
88
+ partyType: RoutingPartyType;
89
+ partyId: string;
90
+ ownerUserId: string;
91
+ };
92
+ /**
93
+ * Idempotent request for routing a queued conversation.
94
+ *
95
+ * contact/business ownership is captured in party by the producer so the
96
+ * routing worker can evaluate it against candidates without another read.
97
+ */
98
+ export interface RouteConversationCommand {
99
+ commandId: string;
100
+ sourceEventId: string;
101
+ spaceId: string;
102
+ conversationId: string;
103
+ queueId: string;
104
+ expectedConversationVersion: number;
105
+ queueConfigVersion: number;
106
+ party: RoutingPartyContext;
107
+ requestedAt: Date;
108
+ }
109
+ export type RoutingSelectionSource = 'party_owner' | 'strategy' | 'fallback';
110
+ export type PartyOwnerResolutionFailure = 'party_not_found' | 'party_without_owner' | 'owner_user_not_found' | 'not_authorized' | 'not_participating' | 'unavailable' | 'channel_ineligible' | 'capacity_exhausted';
111
+ type FailedPartyOwnerEvaluation = {
112
+ party: Extract<RoutingPartyContext, {
113
+ status: 'not_found';
114
+ }>;
115
+ outcome: 'party_not_found';
116
+ } | {
117
+ party: Extract<RoutingPartyContext, {
118
+ status: 'without_owner';
119
+ }>;
120
+ outcome: 'party_without_owner';
121
+ } | {
122
+ party: Extract<RoutingPartyContext, {
123
+ status: 'resolved';
124
+ }>;
125
+ outcome: Exclude<PartyOwnerResolutionFailure, 'party_not_found' | 'party_without_owner'>;
126
+ };
127
+ export type PartyOwnerAssigneeEvaluation = {
128
+ type: 'party_owner';
129
+ mode: PartyOwnerAssigneeResolver['mode'];
130
+ party: Extract<RoutingPartyContext, {
131
+ status: 'resolved';
132
+ }>;
133
+ outcome: 'selected';
134
+ nextStep?: never;
135
+ } | (FailedPartyOwnerEvaluation & {
136
+ type: 'party_owner';
137
+ mode: 'prefer';
138
+ nextStep: 'strategy';
139
+ }) | (FailedPartyOwnerEvaluation & {
140
+ type: 'party_owner';
141
+ mode: 'required';
142
+ nextStep: 'fallback';
143
+ });
144
+ export interface RoutingDecision {
145
+ decisionId: string;
146
+ spaceId: string;
147
+ conversationId: string;
148
+ queueId: string;
149
+ distributionMode: QueueDistributionMode;
150
+ strategy?: QueueRoutingStrategy;
151
+ eligibleUserIds: string[];
152
+ selectedUserId?: string;
153
+ selectionSource?: RoutingSelectionSource;
154
+ ownerEvaluation?: PartyOwnerAssigneeEvaluation;
155
+ rejected: Array<{
156
+ userId: string;
157
+ reasons: string[];
158
+ }>;
159
+ queueConfigVersion: number;
160
+ conversationVersion: number;
161
+ createdAt: Date;
162
+ }
163
+ export {};
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,73 @@
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
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -5,7 +5,7 @@ import { AuthType } from '../Common/API/AuthType';
5
5
  import { Method } from '../Common/API/Method';
6
6
  interface IWebhook {
7
7
  id?: string | null;
8
- tenantId?: string | null;
8
+ spaceId?: string | null;
9
9
  name?: string | null;
10
10
  apiUrl?: string | null;
11
11
  apiMethod?: Method | null;
@@ -1,7 +1,10 @@
1
1
  export * as Flows from './Flows/index';
2
2
  export * as Groups from './Groups/Group';
3
+ export * from './Assignment';
3
4
  export * from './Conversation';
4
- export * from './InboxCounters';
5
+ export * from './InboxMongo';
6
+ export * from './InboxProjection';
7
+ export * from './Outbox';
5
8
  export * from './Ending';
6
9
  export * from './Label';
7
10
  export * from './WebHook';
@@ -12,3 +15,6 @@ export * from '../Forms/API';
12
15
  export * from './DashBoard/dashboardChannels';
13
16
  export * from './DashBoard/dashboardMessages';
14
17
  export * from './Survey';
18
+ export * from './Queue';
19
+ export * from './Routing';
20
+ export * from './Transfer';
@@ -39,8 +39,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
39
39
  exports.Groups = exports.Flows = void 0;
40
40
  exports.Flows = __importStar(require("./Flows/index"));
41
41
  exports.Groups = __importStar(require("./Groups/Group"));
42
+ __exportStar(require("./Assignment"), exports);
42
43
  __exportStar(require("./Conversation"), exports);
43
- __exportStar(require("./InboxCounters"), exports);
44
+ __exportStar(require("./InboxMongo"), exports);
45
+ __exportStar(require("./InboxProjection"), exports);
46
+ __exportStar(require("./Outbox"), exports);
44
47
  __exportStar(require("./Ending"), exports);
45
48
  __exportStar(require("./Label"), exports);
46
49
  __exportStar(require("./WebHook"), exports);
@@ -51,3 +54,6 @@ __exportStar(require("../Forms/API"), exports);
51
54
  __exportStar(require("./DashBoard/dashboardChannels"), exports);
52
55
  __exportStar(require("./DashBoard/dashboardMessages"), exports);
53
56
  __exportStar(require("./Survey"), exports);
57
+ __exportStar(require("./Queue"), exports);
58
+ __exportStar(require("./Routing"), exports);
59
+ __exportStar(require("./Transfer"), exports);
@@ -1,4 +1,4 @@
1
- import { GroupInfo } from "../Conversations/Groups/Group";
1
+ import { ConversationQueueInfo } from "../Conversations/Queue";
2
2
  export interface QueueParticipation {
3
3
  spaceId: string;
4
4
  userId: string;
@@ -13,5 +13,5 @@ export interface QueueParticipationDto {
13
13
  authorized: boolean;
14
14
  active: boolean;
15
15
  updatedAt: Date;
16
- queue?: GroupInfo | null;
16
+ queue?: ConversationQueueInfo | null;
17
17
  }
@@ -1,4 +1,4 @@
1
- import { GroupInfo } from "../Conversations/Groups/Group";
1
+ import { ConversationQueueInfo } from "../Conversations/Queue";
2
2
  export interface QueueRoutingState {
3
3
  spaceId: string;
4
4
  userId: string;
@@ -17,7 +17,7 @@ export declare enum RoutingPresenceStatus {
17
17
  }
18
18
  export interface RoutingStateDto {
19
19
  queueId: string;
20
- queue?: GroupInfo | null;
20
+ queue?: ConversationQueueInfo | null;
21
21
  isEligible: boolean;
22
22
  presenceStatus?: RoutingPresenceStatus;
23
23
  activeJobCount: number;
@@ -193,6 +193,17 @@ export declare enum TicketMetricCode {
193
193
  SECURITY_DENIAL_COUNT = "SECURITY_DENIAL_COUNT",
194
194
  PII_ACCESS_COUNT = "PII_ACCESS_COUNT"
195
195
  }
196
+ export declare enum DashboardIcon {
197
+ DASHBOARD = "DASHBOARD",
198
+ HOME = "HOME",
199
+ SUPPORT = "SUPPORT",
200
+ ANALYTICS = "ANALYTICS",
201
+ REPORTS = "REPORTS",
202
+ USERS = "USERS",
203
+ SETTINGS = "SETTINGS",
204
+ FAVORITES = "FAVORITES",
205
+ QUICK_ACTIONS = "QUICK_ACTIONS"
206
+ }
196
207
  export interface ITicketAnalyticsFilter extends ITicketFilter {
197
208
  range: ITicketDateRange;
198
209
  channelTypes?: ChannelType[];
@@ -318,6 +329,8 @@ export interface ITicketDashboard {
318
329
  refreshMode: TicketWidgetRefreshMode;
319
330
  refreshIntervalSeconds?: number;
320
331
  isDefault?: boolean;
332
+ order: number;
333
+ icon?: DashboardIcon;
321
334
  createdAt: Date;
322
335
  createdBy: string;
323
336
  updatedAt?: Date;
@@ -334,7 +347,9 @@ export interface ICreateTicketDashboardDto {
334
347
  widgets?: ITicketWidgetConfiguration[];
335
348
  refreshMode?: TicketWidgetRefreshMode;
336
349
  refreshIntervalSeconds?: number;
350
+ order?: number;
337
351
  isDefault?: boolean;
352
+ icon?: DashboardIcon;
338
353
  }
339
354
  export interface IUpdateTicketDashboardDto {
340
355
  name?: string;
@@ -347,7 +362,9 @@ export interface IUpdateTicketDashboardDto {
347
362
  widgets?: ITicketWidgetConfiguration[];
348
363
  refreshMode?: TicketWidgetRefreshMode;
349
364
  refreshIntervalSeconds?: number;
365
+ order?: number;
350
366
  isDefault?: boolean;
367
+ icon?: DashboardIcon;
351
368
  }
352
369
  export interface ITicketDashboardTemplate {
353
370
  id: string;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TicketMetricCode = exports.TicketDrilldownTarget = exports.TicketWidgetRefreshMode = exports.TicketMetricFormat = exports.TicketComparisonMode = exports.TicketTimeGranularity = exports.TicketAnalyticsDimension = exports.TicketMetricAggregation = exports.TicketWidgetType = exports.TicketDashboardVisibility = exports.TicketAnalyticsAudience = void 0;
3
+ exports.DashboardIcon = exports.TicketMetricCode = exports.TicketDrilldownTarget = exports.TicketWidgetRefreshMode = exports.TicketMetricFormat = exports.TicketComparisonMode = exports.TicketTimeGranularity = exports.TicketAnalyticsDimension = exports.TicketMetricAggregation = exports.TicketWidgetType = exports.TicketDashboardVisibility = exports.TicketAnalyticsAudience = void 0;
4
4
  var TicketAnalyticsAudience;
5
5
  (function (TicketAnalyticsAudience) {
6
6
  TicketAnalyticsAudience["AGENT"] = "AGENT";
@@ -204,3 +204,15 @@ var TicketMetricCode;
204
204
  TicketMetricCode["SECURITY_DENIAL_COUNT"] = "SECURITY_DENIAL_COUNT";
205
205
  TicketMetricCode["PII_ACCESS_COUNT"] = "PII_ACCESS_COUNT";
206
206
  })(TicketMetricCode || (exports.TicketMetricCode = TicketMetricCode = {}));
207
+ var DashboardIcon;
208
+ (function (DashboardIcon) {
209
+ DashboardIcon["DASHBOARD"] = "DASHBOARD";
210
+ DashboardIcon["HOME"] = "HOME";
211
+ DashboardIcon["SUPPORT"] = "SUPPORT";
212
+ DashboardIcon["ANALYTICS"] = "ANALYTICS";
213
+ DashboardIcon["REPORTS"] = "REPORTS";
214
+ DashboardIcon["USERS"] = "USERS";
215
+ DashboardIcon["SETTINGS"] = "SETTINGS";
216
+ DashboardIcon["FAVORITES"] = "FAVORITES";
217
+ DashboardIcon["QUICK_ACTIONS"] = "QUICK_ACTIONS";
218
+ })(DashboardIcon || (exports.DashboardIcon = DashboardIcon = {}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trii/types",
3
- "version": "2.10.676",
3
+ "version": "2.10.678",
4
4
  "description": "Types definitions for Trii projects - ",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",