UNPKG

@pantheon-systems/pcc-react-sdk

Version:
59 lines (52 loc) 2.81 kB
import { QueryHookOptions } from '@apollo/client'; import { useQuery } from '@apollo/client/react/hooks/useQuery.js'; export { useQuery } from '@apollo/client/react/hooks/useQuery.js'; import { ArticleQueryArgs, ArticleSearchArgs, PantheonClient } from '@pantheon-systems/pcc-sdk-core'; export { GQL, PCCConvenienceFunctions, PantheonAPIOptions, PantheonClient, PantheonClientConfig, findTab, flattenDocumentTabs, getAllTags, getArticle, getArticleBySlugOrId, getArticlePathComponentsFromContentStructure, getArticleURLFromSite, getArticleURLFromSiteWithOptions, getArticles, getPaginatedArticles, getRecommendedArticles, getSite, updateConfig } from '@pantheon-systems/pcc-sdk-core'; import { Article, ArticleWithoutContent, PaginatedArticle } from '@pantheon-systems/pcc-sdk-core/types'; export * from '@pantheon-systems/pcc-sdk-core/types'; import * as React from 'react'; import { PropsWithChildren } from 'react'; export { useMutation } from '@apollo/client/react/hooks/useMutation.js'; export { useSubscription } from '@apollo/client/react/hooks/useSubscription.js'; export { PantheonAPI } from './server/index.mjs'; import * as react_jsx_runtime from 'react/jsx-runtime'; import 'next'; import 'next/server'; type Return$1 = ReturnType<typeof useQuery<{ article: Article; }>> & { article: Article | undefined; }; type ApolloQueryOptions$1 = Omit<QueryHookOptions<{ article: Article; }>, "variables">; declare const useArticle: (id: string, args?: ArticleQueryArgs, apolloQueryOptions?: ApolloQueryOptions$1, related?: { site?: boolean; }) => Return$1; type ListArticlesResponse = { articles: ArticleWithoutContent[]; }; type Return = ReturnType<typeof useQuery<ListArticlesResponse>> & { articles: ArticleWithoutContent[] | undefined; }; type ApolloQueryOptions = Omit<QueryHookOptions<ListArticlesResponse>, "variables">; declare const useArticles: (args?: ArticleQueryArgs, searchParams?: ArticleSearchArgs, apolloQueryOptions?: ApolloQueryOptions) => Return; interface Props { cursor?: string; pageSize: number; initialArticles?: PaginatedArticle[] | ArticleWithoutContent[]; } declare function usePagination({ cursor, initialArticles, pageSize }: Props): { data: ArticleWithoutContent[] | PaginatedArticle[]; fetching: boolean; onPageChange: React.Dispatch<React.SetStateAction<number>>; currentPage: number; }; interface PantheonProviderProps extends PropsWithChildren<object> { client: PantheonClient; } declare const PantheonProvider: ({ client, children, }: PantheonProviderProps) => react_jsx_runtime.JSX.Element; declare const usePantheonClient: () => PantheonClient; declare const markdownToText: (markdown: string) => string; export { PantheonProvider, markdownToText, useArticle, useArticles, usePagination, usePantheonClient };