Built motion from commit (unavailable).|2.5.31
[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 _0xbefe=['server/files/images/logos/','format','%s-%s','originalname','/:id/logo','single','file','addLogo','server/files/images/avatars/','now','addCustomerAvatar','/:id/notify','notify','server/files','replace','extname','any','offline','addInteraction','addApplications','/:id/users','put','update','delete','/:id/canned_answers','removeAnswers','removeAgents','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatWebsite.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/dispositions','getAnswers','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','getOfflineMessages','getAgents','post','create','addDisposition','addAnswer','diskStorage','join','root'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0xbefe,0xa6));var _0xebef=function(_0x2a5dc1,_0xc58ca4){_0x2a5dc1=_0x2a5dc1-0x0;var _0x244d63=_0xbefe[_0x2a5dc1];return _0x244d63;};'use strict';var multer=require('multer');var util=require(_0xebef('0x0'));var path=require(_0xebef('0x1'));var timeout=require('connect-timeout');var express=require(_0xebef('0x2'));var router=express[_0xebef('0x3')]();var fs_extra=require(_0xebef('0x4'));var auth=require(_0xebef('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xebef('0x6'));var controller=require(_0xebef('0x7'));router['get']('/',auth[_0xebef('0x8')](),controller[_0xebef('0x9')]);router[_0xebef('0xa')](_0xebef('0xb'),auth['isAuthenticated'](),controller[_0xebef('0xc')]);router[_0xebef('0xa')](_0xebef('0xd'),auth[_0xebef('0x8')](),controller[_0xebef('0xe')]);router[_0xebef('0xa')](_0xebef('0xf'),auth[_0xebef('0x8')](),controller['getDispositions']);router[_0xebef('0xa')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0xebef('0x10')]);router['get']('/:id/logo',controller['getLogo']);router[_0xebef('0xa')](_0xebef('0x11'),controller[_0xebef('0x12')]);router[_0xebef('0xa')](_0xebef('0x13'),controller[_0xebef('0x14')]);router[_0xebef('0xa')](_0xebef('0x15'),controller[_0xebef('0x16')]);router[_0xebef('0xa')](_0xebef('0x17'),auth[_0xebef('0x8')](),controller[_0xebef('0x18')]);router[_0xebef('0xa')](_0xebef('0x19'),controller[_0xebef('0x1a')]);router[_0xebef('0xa')](_0xebef('0x1b'),auth['isAuthenticated'](),controller[_0xebef('0x1c')]);router[_0xebef('0xa')](_0xebef('0x1d'),auth[_0xebef('0x8')](),controller[_0xebef('0x1e')]);router['get'](_0xebef('0x1f'),controller['getFields']);router[_0xebef('0xa')]('/:id/offline_messages',auth[_0xebef('0x8')](),controller[_0xebef('0x20')]);router[_0xebef('0xa')]('/:id/users',auth[_0xebef('0x8')](),controller[_0xebef('0x21')]);router[_0xebef('0x22')]('/',auth[_0xebef('0x8')](),controller[_0xebef('0x23')]);router[_0xebef('0x22')](_0xebef('0xf'),auth[_0xebef('0x8')](),controller[_0xebef('0x24')]);router['post']('/:id/canned_answers',auth[_0xebef('0x8')](),controller[_0xebef('0x25')]);var upload=multer({'storage':multer[_0xebef('0x26')]({'destination':function(_0x431091,_0x13b25e,_0x513973){_0x513973(null,path[_0xebef('0x27')](config[_0xebef('0x28')],_0xebef('0x29')));},'filename':function(_0x301550,_0x44ae4b,_0x3c5e4e){_0x3c5e4e(null,util[_0xebef('0x2a')](_0xebef('0x2b'),Date['now'](),_0x44ae4b[_0xebef('0x2c')]));}})});router[_0xebef('0x22')](_0xebef('0x2d'),upload[_0xebef('0x2e')](_0xebef('0x2f')),controller[_0xebef('0x30')]);var upload=multer({'storage':multer[_0xebef('0x26')]({'destination':function(_0x1ae613,_0x7a34b,_0x4f65ef){_0x4f65ef(null,path[_0xebef('0x27')](config[_0xebef('0x28')],_0xebef('0x31')));},'filename':function(_0x3f77b2,_0x216d8f,_0x3d36e4){_0x3d36e4(null,util['format'](_0xebef('0x2b'),Date[_0xebef('0x32')](),_0x216d8f[_0xebef('0x2c')]));}})});router[_0xebef('0x22')]('/:id/avatar',upload['single'](_0xebef('0x2f')),controller['addAvatar']);var upload=multer({'storage':multer[_0xebef('0x26')]({'destination':function(_0xa560e4,_0x162045,_0x1c700d){_0x1c700d(null,path[_0xebef('0x27')](config[_0xebef('0x28')],_0xebef('0x31')));},'filename':function(_0x36939d,_0xb919d2,_0x10a065){_0x10a065(null,util['format'](_0xebef('0x2b'),Date[_0xebef('0x32')](),_0xb919d2['originalname']));}})});router[_0xebef('0x22')]('/:id/customer_avatar',upload[_0xebef('0x2e')](_0xebef('0x2f')),controller[_0xebef('0x33')]);var upload=multer({'storage':multer[_0xebef('0x26')]({'destination':function(_0x341703,_0x25b82a,_0x415343){_0x415343(null,path[_0xebef('0x27')](config[_0xebef('0x28')],_0xebef('0x31')));},'filename':function(_0xf74432,_0x4b3d31,_0x2eb2e9){_0x2eb2e9(null,util[_0xebef('0x2a')]('%s-%s',Date[_0xebef('0x32')](),_0x4b3d31[_0xebef('0x2c')]));}})});router[_0xebef('0x22')](_0xebef('0x15'),upload[_0xebef('0x2e')](_0xebef('0x2f')),controller['addSystemAvatar']);router[_0xebef('0x22')](_0xebef('0x34'),controller[_0xebef('0x35')]);const offlineUploadMulter=multer({'storage':multer['diskStorage']({'destination':function(_0xa637ae,_0x23a4f1,_0x28e1c6){const _0x12312f=path[_0xebef('0x27')](config[_0xebef('0x28')],_0xebef('0x36'),'attachments','offline-chat');fs_extra['ensureDir'](_0x12312f,function(){_0x28e1c6(null,_0x12312f);});},'filename':function(_0x3045d6,_0x476f90,_0x1c8e93){const _0x2a9e94=_0x476f90[_0xebef('0x2c')][_0xebef('0x37')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x4d4a77=path[_0xebef('0x38')](_0x2a9e94);const _0x2808fd=Date[_0xebef('0x32')]()+'-'+_0x2a9e94[_0xebef('0x37')](_0x4d4a77,'')+_0x4d4a77;_0x1c8e93(null,_0x2808fd);}})});router[_0xebef('0x22')]('/:id/offline',offlineUploadMulter[_0xebef('0x39')](),controller[_0xebef('0x3a')]);router[_0xebef('0x22')](_0xebef('0x17'),auth[_0xebef('0x8')](),controller[_0xebef('0x3b')]);router['post']('/:id/applications',auth[_0xebef('0x8')](),controller[_0xebef('0x3c')]);router[_0xebef('0x22')](_0xebef('0x1d'),auth[_0xebef('0x8')](),controller['addProactiveActions']);router[_0xebef('0x22')](_0xebef('0x3d'),auth['isAuthenticated'](),controller['addAgents']);router[_0xebef('0x3e')](_0xebef('0xd'),auth[_0xebef('0x8')](),controller[_0xebef('0x3f')]);router[_0xebef('0x40')](_0xebef('0xd'),auth[_0xebef('0x8')](),controller['destroy']);router[_0xebef('0x40')](_0xebef('0xf'),auth[_0xebef('0x8')](),controller['removeDispositions']);router[_0xebef('0x40')](_0xebef('0x41'),auth[_0xebef('0x8')](),controller[_0xebef('0x42')]);router[_0xebef('0x40')](_0xebef('0x3d'),auth[_0xebef('0x8')](),controller[_0xebef('0x43')]);module[_0xebef('0x44')]=router;