import { createFileRoute, redirect } from '@tanstack/react-router'; import { AuthOrigin } from '@archer/domain'; import { ProfilePage } from '@/features/profile'; import { authenticatedUserStore } from '@/infrastructure/storage/AuthenticatedUserStore'; export const Route = createFileRoute('/_authenticated/dashboard/profile')({ // Shopify-originated users are billed + profile-managed on the Shopify side. // Block only that origin; TWWIM (incl. WordPress merchants who register via // landing) and any future channel retain access. Direct-URL hits bounce back // to the dashboard root so the route isn't a back door around the hidden menu. beforeLoad: () => { const authed = authenticatedUserStore.get(); if (authed?.authOrigin === AuthOrigin.SHOPIFY) { throw redirect({ to: '/dashboard' }); } }, component: ProfilePage, });