Skip to content

Commit

Permalink
feat(passport): rollup id deletion analytics event (#2465)
Browse files Browse the repository at this point in the history
  • Loading branch information
poolsar42 committed Jul 10, 2023
1 parent 5bd9f8d commit 1d654cd
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
12 changes: 9 additions & 3 deletions apps/console/app/routes/apps/$clientId/auth.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -243,8 +243,13 @@ export default function AppDetailIndexPage() {
paymaster: PaymasterType
appContactAddress?: AddressURN
}>()
const { appContactAddress, paymaster, notificationHandler, appDetails } =
outletContextData
const {
appContactAddress,
paymaster,
notificationHandler,
appDetails,
accountURN,
} = outletContextData
const { scopeMeta }: { scopeMeta: ScopeMeta } = useLoaderData()
const posthog = usePostHog()

Expand Down Expand Up @@ -287,7 +292,8 @@ export default function AppDetailIndexPage() {
if (actionData?.updatedApp) Object.assign(appDetails, actionData.updatedapp)
if (actionData?.published) {
posthog?.capture('app_published', {
client_id: appDetails.clientId,
distinct_id: appDetails.clientId,
account_urn: accountURN,
})
}
}, [actionData])
Expand Down
7 changes: 7 additions & 0 deletions apps/passport/app/routes/settings/advanced.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import type { ActionFunction } from '@remix-run/cloudflare'
import type { AddressURN } from '@proofzero/urns/address'
import { RollupError, ERROR_CODES, BadRequestError } from '@proofzero/errors'
import { getRollupReqFunctionErrorWrapper } from '@proofzero/utils/errors'
import { posthogCall } from '@proofzero/utils/posthog'

export const action: ActionFunction = getRollupReqFunctionErrorWrapper(
async ({ request, context }) => {
Expand Down Expand Up @@ -103,6 +104,12 @@ export const action: ActionFunction = getRollupReqFunctionErrorWrapper(
})
}

await posthogCall({
apiKey: context.env.POSTHOG_API_KEY,
eventName: 'delete_rollup_identity',
distinctId: accountUrn,
})

return await destroyUserSession(
request,
'/',
Expand Down

0 comments on commit 1d654cd

Please sign in to comment.