Files
Darkhorse7starsandGitHub ff026c9ad6 sign-in: straight on to where it was headed; /onboarding is not shown (#102)
After signup the reader was sent through /onboarding, which could forward on
to pay's plans. The owner's call (2026-10-29): don't show it, keep its files.

- lib/auth/arrive: a finished sign-in goes to where it was headed. A checkout
  asked for (`?next=/pay…`) opens as asked, billed to the organization worked
  in, with the campaign on pay's plans and card step.
- The callback and a signed-in /login or /signup use it, in place of
  @hanzo/app `picker`.
- /onboarding only forwards to its `next` (or `/`), keeping a coupon link's
  code in the tab. components/onboarding/flow.tsx is kept, unrendered.
- Gates: arrive.spec holds the forwarding. onboarding.spec, coupon.spec and
  the sale and focus tests that pass the drawn page are skipped until it
  returns; /pricing signed in is the checkout itself.

Dropped with the page: terms acceptance for a provider-made (Google/GitHub)
account, an offer link opening the plans, Free from /pricing recorded on the
account, and a tab's kept coupon added to a checkout that names none.
2026-10-29 07:31:29 -04:00

43 lines
1.5 KiB
TypeScript

'use client'
/**
* /onboarding is not shown (owner, 2026-10-29). Nothing sends a sign-in here
* any more (lib/auth/arrive); an address that still names it — an old link, a
* coupon link, a bookmark — goes straight on to its `?next=`, or the landing,
* and the coupon it carries is kept in the tab for the plans it is used on.
* The flow that was drawn here is kept, unrendered, for later
* (components/onboarding/flow.tsx).
*/
import { Suspense, useEffect } from 'react'
import { useRouter, useSearchParams } from 'next/navigation'
import { useI18n } from '@hanzo/i18n/react'
import { PICKER, safe } from '@hanzo/app/lib/destination'
import { Wait } from '@/components/shell/focus'
import { arrive } from '@/lib/auth/arrive'
import { clean, keep } from '@/lib/coupon'
/** On to `next`, never back here: an address that resolves to this page is the landing. */
function Forward() {
const router = useRouter()
const query = useSearchParams()
useEffect(() => {
const asked = clean(query.get('coupon'))
if (asked) keep(asked)
const to = safe(query.get('next'), '/')
const path = new URL(to, 'https://hanzo.invalid').pathname.replace(/\/+$/, '')
arrive(path === PICKER ? '/' : to, (next) => router.replace(next))
}, [query, router])
return null
}
export default function OnboardingPage() {
const { t } = useI18n()
return (
<Suspense fallback={<Wait title={t('One moment')} />}>
<Wait title={t('One moment')} />
<Forward />
</Suspense>
)
}