@erdoai/cli 0.144.0 → 0.145.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.
Files changed (2) hide show
  1. package/dist/index.js +55 -2
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -275,6 +275,17 @@ var ErdoClient = class {
275
275
  input
276
276
  );
277
277
  }
278
+ listPaidMediaCampaigns(customerId) {
279
+ const query = customerId ? `?customer_id=${encodeURIComponent(customerId)}` : "";
280
+ return this.request("GET", `/v1/paid-media/campaigns${query}`);
281
+ }
282
+ setPaidMediaCampaignConversionGoals(campaignId, input) {
283
+ return this.request(
284
+ "POST",
285
+ `/v1/paid-media/campaigns/${encodeURIComponent(campaignId)}/conversion-goals`,
286
+ input
287
+ );
288
+ }
278
289
  announceOrgOnce(method) {
279
290
  if (announcedOrg) return;
280
291
  if (method.toUpperCase() === "GET") return;
@@ -2706,6 +2717,47 @@ program.command(REFRESH_COMMAND, { hidden: true }).description("Internal: refres
2706
2717
  await refreshVersionCache();
2707
2718
  });
2708
2719
  var paidMedia = program.command("paid-media").description("Paid media setup and operations");
2720
+ var paidMediaCampaigns = paidMedia.command("campaigns").description("Google Ads campaigns and their conversion goals");
2721
+ paidMediaCampaigns.command("list").description("List the organization's owned Google Ads campaigns and owned conversion actions").option("--customer-id <id>", "Google Ads customer id (defaults to the selected account)").option("--json", "print the raw JSON result").action(async (opts) => {
2722
+ try {
2723
+ const result = await new ErdoClient().listPaidMediaCampaigns(opts.customerId);
2724
+ if (opts.json) {
2725
+ print(result);
2726
+ return;
2727
+ }
2728
+ console.log(`customer id: ${result.customer_id}`);
2729
+ for (const campaign of result.campaigns) {
2730
+ const goal = campaign.goal_config_level === "CAMPAIGN" ? `campaign goal: ${(campaign.conversion_actions ?? []).map((a) => a.name || a.id).join(", ")}` : "customer goals";
2731
+ console.log(`${campaign.id} ${campaign.name} ${campaign.status} ${campaign.bidding_strategy_type || "-"} ${goal}`);
2732
+ }
2733
+ } catch (e) {
2734
+ fail(e);
2735
+ }
2736
+ });
2737
+ paidMediaCampaigns.command("conversion-goals <campaignId>").description("Set a campaign's custom conversion goal to exactly these conversion action ids").requiredOption("--actions <ids>", "comma-separated conversion action ids").option("--customer-id <id>", "Google Ads customer id (defaults to the selected account)").option("--json", "print the raw JSON result").action(async (campaignId, opts) => {
2738
+ try {
2739
+ const ids = opts.actions.split(",").map((id) => id.trim()).filter(Boolean);
2740
+ if (!ids.length) throw new Error("--actions must contain at least one id");
2741
+ const result = await new ErdoClient().setPaidMediaCampaignConversionGoals(campaignId, {
2742
+ customer_id: opts.customerId,
2743
+ conversion_action_ids: ids
2744
+ });
2745
+ if (opts.json) {
2746
+ print(result);
2747
+ return;
2748
+ }
2749
+ console.log(`campaign id: ${result.campaign_id}`);
2750
+ if (result.status === "ready") {
2751
+ console.log("status: ready");
2752
+ if (result.goal_config_level) console.log(`goal config level: ${result.goal_config_level}`);
2753
+ } else {
2754
+ console.log("status: pending approval");
2755
+ console.log(`approval request id: ${result.approval_request_id}`);
2756
+ }
2757
+ } catch (e) {
2758
+ fail(e);
2759
+ }
2760
+ });
2709
2761
  paidMedia.command("conversion-actions").command("ensure").description("Find or approval-gate creation of an offline lead conversion action").requiredOption("--name <name>", "exact Google Ads conversion action name").option("--category <category>", "QUALIFIED_LEAD or SUBMIT_LEAD_FORM", "QUALIFIED_LEAD").option("--customer-id <id>", "Google Ads customer id (defaults to the selected account)").option("--json", "print the raw JSON result").action(async (opts) => {
2710
2762
  try {
2711
2763
  if (opts.category && opts.category !== "QUALIFIED_LEAD" && opts.category !== "SUBMIT_LEAD_FORM") {
@@ -5776,14 +5828,15 @@ pagesCmd.command("update <id>").description(
5776
5828
  }
5777
5829
  }
5778
5830
  );
5779
- pagesCmd.command("validate").description("Validate page content without deploying").requiredOption("--html <htmlOr@file>", "HTML (or @path)").option("--js <jsOr@file>", "JS/JSX (or @path)").option("--css <cssOr@file>", "CSS (or @path)").option("--runtime <runtime>", "react-tailwind (default) or none").action(async (opts) => {
5831
+ pagesCmd.command("validate").description("Validate page content without deploying").requiredOption("--html <htmlOr@file>", "HTML (or @path)").option("--js <jsOr@file>", "JS/JSX (or @path)").option("--css <cssOr@file>", "CSS (or @path)").option("--runtime <runtime>", "react-tailwind (default) or none").option("--datasets <csv>", "read-dataset slugs referenced by this page (comma-separated)").action(async (opts) => {
5780
5832
  try {
5781
5833
  print(
5782
5834
  await new ErdoClient().validatePage({
5783
5835
  html: readMaybeFile(opts.html),
5784
5836
  js: readMaybeFile(opts.js),
5785
5837
  css: readMaybeFile(opts.css),
5786
- runtime: opts.runtime
5838
+ runtime: opts.runtime,
5839
+ dataset_slugs: grantList(opts.datasets)
5787
5840
  })
5788
5841
  );
5789
5842
  } catch (e) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@erdoai/cli",
3
- "version": "0.144.0",
3
+ "version": "0.145.1",
4
4
  "description": "Erdo CLI \u2014 drive datasets, pages, and evals from the terminal or CI",
5
5
  "type": "module",
6
6
  "bin": {