Product Clicked event
This article provides reference material about the "Product Clicked" event. The Sana core system emits this event when a product is clicked in the webstore UI.
The custom RxJS operator
The custom RxJS operator that filters an Observable of actions into the clicked product Observable.
type ProductCollectionSearchContext = {
searchRequestId: string | null;
};
type ClickedProductInfo = {
productId: string;
searchContext: ProductCollectionSearchContext | null;
};
export function onProductClicked(): (source$: Observable<Action>) => Observable<ClickedProductInfo>;
| Property | Type | Description |
|---|---|---|
| productId | string | The identifier of the clicked product. |
| searchContext | ProductCollectionSearchContext | null | The context of the search that returned the product. It is taken from the ProductSearchContext of the product search response that returned the product. Can be null when the product was not returned by a search response or the search response has no search context. |
ProductCollectionSearchContext
| Property | Type | Description |
|---|---|---|
| searchRequestId | string | null | The identifier of the search request that returned the product. |
Example:
import { onProductClicked } from 'sana/events';
const productClicked$ = action$.pipe(
onProductClicked(),
map(result => notifyProductClicked(result.productId, result.searchContext)),
);