@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.
- package/dist/cjs/src/FormoAnalytics.d.ts +1 -2
- package/dist/cjs/src/FormoAnalytics.js +9 -6
- package/dist/cjs/src/event/EventFactory.d.ts +1 -1
- package/dist/cjs/src/event/EventFactory.js +3 -3
- package/dist/cjs/src/privy/types.d.ts +65 -64
- package/dist/cjs/src/privy/utils.js +26 -23
- package/dist/cjs/src/types/events.d.ts +0 -1
- package/dist/cjs/src/utils/index.d.ts +0 -1
- package/dist/cjs/src/utils/index.js +0 -1
- package/dist/cjs/src/version.d.ts +1 -1
- package/dist/cjs/src/version.js +1 -1
- package/dist/cjs/src/wagmi/WagmiEventHandler.js +12 -9
- package/dist/esm/src/FormoAnalytics.d.ts +1 -2
- package/dist/esm/src/FormoAnalytics.js +9 -6
- package/dist/esm/src/event/EventFactory.d.ts +1 -1
- package/dist/esm/src/event/EventFactory.js +3 -3
- package/dist/esm/src/privy/types.d.ts +65 -64
- package/dist/esm/src/privy/utils.js +26 -23
- package/dist/esm/src/types/events.d.ts +0 -1
- package/dist/esm/src/utils/index.d.ts +0 -1
- package/dist/esm/src/utils/index.js +0 -1
- package/dist/esm/src/version.d.ts +1 -1
- package/dist/esm/src/version.js +1 -1
- package/dist/esm/src/wagmi/WagmiEventHandler.js +12 -9
- package/dist/index.umd.min.js +1 -1
- package/package.json +1 -1
- package/dist/cjs/src/utils/builderCode.d.ts +0 -30
- package/dist/cjs/src/utils/builderCode.js +0 -143
- package/dist/esm/src/utils/builderCode.d.ts +0 -30
- package/dist/esm/src/utils/builderCode.js +0 -140
|
@@ -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" | "
|
|
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?:
|
|
42
|
-
latestVerifiedAt?:
|
|
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?:
|
|
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
|
-
|
|
76
|
-
|
|
77
|
-
|
|
74
|
+
subject: string;
|
|
75
|
+
email: string;
|
|
76
|
+
name: string | null;
|
|
78
77
|
};
|
|
79
78
|
discord?: {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
email
|
|
79
|
+
subject: string;
|
|
80
|
+
username: string | null;
|
|
81
|
+
email: string | null;
|
|
83
82
|
};
|
|
84
83
|
twitter?: {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
profilePictureUrl
|
|
84
|
+
subject: string;
|
|
85
|
+
username: string | null;
|
|
86
|
+
name: string | null;
|
|
87
|
+
profilePictureUrl: string | null;
|
|
89
88
|
};
|
|
90
89
|
farcaster?: {
|
|
91
|
-
fid
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
bio
|
|
96
|
-
pfp
|
|
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
|
-
|
|
100
|
-
|
|
101
|
-
|
|
98
|
+
subject: string;
|
|
99
|
+
username: string | null;
|
|
100
|
+
name: string | null;
|
|
102
101
|
};
|
|
103
102
|
linkedin?: {
|
|
104
|
-
|
|
105
|
-
name
|
|
106
|
-
|
|
103
|
+
subject: string;
|
|
104
|
+
name: string | null;
|
|
105
|
+
email: string | null;
|
|
106
|
+
vanityName: string | null;
|
|
107
107
|
};
|
|
108
108
|
apple?: {
|
|
109
|
-
|
|
110
|
-
|
|
109
|
+
subject: string;
|
|
110
|
+
email: string;
|
|
111
111
|
};
|
|
112
112
|
instagram?: {
|
|
113
|
-
|
|
114
|
-
|
|
113
|
+
subject: string;
|
|
114
|
+
username: string | null;
|
|
115
115
|
};
|
|
116
116
|
spotify?: {
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
117
|
+
subject: string;
|
|
118
|
+
email: string | null;
|
|
119
|
+
name: string | null;
|
|
120
120
|
};
|
|
121
121
|
tiktok?: {
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
122
|
+
subject: string;
|
|
123
|
+
username: string | null;
|
|
124
|
+
name: string | null;
|
|
125
125
|
};
|
|
126
126
|
line?: {
|
|
127
|
-
|
|
128
|
-
name
|
|
129
|
-
|
|
127
|
+
subject: string;
|
|
128
|
+
name: string | null;
|
|
129
|
+
email: string | null;
|
|
130
130
|
};
|
|
131
131
|
telegram?: {
|
|
132
|
-
telegramUserId
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
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 ((
|
|
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 ((
|
|
40
|
+
if ((_c = user.apple) === null || _c === void 0 ? void 0 : _c.email) {
|
|
41
41
|
properties.apple = user.apple.email;
|
|
42
42
|
}
|
|
43
|
-
if ((
|
|
43
|
+
if ((_d = user.discord) === null || _d === void 0 ? void 0 : _d.username) {
|
|
44
44
|
properties.discord = user.discord.username;
|
|
45
45
|
}
|
|
46
|
-
if ((
|
|
46
|
+
if ((_e = user.farcaster) === null || _e === void 0 ? void 0 : _e.username) {
|
|
47
47
|
properties.farcaster = user.farcaster.username;
|
|
48
48
|
}
|
|
49
|
-
if ((
|
|
49
|
+
if ((_f = user.github) === null || _f === void 0 ? void 0 : _f.username) {
|
|
50
50
|
properties.github = user.github.username;
|
|
51
51
|
}
|
|
52
|
-
if ((
|
|
52
|
+
if ((_g = user.google) === null || _g === void 0 ? void 0 : _g.email) {
|
|
53
53
|
properties.google = user.google.email;
|
|
54
54
|
}
|
|
55
|
-
if ((
|
|
55
|
+
if ((_h = user.instagram) === null || _h === void 0 ? void 0 : _h.username) {
|
|
56
56
|
properties.instagram = user.instagram.username;
|
|
57
57
|
}
|
|
58
|
-
if ((
|
|
58
|
+
if ((_j = user.line) === null || _j === void 0 ? void 0 : _j.email) {
|
|
59
59
|
properties.line = user.line.email;
|
|
60
60
|
}
|
|
61
|
-
if ((
|
|
61
|
+
if ((_k = user.linkedin) === null || _k === void 0 ? void 0 : _k.email) {
|
|
62
62
|
properties.linkedin = user.linkedin.email;
|
|
63
63
|
}
|
|
64
|
-
if ((
|
|
64
|
+
if ((_l = user.spotify) === null || _l === void 0 ? void 0 : _l.email) {
|
|
65
65
|
properties.spotify = user.spotify.email;
|
|
66
66
|
}
|
|
67
|
-
if ((
|
|
67
|
+
if ((_m = user.telegram) === null || _m === void 0 ? void 0 : _m.username) {
|
|
68
68
|
properties.telegram = user.telegram.username;
|
|
69
69
|
}
|
|
70
|
-
if ((
|
|
70
|
+
if ((_o = user.tiktok) === null || _o === void 0 ? void 0 : _o.username) {
|
|
71
71
|
properties.tiktok = user.tiktok.username;
|
|
72
72
|
}
|
|
73
|
-
if ((
|
|
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 === "
|
|
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) {
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
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
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const version = "1.28.
|
|
1
|
+
export declare const version = "1.28.2";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/dist/esm/src/version.js
CHANGED
|
@@ -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(
|
|
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
|
|
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
|
-
|
|
564
|
-
|
|
565
|
-
|
|
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(
|
|
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(
|
|
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
|
}
|