@wrangled/cli 0.3.60 → 0.3.61
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/main.js +38 -1
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -2848,7 +2848,44 @@ function winnersText(report) {
|
|
|
2848
2848
|
(report.goalSentence ? `${report.goalSentence}\n` : "") +
|
|
2849
2849
|
`A ${words.primary.one} means ${report.saleMeans}. ${report.saleRule ?? FIRST_TOUCH_SALE_RULE}\n` +
|
|
2850
2850
|
winnersWindowText(winnersDatesTitle(report.window), week, words) +
|
|
2851
|
-
(week.from === last30Days.from && week.to === last30Days.to ? "" : winnersWindowText(`Last 30 days, ${last30Days.from} to ${last30Days.to}`, last30Days, words))
|
|
2851
|
+
(week.from === last30Days.from && week.to === last30Days.to ? "" : winnersWindowText(`Last 30 days, ${last30Days.from} to ${last30Days.to}`, last30Days, words)) +
|
|
2852
|
+
(report.followUp ? followUpText(report.followUp, winnersDatesTitle(report.window)) : ""));
|
|
2853
|
+
}
|
|
2854
|
+
/** A message's or sequence's tagged parts, "job: last_chance, hook: question". */
|
|
2855
|
+
const followUpTags = (tags) => tags.flatMap((t) => Object.entries(t.tags).flatMap(([field, value]) => (field !== "tag_reasons" && typeof value === "string" ? [`${field}: ${value}`] : []))).join(", ");
|
|
2856
|
+
/** A message's or sequence's line: its name, its numbers and tags, then why it is on the list. */
|
|
2857
|
+
function followUpLines(row) {
|
|
2858
|
+
const n = row.numbers;
|
|
2859
|
+
const name = "sequenceKey" in row ? `${row.name ?? `Workflow ${row.sequenceKey}`} (${counted(row.messages, "message")})` : [row.name ?? row.subject ?? (row.channel === "text" ? "Text message" : "Email"), row.itemId && `[${row.itemId}]`].filter(Boolean).join(" ");
|
|
2860
|
+
const engaged = "channel" in row && row.channel === "text" ? `${tenths(n.replied)} replied` : `${tenths(n.clicked)} clicked`;
|
|
2861
|
+
const sent = n.sent === null ? "no send count" : `${tenths(n.sent)} sent`;
|
|
2862
|
+
const tags = "tags" in row ? followUpTags(row.tags) : "";
|
|
2863
|
+
return `- ${name}: ${sent}, ${engaged}, ${counted(n.salesHelped, "sale")} helped, ${tenths(n.salesLastNudge)} last nudge${n.optedOut > 0 ? `, ${counted(n.optedOut, "opt-out")}` : ""}${tags ? `. Tags: ${tags}` : ""}\n ${row.pickedBecause}\n`;
|
|
2864
|
+
}
|
|
2865
|
+
function followUpWindowText(title, window) {
|
|
2866
|
+
const list = (heading, rows) => `\n${heading}\n${rows.length === 0 ? "- none\n" : rows.map(followUpLines).join("")}`;
|
|
2867
|
+
const claimed = window.toolClaimed.map((m) => {
|
|
2868
|
+
const revenue = m.toolClaimedRevenue.map((r) => (r.currency === null ? r.revenue.toFixed(2) : money(r.revenue, r.currency))).join(" and ") || "no revenue";
|
|
2869
|
+
const sends = m.toolSends === null ? "" : `, ${tenths(m.toolSends)} sent`;
|
|
2870
|
+
return `- ${m.name ?? m.subject ?? "Email"} [${m.itemId}] (${m.platform}): ${revenue} claimed${sends}\n ${m.pickedBecause}\n`;
|
|
2871
|
+
});
|
|
2872
|
+
return (`\n### ${title}\n` +
|
|
2873
|
+
list("Top emails", window.emails.top) +
|
|
2874
|
+
list("Bottom emails", window.emails.bottom) +
|
|
2875
|
+
list("Top texts", window.texts.top) +
|
|
2876
|
+
list("Bottom texts", window.texts.bottom) +
|
|
2877
|
+
list("Top sequences", window.sequences.top) +
|
|
2878
|
+
list("Bottom sequences", window.sequences.bottom) +
|
|
2879
|
+
(claimed.length > 0 ? `\nThe tool's own claims, not real sales\n${claimed.join("")}` : ""));
|
|
2880
|
+
}
|
|
2881
|
+
/** Follow-up emails and texts for the same windows as the ads; the last 30 days once when they are the dates asked for. */
|
|
2882
|
+
function followUpText(followUp, title) {
|
|
2883
|
+
if (followUp.state === "not_connected")
|
|
2884
|
+
return "\n## Follow-up emails and texts\n\nNo email or text tool is connected yet, so there are no follow-up messages to judge.\n";
|
|
2885
|
+
const { week, last30Days } = followUp;
|
|
2886
|
+
return (`\n## Follow-up emails and texts\n\nA sale is helped by a message the buyer clicked or replied to in the ${counted(followUp.creditDays, "day")} before buying. Under ${tenths(followUp.minSends)} sent, a message is judged on clicks or replies, never as a flop.\n` +
|
|
2887
|
+
followUpWindowText(title, week) +
|
|
2888
|
+
(week.from === last30Days.from && week.to === last30Days.to ? "" : followUpWindowText(`Last 30 days, ${last30Days.from} to ${last30Days.to}`, last30Days)));
|
|
2852
2889
|
}
|
|
2853
2890
|
function printWinnersGoals(goals, format) {
|
|
2854
2891
|
if (format === "json")
|