CurrencyManager caches the result of crm.currency.base.get + crm.currency.list (and a follow-up batched crm.currency.get for per-language formatters). Created when LoadDataType.Currency is requested; reachable through B24HelperManager.currency.
Usage
import { useB24Helper, LoadDataType } from '@bitrix24/b24jssdk'
const { initB24Helper, getB24Helper } = useB24Helper()
await initB24Helper($b24, [LoadDataType.Currency])
const currency = getB24Helper().currency
console.log(currency.baseCurrency) // 'USD'
console.log(currency.currencyList) // ['USD', 'EUR', 'RUB', ...]
console.log(currency.format(1234.5, 'USD', 'en')) // '$1,234.50'
Getters
baseCurrency
get baseCurrency(): string
Portal's base currency code (USD, RUB, …).
currencyList
get currencyList(): string[]
Array of available currency codes.
data
get data(): { currencyBase: string, currencyList: Map<string, Currency> }
Internal cache. The Currency value type is documented in b24-helper.ts.
Methods
getCurrencyFullName
getCurrencyFullName(currencyCode: string, langCode?: string): string
Localised full name (e.g. Russian Ruble). Throws UnhandledMatchError for unknown currencyCode.
getCurrencyLiteral
getCurrencyLiteral(currencyCode: string, langCode?: string): string
Currency symbol/literal extracted from the format string (e.g. $, ₽).
format
format(value: number, currencyCode: string, langCode: string): string
Returns the value formatted per the per-language formatString, decimals, decPoint, thousandsSep (with the same THOUSANDS_VARIANT mapping Bitrix24 uses on the server).
setBaseCurrency / setCurrencyList
setBaseCurrency(currencyBase: string): void
setCurrencyList(list: CurrencyInit[]): void
Manual overrides — primarily used internally during initData.