diff --git a/apps/builder/src/features/publish/components/embeds/modals/WordpressModal/instructions/WordpressBubbleInstructions.tsx b/apps/builder/src/features/publish/components/embeds/modals/WordpressModal/instructions/WordpressBubbleInstructions.tsx
index f12678caf..2e8dcb7a0 100644
--- a/apps/builder/src/features/publish/components/embeds/modals/WordpressModal/instructions/WordpressBubbleInstructions.tsx
+++ b/apps/builder/src/features/publish/components/embeds/modals/WordpressModal/instructions/WordpressBubbleInstructions.tsx
@@ -14,6 +14,8 @@ import { useState } from 'react'
import { BubbleSettings } from '../../../settings/BubbleSettings/BubbleSettings'
import { parseInitBubbleCode } from '../../../snippetParsers'
import { parseDefaultBubbleTheme } from '../../Javascript/instructions/JavascriptBubbleInstructions'
+import { isCloudProdInstance } from '@/utils/helpers'
+import { env, getViewerUrl } from 'utils'
type Props = {
publicId: string
@@ -29,6 +31,9 @@ export const WordpressBubbleInstructions = ({ publicId }: Props) => {
const initCode = parseInitBubbleCode({
typebot: publicId,
+ apiHost: isCloudProdInstance
+ ? undefined
+ : env('VIEWER_INTERNAL_URL') ?? getViewerUrl(),
theme: {
...theme,
chatWindow: {
diff --git a/apps/builder/src/features/publish/components/embeds/modals/WordpressModal/instructions/WordpressPopupInstructions.tsx b/apps/builder/src/features/publish/components/embeds/modals/WordpressModal/instructions/WordpressPopupInstructions.tsx
index 9794cddcb..017224657 100644
--- a/apps/builder/src/features/publish/components/embeds/modals/WordpressModal/instructions/WordpressPopupInstructions.tsx
+++ b/apps/builder/src/features/publish/components/embeds/modals/WordpressModal/instructions/WordpressPopupInstructions.tsx
@@ -11,6 +11,8 @@ import {
import { useState } from 'react'
import { PopupSettings } from '../../../settings/PopupSettings'
import { parseInitPopupCode } from '../../../snippetParsers/popup'
+import { isCloudProdInstance } from '@/utils/helpers'
+import { env, getViewerUrl } from 'utils'
type Props = {
publicId: string
@@ -20,6 +22,9 @@ export const WordpressPopupInstructions = ({ publicId }: Props) => {
const initCode = parseInitPopupCode({
typebot: publicId,
+ apiHost: isCloudProdInstance
+ ? undefined
+ : env('VIEWER_INTERNAL_URL') ?? getViewerUrl(),
autoShowDelay,
})
diff --git a/apps/builder/src/features/publish/components/embeds/modals/WordpressModal/instructions/WordpressStandardInstructions.tsx b/apps/builder/src/features/publish/components/embeds/modals/WordpressModal/instructions/WordpressStandardInstructions.tsx
index 33e299777..affadb5bd 100644
--- a/apps/builder/src/features/publish/components/embeds/modals/WordpressModal/instructions/WordpressStandardInstructions.tsx
+++ b/apps/builder/src/features/publish/components/embeds/modals/WordpressModal/instructions/WordpressStandardInstructions.tsx
@@ -11,6 +11,8 @@ import {
} from '@chakra-ui/react'
import { useState } from 'react'
import { StandardSettings } from '../../../settings/StandardSettings'
+import { isCloudProdInstance } from '@/utils/helpers'
+import { env, getViewerUrl } from 'utils'
type Props = {
publicId: string
@@ -73,8 +75,10 @@ const parseWordpressShortcode = ({
height?: string
publicId: string
}) => {
- return `[typebot typebot="${publicId}"${width ? ` width="${width}"` : ''}${
- height ? ` height="${height}"` : ''
- }]
+ return `[typebot typebot="${publicId}"${
+ isCloudProdInstance
+ ? ''
+ : ` apiHost="${env('VIEWER_INTERNAL_URL') ?? getViewerUrl()}"`
+ }${width ? ` width="${width}"` : ''}${height ? ` height="${height}"` : ''}]
`
}
diff --git a/apps/docs/docs/embed/wordpress.md b/apps/docs/docs/embed/wordpress.md
index e175a89e7..620357051 100644
--- a/apps/docs/docs/embed/wordpress.md
+++ b/apps/docs/docs/embed/wordpress.md
@@ -28,6 +28,10 @@ You can use these variables anywhere on your typebot. For more informations, che
There is an a box where there is a list of URLs it localises, one of them was ‘https://cdn.jsdelivr.net’. This URL should be removed from it since it is used to import the embed library.
+## You have litespeed with cache enabled
+
+Make sure to insert `web.js` and `typebot` in the JS Excludes textbox and JS Deferred Excludes under Tuning Settings.
+
### You have a cache plugin
Plugins like WP Rocket prevent Typebot to work.
diff --git a/packages/wordpress/package.json b/packages/wordpress/package.json
index d38c96ced..fbc7071cb 100644
--- a/packages/wordpress/package.json
+++ b/packages/wordpress/package.json
@@ -1,6 +1,6 @@
{
"name": "wordpress",
- "version": "3.1.3",
+ "version": "3.1.4",
"main": "index.js",
"repository": "https://github.com/baptisteArno/typebot.io",
"author": "baptisteArno",
@@ -11,7 +11,7 @@
},
"scripts": {
"deploy": "pnpm copy && pnpm commit",
- "copy": "svn copy ./trunk ./tags/3.1.3",
- "commit": "svn ci -m 'Update plugin metadata and readme'"
+ "copy": "svn copy ./trunk ./tags/3.1.4",
+ "commit": "svn ci -m 'Support for custom apiHost'"
}
}
diff --git a/packages/wordpress/trunk/README.txt b/packages/wordpress/trunk/README.txt
index f9904e23d..547a362d3 100644
--- a/packages/wordpress/trunk/README.txt
+++ b/packages/wordpress/trunk/README.txt
@@ -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
diff --git a/packages/wordpress/trunk/public/class-typebot-public.php b/packages/wordpress/trunk/public/class-typebot-public.php
index 5f5e5f4dd..f664484c2 100644
--- a/packages/wordpress/trunk/public/class-typebot-public.php
+++ b/packages/wordpress/trunk/public/class-typebot-public.php
@@ -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 = '';
+ Typebot.initStandard({ apiHost: "' . $api_host . '", id: "' . $id . '", typebot: "' . $typebot . '", prefilledVariables: { typebotWpUser } });';
return '' . $bot_initializer;
}
diff --git a/packages/wordpress/trunk/typebot.php b/packages/wordpress/trunk/typebot.php
index a91e5c3fc..9de0c45ea 100644
--- a/packages/wordpress/trunk/typebot.php
+++ b/packages/wordpress/trunk/typebot.php
@@ -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()
{