@formo/analytics 1.28.0 → 1.28.2

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.
@@ -10,37 +10,36 @@
10
10
  /**
11
11
  * Valid Privy linked account type strings.
12
12
  */
13
- export type PrivyAccountType = "email" | "phone" | "wallet" | "farcaster" | "telegram" | "apple_oauth" | "discord_oauth" | "github_oauth" | "google_oauth" | "instagram_oauth" | "linkedin_oauth" | "spotify_oauth" | "tiktok_oauth" | "twitter_oauth" | "line" | "custom_auth" | "passkey" | "cross_app" | string;
13
+ export type PrivyAccountType = "email" | "phone" | "wallet" | "smart_wallet" | "farcaster" | "telegram" | "apple_oauth" | "discord_oauth" | "github_oauth" | "google_oauth" | "instagram_oauth" | "linkedin_oauth" | "spotify_oauth" | "tiktok_oauth" | "twitter_oauth" | "twitch_oauth" | "line_oauth" | "custom_auth" | "passkey" | "cross_app" | "guest" | string;
14
14
  /**
15
15
  * A linked account entry from the Privy user object.
16
16
  * Each linked account has a `type` discriminator and type-specific fields.
17
17
  */
18
18
  export interface PrivyLinkedAccount {
19
19
  type: PrivyAccountType;
20
- address?: string;
21
- number?: string;
22
- username?: string;
23
- name?: string;
24
- displayName?: string;
25
- subject?: string;
26
- email?: string;
27
- chainType?: string;
28
- walletClient?: string;
29
- walletClientType?: string;
30
- connectorType?: string;
20
+ address?: string | null;
21
+ number?: string | null;
22
+ username?: string | null;
23
+ name?: string | null;
24
+ displayName?: string | null;
25
+ subject?: string | null;
26
+ email?: string | null;
27
+ chainType?: string | null;
28
+ walletClient?: string | null;
29
+ walletClientType?: string | null;
30
+ connectorType?: string | null;
31
31
  delegated?: boolean;
32
- fid?: number;
33
- ownerAddress?: string;
34
- bio?: string;
35
- pfp?: string;
36
- url?: string;
37
- signerPublicKey?: string;
38
- telegramUserId?: string;
39
- firstName?: string;
40
- lastName?: string;
41
- firstVerifiedAt?: number | null;
42
- latestVerifiedAt?: number | null;
43
- verifiedAt?: number | null;
32
+ fid?: number | null;
33
+ ownerAddress?: string | null;
34
+ bio?: string | null;
35
+ pfp?: string | null;
36
+ url?: string | null;
37
+ signerPublicKey?: string | null;
38
+ telegramUserId?: string | null;
39
+ firstName?: string | null;
40
+ lastName?: string | null;
41
+ firstVerifiedAt?: Date | null;
42
+ latestVerifiedAt?: Date | null;
44
43
  }
45
44
  /**
46
45
  * Privy user object as returned by the Privy React SDK.
@@ -53,7 +52,7 @@ export interface PrivyUser {
53
52
  /** Privy user ID in DID format (e.g., "did:privy:cm3np...") */
54
53
  id: string;
55
54
  /** Account creation timestamp */
56
- createdAt?: number;
55
+ createdAt?: Date;
57
56
  /** All linked accounts */
58
57
  linkedAccounts?: PrivyLinkedAccount[];
59
58
  /** Optional custom metadata */
@@ -72,67 +71,69 @@ export interface PrivyUser {
72
71
  connectorType?: string;
73
72
  };
74
73
  google?: {
75
- email?: string;
76
- name?: string;
77
- subject?: string;
74
+ subject: string;
75
+ email: string;
76
+ name: string | null;
78
77
  };
79
78
  discord?: {
80
- username?: string;
81
- subject?: string;
82
- email?: string;
79
+ subject: string;
80
+ username: string | null;
81
+ email: string | null;
83
82
  };
84
83
  twitter?: {
85
- username?: string;
86
- name?: string;
87
- subject?: string;
88
- profilePictureUrl?: string;
84
+ subject: string;
85
+ username: string | null;
86
+ name: string | null;
87
+ profilePictureUrl: string | null;
89
88
  };
90
89
  farcaster?: {
91
- fid?: number;
92
- username?: string;
93
- displayName?: string;
94
- ownerAddress?: string;
95
- bio?: string;
96
- pfp?: string;
90
+ fid: number | null;
91
+ ownerAddress: string;
92
+ username: string | null;
93
+ displayName: string | null;
94
+ bio: string | null;
95
+ pfp: string | null;
97
96
  };
98
97
  github?: {
99
- username?: string;
100
- name?: string;
101
- subject?: string;
98
+ subject: string;
99
+ username: string | null;
100
+ name: string | null;
102
101
  };
103
102
  linkedin?: {
104
- email?: string;
105
- name?: string;
106
- subject?: string;
103
+ subject: string;
104
+ name: string | null;
105
+ email: string | null;
106
+ vanityName: string | null;
107
107
  };
108
108
  apple?: {
109
- email?: string;
110
- subject?: string;
109
+ subject: string;
110
+ email: string;
111
111
  };
112
112
  instagram?: {
113
- username?: string;
114
- subject?: string;
113
+ subject: string;
114
+ username: string | null;
115
115
  };
116
116
  spotify?: {
117
- email?: string;
118
- name?: string;
119
- subject?: string;
117
+ subject: string;
118
+ email: string | null;
119
+ name: string | null;
120
120
  };
121
121
  tiktok?: {
122
- username?: string;
123
- name?: string;
124
- subject?: string;
122
+ subject: string;
123
+ username: string | null;
124
+ name: string | null;
125
125
  };
126
126
  line?: {
127
- email?: string;
128
- name?: string;
129
- subject?: string;
127
+ subject: string;
128
+ name: string | null;
129
+ email: string | null;
130
130
  };
131
131
  telegram?: {
132
- telegramUserId?: string;
133
- username?: string;
134
- firstName?: string;
135
- lastName?: string;
132
+ telegramUserId: string;
133
+ firstName: string | null;
134
+ lastName: string | null;
135
+ username: string | null;
136
+ photoUrl: string | null;
136
137
  };
137
138
  /** MFA methods */
138
139
  mfaMethods?: Array<string>;
@@ -25,52 +25,52 @@
25
25
  * ```
26
26
  */
27
27
  export function parsePrivyProperties(user) {
28
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
28
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
29
29
  var accounts = user.linkedAccounts || [];
30
30
  // Extract profile properties
31
31
  var properties = {
32
32
  privyDid: user.id,
33
- privyCreatedAt: user.createdAt,
33
+ privyCreatedAt: (_a = user.createdAt) === null || _a === void 0 ? void 0 : _a.getTime(),
34
34
  };
35
35
  // Email
36
- if ((_a = user.email) === null || _a === void 0 ? void 0 : _a.address) {
36
+ if ((_b = user.email) === null || _b === void 0 ? void 0 : _b.address) {
37
37
  properties.email = user.email.address;
38
38
  }
39
39
  // Social accounts - extract usernames/identifiers
40
- if ((_b = user.apple) === null || _b === void 0 ? void 0 : _b.email) {
40
+ if ((_c = user.apple) === null || _c === void 0 ? void 0 : _c.email) {
41
41
  properties.apple = user.apple.email;
42
42
  }
43
- if ((_c = user.discord) === null || _c === void 0 ? void 0 : _c.username) {
43
+ if ((_d = user.discord) === null || _d === void 0 ? void 0 : _d.username) {
44
44
  properties.discord = user.discord.username;
45
45
  }
46
- if ((_d = user.farcaster) === null || _d === void 0 ? void 0 : _d.username) {
46
+ if ((_e = user.farcaster) === null || _e === void 0 ? void 0 : _e.username) {
47
47
  properties.farcaster = user.farcaster.username;
48
48
  }
49
- if ((_e = user.github) === null || _e === void 0 ? void 0 : _e.username) {
49
+ if ((_f = user.github) === null || _f === void 0 ? void 0 : _f.username) {
50
50
  properties.github = user.github.username;
51
51
  }
52
- if ((_f = user.google) === null || _f === void 0 ? void 0 : _f.email) {
52
+ if ((_g = user.google) === null || _g === void 0 ? void 0 : _g.email) {
53
53
  properties.google = user.google.email;
54
54
  }
55
- if ((_g = user.instagram) === null || _g === void 0 ? void 0 : _g.username) {
55
+ if ((_h = user.instagram) === null || _h === void 0 ? void 0 : _h.username) {
56
56
  properties.instagram = user.instagram.username;
57
57
  }
58
- if ((_h = user.line) === null || _h === void 0 ? void 0 : _h.email) {
58
+ if ((_j = user.line) === null || _j === void 0 ? void 0 : _j.email) {
59
59
  properties.line = user.line.email;
60
60
  }
61
- if ((_j = user.linkedin) === null || _j === void 0 ? void 0 : _j.email) {
61
+ if ((_k = user.linkedin) === null || _k === void 0 ? void 0 : _k.email) {
62
62
  properties.linkedin = user.linkedin.email;
63
63
  }
64
- if ((_k = user.spotify) === null || _k === void 0 ? void 0 : _k.email) {
64
+ if ((_l = user.spotify) === null || _l === void 0 ? void 0 : _l.email) {
65
65
  properties.spotify = user.spotify.email;
66
66
  }
67
- if ((_l = user.telegram) === null || _l === void 0 ? void 0 : _l.username) {
67
+ if ((_m = user.telegram) === null || _m === void 0 ? void 0 : _m.username) {
68
68
  properties.telegram = user.telegram.username;
69
69
  }
70
- if ((_m = user.tiktok) === null || _m === void 0 ? void 0 : _m.username) {
70
+ if ((_o = user.tiktok) === null || _o === void 0 ? void 0 : _o.username) {
71
71
  properties.tiktok = user.tiktok.username;
72
72
  }
73
- if ((_o = user.twitter) === null || _o === void 0 ? void 0 : _o.username) {
73
+ if ((_p = user.twitter) === null || _p === void 0 ? void 0 : _p.username) {
74
74
  properties.twitter = user.twitter.username;
75
75
  }
76
76
  // Fallback to linkedAccounts if convenience accessors are not populated
@@ -120,7 +120,7 @@ export function parsePrivyProperties(user) {
120
120
  }
121
121
  }
122
122
  if (!properties.line) {
123
- var lineAccount = accounts.find(function (a) { return a.type === "line"; });
123
+ var lineAccount = accounts.find(function (a) { return a.type === "line_oauth"; });
124
124
  if (lineAccount === null || lineAccount === void 0 ? void 0 : lineAccount.email) {
125
125
  properties.line = lineAccount.email;
126
126
  }
@@ -173,13 +173,16 @@ export function parsePrivyProperties(user) {
173
173
  }
174
174
  // Extract wallet addresses
175
175
  var wallets = accounts
176
- .filter(function (a) { return a.type === "wallet" && a.address; })
177
- .map(function (a) { return ({
178
- address: a.address,
179
- walletClient: a.walletClientType || a.walletClient,
180
- chainType: a.chainType,
181
- isEmbedded: a.walletClientType === "privy" || a.walletClient === "privy",
182
- }); });
176
+ .filter(function (a) { return (a.type === "wallet" || a.type === "smart_wallet") && a.address; })
177
+ .map(function (a) {
178
+ var _a, _b;
179
+ return ({
180
+ address: a.address,
181
+ walletClient: (_a = (a.walletClientType || a.walletClient)) !== null && _a !== void 0 ? _a : undefined,
182
+ chainType: (_b = a.chainType) !== null && _b !== void 0 ? _b : undefined,
183
+ isEmbedded: a.walletClientType === "privy" || a.walletClient === "privy",
184
+ });
185
+ });
183
186
  return { properties: properties, wallets: wallets };
184
187
  }
185
188
  //# sourceMappingURL=utils.js.map
@@ -65,7 +65,6 @@ export interface TransactionAPIEvent {
65
65
  transactionHash?: string;
66
66
  function_name?: string;
67
67
  function_args?: Record<string, unknown>;
68
- builder_codes?: string;
69
68
  }
70
69
  export interface SignatureAPIEvent {
71
70
  type: "signature";
@@ -1,6 +1,5 @@
1
1
  export * from "./address";
2
2
  export * from "./base";
3
- export * from "./builderCode";
4
3
  export * from "./converter";
5
4
  export * from "./generate";
6
5
  export * from "./hash";
@@ -1,6 +1,5 @@
1
1
  export * from "./address";
2
2
  export * from "./base";
3
- export * from "./builderCode";
4
3
  export * from "./converter";
5
4
  export * from "./generate";
6
5
  export * from "./hash";
@@ -1,2 +1,2 @@
1
- export declare const version = "1.28.0";
1
+ export declare const version = "1.28.2";
2
2
  //# sourceMappingURL=version.d.ts.map
@@ -1,4 +1,4 @@
1
1
  // This file is auto-generated by scripts/update-version.js during npm version
2
2
  // Do not edit manually - it will be overwritten
3
- export var version = '1.28.0';
3
+ export var version = '1.28.2';
4
4
  //# sourceMappingURL=version.js.map
@@ -55,7 +55,6 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
55
55
  import { SignatureStatus, TransactionStatus } from "../types/events";
56
56
  import { logger } from "../logger";
57
57
  import { encodeWriteContractData, concatCalldataWithSuffix, extractFunctionArgs, buildSafeFunctionArgs, } from "./utils";
58
- import { extractBuilderCodes } from "../utils/builderCode";
59
58
  /**
60
59
  * Built-in transaction fields that could collide with function args.
61
60
  * Defined at module level to avoid recreating on every method call.
@@ -70,7 +69,6 @@ var RESERVED_FIELDS = new Set([
70
69
  "transactionHash",
71
70
  "function_name",
72
71
  "function_args",
73
- "builder_codes",
74
72
  ]);
75
73
  /**
76
74
  * Clean up old entries from a Set to prevent memory leaks.
@@ -385,7 +383,7 @@ var WagmiEventHandler = /** @class */ (function () {
385
383
  chainId: chainId,
386
384
  blockNumber: (_a = receipt === null || receipt === void 0 ? void 0 : receipt.blockNumber) === null || _a === void 0 ? void 0 : _a.toString(),
387
385
  });
388
- this.formo.transaction(__assign(__assign(__assign(__assign(__assign(__assign({ status: txStatus, chainId: chainId || 0, address: address, transactionHash: transactionHash }, ((pendingTx === null || pendingTx === void 0 ? void 0 : pendingTx.data) && { data: pendingTx.data })), ((pendingTx === null || pendingTx === void 0 ? void 0 : pendingTx.to) && { to: pendingTx.to })), ((pendingTx === null || pendingTx === void 0 ? void 0 : pendingTx.value) && { value: pendingTx.value })), ((pendingTx === null || pendingTx === void 0 ? void 0 : pendingTx.function_name) && { function_name: pendingTx.function_name })), ((pendingTx === null || pendingTx === void 0 ? void 0 : pendingTx.function_args) && { function_args: pendingTx.function_args })), ((pendingTx === null || pendingTx === void 0 ? void 0 : pendingTx.builder_codes) && { builder_codes: pendingTx.builder_codes })),
386
+ this.formo.transaction(__assign(__assign(__assign(__assign(__assign({ status: txStatus, chainId: chainId || 0, address: address, transactionHash: transactionHash }, ((pendingTx === null || pendingTx === void 0 ? void 0 : pendingTx.data) && { data: pendingTx.data })), ((pendingTx === null || pendingTx === void 0 ? void 0 : pendingTx.to) && { to: pendingTx.to })), ((pendingTx === null || pendingTx === void 0 ? void 0 : pendingTx.value) && { value: pendingTx.value })), ((pendingTx === null || pendingTx === void 0 ? void 0 : pendingTx.function_name) && { function_name: pendingTx.function_name })), ((pendingTx === null || pendingTx === void 0 ? void 0 : pendingTx.function_args) && { function_args: pendingTx.function_args })),
389
387
  // Spread function args as additional properties (only colliding keys are prefixed)
390
388
  pendingTx === null || pendingTx === void 0 ? void 0 : pendingTx.safeFunctionArgs);
391
389
  // Clean up the pending transaction after confirmation
@@ -548,7 +546,7 @@ var WagmiEventHandler = /** @class */ (function () {
548
546
  // Encode the function data synchronously if viem is available
549
547
  var encodedData = encodeWriteContractData(abi, fnName, args);
550
548
  if (encodedData) {
551
- // Include dataSuffix (ERC-8021 builder code) so extractBuilderCodes sees full calldata
549
+ // Include dataSuffix (e.g. ERC-8021 builder code) so full calldata is sent to server
552
550
  data = concatCalldataWithSuffix(encodedData, dataSuffix);
553
551
  logger.debug("WagmiEventHandler: Encoded writeContract data", data.substring(0, 10));
554
552
  }
@@ -560,9 +558,14 @@ var WagmiEventHandler = /** @class */ (function () {
560
558
  data = variables.data;
561
559
  to = variables.to;
562
560
  }
563
- // Extract builder codes from transaction data (ERC-8021)
564
- var builder_codes = extractBuilderCodes(data);
565
- logger.info("WagmiEventHandler: Tracking transaction event", __assign({ status: status_2, mutationType: mutationType, address: userAddress, chainId: chainId, transactionHash: transactionHash, function_name: function_name }, (builder_codes && { builder_codes: builder_codes })));
561
+ logger.info("WagmiEventHandler: Tracking transaction event", {
562
+ status: status_2,
563
+ mutationType: mutationType,
564
+ address: userAddress,
565
+ chainId: chainId,
566
+ transactionHash: transactionHash,
567
+ function_name: function_name,
568
+ });
566
569
  // Build safeFunctionArgs with collision handling and struct flattening
567
570
  var safeFunctionArgs = buildSafeFunctionArgs(function_args, RESERVED_FIELDS);
568
571
  // Store transaction details for BROADCASTED status to use in CONFIRMED/REVERTED
@@ -570,7 +573,7 @@ var WagmiEventHandler = /** @class */ (function () {
570
573
  // Include the sender address to handle wallet switches between broadcast and confirmation
571
574
  if (status_2 === TransactionStatus.BROADCASTED && transactionHash) {
572
575
  var normalizedHash = transactionHash.toLowerCase();
573
- var txDetails = __assign(__assign(__assign(__assign(__assign(__assign(__assign({ address: userAddress }, (data && { data: data })), (to && { to: to })), (value && { value: value })), (function_name && { function_name: function_name })), (function_args && { function_args: function_args })), (builder_codes && { builder_codes: builder_codes })), (safeFunctionArgs && { safeFunctionArgs: safeFunctionArgs }));
576
+ var txDetails = __assign(__assign(__assign(__assign(__assign(__assign({ address: userAddress }, (data && { data: data })), (to && { to: to })), (value && { value: value })), (function_name && { function_name: function_name })), (function_args && { function_args: function_args })), (safeFunctionArgs && { safeFunctionArgs: safeFunctionArgs }));
574
577
  this.pendingTransactions.set(normalizedHash, txDetails);
575
578
  logger.debug("WagmiEventHandler: Stored pending transaction for confirmation", {
576
579
  transactionHash: normalizedHash,
@@ -584,7 +587,7 @@ var WagmiEventHandler = /** @class */ (function () {
584
587
  }
585
588
  }
586
589
  }
587
- this.formo.transaction(__assign(__assign(__assign(__assign(__assign(__assign(__assign({ status: status_2, chainId: chainId || 0, address: userAddress }, (data && { data: data })), (to && { to: to })), (value && { value: value })), (transactionHash && { transactionHash: transactionHash })), (function_name && { function_name: function_name })), (function_args && { function_args: function_args })), (builder_codes && { builder_codes: builder_codes })),
590
+ this.formo.transaction(__assign(__assign(__assign(__assign(__assign(__assign({ status: status_2, chainId: chainId || 0, address: userAddress }, (data && { data: data })), (to && { to: to })), (value && { value: value })), (transactionHash && { transactionHash: transactionHash })), (function_name && { function_name: function_name })), (function_args && { function_args: function_args })),
588
591
  // Spread function args as additional properties (only colliding keys are prefixed)
589
592
  safeFunctionArgs);
590
593
  }