@funkit/connect 13.1.1 → 13.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 +94 -0
- package/dist/{chunk-53FF4ZHH.js → chunk-SJ7E3DKC.js} +6 -0
- package/dist/{chunk-2RND3WWH.js → chunk-V4VFNIG4.js} +6 -0
- package/dist/clients/aave.d.ts +1 -1
- package/dist/clients/{chunk-44LV4GCX.js → chunk-2INCUCQQ.js} +1 -0
- package/dist/clients/chunk-6JL6PF5P.js +22 -0
- package/dist/clients/chunk-747THMHY.js +185 -0
- package/dist/clients/{chunk-Q4JGDB4L.js → chunk-BMU5EYUJ.js} +8 -24
- package/dist/clients/{chunk-T6YNXIOS.js → chunk-HBW7AZUH.js} +7 -5
- package/dist/clients/{chunk-ZBBYOJWK.js → chunk-KDZFZETH.js} +176 -0
- package/dist/clients/{chunk-D6EY2WW4.js → chunk-PVBHWD47.js} +1 -1
- package/dist/clients/chunk-RNTQ7KEL.js +76 -0
- package/dist/clients/{chunk-ZEXIDBIZ.js → chunk-RTHDOT5K.js} +1 -1
- package/dist/clients/{chunk-AJGDTTRJ.js → chunk-SKYQYPX5.js} +58 -2
- package/dist/clients/{chunk-NNMZMHO6.js → chunk-Z6FHIDTD.js} +5 -5
- package/dist/clients/fanatics.css +3136 -2947
- package/dist/clients/fanatics.js +1 -1
- package/dist/clients/internal/nado/withdrawalCallback.js +4 -4
- package/dist/clients/internal/nado/withdrawalErrors.js +2 -2
- package/dist/clients/internal/nado/withdrawalForm.js +12 -77
- package/dist/clients/internal/nado/withdrawalStatus.css +18233 -0
- package/dist/clients/internal/nado/withdrawalStatus.js +218 -20
- package/dist/clients/lighter.css +3519 -2947
- package/dist/clients/lighter.js +5 -7
- package/dist/clients/mallard.d.ts +24 -3
- package/dist/clients/mallard.js +7 -3
- package/dist/clients/nado.js +4 -4
- package/dist/clients/polymarket/createPolymarketDepositConfig.js +4 -3
- package/dist/clients/polymarket/index.js +9 -7
- package/dist/clients/polymarket/polymarket.js +6 -4
- package/dist/components/Box/Box.d.ts +18 -18
- package/dist/components/Dropdown/BaseDropdownItem.d.ts +1 -1
- package/dist/components/FunAsset/FunAssetItem.d.ts +3 -1
- package/dist/components/FunBadge/FunBadge.d.ts +1 -1
- package/dist/components/FunTransactionSummary/PaymentFeesSummary.d.ts +2 -3
- package/dist/components/FunTransactionSummary/PaymentFeesSummary.track.d.ts +2 -3
- package/dist/components/ModalErrorState/ModalErrorState.d.ts +2 -3
- package/dist/consts/customers.d.ts +1 -1
- package/dist/consts/polymarket.d.ts +1 -1
- package/dist/css/sprinkles.css.d.ts +24 -18
- package/dist/domains/clientMetadata.d.ts +2 -1
- package/dist/domains/convert/hostTimeout.d.ts +1 -1
- package/dist/domains/destinationAssetBalance.d.ts +1 -1
- package/dist/hooks/queries/useWithdrawalQuote.d.ts +2 -3
- package/dist/hooks/statsig/index.d.ts +1 -0
- package/dist/hooks/track/analytics/mappers.d.ts +11 -1
- package/dist/hooks/track/analytics/swappedErrorCode.d.ts +1 -0
- package/dist/hooks/track/analytics/useTrackErrorShown.d.ts +2 -3
- package/dist/hooks/useConvertBalances.d.ts +6 -1
- package/dist/hooks/useFunkitMaxCheckoutUsdInfo.d.ts +3 -3
- package/dist/hooks/useHostDepositSettlement.d.ts +12 -0
- package/dist/hooks/useModalStateValueWithProp.d.ts +1 -1
- package/dist/hooks/useRefreshBalancesOnDeposit.d.ts +20 -0
- package/dist/index.css +3519 -2947
- package/dist/index.d.ts +3 -1
- package/dist/index.js +6179 -3864
- package/dist/interfaces/solanaWallet.d.ts +2 -2
- package/dist/modals/CheckoutModal/FiatV2/FiatV2Step.d.ts +19 -0
- package/dist/modals/CheckoutModal/FiatV2/fiatV2DepositInputs.d.ts +38 -0
- package/dist/modals/CheckoutModal/FiatV2/fiatV2PaymentSelectionEffects.d.ts +26 -0
- package/dist/modals/CheckoutModal/FiatV2/useFiatV2DepositInputs.d.ts +6 -0
- package/dist/modals/CheckoutModal/FiatV2/useFiatV2PaymentSelectionHost.d.ts +22 -0
- package/dist/modals/CheckoutModal/FiatV2/useFiatV2Text.d.ts +7 -0
- package/dist/modals/CheckoutModal/FunCheckoutStep.d.ts +3 -1
- package/dist/modals/CheckoutModal/InputAmount/useCheckoutAmountLimits.d.ts +3 -3
- package/dist/modals/CheckoutModal/SourceChange/AddCardItem.d.ts +9 -0
- package/dist/modals/CheckoutModal/SourceChange/SourceChange.d.ts +5 -0
- package/dist/modals/CheckoutModal/SourceChange/fiatV2Reroute.d.ts +24 -0
- package/dist/modals/CheckoutModal/SourceChange/useAddCardRow.d.ts +13 -0
- package/dist/modals/CheckoutModal/SourceChange/useFiatV2Entry.d.ts +21 -0
- package/dist/modals/CheckoutModal/stepTransition.d.ts +3 -0
- package/dist/modals/PolymarketPerpsTransfer/TransferActionButton.d.ts +5 -5
- package/dist/modals/WithdrawalModal/WithdrawalContent.d.ts +2 -3
- package/dist/providers/FunSessionContext.d.ts +20 -0
- package/dist/providers/FunkitCheckoutContext/index.d.ts +7 -1
- package/dist/providers/FunkitCheckoutContext/types.d.ts +30 -0
- package/dist/providers/FunkitProvider.d.ts +7 -0
- package/dist/providers/FunkitQuoteContext.track.d.ts +2 -3
- package/dist/providers/FunkitThemeProvider.d.ts +9 -0
- package/dist/shadow-css.js +1 -1
- package/dist/themes/darkTheme.js +1 -1
- package/dist/themes/lightTheme.js +1 -1
- package/dist/utils/checkout.d.ts +2 -2
- package/dist/utils/localStorageFunSessionStorage.d.ts +9 -0
- package/dist/v2/components/PrimaryButton.css.d.ts +5 -0
- package/dist/v2/components/PrimaryButton.d.ts +16 -0
- package/dist/v2/components/Sheet.css.d.ts +13 -0
- package/dist/v2/components/Sheet.d.ts +23 -0
- package/dist/v2/components/Spinner.css.d.ts +2 -0
- package/dist/v2/components/Spinner.d.ts +6 -0
- package/dist/v2/flows/fiat/FiatDepositGate.d.ts +20 -0
- package/dist/v2/flows/fiat/FiatScreenPicker.d.ts +37 -0
- package/dist/v2/flows/funLogin/FunLoginScreenPicker.d.ts +30 -0
- package/dist/v2/screens/amount/AmountDisplay.css.d.ts +5 -0
- package/dist/v2/screens/amount/AmountDisplay.d.ts +15 -0
- package/dist/v2/screens/amount/AmountScreen.css.d.ts +2 -0
- package/dist/v2/screens/amount/AmountScreen.d.ts +37 -0
- package/dist/v2/screens/amount/PresetButton.css.d.ts +1 -0
- package/dist/v2/screens/amount/PresetButton.d.ts +9 -0
- package/dist/v2/screens/amount/fittedText/useFittedText.d.ts +19 -0
- package/dist/v2/screens/amount/fittedText/useIsomorphicEffect.d.ts +2 -0
- package/dist/v2/screens/amount/fittedText/useTextMeasurer.d.ts +3 -0
- package/dist/v2/screens/amount/typedAmount/amountText.d.ts +37 -0
- package/dist/v2/screens/amount/typedAmount/attachInputNormalization.d.ts +1 -0
- package/dist/v2/screens/fiat/FiatPlaceholderScreen.d.ts +9 -0
- package/dist/v2/screens/funLogin/FunLoginCodeScreen.d.ts +35 -0
- package/dist/v2/screens/funLogin/FunLoginEmailScreen.d.ts +26 -0
- package/dist/v2/screens/funLogin/FunLoginScreen.css.d.ts +20 -0
- package/dist/v2/screens/funLogin/looksLikeEmail.d.ts +5 -0
- package/dist/v2/theme/colors.d.ts +28 -0
- package/dist/v2/theme/fonts.d.ts +9 -0
- package/dist/v2/theme/radii.d.ts +6 -0
- package/dist/wallets/walletConnectors/index.js +39 -39
- package/package.json +4 -4
- package/dist/clients/chunk-JXTKKLVA.js +0 -185
- package/dist/clients/chunk-PZSKO3BJ.js +0 -60
- package/dist/components/FunPayments/icons/coinbase.d.ts +0 -5
|
@@ -6,12 +6,12 @@ import type { FunkitSolanaAdapter } from '@funkit/fun-relay';
|
|
|
6
6
|
export interface SolanaWalletConnection {
|
|
7
7
|
/**
|
|
8
8
|
* Wallet name, e.g. `Phantom`. Picks the icon when none is supplied, and is
|
|
9
|
-
* how funkit
|
|
9
|
+
* how funkit recognizes the same wallet connected on both ecosystems.
|
|
10
10
|
*/
|
|
11
11
|
name: string;
|
|
12
12
|
/**
|
|
13
13
|
* Icon to show for this wallet, as a URL or data URI. Falls back to a
|
|
14
|
-
* bundled icon for wallets funkit
|
|
14
|
+
* bundled icon for wallets funkit recognizes by name, then to a generic one.
|
|
15
15
|
*/
|
|
16
16
|
icon?: string;
|
|
17
17
|
/**
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { CheckoutModalCommonState } from '../stepTransition.shared';
|
|
2
|
+
import type { FunCheckoutStep } from '../FunCheckoutStep';
|
|
3
|
+
import type { ModalStepInfo } from '../stepTransition';
|
|
4
|
+
/** The picker row that opened the step. Only Apple Pay has a V2 deposit today. */
|
|
5
|
+
export type FiatV2Method = 'apple_pay' | 'card';
|
|
6
|
+
export type FiatV2State = CheckoutModalCommonState & {
|
|
7
|
+
fiatV2Method: FiatV2Method;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* The flow has no forward exit yet. `null` makes the step's `onNext`
|
|
11
|
+
* uncallable on purpose, because `onNext` below returns the state unchanged.
|
|
12
|
+
*/
|
|
13
|
+
export type FiatV2Next = null;
|
|
14
|
+
/**
|
|
15
|
+
* The bridge from the V1 checkout modal into the V2 checkout. Every V2 screen renders under this
|
|
16
|
+
* one step, so the V1 step registry and picker never branch on which V2 screen is showing.
|
|
17
|
+
* - V2 screens draw their own title and close, so V1's top bar is hidden.
|
|
18
|
+
*/
|
|
19
|
+
export declare const FiatV2StepInfo: ModalStepInfo<FunCheckoutStep.FIAT_V2>;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { FiatDepositGateProps } from '../../../v2/flows/fiat/FiatDepositGate';
|
|
2
|
+
/**
|
|
3
|
+
* The providers web runs: MoonPay (Jeremy's call). Its steps after the first request still need
|
|
4
|
+
* web components, so a deposit waits there until they land.
|
|
5
|
+
*/
|
|
6
|
+
export declare const WEB_RUNNABLE_PROVIDERS: FiatDepositGateProps['runnable'];
|
|
7
|
+
/** Why the Apple Pay row keeps the Swapped flow instead of opening V2. */
|
|
8
|
+
export type FiatV2SkipReason = 'no_checkout' | 'no_recipient' | 'unmapped_destination' | 'no_geo';
|
|
9
|
+
export type FiatV2DepositInputs = {
|
|
10
|
+
kind: 'ready';
|
|
11
|
+
context: FiatDepositGateProps['context'];
|
|
12
|
+
runnable: FiatDepositGateProps['runnable'];
|
|
13
|
+
routing: Omit<FiatDepositGateProps['routing'], 'identityAssertionProvider'>;
|
|
14
|
+
} | {
|
|
15
|
+
kind: 'skip';
|
|
16
|
+
reason: FiatV2SkipReason;
|
|
17
|
+
};
|
|
18
|
+
export interface FiatV2CheckoutFacts {
|
|
19
|
+
targetChain: string;
|
|
20
|
+
targetAsset: string;
|
|
21
|
+
/** The wallet the deposit lands in, or null when none can receive on `targetChain`. */
|
|
22
|
+
recipient: string | null;
|
|
23
|
+
ipInfo: {
|
|
24
|
+
alpha2: string;
|
|
25
|
+
state: string;
|
|
26
|
+
} | undefined;
|
|
27
|
+
apiKey: string;
|
|
28
|
+
userId: string;
|
|
29
|
+
checkoutId: string;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* What the V2 deposit needs from the V1 checkout, or why the checkout can't open it.
|
|
33
|
+
* - The destination is the token the provider buys. Only a target that is USDC on a chain the
|
|
34
|
+
* rail table lists maps. Any other target would need the backend to swap, which web does not
|
|
35
|
+
* ask for yet, so it keeps the Swapped flow.
|
|
36
|
+
* - The bearer is left out: the deposit gate supplies the Fun login as one provider instance.
|
|
37
|
+
*/
|
|
38
|
+
export declare function fiatV2DepositInputsOf(facts: FiatV2CheckoutFacts): FiatV2DepositInputs;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { CardCheckRefusal, EnteredCard } from '@funkit/connect-core';
|
|
2
|
+
export type CardCheckResult = {
|
|
3
|
+
outcome: 'checked';
|
|
4
|
+
lifetimeMs?: number;
|
|
5
|
+
} | {
|
|
6
|
+
outcome: 'refused';
|
|
7
|
+
refusal: CardCheckRefusal;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* The side effects the FiatV2 payment selection reducer asks its host to run.
|
|
11
|
+
* The reducer never calls the network or reads the clock; the host runs these
|
|
12
|
+
* and sends the answers back as events.
|
|
13
|
+
* - Pass a stable object (module constant or memoized): the expiry timer
|
|
14
|
+
* restarts when this identity changes.
|
|
15
|
+
*/
|
|
16
|
+
export interface FiatV2PaymentSelectionEffects {
|
|
17
|
+
/** `POST /fiat/cards/check`. A throw is reported as `CARD_CHECK_FAILED`. */
|
|
18
|
+
checkCard(card: EnteredCard): Promise<CardCheckResult>;
|
|
19
|
+
/** Device clock in ms. Held-card expiry is measured against it. */
|
|
20
|
+
now(): number;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* M0 stand-in until the card check route exists in api-base. Every check is
|
|
24
|
+
* refused as retryable, so the flow can be driven end to end without a vault.
|
|
25
|
+
*/
|
|
26
|
+
export declare const UNAVAILABLE_CARD_CHECK: FiatV2PaymentSelectionEffects;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type FiatV2DepositInputs } from './fiatV2DepositInputs';
|
|
2
|
+
/**
|
|
3
|
+
* What the V2 deposit needs from the open checkout, read where V1 keeps it. The Apple Pay row
|
|
4
|
+
* reads it to decide whether to open V2, and the V2 step reads it to mount the deposit.
|
|
5
|
+
*/
|
|
6
|
+
export declare function useFiatV2DepositInputs(): FiatV2DepositInputs;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type FiatV2PaymentSelectionEvent, type FiatV2PaymentSelectionState } from '@funkit/connect-core';
|
|
2
|
+
import type { FiatV2PaymentSelectionEffects } from './fiatV2PaymentSelectionEffects';
|
|
3
|
+
/**
|
|
4
|
+
* Events a V2 screen may send. The rest (check answers, expiry, saved-card
|
|
5
|
+
* loads, saves) come from the host's own effects, so a screen can't fake them.
|
|
6
|
+
*/
|
|
7
|
+
export type FiatV2BuyerPaymentEvent = Extract<FiatV2PaymentSelectionEvent, {
|
|
8
|
+
type: 'PAYMENT_METHOD_SELECTED' | 'CARD_ENTRY_OPENED' | 'CARD_ENTRY_CLOSED' | 'CARD_SUBMITTED' | 'CARD_CHECK_RETRIED' | 'CARD_SELECTED' | 'CHANGE_CARD';
|
|
9
|
+
}>;
|
|
10
|
+
/**
|
|
11
|
+
* Holds machine 6 (FiatV2 payment selection) for the FIAT_V2 step and runs the side
|
|
12
|
+
* effects its states ask for: the card check a Submit or Retry tap starts, and
|
|
13
|
+
* the expiry timer while a card is held. Replaced by the FiatV2 root reducer's host later.
|
|
14
|
+
*/
|
|
15
|
+
export declare function useFiatV2PaymentSelectionHost({ effects, }: {
|
|
16
|
+
effects: FiatV2PaymentSelectionEffects;
|
|
17
|
+
}): {
|
|
18
|
+
state: FiatV2PaymentSelectionState;
|
|
19
|
+
send: (event: FiatV2BuyerPaymentEvent) => void;
|
|
20
|
+
};
|
|
21
|
+
/** Short label for the placeholder screen, e.g. `card:refused:rate_limited`. */
|
|
22
|
+
export declare function stageOf(state: FiatV2PaymentSelectionState): string;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { AmountScreenText } from '../../../v2/screens/amount/AmountScreen';
|
|
2
|
+
import type { FunLoginText } from '../../../v2/flows/funLogin/FunLoginScreenPicker';
|
|
3
|
+
/** The V2 deposit's strings in the buyer's language. V2 can't import V1's translate function (R1). */
|
|
4
|
+
export declare function useFiatV2Text(): {
|
|
5
|
+
amount: AmountScreenText;
|
|
6
|
+
login: FunLoginText;
|
|
7
|
+
};
|
|
@@ -23,5 +23,7 @@ export declare enum FunCheckoutStep {
|
|
|
23
23
|
CONVERT_SELECT_SOURCE = "convert_select_source",
|
|
24
24
|
CONVERT_SELECT_DESTINATION = "convert_select_destination",
|
|
25
25
|
WITHDRAWAL_ENTER_AMOUNT = "withdrawal_enter_amount",
|
|
26
|
-
WITHDRAWAL_COMPLETE = "withdrawal_complete"
|
|
26
|
+
WITHDRAWAL_COMPLETE = "withdrawal_complete",
|
|
27
|
+
/** Bridge into the V2 checkout (FiatV2 today). One step hosts every V2 screen. */
|
|
28
|
+
FIAT_V2 = "fiat_v2"
|
|
27
29
|
}
|
|
@@ -4,9 +4,9 @@ import type { FunkitCheckoutConfig } from '../../../providers/FunkitCheckoutCont
|
|
|
4
4
|
export type { CheckoutAmountLimitsUsd };
|
|
5
5
|
/**
|
|
6
6
|
* Resolves the min/max USD bounds for the amount input based on the active
|
|
7
|
-
* payment method. Fetches the inputs (min-transfer floor, global max
|
|
8
|
-
* delegates the per-method rules to
|
|
9
|
-
* `@funkit/connect-core`.
|
|
7
|
+
* payment method. Fetches the inputs (min-transfer floor, global max lowered
|
|
8
|
+
* by the integrator's max) and delegates the per-method rules to
|
|
9
|
+
* `getCheckoutAmountLimitsUsd` in `@funkit/connect-core`.
|
|
10
10
|
*/
|
|
11
11
|
export declare const useCheckoutAmountLimits: ({ checkoutConfig, paymentMethod, }: {
|
|
12
12
|
checkoutConfig: FunkitCheckoutConfig;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Picker row that opens the V2 checkout with FiatV2 to add a debit card. It borrows
|
|
4
|
+
* the legacy card icon only. Choosing it never goes through Meld.
|
|
5
|
+
*/
|
|
6
|
+
export declare function AddCardItem({ isDisabled, onClick, }: {
|
|
7
|
+
isDisabled: boolean;
|
|
8
|
+
onClick: () => void;
|
|
9
|
+
}): React.JSX.Element;
|
|
@@ -8,6 +8,7 @@ import { type MultiSourceWithdrawalConfig, type SingleWithdrawalConfig } from '.
|
|
|
8
8
|
import { type CheckoutModalCommonState, FunCheckoutStep } from '../stepTransition.shared';
|
|
9
9
|
import { type ModalStepComponentProps, type ModalStepInfo } from '../stepTransition';
|
|
10
10
|
import type { SwappedMode } from '../../../providers/SwappedProvider';
|
|
11
|
+
import type { FiatV2Method } from '../FiatV2/FiatV2Step';
|
|
11
12
|
export type SourceChangeState = CheckoutModalCommonState & {
|
|
12
13
|
paymentMethodInfo: ConnectablePaymentMethodInfo | null;
|
|
13
14
|
/** Persisted payment method type filter (crypto/fiat tab) */
|
|
@@ -59,6 +60,10 @@ export type SourceChangeNext = {
|
|
|
59
60
|
*/
|
|
60
61
|
skipAssetSelect: true;
|
|
61
62
|
paymentMethodInfo: ConnectablePaymentMethodInfo;
|
|
63
|
+
} | {
|
|
64
|
+
/** Open the V2 checkout with FiatV2 from its picker row. */
|
|
65
|
+
fiatV2: true;
|
|
66
|
+
fiatV2Method: FiatV2Method;
|
|
62
67
|
} | {
|
|
63
68
|
/** Enter the cashier withdrawal flow with a resolved single-method config. */
|
|
64
69
|
withdraw: true;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { PaymentMethodType } from '../../../hooks/usePaymentSources';
|
|
2
|
+
import type { FiatV2DepositInputs, FiatV2SkipReason } from '../FiatV2/fiatV2DepositInputs';
|
|
3
|
+
export type FiatV2Reroute =
|
|
4
|
+
/** Not an Apple Pay deposit with the gate on: the row works as before, with nothing to log. */
|
|
5
|
+
{
|
|
6
|
+
kind: 'not_eligible';
|
|
7
|
+
} | {
|
|
8
|
+
kind: 'reroute';
|
|
9
|
+
}
|
|
10
|
+
/** An Apple Pay deposit V2 can't serve: Swapped opens as before, and the reason is logged. */
|
|
11
|
+
| {
|
|
12
|
+
kind: 'skip';
|
|
13
|
+
reason: FiatV2SkipReason;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Whether the Apple Pay row opens the V2 deposit instead of Swapped's. Only a deposit, only with
|
|
17
|
+
* the Web V2 gate on, and only when V2 has every input it needs.
|
|
18
|
+
*/
|
|
19
|
+
export declare function fiatV2RerouteOf({ isGateOn, tab, fopType, inputs, }: {
|
|
20
|
+
isGateOn: boolean;
|
|
21
|
+
tab: PaymentMethodType;
|
|
22
|
+
fopType: string;
|
|
23
|
+
inputs: FiatV2DepositInputs;
|
|
24
|
+
}): FiatV2Reroute;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import type { PaymentMethodType } from '../../../hooks/usePaymentSources';
|
|
3
|
+
/**
|
|
4
|
+
* The "Add a card" row, or null when the Web V2 gate is off so the picker is
|
|
5
|
+
* unchanged. The picker reads the gate once and passes it in.
|
|
6
|
+
*/
|
|
7
|
+
export declare function useAddCardRow({ isEnabled, isDisabled, isSwappedEnabled, tab, onOpen, }: {
|
|
8
|
+
isEnabled: boolean;
|
|
9
|
+
isDisabled: boolean;
|
|
10
|
+
isSwappedEnabled: boolean;
|
|
11
|
+
tab: PaymentMethodType;
|
|
12
|
+
onOpen: () => void;
|
|
13
|
+
}): ReactNode | null;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { SwappedFormOfPayment } from '@funkit/api-base';
|
|
2
|
+
import type { ReactNode } from 'react';
|
|
3
|
+
import type { PaymentMethodType } from '../../../hooks/usePaymentSources';
|
|
4
|
+
import type { FiatV2Method } from '../FiatV2/FiatV2Step';
|
|
5
|
+
/**
|
|
6
|
+
* The picker's ways into the V2 deposit, behind its one read of the Web V2 gate: the "Add a card"
|
|
7
|
+
* row, and the Apple Pay row sent to V2 instead of Swapped.
|
|
8
|
+
* - `openedV2` decides at the click and logs it, so a row that renders logs nothing.
|
|
9
|
+
* - A row sent to V2 still counts as a method selection, with no rail: Swapped never runs.
|
|
10
|
+
*/
|
|
11
|
+
export declare function useFiatV2Entry({ isDisabled, isSwappedEnabled, tab, onOpen, }: {
|
|
12
|
+
isDisabled: boolean;
|
|
13
|
+
isSwappedEnabled: boolean;
|
|
14
|
+
tab: PaymentMethodType;
|
|
15
|
+
/** Opens the V2 step for the row's method. */
|
|
16
|
+
onOpen: (method: FiatV2Method) => void;
|
|
17
|
+
}): {
|
|
18
|
+
addCardRow: ReactNode | null;
|
|
19
|
+
/** Opens V2 and returns true when this Apple Pay click belongs there. */
|
|
20
|
+
openedV2: (fop: SwappedFormOfPayment) => boolean;
|
|
21
|
+
};
|
|
@@ -9,6 +9,7 @@ import { type PerpsTransferNext, type PerpsTransferState } from '../PolymarketPe
|
|
|
9
9
|
import { type ConvertSelectDestinationNext, type ConvertSelectDestinationState } from './Convert/ConvertSelectDestinationStep';
|
|
10
10
|
import { type ConvertSelectSourceNext, type ConvertSelectSourceState } from './Convert/ConvertSelectSourceStep';
|
|
11
11
|
import { type ConvertNext, type ConvertState } from './Convert/ConvertStep';
|
|
12
|
+
import { type FiatV2Next, type FiatV2State } from './FiatV2/FiatV2Step';
|
|
12
13
|
import { type SelectBrokerageNext, type SelectBrokerageState } from './Brokerage/SelectBrokerage';
|
|
13
14
|
import { type CheckoutCompleteNext, type CheckoutCompleteState } from './CheckoutComplete/CheckoutComplete';
|
|
14
15
|
import { type ConfirmationStepNext, type ConfirmationStepState } from './ConfirmationStep/ConfirmationStep';
|
|
@@ -113,6 +114,7 @@ export type CheckoutModalState<S extends FunCheckoutStep = FunCheckoutStep> = {
|
|
|
113
114
|
[FunCheckoutStep.CONVERT_SELECT_DESTINATION]: ConvertSelectDestinationState;
|
|
114
115
|
[FunCheckoutStep.WITHDRAWAL_ENTER_AMOUNT]: WithdrawalEnterAmountState;
|
|
115
116
|
[FunCheckoutStep.WITHDRAWAL_COMPLETE]: WithdrawalCompleteState;
|
|
117
|
+
[FunCheckoutStep.FIAT_V2]: FiatV2State;
|
|
116
118
|
}[T] & {
|
|
117
119
|
step: T;
|
|
118
120
|
previousStep?: FunCheckoutStep | null;
|
|
@@ -144,6 +146,7 @@ export type NextPayload<S extends FunCheckoutStep = FunCheckoutStep> = {
|
|
|
144
146
|
[FunCheckoutStep.CONVERT_SELECT_DESTINATION]: ConvertSelectDestinationNext;
|
|
145
147
|
[FunCheckoutStep.WITHDRAWAL_ENTER_AMOUNT]: WithdrawalEnterAmountNext;
|
|
146
148
|
[FunCheckoutStep.WITHDRAWAL_COMPLETE]: WithdrawalCompleteNext;
|
|
149
|
+
[FunCheckoutStep.FIAT_V2]: FiatV2Next;
|
|
147
150
|
}[S] & {
|
|
148
151
|
/** Whether screen transition should change direction to simulate back transition. Only applies if there is a history entry in the stack*/
|
|
149
152
|
reverseAnimation?: boolean;
|
|
@@ -13,7 +13,7 @@ export interface TransferActionButtonProps {
|
|
|
13
13
|
pendingLabel: string;
|
|
14
14
|
/** Label shown on success (already translated). */
|
|
15
15
|
successLabel: string;
|
|
16
|
-
/**
|
|
16
|
+
/** Grays out / blocks the idle button until an amount is entered. */
|
|
17
17
|
isDisabled?: boolean;
|
|
18
18
|
onClick?: () => void;
|
|
19
19
|
testId?: string;
|
|
@@ -26,16 +26,16 @@ export interface TransferActionButtonProps {
|
|
|
26
26
|
* - **loading**: dimmed blue, spinner + loading label, inert.
|
|
27
27
|
* - **pending**: dimmed blue, spinner + pending label, inert — a previous
|
|
28
28
|
* transfer reported by the integrator is still settling.
|
|
29
|
-
* - **success**: secondary (
|
|
29
|
+
* - **success**: secondary (gray) surface, green check + success label, inert.
|
|
30
30
|
*
|
|
31
31
|
* Two details keep the morph smooth:
|
|
32
32
|
*
|
|
33
33
|
* 1. Each state's content (icon + label) is a single absolutely-positioned,
|
|
34
|
-
* centered layer, and we swap whole layers. Because every layer
|
|
34
|
+
* centered layer, and we swap whole layers. Because every layer centers
|
|
35
35
|
* itself, the label never shifts horizontally when the icon appears — the
|
|
36
36
|
* transition is a pure vertical blur/fade (matching the From/To row swap).
|
|
37
|
-
* 2. The
|
|
37
|
+
* 2. The gray surface is the always-present base; the blue sits on top as an
|
|
38
38
|
* overlay whose opacity only ever fades *out* toward success. Nothing
|
|
39
|
-
* brightens mid-transition, so there's no blue "flush" as it turns
|
|
39
|
+
* brightens mid-transition, so there's no blue "flush" as it turns gray.
|
|
40
40
|
*/
|
|
41
41
|
export declare function TransferActionButton({ status, idleLabel, processingLabel, loadingLabel, pendingLabel, successLabel, isDisabled, onClick, testId, }: TransferActionButtonProps): React.JSX.Element;
|
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { Hex } from 'viem';
|
|
3
3
|
import { type ModalBottomBarIdType } from '../../components/Dialog/Dialog';
|
|
4
|
-
import type {
|
|
4
|
+
import type { AnalyticsNamedStep } from '../../hooks/track/analytics/mappers';
|
|
5
5
|
import type { FunkitActiveWithdrawalItem, MultiSourceWithdrawalConfig, SingleWithdrawalConfig } from '../../providers/FunkitCheckoutContext';
|
|
6
6
|
import { type WithdrawalFormData } from './useWithdrawal';
|
|
7
|
-
import { WithdrawalModalStep } from './types';
|
|
8
7
|
/**
|
|
9
8
|
* Multi-method configs are resolved in WithdrawalModal before reaching here; a
|
|
10
9
|
* multi-source config is resolved by {@link MultiSourceWithdrawContent}.
|
|
11
10
|
*/
|
|
12
11
|
interface WithdrawContentProps {
|
|
13
|
-
analyticsStep:
|
|
12
|
+
analyticsStep: AnalyticsNamedStep;
|
|
14
13
|
/** `executedConfig` is the source that ran — the picked one on a multi-source config. */
|
|
15
14
|
onContinue: (withdrawal: WithdrawalFormData, txHash: Hex, executedConfig: SingleWithdrawalConfig) => void;
|
|
16
15
|
config: SingleWithdrawalConfig | MultiSourceWithdrawalConfig;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type FunSessionStorage, type FunSessionStore } from '@funkit/connect-core';
|
|
2
|
+
import React, { type ReactNode } from 'react';
|
|
3
|
+
/** Ends Fun's login for `owner`, the current user by default. Never rejects. */
|
|
4
|
+
export type FunSignOut = (owner?: string) => Promise<void>;
|
|
5
|
+
/** Fun's login for the current user: the store the web fiat flow signs in with and sends. */
|
|
6
|
+
export declare function useFunSessionStore(): FunSessionStore | undefined;
|
|
7
|
+
/** Ends Fun's login: outside a `FunkitProvider` there is none, so it does nothing. */
|
|
8
|
+
export declare function useFunSignOut(): FunSignOut;
|
|
9
|
+
/**
|
|
10
|
+
* Holds Fun's login, one store per API key and user, for the provider's life.
|
|
11
|
+
* - A login lasts up to a year, longer than any checkout, so it lives here and not in a flow.
|
|
12
|
+
* - Nothing is restored here: the fiat flow restores the login when a checkout needs it.
|
|
13
|
+
* - A user switched back to gets the same store, since a second one could spend a refresh handle
|
|
14
|
+
* the first is still refreshing with.
|
|
15
|
+
* - Without a known user the login stays in memory, so two users never share one stored login.
|
|
16
|
+
*/
|
|
17
|
+
export declare function FunSessionProvider({ storage, children, }: {
|
|
18
|
+
storage: FunSessionStorage;
|
|
19
|
+
children: ReactNode;
|
|
20
|
+
}): React.JSX.Element;
|
|
@@ -4,6 +4,7 @@ import type { Address, Hex } from 'viem';
|
|
|
4
4
|
import { type ApplyDynamicRoutingPath } from '../../domains/dynamicRouting';
|
|
5
5
|
import { type PaymentMethodInfo } from '../../domains/paymentMethods';
|
|
6
6
|
import type { AssetHoldingsItem } from '../../utils/assets';
|
|
7
|
+
import { type FunSignOut } from '../FunSessionContext';
|
|
7
8
|
import type { WithdrawalClient, WithdrawalSignContext, WithdrawalTransaction } from '../../wallets/Wallet';
|
|
8
9
|
import { type FunkitCheckoutQuoteResult } from '../FunkitHistoryContext';
|
|
9
10
|
import type { DynamicTargetAssetCandidate, FunkitActiveCheckoutItem, FunkitActiveWithdrawalItem, FunkitCheckoutConfig, FunkitWithdrawalConfig, MultiSourceWithdrawalConfig, PolymarketPerpsTransferPending, SingleWithdrawalConfig, UseFunkitCheckoutProps, UseFunkitCheckoutPropsWithFullConfig } from './types';
|
|
@@ -98,17 +99,22 @@ export declare function CheckoutConfigOverride({ config, children, }: {
|
|
|
98
99
|
children: ReactNode;
|
|
99
100
|
}): React.JSX.Element | null;
|
|
100
101
|
/**
|
|
101
|
-
* External hook for user to kickstart a checkout in their app
|
|
102
|
+
* External hook for user to kickstart a checkout in their app.
|
|
103
|
+
* `signOut` ends Fun's own email login, which web fiat deposits sign in with, as connect-rn's does.
|
|
102
104
|
*/
|
|
103
105
|
export declare function useFunkitCheckout(props: UseFunkitCheckoutPropsWithFullConfig): {
|
|
104
106
|
beginCheckout: (config?: Partial<FunkitCheckoutConfig>) => Promise<{
|
|
105
107
|
isActivated: boolean;
|
|
106
108
|
}>;
|
|
107
109
|
beginWithdrawal: (config: FunkitWithdrawalConfig) => void;
|
|
110
|
+
/** Ends the buyer's Fun email login: the server revokes it, and it leaves storage. */
|
|
111
|
+
signOut: FunSignOut;
|
|
108
112
|
};
|
|
109
113
|
export declare function useFunkitCheckout(props: UseFunkitCheckoutProps): {
|
|
110
114
|
beginCheckout: (config: FunkitCheckoutConfig) => Promise<{
|
|
111
115
|
isActivated: boolean;
|
|
112
116
|
}>;
|
|
113
117
|
beginWithdrawal: (config: FunkitWithdrawalConfig) => void;
|
|
118
|
+
/** Ends the buyer's Fun email login: the server revokes it, and it leaves storage. */
|
|
119
|
+
signOut: FunSignOut;
|
|
114
120
|
};
|
|
@@ -666,6 +666,36 @@ export type FunkitCheckoutResult = {
|
|
|
666
666
|
message: string;
|
|
667
667
|
metadata: object | Error;
|
|
668
668
|
};
|
|
669
|
+
export type FunkitDepositSettlementResult = {
|
|
670
|
+
type: 'success';
|
|
671
|
+
} | {
|
|
672
|
+
type: 'error';
|
|
673
|
+
message: string;
|
|
674
|
+
};
|
|
675
|
+
export interface FunkitDepositSettlementContext {
|
|
676
|
+
checkoutId: string;
|
|
677
|
+
dynamicRoutingId: string | undefined;
|
|
678
|
+
destination: {
|
|
679
|
+
chainId: string;
|
|
680
|
+
tokenAddress: string;
|
|
681
|
+
walletAddress: string;
|
|
682
|
+
};
|
|
683
|
+
/** May be empty when no on-chain transaction is reported. */
|
|
684
|
+
sourceTransactions: {
|
|
685
|
+
chainId: string;
|
|
686
|
+
txId: string;
|
|
687
|
+
}[];
|
|
688
|
+
/** Same-chain: the user's own transaction, which is also the delivery. */
|
|
689
|
+
destinationTransactions: {
|
|
690
|
+
chainId: string;
|
|
691
|
+
txId: string;
|
|
692
|
+
}[];
|
|
693
|
+
/**
|
|
694
|
+
* Aborted at the time limit, or when the checkout is discarded. Closing the
|
|
695
|
+
* modal after the deposit is submitted only hides it, so the check goes on.
|
|
696
|
+
*/
|
|
697
|
+
signal: AbortSignal;
|
|
698
|
+
}
|
|
669
699
|
/** Props common to every checkout, regardless of form factor. */
|
|
670
700
|
interface UseFunkitCheckoutBaseProps {
|
|
671
701
|
/** @optional the checkout config object **/
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { FunSessionStorage } from '@funkit/connect-core';
|
|
1
2
|
import { QueryClient } from '@tanstack/react-query';
|
|
2
3
|
import React, { type ReactNode } from 'react';
|
|
3
4
|
import type { Chain } from '../wagmi/chains';
|
|
@@ -35,6 +36,12 @@ interface FunkitProviderInnerProps {
|
|
|
35
36
|
* runtime changes are ignored. Remount the provider to change it.
|
|
36
37
|
*/
|
|
37
38
|
adoptWallet?: WalletAdoptionConfig;
|
|
39
|
+
/**
|
|
40
|
+
* Where Fun's own login is kept between visits, for fiat deposits where the buyer signs in with
|
|
41
|
+
* an email code. Defaults to the browser's `localStorage`. The value is a credential that lasts
|
|
42
|
+
* up to a year, so pass storage of your own to keep it elsewhere.
|
|
43
|
+
*/
|
|
44
|
+
funSessionStorage?: FunSessionStorage;
|
|
38
45
|
}
|
|
39
46
|
export type FunkitWagmiConfig = Omit<CreateFunkitWagmiConfigParameters, 'funkitApiKey' | 'initialChainId' | 'appName'> & {
|
|
40
47
|
projectId: string;
|
|
@@ -3,15 +3,14 @@ import type { PaymentMethodInfo } from '../domains/paymentMethods';
|
|
|
3
3
|
import type { FunkitCheckoutQuoteResult, QuotePhaseResult } from '../domains/quote';
|
|
4
4
|
import { QuoteMode } from '../domains/quoteMode';
|
|
5
5
|
import type { PerfQuoteProperties } from '../hooks/track/analytics/events';
|
|
6
|
+
import { type AnalyticsNamedStep } from '../hooks/track/analytics/mappers';
|
|
6
7
|
import type { CheckoutModalEvent } from '../hooks/track/CheckoutModalEvent';
|
|
7
8
|
import type { TrackEventData } from '../hooks/track/useTrack';
|
|
8
9
|
import type { WithdrawModalEvent } from '../hooks/track/WithdrawModalEvent';
|
|
9
|
-
import type { FunCheckoutStep } from '../modals/CheckoutModal/FunCheckoutStep';
|
|
10
|
-
import type { WithdrawalModalStep } from '../modals/WithdrawalModal/types';
|
|
11
10
|
import type { FunkitActiveCheckoutItem } from './FunkitCheckoutContext';
|
|
12
11
|
export declare const trackEventFromBaseQuote: (checkoutItem: FunkitActiveCheckoutItem, eventName: CheckoutModalEvent | WithdrawModalEvent, quoteMode?: QuoteMode) => TrackEventData;
|
|
13
12
|
type PerfQuotePropertiesContext = {
|
|
14
|
-
analyticsStep:
|
|
13
|
+
analyticsStep: AnalyticsNamedStep;
|
|
15
14
|
checkoutItem: FunkitActiveCheckoutItem;
|
|
16
15
|
connectorId: string | undefined;
|
|
17
16
|
directExecutionType: DirectExecutionType | null;
|
|
@@ -114,6 +114,9 @@ export declare const useActiveTheme: () => {
|
|
|
114
114
|
failedBadgeBackground: string;
|
|
115
115
|
failedBadgeBorder: string;
|
|
116
116
|
failedBadgeText: string;
|
|
117
|
+
nativeBadgeBackground: string;
|
|
118
|
+
nativeBadgeBorder: string;
|
|
119
|
+
nativeBadgeText: string;
|
|
117
120
|
inputAmountQuickOptionBaseBackground: string;
|
|
118
121
|
inputAmountQuickOptionHoverBackground: string;
|
|
119
122
|
inputAmountQuickOptionActiveBackground: string;
|
|
@@ -649,6 +652,9 @@ export declare const useActiveTheme: () => {
|
|
|
649
652
|
failedBadgeBackground: string;
|
|
650
653
|
failedBadgeBorder: string;
|
|
651
654
|
failedBadgeText: string;
|
|
655
|
+
nativeBadgeBackground: string;
|
|
656
|
+
nativeBadgeBorder: string;
|
|
657
|
+
nativeBadgeText: string;
|
|
652
658
|
inputAmountQuickOptionBaseBackground: string;
|
|
653
659
|
inputAmountQuickOptionHoverBackground: string;
|
|
654
660
|
inputAmountQuickOptionActiveBackground: string;
|
|
@@ -1182,6 +1188,9 @@ export declare const useActiveTheme: () => {
|
|
|
1182
1188
|
failedBadgeBackground: string;
|
|
1183
1189
|
failedBadgeBorder: string;
|
|
1184
1190
|
failedBadgeText: string;
|
|
1191
|
+
nativeBadgeBackground: string;
|
|
1192
|
+
nativeBadgeBorder: string;
|
|
1193
|
+
nativeBadgeText: string;
|
|
1185
1194
|
inputAmountQuickOptionBaseBackground: string;
|
|
1186
1195
|
inputAmountQuickOptionHoverBackground: string;
|
|
1187
1196
|
inputAmountQuickOptionActiveBackground: string;
|