@prismicio/client 7.22.3-pr.476.def2ede → 7.22.3-pr.477.0e49e3d
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 +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/getToolbarSrc.cjs +4 -2
- package/dist/getToolbarSrc.cjs.map +1 -1
- package/dist/getToolbarSrc.d.cts +5 -1
- package/dist/getToolbarSrc.d.cts.map +1 -1
- package/dist/getToolbarSrc.d.ts +5 -1
- package/dist/getToolbarSrc.d.ts.map +1 -1
- package/dist/getToolbarSrc.js +4 -2
- package/dist/getToolbarSrc.js.map +1 -1
- package/dist/package.cjs +1 -1
- package/dist/package.js +1 -1
- package/package.json +1 -1
- package/src/cookie.ts +3 -0
- package/src/getToolbarSrc.ts +6 -3
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 Toolbar v5 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 Toolbar v5 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 Toolbar v5 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 Toolbar v5 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 Toolbar v5 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 Toolbar v5 preview session's ID. */\nexport const previewSession = \"io.prismic.previewSession\"\n"],"mappings":";;;;;;;AACA,MAAa,UAAU;;AAGvB,MAAa,iBAAiB"}
|
package/dist/getToolbarSrc.cjs
CHANGED
|
@@ -30,10 +30,12 @@ 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
35
|
* @returns The URL for the given Prismic repository's Prismic Toolbar script.
|
|
34
36
|
*/
|
|
35
|
-
const getToolbarSrc = (repositoryName) => {
|
|
36
|
-
if (require_isRepositoryName.isRepositoryName(repositoryName)) return `https://static.cdn.prismic.io/prismic.js?
|
|
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" : ""}`;
|
|
37
39
|
else throw new require_errors.PrismicError(`An invalid Prismic repository name was given: ${repositoryName}`, void 0, void 0);
|
|
38
40
|
};
|
|
39
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 * @returns The URL for the given Prismic repository's Prismic Toolbar script.\n */\nexport const getToolbarSrc = <TRepositoryName extends string>(\n\trepositoryName: TRepositoryName,\n): `https://static.cdn.prismic.io/prismic.js?
|
|
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"}
|
package/dist/getToolbarSrc.d.cts
CHANGED
|
@@ -28,8 +28,12 @@
|
|
|
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
33
|
* @returns The URL for the given Prismic repository's Prismic Toolbar script.
|
|
32
34
|
*/
|
|
33
|
-
export declare const getToolbarSrc: <TRepositoryName extends string>(repositoryName: TRepositoryName
|
|
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" : ""}`;
|
|
34
38
|
//#endregion
|
|
35
39
|
//# 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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBAoCa,gBAAiB,gCAAgC,4BAA0B,gBACvE,iBAAe;EACpB,UAAU;uDAC8B,kBAAkB"}
|
package/dist/getToolbarSrc.d.ts
CHANGED
|
@@ -28,8 +28,12 @@
|
|
|
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
33
|
* @returns The URL for the given Prismic repository's Prismic Toolbar script.
|
|
32
34
|
*/
|
|
33
|
-
export declare const getToolbarSrc: <TRepositoryName extends string>(repositoryName: TRepositoryName
|
|
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" : ""}`;
|
|
34
38
|
//#endregion
|
|
35
39
|
//# 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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBAoCa,gBAAiB,gCAAgC,4BAA0B,gBACvE,iBAAe;EACpB,UAAU;uDAC8B,kBAAkB"}
|
package/dist/getToolbarSrc.js
CHANGED
|
@@ -30,10 +30,12 @@ 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
35
|
* @returns The URL for the given Prismic repository's Prismic Toolbar script.
|
|
34
36
|
*/
|
|
35
|
-
const getToolbarSrc = (repositoryName) => {
|
|
36
|
-
if (isRepositoryName(repositoryName)) return `https://static.cdn.prismic.io/prismic.js?
|
|
37
|
+
const getToolbarSrc = (repositoryName, config) => {
|
|
38
|
+
if (isRepositoryName(repositoryName)) return `https://static.cdn.prismic.io/prismic.js?repo=${repositoryName}${config?.version === 5 ? "&v=5" : ""}`;
|
|
37
39
|
else throw new PrismicError(`An invalid Prismic repository name was given: ${repositoryName}`, void 0, void 0);
|
|
38
40
|
};
|
|
39
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 * @returns The URL for the given Prismic repository's Prismic Toolbar script.\n */\nexport const getToolbarSrc = <TRepositoryName extends string>(\n\trepositoryName: TRepositoryName,\n): `https://static.cdn.prismic.io/prismic.js?
|
|
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"}
|
package/dist/package.cjs
CHANGED
package/dist/package.js
CHANGED
package/package.json
CHANGED
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 Toolbar v5 preview session's ID. */
|
|
5
|
+
export const previewSession = "io.prismic.previewSession"
|
package/src/getToolbarSrc.ts
CHANGED
|
@@ -30,13 +30,16 @@ 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
35
|
* @returns The URL for the given Prismic repository's Prismic Toolbar script.
|
|
34
36
|
*/
|
|
35
|
-
export const getToolbarSrc = <TRepositoryName extends string>(
|
|
37
|
+
export const getToolbarSrc = <TRepositoryName extends string, TVersion extends 4 | 5 = 4>(
|
|
36
38
|
repositoryName: TRepositoryName,
|
|
37
|
-
|
|
39
|
+
config?: { version?: TVersion },
|
|
40
|
+
): `https://static.cdn.prismic.io/prismic.js?repo=${TRepositoryName}${TVersion extends 5 ? "&v=5" : ""}` => {
|
|
38
41
|
if (isRepositoryName(repositoryName)) {
|
|
39
|
-
return `https://static.cdn.prismic.io/prismic.js?
|
|
42
|
+
return `https://static.cdn.prismic.io/prismic.js?repo=${repositoryName}${config?.version === 5 ? "&v=5" : ""}` as never
|
|
40
43
|
} else {
|
|
41
44
|
throw new PrismicError(
|
|
42
45
|
`An invalid Prismic repository name was given: ${repositoryName}`,
|