@lifi/widget 1.27.1 → 1.28.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (221) hide show
  1. package/AppDrawer.style.d.ts +1 -1
  2. package/AppRoutes.js +15 -33
  3. package/README.md +1 -1
  4. package/cjs/AppDrawer.style.d.ts +1 -1
  5. package/cjs/AppRoutes.js +15 -33
  6. package/cjs/components/ActiveSwaps/ActiveSwaps.style.d.ts +1 -1
  7. package/cjs/components/Card/Card.d.ts +1 -1
  8. package/cjs/components/ChainSelect/ChainSelect.style.d.ts +1 -1
  9. package/cjs/components/ContractComponent/ContractComponent.d.ts +3 -0
  10. package/cjs/components/ContractComponent/ContractComponent.js +14 -0
  11. package/cjs/components/ContractComponent/index.d.ts +1 -0
  12. package/cjs/components/ContractComponent/index.js +17 -0
  13. package/cjs/components/Header/Header.style.d.ts +2 -2
  14. package/cjs/components/Header/NavigationHeader.js +10 -2
  15. package/cjs/components/Header/WalletHeader.js +1 -1
  16. package/cjs/components/NFT/NFT.d.ts +4 -0
  17. package/cjs/components/NFT/NFT.js +41 -0
  18. package/cjs/components/NFT/NFT.style.d.ts +16 -0
  19. package/cjs/components/NFT/NFT.style.js +11 -0
  20. package/cjs/components/NFT/index.d.ts +2 -0
  21. package/cjs/components/NFT/index.js +18 -0
  22. package/cjs/components/NFT/types.d.ts +15 -0
  23. package/cjs/components/NFT/types.js +2 -0
  24. package/cjs/components/ReverseTokensButton/ReverseTokensButton.style.d.ts +1 -1
  25. package/cjs/components/Select.d.ts +1 -1
  26. package/cjs/components/SelectChainAndToken.js +12 -2
  27. package/cjs/components/SelectTokenButton/SelectTokenButton.js +5 -2
  28. package/cjs/components/SendToWallet/SendToWallet.style.d.ts +1 -1
  29. package/cjs/components/SmallAvatar.d.ts +1 -1
  30. package/cjs/components/Step/StepProcess.style.d.ts +1 -1
  31. package/cjs/components/StepActions/StepActions.d.ts +6 -7
  32. package/cjs/components/StepActions/StepActions.js +41 -12
  33. package/cjs/components/StepActions/StepActions.style.d.ts +1 -1
  34. package/cjs/components/StepActions/types.d.ts +5 -0
  35. package/cjs/components/SwapInput/SwapInput.d.ts +2 -1
  36. package/cjs/components/SwapInput/SwapInput.js +15 -3
  37. package/cjs/components/SwapInput/SwapInput.style.d.ts +1 -1
  38. package/cjs/components/SwapInput/SwapInputAdornment.style.d.ts +1 -1
  39. package/cjs/components/SwapRouteCard/SwapRouteCard.js +3 -1
  40. package/cjs/components/SwapRouteCard/SwapRouteCard.style.d.ts +1 -1
  41. package/cjs/components/Token/Token.d.ts +1 -1
  42. package/cjs/components/Token/Token.js +12 -12
  43. package/cjs/components/TokenAvatar/TokenAvatar.d.ts +5 -3
  44. package/cjs/components/TokenAvatar/TokenAvatar.js +10 -9
  45. package/cjs/components/TokenList/TokenList.style.js +6 -0
  46. package/cjs/components/TokenList/VirtualizedTokenList.js +4 -2
  47. package/cjs/config/theme.js +3 -5
  48. package/cjs/config/version.d.ts +1 -1
  49. package/cjs/config/version.js +1 -1
  50. package/cjs/hooks/useSwapRoutes.d.ts +5 -2
  51. package/cjs/hooks/useSwapRoutes.js +64 -14
  52. package/cjs/hooks/useToken.d.ts +1 -1
  53. package/cjs/hooks/useTokenSearch.d.ts +1 -1
  54. package/cjs/i18n/de.json +214 -214
  55. package/cjs/i18n/en.json +218 -214
  56. package/cjs/i18n/es.json +191 -191
  57. package/cjs/i18n/fr.json +214 -214
  58. package/cjs/i18n/it.json +214 -214
  59. package/cjs/i18n/uk.json +214 -214
  60. package/cjs/i18n/zh.json +214 -214
  61. package/cjs/index.d.ts +2 -0
  62. package/cjs/index.js +4 -1
  63. package/cjs/pages/MainPage/MainPage.js +5 -1
  64. package/cjs/pages/SettingsPage/ColorSchemeButtonGroup.style.d.ts +1 -1
  65. package/cjs/pages/SettingsPage/LanguageSelect.js +1 -2
  66. package/cjs/providers/SwapFormProvider/types.d.ts +10 -0
  67. package/cjs/providers/SwapFormProvider/types.js +5 -0
  68. package/cjs/stores/chains/useChainOrderStore.d.ts +1 -1
  69. package/cjs/stores/routes/useRouteExecutionStore.d.ts +1 -1
  70. package/cjs/stores/settings/useSettingsStore.d.ts +1 -1
  71. package/cjs/types/widget.d.ts +12 -6
  72. package/cjs/types/widget.js +2 -0
  73. package/components/ActiveSwaps/ActiveSwaps.style.d.ts +1 -1
  74. package/components/Card/Card.d.ts +1 -1
  75. package/components/ChainSelect/ChainSelect.style.d.ts +1 -1
  76. package/components/ContractComponent/ContractComponent.d.ts +3 -0
  77. package/components/ContractComponent/ContractComponent.js +10 -0
  78. package/components/ContractComponent/index.d.ts +1 -0
  79. package/components/ContractComponent/index.js +1 -0
  80. package/components/Header/Header.style.d.ts +2 -2
  81. package/components/Header/NavigationHeader.js +12 -4
  82. package/components/Header/WalletHeader.js +1 -1
  83. package/components/NFT/NFT.d.ts +4 -0
  84. package/components/NFT/NFT.js +37 -0
  85. package/components/NFT/NFT.style.d.ts +16 -0
  86. package/components/NFT/NFT.style.js +8 -0
  87. package/components/NFT/index.d.ts +2 -0
  88. package/components/NFT/index.js +2 -0
  89. package/components/NFT/types.d.ts +15 -0
  90. package/components/NFT/types.js +1 -0
  91. package/components/ReverseTokensButton/ReverseTokensButton.style.d.ts +1 -1
  92. package/components/Select.d.ts +1 -1
  93. package/components/SelectChainAndToken.js +12 -2
  94. package/components/SelectTokenButton/SelectTokenButton.js +5 -2
  95. package/components/SendToWallet/SendToWallet.style.d.ts +1 -1
  96. package/components/SmallAvatar.d.ts +1 -1
  97. package/components/Step/StepProcess.style.d.ts +1 -1
  98. package/components/StepActions/StepActions.d.ts +6 -7
  99. package/components/StepActions/StepActions.js +40 -12
  100. package/components/StepActions/StepActions.style.d.ts +1 -1
  101. package/components/StepActions/types.d.ts +5 -0
  102. package/components/SwapInput/SwapInput.d.ts +2 -1
  103. package/components/SwapInput/SwapInput.js +15 -3
  104. package/components/SwapInput/SwapInput.style.d.ts +1 -1
  105. package/components/SwapInput/SwapInputAdornment.style.d.ts +1 -1
  106. package/components/SwapRouteCard/SwapRouteCard.js +3 -1
  107. package/components/SwapRouteCard/SwapRouteCard.style.d.ts +1 -1
  108. package/components/Token/Token.d.ts +1 -1
  109. package/components/Token/Token.js +13 -13
  110. package/components/TokenAvatar/TokenAvatar.d.ts +5 -3
  111. package/components/TokenAvatar/TokenAvatar.js +10 -9
  112. package/components/TokenList/TokenList.style.js +6 -0
  113. package/components/TokenList/VirtualizedTokenList.js +4 -2
  114. package/config/theme.js +3 -5
  115. package/config/version.d.ts +1 -1
  116. package/config/version.js +1 -1
  117. package/hooks/useSwapRoutes.d.ts +5 -2
  118. package/hooks/useSwapRoutes.js +64 -14
  119. package/hooks/useToken.d.ts +1 -1
  120. package/hooks/useTokenSearch.d.ts +1 -1
  121. package/i18n/de.json +214 -214
  122. package/i18n/en.json +218 -214
  123. package/i18n/es.json +191 -191
  124. package/i18n/fr.json +214 -214
  125. package/i18n/it.json +214 -214
  126. package/i18n/uk.json +214 -214
  127. package/i18n/zh.json +214 -214
  128. package/index.d.ts +2 -0
  129. package/index.js +2 -0
  130. package/package.json +15 -13
  131. package/pages/MainPage/MainPage.js +5 -1
  132. package/pages/SettingsPage/ColorSchemeButtonGroup.style.d.ts +1 -1
  133. package/pages/SettingsPage/LanguageSelect.js +1 -2
  134. package/providers/SwapFormProvider/types.d.ts +10 -0
  135. package/providers/SwapFormProvider/types.js +5 -0
  136. package/stores/chains/useChainOrderStore.d.ts +1 -1
  137. package/stores/routes/useRouteExecutionStore.d.ts +1 -1
  138. package/stores/settings/useSettingsStore.d.ts +1 -1
  139. package/tsconfig.cjs.tsbuildinfo +1 -1
  140. package/types/widget.d.ts +12 -6
  141. package/types/widget.js +2 -0
  142. package/cjs/fonts/Inter-Black.woff +0 -0
  143. package/cjs/fonts/Inter-Black.woff2 +0 -0
  144. package/cjs/fonts/Inter-BlackItalic.woff +0 -0
  145. package/cjs/fonts/Inter-BlackItalic.woff2 +0 -0
  146. package/cjs/fonts/Inter-Bold.woff +0 -0
  147. package/cjs/fonts/Inter-Bold.woff2 +0 -0
  148. package/cjs/fonts/Inter-BoldItalic.woff +0 -0
  149. package/cjs/fonts/Inter-BoldItalic.woff2 +0 -0
  150. package/cjs/fonts/Inter-ExtraBold.woff +0 -0
  151. package/cjs/fonts/Inter-ExtraBold.woff2 +0 -0
  152. package/cjs/fonts/Inter-ExtraBoldItalic.woff +0 -0
  153. package/cjs/fonts/Inter-ExtraBoldItalic.woff2 +0 -0
  154. package/cjs/fonts/Inter-ExtraLight.woff +0 -0
  155. package/cjs/fonts/Inter-ExtraLight.woff2 +0 -0
  156. package/cjs/fonts/Inter-ExtraLightItalic.woff +0 -0
  157. package/cjs/fonts/Inter-ExtraLightItalic.woff2 +0 -0
  158. package/cjs/fonts/Inter-Italic.woff +0 -0
  159. package/cjs/fonts/Inter-Italic.woff2 +0 -0
  160. package/cjs/fonts/Inter-Light.woff +0 -0
  161. package/cjs/fonts/Inter-Light.woff2 +0 -0
  162. package/cjs/fonts/Inter-LightItalic.woff +0 -0
  163. package/cjs/fonts/Inter-LightItalic.woff2 +0 -0
  164. package/cjs/fonts/Inter-Medium.woff +0 -0
  165. package/cjs/fonts/Inter-Medium.woff2 +0 -0
  166. package/cjs/fonts/Inter-MediumItalic.woff +0 -0
  167. package/cjs/fonts/Inter-MediumItalic.woff2 +0 -0
  168. package/cjs/fonts/Inter-Regular.woff +0 -0
  169. package/cjs/fonts/Inter-Regular.woff2 +0 -0
  170. package/cjs/fonts/Inter-SemiBold.woff +0 -0
  171. package/cjs/fonts/Inter-SemiBold.woff2 +0 -0
  172. package/cjs/fonts/Inter-SemiBoldItalic.woff +0 -0
  173. package/cjs/fonts/Inter-SemiBoldItalic.woff2 +0 -0
  174. package/cjs/fonts/Inter-Thin.woff +0 -0
  175. package/cjs/fonts/Inter-Thin.woff2 +0 -0
  176. package/cjs/fonts/Inter-ThinItalic.woff +0 -0
  177. package/cjs/fonts/Inter-ThinItalic.woff2 +0 -0
  178. package/cjs/fonts/Inter-italic.var.woff2 +0 -0
  179. package/cjs/fonts/Inter-roman.var.woff2 +0 -0
  180. package/cjs/fonts/Inter.var.woff2 +0 -0
  181. package/cjs/fonts/inter.css +0 -200
  182. package/fonts/Inter-Black.woff +0 -0
  183. package/fonts/Inter-Black.woff2 +0 -0
  184. package/fonts/Inter-BlackItalic.woff +0 -0
  185. package/fonts/Inter-BlackItalic.woff2 +0 -0
  186. package/fonts/Inter-Bold.woff +0 -0
  187. package/fonts/Inter-Bold.woff2 +0 -0
  188. package/fonts/Inter-BoldItalic.woff +0 -0
  189. package/fonts/Inter-BoldItalic.woff2 +0 -0
  190. package/fonts/Inter-ExtraBold.woff +0 -0
  191. package/fonts/Inter-ExtraBold.woff2 +0 -0
  192. package/fonts/Inter-ExtraBoldItalic.woff +0 -0
  193. package/fonts/Inter-ExtraBoldItalic.woff2 +0 -0
  194. package/fonts/Inter-ExtraLight.woff +0 -0
  195. package/fonts/Inter-ExtraLight.woff2 +0 -0
  196. package/fonts/Inter-ExtraLightItalic.woff +0 -0
  197. package/fonts/Inter-ExtraLightItalic.woff2 +0 -0
  198. package/fonts/Inter-Italic.woff +0 -0
  199. package/fonts/Inter-Italic.woff2 +0 -0
  200. package/fonts/Inter-Light.woff +0 -0
  201. package/fonts/Inter-Light.woff2 +0 -0
  202. package/fonts/Inter-LightItalic.woff +0 -0
  203. package/fonts/Inter-LightItalic.woff2 +0 -0
  204. package/fonts/Inter-Medium.woff +0 -0
  205. package/fonts/Inter-Medium.woff2 +0 -0
  206. package/fonts/Inter-MediumItalic.woff +0 -0
  207. package/fonts/Inter-MediumItalic.woff2 +0 -0
  208. package/fonts/Inter-Regular.woff +0 -0
  209. package/fonts/Inter-Regular.woff2 +0 -0
  210. package/fonts/Inter-SemiBold.woff +0 -0
  211. package/fonts/Inter-SemiBold.woff2 +0 -0
  212. package/fonts/Inter-SemiBoldItalic.woff +0 -0
  213. package/fonts/Inter-SemiBoldItalic.woff2 +0 -0
  214. package/fonts/Inter-Thin.woff +0 -0
  215. package/fonts/Inter-Thin.woff2 +0 -0
  216. package/fonts/Inter-ThinItalic.woff +0 -0
  217. package/fonts/Inter-ThinItalic.woff2 +0 -0
  218. package/fonts/Inter-italic.var.woff2 +0 -0
  219. package/fonts/Inter-roman.var.woff2 +0 -0
  220. package/fonts/Inter.var.woff2 +0 -0
  221. package/fonts/inter.css +0 -200
@@ -1,10 +1,10 @@
1
1
  import type { Signer } from '@ethersproject/abstract-signer';
2
2
  import type { ChainKey, ConfigUpdate, Order, RouteOptions, Token } from '@lifi/sdk';
3
- import type { PaletteMode, PaletteOptions, Shape } from '@mui/material';
3
+ import type { Components, PaletteMode, PaletteOptions, Shape, Theme } from '@mui/material';
4
4
  import type { TypographyOptions } from '@mui/material/styles/createTypography';
5
5
  import type { CSSProperties, ReactNode, RefObject } from 'react';
6
6
  import type { LanguageKey, LanguageResources } from '../providers';
7
- export type WidgetVariant = 'default' | 'expandable' | 'drawer' | 'refuel';
7
+ export type WidgetVariant = 'default' | 'expandable' | 'drawer' | 'refuel' | 'nft';
8
8
  export declare enum DisabledUI {
9
9
  FromAmount = "fromAmount",
10
10
  FromToken = "fromToken",
@@ -21,9 +21,10 @@ export declare enum HiddenUI {
21
21
  export type HiddenUIType = `${HiddenUI}`;
22
22
  export type Appearance = PaletteMode | 'auto';
23
23
  export type ThemeConfig = {
24
- palette?: Pick<PaletteOptions, 'grey' | 'background' | 'text' | 'secondary' | 'primary'>;
24
+ palette?: Pick<PaletteOptions, 'background' | 'grey' | 'primary' | 'secondary' | 'text'>;
25
25
  shape?: Shape;
26
26
  typography?: TypographyOptions;
27
+ components?: Pick<Components<Omit<Theme, 'components'>>, 'MuiAvatar'>;
27
28
  };
28
29
  export interface WidgetWalletManagement {
29
30
  connect(): Promise<Signer>;
@@ -36,10 +37,14 @@ export interface WidgetWalletManagement {
36
37
  export interface SDKConfig extends Omit<ConfigUpdate, 'defaultExecutionSettings' | 'defaultRouteOptions' | 'disableVersionCheck'> {
37
38
  defaultRouteOptions?: Omit<RouteOptions, 'bridges' | 'exchanges'>;
38
39
  }
40
+ export interface WidgetContractTool {
41
+ logoURI: string;
42
+ name: string;
43
+ }
39
44
  export interface WidgetContract {
40
- address: string;
41
- callData: string;
42
- gasLimit: string;
45
+ address?: string;
46
+ callData?: string;
47
+ gasLimit?: string;
43
48
  approvalAddress?: string;
44
49
  outputToken?: string;
45
50
  fallbackAddress?: string;
@@ -55,6 +60,7 @@ export interface WidgetConfig {
55
60
  contract?: WidgetContract;
56
61
  contractComponent?: ReactNode;
57
62
  contractCompactComponent?: ReactNode;
63
+ contractTool?: WidgetContractTool;
58
64
  fee?: number;
59
65
  integrator?: string;
60
66
  referrer?: string;
@@ -11,7 +11,9 @@ var DisabledUI;
11
11
  var HiddenUI;
12
12
  (function (HiddenUI) {
13
13
  HiddenUI["Appearance"] = "appearance";
14
+ // FromAmount = 'fromAmount',
14
15
  HiddenUI["Language"] = "language";
15
16
  HiddenUI["PoweredBy"] = "poweredBy";
16
17
  HiddenUI["ToAddress"] = "toAddress";
18
+ // ToToken = 'toToken',
17
19
  })(HiddenUI = exports.HiddenUI || (exports.HiddenUI = {}));
@@ -39,7 +39,7 @@ export declare const ListItem: import("@emotion/styled").StyledComponent<{
39
39
  export declare const ShowAllButton: import("@emotion/styled").StyledComponent<{
40
40
  children?: import("react").ReactNode;
41
41
  classes?: Partial<import("@mui/material").ButtonClasses> | undefined;
42
- color?: "inherit" | "success" | "warning" | "error" | "secondary" | "primary" | "info" | undefined;
42
+ color?: "inherit" | "success" | "warning" | "error" | "primary" | "secondary" | "info" | undefined;
43
43
  disabled?: boolean | undefined;
44
44
  disableElevation?: boolean | undefined;
45
45
  disableFocusRipple?: boolean | undefined;
@@ -18,7 +18,7 @@ export declare const Card: import("@emotion/styled").StyledComponent<import("@mu
18
18
  ref?: import("react").RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void) | null | undefined;
19
19
  }, keyof import("@mui/material/OverridableComponent").CommonProps | "children" | "sx" | "ref" | ("p" | "color" | "border" | "boxShadow" | "fontWeight" | "zIndex" | "alignContent" | "alignItems" | "alignSelf" | "bottom" | "boxSizing" | "columnGap" | "display" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "fontFamily" | "fontSize" | "fontStyle" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "height" | "justifyContent" | "justifyItems" | "justifySelf" | "left" | "letterSpacing" | "lineHeight" | "marginBottom" | "marginLeft" | "marginRight" | "marginTop" | "maxHeight" | "maxWidth" | "minHeight" | "minWidth" | "order" | "paddingBottom" | "paddingLeft" | "paddingRight" | "paddingTop" | "position" | "right" | "rowGap" | "textAlign" | "textOverflow" | "textTransform" | "top" | "visibility" | "whiteSpace" | "width" | "borderBottom" | "borderColor" | "borderLeft" | "borderRadius" | "borderRight" | "borderTop" | "flex" | "gap" | "gridArea" | "gridColumn" | "gridRow" | "margin" | "overflow" | "padding" | "bgcolor" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "marginX" | "my" | "marginY" | "pt" | "pr" | "pb" | "pl" | "px" | "paddingX" | "py" | "paddingY" | "typography" | "displayPrint") | "component"> & import("@mui/system").MUIStyledCommonProps<Theme> & {
20
20
  variant?: CardVariant | undefined;
21
- selectionColor?: "secondary" | "primary" | undefined;
21
+ selectionColor?: "primary" | "secondary" | undefined;
22
22
  dense?: boolean | undefined;
23
23
  indented?: boolean | undefined;
24
24
  onClick?: MouseEventHandler<HTMLDivElement> | undefined;
@@ -8,7 +8,7 @@ export declare const ChainCard: import("@emotion/styled").StyledComponent<import
8
8
  ref?: import("react").RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void) | null | undefined;
9
9
  }, keyof import("@mui/material/OverridableComponent").CommonProps | "children" | "sx" | "ref" | ("p" | "color" | "border" | "boxShadow" | "fontWeight" | "zIndex" | "alignContent" | "alignItems" | "alignSelf" | "bottom" | "boxSizing" | "columnGap" | "display" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "fontFamily" | "fontSize" | "fontStyle" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "height" | "justifyContent" | "justifyItems" | "justifySelf" | "left" | "letterSpacing" | "lineHeight" | "marginBottom" | "marginLeft" | "marginRight" | "marginTop" | "maxHeight" | "maxWidth" | "minHeight" | "minWidth" | "order" | "paddingBottom" | "paddingLeft" | "paddingRight" | "paddingTop" | "position" | "right" | "rowGap" | "textAlign" | "textOverflow" | "textTransform" | "top" | "visibility" | "whiteSpace" | "width" | "borderBottom" | "borderColor" | "borderLeft" | "borderRadius" | "borderRight" | "borderTop" | "flex" | "gap" | "gridArea" | "gridColumn" | "gridRow" | "margin" | "overflow" | "padding" | "bgcolor" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "marginX" | "my" | "marginY" | "pt" | "pr" | "pb" | "pl" | "px" | "paddingX" | "py" | "paddingY" | "typography" | "displayPrint") | "component"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & {
10
10
  variant?: ("default" | "error" | "selected") | undefined;
11
- selectionColor?: "secondary" | "primary" | undefined;
11
+ selectionColor?: "primary" | "secondary" | undefined;
12
12
  dense?: boolean | undefined;
13
13
  indented?: boolean | undefined;
14
14
  onClick?: import("react").MouseEventHandler<HTMLDivElement> | undefined;
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ import type { BoxProps } from '@mui/material';
3
+ export declare const ContractComponent: React.FC<BoxProps>;
@@ -0,0 +1,10 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useWidgetConfig } from '../../providers';
3
+ import { Card } from '../Card';
4
+ export const ContractComponent = (props) => {
5
+ const { contractComponent } = useWidgetConfig();
6
+ if (!contractComponent) {
7
+ return null;
8
+ }
9
+ return (_jsx(Card, Object.assign({ flex: 1 }, props, { children: contractComponent })));
10
+ };
@@ -0,0 +1 @@
1
+ export * from './ContractComponent';
@@ -0,0 +1 @@
1
+ export * from './ContractComponent';
@@ -1,7 +1,7 @@
1
1
  /// <reference types="react" />
2
2
  export declare const HeaderAppBar: import("@emotion/styled").StyledComponent<Omit<import("@mui/material").PaperProps<"div", {}>, "classes" | "color" | "position"> & {
3
3
  classes?: Partial<import("@mui/material").AppBarClasses> | undefined;
4
- color?: "inherit" | "transparent" | "default" | "secondary" | "primary" | undefined;
4
+ color?: "inherit" | "transparent" | "default" | "primary" | "secondary" | undefined;
5
5
  enableColorOnDark?: boolean | undefined;
6
6
  position?: "fixed" | "absolute" | "relative" | "static" | "sticky" | undefined;
7
7
  sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
@@ -21,7 +21,7 @@ export declare const Container: import("@emotion/styled").StyledComponent<import
21
21
  export declare const WalletButton: import("@emotion/styled").StyledComponent<{
22
22
  children?: import("react").ReactNode;
23
23
  classes?: Partial<import("@mui/material").ButtonClasses> | undefined;
24
- color?: "inherit" | "success" | "warning" | "error" | "secondary" | "primary" | "info" | undefined;
24
+ color?: "inherit" | "success" | "warning" | "error" | "primary" | "secondary" | "info" | undefined;
25
25
  disabled?: boolean | undefined;
26
26
  disableElevation?: boolean | undefined;
27
27
  disableFocusRipple?: boolean | undefined;
@@ -1,11 +1,11 @@
1
1
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { ArrowBack as ArrowBackIcon, ReceiptLongRounded as HistoryIcon, SettingsOutlined as SettingsIcon } from '@mui/icons-material';
2
+ import { ArrowBack as ArrowBackIcon, ReceiptLongRounded as HistoryIcon, SettingsOutlined as SettingsIcon, } from '@mui/icons-material';
3
3
  import { Box, IconButton, Tooltip, Typography } from '@mui/material';
4
4
  import { useTranslation } from 'react-i18next';
5
5
  import { Route, Routes, useLocation } from 'react-router-dom';
6
6
  import { useNavigateBack } from '../../hooks';
7
7
  import { useWallet, useWidgetConfig } from '../../providers';
8
- import { backButtonRoutes, navigationRoutes, navigationRoutesValues } from '../../utils';
8
+ import { backButtonRoutes, navigationRoutes, navigationRoutesValues, } from '../../utils';
9
9
  import { HeaderAppBar } from './Header.style';
10
10
  import { useHeaderActionStore } from './useHeaderActionStore';
11
11
  export const NavigationHeader = () => {
@@ -44,8 +44,16 @@ export const NavigationHeader = () => {
44
44
  return t(`header.swap`);
45
45
  case navigationRoutes.swapDetails:
46
46
  return t(`header.swapDetails`);
47
- default:
48
- return variant !== 'refuel' ? t(`header.swap`) : t(`header.gas`);
47
+ default: {
48
+ switch (variant) {
49
+ case 'nft':
50
+ return t(`header.checkout`);
51
+ case 'refuel':
52
+ return t(`header.gas`);
53
+ default:
54
+ return t(`header.swap`);
55
+ }
56
+ }
49
57
  }
50
58
  };
51
59
  return (_jsxs(HeaderAppBar, Object.assign({ elevation: 0 }, { children: [backButtonRoutes.includes(path) ? (_jsx(IconButton, Object.assign({ size: "medium", edge: "start", onClick: navigateBack }, { children: _jsx(ArrowBackIcon, {}) }))) : null, _jsx(Typography, Object.assign({ fontSize: hasPath ? 18 : 24, align: hasPath ? 'center' : 'left', fontWeight: "700", flex: 1, noWrap: true }, { children: handleHeaderTitle() })), _jsxs(Routes, { children: [_jsx(Route, { path: navigationRoutes.home, element: _jsxs(_Fragment, { children: [account.isActive ? (_jsx(Tooltip, Object.assign({ title: t(`header.swapHistory`), enterDelay: 400, arrow: true }, { children: _jsx(IconButton, Object.assign({ size: "medium", edge: "start", onClick: () => navigate(navigationRoutes.swapHistory) }, { children: _jsx(HistoryIcon, {}) })) }))) : null, _jsx(Tooltip, Object.assign({ title: t(`header.settings`), enterDelay: 400, arrow: true }, { children: _jsx(IconButton, Object.assign({ size: "medium", onClick: () => navigate(navigationRoutes.settings), sx: {
@@ -62,5 +62,5 @@ const ConnectedButton = () => {
62
62
  });
63
63
  return (_jsxs(_Fragment, { children: [_jsx(WalletButton, Object.assign({ endIcon: _jsx(ExpandMoreIcon, {}), startIcon: _jsx(Avatar, Object.assign({ src: chain === null || chain === void 0 ? void 0 : chain.logoURI, alt: chain === null || chain === void 0 ? void 0 : chain.key, sx: { width: 24, height: 24 } }, { children: chain === null || chain === void 0 ? void 0 : chain.name[0] })), sx: {
64
64
  marginRight: -1.25,
65
- }, onClick: handleClick }, { children: walletAddress })), _jsxs(Menu, Object.assign({ elevation: 2, anchorEl: anchorEl, open: Boolean(anchorEl), onClose: handleClose }, { children: [_jsxs(MenuItem, Object.assign({ onClick: handleCopyAddress, disableRipple: true, dense: true }, { children: [_jsx(ContentCopyIcon, {}), t(`button.copyAddress`)] })), _jsxs(MenuItem, Object.assign({ onClick: handleDisconnect, disableRipple: true, dense: true }, { children: [_jsx(PowerSettingsIcon, {}), t(`button.disconnectWallet`)] }))] }))] }));
65
+ }, onClick: handleClick }, { children: walletAddress })), _jsxs(Menu, Object.assign({ elevation: 2, anchorEl: anchorEl, open: Boolean(anchorEl), onClose: handleClose }, { children: [_jsxs(MenuItem, Object.assign({ onClick: handleCopyAddress, disableRipple: true }, { children: [_jsx(ContentCopyIcon, {}), t(`button.copyAddress`)] })), _jsxs(MenuItem, Object.assign({ onClick: handleDisconnect, disableRipple: true }, { children: [_jsx(PowerSettingsIcon, {}), t(`button.disconnectWallet`)] }))] }))] }));
66
66
  };
@@ -0,0 +1,4 @@
1
+ /// <reference types="react" />
2
+ import type { BoxProps } from '@mui/material';
3
+ import type { NFTProps } from './types';
4
+ export declare const NFT: React.FC<BoxProps & NFTProps>;
@@ -0,0 +1,37 @@
1
+ var __rest = (this && this.__rest) || function (s, e) {
2
+ var t = {};
3
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
+ t[p] = s[p];
5
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
+ t[p[i]] = s[p[i]];
9
+ }
10
+ return t;
11
+ };
12
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
+ import { Box, Link, Skeleton, Typography } from '@mui/material';
14
+ import { useEffect } from 'react';
15
+ import { useFormContext } from 'react-hook-form';
16
+ import { useTranslation } from 'react-i18next';
17
+ import { SwapFormKey } from '../../providers';
18
+ import { Token } from '../Token';
19
+ import { PreviewAvatar } from './NFT.style';
20
+ export const NFT = (_a) => {
21
+ var { imageUrl, isLoading, collectonName, assetName, owner, token, contract } = _a, props = __rest(_a, ["imageUrl", "isLoading", "collectonName", "assetName", "owner", "token", "contract"]);
22
+ const { t } = useTranslation();
23
+ const { setValue } = useFormContext();
24
+ useEffect(() => {
25
+ if (token) {
26
+ setValue(SwapFormKey.ToChain, token.chainId);
27
+ setValue(SwapFormKey.ToToken, token.address);
28
+ setValue(SwapFormKey.ToAmount, token.amount);
29
+ }
30
+ if (contract) {
31
+ setValue(SwapFormKey.ToContractAddress, contract.address);
32
+ setValue(SwapFormKey.ToContractCallData, contract.callData);
33
+ setValue(SwapFormKey.ToContractGasLimit, contract.gasLimit);
34
+ }
35
+ }, [contract, setValue, token]);
36
+ return (_jsxs(Box, Object.assign({ p: 2 }, { children: [_jsxs(Box, Object.assign({ display: "flex" }, { children: [isLoading ? (_jsx(Skeleton, { width: 96, height: 96, variant: "rectangular", sx: { borderRadius: 1 } })) : (_jsx(PreviewAvatar, { src: imageUrl })), _jsxs(Box, Object.assign({ ml: 2 }, { children: [isLoading ? (_jsx(Skeleton, { width: 144, height: 21, variant: "text" })) : (_jsx(Typography, Object.assign({ fontSize: 14, color: "text.secondary" }, { children: collectonName }))), isLoading ? (_jsx(Skeleton, { width: 112, height: 27, variant: "text" })) : (_jsx(Typography, Object.assign({ fontSize: 18, fontWeight: 600 }, { children: assetName }))), isLoading ? (_jsx(Skeleton, { width: 128, height: 21, variant: "text" })) : owner ? (_jsxs(Typography, Object.assign({ fontSize: 14, color: "text.secondary" }, { children: [t('swap.ownedBy'), ' ', _jsx(Link, Object.assign({ href: owner.url, target: "_blank", underline: "none", color: "primary" }, { children: owner.name }))] }))) : null] }))] })), _jsx(Token, { token: token, isLoading: isLoading, mt: 2 })] })));
37
+ };
@@ -0,0 +1,16 @@
1
+ /// <reference types="react" />
2
+ export declare const PreviewAvatar: import("@emotion/styled").StyledComponent<{
3
+ alt?: string | undefined;
4
+ children?: import("react").ReactNode;
5
+ classes?: Partial<import("@mui/material").AvatarClasses> | undefined;
6
+ imgProps?: (import("react").ImgHTMLAttributes<HTMLImageElement> & {
7
+ sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
8
+ }) | undefined;
9
+ sizes?: string | undefined;
10
+ src?: string | undefined;
11
+ srcSet?: string | undefined;
12
+ sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
13
+ variant?: "square" | "circular" | "rounded" | undefined;
14
+ } & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>> & {
15
+ ref?: import("react").RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void) | null | undefined;
16
+ }, keyof import("@mui/material/OverridableComponent").CommonProps | "children" | "sx" | "variant" | "alt" | "imgProps" | "sizes" | "src" | "srcSet"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
@@ -0,0 +1,8 @@
1
+ import { Avatar } from '@mui/material';
2
+ import { styled } from '@mui/material/styles';
3
+ export const PreviewAvatar = styled(Avatar)(({ theme }) => ({
4
+ background: theme.palette.background.paper,
5
+ width: 96,
6
+ height: 96,
7
+ borderRadius: theme.shape.borderRadius,
8
+ }));
@@ -0,0 +1,2 @@
1
+ export * from './NFT';
2
+ export * from './types';
@@ -0,0 +1,2 @@
1
+ export * from './NFT';
2
+ export * from './types';
@@ -0,0 +1,15 @@
1
+ import type { TokenAmount } from '@lifi/sdk';
2
+ import type { WidgetContract } from '../../types';
3
+ export interface NFTProps {
4
+ imageUrl?: string;
5
+ collectonName?: string;
6
+ assetName?: string;
7
+ isLoading?: boolean;
8
+ owner?: NFTOwner;
9
+ token?: TokenAmount;
10
+ contract?: WidgetContract;
11
+ }
12
+ export interface NFTOwner {
13
+ name?: string;
14
+ url?: string;
15
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -2,7 +2,7 @@
2
2
  export declare const IconButton: import("@emotion/styled").StyledComponent<{
3
3
  children?: import("react").ReactNode;
4
4
  classes?: Partial<import("@mui/material").IconButtonClasses> | undefined;
5
- color?: "inherit" | "default" | "success" | "warning" | "error" | "secondary" | "primary" | "info" | undefined;
5
+ color?: "inherit" | "default" | "success" | "warning" | "error" | "primary" | "secondary" | "info" | undefined;
6
6
  disabled?: boolean | undefined;
7
7
  disableFocusRipple?: boolean | undefined;
8
8
  edge?: false | "end" | "start" | undefined;
@@ -1,3 +1,3 @@
1
- export declare const Select: import("@emotion/styled").StyledComponent<import("@mui/material").SelectProps<unknown> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & {
1
+ export declare const Select: import("@emotion/styled").StyledComponent<(import("@mui/material").SelectProps<unknown> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>) & {
2
2
  dense?: boolean | undefined;
3
3
  }, {}, {}>;
@@ -19,6 +19,16 @@ export const SelectChainAndToken = (props) => {
19
19
  const disabledReverse = variant === 'refuel' ||
20
20
  (disabledUI === null || disabledUI === void 0 ? void 0 : disabledUI.includes(DisabledUI.FromToken)) ||
21
21
  (disabledUI === null || disabledUI === void 0 ? void 0 : disabledUI.includes(DisabledUI.ToToken));
22
- const isCompact = fromChain && toChain && fromToken && toToken && !prefersNarrowView;
23
- return (_jsxs(Box, Object.assign({ sx: { display: 'flex', flexDirection: isCompact ? 'row' : 'column' } }, props, { children: [_jsx(SelectTokenButton, { formType: "from", compact: isCompact }), _jsx(Box, Object.assign({ sx: { display: 'flex', justifyContent: 'center', alignItems: 'center' }, m: !disabledReverse ? -1.125 : 1 }, { children: !disabledReverse ? (_jsx(ReverseTokensButton, { vertical: !isCompact })) : null })), _jsx(SelectTokenButton, { formType: "to", compact: isCompact })] })));
22
+ const nftVariant = variant === 'nft';
23
+ const isCompact = fromChain &&
24
+ toChain &&
25
+ fromToken &&
26
+ toToken &&
27
+ !prefersNarrowView &&
28
+ !nftVariant;
29
+ return (_jsxs(Box, Object.assign({ sx: { display: 'flex', flexDirection: isCompact ? 'row' : 'column' } }, props, { children: [_jsx(SelectTokenButton, { formType: "from", compact: isCompact }), !nftVariant ? (_jsx(Box, Object.assign({ sx: {
30
+ display: 'flex',
31
+ justifyContent: 'center',
32
+ alignItems: 'center',
33
+ }, m: !disabledReverse ? -1.125 : 1 }, { children: !disabledReverse ? (_jsx(ReverseTokensButton, { vertical: !isCompact })) : null }))) : null, !nftVariant ? (_jsx(SelectTokenButton, { formType: "to", compact: isCompact })) : null] })));
24
34
  };
@@ -28,8 +28,11 @@ export const SelectTokenButton = ({ formType, compact }) => {
28
28
  };
29
29
  const isSelected = !!(chain && token);
30
30
  const onClick = !(disabledUI === null || disabledUI === void 0 ? void 0 : disabledUI.includes(tokenKey)) ? handleClick : undefined;
31
- const defaultTitle = formType === 'to' && variant === 'refuel'
31
+ const defaultPlaceholder = formType === 'to' && variant === 'refuel'
32
32
  ? t(`header.selectChain`)
33
33
  : t(`swap.selectChainAndToken`);
34
- return (_jsxs(Card, Object.assign({ flex: 1, onClick: onClick }, { children: [_jsx(CardTitle, { children: t(`swap.${formType}`) }), chainId && tokenAddress && (isChainLoading || isTokenLoading) ? (_jsx(SelectTokenCardHeader, { avatar: _jsx(Skeleton, { variant: "circular", width: 32, height: 32 }), title: _jsx(Skeleton, { variant: "text", width: 64, height: 24 }), subheader: _jsx(Skeleton, { variant: "text", width: 64, height: 16 }), compact: compact })) : (_jsx(SelectTokenCardHeader, { avatar: isSelected ? (_jsx(TokenAvatar, { token: token, chain: chain })) : (_jsx(TokenAvatarDefault, {})), title: isSelected ? token.symbol : defaultTitle, subheader: isSelected ? t(`swap.onChain`, { chainName: chain.name }) : null, selected: isSelected, compact: compact }))] })));
34
+ const cardTitle = formType === 'from' && variant === 'nft'
35
+ ? t(`swap.payWith`)
36
+ : t(`swap.${formType}`);
37
+ return (_jsxs(Card, Object.assign({ flex: 1, onClick: onClick }, { children: [_jsx(CardTitle, { children: cardTitle }), chainId && tokenAddress && (isChainLoading || isTokenLoading) ? (_jsx(SelectTokenCardHeader, { avatar: _jsx(Skeleton, { variant: "circular", width: 32, height: 32 }), title: _jsx(Skeleton, { variant: "text", width: 64, height: 24 }), subheader: _jsx(Skeleton, { variant: "text", width: 64, height: 16 }), compact: compact })) : (_jsx(SelectTokenCardHeader, { avatar: isSelected ? (_jsx(TokenAvatar, { token: token, chain: chain })) : (_jsx(TokenAvatarDefault, {})), title: isSelected ? token.symbol : defaultPlaceholder, subheader: isSelected ? t(`swap.onChain`, { chainName: chain.name }) : null, selected: isSelected, compact: compact }))] })));
35
38
  };
@@ -2,7 +2,7 @@
2
2
  export declare const FormControl: import("@emotion/styled").StyledComponent<{
3
3
  children?: import("react").ReactNode;
4
4
  classes?: Partial<import("@mui/material").FormControlClasses> | undefined;
5
- color?: "success" | "warning" | "error" | "secondary" | "primary" | "info" | undefined;
5
+ color?: "success" | "warning" | "error" | "primary" | "secondary" | "info" | undefined;
6
6
  disabled?: boolean | undefined;
7
7
  error?: boolean | undefined;
8
8
  fullWidth?: boolean | undefined;
@@ -13,7 +13,7 @@ export declare const SmallAvatar: import("@emotion/styled").StyledComponent<{
13
13
  variant?: "square" | "circular" | "rounded" | undefined;
14
14
  } & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>> & {
15
15
  ref?: import("react").RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void) | null | undefined;
16
- }, keyof import("@mui/material/OverridableComponent").CommonProps | "children" | "sx" | "variant" | "alt" | "src" | "sizes" | "srcSet" | "imgProps"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
16
+ }, keyof import("@mui/material/OverridableComponent").CommonProps | "children" | "sx" | "variant" | "alt" | "imgProps" | "sizes" | "src" | "srcSet"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
17
17
  export declare const SmallAvatarSkeletonBase: import("@emotion/styled").StyledComponent<{
18
18
  animation?: false | "pulse" | "wave" | undefined;
19
19
  children?: import("react").ReactNode;
@@ -2,7 +2,7 @@
2
2
  export declare const LinkButton: import("@emotion/styled").StyledComponent<{
3
3
  children?: import("react").ReactNode;
4
4
  classes?: Partial<import("@mui/material").IconButtonClasses> | undefined;
5
- color?: "inherit" | "default" | "success" | "warning" | "error" | "secondary" | "primary" | "info" | undefined;
5
+ color?: "inherit" | "default" | "success" | "warning" | "error" | "primary" | "secondary" | "info" | undefined;
6
6
  disabled?: boolean | undefined;
7
7
  disableFocusRipple?: boolean | undefined;
8
8
  edge?: false | "end" | "start" | undefined;
@@ -1,13 +1,12 @@
1
1
  /// <reference types="react" />
2
2
  import type { Step } from '@lifi/sdk';
3
- import type { StepActionsProps } from './types';
3
+ import type { WidgetVariant } from '../../types';
4
+ import type { StepActionsProps, StepDetailsLabelProps } from './types';
4
5
  export declare const StepActions: React.FC<StepActionsProps>;
5
6
  export declare const StepDetailsContent: React.FC<{
6
7
  step: Step;
8
+ variant?: WidgetVariant;
7
9
  }>;
8
- export declare const CrossStepDetailsLabel: React.FC<{
9
- step: Step;
10
- }>;
11
- export declare const SwapStepDetailsLabel: React.FC<{
12
- step: Step;
13
- }>;
10
+ export declare const CustomStepDetailsLabel: React.FC<StepDetailsLabelProps>;
11
+ export declare const CrossStepDetailsLabel: React.FC<Omit<StepDetailsLabelProps, 'variant'>>;
12
+ export declare const SwapStepDetailsLabel: React.FC<Omit<StepDetailsLabelProps, 'variant'>>;
@@ -9,24 +9,42 @@ var __rest = (this && this.__rest) || function (s, e) {
9
9
  }
10
10
  return t;
11
11
  };
12
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
12
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
13
13
  import { ArrowForward as ArrowForwardIcon } from '@mui/icons-material';
14
14
  import { Box, Step as MuiStep, Stepper, Typography } from '@mui/material';
15
15
  import { useTranslation } from 'react-i18next';
16
16
  import { useChains } from '../../hooks';
17
17
  import { LiFiToolLogo } from '../../icons';
18
+ import { useWidgetConfig } from '../../providers';
18
19
  import { formatTokenAmount } from '../../utils';
19
20
  import { SmallAvatar } from '../SmallAvatar';
20
21
  import { StepAvatar, StepConnector, StepContent, StepLabel, } from './StepActions.style';
21
22
  export const StepActions = (_a) => {
22
- var _b;
23
+ var _b, _c;
23
24
  var { step, dense } = _a, other = __rest(_a, ["step", "dense"]);
24
- const StepDetailsLabel = step.type === 'cross' ||
25
- (step.type === 'lifi' &&
26
- step.includedSteps.some((step) => step.type === 'cross'))
27
- ? CrossStepDetailsLabel
28
- : SwapStepDetailsLabel;
25
+ const { variant, contractTool } = useWidgetConfig();
26
+ const StepDetailsLabel = step.tool === 'custom' && variant === 'nft'
27
+ ? CustomStepDetailsLabel
28
+ : step.type === 'cross' ||
29
+ (step.type === 'lifi' &&
30
+ step.includedSteps.some((step) => step.type === 'cross'))
31
+ ? CrossStepDetailsLabel
32
+ : SwapStepDetailsLabel;
29
33
  const isFullView = !dense && ((_b = step.includedSteps) === null || _b === void 0 ? void 0 : _b.length) > 1;
34
+ const customStep = variant === 'nft'
35
+ ? (_c = step.includedSteps) === null || _c === void 0 ? void 0 : _c.find((step) => step.type === 'custom')
36
+ : undefined;
37
+ if (customStep && contractTool) {
38
+ const toolDetails = {
39
+ key: contractTool.name,
40
+ name: contractTool.name,
41
+ logoURI: contractTool.logoURI,
42
+ };
43
+ customStep.toolDetails = toolDetails;
44
+ if (!isFullView) {
45
+ step.toolDetails = toolDetails;
46
+ }
47
+ }
30
48
  // eslint-disable-next-line react/no-unstable-nested-components
31
49
  const StepIconComponent = ({ icon }) => {
32
50
  var _a;
@@ -37,16 +55,26 @@ export const StepActions = (_a) => {
37
55
  };
38
56
  return (_jsxs(Box, Object.assign({}, other, { children: [_jsxs(Box, Object.assign({ sx: { display: 'flex', alignItems: 'center' }, mb: isFullView ? 1.5 : 0 }, { children: [_jsx(StepAvatar, Object.assign({ variant: "circular", src: step.type !== 'lifi' ? step.toolDetails.logoURI : undefined, alt: step.toolDetails.name }, { children: step.type === 'lifi' ? _jsx(LiFiToolLogo, {}) : step.toolDetails.name[0] })), _jsx(Typography, Object.assign({ ml: 2, fontSize: 18, fontWeight: "500", textTransform: "capitalize" }, { children: step.type === 'lifi'
39
57
  ? 'LI.FI Smart Contract'
40
- : step.toolDetails.name }))] })), isFullView ? (_jsx(Stepper, Object.assign({ orientation: "vertical", connector: _jsx(StepConnector, {}), activeStep: -1 }, { children: step.includedSteps.map((step) => (_jsxs(MuiStep, Object.assign({ expanded: true }, { children: [_jsx(StepLabel, Object.assign({ StepIconComponent: StepIconComponent }, { children: step.type === 'cross' || step.type === 'lifi' ? (_jsx(CrossStepDetailsLabel, { step: step })) : (_jsx(SwapStepDetailsLabel, { step: step })) })), _jsx(StepContent, { children: _jsx(StepDetailsContent, { step: step }) })] }), step.id))) }))) : (_jsxs(Box, Object.assign({ ml: 6 }, { children: [_jsx(StepDetailsLabel, { step: step }), _jsx(StepDetailsContent, { step: step })] })))] })));
58
+ : step.toolDetails.name }))] })), isFullView ? (_jsx(Stepper, Object.assign({ orientation: "vertical", connector: _jsx(StepConnector, {}), activeStep: -1 }, { children: step.includedSteps.map((step, i) => (_jsxs(MuiStep, Object.assign({ expanded: true }, { children: [_jsx(StepLabel, Object.assign({ StepIconComponent: StepIconComponent }, { children: step.type === 'custom' && variant === 'nft' ? (_jsx(CustomStepDetailsLabel, { step: step, variant: variant })) : step.type === 'cross' || step.type === 'lifi' ? (_jsx(CrossStepDetailsLabel, { step: step })) : (_jsx(SwapStepDetailsLabel, { step: step })) })), _jsx(StepContent, { children: _jsx(StepDetailsContent, { step: step, variant: variant }) })] }), step.id))) }))) : (_jsxs(Box, Object.assign({ ml: 6 }, { children: [_jsx(StepDetailsLabel, { step: step, variant: variant === 'nft' ? variant : undefined }), _jsx(StepDetailsContent, { step: step, variant: variant })] })))] })));
41
59
  };
42
- export const StepDetailsContent = ({ step }) => {
60
+ export const StepDetailsContent = ({ step, variant }) => {
43
61
  var _a, _b, _c, _d, _e, _f, _g, _h;
44
62
  const { t } = useTranslation();
45
63
  return (_jsxs(Typography, Object.assign({ fontSize: 12, fontWeight: "500", color: "text.secondary", alignItems: "center", display: "flex" }, { children: [t('format.number', {
46
64
  value: formatTokenAmount(step.estimate.fromAmount, step.action.fromToken.decimals),
47
- }), ' ', step.action.fromToken.symbol, _jsx(ArrowForwardIcon, { sx: { fontSize: 18, paddingX: 0.5 } }), t('format.number', {
48
- value: formatTokenAmount((_b = (_a = step.execution) === null || _a === void 0 ? void 0 : _a.toAmount) !== null && _b !== void 0 ? _b : step.estimate.toAmount, (_e = (_d = (_c = step.execution) === null || _c === void 0 ? void 0 : _c.toToken) === null || _d === void 0 ? void 0 : _d.decimals) !== null && _e !== void 0 ? _e : step.action.toToken.decimals),
49
- }), ' ', (_h = (_g = (_f = step.execution) === null || _f === void 0 ? void 0 : _f.toToken) === null || _g === void 0 ? void 0 : _g.symbol) !== null && _h !== void 0 ? _h : step.action.toToken.symbol] })));
65
+ }), ' ', step.action.fromToken.symbol, !((step.type === 'custom' || step.tool === 'custom') &&
66
+ variant === 'nft') ? (_jsxs(_Fragment, { children: [_jsx(ArrowForwardIcon, { sx: { fontSize: 18, paddingX: 0.5 } }), t('format.number', {
67
+ value: formatTokenAmount((_b = (_a = step.execution) === null || _a === void 0 ? void 0 : _a.toAmount) !== null && _b !== void 0 ? _b : step.estimate.toAmount, (_e = (_d = (_c = step.execution) === null || _c === void 0 ? void 0 : _c.toToken) === null || _d === void 0 ? void 0 : _d.decimals) !== null && _e !== void 0 ? _e : step.action.toToken.decimals),
68
+ }), ' ', (_h = (_g = (_f = step.execution) === null || _f === void 0 ? void 0 : _f.toToken) === null || _g === void 0 ? void 0 : _g.symbol) !== null && _h !== void 0 ? _h : step.action.toToken.symbol] })) : null] })));
69
+ };
70
+ export const CustomStepDetailsLabel = ({ step, variant, }) => {
71
+ const { t } = useTranslation();
72
+ if (!variant) {
73
+ return null;
74
+ }
75
+ return (_jsx(Typography, Object.assign({ fontSize: 12, fontWeight: "500", color: "text.secondary" }, { children: t(`swap.${variant}StepDetails`, {
76
+ tool: step.toolDetails.name,
77
+ }) })));
50
78
  };
51
79
  export const CrossStepDetailsLabel = ({ step }) => {
52
80
  var _a, _b;
@@ -17,4 +17,4 @@ export declare const StepAvatar: import("@emotion/styled").StyledComponent<{
17
17
  variant?: "square" | "circular" | "rounded" | undefined;
18
18
  } & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>> & {
19
19
  ref?: import("react").RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void) | null | undefined;
20
- }, keyof import("@mui/material/OverridableComponent").CommonProps | "children" | "sx" | "variant" | "alt" | "src" | "sizes" | "srcSet" | "imgProps"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
20
+ }, keyof import("@mui/material/OverridableComponent").CommonProps | "children" | "sx" | "variant" | "alt" | "imgProps" | "sizes" | "src" | "srcSet"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
@@ -1,6 +1,11 @@
1
1
  import type { Step } from '@lifi/sdk';
2
2
  import type { BoxProps } from '@mui/material';
3
+ import type { WidgetVariant } from '../../types';
3
4
  export interface StepActionsProps extends BoxProps {
4
5
  step: Step;
5
6
  dense?: boolean;
6
7
  }
8
+ export interface StepDetailsLabelProps {
9
+ step: Step;
10
+ variant?: Extract<WidgetVariant, 'nft'>;
11
+ }
@@ -1,3 +1,4 @@
1
1
  /// <reference types="react" />
2
+ import type { BoxProps } from '@mui/material';
2
3
  import type { SwapFormTypeProps } from '../../providers';
3
- export declare const SwapInput: React.FC<SwapFormTypeProps>;
4
+ export declare const SwapInput: React.FC<SwapFormTypeProps & BoxProps>;
@@ -1,3 +1,14 @@
1
+ var __rest = (this && this.__rest) || function (s, e) {
2
+ var t = {};
3
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
+ t[p] = s[p];
5
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
+ t[p[i]] = s[p[i]];
9
+ }
10
+ return t;
11
+ };
1
12
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
13
  import { useRef } from 'react';
3
14
  import { useController } from 'react-hook-form';
@@ -11,7 +22,8 @@ import { FormPriceHelperText } from './FormPriceHelperText';
11
22
  import { FormControl, Input } from './SwapInput.style';
12
23
  import { SwapInputEndAdornment } from './SwapInputEndAdornment';
13
24
  import { SwapInputStartAdornment } from './SwapInputStartAdornment';
14
- export const SwapInput = ({ formType }) => {
25
+ export const SwapInput = (_a) => {
26
+ var { formType } = _a, props = __rest(_a, ["formType"]);
15
27
  const { t } = useTranslation();
16
28
  const amountKey = SwapFormKeyHelper.getAmountKey(formType);
17
29
  const { field: { onChange, onBlur, value }, } = useController({
@@ -31,7 +43,7 @@ export const SwapInput = ({ formType }) => {
31
43
  onBlur();
32
44
  };
33
45
  const disabled = disabledUI === null || disabledUI === void 0 ? void 0 : disabledUI.includes(DisabledUI.FromAmount);
34
- return (_jsxs(Card, { children: [_jsx(CardTitle, { children: t('swap.fromAmount') }), _jsxs(FormControl, Object.assign({ fullWidth: true }, { children: [_jsx(Input, { inputRef: ref, size: "small", autoComplete: "off", placeholder: "0", startAdornment: _jsx(SwapInputStartAdornment, { formType: formType }), endAdornment: !disabled ? (_jsx(SwapInputEndAdornment, { formType: formType })) : undefined, inputProps: {
46
+ return (_jsxs(Card, Object.assign({}, props, { children: [_jsx(CardTitle, { children: t('swap.fromAmount') }), _jsxs(FormControl, Object.assign({ fullWidth: true }, { children: [_jsx(Input, { inputRef: ref, size: "small", autoComplete: "off", placeholder: "0", startAdornment: _jsx(SwapInputStartAdornment, { formType: formType }), endAdornment: !disabled ? (_jsx(SwapInputEndAdornment, { formType: formType })) : undefined, inputProps: {
35
47
  inputMode: 'decimal',
36
- }, onChange: handleChange, onBlur: handleBlur, value: value, name: amountKey, disabled: disabled, required: true }), _jsx(FormPriceHelperText, { formType: formType })] })), _jsx(FitInputText, { ref: ref, formType: formType })] }));
48
+ }, onChange: handleChange, onBlur: handleBlur, value: value, name: amountKey, disabled: disabled, required: true }), _jsx(FormPriceHelperText, { formType: formType })] })), _jsx(FitInputText, { ref: ref, formType: formType })] })));
37
49
  };
@@ -4,7 +4,7 @@ export declare const minInputFontSize = 14;
4
4
  export declare const FormControl: import("@emotion/styled").StyledComponent<{
5
5
  children?: import("react").ReactNode;
6
6
  classes?: Partial<import("@mui/material").FormControlClasses> | undefined;
7
- color?: "success" | "warning" | "error" | "secondary" | "primary" | "info" | undefined;
7
+ color?: "success" | "warning" | "error" | "primary" | "secondary" | "info" | undefined;
8
8
  disabled?: boolean | undefined;
9
9
  error?: boolean | undefined;
10
10
  fullWidth?: boolean | undefined;
@@ -2,7 +2,7 @@
2
2
  export declare const Button: import("@emotion/styled").StyledComponent<{
3
3
  children?: import("react").ReactNode;
4
4
  classes?: Partial<import("@mui/material").ButtonClasses> | undefined;
5
- color?: "inherit" | "success" | "warning" | "error" | "secondary" | "primary" | "info" | undefined;
5
+ color?: "inherit" | "success" | "warning" | "error" | "primary" | "secondary" | "info" | undefined;
6
6
  disabled?: boolean | undefined;
7
7
  disableElevation?: boolean | undefined;
8
8
  disableFocusRipple?: boolean | undefined;
@@ -34,7 +34,9 @@ export const SwapRouteCard = (_a) => {
34
34
  e.stopPropagation();
35
35
  setCardExpanded((expanded) => !expanded);
36
36
  };
37
- const cardContent = (_jsxs(Box, Object.assign({ flex: 1 }, { children: [widgetVariant !== 'refuel' && !useRecommendedRoute ? (_jsxs(Box, Object.assign({ display: "flex", justifyContent: "space-between", alignItems: "center", mb: 2 }, { children: [_jsx(Label, Object.assign({ active: active !== null && active !== void 0 ? active : label !== alternativeTag }, { children: label })), variant === 'stretched' ? (_jsx(SwapRouteCardEssentials, { route: route })) : null] }))) : null, _jsxs(Box, Object.assign({ display: "flex", justifyContent: "space-between", alignItems: "center" }, { children: [_jsx(Token, { token: Object.assign(Object.assign({}, route.toToken), { amount: route.toAmount }), step: variant === 'stretched' ? route.steps[0] : undefined, disableDescription: variant === 'dense' && widgetVariant !== 'refuel' }), variant === 'stretched' && !expanded ? (_jsx(IconButton, Object.assign({ onClick: handleExpand, size: "small" }, { children: cardExpanded ? _jsx(ExpandLessIcon, {}) : _jsx(ExpandMoreIcon, {}) }))) : null] })), _jsx(Collapse, Object.assign({ timeout: 225, in: cardExpanded, mountOnEnter: true, unmountOnExit: true }, { children: route.steps.map((step) => (_jsx(StepActions, { step: step, mt: 2 }, step.id))) })), variant !== 'stretched' ? (_jsx(SwapRouteCardEssentials, { route: route, dense: true })) : null] })));
37
+ const token = widgetVariant === 'nft'
38
+ ? Object.assign(Object.assign({}, route.fromToken), { amount: route.fromAmount }) : Object.assign(Object.assign({}, route.toToken), { amount: route.toAmount });
39
+ const cardContent = (_jsxs(Box, Object.assign({ flex: 1 }, { children: [widgetVariant !== 'refuel' && !useRecommendedRoute ? (_jsxs(Box, Object.assign({ display: "flex", justifyContent: "space-between", alignItems: "center", mb: 2 }, { children: [_jsx(Label, Object.assign({ active: active !== null && active !== void 0 ? active : label !== alternativeTag }, { children: label })), variant === 'stretched' ? (_jsx(SwapRouteCardEssentials, { route: route })) : null] }))) : null, _jsxs(Box, Object.assign({ display: "flex", justifyContent: "space-between", alignItems: "center" }, { children: [_jsx(Token, { token: token, step: variant === 'stretched' ? route.steps[0] : undefined, disableDescription: variant === 'dense' && widgetVariant !== 'refuel' }), variant === 'stretched' && !expanded ? (_jsx(IconButton, Object.assign({ onClick: handleExpand, size: "small" }, { children: cardExpanded ? _jsx(ExpandLessIcon, {}) : _jsx(ExpandMoreIcon, {}) }))) : null] })), _jsx(Collapse, Object.assign({ timeout: 225, in: cardExpanded, mountOnEnter: true, unmountOnExit: true }, { children: route.steps.map((step) => (_jsx(StepActions, { step: step, mt: 2 }, step.id))) })), variant !== 'stretched' ? (_jsx(SwapRouteCardEssentials, { route: route, dense: true })) : null] })));
38
40
  return widgetVariant === 'refuel' ? (cardContent) : (_jsx(Card, Object.assign({ dense: variant === 'dense', variant: active ? 'selected' : 'default', selectionColor: "secondary", indented: true }, other, { children: cardContent })));
39
41
  };
40
42
  export const SwapRouteCardEssentials = ({ route, dense }) => {
@@ -17,7 +17,7 @@ export declare const Label: import("@emotion/styled").StyledComponent<import("@m
17
17
  export declare const IconButton: import("@emotion/styled").StyledComponent<{
18
18
  children?: import("react").ReactNode;
19
19
  classes?: Partial<import("@mui/material").IconButtonClasses> | undefined;
20
- color?: "inherit" | "default" | "success" | "warning" | "error" | "secondary" | "primary" | "info" | undefined;
20
+ color?: "inherit" | "default" | "success" | "warning" | "error" | "primary" | "secondary" | "info" | undefined;
21
21
  disabled?: boolean | undefined;
22
22
  disableFocusRipple?: boolean | undefined;
23
23
  edge?: false | "end" | "start" | undefined;