@prismicio/client 7.22.3 → 7.23.0-canary.4aca7e3
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/Client.d.cts +1 -0
- package/dist/Client.d.ts +1 -0
- package/dist/Migration.d.cts +1 -0
- package/dist/Migration.d.ts +1 -0
- package/dist/WriteClient.d.cts +1 -0
- package/dist/WriteClient.d.ts +1 -0
- package/dist/buildQueryURL.d.cts +1 -0
- package/dist/buildQueryURL.d.ts +1 -0
- package/dist/cookie.cjs +7 -1
- package/dist/cookie.cjs.map +1 -1
- package/dist/cookie.d.cts +3 -1
- package/dist/cookie.d.cts.map +1 -1
- package/dist/cookie.d.ts +3 -1
- package/dist/cookie.d.ts.map +1 -1
- package/dist/cookie.js +7 -2
- package/dist/cookie.js.map +1 -1
- package/dist/errors.d.cts +1 -0
- package/dist/errors.d.ts +1 -0
- package/dist/getToolbarSrc.cjs +8 -3
- package/dist/getToolbarSrc.cjs.map +1 -1
- package/dist/getToolbarSrc.d.cts +10 -1
- package/dist/getToolbarSrc.d.cts.map +1 -1
- package/dist/getToolbarSrc.d.ts +10 -1
- package/dist/getToolbarSrc.d.ts.map +1 -1
- package/dist/getToolbarSrc.js +8 -3
- package/dist/getToolbarSrc.js.map +1 -1
- package/dist/helpers/asDate.d.cts +1 -0
- package/dist/helpers/asDate.d.ts +1 -0
- package/dist/helpers/asHTML.d.cts +1 -0
- package/dist/helpers/asHTML.d.ts +1 -0
- package/dist/helpers/asImagePixelDensitySrcSet.d.cts +1 -0
- package/dist/helpers/asImagePixelDensitySrcSet.d.ts +1 -0
- package/dist/helpers/asImageSrc.d.cts +1 -0
- package/dist/helpers/asImageSrc.d.ts +1 -0
- package/dist/helpers/asImageWidthSrcSet.d.cts +1 -0
- package/dist/helpers/asImageWidthSrcSet.d.ts +1 -0
- package/dist/helpers/asLink.d.cts +1 -0
- package/dist/helpers/asLink.d.ts +1 -0
- package/dist/helpers/asLinkAttrs.d.cts +1 -0
- package/dist/helpers/asLinkAttrs.d.ts +1 -0
- package/dist/helpers/asText.d.cts +1 -0
- package/dist/helpers/asText.d.ts +1 -0
- package/dist/helpers/documentToLinkField.d.cts +1 -0
- package/dist/helpers/documentToLinkField.d.ts +1 -0
- package/dist/helpers/mapSliceZone.d.cts +1 -0
- package/dist/helpers/mapSliceZone.d.ts +1 -0
- package/dist/package.cjs +1 -1
- package/dist/package.js +1 -1
- package/dist/types/migration/ContentRelationship.d.cts +1 -0
- package/dist/types/migration/ContentRelationship.d.ts +1 -0
- package/dist/types/migration/Document.d.cts +1 -0
- package/dist/types/migration/Document.d.ts +1 -0
- package/dist/types/value/embed.d.cts +1 -0
- package/dist/types/value/embed.d.ts +1 -0
- package/dist/types/value/linkToMedia.d.cts +1 -0
- package/dist/types/value/linkToMedia.d.ts +1 -0
- package/dist/types/value/types.d.cts +1 -0
- package/dist/types/value/types.d.ts +1 -0
- package/dist/types/webhook/apiUpdate.d.cts +1 -0
- package/dist/types/webhook/apiUpdate.d.ts +1 -0
- package/package.json +7 -7
- package/src/cookie.ts +3 -0
- package/src/getToolbarSrc.ts +18 -4
package/dist/Client.d.cts
CHANGED
package/dist/Client.d.ts
CHANGED
package/dist/Migration.d.cts
CHANGED
|
@@ -176,4 +176,5 @@ export declare class Migration<TDocuments extends PrismicDocument = PrismicDocum
|
|
|
176
176
|
_getByOriginalID<TType extends TDocuments["type"]>(id: string): PrismicMigrationDocument<ExtractDocumentType<TDocuments, TType>> | undefined;
|
|
177
177
|
}
|
|
178
178
|
//#endregion
|
|
179
|
+
export {};
|
|
179
180
|
//# sourceMappingURL=Migration.d.cts.map
|
package/dist/Migration.d.ts
CHANGED
|
@@ -176,4 +176,5 @@ export declare class Migration<TDocuments extends PrismicDocument = PrismicDocum
|
|
|
176
176
|
_getByOriginalID<TType extends TDocuments["type"]>(id: string): PrismicMigrationDocument<ExtractDocumentType<TDocuments, TType>> | undefined;
|
|
177
177
|
}
|
|
178
178
|
//#endregion
|
|
179
|
+
export {};
|
|
179
180
|
//# sourceMappingURL=Migration.d.ts.map
|
package/dist/WriteClient.d.cts
CHANGED
package/dist/WriteClient.d.ts
CHANGED
package/dist/buildQueryURL.d.cts
CHANGED
package/dist/buildQueryURL.d.ts
CHANGED
package/dist/cookie.cjs
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
//#region src/cookie.ts
|
|
2
|
-
var cookie_exports = /* @__PURE__ */ require("./_virtual/_rolldown/runtime.cjs").__exportAll({
|
|
2
|
+
var cookie_exports = /* @__PURE__ */ require("./_virtual/_rolldown/runtime.cjs").__exportAll({
|
|
3
|
+
preview: () => preview,
|
|
4
|
+
previewSession: () => previewSession
|
|
5
|
+
});
|
|
3
6
|
/** The well-known name of the cookie used to store a Prismic preview session's ref. */
|
|
4
7
|
const preview = "io.prismic.preview";
|
|
8
|
+
/** The well-known name of the cookie used to store a Prismic preview session's ID. */
|
|
9
|
+
const previewSession = "io.prismic.previewSession";
|
|
5
10
|
//#endregion
|
|
6
11
|
Object.defineProperty(exports, "cookie_exports", {
|
|
7
12
|
enumerable: true,
|
|
@@ -10,5 +15,6 @@ Object.defineProperty(exports, "cookie_exports", {
|
|
|
10
15
|
}
|
|
11
16
|
});
|
|
12
17
|
exports.preview = preview;
|
|
18
|
+
exports.previewSession = previewSession;
|
|
13
19
|
|
|
14
20
|
//# sourceMappingURL=cookie.cjs.map
|
package/dist/cookie.cjs.map
CHANGED
|
@@ -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"],"mappings":"
|
|
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
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
declare namespace cookie_d_exports {
|
|
2
|
-
export { preview };
|
|
2
|
+
export { preview, previewSession };
|
|
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 preview session's ID. */
|
|
7
|
+
export declare const previewSession = "io.prismic.previewSession";
|
|
6
8
|
//#endregion
|
|
7
9
|
export { cookie_d_exports };
|
|
8
10
|
//# sourceMappingURL=cookie.d.cts.map
|
package/dist/cookie.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cookie.d.cts","names":[],"sources":["../src/cookie.ts"],"mappings":";;;;qBACa"}
|
|
1
|
+
{"version":3,"file":"cookie.d.cts","names":[],"sources":["../src/cookie.ts"],"mappings":";;;;qBACa;;qBAGA"}
|
package/dist/cookie.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
declare namespace cookie_d_exports {
|
|
2
|
-
export { preview };
|
|
2
|
+
export { preview, previewSession };
|
|
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 preview session's ID. */
|
|
7
|
+
export declare const previewSession = "io.prismic.previewSession";
|
|
6
8
|
//#endregion
|
|
7
9
|
export { cookie_d_exports };
|
|
8
10
|
//# sourceMappingURL=cookie.d.ts.map
|
package/dist/cookie.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cookie.d.ts","names":[],"sources":["../src/cookie.ts"],"mappings":";;;;qBACa"}
|
|
1
|
+
{"version":3,"file":"cookie.d.ts","names":[],"sources":["../src/cookie.ts"],"mappings":";;;;qBACa;;qBAGA"}
|
package/dist/cookie.js
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
import { __exportAll } from "./_virtual/_rolldown/runtime.js";
|
|
2
2
|
//#region src/cookie.ts
|
|
3
|
-
var cookie_exports = /* @__PURE__ */ __exportAll({
|
|
3
|
+
var cookie_exports = /* @__PURE__ */ __exportAll({
|
|
4
|
+
preview: () => preview,
|
|
5
|
+
previewSession: () => previewSession
|
|
6
|
+
});
|
|
4
7
|
/** The well-known name of the cookie used to store a Prismic preview session's ref. */
|
|
5
8
|
const preview = "io.prismic.preview";
|
|
9
|
+
/** The well-known name of the cookie used to store a Prismic preview session's ID. */
|
|
10
|
+
const previewSession = "io.prismic.previewSession";
|
|
6
11
|
//#endregion
|
|
7
|
-
export { cookie_exports, preview };
|
|
12
|
+
export { cookie_exports, preview, previewSession };
|
|
8
13
|
|
|
9
14
|
//# sourceMappingURL=cookie.js.map
|
package/dist/cookie.js.map
CHANGED
|
@@ -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"],"mappings":"
|
|
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"}
|
package/dist/errors.d.cts
CHANGED
package/dist/errors.d.ts
CHANGED
package/dist/getToolbarSrc.cjs
CHANGED
|
@@ -30,11 +30,16 @@ 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 - Options that configure the toolbar URL.
|
|
33
34
|
* @returns The URL for the given Prismic repository's Prismic Toolbar script.
|
|
34
35
|
*/
|
|
35
|
-
const getToolbarSrc = (repositoryName) => {
|
|
36
|
-
if (require_isRepositoryName.isRepositoryName(repositoryName))
|
|
37
|
-
|
|
36
|
+
const getToolbarSrc = (repositoryName, config) => {
|
|
37
|
+
if (require_isRepositoryName.isRepositoryName(repositoryName)) {
|
|
38
|
+
const url = new URL(`${config?.host ?? "https://static.cdn.prismic.io"}/prismic.js`);
|
|
39
|
+
url.searchParams.set("repo", repositoryName);
|
|
40
|
+
if (config?.version) url.searchParams.set("v", config.version.toString());
|
|
41
|
+
return url.toString();
|
|
42
|
+
} else throw new require_errors.PrismicError(`An invalid Prismic repository name was given: ${repositoryName}`, void 0, void 0);
|
|
38
43
|
};
|
|
39
44
|
//#endregion
|
|
40
45
|
exports.getToolbarSrc = getToolbarSrc;
|
|
@@ -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 * @returns The URL for the given Prismic repository's Prismic Toolbar script.\n */\nexport const getToolbarSrc =
|
|
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 url = new URL(`${config?.host ?? \"https://static.cdn.prismic.io\"}/prismic.js`)\n\t\turl.searchParams.set(\"repo\", repositoryName)\n\t\tif (config?.version) url.searchParams.set(\"v\", config.version.toString())\n\n\t\treturn url.toString()\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,GAAG;EACrC,MAAM,MAAM,IAAI,IAAI,GAAG,QAAQ,QAAQ,gCAAgC,YAAY;EACnF,IAAI,aAAa,IAAI,QAAQ,cAAc;EAC3C,IAAI,QAAQ,SAAS,IAAI,aAAa,IAAI,KAAK,OAAO,QAAQ,SAAS,CAAC;EAExE,OAAO,IAAI,SAAS;CACrB,OACC,MAAM,IAAIC,eAAAA,aACT,iDAAiD,kBACjD,KAAA,GACA,KAAA,CACD;AAEF"}
|
package/dist/getToolbarSrc.d.cts
CHANGED
|
@@ -28,8 +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 - Options that configure the toolbar URL.
|
|
31
32
|
* @returns The URL for the given Prismic repository's Prismic Toolbar script.
|
|
32
33
|
*/
|
|
33
|
-
export declare const getToolbarSrc:
|
|
34
|
+
export declare const getToolbarSrc: (repositoryName: string, config?: {
|
|
35
|
+
/** The version of the Prismic Toolbar to load. Defaults to 4. */
|
|
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;
|
|
42
|
+
}) => string;
|
|
34
43
|
//#endregion
|
|
35
44
|
//# sourceMappingURL=getToolbarSrc.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getToolbarSrc.d.cts","names":[],"sources":["../src/getToolbarSrc.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"getToolbarSrc.d.cts","names":[],"sources":["../src/getToolbarSrc.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBAmCa,gBAAa,wBACH;;EAGrB;;;;;EAKA"}
|
package/dist/getToolbarSrc.d.ts
CHANGED
|
@@ -28,8 +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 - Options that configure the toolbar URL.
|
|
31
32
|
* @returns The URL for the given Prismic repository's Prismic Toolbar script.
|
|
32
33
|
*/
|
|
33
|
-
export declare const getToolbarSrc:
|
|
34
|
+
export declare const getToolbarSrc: (repositoryName: string, config?: {
|
|
35
|
+
/** The version of the Prismic Toolbar to load. Defaults to 4. */
|
|
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;
|
|
42
|
+
}) => string;
|
|
34
43
|
//#endregion
|
|
35
44
|
//# sourceMappingURL=getToolbarSrc.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getToolbarSrc.d.ts","names":[],"sources":["../src/getToolbarSrc.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"getToolbarSrc.d.ts","names":[],"sources":["../src/getToolbarSrc.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBAmCa,gBAAa,wBACH;;EAGrB;;;;;EAKA"}
|
package/dist/getToolbarSrc.js
CHANGED
|
@@ -30,11 +30,16 @@ 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 - Options that configure the toolbar URL.
|
|
33
34
|
* @returns The URL for the given Prismic repository's Prismic Toolbar script.
|
|
34
35
|
*/
|
|
35
|
-
const getToolbarSrc = (repositoryName) => {
|
|
36
|
-
if (isRepositoryName(repositoryName))
|
|
37
|
-
|
|
36
|
+
const getToolbarSrc = (repositoryName, config) => {
|
|
37
|
+
if (isRepositoryName(repositoryName)) {
|
|
38
|
+
const url = new URL(`${config?.host ?? "https://static.cdn.prismic.io"}/prismic.js`);
|
|
39
|
+
url.searchParams.set("repo", repositoryName);
|
|
40
|
+
if (config?.version) url.searchParams.set("v", config.version.toString());
|
|
41
|
+
return url.toString();
|
|
42
|
+
} else throw new PrismicError(`An invalid Prismic repository name was given: ${repositoryName}`, void 0, void 0);
|
|
38
43
|
};
|
|
39
44
|
//#endregion
|
|
40
45
|
export { getToolbarSrc };
|
|
@@ -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 * @returns The URL for the given Prismic repository's Prismic Toolbar script.\n */\nexport const getToolbarSrc =
|
|
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 url = new URL(`${config?.host ?? \"https://static.cdn.prismic.io\"}/prismic.js`)\n\t\turl.searchParams.set(\"repo\", repositoryName)\n\t\tif (config?.version) url.searchParams.set(\"v\", config.version.toString())\n\n\t\treturn url.toString()\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,GAAG;EACrC,MAAM,MAAM,IAAI,IAAI,GAAG,QAAQ,QAAQ,gCAAgC,YAAY;EACnF,IAAI,aAAa,IAAI,QAAQ,cAAc;EAC3C,IAAI,QAAQ,SAAS,IAAI,aAAa,IAAI,KAAK,OAAO,QAAQ,SAAS,CAAC;EAExE,OAAO,IAAI,SAAS;CACrB,OACC,MAAM,IAAI,aACT,iDAAiD,kBACjD,KAAA,GACA,KAAA,CACD;AAEF"}
|
|
@@ -18,4 +18,5 @@ type AsDateReturnType<Field extends DateField | TimestampField | null | undefine
|
|
|
18
18
|
*/
|
|
19
19
|
export declare const asDate: <Field extends DateField | TimestampField | null | undefined>(dateOrTimestampField: Field) => AsDateReturnType<Field>;
|
|
20
20
|
//#endregion
|
|
21
|
+
export {};
|
|
21
22
|
//# sourceMappingURL=asDate.d.cts.map
|
package/dist/helpers/asDate.d.ts
CHANGED
|
@@ -18,4 +18,5 @@ type AsDateReturnType<Field extends DateField | TimestampField | null | undefine
|
|
|
18
18
|
*/
|
|
19
19
|
export declare const asDate: <Field extends DateField | TimestampField | null | undefined>(dateOrTimestampField: Field) => AsDateReturnType<Field>;
|
|
20
20
|
//#endregion
|
|
21
|
+
export {};
|
|
21
22
|
//# sourceMappingURL=asDate.d.ts.map
|
package/dist/helpers/asHTML.d.ts
CHANGED
|
@@ -43,4 +43,5 @@ type AsImagePixelDensitySrcSetReturnType<Field extends ImageFieldImage | null |
|
|
|
43
43
|
*/
|
|
44
44
|
export declare const asImagePixelDensitySrcSet: <Field extends ImageFieldImage | null | undefined>(field: Field, config?: AsImagePixelDensitySrcSetConfig) => AsImagePixelDensitySrcSetReturnType<Field>;
|
|
45
45
|
//#endregion
|
|
46
|
+
export {};
|
|
46
47
|
//# sourceMappingURL=asImagePixelDensitySrcSet.d.cts.map
|
|
@@ -43,4 +43,5 @@ type AsImagePixelDensitySrcSetReturnType<Field extends ImageFieldImage | null |
|
|
|
43
43
|
*/
|
|
44
44
|
export declare const asImagePixelDensitySrcSet: <Field extends ImageFieldImage | null | undefined>(field: Field, config?: AsImagePixelDensitySrcSetConfig) => AsImagePixelDensitySrcSetReturnType<Field>;
|
|
45
45
|
//#endregion
|
|
46
|
+
export {};
|
|
46
47
|
//# sourceMappingURL=asImagePixelDensitySrcSet.d.ts.map
|
|
@@ -21,4 +21,5 @@ type AsImageSrcReturnType<Field extends ImageFieldImage | null | undefined> = Fi
|
|
|
21
21
|
*/
|
|
22
22
|
export declare const asImageSrc: <Field extends ImageFieldImage | null | undefined>(field: Field, config?: ImgixURLParams) => AsImageSrcReturnType<Field>;
|
|
23
23
|
//#endregion
|
|
24
|
+
export {};
|
|
24
25
|
//# sourceMappingURL=asImageSrc.d.cts.map
|
|
@@ -21,4 +21,5 @@ type AsImageSrcReturnType<Field extends ImageFieldImage | null | undefined> = Fi
|
|
|
21
21
|
*/
|
|
22
22
|
export declare const asImageSrc: <Field extends ImageFieldImage | null | undefined>(field: Field, config?: ImgixURLParams) => AsImageSrcReturnType<Field>;
|
|
23
23
|
//#endregion
|
|
24
|
+
export {};
|
|
24
25
|
//# sourceMappingURL=asImageSrc.d.ts.map
|
|
@@ -50,4 +50,5 @@ type AsImageWidthSrcSetConfig = Omit<BuildWidthSrcSetParams, "widths"> & {
|
|
|
50
50
|
*/
|
|
51
51
|
export declare const asImageWidthSrcSet: <Field extends ImageFieldImage | null | undefined>(field: Field, config?: AsImageWidthSrcSetConfig) => AsImageWidthSrcSetReturnType<Field>;
|
|
52
52
|
//#endregion
|
|
53
|
+
export {};
|
|
53
54
|
//# sourceMappingURL=asImageWidthSrcSet.d.cts.map
|
|
@@ -50,4 +50,5 @@ type AsImageWidthSrcSetConfig = Omit<BuildWidthSrcSetParams, "widths"> & {
|
|
|
50
50
|
*/
|
|
51
51
|
export declare const asImageWidthSrcSet: <Field extends ImageFieldImage | null | undefined>(field: Field, config?: AsImageWidthSrcSetConfig) => AsImageWidthSrcSetReturnType<Field>;
|
|
52
52
|
//#endregion
|
|
53
|
+
export {};
|
|
53
54
|
//# sourceMappingURL=asImageWidthSrcSet.d.ts.map
|
|
@@ -60,4 +60,5 @@ export declare const asLink: {
|
|
|
60
60
|
<LinkResolverFunctionReturnType = string | null | undefined, Field extends LinkField | PrismicDocument | null | undefined = LinkField | PrismicDocument | null | undefined>(linkFieldOrDocument: Field, ...config: AsLinkDeprecatedTupleConfig<LinkResolverFunctionReturnType>): AsLinkReturnType<LinkResolverFunctionReturnType, Field>;
|
|
61
61
|
};
|
|
62
62
|
//#endregion
|
|
63
|
+
export {};
|
|
63
64
|
//# sourceMappingURL=asLink.d.cts.map
|
package/dist/helpers/asLink.d.ts
CHANGED
|
@@ -60,4 +60,5 @@ export declare const asLink: {
|
|
|
60
60
|
<LinkResolverFunctionReturnType = string | null | undefined, Field extends LinkField | PrismicDocument | null | undefined = LinkField | PrismicDocument | null | undefined>(linkFieldOrDocument: Field, ...config: AsLinkDeprecatedTupleConfig<LinkResolverFunctionReturnType>): AsLinkReturnType<LinkResolverFunctionReturnType, Field>;
|
|
61
61
|
};
|
|
62
62
|
//#endregion
|
|
63
|
+
export {};
|
|
63
64
|
//# sourceMappingURL=asLink.d.ts.map
|
|
@@ -41,4 +41,5 @@ type AsLinkAttrsReturnType<LinkResolverFunctionReturnType = ReturnType<LinkResol
|
|
|
41
41
|
*/
|
|
42
42
|
export declare const asLinkAttrs: <LinkResolverFunctionReturnType = ReturnType<LinkResolverFunction>, Field extends LinkField | PrismicDocument | null | undefined = LinkField | PrismicDocument | null | undefined>(linkFieldOrDocument: Field, config?: AsLinkAttrsConfig<LinkResolverFunctionReturnType>) => AsLinkAttrsReturnType<LinkResolverFunctionReturnType>;
|
|
43
43
|
//#endregion
|
|
44
|
+
export {};
|
|
44
45
|
//# sourceMappingURL=asLinkAttrs.d.cts.map
|
|
@@ -41,4 +41,5 @@ type AsLinkAttrsReturnType<LinkResolverFunctionReturnType = ReturnType<LinkResol
|
|
|
41
41
|
*/
|
|
42
42
|
export declare const asLinkAttrs: <LinkResolverFunctionReturnType = ReturnType<LinkResolverFunction>, Field extends LinkField | PrismicDocument | null | undefined = LinkField | PrismicDocument | null | undefined>(linkFieldOrDocument: Field, config?: AsLinkAttrsConfig<LinkResolverFunctionReturnType>) => AsLinkAttrsReturnType<LinkResolverFunctionReturnType>;
|
|
43
43
|
//#endregion
|
|
44
|
+
export {};
|
|
44
45
|
//# sourceMappingURL=asLinkAttrs.d.ts.map
|
package/dist/helpers/asText.d.ts
CHANGED
|
@@ -12,4 +12,5 @@ type SetOptional<T, Keys extends keyof T> = Omit<T, Keys> & Partial<Pick<T, Keys
|
|
|
12
12
|
*/
|
|
13
13
|
export declare const documentToLinkField: <TDocument extends SetOptional<PrismicDocument, "slugs">>(prismicDocument: TDocument) => FilledContentRelationshipField<TDocument["type"], TDocument["lang"], TDocument["data"]>;
|
|
14
14
|
//#endregion
|
|
15
|
+
export {};
|
|
15
16
|
//# sourceMappingURL=documentToLinkField.d.cts.map
|
|
@@ -12,4 +12,5 @@ type SetOptional<T, Keys extends keyof T> = Omit<T, Keys> & Partial<Pick<T, Keys
|
|
|
12
12
|
*/
|
|
13
13
|
export declare const documentToLinkField: <TDocument extends SetOptional<PrismicDocument, "slugs">>(prismicDocument: TDocument) => FilledContentRelationshipField<TDocument["type"], TDocument["lang"], TDocument["data"]>;
|
|
14
14
|
//#endregion
|
|
15
|
+
export {};
|
|
15
16
|
//# sourceMappingURL=documentToLinkField.d.ts.map
|
|
@@ -109,4 +109,5 @@ type MapSliceLike<TSliceLike extends SliceLike<any>, TSliceMappers extends Slice
|
|
|
109
109
|
*/
|
|
110
110
|
export declare function mapSliceZone<TSliceLike extends SliceLike, TSliceMappers extends SliceMappers<TSliceLike, TContext>, TContext = unknown>(sliceZone: SliceZoneLike<TSliceLike>, mappers: TSliceMappers, context?: TContext): Promise<MapSliceLike<TSliceLike, TSliceMappers>[]>;
|
|
111
111
|
//#endregion
|
|
112
|
+
export {};
|
|
112
113
|
//# sourceMappingURL=mapSliceZone.d.cts.map
|
|
@@ -109,4 +109,5 @@ type MapSliceLike<TSliceLike extends SliceLike<any>, TSliceMappers extends Slice
|
|
|
109
109
|
*/
|
|
110
110
|
export declare function mapSliceZone<TSliceLike extends SliceLike, TSliceMappers extends SliceMappers<TSliceLike, TContext>, TContext = unknown>(sliceZone: SliceZoneLike<TSliceLike>, mappers: TSliceMappers, context?: TContext): Promise<MapSliceLike<TSliceLike, TSliceMappers>[]>;
|
|
111
111
|
//#endregion
|
|
112
|
+
export {};
|
|
112
113
|
//# sourceMappingURL=mapSliceZone.d.ts.map
|
package/dist/package.cjs
CHANGED
package/dist/package.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prismicio/client",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.23.0-canary.4aca7e3",
|
|
4
4
|
"description": "The official JavaScript + TypeScript client library for Prismic",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"client",
|
|
@@ -70,13 +70,13 @@
|
|
|
70
70
|
"devDependencies": {
|
|
71
71
|
"@prismicio/e2e-tests-utils": "^1.20.0",
|
|
72
72
|
"@prismicio/types-internal": "^3.17.2",
|
|
73
|
-
"@types/node": "^26.6.
|
|
74
|
-
"@vitest/coverage-v8": "^5.0.
|
|
75
|
-
"oxfmt": "^0.
|
|
76
|
-
"oxlint": "^1.
|
|
77
|
-
"tsdown": "^0.23.
|
|
73
|
+
"@types/node": "^26.6.5",
|
|
74
|
+
"@vitest/coverage-v8": "^5.0.5",
|
|
75
|
+
"oxfmt": "^0.74.0",
|
|
76
|
+
"oxlint": "^1.89.0",
|
|
77
|
+
"tsdown": "^0.23.1",
|
|
78
78
|
"typescript": "^7.0.2",
|
|
79
|
-
"vitest": "^5.0.
|
|
79
|
+
"vitest": "^5.0.5"
|
|
80
80
|
},
|
|
81
81
|
"engines": {
|
|
82
82
|
"node": ">=22"
|
package/src/cookie.ts
CHANGED
|
@@ -1,2 +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
|
+
|
|
4
|
+
/** The well-known name of the cookie used to store a Prismic preview session's ID. */
|
|
5
|
+
export const previewSession = "io.prismic.previewSession"
|
package/src/getToolbarSrc.ts
CHANGED
|
@@ -30,13 +30,27 @@ 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 - Options that configure the toolbar URL.
|
|
33
34
|
* @returns The URL for the given Prismic repository's Prismic Toolbar script.
|
|
34
35
|
*/
|
|
35
|
-
export const getToolbarSrc =
|
|
36
|
-
repositoryName:
|
|
37
|
-
|
|
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
|
-
|
|
49
|
+
const url = new URL(`${config?.host ?? "https://static.cdn.prismic.io"}/prismic.js`)
|
|
50
|
+
url.searchParams.set("repo", repositoryName)
|
|
51
|
+
if (config?.version) url.searchParams.set("v", config.version.toString())
|
|
52
|
+
|
|
53
|
+
return url.toString()
|
|
40
54
|
} else {
|
|
41
55
|
throw new PrismicError(
|
|
42
56
|
`An invalid Prismic repository name was given: ${repositoryName}`,
|