@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">, {}, {}>;
@@ -48,7 +48,7 @@ const StepTimer = ({ step, hideInProgress, }) => {
48
48
  ]);
49
49
  if (!isExecutionStarted) {
50
50
  return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: t('swap.estimatedTime', {
51
- value: (step.estimate.executionDuration / 60).toFixed(0),
51
+ value: Math.ceil(step.estimate.executionDuration / 60),
52
52
  }) }));
53
53
  }
54
54
  const isTimerExpired = isExpired || (!minutes && !seconds);
@@ -45,7 +45,12 @@ const StepActions = (_a) => {
45
45
  exports.StepActions = StepActions;
46
46
  const StepDetailsContent = ({ step }) => {
47
47
  var _a, _b;
48
- return ((0, jsx_runtime_1.jsxs)(material_1.Typography, Object.assign({ fontSize: 12, fontWeight: "500", color: "text.secondary", alignItems: "center", display: "flex" }, { children: [(0, utils_1.formatTokenAmount)(step.estimate.fromAmount, step.action.fromToken.decimals), ' ', step.action.fromToken.symbol, (0, jsx_runtime_1.jsx)(icons_material_1.ArrowForward, { sx: { fontSize: 18, paddingX: 0.5 } }), (0, utils_1.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] })));
48
+ const { t } = (0, react_i18next_1.useTranslation)();
49
+ return ((0, jsx_runtime_1.jsxs)(material_1.Typography, Object.assign({ fontSize: 12, fontWeight: "500", color: "text.secondary", alignItems: "center", display: "flex" }, { children: [t('format.number', {
50
+ value: (0, utils_1.formatTokenAmount)(step.estimate.fromAmount, step.action.fromToken.decimals),
51
+ }), ' ', step.action.fromToken.symbol, (0, jsx_runtime_1.jsx)(icons_material_1.ArrowForward, { sx: { fontSize: 18, paddingX: 0.5 } }), t('format.number', {
52
+ value: (0, utils_1.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),
53
+ }), ' ', step.action.toToken.symbol] })));
49
54
  };
50
55
  exports.StepDetailsContent = StepDetailsContent;
51
56
  const CrossStepDetailsLabel = ({ step }) => {
@@ -21,12 +21,12 @@ const utils_1 = require("../../utils");
21
21
  exports.SwapButton = (0, react_1.forwardRef)(({ onClick, currentRoute, text, disable, enableLoading, loading }, ref) => {
22
22
  const { t } = (0, react_i18next_1.useTranslation)();
23
23
  const navigate = (0, react_router_dom_1.useNavigate)();
24
- const config = (0, providers_1.useWidgetConfig)();
24
+ const { variant, walletManagement } = (0, providers_1.useWidgetConfig)();
25
25
  const { account, connect } = (0, providers_1.useWallet)();
26
26
  const { insufficientFunds, insufficientGas, isLoading: isGasSufficiencyLoading, } = (0, hooks_1.useGasSufficiency)(currentRoute);
27
27
  const handleSwapButtonClick = () => __awaiter(void 0, void 0, void 0, function* () {
28
28
  if (!account.isActive) {
29
- if (config.walletManagement) {
29
+ if (walletManagement) {
30
30
  yield connect();
31
31
  }
32
32
  else {
@@ -40,9 +40,14 @@ exports.SwapButton = (0, react_1.forwardRef)(({ onClick, currentRoute, text, dis
40
40
  const getButtonText = () => {
41
41
  if (account.isActive) {
42
42
  if (!currentRoute) {
43
- return t(`button.swap`);
43
+ return variant !== 'refuel' ? t(`button.swap`) : t(`button.getGas`);
44
44
  }
45
- return text || t(`button.reviewSwap`);
45
+ if (text) {
46
+ return text;
47
+ }
48
+ return variant !== 'refuel'
49
+ ? t(`button.reviewSwap`)
50
+ : t(`button.startSwap`);
46
51
  }
47
52
  return t(`button.connectWallet`);
48
53
  };
@@ -22,10 +22,10 @@ const FormPriceHelperText = ({ formType, selected }) => {
22
22
  return ((0, jsx_runtime_1.jsxs)(material_1.FormHelperText, Object.assign({ component: "div", sx: { display: 'flex', justifyContent: 'space-between', margin: 0 } }, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ color: fromAmountTokenPrice ? 'text.secondary' : 'grey.600', fontWeight: 400, fontSize: 12, marginLeft: selected ? 8 : 2, lineHeight: 1.3334, flex: 1, sx: {
23
23
  wordBreak: 'break-word',
24
24
  overflowWrap: 'break-word',
25
- } }, { children: t(`swap.currency`, {
25
+ } }, { children: t(`format.currency`, {
26
26
  value: fromAmountTokenPrice,
27
- }) })), isLoading && tokenAddress ? ((0, jsx_runtime_1.jsx)(material_1.Skeleton, { variant: "text", width: 48, height: 16, sx: { borderRadius: 0.25 } })) : (token === null || token === void 0 ? void 0 : token.amount) ? ((0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ fontWeight: 400, fontSize: 12, color: "text.secondary", lineHeight: 1.3334, pl: 0.25 }, { children: t(`swap.maxAmount`, {
28
- amount: token === null || token === void 0 ? void 0 : token.amount,
29
- }) }))) : null] })));
27
+ }) })), isLoading && tokenAddress ? ((0, jsx_runtime_1.jsx)(material_1.Skeleton, { variant: "text", width: 48, height: 16, sx: { borderRadius: 0.25 } })) : (token === null || token === void 0 ? void 0 : token.amount) ? ((0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ fontWeight: 400, fontSize: 12, color: "text.secondary", lineHeight: 1.3334, pl: 0.25 }, { children: `/ ${t(`format.number`, {
28
+ value: token === null || token === void 0 ? void 0 : token.amount,
29
+ })}` }))) : null] })));
30
30
  };
31
31
  exports.FormPriceHelperText = FormPriceHelperText;
@@ -7,6 +7,7 @@ const react_hook_form_1 = require("react-hook-form");
7
7
  const react_i18next_1 = require("react-i18next");
8
8
  const hooks_1 = require("../../hooks");
9
9
  const providers_1 = require("../../providers");
10
+ const types_1 = require("../../types");
10
11
  const utils_1 = require("../../utils");
11
12
  const Card_1 = require("../Card");
12
13
  const TokenAvatar_1 = require("../TokenAvatar");
@@ -16,6 +17,7 @@ const SwapInputAdornment_1 = require("./SwapInputAdornment");
16
17
  const SwapInput = ({ formType }) => {
17
18
  const { t } = (0, react_i18next_1.useTranslation)();
18
19
  const { setValue } = (0, react_hook_form_1.useFormContext)();
20
+ const { disabledUI } = (0, providers_1.useWidgetConfig)();
19
21
  const ref = (0, react_1.useRef)(null);
20
22
  const amountKey = providers_1.SwapFormKeyHelper.getAmountKey(formType);
21
23
  const [amount, chainId, tokenAddress] = (0, react_hook_form_1.useWatch)({
@@ -43,8 +45,9 @@ const SwapInput = ({ formType }) => {
43
45
  (0, react_1.useLayoutEffect)(() => {
44
46
  (0, utils_1.fitInputText)(SwapInput_style_1.maxInputFontSize, SwapInput_style_1.minInputFontSize, ref.current);
45
47
  }, [amount]);
46
- return ((0, jsx_runtime_1.jsxs)(Card_1.Card, { children: [(0, jsx_runtime_1.jsx)(Card_1.CardTitle, { children: t('swap.amount') }), (0, jsx_runtime_1.jsxs)(SwapInput_style_1.FormControl, Object.assign({ fullWidth: true }, { children: [(0, jsx_runtime_1.jsx)(SwapInput_style_1.Input, { inputRef: ref, size: "small", autoComplete: "off", placeholder: "0", startAdornment: isSelected ? ((0, jsx_runtime_1.jsx)(TokenAvatar_1.TokenAvatar, { token: token, sx: { marginLeft: 2 } })) : null, endAdornment: (0, jsx_runtime_1.jsx)(SwapInputAdornment_1.SwapInputAdornment, { formType: formType }), inputProps: {
48
+ const disabled = disabledUI === null || disabledUI === void 0 ? void 0 : disabledUI.includes(types_1.DisabledUI.FromAmount);
49
+ return ((0, jsx_runtime_1.jsxs)(Card_1.Card, { children: [(0, jsx_runtime_1.jsx)(Card_1.CardTitle, { children: t('swap.fromAmount') }), (0, jsx_runtime_1.jsxs)(SwapInput_style_1.FormControl, Object.assign({ fullWidth: true }, { children: [(0, jsx_runtime_1.jsx)(SwapInput_style_1.Input, { inputRef: ref, size: "small", autoComplete: "off", placeholder: "0", startAdornment: isSelected ? ((0, jsx_runtime_1.jsx)(TokenAvatar_1.TokenAvatar, { token: token, chain: chain, sx: { marginLeft: 2 } })) : null, endAdornment: !disabled ? (0, jsx_runtime_1.jsx)(SwapInputAdornment_1.SwapInputAdornment, { formType: formType }) : undefined, inputProps: {
47
50
  inputMode: 'decimal',
48
- }, onChange: handleChange, onBlur: handleBlur, value: amount, name: amountKey, required: true }), (0, jsx_runtime_1.jsx)(FormPriceHelperText_1.FormPriceHelperText, { selected: isSelected, formType: formType })] }))] }));
51
+ }, onChange: handleChange, onBlur: handleBlur, value: amount, name: amountKey, disabled: disabled, required: true }), (0, jsx_runtime_1.jsx)(FormPriceHelperText_1.FormPriceHelperText, { selected: isSelected, formType: formType })] }))] }));
49
52
  };
50
53
  exports.SwapInput = SwapInput;
@@ -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;
@@ -17,6 +17,7 @@ const icons_material_1 = require("@mui/icons-material");
17
17
  const material_1 = require("@mui/material");
18
18
  const react_1 = require("react");
19
19
  const react_i18next_1 = require("react-i18next");
20
+ const providers_1 = require("../../providers");
20
21
  const Card_1 = require("../Card");
21
22
  const StepActions_1 = require("../StepActions");
22
23
  const Token_1 = require("../Token");
@@ -26,6 +27,7 @@ const SwapRouteCard = (_a) => {
26
27
  var _b;
27
28
  var { route, active, variant = 'default', expanded } = _a, other = __rest(_a, ["route", "active", "variant", "expanded"]);
28
29
  const { t } = (0, react_i18next_1.useTranslation)();
30
+ const { variant: widgetVariant, useRecommendedRoute } = (0, providers_1.useWidgetConfig)();
29
31
  const [cardExpanded, setCardExpanded] = (0, react_1.useState)(variant === 'default' || expanded);
30
32
  const alternativeTag = t(`swap.tags.ALTERNATIVE`);
31
33
  const label = ((_b = route.tags) === null || _b === void 0 ? void 0 : _b.length)
@@ -35,7 +37,7 @@ const SwapRouteCard = (_a) => {
35
37
  e.stopPropagation();
36
38
  setCardExpanded((expanded) => !expanded);
37
39
  };
38
- return ((0, jsx_runtime_1.jsxs)(Card_1.Card, Object.assign({ dense: variant === 'dense', variant: active ? 'selected' : 'default', selectionColor: "secondary", indented: true }, other, { children: [(0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ display: "flex", justifyContent: "space-between", alignItems: "center", mb: 2 }, { children: [(0, jsx_runtime_1.jsx)(SwapRouteCard_style_1.Label, Object.assign({ active: active !== null && active !== void 0 ? active : label !== alternativeTag }, { children: label })), variant === 'stretched' ? ((0, jsx_runtime_1.jsx)(exports.SwapRouteCardEssentials, { route: route })) : null] })), (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ display: "flex", justifyContent: "space-between", alignItems: "center" }, { children: [(0, jsx_runtime_1.jsx)(Token_1.Token, { token: Object.assign(Object.assign({}, route.toToken), { amount: route.toAmount }), step: variant === 'stretched' ? route.steps[0] : undefined }), variant === 'stretched' && !expanded ? ((0, jsx_runtime_1.jsx)(SwapRouteCard_style_1.IconButton, Object.assign({ onClick: handleExpand, size: "small" }, { children: cardExpanded ? (0, jsx_runtime_1.jsx)(icons_material_1.ExpandLess, {}) : (0, jsx_runtime_1.jsx)(icons_material_1.ExpandMore, {}) }))) : null] })), (0, jsx_runtime_1.jsx)(material_1.Collapse, Object.assign({ timeout: 225, in: cardExpanded, mountOnEnter: true, unmountOnExit: true }, { children: route.steps.map((step) => ((0, jsx_runtime_1.jsx)(StepActions_1.StepActions, { step: step, mt: 2 }, step.id))) })), variant !== 'stretched' ? ((0, jsx_runtime_1.jsx)(exports.SwapRouteCardEssentials, { route: route, dense: true })) : null] })));
40
+ return ((0, jsx_runtime_1.jsxs)(Card_1.Card, Object.assign({ dense: variant === 'dense', variant: active ? 'selected' : 'default', selectionColor: "secondary", indented: true }, other, { children: [widgetVariant !== 'refuel' && !useRecommendedRoute ? ((0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ display: "flex", justifyContent: "space-between", alignItems: "center", mb: 2 }, { children: [(0, jsx_runtime_1.jsx)(SwapRouteCard_style_1.Label, Object.assign({ active: active !== null && active !== void 0 ? active : label !== alternativeTag }, { children: label })), variant === 'stretched' ? ((0, jsx_runtime_1.jsx)(exports.SwapRouteCardEssentials, { route: route })) : null] }))) : null, (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ display: "flex", justifyContent: "space-between", alignItems: "center" }, { children: [(0, jsx_runtime_1.jsx)(Token_1.Token, { token: Object.assign(Object.assign({}, route.toToken), { amount: route.toAmount }), step: variant === 'stretched' ? route.steps[0] : undefined }), variant === 'stretched' && !expanded ? ((0, jsx_runtime_1.jsx)(SwapRouteCard_style_1.IconButton, Object.assign({ onClick: handleExpand, size: "small" }, { children: cardExpanded ? (0, jsx_runtime_1.jsx)(icons_material_1.ExpandLess, {}) : (0, jsx_runtime_1.jsx)(icons_material_1.ExpandMore, {}) }))) : null] })), (0, jsx_runtime_1.jsx)(material_1.Collapse, Object.assign({ timeout: 225, in: cardExpanded, mountOnEnter: true, unmountOnExit: true }, { children: route.steps.map((step) => ((0, jsx_runtime_1.jsx)(StepActions_1.StepActions, { step: step, mt: 2 }, step.id))) })), variant !== 'stretched' ? ((0, jsx_runtime_1.jsx)(exports.SwapRouteCardEssentials, { route: route, dense: true })) : null] })));
39
41
  };
40
42
  exports.SwapRouteCard = SwapRouteCard;
41
43
  const SwapRouteCardEssentials = ({ route, dense }) => {
@@ -48,8 +50,8 @@ const SwapRouteCardEssentials = ({ route, dense }) => {
48
50
  const gasCosts = (0, utils_1.getGasCostsBreakdown)(route);
49
51
  return ((0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ display: "flex", justifyContent: dense ? 'space-between' : 'flex-end', flex: 1, pl: dense ? 0 : 2, mt: dense ? 2 : 0 }, { children: [(0, jsx_runtime_1.jsx)(material_1.Tooltip, Object.assign({ title: (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ component: "span" }, { children: [t(`tooltip.estimatedNetworkFee`), gasCosts.map((gas) => {
50
52
  var _a;
51
- return ((0, jsx_runtime_1.jsxs)(material_1.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}`));
52
- })] })), placement: "top", enterDelay: 400, arrow: true }, { children: (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ display: "flex", alignItems: "center", mr: dense ? 0 : 2 }, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ lineHeight: 0, mr: 0.5, color: "grey.500" }, { children: (0, jsx_runtime_1.jsx)(icons_material_1.EvStationOutlined, { fontSize: dense ? 'medium' : 'small' }) })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ fontSize: 14, color: "text.primary", fontWeight: "500", lineHeight: 1 }, { children: t(`swap.currency`, { value: gasCostUSD }) }))] })) })), (0, jsx_runtime_1.jsx)(material_1.Tooltip, Object.assign({ title: t(`tooltip.estimatedTime`), placement: "top", enterDelay: 400, arrow: true }, { children: (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ display: "flex", alignItems: "center", mr: dense ? 0 : 2 }, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ lineHeight: 0, mr: 0.5, color: "grey.500" }, { children: (0, jsx_runtime_1.jsx)(icons_material_1.AccessTime, { fontSize: dense ? 'medium' : 'small' }) })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ fontSize: 14, color: "text.primary", fontWeight: "500", lineHeight: 1 }, { children: t('swap.estimatedTime', {
53
+ return ((0, jsx_runtime_1.jsxs)(material_1.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}`));
54
+ })] })), placement: "top", enterDelay: 400, arrow: true }, { children: (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ display: "flex", alignItems: "center", mr: dense ? 0 : 2 }, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ lineHeight: 0, mr: 0.5, color: "grey.500" }, { children: (0, jsx_runtime_1.jsx)(icons_material_1.EvStationOutlined, { fontSize: dense ? 'medium' : 'small' }) })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ fontSize: 14, color: "text.primary", fontWeight: "500", lineHeight: 1 }, { children: t(`format.currency`, { value: gasCostUSD }) }))] })) })), (0, jsx_runtime_1.jsx)(material_1.Tooltip, Object.assign({ title: t(`tooltip.estimatedTime`), placement: "top", enterDelay: 400, arrow: true }, { children: (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ display: "flex", alignItems: "center", mr: dense ? 0 : 2 }, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ lineHeight: 0, mr: 0.5, color: "grey.500" }, { children: (0, jsx_runtime_1.jsx)(icons_material_1.AccessTime, { fontSize: dense ? 'medium' : 'small' }) })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ fontSize: 14, color: "text.primary", fontWeight: "500", lineHeight: 1 }, { children: t('swap.estimatedTime', {
53
55
  value: executionTimeMinutes,
54
56
  }) }))] })) })), !dense ? ((0, jsx_runtime_1.jsx)(material_1.Tooltip, Object.assign({ title: t(`tooltip.numberOfSteps`), placement: "top", enterDelay: 400, arrow: true }, { children: (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ display: "flex", alignItems: "center" }, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ lineHeight: 0, mr: 0.5, color: "grey.500" }, { children: (0, jsx_runtime_1.jsx)(icons_material_1.LayersOutlined, { fontSize: dense ? 'medium' : 'small' }) })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ fontSize: 14, color: "text.primary", fontWeight: "500", lineHeight: 1 }, { children: route.steps.length }))] })) }))) : null] })));
55
57
  };
@@ -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;
@@ -14,9 +14,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
14
14
  exports.SwapRouteCardSkeleton = void 0;
15
15
  const jsx_runtime_1 = require("react/jsx-runtime");
16
16
  const material_1 = require("@mui/material");
17
+ const providers_1 = require("../../providers");
17
18
  const Card_1 = require("../Card");
18
19
  const SwapRouteCardSkeleton = (_a) => {
19
20
  var { variant } = _a, other = __rest(_a, ["variant"]);
20
- return ((0, jsx_runtime_1.jsxs)(Card_1.Card, Object.assign({ dense: variant === 'dense', indented: true }, other, { children: [(0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ display: "flex", justifyContent: "space-between", alignItems: "center" }, { children: [(0, jsx_runtime_1.jsx)(material_1.Skeleton, { variant: "rectangular", width: 118, height: 24, sx: { borderRadius: 0.5 } }), variant === 'stretched' ? ((0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ display: "flex" }, { children: [(0, jsx_runtime_1.jsx)(material_1.Skeleton, { variant: "text", width: 52, height: 24, sx: { marginRight: 2 } }), (0, jsx_runtime_1.jsx)(material_1.Skeleton, { variant: "text", width: 44, height: 24, sx: { marginRight: 2 } }), (0, jsx_runtime_1.jsx)(material_1.Skeleton, { variant: "text", width: 32, height: 24 })] }))) : null] })), (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ mt: 2 }, { children: [(0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ display: "flex", alignItems: "center" }, { children: [(0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ mr: 2 }, { children: (0, jsx_runtime_1.jsx)(material_1.Skeleton, { variant: "circular", width: 32, height: 32 }) })), (0, jsx_runtime_1.jsx)(material_1.Skeleton, { variant: "text", width: 96, height: 32 })] })), (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ ml: 6, display: "flex", alignItems: "center" }, { children: [(0, jsx_runtime_1.jsx)(material_1.Skeleton, { variant: "text", width: 102, height: 16, sx: { borderRadius: 0.5 } }), variant === 'stretched' ? ((0, jsx_runtime_1.jsx)(material_1.Skeleton, { variant: "text", width: 72, height: 16, sx: { marginLeft: 1 } })) : null] }))] })), variant !== 'stretched' ? ((0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ mt: 2, display: "flex", justifyContent: "space-between" }, { children: [(0, jsx_runtime_1.jsx)(material_1.Skeleton, { variant: "text", width: 48, height: 24 }), (0, jsx_runtime_1.jsx)(material_1.Skeleton, { variant: "text", width: 48, height: 24 })] }))) : null] })));
21
+ const { variant: widgetVariant, useRecommendedRoute } = (0, providers_1.useWidgetConfig)();
22
+ return ((0, jsx_runtime_1.jsxs)(Card_1.Card, Object.assign({ dense: variant === 'dense', indented: true }, other, { children: [widgetVariant !== 'refuel' && !useRecommendedRoute ? ((0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ display: "flex", justifyContent: "space-between", alignItems: "center", mb: 2 }, { children: [(0, jsx_runtime_1.jsx)(material_1.Skeleton, { variant: "rectangular", width: 118, height: 24, sx: { borderRadius: 0.5 } }), variant === 'stretched' ? ((0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ display: "flex" }, { children: [(0, jsx_runtime_1.jsx)(material_1.Skeleton, { variant: "text", width: 52, height: 24, sx: { marginRight: 2 } }), (0, jsx_runtime_1.jsx)(material_1.Skeleton, { variant: "text", width: 44, height: 24, sx: { marginRight: 2 } }), (0, jsx_runtime_1.jsx)(material_1.Skeleton, { variant: "text", width: 32, height: 24 })] }))) : null] }))) : null, (0, jsx_runtime_1.jsxs)(material_1.Box, { children: [(0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ display: "flex", alignItems: "center" }, { children: [(0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ mr: 2 }, { children: (0, jsx_runtime_1.jsx)(material_1.Skeleton, { variant: "circular", width: 32, height: 32 }) })), (0, jsx_runtime_1.jsx)(material_1.Skeleton, { variant: "text", width: 96, height: 32 })] })), (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ ml: 6, display: "flex", alignItems: "center" }, { children: [(0, jsx_runtime_1.jsx)(material_1.Skeleton, { variant: "text", width: 102, height: 16, sx: { borderRadius: 0.5 } }), variant === 'stretched' ? ((0, jsx_runtime_1.jsx)(material_1.Skeleton, { variant: "text", width: 72, height: 16, sx: { marginLeft: 1 } })) : null] }))] }), variant !== 'stretched' ? ((0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ mt: 2, display: "flex", justifyContent: "space-between" }, { children: [(0, jsx_runtime_1.jsx)(material_1.Skeleton, { variant: "text", width: 48, height: 24 }), (0, jsx_runtime_1.jsx)(material_1.Skeleton, { variant: "text", width: 48, height: 24 })] }))) : null] })));
21
23
  };
22
24
  exports.SwapRouteCardSkeleton = SwapRouteCardSkeleton;
@@ -11,11 +11,13 @@ const Card_1 = require("../../components/Card");
11
11
  const ProgressToNextUpdate_1 = require("../../components/ProgressToNextUpdate");
12
12
  const SwapRouteCard_1 = require("../../components/SwapRouteCard");
13
13
  const hooks_1 = require("../../hooks");
14
+ const providers_1 = require("../../providers");
14
15
  const utils_1 = require("../../utils");
15
16
  const SwapRoutes_style_1 = require("./SwapRoutes.style");
16
17
  const useSetRecommendedRoute_1 = require("./useSetRecommendedRoute");
17
18
  const SwapRoutes = (props) => {
18
19
  const { t } = (0, react_i18next_1.useTranslation)();
20
+ const { variant, useRecommendedRoute } = (0, providers_1.useWidgetConfig)();
19
21
  const navigate = (0, react_router_dom_1.useNavigate)();
20
22
  const { isValid, isValidating } = (0, react_hook_form_1.useFormState)();
21
23
  const { routes, isLoading, isFetching, isFetched, dataUpdatedAt, refetchTime, refetch, } = (0, hooks_1.useSwapRoutes)();
@@ -28,14 +30,17 @@ const SwapRoutes = (props) => {
28
30
  navigate(utils_1.navigationRoutes.swapRoutes);
29
31
  };
30
32
  const routeNotFound = !currentRoute && !isLoading && !isFetching;
33
+ const onlyRecommendedRoute = variant === 'refuel' || useRecommendedRoute;
31
34
  return ((0, jsx_runtime_1.jsxs)(Card_1.Card, Object.assign({}, props, { children: [(0, jsx_runtime_1.jsx)(Card_1.CardTitle, { children: t('swap.routes') }), (0, jsx_runtime_1.jsx)(ProgressToNextUpdate_1.ProgressToNextUpdate, { updatedAt: dataUpdatedAt || new Date().getTime(), timeToUpdate: refetchTime, isLoading: isFetching, onClick: () => refetch(), sx: {
32
35
  position: 'absolute',
33
36
  top: 8,
34
37
  right: 8,
35
- } }), (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ sx: { display: 'flex' } }, { children: [(0, jsx_runtime_1.jsx)(SwapRoutes_style_1.Stack, Object.assign({ direction: "row", spacing: 2, my: 2, ml: 2, mr: routeNotFound ? 2 : 1, sx: {
36
- borderRightWidth: !routeNotFound && (isFetching || (routes && routes.length > 1))
38
+ } }), (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ sx: { display: 'flex' } }, { children: [(0, jsx_runtime_1.jsx)(SwapRoutes_style_1.Stack, Object.assign({ direction: "row", spacing: 2, my: 2, ml: 2, mr: onlyRecommendedRoute || routeNotFound ? 2 : 1, sx: {
39
+ borderRightWidth: !onlyRecommendedRoute &&
40
+ !routeNotFound &&
41
+ (isFetching || (routes && routes.length > 1))
37
42
  ? 1
38
43
  : 0,
39
- } }, { children: isLoading || isFetching ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(SwapRouteCard_1.SwapRouteCardSkeleton, { minWidth: "80%", variant: "dense" }), (0, jsx_runtime_1.jsx)(SwapRouteCard_1.SwapRouteCardSkeleton, { minWidth: "80%", variant: "dense" })] })) : !currentRoute ? ((0, jsx_runtime_1.jsx)(SwapRouteCard_1.SwapRouteNotFoundCard, {})) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(SwapRouteCard_1.SwapRouteCard, { minWidth: routes.length > 1 ? '80%' : '100%', route: currentRoute, variant: "dense", active: true }), routes.length > 1 ? ((0, jsx_runtime_1.jsx)(SwapRouteCard_1.SwapRouteCard, { minWidth: "80%", route: routes[1], variant: "dense", pointerEvents: "none" })) : null] })) })), (0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ sx: { display: 'flex', alignItems: 'center' } }, { children: !routeNotFound ? ((0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ py: 1, pr: 1 }, { children: (0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ onClick: handleCardClick, size: "medium", disabled: isValidating || !isValid }, { children: (0, jsx_runtime_1.jsx)(icons_material_1.KeyboardArrowRight, {}) })) }))) : null }))] }))] })));
44
+ } }, { children: isLoading || isFetching ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(SwapRouteCard_1.SwapRouteCardSkeleton, { minWidth: !onlyRecommendedRoute ? '80%' : '100%', variant: "dense" }), !onlyRecommendedRoute ? ((0, jsx_runtime_1.jsx)(SwapRouteCard_1.SwapRouteCardSkeleton, { minWidth: "80%", variant: "dense" })) : null] })) : !currentRoute ? ((0, jsx_runtime_1.jsx)(SwapRouteCard_1.SwapRouteNotFoundCard, {})) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(SwapRouteCard_1.SwapRouteCard, { minWidth: !onlyRecommendedRoute && routes.length > 1 ? '80%' : '100%', route: currentRoute, variant: "dense", active: true }), !onlyRecommendedRoute && routes.length > 1 ? ((0, jsx_runtime_1.jsx)(SwapRouteCard_1.SwapRouteCard, { minWidth: "80%", route: routes[1], variant: "dense", pointerEvents: "none" })) : null] })) })), (0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ sx: { display: 'flex', alignItems: 'center' } }, { children: !onlyRecommendedRoute && !routeNotFound ? ((0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ py: 1, pr: 1 }, { children: (0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ onClick: handleCardClick, size: "medium", disabled: isValidating || !isValid }, { children: (0, jsx_runtime_1.jsx)(icons_material_1.KeyboardArrowRight, {}) })) }))) : null }))] }))] })));
40
45
  };
41
46
  exports.SwapRoutes = SwapRoutes;
@@ -22,15 +22,16 @@ const TextFitter_1 = require("../TextFitter");
22
22
  const TokenAvatar_1 = require("../TokenAvatar");
23
23
  const Token_style_1 = require("./Token.style");
24
24
  const Token = (_a) => {
25
- var _b;
26
25
  var { token, connected, step } = _a, other = __rest(_a, ["token", "connected", "step"]);
27
26
  const { t } = (0, react_i18next_1.useTranslation)();
28
- const { getChainById } = (0, hooks_1.useChains)();
29
- return ((0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ flex: 1 }, other, { children: [(0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ display: "flex", flex: 1, alignItems: "center" }, { children: [(0, jsx_runtime_1.jsx)(TokenAvatar_1.TokenAvatar, { token: token, sx: { marginRight: 2 } }), (0, jsx_runtime_1.jsx)(TextFitter_1.TextFitter, Object.assign({ height: 30, textStyle: {
27
+ const { chain } = (0, hooks_1.useChain)(token.chainId);
28
+ return ((0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ flex: 1 }, other, { children: [(0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ display: "flex", flex: 1, alignItems: "center" }, { children: [(0, jsx_runtime_1.jsx)(TokenAvatar_1.TokenAvatar, { token: token, chain: chain, sx: { marginRight: 2 } }), (0, jsx_runtime_1.jsx)(TextFitter_1.TextFitter, Object.assign({ height: 30, textStyle: {
30
29
  fontWeight: 700,
31
- } }, { children: (0, utils_1.formatTokenAmount)(token.amount, token.decimals) }))] })), (0, jsx_runtime_1.jsxs)(Token_style_1.TextSecondaryContainer, Object.assign({ connected: connected, component: "span" }, { children: [(0, jsx_runtime_1.jsx)(Token_style_1.TextSecondary, Object.assign({ connected: connected }, { children: t(`swap.tokenOnChain`, {
30
+ } }, { children: t('format.number', {
31
+ value: (0, utils_1.formatTokenAmount)(token.amount, token.decimals),
32
+ }) }))] })), (0, jsx_runtime_1.jsxs)(Token_style_1.TextSecondaryContainer, Object.assign({ connected: connected, component: "span" }, { children: [(0, jsx_runtime_1.jsx)(Token_style_1.TextSecondary, Object.assign({ connected: connected }, { children: t(`swap.tokenOnChain`, {
32
33
  tokenSymbol: token.symbol,
33
- chainName: (_b = getChainById(token.chainId)) === null || _b === void 0 ? void 0 : _b.name,
34
+ chainName: chain === null || chain === void 0 ? void 0 : chain.name,
34
35
  }) })), step ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ fontSize: 12, lineHeight: 1, fontWeight: 500, color: "text.secondary", px: 1, mt: 0.5 }, { children: "\u2022" })), (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ display: "flex", alignItems: "flex-end", height: 12, mt: 0.5 }, { children: [(0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ pr: 0.75 }, { children: (0, jsx_runtime_1.jsx)(SmallAvatar_1.SmallAvatar, Object.assign({ src: step.toolDetails.logoURI, alt: step.toolDetails.name, sx: {
35
36
  border: 0,
36
37
  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
  }>;
@@ -1,13 +1,24 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TokenAvatar = void 0;
3
+ exports.TokenAvatar = exports.TokenAvatarBase = exports.TokenAvatarFallback = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const material_1 = require("@mui/material");
6
6
  const hooks_1 = require("../../hooks");
7
7
  const SmallAvatar_1 = require("../SmallAvatar");
8
- const TokenAvatar = ({ token, sx }) => {
8
+ const TokenAvatarFallback = ({ token, sx }) => {
9
9
  const { chain } = (0, hooks_1.useChain)(token.chainId);
10
10
  const { token: chainToken } = (0, hooks_1.useToken)(token.chainId, token.address);
11
- return ((0, jsx_runtime_1.jsx)(material_1.Badge, Object.assign({ overlap: "circular", anchorOrigin: { vertical: 'bottom', horizontal: 'right' }, badgeContent: chain ? ((0, jsx_runtime_1.jsx)(SmallAvatar_1.SmallAvatar, Object.assign({ src: chain.logoURI, alt: chain.name }, { children: chain.name[0] }))) : null, sx: sx }, { children: (0, jsx_runtime_1.jsx)(material_1.Avatar, Object.assign({ src: token.logoURI || (chainToken === null || chainToken === void 0 ? void 0 : chainToken.logoURI), alt: token.symbol }, { children: token.symbol[0] })) })));
11
+ return (0, jsx_runtime_1.jsx)(exports.TokenAvatarBase, { token: chainToken !== null && chainToken !== void 0 ? chainToken : token, chain: chain, sx: sx });
12
+ };
13
+ exports.TokenAvatarFallback = TokenAvatarFallback;
14
+ const TokenAvatarBase = ({ token, chain, sx }) => {
15
+ return ((0, jsx_runtime_1.jsx)(material_1.Badge, Object.assign({ overlap: "circular", anchorOrigin: { vertical: 'bottom', horizontal: 'right' }, badgeContent: chain ? ((0, jsx_runtime_1.jsx)(SmallAvatar_1.SmallAvatar, Object.assign({ src: chain.logoURI, alt: chain.name }, { children: chain.name[0] }))) : null, sx: sx }, { children: (0, jsx_runtime_1.jsx)(material_1.Avatar, Object.assign({ src: token.logoURI, alt: token.symbol }, { children: token.symbol[0] })) })));
16
+ };
17
+ exports.TokenAvatarBase = TokenAvatarBase;
18
+ const TokenAvatar = ({ token, chain, sx }) => {
19
+ if (!chain || !token.logoURI) {
20
+ return (0, jsx_runtime_1.jsx)(exports.TokenAvatarFallback, { token: token, sx: sx });
21
+ }
22
+ return (0, jsx_runtime_1.jsx)(exports.TokenAvatarBase, { token: token, chain: chain, sx: sx });
12
23
  };
13
24
  exports.TokenAvatar = TokenAvatar;
@@ -8,12 +8,12 @@ const react_hook_form_1 = require("react-hook-form");
8
8
  const hooks_1 = require("../../hooks");
9
9
  const providers_1 = require("../../providers");
10
10
  const TokenNotFound_1 = require("./TokenNotFound");
11
+ const useTokenSelect_1 = require("./useTokenSelect");
11
12
  const VirtualizedTokenList_1 = require("./VirtualizedTokenList");
12
13
  const TokenList = ({ formType, height, onClick, }) => {
13
14
  var _a, _b;
14
15
  const parentRef = (0, react_1.useRef)(null);
15
16
  const { account } = (0, providers_1.useWallet)();
16
- const { setValue, getValues } = (0, react_hook_form_1.useFormContext)();
17
17
  const [selectedChainId] = (0, react_hook_form_1.useWatch)({
18
18
  name: [providers_1.SwapFormKeyHelper.getChainKey(formType)],
19
19
  });
@@ -37,28 +37,7 @@ const TokenList = ({ formType, height, onClick, }) => {
37
37
  : searchedToken
38
38
  ? [searchedToken]
39
39
  : filteredTokens;
40
- const handleTokenClick = (0, react_1.useCallback)((tokenAddress) => {
41
- setValue(providers_1.SwapFormKeyHelper.getTokenKey(formType), tokenAddress, {
42
- shouldTouch: true,
43
- });
44
- // Set chain again to trigger URL builder update
45
- setValue(providers_1.SwapFormKeyHelper.getChainKey(formType), selectedChainId, {
46
- shouldTouch: true,
47
- });
48
- setValue(providers_1.SwapFormKeyHelper.getAmountKey(formType), '');
49
- const oppositeFormType = formType === 'from' ? 'to' : 'from';
50
- const [selectedOppositeToken, selectedOppositeChainId] = getValues([
51
- providers_1.SwapFormKeyHelper.getTokenKey(oppositeFormType),
52
- providers_1.SwapFormKeyHelper.getChainKey(oppositeFormType),
53
- ]);
54
- if (selectedOppositeToken === tokenAddress &&
55
- selectedOppositeChainId === selectedChainId) {
56
- setValue(providers_1.SwapFormKeyHelper.getTokenKey(oppositeFormType), '', {
57
- shouldTouch: true,
58
- });
59
- }
60
- onClick === null || onClick === void 0 ? void 0 : onClick();
61
- }, [formType, getValues, onClick, selectedChainId, setValue]);
40
+ const handleTokenClick = (0, useTokenSelect_1.useTokenSelect)(formType, onClick);
62
41
  return ((0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ ref: parentRef, style: { height, overflow: 'auto' } }, { children: [!tokens.length && !isLoading ? ((0, jsx_runtime_1.jsx)(TokenNotFound_1.TokenNotFound, { formType: formType })) : null, (0, jsx_runtime_1.jsx)(VirtualizedTokenList_1.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 })] })));
63
42
  };
64
43
  exports.TokenList = TokenList;
@@ -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;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TokenAmountSkeleton = exports.TokenListItemSkeleton = exports.TokenListItem = void 0;
3
+ exports.TokenAmountSkeleton = exports.TokenListItemSkeleton = exports.TokenListItemButton = exports.TokenListItem = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const material_1 = require("@mui/material");
6
6
  const react_1 = require("react");
@@ -8,16 +8,22 @@ const react_i18next_1 = require("react-i18next");
8
8
  const utils_1 = require("../../utils");
9
9
  const TokenList_style_1 = require("./TokenList.style");
10
10
  exports.TokenListItem = (0, react_1.memo)(({ onClick, size, start, token, showBalance, isBalanceLoading, startAdornment, endAdornment, }) => {
11
- const { t } = (0, react_i18next_1.useTranslation)();
12
11
  const handleClick = () => onClick === null || onClick === void 0 ? void 0 : onClick(token.address);
13
- const tokenPrice = (0, utils_1.formatTokenPrice)(token.amount, token.priceUSD);
14
12
  return ((0, jsx_runtime_1.jsxs)(TokenList_style_1.ListItem, Object.assign({ disablePadding: true, style: {
15
13
  height: `${size}px`,
16
14
  transform: `translateY(${start}px)`,
17
- } }, { children: [startAdornment, (0, jsx_runtime_1.jsxs)(TokenList_style_1.ListItemButton, Object.assign({ onClick: handleClick, dense: true, disableRipple: true }, { children: [(0, jsx_runtime_1.jsx)(material_1.ListItemAvatar, { children: (0, jsx_runtime_1.jsx)(material_1.Avatar, Object.assign({ src: token.logoURI, alt: token.symbol }, { children: token.symbol[0] })) }), (0, jsx_runtime_1.jsx)(material_1.ListItemText, { primary: token.symbol, secondary: token.name }), showBalance ? (isBalanceLoading ? ((0, jsx_runtime_1.jsx)(exports.TokenAmountSkeleton, {})) : ((0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ sx: { textAlign: 'right' } }, { children: [Number(token.amount) ? ((0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body1", noWrap: true }, { children: token.amount }))) : null, tokenPrice ? ((0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ fontWeight: 400, fontSize: 12, color: "text.secondary", "data-price": token.priceUSD }, { children: t(`swap.currency`, {
18
- value: tokenPrice,
19
- }) }))) : null] })))) : null] })), endAdornment] })));
15
+ } }, { children: [startAdornment, (0, jsx_runtime_1.jsx)(exports.TokenListItemButton, { token: token, showBalance: showBalance, isBalanceLoading: isBalanceLoading, onClick: handleClick }), endAdornment] })));
20
16
  });
17
+ const TokenListItemButton = ({ onClick, token, showBalance, isBalanceLoading, }) => {
18
+ const { t } = (0, react_i18next_1.useTranslation)();
19
+ const tokenPrice = (0, utils_1.formatTokenPrice)(token.amount, token.priceUSD);
20
+ return ((0, jsx_runtime_1.jsxs)(TokenList_style_1.ListItemButton, Object.assign({ onClick: onClick, dense: true, disableRipple: true }, { children: [(0, jsx_runtime_1.jsx)(material_1.ListItemAvatar, { children: (0, jsx_runtime_1.jsx)(material_1.Avatar, Object.assign({ src: token.logoURI, alt: token.symbol }, { children: token.symbol[0] })) }), (0, jsx_runtime_1.jsx)(material_1.ListItemText, { primary: token.symbol, secondary: token.name }), showBalance ? (isBalanceLoading ? ((0, jsx_runtime_1.jsx)(exports.TokenAmountSkeleton, {})) : ((0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ sx: { textAlign: 'right' } }, { children: [Number(token.amount) ? ((0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ variant: "body1", noWrap: true }, { children: t('format.number', {
21
+ value: token.amount,
22
+ }) }))) : null, tokenPrice ? ((0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ fontWeight: 400, fontSize: 12, color: "text.secondary", "data-price": token.priceUSD }, { children: t(`format.currency`, {
23
+ value: tokenPrice,
24
+ }) }))) : null] })))) : null] })));
25
+ };
26
+ exports.TokenListItemButton = TokenListItemButton;
21
27
  const TokenListItemSkeleton = () => {
22
28
  return ((0, jsx_runtime_1.jsxs)(TokenList_style_1.ListItem, Object.assign({ secondaryAction: (0, jsx_runtime_1.jsx)(exports.TokenAmountSkeleton, {}), disablePadding: true, sx: { position: 'relative', flexDirection: 'row', alignItems: 'center' } }, { children: [(0, jsx_runtime_1.jsx)(material_1.ListItemAvatar, { children: (0, jsx_runtime_1.jsx)(material_1.Skeleton, { variant: "circular", width: 32, height: 32, sx: { marginLeft: 1.5, marginRight: 2 } }) }), (0, jsx_runtime_1.jsx)(material_1.ListItemText, { primary: (0, jsx_runtime_1.jsx)(material_1.Skeleton, { variant: "text", width: 48, height: 20 }), secondary: (0, jsx_runtime_1.jsx)(material_1.Skeleton, { variant: "text", width: 96, height: 20 }) })] })));
23
29
  };
@@ -1 +1,2 @@
1
1
  export * from './TokenList';
2
+ export * from './useTokenSelect';
@@ -15,3 +15,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./TokenList"), exports);
18
+ __exportStar(require("./useTokenSelect"), exports);
@@ -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,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useTokenSelect = void 0;
4
+ const react_1 = require("react");
5
+ const react_hook_form_1 = require("react-hook-form");
6
+ const providers_1 = require("../../providers");
7
+ const useTokenSelect = (formType, onClick) => {
8
+ const { setValue, getValues } = (0, react_hook_form_1.useFormContext)();
9
+ return (0, react_1.useCallback)((tokenAddress, chainId) => {
10
+ const selectedChainId = chainId !== null && chainId !== void 0 ? chainId : getValues(providers_1.SwapFormKeyHelper.getChainKey(formType));
11
+ setValue(providers_1.SwapFormKeyHelper.getTokenKey(formType), tokenAddress, {
12
+ shouldTouch: true,
13
+ });
14
+ // Set chain again to trigger URL builder update
15
+ setValue(providers_1.SwapFormKeyHelper.getChainKey(formType), selectedChainId, {
16
+ shouldTouch: true,
17
+ });
18
+ setValue(providers_1.SwapFormKeyHelper.getAmountKey(formType), '');
19
+ const oppositeFormType = formType === 'from' ? 'to' : 'from';
20
+ const [selectedOppositeToken, selectedOppositeChainId] = getValues([
21
+ providers_1.SwapFormKeyHelper.getTokenKey(oppositeFormType),
22
+ providers_1.SwapFormKeyHelper.getChainKey(oppositeFormType),
23
+ ]);
24
+ if (selectedOppositeToken === tokenAddress &&
25
+ selectedOppositeChainId === selectedChainId) {
26
+ setValue(providers_1.SwapFormKeyHelper.getTokenKey(oppositeFormType), '', {
27
+ shouldTouch: true,
28
+ });
29
+ }
30
+ onClick === null || onClick === void 0 ? void 0 : onClick();
31
+ }, [formType, getValues, onClick, setValue]);
32
+ };
33
+ exports.useTokenSelect = useTokenSelect;
@@ -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";
@@ -2,4 +2,4 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.version = exports.name = void 0;
4
4
  exports.name = '@lifi/widget';
5
- exports.version = '1.21.0';
5
+ exports.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
  };
@@ -5,10 +5,8 @@ const material_1 = require("@mui/material");
5
5
  const providers_1 = require("../providers");
6
6
  const defaultExpandableWidth = 852;
7
7
  const useExpandableVariant = () => {
8
- const { variant } = (0, providers_1.useWidgetConfig)();
9
- const expandableAllowed = (0, material_1.useMediaQuery)((theme) => {
10
- return theme.breakpoints.up(defaultExpandableWidth);
11
- });
12
- return variant === 'expandable' && expandableAllowed;
8
+ const { variant, useRecommendedRoute } = (0, providers_1.useWidgetConfig)();
9
+ const expandableAllowed = (0, material_1.useMediaQuery)((theme) => theme.breakpoints.up(defaultExpandableWidth));
10
+ return variant === 'expandable' && expandableAllowed && !useRecommendedRoute;
13
11
  };
14
12
  exports.useExpandableVariant = useExpandableVariant;