@funkit/connect 9.23.2-next.0 → 9.24.0-next.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (172) hide show
  1. package/CHANGELOG.md +10 -1
  2. package/dist/clients/aave.d.ts +1 -1
  3. package/dist/clients/chunk-A32VN2DX.js +2382 -0
  4. package/dist/clients/chunk-GUWXVR5S.js +186 -0
  5. package/dist/clients/chunk-JBWB54MX.js +69 -0
  6. package/dist/clients/chunk-NPPIETHZ.js +54 -0
  7. package/dist/clients/chunk-YYMIRDCQ.js +230 -0
  8. package/dist/clients/lighter.d.ts +19 -1
  9. package/dist/clients/lighter.js +7 -2
  10. package/dist/clients/mallard.d.ts +1 -1
  11. package/dist/clients/polymarket/PolymarketDepositAccountDropdown.d.ts +1 -1
  12. package/dist/clients/polymarket/createPolymarketDepositConfig.d.ts +1 -1
  13. package/dist/clients/polymarket/polymarket.d.ts +2 -2
  14. package/dist/clients/rolly.d.ts +1 -1
  15. package/dist/components/ApprovalMethodToggle/ApprovalMethodToggle.d.ts +1 -1
  16. package/dist/components/Dropdown/ChainDropdown.d.ts +1 -1
  17. package/dist/components/Dropdown/TokenAndChainDropdown.d.ts +1 -1
  18. package/dist/components/Dropdown/TokenDropdown.d.ts +1 -1
  19. package/dist/components/FunAsset/FunAssetItem.d.ts +1 -1
  20. package/dist/components/FunCheckoutHistory/AddTokenToWalletButton.d.ts +1 -1
  21. package/dist/components/FunCheckoutHistory/FunDirectExecutionHistoryBottomBar.d.ts +1 -1
  22. package/dist/components/FunCheckoutHistory/FunDirectExecutionHistoryDetail.d.ts +1 -1
  23. package/dist/components/FunCheckoutHistory/PendingSuccessScreen.d.ts +2 -2
  24. package/dist/components/FunCheckoutHistory/YouSendItem.d.ts +1 -1
  25. package/dist/components/FunNotificationBanner/FunNotificationBannerIcon.d.ts +1 -1
  26. package/dist/components/FunPayments/FunPaymentMethods.d.ts +1 -1
  27. package/dist/components/FunSelectBrokerage/FunSelectBrokerage.d.ts +1 -1
  28. package/dist/components/FunTransactionSummary/DestinationYieldRows.d.ts +1 -1
  29. package/dist/components/FunTransactionSummary/PaymentAmountSummary.d.ts +3 -3
  30. package/dist/components/FunTransactionSummary/PaymentFeesSummary.d.ts +2 -2
  31. package/dist/components/FunTransactionSummary/PaymentFeesSummary.track.d.ts +2 -2
  32. package/dist/components/FunTransactionSummary/PaymentMethodSummary.d.ts +2 -2
  33. package/dist/components/FunTransactionSummary/PaymentRouteSummary.d.ts +1 -1
  34. package/dist/components/ModalHeightAnimationLayer/FunCheckoutModalHeightAnimationWrapper.d.ts +2 -2
  35. package/dist/components/NewTokenDepositAlert/NewTokenDepositAlert.d.ts +1 -1
  36. package/dist/components/ReceiveAmount/ReceiveAmount.d.ts +2 -2
  37. package/dist/components/SourcePaymentMethodItem/SourcePaymentMethodItem.d.ts +1 -1
  38. package/dist/components/TransactionStatus/AnimatedSpinner/AnimatedSpinner.d.ts +1 -1
  39. package/dist/components/TransactionStatus/StepSpinner.d.ts +1 -1
  40. package/dist/components/TransactionStatus/TransactionStatus.d.ts +2 -2
  41. package/dist/components/TransferTokenDetails/TransferTokenDetails.d.ts +1 -1
  42. package/dist/consts/customers.d.ts +1 -1
  43. package/dist/domains/aave.d.ts +1 -1
  44. package/dist/domains/asset.d.ts +2 -2
  45. package/dist/domains/checkout.d.ts +1 -1
  46. package/dist/domains/checkoutErrors.d.ts +2 -2
  47. package/dist/domains/checkoutRecipient.d.ts +1 -1
  48. package/dist/domains/clientMetadata.d.ts +1 -1
  49. package/dist/domains/dynamicRouting.d.ts +1 -1
  50. package/dist/domains/fees.d.ts +3 -3
  51. package/dist/domains/paymentMethods.d.ts +1 -1
  52. package/dist/domains/quote.d.ts +5 -5
  53. package/dist/domains/quoteMode/exactOut.d.ts +1 -1
  54. package/dist/domains/quoteMode/resolveQuoteMode.d.ts +1 -1
  55. package/dist/domains/quoteMode/types.d.ts +2 -2
  56. package/dist/hooks/queries/useLightningQuote.d.ts +1 -1
  57. package/dist/hooks/queries/useMeldDefaultCurrency.d.ts +1 -1
  58. package/dist/hooks/queries/useRecentCheckouts.d.ts +1 -1
  59. package/dist/hooks/queries/useRecentDeposits.d.ts +1 -1
  60. package/dist/hooks/queries/useWithdrawalQuote.d.ts +31 -31
  61. package/dist/hooks/track/useTrack.d.ts +1 -1
  62. package/dist/hooks/useBluvo.d.ts +3 -3
  63. package/dist/hooks/useCheckoutDirectExecution.d.ts +3 -3
  64. package/dist/hooks/useCheckoutDirectExecutionHistory.d.ts +1 -1
  65. package/dist/hooks/useCheckoutItemDisplay.d.ts +2 -2
  66. package/dist/hooks/useCheckoutTimeEstimate.d.ts +2 -2
  67. package/dist/hooks/useCountdown.d.ts +1 -1
  68. package/dist/hooks/useEnabledTokenTransferChainTokens.d.ts +1 -1
  69. package/dist/hooks/useExchangeOptions.d.ts +1 -1
  70. package/dist/hooks/useFrogAccount.d.ts +1 -1
  71. package/dist/hooks/useIsBlacklisted.d.ts +1 -1
  72. package/dist/hooks/useIsDynamicRoutingEnabled.d.ts +1 -1
  73. package/dist/hooks/useMinDeposit.d.ts +1 -1
  74. package/dist/hooks/useNewTokenBanner.d.ts +1 -1
  75. package/dist/hooks/useOnNewNotification.d.ts +1 -1
  76. package/dist/hooks/usePaymentMethodTabs.d.ts +1 -1
  77. package/dist/hooks/usePaymentSources.d.ts +2 -2
  78. package/dist/hooks/useRelayBypass.d.ts +1 -1
  79. package/dist/hooks/useStepQueryReadiness.d.ts +3 -3
  80. package/dist/hooks/useTokenAndChainDropdown.d.ts +1 -1
  81. package/dist/hooks/useTokenTransfer.d.ts +1 -1
  82. package/dist/hooks/useTokenTransferConfig.d.ts +1 -1
  83. package/dist/hooks/useUserIpInfo.d.ts +1 -1
  84. package/dist/index.js +11 -4
  85. package/dist/interfaces/identity.d.ts +1 -1
  86. package/dist/modals/ChainModal/Chain.d.ts +1 -1
  87. package/dist/modals/CheckoutModal/Brokerage/BrokerageSuccessModal.d.ts +1 -1
  88. package/dist/modals/CheckoutModal/Brokerage/BrokerageTwoFA.d.ts +2 -2
  89. package/dist/modals/CheckoutModal/Brokerage/ConnectExchange.d.ts +2 -2
  90. package/dist/modals/CheckoutModal/Brokerage/SelectBrokerage.d.ts +2 -2
  91. package/dist/modals/CheckoutModal/ConfirmationStep/CheckoutPrimaryInfo.d.ts +2 -2
  92. package/dist/modals/CheckoutModal/ConfirmationStep/ConfirmationStep.d.ts +1 -1
  93. package/dist/modals/CheckoutModal/ConfirmationStep/DisclaimerText.d.ts +1 -1
  94. package/dist/modals/CheckoutModal/ConfirmationStep/mapRetryAction.d.ts +1 -1
  95. package/dist/modals/CheckoutModal/ConfirmationStep/useCheckoutConfirmation.d.ts +1 -1
  96. package/dist/modals/CheckoutModal/ConfirmationStep/useCheckoutQuote.d.ts +2 -2
  97. package/dist/modals/CheckoutModal/ConfirmationStep/usePostCheckout.d.ts +2 -2
  98. package/dist/modals/CheckoutModal/ConfirmationStep/useQuoteRefresh.d.ts +1 -1
  99. package/dist/modals/CheckoutModal/ConfirmationStep/useSourceAssetConfirm.d.ts +2 -2
  100. package/dist/modals/CheckoutModal/InputAmount/InputAmount.d.ts +1 -1
  101. package/dist/modals/CheckoutModal/InputAmount/InputAmountLoaded.d.ts +2 -2
  102. package/dist/modals/CheckoutModal/InputAmount/state.d.ts +3 -3
  103. package/dist/modals/CheckoutModal/InputAmount/useAaveNativeSupply.d.ts +3 -3
  104. package/dist/modals/CheckoutModal/InputAmount/useAmountInput.d.ts +1 -1
  105. package/dist/modals/CheckoutModal/InputAmount/useAvailableBalanceForCheckout.d.ts +3 -3
  106. package/dist/modals/CheckoutModal/InputAmount/useCheckoutAmountLimits.d.ts +2 -2
  107. package/dist/modals/CheckoutModal/InputAmount/useMeld.d.ts +1 -1
  108. package/dist/modals/CheckoutModal/InputAmount/utils.d.ts +2 -2
  109. package/dist/modals/CheckoutModal/LightningInvoice/LightningInvoice.d.ts +1 -1
  110. package/dist/modals/CheckoutModal/LightningInvoice/LightningInvoiceQrCode.d.ts +1 -1
  111. package/dist/modals/CheckoutModal/MeldCurrencySelect/MeldCurrencySelect.d.ts +1 -1
  112. package/dist/modals/CheckoutModal/MeldQuotes/MeldQuotes.d.ts +1 -1
  113. package/dist/modals/CheckoutModal/MeldRedirect/MeldRedirect.d.ts +1 -1
  114. package/dist/modals/CheckoutModal/SelectAsset/SelectAsset.d.ts +4 -4
  115. package/dist/modals/CheckoutModal/SelectAsset/SelectAssetInfoSection.d.ts +2 -2
  116. package/dist/modals/CheckoutModal/SelectAsset/SelectAssetList.d.ts +2 -2
  117. package/dist/modals/CheckoutModal/SourceChange/ConnectedSource.d.ts +1 -1
  118. package/dist/modals/CheckoutModal/SourceChange/CryptoCashToggle.d.ts +2 -2
  119. package/dist/modals/CheckoutModal/SourceChange/SourceChange.d.ts +2 -2
  120. package/dist/modals/CheckoutModal/SourceChange/useSourceChangeLayout.d.ts +1 -1
  121. package/dist/modals/CheckoutModal/SwappedIframe/SwappedIframeController.d.ts +2 -2
  122. package/dist/modals/CheckoutModal/TransferToken/CheckoutNotification.d.ts +1 -1
  123. package/dist/modals/CheckoutModal/TransferToken/CheckoutNotifications.track.d.ts +1 -1
  124. package/dist/modals/CheckoutModal/TransferToken/DirectExecutionNotification.d.ts +1 -1
  125. package/dist/modals/CheckoutModal/TransferToken/TransferToken.d.ts +1 -1
  126. package/dist/modals/CheckoutModal/TransferToken/types.d.ts +1 -1
  127. package/dist/modals/CheckoutModal/VirtualFiatAccount/BridgeCustomer.d.ts +2 -2
  128. package/dist/modals/CheckoutModal/VirtualFiatAccount/BridgeKyc.d.ts +1 -1
  129. package/dist/modals/CheckoutModal/VirtualFiatAccount/ErrorScreen.d.ts +1 -1
  130. package/dist/modals/CheckoutModal/VirtualFiatAccount/FiatAccountDetail.d.ts +1 -1
  131. package/dist/modals/CheckoutModal/VirtualFiatAccount/KycIframe.d.ts +2 -2
  132. package/dist/modals/CheckoutModal/VirtualFiatAccount/VirtualFiatAccount.d.ts +2 -2
  133. package/dist/modals/CheckoutModal/Withdrawal/WithdrawalComplete.d.ts +2 -2
  134. package/dist/modals/CheckoutModal/Withdrawal/WithdrawalEnterAmount.d.ts +2 -2
  135. package/dist/modals/CheckoutModal/stepTransition.d.ts +5 -5
  136. package/dist/modals/CheckoutModal/stepTransition.track.d.ts +2 -2
  137. package/dist/modals/ProfileDetails/FunProfileViews/Home/HomeCheckoutDisplayRow.d.ts +2 -2
  138. package/dist/modals/ProfileDetails/FunProfileViews/Home/HomeTokenDisplayRow.d.ts +1 -1
  139. package/dist/modals/ProfileDetails/FunProfileViews/Home/ProfileTitleSection.d.ts +2 -2
  140. package/dist/modals/ProfileDetails/FunProfileViews/Home/index.d.ts +1 -1
  141. package/dist/modals/WithdrawalModal/ErrorMessage.d.ts +2 -2
  142. package/dist/modals/WithdrawalModal/LighterWithdrawal.d.ts +4 -4
  143. package/dist/modals/WithdrawalModal/RecipientAddress.d.ts +1 -1
  144. package/dist/modals/WithdrawalModal/WithdrawAmountInput.d.ts +1 -1
  145. package/dist/modals/WithdrawalModal/WithdrawalCallbackSuccess.d.ts +1 -1
  146. package/dist/modals/WithdrawalModal/WithdrawalContent.d.ts +1 -1
  147. package/dist/modals/WithdrawalModal/WithdrawalModal.d.ts +1 -1
  148. package/dist/modals/WithdrawalModal/WithdrawalTypeSelect.d.ts +1 -1
  149. package/dist/modals/WithdrawalModal/useWithdrawal.d.ts +3 -3
  150. package/dist/providers/FunkitBrokerageProvider.d.ts +2 -2
  151. package/dist/providers/FunkitCheckoutContext/index.d.ts +1 -1
  152. package/dist/providers/FunkitCheckoutContext/track.d.ts +4 -4
  153. package/dist/providers/FunkitCheckoutContext/types.d.ts +16 -0
  154. package/dist/providers/FunkitConfigContext.d.ts +3 -3
  155. package/dist/providers/FunkitHistoryContext.d.ts +2 -2
  156. package/dist/providers/FunkitProvider.d.ts +2 -2
  157. package/dist/providers/FunkitQuoteContext.track.d.ts +4 -4
  158. package/dist/providers/GeneralWalletProvider.d.ts +2 -2
  159. package/dist/providers/QuoteModeContext.d.ts +1 -1
  160. package/dist/providers/SwappedProvider.d.ts +1 -1
  161. package/dist/utils/assets.d.ts +1 -1
  162. package/dist/utils/bluvo.d.ts +3 -3
  163. package/dist/utils/checkout.d.ts +3 -3
  164. package/dist/utils/depositCutoff.d.ts +1 -1
  165. package/dist/utils/funkitProvider.d.ts +1 -1
  166. package/dist/utils/payment.d.ts +1 -1
  167. package/dist/utils/polygonRpcCheck.d.ts +1 -1
  168. package/dist/utils/purifyCheckoutHistoryItem.d.ts +1 -1
  169. package/dist/utils/swapped.d.ts +1 -1
  170. package/dist/utils/withdrawal.d.ts +1 -1
  171. package/dist/wallets/walletConnectors/index.js +58 -58
  172. package/package.json +4 -4
@@ -0,0 +1,54 @@
1
+ "use client";
2
+ import {
3
+ Box
4
+ } from "./chunk-JBWB54MX.js";
5
+
6
+ // src/components/Text/Text.tsx
7
+ import React from "react";
8
+ var Text = React.forwardRef(
9
+ ({
10
+ as = "div",
11
+ children,
12
+ className,
13
+ color = "primaryText",
14
+ display,
15
+ font = "body",
16
+ id,
17
+ size = "16",
18
+ style,
19
+ tabIndex,
20
+ title,
21
+ textAlign = "inherit",
22
+ textTransform = "none",
23
+ weight = "regular",
24
+ testId
25
+ }, ref) => {
26
+ return /* @__PURE__ */ React.createElement(
27
+ Box,
28
+ {
29
+ as,
30
+ className,
31
+ color: color === "inherit" ? void 0 : color,
32
+ display,
33
+ fontFamily: font,
34
+ fontSize: size,
35
+ fontWeight: weight,
36
+ id,
37
+ title,
38
+ ref,
39
+ style,
40
+ tabIndex,
41
+ textAlign,
42
+ textTransform,
43
+ testId,
44
+ background: { selection: "textSelection" }
45
+ },
46
+ children
47
+ );
48
+ }
49
+ );
50
+ Text.displayName = "Text";
51
+
52
+ export {
53
+ Text
54
+ };
@@ -0,0 +1,230 @@
1
+ "use client";
2
+ import {
3
+ Box
4
+ } from "./chunk-JBWB54MX.js";
5
+ import {
6
+ logger
7
+ } from "./chunk-UUHGOBKZ.js";
8
+
9
+ // src/components/AsyncImage/useAsyncImage.ts
10
+ import { useEffect, useReducer } from "react";
11
+ var cachedUrls = /* @__PURE__ */ new Map();
12
+ var cachedRequestPromises = /* @__PURE__ */ new Map();
13
+ async function loadAsyncImage(asyncImage) {
14
+ const cachedRequestPromise = cachedRequestPromises.get(asyncImage);
15
+ if (cachedRequestPromise) {
16
+ return cachedRequestPromise;
17
+ }
18
+ const load = async () => asyncImage().then(async (url) => {
19
+ cachedUrls.set(asyncImage, url);
20
+ return url;
21
+ });
22
+ const requestPromise = load().catch(async () => {
23
+ return load().catch(() => {
24
+ cachedRequestPromises.delete(asyncImage);
25
+ return void 0;
26
+ });
27
+ });
28
+ cachedRequestPromises.set(asyncImage, requestPromise);
29
+ return requestPromise;
30
+ }
31
+ function useForceUpdate() {
32
+ const [, forceUpdate] = useReducer((x) => x + 1, 0);
33
+ return forceUpdate;
34
+ }
35
+ function useAsyncImage(url) {
36
+ const cachedUrl = typeof url === "function" ? cachedUrls.get(url) : void 0;
37
+ const forceUpdate = useForceUpdate();
38
+ useEffect(() => {
39
+ if (typeof url === "function" && !cachedUrl) {
40
+ loadAsyncImage(url).then(forceUpdate);
41
+ }
42
+ }, [url, cachedUrl, forceUpdate]);
43
+ return typeof url === "function" ? cachedUrl : url;
44
+ }
45
+ var REMOTE_IMG_CACHE = /* @__PURE__ */ new Set();
46
+ function preloadRemoteImages(...imageUrls) {
47
+ for (const imageUrl of imageUrls) {
48
+ try {
49
+ const { protocol } = new URL(imageUrl);
50
+ if (protocol !== "https:" && protocol !== "http:") {
51
+ logger.warn("preloadRemoteImages:invalidUrl", {
52
+ message: "Invalid protocol",
53
+ imageUrl
54
+ });
55
+ continue;
56
+ }
57
+ if (!REMOTE_IMG_CACHE.has(imageUrl)) {
58
+ REMOTE_IMG_CACHE.add(imageUrl);
59
+ const preloadImage = new Image();
60
+ preloadImage.src = imageUrl;
61
+ }
62
+ } catch (error) {
63
+ logger.warn("preloadRemoteImages:error", {
64
+ message: "Unable to preload image",
65
+ imageUrl,
66
+ error
67
+ });
68
+ }
69
+ }
70
+ }
71
+
72
+ // src/components/AsyncImage/AsyncImage.tsx
73
+ import React, { useMemo, useReducer as useReducer2, useState } from "react";
74
+
75
+ // src/utils/sanitizeUrl.ts
76
+ var SAFE_URL_PROTOCOLS = /* @__PURE__ */ new Set(["https:", "http:"]);
77
+ function sanitizeUrl(url) {
78
+ if (!url) {
79
+ return void 0;
80
+ }
81
+ try {
82
+ const parsed = new URL(url);
83
+ if (SAFE_URL_PROTOCOLS.has(parsed.protocol)) {
84
+ return parsed.href;
85
+ }
86
+ return void 0;
87
+ } catch {
88
+ return void 0;
89
+ }
90
+ }
91
+ function sanitizeCssUrl(url) {
92
+ const safeUrl = sanitizeUrl(url);
93
+ if (!safeUrl) {
94
+ return void 0;
95
+ }
96
+ return safeUrl.replace(/['()\\]/g, (char) => {
97
+ return `%${char.charCodeAt(0).toString(16).padStart(2, "0")}`;
98
+ });
99
+ }
100
+
101
+ // src/components/AsyncImage/AsyncImage.tsx
102
+ function useTriggeredOnce() {
103
+ return useReducer2(() => true, false);
104
+ }
105
+ function AsyncImage({
106
+ alt,
107
+ background,
108
+ borderColor,
109
+ borderRadius,
110
+ boxShadow,
111
+ height,
112
+ useAsImage,
113
+ src: srcProp,
114
+ fallbackSrc,
115
+ fallbackElement,
116
+ width,
117
+ testId
118
+ }) {
119
+ const src = useAsyncImage(srcProp || fallbackSrc);
120
+ const isRemoteImage = src !== void 0 && /^(https?|data):/.test(src);
121
+ const [isRemoteImageLoaded, setRemoteImageLoaded] = useTriggeredOnce();
122
+ const [hasError, setHasError] = useState(
123
+ srcProp === void 0 && fallbackSrc === void 0
124
+ );
125
+ const { asyncStyle, imgProps } = useMemo(() => {
126
+ const asyncStyle2 = !useAsImage ? getRemoteImageStyles(isRemoteImage, isRemoteImageLoaded, src) : {};
127
+ if (useAsImage || isRemoteImage) {
128
+ const imgProps2 = {
129
+ as: "img",
130
+ src,
131
+ "aria-hidden": true,
132
+ onError: ({
133
+ currentTarget
134
+ }) => {
135
+ currentTarget.onerror = null;
136
+ if (fallbackSrc !== void 0) {
137
+ currentTarget.src = fallbackSrc;
138
+ } else {
139
+ setHasError(true);
140
+ }
141
+ },
142
+ onLoad: isRemoteImage ? setRemoteImageLoaded : void 0
143
+ };
144
+ return { imgProps: imgProps2, asyncStyle: asyncStyle2 };
145
+ }
146
+ return {
147
+ imgProps: {
148
+ backgroundSize: "cover"
149
+ },
150
+ asyncStyle: {
151
+ ...asyncStyle2,
152
+ // has to be added as a inline style because vanilla-extract doesn't recognize this as a valid style
153
+ backgroundPosition: "center"
154
+ }
155
+ };
156
+ }, [
157
+ fallbackSrc,
158
+ isRemoteImage,
159
+ isRemoteImageLoaded,
160
+ src,
161
+ useAsImage,
162
+ setRemoteImageLoaded
163
+ ]);
164
+ const mainElement = hasError && fallbackElement || /* @__PURE__ */ React.createElement(
165
+ Box,
166
+ {
167
+ ...imgProps,
168
+ height: "full",
169
+ position: "absolute",
170
+ style: {
171
+ WebkitTouchCallout: "none",
172
+ transition: "opacity .15s linear",
173
+ userSelect: "none",
174
+ ...asyncStyle
175
+ },
176
+ width: "full"
177
+ }
178
+ );
179
+ return /* @__PURE__ */ React.createElement(
180
+ Box,
181
+ {
182
+ "aria-label": alt,
183
+ borderRadius,
184
+ boxShadow,
185
+ height: typeof height === "string" ? height : void 0,
186
+ overflow: "hidden",
187
+ position: "relative",
188
+ role: "img",
189
+ style: {
190
+ background,
191
+ height: typeof height === "number" ? height : void 0,
192
+ width: typeof width === "number" ? width : void 0
193
+ },
194
+ width: typeof width === "string" ? width : void 0,
195
+ testId
196
+ },
197
+ mainElement,
198
+ borderColor ? /* @__PURE__ */ React.createElement(
199
+ Box,
200
+ {
201
+ ...typeof borderColor === "object" && "custom" in borderColor ? { style: { borderColor: borderColor.custom } } : { borderColor },
202
+ borderRadius,
203
+ borderStyle: "solid",
204
+ borderWidth: "1",
205
+ height: "full",
206
+ position: "relative",
207
+ width: "full"
208
+ }
209
+ ) : null
210
+ );
211
+ }
212
+ var getRemoteImageStyles = (isRemoteImage, isRemoteImageLoaded, src) => {
213
+ if (isRemoteImage) {
214
+ return {
215
+ opacity: isRemoteImageLoaded ? 1 : 0
216
+ };
217
+ }
218
+ const safeSrc = sanitizeCssUrl(src);
219
+ return {
220
+ // note the url must have quotation, see https://github.com/evanw/esbuild/issues/1843#issuecomment-1370108070
221
+ backgroundImage: safeSrc ? `url('${safeSrc}')` : void 0,
222
+ backgroundRepeat: "no-repeat",
223
+ opacity: src ? 1 : 0
224
+ };
225
+ };
226
+
227
+ export {
228
+ preloadRemoteImages,
229
+ AsyncImage
230
+ };
@@ -14,7 +14,7 @@
14
14
  * caller provides the actual on-chain implementation.
15
15
  */
16
16
  import { type Address } from 'viem';
17
- import type { CustomWithdrawalConfig, MultiMethodWithdrawalConfig } from '~/providers/FunkitCheckoutContext/types';
17
+ import type { CustomWithdrawalConfig, MultiMethodWithdrawalConfig } from '../providers/FunkitCheckoutContext/types';
18
18
  export type LighterTransferParams = {
19
19
  toAccountIndex: number;
20
20
  assetIndex: number;
@@ -60,6 +60,19 @@ export interface LighterWithdrawalConfig {
60
60
  * ```
61
61
  */
62
62
  getSecureMinWithdrawalAmount?: (symbol: string) => number | undefined;
63
+ /**
64
+ * Awaited hook fired after the user taps "Withdraw" but before either method
65
+ * (Fast or Secure) fetches a nonce, prompts the wallet, or submits the L2 tx.
66
+ *
67
+ * Lighter strategies and withdrawals share the same L2 signing account, so a
68
+ * strategy that's still placing/cancelling orders will bump the nonce out
69
+ * from under the withdrawal and the signed tx is rejected. Cancel in-flight
70
+ * strategies here (awaited) so the withdrawal signs against a stable nonce.
71
+ *
72
+ * Throw to abort the withdrawal — the message is shown to the user verbatim
73
+ * and no nonce is consumed. Applies to both Fast and Secure.
74
+ */
75
+ onBeforeSign?: () => Promise<void> | void;
63
76
  }
64
77
  /**
65
78
  * Default minimum Secure-withdrawal amounts (token units) for known Lighter
@@ -92,6 +105,11 @@ export interface LighterSecureWithdrawalConfig {
92
105
  * ```
93
106
  */
94
107
  getMinWithdrawalAmount?: (symbol: string) => number;
108
+ /**
109
+ * Awaited hook fired before the Secure withdrawal fetches a nonce, prompts
110
+ * the wallet, or submits the L2 tx. See {@link LighterWithdrawalConfig['onBeforeSign']}.
111
+ */
112
+ onBeforeSign?: () => Promise<void> | void;
95
113
  }
96
114
  /**
97
115
  * Records a Lighter Secure withdrawal in Fun's direct-execution table as
@@ -457,6 +457,7 @@ function createLighterSecureWithdrawalConfig(config) {
457
457
  return {
458
458
  modalTitle: config.modalTitle ?? i18next.t("withdrawal.withdraw"),
459
459
  disableConnectedWallet: config.disableConnectedWallet,
460
+ onBeforeSign: config.onBeforeSign,
460
461
  withdrawCallback: buildSecureWithdrawalCallback({
461
462
  exec: config.sendLighterSecureWithdrawal
462
463
  }),
@@ -474,7 +475,8 @@ function buildLighterFastWalletWithdrawalConfig({
474
475
  accountIndex,
475
476
  modalTitle,
476
477
  disableConnectedWallet,
477
- iconSrc
478
+ iconSrc,
479
+ onBeforeSign
478
480
  }) {
479
481
  const adaptedWallet = createLighterAdaptedWallet({
480
482
  signerClient,
@@ -498,6 +500,7 @@ function buildLighterFastWalletWithdrawalConfig({
498
500
  return {
499
501
  modalTitle: modalTitle ?? i18next.t("withdrawal.withdraw"),
500
502
  disableConnectedWallet,
503
+ onBeforeSign,
501
504
  wallet,
502
505
  sourceChainId: RELAY_LIGHTER_CHAIN_ID,
503
506
  sourceTokenSymbol: "USDC",
@@ -549,7 +552,8 @@ function buildLighterMultiMethodConfig({
549
552
  accountIndex: Number(accountIndex),
550
553
  modalTitle: config.modalTitle,
551
554
  disableConnectedWallet: config.disableConnectedWallet,
552
- iconSrc: config.fastIconSrc
555
+ iconSrc: config.fastIconSrc,
556
+ onBeforeSign: config.onBeforeSign
553
557
  });
554
558
  const secureConfig = createLighterSecureWithdrawalConfig({
555
559
  accountIndex,
@@ -557,6 +561,7 @@ function buildLighterMultiMethodConfig({
557
561
  disableConnectedWallet: config.disableConnectedWallet,
558
562
  iconSrc: config.secureIconSrc,
559
563
  sendLighterSecureWithdrawal: config.sendLighterSecureWithdrawal,
564
+ onBeforeSign: config.onBeforeSign,
560
565
  getMinWithdrawalAmount: (symbol) => {
561
566
  const userMin = config.getSecureMinWithdrawalAmount?.(symbol);
562
567
  if (userMin !== void 0) {
@@ -15,7 +15,7 @@
15
15
  * verified on-chain (owner = the Fun deployer).
16
16
  */
17
17
  import { type Address } from 'viem';
18
- import type { FunkitCheckoutActionParams } from '~/providers/FunkitCheckoutContext/types';
18
+ import type { FunkitCheckoutActionParams } from '../providers/FunkitCheckoutContext/types';
19
19
  /** Mallard deposit contract to credit a Mallard (perps) account. */
20
20
  export declare const MALLARD_DEPOSIT_ADDRESS: `0x${string}`;
21
21
  /** VaultDepositooor on Zorro chain. */
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import type { SourceChangeTopComponentProps } from '~/modals/CheckoutModal/stepTransition';
2
+ import type { SourceChangeTopComponentProps } from '../../modals/CheckoutModal/stepTransition';
3
3
  import { type PolymarketAccount } from './createPolymarketDepositConfig';
4
4
  /** The account fields the picker needs: address + its live balance getter. */
5
5
  export type PolymarketAccountDisplay = Pick<PolymarketAccount, 'address' | 'getBalanceUsd'>;
@@ -1,4 +1,4 @@
1
- import type { FunkitCheckoutActionParams, FunkitCheckoutConfig, PolymarketTransferAccount } from '~/providers/FunkitCheckoutContext/types';
1
+ import type { FunkitCheckoutActionParams, FunkitCheckoutConfig, PolymarketTransferAccount } from '../../providers/FunkitCheckoutContext/types';
2
2
  import { type PolymarketPerpsDepositConfig } from './polymarket';
3
3
  /**
4
4
  * Routing ids that select the deposit destination. The deposit dropdown writes
@@ -16,8 +16,8 @@
16
16
  * {@link WalletWithdrawalConfig}.
17
17
  */
18
18
  import { type Address, type PublicClient, type TransactionReceipt } from 'viem';
19
- import type { CustomWithdrawalConfig, FunkitCheckoutActionParams, FunkitWithdrawalConfig, WalletWithdrawalConfig } from '~/providers/FunkitCheckoutContext/types';
20
- import type { WithdrawalTransaction } from '~/wallets/Wallet';
19
+ import type { CustomWithdrawalConfig, FunkitCheckoutActionParams, FunkitWithdrawalConfig, WalletWithdrawalConfig } from '../../providers/FunkitCheckoutContext/types';
20
+ import type { WithdrawalTransaction } from '../../wallets/Wallet';
21
21
  /** Polygon USDCe — used as sourceTokenAddress for withdrawals */
22
22
  export declare const POLYGON_USDCE: Address;
23
23
  /** Polymarket pUSD on Polygon — the integrator-held source token in the wallet-unwrap flow. */
@@ -12,7 +12,7 @@
12
12
  * known at quote time.
13
13
  */
14
14
  import { type Address } from 'viem';
15
- import type { FunkitCheckoutActionParams } from '~/providers/FunkitCheckoutContext/types';
15
+ import type { FunkitCheckoutActionParams } from '../providers/FunkitCheckoutContext/types';
16
16
  /** Rolly rollup deposit contract on Arbitrum (UUPS proxy). */
17
17
  export declare const ROLLY_VAULT_ADDRESS: `0x${string}`;
18
18
  /** Arbitrum USDT0 — Rolly's source deposit token. */
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import type { ApprovalMethod } from '~/providers/FunkitQuoteContext';
2
+ import type { ApprovalMethod } from '../../providers/FunkitQuoteContext';
3
3
  interface ApprovalMethodToggleProps {
4
4
  value: ApprovalMethod;
5
5
  onChange: (next: ApprovalMethod) => void;
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import type { TokenTransferSourceChainsAndAssets } from '~/modals/CheckoutModal/TransferToken/TransferToken';
2
+ import type { TokenTransferSourceChainsAndAssets } from '../../modals/CheckoutModal/TransferToken/TransferToken';
3
3
  import type { BaseActiveDropdownItemProps } from './BaseActiveDropdownItem';
4
4
  import { type BaseDropdownProps } from './BaseDropdown';
5
5
  interface ChainDropdownProps {
@@ -1,5 +1,5 @@
1
1
  import React, { type ReactNode } from 'react';
2
- import type { TokenTransferSourceChainsAndAssets } from '~/modals/CheckoutModal/TransferToken/TransferToken';
2
+ import type { TokenTransferSourceChainsAndAssets } from '../../modals/CheckoutModal/TransferToken/TransferToken';
3
3
  import type { BaseDropdownProps } from './BaseDropdown';
4
4
  interface TokenAndChainDropdownProps {
5
5
  isLoading: boolean;
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import type { TokenTransferSourceChainsAndAssets } from '~/modals/CheckoutModal/TransferToken/TransferToken';
2
+ import type { TokenTransferSourceChainsAndAssets } from '../../modals/CheckoutModal/TransferToken/TransferToken';
3
3
  import { type BaseDropdownProps } from './BaseDropdown';
4
4
  interface TokenDropdownProps {
5
5
  selectedChainId: number | undefined;
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import type { AssetHoldingsItem } from '~/utils/assets';
2
+ import type { AssetHoldingsItem } from '../../utils/assets';
3
3
  interface FunAssetItemProps {
4
4
  asset: AssetHoldingsItem;
5
5
  isActive?: boolean;
@@ -1,5 +1,5 @@
1
1
  import React, { type ReactNode } from 'react';
2
- import type { AddToWalletToken } from '~/providers/FunkitCheckoutContext';
2
+ import type { AddToWalletToken } from '../../providers/FunkitCheckoutContext';
3
3
  export type AddTokenToWalletBannerStatus = 'idle' | 'pending' | 'success' | 'error';
4
4
  interface AddTokenToWalletBannerProps {
5
5
  status: AddTokenToWalletBannerStatus;
@@ -1,5 +1,5 @@
1
1
  import { type FC } from 'react';
2
- import type { FunButtonProps } from '~/components/FunButton/FunButton';
2
+ import type { FunButtonProps } from '../../components/FunButton/FunButton';
3
3
  interface FunDirectExecutionHistoryBottomBarProps {
4
4
  isProcessing: boolean;
5
5
  isLoaded: boolean;
@@ -1,6 +1,6 @@
1
1
  import type { DirectExecution } from '@funkit/api-base';
2
2
  import React from 'react';
3
- import type { MergedMultiStepDirectExecution } from '~/domains/checkoutNotifications';
3
+ import type { MergedMultiStepDirectExecution } from '../../domains/checkoutNotifications';
4
4
  import type { TextConfigStatus, TextConfigSteps } from '../TransactionStatus/TransactionStatus';
5
5
  import type { FunDirectExecutionStatusProps } from './FunDirectExecutionStatus';
6
6
  export declare function FunDirectExecutionHistoryDetail({ bottomBarId, directExecution, isActiveCheckout, onClose, onAnimationComplete, showCheckoutStatus, customTextConfigStatus, customTextConfigSteps, dangerousCustomDelayedAutoTriggerCutoff, disableAutoUpdate, hideYouReceive, }: {
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
- import type { TextConfigSteps } from '~/components/TransactionStatus/TransactionStatus';
3
- import type { FunkitCheckoutQuoteResult } from '~/domains/quote';
2
+ import type { TextConfigSteps } from '../../components/TransactionStatus/TransactionStatus';
3
+ import type { FunkitCheckoutQuoteResult } from '../../domains/quote';
4
4
  export interface PendingSuccessScreenProps {
5
5
  bottomBarId: string;
6
6
  onClose: () => void;
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import type { HistoricalCheckoutItem } from '~/domains/clientMetadata';
2
+ import type { HistoricalCheckoutItem } from '../../domains/clientMetadata';
3
3
  export declare function YouSendItem({ clientMetadata, isLoaded, }: {
4
4
  clientMetadata: HistoricalCheckoutItem | undefined;
5
5
  isLoaded: boolean;
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import type { NotificationStatus } from '~/modals/CheckoutModal/TransferToken/CheckoutNotification';
2
+ import type { NotificationStatus } from '../../modals/CheckoutModal/TransferToken/CheckoutNotification';
3
3
  export interface FunNotificationBannerIconProps {
4
4
  iconUrl?: string | null;
5
5
  fallbackIconUrl?: string;
@@ -1,6 +1,6 @@
1
1
  import { type SwappedFormOfPayment } from '@funkit/api-base';
2
2
  import React, { type ReactNode } from 'react';
3
- import { type FunkitPaymentMethodIconsConfig } from '~/providers/FunkitConfigContext';
3
+ import { type FunkitPaymentMethodIconsConfig } from '../../providers/FunkitConfigContext';
4
4
  import { PaymentMethod, type PaymentMethodBrokerageInfo, type PaymentMethodVirtualBankInfo } from '../../domains/paymentMethods';
5
5
  import type { AssetHoldingsItem } from '../../domains/wallet';
6
6
  /**
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { type BrokerageOption } from '~/consts/bluvo';
2
+ import { type BrokerageOption } from '../../consts/bluvo';
3
3
  interface FunSelectBrokerageProps {
4
4
  isDisabled?: boolean;
5
5
  options: ReadonlyArray<BrokerageOption>;
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import type { FunkitCheckoutConfig } from '~/providers/FunkitCheckoutContext/types';
2
+ import type { FunkitCheckoutConfig } from '../../providers/FunkitCheckoutContext/types';
3
3
  /**
4
4
  * Renders integrator-provided destination yield metadata (Supply APY /
5
5
  * Collateralization) as rows. Driven by the customer-agnostic
@@ -1,8 +1,8 @@
1
1
  import React from 'react';
2
2
  import type { DirectExecutionType } from '@funkit/api-base';
3
- import type { FunkitCheckoutQuoteResult } from '~/domains/quote';
4
- import type { QuoteDisplayAmounts } from '~/domains/quoteMode';
5
- import type { FunkitActiveCheckoutItem } from '~/providers/FunkitCheckoutContext';
3
+ import type { FunkitCheckoutQuoteResult } from '../../domains/quote';
4
+ import type { QuoteDisplayAmounts } from '../../domains/quoteMode';
5
+ import type { FunkitActiveCheckoutItem } from '../../providers/FunkitCheckoutContext';
6
6
  interface PaymentAmountSummaryProps {
7
7
  isLoading: boolean;
8
8
  targetChainId: string;
@@ -1,6 +1,6 @@
1
1
  import React, { type ReactNode } from 'react';
2
- import type { CheckoutFees } from '~/domains/fees';
3
- import type { FunkitCheckoutQuoteResult } from '~/domains/quote';
2
+ import type { CheckoutFees } from '../../domains/fees';
3
+ import type { FunkitCheckoutQuoteResult } from '../../domains/quote';
4
4
  import { type FunTooltipProps } from '../FunTooltip/FunTooltip';
5
5
  export declare const NO_DATA_VALUE = "-";
6
6
  interface PaymentFeesSummaryProps {
@@ -1,4 +1,4 @@
1
- import type { TrackEventData } from '~/hooks/track/useTrack';
2
- import type { FunkitActiveCheckoutItem } from '~/providers/FunkitCheckoutContext';
1
+ import type { TrackEventData } from '../../hooks/track/useTrack';
2
+ import type { FunkitActiveCheckoutItem } from '../../providers/FunkitCheckoutContext';
3
3
  import type { FeeItem } from './PaymentFeesSummary';
4
4
  export declare const trackEventFromPaymentFeesSummary: (checkoutItem: FunkitActiveCheckoutItem, feeItems: FeeItem[], isWithdrawal: boolean) => TrackEventData;
@@ -1,7 +1,7 @@
1
1
  import type { FunAddress } from '@funkit/api-base';
2
2
  import React from 'react';
3
- import type { PaymentMethodInfo } from '~/domains/paymentMethods';
4
- import type { FunkitCheckoutConfig } from '~/providers/FunkitCheckoutContext/types';
3
+ import type { PaymentMethodInfo } from '../../domains/paymentMethods';
4
+ import type { FunkitCheckoutConfig } from '../../providers/FunkitCheckoutContext/types';
5
5
  interface PaymentMethodSummaryProps {
6
6
  paymentMethodInfo: PaymentMethodInfo;
7
7
  customRecipient: FunAddress | undefined;
@@ -1,6 +1,6 @@
1
1
  import type { FunAddress } from '@funkit/api-base';
2
2
  import React, { type ReactNode } from 'react';
3
- import { type PaymentMethodInfo } from '~/domains/paymentMethods';
3
+ import { type PaymentMethodInfo } from '../../domains/paymentMethods';
4
4
  type PaymentRouteSummaryProps = {
5
5
  paymentMethodInfo: PaymentMethodInfo | null;
6
6
  customRecipient: FunAddress | undefined;
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
- import { type FunkitCheckoutConfig } from '~/index';
3
- import { FunCheckoutStep } from '~/modals/CheckoutModal/stepTransition';
2
+ import { type FunkitCheckoutConfig } from '../../index';
3
+ import { FunCheckoutStep } from '../../modals/CheckoutModal/stepTransition';
4
4
  interface FunCheckoutModalHeightAnimationWrapperProps {
5
5
  children: React.ReactNode;
6
6
  checkoutConfig?: FunkitCheckoutConfig;
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import type { TransferTokenDefault } from '~/hooks/useTokenAndChainDropdown';
2
+ import type { TransferTokenDefault } from '../../hooks/useTokenAndChainDropdown';
3
3
  interface NewTokenDepositAlertProps {
4
4
  onClick: (value: TransferTokenDefault) => void;
5
5
  }
@@ -1,7 +1,7 @@
1
1
  import type { ApiFunkitCheckoutQuoteResult } from '@funkit/utils';
2
2
  import React, { type ReactNode } from 'react';
3
- import type { ServerCheckoutConfig } from '~/domains/clientMetadata';
4
- import type { FunkitCheckoutConfig } from '~/providers/FunkitCheckoutContext';
3
+ import type { ServerCheckoutConfig } from '../../domains/clientMetadata';
4
+ import type { FunkitCheckoutConfig } from '../../providers/FunkitCheckoutContext';
5
5
  interface ReceiveAmountProps {
6
6
  config: ServerCheckoutConfig | FunkitCheckoutConfig;
7
7
  /** To override the default icon if custom one is needed */
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { PaymentMethod } from '~/domains/paymentMethods';
2
+ import { PaymentMethod } from '../../domains/paymentMethods';
3
3
  import { type FunPaymentMethodItemProps } from '../FunPaymentMethodItem/FunPaymentMethodItem';
4
4
  interface SourcePaymentMethodItemProps extends Omit<FunPaymentMethodItemProps, 'valueIcon'> {
5
5
  type: PaymentMethod;
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import type { CheckoutProgressStep } from '~/providers/FunkitCheckoutContext';
2
+ import type { CheckoutProgressStep } from '../../../providers/FunkitCheckoutContext';
3
3
  import type { TransactionStatusProps } from '../TransactionStatus';
4
4
  interface AnimatedSpinnerProps {
5
5
  currentStatus: TransactionStatusProps['status'];
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import type { CheckoutProgressStep } from '~/providers/FunkitCheckoutContext';
2
+ import type { CheckoutProgressStep } from '../../providers/FunkitCheckoutContext';
3
3
  export declare const STEP_SPINNER_MORPH_DEGREES = 45;
4
4
  export declare const STEP_SPINNER_MORPH_MAX_OFFSET = 4;
5
5
  export declare const STEP_SPINNER_SIZE_BIG_SCALE = 1;