0c60cd230b0d0d7075d5cedecb6d0524d87d651a
[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 _0xa5e7=['getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','/:id/fields','getFields','/:id/offline_messages','/:id/users','getAgents','post','create','/:id/dispositions','addAnswer','diskStorage','join','root','format','%s-%s','now','originalname','single','file','addLogo','server/files/images/avatars/','addAvatar','addCustomerAvatar','addSystemAvatar','/:id/notify','server/files','ensureDir','replace','offline','addInteraction','addApplications','addAgents','delete','destroy','removeAnswers','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/canned_answers','getAnswers','/:id/logo','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar'];(function(_0x3d5fbd,_0xcbedc2){var _0x5210b5=function(_0x54f65c){while(--_0x54f65c){_0x3d5fbd['push'](_0x3d5fbd['shift']());}};_0x5210b5(++_0xcbedc2);}(_0xa5e7,0x145));var _0x7a5e=function(_0x1fd7dc,_0x9d5a6a){_0x1fd7dc=_0x1fd7dc-0x0;var _0x1c1202=_0xa5e7[_0x1fd7dc];return _0x1c1202;};'use strict';var multer=require(_0x7a5e('0x0'));var util=require(_0x7a5e('0x1'));var path=require(_0x7a5e('0x2'));var timeout=require(_0x7a5e('0x3'));var express=require(_0x7a5e('0x4'));var router=express[_0x7a5e('0x5')]();var fs_extra=require(_0x7a5e('0x6'));var auth=require(_0x7a5e('0x7'));var interaction=require(_0x7a5e('0x8'));var config=require(_0x7a5e('0x9'));var controller=require(_0x7a5e('0xa'));router['get']('/',auth[_0x7a5e('0xb')](),controller[_0x7a5e('0xc')]);router[_0x7a5e('0xd')](_0x7a5e('0xe'),auth[_0x7a5e('0xb')](),controller[_0x7a5e('0xf')]);router[_0x7a5e('0xd')](_0x7a5e('0x10'),auth[_0x7a5e('0xb')](),controller[_0x7a5e('0x11')]);router[_0x7a5e('0xd')]('/:id/dispositions',auth[_0x7a5e('0xb')](),controller['getDispositions']);router[_0x7a5e('0xd')](_0x7a5e('0x12'),auth[_0x7a5e('0xb')](),controller[_0x7a5e('0x13')]);router[_0x7a5e('0xd')](_0x7a5e('0x14'),controller[_0x7a5e('0x15')]);router[_0x7a5e('0xd')](_0x7a5e('0x16'),controller[_0x7a5e('0x17')]);router[_0x7a5e('0xd')](_0x7a5e('0x18'),controller[_0x7a5e('0x19')]);router['get'](_0x7a5e('0x1a'),controller[_0x7a5e('0x1b')]);router[_0x7a5e('0xd')](_0x7a5e('0x1c'),auth['isAuthenticated'](),controller[_0x7a5e('0x1d')]);router[_0x7a5e('0xd')](_0x7a5e('0x1e'),controller[_0x7a5e('0x1f')]);router['get'](_0x7a5e('0x20'),auth[_0x7a5e('0xb')](),controller[_0x7a5e('0x21')]);router[_0x7a5e('0xd')](_0x7a5e('0x22'),auth[_0x7a5e('0xb')](),controller['getProactiveActions']);router[_0x7a5e('0xd')](_0x7a5e('0x23'),controller[_0x7a5e('0x24')]);router[_0x7a5e('0xd')](_0x7a5e('0x25'),auth[_0x7a5e('0xb')](),controller['getOfflineMessages']);router['get'](_0x7a5e('0x26'),auth['isAuthenticated'](),controller[_0x7a5e('0x27')]);router[_0x7a5e('0x28')]('/',auth[_0x7a5e('0xb')](),controller[_0x7a5e('0x29')]);router[_0x7a5e('0x28')](_0x7a5e('0x2a'),auth[_0x7a5e('0xb')](),controller['addDisposition']);router[_0x7a5e('0x28')](_0x7a5e('0x12'),auth[_0x7a5e('0xb')](),controller[_0x7a5e('0x2b')]);var upload=multer({'storage':multer[_0x7a5e('0x2c')]({'destination':function(_0x3c02ee,_0x2e5511,_0x9f494){_0x9f494(null,path[_0x7a5e('0x2d')](config[_0x7a5e('0x2e')],'server/files/images/logos/'));},'filename':function(_0x1f443d,_0x30608f,_0x1ad92c){_0x1ad92c(null,util[_0x7a5e('0x2f')](_0x7a5e('0x30'),Date[_0x7a5e('0x31')](),_0x30608f[_0x7a5e('0x32')]));}})});router[_0x7a5e('0x28')]('/:id/logo',upload[_0x7a5e('0x33')](_0x7a5e('0x34')),controller[_0x7a5e('0x35')]);var upload=multer({'storage':multer[_0x7a5e('0x2c')]({'destination':function(_0x2fb83d,_0x37b94b,_0x137851){_0x137851(null,path[_0x7a5e('0x2d')](config[_0x7a5e('0x2e')],_0x7a5e('0x36')));},'filename':function(_0x4584bd,_0x2d4762,_0x5b3085){_0x5b3085(null,util[_0x7a5e('0x2f')](_0x7a5e('0x30'),Date[_0x7a5e('0x31')](),_0x2d4762[_0x7a5e('0x32')]));}})});router['post']('/:id/avatar',upload[_0x7a5e('0x33')]('file'),controller[_0x7a5e('0x37')]);var upload=multer({'storage':multer[_0x7a5e('0x2c')]({'destination':function(_0x36ced4,_0xd1fe14,_0x313835){_0x313835(null,path['join'](config[_0x7a5e('0x2e')],'server/files/images/avatars/'));},'filename':function(_0x22930a,_0x41b15b,_0x2ad695){_0x2ad695(null,util[_0x7a5e('0x2f')](_0x7a5e('0x30'),Date[_0x7a5e('0x31')](),_0x41b15b[_0x7a5e('0x32')]));}})});router[_0x7a5e('0x28')](_0x7a5e('0x18'),upload[_0x7a5e('0x33')](_0x7a5e('0x34')),controller[_0x7a5e('0x38')]);var upload=multer({'storage':multer[_0x7a5e('0x2c')]({'destination':function(_0x37f429,_0x50de5b,_0x339d5b){_0x339d5b(null,path[_0x7a5e('0x2d')](config['root'],_0x7a5e('0x36')));},'filename':function(_0xc9edd9,_0x57f80d,_0x3aa126){_0x3aa126(null,util[_0x7a5e('0x2f')](_0x7a5e('0x30'),Date[_0x7a5e('0x31')](),_0x57f80d[_0x7a5e('0x32')]));}})});router[_0x7a5e('0x28')](_0x7a5e('0x1a'),upload['single'](_0x7a5e('0x34')),controller[_0x7a5e('0x39')]);router[_0x7a5e('0x28')](_0x7a5e('0x3a'),controller['notify']);const offlineUploadMulter=multer({'storage':multer[_0x7a5e('0x2c')]({'destination':function(_0x41331b,_0x9ab14,_0xc5cefe){const _0xcac4b8=path[_0x7a5e('0x2d')](config[_0x7a5e('0x2e')],_0x7a5e('0x3b'),'attachments','offline-chat');fs_extra[_0x7a5e('0x3c')](_0xcac4b8,function(){_0xc5cefe(null,_0xcac4b8);});},'filename':function(_0x3d75af,_0x48a7b4,_0x3da095){const _0x19ccb4=_0x48a7b4[_0x7a5e('0x32')][_0x7a5e('0x3d')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x7d3ff8=path['extname'](_0x19ccb4);const _0x4c5668=Date[_0x7a5e('0x31')]()+'-'+_0x19ccb4[_0x7a5e('0x3d')](_0x7d3ff8,'')+_0x7d3ff8;_0x3da095(null,_0x4c5668);}})});router[_0x7a5e('0x28')]('/:id/offline',offlineUploadMulter['any'](),controller[_0x7a5e('0x3e')]);router[_0x7a5e('0x28')](_0x7a5e('0x1c'),auth[_0x7a5e('0xb')](),controller[_0x7a5e('0x3f')]);router[_0x7a5e('0x28')](_0x7a5e('0x20'),auth[_0x7a5e('0xb')](),controller[_0x7a5e('0x40')]);router['post'](_0x7a5e('0x22'),auth[_0x7a5e('0xb')](),controller['addProactiveActions']);router[_0x7a5e('0x28')](_0x7a5e('0x26'),auth[_0x7a5e('0xb')](),controller[_0x7a5e('0x41')]);router['put'](_0x7a5e('0x10'),auth[_0x7a5e('0xb')](),controller['update']);router[_0x7a5e('0x42')]('/:id',auth[_0x7a5e('0xb')](),controller[_0x7a5e('0x43')]);router[_0x7a5e('0x42')](_0x7a5e('0x2a'),auth['isAuthenticated'](),controller['removeDispositions']);router[_0x7a5e('0x42')](_0x7a5e('0x12'),auth[_0x7a5e('0xb')](),controller[_0x7a5e('0x44')]);router['delete']('/:id/users',auth[_0x7a5e('0xb')](),controller['removeAgents']);module[_0x7a5e('0x45')]=router;