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.
Emits Reference
Events produced by this drop-in that you can subscribe to.
Event | Direction | Description |
---|---|---|
company/updated | Emits | Fired when company data is updated |
Listens Reference
Events this drop-in listens for from external sources.
Event | Direction | Description |
---|---|---|
company/form-field-changed | Listens | Fired when any form field value changes 🚧 |
company/form-submitted | Listens | Fired when registration form is submitted 🚧 |
company/form-validation-error | Listens | Fired when form validation fails 🚧 |
company/loaded | Listens | Fired when company data is loaded 🚧 |
company/update-failed | Listens | Fired when update fails 🚧 |
company/update-started | Listens | Fired when update process begins 🚧 |
companyContext/changed | Listens | Cache reset and refetch using the updated GraphQL headers |
Emits and Listens Reference
Event Details
The following sections provide detailed information about each event, including its direction, data payload structure, and usage examples.
company/updated (emits)
Fired when company data 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();
company/form-field-changed (listens)
Fired when any form field value changes
Data payload
Usage
Listen to this event in your storefront:
import { events } from '@dropins/tools/event-bus.js';
const companyFormFieldChangedListener = events.on('company/form-field-changed', (data) => { console.log('company/form-field-changed event received:', data); // Add your custom logic here});
// Later, when you want to stop listeningcompanyFormFieldChangedListener.off();
company/form-submitted (listens)
Fired when registration form is submitted
Data payload
Usage
Listen to this event in your storefront:
import { events } from '@dropins/tools/event-bus.js';
const companyFormSubmittedListener = events.on('company/form-submitted', (data) => { console.log('company/form-submitted event received:', data); // Add your custom logic here});
// Later, when you want to stop listeningcompanyFormSubmittedListener.off();
company/form-validation-error (listens)
Fired when form validation fails
Data payload
Usage
Listen to this event in your storefront:
import { events } from '@dropins/tools/event-bus.js';
const companyFormValidationErrorListener = events.on('company/form-validation-error', (data) => { console.log('company/form-validation-error event received:', data); // Add your custom logic here});
// Later, when you want to stop listeningcompanyFormValidationErrorListener.off();
company/loaded (listens)
Fired when company data is loaded
Data payload
Usage
Listen to this event in your storefront:
import { events } from '@dropins/tools/event-bus.js';
const companyLoadedListener = events.on('company/loaded', (data) => { console.log('company/loaded event received:', data); // Add your custom logic here});
// Later, when you want to stop listeningcompanyLoadedListener.off();
company/update-failed (listens)
Fired when update fails
Data payload
Usage
Listen to this event in your storefront:
import { events } from '@dropins/tools/event-bus.js';
const companyUpdateFailedListener = events.on('company/update-failed', (data) => { console.log('company/update-failed event received:', data); // Add your custom logic here});
// Later, when you want to stop listeningcompanyUpdateFailedListener.off();
company/update-started (listens)
Fired when update process begins
Data payload
Usage
Listen to this event in your storefront:
import { events } from '@dropins/tools/event-bus.js';
const companyUpdateStartedListener = events.on('company/update-started', (data) => { console.log('company/update-started event received:', data); // Add your custom logic here});
// Later, when you want to stop listeningcompanyUpdateStartedListener.off();
companyContext/changed (listens)
Cache reset and refetch using the updated GraphQL headers
Data payload
string | null | undefined
Usage
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();