2
0

fix(wp): 🐛 Standard embed when window is loaded

This commit is contained in:
Baptiste Arnaud
2022-05-18 12:30:51 -07:00
parent ac278b9916
commit ad69cc5264
4 changed files with 30 additions and 15 deletions

View File

@@ -1,6 +1,6 @@
{ {
"name": "wordpress", "name": "wordpress",
"version": "2.1.8", "version": "2.1.9",
"main": "index.js", "main": "index.js",
"repository": "https://github.com/baptisteArno/typebot.io", "repository": "https://github.com/baptisteArno/typebot.io",
"author": "baptisteArno", "author": "baptisteArno",
@@ -10,7 +10,7 @@
}, },
"scripts": { "scripts": {
"deploy": "yarn copy && yarn commit", "deploy": "yarn copy && yarn commit",
"copy": "svn copy ./trunk ./tags/2.1.8", "copy": "svn copy ./trunk ./tags/2.1.9",
"commit": "svn ci -m 'Fix proactive message bug'" "commit": "svn ci -m 'Fix standard embed when window loaded'"
} }
} }

View File

@@ -2,10 +2,10 @@
Contributors: baptisteArno Contributors: baptisteArno
Tags: typebot, forms, surveys, quizzes, form builder, survey builder, quiz builder, custom forms, mobile forms, payment forms, order forms, feedback forms, enquiry forms, stripe, dropbox, google sheets, mailchimp, salesforce, hubspot, activecampaign, infusionsoft, asana, hipchat, slack, trello, zendesk Tags: typebot, forms, surveys, quizzes, form builder, survey builder, quiz builder, custom forms, mobile forms, payment forms, order forms, feedback forms, enquiry forms, stripe, dropbox, google sheets, mailchimp, salesforce, hubspot, activecampaign, infusionsoft, asana, hipchat, slack, trello, zendesk
Requires at least: 5.0 Requires at least: 5.0
Tested up to: 5.9.1 Tested up to: 6.0
License: GPL 2.0 License: GPL 2.0
License URI: http://www.gnu.org/licenses/gpl-2.0.txt License URI: http://www.gnu.org/licenses/gpl-2.0.txt
Stable Tag: 2.1.8 Stable Tag: 2.1.9
Build beautiful conversational forms Build beautiful conversational forms
@@ -26,6 +26,9 @@ This plugin relies on Typebot which is a tool that allows you to create conversa
3. Activate your Typebot with the "Typebot" admin button located in the sidebar 3. Activate your Typebot with the "Typebot" admin button located in the sidebar
== Changelog == == Changelog ==
= 2.1.9 =
* Fix standard embed when window is already loaded
= 2.1.8 = = 2.1.8 =
* Fix bubble not displayed with proactive message * Fix bubble not displayed with proactive message

View File

@@ -263,6 +263,16 @@ class Typebot_Public
} }
$container_id = 'typebot-container-' . $this->generateRandomString(4); $container_id = 'typebot-container-' . $this->generateRandomString(4);
$bot_initializer =
'var typebot = Typebot.initContainer("' .
$container_id .
'",{
hiddenVariables: typebotWpUser,
url: "' .
$url .
'",
})';
return '<script>' . return '<script>' .
$this->parse_wp_user() . $this->parse_wp_user() .
'</script>' . '</script>' .
@@ -279,15 +289,17 @@ class Typebot_Public
'" '"
></div> ></div>
<script> <script>
if(document.readyState == "complete"){
' .
$bot_initializer .
'
} else {
window.addEventListener("load",(event) => { window.addEventListener("load",(event) => {
var typebot = Typebot.initContainer("' . ' .
$container_id . $bot_initializer .
'",{ '
hiddenVariables: typebotWpUser, })
url: "' . }
$url .
'",
})})
</script>'; </script>';
} }

View File

@@ -3,7 +3,7 @@
/** /**
* Plugin Name: Typebot * Plugin Name: Typebot
* Description: Convert more with conversational forms * Description: Convert more with conversational forms
* Version: 2.1.8 * Version: 2.1.9
* Author: Typebot * Author: Typebot
* Author URI: http://typebot.io/ * Author URI: http://typebot.io/
* License: GPL-2.0+ * License: GPL-2.0+
@@ -16,7 +16,7 @@ if (!defined('WPINC')) {
die(); die();
} }
define('TYPEBOT_VERSION', '2.1.8'); define('TYPEBOT_VERSION', '2.1.9');
function activate_typebot() function activate_typebot()
{ {