fix: remove effects from UI

This commit is contained in:
yassinedorbozgithub 2024-10-20 07:13:00 +01:00
parent dbc651a314
commit 5de0532a52
6 changed files with 106 additions and 42 deletions

View File

@ -278,7 +278,6 @@
"options": "Options",
"seconds": "Seconds",
"typing_indicator": "Typing indicator",
"effects": "Apply plugin effects",
"enable_fallback": "Enable Fallback?",
"max_fallback_attempts": "Max Fallback Attempts",
"fallback_message": "Fallback Message",

View File

@ -278,7 +278,6 @@
"options": "Options",
"seconds": "Secondes",
"typing_indicator": "Indicateur de frappe",
"effects": "Appliquer les effets des plugins",
"enable_fallback": "Activer le message de secours?",
"max_fallback_attempts": "Nombre maximum de tentatives de secours",
"fallback_message": "Message de secours",

View File

@ -21,7 +21,6 @@ export const SIMPLE_TEXT_BLOCK_TEMPLATE: Partial<IBlockAttributes> = {
options: {
typing: 0,
fallback: { active: false, max_attempts: 1, message: [] },
effects: [],
},
message: ["Hi back !"],
starts_conversation: false,
@ -32,7 +31,6 @@ export const ATTACHMENT_BLOCK_TEMPLATE: Partial<IBlockAttributes> = {
options: {
typing: 0,
fallback: { active: false, max_attempts: 1, message: [] },
effects: [],
},
message: {
attachment: {
@ -49,7 +47,6 @@ export const QUICK_REPLIES_BLOCK_TEMPLATE: Partial<IBlockAttributes> = {
options: {
typing: 0,
fallback: { active: false, max_attempts: 1, message: [] },
effects: [],
},
message: {
text: "What's your favorite color?",
@ -75,7 +72,6 @@ export const BUTTONS_BLOCK_TEMPLATE: Partial<IBlockAttributes> = {
options: {
typing: 0,
fallback: { active: false, max_attempts: 1, message: [] },
effects: [],
},
message: {
text: "What would you like to know about us?",
@ -119,7 +115,6 @@ export const LIST_BLOCK_TEMPLATE: Partial<IBlockAttributes> = {
},
],
},
effects: [],
},
message: { elements: true } as unknown as StdOutgoingListMessage,
starts_conversation: false,
@ -137,7 +132,6 @@ export const CUSTOM_BLOCK_TEMPLATE: Partial<IBlockAttributes> = {
options: {
typing: 0,
fallback: { active: false, max_attempts: 1, message: [] },
effects: [],
},
starts_conversation: false,
message: {

View File

@ -15,7 +15,7 @@ import AutoCompleteEntitySelect from "@/app-components/inputs/AutoCompleteEntity
import { Input } from "@/app-components/inputs/Input";
import { useTranslate } from "@/hooks/useTranslate";
import { EntityType, Format } from "@/services/types";
import { IBlockAttributes, ICustomBlockTemplate } from "@/types/block.types";
import { IBlockAttributes } from "@/types/block.types";
import { ILabelFull } from "@/types/label.types";
import { IUser } from "@/types/user.types";
@ -100,38 +100,6 @@ export const OptionsForm = () => {
}}
/>
</ContentItem>
<ContentItem>
<Controller
name="options.effects"
control={control}
defaultValue={block?.options?.effects || []}
render={({ field }) => {
const { onChange, ...rest } = field;
return (
<AutoCompleteEntitySelect<ICustomBlockTemplate, "id">
searchFields={["id"]}
entity={EntityType.CUSTOM_BLOCK}
format={Format.BASIC}
idKey="id"
labelKey="id"
label={t("label.effects")}
multiple={true}
getOptionLabel={(option) => {
return t(`title.${option.id}`, { ns: option.id });
}}
onChange={(_e, selected) =>
onChange(selected.map(({ id }) => id))
}
preprocess={(options) => {
return options.filter(({ effects }) => effects.length > 0);
}}
{...rest}
/>
);
}}
/>
</ContentItem>
<ContentItem>
<Controller
name="options.fallback"

View File

@ -50,7 +50,6 @@ export interface BlockOptions {
fallback?: BlockFallbackOptions;
assignTo?: string;
// plugins effects
effects?: string[];
}
export type BlockMessage =

105
package-lock.json generated
View File

@ -2173,6 +2173,66 @@
"glob": "10.3.10"
}
},
"node_modules/@next/swc-darwin-arm64": {
"version": "14.2.13",
"resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-14.2.13.tgz",
"integrity": "sha512-IkAmQEa2Htq+wHACBxOsslt+jMoV3msvxCn0WFSfJSkv/scy+i/EukBKNad36grRxywaXUYJc9mxEGkeIs8Bzg==",
"cpu": [
"arm64"
],
"optional": true,
"os": [
"darwin"
],
"engines": {
"node": ">= 10"
}
},
"node_modules/@next/swc-darwin-x64": {
"version": "14.2.13",
"resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-14.2.13.tgz",
"integrity": "sha512-Dv1RBGs2TTjkwEnFMVL5XIfJEavnLqqwYSD6LXgTPdEy/u6FlSrLBSSfe1pcfqhFEXRAgVL3Wpjibe5wXJzWog==",
"cpu": [
"x64"
],
"optional": true,
"os": [
"darwin"
],
"engines": {
"node": ">= 10"
}
},
"node_modules/@next/swc-linux-arm64-gnu": {
"version": "14.2.13",
"resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-14.2.13.tgz",
"integrity": "sha512-yB1tYEFFqo4ZNWkwrJultbsw7NPAAxlPXURXioRl9SdW6aIefOLS+0TEsKrWBtbJ9moTDgU3HRILL6QBQnMevg==",
"cpu": [
"arm64"
],
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">= 10"
}
},
"node_modules/@next/swc-linux-arm64-musl": {
"version": "14.2.13",
"resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-14.2.13.tgz",
"integrity": "sha512-v5jZ/FV/eHGoWhMKYrsAweQ7CWb8xsWGM/8m1mwwZQ/sutJjoFaXchwK4pX8NqwImILEvQmZWyb8pPTcP7htWg==",
"cpu": [
"arm64"
],
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">= 10"
}
},
"node_modules/@next/swc-linux-x64-gnu": {
"version": "14.2.13",
"resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-14.2.13.tgz",
@ -2203,6 +2263,51 @@
"node": ">= 10"
}
},
"node_modules/@next/swc-win32-arm64-msvc": {
"version": "14.2.13",
"resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-14.2.13.tgz",
"integrity": "sha512-uP1XkqCqV2NVH9+g2sC7qIw+w2tRbcMiXFEbMihkQ8B1+V6m28sshBwAB0SDmOe0u44ne1vFU66+gx/28RsBVQ==",
"cpu": [
"arm64"
],
"optional": true,
"os": [
"win32"
],
"engines": {
"node": ">= 10"
}
},
"node_modules/@next/swc-win32-ia32-msvc": {
"version": "14.2.13",
"resolved": "https://registry.npmjs.org/@next/swc-win32-ia32-msvc/-/swc-win32-ia32-msvc-14.2.13.tgz",
"integrity": "sha512-V26ezyjPqQpDBV4lcWIh8B/QICQ4v+M5Bo9ykLN+sqeKKBxJVDpEc6biDVyluTXTC40f5IqCU0ttth7Es2ZuMw==",
"cpu": [
"ia32"
],
"optional": true,
"os": [
"win32"
],
"engines": {
"node": ">= 10"
}
},
"node_modules/@next/swc-win32-x64-msvc": {
"version": "14.2.13",
"resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-14.2.13.tgz",
"integrity": "sha512-WwzOEAFBGhlDHE5Z73mNU8CO8mqMNLqaG+AO9ETmzdCQlJhVtWZnOl2+rqgVQS+YHunjOWptdFmNfbpwcUuEsw==",
"cpu": [
"x64"
],
"optional": true,
"os": [
"win32"
],
"engines": {
"node": ">= 10"
}
},
"node_modules/@nodelib/fs.scandir": {
"version": "2.1.5",
"resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz",