WhatsApp me - Version 4.0.9

Version Description

  • FIX notification balloon text color white
  • New js event 'joinchat:starting'
Download this release

Release Info

Developer creapuntome
Plugin Icon 128x128 WhatsApp me
Version 4.0.9
Comparing to
See all releases

Code changes from version 4.0.8 to 4.0.9

README.txt CHANGED
@@ -3,9 +3,9 @@ Contributors: creapuntome, pacotole, davidlillo, monillo
3
  Donate link: https://www.paypal.me/creapuntome/
4
  Tags: whatsapp business, whatsapp, click to chat, button, whatsapp support chat, support, contact, directly message whatsapp, floating whatsapp, whatsapp chat
5
  Requires at least: 3.0.1
6
- Tested up to: 5.4
7
  Requires PHP: 5.3
8
- Stable tag: 4.0.8
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -15,7 +15,7 @@ License URI: http://www.gnu.org/licenses/gpl-2.0.html
15
 
16
  [Join.chat](https://join.chat?utm_source=wporg&utm_medium=web&utm_campaign=v4_0) | [Add-ons](https://join.chat/en/addons/?utm_source=wporg&utm_medium=web&utm_campaign=v4_0) | [Documentation](https://join.chat/en/docs/?utm_source=wporg&utm_medium=web&utm_campaign=v4_0) | [Support](https://join.chat/en/support/?utm_source=wporg&utm_medium=web&utm_campaign=v4_0)
17
 
18
- ### The best WhatsApp plugin for WordPress.
19
  > We help more than 200,000 businesses worldwide to attract users and convert them into clients.
20
 
21
  ### New in Join.chat 4.0 (formerly WAme) 📍
@@ -26,10 +26,10 @@ License URI: http://www.gnu.org/licenses/gpl-2.0.html
26
 
27
  ### ⌁ What you can do with Join.chat ✅
28
 
29
- #### 🛎 Insert a WhatsApp button on your website.
30
  Define in which pages or zones it should appear, the delay time, if you want it to the right or to the left, only on mobile phones or also on the desktop.
31
 
32
- #### 🔮 Magic WhatsApp button.
33
  Add your logo, profile picture or even an animated gif. You can define a tooltip to capture the user's attention, the limit is set by your creativity.
34
 
35
  #### 📝 Edit at publication level.
@@ -39,7 +39,7 @@ You can change general settings on every Post, Page, Product or CPT. In the righ
39
  Use a balloon on the button to get the user's attention. In this way, you ensure that you do not miss any important message you want to give them, surprise them in a less intrusive way.
40
 
41
  #### 📯 Create call-to-action messages.
42
- For users to click on the button, use custom CTAs on each page, product or section. Welcome them, help them and offer them offers or promotions. [You can read more about this topic here](https://join.chat/es/whatsapp-me-mucho-mas-que-un-click-to-chat/).
43
 
44
  #### 💬 Customize conversation start messages.
45
  So that the user does not waste time in writing. This way you will be able to know from which page it comes or what product is being consulted when you start the first conversation.
@@ -48,7 +48,7 @@ So that the user does not waste time in writing. This way you will be able to kn
48
  Define CTAs and Custom Messages for product pages, you can use dynamic variables such as {SKU}, {PRICE} or {PRODUCT}.
49
 
50
  #### 🏁 Analyze the conversion data in Google Analytics and Facebook Pixel.
51
- Remember, you do not have to do anything, the plugin already creates and computes the events by itself. [You can read more about this topic here](https://join.chat/es/wame-mide-los-eventos-de-whatsapp-en-google-analytics/).
52
 
53
  #### 💱 Customize different languages.
54
  To be able to support all your users, wherever they are. Our plugin is compatible with WPML and Polylang.
@@ -59,21 +59,11 @@ Display the chat window with dark colors and white text. From settings you can a
59
  #### 👨‍💻 Developer friendly.
60
  Fully extensible, with lots of filters and actions to extend its functionality or change behavior.
61
 
62
- ### ⌁ What you can´t do with Join.chat ⛔️
63
-
64
- #### 👨‍🎨 Modify the appearance of the button.
65
- Users recognize it instantly because it is in thousands of web pages and they know what it is for, it generates trust. If you modify it, you lose these important values.
66
-
67
- #### 😡 Wasting time configuring other similar plugins.
68
- Having many options is not an advantage, the configuration of Join.chat is so easy that in less than 2 minutes you will be ‘wasapeando’ with your clients.
69
-
70
  ### ⌁ If you like Join.chat 😍
71
  1. Please leave us a [★★★★★](https://wordpress.org/support/plugin/creame-whatsapp-me/reviews/#new-post) rating. We'll thank you.
72
  2. Help us with the [translation in your language](https://translate.wordpress.org/projects/wp-plugins/creame-whatsapp-me)
73
  3. Subscribe to our newsletter and visit our blog at [join.chat](https://join.chat/?utm_source=wporg&utm_medium=web&utm_campaign=v4_0).
74
- 4. Follow [@joinchat](https://twitter.com/wamechat) on twitter.
75
-
76
- Name history: *WhatsApp me > WAme > VVAme > **Join.chat***
77
 
78
  *WhatsApp and WhatsApp Logo are brand assets and trademark of Facebook, Inc. Join.chat is not in partnership, sponsored or endorsed by Facebook, Inc.*
79
 
@@ -99,6 +89,8 @@ You can change the position of the button so that nothing covers it by adding th
99
 
100
  `.joinchat { z-index:9999; }`
101
 
 
 
102
  If you need to move up:
103
 
104
  `/* always */
@@ -109,8 +101,6 @@ If you need to move up:
109
  .joinchat { --bottom: 60px; }
110
  }`
111
 
112
- Greater values of z-index are left over, the default value is 400.
113
-
114
  = What about GDPR? =
115
 
116
  Join.chat don't use cookies.
@@ -175,12 +165,15 @@ Join.chat general text settings can be translated with the strings translation o
175
  == Screenshots ==
176
 
177
  1. Set phone, button text and call to action.
178
- 2. Chat window.
179
- 3. Set button image and tooltip.
180
- 4. Set chat window color theme.
181
 
182
  == Changelog ==
183
 
 
 
 
 
184
  = 4.0.8 =
185
  * FIX WP Super Cache clear cache error on save
186
  * Image thumbnail fallback if possible
3
  Donate link: https://www.paypal.me/creapuntome/
4
  Tags: whatsapp business, whatsapp, click to chat, button, whatsapp support chat, support, contact, directly message whatsapp, floating whatsapp, whatsapp chat
5
  Requires at least: 3.0.1
6
+ Tested up to: 5.5
7
  Requires PHP: 5.3
8
+ Stable tag: 4.0.9
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
15
 
16
  [Join.chat](https://join.chat?utm_source=wporg&utm_medium=web&utm_campaign=v4_0) | [Add-ons](https://join.chat/en/addons/?utm_source=wporg&utm_medium=web&utm_campaign=v4_0) | [Documentation](https://join.chat/en/docs/?utm_source=wporg&utm_medium=web&utm_campaign=v4_0) | [Support](https://join.chat/en/support/?utm_source=wporg&utm_medium=web&utm_campaign=v4_0)
17
 
18
+ ### The best WordPress plugin for WhatsApp.
19
  > We help more than 200,000 businesses worldwide to attract users and convert them into clients.
20
 
21
  ### New in Join.chat 4.0 (formerly WAme) 📍
26
 
27
  ### ⌁ What you can do with Join.chat ✅
28
 
29
+ #### 🛎 Insert a contact button on your website.
30
  Define in which pages or zones it should appear, the delay time, if you want it to the right or to the left, only on mobile phones or also on the desktop.
31
 
32
+ #### 🔮 Magic contact button for WhatsApp.
33
  Add your logo, profile picture or even an animated gif. You can define a tooltip to capture the user's attention, the limit is set by your creativity.
34
 
35
  #### 📝 Edit at publication level.
39
  Use a balloon on the button to get the user's attention. In this way, you ensure that you do not miss any important message you want to give them, surprise them in a less intrusive way.
40
 
41
  #### 📯 Create call-to-action messages.
42
+ For users to click on the button, use custom CTAs on each page, product or section. Welcome them, help them and offer them offers or promotions. [You can read more about this topic here](https://join.chat/es/joinchat-mucho-mas-que-un-click-to-chat/).
43
 
44
  #### 💬 Customize conversation start messages.
45
  So that the user does not waste time in writing. This way you will be able to know from which page it comes or what product is being consulted when you start the first conversation.
48
  Define CTAs and Custom Messages for product pages, you can use dynamic variables such as {SKU}, {PRICE} or {PRODUCT}.
49
 
50
  #### 🏁 Analyze the conversion data in Google Analytics and Facebook Pixel.
51
+ Remember, you do not have to do anything, the plugin already creates and computes the events by itself. [You can read more about this topic here](https://join.chat/en/joinchat-measures-whatsapp-events-in-google-analytics/).
52
 
53
  #### 💱 Customize different languages.
54
  To be able to support all your users, wherever they are. Our plugin is compatible with WPML and Polylang.
59
  #### 👨‍💻 Developer friendly.
60
  Fully extensible, with lots of filters and actions to extend its functionality or change behavior.
61
 
 
 
 
 
 
 
 
 
62
  ### ⌁ If you like Join.chat 😍
63
  1. Please leave us a [★★★★★](https://wordpress.org/support/plugin/creame-whatsapp-me/reviews/#new-post) rating. We'll thank you.
64
  2. Help us with the [translation in your language](https://translate.wordpress.org/projects/wp-plugins/creame-whatsapp-me)
65
  3. Subscribe to our newsletter and visit our blog at [join.chat](https://join.chat/?utm_source=wporg&utm_medium=web&utm_campaign=v4_0).
66
+ 4. Follow [@joinchatnow](https://twitter.com/joinchatnow) on twitter.
 
 
67
 
68
  *WhatsApp and WhatsApp Logo are brand assets and trademark of Facebook, Inc. Join.chat is not in partnership, sponsored or endorsed by Facebook, Inc.*
69
 
89
 
90
  `.joinchat { z-index:9999; }`
91
 
92
+ Higher values ​​of z-index are above, the default value is 1000.
93
+
94
  If you need to move up:
95
 
96
  `/* always */
101
  .joinchat { --bottom: 60px; }
102
  }`
103
 
 
 
104
  = What about GDPR? =
105
 
106
  Join.chat don't use cookies.
165
  == Screenshots ==
166
 
167
  1. Set phone, button text and call to action.
168
+ 2. Set button image and tooltip.
169
+ 3. Set chat window color theme.
 
170
 
171
  == Changelog ==
172
 
173
+ = 4.0.9 =
174
+ * FIX notification balloon text color white
175
+ * New js event 'joinchat:starting'
176
+
177
  = 4.0.8 =
178
  * FIX WP Super Cache clear cache error on save
179
  * Image thumbnail fallback if possible
includes/class-joinchat-util.php CHANGED
@@ -253,4 +253,20 @@ class JoinChatUtil {
253
 
254
  }
255
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
256
  }
253
 
254
  }
255
 
256
+ /**
257
+ * Encode JSON with filtered options
258
+ *
259
+ * @since 4.0.9
260
+ * @param array $data data to encode
261
+ * @return string data json encoded
262
+ */
263
+ public static function to_json( $data ) {
264
+
265
+ $json_options = defined( 'JSON_UNESCAPED_UNICODE' ) ?
266
+ JSON_HEX_APOS | JSON_HEX_QUOT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES :
267
+ JSON_HEX_APOS | JSON_HEX_QUOT;
268
+
269
+ return json_encode( $data, apply_filters( 'joinchat_json_options', $json_options ) );
270
+
271
+ }
272
  }
joinchat.php CHANGED
@@ -9,7 +9,7 @@
9
  * Plugin Name: Join.chat
10
  * Plugin URI: https://join.chat
11
  * Description: Connects a WordPress chat with WhatsApp. The best solution for marketing and support. Stop losing customers and increase your sales.
12
- * Version: 4.0.8
13
  * Author: Creame
14
  * Author URI: https://crea.me
15
  * License: GPL-2.0+
@@ -27,7 +27,7 @@ if ( ! defined( 'WPINC' ) ) {
27
  * Currently plugin version.
28
  * Start at version 1.0.0 and use SemVer - https://semver.org
29
  */
30
- define( 'JOINCHAT_VERSION', '4.0.8' );
31
 
32
  /**
33
  * The core plugin class that is used to define internationalization,
9
  * Plugin Name: Join.chat
10
  * Plugin URI: https://join.chat
11
  * Description: Connects a WordPress chat with WhatsApp. The best solution for marketing and support. Stop losing customers and increase your sales.
12
+ * Version: 4.0.9
13
  * Author: Creame
14
  * Author URI: https://crea.me
15
  * License: GPL-2.0+
27
  * Currently plugin version.
28
  * Start at version 1.0.0 and use SemVer - https://semver.org
29
  */
30
+ define( 'JOINCHAT_VERSION', '4.0.9' );
31
 
32
  /**
33
  * The core plugin class that is used to define internationalization,
public/class-joinchat-public.php CHANGED
@@ -112,7 +112,8 @@ class JoinChatPublic {
112
  $settings = $default_settings;
113
  $show = false;
114
 
115
- $site_settings = get_option( 'joinchat' );
 
116
 
117
  if ( is_array( $site_settings ) ) {
118
  // Clean unused saved settings
@@ -243,13 +244,6 @@ class JoinChatPublic {
243
 
244
  $data = array_diff_key( $this->settings, array_flip( $excluded_fields ) );
245
 
246
- $json_options = apply_filters(
247
- 'joinchat_json_options',
248
- defined( 'JSON_UNESCAPED_UNICODE' ) ?
249
- JSON_HEX_APOS | JSON_HEX_QUOT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES :
250
- JSON_HEX_APOS | JSON_HEX_QUOT
251
- );
252
-
253
  $copy = apply_filters( 'joinchat_copy', 'Powered by' );
254
 
255
  $powered_url = urlencode( home_url( $wp->request ) );
@@ -286,7 +280,7 @@ class JoinChatPublic {
286
 
287
  ob_start();
288
  ?>
289
- <div class="joinchat <?php echo apply_filters( 'joinchat_classes', $joinchat_classes ); ?>" data-settings='<?php echo json_encode( $data, $json_options ); ?>'>
290
  <div class="joinchat__button">
291
  <div class="joinchat__button__open"></div>
292
  <?php if ( $image ) : ?>
112
  $settings = $default_settings;
113
  $show = false;
114
 
115
+ // Can hook 'option_joinchat' and 'default_option_joinchat' filters
116
+ $site_settings = get_option( 'joinchat', $default_settings );
117
 
118
  if ( is_array( $site_settings ) ) {
119
  // Clean unused saved settings
244
 
245
  $data = array_diff_key( $this->settings, array_flip( $excluded_fields ) );
246
 
 
 
 
 
 
 
 
247
  $copy = apply_filters( 'joinchat_copy', 'Powered by' );
248
 
249
  $powered_url = urlencode( home_url( $wp->request ) );
280
 
281
  ob_start();
282
  ?>
283
+ <div class="joinchat <?php echo apply_filters( 'joinchat_classes', $joinchat_classes ); ?>" data-settings='<?php echo JoinChatUtil::to_json( $data ); ?>'>
284
  <div class="joinchat__button">
285
  <div class="joinchat__button__open"></div>
286
  <?php if ( $image ) : ?>
public/css/joinchat.css CHANGED
@@ -230,6 +230,7 @@
230
  border: none;
231
  border-radius: 50%;
232
  background: #e82c0c;
 
233
  font-size: 12px;
234
  font-weight: 600;
235
  line-height: 20px;
230
  border: none;
231
  border-radius: 50%;
232
  background: #e82c0c;
233
+ color: #fff;
234
  font-size: 12px;
235
  font-weight: 600;
236
  line-height: 20px;
public/css/joinchat.min.css CHANGED
@@ -1 +1 @@
1
- .joinchat{--bottom:20px;--sep:20px;--header:70px;--btn:60px;--red:37;--green:211;--blue:102;--rgb:var(--red),var(--green),var(--blue);--color:rgb(var(--rgb));--dark:rgb(calc(var(--red) - 75),calc(var(--green) - 75),calc(var(--blue) - 75));--hover:rgb(calc(var(--red) + 50),calc(var(--green) + 50),calc(var(--blue) + 50));--bg:rgba(var(--rgb),0.04);--tolerance:210;--bw:calc((var(--red)*0.2126 + var(--green)*0.7152 + var(--blue)*0.0722 - var(--tolerance))*-100000);--text:rgba(var(--bw),var(--bw),var(--bw),min(1,max(0.7,var(--bw))));--msg:var(--color);position:fixed;z-index:1000;right:var(--sep);bottom:var(--bottom);color:var(--text);font:normal normal normal 16px/1.625em -apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Open Sans,Helvetica Neue,sans-serif;letter-spacing:0;transform:scale3d(0,0,0);transition:transform .3s ease-in-out;-webkit-user-select:none;-ms-user-select:none;user-select:none;-webkit-font-smoothing:antialiased}.joinchat *,.joinchat :after,.joinchat :before{box-sizing:border-box}.joinchat--show{transform:scaleX(1);transition:transform .5s cubic-bezier(.18,.89,.32,1.28)}.joinchat.joinchat--left{right:auto;left:var(--sep)}@media (max-width:480px),(orientation:landscape) and (max-width:767px){.joinchat{--bottom:6px;--sep:6px;--header:55px}}.joinchat.joinchat--dark{--msg:var(--dark)}@media (color-index:48){.joinchat.joinchat--dark-auto{--msg:var(--dark)}}@media (prefers-color-scheme:dark){.joinchat.joinchat--dark-auto{--msg:var(--dark)}}.joinchat__button{display:flex;flex-direction:row;position:absolute;z-index:2;bottom:8px;right:8px;height:var(--btn);min-width:var(--btn);max-width:95vw;background:#25d366;color:inherit;border-radius:calc(var(--btn)/2);box-shadow:1px 6px 24px 0 rgba(7,94,84,.24);cursor:pointer;transition:background .2s linear;-webkit-tap-highlight-color:rgba(0,0,0,0);will-change:background-color,width}.joinchat__button:hover{background:#128c7e;transition:background 1.5s linear}.joinchat__button:active{background:#128c7e;transition:none}.joinchat--chatbox .joinchat__button{background:var(--color);transition:background .2s linear;box-shadow:0 1px 2px 0 rgba(0,0,0,.3)}.joinchat--chatbox .joinchat__button:active,.joinchat--chatbox .joinchat__button:hover{background:var(--hover)}[dir=rtl] .joinchat__button{flex-direction:row-reverse}.joinchat--left .joinchat__button{right:auto;left:8px;flex-direction:row-reverse}[dir=rtl] .joinchat--left .joinchat__button{flex-direction:row}.joinchat__button__open{width:var(--btn);height:var(--btn);background:transparent url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23fff' d='M3.516 3.516c4.686-4.686 12.284-4.686 16.97 0 4.686 4.686 4.686 12.283 0 16.97a12.004 12.004 0 01-13.754 2.299l-5.814.735a.392.392 0 01-.438-.44l.748-5.788A12.002 12.002 0 013.517 3.517zm3.61 17.043l.3.158a9.846 9.846 0 0011.534-1.758c3.843-3.843 3.843-10.074 0-13.918-3.843-3.843-10.075-3.843-13.918 0a9.846 9.846 0 00-1.747 11.554l.16.303-.51 3.942a.196.196 0 00.219.22l3.961-.501zm6.534-7.003l-.933 1.164a9.843 9.843 0 01-3.497-3.495l1.166-.933a.792.792 0 00.23-.94L9.561 6.96a.793.793 0 00-.924-.445 1291.6 1291.6 0 00-2.023.524.797.797 0 00-.588.88 11.754 11.754 0 0010.005 10.005.797.797 0 00.88-.587l.525-2.023a.793.793 0 00-.445-.923L14.6 13.327a.792.792 0 00-.94.23z'/%3E%3C/svg%3E") 50% no-repeat;background-size:60%}.joinchat--chatbox .joinchat__button__open{display:none}.joinchat__button__image{position:absolute;top:1px;right:1px;width:calc(var(--btn) - 2px);height:calc(var(--btn) - 2px);border-radius:50%;overflow:hidden;opacity:0}.joinchat__button__image img{display:block;width:100%;height:100%;object-fit:cover}.joinchat--show .joinchat__button__image{animation:joinchat_image_loop 20s linear 5s infinite normal both}.joinchat--image .joinchat__button__image{opacity:1;animation:none}.joinchat--chatbox .joinchat__button__image{display:none}.joinchat__button__send{display:none;width:var(--btn);height:var(--btn);max-width:var(--btn);padding:12px 11px 12px 13px;margin:0;flex-shrink:0}.joinchat--chatbox .joinchat__button__send{display:block}.joinchat__button__send path{fill:none!important;stroke:var(--text)!important}.joinchat__button__send .joinchat_svg__plain{stroke-dasharray:1097;stroke-dashoffset:1097;animation:joinchat_plain 6s .2s ease-in-out infinite}.joinchat__button__send .joinchat_svg__chat{stroke-dasharray:1020;stroke-dashoffset:1020;animation:joinchat_chat 6s 3.2s ease-in-out infinite}.joinchat__button__sendtext{padding:0;max-width:0;font-weight:600;line-height:var(--btn);white-space:nowrap;opacity:0;overflow:hidden;transition:none}.joinchat--chatbox .joinchat__button__sendtext{padding:0 4px 0 24px;max-width:200px;opacity:1;transition:max-width .2s linear,opacity .4s ease-out .2s}.joinchat--chatbox.joinchat--left .joinchat__button__sendtext{padding:0 24px 0 4px}.joinchat__badge{position:absolute;top:-4px;right:-4px;width:20px;height:20px;border:none;border-radius:50%;background:#e82c0c;font-size:12px;font-weight:600;line-height:20px;text-align:center;box-shadow:none;opacity:0;pointer-events:none}.joinchat__badge.joinchat__badge--in{animation:joinchat_badge_in .5s cubic-bezier(.27,.9,.41,1.28) 1 both}.joinchat__badge.joinchat__badge--out{animation:joinchat_badge_out .4s cubic-bezier(.215,.61,.355,1) 1 both}.joinchat__tooltip{position:absolute;top:14px;right:76px;max-width:calc(100vw - 105px);height:32px;padding:0 14px;border:none;border-radius:16px;background:#fff;color:rgba(0,0,0,.8);line-height:31px;white-space:nowrap;opacity:0;filter:drop-shadow(0 1px 4px rgba(0,0,0,.4));transform:translateZ(0);pointer-events:none}.joinchat__tooltip:after{content:"";display:block;position:absolute;top:10px;right:-6px;border:8px solid transparent;border-width:6px 0 6px 8px;border-left-color:#fff}.joinchat__tooltip div{overflow:hidden;text-overflow:ellipsis}.joinchat--tooltip .joinchat__tooltip{animation:joinchat_tootlip 20s linear 5s 1 normal both}.joinchat--chatbox .joinchat__tooltip{display:none}.joinchat--left .joinchat__tooltip{right:auto;left:76px}.joinchat--left .joinchat__tooltip:after{left:-6px;right:auto;border-color:transparent;border-width:6px 8px 6px 0;border-right-color:#fff}.joinchat__box{display:flex;flex-direction:column;position:absolute;bottom:0;right:0;z-index:1;width:calc(100vw - var(--sep)*2);max-width:400px;min-height:170px;max-height:calc(100vh - var(--bottom) - var(--sep));border-radius:32px;background:transparent;box-shadow:0 2px 6px 0 rgba(0,0,0,.5);text-align:left;overflow:hidden;transform:scale3d(0,0,0);opacity:0;transition:opacity .4s ease-out,transform 0ms linear .3s}.joinchat--chatbox .joinchat__box{opacity:1;transform:scaleX(1);transition:opacity .2s ease-out,transform 0ms linear}.joinchat--left .joinchat__box{right:auto;left:0}.joinchat__header{position:relative;flex-shrink:0;height:var(--header);line-height:var(--header);padding:0 26px;margin:0;background:var(--color);text-align:left}[dir=rtl] .joinchat__header{text-align:right}.joinchat--dark .joinchat__header{background:var(--dark)}.joinchat__copy{font-size:11px;line-height:18px;color:inherit!important;text-decoration:none!important;fill:currentColor;opacity:.8}.joinchat__copy svg{display:inline-block;width:auto;height:18px;vertical-align:-26%}a.joinchat__copy:active,a.joinchat__copy:hover{color:inherit!important;text-decoration:none!important;opacity:.9}.joinchat__close{position:absolute;top:50%;right:24px;width:34px;height:34px;margin-top:-16px;border-radius:50%;background:rgba(0,0,0,.4) url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23fff'%3E%3Cpath d='M24 2.4L21.6 0 12 9.6 2.4 0 0 2.4 9.6 12 0 21.6 2.4 24l9.6-9.6 9.6 9.6 2.4-2.4-9.6-9.6L24 2.4z'/%3E%3C/svg%3E") 50% no-repeat;background-size:12px;cursor:pointer;transition:background-color .3s ease-out;-webkit-tap-highlight-color:rgba(0,0,0,0)}.joinchat__close:hover{background-color:rgba(0,0,0,.6)}[dir=rtl] .joinchat__close{right:auto;left:24px}.joinchat__box__scroll{padding:20px 0 70px;padding-bottom:calc(var(--btn) + 10px);background:#fff linear-gradient(0deg,var(--bg),var(--bg));overflow-x:hidden;overflow-y:auto;will-change:scroll-position}.joinchat__box__scroll::-webkit-scrollbar{width:5px;background:transparent}.joinchat__box__scroll::-webkit-scrollbar-thumb{border-radius:3px;background:transparent}.joinchat__box__scroll:hover::-webkit-scrollbar-thumb{background:rgba(0,0,0,.2)}.joinchat--blur .joinchat__box__scroll{background:rgba(var(--rgb),.2);-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px)}.joinchat--dark .joinchat__box__scroll{background:#1a1a1a}@supports (-webkit-overflow-scrolling:touch){.joinchat__box__scroll{overflow-y:scroll;-webkit-overflow-scrolling:touch}}@media (max-width:480px),(orientation:landscape) and (max-width:767px){.joinchat__close{margin-top:-14px;width:28px;height:28px}.joinchat__box__scroll{padding-top:15px}}@media (color-index:48){.joinchat--dark-auto .joinchat__box__scroll{background:#1a1a1a}.joinchat--dark-auto .joinchat__header{background:var(--dark)}}@media (prefers-color-scheme:dark){.joinchat--dark-auto .joinchat__box__scroll{background:#1a1a1a}.joinchat--dark-auto .joinchat__header{background:var(--dark)}}.joinchat__message{position:relative;min-height:60px;padding:17px 20px;margin:0 26px 26px;border-radius:32px;background:#fff;color:#4a4a4a;filter:drop-shadow(0 1px 2px rgba(0,0,0,.3));transform:translateZ(0)}.joinchat__message:before{content:"";display:block;position:absolute;bottom:20px;left:-15px;width:17px;height:25px;background:inherit;-webkit-clip-path:url(#joinchat__message__peak);clip-path:url(#joinchat__message__peak)}.joinchat--dark .joinchat__message{background:#505050;color:#d8d8d8}@media (color-index:48){.joinchat--dark-auto .joinchat__message{background:#505050;color:#d8d8d8}}@media (prefers-color-scheme:dark){.joinchat--dark-auto .joinchat__message{background:#505050;color:#d8d8d8}}@media (max-width:480px),(orientation:landscape) and (max-width:767px){.joinchat__message{padding:18px 16px;line-height:24px;margin:0 20px 20px}}@keyframes joinchat_badge_in{0%{opacity:0;transform:translateY(50px)}to{opacity:1;transform:translateY(0)}}@keyframes joinchat_badge_out{0%{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(-20px)}}@keyframes joinchat_plain{0%,50%,to{stroke-dashoffset:1097}5%,45%{stroke-dashoffset:0}}@keyframes joinchat_chat{0%,50%,to{stroke-dashoffset:1020}5%,45%{stroke-dashoffset:0}}@keyframes joinchat_image_loop{0%{opacity:0}3%,20%{opacity:1}25%,to{opacity:0}}@keyframes joinchat_tootlip{0%{opacity:0;transform:scaleY(0)}1%,20%{opacity:1;transform:scaleY(1)}25%,to{opacity:0;transform:scaleY(1)}}
1
+ .joinchat{--bottom:20px;--sep:20px;--header:70px;--btn:60px;--red:37;--green:211;--blue:102;--rgb:var(--red),var(--green),var(--blue);--color:rgb(var(--rgb));--dark:rgb(calc(var(--red) - 75),calc(var(--green) - 75),calc(var(--blue) - 75));--hover:rgb(calc(var(--red) + 50),calc(var(--green) + 50),calc(var(--blue) + 50));--bg:rgba(var(--rgb),0.04);--tolerance:210;--bw:calc((var(--red)*0.2126 + var(--green)*0.7152 + var(--blue)*0.0722 - var(--tolerance))*-100000);--text:rgba(var(--bw),var(--bw),var(--bw),min(1,max(0.7,var(--bw))));--msg:var(--color);position:fixed;z-index:1000;right:var(--sep);bottom:var(--bottom);color:var(--text);font:normal normal normal 16px/1.625em -apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Open Sans,Helvetica Neue,sans-serif;letter-spacing:0;transform:scale3d(0,0,0);transition:transform .3s ease-in-out;-webkit-user-select:none;-ms-user-select:none;user-select:none;-webkit-font-smoothing:antialiased}.joinchat *,.joinchat :after,.joinchat :before{box-sizing:border-box}.joinchat--show{transform:scaleX(1);transition:transform .5s cubic-bezier(.18,.89,.32,1.28)}.joinchat.joinchat--left{right:auto;left:var(--sep)}@media (max-width:480px),(orientation:landscape) and (max-width:767px){.joinchat{--bottom:6px;--sep:6px;--header:55px}}.joinchat.joinchat--dark{--msg:var(--dark)}@media (color-index:48){.joinchat.joinchat--dark-auto{--msg:var(--dark)}}@media (prefers-color-scheme:dark){.joinchat.joinchat--dark-auto{--msg:var(--dark)}}.joinchat__button{display:flex;flex-direction:row;position:absolute;z-index:2;bottom:8px;right:8px;height:var(--btn);min-width:var(--btn);max-width:95vw;background:#25d366;color:inherit;border-radius:calc(var(--btn)/2);box-shadow:1px 6px 24px 0 rgba(7,94,84,.24);cursor:pointer;transition:background .2s linear;-webkit-tap-highlight-color:rgba(0,0,0,0);will-change:background-color,width}.joinchat__button:hover{background:#128c7e;transition:background 1.5s linear}.joinchat__button:active{background:#128c7e;transition:none}.joinchat--chatbox .joinchat__button{background:var(--color);transition:background .2s linear;box-shadow:0 1px 2px 0 rgba(0,0,0,.3)}.joinchat--chatbox .joinchat__button:active,.joinchat--chatbox .joinchat__button:hover{background:var(--hover)}[dir=rtl] .joinchat__button{flex-direction:row-reverse}.joinchat--left .joinchat__button{right:auto;left:8px;flex-direction:row-reverse}[dir=rtl] .joinchat--left .joinchat__button{flex-direction:row}.joinchat__button__open{width:var(--btn);height:var(--btn);background:transparent url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23fff' d='M3.516 3.516c4.686-4.686 12.284-4.686 16.97 0 4.686 4.686 4.686 12.283 0 16.97a12.004 12.004 0 01-13.754 2.299l-5.814.735a.392.392 0 01-.438-.44l.748-5.788A12.002 12.002 0 013.517 3.517zm3.61 17.043l.3.158a9.846 9.846 0 0011.534-1.758c3.843-3.843 3.843-10.074 0-13.918-3.843-3.843-10.075-3.843-13.918 0a9.846 9.846 0 00-1.747 11.554l.16.303-.51 3.942a.196.196 0 00.219.22l3.961-.501zm6.534-7.003l-.933 1.164a9.843 9.843 0 01-3.497-3.495l1.166-.933a.792.792 0 00.23-.94L9.561 6.96a.793.793 0 00-.924-.445 1291.6 1291.6 0 00-2.023.524.797.797 0 00-.588.88 11.754 11.754 0 0010.005 10.005.797.797 0 00.88-.587l.525-2.023a.793.793 0 00-.445-.923L14.6 13.327a.792.792 0 00-.94.23z'/%3E%3C/svg%3E") 50% no-repeat;background-size:60%}.joinchat--chatbox .joinchat__button__open{display:none}.joinchat__button__image{position:absolute;top:1px;right:1px;width:calc(var(--btn) - 2px);height:calc(var(--btn) - 2px);border-radius:50%;overflow:hidden;opacity:0}.joinchat__button__image img{display:block;width:100%;height:100%;object-fit:cover}.joinchat--show .joinchat__button__image{animation:joinchat_image_loop 20s linear 5s infinite normal both}.joinchat--image .joinchat__button__image{opacity:1;animation:none}.joinchat--chatbox .joinchat__button__image{display:none}.joinchat__button__send{display:none;width:var(--btn);height:var(--btn);max-width:var(--btn);padding:12px 11px 12px 13px;margin:0;flex-shrink:0}.joinchat--chatbox .joinchat__button__send{display:block}.joinchat__button__send path{fill:none!important;stroke:var(--text)!important}.joinchat__button__send .joinchat_svg__plain{stroke-dasharray:1097;stroke-dashoffset:1097;animation:joinchat_plain 6s .2s ease-in-out infinite}.joinchat__button__send .joinchat_svg__chat{stroke-dasharray:1020;stroke-dashoffset:1020;animation:joinchat_chat 6s 3.2s ease-in-out infinite}.joinchat__button__sendtext{padding:0;max-width:0;font-weight:600;line-height:var(--btn);white-space:nowrap;opacity:0;overflow:hidden;transition:none}.joinchat--chatbox .joinchat__button__sendtext{padding:0 4px 0 24px;max-width:200px;opacity:1;transition:max-width .2s linear,opacity .4s ease-out .2s}.joinchat--chatbox.joinchat--left .joinchat__button__sendtext{padding:0 24px 0 4px}.joinchat__badge{position:absolute;top:-4px;right:-4px;width:20px;height:20px;border:none;border-radius:50%;background:#e82c0c;color:#fff;font-size:12px;font-weight:600;line-height:20px;text-align:center;box-shadow:none;opacity:0;pointer-events:none}.joinchat__badge.joinchat__badge--in{animation:joinchat_badge_in .5s cubic-bezier(.27,.9,.41,1.28) 1 both}.joinchat__badge.joinchat__badge--out{animation:joinchat_badge_out .4s cubic-bezier(.215,.61,.355,1) 1 both}.joinchat__tooltip{position:absolute;top:14px;right:76px;max-width:calc(100vw - 105px);height:32px;padding:0 14px;border:none;border-radius:16px;background:#fff;color:rgba(0,0,0,.8);line-height:31px;white-space:nowrap;opacity:0;filter:drop-shadow(0 1px 4px rgba(0,0,0,.4));transform:translateZ(0);pointer-events:none}.joinchat__tooltip:after{content:"";display:block;position:absolute;top:10px;right:-6px;border:8px solid transparent;border-width:6px 0 6px 8px;border-left-color:#fff}.joinchat__tooltip div{overflow:hidden;text-overflow:ellipsis}.joinchat--tooltip .joinchat__tooltip{animation:joinchat_tootlip 20s linear 5s 1 normal both}.joinchat--chatbox .joinchat__tooltip{display:none}.joinchat--left .joinchat__tooltip{right:auto;left:76px}.joinchat--left .joinchat__tooltip:after{left:-6px;right:auto;border-color:transparent;border-width:6px 8px 6px 0;border-right-color:#fff}.joinchat__box{display:flex;flex-direction:column;position:absolute;bottom:0;right:0;z-index:1;width:calc(100vw - var(--sep)*2);max-width:400px;min-height:170px;max-height:calc(100vh - var(--bottom) - var(--sep));border-radius:32px;background:transparent;box-shadow:0 2px 6px 0 rgba(0,0,0,.5);text-align:left;overflow:hidden;transform:scale3d(0,0,0);opacity:0;transition:opacity .4s ease-out,transform 0ms linear .3s}.joinchat--chatbox .joinchat__box{opacity:1;transform:scaleX(1);transition:opacity .2s ease-out,transform 0ms linear}.joinchat--left .joinchat__box{right:auto;left:0}.joinchat__header{position:relative;flex-shrink:0;height:var(--header);line-height:var(--header);padding:0 26px;margin:0;background:var(--color);text-align:left}[dir=rtl] .joinchat__header{text-align:right}.joinchat--dark .joinchat__header{background:var(--dark)}.joinchat__copy{font-size:11px;line-height:18px;color:inherit!important;text-decoration:none!important;fill:currentColor;opacity:.8}.joinchat__copy svg{display:inline-block;width:auto;height:18px;vertical-align:-26%}a.joinchat__copy:active,a.joinchat__copy:hover{color:inherit!important;text-decoration:none!important;opacity:.9}.joinchat__close{position:absolute;top:50%;right:24px;width:34px;height:34px;margin-top:-16px;border-radius:50%;background:rgba(0,0,0,.4) url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23fff'%3E%3Cpath d='M24 2.4L21.6 0 12 9.6 2.4 0 0 2.4 9.6 12 0 21.6 2.4 24l9.6-9.6 9.6 9.6 2.4-2.4-9.6-9.6L24 2.4z'/%3E%3C/svg%3E") 50% no-repeat;background-size:12px;cursor:pointer;transition:background-color .3s ease-out;-webkit-tap-highlight-color:rgba(0,0,0,0)}.joinchat__close:hover{background-color:rgba(0,0,0,.6)}[dir=rtl] .joinchat__close{right:auto;left:24px}.joinchat__box__scroll{padding:20px 0 70px;padding-bottom:calc(var(--btn) + 10px);background:#fff linear-gradient(0deg,var(--bg),var(--bg));overflow-x:hidden;overflow-y:auto;will-change:scroll-position}.joinchat__box__scroll::-webkit-scrollbar{width:5px;background:transparent}.joinchat__box__scroll::-webkit-scrollbar-thumb{border-radius:3px;background:transparent}.joinchat__box__scroll:hover::-webkit-scrollbar-thumb{background:rgba(0,0,0,.2)}.joinchat--blur .joinchat__box__scroll{background:rgba(var(--rgb),.2);-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px)}.joinchat--dark .joinchat__box__scroll{background:#1a1a1a}@supports (-webkit-overflow-scrolling:touch){.joinchat__box__scroll{overflow-y:scroll;-webkit-overflow-scrolling:touch}}@media (max-width:480px),(orientation:landscape) and (max-width:767px){.joinchat__close{margin-top:-14px;width:28px;height:28px}.joinchat__box__scroll{padding-top:15px}}@media (color-index:48){.joinchat--dark-auto .joinchat__box__scroll{background:#1a1a1a}.joinchat--dark-auto .joinchat__header{background:var(--dark)}}@media (prefers-color-scheme:dark){.joinchat--dark-auto .joinchat__box__scroll{background:#1a1a1a}.joinchat--dark-auto .joinchat__header{background:var(--dark)}}.joinchat__message{position:relative;min-height:60px;padding:17px 20px;margin:0 26px 26px;border-radius:32px;background:#fff;color:#4a4a4a;filter:drop-shadow(0 1px 2px rgba(0,0,0,.3));transform:translateZ(0)}.joinchat__message:before{content:"";display:block;position:absolute;bottom:20px;left:-15px;width:17px;height:25px;background:inherit;-webkit-clip-path:url(#joinchat__message__peak);clip-path:url(#joinchat__message__peak)}.joinchat--dark .joinchat__message{background:#505050;color:#d8d8d8}@media (color-index:48){.joinchat--dark-auto .joinchat__message{background:#505050;color:#d8d8d8}}@media (prefers-color-scheme:dark){.joinchat--dark-auto .joinchat__message{background:#505050;color:#d8d8d8}}@media (max-width:480px),(orientation:landscape) and (max-width:767px){.joinchat__message{padding:18px 16px;line-height:24px;margin:0 20px 20px}}@keyframes joinchat_badge_in{0%{opacity:0;transform:translateY(50px)}to{opacity:1;transform:translateY(0)}}@keyframes joinchat_badge_out{0%{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(-20px)}}@keyframes joinchat_plain{0%,50%,to{stroke-dashoffset:1097}5%,45%{stroke-dashoffset:0}}@keyframes joinchat_chat{0%,50%,to{stroke-dashoffset:1020}5%,45%{stroke-dashoffset:0}}@keyframes joinchat_image_loop{0%{opacity:0}3%,20%{opacity:1}25%,to{opacity:0}}@keyframes joinchat_tootlip{0%{opacity:0;transform:scaleY(0)}1%,20%{opacity:1;transform:scaleY(1)}25%,to{opacity:0;transform:scaleY(1)}}
public/js/joinchat.js CHANGED
@@ -155,6 +155,8 @@
155
  joinchat_obj.store.setItem('joinchat_views', parseInt(joinchat_obj.store.getItem('joinchat_views') || 0) + 1);
156
 
157
  function joinchat_magic() {
 
 
158
  var button_delay = joinchat_obj.settings.button_delay * 1000;
159
  var chat_delay = joinchat_obj.settings.message_delay * 1000;
160
  var has_cta = !!joinchat_obj.settings.message_hash;
@@ -203,17 +205,17 @@
203
 
204
  // Open Join.chat on mouse over
205
  if (has_chatbox && !joinchat_obj.is_mobile) {
206
- $('.joinchat__button', joinchat_obj.$div)
207
  .mouseenter(function () { timeoutHover = setTimeout(chatbox_show, 1500); })
208
  .mouseleave(function () { clearTimeout(timeoutHover); });
209
  }
210
 
211
- $('.joinchat__button', joinchat_obj.$div).click(joinchat_click);
212
- $('.joinchat__close', joinchat_obj.$div).click(chatbox_hide);
213
 
214
  // Only scroll Join.chat message box (no all body)
215
  // TODO: disable also on touch
216
- $('.joinchat__box__scroll').on('mousewheel DOMMouseScroll', function (e) {
217
  e.preventDefault();
218
  var delta = e.originalEvent.wheelDelta || -e.originalEvent.detail;
219
  this.scrollTop += (delta < 0 ? 1 : -1) * 30;
@@ -248,7 +250,7 @@
248
 
249
  // Open Join.chat when "joinchat_open" or "joinchat_force_show" on viewport
250
  if (has_chatbox && 'IntersectionObserver' in window) {
251
- var $show_on_scroll = $('.joinchat_show,.joinchat_force_show');
252
 
253
  function joinchat_observed(objs) {
254
  $.each(objs, function () {
155
  joinchat_obj.store.setItem('joinchat_views', parseInt(joinchat_obj.store.getItem('joinchat_views') || 0) + 1);
156
 
157
  function joinchat_magic() {
158
+ $(document).trigger('joinchat:starting');
159
+
160
  var button_delay = joinchat_obj.settings.button_delay * 1000;
161
  var chat_delay = joinchat_obj.settings.message_delay * 1000;
162
  var has_cta = !!joinchat_obj.settings.message_hash;
205
 
206
  // Open Join.chat on mouse over
207
  if (has_chatbox && !joinchat_obj.is_mobile) {
208
+ joinchat_obj.$('.joinchat__button')
209
  .mouseenter(function () { timeoutHover = setTimeout(chatbox_show, 1500); })
210
  .mouseleave(function () { clearTimeout(timeoutHover); });
211
  }
212
 
213
+ joinchat_obj.$('.joinchat__button').click(joinchat_click);
214
+ joinchat_obj.$('.joinchat__close').click(chatbox_hide);
215
 
216
  // Only scroll Join.chat message box (no all body)
217
  // TODO: disable also on touch
218
+ joinchat_obj.$('.joinchat__box__scroll').on('mousewheel DOMMouseScroll', function (e) {
219
  e.preventDefault();
220
  var delta = e.originalEvent.wheelDelta || -e.originalEvent.detail;
221
  this.scrollTop += (delta < 0 ? 1 : -1) * 30;
250
 
251
  // Open Join.chat when "joinchat_open" or "joinchat_force_show" on viewport
252
  if (has_chatbox && 'IntersectionObserver' in window) {
253
+ var $show_on_scroll = $('.joinchat_show, .joinchat_force_show');
254
 
255
  function joinchat_observed(objs) {
256
  $.each(objs, function () {
public/js/joinchat.min.js CHANGED
@@ -1 +1 @@
1
- !function(t,o){"use strict";o.joinchat_obj=o.joinchat_obj||{},joinchat_obj=t.extend({$div:null,settings:null,store:null,chatbox:!1,is_mobile:!1},joinchat_obj),joinchat_obj.$=function(o){return t(o||this.$div,this.$div)},joinchat_obj.send_event=function(t,e){var n=o[this.settings.ga_tracker||"ga"];(t=t||"",e=e||"click","function"==typeof n&&"function"==typeof n.getAll)?(n("set","transport","beacon"),n.getAll().forEach(function(o){o.send("event","JoinChat",e,t)})):"function"==typeof gtag&&gtag("event",e,{event_category:"JoinChat",event_label:t,transport_type:"beacon"});"object"==typeof dataLayer&&dataLayer.push({event:"JoinChat",eventAction:e,eventLabel:t}),"function"==typeof fbq&&fbq("trackCustom","JoinChat",{eventAction:e,eventLabel:t})},joinchat_obj.whatsapp_link=function(t,o,e){return((e=void 0!==e?e:this.settings.whatsapp_web&&!this.is_mobile)?"https://web.whatsapp.com/send":"https://api.whatsapp.com/send")+"?phone="+encodeURIComponent(t)+"&text="+encodeURIComponent(o||"")},joinchat_obj.chatbox_show=function(){this.chatbox||(this.chatbox=!0,this.$div.addClass("joinchat--chatbox"),this.settings.message_badge&&this.$(".joinchat__badge").hasClass("joinchat__badge--in")&&this.$(".joinchat__badge").toggleClass("joinchat__badge--in joinchat__badge--out"),t(document).trigger("joinchat:show"))},joinchat_obj.chatbox_hide=function(){this.chatbox&&(this.chatbox=!1,this.$div.removeClass("joinchat--chatbox joinchat--tooltip"),this.settings.message_badge&&this.$(".joinchat__badge").removeClass("joinchat__badge--out"),t(document).trigger("joinchat:hide"))},joinchat_obj.save_hash=function(){var t=this.settings.message_hash||"none",o=(this.store.getItem("joinchat_hashes")||"").split(",").filter(Boolean);-1===o.indexOf(t)&&(o.push(t),this.store.setItem("joinchat_hashes",o.join(",")))},joinchat_obj.open_whatsapp=function(e,n){var i={link:this.whatsapp_link(e||this.settings.telephone,n||this.settings.message_send)},a=new RegExp("^https?://(wa.me|(api|web|chat).whatsapp.com|"+location.hostname.replace(".",".")+")/.*","i");t(document).trigger("joinchat:open",[i,this.settings]),a.test(i.link)?(this.send_event(i.link),o.open(i.link,"joinchat")):console.error("Join.chat: the link doesn't seem safe, it must point to the current domain or whatsapp.com")},t(function(){joinchat_obj.$div=t(".joinchat"),joinchat_obj.settings=joinchat_obj.$div.data("settings"),joinchat_obj.is_mobile=!!navigator.userAgent.match(/Android|iPhone|BlackBerry|IEMobile|Opera Mini/i);try{localStorage.setItem("test",1),localStorage.removeItem("test"),joinchat_obj.store=localStorage}catch(t){joinchat_obj.store={_data:{},setItem:function(t,o){this._data[t]=String(o)},getItem:function(t){return this._data.hasOwnProperty(t)?this._data[t]:null}}}if(void 0===joinchat_obj.settings)try{joinchat_obj.settings=JSON.parse(joinchat_obj.$div.attr("data-settings"))}catch(t){joinchat_obj.settings=void 0}joinchat_obj.$div.length&&joinchat_obj.settings&&joinchat_obj.settings.telephone&&(joinchat_obj.is_mobile||!joinchat_obj.settings.mobile_only?function(){var e,n,i=1e3*joinchat_obj.settings.button_delay,a=1e3*joinchat_obj.settings.message_delay,s=!!joinchat_obj.settings.message_hash,c=!!joinchat_obj.$(".joinchat__box").length,h=parseInt(joinchat_obj.store.getItem("joinchat_views")||1)>=joinchat_obj.settings.message_views,j=-1!==(joinchat_obj.store.getItem("joinchat_hashes")||"").split(",").filter(Boolean).indexOf(joinchat_obj.settings.message_hash||"none");function _(){clearTimeout(n),joinchat_obj.chatbox_show()}function b(){joinchat_obj.save_hash(),joinchat_obj.chatbox_hide()}function r(){c&&!joinchat_obj.chatbox?_():(b(),joinchat_obj.open_whatsapp())}var l="joinchat--show";j||s&&a&&!joinchat_obj.settings.message_badge&&h||(l+=" joinchat--tooltip");setTimeout(function(){joinchat_obj.$div.addClass(l)},i),s&&!j&&a&&(joinchat_obj.settings.message_badge?n=setTimeout(function(){joinchat_obj.$(".joinchat__badge").addClass("joinchat__badge--in")},i+a):h&&(n=setTimeout(_,i+a)));c&&!joinchat_obj.is_mobile&&t(".joinchat__button",joinchat_obj.$div).mouseenter(function(){e=setTimeout(_,1500)}).mouseleave(function(){clearTimeout(e)});if(t(".joinchat__button",joinchat_obj.$div).click(r),t(".joinchat__close",joinchat_obj.$div).click(b),t(".joinchat__box__scroll").on("mousewheel DOMMouseScroll",function(t){t.preventDefault();var o=t.originalEvent.wheelDelta||-t.originalEvent.detail;this.scrollTop+=30*(o<0?1:-1)}),joinchat_obj.is_mobile){var g,u=o.innerHeight;t(document).on("focus blur","input, textarea",function(e){t(e.target).closest(joinchat_obj.$div)||(clearTimeout(g),g=setTimeout(function(){joinchat_obj.$div.toggleClass("joinchat--show",o.innerHeight>.7*u)},800))})}if(t(document).on("click",".joinchat_open",function(t){t.preventDefault(),joinchat_obj.chatbox||r()}),t(document).on("click",".joinchat_close",function(t){t.preventDefault(),b()}),c&&"IntersectionObserver"in o){var d=t(".joinchat_show,.joinchat_force_show");if(d.length>0){var p=new IntersectionObserver(function(o){t.each(o,function(){if(this.intersectionRatio>0&&(!j||t(this.target).hasClass("joinchat_force_show")))return _(),p.disconnect(),!1})});d.each(function(){p.observe(this)})}}t(document).trigger("joinchat:start")}():t(document).on("click",".joinchat_open",function(t){t.preventDefault(),joinchat_obj.open_whatsapp()})),joinchat_obj.store.setItem("joinchat_views",parseInt(joinchat_obj.store.getItem("joinchat_views")||0)+1)})}(jQuery,window);
1
+ !function(t,o){"use strict";o.joinchat_obj=o.joinchat_obj||{},joinchat_obj=t.extend({$div:null,settings:null,store:null,chatbox:!1,is_mobile:!1},joinchat_obj),joinchat_obj.$=function(o){return t(o||this.$div,this.$div)},joinchat_obj.send_event=function(t,e){var n=o[this.settings.ga_tracker||"ga"];(t=t||"",e=e||"click","function"==typeof n&&"function"==typeof n.getAll)?(n("set","transport","beacon"),n.getAll().forEach(function(o){o.send("event","JoinChat",e,t)})):"function"==typeof gtag&&gtag("event",e,{event_category:"JoinChat",event_label:t,transport_type:"beacon"});"object"==typeof dataLayer&&dataLayer.push({event:"JoinChat",eventAction:e,eventLabel:t}),"function"==typeof fbq&&fbq("trackCustom","JoinChat",{eventAction:e,eventLabel:t})},joinchat_obj.whatsapp_link=function(t,o,e){return((e=void 0!==e?e:this.settings.whatsapp_web&&!this.is_mobile)?"https://web.whatsapp.com/send":"https://api.whatsapp.com/send")+"?phone="+encodeURIComponent(t)+"&text="+encodeURIComponent(o||"")},joinchat_obj.chatbox_show=function(){this.chatbox||(this.chatbox=!0,this.$div.addClass("joinchat--chatbox"),this.settings.message_badge&&this.$(".joinchat__badge").hasClass("joinchat__badge--in")&&this.$(".joinchat__badge").toggleClass("joinchat__badge--in joinchat__badge--out"),t(document).trigger("joinchat:show"))},joinchat_obj.chatbox_hide=function(){this.chatbox&&(this.chatbox=!1,this.$div.removeClass("joinchat--chatbox joinchat--tooltip"),this.settings.message_badge&&this.$(".joinchat__badge").removeClass("joinchat__badge--out"),t(document).trigger("joinchat:hide"))},joinchat_obj.save_hash=function(){var t=this.settings.message_hash||"none",o=(this.store.getItem("joinchat_hashes")||"").split(",").filter(Boolean);-1===o.indexOf(t)&&(o.push(t),this.store.setItem("joinchat_hashes",o.join(",")))},joinchat_obj.open_whatsapp=function(e,n){var i={link:this.whatsapp_link(e||this.settings.telephone,n||this.settings.message_send)},a=new RegExp("^https?://(wa.me|(api|web|chat).whatsapp.com|"+location.hostname.replace(".",".")+")/.*","i");t(document).trigger("joinchat:open",[i,this.settings]),a.test(i.link)?(this.send_event(i.link),o.open(i.link,"joinchat")):console.error("Join.chat: the link doesn't seem safe, it must point to the current domain or whatsapp.com")},t(function(){joinchat_obj.$div=t(".joinchat"),joinchat_obj.settings=joinchat_obj.$div.data("settings"),joinchat_obj.is_mobile=!!navigator.userAgent.match(/Android|iPhone|BlackBerry|IEMobile|Opera Mini/i);try{localStorage.setItem("test",1),localStorage.removeItem("test"),joinchat_obj.store=localStorage}catch(t){joinchat_obj.store={_data:{},setItem:function(t,o){this._data[t]=String(o)},getItem:function(t){return this._data.hasOwnProperty(t)?this._data[t]:null}}}if(void 0===joinchat_obj.settings)try{joinchat_obj.settings=JSON.parse(joinchat_obj.$div.attr("data-settings"))}catch(t){joinchat_obj.settings=void 0}joinchat_obj.$div.length&&joinchat_obj.settings&&joinchat_obj.settings.telephone&&(joinchat_obj.is_mobile||!joinchat_obj.settings.mobile_only?function(){t(document).trigger("joinchat:starting");var e,n,i=1e3*joinchat_obj.settings.button_delay,a=1e3*joinchat_obj.settings.message_delay,s=!!joinchat_obj.settings.message_hash,c=!!joinchat_obj.$(".joinchat__box").length,h=parseInt(joinchat_obj.store.getItem("joinchat_views")||1)>=joinchat_obj.settings.message_views,j=-1!==(joinchat_obj.store.getItem("joinchat_hashes")||"").split(",").filter(Boolean).indexOf(joinchat_obj.settings.message_hash||"none");function _(){clearTimeout(n),joinchat_obj.chatbox_show()}function r(){joinchat_obj.save_hash(),joinchat_obj.chatbox_hide()}function b(){c&&!joinchat_obj.chatbox?_():(r(),joinchat_obj.open_whatsapp())}var l="joinchat--show";j||s&&a&&!joinchat_obj.settings.message_badge&&h||(l+=" joinchat--tooltip");setTimeout(function(){joinchat_obj.$div.addClass(l)},i),s&&!j&&a&&(joinchat_obj.settings.message_badge?n=setTimeout(function(){joinchat_obj.$(".joinchat__badge").addClass("joinchat__badge--in")},i+a):h&&(n=setTimeout(_,i+a)));c&&!joinchat_obj.is_mobile&&joinchat_obj.$(".joinchat__button").mouseenter(function(){e=setTimeout(_,1500)}).mouseleave(function(){clearTimeout(e)});if(joinchat_obj.$(".joinchat__button").click(b),joinchat_obj.$(".joinchat__close").click(r),joinchat_obj.$(".joinchat__box__scroll").on("mousewheel DOMMouseScroll",function(t){t.preventDefault();var o=t.originalEvent.wheelDelta||-t.originalEvent.detail;this.scrollTop+=30*(o<0?1:-1)}),joinchat_obj.is_mobile){var g,u=o.innerHeight;t(document).on("focus blur","input, textarea",function(e){t(e.target).closest(joinchat_obj.$div)||(clearTimeout(g),g=setTimeout(function(){joinchat_obj.$div.toggleClass("joinchat--show",o.innerHeight>.7*u)},800))})}if(t(document).on("click",".joinchat_open",function(t){t.preventDefault(),joinchat_obj.chatbox||b()}),t(document).on("click",".joinchat_close",function(t){t.preventDefault(),r()}),c&&"IntersectionObserver"in o){var d=t(".joinchat_show, .joinchat_force_show");if(d.length>0){var p=new IntersectionObserver(function(o){t.each(o,function(){if(this.intersectionRatio>0&&(!j||t(this.target).hasClass("joinchat_force_show")))return _(),p.disconnect(),!1})});d.each(function(){p.observe(this)})}}t(document).trigger("joinchat:start")}():t(document).on("click",".joinchat_open",function(t){t.preventDefault(),joinchat_obj.open_whatsapp()})),joinchat_obj.store.setItem("joinchat_views",parseInt(joinchat_obj.store.getItem("joinchat_views")||0)+1)})}(jQuery,window);