feat(paradiz): collect contact before manager telegram notification
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
/**
|
||||
* Plugin Name: Paradiz Web Chat
|
||||
* Description: Чат-плагин для сайта vparadize.ru, который отправляет вопросы в изолированного агента OpenClaw paradizweb.
|
||||
* Version: 1.0.6
|
||||
* Version: 1.0.7
|
||||
* Author: EVA
|
||||
*/
|
||||
|
||||
@@ -57,7 +57,7 @@ class ParadizWebChat {
|
||||
}
|
||||
|
||||
public function enqueue_assets() {
|
||||
wp_register_script('paradiz-web-chat', plugins_url('chat.js', __FILE__), [], '1.0.6', true);
|
||||
wp_register_script('paradiz-web-chat', plugins_url('chat.js', __FILE__), [], '1.0.7', true);
|
||||
wp_localize_script('paradiz-web-chat', 'ParadizWebChatCfg', [
|
||||
'ajaxUrl' => admin_url('admin-ajax.php'),
|
||||
'nonce' => wp_create_nonce('paradiz_web_chat_nonce')
|
||||
@@ -170,6 +170,7 @@ class ParadizWebChat {
|
||||
check_ajax_referer('paradiz_web_chat_nonce', 'nonce');
|
||||
|
||||
$question = isset($_POST['question']) ? sanitize_text_field($_POST['question']) : '';
|
||||
$client_id = isset($_POST['client_id']) ? sanitize_text_field($_POST['client_id']) : '';
|
||||
if (!$question) wp_send_json_error(['message' => 'Пустой вопрос']);
|
||||
|
||||
$endpoint = get_option(self::OPT_ENDPOINT, '');
|
||||
@@ -182,7 +183,7 @@ class ParadizWebChat {
|
||||
'Content-Type' => 'application/json',
|
||||
'Authorization' => 'Bearer ' . $token
|
||||
],
|
||||
'body' => wp_json_encode(['question' => $question])
|
||||
'body' => wp_json_encode(['question' => $question, 'client_id' => $client_id])
|
||||
]);
|
||||
|
||||
if (is_wp_error($resp)) {
|
||||
|
||||
Reference in New Issue
Block a user