superceo 0.3.6 → 0.3.8
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.js +16 -16
- package/dist/index.js.map +3 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -56423,9 +56423,9 @@ var init_organizations2 = __esm({
|
|
|
56423
56423
|
}
|
|
56424
56424
|
});
|
|
56425
56425
|
|
|
56426
|
-
// ../server/src/services/
|
|
56427
|
-
function
|
|
56428
|
-
const base = source === "local" ? process.env.
|
|
56426
|
+
// ../server/src/services/lead-product-api.ts
|
|
56427
|
+
function resolveLeadProductUserSummaryUrlTemplate(source) {
|
|
56428
|
+
const base = source === "local" ? process.env.LEAD_PRODUCT_API_BASE_URL_LOCAL?.trim() : source === "staging" ? process.env.LEAD_PRODUCT_API_BASE_URL_STAGING?.trim() : process.env.LEAD_PRODUCT_API_BASE_URL_PRODUCTION?.trim();
|
|
56429
56429
|
if (!base) return void 0;
|
|
56430
56430
|
const root = base.replace(/\/+$/, "");
|
|
56431
56431
|
return `${root}/v1/internal/paperclip/users/{userId}/summary`;
|
|
@@ -56568,9 +56568,9 @@ function parseProductPayload(obj) {
|
|
|
56568
56568
|
tables: tables.length > 0 ? tables : void 0
|
|
56569
56569
|
};
|
|
56570
56570
|
}
|
|
56571
|
-
function
|
|
56571
|
+
function parseLeadProductFromRemoteJson(json) {
|
|
56572
56572
|
if (!isRecord4(json)) return null;
|
|
56573
|
-
const nested = json.product
|
|
56573
|
+
const nested = json.product;
|
|
56574
56574
|
if (isRecord4(nested)) {
|
|
56575
56575
|
const parsed = parseProductPayload(nested);
|
|
56576
56576
|
if (parsed) return parsed;
|
|
@@ -56578,8 +56578,8 @@ function parseCutjamProductFromRemoteJson(json) {
|
|
|
56578
56578
|
return parseProductPayload(json);
|
|
56579
56579
|
}
|
|
56580
56580
|
var SURFACE_ROLES, SURFACE_STATES, MAX_NAMED_TABLES, MAX_ROWS_PER_TABLE;
|
|
56581
|
-
var
|
|
56582
|
-
"../server/src/services/
|
|
56581
|
+
var init_lead_product_api = __esm({
|
|
56582
|
+
"../server/src/services/lead-product-api.ts"() {
|
|
56583
56583
|
"use strict";
|
|
56584
56584
|
SURFACE_ROLES = /* @__PURE__ */ new Set(["editor", "brand", "customer_brand", "creator"]);
|
|
56585
56585
|
SURFACE_STATES = /* @__PURE__ */ new Set(["active", "inactive", "none", "pending"]);
|
|
@@ -57817,9 +57817,9 @@ ${lines.join("\n")}`;
|
|
|
57817
57817
|
},
|
|
57818
57818
|
/**
|
|
57819
57819
|
* High-level + tabular snapshot for the linked product user.
|
|
57820
|
-
* Without per-source `
|
|
57820
|
+
* Without per-source `LEAD_PRODUCT_API_BASE_URL_*`, returns lead-only facts. With it, GETs
|
|
57821
57821
|
* `/v1/internal/paperclip/users/{userId}/summary` and merges JSON
|
|
57822
|
-
* (legacy `headline` / `facts` / `table` or versioned `product`
|
|
57822
|
+
* (legacy `headline` / `facts` / `table` or versioned `product` block).
|
|
57823
57823
|
* Optional API key: env `VEM_API_KEY` or company secret of the same name.
|
|
57824
57824
|
*/
|
|
57825
57825
|
productSummary: async (companyId, leadId, options2) => {
|
|
@@ -57841,7 +57841,7 @@ ${lines.join("\n")}`;
|
|
|
57841
57841
|
leadFacts.push({ label: "Social", value: handleLine });
|
|
57842
57842
|
}
|
|
57843
57843
|
if (signedUp) leadFacts.push({ label: "Converted at", value: signedUp });
|
|
57844
|
-
const urlTemplate =
|
|
57844
|
+
const urlTemplate = resolveLeadProductUserSummaryUrlTemplate(options2?.productSource);
|
|
57845
57845
|
const remoteConfigured = Boolean(urlTemplate);
|
|
57846
57846
|
let headline = null;
|
|
57847
57847
|
let avatarUrl = null;
|
|
@@ -57852,7 +57852,7 @@ ${lines.join("\n")}`;
|
|
|
57852
57852
|
if (urlTemplate) {
|
|
57853
57853
|
const url = urlTemplate.replace(/\{userId\}/gi, encodeURIComponent(productUserId));
|
|
57854
57854
|
const headers = { Accept: "application/json" };
|
|
57855
|
-
const keySource = options2?.
|
|
57855
|
+
const keySource = options2?.productSource ?? "production";
|
|
57856
57856
|
const sourceUpper = keySource.toUpperCase();
|
|
57857
57857
|
let apiKey = process.env[`VEM_${sourceUpper}_API_KEY`]?.trim() || process.env.VEM_API_KEY?.trim() || "";
|
|
57858
57858
|
if (!apiKey) {
|
|
@@ -57893,7 +57893,7 @@ ${lines.join("\n")}`;
|
|
|
57893
57893
|
remoteFacts = [{ label: "Bio", value: json.bio.trim() }];
|
|
57894
57894
|
}
|
|
57895
57895
|
table = parseRemoteTable(json.table);
|
|
57896
|
-
product =
|
|
57896
|
+
product = parseLeadProductFromRemoteJson(json);
|
|
57897
57897
|
if (product) {
|
|
57898
57898
|
if (product.avatarUrl) avatarUrl = product.avatarUrl;
|
|
57899
57899
|
if (product.displayName) headline = product.displayName;
|
|
@@ -58002,7 +58002,7 @@ var init_leads2 = __esm({
|
|
|
58002
58002
|
init_issues2();
|
|
58003
58003
|
init_organizations2();
|
|
58004
58004
|
init_secrets2();
|
|
58005
|
-
|
|
58005
|
+
init_lead_product_api();
|
|
58006
58006
|
init_errors();
|
|
58007
58007
|
SUPPORTED_LEAD_KINDS = ["editor", "brand", "journalist", "partner", "investor", "other"];
|
|
58008
58008
|
SUPPORTED_STATUSES = ["drafted", "contacted", "replied", "signed_up", "dead"];
|
|
@@ -62235,9 +62235,9 @@ function leadRoutes(db) {
|
|
|
62235
62235
|
router.get("/companies/:companyId/leads/:leadId/product-summary", async (req, res) => {
|
|
62236
62236
|
const { companyId, leadId } = req.params;
|
|
62237
62237
|
assertCompanyAccess(req, companyId);
|
|
62238
|
-
const raw = req.query.
|
|
62239
|
-
const
|
|
62240
|
-
const summary = await svc.productSummary(companyId, leadId, {
|
|
62238
|
+
const raw = req.query.productSource;
|
|
62239
|
+
const productSource = raw === "local" || raw === "staging" || raw === "production" ? raw : void 0;
|
|
62240
|
+
const summary = await svc.productSummary(companyId, leadId, { productSource });
|
|
62241
62241
|
res.json(summary);
|
|
62242
62242
|
});
|
|
62243
62243
|
router.get("/companies/:companyId/leads/:leadId", async (req, res) => {
|