conduyt 1.32.0 → 1.33.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 +44 -0
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -2488,6 +2488,50 @@ reports
2488
2488
  }
2489
2489
  return client.get(`/api/v1/reports/speed-to-lead?${params.toString()}`);
2490
2490
  }));
2491
+ reports
2492
+ .command("agents")
2493
+ .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")
2494
+ .option("--from <iso>", "window start (default: 366 days before --to)")
2495
+ .option("--to <iso>", "window end (default: now)")
2496
+ .option("--compare <ids>", "comma-separated user ids to compare (up to 10)")
2497
+ .action(run(async (client, opts) => {
2498
+ const params = new URLSearchParams();
2499
+ if (opts.from)
2500
+ params.set("from", opts.from);
2501
+ if (opts.to)
2502
+ params.set("to", opts.to);
2503
+ if (opts.compare) {
2504
+ const ids = opts.compare.split(",").map((s) => s.trim()).filter(Boolean);
2505
+ for (const id of ids)
2506
+ assertUuid(id, "user id");
2507
+ params.set("userIds", ids.join(","));
2508
+ }
2509
+ return client.get(`/api/v1/reports/agent-performance?${params.toString()}`);
2510
+ }));
2511
+ reports
2512
+ .command("targets")
2513
+ .description("List per-user targets (admins: everyone's; others: your own)")
2514
+ .option("--user <id>", "one user's targets")
2515
+ .action(run(async (client, opts) => {
2516
+ const params = new URLSearchParams();
2517
+ if (opts.user) {
2518
+ assertUuid(opts.user, "user id");
2519
+ params.set("userId", opts.user);
2520
+ }
2521
+ return client.get(`/api/v1/reports/targets?${params.toString()}`);
2522
+ }));
2523
+ reports
2524
+ .command("set-targets")
2525
+ .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")
2526
+ .requiredOption("--json <targets>", "the targets as JSON (or @file)")
2527
+ .action(run(async (client, opts) => {
2528
+ const raw = opts.json.startsWith("@") ? (await import("node:fs")).readFileSync(opts.json.slice(1), "utf8") : opts.json;
2529
+ const parsed = JSON.parse(raw);
2530
+ const targets = Array.isArray(parsed) ? parsed : parsed?.targets;
2531
+ if (!Array.isArray(targets) || targets.length === 0)
2532
+ throw new Error("Pass a non-empty array of { userId, metric, period, value }.");
2533
+ return client.put("/api/v1/reports/targets", { targets });
2534
+ }));
2491
2535
  reports
2492
2536
  .command("calls")
2493
2537
  .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.33.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",