@sellable/mcp 0.1.516 → 0.1.518
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/tools/leads.d.ts +2 -0
- package/dist/tools/leads.js +28 -8
- package/package.json +1 -1
package/dist/tools/leads.d.ts
CHANGED
|
@@ -146,6 +146,7 @@ export type SignalSearchInput = {
|
|
|
146
146
|
headlineICPCriteria?: string[];
|
|
147
147
|
rubricGuidelines?: string[];
|
|
148
148
|
confirmed?: boolean;
|
|
149
|
+
workspaceId?: string;
|
|
149
150
|
};
|
|
150
151
|
export type ImportLeadsInput = {
|
|
151
152
|
campaignOfferId: string;
|
|
@@ -205,6 +206,7 @@ export type SelectPromisingPostsInput = {
|
|
|
205
206
|
scrapePlanMode?: "all-selected" | "capacity-target";
|
|
206
207
|
targetEngagerCount?: number;
|
|
207
208
|
maxPostsToScrape?: number;
|
|
209
|
+
workspaceId?: string;
|
|
208
210
|
};
|
|
209
211
|
export type SetHeadlineICPCriteriaInput = {
|
|
210
212
|
campaignOfferId: string;
|
package/dist/tools/leads.js
CHANGED
|
@@ -3655,6 +3655,17 @@ export async function searchSignals(input) {
|
|
|
3655
3655
|
campaignOfferId: input?.campaignOfferId,
|
|
3656
3656
|
});
|
|
3657
3657
|
const api = getApi();
|
|
3658
|
+
const workspaceId = normalizeExplicitWorkspaceId(input.workspaceId);
|
|
3659
|
+
const requestOptions = workspaceRequestOptions(workspaceId);
|
|
3660
|
+
const apiPut = (path, body) => requestOptions
|
|
3661
|
+
? api.put(path, body, requestOptions)
|
|
3662
|
+
: api.put(path, body);
|
|
3663
|
+
const apiPatch = (path, body) => requestOptions
|
|
3664
|
+
? api.patch(path, body, requestOptions)
|
|
3665
|
+
: api.patch(path, body);
|
|
3666
|
+
const apiPost = (path, body) => requestOptions
|
|
3667
|
+
? api.post(path, body, requestOptions)
|
|
3668
|
+
: api.post(path, body);
|
|
3658
3669
|
const { campaignOfferId, headlineICPCriteria, rubricGuidelines, currentStepTransition, } = input;
|
|
3659
3670
|
const searchRequest = { ...input };
|
|
3660
3671
|
delete searchRequest.currentStepTransition;
|
|
@@ -3665,7 +3676,7 @@ export async function searchSignals(input) {
|
|
|
3665
3676
|
? headlineICPCriteria
|
|
3666
3677
|
: rubricGuidelines;
|
|
3667
3678
|
if (campaignOfferId && searchCurrentStep) {
|
|
3668
|
-
await
|
|
3679
|
+
await apiPut(`/api/v2/campaign-offers/${campaignOfferId}`, {
|
|
3669
3680
|
leadSourceType: "new",
|
|
3670
3681
|
leadSourceProvider: "signal-discovery",
|
|
3671
3682
|
currentStep: searchCurrentStep,
|
|
@@ -3675,17 +3686,17 @@ export async function searchSignals(input) {
|
|
|
3675
3686
|
}
|
|
3676
3687
|
// Persist criteria early so user take-over has filters ready.
|
|
3677
3688
|
if (campaignOfferId && effectiveHeadlineICPCriteria?.length) {
|
|
3678
|
-
await
|
|
3689
|
+
await apiPatch(`/api/v3/campaigns/${campaignOfferId}/signal-discovery/posts`, {
|
|
3679
3690
|
selectedIds: [],
|
|
3680
3691
|
unselectedIds: [],
|
|
3681
3692
|
headlineICPCriteria: effectiveHeadlineICPCriteria,
|
|
3682
3693
|
rubricGuidelines: effectiveHeadlineICPCriteria,
|
|
3683
3694
|
});
|
|
3684
3695
|
}
|
|
3685
|
-
const response = await
|
|
3696
|
+
const response = await apiPost(`/api/v1/signal-discovery/search-signals`, searchRequest);
|
|
3686
3697
|
const summary = summarizeSignalSearchResponse(response);
|
|
3687
3698
|
if (campaignOfferId && searchCurrentStep) {
|
|
3688
|
-
await
|
|
3699
|
+
await apiPut(`/api/v2/campaign-offers/${campaignOfferId}`, {
|
|
3689
3700
|
currentStep: searchCurrentStep,
|
|
3690
3701
|
...(currentStepTransition ? { currentStepTransition } : {}),
|
|
3691
3702
|
watchNarration: buildSignalDiscoveryResultsWatchNarration(summary.postsReturned),
|
|
@@ -4637,6 +4648,15 @@ export function getProviderPrompt(input) {
|
|
|
4637
4648
|
}
|
|
4638
4649
|
export async function selectPromisingPosts(input) {
|
|
4639
4650
|
const api = getApi();
|
|
4651
|
+
const workspaceId = normalizeExplicitWorkspaceId(input.workspaceId);
|
|
4652
|
+
const requestOptions = workspaceRequestOptions(workspaceId);
|
|
4653
|
+
const apiGet = (path) => requestOptions ? api.get(path, requestOptions) : api.get(path);
|
|
4654
|
+
const apiPatch = (path, body) => requestOptions
|
|
4655
|
+
? api.patch(path, body, requestOptions)
|
|
4656
|
+
: api.patch(path, body);
|
|
4657
|
+
const apiPut = (path, body) => requestOptions
|
|
4658
|
+
? api.put(path, body, requestOptions)
|
|
4659
|
+
: api.put(path, body);
|
|
4640
4660
|
const { campaignOfferId, selections, headlineICPCriteria, currentStep, selectionMode, mode, scrapePlanMode, targetEngagerCount, maxPostsToScrape, } = input;
|
|
4641
4661
|
const effectiveMode = selectionMode ?? mode ?? "replace";
|
|
4642
4662
|
const effectiveScrapePlanMode = scrapePlanMode ??
|
|
@@ -4656,14 +4676,14 @@ export async function selectPromisingPosts(input) {
|
|
|
4656
4676
|
const postIds = selections.map((s) => s.postId);
|
|
4657
4677
|
let unselectedIds = [];
|
|
4658
4678
|
if (effectiveMode === "replace") {
|
|
4659
|
-
const existing = await
|
|
4679
|
+
const existing = await apiGet(`/api/v3/campaigns/${campaignOfferId}/signal-discovery/posts?selected=true`);
|
|
4660
4680
|
const existingIds = existing?.posts
|
|
4661
4681
|
?.map((post) => post.id)
|
|
4662
4682
|
.filter((id) => Boolean(id)) ?? [];
|
|
4663
4683
|
const selectedSet = new Set(postIds);
|
|
4664
4684
|
unselectedIds = existingIds.filter((id) => !selectedSet.has(id));
|
|
4665
4685
|
}
|
|
4666
|
-
const selectionResult = await
|
|
4686
|
+
const selectionResult = await apiPatch(`/api/v3/campaigns/${campaignOfferId}/signal-discovery/posts`, {
|
|
4667
4687
|
selectedIds: postIds,
|
|
4668
4688
|
unselectedIds,
|
|
4669
4689
|
headlineICPCriteria,
|
|
@@ -4682,7 +4702,7 @@ export async function selectPromisingPosts(input) {
|
|
|
4682
4702
|
let recommendedPostCount = selectionResult.selectedCount;
|
|
4683
4703
|
let recommendationTargetEngagerCount = null;
|
|
4684
4704
|
try {
|
|
4685
|
-
const tabsResponse = await
|
|
4705
|
+
const tabsResponse = await apiGet(`/api/v3/campaigns/${campaignOfferId}/signal-discovery/tabs`);
|
|
4686
4706
|
const reasonsByPostId = new Map(selections.map((selection) => [selection.postId, selection.reason]));
|
|
4687
4707
|
const selectedByUrl = new Map();
|
|
4688
4708
|
for (const tab of tabsResponse.tabs ?? []) {
|
|
@@ -4739,7 +4759,7 @@ Approval card should say:
|
|
|
4739
4759
|
}
|
|
4740
4760
|
const selectionCurrentStep = currentStep === null ? undefined : (currentStep ?? "signal-discovery");
|
|
4741
4761
|
if (selectionCurrentStep) {
|
|
4742
|
-
await
|
|
4762
|
+
await apiPut(`/api/v2/campaign-offers/${campaignOfferId}`, {
|
|
4743
4763
|
currentStep: selectionCurrentStep,
|
|
4744
4764
|
watchNarration: buildSelectedPostApprovalWatchNarration(selectionResult.selectedCount, recommendedPostCount, recommendationTargetEngagerCount),
|
|
4745
4765
|
});
|