Click to Chat for WhatsApp Chat - Version 3.18

Version Description

  • Enchantment: Greetings Actions
    • Add class name 'ctc_greetings' or 'ctc_greetings_now' to any element to display greetings dialog on click.
    • PRO: Add class name 'ctc_greetings_now' to any element to display greetings dialog when element reached viewport.
Download this release

Release Info

Developer bhvreddy
Plugin Icon 128x128 Click to Chat for WhatsApp Chat
Version 3.18
Comparing to
See all releases

Code changes from version 3.17.1 to 3.18

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.17.1
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.17.1' );
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.18
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.18' );
21
  }
22
 
23
  // define HT_CTC_PLUGIN_FILE
new/admin/class-ht-ctc-admin-greetings-page.php CHANGED
@@ -155,7 +155,7 @@ class HT_CTC_Admin_Greetings {
155
  'db' => 'bottom_content',
156
  'template' => 'editor',
157
  'label' => 'Bottom Content',
158
- 'description' => '',
159
  'parent_style' => "margin-bottom: 30px;",
160
  'parent_class' => 'pr_bottom_content ctc_greetings_settings ctc_g_1 ctc_g_2 ctc_wp_editor',
161
  ],
155
  'db' => 'bottom_content',
156
  'template' => 'editor',
157
  'label' => 'Bottom Content',
158
+ 'description' => "&#128994; <a href='https://holithemes.com/plugins/click-to-chat/symbols/' target='_blank'>Symbols</a>",
159
  'parent_style' => "margin-bottom: 30px;",
160
  'parent_class' => 'pr_bottom_content ctc_greetings_settings ctc_g_1 ctc_g_2 ctc_wp_editor',
161
  ],
new/admin/class-ht-ctc-admin-other-settings.php CHANGED
@@ -476,10 +476,6 @@ class HT_CTC_Admin_Other_Settings {
476
  do_action('ht_ctc_ah_admin_start_os');
477
 
478
  $li_active_gr_sh = ( isset( $options['enable_group'] ) || isset( $options['enable_share'] ) ) ? "class='active'" : '';
479
- ?>
480
-
481
- <p class="description"><?php _e( 'All this below settings are not important to everyone', 'click-to-chat-for-whatsapp' ); ?></p>
482
- <?php
483
 
484
  // url strucutre
485
  $url_target_d = ( isset( $options['url_target_d']) ) ? esc_attr( $options['url_target_d'] ) :'_blank';
@@ -597,6 +593,7 @@ class HT_CTC_Admin_Other_Settings {
597
  </ul>
598
  <br>
599
 
 
600
  <ul class="collapsible ht_ctc_other_settings" data-collapsible="accordion" id="ht_ctc_othersettings">
601
  <li class="">
602
  <div class="collapsible-header"><?php _e( 'z-index, Aria', 'click-to-chat-for-whatsapp' ); ?></div>
476
  do_action('ht_ctc_ah_admin_start_os');
477
 
478
  $li_active_gr_sh = ( isset( $options['enable_group'] ) || isset( $options['enable_share'] ) ) ? "class='active'" : '';
 
 
 
 
479
 
480
  // url strucutre
481
  $url_target_d = ( isset( $options['url_target_d']) ) ? esc_attr( $options['url_target_d'] ) :'_blank';
593
  </ul>
594
  <br>
595
 
596
+ <p class="description"><?php _e( 'All these below settings are not important to everyone', 'click-to-chat-for-whatsapp' ); ?></p>
597
  <ul class="collapsible ht_ctc_other_settings" data-collapsible="accordion" id="ht_ctc_othersettings">
598
  <li class="">
599
  <div class="collapsible-header"><?php _e( 'z-index, Aria', 'click-to-chat-for-whatsapp' ); ?></div>
new/admin/db/class-ht-ctc-db2.php CHANGED
@@ -379,7 +379,13 @@ class HT_CTC_DB2 {
379
  $db_values = get_option( 'ht_ctc_s4', array() );
380
  $db_values = (is_array( $db_values)) ? $db_values : [];
381
 
 
 
 
382
  $update_values = array_merge($style_4, $db_values);
 
 
 
383
  update_option('ht_ctc_s4', $update_values);
384
 
385
  }
379
  $db_values = get_option( 'ht_ctc_s4', array() );
380
  $db_values = (is_array( $db_values)) ? $db_values : [];
381
 
382
+ // this is better solution. possible add in later versions
383
+ // $update_values = (is_array( $db_values)) ? array_merge($style_4, $db_values) : $style_4;
384
+
385
  $update_values = array_merge($style_4, $db_values);
386
+
387
+
388
+
389
  update_option('ht_ctc_s4', $update_values);
390
 
391
  }
new/admin/db/defaults/class-ht-ctc-defaults-greetings.php CHANGED
@@ -33,7 +33,7 @@ class HT_CTC_Defaults_Greetings {
33
  'greetings_template' => 'no',
34
  'header_content' => '<span style="color: #ffffff;">{site}</span>',
35
  'main_content' => 'Any questions related to {title}?',
36
- 'bottom_content' => '<p style="text-align: center;"><span style="font-size: 12px;">🟢 we are online | privacy policy</span></p>',
37
  'call_to_action' => 'WhatsApp Us',
38
  'g_device' => 'all',
39
  'g_init' => 'open',
33
  'greetings_template' => 'no',
34
  'header_content' => '<span style="color: #ffffff;">{site}</span>',
35
  'main_content' => 'Any questions related to {title}?',
36
+ 'bottom_content' => '<p style="text-align: center;"><span style="font-size: 12px;">&#128994; Online | Privacy policy</span></p>',
37
  'call_to_action' => 'WhatsApp Us',
38
  'g_device' => 'all',
39
  'g_init' => 'open',
new/inc/assets/js/app.js CHANGED
@@ -1 +1 @@
1
- !function(f){f(function(){var a=window.location.href,o=void 0!==document.title?document.title:"",_=void 0!==screen.width&&1024<screen.width?"no":"yes",s="",c={};function n(t){return c[t]||!1}function i(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,r="";if("undefined"!=typeof ht_ctc_chat_var)r=ht_ctc_chat_var,e(),h();else{try{document.querySelector(".ht_ctc_chat_data")&&(t=f(".ht_ctc_chat_data").attr("data-settings"),r=JSON.parse(t))}catch(t){r={}}e(),h()}function e(){var t=document.querySelector(".ht_ctc_chat_data");t&&(s=f(".ht_ctc_chat_data").attr("data-no_number"),t.remove())}function h(){var e;document.dispatchEvent(new CustomEvent("ht_ctc_event_settings",{detail:{ctc:r}})),(e=document.querySelector(".ht-ctc-chat"))&&(document.dispatchEvent(new CustomEvent("ht_ctc_event_chat")),function(t){"yes"==r.schedule?document.dispatchEvent(new CustomEvent("ht_ctc_event_display",{detail:{ctc:r,display_chat:l,ht_ctc_chat:t}})):l(t)}(e),e.addEventListener("click",function(){f(".ht_ctc_chat_greetings_box").length||p(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")?d("user_closed"):u("user_opened")}),f(document).on("click",".ctc_greetings_close_btn",function(t){d("user_closed")}),f(document).on("click",".ht_ctc_chat_greetings_box_link",function(t){t.preventDefault(),!document.querySelector("#ctc_opt")||f("#ctc_opt").is(":checked")||n("g_optin")?p(e):f(".ctc_opt_in").show(400).fadeOut("1").fadeIn("1"),document.dispatchEvent(new CustomEvent("ht_ctc_event_greetings"))}),document.querySelector("#ctc_opt")&&f("#ctc_opt").on("change",function(t){f("#ctc_opt").is(":checked")&&(f(".ctc_opt_in").hide(100),i("g_optin","y"),setTimeout(()=>{p(e)},500))})),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,a);e=encodeURIComponent(e),r.url_structure_d&&"yes"!==_?window.open("https://web.whatsapp.com/send?phone="+t+"&text="+e,"_blank","noopener"):window.open("https://wa.me/"+t+"?text="+e,"_blank","noopener"),m(this),v(t)}),f(document).on("click",".ctc_chat, #ctc_chat",function(t){p(this),f(this).hasClass("ctc_woo_place")&&t.preventDefault()}),f(document).on("click",'[href="#ctc_chat"]',function(t){t.preventDefault(),p(this)})}function u(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"),i("g_action",t),"user_opened"==t&&i("g_user_action",t)}function d(t){f(".ht_ctc_chat_greetings_box").hide(70),f(".ht_ctc_chat_greetings_box").addClass("ctc_greetings_closed").removeClass("ctc_greetings_opened"),i("g_action",t),"user_closed"==t&&i("g_user_action",t)}function l(t){var e;"yes"==_?"show"==r.dis_m&&((e=document.querySelector(".ht_ctc_desktop_chat"))&&e.remove(),t.style.cssText=r.pos_m+r.css,g(t)):"show"==r.dis_d&&((e=document.querySelector(".ht_ctc_mobile_chat"))&&e.remove(),t.style.cssText=r.pos_d+r.css,g(t))}function g(e){try{f(e).show(parseInt(r.se))}catch(t){e.style.display="block"}var t,c;!function(){if(f(".ht_ctc_chat_greetings_box").length){if(r.g_device){if("yes"!==_&&"mobile"==r.g_device)return f(".ht_ctc_chat_greetings_box").remove();if("yes"==_&&"desktop"==r.g_device)return f(".ht_ctc_chat_greetings_box").remove()}document.dispatchEvent(new CustomEvent("ht_ctc_event_after_chat_displayed",{detail:{ctc:r,greetings_open:u,greetings_close:d}})),r.g_init&&"open"==r.g_init&&"user_closed"!==n("g_user_action")&&u("init"),f(document).on("click",".ctc_greetings, #ctc_greetings",function(t){d("element"),u("element")})}}(),c=f(t=e).hasClass("ht_ctc_entry_animation")?1200:120,setTimeout(function(){t.classList.add("ht_ctc_animation",r.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 m(t){if(r.analytics&&"session"==r.analytics){if(sessionStorage.getItem("ht_ctc_analytics"))return;sessionStorage.setItem("ht_ctc_analytics","done")}document.dispatchEvent(new CustomEvent("ht_ctc_event_analytics"));var e=r.number;t.classList.contains("ht-ctc-sc")&&(e=t.getAttribute("data-number"));var c="Click to Chat for WhatsApp",n="chat: "+e,t=o+", "+a;(r.ga||r.ga4)&&("undefined"!=typeof gtag?r.ga4?gtag("event","click to chat",{number:e,title:o,url:a}):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:o,url:a,event_category:c,event_label:t,event_action:n}),r.ads&&"undefined"!=typeof gtag_report_conversion&&gtag_report_conversion(),r.fb&&"undefined"!=typeof fbq&&fbq("trackCustom","Click to Chat by HoliThemes",{Category:"Click to Chat for WhatsApp",return_type:"chat",ID:e,Title:o,URL:a})}function p(t){document.dispatchEvent(new CustomEvent("ht_ctc_event_number",{detail:{ctc:r}}));var e,c,n=r.number,o=r.pre_filled;t.hasAttribute("data-number")&&(n=t.getAttribute("data-number")),t.hasAttribute("data-pre_filled")&&(o=t.getAttribute("data-pre_filled")),o=o.replace(/\[url]/gi,a),o=encodeURIComponent(decodeURI(o)),""!=n?(e="https://wa.me/"+n+"?text="+o,c=r.url_target_d||"_blank","yes"==_?(r.url_structure_m&&(e="whatsapp://send?phone="+n+"&text="+o,c="_self"),r.custom_link_m&&""!==r.custom_link_m&&(e=r.custom_link_m)):(r.url_structure_d&&(e="https://web.whatsapp.com/send?phone="+n+"&text="+o),r.custom_link_d&&""!==r.custom_link_d&&(e=r.custom_link_d)),o="popup"==c?"scrollbars=no,resizable=no,status=no,location=no,toolbar=no,menubar=no,width=788,height=514,left=100,top=100":"noopener",window.open(e,c,o),m(t),v(n)):f(".ht-ctc-chat").html(s)}function v(t){var e,c;r.hook_url&&(e=r.hook_url,c={},r.hook_v&&(c=r.hook_v),document.dispatchEvent(new CustomEvent("ht_ctc_event_hook",{detail:{ctc:r,number:t}})),e=r.hook_url,c=r.hook_v,data=JSON.stringify(c),f.ajax({url:e,type:"POST",mode:"no-cors",data:data,success:function(t){}}))}})}(jQuery);
1
+ !function(t){t((function(){var e=window.location.href,c=void 0!==document.title?document.title:"",n=void 0!==screen.width&&screen.width>1024?"no":"yes",o="",a={};function _(t){return!!a[t]&&a[t]}function i(t,e){a[t]=e;var c=JSON.stringify(a);localStorage.setItem("ht_ctc_storage",c)}localStorage.getItem("ht_ctc_storage")&&(a=localStorage.getItem("ht_ctc_storage"),a=JSON.parse(a));var s="";if("undefined"!=typeof ht_ctc_chat_var)s=ht_ctc_chat_var,h(),u();else{try{if(document.querySelector(".ht_ctc_chat_data")){var r=t(".ht_ctc_chat_data").attr("data-settings");s=JSON.parse(r)}}catch(t){s={}}h(),u()}function h(){var e=document.querySelector(".ht_ctc_chat_data");e&&(o=t(".ht_ctc_chat_data").attr("data-no_number"),e.remove())}function u(){var c;document.dispatchEvent(new CustomEvent("ht_ctc_event_settings",{detail:{ctc:s}})),(c=document.querySelector(".ht-ctc-chat"))&&(document.dispatchEvent(new CustomEvent("ht_ctc_event_chat")),function(t){"yes"==s.schedule?document.dispatchEvent(new CustomEvent("ht_ctc_event_display",{detail:{ctc:s,display_chat:g,ht_ctc_chat:t}})):g(t)}(c),c.addEventListener("click",(function(){t(".ht_ctc_chat_greetings_box").length||f(c)})),t(".ht_ctc_chat_greetings_box").length&&t(document).on("click",".ht_ctc_chat_style",(function(e){t(".ht_ctc_chat_greetings_box").hasClass("ctc_greetings_opened")?l("user_closed"):d("user_opened")})),t(document).on("click",".ctc_greetings_close_btn",(function(t){l("user_closed")})),t(document).on("click",".ht_ctc_chat_greetings_box_link",(function(e){e.preventDefault(),document.querySelector("#ctc_opt")?t("#ctc_opt").is(":checked")||_("g_optin")?f(c):t(".ctc_opt_in").show(400).fadeOut("1").fadeIn("1"):f(c),document.dispatchEvent(new CustomEvent("ht_ctc_event_greetings"))})),document.querySelector("#ctc_opt")&&t("#ctc_opt").on("change",(function(e){t("#ctc_opt").is(":checked")&&(t(".ctc_opt_in").hide(100),i("g_optin","y"),setTimeout((()=>{f(c)}),500))}))),t(document).on("click",".ht-ctc-sc-chat",(function(){var t=this.getAttribute("data-number"),c=this.getAttribute("data-pre_filled");c=c.replace(/\[url]/gi,e),c=encodeURIComponent(c),s.url_structure_d&&"yes"!==n?window.open("https://web.whatsapp.com/send?phone="+t+"&text="+c,"_blank","noopener"):window.open("https://wa.me/"+t+"?text="+c,"_blank","noopener"),m(this),v(t)})),t(document).on("click",".ctc_chat, #ctc_chat",(function(e){f(this),t(this).hasClass("ctc_woo_place")&&e.preventDefault()})),t(document).on("click",'[href="#ctc_chat"]',(function(t){t.preventDefault(),f(this)}))}function d(e="open"){t(".ctc_cta_stick").remove(),t(".ht_ctc_chat_greetings_box").show(70),t(".ht_ctc_chat_greetings_box").addClass("ctc_greetings_opened").removeClass("ctc_greetings_closed"),i("g_action",e),"user_opened"==e&&i("g_user_action",e)}function l(e="close"){t(".ht_ctc_chat_greetings_box").hide(70),t(".ht_ctc_chat_greetings_box").addClass("ctc_greetings_closed").removeClass("ctc_greetings_opened"),i("g_action",e),"user_closed"==e&&i("g_user_action",e)}function g(t){var e;"yes"==n?"show"==s.dis_m&&((e=document.querySelector(".ht_ctc_desktop_chat"))&&e.remove(),t.style.cssText=s.pos_m+s.css,p(t)):"show"==s.dis_d&&((e=document.querySelector(".ht_ctc_mobile_chat"))&&e.remove(),t.style.cssText=s.pos_d+s.css,p(t))}function p(e){try{t(e).show(parseInt(s.se))}catch(t){e.style.display="block"}!function(){if(t(".ht_ctc_chat_greetings_box").length){if(s.g_device){if("yes"!==n&&"mobile"==s.g_device)return void t(".ht_ctc_chat_greetings_box").remove();if("yes"==n&&"desktop"==s.g_device)return void t(".ht_ctc_chat_greetings_box").remove()}document.dispatchEvent(new CustomEvent("ht_ctc_event_after_chat_displayed",{detail:{ctc:s,greetings_open:d,greetings_close:l}})),s.g_init&&"open"==s.g_init&&"user_closed"!==_("g_user_action")&&d("init"),t(document).on("click",'.ctc_greetings, #ctc_greetings, .ctc_greetings_now, [href="#ctc_greetings"]',(function(t){l("element"),d("element")}))}}(),function(e){var c=t(e).hasClass("ht_ctc_entry_animation")?1200:120;setTimeout((function(){e.classList.add("ht_ctc_animation",s.ani)}),c),t(".ht-ctc-chat").hover((function(){t(".ht-ctc-chat .ht-ctc-cta-hover").show(120)}),(function(){t(".ht-ctc-chat .ht-ctc-cta-hover").hide(100)}))}(e)}function m(t){if(s.analytics&&"session"==s.analytics){if(sessionStorage.getItem("ht_ctc_analytics"))return;sessionStorage.setItem("ht_ctc_analytics","done")}document.dispatchEvent(new CustomEvent("ht_ctc_event_analytics"));var n=s.number;t.classList.contains("ht-ctc-sc")&&(n=t.getAttribute("data-number"));var o="Click to Chat for WhatsApp",a="chat: "+n,_=c+", "+e;if(s.ga||s.ga4)if("undefined"!=typeof gtag)s.ga4?gtag("event","click to chat",{number:n,title:c,url:e}):gtag("event",a,{event_category:o,event_label:_});else if("undefined"!=typeof ga&&void 0!==ga.getAll){ga.getAll()[0].send("event",o,a,_)}else"undefined"!=typeof __gaTracker&&__gaTracker("send","event",o,a,_);"undefined"!=typeof dataLayer&&dataLayer.push({event:"Click to Chat",type:"chat",number:n,title:c,url:e,event_category:o,event_label:_,event_action:a}),s.ads&&"undefined"!=typeof gtag_report_conversion&&gtag_report_conversion(),s.fb&&"undefined"!=typeof fbq&&fbq("trackCustom","Click to Chat by HoliThemes",{Category:"Click to Chat for WhatsApp",return_type:"chat",ID:n,Title:c,URL:e})}function f(c){document.dispatchEvent(new CustomEvent("ht_ctc_event_number",{detail:{ctc:s}}));var a=s.number,_=s.pre_filled;if(c.hasAttribute("data-number")&&(a=c.getAttribute("data-number")),c.hasAttribute("data-pre_filled")&&(_=c.getAttribute("data-pre_filled")),_=_.replace(/\[url]/gi,e),_=encodeURIComponent(decodeURI(_)),""!=a){var i="https://wa.me/"+a+"?text="+_,r=s.url_target_d?s.url_target_d:"_blank";"yes"==n?(s.url_structure_m&&(i="whatsapp://send?phone="+a+"&text="+_,r="_self"),s.custom_link_m&&""!==s.custom_link_m&&(i=s.custom_link_m)):(s.url_structure_d&&(i="https://web.whatsapp.com/send?phone="+a+"&text="+_),s.custom_link_d&&""!==s.custom_link_d&&(i=s.custom_link_d));var h="popup"==r?"scrollbars=no,resizable=no,status=no,location=no,toolbar=no,menubar=no,width=788,height=514,left=100,top=100":"noopener";window.open(i,r,h),m(c),v(a)}else t(".ht-ctc-chat").html(o)}function v(e){if(s.hook_url){var c=s.hook_url,n={};if(s.hook_v)n=s.hook_v;document.dispatchEvent(new CustomEvent("ht_ctc_event_hook",{detail:{ctc:s,number:e}})),c=s.hook_url,n=s.hook_v,data=JSON.stringify(n),t.ajax({url:c,type:"POST",mode:"no-cors",data:data,success:function(t){}})}}}))}(jQuery);
new/inc/assets/js/dev/app.dev.js CHANGED
@@ -205,13 +205,12 @@
205
  }
206
 
207
 
208
- $(document).on('click', '.ctc_greetings, #ctc_greetings', function (e) {
209
  console.log('greetings open triggered');
210
  greetings_close('element');
211
  greetings_open('element');
212
  });
213
 
214
-
215
  }
216
 
217
  }
@@ -508,7 +507,6 @@
508
 
509
  window.open(base_url, url_target, specs);
510
 
511
-
512
 
513
  // analytics
514
  ht_ctc_chat_analytics(values);
205
  }
206
 
207
 
208
+ $(document).on('click', '.ctc_greetings, #ctc_greetings, .ctc_greetings_now, [href="#ctc_greetings"]', function (e) {
209
  console.log('greetings open triggered');
210
  greetings_close('element');
211
  greetings_open('element');
212
  });
213
 
 
214
  }
215
 
216
  }
507
 
508
  window.open(base_url, url_target, specs);
509
 
 
510
 
511
  // analytics
512
  ht_ctc_chat_analytics(values);
new/inc/assets/js/dev/app.test.js CHANGED
@@ -1,97 +1,267 @@
1
- !function(h) {
2
- h(function() {
3
- var t, a = window.location.href, o = void 0 !== document.title ? document.title : "", i = void 0 !== screen.width && 1024 < screen.width ? "no" : "yes", r = "";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
  if ("undefined" != typeof ht_ctc_chat_var)
5
- r = ht_ctc_chat_var,
6
- e();
 
7
  else {
8
  try {
9
- document.querySelector(".ht-ctc-chat") && (t = h(".ht-ctc-chat").attr("data-settings"),
10
- r = JSON.parse(t))
 
 
11
  } catch (t) {
12
- r = {}
13
  }
14
- e()
 
 
 
 
 
 
15
  }
16
- function e() {
17
- var t;
18
- h(document).trigger("ht_ctc_ce_settings", [r]),
19
- (t = document.querySelector(".ht-ctc-chat")) && (h(t).trigger("ht_ctc_ce_chat"),
20
- function(t) {
21
- "yes" == r.schedule ? h(document).trigger("ht_ctc_display", [r, n, t]) : n(t)
22
- }(t),
23
- t.addEventListener("click", function() {
24
- !function(t) {
25
- var e, n = r.number, c = r.pre_filled;
26
- if (c = c.replace(/\[url]/gi, a),
27
- c = encodeURIComponent(c),
28
- "" == n)
29
- return t.innerHTML = t.getAttribute("data-no_number");
30
- "webapi" == r.webandapi ? (e = "yes" == i ? "https://api.whatsapp.com/send" : "https://web.whatsapp.com/send",
31
- window.open(e + "?phone=" + n + "&text=" + c, "_blank", "noopener")) : (e = "https://wa.me/",
32
- window.open(e + n + "?text=" + c, "_blank", "noopener"))
33
- }(t),
34
- s(t)
35
  })),
36
- h(document).on("click", ".ht-ctc-sc-chat", function() {
37
- var t, e = this.getAttribute("data-number"), n = (n = this.getAttribute("data-pre_filled")).replace(/\[url]/gi, a);
38
- n = encodeURIComponent(n),
39
- "webapi" == this.getAttribute("data-webandapi") ? (t = "yes" == i ? "https://api.whatsapp.com/send" : "https://web.whatsapp.com/send",
40
- window.open(t + "?phone=" + e + "&text=" + n, "_blank", "noopener")) : (t = "https://wa.me/",
41
- window.open(t + e + "?text=" + n, "_blank", "noopener")),
42
- s(this)
43
- })
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
44
  }
45
- function n(t) {
46
  var e;
47
- "yes" == i ? "show" == r.dis_m && ((e = document.querySelector(".ht_ctc_desktop_chat")) && e.remove(),
48
- t.style.cssText = r.pos_m + r.css,
49
- c(t)) : "show" == r.dis_d && ((e = document.querySelector(".ht_ctc_mobile_chat")) && e.remove(),
50
- t.style.cssText = r.pos_d + r.css,
51
- c(t))
52
  }
53
- function c(e) {
54
  try {
55
- h(e).show(parseInt(r.se))
56
  } catch (t) {
57
  e.style.display = "block"
58
  }
59
- var t;
60
- t = e,
61
- setTimeout(function() {
62
- t.classList.add("ht_ctc_animation", r.ani)
63
- }, 120),
64
- h(".ht-ctc-chat").hover(function() {
65
- h(".ht-ctc-chat .ht-ctc-cta-hover").show(120)
66
- }, function() {
67
- h(".ht-ctc-chat .ht-ctc-cta-hover").hide(100)
68
- })
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
69
  }
70
- function s(t) {
71
- h(document).trigger("ht_ctc_analytics");
72
- var e = r.number;
73
- t.classList.contains("ht-ctc-sc") && (e = t.getAttribute("data-number"));
74
- var n = "Click to Chat for WhatsApp"
75
- , c = "chat: " + e
76
- , t = o + ", " + a;
77
- "yes" == r.ga && ("undefined" != typeof gtag ? gtag("event", c, {
78
- event_category: n,
79
- event_label: t
80
- }) : "undefined" != typeof ga && void 0 !== ga.getAll ? ga.getAll()[0].send("event", n, c, t) : "undefined" != typeof __gaTracker && __gaTracker("send", "event", n, c, t)),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
81
  "undefined" != typeof dataLayer && dataLayer.push({
82
  event: "Click to Chat",
83
- event_category: n,
84
- event_label: t,
85
- event_action: c
 
 
 
 
86
  }),
87
- "yes" == r.ads && "undefined" != typeof gtag_report_conversion && gtag_report_conversion(),
88
- "yes" == r.fb && "undefined" != typeof fbq && fbq("trackCustom", "Click to Chat by HoliThemes", {
89
- Category: "Click to Chat for WhatsApp",
90
- return_type: "chat",
91
- ID: e,
92
- Title: o,
93
- URL: a
94
- })
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
95
  }
96
- })
 
97
  }(jQuery);
1
+ !function (t) {
2
+ t((function () {
3
+ var e = window.location.href
4
+ , c = void 0 !== document.title ? document.title : ""
5
+ , n = void 0 !== screen.width && screen.width > 1024 ? "no" : "yes"
6
+ , o = ""
7
+ , a = {};
8
+ function _(t) {
9
+ return !!a[t] && a[t]
10
+ }
11
+ function i(t, e) {
12
+ a[t] = e;
13
+ var c = JSON.stringify(a);
14
+ localStorage.setItem("ht_ctc_storage", c)
15
+ }
16
+ localStorage.getItem("ht_ctc_storage") && (a = localStorage.getItem("ht_ctc_storage"),
17
+ a = JSON.parse(a));
18
+ var s = "";
19
  if ("undefined" != typeof ht_ctc_chat_var)
20
+ s = ht_ctc_chat_var,
21
+ h(),
22
+ u();
23
  else {
24
  try {
25
+ if (document.querySelector(".ht_ctc_chat_data")) {
26
+ var r = t(".ht_ctc_chat_data").attr("data-settings");
27
+ s = JSON.parse(r)
28
+ }
29
  } catch (t) {
30
+ s = {}
31
  }
32
+ h(),
33
+ u()
34
+ }
35
+ function h() {
36
+ var e = document.querySelector(".ht_ctc_chat_data");
37
+ e && (o = t(".ht_ctc_chat_data").attr("data-no_number"),
38
+ e.remove())
39
  }
40
+ function u() {
41
+ var c;
42
+ document.dispatchEvent(new CustomEvent("ht_ctc_event_settings", {
43
+ detail: {
44
+ ctc: s
45
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
46
  })),
47
+ (c = document.querySelector(".ht-ctc-chat")) && (document.dispatchEvent(new CustomEvent("ht_ctc_event_chat")),
48
+ function (t) {
49
+ "yes" == s.schedule ? document.dispatchEvent(new CustomEvent("ht_ctc_event_display", {
50
+ detail: {
51
+ ctc: s,
52
+ display_chat: g,
53
+ ht_ctc_chat: t
54
+ }
55
+ })) : g(t)
56
+ }(c),
57
+ c.addEventListener("click", (function () {
58
+ t(".ht_ctc_chat_greetings_box").length || f(c)
59
+ }
60
+ )),
61
+ t(".ht_ctc_chat_greetings_box").length && t(document).on("click", ".ht_ctc_chat_style", (function (e) {
62
+ t(".ht_ctc_chat_greetings_box").hasClass("ctc_greetings_opened") ? l("user_closed") : d("user_opened")
63
+ }
64
+ )),
65
+ t(document).on("click", ".ctc_greetings_close_btn", (function (t) {
66
+ l("user_closed")
67
+ }
68
+ )),
69
+ t(document).on("click", ".ht_ctc_chat_greetings_box_link", (function (e) {
70
+ e.preventDefault(),
71
+ document.querySelector("#ctc_opt") ? t("#ctc_opt").is(":checked") || _("g_optin") ? f(c) : t(".ctc_opt_in").show(400).fadeOut("1").fadeIn("1") : f(c),
72
+ document.dispatchEvent(new CustomEvent("ht_ctc_event_greetings"))
73
+ }
74
+ )),
75
+ document.querySelector("#ctc_opt") && t("#ctc_opt").on("change", (function (e) {
76
+ t("#ctc_opt").is(":checked") && (t(".ctc_opt_in").hide(100),
77
+ i("g_optin", "y"),
78
+ setTimeout((() => {
79
+ f(c)
80
+ }
81
+ ), 500))
82
+ }
83
+ ))),
84
+ t(document).on("click", ".ht-ctc-sc-chat", (function () {
85
+ var t = this.getAttribute("data-number")
86
+ , c = this.getAttribute("data-pre_filled");
87
+ c = c.replace(/\[url]/gi, e),
88
+ c = encodeURIComponent(c),
89
+ s.url_structure_d && "yes" !== n ? window.open("https://web.whatsapp.com/send?phone=" + t + "&text=" + c, "_blank", "noopener") : window.open("https://wa.me/" + t + "?text=" + c, "_blank", "noopener"),
90
+ m(this),
91
+ v(t)
92
+ }
93
+ )),
94
+ t(document).on("click", ".ctc_chat, #ctc_chat", (function (e) {
95
+ f(this),
96
+ t(this).hasClass("ctc_woo_place") && e.preventDefault()
97
+ }
98
+ )),
99
+ t(document).on("click", '[href="#ctc_chat"]', (function (t) {
100
+ t.preventDefault(),
101
+ f(this)
102
+ }
103
+ ))
104
+ }
105
+ function d(e = "open") {
106
+ t(".ctc_cta_stick").remove(),
107
+ t(".ht_ctc_chat_greetings_box").show(70),
108
+ t(".ht_ctc_chat_greetings_box").addClass("ctc_greetings_opened").removeClass("ctc_greetings_closed"),
109
+ i("g_action", e),
110
+ "user_opened" == e && i("g_user_action", e)
111
+ }
112
+ function l(e = "close") {
113
+ t(".ht_ctc_chat_greetings_box").hide(70),
114
+ t(".ht_ctc_chat_greetings_box").addClass("ctc_greetings_closed").removeClass("ctc_greetings_opened"),
115
+ i("g_action", e),
116
+ "user_closed" == e && i("g_user_action", e)
117
  }
118
+ function g(t) {
119
  var e;
120
+ "yes" == n ? "show" == s.dis_m && ((e = document.querySelector(".ht_ctc_desktop_chat")) && e.remove(),
121
+ t.style.cssText = s.pos_m + s.css,
122
+ p(t)) : "show" == s.dis_d && ((e = document.querySelector(".ht_ctc_mobile_chat")) && e.remove(),
123
+ t.style.cssText = s.pos_d + s.css,
124
+ p(t))
125
  }
126
+ function p(e) {
127
  try {
128
+ t(e).show(parseInt(s.se))
129
  } catch (t) {
130
  e.style.display = "block"
131
  }
132
+ !function () {
133
+ if (t(".ht_ctc_chat_greetings_box").length) {
134
+ if (s.g_device) {
135
+ if ("yes" !== n && "mobile" == s.g_device)
136
+ return void t(".ht_ctc_chat_greetings_box").remove();
137
+ if ("yes" == n && "desktop" == s.g_device)
138
+ return void t(".ht_ctc_chat_greetings_box").remove()
139
+ }
140
+ document.dispatchEvent(new CustomEvent("ht_ctc_event_after_chat_displayed", {
141
+ detail: {
142
+ ctc: s,
143
+ greetings_open: d,
144
+ greetings_close: l
145
+ }
146
+ })),
147
+ s.g_init && "open" == s.g_init && "user_closed" !== _("g_user_action") && d("init"),
148
+ t(document).on("click", '.ctc_greetings, #ctc_greetings, .ctc_greetings_now, [href="#ctc_greetings"]', (function (t) {
149
+ l("element"),
150
+ d("element")
151
+ }
152
+ ))
153
+ }
154
+ }(),
155
+ function (e) {
156
+ var c = t(e).hasClass("ht_ctc_entry_animation") ? 1200 : 120;
157
+ setTimeout((function () {
158
+ e.classList.add("ht_ctc_animation", s.ani)
159
+ }
160
+ ), c),
161
+ t(".ht-ctc-chat").hover((function () {
162
+ t(".ht-ctc-chat .ht-ctc-cta-hover").show(120)
163
+ }
164
+ ), (function () {
165
+ t(".ht-ctc-chat .ht-ctc-cta-hover").hide(100)
166
+ }
167
+ ))
168
+ }(e)
169
  }
170
+ function m(t) {
171
+ if (s.analytics && "session" == s.analytics) {
172
+ if (sessionStorage.getItem("ht_ctc_analytics"))
173
+ return;
174
+ sessionStorage.setItem("ht_ctc_analytics", "done")
175
+ }
176
+ document.dispatchEvent(new CustomEvent("ht_ctc_event_analytics"));
177
+ var n = s.number;
178
+ t.classList.contains("ht-ctc-sc") && (n = t.getAttribute("data-number"));
179
+ var o = "Click to Chat for WhatsApp"
180
+ , a = "chat: " + n
181
+ , _ = c + ", " + e;
182
+ if (s.ga || s.ga4)
183
+ if ("undefined" != typeof gtag)
184
+ s.ga4 ? gtag("event", "click to chat", {
185
+ number: n,
186
+ title: c,
187
+ url: e
188
+ }) : gtag("event", a, {
189
+ event_category: o,
190
+ event_label: _
191
+ });
192
+ else if ("undefined" != typeof ga && void 0 !== ga.getAll) {
193
+ ga.getAll()[0].send("event", o, a, _)
194
+ } else
195
+ "undefined" != typeof __gaTracker && __gaTracker("send", "event", o, a, _);
196
  "undefined" != typeof dataLayer && dataLayer.push({
197
  event: "Click to Chat",
198
+ type: "chat",
199
+ number: n,
200
+ title: c,
201
+ url: e,
202
+ event_category: o,
203
+ event_label: _,
204
+ event_action: a
205
  }),
206
+ s.ads && "undefined" != typeof gtag_report_conversion && gtag_report_conversion(),
207
+ s.fb && "undefined" != typeof fbq && fbq("trackCustom", "Click to Chat by HoliThemes", {
208
+ Category: "Click to Chat for WhatsApp",
209
+ return_type: "chat",
210
+ ID: n,
211
+ Title: c,
212
+ URL: e
213
+ })
214
+ }
215
+ function f(c) {
216
+ document.dispatchEvent(new CustomEvent("ht_ctc_event_number", {
217
+ detail: {
218
+ ctc: s
219
+ }
220
+ }));
221
+ var a = s.number
222
+ , _ = s.pre_filled;
223
+ if (c.hasAttribute("data-number") && (a = c.getAttribute("data-number")),
224
+ c.hasAttribute("data-pre_filled") && (_ = c.getAttribute("data-pre_filled")),
225
+ _ = _.replace(/\[url]/gi, e),
226
+ _ = encodeURIComponent(decodeURI(_)),
227
+ "" != a) {
228
+ var i = "https://wa.me/" + a + "?text=" + _
229
+ , r = s.url_target_d ? s.url_target_d : "_blank";
230
+ "yes" == n ? (s.url_structure_m && (i = "whatsapp://send?phone=" + a + "&text=" + _,
231
+ r = "_self"),
232
+ s.custom_link_m && "" !== s.custom_link_m && (i = s.custom_link_m)) : (s.url_structure_d && (i = "https://web.whatsapp.com/send?phone=" + a + "&text=" + _),
233
+ s.custom_link_d && "" !== s.custom_link_d && (i = s.custom_link_d));
234
+ var h = "popup" == r ? "scrollbars=no,resizable=no,status=no,location=no,toolbar=no,menubar=no,width=788,height=514,left=100,top=100" : "noopener";
235
+ window.open(i, r, h),
236
+ m(c),
237
+ v(a)
238
+ } else
239
+ t(".ht-ctc-chat").html(o)
240
+ }
241
+ function v(e) {
242
+ if (s.hook_url) {
243
+ var c = s.hook_url
244
+ , n = {};
245
+ if (s.hook_v)
246
+ n = s.hook_v;
247
+ document.dispatchEvent(new CustomEvent("ht_ctc_event_hook", {
248
+ detail: {
249
+ ctc: s,
250
+ number: e
251
+ }
252
+ })),
253
+ c = s.hook_url,
254
+ n = s.hook_v,
255
+ data = JSON.stringify(n),
256
+ t.ajax({
257
+ url: c,
258
+ type: "POST",
259
+ mode: "no-cors",
260
+ data: data,
261
+ success: function (t) { }
262
+ })
263
+ }
264
  }
265
+ }
266
+ ))
267
  }(jQuery);
new/inc/chat/class-ht-ctc-chat.php CHANGED
@@ -101,6 +101,10 @@ class HT_CTC_Chat {
101
  // page level
102
  $ht_ctc_pagelevel = get_post_meta( $page_id, 'ht_ctc_pagelevel', true );
103
 
 
 
 
 
104
  /**
105
  * show/hide
106
  * $page_display - page level settings - show/hide/ null
101
  // page level
102
  $ht_ctc_pagelevel = get_post_meta( $page_id, 'ht_ctc_pagelevel', true );
103
 
104
+ // // custom field.
105
+ // $cf_prefilled = get_post_meta( $page_id, 'ht_ctc_cf_prefilled', true );
106
+
107
+
108
  /**
109
  * show/hide
110
  * $page_display - page level settings - show/hide/ null
readme.txt CHANGED
@@ -3,7 +3,7 @@ Requires at least: 4.6
3
  Tested up to: 6.1.1
4
  Requires PHP: 5.6
5
  Contributors: holithemes
6
- Stable tag: 3.17.1
7
  Tags: whatsapp, whatsapp business, click to chat, whatsapp chat, whatsapp support, whatsapp group, whatsapp share, WhatsApp WooCommerce, whatsapp wordpress, whatsapp floating button, chat, holithemes
8
  License: GPLv2 or later
9
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
@@ -524,6 +524,11 @@ After Activate the plugin, add WhatsApp Number at plugin settings.
524
 
525
  == Changelog ==
526
 
 
 
 
 
 
527
  = 3.17.1 =
528
  * Fix: TypeError
529
 
3
  Tested up to: 6.1.1
4
  Requires PHP: 5.6
5
  Contributors: holithemes
6
+ Stable tag: 3.18
7
  Tags: whatsapp, whatsapp business, click to chat, whatsapp chat, whatsapp support, whatsapp group, whatsapp share, WhatsApp WooCommerce, whatsapp wordpress, whatsapp floating button, chat, holithemes
8
  License: GPLv2 or later
9
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
524
 
525
  == Changelog ==
526
 
527
+ = 3.18 =
528
+ * Enchantment: [Greetings Actions](https://holithemes.com/plugins/click-to-chat/greetings-actions/)
529
+ * Add class name 'ctc_greetings' or 'ctc_greetings_now' to any element to display greetings dialog on click.
530
+ * PRO: Add class name 'ctc_greetings_now' to any element to display greetings dialog when element reached viewport.
531
+
532
  = 3.17.1 =
533
  * Fix: TypeError
534