2
0

🐛 Attempt to fix load crash on UC Browser

This commit is contained in:
Baptiste Arnaud
2023-02-25 19:15:43 +01:00
parent c889f302f6
commit 5dd87554c3
11 changed files with 33 additions and 25 deletions

View File

@@ -26,6 +26,7 @@ import { CredentialsDropdown } from '@/features/credentials'
import { useSheets } from '../../hooks/useSheets' import { useSheets } from '../../hooks/useSheets'
import { Sheet } from '../../types' import { Sheet } from '../../types'
import { RowsFilterTableList } from './RowsFilterTableList' import { RowsFilterTableList } from './RowsFilterTableList'
import { createId } from '@paralleldrive/cuid2'
type Props = { type Props = {
options: GoogleSheetsOptions options: GoogleSheetsOptions
@@ -65,21 +66,21 @@ export const GoogleSheetsSettingsBody = ({
case GoogleSheetsAction.GET: { case GoogleSheetsAction.GET: {
const newOptions: GoogleSheetsGetOptions = { const newOptions: GoogleSheetsGetOptions = {
...baseOptions, ...baseOptions,
...defaultGoogleSheetsGetOptions, ...defaultGoogleSheetsGetOptions(createId),
} }
return onOptionsChange({ ...newOptions }) return onOptionsChange({ ...newOptions })
} }
case GoogleSheetsAction.INSERT_ROW: { case GoogleSheetsAction.INSERT_ROW: {
const newOptions: GoogleSheetsInsertRowOptions = { const newOptions: GoogleSheetsInsertRowOptions = {
...baseOptions, ...baseOptions,
...defaultGoogleSheetsInsertOptions, ...defaultGoogleSheetsInsertOptions(createId),
} }
return onOptionsChange({ ...newOptions }) return onOptionsChange({ ...newOptions })
} }
case GoogleSheetsAction.UPDATE_ROW: { case GoogleSheetsAction.UPDATE_ROW: {
const newOptions: GoogleSheetsUpdateRowOptions = { const newOptions: GoogleSheetsUpdateRowOptions = {
...baseOptions, ...baseOptions,
...defaultGoogleSheetsUpdateOptions, ...defaultGoogleSheetsUpdateOptions(createId),
} }
return onOptionsChange({ ...newOptions }) return onOptionsChange({ ...newOptions })
} }

View File

@@ -20,7 +20,6 @@
"aws-sdk": "2.1321.0", "aws-sdk": "2.1321.0",
"bot-engine": "workspace:*", "bot-engine": "workspace:*",
"cors": "2.8.5", "cors": "2.8.5",
"@paralleldrive/cuid2": "2.2.0",
"db": "workspace:*", "db": "workspace:*",
"google-spreadsheet": "3.3.0", "google-spreadsheet": "3.3.0",
"got": "12.5.3", "got": "12.5.3",
@@ -35,6 +34,7 @@
"trpc-openapi": "1.1.2" "trpc-openapi": "1.1.2"
}, },
"devDependencies": { "devDependencies": {
"@paralleldrive/cuid2": "2.2.0",
"@babel/preset-env": "7.20.2", "@babel/preset-env": "7.20.2",
"@faire/mjml-react": "3.1.1", "@faire/mjml-react": "3.1.1",
"@playwright/test": "1.31.1", "@playwright/test": "1.31.1",

View File

@@ -33,5 +33,5 @@
"path": "node_modules/cz-emoji" "path": "node_modules/cz-emoji"
} }
}, },
"packageManager": "pnpm@7.27.1" "packageManager": "pnpm@7.28.0"
} }

View File

@@ -67,7 +67,7 @@ export const ConversationContainer = (props: Props) => {
}) })
const sendMessage = async (message: string | undefined) => { const sendMessage = async (message: string | undefined) => {
const currentBlockId = chatChunks().at(-1)?.input?.id const currentBlockId = [...chatChunks()].pop()?.input?.id
if (currentBlockId && props.onAnswer && message) if (currentBlockId && props.onAnswer && message)
props.onAnswer({ message, blockId: currentBlockId }) props.onAnswer({ message, blockId: currentBlockId })
const longRequest = setTimeout(() => { const longRequest = setTimeout(() => {
@@ -116,7 +116,7 @@ export const ConversationContainer = (props: Props) => {
} }
const handleAllBubblesDisplayed = async () => { const handleAllBubblesDisplayed = async () => {
const lastChunk = chatChunks().at(-1) const lastChunk = [...chatChunks()].pop()
if (!lastChunk) return if (!lastChunk) return
if (isNotDefined(lastChunk.input)) { if (isNotDefined(lastChunk.input)) {
props.onEnd?.() props.onEnd?.()
@@ -124,7 +124,7 @@ export const ConversationContainer = (props: Props) => {
} }
const handleNewBubbleDisplayed = async (blockId: string) => { const handleNewBubbleDisplayed = async (blockId: string) => {
const lastChunk = chatChunks().at(-1) const lastChunk = [...chatChunks()].pop()
if (!lastChunk) return if (!lastChunk) return
if (lastChunk.clientSideActions) { if (lastChunk.clientSideActions) {
const actionsToExecute = lastChunk.clientSideActions.filter( const actionsToExecute = lastChunk.clientSideActions.filter(

View File

@@ -1,6 +1,5 @@
import { z } from 'zod' import { z } from 'zod'
import { ComparisonOperators, LogicalOperator } from '../../logic/condition' import { ComparisonOperators, LogicalOperator } from '../../logic/condition'
import { createId } from '@paralleldrive/cuid2'
import { IntegrationBlockType } from '../enums' import { IntegrationBlockType } from '../enums'
import { GoogleSheetsAction } from './enums' import { GoogleSheetsAction } from './enums'
import { blockBaseSchema } from '../../baseSchemas' import { blockBaseSchema } from '../../baseSchemas'
@@ -72,7 +71,9 @@ export const googleSheetsBlockSchema = blockBaseSchema.and(
export const defaultGoogleSheetsOptions: GoogleSheetsOptions = {} export const defaultGoogleSheetsOptions: GoogleSheetsOptions = {}
export const defaultGoogleSheetsGetOptions: GoogleSheetsGetOptions = { export const defaultGoogleSheetsGetOptions = (
createId: () => string
): GoogleSheetsGetOptions => ({
action: GoogleSheetsAction.GET, action: GoogleSheetsAction.GET,
cellsToExtract: [ cellsToExtract: [
{ {
@@ -87,25 +88,29 @@ export const defaultGoogleSheetsGetOptions: GoogleSheetsGetOptions = {
], ],
logicalOperator: LogicalOperator.AND, logicalOperator: LogicalOperator.AND,
}, },
} })
export const defaultGoogleSheetsInsertOptions: GoogleSheetsInsertRowOptions = { export const defaultGoogleSheetsInsertOptions = (
createId: () => string
): GoogleSheetsInsertRowOptions => ({
action: GoogleSheetsAction.INSERT_ROW, action: GoogleSheetsAction.INSERT_ROW,
cellsToInsert: [ cellsToInsert: [
{ {
id: createId(), id: createId(),
}, },
], ],
} })
export const defaultGoogleSheetsUpdateOptions: GoogleSheetsUpdateRowOptions = { export const defaultGoogleSheetsUpdateOptions = (
createId: () => string
): GoogleSheetsUpdateRowOptions => ({
action: GoogleSheetsAction.UPDATE_ROW, action: GoogleSheetsAction.UPDATE_ROW,
cellsToUpsert: [ cellsToUpsert: [
{ {
id: createId(), id: createId(),
}, },
], ],
} })
export type GoogleSheetsBlock = z.infer<typeof googleSheetsBlockSchema> export type GoogleSheetsBlock = z.infer<typeof googleSheetsBlockSchema>
export type GoogleSheetsOptions = z.infer<typeof googleSheetsOptionsSchema> export type GoogleSheetsOptions = z.infer<typeof googleSheetsOptionsSchema>

View File

@@ -9,7 +9,6 @@
"zod": "3.20.6" "zod": "3.20.6"
}, },
"devDependencies": { "devDependencies": {
"@paralleldrive/cuid2": "2.2.0",
"db": "workspace:*", "db": "workspace:*",
"next": "13.1.6", "next": "13.1.6",
"tsconfig": "workspace:*", "tsconfig": "workspace:*",

View File

@@ -1,6 +1,6 @@
{ {
"name": "wordpress", "name": "wordpress",
"version": "3.1.0", "version": "3.1.1",
"main": "index.js", "main": "index.js",
"repository": "https://github.com/baptisteArno/typebot.io", "repository": "https://github.com/baptisteArno/typebot.io",
"author": "baptisteArno", "author": "baptisteArno",
@@ -11,7 +11,7 @@
}, },
"scripts": { "scripts": {
"deploy": "pnpm copy && pnpm commit", "deploy": "pnpm copy && pnpm commit",
"copy": "svn copy ./trunk ./tags/3.1.0", "copy": "svn copy ./trunk ./tags/3.1.1",
"commit": "svn ci -m 'Fix admin critical bug and introduce excluded pages'" "commit": "svn ci -m 'Fix excluded pages when empty'"
} }
} }

View File

@@ -5,7 +5,7 @@ Requires at least: 5.0
Tested up to: 6.0 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: 3.1.0 Stable Tag: 3.1.1
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 ==
= 3.1.1 =
* Fix excluded pages when empty
= 3.1.0 = = 3.1.0 =
* Breaking change! You will need to import the new code snippet again. * Breaking change! You will need to import the new code snippet again.
* Fix wp admin crash * Fix wp admin crash

View File

@@ -45,6 +45,8 @@ class Typebot_Public
} }
$arr_js = substr($arr_js, 0, -1) . '];'; $arr_js = substr($arr_js, 0, -1) . '];';
echo $arr_js; echo $arr_js;
} else {
echo 'const typebotExcludePaths = null;';
} }
if (get_option('init_snippet') && get_option('init_snippet') !== '') { if (get_option('init_snippet') && get_option('init_snippet') !== '') {

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: 3.1.0 * Version: 3.1.1
* 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', '3.1.0'); define('TYPEBOT_VERSION', '3.1.1');
function activate_typebot() function activate_typebot()
{ {

4
pnpm-lock.yaml generated
View File

@@ -389,7 +389,6 @@ importers:
utils: workspace:* utils: workspace:*
zod: 3.20.6 zod: 3.20.6
dependencies: dependencies:
'@paralleldrive/cuid2': 2.2.0
'@sentry/nextjs': 7.38.0_next@13.1.6+react@18.2.0 '@sentry/nextjs': 7.38.0_next@13.1.6+react@18.2.0
'@trpc/server': 10.12.0 '@trpc/server': 10.12.0
'@typebot.io/js': link:../../packages/js '@typebot.io/js': link:../../packages/js
@@ -412,6 +411,7 @@ importers:
devDependencies: devDependencies:
'@babel/preset-env': 7.20.2_@babel+core@7.21.0 '@babel/preset-env': 7.20.2_@babel+core@7.21.0
'@faire/mjml-react': 3.1.1_7tbcn2mecc3yvuxakflodiks3m '@faire/mjml-react': 3.1.1_7tbcn2mecc3yvuxakflodiks3m
'@paralleldrive/cuid2': 2.2.0
'@playwright/test': 1.31.1 '@playwright/test': 1.31.1
'@types/cors': 2.8.13 '@types/cors': 2.8.13
'@types/google-spreadsheet': 3.3.1 '@types/google-spreadsheet': 3.3.1
@@ -622,7 +622,6 @@ importers:
packages/models: packages/models:
specifiers: specifiers:
'@paralleldrive/cuid2': 2.2.0
db: workspace:* db: workspace:*
next: 13.1.6 next: 13.1.6
tsconfig: workspace:* tsconfig: workspace:*
@@ -631,7 +630,6 @@ importers:
dependencies: dependencies:
zod: 3.20.6 zod: 3.20.6
devDependencies: devDependencies:
'@paralleldrive/cuid2': 2.2.0
db: link:../db db: link:../db
next: 13.1.6_biqbaboplfbrettd7655fr4n2y next: 13.1.6_biqbaboplfbrettd7655fr4n2y
tsconfig: link:../tsconfig tsconfig: link:../tsconfig