Skip to content

feat: add @drift-labs/posthog-types package#327

Merged
ChesterSim merged 4 commits intomasterfrom
chester/posthog-types
Mar 26, 2026
Merged

feat: add @drift-labs/posthog-types package#327
ChesterSim merged 4 commits intomasterfrom
chester/posthog-types

Conversation

@ChesterSim
Copy link
Copy Markdown
Contributor

@ChesterSim ChesterSim commented Mar 25, 2026

Summary

Adds a new @drift-labs/posthog-types package that provides shared, strongly-typed PostHog event definitions for use across web and mobile clients. This ensures consistent event naming and property shapes across platforms, catching analytics drift at compile time.

Changes

  • New package posthog-types/ with build tooling (package.json, tsconfig.json)
  • Event type definitions organized by domain:
    • collateral — deposit, withdrawal, borrow, transfer, funxyz events
    • trade — order placement, orderbook crossed, order params, swap, close position, TP/SL, predictions
    • vault — deposit, withdrawal, view/inspect events
    • ifStaking — stake, unstake, cancel, withdraw events
    • earn — navigation CTA events (IF stake, vaults, dSOL, amplify)
    • amplify — deposit CTA and success events
    • onboarding — wallet connect, magic auth, signless setup, referral, privy errors
    • survey — PostHog-reserved survey lifecycle events (survey shown/dismissed/sent)
    • pnl — action performed, history export events
    • system — unmatched/unhandled errors, performance snapshots, RPC health
  • PostHogEventMap — union type mapping every event name to its typed properties
  • Helper typesNoProperties, PostHogEvent, CaptureEvent<K>, ExtendEventMap<Extra>
  • Super property typesStaticSuperProperties (platform, env) and DynamicSuperProperties (wallet state)

Test plan

  • cd posthog-types && yarn build compiles without errors
  • Verify lib/ output contains .js and .d.ts files for all modules
  • Import PostHogEventMap in a consumer and confirm autocomplete works for event names and properties
  • Confirm CaptureEvent<'trade_placed'> resolves to the correct property type

ChesterSim and others added 3 commits March 25, 2026 22:33
Shared PostHog event type definitions for web and mobile.
Maps every event name to its typed properties via PostHogEventMap.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
trade_order_params_requested.user_account_pubkey accepts PublicKey.
trade_oracle_mark_divergence: market accepts MarketKey, add orderType,
swiftEnabled optional.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@ChesterSim ChesterSim marked this pull request as ready for review March 26, 2026 04:11
@ChesterSim ChesterSim merged commit d8b877f into master Mar 26, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant