diff --git a/with-dynamic/.vite/deps/_metadata.json b/with-dynamic/.vite/deps/_metadata.json new file mode 100644 index 0000000..591282c --- /dev/null +++ b/with-dynamic/.vite/deps/_metadata.json @@ -0,0 +1,8 @@ +{ + "hash": "617a516a", + "configHash": "21b1d9d9", + "lockfileHash": "366f99a9", + "browserHash": "c1da27b5", + "optimized": {}, + "chunks": {} +} \ No newline at end of file diff --git a/with-dynamic/.vite/deps/package.json b/with-dynamic/.vite/deps/package.json new file mode 100644 index 0000000..3dbc1ca --- /dev/null +++ b/with-dynamic/.vite/deps/package.json @@ -0,0 +1,3 @@ +{ + "type": "module" +} diff --git a/with-privy/src/app/page.tsx b/with-privy/src/app/page.tsx index 73960e9..14c4d43 100644 --- a/with-privy/src/app/page.tsx +++ b/with-privy/src/app/page.tsx @@ -4,11 +4,11 @@ import { usePrivy, useWallets } from "@privy-io/react-auth"; import { useSetActiveWallet } from "@privy-io/wagmi"; import { useAccount, useBalance, useChainId, useSignMessage, useSendTransaction } from "wagmi"; import { formatUnits } from "viem"; -import { useFormo } from "@formo/analytics"; +import { useFormo, parsePrivyProperties } from "@formo/analytics"; import { useState, useEffect, useRef } from "react"; export default function Home() { - const { ready, authenticated, login, logout } = usePrivy(); + const { ready, authenticated, login, logout, user } = usePrivy(); const { wallets } = useWallets(); const { setActiveWallet } = useSetActiveWallet(); const { address, isConnected, connector } = useAccount(); @@ -81,15 +81,16 @@ export default function Home() { }); }; - // Handle identify - const handleIdentify = async () => { - if (!address || !formo) return; + // Identify user with Privy profile on connect + useEffect(() => { + if (!user || !formo) return; - await formo.identify({ - address, - providerName: connector?.name, - }); - }; + const { properties, wallets } = parsePrivyProperties(user); + + for (const wallet of wallets) { + formo.identify({ address: wallet.address, userId: user.id }, properties); + } + }, [user, formo]); // Handle sign message (Formo automatically tracks this via wagmi integration) const handleSignMessage = () => { @@ -263,14 +264,6 @@ export default function Home() { Track Page View - -