Skip to content

Commit

Permalink
🪟 🔧  Add Segment track event to suggested destinations experiment (ai…
Browse files Browse the repository at this point in the history
…rbytehq#17328)

* Add segment track event to suggested destinations experiment

Closes airbytehq#17257

* Fix spec
  • Loading branch information
letiescanciano authored and jhammarstedt committed Oct 31, 2022
1 parent 9955f31 commit 2e5734a
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,10 @@ export const DestinationForm: React.FC<DestinationFormProps> = ({
isLoading,
} = useGetDestinationDefinitionSpecificationAsync(destinationDefinitionId);

const onDropDownSelect = (destinationDefinitionId: string) => {
const onDropDownSelect = (
destinationDefinitionId: string,
trackParams?: { actionDescription: string; connector_destination_suggested: boolean }
) => {
setDestinationDefinitionId(destinationDefinitionId);

const connector = destinationDefinitions.find((item) => item.destinationDefinitionId === destinationDefinitionId);
Expand All @@ -65,6 +68,7 @@ export const DestinationForm: React.FC<DestinationFormProps> = ({
actionDescription: "Destination connector type selected",
connector_destination: connector?.name,
connector_destination_definition_id: destinationDefinitionId,
...trackParams,
});
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,10 @@ export interface ServiceFormProps {
formId?: string;
availableServices: ConnectorDefinition[];
selectedConnectorDefinitionSpecification?: ConnectorDefinitionSpecification;
onServiceSelect?: (id: string) => void;
onServiceSelect?: (
id: string,
trackParams?: { actionDescription: string; connector_destination_suggested: boolean }
) => void;
onSubmit: (values: ServiceFormValues) => void;
isLoading?: boolean;
isEditMode?: boolean;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@ describe("<FrequentlyUsedDestinations />", () => {

await waitFor(() => {
expect(handler).toHaveBeenCalledTimes(1);
expect(handler).toHaveBeenCalledWith("2");
expect(handler).toHaveBeenCalledWith("2", {
actionDescription: "Suggested destination connector type selected",
connector_destination_suggested: true,
});
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ import styles from "./FrequentlyUsedDestinations.module.scss";
export interface FrequentlyUsedDestinationsProps {
propertyPath: string;
destinations: DestinationConnectorCard[];
onDestinationSelect?: (id: string) => void;
onDestinationSelect?: (
id: string,
trackParams?: { actionDescription: string; connector_destination_suggested: boolean }
) => void;
isLoading?: boolean;
}

Expand All @@ -30,7 +33,10 @@ export const FrequentlyUsedDestinations: React.FC<FrequentlyUsedDestinationsProp
}
const onSlideClick = (id: string) => {
setValue(id);
onDestinationSelect?.(id);
onDestinationSelect?.(id, {
actionDescription: "Suggested destination connector type selected",
connector_destination_suggested: true,
});
};
return (
<div className={styles.container}>
Expand Down

0 comments on commit 2e5734a

Please sign in to comment.