378d46b2dacad03715a59920880b59d7500f01fd
[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 _0xb12a=['join','root','server/files/images/logos/','format','%s-%s','/:id/logo','single','server/files/images/avatars/','originalname','file','addAvatar','addSystemAvatar','/:id/notify','notify','server/files','attachments','offline-chat','replace','extname','now','any','offline','addApplications','addProactiveActions','addAgents','put','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','getDispositions','/:id/canned_answers','getAnswers','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','/:id/interactions','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','/:id/users','post','create','/:id/dispositions','addDisposition','diskStorage'];(function(_0x4b8412,_0x235b3d){var _0x1ed9ed=function(_0x455209){while(--_0x455209){_0x4b8412['push'](_0x4b8412['shift']());}};_0x1ed9ed(++_0x235b3d);}(_0xb12a,0x1bf));var _0xab12=function(_0x1bc055,_0x33b053){_0x1bc055=_0x1bc055-0x0;var _0xf0ac3d=_0xb12a[_0x1bc055];return _0xf0ac3d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xab12('0x0'));var timeout=require(_0xab12('0x1'));var express=require(_0xab12('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xab12('0x3'));var interaction=require(_0xab12('0x4'));var config=require(_0xab12('0x5'));var controller=require('./chatWebsite.controller');router[_0xab12('0x6')]('/',auth[_0xab12('0x7')](),controller[_0xab12('0x8')]);router['get'](_0xab12('0x9'),auth[_0xab12('0x7')](),controller[_0xab12('0xa')]);router[_0xab12('0x6')](_0xab12('0xb'),auth[_0xab12('0x7')](),controller[_0xab12('0xc')]);router['get']('/:id/dispositions',auth[_0xab12('0x7')](),controller[_0xab12('0xd')]);router[_0xab12('0x6')](_0xab12('0xe'),auth[_0xab12('0x7')](),controller[_0xab12('0xf')]);router['get']('/:id/logo',controller[_0xab12('0x10')]);router['get'](_0xab12('0x11'),controller[_0xab12('0x12')]);router[_0xab12('0x6')](_0xab12('0x13'),controller[_0xab12('0x14')]);router[_0xab12('0x6')](_0xab12('0x15'),controller['getSystemAvatar']);router['get'](_0xab12('0x16'),auth[_0xab12('0x7')](),controller['getInteractions']);router[_0xab12('0x6')]('/:id/snippet',controller[_0xab12('0x17')]);router[_0xab12('0x6')](_0xab12('0x18'),auth[_0xab12('0x7')](),controller[_0xab12('0x19')]);router[_0xab12('0x6')](_0xab12('0x1a'),auth['isAuthenticated'](),controller[_0xab12('0x1b')]);router[_0xab12('0x6')](_0xab12('0x1c'),controller[_0xab12('0x1d')]);router[_0xab12('0x6')]('/:id/offline_messages',auth['isAuthenticated'](),controller['getOfflineMessages']);router[_0xab12('0x6')](_0xab12('0x1e'),auth[_0xab12('0x7')](),controller['getAgents']);router[_0xab12('0x1f')]('/',auth['isAuthenticated'](),controller[_0xab12('0x20')]);router[_0xab12('0x1f')](_0xab12('0x21'),auth[_0xab12('0x7')](),controller[_0xab12('0x22')]);router[_0xab12('0x1f')](_0xab12('0xe'),auth[_0xab12('0x7')](),controller['addAnswer']);var upload=multer({'storage':multer[_0xab12('0x23')]({'destination':function(_0x4c3d9e,_0x3d0493,_0x4585bb){_0x4585bb(null,path[_0xab12('0x24')](config[_0xab12('0x25')],_0xab12('0x26')));},'filename':function(_0x182b29,_0x1507ee,_0x4e21b3){_0x4e21b3(null,util[_0xab12('0x27')](_0xab12('0x28'),Date['now'](),_0x1507ee['originalname']));}})});router[_0xab12('0x1f')](_0xab12('0x29'),upload[_0xab12('0x2a')]('file'),controller['addLogo']);var upload=multer({'storage':multer[_0xab12('0x23')]({'destination':function(_0x2e177c,_0x34579c,_0x169b01){_0x169b01(null,path[_0xab12('0x24')](config['root'],_0xab12('0x2b')));},'filename':function(_0x159648,_0x46ba61,_0x1adb13){_0x1adb13(null,util[_0xab12('0x27')](_0xab12('0x28'),Date['now'](),_0x46ba61[_0xab12('0x2c')]));}})});router[_0xab12('0x1f')](_0xab12('0x11'),upload['single'](_0xab12('0x2d')),controller[_0xab12('0x2e')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1b5622,_0x426918,_0x493657){_0x493657(null,path['join'](config[_0xab12('0x25')],_0xab12('0x2b')));},'filename':function(_0x33a005,_0x55c8ab,_0x7deedb){_0x7deedb(null,util[_0xab12('0x27')](_0xab12('0x28'),Date['now'](),_0x55c8ab[_0xab12('0x2c')]));}})});router[_0xab12('0x1f')](_0xab12('0x13'),upload[_0xab12('0x2a')](_0xab12('0x2d')),controller['addCustomerAvatar']);var upload=multer({'storage':multer[_0xab12('0x23')]({'destination':function(_0x1453b0,_0x2c2c30,_0x50896c){_0x50896c(null,path['join'](config[_0xab12('0x25')],_0xab12('0x2b')));},'filename':function(_0x20aa63,_0x88b784,_0x4bbc3f){_0x4bbc3f(null,util['format'](_0xab12('0x28'),Date['now'](),_0x88b784['originalname']));}})});router[_0xab12('0x1f')](_0xab12('0x15'),upload[_0xab12('0x2a')](_0xab12('0x2d')),controller[_0xab12('0x2f')]);router[_0xab12('0x1f')](_0xab12('0x30'),controller[_0xab12('0x31')]);const offlineUploadMulter=multer({'storage':multer[_0xab12('0x23')]({'destination':function(_0x910e4b,_0x37045c,_0x5f2d24){const _0x4ca2ba=path[_0xab12('0x24')](config[_0xab12('0x25')],_0xab12('0x32'),_0xab12('0x33'),_0xab12('0x34'));fs_extra['ensureDir'](_0x4ca2ba,function(){_0x5f2d24(null,_0x4ca2ba);});},'filename':function(_0x5ddd04,_0x1a8af7,_0x3f84d4){const _0x1f4421=_0x1a8af7[_0xab12('0x2c')][_0xab12('0x35')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x197052=path[_0xab12('0x36')](_0x1f4421);const _0x1d6864=Date[_0xab12('0x37')]()+'-'+_0x1f4421['replace'](_0x197052,'')+_0x197052;_0x3f84d4(null,_0x1d6864);}})});router[_0xab12('0x1f')]('/:id/offline',offlineUploadMulter[_0xab12('0x38')](),controller[_0xab12('0x39')]);router[_0xab12('0x1f')](_0xab12('0x16'),auth[_0xab12('0x7')](),controller['addInteraction']);router[_0xab12('0x1f')](_0xab12('0x18'),auth[_0xab12('0x7')](),controller[_0xab12('0x3a')]);router[_0xab12('0x1f')]('/:id/proactive_actions',auth['isAuthenticated'](),controller[_0xab12('0x3b')]);router['post'](_0xab12('0x1e'),auth[_0xab12('0x7')](),controller[_0xab12('0x3c')]);router[_0xab12('0x3d')](_0xab12('0xb'),auth[_0xab12('0x7')](),controller[_0xab12('0x3e')]);router['delete'](_0xab12('0xb'),auth[_0xab12('0x7')](),controller[_0xab12('0x3f')]);router[_0xab12('0x40')]('/:id/dispositions',auth[_0xab12('0x7')](),controller[_0xab12('0x41')]);router['delete'](_0xab12('0xe'),auth[_0xab12('0x7')](),controller[_0xab12('0x42')]);router[_0xab12('0x40')](_0xab12('0x1e'),auth[_0xab12('0x7')](),controller[_0xab12('0x43')]);module[_0xab12('0x44')]=router;