@mailmodo/cli 0.0.21 → 0.0.23-beta.pr25.40
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/commands/deploy/index.d.ts +2 -28
- package/dist/commands/deploy/index.js +51 -40
- package/dist/commands/domain/index.js +1 -1
- package/dist/commands/edit/index.js +2 -0
- package/dist/commands/init/index.js +6 -1
- package/dist/commands/logs/index.d.ts +2 -0
- package/dist/commands/logs/index.js +18 -2
- package/dist/commands/settings/index.d.ts +2 -0
- package/dist/commands/settings/index.js +81 -57
- package/dist/lib/yaml-config.d.ts +5 -0
- package/oclif.manifest.json +62 -46
- package/package.json +1 -1
|
@@ -6,14 +6,9 @@ export default class Deploy extends BaseCommand {
|
|
|
6
6
|
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
7
7
|
yes: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
8
8
|
};
|
|
9
|
-
/**
|
|
10
|
-
* Fetches current DNS verification status for the deploy flow.
|
|
11
|
-
*
|
|
12
|
-
* @param jsonOutput - When true, spinner uses stderr for stdout-safe JSON runs.
|
|
13
|
-
* @param domain - Sending domain to check. If empty, request will fail and trigger setup flow.
|
|
14
|
-
*/
|
|
15
9
|
private fetchDomainVerifyForDeploy;
|
|
16
10
|
run(): Promise<void>;
|
|
11
|
+
private validateSequence;
|
|
17
12
|
private buildDeployPayload;
|
|
18
13
|
private mapEmailToPayload;
|
|
19
14
|
private buildBrandSection;
|
|
@@ -22,32 +17,11 @@ export default class Deploy extends BaseCommand {
|
|
|
22
17
|
private buildProjectPayload;
|
|
23
18
|
private confirmDeploy;
|
|
24
19
|
private ensureDomainReady;
|
|
25
|
-
/**
|
|
26
|
-
* Lists emails about to be deployed (skipped when `--json` is set).
|
|
27
|
-
*
|
|
28
|
-
* @param yamlConfig - Loaded project YAML.
|
|
29
|
-
* @param jsonOutput - When true, skip human-readable output.
|
|
30
|
-
*/
|
|
31
20
|
private logPreDeploySummary;
|
|
32
|
-
|
|
33
|
-
* Prints the post-deploy success message and SDK install snippet for interactive runs.
|
|
34
|
-
*/
|
|
21
|
+
private logDiff;
|
|
35
22
|
private logDeploySuccessInstructions;
|
|
36
|
-
/**
|
|
37
|
-
* Interactive domain setup flow. Collects domain, sender email, and business
|
|
38
|
-
* address from the user, then calls the API to get DNS records to configure.
|
|
39
|
-
* Polls for verification when the user indicates they've added the records.
|
|
40
|
-
*
|
|
41
|
-
* @returns {Promise<boolean>} true if domain was verified, false if skipped.
|
|
42
|
-
*/
|
|
43
23
|
private runDomainSetup;
|
|
44
24
|
private collectDomainInputs;
|
|
45
25
|
private showDnsRecords;
|
|
46
|
-
/**
|
|
47
|
-
* Calls the domain verification API endpoint and reports pass/fail
|
|
48
|
-
* status for each DNS record (DKIM, DMARC, Return-Path).
|
|
49
|
-
*
|
|
50
|
-
* @returns {Promise<boolean>} true if all records pass.
|
|
51
|
-
*/
|
|
52
26
|
private verifyDomain;
|
|
53
27
|
}
|
|
@@ -12,12 +12,6 @@ export default class Deploy extends BaseCommand {
|
|
|
12
12
|
static flags = {
|
|
13
13
|
...BaseCommand.baseFlags,
|
|
14
14
|
};
|
|
15
|
-
/**
|
|
16
|
-
* Fetches current DNS verification status for the deploy flow.
|
|
17
|
-
*
|
|
18
|
-
* @param jsonOutput - When true, spinner uses stderr for stdout-safe JSON runs.
|
|
19
|
-
* @param domain - Sending domain to check. If empty, request will fail and trigger setup flow.
|
|
20
|
-
*/
|
|
21
15
|
fetchDomainVerifyForDeploy(jsonOutput, domain) {
|
|
22
16
|
return this.withApiSpinner({ json: jsonOutput, text: ' Checking domain verification...' }, () => this.apiClient.get(API_ENDPOINTS.DOMAIN_VERIFY, {
|
|
23
17
|
domain: domain || '',
|
|
@@ -30,11 +24,12 @@ export default class Deploy extends BaseCommand {
|
|
|
30
24
|
const domainReady = await this.ensureDomainReady(yamlConfig, flags);
|
|
31
25
|
if (!domainReady)
|
|
32
26
|
return;
|
|
33
|
-
this.
|
|
27
|
+
const payload = await this.buildDeployPayload(yamlConfig);
|
|
28
|
+
const validateResult = await this.validateSequence(payload, flags);
|
|
29
|
+
this.logPreDeploySummary(yamlConfig, validateResult, flags.json);
|
|
34
30
|
const confirmed = await this.confirmDeploy(yamlConfig, flags);
|
|
35
31
|
if (!confirmed)
|
|
36
32
|
return;
|
|
37
|
-
const payload = await this.buildDeployPayload(yamlConfig);
|
|
38
33
|
const response = await this.withApiSpinner({ json: flags.json, text: ' Deploying email sequences...' }, () => this.apiClient.post(API_ENDPOINTS.SEQUENCES_DEPLOY, payload));
|
|
39
34
|
if (!response.ok) {
|
|
40
35
|
this.handleApiError(response);
|
|
@@ -51,6 +46,19 @@ export default class Deploy extends BaseCommand {
|
|
|
51
46
|
}
|
|
52
47
|
this.logDeploySuccessInstructions(response.data.sdkSnippet);
|
|
53
48
|
}
|
|
49
|
+
async validateSequence(payload, flags) {
|
|
50
|
+
const response = await this.withApiSpinner({ json: flags.json, text: ' Validating sequence...' }, () => this.apiClient.post(API_ENDPOINTS.SEQUENCES_VALIDATE, payload));
|
|
51
|
+
if (!response.ok) {
|
|
52
|
+
if (response.data.error === 'senderDomainNotFound') {
|
|
53
|
+
this.error(`Sending domain not registered. Run: ${chalk.cyan('mailmodo domain')}`);
|
|
54
|
+
}
|
|
55
|
+
if (response.data.error === 'senderDomainNotVerified') {
|
|
56
|
+
this.error(`Sending domain not verified. Run: ${chalk.cyan('mailmodo domain --verify')}`);
|
|
57
|
+
}
|
|
58
|
+
this.handleApiError(response);
|
|
59
|
+
}
|
|
60
|
+
return response.data;
|
|
61
|
+
}
|
|
54
62
|
async buildDeployPayload(yamlConfig) {
|
|
55
63
|
const emailsWithHtml = await Promise.all(yamlConfig.emails.map(async (email) => {
|
|
56
64
|
const html = (await loadTemplate(`${email.id}.html`)) || '';
|
|
@@ -64,7 +72,7 @@ export default class Deploy extends BaseCommand {
|
|
|
64
72
|
mapEmailToPayload(email) {
|
|
65
73
|
return {
|
|
66
74
|
condition: email.condition || null,
|
|
67
|
-
ctaText: '',
|
|
75
|
+
ctaText: email.ctaText || '',
|
|
68
76
|
delay: typeof email.delay === 'string'
|
|
69
77
|
? Number.parseInt(email.delay, 10) || 0
|
|
70
78
|
: email.delay,
|
|
@@ -86,11 +94,11 @@ export default class Deploy extends BaseCommand {
|
|
|
86
94
|
buildProductSection(project) {
|
|
87
95
|
return {
|
|
88
96
|
businessType: project?.type || '',
|
|
89
|
-
description: '',
|
|
90
|
-
pricingModel: '',
|
|
97
|
+
description: project?.description || '',
|
|
98
|
+
pricingModel: project?.pricingModel || '',
|
|
91
99
|
productName: project?.name || '',
|
|
92
|
-
saasModel: '',
|
|
93
|
-
targetUser: '',
|
|
100
|
+
saasModel: project?.saasModel || '',
|
|
101
|
+
targetUser: project?.targetUser || '',
|
|
94
102
|
url: project?.url || '',
|
|
95
103
|
};
|
|
96
104
|
}
|
|
@@ -110,7 +118,7 @@ export default class Deploy extends BaseCommand {
|
|
|
110
118
|
monthlyCap: project?.monthlyCap ?? DEFAULT_MONTHLY_CAP,
|
|
111
119
|
product: this.buildProductSection(project),
|
|
112
120
|
senderDetails: this.buildSenderSection(project),
|
|
113
|
-
webhookUrl: project
|
|
121
|
+
...(project?.webhookUrl ? { webhookUrl: project.webhookUrl } : {}),
|
|
114
122
|
};
|
|
115
123
|
}
|
|
116
124
|
async confirmDeploy(yamlConfig, flags) {
|
|
@@ -150,25 +158,41 @@ export default class Deploy extends BaseCommand {
|
|
|
150
158
|
}
|
|
151
159
|
return this.runDomainSetup(yamlConfig, flags);
|
|
152
160
|
}
|
|
153
|
-
|
|
154
|
-
* Lists emails about to be deployed (skipped when `--json` is set).
|
|
155
|
-
*
|
|
156
|
-
* @param yamlConfig - Loaded project YAML.
|
|
157
|
-
* @param jsonOutput - When true, skip human-readable output.
|
|
158
|
-
*/
|
|
159
|
-
logPreDeploySummary(yamlConfig, jsonOutput) {
|
|
161
|
+
logPreDeploySummary(yamlConfig, validateResult, jsonOutput) {
|
|
160
162
|
if (jsonOutput)
|
|
161
163
|
return;
|
|
162
164
|
this.log(`\n ${chalk.green('✓')} Domain: ${yamlConfig.project?.domain || 'verified'}\n`);
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
165
|
+
if (!validateResult.existingDeployment || !validateResult.diff) {
|
|
166
|
+
this.log(` Deploying:`);
|
|
167
|
+
for (const email of yamlConfig.emails) {
|
|
168
|
+
this.log(` ${chalk.green('+')} ${email.id.padEnd(24)} ${email.trigger}`);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
else {
|
|
172
|
+
this.logDiff(validateResult.diff);
|
|
166
173
|
}
|
|
167
174
|
this.log('');
|
|
168
175
|
}
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
176
|
+
logDiff(diff) {
|
|
177
|
+
if (!diff.hasChanges) {
|
|
178
|
+
this.log(` No changes from last deployment.`);
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
181
|
+
this.log(` Changes vs. last deployment:`);
|
|
182
|
+
for (const email of diff.added) {
|
|
183
|
+
this.log(` ${chalk.green('+')} ${email.id.padEnd(24)} ${email.trigger || ''}`);
|
|
184
|
+
}
|
|
185
|
+
for (const email of diff.removed) {
|
|
186
|
+
this.log(` ${chalk.red('-')} ${email.id.padEnd(24)} ${email.trigger || ''}`);
|
|
187
|
+
}
|
|
188
|
+
for (const email of diff.modified) {
|
|
189
|
+
const fields = email.changedFields?.join(', ') || '';
|
|
190
|
+
this.log(` ${chalk.yellow('~')} ${email.id.padEnd(24)} ${fields}`);
|
|
191
|
+
}
|
|
192
|
+
if (diff.unchanged.length > 0) {
|
|
193
|
+
this.log(` ${chalk.dim(`∙ ${diff.unchanged.length} unchanged`)}`);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
172
196
|
logDeploySuccessInstructions(sdkSnippet) {
|
|
173
197
|
this.log(` ${chalk.green('Deployed.')} Emails are live.\n`);
|
|
174
198
|
this.log(` ${'─'.repeat(53)}`);
|
|
@@ -185,13 +209,6 @@ export default class Deploy extends BaseCommand {
|
|
|
185
209
|
this.log(` Full SDK docs: ${chalk.cyan('mailmodo.com/docs/sdk')}\n`);
|
|
186
210
|
this.log(` ${'─'.repeat(53)}\n`);
|
|
187
211
|
}
|
|
188
|
-
/**
|
|
189
|
-
* Interactive domain setup flow. Collects domain, sender email, and business
|
|
190
|
-
* address from the user, then calls the API to get DNS records to configure.
|
|
191
|
-
* Polls for verification when the user indicates they've added the records.
|
|
192
|
-
*
|
|
193
|
-
* @returns {Promise<boolean>} true if domain was verified, false if skipped.
|
|
194
|
-
*/
|
|
195
212
|
async runDomainSetup(yamlConfig, flags) {
|
|
196
213
|
const { address, domain, senderEmail } = await this.collectDomainInputs(yamlConfig, flags);
|
|
197
214
|
const domainResponse = await this.withApiSpinner({ json: flags.json, text: ' Configuring domain...' }, () => this.apiClient.post(API_ENDPOINTS.DOMAIN, {
|
|
@@ -260,12 +277,6 @@ export default class Deploy extends BaseCommand {
|
|
|
260
277
|
this.log(` DNS changes take 5–30 minutes to propagate.`);
|
|
261
278
|
this.log(` Full guide: ${chalk.cyan(DNS_GUIDE_URL)}\n`);
|
|
262
279
|
}
|
|
263
|
-
/**
|
|
264
|
-
* Calls the domain verification API endpoint and reports pass/fail
|
|
265
|
-
* status for each DNS record (DKIM, DMARC, Return-Path).
|
|
266
|
-
*
|
|
267
|
-
* @returns {Promise<boolean>} true if all records pass.
|
|
268
|
-
*/
|
|
269
280
|
async verifyDomain(jsonOutput, domain) {
|
|
270
281
|
const verify = await this.withApiSpinner({ json: jsonOutput, text: ' Checking DNS...' }, () => this.apiClient.get(API_ENDPOINTS.DOMAIN_VERIFY, {
|
|
271
282
|
domain,
|
|
@@ -179,7 +179,7 @@ export default class Domain extends BaseCommand {
|
|
|
179
179
|
this.log(` Spam rate: ${data.spamRate ?? 'N/A'}%\n`);
|
|
180
180
|
}
|
|
181
181
|
recordLabel(index) {
|
|
182
|
-
const labels = ['
|
|
182
|
+
const labels = ['DKIM', 'DMARC', 'Return Path'];
|
|
183
183
|
return labels[index] || `Record ${index + 1}`;
|
|
184
184
|
}
|
|
185
185
|
}
|
|
@@ -194,6 +194,8 @@ export default class Edit extends BaseCommand {
|
|
|
194
194
|
email.subject = updated.subject;
|
|
195
195
|
if (updated.previewText)
|
|
196
196
|
email.previewText = updated.previewText;
|
|
197
|
+
if (updated.ctaText)
|
|
198
|
+
email.ctaText = updated.ctaText;
|
|
197
199
|
const updatedYaml = {
|
|
198
200
|
...yamlConfig,
|
|
199
201
|
emails: [...yamlConfig.emails],
|
|
@@ -128,6 +128,7 @@ export default class Init extends BaseCommand {
|
|
|
128
128
|
...(generated?.previewText
|
|
129
129
|
? { previewText: generated.previewText }
|
|
130
130
|
: {}),
|
|
131
|
+
...(generated?.ctaText ? { ctaText: generated.ctaText } : {}),
|
|
131
132
|
goal: rec.goal,
|
|
132
133
|
};
|
|
133
134
|
});
|
|
@@ -135,14 +136,18 @@ export default class Init extends BaseCommand {
|
|
|
135
136
|
emails: emailConfigs,
|
|
136
137
|
project: {
|
|
137
138
|
brandColor: analysisPayload.brand?.color || DEFAULT_BRAND_COLOR,
|
|
139
|
+
description: analysisPayload.description,
|
|
138
140
|
emailStyle: 'branded',
|
|
139
141
|
fromEmail: '',
|
|
140
142
|
fromName: `Team ${analysisPayload.productName}`,
|
|
141
143
|
logoUrl: analysisPayload.brand?.logoUrl || '',
|
|
142
144
|
monthlyCap: DEFAULT_MONTHLY_CAP,
|
|
143
145
|
name: analysisPayload.productName,
|
|
146
|
+
pricingModel: analysisPayload.pricingModel,
|
|
144
147
|
replyTo: '',
|
|
145
|
-
|
|
148
|
+
saasModel: analysisPayload.saasModel,
|
|
149
|
+
targetUser: analysisPayload.targetUser,
|
|
150
|
+
type: analysisPayload.businessType,
|
|
146
151
|
url: productUrl,
|
|
147
152
|
webhookUrl: '',
|
|
148
153
|
},
|
|
@@ -5,6 +5,8 @@ export default class Logs extends BaseCommand {
|
|
|
5
5
|
static flags: {
|
|
6
6
|
email: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
7
7
|
failed: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
8
|
+
limit: import("@oclif/core/interfaces").OptionFlag<number, import("@oclif/core/interfaces").CustomOptions>;
|
|
9
|
+
page: import("@oclif/core/interfaces").OptionFlag<number, import("@oclif/core/interfaces").CustomOptions>;
|
|
8
10
|
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
9
11
|
yes: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
10
12
|
};
|
|
@@ -17,11 +17,22 @@ export default class Logs extends BaseCommand {
|
|
|
17
17
|
default: false,
|
|
18
18
|
description: 'Show only failed/bounced events',
|
|
19
19
|
}),
|
|
20
|
+
limit: Flags.integer({
|
|
21
|
+
default: 50,
|
|
22
|
+
description: 'Entries per page (max 200)',
|
|
23
|
+
}),
|
|
24
|
+
page: Flags.integer({
|
|
25
|
+
default: 1,
|
|
26
|
+
description: 'Page number',
|
|
27
|
+
}),
|
|
20
28
|
};
|
|
21
29
|
async run() {
|
|
22
30
|
const { flags } = await this.parse(Logs);
|
|
23
31
|
await this.ensureAuth();
|
|
24
|
-
const params = {
|
|
32
|
+
const params = {
|
|
33
|
+
limit: String(flags.limit),
|
|
34
|
+
page: String(flags.page),
|
|
35
|
+
};
|
|
25
36
|
if (flags.email)
|
|
26
37
|
params.email = flags.email;
|
|
27
38
|
if (flags.failed)
|
|
@@ -30,7 +41,7 @@ export default class Logs extends BaseCommand {
|
|
|
30
41
|
if (!response.ok) {
|
|
31
42
|
this.handleApiError(response);
|
|
32
43
|
}
|
|
33
|
-
const { entries } = response.data;
|
|
44
|
+
const { entries, limit, page, total } = response.data;
|
|
34
45
|
if (flags.json) {
|
|
35
46
|
this.log(JSON.stringify(response.data, null, 2));
|
|
36
47
|
return;
|
|
@@ -49,6 +60,11 @@ export default class Logs extends BaseCommand {
|
|
|
49
60
|
this.log(` ${' '.repeat(52)}${chalk.dim(`(reason: ${entry.reason})`)}`);
|
|
50
61
|
}
|
|
51
62
|
}
|
|
63
|
+
const totalPages = Math.ceil(total / limit);
|
|
64
|
+
this.log(`\n Page ${page} of ${totalPages} · ${total} total entries`);
|
|
65
|
+
if (page < totalPages) {
|
|
66
|
+
this.log(` ${chalk.dim(`Next: --page ${page + 1}`)}`);
|
|
67
|
+
}
|
|
52
68
|
}
|
|
53
69
|
else {
|
|
54
70
|
this.log(` ${chalk.dim('No log entries found.')}`);
|
|
@@ -8,6 +8,8 @@ export default class Settings extends BaseCommand {
|
|
|
8
8
|
yes: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
9
9
|
};
|
|
10
10
|
run(): Promise<void>;
|
|
11
|
+
private applySetFlag;
|
|
12
|
+
private displaySettingsGroup;
|
|
11
13
|
/**
|
|
12
14
|
* Prompts the user to pick a setting key to edit and dispatches
|
|
13
15
|
* to the appropriate handler for that key.
|
|
@@ -43,73 +43,85 @@ export default class Settings extends BaseCommand {
|
|
|
43
43
|
async run() {
|
|
44
44
|
const { flags } = await this.parse(Settings);
|
|
45
45
|
const yamlConfig = await this.ensureYaml();
|
|
46
|
-
const { project } = yamlConfig;
|
|
47
46
|
if (flags.set) {
|
|
48
|
-
|
|
49
|
-
if (eqIndex === -1) {
|
|
50
|
-
this.error('Invalid format. Use --set key=value (e.g., --set brand_color=#0F3460)');
|
|
51
|
-
}
|
|
52
|
-
const key = flags.set.slice(0, eqIndex).trim();
|
|
53
|
-
const propKey = settingKeyToProp(key);
|
|
54
|
-
const value = flags.set.slice(eqIndex + 1).trim();
|
|
55
|
-
if (!(propKey in project)) {
|
|
56
|
-
this.error(`Unknown setting: ${key}`);
|
|
57
|
-
}
|
|
58
|
-
project[propKey] =
|
|
59
|
-
propKey === 'monthlyCap' ? Number(value) : value;
|
|
60
|
-
await saveYaml(yamlConfig);
|
|
61
|
-
if (flags.json) {
|
|
62
|
-
this.log(JSON.stringify({ [propKey]: value, status: 'updated' }, null, 2));
|
|
63
|
-
return;
|
|
64
|
-
}
|
|
65
|
-
this.log(`\n ${chalk.green('✓')} ${key} updated to ${chalk.cyan(value)}`);
|
|
66
|
-
this.log(` Run ${chalk.cyan("'mailmodo deploy'")} to apply.\n`);
|
|
47
|
+
await this.applySetFlag(flags.set, yamlConfig, flags.json ?? false);
|
|
67
48
|
return;
|
|
68
49
|
}
|
|
69
50
|
if (flags.json) {
|
|
70
|
-
this.log(JSON.stringify({ settings: project }, null, 2));
|
|
51
|
+
this.log(JSON.stringify({ settings: yamlConfig.project }, null, 2));
|
|
71
52
|
return;
|
|
72
53
|
}
|
|
73
|
-
const domainVerified = await this.fetchDomainVerified(project.domain);
|
|
74
|
-
this.log(`\n Current settings for ${chalk.bold(project.name || 'project')}:\n`);
|
|
54
|
+
const domainVerified = await this.fetchDomainVerified(yamlConfig.project.domain);
|
|
55
|
+
this.log(`\n Current settings for ${chalk.bold(yamlConfig.project.name || 'project')}:\n`);
|
|
75
56
|
for (const [group, keys] of Object.entries(SETTINGS_GROUPS)) {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
57
|
+
this.displaySettingsGroup(group, keys, yamlConfig.project, domainVerified);
|
|
58
|
+
}
|
|
59
|
+
if (!flags.yes) {
|
|
60
|
+
await this.promptEditSetting(yamlConfig);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
async applySetFlag(setFlag, yamlConfig, isJson) {
|
|
64
|
+
const { project } = yamlConfig;
|
|
65
|
+
const eqIndex = setFlag.indexOf('=');
|
|
66
|
+
if (eqIndex === -1) {
|
|
67
|
+
this.error('Invalid format. Use --set key=value (e.g., --set brand_color=#0F3460)');
|
|
68
|
+
}
|
|
69
|
+
const key = setFlag.slice(0, eqIndex).trim();
|
|
70
|
+
const propKey = settingKeyToProp(key);
|
|
71
|
+
const value = setFlag.slice(eqIndex + 1).trim();
|
|
72
|
+
if (!(propKey in project) && key !== 'logo_file') {
|
|
73
|
+
this.error(`Unknown setting: ${key}`);
|
|
74
|
+
}
|
|
75
|
+
project[propKey] =
|
|
76
|
+
propKey === 'monthlyCap' ? Number(value) : value;
|
|
77
|
+
await saveYaml(yamlConfig);
|
|
78
|
+
if (isJson) {
|
|
79
|
+
this.log(JSON.stringify({ [propKey]: value, status: 'updated' }, null, 2));
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
this.log(`\n ${chalk.green('✓')} ${key} updated to ${chalk.cyan(value)}`);
|
|
83
|
+
this.log(` Run ${chalk.cyan("'mailmodo deploy'")} to apply.\n`);
|
|
84
|
+
}
|
|
85
|
+
displaySettingsGroup(group, keys, project, domainVerified) {
|
|
86
|
+
const availableKeys = keys.filter((key) => {
|
|
87
|
+
if (group === 'brand' && key === 'logo_file')
|
|
88
|
+
return true;
|
|
89
|
+
return settingKeyToProp(key) in project;
|
|
90
|
+
});
|
|
91
|
+
const groupTitle = ` ${chalk.bold(group.charAt(0).toUpperCase() + group.slice(1))}`;
|
|
92
|
+
if (availableKeys.length === 0) {
|
|
93
|
+
const hint = SETUP_HINTS[settingKeyToProp(keys[0])];
|
|
94
|
+
if (hint) {
|
|
95
|
+
this.log(groupTitle);
|
|
96
|
+
this.log(` ${'─'.repeat(49)}`);
|
|
97
|
+
this.log(` ${chalk.dim(`Run ${hint} to configure.`)}`);
|
|
98
|
+
this.log('');
|
|
86
99
|
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
displayValue += ` ${chalk.red('✗ not verified')}`;
|
|
98
|
-
}
|
|
99
|
-
this.log(` ${key.padEnd(16)} ${displayValue}`);
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
this.log(groupTitle);
|
|
103
|
+
this.log(` ${'─'.repeat(49)}`);
|
|
104
|
+
for (const key of availableKeys) {
|
|
105
|
+
const propKey = settingKeyToProp(key);
|
|
106
|
+
const value = project[propKey];
|
|
107
|
+
let displayValue = value ? String(value) : chalk.dim('(not set)');
|
|
108
|
+
if (key === 'domain' && value && domainVerified === true) {
|
|
109
|
+
displayValue += ` ${chalk.green('✓ verified')}`;
|
|
100
110
|
}
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
const hint = SETUP_HINTS[settingKeyToProp(key)];
|
|
104
|
-
if (hint) {
|
|
105
|
-
this.log(` ${key.padEnd(16)} ${chalk.dim(`(run ${hint} to set up)`)}`);
|
|
106
|
-
}
|
|
111
|
+
else if (key === 'domain' && value && domainVerified === false) {
|
|
112
|
+
displayValue += ` ${chalk.red('✗ not verified')}`;
|
|
107
113
|
}
|
|
108
|
-
this.log(
|
|
114
|
+
this.log(` ${key.padEnd(16)} ${displayValue}`);
|
|
109
115
|
}
|
|
110
|
-
|
|
111
|
-
|
|
116
|
+
const missingKeys = keys.filter((key) => !(settingKeyToProp(key) in project) &&
|
|
117
|
+
!(group === 'brand' && key === 'logo_file'));
|
|
118
|
+
for (const key of missingKeys) {
|
|
119
|
+
const hint = SETUP_HINTS[settingKeyToProp(key)];
|
|
120
|
+
if (hint) {
|
|
121
|
+
this.log(` ${key.padEnd(16)} ${chalk.dim(`(run ${hint} to set up)`)}`);
|
|
122
|
+
}
|
|
112
123
|
}
|
|
124
|
+
this.log('');
|
|
113
125
|
}
|
|
114
126
|
/**
|
|
115
127
|
* Prompts the user to pick a setting key to edit and dispatches
|
|
@@ -125,6 +137,10 @@ export default class Settings extends BaseCommand {
|
|
|
125
137
|
return;
|
|
126
138
|
const editPropKey = settingKeyToProp(editKey);
|
|
127
139
|
if (!(editPropKey in project)) {
|
|
140
|
+
if (editKey === 'logo_file') {
|
|
141
|
+
await this.handleLogoUpload(yamlConfig);
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
128
144
|
const hint = SETUP_HINTS[editPropKey];
|
|
129
145
|
if (hint) {
|
|
130
146
|
this.log(`\n ${editKey} is not configured yet. Run ${chalk.cyan(hint)} to set it up.\n`);
|
|
@@ -233,7 +249,7 @@ export default class Settings extends BaseCommand {
|
|
|
233
249
|
this.log(` Help: ${chalk.cyan(DNS_GUIDE_URL)}\n`);
|
|
234
250
|
}
|
|
235
251
|
recordLabel(index) {
|
|
236
|
-
const labels = ['
|
|
252
|
+
const labels = ['DKIM', 'DMARC', 'Return Path'];
|
|
237
253
|
return labels[index] || `Record ${index + 1}`;
|
|
238
254
|
}
|
|
239
255
|
/**
|
|
@@ -252,8 +268,16 @@ export default class Settings extends BaseCommand {
|
|
|
252
268
|
}
|
|
253
269
|
await this.ensureAuth();
|
|
254
270
|
const fileBuffer = await readFile(resolvedPath);
|
|
271
|
+
const ext = resolvedPath.split('.').pop()?.toLowerCase();
|
|
272
|
+
const mimeTypes = {
|
|
273
|
+
png: 'image/png',
|
|
274
|
+
jpg: 'image/jpeg',
|
|
275
|
+
jpeg: 'image/jpeg',
|
|
276
|
+
svg: 'image/svg+xml',
|
|
277
|
+
};
|
|
278
|
+
const mimeType = mimeTypes[ext ?? ''] ?? 'application/octet-stream';
|
|
255
279
|
const formData = new FormData();
|
|
256
|
-
formData.append('logo', new Blob([new Uint8Array(fileBuffer)]), logoPath.split(/[/\\]/).pop() || 'logo.png');
|
|
280
|
+
formData.append('logo', new Blob([new Uint8Array(fileBuffer)], { type: mimeType }), logoPath.split(/[/\\]/).pop() || 'logo.png');
|
|
257
281
|
const response = await this.apiClient.postFormData(API_ENDPOINTS.ASSETS_LOGO, formData);
|
|
258
282
|
if (!response.ok) {
|
|
259
283
|
this.handleApiError(response);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export interface EmailConfig {
|
|
2
2
|
condition?: string;
|
|
3
|
+
ctaText?: string;
|
|
3
4
|
delay: number | string;
|
|
4
5
|
goal?: string;
|
|
5
6
|
id: string;
|
|
@@ -12,6 +13,7 @@ export interface EmailConfig {
|
|
|
12
13
|
export interface ProjectConfig {
|
|
13
14
|
address?: string;
|
|
14
15
|
brandColor?: string;
|
|
16
|
+
description?: string;
|
|
15
17
|
domain?: string;
|
|
16
18
|
emailStyle?: 'branded' | 'plain';
|
|
17
19
|
fromEmail?: string;
|
|
@@ -20,7 +22,10 @@ export interface ProjectConfig {
|
|
|
20
22
|
logoUrl?: string;
|
|
21
23
|
monthlyCap?: number;
|
|
22
24
|
name?: string;
|
|
25
|
+
pricingModel?: string;
|
|
23
26
|
replyTo?: string;
|
|
27
|
+
saasModel?: string;
|
|
28
|
+
targetUser?: string;
|
|
24
29
|
type?: string;
|
|
25
30
|
url?: string;
|
|
26
31
|
webhookUrl?: string;
|
package/oclif.manifest.json
CHANGED
|
@@ -153,14 +153,19 @@
|
|
|
153
153
|
"index.js"
|
|
154
154
|
]
|
|
155
155
|
},
|
|
156
|
-
"
|
|
156
|
+
"edit": {
|
|
157
157
|
"aliases": [],
|
|
158
|
-
"args": {
|
|
159
|
-
|
|
158
|
+
"args": {
|
|
159
|
+
"id": {
|
|
160
|
+
"description": "Email template ID to edit",
|
|
161
|
+
"name": "id",
|
|
162
|
+
"required": true
|
|
163
|
+
}
|
|
164
|
+
},
|
|
165
|
+
"description": "Edit an email using AI-assisted natural language changes",
|
|
160
166
|
"examples": [
|
|
161
|
-
"<%= config.bin %>
|
|
162
|
-
"<%= config.bin %>
|
|
163
|
-
"<%= config.bin %> domain --status"
|
|
167
|
+
"<%= config.bin %> edit welcome",
|
|
168
|
+
"<%= config.bin %> edit welcome --change \"make subject more urgent\" --yes"
|
|
164
169
|
],
|
|
165
170
|
"flags": {
|
|
166
171
|
"json": {
|
|
@@ -176,22 +181,17 @@
|
|
|
176
181
|
"allowNo": false,
|
|
177
182
|
"type": "boolean"
|
|
178
183
|
},
|
|
179
|
-
"
|
|
180
|
-
"description": "
|
|
181
|
-
"name": "
|
|
182
|
-
"
|
|
183
|
-
"
|
|
184
|
-
|
|
185
|
-
"verify": {
|
|
186
|
-
"description": "Verify DNS records",
|
|
187
|
-
"name": "verify",
|
|
188
|
-
"allowNo": false,
|
|
189
|
-
"type": "boolean"
|
|
184
|
+
"change": {
|
|
185
|
+
"description": "Natural language description of the change",
|
|
186
|
+
"name": "change",
|
|
187
|
+
"hasDynamicHelp": false,
|
|
188
|
+
"multiple": false,
|
|
189
|
+
"type": "option"
|
|
190
190
|
}
|
|
191
191
|
},
|
|
192
192
|
"hasDynamicHelp": false,
|
|
193
193
|
"hiddenAliases": [],
|
|
194
|
-
"id": "
|
|
194
|
+
"id": "edit",
|
|
195
195
|
"pluginAlias": "@mailmodo/cli",
|
|
196
196
|
"pluginName": "@mailmodo/cli",
|
|
197
197
|
"pluginType": "core",
|
|
@@ -201,23 +201,17 @@
|
|
|
201
201
|
"relativePath": [
|
|
202
202
|
"dist",
|
|
203
203
|
"commands",
|
|
204
|
-
"
|
|
204
|
+
"edit",
|
|
205
205
|
"index.js"
|
|
206
206
|
]
|
|
207
207
|
},
|
|
208
|
-
"
|
|
208
|
+
"emails": {
|
|
209
209
|
"aliases": [],
|
|
210
|
-
"args": {
|
|
211
|
-
|
|
212
|
-
"description": "Email template ID to edit",
|
|
213
|
-
"name": "id",
|
|
214
|
-
"required": true
|
|
215
|
-
}
|
|
216
|
-
},
|
|
217
|
-
"description": "Edit an email using AI-assisted natural language changes",
|
|
210
|
+
"args": {},
|
|
211
|
+
"description": "List and view configured email sequences",
|
|
218
212
|
"examples": [
|
|
219
|
-
"<%= config.bin %>
|
|
220
|
-
"<%= config.bin %>
|
|
213
|
+
"<%= config.bin %> emails",
|
|
214
|
+
"<%= config.bin %> emails --json"
|
|
221
215
|
],
|
|
222
216
|
"flags": {
|
|
223
217
|
"json": {
|
|
@@ -232,18 +226,11 @@
|
|
|
232
226
|
"name": "yes",
|
|
233
227
|
"allowNo": false,
|
|
234
228
|
"type": "boolean"
|
|
235
|
-
},
|
|
236
|
-
"change": {
|
|
237
|
-
"description": "Natural language description of the change",
|
|
238
|
-
"name": "change",
|
|
239
|
-
"hasDynamicHelp": false,
|
|
240
|
-
"multiple": false,
|
|
241
|
-
"type": "option"
|
|
242
229
|
}
|
|
243
230
|
},
|
|
244
231
|
"hasDynamicHelp": false,
|
|
245
232
|
"hiddenAliases": [],
|
|
246
|
-
"id": "
|
|
233
|
+
"id": "emails",
|
|
247
234
|
"pluginAlias": "@mailmodo/cli",
|
|
248
235
|
"pluginName": "@mailmodo/cli",
|
|
249
236
|
"pluginType": "core",
|
|
@@ -253,17 +240,18 @@
|
|
|
253
240
|
"relativePath": [
|
|
254
241
|
"dist",
|
|
255
242
|
"commands",
|
|
256
|
-
"
|
|
243
|
+
"emails",
|
|
257
244
|
"index.js"
|
|
258
245
|
]
|
|
259
246
|
},
|
|
260
|
-
"
|
|
247
|
+
"domain": {
|
|
261
248
|
"aliases": [],
|
|
262
249
|
"args": {},
|
|
263
|
-
"description": "
|
|
250
|
+
"description": "Set up and verify your sending domain",
|
|
264
251
|
"examples": [
|
|
265
|
-
"<%= config.bin %>
|
|
266
|
-
"<%= config.bin %>
|
|
252
|
+
"<%= config.bin %> domain",
|
|
253
|
+
"<%= config.bin %> domain --verify",
|
|
254
|
+
"<%= config.bin %> domain --status"
|
|
267
255
|
],
|
|
268
256
|
"flags": {
|
|
269
257
|
"json": {
|
|
@@ -278,11 +266,23 @@
|
|
|
278
266
|
"name": "yes",
|
|
279
267
|
"allowNo": false,
|
|
280
268
|
"type": "boolean"
|
|
269
|
+
},
|
|
270
|
+
"status": {
|
|
271
|
+
"description": "Show domain health status",
|
|
272
|
+
"name": "status",
|
|
273
|
+
"allowNo": false,
|
|
274
|
+
"type": "boolean"
|
|
275
|
+
},
|
|
276
|
+
"verify": {
|
|
277
|
+
"description": "Verify DNS records",
|
|
278
|
+
"name": "verify",
|
|
279
|
+
"allowNo": false,
|
|
280
|
+
"type": "boolean"
|
|
281
281
|
}
|
|
282
282
|
},
|
|
283
283
|
"hasDynamicHelp": false,
|
|
284
284
|
"hiddenAliases": [],
|
|
285
|
-
"id": "
|
|
285
|
+
"id": "domain",
|
|
286
286
|
"pluginAlias": "@mailmodo/cli",
|
|
287
287
|
"pluginName": "@mailmodo/cli",
|
|
288
288
|
"pluginType": "core",
|
|
@@ -292,7 +292,7 @@
|
|
|
292
292
|
"relativePath": [
|
|
293
293
|
"dist",
|
|
294
294
|
"commands",
|
|
295
|
-
"
|
|
295
|
+
"domain",
|
|
296
296
|
"index.js"
|
|
297
297
|
]
|
|
298
298
|
},
|
|
@@ -455,6 +455,22 @@
|
|
|
455
455
|
"name": "failed",
|
|
456
456
|
"allowNo": false,
|
|
457
457
|
"type": "boolean"
|
|
458
|
+
},
|
|
459
|
+
"limit": {
|
|
460
|
+
"description": "Entries per page (max 200)",
|
|
461
|
+
"name": "limit",
|
|
462
|
+
"default": 50,
|
|
463
|
+
"hasDynamicHelp": false,
|
|
464
|
+
"multiple": false,
|
|
465
|
+
"type": "option"
|
|
466
|
+
},
|
|
467
|
+
"page": {
|
|
468
|
+
"description": "Page number",
|
|
469
|
+
"name": "page",
|
|
470
|
+
"default": 1,
|
|
471
|
+
"hasDynamicHelp": false,
|
|
472
|
+
"multiple": false,
|
|
473
|
+
"type": "option"
|
|
458
474
|
}
|
|
459
475
|
},
|
|
460
476
|
"hasDynamicHelp": false,
|
|
@@ -618,5 +634,5 @@
|
|
|
618
634
|
]
|
|
619
635
|
}
|
|
620
636
|
},
|
|
621
|
-
"version": "0.0.
|
|
637
|
+
"version": "0.0.23-beta.pr25.40"
|
|
622
638
|
}
|