123a70145f47a6f18fa2963084ec0b0c40e59803
[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 _0x9eca=['create','addDisposition','addAnswer','diskStorage','join','root','server/files/images/logos/','format','%s-%s','now','originalname','/:id/logo','single','server/files/images/avatars/','file','addAvatar','server/files','offline-chat','ensureDir','replace','/:id/offline','any','offline','addInteraction','/:id/applications','addProactiveActions','addAgents','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','getLogo','/:id/avatar','/:id/customer_avatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','getSnippet','/:id/proactive_actions','/:id/fields','getFields','/:id/users','post'];(function(_0x2d8948,_0x1e06f3){var _0x1e62b6=function(_0x30e939){while(--_0x30e939){_0x2d8948['push'](_0x2d8948['shift']());}};_0x1e62b6(++_0x1e06f3);}(_0x9eca,0x12f));var _0xa9ec=function(_0x50b15b,_0x71ac13){_0x50b15b=_0x50b15b-0x0;var _0x1334e2=_0x9eca[_0x50b15b];return _0x1334e2;};'use strict';var multer=require(_0xa9ec('0x0'));var util=require(_0xa9ec('0x1'));var path=require(_0xa9ec('0x2'));var timeout=require('connect-timeout');var express=require(_0xa9ec('0x3'));var router=express[_0xa9ec('0x4')]();var fs_extra=require(_0xa9ec('0x5'));var auth=require(_0xa9ec('0x6'));var interaction=require(_0xa9ec('0x7'));var config=require(_0xa9ec('0x8'));var controller=require('./chatWebsite.controller');router[_0xa9ec('0x9')]('/',auth[_0xa9ec('0xa')](),controller[_0xa9ec('0xb')]);router['get'](_0xa9ec('0xc'),auth[_0xa9ec('0xa')](),controller[_0xa9ec('0xd')]);router[_0xa9ec('0x9')](_0xa9ec('0xe'),auth['isAuthenticated'](),controller[_0xa9ec('0xf')]);router[_0xa9ec('0x9')](_0xa9ec('0x10'),auth['isAuthenticated'](),controller['getDispositions']);router[_0xa9ec('0x9')](_0xa9ec('0x11'),auth['isAuthenticated'](),controller[_0xa9ec('0x12')]);router[_0xa9ec('0x9')]('/:id/logo',controller[_0xa9ec('0x13')]);router['get'](_0xa9ec('0x14'),controller['getAvatar']);router['get'](_0xa9ec('0x15'),controller['getCustomerAvatar']);router[_0xa9ec('0x9')](_0xa9ec('0x16'),controller[_0xa9ec('0x17')]);router[_0xa9ec('0x9')](_0xa9ec('0x18'),auth['isAuthenticated'](),controller[_0xa9ec('0x19')]);router[_0xa9ec('0x9')]('/:id/snippet',controller[_0xa9ec('0x1a')]);router[_0xa9ec('0x9')]('/:id/applications',auth['isAuthenticated'](),controller['getApplications']);router[_0xa9ec('0x9')](_0xa9ec('0x1b'),auth['isAuthenticated'](),controller['getProactiveActions']);router[_0xa9ec('0x9')](_0xa9ec('0x1c'),controller[_0xa9ec('0x1d')]);router[_0xa9ec('0x9')]('/:id/offline_messages',auth[_0xa9ec('0xa')](),controller['getOfflineMessages']);router[_0xa9ec('0x9')](_0xa9ec('0x1e'),auth[_0xa9ec('0xa')](),controller['getAgents']);router[_0xa9ec('0x1f')]('/',auth[_0xa9ec('0xa')](),controller[_0xa9ec('0x20')]);router[_0xa9ec('0x1f')](_0xa9ec('0x10'),auth['isAuthenticated'](),controller[_0xa9ec('0x21')]);router['post'](_0xa9ec('0x11'),auth[_0xa9ec('0xa')](),controller[_0xa9ec('0x22')]);var upload=multer({'storage':multer[_0xa9ec('0x23')]({'destination':function(_0x30391a,_0x3459df,_0x35ab9e){_0x35ab9e(null,path[_0xa9ec('0x24')](config[_0xa9ec('0x25')],_0xa9ec('0x26')));},'filename':function(_0x737b33,_0xfc9dd3,_0x59bd3a){_0x59bd3a(null,util[_0xa9ec('0x27')](_0xa9ec('0x28'),Date[_0xa9ec('0x29')](),_0xfc9dd3[_0xa9ec('0x2a')]));}})});router[_0xa9ec('0x1f')](_0xa9ec('0x2b'),upload[_0xa9ec('0x2c')]('file'),controller['addLogo']);var upload=multer({'storage':multer[_0xa9ec('0x23')]({'destination':function(_0xb40f18,_0x5a5b48,_0x36d147){_0x36d147(null,path[_0xa9ec('0x24')](config[_0xa9ec('0x25')],_0xa9ec('0x2d')));},'filename':function(_0x145916,_0x522704,_0x102f7b){_0x102f7b(null,util[_0xa9ec('0x27')](_0xa9ec('0x28'),Date['now'](),_0x522704['originalname']));}})});router[_0xa9ec('0x1f')](_0xa9ec('0x14'),upload[_0xa9ec('0x2c')](_0xa9ec('0x2e')),controller[_0xa9ec('0x2f')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1d079e,_0x30a28f,_0x519461){_0x519461(null,path[_0xa9ec('0x24')](config[_0xa9ec('0x25')],_0xa9ec('0x2d')));},'filename':function(_0x732587,_0x12d457,_0x359827){_0x359827(null,util[_0xa9ec('0x27')](_0xa9ec('0x28'),Date[_0xa9ec('0x29')](),_0x12d457[_0xa9ec('0x2a')]));}})});router[_0xa9ec('0x1f')](_0xa9ec('0x15'),upload[_0xa9ec('0x2c')](_0xa9ec('0x2e')),controller['addCustomerAvatar']);var upload=multer({'storage':multer[_0xa9ec('0x23')]({'destination':function(_0x3102b9,_0x3235ea,_0x51a812){_0x51a812(null,path[_0xa9ec('0x24')](config[_0xa9ec('0x25')],_0xa9ec('0x2d')));},'filename':function(_0xfc985,_0x42a205,_0x25c123){_0x25c123(null,util[_0xa9ec('0x27')]('%s-%s',Date['now'](),_0x42a205[_0xa9ec('0x2a')]));}})});router[_0xa9ec('0x1f')](_0xa9ec('0x16'),upload[_0xa9ec('0x2c')](_0xa9ec('0x2e')),controller['addSystemAvatar']);router[_0xa9ec('0x1f')]('/:id/notify',controller['notify']);const offlineUploadMulter=multer({'storage':multer[_0xa9ec('0x23')]({'destination':function(_0x10459e,_0x401fec,_0x5f1198){const _0xccbe93=path[_0xa9ec('0x24')](config[_0xa9ec('0x25')],_0xa9ec('0x30'),'attachments',_0xa9ec('0x31'));fs_extra[_0xa9ec('0x32')](_0xccbe93,function(){_0x5f1198(null,_0xccbe93);});},'filename':function(_0x451aa4,_0x421d16,_0x1484cf){const _0x155b4d=_0x421d16[_0xa9ec('0x2a')][_0xa9ec('0x33')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x3a5da6=path['extname'](_0x155b4d);const _0x227aca=Date[_0xa9ec('0x29')]()+'-'+_0x155b4d[_0xa9ec('0x33')](_0x3a5da6,'')+_0x3a5da6;_0x1484cf(null,_0x227aca);}})});router[_0xa9ec('0x1f')](_0xa9ec('0x34'),offlineUploadMulter[_0xa9ec('0x35')](),controller[_0xa9ec('0x36')]);router[_0xa9ec('0x1f')]('/:id/interactions',auth[_0xa9ec('0xa')](),controller[_0xa9ec('0x37')]);router[_0xa9ec('0x1f')](_0xa9ec('0x38'),auth[_0xa9ec('0xa')](),controller['addApplications']);router[_0xa9ec('0x1f')](_0xa9ec('0x1b'),auth[_0xa9ec('0xa')](),controller[_0xa9ec('0x39')]);router[_0xa9ec('0x1f')]('/:id/users',auth[_0xa9ec('0xa')](),controller[_0xa9ec('0x3a')]);router[_0xa9ec('0x3b')](_0xa9ec('0xe'),auth[_0xa9ec('0xa')](),controller[_0xa9ec('0x3c')]);router[_0xa9ec('0x3d')](_0xa9ec('0xe'),auth[_0xa9ec('0xa')](),controller[_0xa9ec('0x3e')]);router[_0xa9ec('0x3d')](_0xa9ec('0x10'),auth[_0xa9ec('0xa')](),controller[_0xa9ec('0x3f')]);router[_0xa9ec('0x3d')](_0xa9ec('0x11'),auth[_0xa9ec('0xa')](),controller[_0xa9ec('0x40')]);router[_0xa9ec('0x3d')](_0xa9ec('0x1e'),auth['isAuthenticated'](),controller[_0xa9ec('0x41')]);module[_0xa9ec('0x42')]=router;