@funkit/connect 11.7.0 → 12.1.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.
- package/CHANGELOG.md +57 -0
- package/dist/{chunk-67BKQQNG.js → chunk-2RND3WWH.js} +1 -1
- package/dist/{chunk-L67HP4HQ.js → chunk-53FF4ZHH.js} +1 -1
- package/dist/{chunk-4YEAUICE.js → chunk-DH3DS4FX.js} +1 -0
- package/dist/clients/{chunk-SG4ZS447.js → chunk-27VBRE7W.js} +79 -15
- package/dist/clients/{chunk-OASVWVSV.js → chunk-A5JW3UI6.js} +1 -1
- package/dist/clients/chunk-DNVDK7JQ.js +335 -0
- package/dist/clients/{chunk-FGUMPXTO.js → chunk-DYV3LRSE.js} +1 -1
- package/dist/clients/{chunk-44USAVWK.js → chunk-ECGTOMZQ.js} +2 -2
- package/dist/clients/{chunk-IYCZWLAF.js → chunk-IAIRECDV.js} +8 -37
- package/dist/clients/{chunk-I4B5AKZC.js → chunk-R6UAC2TB.js} +1 -1
- package/dist/clients/chunk-RQALGV5U.js +335 -0
- package/dist/clients/{chunk-Y7WLUPTX.js → chunk-VE6QD5IM.js} +67 -16
- package/dist/clients/fanatics.css +4686 -4659
- package/dist/clients/fanatics.js +7 -9
- package/dist/clients/internal/nado/withdrawalCallback.js +3 -3
- package/dist/clients/internal/nado/withdrawalErrors.js +2 -2
- package/dist/clients/internal/nado/withdrawalForm.css +4704 -4677
- package/dist/clients/internal/nado/withdrawalForm.js +38 -13
- package/dist/clients/internal/nado/withdrawalStatus.js +3 -3
- package/dist/clients/lighter.css +4704 -4677
- package/dist/clients/lighter.js +50 -30
- package/dist/clients/mallard.js +4 -4
- package/dist/clients/nado.js +3 -3
- package/dist/clients/polymarket/createPolymarketDepositConfig.d.ts +28 -19
- package/dist/clients/polymarket/createPolymarketDepositConfig.js +5 -4
- package/dist/clients/polymarket/index.d.ts +0 -1
- package/dist/clients/polymarket/index.js +4 -17
- package/dist/clients/polymarket/polymarket.d.ts +12 -27
- package/dist/clients/polymarket/polymarket.js +1 -1
- package/dist/components/AsyncImage/useAsyncImage.d.ts +2 -0
- package/dist/components/Box/Box.d.ts +15 -15
- package/dist/components/Dialog/Dialog.d.ts +8 -1
- package/dist/components/FunTransactionSummary/PaymentFeesSummary.d.ts +4 -1
- package/dist/components/FunTransactionSummary/PaymentFeesSummary.track.d.ts +12 -0
- package/dist/components/ModalHeaderTabs/ModalHeaderTabs.d.ts +23 -0
- package/dist/consts/polymarket.d.ts +14 -0
- package/dist/css/sprinkles.css.d.ts +17 -15
- package/dist/domains/polymarketPerps.d.ts +14 -0
- package/dist/hooks/queries/useFops.d.ts +3 -1
- package/dist/hooks/queries/useWithdrawalQuote.d.ts +7 -0
- package/dist/hooks/statsig/index.d.ts +1 -0
- package/dist/hooks/statsig/useExperimentV2.d.ts +8 -0
- package/dist/hooks/track/CheckoutModalEvent.d.ts +1 -0
- package/dist/hooks/track/analytics/events.d.ts +67 -0
- package/dist/hooks/track/analytics/mappers.d.ts +4 -1
- package/dist/hooks/track/analytics/quote.d.ts +3 -1
- package/dist/hooks/track/analytics/useWithdrawalAnalytics.d.ts +27 -3
- package/dist/hooks/track/useTrack.d.ts +1 -1
- package/dist/hooks/track/user.d.ts +8 -0
- package/dist/hooks/useCheckoutTransferInit.d.ts +3 -1
- package/dist/hooks/useFittedText.d.ts +19 -0
- package/dist/hooks/usePolymarketAccountBalances.d.ts +13 -25
- package/dist/hooks/useUpdateActiveFunkitCheckout.d.ts +10 -0
- package/dist/index.css +4704 -4677
- package/dist/index.js +5078 -3730
- package/dist/modals/CheckoutModal/CheckoutModalPrefetchedHooks.d.ts +2 -1
- package/dist/modals/CheckoutModal/InputAmount/InputAmount.d.ts +1 -1
- package/dist/modals/CheckoutModal/InputAmount/state.d.ts +10 -0
- package/dist/modals/CheckoutModal/InputAmount/useAmountInput.d.ts +1 -0
- package/dist/modals/CheckoutModal/SourceChange/CryptoCashToggle.d.ts +6 -1
- package/dist/modals/PolymarketPerpsTransfer/DirectionSwapButton.d.ts +1 -11
- package/dist/modals/PolymarketPerpsTransfer/PerpsHeaderTabs.d.ts +29 -0
- package/dist/modals/PolymarketPerpsTransfer/PerpsTransferAmountInput.css.d.ts +9 -0
- package/dist/modals/PolymarketPerpsTransfer/PerpsTransferAmountInput.d.ts +15 -0
- package/dist/modals/PolymarketPerpsTransfer/PerpsTransferBody.d.ts +12 -0
- package/dist/modals/PolymarketPerpsTransfer/PolymarketPerpsPrefetch.d.ts +7 -0
- package/dist/modals/PolymarketPerpsTransfer/PolymarketPerpsTransferScreen.d.ts +16 -2
- package/dist/modals/PolymarketPerpsTransfer/TransferAccountsCard.d.ts +12 -0
- package/dist/modals/PolymarketPerpsTransfer/TransferActionButton.d.ts +8 -1
- package/dist/modals/PolymarketPerpsTransfer/TransferPercentOptions.d.ts +13 -0
- package/dist/modals/PolymarketPerpsTransfer/usePerpsHeaderTabsState.d.ts +28 -0
- package/dist/modals/PolymarketPerpsTransfer/usePerpsTransferForm.d.ts +31 -5
- package/dist/modals/WithdrawalModal/LighterWithdrawal.d.ts +6 -0
- package/dist/modals/WithdrawalModal/RecipientAddress.d.ts +0 -5
- package/dist/modals/WithdrawalModal/useTrackWithdrawalEvents.d.ts +8 -1
- package/dist/modals/WithdrawalModal/useTrackWithdrawalQuoteEvents.d.ts +16 -0
- package/dist/modals/WithdrawalModal/useWithdrawalChainPreference.d.ts +17 -0
- package/dist/modals/WithdrawalModal/withdrawalHooks.d.ts +2 -1
- package/dist/providers/FunkitCheckoutContext/index.d.ts +13 -1
- package/dist/providers/FunkitCheckoutContext/types.d.ts +30 -3
- package/dist/providers/FunkitConfigContext.d.ts +1 -1
- package/dist/providers/FunkitStatsigProvider.d.ts +2 -7
- package/dist/providers/FunkitStatsigWhnProvider.d.ts +17 -0
- package/dist/providers/FunkitThemeProvider.d.ts +3 -0
- package/dist/providers/GeneralWalletProvider.d.ts +1 -0
- package/dist/shadow-css.js +1 -1
- package/dist/themes/baseTheme.js +1 -1
- package/dist/themes/darkTheme.js +2 -2
- package/dist/themes/lightTheme.js +2 -2
- package/dist/utils/statsig/client.d.ts +4 -0
- package/dist/wallets/walletConnectors/bifrostWallet/bifrostWallet.js +2 -2
- package/dist/wallets/walletConnectors/bitgetWallet/bitgetWallet.js +2 -2
- package/dist/wallets/walletConnectors/bybitWallet/bybitWallet.js +2 -2
- package/dist/wallets/walletConnectors/clvWallet/clvWallet.js +2 -2
- package/dist/wallets/walletConnectors/coin98Wallet/coin98Wallet.js +2 -2
- package/dist/wallets/walletConnectors/coreWallet/coreWallet.js +2 -2
- package/dist/wallets/walletConnectors/foxWallet/foxWallet.js +2 -2
- package/dist/wallets/walletConnectors/frontierWallet/frontierWallet.js +2 -2
- package/dist/wallets/walletConnectors/gateWallet/gateWallet.js +2 -2
- package/dist/wallets/walletConnectors/index.js +46 -46
- package/dist/wallets/walletConnectors/metaMaskWallet/metaMaskWallet.js +2 -2
- package/dist/wallets/walletConnectors/okxWallet/okxWallet.js +2 -2
- package/dist/wallets/walletConnectors/rainbowWallet/rainbowWallet.js +2 -2
- package/dist/wallets/walletConnectors/roninWallet/roninWallet.js +2 -2
- package/dist/wallets/walletConnectors/safepalWallet/safepalWallet.js +2 -2
- package/dist/wallets/walletConnectors/subWallet/subWallet.js +2 -2
- package/dist/wallets/walletConnectors/tokenPocketWallet/tokenPocketWallet.js +2 -2
- package/dist/wallets/walletConnectors/trustWallet/trustWallet.js +2 -2
- package/dist/wallets/walletConnectors/zerionWallet/zerionWallet.js +2 -2
- package/package.json +5 -5
- package/dist/clients/chunk-AXLGZ5XX.js +0 -1325
- package/dist/clients/chunk-DSZHYQPX.js +0 -31
- package/dist/clients/chunk-HZP4DXIZ.js +0 -231
- package/dist/clients/chunk-LUHEVXPD.js +0 -109
- package/dist/clients/chunk-NM2NAKI3.js +0 -1195
- package/dist/clients/polymarket/PolymarketDepositAccountDropdown.css +0 -17545
- package/dist/clients/polymarket/PolymarketDepositAccountDropdown.d.ts +0 -30
- package/dist/clients/polymarket/PolymarketDepositAccountDropdown.js +0 -20
- package/dist/clients/polymarket/index.css +0 -17545
- package/dist/modals/PolymarketPerpsTransfer/PerpsTransferRows.d.ts +0 -10
- package/dist/modals/PolymarketPerpsTransfer/TransferAmountRow.css.d.ts +0 -13
- package/dist/modals/PolymarketPerpsTransfer/TransferAmountRow.d.ts +0 -27
- package/dist/wallets/walletConnectors/{chunk-W2LCLDPX.js → chunk-2VP2F6EK.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-IULPZP2Q.js → chunk-4T6ZSRJF.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-WAHGI5L7.js → chunk-6BW3HLBG.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-YO2K4MBH.js → chunk-CCQV2ZET.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-TKB2OY6G.js → chunk-CPI4TD43.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-OX37G4YT.js → chunk-F5XEEVG6.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-JPN6TWIT.js → chunk-HNRB7KJU.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-WKNQMP4A.js → chunk-HTHAK6XB.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-GUQM4QSL.js → chunk-MIQTHJ6X.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-4NV5BYRP.js → chunk-RB3HR4R2.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-SWFF3TWJ.js → chunk-RVOY537T.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-KI5Y2BBF.js → chunk-STVVP43G.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-OEEGYENV.js → chunk-UK7C2JXW.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-YQFGVZGR.js → chunk-VAPGUPHO.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-XCNHV3HS.js → chunk-VTM6EECM.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-NR2OGDHQ.js → chunk-X6CGV36L.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-AVDUNQUW.js → chunk-YEZM4CK4.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-KCRO2AGO.js → chunk-ZNX4EMPB.js} +3 -3
|
@@ -8,11 +8,13 @@ interface CheckoutQuoteParams {
|
|
|
8
8
|
/** Extra gate ANDed into the internal enabled conditions (default true). */
|
|
9
9
|
isEnabled?: boolean;
|
|
10
10
|
}
|
|
11
|
+
export declare const PLACEHOLDER_WITHDRAWAL_WALLET_ADDRESS = "0x0000000000000000000000000000000000000000";
|
|
11
12
|
/**
|
|
12
13
|
* Simplified quoting logic used for withdrawal UI only.
|
|
13
14
|
*/
|
|
14
15
|
export declare function useWithdrawalQuote({ recipientAddress, selectedChainId, selectedTokenAddress, selectedTokenSymbol, config, isEnabled, }: CheckoutQuoteParams): {
|
|
15
16
|
quoteEnabled: boolean;
|
|
17
|
+
withdrawalWalletAddress: `0x${string}`;
|
|
16
18
|
data: {
|
|
17
19
|
baseQuote: import("@funkit/utils").CheckoutQuoteResponse;
|
|
18
20
|
checkedAssetAmount: import("../../domains/quote").CheckedAssetAmount;
|
|
@@ -52,6 +54,7 @@ export declare function useWithdrawalQuote({ recipientAddress, selectedChainId,
|
|
|
52
54
|
} | null>;
|
|
53
55
|
} | {
|
|
54
56
|
quoteEnabled: boolean;
|
|
57
|
+
withdrawalWalletAddress: `0x${string}`;
|
|
55
58
|
data: {
|
|
56
59
|
baseQuote: import("@funkit/utils").CheckoutQuoteResponse;
|
|
57
60
|
checkedAssetAmount: import("../../domains/quote").CheckedAssetAmount;
|
|
@@ -91,6 +94,7 @@ export declare function useWithdrawalQuote({ recipientAddress, selectedChainId,
|
|
|
91
94
|
} | null>;
|
|
92
95
|
} | {
|
|
93
96
|
quoteEnabled: boolean;
|
|
97
|
+
withdrawalWalletAddress: `0x${string}`;
|
|
94
98
|
data: undefined;
|
|
95
99
|
error: Error;
|
|
96
100
|
isError: true;
|
|
@@ -126,6 +130,7 @@ export declare function useWithdrawalQuote({ recipientAddress, selectedChainId,
|
|
|
126
130
|
} | null>;
|
|
127
131
|
} | {
|
|
128
132
|
quoteEnabled: boolean;
|
|
133
|
+
withdrawalWalletAddress: `0x${string}`;
|
|
129
134
|
data: undefined;
|
|
130
135
|
error: null;
|
|
131
136
|
isError: false;
|
|
@@ -161,6 +166,7 @@ export declare function useWithdrawalQuote({ recipientAddress, selectedChainId,
|
|
|
161
166
|
} | null>;
|
|
162
167
|
} | {
|
|
163
168
|
quoteEnabled: boolean;
|
|
169
|
+
withdrawalWalletAddress: `0x${string}`;
|
|
164
170
|
data: undefined;
|
|
165
171
|
error: null;
|
|
166
172
|
isError: false;
|
|
@@ -196,6 +202,7 @@ export declare function useWithdrawalQuote({ recipientAddress, selectedChainId,
|
|
|
196
202
|
} | null>;
|
|
197
203
|
} | {
|
|
198
204
|
quoteEnabled: boolean;
|
|
205
|
+
withdrawalWalletAddress: `0x${string}`;
|
|
199
206
|
data: {
|
|
200
207
|
baseQuote: import("@funkit/utils").CheckoutQuoteResponse;
|
|
201
208
|
checkedAssetAmount: import("../../domains/quote").CheckedAssetAmount;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reads an experiment parameter from the secondary Fun WHN Statsig client.
|
|
3
|
+
*
|
|
4
|
+
* The secondary client is not mounted in a StatsigProvider, so this hook
|
|
5
|
+
* subscribes to `values_updated` directly. That keeps the returned value in
|
|
6
|
+
* sync after client initialization and user updates.
|
|
7
|
+
*/
|
|
8
|
+
export declare function useExperimentV2<T>(experimentName: string, parameterName: string, fallback: T): T;
|
|
@@ -47,6 +47,7 @@ export declare enum CheckoutModalEvent {
|
|
|
47
47
|
TOKEN_TRANSFER_SUCCESS = "fc::success::token_transfer",
|
|
48
48
|
BLUVO_WITHDRAWAL_COMPLETED = "fc::success::bluvo_withdrawal_completed",
|
|
49
49
|
QUICK_OPTION_SELECTED = "fc::input_amount::quick_option_selected",
|
|
50
|
+
PERPS_TRANSFER_PERCENT_OPTION_SELECTED = "fc::perps_transfer::percent_option_selected",
|
|
50
51
|
SWAPPED_IFRAME_NAVIGATION = "fc::swapped_iframe::navigation",
|
|
51
52
|
SWAPPED_IFRAME_NAVIGATION_INITIAL = "fc::swapped_iframe::navigation::initial",
|
|
52
53
|
SWAPPED_IFRAME_NAVIGATION_LOGIN = "fc::swapped_iframe::navigation::login",
|
|
@@ -2,7 +2,9 @@ import type { QuoteMode } from '../../../domains/quoteMode';
|
|
|
2
2
|
import type { DirectExecutionType } from '@funkit/api-base';
|
|
3
3
|
import type { CheckoutStatus } from '../../../domains/checkout';
|
|
4
4
|
import type { PaymentMethodType } from '../../../hooks/usePaymentSources';
|
|
5
|
+
import type { FunCheckoutStep } from '../../../modals/CheckoutModal/FunCheckoutStep';
|
|
5
6
|
import type { AmountSelectionType } from '../../../modals/CheckoutModal/InputAmount/state';
|
|
7
|
+
import type { WithdrawalModalStep } from '../../../modals/WithdrawalModal/types';
|
|
6
8
|
/**
|
|
7
9
|
* Analytics v2 — the improved, explicit Statsig event scheme that will replace
|
|
8
10
|
* the `fc::`/`fw::` enums in `../CheckoutModalEvent.ts` / `../WithdrawModalEvent.ts`.
|
|
@@ -22,18 +24,25 @@ export declare enum AnalyticsEvent {
|
|
|
22
24
|
DEPOSIT_QUOTE_CONFIRMED = "fc_deposit_quote_confirmed",
|
|
23
25
|
DEPOSIT_SUCCEEDED = "fc_deposit_succeeded",
|
|
24
26
|
DEPOSIT_TRANSFER_INTERACTED = "fc_deposit_transfer_interacted",
|
|
27
|
+
DEPOSIT_TRANSACTION_BREAKDOWN_CLICKED = "fc_deposit_transaction_breakdown_clicked",
|
|
25
28
|
DEPOSIT_TRANSACTION_SUBMITTED = "fc_deposit_transaction_submitted",
|
|
26
29
|
MODAL_OPENED = "fc_modal_opened",
|
|
30
|
+
STEP_VIEWED = "fc_step_viewed",
|
|
27
31
|
TAB_SWITCHED = "fc_tab_switched",
|
|
28
32
|
WITHDRAWAL_AMOUNT_CONFIRMED = "fc_withdrawal_amount_confirmed",
|
|
29
33
|
WITHDRAWAL_FAILED = "fc_withdrawal_failed",
|
|
34
|
+
WITHDRAWAL_METHOD_SELECTED = "fc_withdrawal_method_selected",
|
|
35
|
+
WITHDRAWAL_QUOTE_DISPLAYED = "fc_withdrawal_quote_displayed",
|
|
36
|
+
WITHDRAWAL_QUOTE_CONFIRMED = "fc_withdrawal_quote_confirmed",
|
|
30
37
|
WITHDRAWAL_SUCCEEDED = "fc_withdrawal_succeeded",
|
|
38
|
+
WITHDRAWAL_TRANSACTION_BREAKDOWN_CLICKED = "fc_withdrawal_transaction_breakdown_clicked",
|
|
31
39
|
WITHDRAWAL_TRANSFER_INTERACTED = "fc_withdrawal_transfer_interacted",
|
|
32
40
|
WITHDRAWAL_TRANSACTION_SUBMITTED = "fc_withdrawal_transaction_submitted"
|
|
33
41
|
}
|
|
34
42
|
export type ConnectionStatus = 'new' | 'existing';
|
|
35
43
|
export type AnalyticsFlow = 'deposit' | 'withdraw';
|
|
36
44
|
export type AnalyticsPaymentRail = 'bluvo' | 'swapped' | 'meld' | 'bridge';
|
|
45
|
+
export type AnalyticsStep = Lowercase<FunCheckoutStep | WithdrawalModalStep>;
|
|
37
46
|
/** Envelope carried by every analytics-v2 event. */
|
|
38
47
|
export type CommonProperties = {
|
|
39
48
|
/**
|
|
@@ -142,6 +151,10 @@ export type VisibleQuoteFeeProperties = {
|
|
|
142
151
|
swap_impact_pct: number | null;
|
|
143
152
|
wallet_gas_cost_usd: number | null;
|
|
144
153
|
};
|
|
154
|
+
/** Payload emitted when the user manually expands a transaction breakdown. */
|
|
155
|
+
export type TransactionBreakdownClickedProperties = PaymentMethodProperties & VisibleQuoteFeeProperties & {
|
|
156
|
+
step: AnalyticsStep;
|
|
157
|
+
};
|
|
145
158
|
/** Route fields shared by quote-bearing and later lifecycle events. */
|
|
146
159
|
export type DepositRouteContextProperties = DepositAssetContextProperties & {
|
|
147
160
|
destination_address: string | null;
|
|
@@ -222,6 +235,24 @@ export type TabSwitchedProperties = {
|
|
|
222
235
|
switch_count: number;
|
|
223
236
|
tab: PaymentMethodType;
|
|
224
237
|
};
|
|
238
|
+
export type StepViewedProperties = {
|
|
239
|
+
flow: AnalyticsFlow;
|
|
240
|
+
/**
|
|
241
|
+
* Whether the user initiated a back navigation gesture. Note that we support
|
|
242
|
+
* back navigation by step name, which falls back to pushing the step instead
|
|
243
|
+
* if it's not already in history. Thus, `step_index` may still be incremented
|
|
244
|
+
* even if `is_back_navigation` is true.
|
|
245
|
+
*/
|
|
246
|
+
is_back_navigation: boolean;
|
|
247
|
+
prev_step: AnalyticsStep | null;
|
|
248
|
+
step: AnalyticsStep;
|
|
249
|
+
/**
|
|
250
|
+
* 1-based index of the step being entered. When navigating backward, we attempt
|
|
251
|
+
* to preserve the original index of the step when it was first entered. When
|
|
252
|
+
* navigating forward, it is incremented by 1.
|
|
253
|
+
*/
|
|
254
|
+
step_index: number;
|
|
255
|
+
};
|
|
225
256
|
export type DepositTransferInteractionAction = 'address_copied' | 'chain_changed' | 'token_changed';
|
|
226
257
|
export type DepositTransferInteractedProperties = {
|
|
227
258
|
action: DepositTransferInteractionAction;
|
|
@@ -240,6 +271,11 @@ export type DepositTransferInteractedProperties = {
|
|
|
240
271
|
target_asset_ticker: string | null;
|
|
241
272
|
target_chain: string;
|
|
242
273
|
};
|
|
274
|
+
/** Payload specific to {@link AnalyticsEvent.WITHDRAWAL_METHOD_SELECTED}. */
|
|
275
|
+
export type WithdrawalMethodSelectedProperties = PaymentMethodProperties & {
|
|
276
|
+
connection_status: ConnectionStatus | null;
|
|
277
|
+
payment_rail: AnalyticsPaymentRail | null;
|
|
278
|
+
};
|
|
243
279
|
export type WithdrawalTransferInteractionAction = 'address_autofilled' | 'address_changed' | 'amount_changed' | 'chain_changed' | 'max_button_clicked' | 'token_changed';
|
|
244
280
|
/** Payload specific to {@link AnalyticsEvent.WITHDRAWAL_TRANSFER_INTERACTED}. */
|
|
245
281
|
export type WithdrawalTransferInteractedProperties = PaymentMethodProperties & {
|
|
@@ -259,6 +295,31 @@ export type WithdrawalTransferInteractedProperties = PaymentMethodProperties & {
|
|
|
259
295
|
target_asset_ticker: string | null;
|
|
260
296
|
target_chain: string | null;
|
|
261
297
|
};
|
|
298
|
+
/** Route/quote fields shared by the withdrawal quote-lifecycle events. */
|
|
299
|
+
export type WithdrawalQuoteSnapshotProperties = PaymentMethodProperties & VisibleQuoteFeeProperties & {
|
|
300
|
+
destination_address: string | null;
|
|
301
|
+
/** Estimated fulfillment time in milliseconds. */
|
|
302
|
+
est_fulfillment_time_ms: number | null;
|
|
303
|
+
execution_type: DirectExecutionType | null;
|
|
304
|
+
sender_address: string | null;
|
|
305
|
+
source_amount: string;
|
|
306
|
+
source_chain: string;
|
|
307
|
+
source_asset: string;
|
|
308
|
+
source_asset_ticker: string | null;
|
|
309
|
+
target_amount: string | null;
|
|
310
|
+
target_chain: string;
|
|
311
|
+
target_asset: string;
|
|
312
|
+
target_asset_ticker: string | null;
|
|
313
|
+
trade_type: QuoteMode;
|
|
314
|
+
};
|
|
315
|
+
/** Quote snapshot plus quote-lifecycle metadata. */
|
|
316
|
+
export type WithdrawalQuoteContextProperties = WithdrawalQuoteSnapshotProperties & {
|
|
317
|
+
num_quote_refreshes: number;
|
|
318
|
+
};
|
|
319
|
+
/** Payload specific to {@link AnalyticsEvent.WITHDRAWAL_QUOTE_DISPLAYED}. */
|
|
320
|
+
export type WithdrawalQuoteDisplayedProperties = WithdrawalQuoteContextProperties;
|
|
321
|
+
/** Payload specific to {@link AnalyticsEvent.WITHDRAWAL_QUOTE_CONFIRMED}. */
|
|
322
|
+
export type WithdrawalQuoteConfirmedProperties = WithdrawalQuoteContextProperties;
|
|
262
323
|
export type AnalyticsEventProperties = {
|
|
263
324
|
[AnalyticsEvent.ACCOUNT_CONNECT_COMPLETED]: AccountConnectProperties;
|
|
264
325
|
[AnalyticsEvent.ACCOUNT_CONNECT_FAILED]: AccountConnectFailedProperties;
|
|
@@ -273,12 +334,18 @@ export type AnalyticsEventProperties = {
|
|
|
273
334
|
[AnalyticsEvent.DEPOSIT_QUOTE_CONFIRMED]: DepositQuoteConfirmedProperties;
|
|
274
335
|
[AnalyticsEvent.DEPOSIT_SUCCEEDED]: ExecutionSucceededProperties;
|
|
275
336
|
[AnalyticsEvent.DEPOSIT_TRANSFER_INTERACTED]: DepositTransferInteractedProperties;
|
|
337
|
+
[AnalyticsEvent.DEPOSIT_TRANSACTION_BREAKDOWN_CLICKED]: TransactionBreakdownClickedProperties;
|
|
276
338
|
[AnalyticsEvent.DEPOSIT_TRANSACTION_SUBMITTED]: TransactionSubmittedProperties;
|
|
277
339
|
[AnalyticsEvent.MODAL_OPENED]: ModalOpenedProperties;
|
|
340
|
+
[AnalyticsEvent.STEP_VIEWED]: StepViewedProperties;
|
|
278
341
|
[AnalyticsEvent.TAB_SWITCHED]: TabSwitchedProperties;
|
|
279
342
|
[AnalyticsEvent.WITHDRAWAL_AMOUNT_CONFIRMED]: WithdrawalAmountConfirmedProperties;
|
|
280
343
|
[AnalyticsEvent.WITHDRAWAL_FAILED]: ExecutionFailedProperties;
|
|
344
|
+
[AnalyticsEvent.WITHDRAWAL_METHOD_SELECTED]: WithdrawalMethodSelectedProperties;
|
|
345
|
+
[AnalyticsEvent.WITHDRAWAL_QUOTE_DISPLAYED]: WithdrawalQuoteDisplayedProperties;
|
|
346
|
+
[AnalyticsEvent.WITHDRAWAL_QUOTE_CONFIRMED]: WithdrawalQuoteConfirmedProperties;
|
|
281
347
|
[AnalyticsEvent.WITHDRAWAL_SUCCEEDED]: ExecutionSucceededProperties;
|
|
348
|
+
[AnalyticsEvent.WITHDRAWAL_TRANSACTION_BREAKDOWN_CLICKED]: TransactionBreakdownClickedProperties;
|
|
282
349
|
[AnalyticsEvent.WITHDRAWAL_TRANSFER_INTERACTED]: WithdrawalTransferInteractedProperties;
|
|
283
350
|
[AnalyticsEvent.WITHDRAWAL_TRANSACTION_SUBMITTED]: TransactionSubmittedProperties;
|
|
284
351
|
};
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { FormOfPaymentType, type MeldServiceProvider } from '@funkit/api-base';
|
|
2
2
|
import { PaymentMethod, type PaymentMethodInfo } from '../../../domains/paymentMethods';
|
|
3
|
-
import type { PaymentMethodProperties } from './events';
|
|
3
|
+
import type { AnalyticsStep, PaymentMethodProperties } from './events';
|
|
4
|
+
import type { FunCheckoutStep } from '../../../modals/CheckoutModal/FunCheckoutStep';
|
|
5
|
+
import type { WithdrawalModalStep } from '../../../modals/WithdrawalModal/types';
|
|
4
6
|
/** Round analytics amounts before Statsig stringifies event metadata. */
|
|
5
7
|
export declare function formatAnalyticsAmount(amount: number | null): string | null;
|
|
8
|
+
export declare function formatAnalyticsStep(step: FunCheckoutStep | WithdrawalModalStep): AnalyticsStep;
|
|
6
9
|
export declare function getHistoricalSourceAddress(sourceOfFund: string | null | undefined): string | null;
|
|
7
10
|
/** Selected checkout provider, such as a Bluvo exchange or wallet connector. */
|
|
8
11
|
export declare function resolveProvider(args: {
|
|
@@ -9,4 +9,6 @@ export declare const NULL_VISIBLE_QUOTE_FEE_PROPERTIES: VisibleQuoteFeePropertie
|
|
|
9
9
|
* network/impact rows; other rails report their own cost row from
|
|
10
10
|
* `finalFeesBreakdown` and leave the Relay-specific rows null.
|
|
11
11
|
*/
|
|
12
|
-
export declare function resolveVisibleQuoteFeeProperties(latestQuote: ApiFunkitCheckoutQuoteResult | FunkitCheckoutQuoteResult | null
|
|
12
|
+
export declare function resolveVisibleQuoteFeeProperties(latestQuote: ApiFunkitCheckoutQuoteResult | FunkitCheckoutQuoteResult | null, { extraSourceChainGasUsd }?: {
|
|
13
|
+
extraSourceChainGasUsd?: number;
|
|
14
|
+
}): VisibleQuoteFeeProperties;
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
type
|
|
1
|
+
import type { DirectExecutionType, FormOfPaymentType } from '@funkit/api-base';
|
|
2
|
+
import type { FunkitCheckoutQuoteResult } from '../../../domains/quote';
|
|
3
|
+
import { PaymentMethod } from '../../../domains/paymentMethods';
|
|
4
|
+
import { type AnalyticsPaymentRail, type ConnectionStatus, type WithdrawalAmountSelectionType, type WithdrawalTransferInteractionAction } from './events';
|
|
5
|
+
export type AssetDescriptorArgs = {
|
|
3
6
|
chainId: string;
|
|
4
7
|
tokenAddress: string;
|
|
5
8
|
ticker: string | null;
|
|
@@ -11,6 +14,14 @@ export type TrackWithdrawalAmountConfirmedArgs = {
|
|
|
11
14
|
target: AssetDescriptorArgs;
|
|
12
15
|
targetAmount: number | null;
|
|
13
16
|
};
|
|
17
|
+
export type TrackWithdrawalMethodSelectedArgs = {
|
|
18
|
+
connectionStatus?: ConnectionStatus;
|
|
19
|
+
/** Some Swapped methods can't be mapped to PaymentMethod and are forwarded as-is. */
|
|
20
|
+
paymentMethod: PaymentMethod | FormOfPaymentType;
|
|
21
|
+
paymentRail?: AnalyticsPaymentRail;
|
|
22
|
+
/** Selected checkout provider, such as a Bluvo exchange or a Lighter method id. */
|
|
23
|
+
provider?: string;
|
|
24
|
+
};
|
|
14
25
|
export type TrackWithdrawalTransferInteractedArgs = {
|
|
15
26
|
action: WithdrawalTransferInteractionAction;
|
|
16
27
|
balanceAmount: string | null;
|
|
@@ -33,9 +44,22 @@ export type TrackWithdrawalTransferInteractedArgs = {
|
|
|
33
44
|
chain: string | null;
|
|
34
45
|
};
|
|
35
46
|
};
|
|
47
|
+
export type TrackWithdrawalQuoteSnapshotArgs = {
|
|
48
|
+
destinationAddress: string | null;
|
|
49
|
+
executionType: DirectExecutionType | null;
|
|
50
|
+
numQuoteRefreshes: number;
|
|
51
|
+
quote: FunkitCheckoutQuoteResult;
|
|
52
|
+
source: AssetDescriptorArgs;
|
|
53
|
+
sourceAddress: string | null;
|
|
54
|
+
sourceAssetAmount: string;
|
|
55
|
+
target: AssetDescriptorArgs;
|
|
56
|
+
targetAssetAmount: string | null;
|
|
57
|
+
};
|
|
36
58
|
/** Gathers withdrawal context and emits withdrawal-family analytics events. */
|
|
37
59
|
export declare function useWithdrawalAnalytics(): {
|
|
38
60
|
trackWithdrawalAmountConfirmed: (args: TrackWithdrawalAmountConfirmedArgs) => void;
|
|
61
|
+
trackWithdrawalMethodSelected: (args: TrackWithdrawalMethodSelectedArgs) => void;
|
|
62
|
+
trackWithdrawalQuoteConfirmed: (args: TrackWithdrawalQuoteSnapshotArgs) => void;
|
|
63
|
+
trackWithdrawalQuoteDisplayed: (args: TrackWithdrawalQuoteSnapshotArgs) => void;
|
|
39
64
|
trackWithdrawalTransferInteracted: (args: TrackWithdrawalTransferInteractedArgs) => void;
|
|
40
65
|
};
|
|
41
|
-
export {};
|
|
@@ -15,5 +15,5 @@ export declare const useTrack: () => {
|
|
|
15
15
|
startMeasuredEvent: (eventName: CheckoutModalEvent | WithdrawModalEvent) => void;
|
|
16
16
|
updateUserAsync: (userInfo: FunkitUserInfo & {
|
|
17
17
|
l2Address?: string;
|
|
18
|
-
}, apiKey: string) => Promise<
|
|
18
|
+
}, apiKey: string) => Promise<import("@statsig/react-bindings").StatsigUpdateDetails>;
|
|
19
19
|
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { StatsigUser } from '@statsig/react-bindings';
|
|
2
|
+
export declare function buildStatsigUser({ apiKey, l2Address, userId, userName, userType, }: {
|
|
3
|
+
apiKey: string;
|
|
4
|
+
l2Address?: string;
|
|
5
|
+
userId: string;
|
|
6
|
+
userName: string;
|
|
7
|
+
userType: string;
|
|
8
|
+
}): StatsigUser;
|
|
@@ -17,4 +17,6 @@ export declare function useIsQRCodeTransferEnabled(): {
|
|
|
17
17
|
/**
|
|
18
18
|
* creates QR code transfer EOA
|
|
19
19
|
*/
|
|
20
|
-
export declare const useCheckoutTransferInit: (enabled?: boolean
|
|
20
|
+
export declare const useCheckoutTransferInit: (enabled?: boolean, { trackStepReadiness }?: {
|
|
21
|
+
trackStepReadiness?: boolean;
|
|
22
|
+
}) => UseCheckoutTransferInitResponse;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export declare function getFittedTextFontSize({ availableWidth, textWidthAtMaxFontSize, maxFontSize, minFontSize, }: {
|
|
2
|
+
availableWidth: number;
|
|
3
|
+
textWidthAtMaxFontSize: number;
|
|
4
|
+
maxFontSize: number;
|
|
5
|
+
minFontSize: number;
|
|
6
|
+
}): number;
|
|
7
|
+
export declare function useFittedText(options: {
|
|
8
|
+
availableWidthRef?: React.RefObject<HTMLElement | null>;
|
|
9
|
+
enabled?: boolean;
|
|
10
|
+
maxAvailableWidth?: number;
|
|
11
|
+
maxFontSize?: number;
|
|
12
|
+
minFontSize: number;
|
|
13
|
+
remeasureKey?: unknown;
|
|
14
|
+
text: string;
|
|
15
|
+
textRef: React.RefObject<HTMLInputElement | HTMLTextAreaElement | null>;
|
|
16
|
+
}): {
|
|
17
|
+
fontSize: number | undefined;
|
|
18
|
+
textWidth: number | undefined;
|
|
19
|
+
};
|
|
@@ -9,26 +9,14 @@ import type { Address } from 'viem';
|
|
|
9
9
|
*/
|
|
10
10
|
export declare const polymarketAccountBalanceQueryKey: (address: Address | undefined) => readonly ["polymarket", "accountBalanceUsd", `0x${string}` | null];
|
|
11
11
|
/**
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
* never
|
|
17
|
-
*
|
|
18
|
-
* This is the standard TanStack optimistic-update sequence: cancel in-flight
|
|
19
|
-
* fetches, write the new values with `setQueryData` so every reader (deposit
|
|
20
|
-
* picker, transfer step) updates immediately, and let the server win again
|
|
21
|
-
* later. "Later" is a settlement window rather than the next poll because the
|
|
22
|
-
* integrator's backend is eventually consistent — it keeps reporting the
|
|
23
|
-
* pre-transfer balances for a few seconds after accepting the transfer, so
|
|
24
|
-
* polls inside the window keep the displayed value instead of flashing back.
|
|
12
|
+
* Refetches the given accounts' balances right away — call once the
|
|
13
|
+
* integrator's `transfer` resolves so the displayed numbers move without
|
|
14
|
+
* waiting out the poll interval. Nothing is adjusted client-side: the values
|
|
15
|
+
* shown before, during and after a transfer are always what the integrator's
|
|
16
|
+
* `getBalanceUsd` reports, so the modal can never disagree with the
|
|
17
|
+
* integrator's own balance display.
|
|
25
18
|
*/
|
|
26
|
-
export declare function
|
|
27
|
-
fromAddress: Address;
|
|
28
|
-
toAddress: Address;
|
|
29
|
-
/** Exact entered amount (validated numeric string, ≤6 decimals). */
|
|
30
|
-
amountUsd: string;
|
|
31
|
-
}): void;
|
|
19
|
+
export declare function refetchPolymarketAccountBalances(queryClient: QueryClient, addresses: readonly Address[]): Promise<void>;
|
|
32
20
|
/** The fields a balance reader needs from a Polymarket account. */
|
|
33
21
|
export interface PolymarketBalanceAccount {
|
|
34
22
|
address: Address;
|
|
@@ -38,12 +26,13 @@ export interface PolymarketBalanceAccount {
|
|
|
38
26
|
export interface PolymarketAccountBalance {
|
|
39
27
|
/** Latest polled balance, or `undefined` until the first fetch resolves. */
|
|
40
28
|
balanceUsd: number | undefined;
|
|
29
|
+
/** Whether the last balance is being retained while its query reloads. */
|
|
30
|
+
isRefreshing: boolean;
|
|
41
31
|
}
|
|
42
32
|
export interface UsePolymarketAccountBalancesOptions {
|
|
43
33
|
/**
|
|
44
34
|
* How often (ms) to poll each account's balance. Defaults to
|
|
45
|
-
* {@link DEFAULT_BALANCE_REFETCH_MS}.
|
|
46
|
-
* displayed balance with the server soon after a transfer settles.
|
|
35
|
+
* {@link DEFAULT_BALANCE_REFETCH_MS}.
|
|
47
36
|
*/
|
|
48
37
|
refetchIntervalMs?: number;
|
|
49
38
|
}
|
|
@@ -52,10 +41,9 @@ export interface UsePolymarketAccountBalancesOptions {
|
|
|
52
41
|
* by a single TanStack Query cache keyed by account address. Both the "Deposit
|
|
53
42
|
* to" dropdown and the in-modal transfer step read through this hook, so they
|
|
54
43
|
* share one store: whichever screen loads first populates the balance, and the
|
|
55
|
-
* other reads it instantly on navigation.
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
* window closes.
|
|
44
|
+
* other reads it instantly on navigation. The values are the integrator's
|
|
45
|
+
* own, unmodified; a completed transfer refetches them via
|
|
46
|
+
* {@link refetchPolymarketAccountBalances}.
|
|
59
47
|
*/
|
|
60
48
|
export declare function usePolymarketAccountBalances(accounts: {
|
|
61
49
|
predictions: PolymarketBalanceAccount | undefined;
|
|
@@ -2,7 +2,17 @@
|
|
|
2
2
|
* @external
|
|
3
3
|
* Allows clients to update the active funkit checkout item's displayable fields.
|
|
4
4
|
* DANGER: Sensitive fields like asset and amounts should not be updateable by clients
|
|
5
|
+
*
|
|
6
|
+
* - `updateModalTitleMeta` — the subtitle under the modal title.
|
|
7
|
+
* - `updatePolymarketPerpsTransferPending` — whether a perps deposit and/or
|
|
8
|
+
* withdrawal is in flight on the integrator's side. While either is pending
|
|
9
|
+
* the perps transfer step disables Transfer and shows a pending state.
|
|
10
|
+
* Pass the same flags as `createPolymarketDepositConfig`'s
|
|
11
|
+
* `pendingTransfers` for the initial state; call this whenever they change.
|
|
12
|
+
*
|
|
13
|
+
* When this hook is read with no active checkout, it returns no-op callbacks.
|
|
5
14
|
*/
|
|
6
15
|
export declare const useUpdateActiveFunkitCheckout: () => {
|
|
7
16
|
updateModalTitleMeta: (newMeta: string) => void;
|
|
17
|
+
updatePolymarketPerpsTransferPending: (pending: import("../providers/FunkitCheckoutContext").PolymarketPerpsTransferPending) => void;
|
|
8
18
|
};
|