@prismicio/client
Version:
The official JavaScript + TypeScript client library for Prismic
38 lines • 1.14 kB
text/typescript
//#region src/getToolbarSrc.d.ts
/**
* Returns the URL for a Prismic repository's Prismic Toolbar script. Use the
* URL to inject the script into your app.
*
* @example
*
* ```typescriptreact
* // In Next.js apps, use `next/script` in your `app/layout.tsx` file.
*
* import Script from "next/script";
* import * as prismic from "@prismicio/client";
*
* export default function RootLayout({
* children,
* }: {
* children: React.ReactNode,
* }) {
* const toolbarSrc = prismic.getToolbarSrc("my-repo");
*
* return (
* <html lang="en">
* <body>{children}</body>
* <Script src={toolbarSrc} />
* </html>
* );
* }
* ```
*
* @param repositoryName - The name of the Prismic repository. For example,
* `"my-repo"` if the repository URL is `my-repo.prismic.io`.
*
* @returns The URL for the given Prismic repository's Prismic Toolbar script.
*/
declare const getToolbarSrc: <TRepositoryName extends string>(repositoryName: TRepositoryName) => `https://static.cdn.prismic.io/prismic.js?new=true&repo=${TRepositoryName}`;
//#endregion
export { getToolbarSrc };
//# sourceMappingURL=getToolbarSrc.d.cts.map