Skip to content

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

Company Switcher Data & Events

The Company Switcher drop-in uses the event bus to emit and listen to events for communication between drop-ins and external integrations.

Version: latest

Events reference

EventDirectionDescription
checkout/initializedListensFired by Checkout (checkout) when the component completes initialization.
checkout/updatedListensFired by Checkout (checkout) when the component state is updated.
company/updatedListensFired by Company (company) when the component state is updated.
companyContext/changedEmits and listensTriggered when a change occurs.

Event details

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

checkout/initialized (listens)

Fired by Checkout (checkout) when the component completes initialization.

Event payload

null

Usage

Listen to this event in your storefront:

import { events } from '@dropins/tools/event-bus.js';
const checkoutInitializedListener = events.on('checkout/initialized', (data) => {
console.log('checkout/initialized event received:', data);
// Add your custom logic here
});
// Later, when you want to stop listening
checkoutInitializedListener.off();

checkout/updated (listens)

Fired by Checkout (checkout) when the component state is updated.

Event payload

null

Usage

Listen to this event in your storefront:

import { events } from '@dropins/tools/event-bus.js';
const checkoutUpdatedListener = events.on('checkout/updated', (data) => {
console.log('checkout/updated event received:', data);
// Add your custom logic here
});
// Later, when you want to stop listening
checkoutUpdatedListener.off();

company/updated (listens)

Fired by Company (company) when the component state is updated.

Event payload

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

companyContext/changed (emits and listens)

Triggered when a change occurs.

Event payload

string | null

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