-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(OUT-1212): show NoPreviewSupport while accessing from CRM preview
- Loading branch information
Showing
3 changed files
with
58 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { Box } from '@mui/material' | ||
import AnnouncementIcon from '@mui/icons-material/Announcement' | ||
|
||
export const NoPreviewSupport = () => { | ||
return ( | ||
<Box | ||
sx={{ | ||
display: 'flex', | ||
alignItems: 'center', | ||
justifyContent: 'center', | ||
height: '100vh', | ||
fontSize: '24px', | ||
}} | ||
> | ||
<Box | ||
sx={{ | ||
display: 'flex', | ||
alignItems: 'center', | ||
gap: '4px', | ||
opacity: '0.8', | ||
}} | ||
> | ||
<Box sx={{ display: 'flex' }}> | ||
<AnnouncementIcon /> | ||
</Box> | ||
<div>CRM preview is currently not supported for Client Home</div>{' '} | ||
</Box> | ||
</Box> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { Token } from '@/types/common' | ||
|
||
export type PreviewMode = 'client' | 'company' | null | ||
|
||
export const getPreviewMode = (tokenPayload: Token): PreviewMode => { | ||
const isClientPreview = tokenPayload.internalUserId && tokenPayload.clientId | ||
// For a company to be alongside IU token, it shouldn't be "default" or undefined | ||
// Older workspaces in Copilot have "default" as companyId, while newer ones have undefined for IUs | ||
const isDefaultCompany = tokenPayload.companyId === 'default' | ||
const isCompanyPreview = | ||
tokenPayload.internalUserId && !isDefaultCompany && !!tokenPayload.companyId | ||
const previewMode: PreviewMode = isClientPreview | ||
? 'client' | ||
: isCompanyPreview | ||
? 'company' | ||
: null | ||
return previewMode | ||
} |