conduyt 1.32.0 → 1.34.0

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.
Files changed (2) hide show
  1. package/dist/index.js +69 -0
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -2488,6 +2488,75 @@ reports
2488
2488
  }
2489
2489
  return client.get(`/api/v1/reports/speed-to-lead?${params.toString()}`);
2490
2490
  }));
2491
+ reports
2492
+ .command("attribution")
2493
+ .description("Attribution: the window's new contacts by their first or latest touch (UTM source, medium, campaign, content, term, channel, landing page, referrer), followed to appointments, deals won and revenue")
2494
+ .option("--from <iso>", "window start (default: 366 days before --to)")
2495
+ .option("--to <iso>", "window end (default: now)")
2496
+ .option("--touch <pick>", "first (default) | last")
2497
+ .option("--group <field>", "source (default: the UTM source, else the recorded source) | utm_source | medium | campaign | content | term | channel | landing | referrer")
2498
+ .action(run(async (client, opts) => {
2499
+ const params = new URLSearchParams();
2500
+ if (opts.from)
2501
+ params.set("from", opts.from);
2502
+ if (opts.to)
2503
+ params.set("to", opts.to);
2504
+ if (opts.touch) {
2505
+ if (!["first", "last"].includes(opts.touch))
2506
+ throw new Error("--touch must be first or last");
2507
+ params.set("touch", opts.touch);
2508
+ }
2509
+ if (opts.group) {
2510
+ if (!["source", "utm_source", "medium", "campaign", "content", "term", "channel", "landing", "referrer"].includes(opts.group))
2511
+ throw new Error("--group must be source | utm_source | medium | campaign | content | term | channel | landing | referrer");
2512
+ params.set("group", opts.group);
2513
+ }
2514
+ return client.get(`/api/v1/reports/attribution?${params.toString()}`);
2515
+ }));
2516
+ reports
2517
+ .command("agents")
2518
+ .description("Agent performance: every rep's calls, conversations, appointments, deals won, revenue, activities and talk minutes next to their targets (prorated to the window) with attainment and a score; --compare picks up to 10 reps")
2519
+ .option("--from <iso>", "window start (default: 366 days before --to)")
2520
+ .option("--to <iso>", "window end (default: now)")
2521
+ .option("--compare <ids>", "comma-separated user ids to compare (up to 10)")
2522
+ .action(run(async (client, opts) => {
2523
+ const params = new URLSearchParams();
2524
+ if (opts.from)
2525
+ params.set("from", opts.from);
2526
+ if (opts.to)
2527
+ params.set("to", opts.to);
2528
+ if (opts.compare) {
2529
+ const ids = opts.compare.split(",").map((s) => s.trim()).filter(Boolean);
2530
+ for (const id of ids)
2531
+ assertUuid(id, "user id");
2532
+ params.set("userIds", ids.join(","));
2533
+ }
2534
+ return client.get(`/api/v1/reports/agent-performance?${params.toString()}`);
2535
+ }));
2536
+ reports
2537
+ .command("targets")
2538
+ .description("List per-user targets (admins: everyone's; others: your own)")
2539
+ .option("--user <id>", "one user's targets")
2540
+ .action(run(async (client, opts) => {
2541
+ const params = new URLSearchParams();
2542
+ if (opts.user) {
2543
+ assertUuid(opts.user, "user id");
2544
+ params.set("userId", opts.user);
2545
+ }
2546
+ return client.get(`/api/v1/reports/targets?${params.toString()}`);
2547
+ }));
2548
+ reports
2549
+ .command("set-targets")
2550
+ .description("Set per-user targets from JSON (admins): { targets: [{ userId, metric, period, value }] } or a bare array; value 0 removes; metrics calls | conversations | appointments | deals_won | revenue | activities | talk_minutes; periods daily | weekly | monthly")
2551
+ .requiredOption("--json <targets>", "the targets as JSON (or @file)")
2552
+ .action(run(async (client, opts) => {
2553
+ const raw = opts.json.startsWith("@") ? (await import("node:fs")).readFileSync(opts.json.slice(1), "utf8") : opts.json;
2554
+ const parsed = JSON.parse(raw);
2555
+ const targets = Array.isArray(parsed) ? parsed : parsed?.targets;
2556
+ if (!Array.isArray(targets) || targets.length === 0)
2557
+ throw new Error("Pass a non-empty array of { userId, metric, period, value }.");
2558
+ return client.put("/api/v1/reports/targets", { targets });
2559
+ }));
2491
2560
  reports
2492
2561
  .command("calls")
2493
2562
  .description("Unified call report: every call whatever carried it (dialer, Twilio, Project Blue): answered, connected, conversations, talk time, voicemail, missed, appointments, closed by user, transport, direction, disposition, day and hour")
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "conduyt",
3
- "version": "1.32.0",
3
+ "version": "1.34.0",
4
4
  "description": "Command-line interface for Conduyt CRM — manage contacts, deals, pipelines, and run insight queries from your terminal.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",