Skip to content

Commit f550870

Browse files
committed
⚡ (wordpress) Add the lib_version attribute to wp admin panel
Closes
1 parent 6594c56 commit f550870

File tree

8 files changed

+45
-8
lines changed

8 files changed

+45
-8
lines changed

apps/builder/src/features/publish/components/embeds/modals/WordpressModal/instructions/WordpressBubbleInstructions.tsx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,17 @@ import {
88
Link,
99
Stack,
1010
Text,
11+
Code,
1112
} from '@chakra-ui/react'
1213
import { BubbleProps } from '@typebot.io/nextjs'
1314
import { useState } from 'react'
1415
import { BubbleSettings } from '../../../settings/BubbleSettings/BubbleSettings'
1516
import { parseApiHostValue, parseInitBubbleCode } from '../../../snippetParsers'
1617
import { parseDefaultBubbleTheme } from '../../Javascript/instructions/JavascriptBubbleInstructions'
18+
import packageJson from '../../../../../../../../../../packages/embeds/js/package.json'
19+
import { isCloudProdInstance } from '@/helpers/isCloudProdInstance'
20+
21+
const typebotCloudLibraryVersion = '0.2'
1722

1823
type Props = {
1924
publicId: string
@@ -52,6 +57,14 @@ export const WordpressBubbleInstructions = ({ publicId }: Props) => {
5257
<ExternalLinkIcon mx="2px" />
5358
</Link>
5459
</ListItem>
60+
<ListItem>
61+
Set <Code>Library version</Code> to{' '}
62+
<Code>
63+
{isCloudProdInstance()
64+
? typebotCloudLibraryVersion
65+
: packageJson.version}
66+
</Code>
67+
</ListItem>
5568
<ListItem>
5669
<Stack spacing={4}>
5770
<BubbleSettings

apps/builder/src/features/publish/components/embeds/modals/WordpressModal/instructions/WordpressPopupInstructions.tsx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,16 @@ import {
77
Link,
88
Stack,
99
Text,
10+
Code,
1011
} from '@chakra-ui/react'
1112
import { useState } from 'react'
1213
import { PopupSettings } from '../../../settings/PopupSettings'
1314
import { parseInitPopupCode } from '../../../snippetParsers/popup'
1415
import { parseApiHostValue } from '../../../snippetParsers'
16+
import { isCloudProdInstance } from '@/helpers/isCloudProdInstance'
17+
import packageJson from '../../../../../../../../../../packages/embeds/js/package.json'
18+
19+
const typebotCloudLibraryVersion = '0.2'
1520

1621
type Props = {
1722
publicId: string
@@ -42,6 +47,14 @@ export const WordpressPopupInstructions = ({
4247
<ExternalLinkIcon mx="2px" />
4348
</Link>
4449
</ListItem>
50+
<ListItem>
51+
Set <Code>Library version</Code> to{' '}
52+
<Code>
53+
{isCloudProdInstance()
54+
? typebotCloudLibraryVersion
55+
: packageJson.version}
56+
</Code>
57+
</ListItem>
4558
<ListItem>
4659
<Stack spacing={4}>
4760
<PopupSettings
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
{
22
"name": "@typebot.io/wordpress",
3-
"version": "3.5.0",
3+
"version": "3.6.0",
44
"main": "index.js",
55
"repository": "https://github.com/baptisteArno/typebot.io",
66
"author": "baptisteArno",
77
"license": "AGPL-3.0-or-later",
88
"scripts": {
99
"deploy": "pnpm copy && pnpm commit",
10-
"copy": "svn copy ./trunk ./tags/3.5.0",
11-
"commit": "svn ci -m 'Add lib_version attr in shortcode'"
10+
"copy": "svn copy ./trunk ./tags/3.6.0",
11+
"commit": "svn ci -m 'Add lib_version attr in admin panel'"
1212
}
1313
}

packages/embeds/wordpress/trunk/README.txt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
Contributors: baptisteArno
33
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
44
Requires at least: 5.0
5-
Tested up to: 6.0
5+
Tested up to: 6.5
66
License: GPL 2.0
77
License URI: http://www.gnu.org/licenses/gpl-2.0.txt
8-
Stable Tag: 3.5.0
8+
Stable Tag: 3.6.0
99

1010
== Description ==
1111
Collect 4x more responses with conversational apps using Typebot.
@@ -23,6 +23,10 @@ This plugin relies on Typebot which is a tool that allows you to create conversa
2323
2. Activate the plugin through the ‘Plugins’ menu in WordPress
2424
3. Activate your Typebot with the "Typebot" admin button located in the sidebar
2525

26+
== Changelog ==
27+
= 3.6.0 =
28+
* Add the lib_version attribute to wp admin panel
29+
2630
== Changelog ==
2731
= 3.5.0 =
2832
* Add the lib_version attribute in shortcode

packages/embeds/wordpress/trunk/admin/class-typebot-admin.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ public function typebot_settings_callback()
2525

2626
public function register_typebot_settings()
2727
{
28+
register_setting('typebot', 'lib_version');
2829
register_setting('typebot', 'init_snippet');
2930
register_setting('typebot', 'excluded_pages');
3031
}

packages/embeds/wordpress/trunk/admin/partials/typebot-admin-display.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@
99
settings_fields('typebot');
1010
do_settings_sections('typebot');
1111
?>
12+
<div style="display: flex; flex-direction: column">
13+
<label>Library version:</label>
14+
<input name="lib_version" value="<?php echo esc_attr(get_option('lib_version') !== null && get_option('lib_version') !== '' ? get_option('lib_version') : '0.2'); ?>" style="padding: .5rem" />
15+
</div>
16+
1217
<div style="display: flex; flex-direction: column">
1318
<label>If embedding as <strong>Popup</strong> or <strong>Bubble</strong>, paste the initialization snippet here:</label>
1419
<textarea name="init_snippet" style="min-height: 150px; padding: 0.5rem; margin-top: 1rem"><?php echo esc_attr(get_option('init_snippet')); ?></textarea>

packages/embeds/wordpress/trunk/public/class-typebot-public.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ public function add_head_code()
4040

4141
function typebot_script()
4242
{
43-
echo '<script type="module">import Typebot from "https://cdn.jsdelivr.net/npm/@typebot.io/[email protected]/dist/web.js";';
43+
$lib_version = get_option('lib_version') !== null && get_option('lib_version') !== '' ? get_option('lib_version') : '0.2';
44+
echo '<script type="module">import Typebot from "https://cdn.jsdelivr.net/npm/@typebot.io/js@'.$lib_version.'/dist/web.js";';
4445
if (
4546
get_option('excluded_pages') !== null &&
4647
get_option('excluded_pages') !== ''

packages/embeds/wordpress/trunk/typebot.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
/**
44
* Plugin Name: Typebot
55
* Description: Convert more with conversational forms
6-
* Version: 3.5.0
6+
* Version: 3.6.0
77
* Author: Typebot
88
* Author URI: http://typebot.io/
99
* License: GPL-2.0+
@@ -16,7 +16,7 @@
1616
die();
1717
}
1818

19-
define('TYPEBOT_VERSION', '3.5.0');
19+
define('TYPEBOT_VERSION', '3.6.0');
2020

2121
function activate_typebot()
2222
{

0 commit comments

Comments
 (0)