evo360-types 1.3.9 → 1.3.10

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.
@@ -90,7 +90,7 @@ exports.zDepartmentSchema = zod_schemas_1.zFireDocSchema // Extend from FireDocS
90
90
  .passthrough();
91
91
  exports.zOfficeSchema = zod_schemas_1.zFireDocSchema // Extend from FireDocSchema
92
92
  .extend({
93
- code: zod_1.z.string().min(1).max(10),
93
+ code: zod_1.z.string().min(1).max(20),
94
94
  name: zod_1.z.string().min(1).max(255),
95
95
  timezone: zod_1.z.string().nullable().optional(),
96
96
  company_name: zod_1.z.string().nullable().optional().default(""),
@@ -93,7 +93,7 @@ export const zDepartmentSchema = zFireDocSchema // Extend from FireDocSchema
93
93
 
94
94
  export const zOfficeSchema = zFireDocSchema // Extend from FireDocSchema
95
95
  .extend({
96
- code: z.string().min(1).max(10),
96
+ code: z.string().min(1).max(20),
97
97
  name: z.string().min(1).max(255),
98
98
  timezone: z.string().nullable().optional(),
99
99
  company_name: z.string().nullable().optional().default(""),
@@ -1 +1,4 @@
1
- export {};
1
+ export declare const EVO_MESSAGES_APP = "evo-messages";
2
+ export declare const MSG_CHANNELS_COLLECTION = "channels";
3
+ export declare const MSG_CONVERSATIONS_COLLECTION = "conversations";
4
+ export declare const MSG_MESSAGES_COLLECTION = "messages";
@@ -1,2 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MSG_MESSAGES_COLLECTION = exports.MSG_CONVERSATIONS_COLLECTION = exports.MSG_CHANNELS_COLLECTION = exports.EVO_MESSAGES_APP = void 0;
4
+ //EVO Messages Application Doc
5
+ exports.EVO_MESSAGES_APP = "evo-messages";
6
+ exports.MSG_CHANNELS_COLLECTION = "channels";
7
+ exports.MSG_CONVERSATIONS_COLLECTION = "conversations";
8
+ exports.MSG_MESSAGES_COLLECTION = "messages";
@@ -0,0 +1,6 @@
1
+ //EVO Messages Application Doc
2
+ export const EVO_MESSAGES_APP = "evo-messages";
3
+
4
+ export const MSG_CHANNELS_COLLECTION = "channels";
5
+ export const MSG_CONVERSATIONS_COLLECTION = "conversations";
6
+ export const MSG_MESSAGES_COLLECTION = "messages";
@@ -0,0 +1,48 @@
1
+ export * from "./fb_collections";
2
+ import type { FirestoreDocumentReference, IFireDoc, ITag } from "../shared";
3
+ export type ChannelType = "whatsapp" | "email" | "ig_dm" | "fb_messenger";
4
+ export declare enum IChannelType {
5
+ Whatsapp = "whatsapp",// Whatsapp message
6
+ Email = "email",// Email
7
+ Ig_dm = "ig_dm",// Instagram Direct Message
8
+ Fb_messenger = "fb_messenger"
9
+ }
10
+ export type Provider = "chatbee";
11
+ export declare enum IProvider {
12
+ ChatBee = "chatbee"
13
+ }
14
+ export type MessageDirection = "INBOUND" | "OUTBOUND";
15
+ export declare enum IMessageDirection {
16
+ Inbound = "inbound",// Message received
17
+ Outbound = "outbound"
18
+ }
19
+ export interface IConversation extends IFireDoc {
20
+ leadId: string;
21
+ leadRef?: FirestoreDocumentReference;
22
+ channel: ChannelType;
23
+ provider: Provider;
24
+ contactId: string;
25
+ lastMessage?: {
26
+ /** Resumo da última mensagem p/ exibir na lista */ snippet: string;
27
+ at: Date;
28
+ };
29
+ unreadCount?: number;
30
+ tags?: ITag[] | null;
31
+ [key: string]: unknown;
32
+ }
33
+ export interface IMessage extends IFireDoc {
34
+ conversationId: string;
35
+ leadId: string;
36
+ channel: ChannelType;
37
+ provider: Provider;
38
+ direction: MessageDirection;
39
+ contactId: string;
40
+ payload: {
41
+ text?: string;
42
+ attachmentUrl?: string;
43
+ };
44
+ createdAt: Date;
45
+ receivedAt: Date;
46
+ sentAt?: Date;
47
+ readAt?: Date;
48
+ }
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.IMessageDirection = exports.IProvider = exports.IChannelType = void 0;
18
+ __exportStar(require("./fb_collections"), exports);
19
+ var IChannelType;
20
+ (function (IChannelType) {
21
+ IChannelType["Whatsapp"] = "whatsapp";
22
+ IChannelType["Email"] = "email";
23
+ IChannelType["Ig_dm"] = "ig_dm";
24
+ IChannelType["Fb_messenger"] = "fb_messenger";
25
+ })(IChannelType || (exports.IChannelType = IChannelType = {}));
26
+ var IProvider;
27
+ (function (IProvider) {
28
+ IProvider["ChatBee"] = "chatbee";
29
+ })(IProvider || (exports.IProvider = IProvider = {}));
30
+ var IMessageDirection;
31
+ (function (IMessageDirection) {
32
+ IMessageDirection["Inbound"] = "inbound";
33
+ IMessageDirection["Outbound"] = "outbound";
34
+ })(IMessageDirection || (exports.IMessageDirection = IMessageDirection = {}));
@@ -0,0 +1,59 @@
1
+ export * from "./fb_collections";
2
+ import type { FirestoreDocumentReference, IFireDoc, ITag } from "../shared";
3
+
4
+ export type ChannelType = "whatsapp" | "email" | "ig_dm" | "fb_messenger";
5
+
6
+ export enum IChannelType {
7
+ Whatsapp = "whatsapp", // Whatsapp message
8
+ Email = "email", // Email
9
+ Ig_dm = "ig_dm", // Instagram Direct Message
10
+ Fb_messenger = "fb_messenger", // Facebook Messenger
11
+ }
12
+
13
+ export type Provider = "chatbee";
14
+
15
+ export enum IProvider {
16
+ ChatBee = "chatbee", // ChatBee
17
+ }
18
+
19
+ export type MessageDirection = "INBOUND" | "OUTBOUND";
20
+
21
+ export enum IMessageDirection {
22
+ Inbound = "inbound", // Message received
23
+ Outbound = "outbound", // Message sent
24
+ }
25
+
26
+ // ───────── Conversation ─────────
27
+ export interface IConversation extends IFireDoc {
28
+ leadId: string; // FK do lead (string)
29
+ leadRef?: FirestoreDocumentReference; // Opcional: referência Firestore p/ o lead (facilita queries com .get())
30
+ channel: ChannelType; // Canal lógico (WhatsApp, Email, …)
31
+ provider: Provider; // Nome técnico do provedor (ChatBee, Twilio, …)
32
+ contactId: string; // Identificador de contato dentro do canal (telefone, e-mail, etc.) */;
33
+ lastMessage?: {
34
+ /** Resumo da última mensagem p/ exibir na lista */ snippet: string;
35
+ at: Date;
36
+ };
37
+ unreadCount?: number; // Contador de não-lidas para UX
38
+ tags?: ITag[] | null; // Tags livres (igual às demais entidades)
39
+ [key: string]: unknown;
40
+ }
41
+
42
+ // ───────── Message (canônico: MessageV1) ─────────
43
+ export interface IMessage extends IFireDoc {
44
+ conversationId: string; // PK da conversa onde mora
45
+ leadId: string; // FK para o lead (redundância útil p/ analytics)
46
+ channel: ChannelType; // Canal lógico (WhatsApp, Email, …)
47
+ provider: Provider; // Nome técnico do provedor (ChatBee, Twilio, …)
48
+ direction: MessageDirection;
49
+ contactId: string; // Identificador de contato dentro do canal (telefone, e-mail, etc.)
50
+ // Conteúdo normalizado
51
+ payload: {
52
+ text?: string;
53
+ attachmentUrl?: string; // mídia salva em GCS
54
+ };
55
+ createdAt: Date; // Horário gerado no dispositivo / provedor
56
+ receivedAt: Date; // Horário em que chegou na plataforma
57
+ sentAt?: Date; // Horário em que foi enviado (caso seja OUTBOUND)
58
+ readAt?: Date; // Horário em que foi lido (caso seja INBOUND)
59
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "evo360-types",
3
- "version": "1.3.9",
3
+ "version": "1.3.10",
4
4
  "description": "HREVO360 Shared Types",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",