-
-
{step.type === 'url' ? : }
+
+ handleRemoveStep(index)}
+ >
+
+
+ {step.type === 'url' ? : }
+
+
{step.value}
- {step.value}
-
-
+
+
+ {(close: () => void) => (
+
+
+
+ )}
+
+
);
})}
diff --git a/src/app/(main)/reports/funnel/FunnelStepAddForm.tsx b/src/app/(main)/reports/funnel/FunnelStepAddForm.tsx
index 978747c9..7d77b0c7 100644
--- a/src/app/(main)/reports/funnel/FunnelStepAddForm.tsx
+++ b/src/app/(main)/reports/funnel/FunnelStepAddForm.tsx
@@ -3,13 +3,18 @@ import { useMessages } from 'components/hooks';
import { Button, FormRow, TextField, Flexbox, Dropdown, Item } from 'react-basics';
import styles from './FunnelStepAddForm.module.css';
-export interface UrlAddFormProps {
- defaultValue?: string;
- onAdd?: (step: { type: string; value: string }) => void;
+export interface FunnelStepAddFormProps {
+ type?: string;
+ value?: string;
+ onChange?: (step: { type: string; value: string }) => void;
}
-export function FunnelStepAddForm({ defaultValue = '', onAdd }: UrlAddFormProps) {
- const [type, setType] = useState('url');
+export function FunnelStepAddForm({
+ type: defaultType = 'url',
+ value: defaultValue = '',
+ onChange,
+}: FunnelStepAddFormProps) {
+ const [type, setType] = useState(defaultType);
const [value, setValue] = useState(defaultValue);
const { formatMessage, labels } = useMessages();
const items = [
@@ -19,7 +24,7 @@ export function FunnelStepAddForm({ defaultValue = '', onAdd }: UrlAddFormProps)
const isDisabled = !type || !value;
const handleSave = () => {
- onAdd({ type, value });
+ onChange({ type, value });
setValue('');
};
@@ -39,32 +44,36 @@ export function FunnelStepAddForm({ defaultValue = '', onAdd }: UrlAddFormProps)
};
return (
-
-
- setType(value)}
- >
- {({ value, label }) => {
- return - {label}
;
- }}
-
-
+
+
+
+ setType(value)}
+ >
+ {({ value, label }) => {
+ return - {label}
;
+ }}
+
+
+
+
+
-
-
+
+
);
}
diff --git a/src/pages/api/reports/insights.ts b/src/pages/api/reports/insights.ts
index efd3a6b5..ba4f643e 100644
--- a/src/pages/api/reports/insights.ts
+++ b/src/pages/api/reports/insights.ts
@@ -56,8 +56,8 @@ const schema = {
};
function convertFilters(filters: any[]) {
- return filters.reduce((obj, { name, ...value }) => {
- obj[name] = value;
+ return filters.reduce((obj, filter) => {
+ obj[filter.name] = filter;
return obj;
}, {});