/** * The branch user's walkthrough, mounted in the Store user shell. * * Three steps, not seven, and honestly so — a counter user cannot open outlets, * hire anybody or edit the business, so walking them through those would be * showing somebody work they are not allowed to do. * * Nothing is offered until they have a branch. An unassigned account already * meets the "No store assigned" screen, which is the whole of what they can act * on; a walkthrough on top of it would be a second thing to read and no second * thing to do. */ import { useMemo } from 'react'; import { useAuth } from '@/auth/AuthContext'; import { useBranchScope } from '@/features/store-admin/BranchScope'; import { useLocationProducts } from '@/queries/hooks'; import { storeUserSteps } from './storeUserSteps'; import { SetupTour } from './SetupTour'; export function StoreUserTour() { const { user } = useAuth(); const { current, tenantid } = useBranchScope(); const products = useLocationProducts(tenantid || undefined, current?.locationid, 0); const steps = useMemo( () => storeUserSteps({ user, hasBranch: Boolean(current?.locationid), productCount: (products.data ?? []).length, ...(current?.locationname ? { branchName: current.locationname } : {}), }), [user, current?.locationid, current?.locationname, products.data], ); if (!user?.userid || !tenantid || !current?.locationid) return null; if (products.isLoading) return null; return ( ); }