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, fonts,
components, components,
colors, colors,

View File

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

View File

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

View File

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