⚡ (wp) Add custom api host for WP plugin
This commit is contained in:
@ -5,7 +5,7 @@ Requires at least: 5.0
|
||||
Tested up to: 6.0
|
||||
License: GPL 2.0
|
||||
License URI: http://www.gnu.org/licenses/gpl-2.0.txt
|
||||
Stable Tag: 3.1.3
|
||||
Stable Tag: 3.1.4
|
||||
|
||||
== Description ==
|
||||
Collect 4x more responses with conversational apps using Typebot.
|
||||
@ -24,6 +24,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 ==
|
||||
= 3.1.4 =
|
||||
* Support for apiHost field in shortcode
|
||||
|
||||
= 3.1.1 =
|
||||
* Fix excluded pages when empty
|
||||
|
||||
|
@ -80,6 +80,7 @@ class Typebot_Public
|
||||
$lib_url = "https://cdn.jsdelivr.net/npm/@typebot.io/js@0.0/dist/web.js";
|
||||
$width = '100%';
|
||||
$height = '500px';
|
||||
$api_host = 'https://api.typebot.io';
|
||||
if (array_key_exists('width', $attributes)) {
|
||||
$width = sanitize_text_field($attributes['width']);
|
||||
}
|
||||
@ -89,6 +90,9 @@ class Typebot_Public
|
||||
if (array_key_exists('typebot', $attributes)) {
|
||||
$typebot = sanitize_text_field($attributes['typebot']);
|
||||
}
|
||||
if (array_key_exists('apiHost', $attributes)) {
|
||||
$api_host = sanitize_text_field($attributes['apiHost']);
|
||||
}
|
||||
if (!$typebot) {
|
||||
return;
|
||||
}
|
||||
@ -97,7 +101,7 @@ class Typebot_Public
|
||||
|
||||
$bot_initializer = '<script type="module">
|
||||
import Typebot from "' . $lib_url . '"
|
||||
Typebot.initStandard({ id: "' . $id . '", typebot: "' . $typebot . '", prefilledVariables: { typebotWpUser } });</script>';
|
||||
Typebot.initStandard({ apiHost: "' . $api_host . '", id: "' . $id . '", typebot: "' . $typebot . '", prefilledVariables: { typebotWpUser } });</script>';
|
||||
|
||||
return '<typebot-standard id="' . $id . '" style="width: ' . $width . '; height: ' . $height . ';"></typebot-standard>' . $bot_initializer;
|
||||
}
|
||||
|
@ -3,7 +3,7 @@
|
||||
/**
|
||||
* Plugin Name: Typebot
|
||||
* Description: Convert more with conversational forms
|
||||
* Version: 3.1.2
|
||||
* Version: 3.1.4
|
||||
* Author: Typebot
|
||||
* Author URI: http://typebot.io/
|
||||
* License: GPL-2.0+
|
||||
@ -16,7 +16,7 @@ if (!defined('WPINC')) {
|
||||
die();
|
||||
}
|
||||
|
||||
define('TYPEBOT_VERSION', '3.1.2');
|
||||
define('TYPEBOT_VERSION', '3.1.4');
|
||||
|
||||
function activate_typebot()
|
||||
{
|
||||
|
Reference in New Issue
Block a user