@ -0,0 +1,3 @@
|
||||
{ |
||||
"svn.ignoreMissingSvnWarning": true |
||||
} |
@ -0,0 +1,78 @@
|
||||
<?php |
||||
namespace app\Provider; |
||||
|
||||
/** |
||||
* Description of Cripto |
||||
* |
||||
* @author Lucas Awade |
||||
*/ |
||||
class Crypt { |
||||
|
||||
private $message; |
||||
private $key; |
||||
private $option; |
||||
private $tag; |
||||
private $cipher; |
||||
private $ivlen; |
||||
private $iv; |
||||
private $textcrypt; |
||||
|
||||
const CONF_CIPHER_CRYPT = 'aes-256-cbc'; |
||||
|
||||
function __construct($cipher = null, $key = null, $option = OPENSSL_RAW_DATA, $tag = null) { |
||||
if (!$cipher) { |
||||
$this->cipher = self::CONF_CIPHER_CRYPT; |
||||
} else { |
||||
$this->cipher = $cipher; |
||||
} |
||||
$this->key = $key; |
||||
$this->option = $option; |
||||
$this->tag = $tag; |
||||
$this->openssl_crypt(); |
||||
} |
||||
|
||||
public function encrypt($message = null) { |
||||
$this->setMessage($message); |
||||
$encrypt = openssl_encrypt($this->message, $this->cipher, $this->key, $this->option, $this->iv); |
||||
$hashcode = hash_hmac('sha256', $encrypt, $this->key, true); |
||||
$this->textcrypt = base64_encode($this->iv . $hashcode . $encrypt); |
||||
return $this->textcrypt; |
||||
} |
||||
|
||||
public function decrypt($textcrypt = null) { |
||||
$c = base64_decode($textcrypt); |
||||
$this->iv = substr($c, 0, $this->ivlen); |
||||
$hmac = substr($c, $this->ivlen, 32); |
||||
$ciphertext_raw = substr($c, $this->ivlen + 32); |
||||
$original_plaintext = openssl_decrypt($ciphertext_raw, $this->cipher, $this->key, $options = OPENSSL_RAW_DATA, $this->iv); |
||||
$calcmac = hash_hmac('sha256', $ciphertext_raw, $this->key, true); |
||||
if (hash_equals($hmac, $calcmac)) { |
||||
return $original_plaintext; |
||||
} |
||||
} |
||||
|
||||
private function openssl_crypt() { |
||||
if (in_array(strtolower($this->cipher), openssl_get_cipher_methods())) { |
||||
$this->ivlen = openssl_cipher_iv_length($this->cipher); |
||||
$this->iv = openssl_random_pseudo_bytes($this->ivlen); |
||||
} |
||||
} |
||||
|
||||
public function setKey($key) { |
||||
$this->key = $key; |
||||
} |
||||
|
||||
public function setOption($option) { |
||||
$this->option = $option; |
||||
} |
||||
|
||||
public function setTag($tag) { |
||||
$this->tag = $tag; |
||||
} |
||||
|
||||
public function setMessage($message) { |
||||
$this->message = $message; |
||||
} |
||||
|
||||
} |
||||
|
@ -0,0 +1,5 @@
|
||||
<?php |
||||
function getconfig($file){ |
||||
return include __DIR__ . "/../../config/{$file}.php"; |
||||
} |
||||
?> |
@ -0,0 +1,13 @@
|
||||
{ |
||||
"name": "simplesip/clientwhatsapp", |
||||
"description": "Projeto Client WhatsApp", |
||||
"authors": [{ |
||||
"name": "Simples IP Desenvolvimento", |
||||
"email": "desenvolvimento@gmail.com" |
||||
}], |
||||
"autoload": { |
||||
"psr-4": { |
||||
"app\\": "app/" |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,18 @@
|
||||
{ |
||||
"_readme": [ |
||||
"This file locks the dependencies of your project to a known state", |
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", |
||||
"This file is @generated automatically" |
||||
], |
||||
"content-hash": "ca25f1751db799cee76630ec7297d86d", |
||||
"packages": [], |
||||
"packages-dev": [], |
||||
"aliases": [], |
||||
"minimum-stability": "stable", |
||||
"stability-flags": [], |
||||
"prefer-stable": false, |
||||
"prefer-lowest": false, |
||||
"platform": [], |
||||
"platform-dev": [], |
||||
"plugin-api-version": "2.0.0" |
||||
} |
@ -0,0 +1,6 @@
|
||||
<?php |
||||
return [ |
||||
"PASSWORD" => '#S1mpl3S_C0nn3ct@R00t', |
||||
"FILES" => 'public' |
||||
]; |
||||
?> |
@ -0,0 +1,14 @@
|
||||
<?php |
||||
|
||||
error_reporting(E_ERROR); |
||||
ini_set('display_errors', 1); |
||||
|
||||
$filename = __DIR__ . '/../storage/logs/display_erros.log'; |
||||
|
||||
if (!file_exists($filename)) { |
||||
file_put_contents($filename, ''); |
||||
exec(" chown pbx:pbx {$filename}"); |
||||
} |
||||
ini_set('log_errors', 1); |
||||
ini_set('error_log', $filename); |
||||
ini_set('log_errors_max_len', 4096); |
@ -0,0 +1,5 @@
|
||||
<?php |
||||
require __DIR__ . "/../vendor/autoload.php"; |
||||
include __DIR__ . "/../config/display_erros.php"; |
||||
include __DIR__ . "/../app/helpers/functions.php"; |
||||
?> |
@ -0,0 +1,176 @@
|
||||
<?php |
||||
|
||||
include "config/includes.php"; |
||||
|
||||
use app\Provider\Crypt; |
||||
|
||||
$files = getconfig('app')['FILES']; |
||||
$crypt = new Crypt('aes-256-cbc', getconfig('app')['PASSWORD']); |
||||
|
||||
$json = json_decode($crypt->decrypt(str_replace(' ', '+', $_GET['t'])), true); |
||||
if($_GET['t'] && $json && $json['expire'] < time()){ |
||||
$json = json_decode($crypt->decrypt(str_replace(' ', '+', $_GET['t'])), true); |
||||
|
||||
$objs = [ |
||||
'obj_server' => $json['servidor'], |
||||
'my_uniqueid' => $json['matricula'], |
||||
'obj_queue' => $json['fila'], |
||||
'obj_ws' => $json['websocket'], |
||||
'session_uniqueid' => null, |
||||
'obj_notification' => null, |
||||
'obj_contact' => null, |
||||
'obj_status' => null, |
||||
'session_window' => null |
||||
]; |
||||
|
||||
foreach($objs as $key => $val){ |
||||
$jsStartup[] = "localStorage.removeItem('{$key}')"; |
||||
if($val){ |
||||
$jsStartup[] = sprintf("localStorage.setItem('{$key}', '%s')", $val); |
||||
} |
||||
} |
||||
} |
||||
|
||||
?> |
||||
|
||||
<!DOCTYPE html> |
||||
<html> |
||||
|
||||
<head> |
||||
<meta http-equiv="cache-control" content="max-age=0" /> |
||||
<meta http-equiv="cache-control" content="no-cache" /> |
||||
<meta http-equiv="expires" content="0" /> |
||||
<meta http-equiv="expires" content="Tue, 01 Jan 1980 1:00:00 GMT" /> |
||||
<meta http-equiv="pragma" content="no-cache" /> |
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> |
||||
<title>Simples IP - Simples Client</title> |
||||
<link rel="icon" href="<?= $files ?>/images/favicon.ico" />
|
||||
<link rel="stylesheet" href="<?= $files ?>/css/styles.css" />
|
||||
</head> |
||||
|
||||
<body> |
||||
<div class="grid"> |
||||
<div class="top"></div> |
||||
<div class="bottom"></div> |
||||
<!-- App --> |
||||
<div class="app"> |
||||
<div class="sidebar"> |
||||
<!-- Sidebar header --> |
||||
<div class="sidebar-header"> |
||||
<div class="sidebar-name"> |
||||
<span class="sidebar-span"><span id="nameagent" style="text-transform: uppercase"></span> - <span id="myuniqueid"></span></span> |
||||
<span class="sidebar-span" id="queueagente"></span> |
||||
<span class="sidebar-span">STATUS: <span class="status-connect" id="status_agent"></span></span> |
||||
</div> |
||||
<div class="sidebar-header-icons"> |
||||
<div id="btnsPause"></div> |
||||
<img src="<?= $files ?>/images/power.svg" id="exitSystem" alt="Desconectar do Chat" title="Sair do sistema" />
|
||||
</div> |
||||
</div> |
||||
<div class="chats" id="chats"></div> |
||||
</div> |
||||
<div class="main"> |
||||
<div class="chat-window-header"> |
||||
<div class="chat-window-header-left" id="headermediaagent"> |
||||
<img class="chat-window-contact-image" src="<?= $files ?>/images/whatsapp.png" />
|
||||
<div class="contact-name-and-status-container"> |
||||
<span class="chat-window-contact-name"></span> |
||||
<span class="chat-window-contact-status">WhatsApp</span> |
||||
</div> |
||||
</div> |
||||
|
||||
<div class="chat-window-header-right" id="headerbuttonsagent"> |
||||
<div class="chat-window-header-right-commands btn-info" id="tranferagent" title="Transferir atendimento"> |
||||
<img class="chat-window-menu-icon" src="<?= $files ?>/images/redo.svg" />
|
||||
<span class="chat-window-menu-span"> Transferir</span> |
||||
</div> |
||||
|
||||
<div class="chat-window-header-right-commands btn-danger" id="finalizaratendimento" title="Finalizar atendimento"> |
||||
<img class="chat-window-menu-icon" src="<?= $files ?>/images/cross-circle.svg" />
|
||||
<span class="chat-window-menu-span"> Finalizar</span> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
|
||||
<div class="chat-window" id="chatwindowagent"> |
||||
<div class="type-window-image" id="welcometomessage"> |
||||
<h1>Bem-vindo</h1> |
||||
<h2>Seu canal de atendimento por mensagens!</h2> |
||||
<img src="<?= $files ?>/images/community_message.svg" />
|
||||
</div> |
||||
|
||||
<div class="type-message-bar-icons-upload" id="uploadfiles"> |
||||
<label for="uploadfile" class="type-message-bar-icons-upload-btn" style="cursor: pointer;" title="Anexar arquivo"> |
||||
<img src="<?= $files ?>/images/file.svg" />
|
||||
</label> |
||||
<input id="uploadfile" accept="*" type="file" multiple="" style="display: none;"> |
||||
|
||||
<label for="uploadimage" class="type-message-bar-icons-upload-btn" style="cursor: pointer;" title="Enviar uma imagem"> |
||||
<img src="<?= $files ?>/images/picture.svg">
|
||||
</label> |
||||
<input id="uploadimage" accept="image/*,video/mp4,video/3gpp,video/quicktime" type="file" multiple="" style="display: none;"> |
||||
</div> |
||||
|
||||
<div class="type-message-bar" id="typemessagebar"> |
||||
<div class="type-message-bar-left"> |
||||
<img src="<?= $files ?>/images/microphone.svg" id="voicerecorder" title="Enviar mensagem de audio" />
|
||||
<img src="<?= $files ?>/images/clip.svg" id="imgclip" title="Anexar arquivo ou imagem" />
|
||||
</div> |
||||
|
||||
<div class="type-message-bar-center"> |
||||
<textarea rows="1" type="text" id="fieldsendmessage" placeholder="Escreva uma mensagem" style="resize: none;"></textarea> |
||||
</div> |
||||
<div class="type-message-bar-right flex-center"> |
||||
<img src="<?= $files ?>/images/paper-plane.svg" title="Enviar mensagem" />
|
||||
</div> |
||||
</div> |
||||
|
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
|
||||
<div id="modalselect" class="modal"> |
||||
<div class="modal-content"> |
||||
<div class="modal-header"> |
||||
<div class="modal-header-title"></div> |
||||
<span class="close">×</span> |
||||
</div> |
||||
<div class="modal-body"> |
||||
<div class="modal-content-body"></div> |
||||
</div> |
||||
|
||||
<div class="modal-footer"> |
||||
<div class="modal-footer-content flex-1" id="footer-content-left"></div> |
||||
<div class="modal-footer-content flex-right" id="footer-content-right"></div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
|
||||
<script> |
||||
let modal = document.getElementById("modalselect"); |
||||
let span = document.getElementsByClassName("close")[0]; |
||||
|
||||
span.onclick = function() { |
||||
modal.style.display = "none"; |
||||
} |
||||
window.onclick = function(event) { |
||||
if (event.target == modal) { |
||||
modal.style.display = "none"; |
||||
} |
||||
} |
||||
</script> |
||||
<script src="<?= $files ?>/js/jquery-3.6.0.min.js"></script>
|
||||
<script src="<?= $files ?>/js/config.js"></script>
|
||||
<script src="<?= $files ?>/js/cronometro.js"></script>
|
||||
<script src="<?= $files ?>/js/requests.js"></script>
|
||||
<script src="<?= $files ?>/js/util.js"></script>
|
||||
<script src="<?= $files ?>/js/main.js"></script>
|
||||
<?php |
||||
foreach ($jsStartup as $jquery) { |
||||
echo "<script type='text/javascript'>{$jquery}</script>"; |
||||
} |
||||
?> |
||||
</body> |
||||
|
||||
</html> |
After Width: | Height: | Size: 22 KiB |
After Width: | Height: | Size: 438 B |
After Width: | Height: | Size: 12 KiB |
After Width: | Height: | Size: 9.7 KiB |
After Width: | Height: | Size: 12 KiB |
After Width: | Height: | Size: 8.0 KiB |
After Width: | Height: | Size: 8.1 KiB |
After Width: | Height: | Size: 9.3 KiB |
After Width: | Height: | Size: 11 KiB |
After Width: | Height: | Size: 8.3 KiB |
After Width: | Height: | Size: 35 KiB |
After Width: | Height: | Size: 11 KiB |
After Width: | Height: | Size: 126 KiB |
After Width: | Height: | Size: 56 KiB |
After Width: | Height: | Size: 29 KiB |
After Width: | Height: | Size: 210 KiB |
After Width: | Height: | Size: 29 KiB |
@ -0,0 +1,155 @@
|
||||
<!DOCTYPE html> |
||||
<html lang="pt-br"> |
||||
|
||||
<head> |
||||
<meta charset="UTF-8" /> |
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> |
||||
<title>Multi Channel | Simples Chat</title> |
||||
<link rel="icon" href="images/favicon.ico" /> |
||||
<link rel="stylesheet" href="../public/css/styles.css" /> |
||||
</head> |
||||
|
||||
<body> |
||||
<div class="grid"> |
||||
<!-- App background --> |
||||
<div class="top"></div> |
||||
<div class="bottom"></div> |
||||
<!-- App --> |
||||
<div class="app"> |
||||
<div class="sidebar"> |
||||
<!-- Sidebar header --> |
||||
<div class="sidebar-header"> |
||||
<div class="sidebar-name"> |
||||
<span class="sidebar-span"><span id="nameagent" style="text-transform: uppercase"></span> - <span id="myuniqueid"></span></span> |
||||
<span class="sidebar-span" id="queueagente"></span> |
||||
<span class="sidebar-span">STATUS: <span class="status-connect" id="status_agent"></span></span> |
||||
</div> |
||||
<div class="sidebar-header-icons"> |
||||
<div id="btnsPause"></div> |
||||
<img src="images/power.svg" title="Sair do sistema"/> |
||||
</div> |
||||
</div> |
||||
|
||||
|
||||
<div class="sidebar-notifications"> |
||||
<img src="images/notifications.svg" /> |
||||
<div class="sidebar-notifications-message"> |
||||
<span>Get Notified of New Messages</span> |
||||
<a href="#">Turn on desktop notifications <img src="images/gt-arrow.svg" /></a> |
||||
</div> |
||||
</div> |
||||
|
||||
|
||||
<!-- Sidebar search chat --> |
||||
|
||||
<div class="search-chat"> |
||||
<div class="search-bar"> |
||||
<img src="images/search-icon.svg" /> |
||||
<input type="text" placeholder="Search or start new chat" /> |
||||
</div> |
||||
</div> |
||||
|
||||
<!-- Chats --> |
||||
<div class="chats" id="chats"></div> |
||||
</div> |
||||
<div class="main"> |
||||
<div class="chat-window-header"> |
||||
<div class="chat-window-header-left" id="headermediaagent"> |
||||
<img class="chat-window-contact-image" src="images/whatsapp.png" /> |
||||
<div class="contact-name-and-status-container"> |
||||
<span class="chat-window-contact-name"></span> |
||||
<span class="chat-window-contact-status">WhatsApp</span> |
||||
</div> |
||||
</div> |
||||
|
||||
<div class="chat-window-header-right" id="headerbuttonsagent" > |
||||
<div class="chat-window-header-right-commands btn-info" id="tranferagent" title="Transferir atendimento"> |
||||
<img class="chat-window-menu-icon" src="images/redo.svg" /> |
||||
<span class="chat-window-menu-span"> Transferir</span> |
||||
</div> |
||||
|
||||
<div class="chat-window-header-right-commands btn-danger" id="finalizaratendimento" title="Finalizar atendimento"> |
||||
<img class="chat-window-menu-icon" src="images/cross-circle.svg" /> |
||||
<span class="chat-window-menu-span"> Finalizar</span> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
<div class="chat-window" id="chatwindowagent"> |
||||
<div class="type-window-image" id="welcometomessage"> |
||||
<h1>Bem-vindo</h1> |
||||
<h2>Seu canal de atendimento por mensagens!</h2> |
||||
<img src="images/community_message.svg" id="imgwelcome"/> |
||||
</div> |
||||
|
||||
<div class="type-message-bar-icons-upload" id="uploadfiles"> |
||||
<label for="uploadfile" class="type-message-bar-icons-upload-btn" style="cursor: pointer;"> |
||||
<img src="images/file.svg" /> |
||||
</label> |
||||
<input id="uploadfile" accept="*" type="file" |
||||
multiple="" style="display: none;"> |
||||
|
||||
<label for="uploadimage" class="type-message-bar-icons-upload-btn" style="cursor: pointer;"> |
||||
<img src="images/picture.svg"> |
||||
</label> |
||||
<input id="uploadimage" accept="image/*,video/mp4,video/3gpp,video/quicktime" type="file" multiple="" style="display: none;"> |
||||
</div> |
||||
|
||||
<div class="type-message-bar" id="typemessagebar"> |
||||
<div class="type-message-bar-left"> |
||||
<!-- <img src="images/icons.svg" /> --> |
||||
<img src="images/microphone.svg" id="voicerecorder" title="Gravar mensagem áudio" /> |
||||
<img src="images/clip.svg" id="imgclip" title="Anexar arquivos ou images"/> |
||||
</div> |
||||
|
||||
<div class="type-message-bar-center"> |
||||
<textarea rows="4" type="text" id="fieldsendmessage" placeholder="Escreva uma mensagem"></textarea> |
||||
</div> |
||||
<div class="type-message-bar-right flex-center"> |
||||
<img src="images/paper-plane.svg" title="Enviar mensagem"/> |
||||
</div> |
||||
</div> |
||||
|
||||
</div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
|
||||
<div id="modalselect" class="modal"> |
||||
<div class="modal-content"> |
||||
<div class="modal-header"> |
||||
<div class="modal-header-title"></div> |
||||
<span class="close">×</span> |
||||
</div> |
||||
<div class="modal-body"> |
||||
<div class="modal-content-body"></div> |
||||
</div> |
||||
|
||||
<div class="modal-footer"> |
||||
<div class="modal-footer-content flex-1" id="footer-content-left"></div> |
||||
<div class="modal-footer-content flex-right" id="footer-content-right"></div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
|
||||
<script> |
||||
let modal = document.getElementById("modalselect"); |
||||
let span = document.getElementsByClassName("close")[0]; |
||||
|
||||
span.onclick = function () { |
||||
modal.style.display = "none"; |
||||
} |
||||
window.onclick = function (event) { |
||||
if (event.target == modal) { |
||||
modal.style.display = "none"; |
||||
} |
||||
} |
||||
</script> |
||||
<script src="js/jquery-3.6.0.min.js"></script> |
||||
<script src="js/config.js"></script> |
||||
<script src="js/cronometro.js"></script> |
||||
<script src="js/requests.js"></script> |
||||
<script src="js/util.js"></script> |
||||
<script src="js/main.js"></script> |
||||
</body> |
||||
|
||||
</html> |
@ -0,0 +1,5 @@
|
||||
const ws = localStorage.getItem('obj_ws') |
||||
const server_api = localStorage.getItem('obj_server') |
||||
let mediaRecorder |
||||
const icontypes = ['csv', 'doc', 'pdf', 'txt', 'xls', 'zip', 'ppt'] |
||||
const path = 'public' |
@ -0,0 +1,56 @@
|
||||
let cron |
||||
let segundos = 0; |
||||
let minutos = 0; |
||||
|
||||
$(function(){ |
||||
$('#voicerecorder').on('click', function(){ |
||||
start() |
||||
}) |
||||
$('.modal-content-body').on('click', '#stoprecorder', function(){ |
||||
pause() |
||||
}) |
||||
}) |
||||
|
||||
const addZero = (time) => { |
||||
if(time < 10){ |
||||
time = "0" + time |
||||
} |
||||
return time |
||||
} |
||||
|
||||
function start() { |
||||
segundos = 0 |
||||
minutos = 0 |
||||
pause(); |
||||
cron = setInterval(() => { |
||||
timer(); |
||||
}, 1005);
|
||||
} |
||||
|
||||
function pause() { |
||||
clearInterval(cron); |
||||
} |
||||
|
||||
function timer() { |
||||
segundos++; |
||||
if (segundos == 60) { |
||||
minutos++; |
||||
segundos = 0; |
||||
} |
||||
$('#minutes').text(addZero(minutos)) |
||||
$('#seconds').text(addZero(segundos)) |
||||
} |
||||
|
||||
function converdata(timestamp, horario_server = false){ |
||||
if(horario_server){ |
||||
timestamp = timestamp * 1000 |
||||
} |
||||
|
||||
let date = new Date(timestamp); |
||||
let day = addZero(date.getDay()) |
||||
let month = addZero(date.getMonth()) |
||||
let hours = date.getHours(); |
||||
let minutes = date.getMinutes(); |
||||
let formattedTime = `${day}/${month} ` + addZero(hours) + ':' + addZero(minutes) |
||||
return formattedTime |
||||
} |
@ -0,0 +1,452 @@
|
||||
/** |
||||
* EVENTOS GERADOS PELO USUÁRIO DA APLICAÇÃO |
||||
*/ |
||||
$(function(){ |
||||
connect(ws) |
||||
notifications() |
||||
/** |
||||
* VOICE RECORDER |
||||
*/ |
||||
$('.modal-content-body').on('click', '#stoprecorder', () => { |
||||
$('#msgRecorder').text('Paramos de gravar sua voz!') |
||||
mediaRecorder.stop() |
||||
}) |
||||
|
||||
$('#voicerecorder').on('click', () => { |
||||
recorderVoice() |
||||
}) |
||||
/** FIM VOICE RECORDER */ |
||||
|
||||
/** EVENTOS DE CLICK NO BODY */ |
||||
$("body").mouseup(function(){
|
||||
$('#uploadfiles').fadeOut('slow') |
||||
}); |
||||
|
||||
/** INICIO DAS FUNCIONALIDADES */ |
||||
startSendImage() |
||||
startSendFile() |
||||
startPause() |
||||
startTransfer() |
||||
startFinalizar() |
||||
exitSystem() |
||||
|
||||
/** INICIA COM O HEADER DO CONTATO VAZIO */ |
||||
startChannelMessage() |
||||
|
||||
/** INICIA O CHAT NO FINAL DA CONVERSA */ |
||||
$('.chats').on('click', function(){ |
||||
scrollDown() |
||||
}) |
||||
|
||||
/** ENVIA AS MSG PELO ENTER */ |
||||
$('#fieldsendmessage').bind('keyup', function(ev){ |
||||
if(ev.keyCode == 13 && $(this).val().trim().length > 0){ |
||||
sendMessage() |
||||
} |
||||
}) |
||||
|
||||
$('#fieldsendmessage').on('keyup', () => { |
||||
if($(this).val().trim().length == 0){ |
||||
$(this).val('') |
||||
} |
||||
resizeSendMsg() |
||||
}) |
||||
|
||||
$('.type-message-bar-right').on('click',() => { |
||||
|
||||
sendMessage() |
||||
}) |
||||
|
||||
$('#imgclip').on('click', function(){ |
||||
modalStart() |
||||
$("#uploadimage").val('') |
||||
$('#uploadfile').val('') |
||||
if($('#uploadfiles').is(':hidden')){ |
||||
$('#uploadfiles').fadeIn('slow') |
||||
} else { |
||||
$('#uploadfiles').fadeOut('slow') |
||||
} |
||||
}) |
||||
|
||||
$('#footer-content-right').on('click', '#footersend', () => { |
||||
sendMedia(mediaRecorder) |
||||
$('#modalselect').css({display: 'none'}) |
||||
}) |
||||
supervisorAgente() |
||||
|
||||
}) |
||||
|
||||
/** |
||||
* EVENTOS DE CLICK PARA SELECIONAR A SESSÃO DE MENSAGEM/CONVERSA E RECUPERAR AS MENSAGENS JÁ TROCADAS NO ATENDIMENTO |
||||
* @param {*} id
|
||||
*/ |
||||
const selectNotification = (id) => { |
||||
marcarMensagemVista(id) |
||||
|
||||
listaMensagem(id).then(() => { |
||||
let uniqueid |
||||
let number |
||||
let name |
||||
let dataContact |
||||
let protocolo |
||||
|
||||
const dataRequest = JSON.parse(localStorage.getItem('obj_contact')) |
||||
listarAtendimentoAgente(localStorage.getItem('my_uniqueid')) |
||||
const allNotifications = JSON.parse(localStorage.getItem('obj_notification')) |
||||
|
||||
hideButtons(false) |
||||
allNotifications.data.forEach(e => { |
||||
$('#' + e.uniqueid.replace('.', `\\.`)).removeClass('select-notification') |
||||
if(e.uniqueid == id && e.status == 0){ |
||||
hideButtons(true) |
||||
} |
||||
}) |
||||
$('#' + id.replace('.', `\\.`)).addClass('select-notification') |
||||
|
||||
allNotifications.data.forEach(e => { |
||||
if(e.uniqueid == id && e.status == 0){ |
||||
hideButtons(true) |
||||
} |
||||
}) |
||||
|
||||
if(dataRequest.data.length > 0){ |
||||
dataContact = dataRequest.data.filter(e => { |
||||
if(id.trim() == e.event?.mensagem.uniqueid){ |
||||
return true |
||||
} |
||||
}) |
||||
} |
||||
|
||||
allNotifications.data.forEach(e => { |
||||
if(id === e.uniqueid){ |
||||
uniqueid = e.uniqueid |
||||
name = e.nome |
||||
number = e.cliente_id |
||||
protocolo = e.protocolo |
||||
} |
||||
}) |
||||
|
||||
localStorage.removeItem('session_window') |
||||
localStorage.removeItem('session_uniqueid') |
||||
localStorage.setItem('session_uniqueid', uniqueid) |
||||
localStorage.setItem('session_window', number) |
||||
|
||||
$('.chat-window-contact-name').text(name) |
||||
$('.chat-window-contact-status').text('Protocolo: ' + protocolo) |
||||
|
||||
/** REMOVE AS MSG NA E CONSTRIO A TELA NOVAMENTE (EVITAR DUPLICAR) */ |
||||
$('.chat-window .sender').remove() |
||||
$('.chat-window .receiver').remove() |
||||
$('.chat-window .events').remove() |
||||
alertNotification(localStorage.getItem('session_uniqueid'),'remove') |
||||
|
||||
dataContact.forEach(e => { |
||||
const datesend = e.event?.mensagem.datetime ? converdata(new Date(e.event?.mensagem.datetime).getTime()) : 'algumas horas'; |
||||
let typesend = localStorage.getItem('my_uniqueid') == e.event.contact.number ? 'sender': 'receiver' |
||||
|
||||
if(e.event?.mensagem.type == 'text'){ |
||||
$('.chat-window').append(` |
||||
<div class="${typesend}"> |
||||
<span class="${typesend}-message">${e.event.mensagem.content}</span> |
||||
<br/> |
||||
<span class="message-time">${datesend}</span> |
||||
</div>` |
||||
) |
||||
} |
||||
|
||||
if(e.event?.mensagem.type == 'finish' || e.event?.mensagem.type == 're_start'){ |
||||
$('.chat-window').append(` |
||||
<div class="events"> |
||||
<span class="events-message">${e.event.mensagem.content}</span> |
||||
</div>` |
||||
) |
||||
} |
||||
|
||||
if(e.event?.mensagem.type != 'text'){ |
||||
const sendobj = { |
||||
filename: e.event?.mensagem.file_name, |
||||
id_provedor: e.event?.mensagem.id_provedor,
|
||||
type: e.event?.mensagem.type,
|
||||
mimetype: e.event?.mensagem.mimetype,
|
||||
from: typesend |
||||
} |
||||
messageTypeMedia(sendobj) |
||||
} |
||||
|
||||
if(e.de == localStorage.getItem('my_uniqueid')){ |
||||
const datereceived = e.datetime ? converdata(e.datetime) : 'algumas horas'; |
||||
if(e.type == 'text'){ |
||||
$('.chat-window').append(` |
||||
<div class="${typesend}"> |
||||
<span class="${typesend}-message">${e.msg}</span> |
||||
<br/> |
||||
<span class="message-time">${datereceived}</span> |
||||
</div>`) |
||||
} else if (e.type == 'audio' || e.type == 'voice'){ |
||||
const audio = `<audio controls>
|
||||
<source src="data:audio/mpeg;base64,${e.msg}"></source> |
||||
</audio>` |
||||
$('.chat-window').append(` |
||||
<div class="${typesend}"> |
||||
<span class="${typesend}-message">${audio}</span> |
||||
<br/> |
||||
<span class="message-time">${datereceived}</span> |
||||
</div>`) |
||||
} else if (e.type == 'document'){ |
||||
icontypes.forEach(l => { |
||||
if(e.filename.indexOf(l) >= 0){ |
||||
$('.chat-window').append(` |
||||
<div class="${typesend}"> |
||||
<span class="${typesend}-message message-column"> |
||||
<a href="http://${server_api}/integracao/media/link/${e.uniqueid}/${window.btoa('application/' + l)}" target="_blank"> |
||||
<img src="${path}/images/icons/${l}-file.png" style="max-width: 60px"> |
||||
</a> |
||||
</span> |
||||
${e.filename} |
||||
<br/> |
||||
<span class="message-time">${datereceived}</span> |
||||
</div>`) |
||||
}
|
||||
}) |
||||
} else if (e.type == 'image'){ |
||||
const fileimg = `data:${e.mimetype};base64,` + e.msg |
||||
$('.chat-window').append(` |
||||
<div class="${typesend}"> |
||||
<span class="${typesend}-message"><img src="${fileimg}" style="max-width: 200px; max-height: 150px"></span> |
||||
<br/> |
||||
<span class="message-time">${datereceived}</span> |
||||
</div>`) |
||||
} |
||||
} |
||||
}) |
||||
scrollDown() |
||||
}) |
||||
startNotification() |
||||
} |
||||
|
||||
/** |
||||
* REALIZA O ENVIO DE MENSAGEM ATRAVEZ DA API |
||||
* @param {*} obj
|
||||
* @returns
|
||||
*/ |
||||
const sendMessage = (obj = {}) => { |
||||
const sendNumber = localStorage.getItem('session_window') |
||||
const myUniqueid = localStorage.getItem('my_uniqueid') |
||||
const agent = JSON.parse(localStorage.getItem('obj_status')) |
||||
|
||||
let sendContent = (typeof obj.fileContent === "undefined") ? $('#fieldsendmessage').val() : obj.content |
||||
let name = agent.data.nome ? agent.data.nome : 'Atendente' |
||||
let uniqueid = localStorage.getItem('session_uniqueid') |
||||
let media = obj.media ? obj.media : 'whatsapp' |
||||
let type = obj.type ? obj.type : 'text' |
||||
let mimetype = obj.mimetype ? obj.mimetype : 'text' |
||||
let filename = obj.filename ? obj.filename : Date.now() |
||||
|
||||
if(!sendContent){ |
||||
return |
||||
} |
||||
|
||||
let dataSend = { |
||||
"event": { |
||||
"type": "mensagem", |
||||
"contact": { |
||||
"name": name, |
||||
"number": myUniqueid, |
||||
"matricula": myUniqueid |
||||
}, |
||||
"mensagem": { |
||||
"uniqueid": uniqueid, |
||||
"dst": sendNumber, |
||||
"id_provedor": `${uniqueid}_${Date.now()}`, |
||||
"type": type, |
||||
"mimetype": mimetype, |
||||
"media": media, |
||||
"content": sendContent, |
||||
"status": "sended" |
||||
} |
||||
} |
||||
} |
||||
|
||||
if(type != 'audio'){ |
||||
dataSend.event.mensagem.file_name = filename |
||||
} |
||||
|
||||
enviarMensagem(dataSend) |
||||
|
||||
let msgContent = type == 'text' ? sendContent : obj.fileContent |
||||
$('.chat-window').append(` |
||||
<div class="sender"> |
||||
<span class="sender-message">${msgContent}</span> |
||||
<br/> |
||||
<span class="message-time">${converdata(Date.now())}</span> |
||||
</div>`) |
||||
scrollDown() |
||||
|
||||
/** LIMPA O CAMPO DE ENVIO DE MENSAGEM */ |
||||
$('#fieldsendmessage').val("") |
||||
} |
||||
|
||||
/** |
||||
* ATUALIZA AS MENSAGEM QUE SÃO RECEBIDAS NA TELA DO ATENDIMENTO |
||||
* @param {*} ev
|
||||
*/ |
||||
const viewMessage = (ev) => { |
||||
const sessionOpen = localStorage.getItem('session_uniqueid') |
||||
const datesend = ev.event?.mensagem.datetime ? converdata(ev.event?.mensagem.datetime, true) : 'algumas horas'; |
||||
|
||||
if(ev.event?.mensagem.uniqueid == sessionOpen){ |
||||
marcarMensagemVista(sessionOpen) |
||||
switch(ev.event?.mensagem.type){ |
||||
case 'text': |
||||
$('.chat-window').append(` |
||||
<div class="receiver"> |
||||
<span class="receiver-message">${ev.event.mensagem.content}</span> |
||||
<br/> |
||||
<span class="message-time">${datesend}</span> |
||||
</div>`) |
||||
break |
||||
case 'finish': |
||||
case 're_start': |
||||
$('.chat-window').append(` |
||||
<div class="events"> |
||||
<span class="events-message">${ev.event.mensagem.content}</span> |
||||
</div>`) |
||||
break |
||||
} |
||||
|
||||
const mediaDownload = ["image", "voice", "document", "audio", "video", "sticker"] |
||||
if(mediaDownload.indexOf(ev.event?.mensagem.type) >= 0){ |
||||
const sendobj = { |
||||
filename: ev.event?.mensagem.file_name, |
||||
id_provedor: ev.event?.mensagem.id_provedor,
|
||||
type: ev.event?.mensagem.type,
|
||||
mimetype: ev.event?.mensagem.mimetype,
|
||||
from: 'receiver' |
||||
} |
||||
messageTypeMedia(sendobj) |
||||
} |
||||
scrollDown() |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* APRESENTA AS NOVAS NOTIFICACOES DE ATENDIMENTO NA TELA DO ATENDENTE |
||||
* -> CADA ATENDIMENTO DEVE POSSUIR APENAS UMA NOTIFICACAO |
||||
* @param {*} data
|
||||
*/ |
||||
const receiveNotification = (data) => { |
||||
let validate = null |
||||
|
||||
switch(data.event?.type){ |
||||
case "mensagem": |
||||
if(data.event.mensagem.uniqueid != localStorage.getItem('session_uniqueid')){ |
||||
notifyMe(data.event.contact.name, { |
||||
body: data.event.mensagem.content, |
||||
icon: `images/${data.event.mensagem.media}.png`, |
||||
silent: true |
||||
}) |
||||
soundNotification(`${path}/sound/notification.mp3`) |
||||
} |
||||
|
||||
/** VALIDA O NUMERO, VERIFICA SE O TEM ALGMA MSG INICIAL, SE JÁ TEVE UM NUMERO NA VERIFICACAO */ |
||||
listarAtendimentoAgente(localStorage.getItem('my_uniqueid')) |
||||
validate = JSON.parse(localStorage.getItem('obj_notification')) |
||||
|
||||
const vald = validate.data.filter((e) => { |
||||
return data.event?.mensagem.uniqueid == e.uniqueid
|
||||
}) |
||||
|
||||
if(data.event?.contact.number != localStorage.getItem('session_window')){ |
||||
alertNotification(data.event.mensagem.uniqueid) |
||||
}
|
||||
|
||||
if (data.event?.mensagem.uniqueid && data.event?.contact.number && vald.length == 0) { |
||||
notifications( |
||||
{
|
||||
uniqueid: data.event?.mensagem.uniqueid, |
||||
cliente_id: data.event?.contact.number,
|
||||
context: data.event?.mensagem.media,
|
||||
profile_name: data.event?.contact.name,
|
||||
data_reg: data.event?.mensagem.datetime, |
||||
status: 1, |
||||
action: 'mensagem', |
||||
} |
||||
) |
||||
} |
||||
break |
||||
case "actions": |
||||
let obj |
||||
switch(data.event.mensagem.type){ |
||||
case 'start': |
||||
case 'transfer': |
||||
case 'att_status': |
||||
obj = {} |
||||
break |
||||
case 'finish': |
||||
case 're_start': |
||||
obj = {
|
||||
uniqueid: data.event?.mensagem.uniqueid, |
||||
action: data.event.mensagem.type, |
||||
} |
||||
break |
||||
} |
||||
notifications(obj) |
||||
break |
||||
} |
||||
} |
||||
|
||||
|
||||
/** |
||||
* MANTEM TODAS AS MENSAGENS ARMAZENADAS NO LOCALSTORAGE, SEMPRE QUE ENVIA E RECEBE SERÁ GUARDADO |
||||
* @param {*} ev
|
||||
*/ |
||||
const keepMensage = (ev) => { |
||||
let msg = JSON.parse(localStorage.getItem('keep_msg')) |
||||
if(!msg){ |
||||
msg = { data: [] } |
||||
} |
||||
|
||||
if(ev.event?.contact && ev.event?.mensagem.content){ |
||||
msg.data.push(ev) |
||||
localStorage.removeItem('keep_msg'); |
||||
localStorage.setItem('keep_msg', JSON.stringify(msg)) |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* FUNÇÃO PARA CAPTURAR O ARQUIVO A SER ENVIADO |
||||
*/ |
||||
const sendMedia = (media = null) => { |
||||
let rec |
||||
let filename |
||||
if($("#footer-content-left audio").length){ |
||||
if(media.state == 'recording'){ |
||||
media.stop(); |
||||
} |
||||
let el = $("#footer-content-left audio")[0].src |
||||
fileContent = $("#footer-content-left audio")[0].outerHTML |
||||
sendMessage({ content: el.replace("data:", "").replace(/^.+,/, ""), type: 'audio', mimetype: 'audio/mpeg', fileContent }) |
||||
return |
||||
} else if($("#uploadfile")[0].files[0]) {
|
||||
let el = $("#uploadfile")[0].files[0] |
||||
rec = new Blob([el], { type : el.type }) |
||||
let filesent = $("#myImg") |
||||
filesent[0].id = Date.now() |
||||
imgContent = filesent.css({'max-width': '60px'})[0].outerHTML |
||||
fileContent = `<a href="${URL.createObjectURL(rec)}" target="_blank">${imgContent}</a>` |
||||
filename = el.name |
||||
} else { |
||||
rec = $("#uploadimage")[0].files[0] |
||||
let filesent = $("#myImg") |
||||
filesent[0].id = Date.now() |
||||
fileContent = filesent.css({'max-width': '350px'})[0].outerHTML |
||||
$("#myImg").empty() |
||||
} |
||||
|
||||
const file = new FileReader(); |
||||
file.onload = function() { |
||||
const typefile = rec.type.split("/")[0].indexOf('image') >= 0 ? rec.type.split("/")[0] : 'document' |
||||
sendMessage({ content: file.result.replace("data:", "").replace(/^.+,/, ""), type: typefile, mimetype: rec.type, fileContent, filename }) |
||||
} |
||||
file.readAsDataURL(rec);
|
||||
} |
@ -0,0 +1,263 @@
|
||||
const enviarMensagem = (dataSend) => { |
||||
$.ajax({ |
||||
url: `${server_api}/integracao/media/api/agente/enviarMensagem`, |
||||
type: "POST", |
||||
data: JSON.stringify(dataSend), |
||||
success: function (res) { |
||||
//console.log(res)
|
||||
}, |
||||
error: function (res) { |
||||
$('.chat-window').append(`<div class="sender"><span class="sender-message">MENSAGEM NÃO FOI ENVIADA!</span></div>`) |
||||
} |
||||
}); |
||||
} |
||||
|
||||
const listaMensagem = (uniqueid) => new Promise((resolve) => { |
||||
$.ajax({ |
||||
url: `${server_api}/integracao/media/api/agente/listarMensagem`, |
||||
type: "POST", |
||||
data: JSON.stringify({ |
||||
uniqueid |
||||
}), |
||||
success: function (res) { |
||||
localStorage.removeItem('obj_contact') |
||||
localStorage.setItem('obj_contact', JSON.stringify(res)) |
||||
resolve(res) |
||||
}, |
||||
error: function (res) { |
||||
alert('Nao foi possivel carregar as listas de mensagens.') |
||||
} |
||||
}) |
||||
}) |
||||
|
||||
const listarAgentesDisponivel = () => new Promise((resolve) => { |
||||
$.ajax({ |
||||
url: `${server_api}/integracao/media/api/agente/listarAgentesDisponivel`, |
||||
type: "GET", |
||||
success: function (res) { |
||||
resolve(res) |
||||
}, |
||||
error: function (res) { |
||||
alert('Nao foi possivel carregar as listas de agentes.') |
||||
} |
||||
}); |
||||
}) |
||||
|
||||
const listarAtendimentoAgente = (matricula) => new Promise((resolve) => { |
||||
$.ajax({ |
||||
url: `${server_api}/integracao/media/api/agente/listarAtendimentoAgente`, |
||||
type: "POST", |
||||
data: JSON.stringify({ |
||||
matricula |
||||
}), |
||||
success: function (res) { |
||||
localStorage.removeItem('obj_notification') |
||||
localStorage.setItem('obj_notification', JSON.stringify(res)) |
||||
resolve(res) |
||||
}, |
||||
error: function (res) { |
||||
|
||||
} |
||||
}); |
||||
}) |
||||
|
||||
const listarPausasAgente = (matricula) => new Promise((resolve) => { |
||||
$.ajax({ |
||||
url: `${server_api}/integracao/media/api/agente/listarPausasAgente`, |
||||
type: "POST", |
||||
data: JSON.stringify({ |
||||
matricula |
||||
}), |
||||
success: function (res) { |
||||
resolve(res) |
||||
}, |
||||
error: function (res) { |
||||
alert('Nao foi possivel carregar as listas de pausa.') |
||||
} |
||||
}); |
||||
}) |
||||
|
||||
const entrarPausa = (id_pausa, matricula) => new Promise((resolve) => { |
||||
$.ajax({ |
||||
url: `${server_api}/integracao/media/api/agente/entrarPausa`, |
||||
type: "POST", |
||||
data: JSON.stringify({ |
||||
id_pausa, |
||||
matricula |
||||
}), |
||||
success: function (res) { |
||||
if (res.status == 'success') { |
||||
alert('Agente em Pausa!') |
||||
resolve(res) |
||||
} else { |
||||
alert(res.message) |
||||
} |
||||
}, |
||||
error: function (res) { |
||||
alert('Não foi possível atribuir a pausa no momento!') |
||||
} |
||||
}); |
||||
}) |
||||
|
||||
const sairPausa = (matricula) => new Promise((resolve) => { |
||||
$.ajax({ |
||||
url: `${server_api}/integracao/media/api/agente/sairPausa`, |
||||
type: "POST", |
||||
data: JSON.stringify({ |
||||
matricula |
||||
}), |
||||
success: function (res) { |
||||
alert('Pausa removida do Agente!') |
||||
resolve(res) |
||||
}, |
||||
error: function (res) { |
||||
alert('Nao foi possivel carregar as listas de pausa.') |
||||
} |
||||
}); |
||||
}) |
||||
|
||||
const entrar = (matricula, queue) => new Promise((resolve) => { |
||||
$.ajax({ |
||||
url: `${server_api}/integracao/media/api/agente/entrar`, |
||||
type: "POST", |
||||
data: JSON.stringify({ |
||||
id_fila: queue, |
||||
matricula |
||||
}), |
||||
success: function (res) { |
||||
resolve(res) |
||||
}, |
||||
error: function (res) { |
||||
resolve(res) |
||||
} |
||||
}); |
||||
}) |
||||
|
||||
const sair = (matricula) => { |
||||
$.ajax({ |
||||
url: `${server_api}/integracao/media/api/agente/sair`, |
||||
type: "POST", |
||||
data: JSON.stringify({ |
||||
matricula |
||||
}), |
||||
success: function (res) { |
||||
if (res.status == 'success') { |
||||
alert('Desconectado do sistema!') |
||||
window.close() |
||||
} else { |
||||
alert(res.message) |
||||
} |
||||
}, |
||||
error: function (res) { |
||||
alert('Nao foi possivel desconectar do sistema.') |
||||
} |
||||
}); |
||||
} |
||||
|
||||
const finalizarAtendimento = (matricula, uniqueid) => new Promise((resolve) => { |
||||
$.ajax({ |
||||
url: `${server_api}/integracao/media/api/agente/finalizarAtendimento`, |
||||
type: "POST", |
||||
data: JSON.stringify({ |
||||
matricula, |
||||
uniqueid |
||||
}), |
||||
success: function (res) { |
||||
if (res.status == "success") { |
||||
alert('Atendimento foi finalizado!') |
||||
notifications({ |
||||
matricula, |
||||
uniqueid, |
||||
action: 'finish' |
||||
}) |
||||
} |
||||
resolve(res) |
||||
}, |
||||
error: function (res) { |
||||
alertModal( |
||||
`<h4>OPS... HOUVE UM PROBLEMA  </h4><img id="imgReconnect" width="25px" src="${path}/images/alert.png">
|
||||
<p>Não foi possível finalizar atendimento!</p> |
||||
<p>Error: ${res}</p>`, |
||||
'OPS!!!' |
||||
) |
||||
} |
||||
}); |
||||
}) |
||||
|
||||
const statusAgente = (matricula) => new Promise((resolve) => { |
||||
$.ajax({ |
||||
url: `${server_api}/integracao/media/api/agente/statusAgente`, |
||||
type: "POST", |
||||
data: JSON.stringify({ |
||||
matricula |
||||
}), |
||||
success: function(res) { |
||||
localStorage.removeItem('obj_status') |
||||
localStorage.setItem('obj_status', JSON.stringify(res)) |
||||
resolve(res) |
||||
}, |
||||
error: function(res) { |
||||
console.log(res) |
||||
alertModal( |
||||
`<h4>RECONECTANDO, AGUARDE  </h4><img id="imgReconnect" width="25px" src="${path}/images/loading.gif">`, |
||||
'[ POR FAVOR AGUARDE ]' |
||||
) |
||||
console.log('statusAgente: ' + res.responseText) |
||||
} |
||||
}); |
||||
}) |
||||
|
||||
const atualizaAgente = () => new Promise((resolve) => { |
||||
$.ajax({ |
||||
url: window.location.origin + '/index.php?idProg=14&idSubProg=3&ajax=1&acao=atualiza', |
||||
type: "GET", |
||||
success: function(res){ |
||||
resolve(res) |
||||
} |
||||
}); |
||||
}) |
||||
|
||||
const transferirAtendimento = (origem, destino, uniqueid) => new Promise((resolve) => { |
||||
$.ajax({ |
||||
url: `${server_api}/integracao/media/api/agente/transferirAtendimento`, |
||||
type: "POST", |
||||
data: JSON.stringify({ |
||||
matricula_origem: origem, |
||||
matricula_destino: destino, |
||||
uniqueid
|
||||
}), |
||||
success: function (res) { |
||||
if (res.status == 'success') { |
||||
alert('Atendimento foi transferido!') |
||||
resolve(res) |
||||
} else { |
||||
alert(res.message) |
||||
} |
||||
resolve(res) |
||||
}, |
||||
error: function (res) { |
||||
alertModal( |
||||
`<h4>OPS... HOUVE UM PROBLEMA  </h4><img id="imgReconnect" width="25px" src="${path}/images/alert.png">
|
||||
<p>Não foi possível carregar as infoemacoes do agente!</p> |
||||
<p>Error: ${res}</p>`, |
||||
'OPS!!!' |
||||
) |
||||
} |
||||
}); |
||||
}) |
||||
|
||||
const marcarMensagemVista = (uniqueid) => { |
||||
$.ajax({ |
||||
url: `${server_api}/integracao/media/api/agente/marcarMensagemVista`, |
||||
type: "POST", |
||||
data: JSON.stringify({ |
||||
uniqueid |
||||
}), |
||||
success: function (res) { |
||||
//console.log('success')
|
||||
}, |
||||
error: function (res) { |
||||
alert('Nao foi possivel carregar as informacoes do agente.') |
||||
} |
||||
}); |
||||
} |
@ -0,0 +1,588 @@
|
||||
/** ROLAGEM DO SCROLL ATÉ NO FINAL DO CHAT */ |
||||
const scrollDown = () => { |
||||
$(".chat-window").animate({scrollTop: 99999 * $(this).height() }, 1);
|
||||
} |
||||
|
||||
/** LIMPA O CONTEUDO DO MODAL */ |
||||
const modalStart = () => { |
||||
$('#footer-content-left').empty() |
||||
$('#footer-content-right').empty() |
||||
$('.modal-content-body').empty() |
||||
$('.modal-header-title').empty() |
||||
} |
||||
|
||||
/** INICIA COM O HEADER DO CONTATO VAZIO */ |
||||
const startChannelMessage = () => { |
||||
$('#typemessagebar').hide() |
||||
$('#headerbuttonsagent').hide() |
||||
$("#headermediaagent").hide() |
||||
$('#chatwindowagent').css({ overflow: 'hidden' }) |
||||
$('#uploadfiles').hide() |
||||
} |
||||
|
||||
/** CARREGA OS ELEMENTOS DA SESSAO DA CONVERSA */ |
||||
const startNotification = () => { |
||||
$('#typemessagebar').show(); |
||||
$('#headerbuttonsagent').show() |
||||
$("#headermediaagent").show() |
||||
$('#welcometomessage').hide() |
||||
$('#chatwindowagent').css({ overflow: 'scroll' }) |
||||
} |
||||
|
||||
const removeMensagemBody = () => { |
||||
$('.chat-window .sender').remove() |
||||
$('.chat-window .receiver').remove() |
||||
$('.chat-window .events').remove() |
||||
} |
||||
|
||||
const hideButtons = (type) => { |
||||
if(type){ |
||||
$('#voicerecorder').css({'pointer-events': 'none'}) |
||||
$('#imgclip').css({'pointer-events': 'none'}) |
||||
$('#fieldsendmessage').css({'pointer-events': 'none'}) |
||||
$('#fieldsendmessage').hide() |
||||
$('#tranferagent').hide() |
||||
$('#finalizaratendimento').hide() |
||||
} else { |
||||
$('#voicerecorder').css({'pointer-events': 'auto'}) |
||||
$('#imgclip').css({'pointer-events': 'auto'}) |
||||
$('#fieldsendmessage').css({'pointer-events': 'auto'}) |
||||
$('#fieldsendmessage').show() |
||||
$('#tranferagent').show() |
||||
$('#finalizaratendimento').show() |
||||
} |
||||
} |
||||
|
||||
const alertModal = (title, message) => { |
||||
modalStart() |
||||
$(this).css({'align-items': 'center'}) |
||||
$('.modal-content-body').append(() =>
|
||||
title |
||||
); |
||||
$('.modal-header-title').append(`<span class="fz-14">${message}</span>`) |
||||
$('#modalselect').show() |
||||
} |
||||
|
||||
/** |
||||
* HABILITA O ENVIO DE ARQUIVO DE IMAGENS E APRESENTA UMA MODAL PARA APRESENTAÇÃO DA IMAGEM SELECIONADA |
||||
*/ |
||||
const startSendImage = () => { |
||||
modalStart() |
||||
$("#uploadimage").on('change', function(){ |
||||
const file = new FileReader(); |
||||
file.readAsDataURL(this.files[0]); |
||||
const imgName = this.files[0].name |
||||
|
||||
file.onload = function(e) { |
||||
$('#myImg').remove() |
||||
$('#footername').remove() |
||||
$('#footersend').remove() |
||||
|
||||
$('.modal-content-body').append(`<img id="myImg" src="${e.target.result}" >`) |
||||
$('#footer-content-left').append(`<label id="footername"><b>Arquivo:</b> ${imgName}</label>`) |
||||
$('#footer-content-right').append(`<a href="#" class="btn-send" id="footersend"><img src="${path}/images/enter.svg" /></a>`) |
||||
} |
||||
$('#modalselect').show() |
||||
}) |
||||
} |
||||
|
||||
/** |
||||
* HABILITA O ENVIO DE ARQUIVO DE IMAGENS E APRESENTA UMA MODAL PARA APRESENTAÇÃO DA IMAGEM SELECIONADA |
||||
*/ |
||||
const openImgModal = (link) => { |
||||
modalStart() |
||||
$('#myImg').remove() |
||||
$('.modal-content-body').append(`<a href="${link}" target="_blank"><img id="myImg" src="${link}"></a>`) |
||||
$('#modalselect').show() |
||||
} |
||||
|
||||
const resizeSendMsg = () => { |
||||
let tamField = $('#fieldsendmessage')[0].clientWidth |
||||
let qtdField = $('#fieldsendmessage').val().length |
||||
|
||||
if((qtdField * 8) >= tamField){ |
||||
$('#fieldsendmessage').attr('rows', 4) |
||||
} else { |
||||
$('#fieldsendmessage').attr('rows', 1) |
||||
} |
||||
} |
||||
|
||||
const startSendFile = () => { |
||||
modalStart() |
||||
$("#uploadfile").on('change', function(){ |
||||
const file = new FileReader(); |
||||
file.readAsDataURL(this.files[0]); |
||||
const filename = this.files[0].name |
||||
const typefile = this.files[0].name.split('.')[1] |
||||
|
||||
$('#myImg').remove() |
||||
icontypes.forEach(e => { |
||||
if(typefile.indexOf(e) >= 0){ |
||||
$('.modal-content-body').append(`<img id="myImg" src="${path}/images/icons/${e}-file.png" style="max-width: 100px">`) |
||||
return |
||||
} |
||||
}) |
||||
|
||||
if(!$('#myImg')[0]){ |
||||
$('.modal-content-body').append(`<img id="myImg" src="${path}/images/icons/notfound-file.png" style="max-width: 100px">`) |
||||
} |
||||
|
||||
file.onload = function(e) { |
||||
$('#footername').remove() |
||||
$('#footersend').remove() |
||||
$('#footer-content-left').append(`<label id="footername"><b>Arquivo:</b> ${filename}</label>`) |
||||
$('#footer-content-right').append(`<a href="#" class="btn-send" id="footersend"><img src="${path}/images/enter.svg" /></a>`) |
||||
} |
||||
$('#modalselect').show() |
||||
}) |
||||
} |
||||
|
||||
const startPause = () => { |
||||
$("#btnsPause").on('click', '#entrePause', function(){ |
||||
listarPausasAgente(localStorage.getItem('my_uniqueid')).then((pausas) => { |
||||
modalStart() |
||||
$("#modalselect").show() |
||||
$('.modal-content-body').append(() => { |
||||
let selectPause = '' |
||||
pausas.data.forEach(e => { |
||||
if(e.matricula != localStorage.getItem('my_uniqueid')){ |
||||
selectPause += `<option value="${e.id}">${e.motivo}</option>` |
||||
} |
||||
}) |
||||
if(selectPause.length > 0){ |
||||
selectPause = `<select id="selectpause">${selectPause}</select>` |
||||
} else { |
||||
selectPause = '<h3>Nenhuma pausa foi encontrado!</h3>' |
||||
} |
||||
return selectPause |
||||
}); |
||||
|
||||
$('.modal-header-title').append(`<span class="fz-14">Selecione uma Pausa:</span>`) |
||||
$('#footer-content-right').append(`<a href="#" class="btn-send" id="pausesend"><img src="${path}/images/enter.svg" /></a>`) |
||||
$('#modalselect').show() |
||||
}) |
||||
}) |
||||
|
||||
$("#btnsPause").on('click', '#exitPause', () => { |
||||
sairPausa(localStorage.getItem('my_uniqueid')).then(() => { |
||||
monitorPausaAgente() |
||||
}) |
||||
}) |
||||
|
||||
$('#footer-content-right').on('click', '#pausesend', () => { |
||||
entrarPausa($("#selectpause").val(), localStorage.getItem('my_uniqueid')).then(() => { |
||||
$('#modalselect').css({display: 'none'}) |
||||
monitorPausaAgente() |
||||
}) |
||||
}) |
||||
} |
||||
|
||||
const startTransfer = () => { |
||||
$("#tranferagent").on('click', function(){ |
||||
modalStart() |
||||
listarAgentesDisponivel().then((agentes) => { |
||||
$('.modal-content-body').append(() => { |
||||
let optAgent = null |
||||
agentes.data.forEach(e => { |
||||
if(e.matricula != localStorage.getItem('my_uniqueid')){ |
||||
optAgent += `<option value="${e.matricula}">${e.nome} - ${e.fila}</option>` |
||||
} |
||||
}) |
||||
|
||||
if(optAgent){ |
||||
return `<select id="selectranfer">${optAgent}</select>` |
||||
} |
||||
$('#transfersend').hide() |
||||
return `<h3>Nenhum agente disponível no momento!</h3>` |
||||
}); |
||||
}) |
||||
|
||||
$('.modal-header-title').append(`<span class="fz-14">Selecione um agente para transferir:</span>`) |
||||
$('#footer-content-right').append(`<a href="#" class="btn-send" id="transfersend"><img src="${path}/images/enter.svg" /></a>`) |
||||
$('#modalselect').show() |
||||
}) |
||||
|
||||
$('#footer-content-right').on('click', '#transfersend', () => { |
||||
transferirAtendimento(localStorage.getItem('my_uniqueid'), $("#selectranfer").val(), localStorage.getItem('session_uniqueid')).then((res) => { |
||||
if(res.status == 'success'){ |
||||
hideButtons(true) |
||||
notifications({ matricula: localStorage.getItem('my_uniqueid'), uniqueid: localStorage.getItem('session_uniqueid'), action: 'finish' }) |
||||
$('#modalselect').css({display: 'none'}) |
||||
} |
||||
}) |
||||
}) |
||||
} |
||||
|
||||
const exitSystem = () => { |
||||
$("#exitSystem").on('click', function(){ |
||||
if(confirm('Deseja realmente desconectar do sistema?')){ |
||||
sair(localStorage.getItem('my_uniqueid')) |
||||
} |
||||
}) |
||||
} |
||||
|
||||
|
||||
const startFinalizar = () => { |
||||
$("#finalizaratendimento").on('click', function(){ |
||||
if(confirm('Deseja realmente finalizar o atendimento?')){ |
||||
finalizarAtendimento(localStorage.getItem('my_uniqueid'), localStorage.getItem('session_uniqueid')) |
||||
} |
||||
}) |
||||
} |
||||
|
||||
/** |
||||
* FUNÇÃO PARA RECUPERAR O AUDIO DO MICROFONE |
||||
*/ |
||||
function recorderVoice () { |
||||
$('#modalselect').show() |
||||
modalStart() |
||||
$('.modal-content-body').append(`<img src="${path}/images/stop.svg" class="cursor-pointer" id="stoprecorder"/>
|
||||
<div class="modal-content-body-item"> |
||||
<div class="modal-content-body-itens"> |
||||
<span class="fz-18"><b><span id="minutes">00</span>:<span id="seconds">00</span></b></span> |
||||
</div> |
||||
<div class="modal-content-body-itens"> |
||||
<span id="msgRecorder">Estamos gravando sua linda voz ...</span> |
||||
</div> |
||||
</div>`) |
||||
|
||||
$('#footer-content-right').append(`<a href="#" class="btn-send" id="footersend"><img src="${path}/images/enter.svg" /></a>`) |
||||
|
||||
navigator.mediaDevices.getUserMedia({video: false, audio: true}).then( |
||||
stream => { |
||||
let option = { |
||||
type: 'audio/mpeg', |
||||
}; |
||||
|
||||
mediaRecorder = new MediaRecorder(stream) |
||||
let chunks = [] |
||||
|
||||
mediaRecorder.ondataavailable = (data) => { |
||||
chunks.push(data.data) |
||||
} |
||||
|
||||
mediaRecorder.onstop = () => { |
||||
const blob = new Blob(chunks, option) |
||||
const reader = new FileReader() |
||||
reader.readAsDataURL(blob) |
||||
reader.onloadend = () => { |
||||
const audio = document.createElement('audio') |
||||
audio.src = reader.result |
||||
audio.controls = true |
||||
$('#footer-content-left').append(audio) |
||||
} |
||||
} |
||||
mediaRecorder.start() |
||||
}, err => { |
||||
// add msg de error
|
||||
} |
||||
) |
||||
} |
||||
|
||||
/** |
||||
* ENVIA AS MENSAGEM DO TIPO MIDIA (RECEPTIVO) |
||||
* @param {*} id_provedor
|
||||
* @param {*} type
|
||||
* @param {*} mimetype
|
||||
* @param {*} delivery
|
||||
* @returns
|
||||
*/ |
||||
const messageTypeMedia = (obj) => { |
||||
const fileDownload = server_api + "/integracao/media/link/" + obj.id_provedor + "/" + window.btoa(obj.mimetype) |
||||
if(obj.type == 'voice' || obj.type == 'audio'){ |
||||
$('.chat-window').append(` |
||||
<div class="${obj.from}"> |
||||
<span class="${obj.from}-message"> |
||||
<audio controls><source src="${fileDownload}" type="${obj.mimetype}"></audio> |
||||
<a href="${fileDownload}"><img src="${path}/images/arrow-down.svg" class="btn-default"></a> |
||||
</span> |
||||
<br/> |
||||
<span class="message-time">${converdata(Date.now())}</span> |
||||
</div>`) |
||||
return |
||||
} |
||||
|
||||
if(obj.type == 'video'){ |
||||
$('.chat-window').append(` |
||||
<div class="${obj.from}"> |
||||
<span class="${obj.from}-message"> |
||||
<video autoplay controls> |
||||
<source src="${fileDownload}" type="${obj.mimetype}"> |
||||
</video> |
||||
</span> |
||||
<br/> |
||||
<span class="message-time">${converdata(Date.now())}</span> |
||||
</div>`) |
||||
return |
||||
} |
||||
|
||||
if(obj.type == 'document'){
|
||||
const typefile = obj.filename.split('.')[1] |
||||
let icon |
||||
if(icontypes.indexOf(typefile) >= 0){ |
||||
icon = `<img src="${path}/images/icons/${typefile}-file.png" style="max-width: 60px"></img>` |
||||
} else { |
||||
icon = `<img src="${path}/images/icons/notfound-file.png" style="max-width: 60px"></img>` |
||||
} |
||||
|
||||
$('.chat-window').append(` |
||||
<div class="${obj.from}"> |
||||
<span class="${obj.from}-message message-column"> |
||||
<a href="${fileDownload}" target="_blank"> |
||||
${icon} |
||||
</a> |
||||
</span> |
||||
<span class="fz-12">${obj.filename}</span> |
||||
<br/> |
||||
<span class="message-time">${converdata(Date.now())}</span> |
||||
</div>`) |
||||
return |
||||
} |
||||
|
||||
if(obj.type == 'image' || obj.type == 'sticker'){ |
||||
$('.chat-window').append(` |
||||
<div class="${obj.from}"> |
||||
<span class="${obj.from}-message message-column"> |
||||
<img src="${fileDownload}" style="max-width: 200px; max-height: 150px" onclick="openImgModal('${fileDownload}')" > |
||||
</span> |
||||
<span class="message-time">${converdata(Date.now())}</span> |
||||
</div>`) |
||||
return |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* data = { number, media, name, datetime } |
||||
*
|
||||
* @param {} data
|
||||
* @returns
|
||||
*/ |
||||
const buildNotification = (data = {}) => { |
||||
if(data.length == 'undefined'){ |
||||
return |
||||
} |
||||
|
||||
const datesend = converdata(data.datetime) |
||||
const status = data.status == 0 ? 'opacity-3' : '' |
||||
return `<div class="chat ${status}" id="${data.uniqueid}" onclick="selectNotification(this.id)">
|
||||
<div class="chat-left"> |
||||
<img src="${path}/images/${data.media}.png"/> |
||||
</div> |
||||
<div class="chat-right "> |
||||
<div class="chat-right-top"> |
||||
<span class="contact-name">${data.name}</span> |
||||
<span class="chat-date">${datesend}</span> |
||||
</div> |
||||
<div class="chat-right-bottom"> |
||||
<div class="chat-right-bottom-left"> |
||||
<span class="chat-message-${data.media}">${data.media}</span> |
||||
</div> |
||||
<div class="chat-right-bottom-right"></div> |
||||
</div> |
||||
</div> |
||||
</div>` |
||||
} |
||||
|
||||
const alertNotification = (uniqueid, type = 'add') => { |
||||
$('#' + uniqueid.replace('.', `\\.`) + " .chat-right-bottom-right").empty() |
||||
if(type != 'remove'){ |
||||
listaMensagem(uniqueid).then(mensagens => { |
||||
const countMsg = mensagens.data.filter(e => { |
||||
if(e.event.mensagem.status != 'read'){ |
||||
return true |
||||
} |
||||
}) |
||||
|
||||
let notf = countMsg.length |
||||
$('#' + uniqueid.replace('.', `\\.`) + " .chat-right-bottom-right").append(`<span class="unread-messages-number">${notf}</span>`) |
||||
}) |
||||
} |
||||
} |
||||
|
||||
function soundNotification(url) { |
||||
const audio = new Audio(url); |
||||
audio.play(); |
||||
} |
||||
|
||||
const notifyMe = (title, content) => { |
||||
if (!("Notification" in window)) { |
||||
console.log("This browser does not support desktop notification"); |
||||
} else if (Notification.permission === "granted") { |
||||
let notification = new Notification(title,{ |
||||
body: content.body, |
||||
icon: content.icon, |
||||
silent: true |
||||
}) |
||||
} else if (Notification.permission !== 'denied' || Notification.permission === "default") { |
||||
Notification.requestPermission(function (permission) { |
||||
if (permission === "granted") { |
||||
let notification = new Notification(title, { |
||||
body: content.body, |
||||
icon: content.icon, |
||||
silent: true |
||||
}) |
||||
} |
||||
}) |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* CRIA AS NOTIFICACOES DE TODOS OS ATENDIMENTOS NA INICIALIZACAO DO SISTEMA OU ATUALIZACAO |
||||
*/ |
||||
const notifications = (obj = {}) => { |
||||
|
||||
/** STATUS DO AGENTE */ |
||||
monitorPausaAgente() |
||||
|
||||
listarAtendimentoAgente(localStorage.getItem('my_uniqueid')).then((notification) => { |
||||
let chatList = '' |
||||
$('#chats').empty() |
||||
|
||||
if(!notification.data){ |
||||
return |
||||
} |
||||
|
||||
if(Object.values(obj).length > 0) { |
||||
if(obj.action == "mensagem"){ |
||||
notification.data.push(obj) |
||||
} else if (obj.action == "finish"){ |
||||
/** RECEBIMENTO DO SOCKET PARA ALTERAR ESTILO DO HTML */ |
||||
notification.data.forEach(el => { |
||||
if(el.uniqueid == obj.uniqueid){ |
||||
/** MARCA ATENDIMENTO COMO FINALIZADO */ |
||||
obj.action == "finish" ? el.status = 0 : null |
||||
/** REMOVE OS BOTÕES E CAIXA DE TEXTO DEPOIS DA FINALIZACAO */
|
||||
if(el.uniqueid == localStorage.getItem('session_uniqueid')){ |
||||
hideButtons(true) |
||||
} |
||||
} |
||||
}) |
||||
} |
||||
} |
||||
|
||||
notification.data.sort((a, b) => b.status - a.status) |
||||
notification.data.forEach(e => { |
||||
chatList += buildNotification({
|
||||
uniqueid: e.uniqueid,
|
||||
number: e.cliente_id,
|
||||
media: e.context,
|
||||
name: e.profile_name,
|
||||
datetime: e.data_reg,
|
||||
status: e.status, |
||||
protocolo: e.protocolo
|
||||
}) |
||||
}) |
||||
$('#chats').append(chatList) |
||||
}) |
||||
} |
||||
|
||||
const monitorPausaAgente = () => { |
||||
statusAgente(localStorage.getItem('my_uniqueid')).then((agente) => { |
||||
let statusagent = agente.data[0].status |
||||
|
||||
const status = [ |
||||
{ status: "LIVRE", class: "status-connect", html: `id="entrePause" src="${path}/images/pause.svg" title="Atribuir uma pausa"`, descricao: statusagent }, |
||||
{ status: "PAUSA", class: "status-desconnect", html: `id="exitPause" src="${path}/images/play.svg" title="Remover a pausa"`, descricao: `${statusagent} - ${agente.data[0].motivo_pausa}` }, |
||||
{ status: "OCUPADO", class: "status-reconnect", html: `id="entrePause" src="${path}/images/pause.svg" title="Atribuir uma pausa"`, descricao: statusagent }, |
||||
{ status: "INDISPONIVEL", class: "status-reconnect", html: `id="exitPause" src="${path}/images/play.svg" title="Remover a pausa"`, descricao: statusagent }, |
||||
] |
||||
|
||||
if(statusagent){ |
||||
status.forEach(el => { |
||||
if(el.status == statusagent){ |
||||
$('#status_agent').attr('class', el.class) |
||||
$('#status_agent').text(el.descricao) |
||||
$('#btnsPause').empty() |
||||
$('#btnsPause').html(`<img ${el.html} >`) |
||||
} |
||||
}) |
||||
|
||||
$('#myuniqueid').text(localStorage.getItem('my_uniqueid')) |
||||
/** CONFIGURACAO NOME */ |
||||
$('#nameagent').text(agente.data[0].nome) |
||||
/** CONFIGURACAO FILA */ |
||||
$('#queueagente').text(agente.data[0].fila) |
||||
} |
||||
}) |
||||
} |
||||
|
||||
const supervisorAgente = () => { |
||||
/** MONITORA AS CONFIGURACOES */ |
||||
setInterval(() => { |
||||
|
||||
atualizaAgente().then((res) => { |
||||
if (res.indexOf('close') >= 0) { |
||||
window.close() |
||||
} |
||||
}) |
||||
|
||||
statusAgente(localStorage.getItem('my_uniqueid')).then((agente) => { |
||||
if (agente.status == 'error' && agente.message == 'Agente não encontrado') { |
||||
window.close() |
||||
} |
||||
}) |
||||
}, 30000 ); |
||||
} |
||||
|
||||
/** CONNECT TO WS */ |
||||
const connect = (wsserver) => { |
||||
const ws = new WebSocket(wsserver); |
||||
|
||||
ws.onmessage = function(e) {}; |
||||
ws.onclose = function(e) { |
||||
setTimeout(function() { |
||||
connect(wsserver); |
||||
}, 3000); |
||||
}; |
||||
|
||||
ws.onerror = function(err) { |
||||
alertModal( |
||||
`<h4>TENTANDO RECONECTAR AO SISTEMA  </h4><img id="imgReconnect" width="25px" src="${path}/images/loading.gif">`, |
||||
'[ AGUARDE ALGUNS MINUTOS ]' |
||||
) |
||||
$("#status_agent").addClass("status-desconnect").text('DESCONECTADO'); |
||||
ws.close(); |
||||
}; |
||||
|
||||
ws.onopen = function wsconnect() { |
||||
$("#status_agent").addClass("status-reconnect").text('RECONECTANDO ...'); |
||||
|
||||
entrar(localStorage.getItem('my_uniqueid'), localStorage.getItem('obj_queue')).then((login) => { |
||||
if(login.status == 'success' || login.message.indexOf('autenticado') >= 0){ |
||||
$('#modalselect').css({display: 'none'}) |
||||
monitorPausaAgente()
|
||||
ws.send(JSON.stringify({matricula: localStorage.getItem('my_uniqueid')})); |
||||
notifications() |
||||
} else { |
||||
wsconnect() |
||||
} |
||||
}) |
||||
}; |
||||
|
||||
ws.addEventListener("open", () => { |
||||
const storage = ['my_uniqueid', 'keep_msg', 'obj_contact', 'session_uniqueid', 'session_window'] |
||||
|
||||
ws.addEventListener("message", e => { |
||||
/** att: atualizacao do websocket */ |
||||
if(e.data != 'att'){ |
||||
const data = JSON.parse(e?.data) |
||||
|
||||
if(localStorage.getItem('session_uniqueid') == null){ |
||||
localStorage.setItem('session_uniqueid', data.event.mensagem.uniqueid) |
||||
} |
||||
|
||||
if($("#welcometomessage").is(':hidden') == false){ |
||||
localStorage.setItem('session_window', null) |
||||
} |
||||
|
||||
/** ATUALIZACAO DA SESSAO CORRENTE (VALIDA PARA NAO ENVIAR PARA TELA INICIAL)*/ |
||||
if(localStorage.getItem('session_window') !== 'null'){ |
||||
viewMessage(data) |
||||
} |
||||
|
||||
/** RECEBE AS PRIMEIRAS MENSAGENS */ |
||||
receiveNotification(data) |
||||
} |
||||
}) |
||||
}) |
||||
} |
@ -0,0 +1,4 @@
|
||||
[25-May-2022 21:05:43 Europe/Berlin] PHP Fatal error: Uncaught Error: Class 'app\Providers\Crypt' not found in C:\Users\lucas.awade\Desktop\Arquivos\Projetos\WhatsApp\simples_client\index.php:9 |
||||
Stack trace: |
||||
#0 {main} |
||||
thrown in C:\Users\lucas.awade\Desktop\Arquivos\Projetos\WhatsApp\simples_client\index.php on line 9 |
@ -0,0 +1,7 @@
|
||||
<?php |
||||
|
||||
// autoload.php @generated by Composer |
||||
|
||||
require_once __DIR__ . '/composer/autoload_real.php'; |
||||
|
||||
return ComposerAutoloaderInit6ef9e3db94fd62f31f9f6db66865d14c::getLoader(); |
@ -0,0 +1,479 @@
|
||||
<?php |
||||
|
||||
/* |
||||
* This file is part of Composer. |
||||
* |
||||
* (c) Nils Adermann <naderman@naderman.de> |
||||
* Jordi Boggiano <j.boggiano@seld.be> |
||||
* |
||||
* For the full copyright and license information, please view the LICENSE |
||||
* file that was distributed with this source code. |
||||
*/ |
||||
|
||||
namespace Composer\Autoload; |
||||
|
||||
/** |
||||
* ClassLoader implements a PSR-0, PSR-4 and classmap class loader. |
||||
* |
||||
* $loader = new \Composer\Autoload\ClassLoader(); |
||||
* |
||||
* // register classes with namespaces |
||||
* $loader->add('Symfony\Component', __DIR__.'/component'); |
||||
* $loader->add('Symfony', __DIR__.'/framework'); |
||||
* |
||||
* // activate the autoloader |
||||
* $loader->register(); |
||||
* |
||||
* // to enable searching the include path (eg. for PEAR packages) |
||||
* $loader->setUseIncludePath(true); |
||||
* |
||||
* In this example, if you try to use a class in the Symfony\Component |
||||
* namespace or one of its children (Symfony\Component\Console for instance), |
||||
* the autoloader will first look for the class under the component/ |
||||
* directory, and it will then fallback to the framework/ directory if not |
||||
* found before giving up. |
||||
* |
||||
* This class is loosely based on the Symfony UniversalClassLoader. |
||||
* |
||||
* @author Fabien Potencier <fabien@symfony.com> |
||||
* @author Jordi Boggiano <j.boggiano@seld.be> |
||||
* @see https://www.php-fig.org/psr/psr-0/ |
||||
* @see https://www.php-fig.org/psr/psr-4/ |
||||
*/ |
||||
class ClassLoader |
||||
{ |
||||
private $vendorDir; |
||||
|
||||
// PSR-4 |
||||
private $prefixLengthsPsr4 = array(); |
||||
private $prefixDirsPsr4 = array(); |
||||
private $fallbackDirsPsr4 = array(); |
||||
|
||||
// PSR-0 |
||||
private $prefixesPsr0 = array(); |
||||
private $fallbackDirsPsr0 = array(); |
||||
|
||||
private $useIncludePath = false; |
||||
private $classMap = array(); |
||||
private $classMapAuthoritative = false; |
||||
private $missingClasses = array(); |
||||
private $apcuPrefix; |
||||
|
||||
private static $registeredLoaders = array(); |
||||
|
||||
public function __construct($vendorDir = null) |
||||
{ |
||||
$this->vendorDir = $vendorDir; |
||||
} |
||||
|
||||
public function getPrefixes() |
||||
{ |
||||
if (!empty($this->prefixesPsr0)) { |
||||
return call_user_func_array('array_merge', array_values($this->prefixesPsr0)); |
||||
} |
||||
|
||||
return array(); |
||||
} |
||||
|
||||
public function getPrefixesPsr4() |
||||
{ |
||||
return $this->prefixDirsPsr4; |
||||
} |
||||
|
||||
public function getFallbackDirs() |
||||
{ |
||||
return $this->fallbackDirsPsr0; |
||||
} |
||||
|
||||
public function getFallbackDirsPsr4() |
||||
{ |
||||
return $this->fallbackDirsPsr4; |
||||
} |
||||
|
||||
public function getClassMap() |
||||
{ |
||||
return $this->classMap; |
||||
} |
||||
|
||||
/** |
||||
* @param array $classMap Class to filename map |
||||
*/ |
||||
public function addClassMap(array $classMap) |
||||
{ |
||||
if ($this->classMap) { |
||||
$this->classMap = array_merge($this->classMap, $classMap); |
||||
} else { |
||||
$this->classMap = $classMap; |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* Registers a set of PSR-0 directories for a given prefix, either |
||||
* appending or prepending to the ones previously set for this prefix. |
||||
* |
||||
* @param string $prefix The prefix |
||||
* @param array|string $paths The PSR-0 root directories |
||||
* @param bool $prepend Whether to prepend the directories |
||||
*/ |
||||
public function add($prefix, $paths, $prepend = false) |
||||
{ |
||||
if (!$prefix) { |
||||
if ($prepend) { |
||||
$this->fallbackDirsPsr0 = array_merge( |
||||
(array) $paths, |
||||
$this->fallbackDirsPsr0 |
||||
); |
||||
} else { |
||||
$this->fallbackDirsPsr0 = array_merge( |
||||
$this->fallbackDirsPsr0, |
||||
(array) $paths |
||||
); |
||||
} |
||||
|
||||
return; |
||||
} |
||||
|
||||
$first = $prefix[0]; |
||||
if (!isset($this->prefixesPsr0[$first][$prefix])) { |
||||
$this->prefixesPsr0[$first][$prefix] = (array) $paths; |
||||
|
||||
return; |
||||
} |
||||
if ($prepend) { |
||||
$this->prefixesPsr0[$first][$prefix] = array_merge( |
||||
(array) $paths, |
||||
$this->prefixesPsr0[$first][$prefix] |
||||
); |
||||
} else { |
||||
$this->prefixesPsr0[$first][$prefix] = array_merge( |
||||
$this->prefixesPsr0[$first][$prefix], |
||||
(array) $paths |
||||
); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* Registers a set of PSR-4 directories for a given namespace, either |
||||
* appending or prepending to the ones previously set for this namespace. |
||||
* |
||||
* @param string $prefix The prefix/namespace, with trailing '\\' |
||||
* @param array|string $paths The PSR-4 base directories |
||||
* @param bool $prepend Whether to prepend the directories |
||||
* |
||||
* @throws \InvalidArgumentException |
||||
*/ |
||||
public function addPsr4($prefix, $paths, $prepend = false) |
||||
{ |
||||
if (!$prefix) { |
||||
// Register directories for the root namespace. |
||||
if ($prepend) { |
||||
$this->fallbackDirsPsr4 = array_merge( |
||||
(array) $paths, |
||||
$this->fallbackDirsPsr4 |
||||
); |
||||
} else { |
||||
$this->fallbackDirsPsr4 = array_merge( |
||||
$this->fallbackDirsPsr4, |
||||
(array) $paths |
||||
); |
||||
} |
||||
} elseif (!isset($this->prefixDirsPsr4[$prefix])) { |
||||
// Register directories for a new namespace. |
||||
$length = strlen($prefix); |
||||
if ('\\' !== $prefix[$length - 1]) { |
||||
throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); |
||||
} |
||||
$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; |
||||
$this->prefixDirsPsr4[$prefix] = (array) $paths; |
||||
} elseif ($prepend) { |
||||
// Prepend directories for an already registered namespace. |
||||
$this->prefixDirsPsr4[$prefix] = array_merge( |
||||
(array) $paths, |
||||
$this->prefixDirsPsr4[$prefix] |
||||
); |
||||
} else { |
||||
// Append directories for an already registered namespace. |
||||
$this->prefixDirsPsr4[$prefix] = array_merge( |
||||
$this->prefixDirsPsr4[$prefix], |
||||
(array) $paths |
||||
); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* Registers a set of PSR-0 directories for a given prefix, |
||||
* replacing any others previously set for this prefix. |
||||
* |
||||
* @param string $prefix The prefix |
||||
* @param array|string $paths The PSR-0 base directories |
||||
*/ |
||||
public function set($prefix, $paths) |
||||
{ |
||||
if (!$prefix) { |
||||
$this->fallbackDirsPsr0 = (array) $paths; |
||||
} else { |
||||
$this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths; |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* Registers a set of PSR-4 directories for a given namespace, |
||||
* replacing any others previously set for this namespace. |
||||
* |
||||
* @param string $prefix The prefix/namespace, with trailing '\\' |
||||
* @param array|string $paths The PSR-4 base directories |
||||
* |
||||
* @throws \InvalidArgumentException |
||||
*/ |
||||
public function setPsr4($prefix, $paths) |
||||
{ |
||||
if (!$prefix) { |
||||
$this->fallbackDirsPsr4 = (array) $paths; |
||||
} else { |
||||
$length = strlen($prefix); |
||||
if ('\\' !== $prefix[$length - 1]) { |
||||
throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); |
||||
} |
||||
$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; |
||||
$this->prefixDirsPsr4[$prefix] = (array) $paths; |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* Turns on searching the include path for class files. |
||||
* |
||||
* @param bool $useIncludePath |
||||
*/ |
||||
public function setUseIncludePath($useIncludePath) |
||||
{ |
||||
$this->useIncludePath = $useIncludePath; |
||||
} |
||||
|
||||
/** |
||||
* Can be used to check if the autoloader uses the include path to check |
||||
* for classes. |
||||
* |
||||
* @return bool |
||||
*/ |
||||
public function getUseIncludePath() |
||||
{ |
||||
return $this->useIncludePath; |
||||
} |
||||
|
||||
/** |
||||
* Turns off searching the prefix and fallback directories for classes |
||||
* that have not been registered with the class map. |
||||
* |
||||
* @param bool $classMapAuthoritative |
||||
*/ |
||||
public function setClassMapAuthoritative($classMapAuthoritative) |
||||
{ |
||||
$this->classMapAuthoritative = $classMapAuthoritative; |
||||
} |
||||
|
||||
/** |
||||
* Should class lookup fail if not found in the current class map? |
||||
* |
||||
* @return bool |
||||
*/ |
||||
public function isClassMapAuthoritative() |
||||
{ |
||||
return $this->classMapAuthoritative; |
||||
} |
||||
|
||||
/** |
||||
* APCu prefix to use to cache found/not-found classes, if the extension is enabled. |
||||
* |
||||
* @param string|null $apcuPrefix |
||||
*/ |
||||
public function setApcuPrefix($apcuPrefix) |
||||
{ |
||||
$this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null; |
||||
} |
||||
|
||||
/** |
||||
* The APCu prefix in use, or null if APCu caching is not enabled. |
||||
* |
||||
* @return string|null |
||||
*/ |
||||
public function getApcuPrefix() |
||||
{ |
||||
return $this->apcuPrefix; |
||||
} |
||||
|
||||
/** |
||||
* Registers this instance as an autoloader. |
||||
* |
||||
* @param bool $prepend Whether to prepend the autoloader or not |
||||
*/ |
||||
public function register($prepend = false) |
||||
{ |
||||
spl_autoload_register(array($this, 'loadClass'), true, $prepend); |
||||
|
||||
if (null === $this->vendorDir) { |
||||
return; |
||||
} |
||||
|
||||
if ($prepend) { |
||||
self::$registeredLoaders = array($this->vendorDir => $this) + self::$registeredLoaders; |
||||
} else { |
||||
unset(self::$registeredLoaders[$this->vendorDir]); |
||||
self::$registeredLoaders[$this->vendorDir] = $this; |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* Unregisters this instance as an autoloader. |
||||
*/ |
||||
public function unregister() |
||||
{ |
||||
spl_autoload_unregister(array($this, 'loadClass')); |
||||
|
||||
if (null !== $this->vendorDir) { |
||||
unset(self::$registeredLoaders[$this->vendorDir]); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* Loads the given class or interface. |
||||
* |
||||
* @param string $class The name of the class |
||||
* @return bool|null True if loaded, null otherwise |
||||
*/ |
||||
public function loadClass($class) |
||||
{ |
||||
if ($file = $this->findFile($class)) { |
||||
includeFile($file); |
||||
|
||||
return true; |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* Finds the path to the file where the class is defined. |
||||
* |
||||
* @param string $class The name of the class |
||||
* |
||||
* @return string|false The path if found, false otherwise |
||||
*/ |
||||
public function findFile($class) |
||||
{ |
||||
// class map lookup |
||||
if (isset($this->classMap[$class])) { |
||||
return $this->classMap[$class]; |
||||
} |
||||
if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) { |
||||
return false; |
||||
} |
||||
if (null !== $this->apcuPrefix) { |
||||
$file = apcu_fetch($this->apcuPrefix.$class, $hit); |
||||
if ($hit) { |
||||
return $file; |
||||
} |
||||
} |
||||
|
||||
$file = $this->findFileWithExtension($class, '.php'); |
||||
|
||||
// Search for Hack files if we are running on HHVM |
||||
if (false === $file && defined('HHVM_VERSION')) { |
||||
$file = $this->findFileWithExtension($class, '.hh'); |
||||
} |
||||
|
||||
if (null !== $this->apcuPrefix) { |
||||
apcu_add($this->apcuPrefix.$class, $file); |
||||
} |
||||
|
||||
if (false === $file) { |
||||
// Remember that this class does not exist. |
||||
$this->missingClasses[$class] = true; |
||||
} |
||||
|
||||
return $file; |
||||
} |
||||
|
||||
/** |
||||
* Returns the currently registered loaders indexed by their corresponding vendor directories. |
||||
* |
||||
* @return self[] |
||||
*/ |
||||
public static function getRegisteredLoaders() |
||||
{ |
||||
return self::$registeredLoaders; |
||||
} |
||||
|
||||
private function findFileWithExtension($class, $ext) |
||||
{ |
||||
// PSR-4 lookup |
||||
$logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext; |
||||
|
||||
$first = $class[0]; |
||||
if (isset($this->prefixLengthsPsr4[$first])) { |
||||
$subPath = $class; |
||||
while (false !== $lastPos = strrpos($subPath, '\\')) { |
||||
$subPath = substr($subPath, 0, $lastPos); |
||||
$search = $subPath . '\\'; |
||||
if (isset($this->prefixDirsPsr4[$search])) { |
||||
$pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1); |
||||
foreach ($this->prefixDirsPsr4[$search] as $dir) { |
||||
if (file_exists($file = $dir . $pathEnd)) { |
||||
return $file; |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
// PSR-4 fallback dirs |
||||
foreach ($this->fallbackDirsPsr4 as $dir) { |
||||
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) { |
||||
return $file; |
||||
} |
||||
} |
||||
|
||||
// PSR-0 lookup |
||||
if (false !== $pos = strrpos($class, '\\')) { |
||||
// namespaced class name |
||||
$logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1) |
||||
. strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR); |
||||
} else { |
||||
// PEAR-like class name |
||||
$logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext; |
||||
} |
||||
|
||||
if (isset($this->prefixesPsr0[$first])) { |
||||
foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) { |
||||
if (0 === strpos($class, $prefix)) { |
||||
foreach ($dirs as $dir) { |
||||
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { |
||||
return $file; |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
// PSR-0 fallback dirs |
||||
foreach ($this->fallbackDirsPsr0 as $dir) { |
||||
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { |
||||
return $file; |
||||
} |
||||
} |
||||
|
||||
// PSR-0 include paths. |
||||
if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) { |
||||
return $file; |
||||
} |
||||
|
||||
return false; |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* Scope isolated include. |
||||
* |
||||
* Prevents access to $this/self from included files. |
||||
*/ |
||||
function includeFile($file) |
||||
{ |
||||
include $file; |
||||
} |
@ -0,0 +1,283 @@
|
||||
<?php |
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
namespace Composer; |
||||
|
||||
use Composer\Autoload\ClassLoader; |
||||
use Composer\Semver\VersionParser; |
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
class InstalledVersions |
||||
{ |
||||
private static $installed = array ( |
||||
'root' => |
||||
array ( |
||||
'pretty_version' => '1.0.0+no-version-set', |
||||
'version' => '1.0.0.0', |
||||
'aliases' => |
||||
array ( |
||||
), |
||||
'reference' => NULL, |
||||
'name' => 'simplesip/clientwhatsapp', |
||||
), |
||||
'versions' => |
||||
array ( |
||||
'simplesip/clientwhatsapp' => |
||||
array ( |
||||
'pretty_version' => '1.0.0+no-version-set', |
||||
'version' => '1.0.0.0', |
||||
'aliases' => |
||||
array ( |
||||
), |
||||
'reference' => NULL, |
||||
), |
||||
), |
||||
); |
||||
private static $canGetVendors; |
||||
private static $installedByVendor = array(); |
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public static function getInstalledPackages() |
||||
{ |
||||
$packages = array(); |
||||
foreach (self::getInstalled() as $installed) { |
||||
$packages[] = array_keys($installed['versions']); |
||||
} |
||||
|
||||
|
||||
if (1 === \count($packages)) { |
||||
return $packages[0]; |
||||
} |
||||
|
||||
return array_keys(array_flip(\call_user_func_array('array_merge', $packages))); |
||||
} |
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public static function isInstalled($packageName) |
||||
{ |
||||
foreach (self::getInstalled() as $installed) { |
||||
if (isset($installed['versions'][$packageName])) { |
||||
return true; |
||||
} |
||||
} |
||||
|
||||
return false; |
||||
} |
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public static function satisfies(VersionParser $parser, $packageName, $constraint) |
||||
{ |
||||
$constraint = $parser->parseConstraints($constraint); |
||||
$provided = $parser->parseConstraints(self::getVersionRanges($packageName)); |
||||
|
||||
return $provided->matches($constraint); |
||||
} |
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public static function getVersionRanges($packageName) |
||||
{ |
||||
foreach (self::getInstalled() as $installed) { |
||||
if (!isset($installed['versions'][$packageName])) { |
||||
continue; |
||||
} |
||||
|
||||
$ranges = array(); |
||||
if (isset($installed['versions'][$packageName]['pretty_version'])) { |
||||
$ranges[] = $installed['versions'][$packageName]['pretty_version']; |
||||
} |
||||
if (array_key_exists('aliases', $installed['versions'][$packageName])) { |
||||
$ranges = array_merge($ranges, $installed['versions'][$packageName]['aliases']); |
||||
} |
||||
if (array_key_exists('replaced', $installed['versions'][$packageName])) { |
||||
$ranges = array_merge($ranges, $installed['versions'][$packageName]['replaced']); |
||||
} |
||||
if (array_key_exists('provided', $installed['versions'][$packageName])) { |
||||
$ranges = array_merge($ranges, $installed['versions'][$packageName]['provided']); |
||||
} |
||||
|
||||
return implode(' || ', $ranges); |
||||
} |
||||
|
||||
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); |
||||
} |
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public static function getVersion($packageName) |
||||
{ |
||||
foreach (self::getInstalled() as $installed) { |
||||
if (!isset($installed['versions'][$packageName])) { |
||||
continue; |
||||
} |
||||
|
||||
if (!isset($installed['versions'][$packageName]['version'])) { |
||||
return null; |
||||
} |
||||
|
||||
return $installed['versions'][$packageName]['version']; |
||||
} |
||||
|
||||
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); |
||||
} |
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public static function getPrettyVersion($packageName) |
||||
{ |
||||
foreach (self::getInstalled() as $installed) { |
||||
if (!isset($installed['versions'][$packageName])) { |
||||
continue; |
||||
} |
||||
|
||||
if (!isset($installed['versions'][$packageName]['pretty_version'])) { |
||||
return null; |
||||
} |
||||
|
||||
return $installed['versions'][$packageName]['pretty_version']; |
||||
} |
||||
|
||||
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); |
||||
} |
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public static function getReference($packageName) |
||||
{ |
||||
foreach (self::getInstalled() as $installed) { |
||||
if (!isset($installed['versions'][$packageName])) { |
||||
continue; |
||||
} |
||||
|
||||
if (!isset($installed['versions'][$packageName]['reference'])) { |
||||
return null; |
||||
} |
||||
|
||||
return $installed['versions'][$packageName]['reference']; |
||||
} |
||||
|
||||
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); |
||||
} |
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public static function getRootPackage() |
||||
{ |
||||
$installed = self::getInstalled(); |
||||
|
||||
return $installed[0]['root']; |
||||
} |
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public static function getRawData() |
||||
{ |
||||
return self::$installed; |
||||
} |
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public static function reload($data) |
||||
{ |
||||
self::$installed = $data; |
||||
self::$installedByVendor = array(); |
||||
} |
||||
|
||||
|
||||
|
||||
|
||||
private static function getInstalled() |
||||
{ |
||||
if (null === self::$canGetVendors) { |
||||
self::$canGetVendors = method_exists('Composer\Autoload\ClassLoader', 'getRegisteredLoaders'); |
||||
} |
||||
|
||||
$installed = array(); |
||||
|
||||
if (self::$canGetVendors) { |
||||
foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) { |
||||
if (isset(self::$installedByVendor[$vendorDir])) { |
||||
$installed[] = self::$installedByVendor[$vendorDir]; |
||||
} elseif (is_file($vendorDir.'/composer/installed.php')) { |
||||
$installed[] = self::$installedByVendor[$vendorDir] = require $vendorDir.'/composer/installed.php'; |
||||
} |
||||
} |
||||
} |
||||
|
||||
$installed[] = self::$installed; |
||||
|
||||
return $installed; |
||||
} |
||||
} |
@ -0,0 +1,21 @@
|
||||
|
||||
Copyright (c) Nils Adermann, Jordi Boggiano |
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy |
||||
of this software and associated documentation files (the "Software"), to deal |
||||
in the Software without restriction, including without limitation the rights |
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
||||
copies of the Software, and to permit persons to whom the Software is furnished |
||||
to do so, subject to the following conditions: |
||||
|
||||
The above copyright notice and this permission notice shall be included in all |
||||
copies or substantial portions of the Software. |
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
||||
THE SOFTWARE. |
||||
|
@ -0,0 +1,10 @@
|
||||
<?php |
||||
|
||||
// autoload_classmap.php @generated by Composer |
||||
|
||||
$vendorDir = dirname(dirname(__FILE__)); |
||||
$baseDir = dirname($vendorDir); |
||||
|
||||
return array( |
||||
'Composer\\InstalledVersions' => $vendorDir . '/composer/InstalledVersions.php', |
||||
); |
@ -0,0 +1,9 @@
|
||||
<?php |
||||
|
||||
// autoload_namespaces.php @generated by Composer |
||||
|
||||
$vendorDir = dirname(dirname(__FILE__)); |
||||
$baseDir = dirname($vendorDir); |
||||
|
||||
return array( |
||||
); |
@ -0,0 +1,10 @@
|
||||
<?php |
||||
|
||||
// autoload_psr4.php @generated by Composer |
||||
|
||||
$vendorDir = dirname(dirname(__FILE__)); |
||||
$baseDir = dirname($vendorDir); |
||||
|
||||
return array( |
||||
'app\\' => array($baseDir . '/app'), |
||||
); |
@ -0,0 +1,55 @@
|
||||
<?php |
||||
|
||||
// autoload_real.php @generated by Composer |
||||
|
||||
class ComposerAutoloaderInit6ef9e3db94fd62f31f9f6db66865d14c |
||||
{ |
||||
private static $loader; |
||||
|
||||
public static function loadClassLoader($class) |
||||
{ |
||||
if ('Composer\Autoload\ClassLoader' === $class) { |
||||
require __DIR__ . '/ClassLoader.php'; |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* @return \Composer\Autoload\ClassLoader |
||||
*/ |
||||
public static function getLoader() |
||||
{ |
||||
if (null !== self::$loader) { |
||||
return self::$loader; |
||||
} |
||||
|
||||
spl_autoload_register(array('ComposerAutoloaderInit6ef9e3db94fd62f31f9f6db66865d14c', 'loadClassLoader'), true, true); |
||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__))); |
||||
spl_autoload_unregister(array('ComposerAutoloaderInit6ef9e3db94fd62f31f9f6db66865d14c', 'loadClassLoader')); |
||||
|
||||
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded()); |
||||
if ($useStaticLoader) { |
||||
require __DIR__ . '/autoload_static.php'; |
||||
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInit6ef9e3db94fd62f31f9f6db66865d14c::getInitializer($loader)); |
||||
} else { |
||||
$map = require __DIR__ . '/autoload_namespaces.php'; |
||||
foreach ($map as $namespace => $path) { |
||||
$loader->set($namespace, $path); |
||||
} |
||||
|
||||
$map = require __DIR__ . '/autoload_psr4.php'; |
||||
foreach ($map as $namespace => $path) { |
||||
$loader->setPsr4($namespace, $path); |
||||
} |
||||
|
||||
$classMap = require __DIR__ . '/autoload_classmap.php'; |
||||
if ($classMap) { |
||||
$loader->addClassMap($classMap); |
||||
} |
||||
} |
||||
|
||||
$loader->register(true); |
||||
|
||||
return $loader; |
||||
} |
||||
} |
@ -0,0 +1,36 @@
|
||||
<?php |
||||
|
||||
// autoload_static.php @generated by Composer |
||||
|
||||
namespace Composer\Autoload; |
||||
|
||||
class ComposerStaticInit6ef9e3db94fd62f31f9f6db66865d14c |
||||
{ |
||||
public static $prefixLengthsPsr4 = array ( |
||||
'a' => |
||||
array ( |
||||
'app\\' => 4, |
||||
), |
||||
); |
||||
|
||||
public static $prefixDirsPsr4 = array ( |
||||
'app\\' => |
||||
array ( |
||||
0 => __DIR__ . '/../..' . '/app', |
||||
), |
||||
); |
||||
|
||||
public static $classMap = array ( |
||||
'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php', |
||||
); |
||||
|
||||
public static function getInitializer(ClassLoader $loader) |
||||
{ |
||||
return \Closure::bind(function () use ($loader) { |
||||
$loader->prefixLengthsPsr4 = ComposerStaticInit6ef9e3db94fd62f31f9f6db66865d14c::$prefixLengthsPsr4; |
||||
$loader->prefixDirsPsr4 = ComposerStaticInit6ef9e3db94fd62f31f9f6db66865d14c::$prefixDirsPsr4; |
||||
$loader->classMap = ComposerStaticInit6ef9e3db94fd62f31f9f6db66865d14c::$classMap; |
||||
|
||||
}, null, ClassLoader::class); |
||||
} |
||||
} |
@ -0,0 +1,5 @@
|
||||
{ |
||||
"packages": [], |
||||
"dev": true, |
||||
"dev-package-names": [] |
||||
} |
@ -0,0 +1,24 @@
|
||||
<?php return array ( |
||||
'root' => |
||||
array ( |
||||
'pretty_version' => '1.0.0+no-version-set', |
||||
'version' => '1.0.0.0', |
||||
'aliases' => |
||||
array ( |
||||
), |
||||
'reference' => NULL, |
||||
'name' => 'simplesip/clientwhatsapp', |
||||
), |
||||
'versions' => |
||||
array ( |
||||
'simplesip/clientwhatsapp' => |
||||
array ( |
||||
'pretty_version' => '1.0.0+no-version-set', |
||||
'version' => '1.0.0.0', |
||||
'aliases' => |
||||
array ( |
||||
), |
||||
'reference' => NULL, |
||||
), |
||||
), |
||||
); |