conduyt 1.31.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 +71 -0
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -2488,6 +2488,77 @@ 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
+ }));
2535
+ reports
2536
+ .command("calls")
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")
2538
+ .option("--from <iso>", "window start (default: 366 days before --to)")
2539
+ .option("--to <iso>", "window end (default: now)")
2540
+ .option("--user <id>", "only calls placed or taken by this user")
2541
+ .option("--transport <value>", "exact transport: twilio | project_blue | project_blue_twilio")
2542
+ .option("--direction <dir>", "inbound | outbound")
2543
+ .action(run(async (client, opts) => {
2544
+ const params = new URLSearchParams();
2545
+ if (opts.from)
2546
+ params.set("from", opts.from);
2547
+ if (opts.to)
2548
+ params.set("to", opts.to);
2549
+ if (opts.user) {
2550
+ assertUuid(opts.user, "user id");
2551
+ params.set("userId", opts.user);
2552
+ }
2553
+ if (opts.transport)
2554
+ params.set("transport", opts.transport);
2555
+ if (opts.direction) {
2556
+ if (!["inbound", "outbound"].includes(opts.direction))
2557
+ throw new Error("--direction must be inbound or outbound");
2558
+ params.set("direction", opts.direction);
2559
+ }
2560
+ return client.get(`/api/v1/reports/call-performance?${params.toString()}`);
2561
+ }));
2491
2562
  reports
2492
2563
  .command("appointments")
2493
2564
  .description("Appointment report: booked, held, no-shows and show rate (past appointments only), cancellations, reschedules and upcoming, by assigned user, calendar or booking page, lead source, channel and day; window by appointment time (default) or booking time")
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "conduyt",
3
- "version": "1.31.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",