Overview
B24HelperManager batches a single REST call (profile, app.info, crm.currency.base.get, crm.currency.list, app.option.get, user.option.get) and exposes the parsed result through specialised sub-managers. It also owns the Pull client lifecycle — connect, subscribe, start, destroy.
You will normally interact with B24HelperManager indirectly, through the useB24Helper composable. Direct construction is supported but rarely needed.
import { useB24Helper, LoadDataType, initializeB24Frame } from '@bitrix24/b24jssdk'
const { initB24Helper, getB24Helper } = useB24Helper()
const $b24 = await initializeB24Frame()
await initB24Helper($b24, [
LoadDataType.Profile,
LoadDataType.App,
LoadDataType.Currency,
LoadDataType.AppOptions,
LoadDataType.UserOptions
])
const helper = getB24Helper()
console.log(helper.profileInfo.data, helper.appInfo.data)
Constructor
constructor(b24: TypeB24)
Accepts any TypeB24 instance — B24Frame, B24Hook, or B24OAuth. The helper does not call init() for you; the wrapped instance must already be initialized before loadData() runs.
Methods
loadData
loadData(
dataTypes?: LoadDataType[],
requestId?: string
): Promise<void>
Fetches the requested data slices via actions.v2.batch.make({ isHaltOnError: true }). After this resolves, the matching getters (profileInfo, appInfo, etc.) become available; before that they throw 'B24HelperManager not initialized'.
On failure it rejects. An Error raised by the batch call — including AjaxError and SdkError — is rethrown untouched, so you keep its code / status. Only a thrown value that is not an Error at all gets wrapped, in new Error('Failed to load data') with that raw value attached as cause so it is not lost.
dataTypes defaults to [LoadDataType.App, LoadDataType.Profile].
requestId defaults to 'helper-load-data'. Override it for traceability.
LoadDataType enum
getLogger / setLogger
getLogger(): LoggerInterface
setLogger(logger: LoggerInterface): void
setLogger propagates the logger into every parsed sub-manager. Defaults to LoggerFactory.createNullLogger().
destroy
destroy(): void
Tears down the Pull client (unsubscribe + disconnect). Idempotent.
Pull client glue
usePullClient(prefix?: string, userId?: number): B24HelperManager
subscribePullClient(callback: (message: TypePullMessage) => void, moduleId?: string): B24HelperManager
startPullClient(): void
getModuleIdPullClient(): string
Order matters: usePullClient() → subscribePullClient() (one or more times) → startPullClient(). See Pull client for the full flow. getModuleIdPullClient() returns the moduleId last passed to subscribePullClient, intended for pull.application.event.add payloads.
Getters
'B24HelperManager not initialized' until loadData() resolves. Each individual getter additionally throws when the relevant LoadDataType was not requested.isInit
get isInit(): boolean
true once loadData() has finished successfully.
profileInfo / appInfo / paymentInfo / licenseInfo / currency / appOptions / userOptions
Return the parsed sub-manager. See:
forB24Form
get forB24Form(): TypeB24Form
Returns a flat object suitable for posting to a Bitrix24 CRM feedback form. Requires both LoadDataType.App and LoadDataType.Profile.
hostName
get hostName(): string
Portal origin (https://xxx.bitrix24.com). Backed by b24.getTargetOrigin().
isSelfHosted
get isSelfHosted(): boolean
true when the license string contains selfhosted. Requires LoadDataType.App.
primaryKeyIncrementValue
get primaryKeyIncrementValue(): number
Returns the increment step for ID-typed fields: 1 on self-hosted, 2 on cloud.
b24SpecificUrl
get b24SpecificUrl(): Record<keyof typeof TypeSpecificUrl, string>
Returns admin-area URLs that differ between cloud and self-hosted: