4c83b95249f7a056a422c9c5058dd55e00c4c66f
[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 _0x54f0=['single','root','server/files/images/avatars/','format','/:id/avatar','file','addAvatar','/:id/system_avatar','addSystemAvatar','/:id/notify','notify','server/files','attachments','offline-chat','ensureDir','replace','any','offline','addApplications','addProactiveActions','/:id/users','addAgents','update','delete','/:id','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','/describe','describe','get','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getAvatar','/:id/customer_avatar','getCustomerAvatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','getFields','/:id/offline_messages','getOfflineMessages','getAgents','post','create','addDisposition','addAnswer','diskStorage','join','%s-%s','now','originalname','/:id/logo'];(function(_0x2ef6e0,_0x24707b){var _0x5e3bf7=function(_0x2a13ba){while(--_0x2a13ba){_0x2ef6e0['push'](_0x2ef6e0['shift']());}};_0x5e3bf7(++_0x24707b);}(_0x54f0,0x141));var _0x054f=function(_0x55e088,_0x334a90){_0x55e088=_0x55e088-0x0;var _0x3065d4=_0x54f0[_0x55e088];return _0x3065d4;};'use strict';var multer=require(_0x054f('0x0'));var util=require(_0x054f('0x1'));var path=require(_0x054f('0x2'));var timeout=require(_0x054f('0x3'));var express=require(_0x054f('0x4'));var router=express[_0x054f('0x5')]();var fs_extra=require(_0x054f('0x6'));var auth=require(_0x054f('0x7'));var interaction=require(_0x054f('0x8'));var config=require('../../config/environment');var controller=require('./chatWebsite.controller');router['get']('/',auth[_0x054f('0x9')](),controller['index']);router['get'](_0x054f('0xa'),auth['isAuthenticated'](),controller[_0x054f('0xb')]);router[_0x054f('0xc')]('/:id',auth[_0x054f('0x9')](),controller[_0x054f('0xd')]);router[_0x054f('0xc')](_0x054f('0xe'),auth[_0x054f('0x9')](),controller[_0x054f('0xf')]);router['get'](_0x054f('0x10'),auth[_0x054f('0x9')](),controller[_0x054f('0x11')]);router[_0x054f('0xc')]('/:id/logo',controller['getLogo']);router[_0x054f('0xc')]('/:id/avatar',controller[_0x054f('0x12')]);router[_0x054f('0xc')](_0x054f('0x13'),controller[_0x054f('0x14')]);router[_0x054f('0xc')]('/:id/system_avatar',controller[_0x054f('0x15')]);router[_0x054f('0xc')](_0x054f('0x16'),auth[_0x054f('0x9')](),controller[_0x054f('0x17')]);router[_0x054f('0xc')](_0x054f('0x18'),controller[_0x054f('0x19')]);router[_0x054f('0xc')](_0x054f('0x1a'),auth[_0x054f('0x9')](),controller[_0x054f('0x1b')]);router['get'](_0x054f('0x1c'),auth[_0x054f('0x9')](),controller[_0x054f('0x1d')]);router['get']('/:id/fields',controller[_0x054f('0x1e')]);router[_0x054f('0xc')](_0x054f('0x1f'),auth[_0x054f('0x9')](),controller[_0x054f('0x20')]);router[_0x054f('0xc')]('/:id/users',auth[_0x054f('0x9')](),controller[_0x054f('0x21')]);router[_0x054f('0x22')]('/',auth[_0x054f('0x9')](),controller[_0x054f('0x23')]);router['post'](_0x054f('0xe'),auth[_0x054f('0x9')](),controller[_0x054f('0x24')]);router[_0x054f('0x22')](_0x054f('0x10'),auth[_0x054f('0x9')](),controller[_0x054f('0x25')]);var upload=multer({'storage':multer[_0x054f('0x26')]({'destination':function(_0x5c02d8,_0x428719,_0x58100d){_0x58100d(null,path[_0x054f('0x27')](config['root'],'server/files/images/logos/'));},'filename':function(_0x360512,_0x553e60,_0x47a181){_0x47a181(null,util['format'](_0x054f('0x28'),Date[_0x054f('0x29')](),_0x553e60[_0x054f('0x2a')]));}})});router['post'](_0x054f('0x2b'),upload[_0x054f('0x2c')]('file'),controller['addLogo']);var upload=multer({'storage':multer[_0x054f('0x26')]({'destination':function(_0xd3cb6b,_0x10fcdc,_0x30e709){_0x30e709(null,path[_0x054f('0x27')](config[_0x054f('0x2d')],_0x054f('0x2e')));},'filename':function(_0x320593,_0x3735f4,_0x40f5b6){_0x40f5b6(null,util[_0x054f('0x2f')](_0x054f('0x28'),Date['now'](),_0x3735f4[_0x054f('0x2a')]));}})});router[_0x054f('0x22')](_0x054f('0x30'),upload[_0x054f('0x2c')](_0x054f('0x31')),controller[_0x054f('0x32')]);var upload=multer({'storage':multer[_0x054f('0x26')]({'destination':function(_0x3d79e1,_0xa653fe,_0x2780a2){_0x2780a2(null,path[_0x054f('0x27')](config[_0x054f('0x2d')],'server/files/images/avatars/'));},'filename':function(_0x4e29be,_0x281f4d,_0x2448a4){_0x2448a4(null,util[_0x054f('0x2f')]('%s-%s',Date[_0x054f('0x29')](),_0x281f4d[_0x054f('0x2a')]));}})});router[_0x054f('0x22')](_0x054f('0x13'),upload[_0x054f('0x2c')](_0x054f('0x31')),controller['addCustomerAvatar']);var upload=multer({'storage':multer[_0x054f('0x26')]({'destination':function(_0x11eef0,_0x54aaaa,_0x4035f3){_0x4035f3(null,path[_0x054f('0x27')](config[_0x054f('0x2d')],'server/files/images/avatars/'));},'filename':function(_0x319c9f,_0xec0ab5,_0x57491b){_0x57491b(null,util[_0x054f('0x2f')]('%s-%s',Date[_0x054f('0x29')](),_0xec0ab5[_0x054f('0x2a')]));}})});router[_0x054f('0x22')](_0x054f('0x33'),upload['single']('file'),controller[_0x054f('0x34')]);router[_0x054f('0x22')](_0x054f('0x35'),controller[_0x054f('0x36')]);const offlineUploadMulter=multer({'storage':multer[_0x054f('0x26')]({'destination':function(_0x5ac7c7,_0x4bb9a3,_0x46bb23){const _0x3edb02=path[_0x054f('0x27')](config[_0x054f('0x2d')],_0x054f('0x37'),_0x054f('0x38'),_0x054f('0x39'));fs_extra[_0x054f('0x3a')](_0x3edb02,function(){_0x46bb23(null,_0x3edb02);});},'filename':function(_0x4d2992,_0x1a172c,_0x2125e0){const _0x417c6e=_0x1a172c[_0x054f('0x2a')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x400642=path['extname'](_0x417c6e);const _0xb4e2d8=Date[_0x054f('0x29')]()+'-'+_0x417c6e[_0x054f('0x3b')](_0x400642,'')+_0x400642;_0x2125e0(null,_0xb4e2d8);}})});router[_0x054f('0x22')]('/:id/offline',offlineUploadMulter[_0x054f('0x3c')](),controller[_0x054f('0x3d')]);router[_0x054f('0x22')](_0x054f('0x16'),auth[_0x054f('0x9')](),controller['addInteraction']);router[_0x054f('0x22')](_0x054f('0x1a'),auth[_0x054f('0x9')](),controller[_0x054f('0x3e')]);router[_0x054f('0x22')](_0x054f('0x1c'),auth['isAuthenticated'](),controller[_0x054f('0x3f')]);router[_0x054f('0x22')](_0x054f('0x40'),auth[_0x054f('0x9')](),controller[_0x054f('0x41')]);router['put']('/:id',auth[_0x054f('0x9')](),controller[_0x054f('0x42')]);router[_0x054f('0x43')](_0x054f('0x44'),auth[_0x054f('0x9')](),controller['destroy']);router[_0x054f('0x43')](_0x054f('0xe'),auth[_0x054f('0x9')](),controller[_0x054f('0x45')]);router[_0x054f('0x43')](_0x054f('0x10'),auth[_0x054f('0x9')](),controller[_0x054f('0x46')]);router['delete']('/:id/users',auth[_0x054f('0x9')](),controller[_0x054f('0x47')]);module[_0x054f('0x48')]=router;