Version Description
- Enchantment: Greetings feature
Download this release
Release Info
Developer | bhvreddy |
Plugin | Click to Chat for WhatsApp Chat |
Version | 3.9.2 |
Comparing to | |
See all releases |
Code changes from version 3.9.1 to 3.9.2
- click-to-chat.php +2 -2
- new/admin/admin_assets/js/greetings.js +3 -1
- new/admin/admin_commons/class-ht-ctc-admin-hooks.php +66 -52
- new/admin/class-ht-ctc-admin-greetings-page.php +3 -5
- new/inc/assets/js/app.js +1 -1
- new/inc/assets/js/dev/app.dev.js +14 -6
- new/inc/greetings/class-ht-ctc-chat-greetings.php +24 -25
- new/tools/woo/class-ht-ctc-woo.php +20 -4
- readme.txt +10 -5
click-to-chat.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Click to Chat
|
4 |
Plugin URI: https://wordpress.org/plugins/click-to-chat-for-whatsapp/
|
5 |
Description: Lets make your Web page visitors contact you through WhatsApp with a single click/tap
|
6 |
-
Version: 3.9.
|
7 |
Author: HoliThemes
|
8 |
Author URI: https://holithemes.com/plugins/click-to-chat/
|
9 |
License: GPL2
|
@@ -17,7 +17,7 @@ if ( ! defined( 'WPINC' ) ) {
|
|
17 |
|
18 |
// ctc - Version - update version at readme 'Stable tag'
|
19 |
if ( ! defined( 'HT_CTC_VERSION' ) ) {
|
20 |
-
define( 'HT_CTC_VERSION', '3.9.
|
21 |
}
|
22 |
|
23 |
// define HT_CTC_PLUGIN_FILE
|
3 |
Plugin Name: Click to Chat
|
4 |
Plugin URI: https://wordpress.org/plugins/click-to-chat-for-whatsapp/
|
5 |
Description: Lets make your Web page visitors contact you through WhatsApp with a single click/tap
|
6 |
+
Version: 3.9.2
|
7 |
Author: HoliThemes
|
8 |
Author URI: https://holithemes.com/plugins/click-to-chat/
|
9 |
License: GPL2
|
17 |
|
18 |
// ctc - Version - update version at readme 'Stable tag'
|
19 |
if ( ! defined( 'HT_CTC_VERSION' ) ) {
|
20 |
+
define( 'HT_CTC_VERSION', '3.9.2' );
|
21 |
}
|
22 |
|
23 |
// define HT_CTC_PLUGIN_FILE
|
new/admin/admin_assets/js/greetings.js
CHANGED
@@ -72,7 +72,9 @@
|
|
72 |
|
73 |
function tiny_bg() {
|
74 |
if (document.getElementById("header_content_ifr")) {
|
75 |
-
|
|
|
|
|
76 |
} else {
|
77 |
check++;
|
78 |
if (check < check_times) {
|
72 |
|
73 |
function tiny_bg() {
|
74 |
if (document.getElementById("header_content_ifr")) {
|
75 |
+
try {
|
76 |
+
tiny_bg_color();
|
77 |
+
} catch (e) {}
|
78 |
} else {
|
79 |
check++;
|
80 |
if (check < check_times) {
|
new/admin/admin_commons/class-ht-ctc-admin-hooks.php
CHANGED
@@ -23,7 +23,8 @@ class HT_CTC_Admin_Others {
|
|
23 |
}
|
24 |
|
25 |
function ajax() {
|
26 |
-
|
|
|
27 |
}
|
28 |
|
29 |
function admin_hooks() {
|
@@ -139,28 +140,35 @@ class HT_CTC_Admin_Others {
|
|
139 |
}
|
140 |
|
141 |
|
142 |
-
|
143 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
144 |
|
145 |
-
|
146 |
-
|
147 |
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
// $ht_ctc_plugin_details = get_option('ht_ctc_plugin_details');
|
152 |
-
// $first_install_time = (isset($ht_ctc_plugin_details['first_install_time'])) ? esc_attr($ht_ctc_plugin_details['first_install_time']) : 1;
|
153 |
|
154 |
-
|
|
|
155 |
|
156 |
-
|
157 |
-
// add_action('admin_notices', array( $this, 'pro_notice') );
|
158 |
-
// add_action('admin_footer', array( $this, 'admin_pro_notice_scripts') );
|
159 |
-
// }
|
160 |
|
161 |
-
|
|
|
|
|
|
|
162 |
|
163 |
-
|
|
|
|
|
164 |
|
165 |
// // todo -remove this.. - added here for testing..
|
166 |
// add_action('admin_notices', array( $this, 'pro_notice') );
|
@@ -198,14 +206,15 @@ class HT_CTC_Admin_Others {
|
|
198 |
|
199 |
function pro_notice() {
|
200 |
?>
|
201 |
-
<div class="notice notice-info is-dismissible ht-ctc-notice-pro-banner" data-db="pro_banner" style="display:flex; flex-direction:
|
202 |
-
<p style="margin:0; font-size:
|
203 |
-
<p style="margin:0 0 2px;">
|
204 |
-
Upgrade to Click to Chat PRO. Includes
|
205 |
</p>
|
206 |
-
<p
|
207 |
-
<a class="button button-primary" href="https://holithemes.com/plugins/click-to-chat/pricing/" target="_blank">Buy Now</a>
|
208 |
-
<
|
|
|
209 |
</p>
|
210 |
</div>
|
211 |
<?php
|
@@ -264,34 +273,39 @@ class HT_CTC_Admin_Others {
|
|
264 |
*
|
265 |
* dismise notice - $key - post data 'db' - value is time..
|
266 |
*/
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
|
|
|
|
|
|
|
|
|
|
295 |
|
296 |
|
297 |
/**
|
23 |
}
|
24 |
|
25 |
function ajax() {
|
26 |
+
|
27 |
+
add_action( 'wp_ajax_ht_ctc_admin_dismiss_notices', [$this, 'dismiss_notices'] );
|
28 |
}
|
29 |
|
30 |
function admin_hooks() {
|
140 |
}
|
141 |
|
142 |
|
143 |
+
/**
|
144 |
+
* pro notice
|
145 |
+
*
|
146 |
+
* not closed/dismissed the pro notice
|
147 |
+
* not yet installed once.
|
148 |
+
* after 1 week of first install..
|
149 |
+
*/
|
150 |
+
if ( !isset($ht_ctc_notices['pro_banner']) ) {
|
151 |
|
152 |
+
// display pro banner only if pro plugin is not yet installed once
|
153 |
+
if ( !isset($ht_ctc_pro_plugin_details['version']) ) {
|
154 |
|
155 |
+
$time = time();
|
156 |
+
// 1 week
|
157 |
+
$wait_time = (7*24*60*60);
|
|
|
|
|
158 |
|
159 |
+
$ht_ctc_plugin_details = get_option('ht_ctc_plugin_details');
|
160 |
+
$first_install_time = (isset($ht_ctc_plugin_details['first_install_time'])) ? esc_attr($ht_ctc_plugin_details['first_install_time']) : 1;
|
161 |
|
162 |
+
$diff_time = $time - $first_install_time;
|
|
|
|
|
|
|
163 |
|
164 |
+
if ( $diff_time > $wait_time ) {
|
165 |
+
add_action('admin_notices', array( $this, 'pro_notice') );
|
166 |
+
add_action('admin_footer', array( $this, 'admin_pro_notice_scripts') );
|
167 |
+
}
|
168 |
|
169 |
+
}
|
170 |
+
|
171 |
+
}
|
172 |
|
173 |
// // todo -remove this.. - added here for testing..
|
174 |
// add_action('admin_notices', array( $this, 'pro_notice') );
|
206 |
|
207 |
function pro_notice() {
|
208 |
?>
|
209 |
+
<div class="notice notice-info is-dismissible ht-ctc-notice-pro-banner" data-db="pro_banner" style="display:flex; flex-direction:column; padding:14px; background-color:#253142; border-color:#253142; color:#f7d070; border-radius:5px;">
|
210 |
+
<p style="margin:0; font-size:1.4rem; color:#1d2327; font-weight:600; color:#f7d070;">Click to Chat - PRO</p>
|
211 |
+
<p style="margin:0 0 2px; color:#f7d070; font-size:1.1rem;">
|
212 |
+
Upgrade to Click to Chat PRO. Includes features like Random Number, Form filling, Webhooks, Business hours, Display based on time range, days in a week, time dealy, scroll delay, login status
|
213 |
</p>
|
214 |
+
<p>
|
215 |
+
<a class="button button-primary" style="padding:2px 15px;" href="https://holithemes.com/plugins/click-to-chat/pricing/" target="_blank">Buy Now</a>
|
216 |
+
<br>
|
217 |
+
<a class="button-dismiss" style="text-decoration: none;" href="#">Dismiss</a>
|
218 |
</p>
|
219 |
</div>
|
220 |
<?php
|
273 |
*
|
274 |
* dismise notice - $key - post data 'db' - value is time..
|
275 |
*/
|
276 |
+
function dismiss_notices() {
|
277 |
+
|
278 |
+
check_ajax_referer('ht-ctc-notices', 'nonce');
|
279 |
+
|
280 |
+
$time = time();
|
281 |
+
|
282 |
+
$post_data = ($_POST) ? map_deep( $_POST, 'sanitize_text_field' ) : '';
|
283 |
+
$db_key = (isset($post_data['db'])) ? esc_attr( $post_data['db'] ) : '';
|
284 |
+
|
285 |
+
// update/add at db..
|
286 |
+
$values = array(
|
287 |
+
'version' => HT_CTC_VERSION,
|
288 |
+
);
|
289 |
+
$update_values = [];
|
290 |
+
$db_values = get_option( 'ht_ctc_notices', array() );
|
291 |
+
|
292 |
+
if (is_array($db_values)) {
|
293 |
+
$update_values = array_merge($values, $db_values);
|
294 |
+
}
|
295 |
+
|
296 |
+
// update to latest values
|
297 |
+
$update_values['version'] = HT_CTC_VERSION;
|
298 |
+
// add data ..
|
299 |
+
if ('' !== $db_key) {
|
300 |
+
$update_values[$db_key] = $time;
|
301 |
+
}
|
302 |
+
update_option( 'ht_ctc_notices', $update_values );
|
303 |
+
|
304 |
+
wp_send_json_success();
|
305 |
+
|
306 |
+
// this wont run
|
307 |
+
wp_die();
|
308 |
+
}
|
309 |
|
310 |
|
311 |
/**
|
new/admin/class-ht-ctc-admin-greetings-page.php
CHANGED
@@ -114,7 +114,7 @@ class HT_CTC_Admin_Greetings {
|
|
114 |
'description' => "",
|
115 |
'list_cb' => 'greetings_template',
|
116 |
'parent_class' => 'pr_greetings_template',
|
117 |
-
'description' => "<a href='https://holithemes.com/plugins/click-to-chat/greetings/' target='_blank'>Greetings</a> | <a href='https://holithemes.com/plugins/click-to-chat/greetings-1/' target='_blank'>Greetings-1</a> | <a href='https://holithemes.com/plugins/click-to-chat/greetings-2/' target='_blank'>Greetings-2</a> | <a href='https://holithemes.com/plugins/click-to-chat/greetings-form/' target='_blank'>Greetings Form </a> ",
|
118 |
],
|
119 |
[
|
120 |
'db' => 'empty',
|
@@ -135,7 +135,7 @@ class HT_CTC_Admin_Greetings {
|
|
135 |
'db' => 'main_content',
|
136 |
'template' => 'editor',
|
137 |
'label' => 'Main Content',
|
138 |
-
'description' =>
|
139 |
'parent_class' => 'pr_main_content ctc_greetings_settings ctc_g_1 ctc_g_2',
|
140 |
],
|
141 |
'bottom_content' => [
|
@@ -458,8 +458,6 @@ class HT_CTC_Admin_Greetings {
|
|
458 |
public function ht_ctc_greetings_section_cb() {
|
459 |
?>
|
460 |
<h1 id="greetings_settings">Greetings Dialog</h1>
|
461 |
-
<p class="description"> <b style="color:#42a69a;">New feature: </b> please <a target="_blank" href="https://holithemes.com/plugins/click-to-chat/support">contact us</a> for any suggestions</p>
|
462 |
-
<br>
|
463 |
<?php
|
464 |
do_action('ht_ctc_ah_admin' );
|
465 |
|
@@ -472,7 +470,7 @@ class HT_CTC_Admin_Greetings {
|
|
472 |
<div class="ctc_greetings_settings ctc_greetings_notes">
|
473 |
<p class="description"><a href="https://holithemes.com/plugins/click-to-chat/pricing/">PRO Features</a></p>
|
474 |
<p class="description"><a target="_blank" href="https://holithemes.com/plugins/click-to-chat/greetings-form/">Greetings Form</a>: Form filling before initiating the chat</p>
|
475 |
-
<p class="description"><a target="_blank" href="https://holithemes.com/plugins/click-to-chat/greetings-actions/">Actions</a>: Display/reappear based on time, scroll Actions</p>
|
476 |
</div>
|
477 |
<?php
|
478 |
}
|
114 |
'description' => "",
|
115 |
'list_cb' => 'greetings_template',
|
116 |
'parent_class' => 'pr_greetings_template',
|
117 |
+
'description' => "<a href='https://holithemes.com/plugins/click-to-chat/greetings/' target='_blank'>Greetings</a> | <a href='https://holithemes.com/plugins/click-to-chat/greetings-1/' target='_blank'>Greetings-1</a> | <a href='https://holithemes.com/plugins/click-to-chat/greetings-2/' target='_blank'>Greetings-2</a> | <a href='https://holithemes.com/plugins/click-to-chat/greetings-form/' target='_blank'>Greetings - Form Filling</a> ",
|
118 |
],
|
119 |
[
|
120 |
'db' => 'empty',
|
135 |
'db' => 'main_content',
|
136 |
'template' => 'editor',
|
137 |
'label' => 'Main Content',
|
138 |
+
'description' => "Variables: {site}, {title}, {url}",
|
139 |
'parent_class' => 'pr_main_content ctc_greetings_settings ctc_g_1 ctc_g_2',
|
140 |
],
|
141 |
'bottom_content' => [
|
458 |
public function ht_ctc_greetings_section_cb() {
|
459 |
?>
|
460 |
<h1 id="greetings_settings">Greetings Dialog</h1>
|
|
|
|
|
461 |
<?php
|
462 |
do_action('ht_ctc_ah_admin' );
|
463 |
|
470 |
<div class="ctc_greetings_settings ctc_greetings_notes">
|
471 |
<p class="description"><a href="https://holithemes.com/plugins/click-to-chat/pricing/">PRO Features</a></p>
|
472 |
<p class="description"><a target="_blank" href="https://holithemes.com/plugins/click-to-chat/greetings-form/">Greetings Form</a>: Form filling before initiating the chat</p>
|
473 |
+
<p class="description"><a target="_blank" href="https://holithemes.com/plugins/click-to-chat/greetings-actions/">Actions</a>: Display/reappear Greetings Dialog based on time, scroll Actions</p>
|
474 |
</div>
|
475 |
<?php
|
476 |
}
|
new/inc/assets/js/app.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
!function(f){f(function(){var o=window.location.href,a=void 0!==document.title?document.title:"",n=void 0!==screen.width&&1024<screen.width?"no":"yes",_="",c={};function e(t,e){c[t]=e;e=JSON.stringify(c);localStorage.setItem("ht_ctc_storage",e)}localStorage.getItem("ht_ctc_storage")&&(c=localStorage.getItem("ht_ctc_storage"),c=JSON.parse(c));var t,i="";if("undefined"!=typeof ht_ctc_chat_var)i=ht_ctc_chat_var,s(),r();else{try{document.querySelector(".ht_ctc_chat_data")&&(t=f(".ht_ctc_chat_data").attr("data-settings"),i=JSON.parse(t))}catch(t){i={}}s(),r()}function s(){var t=document.querySelector(".ht_ctc_chat_data");t&&(_=f(".ht_ctc_chat_data").attr("data-no_number"),t.remove())}function r(){var e;document.dispatchEvent(new CustomEvent("ht_ctc_event_settings",{detail:{ctc:i}})),(e=document.querySelector(".ht-ctc-chat"))&&(document.dispatchEvent(new CustomEvent("ht_ctc_event_chat")),function(t){"yes"==i.schedule?document.dispatchEvent(new CustomEvent("ht_ctc_event_display",{detail:{ctc:i,display_chat:l,ht_ctc_chat:t}})):l(t)}(e),e.addEventListener("click",function(){f(".ht_ctc_chat_greetings_box").length||
|
1 |
+
!function(f){f(function(){var o=window.location.href,a=void 0!==document.title?document.title:"",n=void 0!==screen.width&&1024<screen.width?"no":"yes",_="",c={};function e(t,e){c[t]=e;e=JSON.stringify(c);localStorage.setItem("ht_ctc_storage",e)}localStorage.getItem("ht_ctc_storage")&&(c=localStorage.getItem("ht_ctc_storage"),c=JSON.parse(c));var t,i="";if("undefined"!=typeof ht_ctc_chat_var)i=ht_ctc_chat_var,s(),r();else{try{document.querySelector(".ht_ctc_chat_data")&&(t=f(".ht_ctc_chat_data").attr("data-settings"),i=JSON.parse(t))}catch(t){i={}}s(),r()}function s(){var t=document.querySelector(".ht_ctc_chat_data");t&&(_=f(".ht_ctc_chat_data").attr("data-no_number"),t.remove())}function r(){var e;document.dispatchEvent(new CustomEvent("ht_ctc_event_settings",{detail:{ctc:i}})),(e=document.querySelector(".ht-ctc-chat"))&&(document.dispatchEvent(new CustomEvent("ht_ctc_event_chat")),function(t){"yes"==i.schedule?document.dispatchEvent(new CustomEvent("ht_ctc_event_display",{detail:{ctc:i,display_chat:l,ht_ctc_chat:t}})):l(t)}(e),e.addEventListener("click",function(){f(".ht_ctc_chat_greetings_box").length||v(e)}),f(".ht_ctc_chat_greetings_box").length&&f(document).on("click",".ht_ctc_chat_style",function(t){f(".ht_ctc_chat_greetings_box").hasClass("ctc_greetings_opened")?u("user_closed"):d("user_opened")}),f(document).on("click",".ctc_greetings_close_btn",function(t){u("user_closed")}),f(document).on("click",".ht_ctc_chat_greetings_box_link",function(t){t.preventDefault(),v(e),document.dispatchEvent(new CustomEvent("ht_ctc_event_greetings"))})),f(document).on("click",".ht-ctc-sc-chat",function(){var t=this.getAttribute("data-number"),e=(e=this.getAttribute("data-pre_filled")).replace(/\[url]/gi,o);e=encodeURIComponent(e),i.web&&"yes"!==n?window.open("https://web.whatsapp.com/send?phone="+t+"&text="+e,"_blank","noopener"):window.open("https://wa.me/"+t+"?text="+e,"_blank","noopener"),p(this),m(t)}),f(document).on("click",".ctc_chat, #ctc_chat",function(t){v(this),f(this).hasClass("ctc_woo_place")&&t.preventDefault()}),f(document).on("click",'[href="#ctc_chat"]',function(t){t.preventDefault(),v(this)})}function h(){if(f(".ht_ctc_chat_greetings_box").length){if(i.g_device){if("yes"!==n&&"mobile"==i.g_device)return void f(".ht_ctc_chat_greetings_box").remove();if("yes"==n&&"desktop"==i.g_device)return void f(".ht_ctc_chat_greetings_box").remove()}document.dispatchEvent(new CustomEvent("ht_ctc_event_after_chat_displayed",{detail:{ctc:i,greetings_open:d,greetings_close:u}})),i.g_init&&"open"==i.g_init&&"user_closed"!==(c["g_user_action"]||!1)&&d("init"),f(document).on("click",".ctc_open_greetings, #ctc_open_greetings",function(t){u("element"),d("element")})}}function d(t){f(".ctc_cta_stick").remove(),f(".ht_ctc_chat_greetings_box").show(70),f(".ht_ctc_chat_greetings_box").addClass("ctc_greetings_opened").removeClass("ctc_greetings_closed"),e("g_action",t),"user_opened"==t&&e("g_user_action",t)}function u(t){f(".ht_ctc_chat_greetings_box").hide(70),f(".ht_ctc_chat_greetings_box").addClass("ctc_greetings_closed").removeClass("ctc_greetings_opened"),e("g_action",t),"user_closed"==t&&e("g_user_action",t)}function l(t){var e;"yes"==n?"show"==i.dis_m&&((e=document.querySelector(".ht_ctc_desktop_chat"))&&e.remove(),t.style.cssText=i.pos_m+i.css,g(t)):"show"==i.dis_d&&((e=document.querySelector(".ht_ctc_mobile_chat"))&&e.remove(),t.style.cssText=i.pos_d+i.css,g(t))}function g(e){try{f(e).show(parseInt(i.se))}catch(t){e.style.display="block"}var t,c;h(),c=f(t=e).hasClass("ht_ctc_entry_animation")?1200:120,setTimeout(function(){t.classList.add("ht_ctc_animation",i.ani)},c),f(".ht-ctc-chat").hover(function(){f(".ht-ctc-chat .ht-ctc-cta-hover").show(120)},function(){f(".ht-ctc-chat .ht-ctc-cta-hover").hide(100)})}function p(t){document.dispatchEvent(new CustomEvent("ht_ctc_event_analytics"));var e=i.number;t.classList.contains("ht-ctc-sc")&&(e=t.getAttribute("data-number"));var c="Click to Chat for WhatsApp",n="chat: "+e,t=a+", "+o;(i.ga||i.ga4)&&("undefined"!=typeof gtag?i.ga4?gtag("event","click to chat",{number:e,title:a,url:o}):gtag("event",n,{event_category:c,event_label:t}):"undefined"!=typeof ga&&void 0!==ga.getAll?ga.getAll()[0].send("event",c,n,t):"undefined"!=typeof __gaTracker&&__gaTracker("send","event",c,n,t)),"undefined"!=typeof dataLayer&&dataLayer.push({event:"Click to Chat",type:"chat",number:e,title:a,url:o,event_category:c,event_label:t,event_action:n}),i.ads&&"undefined"!=typeof gtag_report_conversion&>ag_report_conversion(),i.fb&&"undefined"!=typeof fbq&&fbq("trackCustom","Click to Chat by HoliThemes",{Category:"Click to Chat for WhatsApp",return_type:"chat",ID:e,Title:a,URL:o})}function v(t){document.dispatchEvent(new CustomEvent("ht_ctc_event_number",{detail:{ctc:i}}));var e=i.number,c=i.pre_filled;t.hasAttribute("data-number")&&(e=t.getAttribute("data-number")),t.hasAttribute("data-pre_filled")&&(c=t.getAttribute("data-pre_filled")),c=c.replace(/\[url]/gi,o),c=encodeURIComponent(c),""!=e?(i.web&&"yes"!==n?window.open("https://web.whatsapp.com/send?phone="+e+"&text="+c,"_blank","noopener"):window.open("https://wa.me/"+e+"?text="+c,"_blank","noopener"),p(t),m(e)):f(".ht-ctc-chat").html(_)}function m(t){var e,c;i.hook_url&&(e=i.hook_url,c={},i.hook_v&&(c=i.hook_v),document.dispatchEvent(new CustomEvent("ht_ctc_event_hook",{detail:{ctc:i,number:t}})),e=i.hook_url,c=i.hook_v,data=JSON.stringify(c),f.ajax({url:e,type:"POST",mode:"no-cors",data:data,success:function(t){}}))}})}(jQuery);
|
new/inc/assets/js/dev/app.dev.js
CHANGED
@@ -142,9 +142,9 @@ $(function () {
|
|
142 |
$(document).on('click', '.ht_ctc_chat_style', function (e) {
|
143 |
// ctc_greetings_opened / ctc_greetings_closed
|
144 |
if ($('.ht_ctc_chat_greetings_box').hasClass('ctc_greetings_opened')) {
|
145 |
-
greetings_close();
|
146 |
} else {
|
147 |
-
greetings_open();
|
148 |
}
|
149 |
});
|
150 |
|
@@ -152,7 +152,7 @@ $(function () {
|
|
152 |
|
153 |
// close btn - greetings dialog
|
154 |
$(document).on('click', '.ctc_greetings_close_btn', function (e) {
|
155 |
-
greetings_close();
|
156 |
});
|
157 |
|
158 |
}
|
@@ -178,10 +178,18 @@ $(function () {
|
|
178 |
new CustomEvent("ht_ctc_event_after_chat_displayed", { detail: { ctc, greetings_open, greetings_close } })
|
179 |
);
|
180 |
|
181 |
-
if (ctc.g_init && 'open' == ctc.g_init && 'user_closed' !== ctc_getItem('g_user_action')
|
182 |
greetings_open('init');
|
183 |
}
|
184 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
185 |
}
|
186 |
|
187 |
}
|
@@ -190,7 +198,7 @@ $(function () {
|
|
190 |
* ht_ctc_chat_greetings_box_user_action - this is needed for initial close or open.. if user closed.. then no auto open initially
|
191 |
*
|
192 |
*/
|
193 |
-
function greetings_open(message = '
|
194 |
console.log('open');
|
195 |
$('.ctc_cta_stick').remove();
|
196 |
$('.ht_ctc_chat_greetings_box').show(70);
|
@@ -201,7 +209,7 @@ $(function () {
|
|
201 |
}
|
202 |
}
|
203 |
|
204 |
-
function greetings_close(message = '
|
205 |
console.log('close');
|
206 |
$('.ht_ctc_chat_greetings_box').hide(70);
|
207 |
$('.ht_ctc_chat_greetings_box').addClass('ctc_greetings_closed').removeClass('ctc_greetings_opened');
|
142 |
$(document).on('click', '.ht_ctc_chat_style', function (e) {
|
143 |
// ctc_greetings_opened / ctc_greetings_closed
|
144 |
if ($('.ht_ctc_chat_greetings_box').hasClass('ctc_greetings_opened')) {
|
145 |
+
greetings_close('user_closed');
|
146 |
} else {
|
147 |
+
greetings_open('user_opened');
|
148 |
}
|
149 |
});
|
150 |
|
152 |
|
153 |
// close btn - greetings dialog
|
154 |
$(document).on('click', '.ctc_greetings_close_btn', function (e) {
|
155 |
+
greetings_close('user_closed');
|
156 |
});
|
157 |
|
158 |
}
|
178 |
new CustomEvent("ht_ctc_event_after_chat_displayed", { detail: { ctc, greetings_open, greetings_close } })
|
179 |
);
|
180 |
|
181 |
+
if (ctc.g_init && 'open' == ctc.g_init && 'user_closed' !== ctc_getItem('g_user_action')) {
|
182 |
greetings_open('init');
|
183 |
}
|
184 |
|
185 |
+
|
186 |
+
$(document).on('click', '.ctc_open_greetings, #ctc_open_greetings', function (e) {
|
187 |
+
console.log('greetings open triggered');
|
188 |
+
greetings_close('element');
|
189 |
+
greetings_open('element');
|
190 |
+
});
|
191 |
+
|
192 |
+
|
193 |
}
|
194 |
|
195 |
}
|
198 |
* ht_ctc_chat_greetings_box_user_action - this is needed for initial close or open.. if user closed.. then no auto open initially
|
199 |
*
|
200 |
*/
|
201 |
+
function greetings_open(message = 'open') {
|
202 |
console.log('open');
|
203 |
$('.ctc_cta_stick').remove();
|
204 |
$('.ht_ctc_chat_greetings_box').show(70);
|
209 |
}
|
210 |
}
|
211 |
|
212 |
+
function greetings_close(message = 'close') {
|
213 |
console.log('close');
|
214 |
$('.ht_ctc_chat_greetings_box').hide(70);
|
215 |
$('.ht_ctc_chat_greetings_box').addClass('ctc_greetings_closed').removeClass('ctc_greetings_opened');
|
new/inc/greetings/class-ht-ctc-chat-greetings.php
CHANGED
@@ -28,12 +28,6 @@ class HT_CTC_Chat_Greetings {
|
|
28 |
$chat = get_option('ht_ctc_chat_options');
|
29 |
|
30 |
$ht_ctc_greetings = array();
|
31 |
-
$ht_ctc_greetings['greetings_template'] = ( isset( $greetings['greetings_template']) ) ? esc_attr( $greetings['greetings_template'] ) : '';
|
32 |
-
|
33 |
-
// return if template not set..
|
34 |
-
if ( '' == $ht_ctc_greetings['greetings_template'] ) {
|
35 |
-
return;
|
36 |
-
}
|
37 |
|
38 |
$page_id = get_the_ID();
|
39 |
// $page_id = get_queried_object_id();
|
@@ -94,13 +88,22 @@ class HT_CTC_Chat_Greetings {
|
|
94 |
$post_title = esc_html( get_the_title( $page_id ) );
|
95 |
}
|
96 |
|
97 |
-
|
98 |
-
// greetings dialog position based on chat icon/button position
|
99 |
-
$g_position_r_l = ( isset( $chat['side_2']) ) ? esc_attr( $chat['side_2'] ) : 'right';
|
100 |
-
|
101 |
// page level
|
102 |
$ht_ctc_pagelevel = get_post_meta( $page_id, 'ht_ctc_pagelevel', true );
|
103 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
104 |
$ht_ctc_greetings['header_content'] = (isset($ht_ctc_pagelevel['header_content'])) ? esc_attr($ht_ctc_pagelevel['header_content']) : '';
|
105 |
if ( '' == $ht_ctc_greetings['header_content'] ) {
|
106 |
$ht_ctc_greetings['header_content'] = ( isset( $greetings['header_content']) ) ? esc_attr($greetings['header_content']) : '';
|
@@ -149,6 +152,8 @@ class HT_CTC_Chat_Greetings {
|
|
149 |
$ht_ctc_greetings['bottom_content'] = str_replace( array('{url}', '{title}', '{site}' ), array( $page_url, $post_title, HT_CTC_BLOG_NAME ), $ht_ctc_greetings['bottom_content'] );
|
150 |
}
|
151 |
|
|
|
|
|
152 |
|
153 |
$ht_ctc_greetings['call_to_action'] = ( isset( $greetings['call_to_action']) ) ? esc_attr( $greetings['call_to_action'] ) : '';
|
154 |
if ('' == $ht_ctc_greetings['call_to_action']) {
|
@@ -160,35 +165,29 @@ class HT_CTC_Chat_Greetings {
|
|
160 |
// filter hook to update values...
|
161 |
$ht_ctc_greetings = apply_filters( 'ht_ctc_fh_greetings', $ht_ctc_greetings );
|
162 |
|
|
|
|
|
|
|
|
|
|
|
163 |
if ( is_file( $ht_ctc_greetings['path'] ) ) {
|
164 |
|
165 |
-
// $script = 'dev';
|
166 |
$script = '';
|
|
|
167 |
if('dev' == $script) {
|
168 |
?>
|
169 |
<style>
|
170 |
-
.ctc_greetings_close_btn {
|
171 |
-
display: none;
|
172 |
-
}
|
173 |
-
.ht_ctc_chat_greetings_box:hover .ctc_greetings_close_btn {
|
174 |
-
display: block;
|
175 |
-
}
|
176 |
.ht_ctc_chat_greetings_box *:not(ul):not(ol) {
|
177 |
padding: 0px; margin: 0px;
|
178 |
}
|
179 |
.ht_ctc_chat_greetings_box ul, .ht_ctc_chat_greetings_box ol {
|
180 |
margin-top: 0px; margin-bottom: 0px;
|
181 |
}
|
182 |
-
@media only screen and (max-width: 1200px) {
|
183 |
-
.ctc_greetings_close_btn {
|
184 |
-
display: block;
|
185 |
-
}
|
186 |
-
}
|
187 |
</style>
|
188 |
<?php
|
189 |
} else {
|
190 |
?>
|
191 |
-
<style>.
|
192 |
<?php
|
193 |
}
|
194 |
?>
|
@@ -197,13 +196,13 @@ class HT_CTC_Chat_Greetings {
|
|
197 |
|
198 |
<div class="ht_ctc_chat_greetings_box" style="display: none; position: absolute; bottom: 0px; <?= $g_position_r_l ?>: 0px; min-width: 300px; max-width: 400px; ">
|
199 |
|
200 |
-
<span style=" cursor:pointer; float
|
201 |
<svg style="color:#ffffff; background-color:lightgray; border-radius:50%;" xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-x" viewBox="0 0 16 16">
|
202 |
<path d="M4.646 4.646a.5.5 0 0 1 .708 0L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708L8.707 8l2.647 2.646a.5.5 0 0 1-.708.708L8 8.707l-2.646 2.647a.5.5 0 0 1-.708-.708L7.293 8 4.646 5.354a.5.5 0 0 1 0-.708z"/>
|
203 |
</svg>
|
204 |
</span>
|
205 |
<br>
|
206 |
-
<div class="ht_ctc_chat_greetings_box_layout" style="max-height: 67vh; overflow-y:auto; background-color: #ffffff; box-shadow:
|
207 |
<div class="ctc_greetings_template">
|
208 |
<?php include $ht_ctc_greetings['path']; ?>
|
209 |
</div>
|
28 |
$chat = get_option('ht_ctc_chat_options');
|
29 |
|
30 |
$ht_ctc_greetings = array();
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
|
32 |
$page_id = get_the_ID();
|
33 |
// $page_id = get_queried_object_id();
|
88 |
$post_title = esc_html( get_the_title( $page_id ) );
|
89 |
}
|
90 |
|
91 |
+
|
|
|
|
|
|
|
92 |
// page level
|
93 |
$ht_ctc_pagelevel = get_post_meta( $page_id, 'ht_ctc_pagelevel', true );
|
94 |
|
95 |
+
|
96 |
+
$ht_ctc_greetings['greetings_template'] = ( isset( $ht_ctc_pagelevel['greetings_template']) ) ? esc_attr( $ht_ctc_pagelevel['greetings_template'] ) : '';
|
97 |
+
if ( '' == $ht_ctc_greetings['greetings_template'] ) {
|
98 |
+
$ht_ctc_greetings['greetings_template'] = ( isset( $greetings['greetings_template']) ) ? esc_attr( $greetings['greetings_template'] ) : '';
|
99 |
+
}
|
100 |
+
|
101 |
+
// return if template not set..
|
102 |
+
if ( '' == $ht_ctc_greetings['greetings_template'] ) {
|
103 |
+
return;
|
104 |
+
}
|
105 |
+
|
106 |
+
|
107 |
$ht_ctc_greetings['header_content'] = (isset($ht_ctc_pagelevel['header_content'])) ? esc_attr($ht_ctc_pagelevel['header_content']) : '';
|
108 |
if ( '' == $ht_ctc_greetings['header_content'] ) {
|
109 |
$ht_ctc_greetings['header_content'] = ( isset( $greetings['header_content']) ) ? esc_attr($greetings['header_content']) : '';
|
152 |
$ht_ctc_greetings['bottom_content'] = str_replace( array('{url}', '{title}', '{site}' ), array( $page_url, $post_title, HT_CTC_BLOG_NAME ), $ht_ctc_greetings['bottom_content'] );
|
153 |
}
|
154 |
|
155 |
+
// greetings dialog position based on chat icon/button position
|
156 |
+
$g_position_r_l = ( isset( $chat['side_2']) ) ? esc_attr( $chat['side_2'] ) : 'right';
|
157 |
|
158 |
$ht_ctc_greetings['call_to_action'] = ( isset( $greetings['call_to_action']) ) ? esc_attr( $greetings['call_to_action'] ) : '';
|
159 |
if ('' == $ht_ctc_greetings['call_to_action']) {
|
165 |
// filter hook to update values...
|
166 |
$ht_ctc_greetings = apply_filters( 'ht_ctc_fh_greetings', $ht_ctc_greetings );
|
167 |
|
168 |
+
$box_shadow = '1px 1px 3px 1px rgba(0,0,0,.14)';
|
169 |
+
if ( 'greetings-2' == $ht_ctc_greetings['greetings_template'] ) {
|
170 |
+
$box_shadow = '0px 0px 5px 1px rgba(0,0,0,.14)';
|
171 |
+
}
|
172 |
+
|
173 |
if ( is_file( $ht_ctc_greetings['path'] ) ) {
|
174 |
|
|
|
175 |
$script = '';
|
176 |
+
// $script = 'dev';
|
177 |
if('dev' == $script) {
|
178 |
?>
|
179 |
<style>
|
|
|
|
|
|
|
|
|
|
|
|
|
180 |
.ht_ctc_chat_greetings_box *:not(ul):not(ol) {
|
181 |
padding: 0px; margin: 0px;
|
182 |
}
|
183 |
.ht_ctc_chat_greetings_box ul, .ht_ctc_chat_greetings_box ol {
|
184 |
margin-top: 0px; margin-bottom: 0px;
|
185 |
}
|
|
|
|
|
|
|
|
|
|
|
186 |
</style>
|
187 |
<?php
|
188 |
} else {
|
189 |
?>
|
190 |
+
<style>.ht_ctc_chat_greetings_box :not(ul):not(ol){padding:0;margin:0}.ht_ctc_chat_greetings_box ul,.ht_ctc_chat_greetings_box ol{margin-top:0;margin-bottom:0}</style>
|
191 |
<?php
|
192 |
}
|
193 |
?>
|
196 |
|
197 |
<div class="ht_ctc_chat_greetings_box" style="display: none; position: absolute; bottom: 0px; <?= $g_position_r_l ?>: 0px; min-width: 300px; max-width: 400px; ">
|
198 |
|
199 |
+
<span style=" cursor:pointer; float:<?= $g_position_r_l ?>;" class="ctc_greetings_close_btn">
|
200 |
<svg style="color:#ffffff; background-color:lightgray; border-radius:50%;" xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-x" viewBox="0 0 16 16">
|
201 |
<path d="M4.646 4.646a.5.5 0 0 1 .708 0L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708L8.707 8l2.647 2.646a.5.5 0 0 1-.708.708L8 8.707l-2.646 2.647a.5.5 0 0 1-.708-.708L7.293 8 4.646 5.354a.5.5 0 0 1 0-.708z"/>
|
202 |
</svg>
|
203 |
</span>
|
204 |
<br>
|
205 |
+
<div class="ht_ctc_chat_greetings_box_layout" style="max-height: 67vh; overflow-y:auto; background-color: #ffffff; box-shadow: <?= $box_shadow ?>; border-radius:8px;clear:both;">
|
206 |
<div class="ctc_greetings_template">
|
207 |
<?php include $ht_ctc_greetings['path']; ?>
|
208 |
</div>
|
new/tools/woo/class-ht-ctc-woo.php
CHANGED
@@ -136,10 +136,14 @@ class HT_CTC_WOO_Pages {
|
|
136 |
$class_names = "";
|
137 |
$class_names .= "ctc_chat ctc_woo_place";
|
138 |
|
|
|
|
|
139 |
// shop cart layout
|
140 |
if ('' !== $woo_shop_layout_cart_btn) {
|
141 |
-
$
|
142 |
-
|
|
|
|
|
143 |
}
|
144 |
|
145 |
$ht_ctc_woo_shop['shop_schedule'] = 'no';
|
@@ -151,6 +155,10 @@ class HT_CTC_WOO_Pages {
|
|
151 |
|
152 |
if ('yes' == $ht_ctc_woo_shop['shop_schedule']) {
|
153 |
$class_names .= " ctc_woo_schedule";
|
|
|
|
|
|
|
|
|
154 |
$css .= "display: none;";
|
155 |
} else {
|
156 |
$css .= "display: $woo_shop_block_type;";
|
@@ -242,10 +250,14 @@ class HT_CTC_WOO_Pages {
|
|
242 |
$class_names = "";
|
243 |
$class_names .= "ctc_chat ctc_woo_place";
|
244 |
|
|
|
|
|
245 |
// single - cart layout
|
246 |
if ('' !== $woo_single_layout_cart_btn) {
|
247 |
-
$
|
248 |
-
|
|
|
|
|
249 |
}
|
250 |
|
251 |
$ht_ctc_woo_single_product['single_schedule'] = 'no';
|
@@ -255,6 +267,10 @@ class HT_CTC_WOO_Pages {
|
|
255 |
|
256 |
if ('yes' == $ht_ctc_woo_single_product['single_schedule']) {
|
257 |
$class_names .= " ctc_woo_schedule";
|
|
|
|
|
|
|
|
|
258 |
$css .= "display: none;";
|
259 |
} else {
|
260 |
$css .= "display: $woo_single_block_type;";
|
136 |
$class_names = "";
|
137 |
$class_names .= "ctc_chat ctc_woo_place";
|
138 |
|
139 |
+
$display_from_js = '';
|
140 |
+
|
141 |
// shop cart layout
|
142 |
if ('' !== $woo_shop_layout_cart_btn) {
|
143 |
+
if ('1' == $ht_ctc_woo_shop['style'] || '8' == $ht_ctc_woo_shop['style'] ) {
|
144 |
+
$class_names .= " ctc_woo_shop_cart_layout";
|
145 |
+
$display_from_js = 'yes';
|
146 |
+
}
|
147 |
}
|
148 |
|
149 |
$ht_ctc_woo_shop['shop_schedule'] = 'no';
|
155 |
|
156 |
if ('yes' == $ht_ctc_woo_shop['shop_schedule']) {
|
157 |
$class_names .= " ctc_woo_schedule";
|
158 |
+
$display_from_js = 'yes';
|
159 |
+
}
|
160 |
+
|
161 |
+
if ('yes' == $display_from_js) {
|
162 |
$css .= "display: none;";
|
163 |
} else {
|
164 |
$css .= "display: $woo_shop_block_type;";
|
250 |
$class_names = "";
|
251 |
$class_names .= "ctc_chat ctc_woo_place";
|
252 |
|
253 |
+
$display_from_js = '';
|
254 |
+
|
255 |
// single - cart layout
|
256 |
if ('' !== $woo_single_layout_cart_btn) {
|
257 |
+
if ('1' == $ht_ctc_woo_single_product['style'] || '8' == $ht_ctc_woo_single_product['style'] ) {
|
258 |
+
$class_names .= " ctc_woo_single_cart_layout";
|
259 |
+
$display_from_js = 'yes';
|
260 |
+
}
|
261 |
}
|
262 |
|
263 |
$ht_ctc_woo_single_product['single_schedule'] = 'no';
|
267 |
|
268 |
if ('yes' == $ht_ctc_woo_single_product['single_schedule']) {
|
269 |
$class_names .= " ctc_woo_schedule";
|
270 |
+
$display_from_js = 'yes';
|
271 |
+
}
|
272 |
+
|
273 |
+
if ('yes' == $display_from_js) {
|
274 |
$css .= "display: none;";
|
275 |
} else {
|
276 |
$css .= "display: $woo_single_block_type;";
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Requires at least: 4.6
|
|
3 |
Tested up to: 5.9.3
|
4 |
Requires PHP: 5.6
|
5 |
Contributors: holithemes
|
6 |
-
Stable tag: 3.9.
|
7 |
Tags: whatsapp, whatsapp business, click to chat, whatsapp chat, whatsapp support, whatsapp group, whatsapp message, WhatsApp WooCommerce, whatsapp wordpress, whatsapp floating button, whatsapp icon, holithemes
|
8 |
License: GPLv2 or later
|
9 |
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
@@ -60,13 +60,15 @@ The custom design will navigate to WhatsApp based on plugin settings (WhatsApp N
|
|
60 |
|
61 |
== Greetings Dialog ==
|
62 |
|
63 |
-
Encourage user engagement by displaying the perfect
|
64 |
|
65 |
* [Greetings-1](https://holithemes.com/plugins/click-to-chat/greetings-1/): Customizable Design
|
66 |
* [Greetings-2](https://holithemes.com/plugins/click-to-chat/greetings-2/): Content Specific Design
|
67 |
-
* [Greetings-Form](https://holithemes.com/plugins/click-to-chat/greetings-form/) [pro]: Form Filling before initializing the chat
|
68 |
|
69 |
-
|
|
|
|
|
|
|
70 |
|
71 |
|
72 |
== ✳️ Position to Place ==
|
@@ -179,7 +181,7 @@ Connect other applications using Integrate, Automation tools like Zapier, IFTTT,
|
|
179 |
* {number} - WhatsApp Number for that icon/button
|
180 |
* Greetings
|
181 |
* Greetings From filling before initiating the chat
|
182 |
-
* Display/reappear based Time,
|
183 |
* Position to place
|
184 |
* Fixed: Fixed position to the screen (default, available in Free version)
|
185 |
* Absolute: Fixed position to the body content. (Moves when the user scrolls page)
|
@@ -496,6 +498,9 @@ After Activate the plugin, add WhatsApp Number at plugin settings.
|
|
496 |
|
497 |
== Changelog ==
|
498 |
|
|
|
|
|
|
|
499 |
= 3.9.1 =
|
500 |
* Enchantment: Greetings feature
|
501 |
* PRO: New - [Greetings - From filling](https://holithemes.com/plugins/click-to-chat/greetings-form/)
|
3 |
Tested up to: 5.9.3
|
4 |
Requires PHP: 5.6
|
5 |
Contributors: holithemes
|
6 |
+
Stable tag: 3.9.2
|
7 |
Tags: whatsapp, whatsapp business, click to chat, whatsapp chat, whatsapp support, whatsapp group, whatsapp message, WhatsApp WooCommerce, whatsapp wordpress, whatsapp floating button, whatsapp icon, holithemes
|
8 |
License: GPLv2 or later
|
9 |
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
60 |
|
61 |
== Greetings Dialog ==
|
62 |
|
63 |
+
Encourage user engagement by displaying the perfect message at the perfect time
|
64 |
|
65 |
* [Greetings-1](https://holithemes.com/plugins/click-to-chat/greetings-1/): Customizable Design
|
66 |
* [Greetings-2](https://holithemes.com/plugins/click-to-chat/greetings-2/): Content Specific Design
|
|
|
67 |
|
68 |
+
PRO
|
69 |
+
|
70 |
+
* [Greetings-Form](https://holithemes.com/plugins/click-to-chat/greetings-form/): Form Filling before initializing the chat
|
71 |
+
* [Actions](https://holithemes.com/plugins/click-to-chat/greetings-actions/): Display/reappear Greetings dialog based on Time, Scroll
|
72 |
|
73 |
|
74 |
== ✳️ Position to Place ==
|
181 |
* {number} - WhatsApp Number for that icon/button
|
182 |
* Greetings
|
183 |
* Greetings From filling before initiating the chat
|
184 |
+
* Display/reappear based on Time, page scroll
|
185 |
* Position to place
|
186 |
* Fixed: Fixed position to the screen (default, available in Free version)
|
187 |
* Absolute: Fixed position to the body content. (Moves when the user scrolls page)
|
498 |
|
499 |
== Changelog ==
|
500 |
|
501 |
+
= 3.9.2 =
|
502 |
+
* Enchantment: Greetings feature
|
503 |
+
|
504 |
= 3.9.1 =
|
505 |
* Enchantment: Greetings feature
|
506 |
* PRO: New - [Greetings - From filling](https://holithemes.com/plugins/click-to-chat/greetings-form/)
|