Requisition List Data & Events
The Requisition List drop-in uses the event bus to emit and listen to events for communication between drop-ins and external integrations.
Events reference
| Event | Direction | Description |
|---|---|---|
| requisitionList/redirect | Emits | Emitted when a specific condition or state change occurs. |
| requisitionList/alert | Emits and listens | Triggered when an alert or notification is triggered. |
| requisitionList/data | Emits and listens | Triggered when data is available or changes. |
| requisitionLists/data | Emits and listens | Triggered when data is available or changes. |
Event details
The following sections provide detailed information about each event, including its direction, event payload, and usage examples.
requisitionList/alert (emits and listens)
Triggered when an alert or notification is triggered.
Event payload
RequisitionListActionPayloadSee RequisitionListActionPayload for full type definition.
Usage
Listen to this event in your storefront:
import { events } from '@dropins/tools/event-bus.js';
const requisitionListAlertListener = events.on('requisitionList/alert', (data) => { console.log('requisitionList/alert event received:', data); // Add your custom logic here});
// Later, when you want to stop listeningrequisitionListAlertListener.off();requisitionList/data (emits and listens)
Triggered when data is available or changes.
Event payload
RequisitionList | nullSee RequisitionList for full type definition.
Usage
Listen to this event in your storefront:
import { events } from '@dropins/tools/event-bus.js';
const requisitionListDataListener = events.on('requisitionList/data', (data) => { console.log('requisitionList/data event received:', data); // Add your custom logic here});
// Later, when you want to stop listeningrequisitionListDataListener.off();requisitionList/redirect (emits)
Emitted when a specific condition or state change occurs.
Event payload
Usage
Listen to this event in your storefront:
import { events } from '@dropins/tools/event-bus.js';
const requisitionListRedirectListener = events.on('requisitionList/redirect', (data) => { console.log('requisitionList/redirect event received:', data); // Add your custom logic here});
// Later, when you want to stop listeningrequisitionListRedirectListener.off();requisitionLists/data (emits and listens)
Triggered when data is available or changes.
Event payload
RequisitionList[] | nullSee RequisitionList for full type definition.
Usage
Listen to this event in your storefront:
import { events } from '@dropins/tools/event-bus.js';
const requisitionListsDataListener = events.on('requisitionLists/data', (data) => { console.log('requisitionLists/data event received:', data); // Add your custom logic here});
// Later, when you want to stop listeningrequisitionListsDataListener.off();Data Models
The following data models are used in event payloads for this drop-in.
RequisitionList
Used in: requisitionList/data, requisitionLists/data.
interface RequisitionList { uid: string; name: string; description: string; updated_at: string; items_count: number; items: Item[]; page_info?: PageInfo;}RequisitionListActionPayload
Used in: requisitionList/alert.
interface RequisitionListActionPayload { action: 'add' | 'delete' | 'update' | 'move'; type: 'success' | 'error'; context: 'product' | 'requisitionList'; skus?: string[]; // for product-related actions message?: string[]; // for uncontrolled/custom messages }