@periskope/types 0.6.147 → 0.6.148

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.
@@ -156,7 +156,8 @@ export type AssignTicketAction = {
156
156
  type: 'assign_ticket';
157
157
  delay: `${number} ${'seconds' | 'minutes' | 'hours' | 'days'}`;
158
158
  metadata: {
159
- email: string;
159
+ assignee: string;
160
+ round_robin: 'true' | 'false';
160
161
  };
161
162
  };
162
163
  export type CloseTicketAction = {
@@ -188,7 +189,8 @@ export type AssignChatAction = {
188
189
  type: 'assign_chat';
189
190
  delay: `${number} ${'seconds' | 'minutes' | 'hours' | 'days'}`;
190
191
  metadata: {
191
- email: string;
192
+ assignee: string;
193
+ round_robin: 'true' | 'false';
192
194
  };
193
195
  };
194
196
  export type ForwardMessageAction = {
@@ -259,7 +261,13 @@ export declare const ActionNameMap: Record<Action['type'], {
259
261
  }[] | null | 'org.custom_properties' | 'custom_property_values';
260
262
  label: string;
261
263
  placeholder: string;
264
+ info?: string;
262
265
  }>;
263
266
  validTriggers: Rule['trigger'][];
264
267
  }>;
268
+ export declare const editorVariables: Array<{
269
+ label: string;
270
+ value: string;
271
+ validTriggers: Rule['trigger'][];
272
+ }>;
265
273
  export {};
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
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.FilterNameMap = exports.isFilter = void 0;
3
+ exports.editorVariables = exports.ActionNameMap = exports.RuleNameMap = exports.isSendMessageAction = exports.FilterConditionMap = exports.ReactionVariableNameMap = exports.TicketVariableNameMap = exports.ChatVariableNameMap = exports.SenderVariableNameMap = exports.MessageVariableNameMap = exports.FilterNameMap = exports.isFilter = void 0;
4
4
  const isFilter = (filter) => {
5
5
  return (typeof filter === 'object' &&
6
6
  'id' in filter &&
@@ -178,7 +178,7 @@ exports.SenderVariableNameMap = {
178
178
  text: 'Sender Contact Phone',
179
179
  type: 'string',
180
180
  filters: ['EQ', 'NEQ'],
181
- placeholder: 'e.g. 919876543210@c.us'
181
+ placeholder: 'e.g. 919876543210@c.us',
182
182
  },
183
183
  'sender.labels': {
184
184
  text: 'Sender Labels',
@@ -237,7 +237,7 @@ exports.ChatVariableNameMap = {
237
237
  'chat.chat_name': {
238
238
  text: 'Chat Name',
239
239
  type: 'string',
240
- filters: ['EQ', 'NEQ'],
240
+ filters: ['EQ', 'NEQ', 'CONTAINS', 'NCONTAINS'],
241
241
  placeholder: 'e.g. Support Chat',
242
242
  },
243
243
  'chat.org_phone': {
@@ -259,7 +259,7 @@ exports.ChatVariableNameMap = {
259
259
  text: 'Chat Members',
260
260
  type: 'string',
261
261
  filters: ['CONTAINS', 'NCONTAINS'],
262
- placeholder: 'e.g. 919876543210'
262
+ placeholder: 'e.g. 919876543210',
263
263
  },
264
264
  'chat.labels': {
265
265
  text: 'Chat Labels',
@@ -271,7 +271,7 @@ exports.ChatVariableNameMap = {
271
271
  text: 'Chat ID',
272
272
  type: 'string',
273
273
  filters: ['EQ', 'NEQ'],
274
- placeholder: 'e.g. 12027747916749@c.us'
274
+ placeholder: 'e.g. 12027747916749@c.us',
275
275
  },
276
276
  'chat.chat_org_phones': {
277
277
  text: 'Chat Org Phones',
@@ -439,7 +439,7 @@ exports.TicketVariableNameMap = {
439
439
  text: 'Ticket Assignee',
440
440
  type: 'dropdown',
441
441
  value: 'org.members',
442
- filters: ['EQ', 'NEQ', "KNOWN", "NKNOWN"],
442
+ filters: ['EQ', 'NEQ', 'KNOWN', 'NKNOWN'],
443
443
  },
444
444
  'ticket.labels': {
445
445
  text: 'Ticket Labels',
@@ -505,7 +505,7 @@ exports.ReactionVariableNameMap = {
505
505
  text: 'Reaction Sender Phone',
506
506
  type: 'string',
507
507
  filters: ['EQ', 'NEQ'],
508
- placeholder: 'e.g. 919876543210@c.us'
508
+ placeholder: 'e.g. 919876543210@c.us',
509
509
  },
510
510
  'reaction.message_id': {
511
511
  text: 'Reaction Message ID',
@@ -631,7 +631,7 @@ exports.ActionNameMap = {
631
631
  'ticket.created',
632
632
  'reaction.added',
633
633
  'message.flagged',
634
- 'chat.label.updated'
634
+ 'chat.label.updated',
635
635
  ],
636
636
  },
637
637
  reply_to_message: {
@@ -680,7 +680,7 @@ exports.ActionNameMap = {
680
680
  'ticket.created',
681
681
  'reaction.added',
682
682
  'message.flagged',
683
- 'chat.label.updated'
683
+ 'chat.label.updated',
684
684
  ],
685
685
  },
686
686
  create_ticket: {
@@ -743,12 +743,24 @@ exports.ActionNameMap = {
743
743
  title: 'Assign Ticket',
744
744
  description: 'Assign a ticket',
745
745
  inputs: {
746
- email: {
747
- id: 'email',
746
+ round_robin: {
747
+ id: 'round_robin',
748
748
  type: 'dropdown',
749
+ value: [
750
+ { id: 'true', value: 'true', label: 'True' },
751
+ { id: 'false', value: 'false', label: 'False' },
752
+ ],
753
+ label: 'Enable Round Robin',
754
+ placeholder: 'Select...',
755
+ info: 'If enabled, the ticket will be assigned to the next available agent in the list',
756
+ },
757
+ assignee: {
758
+ id: 'email',
759
+ type: 'dynamic',
749
760
  value: 'org.members',
750
761
  label: 'Assignee',
751
762
  placeholder: 'Select assignee',
763
+ 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",
752
764
  },
753
765
  },
754
766
  validTriggers: ['ticket.updated', 'ticket.created'],
@@ -786,7 +798,7 @@ exports.ActionNameMap = {
786
798
  'ticket.updated',
787
799
  'ticket.created',
788
800
  'reaction.added',
789
- 'chat.label.updated'
801
+ 'chat.label.updated',
790
802
  ],
791
803
  },
792
804
  add_ticket_label: {
@@ -836,9 +848,20 @@ exports.ActionNameMap = {
836
848
  title: 'Assign Chat',
837
849
  description: 'Assign a chat',
838
850
  inputs: {
839
- email: {
840
- id: 'email',
851
+ round_robin: {
852
+ id: 'round_robin',
841
853
  type: 'dropdown',
854
+ value: [
855
+ { id: 'true', value: 'true', label: 'True' },
856
+ { id: 'false', value: 'false', label: 'False' },
857
+ ],
858
+ label: 'Enable Round Robin',
859
+ placeholder: 'Select...',
860
+ info: 'If enabled, the chat will be assigned to the next available agent in the list',
861
+ },
862
+ assignee: {
863
+ id: 'assignee',
864
+ type: 'dynamic',
842
865
  value: 'org.members',
843
866
  label: 'Assignee',
844
867
  placeholder: 'Select assignee',
@@ -851,7 +874,7 @@ exports.ActionNameMap = {
851
874
  'ticket.updated',
852
875
  'ticket.created',
853
876
  'reaction.added',
854
- 'chat.label.updated'
877
+ 'chat.label.updated',
855
878
  ],
856
879
  },
857
880
  forward_message: {
@@ -917,7 +940,46 @@ exports.ActionNameMap = {
917
940
  'ticket.created',
918
941
  'reaction.added',
919
942
  'message.flagged',
920
- 'chat.label.updated'
943
+ 'chat.label.updated',
921
944
  ],
922
945
  },
923
946
  };
947
+ exports.editorVariables = [
948
+ {
949
+ label: 'Message Body',
950
+ value: 'message.body',
951
+ validTriggers: [
952
+ 'message.created',
953
+ 'message.updated',
954
+ 'reaction.added',
955
+ 'message.flagged',
956
+ ],
957
+ },
958
+ {
959
+ label: 'Sender Name',
960
+ value: 'sender.contact_name',
961
+ validTriggers: [
962
+ 'message.created',
963
+ 'message.updated',
964
+ 'reaction.added',
965
+ 'message.flagged',
966
+ ],
967
+ },
968
+ {
969
+ label: 'Chat Name',
970
+ value: 'chat.chat_name',
971
+ validTriggers: [
972
+ 'message.created',
973
+ 'message.updated',
974
+ 'reaction.added',
975
+ 'message.flagged',
976
+ 'chat.created',
977
+ 'chat.label.updated',
978
+ ],
979
+ },
980
+ {
981
+ label: 'Ticket ID',
982
+ value: 'ticket.ticket_id',
983
+ validTriggers: ['ticket.updated', 'ticket.created'],
984
+ },
985
+ ];
@@ -2,31 +2,6 @@ export type Json = {
2
2
  [key: string]: any;
3
3
  } | any;
4
4
  export type Database = {
5
- graphql_public: {
6
- Tables: {
7
- [_ in never]: never;
8
- };
9
- Views: {
10
- [_ in never]: never;
11
- };
12
- Functions: {
13
- graphql: {
14
- Args: {
15
- operationName?: string;
16
- query?: string;
17
- variables?: Json;
18
- extensions?: Json;
19
- };
20
- Returns: Json;
21
- };
22
- };
23
- Enums: {
24
- [_ in never]: never;
25
- };
26
- CompositeTypes: {
27
- [_ in never]: never;
28
- };
29
- };
30
5
  internal: {
31
6
  Tables: {
32
7
  config: {
@@ -110,6 +85,42 @@ export type Database = {
110
85
  };
111
86
  Relationships: [];
112
87
  };
88
+ tbl_feature_flags: {
89
+ Row: {
90
+ created_at: string | null;
91
+ enabled: boolean | null;
92
+ excluded_orgs: string[] | null;
93
+ exclusive_to_orgs: string[] | null;
94
+ feature: string;
95
+ included_orgs: string[] | null;
96
+ percentage: number | null;
97
+ plans: string[] | null;
98
+ start_date: string | null;
99
+ };
100
+ Insert: {
101
+ created_at?: string | null;
102
+ enabled?: boolean | null;
103
+ excluded_orgs?: string[] | null;
104
+ exclusive_to_orgs?: string[] | null;
105
+ feature: string;
106
+ included_orgs?: string[] | null;
107
+ percentage?: number | null;
108
+ plans?: string[] | null;
109
+ start_date?: string | null;
110
+ };
111
+ Update: {
112
+ created_at?: string | null;
113
+ enabled?: boolean | null;
114
+ excluded_orgs?: string[] | null;
115
+ exclusive_to_orgs?: string[] | null;
116
+ feature?: string;
117
+ included_orgs?: string[] | null;
118
+ percentage?: number | null;
119
+ plans?: string[] | null;
120
+ start_date?: string | null;
121
+ };
122
+ Relationships: [];
123
+ };
113
124
  tbl_trigger_logs: {
114
125
  Row: {
115
126
  created_at: string;
@@ -718,39 +729,54 @@ export type Database = {
718
729
  assigned_to: string | null;
719
730
  chat_access: Json | null;
720
731
  chat_id: string;
732
+ chat_image: string | null;
733
+ chat_name: string | null;
721
734
  chat_org_phones: string[];
735
+ chat_type: string | null;
722
736
  custom_properties: Json | null;
723
737
  flag_count_map: Json | null;
724
738
  hubspot_metadata: Json | null;
725
739
  label_ids: Json | null;
740
+ latest_message_timestamp: string | null;
726
741
  org_id: string;
727
742
  unread_count: Json | null;
743
+ unread_count_map: Json | null;
728
744
  updated_at: string | null;
729
745
  };
730
746
  Insert: {
731
747
  assigned_to?: string | null;
732
748
  chat_access?: Json | null;
733
749
  chat_id: string;
750
+ chat_image?: string | null;
751
+ chat_name?: string | null;
734
752
  chat_org_phones?: string[];
753
+ chat_type?: string | null;
735
754
  custom_properties?: Json | null;
736
755
  flag_count_map?: Json | null;
737
756
  hubspot_metadata?: Json | null;
738
757
  label_ids?: Json | null;
758
+ latest_message_timestamp?: string | null;
739
759
  org_id: string;
740
760
  unread_count?: Json | null;
761
+ unread_count_map?: Json | null;
741
762
  updated_at?: string | null;
742
763
  };
743
764
  Update: {
744
765
  assigned_to?: string | null;
745
766
  chat_access?: Json | null;
746
767
  chat_id?: string;
768
+ chat_image?: string | null;
769
+ chat_name?: string | null;
747
770
  chat_org_phones?: string[];
771
+ chat_type?: string | null;
748
772
  custom_properties?: Json | null;
749
773
  flag_count_map?: Json | null;
750
774
  hubspot_metadata?: Json | null;
751
775
  label_ids?: Json | null;
776
+ latest_message_timestamp?: string | null;
752
777
  org_id?: string;
753
778
  unread_count?: Json | null;
779
+ unread_count_map?: Json | null;
754
780
  updated_at?: string | null;
755
781
  };
756
782
  Relationships: [];
@@ -1798,7 +1824,6 @@ export type Database = {
1798
1824
  is_exited: boolean | null;
1799
1825
  is_muted: boolean | null;
1800
1826
  label_ids: Json | null;
1801
- last_read_timestamp: string | null;
1802
1827
  latest_message: Json | null;
1803
1828
  member_add_mode: string | null;
1804
1829
  member_count: number | null;
@@ -2003,6 +2028,20 @@ export type Database = {
2003
2028
  };
2004
2029
  Returns: Json;
2005
2030
  };
2031
+ get_feature_flags: {
2032
+ Args: Record<PropertyKey, never>;
2033
+ Returns: {
2034
+ feature: string;
2035
+ enabled: boolean;
2036
+ plans: string[];
2037
+ excluded_orgs: string[];
2038
+ exclusive_to_orgs: string[];
2039
+ included_orgs: string[];
2040
+ percentage: number;
2041
+ start_date: string;
2042
+ created_at: string;
2043
+ }[];
2044
+ };
2006
2045
  get_integration_data: {
2007
2046
  Args: {
2008
2047
  org_id_input?: string;
@@ -2146,7 +2185,7 @@ export type Database = {
2146
2185
  enum_chat_colors: "#B4876E" | "#A5B337" | "#06CF9C" | "#25D366" | "#02A698" | "#7D9EF1" | "#007BFC" | "#5E47DE" | "#7F66FF" | "#9333EA" | "#FA6533" | "#C4532D" | "#DC2626" | "#FF2E74" | "#DB2777";
2147
2186
  enum_chat_tickets_status: "open" | "inprogress" | "closed" | "archived";
2148
2187
  enum_credit_transaction_type: "credit" | "debit";
2149
- enum_integration_name: "org.created" | "org.updated" | "org.member.created" | "org.member.updated" | "org.phone.created" | "org.phone.connected" | "org.phone.disconnected" | "org.subscription.trial_will_end" | "chat.created" | "chat.updated" | "chat.notification.created" | "message.created" | "message.updated" | "message.deleted" | "message.ack.updated" | "reaction.created" | "reaction.updated" | "ticket.created" | "ticket.updated" | "ticket.deleted" | "org.integrations.updated";
2188
+ enum_integration_name: "org.created" | "org.updated" | "org.member.created" | "org.member.updated" | "org.phone.created" | "org.phone.connected" | "org.phone.disconnected" | "org.subscription.trial_will_end" | "chat.created" | "chat.updated" | "chat.notification.created" | "message.created" | "message.updated" | "message.deleted" | "message.ack.updated" | "reaction.created" | "reaction.updated" | "ticket.created" | "ticket.updated" | "ticket.deleted" | "org.integrations.updated" | "message.flagged" | "message.unflagged";
2150
2189
  enum_integration_type: "zapier" | "pabbly" | "api" | "webhook" | "hubspot" | "freshdesk" | "slack" | "jira" | "salesforce" | "zohodesk" | "gsheets";
2151
2190
  enum_member_role: "admin" | "member";
2152
2191
  };
@@ -2228,6 +2267,7 @@ export type Database = {
2228
2267
  owner_id: string | null;
2229
2268
  path_tokens: string[] | null;
2230
2269
  updated_at: string | null;
2270
+ user_metadata: Json | null;
2231
2271
  version: string | null;
2232
2272
  };
2233
2273
  Insert: {
@@ -2241,6 +2281,7 @@ export type Database = {
2241
2281
  owner_id?: string | null;
2242
2282
  path_tokens?: string[] | null;
2243
2283
  updated_at?: string | null;
2284
+ user_metadata?: Json | null;
2244
2285
  version?: string | null;
2245
2286
  };
2246
2287
  Update: {
@@ -2254,6 +2295,7 @@ export type Database = {
2254
2295
  owner_id?: string | null;
2255
2296
  path_tokens?: string[] | null;
2256
2297
  updated_at?: string | null;
2298
+ user_metadata?: Json | null;
2257
2299
  version?: string | null;
2258
2300
  };
2259
2301
  Relationships: [
@@ -2275,6 +2317,7 @@ export type Database = {
2275
2317
  key: string;
2276
2318
  owner_id: string | null;
2277
2319
  upload_signature: string;
2320
+ user_metadata: Json | null;
2278
2321
  version: string;
2279
2322
  };
2280
2323
  Insert: {
@@ -2285,6 +2328,7 @@ export type Database = {
2285
2328
  key: string;
2286
2329
  owner_id?: string | null;
2287
2330
  upload_signature: string;
2331
+ user_metadata?: Json | null;
2288
2332
  version: string;
2289
2333
  };
2290
2334
  Update: {
@@ -2295,6 +2339,7 @@ export type Database = {
2295
2339
  key?: string;
2296
2340
  owner_id?: string | null;
2297
2341
  upload_signature?: string;
2342
+ user_metadata?: Json | null;
2298
2343
  version?: string;
2299
2344
  };
2300
2345
  Relationships: [
@@ -2431,6 +2476,10 @@ export type Database = {
2431
2476
  updated_at: string;
2432
2477
  }[];
2433
2478
  };
2479
+ operation: {
2480
+ Args: Record<PropertyKey, never>;
2481
+ Returns: string;
2482
+ };
2434
2483
  search: {
2435
2484
  Args: {
2436
2485
  prefix: string;
package/dist/types.d.ts CHANGED
@@ -134,6 +134,7 @@ export type ChatType = Merge<Tables<'view_chats'>, {
134
134
  };
135
135
  is_archived?: boolean;
136
136
  is_pinned?: boolean;
137
+ closed_at?: number;
137
138
  }>;
138
139
  export type MediaType = {
139
140
  path: string;
@@ -350,9 +351,11 @@ export declare enum IntegrationLogType {
350
351
  REACTION_UPDATED = "reaction.updated",
351
352
  NEW_TICKET = "ticket.created",
352
353
  TICKET_UPDATED = "ticket.updated",
353
- TICKET_DELETED = "ticket.deleted"
354
+ TICKET_DELETED = "ticket.deleted",
355
+ MESSAGE_FLAGGED = "message.flagged",
356
+ MESSAGE_UNFLAGGED = "message.unflagged"
354
357
  }
355
- export type IntegrationLogMetadataType<T extends IntegrationLogType> = T extends IntegrationLogType.NEW_TICKET | IntegrationLogType.TICKET_UPDATED ? TicketInfoType : T extends IntegrationLogType.NEW_CHAT ? Tables<'tbl_chats'> : T extends IntegrationLogType.NEW_MESSAGE | IntegrationLogType.MESSAGE_UPDATED | IntegrationLogType.MESSAGE_DELETED | IntegrationLogType.MESSAGE_ACK_UPDATED ? Tables<'tbl_chat_messages'> : T extends IntegrationLogType.REACTION_CREATED | IntegrationLogType.REACTION_UPDATED ? Tables<'tbl_chat_reactions'> : {
358
+ export type IntegrationLogMetadataType<T extends IntegrationLogType> = T extends IntegrationLogType.NEW_TICKET | IntegrationLogType.TICKET_UPDATED ? TicketInfoType : T extends IntegrationLogType.NEW_CHAT ? Tables<'tbl_chats'> : T extends IntegrationLogType.NEW_MESSAGE | IntegrationLogType.MESSAGE_UPDATED | IntegrationLogType.MESSAGE_DELETED | IntegrationLogType.MESSAGE_ACK_UPDATED | IntegrationLogType.MESSAGE_FLAGGED | IntegrationLogType.MESSAGE_UNFLAGGED ? Tables<'tbl_chat_messages'> : T extends IntegrationLogType.REACTION_CREATED | IntegrationLogType.REACTION_UPDATED ? Tables<'tbl_chat_reactions'> : {
356
359
  [key: string]: unknown;
357
360
  };
358
361
  export type IntegrationLogDetailsType<T extends IntegrationLogType> = OverrideProperties<Tables<'tbl_integration_logs'>, {
@@ -400,6 +403,9 @@ export type UserPreferences = {
400
403
  right_sidepanel_open: boolean;
401
404
  sync_wa_unread_count: boolean;
402
405
  pinned_chats: string[];
406
+ archived_chats: string[];
407
+ closed_chats: Record<string, number>;
408
+ periskope_chat_limit: number;
403
409
  };
404
410
  export type PollSendType = {
405
411
  pollName: string;
@@ -472,4 +478,5 @@ export type TicketRuleInfoType = {
472
478
  }>;
473
479
  message: MessageRuleInfoType['message'];
474
480
  };
481
+ export type FeatureFlagReturnType = Record<string, boolean>;
475
482
  export {};
package/dist/types.js CHANGED
@@ -69,4 +69,6 @@ var IntegrationLogType;
69
69
  IntegrationLogType["NEW_TICKET"] = "ticket.created";
70
70
  IntegrationLogType["TICKET_UPDATED"] = "ticket.updated";
71
71
  IntegrationLogType["TICKET_DELETED"] = "ticket.deleted";
72
+ IntegrationLogType["MESSAGE_FLAGGED"] = "message.flagged";
73
+ IntegrationLogType["MESSAGE_UNFLAGGED"] = "message.unflagged";
72
74
  })(IntegrationLogType || (exports.IntegrationLogType = IntegrationLogType = {}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@periskope/types",
3
- "version": "0.6.147",
3
+ "version": "0.6.148",
4
4
  "private": false,
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/rules.types.ts CHANGED
@@ -224,7 +224,6 @@ export const MessageVariableNameMap: Record<
224
224
  text: 'Message Flag Status',
225
225
  filters: ['IS'],
226
226
  type: 'boolean',
227
-
228
227
  },
229
228
  'message.has_quoted_msg': {
230
229
  text: 'Quoted Message',
@@ -326,7 +325,7 @@ export const SenderVariableNameMap: Record<
326
325
  text: 'Sender Contact Phone',
327
326
  type: 'string',
328
327
  filters: ['EQ', 'NEQ'],
329
- placeholder: 'e.g. 919876543210@c.us'
328
+ placeholder: 'e.g. 919876543210@c.us',
330
329
  },
331
330
  'sender.labels': {
332
331
  text: 'Sender Labels',
@@ -389,7 +388,7 @@ export const ChatVariableNameMap: Record<
389
388
  'chat.chat_name': {
390
389
  text: 'Chat Name',
391
390
  type: 'string',
392
- filters: ['EQ', 'NEQ'],
391
+ filters: ['EQ', 'NEQ', 'CONTAINS', 'NCONTAINS'],
393
392
  placeholder: 'e.g. Support Chat',
394
393
  },
395
394
  'chat.org_phone': {
@@ -411,7 +410,7 @@ export const ChatVariableNameMap: Record<
411
410
  text: 'Chat Members',
412
411
  type: 'string',
413
412
  filters: ['CONTAINS', 'NCONTAINS'],
414
- placeholder: 'e.g. 919876543210'
413
+ placeholder: 'e.g. 919876543210',
415
414
  },
416
415
  'chat.labels': {
417
416
  text: 'Chat Labels',
@@ -423,7 +422,7 @@ export const ChatVariableNameMap: Record<
423
422
  text: 'Chat ID',
424
423
  type: 'string',
425
424
  filters: ['EQ', 'NEQ'],
426
- placeholder: 'e.g. 12027747916749@c.us'
425
+ placeholder: 'e.g. 12027747916749@c.us',
427
426
  },
428
427
  'chat.chat_org_phones': {
429
428
  text: 'Chat Org Phones',
@@ -595,7 +594,7 @@ export const TicketVariableNameMap: Record<
595
594
  text: 'Ticket Assignee',
596
595
  type: 'dropdown',
597
596
  value: 'org.members',
598
- filters: ['EQ', 'NEQ', "KNOWN", "NKNOWN"],
597
+ filters: ['EQ', 'NEQ', 'KNOWN', 'NKNOWN'],
599
598
  },
600
599
  'ticket.labels': {
601
600
  text: 'Ticket Labels',
@@ -665,7 +664,7 @@ export const ReactionVariableNameMap: Record<
665
664
  text: 'Reaction Sender Phone',
666
665
  type: 'string',
667
666
  filters: ['EQ', 'NEQ'],
668
- placeholder: 'e.g. 919876543210@c.us'
667
+ placeholder: 'e.g. 919876543210@c.us',
669
668
  },
670
669
  'reaction.message_id': {
671
670
  text: 'Reaction Message ID',
@@ -761,7 +760,8 @@ export type AssignTicketAction = {
761
760
  type: 'assign_ticket';
762
761
  delay: `${number} ${'seconds' | 'minutes' | 'hours' | 'days'}`;
763
762
  metadata: {
764
- email: string;
763
+ assignee: string;
764
+ round_robin: 'true' | 'false';
765
765
  };
766
766
  };
767
767
 
@@ -797,7 +797,8 @@ export type AssignChatAction = {
797
797
  type: 'assign_chat';
798
798
  delay: `${number} ${'seconds' | 'minutes' | 'hours' | 'days'}`;
799
799
  metadata: {
800
- email: string;
800
+ assignee: string;
801
+ round_robin: 'true' | 'false';
801
802
  };
802
803
  };
803
804
 
@@ -984,6 +985,7 @@ export const ActionNameMap: Record<
984
985
  | 'custom_property_values';
985
986
  label: string;
986
987
  placeholder: string;
988
+ info?: string;
987
989
  }
988
990
  >;
989
991
  validTriggers: Rule['trigger'][];
@@ -1016,7 +1018,7 @@ export const ActionNameMap: Record<
1016
1018
  'ticket.created',
1017
1019
  'reaction.added',
1018
1020
  'message.flagged',
1019
- 'chat.label.updated'
1021
+ 'chat.label.updated',
1020
1022
  ],
1021
1023
  },
1022
1024
  reply_to_message: {
@@ -1065,7 +1067,7 @@ export const ActionNameMap: Record<
1065
1067
  'ticket.created',
1066
1068
  'reaction.added',
1067
1069
  'message.flagged',
1068
- 'chat.label.updated'
1070
+ 'chat.label.updated',
1069
1071
  ],
1070
1072
  },
1071
1073
  create_ticket: {
@@ -1128,12 +1130,24 @@ export const ActionNameMap: Record<
1128
1130
  title: 'Assign Ticket',
1129
1131
  description: 'Assign a ticket',
1130
1132
  inputs: {
1131
- email: {
1132
- id: 'email',
1133
+ round_robin: {
1134
+ id: 'round_robin',
1133
1135
  type: 'dropdown',
1136
+ value: [
1137
+ { id: 'true', value: 'true', label: 'True' },
1138
+ { id: 'false', value: 'false', label: 'False' },
1139
+ ],
1140
+ label: 'Enable Round Robin',
1141
+ placeholder: 'Select...',
1142
+ info: 'If enabled, the ticket will be assigned to the next available agent in the list',
1143
+ },
1144
+ assignee: {
1145
+ id: 'email',
1146
+ type: 'dynamic',
1134
1147
  value: 'org.members',
1135
1148
  label: 'Assignee',
1136
1149
  placeholder: 'Select assignee',
1150
+ 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",
1137
1151
  },
1138
1152
  },
1139
1153
  validTriggers: ['ticket.updated', 'ticket.created'],
@@ -1171,7 +1185,7 @@ export const ActionNameMap: Record<
1171
1185
  'ticket.updated',
1172
1186
  'ticket.created',
1173
1187
  'reaction.added',
1174
- 'chat.label.updated'
1188
+ 'chat.label.updated',
1175
1189
  ],
1176
1190
  },
1177
1191
  add_ticket_label: {
@@ -1221,9 +1235,20 @@ export const ActionNameMap: Record<
1221
1235
  title: 'Assign Chat',
1222
1236
  description: 'Assign a chat',
1223
1237
  inputs: {
1224
- email: {
1225
- id: 'email',
1238
+ round_robin: {
1239
+ id: 'round_robin',
1226
1240
  type: 'dropdown',
1241
+ value: [
1242
+ { id: 'true', value: 'true', label: 'True' },
1243
+ { id: 'false', value: 'false', label: 'False' },
1244
+ ],
1245
+ label: 'Enable Round Robin',
1246
+ placeholder: 'Select...',
1247
+ info: 'If enabled, the chat will be assigned to the next available agent in the list',
1248
+ },
1249
+ assignee: {
1250
+ id: 'assignee',
1251
+ type: 'dynamic',
1227
1252
  value: 'org.members',
1228
1253
  label: 'Assignee',
1229
1254
  placeholder: 'Select assignee',
@@ -1236,7 +1261,7 @@ export const ActionNameMap: Record<
1236
1261
  'ticket.updated',
1237
1262
  'ticket.created',
1238
1263
  'reaction.added',
1239
- 'chat.label.updated'
1264
+ 'chat.label.updated',
1240
1265
  ],
1241
1266
  },
1242
1267
  forward_message: {
@@ -1302,7 +1327,51 @@ export const ActionNameMap: Record<
1302
1327
  'ticket.created',
1303
1328
  'reaction.added',
1304
1329
  'message.flagged',
1305
- 'chat.label.updated'
1330
+ 'chat.label.updated',
1306
1331
  ],
1307
1332
  },
1308
1333
  };
1334
+
1335
+ export const editorVariables: Array<{
1336
+ label: string;
1337
+ value: string;
1338
+ validTriggers: Rule['trigger'][];
1339
+ }> = [
1340
+ {
1341
+ label: 'Message Body',
1342
+ value: 'message.body',
1343
+ validTriggers: [
1344
+ 'message.created',
1345
+ 'message.updated',
1346
+ 'reaction.added',
1347
+ 'message.flagged',
1348
+ ],
1349
+ },
1350
+ {
1351
+ label: 'Sender Name',
1352
+ value: 'sender.contact_name',
1353
+ validTriggers: [
1354
+ 'message.created',
1355
+ 'message.updated',
1356
+ 'reaction.added',
1357
+ 'message.flagged',
1358
+ ],
1359
+ },
1360
+ {
1361
+ label: 'Chat Name',
1362
+ value: 'chat.chat_name',
1363
+ validTriggers: [
1364
+ 'message.created',
1365
+ 'message.updated',
1366
+ 'reaction.added',
1367
+ 'message.flagged',
1368
+ 'chat.created',
1369
+ 'chat.label.updated',
1370
+ ],
1371
+ },
1372
+ {
1373
+ label: 'Ticket ID',
1374
+ value: 'ticket.ticket_id',
1375
+ validTriggers: ['ticket.updated', 'ticket.created'],
1376
+ },
1377
+ ];
package/supabase.types.ts CHANGED
@@ -1,31 +1,6 @@
1
1
  export type Json = { [key: string]: any } | any
2
2
 
3
3
  export type Database = {
4
- graphql_public: {
5
- Tables: {
6
- [_ in never]: never
7
- }
8
- Views: {
9
- [_ in never]: never
10
- }
11
- Functions: {
12
- graphql: {
13
- Args: {
14
- operationName?: string
15
- query?: string
16
- variables?: Json
17
- extensions?: Json
18
- }
19
- Returns: Json
20
- }
21
- }
22
- Enums: {
23
- [_ in never]: never
24
- }
25
- CompositeTypes: {
26
- [_ in never]: never
27
- }
28
- }
29
4
  internal: {
30
5
  Tables: {
31
6
  config: {
@@ -109,6 +84,42 @@ export type Database = {
109
84
  }
110
85
  Relationships: []
111
86
  }
87
+ tbl_feature_flags: {
88
+ Row: {
89
+ created_at: string | null
90
+ enabled: boolean | null
91
+ excluded_orgs: string[] | null
92
+ exclusive_to_orgs: string[] | null
93
+ feature: string
94
+ included_orgs: string[] | null
95
+ percentage: number | null
96
+ plans: string[] | null
97
+ start_date: string | null
98
+ }
99
+ Insert: {
100
+ created_at?: string | null
101
+ enabled?: boolean | null
102
+ excluded_orgs?: string[] | null
103
+ exclusive_to_orgs?: string[] | null
104
+ feature: string
105
+ included_orgs?: string[] | null
106
+ percentage?: number | null
107
+ plans?: string[] | null
108
+ start_date?: string | null
109
+ }
110
+ Update: {
111
+ created_at?: string | null
112
+ enabled?: boolean | null
113
+ excluded_orgs?: string[] | null
114
+ exclusive_to_orgs?: string[] | null
115
+ feature?: string
116
+ included_orgs?: string[] | null
117
+ percentage?: number | null
118
+ plans?: string[] | null
119
+ start_date?: string | null
120
+ }
121
+ Relationships: []
122
+ }
112
123
  tbl_trigger_logs: {
113
124
  Row: {
114
125
  created_at: string
@@ -723,39 +734,54 @@ export type Database = {
723
734
  assigned_to: string | null
724
735
  chat_access: Json | null
725
736
  chat_id: string
737
+ chat_image: string | null
738
+ chat_name: string | null
726
739
  chat_org_phones: string[]
740
+ chat_type: string | null
727
741
  custom_properties: Json | null
728
742
  flag_count_map: Json | null
729
743
  hubspot_metadata: Json | null
730
744
  label_ids: Json | null
745
+ latest_message_timestamp: string | null
731
746
  org_id: string
732
747
  unread_count: Json | null
748
+ unread_count_map: Json | null
733
749
  updated_at: string | null
734
750
  }
735
751
  Insert: {
736
752
  assigned_to?: string | null
737
753
  chat_access?: Json | null
738
754
  chat_id: string
755
+ chat_image?: string | null
756
+ chat_name?: string | null
739
757
  chat_org_phones?: string[]
758
+ chat_type?: string | null
740
759
  custom_properties?: Json | null
741
760
  flag_count_map?: Json | null
742
761
  hubspot_metadata?: Json | null
743
762
  label_ids?: Json | null
763
+ latest_message_timestamp?: string | null
744
764
  org_id: string
745
765
  unread_count?: Json | null
766
+ unread_count_map?: Json | null
746
767
  updated_at?: string | null
747
768
  }
748
769
  Update: {
749
770
  assigned_to?: string | null
750
771
  chat_access?: Json | null
751
772
  chat_id?: string
773
+ chat_image?: string | null
774
+ chat_name?: string | null
752
775
  chat_org_phones?: string[]
776
+ chat_type?: string | null
753
777
  custom_properties?: Json | null
754
778
  flag_count_map?: Json | null
755
779
  hubspot_metadata?: Json | null
756
780
  label_ids?: Json | null
781
+ latest_message_timestamp?: string | null
757
782
  org_id?: string
758
783
  unread_count?: Json | null
784
+ unread_count_map?: Json | null
759
785
  updated_at?: string | null
760
786
  }
761
787
  Relationships: []
@@ -1809,7 +1835,6 @@ export type Database = {
1809
1835
  is_exited: boolean | null
1810
1836
  is_muted: boolean | null
1811
1837
  label_ids: Json | null
1812
- last_read_timestamp: string | null
1813
1838
  latest_message: Json | null
1814
1839
  member_add_mode: string | null
1815
1840
  member_count: number | null
@@ -1955,19 +1980,19 @@ export type Database = {
1955
1980
  }
1956
1981
  get_chat_labels_data: {
1957
1982
  Args: {
1958
- org_id_input: string;
1959
- chat_ids_input?: string[];
1960
- };
1961
- Returns: Json[];
1962
- };
1983
+ org_id_input: string
1984
+ chat_ids_input?: string[]
1985
+ }
1986
+ Returns: Json[]
1987
+ }
1963
1988
  get_chat_rule_info: {
1964
1989
  Args: {
1965
- chat_id_input: string;
1966
- org_id_input: string;
1967
- org_phone_input: string;
1968
- };
1969
- Returns: Json;
1970
- };
1990
+ chat_id_input: string
1991
+ org_id_input: string
1992
+ org_phone_input: string
1993
+ }
1994
+ Returns: Json
1995
+ }
1971
1996
  get_chats: {
1972
1997
  Args: {
1973
1998
  org_id_input: string
@@ -2014,22 +2039,36 @@ export type Database = {
2014
2039
  }
2015
2040
  Returns: Json
2016
2041
  }
2042
+ get_feature_flags: {
2043
+ Args: Record<PropertyKey, never>
2044
+ Returns: {
2045
+ feature: string
2046
+ enabled: boolean
2047
+ plans: string[]
2048
+ excluded_orgs: string[]
2049
+ exclusive_to_orgs: string[]
2050
+ included_orgs: string[]
2051
+ percentage: number
2052
+ start_date: string
2053
+ created_at: string
2054
+ }[]
2055
+ }
2017
2056
  get_integration_data: {
2018
2057
  Args: {
2019
- org_id_input?: string;
2020
- };
2021
- Returns: Json;
2022
- };
2058
+ org_id_input?: string
2059
+ }
2060
+ Returns: Json
2061
+ }
2023
2062
  get_message_rule_info: {
2024
2063
  Args: {
2025
- message_id_input: string;
2026
- chat_id_input: string;
2027
- org_id_input: string;
2028
- org_phone_input: string;
2029
- sender_id_input: string;
2030
- };
2031
- Returns: Json;
2032
- };
2064
+ message_id_input: string
2065
+ chat_id_input: string
2066
+ org_id_input: string
2067
+ org_phone_input: string
2068
+ sender_id_input: string
2069
+ }
2070
+ Returns: Json
2071
+ }
2033
2072
  get_messages_notifications_reactions: {
2034
2073
  Args: {
2035
2074
  org_id_input: string
@@ -2053,22 +2092,22 @@ export type Database = {
2053
2092
  }
2054
2093
  get_org_phones: {
2055
2094
  Args: {
2056
- org_id_input?: string;
2057
- phone_id_input?: string;
2058
- };
2059
- Returns: Json;
2060
- };
2095
+ org_id_input?: string
2096
+ phone_id_input?: string
2097
+ }
2098
+ Returns: Json
2099
+ }
2061
2100
  get_reaction_rule_info: {
2062
2101
  Args: {
2063
- reaction_id_input: string;
2064
- message_id_input: string;
2065
- chat_id_input: string;
2066
- org_id_input: string;
2067
- org_phone_input: string;
2068
- sender_id_input: string;
2069
- };
2070
- Returns: Json;
2071
- };
2102
+ reaction_id_input: string
2103
+ message_id_input: string
2104
+ chat_id_input: string
2105
+ org_id_input: string
2106
+ org_phone_input: string
2107
+ sender_id_input: string
2108
+ }
2109
+ Returns: Json
2110
+ }
2072
2111
  get_team_metrics_between_dates: {
2073
2112
  Args: {
2074
2113
  org_id_input: string
@@ -2080,22 +2119,22 @@ export type Database = {
2080
2119
  }
2081
2120
  get_ticket_info: {
2082
2121
  Args: {
2083
- ticket_id_input?: string;
2084
- org_id_input?: string;
2085
- chat_id_input?: string;
2086
- unique_message_id_input?: string;
2087
- };
2088
- Returns: Json;
2089
- };
2122
+ ticket_id_input?: string
2123
+ org_id_input?: string
2124
+ chat_id_input?: string
2125
+ unique_message_id_input?: string
2126
+ }
2127
+ Returns: Json
2128
+ }
2090
2129
  get_ticket_rule_info: {
2091
2130
  Args: {
2092
- ticket_id_input: string;
2093
- unique_message_id_input: string;
2094
- chat_id_input: string;
2095
- org_id_input: string;
2096
- };
2097
- Returns: Json;
2098
- };
2131
+ ticket_id_input: string
2132
+ unique_message_id_input: string
2133
+ chat_id_input: string
2134
+ org_id_input: string
2135
+ }
2136
+ Returns: Json
2137
+ }
2099
2138
  get_universal_search_result: {
2100
2139
  Args: {
2101
2140
  search_category_input: string
@@ -2194,6 +2233,8 @@ export type Database = {
2194
2233
  | "ticket.updated"
2195
2234
  | "ticket.deleted"
2196
2235
  | "org.integrations.updated"
2236
+ | "message.flagged"
2237
+ | "message.unflagged"
2197
2238
  enum_integration_type:
2198
2239
  | "zapier"
2199
2240
  | "pabbly"
@@ -2286,6 +2327,7 @@ export type Database = {
2286
2327
  owner_id: string | null
2287
2328
  path_tokens: string[] | null
2288
2329
  updated_at: string | null
2330
+ user_metadata: Json | null
2289
2331
  version: string | null
2290
2332
  }
2291
2333
  Insert: {
@@ -2299,6 +2341,7 @@ export type Database = {
2299
2341
  owner_id?: string | null
2300
2342
  path_tokens?: string[] | null
2301
2343
  updated_at?: string | null
2344
+ user_metadata?: Json | null
2302
2345
  version?: string | null
2303
2346
  }
2304
2347
  Update: {
@@ -2312,6 +2355,7 @@ export type Database = {
2312
2355
  owner_id?: string | null
2313
2356
  path_tokens?: string[] | null
2314
2357
  updated_at?: string | null
2358
+ user_metadata?: Json | null
2315
2359
  version?: string | null
2316
2360
  }
2317
2361
  Relationships: [
@@ -2333,6 +2377,7 @@ export type Database = {
2333
2377
  key: string
2334
2378
  owner_id: string | null
2335
2379
  upload_signature: string
2380
+ user_metadata: Json | null
2336
2381
  version: string
2337
2382
  }
2338
2383
  Insert: {
@@ -2343,6 +2388,7 @@ export type Database = {
2343
2388
  key: string
2344
2389
  owner_id?: string | null
2345
2390
  upload_signature: string
2391
+ user_metadata?: Json | null
2346
2392
  version: string
2347
2393
  }
2348
2394
  Update: {
@@ -2353,6 +2399,7 @@ export type Database = {
2353
2399
  key?: string
2354
2400
  owner_id?: string | null
2355
2401
  upload_signature?: string
2402
+ user_metadata?: Json | null
2356
2403
  version?: string
2357
2404
  }
2358
2405
  Relationships: [
@@ -2489,6 +2536,10 @@ export type Database = {
2489
2536
  updated_at: string
2490
2537
  }[]
2491
2538
  }
2539
+ operation: {
2540
+ Args: Record<PropertyKey, never>
2541
+ Returns: string
2542
+ }
2492
2543
  search: {
2493
2544
  Args: {
2494
2545
  prefix: string
@@ -2600,3 +2651,5 @@ export type Enums<
2600
2651
  : PublicEnumNameOrOptions extends keyof PublicSchema["Enums"]
2601
2652
  ? PublicSchema["Enums"][PublicEnumNameOrOptions]
2602
2653
  : never
2654
+
2655
+
package/types.ts CHANGED
@@ -156,6 +156,7 @@ export type ChatType = Merge<
156
156
  flag_count_map?: { [key: string]: number };
157
157
  is_archived?: boolean;
158
158
  is_pinned?: boolean;
159
+ closed_at?: number;
159
160
  }
160
161
  >;
161
162
 
@@ -471,6 +472,8 @@ export enum IntegrationLogType {
471
472
  NEW_TICKET = 'ticket.created',
472
473
  TICKET_UPDATED = 'ticket.updated',
473
474
  TICKET_DELETED = 'ticket.deleted',
475
+ MESSAGE_FLAGGED = 'message.flagged',
476
+ MESSAGE_UNFLAGGED = 'message.unflagged',
474
477
  }
475
478
 
476
479
  export type IntegrationLogMetadataType<T extends IntegrationLogType> =
@@ -483,6 +486,8 @@ export type IntegrationLogMetadataType<T extends IntegrationLogType> =
483
486
  | IntegrationLogType.MESSAGE_UPDATED
484
487
  | IntegrationLogType.MESSAGE_DELETED
485
488
  | IntegrationLogType.MESSAGE_ACK_UPDATED
489
+ | IntegrationLogType.MESSAGE_FLAGGED
490
+ | IntegrationLogType.MESSAGE_UNFLAGGED
486
491
  ? Tables<'tbl_chat_messages'>
487
492
  : T extends
488
493
  | IntegrationLogType.REACTION_CREATED
@@ -553,6 +558,9 @@ export type UserPreferences = {
553
558
  right_sidepanel_open: boolean;
554
559
  sync_wa_unread_count: boolean;
555
560
  pinned_chats: string[];
561
+ archived_chats: string[];
562
+ closed_chats: Record<string, number>;
563
+ periskope_chat_limit: number;
556
564
  };
557
565
 
558
566
  /* ----------------------------- POLL VOTE INFO ----------------------------- */
@@ -750,3 +758,4 @@ export type TicketRuleInfoType = {
750
758
  >;
751
759
  message: MessageRuleInfoType['message'];
752
760
  };
761
+ export type FeatureFlagReturnType = Record<string, boolean>;