mirror of
https://github.com/supabase/supabase.git
synced 2026-12-04 07:29:16 +00:00
Studio sends no events between the plan CTA click and the backend's subscription update, so we can't see where people stop in the plan change flow. The redesigned plan change screen from #53670 is also gated by a ConfigCat flag, and ConfigCat flag values are not attached to events, so its rollout can't be compared against the legacy dialog. I added the missing events and a property for the flag state. **Changed:** - **Which screen a user gets**: I added `planUpdateRedesignEnabled` and `origin` (the `source` query param the panel was opened with) to `studio_pricing_plan_cta_clicked`. - **Confirm and completion**: the redesigned screen now sends `studio_pricing_plan_change_confirm_clicked` on the confirm button and `studio_pricing_plan_change_completed` once the change succeeds. A payment confirmation that the API answers with 202 (payment taken, plan still syncing) counts as completed too. - **Compute explainer and docs links**: expanding "Billed every hour, even when idle" sends `studio_pricing_compute_billing_explainer_opened`, and the compute and project transfer docs links send `studio_pricing_plan_change_docs_link_clicked`. - **Stale origin**: closing the pricing panel now removes `source` from the URL. Before, reopening the panel from the billing page reported the previous entry point as the origin. **Note:** the legacy dialog gets no new events, and `planUpdateRedesignEnabled` should be removed together with it. ## To test Needs the `billingPlanUpdateRedesign` flag on. Watch the `telemetry/event` requests in the network tab. Tested on the PR preview: - [x] Open `/org/<slug>/billing?panel=subscriptionPlan&source=backups` on a Free org and click "Upgrade to Pro", expect `studio_pricing_plan_cta_clicked` with `planUpdateRedesignEnabled: true` and `origin: "backups"`. Observed, and the redesigned screen opened. - [x] On the same panel, click the Enterprise card's "Contact us", expect exactly one `studio_pricing_plan_cta_clicked` with `selectedPlan: "Enterprise"`, `planUpdateRedesignEnabled: true` and `origin: "backups"`. Observed, one event. - [x] Expand "Billed every hour, even when idle", expect one `studio_pricing_compute_billing_explainer_opened`. Collapse it, expect no event. Observed, and a second expand sent a second event. - [x] Click "Learn about compute", expect `studio_pricing_plan_change_docs_link_clicked` with `docsLink: "compute"`. Observed, and the "Transfer" link sent `docsLink: "project_transfer"`. - [x] Go back and close the pricing panel, expect `source` to be gone from the URL. Observed: the URL ended at `/billing` with no `panel` or `source`. - [x] With the flag overridden off and the page reloaded, click "Upgrade to Pro", expect `planUpdateRedesignEnabled: false` and the legacy dialog. Observed. - [x] Confirm with a declining card, expect `studio_pricing_plan_change_confirm_clicked` and no `studio_pricing_plan_change_completed`. Observed: the subscription update returned 402 and no completion was sent. - [x] Confirm the upgrade with a test card, expect `studio_pricing_plan_change_confirm_clicked` then one `studio_pricing_plan_change_completed` with `currentPlan: "Free"`, `selectedPlan: "Pro"`, `origin: "backups"` and no project group. Observed, with `groups` holding only `organization`. - [x] Upgrade again with a card that requires 3D Secure, expect one `studio_pricing_plan_change_completed`, sent only after the challenge. Observed on a Pro to Team change. I also confirmed ingestion by querying the staging PostHog project: all five events from this run arrived from the preview host with the properties above. The run included the CTA click with both `true` and `false` for `planUpdateRedesignEnabled`, `docsLink` values `compute` and `project_transfer`, completions for Free to Pro and Pro to Team, and only an organization group on every event. ## Linear - fixes GROWTH-1565
69 lines
2.3 KiB
TypeScript
69 lines
2.3 KiB
TypeScript
import { ClockIcon, RefreshCwIcon, TrendingUpIcon } from 'lucide-react'
|
|
import type { ReactNode } from 'react'
|
|
|
|
import { getInfrastructurePath } from '@/components/interfaces/Settings/Infrastructure/Infrastructure.utils'
|
|
import { DOCS_URL } from '@/lib/constants'
|
|
|
|
const Note = ({ icon, children }: { icon: ReactNode; children: ReactNode }) => (
|
|
<li className="flex items-start gap-3">
|
|
<span className="mt-1 shrink-0 text-foreground-lighter" aria-hidden="true">
|
|
{icon}
|
|
</span>
|
|
<p className="text-base text-foreground-light">{children}</p>
|
|
</li>
|
|
)
|
|
|
|
interface PlanChangeNotesProps {
|
|
/** Any project the customer could move to Micro, used to link Infrastructure settings. */
|
|
exampleProjectRef?: string
|
|
onProjectTransferDocsClick: () => void
|
|
}
|
|
|
|
/**
|
|
* What surprises customers after upgrading off Free: projects never pause, every project
|
|
* in the org is billed, compute size does not change on its own, and the plan renews
|
|
* until they cancel it. Only rendered for an upgrade from the Free plan.
|
|
*/
|
|
export const PlanChangeNotes = ({
|
|
exampleProjectRef,
|
|
onProjectTransferDocsClick,
|
|
}: PlanChangeNotesProps) => (
|
|
<ul className="space-y-3">
|
|
<Note icon={<ClockIcon size={16} />}>
|
|
<span className="text-foreground">Projects never pause.</span> Every project bills around the
|
|
clock, even when idle.{' '}
|
|
<a
|
|
href={`${DOCS_URL}/guides/platform/project-transfer`}
|
|
target="_blank"
|
|
rel="noreferrer"
|
|
className="underline"
|
|
onClick={onProjectTransferDocsClick}
|
|
>
|
|
Transfer
|
|
</a>{' '}
|
|
or delete one to stop its charges.
|
|
</Note>
|
|
|
|
<Note icon={<TrendingUpIcon size={16} />}>
|
|
<span className="text-foreground">Compute stays as it is.</span> Upgrade to Micro in{' '}
|
|
{exampleProjectRef ? (
|
|
<a
|
|
href={getInfrastructurePath(exampleProjectRef)}
|
|
target="_blank"
|
|
rel="noreferrer"
|
|
className="underline"
|
|
>
|
|
Infrastructure settings
|
|
</a>
|
|
) : (
|
|
<span>Infrastructure settings</span>
|
|
)}{' '}
|
|
<span>at the same price, after a short restart.</span>
|
|
</Note>
|
|
|
|
<Note icon={<RefreshCwIcon size={16} />}>
|
|
<span className="text-foreground">Renews monthly</span> until you cancel.
|
|
</Note>
|
|
</ul>
|
|
)
|