Wishlist Data & Events
The Wishlist drop-in uses the event bus to emit and listen to events for communication between drop-ins and external integrations.
Events reference
Section titled “Events reference”| Event | Direction | Description |
|---|---|---|
| wishlist/initialized | Emits | Emitted when the component completes initialization. |
| wishlist/alert | Emits and listens | Triggered when an alert or notification is triggered. |
| wishlist/data | Emits and listens | Triggered when data is available or changes. |
| wishlist/reset | Emits and listens | Triggered when the component state is reset. |
Event details
Section titled “Event details”The following sections provide detailed information about each event, including its direction, event payload, and usage examples.
wishlist/alert (emits and listens)
Section titled “wishlist/alert (emits and listens)”Triggered when an alert or notification is triggered.
Event payload
Section titled “Event payload”WishlistActionPayload | nullSee WishlistActionPayload for full type definition.
Example
Section titled “Example”import { events } from '@dropins/tools/event-bus.js';
events.on('wishlist/alert', (payload) => { console.log('wishlist/alert event received:', payload); // Add your custom logic here});wishlist/data (emits and listens)
Section titled “wishlist/data (emits and listens)”Emitted when wishlist data is updated or retrieved. This event is triggered after operations like adding items, removing items, or updating quantities in the wishlist.
Event payload
Section titled “Event payload”Wishlist | nullSee Wishlist for full type definition.
Example
Section titled “Example”import { events } from '@dropins/tools/event-bus.js';
events.on('wishlist/data', (payload) => { console.log('wishlist/data event received:', payload); // Add your custom logic here});wishlist/initialized (emits)
Section titled “wishlist/initialized (emits)”Emitted when the wishlist component completes initialization. This indicates the wishlist is ready to display items and accept user interactions.
Event payload
Section titled “Event payload”Wishlist | nullSee Wishlist for full type definition.
Example
Section titled “Example”import { events } from '@dropins/tools/event-bus.js';
events.on('wishlist/initialized', (payload) => { console.log('wishlist/initialized event received:', payload); // Add your custom logic here});wishlist/reset (emits and listens)
Section titled “wishlist/reset (emits and listens)”Triggered when the component state is reset.
Event payload
Section titled “Event payload”Example
Section titled “Example”import { events } from '@dropins/tools/event-bus.js';
events.on('wishlist/reset', (payload) => { console.log('wishlist/reset event received:', payload); // Add your custom logic here});Data Models
Section titled “Data Models”The following data models are used in event payloads for this drop-in.
Wishlist
Section titled “Wishlist”Used in: wishlist/data, wishlist/initialized.
interface Wishlist { id: string; updated_at: string; sharing_code: string; items_count: number; items: Item[];}WishlistActionPayload
Section titled “WishlistActionPayload”Used in: wishlist/alert.
interface WishlistActionPayload { action: WishlistAlertProps.action; item: WishlistAlertProps.item; }