UNPKG

@cranberry-money/shared-types

Version:

Shared TypeScript type definitions for Blueberry platform

347 lines 12.3 kB
import type * as React from 'react'; import type { Portfolio, AssetAllocation, AssetHolding, Instrument, Trade, TargetTrade, WithdrawalRequest, WithdrawalAssetLiquidation, DashboardPerformanceData, WithdrawalSummary, InstrumentFilters, InstrumentMetadata, CashAccountTransaction, WithLoadingState, WithRefreshActions, SignupPayload, SigninPayload, FormErrors, CreateUserProfile, Country, BaseSummaryPanelProps, BaseTradingPanelProps, PortfolioTemplate, BadgeStyle, EmailVerificationPayload, PasswordValidation } from '../../index'; import type { Sector, Industry, StockExchange } from '../../models/reference/reference-data'; import type { TimeRange } from '@cranberry-money/shared-constants'; import type { AllocationChartData, InstrumentPerformanceData, InvestmentPreferenceFormState, InvestmentPreferenceFormValidation, ReviewData, CashSummary, TransactionFilters, TradeFilters, TargetTradeFilters, InstrumentHolding, TemplateWithAllocations, UserProfileFormValidation, TokenValidation, TaxResidencyForm, PortfolioSelectionFormValidation, FinancialSummary, ReviewAllocation } from './view-models'; export interface DashboardViewProps<TWithdrawalRequest = WithdrawalRequest, TWithdrawalAssetLiquidation = WithdrawalAssetLiquidation> { portfolio: Portfolio | undefined; allocations: AssetAllocation[]; holdings: AssetHolding[]; trades: Trade[]; targetTrades: TargetTrade[]; withdrawalRequests: TWithdrawalRequest[]; withdrawalLiquidations: TWithdrawalAssetLiquidation[]; withdrawalSummary: WithdrawalSummary<TWithdrawalAssetLiquidation>; performanceData: DashboardPerformanceData | null; totalCashBalance: number; isLoading: boolean; onRefresh?: () => void; onRefreshTrades?: () => void; onRefreshTargetTrades?: () => void; onRefreshCashTransactions?: () => void; onRefreshPortfolio?: () => void; onRefreshAssets?: () => void; onRefreshWithdrawals?: () => void; } export interface PortfolioSummaryCardProps { portfolio: Portfolio | undefined; performanceData: DashboardPerformanceData | null; totalCashBalance: number; onRefresh?: () => void; } export interface AssetsOverviewProps { allocations: AssetAllocation[]; holdings: AssetHolding[]; isLoading?: boolean; onRefresh?: () => void; } export interface UserFormProps { form: SignupPayload; errors: FormErrors; isSubmitting: boolean; showPassword: boolean; passwordValidation: PasswordValidation; onChange: (e: React.ChangeEvent<HTMLInputElement>) => void; onSubmit: (e: React.FormEvent) => void; onTogglePassword: () => void; } export interface SigninFormProps { form: SigninPayload; errors: FormErrors; generalError: string | null; isSubmitting: boolean; showPassword: boolean; onChange: (e: React.ChangeEvent<HTMLInputElement>) => void; onSubmit: (e: React.FormEvent) => void; onTogglePassword: () => void; } export interface EmailConfirmationFormProps { form: EmailVerificationPayload; errors: FormErrors; isSubmitting: boolean; isResending: boolean; tokenValidation?: TokenValidation; onChange: (e: React.ChangeEvent<HTMLInputElement>) => void; onSubmit: (e: React.FormEvent) => void; onResendCode: () => void; onBack?: () => void; } export interface UserProfileFormProps { form: CreateUserProfile; errors: FormErrors; countries: Country[]; isSubmitting: boolean; formValidation?: UserProfileFormValidation; onChange: (e: React.ChangeEvent<HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement>) => void; onSubmit: (e: React.FormEvent) => void; onBack?: () => void; } export interface InvestmentPreferenceFormProps { form: InvestmentPreferenceFormState; errors: FormErrors; isSubmitting: boolean; existingPreferenceUuid: string | null; formValidation?: InvestmentPreferenceFormValidation; onChange: (field: keyof InvestmentPreferenceFormState, value: string | string[] | number) => void; onSubmit: (e: React.FormEvent) => void; onBack?: () => void; } export interface TaxResidencyCardProps { taxResidency: TaxResidencyForm; index: number; countries: Country[]; onChange: (index: number, field: keyof TaxResidencyForm, value: string | boolean | null) => void; onRemove: (index: number) => void; onTogglePrimary: (index: number) => void; isOnlyOne: boolean; errors: Record<string, string>; } export interface PortfolioSelectionFormProps { templates: PortfolioTemplate[]; recommendedTemplateUuid: string | null; selectedTemplateUuid: string | null; viewingDetailsForUuid: string | null; templateAllocations: Record<string, TemplateWithAllocations>; errors: FormErrors; isSubmitting: boolean; formValidation?: PortfolioSelectionFormValidation; onSelectTemplate: (templateUuid: string) => void; onViewDetails: (templateUuid: string | null) => void; onSubmit: () => void; onCustomize: () => void; onBack?: () => void; } export interface ReviewFormProps<TDocumentType = string> { data: ReviewData; isLoading: boolean; error: string | null; termsAccepted: boolean; onTermsChange: (accepted: boolean) => void; onDocumentDownload: (type: TDocumentType) => void; onCompleteSignup: () => void; isSubmitting: boolean; canCompleteSignup: boolean; onBack?: () => void; } export interface AssetPerformanceChartProps { instrumentData: InstrumentPerformanceData[]; selectedTimeRange: TimeRange; isLoading: boolean; } export interface PortfolioPerformanceChartProps { allocations: AssetAllocation[]; instrumentData: InstrumentPerformanceData[]; selectedTimeRange: TimeRange; isLoading: boolean; } export interface TimeRangeSelectorProps { selectedRange: TimeRange; onRangeChange: (range: TimeRange) => void; } export interface AllocationSummaryProps { allocations: AssetAllocation[]; instrumentData: InstrumentPerformanceData[]; isLoading: boolean; } export interface AllocationChartProps { data: AllocationChartData[]; onPercentageChange?: (instrumentUuid: string, percentage: number) => void; disableControls?: boolean; } export interface PortfolioSelectionAllocationChartProps { templateData: TemplateWithAllocations; } export interface AllocationBarProps { instrumentData: InstrumentPerformanceData[]; } export interface SignupAllocationBarProps { instrumentData: InstrumentPerformanceData[]; } export interface PortfolioPerformancePanelProps { portfolio: Portfolio | null; allocations: AssetAllocation[]; instrumentData: InstrumentPerformanceData[]; selectedTimeRange: TimeRange; isLoading: boolean; isError: boolean; onTimeRangeChange: (timeRange: TimeRange) => void; onRetry: () => void; onContinue: () => void; onBackToPortfolioSelection: () => void; onBackToAssetAllocation: () => void; } export interface RecentTradesProps extends WithLoadingState, WithRefreshActions { trades: Trade[]; } export interface TargetTradesProps extends WithLoadingState, WithRefreshActions { targetTrades: TargetTrade[]; } export interface RecentTradeItemProps { trade: Trade; } export interface TargetTradeItemProps { targetTrade: TargetTrade; } export interface TradeItemProps { trade: Trade; } export interface TradesPanelProps { trades: Trade[]; dialogFilters: TradeFilters; clientSearchQuery: string; isLoading?: boolean; onSearch: (query: string) => void; onUpdateDialogFilters: (filters: Partial<TradeFilters>) => void; onApplyFiltersToServer: () => void; onClearAllFilters: () => void; } export interface TargetTradesPanelProps { targetTrades: TargetTrade[]; isLoading: boolean; onRefresh?: () => void; dialogTargetTradeFilters: TargetTradeFilters; clientTargetTradeSearchQuery: string; showTargetTradeFiltersDialog: boolean; onTargetTradeSearch: (query: string) => void; onClearTargetTradeSearch: () => void; onUpdateDialogTargetTradeFilters: (filters: Partial<TargetTradeFilters>) => void; onApplyTargetFiltersToServer: () => void; onClearAllTargetTradeFilters: () => void; onToggleTargetTradeFiltersDialog: () => void; } export interface CashTransactionsProps { cashAccountUuid?: string; onRefresh?: () => void; } export interface CashSummaryPanelProps extends BaseSummaryPanelProps<CashSummary> { cashSummary: CashSummary; summary: CashSummary; } export interface TransactionsPanelProps extends BaseTradingPanelProps<CashAccountTransaction, TransactionFilters> { transactions: CashAccountTransaction[]; items: CashAccountTransaction[]; showFiltersDialog: boolean; onOpenFiltersDialog: () => void; onCloseFiltersDialog: () => void; } export interface FinancialSummaryPanelProps { financialSummary: FinancialSummary; isLoading?: boolean; error?: Error | null; onRefresh?: () => void; } export interface WithdrawalOverviewProps { withdrawalRequests: WithdrawalRequest[]; withdrawalLiquidations: WithdrawalAssetLiquidation[]; withdrawalSummary: WithdrawalSummary<WithdrawalAssetLiquidation>; isLoading: boolean; onRefresh?: () => void; } export interface WithdrawalRequestItemProps { request: WithdrawalRequest; } export interface WithdrawalLiquidationItemProps { liquidation: WithdrawalAssetLiquidation; } export interface InstrumentsPanelProps extends WithLoadingState { instruments: Instrument[]; holdings: InstrumentHolding[]; sectors: Sector[]; exchanges: StockExchange[]; industries: Industry[]; loadingSectors: boolean; loadingExchanges: boolean; loadingIndustries: boolean; filters: InstrumentFilters; showFiltersDialog: boolean; onSearch: (query: string) => void; onClear: () => void; onUpdateFilters: (filters: Partial<InstrumentFilters>) => void; onApplyFilters: () => void; onClearFilters: () => void; onToggleFiltersDialog: () => void; onBuyInstrument: (instrumentUuid: string) => void; onSellInstrument: (instrumentUuid: string) => void; onRefresh?: () => void; } export interface InstrumentsTableProps { instruments: Instrument[]; selectedInstruments: Set<string>; onToggleInstrument: (instrumentUuid: string) => void; isLoading?: boolean; isSubmitting?: boolean; } export interface RadioGroupFieldProps { label: string; value: string; options: Array<{ value: string; label: string; }>; error?: string[]; onChange: (value: string) => void; } export interface CheckboxGroupFieldProps { label: string; value: string[]; options: Array<{ value: string; label: string; }>; error?: string[]; onChange: (values: string[]) => void; } export interface SearchFieldProps { value: string; onSearch: (query: string) => void; onClear: () => void; placeholder?: string; } export interface SearchTradesFieldProps { initialValue?: string; onSearch: (query: string) => void; placeholder?: string; } export interface AssetAllocationSearchFieldProps { value: string; onChange: (value: string) => void; placeholder?: string; showFilters: boolean; filters: InstrumentFilters; filterOptions: InstrumentMetadata; onToggleFilters: () => void; onCloseFilters: () => void; onUpdateFilters: (filters: Partial<InstrumentFilters>) => void; onApplyFilters: () => void; onClearFilters: () => void; } export interface TooltipProps { children: React.ReactNode; content: string; position?: 'top' | 'bottom' | 'left' | 'right'; className?: string; disabled?: boolean; delay?: number; } export interface BadgeProps extends BadgeStyle { children: React.ReactNode; onClick?: () => void; } export interface LayoutProps { children: React.ReactNode; } export interface LoadingStateProps { message?: string; className?: string; } export interface ErrorStateProps { title?: string; message?: string; retryLabel?: string; onRetry: () => void; className?: string; } export interface ReviewAllocationSummaryProps { allocations: ReviewAllocation[]; } //# sourceMappingURL=component-props.d.ts.map