Built motion from commit 1fa89557.|2.6.10
[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 _0xf372=['getInteractions','/:id/snippet','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','/:id/offline_messages','/:id/users','post','create','addDisposition','addAnswer','diskStorage','join','server/files/images/logos/','%s-%s','now','originalname','single','file','addLogo','root','server/files/images/avatars/','format','addSystemAvatar','/:id/notify','notify','server/files','attachments','ensureDir','extname','replace','/:id/offline','any','addInteraction','addApplications','addProactiveActions','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','isAuthenticated','index','get','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions'];(function(_0xc83289,_0x12d090){var _0x3d09a3=function(_0x59eab){while(--_0x59eab){_0xc83289['push'](_0xc83289['shift']());}};_0x3d09a3(++_0x12d090);}(_0xf372,0x149));var _0x2f37=function(_0x18cb8f,_0x161f2a){_0x18cb8f=_0x18cb8f-0x0;var _0x131d4b=_0xf372[_0x18cb8f];return _0x131d4b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x2f37('0x0'));var timeout=require('connect-timeout');var express=require(_0x2f37('0x1'));var router=express[_0x2f37('0x2')]();var fs_extra=require(_0x2f37('0x3'));var auth=require(_0x2f37('0x4'));var interaction=require(_0x2f37('0x5'));var config=require(_0x2f37('0x6'));var controller=require(_0x2f37('0x7'));router['get']('/',auth[_0x2f37('0x8')](),controller[_0x2f37('0x9')]);router[_0x2f37('0xa')]('/describe',auth[_0x2f37('0x8')](),controller[_0x2f37('0xb')]);router[_0x2f37('0xa')]('/:id',auth[_0x2f37('0x8')](),controller[_0x2f37('0xc')]);router[_0x2f37('0xa')](_0x2f37('0xd'),auth['isAuthenticated'](),controller[_0x2f37('0xe')]);router[_0x2f37('0xa')](_0x2f37('0xf'),auth['isAuthenticated'](),controller[_0x2f37('0x10')]);router[_0x2f37('0xa')](_0x2f37('0x11'),controller[_0x2f37('0x12')]);router[_0x2f37('0xa')](_0x2f37('0x13'),controller[_0x2f37('0x14')]);router[_0x2f37('0xa')](_0x2f37('0x15'),controller[_0x2f37('0x16')]);router[_0x2f37('0xa')](_0x2f37('0x17'),controller[_0x2f37('0x18')]);router[_0x2f37('0xa')](_0x2f37('0x19'),auth[_0x2f37('0x8')](),controller[_0x2f37('0x1a')]);router[_0x2f37('0xa')](_0x2f37('0x1b'),controller[_0x2f37('0x1c')]);router['get'](_0x2f37('0x1d'),auth['isAuthenticated'](),controller[_0x2f37('0x1e')]);router[_0x2f37('0xa')](_0x2f37('0x1f'),auth[_0x2f37('0x8')](),controller['getProactiveActions']);router[_0x2f37('0xa')]('/:id/fields',controller['getFields']);router[_0x2f37('0xa')](_0x2f37('0x20'),auth[_0x2f37('0x8')](),controller['getOfflineMessages']);router[_0x2f37('0xa')](_0x2f37('0x21'),auth[_0x2f37('0x8')](),controller['getAgents']);router[_0x2f37('0x22')]('/',auth['isAuthenticated'](),controller[_0x2f37('0x23')]);router[_0x2f37('0x22')]('/:id/dispositions',auth[_0x2f37('0x8')](),controller[_0x2f37('0x24')]);router[_0x2f37('0x22')](_0x2f37('0xf'),auth[_0x2f37('0x8')](),controller[_0x2f37('0x25')]);var upload=multer({'storage':multer[_0x2f37('0x26')]({'destination':function(_0x5cd388,_0x39e8ed,_0x10f865){_0x10f865(null,path[_0x2f37('0x27')](config['root'],_0x2f37('0x28')));},'filename':function(_0x2d91fc,_0x43d4f1,_0x3e3666){_0x3e3666(null,util['format'](_0x2f37('0x29'),Date[_0x2f37('0x2a')](),_0x43d4f1[_0x2f37('0x2b')]));}})});router[_0x2f37('0x22')]('/:id/logo',upload[_0x2f37('0x2c')](_0x2f37('0x2d')),controller[_0x2f37('0x2e')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x53b174,_0x49f6af,_0x2b1e89){_0x2b1e89(null,path[_0x2f37('0x27')](config[_0x2f37('0x2f')],_0x2f37('0x30')));},'filename':function(_0x3f5826,_0x1e557e,_0x1402c7){_0x1402c7(null,util[_0x2f37('0x31')](_0x2f37('0x29'),Date[_0x2f37('0x2a')](),_0x1e557e[_0x2f37('0x2b')]));}})});router[_0x2f37('0x22')]('/:id/avatar',upload[_0x2f37('0x2c')](_0x2f37('0x2d')),controller['addAvatar']);var upload=multer({'storage':multer[_0x2f37('0x26')]({'destination':function(_0xdab659,_0x570914,_0x143d10){_0x143d10(null,path[_0x2f37('0x27')](config[_0x2f37('0x2f')],'server/files/images/avatars/'));},'filename':function(_0x1dd026,_0x55b9a9,_0x69be92){_0x69be92(null,util[_0x2f37('0x31')](_0x2f37('0x29'),Date[_0x2f37('0x2a')](),_0x55b9a9[_0x2f37('0x2b')]));}})});router['post'](_0x2f37('0x15'),upload[_0x2f37('0x2c')](_0x2f37('0x2d')),controller['addCustomerAvatar']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x343a3b,_0x44bbdf,_0x250efe){_0x250efe(null,path[_0x2f37('0x27')](config[_0x2f37('0x2f')],'server/files/images/avatars/'));},'filename':function(_0x98d71f,_0x57dd32,_0x55fe20){_0x55fe20(null,util[_0x2f37('0x31')](_0x2f37('0x29'),Date['now'](),_0x57dd32['originalname']));}})});router[_0x2f37('0x22')]('/:id/system_avatar',upload[_0x2f37('0x2c')](_0x2f37('0x2d')),controller[_0x2f37('0x32')]);router[_0x2f37('0x22')](_0x2f37('0x33'),controller[_0x2f37('0x34')]);const offlineUploadMulter=multer({'storage':multer['diskStorage']({'destination':function(_0x88775b,_0x17fa07,_0x5b2f46){const _0x314b4f=path['join'](config[_0x2f37('0x2f')],_0x2f37('0x35'),_0x2f37('0x36'),'offline-chat');fs_extra[_0x2f37('0x37')](_0x314b4f,function(){_0x5b2f46(null,_0x314b4f);});},'filename':function(_0x14359f,_0x4274cf,_0x5c8ca8){const _0x30e784=_0x4274cf[_0x2f37('0x2b')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x5f343a=path[_0x2f37('0x38')](_0x30e784);const _0x592e8c=Date[_0x2f37('0x2a')]()+'-'+_0x30e784[_0x2f37('0x39')](_0x5f343a,'')+_0x5f343a;_0x5c8ca8(null,_0x592e8c);}})});router[_0x2f37('0x22')](_0x2f37('0x3a'),offlineUploadMulter[_0x2f37('0x3b')](),controller['offline']);router[_0x2f37('0x22')](_0x2f37('0x19'),auth['isAuthenticated'](),controller[_0x2f37('0x3c')]);router[_0x2f37('0x22')](_0x2f37('0x1d'),auth[_0x2f37('0x8')](),controller[_0x2f37('0x3d')]);router['post'](_0x2f37('0x1f'),auth['isAuthenticated'](),controller[_0x2f37('0x3e')]);router[_0x2f37('0x22')](_0x2f37('0x21'),auth['isAuthenticated'](),controller['addAgents']);router[_0x2f37('0x3f')]('/:id',auth[_0x2f37('0x8')](),controller[_0x2f37('0x40')]);router[_0x2f37('0x41')]('/:id',auth['isAuthenticated'](),controller[_0x2f37('0x42')]);router[_0x2f37('0x41')](_0x2f37('0xd'),auth[_0x2f37('0x8')](),controller[_0x2f37('0x43')]);router['delete'](_0x2f37('0xf'),auth['isAuthenticated'](),controller[_0x2f37('0x44')]);router[_0x2f37('0x41')](_0x2f37('0x21'),auth[_0x2f37('0x8')](),controller[_0x2f37('0x45')]);module[_0x2f37('0x46')]=router;