@erdoai/cli 0.170.0 → 0.173.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 +83 -14
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -777,9 +777,15 @@ var ErdoClient = class {
777
777
  setVoiceBrandedCalling(body) {
778
778
  return this.request("PUT", "/v1/voice/branded-calling", body);
779
779
  }
780
+ // The letter of authorization on file — the signed letter — for an admin to keep.
780
781
  getVoiceBrandedCallingLOA() {
781
782
  return this.request("GET", "/v1/voice/branded-calling/loa");
782
783
  }
784
+ // Emails the pre-filled letter to its signer to sign electronically. The
785
+ // signer defaults to the business profile's representative.
786
+ sendVoiceBrandedCallingLOA(body) {
787
+ return this.request("POST", "/v1/voice/branded-calling/loa/send", body);
788
+ }
783
789
  // Filing Branded Calling is billed per branded call, so this files the same
784
790
  // approval-gated action the chat agent files.
785
791
  provisionVoiceBrandedCalling() {
@@ -2917,6 +2923,15 @@ paidMediaCampaigns.command("list").description("List the organization's owned Go
2917
2923
  return;
2918
2924
  }
2919
2925
  console.log(`customer id: ${result.customer_id}`);
2926
+ const setup = result.conversion_setup;
2927
+ if (setup) {
2928
+ const terms = setup.accepted_customer_data_terms === true ? "accepted" : setup.accepted_customer_data_terms === false ? "not accepted" : "unknown";
2929
+ const leads = setup.enhanced_conversions_for_leads_enabled === true ? "enabled" : setup.enhanced_conversions_for_leads_enabled === false ? "disabled" : "unknown";
2930
+ console.log(`customer data terms: ${terms}; enhanced conversions for leads: ${leads}`);
2931
+ for (const note of setup.readiness_notes) console.log(`warning [${note.code}]: ${note.message}`);
2932
+ } else {
2933
+ console.log("warning: conversion setup is unverified (not returned by the server)");
2934
+ }
2920
2935
  for (const campaign of result.campaigns) {
2921
2936
  const goal = campaign.goal_config_level === "CAMPAIGN" ? `campaign goal: ${(campaign.conversion_actions ?? []).map((a) => a.name || a.id).join(", ")}` : "customer goals";
2922
2937
  console.log(`${campaign.id} ${campaign.name} ${campaign.status} ${campaign.bidding_strategy_type || "-"} ${goal}`);
@@ -7392,7 +7407,12 @@ function printBrandedCallingStatus(status) {
7392
7407
  ["legal name", status.legal_name ?? ""],
7393
7408
  ["call reason", status.inputs.call_reason || ""],
7394
7409
  ["logo", status.logo_url ?? "not uploaded"],
7395
- ["signed LOA", status.loa ? status.loa.filename : "not uploaded \u2014 erdo voice branded-calling loa"],
7410
+ [
7411
+ "signed LOA",
7412
+ status.loa ? `${status.loa.filename}${status.loa.source === "signature" ? " (signed through Erdo)" : ""}` : "not on file \u2014 erdo voice branded-calling loa --send"
7413
+ ],
7414
+ ["sent for signature", describeLOASignature(status.loa_signature)],
7415
+ ["signing link", status.loa_signature?.signing_url ?? ""],
7396
7416
  ["registered as", status.registered_display_name ?? ""],
7397
7417
  ["price", `$${status.price_per_call_usd} per call whose brand is delivered`]
7398
7418
  ]
@@ -7423,6 +7443,32 @@ function printBrandedCallingStatus(status) {
7423
7443
  );
7424
7444
  }
7425
7445
  }
7446
+ function describeLOASignature(sig) {
7447
+ if (!sig) return "";
7448
+ switch (sig.status) {
7449
+ case "signed":
7450
+ return `signed by ${sig.signed_name ?? sig.signer_name} at ${sig.signed_at ?? ""}${sig.stored ? "" : " (not stored yet)"}`;
7451
+ case "sent":
7452
+ if (sig.delivery_status === "failed") {
7453
+ return `email to ${sig.signer_email_masked} failed: ${sig.delivery_error ?? "unknown error"} \u2014 send again`;
7454
+ }
7455
+ if (sig.delivery_status === "pending") {
7456
+ return `sending to ${sig.signer_email_masked} \u2014 delivery not confirmed yet`;
7457
+ }
7458
+ if (sig.delivery_status === "unknown") {
7459
+ return `delivery to ${sig.signer_email_masked} could not be confirmed \u2014 send again if it did not arrive`;
7460
+ }
7461
+ return `sent to ${sig.signer_email_masked} at ${sig.sent_at}; the link works until ${sig.expires_at}`;
7462
+ case "expired":
7463
+ return `the link sent to ${sig.signer_email_masked} expired \u2014 send again`;
7464
+ case "voided":
7465
+ return `withdrawn${sig.voided_reason ? `: ${sig.voided_reason}` : ""}`;
7466
+ case "out_of_date":
7467
+ return "signed, but the letter's details changed since \u2014 send the current letter again";
7468
+ default:
7469
+ return sig.status;
7470
+ }
7471
+ }
7426
7472
  function fileAsBase64(path) {
7427
7473
  return path ? readFileSync4(path).toString("base64") : void 0;
7428
7474
  }
@@ -7443,7 +7489,7 @@ voiceBrandedCallingCmd.command("set").description(
7443
7489
  ).option(
7444
7490
  "--display-name <name>",
7445
7491
  "shown on the phone, at most 35 characters; defaults to the legal name. Twilio only accepts the legal name or a name legally registered to the business, and rejects the registration otherwise"
7446
- ).option("--call-reason <text>", 'the line under the name, at most 64 characters, e.g. "Your viewing request"').option("--use-case <category>", "CUSTOMER_CARE, ACCOUNT_NOTIFICATION, MARKETING, MIXED, \u2026 (see erdo voice branded-calling get --json)").option("--use-case-description <text>", "what the calls are for").option("--consent-description <text>", "how the people called agreed to be called").option("--daily-calls <n>", "calls expected per day").option("--employees <n>", "number of employees").option("--logo <file>", "the logo: PNG, JPG, WebP, GIF or BMP, at least 128 px; converted to the 256x256 BMP Twilio takes").option("--loa-file <file>", "the signed letter of authorization (PDF, JPG or PNG) \u2014 get it pre-filled with: erdo voice branded-calling loa").option("--json", "print the raw JSON result instead of a table").action(
7492
+ ).option("--call-reason <text>", 'the line under the name, at most 64 characters, e.g. "Your viewing request"').option("--use-case <category>", "CUSTOMER_CARE, ACCOUNT_NOTIFICATION, MARKETING, MIXED, \u2026 (see erdo voice branded-calling get --json)").option("--use-case-description <text>", "what the calls are for").option("--consent-description <text>", "how the people called agreed to be called").option("--daily-calls <n>", "calls expected per day").option("--employees <n>", "number of employees").option("--logo <file>", "the logo: PNG, JPG, WebP, GIF or BMP, at least 128 px; converted to the 256x256 BMP Twilio takes").option("--json", "print the raw JSON result instead of a table").action(
7447
7493
  async (opts) => {
7448
7494
  try {
7449
7495
  const res = await new ErdoClient().setVoiceBrandedCalling({
@@ -7454,9 +7500,7 @@ voiceBrandedCallingCmd.command("set").description(
7454
7500
  consent_description: opts.consentDescription,
7455
7501
  daily_call_volume: opts.dailyCalls ? Number(opts.dailyCalls) : void 0,
7456
7502
  employee_count: opts.employees ? Number(opts.employees) : void 0,
7457
- logo_base64: fileAsBase64(opts.logo),
7458
- loa_base64: fileAsBase64(opts.loaFile),
7459
- loa_filename: opts.loaFile ? basename(opts.loaFile) : void 0
7503
+ logo_base64: fileAsBase64(opts.logo)
7460
7504
  });
7461
7505
  if (opts.json) {
7462
7506
  print(res);
@@ -7468,16 +7512,41 @@ voiceBrandedCallingCmd.command("set").description(
7468
7512
  }
7469
7513
  }
7470
7514
  );
7471
- voiceBrandedCallingCmd.command("loa").description("Download the letter of authorization pre-filled from the business profile, for somebody at the business to sign (admins only)").option("--out <file>", "where to write the PDF", "branded-calling-letter-of-authorization.pdf").action(async (opts) => {
7472
- try {
7473
- const res = await new ErdoClient().getVoiceBrandedCallingLOA();
7474
- writeFileSync3(opts.out, Buffer.from(res.content, "base64"));
7475
- console.log(`Wrote ${opts.out}. Tick the authorization, sign and date it, then upload it with:`);
7476
- console.log(` erdo voice branded-calling set --loa-file <signed file>`);
7477
- } catch (e) {
7478
- fail(e);
7515
+ voiceBrandedCallingCmd.command("loa").description(
7516
+ "The letter of authorization (admins only): --send it, pre-filled from the business profile, to be signed electronically \u2014 the only way it is provided \u2014 or --download the signed letter on file"
7517
+ ).option("--send", "email it to the signer to sign on Erdo's signing page").option("--download", "save the signed letter on file instead").option("--out <file>", "with --download: where to write it (default: the letter's own filename)").option("--signer-name <name>", "who signs (defaults to the business profile's representative)").option("--signer-email <email>", "the signer's email (give it with --signer-name)").option("--json", "print the raw JSON result").action(
7518
+ async (opts) => {
7519
+ try {
7520
+ if (opts.download) {
7521
+ const doc = await new ErdoClient().getVoiceBrandedCallingLOA();
7522
+ const out = opts.out ?? doc.filename;
7523
+ writeFileSync3(out, Buffer.from(doc.content, "base64"));
7524
+ console.log(`Wrote ${out}.`);
7525
+ return;
7526
+ }
7527
+ if (!opts.send) {
7528
+ throw new Error(
7529
+ "the letter of authorization is only signed electronically \u2014 send it with: erdo voice branded-calling loa --send (or --download the signed letter)"
7530
+ );
7531
+ }
7532
+ const sent = await new ErdoClient().sendVoiceBrandedCallingLOA({
7533
+ signer_name: opts.signerName,
7534
+ signer_email: opts.signerEmail
7535
+ });
7536
+ if (opts.json) {
7537
+ print(sent);
7538
+ return;
7539
+ }
7540
+ console.log(`Letter of authorization: ${describeLOASignature(sent.loa_signature)}`);
7541
+ if (sent.loa_signature?.signing_url) {
7542
+ console.log(`Signing link (anyone with it can sign until it expires): ${sent.loa_signature.signing_url}`);
7543
+ }
7544
+ console.log("When it is signed it becomes the LOA by itself; check with: erdo voice branded-calling get");
7545
+ } catch (e) {
7546
+ fail(e);
7547
+ }
7479
7548
  }
7480
- });
7549
+ );
7481
7550
  voiceBrandedCallingCmd.command("provision").description("File Branded Calling for every number with A attestation (approval-gated; Twilio charges per branded call)").option("--json", "print the raw JSON result instead of a summary").action(async (opts) => {
7482
7551
  try {
7483
7552
  const res = await new ErdoClient().provisionVoiceBrandedCalling();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@erdoai/cli",
3
- "version": "0.170.0",
3
+ "version": "0.173.0",
4
4
  "description": "Erdo CLI \u2014 drive datasets, pages, and evals from the terminal or CI",
5
5
  "type": "module",
6
6
  "bin": {