@funkit/connect 11.1.0 → 11.3.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 (100) hide show
  1. package/CHANGELOG.md +118 -0
  2. package/dist/clients/{chunk-YZSO4EMO.js → chunk-2576N7PQ.js} +1 -1
  3. package/dist/clients/{chunk-II5CZTBC.js → chunk-3P2C436B.js} +3 -1
  4. package/dist/clients/{chunk-YMGRBJAS.js → chunk-46L2KJJ4.js} +14 -16
  5. package/dist/clients/chunk-6EU6CXNH.js +20 -0
  6. package/dist/clients/{chunk-2QYQNTOI.js → chunk-C45VNQXY.js} +24 -16
  7. package/dist/clients/{chunk-SO756ELD.js → chunk-DGBIV3ZS.js} +1 -0
  8. package/dist/clients/{chunk-SYFHMTUO.js → chunk-FM7SFGAV.js} +2 -2
  9. package/dist/clients/{chunk-EJKHMZW3.js → chunk-IYCZWLAF.js} +2 -1
  10. package/dist/clients/{chunk-OJZNF6EM.js → chunk-JFDRLSYM.js} +1 -1
  11. package/dist/clients/{chunk-QIMCURVA.js → chunk-L2XMI4EX.js} +9 -9
  12. package/dist/clients/{chunk-A6OXZWCN.js → chunk-QQEGNLGD.js} +1 -1
  13. package/dist/clients/{chunk-A44M6EAG.js → chunk-TZGKB6WY.js} +1 -1
  14. package/dist/clients/{chunk-C53FRCUM.js → chunk-UK64SY6N.js} +1 -1
  15. package/dist/clients/{chunk-WVM4ZJD2.js → chunk-VIAEAD75.js} +1 -1
  16. package/dist/clients/{chunk-SH3MHRHX.js → chunk-Y7WLUPTX.js} +1 -1
  17. package/dist/clients/{chunk-FAYBQQNB.js → chunk-YUZ3B2Q3.js} +1 -1
  18. package/dist/clients/fanatics.js +2 -2
  19. package/dist/clients/internal/nado/consts.d.ts +6 -0
  20. package/dist/clients/internal/nado/consts.js +5 -3
  21. package/dist/clients/internal/nado/gateway.js +2 -2
  22. package/dist/clients/internal/nado/hooks.js +4 -4
  23. package/dist/clients/internal/nado/indexer.js +2 -2
  24. package/dist/clients/internal/nado/typedData.js +2 -2
  25. package/dist/clients/internal/nado/withdrawalCallback.js +7 -7
  26. package/dist/clients/internal/nado/withdrawalConfig.d.ts +4 -4
  27. package/dist/clients/internal/nado/withdrawalConfig.js +2 -2
  28. package/dist/clients/internal/nado/withdrawalErrors.js +2 -2
  29. package/dist/clients/internal/nado/withdrawalForm.css +43 -35
  30. package/dist/clients/internal/nado/withdrawalForm.d.ts +3 -0
  31. package/dist/clients/internal/nado/withdrawalForm.js +15 -11
  32. package/dist/clients/internal/nado/withdrawalStatus.js +3 -3
  33. package/dist/clients/lighter.css +43 -35
  34. package/dist/clients/lighter.d.ts +4 -30
  35. package/dist/clients/lighter.js +74 -260
  36. package/dist/clients/mallard.js +2 -2
  37. package/dist/clients/nado.js +9 -9
  38. package/dist/clients/polymarket/PolymarketDepositAccountDropdown.css +43 -35
  39. package/dist/clients/polymarket/PolymarketDepositAccountDropdown.js +8 -8
  40. package/dist/clients/polymarket/createPolymarketDepositConfig.d.ts +6 -0
  41. package/dist/clients/polymarket/createPolymarketDepositConfig.js +2 -2
  42. package/dist/clients/polymarket/index.css +43 -35
  43. package/dist/clients/polymarket/index.js +11 -11
  44. package/dist/clients/polymarket/polymarket.js +1 -1
  45. package/dist/components/Dialog/Dialog.d.ts +3 -1
  46. package/dist/components/Dialog/DialogContent.css.d.ts +6 -0
  47. package/dist/components/FunCheckbox/FunCheckbox.d.ts +3 -1
  48. package/dist/components/FunCheckoutHistory/FunCheckoutHistoryContent.d.ts +3 -1
  49. package/dist/components/FunCheckoutHistory/PendingSuccessScreen.d.ts +3 -1
  50. package/dist/components/FunTransactionSummary/PaymentFeesSummary.d.ts +2 -1
  51. package/dist/domains/checkout.d.ts +2 -1
  52. package/dist/domains/nado.d.ts +11 -2
  53. package/dist/domains/quoteMode/types.d.ts +16 -0
  54. package/dist/domains/relay.d.ts +0 -3
  55. package/dist/hooks/track/analytics/claimAnalyticsEvent.d.ts +5 -0
  56. package/dist/hooks/track/analytics/events.d.ts +203 -7
  57. package/dist/hooks/track/analytics/mappers.d.ts +17 -0
  58. package/dist/hooks/track/analytics/quote.d.ts +12 -0
  59. package/dist/hooks/track/analytics/resolveExecutionProgressContext.d.ts +40 -0
  60. package/dist/hooks/track/analytics/useDepositAnalytics.d.ts +87 -2
  61. package/dist/hooks/track/analytics/useTrackExecutionProgressEvents.d.ts +48 -0
  62. package/dist/hooks/track/analytics/useWithdrawalAnalytics.d.ts +18 -0
  63. package/dist/hooks/track/useTrack.d.ts +1 -1
  64. package/dist/hooks/useFunkitTranslation.d.ts +5 -0
  65. package/dist/hooks/useIsBlacklistedWithdrawalAddress.d.ts +4 -1
  66. package/dist/hooks/useTokenAndChainDropdown.d.ts +4 -1
  67. package/dist/index.css +43 -35
  68. package/dist/index.js +5301 -3619
  69. package/dist/modals/CheckoutModal/ConfirmationStep/useCheckoutConfirmation.d.ts +2 -1
  70. package/dist/modals/CheckoutModal/ConfirmationStep/useQuoteRefresh.d.ts +5 -1
  71. package/dist/modals/CheckoutModal/ConfirmationStep/useTrackDepositQuoteEvents.d.ts +20 -0
  72. package/dist/modals/CheckoutModal/InputAmount/InputAmount.d.ts +5 -1
  73. package/dist/modals/CheckoutModal/InputAmount/state.d.ts +13 -0
  74. package/dist/modals/CheckoutModal/InputAmount/useMeld.d.ts +4 -3
  75. package/dist/modals/CheckoutModal/InputAmount/utils.d.ts +9 -1
  76. package/dist/modals/CheckoutModal/MeldQuotes/MeldQuotes.d.ts +3 -1
  77. package/dist/modals/CheckoutModal/MeldQuotes/useMeldQuotes.d.ts +1 -1
  78. package/dist/modals/CheckoutModal/MeldRedirect/MeldRedirect.d.ts +4 -1
  79. package/dist/modals/CheckoutModal/SourceChange/useBottomBarCloseLabel.d.ts +7 -0
  80. package/dist/modals/CheckoutModal/SourceChange/useTrackSourceChangeEvents.d.ts +10 -0
  81. package/dist/modals/CheckoutModal/TransferToken/useTrackDepositNotificationEvents.d.ts +6 -0
  82. package/dist/modals/CheckoutModal/TransferToken/useTransferTokenTracking.d.ts +9 -3
  83. package/dist/modals/PolymarketPerpsTransfer/recordPerpsTransfer.d.ts +40 -0
  84. package/dist/modals/PolymarketPerpsTransfer/useRecordPerpsTransfer.d.ts +24 -0
  85. package/dist/modals/WithdrawalModal/LighterWithdrawal.d.ts +14 -92
  86. package/dist/modals/WithdrawalModal/LockedReceiveDisplay.d.ts +22 -0
  87. package/dist/modals/WithdrawalModal/WithdrawAmountInput.d.ts +3 -1
  88. package/dist/modals/WithdrawalModal/useTrackWithdrawalEvents.d.ts +1 -0
  89. package/dist/modals/WithdrawalModal/withdrawalFormHelpers.d.ts +18 -1
  90. package/dist/modals/WithdrawalModal/withdrawalHooks.d.ts +1 -1
  91. package/dist/providers/FunkitCheckoutContext/index.d.ts +10 -2
  92. package/dist/providers/FunkitCheckoutContext/types.d.ts +21 -4
  93. package/dist/providers/FunkitStatsigProvider.d.ts +7 -0
  94. package/dist/utils/customer.d.ts +45 -504
  95. package/dist/utils/lighter.d.ts +1 -83
  96. package/dist/utils/signature.d.ts +1 -2
  97. package/dist/utils/withdrawal.d.ts +11 -1
  98. package/dist/wallets/walletConnectors/index.js +49 -49
  99. package/package.json +4 -5
  100. package/dist/clients/chunk-NAVU6W7V.js +0 -89
@@ -58,6 +58,20 @@ export interface QuoteDisplayAmounts {
58
58
  /** Total fees in USD. '0' for ONE_TO_ONE */
59
59
  feesUsd: string;
60
60
  }
61
+ export interface PreQuoteAmountsParams {
62
+ /** The user-controlled token amount in the active quote mode. */
63
+ inputAmount: number;
64
+ /** USD value corresponding to the user's input. */
65
+ inputUsdAmount: number | null;
66
+ /** Source token unit price in USD, when available. */
67
+ sourceUnitPrice: number | null | undefined;
68
+ /** Target token unit price in USD. */
69
+ targetUnitPrice: number;
70
+ }
71
+ export interface PreQuoteAmounts {
72
+ sourceAmount: number | null;
73
+ targetAmount: number | null;
74
+ }
61
75
  export interface MaxSendableParams {
62
76
  /** Token balance as a Dnum */
63
77
  tokenBalanceBaseUnit: Dnum;
@@ -108,6 +122,8 @@ export interface QuoteBuilder {
108
122
  /** Target asset ticker (e.g. "USDC") — used for stablecoin display logic */
109
123
  targetAssetTicker: string;
110
124
  }): QuoteDisplayAmounts;
125
+ /** Resolve source and target amounts before a quote is available. */
126
+ getPreQuoteAmounts(params: PreQuoteAmountsParams): PreQuoteAmounts;
111
127
  /** Whether the confirmation screen can show a dollar amount before the quote resolves */
112
128
  hasKnownAmountBeforeQuote(config: {
113
129
  targetAssetAmount?: number;
@@ -7,9 +7,6 @@ export type RelayQuoteMetadata = {
7
7
  relayQuote: RelayQuote['metadata']['relayQuote'];
8
8
  feeBreakdown?: FeeBreakdownV2;
9
9
  };
10
- export declare function extractRelayFeeInfo(quoteV2: {
11
- [x: string]: unknown;
12
- } | undefined): FeeBreakdownV2;
13
10
  type RelayQuoteDetails = NonNullable<RelayExecute['details']>;
14
11
  /** Checks if input and output are the same token on the same chain. */
15
12
  export declare function isRelayQuoteSameChainAndAsset(details: RelayQuoteDetails): boolean;
@@ -0,0 +1,5 @@
1
+ import { AnalyticsEvent } from './events';
2
+ /** Claim one analytics event per stable record key, persisted across sessions. */
3
+ export declare function claimAnalyticsEvent(event: AnalyticsEvent,
4
+ /** Based on the event, this could be checkoutId, depositAddr, txHash, etc */
5
+ claimKey: string): boolean;
@@ -1,12 +1,35 @@
1
+ import type { QuoteMode } from '../../../domains/quoteMode';
2
+ import type { DirectExecutionType } from '@funkit/api-base';
3
+ import type { CheckoutStatus } from '../../../domains/checkout';
4
+ import type { PaymentMethodType } from '../../../hooks/usePaymentSources';
5
+ import type { AmountSelectionType } from '../../../modals/CheckoutModal/InputAmount/state';
1
6
  /**
2
7
  * Analytics v2 — the improved, explicit Statsig event scheme that will replace
3
8
  * the `fc::`/`fw::` enums in `../CheckoutModalEvent.ts` / `../WithdrawModalEvent.ts`.
4
9
  * Every property is explicitly assigned so each emitted payload is auditable.
5
10
  */
6
11
  export declare enum AnalyticsEvent {
7
- DEPOSIT_ASSET_SELECTED = "fc_deposit_asset_selected"
12
+ DEPOSIT_ASSET_SELECTED = "fc_deposit_asset_selected",
13
+ DEPOSIT_AMOUNT_CONFIRMED = "fc_deposit_amount_confirmed",
14
+ DEPOSIT_FAILED = "fc_deposit_failed",
15
+ DEPOSIT_METHOD_SELECTED = "fc_deposit_method_selected",
16
+ DEPOSIT_NOTIFICATION_DISPLAYED = "fc_deposit_notification_displayed",
17
+ DEPOSIT_NOTIFICATION_INTERACTED = "fc_deposit_notification_interacted",
18
+ DEPOSIT_QUOTE_DISPLAYED = "fc_deposit_quote_displayed",
19
+ DEPOSIT_QUOTE_CONFIRMED = "fc_deposit_quote_confirmed",
20
+ DEPOSIT_SUCCEEDED = "fc_deposit_succeeded",
21
+ DEPOSIT_TRANSFER_INTERACTED = "fc_deposit_transfer_interacted",
22
+ DEPOSIT_TRANSACTION_SUBMITTED = "fc_deposit_transaction_submitted",
23
+ MODAL_OPENED = "fc_modal_opened",
24
+ TAB_SWITCHED = "fc_tab_switched",
25
+ WITHDRAWAL_AMOUNT_CONFIRMED = "fc_withdrawal_amount_confirmed",
26
+ WITHDRAWAL_FAILED = "fc_withdrawal_failed",
27
+ WITHDRAWAL_SUCCEEDED = "fc_withdrawal_succeeded",
28
+ WITHDRAWAL_TRANSACTION_SUBMITTED = "fc_withdrawal_transaction_submitted"
8
29
  }
30
+ export type ConnectionStatus = 'new' | 'existing';
9
31
  export type AnalyticsFlow = 'deposit' | 'withdraw';
32
+ export type AnalyticsPaymentRail = 'bluvo' | 'swapped' | 'meld' | 'bridge';
10
33
  /** Envelope carried by every analytics-v2 event. */
11
34
  export type CommonProperties = {
12
35
  /**
@@ -33,21 +56,194 @@ export type PaymentMethodProperties = {
33
56
  /** Checkout provider identity; null when not applicable or authoritative. */
34
57
  provider: string | null;
35
58
  };
36
- /** Payload specific to {@link AnalyticsEvent.DEPOSIT_ASSET_SELECTED}. */
37
- export type DepositAssetSelectedProperties = PaymentMethodProperties & {
38
- source_chain: string;
39
- source_asset: string;
40
- source_asset_ticker: string;
59
+ /** Source/target/payment context shared by the deposit events. */
60
+ export type DepositAssetContextProperties = PaymentMethodProperties & {
61
+ source_chain: string | null;
62
+ source_asset: string | null;
63
+ source_asset_ticker: string | null;
41
64
  target_chain: string;
42
65
  target_asset: string;
43
- target_asset_ticker: string;
66
+ target_asset_ticker: string | null;
67
+ };
68
+ /** Payload specific to {@link AnalyticsEvent.DEPOSIT_ASSET_SELECTED}. */
69
+ export type DepositAssetSelectedProperties = DepositAssetContextProperties & {
44
70
  /** 0-based index of the chosen asset in the displayed list; `-1` if unresolved. */
45
71
  asset_position: number;
46
72
  /** Whether the chosen chain/token pair matches the flow's resolved default. */
47
73
  is_default_token: boolean;
48
74
  };
75
+ /** Payload specific to {@link AnalyticsEvent.DEPOSIT_AMOUNT_CONFIRMED}. */
76
+ export type DepositAmountConfirmedProperties = DepositAssetContextProperties & {
77
+ /**
78
+ * The quick option / recovery amount the user picked, formatted exactly as
79
+ * shown on its button (e.g. `"25%"`, `"$100"`). `null` when `select_type`
80
+ * is not `'preset'`.
81
+ */
82
+ preset_amount: string | null;
83
+ select_type: AmountSelectionType;
84
+ /**
85
+ * Source token amount the user pays — exact in EXACT_IN, estimated in
86
+ * EXACT_OUT. `null` when the estimate's unit price is unavailable.
87
+ */
88
+ source_amount: string | null;
89
+ /**
90
+ * Target token amount received — exact in EXACT_OUT, estimated in EXACT_IN.
91
+ * `null` when the estimate's unit price is unavailable.
92
+ */
93
+ target_amount: string | null;
94
+ trade_type: QuoteMode;
95
+ };
96
+ export type WithdrawalAmountSelectionType = 'manual' | 'max';
97
+ /** Payload specific to {@link AnalyticsEvent.WITHDRAWAL_AMOUNT_CONFIRMED}. */
98
+ export type WithdrawalAmountConfirmedProperties = PaymentMethodProperties & {
99
+ select_type: WithdrawalAmountSelectionType;
100
+ source_amount: string | null;
101
+ source_chain: string;
102
+ source_asset: string;
103
+ source_asset_ticker: string | null;
104
+ target_amount: string | null;
105
+ target_chain: string;
106
+ target_asset: string;
107
+ target_asset_ticker: string | null;
108
+ trade_type: QuoteMode.EXACT_IN;
109
+ };
110
+ /** Payload specific to {@link AnalyticsEvent.DEPOSIT_METHOD_SELECTED}. */
111
+ export type DepositMethodSelectedProperties = DepositAssetContextProperties & {
112
+ connection_status: ConnectionStatus | null;
113
+ payment_rail: AnalyticsPaymentRail | null;
114
+ tab: PaymentMethodType | null;
115
+ };
116
+ /** Fee rows rendered by PaymentFeesSummary for a displayed quote. */
117
+ export type VisibleQuoteFeeProperties = {
118
+ app_fee_pct: number | null;
119
+ destination_chain_gas_usd: number | null;
120
+ card_processing_fee_usd: number | null;
121
+ exchange_processing_fee_usd: number | null;
122
+ liquidity_provider_cost_usd: number | null;
123
+ market_maker_gas_cost_usd: number | null;
124
+ max_slippage_pct: number | null;
125
+ moonpay_cost_usd: number | null;
126
+ network_cost_usd: number | null;
127
+ price_impact_pct: number | null;
128
+ source_chain_gas_usd: number | null;
129
+ swap_impact_pct: number | null;
130
+ wallet_gas_cost_usd: number | null;
131
+ };
132
+ /** Route fields shared by quote-bearing and later lifecycle events. */
133
+ export type DepositRouteContextProperties = DepositAssetContextProperties & {
134
+ destination_address: string | null;
135
+ execution_type: DirectExecutionType | null;
136
+ sender_address: string | null;
137
+ trade_type: QuoteMode;
138
+ };
139
+ /** Quote fields shared across quote-lifecycle and submission events. */
140
+ export type DepositQuoteSnapshotProperties = DepositRouteContextProperties & VisibleQuoteFeeProperties & {
141
+ /** Estimated fulfillment time in milliseconds. */
142
+ est_fulfillment_time_ms: number | null;
143
+ source_amount: string;
144
+ target_amount: string | null;
145
+ };
146
+ /** Quote snapshot plus quote-lifecycle metadata. */
147
+ export type DepositQuoteContextProperties = DepositQuoteSnapshotProperties & {
148
+ num_quote_refreshes: number;
149
+ };
150
+ /** Payload specific to {@link AnalyticsEvent.DEPOSIT_QUOTE_DISPLAYED}. */
151
+ export type DepositQuoteDisplayedProperties = DepositQuoteContextProperties;
152
+ /** Payload specific to {@link AnalyticsEvent.DEPOSIT_QUOTE_CONFIRMED}. */
153
+ export type DepositQuoteConfirmedProperties = DepositQuoteContextProperties;
154
+ /**
155
+ * Submitted execution snapshot with values preserved at their historical
156
+ * authority. Persisted records cannot always recover a trade direction,
157
+ * quote, source asset, or broadcast hash.
158
+ */
159
+ export type ExecutionTransactionSnapshotProperties = DepositAssetContextProperties & VisibleQuoteFeeProperties & {
160
+ destination_address: string | null;
161
+ execution_type: DirectExecutionType | null;
162
+ sender_address: string | null;
163
+ source_amount: string | null;
164
+ target_amount: string | null;
165
+ trade_type: QuoteMode | null;
166
+ tx_hash: string | null;
167
+ };
168
+ export type TransactionSubmittedProperties = ExecutionTransactionSnapshotProperties & {
169
+ est_fulfillment_time_ms: number | null;
170
+ };
171
+ export type ExecutionSucceededProperties = ExecutionTransactionSnapshotProperties & {
172
+ fulfillment_time_ms: number | null;
173
+ };
174
+ export type ExecutionFailedProperties = ExecutionTransactionSnapshotProperties & {
175
+ error_code: string | null;
176
+ };
177
+ export type DepositNotificationStatus = CheckoutStatus | 'delayed';
178
+ export type DepositNotificationProperties = ExecutionTransactionSnapshotProperties & {
179
+ status: DepositNotificationStatus;
180
+ };
181
+ export type DepositNotificationInteractedProperties = DepositNotificationProperties & {
182
+ action: 'dismissed' | 'expanded';
183
+ ms_since_displayed: number;
184
+ };
185
+ /**
186
+ * Payload specific to {@link AnalyticsEvent.MODAL_OPENED}. Captures the
187
+ * payment sources and checkout configuration available when the modal opens.
188
+ */
189
+ export type ModalOpenedProperties = {
190
+ custom_recipient: string | null;
191
+ dynamic_routing_id: string | null;
192
+ exchange_count: number;
193
+ primary_exchange: string | null;
194
+ primary_wallet: string | null;
195
+ source_asset: string | null;
196
+ source_asset_ticker: string | null;
197
+ source_chain: string | null;
198
+ tab: PaymentMethodType;
199
+ target_asset: string | null;
200
+ target_asset_ticker: string | null;
201
+ target_chain: string | null;
202
+ wallet_count: number;
203
+ };
204
+ /** Payload specific to {@link AnalyticsEvent.TAB_SWITCHED}. */
205
+ export type TabSwitchedProperties = {
206
+ from_tab: PaymentMethodType;
207
+ /** 1-based switch ordinal for the current SourceChange visit. */
208
+ switch_count: number;
209
+ tab: PaymentMethodType;
210
+ };
211
+ export type DepositTransferInteractionAction = 'address_copied' | 'chain_changed' | 'token_changed';
212
+ export type DepositTransferInteractedProperties = {
213
+ action: DepositTransferInteractionAction;
214
+ deposit_address: string;
215
+ est_price_impact: number | null;
216
+ interaction_count: number;
217
+ min_amount_usd: number;
218
+ payment_method: 'transfer_crypto';
219
+ prev_source_asset: string | null;
220
+ prev_source_asset_ticker: string | null;
221
+ prev_source_chain: string | null;
222
+ source_asset: string;
223
+ source_asset_ticker: string;
224
+ source_chain: string;
225
+ target_asset: string;
226
+ target_asset_ticker: string | null;
227
+ target_chain: string;
228
+ };
49
229
  export type AnalyticsEventProperties = {
50
230
  [AnalyticsEvent.DEPOSIT_ASSET_SELECTED]: DepositAssetSelectedProperties;
231
+ [AnalyticsEvent.DEPOSIT_AMOUNT_CONFIRMED]: DepositAmountConfirmedProperties;
232
+ [AnalyticsEvent.DEPOSIT_FAILED]: ExecutionFailedProperties;
233
+ [AnalyticsEvent.DEPOSIT_METHOD_SELECTED]: DepositMethodSelectedProperties;
234
+ [AnalyticsEvent.DEPOSIT_NOTIFICATION_DISPLAYED]: DepositNotificationProperties;
235
+ [AnalyticsEvent.DEPOSIT_NOTIFICATION_INTERACTED]: DepositNotificationInteractedProperties;
236
+ [AnalyticsEvent.DEPOSIT_QUOTE_DISPLAYED]: DepositQuoteDisplayedProperties;
237
+ [AnalyticsEvent.DEPOSIT_QUOTE_CONFIRMED]: DepositQuoteConfirmedProperties;
238
+ [AnalyticsEvent.DEPOSIT_SUCCEEDED]: ExecutionSucceededProperties;
239
+ [AnalyticsEvent.DEPOSIT_TRANSFER_INTERACTED]: DepositTransferInteractedProperties;
240
+ [AnalyticsEvent.DEPOSIT_TRANSACTION_SUBMITTED]: TransactionSubmittedProperties;
241
+ [AnalyticsEvent.MODAL_OPENED]: ModalOpenedProperties;
242
+ [AnalyticsEvent.TAB_SWITCHED]: TabSwitchedProperties;
243
+ [AnalyticsEvent.WITHDRAWAL_AMOUNT_CONFIRMED]: WithdrawalAmountConfirmedProperties;
244
+ [AnalyticsEvent.WITHDRAWAL_FAILED]: ExecutionFailedProperties;
245
+ [AnalyticsEvent.WITHDRAWAL_SUCCEEDED]: ExecutionSucceededProperties;
246
+ [AnalyticsEvent.WITHDRAWAL_TRANSACTION_SUBMITTED]: TransactionSubmittedProperties;
51
247
  };
52
248
  type AnalyticsPropertyValue = string | number | boolean | null | undefined;
53
249
  type AnalyticsEventShape<T extends AnalyticsEvent> = CommonProperties & AnalyticsEventProperties[T];
@@ -1,3 +1,20 @@
1
+ import { FormOfPaymentType, type MeldServiceProvider } from '@funkit/api-base';
2
+ import { PaymentMethod, type PaymentMethodInfo } from '../../../domains/paymentMethods';
3
+ import type { PaymentMethodProperties } from './events';
4
+ /** Round analytics amounts before Statsig stringifies event metadata. */
5
+ export declare function formatAnalyticsAmount(amount: number | null): string | null;
6
+ export declare function getHistoricalSourceAddress(sourceOfFund: string | null | undefined): string | null;
7
+ /** Selected checkout provider, such as a Bluvo exchange or wallet connector. */
8
+ export declare function resolveProvider(args: {
9
+ paymentMethodInfo: PaymentMethodInfo;
10
+ serviceProvider?: MeldServiceProvider;
11
+ }, connectorId: string | undefined): string | null;
12
+ /** Payment-method-derived fields shared by deposit analytics payloads. */
13
+ export declare function resolvePaymentMethodProperties(args: {
14
+ paymentMethodInfo: PaymentMethodInfo;
15
+ serviceProvider?: MeldServiceProvider;
16
+ }, connectorId: string | undefined): PaymentMethodProperties;
17
+ export declare function mapSwappedFopTypeToPaymentMethod(fopType: FormOfPaymentType): PaymentMethod | null;
1
18
  /**
2
19
  * Explicit, non-recursive stringify for a flat analytics payload. Statsig
3
20
  * event metadata must be Record<string, string>; values are stringified and
@@ -0,0 +1,12 @@
1
+ import type { FunkitCheckoutQuoteResult } from '../../../domains/quote';
2
+ import type { VisibleQuoteFeeProperties } from './events';
3
+ import type { ApiFunkitCheckoutQuoteResult } from '@funkit/utils';
4
+ /** All-null fee row, for events firing without a compatible live quote. */
5
+ export declare const NULL_VISIBLE_QUOTE_FEE_PROPERTIES: VisibleQuoteFeeProperties;
6
+ /**
7
+ * Maps a quote's fee breakdown to the fee rows PaymentFeesSummary renders.
8
+ * Relay (direct-execution) quotes carry `feeBreakdown` metadata and report
9
+ * network/impact rows; other rails report their own cost row from
10
+ * `finalFeesBreakdown` and leave the Relay-specific rows null.
11
+ */
12
+ export declare function resolveVisibleQuoteFeeProperties(latestQuote: ApiFunkitCheckoutQuoteResult | FunkitCheckoutQuoteResult | null): VisibleQuoteFeeProperties;
@@ -0,0 +1,40 @@
1
+ import { type DirectExecutionType } from '@funkit/api-base';
2
+ import type { ApiFunkitCheckoutQuoteResult } from '@funkit/utils';
3
+ import type { PaymentMethodInfo } from '../../../domains/paymentMethods';
4
+ import type { QuoteMode } from '../../../domains/quoteMode';
5
+ import type { AnalyticsFlow } from './events';
6
+ import type { NotificationItem } from '../../../modals/CheckoutModal/TransferToken/types';
7
+ type AssetDescriptor = {
8
+ chainId: string;
9
+ tokenAddress: string;
10
+ ticker: string | null;
11
+ };
12
+ export type ExecutionTransactionSubmittedArgs = {
13
+ destinationAddress: string | null;
14
+ executionType: DirectExecutionType | null;
15
+ historicalCheckoutId: string;
16
+ historicalUserId: string | null;
17
+ paymentMethodInfo: PaymentMethodInfo;
18
+ quote: ApiFunkitCheckoutQuoteResult | null;
19
+ source: AssetDescriptor | null;
20
+ sourceAddress: string | null;
21
+ sourceAssetAmount: string | null;
22
+ target: AssetDescriptor;
23
+ targetAssetAmount: string | null;
24
+ tradeType: QuoteMode | null;
25
+ txHash: string | null;
26
+ };
27
+ export type ExecutionProgressContext = ExecutionTransactionSubmittedArgs & {
28
+ claimKey: string;
29
+ errorCode: string | null;
30
+ fulfillmentTimeMs: number | null;
31
+ isCompleted: boolean;
32
+ isFailed: boolean;
33
+ isSubmitted: boolean;
34
+ };
35
+ /**
36
+ * Resolves the historical source, target, and payment context shared by
37
+ * progress-screen and notification deposit events.
38
+ */
39
+ export declare function resolveExecutionProgressContext(historyItem: NotificationItem, flow: AnalyticsFlow): ExecutionProgressContext | null;
40
+ export {};
@@ -1,8 +1,15 @@
1
- import { type PaymentMethodInfo } from '../../../domains/paymentMethods';
1
+ import type { DirectExecutionType, FormOfPaymentType, MeldQuote, MeldServiceProvider } from '@funkit/api-base';
2
+ import type { ApiFunkitCheckoutQuoteResult } from '@funkit/utils';
3
+ import { PaymentMethod, type PaymentMethodInfo } from '../../../domains/paymentMethods';
4
+ import { QuoteMode } from '../../../domains/quoteMode';
5
+ import type { FunkitCheckoutQuoteResult } from '../../../domains/quote';
6
+ import type { AmountSelectionType } from '../../../modals/CheckoutModal/InputAmount/state';
7
+ import { type AnalyticsPaymentRail, type ConnectionStatus, type DepositTransferInteractionAction } from './events';
8
+ import type { PaymentMethodType } from '../../../hooks/usePaymentSources';
2
9
  type AssetDescriptorArgs = {
3
10
  chainId: string;
4
11
  tokenAddress: string;
5
- ticker: string;
12
+ ticker: string | null;
6
13
  };
7
14
  export type TrackDepositAssetSelectedArgs = {
8
15
  source: AssetDescriptorArgs;
@@ -11,10 +18,88 @@ export type TrackDepositAssetSelectedArgs = {
11
18
  assetPosition: number;
12
19
  isDefaultToken: boolean;
13
20
  };
21
+ export type TrackDepositAmountConfirmedArgs = {
22
+ /** Null for card/Meld deposits, which have no crypto source asset. */
23
+ source: AssetDescriptorArgs | null;
24
+ target: AssetDescriptorArgs;
25
+ paymentMethodInfo: PaymentMethodInfo;
26
+ /** Concrete Meld provider selected for card checkout. */
27
+ serviceProvider?: MeldServiceProvider;
28
+ selectType: AmountSelectionType;
29
+ presetAmount: string | null;
30
+ tradeType: QuoteMode;
31
+ sourceAmount: number | null;
32
+ targetAmount: number | null;
33
+ };
34
+ export type TrackDepositMethodSelectedArgs = {
35
+ connectionStatus?: ConnectionStatus;
36
+ /** Some Swapped methods can't be mapped to PaymentMethod and are forwarded as-is. */
37
+ paymentMethod: PaymentMethod | FormOfPaymentType;
38
+ paymentRail?: AnalyticsPaymentRail;
39
+ /** Selected checkout provider, such as a Bluvo exchange. */
40
+ provider?: string;
41
+ /** Explicit source override (e.g. the native fast-path row) */
42
+ source?: AssetDescriptorArgs;
43
+ tab: PaymentMethodType | null;
44
+ };
45
+ export type TrackDepositTransferInteractedArgs = {
46
+ action: DepositTransferInteractionAction;
47
+ depositAddress: string;
48
+ estPriceImpact: number | null;
49
+ interactionCount: number;
50
+ minAmountUsd: number;
51
+ previousSource: {
52
+ chainId: string | null;
53
+ ticker: string | null;
54
+ tokenAddress: string | null;
55
+ } | null;
56
+ source: AssetDescriptorArgs & {
57
+ ticker: string;
58
+ };
59
+ target: AssetDescriptorArgs;
60
+ };
61
+ export type TrackDepositQuoteSnapshotArgs = {
62
+ destinationAddress: string | null;
63
+ executionType: DirectExecutionType | null;
64
+ numQuoteRefreshes: number;
65
+ paymentMethodInfo: PaymentMethodInfo;
66
+ quote: FunkitCheckoutQuoteResult;
67
+ source: AssetDescriptorArgs;
68
+ sourceAddress: string | null;
69
+ sourceAssetAmount: string;
70
+ target: AssetDescriptorArgs;
71
+ targetAssetAmount: string | null;
72
+ tradeType: QuoteMode;
73
+ };
74
+ export type ExecutionTransactionSubmittedArgs = {
75
+ destinationAddress: string | null;
76
+ executionType: DirectExecutionType | null;
77
+ historicalCheckoutId: string;
78
+ historicalUserId: string | null;
79
+ paymentMethodInfo: PaymentMethodInfo;
80
+ quote: ApiFunkitCheckoutQuoteResult | null;
81
+ source: AssetDescriptorArgs | null;
82
+ sourceAddress: string | null;
83
+ sourceAssetAmount: string | null;
84
+ target: AssetDescriptorArgs;
85
+ targetAssetAmount: string | null;
86
+ tradeType: QuoteMode | null;
87
+ txHash: string | null;
88
+ };
89
+ export type TrackDepositMeldQuoteDisplayedArgs = {
90
+ numQuoteRefreshes: number;
91
+ quote: MeldQuote;
92
+ };
14
93
  /**
15
94
  * Gathers provider context and emits deposit-family analytics events.
16
95
  */
17
96
  export declare function useDepositAnalytics(): {
18
97
  trackDepositAssetSelected: (args: TrackDepositAssetSelectedArgs) => void;
98
+ trackDepositAmountConfirmed: (args: TrackDepositAmountConfirmedArgs) => void;
99
+ trackDepositMethodSelected: (args: TrackDepositMethodSelectedArgs) => void;
100
+ trackDepositMeldQuoteDisplayed: ({ quote, numQuoteRefreshes }: TrackDepositMeldQuoteDisplayedArgs) => void;
101
+ trackDepositQuoteDisplayed: (args: TrackDepositQuoteSnapshotArgs) => void;
102
+ trackDepositQuoteConfirmed: (args: TrackDepositQuoteSnapshotArgs) => void;
103
+ trackDepositTransferInteracted: (args: TrackDepositTransferInteractedArgs) => void;
19
104
  };
20
105
  export {};
@@ -0,0 +1,48 @@
1
+ import type { NotificationItem } from '../../../modals/CheckoutModal/TransferToken/types';
2
+ import { type ExecutionTransactionSubmittedArgs } from './resolveExecutionProgressContext';
3
+ import { type AnalyticsFlow } from './events';
4
+ export type TrackExecutionSucceededArgs = ExecutionTransactionSubmittedArgs & {
5
+ fulfillmentTimeMs: number | null;
6
+ };
7
+ export type TrackExecutionFailedArgs = ExecutionTransactionSubmittedArgs & {
8
+ errorCode: string | null;
9
+ };
10
+ export declare function buildExecutionTransactionSnapshotProperties(args: ExecutionTransactionSubmittedArgs, connectedUserId: string | null, connectorId: string | undefined): {
11
+ app_fee_pct: number | null;
12
+ destination_chain_gas_usd: number | null;
13
+ card_processing_fee_usd: number | null;
14
+ exchange_processing_fee_usd: number | null;
15
+ liquidity_provider_cost_usd: number | null;
16
+ market_maker_gas_cost_usd: number | null;
17
+ max_slippage_pct: number | null;
18
+ moonpay_cost_usd: number | null;
19
+ network_cost_usd: number | null;
20
+ price_impact_pct: number | null;
21
+ source_chain_gas_usd: number | null;
22
+ swap_impact_pct: number | null;
23
+ wallet_gas_cost_usd: number | null;
24
+ checkout_id: string;
25
+ destination_address: string | null;
26
+ execution_type: import("@funkit/api-base").DirectExecutionType | null;
27
+ sender_address: string | null;
28
+ source_amount: string | null;
29
+ source_chain: string | null;
30
+ source_asset: string | null;
31
+ source_asset_ticker: string | null;
32
+ target_amount: string | null;
33
+ target_chain: string;
34
+ target_asset: string;
35
+ target_asset_ticker: string | null;
36
+ trade_type: import("../../../domains/quoteMode").QuoteMode | null;
37
+ tx_hash: string | null;
38
+ user_id: string | null;
39
+ payment_method: string;
40
+ provider: string | null;
41
+ };
42
+ /** Builds and emits execution lifecycle events without owning any polling. */
43
+ export declare function useTrackExecutionProgressEvents(flow: AnalyticsFlow): {
44
+ trackExecutionFailed: (args: TrackExecutionFailedArgs, claimKey: string) => void;
45
+ trackExecutionProgressEvents: (historyItem: NotificationItem) => void;
46
+ trackExecutionSucceeded: (args: TrackExecutionSucceededArgs, claimKey: string) => void;
47
+ trackExecutionTransactionSubmitted: (args: ExecutionTransactionSubmittedArgs, claimKey: string) => void;
48
+ };
@@ -0,0 +1,18 @@
1
+ import { type WithdrawalAmountSelectionType } from './events';
2
+ type AssetDescriptorArgs = {
3
+ chainId: string;
4
+ tokenAddress: string;
5
+ ticker: string | null;
6
+ };
7
+ export type TrackWithdrawalAmountConfirmedArgs = {
8
+ selectType: WithdrawalAmountSelectionType;
9
+ source: AssetDescriptorArgs;
10
+ sourceAmount: number;
11
+ target: AssetDescriptorArgs;
12
+ targetAmount: number | null;
13
+ };
14
+ /** Gathers withdrawal context and emits withdrawal-family analytics events. */
15
+ export declare function useWithdrawalAnalytics(): {
16
+ trackWithdrawalAmountConfirmed: (args: TrackWithdrawalAmountConfirmedArgs) => void;
17
+ };
18
+ 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<import("@statsig/react-bindings").StatsigUpdateDetails>;
18
+ }, apiKey: string) => Promise<[import("@statsig/react-bindings").StatsigUpdateDetails, import("@statsig/react-bindings").StatsigUpdateDetails | undefined]>;
19
19
  };
@@ -21,3 +21,8 @@
21
21
  * ```
22
22
  */
23
23
  export declare function useFunkitTranslation(): import("react-i18next").UseTranslationResponse<"translation", undefined>;
24
+ /**
25
+ * For lookup tables that must keep every `t()` key literal: store a
26
+ * `(t: Translate) => string` per entry instead of a bare key string.
27
+ */
28
+ export type Translate = ReturnType<typeof useFunkitTranslation>['t'];
@@ -1,4 +1,7 @@
1
1
  /**
2
- * Attempt to safeguard user from irrecoverable losses
2
+ * Attempt to safeguard user from irrecoverable losses.
3
+ *
4
+ * The verdict itself lives in connect-core so web and React Native block the
5
+ * same recipients; this hook only resolves the Statsig configs it reads from.
3
6
  */
4
7
  export declare function useIsBlacklistedWithdrawalAddress(address: string): boolean;
@@ -7,8 +7,11 @@ export type TransferTokenDefault = {
7
7
  interface UseTokenChainResult {
8
8
  assets: TokenTransferSourceChainsAndAssets;
9
9
  selectedChainId: number | undefined;
10
- handleChainChange: (chainId?: number, autoUpdate?: boolean) => void;
10
+ /** Returns the auto-selected replacement token when the prior selection isn't on the new chain, else undefined. */
11
+ handleChainChange: (chainId?: number, autoUpdate?: boolean) => string | undefined;
11
12
  selectedToken: string | undefined;
13
+ /** The chain/token pair that would be selected absent any explicit user pick — used to attribute analytics. */
14
+ defaultSelection: TransferTokenDefault;
12
15
  selectedChainName: string | undefined;
13
16
  handleTokenChange: (token: string, chainId?: number, autoUpdate?: boolean) => void;
14
17
  isLoadingAssets: boolean;