Compare commits

..

No commits in common. "940a6c1f97b21c9c31c8d0d5d908ad6cab8940ae" and "bf2dc3de03526dee5a96f200bc4ab67619d7ab6a" have entirely different histories.

56 changed files with 579 additions and 1121 deletions

View File

@ -17,12 +17,10 @@
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@sentry/node": "^5.29.2", "@sentry/node": "^5.29.2",
"@socket.io/redis-adapter": "^7.2.0",
"@types/fluent-ffmpeg": "^2.1.21", "@types/fluent-ffmpeg": "^2.1.21",
"@types/pino": "^6.3.4", "@types/pino": "^6.3.4",
"axios": "^1.2.3", "axios": "^1.2.3",
"bcryptjs": "^2.4.3", "bcryptjs": "^2.4.3",
"compression": "^1.7.4",
"cookie-parser": "^1.4.5", "cookie-parser": "^1.4.5",
"cors": "^2.8.5", "cors": "^2.8.5",
"cpf-cnpj-validator": "^1.0.3", "cpf-cnpj-validator": "^1.0.3",
@ -44,13 +42,12 @@
"pino": "^6.9.0", "pino": "^6.9.0",
"pino-pretty": "^9.1.1", "pino-pretty": "^9.1.1",
"qrcode-terminal": "^0.12.0", "qrcode-terminal": "^0.12.0",
"redis": "^4.6.13",
"reflect-metadata": "^0.1.13", "reflect-metadata": "^0.1.13",
"sequelize": "^5.22.3", "sequelize": "^5.22.3",
"sequelize-cli": "^5.5.1", "sequelize-cli": "^5.5.1",
"sequelize-typescript": "^1.1.0", "sequelize-typescript": "^1.1.0",
"sharp": "^0.32.5", "sharp": "^0.32.5",
"socket.io": "^4.7.5", "socket.io": "^3.0.5",
"socket.io-client": "^4.5.4", "socket.io-client": "^4.5.4",
"uuid": "^8.3.2", "uuid": "^8.3.2",
"whatsapp-web.js": "github:pedroslopez/whatsapp-web.js", "whatsapp-web.js": "github:pedroslopez/whatsapp-web.js",
@ -59,7 +56,6 @@
"devDependencies": { "devDependencies": {
"@types/bcryptjs": "^2.4.2", "@types/bcryptjs": "^2.4.2",
"@types/bluebird": "^3.5.32", "@types/bluebird": "^3.5.32",
"@types/compression": "^1.7.5",
"@types/cookie-parser": "^1.4.2", "@types/cookie-parser": "^1.4.2",
"@types/cors": "^2.8.7", "@types/cors": "^2.8.7",
"@types/express": "^4.17.13", "@types/express": "^4.17.13",
@ -67,7 +63,6 @@
"@types/faker": "^5.1.3", "@types/faker": "^5.1.3",
"@types/jest": "^26.0.15", "@types/jest": "^26.0.15",
"@types/jsonwebtoken": "^8.5.0", "@types/jsonwebtoken": "^8.5.0",
"@types/lodash": "4.14",
"@types/multer": "^1.4.4", "@types/multer": "^1.4.4",
"@types/node": "^14.11.8", "@types/node": "^14.11.8",
"@types/supertest": "^2.0.10", "@types/supertest": "^2.0.10",

View File

@ -11,7 +11,6 @@ import uploadConfig from "./config/upload";
import AppError from "./errors/AppError"; import AppError from "./errors/AppError";
import routes from "./routes"; import routes from "./routes";
import { logger } from "./utils/logger"; import { logger } from "./utils/logger";
import compression from 'compression';
Sentry.init({ dsn: process.env.SENTRY_DSN }); Sentry.init({ dsn: process.env.SENTRY_DSN });
@ -24,7 +23,6 @@ app.use(
}) })
); );
app.use(compression());
app.use(cookieParser()); app.use(cookieParser());
app.use(express.json()); app.use(express.json());
app.use(Sentry.Handlers.requestHandler()); app.use(Sentry.Handlers.requestHandler());

View File

@ -41,10 +41,7 @@ import { getSettingValue } from "../helpers/WhaticketSettings";
import ListWhatsAppsNumber from "../services/WhatsappService/ListWhatsAppsNumber"; import ListWhatsAppsNumber from "../services/WhatsappService/ListWhatsAppsNumber";
import SettingTicket from "../models/SettingTicket"; import SettingTicket from "../models/SettingTicket";
import { Op } from "sequelize"; import { Op } from "sequelize";
import { del, get, getKeysByPattern, set, setCBPWhatsappOfficial } from "../helpers/RedisClient"; import { del, get, set } from "../helpers/RedisClient";
import axios from "axios";
interface WhatsappData { interface WhatsappData {
name: string; name: string;
@ -217,48 +214,6 @@ export const weebhook = async (
return res.sendStatus(500); return res.sendStatus(500);
} }
if(
req?.body?.entry?.length > 0 &&
req?.body?.entry[0]?.changes?.length > 0 &&
req?.body?.entry[0]?.changes?.length > 0 &&
req?.body?.entry[0]?.changes[0]?.value?.statuses?.length>0 &&
req?.body?.entry[0]?.changes[0]?.value?.statuses[0]?.recipient_id &&
req?.body?.entry[0]?.changes[0]?.value?.statuses[0]?.conversation?.origin?.type){
const company_phone = req?.body?.entry[0]?.changes[0]?.value?.metadata?.display_phone_number
const client_phone = req?.body?.entry[0]?.changes[0]?.value?.statuses[0]?.recipient_id
const conversation_type = req?.body?.entry[0]?.changes[0]?.value?.statuses[0].conversation.origin.type
const billable = req?.body?.entry[0]?.changes[0]?.value?.statuses[0].pricing.billable
const pricing_model = req?.body?.entry[0]?.changes[0]?.value?.statuses[0].pricing.pricing_model
const conversation_type_category = req?.body?.entry[0]?.changes[0]?.value?.statuses[0].pricing.category
const msg_id = req?.body?.entry[0]?.changes[0]?.value?.statuses[0].id
const _contact_to_exist = await get({
key: "whatsapp:*",
value: `${company_phone}`
});
if(_contact_to_exist){
const lst_services_cbp = await getKeysByPattern(company_phone, client_phone, conversation_type_category)
if(lst_services_cbp && lst_services_cbp.length > 0){
for(const item of lst_services_cbp){
if(!item.split(':').includes(conversation_type_category)){
await setCBP(msg_id, company_phone, client_phone, conversation_type_category, billable, pricing_model)
}
}
}else{
await setCBP(msg_id, company_phone, client_phone, conversation_type_category, billable, pricing_model)
}
console.log('_contact_to_exist: ', _contact_to_exist)
}
}
// MESSAGE // MESSAGE
if (req.body.object) { if (req.body.object) {
if ( if (
@ -422,11 +377,9 @@ export const store = async (req: Request, res: Response): Promise<Response> => {
} else if (!isOfficial) { } else if (!isOfficial) {
phoneNumberId = ""; phoneNumberId = "";
wabaId = ""; wabaId = "";
//number = ""; number = "";
}
if(!number){
number = getNumberFromName(name)
} }
let invalidPhoneName = validatePhoneName(name); let invalidPhoneName = validatePhoneName(name);
if (invalidPhoneName) { if (invalidPhoneName) {
@ -526,11 +479,9 @@ export const update = async (
} else if (!isOfficial) { } else if (!isOfficial) {
whatsappData.phoneNumberId = ""; whatsappData.phoneNumberId = "";
whatsappData.wabaId = ""; whatsappData.wabaId = "";
//whatsappData.number = ""; whatsappData.number = "";
}
if(!whatsappData?.number){
whatsappData.number = getNumberFromName(whatsappData.name)
} }
const { whatsapp, oldDefaultWhatsapp } = await UpdateWhatsAppService({ const { whatsapp, oldDefaultWhatsapp } = await UpdateWhatsAppService({
whatsappData, whatsappData,
whatsappId whatsappId
@ -675,56 +626,3 @@ const checkWhatsAppData = ({
return { message: "urlApi is required!" }; return { message: "urlApi is required!" };
} }
}; };
async function setCBP(msg_id: any, company_phone: any, client_phone: any, conversation_type_category: any, billable:string, pricing_model:string) {
const message = await Message.findByPk(msg_id)
if (message) {
await setCBPWhatsappOfficial(company_phone, client_phone, conversation_type_category, msg_id, `${message.ticketId}`)
await sendToAPIUsage(msg_id,
company_phone,
client_phone,
conversation_type_category,
`${message.ticketId}`,
billable,
pricing_model
)
}
}
async function sendToAPIUsage(msg_id: any, company_phone: any, client_phone: any, conversation_type_category: any, ticketId: any, billable:string, pricing_model:string) {
const data = JSON.stringify({
"companyId": process.env.COMPANY_ID || company_phone,
"companyPhone": company_phone,
"clientPhone": client_phone,
"provider": "meta",
"product": "whatsapp",
"type": conversation_type_category,
"msgId": msg_id,
"ticketId": `${ticketId}`,
"ticketUrl": `${process.env.FRONTEND_URL}/tickets/${ticketId}`,
"billable": billable,
"pricing_model": pricing_model
});
const config = {
method: 'post',
url: 'http://172.31.187.24:6008/api/v1/billing/usage-whatsapp',
headers: {
'Authorization': 'Bearer 2ivck10D3o9qAZi0pkKudVDl9bdEVXY2s8gdxZ0jYgL1DZWTgDz6wDiIjlWgYmJtVOoqf0b42ZTLBRrfo8WoAaScRsujz3jQUNXdchSg0o43YilZGmVhheGJNAeIQRknHEll4nRJ7avcFgmDGoYbEey7TSC8EHS4Z3gzeufYYSfnKNDBwwzBURIQrTOxYFe3tBHsGOzwnuD2lU5tnEx7tr2XRO4zRNYeNY4lMBOFM0mRuyAe4kuqTrKXmJ8As200',
'Content-Type': 'application/json'
},
data: data
};
try {
const response = await axios(config);
console.log('Response from whatsapp api usage: ',JSON.stringify(response.data));
} catch (error) {
console.log('Error on try register the whatsapp usage: ', error);
}
}

View File

@ -158,46 +158,6 @@ export async function findObject(
return result; return result;
} }
export async function setCBPWhatsappOfficial(
company_phone:string,
client_phone:string,
conversation_type:string,
msg_id: string,
ticketId?: string
) {
const key = `company_phone:${company_phone}:client_phone:${client_phone}:conversation_type:${conversation_type}`;
const result = await redis.hmset(
key,
"company_phone",
company_phone,
"client_phone",
client_phone,
"conversation_type",
conversation_type,
"msg_id",
msg_id,
"ticketId",
ticketId
);
await redis.expire(key, 86400);
}
export async function getKeysByPattern(company_phone:string, client_phone:string, conversation_type:string,) {
const pattern = `company_phone:${company_phone}:client_phone:${client_phone}:conversation_type:${conversation_type}*`;
const keys = [];
let cursor = "0";
do {
const result = await redis.scan(cursor, "MATCH", pattern, "COUNT", 100);
cursor = result[0];
keys.push(...result[1]);
} while (cursor !== "0");
return keys;
}
export async function deleteObject( export async function deleteObject(
whatsappId: string, whatsappId: string,
contactId: string, contactId: string,

View File

@ -29,23 +29,23 @@ async function controllByNumber() {
number = JSON.parse(number); number = JSON.parse(number);
ticketId = JSON.parse(ticketId); ticketId = JSON.parse(ticketId);
const index = controll?.findIndex((c: any) => c.number == number); const index = controll.findIndex((c: any) => c.number == number);
if (index == -1) { if (index == -1) {
controll?.push({ ticketId, number }); controll.push({ ticketId, number });
} }
} }
const ticketIds = controll?.map((c: any) => c.ticketId); const ticketIds = controll.map((c: any) => c.ticketId);
//console.log("=======> ticketIds: ", ticketIds); console.log("=======> ticketIds: ", ticketIds);
for (const ticketId of ticketIds) { for (const ticketId of ticketIds) {
const ticket: any = await Ticket.findByPk(ticketId); const ticket: any = await Ticket.findByPk(ticketId);
if(ticket){ if(ticket){
const { status } = ticket; const { status } = ticket;
if (status && status == "pending") { if (status == "pending") {
await UpdateTicketService({ await UpdateTicketService({
ticketData: { statusChatEnd: uuidv4() }, ticketData: { statusChatEnd: uuidv4() },
ticketId: ticket.id ticketId: ticket.id

View File

@ -3,9 +3,6 @@ import { Server } from "http";
import AppError from "../errors/AppError"; import AppError from "../errors/AppError";
import { logger } from "../utils/logger"; import { logger } from "../utils/logger";
import { createAdapter } from "@socket.io/redis-adapter";
import { createClient } from 'redis';
import { v4 as uuidv4 } from "uuid"; import { v4 as uuidv4 } from "uuid";
import ListUserParamiterService from "../services/UserServices/ListUserParamiterService"; import ListUserParamiterService from "../services/UserServices/ListUserParamiterService";
import { import {
@ -30,7 +27,6 @@ import {
} from "../services/WbotServices/wbotMessageListener"; } from "../services/WbotServices/wbotMessageListener";
import { join } from "path"; import { join } from "path";
import Whatsapp from "../models/Whatsapp"; import Whatsapp from "../models/Whatsapp";
import { get } from "../helpers/RedisClient"
let count: number = 0; let count: number = 0;
let listOnline: any[] = []; let listOnline: any[] = [];
@ -46,32 +42,16 @@ let dateTime = splitDateTime(
new Date(format(new Date(), "yyyy-MM-dd HH:mm:ss", { locale: ptBR })) new Date(format(new Date(), "yyyy-MM-dd HH:mm:ss", { locale: ptBR }))
); );
const pubClient = createClient({ url: 'redis://172.31.187.29:6379' });
const subClient = pubClient.duplicate();
pubClient.connect().catch(console.error);
subClient.connect().catch(console.error);
export const initIO = (httpServer: Server): SocketIO => { export const initIO = (httpServer: Server): SocketIO => {
io = new SocketIO(httpServer, { io = new SocketIO(httpServer, {
cors: { cors: {
origin: process.env.FRONTEND_URL, origin: process.env.FRONTEND_URL
//allowedHeaders: ["my-custom-header"],
//credentials: true
}, },
maxHttpBufferSize: 1e8, maxHttpBufferSize: 1e8
// pingInterval: 25000,
// pingTimeout: 60000,
// adapter: createAdapter(pubClient, subClient)
}); });
io.on("connection", socket => { io.on("connection", socket => {
logger.info("Client Connected"); //logger.info("Client Connected");
socket.on("joinWhatsSession", (whatsappId: string) => { socket.on("joinWhatsSession", (whatsappId: string) => {
//logger.info(`A client joined a joinWhatsSession channel: ${whatsappId}`); //logger.info(`A client joined a joinWhatsSession channel: ${whatsappId}`);
@ -127,7 +107,6 @@ export const initIO = (httpServer: Server): SocketIO => {
socket.on("online", (userId: any) => { socket.on("online", (userId: any) => {
// console.log('userId: ', userId) // console.log('userId: ', userId)
return
obj.uuid = uuidv4(); obj.uuid = uuidv4();
if (userId.logoutUserId) { if (userId.logoutUserId) {
@ -254,18 +233,13 @@ export const initIO = (httpServer: Server): SocketIO => {
if (rooms && rooms.size == 2 && ![...rooms][1].startsWith("session_")) if (rooms && rooms.size == 2 && ![...rooms][1].startsWith("session_"))
return; return;
let whatsappIds = await get({ let whatsappIds: any = await Whatsapp.findAll({
key: "whatsapp:*", attributes: ["id"],
parse: true raw: true
}); });
// let whatsappIds: any = await Whatsapp.findAll({
// attributes: ["id"],
// raw: true
// });
if (whatsappIds && whatsappIds.length > 0) { if (whatsappIds && whatsappIds.length > 0) {
// whatsappIds = whatsappIds.map((e: any) => `${e.id}`); whatsappIds = whatsappIds.map((e: any) => `${e.id}`);
console.log( console.log(
"whatsappIds whatsappIds whatsappIds whatsappIds whatsappIds: ", "whatsappIds whatsappIds whatsappIds whatsappIds whatsappIds: ",

View File

@ -1,6 +1,5 @@
import { getIO } from "../../libs/socket"; import { getIO } from "../../libs/socket";
import Contact from "../../models/Contact"; import Contact from "../../models/Contact";
const { Op } = require('sequelize');
import { createOrUpdateContactCache } from '../../helpers/ContactsCache' import { createOrUpdateContactCache } from '../../helpers/ContactsCache'
import { tr } from "date-fns/locale"; import { tr } from "date-fns/locale";
@ -36,37 +35,15 @@ const CreateOrUpdateContactService = async ({
const io = getIO(); const io = getIO();
let contact: Contact | null; let contact: Contact | null;
const firstFourDigits = number.slice(0, 4);
const lastEightDigits = number.slice(-8);
//const numberFormat = number?.length === 13 && number[4] == '9' ? number.slice(0, 4) + number.slice(0, 4) : number; contact = await Contact.findOne({ where: { number } });
//contact = await Contact.findOne({ where: { number } });
contact = await Contact.findOne({
where: {
[Op.and]: [
{
number: {
[Op.like]: `%${firstFourDigits}%`
}
},
{
number: {
[Op.like]: `%${lastEightDigits}%`
}
}
]
}
});
if (contact) { if (contact) {
if(contact.number == number){
contact.update({ profilePicUrl }); contact.update({ profilePicUrl });
// TEST DEL
await createOrUpdateContactCache(`contact:${contact.id}`, { profilePicUrl }) await createOrUpdateContactCache(`contact:${contact.id}`, { profilePicUrl })
} else{ //
contact.update({ profilePicUrl, number });
await createOrUpdateContactCache(`contact:${contact.id}`, { profilePicUrl, number })
}
io.emit("contact", { io.emit("contact", {
action: "update", action: "update",

View File

@ -101,6 +101,8 @@ const FindOrCreateTicketServiceBot = async (
unreadMessages unreadMessages
}); });
console.log("lxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
await dialogFlowStartContext(contact, ticket, botInfo); await dialogFlowStartContext(contact, ticket, botInfo);
} }
} }
@ -126,6 +128,8 @@ const FindOrCreateTicketServiceBot = async (
phoneNumberId phoneNumberId
}); });
console.log("yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy");
await dialogFlowStartContext(contact, ticket, botInfo); await dialogFlowStartContext(contact, ticket, botInfo);
} }

View File

@ -613,15 +613,6 @@ const transferTicket = async (
} else if (typeof queueName == "number") { } else if (typeof queueName == "number") {
queue = queues[queueName]; queue = queues[queueName];
} }
const whatsapp: any = await whatsappInfo(ticket?.whatsappId);
const outService = await outOfService(whatsapp?.number);
if (outService.length > 0) {
const { type, msg: msgOutService } = outService[0];
console.log(`${type} message ignored on queue`);
botSendMessage(ticket, `\u200e${msgOutService}`);
return;
}
if (queue) { if (queue) {
await assingContactByQueue(ticket, queue.id); await assingContactByQueue(ticket, queue.id);
@ -761,6 +752,8 @@ const handleMessage = async (
// console.log('----------> chat: ', JSON.parse(JSON.stringify(chat))) // console.log('----------> chat: ', JSON.parse(JSON.stringify(chat)))
console
if (chat.isGroup) { if (chat.isGroup) {
// let msgGroupContact; // let msgGroupContact;
@ -1242,11 +1235,7 @@ const menu = async (userTyped: string, whatsappId: any, contactId: any, ticket:
let option = data.find((o: any) => o.id == currentMenu[3]); let option = data.find((o: any) => o.id == currentMenu[3]);
response = data.find((o: any) => o.id == option.idnext); response = data.find((o: any) => o.id == option.idnext);
if (response){ if (response) response.value = `Seja bem-vindo(a) ao WhatsApp Gertec.\nQual o seu nome?`;
const whatsapp = await whatsappCache(ticket.whatsappId);
if (whatsapp.number === '551121736500') response.value = `Seja bem-vindo(a) ao WhatsApp Gertec.\nQual o seu nome?`;
else response.value = `Seja bem-vindo(a) ao WhatsApp GéRun.\nQual o seu nome?`;
}
}else response = data.find((o: any) => o.idmaster == menuOption.id); }else response = data.find((o: any) => o.idmaster == menuOption.id);
if (response) { if (response) {

View File

@ -43,7 +43,7 @@
"yup": "^0.32.8" "yup": "^0.32.8"
}, },
"scripts": { "scripts": {
"start": "PORT=3331 react-scripts start", "start": "react-scripts start",
"build": "react-scripts build", "build": "react-scripts build",
"test": "react-scripts test", "test": "react-scripts test",
"eject": "react-scripts eject" "eject": "react-scripts eject"

View File

@ -45,7 +45,7 @@ import {
import ptBrLocale from "date-fns/locale/pt-BR"; import ptBrLocale from "date-fns/locale/pt-BR";
import esLocale from 'date-fns/locale/es';
const ResponsiveTimePickers = (props) => { const ResponsiveTimePickers = (props) => {
@ -63,7 +63,7 @@ const ResponsiveTimePickers = (props) => {
<Fragment> <Fragment>
<MuiPickersUtilsProvider utils={DateFnsUtils} locale={esLocale}> <MuiPickersUtilsProvider utils={DateFnsUtils} locale={ptBrLocale}>
<TimePicker <TimePicker
variant="outline" variant="outline"
label={props.title} label={props.title}

View File

@ -11,7 +11,6 @@ import { TimePicker, DatePicker } from 'formik-material-ui-pickers'
import DateFnsUtils from '@date-io/date-fns' import DateFnsUtils from '@date-io/date-fns'
import ptBrLocale from "date-fns/locale/pt-BR" import ptBrLocale from "date-fns/locale/pt-BR"
import esLocale from 'date-fns/locale/es';
import { WhatsAppsContext } from "../../context/WhatsApp/WhatsAppsContext" import { WhatsAppsContext } from "../../context/WhatsApp/WhatsAppsContext"
@ -258,7 +257,7 @@ const ConfigModal = ({ open, onClose, change }) => {
}} }}
> >
{({ values, touched, errors, isSubmitting }) => ( {({ values, touched, errors, isSubmitting }) => (
<MuiPickersUtilsProvider utils={DateFnsUtils} locale={esLocale}> <MuiPickersUtilsProvider utils={DateFnsUtils} locale={ptBrLocale}>
<Form> <Form>
<DialogContent dividers> <DialogContent dividers>
@ -300,7 +299,7 @@ const ConfigModal = ({ open, onClose, change }) => {
<Field <Field
component={TimePicker} component={TimePicker}
name="startTimeBus" name="startTimeBus"
label={i18n.t('configModal.titles.startService')} label="Inicio atendimento"
ampm={false} ampm={false}
openTo="hours" openTo="hours"
views={['hours', 'minutes',]} views={['hours', 'minutes',]}
@ -310,7 +309,7 @@ const ConfigModal = ({ open, onClose, change }) => {
<Field <Field
component={TimePicker} component={TimePicker}
name="endTimeBus" name="endTimeBus"
label={i18n.t('configModal.titles.endService')} label="Fim atendimento"
ampm={false} ampm={false}
openTo="hours" openTo="hours"
views={['hours', 'minutes',]} views={['hours', 'minutes',]}
@ -326,13 +325,13 @@ const ConfigModal = ({ open, onClose, change }) => {
checked={values.businessTimeEnable} checked={values.businessTimeEnable}
/> />
} }
label={i18n.t('configModal.titles.enableDisable')} /> label={'Ativar/Desativar'} />
</div> </div>
<div> <div>
<Field <Field
as={TextField} as={TextField}
label={i18n.t('configModal.titles.outOfHours')} label={'Mensagem fora do horário de atendimento'}
type="messageBus" type="messageBus"
multiline multiline
rows={5} rows={5}
@ -356,7 +355,7 @@ const ConfigModal = ({ open, onClose, change }) => {
<Field <Field
component={TimePicker} component={TimePicker}
name="startTimeBusSaturday" name="startTimeBusSaturday"
label={i18n.t('configModal.titles.startService')} label="Inicio atendimentos"
ampm={false} ampm={false}
openTo="hours" openTo="hours"
views={['hours', 'minutes',]} views={['hours', 'minutes',]}
@ -366,7 +365,7 @@ const ConfigModal = ({ open, onClose, change }) => {
<Field <Field
component={TimePicker} component={TimePicker}
name="endTimeBusSaturday" name="endTimeBusSaturday"
label={i18n.t('configModal.titles.endService')} label="Fim atendimento"
ampm={false} ampm={false}
openTo="hours" openTo="hours"
views={['hours', 'minutes',]} views={['hours', 'minutes',]}
@ -382,13 +381,13 @@ const ConfigModal = ({ open, onClose, change }) => {
checked={values.businessTimeEnableSaturday} checked={values.businessTimeEnableSaturday}
/> />
} }
label={i18n.t('configModal.titles.enableDisable')} /> label={'Ativar/Desativar'} />
</div> </div>
<div> <div>
<Field <Field
as={TextField} as={TextField}
label={i18n.t('configModal.titles.outOfHoursSaturday')} label={'Mensagem fora do horário de atendimento sábado'}
type="messageBusSaturday" type="messageBusSaturday"
multiline multiline
rows={5} rows={5}
@ -431,13 +430,13 @@ const ConfigModal = ({ open, onClose, change }) => {
checked={values.enableWeekendMessage} checked={values.enableWeekendMessage}
/> />
} }
label={i18n.t('configModal.titles.enableDisable')} label={'Ativar/Desativar'}
/> />
</div> </div>
<div> <div>
<Field <Field
as={TextField} as={TextField}
label={i18n.t('configModal.titles.forTheWeekend')} label={'Mensagem para final de semana'}
type="weekendMessage" type="weekendMessage"
multiline multiline
rows={5} rows={5}
@ -462,7 +461,7 @@ const ConfigModal = ({ open, onClose, change }) => {
<Field <Field
component={DatePicker} component={DatePicker}
name="holidayDate" name="holidayDate"
label={i18n.t('configModal.titles.holiday')} label="Data do feriado"
format="dd/MM/yyyy" format="dd/MM/yyyy"
fullWidth fullWidth
/> />
@ -476,13 +475,13 @@ const ConfigModal = ({ open, onClose, change }) => {
checked={values.holidayDateEnable} checked={values.holidayDateEnable}
/> />
} }
label={i18n.t('configModal.titles.enableDisable')} label={'Ativar/Desativar'}
/> />
</div> </div>
<div> <div>
<Field <Field
as={TextField} as={TextField}
label={i18n.t('configModal.titles.holidayMessage')} label={'Mensagem para feriado'}
type="holidayDateMessage" type="holidayDateMessage"
multiline multiline
rows={5} rows={5}
@ -525,13 +524,13 @@ const ConfigModal = ({ open, onClose, change }) => {
checked={values.ticketExpirationEnable} checked={values.ticketExpirationEnable}
/> />
} }
label={i18n.t('configModal.titles.enableDisable')} label={'Ativar/Desativar'}
/> />
</div> </div>
<div> <div>
<Field <Field
as={TextField} as={TextField}
label={i18n.t('configModal.titles.inactivityMessage')} label={'Mensagem por falta de atividade no atendimento'}
type="ticketExpirationMsg" type="ticketExpirationMsg"
multiline multiline
rows={5} rows={5}
@ -570,7 +569,7 @@ const ConfigModal = ({ open, onClose, change }) => {
size={24} size={24}
className={classes.buttonProgress} className={classes.buttonProgress}
/> />
) : i18n.t('configModal.titles.save')} ) : 'Salvar'}
</Button> </Button>
</DialogActions> </DialogActions>
</Form> </Form>

View File

@ -199,7 +199,7 @@ const ContactCreateTicketModal = ({ modalOpen, onClose, contactId }) => {
style={{ style={{
background: id !== itemHover ? "white" : color, background: id !== itemHover ? "white" : color,
}} }}
>{name}</MenuItem> >{name[0].toUpperCase() + name.slice(1).toLowerCase()}</MenuItem>
))} ))}
</Select> </Select>
</FormControl> </FormControl>

View File

@ -23,8 +23,6 @@ import CheckCircleIcon from "@material-ui/icons/CheckCircle";
import ErrorIcon from "@material-ui/icons/Error"; import ErrorIcon from "@material-ui/icons/Error";
import RemoveCircleIcon from "@material-ui/icons/RemoveCircle"; import RemoveCircleIcon from "@material-ui/icons/RemoveCircle";
import { i18n } from "../../translate/i18n";
const CardUser = ({ classes, usersOnlineInfo, logout }) => { const CardUser = ({ classes, usersOnlineInfo, logout }) => {
const [search, setSearch] = React.useState(""); const [search, setSearch] = React.useState("");
@ -48,14 +46,14 @@ const CardUser = ({ classes, usersOnlineInfo, logout }) => {
color="primary" color="primary"
style={{ marginBottom: "16px" }} style={{ marginBottom: "16px" }}
> >
{i18n.t('dashboard.titles.listUser')} Lista de Usuários
</Typography> </Typography>
</Grid> </Grid>
<Grid item sx={8} width="100%"> <Grid item sx={8} width="100%">
<Box sx={{ marginBottom: 2, display: "flex", gap: "12px" }}> <Box sx={{ marginBottom: 2, display: "flex", gap: "12px" }}>
<TextField <TextField
id="outlined-basic" id="outlined-basic"
label={i18n.t('dashboard.titles.user')} label="Usuário"
variant="standard" variant="standard"
value={search} value={search}
onChange={handlesearch} onChange={handlesearch}
@ -72,7 +70,7 @@ const CardUser = ({ classes, usersOnlineInfo, logout }) => {
<MenuItem value={null}>Todos</MenuItem> <MenuItem value={null}>Todos</MenuItem>
<MenuItem value={"online"}>Online</MenuItem> <MenuItem value={"online"}>Online</MenuItem>
<MenuItem value={"offline"}>Offline</MenuItem> <MenuItem value={"offline"}>Offline</MenuItem>
<MenuItem value={"not"}>{i18n.t('dashboard.titles.notEnter')}</MenuItem> <MenuItem value={"not"}>Não entrou</MenuItem>
</Select> </Select>
</FormControl> </FormControl>
</Box> </Box>
@ -163,7 +161,7 @@ const CardUser = ({ classes, usersOnlineInfo, logout }) => {
<Typography component="p" color="textPrimary" paragraph> <Typography component="p" color="textPrimary" paragraph>
{user.sumOnlineTime && user.sumOnlineTime.sum {user.sumOnlineTime && user.sumOnlineTime.sum
? user.sumOnlineTime.sum ? user.sumOnlineTime.sum
: i18n.t('dashboard.titles.notEnterToday')} : "Não entrou Hoje"}
</Typography> </Typography>
</Typography> </Typography>
</CardContent> </CardContent>

View File

@ -75,7 +75,7 @@ const TableUser = ({ classes, usersOnlineInfo, logout }) => {
<MenuItem value={null}>Todos</MenuItem> <MenuItem value={null}>Todos</MenuItem>
<MenuItem value={"online"}>Online</MenuItem> <MenuItem value={"online"}>Online</MenuItem>
<MenuItem value={"offline"}>Offline</MenuItem> <MenuItem value={"offline"}>Offline</MenuItem>
<MenuItem value={"not"}>{i18n.t('dashboard.titles.notEnter')}</MenuItem> <MenuItem value={"not"}>Não entrou</MenuItem>
</Select> </Select>
</FormControl> </FormControl>
</Box> </Box>
@ -221,7 +221,7 @@ const TableUser = ({ classes, usersOnlineInfo, logout }) => {
</div> </div>
</TableCell> </TableCell>
<TableCell> <TableCell>
{user.sumOnlineTime ? user.sumOnlineTime.sum : i18n.t('dashboard.titles.notEnter')} {user.sumOnlineTime ? user.sumOnlineTime.sum : "Não entrou"}
</TableCell> </TableCell>
<TableCell> <TableCell>
{user.statusOnline && user.statusOnline.status === "online" ? ( {user.statusOnline && user.statusOnline.status === "online" ? (

View File

@ -1,9 +1,7 @@
import React, { useContext, useState, useEffect, useReducer, useRef } from "react" import React, { useContext, useState, useEffect, useReducer, useRef } from "react"
import { isSameDay, parseISO, format } from "date-fns" import { isSameDay, parseISO, format } from "date-fns"
//import openSocket from "socket.io-client" import openSocket from "socket.io-client"
import { socket } from "../../services/socket"
import clsx from "clsx" import clsx from "clsx"
import { AuthContext } from "../../context/Auth/AuthContext" import { AuthContext } from "../../context/Auth/AuthContext"
@ -440,18 +438,11 @@ const MessagesList = ({ ticketId, isGroup }) => {
}, [pageNumber, ticketId]) }, [pageNumber, ticketId])
useEffect(() => { useEffect(() => {
//const socket = openSocket(process.env.REACT_APP_BACKEND_URL) const socket = openSocket(process.env.REACT_APP_BACKEND_URL)
const onConnectMessagesList = () => { socket.on("connect", () => socket.emit("joinChatBox", ticketId))
socket.emit("joinChatBox", ticketId)
}
onConnectMessagesList() socket.on("appMessage", (data) => {
socket.on("connect", onConnectMessagesList)
const onAppMessageMessagesList = (data) => {
if (+data.message.ticketId !== +ticketId) return
if (data.action === "create") { if (data.action === "create") {
@ -463,14 +454,10 @@ const MessagesList = ({ ticketId, isGroup }) => {
if (data.action === "update") { if (data.action === "update") {
dispatch({ type: "UPDATE_MESSAGE", payload: data.message }) dispatch({ type: "UPDATE_MESSAGE", payload: data.message })
} }
} })
socket.on("appMessage", onAppMessageMessagesList)
return () => { return () => {
socket.emit("leaveChatBox", ticketId) socket.disconnect()
socket.off("connect", onConnectMessagesList)
socket.off("appMessage", onAppMessageMessagesList)
} }
}, [ticketId]) }, [ticketId])

View File

@ -13,7 +13,7 @@ import {
import ptBrLocale from "date-fns/locale/pt-BR"; import ptBrLocale from "date-fns/locale/pt-BR";
import esLocale from 'date-fns/locale/es';
function formatDateDatePicker(data){ function formatDateDatePicker(data){
return String(new Date(data).getFullYear())+'-'+ return String(new Date(data).getFullYear())+'-'+
@ -50,7 +50,7 @@ function ResponsiveDatePickers(props) {
return ( return (
<Fragment> <Fragment>
<MuiPickersUtilsProvider utils={DateFnsUtils} locale={esLocale}> <MuiPickersUtilsProvider utils={DateFnsUtils} locale={ptBrLocale}>
<KeyboardDatePicker <KeyboardDatePicker
// autoOk // autoOk

View File

@ -45,7 +45,7 @@ import {
import ptBrLocale from "date-fns/locale/pt-BR"; import ptBrLocale from "date-fns/locale/pt-BR";
import esLocale from 'date-fns/locale/es';
function formatDate(strDate){ function formatDate(strDate){
const date = strDate.split(' ')[0].split('/') const date = strDate.split(' ')[0].split('/')
@ -70,7 +70,7 @@ const ResponsiveTimePickers = (props) => {
<Fragment> <Fragment>
<MuiPickersUtilsProvider utils={DateFnsUtils} locale={esLocale}> <MuiPickersUtilsProvider utils={DateFnsUtils} locale={ptBrLocale}>
<TimePicker <TimePicker
variant="outline" variant="outline"
label={props.title} label={props.title}

View File

@ -2,8 +2,7 @@ import React, { useState, useRef, useEffect, useContext } from "react"
import { useHistory } from "react-router-dom" import { useHistory } from "react-router-dom"
import { format } from "date-fns" import { format } from "date-fns"
//import openSocket from "socket.io-client" import openSocket from "socket.io-client"
import { socket } from "../../services/socket"
import useSound from "use-sound" import useSound from "use-sound"
import Popover from "@material-ui/core/Popover" import Popover from "@material-ui/core/Popover"
@ -133,7 +132,7 @@ const NotificationsPopOver = () => {
useEffect(() => { useEffect(() => {
//const socket = openSocket(process.env.REACT_APP_BACKEND_URL) const socket = openSocket(process.env.REACT_APP_BACKEND_URL)
socket.on("reload_page", (data) => { socket.on("reload_page", (data) => {
@ -194,8 +193,7 @@ const NotificationsPopOver = () => {
return () => { return () => {
socket.removeAllListeners('reload_page'); socket.disconnect()
socket.removeAllListeners('onlineStatus');
} }
}, [user.id, handleLogout, user.profile]) }, [user.id, handleLogout, user.profile])
@ -203,17 +201,12 @@ const NotificationsPopOver = () => {
useEffect(() => { useEffect(() => {
//const socket = openSocket(process.env.REACT_APP_BACKEND_URL) const socket = openSocket(process.env.REACT_APP_BACKEND_URL)
const onConnectNotifications = () => { socket.on("connect", () => socket.emit("joinNotification"))
socket.emit("joinNotification")
}
onConnectNotifications()
socket.on("connect", onConnectNotifications) socket.on("ticket", data => {
const onTicketNotifications = data => {
if (data.action === "updateUnread" || data.action === "delete") { if (data.action === "updateUnread" || data.action === "delete") {
@ -239,18 +232,25 @@ const NotificationsPopOver = () => {
return prevState return prevState
}) })
} }
} })
socket.on("appMessage", data => {
socket.on("ticket", onTicketNotifications)
const onAppMessageNotifications = data => {
if ( if (
data.action === "create" && data.action === "create" &&
!data.message.read && !data.message.read &&
(data.ticket.userId === user?.id || !data.ticket.userId) (data.ticket.userId === user?.id || !data.ticket.userId)
) { ) {
setNotifications(prevState => { setNotifications(prevState => {
// prevState.forEach((e)=>{ // prevState.forEach((e)=>{
// //
// }) // })
@ -265,6 +265,8 @@ const NotificationsPopOver = () => {
return [data.ticket, ...prevState] return [data.ticket, ...prevState]
}) })
const shouldNotNotificate = (data.message.ticketId === ticketIdRef.current && document.visibilityState === "visible") || const shouldNotNotificate = (data.message.ticketId === ticketIdRef.current && document.visibilityState === "visible") ||
(data.ticket.userId && data.ticket.userId !== user?.id) || (data.ticket.userId && data.ticket.userId !== user?.id) ||
data.ticket.isGroup || !data.ticket.userId data.ticket.isGroup || !data.ticket.userId
@ -273,19 +275,14 @@ const NotificationsPopOver = () => {
handleNotifications(data) handleNotifications(data)
} }
} })
socket.on("appMessage", onAppMessageNotifications)
socket.on('notifyPeding', data =>{ socket.on('notifyPeding', data =>{
if(settings?.length > 0 && getSettingValue('notificationTransferQueue') === 'enabled') handleNotifications("", data); if(settings?.length > 0 && getSettingValue('notificationTransferQueue') === 'enabled') handleNotifications("", data);
}); });
return () => { return () => {
socket.off('connect', onConnectNotifications); socket.disconnect()
socket.off('ticket', onTicketNotifications);
socket.off('appMessage', onAppMessageNotifications);
socket.removeAllListeners('notifyPeding');
} }
}, [user, settings]) }, [user, settings])

View File

@ -3,8 +3,8 @@ import React, { useState, useEffect, useRef, useContext } from "react"
import * as Yup from "yup" import * as Yup from "yup"
import { Formik, Form, Field } from "formik" import { Formik, Form, Field } from "formik"
import { toast } from "react-toastify" import { toast } from "react-toastify"
//import openSocket from 'socket.io-client' import openSocket from 'socket.io-client'
import { socket } from "../../services/socket"
import { import {
makeStyles, makeStyles,
@ -87,9 +87,9 @@ const PositionModal = ({
useEffect(() => { useEffect(() => {
//const socket = openSocket(process.env.REACT_APP_BACKEND_URL) const socket = openSocket(process.env.REACT_APP_BACKEND_URL)
const onSettingsPosition = (data) => { socket.on('settings', (data) => {
if (data.action === 'update') { if (data.action === 'update') {
setSettings((prevState) => { setSettings((prevState) => {
const aux = [...prevState] const aux = [...prevState]
@ -98,12 +98,10 @@ const PositionModal = ({
return aux return aux
}) })
} }
} })
socket.on('settings', onSettingsPosition)
return () => { return () => {
socket.off("settings", onSettingsPosition) socket.disconnect()
} }
}, []) }, [])
@ -193,7 +191,7 @@ const PositionModal = ({
<div className={classes.textQuickAnswerContainer}> <div className={classes.textQuickAnswerContainer}>
<Field <Field
as={TextField} as={TextField}
label={i18n.t('dashboard.titles.name')} label={'Nome'}
name="name" name="name"
autoFocus autoFocus
error={touched.name && Boolean(errors.name)} error={touched.name && Boolean(errors.name)}

View File

@ -1,8 +1,6 @@
import React, { useEffect, useState, useContext } from "react"; import React, { useEffect, useState, useContext } from "react";
import QRCode from "qrcode.react"; import QRCode from "qrcode.react";
//import openSocket from "socket.io-client"; import openSocket from "socket.io-client";
import { socket } from "../../services/socket";
import toastError from "../../errors/toastError"; import toastError from "../../errors/toastError";
import { Dialog, DialogContent, Paper, Typography } from "@material-ui/core"; import { Dialog, DialogContent, Paper, Typography } from "@material-ui/core";
@ -33,9 +31,9 @@ const QrcodeModal = ({ open, onClose, whatsAppId }) => {
useEffect(() => { useEffect(() => {
if (!whatsAppId) return; if (!whatsAppId) return;
//const socket = openSocket(process.env.REACT_APP_BACKEND_URL); const socket = openSocket(process.env.REACT_APP_BACKEND_URL);
const onWhatsAppSessionQrCode = data => { socket.on("whatsappSession", data => {
if (data.action === "update" && data.session.id === whatsAppId) { if (data.action === "update" && data.session.id === whatsAppId) {
setQrCode(data.session.qrcode); setQrCode(data.session.qrcode);
} }
@ -55,12 +53,10 @@ const QrcodeModal = ({ open, onClose, whatsAppId }) => {
} }
} }
} });
socket.on("whatsappSession", onWhatsAppSessionQrCode);
return () => { return () => {
socket.off("whatsappSession", onWhatsAppSessionQrCode); socket.disconnect();
}; };
}, [whatsAppId, onClose, user.profile]); }, [whatsAppId, onClose, user.profile]);

View File

@ -23,8 +23,8 @@ import { IconButton, InputAdornment } from "@material-ui/core"
import { Colorize } from "@material-ui/icons" import { Colorize } from "@material-ui/icons"
import { AuthContext } from '../../context/Auth/AuthContext' import { AuthContext } from '../../context/Auth/AuthContext'
//import openSocket from 'socket.io-client' import openSocket from 'socket.io-client'
import { socket } from "../../services/socket"
const useStyles = makeStyles(theme => ({ const useStyles = makeStyles(theme => ({
@ -92,9 +92,9 @@ const QueueModal = ({ open, onClose, queueId }) => {
}, [setting]) }, [setting])
useEffect(() => { useEffect(() => {
//const socket = openSocket(process.env.REACT_APP_BACKEND_URL) const socket = openSocket(process.env.REACT_APP_BACKEND_URL)
const onSettingsQueueModal = (data) => { socket.on('settings', (data) => {
if (data.action === 'update') { if (data.action === 'update') {
setSettings((prevState) => { setSettings((prevState) => {
const aux = [...prevState] const aux = [...prevState]
@ -103,12 +103,10 @@ const QueueModal = ({ open, onClose, queueId }) => {
return aux return aux
}) })
} }
} })
socket.on('settings', onSettingsQueueModal)
return () => { return () => {
socket.off("settings", onSettingsQueueModal) socket.disconnect()
} }
}, []) }, [])

View File

@ -3,8 +3,8 @@ import React, { useState, useEffect, useRef, useContext } from "react"
import * as Yup from "yup" import * as Yup from "yup"
import { Formik, Form, Field } from "formik" import { Formik, Form, Field } from "formik"
import { toast } from "react-toastify" import { toast } from "react-toastify"
//import openSocket from 'socket.io-client' import openSocket from 'socket.io-client'
import { socket } from "../../services/socket"
import { import {
makeStyles, makeStyles,
@ -101,9 +101,9 @@ const QuickAnswersModal = ({
}, [open,]) }, [open,])
useEffect(() => { useEffect(() => {
//const socket = openSocket(process.env.REACT_APP_BACKEND_URL) const socket = openSocket(process.env.REACT_APP_BACKEND_URL)
const onSettingsQuickAnswersModal = (data) => { socket.on('settings', (data) => {
if (data.action === 'update') { if (data.action === 'update') {
setSettings((prevState) => { setSettings((prevState) => {
const aux = [...prevState] const aux = [...prevState]
@ -112,12 +112,10 @@ const QuickAnswersModal = ({
return aux return aux
}) })
} }
} })
socket.on('settings', onSettingsQuickAnswersModal)
return () => { return () => {
socket.off("settings", onSettingsQuickAnswersModal) socket.disconnect()
} }
}, []) }, [])

View File

@ -15,7 +15,7 @@ import {
import ptBrLocale from "date-fns/locale/pt-BR"; import ptBrLocale from "date-fns/locale/pt-BR";
import esLocale from 'date-fns/locale/es';
function formatDateDatePicker(data){ function formatDateDatePicker(data){
return String(new Date(data).getFullYear())+'-'+ return String(new Date(data).getFullYear())+'-'+
@ -52,7 +52,7 @@ function ResponsiveDatePickers(props) {
return ( return (
<Fragment> <Fragment>
<MuiPickersUtilsProvider utils={DateFnsUtils} locale={esLocale}> <MuiPickersUtilsProvider utils={DateFnsUtils} locale={ptBrLocale}>
<KeyboardDatePicker <KeyboardDatePicker
// autoOk // autoOk

View File

@ -52,7 +52,7 @@ const Modal = (props) => {
const dataChat = props.data.map((dt) => { const dataChat = props.data.map((dt) => {
return { return {
'fromMe': dt.fromMe ? i18n.t('dashboard.titles.attendant') : 'Cliente', 'fromMe': dt.fromMe ? 'Atendente' : 'Cliente',
'body': dt.body, 'body': dt.body,
'createdAt': dt.createdAt 'createdAt': dt.createdAt
} }

View File

@ -12,7 +12,6 @@ import InputLabel from '@mui/material/InputLabel';
import MenuItem from '@mui/material/MenuItem'; import MenuItem from '@mui/material/MenuItem';
import Select from '@mui/material/Select'; import Select from '@mui/material/Select';
import { i18n } from "../../translate/i18n";
@ -57,11 +56,11 @@ useEffect(()=>{
open={open} open={open}
onClose={handleClose} onClose={handleClose}
> >
<DialogTitle>{i18n.t('dashboard.titles.dialogTitle')}</DialogTitle> <DialogTitle>Relatórios</DialogTitle>
<DialogContent> <DialogContent>
<DialogContentText> <DialogContentText>
{i18n.t('dashboard.titles.dialogContentText')} Escolha uma opção de relatório abaixo
</DialogContentText> </DialogContentText>
<Box <Box

View File

@ -3,8 +3,8 @@ import React, { useState, useEffect, useRef, useContext } from "react"
import * as Yup from "yup" import * as Yup from "yup"
import { Formik, Form, Field } from "formik" import { Formik, Form, Field } from "formik"
import { toast } from "react-toastify" import { toast } from "react-toastify"
//import openSocket from 'socket.io-client' import openSocket from 'socket.io-client'
import { socket } from "../../services/socket"
import { import {
makeStyles, makeStyles,
@ -91,9 +91,9 @@ const StatusChatEndModal = ({
useEffect(() => { useEffect(() => {
//const socket = openSocket(process.env.REACT_APP_BACKEND_URL) const socket = openSocket(process.env.REACT_APP_BACKEND_URL)
const onSettingsStatusChatEndModal = (data) => { socket.on('settings', (data) => {
if (data.action === 'update') { if (data.action === 'update') {
setSettings((prevState) => { setSettings((prevState) => {
const aux = [...prevState] const aux = [...prevState]
@ -102,12 +102,10 @@ const StatusChatEndModal = ({
return aux return aux
}) })
} }
} })
socket.on('settings', onSettingsStatusChatEndModal)
return () => { return () => {
socket.off("settings", onSettingsStatusChatEndModal) socket.disconnect()
} }
}, []) }, [])

View File

@ -2,9 +2,7 @@ import React, { useState, useEffect } from "react"
import { useParams, useHistory } from "react-router-dom" import { useParams, useHistory } from "react-router-dom"
import { toast } from "react-toastify" import { toast } from "react-toastify"
//import openSocket from "socket.io-client" import openSocket from "socket.io-client"
import { socket } from "../../services/socket"
import clsx from "clsx" import clsx from "clsx"
import { Paper, makeStyles } from "@material-ui/core" import { Paper, makeStyles } from "@material-ui/core"
@ -134,32 +132,22 @@ const Ticket = () => {
}, []) }, [])
useEffect(() => { useEffect(() => {
//const socket = openSocket(process.env.REACT_APP_BACKEND_URL) const socket = openSocket(process.env.REACT_APP_BACKEND_URL)
const onConnectTicket = () => socket.emit("joinChatBox", ticketId) socket.on("connect", () => socket.emit("joinChatBox", ticketId))
onConnectTicket()
socket.on("connect", onConnectTicket)
const onTicketTicket = (data) => {
const isSameTicket = +data?.ticket?.id === +ticketId || +data.ticketId === +ticketId
if (!isSameTicket) return
socket.on("ticket", (data) => {
if (data.action === "update") { if (data.action === "update") {
setTicket(data.ticket) setTicket(data.ticket)
} }
if (data.action === "deleteForever") { if (data.action === "delete") {
console.log('delete forever')
toast.success("Ticket deleted sucessfully.") toast.success("Ticket deleted sucessfully.")
history.push("/tickets") history.push("/tickets")
} }
} })
socket.on("ticket", onTicketTicket) socket.on("contact", (data) => {
const onContactTicket = (data) => {
if (data.action === "update") { if (data.action === "update") {
setContact((prevState) => { setContact((prevState) => {
if (prevState.id === data.contact?.id) { if (prevState.id === data.contact?.id) {
@ -168,11 +156,9 @@ const Ticket = () => {
return prevState return prevState
}) })
} }
} })
socket.on("contact", onContactTicket) socket.on("remoteTickesControllIdleOpen", (data) => {
const onRemoteTicketsControllIdleOpenTicket = (data) => {
if (data.action === "update") { if (data.action === "update") {
let url_ticketId let url_ticketId
try { try {
@ -189,15 +175,10 @@ const Ticket = () => {
console.log('error on try do the send seen: ', error) console.log('error on try do the send seen: ', error)
} }
} }
} })
socket.on("remoteTickesControllIdleOpen", onRemoteTicketsControllIdleOpenTicket)
return () => { return () => {
socket.off("connect", onConnectTicket) socket.disconnect()
socket.off("ticket", onTicketTicket)
socket.off("contact", onContactTicket)
socket.off("remoteTickesControllIdleOpen", onRemoteTicketsControllIdleOpenTicket)
} }
}, [ticketId, history]) }, [ticketId, history])

View File

@ -22,8 +22,7 @@ import MarkdownWrapper from "../MarkdownWrapper"
import { Tooltip } from "@material-ui/core" import { Tooltip } from "@material-ui/core"
import { AuthContext } from "../../context/Auth/AuthContext" import { AuthContext } from "../../context/Auth/AuthContext"
import toastError from "../../errors/toastError" import toastError from "../../errors/toastError"
//import openSocket from 'socket.io-client' import openSocket from 'socket.io-client'
import { socket } from "../../services/socket"
const useStyles = makeStyles(theme => ({ const useStyles = makeStyles(theme => ({
ticket: { ticket: {
@ -152,18 +151,17 @@ const TicketListItem = ({ ticket, remoteTicketsControll, settings }) => {
useEffect(() => { useEffect(() => {
//const socket = openSocket(process.env.REACT_APP_BACKEND_URL) const socket = openSocket(process.env.REACT_APP_BACKEND_URL)
const onRemoteTickesControllTicketListItem = (data) => { socket.on('remoteTickesControll', (data) => {
console.log('REMOTE TICKETS CONTROLL UPDATE2: ', data.tickets) console.log('REMOTE TICKETS CONTROLL UPDATE2: ', data.tickets)
if (data.action === 'update') { if (data.action === 'update') {
setRemoteTicketsControll(data.tickets) setRemoteTicketsControll(data.tickets)
} }
} })
socket.on('remoteTickesControll', onRemoteTickesControllTicketListItem)
const onSettingsTicketListItem = (data) => { socket.on('settings', (data) => {
if (data.action === 'update') { if (data.action === 'update') {
setSettings((prevState) => { setSettings((prevState) => {
const aux = [...prevState] const aux = [...prevState]
@ -172,13 +170,11 @@ const TicketListItem = ({ ticket, remoteTicketsControll, settings }) => {
return aux return aux
}) })
} }
} })
socket.on('settings', onSettingsTicketListItem)
return () => { return () => {
socket.off('remoteTickesControll', onRemoteTickesControllTicketListItem); socket.disconnect()
socket.off('settings', onSettingsTicketListItem);
} }
}, []) }, [])

View File

@ -1,7 +1,7 @@
import React, { useState, useEffect, useReducer, useContext } from "react" import React, { useState, useEffect, useReducer, useContext } from "react"
//import openSocket from "socket.io-client"
import { socket } from "../../services/socket" import openSocket from "socket.io-client"
import { makeStyles } from "@material-ui/core/styles" import { makeStyles } from "@material-ui/core/styles"
import List from "@material-ui/core/List" import List from "@material-ui/core/List"
@ -243,29 +243,27 @@ const TicketsList = (props) => {
// if (tab=='search')return // if (tab=='search')return
//const socket = openSocket(process.env.REACT_APP_BACKEND_URL) const socket = openSocket(process.env.REACT_APP_BACKEND_URL)
const shouldUpdateTicket = ticket => const shouldUpdateTicket = ticket =>
(status === ticket.status) &&
(!ticket.userId || ticket.userId === user?.id || showAll) && (!ticket.userId || ticket.userId === user?.id || showAll) &&
(!ticket.queueId || selectedQueueIds.indexOf(ticket.queueId) > -1) (!ticket.queueId || selectedQueueIds.indexOf(ticket.queueId) > -1)
const notBelongsToUserQueues = ticket => const notBelongsToUserQueues = ticket =>
ticket.queueId && selectedQueueIds.indexOf(ticket.queueId) === -1 ticket.queueId && selectedQueueIds.indexOf(ticket.queueId) === -1
const onConnectTicketList = () => { socket.on("connect", () => {
if (status) { if (status) {
socket.emit("joinTickets", status) socket.emit("joinTickets", status)
} else { } else {
socket.emit("joinNotification") socket.emit("joinNotification")
} }
}
onConnectTicketList() })
socket.on("connect", onConnectTicketList)
const onTicketTicketList = data => {
socket.on("ticket", data => {
if (data.action === "updateUnread") { if (data.action === "updateUnread") {
@ -294,11 +292,10 @@ const TicketsList = (props) => {
if (data.action === "delete") { if (data.action === "delete") {
dispatch({ type: "DELETE_TICKET", payload: data.ticketId }) dispatch({ type: "DELETE_TICKET", payload: data.ticketId })
} }
} })
socket.on("ticket", onTicketTicketList)
const onAppMessageTicketList = data => { socket.on("appMessage", data => {
if (data.action === "create" && shouldUpdateTicket(data.ticket)) { if (data.action === "create" && shouldUpdateTicket(data.ticket)) {
@ -310,9 +307,7 @@ const TicketsList = (props) => {
payload: data, payload: data,
}) })
} }
} })
socket.on("appMessage", onAppMessageTicketList)
socket.on("contact", data => { socket.on("contact", data => {
if (data.action === "update") { if (data.action === "update") {
@ -323,16 +318,16 @@ const TicketsList = (props) => {
} }
}) })
const onRemoteTickesControllTicketList = (data) => {
socket.on('remoteTickesControll', (data) => {
console.log('REMOTE TICKETS CONTROLL UPDATE 1: ', data.tickets) console.log('REMOTE TICKETS CONTROLL UPDATE 1: ', data.tickets)
if (data.action === 'update') { if (data.action === 'update') {
setRemoteTicketsControll(data.tickets) setRemoteTicketsControll(data.tickets)
} }
} })
socket.on('remoteTickesControll', onRemoteTickesControllTicketList)
const onSettingsTicketList = (data) => { socket.on('settings', (data) => {
if (data.action === 'update') { if (data.action === 'update') {
setSettings((prevState) => { setSettings((prevState) => {
const aux = [...prevState] const aux = [...prevState]
@ -341,17 +336,11 @@ const TicketsList = (props) => {
return aux return aux
}) })
} }
} })
socket.on('settings', onSettingsTicketList)
return () => { return () => {
socket.off("ticket", onTicketTicketList) socket.disconnect()
socket.off('appMessage', onAppMessageTicketList);
socket.removeAllListeners("contact")
socket.off('connect', onConnectTicketList);
socket.off('settings', onSettingsTicketList);
socket.off('remoteTickesControll', onRemoteTickesControllTicketList);
} }
}, [status, showAll, user, selectedQueueIds, tab]) }, [status, showAll, user, selectedQueueIds, tab])

View File

@ -19,6 +19,7 @@ import FindInPageIcon from '@material-ui/icons/FindInPage'
import FormControlLabel from "@material-ui/core/FormControlLabel" import FormControlLabel from "@material-ui/core/FormControlLabel"
import Switch from "@material-ui/core/Switch" import Switch from "@material-ui/core/Switch"
import openSocket from "socket.io-client"
import NewTicketModal from "../NewTicketModal" import NewTicketModal from "../NewTicketModal"
import TicketsList from "../TicketsList" import TicketsList from "../TicketsList"
@ -152,7 +153,7 @@ const TicketsManager = () => {
const [openCount, setOpenCount] = useState(0) const [openCount, setOpenCount] = useState(0)
const [pendingCount, setPendingCount] = useState(0) const [pendingCount, setPendingCount] = useState(0)
const userQueueIds = user?.queues?.map((q) => q?.id) const userQueueIds = user.queues.map((q) => q.id)
const [selectedQueueIds, setSelectedQueueIds] = useState(userQueueIds || []) const [selectedQueueIds, setSelectedQueueIds] = useState(userQueueIds || [])
const [showContentSearch, setShowContentSearch] = useState(false) const [showContentSearch, setShowContentSearch] = useState(false)
@ -177,9 +178,9 @@ const TicketsManager = () => {
}, [setting]) }, [setting])
useEffect(() => { useEffect(() => {
if (user?.profile?.toUpperCase() === "ADMIN" || if (user.profile.toUpperCase() === "ADMIN" ||
user?.profile?.toUpperCase() === "SUPERVISOR" || user.profile.toUpperCase() === "SUPERVISOR" ||
user?.profile?.toUpperCase() === "MASTER") { user.profile.toUpperCase() === "MASTER") {
setShowAllTickets(true) setShowAllTickets(true)
} }
// eslint-disable-next-line react-hooks/exhaustive-deps // eslint-disable-next-line react-hooks/exhaustive-deps
@ -202,11 +203,11 @@ const TicketsManager = () => {
if (tickets.length > 0) { if (tickets.length > 0) {
const now = new Date() const now = new Date()
const differenceTime = tickets?.map(ticket => { const differenceTime = tickets?.map(ticket => {
const createdAt = new Date(ticket?.createdAt) const createdAt = new Date(ticket.createdAt)
const difference = now - createdAt const difference = now - createdAt
return difference return difference
}) })
const sumDifferences = differenceTime?.reduce((total, difference) => total + difference, 0) const sumDifferences = differenceTime.reduce((total, difference) => total + difference, 0)
const averageTimeMilliseconds = sumDifferences / tickets?.length const averageTimeMilliseconds = sumDifferences / tickets?.length
let hours = Math.floor(averageTimeMilliseconds / 3600000) let hours = Math.floor(averageTimeMilliseconds / 3600000)
const minutes = Math.floor((averageTimeMilliseconds % 3600000) / 60000) const minutes = Math.floor((averageTimeMilliseconds % 3600000) / 60000)

View File

@ -1,7 +1,6 @@
import React, { useState, useContext, useMemo, useEffect } from "react" import React, { useState, useContext, useMemo, useEffect } from "react"
import { useHistory } from "react-router-dom" import { useHistory } from "react-router-dom"
//import openSocket from "socket.io-client" import openSocket from "socket.io-client"
import { socket } from "../../services/socket"
import Button from "@material-ui/core/Button" import Button from "@material-ui/core/Button"
import Dialog from "@material-ui/core/Dialog" import Dialog from "@material-ui/core/Dialog"
@ -72,12 +71,7 @@ const TransferTicketModal = ({ modalOpen, onClose, ticketid }) => {
if (!whatsApps) return [] if (!whatsApps) return []
const whatsAppsQueues = whatsApps.map(({ queues }) => queues) const whatsAppsQueues = whatsApps.map(({ queues }) => queues)
//const whatsAppsQueues = whatsApps.filter(({ status }) => status === "CONNECTED" ).map(({ queues }) => queues) //const whatsAppsQueues = whatsApps.filter(({ status }) => status === "CONNECTED" ).map(({ queues }) => queues)
const uniqueQueuesAvailable = queueArraysToOneArray(whatsAppsQueues); const uniqueQueuesAvailable = queueArraysToOneArray(whatsAppsQueues)
uniqueQueuesAvailable.sort((a, b) => {
if (a.name.toLowerCase() < b.name.toLowerCase()) return -1;
if (a.name.toLowerCase() > b.name.toLowerCase()) return 1;
return 0;
});
return uniqueQueuesAvailable return uniqueQueuesAvailable
}, [whatsApps]) }, [whatsApps])
@ -97,11 +91,6 @@ const TransferTicketModal = ({ modalOpen, onClose, ticketid }) => {
const { id, color, name } = q const { id, color, name } = q
return { id, color, name } return { id, color, name }
}) })
userQueues.sort((a, b) => {
if (a.name.toLowerCase() < b.name.toLowerCase()) return -1;
if (a.name.toLowerCase() > b.name.toLowerCase()) return 1;
return 0;
});
setQueues(userQueues) setQueues(userQueues)
setSelectedQueue('') setSelectedQueue('')
@ -121,9 +110,9 @@ const TransferTicketModal = ({ modalOpen, onClose, ticketid }) => {
useEffect(() => { useEffect(() => {
//const socket = openSocket(process.env.REACT_APP_BACKEND_URL) const socket = openSocket(process.env.REACT_APP_BACKEND_URL)
const onSettingsTransferTicketModal = (data) => { socket.on('settings', (data) => {
console.log('settings updated ----------------------------xxxxxxxxxxxx') console.log('settings updated ----------------------------xxxxxxxxxxxx')
if (data.action === 'update') { if (data.action === 'update') {
@ -134,12 +123,10 @@ const TransferTicketModal = ({ modalOpen, onClose, ticketid }) => {
return aux return aux
}) })
} }
} })
socket.on('settings', onSettingsTransferTicketModal)
return () => { return () => {
socket.off("settings", onSettingsTransferTicketModal) socket.disconnect()
} }
}, []) }, [])
@ -207,16 +194,7 @@ const TransferTicketModal = ({ modalOpen, onClose, ticketid }) => {
const { data } = await api.get(`/users/all`, { const { data } = await api.get(`/users/all`, {
params: { userId: user.id }, params: { userId: user.id },
}) })
data.queues.sort((a, b) => {
if (a.name.toLowerCase() < b.name.toLowerCase()) return -1;
if (a.name.toLowerCase() > b.name.toLowerCase()) return 1;
return 0;
});
data.users.sort((a, b) => {
if (a.name.toLowerCase() < b.name.toLowerCase()) return -1;
if (a.name.toLowerCase() > b.name.toLowerCase()) return 1;
return 0;
});
setUsers(data.users) setUsers(data.users)
setQueuesByWhats(data.queues) setQueuesByWhats(data.queues)
setQueues(data.queues) setQueues(data.queues)
@ -227,12 +205,6 @@ const TransferTicketModal = ({ modalOpen, onClose, ticketid }) => {
params: { profile: 'user', transferToOtherQueues: user.transferToOtherQueues }, params: { profile: 'user', transferToOtherQueues: user.transferToOtherQueues },
}) })
data.users.sort((a, b) => {
if (a.name.toLowerCase() < b.name.toLowerCase()) return -1;
if (a.name.toLowerCase() > b.name.toLowerCase()) return 1;
return 0;
});
setUsers(data.users) setUsers(data.users)
setQueues(_queues2) setQueues(_queues2)
} }
@ -287,7 +259,7 @@ const TransferTicketModal = ({ modalOpen, onClose, ticketid }) => {
required required
> >
<MenuItem style={{ background: "white", }} value={''}>&nbsp;</MenuItem> <MenuItem style={{ background: "white", }} value={''}>&nbsp;</MenuItem>
{queues?.map((queue) => ( {queues.map((queue) => (
<MenuItem <MenuItem
key={queue.id} key={queue.id}
value={queue.id} value={queue.id}

View File

@ -262,7 +262,7 @@ const UserModal = ({ open, onClose, userId, }) => {
/> />
<div className={classes.multFieldLine}> <div className={classes.multFieldLine}>
<label style={{display: 'flex', alignItems:'center'}}> <label style={{display: 'flex', alignItems:'center'}}>
{i18n.t('dashboard.titles.transfer')} Transferir para outras filas
<Switch <Switch
name= 'transferToOtherQueues' name= 'transferToOtherQueues'
checked={checked} checked={checked}

View File

@ -1,7 +1,6 @@
import { useState, useEffect } from 'react' import { useState, useEffect } from 'react'
import { useHistory } from 'react-router-dom' import { useHistory } from 'react-router-dom'
//import openSocket from 'socket.io-client' import openSocket from 'socket.io-client'
import { socket } from '../../services/socket'
import { toast } from 'react-toastify' import { toast } from 'react-toastify'
@ -91,7 +90,7 @@ const useAuth = () => {
}, []) }, [])
useEffect(() => { useEffect(() => {
//const socket = openSocket(process.env.REACT_APP_BACKEND_URL) const socket = openSocket(process.env.REACT_APP_BACKEND_URL)
socket.on('user', (data) => { socket.on('user', (data) => {
if (data.action === 'update' && data.user.id === user.id) { if (data.action === 'update' && data.user.id === user.id) {
@ -99,7 +98,7 @@ const useAuth = () => {
} }
}) })
const onSettingsAuth = (data) => { socket.on('settings', (data) => {
if (data.action === 'update') { if (data.action === 'update') {
setSetting((prevState) => { setSetting((prevState) => {
const aux = [...prevState] const aux = [...prevState]
@ -108,13 +107,10 @@ const useAuth = () => {
return aux return aux
}) })
} }
} })
socket.on('settings', onSettingsAuth)
return () => { return () => {
socket.removeAllListeners('user'); socket.disconnect()
socket.off('settings', onSettingsAuth);
} }
}, [user]) }, [user])

View File

@ -1,7 +1,5 @@
import { useState, useEffect, useReducer } from "react"; import { useState, useEffect, useReducer } from "react";
//import openSocket from "socket.io-client"; import openSocket from "socket.io-client";
import { socket } from "../../services/socket";
import toastError from "../../errors/toastError"; import toastError from "../../errors/toastError";
@ -128,7 +126,7 @@ const useWhatsApps = () => {
}, []); }, []);
useEffect(() => { useEffect(() => {
//const socket = openSocket(process.env.REACT_APP_BACKEND_URL); const socket = openSocket(process.env.REACT_APP_BACKEND_URL);
socket.on("whatsapp", data => { socket.on("whatsapp", data => {
if (data.action === "update") { if (data.action === "update") {
@ -160,9 +158,7 @@ const useWhatsApps = () => {
return () => { return () => {
socket.removeAllListeners('whatsapp'); socket.disconnect();
socket.removeAllListeners('whatsappSession');
socket.removeAllListeners('whatsappSessionMonit');
}; };
}, []); }, []);

View File

@ -31,8 +31,7 @@ import { i18n } from '../translate/i18n'
import { WhatsAppsContext } from '../context/WhatsApp/WhatsAppsContext' import { WhatsAppsContext } from '../context/WhatsApp/WhatsAppsContext'
import { AuthContext } from '../context/Auth/AuthContext' import { AuthContext } from '../context/Auth/AuthContext'
import { Can } from '../components/Can' import { Can } from '../components/Can'
//import openSocket from 'socket.io-client' import openSocket from 'socket.io-client'
import { socket } from '../services/socket'
import api from '../services/api' import api from '../services/api'
@ -119,9 +118,9 @@ const MainListItems = (props) => {
} }
useEffect(() => { useEffect(() => {
//const socket = openSocket(process.env.REACT_APP_BACKEND_URL) const socket = openSocket(process.env.REACT_APP_BACKEND_URL)
const onSettingsMainListItem = (data) => { socket.on('settings', (data) => {
if (data.action === 'update') { if (data.action === 'update') {
setSettings((prevState) => { setSettings((prevState) => {
const aux = [...prevState] const aux = [...prevState]
@ -130,12 +129,10 @@ const MainListItems = (props) => {
return aux return aux
}) })
} }
} })
socket.on('settings', onSettingsMainListItem)
return () => { return () => {
socket.off('settings', onSettingsMainListItem); socket.disconnect()
} }
}, []) }, [])
@ -192,7 +189,7 @@ const MainListItems = (props) => {
/> />
<ListItemLink <ListItemLink
to="/report" to="/report"
primary={i18n.t("mainDrawer.listItems.reports")} primary="Relatório"
icon={<ReportOutlinedIcon />} icon={<ReportOutlinedIcon />}
/> />
</> </>
@ -245,7 +242,7 @@ const MainListItems = (props) => {
(getSettingValue('hasCampaign') === 'enabled' || user.profile === 'master') && ( (getSettingValue('hasCampaign') === 'enabled' || user.profile === 'master') && (
<ListItemLink <ListItemLink
to="/campaign" to="/campaign"
primary={i18n.t("mainDrawer.listItems.campaign") || 'Campaign'} primary="Campanha"
icon={<CampaignIcon />} icon={<CampaignIcon />}
/> />
) )

View File

@ -1,8 +1,7 @@
import React, { useState, useCallback, useEffect, useReducer, useContext } from 'react' import React, { useState, useCallback, useEffect, useReducer, useContext } from 'react'
import { toast } from 'react-toastify' import { toast } from 'react-toastify'
//import openSocket from 'socket.io-client' import openSocket from 'socket.io-client'
import { socket } from '../../services/socket'
import { makeStyles } from '@material-ui/core/styles' import { makeStyles } from '@material-ui/core/styles'
import { green } from '@material-ui/core/colors' import { green } from '@material-ui/core/colors'
@ -297,9 +296,10 @@ const Campaign = () => {
} }
useEffect(() => { useEffect(() => {
//const socket = openSocket(process.env.REACT_APP_BACKEND_URL) const socket = openSocket(process.env.REACT_APP_BACKEND_URL)
const onContactsBulkCampaing = (data) => {
socket.on("contactsBulkInsertOnQueueStatus", (data) => {
if (data.action === 'update') { if (data.action === 'update') {
if (String(data.insertOnQueue.adminId) === String(user.id)) { if (String(data.insertOnQueue.adminId) === String(user.id)) {
@ -312,24 +312,19 @@ const Campaign = () => {
} }
} }
} })
socket.on("contactsBulkInsertOnQueueStatus", onContactsBulkCampaing) socket.on('campaign', (data) => {
const onCampaignCampaign = (data) => {
if (data.action === 'update') { if (data.action === 'update') {
dispatch({ type: "UPDATE_CAMPAIGNS", payload: data.campaign }) dispatch({ type: "UPDATE_CAMPAIGNS", payload: data.campaign })
} }
} })
socket.on('campaign', onCampaignCampaign)
return () => { return () => {
socket.off("campaign", onCampaignCampaign) socket.disconnect()
socket.off("contactsBulkInsertOnQueueStatus", onContactsBulkCampaing)
} }
}, [user.id]) }, [user.id])

View File

@ -2,8 +2,7 @@ import React, { useState, useCallback, useEffect, useContext } from 'react'
import { toast } from 'react-toastify' import { toast } from 'react-toastify'
import { format, parseISO } from 'date-fns' import { format, parseISO } from 'date-fns'
//import openSocket from 'socket.io-client' import openSocket from 'socket.io-client'
import { socket } from '../../services/socket'
import { makeStyles } from '@material-ui/core/styles' import { makeStyles } from '@material-ui/core/styles'
import { green, red, yellow, grey } from '@material-ui/core/colors' import { green, red, yellow, grey } from '@material-ui/core/colors'
@ -452,17 +451,15 @@ const Connections = () => {
}, []) }, [])
useEffect(() => { useEffect(() => {
//const socket = openSocket(process.env.REACT_APP_BACKEND_URL) const socket = openSocket(process.env.REACT_APP_BACKEND_URL)
const onDiskSpaceMonitConnections = (data) => { socket.on('diskSpaceMonit', (data) => {
if (data.action === 'update') { if (data.action === 'update') {
setDiskSpaceInfo(data.diskSpace) setDiskSpaceInfo(data.diskSpace)
} }
} })
socket.on('diskSpaceMonit', onDiskSpaceMonitConnections) socket.on('settings', (data) => {
const onSettingsConnections = (data) => {
if (data.action === 'update') { if (data.action === 'update') {
setSettings((prevState) => { setSettings((prevState) => {
const aux = [...prevState] const aux = [...prevState]
@ -471,13 +468,10 @@ const Connections = () => {
return aux return aux
}) })
} }
} })
socket.on('settings', onSettingsConnections)
return () => { return () => {
socket.off("settings", onSettingsConnections) socket.disconnect()
socket.off("diskSpaceMonit", onDiskSpaceMonitConnections)
} }
}, []) }, [])

View File

@ -1,6 +1,5 @@
import React, { useState, useEffect, useReducer, useCallback, useContext } from "react" import React, { useState, useEffect, useReducer, useCallback, useContext } from "react"
//import openSocket from "socket.io-client" import openSocket from "socket.io-client"
import { socket } from "../../services/socket"
import { toast } from "react-toastify" import { toast } from "react-toastify"
import { useHistory } from "react-router-dom" import { useHistory } from "react-router-dom"
@ -261,9 +260,9 @@ const Contacts = () => {
}, [searchParam, pageNumber]) }, [searchParam, pageNumber])
useEffect(() => { useEffect(() => {
//const socket = openSocket(process.env.REACT_APP_BACKEND_URL) const socket = openSocket(process.env.REACT_APP_BACKEND_URL)
const onContactsBulkContacts = (data) => { socket.on("contactsBulkInsertOnQueueStatus", (data) => {
if (data.action === 'update') { if (data.action === 'update') {
if (String(data.insertOnQueue.adminId) === String(user.id)) { if (String(data.insertOnQueue.adminId) === String(user.id)) {
@ -279,11 +278,9 @@ const Contacts = () => {
} }
} }
} })
socket.on("contactsBulkInsertOnQueueStatus", onContactsBulkContacts) socket.on("contact", (data) => {
const onContactContacts = (data) => {
if (data.action === "update" || data.action === "create") { if (data.action === "update" || data.action === "create") {
dispatch({ type: "UPDATE_CONTACTS", payload: data.contact }) dispatch({ type: "UPDATE_CONTACTS", payload: data.contact })
} }
@ -291,13 +288,10 @@ const Contacts = () => {
if (data.action === "delete") { if (data.action === "delete") {
dispatch({ type: "DELETE_CONTACT", payload: +data.contactId }) dispatch({ type: "DELETE_CONTACT", payload: +data.contactId })
} }
} })
socket.on("contact", onContactContacts)
return () => { return () => {
socket.off("contact", onContactContacts) socket.disconnect()
socket.off("contactsBulkInsertOnQueueStatus", onContactsBulkContacts)
} }
}, [user, history]) }, [user, history])

View File

@ -5,8 +5,6 @@ import { PieChart as RechartsPieChart, Pie, Cell, ResponsiveContainer, Tooltip }
import Title from './Title'; import Title from './Title';
import { i18n } from "../../translate/i18n";
const generateDataExample = (amount) => { const generateDataExample = (amount) => {
const arr = [] const arr = []
for (let i = 1; i <= amount; i++) { for (let i = 1; i <= amount; i++) {
@ -78,7 +76,7 @@ const PieChart = ({ data = dataExample }) => {
> >
<Box width="100%" height="100%" position="sticky" top="0" zIndex={1000}> <Box width="100%" height="100%" position="sticky" top="0" zIndex={1000}>
<Box sx={{ position: "absolute" }}> <Box sx={{ position: "absolute" }}>
<Title>{i18n.t('dashboard.titles.title')}</Title> <Title>Tickets encerramento</Title>
</Box> </Box>
<ResponsiveContainer width="100%" height="100%"> <ResponsiveContainer width="100%" height="100%">
<RechartsPieChart width={400} height={400}> <RechartsPieChart width={400} height={400}>

View File

@ -14,11 +14,10 @@ import Info from "@material-ui/icons/Info"
import SelectField from "../../components/Report/SelectField" import SelectField from "../../components/Report/SelectField"
import { AuthContext } from "../../context/Auth/AuthContext" import { AuthContext } from "../../context/Auth/AuthContext"
import { i18n } from "../../translate/i18n"; // import { i18n } from "../../translate/i18n";
import Chart from "./Chart" import Chart from "./Chart"
import PieChart from "./PieChart" import PieChart from "./PieChart"
//import openSocket from "socket.io-client" import openSocket from "socket.io-client"
import { socket } from "../../services/socket"
import api from "../../services/api" import api from "../../services/api"
import { Can } from "../../components/Can" import { Can } from "../../components/Can"
@ -357,40 +356,32 @@ const Dashboard = () => {
useEffect(() => { useEffect(() => {
//const socket = openSocket(process.env.REACT_APP_BACKEND_URL) const socket = openSocket(process.env.REACT_APP_BACKEND_URL)
const onTicketsStatusDashboard = (data) => { socket.on("ticketStatus", (data) => {
if (data.action === "update") { if (data.action === "update") {
setStatus("") setStatus("")
setStatus(data.ticketStatus.status) setStatus(data.ticketStatus.status)
} }
} })
socket.on("ticketStatus", onTicketsStatusDashboard) socket.on("onlineStatus", (data) => {
const onOnlineStatusDashboard = (data) => {
if (data.action === "logout" || data.action === "update") { if (data.action === "logout" || data.action === "update") {
dispatch({ type: "UPDATE_STATUS_ONLINE", payload: data.userOnlineTime }) dispatch({ type: "UPDATE_STATUS_ONLINE", payload: data.userOnlineTime })
} else if (data.action === "delete") { } else if (data.action === "delete") {
dispatch({ type: "DELETE_USER_STATUS", payload: data.userOnlineTime }) dispatch({ type: "DELETE_USER_STATUS", payload: data.userOnlineTime })
} }
} })
socket.on("onlineStatus", onOnlineStatusDashboard) socket.on("user", (data) => {
const onUserDashboard = (data) => {
if (data.action === "delete") { if (data.action === "delete") {
dispatch({ type: "DELETE_USER", payload: +data.userId }) dispatch({ type: "DELETE_USER", payload: +data.userId })
} }
} })
socket.on("user", onUserDashboard)
return () => { return () => {
socket.off("user", onUserDashboard) socket.disconnect()
socket.off("onlineStatus", onOnlineStatusDashboard)
socket.off("ticketStatus", onTicketsStatusDashboard)
} }
}, []) }, [])
@ -481,7 +472,7 @@ const Dashboard = () => {
func={handleSelectedQueue} func={handleSelectedQueue}
textBoxFieldSelected={'All'} textBoxFieldSelected={'All'}
emptyField={false} emptyField={false}
header={i18n.t('dashboard.titles.selectQueues')} header={'Filas'}
currencies={user.queues.map((obj) => { currencies={user.queues.map((obj) => {
return { 'value': obj.id, 'label': obj.name } return { 'value': obj.id, 'label': obj.name }
})} /> })} />
@ -494,7 +485,7 @@ const Dashboard = () => {
variant="outlined" variant="outlined"
> >
<Typography component="h3" variant="h6" color="primary" paragraph> <Typography component="h3" variant="h6" color="primary" paragraph>
{i18n.t('dashboard.titles.waiting')} Aguardando
</Typography> </Typography>
<Grid item> <Grid item>
<Typography component="h1" variant="h4"> <Typography component="h1" variant="h4">
@ -510,7 +501,7 @@ const Dashboard = () => {
variant="outlined" variant="outlined"
> >
<Typography component="h3" variant="h6" color="primary" style={{ marginBottom: "0" }} paragraph> <Typography component="h3" variant="h6" color="primary" style={{ marginBottom: "0" }} paragraph>
{i18n.t('dashboard.titles.inService')} Em Atendimento
</Typography> </Typography>
<Typography paragraph style={{ fontSize: "12px", margin: "0px" }}>Hoje/Todo Periodo</Typography> <Typography paragraph style={{ fontSize: "12px", margin: "0px" }}>Hoje/Todo Periodo</Typography>
@ -529,7 +520,7 @@ const Dashboard = () => {
variant="outlined" variant="outlined"
> >
<Typography component="h3" variant="h6" color="primary" paragraph> <Typography component="h3" variant="h6" color="primary" paragraph>
{i18n.t('dashboard.titles.ticketsClosed')} Fechados
</Typography> </Typography>
<Grid item> <Grid item>
<Typography component="h1" variant="h4"> <Typography component="h1" variant="h4">
@ -560,7 +551,7 @@ const Dashboard = () => {
color="primary" color="primary"
style={{ marginBottom: "16px" }} style={{ marginBottom: "16px" }}
> >
{i18n.t('dashboard.titles.users')} Usuários
<Tooltip <Tooltip
title={`Os dados informados abaixo é baseado na data: ${new Date().toLocaleDateString( title={`Os dados informados abaixo é baseado na data: ${new Date().toLocaleDateString(
"pt-BR", "pt-BR",

View File

@ -1,6 +1,5 @@
import React, { useState, useContext, useEffect, useReducer } from "react" import React, { useState, useContext, useEffect, useReducer } from "react"
//import openSocket from "socket.io-client" import openSocket from "socket.io-client"
import { socket } from "../../services/socket"
import { import {
Button, Button,
@ -126,9 +125,9 @@ const Position = () => {
}, [searchParam, pageNumber]) }, [searchParam, pageNumber])
useEffect(() => { useEffect(() => {
//const socket = openSocket(process.env.REACT_APP_BACKEND_URL) const socket = openSocket(process.env.REACT_APP_BACKEND_URL)
const onPositionPosition = (data) => { socket.on("position", (data) => {
if (data.action === "update" || data.action === "create") { if (data.action === "update" || data.action === "create") {
dispatch({ type: "UPDATE_POSITIONS", payload: data.position }) dispatch({ type: "UPDATE_POSITIONS", payload: data.position })
} }
@ -139,12 +138,10 @@ const Position = () => {
payload: +data.positionId, payload: +data.positionId,
}) })
} }
} })
socket.on("position", onPositionPosition)
return () => { return () => {
socket.off("position", onPositionPosition) socket.disconnect()
} }
}, []) }, [])

View File

@ -1,7 +1,6 @@
import React, { useEffect, useReducer, useState, useContext } from 'react' import React, { useEffect, useReducer, useState, useContext } from 'react'
//import openSocket from 'socket.io-client' import openSocket from 'socket.io-client'
import { socket } from '../../services/socket'
import { import {
Button, Button,
@ -124,9 +123,9 @@ const Queues = () => {
}, []) }, [])
useEffect(() => { useEffect(() => {
//const socket = openSocket(process.env.REACT_APP_BACKEND_URL) const socket = openSocket(process.env.REACT_APP_BACKEND_URL)
const onQueueQueues = (data) => { socket.on('queue', (data) => {
if (data.action === 'update' || data.action === 'create') { if (data.action === 'update' || data.action === 'create') {
dispatch({ type: 'UPDATE_QUEUES', payload: data.queue }) dispatch({ type: 'UPDATE_QUEUES', payload: data.queue })
} }
@ -134,11 +133,9 @@ const Queues = () => {
if (data.action === 'delete') { if (data.action === 'delete') {
dispatch({ type: 'DELETE_QUEUE', payload: data.queueId }) dispatch({ type: 'DELETE_QUEUE', payload: data.queueId })
} }
} })
socket.on('queue', onQueueQueues) socket.on('settings', (data) => {
const onSettingsQueues = (data) => {
if (data.action === 'update') { if (data.action === 'update') {
setSettings((prevState) => { setSettings((prevState) => {
const aux = [...prevState] const aux = [...prevState]
@ -147,13 +144,10 @@ const Queues = () => {
return aux return aux
}) })
} }
} })
socket.on('settings', onSettingsQueues)
return () => { return () => {
socket.off("settings", onSettingsQueues) socket.disconnect()
socket.off("queue", onQueueQueues)
} }
}, []) }, [])

View File

@ -1,6 +1,5 @@
import React, { useState, useContext, useEffect, useReducer } from "react" import React, { useState, useContext, useEffect, useReducer } from "react"
//import openSocket from "socket.io-client" import openSocket from "socket.io-client"
import { socket } from "../../services/socket"
import { import {
Button, Button,
@ -126,9 +125,9 @@ const QuickAnswers = () => {
}, [searchParam, pageNumber]) }, [searchParam, pageNumber])
useEffect(() => { useEffect(() => {
//const socket = openSocket(process.env.REACT_APP_BACKEND_URL) const socket = openSocket(process.env.REACT_APP_BACKEND_URL)
const onQuickAnswerQuickAnswers = (data) => { socket.on("quickAnswer", (data) => {
if (data.action === "update" || data.action === "create") { if (data.action === "update" || data.action === "create") {
dispatch({ type: "UPDATE_QUICK_ANSWERS", payload: data.quickAnswer }) dispatch({ type: "UPDATE_QUICK_ANSWERS", payload: data.quickAnswer })
} }
@ -139,11 +138,10 @@ const QuickAnswers = () => {
payload: +data.quickAnswerId, payload: +data.quickAnswerId,
}) })
} }
} })
socket.on("quickAnswer", onQuickAnswerQuickAnswers)
return () => { return () => {
socket.off("quickAnswer", onQuickAnswerQuickAnswers) socket.disconnect()
} }
}, []) }, [])

View File

@ -18,24 +18,23 @@ import MaterialTable from 'material-table'
import LogoutIcon from '@material-ui/icons/CancelOutlined' import LogoutIcon from '@material-ui/icons/CancelOutlined'
import apiBroker from "../../services/apiBroker" import apiBroker from "../../services/apiBroker"
import fileDownload from 'js-file-download' import fileDownload from 'js-file-download'
//import openSocket from "socket.io-client" import openSocket from "socket.io-client"
import { socket } from "../../services/socket"
import { i18n } from "../../translate/i18n" import { i18n } from "../../translate/i18n"
import Switch from '@mui/material/Switch' import Switch from '@mui/material/Switch'
const label = { inputProps: { 'aria-label': 'Size switch demo' } } const label = { inputProps: { 'aria-label': 'Size switch demo' } }
const report = [ const report = [
{ 'value': '1', 'label': `${i18n.t("reports.listTitles.title1_1")}` }, { 'value': '1', 'label': 'Atendimento por atendentes' },
{ 'value': '2', 'label': `${i18n.t("reports.listTitles.title3_1")}` }, { 'value': '2', 'label': 'Usuários online/offline' },
{ 'value': '3', 'label': `${i18n.t("reports.listTitles.title4_1")}` }, { 'value': '3', 'label': 'Relatorio de atendimento por numeros' },
{ 'value': '4', 'label': `${i18n.t("reports.listTitles.title5_1")}` }, { 'value': '4', 'label': 'Relatorio de atendimento por filas' },
] ]
const reportOptType = [ const reportOptType = [
{ 'value': '1', 'label': i18n.t('reportOptType.listTitles.title1') }, { 'value': '1', 'label': 'Padrão' },
{ 'value': '2', 'label': i18n.t('reportOptType.listTitles.title2') }, { 'value': '2', 'label': 'Sintético' },
{ 'value': '3', 'label': i18n.t('reportOptType.listTitles.title3') } { 'value': '3', 'label': 'Analítico' }
] ]
@ -592,9 +591,9 @@ const Report = () => {
useEffect(() => { useEffect(() => {
//const socket = openSocket(process.env.REACT_APP_BACKEND_URL) const socket = openSocket(process.env.REACT_APP_BACKEND_URL)
const onQueryOnQueueStatusReport = (data) => { socket.on("queryOnQueueStatus", (data) => {
if (data.action === 'update') { if (data.action === 'update') {
if (String(data.queryOnQueue.adminId) === String(userA.id)) { if (String(data.queryOnQueue.adminId) === String(userA.id)) {
@ -605,11 +604,12 @@ const Report = () => {
} }
} }
} })
socket.on("queryOnQueueStatus", onQueryOnQueueStatusReport) if (reportOption === '2') {
const onOnlineStatusReport = (data) => {
socket.on("onlineStatus", (data) => {
let date = new Date().toLocaleDateString('pt-BR').split('/') let date = new Date().toLocaleDateString('pt-BR').split('/')
let dateToday = `${date[2]}-${date[1]}-${date[0]}` let dateToday = `${date[2]}-${date[1]}-${date[0]}`
@ -624,20 +624,15 @@ const Report = () => {
dispatchQ({ type: "DELETE_USER_STATUS", payload: data.userOnlineTime }) dispatchQ({ type: "DELETE_USER_STATUS", payload: data.userOnlineTime })
} }
} })
const onUserReport = (data) => { socket.on("user", (data) => {
if (data.action === "delete") { if (data.action === "delete") {
dispatch({ type: "DELETE_USER", payload: +data.userId }) dispatch({ type: "DELETE_USER", payload: +data.userId })
} }
} })
if (reportOption === '2') {
socket.on("onlineStatus", onOnlineStatusReport)
socket.on("user", onUserReport)
} }
else if (reportOption === "1") { else if (reportOption === "1") {
@ -646,9 +641,7 @@ const Report = () => {
} }
return () => { return () => {
socket.off("onlineStatus", onOnlineStatusReport) socket.disconnect()
socket.off("user", onUserReport)
socket.off("queryOnQueueStatus", onQueryOnQueueStatusReport)
} }
@ -845,11 +838,11 @@ const Report = () => {
<Box sx={{ display: 'flex', flexDirection: 'column', padding: '10px 0', }}> <Box sx={{ display: 'flex', flexDirection: 'column', padding: '10px 0', }}>
<FormControlLabel <FormControlLabel
control={<Checkbox checked={selectedValue === 'created'} onChange={() => handleCheckBoxChange('created')} />} control={<Checkbox checked={selectedValue === 'created'} onChange={() => handleCheckBoxChange('created')} />}
label="Creado" label="Criado"
/> />
<FormControlLabel <FormControlLabel
control={<Checkbox checked={selectedValue === 'updated'} onChange={() => handleCheckBoxChange('updated')} />} control={<Checkbox checked={selectedValue === 'updated'} onChange={() => handleCheckBoxChange('updated')} />}
label="Actualizado" label="Atualizado"
/> />
</Box> : </Box> :
@ -903,7 +896,7 @@ const Report = () => {
localization={{ localization={{
header: { header: {
actions: 'Unidad' actions: 'Deslogar'
}, },
}} }}
@ -913,7 +906,7 @@ const Report = () => {
[ [
// { title: 'Foto', field: 'ticket.contact.profilePicUrl', render: rowData => <img src={rowData['ticket.contact.profilePicUrl']} alt="imagem de perfil do whatsapp" style={{ width: 40, borderRadius: '50%' }} /> }, // { title: 'Foto', field: 'ticket.contact.profilePicUrl', render: rowData => <img src={rowData['ticket.contact.profilePicUrl']} alt="imagem de perfil do whatsapp" style={{ width: 40, borderRadius: '50%' }} /> },
{ title: 'Nombre', field: 'name', cellStyle: { whiteSpace: 'nowrap' }, }, { title: 'Nome', field: 'name', cellStyle: { whiteSpace: 'nowrap' }, },
{ {
title: 'Status', field: 'statusOnline.status', title: 'Status', field: 'statusOnline.status',
@ -942,11 +935,11 @@ const Report = () => {
}, },
{ title: `${i18n.t('reports.onlineTime')}`, field: 'sumOnlineTime.sum' }, { title: 'Tempo online', field: 'sumOnlineTime.sum' },
{ title: `${i18n.t("reports.dateStart")}`, field: 'startDate' }, { title: `${i18n.t("reports.dateStart")}`, field: 'startDate' },
{ title: `${i18n.t("reports.dateEnd")}`, field: 'endDate' }, { title: `${i18n.t("reports.dateEnd")}`, field: 'endDate' },
{ title: `${i18n.t('reports.inService')}`, field: 'sumOpen.count' }, { title: 'Em atendimento', field: 'sumOpen.count' },
{ title: `${i18n.t('reports.finished')}`, field: 'sumClosed.count' }, { title: 'Finalizado', field: 'sumClosed.count' },
] ]
} }
@ -1008,20 +1001,20 @@ const Report = () => {
title={i18n.t("reports.listTitles.title4_1")} title={i18n.t("reports.listTitles.title4_1")}
columns={ columns={
!checkedRemote ? [ !checkedRemote ? [
{ title: i18n.t('reports.listColumns.column3_1'), field: 'name', cellStyle: { whiteSpace: 'nowrap' }, }, { title: 'Unidade', field: 'name', cellStyle: { whiteSpace: 'nowrap' }, },
{ title: i18n.t('reports.listColumns.column3_3'), field: 'startedByAgent', }, { title: 'Conversas iniciadas', field: 'startedByAgent', },
{ title: i18n.t('reports.listColumns.column3_4'), field: 'startedByClient' }, { title: 'Conversas recebidas', field: 'startedByClient' },
{ title: i18n.t('reports.listColumns.column3_5'), field: 'closedChat' }, { title: `Conversas finalizadas`, field: 'closedChat' },
{ title: i18n.t('reports.listColumns.column3_6'), field: 'avgChatWaitingTime' }, { title: `Tempo médio de espera`, field: 'avgChatWaitingTime' },
{ title: i18n.t('reports.listColumns.column3_7'), field: 'pendingChat' } { title: 'Aguardando', field: 'pendingChat' }
] : ] :
[ [
{ title: i18n.t('reports.listColumns.column3_1'), field: 'name', cellStyle: { whiteSpace: 'nowrap' }, }, { title: 'Unidade', field: 'name', cellStyle: { whiteSpace: 'nowrap' }, },
{ title: i18n.t('reports.listColumns.column3_3'), field: 'startedByAgent', }, { title: 'Conversas iniciadas', field: 'startedByAgent', },
{ title: i18n.t('reports.listColumns.column3_4'), field: 'startedByClient' }, { title: 'Conversas respondidas', field: 'startedByClient' },
{ title: i18n.t('reports.listColumns.column3_5'), field: 'closedChat' }, { title: `Conversas finalizadas`, field: 'closedChat' },
{ title: i18n.t('reports.listColumns.column3_7'), field: 'pendingChat' } { title: 'Aguardando', field: 'pendingChat' }
] ]
} }
@ -1061,9 +1054,9 @@ const Report = () => {
columns={ columns={
!checkedRemote ? [ !checkedRemote ? [
{ title: i18n.t('reports.listColumns.column3_1'), field: 'name', cellStyle: { whiteSpace: 'nowrap' }, }, { title: 'Unidade', field: 'name', cellStyle: { whiteSpace: 'nowrap' }, },
{ {
title: i18n.t('reports.listColumns.column3_2'), field: 'queueName', title: 'Fila', field: 'queueName',
cellStyle: (evt, rowData) => { cellStyle: (evt, rowData) => {
return { return {
whiteSpace: 'nowrap', whiteSpace: 'nowrap',
@ -1073,19 +1066,19 @@ const Report = () => {
} }
}, },
{ title: i18n.t('reports.listColumns.column3_3'), field: 'startedByAgent', }, { title: 'Conversas iniciadas', field: 'startedByAgent', },
{ title: i18n.t('reports.listColumns.column3_4'), field: 'startedByClient' }, { title: 'Conversas recebidas', field: 'startedByClient' },
{ title: i18n.t('reports.listColumns.column3_5'), field: 'closedChat' }, { title: `Conversas finalizadas`, field: 'closedChat' },
{ title: i18n.t('reports.listColumns.column3_6'), field: 'avgChatWaitingTime' }, { title: `Tempo médio de espera`, field: 'avgChatWaitingTime' },
{ title: i18n.t('reports.listColumns.column3_7'), field: 'pendingChat' } { title: 'Aguardando', field: 'pendingChat' }
] : ] :
[ [
{ title: i18n.t('reports.listColumns.column3_1'), field: 'name', cellStyle: { whiteSpace: 'nowrap' }, }, { title: 'Unidade', field: 'name', cellStyle: { whiteSpace: 'nowrap' }, },
{ {
title: i18n.t('reports.listColumns.column3_2'), field: 'queueName', title: 'Fila', field: 'queueName',
cellStyle: (evt, rowData) => { cellStyle: (evt, rowData) => {
return { return {
whiteSpace: 'nowrap', whiteSpace: 'nowrap',
@ -1095,10 +1088,10 @@ const Report = () => {
} }
}, },
{ title: i18n.t('reports.listColumns.column3_3'), field: 'startedByAgent', }, { title: 'Conversas iniciadas', field: 'startedByAgent', },
{ title: i18n.t('reports.listColumns.column3_4'), field: 'startedByClient' }, { title: 'Conversas respondidas', field: 'startedByClient' },
{ title: i18n.t('reports.listColumns.column3_5'), field: 'closedChat' }, { title: `Conversas finalizadas`, field: 'closedChat' },
{ title: i18n.t('reports.listColumns.column3_7'), field: 'pendingChat' } { title: 'Aguardando', field: 'pendingChat' }
] ]
} }

View File

@ -28,8 +28,8 @@ import { render } from '@testing-library/react'
// import Modal from "../../../..ChatEnd/ModalChatEnd"; // import Modal from "../../../..ChatEnd/ModalChatEnd";
import Modal from "../../components/ModalUpdateScheduleReminder" import Modal from "../../components/ModalUpdateScheduleReminder"
//import openSocket from "socket.io-client" import openSocket from "socket.io-client"
import { socket } from "../../services/socket"
@ -204,9 +204,11 @@ const SchedulesReminder = () => {
useEffect(() => { useEffect(() => {
//const socket = openSocket(process.env.REACT_APP_BACKEND_URL) const socket = openSocket(process.env.REACT_APP_BACKEND_URL)
socket.on("schedulingNotify", (data) => {
const onSchedulingNotifySchedulesRemider = (data) => {
setLoading(true) setLoading(true)
@ -226,12 +228,10 @@ const SchedulesReminder = () => {
setLoading(false) setLoading(false)
} })
socket.on("schedulingNotify", onSchedulingNotifySchedulesRemider)
return () => { return () => {
socket.off("schedulingNotify", onSchedulingNotifySchedulesRemider) socket.disconnect()
} }
}, []) }, [])

View File

@ -1,6 +1,5 @@
import React, { useState, useEffect, useContext } from 'react' import React, { useState, useEffect, useContext } from 'react'
//import openSocket from 'socket.io-client' import openSocket from 'socket.io-client'
import { socket } from '../../services/socket.js'
import { makeStyles } from '@material-ui/core/styles' import { makeStyles } from '@material-ui/core/styles'
import Paper from '@material-ui/core/Paper' import Paper from '@material-ui/core/Paper'
@ -125,9 +124,9 @@ const Settings = () => {
useEffect(() => { useEffect(() => {
//const socket = openSocket(process.env.REACT_APP_BACKEND_URL) const socket = openSocket(process.env.REACT_APP_BACKEND_URL)
const onSettingsSettings = (data) => { socket.on('settings', (data) => {
console.log('settings updated ----------------------------') console.log('settings updated ----------------------------')
if (data.action === 'update') { if (data.action === 'update') {
@ -138,12 +137,10 @@ const Settings = () => {
return aux return aux
}) })
} }
} })
socket.on('settings', onSettingsSettings)
return () => { return () => {
socket.off("settings", onSettingsSettings) socket.disconnect()
} }
}, []) }, [])
@ -182,11 +179,7 @@ const Settings = () => {
} }
const getSettingValue = (key, _obj = false) => { const getSettingValue = (key, _obj = false) => {
//const { value, obj } = settings.find((s) => s.key === key) const { value, obj } = settings.find((s) => s.key === key)
const setting = settings.find((s) => s.key === key)
const value = setting?.value || ""
const obj = setting?.obj || null
if (_obj) if (_obj)
return obj return obj

View File

@ -1,6 +1,5 @@
import React, { useState, useContext, useEffect, useReducer } from "react" import React, { useState, useContext, useEffect, useReducer } from "react"
//import openSocket from "socket.io-client" import openSocket from "socket.io-client"
import { socket } from "../../services/socket"
import { import {
Button, Button,
@ -132,9 +131,9 @@ const StatusChatEnd = () => {
}, [searchParam, pageNumber]) }, [searchParam, pageNumber])
useEffect(() => { useEffect(() => {
//const socket = openSocket(process.env.REACT_APP_BACKEND_URL) const socket = openSocket(process.env.REACT_APP_BACKEND_URL)
const onStatusChatEndStatusChatEnd = (data) => { socket.on("statusChatEnd", (data) => {
if (data.action === "update" || data.action === "create") { if (data.action === "update" || data.action === "create") {
dispatch({ type: "UPDATE_STATUS_CHAT_END", payload: data.statusChatEnd }) dispatch({ type: "UPDATE_STATUS_CHAT_END", payload: data.statusChatEnd })
} }
@ -145,12 +144,10 @@ const StatusChatEnd = () => {
payload: +data.statusChatEndId, payload: +data.statusChatEndId,
}) })
} }
} })
socket.on("statusChatEnd", onStatusChatEndStatusChatEnd)
return () => { return () => {
socket.off("statusChatEnd", onStatusChatEndStatusChatEnd) socket.disconnect()
} }
}, []) }, [])
@ -220,7 +217,7 @@ const StatusChatEnd = () => {
<ConfirmationModal <ConfirmationModal
title={ title={
deletingStatusChatEnds && deletingStatusChatEnds &&
`${i18n.t('dashboard.titles.confirmationModal')} ${deletingStatusChatEnds.name `Você tem certeza que quer excluir esta Status de encerramento: ${deletingStatusChatEnds.name
}?` }?`
} }
open={confirmModalOpen} open={confirmModalOpen}
@ -236,7 +233,7 @@ const StatusChatEnd = () => {
statusChatEndId={selectedStatusChatEnd && selectedStatusChatEnd.id} statusChatEndId={selectedStatusChatEnd && selectedStatusChatEnd.id}
></StatusChatEndModal> ></StatusChatEndModal>
<MainHeader> <MainHeader>
<Title>{i18n.t('dashboard.titles.status')}</Title> <Title>{"Status de encerramento"}</Title>
<MainHeaderButtonsWrapper> <MainHeaderButtonsWrapper>
<TextField <TextField
placeholder={i18n.t("quickAnswers.searchPlaceholder")} placeholder={i18n.t("quickAnswers.searchPlaceholder")}
@ -269,13 +266,13 @@ const StatusChatEnd = () => {
<TableHead> <TableHead>
<TableRow> <TableRow>
<TableCell align="center"> <TableCell align="center">
{i18n.t('dashboard.titles.status')} {"Status de encerramento"}
</TableCell> </TableCell>
<TableCell align="center"> <TableCell align="center">
{i18n.t('quickAnswers.table.farewellMessage')} {"Mensagem de despedida"}
</TableCell> </TableCell>
<TableCell align="center"> <TableCell align="center">
{i18n.t('quickAnswers.table.standard')} {"Padrão"}
</TableCell> </TableCell>
<TableCell align="center"> <TableCell align="center">
{i18n.t("quickAnswers.table.actions")} {i18n.t("quickAnswers.table.actions")}

View File

@ -1,7 +1,6 @@
import React, { useState, useEffect, useReducer, useContext } from "react" import React, { useState, useEffect, useReducer, useContext } from "react"
import { toast } from "react-toastify" import { toast } from "react-toastify"
//import openSocket from "socket.io-client" import openSocket from "socket.io-client"
import { socket } from "../../services/socket"
import { makeStyles } from "@material-ui/core/styles" import { makeStyles } from "@material-ui/core/styles"
import Paper from "@material-ui/core/Paper" import Paper from "@material-ui/core/Paper"
@ -166,9 +165,9 @@ const Users = () => {
useEffect(() => { useEffect(() => {
//const socket = openSocket(process.env.REACT_APP_BACKEND_URL) const socket = openSocket(process.env.REACT_APP_BACKEND_URL)
const onUserUsers = (data) => { socket.on("user", (data) => {
if (data.action === "update" || data.action === "create") { if (data.action === "update" || data.action === "create") {
dispatch({ type: "UPDATE_USERS", payload: data.user }) dispatch({ type: "UPDATE_USERS", payload: data.user })
} }
@ -176,11 +175,10 @@ const Users = () => {
if (data.action === "delete") { if (data.action === "delete") {
dispatch({ type: "DELETE_USER", payload: +data.userId }) dispatch({ type: "DELETE_USER", payload: +data.userId })
} }
} })
socket.on("user", onUserUsers)
const onSettingsUsers = (data) => { socket.on('settings', (data) => {
if (data.action === 'update') { if (data.action === 'update') {
setSettings((prevState) => { setSettings((prevState) => {
const aux = [...prevState] const aux = [...prevState]
@ -189,12 +187,10 @@ const Users = () => {
return aux return aux
}) })
} }
} })
socket.on('settings', onSettingsUsers)
return () => { return () => {
socket.off("settings", onSettingsUsers) socket.disconnect()
socket.off("user", onUserUsers)
} }
}, []) }, [])

View File

@ -1,14 +1,9 @@
import React, { useContext, Suspense, lazy } from "react"; import React, { useContext } from "react";
import { Route as RouterRoute, Redirect } from "react-router-dom"; import { Route as RouterRoute, Redirect } from "react-router-dom";
import { AuthContext } from "../context/Auth/AuthContext"; import { AuthContext } from "../context/Auth/AuthContext";
import BackdropLoading from "../components/BackdropLoading"; import BackdropLoading from "../components/BackdropLoading";
// Exemplo de como você carregaria componentes de forma lazy
const Dashboard = lazy(() => import("../pages/Dashboard"));
const Login = lazy(() => import("../pages/Login"));
const Signup = lazy(() => import("../pages/Signup"));
const Route = ({ component: Component, isPrivate = false, ...rest }) => { const Route = ({ component: Component, isPrivate = false, ...rest }) => {
const { isAuth, loading } = useContext(AuthContext); const { isAuth, loading } = useContext(AuthContext);
@ -25,7 +20,7 @@ const Route = ({ component: Component, isPrivate = false, ...rest }) => {
return ( return (
<> <>
{loading && <BackdropLoading />} {loading && <BackdropLoading />}
<Redirect to={{ pathname: "/", state: { from: rest.location } }} /> <Redirect to={{ pathname: "/", state: { from: rest.location } }} />;
</> </>
); );
} }
@ -33,9 +28,7 @@ const Route = ({ component: Component, isPrivate = false, ...rest }) => {
return ( return (
<> <>
{loading && <BackdropLoading />} {loading && <BackdropLoading />}
<Suspense fallback={<BackdropLoading />}>
<RouterRoute {...rest} component={Component} /> <RouterRoute {...rest} component={Component} />
</Suspense>
</> </>
); );
}; };

View File

@ -1,34 +1,34 @@
import React, { Suspense, lazy } from 'react'; import React from 'react'
import { BrowserRouter, Switch } from 'react-router-dom' import { BrowserRouter, Switch } from 'react-router-dom'
import { ToastContainer } from 'react-toastify' import { ToastContainer } from 'react-toastify'
import LoggedInLayout from '../layout'
import Dashboard from '../pages/Dashboard/'
import Report from '../pages/Report/'
import SchedulesReminder from '../pages/SchedulesReminder/'
import Tickets from '../pages/Tickets/'
import Signup from '../pages/Signup/'
import Login from '../pages/Login/'
import Connections from '../pages/Connections/'
import Campaign from '../pages/Campaign'
import Settings from '../pages/Settings/'
import Users from '../pages/Users'
import Contacts from '../pages/Contacts/'
import QuickAnswers from '../pages/QuickAnswers/'
import StatusChatEnd from '../pages/StatusChatEnd/'
import Position from '../pages/Position/'
import Queues from '../pages/Queues/'
import { AuthProvider } from '../context/Auth/AuthContext' import { AuthProvider } from '../context/Auth/AuthContext'
import { WhatsAppsProvider } from '../context/WhatsApp/WhatsAppsContext' import { WhatsAppsProvider } from '../context/WhatsApp/WhatsAppsContext'
import LoggedInLayout from '../layout'
import Route from './Route' import Route from './Route'
import BackdropLoading from "../components/BackdropLoading";
const Dashboard = lazy(() => import('../pages/Dashboard/'));
const Report = lazy(() => import('../pages/Report/'));
const SchedulesReminder = lazy(() => import('../pages/SchedulesReminder/'));
const Tickets = lazy(() => import('../pages/Tickets/'));
const Signup = lazy(() => import('../pages/Signup/'));
const Login = lazy(() => import('../pages/Login/'));
const Connections = lazy(() => import('../pages/Connections/'));
const Campaign = lazy(() => import('../pages/Campaign/'));
const Settings = lazy(() => import('../pages/Settings/'));
const Users = lazy(() => import('../pages/Users/'));
const Contacts = lazy(() => import('../pages/Contacts/'));
const QuickAnswers = lazy(() => import('../pages/QuickAnswers/'));
const StatusChatEnd = lazy(() => import('../pages/StatusChatEnd/'));
const Position = lazy(() => import('../pages/Position/'));
const Queues = lazy(() => import('../pages/Queues/'));
const Routes = () => { const Routes = () => {
return ( return (
<BrowserRouter> <BrowserRouter>
<AuthProvider> <AuthProvider>
<Suspense fallback={<BackdropLoading />}>
<Switch> <Switch>
<Route exact path="/login" component={Login} /> <Route exact path="/login" component={Login} />
<Route exact path="/signup" component={Signup} /> <Route exact path="/signup" component={Signup} />
@ -41,20 +41,25 @@ const Routes = () => {
component={Tickets} component={Tickets}
isPrivate isPrivate
/> />
<Route <Route
exact exact
path="/connections" path="/connections"
component={Connections} component={Connections}
isPrivate isPrivate
/> />
<Route exact path="/report" component={Report} isPrivate /> <Route exact path="/report" component={Report} isPrivate />
<Route exact path="/contacts" component={Contacts} isPrivate /> <Route exact path="/contacts" component={Contacts} isPrivate />
<Route <Route
exact exact
path="/schedulesReminder" path="/schedulesReminder"
component={SchedulesReminder} component={SchedulesReminder}
isPrivate isPrivate
/> />
<Route exact path="/users" component={Users} isPrivate /> <Route exact path="/users" component={Users} isPrivate />
<Route <Route
exact exact
@ -68,18 +73,22 @@ const Routes = () => {
component={StatusChatEnd} component={StatusChatEnd}
isPrivate isPrivate
/> />
<Route exact path="/position" component={Position} isPrivate /> <Route
exact
path="/position"
component={Position}
isPrivate
/>
<Route exact path="/Settings" component={Settings} isPrivate /> <Route exact path="/Settings" component={Settings} isPrivate />
<Route exact path="/Queues" component={Queues} isPrivate /> <Route exact path="/Queues" component={Queues} isPrivate />
<Route exact path="/campaign" component={Campaign} isPrivate /> <Route exact path="/campaign" component={Campaign} isPrivate />
</LoggedInLayout> </LoggedInLayout>
</WhatsAppsProvider> </WhatsAppsProvider>
</Switch> </Switch>
</Suspense>
<ToastContainer autoClose={3000} /> <ToastContainer autoClose={3000} />
</AuthProvider> </AuthProvider>
</BrowserRouter> </BrowserRouter>
); )
} }
export default Routes export default Routes

View File

@ -1,14 +0,0 @@
import { io } from 'socket.io-client';
// "undefined" means the URL will be computed from the `window.location` object
const URL = process.env.REACT_APP_BACKEND_URL
export const socket = io(URL,
//{
// withCredentials: true,
// extraHeaders: {
// "my-custom-header": "abcd"
// },
// transports: ['websocket', 'polling']
//}
);

View File

@ -59,45 +59,6 @@ const messages = {
column3: 'Closed by Queue', column3: 'Closed by Queue',
column4: 'Online time', column4: 'Online time',
column5: 'Actions', column5: 'Actions',
},
titles: {
selectQueues: 'Queues',
waiting: 'In Waiting',
inService: 'In Service',
users: 'Users',
name: 'Name',
attendant: 'Attendant',
dialogContentText: 'Choose a reporting option below.',
transfer: 'Transfer to other queues',
title: 'Closing tickets',
confirmationModal: 'Are you sure you want to remove this closing state: ',
status: 'Closing status',
listUser: 'List user',
user: 'user',
notEnter: 'Did not enter',
notEnterToday: 'Did not enter today',
ticketsClosed: 'Closed'
}
},
reportOptType: {
listTitles: {
title1: 'Standard',
title2: 'Synthetic',
title3: 'Analytical'
}
},
configModal: {
titles: {
startService: 'Start Service',
endService: 'End Service',
enableDisable: 'Enable/Disable',
outOfHours: 'Message outside opening hours',
outOfHoursSaturday: 'Message outside opening hours Saturday',
forTheWeekend: 'Weekend message',
holiday: 'Holiday date',
holidayMessage: 'Message for holidays',
inactivityMessage: 'Message due to lack of service activity',
save: 'Save'
} }
}, },
connections: { connections: {
@ -334,8 +295,7 @@ const messages = {
administration: "Administration", administration: "Administration",
users: "Users", users: "Users",
settings: "Settings", settings: "Settings",
schedules: "Schedules", schedules: "Schedules"
reports: "Reports"
}, },
appBar: { appBar: {
user: { user: {
@ -349,9 +309,7 @@ const messages = {
title0_1: "Reminders/Schedulings", title0_1: "Reminders/Schedulings",
title1_1: "Calls by attendants", title1_1: "Calls by attendants",
title2_1: "Whatsapp chat", title2_1: "Whatsapp chat",
title3_1: "Users online/offline", title3_1: "Users online/offline"
title4_1: "Attendance report by numbers",
title5_1: "Queue service report"
}, },
listColumns:{ listColumns:{
column0_1: 'Actions', column0_1: 'Actions',
@ -372,22 +330,13 @@ const messages = {
column1_9: 'Closing status', column1_9: 'Closing status',
column2_1: 'Attendant/Client', column2_1: 'Attendant/Client',
column3_1: 'Unit',
column3_2: 'Row',
column3_3: 'Conversations started',
column3_4: 'Incoming conversations',
column3_5: 'Finished conversations',
column3_6: 'Average waiting time',
column3_7: 'Waiting',
}, },
search: 'Number/Name...', search: 'Number/Name...',
dateStart: 'Start date', dateStart: 'Start date',
dateEnd: 'End date', dateEnd: 'End date',
user: 'User', user: 'User'
onlineTime: 'Online time',
inService: 'In service',
finished: 'Finished'
}, },
notifications: { notifications: {
noTickets: "No notifications.", noTickets: "No notifications.",
@ -418,8 +367,6 @@ const messages = {
shortcut: "Shortcut", shortcut: "Shortcut",
message: "Quick Reply", message: "Quick Reply",
actions: "Actions", actions: "Actions",
farewellMessage: "Farewell message",
standard: "Standard"
}, },
buttons: { buttons: {
add: "Add Quick Reply", add: "Add Quick Reply",

View File

@ -61,46 +61,6 @@ const messages = {
column3: 'Cerrado por cola', column3: 'Cerrado por cola',
column4: 'Tiempo Online', column4: 'Tiempo Online',
column5: 'Actions', column5: 'Actions',
},
titles: {
selectQueues: 'Colas',
waiting: 'En espera',
inService: 'En Atendimiento',
users: 'Usuarios',
name: 'Nombre',
attendant: 'Agente',
dialogTitle: 'Reportes',
dialogContentText: 'Escoja una opción de reporte abajo.',
transfer: 'Transferir para otras Colas',
title: 'Cierre de Tickets',
confirmationModal: 'Está seguro de que desea eliminar este estado de cierre: ',
status: 'Status de cierre',
listUser: 'Lista de Usuarios',
user: 'Usuario',
notEnter: 'No ingresó',
notEnterToday: 'No ingresó hoy',
ticketsClosed: 'Cerrados'
}
},
reportOptType: {
listTitles: {
title1: 'Patrón',
title2: 'Sintético',
title3: 'Analítico'
}
},
configModal: {
titles: {
startService: 'Inicio atención',
endService: 'Fin atención',
enableDisable: 'Activar/Desactivar',
outOfHours: 'Mensaje fuera de horario de atención',
outOfHoursSaturday: 'Mensaje fuera del horario de atención sábado',
forTheWeekend: 'Mensaje fin de semana',
holiday: 'Día Festivo',
holidayMessage: 'Mensaje para Festivos',
inactivityMessage: 'Mensaje por falta de actividad',
save: 'Guardar'
} }
}, },
connections: { connections: {
@ -277,7 +237,7 @@ const messages = {
}, },
}, },
ticketsQueueSelect: { ticketsQueueSelect: {
placeholder: "Líneas", placeholder: "Linhas",
}, },
tickets: { tickets: {
toasts: { toasts: {
@ -336,13 +296,11 @@ const messages = {
tickets: "Tickets", tickets: "Tickets",
contacts: "Contactos", contacts: "Contactos",
quickAnswers: "Respuestas rápidas", quickAnswers: "Respuestas rápidas",
queues: "Líneas", queues: "Linhas",
administration: "Administración", administration: "Administración",
users: "Usuarios", users: "Usuarios",
settings: "Configuración", settings: "Configuración",
schedules: "Recordatorio", schedules: "Recordatorio"
reports: "Reportes",
campain: "Campañas"
}, },
appBar: { appBar: {
user: { user: {
@ -354,11 +312,9 @@ const messages = {
reports: { reports: {
listTitles: { listTitles: {
title0_1: "Recordatorios/Programación", title0_1: "Recordatorios/Programación",
title1_1: "Atención por agentes", title1_1: "Llamadas de asistentes",
title2_1: "Chat de whatsapp", title2_1: "Chat de whatsapp",
title3_1: "Usuarios online/offline", title3_1: "Usuarios online/offline"
title4_1: "Reporte de atención por números",
title5_1: "Reporte de atención por colas"
}, },
listColumns:{ listColumns:{
column0_1: 'Acción', column0_1: 'Acción',
@ -379,28 +335,18 @@ const messages = {
column1_9: 'Estado de cierre', column1_9: 'Estado de cierre',
column2_1: 'Secretario/Cliente', column2_1: 'Secretario/Cliente',
column3_1: 'Unidad',
column3_2: 'Cola',
column3_3: 'Chats iniciados',
column3_4: 'Chats Recibidos',
column3_5: 'Chats Finalizados',
column3_6: 'Tiempo medio de espera',
column3_7: 'En Espera',
}, },
search: 'Número/Nombre...', search: 'Número/Nombre...',
dateStart: 'Fecha de inicio', dateStart: 'Fecha de inicio',
dateEnd: 'Fecha final', dateEnd: 'Fecha final',
user: 'Usuario', user: 'Usuario'
onlineTime: 'Tiempo online',
inService: 'En servicio',
finished: 'Finalizado'
}, },
notifications: { notifications: {
noTickets: "Sin notificaciones.", noTickets: "Sin notificaciones.",
}, },
queues: { queues: {
title: "Líneas", title: "Linhas",
table: { table: {
name: "Nombre", name: "Nombre",
color: "Color", color: "Color",
@ -417,7 +363,7 @@ const messages = {
}, },
}, },
queueSelect: { queueSelect: {
inputLabel: "Líneas", inputLabel: "Linhas",
}, },
quickAnswers: { quickAnswers: {
title: "Respuestas rápidas", title: "Respuestas rápidas",
@ -425,8 +371,6 @@ const messages = {
shortcut: "Atajo", shortcut: "Atajo",
message: "Respuesta rápida", message: "Respuesta rápida",
actions: "Acciones", actions: "Acciones",
farewellMessage: "Mensaje de despedida",
standard: "Patrón"
}, },
buttons: { buttons: {
add: "Agregar respuesta rápida", add: "Agregar respuesta rápida",

View File

@ -59,46 +59,6 @@ const messages = {
column3: 'Fechados Por Fila', column3: 'Fechados Por Fila',
column4: 'Tempo Online', column4: 'Tempo Online',
column5: 'Ações', column5: 'Ações',
},
titles: {
selectQueues: 'Filas',
waiting: 'Em espera',
inService: 'Em Atendimento',
users: 'Usuários',
name: 'Nome',
attendant: 'Atendente',
dialogTitle: 'Relatórios',
dialogContentText: 'Escolha uma opção de relatório abaixo.',
transfer: 'Transferir para outras filas',
title: 'Tickets encerramento',
confirmationModal: 'Você tem certeza que quer excluir esta Status de encerramento: ' ,
status: 'Status de encerramento',
listUser: 'Lista de Usuarios',
user: 'Usuario',
notEnter: 'Não entrou',
notEnterToday: 'Não entrou hoje',
ticketsClosed: 'Fechados'
}
},
reportOptType: {
listTitles: {
title1: 'Padrão',
title2: 'Sintético',
title3: 'Analítico'
}
},
configModal: {
titles: {
startService: 'Início atendimento',
endService: 'Fim atendimento',
enableDisable: 'Ativar/Desativar',
outOfHours: 'Mensagem fora do horário de atendimento',
outOfHoursSaturday: 'Mensagem fora do horário de atendimento sábado',
forTheWeekend: 'Mensagem fim de semana',
holiday: 'Data do feriado',
holidayMessage: 'Mensagem para feriados',
inactivityMessage: 'Mensagem por falta de atividade no atendimento',
save: 'Salvar'
} }
}, },
connections: { connections: {
@ -339,9 +299,7 @@ const messages = {
administration: "Administração", administration: "Administração",
users: "Usuários", users: "Usuários",
settings: "Configurações", settings: "Configurações",
schedules: "Lembretes", schedules: "Lembretes"
reports: "Relatórios",
campaign: "Campanha"
}, },
appBar: { appBar: {
user: { user: {
@ -379,21 +337,13 @@ const messages = {
column2_1: 'Atendente/Cliente', column2_1: 'Atendente/Cliente',
column3_1: 'Unidade',
column3_2: 'Fila',
column3_3: 'Conversas iniciadas',
column3_4: 'Conversas recebidas',
column3_5: 'Conversas finalizadas',
column3_6: 'Tempo médio de espera',
column3_7: 'Aguardando',
}, },
search: 'Numer/Nome...', search: 'Numer/Nome...',
dateStart: 'Data início', dateStart: 'Data início',
dateEnd: 'Data fim', dateEnd: 'Data fim',
user: 'Usuário', user: 'Usuário'
onlineTime: 'Tempo online',
inService: 'Em atendimento',
finished: 'Finalizado'
}, },
notifications: { notifications: {
noTickets: "Nenhuma notificação.", noTickets: "Nenhuma notificação.",
@ -424,8 +374,6 @@ const messages = {
shortcut: "Atalho", shortcut: "Atalho",
message: "Resposta Rápida", message: "Resposta Rápida",
actions: "Ações", actions: "Ações",
farewellMessage: "Mensagem de despedida",
standard: "Padrão"
}, },
buttons: { buttons: {
add: "Adicionar Resposta Rápida", add: "Adicionar Resposta Rápida",

2
package-lock.json generated
View File

@ -1,5 +1,5 @@
{ {
"name": "projeto-hit", "name": "whaticket",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {