@funkit/connect 12.12.1 → 12.14.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 (41) hide show
  1. package/CHANGELOG.md +41 -0
  2. package/dist/clients/{chunk-GPI6LBBB.js → chunk-5GX6G7JR.js} +1 -1
  3. package/dist/clients/{chunk-JDQK4VQB.js → chunk-I75AI3N7.js} +5 -5
  4. package/dist/clients/{chunk-JN52EBYV.js → chunk-P6UM36G5.js} +64 -0
  5. package/dist/clients/{chunk-RBMOSICG.js → chunk-YMBIRJQF.js} +1 -1
  6. package/dist/clients/{chunk-WXHSEFYH.js → chunk-ZOQQL2QX.js} +1 -1
  7. package/dist/clients/fanatics.js +2 -2
  8. package/dist/clients/internal/nado/withdrawalCallback.js +3 -3
  9. package/dist/clients/internal/nado/withdrawalErrors.js +2 -2
  10. package/dist/clients/internal/nado/withdrawalForm.js +3 -3
  11. package/dist/clients/internal/nado/withdrawalStatus.js +3 -3
  12. package/dist/clients/lighter.css +225 -225
  13. package/dist/clients/lighter.js +3 -3
  14. package/dist/clients/mallard.js +2 -2
  15. package/dist/clients/nado.js +3 -3
  16. package/dist/components/FunTransactionSummary/PaymentFeesSummary.d.ts +6 -1
  17. package/dist/components/LargeAmountInput/LargeAmountInput.css.d.ts +8 -0
  18. package/dist/components/LargeAmountInput/LargeAmountInput.d.ts +26 -0
  19. package/dist/components/SwapDirectionButton/SwapDirectionButton.d.ts +12 -0
  20. package/dist/components/TokenSwapWidget/AmountUnitToggle/AmountUnitToggle.d.ts +13 -0
  21. package/dist/components/TokenSwapWidget/AmountUnitToggle/useAmountUnitToggle.d.ts +46 -0
  22. package/dist/components/TokenSwapWidget/TokenSelectButton/TokenSelectButton.d.ts +17 -0
  23. package/dist/components/TokenSwapWidget/TokenSwapCard/TokenSwapCard.d.ts +24 -0
  24. package/dist/components/TokenSwapWidget/TokenSwapWidget.css.d.ts +5 -0
  25. package/dist/components/TokenSwapWidget/TokenSwapWidget.d.ts +36 -0
  26. package/dist/consts/animation.d.ts +8 -0
  27. package/dist/domains/asset.d.ts +2 -3
  28. package/dist/domains/checkoutTransfer.d.ts +8 -0
  29. package/dist/domains/savedFopsCache.d.ts +15 -0
  30. package/dist/domains/tokenAddress.d.ts +7 -0
  31. package/dist/hooks/queries/useHasSavedFops.d.ts +2 -1
  32. package/dist/hooks/useAnimatedNavigation.d.ts +2 -2
  33. package/dist/hooks/useCheckoutTransferInit.d.ts +3 -3
  34. package/dist/index.d.ts +1 -1
  35. package/dist/index.js +44918 -44727
  36. package/dist/modals/WithdrawalModal/useWithdrawalExtraFeeItems.d.ts +8 -0
  37. package/dist/providers/FunkitCheckoutContext/types.d.ts +33 -4
  38. package/dist/utils/hypercoreRelayWallet.d.ts +12 -0
  39. package/dist/wallets/walletConnectors/index.js +38 -38
  40. package/package.json +5 -5
  41. package/dist/clients/internal/nado/withdrawalForm.css +0 -17587
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Centers the swap button over the gap between the two cards. The ring in the
3
+ * modal background color makes it look cut out of both cards.
4
+ */
5
+ export declare const swapDirectionButtonSlot: string;
@@ -0,0 +1,36 @@
1
+ import React from 'react';
2
+ import type { AmountUnit } from './AmountUnitToggle/useAmountUnitToggle';
3
+ import type { TokenSwapToken } from './TokenSelectButton/TokenSelectButton';
4
+ export type { TokenSwapToken };
5
+ interface TokenSwapSideAmounts {
6
+ token: TokenSwapToken;
7
+ onTokenClick?: () => void;
8
+ usdAmount: number | undefined;
9
+ tokenAmount: number | undefined;
10
+ /** The user's holding of `token`, in token units. */
11
+ tokenBalance?: number;
12
+ }
13
+ export interface TokenSwapFromSide extends TokenSwapSideAmounts {
14
+ /** What the user typed, in `unit`. */
15
+ inputValue: string;
16
+ onInputChange: (next: string) => void;
17
+ }
18
+ export interface TokenSwapToSide extends TokenSwapSideAmounts {
19
+ /** Shows a skeleton in place of the amount while the quote loads. */
20
+ isLoading?: boolean;
21
+ }
22
+ export interface TokenSwapWidgetProps {
23
+ from: TokenSwapFromSide;
24
+ to: TokenSwapToSide;
25
+ /** Unit the amounts are entered and shown in. */
26
+ unit: AmountUnit;
27
+ /** Omit to hide the unit switch (e.g. price unknown). */
28
+ onToggleUnit?: () => void;
29
+ onSwapDirection: () => void;
30
+ isSwapDirectionDisabled?: boolean;
31
+ }
32
+ /**
33
+ * From card, swap-direction button, To card. Layout and callbacks only; the
34
+ * caller owns amounts, quotes and token selection.
35
+ */
36
+ export declare function TokenSwapWidget({ from, to, unit, onToggleUnit, onSwapDirection, isSwapDirectionDisabled, }: TokenSwapWidgetProps): React.JSX.Element;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Shared modal transition timing, in milliseconds.
3
+ *
4
+ * A leaf module: both `useAnimatedNavigation` and the `.css.ts` files that
5
+ * animate alongside it need this number, and having either own it puts the
6
+ * stylesheet and the hook in a runtime import cycle.
7
+ */
8
+ export declare const ANIMATION_DELAY = 75;
@@ -1,8 +1,8 @@
1
1
  import type { TFunction } from 'i18next';
2
- import type { Address } from 'viem';
3
2
  import type { FunkitCheckoutConfig } from '../providers/FunkitCheckoutContext';
4
3
  import type { CheckoutPayer } from '../providers/GeneralWalletProvider';
5
4
  import type { AssetHoldingsItem } from '../utils/assets';
5
+ import { isNativeTokenAddress } from './tokenAddress';
6
6
  import { PaymentMethod } from '../domains/paymentMethods';
7
7
  /**
8
8
  * Calculates the minimum USD value an asset must have to be considered usable for checkout.
@@ -10,7 +10,7 @@ import { PaymentMethod } from '../domains/paymentMethods';
10
10
  */
11
11
  export declare function getMinValueThreshold(config: FunkitCheckoutConfig | undefined, minUsdRequired?: number): number;
12
12
  export declare function isPreferredChain(chainId: number, additionalChains?: number[]): boolean;
13
- export declare function isNativeTokenAddress(address: Address): boolean;
13
+ export { isNativeTokenAddress };
14
14
  export declare function isDefaultToken(asset: AssetHoldingsItem, checkoutConfig: FunkitCheckoutConfig): boolean;
15
15
  export declare const isPolygonEcosystemToken: (chainId: string, tokenAddress: string) => boolean;
16
16
  interface AssetUsableToPayParms {
@@ -32,4 +32,3 @@ export declare const isAssetUsableToPayForCheckout: ({ config, payerWallets, pay
32
32
  reason: string;
33
33
  minUsdWithFees?: number;
34
34
  };
35
- export {};
@@ -0,0 +1,8 @@
1
+ import { type CheckoutInitTokenTransferAddressParams } from '@funkit/api-base';
2
+ export type CheckoutTokenTransferParams = Omit<CheckoutInitTokenTransferAddressParams, 'logger' | 'clientMetadata'>;
3
+ /**
4
+ * Lives here rather than beside `useCheckoutTransferInit` so that
5
+ * `FunkitCheckoutContext` can call it without importing that hook module —
6
+ * which imports the context straight back, closing a runtime import cycle.
7
+ */
8
+ export declare function checkoutTransferFetch(params: CheckoutTokenTransferParams): Promise<import("@funkit/api-base").CheckoutInitTokenTransferResponse>;
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Per-browser cache of "has this user saved a form of payment", so the payment
3
+ * step can render its first frame without waiting on the FOPs query.
4
+ *
5
+ * A leaf module on purpose: `GeneralWalletProvider` clears this cache on logout,
6
+ * and the hook that reads it needs the provider — keeping the storage here stops
7
+ * that from closing a runtime import cycle.
8
+ */
9
+ /**
10
+ * Synchronous read from localStorage. Safe for use in useState initializers.
11
+ * Returns true/false if a valid cache entry exists for the user, undefined otherwise.
12
+ */
13
+ export declare function readHasSavedFops(userId: string): boolean | undefined;
14
+ export declare function writeHasSavedFops(userId: string, hasSavedFops: boolean): void;
15
+ export declare function clearHasSavedFopsCache(): void;
@@ -0,0 +1,7 @@
1
+ import type { Address } from 'viem';
2
+ /**
3
+ * A leaf module: `domains/asset` and `utils/checkout` both need this predicate
4
+ * and import each other otherwise, which closes a runtime import cycle.
5
+ * `domains/asset` re-exports it, so existing importers are unaffected.
6
+ */
7
+ export declare function isNativeTokenAddress(address: Address): boolean;
@@ -1,2 +1,3 @@
1
- export declare function clearHasSavedFopsCache(): void;
1
+ import { clearHasSavedFopsCache } from '../../domains/savedFopsCache';
2
+ export { clearHasSavedFopsCache };
2
3
  export declare function useHasSavedFops(): boolean | undefined;
@@ -1,4 +1,5 @@
1
- export declare const ANIMATION_DELAY = 75;
1
+ import { ANIMATION_DELAY } from '../consts/animation';
2
+ export { ANIMATION_DELAY };
2
3
  /**
3
4
  * @param isInitialStep utilizes the old scale-in for initial display. Based on this boolean and animation state.
4
5
  * @returns className to be applied on the animatable content
@@ -24,4 +25,3 @@ export interface AnimationState {
24
25
  isSkipped: boolean;
25
26
  isReversed: boolean;
26
27
  }
27
- export {};
@@ -1,5 +1,6 @@
1
- import { type CheckoutInitTokenTransferAddressParams, type CheckoutInitTokenTransferResponse, type FunAddress } from '@funkit/api-base';
1
+ import { type CheckoutInitTokenTransferResponse, type FunAddress } from '@funkit/api-base';
2
2
  import { getCheckoutTokenTransferParams } from '@funkit/connect-core';
3
+ import { checkoutTransferFetch } from '../domains/checkoutTransfer';
3
4
  export { getCheckoutTokenTransferParams };
4
5
  interface UseCheckoutTransferInitResponse {
5
6
  transferInit: CheckoutInitTokenTransferResponse | undefined;
@@ -7,8 +8,7 @@ interface UseCheckoutTransferInitResponse {
7
8
  isLoading: boolean;
8
9
  isFetching: boolean;
9
10
  }
10
- type CheckoutTokenTransferParams = Omit<CheckoutInitTokenTransferAddressParams, 'logger' | 'clientMetadata'>;
11
- export declare function checkoutTransferFetch(params: CheckoutTokenTransferParams): Promise<CheckoutInitTokenTransferResponse>;
11
+ export { checkoutTransferFetch };
12
12
  export declare function useIsQRCodeTransferEnabled(): {
13
13
  enabled: boolean;
14
14
  comingSoon: boolean;
package/dist/index.d.ts CHANGED
@@ -20,7 +20,7 @@ export { createAuthenticationAdapter, FunkitConnectAuthenticationProvider, } fro
20
20
  export type { AuthenticationAdapter, FunkitConnectAuthenticationProviderProps, } from './providers/AuthenticationContext';
21
21
  export type { AvatarComponent } from './providers/AvatarContext';
22
22
  export type { CheckoutBlockedReason } from './modals/CheckoutModal/CheckoutBlockedReason';
23
- export type { FunkitCheckoutActionParams, FunkitCheckoutConfig, FunkitCheckoutOnCloseResult, FunkitWithdrawalConfig, WalletWithdrawalConfig, CustomWithdrawalConfig, MultiMethodWithdrawalConfig, WithdrawalMethodOption, WithdrawalParam, WithdrawalFormData, WithdrawalSourceTokenBalanceParams, WithdrawalSourceCustomData, SourceTokenOption, WithdrawalCustomerData, LighterWithdrawalCustomerData, LighterRouteType, WithdrawalCustomerConfig, UseFunkitCheckoutPropsWithFullConfig, UseFunkitCheckoutProps, FunkitCheckoutValidationResult, FunkitCheckoutResult, DynamicTargetAssetCandidate, AddToWalletToken, TokenInfo, ModalTitleContext, DestinationLineItem, DestinationLineItemContext, LineItemSlot, LineItemValue, LineItemValueColor, } from './providers/FunkitCheckoutContext';
23
+ export type { FunkitCheckoutActionParams, FunkitCheckoutConfig, FunkitCheckoutOnCloseResult, FunkitWithdrawalConfig, WalletWithdrawalConfig, CustomWithdrawalConfig, MultiMethodWithdrawalConfig, WithdrawalMethodOption, WithdrawalParam, WithdrawalFormData, WithdrawalSourceTokenBalanceParams, WithdrawalSourceCustomData, SourceTokenOption, WithdrawalCustomerData, LighterWithdrawalCustomerData, LighterRouteType, WithdrawalCustomerConfig, UseFunkitCheckoutPropsWithFullConfig, UseFunkitCheckoutProps, FunkitCheckoutValidationResult, FunkitCheckoutResult, DynamicTargetAssetCandidate, AddToWalletToken, TokenInfo, ModalTitleContext, DestinationLineItem, DestinationLineItemContext, LineItemSlot, LineItemValue, LineItemValueColor, WithdrawalFeeItem, WithdrawalFeeItemContext, } from './providers/FunkitCheckoutContext';
24
24
  export { useFunkitCheckout, FunCheckoutStartingStep, } from './providers/FunkitCheckoutContext';
25
25
  export type { FunkitCheckoutQuoteResult } from './domains/quote';
26
26
  export type { FunkitConfig, FunkitUiCustomizationsConfig, FunkitTextCustomizationsConfig, } from './providers/FunkitConfigContext';