@funkit/connect 9.4.1 → 9.5.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 (61) hide show
  1. package/CHANGELOG.md +48 -0
  2. package/dist/__generated__/default_configs.d.ts +222 -12
  3. package/dist/__generated__/default_feature_gates.d.ts +1 -0
  4. package/dist/{chunk-BSF2AKBC.js → chunk-O35RTEEF.js} +1 -1
  5. package/dist/{chunk-IZC4ZKKQ.js → chunk-S65TG73G.js} +1 -1
  6. package/dist/{chunk-DBRUJYOQ.js → chunk-VLAOBEJN.js} +1 -1
  7. package/dist/clients/fanatics.css +4572 -4545
  8. package/dist/clients/fanatics.js +2 -2
  9. package/dist/components/Box/Box.d.ts +15 -15
  10. package/dist/components/Dropdown/BaseDropdown.css.d.ts +0 -2
  11. package/dist/components/Dropdown/BaseDropdown.d.ts +1 -0
  12. package/dist/components/Dropdown/ChainDropdown.d.ts +5 -2
  13. package/dist/components/Dropdown/TokenAndChainDropdown.d.ts +7 -1
  14. package/dist/components/Dropdown/TokenDropdown.d.ts +3 -1
  15. package/dist/components/ModalHeightAnimationLayer/WithdrawalModalHeightAnimationWrapper.d.ts +1 -1
  16. package/dist/components/NewTokenDepositAlert/NewTokenDepositAlert.d.ts +1 -1
  17. package/dist/css/sprinkles.css.d.ts +15 -15
  18. package/dist/domains/quoteMode/exactIn.d.ts +2 -0
  19. package/dist/domains/quoteMode/exactOut.d.ts +2 -0
  20. package/dist/domains/quoteMode/gasEstimate.d.ts +15 -0
  21. package/dist/domains/quoteMode/index.d.ts +9 -0
  22. package/dist/domains/quoteMode/oneToOne.d.ts +21 -0
  23. package/dist/domains/quoteMode/resolveQuoteMode.d.ts +19 -0
  24. package/dist/domains/quoteMode/types.d.ts +125 -0
  25. package/dist/hooks/queries/useFops.d.ts +1 -0
  26. package/dist/hooks/queries/useWithdrawFops.d.ts +9 -0
  27. package/dist/hooks/statsig/useFeatureGate.d.ts +3 -6
  28. package/dist/hooks/track/WithdrawModalEvent.d.ts +3 -0
  29. package/dist/hooks/useBluvo.d.ts +1215 -5
  30. package/dist/hooks/useCheckoutTransferInit.d.ts +1 -0
  31. package/dist/hooks/useSupportedAssets.d.ts +9 -0
  32. package/dist/hooks/{useTokenChain.d.ts → useTokenAndChainDropdown.d.ts} +8 -2
  33. package/dist/hooks/useTokenTransfer.d.ts +1 -0
  34. package/dist/hooks/useTokenTransferConfig.d.ts +2 -0
  35. package/dist/index.css +4818 -4789
  36. package/dist/index.js +3503 -2455
  37. package/dist/modals/CheckoutModal/Brokerage/SelectBrokerage.d.ts +1 -1
  38. package/dist/modals/CheckoutModal/SelectAsset/SelectAsset.d.ts +1 -1
  39. package/dist/modals/CheckoutModal/SelectAsset/SelectAssetInfoSection.d.ts +1 -1
  40. package/dist/modals/CheckoutModal/SourceChange/FormOfPaymentsListLoading.d.ts +6 -0
  41. package/dist/modals/CheckoutModal/SwappedIframe/SwappedErrorMessage.d.ts +6 -0
  42. package/dist/modals/CheckoutModal/SwappedIframe/SwappedIframeContainer.d.ts +3 -1
  43. package/dist/modals/CheckoutModal/TransferToken/TransferToken.d.ts +1 -1
  44. package/dist/modals/CheckoutModal/stepTransition.d.ts +4 -1
  45. package/dist/modals/WithdrawalModal/WithdrawalMethodSelect.d.ts +8 -0
  46. package/dist/modals/{WithdrwalModal → WithdrawalModal}/types.d.ts +1 -0
  47. package/dist/themes/baseTheme.js +1 -1
  48. package/dist/themes/darkTheme.js +2 -2
  49. package/dist/themes/lightTheme.js +2 -2
  50. package/dist/utils/bluvo.d.ts +99 -1
  51. package/dist/utils/swapped.d.ts +1 -0
  52. package/dist/utils/tokenMath.d.ts +38 -0
  53. package/dist/utils/tokenTransfer/disabledList.d.ts +14 -0
  54. package/dist/utils/tokenTransfer/types.d.ts +26 -0
  55. package/dist/wallets/walletConnectors/index.js +40 -40
  56. package/package.json +11 -10
  57. /package/dist/modals/{WithdrwalModal → WithdrawalModal}/WithdrawalCallbackSuccess.d.ts +0 -0
  58. /package/dist/modals/{WithdrwalModal → WithdrawalModal}/WithdrawalContent.d.ts +0 -0
  59. /package/dist/modals/{WithdrwalModal → WithdrawalModal}/WithdrawalModal.d.ts +0 -0
  60. /package/dist/modals/{WithdrwalModal → WithdrawalModal}/WithdrawalSuccess.d.ts +0 -0
  61. /package/dist/modals/{WithdrwalModal → WithdrawalModal}/useWithdrawal.d.ts +0 -0
@@ -0,0 +1,19 @@
1
+ import { type QuoteBuilder } from './types';
2
+ export interface CreateQuoteBuilderParams {
3
+ hasPostAction: boolean;
4
+ isExactInEnabled: boolean;
5
+ providerSupportsExactInWithActions?: boolean;
6
+ }
7
+ /**
8
+ * Determines the quote mode and returns the corresponding builder.
9
+ *
10
+ * Resolution order:
11
+ * 1. Feature gate off → EXACT_OUT (Stage 1 default)
12
+ * 2. No action params → EXACT_IN
13
+ * 3. Action params + provider supports → EXACT_IN
14
+ * 4. Action params + no support → EXACT_OUT
15
+ *
16
+ * Note: ONE_TO_ONE (subsidized routes) is not yet auto-detected.
17
+ * It will be enabled in a future phase when subsidy detection is implemented.
18
+ */
19
+ export declare function createQuoteBuilder({ hasPostAction, isExactInEnabled, providerSupportsExactInWithActions, }: CreateQuoteBuilderParams): QuoteBuilder;
@@ -0,0 +1,125 @@
1
+ import type { Dnum } from 'dnum';
2
+ import type { PaymentMethod } from '../../domains/paymentMethods';
3
+ import type { FunkitCheckoutQuoteResult } from '../../domains/quote';
4
+ export declare enum QuoteMode {
5
+ EXACT_IN = "EXACT_IN",
6
+ EXACT_OUT = "EXACT_OUT",
7
+ ONE_TO_ONE = "ONE_TO_ONE"
8
+ }
9
+ export declare enum QuoteBuildType {
10
+ EXACT_IN = "exactIn",
11
+ EXACT_OUT = "exactOut"
12
+ }
13
+ export declare enum RetryActionType {
14
+ CALIBRATE_AMOUNT = "calibrateAmount",
15
+ REFETCH_BALANCE = "refetchBalance",
16
+ GIVE_UP = "giveUp"
17
+ }
18
+ export declare enum RetryErrorReason {
19
+ INSUFFICIENT_BALANCE = "insufficientBalance",
20
+ INSUFFICIENT_AMOUNT = "insufficientAmount",
21
+ INTERNAL = "internal"
22
+ }
23
+ export declare enum QuickOptionType {
24
+ SET_TOKEN_AMOUNT = "setTokenAmount",
25
+ SET_FIAT_AMOUNT = "setFiatAmount"
26
+ }
27
+ export interface QuoteRetryError {
28
+ reason: RetryErrorReason;
29
+ maxTargetAssetAmount?: Dnum;
30
+ minTargetAssetAmount?: Dnum;
31
+ }
32
+ export type QuoteBuildResult = {
33
+ type: QuoteBuildType.EXACT_IN;
34
+ fromAmountBaseUnit: string;
35
+ } | {
36
+ type: QuoteBuildType.EXACT_OUT;
37
+ toAmountBaseUnit: string;
38
+ };
39
+ export type RetryAction = {
40
+ type: RetryActionType.CALIBRATE_AMOUNT;
41
+ newAmountBaseUnit: Dnum;
42
+ } | {
43
+ type: RetryActionType.REFETCH_BALANCE;
44
+ } | {
45
+ type: RetryActionType.GIVE_UP;
46
+ };
47
+ export interface QuoteDisplayAmounts {
48
+ /** The primary dollar/token amount shown at the top of the confirmation screen */
49
+ confirmationScreenDisplayAmount: string;
50
+ /** "You send" line */
51
+ sendAmount: string;
52
+ /** "You receive" line */
53
+ receiveAmount: string;
54
+ /** Whether the send amount is exact (vs estimated) */
55
+ isSendExact: boolean;
56
+ /** Whether the receive amount is exact (vs estimated) */
57
+ isReceiveExact: boolean;
58
+ /** Total fees in USD. '0' for ONE_TO_ONE */
59
+ feesUsd: string;
60
+ }
61
+ export interface MaxSendableParams {
62
+ /** Token balance as a Dnum */
63
+ tokenBalanceBaseUnit: Dnum;
64
+ /** Whether the token is the chain's native token (ETH, MATIC, etc.) */
65
+ isNativeToken: boolean;
66
+ /** Estimated gas price in wei (required for native tokens) */
67
+ gasEstimateWei?: Dnum;
68
+ /** Token price in USD (used for fee estimation in token terms) */
69
+ unitPrice: number;
70
+ /** Checkout target chain ID */
71
+ targetChainId: string;
72
+ /** Source asset chain ID */
73
+ assetChainId: string;
74
+ /** Payment method */
75
+ paymentMethod: PaymentMethod | undefined;
76
+ }
77
+ export interface UsdAvailableAmountParams {
78
+ /** Source asset USD value */
79
+ assetUsdAmount: number | null | undefined;
80
+ /** Checkout target chain ID */
81
+ targetChainId: string;
82
+ /** Source asset chain ID */
83
+ assetChainId: string | undefined;
84
+ /** Payment method */
85
+ paymentMethod: PaymentMethod | undefined;
86
+ }
87
+ export interface QuoteBuilder {
88
+ readonly mode: QuoteMode;
89
+ /** Compute the USD available amount for the source asset, accounting for fees where applicable */
90
+ getUsdAvailableAmount(params: UsdAvailableAmountParams): number | null;
91
+ /** Compute max sendable token amount for the max button */
92
+ getMaxSendableAmount(params: MaxSendableParams): Dnum;
93
+ /** Build the quote request params from the user's input */
94
+ buildQuoteRequest(params: {
95
+ tokenAmountBaseUnit: Dnum;
96
+ }): QuoteBuildResult;
97
+ /** Handle quote failure. Returns action to take. */
98
+ handleRetry(params: {
99
+ error: QuoteRetryError;
100
+ }): RetryAction;
101
+ /** Derive display amounts for confirmation screen.
102
+ * @param inputAmount — the user's input in human-readable form (e.g., 15.9) */
103
+ getDisplayAmounts(quote: FunkitCheckoutQuoteResult, inputAmount: number): QuoteDisplayAmounts;
104
+ /** Whether the confirmation screen can show a dollar amount before the quote resolves */
105
+ hasKnownAmountBeforeQuote(config: {
106
+ targetAssetAmount?: number;
107
+ targetAssetTicker: string;
108
+ finalizedToken?: unknown;
109
+ }): boolean;
110
+ /** Compute the token/fiat amount for a quick-option percentage button.
111
+ * Returns the action to dispatch to the state reducer. */
112
+ computeQuickOptionAmount(params: {
113
+ percentage: number;
114
+ tokenBalanceBaseUnit: Dnum | null;
115
+ frozenUnitPrice: number | null;
116
+ usdAvailableAmount: number | null;
117
+ }): {
118
+ type: QuickOptionType.SET_TOKEN_AMOUNT;
119
+ tokenAmountBaseUnit: Dnum;
120
+ frozenUnitPrice: number;
121
+ } | {
122
+ type: QuickOptionType.SET_FIAT_AMOUNT;
123
+ fiatAmount: number;
124
+ };
125
+ }
@@ -9,4 +9,5 @@ export declare const useFops: () => {
9
9
  savedFormsOfPayments: SavedFormOfPayment[];
10
10
  } | undefined;
11
11
  isLoading: boolean;
12
+ isFetching: boolean;
12
13
  };
@@ -0,0 +1,9 @@
1
+ import { type GetFopsResponse } from '@funkit/api-base';
2
+ /**
3
+ * Hook to fetch available withdrawal forms of payment.
4
+ * MVP: Returns static mock data. Will be replaced with a real API call later.
5
+ */
6
+ export declare const useWithdrawFops: () => {
7
+ data: GetFopsResponse;
8
+ isLoading: boolean;
9
+ };
@@ -1,7 +1,4 @@
1
- import { type TypedReturn } from '@statsig/react-bindings';
2
- import fallbackFeatureGates from '../../__generated__/default_feature_gates';
3
- type FallbackFeatureGates = typeof fallbackFeatureGates;
4
- type FeatureGateName = keyof FallbackFeatureGates;
5
- type FeatureGateValue<Name extends FeatureGateName> = FallbackFeatureGates[Name];
6
- export declare const useFeatureGate: <Name extends FeatureGateName>(name: Name) => TypedReturn<FeatureGateValue<Name>>;
1
+ import type fallbackFeatureGates from '../../__generated__/default_feature_gates';
2
+ type FeatureGateName = keyof typeof fallbackFeatureGates;
3
+ export declare const useFeatureGate: (name: FeatureGateName) => boolean;
7
4
  export {};
@@ -2,6 +2,9 @@ export declare enum WithdrawModalEvent {
2
2
  MODAL_OPENED = "fw::modal_opened",
3
3
  MODAL_READY = "fw::modal_ready",
4
4
  MODAL_CLOSED = "fw::modal_closed",
5
+ ENTER_AMOUNT_VIEWED = "fw::enter_amount_viewed",
6
+ CRYPTO_ADDRESS_SELECTED = "fw::crypto_address_selected",
7
+ CASH_FOP_SELECTED = "fw::cash_fop_selected",
5
8
  FINAL_QUOTE = "fw::quote::final_quote",
6
9
  VIEW_TRANSACTION_BREAKDOWN = "fw::quote::view_transaction_breakdown",
7
10
  PENDING_CALLBACK = "fw::pending_callback",