@periskope/types 0.6.178 → 0.6.180

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.
@@ -149,10 +149,11 @@ export type CreateTicketAction = {
149
149
  type: 'create_ticket';
150
150
  delay: `${number} ${'seconds' | 'minutes' | 'hours' | 'days'}`;
151
151
  metadata: {
152
- assignee?: string;
153
152
  priority?: '0' | '1' | '2' | '3' | '4';
154
153
  label?: string;
155
154
  append_to_latest_ticket?: 'true' | 'false';
155
+ round_robin?: 'true' | 'false';
156
+ assignee?: string;
156
157
  };
157
158
  };
158
159
  export type FlagMessageAction = {
@@ -255,7 +256,16 @@ export type DeleteMessageAction = {
255
256
  delay: `${number} ${'seconds' | 'minutes' | 'hours' | 'days'}`;
256
257
  metadata: {};
257
258
  };
258
- export type Action = SendMessageAction | NotifyHttpAction | CreateTicketAction | FlagMessageAction | AssignTicketAction | CloseTicketAction | AddChatLabelAction | AddTicketLabelAction | AssignChatAction | ForwardMessageAction | SendEmailAction | ReplyToMessageAction | UpdateCustomPropertyAction | DeleteMessageAction;
259
+ export type SendSlackNotificationAction = {
260
+ id: string;
261
+ type: 'send_slack_notification';
262
+ delay: `${number} ${'seconds' | 'minutes' | 'hours' | 'days'}`;
263
+ metadata: {
264
+ slack_payload: string;
265
+ webhook_url: string;
266
+ };
267
+ };
268
+ export type Action = SendMessageAction | NotifyHttpAction | CreateTicketAction | FlagMessageAction | AssignTicketAction | CloseTicketAction | AddChatLabelAction | AddTicketLabelAction | AssignChatAction | ForwardMessageAction | SendEmailAction | ReplyToMessageAction | UpdateCustomPropertyAction | DeleteMessageAction | SendSlackNotificationAction;
259
269
  export declare const isSendMessageOrReplyToMessageAction: (action: Action) => action is SendMessageAction | ReplyToMessageAction;
260
270
  export type Rule = OverrideProperties<Tables<'tbl_automation_rules'>, {
261
271
  actions: Action[];
@@ -274,7 +284,7 @@ export declare const ActionNameMap: Record<Action['type'], {
274
284
  description: string;
275
285
  inputs: Record<string, {
276
286
  id: string;
277
- type: 'text' | 'dropdown' | 'editor' | 'date' | 'file' | 'textarea' | 'dynamic';
287
+ type: 'text' | 'dropdown' | 'editor' | 'date' | 'file' | 'textarea' | 'dynamic' | 'json_editor';
278
288
  value: 'ticket.labels' | 'org.members' | 'chat.labels' | 'org.chats' | {
279
289
  id: string;
280
290
  value: string;
@@ -287,9 +297,10 @@ export declare const ActionNameMap: Record<Action['type'], {
287
297
  }>;
288
298
  validTriggers: Rule['trigger'][];
289
299
  }>;
300
+ type editorVariablesList = 'chat.assigned_to' | 'chat.chat_id' | 'chat.chat_name' | 'chat.chat_type' | 'chat.org_phone' | 'chat.org_id' | 'chat.group_description' | 'ticket.assignee' | 'ticket.due_date' | 'ticket.priority' | 'ticket.status' | 'ticket.subject' | 'ticket.ticket_id' | 'ticket.raised_by' | 'ticket.created_at' | 'sender.is_internal' | 'sender.is_admin' | 'sender.contact_name' | 'sender.contact_id' | 'reaction.sender_id' | 'reaction.reaction' | 'message.message_id' | 'message.timestamp' | 'message.sender_phone' | 'message.message_type' | 'message.media' | 'message.body';
290
301
  export declare const editorVariables: Array<{
291
302
  label: string;
292
- value: string;
303
+ value: editorVariablesList;
293
304
  validTriggers: Rule['trigger'][];
294
305
  }>;
295
306
  export declare const variablesExclusionList: Record<Rule['trigger'], Array<keyof AppendTypes<{
@@ -412,7 +412,7 @@ exports.TicketVariableNameMap = {
412
412
  text: 'Ticket Priority',
413
413
  type: 'dropdown',
414
414
  value: [
415
- { id: '0', value: '0', label: 'No Prioriy' },
415
+ { id: '0', value: '0', label: 'No Priority' },
416
416
  { id: '1', value: '1', label: 'Low' },
417
417
  { id: '2', value: '2', label: 'Medium' },
418
418
  { id: '3', value: '3', label: 'High' },
@@ -808,15 +808,6 @@ exports.ActionNameMap = {
808
808
  info: 'If enabled, the message will be appended to the latest open ticket (if available) else a new ticket will be created',
809
809
  required: false,
810
810
  },
811
- assignee: {
812
- id: 'assignee',
813
- type: 'dropdown',
814
- value: 'org.members',
815
- label: 'Assignee (New Ticket)',
816
- placeholder: 'Select assignee',
817
- info: 'Only applicable for create ticket. If no assignee is selected, the ticket will be unassigned.',
818
- required: false,
819
- },
820
811
  priority: {
821
812
  id: 'priority',
822
813
  type: 'dropdown',
@@ -841,6 +832,27 @@ exports.ActionNameMap = {
841
832
  info: 'Only applicable for create ticket. If no label is selected, the ticket will have no label.',
842
833
  required: false,
843
834
  },
835
+ round_robin: {
836
+ id: 'round_robin',
837
+ type: 'dropdown',
838
+ value: [
839
+ { id: 'true', value: 'true', label: 'True' },
840
+ { id: 'false', value: 'false', label: 'False' },
841
+ ],
842
+ label: 'Enable Round Robin (New Ticket: Assignee)',
843
+ placeholder: 'Select...',
844
+ info: 'If enabled, the ticket will be assigned to the next available agent in the list',
845
+ required: false,
846
+ },
847
+ assignee: {
848
+ id: 'assignee',
849
+ type: 'dynamic',
850
+ value: 'org.members',
851
+ label: 'Assignee (New Ticket)',
852
+ placeholder: 'Select assignee',
853
+ info: "If round robin is enabled, the ticket will be assigned to the next available agent in the list else it'll be assigned to the selected agent",
854
+ required: false,
855
+ },
844
856
  },
845
857
  validTriggers: [
846
858
  'message.created',
@@ -857,8 +869,8 @@ exports.ActionNameMap = {
857
869
  id: 'flag',
858
870
  type: 'dropdown',
859
871
  value: [
860
- { id: 'flag', value: 'true', label: 'TRUE' },
861
- { id: 'unflag', value: 'false', label: 'FALSE' },
872
+ { id: 'flag', value: 'true', label: 'True' },
873
+ { id: 'unflag', value: 'false', label: 'False' },
862
874
  ],
863
875
  label: 'Flag status',
864
876
  placeholder: 'Select flag',
@@ -1084,8 +1096,70 @@ exports.ActionNameMap = {
1084
1096
  'chat.label.updated',
1085
1097
  ],
1086
1098
  },
1099
+ send_slack_notification: {
1100
+ title: 'Send Slack Webhook Notification',
1101
+ description: 'Send a slack webhook notification to a channel',
1102
+ validTriggers: [
1103
+ 'message.created',
1104
+ 'message.updated',
1105
+ 'chat.created',
1106
+ 'ticket.updated',
1107
+ 'ticket.created',
1108
+ 'reaction.added',
1109
+ 'message.flagged',
1110
+ 'chat.label.updated',
1111
+ ],
1112
+ inputs: {
1113
+ webhook_url: {
1114
+ type: 'text',
1115
+ id: 'webhook_url',
1116
+ label: 'Webhook URL',
1117
+ placeholder: 'Enter webhook URL',
1118
+ value: null,
1119
+ required: true,
1120
+ },
1121
+ slack_payload: {
1122
+ type: 'json_editor',
1123
+ id: 'slack_payload',
1124
+ label: 'Slack Notification Payload',
1125
+ placeholder: 'Enter payload',
1126
+ value: null,
1127
+ required: true,
1128
+ },
1129
+ },
1130
+ },
1087
1131
  };
1088
1132
  exports.editorVariables = [
1133
+ {
1134
+ label: 'Ticket ID',
1135
+ value: 'ticket.ticket_id',
1136
+ validTriggers: ['ticket.updated', 'ticket.created'],
1137
+ },
1138
+ {
1139
+ value: 'ticket.assignee',
1140
+ label: 'Ticket Assignee',
1141
+ validTriggers: ['ticket.updated', 'ticket.created'],
1142
+ },
1143
+ {
1144
+ value: 'ticket.due_date',
1145
+ label: 'Ticket Due Date',
1146
+ validTriggers: ['ticket.updated', 'ticket.created'],
1147
+ },
1148
+ {
1149
+ value: 'ticket.priority',
1150
+ label: 'Ticket Priority',
1151
+ validTriggers: ['ticket.updated', 'ticket.created'],
1152
+ },
1153
+ {
1154
+ value: 'ticket.status',
1155
+ label: 'Ticket Status',
1156
+ validTriggers: ['ticket.updated', 'ticket.created'],
1157
+ },
1158
+ {
1159
+ value: 'ticket.subject',
1160
+ label: 'Ticket Subject',
1161
+ validTriggers: ['ticket.updated', 'ticket.created'],
1162
+ },
1089
1163
  {
1090
1164
  label: 'Message Body',
1091
1165
  value: 'message.body',
@@ -1098,6 +1172,66 @@ exports.editorVariables = [
1098
1172
  'ticket.updated',
1099
1173
  ],
1100
1174
  },
1175
+ {
1176
+ value: 'message.media',
1177
+ label: 'Message Media',
1178
+ validTriggers: [
1179
+ 'message.created',
1180
+ 'message.updated',
1181
+ 'reaction.added',
1182
+ 'message.flagged',
1183
+ 'ticket.created',
1184
+ 'ticket.updated',
1185
+ ],
1186
+ },
1187
+ {
1188
+ value: 'message.message_id',
1189
+ label: 'Message ID',
1190
+ validTriggers: [
1191
+ 'message.created',
1192
+ 'message.updated',
1193
+ 'reaction.added',
1194
+ 'message.flagged',
1195
+ 'ticket.created',
1196
+ 'ticket.updated',
1197
+ ],
1198
+ },
1199
+ {
1200
+ value: 'message.message_type',
1201
+ label: 'Message Type',
1202
+ validTriggers: [
1203
+ 'message.created',
1204
+ 'message.updated',
1205
+ 'reaction.added',
1206
+ 'message.flagged',
1207
+ 'ticket.created',
1208
+ 'ticket.updated',
1209
+ ],
1210
+ },
1211
+ {
1212
+ value: 'message.sender_phone',
1213
+ label: 'Sender Phone',
1214
+ validTriggers: [
1215
+ 'message.created',
1216
+ 'message.updated',
1217
+ 'reaction.added',
1218
+ 'message.flagged',
1219
+ 'ticket.created',
1220
+ 'ticket.updated',
1221
+ ],
1222
+ },
1223
+ {
1224
+ value: 'message.timestamp',
1225
+ label: 'Message Timestamp',
1226
+ validTriggers: [
1227
+ 'message.created',
1228
+ 'message.updated',
1229
+ 'reaction.added',
1230
+ 'message.flagged',
1231
+ 'ticket.created',
1232
+ 'ticket.updated',
1233
+ ],
1234
+ },
1101
1235
  {
1102
1236
  label: 'Sender Name',
1103
1237
  value: 'sender.contact_name',
@@ -1110,6 +1244,40 @@ exports.editorVariables = [
1110
1244
  'ticket.updated',
1111
1245
  ],
1112
1246
  },
1247
+ {
1248
+ value: 'sender.is_admin',
1249
+ label: 'Sender Is Admin',
1250
+ validTriggers: [
1251
+ 'message.created',
1252
+ 'message.updated',
1253
+ 'reaction.added',
1254
+ 'message.flagged',
1255
+ 'ticket.created',
1256
+ 'ticket.updated',
1257
+ ],
1258
+ },
1259
+ {
1260
+ value: 'sender.is_internal',
1261
+ label: 'Sender Is Internal',
1262
+ validTriggers: [
1263
+ 'message.created',
1264
+ 'message.updated',
1265
+ 'reaction.added',
1266
+ 'message.flagged',
1267
+ 'ticket.created',
1268
+ 'ticket.updated',
1269
+ ],
1270
+ },
1271
+ {
1272
+ label: 'Reaction',
1273
+ value: 'reaction.reaction',
1274
+ validTriggers: ['reaction.added'],
1275
+ },
1276
+ {
1277
+ value: 'reaction.sender_id',
1278
+ label: 'Reaction Sender Phone',
1279
+ validTriggers: ['reaction.added'],
1280
+ },
1113
1281
  {
1114
1282
  label: 'Chat Name',
1115
1283
  value: 'chat.chat_name',
@@ -1125,13 +1293,22 @@ exports.editorVariables = [
1125
1293
  ],
1126
1294
  },
1127
1295
  {
1128
- label: 'Ticket ID',
1129
- value: 'ticket.ticket_id',
1130
- validTriggers: ['ticket.updated', 'ticket.created'],
1296
+ value: 'chat.assigned_to',
1297
+ label: 'Chat Assigned To',
1298
+ validTriggers: [
1299
+ 'message.created',
1300
+ 'message.updated',
1301
+ 'reaction.added',
1302
+ 'message.flagged',
1303
+ 'chat.created',
1304
+ 'chat.label.updated',
1305
+ 'ticket.created',
1306
+ 'ticket.updated',
1307
+ ],
1131
1308
  },
1132
1309
  {
1133
- label: 'Chat ID',
1134
1310
  value: 'chat.chat_id',
1311
+ label: 'Chat ID',
1135
1312
  validTriggers: [
1136
1313
  'message.created',
1137
1314
  'message.updated',
@@ -1144,9 +1321,46 @@ exports.editorVariables = [
1144
1321
  ],
1145
1322
  },
1146
1323
  {
1147
- label: 'Reaction',
1148
- value: 'reaction.reaction',
1149
- validTriggers: ['reaction.added'],
1324
+ value: 'chat.chat_type',
1325
+ label: 'Chat Type',
1326
+ validTriggers: [
1327
+ 'message.created',
1328
+ 'message.updated',
1329
+ 'reaction.added',
1330
+ 'message.flagged',
1331
+ 'chat.created',
1332
+ 'chat.label.updated',
1333
+ 'ticket.created',
1334
+ 'ticket.updated',
1335
+ ],
1336
+ },
1337
+ {
1338
+ value: 'chat.org_id',
1339
+ label: 'Chat Org ID',
1340
+ validTriggers: [
1341
+ 'message.created',
1342
+ 'message.updated',
1343
+ 'reaction.added',
1344
+ 'message.flagged',
1345
+ 'chat.created',
1346
+ 'chat.label.updated',
1347
+ 'ticket.created',
1348
+ 'ticket.updated',
1349
+ ],
1350
+ },
1351
+ {
1352
+ value: 'chat.org_phone',
1353
+ label: 'Chat Org Phone',
1354
+ validTriggers: [
1355
+ 'message.created',
1356
+ 'message.updated',
1357
+ 'reaction.added',
1358
+ 'message.flagged',
1359
+ 'chat.created',
1360
+ 'chat.label.updated',
1361
+ 'ticket.created',
1362
+ 'ticket.updated',
1363
+ ],
1150
1364
  },
1151
1365
  ];
1152
1366
  exports.variablesExclusionList = {
package/index.ts CHANGED
@@ -1,3 +1,3 @@
1
- export * from './rules.types';
2
- export * from './supabase.types';
3
- export * from './types';
1
+ export * from './rules.types';
2
+ export * from './supabase.types';
3
+ export * from './types';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@periskope/types",
3
- "version": "0.6.178",
3
+ "version": "0.6.180",
4
4
  "private": false,
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",