Built motion from commit f623a78c.|2.6.31
[motion2.git] / server / api / chatWebsite / index.js
1 // *************************************************************************
2 // *                                                                       *
3 // * xCALLY Motion -  The Omnichannel Contact Center                       *
4 // * Copyright (c) Xenialab s.r.l. All Rights Reserved                     *
5 // *                                                                       *
6 // *************************************************************************
7 // *                                                                       *
8 // * Email: info@xcally.com                                                *
9 // * Website: https://www.xcally.com                                       *
10 // *                                                                       *
11 // *************************************************************************
12 // *                                                                       *
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.                         *
16 // *                                                                       *
17 // *************************************************************************
18 var _0x6bc2=['/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','getOfflineMessages','/:id/users','post','create','addDisposition','addAnswer','diskStorage','join','root','server/files/images/logos/','format','%s-%s','originalname','single','file','addLogo','server/files/images/avatars/','addAvatar','now','addCustomerAvatar','/:id/system_avatar','addSystemAvatar','/:id/notify','notify','attachments','offline-chat','ensureDir','extname','replace','/:id/offline','any','offline','addApplications','addProactiveActions','put','update','delete','removeAnswers','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','index','/describe','describe','/:id','show','/:id/dispositions','isAuthenticated','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','getLogo','/:id/avatar','getAvatar','getSystemAvatar','/:id/interactions','getInteractions'];(function(_0x4e817c,_0x377b98){var _0x2f7a9f=function(_0x48b8d4){while(--_0x48b8d4){_0x4e817c['push'](_0x4e817c['shift']());}};_0x2f7a9f(++_0x377b98);}(_0x6bc2,0x73));var _0x26bc=function(_0xbbc85e,_0x100d7c){_0xbbc85e=_0xbbc85e-0x0;var _0x43d533=_0x6bc2[_0xbbc85e];return _0x43d533;};'use strict';var multer=require(_0x26bc('0x0'));var util=require(_0x26bc('0x1'));var path=require(_0x26bc('0x2'));var timeout=require(_0x26bc('0x3'));var express=require(_0x26bc('0x4'));var router=express[_0x26bc('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x26bc('0x6'));var config=require(_0x26bc('0x7'));var controller=require(_0x26bc('0x8'));router[_0x26bc('0x9')]('/',auth['isAuthenticated'](),controller[_0x26bc('0xa')]);router[_0x26bc('0x9')](_0x26bc('0xb'),auth['isAuthenticated'](),controller[_0x26bc('0xc')]);router['get'](_0x26bc('0xd'),auth['isAuthenticated'](),controller[_0x26bc('0xe')]);router['get'](_0x26bc('0xf'),auth[_0x26bc('0x10')](),controller[_0x26bc('0x11')]);router[_0x26bc('0x9')](_0x26bc('0x12'),auth[_0x26bc('0x10')](),controller[_0x26bc('0x13')]);router[_0x26bc('0x9')](_0x26bc('0x14'),controller[_0x26bc('0x15')]);router['get'](_0x26bc('0x16'),controller[_0x26bc('0x17')]);router[_0x26bc('0x9')]('/:id/customer_avatar',controller['getCustomerAvatar']);router[_0x26bc('0x9')]('/:id/system_avatar',controller[_0x26bc('0x18')]);router[_0x26bc('0x9')](_0x26bc('0x19'),auth['isAuthenticated'](),controller[_0x26bc('0x1a')]);router['get']('/:id/snippet',controller['getSnippet']);router['get'](_0x26bc('0x1b'),auth[_0x26bc('0x10')](),controller[_0x26bc('0x1c')]);router[_0x26bc('0x9')](_0x26bc('0x1d'),auth[_0x26bc('0x10')](),controller[_0x26bc('0x1e')]);router['get'](_0x26bc('0x1f'),controller['getFields']);router[_0x26bc('0x9')]('/:id/offline_messages',auth[_0x26bc('0x10')](),controller[_0x26bc('0x20')]);router[_0x26bc('0x9')](_0x26bc('0x21'),auth[_0x26bc('0x10')](),controller['getAgents']);router[_0x26bc('0x22')]('/',auth['isAuthenticated'](),controller[_0x26bc('0x23')]);router[_0x26bc('0x22')]('/:id/dispositions',auth[_0x26bc('0x10')](),controller[_0x26bc('0x24')]);router[_0x26bc('0x22')](_0x26bc('0x12'),auth[_0x26bc('0x10')](),controller[_0x26bc('0x25')]);var upload=multer({'storage':multer[_0x26bc('0x26')]({'destination':function(_0x571e9c,_0x30553b,_0x11ea47){_0x11ea47(null,path[_0x26bc('0x27')](config[_0x26bc('0x28')],_0x26bc('0x29')));},'filename':function(_0x5aca93,_0xd28057,_0x32ce55){_0x32ce55(null,util[_0x26bc('0x2a')](_0x26bc('0x2b'),Date['now'](),_0xd28057[_0x26bc('0x2c')]));}})});router[_0x26bc('0x22')](_0x26bc('0x14'),upload[_0x26bc('0x2d')](_0x26bc('0x2e')),controller[_0x26bc('0x2f')]);var upload=multer({'storage':multer[_0x26bc('0x26')]({'destination':function(_0xc69959,_0x101a55,_0xe2c5d6){_0xe2c5d6(null,path[_0x26bc('0x27')](config['root'],_0x26bc('0x30')));},'filename':function(_0x16120d,_0x1de5bc,_0x44b482){_0x44b482(null,util[_0x26bc('0x2a')]('%s-%s',Date['now'](),_0x1de5bc['originalname']));}})});router[_0x26bc('0x22')](_0x26bc('0x16'),upload[_0x26bc('0x2d')](_0x26bc('0x2e')),controller[_0x26bc('0x31')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1eefd1,_0x554ab7,_0x4b1532){_0x4b1532(null,path[_0x26bc('0x27')](config[_0x26bc('0x28')],_0x26bc('0x30')));},'filename':function(_0x4e7e80,_0x5b1388,_0xb764a9){_0xb764a9(null,util[_0x26bc('0x2a')](_0x26bc('0x2b'),Date[_0x26bc('0x32')](),_0x5b1388[_0x26bc('0x2c')]));}})});router[_0x26bc('0x22')]('/:id/customer_avatar',upload[_0x26bc('0x2d')](_0x26bc('0x2e')),controller[_0x26bc('0x33')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x416167,_0x4b18d3,_0x50d6c8){_0x50d6c8(null,path['join'](config[_0x26bc('0x28')],'server/files/images/avatars/'));},'filename':function(_0x44ce63,_0x240f91,_0xb9438){_0xb9438(null,util['format'](_0x26bc('0x2b'),Date[_0x26bc('0x32')](),_0x240f91[_0x26bc('0x2c')]));}})});router[_0x26bc('0x22')](_0x26bc('0x34'),upload[_0x26bc('0x2d')](_0x26bc('0x2e')),controller[_0x26bc('0x35')]);router[_0x26bc('0x22')](_0x26bc('0x36'),controller[_0x26bc('0x37')]);const offlineUploadMulter=multer({'storage':multer[_0x26bc('0x26')]({'destination':function(_0x19b517,_0x10337f,_0x53c4e9){const _0x1bb9dd=path['join'](config['root'],'server/files',_0x26bc('0x38'),_0x26bc('0x39'));fs_extra[_0x26bc('0x3a')](_0x1bb9dd,function(){_0x53c4e9(null,_0x1bb9dd);});},'filename':function(_0x385cc1,_0x1ebc2a,_0x1d1aa2){const _0x248e0d=_0x1ebc2a[_0x26bc('0x2c')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x45ba30=path[_0x26bc('0x3b')](_0x248e0d);const _0x2eaba5=Date['now']()+'-'+_0x248e0d[_0x26bc('0x3c')](_0x45ba30,'')+_0x45ba30;_0x1d1aa2(null,_0x2eaba5);}})});router[_0x26bc('0x22')](_0x26bc('0x3d'),offlineUploadMulter[_0x26bc('0x3e')](),controller[_0x26bc('0x3f')]);router[_0x26bc('0x22')](_0x26bc('0x19'),auth['isAuthenticated'](),controller['addInteraction']);router['post'](_0x26bc('0x1b'),auth[_0x26bc('0x10')](),controller[_0x26bc('0x40')]);router[_0x26bc('0x22')]('/:id/proactive_actions',auth[_0x26bc('0x10')](),controller[_0x26bc('0x41')]);router[_0x26bc('0x22')](_0x26bc('0x21'),auth[_0x26bc('0x10')](),controller['addAgents']);router[_0x26bc('0x42')](_0x26bc('0xd'),auth[_0x26bc('0x10')](),controller[_0x26bc('0x43')]);router['delete'](_0x26bc('0xd'),auth[_0x26bc('0x10')](),controller['destroy']);router[_0x26bc('0x44')](_0x26bc('0xf'),auth[_0x26bc('0x10')](),controller['removeDispositions']);router[_0x26bc('0x44')](_0x26bc('0x12'),auth[_0x26bc('0x10')](),controller[_0x26bc('0x45')]);router[_0x26bc('0x44')](_0x26bc('0x21'),auth[_0x26bc('0x10')](),controller['removeAgents']);module[_0x26bc('0x46')]=router;