Commit Graph
7 Commits
Author SHA1 Message Date
Pamela Chia 0755ba6556 feat(studio): use the onboarding survey in the AWS Marketplace org form (#53938) 2026-11-26 23:27:19 +08:00
Pamela Chia 68b2b5eb1d feat(studio): ask new Vercel Marketplace org owners the onboarding survey (#53941) 2026-11-26 23:26:45 +08:00
Alaister YoungandAlaister Young 953e508a3e [FE-5110] refactor(studio): replace next/navigation with TanStack (#54041)
Moves the remaining `next/navigation` imports in Studio onto TanStack
Router hooks (and `useParams` from `common`), finishes migrating the
remaining `next/link` and `next/router` usages in the touched
components, and removes the `compat/next/navigation.ts` shim and its
Vite alias. Shared packages (`packages/**`) no longer import
`next/navigation`, so the alias can be dropped now.

**Removed:**

- `apps/studio/compat/next/navigation.ts` and the `'next/navigation'`
entry in `apps/studio/vite.config.ts`
- Global `next/navigation` mock in `apps/studio/tests/vitestSetup.ts`
and the obsolete `apps/studio/tests/lib/route-mock.test.tsx`

**Changed:**

- Replaced `usePathname` (12 files) and `useSearchParams` (3 files) with
`useLocation({ select })` from `@tanstack/react-router`
- Replaced `useRouter` in Storage bucket tables, SQL Editor commands,
and `SignInMfaForm` with `useNavigate` from `@tanstack/react-router`,
and updated `createNavigationHandler` in `lib/navigation.ts` to accept
either `NextRouter` or TanStack's `useNavigate`
- Replaced remaining `next/link` imports in touched components
(`SignInMfaForm`, `Restriction`, `DownloadLogsButton`,
`DownloadResultsButton`, `AuthEmailsLayout`, `AuthProvidersLayout`,
`JWTKeysLayout`, `StorageBucketsLayout`) with TanStack Router's `Link`
- Replaced `useParams` in `CreatePublishableAPIKeyDialog` with
`useParams` from `common` (matching `CreateSecretAPIKeyDialog`)
- Wrapped `CustomWrapper` (`tests/lib/custom-render.tsx`) in a default
TanStack `RouterContextProvider` (with optional `router` / `initialUrl`
overrides) and updated affected component tests to drop their
`next/navigation` mocks

Addresses
[FE-5110](https://linear.app/supabase/issue/FE-5110/replace-the-nextnavigation-shim-with-tanstack-router-hooks)

## To test

1. Check active tab highlighting and navigation across Auth Emails, Auth
Providers, JWT Keys, Storage Buckets, and Editor layouts
2. Verify clicking, Cmd/Ctrl-clicking, middle-clicking, and pressing
Enter on Storage bucket rows (Files, Analytics, Vector) navigates as
before
3. Run "Query a table..." and open SQL snippets from the Command Menu
and confirm `/project/$ref/sql/$id` opens with multi-line SQL preserved
in `?content=`
4. In the MFA sign-in flow, verify the recovery code link and
`forgot-password` completion preserve query params (`returnTo`,
`context=forgot-password`), and Cancel signs out and replaces history
with `/sign-in`
5. Confirm Table Editor sort/filter URL sync persists filters per table
without leaking across table switches

---------

Co-authored-by: Alaister Young <10985857+alaister@users.noreply.github.com>
2026-11-26 17:18:49 +08:00
Pamela ChiaandJoshen Lim 86ab87efd7 chore(studio): remove the onboarding survey experiment flag (#53918)
The onboarding survey experiment on the new-org form is finished and the
survey version is now the default. I removed the
`onboardingSurveyPlacement` flag from Studio: the form always shows the
survey, and I deleted the old form path.

**Changed:**
- **New-org form**: always renders the name field plus the optional
"Help improve Supabase" survey card. Org type and size are saved through
the survey endpoint only, as they already were for the survey variant.
- **Experiment plumbing removed**: I deleted the flag read, its exposure
event (`onboarding_survey_placement_experiment_exposed`) and the variant
constants, so the form no longer starts on the old layout while flags
load.
- **Tests**: the survey tests keep their assertions with the flag setup
removed. I deleted the test for the old form (org type sent at creation,
no survey) because that behavior no longer exists.

**Note:** I removed the `renderFieldWrapper` option from
`OrganizationDetailsFields`, which only the old form path used. The
cloud marketplace org form still uses the component unchanged.

## To test

Tested on the PR preview:
- [x] Sign in and open `/new`: expect a Name field with no Type field
above the plan picker, and a "Help improve Supabase" card with the org
type, "What are you building?" and "Do you know how to code?" questions.
Observed: Name, Plan, then the card with "Who is this org for?" (default
Personal) and both questions.
- [x] Create a free org with the survey untouched: expect the create
request body to carry no `kind` or `size`, no `onboarding-survey`
request, and the follow-up card on the new org's projects page.
Observed: create body `{"name":"…","tier":"tier_free"}` (201), no survey
request, and the follow-up card with Answer and Skip on the org page.
- [x] Create a free org with type Company, a company size and a "What
are you building?" answer: expect one `POST
/platform/organizations/onboarding-survey` with those answers returning
204, and no follow-up card. Observed: one request with `kind:
"COMPANY"`, `size: "50"`, `building: "b2b_saas"` (204), create body
again without `kind` or `size`, no follow-up card.
- [x] Watch telemetry requests while `/new` loads: expect no
`onboarding_survey_placement_experiment_exposed` event. Observed: none
across both org creations, while `onboarding_survey_dismissed` and
`onboarding_survey_submit_button_clicked` (both `surface: org_form`)
were sent.
- [x] Added: the survey card is in the first render of `/new` and the
Name input keeps focus, with no layout switch after flags load.

## Linear
- fixes GROWTH-1562

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2026-11-24 18:13:38 +08:00
Pamela Chia 4998b77ab2 feat(studio): ask whether org creators know how to code (#53317)
I added the "Do you know how to code?" question (Yes / No, optional) to
the onboarding survey on the new organization form and in the follow-up
dialog. The answer is sent as `can_code` in the same survey request as
the other answers. I removed an earlier version of this question before
the survey shipped because the platform didn't store it; the platform
now accepts `can_code`.

**Changed:**
- **New question, always visible**: it shows on both surfaces without
waiting on another answer, so it can be answered on its own. Only the
`org_form` arm of the experiment shows the survey.
- **Follow-up dialog shows every question at once**: "What are you
building?" used to appear only after "Who is this org for?" was
answered. "How many people?" still appears only for the Company org
type.
- **Follow-up card above other banners**: I raised its priority in the
banner stack so it sits in front of the project-page cards for its
five-minute window.
- **Telemetry**: I added a `hasCanCode` boolean to
`onboarding_survey_submit_button_clicked` and
`onboarding_survey_submit_failed`.

**Note:** Merge only after the platform change that accepts `can_code`
is in production: before that, the API drops the key and still returns
204, so answers are lost with no error. The change is live once
`can_code` is listed under `OnboardingSurveyBody` in the production
platform OpenAPI spec. I widened `OnboardingSurveyBody` locally because
`packages/api-types` can only be regenerated once the production spec
has the field.

## To test
Setup: sign in and set the `onboardingSurveyPlacement` flag to
`org_form` with the dev toolbar.

Tested on the PR preview:
- [x] Open `/new`: expect "Do you know how to code?" below "What are you
building?" with Yes then No, before any other question is answered.
Answer both and create the org: expect one `POST
/platform/organizations/onboarding-survey` whose body has `building` and
`can_code`. Observed: both questions on the untouched form, options Yes
then No; one request, 204, body has `"can_code":"yes"`.
- [x] Create an org with only "Do you know how to code?" answered:
expect one request whose body has `can_code` and no `building` key.
Observed: one request, 204, `"can_code":"no"`, no `building` key, and no
follow-up card on the new org's page.
- [x] Create an org with the org type changed to Company, a size picked
and "Do you know how to code?" answered, leaving "What are you
building?" blank: expect one request with `kind`, `size` and `can_code`,
and no follow-up card on the new org's page. Observed: one request, 204,
`"kind":"COMPANY","size":"50","can_code":"yes"`; no follow-up card.
- [x] Create an org with "What are you building?" answered and the new
question left blank: expect the request body to have no `can_code` key,
and the org to be created. Observed: one request, 204, no `can_code`
key.
- [x] Create an org without touching the survey, then open the new org's
page: expect the "Help improve Supabase" card. Click Answer: expect all
three questions in the dialog right away. Answer all three questions and
send: expect one request with `kind`, `building` and `can_code`.
Observed: no survey request at creation; the card shows on the org page;
the dialog opens with all three questions blank; one request, 204, body
has `"can_code":"yes"`.
- [x] Set the flag to `control` and open `/new`: expect no survey
questions. Observed: none of the survey questions render.
- [x] Added check: `onboarding_survey_submit_button_clicked` carries
`hasCanCode`. Observed: `true` when answered on both surfaces, `false`
when left blank.

## Linear
- fixes GROWTH-1487
2026-11-13 23:14:29 +09:00
Pamela Chia 362c974153 fix(studio): record onboarding survey exposure only for signed-in users (#53253) 2026-11-12 10:21:20 +09:00
2ce7f1f33c experiment(studio): expanded onboarding survey (#45707)
Adds an optional onboarding survey to the new-organization form, so we
learn who new orgs are for and what they are building. Users in the
`org_form` arm of the `onboardingSurveyPlacement` PostHog flag see a
**Help improve Supabase** section. Users in `control` get today's form
unchanged and still record exposure, so the two arms can be compared;
users the flag doesn't assign get the existing form and record nothing.

**Changed:**
- **Survey on the new-org form**: asks **Who is this org for?** (plus
**How many people?** for companies) and **What are you building?** (AI
assistant or agent, AI search or knowledge base, B2B SaaS, internal
tool, consumer app, social or community, marketplace or booking,
e-commerce, developer tool or app builder, analytics or reporting,
other). Every question ends with **Prefer not to say**. Answers go to
`POST /platform/organizations/onboarding-survey` as `kind`, `size` and
`building`.
- **Follow-up card for a blank survey**: if the creator answers nothing,
a card in the bottom-right asks the same questions for 5 minutes after
the org is created (not on project creation pages). Only the creator
sees it, once, tracked in localStorage. A blank form sends nothing at
creation, because the platform keeps only the first survey response per
user and org. Skipping the card, closing it, or letting the 5 minutes
run out still saves the org type and size picked on the form.
- **Telemetry**: exposure for both arms, plus submit, submit failed,
dismissed (including `follow_up_expired` when the card times out) and
Answer clicked events with `surface` set to `org_form` or `follow_up`.

**Note:** I cut **How comfortable are you working with code?** from v1.
The survey endpoint doesn't accept `coding_experience` yet, and the
question is planned to move to the user level later.

## To test
Setup: override `onboardingSurveyPlacement` to `org_form` in the dev
toolbar. Close the Terms of Service banner first, since the follow-up
card shares its slot.

Tested on the PR preview:
- [x] Create an org with **Who is this org for?** and **What are you
building?** answered, expect one `POST
/platform/organizations/onboarding-survey` carrying `kind` and
`building` (plus `size` for companies), no `coding_experience` key, and
no `kind` or `size` in the org-create request. Observed: 204 with
`{"slug":"<slug>","kind":"COMPANY","size":"10","building":"b2b_saas"}`;
org-create body was `{"name":"<name>","tier":"tier_free"}`
- [x] Create an org with the survey left blank, then open its projects
page, expect the follow-up card; answer it, expect the same survey
request and a "Thanks for sharing" toast. Observed: no survey request at
creation; after answering, 204 with
`{"slug":"<slug>","kind":"PERSONAL","building":"consumer_app"}` and the
toast
- [x] Override to `control`, open the new-org form, expect the same form
as master (Name, Type, Company size with "How many people are in your
company?" for Company, then Plan), no survey section, and an
`onboarding_survey_placement_experiment_exposed` event with `variant:
control`. Observed: screenshots match master's form field for field; the
exposure arrived in PostHog with `variant: control`
- [x] Create an org with the survey left blank and don't act on the
follow-up card for 5 minutes, expect the card to disappear, one `POST
/platform/organizations/onboarding-survey` carrying the form's `kind`
(plus `size` for companies) and no `building`, and an
`onboarding_survey_dismissed` event with `reason: follow_up_expired`.
Observed (stored follow-up time moved to near expiry instead of
waiting): the card disappeared at the 5-minute mark with one 204
carrying `{"slug":"<slug>","kind":"AGENCY"}` and the `follow_up_expired`
event; an already-expired follow-up sends on page load; with the dialog
open past expiry nothing is sent until it is closed

## Linear
- fixes GROWTH-771
- part of GROWTH-1463

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: Jonathan Summers-Muir <MildTomato@users.noreply.github.com>
Co-authored-by: Pamela Chia <pamelachiamayyee@gmail.com>
Co-authored-by: Alaister Young <10985857+alaister@users.noreply.github.com>
2026-11-10 17:52:57 +09:00