@periskope/types 0.6.13-7.2 → 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 +22 -6
- package/dist/rules.types.js +79 -32
- package/package.json +1 -1
- package/rules.types.ts +105 -39
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;
|
|
@@ -148,10 +149,9 @@ export type CreateTicketAction = {
|
|
|
148
149
|
type: 'create_ticket';
|
|
149
150
|
delay: `${number} ${'seconds' | 'minutes' | 'hours' | 'days'}`;
|
|
150
151
|
metadata: {
|
|
151
|
-
assignee
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
label: string;
|
|
152
|
+
assignee?: string;
|
|
153
|
+
priority?: 0 | 1 | 2 | 3 | 4;
|
|
154
|
+
label?: string;
|
|
155
155
|
};
|
|
156
156
|
};
|
|
157
157
|
export type FlagMessageAction = {
|
|
@@ -219,16 +219,32 @@ export type SendEmailAction = {
|
|
|
219
219
|
body: string;
|
|
220
220
|
};
|
|
221
221
|
};
|
|
222
|
-
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;
|
|
223
236
|
export declare const isSendMessageAction: (action: Action) => action is SendMessageAction;
|
|
224
237
|
export type Rule = OverrideProperties<Tables<'tbl_automation_rules'>, {
|
|
225
238
|
actions: Action[];
|
|
226
239
|
conditions: Conditions;
|
|
227
|
-
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';
|
|
228
241
|
}>;
|
|
229
242
|
export declare const RuleNameMap: Record<Rule['trigger'], {
|
|
230
243
|
title: string;
|
|
231
244
|
description: string;
|
|
245
|
+
base_conditions: {
|
|
246
|
+
org_phone: boolean;
|
|
247
|
+
};
|
|
232
248
|
}>;
|
|
233
249
|
export declare const ActionNameMap: Record<Action['type'], {
|
|
234
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 = {
|
|
@@ -509,10 +510,9 @@ export type CreateTicketAction = {
|
|
|
509
510
|
type: 'create_ticket';
|
|
510
511
|
delay: `${number} ${'seconds' | 'minutes' | 'hours' | 'days'}`;
|
|
511
512
|
metadata: {
|
|
512
|
-
assignee
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
label: string;
|
|
513
|
+
assignee?: string;
|
|
514
|
+
priority?: 0 | 1 | 2 | 3 | 4;
|
|
515
|
+
label?: string;
|
|
516
516
|
};
|
|
517
517
|
};
|
|
518
518
|
|
|
@@ -589,6 +589,20 @@ export type SendEmailAction = {
|
|
|
589
589
|
};
|
|
590
590
|
};
|
|
591
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
|
+
|
|
592
606
|
export type Action =
|
|
593
607
|
| SendMessageAction
|
|
594
608
|
| NotifyHttpAction
|
|
@@ -600,7 +614,8 @@ export type Action =
|
|
|
600
614
|
| AddTicketLabelAction
|
|
601
615
|
| AssignChatAction
|
|
602
616
|
| ForwardMessageAction
|
|
603
|
-
| SendEmailAction
|
|
617
|
+
| SendEmailAction
|
|
618
|
+
| ReplyToMessage;
|
|
604
619
|
|
|
605
620
|
export const isSendMessageAction = (
|
|
606
621
|
action: Action
|
|
@@ -619,8 +634,9 @@ export type Rule = OverrideProperties<
|
|
|
619
634
|
| 'chat.created'
|
|
620
635
|
| 'ticket.updated'
|
|
621
636
|
| 'ticket.created'
|
|
622
|
-
| 'reaction.
|
|
623
|
-
| '
|
|
637
|
+
| 'reaction.added'
|
|
638
|
+
| 'chat.label.updated'
|
|
639
|
+
| 'message.flagged';
|
|
624
640
|
}
|
|
625
641
|
>;
|
|
626
642
|
|
|
@@ -629,35 +645,66 @@ export const RuleNameMap: Record<
|
|
|
629
645
|
{
|
|
630
646
|
title: string;
|
|
631
647
|
description: string;
|
|
648
|
+
base_conditions: {
|
|
649
|
+
org_phone: boolean;
|
|
650
|
+
};
|
|
632
651
|
}
|
|
633
652
|
> = {
|
|
634
653
|
'message.created': {
|
|
635
|
-
title: 'New Message
|
|
654
|
+
title: 'New Message Received',
|
|
636
655
|
description: 'When a new message is sent or received',
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
description: 'When a message is updated',
|
|
656
|
+
base_conditions: {
|
|
657
|
+
org_phone: true,
|
|
658
|
+
},
|
|
641
659
|
},
|
|
642
660
|
'chat.created': {
|
|
643
661
|
title: 'New Chat Created',
|
|
644
662
|
description: 'When a new chat is created',
|
|
663
|
+
base_conditions: {
|
|
664
|
+
org_phone: true,
|
|
665
|
+
},
|
|
645
666
|
},
|
|
646
667
|
'ticket.created': {
|
|
647
668
|
title: 'New Ticket Created',
|
|
648
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
|
+
},
|
|
649
687
|
},
|
|
650
688
|
'ticket.updated': {
|
|
651
689
|
title: 'Ticket Updated',
|
|
652
690
|
description: 'When a ticket is updated',
|
|
691
|
+
base_conditions: {
|
|
692
|
+
org_phone: false,
|
|
693
|
+
},
|
|
653
694
|
},
|
|
654
|
-
'
|
|
655
|
-
title: '
|
|
656
|
-
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
|
+
},
|
|
657
701
|
},
|
|
658
|
-
'
|
|
659
|
-
title: '
|
|
660
|
-
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
|
+
},
|
|
661
708
|
},
|
|
662
709
|
};
|
|
663
710
|
|
|
@@ -714,8 +761,34 @@ export const ActionNameMap: Record<
|
|
|
714
761
|
'chat.created',
|
|
715
762
|
'ticket.updated',
|
|
716
763
|
'ticket.created',
|
|
717
|
-
'reaction.
|
|
718
|
-
'
|
|
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',
|
|
719
792
|
],
|
|
720
793
|
},
|
|
721
794
|
notify_http: {
|
|
@@ -736,8 +809,8 @@ export const ActionNameMap: Record<
|
|
|
736
809
|
'chat.created',
|
|
737
810
|
'ticket.updated',
|
|
738
811
|
'ticket.created',
|
|
739
|
-
'reaction.
|
|
740
|
-
'
|
|
812
|
+
'reaction.added',
|
|
813
|
+
'message.flagged',
|
|
741
814
|
],
|
|
742
815
|
},
|
|
743
816
|
create_ticket: {
|
|
@@ -776,8 +849,8 @@ export const ActionNameMap: Record<
|
|
|
776
849
|
'message.created',
|
|
777
850
|
'message.updated',
|
|
778
851
|
'chat.created',
|
|
779
|
-
'reaction.
|
|
780
|
-
'
|
|
852
|
+
'reaction.added',
|
|
853
|
+
'message.flagged',
|
|
781
854
|
],
|
|
782
855
|
},
|
|
783
856
|
flag_message: {
|
|
@@ -795,12 +868,7 @@ export const ActionNameMap: Record<
|
|
|
795
868
|
placeholder: 'Select flag',
|
|
796
869
|
},
|
|
797
870
|
},
|
|
798
|
-
validTriggers: [
|
|
799
|
-
'message.created',
|
|
800
|
-
'message.updated',
|
|
801
|
-
'reaction.created',
|
|
802
|
-
'reaction.updated',
|
|
803
|
-
],
|
|
871
|
+
validTriggers: ['message.created', 'message.updated', 'reaction.added'],
|
|
804
872
|
},
|
|
805
873
|
assign_ticket: {
|
|
806
874
|
title: 'Assign Ticket',
|
|
@@ -848,8 +916,7 @@ export const ActionNameMap: Record<
|
|
|
848
916
|
'chat.created',
|
|
849
917
|
'ticket.updated',
|
|
850
918
|
'ticket.created',
|
|
851
|
-
'reaction.
|
|
852
|
-
'reaction.updated',
|
|
919
|
+
'reaction.added',
|
|
853
920
|
],
|
|
854
921
|
},
|
|
855
922
|
add_ticket_label: {
|
|
@@ -884,8 +951,7 @@ export const ActionNameMap: Record<
|
|
|
884
951
|
'chat.created',
|
|
885
952
|
'ticket.updated',
|
|
886
953
|
'ticket.created',
|
|
887
|
-
'reaction.
|
|
888
|
-
'reaction.updated',
|
|
954
|
+
'reaction.added',
|
|
889
955
|
],
|
|
890
956
|
},
|
|
891
957
|
forward_message: {
|
|
@@ -913,8 +979,8 @@ export const ActionNameMap: Record<
|
|
|
913
979
|
'chat.created',
|
|
914
980
|
'ticket.updated',
|
|
915
981
|
'ticket.created',
|
|
916
|
-
'reaction.
|
|
917
|
-
'
|
|
982
|
+
'reaction.added',
|
|
983
|
+
'message.flagged',
|
|
918
984
|
],
|
|
919
985
|
},
|
|
920
986
|
send_email: {
|
|
@@ -949,8 +1015,8 @@ export const ActionNameMap: Record<
|
|
|
949
1015
|
'chat.created',
|
|
950
1016
|
'ticket.updated',
|
|
951
1017
|
'ticket.created',
|
|
952
|
-
'reaction.
|
|
953
|
-
'
|
|
1018
|
+
'reaction.added',
|
|
1019
|
+
'message.flagged',
|
|
954
1020
|
],
|
|
955
1021
|
},
|
|
956
1022
|
};
|