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
Events reference
Section titled “Events reference”| Event | Direction | Description |
|---|---|---|
| checkout/initialized | Listens | Fired by Checkout (checkout) when the component completes initialization. |
| checkout/updated | Listens | Fired by Checkout (checkout) when the component state is updated. |
| company/updated | Listens | Fired by Company (company) when the component state is updated. |
| companyContext/changed | Emits and listens | Emitted when a change occurs. |
Event details
Section titled “Event details”The following sections provide detailed information about each event, including its direction, event payload, and usage examples.
checkout/initialized (listens)
Section titled “checkout/initialized (listens)”Fired by Checkout (checkout) when the component completes initialization.
Event payload
Section titled “Event payload”Example
Section titled “Example”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});checkout/updated (listens)
Section titled “checkout/updated (listens)”Fired by Checkout (checkout) when the component state is updated.
Event payload
Section titled “Event payload”Example
Section titled “Example”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});company/updated (listens)
Section titled “company/updated (listens)”Fired by Company (company) when the component state is updated.
Event payload
Section titled “Event payload”{ 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;}}Example
Section titled “Example”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.
Event payload
Section titled “Event payload”string | nullExample
Section titled “Example”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});