@metricraven/cli 0.4.4 → 0.4.5
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/args.js +1 -0
- package/dist/commands.js +9 -3
- package/dist/index.js +1 -0
- package/package.json +1 -1
package/dist/args.js
CHANGED
package/dist/commands.js
CHANGED
|
@@ -738,6 +738,7 @@ async function aiVisibility(ctx) {
|
|
|
738
738
|
}
|
|
739
739
|
/** "Signup started (signup_started)" when the goal has a display name, else the raw name. */
|
|
740
740
|
const goalText = (g) => g.displayName && g.displayName !== g.name ? `${g.displayName} (${g.name})` : g.name;
|
|
741
|
+
const CATEGORY_CHOICES = ["conversion", "engagement", "none", "default"];
|
|
741
742
|
/** `metricraven goals …`: how goals are shown (display name, colour, description, hidden). */
|
|
742
743
|
async function goals(ctx, sub, rest) {
|
|
743
744
|
const { flags, client } = ctx;
|
|
@@ -759,7 +760,7 @@ async function goals(ctx, sub, rest) {
|
|
|
759
760
|
return printJson(d), 0;
|
|
760
761
|
if (!d.customizations.length)
|
|
761
762
|
return out(dim("No goal customisations yet. Use `metricraven goals set <goal> --name <label>`.")), 0;
|
|
762
|
-
out(table(["Goal", "Display name", "Colour", "Hidden", "Description"], d.customizations.map((c) => [c.goal, c.displayName ?? "–", colorText(c.color, d.colors), c.hidden ? "yes" : "no", c.description ? truncate(c.description, 50) : "–"])));
|
|
763
|
+
out(table(["Goal", "Display name", "Colour", "Counts as", "Hidden", "Description"], d.customizations.map((c) => [c.goal, c.displayName ?? "–", colorText(c.color, d.colors), c.category ?? "default", c.hidden ? "yes" : "no", c.description ? truncate(c.description, 50) : "–"])));
|
|
763
764
|
return 0;
|
|
764
765
|
}
|
|
765
766
|
case "colors":
|
|
@@ -792,17 +793,22 @@ async function goals(ctx, sub, rest) {
|
|
|
792
793
|
body.color = match.color;
|
|
793
794
|
}
|
|
794
795
|
}
|
|
796
|
+
if (flags.category !== undefined) {
|
|
797
|
+
if (!CATEGORY_CHOICES.includes(flags.category))
|
|
798
|
+
throw new UsageError(`--category must be one of: ${CATEGORY_CHOICES.join(", ")}.`);
|
|
799
|
+
body.category = flags.category === "default" ? null : flags.category;
|
|
800
|
+
}
|
|
795
801
|
if (flags.hidden)
|
|
796
802
|
body.hidden = true;
|
|
797
803
|
if (flags.visible)
|
|
798
804
|
body.hidden = false;
|
|
799
805
|
if (Object.keys(body).length === 1)
|
|
800
|
-
throw new UsageError("Nothing to change. Use --name, --color, --description, --hidden or --visible.");
|
|
806
|
+
throw new UsageError("Nothing to change. Use --name, --color, --description, --category, --hidden or --visible.");
|
|
801
807
|
const d = await needs("write", client.put("/goals/customizations", body, params()));
|
|
802
808
|
if (flags.json)
|
|
803
809
|
return printJson(d), 0;
|
|
804
810
|
const c = d.customization;
|
|
805
|
-
out(`Saved ${bold(goalText({ name: c.goal, displayName: c.displayName }))}: colour ${colorText(c.color, d.colors)}, ${c.hidden ? "hidden" : "visible"}.`);
|
|
811
|
+
out(`Saved ${bold(goalText({ name: c.goal, displayName: c.displayName }))}: colour ${colorText(c.color, d.colors)}, counts as ${c.category ?? "default"}, ${c.hidden ? "hidden" : "visible"}.`);
|
|
806
812
|
return 0;
|
|
807
813
|
}
|
|
808
814
|
case "reset": {
|
package/dist/index.js
CHANGED
|
@@ -63,6 +63,7 @@ Reports (default: last 30 days)
|
|
|
63
63
|
funnels list Saved funnels
|
|
64
64
|
goals list Goal display settings (name, colour, hidden)
|
|
65
65
|
goals set <goal> [--name <label>] [--color <hex|name>] [--description]
|
|
66
|
+
[--category conversion|engagement|none|default]
|
|
66
67
|
[--hidden | --visible] (needs write access, admin);
|
|
67
68
|
pass "" to clear a text field or colour
|
|
68
69
|
goals reset <goal> Back to the raw name, default colour, visible
|
package/package.json
CHANGED