@lifi/widget 1.21.0 → 1.22.1

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 (206) hide show
  1. package/AppDrawer.style.d.ts +1 -1
  2. package/AppProvider.js +2 -4
  3. package/AppRoutes.js +4 -0
  4. package/cjs/AppDrawer.style.d.ts +1 -1
  5. package/cjs/AppProvider.js +1 -3
  6. package/cjs/AppRoutes.js +4 -0
  7. package/cjs/components/ActiveSwaps/ActiveSwaps.style.d.ts +1 -1
  8. package/cjs/components/BottomSheet/BottomSheet.d.ts +1 -1
  9. package/cjs/components/ChainSelect/ChainSelect.js +1 -3
  10. package/cjs/components/ChainSelect/useChainSelect.d.ts +1 -1
  11. package/cjs/components/Header/Header.style.d.ts +34 -1
  12. package/cjs/components/Header/Header.style.js +19 -1
  13. package/cjs/components/Header/NavigationHeader.js +6 -2
  14. package/cjs/components/Header/WalletHeader.js +34 -9
  15. package/cjs/components/Menu.d.ts +1 -0
  16. package/cjs/components/Menu.js +24 -0
  17. package/cjs/components/PoweredBy/PoweredBy.style.d.ts +1 -1
  18. package/cjs/components/ReverseTokensButton/ReverseTokensButton.style.d.ts +1 -1
  19. package/cjs/components/SelectChainAndToken.js +6 -1
  20. package/cjs/components/SelectTokenButton/SelectTokenButton.js +11 -6
  21. package/cjs/components/SelectTokenButton/SelectTokenButton.style.js +2 -1
  22. package/cjs/components/SendToWallet/SendToWallet.js +5 -0
  23. package/cjs/components/SendToWallet/SendToWallet.style.d.ts +1 -1
  24. package/cjs/components/SendToWallet/SendToWalletButton.js +5 -1
  25. package/cjs/components/Step/StepProcess.style.d.ts +2 -2
  26. package/cjs/components/Step/StepTimer.js +1 -1
  27. package/cjs/components/StepActions/StepActions.js +6 -1
  28. package/cjs/components/SwapButton/SwapButton.js +9 -4
  29. package/cjs/components/SwapInput/FormPriceHelperText.js +4 -4
  30. package/cjs/components/SwapInput/SwapInput.js +5 -2
  31. package/cjs/components/SwapInput/SwapInput.style.d.ts +1 -1
  32. package/cjs/components/SwapInput/SwapInputAdornment.style.d.ts +1 -1
  33. package/cjs/components/SwapRouteCard/SwapRouteCard.js +5 -3
  34. package/cjs/components/SwapRouteCard/SwapRouteCard.style.d.ts +1 -1
  35. package/cjs/components/SwapRouteCard/SwapRouteCardSkeleton.js +3 -1
  36. package/cjs/components/SwapRoutes/SwapRoutes.js +8 -3
  37. package/cjs/components/Token/Token.js +6 -5
  38. package/cjs/components/TokenAvatar/TokenAvatar.d.ts +11 -1
  39. package/cjs/components/TokenAvatar/TokenAvatar.js +14 -3
  40. package/cjs/components/TokenList/TokenList.js +2 -23
  41. package/cjs/components/TokenList/TokenListItem.d.ts +2 -1
  42. package/cjs/components/TokenList/TokenListItem.js +12 -6
  43. package/cjs/components/TokenList/index.d.ts +1 -0
  44. package/cjs/components/TokenList/index.js +1 -0
  45. package/cjs/components/TokenList/types.d.ts +6 -0
  46. package/cjs/components/TokenList/useTokenSelect.d.ts +2 -0
  47. package/cjs/components/TokenList/useTokenSelect.js +33 -0
  48. package/cjs/config/version.d.ts +1 -1
  49. package/cjs/config/version.js +1 -1
  50. package/cjs/hooks/useChain.d.ts +2 -2
  51. package/cjs/hooks/useChains.d.ts +2 -2
  52. package/cjs/hooks/useExpandableVariant.js +3 -5
  53. package/cjs/hooks/useProcessMessage.d.ts +2 -2
  54. package/cjs/hooks/useSwapRoutes.js +11 -7
  55. package/cjs/i18n/de.json +199 -0
  56. package/cjs/i18n/en.json +162 -151
  57. package/cjs/i18n/es.json +200 -0
  58. package/cjs/i18n/fr.json +199 -0
  59. package/cjs/i18n/index.d.ts +8 -200
  60. package/cjs/i18n/index.js +15 -19
  61. package/cjs/i18n/it.json +199 -0
  62. package/cjs/i18n/uk.json +200 -0
  63. package/cjs/i18n/zh.json +199 -0
  64. package/cjs/pages/SelectChainPage/SelectChainPage.d.ts +2 -2
  65. package/cjs/pages/SelectChainPage/SelectChainPage.js +13 -9
  66. package/cjs/pages/SelectChainPage/types.d.ts +4 -0
  67. package/cjs/pages/SelectChainPage/types.js +2 -0
  68. package/cjs/pages/SelectNativeTokenPage/SelectNativeTokenPage.d.ts +3 -0
  69. package/cjs/pages/SelectNativeTokenPage/SelectNativeTokenPage.js +21 -0
  70. package/cjs/pages/SelectNativeTokenPage/SelectNativeTokenPage.style.d.ts +21 -0
  71. package/cjs/pages/SelectNativeTokenPage/SelectNativeTokenPage.style.js +20 -0
  72. package/cjs/pages/SelectNativeTokenPage/index.d.ts +1 -0
  73. package/cjs/pages/SelectNativeTokenPage/index.js +17 -0
  74. package/cjs/pages/SettingsPage/ColorSchemeButtonGroup.style.d.ts +1 -1
  75. package/cjs/pages/SettingsPage/LanguageSelect.d.ts +2 -0
  76. package/cjs/pages/SettingsPage/LanguageSelect.js +38 -0
  77. package/cjs/pages/SettingsPage/SettingsPage.js +2 -1
  78. package/cjs/pages/SettingsPage/ShowDestinationWallet.d.ts +1 -1
  79. package/cjs/pages/SettingsPage/ShowDestinationWallet.js +6 -0
  80. package/cjs/pages/SwapDetailsPage/SwapDetailsPage.js +4 -2
  81. package/cjs/pages/SwapHistoryPage/SwapHistoryItem.js +4 -2
  82. package/cjs/pages/SwapPage/StatusBottomSheet.js +3 -3
  83. package/cjs/pages/SwapPage/SwapPage.js +1 -3
  84. package/cjs/pages/SwapPage/TokenValueBottomSheet.js +1 -1
  85. package/cjs/providers/I18nProvider/I18nProvider.d.ts +2 -0
  86. package/cjs/providers/I18nProvider/I18nProvider.js +62 -0
  87. package/cjs/providers/I18nProvider/index.d.ts +2 -0
  88. package/cjs/providers/I18nProvider/index.js +18 -0
  89. package/cjs/providers/I18nProvider/types.d.ts +16 -0
  90. package/cjs/providers/I18nProvider/types.js +2 -0
  91. package/cjs/providers/WidgetProvider/utils.d.ts +1 -1
  92. package/cjs/providers/WidgetProvider/utils.js +4 -4
  93. package/cjs/providers/index.d.ts +1 -0
  94. package/cjs/providers/index.js +1 -0
  95. package/cjs/stores/settings/types.d.ts +1 -0
  96. package/cjs/stores/settings/useSettingsStore.d.ts +2 -0
  97. package/cjs/types/widget.d.ts +24 -7
  98. package/cjs/types/widget.js +8 -0
  99. package/cjs/utils/deepMerge.d.ts +1 -0
  100. package/cjs/utils/deepMerge.js +18 -0
  101. package/cjs/utils/index.d.ts +1 -0
  102. package/cjs/utils/index.js +1 -0
  103. package/cjs/utils/input.js +3 -1
  104. package/cjs/utils/navigationRoutes.d.ts +8 -7
  105. package/cjs/utils/navigationRoutes.js +10 -7
  106. package/components/ActiveSwaps/ActiveSwaps.style.d.ts +1 -1
  107. package/components/BottomSheet/BottomSheet.d.ts +1 -1
  108. package/components/ChainSelect/ChainSelect.js +1 -3
  109. package/components/ChainSelect/useChainSelect.d.ts +1 -1
  110. package/components/Header/Header.style.d.ts +34 -1
  111. package/components/Header/Header.style.js +19 -1
  112. package/components/Header/NavigationHeader.js +7 -3
  113. package/components/Header/WalletHeader.js +37 -12
  114. package/components/Menu.d.ts +1 -0
  115. package/components/Menu.js +21 -0
  116. package/components/PoweredBy/PoweredBy.style.d.ts +1 -1
  117. package/components/ReverseTokensButton/ReverseTokensButton.style.d.ts +1 -1
  118. package/components/SelectChainAndToken.js +7 -2
  119. package/components/SelectTokenButton/SelectTokenButton.js +12 -7
  120. package/components/SelectTokenButton/SelectTokenButton.style.js +2 -1
  121. package/components/SendToWallet/SendToWallet.js +6 -1
  122. package/components/SendToWallet/SendToWallet.style.d.ts +1 -1
  123. package/components/SendToWallet/SendToWalletButton.js +6 -2
  124. package/components/Step/StepProcess.style.d.ts +2 -2
  125. package/components/Step/StepTimer.js +1 -1
  126. package/components/StepActions/StepActions.js +6 -1
  127. package/components/SwapButton/SwapButton.js +9 -4
  128. package/components/SwapInput/FormPriceHelperText.js +4 -4
  129. package/components/SwapInput/SwapInput.js +6 -3
  130. package/components/SwapInput/SwapInput.style.d.ts +1 -1
  131. package/components/SwapInput/SwapInputAdornment.style.d.ts +1 -1
  132. package/components/SwapRouteCard/SwapRouteCard.js +5 -3
  133. package/components/SwapRouteCard/SwapRouteCard.style.d.ts +1 -1
  134. package/components/SwapRouteCard/SwapRouteCardSkeleton.js +3 -1
  135. package/components/SwapRoutes/SwapRoutes.js +8 -3
  136. package/components/Token/Token.js +7 -6
  137. package/components/TokenAvatar/TokenAvatar.d.ts +11 -1
  138. package/components/TokenAvatar/TokenAvatar.js +11 -2
  139. package/components/TokenList/TokenList.js +4 -25
  140. package/components/TokenList/TokenListItem.d.ts +2 -1
  141. package/components/TokenList/TokenListItem.js +10 -5
  142. package/components/TokenList/index.d.ts +1 -0
  143. package/components/TokenList/index.js +1 -0
  144. package/components/TokenList/types.d.ts +6 -0
  145. package/components/TokenList/useTokenSelect.d.ts +2 -0
  146. package/components/TokenList/useTokenSelect.js +29 -0
  147. package/config/version.d.ts +1 -1
  148. package/config/version.js +1 -1
  149. package/hooks/useChain.d.ts +2 -2
  150. package/hooks/useChains.d.ts +2 -2
  151. package/hooks/useExpandableVariant.js +3 -5
  152. package/hooks/useProcessMessage.d.ts +2 -2
  153. package/hooks/useSwapRoutes.js +12 -8
  154. package/i18n/de.json +199 -0
  155. package/i18n/en.json +162 -151
  156. package/i18n/es.json +200 -0
  157. package/i18n/fr.json +199 -0
  158. package/i18n/index.d.ts +8 -200
  159. package/i18n/index.js +8 -18
  160. package/i18n/it.json +199 -0
  161. package/i18n/uk.json +200 -0
  162. package/i18n/zh.json +199 -0
  163. package/package.json +19 -18
  164. package/pages/SelectChainPage/SelectChainPage.d.ts +2 -2
  165. package/pages/SelectChainPage/SelectChainPage.js +13 -9
  166. package/pages/SelectChainPage/types.d.ts +4 -0
  167. package/pages/SelectChainPage/types.js +1 -0
  168. package/pages/SelectNativeTokenPage/SelectNativeTokenPage.d.ts +3 -0
  169. package/pages/SelectNativeTokenPage/SelectNativeTokenPage.js +17 -0
  170. package/pages/SelectNativeTokenPage/SelectNativeTokenPage.style.d.ts +21 -0
  171. package/pages/SelectNativeTokenPage/SelectNativeTokenPage.style.js +17 -0
  172. package/pages/SelectNativeTokenPage/index.d.ts +1 -0
  173. package/pages/SelectNativeTokenPage/index.js +1 -0
  174. package/pages/SettingsPage/ColorSchemeButtonGroup.style.d.ts +1 -1
  175. package/pages/SettingsPage/LanguageSelect.d.ts +2 -0
  176. package/pages/SettingsPage/LanguageSelect.js +34 -0
  177. package/pages/SettingsPage/SettingsPage.js +2 -1
  178. package/pages/SettingsPage/ShowDestinationWallet.d.ts +1 -1
  179. package/pages/SettingsPage/ShowDestinationWallet.js +6 -0
  180. package/pages/SwapDetailsPage/SwapDetailsPage.js +4 -2
  181. package/pages/SwapHistoryPage/SwapHistoryItem.js +4 -2
  182. package/pages/SwapPage/StatusBottomSheet.js +3 -3
  183. package/pages/SwapPage/SwapPage.js +1 -3
  184. package/pages/SwapPage/TokenValueBottomSheet.js +1 -1
  185. package/providers/I18nProvider/I18nProvider.d.ts +2 -0
  186. package/providers/I18nProvider/I18nProvider.js +58 -0
  187. package/providers/I18nProvider/index.d.ts +2 -0
  188. package/providers/I18nProvider/index.js +2 -0
  189. package/providers/I18nProvider/types.d.ts +16 -0
  190. package/providers/I18nProvider/types.js +1 -0
  191. package/providers/WidgetProvider/utils.d.ts +1 -1
  192. package/providers/WidgetProvider/utils.js +4 -4
  193. package/providers/index.d.ts +1 -0
  194. package/providers/index.js +1 -0
  195. package/stores/settings/types.d.ts +1 -0
  196. package/stores/settings/useSettingsStore.d.ts +2 -0
  197. package/tsconfig.cjs.tsbuildinfo +1 -1
  198. package/types/widget.d.ts +24 -7
  199. package/types/widget.js +7 -1
  200. package/utils/deepMerge.d.ts +1 -0
  201. package/utils/deepMerge.js +14 -0
  202. package/utils/index.d.ts +1 -0
  203. package/utils/index.js +1 -0
  204. package/utils/input.js +3 -1
  205. package/utils/navigationRoutes.d.ts +8 -7
  206. package/utils/navigationRoutes.js +10 -7
@@ -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" | "primary" | "secondary" | "error" | "warning" | "info" | "success" | undefined;
5
+ color?: "inherit" | "default" | "error" | "success" | "warning" | "primary" | "secondary" | "info" | undefined;
6
6
  disabled?: boolean | undefined;
7
7
  disableFocusRipple?: boolean | undefined;
8
8
  edge?: false | "end" | "start" | undefined;
@@ -36,4 +36,4 @@ export declare const LinkButton: import("@emotion/styled").StyledComponent<{
36
36
  variant?: "button" | "caption" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "inherit" | "subtitle1" | "subtitle2" | "body1" | "body2" | "overline" | "@supports (font-variation-settings: normal)" | undefined;
37
37
  } & Omit<Pick<import("react").DetailedHTMLProps<import("react").AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>, "key" | keyof import("react").AnchorHTMLAttributes<HTMLAnchorElement>> & {
38
38
  ref?: ((instance: HTMLAnchorElement | null) => void) | import("react").RefObject<HTMLAnchorElement> | null | undefined;
39
- }, keyof import("@mui/material/OverridableComponent").CommonProps | "p" | "slot" | "title" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "children" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "sx" | "key" | "download" | "href" | "hrefLang" | "media" | "ping" | "rel" | "target" | "type" | "referrerPolicy" | "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" | "variant" | "align" | "gutterBottom" | "noWrap" | "paragraph" | "variantMapping" | "underline" | "TypographyClasses">, {}, {}>;
39
+ }, keyof import("@mui/material/OverridableComponent").CommonProps | "p" | "slot" | "title" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "nonce" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "children" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onResize" | "onResizeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "sx" | "key" | "download" | "href" | "hrefLang" | "media" | "ping" | "rel" | "target" | "type" | "referrerPolicy" | "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" | "variant" | "align" | "gutterBottom" | "noWrap" | "paragraph" | "variantMapping" | "underline" | "TypographyClasses">, {}, {}>;
@@ -45,7 +45,7 @@ export const StepTimer = ({ step, hideInProgress, }) => {
45
45
  ]);
46
46
  if (!isExecutionStarted) {
47
47
  return (_jsx(_Fragment, { children: t('swap.estimatedTime', {
48
- value: (step.estimate.executionDuration / 60).toFixed(0),
48
+ value: Math.ceil(step.estimate.executionDuration / 60),
49
49
  }) }));
50
50
  }
51
51
  const isTimerExpired = isExpired || (!minutes && !seconds);
@@ -41,7 +41,12 @@ export const StepActions = (_a) => {
41
41
  };
42
42
  export const StepDetailsContent = ({ step }) => {
43
43
  var _a, _b;
44
- return (_jsxs(Typography, Object.assign({ fontSize: 12, fontWeight: "500", color: "text.secondary", alignItems: "center", display: "flex" }, { children: [formatTokenAmount(step.estimate.fromAmount, step.action.fromToken.decimals), ' ', step.action.fromToken.symbol, _jsx(ArrowForwardIcon, { sx: { fontSize: 18, paddingX: 0.5 } }), formatTokenAmount((_b = (_a = step.execution) === null || _a === void 0 ? void 0 : _a.toAmount) !== null && _b !== void 0 ? _b : step.estimate.toAmount, step.action.toToken.decimals), ' ', step.action.toToken.symbol] })));
44
+ const { t } = useTranslation();
45
+ return (_jsxs(Typography, Object.assign({ fontSize: 12, fontWeight: "500", color: "text.secondary", alignItems: "center", display: "flex" }, { children: [t('format.number', {
46
+ 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, step.action.toToken.decimals),
49
+ }), ' ', step.action.toToken.symbol] })));
45
50
  };
46
51
  export const CrossStepDetailsLabel = ({ step }) => {
47
52
  var _a, _b;
@@ -18,12 +18,12 @@ import { navigationRoutes } from '../../utils';
18
18
  export const SwapButton = forwardRef(({ onClick, currentRoute, text, disable, enableLoading, loading }, ref) => {
19
19
  const { t } = useTranslation();
20
20
  const navigate = useNavigate();
21
- const config = useWidgetConfig();
21
+ const { variant, walletManagement } = useWidgetConfig();
22
22
  const { account, connect } = useWallet();
23
23
  const { insufficientFunds, insufficientGas, isLoading: isGasSufficiencyLoading, } = useGasSufficiency(currentRoute);
24
24
  const handleSwapButtonClick = () => __awaiter(void 0, void 0, void 0, function* () {
25
25
  if (!account.isActive) {
26
- if (config.walletManagement) {
26
+ if (walletManagement) {
27
27
  yield connect();
28
28
  }
29
29
  else {
@@ -37,9 +37,14 @@ export const SwapButton = forwardRef(({ onClick, currentRoute, text, disable, en
37
37
  const getButtonText = () => {
38
38
  if (account.isActive) {
39
39
  if (!currentRoute) {
40
- return t(`button.swap`);
40
+ return variant !== 'refuel' ? t(`button.swap`) : t(`button.getGas`);
41
41
  }
42
- return text || t(`button.reviewSwap`);
42
+ if (text) {
43
+ return text;
44
+ }
45
+ return variant !== 'refuel'
46
+ ? t(`button.reviewSwap`)
47
+ : t(`button.startSwap`);
43
48
  }
44
49
  return t(`button.connectWallet`);
45
50
  };
@@ -19,9 +19,9 @@ export const FormPriceHelperText = ({ formType, selected }) => {
19
19
  return (_jsxs(FormHelperText, Object.assign({ component: "div", sx: { display: 'flex', justifyContent: 'space-between', margin: 0 } }, { children: [_jsx(Typography, Object.assign({ color: fromAmountTokenPrice ? 'text.secondary' : 'grey.600', fontWeight: 400, fontSize: 12, marginLeft: selected ? 8 : 2, lineHeight: 1.3334, flex: 1, sx: {
20
20
  wordBreak: 'break-word',
21
21
  overflowWrap: 'break-word',
22
- } }, { children: t(`swap.currency`, {
22
+ } }, { children: t(`format.currency`, {
23
23
  value: fromAmountTokenPrice,
24
- }) })), isLoading && tokenAddress ? (_jsx(Skeleton, { variant: "text", width: 48, height: 16, sx: { borderRadius: 0.25 } })) : (token === null || token === void 0 ? void 0 : token.amount) ? (_jsx(Typography, Object.assign({ fontWeight: 400, fontSize: 12, color: "text.secondary", lineHeight: 1.3334, pl: 0.25 }, { children: t(`swap.maxAmount`, {
25
- amount: token === null || token === void 0 ? void 0 : token.amount,
26
- }) }))) : null] })));
24
+ }) })), isLoading && tokenAddress ? (_jsx(Skeleton, { variant: "text", width: 48, height: 16, sx: { borderRadius: 0.25 } })) : (token === null || token === void 0 ? void 0 : token.amount) ? (_jsx(Typography, Object.assign({ fontWeight: 400, fontSize: 12, color: "text.secondary", lineHeight: 1.3334, pl: 0.25 }, { children: `/ ${t(`format.number`, {
25
+ value: token === null || token === void 0 ? void 0 : token.amount,
26
+ })}` }))) : null] })));
27
27
  };
@@ -3,7 +3,8 @@ import { useLayoutEffect, useRef } from 'react';
3
3
  import { useFormContext, useWatch } from 'react-hook-form';
4
4
  import { useTranslation } from 'react-i18next';
5
5
  import { useChain, useToken } from '../../hooks';
6
- import { SwapFormKeyHelper } from '../../providers';
6
+ import { SwapFormKeyHelper, useWidgetConfig } from '../../providers';
7
+ import { DisabledUI } from '../../types';
7
8
  import { fitInputText, formatAmount } from '../../utils';
8
9
  import { Card, CardTitle } from '../Card';
9
10
  import { TokenAvatar } from '../TokenAvatar';
@@ -13,6 +14,7 @@ import { SwapInputAdornment } from './SwapInputAdornment';
13
14
  export const SwapInput = ({ formType }) => {
14
15
  const { t } = useTranslation();
15
16
  const { setValue } = useFormContext();
17
+ const { disabledUI } = useWidgetConfig();
16
18
  const ref = useRef(null);
17
19
  const amountKey = SwapFormKeyHelper.getAmountKey(formType);
18
20
  const [amount, chainId, tokenAddress] = useWatch({
@@ -40,7 +42,8 @@ export const SwapInput = ({ formType }) => {
40
42
  useLayoutEffect(() => {
41
43
  fitInputText(maxInputFontSize, minInputFontSize, ref.current);
42
44
  }, [amount]);
43
- return (_jsxs(Card, { children: [_jsx(CardTitle, { children: t('swap.amount') }), _jsxs(FormControl, Object.assign({ fullWidth: true }, { children: [_jsx(Input, { inputRef: ref, size: "small", autoComplete: "off", placeholder: "0", startAdornment: isSelected ? (_jsx(TokenAvatar, { token: token, sx: { marginLeft: 2 } })) : null, endAdornment: _jsx(SwapInputAdornment, { formType: formType }), inputProps: {
45
+ const disabled = disabledUI === null || disabledUI === void 0 ? void 0 : disabledUI.includes(DisabledUI.FromAmount);
46
+ 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: isSelected ? (_jsx(TokenAvatar, { token: token, chain: chain, sx: { marginLeft: 2 } })) : null, endAdornment: !disabled ? _jsx(SwapInputAdornment, { formType: formType }) : undefined, inputProps: {
44
47
  inputMode: 'decimal',
45
- }, onChange: handleChange, onBlur: handleBlur, value: amount, name: amountKey, required: true }), _jsx(FormPriceHelperText, { selected: isSelected, formType: formType })] }))] }));
48
+ }, onChange: handleChange, onBlur: handleBlur, value: amount, name: amountKey, disabled: disabled, required: true }), _jsx(FormPriceHelperText, { selected: isSelected, formType: formType })] }))] }));
46
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?: "primary" | "secondary" | "error" | "warning" | "info" | "success" | undefined;
7
+ color?: "error" | "success" | "warning" | "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" | "primary" | "secondary" | "error" | "warning" | "info" | "success" | undefined;
5
+ color?: "inherit" | "error" | "success" | "warning" | "primary" | "secondary" | "info" | undefined;
6
6
  disabled?: boolean | undefined;
7
7
  disableElevation?: boolean | undefined;
8
8
  disableFocusRipple?: boolean | undefined;
@@ -14,6 +14,7 @@ import { AccessTime as AccessTimeIcon, EvStationOutlined as EvStationIcon, Expan
14
14
  import { Box, Collapse, Tooltip, Typography } from '@mui/material';
15
15
  import { useState } from 'react';
16
16
  import { useTranslation } from 'react-i18next';
17
+ import { useWidgetConfig } from '../../providers';
17
18
  import { Card } from '../Card';
18
19
  import { StepActions } from '../StepActions';
19
20
  import { Token } from '../Token';
@@ -23,6 +24,7 @@ export const SwapRouteCard = (_a) => {
23
24
  var _b;
24
25
  var { route, active, variant = 'default', expanded } = _a, other = __rest(_a, ["route", "active", "variant", "expanded"]);
25
26
  const { t } = useTranslation();
27
+ const { variant: widgetVariant, useRecommendedRoute } = useWidgetConfig();
26
28
  const [cardExpanded, setCardExpanded] = useState(variant === 'default' || expanded);
27
29
  const alternativeTag = t(`swap.tags.ALTERNATIVE`);
28
30
  const label = ((_b = route.tags) === null || _b === void 0 ? void 0 : _b.length)
@@ -32,7 +34,7 @@ export const SwapRouteCard = (_a) => {
32
34
  e.stopPropagation();
33
35
  setCardExpanded((expanded) => !expanded);
34
36
  };
35
- return (_jsxs(Card, Object.assign({ dense: variant === 'dense', variant: active ? 'selected' : 'default', selectionColor: "secondary", indented: true }, other, { children: [_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] })), _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 }), 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
+ return (_jsxs(Card, Object.assign({ dense: variant === 'dense', variant: active ? 'selected' : 'default', selectionColor: "secondary", indented: true }, other, { 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 }), 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] })));
36
38
  };
37
39
  export const SwapRouteCardEssentials = ({ route, dense }) => {
38
40
  var _a;
@@ -44,8 +46,8 @@ export const SwapRouteCardEssentials = ({ route, dense }) => {
44
46
  const gasCosts = getGasCostsBreakdown(route);
45
47
  return (_jsxs(Box, Object.assign({ display: "flex", justifyContent: dense ? 'space-between' : 'flex-end', flex: 1, pl: dense ? 0 : 2, mt: dense ? 2 : 0 }, { children: [_jsx(Tooltip, Object.assign({ title: _jsxs(Box, Object.assign({ component: "span" }, { children: [t(`tooltip.estimatedNetworkFee`), gasCosts.map((gas) => {
46
48
  var _a;
47
- return (_jsxs(Typography, Object.assign({ fontSize: 11 }, { children: [(_a = gas.amount) === null || _a === void 0 ? void 0 : _a.toFixed(6), " ", gas.token.symbol, " (", t(`swap.currency`, { value: gas.amountUSD }), ")"] }), `${gas.token.address}${gas.token.symbol}`));
48
- })] })), placement: "top", enterDelay: 400, arrow: true }, { children: _jsxs(Box, Object.assign({ display: "flex", alignItems: "center", mr: dense ? 0 : 2 }, { children: [_jsx(Typography, Object.assign({ lineHeight: 0, mr: 0.5, color: "grey.500" }, { children: _jsx(EvStationIcon, { fontSize: dense ? 'medium' : 'small' }) })), _jsx(Typography, Object.assign({ fontSize: 14, color: "text.primary", fontWeight: "500", lineHeight: 1 }, { children: t(`swap.currency`, { value: gasCostUSD }) }))] })) })), _jsx(Tooltip, Object.assign({ title: t(`tooltip.estimatedTime`), placement: "top", enterDelay: 400, arrow: true }, { children: _jsxs(Box, Object.assign({ display: "flex", alignItems: "center", mr: dense ? 0 : 2 }, { children: [_jsx(Typography, Object.assign({ lineHeight: 0, mr: 0.5, color: "grey.500" }, { children: _jsx(AccessTimeIcon, { fontSize: dense ? 'medium' : 'small' }) })), _jsx(Typography, Object.assign({ fontSize: 14, color: "text.primary", fontWeight: "500", lineHeight: 1 }, { children: t('swap.estimatedTime', {
49
+ return (_jsxs(Typography, Object.assign({ fontSize: 11 }, { children: [(_a = gas.amount) === null || _a === void 0 ? void 0 : _a.toFixed(6), " ", gas.token.symbol, " (", t(`format.currency`, { value: gas.amountUSD }), ")"] }), `${gas.token.address}${gas.token.symbol}`));
50
+ })] })), placement: "top", enterDelay: 400, arrow: true }, { children: _jsxs(Box, Object.assign({ display: "flex", alignItems: "center", mr: dense ? 0 : 2 }, { children: [_jsx(Typography, Object.assign({ lineHeight: 0, mr: 0.5, color: "grey.500" }, { children: _jsx(EvStationIcon, { fontSize: dense ? 'medium' : 'small' }) })), _jsx(Typography, Object.assign({ fontSize: 14, color: "text.primary", fontWeight: "500", lineHeight: 1 }, { children: t(`format.currency`, { value: gasCostUSD }) }))] })) })), _jsx(Tooltip, Object.assign({ title: t(`tooltip.estimatedTime`), placement: "top", enterDelay: 400, arrow: true }, { children: _jsxs(Box, Object.assign({ display: "flex", alignItems: "center", mr: dense ? 0 : 2 }, { children: [_jsx(Typography, Object.assign({ lineHeight: 0, mr: 0.5, color: "grey.500" }, { children: _jsx(AccessTimeIcon, { fontSize: dense ? 'medium' : 'small' }) })), _jsx(Typography, Object.assign({ fontSize: 14, color: "text.primary", fontWeight: "500", lineHeight: 1 }, { children: t('swap.estimatedTime', {
49
51
  value: executionTimeMinutes,
50
52
  }) }))] })) })), !dense ? (_jsx(Tooltip, Object.assign({ title: t(`tooltip.numberOfSteps`), placement: "top", enterDelay: 400, arrow: true }, { children: _jsxs(Box, Object.assign({ display: "flex", alignItems: "center" }, { children: [_jsx(Typography, Object.assign({ lineHeight: 0, mr: 0.5, color: "grey.500" }, { children: _jsx(LayersIcon, { fontSize: dense ? 'medium' : 'small' }) })), _jsx(Typography, Object.assign({ fontSize: 14, color: "text.primary", fontWeight: "500", lineHeight: 1 }, { children: route.steps.length }))] })) }))) : null] })));
51
53
  };
@@ -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" | "primary" | "secondary" | "error" | "warning" | "info" | "success" | undefined;
20
+ color?: "inherit" | "default" | "error" | "success" | "warning" | "primary" | "secondary" | "info" | undefined;
21
21
  disabled?: boolean | undefined;
22
22
  disableFocusRipple?: boolean | undefined;
23
23
  edge?: false | "end" | "start" | undefined;
@@ -11,8 +11,10 @@ var __rest = (this && this.__rest) || function (s, e) {
11
11
  };
12
12
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
13
  import { Box, Skeleton } from '@mui/material';
14
+ import { useWidgetConfig } from '../../providers';
14
15
  import { Card } from '../Card';
15
16
  export const SwapRouteCardSkeleton = (_a) => {
16
17
  var { variant } = _a, other = __rest(_a, ["variant"]);
17
- return (_jsxs(Card, Object.assign({ dense: variant === 'dense', indented: true }, other, { children: [_jsxs(Box, Object.assign({ display: "flex", justifyContent: "space-between", alignItems: "center" }, { children: [_jsx(Skeleton, { variant: "rectangular", width: 118, height: 24, sx: { borderRadius: 0.5 } }), variant === 'stretched' ? (_jsxs(Box, Object.assign({ display: "flex" }, { children: [_jsx(Skeleton, { variant: "text", width: 52, height: 24, sx: { marginRight: 2 } }), _jsx(Skeleton, { variant: "text", width: 44, height: 24, sx: { marginRight: 2 } }), _jsx(Skeleton, { variant: "text", width: 32, height: 24 })] }))) : null] })), _jsxs(Box, Object.assign({ mt: 2 }, { children: [_jsxs(Box, Object.assign({ display: "flex", alignItems: "center" }, { children: [_jsx(Box, Object.assign({ mr: 2 }, { children: _jsx(Skeleton, { variant: "circular", width: 32, height: 32 }) })), _jsx(Skeleton, { variant: "text", width: 96, height: 32 })] })), _jsxs(Box, Object.assign({ ml: 6, display: "flex", alignItems: "center" }, { children: [_jsx(Skeleton, { variant: "text", width: 102, height: 16, sx: { borderRadius: 0.5 } }), variant === 'stretched' ? (_jsx(Skeleton, { variant: "text", width: 72, height: 16, sx: { marginLeft: 1 } })) : null] }))] })), variant !== 'stretched' ? (_jsxs(Box, Object.assign({ mt: 2, display: "flex", justifyContent: "space-between" }, { children: [_jsx(Skeleton, { variant: "text", width: 48, height: 24 }), _jsx(Skeleton, { variant: "text", width: 48, height: 24 })] }))) : null] })));
18
+ const { variant: widgetVariant, useRecommendedRoute } = useWidgetConfig();
19
+ return (_jsxs(Card, Object.assign({ dense: variant === 'dense', indented: true }, other, { children: [widgetVariant !== 'refuel' && !useRecommendedRoute ? (_jsxs(Box, Object.assign({ display: "flex", justifyContent: "space-between", alignItems: "center", mb: 2 }, { children: [_jsx(Skeleton, { variant: "rectangular", width: 118, height: 24, sx: { borderRadius: 0.5 } }), variant === 'stretched' ? (_jsxs(Box, Object.assign({ display: "flex" }, { children: [_jsx(Skeleton, { variant: "text", width: 52, height: 24, sx: { marginRight: 2 } }), _jsx(Skeleton, { variant: "text", width: 44, height: 24, sx: { marginRight: 2 } }), _jsx(Skeleton, { variant: "text", width: 32, height: 24 })] }))) : null] }))) : null, _jsxs(Box, { children: [_jsxs(Box, Object.assign({ display: "flex", alignItems: "center" }, { children: [_jsx(Box, Object.assign({ mr: 2 }, { children: _jsx(Skeleton, { variant: "circular", width: 32, height: 32 }) })), _jsx(Skeleton, { variant: "text", width: 96, height: 32 })] })), _jsxs(Box, Object.assign({ ml: 6, display: "flex", alignItems: "center" }, { children: [_jsx(Skeleton, { variant: "text", width: 102, height: 16, sx: { borderRadius: 0.5 } }), variant === 'stretched' ? (_jsx(Skeleton, { variant: "text", width: 72, height: 16, sx: { marginLeft: 1 } })) : null] }))] }), variant !== 'stretched' ? (_jsxs(Box, Object.assign({ mt: 2, display: "flex", justifyContent: "space-between" }, { children: [_jsx(Skeleton, { variant: "text", width: 48, height: 24 }), _jsx(Skeleton, { variant: "text", width: 48, height: 24 })] }))) : null] })));
18
20
  };
@@ -8,11 +8,13 @@ import { Card, CardTitle } from '../../components/Card';
8
8
  import { ProgressToNextUpdate } from '../../components/ProgressToNextUpdate';
9
9
  import { SwapRouteCard, SwapRouteCardSkeleton, SwapRouteNotFoundCard, } from '../../components/SwapRouteCard';
10
10
  import { useSwapRoutes } from '../../hooks';
11
+ import { useWidgetConfig } from '../../providers';
11
12
  import { navigationRoutes } from '../../utils';
12
13
  import { Stack } from './SwapRoutes.style';
13
14
  import { useSetRecommendedRoute } from './useSetRecommendedRoute';
14
15
  export const SwapRoutes = (props) => {
15
16
  const { t } = useTranslation();
17
+ const { variant, useRecommendedRoute } = useWidgetConfig();
16
18
  const navigate = useNavigate();
17
19
  const { isValid, isValidating } = useFormState();
18
20
  const { routes, isLoading, isFetching, isFetched, dataUpdatedAt, refetchTime, refetch, } = useSwapRoutes();
@@ -25,13 +27,16 @@ export const SwapRoutes = (props) => {
25
27
  navigate(navigationRoutes.swapRoutes);
26
28
  };
27
29
  const routeNotFound = !currentRoute && !isLoading && !isFetching;
30
+ const onlyRecommendedRoute = variant === 'refuel' || useRecommendedRoute;
28
31
  return (_jsxs(Card, Object.assign({}, props, { children: [_jsx(CardTitle, { children: t('swap.routes') }), _jsx(ProgressToNextUpdate, { updatedAt: dataUpdatedAt || new Date().getTime(), timeToUpdate: refetchTime, isLoading: isFetching, onClick: () => refetch(), sx: {
29
32
  position: 'absolute',
30
33
  top: 8,
31
34
  right: 8,
32
- } }), _jsxs(Box, Object.assign({ sx: { display: 'flex' } }, { children: [_jsx(Stack, Object.assign({ direction: "row", spacing: 2, my: 2, ml: 2, mr: routeNotFound ? 2 : 1, sx: {
33
- borderRightWidth: !routeNotFound && (isFetching || (routes && routes.length > 1))
35
+ } }), _jsxs(Box, Object.assign({ sx: { display: 'flex' } }, { children: [_jsx(Stack, Object.assign({ direction: "row", spacing: 2, my: 2, ml: 2, mr: onlyRecommendedRoute || routeNotFound ? 2 : 1, sx: {
36
+ borderRightWidth: !onlyRecommendedRoute &&
37
+ !routeNotFound &&
38
+ (isFetching || (routes && routes.length > 1))
34
39
  ? 1
35
40
  : 0,
36
- } }, { children: isLoading || isFetching ? (_jsxs(_Fragment, { children: [_jsx(SwapRouteCardSkeleton, { minWidth: "80%", variant: "dense" }), _jsx(SwapRouteCardSkeleton, { minWidth: "80%", variant: "dense" })] })) : !currentRoute ? (_jsx(SwapRouteNotFoundCard, {})) : (_jsxs(_Fragment, { children: [_jsx(SwapRouteCard, { minWidth: routes.length > 1 ? '80%' : '100%', route: currentRoute, variant: "dense", active: true }), routes.length > 1 ? (_jsx(SwapRouteCard, { minWidth: "80%", route: routes[1], variant: "dense", pointerEvents: "none" })) : null] })) })), _jsx(Box, Object.assign({ sx: { display: 'flex', alignItems: 'center' } }, { children: !routeNotFound ? (_jsx(Box, Object.assign({ py: 1, pr: 1 }, { children: _jsx(IconButton, Object.assign({ onClick: handleCardClick, size: "medium", disabled: isValidating || !isValid }, { children: _jsx(KeyboardArrowRightIcon, {}) })) }))) : null }))] }))] })));
41
+ } }, { children: isLoading || isFetching ? (_jsxs(_Fragment, { children: [_jsx(SwapRouteCardSkeleton, { minWidth: !onlyRecommendedRoute ? '80%' : '100%', variant: "dense" }), !onlyRecommendedRoute ? (_jsx(SwapRouteCardSkeleton, { minWidth: "80%", variant: "dense" })) : null] })) : !currentRoute ? (_jsx(SwapRouteNotFoundCard, {})) : (_jsxs(_Fragment, { children: [_jsx(SwapRouteCard, { minWidth: !onlyRecommendedRoute && routes.length > 1 ? '80%' : '100%', route: currentRoute, variant: "dense", active: true }), !onlyRecommendedRoute && routes.length > 1 ? (_jsx(SwapRouteCard, { minWidth: "80%", route: routes[1], variant: "dense", pointerEvents: "none" })) : null] })) })), _jsx(Box, Object.assign({ sx: { display: 'flex', alignItems: 'center' } }, { children: !onlyRecommendedRoute && !routeNotFound ? (_jsx(Box, Object.assign({ py: 1, pr: 1 }, { children: _jsx(IconButton, Object.assign({ onClick: handleCardClick, size: "medium", disabled: isValidating || !isValid }, { children: _jsx(KeyboardArrowRightIcon, {}) })) }))) : null }))] }))] })));
37
42
  };
@@ -12,22 +12,23 @@ var __rest = (this && this.__rest) || function (s, e) {
12
12
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
13
13
  import { Box, Typography } from '@mui/material';
14
14
  import { useTranslation } from 'react-i18next';
15
- import { useChains } from '../../hooks';
15
+ import { useChain } from '../../hooks';
16
16
  import { formatTokenAmount } from '../../utils';
17
17
  import { SmallAvatar } from '../SmallAvatar';
18
18
  import { TextFitter } from '../TextFitter';
19
19
  import { TokenAvatar } from '../TokenAvatar';
20
20
  import { TextSecondary, TextSecondaryContainer } from './Token.style';
21
21
  export const Token = (_a) => {
22
- var _b;
23
22
  var { token, connected, step } = _a, other = __rest(_a, ["token", "connected", "step"]);
24
23
  const { t } = useTranslation();
25
- const { getChainById } = useChains();
26
- return (_jsxs(Box, Object.assign({ flex: 1 }, other, { children: [_jsxs(Box, Object.assign({ display: "flex", flex: 1, alignItems: "center" }, { children: [_jsx(TokenAvatar, { token: token, sx: { marginRight: 2 } }), _jsx(TextFitter, Object.assign({ height: 30, textStyle: {
24
+ const { chain } = useChain(token.chainId);
25
+ return (_jsxs(Box, Object.assign({ flex: 1 }, other, { children: [_jsxs(Box, Object.assign({ display: "flex", flex: 1, alignItems: "center" }, { children: [_jsx(TokenAvatar, { token: token, chain: chain, sx: { marginRight: 2 } }), _jsx(TextFitter, Object.assign({ height: 30, textStyle: {
27
26
  fontWeight: 700,
28
- } }, { children: formatTokenAmount(token.amount, token.decimals) }))] })), _jsxs(TextSecondaryContainer, Object.assign({ connected: connected, component: "span" }, { children: [_jsx(TextSecondary, Object.assign({ connected: connected }, { children: t(`swap.tokenOnChain`, {
27
+ } }, { children: t('format.number', {
28
+ value: formatTokenAmount(token.amount, token.decimals),
29
+ }) }))] })), _jsxs(TextSecondaryContainer, Object.assign({ connected: connected, component: "span" }, { children: [_jsx(TextSecondary, Object.assign({ connected: connected }, { children: t(`swap.tokenOnChain`, {
29
30
  tokenSymbol: token.symbol,
30
- chainName: (_b = getChainById(token.chainId)) === null || _b === void 0 ? void 0 : _b.name,
31
+ chainName: chain === null || chain === void 0 ? void 0 : chain.name,
31
32
  }) })), step ? (_jsxs(_Fragment, { children: [_jsx(Typography, Object.assign({ fontSize: 12, lineHeight: 1, fontWeight: 500, color: "text.secondary", px: 1, mt: 0.5 }, { children: "\u2022" })), _jsxs(Box, Object.assign({ display: "flex", alignItems: "flex-end", height: 12, mt: 0.5 }, { children: [_jsx(Box, Object.assign({ pr: 0.75 }, { children: _jsx(SmallAvatar, Object.assign({ src: step.toolDetails.logoURI, alt: step.toolDetails.name, sx: {
32
33
  border: 0,
33
34
  marginBottom: -0.25,
@@ -1,7 +1,17 @@
1
1
  /// <reference types="react" />
2
- import type { Token } from '@lifi/sdk';
2
+ import type { Chain, Token } from '@lifi/sdk';
3
3
  import type { SxProps, Theme } from '@mui/material';
4
+ export declare const TokenAvatarFallback: React.FC<{
5
+ token: Token;
6
+ sx?: SxProps<Theme>;
7
+ }>;
8
+ export declare const TokenAvatarBase: React.FC<{
9
+ token: Token;
10
+ chain?: Chain;
11
+ sx?: SxProps<Theme>;
12
+ }>;
4
13
  export declare const TokenAvatar: React.FC<{
5
14
  token: Token;
15
+ chain?: Chain;
6
16
  sx?: SxProps<Theme>;
7
17
  }>;
@@ -2,8 +2,17 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { Avatar, Badge } from '@mui/material';
3
3
  import { useChain, useToken } from '../../hooks';
4
4
  import { SmallAvatar } from '../SmallAvatar';
5
- export const TokenAvatar = ({ token, sx }) => {
5
+ export const TokenAvatarFallback = ({ token, sx }) => {
6
6
  const { chain } = useChain(token.chainId);
7
7
  const { token: chainToken } = useToken(token.chainId, token.address);
8
- return (_jsx(Badge, Object.assign({ overlap: "circular", anchorOrigin: { vertical: 'bottom', horizontal: 'right' }, badgeContent: chain ? (_jsx(SmallAvatar, Object.assign({ src: chain.logoURI, alt: chain.name }, { children: chain.name[0] }))) : null, sx: sx }, { children: _jsx(Avatar, Object.assign({ src: token.logoURI || (chainToken === null || chainToken === void 0 ? void 0 : chainToken.logoURI), alt: token.symbol }, { children: token.symbol[0] })) })));
8
+ return _jsx(TokenAvatarBase, { token: chainToken !== null && chainToken !== void 0 ? chainToken : token, chain: chain, sx: sx });
9
+ };
10
+ export const TokenAvatarBase = ({ token, chain, sx }) => {
11
+ return (_jsx(Badge, Object.assign({ overlap: "circular", anchorOrigin: { vertical: 'bottom', horizontal: 'right' }, badgeContent: chain ? (_jsx(SmallAvatar, Object.assign({ src: chain.logoURI, alt: chain.name }, { children: chain.name[0] }))) : null, sx: sx }, { children: _jsx(Avatar, Object.assign({ src: token.logoURI, alt: token.symbol }, { children: token.symbol[0] })) })));
12
+ };
13
+ export const TokenAvatar = ({ token, chain, sx }) => {
14
+ if (!chain || !token.logoURI) {
15
+ return _jsx(TokenAvatarFallback, { token: token, sx: sx });
16
+ }
17
+ return _jsx(TokenAvatarBase, { token: token, chain: chain, sx: sx });
9
18
  };
@@ -1,16 +1,16 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { Box } from '@mui/material';
3
- import { useCallback, useRef } from 'react';
4
- import { useFormContext, useWatch } from 'react-hook-form';
3
+ import { useRef } from 'react';
4
+ import { useWatch } from 'react-hook-form';
5
5
  import { useDebouncedWatch, useTokenBalances, useTokenSearch, } from '../../hooks';
6
6
  import { SwapFormKey, SwapFormKeyHelper, useWallet } from '../../providers';
7
7
  import { TokenNotFound } from './TokenNotFound';
8
+ import { useTokenSelect } from './useTokenSelect';
8
9
  import { VirtualizedTokenList } from './VirtualizedTokenList';
9
10
  export const TokenList = ({ formType, height, onClick, }) => {
10
11
  var _a, _b;
11
12
  const parentRef = useRef(null);
12
13
  const { account } = useWallet();
13
- const { setValue, getValues } = useFormContext();
14
14
  const [selectedChainId] = useWatch({
15
15
  name: [SwapFormKeyHelper.getChainKey(formType)],
16
16
  });
@@ -34,27 +34,6 @@ export const TokenList = ({ formType, height, onClick, }) => {
34
34
  : searchedToken
35
35
  ? [searchedToken]
36
36
  : filteredTokens;
37
- const handleTokenClick = useCallback((tokenAddress) => {
38
- setValue(SwapFormKeyHelper.getTokenKey(formType), tokenAddress, {
39
- shouldTouch: true,
40
- });
41
- // Set chain again to trigger URL builder update
42
- setValue(SwapFormKeyHelper.getChainKey(formType), selectedChainId, {
43
- shouldTouch: true,
44
- });
45
- setValue(SwapFormKeyHelper.getAmountKey(formType), '');
46
- const oppositeFormType = formType === 'from' ? 'to' : 'from';
47
- const [selectedOppositeToken, selectedOppositeChainId] = getValues([
48
- SwapFormKeyHelper.getTokenKey(oppositeFormType),
49
- SwapFormKeyHelper.getChainKey(oppositeFormType),
50
- ]);
51
- if (selectedOppositeToken === tokenAddress &&
52
- selectedOppositeChainId === selectedChainId) {
53
- setValue(SwapFormKeyHelper.getTokenKey(oppositeFormType), '', {
54
- shouldTouch: true,
55
- });
56
- }
57
- onClick === null || onClick === void 0 ? void 0 : onClick();
58
- }, [formType, getValues, onClick, selectedChainId, setValue]);
37
+ const handleTokenClick = useTokenSelect(formType, onClick);
59
38
  return (_jsxs(Box, Object.assign({ ref: parentRef, style: { height, overflow: 'auto' } }, { children: [!tokens.length && !isLoading ? (_jsx(TokenNotFound, { formType: formType })) : null, _jsx(VirtualizedTokenList, { tokens: tokens, featuredTokensLength: featuredTokens === null || featuredTokens === void 0 ? void 0 : featuredTokens.length, scrollElementRef: parentRef, chainId: selectedChainId, isLoading: isLoading, isBalanceLoading: isBalanceLoading, showBalance: account.isActive, showFeatured: !tokenSearchFilter, onClick: handleTokenClick })] })));
60
39
  };
@@ -1,5 +1,6 @@
1
1
  /// <reference types="react" />
2
- import type { TokenListItemProps } from './types';
2
+ import type { TokenListItemButtonProps, TokenListItemProps } from './types';
3
3
  export declare const TokenListItem: React.FC<TokenListItemProps>;
4
+ export declare const TokenListItemButton: React.FC<TokenListItemButtonProps>;
4
5
  export declare const TokenListItemSkeleton: () => JSX.Element;
5
6
  export declare const TokenAmountSkeleton: React.FC;
@@ -5,16 +5,21 @@ import { useTranslation } from 'react-i18next';
5
5
  import { formatTokenPrice } from '../../utils';
6
6
  import { ListItem, ListItemButton } from './TokenList.style';
7
7
  export const TokenListItem = memo(({ onClick, size, start, token, showBalance, isBalanceLoading, startAdornment, endAdornment, }) => {
8
- const { t } = useTranslation();
9
8
  const handleClick = () => onClick === null || onClick === void 0 ? void 0 : onClick(token.address);
10
- const tokenPrice = formatTokenPrice(token.amount, token.priceUSD);
11
9
  return (_jsxs(ListItem, Object.assign({ disablePadding: true, style: {
12
10
  height: `${size}px`,
13
11
  transform: `translateY(${start}px)`,
14
- } }, { children: [startAdornment, _jsxs(ListItemButton, Object.assign({ onClick: handleClick, dense: true, disableRipple: true }, { children: [_jsx(ListItemAvatar, { children: _jsx(Avatar, Object.assign({ src: token.logoURI, alt: token.symbol }, { children: token.symbol[0] })) }), _jsx(ListItemText, { primary: token.symbol, secondary: token.name }), showBalance ? (isBalanceLoading ? (_jsx(TokenAmountSkeleton, {})) : (_jsxs(Box, Object.assign({ sx: { textAlign: 'right' } }, { children: [Number(token.amount) ? (_jsx(Typography, Object.assign({ variant: "body1", noWrap: true }, { children: token.amount }))) : null, tokenPrice ? (_jsx(Typography, Object.assign({ fontWeight: 400, fontSize: 12, color: "text.secondary", "data-price": token.priceUSD }, { children: t(`swap.currency`, {
15
- value: tokenPrice,
16
- }) }))) : null] })))) : null] })), endAdornment] })));
12
+ } }, { children: [startAdornment, _jsx(TokenListItemButton, { token: token, showBalance: showBalance, isBalanceLoading: isBalanceLoading, onClick: handleClick }), endAdornment] })));
17
13
  });
14
+ export const TokenListItemButton = ({ onClick, token, showBalance, isBalanceLoading, }) => {
15
+ const { t } = useTranslation();
16
+ const tokenPrice = formatTokenPrice(token.amount, token.priceUSD);
17
+ return (_jsxs(ListItemButton, Object.assign({ onClick: onClick, dense: true, disableRipple: true }, { children: [_jsx(ListItemAvatar, { children: _jsx(Avatar, Object.assign({ src: token.logoURI, alt: token.symbol }, { children: token.symbol[0] })) }), _jsx(ListItemText, { primary: token.symbol, secondary: token.name }), showBalance ? (isBalanceLoading ? (_jsx(TokenAmountSkeleton, {})) : (_jsxs(Box, Object.assign({ sx: { textAlign: 'right' } }, { children: [Number(token.amount) ? (_jsx(Typography, Object.assign({ variant: "body1", noWrap: true }, { children: t('format.number', {
18
+ value: token.amount,
19
+ }) }))) : null, tokenPrice ? (_jsx(Typography, Object.assign({ fontWeight: 400, fontSize: 12, color: "text.secondary", "data-price": token.priceUSD }, { children: t(`format.currency`, {
20
+ value: tokenPrice,
21
+ }) }))) : null] })))) : null] })));
22
+ };
18
23
  export const TokenListItemSkeleton = () => {
19
24
  return (_jsxs(ListItem, Object.assign({ secondaryAction: _jsx(TokenAmountSkeleton, {}), disablePadding: true, sx: { position: 'relative', flexDirection: 'row', alignItems: 'center' } }, { children: [_jsx(ListItemAvatar, { children: _jsx(Skeleton, { variant: "circular", width: 32, height: 32, sx: { marginLeft: 1.5, marginRight: 2 } }) }), _jsx(ListItemText, { primary: _jsx(Skeleton, { variant: "text", width: 48, height: 20 }), secondary: _jsx(Skeleton, { variant: "text", width: 96, height: 20 }) })] })));
20
25
  };
@@ -1 +1,2 @@
1
1
  export * from './TokenList';
2
+ export * from './useTokenSelect';
@@ -1 +1,2 @@
1
1
  export * from './TokenList';
2
+ export * from './useTokenSelect';
@@ -30,3 +30,9 @@ export interface TokenListItemProps extends TokenListItemBaseProps {
30
30
  startAdornment?: React.ReactNode;
31
31
  endAdornment?: React.ReactNode;
32
32
  }
33
+ export interface TokenListItemButtonProps {
34
+ onClick?(): void;
35
+ showBalance?: boolean;
36
+ token: TokenAmount;
37
+ isBalanceLoading?: boolean;
38
+ }
@@ -0,0 +1,2 @@
1
+ import type { SwapFormType } from '../../providers';
2
+ export declare const useTokenSelect: (formType: SwapFormType, onClick?: () => void) => (tokenAddress: string, chainId?: number) => void;
@@ -0,0 +1,29 @@
1
+ import { useCallback } from 'react';
2
+ import { useFormContext } from 'react-hook-form';
3
+ import { SwapFormKeyHelper } from '../../providers';
4
+ export const useTokenSelect = (formType, onClick) => {
5
+ const { setValue, getValues } = useFormContext();
6
+ return useCallback((tokenAddress, chainId) => {
7
+ const selectedChainId = chainId !== null && chainId !== void 0 ? chainId : getValues(SwapFormKeyHelper.getChainKey(formType));
8
+ setValue(SwapFormKeyHelper.getTokenKey(formType), tokenAddress, {
9
+ shouldTouch: true,
10
+ });
11
+ // Set chain again to trigger URL builder update
12
+ setValue(SwapFormKeyHelper.getChainKey(formType), selectedChainId, {
13
+ shouldTouch: true,
14
+ });
15
+ setValue(SwapFormKeyHelper.getAmountKey(formType), '');
16
+ const oppositeFormType = formType === 'from' ? 'to' : 'from';
17
+ const [selectedOppositeToken, selectedOppositeChainId] = getValues([
18
+ SwapFormKeyHelper.getTokenKey(oppositeFormType),
19
+ SwapFormKeyHelper.getChainKey(oppositeFormType),
20
+ ]);
21
+ if (selectedOppositeToken === tokenAddress &&
22
+ selectedOppositeChainId === selectedChainId) {
23
+ setValue(SwapFormKeyHelper.getTokenKey(oppositeFormType), '', {
24
+ shouldTouch: true,
25
+ });
26
+ }
27
+ onClick === null || onClick === void 0 ? void 0 : onClick();
28
+ }, [formType, getValues, onClick, setValue]);
29
+ };
@@ -1,2 +1,2 @@
1
1
  export declare const name = "@lifi/widget";
2
- export declare const version = "1.21.0";
2
+ export declare const version = "1.22.1";
package/config/version.js CHANGED
@@ -1,2 +1,2 @@
1
1
  export const name = '@lifi/widget';
2
- export const version = '1.21.0';
2
+ export const version = '1.22.1';
@@ -1,4 +1,4 @@
1
- export declare const useChain: (chainId: number) => {
2
- chain: import("@lifi/types").EVMChain | undefined;
1
+ export declare const useChain: (chainId?: number) => {
2
+ chain: import("@lifi/types").ExtendedChain | undefined;
3
3
  isLoading: boolean;
4
4
  };
@@ -1,5 +1,5 @@
1
1
  export declare const useChains: () => {
2
- chains: import("@lifi/types").EVMChain[] | undefined;
3
- getChainById: (chainId: number) => import("@lifi/types").EVMChain | undefined;
2
+ chains: import("@lifi/types").ExtendedChain[] | undefined;
3
+ getChainById: (chainId: number) => import("@lifi/types").ExtendedChain | undefined;
4
4
  isLoading: boolean;
5
5
  };
@@ -2,9 +2,7 @@ import { useMediaQuery } from '@mui/material';
2
2
  import { useWidgetConfig } from '../providers';
3
3
  const defaultExpandableWidth = 852;
4
4
  export const useExpandableVariant = () => {
5
- const { variant } = useWidgetConfig();
6
- const expandableAllowed = useMediaQuery((theme) => {
7
- return theme.breakpoints.up(defaultExpandableWidth);
8
- });
9
- return variant === 'expandable' && expandableAllowed;
5
+ const { variant, useRecommendedRoute } = useWidgetConfig();
6
+ const expandableAllowed = useMediaQuery((theme) => theme.breakpoints.up(defaultExpandableWidth));
7
+ return variant === 'expandable' && expandableAllowed && !useRecommendedRoute;
10
8
  };
@@ -1,10 +1,10 @@
1
1
  import type { EVMChain, Process, Step } from '@lifi/sdk';
2
- import type { TFunction } from 'react-i18next';
2
+ import type { TFunction } from 'i18next';
3
3
  export declare const useProcessMessage: (step?: Step, process?: Process) => {
4
4
  title?: string | undefined;
5
5
  message?: string | undefined;
6
6
  };
7
- export declare function getProcessMessage(t: TFunction<'translation', undefined>, getChainById: (chainId: number) => EVMChain | undefined, step: Step, process: Process): {
7
+ export declare function getProcessMessage(t: TFunction, getChainById: (chainId: number) => EVMChain | undefined, step: Step, process: Process): {
8
8
  title?: string;
9
9
  message?: string;
10
10
  };