@erdoai/cli 0.170.0 → 0.172.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.
- package/dist/index.js +74 -14
- 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() {
|
|
@@ -7392,7 +7398,12 @@ function printBrandedCallingStatus(status) {
|
|
|
7392
7398
|
["legal name", status.legal_name ?? ""],
|
|
7393
7399
|
["call reason", status.inputs.call_reason || ""],
|
|
7394
7400
|
["logo", status.logo_url ?? "not uploaded"],
|
|
7395
|
-
[
|
|
7401
|
+
[
|
|
7402
|
+
"signed LOA",
|
|
7403
|
+
status.loa ? `${status.loa.filename}${status.loa.source === "signature" ? " (signed through Erdo)" : ""}` : "not on file \u2014 erdo voice branded-calling loa --send"
|
|
7404
|
+
],
|
|
7405
|
+
["sent for signature", describeLOASignature(status.loa_signature)],
|
|
7406
|
+
["signing link", status.loa_signature?.signing_url ?? ""],
|
|
7396
7407
|
["registered as", status.registered_display_name ?? ""],
|
|
7397
7408
|
["price", `$${status.price_per_call_usd} per call whose brand is delivered`]
|
|
7398
7409
|
]
|
|
@@ -7423,6 +7434,32 @@ function printBrandedCallingStatus(status) {
|
|
|
7423
7434
|
);
|
|
7424
7435
|
}
|
|
7425
7436
|
}
|
|
7437
|
+
function describeLOASignature(sig) {
|
|
7438
|
+
if (!sig) return "";
|
|
7439
|
+
switch (sig.status) {
|
|
7440
|
+
case "signed":
|
|
7441
|
+
return `signed by ${sig.signed_name ?? sig.signer_name} at ${sig.signed_at ?? ""}${sig.stored ? "" : " (not stored yet)"}`;
|
|
7442
|
+
case "sent":
|
|
7443
|
+
if (sig.delivery_status === "failed") {
|
|
7444
|
+
return `email to ${sig.signer_email_masked} failed: ${sig.delivery_error ?? "unknown error"} \u2014 send again`;
|
|
7445
|
+
}
|
|
7446
|
+
if (sig.delivery_status === "pending") {
|
|
7447
|
+
return `sending to ${sig.signer_email_masked} \u2014 delivery not confirmed yet`;
|
|
7448
|
+
}
|
|
7449
|
+
if (sig.delivery_status === "unknown") {
|
|
7450
|
+
return `delivery to ${sig.signer_email_masked} could not be confirmed \u2014 send again if it did not arrive`;
|
|
7451
|
+
}
|
|
7452
|
+
return `sent to ${sig.signer_email_masked} at ${sig.sent_at}; the link works until ${sig.expires_at}`;
|
|
7453
|
+
case "expired":
|
|
7454
|
+
return `the link sent to ${sig.signer_email_masked} expired \u2014 send again`;
|
|
7455
|
+
case "voided":
|
|
7456
|
+
return `withdrawn${sig.voided_reason ? `: ${sig.voided_reason}` : ""}`;
|
|
7457
|
+
case "out_of_date":
|
|
7458
|
+
return "signed, but the letter's details changed since \u2014 send the current letter again";
|
|
7459
|
+
default:
|
|
7460
|
+
return sig.status;
|
|
7461
|
+
}
|
|
7462
|
+
}
|
|
7426
7463
|
function fileAsBase64(path) {
|
|
7427
7464
|
return path ? readFileSync4(path).toString("base64") : void 0;
|
|
7428
7465
|
}
|
|
@@ -7443,7 +7480,7 @@ voiceBrandedCallingCmd.command("set").description(
|
|
|
7443
7480
|
).option(
|
|
7444
7481
|
"--display-name <name>",
|
|
7445
7482
|
"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("--
|
|
7483
|
+
).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
7484
|
async (opts) => {
|
|
7448
7485
|
try {
|
|
7449
7486
|
const res = await new ErdoClient().setVoiceBrandedCalling({
|
|
@@ -7454,9 +7491,7 @@ voiceBrandedCallingCmd.command("set").description(
|
|
|
7454
7491
|
consent_description: opts.consentDescription,
|
|
7455
7492
|
daily_call_volume: opts.dailyCalls ? Number(opts.dailyCalls) : void 0,
|
|
7456
7493
|
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
|
|
7494
|
+
logo_base64: fileAsBase64(opts.logo)
|
|
7460
7495
|
});
|
|
7461
7496
|
if (opts.json) {
|
|
7462
7497
|
print(res);
|
|
@@ -7468,16 +7503,41 @@ voiceBrandedCallingCmd.command("set").description(
|
|
|
7468
7503
|
}
|
|
7469
7504
|
}
|
|
7470
7505
|
);
|
|
7471
|
-
voiceBrandedCallingCmd.command("loa").description(
|
|
7472
|
-
|
|
7473
|
-
|
|
7474
|
-
|
|
7475
|
-
|
|
7476
|
-
|
|
7477
|
-
|
|
7478
|
-
|
|
7506
|
+
voiceBrandedCallingCmd.command("loa").description(
|
|
7507
|
+
"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"
|
|
7508
|
+
).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(
|
|
7509
|
+
async (opts) => {
|
|
7510
|
+
try {
|
|
7511
|
+
if (opts.download) {
|
|
7512
|
+
const doc = await new ErdoClient().getVoiceBrandedCallingLOA();
|
|
7513
|
+
const out = opts.out ?? doc.filename;
|
|
7514
|
+
writeFileSync3(out, Buffer.from(doc.content, "base64"));
|
|
7515
|
+
console.log(`Wrote ${out}.`);
|
|
7516
|
+
return;
|
|
7517
|
+
}
|
|
7518
|
+
if (!opts.send) {
|
|
7519
|
+
throw new Error(
|
|
7520
|
+
"the letter of authorization is only signed electronically \u2014 send it with: erdo voice branded-calling loa --send (or --download the signed letter)"
|
|
7521
|
+
);
|
|
7522
|
+
}
|
|
7523
|
+
const sent = await new ErdoClient().sendVoiceBrandedCallingLOA({
|
|
7524
|
+
signer_name: opts.signerName,
|
|
7525
|
+
signer_email: opts.signerEmail
|
|
7526
|
+
});
|
|
7527
|
+
if (opts.json) {
|
|
7528
|
+
print(sent);
|
|
7529
|
+
return;
|
|
7530
|
+
}
|
|
7531
|
+
console.log(`Letter of authorization: ${describeLOASignature(sent.loa_signature)}`);
|
|
7532
|
+
if (sent.loa_signature?.signing_url) {
|
|
7533
|
+
console.log(`Signing link (anyone with it can sign until it expires): ${sent.loa_signature.signing_url}`);
|
|
7534
|
+
}
|
|
7535
|
+
console.log("When it is signed it becomes the LOA by itself; check with: erdo voice branded-calling get");
|
|
7536
|
+
} catch (e) {
|
|
7537
|
+
fail(e);
|
|
7538
|
+
}
|
|
7479
7539
|
}
|
|
7480
|
-
|
|
7540
|
+
);
|
|
7481
7541
|
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
7542
|
try {
|
|
7483
7543
|
const res = await new ErdoClient().provisionVoiceBrandedCalling();
|