Built motion from commit e6806ed6.|2.6.0
[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 _0x5346=['/:id/interactions','getInteractions','/:id/snippet','getSnippet','/:id/applications','getApplications','getProactiveActions','/:id/fields','getFields','getOfflineMessages','/:id/users','getAgents','post','create','addDisposition','addAnswer','diskStorage','join','root','server/files/images/logos/','%s-%s','now','originalname','addLogo','server/files/images/avatars/','file','addAvatar','format','single','/:id/notify','notify','server/files','offline-chat','ensureDir','replace','extname','/:id/offline','any','addInteraction','addApplications','/:id/proactive_actions','addAgents','update','delete','destroy','removeDispositions','removeAnswers','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','getLogo','/:id/avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar'];(function(_0x450f09,_0x59561d){var _0x4e22ec=function(_0x516748){while(--_0x516748){_0x450f09['push'](_0x450f09['shift']());}};_0x4e22ec(++_0x59561d);}(_0x5346,0x19d));var _0x6534=function(_0x59906d,_0x4b3c5f){_0x59906d=_0x59906d-0x0;var _0x4f3eec=_0x5346[_0x59906d];return _0x4f3eec;};'use strict';var multer=require(_0x6534('0x0'));var util=require(_0x6534('0x1'));var path=require(_0x6534('0x2'));var timeout=require(_0x6534('0x3'));var express=require(_0x6534('0x4'));var router=express['Router']();var fs_extra=require(_0x6534('0x5'));var auth=require(_0x6534('0x6'));var interaction=require(_0x6534('0x7'));var config=require('../../config/environment');var controller=require('./chatWebsite.controller');router[_0x6534('0x8')]('/',auth[_0x6534('0x9')](),controller[_0x6534('0xa')]);router[_0x6534('0x8')](_0x6534('0xb'),auth[_0x6534('0x9')](),controller[_0x6534('0xc')]);router[_0x6534('0x8')](_0x6534('0xd'),auth[_0x6534('0x9')](),controller[_0x6534('0xe')]);router[_0x6534('0x8')](_0x6534('0xf'),auth[_0x6534('0x9')](),controller[_0x6534('0x10')]);router['get'](_0x6534('0x11'),auth[_0x6534('0x9')](),controller[_0x6534('0x12')]);router[_0x6534('0x8')](_0x6534('0x13'),controller[_0x6534('0x14')]);router['get'](_0x6534('0x15'),controller['getAvatar']);router[_0x6534('0x8')]('/:id/customer_avatar',controller[_0x6534('0x16')]);router[_0x6534('0x8')](_0x6534('0x17'),controller[_0x6534('0x18')]);router[_0x6534('0x8')](_0x6534('0x19'),auth['isAuthenticated'](),controller[_0x6534('0x1a')]);router[_0x6534('0x8')](_0x6534('0x1b'),controller[_0x6534('0x1c')]);router[_0x6534('0x8')](_0x6534('0x1d'),auth[_0x6534('0x9')](),controller[_0x6534('0x1e')]);router[_0x6534('0x8')]('/:id/proactive_actions',auth[_0x6534('0x9')](),controller[_0x6534('0x1f')]);router['get'](_0x6534('0x20'),controller[_0x6534('0x21')]);router[_0x6534('0x8')]('/:id/offline_messages',auth['isAuthenticated'](),controller[_0x6534('0x22')]);router[_0x6534('0x8')](_0x6534('0x23'),auth[_0x6534('0x9')](),controller[_0x6534('0x24')]);router[_0x6534('0x25')]('/',auth[_0x6534('0x9')](),controller[_0x6534('0x26')]);router[_0x6534('0x25')](_0x6534('0xf'),auth[_0x6534('0x9')](),controller[_0x6534('0x27')]);router[_0x6534('0x25')](_0x6534('0x11'),auth[_0x6534('0x9')](),controller[_0x6534('0x28')]);var upload=multer({'storage':multer[_0x6534('0x29')]({'destination':function(_0x327917,_0xd9fde7,_0x868b70){_0x868b70(null,path[_0x6534('0x2a')](config[_0x6534('0x2b')],_0x6534('0x2c')));},'filename':function(_0x25693c,_0x3e5e45,_0x2f30ae){_0x2f30ae(null,util['format'](_0x6534('0x2d'),Date[_0x6534('0x2e')](),_0x3e5e45[_0x6534('0x2f')]));}})});router[_0x6534('0x25')](_0x6534('0x13'),upload['single']('file'),controller[_0x6534('0x30')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xc8e6ac,_0x3b356d,_0xdbb58c){_0xdbb58c(null,path[_0x6534('0x2a')](config[_0x6534('0x2b')],_0x6534('0x31')));},'filename':function(_0x526cd1,_0x2d4e77,_0x58d59a){_0x58d59a(null,util['format'](_0x6534('0x2d'),Date['now'](),_0x2d4e77[_0x6534('0x2f')]));}})});router['post'](_0x6534('0x15'),upload['single'](_0x6534('0x32')),controller[_0x6534('0x33')]);var upload=multer({'storage':multer[_0x6534('0x29')]({'destination':function(_0x124992,_0xf73a51,_0x5f1dcb){_0x5f1dcb(null,path['join'](config[_0x6534('0x2b')],_0x6534('0x31')));},'filename':function(_0x2b080f,_0x5c9741,_0x5accf4){_0x5accf4(null,util[_0x6534('0x34')](_0x6534('0x2d'),Date['now'](),_0x5c9741[_0x6534('0x2f')]));}})});router[_0x6534('0x25')]('/:id/customer_avatar',upload[_0x6534('0x35')]('file'),controller['addCustomerAvatar']);var upload=multer({'storage':multer[_0x6534('0x29')]({'destination':function(_0x2edc76,_0x48990e,_0x4925a6){_0x4925a6(null,path[_0x6534('0x2a')](config[_0x6534('0x2b')],_0x6534('0x31')));},'filename':function(_0xf981eb,_0x4ce670,_0x13d518){_0x13d518(null,util[_0x6534('0x34')](_0x6534('0x2d'),Date[_0x6534('0x2e')](),_0x4ce670['originalname']));}})});router[_0x6534('0x25')](_0x6534('0x17'),upload['single'](_0x6534('0x32')),controller['addSystemAvatar']);router[_0x6534('0x25')](_0x6534('0x36'),controller[_0x6534('0x37')]);const offlineUploadMulter=multer({'storage':multer[_0x6534('0x29')]({'destination':function(_0x197ff1,_0x32018c,_0x21792f){const _0x4e457a=path[_0x6534('0x2a')](config['root'],_0x6534('0x38'),'attachments',_0x6534('0x39'));fs_extra[_0x6534('0x3a')](_0x4e457a,function(){_0x21792f(null,_0x4e457a);});},'filename':function(_0x568b26,_0x208682,_0x35148c){const _0x171802=_0x208682['originalname'][_0x6534('0x3b')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x200648=path[_0x6534('0x3c')](_0x171802);const _0x4ce59a=Date[_0x6534('0x2e')]()+'-'+_0x171802[_0x6534('0x3b')](_0x200648,'')+_0x200648;_0x35148c(null,_0x4ce59a);}})});router[_0x6534('0x25')](_0x6534('0x3d'),offlineUploadMulter[_0x6534('0x3e')](),controller['offline']);router[_0x6534('0x25')](_0x6534('0x19'),auth[_0x6534('0x9')](),controller[_0x6534('0x3f')]);router[_0x6534('0x25')](_0x6534('0x1d'),auth[_0x6534('0x9')](),controller[_0x6534('0x40')]);router['post'](_0x6534('0x41'),auth['isAuthenticated'](),controller['addProactiveActions']);router[_0x6534('0x25')](_0x6534('0x23'),auth['isAuthenticated'](),controller[_0x6534('0x42')]);router['put'](_0x6534('0xd'),auth['isAuthenticated'](),controller[_0x6534('0x43')]);router[_0x6534('0x44')]('/:id',auth['isAuthenticated'](),controller[_0x6534('0x45')]);router[_0x6534('0x44')](_0x6534('0xf'),auth[_0x6534('0x9')](),controller[_0x6534('0x46')]);router[_0x6534('0x44')](_0x6534('0x11'),auth[_0x6534('0x9')](),controller[_0x6534('0x47')]);router['delete'](_0x6534('0x23'),auth['isAuthenticated'](),controller['removeAgents']);module[_0x6534('0x48')]=router;