@periskope/types 0.6.177 → 0.6.179

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;
@@ -289,7 +299,7 @@ export declare const ActionNameMap: Record<Action['type'], {
289
299
  }>;
290
300
  export declare const editorVariables: Array<{
291
301
  label: string;
292
- value: string;
302
+ value: keyof typeof MessageVariableNameMap | keyof typeof SenderVariableNameMap | keyof typeof ChatVariableNameMap | keyof typeof TicketVariableNameMap | keyof typeof ReactionVariableNameMap;
293
303
  validTriggers: Rule['trigger'][];
294
304
  }>;
295
305
  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,6 +1096,38 @@ exports.ActionNameMap = {
1084
1096
  'chat.label.updated',
1085
1097
  ],
1086
1098
  },
1099
+ send_slack_notification: {
1100
+ title: 'Send Slack Notification',
1101
+ description: 'Send a slack 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 = [
1089
1133
  {
@@ -1148,6 +1192,20 @@ exports.editorVariables = [
1148
1192
  value: 'reaction.reaction',
1149
1193
  validTriggers: ['reaction.added'],
1150
1194
  },
1195
+ {
1196
+ value: 'chat.assigned_to',
1197
+ label: 'Chat Assigned To',
1198
+ validTriggers: [
1199
+ 'message.created',
1200
+ 'message.updated',
1201
+ 'reaction.added',
1202
+ 'message.flagged',
1203
+ 'chat.created',
1204
+ 'chat.label.updated',
1205
+ 'ticket.created',
1206
+ 'ticket.updated',
1207
+ ],
1208
+ },
1151
1209
  ];
1152
1210
  exports.variablesExclusionList = {
1153
1211
  'ticket.created': ['ticket.is_deleted'],
@@ -1755,15 +1755,69 @@ export type Database = {
1755
1755
  }
1756
1756
  ];
1757
1757
  };
1758
+ tbl_scheduled_logs: {
1759
+ Row: {
1760
+ chat_id: string | null;
1761
+ created_at: string;
1762
+ delivered_at: string | null;
1763
+ id: number;
1764
+ is_success: boolean | null;
1765
+ org_id: string | null;
1766
+ sent_message_id: string | null;
1767
+ };
1768
+ Insert: {
1769
+ chat_id?: string | null;
1770
+ created_at?: string;
1771
+ delivered_at?: string | null;
1772
+ id?: number;
1773
+ is_success?: boolean | null;
1774
+ org_id?: string | null;
1775
+ sent_message_id?: string | null;
1776
+ };
1777
+ Update: {
1778
+ chat_id?: string | null;
1779
+ created_at?: string;
1780
+ delivered_at?: string | null;
1781
+ id?: number;
1782
+ is_success?: boolean | null;
1783
+ org_id?: string | null;
1784
+ sent_message_id?: string | null;
1785
+ };
1786
+ Relationships: [
1787
+ {
1788
+ foreignKeyName: "tbl_scheduled_message_logs_org_id_fkey";
1789
+ columns: ["org_id"];
1790
+ isOneToOne: false;
1791
+ referencedRelation: "tbl_org";
1792
+ referencedColumns: ["org_id"];
1793
+ },
1794
+ {
1795
+ foreignKeyName: "tbl_scheduled_message_logs_org_id_fkey";
1796
+ columns: ["org_id"];
1797
+ isOneToOne: false;
1798
+ referencedRelation: "view_org";
1799
+ referencedColumns: ["org_id"];
1800
+ },
1801
+ {
1802
+ foreignKeyName: "tbl_scheduled_message_logs_sent_message_id_fkey";
1803
+ columns: ["sent_message_id"];
1804
+ isOneToOne: false;
1805
+ referencedRelation: "tbl_scheduled_messages";
1806
+ referencedColumns: ["sent_message_id"];
1807
+ }
1808
+ ];
1809
+ };
1758
1810
  tbl_scheduled_messages: {
1759
1811
  Row: {
1760
1812
  chat_id: string;
1761
1813
  created_at: string;
1814
+ is_repeat: boolean | null;
1762
1815
  message_id: string | null;
1763
1816
  message_payload: Json | null;
1764
1817
  org_id: string;
1765
1818
  org_phone: string | null;
1766
1819
  performed_by: string | null;
1820
+ repeat_config: Json | null;
1767
1821
  scheduled_at: string;
1768
1822
  sent_message_id: string;
1769
1823
  status: boolean | null;
@@ -1772,11 +1826,13 @@ export type Database = {
1772
1826
  Insert: {
1773
1827
  chat_id: string;
1774
1828
  created_at?: string;
1829
+ is_repeat?: boolean | null;
1775
1830
  message_id?: string | null;
1776
1831
  message_payload?: Json | null;
1777
1832
  org_id: string;
1778
1833
  org_phone?: string | null;
1779
1834
  performed_by?: string | null;
1835
+ repeat_config?: Json | null;
1780
1836
  scheduled_at: string;
1781
1837
  sent_message_id: string;
1782
1838
  status?: boolean | null;
@@ -1785,11 +1841,13 @@ export type Database = {
1785
1841
  Update: {
1786
1842
  chat_id?: string;
1787
1843
  created_at?: string;
1844
+ is_repeat?: boolean | null;
1788
1845
  message_id?: string | null;
1789
1846
  message_payload?: Json | null;
1790
1847
  org_id?: string;
1791
1848
  org_phone?: string | null;
1792
1849
  performed_by?: string | null;
1850
+ repeat_config?: Json | null;
1793
1851
  scheduled_at?: string;
1794
1852
  sent_message_id?: string;
1795
1853
  status?: boolean | null;
package/dist/types.d.ts CHANGED
@@ -92,6 +92,9 @@ export type OrgMetadata = {
92
92
  rules?: {
93
93
  limit?: number;
94
94
  };
95
+ ai?: {
96
+ flag_prompt?: string;
97
+ };
95
98
  };
96
99
  type AccessScopes = {
97
100
  feature_flags: Record<string, boolean>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@periskope/types",
3
- "version": "0.6.177",
3
+ "version": "0.6.179",
4
4
  "private": false,
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/rules.types.ts CHANGED
@@ -586,7 +586,7 @@ export const TicketVariableNameMap: Record<
586
586
  text: 'Ticket Priority',
587
587
  type: 'dropdown',
588
588
  value: [
589
- { id: '0', value: '0', label: 'No Prioriy' },
589
+ { id: '0', value: '0', label: 'No Priority' },
590
590
  { id: '1', value: '1', label: 'Low' },
591
591
  { id: '2', value: '2', label: 'Medium' },
592
592
  { id: '3', value: '3', label: 'High' },
@@ -799,10 +799,11 @@ export type CreateTicketAction = {
799
799
  type: 'create_ticket';
800
800
  delay: `${number} ${'seconds' | 'minutes' | 'hours' | 'days'}`;
801
801
  metadata: {
802
- assignee?: string;
803
802
  priority?: '0' | '1' | '2' | '3' | '4';
804
803
  label?: string;
805
804
  append_to_latest_ticket?: 'true' | 'false';
805
+ round_robin?: 'true' | 'false';
806
+ assignee?: string;
806
807
  };
807
808
  };
808
809
 
@@ -920,6 +921,16 @@ export type DeleteMessageAction = {
920
921
  metadata: {};
921
922
  };
922
923
 
924
+ export type SendSlackNotificationAction = {
925
+ id: string;
926
+ type: 'send_slack_notification';
927
+ delay: `${number} ${'seconds' | 'minutes' | 'hours' | 'days'}`;
928
+ metadata: {
929
+ slack_payload: string;
930
+ webhook_url: string;
931
+ };
932
+ };
933
+
923
934
  export type Action =
924
935
  | SendMessageAction
925
936
  | NotifyHttpAction
@@ -934,7 +945,8 @@ export type Action =
934
945
  | SendEmailAction
935
946
  | ReplyToMessageAction
936
947
  | UpdateCustomPropertyAction
937
- | DeleteMessageAction;
948
+ | DeleteMessageAction
949
+ | SendSlackNotificationAction;
938
950
 
939
951
  export const isSendMessageOrReplyToMessageAction = (
940
952
  action: Action
@@ -1043,7 +1055,8 @@ export const ActionNameMap: Record<
1043
1055
  | 'date'
1044
1056
  | 'file'
1045
1057
  | 'textarea'
1046
- | 'dynamic';
1058
+ | 'dynamic'
1059
+ | 'json_editor';
1047
1060
  value:
1048
1061
  | 'ticket.labels'
1049
1062
  | 'org.members'
@@ -1240,15 +1253,6 @@ export const ActionNameMap: Record<
1240
1253
  info: 'If enabled, the message will be appended to the latest open ticket (if available) else a new ticket will be created',
1241
1254
  required: false,
1242
1255
  },
1243
- assignee: {
1244
- id: 'assignee',
1245
- type: 'dropdown',
1246
- value: 'org.members',
1247
- label: 'Assignee (New Ticket)',
1248
- placeholder: 'Select assignee',
1249
- info: 'Only applicable for create ticket. If no assignee is selected, the ticket will be unassigned.',
1250
- required: false,
1251
- },
1252
1256
  priority: {
1253
1257
  id: 'priority',
1254
1258
  type: 'dropdown',
@@ -1273,6 +1277,27 @@ export const ActionNameMap: Record<
1273
1277
  info: 'Only applicable for create ticket. If no label is selected, the ticket will have no label.',
1274
1278
  required: false,
1275
1279
  },
1280
+ round_robin: {
1281
+ id: 'round_robin',
1282
+ type: 'dropdown',
1283
+ value: [
1284
+ { id: 'true', value: 'true', label: 'True' },
1285
+ { id: 'false', value: 'false', label: 'False' },
1286
+ ],
1287
+ label: 'Enable Round Robin (New Ticket: Assignee)',
1288
+ placeholder: 'Select...',
1289
+ info: 'If enabled, the ticket will be assigned to the next available agent in the list',
1290
+ required: false,
1291
+ },
1292
+ assignee: {
1293
+ id: 'assignee',
1294
+ type: 'dynamic',
1295
+ value: 'org.members',
1296
+ label: 'Assignee (New Ticket)',
1297
+ placeholder: 'Select assignee',
1298
+ 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",
1299
+ required: false,
1300
+ },
1276
1301
  },
1277
1302
  validTriggers: [
1278
1303
  'message.created',
@@ -1289,8 +1314,8 @@ export const ActionNameMap: Record<
1289
1314
  id: 'flag',
1290
1315
  type: 'dropdown',
1291
1316
  value: [
1292
- { id: 'flag', value: 'true', label: 'TRUE' },
1293
- { id: 'unflag', value: 'false', label: 'FALSE' },
1317
+ { id: 'flag', value: 'true', label: 'True' },
1318
+ { id: 'unflag', value: 'false', label: 'False' },
1294
1319
  ],
1295
1320
  label: 'Flag status',
1296
1321
  placeholder: 'Select flag',
@@ -1516,11 +1541,48 @@ export const ActionNameMap: Record<
1516
1541
  'chat.label.updated',
1517
1542
  ],
1518
1543
  },
1544
+ send_slack_notification: {
1545
+ title: 'Send Slack Notification',
1546
+ description: 'Send a slack notification to a channel',
1547
+ validTriggers: [
1548
+ 'message.created',
1549
+ 'message.updated',
1550
+ 'chat.created',
1551
+ 'ticket.updated',
1552
+ 'ticket.created',
1553
+ 'reaction.added',
1554
+ 'message.flagged',
1555
+ 'chat.label.updated',
1556
+ ],
1557
+ inputs: {
1558
+ webhook_url: {
1559
+ type: 'text',
1560
+ id: 'webhook_url',
1561
+ label: 'Webhook URL',
1562
+ placeholder: 'Enter webhook URL',
1563
+ value: null,
1564
+ required: true,
1565
+ },
1566
+ slack_payload: {
1567
+ type: 'json_editor',
1568
+ id: 'slack_payload',
1569
+ label: 'Slack Notification Payload',
1570
+ placeholder: 'Enter payload',
1571
+ value: null,
1572
+ required: true,
1573
+ },
1574
+ },
1575
+ },
1519
1576
  };
1520
1577
 
1521
1578
  export const editorVariables: Array<{
1522
1579
  label: string;
1523
- value: string;
1580
+ value:
1581
+ | keyof typeof MessageVariableNameMap
1582
+ | keyof typeof SenderVariableNameMap
1583
+ | keyof typeof ChatVariableNameMap
1584
+ | keyof typeof TicketVariableNameMap
1585
+ | keyof typeof ReactionVariableNameMap;
1524
1586
  validTriggers: Rule['trigger'][];
1525
1587
  }> = [
1526
1588
  {
@@ -1585,6 +1647,20 @@ export const editorVariables: Array<{
1585
1647
  value: 'reaction.reaction',
1586
1648
  validTriggers: ['reaction.added'],
1587
1649
  },
1650
+ {
1651
+ value: 'chat.assigned_to',
1652
+ label: 'Chat Assigned To',
1653
+ validTriggers: [
1654
+ 'message.created',
1655
+ 'message.updated',
1656
+ 'reaction.added',
1657
+ 'message.flagged',
1658
+ 'chat.created',
1659
+ 'chat.label.updated',
1660
+ 'ticket.created',
1661
+ 'ticket.updated',
1662
+ ],
1663
+ },
1588
1664
  ];
1589
1665
 
1590
1666
  export const variablesExclusionList: Record<
package/supabase.types.ts CHANGED
@@ -1764,15 +1764,69 @@ export type Database = {
1764
1764
  },
1765
1765
  ]
1766
1766
  }
1767
+ tbl_scheduled_logs: {
1768
+ Row: {
1769
+ chat_id: string | null
1770
+ created_at: string
1771
+ delivered_at: string | null
1772
+ id: number
1773
+ is_success: boolean | null
1774
+ org_id: string | null
1775
+ sent_message_id: string | null
1776
+ }
1777
+ Insert: {
1778
+ chat_id?: string | null
1779
+ created_at?: string
1780
+ delivered_at?: string | null
1781
+ id?: number
1782
+ is_success?: boolean | null
1783
+ org_id?: string | null
1784
+ sent_message_id?: string | null
1785
+ }
1786
+ Update: {
1787
+ chat_id?: string | null
1788
+ created_at?: string
1789
+ delivered_at?: string | null
1790
+ id?: number
1791
+ is_success?: boolean | null
1792
+ org_id?: string | null
1793
+ sent_message_id?: string | null
1794
+ }
1795
+ Relationships: [
1796
+ {
1797
+ foreignKeyName: "tbl_scheduled_message_logs_org_id_fkey"
1798
+ columns: ["org_id"]
1799
+ isOneToOne: false
1800
+ referencedRelation: "tbl_org"
1801
+ referencedColumns: ["org_id"]
1802
+ },
1803
+ {
1804
+ foreignKeyName: "tbl_scheduled_message_logs_org_id_fkey"
1805
+ columns: ["org_id"]
1806
+ isOneToOne: false
1807
+ referencedRelation: "view_org"
1808
+ referencedColumns: ["org_id"]
1809
+ },
1810
+ {
1811
+ foreignKeyName: "tbl_scheduled_message_logs_sent_message_id_fkey"
1812
+ columns: ["sent_message_id"]
1813
+ isOneToOne: false
1814
+ referencedRelation: "tbl_scheduled_messages"
1815
+ referencedColumns: ["sent_message_id"]
1816
+ },
1817
+ ]
1818
+ }
1767
1819
  tbl_scheduled_messages: {
1768
1820
  Row: {
1769
1821
  chat_id: string
1770
1822
  created_at: string
1823
+ is_repeat: boolean | null
1771
1824
  message_id: string | null
1772
1825
  message_payload: Json | null
1773
1826
  org_id: string
1774
1827
  org_phone: string | null
1775
1828
  performed_by: string | null
1829
+ repeat_config: Json | null
1776
1830
  scheduled_at: string
1777
1831
  sent_message_id: string
1778
1832
  status: boolean | null
@@ -1781,11 +1835,13 @@ export type Database = {
1781
1835
  Insert: {
1782
1836
  chat_id: string
1783
1837
  created_at?: string
1838
+ is_repeat?: boolean | null
1784
1839
  message_id?: string | null
1785
1840
  message_payload?: Json | null
1786
1841
  org_id: string
1787
1842
  org_phone?: string | null
1788
1843
  performed_by?: string | null
1844
+ repeat_config?: Json | null
1789
1845
  scheduled_at: string
1790
1846
  sent_message_id: string
1791
1847
  status?: boolean | null
@@ -1794,11 +1850,13 @@ export type Database = {
1794
1850
  Update: {
1795
1851
  chat_id?: string
1796
1852
  created_at?: string
1853
+ is_repeat?: boolean | null
1797
1854
  message_id?: string | null
1798
1855
  message_payload?: Json | null
1799
1856
  org_id?: string
1800
1857
  org_phone?: string | null
1801
1858
  performed_by?: string | null
1859
+ repeat_config?: Json | null
1802
1860
  scheduled_at?: string
1803
1861
  sent_message_id?: string
1804
1862
  status?: boolean | null
package/types.ts CHANGED
@@ -109,6 +109,9 @@ export type OrgMetadata = {
109
109
  rules?: {
110
110
  limit?: number;
111
111
  }
112
+ ai?: {
113
+ flag_prompt?: string;
114
+ }
112
115
  };
113
116
 
114
117
  type AccessScopes = {