@funkit/connect 11.2.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.
- package/CHANGELOG.md +66 -0
- package/dist/clients/{chunk-SU3YSNMB.js → chunk-46L2KJJ4.js} +4 -10
- package/dist/clients/chunk-6EU6CXNH.js +20 -0
- package/dist/clients/internal/nado/withdrawalCallback.js +2 -2
- package/dist/clients/internal/nado/withdrawalForm.js +4 -4
- package/dist/clients/lighter.d.ts +4 -30
- package/dist/clients/lighter.js +70 -254
- package/dist/clients/nado.js +5 -5
- package/dist/clients/polymarket/PolymarketDepositAccountDropdown.js +5 -5
- package/dist/clients/polymarket/createPolymarketDepositConfig.d.ts +6 -0
- package/dist/clients/polymarket/index.js +9 -9
- package/dist/components/FunCheckoutHistory/FunCheckoutHistoryContent.d.ts +3 -1
- package/dist/components/FunCheckoutHistory/PendingSuccessScreen.d.ts +3 -1
- package/dist/domains/checkout.d.ts +2 -1
- package/dist/hooks/track/analytics/claimAnalyticsEvent.d.ts +5 -0
- package/dist/hooks/track/analytics/events.d.ts +171 -3
- package/dist/hooks/track/analytics/mappers.d.ts +15 -0
- package/dist/hooks/track/analytics/quote.d.ts +12 -0
- package/dist/hooks/track/analytics/resolveExecutionProgressContext.d.ts +40 -0
- package/dist/hooks/track/analytics/useDepositAnalytics.d.ts +71 -3
- package/dist/hooks/track/analytics/useTrackExecutionProgressEvents.d.ts +48 -0
- package/dist/hooks/track/analytics/useWithdrawalAnalytics.d.ts +18 -0
- package/dist/hooks/useIsBlacklistedWithdrawalAddress.d.ts +4 -1
- package/dist/index.js +2245 -965
- package/dist/modals/CheckoutModal/ConfirmationStep/useCheckoutConfirmation.d.ts +2 -1
- package/dist/modals/CheckoutModal/ConfirmationStep/useQuoteRefresh.d.ts +5 -1
- package/dist/modals/CheckoutModal/ConfirmationStep/useTrackDepositQuoteEvents.d.ts +20 -0
- package/dist/modals/CheckoutModal/MeldQuotes/useMeldQuotes.d.ts +1 -1
- package/dist/modals/CheckoutModal/SourceChange/useTrackSourceChangeEvents.d.ts +10 -0
- package/dist/modals/CheckoutModal/TransferToken/useTrackDepositNotificationEvents.d.ts +6 -0
- package/dist/modals/CheckoutModal/TransferToken/useTransferTokenTracking.d.ts +9 -3
- package/dist/modals/PolymarketPerpsTransfer/recordPerpsTransfer.d.ts +40 -0
- package/dist/modals/PolymarketPerpsTransfer/useRecordPerpsTransfer.d.ts +24 -0
- package/dist/modals/WithdrawalModal/LighterWithdrawal.d.ts +14 -92
- package/dist/modals/WithdrawalModal/WithdrawAmountInput.d.ts +3 -1
- package/dist/modals/WithdrawalModal/useTrackWithdrawalEvents.d.ts +1 -0
- package/dist/providers/FunkitCheckoutContext/index.d.ts +10 -2
- package/dist/providers/FunkitCheckoutContext/types.d.ts +17 -2
- package/dist/utils/customer.d.ts +24 -276
- package/dist/utils/lighter.d.ts +1 -83
- package/dist/utils/signature.d.ts +1 -2
- 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 +47 -47
- 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 +3 -4
- package/dist/clients/chunk-6QCAWEAT.js +0 -53
- package/dist/clients/{chunk-XJTRLB7W.js → chunk-L2XMI4EX.js} +8 -8
- package/dist/wallets/walletConnectors/{chunk-RB3HR4R2.js → chunk-4NV5BYRP.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-YEZM4CK4.js → chunk-AVDUNQUW.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-MIQTHJ6X.js → chunk-GUQM4QSL.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-4T6ZSRJF.js → chunk-IULPZP2Q.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-HNRB7KJU.js → chunk-JPN6TWIT.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-ZNX4EMPB.js → chunk-KCRO2AGO.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-STVVP43G.js → chunk-KI5Y2BBF.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-X6CGV36L.js → chunk-NR2OGDHQ.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-UK7C2JXW.js → chunk-OEEGYENV.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-F5XEEVG6.js → chunk-OX37G4YT.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-RVOY537T.js → chunk-SWFF3TWJ.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-CPI4TD43.js → chunk-TKB2OY6G.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-2VP2F6EK.js → chunk-W2LCLDPX.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-6BW3HLBG.js → chunk-WAHGI5L7.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-HTHAK6XB.js → chunk-WKNQMP4A.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-VTM6EECM.js → chunk-XCNHV3HS.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-CCQV2ZET.js → chunk-YO2K4MBH.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-VAPGUPHO.js → chunk-YQFGVZGR.js} +3 -3
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
PolymarketDepositAccountDropdown
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-L2XMI4EX.js";
|
|
5
5
|
import "../chunk-BPDLF2R6.js";
|
|
6
|
+
import "../chunk-Y7WLUPTX.js";
|
|
7
|
+
import "../chunk-IYCZWLAF.js";
|
|
6
8
|
import "../chunk-5MY7WMEJ.js";
|
|
7
9
|
import "../chunk-FNB7OPJI.js";
|
|
8
|
-
import "../chunk-
|
|
10
|
+
import "../chunk-6EU6CXNH.js";
|
|
9
11
|
import "../chunk-UK64SY6N.js";
|
|
10
12
|
import "../chunk-LUHEVXPD.js";
|
|
11
13
|
import "../chunk-YUZ3B2Q3.js";
|
|
14
|
+
import "../chunk-PENJ5JGH.js";
|
|
12
15
|
import "../chunk-UPZNKPYU.js";
|
|
13
16
|
import "../chunk-C45VNQXY.js";
|
|
14
|
-
import "../chunk-Y7WLUPTX.js";
|
|
15
|
-
import "../chunk-IYCZWLAF.js";
|
|
16
|
-
import "../chunk-PENJ5JGH.js";
|
|
17
17
|
import "../chunk-AHYOV7AV.js";
|
|
18
18
|
export {
|
|
19
19
|
PolymarketDepositAccountDropdown
|
|
@@ -23,6 +23,12 @@ export declare function createPredictionsGenerateActionParams(config: Polymarket
|
|
|
23
23
|
* Both accounts share it, so each transfer direction is symmetrical.
|
|
24
24
|
*/
|
|
25
25
|
export type PolymarketAccount = PolymarketTransferAccount;
|
|
26
|
+
/**
|
|
27
|
+
* Re-exported so an integrator can type a `transfer` implementation without
|
|
28
|
+
* reaching outside this entry point — returning the rail's id is what lets a
|
|
29
|
+
* transfer record be joined to Polymarket's side of the same transfer.
|
|
30
|
+
*/
|
|
31
|
+
export type { PolymarketTransferResult } from '../../providers/FunkitCheckoutContext/types';
|
|
26
32
|
export interface CreatePolymarketDepositConfigParams {
|
|
27
33
|
/** Predictions account (the user's predictions proxy). */
|
|
28
34
|
predictions: PolymarketAccount;
|
|
@@ -1,16 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
PolymarketDepositAccountDropdown
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-L2XMI4EX.js";
|
|
5
5
|
import "../chunk-BPDLF2R6.js";
|
|
6
|
-
import "../chunk-5MY7WMEJ.js";
|
|
7
|
-
import "../chunk-FNB7OPJI.js";
|
|
8
|
-
import "../chunk-6QCAWEAT.js";
|
|
9
|
-
import "../chunk-UK64SY6N.js";
|
|
10
|
-
import "../chunk-LUHEVXPD.js";
|
|
11
|
-
import "../chunk-YUZ3B2Q3.js";
|
|
12
|
-
import "../chunk-UPZNKPYU.js";
|
|
13
|
-
import "../chunk-C45VNQXY.js";
|
|
14
6
|
import {
|
|
15
7
|
POLYMARKET_PERPS_ROUTING_ID,
|
|
16
8
|
POLYMARKET_PREDICTIONS_ROUTING_ID,
|
|
@@ -28,7 +20,15 @@ import {
|
|
|
28
20
|
createPerpsGenerateActionParams,
|
|
29
21
|
createPolymarketWithdrawalConfig
|
|
30
22
|
} from "../chunk-IYCZWLAF.js";
|
|
23
|
+
import "../chunk-5MY7WMEJ.js";
|
|
24
|
+
import "../chunk-FNB7OPJI.js";
|
|
25
|
+
import "../chunk-6EU6CXNH.js";
|
|
26
|
+
import "../chunk-UK64SY6N.js";
|
|
27
|
+
import "../chunk-LUHEVXPD.js";
|
|
28
|
+
import "../chunk-YUZ3B2Q3.js";
|
|
31
29
|
import "../chunk-PENJ5JGH.js";
|
|
30
|
+
import "../chunk-UPZNKPYU.js";
|
|
31
|
+
import "../chunk-C45VNQXY.js";
|
|
32
32
|
import "../chunk-AHYOV7AV.js";
|
|
33
33
|
export {
|
|
34
34
|
AMOUNT_PLACEHOLDER,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import type { NotificationItem } from '../../modals/CheckoutModal/TransferToken/types';
|
|
2
3
|
import { HistoryContentPages } from '../../utils/checkoutHistory';
|
|
3
4
|
interface FunCheckoutHistoryContentProps {
|
|
4
5
|
depositAddress: `0x${string}`;
|
|
@@ -11,6 +12,7 @@ interface FunCheckoutHistoryContentProps {
|
|
|
11
12
|
/** Element ID to be used to mount the CTA action bar */
|
|
12
13
|
bottomBarId: string;
|
|
13
14
|
isActiveCheckout: boolean;
|
|
15
|
+
onHistoryItemChange?: (item: NotificationItem) => void;
|
|
14
16
|
}
|
|
15
|
-
export declare function FunCheckoutHistoryContent({ bottomBarId, currentPage, depositAddress, isActiveCheckout, onAnimationComplete, onClose, onHelp, }: FunCheckoutHistoryContentProps): React.JSX.Element;
|
|
17
|
+
export declare function FunCheckoutHistoryContent({ bottomBarId, currentPage, depositAddress, isActiveCheckout, onAnimationComplete, onClose, onHelp, onHistoryItemChange, }: FunCheckoutHistoryContentProps): React.JSX.Element;
|
|
16
18
|
export {};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { TextConfigSteps } from '../../components/TransactionStatus/TransactionStatus';
|
|
3
3
|
import type { FunkitCheckoutQuoteResult } from '../../domains/quote';
|
|
4
|
+
import type { NotificationItem } from '../../modals/CheckoutModal/TransferToken/types';
|
|
4
5
|
export interface PendingSuccessScreenProps {
|
|
5
6
|
bottomBarId: string;
|
|
6
7
|
onClose: () => void;
|
|
@@ -9,5 +10,6 @@ export interface PendingSuccessScreenProps {
|
|
|
9
10
|
quote?: FunkitCheckoutQuoteResult | null;
|
|
10
11
|
isWithdrawal?: boolean;
|
|
11
12
|
hideYouReceive: boolean;
|
|
13
|
+
onHistoryItemChange?: (item: NotificationItem) => void;
|
|
12
14
|
}
|
|
13
|
-
export declare const PendingSuccessScreen: ({ bottomBarId, onClose, onAction, customTextConfigSteps, quote, isWithdrawal, hideYouReceive, }: PendingSuccessScreenProps) => React.JSX.Element | null;
|
|
15
|
+
export declare const PendingSuccessScreen: ({ bottomBarId, onClose, onAction, customTextConfigSteps, quote, isWithdrawal, hideYouReceive, onHistoryItemChange, }: PendingSuccessScreenProps) => React.JSX.Element | null;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { FunAddress } from '@funkit/api-base';
|
|
2
2
|
import { CheckoutRefundState, CheckoutState } from '@funkit/api-base';
|
|
3
3
|
import type { GeneralWalletContextProps } from '../providers/GeneralWalletProvider';
|
|
4
|
+
/** Web's entry to the shared screen: resolves the kill switch and logger. */
|
|
4
5
|
export declare const hasRisk: (apiKey: string, walletAddress: GeneralWalletContextProps["walletAddress"], customRecipient?: FunAddress) => Promise<boolean>;
|
|
5
6
|
export type CheckoutStatus = 'failed' | 'expired' | 'processing' | 'completed';
|
|
6
7
|
type CheckoutStateBooleans = {
|
|
@@ -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,4 +1,7 @@
|
|
|
1
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';
|
|
2
5
|
import type { AmountSelectionType } from '../../../modals/CheckoutModal/InputAmount/state';
|
|
3
6
|
/**
|
|
4
7
|
* Analytics v2 — the improved, explicit Statsig event scheme that will replace
|
|
@@ -7,9 +10,26 @@ import type { AmountSelectionType } from '../../../modals/CheckoutModal/InputAmo
|
|
|
7
10
|
*/
|
|
8
11
|
export declare enum AnalyticsEvent {
|
|
9
12
|
DEPOSIT_ASSET_SELECTED = "fc_deposit_asset_selected",
|
|
10
|
-
DEPOSIT_AMOUNT_CONFIRMED = "fc_deposit_amount_confirmed"
|
|
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"
|
|
11
29
|
}
|
|
30
|
+
export type ConnectionStatus = 'new' | 'existing';
|
|
12
31
|
export type AnalyticsFlow = 'deposit' | 'withdraw';
|
|
32
|
+
export type AnalyticsPaymentRail = 'bluvo' | 'swapped' | 'meld' | 'bridge';
|
|
13
33
|
/** Envelope carried by every analytics-v2 event. */
|
|
14
34
|
export type CommonProperties = {
|
|
15
35
|
/**
|
|
@@ -54,14 +74,13 @@ export type DepositAssetSelectedProperties = DepositAssetContextProperties & {
|
|
|
54
74
|
};
|
|
55
75
|
/** Payload specific to {@link AnalyticsEvent.DEPOSIT_AMOUNT_CONFIRMED}. */
|
|
56
76
|
export type DepositAmountConfirmedProperties = DepositAssetContextProperties & {
|
|
57
|
-
select_type: AmountSelectionType;
|
|
58
77
|
/**
|
|
59
78
|
* The quick option / recovery amount the user picked, formatted exactly as
|
|
60
79
|
* shown on its button (e.g. `"25%"`, `"$100"`). `null` when `select_type`
|
|
61
80
|
* is not `'preset'`.
|
|
62
81
|
*/
|
|
63
82
|
preset_amount: string | null;
|
|
64
|
-
|
|
83
|
+
select_type: AmountSelectionType;
|
|
65
84
|
/**
|
|
66
85
|
* Source token amount the user pays — exact in EXACT_IN, estimated in
|
|
67
86
|
* EXACT_OUT. `null` when the estimate's unit price is unavailable.
|
|
@@ -72,10 +91,159 @@ export type DepositAmountConfirmedProperties = DepositAssetContextProperties & {
|
|
|
72
91
|
* `null` when the estimate's unit price is unavailable.
|
|
73
92
|
*/
|
|
74
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;
|
|
75
228
|
};
|
|
76
229
|
export type AnalyticsEventProperties = {
|
|
77
230
|
[AnalyticsEvent.DEPOSIT_ASSET_SELECTED]: DepositAssetSelectedProperties;
|
|
78
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;
|
|
79
247
|
};
|
|
80
248
|
type AnalyticsPropertyValue = string | number | boolean | null | undefined;
|
|
81
249
|
type AnalyticsEventShape<T extends AnalyticsEvent> = CommonProperties & AnalyticsEventProperties[T];
|
|
@@ -1,5 +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';
|
|
1
4
|
/** Round analytics amounts before Statsig stringifies event metadata. */
|
|
2
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;
|
|
3
18
|
/**
|
|
4
19
|
* Explicit, non-recursive stringify for a flat analytics payload. Statsig
|
|
5
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,7 +1,11 @@
|
|
|
1
|
-
import type { MeldServiceProvider } from '@funkit/api-base';
|
|
2
|
-
import {
|
|
3
|
-
import type
|
|
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';
|
|
4
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';
|
|
5
9
|
type AssetDescriptorArgs = {
|
|
6
10
|
chainId: string;
|
|
7
11
|
tokenAddress: string;
|
|
@@ -27,11 +31,75 @@ export type TrackDepositAmountConfirmedArgs = {
|
|
|
27
31
|
sourceAmount: number | null;
|
|
28
32
|
targetAmount: number | null;
|
|
29
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
|
+
};
|
|
30
93
|
/**
|
|
31
94
|
* Gathers provider context and emits deposit-family analytics events.
|
|
32
95
|
*/
|
|
33
96
|
export declare function useDepositAnalytics(): {
|
|
34
97
|
trackDepositAssetSelected: (args: TrackDepositAssetSelectedArgs) => void;
|
|
35
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;
|
|
36
104
|
};
|
|
37
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 {};
|
|
@@ -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;
|