@prismicio/next 1.0.2 → 1.1.0-alpha.0

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.
Files changed (82) hide show
  1. package/dist/PrismicNextImage.cjs +17 -27
  2. package/dist/PrismicNextImage.cjs.map +1 -1
  3. package/dist/PrismicNextImage.d.ts +3 -3
  4. package/dist/PrismicNextImage.js +13 -19
  5. package/dist/PrismicNextImage.js.map +1 -1
  6. package/dist/PrismicNextLink.cjs +40 -0
  7. package/dist/PrismicNextLink.cjs.map +1 -0
  8. package/dist/PrismicNextLink.d.ts +126 -0
  9. package/dist/PrismicNextLink.js +22 -0
  10. package/dist/PrismicNextLink.js.map +1 -0
  11. package/dist/PrismicPreview.cjs +14 -20
  12. package/dist/PrismicPreview.cjs.map +1 -1
  13. package/dist/PrismicPreview.d.ts +1 -1
  14. package/dist/PrismicPreview.js +11 -13
  15. package/dist/PrismicPreview.js.map +1 -1
  16. package/dist/enableAutoPreviews.cjs +1 -1
  17. package/dist/enableAutoPreviews.cjs.map +1 -1
  18. package/dist/enableAutoPreviews.d.ts +4 -4
  19. package/dist/enableAutoPreviews.js.map +1 -1
  20. package/dist/exitPreview.cjs +1 -1
  21. package/dist/exitPreview.cjs.map +1 -1
  22. package/dist/exitPreview.d.ts +1 -1
  23. package/dist/exitPreview.js.map +1 -1
  24. package/dist/imgixLoader.cjs +1 -1
  25. package/dist/imgixLoader.cjs.map +1 -1
  26. package/dist/imgixLoader.js.map +1 -1
  27. package/dist/index.cjs +3 -1
  28. package/dist/index.cjs.map +1 -1
  29. package/dist/index.d.ts +15 -7
  30. package/dist/index.js +2 -0
  31. package/dist/index.js.map +1 -1
  32. package/dist/lib/__PRODUCTION__.cjs +1 -1
  33. package/dist/lib/__PRODUCTION__.cjs.map +1 -1
  34. package/dist/lib/__PRODUCTION__.js.map +1 -1
  35. package/dist/lib/devMsg.cjs +2 -2
  36. package/dist/lib/devMsg.cjs.map +1 -1
  37. package/dist/lib/devMsg.js +1 -1
  38. package/dist/lib/devMsg.js.map +1 -1
  39. package/dist/lib/getPreviewCookieRepositoryName.cjs +1 -1
  40. package/dist/lib/getPreviewCookieRepositoryName.cjs.map +1 -1
  41. package/dist/lib/getPreviewCookieRepositoryName.js.map +1 -1
  42. package/dist/lib/getPrismicPreviewCookie.cjs +3 -5
  43. package/dist/lib/getPrismicPreviewCookie.cjs.map +1 -1
  44. package/dist/lib/getPrismicPreviewCookie.js.map +1 -1
  45. package/dist/package.json.cjs +5 -0
  46. package/dist/package.json.cjs.map +1 -0
  47. package/dist/package.json.js +5 -0
  48. package/dist/package.json.js.map +1 -0
  49. package/dist/react-server/PrismicPreview.d.ts +22 -0
  50. package/dist/react-server/index.d.ts +2 -0
  51. package/dist/react-server/unsupported.cjs +26 -0
  52. package/dist/react-server/unsupported.cjs.map +1 -0
  53. package/dist/react-server/unsupported.d.ts +6 -0
  54. package/dist/react-server/unsupported.js +26 -0
  55. package/dist/react-server/unsupported.js.map +1 -0
  56. package/dist/react-server.cjs +15 -0
  57. package/dist/react-server.cjs.map +1 -0
  58. package/dist/react-server.js +15 -0
  59. package/dist/react-server.js.map +1 -0
  60. package/dist/redirectToPreviewURL.cjs +1 -1
  61. package/dist/redirectToPreviewURL.cjs.map +1 -1
  62. package/dist/redirectToPreviewURL.d.ts +4 -5
  63. package/dist/redirectToPreviewURL.js.map +1 -1
  64. package/dist/setPreviewData.cjs +3 -5
  65. package/dist/setPreviewData.cjs.map +1 -1
  66. package/dist/setPreviewData.d.ts +1 -1
  67. package/dist/setPreviewData.js.map +1 -1
  68. package/dist/types.d.ts +1 -1
  69. package/package.json +38 -33
  70. package/src/PrismicNextImage.tsx +6 -5
  71. package/src/PrismicNextLink.tsx +55 -0
  72. package/src/PrismicPreview.tsx +2 -0
  73. package/src/enableAutoPreviews.ts +9 -3
  74. package/src/index.ts +16 -13
  75. package/src/react-server/PrismicPreview.tsx +74 -0
  76. package/src/react-server/index.ts +11 -0
  77. package/src/react-server/unsupported.ts +26 -0
  78. package/src/redirectToPreviewURL.ts +7 -5
  79. package/dist/package.cjs +0 -5
  80. package/dist/package.cjs.map +0 -1
  81. package/dist/package.js +0 -5
  82. package/dist/package.js.map +0 -1
@@ -1,16 +1,15 @@
1
+ 'use client';
2
+ 'use client';
1
3
  "use strict";
2
- Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
4
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
5
  const jsxRuntime = require("react/jsx-runtime");
4
6
  const Image = require("next/image");
5
7
  const imgixUrlBuilder = require("imgix-url-builder");
6
- const prismicH = require("@prismicio/helpers");
8
+ const prismic = require("@prismicio/client");
7
9
  const __PRODUCTION__ = require("./lib/__PRODUCTION__.cjs");
8
10
  const devMsg = require("./lib/devMsg.cjs");
9
11
  const imgixLoader = require("./imgixLoader.cjs");
10
- const _interopDefaultLegacy = (e) => e && typeof e === "object" && "default" in e ? e : { default: e };
11
- function _interopNamespace(e) {
12
- if (e && e.__esModule)
13
- return e;
12
+ function _interopNamespaceDefault(e) {
14
13
  const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
15
14
  if (e) {
16
15
  for (const k in e) {
@@ -26,8 +25,7 @@ function _interopNamespace(e) {
26
25
  n.default = e;
27
26
  return Object.freeze(n);
28
27
  }
29
- const Image__default = /* @__PURE__ */ _interopDefaultLegacy(Image);
30
- const prismicH__namespace = /* @__PURE__ */ _interopNamespace(prismicH);
28
+ const prismic__namespace = /* @__PURE__ */ _interopNamespaceDefault(prismic);
31
29
  const castInt = (input) => {
32
30
  if (typeof input === "number" || typeof input === "undefined") {
33
31
  return input;
@@ -40,17 +38,7 @@ const castInt = (input) => {
40
38
  }
41
39
  }
42
40
  };
43
- const PrismicNextImage = ({
44
- field,
45
- imgixParams = {},
46
- alt,
47
- fallbackAlt,
48
- fill,
49
- width,
50
- height,
51
- fallback = null,
52
- ...restProps
53
- }) => {
41
+ const PrismicNextImage = ({ field, imgixParams = {}, alt, fallbackAlt, fill, width, height, fallback = null, ...restProps }) => {
54
42
  if (!__PRODUCTION__.__PRODUCTION__) {
55
43
  if (typeof alt === "string" && alt !== "") {
56
44
  console.warn(`[PrismicNextImage] The "alt" prop can only be used to declare an image as decorative by passing an empty string (alt="") but was provided a non-empty string. You can resolve this warning by removing the "alt" prop or changing it to alt="". For more details, see ${devMsg.devMsg("alt-must-be-an-empty-string")}`);
@@ -59,31 +47,33 @@ const PrismicNextImage = ({
59
47
  console.warn(`[PrismicNextImage] The "fallbackAlt" prop can only be used to declare an image as decorative by passing an empty string (fallbackAlt="") but was provided a non-empty string. You can resolve this warning by removing the "fallbackAlt" prop or changing it to fallbackAlt="". For more details, see ${devMsg.devMsg("alt-must-be-an-empty-string")}`);
60
48
  }
61
49
  }
62
- if (prismicH__namespace.isFilled.imageThumbnail(field)) {
50
+ if (prismic__namespace.isFilled.imageThumbnail(field)) {
63
51
  const src = imgixUrlBuilder.buildURL(field.url, imgixParams);
64
52
  const ar = field.dimensions.width / field.dimensions.height;
65
53
  const castedWidth = castInt(width);
66
54
  const castedHeight = castInt(height);
67
- let resolvedWidth = castedWidth != null ? castedWidth : field.dimensions.width;
68
- let resolvedHeight = castedHeight != null ? castedHeight : field.dimensions.width;
55
+ let resolvedWidth = castedWidth ?? field.dimensions.width;
56
+ let resolvedHeight = castedHeight ?? field.dimensions.height;
69
57
  if (castedWidth != null && castedHeight == null) {
70
58
  resolvedHeight = castedWidth / ar;
71
59
  } else if (castedWidth == null && castedHeight != null) {
72
60
  resolvedWidth = castedHeight * ar;
73
61
  }
74
- return jsxRuntime.jsx(Image__default.default, {
62
+ return jsxRuntime.jsx(Image, {
75
63
  src,
76
64
  width: fill ? void 0 : resolvedWidth,
77
65
  height: fill ? void 0 : resolvedHeight,
78
- alt: alt != null ? alt : field.alt || fallbackAlt,
66
+ // A non-null assertion is required since we
67
+ // can't statically know if an alt attribute is
68
+ // available.
69
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
70
+ alt: alt ?? (field.alt || fallbackAlt),
79
71
  fill,
80
72
  loader: imgixLoader.imgixLoader,
81
73
  ...restProps
82
74
  });
83
75
  } else {
84
- return jsxRuntime.jsx(jsxRuntime.Fragment, {
85
- children: fallback
86
- });
76
+ return jsxRuntime.jsx(jsxRuntime.Fragment, { children: fallback });
87
77
  }
88
78
  };
89
79
  exports.PrismicNextImage = PrismicNextImage;
@@ -1 +1 @@
1
- {"version":3,"file":"PrismicNextImage.cjs","sources":["../src/PrismicNextImage.tsx"],"sourcesContent":["import Image, { ImageProps } from \"next/image\";\nimport { buildURL, ImgixURLParams } from \"imgix-url-builder\";\nimport * as prismicH from \"@prismicio/helpers\";\nimport * as prismicT from \"@prismicio/types\";\n\nimport { __PRODUCTION__ } from \"./lib/__PRODUCTION__\";\nimport { devMsg } from \"./lib/devMsg\";\n\nimport { imgixLoader } from \"./imgixLoader\";\n\nconst castInt = (input: string | number | undefined): number | undefined => {\n\tif (typeof input === \"number\" || typeof input === \"undefined\") {\n\t\treturn input;\n\t} else {\n\t\tconst parsed = Number.parseInt(input);\n\n\t\tif (Number.isNaN(parsed)) {\n\t\t\treturn undefined;\n\t\t} else {\n\t\t\treturn parsed;\n\t\t}\n\t}\n};\n\nexport type PrismicNextImageProps = Omit<ImageProps, \"src\" | \"alt\"> & {\n\t/**\n\t * The Prismic Image field or thumbnail to render.\n\t */\n\tfield: prismicT.ImageFieldImage | null | undefined;\n\n\t/**\n\t * An object of Imgix URL API parameters to transform the image.\n\t *\n\t * @see https://docs.imgix.com/apis/rendering\n\t */\n\timgixParams?: ImgixURLParams;\n\n\t/**\n\t * Declare an image as decorative by providing `alt=\"\"`.\n\t *\n\t * See:\n\t * https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/alt#decorative_images\n\t */\n\talt?: \"\";\n\n\t/**\n\t * Declare an image as decorative only if the Image field does not have\n\t * alternative text by providing `fallbackAlt=\"\"`.\n\t *\n\t * See:\n\t * https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/alt#decorative_images\n\t */\n\tfallbackAlt?: \"\";\n\n\t/**\n\t * Rendered when the field is empty. If a fallback is not given, `null` will\n\t * be rendered.\n\t */\n\tfallback?: React.ReactNode;\n};\n\n/**\n * React component that renders an image from a Prismic Image field or one of\n * its thumbnails using `next/image`. It will automatically set the `alt`\n * attribute using the Image field's `alt` property.\n *\n * It uses an Imgix URL-based loader by default. A custom loader can be provided\n * with the `loader` prop. If you would like to use the Next.js Image\n * Optimization API instead, set `loader={undefined}`.\n *\n * @param props - Props for the component.\n *\n * @returns A responsive image component using `next/image` for the given Image\n * field.\n * @see To learn more about `next/image`, see: https://nextjs.org/docs/api-reference/next/image\n */\nexport const PrismicNextImage = ({\n\tfield,\n\timgixParams = {},\n\talt,\n\tfallbackAlt,\n\tfill,\n\twidth,\n\theight,\n\tfallback = null,\n\t...restProps\n}: PrismicNextImageProps): JSX.Element => {\n\tif (!__PRODUCTION__) {\n\t\tif (typeof alt === \"string\" && alt !== \"\") {\n\t\t\tconsole.warn(\n\t\t\t\t`[PrismicNextImage] The \"alt\" prop can only be used to declare an image as decorative by passing an empty string (alt=\"\") but was provided a non-empty string. You can resolve this warning by removing the \"alt\" prop or changing it to alt=\"\". For more details, see ${devMsg(\n\t\t\t\t\t\"alt-must-be-an-empty-string\",\n\t\t\t\t)}`,\n\t\t\t);\n\t\t}\n\n\t\tif (typeof fallbackAlt === \"string\" && fallbackAlt !== \"\") {\n\t\t\tconsole.warn(\n\t\t\t\t`[PrismicNextImage] The \"fallbackAlt\" prop can only be used to declare an image as decorative by passing an empty string (fallbackAlt=\"\") but was provided a non-empty string. You can resolve this warning by removing the \"fallbackAlt\" prop or changing it to fallbackAlt=\"\". For more details, see ${devMsg(\n\t\t\t\t\t\"alt-must-be-an-empty-string\",\n\t\t\t\t)}`,\n\t\t\t);\n\t\t}\n\t}\n\n\tif (prismicH.isFilled.imageThumbnail(field)) {\n\t\tconst src = buildURL(field.url, imgixParams);\n\n\t\tconst ar = field.dimensions.width / field.dimensions.height;\n\n\t\tconst castedWidth = castInt(width);\n\t\tconst castedHeight = castInt(height);\n\n\t\tlet resolvedWidth = castedWidth ?? field.dimensions.width;\n\t\tlet resolvedHeight = castedHeight ?? field.dimensions.width;\n\n\t\tif (castedWidth != null && castedHeight == null) {\n\t\t\tresolvedHeight = castedWidth / ar;\n\t\t} else if (castedWidth == null && castedHeight != null) {\n\t\t\tresolvedWidth = castedHeight * ar;\n\t\t}\n\n\t\treturn (\n\t\t\t<Image\n\t\t\t\tsrc={src}\n\t\t\t\twidth={fill ? undefined : resolvedWidth}\n\t\t\t\theight={fill ? undefined : resolvedHeight}\n\t\t\t\t// A non-null assertion is required since we\n\t\t\t\t// can't statically know if an alt attribute is\n\t\t\t\t// available.\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\t\talt={(alt ?? (field.alt || fallbackAlt))!}\n\t\t\t\tfill={fill}\n\t\t\t\tloader={imgixLoader}\n\t\t\t\t{...restProps}\n\t\t\t/>\n\t\t);\n\t} else {\n\t\treturn <>{fallback}</>;\n\t}\n};\n"],"names":["castInt","input","parsed","Number","parseInt","isNaN","undefined","PrismicNextImage","field","imgixParams","alt","fallbackAlt","fill","width","height","fallback","restProps","__PRODUCTION__","console","warn","devMsg","prismicH","isFilled","imageThumbnail","src","buildURL","url","ar","dimensions","castedWidth","castedHeight","resolvedWidth","resolvedHeight","_jsx","Image","loader","imgixLoader","_Fragment","children"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUA,MAAMA,UAAWC,CAA0D,UAAA;AAC1E,MAAI,OAAOA,UAAU,YAAY,OAAOA,UAAU,aAAa;AACvDA,WAAAA;AAAAA,EAAAA,OACD;AACAC,UAAAA,SAASC,OAAOC,SAASH,KAAK;AAEhCE,QAAAA,OAAOE,MAAMH,MAAM,GAAG;AAClBI,aAAAA;AAAAA,IAAAA,OACD;AACCJ,aAAAA;AAAAA,IACP;AAAA,EACD;AACF;AAsDO,MAAMK,mBAAmB,CAAC;AAAA,EAChCC;AAAAA,EACAC,cAAc,CAAE;AAAA,EAChBC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC,WAAW;AAAA,KACRC;AAAS,MAC4B;AACxC,MAAI,CAACC,eAAAA,gBAAgB;AACpB,QAAI,OAAOP,QAAQ,YAAYA,QAAQ,IAAI;AAC1CQ,cAAQC,KACkQ,yQAAAC,OACxQ,OAAA,6BAA6B,GAC3B;AAAA,IAEJ;AAED,QAAI,OAAOT,gBAAgB,YAAYA,gBAAgB,IAAI;AAC1DO,cAAQC,KACkS,ySAAAC,OACxS,OAAA,6BAA6B,GAC3B;AAAA,IAEJ;AAAA,EACD;AAED,MAAIC,oBAASC,SAASC,eAAef,KAAK,GAAG;AAC5C,UAAMgB,MAAMC,gBAAAA,SAASjB,MAAMkB,KAAKjB,WAAW;AAE3C,UAAMkB,KAAKnB,MAAMoB,WAAWf,QAAQL,MAAMoB,WAAWd;AAE/Ce,UAAAA,cAAc7B,QAAQa,KAAK;AAC3BiB,UAAAA,eAAe9B,QAAQc,MAAM;AAE/BiB,QAAAA,gBAAgBF,oCAAerB,MAAMoB,WAAWf;AAChDmB,QAAAA,iBAAiBF,sCAAgBtB,MAAMoB,WAAWf;AAElDgB,QAAAA,eAAe,QAAQC,gBAAgB,MAAM;AAChDE,uBAAiBH,cAAcF;AAAAA,IACrBE,WAAAA,eAAe,QAAQC,gBAAgB,MAAM;AACvDC,sBAAgBD,eAAeH;AAAAA,IAC/B;AAED,WACCM,WAAAA,IAACC,eAAAA,SAAK;AAAA,MACLV;AAAAA,MACAX,OAAOD,OAAON,SAAYyB;AAAAA,MAC1BjB,QAAQF,OAAON,SAAY0B;AAAAA,MAK3BtB,KAAMA,oBAAQF,MAAME,OAAOC;AAAAA,MAC3BC;AAAAA,MACAuB,QAAQC,YAAAA;AAAAA,MACJ,GAAApB;AAAAA,IAAAA,CACH;AAAA,EAAA,OAEG;AACN,WAAOiB,WAAAA,IAAAI,WAAAA,UAAA;AAAA,MAAAC,UAAGvB;AAAAA,IAAAA,CAAQ;AAAA,EAClB;AACF;;"}
1
+ {"version":3,"file":"PrismicNextImage.cjs","sources":["../../src/PrismicNextImage.tsx"],"sourcesContent":["\"use client\";\n\nimport Image, { ImageProps } from \"next/image\";\nimport { buildURL, ImgixURLParams } from \"imgix-url-builder\";\nimport * as prismic from \"@prismicio/client\";\n\nimport { __PRODUCTION__ } from \"./lib/__PRODUCTION__\";\nimport { devMsg } from \"./lib/devMsg\";\n\nimport { imgixLoader } from \"./imgixLoader\";\n\nconst castInt = (input: string | number | undefined): number | undefined => {\n\tif (typeof input === \"number\" || typeof input === \"undefined\") {\n\t\treturn input;\n\t} else {\n\t\tconst parsed = Number.parseInt(input);\n\n\t\tif (Number.isNaN(parsed)) {\n\t\t\treturn undefined;\n\t\t} else {\n\t\t\treturn parsed;\n\t\t}\n\t}\n};\n\nexport type PrismicNextImageProps = Omit<ImageProps, \"src\" | \"alt\"> & {\n\t/**\n\t * The Prismic Image field or thumbnail to render.\n\t */\n\tfield: prismic.ImageFieldImage | null | undefined;\n\n\t/**\n\t * An object of Imgix URL API parameters to transform the image.\n\t *\n\t * @see https://docs.imgix.com/apis/rendering\n\t */\n\timgixParams?: ImgixURLParams;\n\n\t/**\n\t * Declare an image as decorative by providing `alt=\"\"`.\n\t *\n\t * See:\n\t * https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/alt#decorative_images\n\t */\n\talt?: \"\";\n\n\t/**\n\t * Declare an image as decorative only if the Image field does not have\n\t * alternative text by providing `fallbackAlt=\"\"`.\n\t *\n\t * See:\n\t * https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/alt#decorative_images\n\t */\n\tfallbackAlt?: \"\";\n\n\t/**\n\t * Rendered when the field is empty. If a fallback is not given, `null` will\n\t * be rendered.\n\t */\n\tfallback?: React.ReactNode;\n};\n\n/**\n * React component that renders an image from a Prismic Image field or one of\n * its thumbnails using `next/image`. It will automatically set the `alt`\n * attribute using the Image field's `alt` property.\n *\n * It uses an Imgix URL-based loader by default. A custom loader can be provided\n * with the `loader` prop. If you would like to use the Next.js Image\n * Optimization API instead, set `loader={undefined}`.\n *\n * @param props - Props for the component.\n *\n * @returns A responsive image component using `next/image` for the given Image\n * field.\n * @see To learn more about `next/image`, see: https://nextjs.org/docs/api-reference/next/image\n */\nexport const PrismicNextImage = ({\n\tfield,\n\timgixParams = {},\n\talt,\n\tfallbackAlt,\n\tfill,\n\twidth,\n\theight,\n\tfallback = null,\n\t...restProps\n}: PrismicNextImageProps): JSX.Element => {\n\tif (!__PRODUCTION__) {\n\t\tif (typeof alt === \"string\" && alt !== \"\") {\n\t\t\tconsole.warn(\n\t\t\t\t`[PrismicNextImage] The \"alt\" prop can only be used to declare an image as decorative by passing an empty string (alt=\"\") but was provided a non-empty string. You can resolve this warning by removing the \"alt\" prop or changing it to alt=\"\". For more details, see ${devMsg(\n\t\t\t\t\t\"alt-must-be-an-empty-string\",\n\t\t\t\t)}`,\n\t\t\t);\n\t\t}\n\n\t\tif (typeof fallbackAlt === \"string\" && fallbackAlt !== \"\") {\n\t\t\tconsole.warn(\n\t\t\t\t`[PrismicNextImage] The \"fallbackAlt\" prop can only be used to declare an image as decorative by passing an empty string (fallbackAlt=\"\") but was provided a non-empty string. You can resolve this warning by removing the \"fallbackAlt\" prop or changing it to fallbackAlt=\"\". For more details, see ${devMsg(\n\t\t\t\t\t\"alt-must-be-an-empty-string\",\n\t\t\t\t)}`,\n\t\t\t);\n\t\t}\n\t}\n\n\tif (prismic.isFilled.imageThumbnail(field)) {\n\t\tconst src = buildURL(field.url, imgixParams);\n\n\t\tconst ar = field.dimensions.width / field.dimensions.height;\n\n\t\tconst castedWidth = castInt(width);\n\t\tconst castedHeight = castInt(height);\n\n\t\tlet resolvedWidth = castedWidth ?? field.dimensions.width;\n\t\tlet resolvedHeight = castedHeight ?? field.dimensions.height;\n\n\t\tif (castedWidth != null && castedHeight == null) {\n\t\t\tresolvedHeight = castedWidth / ar;\n\t\t} else if (castedWidth == null && castedHeight != null) {\n\t\t\tresolvedWidth = castedHeight * ar;\n\t\t}\n\n\t\treturn (\n\t\t\t<Image\n\t\t\t\tsrc={src}\n\t\t\t\twidth={fill ? undefined : resolvedWidth}\n\t\t\t\theight={fill ? undefined : resolvedHeight}\n\t\t\t\t// A non-null assertion is required since we\n\t\t\t\t// can't statically know if an alt attribute is\n\t\t\t\t// available.\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\t\talt={(alt ?? (field.alt || fallbackAlt))!}\n\t\t\t\tfill={fill}\n\t\t\t\tloader={imgixLoader}\n\t\t\t\t{...restProps}\n\t\t\t/>\n\t\t);\n\t} else {\n\t\treturn <>{fallback}</>;\n\t}\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAWA;AACC;AACQ;AAAA;AAED;AAEF;AACI;AAAA;AAEA;AAAA;AACP;AAEH;AAsDO;AAWN;AACC;AACC;AAGI;AAIL;AACC;AAGI;AAEJ;AAGF;AACC;AAEA;AAEM;AACA;AAEF;AACA;AAEA;AACH;AAA+B;AAE/B;AAA+B;AAGhC;AACO;AACL;AAC0B;AACC;AAAA;AAAA;AAAA;AAAA;AAKA;AAC3B;AACQ;AACJ;AACH;AAGH;AAAkB;AAEpB;;"}
@@ -1,12 +1,12 @@
1
1
  /// <reference types="react" />
2
2
  import { ImageProps } from "next/image";
3
3
  import { ImgixURLParams } from "imgix-url-builder";
4
- import * as prismicT from "@prismicio/types";
5
- export declare type PrismicNextImageProps = Omit<ImageProps, "src" | "alt"> & {
4
+ import * as prismic from "@prismicio/client";
5
+ export type PrismicNextImageProps = Omit<ImageProps, "src" | "alt"> & {
6
6
  /**
7
7
  * The Prismic Image field or thumbnail to render.
8
8
  */
9
- field: prismicT.ImageFieldImage | null | undefined;
9
+ field: prismic.ImageFieldImage | null | undefined;
10
10
  /**
11
11
  * An object of Imgix URL API parameters to transform the image.
12
12
  *
@@ -1,7 +1,9 @@
1
+ 'use client';
2
+ 'use client';
1
3
  import { jsx, Fragment } from "react/jsx-runtime";
2
4
  import Image from "next/image";
3
5
  import { buildURL } from "imgix-url-builder";
4
- import * as prismicH from "@prismicio/helpers";
6
+ import * as prismic from "@prismicio/client";
5
7
  import { __PRODUCTION__ } from "./lib/__PRODUCTION__.js";
6
8
  import { devMsg } from "./lib/devMsg.js";
7
9
  import { imgixLoader } from "./imgixLoader.js";
@@ -17,17 +19,7 @@ const castInt = (input) => {
17
19
  }
18
20
  }
19
21
  };
20
- const PrismicNextImage = ({
21
- field,
22
- imgixParams = {},
23
- alt,
24
- fallbackAlt,
25
- fill,
26
- width,
27
- height,
28
- fallback = null,
29
- ...restProps
30
- }) => {
22
+ const PrismicNextImage = ({ field, imgixParams = {}, alt, fallbackAlt, fill, width, height, fallback = null, ...restProps }) => {
31
23
  if (!__PRODUCTION__) {
32
24
  if (typeof alt === "string" && alt !== "") {
33
25
  console.warn(`[PrismicNextImage] The "alt" prop can only be used to declare an image as decorative by passing an empty string (alt="") but was provided a non-empty string. You can resolve this warning by removing the "alt" prop or changing it to alt="". For more details, see ${devMsg("alt-must-be-an-empty-string")}`);
@@ -36,13 +28,13 @@ const PrismicNextImage = ({
36
28
  console.warn(`[PrismicNextImage] The "fallbackAlt" prop can only be used to declare an image as decorative by passing an empty string (fallbackAlt="") but was provided a non-empty string. You can resolve this warning by removing the "fallbackAlt" prop or changing it to fallbackAlt="". For more details, see ${devMsg("alt-must-be-an-empty-string")}`);
37
29
  }
38
30
  }
39
- if (prismicH.isFilled.imageThumbnail(field)) {
31
+ if (prismic.isFilled.imageThumbnail(field)) {
40
32
  const src = buildURL(field.url, imgixParams);
41
33
  const ar = field.dimensions.width / field.dimensions.height;
42
34
  const castedWidth = castInt(width);
43
35
  const castedHeight = castInt(height);
44
- let resolvedWidth = castedWidth != null ? castedWidth : field.dimensions.width;
45
- let resolvedHeight = castedHeight != null ? castedHeight : field.dimensions.width;
36
+ let resolvedWidth = castedWidth ?? field.dimensions.width;
37
+ let resolvedHeight = castedHeight ?? field.dimensions.height;
46
38
  if (castedWidth != null && castedHeight == null) {
47
39
  resolvedHeight = castedWidth / ar;
48
40
  } else if (castedWidth == null && castedHeight != null) {
@@ -52,15 +44,17 @@ const PrismicNextImage = ({
52
44
  src,
53
45
  width: fill ? void 0 : resolvedWidth,
54
46
  height: fill ? void 0 : resolvedHeight,
55
- alt: alt != null ? alt : field.alt || fallbackAlt,
47
+ // A non-null assertion is required since we
48
+ // can't statically know if an alt attribute is
49
+ // available.
50
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
51
+ alt: alt ?? (field.alt || fallbackAlt),
56
52
  fill,
57
53
  loader: imgixLoader,
58
54
  ...restProps
59
55
  });
60
56
  } else {
61
- return jsx(Fragment, {
62
- children: fallback
63
- });
57
+ return jsx(Fragment, { children: fallback });
64
58
  }
65
59
  };
66
60
  export {
@@ -1 +1 @@
1
- {"version":3,"file":"PrismicNextImage.js","sources":["../src/PrismicNextImage.tsx"],"sourcesContent":["import Image, { ImageProps } from \"next/image\";\nimport { buildURL, ImgixURLParams } from \"imgix-url-builder\";\nimport * as prismicH from \"@prismicio/helpers\";\nimport * as prismicT from \"@prismicio/types\";\n\nimport { __PRODUCTION__ } from \"./lib/__PRODUCTION__\";\nimport { devMsg } from \"./lib/devMsg\";\n\nimport { imgixLoader } from \"./imgixLoader\";\n\nconst castInt = (input: string | number | undefined): number | undefined => {\n\tif (typeof input === \"number\" || typeof input === \"undefined\") {\n\t\treturn input;\n\t} else {\n\t\tconst parsed = Number.parseInt(input);\n\n\t\tif (Number.isNaN(parsed)) {\n\t\t\treturn undefined;\n\t\t} else {\n\t\t\treturn parsed;\n\t\t}\n\t}\n};\n\nexport type PrismicNextImageProps = Omit<ImageProps, \"src\" | \"alt\"> & {\n\t/**\n\t * The Prismic Image field or thumbnail to render.\n\t */\n\tfield: prismicT.ImageFieldImage | null | undefined;\n\n\t/**\n\t * An object of Imgix URL API parameters to transform the image.\n\t *\n\t * @see https://docs.imgix.com/apis/rendering\n\t */\n\timgixParams?: ImgixURLParams;\n\n\t/**\n\t * Declare an image as decorative by providing `alt=\"\"`.\n\t *\n\t * See:\n\t * https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/alt#decorative_images\n\t */\n\talt?: \"\";\n\n\t/**\n\t * Declare an image as decorative only if the Image field does not have\n\t * alternative text by providing `fallbackAlt=\"\"`.\n\t *\n\t * See:\n\t * https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/alt#decorative_images\n\t */\n\tfallbackAlt?: \"\";\n\n\t/**\n\t * Rendered when the field is empty. If a fallback is not given, `null` will\n\t * be rendered.\n\t */\n\tfallback?: React.ReactNode;\n};\n\n/**\n * React component that renders an image from a Prismic Image field or one of\n * its thumbnails using `next/image`. It will automatically set the `alt`\n * attribute using the Image field's `alt` property.\n *\n * It uses an Imgix URL-based loader by default. A custom loader can be provided\n * with the `loader` prop. If you would like to use the Next.js Image\n * Optimization API instead, set `loader={undefined}`.\n *\n * @param props - Props for the component.\n *\n * @returns A responsive image component using `next/image` for the given Image\n * field.\n * @see To learn more about `next/image`, see: https://nextjs.org/docs/api-reference/next/image\n */\nexport const PrismicNextImage = ({\n\tfield,\n\timgixParams = {},\n\talt,\n\tfallbackAlt,\n\tfill,\n\twidth,\n\theight,\n\tfallback = null,\n\t...restProps\n}: PrismicNextImageProps): JSX.Element => {\n\tif (!__PRODUCTION__) {\n\t\tif (typeof alt === \"string\" && alt !== \"\") {\n\t\t\tconsole.warn(\n\t\t\t\t`[PrismicNextImage] The \"alt\" prop can only be used to declare an image as decorative by passing an empty string (alt=\"\") but was provided a non-empty string. You can resolve this warning by removing the \"alt\" prop or changing it to alt=\"\". For more details, see ${devMsg(\n\t\t\t\t\t\"alt-must-be-an-empty-string\",\n\t\t\t\t)}`,\n\t\t\t);\n\t\t}\n\n\t\tif (typeof fallbackAlt === \"string\" && fallbackAlt !== \"\") {\n\t\t\tconsole.warn(\n\t\t\t\t`[PrismicNextImage] The \"fallbackAlt\" prop can only be used to declare an image as decorative by passing an empty string (fallbackAlt=\"\") but was provided a non-empty string. You can resolve this warning by removing the \"fallbackAlt\" prop or changing it to fallbackAlt=\"\". For more details, see ${devMsg(\n\t\t\t\t\t\"alt-must-be-an-empty-string\",\n\t\t\t\t)}`,\n\t\t\t);\n\t\t}\n\t}\n\n\tif (prismicH.isFilled.imageThumbnail(field)) {\n\t\tconst src = buildURL(field.url, imgixParams);\n\n\t\tconst ar = field.dimensions.width / field.dimensions.height;\n\n\t\tconst castedWidth = castInt(width);\n\t\tconst castedHeight = castInt(height);\n\n\t\tlet resolvedWidth = castedWidth ?? field.dimensions.width;\n\t\tlet resolvedHeight = castedHeight ?? field.dimensions.width;\n\n\t\tif (castedWidth != null && castedHeight == null) {\n\t\t\tresolvedHeight = castedWidth / ar;\n\t\t} else if (castedWidth == null && castedHeight != null) {\n\t\t\tresolvedWidth = castedHeight * ar;\n\t\t}\n\n\t\treturn (\n\t\t\t<Image\n\t\t\t\tsrc={src}\n\t\t\t\twidth={fill ? undefined : resolvedWidth}\n\t\t\t\theight={fill ? undefined : resolvedHeight}\n\t\t\t\t// A non-null assertion is required since we\n\t\t\t\t// can't statically know if an alt attribute is\n\t\t\t\t// available.\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\t\talt={(alt ?? (field.alt || fallbackAlt))!}\n\t\t\t\tfill={fill}\n\t\t\t\tloader={imgixLoader}\n\t\t\t\t{...restProps}\n\t\t\t/>\n\t\t);\n\t} else {\n\t\treturn <>{fallback}</>;\n\t}\n};\n"],"names":["castInt","input","parsed","Number","parseInt","isNaN","undefined","PrismicNextImage","field","imgixParams","alt","fallbackAlt","fill","width","height","fallback","restProps","__PRODUCTION__","console","warn","devMsg","prismicH","isFilled","imageThumbnail","src","buildURL","url","ar","dimensions","castedWidth","castedHeight","resolvedWidth","resolvedHeight","_jsx","Image","loader","imgixLoader","_Fragment","children"],"mappings":";;;;;;;AAUA,MAAMA,UAAWC,CAA0D,UAAA;AAC1E,MAAI,OAAOA,UAAU,YAAY,OAAOA,UAAU,aAAa;AACvDA,WAAAA;AAAAA,EAAAA,OACD;AACAC,UAAAA,SAASC,OAAOC,SAASH,KAAK;AAEhCE,QAAAA,OAAOE,MAAMH,MAAM,GAAG;AAClBI,aAAAA;AAAAA,IAAAA,OACD;AACCJ,aAAAA;AAAAA,IACP;AAAA,EACD;AACF;AAsDO,MAAMK,mBAAmB,CAAC;AAAA,EAChCC;AAAAA,EACAC,cAAc,CAAE;AAAA,EAChBC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC,WAAW;AAAA,KACRC;AAAS,MAC4B;AACxC,MAAI,CAACC,gBAAgB;AACpB,QAAI,OAAOP,QAAQ,YAAYA,QAAQ,IAAI;AAC1CQ,cAAQC,KACkQ,yQAAAC,OACxQ,6BAA6B,GAC3B;AAAA,IAEJ;AAED,QAAI,OAAOT,gBAAgB,YAAYA,gBAAgB,IAAI;AAC1DO,cAAQC,KACkS,ySAAAC,OACxS,6BAA6B,GAC3B;AAAA,IAEJ;AAAA,EACD;AAED,MAAIC,SAASC,SAASC,eAAef,KAAK,GAAG;AAC5C,UAAMgB,MAAMC,SAASjB,MAAMkB,KAAKjB,WAAW;AAE3C,UAAMkB,KAAKnB,MAAMoB,WAAWf,QAAQL,MAAMoB,WAAWd;AAE/Ce,UAAAA,cAAc7B,QAAQa,KAAK;AAC3BiB,UAAAA,eAAe9B,QAAQc,MAAM;AAE/BiB,QAAAA,gBAAgBF,oCAAerB,MAAMoB,WAAWf;AAChDmB,QAAAA,iBAAiBF,sCAAgBtB,MAAMoB,WAAWf;AAElDgB,QAAAA,eAAe,QAAQC,gBAAgB,MAAM;AAChDE,uBAAiBH,cAAcF;AAAAA,IACrBE,WAAAA,eAAe,QAAQC,gBAAgB,MAAM;AACvDC,sBAAgBD,eAAeH;AAAAA,IAC/B;AAED,WACCM,IAACC,OAAK;AAAA,MACLV;AAAAA,MACAX,OAAOD,OAAON,SAAYyB;AAAAA,MAC1BjB,QAAQF,OAAON,SAAY0B;AAAAA,MAK3BtB,KAAMA,oBAAQF,MAAME,OAAOC;AAAAA,MAC3BC;AAAAA,MACAuB,QAAQC;AAAAA,MACJ,GAAApB;AAAAA,IAAAA,CACH;AAAA,EAAA,OAEG;AACN,WAAOiB,IAAAI,UAAA;AAAA,MAAAC,UAAGvB;AAAAA,IAAAA,CAAQ;AAAA,EAClB;AACF;"}
1
+ {"version":3,"file":"PrismicNextImage.js","sources":["../../src/PrismicNextImage.tsx"],"sourcesContent":["\"use client\";\n\nimport Image, { ImageProps } from \"next/image\";\nimport { buildURL, ImgixURLParams } from \"imgix-url-builder\";\nimport * as prismic from \"@prismicio/client\";\n\nimport { __PRODUCTION__ } from \"./lib/__PRODUCTION__\";\nimport { devMsg } from \"./lib/devMsg\";\n\nimport { imgixLoader } from \"./imgixLoader\";\n\nconst castInt = (input: string | number | undefined): number | undefined => {\n\tif (typeof input === \"number\" || typeof input === \"undefined\") {\n\t\treturn input;\n\t} else {\n\t\tconst parsed = Number.parseInt(input);\n\n\t\tif (Number.isNaN(parsed)) {\n\t\t\treturn undefined;\n\t\t} else {\n\t\t\treturn parsed;\n\t\t}\n\t}\n};\n\nexport type PrismicNextImageProps = Omit<ImageProps, \"src\" | \"alt\"> & {\n\t/**\n\t * The Prismic Image field or thumbnail to render.\n\t */\n\tfield: prismic.ImageFieldImage | null | undefined;\n\n\t/**\n\t * An object of Imgix URL API parameters to transform the image.\n\t *\n\t * @see https://docs.imgix.com/apis/rendering\n\t */\n\timgixParams?: ImgixURLParams;\n\n\t/**\n\t * Declare an image as decorative by providing `alt=\"\"`.\n\t *\n\t * See:\n\t * https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/alt#decorative_images\n\t */\n\talt?: \"\";\n\n\t/**\n\t * Declare an image as decorative only if the Image field does not have\n\t * alternative text by providing `fallbackAlt=\"\"`.\n\t *\n\t * See:\n\t * https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/alt#decorative_images\n\t */\n\tfallbackAlt?: \"\";\n\n\t/**\n\t * Rendered when the field is empty. If a fallback is not given, `null` will\n\t * be rendered.\n\t */\n\tfallback?: React.ReactNode;\n};\n\n/**\n * React component that renders an image from a Prismic Image field or one of\n * its thumbnails using `next/image`. It will automatically set the `alt`\n * attribute using the Image field's `alt` property.\n *\n * It uses an Imgix URL-based loader by default. A custom loader can be provided\n * with the `loader` prop. If you would like to use the Next.js Image\n * Optimization API instead, set `loader={undefined}`.\n *\n * @param props - Props for the component.\n *\n * @returns A responsive image component using `next/image` for the given Image\n * field.\n * @see To learn more about `next/image`, see: https://nextjs.org/docs/api-reference/next/image\n */\nexport const PrismicNextImage = ({\n\tfield,\n\timgixParams = {},\n\talt,\n\tfallbackAlt,\n\tfill,\n\twidth,\n\theight,\n\tfallback = null,\n\t...restProps\n}: PrismicNextImageProps): JSX.Element => {\n\tif (!__PRODUCTION__) {\n\t\tif (typeof alt === \"string\" && alt !== \"\") {\n\t\t\tconsole.warn(\n\t\t\t\t`[PrismicNextImage] The \"alt\" prop can only be used to declare an image as decorative by passing an empty string (alt=\"\") but was provided a non-empty string. You can resolve this warning by removing the \"alt\" prop or changing it to alt=\"\". For more details, see ${devMsg(\n\t\t\t\t\t\"alt-must-be-an-empty-string\",\n\t\t\t\t)}`,\n\t\t\t);\n\t\t}\n\n\t\tif (typeof fallbackAlt === \"string\" && fallbackAlt !== \"\") {\n\t\t\tconsole.warn(\n\t\t\t\t`[PrismicNextImage] The \"fallbackAlt\" prop can only be used to declare an image as decorative by passing an empty string (fallbackAlt=\"\") but was provided a non-empty string. You can resolve this warning by removing the \"fallbackAlt\" prop or changing it to fallbackAlt=\"\". For more details, see ${devMsg(\n\t\t\t\t\t\"alt-must-be-an-empty-string\",\n\t\t\t\t)}`,\n\t\t\t);\n\t\t}\n\t}\n\n\tif (prismic.isFilled.imageThumbnail(field)) {\n\t\tconst src = buildURL(field.url, imgixParams);\n\n\t\tconst ar = field.dimensions.width / field.dimensions.height;\n\n\t\tconst castedWidth = castInt(width);\n\t\tconst castedHeight = castInt(height);\n\n\t\tlet resolvedWidth = castedWidth ?? field.dimensions.width;\n\t\tlet resolvedHeight = castedHeight ?? field.dimensions.height;\n\n\t\tif (castedWidth != null && castedHeight == null) {\n\t\t\tresolvedHeight = castedWidth / ar;\n\t\t} else if (castedWidth == null && castedHeight != null) {\n\t\t\tresolvedWidth = castedHeight * ar;\n\t\t}\n\n\t\treturn (\n\t\t\t<Image\n\t\t\t\tsrc={src}\n\t\t\t\twidth={fill ? undefined : resolvedWidth}\n\t\t\t\theight={fill ? undefined : resolvedHeight}\n\t\t\t\t// A non-null assertion is required since we\n\t\t\t\t// can't statically know if an alt attribute is\n\t\t\t\t// available.\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\t\talt={(alt ?? (field.alt || fallbackAlt))!}\n\t\t\t\tfill={fill}\n\t\t\t\tloader={imgixLoader}\n\t\t\t\t{...restProps}\n\t\t\t/>\n\t\t);\n\t} else {\n\t\treturn <>{fallback}</>;\n\t}\n};\n"],"names":[],"mappings":";;;;;;;;;AAWA;AACC;AACQ;AAAA;AAED;AAEF;AACI;AAAA;AAEA;AAAA;AACP;AAEH;AAsDO;AAWN;AACC;AACC;AAGI;AAIL;AACC;AAGI;AAEJ;AAGF;AACC;AAEA;AAEM;AACA;AAEF;AACA;AAEA;AACH;AAA+B;AAE/B;AAA+B;AAGhC;AACO;AACL;AAC0B;AACC;AAAA;AAAA;AAAA;AAAA;AAKA;AAC3B;AACQ;AACJ;AACH;AAGH;AAAkB;AAEpB;;;;"}
@@ -0,0 +1,40 @@
1
+ 'use client';
2
+ 'use client';
3
+ "use strict";
4
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
5
+ const jsxRuntime = require("react/jsx-runtime");
6
+ const React = require("react");
7
+ const prismic = require("@prismicio/client");
8
+ const Link = require("next/link");
9
+ function _interopNamespaceDefault(e) {
10
+ const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
11
+ if (e) {
12
+ for (const k in e) {
13
+ if (k !== "default") {
14
+ const d = Object.getOwnPropertyDescriptor(e, k);
15
+ Object.defineProperty(n, k, d.get ? d : {
16
+ enumerable: true,
17
+ get: () => e[k]
18
+ });
19
+ }
20
+ }
21
+ }
22
+ n.default = e;
23
+ return Object.freeze(n);
24
+ }
25
+ const React__namespace = /* @__PURE__ */ _interopNamespaceDefault(React);
26
+ const prismic__namespace = /* @__PURE__ */ _interopNamespaceDefault(prismic);
27
+ const PrismicNextLink = React__namespace.forwardRef(function PrismicNextLink2({ field, document, linkResolver, ...restProps }, ref) {
28
+ const { href: computedHref, rel: computedRel, ...attrs } = prismic__namespace.asLinkAttrs(field ?? document, {
29
+ linkResolver,
30
+ rel: typeof restProps.rel === "function" ? restProps.rel : void 0
31
+ });
32
+ let rel = computedRel;
33
+ if ("rel" in restProps && typeof restProps.rel !== "function") {
34
+ rel = restProps.rel;
35
+ }
36
+ const href = ("href" in restProps ? restProps.href : computedHref) || "";
37
+ return jsxRuntime.jsx(Link, { ref, ...attrs, ...restProps, href, rel });
38
+ });
39
+ exports.PrismicNextLink = PrismicNextLink;
40
+ //# sourceMappingURL=PrismicNextLink.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PrismicNextLink.cjs","sources":["../../src/PrismicNextLink.tsx"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport * as prismic from \"@prismicio/client\";\nimport Link, { LinkProps } from \"next/link\";\n\nexport type PrismicNextLinkProps = Omit<\n\tReact.ComponentProps<typeof Link>,\n\t\"field\" | \"document\" | \"href\" | \"rel\"\n> & {\n\tlinkResolver?: prismic.LinkResolverFunction;\n\trel?: string | prismic.AsLinkAttrsConfig[\"rel\"];\n} & (\n\t\t| {\n\t\t\t\tdocument: prismic.PrismicDocument | null | undefined;\n\t\t\t\thref?: never;\n\t\t\t\tfield?: never;\n\t\t }\n\t\t| {\n\t\t\t\tfield: prismic.LinkField | null | undefined;\n\t\t\t\thref?: never;\n\t\t\t\tdocument?: never;\n\t\t }\n\t\t| {\n\t\t\t\thref: LinkProps[\"href\"];\n\t\t\t\tfield?: prismic.LinkField | null | undefined;\n\t\t\t\tdocument?: never;\n\t\t }\n\t);\n\nexport const PrismicNextLink = React.forwardRef<\n\tHTMLAnchorElement,\n\tPrismicNextLinkProps\n>(function PrismicNextLink(\n\t{ field, document, linkResolver, ...restProps },\n\tref,\n): JSX.Element | null {\n\tconst {\n\t\thref: computedHref,\n\t\trel: computedRel,\n\t\t...attrs\n\t} = prismic.asLinkAttrs(field ?? document, {\n\t\tlinkResolver,\n\t\trel: typeof restProps.rel === \"function\" ? restProps.rel : undefined,\n\t});\n\n\tlet rel: string | undefined = computedRel;\n\tif (\"rel\" in restProps && typeof restProps.rel !== \"function\") {\n\t\trel = restProps.rel;\n\t}\n\n\tconst href = (\"href\" in restProps ? restProps.href : computedHref) || \"\";\n\n\treturn <Link ref={ref} {...attrs} {...restProps} href={href} rel={rel} />;\n});\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AA8BO;AAOA;AAIqC;AAC1C;AAC2D;AAG5D;AACA;AACC;AAAgB;AAGjB;AAEO;AACR;;"}
@@ -0,0 +1,126 @@
1
+ /// <reference types="node" />
2
+ import * as React from "react";
3
+ import * as prismic from "@prismicio/client";
4
+ import Link, { LinkProps } from "next/link";
5
+ export type PrismicNextLinkProps = Omit<React.ComponentProps<typeof Link>, "field" | "document" | "href" | "rel"> & {
6
+ linkResolver?: prismic.LinkResolverFunction;
7
+ rel?: string | prismic.AsLinkAttrsConfig["rel"];
8
+ } & ({
9
+ document: prismic.PrismicDocument | null | undefined;
10
+ href?: never;
11
+ field?: never;
12
+ } | {
13
+ field: prismic.LinkField | null | undefined;
14
+ href?: never;
15
+ document?: never;
16
+ } | {
17
+ href: LinkProps["href"];
18
+ field?: prismic.LinkField | null | undefined;
19
+ document?: never;
20
+ });
21
+ export declare const PrismicNextLink: React.ForwardRefExoticComponent<(Pick<Omit<Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, keyof {
22
+ href: string | import("url").UrlObject;
23
+ as?: (string | import("url").UrlObject) | undefined;
24
+ replace?: boolean | undefined;
25
+ scroll?: boolean | undefined;
26
+ shallow?: boolean | undefined;
27
+ passHref?: boolean | undefined;
28
+ prefetch?: boolean | undefined;
29
+ locale?: string | false | undefined;
30
+ legacyBehavior?: boolean | undefined;
31
+ onMouseEnter?: React.MouseEventHandler<HTMLAnchorElement> | undefined;
32
+ onTouchStart?: React.TouchEventHandler<HTMLAnchorElement> | undefined;
33
+ onClick?: React.MouseEventHandler<HTMLAnchorElement> | undefined;
34
+ }> & {
35
+ href: string | import("url").UrlObject;
36
+ as?: (string | import("url").UrlObject) | undefined;
37
+ replace?: boolean | undefined;
38
+ scroll?: boolean | undefined;
39
+ shallow?: boolean | undefined;
40
+ passHref?: boolean | undefined;
41
+ prefetch?: boolean | undefined;
42
+ locale?: string | false | undefined;
43
+ legacyBehavior?: boolean | undefined;
44
+ onMouseEnter?: React.MouseEventHandler<HTMLAnchorElement> | undefined;
45
+ onTouchStart?: React.TouchEventHandler<HTMLAnchorElement> | undefined;
46
+ onClick?: React.MouseEventHandler<HTMLAnchorElement> | undefined;
47
+ } & {
48
+ children?: React.ReactNode;
49
+ } & React.RefAttributes<HTMLAnchorElement>, "field" | "document" | "href" | "rel"> & {
50
+ linkResolver?: prismic.LinkResolverFunction | undefined;
51
+ rel?: string | prismic.AsLinkAttrsConfig["rel"];
52
+ } & {
53
+ document: prismic.PrismicDocument | null | undefined;
54
+ href?: undefined;
55
+ field?: undefined;
56
+ }, "key" | "referrerPolicy" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "nonce" | "placeholder" | "slot" | "spellCheck" | "style" | "tabIndex" | "title" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onResize" | "onResizeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "field" | "replace" | "document" | "href" | "as" | "scroll" | "shallow" | "passHref" | "prefetch" | "locale" | "legacyBehavior" | "download" | "hrefLang" | "media" | "ping" | "rel" | "target" | "type" | "linkResolver"> | Pick<Omit<Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, keyof {
57
+ href: string | import("url").UrlObject;
58
+ as?: (string | import("url").UrlObject) | undefined;
59
+ replace?: boolean | undefined;
60
+ scroll?: boolean | undefined;
61
+ shallow?: boolean | undefined;
62
+ passHref?: boolean | undefined;
63
+ prefetch?: boolean | undefined;
64
+ locale?: string | false | undefined;
65
+ legacyBehavior?: boolean | undefined;
66
+ onMouseEnter?: React.MouseEventHandler<HTMLAnchorElement> | undefined;
67
+ onTouchStart?: React.TouchEventHandler<HTMLAnchorElement> | undefined;
68
+ onClick?: React.MouseEventHandler<HTMLAnchorElement> | undefined;
69
+ }> & {
70
+ href: string | import("url").UrlObject;
71
+ as?: (string | import("url").UrlObject) | undefined;
72
+ replace?: boolean | undefined;
73
+ scroll?: boolean | undefined;
74
+ shallow?: boolean | undefined;
75
+ passHref?: boolean | undefined;
76
+ prefetch?: boolean | undefined;
77
+ locale?: string | false | undefined;
78
+ legacyBehavior?: boolean | undefined;
79
+ onMouseEnter?: React.MouseEventHandler<HTMLAnchorElement> | undefined;
80
+ onTouchStart?: React.TouchEventHandler<HTMLAnchorElement> | undefined;
81
+ onClick?: React.MouseEventHandler<HTMLAnchorElement> | undefined;
82
+ } & {
83
+ children?: React.ReactNode;
84
+ } & React.RefAttributes<HTMLAnchorElement>, "field" | "document" | "href" | "rel"> & {
85
+ linkResolver?: prismic.LinkResolverFunction | undefined;
86
+ rel?: string | prismic.AsLinkAttrsConfig["rel"];
87
+ } & {
88
+ field: prismic.LinkField | null | undefined;
89
+ href?: undefined;
90
+ document?: undefined;
91
+ }, "key" | "referrerPolicy" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "nonce" | "placeholder" | "slot" | "spellCheck" | "style" | "tabIndex" | "title" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onResize" | "onResizeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "field" | "replace" | "document" | "href" | "as" | "scroll" | "shallow" | "passHref" | "prefetch" | "locale" | "legacyBehavior" | "download" | "hrefLang" | "media" | "ping" | "rel" | "target" | "type" | "linkResolver"> | Pick<Omit<Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, keyof {
92
+ href: string | import("url").UrlObject;
93
+ as?: (string | import("url").UrlObject) | undefined;
94
+ replace?: boolean | undefined;
95
+ scroll?: boolean | undefined;
96
+ shallow?: boolean | undefined;
97
+ passHref?: boolean | undefined;
98
+ prefetch?: boolean | undefined;
99
+ locale?: string | false | undefined;
100
+ legacyBehavior?: boolean | undefined;
101
+ onMouseEnter?: React.MouseEventHandler<HTMLAnchorElement> | undefined;
102
+ onTouchStart?: React.TouchEventHandler<HTMLAnchorElement> | undefined;
103
+ onClick?: React.MouseEventHandler<HTMLAnchorElement> | undefined;
104
+ }> & {
105
+ href: string | import("url").UrlObject;
106
+ as?: (string | import("url").UrlObject) | undefined;
107
+ replace?: boolean | undefined;
108
+ scroll?: boolean | undefined;
109
+ shallow?: boolean | undefined;
110
+ passHref?: boolean | undefined;
111
+ prefetch?: boolean | undefined;
112
+ locale?: string | false | undefined;
113
+ legacyBehavior?: boolean | undefined;
114
+ onMouseEnter?: React.MouseEventHandler<HTMLAnchorElement> | undefined;
115
+ onTouchStart?: React.TouchEventHandler<HTMLAnchorElement> | undefined;
116
+ onClick?: React.MouseEventHandler<HTMLAnchorElement> | undefined;
117
+ } & {
118
+ children?: React.ReactNode;
119
+ } & React.RefAttributes<HTMLAnchorElement>, "field" | "document" | "href" | "rel"> & {
120
+ linkResolver?: prismic.LinkResolverFunction | undefined;
121
+ rel?: string | prismic.AsLinkAttrsConfig["rel"];
122
+ } & {
123
+ href: LinkProps["href"];
124
+ field?: prismic.LinkField | null | undefined;
125
+ document?: undefined;
126
+ }, "key" | "referrerPolicy" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "nonce" | "placeholder" | "slot" | "spellCheck" | "style" | "tabIndex" | "title" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onResize" | "onResizeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "field" | "replace" | "document" | "href" | "as" | "scroll" | "shallow" | "passHref" | "prefetch" | "locale" | "legacyBehavior" | "download" | "hrefLang" | "media" | "ping" | "rel" | "target" | "type" | "linkResolver">) & React.RefAttributes<HTMLAnchorElement>>;
@@ -0,0 +1,22 @@
1
+ 'use client';
2
+ 'use client';
3
+ import { jsx } from "react/jsx-runtime";
4
+ import * as React from "react";
5
+ import * as prismic from "@prismicio/client";
6
+ import Link from "next/link";
7
+ const PrismicNextLink = React.forwardRef(function PrismicNextLink2({ field, document, linkResolver, ...restProps }, ref) {
8
+ const { href: computedHref, rel: computedRel, ...attrs } = prismic.asLinkAttrs(field ?? document, {
9
+ linkResolver,
10
+ rel: typeof restProps.rel === "function" ? restProps.rel : void 0
11
+ });
12
+ let rel = computedRel;
13
+ if ("rel" in restProps && typeof restProps.rel !== "function") {
14
+ rel = restProps.rel;
15
+ }
16
+ const href = ("href" in restProps ? restProps.href : computedHref) || "";
17
+ return jsx(Link, { ref, ...attrs, ...restProps, href, rel });
18
+ });
19
+ export {
20
+ PrismicNextLink
21
+ };
22
+ //# sourceMappingURL=PrismicNextLink.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PrismicNextLink.js","sources":["../../src/PrismicNextLink.tsx"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport * as prismic from \"@prismicio/client\";\nimport Link, { LinkProps } from \"next/link\";\n\nexport type PrismicNextLinkProps = Omit<\n\tReact.ComponentProps<typeof Link>,\n\t\"field\" | \"document\" | \"href\" | \"rel\"\n> & {\n\tlinkResolver?: prismic.LinkResolverFunction;\n\trel?: string | prismic.AsLinkAttrsConfig[\"rel\"];\n} & (\n\t\t| {\n\t\t\t\tdocument: prismic.PrismicDocument | null | undefined;\n\t\t\t\thref?: never;\n\t\t\t\tfield?: never;\n\t\t }\n\t\t| {\n\t\t\t\tfield: prismic.LinkField | null | undefined;\n\t\t\t\thref?: never;\n\t\t\t\tdocument?: never;\n\t\t }\n\t\t| {\n\t\t\t\thref: LinkProps[\"href\"];\n\t\t\t\tfield?: prismic.LinkField | null | undefined;\n\t\t\t\tdocument?: never;\n\t\t }\n\t);\n\nexport const PrismicNextLink = React.forwardRef<\n\tHTMLAnchorElement,\n\tPrismicNextLinkProps\n>(function PrismicNextLink(\n\t{ field, document, linkResolver, ...restProps },\n\tref,\n): JSX.Element | null {\n\tconst {\n\t\thref: computedHref,\n\t\trel: computedRel,\n\t\t...attrs\n\t} = prismic.asLinkAttrs(field ?? document, {\n\t\tlinkResolver,\n\t\trel: typeof restProps.rel === \"function\" ? restProps.rel : undefined,\n\t});\n\n\tlet rel: string | undefined = computedRel;\n\tif (\"rel\" in restProps && typeof restProps.rel !== \"function\") {\n\t\trel = restProps.rel;\n\t}\n\n\tconst href = (\"href\" in restProps ? restProps.href : computedHref) || \"\";\n\n\treturn <Link ref={ref} {...attrs} {...restProps} href={href} rel={rel} />;\n});\n"],"names":[],"mappings":";;;;;;AA8BO;AAOA;AAIqC;AAC1C;AAC2D;AAG5D;AACA;AACC;AAAgB;AAGjB;AAEO;AACR;;;;"}
@@ -1,15 +1,14 @@
1
+ 'use client';
2
+ 'use client';
1
3
  "use strict";
2
- Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
4
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
5
  const jsxRuntime = require("react/jsx-runtime");
4
6
  const React = require("react");
5
7
  const router = require("next/router");
6
8
  const Script = require("next/script");
7
9
  const getPrismicPreviewCookie = require("./lib/getPrismicPreviewCookie.cjs");
8
10
  const getPreviewCookieRepositoryName = require("./lib/getPreviewCookieRepositoryName.cjs");
9
- const _interopDefaultLegacy = (e) => e && typeof e === "object" && "default" in e ? e : { default: e };
10
- function _interopNamespace(e) {
11
- if (e && e.__esModule)
12
- return e;
11
+ function _interopNamespaceDefault(e) {
13
12
  const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
14
13
  if (e) {
15
14
  for (const k in e) {
@@ -25,14 +24,8 @@ function _interopNamespace(e) {
25
24
  n.default = e;
26
25
  return Object.freeze(n);
27
26
  }
28
- const React__namespace = /* @__PURE__ */ _interopNamespace(React);
29
- const Script__default = /* @__PURE__ */ _interopDefaultLegacy(Script);
30
- function PrismicPreview({
31
- repositoryName,
32
- children,
33
- updatePreviewURL = "/api/preview",
34
- exitPreviewURL = "/api/exit-preview"
35
- }) {
27
+ const React__namespace = /* @__PURE__ */ _interopNamespaceDefault(React);
28
+ function PrismicPreview({ repositoryName, children, updatePreviewURL = "/api/preview", exitPreviewURL = "/api/exit-preview" }) {
36
29
  const router$1 = router.useRouter();
37
30
  const resolvedUpdatePreviewURL = router$1.basePath + updatePreviewURL;
38
31
  const resolvedExitPreviewURL = router$1.basePath + exitPreviewURL;
@@ -75,13 +68,14 @@ function PrismicPreview({
75
68
  window.removeEventListener("prismicPreviewUpdate", handlePrismicPreviewUpdate);
76
69
  window.removeEventListener("prismicPreviewEnd", handlePrismicPreviewEnd);
77
70
  };
78
- }, [repositoryName, resolvedExitPreviewURL, resolvedUpdatePreviewURL, router$1.isPreview, router$1.basePath]);
79
- return jsxRuntime.jsxs(jsxRuntime.Fragment, {
80
- children: [children, jsxRuntime.jsx(Script__default.default, {
81
- src: `https://static.cdn.prismic.io/prismic.js?repo=${repositoryName}&new=true`,
82
- strategy: "lazyOnload"
83
- })]
84
- });
71
+ }, [
72
+ repositoryName,
73
+ resolvedExitPreviewURL,
74
+ resolvedUpdatePreviewURL,
75
+ router$1.isPreview,
76
+ router$1.basePath
77
+ ]);
78
+ return jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [children, jsxRuntime.jsx(Script, { src: `https://static.cdn.prismic.io/prismic.js?repo=${repositoryName}&new=true`, strategy: "lazyOnload" })] });
85
79
  }
86
80
  exports.PrismicPreview = PrismicPreview;
87
81
  //# sourceMappingURL=PrismicPreview.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"PrismicPreview.cjs","sources":["../src/PrismicPreview.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { useRouter } from \"next/router\";\nimport Script from \"next/script\";\n\nimport { getPrismicPreviewCookie } from \"./lib/getPrismicPreviewCookie\";\nimport { getPreviewCookieRepositoryName } from \"./lib/getPreviewCookieRepositoryName\";\n\n/**\n * Props for `<PrismicPreview>`.\n */\nexport type PrismicPreviewProps = {\n\t/**\n\t * The name of your Prismic repository. A Prismic Toolbar will be registered\n\t * using this repository.\n\t */\n\trepositoryName: string;\n\n\t/**\n\t * The URL of your app's Prismic preview endpoint (default: `/api/preview`).\n\t * This URL will be fetched on preview update events.\n\t *\n\t * **Note**: If your `next.config.js` file contains a `basePath`, it is\n\t * automatically included.\n\t */\n\tupdatePreviewURL?: string;\n\n\t/**\n\t * The URL of your app's exit preview endpoint (default: `/api/exit-preview`).\n\t * This URL will be fetched on preview exit events.\n\t *\n\t * **Note**: If your `next.config.js` file contains a `basePath`, it is\n\t * automatically included.\n\t */\n\texitPreviewURL?: string;\n\n\t/**\n\t * Children to render adjacent to the Prismic Toolbar. The Prismic Toolbar\n\t * will be rendered last.\n\t */\n\tchildren?: React.ReactNode;\n};\n\n/**\n * React component that sets up Prismic Previews using the Prismic Toolbar. When\n * the Prismic Toolbar send events to the browser, such as on preview updates\n * and exiting, this component will automatically update the Next.js preview\n * cookie and refresh the page.\n *\n * This component can be wrapped around your app or added anywhere in your app's\n * tree. It must be rendered on every page.\n */\nexport function PrismicPreview({\n\trepositoryName,\n\tchildren,\n\tupdatePreviewURL = \"/api/preview\",\n\texitPreviewURL = \"/api/exit-preview\",\n}: PrismicPreviewProps): JSX.Element {\n\tconst router = useRouter();\n\n\tconst resolvedUpdatePreviewURL = router.basePath + updatePreviewURL;\n\tconst resolvedExitPreviewURL = router.basePath + exitPreviewURL;\n\n\tReact.useEffect(() => {\n\t\t/**\n\t\t * Starts Preview Mode and refreshes the page's props.\n\t\t */\n\t\tconst startPreviewMode = async () => {\n\t\t\t// Start Next.js Preview Mode via the given preview API endpoint.\n\t\t\tconst res = await globalThis.fetch(resolvedUpdatePreviewURL);\n\n\t\t\t// We check for `res.redirected` rather than `res.ok`\n\t\t\t// since the update preview endpoint may redirect to a\n\t\t\t// 404 page. As long as it redirects, we know the\n\t\t\t// endpoint exists and at least attempted to set\n\t\t\t// preview data.\n\t\t\tif (res.redirected) {\n\t\t\t\tglobalThis.location.reload();\n\t\t\t} else {\n\t\t\t\tconsole.error(\n\t\t\t\t\t`[<PrismicPreview>] Failed to start or update Preview Mode using the \"${resolvedUpdatePreviewURL}\" API endpoint. Does it exist?`,\n\t\t\t\t);\n\t\t\t}\n\t\t};\n\n\t\tconst handlePrismicPreviewUpdate = async (event: Event) => {\n\t\t\t// Prevent the toolbar from reloading the page.\n\t\t\tevent.preventDefault();\n\n\t\t\tawait startPreviewMode();\n\t\t};\n\n\t\tconst handlePrismicPreviewEnd = async (event: Event) => {\n\t\t\t// Prevent the toolbar from reloading the page.\n\t\t\tevent.preventDefault();\n\n\t\t\t// Exit Next.js Preview Mode via the given preview API endpoint.\n\t\t\tconst res = await globalThis.fetch(resolvedExitPreviewURL);\n\n\t\t\tif (res.ok) {\n\t\t\t\tglobalThis.location.reload();\n\t\t\t} else {\n\t\t\t\tconsole.error(\n\t\t\t\t\t`[<PrismicPreview>] Failed to exit Preview Mode using the \"${resolvedExitPreviewURL}\" API endpoint. Does it exist?`,\n\t\t\t\t);\n\t\t\t}\n\t\t};\n\n\t\tif (router.isPreview) {\n\t\t\t// Register Prismic Toolbar event handlers.\n\t\t\twindow.addEventListener(\n\t\t\t\t\"prismicPreviewUpdate\",\n\t\t\t\thandlePrismicPreviewUpdate,\n\t\t\t);\n\t\t\twindow.addEventListener(\"prismicPreviewEnd\", handlePrismicPreviewEnd);\n\t\t} else {\n\t\t\tconst prismicPreviewCookie = getPrismicPreviewCookie(\n\t\t\t\tglobalThis.document.cookie,\n\t\t\t);\n\n\t\t\tif (prismicPreviewCookie) {\n\t\t\t\t// If a Prismic preview cookie is present, but Next.js Preview\n\t\t\t\t// Mode is not active, we must activate Preview Mode manually.\n\t\t\t\t//\n\t\t\t\t// This will happen when a visitor accesses the page using a\n\t\t\t\t// Prismic preview share link.\n\n\t\t\t\t/**\n\t\t\t\t * Determines if the current location is a descendant of the app's base\n\t\t\t\t * path.\n\t\t\t\t *\n\t\t\t\t * This is used to prevent infinite refrehes; when\n\t\t\t\t * `isDescendantOfBasePath` is `false`, `router.isPreview` is also\n\t\t\t\t * `false`.\n\t\t\t\t *\n\t\t\t\t * If the app does not have a base path, this should always be `true`.\n\t\t\t\t */\n\t\t\t\tconst locationIsDescendantOfBasePath = window.location.href.startsWith(\n\t\t\t\t\twindow.location.origin + router.basePath,\n\t\t\t\t);\n\n\t\t\t\tconst prismicPreviewCookieRepositoryName =\n\t\t\t\t\tgetPreviewCookieRepositoryName(prismicPreviewCookie);\n\n\t\t\t\tif (\n\t\t\t\t\tlocationIsDescendantOfBasePath &&\n\t\t\t\t\tprismicPreviewCookieRepositoryName === repositoryName\n\t\t\t\t) {\n\t\t\t\t\tstartPreviewMode();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// On cleanup, unregister Prismic Toolbar event handlers.\n\t\treturn () => {\n\t\t\twindow.removeEventListener(\n\t\t\t\t\"prismicPreviewUpdate\",\n\t\t\t\thandlePrismicPreviewUpdate,\n\t\t\t);\n\t\t\twindow.removeEventListener(\"prismicPreviewEnd\", handlePrismicPreviewEnd);\n\t\t};\n\t}, [\n\t\trepositoryName,\n\t\tresolvedExitPreviewURL,\n\t\tresolvedUpdatePreviewURL,\n\t\trouter.isPreview,\n\t\trouter.basePath,\n\t]);\n\n\treturn (\n\t\t<>\n\t\t\t{children}\n\t\t\t<Script\n\t\t\t\tsrc={`https://static.cdn.prismic.io/prismic.js?repo=${repositoryName}&new=true`}\n\t\t\t\tstrategy=\"lazyOnload\"\n\t\t\t/>\n\t\t</>\n\t);\n}\n"],"names":["PrismicPreview","repositoryName","children","updatePreviewURL","exitPreviewURL","router","useRouter","resolvedUpdatePreviewURL","basePath","resolvedExitPreviewURL","React","useEffect","startPreviewMode","res","globalThis","fetch","redirected","location","reload","error","handlePrismicPreviewUpdate","event","preventDefault","handlePrismicPreviewEnd","ok","isPreview","addEventListener","prismicPreviewCookie","getPrismicPreviewCookie","document","cookie","locationIsDescendantOfBasePath","window","href","startsWith","origin","prismicPreviewCookieRepositoryName","getPreviewCookieRepositoryName","removeEventListener","_jsxs","_Fragment","_jsx","Script","src","strategy"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmDgB,SAAAA,eAAe;AAAA,EAC9BC;AAAAA,EACAC;AAAAA,EACAC,mBAAmB;AAAA,EACnBC,iBAAiB;AACI,GAAA;AACrB,QAAMC,WAASC,OAAAA;AAETC,QAAAA,2BAA2BF,SAAOG,WAAWL;AAC7CM,QAAAA,yBAAyBJ,SAAOG,WAAWJ;AAEjDM,mBAAMC,UAAU,MAAK;AAIpB,UAAMC,mBAAmB,YAAW;AAEnC,YAAMC,MAAM,MAAMC,WAAWC,MAAMR,wBAAwB;AAO3D,UAAIM,IAAIG,YAAY;AACnBF,mBAAWG,SAASC;MAAQ,OACtB;AACEC,gBAAAA,8EACiEZ,wDAAwD;AAAA,MAEjI;AAAA,IAAA;AAGIa,UAAAA,6BAA6B,OAAOC,UAAgB;AAEzDA,YAAMC,eAAgB;AAEtB,YAAMV,iBAAkB;AAAA,IAAA;AAGnBW,UAAAA,0BAA0B,OAAOF,UAAgB;AAEtDA,YAAMC,eAAgB;AAGtB,YAAMT,MAAM,MAAMC,WAAWC,MAAMN,sBAAsB;AAEzD,UAAII,IAAIW,IAAI;AACXV,mBAAWG,SAASC;MAAQ,OACtB;AACEC,gBAAAA,mEACsDV,sDAAsD;AAAA,MAEpH;AAAA,IAAA;AAGF,QAAIJ,SAAOoB,WAAW;AAEdC,aAAAA,iBACN,wBACAN,0BAA0B;AAEpBM,aAAAA,iBAAiB,qBAAqBH,uBAAuB;AAAA,IAAA,OAC9D;AACN,YAAMI,uBAAuBC,wBAAAA,wBAC5Bd,WAAWe,SAASC,MAAM;AAG3B,UAAIH,sBAAsB;AAiBnBI,cAAAA,iCAAiCC,OAAOf,SAASgB,KAAKC,WAC3DF,OAAOf,SAASkB,SAAS9B,SAAOG,QAAQ;AAGnC4B,cAAAA,qCACLC,8DAA+BV,oBAAoB;AAGnDI,YAAAA,kCACAK,uCAAuCnC,gBACtC;AACiB;QAClB;AAAA,MACD;AAAA,IACD;AAGD,WAAO,MAAK;AACJqC,aAAAA,oBACN,wBACAlB,0BAA0B;AAEpBkB,aAAAA,oBAAoB,qBAAqBf,uBAAuB;AAAA,IAAA;AAAA,EACxE,GACE,CACFtB,gBACAQ,wBACAF,0BACAF,SAAOoB,WACPpB,SAAOG,QAAQ,CACf;AAED,SACC+B,WAAAA,KACEC,WAAAA,UAAA;AAAA,IAAAtC,UAAA,CAAAA,UACDuC,WAAAA,IAACC;MACAC,sDAAsD1C;AAAAA,MACtD2C,UAAS;AAAA,IAAA,CACR,CAAA;AAAA,EAAA,CAAA;AAGL;;"}
1
+ {"version":3,"file":"PrismicPreview.cjs","sources":["../../src/PrismicPreview.tsx"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport { useRouter } from \"next/router\";\nimport Script from \"next/script\";\n\nimport { getPrismicPreviewCookie } from \"./lib/getPrismicPreviewCookie\";\nimport { getPreviewCookieRepositoryName } from \"./lib/getPreviewCookieRepositoryName\";\n\n/**\n * Props for `<PrismicPreview>`.\n */\nexport type PrismicPreviewProps = {\n\t/**\n\t * The name of your Prismic repository. A Prismic Toolbar will be registered\n\t * using this repository.\n\t */\n\trepositoryName: string;\n\n\t/**\n\t * The URL of your app's Prismic preview endpoint (default: `/api/preview`).\n\t * This URL will be fetched on preview update events.\n\t *\n\t * **Note**: If your `next.config.js` file contains a `basePath`, it is\n\t * automatically included.\n\t */\n\tupdatePreviewURL?: string;\n\n\t/**\n\t * The URL of your app's exit preview endpoint (default: `/api/exit-preview`).\n\t * This URL will be fetched on preview exit events.\n\t *\n\t * **Note**: If your `next.config.js` file contains a `basePath`, it is\n\t * automatically included.\n\t */\n\texitPreviewURL?: string;\n\n\t/**\n\t * Children to render adjacent to the Prismic Toolbar. The Prismic Toolbar\n\t * will be rendered last.\n\t */\n\tchildren?: React.ReactNode;\n};\n\n/**\n * React component that sets up Prismic Previews using the Prismic Toolbar. When\n * the Prismic Toolbar send events to the browser, such as on preview updates\n * and exiting, this component will automatically update the Next.js preview\n * cookie and refresh the page.\n *\n * This component can be wrapped around your app or added anywhere in your app's\n * tree. It must be rendered on every page.\n */\nexport function PrismicPreview({\n\trepositoryName,\n\tchildren,\n\tupdatePreviewURL = \"/api/preview\",\n\texitPreviewURL = \"/api/exit-preview\",\n}: PrismicPreviewProps): JSX.Element {\n\tconst router = useRouter();\n\n\tconst resolvedUpdatePreviewURL = router.basePath + updatePreviewURL;\n\tconst resolvedExitPreviewURL = router.basePath + exitPreviewURL;\n\n\tReact.useEffect(() => {\n\t\t/**\n\t\t * Starts Preview Mode and refreshes the page's props.\n\t\t */\n\t\tconst startPreviewMode = async () => {\n\t\t\t// Start Next.js Preview Mode via the given preview API endpoint.\n\t\t\tconst res = await globalThis.fetch(resolvedUpdatePreviewURL);\n\n\t\t\t// We check for `res.redirected` rather than `res.ok`\n\t\t\t// since the update preview endpoint may redirect to a\n\t\t\t// 404 page. As long as it redirects, we know the\n\t\t\t// endpoint exists and at least attempted to set\n\t\t\t// preview data.\n\t\t\tif (res.redirected) {\n\t\t\t\tglobalThis.location.reload();\n\t\t\t} else {\n\t\t\t\tconsole.error(\n\t\t\t\t\t`[<PrismicPreview>] Failed to start or update Preview Mode using the \"${resolvedUpdatePreviewURL}\" API endpoint. Does it exist?`,\n\t\t\t\t);\n\t\t\t}\n\t\t};\n\n\t\tconst handlePrismicPreviewUpdate = async (event: Event) => {\n\t\t\t// Prevent the toolbar from reloading the page.\n\t\t\tevent.preventDefault();\n\n\t\t\tawait startPreviewMode();\n\t\t};\n\n\t\tconst handlePrismicPreviewEnd = async (event: Event) => {\n\t\t\t// Prevent the toolbar from reloading the page.\n\t\t\tevent.preventDefault();\n\n\t\t\t// Exit Next.js Preview Mode via the given preview API endpoint.\n\t\t\tconst res = await globalThis.fetch(resolvedExitPreviewURL);\n\n\t\t\tif (res.ok) {\n\t\t\t\tglobalThis.location.reload();\n\t\t\t} else {\n\t\t\t\tconsole.error(\n\t\t\t\t\t`[<PrismicPreview>] Failed to exit Preview Mode using the \"${resolvedExitPreviewURL}\" API endpoint. Does it exist?`,\n\t\t\t\t);\n\t\t\t}\n\t\t};\n\n\t\tif (router.isPreview) {\n\t\t\t// Register Prismic Toolbar event handlers.\n\t\t\twindow.addEventListener(\n\t\t\t\t\"prismicPreviewUpdate\",\n\t\t\t\thandlePrismicPreviewUpdate,\n\t\t\t);\n\t\t\twindow.addEventListener(\"prismicPreviewEnd\", handlePrismicPreviewEnd);\n\t\t} else {\n\t\t\tconst prismicPreviewCookie = getPrismicPreviewCookie(\n\t\t\t\tglobalThis.document.cookie,\n\t\t\t);\n\n\t\t\tif (prismicPreviewCookie) {\n\t\t\t\t// If a Prismic preview cookie is present, but Next.js Preview\n\t\t\t\t// Mode is not active, we must activate Preview Mode manually.\n\t\t\t\t//\n\t\t\t\t// This will happen when a visitor accesses the page using a\n\t\t\t\t// Prismic preview share link.\n\n\t\t\t\t/**\n\t\t\t\t * Determines if the current location is a descendant of the app's base\n\t\t\t\t * path.\n\t\t\t\t *\n\t\t\t\t * This is used to prevent infinite refrehes; when\n\t\t\t\t * `isDescendantOfBasePath` is `false`, `router.isPreview` is also\n\t\t\t\t * `false`.\n\t\t\t\t *\n\t\t\t\t * If the app does not have a base path, this should always be `true`.\n\t\t\t\t */\n\t\t\t\tconst locationIsDescendantOfBasePath = window.location.href.startsWith(\n\t\t\t\t\twindow.location.origin + router.basePath,\n\t\t\t\t);\n\n\t\t\t\tconst prismicPreviewCookieRepositoryName =\n\t\t\t\t\tgetPreviewCookieRepositoryName(prismicPreviewCookie);\n\n\t\t\t\tif (\n\t\t\t\t\tlocationIsDescendantOfBasePath &&\n\t\t\t\t\tprismicPreviewCookieRepositoryName === repositoryName\n\t\t\t\t) {\n\t\t\t\t\tstartPreviewMode();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// On cleanup, unregister Prismic Toolbar event handlers.\n\t\treturn () => {\n\t\t\twindow.removeEventListener(\n\t\t\t\t\"prismicPreviewUpdate\",\n\t\t\t\thandlePrismicPreviewUpdate,\n\t\t\t);\n\t\t\twindow.removeEventListener(\"prismicPreviewEnd\", handlePrismicPreviewEnd);\n\t\t};\n\t}, [\n\t\trepositoryName,\n\t\tresolvedExitPreviewURL,\n\t\tresolvedUpdatePreviewURL,\n\t\trouter.isPreview,\n\t\trouter.basePath,\n\t]);\n\n\treturn (\n\t\t<>\n\t\t\t{children}\n\t\t\t<Script\n\t\t\t\tsrc={`https://static.cdn.prismic.io/prismic.js?repo=${repositoryName}&new=true`}\n\t\t\t\tstrategy=\"lazyOnload\"\n\t\t\t/>\n\t\t</>\n\t);\n}\n"],"names":["React"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAqDgB;AAMf;AAEM;AACA;AAENA;AAIC;AAEC;AAOA;AACC;;AAEQ;AACyH;AAEjI;AAGI;AAEL;AAEA;;AAGK;AAEL;AAGA;AAEA;AACC;;AAEQ;AAC4G;AAEpH;AAGF;AAEQ;AAIA;AAA6D;AAEpE;AAIA;AAiBO;AAIA;AAIL;;;AAIA;AACD;AAIF;AACQ;AAIA;AAAgE;AAAA;AAEtE;AACF;AACA;AACA;AACO;AACA;AAGR;AASD;;"}
@@ -2,7 +2,7 @@ import * as React from "react";
2
2
  /**
3
3
  * Props for `<PrismicPreview>`.
4
4
  */
5
- export declare type PrismicPreviewProps = {
5
+ export type PrismicPreviewProps = {
6
6
  /**
7
7
  * The name of your Prismic repository. A Prismic Toolbar will be registered
8
8
  * using this repository.