@formo/analytics 1.35.1 → 1.36.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/dist/cjs/src/FormoAnalytics.d.ts +90 -240
- package/dist/cjs/src/FormoAnalytics.js +432 -1840
- package/dist/cjs/src/constants/base.d.ts +0 -1
- package/dist/cjs/src/constants/base.js +1 -3
- package/dist/cjs/src/event/EventFactory.js +1 -1
- package/dist/cjs/src/event/EventManager.d.ts +3 -1
- package/dist/cjs/src/event/EventManager.js +5 -1
- package/dist/cjs/src/event/type.d.ts +1 -0
- package/dist/cjs/src/evm/EvmEventTracker.d.ts +175 -0
- package/dist/cjs/src/evm/EvmEventTracker.js +1030 -0
- package/dist/cjs/src/evm/EvmProviderRegistry.d.ts +132 -0
- package/dist/cjs/src/evm/EvmProviderRegistry.js +348 -0
- package/dist/cjs/src/evm/EvmRequestTracker.d.ts +120 -0
- package/dist/cjs/src/evm/EvmRequestTracker.js +756 -0
- package/dist/cjs/src/queue/EventQueue.d.ts +28 -0
- package/dist/cjs/src/queue/EventQueue.js +97 -19
- package/dist/cjs/src/queue/type.d.ts +1 -0
- package/dist/cjs/src/tracking/TrackingPolicy.d.ts +146 -0
- package/dist/cjs/src/tracking/TrackingPolicy.js +200 -0
- package/dist/cjs/src/utils/mergeDeepRight.d.ts +22 -0
- package/dist/cjs/src/utils/mergeDeepRight.js +54 -0
- package/dist/cjs/src/validators/address.d.ts +1 -1
- package/dist/cjs/src/version.d.ts +1 -1
- package/dist/cjs/src/version.js +1 -1
- package/dist/cjs/src/wagmi/WagmiEventHandler.d.ts +193 -1
- package/dist/cjs/src/wagmi/WagmiEventHandler.js +1317 -77
- package/dist/cjs/src/wagmi/types.d.ts +6 -0
- package/dist/cjs/src/wallet/WalletStateStore.d.ts +223 -0
- package/dist/cjs/src/wallet/WalletStateStore.js +515 -0
- package/dist/esm/src/FormoAnalytics.d.ts +90 -240
- package/dist/esm/src/FormoAnalytics.js +433 -1841
- package/dist/esm/src/constants/base.d.ts +0 -1
- package/dist/esm/src/constants/base.js +0 -2
- package/dist/esm/src/event/EventFactory.js +1 -1
- package/dist/esm/src/event/EventManager.d.ts +3 -1
- package/dist/esm/src/event/EventManager.js +5 -1
- package/dist/esm/src/event/type.d.ts +1 -0
- package/dist/esm/src/evm/EvmEventTracker.d.ts +175 -0
- package/dist/esm/src/evm/EvmEventTracker.js +1027 -0
- package/dist/esm/src/evm/EvmProviderRegistry.d.ts +132 -0
- package/dist/esm/src/evm/EvmProviderRegistry.js +345 -0
- package/dist/esm/src/evm/EvmRequestTracker.d.ts +120 -0
- package/dist/esm/src/evm/EvmRequestTracker.js +753 -0
- package/dist/esm/src/queue/EventQueue.d.ts +28 -0
- package/dist/esm/src/queue/EventQueue.js +97 -19
- package/dist/esm/src/queue/type.d.ts +1 -0
- package/dist/esm/src/tracking/TrackingPolicy.d.ts +146 -0
- package/dist/esm/src/tracking/TrackingPolicy.js +197 -0
- package/dist/esm/src/utils/mergeDeepRight.d.ts +22 -0
- package/dist/esm/src/utils/mergeDeepRight.js +51 -0
- package/dist/esm/src/version.d.ts +1 -1
- package/dist/esm/src/version.js +1 -1
- package/dist/esm/src/wagmi/WagmiEventHandler.d.ts +193 -1
- package/dist/esm/src/wagmi/WagmiEventHandler.js +1315 -76
- package/dist/esm/src/wagmi/types.d.ts +6 -0
- package/dist/esm/src/wallet/WalletStateStore.d.ts +223 -0
- package/dist/esm/src/wallet/WalletStateStore.js +512 -0
- package/dist/index.umd.min.js +1 -1
- package/package.json +5 -13
- package/dist/cjs/src/ramda/internal/_curry1.d.ts +0 -10
- package/dist/cjs/src/ramda/internal/_curry1.js +0 -26
- package/dist/cjs/src/ramda/internal/_curry2.d.ts +0 -10
- package/dist/cjs/src/ramda/internal/_curry2.js +0 -43
- package/dist/cjs/src/ramda/internal/_curry3.d.ts +0 -10
- package/dist/cjs/src/ramda/internal/_curry3.js +0 -74
- package/dist/cjs/src/ramda/internal/_has.d.ts +0 -2
- package/dist/cjs/src/ramda/internal/_has.js +0 -7
- package/dist/cjs/src/ramda/internal/_isObject.d.ts +0 -2
- package/dist/cjs/src/ramda/internal/_isObject.js +0 -7
- package/dist/cjs/src/ramda/internal/_isPlaceholder.d.ts +0 -2
- package/dist/cjs/src/ramda/internal/_isPlaceholder.js +0 -7
- package/dist/cjs/src/ramda/mergeDeepRight.d.ts +0 -3
- package/dist/cjs/src/ramda/mergeDeepRight.js +0 -14
- package/dist/cjs/src/ramda/mergeDeepWithKey.d.ts +0 -3
- package/dist/cjs/src/ramda/mergeDeepWithKey.js +0 -20
- package/dist/cjs/src/ramda/mergeWithKey.d.ts +0 -3
- package/dist/cjs/src/ramda/mergeWithKey.js +0 -26
- package/dist/esm/src/ramda/internal/_curry1.d.ts +0 -10
- package/dist/esm/src/ramda/internal/_curry1.js +0 -20
- package/dist/esm/src/ramda/internal/_curry2.d.ts +0 -10
- package/dist/esm/src/ramda/internal/_curry2.js +0 -37
- package/dist/esm/src/ramda/internal/_curry3.d.ts +0 -10
- package/dist/esm/src/ramda/internal/_curry3.js +0 -68
- package/dist/esm/src/ramda/internal/_has.d.ts +0 -2
- package/dist/esm/src/ramda/internal/_has.js +0 -4
- package/dist/esm/src/ramda/internal/_isObject.d.ts +0 -2
- package/dist/esm/src/ramda/internal/_isObject.js +0 -4
- package/dist/esm/src/ramda/internal/_isPlaceholder.d.ts +0 -2
- package/dist/esm/src/ramda/internal/_isPlaceholder.js +0 -4
- package/dist/esm/src/ramda/mergeDeepRight.d.ts +0 -3
- package/dist/esm/src/ramda/mergeDeepRight.js +0 -9
- package/dist/esm/src/ramda/mergeDeepWithKey.d.ts +0 -3
- package/dist/esm/src/ramda/mergeDeepWithKey.js +0 -15
- package/dist/esm/src/ramda/mergeWithKey.d.ts +0 -3
- package/dist/esm/src/ramda/mergeWithKey.js +0 -21
|
@@ -1,36 +1,31 @@
|
|
|
1
1
|
import { EIP6963ProviderDetail } from "mipd";
|
|
2
2
|
import { Address, ChainID, Config, EIP1193Provider, IFormoAnalytics, IFormoEventContext, IFormoEventProperties, Options, SignatureStatus, TransactionStatus } from "./types";
|
|
3
|
+
import { AutocaptureEventType } from "./tracking/TrackingPolicy";
|
|
3
4
|
import { SolanaManager } from "./solana/SolanaManager";
|
|
4
5
|
import type { PrivyUser } from "./privy";
|
|
6
|
+
/**
|
|
7
|
+
* Constants for provider switching reasons
|
|
8
|
+
*/
|
|
5
9
|
export declare class FormoAnalytics implements IFormoAnalytics {
|
|
6
10
|
readonly writeKey: string;
|
|
7
11
|
options: Options;
|
|
8
|
-
|
|
9
|
-
private
|
|
12
|
+
/** Wallet identity, chain state and the active-wallet cookie. */
|
|
13
|
+
private wallet;
|
|
10
14
|
private get _provider();
|
|
11
15
|
private set _provider(value);
|
|
12
16
|
private get _evmAddress();
|
|
13
17
|
private get _evmChainId();
|
|
14
|
-
private
|
|
18
|
+
private _announcedConnect;
|
|
15
19
|
private session;
|
|
16
20
|
private eventManager;
|
|
17
|
-
/**
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
* - _providers contains all discovered providers (EIP-6963)
|
|
26
|
-
* - _trackedProviders contains only providers that have been set up with listeners
|
|
27
|
-
* - A provider can be discovered but not yet tracked (e.g., during initialization)
|
|
28
|
-
* - A provider can be tracked but later removed from discovery
|
|
29
|
-
*/
|
|
30
|
-
private _trackedProviders;
|
|
31
|
-
private _injectedProviderDetail?;
|
|
32
|
-
private _processingAccountsChanged;
|
|
33
|
-
private _seenProviders;
|
|
21
|
+
/** Which EVM wallets exist, and what is known about each. */
|
|
22
|
+
private evm;
|
|
23
|
+
/** Which providers to watch, and what their events mean. */
|
|
24
|
+
private evmEvents;
|
|
25
|
+
/** Autocapture for signatures and transactions. */
|
|
26
|
+
private evmRequests;
|
|
27
|
+
/** Every "may we track this?" rule. See src/tracking/TrackingPolicy.ts. */
|
|
28
|
+
private trackingPolicy;
|
|
34
29
|
/**
|
|
35
30
|
* Wagmi event handler for tracking wallet events via Wagmi v2
|
|
36
31
|
* Only initialized when options.wagmi is provided
|
|
@@ -60,15 +55,25 @@ export declare class FormoAnalytics implements IFormoAnalytics {
|
|
|
60
55
|
private _onLocationChangeListener?;
|
|
61
56
|
private _pageHooksDisposed;
|
|
62
57
|
config: Config;
|
|
63
|
-
currentChainId?: ChainID;
|
|
64
|
-
currentAddress?: Address;
|
|
65
|
-
currentUserId?: string;
|
|
66
58
|
/**
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
*
|
|
59
|
+
* The wallet later events are attributed to, derived from whichever
|
|
60
|
+
* namespace last claimed the slot. Read by the wagmi and Privy
|
|
61
|
+
* integrations; the store is the only writer.
|
|
70
62
|
*/
|
|
71
|
-
|
|
63
|
+
get currentAddress(): Address | undefined;
|
|
64
|
+
get currentChainId(): ChainID | undefined;
|
|
65
|
+
/**
|
|
66
|
+
* These stay writable.
|
|
67
|
+
*
|
|
68
|
+
* Both were public mutable fields, so a consumer assigning one is using a
|
|
69
|
+
* documented public API. Getter-only replacements would break that
|
|
70
|
+
* silently: TypeScript rejects the assignment, and plain JavaScript throws
|
|
71
|
+
* on an accessor with no setter. The writes forward into the store, which
|
|
72
|
+
* keeps a single owner without turning a refactor into a breaking change.
|
|
73
|
+
*/
|
|
74
|
+
set currentAddress(value: Address | undefined);
|
|
75
|
+
set currentChainId(value: ChainID | undefined);
|
|
76
|
+
currentUserId?: string;
|
|
72
77
|
private constructor();
|
|
73
78
|
static init(writeKey: string, options?: Options): Promise<FormoAnalytics>;
|
|
74
79
|
/**
|
|
@@ -118,6 +123,45 @@ export declare class FormoAnalytics implements IFormoAnalytics {
|
|
|
118
123
|
chainId?: ChainID;
|
|
119
124
|
address?: Address;
|
|
120
125
|
}, properties?: IFormoEventProperties, context?: IFormoEventContext, callback?: (...args: unknown[]) => void): Promise<void>;
|
|
126
|
+
/** @see WalletStateStore.set */
|
|
127
|
+
private setChainState;
|
|
128
|
+
/** @see WalletStateStore.clear */
|
|
129
|
+
private clearChainState;
|
|
130
|
+
/**
|
|
131
|
+
* Record validated wallet/chain state WITHOUT emitting an event.
|
|
132
|
+
*
|
|
133
|
+
* Integrations must call this on every connect / chain change / disconnect,
|
|
134
|
+
* even when the matching autocapture event is disabled, or the exclusion
|
|
135
|
+
* gate (which keys off the central chain, not the event payload) can be
|
|
136
|
+
* bypassed. Stays on the class because integrations bind to it.
|
|
137
|
+
* @see WalletStateStore.syncWalletState
|
|
138
|
+
*/
|
|
139
|
+
syncWalletState(params: {
|
|
140
|
+
chainId?: ChainID;
|
|
141
|
+
address?: Address;
|
|
142
|
+
}): void;
|
|
143
|
+
/** @see WalletStateStore.clearProvider */
|
|
144
|
+
private clearActiveProvider;
|
|
145
|
+
/** @see WalletStateStore.backfill */
|
|
146
|
+
private backfillActiveWallet;
|
|
147
|
+
/** @see WalletStateStore.clearStaleEvmWalletOnSwitchWhileSuppressed */
|
|
148
|
+
private clearStaleEvmWalletOnSwitchWhileSuppressed;
|
|
149
|
+
/** @see EvmProviderRegistry.addListener */
|
|
150
|
+
private addProviderListener;
|
|
151
|
+
/** @see EvmProviderRegistry.removeListeners */
|
|
152
|
+
private removeProviderListeners;
|
|
153
|
+
/** @see EvmProviderRegistry.infoFor */
|
|
154
|
+
private getProviderInfo;
|
|
155
|
+
/** @see EvmProviderRegistry.isWrapped */
|
|
156
|
+
private isProviderAlreadyWrapped;
|
|
157
|
+
/** @see EvmProviderRegistry.resolveChainId */
|
|
158
|
+
private resolveChainIdForProvider;
|
|
159
|
+
/** @see EvmProviderRegistry.rememberChain */
|
|
160
|
+
private rememberProviderChain;
|
|
161
|
+
/** @see EvmProviderRegistry.addressOf */
|
|
162
|
+
private getAddress;
|
|
163
|
+
/** @see EvmProviderRegistry.accountsOf */
|
|
164
|
+
private getAccounts;
|
|
121
165
|
/**
|
|
122
166
|
* Emits a chain network change event.
|
|
123
167
|
* @param {ChainID} params.chainId
|
|
@@ -260,6 +304,16 @@ export declare class FormoAnalytics implements IFormoAnalytics {
|
|
|
260
304
|
* Opt out of tracking.
|
|
261
305
|
* @returns {void}
|
|
262
306
|
*/
|
|
307
|
+
/**
|
|
308
|
+
* Whether an event carrying this chain would currently be sent.
|
|
309
|
+
*
|
|
310
|
+
* Exposed for integrations that keep their own "already reported" state.
|
|
311
|
+
* `syncWalletState()` can accept a wallet that `trackEvent()` then drops -
|
|
312
|
+
* `tracking: false`, or a chain in `excludeChains` - and an integration that
|
|
313
|
+
* marked it as reported would stay silent about that wallet even after the
|
|
314
|
+
* configuration changed to allow it.
|
|
315
|
+
*/
|
|
316
|
+
willTrackEvent(chainId?: ChainID): boolean;
|
|
263
317
|
optOutTracking(): void;
|
|
264
318
|
/**
|
|
265
319
|
* Opt back into tracking after previously opting out. This will re-enable analytics tracking
|
|
@@ -272,34 +326,6 @@ export declare class FormoAnalytics implements IFormoAnalytics {
|
|
|
272
326
|
* @returns {boolean} True if the user has opted out
|
|
273
327
|
*/
|
|
274
328
|
hasOptedOutTracking(): boolean;
|
|
275
|
-
/**
|
|
276
|
-
* Track an EIP-1193 provider by wrapping its request method and adding event listeners
|
|
277
|
-
* Note: This is only used in non-Wagmi mode. When Wagmi is enabled, all tracking
|
|
278
|
-
* happens through Wagmi's connector system instead of EIP-1193/EIP-6963.
|
|
279
|
-
* @param provider The EIP-1193 provider to track
|
|
280
|
-
*/
|
|
281
|
-
private trackEIP1193Provider;
|
|
282
|
-
private trackProviders;
|
|
283
|
-
private addProviderListener;
|
|
284
|
-
private registerAccountsChangedListener;
|
|
285
|
-
private onAccountsChanged;
|
|
286
|
-
/**
|
|
287
|
-
* Handles changes to the accounts of a given EIP-1193 provider.
|
|
288
|
-
*
|
|
289
|
-
* @param provider - The EIP-1193 provider whose accounts have changed.
|
|
290
|
-
* @param accounts - The new array of account addresses. An empty array indicates a disconnect.
|
|
291
|
-
* @returns A promise that resolves when the account change has been processed.
|
|
292
|
-
*
|
|
293
|
-
* If the accounts array is empty and the provider is the active provider, this method triggers
|
|
294
|
-
* a disconnect flow. Otherwise, it updates the state to reflect the new accounts as needed.
|
|
295
|
-
*/
|
|
296
|
-
private _handleAccountsChanged;
|
|
297
|
-
private registerChainChangedListener;
|
|
298
|
-
private onChainChanged;
|
|
299
|
-
private registerConnectListener;
|
|
300
|
-
private registerDisconnectListener;
|
|
301
|
-
private onConnected;
|
|
302
|
-
private registerRequestListeners;
|
|
303
329
|
private onLocationChange;
|
|
304
330
|
private trackPageHits;
|
|
305
331
|
/**
|
|
@@ -313,94 +339,26 @@ export declare class FormoAnalytics implements IFormoAnalytics {
|
|
|
313
339
|
/**
|
|
314
340
|
* Visitor-level tracking suppression.
|
|
315
341
|
*
|
|
316
|
-
*
|
|
317
|
-
*
|
|
318
|
-
*
|
|
319
|
-
*
|
|
320
|
-
*
|
|
321
|
-
*
|
|
342
|
+
* True when the SDK must not persist identity/session/chain state or send
|
|
343
|
+
* events for this visitor. Public entry points that write state before
|
|
344
|
+
* reaching the `shouldTrack()` gate (identify / connect / detect) check this
|
|
345
|
+
* first, so a suppressed visitor leaves no cookies or session state.
|
|
346
|
+
*
|
|
347
|
+
* The rule lives in `TrackingPolicy`; this stays on the class because it is
|
|
348
|
+
* part of the surface integrations bind to.
|
|
322
349
|
* @internal Also read by `identifyPrivyUser` (via a structural cast) so the
|
|
323
350
|
* Privy sync skips chain reconciliation and emission for suppressed visitors.
|
|
324
351
|
*/
|
|
325
352
|
isTrackingSuppressed(): boolean;
|
|
326
|
-
/**
|
|
327
|
-
* Whether the current chain id is in `tracking.excludeChains`.
|
|
328
|
-
*
|
|
329
|
-
* Split out from `shouldTrack()` so `identify()` can check it *before*
|
|
330
|
-
* mutating identity state. `trackEvent()` drops an excluded event silently
|
|
331
|
-
* and returns void, but `identify()` marks the wallet as identified first, so
|
|
332
|
-
* without this guard an identify on an excluded chain is dedup-marked and
|
|
333
|
-
* then discarded, and the wallet never re-emits for the rest of the session
|
|
334
|
-
* even after switching to an allowed chain. On the Privy path that loses the
|
|
335
|
-
* user's whole cluster at once rather than a single wallet.
|
|
336
|
-
*
|
|
337
|
-
* Mirrors the chain rule in `shouldTrack()`: only applies when `tracking` is
|
|
338
|
-
* an options object with `excludeChains` set, and only once a chain id is
|
|
339
|
-
* known.
|
|
340
|
-
*/
|
|
341
|
-
private isCurrentChainExcluded;
|
|
342
|
-
/**
|
|
343
|
-
* Whether the current environment is excluded from tracking - the visitor's
|
|
344
|
-
* timezone, the current hostname, or the current pathname matches a
|
|
345
|
-
* configured exclusion.
|
|
346
|
-
*
|
|
347
|
-
* Timezone is visitor/session-level (stable for the session); host/path are
|
|
348
|
-
* current-page-level and transient - if a SPA navigates to an allowed path,
|
|
349
|
-
* tracking resumes for future actions. Used as the "do not write identity or
|
|
350
|
-
* send events" gate at every entry point that would persist state before the
|
|
351
|
-
* `shouldTrack()` event gate.
|
|
352
|
-
* @returns {boolean} True if the current environment is excluded
|
|
353
|
-
*/
|
|
354
|
-
private isCurrentEnvironmentExcluded;
|
|
355
|
-
/**
|
|
356
|
-
* Whether the current hostname matches a configured `tracking.excludeHosts`
|
|
357
|
-
* entry (exact match). Current-page-level - see isCurrentEnvironmentExcluded.
|
|
358
|
-
* @returns {boolean} True if the current hostname is excluded
|
|
359
|
-
*/
|
|
360
|
-
private isHostExcluded;
|
|
361
|
-
/**
|
|
362
|
-
* Whether the current pathname matches a configured `tracking.excludePaths`
|
|
363
|
-
* entry (exact match). Current-page-level - see isCurrentEnvironmentExcluded.
|
|
364
|
-
* @returns {boolean} True if the current pathname is excluded
|
|
365
|
-
*/
|
|
366
|
-
private isPathExcluded;
|
|
367
|
-
/**
|
|
368
|
-
* Whether the current call is in a visitor-level suppression state - opt-out
|
|
369
|
-
* or excluded timezone - for which any persisted identity cookie should be
|
|
370
|
-
* actively purged (not merely skipped). Host/path exclusions are
|
|
371
|
-
* deliberately excluded here: they are transient current-page states, so a
|
|
372
|
-
* cookie legitimately written on an allowed page must survive a visit to an
|
|
373
|
-
* excluded route.
|
|
374
|
-
* @returns {boolean} True if persisted identity must be purged
|
|
375
|
-
*/
|
|
376
|
-
private isPersistedIdentityPurgeRequired;
|
|
377
|
-
/**
|
|
378
|
-
* Whether the visitor's browser-resolved timezone matches a configured
|
|
379
|
-
* `tracking.excludeTimezones` entry (case-insensitive). Client-side and
|
|
380
|
-
* best-effort - see TrackingOptions.excludeTimezones.
|
|
381
|
-
* @returns {boolean} True if the current timezone is excluded
|
|
382
|
-
*/
|
|
383
|
-
private isTimezoneExcluded;
|
|
384
|
-
/**
|
|
385
|
-
* Determines if tracking should be enabled based on configuration and consent
|
|
386
|
-
* @returns {boolean} True if tracking should be enabled
|
|
387
|
-
*/
|
|
353
|
+
/** @see TrackingPolicy.shouldTrack */
|
|
388
354
|
private shouldTrack;
|
|
389
355
|
/**
|
|
390
356
|
* Check if a specific wallet event type is enabled for autocapture
|
|
391
357
|
* @param eventType The wallet event type to check
|
|
392
358
|
* @returns {boolean} True if the event type should be autocaptured
|
|
393
359
|
*/
|
|
394
|
-
isAutocaptureEnabled(eventType:
|
|
395
|
-
/**
|
|
396
|
-
* Get provider information for a given provider
|
|
397
|
-
* @param provider The provider to get info for
|
|
398
|
-
* @returns Provider information
|
|
399
|
-
*/
|
|
400
|
-
private getProviderInfo;
|
|
401
|
-
private getProviders;
|
|
360
|
+
isAutocaptureEnabled(eventType: AutocaptureEventType): boolean;
|
|
402
361
|
get providers(): readonly EIP6963ProviderDetail[];
|
|
403
|
-
private detectWallets;
|
|
404
362
|
get provider(): EIP1193Provider | undefined;
|
|
405
363
|
/**
|
|
406
364
|
* Access the Solana integration manager.
|
|
@@ -414,34 +372,7 @@ export declare class FormoAnalytics implements IFormoAnalytics {
|
|
|
414
372
|
* ```
|
|
415
373
|
*/
|
|
416
374
|
get solana(): SolanaManager;
|
|
417
|
-
private getAddress;
|
|
418
|
-
private getAccounts;
|
|
419
375
|
private getCurrentChainId;
|
|
420
|
-
private buildSignatureEventPayload;
|
|
421
|
-
private buildTransactionEventPayload;
|
|
422
|
-
/**
|
|
423
|
-
* Persist an EVM address discovered through autocapture (signature / transaction)
|
|
424
|
-
* as the current EVM address when none is currently set. This lets subsequent
|
|
425
|
-
* track()/page() calls carry the address even when the underlying wallet never
|
|
426
|
-
* fires an EIP-1193 `accountsChanged` event (embedded wallets, smart accounts,
|
|
427
|
-
* social-login wrappers). If `accountsChanged` later fires it overwrites this
|
|
428
|
-
* value in the normal way; existing connections are never clobbered.
|
|
429
|
-
*/
|
|
430
|
-
private backfillActiveWallet;
|
|
431
|
-
/**
|
|
432
|
-
* Apply an EVM autocapture connect/switch while tracking is suppressed
|
|
433
|
-
* (opt-out / timezone / excluded host or path): never LEARN the wallet, but
|
|
434
|
-
* if it is a switch away from an already-learned EVM wallet, drop the stale
|
|
435
|
-
* one (which also clears the active-wallet cookie) so it can't attach to a
|
|
436
|
-
* later allowed-page event.
|
|
437
|
-
*/
|
|
438
|
-
private clearStaleEvmWalletOnSwitchWhileSuppressed;
|
|
439
|
-
/**
|
|
440
|
-
* Polls for transaction receipt and emits tx.status = CONFIRMED or REVERTED.
|
|
441
|
-
*/
|
|
442
|
-
private pollTransactionReceipt;
|
|
443
|
-
private removeProviderListeners;
|
|
444
|
-
private untrackProvider;
|
|
445
376
|
getTrackedProvidersCount(): number;
|
|
446
377
|
/**
|
|
447
378
|
* Get current provider state for debugging
|
|
@@ -453,86 +384,5 @@ export declare class FormoAnalytics implements IFormoAnalytics {
|
|
|
453
384
|
seenProviders: number;
|
|
454
385
|
activeProvider: boolean;
|
|
455
386
|
};
|
|
456
|
-
/**
|
|
457
|
-
* Clean up providers that are no longer available
|
|
458
|
-
* This helps maintain consistent state and prevents memory leaks
|
|
459
|
-
*/
|
|
460
|
-
private cleanupUnavailableProviders;
|
|
461
|
-
/**
|
|
462
|
-
* Helper method to check if a provider is already wrapped
|
|
463
|
-
* @param provider The provider to check
|
|
464
|
-
* @param currentRequest The current request function
|
|
465
|
-
* @returns true if the provider is already wrapped
|
|
466
|
-
*/
|
|
467
|
-
private isProviderAlreadyWrapped;
|
|
468
|
-
/**
|
|
469
|
-
* Handle provider mismatch by switching to the new provider and invalidating old tokens
|
|
470
|
-
* @param provider The new provider to switch to
|
|
471
|
-
*/
|
|
472
|
-
private handleProviderMismatch;
|
|
473
|
-
/**
|
|
474
|
-
* Determine which namespace a chainId belongs to.
|
|
475
|
-
*/
|
|
476
|
-
private getNamespace;
|
|
477
|
-
/**
|
|
478
|
-
* Update per-chain state and sync the derived currentAddress/currentChainId.
|
|
479
|
-
* Accepts either a namespace string ('evm'/'solana') or a chainId number
|
|
480
|
-
* to resolve the namespace automatically. When a chainId number is passed,
|
|
481
|
-
* it is also stored as the namespace's chainId (unless explicitly overridden
|
|
482
|
-
* in the update object).
|
|
483
|
-
*/
|
|
484
|
-
private setChainState;
|
|
485
|
-
/**
|
|
486
|
-
* Clear per-chain state for a given namespace (or chainId) and sync derived state.
|
|
487
|
-
*/
|
|
488
|
-
private clearChainState;
|
|
489
|
-
/**
|
|
490
|
-
* Sync validated wallet/chain state into the SDK's central state
|
|
491
|
-
* WITHOUT emitting an event.
|
|
492
|
-
*
|
|
493
|
-
* Integrations (e.g. the wagmi handler) must call this on every
|
|
494
|
-
* connect / chain-change / disconnect - even when the corresponding
|
|
495
|
-
* autocapture event is disabled. Otherwise `currentChainId` stays
|
|
496
|
-
* stale/undefined and `shouldTrack()`'s `tracking.excludeChains`
|
|
497
|
-
* check (which keys off `currentChainId`, not the event payload) can
|
|
498
|
-
* be bypassed, letting wallet activity on an excluded chain still be
|
|
499
|
-
* collected.
|
|
500
|
-
*
|
|
501
|
-
* - valid `address` present → record per-chain + derived state
|
|
502
|
-
* - `address` absent → clear chain state (disconnect)
|
|
503
|
-
*/
|
|
504
|
-
syncWalletState(params: {
|
|
505
|
-
chainId?: ChainID;
|
|
506
|
-
address?: Address;
|
|
507
|
-
}): void;
|
|
508
|
-
/**
|
|
509
|
-
* Synchronize currentAddress/currentChainId from the active namespace.
|
|
510
|
-
* Last-connected-chain-wins: _activeNamespace takes precedence.
|
|
511
|
-
*/
|
|
512
|
-
private syncDerivedState;
|
|
513
|
-
/**
|
|
514
|
-
* Persist (or clear) the current wallet snapshot in a cookie so that the
|
|
515
|
-
* SDK can repopulate `currentAddress`/`currentChainId` at init on the next
|
|
516
|
-
* page load - closing the gap between page-show and wagmi/EIP-1193
|
|
517
|
-
* reconnection during which track()/page() events would otherwise ship
|
|
518
|
-
* with an empty address.
|
|
519
|
-
*/
|
|
520
|
-
private persistActiveWallet;
|
|
521
|
-
/**
|
|
522
|
-
* Seed `currentAddress`/`currentChainId` from the persisted snapshot, if
|
|
523
|
-
* any. Called once during construction before the first page hit fires.
|
|
524
|
-
*/
|
|
525
|
-
private loadActiveWallet;
|
|
526
|
-
/**
|
|
527
|
-
* Helper method to clear the active provider state
|
|
528
|
-
* Centralizes provider clearing logic for consistency
|
|
529
|
-
*/
|
|
530
|
-
private clearActiveProvider;
|
|
531
|
-
/**
|
|
532
|
-
* Helper method to safely add a provider detail to _providers array, ensuring no duplicates
|
|
533
|
-
* @param detail The provider detail to add
|
|
534
|
-
* @returns true if the provider was added, false if it was already present
|
|
535
|
-
*/
|
|
536
|
-
private safeAddProviderDetail;
|
|
537
387
|
}
|
|
538
388
|
//# sourceMappingURL=FormoAnalytics.d.ts.map
|