Built motion from commit da617fac.|2.6.6
[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 _0x57f0=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','/:id/avatar','getAvatar','getCustomerAvatar','/:id/system_avatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','getApplications','/:id/proactive_actions','/:id/fields','/:id/offline_messages','post','create','addAnswer','diskStorage','join','root','server/files/images/logos/','format','%s-%s','now','originalname','file','addLogo','single','addAvatar','/:id/customer_avatar','addCustomerAvatar','server/files/images/avatars/','addSystemAvatar','/:id/notify','notify','server/files','attachments','offline-chat','ensureDir','extname','replace','any','offline','addInteraction','/:id/applications','addApplications','addProactiveActions','/:id/users','addAgents','put','/:id','update','delete','destroy','removeDispositions','removeAnswers','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x39914e,_0x1ec745){var _0x56350b=function(_0x4b390d){while(--_0x4b390d){_0x39914e['push'](_0x39914e['shift']());}};_0x56350b(++_0x1ec745);}(_0x57f0,0x94));var _0x057f=function(_0x266e98,_0x597291){_0x266e98=_0x266e98-0x0;var _0x29e243=_0x57f0[_0x266e98];return _0x29e243;};'use strict';var multer=require(_0x057f('0x0'));var util=require(_0x057f('0x1'));var path=require(_0x057f('0x2'));var timeout=require(_0x057f('0x3'));var express=require(_0x057f('0x4'));var router=express[_0x057f('0x5')]();var fs_extra=require(_0x057f('0x6'));var auth=require(_0x057f('0x7'));var interaction=require(_0x057f('0x8'));var config=require(_0x057f('0x9'));var controller=require(_0x057f('0xa'));router[_0x057f('0xb')]('/',auth[_0x057f('0xc')](),controller[_0x057f('0xd')]);router[_0x057f('0xb')](_0x057f('0xe'),auth[_0x057f('0xc')](),controller[_0x057f('0xf')]);router[_0x057f('0xb')]('/:id',auth[_0x057f('0xc')](),controller[_0x057f('0x10')]);router[_0x057f('0xb')](_0x057f('0x11'),auth[_0x057f('0xc')](),controller[_0x057f('0x12')]);router[_0x057f('0xb')](_0x057f('0x13'),auth['isAuthenticated'](),controller[_0x057f('0x14')]);router[_0x057f('0xb')](_0x057f('0x15'),controller['getLogo']);router[_0x057f('0xb')](_0x057f('0x16'),controller[_0x057f('0x17')]);router[_0x057f('0xb')]('/:id/customer_avatar',controller[_0x057f('0x18')]);router['get'](_0x057f('0x19'),controller['getSystemAvatar']);router[_0x057f('0xb')](_0x057f('0x1a'),auth['isAuthenticated'](),controller[_0x057f('0x1b')]);router['get'](_0x057f('0x1c'),controller[_0x057f('0x1d')]);router[_0x057f('0xb')]('/:id/applications',auth[_0x057f('0xc')](),controller[_0x057f('0x1e')]);router[_0x057f('0xb')](_0x057f('0x1f'),auth['isAuthenticated'](),controller['getProactiveActions']);router[_0x057f('0xb')](_0x057f('0x20'),controller['getFields']);router[_0x057f('0xb')](_0x057f('0x21'),auth[_0x057f('0xc')](),controller['getOfflineMessages']);router[_0x057f('0xb')]('/:id/users',auth[_0x057f('0xc')](),controller['getAgents']);router[_0x057f('0x22')]('/',auth['isAuthenticated'](),controller[_0x057f('0x23')]);router[_0x057f('0x22')](_0x057f('0x11'),auth[_0x057f('0xc')](),controller['addDisposition']);router[_0x057f('0x22')](_0x057f('0x13'),auth['isAuthenticated'](),controller[_0x057f('0x24')]);var upload=multer({'storage':multer[_0x057f('0x25')]({'destination':function(_0x45682b,_0x774481,_0x1e411b){_0x1e411b(null,path[_0x057f('0x26')](config[_0x057f('0x27')],_0x057f('0x28')));},'filename':function(_0x527474,_0x2c8a08,_0x4fcbdf){_0x4fcbdf(null,util[_0x057f('0x29')](_0x057f('0x2a'),Date[_0x057f('0x2b')](),_0x2c8a08[_0x057f('0x2c')]));}})});router['post'](_0x057f('0x15'),upload['single'](_0x057f('0x2d')),controller[_0x057f('0x2e')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2f4a70,_0x1c8f33,_0x5e7c25){_0x5e7c25(null,path[_0x057f('0x26')](config[_0x057f('0x27')],'server/files/images/avatars/'));},'filename':function(_0x47462c,_0x55ef37,_0x31e1a7){_0x31e1a7(null,util['format'](_0x057f('0x2a'),Date['now'](),_0x55ef37[_0x057f('0x2c')]));}})});router[_0x057f('0x22')](_0x057f('0x16'),upload[_0x057f('0x2f')](_0x057f('0x2d')),controller[_0x057f('0x30')]);var upload=multer({'storage':multer[_0x057f('0x25')]({'destination':function(_0x53c31d,_0x273712,_0x2d65a1){_0x2d65a1(null,path[_0x057f('0x26')](config[_0x057f('0x27')],'server/files/images/avatars/'));},'filename':function(_0x1d8059,_0xe6b4c9,_0x4ca788){_0x4ca788(null,util['format'](_0x057f('0x2a'),Date[_0x057f('0x2b')](),_0xe6b4c9['originalname']));}})});router[_0x057f('0x22')](_0x057f('0x31'),upload[_0x057f('0x2f')](_0x057f('0x2d')),controller[_0x057f('0x32')]);var upload=multer({'storage':multer[_0x057f('0x25')]({'destination':function(_0x2f17d9,_0x42ce96,_0x146721){_0x146721(null,path[_0x057f('0x26')](config[_0x057f('0x27')],_0x057f('0x33')));},'filename':function(_0x5714d6,_0x55ffe9,_0x228f07){_0x228f07(null,util[_0x057f('0x29')](_0x057f('0x2a'),Date[_0x057f('0x2b')](),_0x55ffe9[_0x057f('0x2c')]));}})});router[_0x057f('0x22')](_0x057f('0x19'),upload[_0x057f('0x2f')](_0x057f('0x2d')),controller[_0x057f('0x34')]);router[_0x057f('0x22')](_0x057f('0x35'),controller[_0x057f('0x36')]);const offlineUploadMulter=multer({'storage':multer['diskStorage']({'destination':function(_0x91cdda,_0x46305a,_0x2c2b5){const _0xe11d42=path[_0x057f('0x26')](config[_0x057f('0x27')],_0x057f('0x37'),_0x057f('0x38'),_0x057f('0x39'));fs_extra[_0x057f('0x3a')](_0xe11d42,function(){_0x2c2b5(null,_0xe11d42);});},'filename':function(_0x3127a8,_0x2728f8,_0x3815ec){const _0x1247e8=_0x2728f8[_0x057f('0x2c')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x3f814b=path[_0x057f('0x3b')](_0x1247e8);const _0x46d9d4=Date['now']()+'-'+_0x1247e8[_0x057f('0x3c')](_0x3f814b,'')+_0x3f814b;_0x3815ec(null,_0x46d9d4);}})});router[_0x057f('0x22')]('/:id/offline',offlineUploadMulter[_0x057f('0x3d')](),controller[_0x057f('0x3e')]);router[_0x057f('0x22')](_0x057f('0x1a'),auth[_0x057f('0xc')](),controller[_0x057f('0x3f')]);router[_0x057f('0x22')](_0x057f('0x40'),auth[_0x057f('0xc')](),controller[_0x057f('0x41')]);router[_0x057f('0x22')](_0x057f('0x1f'),auth[_0x057f('0xc')](),controller[_0x057f('0x42')]);router[_0x057f('0x22')](_0x057f('0x43'),auth[_0x057f('0xc')](),controller[_0x057f('0x44')]);router[_0x057f('0x45')](_0x057f('0x46'),auth[_0x057f('0xc')](),controller[_0x057f('0x47')]);router[_0x057f('0x48')](_0x057f('0x46'),auth[_0x057f('0xc')](),controller[_0x057f('0x49')]);router[_0x057f('0x48')](_0x057f('0x11'),auth[_0x057f('0xc')](),controller[_0x057f('0x4a')]);router[_0x057f('0x48')](_0x057f('0x13'),auth['isAuthenticated'](),controller[_0x057f('0x4b')]);router[_0x057f('0x48')]('/:id/users',auth[_0x057f('0xc')](),controller['removeAgents']);module[_0x057f('0x4c')]=router;