Markets and money SDK reference
India-first market presentation, currencies and money formatting.
Import these public values from @upstorr/theme-sdk/v1. Do not import their internal source files.
buildThemeMarketHref
buildThemeMarketHref(currentPath: string, marketCode: string, marketCodes: string[]): string | null
createThemeMarketsView
createThemeMarketsView(localization?: ThemeMarketsLocalization | null): ThemeMarketsView
createThemeMoneyView
createThemeMoneyView(localization?: ThemeMarketsLocalization | null): ThemeMoneyView
formatCurrencySymbol
formatCurrencySymbol(currencyCode: string): string
formatMoney
formatMoney(value: ThemeMoney): string
formatMoneyWithCurrencyCode
formatMoneyWithCurrencyCode(value: ThemeMoney): string
formatThemeCurrencyLabel
formatThemeCurrencyLabel(currencyCode: string | null | undefined): string
formatThemeMoney
formatThemeMoney(amount: number | null | undefined, currencyCode: string | null | undefined): string
formatThemeMoneyDisplay
formatThemeMoneyDisplay(amount: number | null | undefined, currencyCode: string | null | undefined, options?: { showCurrencyCode?: boolean; }): string
formatThemeMoneyWithCurrencyCode
formatThemeMoneyWithCurrencyCode(amount: number | null | undefined, currencyCode: string | null | undefined): string
getThemeCurrencyCode
getThemeCurrencyCode(localization?: ThemeMarketsLocalization | null): string
getThemeMarketHref
getThemeMarketHref(markets: ThemeMarket[], marketCode: string, currentPath?: string): string | null
ThemeMarket
type ThemeMarket = {
code: string;
name: string;
flag?: string | null;
currency?: {
iso_code: string;
symbol?: string;
};
language?: {
iso_code: string;
name: string;
endonym_name?: string;
};
href: string;
domain?: string | null;
is_current?: boolean;
is_primary?: boolean;
};
ThemeMarketsLocalization
type ThemeMarketsLocalization = {
market?: ThemeMarket | null;
country?: {
iso_code: string;
name?: string;
flag?: string | null;
currency?: {
iso_code: string;
symbol?: string;
};
} | null;
markets?: {
current?: ThemeMarket | null;
available?: ThemeMarket[];
};
available_countries?: Array<{
iso_code: string;
name: string;
flag?: string | null;
currency?: {
iso_code: string;
symbol?: string;
};
}>;
};
ThemeMarketsView
type ThemeMarketsView = {
current: ThemeMarket | null;
available: ThemeMarket[];
getMarketHref: (marketCode: string, currentPath?: string) => string | null;
switchMarket: (marketCode: string, currentPath?: string) => void;
};
ThemeMoney
type ThemeMoney = {
amount: number;
currencyCode: string;
};
ThemeMoneyView
type ThemeMoneyView = {
currencyCode: string;
format: (amount: number | null | undefined, currencyCode?: string | null) => string;
formatWithCurrencyCode: (amount: number | null | undefined, currencyCode?: string | null) => string;
currencySymbol: (currencyCode?: string | null) => string;
};
useThemeMarkets
useThemeMarkets(localization?: ThemeMarketsLocalization | null): ThemeMarketsView
useThemeMoney
useThemeMoney(localization?: ThemeMarketsLocalization | null): ThemeMoneyView