feat(appshell): integrate @abe-kap/appshell-sdk (strangler, mock fallback)

Wire the AppShell SDK for auth/identity across the CRM, gated behind
isShellConfigured() so the existing mock portal + static demo user stay
the fallback until the Shell BFF is configured.

- providers.tsx: app-wide <AppShellProvider> (auth passed only when Supabase env set)
- next.config.ts: transpilePackages + /shell -> BFF rewrite (keeps /api/geo intact)
- login: password -> login(), social -> loginWithOAuth(), OAuth return -> completeOAuthLogin()
- register: email/password sign-ups call register() on finish
- dashboard: AuthGate bounces unauthenticated visitors; topbar shows ACE identity
- docs/APPSHELL_INTEGRATION.md, .env.local.example, .npmrc for GitHub Packages
This commit is contained in:
tanweer919
2026-07-09 20:51:17 +05:30
parent 9675bf014d
commit 1d37593102
13 changed files with 253 additions and 16 deletions
+6 -1
View File
@@ -1,5 +1,10 @@
import { Dashboard } from "@/components/dashboard/dashboard";
import { AuthGate } from "@/components/dashboard/auth-gate";
export default function DashboardPage() {
return <Dashboard />;
return (
<AuthGate>
<Dashboard />
</AuthGate>
);
}
+4 -1
View File
@@ -1,6 +1,7 @@
import type { Metadata } from "next";
import { Geist, Geist_Mono } from "next/font/google";
import { siteConfig } from "@/config/site";
import { Providers } from "./providers";
import "./globals.css";
const geistSans = Geist({
@@ -31,7 +32,9 @@ export default function RootLayout({
lang="en"
className={`${geistSans.variable} ${geistMono.variable} h-full antialiased`}
>
<body className="min-h-full flex flex-col">{children}</body>
<body className="min-h-full flex flex-col">
<Providers>{children}</Providers>
</body>
</html>
);
}
+29
View File
@@ -0,0 +1,29 @@
"use client";
// AppShell runs in the browser (boot, React context), so the provider is a
// Client Component. When Supabase env is NOT configured (no BFF yet) we mount the
// provider WITHOUT `auth` — `useAuth()` still works (returns nulls / status
// "unauthenticated"), and the existing mock portal remains the fallback. Once the
// env is set + the Shell BFF is deployed, real auth flows through appshell-sdk.
import { AppShellProvider } from "@abe-kap/appshell-sdk/react";
import type { AppShellOptions } from "@abe-kap/appshell-sdk";
import type { ReactNode } from "react";
const supabaseUrl = process.env.NEXT_PUBLIC_SUPABASE_URL;
const bffBaseUrl = process.env.NEXT_PUBLIC_BFF_BASE_URL ?? "/shell";
const options: AppShellOptions = supabaseUrl
? {
auth: {
supabaseUrl,
supabaseAnonKey: process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY ?? "",
appId: "crm-web",
},
bffBaseUrl,
}
: { bffBaseUrl };
export function Providers({ children }: { children: ReactNode }) {
return <AppShellProvider options={options}>{children}</AppShellProvider>;
}