@elevasis/core 0.15.0 → 0.15.1
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/index.d.ts +60 -0
- package/dist/index.js +198 -1
- package/dist/organization-model/index.d.ts +60 -0
- package/dist/organization-model/index.js +198 -1
- package/dist/test-utils/index.d.ts +399 -363
- package/dist/test-utils/index.js +198 -1
- package/package.json +3 -3
- package/src/_gen/__tests__/__snapshots__/contracts.md.snap +826 -703
- package/src/business/acquisition/activity-events.ts +12 -3
- package/src/business/acquisition/api-schemas.test.ts +315 -4
- package/src/business/acquisition/api-schemas.ts +1192 -1097
- package/src/business/acquisition/build-templates.ts +44 -0
- package/src/business/acquisition/crm-next-action.test.ts +262 -0
- package/src/business/acquisition/crm-next-action.ts +220 -0
- package/src/business/acquisition/crm-priority.test.ts +216 -0
- package/src/business/acquisition/crm-priority.ts +349 -0
- package/src/business/acquisition/crm-state-actions.test.ts +12 -21
- package/src/business/acquisition/deal-ownership.test.ts +351 -0
- package/src/business/acquisition/deal-ownership.ts +120 -0
- package/src/business/acquisition/derive-actions.test.ts +101 -37
- package/src/business/acquisition/derive-actions.ts +102 -87
- package/src/business/acquisition/index.ts +10 -0
- package/src/business/acquisition/types.ts +51 -8
- package/src/execution/engine/index.ts +4 -3
- package/src/execution/engine/tools/lead-service-types.ts +44 -30
- package/src/execution/engine/tools/platform/acquisition/list-tools.ts +6 -5
- package/src/execution/engine/tools/platform/acquisition/types.ts +3 -1
- package/src/execution/engine/tools/registry.ts +4 -3
- package/src/execution/engine/tools/tool-maps.ts +3 -1
- package/src/organization-model/domains/prospecting.ts +204 -1
- package/src/organization-model/domains/sales.test.ts +29 -0
- package/src/organization-model/domains/sales.ts +102 -0
- package/src/organization-model/types.ts +2 -2
- package/src/platform/constants/versions.ts +1 -1
- package/src/reference/_generated/contracts.md +826 -703
- package/src/supabase/database.types.ts +2978 -2958
|
@@ -1,18 +1,19 @@
|
|
|
1
|
-
import { z } from 'zod'
|
|
1
|
+
import { z } from 'zod'
|
|
2
2
|
import {
|
|
3
3
|
CRM_DISCOVERY_BOOKING_CANCELLED_STATE,
|
|
4
4
|
CRM_DISCOVERY_LINK_SENT_STATE,
|
|
5
5
|
CRM_DISCOVERY_NUDGING_STATE,
|
|
6
6
|
CRM_DISCOVERY_REPLIED_STATE
|
|
7
7
|
} from '@repo/core/organization-model'
|
|
8
|
+
import { getDealOwnership, type DealOwnership } from './deal-ownership'
|
|
8
9
|
import type { AcqDealRow } from './types'
|
|
9
|
-
|
|
10
|
-
export interface Action {
|
|
11
|
-
key: string
|
|
12
|
-
label: string
|
|
13
|
-
payloadSchema?: z.ZodTypeAny
|
|
14
|
-
}
|
|
15
|
-
|
|
10
|
+
|
|
11
|
+
export interface Action {
|
|
12
|
+
key: string
|
|
13
|
+
label: string
|
|
14
|
+
payloadSchema?: z.ZodTypeAny
|
|
15
|
+
}
|
|
16
|
+
|
|
16
17
|
export interface ActionDef {
|
|
17
18
|
key: string
|
|
18
19
|
label: string
|
|
@@ -21,93 +22,107 @@ export interface ActionDef {
|
|
|
21
22
|
payloadSchema?: z.ZodTypeAny
|
|
22
23
|
}
|
|
23
24
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
25
|
+
type DealActionInput = AcqDealRow & {
|
|
26
|
+
ownership?: DealOwnership
|
|
27
|
+
nextAction?: string | null
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export const SendReplyActionPayloadSchema = z
|
|
31
|
+
.object({
|
|
32
|
+
replyBody: z.string().trim().min(1).max(10000)
|
|
33
|
+
})
|
|
34
|
+
.strict()
|
|
35
|
+
|
|
36
|
+
export const DEFAULT_CRM_ACTIONS: ActionDef[] = [
|
|
37
|
+
{
|
|
38
|
+
key: 'move_to_proposal',
|
|
39
|
+
label: 'Move to Proposal',
|
|
40
|
+
isAvailableFor: (deal) => deal.stage_key === 'interested',
|
|
41
|
+
workflowId: 'move_to_proposal-workflow'
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
key: 'move_to_closing',
|
|
45
|
+
label: 'Move to Closing',
|
|
46
|
+
isAvailableFor: (deal) => deal.stage_key === 'proposal',
|
|
47
|
+
workflowId: 'move_to_closing-workflow'
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
key: 'move_to_closed_won',
|
|
51
|
+
label: 'Close Won',
|
|
52
|
+
isAvailableFor: (deal) => deal.stage_key === 'closing',
|
|
53
|
+
workflowId: 'move_to_closed_won-workflow'
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
key: 'move_to_closed_lost',
|
|
57
|
+
label: 'Close Lost',
|
|
58
|
+
isAvailableFor: (deal) =>
|
|
59
|
+
deal.stage_key === 'interested' || deal.stage_key === 'proposal' || deal.stage_key === 'closing',
|
|
60
|
+
workflowId: 'move_to_closed_lost-workflow'
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
key: 'move_to_nurturing',
|
|
64
|
+
label: 'Move to Nurturing',
|
|
65
|
+
isAvailableFor: (deal) =>
|
|
66
|
+
deal.stage_key === 'interested' || deal.stage_key === 'proposal' || deal.stage_key === 'closing',
|
|
67
|
+
workflowId: 'move_to_nurturing-workflow'
|
|
68
|
+
},
|
|
69
|
+
{
|
|
64
70
|
key: 'send_reply',
|
|
65
71
|
label: 'Send Reply',
|
|
66
72
|
isAvailableFor: (deal) =>
|
|
67
73
|
deal.stage_key === 'interested' &&
|
|
74
|
+
isOurReplyAction(deal) &&
|
|
68
75
|
(deal.state_key === CRM_DISCOVERY_REPLIED_STATE.stateKey ||
|
|
69
76
|
deal.state_key === CRM_DISCOVERY_LINK_SENT_STATE.stateKey ||
|
|
70
77
|
deal.state_key === CRM_DISCOVERY_NUDGING_STATE.stateKey),
|
|
71
|
-
workflowId: 'crm-send-reply-workflow',
|
|
72
|
-
payloadSchema: SendReplyActionPayloadSchema
|
|
73
|
-
},
|
|
74
|
-
{
|
|
75
|
-
key: 'send_link',
|
|
76
|
-
label: 'Send Booking Link',
|
|
77
|
-
isAvailableFor: (deal) =>
|
|
78
|
-
deal.stage_key === 'interested' && deal.state_key === CRM_DISCOVERY_REPLIED_STATE.stateKey,
|
|
79
|
-
workflowId: 'crm-send-booking-link-workflow'
|
|
80
|
-
},
|
|
81
|
-
{
|
|
82
|
-
key: 'send_nudge',
|
|
83
|
-
label: 'Send Nudge',
|
|
84
|
-
isAvailableFor: (deal) =>
|
|
85
|
-
deal.stage_key === 'interested' &&
|
|
86
|
-
(deal.state_key === CRM_DISCOVERY_LINK_SENT_STATE.stateKey ||
|
|
87
|
-
deal.state_key === CRM_DISCOVERY_NUDGING_STATE.stateKey),
|
|
88
|
-
workflowId: 'crm-send-nudge-workflow'
|
|
89
|
-
},
|
|
90
|
-
{
|
|
91
|
-
key: 'mark_no_show',
|
|
92
|
-
label: 'Mark No-Show',
|
|
93
|
-
isAvailableFor: (deal) =>
|
|
94
|
-
deal.stage_key === 'interested' && deal.state_key === CRM_DISCOVERY_NUDGING_STATE.stateKey,
|
|
95
|
-
// Mirrors the auto-timeout precedent in operations/sales/crm/pipeline/timeout-actions.ts:
|
|
96
|
-
// both manual-click and timeout move the deal to closed_lost. The action_taken activity
|
|
97
|
-
// event captures operator intent and distinguishes the manual variant from the timed one.
|
|
98
|
-
workflowId: 'mark_no_show-workflow'
|
|
99
|
-
},
|
|
100
|
-
{
|
|
101
|
-
key: 'rebook',
|
|
102
|
-
label: 'Rebook',
|
|
103
|
-
isAvailableFor: (deal) =>
|
|
104
|
-
deal.stage_key === 'interested' && deal.state_key === CRM_DISCOVERY_BOOKING_CANCELLED_STATE.stateKey,
|
|
105
|
-
workflowId: 'crm-rebook-workflow'
|
|
106
|
-
}
|
|
107
|
-
]
|
|
108
|
-
|
|
109
|
-
export function deriveActions(deal:
|
|
78
|
+
workflowId: 'crm-send-reply-workflow',
|
|
79
|
+
payloadSchema: SendReplyActionPayloadSchema
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
key: 'send_link',
|
|
83
|
+
label: 'Send Booking Link',
|
|
84
|
+
isAvailableFor: (deal) =>
|
|
85
|
+
deal.stage_key === 'interested' && deal.state_key === CRM_DISCOVERY_REPLIED_STATE.stateKey,
|
|
86
|
+
workflowId: 'crm-send-booking-link-workflow'
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
key: 'send_nudge',
|
|
90
|
+
label: 'Send Nudge',
|
|
91
|
+
isAvailableFor: (deal) =>
|
|
92
|
+
deal.stage_key === 'interested' &&
|
|
93
|
+
(deal.state_key === CRM_DISCOVERY_LINK_SENT_STATE.stateKey ||
|
|
94
|
+
deal.state_key === CRM_DISCOVERY_NUDGING_STATE.stateKey),
|
|
95
|
+
workflowId: 'crm-send-nudge-workflow'
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
key: 'mark_no_show',
|
|
99
|
+
label: 'Mark No-Show',
|
|
100
|
+
isAvailableFor: (deal) =>
|
|
101
|
+
deal.stage_key === 'interested' && deal.state_key === CRM_DISCOVERY_NUDGING_STATE.stateKey,
|
|
102
|
+
// Mirrors the auto-timeout precedent in operations/sales/crm/pipeline/timeout-actions.ts:
|
|
103
|
+
// both manual-click and timeout move the deal to closed_lost. The action_taken activity
|
|
104
|
+
// event captures operator intent and distinguishes the manual variant from the timed one.
|
|
105
|
+
workflowId: 'mark_no_show-workflow'
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
key: 'rebook',
|
|
109
|
+
label: 'Rebook',
|
|
110
|
+
isAvailableFor: (deal) =>
|
|
111
|
+
deal.stage_key === 'interested' && deal.state_key === CRM_DISCOVERY_BOOKING_CANCELLED_STATE.stateKey,
|
|
112
|
+
workflowId: 'crm-rebook-workflow'
|
|
113
|
+
}
|
|
114
|
+
]
|
|
115
|
+
|
|
116
|
+
export function deriveActions(deal: DealActionInput, actions: ActionDef[] = DEFAULT_CRM_ACTIONS): Action[] {
|
|
110
117
|
return actions
|
|
111
118
|
.filter((a) => a.isAvailableFor(deal))
|
|
112
119
|
.map(({ key, label, payloadSchema }) => ({ key, label, payloadSchema }))
|
|
113
120
|
}
|
|
121
|
+
|
|
122
|
+
function isOurReplyAction(deal: DealActionInput): boolean {
|
|
123
|
+
if (Object.prototype.hasOwnProperty.call(deal, 'nextAction')) {
|
|
124
|
+
return deal.nextAction === 'send_reply'
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
return (deal.ownership ?? getDealOwnership(deal)) === 'us'
|
|
128
|
+
}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
export * from './types'
|
|
2
2
|
export * from './activity-events'
|
|
3
|
+
export * from './build-templates'
|
|
3
4
|
export * from './derive-actions'
|
|
5
|
+
export * from './crm-priority'
|
|
6
|
+
export * from './crm-next-action'
|
|
7
|
+
export * from './deal-ownership'
|
|
4
8
|
export * from './stateful'
|
|
5
9
|
// Export api-schemas selectively to avoid re-exporting names already defined in types.ts
|
|
6
10
|
// (DealStage, AcqDealTaskKind are declared as union types there; api-schemas re-infers them from Zod)
|
|
@@ -35,6 +39,7 @@ export {
|
|
|
35
39
|
ExecuteActionParamsSchema,
|
|
36
40
|
ExecuteActionRequestSchema,
|
|
37
41
|
DealContactSummarySchema,
|
|
42
|
+
DealPrioritySchema,
|
|
38
43
|
DealListItemSchema,
|
|
39
44
|
DealListResponseSchema,
|
|
40
45
|
DealDetailResponseSchema,
|
|
@@ -48,6 +53,10 @@ export {
|
|
|
48
53
|
IcpRubricSchema,
|
|
49
54
|
PipelineStageSchema,
|
|
50
55
|
PipelineConfigSchema,
|
|
56
|
+
BuildPlanSnapshotStepSchema,
|
|
57
|
+
BuildPlanSnapshotSchema,
|
|
58
|
+
AcqListMetadataSchema,
|
|
59
|
+
ProspectingBuildTemplateIdSchema,
|
|
51
60
|
ProcessingStageStatusSchema,
|
|
52
61
|
ListStageCountsSchema,
|
|
53
62
|
ListTelemetrySchema,
|
|
@@ -119,6 +128,7 @@ export {
|
|
|
119
128
|
type TransitionDealStateRequest,
|
|
120
129
|
type ExecuteActionParams,
|
|
121
130
|
type ExecuteActionRequest,
|
|
131
|
+
type DealPriorityResponse,
|
|
122
132
|
type DealListResponse,
|
|
123
133
|
type DealDetailResponse,
|
|
124
134
|
type DealNoteResponse,
|
|
@@ -186,6 +186,34 @@ export interface PipelineConfig {
|
|
|
186
186
|
stages: PipelineStage[]
|
|
187
187
|
}
|
|
188
188
|
|
|
189
|
+
export type BuildPlanSnapshotPrimaryEntity = 'company' | 'contact'
|
|
190
|
+
export type BuildPlanSnapshotOutput = 'company' | 'contact' | 'export'
|
|
191
|
+
export type BuildPlanSnapshotDependencyMode = 'per-record-eligibility'
|
|
192
|
+
|
|
193
|
+
export interface BuildPlanSnapshotStep {
|
|
194
|
+
id: string
|
|
195
|
+
label: string
|
|
196
|
+
description?: string
|
|
197
|
+
primaryEntity: BuildPlanSnapshotPrimaryEntity
|
|
198
|
+
outputs: BuildPlanSnapshotOutput[]
|
|
199
|
+
stageKey: string
|
|
200
|
+
dependsOn?: string[]
|
|
201
|
+
dependencyMode: BuildPlanSnapshotDependencyMode
|
|
202
|
+
capabilityKey: string
|
|
203
|
+
defaultBatchSize: number
|
|
204
|
+
maxBatchSize: number
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
export interface BuildPlanSnapshot {
|
|
208
|
+
templateId: string
|
|
209
|
+
templateLabel: string
|
|
210
|
+
steps: BuildPlanSnapshotStep[]
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
export interface AcqListMetadata extends Record<string, unknown> {
|
|
214
|
+
buildPlanSnapshot?: BuildPlanSnapshot
|
|
215
|
+
}
|
|
216
|
+
|
|
189
217
|
export interface AcqList {
|
|
190
218
|
id: string
|
|
191
219
|
organizationId: string
|
|
@@ -197,7 +225,7 @@ export interface AcqList {
|
|
|
197
225
|
scrapingConfig: ScrapingConfig
|
|
198
226
|
icp: IcpRubric
|
|
199
227
|
pipelineConfig: PipelineConfig
|
|
200
|
-
metadata:
|
|
228
|
+
metadata: AcqListMetadata
|
|
201
229
|
launchedAt: Date | null
|
|
202
230
|
completedAt: Date | null
|
|
203
231
|
createdAt: Date
|
|
@@ -272,6 +300,18 @@ export interface AcqContact {
|
|
|
272
300
|
|
|
273
301
|
export type DealStage = 'interested' | 'proposal' | 'closing' | 'closed_won' | 'closed_lost' | 'nurturing'
|
|
274
302
|
|
|
303
|
+
export type DealPriorityBucketKey = 'needs_response' | 'follow_up_due' | 'waiting' | 'stale' | 'closed_low'
|
|
304
|
+
|
|
305
|
+
export interface DealPriority {
|
|
306
|
+
bucketKey: DealPriorityBucketKey
|
|
307
|
+
rank: number
|
|
308
|
+
label: string
|
|
309
|
+
color: string
|
|
310
|
+
reason: string
|
|
311
|
+
latestActivityAt: string | null
|
|
312
|
+
nextActionAt: string | null
|
|
313
|
+
}
|
|
314
|
+
|
|
275
315
|
export interface KanbanStageConfig {
|
|
276
316
|
color: string // Mantine color token (e.g. 'blue', 'teal')
|
|
277
317
|
label?: string // Optional display label override
|
|
@@ -309,9 +349,12 @@ export interface DealFilters {
|
|
|
309
349
|
}
|
|
310
350
|
|
|
311
351
|
/** Deal list item with joined contact and company data */
|
|
312
|
-
export interface DealListItem extends AcqDealRow {
|
|
313
|
-
|
|
314
|
-
|
|
352
|
+
export interface DealListItem extends AcqDealRow {
|
|
353
|
+
priority: DealPriority
|
|
354
|
+
ownership: 'us' | 'them' | null
|
|
355
|
+
nextAction: string | null
|
|
356
|
+
contact: DealContact | null
|
|
357
|
+
}
|
|
315
358
|
|
|
316
359
|
export type DealDetail = DealListItem
|
|
317
360
|
|
|
@@ -341,10 +384,10 @@ export interface AcqDealTask {
|
|
|
341
384
|
// ─── Progress / Telemetry Types ──────────────────────────────────────────────
|
|
342
385
|
|
|
343
386
|
/**
|
|
344
|
-
* Live-scan aggregate telemetry for a single list, computed on demand from
|
|
345
|
-
* the list junction tables and current contact deliverability state.
|
|
346
|
-
* `stageCounts` are attempted counts from list-row processing_state.
|
|
347
|
-
*/
|
|
387
|
+
* Live-scan aggregate telemetry for a single list, computed on demand from
|
|
388
|
+
* the list junction tables and current contact deliverability state.
|
|
389
|
+
* `stageCounts` are attempted counts from list-row processing_state.
|
|
390
|
+
*/
|
|
348
391
|
export interface ListTelemetry {
|
|
349
392
|
listId: string
|
|
350
393
|
totalCompanies: number
|
|
@@ -297,9 +297,10 @@ export {
|
|
|
297
297
|
type UpdateProposalDataParams,
|
|
298
298
|
type MarkProposalSentParams,
|
|
299
299
|
type MarkProposalReviewedParams,
|
|
300
|
-
type UpdateCloseLostReasonParams,
|
|
301
|
-
type UpdateFeesParams,
|
|
302
|
-
type
|
|
300
|
+
type UpdateCloseLostReasonParams,
|
|
301
|
+
type UpdateFeesParams,
|
|
302
|
+
type CacheInstantlyThreadIdsParams,
|
|
303
|
+
type TransitionItemParams,
|
|
303
304
|
type SetContactNurtureParams,
|
|
304
305
|
type CancelSchedulesAndHitlByEmailParams,
|
|
305
306
|
type CancelHitlByDealIdParams,
|
|
@@ -59,19 +59,20 @@ export interface CreateListParams {
|
|
|
59
59
|
description?: string
|
|
60
60
|
type?: string
|
|
61
61
|
batchIds?: string[]
|
|
62
|
-
instantlyCampaignId?: string
|
|
63
|
-
status?: ListStatus
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
62
|
+
instantlyCampaignId?: string
|
|
63
|
+
status?: ListStatus
|
|
64
|
+
buildTemplateId?: string
|
|
65
|
+
metadata?: Record<string, unknown>
|
|
66
|
+
scrapingConfig?: ScrapingConfig
|
|
67
|
+
icp?: IcpRubric
|
|
67
68
|
pipelineConfig?: PipelineConfig
|
|
68
69
|
}
|
|
69
70
|
|
|
70
|
-
export interface UpdateListParams {
|
|
71
|
-
name?: string
|
|
72
|
-
description?: string
|
|
73
|
-
batchIds?: string[]
|
|
74
|
-
}
|
|
71
|
+
export interface UpdateListParams {
|
|
72
|
+
name?: string
|
|
73
|
+
description?: string
|
|
74
|
+
batchIds?: string[]
|
|
75
|
+
}
|
|
75
76
|
|
|
76
77
|
export interface UpdateListStatusParams {
|
|
77
78
|
organizationId: string
|
|
@@ -193,10 +194,14 @@ export interface UpsertDealParams {
|
|
|
193
194
|
/** Deal origin: 'instantly', 'referral', 'inbound', 'manual' */
|
|
194
195
|
sourceType?: 'instantly' | 'referral' | 'inbound' | 'manual'
|
|
195
196
|
/** Optional discovery data JSONB to set on upsert */
|
|
196
|
-
discoveryData?: unknown
|
|
197
|
-
/** Optional proposal data JSONB to set on upsert */
|
|
198
|
-
proposalData?: unknown
|
|
199
|
-
|
|
197
|
+
discoveryData?: unknown
|
|
198
|
+
/** Optional proposal data JSONB to set on upsert */
|
|
199
|
+
proposalData?: unknown
|
|
200
|
+
/** Instantly email UUID used to hydrate the reply thread */
|
|
201
|
+
instantlyThreadUuid?: string
|
|
202
|
+
/** Instantly sender account for direction detection */
|
|
203
|
+
instantlyEmailAccount?: string
|
|
204
|
+
}
|
|
200
205
|
|
|
201
206
|
export interface UpdateDiscoveryDataParams {
|
|
202
207
|
organizationId: string
|
|
@@ -230,19 +235,26 @@ export interface UpdateCloseLostReasonParams {
|
|
|
230
235
|
reason: string
|
|
231
236
|
}
|
|
232
237
|
|
|
233
|
-
export interface UpdateFeesParams {
|
|
234
|
-
organizationId: string
|
|
235
|
-
contactEmail?: string
|
|
236
|
-
dealId?: string
|
|
237
|
-
initialFee?: number
|
|
238
|
-
monthlyFee?: number
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
export interface
|
|
242
|
-
organizationId: string
|
|
243
|
-
dealId: string
|
|
244
|
-
|
|
245
|
-
|
|
238
|
+
export interface UpdateFeesParams {
|
|
239
|
+
organizationId: string
|
|
240
|
+
contactEmail?: string
|
|
241
|
+
dealId?: string
|
|
242
|
+
initialFee?: number
|
|
243
|
+
monthlyFee?: number
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
export interface CacheInstantlyThreadIdsParams {
|
|
247
|
+
organizationId: string
|
|
248
|
+
dealId: string
|
|
249
|
+
instantlyThreadUuid: string
|
|
250
|
+
instantlyEmailAccount: string
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
export interface TransitionItemParams {
|
|
254
|
+
organizationId: string
|
|
255
|
+
dealId: string
|
|
256
|
+
pipelineKey: string
|
|
257
|
+
stageKey: string
|
|
246
258
|
stateKey?: string | null
|
|
247
259
|
reason?: string
|
|
248
260
|
expectedUpdatedAt?: string
|
|
@@ -844,9 +856,11 @@ export interface ILeadService {
|
|
|
844
856
|
|
|
845
857
|
updateCloseLostReason(params: UpdateCloseLostReasonParams): Promise<void>
|
|
846
858
|
|
|
847
|
-
updateFees(params: UpdateFeesParams): Promise<void>
|
|
848
|
-
|
|
849
|
-
|
|
859
|
+
updateFees(params: UpdateFeesParams): Promise<void>
|
|
860
|
+
|
|
861
|
+
cacheInstantlyThreadIds(params: CacheInstantlyThreadIdsParams): Promise<void>
|
|
862
|
+
|
|
863
|
+
transitionItem(params: TransitionItemParams): Promise<void>
|
|
850
864
|
|
|
851
865
|
setContactNurture(params: SetContactNurtureParams): Promise<void>
|
|
852
866
|
|
|
@@ -38,13 +38,14 @@ export function createAcqListCreateTool(): Tool {
|
|
|
38
38
|
if (!leadService) throw serviceUnavailable('LeadService')
|
|
39
39
|
if (!executionContext?.organizationId) throw serviceUnavailable('ExecutionContext', { reason: 'organizationId required for multi-tenant isolation' })
|
|
40
40
|
|
|
41
|
-
const typedInput = input as { name: string; description?: string }
|
|
41
|
+
const typedInput = input as { name: string; description?: string; buildTemplateId?: string }
|
|
42
42
|
|
|
43
43
|
const result = await leadService.createList({
|
|
44
|
-
organizationId: executionContext.organizationId,
|
|
45
|
-
name: typedInput.name,
|
|
46
|
-
description: typedInput.description
|
|
47
|
-
|
|
44
|
+
organizationId: executionContext.organizationId,
|
|
45
|
+
name: typedInput.name,
|
|
46
|
+
description: typedInput.description,
|
|
47
|
+
buildTemplateId: typedInput.buildTemplateId
|
|
48
|
+
})
|
|
48
49
|
|
|
49
50
|
return {
|
|
50
51
|
id: result.id,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod'
|
|
2
|
+
import { isProspectingBuildTemplateId } from '../../../../../business/acquisition/build-templates'
|
|
2
3
|
|
|
3
4
|
// ============================================
|
|
4
5
|
// LIST SCHEMAS
|
|
@@ -6,7 +7,8 @@ import { z } from 'zod'
|
|
|
6
7
|
|
|
7
8
|
export const CreateListInputSchema = z.object({
|
|
8
9
|
name: z.string().min(1),
|
|
9
|
-
description: z.string().optional()
|
|
10
|
+
description: z.string().optional(),
|
|
11
|
+
buildTemplateId: z.string().refine(isProspectingBuildTemplateId).optional()
|
|
10
12
|
})
|
|
11
13
|
|
|
12
14
|
export const UpdateListInputSchema = z.object({
|
|
@@ -557,9 +557,10 @@ export {
|
|
|
557
557
|
type UpdateProposalDataParams,
|
|
558
558
|
type MarkProposalSentParams,
|
|
559
559
|
type MarkProposalReviewedParams,
|
|
560
|
-
type UpdateCloseLostReasonParams,
|
|
561
|
-
type UpdateFeesParams,
|
|
562
|
-
type
|
|
560
|
+
type UpdateCloseLostReasonParams,
|
|
561
|
+
type UpdateFeesParams,
|
|
562
|
+
type CacheInstantlyThreadIdsParams,
|
|
563
|
+
type TransitionItemParams,
|
|
563
564
|
type SetContactNurtureParams,
|
|
564
565
|
type CancelSchedulesAndHitlByEmailParams,
|
|
565
566
|
type CancelHitlByDealIdParams,
|
|
@@ -243,6 +243,7 @@ import type {
|
|
|
243
243
|
MarkProposalReviewedParams,
|
|
244
244
|
UpdateCloseLostReasonParams,
|
|
245
245
|
UpdateFeesParams,
|
|
246
|
+
CacheInstantlyThreadIdsParams,
|
|
246
247
|
TransitionItemParams,
|
|
247
248
|
SetContactNurtureParams,
|
|
248
249
|
CancelSchedulesAndHitlByEmailParams,
|
|
@@ -567,7 +568,7 @@ export type MillionVerifierToolMap = {
|
|
|
567
568
|
}
|
|
568
569
|
|
|
569
570
|
// ---------------------------------------------------------------------------
|
|
570
|
-
// Lead (platform tool,
|
|
571
|
+
// Lead (platform tool, 56 methods)
|
|
571
572
|
// ---------------------------------------------------------------------------
|
|
572
573
|
|
|
573
574
|
export type LeadToolMap = {
|
|
@@ -628,6 +629,7 @@ export type LeadToolMap = {
|
|
|
628
629
|
markProposalReviewed: { params: Omit<MarkProposalReviewedParams, 'organizationId'>; result: void }
|
|
629
630
|
updateCloseLostReason: { params: Omit<UpdateCloseLostReasonParams, 'organizationId'>; result: void }
|
|
630
631
|
updateFees: { params: Omit<UpdateFeesParams, 'organizationId'>; result: void }
|
|
632
|
+
cacheInstantlyThreadIds: { params: Omit<CacheInstantlyThreadIdsParams, 'organizationId'>; result: void }
|
|
631
633
|
transitionItem: { params: Omit<TransitionItemParams, 'organizationId'>; result: void }
|
|
632
634
|
setContactNurture: { params: Omit<SetContactNurtureParams, 'organizationId'>; result: void }
|
|
633
635
|
cancelSchedulesAndHitlByEmail: {
|