@prismicio/client 7.22.3-pr.477.0e49e3d → 7.22.3-pr.477.5e5ad22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -35,7 +35,7 @@ const require_isRepositoryName = require("./isRepositoryName.cjs");
35
35
  * @returns The URL for the given Prismic repository's Prismic Toolbar script.
36
36
  */
37
37
  const getToolbarSrc = (repositoryName, config) => {
38
- if (require_isRepositoryName.isRepositoryName(repositoryName)) return `https://static.cdn.prismic.io/prismic.js?repo=${repositoryName}${config?.version === 5 ? "&v=5" : ""}`;
38
+ if (require_isRepositoryName.isRepositoryName(repositoryName)) return `https://static.cdn.prismic.io/prismic.js?repo=${repositoryName}${config?.version ? `&v=${config.version}` : ""}`;
39
39
  else throw new require_errors.PrismicError(`An invalid Prismic repository name was given: ${repositoryName}`, void 0, void 0);
40
40
  };
41
41
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"getToolbarSrc.cjs","names":["isRepositoryName","PrismicError"],"sources":["../src/getToolbarSrc.ts"],"sourcesContent":["import { PrismicError } from \"./errors\"\nimport { isRepositoryName } from \"./isRepositoryName\"\n\n/**\n * Returns the URL for a Prismic repository's Prismic Toolbar script. Use the URL to inject the\n * script into your app.\n *\n * @example\n * \t```typescriptreact\n * \t// In Next.js apps, use `next/script` in your `app/layout.tsx` file.\n *\n * \timport Script from \"next/script\";\n * \timport * as prismic from \"@prismicio/client\";\n *\n * \texport default function RootLayout({\n * \tchildren,\n * \t}: {\n * \tchildren: React.ReactNode,\n * \t}) {\n * \tconst toolbarSrc = prismic.getToolbarSrc(\"my-repo\");\n *\n * \treturn (\n * \t<html lang=\"en\">\n * \t<body>{children}</body>\n * \t<Script src={toolbarSrc} />\n * \t</html>\n * \t);\n * \t}\n * \t```\n *\n * @param repositoryName - The name of the Prismic repository. For example, `\"my-repo\"` if the\n * repository URL is `my-repo.prismic.io`.\n * @param config - `version: 5` opts in to Prismic Toolbar v5. Only use it with an integration that\n * stores the preview session in the `cookie.previewSession` cookie. Defaults to v4.\n * @returns The URL for the given Prismic repository's Prismic Toolbar script.\n */\nexport const getToolbarSrc = <TRepositoryName extends string, TVersion extends 4 | 5 = 4>(\n\trepositoryName: TRepositoryName,\n\tconfig?: { version?: TVersion },\n): `https://static.cdn.prismic.io/prismic.js?repo=${TRepositoryName}${TVersion extends 5 ? \"&v=5\" : \"\"}` => {\n\tif (isRepositoryName(repositoryName)) {\n\t\treturn `https://static.cdn.prismic.io/prismic.js?repo=${repositoryName}${config?.version === 5 ? \"&v=5\" : \"\"}` as never\n\t} else {\n\t\tthrow new PrismicError(\n\t\t\t`An invalid Prismic repository name was given: ${repositoryName}`,\n\t\t\tundefined,\n\t\t\tundefined,\n\t\t)\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoCA,MAAa,iBACZ,gBACA,WAC2G;CAC3G,IAAIA,yBAAAA,iBAAiB,cAAc,GAClC,OAAO,iDAAiD,iBAAiB,QAAQ,YAAY,IAAI,SAAS;MAE1G,MAAM,IAAIC,eAAAA,aACT,iDAAiD,kBACjD,KAAA,GACA,KAAA,CACD;AAEF"}
1
+ {"version":3,"file":"getToolbarSrc.cjs","names":["isRepositoryName","PrismicError"],"sources":["../src/getToolbarSrc.ts"],"sourcesContent":["import { PrismicError } from \"./errors\"\nimport { isRepositoryName } from \"./isRepositoryName\"\n\n/**\n * Returns the URL for a Prismic repository's Prismic Toolbar script. Use the URL to inject the\n * script into your app.\n *\n * @example\n * \t```typescriptreact\n * \t// In Next.js apps, use `next/script` in your `app/layout.tsx` file.\n *\n * \timport Script from \"next/script\";\n * \timport * as prismic from \"@prismicio/client\";\n *\n * \texport default function RootLayout({\n * \tchildren,\n * \t}: {\n * \tchildren: React.ReactNode,\n * \t}) {\n * \tconst toolbarSrc = prismic.getToolbarSrc(\"my-repo\");\n *\n * \treturn (\n * \t<html lang=\"en\">\n * \t<body>{children}</body>\n * \t<Script src={toolbarSrc} />\n * \t</html>\n * \t);\n * \t}\n * \t```\n *\n * @param repositoryName - The name of the Prismic repository. For example, `\"my-repo\"` if the\n * repository URL is `my-repo.prismic.io`.\n * @param config - `version: 5` opts in to Prismic Toolbar v5. Only use it with an integration that\n * stores the preview session in the `cookie.previewSession` cookie. Defaults to v4.\n * @returns The URL for the given Prismic repository's Prismic Toolbar script.\n */\nexport const getToolbarSrc = (repositoryName: string, config?: { version?: 4 | 5 }): string => {\n\tif (isRepositoryName(repositoryName)) {\n\t\treturn `https://static.cdn.prismic.io/prismic.js?repo=${repositoryName}${config?.version ? `&v=${config.version}` : \"\"}`\n\t} else {\n\t\tthrow new PrismicError(\n\t\t\t`An invalid Prismic repository name was given: ${repositoryName}`,\n\t\t\tundefined,\n\t\t\tundefined,\n\t\t)\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoCA,MAAa,iBAAiB,gBAAwB,WAAyC;CAC9F,IAAIA,yBAAAA,iBAAiB,cAAc,GAClC,OAAO,iDAAiD,iBAAiB,QAAQ,UAAU,MAAM,OAAO,YAAY;MAEpH,MAAM,IAAIC,eAAAA,aACT,iDAAiD,kBACjD,KAAA,GACA,KAAA,CACD;AAEF"}
@@ -32,8 +32,8 @@
32
32
  * stores the preview session in the `cookie.previewSession` cookie. Defaults to v4.
33
33
  * @returns The URL for the given Prismic repository's Prismic Toolbar script.
34
34
  */
35
- export declare const getToolbarSrc: <TRepositoryName extends string, TVersion extends 4 | 5 = 4>(repositoryName: TRepositoryName, config?: {
36
- version?: TVersion;
37
- }) => `https://static.cdn.prismic.io/prismic.js?repo=${TRepositoryName}${TVersion extends 5 ? "&v=5" : ""}`;
35
+ export declare const getToolbarSrc: (repositoryName: string, config?: {
36
+ version?: 4 | 5;
37
+ }) => string;
38
38
  //#endregion
39
39
  //# sourceMappingURL=getToolbarSrc.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"getToolbarSrc.d.cts","names":[],"sources":["../src/getToolbarSrc.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBAoCa,gBAAiB,gCAAgC,4BAA0B,gBACvE,iBAAe;EACpB,UAAU;uDAC8B,kBAAkB"}
1
+ {"version":3,"file":"getToolbarSrc.d.cts","names":[],"sources":["../src/getToolbarSrc.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBAoCa,gBAAa,wBAA0B;EAAa"}
@@ -32,8 +32,8 @@
32
32
  * stores the preview session in the `cookie.previewSession` cookie. Defaults to v4.
33
33
  * @returns The URL for the given Prismic repository's Prismic Toolbar script.
34
34
  */
35
- export declare const getToolbarSrc: <TRepositoryName extends string, TVersion extends 4 | 5 = 4>(repositoryName: TRepositoryName, config?: {
36
- version?: TVersion;
37
- }) => `https://static.cdn.prismic.io/prismic.js?repo=${TRepositoryName}${TVersion extends 5 ? "&v=5" : ""}`;
35
+ export declare const getToolbarSrc: (repositoryName: string, config?: {
36
+ version?: 4 | 5;
37
+ }) => string;
38
38
  //#endregion
39
39
  //# sourceMappingURL=getToolbarSrc.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"getToolbarSrc.d.ts","names":[],"sources":["../src/getToolbarSrc.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBAoCa,gBAAiB,gCAAgC,4BAA0B,gBACvE,iBAAe;EACpB,UAAU;uDAC8B,kBAAkB"}
1
+ {"version":3,"file":"getToolbarSrc.d.ts","names":[],"sources":["../src/getToolbarSrc.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBAoCa,gBAAa,wBAA0B;EAAa"}
@@ -35,7 +35,7 @@ import { isRepositoryName } from "./isRepositoryName.js";
35
35
  * @returns The URL for the given Prismic repository's Prismic Toolbar script.
36
36
  */
37
37
  const getToolbarSrc = (repositoryName, config) => {
38
- if (isRepositoryName(repositoryName)) return `https://static.cdn.prismic.io/prismic.js?repo=${repositoryName}${config?.version === 5 ? "&v=5" : ""}`;
38
+ if (isRepositoryName(repositoryName)) return `https://static.cdn.prismic.io/prismic.js?repo=${repositoryName}${config?.version ? `&v=${config.version}` : ""}`;
39
39
  else throw new PrismicError(`An invalid Prismic repository name was given: ${repositoryName}`, void 0, void 0);
40
40
  };
41
41
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"getToolbarSrc.js","names":[],"sources":["../src/getToolbarSrc.ts"],"sourcesContent":["import { PrismicError } from \"./errors\"\nimport { isRepositoryName } from \"./isRepositoryName\"\n\n/**\n * Returns the URL for a Prismic repository's Prismic Toolbar script. Use the URL to inject the\n * script into your app.\n *\n * @example\n * \t```typescriptreact\n * \t// In Next.js apps, use `next/script` in your `app/layout.tsx` file.\n *\n * \timport Script from \"next/script\";\n * \timport * as prismic from \"@prismicio/client\";\n *\n * \texport default function RootLayout({\n * \tchildren,\n * \t}: {\n * \tchildren: React.ReactNode,\n * \t}) {\n * \tconst toolbarSrc = prismic.getToolbarSrc(\"my-repo\");\n *\n * \treturn (\n * \t<html lang=\"en\">\n * \t<body>{children}</body>\n * \t<Script src={toolbarSrc} />\n * \t</html>\n * \t);\n * \t}\n * \t```\n *\n * @param repositoryName - The name of the Prismic repository. For example, `\"my-repo\"` if the\n * repository URL is `my-repo.prismic.io`.\n * @param config - `version: 5` opts in to Prismic Toolbar v5. Only use it with an integration that\n * stores the preview session in the `cookie.previewSession` cookie. Defaults to v4.\n * @returns The URL for the given Prismic repository's Prismic Toolbar script.\n */\nexport const getToolbarSrc = <TRepositoryName extends string, TVersion extends 4 | 5 = 4>(\n\trepositoryName: TRepositoryName,\n\tconfig?: { version?: TVersion },\n): `https://static.cdn.prismic.io/prismic.js?repo=${TRepositoryName}${TVersion extends 5 ? \"&v=5\" : \"\"}` => {\n\tif (isRepositoryName(repositoryName)) {\n\t\treturn `https://static.cdn.prismic.io/prismic.js?repo=${repositoryName}${config?.version === 5 ? \"&v=5\" : \"\"}` as never\n\t} else {\n\t\tthrow new PrismicError(\n\t\t\t`An invalid Prismic repository name was given: ${repositoryName}`,\n\t\t\tundefined,\n\t\t\tundefined,\n\t\t)\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoCA,MAAa,iBACZ,gBACA,WAC2G;CAC3G,IAAI,iBAAiB,cAAc,GAClC,OAAO,iDAAiD,iBAAiB,QAAQ,YAAY,IAAI,SAAS;MAE1G,MAAM,IAAI,aACT,iDAAiD,kBACjD,KAAA,GACA,KAAA,CACD;AAEF"}
1
+ {"version":3,"file":"getToolbarSrc.js","names":[],"sources":["../src/getToolbarSrc.ts"],"sourcesContent":["import { PrismicError } from \"./errors\"\nimport { isRepositoryName } from \"./isRepositoryName\"\n\n/**\n * Returns the URL for a Prismic repository's Prismic Toolbar script. Use the URL to inject the\n * script into your app.\n *\n * @example\n * \t```typescriptreact\n * \t// In Next.js apps, use `next/script` in your `app/layout.tsx` file.\n *\n * \timport Script from \"next/script\";\n * \timport * as prismic from \"@prismicio/client\";\n *\n * \texport default function RootLayout({\n * \tchildren,\n * \t}: {\n * \tchildren: React.ReactNode,\n * \t}) {\n * \tconst toolbarSrc = prismic.getToolbarSrc(\"my-repo\");\n *\n * \treturn (\n * \t<html lang=\"en\">\n * \t<body>{children}</body>\n * \t<Script src={toolbarSrc} />\n * \t</html>\n * \t);\n * \t}\n * \t```\n *\n * @param repositoryName - The name of the Prismic repository. For example, `\"my-repo\"` if the\n * repository URL is `my-repo.prismic.io`.\n * @param config - `version: 5` opts in to Prismic Toolbar v5. Only use it with an integration that\n * stores the preview session in the `cookie.previewSession` cookie. Defaults to v4.\n * @returns The URL for the given Prismic repository's Prismic Toolbar script.\n */\nexport const getToolbarSrc = (repositoryName: string, config?: { version?: 4 | 5 }): string => {\n\tif (isRepositoryName(repositoryName)) {\n\t\treturn `https://static.cdn.prismic.io/prismic.js?repo=${repositoryName}${config?.version ? `&v=${config.version}` : \"\"}`\n\t} else {\n\t\tthrow new PrismicError(\n\t\t\t`An invalid Prismic repository name was given: ${repositoryName}`,\n\t\t\tundefined,\n\t\t\tundefined,\n\t\t)\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoCA,MAAa,iBAAiB,gBAAwB,WAAyC;CAC9F,IAAI,iBAAiB,cAAc,GAClC,OAAO,iDAAiD,iBAAiB,QAAQ,UAAU,MAAM,OAAO,YAAY;MAEpH,MAAM,IAAI,aACT,iDAAiD,kBACjD,KAAA,GACA,KAAA,CACD;AAEF"}
package/dist/package.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  //#region package.json
2
2
  var name = "@prismicio/client";
3
- var version = "7.22.3-pr.477.0e49e3d";
3
+ var version = "7.22.3-pr.477.5e5ad22";
4
4
  //#endregion
5
5
  Object.defineProperty(exports, "name", {
6
6
  enumerable: true,
package/dist/package.js CHANGED
@@ -1,6 +1,6 @@
1
1
  //#region package.json
2
2
  var name = "@prismicio/client";
3
- var version = "7.22.3-pr.477.0e49e3d";
3
+ var version = "7.22.3-pr.477.5e5ad22";
4
4
  //#endregion
5
5
  export { name, version };
6
6
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prismicio/client",
3
- "version": "7.22.3-pr.477.0e49e3d",
3
+ "version": "7.22.3-pr.477.5e5ad22",
4
4
  "description": "The official JavaScript + TypeScript client library for Prismic",
5
5
  "keywords": [
6
6
  "client",
@@ -34,12 +34,9 @@ import { isRepositoryName } from "./isRepositoryName"
34
34
  * stores the preview session in the `cookie.previewSession` cookie. Defaults to v4.
35
35
  * @returns The URL for the given Prismic repository's Prismic Toolbar script.
36
36
  */
37
- export const getToolbarSrc = <TRepositoryName extends string, TVersion extends 4 | 5 = 4>(
38
- repositoryName: TRepositoryName,
39
- config?: { version?: TVersion },
40
- ): `https://static.cdn.prismic.io/prismic.js?repo=${TRepositoryName}${TVersion extends 5 ? "&v=5" : ""}` => {
37
+ export const getToolbarSrc = (repositoryName: string, config?: { version?: 4 | 5 }): string => {
41
38
  if (isRepositoryName(repositoryName)) {
42
- return `https://static.cdn.prismic.io/prismic.js?repo=${repositoryName}${config?.version === 5 ? "&v=5" : ""}` as never
39
+ return `https://static.cdn.prismic.io/prismic.js?repo=${repositoryName}${config?.version ? `&v=${config.version}` : ""}`
43
40
  } else {
44
41
  throw new PrismicError(
45
42
  `An invalid Prismic repository name was given: ${repositoryName}`,