Setup step 3 asks where you live and shows that country's bank feed (#6)
Saved as BROKE_COUNTRY. US and Canada get Plaid, NZ Akahu, UK and Europe Enable Banking, Australia Basiq, Brazil Belvo. Countries with no feed are told to import a statement after sign-in. Onboarding uses the saved country instead of asking again. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
1e246336a2
commit
b532bb8dd8
8 files changed
+136
-60
No files matched your search
@@ -1,10 +1,11 @@
|
||||
import { redirect } from "next/navigation";
|
||||
import { MoneyProvider } from "@/components/Money";
|
||||
import { Onboarding, type Step } from "@/components/Onboarding";
|
||||
import { countryOf } from "@/lib/countries";
|
||||
import { COUNTRIES, countryOf } from "@/lib/countries";
|
||||
import { getUser, userTz } from "@/lib/data";
|
||||
import { fmtFor } from "@/lib/format";
|
||||
import { addChoices } from "@/lib/providers";
|
||||
import { currentEnv } from "@/lib/setup";
|
||||
|
||||
// First run: the app layout sends new users here until onboarding is done (profile.onboarding, Onboarding.tsx).
|
||||
// No country yet starts at the country picker; otherwise it resumes at the saved step.
|
||||
@@ -14,10 +15,12 @@ export default async function WelcomePage() {
|
||||
const profile = user.user_metadata?.profile ?? {};
|
||||
if (profile.country && (!profile.onboarding || profile.onboarding === "done")) redirect("/");
|
||||
const step = (profile.country ? profile.onboarding : "country") as Step;
|
||||
// Setup step 3 already asked where they live. Onboarding uses that instead of asking again. "Somewhere else" still asks, for the currency.
|
||||
const setupCountry = COUNTRIES.some((c) => c.code === currentEnv().BROKE_COUNTRY) ? currentEnv().BROKE_COUNTRY : undefined;
|
||||
return (
|
||||
<MoneyProvider fmt={{ ...fmtFor(profile), tz }}>
|
||||
<main className="min-h-screen bg-canvas px-4 py-10 md:py-16 flex justify-center">
|
||||
<Onboarding profile={profile} start={step} choices={addChoices(countryOf(profile.country).code)} />
|
||||
<Onboarding profile={profile} start={step} setupCountry={setupCountry} choices={addChoices(countryOf(profile.country ?? setupCountry).code)} />
|
||||
</main>
|
||||
</MoneyProvider>
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user