Files
bsky-social-app/src/components/Post/Embed/StandardSiteEmbed/utils.ts
T
Samuel Newman 9fe0084874 [SDK] Remove @atproto/api (#11386)
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-08-13 12:26:22 -07:00

39 lines
1.0 KiB
TypeScript

import {AtUri} from '@atproto/syntax'
import {type app, type com} from '#/lexicons'
export function isStandardSiteDocumentUri(
ref: com.atproto.repo.strongRef.Main,
) {
return new AtUri(ref.uri).collection.startsWith('site.standard.document')
}
export function isStandardSitePublicationUri(
ref: com.atproto.repo.strongRef.Main,
) {
return new AtUri(ref.uri).collection.startsWith('site.standard.publication')
}
export function isStandardSiteUri(ref: com.atproto.repo.strongRef.Main) {
return new AtUri(ref.uri).collection.startsWith('site.standard.')
}
export function isStandardSiteEmbed(
view: app.bsky.embed.external.ViewExternal,
) {
return view.associatedRefs?.some(ref => isStandardSiteUri(ref))
}
export function isStandardSitePublicationEmbed(
view: app.bsky.embed.external.ViewExternal,
) {
return (
view.associatedRefs?.some(
ref => new AtUri(ref.uri).collection === 'site.standard.publication',
) &&
view.associatedRefs.every(
ref => new AtUri(ref.uri).collection !== 'site.standard.document',
)
)
}