@funkit/connect 12.12.0 → 12.12.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 (46) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/clients/internal/nado/withdrawalCallback.js +2 -2
  3. package/dist/clients/nado.js +2 -2
  4. package/dist/index.js +356 -289
  5. package/dist/modals/CheckoutModal/isSourceChangeLike.d.ts +3 -0
  6. package/dist/modals/ProfileDetails/FunProfileViews/Home/index.d.ts +3 -0
  7. package/dist/providers/FunkitQuoteContext.d.ts +2 -1
  8. package/dist/wallets/walletConnectors/bifrostWallet/bifrostWallet.js +2 -2
  9. package/dist/wallets/walletConnectors/bitgetWallet/bitgetWallet.js +2 -2
  10. package/dist/wallets/walletConnectors/bybitWallet/bybitWallet.js +2 -2
  11. package/dist/wallets/walletConnectors/clvWallet/clvWallet.js +2 -2
  12. package/dist/wallets/walletConnectors/coin98Wallet/coin98Wallet.js +2 -2
  13. package/dist/wallets/walletConnectors/coreWallet/coreWallet.js +2 -2
  14. package/dist/wallets/walletConnectors/foxWallet/foxWallet.js +2 -2
  15. package/dist/wallets/walletConnectors/frontierWallet/frontierWallet.js +2 -2
  16. package/dist/wallets/walletConnectors/gateWallet/gateWallet.js +2 -2
  17. package/dist/wallets/walletConnectors/index.js +45 -45
  18. package/dist/wallets/walletConnectors/metaMaskWallet/metaMaskWallet.js +2 -2
  19. package/dist/wallets/walletConnectors/okxWallet/okxWallet.js +2 -2
  20. package/dist/wallets/walletConnectors/rainbowWallet/rainbowWallet.js +2 -2
  21. package/dist/wallets/walletConnectors/roninWallet/roninWallet.js +2 -2
  22. package/dist/wallets/walletConnectors/safepalWallet/safepalWallet.js +2 -2
  23. package/dist/wallets/walletConnectors/subWallet/subWallet.js +2 -2
  24. package/dist/wallets/walletConnectors/tokenPocketWallet/tokenPocketWallet.js +2 -2
  25. package/dist/wallets/walletConnectors/trustWallet/trustWallet.js +2 -2
  26. package/dist/wallets/walletConnectors/zerionWallet/zerionWallet.js +2 -2
  27. package/package.json +5 -5
  28. package/dist/clients/{chunk-PK7BKCPR.js → chunk-JDQK4VQB.js} +3 -3
  29. package/dist/wallets/walletConnectors/{chunk-OVDCDVFX.js → chunk-34B7OJNT.js} +3 -3
  30. package/dist/wallets/walletConnectors/{chunk-JJBLW4IU.js → chunk-4FHNLTR3.js} +3 -3
  31. package/dist/wallets/walletConnectors/{chunk-TM7UBV3Q.js → chunk-ALGPGI6V.js} +3 -3
  32. package/dist/wallets/walletConnectors/{chunk-MWB6LFSG.js → chunk-BBB2J3US.js} +3 -3
  33. package/dist/wallets/walletConnectors/{chunk-IWPW26AL.js → chunk-BBDNB5TQ.js} +3 -3
  34. package/dist/wallets/walletConnectors/{chunk-53MYTA42.js → chunk-CU5J53XR.js} +3 -3
  35. package/dist/wallets/walletConnectors/{chunk-USLZMUJ3.js → chunk-HOCKAU5H.js} +3 -3
  36. package/dist/wallets/walletConnectors/{chunk-RJF2YEZ5.js → chunk-IA5432IR.js} +3 -3
  37. package/dist/wallets/walletConnectors/{chunk-ASTCNVJC.js → chunk-IWOMSW64.js} +3 -3
  38. package/dist/wallets/walletConnectors/{chunk-KE4CWI3A.js → chunk-NXWG6FG2.js} +3 -3
  39. package/dist/wallets/walletConnectors/{chunk-RQYEGJKL.js → chunk-RFCZYLNR.js} +3 -3
  40. package/dist/wallets/walletConnectors/{chunk-ANODOMIN.js → chunk-RXRYHMRI.js} +3 -3
  41. package/dist/wallets/walletConnectors/{chunk-PPQ6L4K2.js → chunk-SR5CZR3L.js} +3 -3
  42. package/dist/wallets/walletConnectors/{chunk-TIHTQ3OB.js → chunk-TRZDAXCQ.js} +3 -3
  43. package/dist/wallets/walletConnectors/{chunk-F45CUFRR.js → chunk-U52QO5HF.js} +3 -3
  44. package/dist/wallets/walletConnectors/{chunk-A5POD5SV.js → chunk-XODA5ESL.js} +3 -3
  45. package/dist/wallets/walletConnectors/{chunk-FYPQ3HP4.js → chunk-YRMBR6NA.js} +3 -3
  46. package/dist/wallets/walletConnectors/{chunk-65ULY6OC.js → chunk-ZSSSLFQF.js} +3 -3
package/dist/index.js CHANGED
@@ -113,7 +113,7 @@ function setFunkitConnectVersion({ version }) {
113
113
  localStorage.setItem(storageKey, version);
114
114
  }
115
115
  function getCurrentSdkVersion() {
116
- return "12.12.0";
116
+ return "12.12.1";
117
117
  }
118
118
  function useFingerprint() {
119
119
  const fingerprint = useCallback(() => {
@@ -16048,21 +16048,6 @@ var FunInput = forwardRef4(function FunInputWithRef({
16048
16048
  };
16049
16049
  const isFocused = alwaysFocused || focused;
16050
16050
  const isValidDecimalColor = !!decimalsColor && activeTheme.colors?.[decimalsColor] !== "none";
16051
- const getBorderColor2 = () => {
16052
- if (error) {
16053
- return { base: "error" };
16054
- }
16055
- if (inputProps.disabled) {
16056
- return { base: "inputBorderBase" };
16057
- }
16058
- if (isFocused) {
16059
- return { base: "secondaryText" };
16060
- }
16061
- return {
16062
- base: "inputBorderBase",
16063
- hover: "inputBorderHover"
16064
- };
16065
- };
16066
16051
  const textareaRef = React73.useRef(null);
16067
16052
  useEffect28(() => {
16068
16053
  if (allowMultiline) {
@@ -16102,7 +16087,7 @@ var FunInput = forwardRef4(function FunInputWithRef({
16102
16087
  e.currentTarget.blur();
16103
16088
  },
16104
16089
  className: clsx11(
16105
- error ? ignoreBaseTransitions ? inputClassErrorNoTransition : inputClassError : inputProps.disabled ? ignoreBaseTransitions ? inputClassDisabledNoTransition : inputClassDisabled : ignoreBaseTransitions ? inputClassNoTransition : inputClass,
16090
+ getInputClassName(error, inputProps, ignoreBaseTransitions),
16106
16091
  numberInputResetStyle,
16107
16092
  inputClassName
16108
16093
  ),
@@ -16165,28 +16150,15 @@ var FunInput = forwardRef4(function FunInputWithRef({
16165
16150
  }
16166
16151
  );
16167
16152
  if (shouldColorDecimals) {
16168
- return /* @__PURE__ */ React73.createElement(Box, { style: { position: "relative", display: "flex", flex: 1 } }, /* @__PURE__ */ React73.createElement(
16169
- Box,
16153
+ return /* @__PURE__ */ React73.createElement(
16154
+ DecimalOverlay,
16170
16155
  {
16171
- color: "primaryText",
16172
- style: {
16173
- position: "absolute",
16174
- left: 0,
16175
- top: 0,
16176
- pointerEvents: "none",
16177
- fontFamily: "inherit",
16178
- fontSize: "inherit",
16179
- fontWeight: "inherit",
16180
- lineHeight: "inherit",
16181
- whiteSpace: "nowrap",
16182
- display: "flex",
16183
- alignItems: "center",
16184
- height: "100%"
16185
- }
16156
+ integerPart,
16157
+ decimalPart,
16158
+ decimalsColor
16186
16159
  },
16187
- /* @__PURE__ */ React73.createElement("span", { style: { color: "inherit" } }, integerPart),
16188
- /* @__PURE__ */ React73.createElement(DecimalSpan, { decimalsColor }, decimalPart)
16189
- ), inputElement);
16160
+ inputElement
16161
+ );
16190
16162
  }
16191
16163
  return inputElement;
16192
16164
  };
@@ -16210,7 +16182,7 @@ var FunInput = forwardRef4(function FunInputWithRef({
16210
16182
  display: "flex",
16211
16183
  alignItems: allowMultiline ? "flex-start" : "center",
16212
16184
  color: adornmentColor,
16213
- borderColor: getBorderColor2(),
16185
+ borderColor: getBorderColor2(error, inputProps, isFocused),
16214
16186
  borderWidth: overrideBorderWidth ?? "1",
16215
16187
  borderStyle: "solid",
16216
16188
  fontSize: ignoreFontSize ? "inherit" : "inputValue",
@@ -16221,33 +16193,15 @@ var FunInput = forwardRef4(function FunInputWithRef({
16221
16193
  hover: "inputBackgroundHover"
16222
16194
  }
16223
16195
  },
16224
- prefix && /* @__PURE__ */ React73.createElement(
16225
- Box,
16226
- {
16227
- display: "flex",
16228
- alignItems: "center",
16229
- paddingLeft: "12",
16230
- height: "max"
16231
- },
16232
- prefix
16233
- ),
16234
- prefixIcon === "SearchIcon" && /* @__PURE__ */ React73.createElement(
16235
- Box,
16236
- {
16237
- display: "flex",
16238
- paddingLeft: "12",
16239
- height: "max",
16240
- alignItems: "center",
16241
- color: isFocused ? "primaryText" : "secondaryText"
16242
- },
16243
- /* @__PURE__ */ React73.createElement(SearchIcon, null)
16244
- ),
16245
- prefixIcon === "$" && /* @__PURE__ */ React73.createElement(Box, { display: "flex", alignItems: "center", paddingLeft: "32" }, /* @__PURE__ */ React73.createElement(
16246
- DollarTextIcon,
16196
+ /* @__PURE__ */ React73.createElement(
16197
+ PrefixAdornments,
16247
16198
  {
16248
- fontSize: inputStyle.fontSize || DEFAULT_ICON_FONT_SIZE
16199
+ prefix,
16200
+ prefixIcon,
16201
+ isFocused,
16202
+ inputStyle
16249
16203
  }
16250
- )),
16204
+ ),
16251
16205
  renderInputOrTextarea(),
16252
16206
  suffix && /* @__PURE__ */ React73.createElement(
16253
16207
  Box,
@@ -16269,6 +16223,70 @@ var FunInput = forwardRef4(function FunInputWithRef({
16269
16223
  error && typeof error === "string" && /* @__PURE__ */ React73.createElement(Text, { color: "error", size: "10" }, error)
16270
16224
  );
16271
16225
  });
16226
+ var getBorderColor2 = (error, inputProps, isFocused) => {
16227
+ if (error) {
16228
+ return { base: "error" };
16229
+ }
16230
+ if (inputProps.disabled) {
16231
+ return { base: "inputBorderBase" };
16232
+ }
16233
+ if (isFocused) {
16234
+ return { base: "secondaryText" };
16235
+ }
16236
+ return {
16237
+ base: "inputBorderBase",
16238
+ hover: "inputBorderHover"
16239
+ };
16240
+ };
16241
+ var getInputClassName = (error, inputProps, ignoreBaseTransitions) => error ? ignoreBaseTransitions ? inputClassErrorNoTransition : inputClassError : inputProps.disabled ? ignoreBaseTransitions ? inputClassDisabledNoTransition : inputClassDisabled : ignoreBaseTransitions ? inputClassNoTransition : inputClass;
16242
+ var PrefixAdornments = ({
16243
+ prefix,
16244
+ prefixIcon,
16245
+ isFocused,
16246
+ inputStyle
16247
+ }) => /* @__PURE__ */ React73.createElement(React73.Fragment, null, prefix && /* @__PURE__ */ React73.createElement(Box, { display: "flex", alignItems: "center", paddingLeft: "12", height: "max" }, prefix), prefixIcon === "SearchIcon" && /* @__PURE__ */ React73.createElement(
16248
+ Box,
16249
+ {
16250
+ display: "flex",
16251
+ paddingLeft: "12",
16252
+ height: "max",
16253
+ alignItems: "center",
16254
+ color: isFocused ? "primaryText" : "secondaryText"
16255
+ },
16256
+ /* @__PURE__ */ React73.createElement(SearchIcon, null)
16257
+ ), prefixIcon === "$" && /* @__PURE__ */ React73.createElement(Box, { display: "flex", alignItems: "center", paddingLeft: "32" }, /* @__PURE__ */ React73.createElement(
16258
+ DollarTextIcon,
16259
+ {
16260
+ fontSize: inputStyle.fontSize || DEFAULT_ICON_FONT_SIZE
16261
+ }
16262
+ )));
16263
+ var DecimalOverlay = ({
16264
+ integerPart,
16265
+ decimalPart,
16266
+ decimalsColor,
16267
+ children
16268
+ }) => /* @__PURE__ */ React73.createElement(Box, { style: { position: "relative", display: "flex", flex: 1 } }, /* @__PURE__ */ React73.createElement(
16269
+ Box,
16270
+ {
16271
+ color: "primaryText",
16272
+ style: {
16273
+ position: "absolute",
16274
+ left: 0,
16275
+ top: 0,
16276
+ pointerEvents: "none",
16277
+ fontFamily: "inherit",
16278
+ fontSize: "inherit",
16279
+ fontWeight: "inherit",
16280
+ lineHeight: "inherit",
16281
+ whiteSpace: "nowrap",
16282
+ display: "flex",
16283
+ alignItems: "center",
16284
+ height: "100%"
16285
+ }
16286
+ },
16287
+ /* @__PURE__ */ React73.createElement("span", { style: { color: "inherit" } }, integerPart),
16288
+ /* @__PURE__ */ React73.createElement(DecimalSpan, { decimalsColor }, decimalPart)
16289
+ ), children);
16272
16290
  var adjustTextareaHeight = (textarea) => {
16273
16291
  if (textarea) {
16274
16292
  textarea.style.height = "auto";
@@ -24174,77 +24192,14 @@ function BaseDropdown({
24174
24192
  prefixIcon: "SearchIcon"
24175
24193
  }
24176
24194
  )), organizedOptions.length === 0 ? /* @__PURE__ */ React135.createElement(FunNoResults, { text: t("common.noResultsFound") }) : /* @__PURE__ */ React135.createElement(
24177
- Box,
24195
+ DropdownOptionList,
24178
24196
  {
24179
- as: "ul",
24180
- display: "flex",
24181
- flexDirection: "column",
24182
- paddingY: size === "compact" ? "dropdownCompactPaddingY" : "dropdownPaddingY"
24183
- },
24184
- organizedGroups.map(
24185
- ({
24186
- key: groupKey,
24187
- label: groupLabel,
24188
- options: optionsInGroup
24189
- }, groupIndex) => /* @__PURE__ */ React135.createElement(React135.Fragment, { key: groupKey }, groupIndex > 0 && /* @__PURE__ */ React135.createElement(
24190
- Box,
24191
- {
24192
- height: "1",
24193
- background: "lightStroke",
24194
- marginY: "dropdownGroupDividerMarginY"
24195
- }
24196
- ), groupLabel && /* @__PURE__ */ React135.createElement(
24197
- Box,
24198
- {
24199
- paddingX: size === "compact" ? "dropdownCompactPaddingX" : "dropdownPaddingX"
24200
- },
24201
- /* @__PURE__ */ React135.createElement(
24202
- Box,
24203
- {
24204
- paddingX: "dropdownItemPaddingX",
24205
- paddingY: "dropdownItemPaddingY"
24206
- },
24207
- /* @__PURE__ */ React135.createElement(
24208
- Text,
24209
- {
24210
- color: "dropdownGroupHeader",
24211
- font: "dropdownGroupHeader",
24212
- size: "dropdownGroupHeader",
24213
- weight: "dropdownGroupHeader"
24214
- },
24215
- groupLabel
24216
- )
24217
- )
24218
- ), optionsInGroup.map((singleOption) => {
24219
- const isSelected = singleOption.value === selectedOption?.value;
24220
- return /* @__PURE__ */ React135.createElement(
24221
- Box,
24222
- {
24223
- key: singleOption.value,
24224
- paddingX: size === "compact" ? "dropdownCompactPaddingX" : "dropdownPaddingX"
24225
- },
24226
- /* @__PURE__ */ React135.createElement(
24227
- Box,
24228
- {
24229
- id: `${singleOption.value}-dropdown-item`,
24230
- as: "li",
24231
- background: {
24232
- base: isSelected ? "selectedDropdownItemBackground" : "transparent",
24233
- hover: "offBackground"
24234
- },
24235
- className: baseDropdownItemWrapperStyles,
24236
- onClick: () => {
24237
- onOptionSelected?.(singleOption);
24238
- }
24239
- },
24240
- renderDropdownOption(
24241
- singleOption,
24242
- isSelected
24243
- )
24244
- )
24245
- );
24246
- }))
24247
- )
24197
+ organizedGroups,
24198
+ size,
24199
+ selectedOption,
24200
+ onOptionSelected,
24201
+ renderDropdownOption
24202
+ }
24248
24203
  ))
24249
24204
  )
24250
24205
  ))
@@ -24261,6 +24216,80 @@ function BaseDropdown({
24261
24216
  )
24262
24217
  ));
24263
24218
  }
24219
+ function DropdownOptionList({
24220
+ organizedGroups,
24221
+ size,
24222
+ selectedOption,
24223
+ onOptionSelected,
24224
+ renderDropdownOption
24225
+ }) {
24226
+ return /* @__PURE__ */ React135.createElement(
24227
+ Box,
24228
+ {
24229
+ as: "ul",
24230
+ display: "flex",
24231
+ flexDirection: "column",
24232
+ paddingY: size === "compact" ? "dropdownCompactPaddingY" : "dropdownPaddingY"
24233
+ },
24234
+ organizedGroups.map(
24235
+ ({ key: groupKey, label: groupLabel, options: optionsInGroup }, groupIndex) => /* @__PURE__ */ React135.createElement(React135.Fragment, { key: groupKey }, groupIndex > 0 && /* @__PURE__ */ React135.createElement(
24236
+ Box,
24237
+ {
24238
+ height: "1",
24239
+ background: "lightStroke",
24240
+ marginY: "dropdownGroupDividerMarginY"
24241
+ }
24242
+ ), groupLabel && /* @__PURE__ */ React135.createElement(
24243
+ Box,
24244
+ {
24245
+ paddingX: size === "compact" ? "dropdownCompactPaddingX" : "dropdownPaddingX"
24246
+ },
24247
+ /* @__PURE__ */ React135.createElement(
24248
+ Box,
24249
+ {
24250
+ paddingX: "dropdownItemPaddingX",
24251
+ paddingY: "dropdownItemPaddingY"
24252
+ },
24253
+ /* @__PURE__ */ React135.createElement(
24254
+ Text,
24255
+ {
24256
+ color: "dropdownGroupHeader",
24257
+ font: "dropdownGroupHeader",
24258
+ size: "dropdownGroupHeader",
24259
+ weight: "dropdownGroupHeader"
24260
+ },
24261
+ groupLabel
24262
+ )
24263
+ )
24264
+ ), optionsInGroup.map((singleOption) => {
24265
+ const isSelected = singleOption.value === selectedOption?.value;
24266
+ return /* @__PURE__ */ React135.createElement(
24267
+ Box,
24268
+ {
24269
+ key: singleOption.value,
24270
+ paddingX: size === "compact" ? "dropdownCompactPaddingX" : "dropdownPaddingX"
24271
+ },
24272
+ /* @__PURE__ */ React135.createElement(
24273
+ Box,
24274
+ {
24275
+ id: `${singleOption.value}-dropdown-item`,
24276
+ as: "li",
24277
+ background: {
24278
+ base: isSelected ? "selectedDropdownItemBackground" : "transparent",
24279
+ hover: "offBackground"
24280
+ },
24281
+ className: baseDropdownItemWrapperStyles,
24282
+ onClick: () => {
24283
+ onOptionSelected?.(singleOption);
24284
+ }
24285
+ },
24286
+ renderDropdownOption(singleOption, isSelected)
24287
+ )
24288
+ );
24289
+ }))
24290
+ )
24291
+ );
24292
+ }
24264
24293
  var BaseDropdown_default = BaseDropdown;
24265
24294
 
24266
24295
  // src/components/Dropdown/BaseDropdownItem.tsx
@@ -25974,6 +26003,15 @@ function getRecipientAddressPlaceholder(selectedChainId, t) {
25974
26003
  return "0x...";
25975
26004
  }
25976
26005
  var MIN_RECIPIENT_ADDRESS_FONT_SIZE = 8;
26006
+ function getConnectedAddressInputStyle(connectedAddressFontSize) {
26007
+ return {
26008
+ fontSize: connectedAddressFontSize === void 0 ? void 0 : `${connectedAddressFontSize}px`,
26009
+ lineHeight: "16px",
26010
+ textOverflow: "ellipsis",
26011
+ overflow: "hidden",
26012
+ whiteSpace: "nowrap"
26013
+ };
26014
+ }
25977
26015
  function WithdrawRecipientAddress({
25978
26016
  config,
25979
26017
  recipientAddress,
@@ -26079,13 +26117,7 @@ function WithdrawRecipientAddress({
26079
26117
  allowMultiline: !isShowingConnectedAddress,
26080
26118
  borderRadius: "withdrawalInput",
26081
26119
  inputProps: { spellCheck: false },
26082
- inputStyle: isShowingConnectedAddress ? {
26083
- fontSize: connectedAddressFontSize === void 0 ? void 0 : `${connectedAddressFontSize}px`,
26084
- lineHeight: "16px",
26085
- textOverflow: "ellipsis",
26086
- overflow: "hidden",
26087
- whiteSpace: "nowrap"
26088
- } : void 0,
26120
+ inputStyle: isShowingConnectedAddress ? getConnectedAddressInputStyle(connectedAddressFontSize) : void 0,
26089
26121
  value: recipientAddress,
26090
26122
  onChange: handleAddressChange,
26091
26123
  onFocus: () => {
@@ -31278,6 +31310,37 @@ var EmptyTabAlert = () => {
31278
31310
  }
31279
31311
  ));
31280
31312
  };
31313
+ function groupCheckoutsByDay(checkouts) {
31314
+ const segmentedCheckoutHistoryListByDays = Object.entries(
31315
+ checkouts.reduce(
31316
+ (acc, checkoutHistoryItem) => {
31317
+ const date = new Date(checkoutHistoryItem.createdTimeMs);
31318
+ const dateKey = `${date.getFullYear()}-${fullMonthNames[date.getMonth()]}-${date.getDate()}`;
31319
+ if (!acc[dateKey]) {
31320
+ acc[dateKey] = [];
31321
+ }
31322
+ acc[dateKey].push(checkoutHistoryItem);
31323
+ return acc;
31324
+ },
31325
+ {}
31326
+ )
31327
+ );
31328
+ segmentedCheckoutHistoryListByDays.sort(
31329
+ ([dateKeyA], [dateKeyB]) => new Date(dateKeyB).getTime() - new Date(dateKeyA).getTime()
31330
+ );
31331
+ const hasMultipleYearsOfCheckoutData = segmentedCheckoutHistoryListByDays.some(([dateKey]) => {
31332
+ return new Date(dateKey).getFullYear() !== (/* @__PURE__ */ new Date()).getFullYear();
31333
+ });
31334
+ return segmentedCheckoutHistoryListByDays.map(
31335
+ ([dateKey, dayCheckouts]) => [
31336
+ formatTimestampToDate(new Date(dateKey), {
31337
+ year: hasMultipleYearsOfCheckoutData ? "full" : "none",
31338
+ month: "short"
31339
+ }),
31340
+ dayCheckouts
31341
+ ]
31342
+ );
31343
+ }
31281
31344
  function Home({
31282
31345
  onClose,
31283
31346
  onChangeView,
@@ -31338,26 +31401,6 @@ function Home({
31338
31401
  const nonProcessingCheckouts = checkoutHistoryList.filter(
31339
31402
  (checkoutHistoryItem) => !IN_PROGRESS_CHECKOUT_STATES2.includes(checkoutHistoryItem.state)
31340
31403
  );
31341
- const segmentedCheckoutHistoryListByDays = Object.entries(
31342
- nonProcessingCheckouts.reduce(
31343
- (acc, checkoutHistoryItem) => {
31344
- const date = new Date(checkoutHistoryItem.createdTimeMs);
31345
- const dateKey = `${date.getFullYear()}-${fullMonthNames[date.getMonth()]}-${date.getDate()}`;
31346
- if (!acc[dateKey]) {
31347
- acc[dateKey] = [];
31348
- }
31349
- acc[dateKey].push(checkoutHistoryItem);
31350
- return acc;
31351
- },
31352
- {}
31353
- )
31354
- );
31355
- segmentedCheckoutHistoryListByDays.sort(
31356
- ([dateKeyA], [dateKeyB]) => new Date(dateKeyB).getTime() - new Date(dateKeyA).getTime()
31357
- );
31358
- const hasMultipleYearsOfCheckoutData = segmentedCheckoutHistoryListByDays.some(([dateKey]) => {
31359
- return new Date(dateKey).getFullYear() !== (/* @__PURE__ */ new Date()).getFullYear();
31360
- });
31361
31404
  const handleCheckoutSelect = (checkoutId, initialPage) => {
31362
31405
  checkoutsListRef.current?.getState((scrollState) => {
31363
31406
  onSelectActivity({
@@ -31371,15 +31414,7 @@ function Home({
31371
31414
  });
31372
31415
  });
31373
31416
  };
31374
- const groups = segmentedCheckoutHistoryListByDays.map(
31375
- ([dateKey, checkouts]) => [
31376
- formatTimestampToDate(new Date(dateKey), {
31377
- year: hasMultipleYearsOfCheckoutData ? "full" : "none",
31378
- month: "short"
31379
- }),
31380
- checkouts
31381
- ]
31382
- );
31417
+ const groups = groupCheckoutsByDay(nonProcessingCheckouts);
31383
31418
  if (processingCheckouts.length > 0) {
31384
31419
  groups.unshift([t("checkoutHistory.processing"), processingCheckouts]);
31385
31420
  }
@@ -33679,6 +33714,84 @@ function shouldShowApprovalMethodToggle({
33679
33714
  }
33680
33715
  return isPermitToggleGateOn;
33681
33716
  }
33717
+ function getIsAaveNativeSupplyFlow(checkoutItem, apiKey) {
33718
+ const sourceAssetInfo = checkoutItem?.selectedSourceAssetInfo;
33719
+ return checkoutItem != null && sourceAssetInfo?.address != null && isAaveNativeSupplyContext({
33720
+ apiKey,
33721
+ sourceAsset: {
33722
+ chainId: sourceAssetInfo.chainId,
33723
+ address: sourceAssetInfo.address
33724
+ },
33725
+ checkoutConfig: checkoutItem.initSettings.config
33726
+ });
33727
+ }
33728
+ function assertCheckedAmountWithinLimits(checkedAmount, t) {
33729
+ const QUOTE_CUSTOM_ERROR_DISPLAY_INFO = getQuoteCustomErrorDisplayInfo(t);
33730
+ if (checkedAmount.isAboveMaximum) {
33731
+ throw new Error(
33732
+ QUOTE_CUSTOM_ERROR_DISPLAY_INFO[2 /* INSUFFICIENT_BALANCE_POST_CHECK */].check
33733
+ );
33734
+ }
33735
+ if (checkedAmount.isBelowMinimum) {
33736
+ throw new Error(
33737
+ QUOTE_CUSTOM_ERROR_DISPLAY_INFO[3 /* INSUFFICIENT_AMOUNT_POST_CHECK */].check
33738
+ );
33739
+ }
33740
+ }
33741
+ function getProviderQuoteStepMessage(paymentMethodInfo, loginType, t) {
33742
+ const PENDING_QUOTE_MESSAGE_GENERATOR = getPendingQuoteMessageGenerator(t);
33743
+ return paymentMethodInfo.paymentMethod === PaymentMethod.ACCOUNT_BALANCE && loginType === "web3" /* Web3 */ ? PENDING_QUOTE_MESSAGE_GENERATOR[2 /* ESTIMATING_GAS */]() : PENDING_QUOTE_MESSAGE_GENERATOR[1 /* VERIFYING_PROVIDER */](
33744
+ paymentMethodInfo.title
33745
+ );
33746
+ }
33747
+ function getQuoteErrorResponse(error, checkedAmount, newCheckoutItem, quoteState) {
33748
+ if (checkedAmount?.isAboveMaximum) {
33749
+ const { maxTargetAssetAmount, minTargetAssetAmount } = checkedAmount;
33750
+ return {
33751
+ error: {
33752
+ maxTargetAssetAmount,
33753
+ minTargetAssetAmount,
33754
+ reason: "insufficientBalance"
33755
+ },
33756
+ shellCheckoutItemWithNextQuote: newCheckoutItem,
33757
+ quoteState,
33758
+ success: false
33759
+ };
33760
+ }
33761
+ if (checkedAmount?.isBelowMinimum) {
33762
+ const { maxTargetAssetAmount, minTargetAssetAmount } = checkedAmount;
33763
+ return {
33764
+ error: {
33765
+ maxTargetAssetAmount,
33766
+ minTargetAssetAmount,
33767
+ reason: "insufficientAmount"
33768
+ },
33769
+ shellCheckoutItemWithNextQuote: newCheckoutItem,
33770
+ quoteState,
33771
+ success: false
33772
+ };
33773
+ }
33774
+ const insufficientAmountMatch = error.message.match(
33775
+ /target token must be at least \$(\d+(\.\d+)?)/i
33776
+ );
33777
+ if (insufficientAmountMatch?.[1]) {
33778
+ return {
33779
+ error: {
33780
+ minTargetUsdAmount: Number.parseFloat(insufficientAmountMatch[1]),
33781
+ reason: "insufficientAmount"
33782
+ },
33783
+ shellCheckoutItemWithNextQuote: newCheckoutItem,
33784
+ quoteState,
33785
+ success: false
33786
+ };
33787
+ }
33788
+ return {
33789
+ error: { originalError: error, reason: "internal" },
33790
+ shellCheckoutItemWithNextQuote: newCheckoutItem,
33791
+ quoteState,
33792
+ success: false
33793
+ };
33794
+ }
33682
33795
  function FunkitQuoteProvider({ children }) {
33683
33796
  const { t } = useFunkitTranslation();
33684
33797
  const { logMeasuredEvent, startMeasuredEvent } = useTrack();
@@ -33701,15 +33814,10 @@ function FunkitQuoteProvider({ children }) {
33701
33814
  const paymentMethod = checkoutItem?.selectedPaymentMethodInfo?.paymentMethod;
33702
33815
  const supplyAmountBaseUnits = checkoutItem?.inputTokenAmountBaseUnits ?? null;
33703
33816
  const targetAssetAllowanceCoversAmount = targetAssetPoolAllowance !== void 0 && supplyAmountBaseUnits !== null && supplyAmountBaseUnits > 0n && targetAssetPoolAllowance >= supplyAmountBaseUnits;
33704
- const sourceAssetInfo = checkoutItem?.selectedSourceAssetInfo;
33705
- const isAaveNativeSupplyFlow = checkoutItem != null && sourceAssetInfo?.address != null && isAaveNativeSupplyContext({
33706
- apiKey: funkitConfig.apiKey,
33707
- sourceAsset: {
33708
- chainId: sourceAssetInfo.chainId,
33709
- address: sourceAssetInfo.address
33710
- },
33711
- checkoutConfig: checkoutItem.initSettings.config
33712
- });
33817
+ const isAaveNativeSupplyFlow = getIsAaveNativeSupplyFlow(
33818
+ checkoutItem,
33819
+ funkitConfig.apiKey
33820
+ );
33713
33821
  const showApprovalMethodToggle = shouldShowApprovalMethodToggle({
33714
33822
  isPermitToggleGateOn,
33715
33823
  isAccountBalancePayment: paymentMethod === PaymentMethod.ACCOUNT_BALANCE,
@@ -33788,9 +33896,8 @@ function FunkitQuoteProvider({ children }) {
33788
33896
  );
33789
33897
  logMeasuredEvent(baseQuoteEvent);
33790
33898
  if (!disableInformationStreaming) {
33791
- const PENDING_QUOTE_MESSAGE_GENERATOR2 = getPendingQuoteMessageGenerator(t);
33792
33899
  setQuoteStepMessage(
33793
- paymentMethodInfo.paymentMethod === PaymentMethod.ACCOUNT_BALANCE && loginType === "web3" /* Web3 */ ? PENDING_QUOTE_MESSAGE_GENERATOR2[2 /* ESTIMATING_GAS */]() : PENDING_QUOTE_MESSAGE_GENERATOR2[1 /* VERIFYING_PROVIDER */](paymentMethodInfo.title)
33900
+ getProviderQuoteStepMessage(paymentMethodInfo, loginType, t)
33794
33901
  );
33795
33902
  }
33796
33903
  const newFinalDollarValue = baseQuote.estSubtotalUsd;
@@ -33830,18 +33937,7 @@ function FunkitQuoteProvider({ children }) {
33830
33937
  walletAddress,
33831
33938
  brokerage
33832
33939
  );
33833
- const QUOTE_CUSTOM_ERROR_DISPLAY_INFO = getQuoteCustomErrorDisplayInfo(t);
33834
- if (checkedAmount.isAboveMaximum) {
33835
- throw new Error(
33836
- QUOTE_CUSTOM_ERROR_DISPLAY_INFO[2 /* INSUFFICIENT_BALANCE_POST_CHECK */].check
33837
- );
33838
- }
33839
- if (checkedAmount.isBelowMinimum) {
33840
- throw new Error(
33841
- QUOTE_CUSTOM_ERROR_DISPLAY_INFO[3 /* INSUFFICIENT_AMOUNT_POST_CHECK */].check
33842
- );
33843
- }
33844
- const PENDING_QUOTE_MESSAGE_GENERATOR = getPendingQuoteMessageGenerator(t);
33940
+ assertCheckedAmountWithinLimits(checkedAmount, t);
33845
33941
  return {
33846
33942
  shellCheckoutItemWithNextQuote: {
33847
33943
  ...newCheckoutItem,
@@ -33850,7 +33946,7 @@ function FunkitQuoteProvider({ children }) {
33850
33946
  quoteState: {
33851
33947
  latestQuote: finalEstimation,
33852
33948
  isQuoting: false,
33853
- quoteStepMessage: !disableInformationStreaming ? paymentMethodInfo.paymentMethod === PaymentMethod.ACCOUNT_BALANCE && loginType === "web3" /* Web3 */ ? PENDING_QUOTE_MESSAGE_GENERATOR[2 /* ESTIMATING_GAS */]() : PENDING_QUOTE_MESSAGE_GENERATOR[1 /* VERIFYING_PROVIDER */](paymentMethodInfo.title) : "",
33949
+ quoteStepMessage: !disableInformationStreaming ? getProviderQuoteStepMessage(paymentMethodInfo, loginType, t) : "",
33854
33950
  quoteError: null
33855
33951
  },
33856
33952
  success: true
@@ -33874,52 +33970,12 @@ function FunkitQuoteProvider({ children }) {
33874
33970
  setQuoteProgress({ isQuoting: isQuoting2, quoteError: quoteError3, quoteStepMessage: quoteStepMessage2 });
33875
33971
  setLatestQuote(quoteState.latestQuote);
33876
33972
  }
33877
- if (checkedAmount?.isAboveMaximum) {
33878
- const { maxTargetAssetAmount, minTargetAssetAmount } = checkedAmount;
33879
- return {
33880
- error: {
33881
- maxTargetAssetAmount,
33882
- minTargetAssetAmount,
33883
- reason: "insufficientBalance"
33884
- },
33885
- shellCheckoutItemWithNextQuote: newCheckoutItem,
33886
- quoteState,
33887
- success: false
33888
- };
33889
- }
33890
- if (checkedAmount?.isBelowMinimum) {
33891
- const { maxTargetAssetAmount, minTargetAssetAmount } = checkedAmount;
33892
- return {
33893
- error: {
33894
- maxTargetAssetAmount,
33895
- minTargetAssetAmount,
33896
- reason: "insufficientAmount"
33897
- },
33898
- shellCheckoutItemWithNextQuote: newCheckoutItem,
33899
- quoteState,
33900
- success: false
33901
- };
33902
- }
33903
- const insufficientAmountMatch = error.message.match(
33904
- /target token must be at least \$(\d+(\.\d+)?)/i
33973
+ return getQuoteErrorResponse(
33974
+ error,
33975
+ checkedAmount,
33976
+ newCheckoutItem,
33977
+ quoteState
33905
33978
  );
33906
- if (insufficientAmountMatch?.[1]) {
33907
- return {
33908
- error: {
33909
- minTargetUsdAmount: Number.parseFloat(insufficientAmountMatch[1]),
33910
- reason: "insufficientAmount"
33911
- },
33912
- shellCheckoutItemWithNextQuote: newCheckoutItem,
33913
- quoteState,
33914
- success: false
33915
- };
33916
- }
33917
- return {
33918
- error: { originalError: error, reason: "internal" },
33919
- shellCheckoutItemWithNextQuote: newCheckoutItem,
33920
- quoteState,
33921
- success: false
33922
- };
33923
33979
  }
33924
33980
  }
33925
33981
  );
@@ -34863,6 +34919,38 @@ var statusIconMap = {
34863
34919
  failed: pendingIcon,
34864
34920
  expired: errorIcon
34865
34921
  };
34922
+ var StatusIconWrapper = ({
34923
+ statusRef
34924
+ }) => /* @__PURE__ */ React197.createElement(
34925
+ Box,
34926
+ {
34927
+ className: clsx21(
34928
+ statusIconWrapper,
34929
+ generateAnimationPrefixClassName("icon-wrapper")
34930
+ ),
34931
+ width: "20",
34932
+ height: "20"
34933
+ },
34934
+ /* @__PURE__ */ React197.createElement(Box, { className: clsx21(statusIcon) }, Object.entries(statusIconMap).map(([key, value]) => /* @__PURE__ */ React197.createElement(
34935
+ "div",
34936
+ {
34937
+ key,
34938
+ className: generateAnimationPrefixClassName(`icon-wrapper-${key}`),
34939
+ style: {
34940
+ // referencing status in the ref rather than the prop to keep the status in the ref for the whole lifecycle
34941
+ opacity: statusRef.current === key ? 1 : 0,
34942
+ position: "absolute",
34943
+ top: 0,
34944
+ bottom: 0,
34945
+ left: 0,
34946
+ right: 0,
34947
+ width: "100%",
34948
+ height: "100%"
34949
+ }
34950
+ },
34951
+ value
34952
+ )))
34953
+ );
34866
34954
  var FunNotificationBannerIcon = ({
34867
34955
  status,
34868
34956
  iconUrl,
@@ -35096,38 +35184,7 @@ var FunNotificationBannerIcon = ({
35096
35184
  src: iconUrl ?? void 0,
35097
35185
  fallbackSrc: fallbackIconUrl
35098
35186
  }
35099
- )), statusRef.current && /* @__PURE__ */ React197.createElement(
35100
- Box,
35101
- {
35102
- className: clsx21(
35103
- statusIconWrapper,
35104
- generateAnimationPrefixClassName("icon-wrapper")
35105
- ),
35106
- width: "20",
35107
- height: "20"
35108
- },
35109
- /* @__PURE__ */ React197.createElement(Box, { className: clsx21(statusIcon) }, Object.entries(statusIconMap).map(([key, value]) => /* @__PURE__ */ React197.createElement(
35110
- "div",
35111
- {
35112
- key,
35113
- className: generateAnimationPrefixClassName(
35114
- `icon-wrapper-${key}`
35115
- ),
35116
- style: {
35117
- // referencing status in the ref rather than the prop to keep the status in the ref for the whole lifecycle
35118
- opacity: statusRef.current === key ? 1 : 0,
35119
- position: "absolute",
35120
- top: 0,
35121
- bottom: 0,
35122
- left: 0,
35123
- right: 0,
35124
- width: "100%",
35125
- height: "100%"
35126
- }
35127
- },
35128
- value
35129
- )))
35130
- ));
35187
+ )), statusRef.current && /* @__PURE__ */ React197.createElement(StatusIconWrapper, { statusRef }));
35131
35188
  };
35132
35189
 
35133
35190
  // src/components/FunNotificationBanner/FunNotificationBanner.tsx
@@ -36958,6 +37015,11 @@ function PerpsHeaderTabs({
36958
37015
  return /* @__PURE__ */ React203.createElement(PerpsHeaderTabsView, { ...tabsState });
36959
37016
  }
36960
37017
 
37018
+ // src/modals/CheckoutModal/isSourceChangeLike.ts
37019
+ function isSourceChangeLike({ step }, startingStep) {
37020
+ return step === "source_change" /* SOURCE_CHANGE */ || step === "loading_account" /* LOADING_ACCOUNT */ && startingStep !== "confirmation" /* CONFIRMATION */ && startingStep !== "select_asset" /* SELECT_ASSET */;
37021
+ }
37022
+
36961
37023
  // src/modals/CheckoutModal/isWithdrawalStep.ts
36962
37024
  function isWithdrawalStep(modalState) {
36963
37025
  return modalState.step === "withdrawal_enter_amount" /* WITHDRAWAL_ENTER_AMOUNT */ || modalState.step === "withdrawal_complete" /* WITHDRAWAL_COMPLETE */ || modalState.step === "source_change" /* SOURCE_CHANGE */ && modalState.paymentMethodTypeFilter === "withdraw" && !!modalState.withdrawalConfig;
@@ -39624,7 +39686,7 @@ var FunTwoFaInput = ({
39624
39686
  inputRefs.current[focusIndex]?.focus();
39625
39687
  ensureFocus(focusIndex);
39626
39688
  };
39627
- const getBorderColor2 = () => {
39689
+ const getBorderColor3 = () => {
39628
39690
  if (hasError) {
39629
39691
  return { base: "error" };
39630
39692
  }
@@ -39644,7 +39706,7 @@ var FunTwoFaInput = ({
39644
39706
  fontWeight: "medium",
39645
39707
  borderStyle: "solid",
39646
39708
  borderWidth: "1",
39647
- borderColor: getBorderColor2(),
39709
+ borderColor: getBorderColor3(),
39648
39710
  borderRadius: "10",
39649
39711
  cursor: isFocused ? "default" : "pointer",
39650
39712
  style: { overflowX: "auto" },
@@ -49023,6 +49085,22 @@ function useAssetOptions({
49023
49085
  ]);
49024
49086
  return assetOptions;
49025
49087
  }
49088
+ function getDefaultChainTokenSymbol(assetOptions, selectedSourceAssetInfo) {
49089
+ if (selectedSourceAssetInfo?.symbol) {
49090
+ const key = combineChainSymbolOrAddress({
49091
+ chainId: selectedSourceAssetInfo.chainId,
49092
+ symbolOrAddress: selectedSourceAssetInfo.symbol
49093
+ });
49094
+ const option = assetOptions.find(
49095
+ (option2) => option2.asset.chainSymbolKey === key
49096
+ );
49097
+ if (option && !option.isDisabled) {
49098
+ return key;
49099
+ }
49100
+ }
49101
+ const usableOptions = assetOptions.filter((option) => !option.isDisabled);
49102
+ return usableOptions[0]?.asset.chainSymbolKey;
49103
+ }
49026
49104
  function useScrollToSelectedAsset(selectedChainTokenSymbol) {
49027
49105
  const rootNode = useRootNode();
49028
49106
  useEffect85(() => {
@@ -49172,22 +49250,11 @@ function AccountSelectAsset({
49172
49250
  });
49173
49251
  onFinish();
49174
49252
  });
49175
- const defaultSelectedChainTokenSymbol = useMemo65(() => {
49176
- if (checkoutItem?.selectedSourceAssetInfo.symbol) {
49177
- const key = combineChainSymbolOrAddress({
49178
- chainId: checkoutItem.selectedSourceAssetInfo.chainId,
49179
- symbolOrAddress: checkoutItem.selectedSourceAssetInfo.symbol
49180
- });
49181
- const option = assetOptions.find(
49182
- (option2) => option2.asset.chainSymbolKey === key
49183
- );
49184
- if (option && !option.isDisabled) {
49185
- return key;
49186
- }
49187
- }
49188
- const usableOptions = assetOptions.filter((option) => !option.isDisabled);
49189
- return usableOptions[0]?.asset.chainSymbolKey;
49190
- }, [assetOptions, checkoutItem?.selectedSourceAssetInfo]);
49253
+ const selectedSourceAssetInfo = checkoutItem?.selectedSourceAssetInfo;
49254
+ const defaultSelectedChainTokenSymbol = useMemo65(
49255
+ () => getDefaultChainTokenSymbol(assetOptions, selectedSourceAssetInfo),
49256
+ [assetOptions, selectedSourceAssetInfo]
49257
+ );
49191
49258
  const selectedChainTokenSymbol = useMemo65(() => {
49192
49259
  if (explicitlySelectedChainTokenSymbol) {
49193
49260
  const assetExists = assetOptions.some(
@@ -52974,7 +53041,7 @@ function FunCheckoutModalInner({
52974
53041
  const shouldSkipExtraContentTopPadding = getSwappedExtraPaddingExcludedSteps(startingStep).includes(
52975
53042
  modalState.step
52976
53043
  ) && isSwappedEnabled;
52977
- const isSourceChangeLikeStep = modalState.step === "source_change" /* SOURCE_CHANGE */ || modalState.step === "loading_account" /* LOADING_ACCOUNT */ && startingStep !== "confirmation" /* CONFIRMATION */ && startingStep !== "select_asset" /* SELECT_ASSET */;
53044
+ const isSourceChangeLikeStep = isSourceChangeLike(modalState, startingStep);
52978
53045
  return /* @__PURE__ */ React318.createElement(
52979
53046
  Dialog,
52980
53047
  {