@formo/analytics 1.28.5 → 1.28.6

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 (44) hide show
  1. package/dist/cjs/src/FormoAnalytics.d.ts +7 -3
  2. package/dist/cjs/src/FormoAnalytics.js +24 -12
  3. package/dist/cjs/src/index.d.ts +3 -1
  4. package/dist/cjs/src/index.js +5 -1
  5. package/dist/cjs/src/solana/SolanaManager.d.ts +36 -11
  6. package/dist/cjs/src/solana/SolanaManager.js +47 -49
  7. package/dist/cjs/src/solana/SolanaStoreHandler.d.ts +88 -0
  8. package/dist/cjs/src/solana/SolanaStoreHandler.js +471 -0
  9. package/dist/cjs/src/solana/index.d.ts +8 -4
  10. package/dist/cjs/src/solana/index.js +10 -6
  11. package/dist/cjs/src/solana/storeTypes.d.ts +107 -0
  12. package/dist/cjs/src/solana/storeTypes.js +12 -0
  13. package/dist/cjs/src/solana/types.d.ts +23 -154
  14. package/dist/cjs/src/solana/types.js +4 -37
  15. package/dist/cjs/src/storage/StorageManager.d.ts +1 -0
  16. package/dist/cjs/src/storage/StorageManager.js +10 -2
  17. package/dist/cjs/src/types/base.d.ts +16 -5
  18. package/dist/cjs/src/version.d.ts +1 -1
  19. package/dist/cjs/src/version.js +1 -1
  20. package/dist/esm/src/FormoAnalytics.d.ts +7 -3
  21. package/dist/esm/src/FormoAnalytics.js +24 -12
  22. package/dist/esm/src/index.d.ts +3 -1
  23. package/dist/esm/src/index.js +1 -0
  24. package/dist/esm/src/solana/SolanaManager.d.ts +36 -11
  25. package/dist/esm/src/solana/SolanaManager.js +47 -49
  26. package/dist/esm/src/solana/SolanaStoreHandler.d.ts +88 -0
  27. package/dist/esm/src/solana/SolanaStoreHandler.js +468 -0
  28. package/dist/esm/src/solana/index.d.ts +8 -4
  29. package/dist/esm/src/solana/index.js +8 -4
  30. package/dist/esm/src/solana/storeTypes.d.ts +107 -0
  31. package/dist/esm/src/solana/storeTypes.js +11 -0
  32. package/dist/esm/src/solana/types.d.ts +23 -154
  33. package/dist/esm/src/solana/types.js +3 -34
  34. package/dist/esm/src/storage/StorageManager.d.ts +1 -0
  35. package/dist/esm/src/storage/StorageManager.js +10 -2
  36. package/dist/esm/src/types/base.d.ts +16 -5
  37. package/dist/esm/src/version.d.ts +1 -1
  38. package/dist/esm/src/version.js +1 -1
  39. package/dist/index.umd.min.js +1 -1
  40. package/package.json +3 -3
  41. package/dist/cjs/src/solana/SolanaAdapter.d.ts +0 -210
  42. package/dist/cjs/src/solana/SolanaAdapter.js +0 -988
  43. package/dist/esm/src/solana/SolanaAdapter.d.ts +0 -210
  44. package/dist/esm/src/solana/SolanaAdapter.js +0 -985
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@formo/analytics",
3
- "version": "1.28.5",
3
+ "version": "1.28.6",
4
4
  "packageManager": "pnpm@9.0.0",
5
5
  "repository": {
6
6
  "type": "git",
@@ -53,7 +53,7 @@
53
53
  "@types/sinon": "^21.0.0",
54
54
  "@types/sinon-chai": "^3.2.12",
55
55
  "@typescript-eslint/eslint-plugin": "^8.0.0",
56
- "@typescript-eslint/parser": "^8.0.0",
56
+ "@typescript-eslint/parser": "^8.58.0",
57
57
  "c8": "^11.0.0",
58
58
  "chai": "^4.5.0",
59
59
  "eslint": "^10.1.0",
@@ -70,7 +70,7 @@
70
70
  "ts-loader": "^9.3.1",
71
71
  "ts-node": "^10.8.2",
72
72
  "typescript": "^5.7.3",
73
- "typescript-eslint": "^8.0.0",
73
+ "typescript-eslint": "^8.58.0",
74
74
  "webpack": "^5.105.4",
75
75
  "webpack-cli": "^7.0.2"
76
76
  },
@@ -1,210 +0,0 @@
1
- /**
2
- * SolanaAdapter
3
- *
4
- * Handles wallet event tracking by hooking into Solana Wallet Adapter events.
5
- * This provides integration with the @solana/wallet-adapter ecosystem.
6
- *
7
- * @see https://github.com/anza-xyz/wallet-adapter
8
- */
9
- import { FormoAnalytics } from "../FormoAnalytics";
10
- import { ISolanaAdapter, SolanaWalletContext, SolanaConnection, SolanaCluster } from "./types";
11
- export declare class SolanaAdapter {
12
- private formo;
13
- private wallet;
14
- private connection;
15
- private cluster;
16
- private chainId;
17
- private unsubscribers;
18
- private connectionState;
19
- /**
20
- * Track processed signatures to prevent duplicate event emissions
21
- */
22
- private processedSignatures;
23
- /**
24
- * Store pending transaction details for confirmation tracking
25
- * Key: transaction signature, Value: transaction details
26
- */
27
- private pendingTransactions;
28
- /**
29
- * Per-adapter original methods stored in a WeakMap to prevent routing
30
- * to the wrong wallet after switching adapters.
31
- */
32
- private adapterOriginals;
33
- /**
34
- * Bound wrapper references — used to detect when external code (e.g. StandardWalletAdapter._reset())
35
- * overwrites our wraps so we can re-apply them.
36
- */
37
- private boundWrappedSendTransaction?;
38
- private boundWrappedSignMessage?;
39
- private boundWrappedSignTransaction?;
40
- /**
41
- * Reference to the wrapped adapter (to restore methods on cleanup)
42
- */
43
- private wrappedAdapter?;
44
- /**
45
- * Reference to the adapter we bound event listeners to (for context wallets).
46
- * Used to detect when context.wallet changes and rebind listeners.
47
- */
48
- private currentBoundAdapter?;
49
- /**
50
- * Track active polling timeout IDs for cleanup
51
- */
52
- private pollingTimeouts;
53
- /**
54
- * Flag to prevent new polls after cleanup is initiated
55
- */
56
- private isCleanedUp;
57
- constructor(formoAnalytics: FormoAnalytics, options: {
58
- wallet?: ISolanaAdapter | SolanaWalletContext;
59
- connection?: SolanaConnection;
60
- cluster?: SolanaCluster;
61
- });
62
- /**
63
- * Restore original methods on the wrapped adapter
64
- */
65
- private restoreOriginalMethods;
66
- /**
67
- * Update the wallet instance (useful for React context updates)
68
- */
69
- setWallet(wallet: ISolanaAdapter | SolanaWalletContext | null): void;
70
- /**
71
- * Check if the wallet adapter has changed (for context-based wallets) and rebind if needed.
72
- * Call this in React effects when you know the wallet context may have changed but the
73
- * context object reference stayed the same (e.g., user switched wallets in the wallet selector).
74
- *
75
- * This ensures connect/disconnect events from the new wallet are properly tracked without
76
- * waiting for the next transaction or signature call.
77
- *
78
- * @example
79
- * ```tsx
80
- * const wallet = useWallet();
81
- * useEffect(() => {
82
- * formo.solana.syncWalletState();
83
- * }, [wallet.wallet]); // Trigger when inner wallet changes
84
- * ```
85
- */
86
- syncWalletState(): void;
87
- /**
88
- * Update the connection instance
89
- */
90
- setConnection(connection: SolanaConnection | null): void;
91
- /**
92
- * Update the cluster/network
93
- */
94
- setCluster(cluster: SolanaCluster): void;
95
- /**
96
- * Get the current chain ID
97
- */
98
- getChainId(): number;
99
- /**
100
- * Set up listeners for wallet events
101
- */
102
- private setupWalletListeners;
103
- /**
104
- * Set up listeners for a wallet context (useWallet)
105
- */
106
- private setupContextListeners;
107
- /**
108
- * Check if the adapter inside a wallet context has changed (e.g., user switched wallets).
109
- * If so, rebind event listeners and rewrap methods on the new adapter.
110
- * This handles the case where context.wallet changes but the context object reference stays the same.
111
- */
112
- private checkAndRebindContextAdapter;
113
- /**
114
- * Clean up only adapter event listeners (not the full cleanup)
115
- */
116
- private cleanupAdapterListenersOnly;
117
- /**
118
- * Register a listener on an adapter and track its unsubscriber
119
- */
120
- private registerAdapterListener;
121
- /**
122
- * Set up event listeners on an adapter (connect/disconnect events)
123
- */
124
- private setupAdapterEventListenersOnly;
125
- /**
126
- * Set up listeners for a direct wallet adapter
127
- */
128
- private setupAdapterListeners;
129
- /**
130
- * Wrap wallet adapter methods for transaction/signature tracking
131
- */
132
- private wrapAdapterMethods;
133
- /**
134
- * Re-wrap methods that were overwritten by external code.
135
- *
136
- * StandardWalletAdapter._reset() overwrites signMessage and signTransaction
137
- * as own properties on every connect/disconnect/
138
- * feature-change event. This method detects which wraps were overwritten
139
- * and re-applies them, capturing the new original methods.
140
- */
141
- private rewrapOverwrittenMethods;
142
- /**
143
- * Wrapped sendTransaction method for direct adapter
144
- */
145
- private wrappedSendTransaction;
146
- /**
147
- * Wrapped signMessage method for direct adapter
148
- */
149
- private wrappedSignMessage;
150
- /**
151
- * Wrapped signTransaction method for direct adapter
152
- */
153
- private wrappedSignTransaction;
154
- /**
155
- * Check initial connection state
156
- */
157
- private checkInitialConnection;
158
- /**
159
- * Handle wallet connect event
160
- */
161
- private handleConnect;
162
- /**
163
- * Handle wallet disconnect event
164
- */
165
- private handleDisconnect;
166
- /**
167
- * Poll for transaction confirmation
168
- */
169
- private pollTransactionConfirmation;
170
- /**
171
- * Get current wallet public key
172
- */
173
- private getPublicKey;
174
- /**
175
- * Get current address
176
- */
177
- private getCurrentAddress;
178
- /**
179
- * Emit a transaction event if address is valid and autocapture is enabled
180
- */
181
- private emitTransactionEvent;
182
- /**
183
- * Emit a signature event if address is valid and autocapture is enabled
184
- */
185
- private emitSignatureEvent;
186
- /**
187
- * Extract the actual adapter (with .on/.off) from a wallet context.
188
- * In @solana/wallet-adapter-react, context.wallet is { adapter, readyState },
189
- * not a direct adapter.
190
- */
191
- private getAdapterFromContext;
192
- /**
193
- * Get wallet name
194
- */
195
- private getWalletName;
196
- /**
197
- * Get wallet RDNS (reverse domain name)
198
- * For Solana wallets, we construct an RDNS-like identifier
199
- */
200
- private getWalletRdns;
201
- /**
202
- * Clean up wallet listeners
203
- */
204
- private cleanupWalletListeners;
205
- /**
206
- * Clean up all resources
207
- */
208
- cleanup(): void;
209
- }
210
- //# sourceMappingURL=SolanaAdapter.d.ts.map