diff --git a/src/DeprecatedHelpers/Search/SelectedItemFromSearch.ts b/src/DeprecatedHelpers/Search/SelectedItemFromSearch.ts deleted file mode 100644 index c1856fe2..00000000 --- a/src/DeprecatedHelpers/Search/SelectedItemFromSearch.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { ActionType } from "../../Schema" -import { SelectedItemFromSearch } from "../../Schema/Events/Search" - -export const selectedItemFromSearch = ( - props: Omit, -): SelectedItemFromSearch => { - return { - action: ActionType.selectedItemFromSearch, - context_module: props.context_module, - context_owner_id: props.context_owner_id, - context_owner_slug: props.context_owner_slug, - context_owner_type: props.context_owner_type, - destination_owner_id: props.destination_owner_id, - destination_owner_slug: props.destination_owner_slug, - destination_owner_type: props.destination_owner_type, - owner_id: props.owner_id, - owner_slug: props.owner_slug, - owner_type: props.owner_type, - query: props.query, - } -} diff --git a/src/DeprecatedHelpers/index.ts b/src/DeprecatedHelpers/index.ts index 039510a6..e3bdfaf4 100644 --- a/src/DeprecatedHelpers/index.ts +++ b/src/DeprecatedHelpers/index.ts @@ -13,7 +13,6 @@ export * from "./MyCollection/TappedCollectedArtworkImages" export * from "./SavesAndFollows/Follow" export * from "./Search/FocusedOnSearchInput" export * from "./Search/SearchedWithNoResults" -export * from "./Search/SelectedItemFromSearch" export * from "./System/TimeOnPage" export * from "./Tap/TappedConsign" export * from "./Tap/TappedEntityGroup" diff --git a/src/Schema/Events/Search.ts b/src/Schema/Events/Search.ts index 13372f2e..57aa2c57 100644 --- a/src/Schema/Events/Search.ts +++ b/src/Schema/Events/Search.ts @@ -38,28 +38,49 @@ export interface FocusedOnSearchInput { * ``` * { * action: "selectedItemFromSearch", - * context_module: "priceEstimate", - * context_owner_type: "consign", - * owner_type: "artist", - * owner_id: "5df3e3fa485efe0012c37055", - * owner_slug: "andy-warhol", - * query: "andy warhol" + * context_module: "header", + * destination_path: "/artist/andy-warhol", + * query: "andy warhol", + * item_id: "4d8b92b34eb68a1b2c0003f4", + * item_number: 2, + * item_type: "Artist" * } * ``` */ export interface SelectedItemFromSearch { action: ActionType.selectedItemFromSearch context_module: ContextModule - context_owner_type: PageOwnerType - context_owner_id?: string - context_owner_slug?: string - destination_owner_type?: PageOwnerType - destination_owner_id?: string - destination_owner_slug?: string - owner_type: OwnerType - owner_id: string - owner_slug: string + destination_path: string query: string + item_id: string + item_number: number + item_type: string +} + +/** + * A user selects an item from the search results page + * + * This schema describes events sent to Segment from [[selectedItemFromSearchPage]] + * + * @example + * ``` + * { + * action: "selectedItemFromSearchPage", + * query: "andy warhol", + * item_number: 2, + * item_type: "Artist", + * item_id: "4d8b92b34eb68a1b2c0003f4", + * destination_path: "/artist/andy-warhol" + * } + * ``` + */ +export interface SelectedItemFromSearchPage { + action: ActionType.selectedItemFromSearchPage + query: string + item_number: number + item_type: string + item_id: string + destination_path: string } /** diff --git a/src/Schema/Events/index.ts b/src/Schema/Events/index.ts index aedf222a..c8608aba 100644 --- a/src/Schema/Events/index.ts +++ b/src/Schema/Events/index.ts @@ -240,6 +240,7 @@ import { SelectedItemFromAddressAutoCompletion, SelectedItemFromPriceDatabaseSearch, SelectedItemFromSearch, + SelectedItemFromSearchPage, SelectedSearchSuggestionQuickNavigationItem, } from "./Search" import { DarkModeOptionUpdated } from "./Settings" @@ -484,6 +485,7 @@ export type Event = | SelectedItemFromAddressAutoCompletion | SelectedItemFromPriceDatabaseSearch | SelectedItemFromSearch + | SelectedItemFromSearchPage | SelectedFromDrawer | SelectedRecentPriceRange | SelectedSearchSuggestionQuickNavigationItem @@ -1377,6 +1379,10 @@ export enum ActionType { * Corresponds to {@link SelectedItemFromSearch} */ selectedItemFromSearch = "selectedItemFromSearch", + /** + * Corresponds to {@link SelectedItemFromSearchPage} + */ + selectedItemFromSearchPage = "selectedItemFromSearchPage", /** * Corresponds to {@link SelectedItemFromAddressAutoCompletion} */