bfe3d3fade75a7f041a7a6a627dbeed2882286bf
[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 _0x9bee=['delete','destroy','removeDispositions','removeAgents','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','isAuthenticated','get','/describe','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','getLogo','/:id/avatar','getAvatar','getCustomerAvatar','/:id/system_avatar','getInteractions','/:id/snippet','getSnippet','/:id/applications','getApplications','getProactiveActions','/:id/fields','/:id/offline_messages','/:id/users','getAgents','post','create','addDisposition','diskStorage','join','format','%s-%s','now','originalname','/:id/logo','single','file','addLogo','root','server/files/images/avatars/','addAvatar','addCustomerAvatar','addSystemAvatar','notify','attachments','offline-chat','ensureDir','replace','extname','any','offline','/:id/interactions','addInteraction','addApplications','/:id/proactive_actions','addProactiveActions','addAgents','put'];(function(_0x4295bc,_0x55b581){var _0x2f0298=function(_0x3015e2){while(--_0x3015e2){_0x4295bc['push'](_0x4295bc['shift']());}};_0x2f0298(++_0x55b581);}(_0x9bee,0xd4));var _0xe9be=function(_0x1925df,_0xbd3e63){_0x1925df=_0x1925df-0x0;var _0x2f4e05=_0x9bee[_0x1925df];return _0x2f4e05;};'use strict';var multer=require(_0xe9be('0x0'));var util=require(_0xe9be('0x1'));var path=require(_0xe9be('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xe9be('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xe9be('0x4'));var interaction=require(_0xe9be('0x5'));var config=require(_0xe9be('0x6'));var controller=require(_0xe9be('0x7'));router['get']('/',auth[_0xe9be('0x8')](),controller['index']);router[_0xe9be('0x9')](_0xe9be('0xa'),auth[_0xe9be('0x8')](),controller['describe']);router[_0xe9be('0x9')](_0xe9be('0xb'),auth[_0xe9be('0x8')](),controller[_0xe9be('0xc')]);router[_0xe9be('0x9')](_0xe9be('0xd'),auth['isAuthenticated'](),controller['getDispositions']);router[_0xe9be('0x9')](_0xe9be('0xe'),auth[_0xe9be('0x8')](),controller[_0xe9be('0xf')]);router[_0xe9be('0x9')]('/:id/logo',controller[_0xe9be('0x10')]);router['get'](_0xe9be('0x11'),controller[_0xe9be('0x12')]);router[_0xe9be('0x9')]('/:id/customer_avatar',controller[_0xe9be('0x13')]);router[_0xe9be('0x9')](_0xe9be('0x14'),controller['getSystemAvatar']);router[_0xe9be('0x9')]('/:id/interactions',auth[_0xe9be('0x8')](),controller[_0xe9be('0x15')]);router[_0xe9be('0x9')](_0xe9be('0x16'),controller[_0xe9be('0x17')]);router['get'](_0xe9be('0x18'),auth['isAuthenticated'](),controller[_0xe9be('0x19')]);router[_0xe9be('0x9')]('/:id/proactive_actions',auth[_0xe9be('0x8')](),controller[_0xe9be('0x1a')]);router[_0xe9be('0x9')](_0xe9be('0x1b'),controller['getFields']);router['get'](_0xe9be('0x1c'),auth['isAuthenticated'](),controller['getOfflineMessages']);router[_0xe9be('0x9')](_0xe9be('0x1d'),auth['isAuthenticated'](),controller[_0xe9be('0x1e')]);router[_0xe9be('0x1f')]('/',auth[_0xe9be('0x8')](),controller[_0xe9be('0x20')]);router[_0xe9be('0x1f')]('/:id/dispositions',auth[_0xe9be('0x8')](),controller[_0xe9be('0x21')]);router[_0xe9be('0x1f')]('/:id/canned_answers',auth[_0xe9be('0x8')](),controller['addAnswer']);var upload=multer({'storage':multer[_0xe9be('0x22')]({'destination':function(_0x264988,_0x7bf02e,_0x11c013){_0x11c013(null,path[_0xe9be('0x23')](config['root'],'server/files/images/logos/'));},'filename':function(_0xf2acb0,_0x5e24da,_0xb21874){_0xb21874(null,util[_0xe9be('0x24')](_0xe9be('0x25'),Date[_0xe9be('0x26')](),_0x5e24da[_0xe9be('0x27')]));}})});router[_0xe9be('0x1f')](_0xe9be('0x28'),upload[_0xe9be('0x29')](_0xe9be('0x2a')),controller[_0xe9be('0x2b')]);var upload=multer({'storage':multer[_0xe9be('0x22')]({'destination':function(_0xe262f7,_0x19586f,_0xdab3a3){_0xdab3a3(null,path[_0xe9be('0x23')](config[_0xe9be('0x2c')],_0xe9be('0x2d')));},'filename':function(_0x38b653,_0x4cd778,_0x2e371c){_0x2e371c(null,util[_0xe9be('0x24')]('%s-%s',Date[_0xe9be('0x26')](),_0x4cd778[_0xe9be('0x27')]));}})});router[_0xe9be('0x1f')]('/:id/avatar',upload[_0xe9be('0x29')](_0xe9be('0x2a')),controller[_0xe9be('0x2e')]);var upload=multer({'storage':multer[_0xe9be('0x22')]({'destination':function(_0x4d918c,_0x553aaf,_0x53cbfc){_0x53cbfc(null,path['join'](config[_0xe9be('0x2c')],_0xe9be('0x2d')));},'filename':function(_0x4f3c28,_0x2f0863,_0x2af5bb){_0x2af5bb(null,util[_0xe9be('0x24')](_0xe9be('0x25'),Date['now'](),_0x2f0863[_0xe9be('0x27')]));}})});router[_0xe9be('0x1f')]('/:id/customer_avatar',upload[_0xe9be('0x29')](_0xe9be('0x2a')),controller[_0xe9be('0x2f')]);var upload=multer({'storage':multer[_0xe9be('0x22')]({'destination':function(_0x3b4e00,_0x3a912c,_0x532411){_0x532411(null,path[_0xe9be('0x23')](config['root'],_0xe9be('0x2d')));},'filename':function(_0x418134,_0x47abb6,_0x23382e){_0x23382e(null,util[_0xe9be('0x24')](_0xe9be('0x25'),Date[_0xe9be('0x26')](),_0x47abb6['originalname']));}})});router[_0xe9be('0x1f')](_0xe9be('0x14'),upload[_0xe9be('0x29')](_0xe9be('0x2a')),controller[_0xe9be('0x30')]);router[_0xe9be('0x1f')]('/:id/notify',controller[_0xe9be('0x31')]);const offlineUploadMulter=multer({'storage':multer[_0xe9be('0x22')]({'destination':function(_0x121bcc,_0x265819,_0x923342){const _0x3400e5=path[_0xe9be('0x23')](config[_0xe9be('0x2c')],'server/files',_0xe9be('0x32'),_0xe9be('0x33'));fs_extra[_0xe9be('0x34')](_0x3400e5,function(){_0x923342(null,_0x3400e5);});},'filename':function(_0x4e2f42,_0x13cadc,_0x35e728){const _0x55d068=_0x13cadc[_0xe9be('0x27')][_0xe9be('0x35')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x536683=path[_0xe9be('0x36')](_0x55d068);const _0x5d9b8c=Date[_0xe9be('0x26')]()+'-'+_0x55d068[_0xe9be('0x35')](_0x536683,'')+_0x536683;_0x35e728(null,_0x5d9b8c);}})});router['post']('/:id/offline',offlineUploadMulter[_0xe9be('0x37')](),controller[_0xe9be('0x38')]);router[_0xe9be('0x1f')](_0xe9be('0x39'),auth[_0xe9be('0x8')](),controller[_0xe9be('0x3a')]);router[_0xe9be('0x1f')](_0xe9be('0x18'),auth['isAuthenticated'](),controller[_0xe9be('0x3b')]);router[_0xe9be('0x1f')](_0xe9be('0x3c'),auth[_0xe9be('0x8')](),controller[_0xe9be('0x3d')]);router[_0xe9be('0x1f')]('/:id/users',auth[_0xe9be('0x8')](),controller[_0xe9be('0x3e')]);router[_0xe9be('0x3f')](_0xe9be('0xb'),auth[_0xe9be('0x8')](),controller['update']);router[_0xe9be('0x40')](_0xe9be('0xb'),auth[_0xe9be('0x8')](),controller[_0xe9be('0x41')]);router['delete'](_0xe9be('0xd'),auth[_0xe9be('0x8')](),controller[_0xe9be('0x42')]);router[_0xe9be('0x40')](_0xe9be('0xe'),auth[_0xe9be('0x8')](),controller['removeAnswers']);router[_0xe9be('0x40')](_0xe9be('0x1d'),auth[_0xe9be('0x8')](),controller[_0xe9be('0x43')]);module[_0xe9be('0x44')]=router;