[APP-2160] Add local PublicationViewExternal types + extend ResolvedExternalLink
This commit is contained in:
committed by
Eric Bailey
parent
feb623520c
commit
ffa58f6cb2
@@ -0,0 +1,42 @@
|
|||||||
|
import {
|
||||||
|
type AppBskyEmbedExternal,
|
||||||
|
type ComAtprotoRepoStrongRef,
|
||||||
|
} from '@atproto/api'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Local extension of `app.bsky.embed.external#viewExternal` that mirrors
|
||||||
|
* atproto PR #4915. Once @atproto/api ships those fields, delete this file
|
||||||
|
* and replace usages with `AppBskyEmbedExternal.ViewExternal` directly.
|
||||||
|
*/
|
||||||
|
export type PublicationViewExternal = AppBskyEmbedExternal.ViewExternal & {
|
||||||
|
createdAt?: string
|
||||||
|
updatedAt?: string
|
||||||
|
readingTime?: number
|
||||||
|
source?: PublicationViewExternalSource
|
||||||
|
associatedRecord?: ComAtprotoRepoStrongRef.Main
|
||||||
|
associatedBskyPost?: ComAtprotoRepoStrongRef.Main
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface PublicationViewExternalSource {
|
||||||
|
$type?: 'app.bsky.embed.external#viewExternalSource'
|
||||||
|
uri?: string
|
||||||
|
icon?: string
|
||||||
|
name?: string
|
||||||
|
description?: string
|
||||||
|
theme?: PublicationViewExternalSourceTheme
|
||||||
|
associatedRecord?: ComAtprotoRepoStrongRef.Main
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface PublicationViewExternalSourceTheme {
|
||||||
|
$type?: 'app.bsky.embed.external#viewExternalSourceTheme'
|
||||||
|
background?: PublicationColorRGB
|
||||||
|
foreground?: PublicationColorRGB
|
||||||
|
accent?: PublicationColorRGB
|
||||||
|
accentForeground?: PublicationColorRGB
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface PublicationColorRGB {
|
||||||
|
r: number
|
||||||
|
g: number
|
||||||
|
b: number
|
||||||
|
}
|
||||||
@@ -26,6 +26,7 @@ import {
|
|||||||
} from '#/lib/strings/url-helpers'
|
} from '#/lib/strings/url-helpers'
|
||||||
import {type ComposerImage} from '#/state/gallery'
|
import {type ComposerImage} from '#/state/gallery'
|
||||||
import {createComposerImage} from '#/state/gallery'
|
import {createComposerImage} from '#/state/gallery'
|
||||||
|
import {type PublicationViewExternalSource} from '#/components/Post/Embed/ExternalEmbed/PublicationEmbed/types'
|
||||||
import {type Gif} from '#/features/gifPicker/types'
|
import {type Gif} from '#/features/gifPicker/types'
|
||||||
import {createGIFDescription} from '../gif-alt-text'
|
import {createGIFDescription} from '../gif-alt-text'
|
||||||
|
|
||||||
@@ -40,6 +41,11 @@ type ResolvedExternalLink = {
|
|||||||
* it exists. Example: a site.standard.document record.
|
* it exists. Example: a site.standard.document record.
|
||||||
*/
|
*/
|
||||||
associatedRecord?: LinkMeta['associatedRecord']
|
associatedRecord?: LinkMeta['associatedRecord']
|
||||||
|
// APP-2160 / APP-2155: populated by Cardyb when the URL resolves to a
|
||||||
|
// standard.site publication. Until APP-2155 ships these stay undefined.
|
||||||
|
source?: PublicationViewExternalSource
|
||||||
|
createdAt?: string
|
||||||
|
readingTime?: number
|
||||||
}
|
}
|
||||||
|
|
||||||
type ResolvedPostRecord = {
|
type ResolvedPostRecord = {
|
||||||
|
|||||||
Reference in New Issue
Block a user