@mailmodo/cli 0.0.51-beta.pr53.84 → 0.0.51
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
|
@@ -289,19 +289,13 @@
|
|
|
289
289
|
"index.js"
|
|
290
290
|
]
|
|
291
291
|
},
|
|
292
|
-
"
|
|
292
|
+
"emails": {
|
|
293
293
|
"aliases": [],
|
|
294
|
-
"args": {
|
|
295
|
-
|
|
296
|
-
"description": "Email template ID to edit",
|
|
297
|
-
"name": "id",
|
|
298
|
-
"required": true
|
|
299
|
-
}
|
|
300
|
-
},
|
|
301
|
-
"description": "Edit an email using AI-assisted natural language changes",
|
|
294
|
+
"args": {},
|
|
295
|
+
"description": "List and view configured email sequences",
|
|
302
296
|
"examples": [
|
|
303
|
-
"<%= config.bin %>
|
|
304
|
-
"<%= config.bin %>
|
|
297
|
+
"<%= config.bin %> emails",
|
|
298
|
+
"<%= config.bin %> emails --json"
|
|
305
299
|
],
|
|
306
300
|
"flags": {
|
|
307
301
|
"json": {
|
|
@@ -316,18 +310,11 @@
|
|
|
316
310
|
"name": "yes",
|
|
317
311
|
"allowNo": false,
|
|
318
312
|
"type": "boolean"
|
|
319
|
-
},
|
|
320
|
-
"change": {
|
|
321
|
-
"description": "Natural language description of the change",
|
|
322
|
-
"name": "change",
|
|
323
|
-
"hasDynamicHelp": false,
|
|
324
|
-
"multiple": false,
|
|
325
|
-
"type": "option"
|
|
326
313
|
}
|
|
327
314
|
},
|
|
328
315
|
"hasDynamicHelp": false,
|
|
329
316
|
"hiddenAliases": [],
|
|
330
|
-
"id": "
|
|
317
|
+
"id": "emails",
|
|
331
318
|
"pluginAlias": "@mailmodo/cli",
|
|
332
319
|
"pluginName": "@mailmodo/cli",
|
|
333
320
|
"pluginType": "core",
|
|
@@ -337,17 +324,23 @@
|
|
|
337
324
|
"relativePath": [
|
|
338
325
|
"dist",
|
|
339
326
|
"commands",
|
|
340
|
-
"
|
|
327
|
+
"emails",
|
|
341
328
|
"index.js"
|
|
342
329
|
]
|
|
343
330
|
},
|
|
344
|
-
"
|
|
331
|
+
"edit": {
|
|
345
332
|
"aliases": [],
|
|
346
|
-
"args": {
|
|
347
|
-
|
|
333
|
+
"args": {
|
|
334
|
+
"id": {
|
|
335
|
+
"description": "Email template ID to edit",
|
|
336
|
+
"name": "id",
|
|
337
|
+
"required": true
|
|
338
|
+
}
|
|
339
|
+
},
|
|
340
|
+
"description": "Edit an email using AI-assisted natural language changes",
|
|
348
341
|
"examples": [
|
|
349
|
-
"<%= config.bin %>
|
|
350
|
-
"<%= config.bin %>
|
|
342
|
+
"<%= config.bin %> edit welcome",
|
|
343
|
+
"<%= config.bin %> edit welcome --change \"make subject more urgent\" --yes"
|
|
351
344
|
],
|
|
352
345
|
"flags": {
|
|
353
346
|
"json": {
|
|
@@ -362,11 +355,18 @@
|
|
|
362
355
|
"name": "yes",
|
|
363
356
|
"allowNo": false,
|
|
364
357
|
"type": "boolean"
|
|
358
|
+
},
|
|
359
|
+
"change": {
|
|
360
|
+
"description": "Natural language description of the change",
|
|
361
|
+
"name": "change",
|
|
362
|
+
"hasDynamicHelp": false,
|
|
363
|
+
"multiple": false,
|
|
364
|
+
"type": "option"
|
|
365
365
|
}
|
|
366
366
|
},
|
|
367
367
|
"hasDynamicHelp": false,
|
|
368
368
|
"hiddenAliases": [],
|
|
369
|
-
"id": "
|
|
369
|
+
"id": "edit",
|
|
370
370
|
"pluginAlias": "@mailmodo/cli",
|
|
371
371
|
"pluginName": "@mailmodo/cli",
|
|
372
372
|
"pluginType": "core",
|
|
@@ -376,7 +376,7 @@
|
|
|
376
376
|
"relativePath": [
|
|
377
377
|
"dist",
|
|
378
378
|
"commands",
|
|
379
|
-
"
|
|
379
|
+
"edit",
|
|
380
380
|
"index.js"
|
|
381
381
|
]
|
|
382
382
|
},
|
|
@@ -503,19 +503,15 @@
|
|
|
503
503
|
"index.js"
|
|
504
504
|
]
|
|
505
505
|
},
|
|
506
|
-
"
|
|
506
|
+
"logs": {
|
|
507
507
|
"aliases": [],
|
|
508
|
-
"args": {
|
|
509
|
-
|
|
510
|
-
"description": "Email template ID to preview",
|
|
511
|
-
"name": "id"
|
|
512
|
-
}
|
|
513
|
-
},
|
|
514
|
-
"description": "Preview an email in browser, as text, or send a test",
|
|
508
|
+
"args": {},
|
|
509
|
+
"description": "View email send logs and delivery events",
|
|
515
510
|
"examples": [
|
|
516
|
-
"<%= config.bin %>
|
|
517
|
-
"<%= config.bin %>
|
|
518
|
-
"<%= config.bin %>
|
|
511
|
+
"<%= config.bin %> logs",
|
|
512
|
+
"<%= config.bin %> logs --email sarah@example.com",
|
|
513
|
+
"<%= config.bin %> logs --failed",
|
|
514
|
+
"<%= config.bin %> logs --json"
|
|
519
515
|
],
|
|
520
516
|
"flags": {
|
|
521
517
|
"json": {
|
|
@@ -531,62 +527,31 @@
|
|
|
531
527
|
"allowNo": false,
|
|
532
528
|
"type": "boolean"
|
|
533
529
|
},
|
|
534
|
-
"
|
|
535
|
-
"description": "
|
|
536
|
-
"name": "
|
|
530
|
+
"email": {
|
|
531
|
+
"description": "Filter logs by contact email",
|
|
532
|
+
"name": "email",
|
|
537
533
|
"hasDynamicHelp": false,
|
|
538
534
|
"multiple": false,
|
|
539
535
|
"type": "option"
|
|
540
536
|
},
|
|
541
|
-
"
|
|
542
|
-
"description": "
|
|
543
|
-
"name": "
|
|
544
|
-
"allowNo": false,
|
|
545
|
-
"type": "boolean"
|
|
546
|
-
}
|
|
547
|
-
},
|
|
548
|
-
"hasDynamicHelp": false,
|
|
549
|
-
"hiddenAliases": [],
|
|
550
|
-
"id": "preview",
|
|
551
|
-
"pluginAlias": "@mailmodo/cli",
|
|
552
|
-
"pluginName": "@mailmodo/cli",
|
|
553
|
-
"pluginType": "core",
|
|
554
|
-
"strict": true,
|
|
555
|
-
"enableJsonFlag": false,
|
|
556
|
-
"isESM": true,
|
|
557
|
-
"relativePath": [
|
|
558
|
-
"dist",
|
|
559
|
-
"commands",
|
|
560
|
-
"preview",
|
|
561
|
-
"index.js"
|
|
562
|
-
]
|
|
563
|
-
},
|
|
564
|
-
"sdk": {
|
|
565
|
-
"aliases": [],
|
|
566
|
-
"args": {},
|
|
567
|
-
"description": "Show the SDK track() / identify() reference for deployed sequences",
|
|
568
|
-
"examples": [
|
|
569
|
-
"<%= config.bin %> sdk",
|
|
570
|
-
"<%= config.bin %> sdk --sequence-id a1b2c3d4",
|
|
571
|
-
"<%= config.bin %> sdk --json"
|
|
572
|
-
],
|
|
573
|
-
"flags": {
|
|
574
|
-
"json": {
|
|
575
|
-
"description": "Output as JSON",
|
|
576
|
-
"name": "json",
|
|
537
|
+
"failed": {
|
|
538
|
+
"description": "Show only failed/bounced events",
|
|
539
|
+
"name": "failed",
|
|
577
540
|
"allowNo": false,
|
|
578
541
|
"type": "boolean"
|
|
579
542
|
},
|
|
580
|
-
"
|
|
581
|
-
"
|
|
582
|
-
"
|
|
583
|
-
"
|
|
584
|
-
"
|
|
585
|
-
"
|
|
543
|
+
"limit": {
|
|
544
|
+
"description": "Entries per page (max 200)",
|
|
545
|
+
"name": "limit",
|
|
546
|
+
"default": 50,
|
|
547
|
+
"hasDynamicHelp": false,
|
|
548
|
+
"multiple": false,
|
|
549
|
+
"type": "option"
|
|
586
550
|
},
|
|
587
|
-
"
|
|
588
|
-
"description": "
|
|
589
|
-
"name": "
|
|
551
|
+
"page": {
|
|
552
|
+
"description": "Page number",
|
|
553
|
+
"name": "page",
|
|
554
|
+
"default": 1,
|
|
590
555
|
"hasDynamicHelp": false,
|
|
591
556
|
"multiple": false,
|
|
592
557
|
"type": "option"
|
|
@@ -594,7 +559,7 @@
|
|
|
594
559
|
},
|
|
595
560
|
"hasDynamicHelp": false,
|
|
596
561
|
"hiddenAliases": [],
|
|
597
|
-
"id": "
|
|
562
|
+
"id": "logs",
|
|
598
563
|
"pluginAlias": "@mailmodo/cli",
|
|
599
564
|
"pluginName": "@mailmodo/cli",
|
|
600
565
|
"pluginType": "core",
|
|
@@ -604,18 +569,23 @@
|
|
|
604
569
|
"relativePath": [
|
|
605
570
|
"dist",
|
|
606
571
|
"commands",
|
|
607
|
-
"
|
|
572
|
+
"logs",
|
|
608
573
|
"index.js"
|
|
609
574
|
]
|
|
610
575
|
},
|
|
611
|
-
"
|
|
576
|
+
"preview": {
|
|
612
577
|
"aliases": [],
|
|
613
|
-
"args": {
|
|
614
|
-
|
|
578
|
+
"args": {
|
|
579
|
+
"id": {
|
|
580
|
+
"description": "Email template ID to preview",
|
|
581
|
+
"name": "id"
|
|
582
|
+
}
|
|
583
|
+
},
|
|
584
|
+
"description": "Preview an email in browser, as text, or send a test",
|
|
615
585
|
"examples": [
|
|
616
|
-
"<%= config.bin %>
|
|
617
|
-
"<%= config.bin %>
|
|
618
|
-
"<%= config.bin %>
|
|
586
|
+
"<%= config.bin %> preview welcome",
|
|
587
|
+
"<%= config.bin %> preview welcome --text",
|
|
588
|
+
"<%= config.bin %> preview welcome --send me@example.com"
|
|
619
589
|
],
|
|
620
590
|
"flags": {
|
|
621
591
|
"json": {
|
|
@@ -631,17 +601,23 @@
|
|
|
631
601
|
"allowNo": false,
|
|
632
602
|
"type": "boolean"
|
|
633
603
|
},
|
|
634
|
-
"
|
|
635
|
-
"description": "
|
|
636
|
-
"name": "
|
|
604
|
+
"send": {
|
|
605
|
+
"description": "Send test email to this address",
|
|
606
|
+
"name": "send",
|
|
637
607
|
"hasDynamicHelp": false,
|
|
638
608
|
"multiple": false,
|
|
639
609
|
"type": "option"
|
|
610
|
+
},
|
|
611
|
+
"text": {
|
|
612
|
+
"description": "Output plain text version (for AI agents)",
|
|
613
|
+
"name": "text",
|
|
614
|
+
"allowNo": false,
|
|
615
|
+
"type": "boolean"
|
|
640
616
|
}
|
|
641
617
|
},
|
|
642
618
|
"hasDynamicHelp": false,
|
|
643
619
|
"hiddenAliases": [],
|
|
644
|
-
"id": "
|
|
620
|
+
"id": "preview",
|
|
645
621
|
"pluginAlias": "@mailmodo/cli",
|
|
646
622
|
"pluginName": "@mailmodo/cli",
|
|
647
623
|
"pluginType": "core",
|
|
@@ -651,7 +627,7 @@
|
|
|
651
627
|
"relativePath": [
|
|
652
628
|
"dist",
|
|
653
629
|
"commands",
|
|
654
|
-
"
|
|
630
|
+
"preview",
|
|
655
631
|
"index.js"
|
|
656
632
|
]
|
|
657
633
|
},
|
|
@@ -694,15 +670,14 @@
|
|
|
694
670
|
"index.js"
|
|
695
671
|
]
|
|
696
672
|
},
|
|
697
|
-
"
|
|
673
|
+
"settings": {
|
|
698
674
|
"aliases": [],
|
|
699
675
|
"args": {},
|
|
700
|
-
"description": "View
|
|
676
|
+
"description": "View and update project settings",
|
|
701
677
|
"examples": [
|
|
702
|
-
"<%= config.bin %>
|
|
703
|
-
"<%= config.bin %>
|
|
704
|
-
"<%= config.bin %>
|
|
705
|
-
"<%= config.bin %> logs --json"
|
|
678
|
+
"<%= config.bin %> settings",
|
|
679
|
+
"<%= config.bin %> settings --set brand_color=#0F3460",
|
|
680
|
+
"<%= config.bin %> settings --json"
|
|
706
681
|
],
|
|
707
682
|
"flags": {
|
|
708
683
|
"json": {
|
|
@@ -718,31 +693,9 @@
|
|
|
718
693
|
"allowNo": false,
|
|
719
694
|
"type": "boolean"
|
|
720
695
|
},
|
|
721
|
-
"
|
|
722
|
-
"description": "
|
|
723
|
-
"name": "
|
|
724
|
-
"hasDynamicHelp": false,
|
|
725
|
-
"multiple": false,
|
|
726
|
-
"type": "option"
|
|
727
|
-
},
|
|
728
|
-
"failed": {
|
|
729
|
-
"description": "Show only failed/bounced events",
|
|
730
|
-
"name": "failed",
|
|
731
|
-
"allowNo": false,
|
|
732
|
-
"type": "boolean"
|
|
733
|
-
},
|
|
734
|
-
"limit": {
|
|
735
|
-
"description": "Entries per page (max 200)",
|
|
736
|
-
"name": "limit",
|
|
737
|
-
"default": 50,
|
|
738
|
-
"hasDynamicHelp": false,
|
|
739
|
-
"multiple": false,
|
|
740
|
-
"type": "option"
|
|
741
|
-
},
|
|
742
|
-
"page": {
|
|
743
|
-
"description": "Page number",
|
|
744
|
-
"name": "page",
|
|
745
|
-
"default": 1,
|
|
696
|
+
"set": {
|
|
697
|
+
"description": "Set a setting (format: key=value)",
|
|
698
|
+
"name": "set",
|
|
746
699
|
"hasDynamicHelp": false,
|
|
747
700
|
"multiple": false,
|
|
748
701
|
"type": "option"
|
|
@@ -750,7 +703,7 @@
|
|
|
750
703
|
},
|
|
751
704
|
"hasDynamicHelp": false,
|
|
752
705
|
"hiddenAliases": [],
|
|
753
|
-
"id": "
|
|
706
|
+
"id": "settings",
|
|
754
707
|
"pluginAlias": "@mailmodo/cli",
|
|
755
708
|
"pluginName": "@mailmodo/cli",
|
|
756
709
|
"pluginType": "core",
|
|
@@ -760,10 +713,10 @@
|
|
|
760
713
|
"relativePath": [
|
|
761
714
|
"dist",
|
|
762
715
|
"commands",
|
|
763
|
-
"
|
|
716
|
+
"settings",
|
|
764
717
|
"index.js"
|
|
765
718
|
]
|
|
766
719
|
}
|
|
767
720
|
},
|
|
768
|
-
"version": "0.0.51
|
|
721
|
+
"version": "0.0.51"
|
|
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
|
-
}
|