Company Management Data & Events
The Company Management drop-in uses the Event Bus to emit and listen to events for communication between drop-ins and external integrations. For common events shared across multiple drop-ins (such as locale, error, authenticated, etc.), see the Common Events Reference.
Events reference
| Event | Direction | Description |
|---|---|---|
| company/updated | Emits | Emitted when the component state is updated |
| companyContext/changed | Listens | Fired by Company Context (companyContext) when a change occurs |
Event details
The following sections provide detailed information about each event, including its direction, data payload structure, and usage examples.
company/updated (emits)
Emitted when the component state is updated
Data payload
{ company?: any; message?: string; error?: any }| Property | Type | Description |
|---|---|---|
company | any (optional) | See type definition in source code |
message | string (optional) | See type definition in source code |
error | any (optional) | See type definition in source code |
Usage
Listen to this event in your storefront:
import { events } from '@dropins/tools/event-bus.js';
const companyUpdatedListener = events.on('company/updated', (data) => { console.log('company/updated event received:', data); // Add your custom logic here});
// Later, when you want to stop listeningcompanyUpdatedListener.off();companyContext/changed (listens)
Fired by Company Context (companyContext) when a change occurs
Data payload
string | null | undefinedUsage
Listen to this event in your storefront:
import { events } from '@dropins/tools/event-bus.js';
const companyContextChangedListener = events.on('companyContext/changed', (data) => { console.log('companyContext/changed event received:', data); // Add your custom logic here});
// Later, when you want to stop listeningcompanyContextChangedListener.off();