diff --git a/packages/widget/src/stores/StoreProvider.tsx b/packages/widget/src/stores/StoreProvider.tsx index 96c6639c5..d19c7fc00 100644 --- a/packages/widget/src/stores/StoreProvider.tsx +++ b/packages/widget/src/stores/StoreProvider.tsx @@ -11,7 +11,11 @@ export const StoreProvider: React.FC> = ({ }) => { return ( diff --git a/packages/widget/src/stores/settings/types.ts b/packages/widget/src/stores/settings/types.ts index 249ecedc6..5101dcfd1 100644 --- a/packages/widget/src/stores/settings/types.ts +++ b/packages/widget/src/stores/settings/types.ts @@ -56,9 +56,11 @@ export interface SendToWalletStore extends SendToWalletState { setSendToWallet(value: boolean): void; } +export type SplitSubvariantOptions = 'bridge' | 'swap'; + export interface SplitSubvariantState { - state?: 'swap' | 'bridge'; - setState(state: 'swap' | 'bridge'): void; + state?: SplitSubvariantOptions; + setState(state: SplitSubvariantOptions): void; } export type SplitSubvariantStore = UseBoundStoreWithEqualityFn< @@ -66,7 +68,7 @@ export type SplitSubvariantStore = UseBoundStoreWithEqualityFn< >; export interface SplitSubvariantProps { - state?: 'swap' | 'bridge'; + state?: SplitSubvariantOptions; } export type SplitSubvariantProviderProps = diff --git a/packages/widget/src/stores/settings/useSplitSubvariantStore.tsx b/packages/widget/src/stores/settings/useSplitSubvariantStore.tsx index dcc2a668b..cb53e004c 100644 --- a/packages/widget/src/stores/settings/useSplitSubvariantStore.tsx +++ b/packages/widget/src/stores/settings/useSplitSubvariantStore.tsx @@ -15,7 +15,7 @@ const shouldRecreateStore = ( props: SplitSubvariantProps, ) => { const { state } = store.getState(); - return (!state && props.state) || (state && !props.state); + return state !== props.state; }; export function SplitSubvariantStoreProvider({ diff --git a/packages/widget/src/types/widget.ts b/packages/widget/src/types/widget.ts index 5afcb0823..62779fce0 100644 --- a/packages/widget/src/types/widget.ts +++ b/packages/widget/src/types/widget.ts @@ -18,6 +18,7 @@ import type { import type { TypographyOptions } from '@mui/material/styles/createTypography'; import type { CSSProperties, ReactNode, RefObject } from 'react'; import type { LanguageKey, LanguageResources } from '../providers'; +import type { SplitSubvariantOptions } from '../stores'; export type WidgetVariant = 'default' | 'expandable' | 'drawer'; @@ -121,6 +122,7 @@ export interface WidgetConfig { variant?: WidgetVariant; subvariant?: WidgetSubvariant; + subvariantOptions?: SplitSubvariantOptions; appearance?: Appearance; theme?: ThemeConfig;