1 // *************************************************************************
3 // * xCALLY Motion - The Omnichannel Contact Center *
4 // * Copyright (c) Xenialab s.r.l. All Rights Reserved *
6 // *************************************************************************
8 // * Email: info@xcally.com *
9 // * Website: https://www.xcally.com *
11 // *************************************************************************
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. *
17 // *************************************************************************
18 var _0xd7ee=['root','resolve','server/app.json','isArray','apps','findIndex','env','NODE_PATH','string','pathExists','then','readJSON','updated','writeJSON','exports','fs-extra','path'];(function(_0x6a1321,_0x579f93){var _0x5d84ed=function(_0x477e8d){while(--_0x477e8d){_0x6a1321['push'](_0x6a1321['shift']());}};_0x5d84ed(++_0x579f93);}(_0xd7ee,0x1c9));var _0xed7e=function(_0x4d4f61,_0x56d7a7){_0x4d4f61=_0x4d4f61-0x0;var _0x297414=_0xd7ee[_0x4d4f61];return _0x297414;};var fs=require(_0xed7e('0x0'));var path=require(_0xed7e('0x1'));var config=require('../config/environment');var root=config[_0xed7e('0x2')];var APP_JSON_PATH=path[_0xed7e('0x3')](root,_0xed7e('0x4'));var NODEPATH=path[_0xed7e('0x3')](root,'legacy-libs');function setLegacyLibsNodeEnvPath(_0x4ae2fd){let _0x22496e=![];if(Array[_0xed7e('0x5')](_0x4ae2fd[_0xed7e('0x6')])){var _0x532d59=_0x4ae2fd[_0xed7e('0x6')][_0xed7e('0x7')](function(_0x51d1ae){return _0x51d1ae['name']==='motion2';});if(_0x532d59>-0x1){var _0xbf8263=_0x4ae2fd[_0xed7e('0x6')][_0x532d59];if(typeof _0xbf8263[_0xed7e('0x8')][_0xed7e('0x9')]!==_0xed7e('0xa')){_0xbf8263[_0xed7e('0x8')]['NODE_PATH']=NODEPATH;_0x22496e=!![];}}return{'appConfig':_0x4ae2fd,'updated':_0x22496e};}}function updateAppConfig(_0x5e7689){return fs[_0xed7e('0xb')](APP_JSON_PATH)[_0xed7e('0xc')](function(_0x41c6d1){if(_0x41c6d1){return fs[_0xed7e('0xd')](APP_JSON_PATH)[_0xed7e('0xc')](function(_0x45dbfa){var _0x46f13f=setLegacyLibsNodeEnvPath(_0x45dbfa);if(_0x46f13f[_0xed7e('0xe')]){_0x5e7689['info']('Updating\x20app.json');return fs[_0xed7e('0xf')](APP_JSON_PATH,_0x45dbfa,{'spaces':0x2});}else{return Promise[_0xed7e('0x3')]();}});}else{return Promise[_0xed7e('0x3')]();}});}module[_0xed7e('0x10')]=updateAppConfig;