1b2dbf219fdaf61b7a8b702844eed9f73e4f9737
[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 _0x0d1f=['getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','getOfflineMessages','/:id/users','getAgents','create','post','addDisposition','addAnswer','diskStorage','join','root','server/files/images/logos/','format','%s-%s','now','originalname','file','server/files/images/avatars/','single','addAvatar','addCustomerAvatar','addSystemAvatar','/:id/notify','notify','server/files','attachments','offline-chat','replace','any','addInteraction','addApplications','addProactiveActions','addAgents','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatWebsite.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/avatar'];(function(_0x5c2c7c,_0xa7d3b1){var _0xea7ffe=function(_0x471f17){while(--_0x471f17){_0x5c2c7c['push'](_0x5c2c7c['shift']());}};_0xea7ffe(++_0xa7d3b1);}(_0x0d1f,0x159));var _0xf0d1=function(_0x40a006,_0x29f2b0){_0x40a006=_0x40a006-0x0;var _0x57ce2a=_0x0d1f[_0x40a006];return _0x57ce2a;};'use strict';var multer=require(_0xf0d1('0x0'));var util=require(_0xf0d1('0x1'));var path=require('path');var timeout=require(_0xf0d1('0x2'));var express=require(_0xf0d1('0x3'));var router=express[_0xf0d1('0x4')]();var fs_extra=require(_0xf0d1('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xf0d1('0x6'));var config=require(_0xf0d1('0x7'));var controller=require(_0xf0d1('0x8'));router['get']('/',auth[_0xf0d1('0x9')](),controller[_0xf0d1('0xa')]);router[_0xf0d1('0xb')](_0xf0d1('0xc'),auth['isAuthenticated'](),controller[_0xf0d1('0xd')]);router['get'](_0xf0d1('0xe'),auth[_0xf0d1('0x9')](),controller[_0xf0d1('0xf')]);router['get'](_0xf0d1('0x10'),auth[_0xf0d1('0x9')](),controller[_0xf0d1('0x11')]);router[_0xf0d1('0xb')](_0xf0d1('0x12'),auth[_0xf0d1('0x9')](),controller['getAnswers']);router['get']('/:id/logo',controller['getLogo']);router[_0xf0d1('0xb')](_0xf0d1('0x13'),controller[_0xf0d1('0x14')]);router['get'](_0xf0d1('0x15'),controller[_0xf0d1('0x16')]);router[_0xf0d1('0xb')](_0xf0d1('0x17'),controller['getSystemAvatar']);router['get'](_0xf0d1('0x18'),auth['isAuthenticated'](),controller[_0xf0d1('0x19')]);router[_0xf0d1('0xb')](_0xf0d1('0x1a'),controller[_0xf0d1('0x1b')]);router['get'](_0xf0d1('0x1c'),auth[_0xf0d1('0x9')](),controller[_0xf0d1('0x1d')]);router[_0xf0d1('0xb')](_0xf0d1('0x1e'),auth[_0xf0d1('0x9')](),controller[_0xf0d1('0x1f')]);router['get'](_0xf0d1('0x20'),controller['getFields']);router['get']('/:id/offline_messages',auth[_0xf0d1('0x9')](),controller[_0xf0d1('0x21')]);router[_0xf0d1('0xb')](_0xf0d1('0x22'),auth[_0xf0d1('0x9')](),controller[_0xf0d1('0x23')]);router['post']('/',auth[_0xf0d1('0x9')](),controller[_0xf0d1('0x24')]);router[_0xf0d1('0x25')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0xf0d1('0x26')]);router[_0xf0d1('0x25')]('/:id/canned_answers',auth[_0xf0d1('0x9')](),controller[_0xf0d1('0x27')]);var upload=multer({'storage':multer[_0xf0d1('0x28')]({'destination':function(_0x12fd78,_0x3a209a,_0x4a0529){_0x4a0529(null,path[_0xf0d1('0x29')](config[_0xf0d1('0x2a')],_0xf0d1('0x2b')));},'filename':function(_0x28c26e,_0x5a1f45,_0x4a80c3){_0x4a80c3(null,util[_0xf0d1('0x2c')](_0xf0d1('0x2d'),Date[_0xf0d1('0x2e')](),_0x5a1f45[_0xf0d1('0x2f')]));}})});router['post']('/:id/logo',upload['single'](_0xf0d1('0x30')),controller['addLogo']);var upload=multer({'storage':multer[_0xf0d1('0x28')]({'destination':function(_0x271f04,_0x554400,_0x3b2515){_0x3b2515(null,path[_0xf0d1('0x29')](config[_0xf0d1('0x2a')],_0xf0d1('0x31')));},'filename':function(_0x512d51,_0x4465c6,_0x3064c1){_0x3064c1(null,util[_0xf0d1('0x2c')]('%s-%s',Date[_0xf0d1('0x2e')](),_0x4465c6['originalname']));}})});router[_0xf0d1('0x25')](_0xf0d1('0x13'),upload[_0xf0d1('0x32')](_0xf0d1('0x30')),controller[_0xf0d1('0x33')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x118236,_0xa7e4ca,_0x2eb861){_0x2eb861(null,path[_0xf0d1('0x29')](config[_0xf0d1('0x2a')],_0xf0d1('0x31')));},'filename':function(_0x41e3ab,_0x5231a4,_0x8f319a){_0x8f319a(null,util['format'](_0xf0d1('0x2d'),Date[_0xf0d1('0x2e')](),_0x5231a4[_0xf0d1('0x2f')]));}})});router['post']('/:id/customer_avatar',upload[_0xf0d1('0x32')]('file'),controller[_0xf0d1('0x34')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2a75cf,_0x3e3337,_0x3b54e8){_0x3b54e8(null,path[_0xf0d1('0x29')](config[_0xf0d1('0x2a')],_0xf0d1('0x31')));},'filename':function(_0x2c8ce8,_0x49ba07,_0x1d67e1){_0x1d67e1(null,util[_0xf0d1('0x2c')]('%s-%s',Date[_0xf0d1('0x2e')](),_0x49ba07[_0xf0d1('0x2f')]));}})});router['post'](_0xf0d1('0x17'),upload[_0xf0d1('0x32')](_0xf0d1('0x30')),controller[_0xf0d1('0x35')]);router['post'](_0xf0d1('0x36'),controller[_0xf0d1('0x37')]);const offlineUploadMulter=multer({'storage':multer[_0xf0d1('0x28')]({'destination':function(_0xf3979,_0x31bdb0,_0xa91728){const _0x439193=path['join'](config[_0xf0d1('0x2a')],_0xf0d1('0x38'),_0xf0d1('0x39'),_0xf0d1('0x3a'));fs_extra['ensureDir'](_0x439193,function(){_0xa91728(null,_0x439193);});},'filename':function(_0x3a4581,_0x4631ba,_0x770c6c){const _0x34f277=_0x4631ba['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x57943d=path['extname'](_0x34f277);const _0x5b3a5c=Date[_0xf0d1('0x2e')]()+'-'+_0x34f277[_0xf0d1('0x3b')](_0x57943d,'')+_0x57943d;_0x770c6c(null,_0x5b3a5c);}})});router['post']('/:id/offline',offlineUploadMulter[_0xf0d1('0x3c')](),controller['offline']);router['post']('/:id/interactions',auth[_0xf0d1('0x9')](),controller[_0xf0d1('0x3d')]);router[_0xf0d1('0x25')](_0xf0d1('0x1c'),auth['isAuthenticated'](),controller[_0xf0d1('0x3e')]);router[_0xf0d1('0x25')](_0xf0d1('0x1e'),auth['isAuthenticated'](),controller[_0xf0d1('0x3f')]);router[_0xf0d1('0x25')](_0xf0d1('0x22'),auth[_0xf0d1('0x9')](),controller[_0xf0d1('0x40')]);router[_0xf0d1('0x41')]('/:id',auth['isAuthenticated'](),controller[_0xf0d1('0x42')]);router[_0xf0d1('0x43')]('/:id',auth['isAuthenticated'](),controller[_0xf0d1('0x44')]);router[_0xf0d1('0x43')](_0xf0d1('0x10'),auth['isAuthenticated'](),controller[_0xf0d1('0x45')]);router[_0xf0d1('0x43')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0xf0d1('0x46')]);router['delete']('/:id/users',auth[_0xf0d1('0x9')](),controller[_0xf0d1('0x47')]);module[_0xf0d1('0x48')]=router;