Files
supabase/packages/common/package.json
T
Sean Oliver f0f2b57939 test(telemetry): cover every ad click id in first-touch attribution (#51774)
## Problem

The ad click ids we send to PostHog for first-touch attribution have no
direct tests. A typo in a param name (say `getParam('opref')`) would
silently drop that click id and CI would stay green. Also, nothing in CI
ran `packages/common` tests at all, apart from `sentry.test.ts`.
GROWTH-1326.

## Solution

- First-touch click ids are now one exported list,
`FIRST_TOUCH_CLICK_ID_KEYS`, instead of 11 hand-written `getParam`
lines. Same ids, same output.
- New `telemetry.test.ts` checks that list equals `CLICK_ID_KEYS` plus
`bfcid`, and that every id in it comes back from
`getFirstTouchAttributionProps`.
- `first-referrer-cookie.test.ts` checks `buildFirstReferrerData`
extracts every `CLICK_ID_KEYS` entry, and that `bfcid` stays out of that
pre-consent list.
- Added a `test` script to `packages/common` and a `pnpm --filter common
test` step to `library-tests.yml`, which already triggers on
`packages/common/**`.

## Review instructions

1. Check the Library checks job runs the common tests (13 files).
2. Add a made-up id to `FIRST_TOUCH_CLICK_ID_KEYS` only, then run `pnpm
--filter common test`. It fails.

## Checklist

Check all before review:

- [x] I have read
[CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md)
- [ ] If I wrote a new docs topic or edited an existing topic, I used
the `/write-the-docs` or `/edit-the-docs` skill, which applies the docs
[style
guide](https://github.com/supabase/supabase/tree/master/apps/docs/style-guide)
2026-11-09 09:37:28 -08:00

53 lines
1.4 KiB
JSON

{
"name": "common",
"version": "0.0.0",
"type": "module",
"main": "./index.tsx",
"types": "./index.tsx",
"license": "MIT",
"scripts": {
"preinstall": "npx only-allow pnpm",
"clean": "rimraf .turbo tsconfig.tsbuildinfo",
"gen:types": "supabase gen types typescript --local >| ./database-types.ts",
"test": "vitest run",
"typecheck": "tsc --noEmit"
},
"dependencies": {
"@types/dat.gui": "^0.7.12",
"@usercentrics/cmp-browser-sdk": "^4.42.0",
"api-types": "workspace:*",
"config": "workspace:*",
"configcat-js": "^9.5.1",
"dat.gui": "^0.7.9",
"flags": "^4.0.0",
"lodash": "catalog:",
"next-themes": "catalog:",
"posthog-js": "^1.416.1",
"react-use": "^17.4.0",
"valtio": "catalog:"
},
"devDependencies": {
"@types/lodash": "4.17.5",
"@types/node": "catalog:",
"@types/react": "catalog:",
"@types/react-dom": "catalog:",
"@typescript/native": "catalog:",
"@vitest/coverage-v8": "catalog:",
"@vitest/ui": "catalog:",
"lucide-react": "catalog:",
"tsconfig": "workspace:*",
"type-fest": "5.6.0",
"typescript": "catalog:",
"vite": "catalog:",
"vitest": "catalog:"
},
"peerDependencies": {
"@supabase/auth-js": "catalog:",
"@supabase/supabase-js": "catalog:",
"lucide-react": "catalog:",
"next": "catalog:",
"react": "catalog:",
"react-dom": "catalog:"
}
}