@nomalism-com/types 0.45.16 → 0.45.18

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,9 +1,16 @@
1
1
  import type { IChatBalloon } from '../../stock/chat/interfaces';
2
+ import type { ILastTicketCalledTodayByChannel, IRemainingTodayTickets } from '../../tickets/tickets/interfaces';
2
3
  import type { IPublicDocument, IPublicFindBySubscriberId, ITags } from '../../ui/portal/interface';
3
4
  export declare const Route = "ws";
4
5
  export interface IEvent {
5
6
  type: string;
6
7
  }
8
+ export interface IPing extends IEvent {
9
+ type: 'ping';
10
+ }
11
+ export interface IPong extends IEvent {
12
+ type: 'pong';
13
+ }
7
14
  export interface IChatTranslationUpdated extends IEvent {
8
15
  type: 'chat.translation.updated';
9
16
  chat_id: string;
@@ -47,13 +54,19 @@ export interface IDocumentUpdated extends IEvent {
47
54
  type: 'document.updated';
48
55
  document: IPublicDocument;
49
56
  }
50
- export interface IPing extends IEvent {
51
- type: 'ping';
57
+ export type ChatSocketEvent = IChatTranslationUpdated | IChatMessageCreated | IChatMessageUpdated | IChatMessageDeleted | IChatFileDeleted | IChatReadStateUpdated | IChatTagsUpdated | IPersonaUpdated | IDocumentUpdated | IPing | IPong;
58
+ export interface ITicketsChanged extends IEvent {
59
+ type: 'tickets.changed';
60
+ last_tickets_called_today_by_channel: ILastTicketCalledTodayByChannel[];
61
+ remaining_today_tickets_to_call: IRemainingTodayTickets[];
52
62
  }
53
- export interface IPong extends IEvent {
54
- type: 'pong';
63
+ export type TicketsSocketEvent = ITicketsChanged | IPing | IPong;
64
+ export interface IPushNotificationEvent extends IEvent {
65
+ type: 'push_notification';
66
+ counts: Record<string, number>;
67
+ timestamp?: string;
55
68
  }
56
- export type ChatSocketEvent = IChatTranslationUpdated | IChatMessageCreated | IChatMessageUpdated | IChatMessageDeleted | IChatFileDeleted | IChatReadStateUpdated | IChatTagsUpdated | IPersonaUpdated | IDocumentUpdated | IPing | IPong;
69
+ export type SideMenuSocketEvent = IPushNotificationEvent | IPing | IPong;
57
70
  export interface SocketOptions<T extends IEvent> {
58
71
  token: string;
59
72
  onEvent: (evt: T) => void;
@@ -1,6 +1,5 @@
1
1
  import joi from 'joi';
2
2
  import { messages } from './messages';
3
- import type { ILastTicketCalledTodayByChannel, IRemainingTodayTickets } from '../modules/tickets/tickets/interfaces';
4
3
  import type { IGetUserData } from '../modules/integration/googleSheets/interfaces';
5
4
  import type { IDocumentTypeUserType } from '../modules/supply/documentType/interfaces';
6
5
  import type { IScheduleType } from '../modules/supply/schedule/interface';
@@ -11,8 +10,8 @@ import type { File } from './entities/stock';
11
10
  import type { ProjectInfo } from './entities/integration';
12
11
  import type { IAttachment } from '../modules/supply/externalDocumentHeader/interface';
13
12
  import type { Persona } from './entities/user';
14
- import type { IChatBalloon, ITranslateRequest } from '../modules/stock/chat/interfaces';
15
- import type { IPublicDocument, IPublicFindBySubscriberId, ITags } from '../modules/ui/portal/interface';
13
+ import type { ITranslateRequest } from '../modules/stock/chat/interfaces';
14
+ import type { ChatSocketEvent, TicketsSocketEvent } from '../modules/view/webSocket/interfaces';
16
15
  export { messages };
17
16
  type CreatedAt = 'created_at';
18
17
  type UpdatedAt = 'updated_at';
@@ -134,56 +133,6 @@ export declare const IUserSendEmailDocumentTemplateEnum: {
134
133
  };
135
134
  export type IUserSendEmailDocumentTemplate = (typeof IUserSendEmailDocumentTemplateEnum)[keyof typeof IUserSendEmailDocumentTemplateEnum];
136
135
  export declare const IUserSendEmailDocumentTemplateTypes: string[];
137
- export interface ChatTranslationUpdatedEvent {
138
- type: 'chat.translation.updated';
139
- chat_id: string;
140
- translation: string;
141
- target_language_id: string;
142
- }
143
- export interface ChatMessageCreatedEvent {
144
- type: 'chat.message.created';
145
- balloon: IChatBalloon;
146
- }
147
- export interface ChatMessageUpdatedEvent {
148
- type: 'chat.message.updated';
149
- chat_id: string;
150
- patch: Partial<NonNullable<IChatBalloon['chat']>>;
151
- }
152
- export interface ChatMessageDeletedEvent {
153
- type: 'chat.message.deleted';
154
- chat_id: string;
155
- }
156
- export interface ChatFileDeletedEvent {
157
- type: 'chat.file.deleted';
158
- file_id: string;
159
- }
160
- export interface ChatReadStateUpdatedEvent {
161
- type: 'chat.read_state.updated';
162
- chat_document_header_id: string;
163
- client_read: boolean;
164
- chat_id?: string;
165
- file_id?: string;
166
- }
167
- export interface ChatTagsUpdatedEvent {
168
- type: 'chat.tags.updated';
169
- chat_document_header_id: string;
170
- tags: ITags[];
171
- }
172
- export interface PersonaUpdatedEvent {
173
- type: 'persona.updated';
174
- persona: NonNullable<IPublicFindBySubscriberId['persona']>;
175
- }
176
- export interface DocumentUpdatedEvent {
177
- type: 'document.updated';
178
- document: IPublicDocument;
179
- }
180
- export interface PingEvent {
181
- type: 'ping';
182
- }
183
- export interface PongEvent {
184
- type: 'pong';
185
- }
186
- export type ChatSocketEvent = ChatTranslationUpdatedEvent | ChatMessageCreatedEvent | ChatMessageUpdatedEvent | ChatMessageDeletedEvent | ChatFileDeletedEvent | ChatReadStateUpdatedEvent | ChatTagsUpdatedEvent | PersonaUpdatedEvent | DocumentUpdatedEvent | PingEvent | PongEvent;
187
136
  export declare enum IBrokerTopic {
188
137
  tickets_change = "tickets_change",
189
138
  push_notification = "push_notification",
@@ -267,10 +216,7 @@ export type IBrokerTopicPayload = {
267
216
  [IBrokerTopic.remove_access]: {
268
217
  email: string;
269
218
  };
270
- [IBrokerTopic.tickets_change]: {
271
- last_tickets_called_today_by_channel: ILastTicketCalledTodayByChannel[];
272
- remaining_today_tickets_to_call: IRemainingTodayTickets[];
273
- };
219
+ [IBrokerTopic.tickets_change]: TicketsSocketEvent;
274
220
  [IBrokerTopic.google_sheet_set_permissions]: {
275
221
  file_id: string;
276
222
  email: string;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@nomalism-com/types",
3
3
  "description": "A nomalism package with all necessary types and validations for developing APIs",
4
- "version": "0.45.16",
4
+ "version": "0.45.18",
5
5
  "author": "Nomalism <it.nomalism@gmail.com> (https://nomalism.com/)",
6
6
  "license": "UNLICENSED",
7
7
  "type": "module",