@mailmodo/cli 0.0.56-beta.pr58.103 → 0.0.56-beta.pr58.104

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.
@@ -1,4 +1,9 @@
1
1
  import chalk from 'chalk';
2
+ const TIME_W = 18;
3
+ const EMAIL_W = 24;
4
+ const SEQ_W = 12;
5
+ const STATUS_W = 14;
6
+ const CONTACT_COL = TIME_W + EMAIL_W + SEQ_W + STATUS_W;
2
7
  function statusColor(status) {
3
8
  switch (status) {
4
9
  case 'bounced':
@@ -19,25 +24,31 @@ function statusColor(status) {
19
24
  }
20
25
  }
21
26
  }
27
+ function truncate(s, width) {
28
+ return s.length > width ? s.slice(0, width - 1) + '…' : s;
29
+ }
30
+ function shortSeq(id) {
31
+ return id.length > 8 ? id.slice(0, 8) + '…' : id;
32
+ }
22
33
  export function renderEntries(ctx, data) {
23
34
  const { entries, limit, page, total } = data;
24
- ctx.log(`\n ${'Time'.padEnd(22)}${'Email'.padEnd(24)}${'Sequence'.padEnd(20)}${'Status'.padEnd(12)}Contact`);
25
- ctx.log(` ${''.repeat(90)}`);
35
+ ctx.log(`\n ${'Time'.padEnd(TIME_W)}${'Email'.padEnd(EMAIL_W)}` +
36
+ `${'Sequence'.padEnd(SEQ_W)}${'Status'.padEnd(STATUS_W)}Contact`);
37
+ ctx.log(` ${'─'.repeat(CONTACT_COL + 28)}`);
26
38
  if (!entries?.length) {
27
39
  ctx.log(` ${chalk.dim('No entries found.')}`);
28
40
  ctx.log('');
29
41
  return;
30
42
  }
31
43
  for (const entry of entries) {
32
- const time = (entry.timestamp || '').padEnd(22);
33
- const emailId = (entry.emailId || '').padEnd(24);
34
- const seqId = (entry.sequenceId || '').padEnd(20);
35
- const colorFn = statusColor(entry.status);
36
- const status = colorFn((entry.status || '').padEnd(12));
37
- ctx.log(` ${time}${emailId}${seqId}${status}${entry.contact || ''}`);
44
+ const time = (entry.timestamp || '').padEnd(TIME_W);
45
+ const email = truncate(entry.emailId || '', EMAIL_W - 2).padEnd(EMAIL_W);
46
+ const seq = chalk.dim(shortSeq(entry.sequenceId || '').padEnd(SEQ_W));
47
+ const status = statusColor(entry.status)((entry.status || '').padEnd(STATUS_W));
48
+ ctx.log(` ${time}${email}${seq}${status}${entry.contact || ''}`);
38
49
  if (entry.reason) {
39
50
  const label = entry.status === 'skipped' ? 'condition not met' : 'reason';
40
- ctx.log(` ${' '.repeat(78)}${chalk.dim(`(${label}: ${entry.reason})`)}`);
51
+ ctx.log(` ${' '.repeat(CONTACT_COL)}${chalk.dim(`└ ${label}: ${entry.reason}`)}`);
41
52
  }
42
53
  }
43
54
  const totalPages = Math.ceil(total / limit);
@@ -932,5 +932,5 @@
932
932
  ]
933
933
  }
934
934
  },
935
- "version": "0.0.56-beta.pr58.103"
935
+ "version": "0.0.56-beta.pr58.104"
936
936
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mailmodo/cli",
3
3
  "description": "Email lifecycle automation for the AI-native builder generation.",
4
- "version": "0.0.56-beta.pr58.103",
4
+ "version": "0.0.56-beta.pr58.104",
5
5
  "author": "provishalk",
6
6
  "bin": {
7
7
  "mailmodo": "bin/run.js"