@@ -12,13 +12,15 @@ type Props = {
|
||||
}
|
||||
|
||||
export const ButtonsBlockSettings = ({ options, onOptionsChange }: Props) => {
|
||||
const handleIsMultipleChange = (isMultipleChoice: boolean) =>
|
||||
const updateIsMultiple = (isMultipleChoice: boolean) =>
|
||||
options && onOptionsChange({ ...options, isMultipleChoice })
|
||||
const handleButtonLabelChange = (buttonLabel: string) =>
|
||||
const updateIsSearchable = (isSearchable: boolean) =>
|
||||
options && onOptionsChange({ ...options, isSearchable })
|
||||
const updateButtonLabel = (buttonLabel: string) =>
|
||||
options && onOptionsChange({ ...options, buttonLabel })
|
||||
const handleVariableChange = (variable?: Variable) =>
|
||||
const updateSaveVariable = (variable?: Variable) =>
|
||||
options && onOptionsChange({ ...options, variableId: variable?.id })
|
||||
const handleDynamicVariableChange = (variable?: Variable) =>
|
||||
const updateDynamicDataVariable = (variable?: Variable) =>
|
||||
options && onOptionsChange({ ...options, dynamicVariableId: variable?.id })
|
||||
|
||||
return (
|
||||
@@ -26,18 +28,23 @@ export const ButtonsBlockSettings = ({ options, onOptionsChange }: Props) => {
|
||||
<SwitchWithLabel
|
||||
label="Multiple choice?"
|
||||
initialValue={options?.isMultipleChoice ?? false}
|
||||
onCheckChange={handleIsMultipleChange}
|
||||
onCheckChange={updateIsMultiple}
|
||||
/>
|
||||
<SwitchWithLabel
|
||||
label="Is searchable?"
|
||||
initialValue={options?.isSearchable ?? false}
|
||||
onCheckChange={updateIsSearchable}
|
||||
/>
|
||||
{options?.isMultipleChoice && (
|
||||
<TextInput
|
||||
label="Button label:"
|
||||
defaultValue={options?.buttonLabel ?? 'Send'}
|
||||
onChange={handleButtonLabelChange}
|
||||
onChange={updateButtonLabel}
|
||||
/>
|
||||
)}
|
||||
<FormControl>
|
||||
<FormLabel>
|
||||
Dynamic items from variable:{' '}
|
||||
Dynamic data:{' '}
|
||||
<MoreInfoTooltip>
|
||||
If defined, buttons will be dynamically displayed based on what the
|
||||
variable contains.
|
||||
@@ -45,7 +52,7 @@ export const ButtonsBlockSettings = ({ options, onOptionsChange }: Props) => {
|
||||
</FormLabel>
|
||||
<VariableSearchInput
|
||||
initialVariableId={options?.dynamicVariableId}
|
||||
onSelectVariable={handleDynamicVariableChange}
|
||||
onSelectVariable={updateDynamicDataVariable}
|
||||
/>
|
||||
</FormControl>
|
||||
<Stack>
|
||||
@@ -54,7 +61,7 @@ export const ButtonsBlockSettings = ({ options, onOptionsChange }: Props) => {
|
||||
</FormLabel>
|
||||
<VariableSearchInput
|
||||
initialVariableId={options?.variableId}
|
||||
onSelectVariable={handleVariableChange}
|
||||
onSelectVariable={updateSaveVariable}
|
||||
/>
|
||||
</Stack>
|
||||
</Stack>
|
||||
|
||||
@@ -295,6 +295,54 @@
|
||||
"data"
|
||||
],
|
||||
"additionalProperties": false
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"userId": {
|
||||
"type": "string"
|
||||
},
|
||||
"workspaceId": {
|
||||
"type": "string"
|
||||
},
|
||||
"name": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"Workspace limit reached"
|
||||
]
|
||||
},
|
||||
"data": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"chatsLimit": {
|
||||
"type": "number"
|
||||
},
|
||||
"storageLimit": {
|
||||
"type": "number"
|
||||
},
|
||||
"totalChatsUsed": {
|
||||
"type": "number"
|
||||
},
|
||||
"totalStorageUsed": {
|
||||
"type": "number"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"chatsLimit",
|
||||
"storageLimit",
|
||||
"totalChatsUsed",
|
||||
"totalStorageUsed"
|
||||
],
|
||||
"additionalProperties": false
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"userId",
|
||||
"workspaceId",
|
||||
"name",
|
||||
"data"
|
||||
],
|
||||
"additionalProperties": false
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -798,6 +846,9 @@
|
||||
},
|
||||
"dynamicVariableId": {
|
||||
"type": "string"
|
||||
},
|
||||
"isSearchable": {
|
||||
"type": "boolean"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
@@ -1743,6 +1794,121 @@
|
||||
"options"
|
||||
],
|
||||
"additionalProperties": false
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
"groupId": {
|
||||
"type": "string"
|
||||
},
|
||||
"outgoingEdgeId": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"AB test"
|
||||
]
|
||||
},
|
||||
"items": {
|
||||
"type": "array",
|
||||
"minItems": 2,
|
||||
"maxItems": 2,
|
||||
"items": [
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
"blockId": {
|
||||
"type": "string"
|
||||
},
|
||||
"outgoingEdgeId": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": {
|
||||
"type": "number",
|
||||
"enum": [
|
||||
2
|
||||
]
|
||||
},
|
||||
"path": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"a"
|
||||
]
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"id",
|
||||
"blockId",
|
||||
"type",
|
||||
"path"
|
||||
],
|
||||
"additionalProperties": false
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
"blockId": {
|
||||
"type": "string"
|
||||
},
|
||||
"outgoingEdgeId": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": {
|
||||
"type": "number",
|
||||
"enum": [
|
||||
2
|
||||
]
|
||||
},
|
||||
"path": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"b"
|
||||
]
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"id",
|
||||
"blockId",
|
||||
"type",
|
||||
"path"
|
||||
],
|
||||
"additionalProperties": false
|
||||
}
|
||||
]
|
||||
},
|
||||
"options": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"aPercent": {
|
||||
"type": "number",
|
||||
"minimum": 0,
|
||||
"maximum": 100
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"aPercent"
|
||||
],
|
||||
"additionalProperties": false
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"id",
|
||||
"groupId",
|
||||
"type",
|
||||
"items",
|
||||
"options"
|
||||
],
|
||||
"additionalProperties": false
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -3075,6 +3241,9 @@
|
||||
"customSeatsLimit": {
|
||||
"type": "number",
|
||||
"nullable": true
|
||||
},
|
||||
"isQuarantined": {
|
||||
"type": "boolean"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
@@ -3093,7 +3262,8 @@
|
||||
"storageLimitSecondEmailSentAt",
|
||||
"customChatsLimit",
|
||||
"customStorageLimit",
|
||||
"customSeatsLimit"
|
||||
"customSeatsLimit",
|
||||
"isQuarantined"
|
||||
],
|
||||
"additionalProperties": false
|
||||
}
|
||||
@@ -3216,6 +3386,9 @@
|
||||
"customSeatsLimit": {
|
||||
"type": "number",
|
||||
"nullable": true
|
||||
},
|
||||
"isQuarantined": {
|
||||
"type": "boolean"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
@@ -3234,7 +3407,8 @@
|
||||
"storageLimitSecondEmailSentAt",
|
||||
"customChatsLimit",
|
||||
"customStorageLimit",
|
||||
"customSeatsLimit"
|
||||
"customSeatsLimit",
|
||||
"isQuarantined"
|
||||
],
|
||||
"additionalProperties": false
|
||||
}
|
||||
@@ -3374,6 +3548,9 @@
|
||||
"customSeatsLimit": {
|
||||
"type": "number",
|
||||
"nullable": true
|
||||
},
|
||||
"isQuarantined": {
|
||||
"type": "boolean"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
@@ -3392,7 +3569,8 @@
|
||||
"storageLimitSecondEmailSentAt",
|
||||
"customChatsLimit",
|
||||
"customStorageLimit",
|
||||
"customSeatsLimit"
|
||||
"customSeatsLimit",
|
||||
"isQuarantined"
|
||||
],
|
||||
"additionalProperties": false
|
||||
}
|
||||
@@ -4642,6 +4820,9 @@
|
||||
"customSeatsLimit": {
|
||||
"type": "number",
|
||||
"nullable": true
|
||||
},
|
||||
"isQuarantined": {
|
||||
"type": "boolean"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
@@ -4660,7 +4841,8 @@
|
||||
"storageLimitSecondEmailSentAt",
|
||||
"customChatsLimit",
|
||||
"customStorageLimit",
|
||||
"customSeatsLimit"
|
||||
"customSeatsLimit",
|
||||
"isQuarantined"
|
||||
],
|
||||
"additionalProperties": false
|
||||
}
|
||||
|
||||
@@ -459,6 +459,9 @@
|
||||
},
|
||||
"dynamicVariableId": {
|
||||
"type": "string"
|
||||
},
|
||||
"isSearchable": {
|
||||
"type": "boolean"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
@@ -1404,6 +1407,121 @@
|
||||
"options"
|
||||
],
|
||||
"additionalProperties": false
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
"groupId": {
|
||||
"type": "string"
|
||||
},
|
||||
"outgoingEdgeId": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"AB test"
|
||||
]
|
||||
},
|
||||
"items": {
|
||||
"type": "array",
|
||||
"minItems": 2,
|
||||
"maxItems": 2,
|
||||
"items": [
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
"blockId": {
|
||||
"type": "string"
|
||||
},
|
||||
"outgoingEdgeId": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": {
|
||||
"type": "number",
|
||||
"enum": [
|
||||
2
|
||||
]
|
||||
},
|
||||
"path": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"a"
|
||||
]
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"id",
|
||||
"blockId",
|
||||
"type",
|
||||
"path"
|
||||
],
|
||||
"additionalProperties": false
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
"blockId": {
|
||||
"type": "string"
|
||||
},
|
||||
"outgoingEdgeId": {
|
||||
"type": "string"
|
||||
},
|
||||
"type": {
|
||||
"type": "number",
|
||||
"enum": [
|
||||
2
|
||||
]
|
||||
},
|
||||
"path": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"b"
|
||||
]
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"id",
|
||||
"blockId",
|
||||
"type",
|
||||
"path"
|
||||
],
|
||||
"additionalProperties": false
|
||||
}
|
||||
]
|
||||
},
|
||||
"options": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"aPercent": {
|
||||
"type": "number",
|
||||
"minimum": 0,
|
||||
"maximum": 100
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"aPercent"
|
||||
],
|
||||
"additionalProperties": false
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"id",
|
||||
"groupId",
|
||||
"type",
|
||||
"items",
|
||||
"options"
|
||||
],
|
||||
"additionalProperties": false
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -3182,6 +3300,9 @@
|
||||
},
|
||||
"dynamicVariableId": {
|
||||
"type": "string"
|
||||
},
|
||||
"isSearchable": {
|
||||
"type": "boolean"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
|
||||
Reference in New Issue
Block a user