@@ -13,6 +13,7 @@ import {
1313 sendBusinessTestSmsAction ,
1414 setBusinessProvisioningStatusAction ,
1515} from '@/app/admin/actions' ;
16+ import { buildAdminCustomerOpenHref } from '@/lib/admin-customer-paths' ;
1617import {
1718 buildAdminOnboardingConfidence ,
1819 canDeleteTestBusiness ,
@@ -180,9 +181,9 @@ function getOperatorEventDetails(value: unknown) {
180181
181182function buildOperatorEventRelatedHref ( businessId : string , relatedEntityType : string | null , relatedEntityId : string | null ) {
182183 if ( ! relatedEntityType || ! relatedEntityId ) return null ;
183- if ( relatedEntityType === 'lead' ) return `/admin/ ${ businessId } /workspace#recent-leads` ;
184+ if ( relatedEntityType === 'lead' ) return buildAdminCustomerOpenHref ( businessId , `/app/leads/ ${ relatedEntityId } ` ) ;
184185 if ( relatedEntityType === 'message' ) return `/admin/${ businessId } /workspace#recent-activity` ;
185- if ( relatedEntityType === 'call' ) return `/admin/ ${ businessId } /workspace# call-flow-snapshot` ;
186+ if ( relatedEntityType === 'call' ) return buildAdminCustomerOpenHref ( businessId , '/app/ call-flow' ) ;
186187 return null ;
187188}
188189
@@ -495,12 +496,15 @@ export default async function AdminBusinessDetailPage({
495496 </ p >
496497 </ div >
497498 < div className = "flex flex-wrap gap-2" >
498- < Link className = { buttonVariants ( { variant : 'default' } ) } href = { `/admin/ ${ business . id } /workspace` } >
499+ < Link className = { buttonVariants ( { variant : 'default' } ) } href = { buildAdminCustomerOpenHref ( business . id , '/app' ) } >
499500 Open customer workspace
500501 </ Link >
501- < Link className = { buttonVariants ( { variant : 'outline' } ) } href = { `/admin/ ${ business . id } /workspace#recent- leads` } >
502+ < Link className = { buttonVariants ( { variant : 'outline' } ) } href = { buildAdminCustomerOpenHref ( business . id , '/app/ leads?view=attention' ) } >
502503 Open customer leads
503504 </ Link >
505+ < Link className = { buttonVariants ( { variant : 'outline' } ) } href = { `/admin/${ business . id } /workspace` } >
506+ View support workspace snapshot
507+ </ Link >
504508 < Link className = { buttonVariants ( { variant : 'outline' } ) } href = "/admin" >
505509 Back to board
506510 </ Link >
@@ -670,22 +674,25 @@ export default async function AdminBusinessDetailPage({
670674 < Card className = "bg-card/90" >
671675 < CardHeader >
672676 < CardTitle > Support mode shortcuts</ CardTitle >
673- < CardDescription > Safe customer-side entry points without impersonation or tenant bleed .</ CardDescription >
677+ < CardDescription > Open the real customer pages for this business, or choose the snapshot view when you only need read-only context .</ CardDescription >
674678 </ CardHeader >
675679 < CardContent className = "space-y-4" >
676680 < div className = "grid gap-2" >
677- < Link className = { buttonVariants ( { variant : 'default' , size : 'sm' } ) } href = { `/admin/ ${ business . id } /workspace` } >
681+ < Link className = { buttonVariants ( { variant : 'default' , size : 'sm' } ) } href = { buildAdminCustomerOpenHref ( business . id , '/app' ) } >
678682 Open customer workspace
679683 </ Link >
680- < Link className = { buttonVariants ( { variant : 'outline' , size : 'sm' } ) } href = { `/admin/ ${ business . id } /workspace#recent- leads` } >
684+ < Link className = { buttonVariants ( { variant : 'outline' , size : 'sm' } ) } href = { buildAdminCustomerOpenHref ( business . id , '/app/ leads?view=attention' ) } >
681685 Open customer leads
682686 </ Link >
683- < Link className = { buttonVariants ( { variant : 'outline' , size : 'sm' } ) } href = { `/admin/ ${ business . id } /workspace# settings-snapshot` } >
687+ < Link className = { buttonVariants ( { variant : 'outline' , size : 'sm' } ) } href = { buildAdminCustomerOpenHref ( business . id , '/app/ settings' ) } >
684688 Open customer settings
685689 </ Link >
686- < Link className = { buttonVariants ( { variant : 'outline' , size : 'sm' } ) } href = { `/admin/ ${ business . id } /workspace# call-flow-snapshot` } >
690+ < Link className = { buttonVariants ( { variant : 'outline' , size : 'sm' } ) } href = { buildAdminCustomerOpenHref ( business . id , '/app/ call-flow' ) } >
687691 Open customer call flow
688692 </ Link >
693+ < Link className = { buttonVariants ( { variant : 'ghost' , size : 'sm' } ) } href = { `/admin/${ business . id } /workspace` } >
694+ View support workspace snapshot
695+ </ Link >
689696 </ div >
690697
691698 < form action = { sendBusinessTestSmsAction } className = "rounded-xl border bg-background/80 p-4" >
@@ -711,7 +718,7 @@ export default async function AdminBusinessDetailPage({
711718 </ form >
712719
713720 < div className = "rounded-xl border bg-background/80 p-4 text-sm text-muted-foreground" >
714- Support mode stays read-only. Use it to inspect leads, settings, and call flow quickly without weakening business isolation .
721+ Support workspace snapshots stay read-only. The buttons above open the real customer pages in an admin-scoped customer mode so you can act without impersonation .
715722 </ div >
716723 </ CardContent >
717724 </ Card >
0 commit comments