:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
import { LemonSelectOption } from '@posthog/lemon-ui'
import {
CURRENCY_SYMBOL_TO_EMOJI_MAP,
CURRENCY_SYMBOL_TO_NAME_MAP,
DISABLED_CURRENCIES,
IMPORTANT_CURRENCIES,
OTHER_CURRENCIES,
} from 'lib/utils/currency'
import { CurrencyCode } from '~/queries/schema/schema-general'
const optionFromCurrency = (currency: CurrencyCode): LemonSelectOption<CurrencyCode> => {
return {
value: currency,
disabledReason: DISABLED_CURRENCIES[currency],
label: (
<span>
{CURRENCY_SYMBOL_TO_EMOJI_MAP[currency]} {`${CURRENCY_SYMBOL_TO_NAME_MAP[currency]} (${currency})`}
</span>
),
}
}
const optionFromCurrencyAbbreviated = (currency: CurrencyCode): LemonSelectOption<CurrencyCode> => {
return {
value: currency,
disabledReason: DISABLED_CURRENCIES[currency],
label: (
<span>
{CURRENCY_SYMBOL_TO_EMOJI_MAP[currency]} {currency}
</span>
),
}
}
// Computing these before hand is more efficient than computing them on the fly.
export const OPTIONS_FOR_IMPORTANT_CURRENCIES: LemonSelectOption<CurrencyCode>[] =
IMPORTANT_CURRENCIES.map(optionFromCurrency)
export const OPTIONS_FOR_OTHER_CURRENCIES: LemonSelectOption<CurrencyCode>[] = OTHER_CURRENCIES.map(optionFromCurrency)
export const OPTIONS_FOR_IMPORTANT_CURRENCIES_ABBREVIATED: LemonSelectOption<CurrencyCode>[] =
IMPORTANT_CURRENCIES.map(optionFromCurrencyAbbreviated)
export const OPTIONS_FOR_OTHER_CURRENCIES_ABBREVIATED: LemonSelectOption<CurrencyCode>[] =
OTHER_CURRENCIES.map(optionFromCurrencyAbbreviated)