import type { Order } from '@openocean.finance/widget-sdk' import type { PropsWithChildren } from 'react' import type { StoreApi } from 'zustand' import type { UseBoundStoreWithEqualityFn } from 'zustand/traditional' import type { Appearance, SplitSubvariant } from '../../types/widget.js' export type ValueSetter = ( key: K, value: S[Extract] ) => void export type ValueGetter = (key: K) => S[K] export type ValuesSetter = ( values: Record]> ) => void export const SettingsToolTypes = ['Bridges', 'Exchanges'] as const export type SettingsToolType = (typeof SettingsToolTypes)[number] export interface SettingsProps { appearance: Appearance gasPrice?: string language?: string routePriority?: Order enabledAutoRefuel: boolean slippage?: string dynamicSlippage?: boolean disabledBridges: string[] enabledBridges: string[] _enabledBridges: Record disabledExchanges: string[] enabledExchanges: string[] _enabledExchanges: Record } export interface SettingsActions { setValue: ValueSetter getValue: ValueGetter getSettings: () => SettingsProps initializeTools( toolType: SettingsToolType, tools: string[], reset?: boolean ): void setToolValue(toolType: SettingsToolType, tool: string, value: boolean): void toggleToolKeys(toolType: SettingsToolType, toolKeys: string[]): void reset(bridges: string[], exchanges: string[]): void } export type SettingsState = SettingsProps & SettingsActions export interface SendToWalletState { showSendToWallet: boolean } export interface SendToWalletStore extends SendToWalletState { setSendToWallet(value: boolean): void } export interface SplitSubvariantState { state?: SplitSubvariant setState(state: SplitSubvariant): void } export type SplitSubvariantStore = UseBoundStoreWithEqualityFn< StoreApi > export interface SplitSubvariantProps { state?: SplitSubvariant } export type SplitSubvariantProviderProps = PropsWithChildren