contactstudiocstools 1.0.268 → 1.0.269

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.
package/dist/module.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@contactstudio/cstools",
3
3
  "configKey": "CSTools",
4
- "version": "1.0.268"
4
+ "version": "1.0.269"
5
5
  }
@@ -1,4 +1,4 @@
1
- import { IDoubts, IMailing, IPauses, ISchedules, IUser, IChatContacts, INodes, IChatMessage, IFlows, IClientHistories, IPortfolioSchedules } from ".";
1
+ import { IDoubts, IMailing, IPauses, ISchedules, IUser, IChatContacts, INodes, IChatMessage, IFlows, IClientHistories, IPortfolioSchedules, IMessageDelivered, IMessageSeek, IMessageSeen, IChatSeenInteraction } from ".";
2
2
  export declare function IPortfolioSchedulesDTO(primitives: any[]): IPortfolioSchedules;
3
3
  export declare function IClientHistoriesDTO(primitives: any[]): IClientHistories;
4
4
  export declare function FlowsDTO(primitives: any[]): IFlows;
@@ -15,3 +15,31 @@ export declare function PausesDTO({ lista_pausa }: any): IPauses;
15
15
  export declare function DoubtsDTO(primitives: any[]): IDoubts;
16
16
  export declare function UserDTO(primitive: any): IUser;
17
17
  export declare function MailingDTO(primitives: any[]): IMailing;
18
+ export declare function MessageDeliveredDTO(primitive: any): IMessageDelivered;
19
+ export declare function MessageSeenDTO(primitive: any): IMessageSeen;
20
+ export declare function SeenMessageDTO(payload: IChatSeenInteraction): {
21
+ interaction_type: string;
22
+ company: string;
23
+ when: string;
24
+ room_id: string;
25
+ message_id: string;
26
+ user_defined_fields: {};
27
+ chat_trunk_id: null;
28
+ content: {
29
+ event_type: string;
30
+ who: {
31
+ label: string;
32
+ contact_point: string;
33
+ type: string;
34
+ };
35
+ event: {
36
+ message_id: string;
37
+ original_message_id: null;
38
+ original_timestamp: null;
39
+ description: null;
40
+ };
41
+ };
42
+ referenced_message: null;
43
+ original_message: null;
44
+ };
45
+ export declare function SeekRoomsDTO(primitive: any): IMessageSeek;
@@ -1,6 +1,7 @@
1
1
  import {
2
2
  EFieldTypes,
3
- EChatMessageTypes
3
+ EChatMessageTypes,
4
+ newUUID
4
5
  } from "./index.mjs";
5
6
  export function IPortfolioSchedulesDTO(primitives) {
6
7
  const schedules = [];
@@ -233,6 +234,62 @@ export function MailingDTO(primitives) {
233
234
  }
234
235
  return mailing;
235
236
  }
237
+ export function MessageDeliveredDTO(primitive) {
238
+ const { when, content } = primitive;
239
+ const messageDeliveredId = content?.event?.message_id;
240
+ return {
241
+ messageId: messageDeliveredId,
242
+ when: new Date(when),
243
+ primitive
244
+ };
245
+ }
246
+ export function MessageSeenDTO(primitive) {
247
+ const { when, content } = primitive;
248
+ const messageSeenId = content?.event?.message_id;
249
+ return {
250
+ messageId: messageSeenId,
251
+ when: new Date(when),
252
+ primitive
253
+ };
254
+ }
255
+ export function SeenMessageDTO(payload) {
256
+ const { company, roomID, nickname, name, seenMessageId } = payload;
257
+ return {
258
+ interaction_type: "event",
259
+ company,
260
+ when: (/* @__PURE__ */ new Date()).toISOString(),
261
+ room_id: roomID,
262
+ message_id: newUUID(),
263
+ user_defined_fields: {},
264
+ chat_trunk_id: null,
265
+ content: {
266
+ event_type: "message_seen",
267
+ who: {
268
+ label: name,
269
+ contact_point: nickname,
270
+ type: "human"
271
+ },
272
+ event: {
273
+ message_id: seenMessageId,
274
+ original_message_id: null,
275
+ original_timestamp: null,
276
+ description: null
277
+ }
278
+ },
279
+ referenced_message: null,
280
+ original_message: null
281
+ };
282
+ }
283
+ export function SeekRoomsDTO(primitive) {
284
+ const seekRoomsList = primitive.map((item) => {
285
+ return {
286
+ roomID: item?.room_id,
287
+ contactID: item?.contact_id,
288
+ primitive: item
289
+ };
290
+ });
291
+ return seekRoomsList?.reverse();
292
+ }
236
293
  function getFieldType({ combo, tipo }) {
237
294
  if (combo)
238
295
  return EFieldTypes.select;
@@ -140,8 +140,34 @@ export interface IChatMessage {
140
140
  type: EChatMessageTypes;
141
141
  who: string;
142
142
  text: string;
143
+ delivered?: Date;
144
+ seen?: Date;
143
145
  primitive?: any;
144
146
  }
147
+ export interface IMessageSeen {
148
+ messageId: string;
149
+ when: Date;
150
+ primitive: any;
151
+ }
152
+ export interface IChatInteraction {
153
+ roomID: string;
154
+ company: string;
155
+ nickname: string;
156
+ name: string;
157
+ }
158
+ export interface IChatSeenInteraction extends IChatInteraction {
159
+ seenMessageId: string;
160
+ }
161
+ export interface IMessageDelivered {
162
+ messageId: string;
163
+ when: Date;
164
+ primitive: any;
165
+ }
166
+ export interface IMessageSeek {
167
+ messageId: string;
168
+ when: Date;
169
+ primitive: any;
170
+ }
145
171
  export interface IChatMessages extends Array<IChatMessage> {
146
172
  }
147
173
  export interface IChatRooms {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "contactstudiocstools",
3
- "version": "1.0.268",
3
+ "version": "1.0.269",
4
4
  "description": "Nuxt Tools Module for ContactStudio",
5
5
  "type": "module",
6
6
  "exports": {