Skip to content

Commit

Permalink
fix(wp): 🐛 Standard embed when window is loaded
Browse files Browse the repository at this point in the history
  • Loading branch information
baptisteArno committed May 18, 2022
1 parent ac278b9 commit ad69cc5
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 15 deletions.
6 changes: 3 additions & 3 deletions packages/wordpress/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "wordpress",
"version": "2.1.8",
"version": "2.1.9",
"main": "index.js",
"repository": "https://github.com/baptisteArno/typebot.io",
"author": "baptisteArno",
Expand All @@ -10,7 +10,7 @@
},
"scripts": {
"deploy": "yarn copy && yarn commit",
"copy": "svn copy ./trunk ./tags/2.1.8",
"commit": "svn ci -m 'Fix proactive message bug'"
"copy": "svn copy ./trunk ./tags/2.1.9",
"commit": "svn ci -m 'Fix standard embed when window loaded'"
}
}
7 changes: 5 additions & 2 deletions packages/wordpress/trunk/README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
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
Requires at least: 5.0
Tested up to: 5.9.1
Tested up to: 6.0
License: GPL 2.0
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

Expand All @@ -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

== Changelog ==
= 2.1.9 =
* Fix standard embed when window is already loaded

= 2.1.8 =
* Fix bubble not displayed with proactive message

Expand Down
28 changes: 20 additions & 8 deletions packages/wordpress/trunk/public/class-typebot-public.php
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,16 @@ public function add_typebot_container($attributes = [])
}
$container_id = 'typebot-container-' . $this->generateRandomString(4);

$bot_initializer =
'var typebot = Typebot.initContainer("' .
$container_id .
'",{
hiddenVariables: typebotWpUser,
url: "' .
$url .
'",
})';

return '<script>' .
$this->parse_wp_user() .
'</script>' .
Expand All @@ -279,15 +289,17 @@ public function add_typebot_container($attributes = [])
'"
></div>
<script>
if(document.readyState == "complete"){
' .
$bot_initializer .
'
} else {
window.addEventListener("load",(event) => {
var typebot = Typebot.initContainer("' .
$container_id .
'",{
hiddenVariables: typebotWpUser,
url: "' .
$url .
'",
})})
' .
$bot_initializer .
'
})
}
</script>';
}

Expand Down
4 changes: 2 additions & 2 deletions packages/wordpress/trunk/typebot.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/**
* Plugin Name: Typebot
* Description: Convert more with conversational forms
* Version: 2.1.8
* Version: 2.1.9
* Author: Typebot
* Author URI: http://typebot.io/
* License: GPL-2.0+
Expand All @@ -16,7 +16,7 @@
die();
}

define('TYPEBOT_VERSION', '2.1.8');
define('TYPEBOT_VERSION', '2.1.9');

function activate_typebot()
{
Expand Down

4 comments on commit ad69cc5

@vercel
Copy link

@vercel vercel bot commented on ad69cc5 May 18, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on ad69cc5 May 18, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on ad69cc5 May 18, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

builder-v2 – ./apps/builder

builder-v2-git-main-typebot-io.vercel.app
builder-v2-typebot-io.vercel.app
app.typebot.io

Please sign in to comment.