conduyt 1.52.0 → 1.53.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 +61 -3
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -3527,11 +3527,29 @@ reports
3527
3527
  const smartViews = program.command("smart-views").description("Smart Views and their Smart Dialing priorities");
3528
3528
  smartViews
3529
3529
  .command("list")
3530
- .description("List Smart Views in sidebar order (= Smart Dialing priority) with lead counts and dialing settings")
3530
+ .description("List Smart Views in sidebar order (= Smart Dialing priority) with lead counts, audience (groupId / members / isPersonal) and dialing settings")
3531
3531
  .option("--dialing", "only the dial-enabled views (the Smart Dialing priorities)")
3532
3532
  .action(run(async (client, opts) => {
3533
- const views = (await client.get("/api/v1/smart-views"));
3534
- const rows = Array.isArray(views) ? views : [];
3533
+ let rows = null;
3534
+ for (let attempt = 0; attempt < 3 && rows === null; attempt += 1) {
3535
+ const first = (await client.get("/api/v1/smart-views"));
3536
+ const walked = [...first.data.data];
3537
+ let meta = first.data.meta;
3538
+ let shifted = false;
3539
+ for (let page = 2; meta.has_more && page <= 50; page += 1) {
3540
+ const next = (await client.get(`/api/v1/smart-views?page=${page}&counts=false`));
3541
+ if (next.data.meta.order_stamp !== first.data.meta.order_stamp) {
3542
+ shifted = true;
3543
+ break;
3544
+ }
3545
+ walked.push(...next.data.data);
3546
+ meta = next.data.meta;
3547
+ }
3548
+ if (!shifted)
3549
+ rows = walked;
3550
+ }
3551
+ if (rows === null)
3552
+ throw new Error("Smart Views kept changing while they were listed; try again.");
3535
3553
  const sorted = [...rows].sort((a, b) => Number(a.sortPosition ?? 0) - Number(b.sortPosition ?? 0));
3536
3554
  return opts.dialing ? sorted.filter((v) => v.dialEnabled === true) : sorted;
3537
3555
  }));
@@ -3606,6 +3624,31 @@ smartViews
3606
3624
  throw new Error("Nothing to change. Pass --enable/--disable, --max-attempts, --per-day, --cooldown or --schedule.");
3607
3625
  return client.patch(`/api/v1/smart-views/${encodeURIComponent(id)}`, body);
3608
3626
  }));
3627
+ smartViews
3628
+ .command("audience <id>")
3629
+ .description("Who a shared Smart View is for (PATCH): everyone, one Team group (its current members, resolved when the view is read), or picked reps. A group replaces picked reps and vice versa.")
3630
+ .option("--everyone", "every rep on the account")
3631
+ .option("--group <groupId>", "one Team group (see: conduyt groups list)")
3632
+ .option("--reps <userIds>", "comma-separated user ids of the reps")
3633
+ .action(run(async (client, id, opts) => {
3634
+ assertUuid(id, "smart view id");
3635
+ const picked = [opts.everyone ? "everyone" : null, opts.group ? "group" : null, opts.reps ? "reps" : null].filter(Boolean);
3636
+ if (picked.length !== 1)
3637
+ throw new Error("Pass exactly one of --everyone, --group <groupId> or --reps <userIds>.");
3638
+ if (opts.group) {
3639
+ assertUuid(opts.group, "group id");
3640
+ return client.patch(`/api/v1/smart-views/${encodeURIComponent(id)}`, { groupId: opts.group, members: [] });
3641
+ }
3642
+ if (opts.reps) {
3643
+ const ids = opts.reps.split(",").map((x) => x.trim()).filter(Boolean);
3644
+ if (ids.length === 0)
3645
+ throw new Error("--reps needs at least one user id.");
3646
+ for (const u of ids)
3647
+ assertUuid(u, "user id");
3648
+ return client.patch(`/api/v1/smart-views/${encodeURIComponent(id)}`, { groupId: null, members: ids.map((userId) => ({ userId })) });
3649
+ }
3650
+ return client.patch(`/api/v1/smart-views/${encodeURIComponent(id)}`, { groupId: null, members: [] });
3651
+ }));
3609
3652
  smartViews
3610
3653
  .command("dial-order [ids...]")
3611
3654
  .description("No ids: show the Smart Dialing priorities, uncapped (every dial-enabled view in dial order + candidates). With ids: set the priority order — every dial-enabled view id, first = dialed first (the server keeps non-priority views in their slots)")
@@ -3620,6 +3663,21 @@ smartViews
3620
3663
  assertUuid(id, "smart view id");
3621
3664
  return client.patch("/api/v1/smart-views/dial-order", { order: ids });
3622
3665
  }));
3666
+ smartViews
3667
+ .command("move <id>")
3668
+ .description("Move ONE Smart View next to another in the sidebar order (= Smart Dialing priority). No size limit: use this on accounts with more than 200 views")
3669
+ .option("--before <viewId>", "land directly above this view")
3670
+ .option("--after <viewId>", "land directly below this view")
3671
+ .action(run(async (client, id, opts) => {
3672
+ assertUuid(id, "smart view id");
3673
+ const anchors = [opts.before, opts.after].filter(Boolean);
3674
+ if (anchors.length !== 1)
3675
+ throw new Error("Pass exactly one of --before <viewId> or --after <viewId>.");
3676
+ assertUuid(anchors[0], "anchor view id");
3677
+ if (anchors[0] === id)
3678
+ throw new Error("A view cannot be anchored to itself.");
3679
+ return client.patch("/api/v1/smart-views/reorder", { move: opts.before ? { id, beforeId: opts.before } : { id, afterId: opts.after } });
3680
+ }));
3623
3681
  smartViews
3624
3682
  .command("reorder <ids...>")
3625
3683
  .description("Set the SIDEBAR order of Smart Views. Pass EVERY view id; views left out keep a stale position. For the dialing priority use dial-order")
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "conduyt",
3
- "version": "1.52.0",
3
+ "version": "1.53.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",