@prismicio/client 7.22.3-pr.477.5e5ad22 → 7.22.3-pr.477.689b433

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.
package/dist/cookie.cjs CHANGED
@@ -5,7 +5,7 @@ var cookie_exports = /* @__PURE__ */ require("./_virtual/_rolldown/runtime.cjs")
5
5
  });
6
6
  /** The well-known name of the cookie used to store a Prismic preview session's ref. */
7
7
  const preview = "io.prismic.preview";
8
- /** The well-known name of the cookie used to store a Prismic Toolbar v5 preview session's ID. */
8
+ /** The well-known name of the cookie used to store a Prismic preview session's ID. */
9
9
  const previewSession = "io.prismic.previewSession";
10
10
  //#endregion
11
11
  Object.defineProperty(exports, "cookie_exports", {
@@ -1 +1 @@
1
- {"version":3,"file":"cookie.cjs","names":[],"sources":["../src/cookie.ts"],"sourcesContent":["/** The well-known name of the cookie used to store a Prismic preview session's ref. */\nexport const preview = \"io.prismic.preview\"\n\n/** The well-known name of the cookie used to store a Prismic Toolbar v5 preview session's ID. */\nexport const previewSession = \"io.prismic.previewSession\"\n"],"mappings":";;;;;;AACA,MAAa,UAAU;;AAGvB,MAAa,iBAAiB"}
1
+ {"version":3,"file":"cookie.cjs","names":[],"sources":["../src/cookie.ts"],"sourcesContent":["/** The well-known name of the cookie used to store a Prismic preview session's ref. */\nexport const preview = \"io.prismic.preview\"\n\n/** The well-known name of the cookie used to store a Prismic preview session's ID. */\nexport const previewSession = \"io.prismic.previewSession\"\n"],"mappings":";;;;;;AACA,MAAa,UAAU;;AAGvB,MAAa,iBAAiB"}
package/dist/cookie.d.cts CHANGED
@@ -3,7 +3,7 @@ declare namespace cookie_d_exports {
3
3
  }
4
4
  /** The well-known name of the cookie used to store a Prismic preview session's ref. */
5
5
  export declare const preview = "io.prismic.preview";
6
- /** The well-known name of the cookie used to store a Prismic Toolbar v5 preview session's ID. */
6
+ /** The well-known name of the cookie used to store a Prismic preview session's ID. */
7
7
  export declare const previewSession = "io.prismic.previewSession";
8
8
  //#endregion
9
9
  export { cookie_d_exports };
package/dist/cookie.d.ts CHANGED
@@ -3,7 +3,7 @@ declare namespace cookie_d_exports {
3
3
  }
4
4
  /** The well-known name of the cookie used to store a Prismic preview session's ref. */
5
5
  export declare const preview = "io.prismic.preview";
6
- /** The well-known name of the cookie used to store a Prismic Toolbar v5 preview session's ID. */
6
+ /** The well-known name of the cookie used to store a Prismic preview session's ID. */
7
7
  export declare const previewSession = "io.prismic.previewSession";
8
8
  //#endregion
9
9
  export { cookie_d_exports };
package/dist/cookie.js CHANGED
@@ -6,7 +6,7 @@ var cookie_exports = /* @__PURE__ */ __exportAll({
6
6
  });
7
7
  /** The well-known name of the cookie used to store a Prismic preview session's ref. */
8
8
  const preview = "io.prismic.preview";
9
- /** The well-known name of the cookie used to store a Prismic Toolbar v5 preview session's ID. */
9
+ /** The well-known name of the cookie used to store a Prismic preview session's ID. */
10
10
  const previewSession = "io.prismic.previewSession";
11
11
  //#endregion
12
12
  export { cookie_exports, preview, previewSession };
@@ -1 +1 @@
1
- {"version":3,"file":"cookie.js","names":[],"sources":["../src/cookie.ts"],"sourcesContent":["/** The well-known name of the cookie used to store a Prismic preview session's ref. */\nexport const preview = \"io.prismic.preview\"\n\n/** The well-known name of the cookie used to store a Prismic Toolbar v5 preview session's ID. */\nexport const previewSession = \"io.prismic.previewSession\"\n"],"mappings":";;;;;;;AACA,MAAa,UAAU;;AAGvB,MAAa,iBAAiB"}
1
+ {"version":3,"file":"cookie.js","names":[],"sources":["../src/cookie.ts"],"sourcesContent":["/** The well-known name of the cookie used to store a Prismic preview session's ref. */\nexport const preview = \"io.prismic.preview\"\n\n/** The well-known name of the cookie used to store a Prismic preview session's ID. */\nexport const previewSession = \"io.prismic.previewSession\"\n"],"mappings":";;;;;;;AACA,MAAa,UAAU;;AAGvB,MAAa,iBAAiB"}
@@ -30,12 +30,11 @@ const require_isRepositoryName = require("./isRepositoryName.cjs");
30
30
  *
31
31
  * @param repositoryName - The name of the Prismic repository. For example, `"my-repo"` if the
32
32
  * repository URL is `my-repo.prismic.io`.
33
- * @param config - `version: 5` opts in to Prismic Toolbar v5. Only use it with an integration that
34
- * stores the preview session in the `cookie.previewSession` cookie. Defaults to v4.
33
+ * @param config - Options that configure the toolbar URL.
35
34
  * @returns The URL for the given Prismic repository's Prismic Toolbar script.
36
35
  */
37
36
  const getToolbarSrc = (repositoryName, config) => {
38
- if (require_isRepositoryName.isRepositoryName(repositoryName)) return `https://static.cdn.prismic.io/prismic.js?repo=${repositoryName}${config?.version ? `&v=${config.version}` : ""}`;
37
+ if (require_isRepositoryName.isRepositoryName(repositoryName)) return `${config?.host ?? "https://static.cdn.prismic.io"}/prismic.js?repo=${repositoryName}${config?.version ? `&v=${config.version}` : ""}`;
39
38
  else throw new require_errors.PrismicError(`An invalid Prismic repository name was given: ${repositoryName}`, void 0, void 0);
40
39
  };
41
40
  //#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 = (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"}
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 - Options that configure the toolbar URL.\n * @returns The URL for the given Prismic repository's Prismic Toolbar script.\n */\nexport const getToolbarSrc = (\n\trepositoryName: string,\n\tconfig?: {\n\t\t/** The version of the Prismic Toolbar to load. Defaults to 4. */\n\t\tversion?: 4 | 5\n\t\t/**\n\t\t * The URL the toolbar script is loaded from, without a trailing slash. For example, a toolbar\n\t\t * preview build. Defaults to `https://static.cdn.prismic.io`.\n\t\t */\n\t\thost?: string\n\t},\n): string => {\n\tif (isRepositoryName(repositoryName)) {\n\t\tconst host = config?.host ?? \"https://static.cdn.prismic.io\"\n\n\t\treturn `${host}/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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCA,MAAa,iBACZ,gBACA,WASY;CACZ,IAAIA,yBAAAA,iBAAiB,cAAc,GAGlC,OAAO,GAFM,QAAQ,QAAQ,gCAEd,mBAAmB,iBAAiB,QAAQ,UAAU,MAAM,OAAO,YAAY;MAE9F,MAAM,IAAIC,eAAAA,aACT,iDAAiD,kBACjD,KAAA,GACA,KAAA,CACD;AAEF"}
@@ -28,12 +28,17 @@
28
28
  *
29
29
  * @param repositoryName - The name of the Prismic repository. For example, `"my-repo"` if the
30
30
  * repository URL is `my-repo.prismic.io`.
31
- * @param config - `version: 5` opts in to Prismic Toolbar v5. Only use it with an integration that
32
- * stores the preview session in the `cookie.previewSession` cookie. Defaults to v4.
31
+ * @param config - Options that configure the toolbar URL.
33
32
  * @returns The URL for the given Prismic repository's Prismic Toolbar script.
34
33
  */
35
34
  export declare const getToolbarSrc: (repositoryName: string, config?: {
35
+ /** The version of the Prismic Toolbar to load. Defaults to 4. */
36
36
  version?: 4 | 5;
37
+ /**
38
+ * The URL the toolbar script is loaded from, without a trailing slash. For example, a toolbar
39
+ * preview build. Defaults to `https://static.cdn.prismic.io`.
40
+ */
41
+ host?: string;
37
42
  }) => string;
38
43
  //#endregion
39
44
  //# sourceMappingURL=getToolbarSrc.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"getToolbarSrc.d.cts","names":[],"sources":["../src/getToolbarSrc.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBAoCa,gBAAa,wBAA0B;EAAa"}
1
+ {"version":3,"file":"getToolbarSrc.d.cts","names":[],"sources":["../src/getToolbarSrc.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBAmCa,gBAAa,wBACH;;EAGrB;;;;;EAKA"}
@@ -28,12 +28,17 @@
28
28
  *
29
29
  * @param repositoryName - The name of the Prismic repository. For example, `"my-repo"` if the
30
30
  * repository URL is `my-repo.prismic.io`.
31
- * @param config - `version: 5` opts in to Prismic Toolbar v5. Only use it with an integration that
32
- * stores the preview session in the `cookie.previewSession` cookie. Defaults to v4.
31
+ * @param config - Options that configure the toolbar URL.
33
32
  * @returns The URL for the given Prismic repository's Prismic Toolbar script.
34
33
  */
35
34
  export declare const getToolbarSrc: (repositoryName: string, config?: {
35
+ /** The version of the Prismic Toolbar to load. Defaults to 4. */
36
36
  version?: 4 | 5;
37
+ /**
38
+ * The URL the toolbar script is loaded from, without a trailing slash. For example, a toolbar
39
+ * preview build. Defaults to `https://static.cdn.prismic.io`.
40
+ */
41
+ host?: string;
37
42
  }) => string;
38
43
  //#endregion
39
44
  //# sourceMappingURL=getToolbarSrc.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"getToolbarSrc.d.ts","names":[],"sources":["../src/getToolbarSrc.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBAoCa,gBAAa,wBAA0B;EAAa"}
1
+ {"version":3,"file":"getToolbarSrc.d.ts","names":[],"sources":["../src/getToolbarSrc.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBAmCa,gBAAa,wBACH;;EAGrB;;;;;EAKA"}
@@ -30,12 +30,11 @@ import { isRepositoryName } from "./isRepositoryName.js";
30
30
  *
31
31
  * @param repositoryName - The name of the Prismic repository. For example, `"my-repo"` if the
32
32
  * repository URL is `my-repo.prismic.io`.
33
- * @param config - `version: 5` opts in to Prismic Toolbar v5. Only use it with an integration that
34
- * stores the preview session in the `cookie.previewSession` cookie. Defaults to v4.
33
+ * @param config - Options that configure the toolbar URL.
35
34
  * @returns The URL for the given Prismic repository's Prismic Toolbar script.
36
35
  */
37
36
  const getToolbarSrc = (repositoryName, config) => {
38
- if (isRepositoryName(repositoryName)) return `https://static.cdn.prismic.io/prismic.js?repo=${repositoryName}${config?.version ? `&v=${config.version}` : ""}`;
37
+ if (isRepositoryName(repositoryName)) return `${config?.host ?? "https://static.cdn.prismic.io"}/prismic.js?repo=${repositoryName}${config?.version ? `&v=${config.version}` : ""}`;
39
38
  else throw new PrismicError(`An invalid Prismic repository name was given: ${repositoryName}`, void 0, void 0);
40
39
  };
41
40
  //#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 = (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"}
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 - Options that configure the toolbar URL.\n * @returns The URL for the given Prismic repository's Prismic Toolbar script.\n */\nexport const getToolbarSrc = (\n\trepositoryName: string,\n\tconfig?: {\n\t\t/** The version of the Prismic Toolbar to load. Defaults to 4. */\n\t\tversion?: 4 | 5\n\t\t/**\n\t\t * The URL the toolbar script is loaded from, without a trailing slash. For example, a toolbar\n\t\t * preview build. Defaults to `https://static.cdn.prismic.io`.\n\t\t */\n\t\thost?: string\n\t},\n): string => {\n\tif (isRepositoryName(repositoryName)) {\n\t\tconst host = config?.host ?? \"https://static.cdn.prismic.io\"\n\n\t\treturn `${host}/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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCA,MAAa,iBACZ,gBACA,WASY;CACZ,IAAI,iBAAiB,cAAc,GAGlC,OAAO,GAFM,QAAQ,QAAQ,gCAEd,mBAAmB,iBAAiB,QAAQ,UAAU,MAAM,OAAO,YAAY;MAE9F,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.5e5ad22";
3
+ var version = "7.22.3-pr.477.689b433";
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.5e5ad22";
3
+ var version = "7.22.3-pr.477.689b433";
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.5e5ad22",
3
+ "version": "7.22.3-pr.477.689b433",
4
4
  "description": "The official JavaScript + TypeScript client library for Prismic",
5
5
  "keywords": [
6
6
  "client",
package/src/cookie.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /** The well-known name of the cookie used to store a Prismic preview session's ref. */
2
2
  export const preview = "io.prismic.preview"
3
3
 
4
- /** The well-known name of the cookie used to store a Prismic Toolbar v5 preview session's ID. */
4
+ /** The well-known name of the cookie used to store a Prismic preview session's ID. */
5
5
  export const previewSession = "io.prismic.previewSession"
@@ -30,13 +30,25 @@ import { isRepositoryName } from "./isRepositoryName"
30
30
  *
31
31
  * @param repositoryName - The name of the Prismic repository. For example, `"my-repo"` if the
32
32
  * repository URL is `my-repo.prismic.io`.
33
- * @param config - `version: 5` opts in to Prismic Toolbar v5. Only use it with an integration that
34
- * stores the preview session in the `cookie.previewSession` cookie. Defaults to v4.
33
+ * @param config - Options that configure the toolbar URL.
35
34
  * @returns The URL for the given Prismic repository's Prismic Toolbar script.
36
35
  */
37
- export const getToolbarSrc = (repositoryName: string, config?: { version?: 4 | 5 }): string => {
36
+ export const getToolbarSrc = (
37
+ repositoryName: string,
38
+ config?: {
39
+ /** The version of the Prismic Toolbar to load. Defaults to 4. */
40
+ version?: 4 | 5
41
+ /**
42
+ * The URL the toolbar script is loaded from, without a trailing slash. For example, a toolbar
43
+ * preview build. Defaults to `https://static.cdn.prismic.io`.
44
+ */
45
+ host?: string
46
+ },
47
+ ): string => {
38
48
  if (isRepositoryName(repositoryName)) {
39
- return `https://static.cdn.prismic.io/prismic.js?repo=${repositoryName}${config?.version ? `&v=${config.version}` : ""}`
49
+ const host = config?.host ?? "https://static.cdn.prismic.io"
50
+
51
+ return `${host}/prismic.js?repo=${repositoryName}${config?.version ? `&v=${config.version}` : ""}`
40
52
  } else {
41
53
  throw new PrismicError(
42
54
  `An invalid Prismic repository name was given: ${repositoryName}`,