@hahnpro/hpc-api 2026.9.6 → 2026.9.7
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/package.json +1 -1
- package/src/lib/crm.constants.d.ts +12 -0
- package/src/lib/crm.constants.js +36 -0
- package/src/lib/interfaces/ai.interface.d.ts +16 -0
- package/src/lib/interfaces/ai.interface.js +17 -1
- package/src/lib/interfaces/crm-autonomy.interface.d.ts +47 -0
- package/src/lib/mock/crm.mock.service.d.ts +11 -1
- package/src/lib/mock/crm.mock.service.js +56 -0
- package/src/lib/services/crm.service.d.ts +10 -0
- package/src/lib/services/crm.service.js +27 -0
package/package.json
CHANGED
|
@@ -51,4 +51,16 @@ export declare const CRM_ASSET_TYPE_NAMES: {
|
|
|
51
51
|
readonly touchpoint: "com.hahnpro.crm.touchpoint";
|
|
52
52
|
readonly deal: "com.hahnpro.crm.deal";
|
|
53
53
|
};
|
|
54
|
+
/**
|
|
55
|
+
* Stable identity for a CRM meeting across its source artifacts, such as an
|
|
56
|
+
* attendance export and a Teams transcript. Keep this independent of source
|
|
57
|
+
* type because both files describe the same meeting.
|
|
58
|
+
*/
|
|
59
|
+
export declare function buildCrmMeetingSourceId(title?: string | null, startTime?: Date | null): string;
|
|
60
|
+
/**
|
|
61
|
+
* Stable identity for a participant-specific touchpoint. The complete identity
|
|
62
|
+
* is bounded because appending an email to a bounded meeting identity can still
|
|
63
|
+
* exceed the CRM sourceId contract.
|
|
64
|
+
*/
|
|
65
|
+
export declare function buildCrmMeetingParticipantSourceId(title?: string | null, startTime?: Date | null, email?: string | null): string;
|
|
54
66
|
export declare const PUBLIC_EMAIL_PROVIDERS: readonly ["gmail.com", "googlemail.com", "t-online.de", "yahoo.com", "yahoo.de", "outlook.com", "hotmail.com", "live.com", "web.de", "gmx.de", "gmx.net", "gmx.ch", "freenet.de", "arcor.de", "aol.com", "icloud.com", "me.com"];
|
package/src/lib/crm.constants.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.PUBLIC_EMAIL_PROVIDERS = exports.CRM_ASSET_TYPE_NAMES = exports.CRM_ASSET_TYPE_IDS = exports.CRM_DEAL_REMINDER_RULES = exports.CRM_DEAL_REMINDER_SCHEMA_MARKER = exports.CRM_ASSET_TYPES = void 0;
|
|
4
|
+
exports.buildCrmMeetingSourceId = buildCrmMeetingSourceId;
|
|
5
|
+
exports.buildCrmMeetingParticipantSourceId = buildCrmMeetingParticipantSourceId;
|
|
4
6
|
exports.CRM_ASSET_TYPES = {
|
|
5
7
|
company: {
|
|
6
8
|
id: '69cd1e34310cf709b7936192',
|
|
@@ -52,6 +54,40 @@ exports.CRM_ASSET_TYPE_NAMES = {
|
|
|
52
54
|
touchpoint: exports.CRM_ASSET_TYPES.touchpoint.name,
|
|
53
55
|
deal: exports.CRM_ASSET_TYPES.deal.name,
|
|
54
56
|
};
|
|
57
|
+
const CRM_SOURCE_ID_MAX_LENGTH = 128;
|
|
58
|
+
const FNV_1A_64_OFFSET_BASIS = 0xcbf29ce484222325n;
|
|
59
|
+
const FNV_1A_64_PRIME = 0x100000001b3n;
|
|
60
|
+
const FNV_1A_64_MASK = 0xffffffffffffffffn;
|
|
61
|
+
function stableSourceHash(value) {
|
|
62
|
+
let hash = FNV_1A_64_OFFSET_BASIS;
|
|
63
|
+
for (const character of value) {
|
|
64
|
+
hash ^= BigInt(character.codePointAt(0) ?? 0);
|
|
65
|
+
hash = (hash * FNV_1A_64_PRIME) & FNV_1A_64_MASK;
|
|
66
|
+
}
|
|
67
|
+
return hash.toString(36);
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Stable identity for a CRM meeting across its source artifacts, such as an
|
|
71
|
+
* attendance export and a Teams transcript. Keep this independent of source
|
|
72
|
+
* type because both files describe the same meeting.
|
|
73
|
+
*/
|
|
74
|
+
function buildCrmMeetingSourceId(title, startTime) {
|
|
75
|
+
const normalizedTitle = title?.trim().toLowerCase() || 'untitled';
|
|
76
|
+
const timestamp = startTime instanceof Date && !Number.isNaN(startTime.getTime()) ? startTime.toISOString() : 'unknown';
|
|
77
|
+
const sourceId = `meeting::${normalizedTitle}::${timestamp}`;
|
|
78
|
+
return sourceId.length <= CRM_SOURCE_ID_MAX_LENGTH ? sourceId : `meeting::${stableSourceHash(normalizedTitle)}::${timestamp}`;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Stable identity for a participant-specific touchpoint. The complete identity
|
|
82
|
+
* is bounded because appending an email to a bounded meeting identity can still
|
|
83
|
+
* exceed the CRM sourceId contract.
|
|
84
|
+
*/
|
|
85
|
+
function buildCrmMeetingParticipantSourceId(title, startTime, email) {
|
|
86
|
+
const meetingSourceId = buildCrmMeetingSourceId(title, startTime);
|
|
87
|
+
const normalizedEmail = email?.trim().toLowerCase() || 'unknown';
|
|
88
|
+
const sourceId = `${meetingSourceId}::${normalizedEmail}`;
|
|
89
|
+
return sourceId.length <= CRM_SOURCE_ID_MAX_LENGTH ? sourceId : `meeting-participant::${stableSourceHash(sourceId)}`;
|
|
90
|
+
}
|
|
55
91
|
exports.PUBLIC_EMAIL_PROVIDERS = [
|
|
56
92
|
'gmail.com',
|
|
57
93
|
'googlemail.com',
|
|
@@ -66,6 +66,7 @@ export declare enum AgentId {
|
|
|
66
66
|
ASSET_IDENTIFIER = "asset-identifier-agent",
|
|
67
67
|
ASSET_MULTI_IDENTIFIER = "asset-multi-identifier-agent",
|
|
68
68
|
ASSET_WEB = "asset-web-agent",
|
|
69
|
+
CRM = "crm-agent",
|
|
69
70
|
LOGBOOK = "logbook-agent",
|
|
70
71
|
MESSAGE = "message-agent",
|
|
71
72
|
STATUS = "status-agent",
|
|
@@ -107,6 +108,20 @@ export declare enum ToolName {
|
|
|
107
108
|
LOAD_USER_MESSAGE_ATTACHMENT_REFERENCES = "loadUserMessageAttachmentReferences",
|
|
108
109
|
SEARCH_IN_ATTACHMENTS = "searchInAttachments",
|
|
109
110
|
LOAD_ATTACHMENT_ANALYSIS = "loadAttachmentAnalysis",
|
|
111
|
+
SUBMIT_CRM_CANDIDATES = "crmSubmitCandidates",
|
|
112
|
+
ENRICH_CRM_CANDIDATES = "crmEnrichCandidates",
|
|
113
|
+
PROPOSE_CRM_WEB_ENRICHMENT = "crmProposeWebEnrichment",
|
|
114
|
+
APPLY_CRM_WEB_ENRICHMENT = "crmApplyWebEnrichment",
|
|
115
|
+
LIST_CRM_IMPORT_COMPANIES_FOR_WEB_ENRICHMENT = "crmListImportCompaniesForWebEnrichment",
|
|
116
|
+
LINK_CRM_TOUCHPOINT_PARTICIPANT = "crmLinkTouchpointParticipant",
|
|
117
|
+
PREPARE_CRM_IMPORT_PLAN = "crmPrepareImportPlan",
|
|
118
|
+
EXECUTE_CRM_IMPORT_PLAN = "crmExecuteImportPlan",
|
|
119
|
+
IMPORT_CRM_ATTACHMENT = "crmImportAttachment",
|
|
120
|
+
LIST_CRM_OPERATIONS = "crmListOperations",
|
|
121
|
+
GET_CRM_OPERATION = "crmGetOperation",
|
|
122
|
+
LIST_CRM_REVIEWS = "crmListReviews",
|
|
123
|
+
RESOLVE_CRM_REVIEW = "crmResolveReview",
|
|
124
|
+
UNDO_CRM_OPERATION = "crmUndoOperation",
|
|
110
125
|
WEB_SEARCH = "web_search",
|
|
111
126
|
USE_SKILL = "useSkill",
|
|
112
127
|
READ_SKILL_FILE = "readSkillFile",
|
|
@@ -131,6 +146,7 @@ export declare enum HandOffTool {
|
|
|
131
146
|
export declare enum AiAssistantId {
|
|
132
147
|
ASSET = "asset-assistant",
|
|
133
148
|
ASSET_WEB = "asset-web-assistant",
|
|
149
|
+
CRM = "crm-assistant",
|
|
134
150
|
INCIDENT = "incident-assistant",
|
|
135
151
|
REPORT = "report-assistant",
|
|
136
152
|
AXALTA_INCIDENT = "axalta-incident-assistant"
|
|
@@ -76,6 +76,7 @@ var AgentId;
|
|
|
76
76
|
AgentId["ASSET_IDENTIFIER"] = "asset-identifier-agent";
|
|
77
77
|
AgentId["ASSET_MULTI_IDENTIFIER"] = "asset-multi-identifier-agent";
|
|
78
78
|
AgentId["ASSET_WEB"] = "asset-web-agent";
|
|
79
|
+
AgentId["CRM"] = "crm-agent";
|
|
79
80
|
AgentId["LOGBOOK"] = "logbook-agent";
|
|
80
81
|
AgentId["MESSAGE"] = "message-agent";
|
|
81
82
|
AgentId["STATUS"] = "status-agent";
|
|
@@ -87,7 +88,7 @@ var AgentId;
|
|
|
87
88
|
AgentId["AXALTA_MESSAGE"] = "axalta-message-agent";
|
|
88
89
|
AgentId["TRIAGE"] = "triage-agent";
|
|
89
90
|
})(AgentId || (exports.AgentId = AgentId = {}));
|
|
90
|
-
exports.ATTACHMENT_CAPABLE_AGENT_IDS = [AgentId.ASSET, AgentId.ASSET_WEB, AgentId.REPORT, AgentId.MESSAGE];
|
|
91
|
+
exports.ATTACHMENT_CAPABLE_AGENT_IDS = [AgentId.ASSET, AgentId.ASSET_WEB, AgentId.CRM, AgentId.REPORT, AgentId.MESSAGE];
|
|
91
92
|
var ToolName;
|
|
92
93
|
(function (ToolName) {
|
|
93
94
|
ToolName["SWITCH_ASSISTANT"] = "switchAssistant";
|
|
@@ -118,6 +119,20 @@ var ToolName;
|
|
|
118
119
|
ToolName["LOAD_USER_MESSAGE_ATTACHMENT_REFERENCES"] = "loadUserMessageAttachmentReferences";
|
|
119
120
|
ToolName["SEARCH_IN_ATTACHMENTS"] = "searchInAttachments";
|
|
120
121
|
ToolName["LOAD_ATTACHMENT_ANALYSIS"] = "loadAttachmentAnalysis";
|
|
122
|
+
ToolName["SUBMIT_CRM_CANDIDATES"] = "crmSubmitCandidates";
|
|
123
|
+
ToolName["ENRICH_CRM_CANDIDATES"] = "crmEnrichCandidates";
|
|
124
|
+
ToolName["PROPOSE_CRM_WEB_ENRICHMENT"] = "crmProposeWebEnrichment";
|
|
125
|
+
ToolName["APPLY_CRM_WEB_ENRICHMENT"] = "crmApplyWebEnrichment";
|
|
126
|
+
ToolName["LIST_CRM_IMPORT_COMPANIES_FOR_WEB_ENRICHMENT"] = "crmListImportCompaniesForWebEnrichment";
|
|
127
|
+
ToolName["LINK_CRM_TOUCHPOINT_PARTICIPANT"] = "crmLinkTouchpointParticipant";
|
|
128
|
+
ToolName["PREPARE_CRM_IMPORT_PLAN"] = "crmPrepareImportPlan";
|
|
129
|
+
ToolName["EXECUTE_CRM_IMPORT_PLAN"] = "crmExecuteImportPlan";
|
|
130
|
+
ToolName["IMPORT_CRM_ATTACHMENT"] = "crmImportAttachment";
|
|
131
|
+
ToolName["LIST_CRM_OPERATIONS"] = "crmListOperations";
|
|
132
|
+
ToolName["GET_CRM_OPERATION"] = "crmGetOperation";
|
|
133
|
+
ToolName["LIST_CRM_REVIEWS"] = "crmListReviews";
|
|
134
|
+
ToolName["RESOLVE_CRM_REVIEW"] = "crmResolveReview";
|
|
135
|
+
ToolName["UNDO_CRM_OPERATION"] = "crmUndoOperation";
|
|
121
136
|
ToolName["WEB_SEARCH"] = "web_search";
|
|
122
137
|
ToolName["USE_SKILL"] = "useSkill";
|
|
123
138
|
ToolName["READ_SKILL_FILE"] = "readSkillFile";
|
|
@@ -145,6 +160,7 @@ var AiAssistantId;
|
|
|
145
160
|
(function (AiAssistantId) {
|
|
146
161
|
AiAssistantId["ASSET"] = "asset-assistant";
|
|
147
162
|
AiAssistantId["ASSET_WEB"] = "asset-web-assistant";
|
|
163
|
+
AiAssistantId["CRM"] = "crm-assistant";
|
|
148
164
|
AiAssistantId["INCIDENT"] = "incident-assistant";
|
|
149
165
|
AiAssistantId["REPORT"] = "report-assistant";
|
|
150
166
|
AiAssistantId["AXALTA_INCIDENT"] = "axalta-incident-assistant";
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { CrmContactMergeOverrides, CrmEmailMerge } from './crm.interface';
|
|
1
2
|
export type CrmAutonomyEntityType = 'company' | 'contact' | 'deal' | 'touchpoint';
|
|
2
3
|
export type CrmAutonomySource = 'assistant' | 'import' | 'outlook_mail' | 'outlook_calendar' | 'website_webform' | 'workflow';
|
|
3
4
|
export type CrmConfidenceLevel = 'high' | 'medium' | 'low';
|
|
@@ -16,6 +17,16 @@ export interface CrmAutonomyCandidateConfidence {
|
|
|
16
17
|
score?: number;
|
|
17
18
|
reasons: string[];
|
|
18
19
|
}
|
|
20
|
+
/** Official-web evidence retained with an autonomy operation, never as CRM asset data. */
|
|
21
|
+
export interface CrmAutonomyCandidateProvenance {
|
|
22
|
+
source: 'official_web';
|
|
23
|
+
officialDomain: string;
|
|
24
|
+
sources: Array<{
|
|
25
|
+
sourceUrl: string;
|
|
26
|
+
title?: string;
|
|
27
|
+
fields: string[];
|
|
28
|
+
}>;
|
|
29
|
+
}
|
|
19
30
|
export interface CrmAutonomyCandidate {
|
|
20
31
|
candidateId: string;
|
|
21
32
|
entityType: CrmAutonomyEntityType;
|
|
@@ -27,6 +38,9 @@ export interface CrmAutonomyCandidate {
|
|
|
27
38
|
parent?: string | null;
|
|
28
39
|
parentCandidateId?: string;
|
|
29
40
|
relations?: CrmCandidateRelation[];
|
|
41
|
+
/** Applies only parent/relation links while preserving the target asset data. */
|
|
42
|
+
linkOnly?: boolean;
|
|
43
|
+
provenance?: CrmAutonomyCandidateProvenance;
|
|
30
44
|
source: CrmAutonomySource;
|
|
31
45
|
sourceId: string;
|
|
32
46
|
confidence: CrmAutonomyCandidateConfidence;
|
|
@@ -46,6 +60,8 @@ export interface CrmAutonomyCandidateSubmissionRequest {
|
|
|
46
60
|
export interface CrmAutonomyCandidateResult {
|
|
47
61
|
candidateId: string;
|
|
48
62
|
entityType: CrmAutonomyEntityType;
|
|
63
|
+
/** Action after CRM identity matching, which can differ from the requested action. */
|
|
64
|
+
appliedAction?: 'create' | 'update';
|
|
49
65
|
decision: CrmAutonomyDecision;
|
|
50
66
|
assetId?: string;
|
|
51
67
|
reviewItemId?: string;
|
|
@@ -125,12 +141,43 @@ export interface CrmAutonomySubmitCandidatesResponse {
|
|
|
125
141
|
operation: CrmAutonomyOperationSummary;
|
|
126
142
|
reviewItems: CrmAutonomyReviewItemSummary[];
|
|
127
143
|
}
|
|
144
|
+
export interface CrmAutonomyReviewActionRequest {
|
|
145
|
+
note?: string;
|
|
146
|
+
candidate?: CrmAutonomyCandidate;
|
|
147
|
+
selectedMatchAssetId?: string;
|
|
148
|
+
mergeAssetIds?: string[];
|
|
149
|
+
emailMerge?: CrmEmailMerge;
|
|
150
|
+
overrides?: CrmContactMergeOverrides;
|
|
151
|
+
}
|
|
152
|
+
export interface CrmAutonomyReconcileContactGovernanceRequest {
|
|
153
|
+
operationIds: string[];
|
|
154
|
+
}
|
|
155
|
+
export interface CrmAutonomyReconcileContactGovernanceResponse {
|
|
156
|
+
resolvedCount: number;
|
|
157
|
+
pendingCount: number;
|
|
158
|
+
pendingReasonCodes: Record<string, number>;
|
|
159
|
+
}
|
|
160
|
+
export interface CrmAutonomyOperationQuery {
|
|
161
|
+
status?: CrmAutonomyOperationStatus;
|
|
162
|
+
}
|
|
163
|
+
export interface CrmAutonomyReviewQuery {
|
|
164
|
+
status?: CrmAutonomyReviewStatus;
|
|
165
|
+
}
|
|
128
166
|
export interface CrmAutonomyListOperationsResponse {
|
|
129
167
|
items: CrmAutonomyOperationSummary[];
|
|
130
168
|
}
|
|
131
169
|
export interface CrmAutonomyListReviewsResponse {
|
|
132
170
|
items: CrmAutonomyReviewItemSummary[];
|
|
133
171
|
}
|
|
172
|
+
export interface CrmAutonomyApproveReviewResponse {
|
|
173
|
+
operation: CrmAutonomyOperationSummary;
|
|
174
|
+
reviewItems: CrmAutonomyReviewItemSummary[];
|
|
175
|
+
}
|
|
176
|
+
export interface CrmAutonomyRejectReviewResponse {
|
|
177
|
+
review: CrmAutonomyReviewItemSummary;
|
|
178
|
+
operation: CrmAutonomyOperationSummary;
|
|
179
|
+
reviewItems: CrmAutonomyReviewItemSummary[];
|
|
180
|
+
}
|
|
134
181
|
export interface CrmAutonomyUndoResponse {
|
|
135
182
|
undone: boolean;
|
|
136
183
|
reason?: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Config, CrmDealReminderDeliveryResult, CrmGetDuplicatesQuery, CrmGetDuplicatesResponse, CrmImportParser, CrmImportResponse, CrmMergeContactDuplicatesRequest, CrmMergeContactDuplicatesResponse, SendDealReminderPayload, TokenOption } from '../interfaces';
|
|
1
|
+
import { Config, CrmAutonomyApproveReviewResponse, CrmAutonomyCandidateSubmissionRequest, CrmAutonomyListOperationsResponse, CrmAutonomyListReviewsResponse, CrmAutonomyOperationDetail, CrmAutonomyReconcileContactGovernanceRequest, CrmAutonomyReconcileContactGovernanceResponse, CrmAutonomyRejectReviewResponse, CrmAutonomyReviewActionRequest, CrmAutonomySubmitCandidatesResponse, CrmAutonomyUndoResponse, CrmDealReminderDeliveryResult, CrmGetDuplicatesQuery, CrmGetDuplicatesResponse, CrmImportParser, CrmImportResponse, CrmMergeContactDuplicatesRequest, CrmMergeContactDuplicatesResponse, SendDealReminderPayload, TokenOption } from '../interfaces';
|
|
2
2
|
import { CrmService } from '../services';
|
|
3
3
|
import { CrossPlatformFormData } from '../utils';
|
|
4
4
|
export declare class CrmMockService extends CrmService {
|
|
@@ -8,4 +8,14 @@ export declare class CrmMockService extends CrmService {
|
|
|
8
8
|
getDuplicates(_query?: CrmGetDuplicatesQuery, _options?: TokenOption): Promise<CrmGetDuplicatesResponse>;
|
|
9
9
|
mergeDuplicates(dto: CrmMergeContactDuplicatesRequest, _options?: TokenOption): Promise<CrmMergeContactDuplicatesResponse>;
|
|
10
10
|
sendDealReminder(_payload: SendDealReminderPayload, _options?: TokenOption): Promise<CrmDealReminderDeliveryResult>;
|
|
11
|
+
submitAutonomyCandidates(request: CrmAutonomyCandidateSubmissionRequest, _options?: TokenOption): Promise<CrmAutonomySubmitCandidatesResponse>;
|
|
12
|
+
listAutonomyOperations(_query?: {}, _options?: TokenOption): Promise<CrmAutonomyListOperationsResponse>;
|
|
13
|
+
getAutonomyOperation(operationId: string, _options?: TokenOption): Promise<CrmAutonomyOperationDetail>;
|
|
14
|
+
listAutonomyReviews(_query?: {}, _options?: TokenOption): Promise<CrmAutonomyListReviewsResponse>;
|
|
15
|
+
approveAutonomyReview(_reviewId: string, _action?: CrmAutonomyReviewActionRequest, _options?: TokenOption): Promise<CrmAutonomyApproveReviewResponse>;
|
|
16
|
+
rejectAutonomyReview(reviewId: string, _action?: Pick<CrmAutonomyReviewActionRequest, 'note'>, _options?: TokenOption): Promise<CrmAutonomyRejectReviewResponse>;
|
|
17
|
+
reconcileContactGovernance(_request: CrmAutonomyReconcileContactGovernanceRequest, _options?: TokenOption): Promise<CrmAutonomyReconcileContactGovernanceResponse>;
|
|
18
|
+
undoAutonomyOperation(operationId: string, _options?: TokenOption): Promise<CrmAutonomyUndoResponse>;
|
|
19
|
+
private createAutonomyOperation;
|
|
20
|
+
private createAutonomyReview;
|
|
11
21
|
}
|
|
@@ -67,5 +67,61 @@ class CrmMockService extends services_1.CrmService {
|
|
|
67
67
|
delivered: true,
|
|
68
68
|
};
|
|
69
69
|
}
|
|
70
|
+
async submitAutonomyCandidates(request, _options = {}) {
|
|
71
|
+
return { operation: this.createAutonomyOperation(request), reviewItems: [] };
|
|
72
|
+
}
|
|
73
|
+
async listAutonomyOperations(_query = {}, _options = {}) {
|
|
74
|
+
return { items: [] };
|
|
75
|
+
}
|
|
76
|
+
async getAutonomyOperation(operationId, _options = {}) {
|
|
77
|
+
return { ...this.createAutonomyOperation(), id: operationId, candidates: [] };
|
|
78
|
+
}
|
|
79
|
+
async listAutonomyReviews(_query = {}, _options = {}) {
|
|
80
|
+
return { items: [] };
|
|
81
|
+
}
|
|
82
|
+
async approveAutonomyReview(_reviewId, _action = {}, _options = {}) {
|
|
83
|
+
return { operation: this.createAutonomyOperation(), reviewItems: [] };
|
|
84
|
+
}
|
|
85
|
+
async rejectAutonomyReview(reviewId, _action = {}, _options = {}) {
|
|
86
|
+
return { review: this.createAutonomyReview(reviewId), operation: this.createAutonomyOperation(), reviewItems: [] };
|
|
87
|
+
}
|
|
88
|
+
async reconcileContactGovernance(_request, _options = {}) {
|
|
89
|
+
return { resolvedCount: 0, pendingCount: 0, pendingReasonCodes: {} };
|
|
90
|
+
}
|
|
91
|
+
async undoAutonomyOperation(operationId, _options = {}) {
|
|
92
|
+
return { undone: true, operation: { ...this.createAutonomyOperation(), id: operationId, status: 'undone' } };
|
|
93
|
+
}
|
|
94
|
+
createAutonomyOperation(request) {
|
|
95
|
+
const now = new Date().toISOString();
|
|
96
|
+
return {
|
|
97
|
+
id: 'mock-crm-autonomy-operation',
|
|
98
|
+
ownerId: 'mock-owner',
|
|
99
|
+
source: request?.source ?? 'assistant',
|
|
100
|
+
sourceId: request?.sourceId ?? 'mock-source',
|
|
101
|
+
idempotencyKey: request?.idempotencyKey ?? 'mock-idempotency-key',
|
|
102
|
+
status: 'executed',
|
|
103
|
+
triggeredBy: { type: 'user', id: 'mock-user' },
|
|
104
|
+
policyVersion: 'mock-policy',
|
|
105
|
+
createdAssetIds: {},
|
|
106
|
+
candidateResults: [],
|
|
107
|
+
createdAt: now,
|
|
108
|
+
updatedAt: now,
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
createAutonomyReview(id) {
|
|
112
|
+
const now = new Date().toISOString();
|
|
113
|
+
return {
|
|
114
|
+
id,
|
|
115
|
+
ownerId: 'mock-owner',
|
|
116
|
+
operationId: 'mock-crm-autonomy-operation',
|
|
117
|
+
candidateId: 'mock-candidate',
|
|
118
|
+
entityType: 'contact',
|
|
119
|
+
status: 'rejected',
|
|
120
|
+
appliedRule: 'mock-rule',
|
|
121
|
+
reasonCodes: [],
|
|
122
|
+
createdAt: now,
|
|
123
|
+
updatedAt: now,
|
|
124
|
+
};
|
|
125
|
+
}
|
|
70
126
|
}
|
|
71
127
|
exports.CrmMockService = CrmMockService;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { APIBase } from '../api-base';
|
|
2
2
|
import { Config, TokenOption } from '../interfaces';
|
|
3
|
+
import { CrmAutonomyApproveReviewResponse, CrmAutonomyCandidateSubmissionRequest, CrmAutonomyListOperationsResponse, CrmAutonomyListReviewsResponse, CrmAutonomyOperationDetail, CrmAutonomyOperationQuery, CrmAutonomyReconcileContactGovernanceRequest, CrmAutonomyReconcileContactGovernanceResponse, CrmAutonomyRejectReviewResponse, CrmAutonomyReviewActionRequest, CrmAutonomyReviewItemDetail, CrmAutonomyReviewQuery, CrmAutonomySubmitCandidatesResponse, CrmAutonomyUndoResponse } from '../interfaces/crm-autonomy.interface';
|
|
3
4
|
import { CrmDealReminderDeliveryResult, CrmGetDuplicatesQuery, CrmGetDuplicatesResponse, CrmImportParser, CrmImportResponse, CrmMergeContactDuplicatesRequest, CrmMergeContactDuplicatesResponse, SendDealReminderPayload } from '../interfaces/crm.interface';
|
|
4
5
|
import { CrossPlatformFormData } from '../utils';
|
|
5
6
|
import { HttpClientService } from './http-client.service';
|
|
@@ -10,4 +11,13 @@ export declare class CrmService extends APIBase {
|
|
|
10
11
|
getDuplicates(query?: CrmGetDuplicatesQuery, options?: TokenOption): Promise<CrmGetDuplicatesResponse>;
|
|
11
12
|
mergeDuplicates(dto: CrmMergeContactDuplicatesRequest, options?: TokenOption): Promise<CrmMergeContactDuplicatesResponse>;
|
|
12
13
|
sendDealReminder(payload: SendDealReminderPayload, options?: TokenOption): Promise<CrmDealReminderDeliveryResult>;
|
|
14
|
+
submitAutonomyCandidates(request: CrmAutonomyCandidateSubmissionRequest, options?: TokenOption): Promise<CrmAutonomySubmitCandidatesResponse>;
|
|
15
|
+
listAutonomyOperations(query?: CrmAutonomyOperationQuery, options?: TokenOption): Promise<CrmAutonomyListOperationsResponse>;
|
|
16
|
+
getAutonomyOperation(operationId: string, options?: TokenOption): Promise<CrmAutonomyOperationDetail>;
|
|
17
|
+
listAutonomyReviews(query?: CrmAutonomyReviewQuery, options?: TokenOption): Promise<CrmAutonomyListReviewsResponse>;
|
|
18
|
+
getAutonomyReview(reviewId: string, options?: TokenOption): Promise<CrmAutonomyReviewItemDetail>;
|
|
19
|
+
approveAutonomyReview(reviewId: string, action?: CrmAutonomyReviewActionRequest, options?: TokenOption): Promise<CrmAutonomyApproveReviewResponse>;
|
|
20
|
+
rejectAutonomyReview(reviewId: string, action?: Pick<CrmAutonomyReviewActionRequest, 'note'>, options?: TokenOption): Promise<CrmAutonomyRejectReviewResponse>;
|
|
21
|
+
reconcileContactGovernance(request: CrmAutonomyReconcileContactGovernanceRequest, options?: TokenOption): Promise<CrmAutonomyReconcileContactGovernanceResponse>;
|
|
22
|
+
undoAutonomyOperation(operationId: string, options?: TokenOption): Promise<CrmAutonomyUndoResponse>;
|
|
13
23
|
}
|
|
@@ -29,5 +29,32 @@ class CrmService extends api_base_1.APIBase {
|
|
|
29
29
|
sendDealReminder(payload, options = {}) {
|
|
30
30
|
return this.httpClient.post(`${this.basePath}/deal-reminder/send`, payload, options);
|
|
31
31
|
}
|
|
32
|
+
submitAutonomyCandidates(request, options = {}) {
|
|
33
|
+
return this.httpClient.post(`${this.basePath}/autonomy/candidates`, request, options);
|
|
34
|
+
}
|
|
35
|
+
listAutonomyOperations(query = {}, options = {}) {
|
|
36
|
+
return this.httpClient.get(`${this.basePath}/autonomy/operations`, { ...options, params: query });
|
|
37
|
+
}
|
|
38
|
+
getAutonomyOperation(operationId, options = {}) {
|
|
39
|
+
return this.httpClient.get(`${this.basePath}/autonomy/operations/${operationId}`, options);
|
|
40
|
+
}
|
|
41
|
+
listAutonomyReviews(query = {}, options = {}) {
|
|
42
|
+
return this.httpClient.get(`${this.basePath}/autonomy/reviews`, { ...options, params: query });
|
|
43
|
+
}
|
|
44
|
+
getAutonomyReview(reviewId, options = {}) {
|
|
45
|
+
return this.httpClient.get(`${this.basePath}/autonomy/reviews/${reviewId}`, options);
|
|
46
|
+
}
|
|
47
|
+
approveAutonomyReview(reviewId, action = {}, options = {}) {
|
|
48
|
+
return this.httpClient.post(`${this.basePath}/autonomy/reviews/${reviewId}/approve`, action, options);
|
|
49
|
+
}
|
|
50
|
+
rejectAutonomyReview(reviewId, action = {}, options = {}) {
|
|
51
|
+
return this.httpClient.post(`${this.basePath}/autonomy/reviews/${reviewId}/reject`, action, options);
|
|
52
|
+
}
|
|
53
|
+
reconcileContactGovernance(request, options = {}) {
|
|
54
|
+
return this.httpClient.post(`${this.basePath}/autonomy/reviews/reconcile-contact-governance`, request, options);
|
|
55
|
+
}
|
|
56
|
+
undoAutonomyOperation(operationId, options = {}) {
|
|
57
|
+
return this.httpClient.post(`${this.basePath}/autonomy/operations/${operationId}/undo`, {}, options);
|
|
58
|
+
}
|
|
32
59
|
}
|
|
33
60
|
exports.CrmService = CrmService;
|