@erdoai/cli 0.108.1 → 0.109.1
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 +32 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
+
// src/ads-container.ts
|
|
4
|
+
function advertiserVerificationAction(container) {
|
|
5
|
+
const verification = container.advertiser_verification;
|
|
6
|
+
if (!verification || verification.action_url) return void 0;
|
|
7
|
+
if (verification.status === "check_in_google_ads") {
|
|
8
|
+
return `Google cannot expose advertiser verification for card-billed account ${container.customer_id} through the API. Open Billing \u2192 Advertiser verification in Google Ads to check its status, and complete verification there only if Google shows it is pending.`;
|
|
9
|
+
}
|
|
10
|
+
if (verification.status === "PENDING_USER_ACTION" || verification.status === "FAILURE") {
|
|
11
|
+
return `Google shows no business name or logo on ${container.customer_id}'s ads until the advertiser is verified. Get a link with: erdo org managed ads-container ${container.org_slug} --provision --start-verification`;
|
|
12
|
+
}
|
|
13
|
+
return void 0;
|
|
14
|
+
}
|
|
15
|
+
|
|
3
16
|
// src/refresh.ts
|
|
4
17
|
function describeRefreshTrigger(state) {
|
|
5
18
|
if (state.disarmed) return "disarmed \u2014 the experiment has settled";
|
|
@@ -386,6 +399,7 @@ var ErdoClient = class {
|
|
|
386
399
|
if (input.currencyCode) body.currency_code = input.currencyCode;
|
|
387
400
|
if (input.timeZone) body.time_zone = input.timeZone;
|
|
388
401
|
if (input.replaceCurrentAccount) body.replace_current_account = true;
|
|
402
|
+
if (input.startAdvertiserVerification) body.start_advertiser_verification = true;
|
|
389
403
|
return this.request(
|
|
390
404
|
"POST",
|
|
391
405
|
`/v1/managed-organizations/${encodeURIComponent(slug)}/ads-container`,
|
|
@@ -2718,6 +2732,15 @@ function printAdsContainer(c) {
|
|
|
2718
2732
|
`
|
|
2719
2733
|
);
|
|
2720
2734
|
}
|
|
2735
|
+
const v = c.advertiser_verification;
|
|
2736
|
+
if (v) {
|
|
2737
|
+
console.log(`advertiser verification: ${v.status}`);
|
|
2738
|
+
if (v.action_url) console.log(`verification link: ${v.action_url}`);
|
|
2739
|
+
if (v.completion_deadline) console.log(`verification deadline: ${v.completion_deadline}`);
|
|
2740
|
+
const action = advertiserVerificationAction(c);
|
|
2741
|
+
if (action) process.stderr.write(`${action}
|
|
2742
|
+
`);
|
|
2743
|
+
}
|
|
2721
2744
|
}
|
|
2722
2745
|
managed.command("ads-container <orgSlug>").description(
|
|
2723
2746
|
"Read the Google Ads account a managed org runs its campaigns in, or --provision one under your manager account"
|
|
@@ -2727,12 +2750,18 @@ managed.command("ads-container <orgSlug>").description(
|
|
|
2727
2750
|
).option(
|
|
2728
2751
|
"--replace-current-account",
|
|
2729
2752
|
"with --provision: go ahead even though the org already runs campaigns in another account. Google Ads cannot move a campaign, so those campaigns stay behind and have to be rebuilt"
|
|
2730
|
-
).option("--name <descriptiveName>", "display name for the new account (default: the org's name and slug)").option("--currency <code>", "ISO currency code for the new account, e.g. USD").option("--time-zone <tz>", "IANA time zone for the new account, e.g. America/New_York").
|
|
2753
|
+
).option("--name <descriptiveName>", "display name for the new account (default: the org's name and slug)").option("--currency <code>", "ISO currency code for the new account, e.g. USD").option("--time-zone <tz>", "IANA time zone for the new account, e.g. America/New_York").option(
|
|
2754
|
+
"--start-verification",
|
|
2755
|
+
"with --provision: open a Google advertiser-verification session when the account still needs one, so the output carries the link a person finishes it on"
|
|
2756
|
+
).action(
|
|
2731
2757
|
async (orgSlug, opts) => {
|
|
2732
2758
|
try {
|
|
2733
2759
|
if (opts.replaceCurrentAccount && !opts.provision) {
|
|
2734
2760
|
fail(new Error("--replace-current-account only applies with --provision"));
|
|
2735
2761
|
}
|
|
2762
|
+
if (opts.startVerification && !opts.provision) {
|
|
2763
|
+
fail(new Error("--start-verification only applies with --provision"));
|
|
2764
|
+
}
|
|
2736
2765
|
if (opts.adopt && !opts.provision) {
|
|
2737
2766
|
fail(new Error("--adopt only applies with --provision"));
|
|
2738
2767
|
}
|
|
@@ -2764,7 +2793,8 @@ managed.command("ads-container <orgSlug>").description(
|
|
|
2764
2793
|
descriptiveName: opts.name,
|
|
2765
2794
|
currencyCode: opts.currency,
|
|
2766
2795
|
timeZone: opts.timeZone,
|
|
2767
|
-
replaceCurrentAccount: opts.replaceCurrentAccount
|
|
2796
|
+
replaceCurrentAccount: opts.replaceCurrentAccount,
|
|
2797
|
+
startAdvertiserVerification: opts.startVerification
|
|
2768
2798
|
});
|
|
2769
2799
|
let outcome;
|
|
2770
2800
|
if (c.already_provisioned) outcome = `Google Ads container already existed for ${c.org_slug}`;
|