Built motion from commit f6d7e26c.|2.6.14
[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 _0x5b0b=['/:id/customer_avatar','addCustomerAvatar','/:id/notify','notify','server/files','offline-chat','ensureDir','replace','extname','any','offline','/:id/interactions','addInteraction','addProactiveActions','addAgents','put','update','destroy','delete','removeAnswers','removeAgents','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','getLogo','/:id/avatar','getAvatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','getInteractions','/:id/snippet','getSnippet','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','post','create','/:id/dispositions','addDisposition','addAnswer','diskStorage','root','server/files/images/logos/','format','%s-%s','single','file','addLogo','join','now','originalname','addAvatar','server/files/images/avatars/'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5b0b,0x19c));var _0xb5b0=function(_0xd66a31,_0xacd08d){_0xd66a31=_0xd66a31-0x0;var _0x2f4fa4=_0x5b0b[_0xd66a31];return _0x2f4fa4;};'use strict';var multer=require(_0xb5b0('0x0'));var util=require('util');var path=require(_0xb5b0('0x1'));var timeout=require(_0xb5b0('0x2'));var express=require(_0xb5b0('0x3'));var router=express[_0xb5b0('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xb5b0('0x5'));var interaction=require(_0xb5b0('0x6'));var config=require(_0xb5b0('0x7'));var controller=require(_0xb5b0('0x8'));router[_0xb5b0('0x9')]('/',auth[_0xb5b0('0xa')](),controller[_0xb5b0('0xb')]);router[_0xb5b0('0x9')](_0xb5b0('0xc'),auth[_0xb5b0('0xa')](),controller[_0xb5b0('0xd')]);router[_0xb5b0('0x9')](_0xb5b0('0xe'),auth['isAuthenticated'](),controller[_0xb5b0('0xf')]);router[_0xb5b0('0x9')]('/:id/dispositions',auth[_0xb5b0('0xa')](),controller[_0xb5b0('0x10')]);router[_0xb5b0('0x9')](_0xb5b0('0x11'),auth[_0xb5b0('0xa')](),controller[_0xb5b0('0x12')]);router[_0xb5b0('0x9')](_0xb5b0('0x13'),controller[_0xb5b0('0x14')]);router[_0xb5b0('0x9')](_0xb5b0('0x15'),controller[_0xb5b0('0x16')]);router['get']('/:id/customer_avatar',controller[_0xb5b0('0x17')]);router[_0xb5b0('0x9')](_0xb5b0('0x18'),controller[_0xb5b0('0x19')]);router[_0xb5b0('0x9')]('/:id/interactions',auth[_0xb5b0('0xa')](),controller[_0xb5b0('0x1a')]);router['get'](_0xb5b0('0x1b'),controller[_0xb5b0('0x1c')]);router[_0xb5b0('0x9')]('/:id/applications',auth[_0xb5b0('0xa')](),controller[_0xb5b0('0x1d')]);router[_0xb5b0('0x9')](_0xb5b0('0x1e'),auth[_0xb5b0('0xa')](),controller[_0xb5b0('0x1f')]);router['get'](_0xb5b0('0x20'),controller[_0xb5b0('0x21')]);router[_0xb5b0('0x9')](_0xb5b0('0x22'),auth[_0xb5b0('0xa')](),controller[_0xb5b0('0x23')]);router[_0xb5b0('0x9')](_0xb5b0('0x24'),auth[_0xb5b0('0xa')](),controller[_0xb5b0('0x25')]);router[_0xb5b0('0x26')]('/',auth[_0xb5b0('0xa')](),controller[_0xb5b0('0x27')]);router['post'](_0xb5b0('0x28'),auth['isAuthenticated'](),controller[_0xb5b0('0x29')]);router[_0xb5b0('0x26')]('/:id/canned_answers',auth[_0xb5b0('0xa')](),controller[_0xb5b0('0x2a')]);var upload=multer({'storage':multer[_0xb5b0('0x2b')]({'destination':function(_0x315b62,_0x43b5dc,_0x28db99){_0x28db99(null,path['join'](config[_0xb5b0('0x2c')],_0xb5b0('0x2d')));},'filename':function(_0x236287,_0xa31597,_0x4be787){_0x4be787(null,util[_0xb5b0('0x2e')](_0xb5b0('0x2f'),Date['now'](),_0xa31597['originalname']));}})});router[_0xb5b0('0x26')]('/:id/logo',upload[_0xb5b0('0x30')](_0xb5b0('0x31')),controller[_0xb5b0('0x32')]);var upload=multer({'storage':multer[_0xb5b0('0x2b')]({'destination':function(_0x5a5403,_0x4d331e,_0xaa37e){_0xaa37e(null,path[_0xb5b0('0x33')](config[_0xb5b0('0x2c')],'server/files/images/avatars/'));},'filename':function(_0x4a1e85,_0x25a568,_0x2dbe06){_0x2dbe06(null,util[_0xb5b0('0x2e')]('%s-%s',Date[_0xb5b0('0x34')](),_0x25a568[_0xb5b0('0x35')]));}})});router['post'](_0xb5b0('0x15'),upload['single']('file'),controller[_0xb5b0('0x36')]);var upload=multer({'storage':multer[_0xb5b0('0x2b')]({'destination':function(_0x2d2dd0,_0x231ef6,_0x11eb8f){_0x11eb8f(null,path[_0xb5b0('0x33')](config[_0xb5b0('0x2c')],_0xb5b0('0x37')));},'filename':function(_0x2df4f8,_0x50744b,_0x42fec9){_0x42fec9(null,util[_0xb5b0('0x2e')](_0xb5b0('0x2f'),Date[_0xb5b0('0x34')](),_0x50744b[_0xb5b0('0x35')]));}})});router[_0xb5b0('0x26')](_0xb5b0('0x38'),upload[_0xb5b0('0x30')]('file'),controller[_0xb5b0('0x39')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x7f4b3b,_0x374520,_0x11d09){_0x11d09(null,path[_0xb5b0('0x33')](config['root'],'server/files/images/avatars/'));},'filename':function(_0x473259,_0x162dc8,_0x2e6016){_0x2e6016(null,util[_0xb5b0('0x2e')](_0xb5b0('0x2f'),Date[_0xb5b0('0x34')](),_0x162dc8['originalname']));}})});router[_0xb5b0('0x26')](_0xb5b0('0x18'),upload[_0xb5b0('0x30')]('file'),controller['addSystemAvatar']);router[_0xb5b0('0x26')](_0xb5b0('0x3a'),controller[_0xb5b0('0x3b')]);const offlineUploadMulter=multer({'storage':multer[_0xb5b0('0x2b')]({'destination':function(_0x6eb78b,_0x28db43,_0x5f3bd3){const _0x334312=path[_0xb5b0('0x33')](config['root'],_0xb5b0('0x3c'),'attachments',_0xb5b0('0x3d'));fs_extra[_0xb5b0('0x3e')](_0x334312,function(){_0x5f3bd3(null,_0x334312);});},'filename':function(_0x6956da,_0x3e9c1b,_0x2274f3){const _0x358fbd=_0x3e9c1b[_0xb5b0('0x35')][_0xb5b0('0x3f')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x3b327e=path[_0xb5b0('0x40')](_0x358fbd);const _0x5a1f84=Date[_0xb5b0('0x34')]()+'-'+_0x358fbd[_0xb5b0('0x3f')](_0x3b327e,'')+_0x3b327e;_0x2274f3(null,_0x5a1f84);}})});router[_0xb5b0('0x26')]('/:id/offline',offlineUploadMulter[_0xb5b0('0x41')](),controller[_0xb5b0('0x42')]);router['post'](_0xb5b0('0x43'),auth[_0xb5b0('0xa')](),controller[_0xb5b0('0x44')]);router[_0xb5b0('0x26')]('/:id/applications',auth[_0xb5b0('0xa')](),controller['addApplications']);router[_0xb5b0('0x26')](_0xb5b0('0x1e'),auth[_0xb5b0('0xa')](),controller[_0xb5b0('0x45')]);router[_0xb5b0('0x26')]('/:id/users',auth['isAuthenticated'](),controller[_0xb5b0('0x46')]);router[_0xb5b0('0x47')](_0xb5b0('0xe'),auth[_0xb5b0('0xa')](),controller[_0xb5b0('0x48')]);router['delete']('/:id',auth[_0xb5b0('0xa')](),controller[_0xb5b0('0x49')]);router[_0xb5b0('0x4a')](_0xb5b0('0x28'),auth[_0xb5b0('0xa')](),controller['removeDispositions']);router[_0xb5b0('0x4a')](_0xb5b0('0x11'),auth[_0xb5b0('0xa')](),controller[_0xb5b0('0x4b')]);router['delete'](_0xb5b0('0x24'),auth[_0xb5b0('0xa')](),controller[_0xb5b0('0x4c')]);module[_0xb5b0('0x4d')]=router;