@funkit/connect 12.13.0 → 12.15.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 (56) hide show
  1. package/CHANGELOG.md +58 -0
  2. package/dist/clients/axiom.d.ts +12 -0
  3. package/dist/clients/axiom.js +27 -0
  4. package/dist/clients/{chunk-YMBIRJQF.js → chunk-6IH7AWFA.js} +1 -1
  5. package/dist/clients/{chunk-P6UM36G5.js → chunk-7JYLS7IF.js} +32 -0
  6. package/dist/clients/{chunk-ZOQQL2QX.js → chunk-BKK2BFIP.js} +1 -1
  7. package/dist/clients/{chunk-I75AI3N7.js → chunk-C3BTAVJA.js} +6 -6
  8. package/dist/clients/{chunk-R6E3NH5A.js → chunk-FLREOB24.js} +1 -1
  9. package/dist/clients/{chunk-U33QNTIA.js → chunk-IUVVGGP4.js} +66 -5
  10. package/dist/clients/{chunk-5GX6G7JR.js → chunk-OB5GKTP2.js} +1 -1
  11. package/dist/clients/{chunk-I5GSXPFE.js → chunk-TKEBGMVW.js} +1 -7
  12. package/dist/clients/fanatics.js +2 -2
  13. package/dist/clients/internal/nado/withdrawalCallback.js +4 -4
  14. package/dist/clients/internal/nado/withdrawalErrors.js +2 -2
  15. package/dist/clients/internal/nado/withdrawalForm.js +3 -3
  16. package/dist/clients/internal/nado/withdrawalStatus.js +3 -3
  17. package/dist/clients/lighter.css +271 -225
  18. package/dist/clients/lighter.js +3 -3
  19. package/dist/clients/mallard.js +2 -2
  20. package/dist/clients/nado.js +4 -4
  21. package/dist/clients/polymarket/createPolymarketDepositConfig.d.ts +5 -5
  22. package/dist/clients/polymarket/createPolymarketDepositConfig.js +3 -3
  23. package/dist/clients/polymarket/index.js +3 -3
  24. package/dist/clients/polymarket/polymarket.js +2 -2
  25. package/dist/components/TokenSwapWidget/AmountUnitToggle/AmountUnitToggle.d.ts +2 -1
  26. package/dist/components/TokenSwapWidget/TokenSwapCard/TokenSwapCard.d.ts +17 -6
  27. package/dist/components/TokenSwapWidget/TokenSwapWidget.d.ts +9 -7
  28. package/dist/consts/animation.d.ts +8 -0
  29. package/dist/consts/customers.d.ts +2 -2
  30. package/dist/domains/asset.d.ts +2 -3
  31. package/dist/domains/checkoutTransfer.d.ts +8 -0
  32. package/dist/domains/clientMetadata.d.ts +4 -3
  33. package/dist/domains/savedFopsCache.d.ts +15 -0
  34. package/dist/domains/tokenAddress.d.ts +7 -0
  35. package/dist/hooks/queries/useHasSavedFops.d.ts +2 -1
  36. package/dist/hooks/track/CheckoutModalEvent.d.ts +1 -0
  37. package/dist/hooks/track/analytics/events.d.ts +1 -1
  38. package/dist/hooks/track/analytics/useTrackExecutionProgressEvents.d.ts +17 -2
  39. package/dist/hooks/useAnimatedNavigation.d.ts +2 -2
  40. package/dist/hooks/useCheckoutTransferInit.d.ts +3 -3
  41. package/dist/index.css +46 -0
  42. package/dist/index.js +45373 -44823
  43. package/dist/modals/CheckoutModal/Convert/ConvertStep.d.ts +6 -0
  44. package/dist/modals/CheckoutModal/FunCheckoutStep.d.ts +1 -0
  45. package/dist/modals/CheckoutModal/HeaderTabs/CheckoutHeaderTabs.d.ts +12 -0
  46. package/dist/modals/CheckoutModal/HeaderTabs/headerTabs.d.ts +8 -0
  47. package/dist/modals/CheckoutModal/HeaderTabs/useCheckoutHeaderTabsState.d.ts +4 -0
  48. package/dist/modals/CheckoutModal/stepTransition.d.ts +3 -0
  49. package/dist/modals/PolymarketPerpsTransfer/usePerpsHeaderTabsState.d.ts +1 -21
  50. package/dist/providers/FunkitCheckoutContext/types.d.ts +44 -4
  51. package/dist/shadow-css.js +1 -1
  52. package/dist/utils/hypercoreRelayWallet.d.ts +12 -0
  53. package/dist/wallets/walletConnectors/index.js +45 -45
  54. package/package.json +6 -6
  55. package/dist/clients/internal/nado/withdrawalForm.css +0 -17587
  56. package/dist/modals/PolymarketPerpsTransfer/PerpsHeaderTabs.d.ts +0 -29
@@ -0,0 +1,6 @@
1
+ import { FunCheckoutStep } from '../FunCheckoutStep';
2
+ import type { ModalStepInfo } from '../stepTransition';
3
+ import type { CheckoutModalCommonState } from '../stepTransition.shared';
4
+ export type ConvertState = CheckoutModalCommonState;
5
+ export type ConvertNext = null;
6
+ export declare const ConvertStepInfo: ModalStepInfo<FunCheckoutStep.CONVERT>;
@@ -22,6 +22,7 @@ export declare enum FunCheckoutStep {
22
22
  BROKERAGE_SUCCESS = "brokerage_success",
23
23
  SWAPPED_IFRAME = "swapped_iframe",
24
24
  PERPS_TRANSFER = "perps_transfer",
25
+ CONVERT = "convert",
25
26
  WITHDRAWAL_ENTER_AMOUNT = "withdrawal_enter_amount",
26
27
  WITHDRAWAL_COMPLETE = "withdrawal_complete"
27
28
  }
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ import type { CheckoutModalState } from '../../../modals/CheckoutModal/stepTransition';
3
+ import type { CheckoutHeaderTabsState } from './headerTabs';
4
+ export interface CheckoutHeaderTabsProps {
5
+ state: CheckoutHeaderTabsState;
6
+ modalState: CheckoutModalState;
7
+ onStepChange: (state: CheckoutModalState) => void;
8
+ /** Line under the tabs; shown only while the active tab fills the header. */
9
+ meta?: string;
10
+ }
11
+ /** The active checkout's header tabs in the modal title slot. */
12
+ export declare function CheckoutHeaderTabs({ state, modalState, onStepChange, meta, }: CheckoutHeaderTabsProps): React.JSX.Element;
@@ -0,0 +1,8 @@
1
+ import type { CheckoutModalState } from '../../../modals/CheckoutModal/stepTransition';
2
+ import { type CheckoutHeaderTab, type CheckoutHeaderTabs } from '../../../providers/FunkitCheckoutContext/types';
3
+ export interface CheckoutHeaderTabsState {
4
+ tabs: CheckoutHeaderTab[];
5
+ activeTab: CheckoutHeaderTab;
6
+ }
7
+ /** Header tabs for the current screen; undefined on deeper screens or without tabs. */
8
+ export declare function getCheckoutHeaderTabsState(headerTabs: CheckoutHeaderTabs | undefined, modalState: Pick<CheckoutModalState, 'step' | 'startingStep'>): CheckoutHeaderTabsState | undefined;
@@ -0,0 +1,4 @@
1
+ import type { CheckoutModalState } from '../../../modals/CheckoutModal/stepTransition';
2
+ import { type CheckoutHeaderTabsState } from './headerTabs';
3
+ /** Resolves the active checkout's header tabs (with funkit's `t`) for the current screen. */
4
+ export declare function useCheckoutHeaderTabsState(modalState: Pick<CheckoutModalState, 'step' | 'startingStep'>): CheckoutHeaderTabsState | undefined;
@@ -6,6 +6,7 @@ import { type VirtualFiatAccountNext, type VirtualFiatAccountState } from '../..
6
6
  import { type DynamicTargetAssetCandidate, FunCheckoutStartingStep, type FunkitActiveCheckoutItem } from '../../providers/FunkitCheckoutContext';
7
7
  import { type FunkitTextCustomizationsConfig } from '../../providers/FunkitConfigContext';
8
8
  import { type PerpsTransferNext, type PerpsTransferState } from '../PolymarketPerpsTransfer/PerpsTransferStep';
9
+ import { type ConvertNext, type ConvertState } from './Convert/ConvertStep';
9
10
  import { type BrokerageSuccessState } from './Brokerage/BrokerageSuccessModal';
10
11
  import { type BrokerageTwoFANext, type BrokerageTwoFAState } from './Brokerage/BrokerageTwoFA';
11
12
  import { type ConnectExchangeNext, type ConnectExchangeState } from './Brokerage/ConnectExchange';
@@ -111,6 +112,7 @@ export type CheckoutModalState<S extends FunCheckoutStep = FunCheckoutStep> = {
111
112
  [FunCheckoutStep.BROKERAGE_SUCCESS]: BrokerageSuccessState;
112
113
  [FunCheckoutStep.SWAPPED_IFRAME]: SwappedIframeState;
113
114
  [FunCheckoutStep.PERPS_TRANSFER]: PerpsTransferState;
115
+ [FunCheckoutStep.CONVERT]: ConvertState;
114
116
  [FunCheckoutStep.WITHDRAWAL_ENTER_AMOUNT]: WithdrawalEnterAmountState;
115
117
  [FunCheckoutStep.WITHDRAWAL_COMPLETE]: WithdrawalCompleteState;
116
118
  }[T] & {
@@ -142,6 +144,7 @@ export type NextPayload<S extends FunCheckoutStep = FunCheckoutStep> = {
142
144
  [FunCheckoutStep.BROKERAGE_SUCCESS]: null;
143
145
  [FunCheckoutStep.SWAPPED_IFRAME]: SwappedIframeNext;
144
146
  [FunCheckoutStep.PERPS_TRANSFER]: PerpsTransferNext;
147
+ [FunCheckoutStep.CONVERT]: ConvertNext;
145
148
  [FunCheckoutStep.WITHDRAWAL_ENTER_AMOUNT]: WithdrawalEnterAmountNext;
146
149
  [FunCheckoutStep.WITHDRAWAL_COMPLETE]: WithdrawalCompleteNext;
147
150
  }[S] & {
@@ -1,6 +1,4 @@
1
- import type { CheckoutModalState } from '../../modals/CheckoutModal/stepTransition';
2
- import type { DepositAccess, FunkitCheckoutConfig } from '../../providers/FunkitCheckoutContext/types';
3
- export type PerpsHeaderTabId = 'predictions' | 'perps' | 'transfer';
1
+ import type { FunkitCheckoutConfig } from '../../providers/FunkitCheckoutContext/types';
4
2
  /**
5
3
  * Live "Predictions Balance: $X" / "Perps Balance: $X" line for the selected
6
4
  * account of a perps-enabled checkout; `undefined` otherwise (or while the
@@ -8,21 +6,3 @@ export type PerpsHeaderTabId = 'predictions' | 'perps' | 'transfer';
8
6
  * steps.
9
7
  */
10
8
  export declare function usePerpsTitleMeta(config: FunkitCheckoutConfig | undefined): string | undefined;
11
- export interface PerpsHeaderTabsState {
12
- activeTabId: PerpsHeaderTabId;
13
- onTabChange: (tabId: PerpsHeaderTabId) => void;
14
- /** Balance line under the tabs; absent on the transfer step. */
15
- meta: string | undefined;
16
- isTransferStep: boolean;
17
- access: DepositAccess;
18
- }
19
- /**
20
- * Tab state + selection behavior for the perps header tabs, off the active
21
- * checkout's config: Predictions/Perps switch the deposit destination through
22
- * the target-asset-candidate path, Transfer opens/leaves the transfer step.
23
- * `null` when the checkout carries no perps transfer handles.
24
- */
25
- export declare function usePerpsHeaderTabsState({ modalState, onStepChange, }: {
26
- modalState: CheckoutModalState;
27
- onStepChange: (state: CheckoutModalState) => void;
28
- }): PerpsHeaderTabsState | null;
@@ -6,6 +6,7 @@ import type { Address } from 'viem';
6
6
  import type { NadoWithdrawalCustomerConfig, NadoWithdrawalCustomerData } from '@funkit/connect-core/clients/nado';
7
7
  import type { PaymentMethodInfo } from '../../domains/paymentMethods';
8
8
  import type { CheckoutBlockedReason } from '../../modals/CheckoutModal/CheckoutBlockedReason';
9
+ import type { FunCheckoutStep } from '../../modals/CheckoutModal/FunCheckoutStep';
9
10
  import type { WithdrawalClient, WithdrawalTransaction } from '../../wallets/Wallet';
10
11
  import type { FunkitCheckoutQuoteResult } from '../FunkitHistoryContext';
11
12
  export type FunkitCheckoutActionParams = ApiFunkitCheckoutActionParams;
@@ -141,6 +142,45 @@ export interface PolymarketPerpsTransferHandles {
141
142
  */
142
143
  initialAmountUsd?: string;
143
144
  }
145
+ /**
146
+ * Screens a header tab can open. `SOURCE_CHANGE` is the deposit screen; the
147
+ * others are steps that need no extra modal state, since a tab opens its step
148
+ * with `{ ...modalState, step }`.
149
+ */
150
+ export type CheckoutHeaderTabStep = FunCheckoutStep.SOURCE_CHANGE | FunCheckoutStep.PERPS_TRANSFER | FunCheckoutStep.CONVERT;
151
+ export interface CheckoutHeaderTab {
152
+ /** Stable id; used for the active-tab highlight and logs. */
153
+ id: string;
154
+ /** Tab text, already translated (or a customer-supplied string shown as-is). */
155
+ label: string;
156
+ /** Shown but not clickable. */
157
+ disabled?: boolean;
158
+ /** Tooltip on a disabled tab. */
159
+ disabledTooltip?: string;
160
+ /** Screen this tab opens. */
161
+ step: CheckoutHeaderTabStep;
162
+ /**
163
+ * Deposit destination (token, chain, recipient, route) applied on click,
164
+ * before the screen opens. Omit to keep the current one. Has no bearing on
165
+ * which tab is active; see `CheckoutHeaderTabs.resolveSharedTab`.
166
+ */
167
+ dynamicTargetAsset?: DynamicTargetAssetCandidate;
168
+ /**
169
+ * Fills the header behind the tabs with the theme's `offBackground` while
170
+ * this tab is active. The active pill takes the other color, so it always
171
+ * contrasts. Omit for the plain modal background.
172
+ */
173
+ headerBackground?: 'offBackground';
174
+ }
175
+ export interface CheckoutHeaderTabs {
176
+ tabs: CheckoutHeaderTab[];
177
+ /**
178
+ * Picks the active tab when several tabs open the same screen (e.g. predictions & perps for the deposit screen).
179
+ * Fn receives those tabs and returns the id of whichever matches the live config.
180
+ * Not called for a tab that has a unique screen.
181
+ */
182
+ resolveSharedTab?: (screenTabs: CheckoutHeaderTab[]) => string;
183
+ }
144
184
  export interface FunkitCheckoutConfig extends Omit<ApiFunkitCheckoutConfig, 'generateActionsParams' | 'customRecipient' | 'modalTitle' | 'iconSrc' | 'modalTitleMeta'> {
145
185
  /** List of contract action params **/
146
186
  generateActionsParams?: (targetAssetAmount: number, config?: {
@@ -194,11 +234,11 @@ export interface FunkitCheckoutConfig extends Omit<ApiFunkitCheckoutConfig, 'gen
194
234
  * Return `null` or `[]` to omit rows; only the first 3 are shown.
195
235
  *
196
236
  * @example
197
- * resolveDestinationLineItems: ({ targetAssetHumanAmount }) => [
237
+ * resolveDestinationLineItems: ({ targetAssetAmount }) => [
198
238
  * {
199
239
  * id: 'initial-margin-usage',
200
240
  * label: { text: 'Initial Margin Usage', tooltip: 'Collateral required to open positions.' },
201
- * value: { text: projectInitialMargin(targetAssetHumanAmount), color: 'success' },
241
+ * value: { text: projectInitialMargin(targetAssetAmount), color: 'success' },
202
242
  * },
203
243
  * ]
204
244
  */
@@ -703,8 +743,8 @@ export interface DestinationLineItem {
703
743
  }
704
744
  /** Live checkout amounts handed to `resolveDestinationLineItems`. */
705
745
  export interface DestinationLineItemContext {
706
- /** Amount landing in the target asset, human units — the same figure the "You receive" row shows. */
707
- targetAssetHumanAmount: string;
746
+ /** Target asset amount in token units (e.g. "1.5" for 1.5 USDC), matching the "You receive" row. */
747
+ targetAssetAmount: string;
708
748
  /** Token the user is paying with. `null` fields when no source is selected yet. */
709
749
  sourceTokenSymbol: string | null;
710
750
  sourceTokenAddress: Address | null;