Built motion from commit 87cd5f02.|2.5.48
[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 _0x8379=['show','getDispositions','/:id/canned_answers','getAnswers','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','/:id/snippet','/:id/applications','getApplications','/:id/proactive_actions','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','post','create','/:id/dispositions','addDisposition','join','root','server/files/images/logos/','format','%s-%s','now','originalname','file','addLogo','diskStorage','server/files/images/avatars/','single','addCustomerAvatar','addSystemAvatar','/:id/notify','server/files','attachments','offline-chat','ensureDir','replace','extname','/:id/offline','offline','addApplications','addProactiveActions','addAgents','put','/:id','update','delete','removeDispositions','removeAnswers','removeAgents','exports','util','path','express','fs-extra','../../components/auth/service','../../config/environment','./chatWebsite.controller','isAuthenticated','index','get','/describe','describe'];(function(_0x2112d4,_0x3c863c){var _0x434972=function(_0x477020){while(--_0x477020){_0x2112d4['push'](_0x2112d4['shift']());}};_0x434972(++_0x3c863c);}(_0x8379,0x19e));var _0x9837=function(_0x181f2d,_0x21d846){_0x181f2d=_0x181f2d-0x0;var _0x259107=_0x8379[_0x181f2d];return _0x259107;};'use strict';var multer=require('multer');var util=require(_0x9837('0x0'));var path=require(_0x9837('0x1'));var timeout=require('connect-timeout');var express=require(_0x9837('0x2'));var router=express['Router']();var fs_extra=require(_0x9837('0x3'));var auth=require(_0x9837('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x9837('0x5'));var controller=require(_0x9837('0x6'));router['get']('/',auth[_0x9837('0x7')](),controller[_0x9837('0x8')]);router[_0x9837('0x9')](_0x9837('0xa'),auth[_0x9837('0x7')](),controller[_0x9837('0xb')]);router[_0x9837('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x9837('0xc')]);router[_0x9837('0x9')]('/:id/dispositions',auth[_0x9837('0x7')](),controller[_0x9837('0xd')]);router[_0x9837('0x9')](_0x9837('0xe'),auth[_0x9837('0x7')](),controller[_0x9837('0xf')]);router[_0x9837('0x9')]('/:id/logo',controller[_0x9837('0x10')]);router['get'](_0x9837('0x11'),controller[_0x9837('0x12')]);router['get'](_0x9837('0x13'),controller[_0x9837('0x14')]);router['get'](_0x9837('0x15'),controller[_0x9837('0x16')]);router['get'](_0x9837('0x17'),auth[_0x9837('0x7')](),controller['getInteractions']);router[_0x9837('0x9')](_0x9837('0x18'),controller['getSnippet']);router[_0x9837('0x9')](_0x9837('0x19'),auth[_0x9837('0x7')](),controller[_0x9837('0x1a')]);router['get'](_0x9837('0x1b'),auth[_0x9837('0x7')](),controller['getProactiveActions']);router[_0x9837('0x9')]('/:id/fields',controller[_0x9837('0x1c')]);router[_0x9837('0x9')](_0x9837('0x1d'),auth[_0x9837('0x7')](),controller[_0x9837('0x1e')]);router[_0x9837('0x9')](_0x9837('0x1f'),auth[_0x9837('0x7')](),controller[_0x9837('0x20')]);router[_0x9837('0x21')]('/',auth['isAuthenticated'](),controller[_0x9837('0x22')]);router[_0x9837('0x21')](_0x9837('0x23'),auth[_0x9837('0x7')](),controller[_0x9837('0x24')]);router[_0x9837('0x21')](_0x9837('0xe'),auth['isAuthenticated'](),controller['addAnswer']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x671faf,_0x525d1a,_0x18a76b){_0x18a76b(null,path[_0x9837('0x25')](config[_0x9837('0x26')],_0x9837('0x27')));},'filename':function(_0x86924d,_0xcdaa98,_0x318f74){_0x318f74(null,util[_0x9837('0x28')](_0x9837('0x29'),Date[_0x9837('0x2a')](),_0xcdaa98[_0x9837('0x2b')]));}})});router['post']('/:id/logo',upload['single'](_0x9837('0x2c')),controller[_0x9837('0x2d')]);var upload=multer({'storage':multer[_0x9837('0x2e')]({'destination':function(_0x939941,_0x2165f6,_0x2017a0){_0x2017a0(null,path[_0x9837('0x25')](config['root'],_0x9837('0x2f')));},'filename':function(_0x4de2e7,_0x41a9d6,_0x20c9de){_0x20c9de(null,util[_0x9837('0x28')]('%s-%s',Date[_0x9837('0x2a')](),_0x41a9d6[_0x9837('0x2b')]));}})});router[_0x9837('0x21')](_0x9837('0x11'),upload['single'](_0x9837('0x2c')),controller['addAvatar']);var upload=multer({'storage':multer[_0x9837('0x2e')]({'destination':function(_0x21ece7,_0x57c532,_0x93b313){_0x93b313(null,path[_0x9837('0x25')](config[_0x9837('0x26')],_0x9837('0x2f')));},'filename':function(_0x148ac9,_0x505445,_0x3f8467){_0x3f8467(null,util[_0x9837('0x28')](_0x9837('0x29'),Date[_0x9837('0x2a')](),_0x505445['originalname']));}})});router[_0x9837('0x21')](_0x9837('0x13'),upload[_0x9837('0x30')](_0x9837('0x2c')),controller[_0x9837('0x31')]);var upload=multer({'storage':multer[_0x9837('0x2e')]({'destination':function(_0xa1dde,_0x3f8efc,_0x14e207){_0x14e207(null,path[_0x9837('0x25')](config['root'],_0x9837('0x2f')));},'filename':function(_0x5e28b4,_0x559b38,_0x741f3){_0x741f3(null,util[_0x9837('0x28')](_0x9837('0x29'),Date['now'](),_0x559b38[_0x9837('0x2b')]));}})});router[_0x9837('0x21')](_0x9837('0x15'),upload['single'](_0x9837('0x2c')),controller[_0x9837('0x32')]);router[_0x9837('0x21')](_0x9837('0x33'),controller['notify']);const offlineUploadMulter=multer({'storage':multer['diskStorage']({'destination':function(_0x308b66,_0x54fc0f,_0x213d16){const _0x56dcd8=path[_0x9837('0x25')](config[_0x9837('0x26')],_0x9837('0x34'),_0x9837('0x35'),_0x9837('0x36'));fs_extra[_0x9837('0x37')](_0x56dcd8,function(){_0x213d16(null,_0x56dcd8);});},'filename':function(_0x4a2a4f,_0x18ba2b,_0x269a0e){const _0x225c11=_0x18ba2b[_0x9837('0x2b')][_0x9837('0x38')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x1736ab=path[_0x9837('0x39')](_0x225c11);const _0x59a7b1=Date[_0x9837('0x2a')]()+'-'+_0x225c11[_0x9837('0x38')](_0x1736ab,'')+_0x1736ab;_0x269a0e(null,_0x59a7b1);}})});router[_0x9837('0x21')](_0x9837('0x3a'),offlineUploadMulter['any'](),controller[_0x9837('0x3b')]);router[_0x9837('0x21')](_0x9837('0x17'),auth[_0x9837('0x7')](),controller['addInteraction']);router[_0x9837('0x21')](_0x9837('0x19'),auth['isAuthenticated'](),controller[_0x9837('0x3c')]);router[_0x9837('0x21')](_0x9837('0x1b'),auth[_0x9837('0x7')](),controller[_0x9837('0x3d')]);router[_0x9837('0x21')]('/:id/users',auth[_0x9837('0x7')](),controller[_0x9837('0x3e')]);router[_0x9837('0x3f')](_0x9837('0x40'),auth[_0x9837('0x7')](),controller[_0x9837('0x41')]);router[_0x9837('0x42')]('/:id',auth[_0x9837('0x7')](),controller['destroy']);router[_0x9837('0x42')](_0x9837('0x23'),auth[_0x9837('0x7')](),controller[_0x9837('0x43')]);router[_0x9837('0x42')](_0x9837('0xe'),auth[_0x9837('0x7')](),controller[_0x9837('0x44')]);router[_0x9837('0x42')](_0x9837('0x1f'),auth[_0x9837('0x7')](),controller[_0x9837('0x45')]);module[_0x9837('0x46')]=router;