@periskope/types 0.6.13-7.3 → 0.6.13-7.4
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/rules.types.d.ts +19 -2
- package/dist/rules.types.js +79 -32
- package/package.json +1 -1
- package/rules.types.ts +102 -35
package/dist/rules.types.d.ts
CHANGED
|
@@ -121,6 +121,7 @@ export interface Conditions {
|
|
|
121
121
|
condition: 'allOf' | 'anyOf' | 'noneOf';
|
|
122
122
|
variables: string[];
|
|
123
123
|
delay: `${number} ${'seconds' | 'minutes' | 'hours' | 'days'}`;
|
|
124
|
+
org_phones: string[];
|
|
124
125
|
}
|
|
125
126
|
export type SendMessageAction = {
|
|
126
127
|
id: string;
|
|
@@ -218,16 +219,32 @@ export type SendEmailAction = {
|
|
|
218
219
|
body: string;
|
|
219
220
|
};
|
|
220
221
|
};
|
|
221
|
-
export type
|
|
222
|
+
export type ReplyToMessage = {
|
|
223
|
+
id: string;
|
|
224
|
+
type: 'reply_to_message';
|
|
225
|
+
delay: `${number} ${'seconds' | 'minutes' | 'hours' | 'days'}`;
|
|
226
|
+
metadata: {
|
|
227
|
+
message: string;
|
|
228
|
+
media?: {
|
|
229
|
+
url: string;
|
|
230
|
+
type: 'image' | 'video' | 'audio' | 'document';
|
|
231
|
+
name: string;
|
|
232
|
+
};
|
|
233
|
+
};
|
|
234
|
+
};
|
|
235
|
+
export type Action = SendMessageAction | NotifyHttpAction | CreateTicketAction | FlagMessageAction | AssignTicketAction | CloseTicketAction | AddChatLabelAction | AddTicketLabelAction | AssignChatAction | ForwardMessageAction | SendEmailAction | ReplyToMessage;
|
|
222
236
|
export declare const isSendMessageAction: (action: Action) => action is SendMessageAction;
|
|
223
237
|
export type Rule = OverrideProperties<Tables<'tbl_automation_rules'>, {
|
|
224
238
|
actions: Action[];
|
|
225
239
|
conditions: Conditions;
|
|
226
|
-
trigger: 'message.created' | 'message.updated' | 'chat.created' | 'ticket.updated' | 'ticket.created' | 'reaction.
|
|
240
|
+
trigger: 'message.created' | 'message.updated' | 'chat.created' | 'ticket.updated' | 'ticket.created' | 'reaction.added' | 'chat.label.updated' | 'message.flagged';
|
|
227
241
|
}>;
|
|
228
242
|
export declare const RuleNameMap: Record<Rule['trigger'], {
|
|
229
243
|
title: string;
|
|
230
244
|
description: string;
|
|
245
|
+
base_conditions: {
|
|
246
|
+
org_phone: boolean;
|
|
247
|
+
};
|
|
231
248
|
}>;
|
|
232
249
|
export declare const ActionNameMap: Record<Action['type'], {
|
|
233
250
|
title: string;
|
package/dist/rules.types.js
CHANGED
|
@@ -171,7 +171,7 @@ exports.ChatVariableNameMap = {
|
|
|
171
171
|
text: 'Chat Labels',
|
|
172
172
|
type: 'dropdown',
|
|
173
173
|
value: 'org.labels',
|
|
174
|
-
filters: ['
|
|
174
|
+
filters: ['CONTAINS', 'NCONTAINS'],
|
|
175
175
|
},
|
|
176
176
|
};
|
|
177
177
|
exports.TicketVariableNameMap = {
|
|
@@ -270,32 +270,60 @@ const isSendMessageAction = (action) => {
|
|
|
270
270
|
exports.isSendMessageAction = isSendMessageAction;
|
|
271
271
|
exports.RuleNameMap = {
|
|
272
272
|
'message.created': {
|
|
273
|
-
title: 'New Message
|
|
273
|
+
title: 'New Message Received',
|
|
274
274
|
description: 'When a new message is sent or received',
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
description: 'When a message is updated',
|
|
275
|
+
base_conditions: {
|
|
276
|
+
org_phone: true,
|
|
277
|
+
},
|
|
279
278
|
},
|
|
280
279
|
'chat.created': {
|
|
281
280
|
title: 'New Chat Created',
|
|
282
281
|
description: 'When a new chat is created',
|
|
282
|
+
base_conditions: {
|
|
283
|
+
org_phone: true,
|
|
284
|
+
},
|
|
283
285
|
},
|
|
284
286
|
'ticket.created': {
|
|
285
287
|
title: 'New Ticket Created',
|
|
286
288
|
description: 'When a new ticket is created',
|
|
289
|
+
base_conditions: {
|
|
290
|
+
org_phone: false,
|
|
291
|
+
},
|
|
292
|
+
},
|
|
293
|
+
'reaction.added': {
|
|
294
|
+
title: 'New Reaction Added',
|
|
295
|
+
description: 'When a reaction is added on a message',
|
|
296
|
+
base_conditions: {
|
|
297
|
+
org_phone: true,
|
|
298
|
+
},
|
|
299
|
+
},
|
|
300
|
+
'message.updated': {
|
|
301
|
+
title: 'Message Updated',
|
|
302
|
+
description: 'When a message is updated',
|
|
303
|
+
base_conditions: {
|
|
304
|
+
org_phone: true,
|
|
305
|
+
},
|
|
287
306
|
},
|
|
288
307
|
'ticket.updated': {
|
|
289
308
|
title: 'Ticket Updated',
|
|
290
309
|
description: 'When a ticket is updated',
|
|
310
|
+
base_conditions: {
|
|
311
|
+
org_phone: false,
|
|
312
|
+
},
|
|
291
313
|
},
|
|
292
|
-
'
|
|
293
|
-
title: '
|
|
294
|
-
description: 'When
|
|
314
|
+
'chat.label.updated': {
|
|
315
|
+
title: 'Chat Label Added/Removed',
|
|
316
|
+
description: 'When labels on chats are updated',
|
|
317
|
+
base_conditions: {
|
|
318
|
+
org_phone: false,
|
|
319
|
+
},
|
|
295
320
|
},
|
|
296
|
-
'
|
|
297
|
-
title: '
|
|
298
|
-
description: 'When a
|
|
321
|
+
'message.flagged': {
|
|
322
|
+
title: 'Message Flagged',
|
|
323
|
+
description: 'When a message is flagged',
|
|
324
|
+
base_conditions: {
|
|
325
|
+
org_phone: true,
|
|
326
|
+
},
|
|
299
327
|
},
|
|
300
328
|
};
|
|
301
329
|
exports.ActionNameMap = {
|
|
@@ -324,8 +352,34 @@ exports.ActionNameMap = {
|
|
|
324
352
|
'chat.created',
|
|
325
353
|
'ticket.updated',
|
|
326
354
|
'ticket.created',
|
|
327
|
-
'reaction.
|
|
328
|
-
'
|
|
355
|
+
'reaction.added',
|
|
356
|
+
'message.flagged',
|
|
357
|
+
],
|
|
358
|
+
},
|
|
359
|
+
reply_to_message: {
|
|
360
|
+
title: 'Reply to message',
|
|
361
|
+
description: 'Send a message with the quoted message',
|
|
362
|
+
inputs: {
|
|
363
|
+
message: {
|
|
364
|
+
id: 'message',
|
|
365
|
+
type: 'editor',
|
|
366
|
+
label: 'Message',
|
|
367
|
+
placeholder: 'Enter message',
|
|
368
|
+
value: null,
|
|
369
|
+
},
|
|
370
|
+
media: {
|
|
371
|
+
id: 'media',
|
|
372
|
+
type: 'file',
|
|
373
|
+
label: 'Media',
|
|
374
|
+
placeholder: 'Upload media',
|
|
375
|
+
value: null,
|
|
376
|
+
},
|
|
377
|
+
},
|
|
378
|
+
validTriggers: [
|
|
379
|
+
'message.created',
|
|
380
|
+
'message.updated',
|
|
381
|
+
'reaction.added',
|
|
382
|
+
'message.flagged',
|
|
329
383
|
],
|
|
330
384
|
},
|
|
331
385
|
notify_http: {
|
|
@@ -346,8 +400,8 @@ exports.ActionNameMap = {
|
|
|
346
400
|
'chat.created',
|
|
347
401
|
'ticket.updated',
|
|
348
402
|
'ticket.created',
|
|
349
|
-
'reaction.
|
|
350
|
-
'
|
|
403
|
+
'reaction.added',
|
|
404
|
+
'message.flagged',
|
|
351
405
|
],
|
|
352
406
|
},
|
|
353
407
|
create_ticket: {
|
|
@@ -386,8 +440,8 @@ exports.ActionNameMap = {
|
|
|
386
440
|
'message.created',
|
|
387
441
|
'message.updated',
|
|
388
442
|
'chat.created',
|
|
389
|
-
'reaction.
|
|
390
|
-
'
|
|
443
|
+
'reaction.added',
|
|
444
|
+
'message.flagged',
|
|
391
445
|
],
|
|
392
446
|
},
|
|
393
447
|
flag_message: {
|
|
@@ -405,12 +459,7 @@ exports.ActionNameMap = {
|
|
|
405
459
|
placeholder: 'Select flag',
|
|
406
460
|
},
|
|
407
461
|
},
|
|
408
|
-
validTriggers: [
|
|
409
|
-
'message.created',
|
|
410
|
-
'message.updated',
|
|
411
|
-
'reaction.created',
|
|
412
|
-
'reaction.updated',
|
|
413
|
-
],
|
|
462
|
+
validTriggers: ['message.created', 'message.updated', 'reaction.added'],
|
|
414
463
|
},
|
|
415
464
|
assign_ticket: {
|
|
416
465
|
title: 'Assign Ticket',
|
|
@@ -458,8 +507,7 @@ exports.ActionNameMap = {
|
|
|
458
507
|
'chat.created',
|
|
459
508
|
'ticket.updated',
|
|
460
509
|
'ticket.created',
|
|
461
|
-
'reaction.
|
|
462
|
-
'reaction.updated',
|
|
510
|
+
'reaction.added',
|
|
463
511
|
],
|
|
464
512
|
},
|
|
465
513
|
add_ticket_label: {
|
|
@@ -494,8 +542,7 @@ exports.ActionNameMap = {
|
|
|
494
542
|
'chat.created',
|
|
495
543
|
'ticket.updated',
|
|
496
544
|
'ticket.created',
|
|
497
|
-
'reaction.
|
|
498
|
-
'reaction.updated',
|
|
545
|
+
'reaction.added',
|
|
499
546
|
],
|
|
500
547
|
},
|
|
501
548
|
forward_message: {
|
|
@@ -523,8 +570,8 @@ exports.ActionNameMap = {
|
|
|
523
570
|
'chat.created',
|
|
524
571
|
'ticket.updated',
|
|
525
572
|
'ticket.created',
|
|
526
|
-
'reaction.
|
|
527
|
-
'
|
|
573
|
+
'reaction.added',
|
|
574
|
+
'message.flagged',
|
|
528
575
|
],
|
|
529
576
|
},
|
|
530
577
|
send_email: {
|
|
@@ -559,8 +606,8 @@ exports.ActionNameMap = {
|
|
|
559
606
|
'chat.created',
|
|
560
607
|
'ticket.updated',
|
|
561
608
|
'ticket.created',
|
|
562
|
-
'reaction.
|
|
563
|
-
'
|
|
609
|
+
'reaction.added',
|
|
610
|
+
'message.flagged',
|
|
564
611
|
],
|
|
565
612
|
},
|
|
566
613
|
};
|
package/package.json
CHANGED
package/rules.types.ts
CHANGED
|
@@ -367,7 +367,7 @@ export const ChatVariableNameMap: Record<
|
|
|
367
367
|
text: 'Chat Labels',
|
|
368
368
|
type: 'dropdown',
|
|
369
369
|
value: 'org.labels',
|
|
370
|
-
filters: ['
|
|
370
|
+
filters: ['CONTAINS', 'NCONTAINS'],
|
|
371
371
|
},
|
|
372
372
|
};
|
|
373
373
|
|
|
@@ -479,6 +479,7 @@ export interface Conditions {
|
|
|
479
479
|
condition: 'allOf' | 'anyOf' | 'noneOf';
|
|
480
480
|
variables: string[];
|
|
481
481
|
delay: `${number} ${'seconds' | 'minutes' | 'hours' | 'days'}`;
|
|
482
|
+
org_phones: string[];
|
|
482
483
|
}
|
|
483
484
|
|
|
484
485
|
export type SendMessageAction = {
|
|
@@ -588,6 +589,20 @@ export type SendEmailAction = {
|
|
|
588
589
|
};
|
|
589
590
|
};
|
|
590
591
|
|
|
592
|
+
export type ReplyToMessage = {
|
|
593
|
+
id: string;
|
|
594
|
+
type: 'reply_to_message';
|
|
595
|
+
delay: `${number} ${'seconds' | 'minutes' | 'hours' | 'days'}`;
|
|
596
|
+
metadata: {
|
|
597
|
+
message: string;
|
|
598
|
+
media?: {
|
|
599
|
+
url: string;
|
|
600
|
+
type: 'image' | 'video' | 'audio' | 'document';
|
|
601
|
+
name: string;
|
|
602
|
+
};
|
|
603
|
+
};
|
|
604
|
+
};
|
|
605
|
+
|
|
591
606
|
export type Action =
|
|
592
607
|
| SendMessageAction
|
|
593
608
|
| NotifyHttpAction
|
|
@@ -599,7 +614,8 @@ export type Action =
|
|
|
599
614
|
| AddTicketLabelAction
|
|
600
615
|
| AssignChatAction
|
|
601
616
|
| ForwardMessageAction
|
|
602
|
-
| SendEmailAction
|
|
617
|
+
| SendEmailAction
|
|
618
|
+
| ReplyToMessage;
|
|
603
619
|
|
|
604
620
|
export const isSendMessageAction = (
|
|
605
621
|
action: Action
|
|
@@ -618,8 +634,9 @@ export type Rule = OverrideProperties<
|
|
|
618
634
|
| 'chat.created'
|
|
619
635
|
| 'ticket.updated'
|
|
620
636
|
| 'ticket.created'
|
|
621
|
-
| 'reaction.
|
|
622
|
-
| '
|
|
637
|
+
| 'reaction.added'
|
|
638
|
+
| 'chat.label.updated'
|
|
639
|
+
| 'message.flagged';
|
|
623
640
|
}
|
|
624
641
|
>;
|
|
625
642
|
|
|
@@ -628,35 +645,66 @@ export const RuleNameMap: Record<
|
|
|
628
645
|
{
|
|
629
646
|
title: string;
|
|
630
647
|
description: string;
|
|
648
|
+
base_conditions: {
|
|
649
|
+
org_phone: boolean;
|
|
650
|
+
};
|
|
631
651
|
}
|
|
632
652
|
> = {
|
|
633
653
|
'message.created': {
|
|
634
|
-
title: 'New Message
|
|
654
|
+
title: 'New Message Received',
|
|
635
655
|
description: 'When a new message is sent or received',
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
description: 'When a message is updated',
|
|
656
|
+
base_conditions: {
|
|
657
|
+
org_phone: true,
|
|
658
|
+
},
|
|
640
659
|
},
|
|
641
660
|
'chat.created': {
|
|
642
661
|
title: 'New Chat Created',
|
|
643
662
|
description: 'When a new chat is created',
|
|
663
|
+
base_conditions: {
|
|
664
|
+
org_phone: true,
|
|
665
|
+
},
|
|
644
666
|
},
|
|
645
667
|
'ticket.created': {
|
|
646
668
|
title: 'New Ticket Created',
|
|
647
669
|
description: 'When a new ticket is created',
|
|
670
|
+
base_conditions: {
|
|
671
|
+
org_phone: false,
|
|
672
|
+
},
|
|
673
|
+
},
|
|
674
|
+
'reaction.added': {
|
|
675
|
+
title: 'New Reaction Added',
|
|
676
|
+
description: 'When a reaction is added on a message',
|
|
677
|
+
base_conditions: {
|
|
678
|
+
org_phone: true,
|
|
679
|
+
},
|
|
680
|
+
},
|
|
681
|
+
'message.updated': {
|
|
682
|
+
title: 'Message Updated',
|
|
683
|
+
description: 'When a message is updated',
|
|
684
|
+
base_conditions: {
|
|
685
|
+
org_phone: true,
|
|
686
|
+
},
|
|
648
687
|
},
|
|
649
688
|
'ticket.updated': {
|
|
650
689
|
title: 'Ticket Updated',
|
|
651
690
|
description: 'When a ticket is updated',
|
|
691
|
+
base_conditions: {
|
|
692
|
+
org_phone: false,
|
|
693
|
+
},
|
|
652
694
|
},
|
|
653
|
-
'
|
|
654
|
-
title: '
|
|
655
|
-
description: 'When
|
|
695
|
+
'chat.label.updated': {
|
|
696
|
+
title: 'Chat Label Added/Removed',
|
|
697
|
+
description: 'When labels on chats are updated',
|
|
698
|
+
base_conditions: {
|
|
699
|
+
org_phone: false,
|
|
700
|
+
},
|
|
656
701
|
},
|
|
657
|
-
'
|
|
658
|
-
title: '
|
|
659
|
-
description: 'When a
|
|
702
|
+
'message.flagged': {
|
|
703
|
+
title: 'Message Flagged',
|
|
704
|
+
description: 'When a message is flagged',
|
|
705
|
+
base_conditions: {
|
|
706
|
+
org_phone: true,
|
|
707
|
+
},
|
|
660
708
|
},
|
|
661
709
|
};
|
|
662
710
|
|
|
@@ -713,8 +761,34 @@ export const ActionNameMap: Record<
|
|
|
713
761
|
'chat.created',
|
|
714
762
|
'ticket.updated',
|
|
715
763
|
'ticket.created',
|
|
716
|
-
'reaction.
|
|
717
|
-
'
|
|
764
|
+
'reaction.added',
|
|
765
|
+
'message.flagged',
|
|
766
|
+
],
|
|
767
|
+
},
|
|
768
|
+
reply_to_message: {
|
|
769
|
+
title: 'Reply to message',
|
|
770
|
+
description: 'Send a message with the quoted message',
|
|
771
|
+
inputs: {
|
|
772
|
+
message: {
|
|
773
|
+
id: 'message',
|
|
774
|
+
type: 'editor',
|
|
775
|
+
label: 'Message',
|
|
776
|
+
placeholder: 'Enter message',
|
|
777
|
+
value: null,
|
|
778
|
+
},
|
|
779
|
+
media: {
|
|
780
|
+
id: 'media',
|
|
781
|
+
type: 'file',
|
|
782
|
+
label: 'Media',
|
|
783
|
+
placeholder: 'Upload media',
|
|
784
|
+
value: null,
|
|
785
|
+
},
|
|
786
|
+
},
|
|
787
|
+
validTriggers: [
|
|
788
|
+
'message.created',
|
|
789
|
+
'message.updated',
|
|
790
|
+
'reaction.added',
|
|
791
|
+
'message.flagged',
|
|
718
792
|
],
|
|
719
793
|
},
|
|
720
794
|
notify_http: {
|
|
@@ -735,8 +809,8 @@ export const ActionNameMap: Record<
|
|
|
735
809
|
'chat.created',
|
|
736
810
|
'ticket.updated',
|
|
737
811
|
'ticket.created',
|
|
738
|
-
'reaction.
|
|
739
|
-
'
|
|
812
|
+
'reaction.added',
|
|
813
|
+
'message.flagged',
|
|
740
814
|
],
|
|
741
815
|
},
|
|
742
816
|
create_ticket: {
|
|
@@ -775,8 +849,8 @@ export const ActionNameMap: Record<
|
|
|
775
849
|
'message.created',
|
|
776
850
|
'message.updated',
|
|
777
851
|
'chat.created',
|
|
778
|
-
'reaction.
|
|
779
|
-
'
|
|
852
|
+
'reaction.added',
|
|
853
|
+
'message.flagged',
|
|
780
854
|
],
|
|
781
855
|
},
|
|
782
856
|
flag_message: {
|
|
@@ -794,12 +868,7 @@ export const ActionNameMap: Record<
|
|
|
794
868
|
placeholder: 'Select flag',
|
|
795
869
|
},
|
|
796
870
|
},
|
|
797
|
-
validTriggers: [
|
|
798
|
-
'message.created',
|
|
799
|
-
'message.updated',
|
|
800
|
-
'reaction.created',
|
|
801
|
-
'reaction.updated',
|
|
802
|
-
],
|
|
871
|
+
validTriggers: ['message.created', 'message.updated', 'reaction.added'],
|
|
803
872
|
},
|
|
804
873
|
assign_ticket: {
|
|
805
874
|
title: 'Assign Ticket',
|
|
@@ -847,8 +916,7 @@ export const ActionNameMap: Record<
|
|
|
847
916
|
'chat.created',
|
|
848
917
|
'ticket.updated',
|
|
849
918
|
'ticket.created',
|
|
850
|
-
'reaction.
|
|
851
|
-
'reaction.updated',
|
|
919
|
+
'reaction.added',
|
|
852
920
|
],
|
|
853
921
|
},
|
|
854
922
|
add_ticket_label: {
|
|
@@ -883,8 +951,7 @@ export const ActionNameMap: Record<
|
|
|
883
951
|
'chat.created',
|
|
884
952
|
'ticket.updated',
|
|
885
953
|
'ticket.created',
|
|
886
|
-
'reaction.
|
|
887
|
-
'reaction.updated',
|
|
954
|
+
'reaction.added',
|
|
888
955
|
],
|
|
889
956
|
},
|
|
890
957
|
forward_message: {
|
|
@@ -912,8 +979,8 @@ export const ActionNameMap: Record<
|
|
|
912
979
|
'chat.created',
|
|
913
980
|
'ticket.updated',
|
|
914
981
|
'ticket.created',
|
|
915
|
-
'reaction.
|
|
916
|
-
'
|
|
982
|
+
'reaction.added',
|
|
983
|
+
'message.flagged',
|
|
917
984
|
],
|
|
918
985
|
},
|
|
919
986
|
send_email: {
|
|
@@ -948,8 +1015,8 @@ export const ActionNameMap: Record<
|
|
|
948
1015
|
'chat.created',
|
|
949
1016
|
'ticket.updated',
|
|
950
1017
|
'ticket.created',
|
|
951
|
-
'reaction.
|
|
952
|
-
'
|
|
1018
|
+
'reaction.added',
|
|
1019
|
+
'message.flagged',
|
|
953
1020
|
],
|
|
954
1021
|
},
|
|
955
1022
|
};
|