@periskope/types 0.6.137 → 0.6.138

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.
@@ -1,566 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ActionNameMap = exports.RuleNameMap = exports.isSendMessageAction = exports.FilterConditionMap = exports.ReactionVariableNameMap = exports.TicketVariableNameMap = exports.ChatVariableNameMap = exports.SenderVariableNameMap = exports.MessageVariableNameMap = exports.ReactionVariableFilterMap = exports.FilterNameMap = exports.isFilter = void 0;
4
- const isFilter = (filter) => {
5
- return (typeof filter === 'object' &&
6
- 'id' in filter &&
7
- 'condition' in filter &&
8
- 'variable' in filter &&
9
- 'value' in filter);
10
- };
11
- exports.isFilter = isFilter;
12
- exports.FilterNameMap = {
13
- CONTAINS: {
14
- name: 'contains',
15
- input: true,
16
- },
17
- NCONTAINS: {
18
- name: 'does not contain',
19
- input: true,
20
- },
21
- EQ: {
22
- name: 'equals to',
23
- input: true,
24
- },
25
- NEQ: {
26
- name: 'not equals to',
27
- input: true,
28
- },
29
- LT: {
30
- name: 'less than',
31
- input: true,
32
- },
33
- LTE: {
34
- name: 'less than or equals to',
35
- input: true,
36
- },
37
- GT: {
38
- name: 'greater than',
39
- input: true,
40
- },
41
- GTE: {
42
- name: 'greater than or equals to',
43
- input: true,
44
- },
45
- KNOWN: {
46
- name: 'is known',
47
- input: false,
48
- },
49
- NKNOWN: {
50
- name: 'is not known',
51
- input: false,
52
- },
53
- IS: {
54
- name: 'is',
55
- input: true,
56
- },
57
- NIS: {
58
- name: 'is not',
59
- input: true,
60
- },
61
- };
62
- exports.ReactionVariableFilterMap = {
63
- 'reaction.reaction': ['EQ', 'NEQ', 'KNOWN', 'NKNOWN'],
64
- 'reaction.sender_id': ['EQ', 'NEQ'],
65
- };
66
- exports.MessageVariableNameMap = {
67
- 'message.body': {
68
- text: 'Message Body',
69
- type: 'string',
70
- filters: ['CONTAINS', 'NCONTAINS', 'EQ', 'NEQ', 'KNOWN', 'NKNOWN'],
71
- },
72
- 'message.sender_phone': {
73
- text: 'Message Sender Phone',
74
- type: 'string',
75
- filters: ['EQ', 'NEQ'],
76
- },
77
- 'message.timestamp': {
78
- text: 'Message Timestamp',
79
- type: 'date',
80
- filters: ['LT', 'LTE', 'GT', 'GTE', 'IS'],
81
- },
82
- 'message.flag_status': {
83
- text: 'Message Flag Status',
84
- filters: ['IS'],
85
- type: 'boolean',
86
- },
87
- 'message.has_quoted_msg': {
88
- text: 'Quoted Message',
89
- filters: ['IS'],
90
- type: 'boolean',
91
- },
92
- 'message.media': {
93
- text: 'Message Media',
94
- type: 'boolean',
95
- filters: ['KNOWN', 'NKNOWN'],
96
- },
97
- 'message.performed_by': {
98
- text: 'Message Performed By',
99
- type: 'dropdown',
100
- value: 'org.members',
101
- filters: ['EQ', 'NEQ'],
102
- },
103
- };
104
- exports.SenderVariableNameMap = {
105
- 'sender.is_business': {
106
- // remove
107
- text: 'Sender is business',
108
- type: 'boolean',
109
- filters: ['IS'],
110
- },
111
- 'sender.is_enterprise': {
112
- // remove
113
- text: 'Sender is enterprise',
114
- type: 'boolean',
115
- filters: ['IS'],
116
- },
117
- 'sender.is_internal': {
118
- text: 'Sender is internal',
119
- type: 'boolean',
120
- filters: ['IS'],
121
- },
122
- 'sender.contact_name': {
123
- text: 'Sender Name',
124
- type: 'string',
125
- filters: ['EQ', 'NEQ', 'KNOWN', 'NKNOWN'],
126
- },
127
- 'sender.contact_id': {
128
- text: 'Sender Contact Phone',
129
- type: 'string',
130
- filters: ['EQ', 'NEQ'],
131
- },
132
- 'sender.labels': {
133
- text: 'Sender Labels',
134
- type: 'dropdown',
135
- value: 'org.labels',
136
- filters: ['EQ', 'NEQ'],
137
- },
138
- };
139
- exports.ChatVariableNameMap = {
140
- 'chat.assigned_to': {
141
- text: 'Chat Assignee',
142
- type: 'dropdown',
143
- value: 'org.members',
144
- filters: ['EQ', 'NEQ', 'KNOWN', 'NKNOWN'],
145
- },
146
- 'chat.chat_name': {
147
- text: 'Chat Name',
148
- type: 'string',
149
- filters: ['EQ', 'NEQ'],
150
- },
151
- 'chat.org_phone': {
152
- text: 'Chat Org Phone',
153
- type: 'string',
154
- filters: ['EQ', 'NEQ'],
155
- },
156
- 'chat.chat_type': {
157
- text: 'Chat Type',
158
- type: 'dropdown',
159
- value: [
160
- { id: 'user', value: 'user', label: 'User' },
161
- { id: 'group', value: 'group', label: 'Group' },
162
- ],
163
- filters: ['EQ', 'NEQ'],
164
- },
165
- 'chat.members': {
166
- text: 'Chat Members',
167
- type: 'string',
168
- filters: ['CONTAINS', 'NCONTAINS', 'EQ', 'NEQ'],
169
- },
170
- 'chat.labels': {
171
- text: 'Chat Labels',
172
- type: 'dropdown',
173
- value: 'org.labels',
174
- filters: ['EQ', 'NEQ'],
175
- },
176
- };
177
- exports.TicketVariableNameMap = {
178
- 'ticket.subject': {
179
- text: 'Ticket Subject',
180
- type: 'string',
181
- filters: ['CONTAINS', 'NCONTAINS', 'EQ', 'NEQ'],
182
- },
183
- 'ticket.status': {
184
- text: 'Ticket Status',
185
- type: 'dropdown',
186
- value: [
187
- { id: 'open', value: 'open', label: 'Open' },
188
- { id: 'closed', value: 'closed', label: 'Closed' },
189
- { id: 'inprogress', value: 'inprogress', label: 'In progress' },
190
- ],
191
- filters: ['EQ', 'NEQ'],
192
- },
193
- 'ticket.priority': {
194
- text: 'Ticket Priority',
195
- type: 'dropdown',
196
- value: [
197
- { id: '0', value: '0', label: 'No Prioriy' },
198
- { id: '1', value: '1', label: 'Low' },
199
- { id: '2', value: '2', label: 'Medium' },
200
- { id: '3', value: '3', label: 'High' },
201
- { id: '4', value: '4', label: 'Urgent' },
202
- ],
203
- filters: ['EQ', 'NEQ'],
204
- },
205
- 'ticket.assignee': {
206
- text: 'Ticket Assignee',
207
- type: 'dropdown',
208
- value: 'org.members',
209
- filters: ['EQ', 'NEQ'],
210
- },
211
- 'ticket.labels': {
212
- text: 'Ticket Labels',
213
- type: 'dropdown',
214
- value: 'org.labels',
215
- filters: ['EQ', 'NEQ'],
216
- },
217
- 'ticket.is_deleted': {
218
- text: 'Ticket is deleted',
219
- type: 'boolean',
220
- filters: ['IS'],
221
- },
222
- 'ticket.raised_by': {
223
- text: 'Ticket Raised By',
224
- type: 'dropdown',
225
- value: 'org.members',
226
- filters: ['EQ', 'NEQ'],
227
- },
228
- 'ticket.due_date': {
229
- text: 'Ticket Due Date',
230
- type: 'date',
231
- filters: ['LT', 'LTE', 'GT', 'GTE'],
232
- },
233
- 'ticket.assigned_by': {
234
- text: 'Ticket assignee',
235
- type: 'dropdown',
236
- value: 'org.members',
237
- filters: ['EQ', 'NEQ'],
238
- },
239
- };
240
- exports.ReactionVariableNameMap = {
241
- 'reaction.reaction': {
242
- text: 'Reaction',
243
- type: 'string',
244
- filters: ['EQ', 'NEQ'],
245
- },
246
- 'reaction.sender_id': {
247
- text: 'Reaction Sender Phone',
248
- type: 'string',
249
- filters: ['EQ', 'NEQ'],
250
- },
251
- };
252
- var FilterConditionMap;
253
- (function (FilterConditionMap) {
254
- FilterConditionMap["CONTAINS"] = "contains";
255
- FilterConditionMap["NCONTAINS"] = "does not contain";
256
- FilterConditionMap["EQ"] = "=";
257
- FilterConditionMap["NEQ"] = "<>";
258
- FilterConditionMap["LT"] = "<";
259
- FilterConditionMap["LTE"] = "<=";
260
- FilterConditionMap["GT"] = ">";
261
- FilterConditionMap["GTE"] = ">=";
262
- FilterConditionMap["KNOWN"] = "is known";
263
- FilterConditionMap["NKNOWN"] = "is not known";
264
- FilterConditionMap["IS"] = "=";
265
- FilterConditionMap["NIS"] = "<>";
266
- })(FilterConditionMap || (exports.FilterConditionMap = FilterConditionMap = {}));
267
- const isSendMessageAction = (action) => {
268
- return action.type === 'send_message';
269
- };
270
- exports.isSendMessageAction = isSendMessageAction;
271
- exports.RuleNameMap = {
272
- 'message.created': {
273
- title: 'New Message Sent/Received',
274
- description: 'When a new message is sent or received',
275
- },
276
- 'message.updated': {
277
- title: 'Message Updated',
278
- description: 'When a message is updated',
279
- },
280
- 'chat.created': {
281
- title: 'New Chat Created',
282
- description: 'When a new chat is created',
283
- },
284
- 'ticket.created': {
285
- title: 'New Ticket Created',
286
- description: 'When a new ticket is created',
287
- },
288
- 'ticket.updated': {
289
- title: 'Ticket Updated',
290
- description: 'When a ticket is updated',
291
- },
292
- 'reaction.created': {
293
- title: 'Reaction Created',
294
- description: 'When a reaction is created',
295
- },
296
- 'reaction.updated': {
297
- title: 'Reaction Updated',
298
- description: 'When a reaction is updated',
299
- },
300
- };
301
- exports.ActionNameMap = {
302
- send_message: {
303
- title: 'Send Message',
304
- description: 'Send a message',
305
- inputs: {
306
- message: {
307
- id: 'message',
308
- type: 'editor',
309
- label: 'Message',
310
- placeholder: 'Enter message',
311
- value: null,
312
- },
313
- media: {
314
- id: 'media',
315
- type: 'file',
316
- label: 'Media',
317
- placeholder: 'Upload media',
318
- value: null,
319
- },
320
- },
321
- validTriggers: [
322
- 'message.created',
323
- 'message.updated',
324
- 'chat.created',
325
- 'ticket.updated',
326
- 'ticket.created',
327
- 'reaction.created',
328
- 'reaction.updated',
329
- ],
330
- },
331
- notify_http: {
332
- title: 'Notify HTTP',
333
- description: 'Notify an HTTP endpoint',
334
- inputs: {
335
- url: {
336
- id: 'url',
337
- type: 'text',
338
- label: 'URL',
339
- placeholder: 'Enter URL',
340
- value: null,
341
- },
342
- },
343
- validTriggers: [
344
- 'message.created',
345
- 'message.updated',
346
- 'chat.created',
347
- 'ticket.updated',
348
- 'ticket.created',
349
- 'reaction.created',
350
- 'reaction.updated',
351
- ],
352
- },
353
- create_ticket: {
354
- title: 'Create Ticket',
355
- description: 'Create a ticket',
356
- inputs: {
357
- assignee: {
358
- id: 'assignee',
359
- type: 'dropdown',
360
- value: 'org.members',
361
- label: 'Assignee',
362
- placeholder: 'Select assignee',
363
- },
364
- priority: {
365
- id: 'priority',
366
- type: 'dropdown',
367
- value: [
368
- { id: '0', value: '0', label: 'Low' },
369
- { id: '1', value: '1', label: 'Medium' },
370
- { id: '2', value: '2', label: 'High' },
371
- { id: '3', value: '3', label: 'Urgent' },
372
- { id: '4', value: '4', label: 'Immediate' },
373
- ],
374
- label: 'Priority',
375
- placeholder: 'Select priority',
376
- },
377
- label: {
378
- id: 'label',
379
- type: 'dropdown',
380
- value: 'ticket.labels',
381
- label: 'Label',
382
- placeholder: 'Select label',
383
- },
384
- },
385
- validTriggers: [
386
- 'message.created',
387
- 'message.updated',
388
- 'chat.created',
389
- 'reaction.created',
390
- 'reaction.updated',
391
- ],
392
- },
393
- flag_message: {
394
- title: 'Update flag status',
395
- description: 'Flag/Unflag a message',
396
- inputs: {
397
- flag: {
398
- id: 'flag',
399
- type: 'dropdown',
400
- value: [
401
- { id: 'flag', value: 'true', label: 'TRUE' },
402
- { id: 'unflag', value: 'false', label: 'FALSE' },
403
- ],
404
- label: 'Flag status',
405
- placeholder: 'Select flag',
406
- },
407
- },
408
- validTriggers: [
409
- 'message.created',
410
- 'message.updated',
411
- 'reaction.created',
412
- 'reaction.updated',
413
- ],
414
- },
415
- assign_ticket: {
416
- title: 'Assign Ticket',
417
- description: 'Assign a ticket',
418
- inputs: {
419
- assignee: {
420
- id: 'assignee',
421
- type: 'dropdown',
422
- value: 'org.members',
423
- label: 'Assignee',
424
- placeholder: 'Select assignee',
425
- },
426
- },
427
- validTriggers: ['ticket.updated', 'ticket.created'],
428
- },
429
- close_ticket: {
430
- title: 'Close Ticket',
431
- description: 'Close a ticket',
432
- inputs: {
433
- closing_note: {
434
- id: 'closing_note',
435
- type: 'textarea',
436
- label: 'Closing Note',
437
- placeholder: 'Enter closing note',
438
- value: null,
439
- },
440
- },
441
- validTriggers: ['ticket.updated', 'ticket.created'],
442
- },
443
- add_chat_label: {
444
- title: 'Add Chat Label',
445
- description: 'Add a label to referred chat',
446
- inputs: {
447
- label: {
448
- id: 'label',
449
- type: 'dropdown',
450
- value: 'chat.labels',
451
- label: 'Label',
452
- placeholder: 'Select label',
453
- },
454
- },
455
- validTriggers: [
456
- 'message.created',
457
- 'message.updated',
458
- 'chat.created',
459
- 'ticket.updated',
460
- 'ticket.created',
461
- 'reaction.created',
462
- 'reaction.updated',
463
- ],
464
- },
465
- add_ticket_label: {
466
- title: 'Add Ticket Label',
467
- description: 'Add a label to referred ticket',
468
- inputs: {
469
- label: {
470
- id: 'label',
471
- type: 'dropdown',
472
- value: 'ticket.labels',
473
- label: 'Label',
474
- placeholder: 'Select label',
475
- },
476
- },
477
- validTriggers: ['ticket.updated', 'ticket.created'],
478
- },
479
- assign_chat: {
480
- title: 'Assign Chat',
481
- description: 'Assign a chat',
482
- inputs: {
483
- assignee: {
484
- id: 'assignee',
485
- type: 'dropdown',
486
- value: 'org.members',
487
- label: 'Assignee',
488
- placeholder: 'Select assignee',
489
- },
490
- },
491
- validTriggers: [
492
- 'message.created',
493
- 'message.updated',
494
- 'chat.created',
495
- 'ticket.updated',
496
- 'ticket.created',
497
- 'reaction.created',
498
- 'reaction.updated',
499
- ],
500
- },
501
- forward_message: {
502
- title: 'Forward Message',
503
- description: 'Forward a message',
504
- inputs: {
505
- chat_id: {
506
- id: 'chat_id',
507
- type: 'dropdown',
508
- value: 'org.chats',
509
- label: 'Chat',
510
- placeholder: 'Select chat',
511
- },
512
- prefix: {
513
- id: 'prefix',
514
- type: 'editor',
515
- label: 'Prefix',
516
- placeholder: 'Enter prefix',
517
- value: null,
518
- },
519
- },
520
- validTriggers: [
521
- 'message.created',
522
- 'message.updated',
523
- 'chat.created',
524
- 'ticket.updated',
525
- 'ticket.created',
526
- 'reaction.created',
527
- 'reaction.updated',
528
- ],
529
- },
530
- send_email: {
531
- title: 'Send Email',
532
- description: 'Send an email',
533
- inputs: {
534
- email: {
535
- id: 'email',
536
- type: 'text',
537
- label: 'Email',
538
- placeholder: 'Enter email',
539
- value: null,
540
- },
541
- subject: {
542
- id: 'subject',
543
- type: 'text',
544
- label: 'Subject',
545
- placeholder: 'Enter subject',
546
- value: null,
547
- },
548
- body: {
549
- id: 'body',
550
- type: 'editor',
551
- label: 'Body',
552
- placeholder: 'Enter body',
553
- value: null,
554
- },
555
- },
556
- validTriggers: [
557
- 'message.created',
558
- 'message.updated',
559
- 'chat.created',
560
- 'ticket.updated',
561
- 'ticket.created',
562
- 'reaction.created',
563
- 'reaction.updated',
564
- ],
565
- },
566
- };