1 // *************************************************************************
3 // * xCALLY Motion - The Omnichannel Contact Center *
4 // * Copyright (c) Xenialab s.r.l. All Rights Reserved *
6 // *************************************************************************
8 // * Email: info@xcally.com *
9 // * Website: https://www.xcally.com *
11 // *************************************************************************
13 // * The SOFTWARE PRODUCT is protected by copyright laws and international *
14 // * copyright treaties, as well as other intellectual property laws and *
15 // * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
17 // *************************************************************************
18 var _0xe6cd=['findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','events','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','save','remove','getUsers','then','setDataValue','Users'];(function(_0x2c88b6,_0x7fa2bb){var _0x1478d1=function(_0x2d9565){while(--_0x2d9565){_0x2c88b6['push'](_0x2c88b6['shift']());}};_0x1478d1(++_0x7fa2bb);}(_0xe6cd,0x1ed));var _0xde6c=function(_0x15ccfe,_0xb6e509){_0x15ccfe=_0x15ccfe-0x0;var _0x538030=_0xe6cd[_0x15ccfe];return _0x538030;};'use strict';var EventEmitter=require(_0xde6c('0x0'));var FaxInteraction=require(_0xde6c('0x1'))['db'][_0xde6c('0x2')];var FaxMessage=require(_0xde6c('0x1'))['db'][_0xde6c('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xde6c('0x4')](0x0);var events={'afterCreate':_0xde6c('0x5'),'afterUpdate':'update','afterDestroy':_0xde6c('0x6')};function emitEvent(_0x4c8ab4){return function(_0x5b7ef8,_0xb7f73b,_0x24f99c){_0x5b7ef8[_0xde6c('0x7')]({'attributes':['id'],'raw':!![]})[_0xde6c('0x8')](function(_0x26c2a0){_0x5b7ef8[_0xde6c('0x9')](_0xde6c('0xa'),_0x26c2a0['map'](function(_0x21ae99){return{'id':_0x21ae99['id']};}));return FaxMessage[_0xde6c('0xb')]({'where':{'FaxInteractionId':_0x5b7ef8['id'],'direction':'in','read':![]},'raw':!![]});})[_0xde6c('0x8')](function(_0x18327){_0x5b7ef8[_0xde6c('0x9')](_0xde6c('0xc'),_0x18327[_0xde6c('0xd')]);FaxInteractionEvents[_0xde6c('0xe')](_0x4c8ab4+':'+_0x5b7ef8['id'],_0x5b7ef8);FaxInteractionEvents['emit'](_0x4c8ab4,_0x5b7ef8);_0x24f99c(null);})[_0xde6c('0xf')](_0x24f99c(null));};}for(var e in events){if(events[_0xde6c('0x10')](e)){var event=events[e];FaxInteraction[_0xde6c('0x11')](e,emitEvent(event));}}module['exports']=FaxInteractionEvents;