@opencxh/domain 1.279.0 → 1.280.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.
- package/dist/entities/activity/index.d.ts +1 -0
- package/dist/entities/activity/resource-activity.d.ts +33 -0
- package/dist/entities/activity/types.d.ts +1 -1
- package/dist/entities/crm-activity/index.d.ts +43 -0
- package/dist/entities/work/activity.d.ts +11 -35
- package/dist/index.cjs +16 -16
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1334 -1303
- package/package.json +1 -1
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { ReactionSummary } from '../reaction/types';
|
|
2
|
+
/**
|
|
3
|
+
* A feed row that hangs on something other than an interaction — a work item, a contact.
|
|
4
|
+
*
|
|
5
|
+
* Comms' `Activity` requires `interactionId` everywhere, so every other feed mirrors it minus the
|
|
6
|
+
* interaction fields. This is that mirror once, as a type only: each app keeps its own entity.
|
|
7
|
+
* The shape is what `wakesAssignment` and `buildTriggerVars` read structurally.
|
|
8
|
+
*/
|
|
9
|
+
export interface ResourceActivity<TType extends string, TPayload> {
|
|
10
|
+
id: string;
|
|
11
|
+
organizationId: string;
|
|
12
|
+
type: TType;
|
|
13
|
+
author: {
|
|
14
|
+
type: "user" | "system" | "app";
|
|
15
|
+
id?: string;
|
|
16
|
+
name: string;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Always `"internal"`. Never `"inbound"`: rule 1 of `wakesAssignment` treats inbound as
|
|
20
|
+
* "the customer answered" and would wake every waiting assignment on the row's subject.
|
|
21
|
+
*/
|
|
22
|
+
direction: "internal";
|
|
23
|
+
/** The activity this one answers — same one-level thread as comms' `BaseActivity.parentId`. */
|
|
24
|
+
parentId?: string;
|
|
25
|
+
payload: TPayload;
|
|
26
|
+
/**
|
|
27
|
+
* The emoji on this row, as the list route projects them. Read-only and never stored on the
|
|
28
|
+
* row — see `BaseActivity.reactions` and the generic store in the communication app.
|
|
29
|
+
*/
|
|
30
|
+
reactions?: ReactionSummary[];
|
|
31
|
+
createdAt?: number;
|
|
32
|
+
updatedAt?: number;
|
|
33
|
+
}
|
|
@@ -5,7 +5,7 @@ import { ReactionSummary } from '../reaction/types';
|
|
|
5
5
|
export type CallStatus = "new" | "connecting" | "ringing" | "connected" | "held" | "ended" | "failed";
|
|
6
6
|
export type CallDirection = "inbound" | "outbound";
|
|
7
7
|
export type CallType = "audio" | "video" | "data" | "screen-share";
|
|
8
|
-
export type ActivityType = "VOICE_CALL_STARTED" | "VOICE_CALL_ANSWERED" | "VOICE_CALL_HOLD" | "VOICE_CALL_UNHOLD" | "VOICE_CALL_ENDED" | "VOICE_CALL_MISSED" | "VOICE_CALL_VOICEMAIL" | "VIDEO_CALL_STARTED" | "VIDEO_CALL_ANSWERED" | "VIDEO_CALL_HOLD" | "VIDEO_CALL_UNHOLD" | "VIDEO_CALL_ENDED" | "VIDEO_CALL_MISSED" | "EMAIL_RECEIVED" | "EMAIL_SENT" | "CHAT_MESSAGE_SENT" | "CHAT_MESSAGE_RECEIVED" | "CHAT_MEMBER_JOINED" | "CHAT_MEMBER_LEFT" | "CHAT_RENAMED" | "CHAT_CALL_STARTED" | "CHAT_CALL_ENDED" | "CHAT_EVENT" | "AI_MESSAGE_ADDED" | "AI_ACTION_PROPOSED" | "PLAYBOOK_STARTED" | "PLAYBOOK_COMPLETED" | "PLAYBOOK_ESCALATED" | "AGENT_DELEGATED" | "AGENT_ANSWERED" | "MEETING_SCHEDULED" | "MEETING_STARTED" | "MEETING_ENDED" | "MEETING_PARTICIPANT_JOINED" | "MEETING_PARTICIPANT_LEFT" | "COMMENT_ADDED" | "FILE_UPLOADED" | "INTERACTION_CREATED" | "INTERACTION_STATUS_CHANGED" | "INTERACTION_ASSIGNED" | "SLA_BREACHED" | "VOICE_CALL_FAILED" | "VIDEO_CALL_FAILED" | "TRANSCRIPT_ADDED" | "WORK_COMMENT_ADDED" | "WORK_ITEM_ASSIGNED" | "WORK_ITEM_STATUS_CHANGED";
|
|
8
|
+
export type ActivityType = "VOICE_CALL_STARTED" | "VOICE_CALL_ANSWERED" | "VOICE_CALL_HOLD" | "VOICE_CALL_UNHOLD" | "VOICE_CALL_ENDED" | "VOICE_CALL_MISSED" | "VOICE_CALL_VOICEMAIL" | "VIDEO_CALL_STARTED" | "VIDEO_CALL_ANSWERED" | "VIDEO_CALL_HOLD" | "VIDEO_CALL_UNHOLD" | "VIDEO_CALL_ENDED" | "VIDEO_CALL_MISSED" | "EMAIL_RECEIVED" | "EMAIL_SENT" | "CHAT_MESSAGE_SENT" | "CHAT_MESSAGE_RECEIVED" | "CHAT_MEMBER_JOINED" | "CHAT_MEMBER_LEFT" | "CHAT_RENAMED" | "CHAT_CALL_STARTED" | "CHAT_CALL_ENDED" | "CHAT_EVENT" | "AI_MESSAGE_ADDED" | "AI_ACTION_PROPOSED" | "PLAYBOOK_STARTED" | "PLAYBOOK_COMPLETED" | "PLAYBOOK_ESCALATED" | "AGENT_DELEGATED" | "AGENT_ANSWERED" | "MEETING_SCHEDULED" | "MEETING_STARTED" | "MEETING_ENDED" | "MEETING_PARTICIPANT_JOINED" | "MEETING_PARTICIPANT_LEFT" | "COMMENT_ADDED" | "FILE_UPLOADED" | "INTERACTION_CREATED" | "INTERACTION_STATUS_CHANGED" | "INTERACTION_ASSIGNED" | "SLA_BREACHED" | "VOICE_CALL_FAILED" | "VIDEO_CALL_FAILED" | "TRANSCRIPT_ADDED" | "WORK_COMMENT_ADDED" | "WORK_ITEM_ASSIGNED" | "WORK_ITEM_STATUS_CHANGED" | "CRM_NOTE_ADDED" | "CRM_CALL_LOGGED" | "CRM_STAGE_CHANGED";
|
|
9
9
|
export interface Attachment {
|
|
10
10
|
id: string;
|
|
11
11
|
filename: string;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { ResourceActivity } from '../activity/resource-activity';
|
|
2
|
+
import { LifecycleStage } from '../contact/lifecycle';
|
|
3
|
+
/**
|
|
4
|
+
* The feed under a contact or a company: notes, logged calls, stage changes.
|
|
5
|
+
*
|
|
6
|
+
* The work-activity pattern (`entities/work/activity.ts`), keyed on the record's scope key
|
|
7
|
+
* (`contact:<id>`, `company:<id>`) instead of an item id. The type names are crm's own — reusing
|
|
8
|
+
* comms' `COMMENT_ADDED` would fire every comms playbook trigger on a crm note.
|
|
9
|
+
*/
|
|
10
|
+
export declare const CRM_NOTE_ADDED = "CRM_NOTE_ADDED";
|
|
11
|
+
/** The scope kind of one feed row, `crm_activity:<id>` — what the reaction store asks about. */
|
|
12
|
+
export declare const CRM_ACTIVITY_SCOPE_KIND = "crm_activity";
|
|
13
|
+
/** A call or meeting that happened outside the system, written down afterwards. */
|
|
14
|
+
export declare const CRM_CALL_LOGGED = "CRM_CALL_LOGGED";
|
|
15
|
+
/** History, not content: written by the update routes, never editable. */
|
|
16
|
+
export declare const CRM_STAGE_CHANGED = "CRM_STAGE_CHANGED";
|
|
17
|
+
export type CrmActivityType = typeof CRM_NOTE_ADDED | typeof CRM_CALL_LOGGED | typeof CRM_STAGE_CHANGED;
|
|
18
|
+
export declare const CRM_CALL_CHANNELS: readonly ["phone", "meeting", "video"];
|
|
19
|
+
export type CrmCallChannel = (typeof CRM_CALL_CHANNELS)[number];
|
|
20
|
+
export declare const CRM_CALL_OUTCOMES: readonly ["callback", "interested", "no_answer", "not_interested"];
|
|
21
|
+
export type CrmCallOutcome = (typeof CRM_CALL_OUTCOMES)[number];
|
|
22
|
+
export interface CrmCall {
|
|
23
|
+
channel: CrmCallChannel;
|
|
24
|
+
/** When the call happened, not when it was logged. The timeline sorts on this. */
|
|
25
|
+
at: number;
|
|
26
|
+
durationMin?: number;
|
|
27
|
+
outcome?: CrmCallOutcome;
|
|
28
|
+
}
|
|
29
|
+
export interface CrmActivity extends ResourceActivity<CrmActivityType, {
|
|
30
|
+
text?: string;
|
|
31
|
+
html?: string;
|
|
32
|
+
mentions?: string[];
|
|
33
|
+
call?: CrmCall;
|
|
34
|
+
fromStage?: LifecycleStage;
|
|
35
|
+
toStage?: LifecycleStage;
|
|
36
|
+
}> {
|
|
37
|
+
/** `contact:<id>` or `company:<id>`. */
|
|
38
|
+
record: string;
|
|
39
|
+
}
|
|
40
|
+
/** Rows a person wrote, and may therefore edit or delete. A stage row is history. */
|
|
41
|
+
export declare const isAuthoredCrmActivity: (type: string) => boolean;
|
|
42
|
+
/** Where the timeline puts the row: a call at the moment it happened, the rest when written. */
|
|
43
|
+
export declare const crmActivityAt: (activity: CrmActivity) => number;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ResourceActivity } from '../activity/resource-activity';
|
|
2
2
|
import { WorkStatusCategory } from './types';
|
|
3
3
|
/**
|
|
4
4
|
* The activity feed under a work item.
|
|
@@ -22,39 +22,15 @@ export declare const WORK_ITEM_ASSIGNED = "WORK_ITEM_ASSIGNED";
|
|
|
22
22
|
*/
|
|
23
23
|
export declare const WORK_ITEM_STATUS_CHANGED = "WORK_ITEM_STATUS_CHANGED";
|
|
24
24
|
export type WorkActivityType = typeof WORK_COMMENT_ADDED | typeof WORK_ITEM_ASSIGNED | typeof WORK_ITEM_STATUS_CHANGED;
|
|
25
|
-
export interface WorkActivity {
|
|
26
|
-
id: string;
|
|
27
|
-
organizationId: string;
|
|
28
|
-
itemId: string;
|
|
29
|
-
type: WorkActivityType;
|
|
30
|
-
author: {
|
|
31
|
-
type: "user" | "system" | "app";
|
|
32
|
-
id?: string;
|
|
33
|
-
name: string;
|
|
34
|
-
};
|
|
35
|
-
/**
|
|
36
|
-
* Always `"internal"`. Never `"inbound"`: rule 1 of `wakesAssignment` treats inbound as
|
|
37
|
-
* "the customer answered" and would wake every waiting assignment on the item.
|
|
38
|
-
*/
|
|
39
|
-
direction: "internal";
|
|
40
|
-
/** The activity this one answers — same one-level thread as comms' `BaseActivity.parentId`. */
|
|
41
|
-
parentId?: string;
|
|
25
|
+
export interface WorkActivity extends ResourceActivity<WorkActivityType, {
|
|
42
26
|
/** `html` is the composer's markup for a comment; `text` stays the plain reading of it. */
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* The emoji on this comment, as the list route projects them. Read-only and never stored
|
|
54
|
-
* on the row — see `BaseActivity.reactions`, which this mirrors, and the generic store in
|
|
55
|
-
* the communication app that both read from.
|
|
56
|
-
*/
|
|
57
|
-
reactions?: ReactionSummary[];
|
|
58
|
-
createdAt?: number;
|
|
59
|
-
updatedAt?: number;
|
|
27
|
+
text?: string;
|
|
28
|
+
html?: string;
|
|
29
|
+
mentions?: string[];
|
|
30
|
+
assigneeId?: string;
|
|
31
|
+
fromStatus?: string;
|
|
32
|
+
toStatus?: string;
|
|
33
|
+
toCategory?: WorkStatusCategory;
|
|
34
|
+
}> {
|
|
35
|
+
itemId: string;
|
|
60
36
|
}
|