2
0

♻️ Fix eslint warnings

This commit is contained in:
Baptiste Arnaud
2023-02-23 07:48:11 +01:00
parent 889e6a4f7e
commit be4c8e0760
4 changed files with 20 additions and 20 deletions

View File

@ -92,7 +92,7 @@ const components = {
},
}
export const theme: any = extendTheme({
export const theme = extendTheme({
fonts,
components,
colors,

View File

@ -13,6 +13,7 @@ import {
import { setCssVariablesValue } from '@/utils/setCssVariablesValue'
export type BotProps = {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
typebot: string | any
isPreview?: boolean
resultId?: string

View File

@ -103,6 +103,13 @@ const Input = (props: {
const getPrefilledValue = () =>
props.isInputPrefillEnabled ? props.block.prefilledValue : undefined
const submitPaymentSuccess = () =>
props.onSubmit({
value:
(props.block.options as PaymentInputOptions).labels.success ??
'Success',
})
return (
<Switch>
<Match when={props.block.type === InputBlockType.TEXT}>
@ -182,13 +189,7 @@ const Input = (props: {
...props.block.runtimeOptions,
} as PaymentInputOptions & RuntimeOptions
}
onSuccess={() =>
props.onSubmit({
value:
(props.block.options as PaymentInputOptions).labels.success ??
'Success',
})
}
onSuccess={submitPaymentSuccess}
/>
</Match>
</Switch>

View File

@ -8,20 +8,18 @@ export const LiteBadge = (props: Props) => {
let liteBadge: HTMLAnchorElement | undefined
let observer: MutationObserver | undefined
onMount(() => {
if (!document || !props.botContainer) return
observer = new MutationObserver(function (mutations_list) {
mutations_list.forEach(function (mutation) {
mutation.removedNodes.forEach(function (removed_node) {
if (
'id' in removed_node &&
liteBadge &&
removed_node.id == 'lite-badge'
)
props.botContainer?.append(liteBadge)
})
const appendBadgeIfNecessary = (mutations: MutationRecord[]) => {
mutations.forEach((mutation) => {
mutation.removedNodes.forEach((removedNode) => {
if ('id' in removedNode && liteBadge && removedNode.id == 'lite-badge')
props.botContainer?.append(liteBadge)
})
})
}
onMount(() => {
if (!document || !props.botContainer) return
observer = new MutationObserver(appendBadgeIfNecessary)
observer.observe(props.botContainer, {
subtree: false,
childList: true,