@erdoai/cli 0.167.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 +94 -15
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -522,6 +522,13 @@ var ErdoClient = class {
|
|
|
522
522
|
{ manager_default: managerDefault }
|
|
523
523
|
);
|
|
524
524
|
}
|
|
525
|
+
setCustomDomainHome(domain, homeArtifactId) {
|
|
526
|
+
return this.request(
|
|
527
|
+
"PATCH",
|
|
528
|
+
`/v1/custom-domains/${encodeURIComponent(domain)}/home`,
|
|
529
|
+
{ home_artifact_id: homeArtifactId }
|
|
530
|
+
);
|
|
531
|
+
}
|
|
525
532
|
deleteCustomDomain(domain) {
|
|
526
533
|
return this.request(
|
|
527
534
|
"DELETE",
|
|
@@ -770,9 +777,15 @@ var ErdoClient = class {
|
|
|
770
777
|
setVoiceBrandedCalling(body) {
|
|
771
778
|
return this.request("PUT", "/v1/voice/branded-calling", body);
|
|
772
779
|
}
|
|
780
|
+
// The letter of authorization on file — the signed letter — for an admin to keep.
|
|
773
781
|
getVoiceBrandedCallingLOA() {
|
|
774
782
|
return this.request("GET", "/v1/voice/branded-calling/loa");
|
|
775
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
|
+
}
|
|
776
789
|
// Filing Branded Calling is billed per branded call, so this files the same
|
|
777
790
|
// approval-gated action the chat agent files.
|
|
778
791
|
provisionVoiceBrandedCalling() {
|
|
@@ -6281,8 +6294,9 @@ domainsCmd.command("list").description("List the org's custom domains with live
|
|
|
6281
6294
|
for (const d of domains) {
|
|
6282
6295
|
const checked = d.last_checked_at ? `checked ${d.last_checked_at}` : "never checked";
|
|
6283
6296
|
const managerDefault = d.manager_default ? " manager default" : "";
|
|
6297
|
+
const home = d.home_artifact_id ? ` home ${d.home_artifact_id}` : "";
|
|
6284
6298
|
const reason = d.error_reason ? ` ${d.error_reason}` : "";
|
|
6285
|
-
console.log(`${d.domain} ${d.status} ${checked}${managerDefault}${reason}`);
|
|
6299
|
+
console.log(`${d.domain} ${d.status} ${checked}${managerDefault}${home}${reason}`);
|
|
6286
6300
|
}
|
|
6287
6301
|
} catch (e) {
|
|
6288
6302
|
fail(e);
|
|
@@ -6319,6 +6333,17 @@ domainsCmd.command("manager-default <domain>").description(
|
|
|
6319
6333
|
fail(e);
|
|
6320
6334
|
}
|
|
6321
6335
|
});
|
|
6336
|
+
domainsCmd.command("home <domain> [artifactId]").description("Set the domain root's public home page, or clear it with --unset").option("--unset", "clear the home page (the domain root will return 404)").action(async (domain, artifactId, opts) => {
|
|
6337
|
+
try {
|
|
6338
|
+
if (opts.unset ? artifactId !== void 0 : !artifactId) {
|
|
6339
|
+
throw new Error("Provide a page artifact ID, or use --unset without an ID");
|
|
6340
|
+
}
|
|
6341
|
+
const d = await new ErdoClient().setCustomDomainHome(domain, opts.unset ? null : artifactId);
|
|
6342
|
+
console.log(d.home_artifact_id ? `${d.domain} home page: /p/${d.home_artifact_id}` : `${d.domain} home page cleared (the domain root returns 404)`);
|
|
6343
|
+
} catch (e) {
|
|
6344
|
+
fail(e);
|
|
6345
|
+
}
|
|
6346
|
+
});
|
|
6322
6347
|
domainsCmd.command("remove <domain>").description("Remove a custom domain registration (stops it serving pages)").action(async (domain) => {
|
|
6323
6348
|
try {
|
|
6324
6349
|
const res = await new ErdoClient().deleteCustomDomain(domain);
|
|
@@ -7373,7 +7398,12 @@ function printBrandedCallingStatus(status) {
|
|
|
7373
7398
|
["legal name", status.legal_name ?? ""],
|
|
7374
7399
|
["call reason", status.inputs.call_reason || ""],
|
|
7375
7400
|
["logo", status.logo_url ?? "not uploaded"],
|
|
7376
|
-
[
|
|
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 ?? ""],
|
|
7377
7407
|
["registered as", status.registered_display_name ?? ""],
|
|
7378
7408
|
["price", `$${status.price_per_call_usd} per call whose brand is delivered`]
|
|
7379
7409
|
]
|
|
@@ -7404,6 +7434,32 @@ function printBrandedCallingStatus(status) {
|
|
|
7404
7434
|
);
|
|
7405
7435
|
}
|
|
7406
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
|
+
}
|
|
7407
7463
|
function fileAsBase64(path) {
|
|
7408
7464
|
return path ? readFileSync4(path).toString("base64") : void 0;
|
|
7409
7465
|
}
|
|
@@ -7424,7 +7480,7 @@ voiceBrandedCallingCmd.command("set").description(
|
|
|
7424
7480
|
).option(
|
|
7425
7481
|
"--display-name <name>",
|
|
7426
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"
|
|
7427
|
-
).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(
|
|
7428
7484
|
async (opts) => {
|
|
7429
7485
|
try {
|
|
7430
7486
|
const res = await new ErdoClient().setVoiceBrandedCalling({
|
|
@@ -7435,9 +7491,7 @@ voiceBrandedCallingCmd.command("set").description(
|
|
|
7435
7491
|
consent_description: opts.consentDescription,
|
|
7436
7492
|
daily_call_volume: opts.dailyCalls ? Number(opts.dailyCalls) : void 0,
|
|
7437
7493
|
employee_count: opts.employees ? Number(opts.employees) : void 0,
|
|
7438
|
-
logo_base64: fileAsBase64(opts.logo)
|
|
7439
|
-
loa_base64: fileAsBase64(opts.loaFile),
|
|
7440
|
-
loa_filename: opts.loaFile ? basename(opts.loaFile) : void 0
|
|
7494
|
+
logo_base64: fileAsBase64(opts.logo)
|
|
7441
7495
|
});
|
|
7442
7496
|
if (opts.json) {
|
|
7443
7497
|
print(res);
|
|
@@ -7449,16 +7503,41 @@ voiceBrandedCallingCmd.command("set").description(
|
|
|
7449
7503
|
}
|
|
7450
7504
|
}
|
|
7451
7505
|
);
|
|
7452
|
-
voiceBrandedCallingCmd.command("loa").description(
|
|
7453
|
-
|
|
7454
|
-
|
|
7455
|
-
|
|
7456
|
-
|
|
7457
|
-
|
|
7458
|
-
|
|
7459
|
-
|
|
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
|
+
}
|
|
7460
7539
|
}
|
|
7461
|
-
|
|
7540
|
+
);
|
|
7462
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) => {
|
|
7463
7542
|
try {
|
|
7464
7543
|
const res = await new ErdoClient().provisionVoiceBrandedCalling();
|