@sellable/mcp 0.1.517 → 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 +1 -0
- package/dist/tools/leads.js +13 -4
- package/package.json +1 -1
package/dist/tools/leads.d.ts
CHANGED
|
@@ -206,6 +206,7 @@ export type SelectPromisingPostsInput = {
|
|
|
206
206
|
scrapePlanMode?: "all-selected" | "capacity-target";
|
|
207
207
|
targetEngagerCount?: number;
|
|
208
208
|
maxPostsToScrape?: number;
|
|
209
|
+
workspaceId?: string;
|
|
209
210
|
};
|
|
210
211
|
export type SetHeadlineICPCriteriaInput = {
|
|
211
212
|
campaignOfferId: string;
|
package/dist/tools/leads.js
CHANGED
|
@@ -4648,6 +4648,15 @@ export function getProviderPrompt(input) {
|
|
|
4648
4648
|
}
|
|
4649
4649
|
export async function selectPromisingPosts(input) {
|
|
4650
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);
|
|
4651
4660
|
const { campaignOfferId, selections, headlineICPCriteria, currentStep, selectionMode, mode, scrapePlanMode, targetEngagerCount, maxPostsToScrape, } = input;
|
|
4652
4661
|
const effectiveMode = selectionMode ?? mode ?? "replace";
|
|
4653
4662
|
const effectiveScrapePlanMode = scrapePlanMode ??
|
|
@@ -4667,14 +4676,14 @@ export async function selectPromisingPosts(input) {
|
|
|
4667
4676
|
const postIds = selections.map((s) => s.postId);
|
|
4668
4677
|
let unselectedIds = [];
|
|
4669
4678
|
if (effectiveMode === "replace") {
|
|
4670
|
-
const existing = await
|
|
4679
|
+
const existing = await apiGet(`/api/v3/campaigns/${campaignOfferId}/signal-discovery/posts?selected=true`);
|
|
4671
4680
|
const existingIds = existing?.posts
|
|
4672
4681
|
?.map((post) => post.id)
|
|
4673
4682
|
.filter((id) => Boolean(id)) ?? [];
|
|
4674
4683
|
const selectedSet = new Set(postIds);
|
|
4675
4684
|
unselectedIds = existingIds.filter((id) => !selectedSet.has(id));
|
|
4676
4685
|
}
|
|
4677
|
-
const selectionResult = await
|
|
4686
|
+
const selectionResult = await apiPatch(`/api/v3/campaigns/${campaignOfferId}/signal-discovery/posts`, {
|
|
4678
4687
|
selectedIds: postIds,
|
|
4679
4688
|
unselectedIds,
|
|
4680
4689
|
headlineICPCriteria,
|
|
@@ -4693,7 +4702,7 @@ export async function selectPromisingPosts(input) {
|
|
|
4693
4702
|
let recommendedPostCount = selectionResult.selectedCount;
|
|
4694
4703
|
let recommendationTargetEngagerCount = null;
|
|
4695
4704
|
try {
|
|
4696
|
-
const tabsResponse = await
|
|
4705
|
+
const tabsResponse = await apiGet(`/api/v3/campaigns/${campaignOfferId}/signal-discovery/tabs`);
|
|
4697
4706
|
const reasonsByPostId = new Map(selections.map((selection) => [selection.postId, selection.reason]));
|
|
4698
4707
|
const selectedByUrl = new Map();
|
|
4699
4708
|
for (const tab of tabsResponse.tabs ?? []) {
|
|
@@ -4750,7 +4759,7 @@ Approval card should say:
|
|
|
4750
4759
|
}
|
|
4751
4760
|
const selectionCurrentStep = currentStep === null ? undefined : (currentStep ?? "signal-discovery");
|
|
4752
4761
|
if (selectionCurrentStep) {
|
|
4753
|
-
await
|
|
4762
|
+
await apiPut(`/api/v2/campaign-offers/${campaignOfferId}`, {
|
|
4754
4763
|
currentStep: selectionCurrentStep,
|
|
4755
4764
|
watchNarration: buildSelectedPostApprovalWatchNarration(selectionResult.selectedCount, recommendedPostCount, recommendationTargetEngagerCount),
|
|
4756
4765
|
});
|