@formo/analytics 1.19.5 → 1.19.7

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.
@@ -3,4 +3,5 @@ export declare const SESSION_WALLET_DETECTED_KEY = "wallet-detected";
3
3
  export declare const SESSION_CURRENT_URL_KEY = "analytics-current-url";
4
4
  export declare const SESSION_USER_ID_KEY = "user-id";
5
5
  export declare const LOCAL_ANONYMOUS_ID_KEY = "anonymous-id";
6
+ export declare const DEFAULT_PROVIDER_ICON = "data:image/svg+xml;base64,";
6
7
  //# sourceMappingURL=base.d.ts.map
@@ -3,4 +3,6 @@ export var SESSION_WALLET_DETECTED_KEY = "wallet-detected";
3
3
  export var SESSION_CURRENT_URL_KEY = "analytics-current-url";
4
4
  export var SESSION_USER_ID_KEY = "user-id";
5
5
  export var LOCAL_ANONYMOUS_ID_KEY = "anonymous-id";
6
+ // Default provider icon (empty data URL)
7
+ export var DEFAULT_PROVIDER_ICON = 'data:image/svg+xml;base64,';
6
8
  //# sourceMappingURL=base.js.map
@@ -4,6 +4,19 @@ export function formofy(writeKey, options) {
4
4
  FormoAnalytics.init(writeKey, options)
5
5
  .then(function (f) {
6
6
  window.formo = f;
7
+ // Call ready callback if provided with proper error handling
8
+ if (options === null || options === void 0 ? void 0 : options.ready) {
9
+ // Wrap the callback execution in a try-catch to handle synchronous errors
10
+ try {
11
+ options.ready(f);
12
+ }
13
+ catch (callbackError) {
14
+ console.error("Error in FormoAnalytics ready callback:", callbackError);
15
+ }
16
+ // Note: If the callback returns a Promise (even though typed as void),
17
+ // it's the responsibility of the callback implementation to handle its own errors.
18
+ // This prevents the callback from throwing unhandled rejections.
19
+ }
7
20
  })
8
21
  .catch(function (e) { return console.error("Error initializing FormoAnalytics:", e); });
9
22
  }
@@ -20,7 +20,7 @@ declare class EventFactory implements IEventFactory {
20
20
  generateDetectWalletEvent(providerName: string, rdns: string, properties?: IFormoEventProperties, context?: IFormoEventContext): IFormoEvent;
21
21
  generateIdentifyEvent(providerName: string, rdns: string, address: Nullable<Address>, userId?: Nullable<string>, properties?: IFormoEventProperties, context?: IFormoEventContext): IFormoEvent;
22
22
  generateConnectEvent(chainId: ChainID, address: Address, properties?: IFormoEventProperties, context?: IFormoEventContext): IFormoEvent;
23
- generateDisconnectEvent(chainId: ChainID, address: Address, properties?: IFormoEventProperties, context?: IFormoEventContext): IFormoEvent;
23
+ generateDisconnectEvent(chainId?: ChainID, address?: Address, properties?: IFormoEventProperties, context?: IFormoEventContext): IFormoEvent;
24
24
  generateChainChangedEvent(chainId: ChainID, address: Address, properties?: IFormoEventProperties, context?: IFormoEventContext): IFormoEvent;
25
25
  generateSignatureEvent(status: SignatureStatus, chainId: ChainID, address: Address, message: string, signatureHash?: string, properties?: IFormoEventProperties, context?: IFormoEventContext): IFormoEvent;
26
26
  generateTransactionEvent(status: TransactionStatus, chainId: ChainID, address: Address, data: string, to: string, value: string, transactionHash?: string, properties?: IFormoEventProperties, context?: IFormoEventContext): IFormoEvent;
@@ -60,7 +60,7 @@ var EventFactory = /** @class */ (function () {
60
60
  var storedTrafficSources = session().get(SESSION_TRAFFIC_SOURCE_KEY) || {};
61
61
  var finalTrafficSources = {
62
62
  ref: contextTrafficSources.ref || (storedTrafficSources === null || storedTrafficSources === void 0 ? void 0 : storedTrafficSources.ref) || "",
63
- referrer: contextTrafficSources.referrer || (storedTrafficSources === null || storedTrafficSources === void 0 ? void 0 : storedTrafficSources.referrer),
63
+ referrer: contextTrafficSources.referrer || (storedTrafficSources === null || storedTrafficSources === void 0 ? void 0 : storedTrafficSources.referrer) || "",
64
64
  utm_campaign: contextTrafficSources.utm_campaign ||
65
65
  (storedTrafficSources === null || storedTrafficSources === void 0 ? void 0 : storedTrafficSources.utm_campaign) ||
66
66
  "",
@@ -71,6 +71,7 @@ export interface Options {
71
71
  enabled?: boolean;
72
72
  levels?: LogLevel[];
73
73
  };
74
+ ready?: (formo: IFormoAnalytics) => void;
74
75
  }
75
76
  export interface FormoAnalyticsProviderProps {
76
77
  writeKey: string;
@@ -79,8 +79,8 @@ export interface ConnectAPIEvent {
79
79
  }
80
80
  export interface DisconnectAPIEvent {
81
81
  type: "disconnect";
82
- chainId: ChainID;
83
- address: Address;
82
+ chainId?: ChainID;
83
+ address?: Address;
84
84
  }
85
85
  export interface TrackAPIEvent {
86
86
  type: "track";
@@ -15,4 +15,12 @@ export interface RPCError extends Error {
15
15
  export interface ConnectInfo {
16
16
  chainId: string;
17
17
  }
18
+ export declare const WRAPPED_REQUEST_SYMBOL: unique symbol;
19
+ export type WrappedRequestFunction = (<T>(args: RequestArguments) => Promise<T | null | undefined>) & {
20
+ [WRAPPED_REQUEST_SYMBOL]?: boolean;
21
+ };
22
+ export declare const WRAPPED_REQUEST_REF_SYMBOL: unique symbol;
23
+ export interface WrappedEIP1193Provider extends EIP1193Provider {
24
+ [WRAPPED_REQUEST_REF_SYMBOL]?: WrappedRequestFunction;
25
+ }
18
26
  //# sourceMappingURL=provider.d.ts.map
@@ -1,2 +1,3 @@
1
- export {};
1
+ export var WRAPPED_REQUEST_SYMBOL = Symbol("formoWrappedRequest");
2
+ export var WRAPPED_REQUEST_REF_SYMBOL = Symbol("formoWrappedRequestRef");
2
3
  //# sourceMappingURL=provider.js.map