3ceaa148b319f6ef5ce7f96971c4aabba0165305
[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 _0xe575=['server/files/images/logos/','format','%s-%s','originalname','file','diskStorage','server/files/images/avatars/','now','single','addCustomerAvatar','addSystemAvatar','notify','server/files','attachments','offline-chat','replace','extname','any','offline','addInteraction','addApplications','addProactiveActions','put','delete','destroy','removeDispositions','removeAnswers','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','getLogo','/:id/avatar','/:id/customer_avatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','post','create','addAnswer','join','root'];(function(_0x123bab,_0x1fd456){var _0x46a65d=function(_0x1edb61){while(--_0x1edb61){_0x123bab['push'](_0x123bab['shift']());}};_0x46a65d(++_0x1fd456);}(_0xe575,0x1ba));var _0x5e57=function(_0x415b19,_0x40aea5){_0x415b19=_0x415b19-0x0;var _0x1ae77e=_0xe575[_0x415b19];return _0x1ae77e;};'use strict';var multer=require(_0x5e57('0x0'));var util=require('util');var path=require(_0x5e57('0x1'));var timeout=require('connect-timeout');var express=require(_0x5e57('0x2'));var router=express[_0x5e57('0x3')]();var fs_extra=require(_0x5e57('0x4'));var auth=require(_0x5e57('0x5'));var interaction=require(_0x5e57('0x6'));var config=require(_0x5e57('0x7'));var controller=require('./chatWebsite.controller');router[_0x5e57('0x8')]('/',auth[_0x5e57('0x9')](),controller['index']);router[_0x5e57('0x8')](_0x5e57('0xa'),auth[_0x5e57('0x9')](),controller[_0x5e57('0xb')]);router[_0x5e57('0x8')](_0x5e57('0xc'),auth['isAuthenticated'](),controller[_0x5e57('0xd')]);router['get'](_0x5e57('0xe'),auth[_0x5e57('0x9')](),controller['getDispositions']);router[_0x5e57('0x8')](_0x5e57('0xf'),auth[_0x5e57('0x9')](),controller[_0x5e57('0x10')]);router[_0x5e57('0x8')]('/:id/logo',controller[_0x5e57('0x11')]);router[_0x5e57('0x8')](_0x5e57('0x12'),controller['getAvatar']);router[_0x5e57('0x8')](_0x5e57('0x13'),controller['getCustomerAvatar']);router['get'](_0x5e57('0x14'),controller[_0x5e57('0x15')]);router[_0x5e57('0x8')](_0x5e57('0x16'),auth['isAuthenticated'](),controller[_0x5e57('0x17')]);router['get'](_0x5e57('0x18'),controller[_0x5e57('0x19')]);router['get'](_0x5e57('0x1a'),auth['isAuthenticated'](),controller[_0x5e57('0x1b')]);router[_0x5e57('0x8')](_0x5e57('0x1c'),auth[_0x5e57('0x9')](),controller[_0x5e57('0x1d')]);router[_0x5e57('0x8')](_0x5e57('0x1e'),controller[_0x5e57('0x1f')]);router[_0x5e57('0x8')](_0x5e57('0x20'),auth[_0x5e57('0x9')](),controller[_0x5e57('0x21')]);router[_0x5e57('0x8')](_0x5e57('0x22'),auth[_0x5e57('0x9')](),controller[_0x5e57('0x23')]);router[_0x5e57('0x24')]('/',auth['isAuthenticated'](),controller[_0x5e57('0x25')]);router[_0x5e57('0x24')](_0x5e57('0xe'),auth[_0x5e57('0x9')](),controller['addDisposition']);router[_0x5e57('0x24')](_0x5e57('0xf'),auth[_0x5e57('0x9')](),controller[_0x5e57('0x26')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5da115,_0x233eff,_0x258813){_0x258813(null,path[_0x5e57('0x27')](config[_0x5e57('0x28')],_0x5e57('0x29')));},'filename':function(_0x46540f,_0x53f93f,_0x494af9){_0x494af9(null,util[_0x5e57('0x2a')](_0x5e57('0x2b'),Date['now'](),_0x53f93f[_0x5e57('0x2c')]));}})});router['post']('/:id/logo',upload['single'](_0x5e57('0x2d')),controller['addLogo']);var upload=multer({'storage':multer[_0x5e57('0x2e')]({'destination':function(_0x12abde,_0x30466f,_0xac5deb){_0xac5deb(null,path['join'](config[_0x5e57('0x28')],_0x5e57('0x2f')));},'filename':function(_0x7fc62,_0x1a1276,_0x540279){_0x540279(null,util['format'](_0x5e57('0x2b'),Date[_0x5e57('0x30')](),_0x1a1276[_0x5e57('0x2c')]));}})});router[_0x5e57('0x24')](_0x5e57('0x12'),upload[_0x5e57('0x31')](_0x5e57('0x2d')),controller['addAvatar']);var upload=multer({'storage':multer[_0x5e57('0x2e')]({'destination':function(_0x35e2c5,_0x52c49c,_0x2222e9){_0x2222e9(null,path[_0x5e57('0x27')](config[_0x5e57('0x28')],_0x5e57('0x2f')));},'filename':function(_0x3e7b6f,_0x28cfa5,_0x103fa0){_0x103fa0(null,util[_0x5e57('0x2a')](_0x5e57('0x2b'),Date[_0x5e57('0x30')](),_0x28cfa5[_0x5e57('0x2c')]));}})});router['post'](_0x5e57('0x13'),upload['single'](_0x5e57('0x2d')),controller[_0x5e57('0x32')]);var upload=multer({'storage':multer[_0x5e57('0x2e')]({'destination':function(_0x50616c,_0x1c6d21,_0x366b0d){_0x366b0d(null,path[_0x5e57('0x27')](config[_0x5e57('0x28')],_0x5e57('0x2f')));},'filename':function(_0x4d2aff,_0x19ef03,_0x1fef29){_0x1fef29(null,util[_0x5e57('0x2a')]('%s-%s',Date[_0x5e57('0x30')](),_0x19ef03[_0x5e57('0x2c')]));}})});router[_0x5e57('0x24')](_0x5e57('0x14'),upload['single'](_0x5e57('0x2d')),controller[_0x5e57('0x33')]);router[_0x5e57('0x24')]('/:id/notify',controller[_0x5e57('0x34')]);const offlineUploadMulter=multer({'storage':multer[_0x5e57('0x2e')]({'destination':function(_0x5da44c,_0x592de2,_0x792790){const _0x285188=path['join'](config[_0x5e57('0x28')],_0x5e57('0x35'),_0x5e57('0x36'),_0x5e57('0x37'));fs_extra['ensureDir'](_0x285188,function(){_0x792790(null,_0x285188);});},'filename':function(_0x23f94a,_0x4fc695,_0x3e29b0){const _0x3d547e=_0x4fc695[_0x5e57('0x2c')][_0x5e57('0x38')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x2597f0=path[_0x5e57('0x39')](_0x3d547e);const _0x45ffcc=Date[_0x5e57('0x30')]()+'-'+_0x3d547e['replace'](_0x2597f0,'')+_0x2597f0;_0x3e29b0(null,_0x45ffcc);}})});router[_0x5e57('0x24')]('/:id/offline',offlineUploadMulter[_0x5e57('0x3a')](),controller[_0x5e57('0x3b')]);router['post'](_0x5e57('0x16'),auth[_0x5e57('0x9')](),controller[_0x5e57('0x3c')]);router[_0x5e57('0x24')](_0x5e57('0x1a'),auth[_0x5e57('0x9')](),controller[_0x5e57('0x3d')]);router['post'](_0x5e57('0x1c'),auth[_0x5e57('0x9')](),controller[_0x5e57('0x3e')]);router[_0x5e57('0x24')](_0x5e57('0x22'),auth[_0x5e57('0x9')](),controller['addAgents']);router[_0x5e57('0x3f')](_0x5e57('0xc'),auth[_0x5e57('0x9')](),controller['update']);router[_0x5e57('0x40')](_0x5e57('0xc'),auth[_0x5e57('0x9')](),controller[_0x5e57('0x41')]);router['delete'](_0x5e57('0xe'),auth[_0x5e57('0x9')](),controller[_0x5e57('0x42')]);router[_0x5e57('0x40')](_0x5e57('0xf'),auth[_0x5e57('0x9')](),controller[_0x5e57('0x43')]);router[_0x5e57('0x40')](_0x5e57('0x22'),auth[_0x5e57('0x9')](),controller['removeAgents']);module[_0x5e57('0x44')]=router;