3b19adcfeb4ca414dec94377897a6f94e07eab9f
[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 _0xfb34=['getApplications','getProactiveActions','/:id/fields','getOfflineMessages','/:id/users','getAgents','create','post','/:id/dispositions','diskStorage','join','root','server/files/images/logos/','%s-%s','now','originalname','single','file','addLogo','addAvatar','server/files/images/avatars/','format','addCustomerAvatar','addSystemAvatar','/:id/notify','notify','server/files','attachments','ensureDir','replace','extname','/:id/offline','any','addInteraction','addApplications','/:id/proactive_actions','addProactiveActions','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','/describe','describe','/:id','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','getLogo','/:id/avatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','/:id/applications'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xfb34,0x154));var _0x4fb3=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0xfb34[_0x32f7d7];return _0x133d09;};'use strict';var multer=require(_0x4fb3('0x0'));var util=require('util');var path=require(_0x4fb3('0x1'));var timeout=require(_0x4fb3('0x2'));var express=require(_0x4fb3('0x3'));var router=express[_0x4fb3('0x4')]();var fs_extra=require(_0x4fb3('0x5'));var auth=require(_0x4fb3('0x6'));var interaction=require(_0x4fb3('0x7'));var config=require(_0x4fb3('0x8'));var controller=require(_0x4fb3('0x9'));router[_0x4fb3('0xa')]('/',auth[_0x4fb3('0xb')](),controller['index']);router[_0x4fb3('0xa')](_0x4fb3('0xc'),auth[_0x4fb3('0xb')](),controller[_0x4fb3('0xd')]);router['get'](_0x4fb3('0xe'),auth[_0x4fb3('0xb')](),controller['show']);router[_0x4fb3('0xa')]('/:id/dispositions',auth[_0x4fb3('0xb')](),controller[_0x4fb3('0xf')]);router[_0x4fb3('0xa')](_0x4fb3('0x10'),auth[_0x4fb3('0xb')](),controller[_0x4fb3('0x11')]);router['get'](_0x4fb3('0x12'),controller[_0x4fb3('0x13')]);router[_0x4fb3('0xa')](_0x4fb3('0x14'),controller['getAvatar']);router[_0x4fb3('0xa')](_0x4fb3('0x15'),controller[_0x4fb3('0x16')]);router['get'](_0x4fb3('0x17'),controller[_0x4fb3('0x18')]);router[_0x4fb3('0xa')](_0x4fb3('0x19'),auth[_0x4fb3('0xb')](),controller[_0x4fb3('0x1a')]);router['get'](_0x4fb3('0x1b'),controller[_0x4fb3('0x1c')]);router[_0x4fb3('0xa')](_0x4fb3('0x1d'),auth[_0x4fb3('0xb')](),controller[_0x4fb3('0x1e')]);router['get']('/:id/proactive_actions',auth[_0x4fb3('0xb')](),controller[_0x4fb3('0x1f')]);router['get'](_0x4fb3('0x20'),controller['getFields']);router['get']('/:id/offline_messages',auth['isAuthenticated'](),controller[_0x4fb3('0x21')]);router[_0x4fb3('0xa')](_0x4fb3('0x22'),auth[_0x4fb3('0xb')](),controller[_0x4fb3('0x23')]);router['post']('/',auth['isAuthenticated'](),controller[_0x4fb3('0x24')]);router[_0x4fb3('0x25')](_0x4fb3('0x26'),auth['isAuthenticated'](),controller['addDisposition']);router[_0x4fb3('0x25')](_0x4fb3('0x10'),auth[_0x4fb3('0xb')](),controller['addAnswer']);var upload=multer({'storage':multer[_0x4fb3('0x27')]({'destination':function(_0x5897d5,_0x30a5ce,_0x44d0c1){_0x44d0c1(null,path[_0x4fb3('0x28')](config[_0x4fb3('0x29')],_0x4fb3('0x2a')));},'filename':function(_0x43417d,_0x5f3fb1,_0x366e80){_0x366e80(null,util['format'](_0x4fb3('0x2b'),Date[_0x4fb3('0x2c')](),_0x5f3fb1[_0x4fb3('0x2d')]));}})});router[_0x4fb3('0x25')](_0x4fb3('0x12'),upload[_0x4fb3('0x2e')](_0x4fb3('0x2f')),controller[_0x4fb3('0x30')]);var upload=multer({'storage':multer[_0x4fb3('0x27')]({'destination':function(_0x232748,_0x485dbb,_0x1cbc32){_0x1cbc32(null,path[_0x4fb3('0x28')](config[_0x4fb3('0x29')],'server/files/images/avatars/'));},'filename':function(_0x21c608,_0x13276f,_0x400e20){_0x400e20(null,util['format']('%s-%s',Date[_0x4fb3('0x2c')](),_0x13276f[_0x4fb3('0x2d')]));}})});router[_0x4fb3('0x25')](_0x4fb3('0x14'),upload[_0x4fb3('0x2e')]('file'),controller[_0x4fb3('0x31')]);var upload=multer({'storage':multer[_0x4fb3('0x27')]({'destination':function(_0x1b61c6,_0x41e05b,_0x33edb4){_0x33edb4(null,path['join'](config[_0x4fb3('0x29')],_0x4fb3('0x32')));},'filename':function(_0x1e319c,_0x1b3da1,_0xf82d50){_0xf82d50(null,util[_0x4fb3('0x33')](_0x4fb3('0x2b'),Date[_0x4fb3('0x2c')](),_0x1b3da1[_0x4fb3('0x2d')]));}})});router[_0x4fb3('0x25')](_0x4fb3('0x15'),upload['single'](_0x4fb3('0x2f')),controller[_0x4fb3('0x34')]);var upload=multer({'storage':multer[_0x4fb3('0x27')]({'destination':function(_0x52aadd,_0x36495d,_0x2a9d97){_0x2a9d97(null,path['join'](config[_0x4fb3('0x29')],_0x4fb3('0x32')));},'filename':function(_0x457516,_0x170892,_0x90446f){_0x90446f(null,util[_0x4fb3('0x33')](_0x4fb3('0x2b'),Date[_0x4fb3('0x2c')](),_0x170892[_0x4fb3('0x2d')]));}})});router['post'](_0x4fb3('0x17'),upload['single'](_0x4fb3('0x2f')),controller[_0x4fb3('0x35')]);router[_0x4fb3('0x25')](_0x4fb3('0x36'),controller[_0x4fb3('0x37')]);const offlineUploadMulter=multer({'storage':multer[_0x4fb3('0x27')]({'destination':function(_0x3da300,_0x4fe944,_0x3688d6){const _0x82e22=path[_0x4fb3('0x28')](config[_0x4fb3('0x29')],_0x4fb3('0x38'),_0x4fb3('0x39'),'offline-chat');fs_extra[_0x4fb3('0x3a')](_0x82e22,function(){_0x3688d6(null,_0x82e22);});},'filename':function(_0x421c1f,_0x54813e,_0x439460){const _0x501f2f=_0x54813e['originalname'][_0x4fb3('0x3b')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x394749=path[_0x4fb3('0x3c')](_0x501f2f);const _0x2c624f=Date['now']()+'-'+_0x501f2f[_0x4fb3('0x3b')](_0x394749,'')+_0x394749;_0x439460(null,_0x2c624f);}})});router[_0x4fb3('0x25')](_0x4fb3('0x3d'),offlineUploadMulter[_0x4fb3('0x3e')](),controller['offline']);router['post']('/:id/interactions',auth[_0x4fb3('0xb')](),controller[_0x4fb3('0x3f')]);router[_0x4fb3('0x25')](_0x4fb3('0x1d'),auth[_0x4fb3('0xb')](),controller[_0x4fb3('0x40')]);router[_0x4fb3('0x25')](_0x4fb3('0x41'),auth[_0x4fb3('0xb')](),controller[_0x4fb3('0x42')]);router[_0x4fb3('0x25')](_0x4fb3('0x22'),auth['isAuthenticated'](),controller['addAgents']);router['put'](_0x4fb3('0xe'),auth[_0x4fb3('0xb')](),controller[_0x4fb3('0x43')]);router[_0x4fb3('0x44')](_0x4fb3('0xe'),auth[_0x4fb3('0xb')](),controller[_0x4fb3('0x45')]);router[_0x4fb3('0x44')](_0x4fb3('0x26'),auth['isAuthenticated'](),controller[_0x4fb3('0x46')]);router[_0x4fb3('0x44')](_0x4fb3('0x10'),auth[_0x4fb3('0xb')](),controller[_0x4fb3('0x47')]);router[_0x4fb3('0x44')](_0x4fb3('0x22'),auth[_0x4fb3('0xb')](),controller[_0x4fb3('0x48')]);module[_0x4fb3('0x49')]=router;