Built motion from commit efa66e19.|2.6.22
[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 _0x88f6=['/:id/proactive_actions','addProactiveActions','addAgents','put','update','destroy','delete','/:id/users','removeAgents','exports','multer','util','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatWebsite.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','getApplications','getProactiveActions','getFields','getAgents','post','addDisposition','addAnswer','join','root','server/files/images/logos/','format','%s-%s','now','originalname','addLogo','server/files/images/avatars/','single','file','diskStorage','addSystemAvatar','/:id/notify','server/files','attachments','offline-chat','ensureDir','replace','extname','/:id/offline','any','addInteraction','/:id/applications','addApplications'];(function(_0x4d8dc3,_0x585fd1){var _0x9b03d9=function(_0x7a31d5){while(--_0x7a31d5){_0x4d8dc3['push'](_0x4d8dc3['shift']());}};_0x9b03d9(++_0x585fd1);}(_0x88f6,0x12a));var _0x688f=function(_0x1bc3c1,_0x400b0b){_0x1bc3c1=_0x1bc3c1-0x0;var _0x32b0d4=_0x88f6[_0x1bc3c1];return _0x32b0d4;};'use strict';var multer=require(_0x688f('0x0'));var util=require(_0x688f('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x688f('0x2')]();var fs_extra=require(_0x688f('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x688f('0x4'));var config=require(_0x688f('0x5'));var controller=require(_0x688f('0x6'));router['get']('/',auth[_0x688f('0x7')](),controller[_0x688f('0x8')]);router[_0x688f('0x9')](_0x688f('0xa'),auth[_0x688f('0x7')](),controller[_0x688f('0xb')]);router[_0x688f('0x9')](_0x688f('0xc'),auth[_0x688f('0x7')](),controller[_0x688f('0xd')]);router[_0x688f('0x9')](_0x688f('0xe'),auth['isAuthenticated'](),controller[_0x688f('0xf')]);router['get'](_0x688f('0x10'),auth[_0x688f('0x7')](),controller[_0x688f('0x11')]);router['get'](_0x688f('0x12'),controller[_0x688f('0x13')]);router['get'](_0x688f('0x14'),controller[_0x688f('0x15')]);router[_0x688f('0x9')](_0x688f('0x16'),controller[_0x688f('0x17')]);router[_0x688f('0x9')](_0x688f('0x18'),controller[_0x688f('0x19')]);router[_0x688f('0x9')](_0x688f('0x1a'),auth[_0x688f('0x7')](),controller[_0x688f('0x1b')]);router[_0x688f('0x9')](_0x688f('0x1c'),controller[_0x688f('0x1d')]);router[_0x688f('0x9')]('/:id/applications',auth['isAuthenticated'](),controller[_0x688f('0x1e')]);router[_0x688f('0x9')]('/:id/proactive_actions',auth[_0x688f('0x7')](),controller[_0x688f('0x1f')]);router[_0x688f('0x9')]('/:id/fields',controller[_0x688f('0x20')]);router[_0x688f('0x9')]('/:id/offline_messages',auth['isAuthenticated'](),controller['getOfflineMessages']);router['get']('/:id/users',auth[_0x688f('0x7')](),controller[_0x688f('0x21')]);router[_0x688f('0x22')]('/',auth[_0x688f('0x7')](),controller['create']);router[_0x688f('0x22')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x688f('0x23')]);router[_0x688f('0x22')](_0x688f('0x10'),auth['isAuthenticated'](),controller[_0x688f('0x24')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5c3867,_0x5df163,_0x3566d5){_0x3566d5(null,path[_0x688f('0x25')](config[_0x688f('0x26')],_0x688f('0x27')));},'filename':function(_0x33c893,_0x208b4a,_0x37aeb5){_0x37aeb5(null,util[_0x688f('0x28')](_0x688f('0x29'),Date[_0x688f('0x2a')](),_0x208b4a[_0x688f('0x2b')]));}})});router[_0x688f('0x22')]('/:id/logo',upload['single']('file'),controller[_0x688f('0x2c')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x46289c,_0x5b9538,_0x1a8f8f){_0x1a8f8f(null,path[_0x688f('0x25')](config['root'],_0x688f('0x2d')));},'filename':function(_0x3d0779,_0x3ae260,_0x30eeb5){_0x30eeb5(null,util[_0x688f('0x28')](_0x688f('0x29'),Date[_0x688f('0x2a')](),_0x3ae260[_0x688f('0x2b')]));}})});router['post'](_0x688f('0x14'),upload[_0x688f('0x2e')](_0x688f('0x2f')),controller['addAvatar']);var upload=multer({'storage':multer[_0x688f('0x30')]({'destination':function(_0x181c1a,_0x5f73e4,_0xa0f21f){_0xa0f21f(null,path[_0x688f('0x25')](config[_0x688f('0x26')],_0x688f('0x2d')));},'filename':function(_0x1bb302,_0x43d7cf,_0x5ba7cf){_0x5ba7cf(null,util[_0x688f('0x28')]('%s-%s',Date[_0x688f('0x2a')](),_0x43d7cf[_0x688f('0x2b')]));}})});router[_0x688f('0x22')](_0x688f('0x16'),upload[_0x688f('0x2e')]('file'),controller['addCustomerAvatar']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x426164,_0x416b28,_0x4030ac){_0x4030ac(null,path[_0x688f('0x25')](config[_0x688f('0x26')],_0x688f('0x2d')));},'filename':function(_0x24aa1c,_0x440975,_0x3d3c89){_0x3d3c89(null,util[_0x688f('0x28')]('%s-%s',Date[_0x688f('0x2a')](),_0x440975[_0x688f('0x2b')]));}})});router[_0x688f('0x22')](_0x688f('0x18'),upload['single']('file'),controller[_0x688f('0x31')]);router[_0x688f('0x22')](_0x688f('0x32'),controller['notify']);const offlineUploadMulter=multer({'storage':multer['diskStorage']({'destination':function(_0xf4d78b,_0x5b37a0,_0x268156){const _0x2eb845=path[_0x688f('0x25')](config[_0x688f('0x26')],_0x688f('0x33'),_0x688f('0x34'),_0x688f('0x35'));fs_extra[_0x688f('0x36')](_0x2eb845,function(){_0x268156(null,_0x2eb845);});},'filename':function(_0x5e98c2,_0xca6992,_0x43ee36){const _0x4a7697=_0xca6992['originalname'][_0x688f('0x37')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x4051ce=path[_0x688f('0x38')](_0x4a7697);const _0x434235=Date['now']()+'-'+_0x4a7697['replace'](_0x4051ce,'')+_0x4051ce;_0x43ee36(null,_0x434235);}})});router['post'](_0x688f('0x39'),offlineUploadMulter[_0x688f('0x3a')](),controller['offline']);router[_0x688f('0x22')](_0x688f('0x1a'),auth[_0x688f('0x7')](),controller[_0x688f('0x3b')]);router[_0x688f('0x22')](_0x688f('0x3c'),auth['isAuthenticated'](),controller[_0x688f('0x3d')]);router['post'](_0x688f('0x3e'),auth['isAuthenticated'](),controller[_0x688f('0x3f')]);router[_0x688f('0x22')]('/:id/users',auth[_0x688f('0x7')](),controller[_0x688f('0x40')]);router[_0x688f('0x41')](_0x688f('0xc'),auth[_0x688f('0x7')](),controller[_0x688f('0x42')]);router['delete'](_0x688f('0xc'),auth[_0x688f('0x7')](),controller[_0x688f('0x43')]);router['delete'](_0x688f('0xe'),auth[_0x688f('0x7')](),controller['removeDispositions']);router[_0x688f('0x44')](_0x688f('0x10'),auth[_0x688f('0x7')](),controller['removeAnswers']);router[_0x688f('0x44')](_0x688f('0x45'),auth[_0x688f('0x7')](),controller[_0x688f('0x46')]);module[_0x688f('0x47')]=router;