Skip to content

Search is only available in production builds. Try building and previewing the site to test it out locally.

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.

EventDirectionDescription
company/updatedEmitsFired when company data is updated

Listens Reference

Events this drop-in listens for from external sources.

EventDirectionDescription
company/form-field-changedListensFired when any form field value changes 🚧
company/form-submittedListensFired when registration form is submitted 🚧
company/form-validation-errorListensFired when form validation fails 🚧
company/loadedListensFired when company data is loaded 🚧
company/update-failedListensFired when update fails 🚧
company/update-startedListensFired when update process begins 🚧
companyContext/changedListensCache 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 }
PropertyTypeDescription
companyany (optional)See type definition in source code
messagestring (optional)See type definition in source code
errorany (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 listening
companyUpdatedListener.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 listening
companyFormFieldChangedListener.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 listening
companyFormSubmittedListener.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 listening
companyFormValidationErrorListener.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 listening
companyLoadedListener.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 listening
companyUpdateFailedListener.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 listening
companyUpdateStartedListener.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 listening
companyContextChangedListener.off();