Skip to content

Company Switcher Events and Data

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

Version: 1.1.1
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 listensEmitted when a change occurs.

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

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

import { events } from '@dropins/tools/event-bus.js';
events.on('checkout/initialized', (payload) => {
console.log('checkout/initialized event received:', payload);
// Add your custom logic here
});

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

import { events } from '@dropins/tools/event-bus.js';
events.on('checkout/updated', (payload) => {
console.log('checkout/updated event received:', payload);
// Add your custom logic here
});

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

{
company: {
id: string;
name: string;
email: string;
legalAddress: {
street: string[];
city: string;
region: {
region: string;
regionCode: string;
regionId: number;
}
countryCode: string;
postcode: string;
telephone: string;
}
companyAdmin: {
id: string;
firstname: string;
lastname: string;
email: string;
}
salesRepresentative: {
firstname: string;
lastname: string;
email: string;
}
availablePaymentMethods: Array<{
code: string;
title: string;
}>;
availableShippingMethods: Array<{
code: string;
title: string;
}>;
canEditAccount: boolean;
canEditAddress: boolean;
permissionsFlags: {
canViewAccount: boolean;
canEditAccount: boolean;
canViewAddress: boolean;
canEditAddress: boolean;
canViewContacts: boolean;
canViewPaymentInformation: boolean;
canViewShippingInformation: boolean;
}
customerRole: {
id: string;
name: string;
permissions: any[];
}
customerStatus: string;
}
}
import { events } from '@dropins/tools/event-bus.js';
events.on('company/updated', (payload) => {
console.log('company/updated event received:', payload);
// Add your custom logic here
});

companyContext/changed (emits and listens)

Section titled “companyContext/changed (emits and listens)”

Emitted when a change occurs.

string | null
import { events } from '@dropins/tools/event-bus.js';
events.on('companyContext/changed', (payload) => {
console.log('companyContext/changed event received:', payload);
// Add your custom logic here
});