Skip to content

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.

Version: 3.1.0
EventDirectionDescription
wishlist/initializedEmitsEmitted when the component completes initialization.
wishlist/alertEmits and listensTriggered when an alert or notification is triggered.
wishlist/dataEmits and listensTriggered when data is available or changes.
wishlist/resetEmits and listensTriggered when the component state is reset.

The following sections provide detailed information about each event, including its direction, event payload, and usage examples.

Triggered when an alert or notification is triggered.

WishlistActionPayload | null

See WishlistActionPayload for full type definition.

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
});

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.

Wishlist | null

See Wishlist for full type definition.

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
});

Emitted when the wishlist component completes initialization. This indicates the wishlist is ready to display items and accept user interactions.

Wishlist | null

See Wishlist for full type definition.

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
});

Triggered when the component state is reset.

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
});

The following data models are used in event payloads for this drop-in.

Used in: wishlist/data, wishlist/initialized.

interface Wishlist {
id: string;
updated_at: string;
sharing_code: string;
items_count: number;
items: Item[];
}

Used in: wishlist/alert.

interface WishlistActionPayload {
action: WishlistAlertProps.action;
item: WishlistAlertProps.item;
}