Company Management Functions
The Company Management drop-in provides API functions that enable you to programmatically control behavior, fetch data, and integrate with Adobe Commerce backend services.
| Function | Description |
|---|---|
allowCompanyRegistration | Return whether the backend allows company self-registration per store configuration.. |
checkCompanyCreditEnabled | Checks whether the Company Credit functionality (“Payment on Account”) is enabled for the logged-in customer’s company.. |
companyEnabled | Return whether the Company feature is enabled in store configuration.. |
createCompany | API function for the drop-in.. |
createCompanyTeam | Creates a new company team under an optional target structure node.. |
createCompanyUser | Creates a new company user and optionally places them under a target structure node.. |
deleteCompanyTeam | Deletes a company team by entity ID.. |
deleteCompanyUser | Deletes a company user by their ID with automatic base64 encoding.. |
fetchUserPermissions | API function retrieves the current user’s role permissions and returns both the flattened permission IDs and the raw role response. |
getCompany | API function for the drop-in.. |
getCompanyCredit | Function that returns the logged in Customer’s Company Credit information, or null if the user is unable to access Company Credit information.. |
getCompanyCreditHistory | API function for the drop-in.. |
getCompanyStructure | Fetches the company structure with teams and users. |
getCompanyTeam | Fetches details for a single company team by entity ID.. |
getCompanyUser | Fetches details for a single company user by entity ID.. |
getCompanyUsers | Fetches the list of company users with their roles and team information, supporting pagination and status filtering.. |
getCountries | ## Overview.. |
getCustomerCompany | Fetches simplified customer company information for display on the account information page.. |
initialize | Initializes the Company drop-in with optional language definitions and data model metadata.. |
isCompanyAdmin | Check if the current authenticated customer is a company administrator in any company.. |
isCompanyUser | Check if the current authenticated customer belongs to any company.. |
updateCompany | API function for the drop-in.. |
updateCompanyStructure | Moves a structure node under a new parent in the company structure tree.. |
updateCompanyTeam | Updates a company team’s name and/or description.. |
updateCompanyUser | Updates company user fields such as name, email, telephone, role, and status.. |
updateCompanyUserStatus | Updates a company user’s status between Active and Inactive with automatic base64 encoding.. |
validateCompanyEmail | Validates if a company email is available.. |
allowCompanyRegistration
Return whether the backend allows company self-registration per store configuration.
const allowCompanyRegistration = async (): Promise<boolean>Events
Does not emit any drop-in events.
Returns
Returns boolean.
checkCompanyCreditEnabled
Checks whether the Company Credit functionality (“Payment on Account”) is enabled for the logged-in customer’s company.
const checkCompanyCreditEnabled = async (): Promise<CheckCompanyCreditEnabledResponse>Events
Does not emit any drop-in events.
Returns
Returns CheckCompanyCreditEnabledResponse.
companyEnabled
Return whether the Company feature is enabled in store configuration.
const companyEnabled = async (): Promise<boolean>Events
Does not emit any drop-in events.
Returns
Returns boolean.
createCompany
const createCompany = async ( formData: any): Promise<{ success: boolean; company?: CompanyRegistrationModel; errors?: string[] }>| Parameter | Type | Req? | Description |
|---|---|---|---|
formData | any | Yes | See function signature above |
Events
Does not emit any drop-in events.
Returns
Returns { success: boolean; company?: CompanyRegistrationModel; errors?: string[] }. See CompanyRegistrationModel.
createCompanyTeam
Creates a new company team under an optional target structure node.
const createCompanyTeam = async ( input: CreateCompanyTeamInput): Promise<any>| Parameter | Type | Req? | Description |
|---|---|---|---|
input | CreateCompanyTeamInput | Yes | Input parameters for the operation. |
Events
Does not emit any drop-in events.
Returns
Returns void.
createCompanyUser
Creates a new company user and optionally places them under a target structure node.
const createCompanyUser = async ( input: CreateCompanyUserInput): Promise<any>| Parameter | Type | Req? | Description |
|---|---|---|---|
input | CreateCompanyUserInput | Yes | Input parameters for the operation. |
Events
Does not emit any drop-in events.
Returns
Returns void.
deleteCompanyTeam
Deletes a company team by entity ID.
const deleteCompanyTeam = async ( id: string): Promise<any>| Parameter | Type | Req? | Description |
|---|---|---|---|
id | string | Yes | See function signature above |
Events
Does not emit any drop-in events.
Returns
Returns void.
deleteCompanyUser
Deletes a company user by their ID with automatic base64 encoding.
const deleteCompanyUser = async ( params: DeleteCompanyUserParams): Promise<DeleteCompanyUserResponse>| Parameter | Type | Req? | Description |
|---|---|---|---|
params | DeleteCompanyUserParams | Yes | See function signature above |
Events
Does not emit any drop-in events.
Returns
Returns DeleteCompanyUserResponse.
fetchUserPermissions
The fetchUserPermissions API function retrieves the current user’s role permissions and returns both the flattened permission IDs and the raw role response. This function is used internally by other API functions to determine what data the user can access.
const fetchUserPermissions = async (): Promise<any>Events
Does not emit any drop-in events.
Returns
Returns void.
getCompany
const getCompany = async (): Promise<any>Events
Does not emit any drop-in events.
Returns
Returns void.
getCompanyCredit
Function that returns the logged in Customer’s Company Credit information, or null if the user is unable to access Company Credit information.
const getCompanyCredit = async (): Promise<CompanyCreditInfo | null>Events
Does not emit any drop-in events.
Returns
Returns CompanyCreditInfo or null.
getCompanyCreditHistory
const getCompanyCreditHistory = async ( params: GetCompanyCreditHistoryParams = {}): Promise<CompanyCreditHistory | null>| Parameter | Type | Req? | Description |
|---|---|---|---|
params | GetCompanyCreditHistoryParams | No | See function signature above |
Events
Does not emit any drop-in events.
Returns
Returns CompanyCreditHistory or null.
getCompanyStructure
Fetches the company structure with teams and users. Returns entity-centric items that include both entity and structure identifiers.
const getCompanyStructure = async (): Promise<any>Events
Does not emit any drop-in events.
Returns
Returns void.
getCompanyTeam
Fetches details for a single company team by entity ID.
const getCompanyTeam = async ( id: string): Promise<any>| Parameter | Type | Req? | Description |
|---|---|---|---|
id | string | Yes | See function signature above |
Events
Does not emit any drop-in events.
Returns
Returns void.
getCompanyUser
Fetches details for a single company user by entity ID.
const getCompanyUser = async ( id: string): Promise<any>| Parameter | Type | Req? | Description |
|---|---|---|---|
id | string | Yes | See function signature above |
Events
Does not emit any drop-in events.
Returns
Returns void.
getCompanyUsers
Fetches the list of company users with their roles and team information, supporting pagination and status filtering.
const getCompanyUsers = async ( params: CompanyUsersParams = {}): Promise<CompanyUsersResponse>| Parameter | Type | Req? | Description |
|---|---|---|---|
params | CompanyUsersParams | No | See function signature above |
Events
Does not emit any drop-in events.
Returns
Returns CompanyUsersResponse.
getCountries
Overview
const getCountries = async (): Promise<{ availableCountries: Country[] | []; countriesWithRequiredRegion: string[]; optionalZipCountries: string[];}>Events
Does not emit any drop-in events.
Returns
Returns Promise<{ availableCountries: Country[] | []; countriesWithRequiredRegion: string[]; optionalZipCountries: string[]; }>. See Country.
getCustomerCompany
Fetches simplified customer company information for display on the account information page.
const getCustomerCompany = async (): Promise<any>Events
Does not emit any drop-in events.
Returns
Returns void.
initialize
Initializes the Company drop-in with optional language definitions and data model metadata.
const initialize = async ( config: CompanyDropinConfig = {}): Promise<any>| Parameter | Type | Req? | Description |
|---|---|---|---|
config | CompanyDropinConfig | No | See function signature above |
Events
Does not emit any drop-in events.
Returns
Returns void.
isCompanyAdmin
Check if the current authenticated customer is a company administrator in any company.
const isCompanyAdmin = async (): Promise<boolean>Events
Does not emit any drop-in events.
Returns
Returns boolean.
isCompanyUser
Check if the current authenticated customer belongs to any company.
const isCompanyUser = async (): Promise<boolean>Events
Does not emit any drop-in events.
Returns
Returns boolean.
updateCompany
const updateCompany = async ( input: UpdateCompanyDto): Promise<CompanyModel>| Parameter | Type | Req? | Description |
|---|---|---|---|
input | UpdateCompanyDto | Yes | Input parameters for the operation. |
Events
Does not emit any drop-in events.
Returns
Returns CompanyModel.
updateCompanyStructure
Moves a structure node under a new parent in the company structure tree.
const updateCompanyStructure = async ( input: UpdateCompanyStructureInput): Promise<any>| Parameter | Type | Req? | Description |
|---|---|---|---|
input | UpdateCompanyStructureInput | Yes | Input parameters for the operation. |
Events
Does not emit any drop-in events.
Returns
Returns void.
updateCompanyTeam
Updates a company team’s name and/or description.
const updateCompanyTeam = async ( input: UpdateCompanyTeamInput): Promise<any>| Parameter | Type | Req? | Description |
|---|---|---|---|
input | UpdateCompanyTeamInput | Yes | Input parameters for the operation. |
Events
Does not emit any drop-in events.
Returns
Returns void.
updateCompanyUser
Updates company user fields such as name, email, telephone, role, and status.
const updateCompanyUser = async ( input: UpdateCompanyUserInput): Promise<any>| Parameter | Type | Req? | Description |
|---|---|---|---|
input | UpdateCompanyUserInput | Yes | Input parameters for the operation. |
Events
Does not emit any drop-in events.
Returns
Returns void.
updateCompanyUserStatus
Updates a company user’s status between Active and Inactive with automatic base64 encoding.
const updateCompanyUserStatus = async ( params: UpdateCompanyUserStatusParams): Promise<UpdateCompanyUserStatusResponse>| Parameter | Type | Req? | Description |
|---|---|---|---|
params | UpdateCompanyUserStatusParams | Yes | See function signature above |
Events
Does not emit any drop-in events.
Returns
Returns UpdateCompanyUserStatusResponse.
validateCompanyEmail
Validates if a company email is available.
const validateCompanyEmail = async ( email: string): Promise<ValidateCompanyEmailResponse>| Parameter | Type | Req? | Description |
|---|---|---|---|
email | string | Yes | The email address. |
Events
Does not emit any drop-in events.
Returns
Returns ValidateCompanyEmailResponse.
Data Models
The following data models are used by functions in this drop-in.
CheckCompanyCreditEnabledResponse
The CheckCompanyCreditEnabledResponse object is returned by the following functions: checkCompanyCreditEnabled.
interface CheckCompanyCreditEnabledResponse { creditEnabled: boolean; error?: string;}CompanyCreditHistory
The CompanyCreditHistory object is returned by the following functions: getCompanyCreditHistory.
interface CompanyCreditHistory { items: CompanyCreditHistoryItem[]; pageInfo: CompanyCreditHistoryPageInfo; totalCount: number;}CompanyCreditInfo
The CompanyCreditInfo object is returned by the following functions: getCompanyCredit.
interface CompanyCreditInfo { credit: { available_credit: { currency: string; value: number; }; credit_limit: { currency: string; value: number; }; outstanding_balance: { currency: string; value: number; };
};}CompanyRegistrationModel
The CompanyRegistrationModel object is returned by the following functions: createCompany.
interface CompanyRegistrationModel { id: string; name: string; email: string; legalName?: string; vatTaxId?: string; resellerId?: string; legalAddress: { street: string[]; city: string; region: { regionCode: string; region?: string; regionId?: number; }; postcode: string; countryCode: string; telephone?: string; }; companyAdmin: { id: string; firstname: string; lastname: string; email: string; jobTitle?: string; telephone?: string; };}CompanyUsersResponse
The CompanyUsersResponse object is returned by the following functions: getCompanyUsers.
interface CompanyUsersResponse { users: CompanyUser[]; pageInfo: CompanyUsersPageInfo; totalCount?: number;}Country
The Country object is returned by the following functions: getCountries.
type Country = { value: string; text: string; availableRegions?: { id: number; code: string; name: string; }[];};DeleteCompanyUserResponse
The DeleteCompanyUserResponse object is returned by the following functions: deleteCompanyUser.
interface DeleteCompanyUserResponse { success: boolean;}UpdateCompanyUserStatusResponse
The UpdateCompanyUserStatusResponse object is returned by the following functions: updateCompanyUserStatus.
interface UpdateCompanyUserStatusResponse { success: boolean; user?: { id: string; status: CompanyUserStatus; };}ValidateCompanyEmailResponse
The ValidateCompanyEmailResponse object is returned by the following functions: validateCompanyEmail.
interface ValidateCompanyEmailResponse { isValid: boolean; error?: string;}