2
0

🐛 (googleAnalytics) Fix sendTo initial value in settings

This commit is contained in:
Baptiste Arnaud
2023-05-02 13:46:49 -04:00
parent e58016e43a
commit e2836f305c
4 changed files with 12 additions and 10 deletions

View File

@@ -1,4 +1,4 @@
import { TextInput } from '@/components/inputs'
import { NumberInput, TextInput } from '@/components/inputs'
import {
Accordion,
AccordionButton,
@@ -31,10 +31,10 @@ export const GoogleAnalyticsSettings = ({
const updateLabel = (label: string) => onOptionsChange({ ...options, label })
const updateValue = (value?: string) =>
const updateValue = (value: number | `{{${string}}}` | undefined) =>
onOptionsChange({
...options,
value: value ? parseFloat(value) : undefined,
value,
})
const updateSendTo = (sendTo?: string) =>
@@ -80,16 +80,17 @@ export const GoogleAnalyticsSettings = ({
placeholder="Example: Campaign Z"
onChange={updateLabel}
/>
<TextInput
<NumberInput
direction="column"
label="Event value:"
defaultValue={options?.value?.toString() ?? ''}
defaultValue={options?.value}
placeholder="Example: 0"
onChange={updateValue}
onValueChange={updateValue}
/>
<TextInput
label="Send to:"
moreInfoTooltip="Useful to send a conversion event to Google Ads"
defaultValue={options?.value?.toString() ?? ''}
defaultValue={options?.sendTo?.toString() ?? ''}
placeholder="Example: AW-123456789"
onChange={updateSendTo}
/>