fix: csat toggle in inbox form.

This commit is contained in:
Abhinav Raut
2025-01-20 01:08:15 +05:30
parent 0c01b53b09
commit 2ac8fcfd21
3 changed files with 64 additions and 62 deletions
@@ -27,8 +27,7 @@ const breadcrumbLinks = [
const submitForm = (values) => {
const payload = {
name: values.name,
from: values.from,
...values,
channel: inbox.value.channel,
config: {
imap: [{ ...values.imap }],
@@ -3,64 +3,7 @@
class="space-y-6"
:schema="formSchema"
:form="form"
:field-config="{
name: {
description: 'Name for your inbox.'
},
from: {
label: 'From email address',
description: 'From email address. e.g. My Support <mysupport@example.com>'
},
csat_enabled: {
label: 'CSAT',
description: 'Send a CSAT survey after a conversation is marked as resolved.'
},
imap: {
label: 'IMAP',
password: {
inputProps: {
type: 'password',
placeholder: ''
}
},
read_interval: {
label: 'Emails scan interval'
}
},
smtp: {
label: 'SMTP',
max_conns: {
label: 'Max connections',
description: 'Maximum number of concurrent connections to the server.'
},
max_msg_retries: {
label: 'Retries',
description: 'Number of times to retry when a message fails.'
},
idle_timeout: {
label: 'Idle timeout',
description: `IdleTimeout is the maximum time to wait for new activity on a connection
before closing it and removing it from the pool.`
},
wait_timeout: {
label: 'Wait timeout',
description: `PoolWaitTimeout is the maximum time to wait to obtain a connection from
a pool before timing out. This may happen when all open connections are
busy sending e-mails and they're not returning to the pool fast enough.
This is also the timeout used when creating new SMTP connections.
`
},
auth_protocol: {
label: 'Auth protocol'
},
password: {
inputProps: {
type: 'password',
placeholder: ''
}
}
}
}"
:field-config="fieldConfig"
@submit="submitForm"
>
<Button type="submit" :is-loading="isLoading"> {{ props.submitLabel }} </Button>
@@ -91,10 +34,70 @@ const props = defineProps({
},
isLoading: {
type: Boolean,
required: false,
required: false
}
})
const fieldConfig = {
name: {
description: 'Name for your inbox.'
},
from: {
label: 'From email address',
description: 'From email address. e.g. My Support <mysupport@example.com>'
},
csat_enabled: {
label: 'CSAT',
description: 'Send a CSAT survey after a conversation is marked as resolved.',
component: 'switch',
},
imap: {
label: 'IMAP',
password: {
inputProps: {
type: 'password',
placeholder: '••••••••'
}
},
read_interval: {
label: 'Emails scan interval'
}
},
smtp: {
label: 'SMTP',
max_conns: {
label: 'Max connections',
description: 'Maximum number of concurrent connections to the server.'
},
max_msg_retries: {
label: 'Retries',
description: 'Number of times to retry when a message fails.'
},
idle_timeout: {
label: 'Idle timeout',
description: `IdleTimeout is the maximum time to wait for new activity on a connection
before closing it and removing it from the pool.`
},
wait_timeout: {
label: 'Wait timeout',
description: `PoolWaitTimeout is the maximum time to wait to obtain a connection from
a pool before timing out. This may happen when all open connections are
busy sending e-mails and they're not returning to the pool fast enough.
This is also the timeout used when creating new SMTP connections.
`
},
auth_protocol: {
label: 'Auth protocol'
},
password: {
inputProps: {
type: 'password',
placeholder: '••••••••'
}
}
}
}
const form = useForm({
validationSchema: toTypedSchema(formSchema),
initialValues: props.initialValues
@@ -4,7 +4,7 @@ import { isGoDuration } from '@/utils/strings'
export const formSchema = z.object({
name: z.string().describe('Name').default(''),
from: z.string().describe('From address').default(''),
csat_enabled: z.boolean().describe('Enable CSAT').optional(),
csat_enabled: z.boolean().describe('CSAT').default(false),
imap: z
.object({
host: z.string().describe('Host').default('imap.gmail.com'),