@mailmodo/cli 0.0.52-beta.pr55.85 → 0.0.53
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.
|
@@ -2,7 +2,7 @@ import { Flags } from '@oclif/core';
|
|
|
2
2
|
import { confirm, input } from '@inquirer/prompts';
|
|
3
3
|
import chalk from 'chalk';
|
|
4
4
|
import { BaseCommand } from '../../lib/base-command.js';
|
|
5
|
-
import { API_ENDPOINTS, DEFAULT_BRAND_COLOR
|
|
5
|
+
import { API_ENDPOINTS, DEFAULT_BRAND_COLOR } from '../../lib/constants.js';
|
|
6
6
|
import { ERRORS, INFO, pauseAlready, pauseSuccess, PROMPTS, resumeAlready, resumeSuccess, SEPARATOR, } from '../../lib/messages.js';
|
|
7
7
|
import { loadTemplate, } from '../../lib/yaml-config.js';
|
|
8
8
|
export default class Deploy extends BaseCommand {
|
|
@@ -286,8 +286,8 @@ export default class Deploy extends BaseCommand {
|
|
|
286
286
|
this.log(` ${SEPARATOR}`);
|
|
287
287
|
this.log(` ${chalk.bold('ADD THIS TO YOUR APP (one-time only):')}`);
|
|
288
288
|
this.log(` ${SEPARATOR}\n`);
|
|
289
|
-
this.log(` ${chalk.cyan(sdkSnippet.install ??
|
|
290
|
-
this.log(` ${chalk.dim(
|
|
289
|
+
this.log(` ${chalk.cyan(sdkSnippet.install ?? 'npm install @mailmodo/sdk')}\n`);
|
|
290
|
+
this.log(` ${chalk.dim("import { track, identify } from '@mailmodo/sdk'")}\n`);
|
|
291
291
|
if (sdkSnippet.examples) {
|
|
292
292
|
this.log(` ${chalk.dim('// Example usage:')}`);
|
|
293
293
|
this.log(` ${chalk.dim(sdkSnippet.examples.track)}`);
|
package/dist/lib/constants.d.ts
CHANGED
|
@@ -26,7 +26,6 @@ export declare const API_ENDPOINTS: Readonly<{
|
|
|
26
26
|
PREVIEW: "/preview";
|
|
27
27
|
SEQUENCES: "/sequences";
|
|
28
28
|
SEQUENCES_DEPLOY: "/sequences/deploy";
|
|
29
|
-
SEQUENCES_SDK: "/sequences/sdk";
|
|
30
29
|
SEQUENCES_VALIDATE: "/sequences/validate";
|
|
31
30
|
}>;
|
|
32
31
|
export declare const LOGIN_URL = "https://app-vertex-debug.azurewebsites.net/signup.html";
|
|
@@ -34,6 +33,3 @@ export declare const PREVIEW_PORT = 3421;
|
|
|
34
33
|
export declare const DEFAULT_BRAND_COLOR = "#1A56DB";
|
|
35
34
|
export declare const TEMPLATES_DIR = "mailmodo";
|
|
36
35
|
export declare const YAML_FILE = "mailmodo.yaml";
|
|
37
|
-
export declare const SDK_PACKAGE_NAME = "@mailmodo/sdk";
|
|
38
|
-
export declare const SDK_INSTALL_COMMAND = "npm install @mailmodo/sdk";
|
|
39
|
-
export declare const SDK_IMPORT_SNIPPET = "import { track, identify } from '@mailmodo/sdk'";
|
package/dist/lib/constants.js
CHANGED
|
@@ -32,7 +32,6 @@ export const API_ENDPOINTS = Object.freeze({
|
|
|
32
32
|
PREVIEW: '/preview',
|
|
33
33
|
SEQUENCES: '/sequences',
|
|
34
34
|
SEQUENCES_DEPLOY: '/sequences/deploy',
|
|
35
|
-
SEQUENCES_SDK: '/sequences/sdk',
|
|
36
35
|
SEQUENCES_VALIDATE: '/sequences/validate',
|
|
37
36
|
});
|
|
38
37
|
const DEV_LOGIN_URL = 'https://app-vertex-debug.azurewebsites.net/signup.html';
|
|
@@ -45,6 +44,3 @@ export const PREVIEW_PORT = 3421;
|
|
|
45
44
|
export const DEFAULT_BRAND_COLOR = '#1A56DB';
|
|
46
45
|
export const TEMPLATES_DIR = 'mailmodo';
|
|
47
46
|
export const YAML_FILE = 'mailmodo.yaml';
|
|
48
|
-
export const SDK_PACKAGE_NAME = '@mailmodo/sdk';
|
|
49
|
-
export const SDK_INSTALL_COMMAND = `npm install ${SDK_PACKAGE_NAME}`;
|
|
50
|
-
export const SDK_IMPORT_SNIPPET = `import { track, identify } from '${SDK_PACKAGE_NAME}'`;
|
package/oclif.manifest.json
CHANGED
|
@@ -426,45 +426,6 @@
|
|
|
426
426
|
"index.js"
|
|
427
427
|
]
|
|
428
428
|
},
|
|
429
|
-
"login": {
|
|
430
|
-
"aliases": [],
|
|
431
|
-
"args": {},
|
|
432
|
-
"description": "Authenticate with Mailmodo using your API key",
|
|
433
|
-
"examples": [
|
|
434
|
-
"<%= config.bin %> login",
|
|
435
|
-
"MAILMODO_API_KEY=YOUR_API_KEY <%= config.bin %> login"
|
|
436
|
-
],
|
|
437
|
-
"flags": {
|
|
438
|
-
"json": {
|
|
439
|
-
"description": "Output as JSON",
|
|
440
|
-
"name": "json",
|
|
441
|
-
"allowNo": false,
|
|
442
|
-
"type": "boolean"
|
|
443
|
-
},
|
|
444
|
-
"yes": {
|
|
445
|
-
"char": "y",
|
|
446
|
-
"description": "Skip confirmation prompts",
|
|
447
|
-
"name": "yes",
|
|
448
|
-
"allowNo": false,
|
|
449
|
-
"type": "boolean"
|
|
450
|
-
}
|
|
451
|
-
},
|
|
452
|
-
"hasDynamicHelp": false,
|
|
453
|
-
"hiddenAliases": [],
|
|
454
|
-
"id": "login",
|
|
455
|
-
"pluginAlias": "@mailmodo/cli",
|
|
456
|
-
"pluginName": "@mailmodo/cli",
|
|
457
|
-
"pluginType": "core",
|
|
458
|
-
"strict": true,
|
|
459
|
-
"enableJsonFlag": false,
|
|
460
|
-
"isESM": true,
|
|
461
|
-
"relativePath": [
|
|
462
|
-
"dist",
|
|
463
|
-
"commands",
|
|
464
|
-
"login",
|
|
465
|
-
"index.js"
|
|
466
|
-
]
|
|
467
|
-
},
|
|
468
429
|
"logout": {
|
|
469
430
|
"aliases": [],
|
|
470
431
|
"args": {},
|
|
@@ -631,14 +592,13 @@
|
|
|
631
592
|
"index.js"
|
|
632
593
|
]
|
|
633
594
|
},
|
|
634
|
-
"
|
|
595
|
+
"login": {
|
|
635
596
|
"aliases": [],
|
|
636
597
|
"args": {},
|
|
637
|
-
"description": "
|
|
598
|
+
"description": "Authenticate with Mailmodo using your API key",
|
|
638
599
|
"examples": [
|
|
639
|
-
"<%= config.bin %>
|
|
640
|
-
"<%= config.bin %>
|
|
641
|
-
"<%= config.bin %> sdk --json"
|
|
600
|
+
"<%= config.bin %> login",
|
|
601
|
+
"MAILMODO_API_KEY=YOUR_API_KEY <%= config.bin %> login"
|
|
642
602
|
],
|
|
643
603
|
"flags": {
|
|
644
604
|
"json": {
|
|
@@ -653,18 +613,11 @@
|
|
|
653
613
|
"name": "yes",
|
|
654
614
|
"allowNo": false,
|
|
655
615
|
"type": "boolean"
|
|
656
|
-
},
|
|
657
|
-
"sequence-id": {
|
|
658
|
-
"description": "Limit output to a single active sequence by ID (default: all active sequences)",
|
|
659
|
-
"name": "sequence-id",
|
|
660
|
-
"hasDynamicHelp": false,
|
|
661
|
-
"multiple": false,
|
|
662
|
-
"type": "option"
|
|
663
616
|
}
|
|
664
617
|
},
|
|
665
618
|
"hasDynamicHelp": false,
|
|
666
619
|
"hiddenAliases": [],
|
|
667
|
-
"id": "
|
|
620
|
+
"id": "login",
|
|
668
621
|
"pluginAlias": "@mailmodo/cli",
|
|
669
622
|
"pluginName": "@mailmodo/cli",
|
|
670
623
|
"pluginType": "core",
|
|
@@ -674,7 +627,7 @@
|
|
|
674
627
|
"relativePath": [
|
|
675
628
|
"dist",
|
|
676
629
|
"commands",
|
|
677
|
-
"
|
|
630
|
+
"login",
|
|
678
631
|
"index.js"
|
|
679
632
|
]
|
|
680
633
|
},
|
|
@@ -765,5 +718,5 @@
|
|
|
765
718
|
]
|
|
766
719
|
}
|
|
767
720
|
},
|
|
768
|
-
"version": "0.0.
|
|
721
|
+
"version": "0.0.53"
|
|
769
722
|
}
|
package/package.json
CHANGED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { BaseCommand } from '../../lib/base-command.js';
|
|
2
|
-
export default class Sdk extends BaseCommand {
|
|
3
|
-
static description: string;
|
|
4
|
-
static examples: string[];
|
|
5
|
-
static flags: {
|
|
6
|
-
'sequence-id': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
7
|
-
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
8
|
-
yes: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
9
|
-
};
|
|
10
|
-
run(): Promise<void>;
|
|
11
|
-
private renderSnippets;
|
|
12
|
-
private renderSequenceBlock;
|
|
13
|
-
private renderCallBlock;
|
|
14
|
-
}
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import { Flags } from '@oclif/core';
|
|
2
|
-
import chalk from 'chalk';
|
|
3
|
-
import { BaseCommand } from '../../lib/base-command.js';
|
|
4
|
-
import { API_ENDPOINTS, SDK_IMPORT_SNIPPET, SDK_INSTALL_COMMAND, } from '../../lib/constants.js';
|
|
5
|
-
import { SEPARATOR } from '../../lib/messages.js';
|
|
6
|
-
export default class Sdk extends BaseCommand {
|
|
7
|
-
static description = 'Show the SDK track() / identify() reference for deployed sequences';
|
|
8
|
-
static examples = [
|
|
9
|
-
'<%= config.bin %> sdk',
|
|
10
|
-
'<%= config.bin %> sdk --sequence-id a1b2c3d4',
|
|
11
|
-
'<%= config.bin %> sdk --json',
|
|
12
|
-
];
|
|
13
|
-
static flags = {
|
|
14
|
-
...BaseCommand.baseFlags,
|
|
15
|
-
'sequence-id': Flags.string({
|
|
16
|
-
description: 'Limit output to a single active sequence by ID (default: all active sequences)',
|
|
17
|
-
}),
|
|
18
|
-
};
|
|
19
|
-
async run() {
|
|
20
|
-
const { flags } = await this.parse(Sdk);
|
|
21
|
-
await this.ensureAuth();
|
|
22
|
-
const params = flags['sequence-id']
|
|
23
|
-
? { sequenceId: flags['sequence-id'] }
|
|
24
|
-
: undefined;
|
|
25
|
-
const response = await this.withApiSpinner({ json: flags.json, text: ' Loading SDK reference...' }, () => this.apiClient.get(API_ENDPOINTS.SEQUENCES_SDK, params));
|
|
26
|
-
if (!response.ok) {
|
|
27
|
-
this.handleApiError(response);
|
|
28
|
-
}
|
|
29
|
-
if (flags.json) {
|
|
30
|
-
this.log(JSON.stringify(response.data, null, 2));
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
this.renderSnippets(response.data);
|
|
34
|
-
}
|
|
35
|
-
renderSnippets(data) {
|
|
36
|
-
const snippets = data.sdkSnippets ?? [];
|
|
37
|
-
if (snippets.length === 0) {
|
|
38
|
-
this.log(`\n ${chalk.dim('No active deployed sequences.')}`);
|
|
39
|
-
this.log(` Run ${chalk.cyan('mailmodo deploy')} to deploy one.\n`);
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
|
-
this.log(`\n ${chalk.bold(String(snippets.length))} active ${snippets.length === 1 ? 'sequence' : 'sequences'}:\n`);
|
|
43
|
-
this.log(` ${SEPARATOR}`);
|
|
44
|
-
this.log(` ${chalk.bold('SDK EVENT REFERENCE')}`);
|
|
45
|
-
this.log(` ${SEPARATOR}\n`);
|
|
46
|
-
this.log(` ${chalk.cyan(SDK_INSTALL_COMMAND)}\n`);
|
|
47
|
-
this.log(` ${chalk.dim(SDK_IMPORT_SNIPPET)}\n`);
|
|
48
|
-
for (const [index, snippet] of snippets.entries()) {
|
|
49
|
-
this.renderSequenceBlock(snippet);
|
|
50
|
-
if (index < snippets.length - 1)
|
|
51
|
-
this.log('');
|
|
52
|
-
}
|
|
53
|
-
this.log(` ${SEPARATOR}\n`);
|
|
54
|
-
}
|
|
55
|
-
renderSequenceBlock(snippet) {
|
|
56
|
-
const productName = snippet.productName || 'Unnamed sequence';
|
|
57
|
-
this.log(` ${chalk.bold(productName)} ${chalk.dim(`(${snippet.sequenceId})`)}`);
|
|
58
|
-
const trackCalls = [...new Set(snippet.sdkSnippet?.trackCalls ?? [])];
|
|
59
|
-
const identifyCalls = [...new Set(snippet.sdkSnippet?.identifyCalls ?? [])];
|
|
60
|
-
this.renderCallBlock('// track() calls', trackCalls);
|
|
61
|
-
this.renderCallBlock('// identify() calls', identifyCalls);
|
|
62
|
-
if (trackCalls.length === 0 && identifyCalls.length === 0) {
|
|
63
|
-
this.log(` ${chalk.dim('No track() or identify() calls available.')}`);
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
renderCallBlock(label, calls) {
|
|
67
|
-
if (calls.length === 0)
|
|
68
|
-
return;
|
|
69
|
-
this.log(` ${chalk.dim(label)}`);
|
|
70
|
-
for (const call of calls) {
|
|
71
|
-
this.log(` ${chalk.dim(call)}`);
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
}
|