Options
All
  • Public
  • Public/Protected
  • All
Menu

next-tinacms-contentful

Index

Classes

Interfaces

Type aliases

Variables

Functions

Type aliases

ClientMode

ClientMode: "delivery" | "preview" | "management"

ContentfulEntriesFormOptions

ContentfulEntriesFormOptions: ContentfulEntryFormOptions

ContentfulMultiClient

ContentfulMultiClient: Pick<ContentfulClient, "authenticate" | "allowedOrigins"> & {}

ContentfulUpload

ContentfulUpload: { fields: { description: string; file: { contentType: string; file: string | ArrayBuffer | any; fileName: string }; title: string } }

Type declaration

  • fields: { description: string; file: { contentType: string; file: string | ArrayBuffer | any; fileName: string }; title: string }
    • description: string
    • file: { contentType: string; file: string | ArrayBuffer | any; fileName: string }
      • contentType: string
      • file: string | ArrayBuffer | any
      • fileName: string
    • title: string

Operation

Operation<Type>: Type extends "dereference" ? BaseOperation<"dereference"> & { fields: undefined } : BaseOperation<Type>

Type parameters

OperationType

OperationType: "create" | "update" | "dereference"

OptionalSpaceOptions

OptionalSpaceOptions: Partial<Omit<CreateClientParams, "accessToken" | "space" | "environment">> & { deliveryClient?: ContentfulClientApi; previewClient?: ContentfulClientApi }

ServerOptions

ServerOptions<BaseOptions>: BaseOptions & Omit<ContentfulClientOptions, "clientId" | "redirectUrl"> & SpaceOptions

Type parameters

  • BaseOptions = any

Space

deprecated

Renamed to SpaceOptions. This type will be removed in v1.0.0.

getEntriesOptions

getEntriesOptions<Mode>: Omit<getEntryOptions<Mode>, "query">

Type parameters

getEntryOptions

getEntryOptions<Mode>: { locale?: string; mode?: Mode; preview?: boolean; query?: any }

Type parameters

Type declaration

  • Optional locale?: string
  • Optional mode?: Mode
  • Optional preview?: boolean
    deprecated

    Use mode instead. Will be removed in 1.0.0

  • Optional query?: any

getServerSideEntriesOptions

getServerSideEntriesOptions<Mode>: ServerOptions<getEntriesOptions<Mode>> & { accessTokens: { management?: string } }

Type parameters

getServerSideEntryOptions

getServerSideEntryOptions<Mode>: ServerOptions<getEntryOptions<Mode>> & { accessTokens: { management?: string } }

Type parameters

Variables

Const AUTH_FAILURE

AUTH_FAILURE: "contentful:auth:failure" = "contentful:auth:failure"

Const AUTH_SUCCESS

AUTH_SUCCESS: "contentful:auth:success" = "contentful:auth:success"

Const CHANGE_ENVIRONMENT

CHANGE_ENVIRONMENT: "contentful:environment:change" = "contentful:environment:change"

Const CONTENTFUL_AUTH_HOSTNAME

CONTENTFUL_AUTH_HOSTNAME: "be.contentful.com" = "be.contentful.com"

Const CONTENTFUL_AUTH_TOKEN

CONTENTFUL_AUTH_TOKEN: "TINACMS_CONTENTFUL_USER_AUTH_TOKEN" = "TINACMS_CONTENTFUL_USER_AUTH_TOKEN"

Const CREATE_ENVIRONMENT

CREATE_ENVIRONMENT: "contentful:environment:create" = "contentful:environment:create"

Const CustomPaginatorPlugin

CustomPaginatorPlugin: MediaPaginatorPlugin

Const ENTRY_DELETE

ENTRY_DELETE: "contentful:entry:delete" = "contentful:entry:delete"

Const ENTRY_PUBLISH

ENTRY_PUBLISH: "contentful:entry:publish" = "contentful:entry:publish"

Const ENTRY_UPDATE

ENTRY_UPDATE: "contentful:entry:update" = "contentful:entry:update"

Const ERROR

ERROR: "contentful:error" = "contentful:error"

Const FILE_TYPES

FILE_TYPES: FileTypes

Const MediaArchiveAction

MediaArchiveAction: { action: typeof MediaArchiveActionButton; type: string }

Type declaration

Const MediaFilterAction

MediaFilterAction: { action: typeof MediaFilterActionButton; type: string }

Type declaration

Const MediaFilterScreenPlugin

MediaFilterScreenPlugin: ScreenPlugin

Const ON_LOGIN

ON_LOGIN: "contentful:login" = "contentful:login"

Const ON_LOGOUT

ON_LOGOUT: "contentful:logout" = "contentful:logout"

Functions

Const AsyncAction

  • Parameters

    Returns Element

MediaArchiveActionButton

  • Parameters

    Returns JSX.Element

MediaFilter

  • MediaFilter(): JSX.Element
  • Returns JSX.Element

MediaFilterActionButton

  • MediaFilterActionButton(): JSX.Element
  • Returns JSX.Element

MediaManagerFilterModal

  • Parameters

    Returns JSX.Element

Paginator

  • Paginator(__namedParameters: MediaPaginatorProps): JSX.Element | null
  • A custom media paginator designed to handle hundreds of pages of Contentful Assets

    Parameters

    • __namedParameters: MediaPaginatorProps

    Returns JSX.Element | null

Const TinaContentfulProvider

  • A provider for managing the Oauth authentication UI workflow for Contentful

    Parameters

    Returns Element

authenticateWithContentful

  • authenticateWithContentful(clientId: string, redirectUrl: string, allowedOrigins: string[], authWindow?: Window): Promise<string>
  • Parameters

    • clientId: string
    • redirectUrl: string
    • allowedOrigins: string[]
    • Optional authWindow: Window

    Returns Promise<string>

createContentfulClientForSpaces

Const createContentfulOperationsForEntries

  • createContentfulOperationsForEntries(initial: Entry<any>[], updated: Entry<any>[], parent?: null | Entry<any>, options?: GraphOptions): { create: BaseOperation<"create">[]; dereference: (Entry<unknown> & { type: "dereference" } & { fields: undefined })[]; graph: OperationsGraph; update: BaseOperation<"update">[] }
  • Takes an initial and updated state of an array of entries, and computes a graph of the changes:

    • nodes: the individual operations to run to update the delta
    • edges: the relationships between operations, allowing different traversal paths

    Parameters

    • initial: Entry<any>[]

      The initial state of the entry

    • updated: Entry<any>[]

      The updated state of the entry

    • Optional parent: null | Entry<any>
    • Optional options: GraphOptions

    Returns { create: BaseOperation<"create">[]; dereference: (Entry<unknown> & { type: "dereference" } & { fields: undefined })[]; graph: OperationsGraph; update: BaseOperation<"update">[] }

    operations and the graph

    • create: BaseOperation<"create">[]
    • dereference: (Entry<unknown> & { type: "dereference" } & { fields: undefined })[]
    • graph: OperationsGraph
    • update: BaseOperation<"update">[]

Const createContentfulOperationsForEntry

  • createContentfulOperationsForEntry(initial: null | Entry<any>, updated: null | Entry<any>, options?: GraphOptions): { create: BaseOperation<"create">[]; dereference: (Entry<unknown> & { type: "dereference" } & { fields: undefined })[]; graph: OperationsGraph; update: BaseOperation<"update">[] }
  • Takes an initial and updated state of an entry, and computes a graph of the changes:

    • nodes: the individual operations to run to update the delta
    • edges: the relationships between operations, allowing different traversal paths

    Parameters

    • initial: null | Entry<any>

      The initial state of the entry

    • updated: null | Entry<any>

      The updated state of the entry

    • Optional options: GraphOptions

    Returns { create: BaseOperation<"create">[]; dereference: (Entry<unknown> & { type: "dereference" } & { fields: undefined })[]; graph: OperationsGraph; update: BaseOperation<"update">[] }

    operations and the graph

    • create: BaseOperation<"create">[]
    • dereference: (Entry<unknown> & { type: "dereference" } & { fields: undefined })[]
    • graph: OperationsGraph
    • update: BaseOperation<"update">[]

createFieldConfigFromContentType

  • createFieldConfigFromContentType(contentType: ContentType): TinaField<any>[]
  • Converts a Contentful Content Type to a TinaCMS Fields Array

    Parameters

    • contentType: ContentType

      The content type to convert

    Returns TinaField<any>[]

    An array of TinaCMS fields

Const editModeHandler

  • editModeHandler(expires?: number): (req: NextApiRequest, res: NextApiResponse<any>) => void
  • Parameters

    • Optional expires: number

    Returns (req: NextApiRequest, res: NextApiResponse<any>) => void

      • (req: NextApiRequest, res: NextApiResponse<any>): void
      • Parameters

        • req: NextApiRequest
        • res: NextApiResponse<any>

        Returns void

Const getAsset

  • getAsset(assetId: string, options: any): Promise<Asset>

Const getAssets

  • getAssets(query: any, options: any): Promise<Asset[]>

getBearerToken

  • getBearerToken(window: Window, allowedOrigins?: string[]): void
  • Parameters

    • window: Window
    • Optional allowedOrigins: string[]

    Returns void

Const getBearerTokenFromContext

  • getBearerTokenFromContext(context: NextApiRequest): any

getCachedBearerToken

  • getCachedBearerToken(): string | undefined
  • Returns string | undefined

Const getEntries

  • getEntries<EntryShape, Mode>(query?: any, options?: Pick<getServerSideEntriesOptions<"delivery">, "insecure" | "preview" | "locale" | "mode" | "allowedOrigins" | "rateLimit" | "spaceId" | "defaultEnvironmentId" | "accessTokens" | "options">): Promise<Entry<EntryShape>[]>
  • getEntries<EntryShape, Mode>(query?: any, options?: Pick<getServerSideEntriesOptions<"management">, "insecure" | "preview" | "locale" | "mode" | "allowedOrigins" | "rateLimit" | "spaceId" | "defaultEnvironmentId" | "accessTokens" | "options">): Promise<Entry[]>
  • getEntries<EntryShape, Mode>(query?: any, options?: Pick<getServerSideEntriesOptions<Mode>, "insecure" | "preview" | "locale" | "mode" | "allowedOrigins" | "rateLimit" | "spaceId" | "defaultEnvironmentId" | "accessTokens" | "options">): Promise<Entry<EntryShape>[]>
  • Type parameters

    • EntryShape: unknown

    • Mode = unknown

    Parameters

    • Optional query: any
    • Optional options: Pick<getServerSideEntriesOptions<"delivery">, "insecure" | "preview" | "locale" | "mode" | "allowedOrigins" | "rateLimit" | "spaceId" | "defaultEnvironmentId" | "accessTokens" | "options">

    Returns Promise<Entry<EntryShape>[]>

  • Type parameters

    • EntryShape: unknown

    • Mode = "management"

    Parameters

    • Optional query: any
    • Optional options: Pick<getServerSideEntriesOptions<"management">, "insecure" | "preview" | "locale" | "mode" | "allowedOrigins" | "rateLimit" | "spaceId" | "defaultEnvironmentId" | "accessTokens" | "options">

    Returns Promise<Entry[]>

  • Type parameters

    • EntryShape: unknown

    • Mode: "delivery" | "preview"

    Parameters

    • Optional query: any
    • Optional options: Pick<getServerSideEntriesOptions<Mode>, "insecure" | "preview" | "locale" | "mode" | "allowedOrigins" | "rateLimit" | "spaceId" | "defaultEnvironmentId" | "accessTokens" | "options">

    Returns Promise<Entry<EntryShape>[]>

Const getEntry

getSpaceIdFromReq

  • getSpaceIdFromReq(req: NextApiRequest): null | string

onBearerToken

  • onBearerToken(allowedOrigins?: string[]): Promise<string>
  • Parameters

    • Optional allowedOrigins: string[]

    Returns Promise<string>

openOauthWindow

  • openOauthWindow(clientId: string, redirectUrl: string): Window
  • Parameters

    • clientId: string
    • redirectUrl: string

    Returns Window

proxy

  • proxy(options: ProxyOptions): <ResponseShape>(req: NextApiRequest, res: NextApiResponse<any>) => Promise<ResponseShape | NextApiResponse<any>>
  • Forwards requests along to Contentful, but provides access to server-side tokens and Next.js's preview data.

    Uses access tokens in this order:

    • Uses delivery, preview token provided, otherwise the one sent in the client-side request headers
    • Uses management stored in preview data, otherwise provided, otherwise the one sent in the client-side request headers

    Parameters

    • options: ProxyOptions

    Returns <ResponseShape>(req: NextApiRequest, res: NextApiResponse<any>) => Promise<ResponseShape | NextApiResponse<any>>

      • <ResponseShape>(req: NextApiRequest, res: NextApiResponse<any>): Promise<ResponseShape | NextApiResponse<any>>
      • Type parameters

        • ResponseShape: unknown

        Parameters

        • req: NextApiRequest
        • res: NextApiResponse<any>

        Returns Promise<ResponseShape | NextApiResponse<any>>

setCachedBearerToken

  • setCachedBearerToken(bearerToken: string, secure?: boolean): void
  • Parameters

    • bearerToken: string
    • Optional secure: boolean

    Returns void

toggleEditing

  • toggleEditing(enable: boolean, options?: { url?: string }): Promise<void>

useContentful

  • Retrieves the ContentfulClient from the CMS

    Parameters

    • Optional spaceId: string

      When using multiple spaces, specify the space you need the client for (Optional)

    Returns ContentfulClient

useContentfulAuthRedirect

  • useContentfulAuthRedirect(): void
  • Retreives the OAuth Bearer Token from the page used as the OAuth App's callback URL

    Returns void

useContentfulDelivery

  • useContentfulDelivery(spaceId?: string): ContentfulClientApi
  • Retrieves the Contentful Delivery SDK from the CMS

    Parameters

    • Optional spaceId: string

      When using multiple spaces, specify the space you need the client for (Optional)

    Returns ContentfulClientApi

useContentfulEntries

  • useContentfulEntries<TEntryType>(query: any, options?: useContentfulEntriesOptions): [Entry<TEntryType>[], boolean, Error | undefined]
  • Fetches an array of Contentful Entries for a given query

    Type parameters

    • TEntryType = any

    Parameters

    Returns [Entry<TEntryType>[], boolean, Error | undefined]

useContentfulEntriesForm

  • useContentfulEntriesForm<EntryShape>(entries: Entry<EntryShape>[], options: ContentfulEntriesFormOptions, watch?: Partial<WatchableFormValue>): [Entry<EntryShape>[], Form]
  • Creates a TinaCMS Form for an array of entries

    Type parameters

    • EntryShape: Record<string, any> = any

    Parameters

    • entries: Entry<EntryShape>[]
    • options: ContentfulEntriesFormOptions
    • Optional watch: Partial<WatchableFormValue>

      The TinaCMS form values to watch for changes and update the form with

    Returns [Entry<EntryShape>[], Form]

useContentfulEntry

  • useContentfulEntry<TEntryType>(entryId: string, options?: useContentfulEntryOptions): [Entry<TEntryType> | undefined, boolean, Error | undefined]
  • Fetches a Contentful Entry by ID

    Type parameters

    • TEntryType: Entry<any, TEntryType>

    Parameters

    Returns [Entry<TEntryType> | undefined, boolean, Error | undefined]

useContentfulEntryForm

  • Creates a TinaCMS Form for a given Entry

    Type parameters

    • EntryShape: Record<string, any> = any

    Parameters

    • entry: Entry<EntryShape>

      The entry to edit

    • options: ContentfulEntryFormOptions
    • Optional watch: Partial<WatchableFormValue>

      The TinaCMS form values to watch for changes and update the form with

    Returns [Entry<EntryShape>, Form, EntryStatus]

useContentfulManagement

  • useContentfulManagement(spaceId?: string): ClientAPI | undefined
  • Retrieves the Contentful Management SDK from the CMS

    Parameters

    • Optional spaceId: string

      When using multiple spaces, specify the space you need the client for (Optional)

    Returns ClientAPI | undefined

useContentfulPreview

  • useContentfulPreview(spaceId?: string): ContentfulClientApi
  • Retrieves the Contentful Preview SDK from the CMS

    Parameters

    • Optional spaceId: string

      When using multiple spaces, specify the space you need the client for (Optional)

    Returns ContentfulClientApi

Const useMediaFilterScreenPlugin

  • useMediaFilterScreenPlugin(): void
  • Returns void

Generated using TypeDoc