proca 1.4.0 → 1.7.0

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/README.md CHANGED
@@ -8,53 +8,58 @@ Proca is an open-source campaign toolkit designed to empower activists and organ
8
8
 
9
9
  One of Proca's standout features is its robust support for coalition campaigns, allowing multiple organisations to collaborate seamlessly on shared initiatives. This coalition functionality enables partners to pool resources, amplify their collective voice, and reach a broader audience whilst maintaining individual branding and supporter relationships. By facilitating data sharing and joint campaign management, Proca helps coalitions to maximise their impact, streamline operations, and present a united front on critical issues, all whilst ensuring compliance with data protection regulations.
10
10
 
11
-
12
11
  ## usage
13
12
 
14
13
  ### global installation
15
- <!-- usage -->
14
+
15
+ if you have or plan to have multiple servers (eg. production and staging) or multiple users, you can setup multiple environments. each proca command support a --env <environment> param (optional, 'default' if not specified.
16
+
17
+ All the examples are using the default environment, add --env=staging if you need to access another server than your default one. By convention, we keep default for production.
18
+
16
19
  ```sh-session
17
20
  $ npm install -g proca
18
- $ proca COMMAND
19
- running command...
20
- $ proca (--version)
21
- proca/1.4.0 linux-x64 node-v20.12.2
22
- $ proca --help [COMMAND]
23
- USAGE
24
- $ proca COMMAND
25
- ...
21
+ $# if you don't have your API token, generate one
22
+ $ proca user reset --email <your_email> --passowrd <your password>
23
+ $ proca config init --token=<API-token>
26
24
  ```
27
- <!-- usagestop -->
25
+ you can set up the config folder the widget builder will use to store the caches. skip unless you want a different one than the default (your/widget/folder/config).
26
+
28
27
 
29
28
  ### local development
30
29
 
31
- ```sh-session
30
+ ````sh-session
32
31
  $ git clone https://github.com/fixthestatusquo/proca-cli.git
33
- $ git install
34
32
  $ cd proca-cli
35
- $./proca-cli --help
36
- ...
37
- ```
33
+ $ npm install
34
+ $ npm link # let the proca widget and other use the local version
35
+ $./proca-cli config add --env=local --url=http://localhost:4000/api
36
+ $./proca-cli config server --env=local #check if the config is working
37
+ $./proca-cli config user #check if the config is working
38
+ ````
39
+
40
+ you should also use the local proca-api in your [widget generator](https://github.com/fixthestatusquo/proca)
38
41
 
39
- ### TOPICS
40
- - campaign Handle campaigns
41
- - org
42
- - config create setting to access the server authentication
43
- - widget
44
- - supporters (counter)
42
+ ````sh-session
43
+ $ cd /your/path/to/proca
44
+ $ npm link proca # use the local proca-cli repo
45
+ ````
45
46
 
46
47
  # Commands
48
+
47
49
  <!-- commands -->
48
50
  * [`proca action add`](#proca-action-add)
49
51
  * [`proca action count`](#proca-action-count)
50
52
  * [`proca action list [TITLE]`](#proca-action-list-title)
51
53
  * [`proca action replay`](#proca-action-replay)
52
54
  * [`proca campaign add [TITLE]`](#proca-campaign-add-title)
53
- * [`proca campaign close [TITLE]`](#proca-campaign-close-title)
55
+ * [`proca campaign close`](#proca-campaign-close)
54
56
  * [`proca campaign delete`](#proca-campaign-delete)
55
57
  * [`proca campaign get`](#proca-campaign-get)
56
58
  * [`proca campaign list [TITLE]`](#proca-campaign-list-title)
59
+ * [`proca campaign mtt`](#proca-campaign-mtt)
60
+ * [`proca campaign status`](#proca-campaign-status)
57
61
  * [`proca config add [ENV] [HUMAN] [JSON] [CSV] [SIMPLIFY]`](#proca-config-add-env-human-json-csv-simplify)
62
+ * [`proca config folder`](#proca-config-folder)
58
63
  * [`proca config init [ENV] [HUMAN] [JSON] [CSV] [SIMPLIFY]`](#proca-config-init-env-human-json-csv-simplify)
59
64
  * [`proca config server`](#proca-config-server)
60
65
  * [`proca config set [KEY] [VALUE]`](#proca-config-set-key-value)
@@ -78,9 +83,12 @@ USAGE
78
83
  * [`proca plugins uninstall [PLUGIN]`](#proca-plugins-uninstall-plugin)
79
84
  * [`proca plugins unlink [PLUGIN]`](#proca-plugins-unlink-plugin)
80
85
  * [`proca plugins update`](#proca-plugins-update)
86
+ * [`proca target add`](#proca-target-add)
81
87
  * [`proca user get`](#proca-user-get)
82
88
  * [`proca user leave`](#proca-user-leave)
83
89
  * [`proca user list`](#proca-user-list)
90
+ * [`proca user reset [USER]`](#proca-user-reset-user)
91
+ * [`proca user whoami`](#proca-user-whoami)
84
92
  * [`proca widget add`](#proca-widget-add)
85
93
  * [`proca widget get`](#proca-widget-get)
86
94
  * [`proca widget list`](#proca-widget-list)
@@ -92,13 +100,14 @@ USAGE
92
100
  $ proca action add [ID_NAME_DXID...] -i <value> --firstname <value> --email <value>
93
101
  [--json | --human | --csv] [--env <value>] [--simplify] [-x <value>] [-n <the_short_name>] [--testing] [--optin]
94
102
  [--action_type <value>] [--lastname <value>] [--street <value>] [--locality <value>] [--region <value>] [--country
95
- <value>] [--utm <value>]
103
+ <value>] [--utm <value>] [--target <value>] [--subject <value>] [--body <value>]
96
104
 
97
105
  FLAGS
98
106
  -i, --id=<value> (required) widget's id
99
107
  -n, --name=<the_short_name> name
100
108
  -x, --dxid=<value> dxid
101
109
  --action_type=<value> [default: register]
110
+ --body=<value> [mtt] body of the email
102
111
  --country=<value> 2-letter country iso code
103
112
  --email=<value> (required) email
104
113
  --env=<value> [default: default] allow to switch between configurations (server or users)
@@ -108,6 +117,8 @@ FLAGS
108
117
  --optin
109
118
  --region=<value>
110
119
  --street=<value>
120
+ --subject=<value> [mtt] subject of the email
121
+ --target=<value> [mtt] uid of the target
111
122
  --testing
112
123
  --utm=<value> utm=campaign.source.medium
113
124
 
@@ -121,6 +132,8 @@ EXAMPLES
121
132
  $ proca action add -i <widget_id> --firstname=John --email=john@example.org
122
133
 
123
134
  $ proca action add -i <widget_id> --firstname=John --email=john@example.org --country=FR custom1=A custom2=B
135
+
136
+ $ proca action add -i <widget_id> --firstname=John --email=john@example.org target=715a9580-cfe6-4005-9e23-61a62ddecfea --subject='MTT subject' --body='message MTT'
124
137
  ```
125
138
 
126
139
  ## `proca action count`
@@ -234,22 +247,17 @@ EXAMPLES
234
247
  $ proca campaign add -n <new_campaign> the full name of the campaign
235
248
  ```
236
249
 
237
- ## `proca campaign close [TITLE]`
250
+ ## `proca campaign close`
238
251
 
239
252
  ```
240
253
  USAGE
241
- $ proca campaign close [TITLE] -n <campaign name> -o <org name> --status
242
- closed|ignored|live [--json | --human | --csv] [--env <value>] [--simplify]
243
-
244
- ARGUMENTS
245
- TITLE title of the campaign
254
+ $ proca campaign close [ID_NAME_DXID] --status draft|live|closed|ignored [--json |
255
+ --human | --csv] [--env <value>] [--simplify]
246
256
 
247
257
  FLAGS
248
- -n, --name=<campaign name> (required) name of the campaign
249
- -o, --org=<org name> (required) name of the coordinator
250
- --env=<value> [default: default] allow to switch between configurations (server or users)
251
- --status=<option> (required) [default: closed] status
252
- <options: closed|ignored|live>
258
+ --env=<value> [default: default] allow to switch between configurations (server or users)
259
+ --status=<option> (required) Status to set
260
+ <options: draft|live|closed|ignored>
253
261
 
254
262
  OUTPUT FLAGS
255
263
  --csv Format output as csv
@@ -257,8 +265,13 @@ OUTPUT FLAGS
257
265
  --json Format output as json
258
266
  --[no-]simplify flatten and filter to output only the most important attributes, mostly relevant for json
259
267
 
268
+ ALIASES
269
+ $ proca campaign close
270
+
260
271
  EXAMPLES
261
272
  $ proca campaign close -name <campaign>
273
+
274
+ $ proca campaign close -i <campaign_id>
262
275
  ```
263
276
 
264
277
  ## `proca campaign delete`
@@ -350,14 +363,76 @@ EXAMPLES
350
363
  $ proca campaign list %pizza%
351
364
  ```
352
365
 
366
+ ## `proca campaign mtt`
367
+
368
+ set the mail to target (mtt) params
369
+
370
+ ```
371
+ USAGE
372
+ $ proca campaign mtt [ID_NAME_DXID] --from <value> --to <value> [--json | --human |
373
+ --csv] [--env <value>] [--simplify] [-i <value> | -n <the_short_name> | -x <value>] [--template <value>] [--period
374
+ <value>] [--email <value>]
375
+
376
+ FLAGS
377
+ -i, --id=<value>
378
+ -n, --name=<the_short_name> name
379
+ -x, --dxid=<value> dxid
380
+ --email=<value> test email address
381
+ --env=<value> [default: default] allow to switch between configurations (server or users)
382
+ --from=<value> (required) start date (yyyy-mm-dd)
383
+ --period=<value> [default: 09:09-18:18] period of the day (HH:HH-HH:HH)
384
+ --template=<value> mtt template to use
385
+ --to=<value> (required) end date (yyyy-mm-dd)
386
+
387
+ OUTPUT FLAGS
388
+ --csv Format output as csv
389
+ --human Format output to be read on screen by a human [default]
390
+ --json Format output as json
391
+ --[no-]simplify flatten and filter to output only the most important attributes, mostly relevant for json
392
+
393
+ DESCRIPTION
394
+ set the mail to target (mtt) params
395
+
396
+ EXAMPLES
397
+ $ proca campaign mtt -n <test-mtt-campaign>
398
+ ```
399
+
400
+ ## `proca campaign status`
401
+
402
+ ```
403
+ USAGE
404
+ $ proca campaign status [ID_NAME_DXID] --status draft|live|closed|ignored [--json |
405
+ --human | --csv] [--env <value>] [--simplify]
406
+
407
+ FLAGS
408
+ --env=<value> [default: default] allow to switch between configurations (server or users)
409
+ --status=<option> (required) Status to set
410
+ <options: draft|live|closed|ignored>
411
+
412
+ OUTPUT FLAGS
413
+ --csv Format output as csv
414
+ --human Format output to be read on screen by a human [default]
415
+ --json Format output as json
416
+ --[no-]simplify flatten and filter to output only the most important attributes, mostly relevant for json
417
+
418
+ ALIASES
419
+ $ proca campaign close
420
+
421
+ EXAMPLES
422
+ $ proca campaign status -name <campaign>
423
+
424
+ $ proca campaign status -i <campaign_id>
425
+ ```
426
+
353
427
  ## `proca config add [ENV] [HUMAN] [JSON] [CSV] [SIMPLIFY]`
354
428
 
355
- create setting to access the server authentication
429
+ create setting to access to a server
356
430
 
357
431
  ```
358
432
  USAGE
359
- $ proca config add [ENV] [HUMAN] [JSON] [CSV] [SIMPLIFY] --token <API-token> [--json
360
- | --human | --csv] [--env <value>] [--simplify] [--force] [--url <url>]
433
+ $ proca config add [ENV] [HUMAN] [JSON] [CSV] [SIMPLIFY] [--json | --human | --csv]
434
+ [--env <value>] [--simplify] [--url http://localhost:4000] [--token API-token>] [--email you@example.org] [--folder
435
+ /var/www/proca/config.example]
361
436
 
362
437
  ARGUMENTS
363
438
  ENV [default: default] allow to switch between configurations (server or users)
@@ -367,10 +442,11 @@ ARGUMENTS
367
442
  SIMPLIFY flatten and filter to output only the most important attributes, mostly relevant for json
368
443
 
369
444
  FLAGS
370
- --env=<value> [default: default] allow to switch between configurations (server or users)
371
- --force write over an existing configuration
372
- --token=<API-token> (required) user token on proca server
373
- --url=<url> [default: https://api.proca.app/api] url of the proca server api
445
+ --email=you@example.org user email on proca server
446
+ --env=<value> [default: default] allow to switch between configurations (server or users)
447
+ --folder=/var/www/proca/config.example config folder (in the proca widget generator)
448
+ --token=API-token> user token on proca server
449
+ --url=http://localhost:4000 [default: https://api.proca.app/api] url of the proca server api
374
450
 
375
451
  OUTPUT FLAGS
376
452
  --csv Format output as csv
@@ -379,7 +455,7 @@ OUTPUT FLAGS
379
455
  --[no-]simplify flatten and filter to output only the most important attributes, mostly relevant for json
380
456
 
381
457
  DESCRIPTION
382
- create setting to access the server authentication
458
+ create setting to access to a server
383
459
 
384
460
  ALIASES
385
461
  $ proca config setup
@@ -389,14 +465,38 @@ EXAMPLES
389
465
  $ proca config add --user=xavier@example.org --token=API-12345789
390
466
  ```
391
467
 
468
+ ## `proca config folder`
469
+
470
+ Check and create config folders
471
+
472
+ ```
473
+ USAGE
474
+ $ proca config folder [--json | --human | --csv] [--env <value>] [--simplify]
475
+
476
+ FLAGS
477
+ --env=<value> [default: default] allow to switch between configurations (server or users)
478
+
479
+ OUTPUT FLAGS
480
+ --csv Format output as csv
481
+ --human Format output to be read on screen by a human [default]
482
+ --json Format output as json
483
+ --[no-]simplify flatten and filter to output only the most important attributes, mostly relevant for json
484
+
485
+ DESCRIPTION
486
+ Check and create config folders
487
+
488
+ Check if the PROCA_CONFIG_FOLDER is set up, if it is, check if the required subfolders exists and create if not
489
+ ```
490
+
392
491
  ## `proca config init [ENV] [HUMAN] [JSON] [CSV] [SIMPLIFY]`
393
492
 
394
- create setting to access the server authentication
493
+ create setting to access to a server
395
494
 
396
495
  ```
397
496
  USAGE
398
- $ proca config init [ENV] [HUMAN] [JSON] [CSV] [SIMPLIFY] --token <API-token> [--json
399
- | --human | --csv] [--env <value>] [--simplify] [--force] [--url <url>]
497
+ $ proca config init [ENV] [HUMAN] [JSON] [CSV] [SIMPLIFY] [--json | --human | --csv]
498
+ [--env <value>] [--simplify] [--url http://localhost:4000] [--token API-token>] [--email you@example.org] [--folder
499
+ /var/www/proca/config.example]
400
500
 
401
501
  ARGUMENTS
402
502
  ENV [default: default] allow to switch between configurations (server or users)
@@ -406,10 +506,11 @@ ARGUMENTS
406
506
  SIMPLIFY flatten and filter to output only the most important attributes, mostly relevant for json
407
507
 
408
508
  FLAGS
409
- --env=<value> [default: default] allow to switch between configurations (server or users)
410
- --force write over an existing configuration
411
- --token=<API-token> (required) user token on proca server
412
- --url=<url> [default: https://api.proca.app/api] url of the proca server api
509
+ --email=you@example.org user email on proca server
510
+ --env=<value> [default: default] allow to switch between configurations (server or users)
511
+ --folder=/var/www/proca/config.example config folder (in the proca widget generator)
512
+ --token=API-token> user token on proca server
513
+ --url=http://localhost:4000 [default: https://api.proca.app/api] url of the proca server api
413
514
 
414
515
  OUTPUT FLAGS
415
516
  --csv Format output as csv
@@ -418,7 +519,7 @@ OUTPUT FLAGS
418
519
  --[no-]simplify flatten and filter to output only the most important attributes, mostly relevant for json
419
520
 
420
521
  DESCRIPTION
421
- create setting to access the server authentication
522
+ create setting to access to a server
422
523
 
423
524
  ALIASES
424
525
  $ proca config setup
@@ -488,12 +589,13 @@ EXAMPLES
488
589
 
489
590
  ## `proca config setup [ENV] [HUMAN] [JSON] [CSV] [SIMPLIFY]`
490
591
 
491
- create setting to access the server authentication
592
+ create setting to access to a server
492
593
 
493
594
  ```
494
595
  USAGE
495
- $ proca config setup [ENV] [HUMAN] [JSON] [CSV] [SIMPLIFY] --token <API-token> [--json
496
- | --human | --csv] [--env <value>] [--simplify] [--force] [--url <url>]
596
+ $ proca config setup [ENV] [HUMAN] [JSON] [CSV] [SIMPLIFY] [--json | --human | --csv]
597
+ [--env <value>] [--simplify] [--url http://localhost:4000] [--token API-token>] [--email you@example.org] [--folder
598
+ /var/www/proca/config.example]
497
599
 
498
600
  ARGUMENTS
499
601
  ENV [default: default] allow to switch between configurations (server or users)
@@ -503,10 +605,11 @@ ARGUMENTS
503
605
  SIMPLIFY flatten and filter to output only the most important attributes, mostly relevant for json
504
606
 
505
607
  FLAGS
506
- --env=<value> [default: default] allow to switch between configurations (server or users)
507
- --force write over an existing configuration
508
- --token=<API-token> (required) user token on proca server
509
- --url=<url> [default: https://api.proca.app/api] url of the proca server api
608
+ --email=you@example.org user email on proca server
609
+ --env=<value> [default: default] allow to switch between configurations (server or users)
610
+ --folder=/var/www/proca/config.example config folder (in the proca widget generator)
611
+ --token=API-token> user token on proca server
612
+ --url=http://localhost:4000 [default: https://api.proca.app/api] url of the proca server api
510
613
 
511
614
  OUTPUT FLAGS
512
615
  --csv Format output as csv
@@ -515,7 +618,7 @@ OUTPUT FLAGS
515
618
  --[no-]simplify flatten and filter to output only the most important attributes, mostly relevant for json
516
619
 
517
620
  DESCRIPTION
518
- create setting to access the server authentication
621
+ create setting to access to a server
519
622
 
520
623
  ALIASES
521
624
  $ proca config setup
@@ -545,6 +648,9 @@ OUTPUT FLAGS
545
648
  DESCRIPTION
546
649
  fetch the information about the current user (based on the token)
547
650
 
651
+ ALIASES
652
+ $ proca user whoami
653
+
548
654
  EXAMPLES
549
655
  $ proca config user
550
656
  ```
@@ -638,12 +744,13 @@ _See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v6.2.2
638
744
  ```
639
745
  USAGE
640
746
  $ proca org add [--json | --human | --csv] [--env <value>] [--simplify] [--twitter
641
- <screen name>] [-n <org name>]
747
+ <screen name>] [-n <org acronym/name>] [-t <org full name>]
642
748
 
643
749
  FLAGS
644
- -n, --name=<org name> name of the org
645
- --env=<value> [default: default] allow to switch between configurations (server or users)
646
- --twitter=<screen name> twitter account
750
+ -n, --name=<org acronym/name> short name of the org
751
+ -t, --title=<org full name> title/full name of the org
752
+ --env=<value> [default: default] allow to switch between configurations (server or users)
753
+ --twitter=<screen name> twitter account
647
754
 
648
755
  OUTPUT FLAGS
649
756
  --csv Format output as csv
@@ -652,6 +759,8 @@ OUTPUT FLAGS
652
759
  --[no-]simplify flatten and filter to output only the most important attributes, mostly relevant for json
653
760
 
654
761
  EXAMPLES
762
+ $ proca org add --name <twitter of the organisation> --title='this is an organisation'
763
+
655
764
  $ proca org add --twitter <twitter of the organisation>
656
765
  ```
657
766
 
@@ -709,7 +818,7 @@ view a org
709
818
  ```
710
819
  USAGE
711
820
  $ proca org get [ID_NAME_DXID] [--json | --human | --csv] [--env <value>]
712
- [--simplify] [-n <org name>] [--config] [--keys] [--campaigns] [--widgets] [--users]
821
+ [--simplify] [-n <org name>] [--config] [--keys] [--campaigns] [--users]
713
822
 
714
823
  FLAGS
715
824
  -n, --name=<org name> name of the org
@@ -718,7 +827,6 @@ FLAGS
718
827
  --env=<value> [default: default] allow to switch between configurations (server or users)
719
828
  --[no-]keys
720
829
  --[no-]users
721
- --[no-]widgets
722
830
 
723
831
  OUTPUT FLAGS
724
832
  --csv Format output as csv
@@ -1052,6 +1160,27 @@ DESCRIPTION
1052
1160
 
1053
1161
  _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.25/src/commands/plugins/update.ts)_
1054
1162
 
1163
+ ## `proca target add`
1164
+
1165
+ ```
1166
+ USAGE
1167
+ $ proca target add -c <value> --name <value> --email <value> [--json | --human |
1168
+ --csv] [--env <value>] [--simplify] [--external_id <value>]
1169
+
1170
+ FLAGS
1171
+ -c, --campaign=<value> (required) mtt campaign to add the target
1172
+ --email=<value> (required) email of the target
1173
+ --env=<value> [default: default] allow to switch between configurations (server or users)
1174
+ --external_id=<value> external id of the target
1175
+ --name=<value> (required) name of the target
1176
+
1177
+ OUTPUT FLAGS
1178
+ --csv Format output as csv
1179
+ --human Format output to be read on screen by a human [default]
1180
+ --json Format output as json
1181
+ --[no-]simplify flatten and filter to output only the most important attributes, mostly relevant for json
1182
+ ```
1183
+
1055
1184
  ## `proca user get`
1056
1185
 
1057
1186
  fetch the information about a user
@@ -1133,6 +1262,60 @@ EXAMPLES
1133
1262
  $ proca user list %pizza%
1134
1263
  ```
1135
1264
 
1265
+ ## `proca user reset [USER]`
1266
+
1267
+ Reset user API token
1268
+
1269
+ ```
1270
+ USAGE
1271
+ $ proca user reset [USER] [--json | --human | --csv] [--env <value>] [--simplify]
1272
+ [--password <value>] [--url <value>]
1273
+
1274
+ ARGUMENTS
1275
+ USER Username (email)
1276
+
1277
+ FLAGS
1278
+ --env=<value> [default: default] allow to switch between configurations (server or users)
1279
+ --password=<value> Password
1280
+ --url=<value> URL of the Proca server API
1281
+
1282
+ OUTPUT FLAGS
1283
+ --csv Format output as csv
1284
+ --human Format output to be read on screen by a human [default]
1285
+ --json Format output as json
1286
+ --[no-]simplify flatten and filter to output only the most important attributes, mostly relevant for json
1287
+
1288
+ DESCRIPTION
1289
+ Reset user API token
1290
+ ```
1291
+
1292
+ ## `proca user whoami`
1293
+
1294
+ fetch the information about the current user (based on the token)
1295
+
1296
+ ```
1297
+ USAGE
1298
+ $ proca user whoami [--json | --human | --csv] [--env <value>] [--simplify]
1299
+
1300
+ FLAGS
1301
+ --env=<value> [default: default] allow to switch between configurations (server or users)
1302
+
1303
+ OUTPUT FLAGS
1304
+ --csv Format output as csv
1305
+ --human Format output to be read on screen by a human [default]
1306
+ --json Format output as json
1307
+ --[no-]simplify flatten and filter to output only the most important attributes, mostly relevant for json
1308
+
1309
+ DESCRIPTION
1310
+ fetch the information about the current user (based on the token)
1311
+
1312
+ ALIASES
1313
+ $ proca user whoami
1314
+
1315
+ EXAMPLES
1316
+ $ proca user whoami
1317
+ ```
1318
+
1136
1319
  ## `proca widget add`
1137
1320
 
1138
1321
  ```
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "proca",
3
3
  "description": "Access the proca api",
4
- "version": "1.4.0",
4
+ "version": "1.7.0",
5
5
  "author": "Xavier",
6
6
  "bin": {
7
7
  "proca": "proca-cli"
@@ -19,7 +19,8 @@
19
19
  "fast-csv": "^5.0.1",
20
20
  "graphql": "^16.10.0",
21
21
  "typescript": "^5.7.3",
22
- "urql": "^4.1.0"
22
+ "urql": "^4.1.0",
23
+ "prompts": "^2.4.2"
23
24
  },
24
25
  "devDependencies": {
25
26
  "@biomejs/biome": "^1.9.3",
@@ -9,6 +9,7 @@ export default class ActionAdd extends Command {
9
9
  static examples = [
10
10
  "<%= config.bin %> <%= command.id %> -i <widget_id> --firstname=John --email=john@example.org",
11
11
  "<%= config.bin %> <%= command.id %> -i <widget_id> --firstname=John --email=john@example.org --country=FR custom1=A custom2=B",
12
+ "<%= config.bin %> <%= command.id %> -i <widget_id> --firstname=John --email=john@example.org target=715a9580-cfe6-4005-9e23-61a62ddecfea --subject='MTT subject' --body='message MTT'",
12
13
  ];
13
14
 
14
15
  static args = this.multiid();
@@ -50,6 +51,9 @@ export default class ActionAdd extends Command {
50
51
  description: "email",
51
52
  required: true,
52
53
  }),
54
+ target: Flags.string({ description: "[mtt] uid of the target" }),
55
+ subject: Flags.string({ description: "[mtt] subject of the email" }),
56
+ body: Flags.string({ description: "[mtt] body of the email" }),
53
57
  };
54
58
 
55
59
  create = async (flags) => {
@@ -95,6 +99,16 @@ export default class ActionAdd extends Command {
95
99
  },
96
100
  };
97
101
 
102
+ if (flags.target) {
103
+ values.action.mtt = {
104
+ targets: [flags.target],
105
+ subject: flags.subject || "Test MTT",
106
+ body: flags.body || "Please ignore, this is a test",
107
+ };
108
+ values.action.actionType = "mail2target";
109
+ }
110
+ console.log(values.action.mtt);
111
+
98
112
  const query = gql`
99
113
  mutation (
100
114
  $action: ActionInput!
@@ -2,6 +2,7 @@ import { Args, Flags } from "@oclif/core";
2
2
  import { error, stdout, ux } from "@oclif/core/ux";
3
3
  import Command from "#src/procaCommand.mjs";
4
4
  import {
5
+ FragmentMtt,
5
6
  FragmentOrg,
6
7
  FragmentStats,
7
8
  FragmentSummary,
@@ -43,11 +44,13 @@ export default class CampaignGet extends Command {
43
44
  ...Org
44
45
  config
45
46
  ...Stats @include(if: $withStats)
47
+ ...Mtt
46
48
  }
47
49
  }
48
50
  ${FragmentStats}
49
51
  ${FragmentSummary}
50
52
  ${FragmentOrg}
53
+ ${FragmentMtt}
51
54
  `;
52
55
  const result = await query(GetCampaignDocument, {
53
56
  id: id,
@@ -67,6 +70,20 @@ export default class CampaignGet extends Command {
67
70
  locales: d.config.locales && Object.keys(d.config.locales).join(" "),
68
71
  journey: d.config.journey?.join(" → "),
69
72
  };
73
+ if (d.mtt) {
74
+ // we have an mtt
75
+ const hhmm = (date) =>
76
+ new Date(date).toLocaleTimeString(undefined, {
77
+ hour: "2-digit",
78
+ minute: "2-digit",
79
+ hour12: false,
80
+ });
81
+ result.from = d.mtt.startAt.substring(0, 10);
82
+ result.to = d.mtt.endAt.substring(0, 10);
83
+ result.period = `${hhmm(d.mtt.startAt)}↔${hhmm(d.mtt.endAt)}`;
84
+ result["test email"] = d.mtt.testEmail;
85
+ result["mtt template"] = d.mtt.template;
86
+ }
70
87
  if (this.flags.stats) {
71
88
  result["#Supporters"] = d.stats.supporterCount;
72
89