Skip to content

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

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.

Version: 1.0.0-beta16
FunctionDescription
allowCompanyRegistrationReturn whether the backend allows company self-registration per store configuration..
checkCompanyCreditEnabledChecks whether the Company Credit functionality (“Payment on Account”) is enabled for the logged-in customer’s company..
companyEnabledReturn whether the Company feature is enabled in store configuration..
createCompanyAPI function for the drop-in..
createCompanyTeamCreates a new company team under an optional target structure node..
createCompanyUserCreates a new company user and optionally places them under a target structure node..
deleteCompanyTeamDeletes a company team by entity ID..
deleteCompanyUserDeletes a company user by their ID with automatic base64 encoding..
fetchUserPermissionsAPI function retrieves the current user’s role permissions and returns both the flattened permission IDs and the raw role response.
getCompanyAPI function for the drop-in..
getCompanyCreditFunction that returns the logged in Customer’s Company Credit information, or null if the user is unable to access Company Credit information..
getCompanyCreditHistoryAPI function for the drop-in..
getCompanyStructureFetches the company structure with teams and users.
getCompanyTeamFetches details for a single company team by entity ID..
getCompanyUserFetches details for a single company user by entity ID..
getCompanyUsersFetches the list of company users with their roles and team information, supporting pagination and status filtering..
getCountries## Overview..
getCustomerCompanyFetches simplified customer company information for display on the account information page..
initializeInitializes the Company drop-in with optional language definitions and data model metadata..
isCompanyAdminCheck if the current authenticated customer is a company administrator in any company..
isCompanyUserCheck if the current authenticated customer belongs to any company..
updateCompanyAPI function for the drop-in..
updateCompanyStructureMoves a structure node under a new parent in the company structure tree..
updateCompanyTeamUpdates a company team’s name and/or description..
updateCompanyUserUpdates company user fields such as name, email, telephone, role, and status..
updateCompanyUserStatusUpdates a company user’s status between Active and Inactive with automatic base64 encoding..
validateCompanyEmailValidates 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[] }>
ParameterTypeReq?Description
formDataanyYesSee 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>
ParameterTypeReq?Description
inputCreateCompanyTeamInputYesInput 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>
ParameterTypeReq?Description
inputCreateCompanyUserInputYesInput 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>
ParameterTypeReq?Description
idstringYesSee 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>
ParameterTypeReq?Description
paramsDeleteCompanyUserParamsYesSee 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>
ParameterTypeReq?Description
paramsGetCompanyCreditHistoryParamsNoSee 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>
ParameterTypeReq?Description
idstringYesSee 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>
ParameterTypeReq?Description
idstringYesSee 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>
ParameterTypeReq?Description
paramsCompanyUsersParamsNoSee 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>
ParameterTypeReq?Description
configCompanyDropinConfigNoSee 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>
ParameterTypeReq?Description
inputUpdateCompanyDtoYesInput 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>
ParameterTypeReq?Description
inputUpdateCompanyStructureInputYesInput 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>
ParameterTypeReq?Description
inputUpdateCompanyTeamInputYesInput 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>
ParameterTypeReq?Description
inputUpdateCompanyUserInputYesInput 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>
ParameterTypeReq?Description
paramsUpdateCompanyUserStatusParamsYesSee 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>
ParameterTypeReq?Description
emailstringYesThe 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;
}