fix(message-system): fix circular dependency in message system (TradingType)

This commit is contained in:
Jaroslav Hrách
2025-11-11 18:36:49 +01:00
committed by Jaroslav Hrách
parent 7ba3dbef6c
commit d470d91641
4 changed files with 39 additions and 3 deletions

View File

@@ -749,6 +749,10 @@
"ZM",
"ZW"
]
},
"tradingType": {
"type": "string",
"enum": ["buy", "sell", "exchange"]
}
}
}

View File

@@ -6,6 +6,7 @@ import { SCHEMA_PATH, TYPES_PATH } from './constants';
const options = {
style: { singleQuote: true, tabWidth: 4 },
ignoreMinAndMaxItems: true,
unreachableDefinitions: true,
bannerComment: `/**
* DO NOT MODIFY BY HAND! This file was automatically generated.
* Instead, modify the original JSONSchema file in /message-system/schema, and run yarn build:libs.

View File

@@ -1,4 +1,9 @@
import type { Category, ExperimentsItem, MessageSystem } from '@suite-common/suite-types';
import type {
Category,
ExperimentsItem,
MessageSystem,
TradingType,
} from '@suite-common/suite-types';
import type { AccountType, NetworkSymbol, StakingNetworkSymbol } from '@suite-common/wallet-config';
export type MessageState = { [key in Category]: boolean };
@@ -104,8 +109,7 @@ const getAccountContext = (networkSymbol: NetworkSymbol, accountType?: AccountTy
const getStakingContext = (networkSymbol: StakingNetworkSymbol) =>
`accounts.${networkSymbol}.staking` as const;
// Todo: fix TradingType see: https://github.com/trezor/trezor-suite/pull/21265
const getTradingContext = (type: 'buy' | 'sell' | 'exchange') => `trading.${type}` as const;
const getTradingContext = (type: TradingType) => `trading.${type}` as const;
export type SettingsCategory = 'general' | 'device' | 'networks' | 'debug';
const getSettingsContext = (category: SettingsCategory) => `settings.${category}` as const;

View File

@@ -5,8 +5,15 @@
/**
* ISO 8601 date-time format.
*
* This interface was referenced by `MessageSystem`'s JSON-Schema
* via the `definition` "date-time".
*/
export type DateTime = string;
/**
* This interface was referenced by `MessageSystem`'s JSON-Schema
* via the `definition` "version".
*/
export type Version = string | string[];
export type Model = '1' | 'T' | 'T1B1' | 'T2T1' | 'T2B1' | 'Safe 3' | 'T3B1' | 'T3T1' | 'T3W1' | '';
export type FirmwareRevision = string;
@@ -15,6 +22,10 @@ export type FirmwareVariant = '*' | 'bitcoin-only' | 'universal';
* Eligible authorized vendors.
*/
export type Vendor = '*' | 'trezor.io';
/**
* This interface was referenced by `MessageSystem`'s JSON-Schema
* via the `definition` "countryCodes".
*/
export type CountryCodes =
| 'AD'
| 'AE'
@@ -271,10 +282,23 @@ export type CountryCodes =
* @minItems 1
*/
export type CountryCode = CountryCodes[];
/**
* This interface was referenced by `MessageSystem`'s JSON-Schema
* via the `definition` "conditions".
*/
export type Conditions = Condition[];
export type Variant = 'info' | 'warning' | 'critical';
/**
* This interface was referenced by `MessageSystem`'s JSON-Schema
* via the `definition` "category".
*/
export type Category = 'banner' | 'context' | 'modal' | 'feature';
export type CTAAction = 'internal-link' | 'external-link';
/**
* This interface was referenced by `MessageSystem`'s JSON-Schema
* via the `definition` "tradingType".
*/
export type TradingType = 'buy' | 'sell' | 'exchange';
/**
* JSON schema of the Trezor Suite messaging system.
@@ -373,6 +397,9 @@ export interface Message {
}
/**
* A multilingual text localization.
*
* This interface was referenced by `MessageSystem`'s JSON-Schema
* via the `definition` "localization".
*/
export interface Localization {
en: string;