@funkit/connect 9.12.0 → 9.13.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 +19 -0
  2. package/README.md +21 -0
  3. package/dist/clients/lighter.js +1 -0
  4. package/dist/components/FunOptionBox/FunOptionBox.css.d.ts +1 -1
  5. package/dist/hooks/queries/useRecentDeposits.d.ts +39 -49
  6. package/dist/index.js +2226 -2082
  7. package/dist/modals/CheckoutModal/SourceChange/FlatList.d.ts +31 -0
  8. package/dist/modals/CheckoutModal/SourceChange/GroupedList.d.ts +25 -0
  9. package/dist/modals/CheckoutModal/SourceChange/SourceList.d.ts +17 -9
  10. package/dist/modals/CheckoutModal/SourceChange/buildSourceGroups.d.ts +47 -0
  11. package/dist/modals/CheckoutModal/TransferToken/types.d.ts +1 -2
  12. package/dist/modals/ProfileDetails/FunProfileViews/Home/HomeCheckoutDisplayRow.css.d.ts +1 -1
  13. package/dist/modals/WithdrawalModal/ErrorMessage.d.ts +4 -0
  14. package/dist/modals/WithdrawalModal/RecipientAddress.d.ts +11 -0
  15. package/dist/providers/FunkitCheckoutContext/types.d.ts +1 -0
  16. package/dist/providers/FunkitConfigContext.d.ts +2 -0
  17. package/dist/providers/GeneralWalletProvider.d.ts +2 -4
  18. package/dist/utils/userInfo.d.ts +36 -0
  19. package/dist/wallets/walletConnectors/bifrostWallet/bifrostWallet.js +2 -2
  20. package/dist/wallets/walletConnectors/bitgetWallet/bitgetWallet.js +2 -2
  21. package/dist/wallets/walletConnectors/bybitWallet/bybitWallet.js +2 -2
  22. package/dist/wallets/walletConnectors/clvWallet/clvWallet.js +2 -2
  23. package/dist/wallets/walletConnectors/coin98Wallet/coin98Wallet.js +2 -2
  24. package/dist/wallets/walletConnectors/coreWallet/coreWallet.js +2 -2
  25. package/dist/wallets/walletConnectors/foxWallet/foxWallet.js +2 -2
  26. package/dist/wallets/walletConnectors/frontierWallet/frontierWallet.js +2 -2
  27. package/dist/wallets/walletConnectors/gateWallet/gateWallet.js +2 -2
  28. package/dist/wallets/walletConnectors/index.js +43 -43
  29. package/dist/wallets/walletConnectors/metaMaskWallet/metaMaskWallet.js +2 -2
  30. package/dist/wallets/walletConnectors/okxWallet/okxWallet.js +2 -2
  31. package/dist/wallets/walletConnectors/rainbowWallet/rainbowWallet.js +2 -2
  32. package/dist/wallets/walletConnectors/roninWallet/roninWallet.js +2 -2
  33. package/dist/wallets/walletConnectors/safepalWallet/safepalWallet.js +2 -2
  34. package/dist/wallets/walletConnectors/subWallet/subWallet.js +2 -2
  35. package/dist/wallets/walletConnectors/tokenPocketWallet/tokenPocketWallet.js +2 -2
  36. package/dist/wallets/walletConnectors/trustWallet/trustWallet.js +2 -2
  37. package/dist/wallets/walletConnectors/zerionWallet/zerionWallet.js +2 -2
  38. package/package.json +7 -3
  39. package/dist/wallets/walletConnectors/{chunk-5TN5Z2WY.js → chunk-3ZJN3PXP.js} +3 -3
  40. package/dist/wallets/walletConnectors/{chunk-V6UOWTEZ.js → chunk-55VS2NKG.js} +3 -3
  41. package/dist/wallets/walletConnectors/{chunk-DEFRRPXB.js → chunk-7IEUTLHY.js} +3 -3
  42. package/dist/wallets/walletConnectors/{chunk-LCIPVVH5.js → chunk-AZYMJ4C6.js} +3 -3
  43. package/dist/wallets/walletConnectors/{chunk-T4ROGPMF.js → chunk-FWM4KTOV.js} +3 -3
  44. package/dist/wallets/walletConnectors/{chunk-YIEASHLS.js → chunk-IMNI4AGV.js} +3 -3
  45. package/dist/wallets/walletConnectors/{chunk-7V33VJAL.js → chunk-IRHK6SOW.js} +3 -3
  46. package/dist/wallets/walletConnectors/{chunk-UDTBQV4Q.js → chunk-J3PJOMO7.js} +3 -3
  47. package/dist/wallets/walletConnectors/{chunk-VJZWNQOF.js → chunk-LEAZMT5Y.js} +3 -3
  48. package/dist/wallets/walletConnectors/{chunk-6DRCY52E.js → chunk-OD6B2ISG.js} +3 -3
  49. package/dist/wallets/walletConnectors/{chunk-FG2LDVXL.js → chunk-OSOB6QYX.js} +3 -3
  50. package/dist/wallets/walletConnectors/{chunk-XVBSJCW5.js → chunk-RZQ4B4Z7.js} +3 -3
  51. package/dist/wallets/walletConnectors/{chunk-KWX2SYU2.js → chunk-UFYNHHDU.js} +3 -3
  52. package/dist/wallets/walletConnectors/{chunk-HXWUH73P.js → chunk-UYW6MV74.js} +3 -3
  53. package/dist/wallets/walletConnectors/{chunk-34HACM5U.js → chunk-VMMROPXK.js} +3 -3
  54. package/dist/wallets/walletConnectors/{chunk-ZPSPK6LH.js → chunk-YGMU5VWD.js} +3 -3
  55. package/dist/wallets/walletConnectors/{chunk-APHCF4DT.js → chunk-ZJJWGKB6.js} +3 -3
  56. package/dist/wallets/walletConnectors/{chunk-HRDPUW3V.js → chunk-ZL6XCMV5.js} +3 -3
package/CHANGELOG.md CHANGED
@@ -1,5 +1,24 @@
1
1
  # @funkit/connect
2
2
 
3
+ ## 9.13.0
4
+
5
+ ### Minor Changes
6
+
7
+ - ac8b104: Add `showWalletConnect` option to `uiCustomizations.sourceChangeScreen` to allow hiding the wallet connect payment method
8
+
9
+ ### Patch Changes
10
+
11
+ - 01826fb: chore(connect): bump postcss
12
+ - ab86ca3: refactor(connect): split `SourceList` into a thin composer + `FlatList`/`GroupedList` layout primitives. Internal-only; no public API change; rendered DOM unchanged.
13
+ - 6039a1b: When `externalUserId` is set for Lighter customers, use it directly as `userId` and `walletAddress` instead of wrapping via `generateSyntheticUserId`
14
+ - 3719658: Split useRecentDeposits into a raw API hook and a pure testable transform function
15
+ - ce7e633: Internal: add `testId` prop to `SourceList` for testability.
16
+ - 7743d5b: Extract withdrawal error notification helpers into ErrorMessage module
17
+ - 7743d5b: Extract WithdrawRecipientAddress into its own module and allow multi-method config to disable connected wallet
18
+ - 7743d5b: Use config source chain for withdrawal source token price lookup
19
+ - Updated dependencies [ec97ba2]
20
+ - @funkit/fun-relay@2.7.2
21
+
3
22
  ## 9.12.0
4
23
 
5
24
  ### Minor Changes
package/README.md CHANGED
@@ -10,3 +10,24 @@ The `@funkit/connect` package elevates decentralize applications via web2 & web3
10
10
  ### 📝 Note
11
11
 
12
12
  This package is currently in closed beta. To learn more, reach out to [developers@fun.xyz](mailto:developers@fun.xyz).
13
+
14
+ ## Development
15
+
16
+ ### Running tests
17
+
18
+ From the monorepo root:
19
+
20
+ ```bash
21
+ # Run all connect tests once
22
+ pnpm --filter=@funkit/connect test
23
+
24
+ # Run with coverage (terminal summary + lcov + HTML report)
25
+ pnpm --filter=@funkit/connect test:coverage
26
+
27
+ # Open the Vitest UI (interactive dashboard with live coverage heatmap)
28
+ pnpm --filter=@funkit/connect test:ui
29
+ ```
30
+
31
+ After `test:coverage`, open `packages/connect/coverage/index.html` to browse the HTML report. The `coverage/` directory is gitignored.
32
+
33
+ Coverage is collected by [`@vitest/coverage-v8`](https://vitest.dev/guide/coverage) and excludes generated files, Storybook stories, vanilla-extract style files (`*.css.ts`), and translation JSON. Update the `coverage` block in `vitest.config.ts` to tweak include/exclude patterns.
@@ -120,6 +120,7 @@ var DEFAULT_UI_CUSTOMIZATIONS = {
120
120
  },
121
121
  showTargetAssetSelection: false,
122
122
  showWalletOnInsufficientBalance: false,
123
+ showWalletConnect: true,
123
124
  paymentMethodIcons: {}
124
125
  },
125
126
  inputAmountScreen: {
@@ -1 +1 @@
1
- export declare const funOptionBoxStyle: Record<"activeBackground" | "baseStyle" | "compactListStyle" | "defaultBorder" | "defaultModeNotActiveBorder" | "activeBorder" | "disabledOptionBorder" | "defaultBackground" | "uninteractiveBackground", string>;
1
+ export declare const funOptionBoxStyle: Record<"baseStyle" | "compactListStyle" | "defaultBorder" | "defaultModeNotActiveBorder" | "activeBorder" | "disabledOptionBorder" | "defaultBackground" | "activeBackground" | "uninteractiveBackground", string>;
@@ -1,47 +1,7 @@
1
1
  import { type DirectExecution } from '@funkit/api-base';
2
+ import { type UseQueryResult } from '@tanstack/react-query';
3
+ import type { NotificationVariant } from '../../modals/CheckoutModal/TransferToken/types';
2
4
  import { type PurifiedCheckoutHistoryItem } from '../../utils/purifyCheckoutHistoryItem';
3
- /**
4
- * Query parameters for the useRecentDeposits hook.
5
- */
6
- interface RecentDirectExecutionsQuery {
7
- /**
8
- * Controls whether the hook should fetch and return data.
9
- * When false, the query is disabled and no data will be fetched.
10
- */
11
- isVisible: boolean;
12
- /**
13
- * Optional filter function to further refine which deposits are returned.
14
- * WARNING: Must be a stable reference (wrap in useMemo), otherwise the hook will constantly re-render.
15
- * @param de - The DirectExecution to filter
16
- * @returns true to include the deposit, false to exclude it
17
- */
18
- memoizedFilterFunc?: (de: DirectExecution) => boolean;
19
- /**
20
- * Maximum number of deposits to fetch from the API.
21
- * @default 5
22
- */
23
- fetchSize?: number;
24
- /**
25
- * Custom cutoff time in milliseconds for determining which deposits are "recent".
26
- * Deposits created after this timestamp will be included.
27
- * If not provided, uses Fun's default strategy.
28
- */
29
- cutOffTimeMs?: number;
30
- /**
31
- * API key for authenticating requests to Fun's API server.
32
- */
33
- apiKey: string;
34
- /**
35
- * User ID for which to fetch direct executions.
36
- * Usually user's connected wallet address.
37
- */
38
- userId: string;
39
- /**
40
- * Interval in milliseconds for how often to refetch the data.
41
- * Determines the polling frequency for keeping deposit data up to date.
42
- */
43
- refreshIntervalMs: number;
44
- }
45
5
  export interface MergedMultiStepDirectExecution extends DirectExecution {
46
6
  /**
47
7
  * In a multi-step DE chain, represents the latest **present** DE of the chain.
@@ -53,15 +13,45 @@ export interface MergedMultiStepDirectExecution extends DirectExecution {
53
13
  export declare function mergeMultiStepDirectExecutions(directExecutions: DirectExecution[]): MergedMultiStepDirectExecution[];
54
14
  export declare function isTokenTransferDirectExecution(de: DirectExecution): boolean;
55
15
  export declare function isWithdrawalDirectExecution(de: DirectExecution): boolean;
56
- type DefaultDEQueryKey = 'apiKey' | 'userId' | 'refreshIntervalMs';
57
- export type RecentDEQuerySimplified = Omit<RecentDirectExecutionsQuery, DefaultDEQueryKey>;
58
16
  /**
59
- * @returns recent direct executions tied to a recipient address used in the token transfer flow
17
+ * Pure transform: filters, merges multi-step chains, and sorts direct executions.
18
+ * Testable without React.
60
19
  */
61
- export declare const useRecentDeposits: ({ isVisible, memoizedFilterFunc, fetchSize, cutOffTimeMs, }: RecentDEQuerySimplified) => {
62
- data: MergedMultiStepDirectExecution[] | undefined;
63
- rawData: DirectExecution[] | undefined;
20
+ export declare function processRecentDepositsForNotifications(directExecutions: DirectExecution[] | undefined, { createdAfterMs, cutOffTimeMs, variant, }?: {
21
+ createdAfterMs?: number;
22
+ cutOffTimeMs?: number;
23
+ variant?: NotificationVariant;
24
+ }): MergedMultiStepDirectExecution[] | undefined;
25
+ interface RecentDepositsApiQuery {
26
+ isVisible: boolean;
27
+ fetchSize?: number;
28
+ apiKey: string;
29
+ userId: string;
30
+ refreshIntervalMs: number;
31
+ }
32
+ type DefaultDEQueryKey = 'apiKey' | 'userId' | 'refreshIntervalMs';
33
+ export type RecentDEQuerySimplified = {
34
+ isVisible: boolean;
35
+ fetchSize?: number;
64
36
  };
37
+ /**
38
+ * @returns raw direct executions for the current user (no filtering or transforms applied)
39
+ */
40
+ export declare const useRecentDeposits: ({ isVisible, fetchSize, }: RecentDEQuerySimplified) => UseQueryResult<DirectExecution[]>;
41
+ /**
42
+ * Full explicit-params version of `useRecentDeposits` for use outside FunkitProvider context.
43
+ * Used by SDK wrappers.
44
+ */
45
+ interface RecentDirectExecutionsQuery extends RecentDepositsApiQuery {
46
+ cutOffTimeMs?: number;
47
+ /**
48
+ * Optional filter function to further refine which deposits are returned.
49
+ * WARNING: Must be a stable reference (wrap in useMemo), otherwise the hook will constantly re-render.
50
+ * @param de - The DirectExecution to filter
51
+ * @returns true to include the deposit, false to exclude it
52
+ */
53
+ memoizedFilterFunc?: (de: DirectExecution) => boolean;
54
+ }
65
55
  /**
66
56
  * Hook for SDK users to fetch recent deposits/direct executions with automatic context integration.
67
57
  *
@@ -85,7 +75,7 @@ export declare const useRecentDeposits: ({ isVisible, memoizedFilterFunc, fetchS
85
75
  * }
86
76
  * ```
87
77
  */
88
- export declare function useFunkitRecentDeposits(query: RecentDEQuerySimplified): {
78
+ export declare function useFunkitRecentDeposits(query: Omit<RecentDirectExecutionsQuery, DefaultDEQueryKey>): {
89
79
  data: PurifiedCheckoutHistoryItem[] | undefined;
90
80
  };
91
81
  /**