@periskope/types 0.6.390 → 0.6.391

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,6 +1,7 @@
1
1
  import { Merge, OverrideProperties } from 'type-fest';
2
2
  import { Tables } from './supabase.types';
3
3
  import {
4
+ CallRuleInfoType,
4
5
  ChatRuleInfoType,
5
6
  MessageRuleInfoType,
6
7
  OrgType,
@@ -131,12 +132,39 @@ export type ChatRulesInfoType = Merge<
131
132
  }
132
133
  >;
133
134
 
135
+ export type CallVariablesType = {
136
+ call_id: string;
137
+ from: string | null;
138
+ to: string | null;
139
+ timestamp: string | null;
140
+ duration: number | null;
141
+ status: string | null;
142
+ org_phone: string;
143
+ };
144
+
145
+ export type CallRulesInfoType = Merge<
146
+ AppendTypes<
147
+ {
148
+ call: CallVariablesType;
149
+ chat: ChatVariablesType;
150
+ },
151
+ '.'
152
+ >,
153
+ {
154
+ rule: Tables<'tbl_automation_rules'>[];
155
+ id: 'call.call_id';
156
+ type: 'call.created';
157
+ org_id: string;
158
+ }
159
+ >;
160
+
134
161
  export type RuleInfoType =
135
162
  | MessageRulesInfoType
136
163
  | ChatRulesInfoType
137
164
  | TicketRulesInfoType
138
165
  | ReactionRulesInfoType
139
- | TaskRulesInfoType;
166
+ | TaskRulesInfoType
167
+ | CallRulesInfoType;
140
168
 
141
169
  export interface Filter {
142
170
  id: string;
@@ -917,6 +945,82 @@ export const ReactionVariableNameMap: Record<
917
945
  },
918
946
  };
919
947
 
948
+ export const CallVariableNameMap: Record<
949
+ keyof AppendTypes<{ call: CallVariablesType }, '.'>,
950
+ VariableNameValueType
951
+ > = {
952
+ 'call.call_id': {
953
+ text: 'Call ID',
954
+ type: 'string',
955
+ filters: ['EQ', 'NEQ'],
956
+ hidden: true,
957
+ variable_type: 'string',
958
+ },
959
+ 'call.from': {
960
+ text: 'Caller Phone',
961
+ type: 'string',
962
+ filters: ['EQ', 'NEQ'],
963
+ placeholder: 'e.g. 919876543210',
964
+ variable_type: 'string',
965
+ },
966
+ 'call.to': {
967
+ text: 'Receiver Phone',
968
+ type: 'string',
969
+ filters: ['EQ', 'NEQ'],
970
+ placeholder: 'e.g. 919876543210',
971
+ variable_type: 'string',
972
+ },
973
+ 'call.timestamp': {
974
+ text: 'Call Timestamp',
975
+ type: 'day-time',
976
+ filters: {
977
+ LT: {
978
+ info: 'When call is received before mentioned time (UTC)',
979
+ },
980
+ LTE: {
981
+ info: 'When call is received before mentioned time (UTC)',
982
+ },
983
+ GT: {
984
+ info: 'When call is received after mentioned time (UTC)',
985
+ },
986
+ GTE: {
987
+ info: 'When call is received on or after mentioned time (UTC)',
988
+ },
989
+ ON: {
990
+ info: 'When call is received on mentioned days',
991
+ },
992
+ },
993
+ variable_type: 'day-time',
994
+ info: 'The timestamp when the call was received',
995
+ },
996
+ 'call.duration': {
997
+ text: 'Call Duration (seconds)',
998
+ type: 'number',
999
+ filters: ['EQ', 'NEQ', 'LT', 'LTE', 'GT', 'GTE'],
1000
+ placeholder: 'e.g. 30',
1001
+ variable_type: 'number',
1002
+ },
1003
+ 'call.status': {
1004
+ text: 'Call Status',
1005
+ type: 'dropdown',
1006
+ value: [
1007
+ { id: 'incoming', value: 'incoming', label: 'Incoming' },
1008
+ { id: 'missed', value: 'missed', label: 'Missed' },
1009
+ { id: 'answered', value: 'answered', label: 'Answered' },
1010
+ { id: 'rejected', value: 'rejected', label: 'Rejected' },
1011
+ ],
1012
+ filters: ['EQ', 'NEQ'],
1013
+ variable_type: 'string',
1014
+ },
1015
+ 'call.org_phone': {
1016
+ text: 'Organization Phone',
1017
+ type: 'string',
1018
+ filters: ['EQ', 'NEQ'],
1019
+ hidden: true,
1020
+ variable_type: 'string',
1021
+ },
1022
+ };
1023
+
920
1024
  export enum FilterConditionMap {
921
1025
  'CONTAINS' = 'contains',
922
1026
  'NCONTAINS' = 'does not contain',
@@ -1239,7 +1343,8 @@ export type Rule = OverrideProperties<
1239
1343
  | 'ticket.closed'
1240
1344
  | 'ticket.label.updated'
1241
1345
  | 'task.created'
1242
- | 'task.assignee.updated';
1346
+ | 'task.assignee.updated'
1347
+ | 'call.created';
1243
1348
  }
1244
1349
  >;
1245
1350
 
@@ -1351,6 +1456,13 @@ export const RuleNameMap: Record<
1351
1456
  org_phone: false,
1352
1457
  },
1353
1458
  },
1459
+ 'call.created': {
1460
+ title: 'Call Received',
1461
+ description: 'When a call is received',
1462
+ base_conditions: {
1463
+ org_phone: true,
1464
+ },
1465
+ },
1354
1466
  };
1355
1467
 
1356
1468
  export type ValidateFunction<T extends any[] = any[]> = (...args: T) => boolean;
@@ -2318,7 +2430,13 @@ type editorVariablesList =
2318
2430
  | 'task.assignee'
2319
2431
  | 'task.due_date'
2320
2432
  | 'task.task_id'
2321
- | 'task.notes';
2433
+ | 'task.notes'
2434
+ | 'call.call_id'
2435
+ | 'call.from'
2436
+ | 'call.to'
2437
+ | 'call.timestamp'
2438
+ | 'call.duration'
2439
+ | 'call.status';
2322
2440
 
2323
2441
  export const editorVariables: Array<{
2324
2442
  label: string;
@@ -2668,6 +2786,36 @@ export const editorVariables: Array<{
2668
2786
  label: 'Task Notes',
2669
2787
  validTriggers: ['task.created', 'task.assignee.updated'],
2670
2788
  },
2789
+ {
2790
+ value: 'call.call_id',
2791
+ label: 'Call ID',
2792
+ validTriggers: ['call.created'],
2793
+ },
2794
+ {
2795
+ value: 'call.from',
2796
+ label: 'Caller Phone',
2797
+ validTriggers: ['call.created'],
2798
+ },
2799
+ {
2800
+ value: 'call.to',
2801
+ label: 'Receiver Phone',
2802
+ validTriggers: ['call.created'],
2803
+ },
2804
+ {
2805
+ value: 'call.timestamp',
2806
+ label: 'Call Timestamp',
2807
+ validTriggers: ['call.created'],
2808
+ },
2809
+ {
2810
+ value: 'call.duration',
2811
+ label: 'Call Duration',
2812
+ validTriggers: ['call.created'],
2813
+ },
2814
+ {
2815
+ value: 'call.status',
2816
+ label: 'Call Status',
2817
+ validTriggers: ['call.created'],
2818
+ },
2671
2819
  ];
2672
2820
 
2673
2821
  export const variablesExclusionList: Record<
@@ -2679,6 +2827,7 @@ export const variablesExclusionList: Record<
2679
2827
  | keyof AppendTypes<{ ticket: TicketVariablesType }, '.'>
2680
2828
  | keyof AppendTypes<{ reaction: ReactionVariablesType }, '.'>
2681
2829
  | keyof AppendTypes<{ task: TaskVariablesType }, '.'>
2830
+ | keyof AppendTypes<{ call: CallVariablesType }, '.'>
2682
2831
  >
2683
2832
  > = {
2684
2833
  'ticket.created': ['ticket.is_deleted'],
@@ -2704,4 +2853,5 @@ export const variablesExclusionList: Record<
2704
2853
  'chat.label.updated': [],
2705
2854
  'task.created': [],
2706
2855
  'task.assignee.updated': [],
2856
+ 'call.created': [],
2707
2857
  };
package/src/types.ts CHANGED
@@ -253,6 +253,7 @@ export type OrgMetadata = {
253
253
  limit?: number;
254
254
  };
255
255
  display_language?: string;
256
+ auto_translate_messages?: boolean;
256
257
  custom_invite?: {
257
258
  is_enabled: boolean;
258
259
  template: string;
@@ -1014,7 +1015,6 @@ export interface GroupAnalyticsResult {
1014
1015
  total_leaves: number;
1015
1016
  total_removes: number;
1016
1017
  total_reactions: number;
1017
- most_active_members: MostActiveMember[];
1018
1018
  }
1019
1019
 
1020
1020
  export interface TimeRange {
@@ -1253,6 +1253,21 @@ export type TaskRuleInfoType<
1253
1253
  >;
1254
1254
  };
1255
1255
 
1256
+ export type CallRuleInfoType = {
1257
+ chat: ChatRuleInfoType['chat'];
1258
+ call: {
1259
+ call_id: string;
1260
+ from: string | null;
1261
+ to: string | null;
1262
+ timestamp: string | null;
1263
+ duration: number | null;
1264
+ status: string | null;
1265
+ org_phone: string;
1266
+ org_id: string;
1267
+ chat_id: string | null;
1268
+ };
1269
+ };
1270
+
1256
1271
  export type FeatureFlagReturnType = Record<string, boolean>;
1257
1272
 
1258
1273
  export type RuleLogsType = OverrideProperties<
@@ -306,6 +306,7 @@ export enum Triggers {
306
306
  CHAT_CLOSED = 'chat.closed',
307
307
  TASK_CREATED = 'task.created',
308
308
  TASK_DUE = 'task.due',
309
+ CALL_CREATED = 'call.created',
309
310
  }
310
311
 
311
312
  export type WorkflowDataType<T extends Triggers = Triggers> = T extends
@@ -648,6 +649,7 @@ export const TriggerNameMap: Record<Triggers, string> = {
648
649
  'ticket.updated': 'Ticket Updated',
649
650
  'task.created': 'Task Created',
650
651
  'task.due': 'Task Due',
652
+ 'call.created': 'Call Received',
651
653
  };
652
654
 
653
655
  export const WorkflowActionNameMap: Record<