@prismicio/next 1.7.1 → 2.0.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 (150) hide show
  1. package/README.md +5 -3
  2. package/dist/PrismicNextImage.d.ts +7 -8
  3. package/dist/PrismicNextImage.js +8 -8
  4. package/dist/PrismicNextImage.js.map +1 -1
  5. package/dist/PrismicNextLink.d.ts +99 -100
  6. package/dist/PrismicNextLink.js +3 -5
  7. package/dist/PrismicNextLink.js.map +1 -1
  8. package/dist/PrismicPreview.d.ts +5 -13
  9. package/dist/PrismicPreview.js +6 -19
  10. package/dist/PrismicPreview.js.map +1 -1
  11. package/dist/PrismicPreviewClient.d.ts +5 -3
  12. package/dist/PrismicPreviewClient.js +58 -69
  13. package/dist/PrismicPreviewClient.js.map +1 -1
  14. package/dist/createLocaleRedirect.d.ts +8 -15
  15. package/dist/createLocaleRedirect.js +4 -28
  16. package/dist/createLocaleRedirect.js.map +1 -1
  17. package/dist/enableAutoPreviews.d.ts +7 -31
  18. package/dist/enableAutoPreviews.js +24 -35
  19. package/dist/enableAutoPreviews.js.map +1 -1
  20. package/dist/exitPreview.d.ts +4 -46
  21. package/dist/exitPreview.js +8 -15
  22. package/dist/exitPreview.js.map +1 -1
  23. package/dist/imgixLoader.js.map +1 -1
  24. package/dist/index.d.ts +15 -18
  25. package/dist/index.js +2 -4
  26. package/dist/index.js.map +1 -1
  27. package/dist/lib/devMsg.d.ts +1 -1
  28. package/dist/lib/devMsg.js.map +1 -1
  29. package/dist/package.json.js +1 -1
  30. package/dist/pages/PrismicPreview.d.ts +31 -0
  31. package/dist/pages/PrismicPreview.js +64 -0
  32. package/dist/pages/PrismicPreview.js.map +1 -0
  33. package/dist/pages/enableAutoPreviews.d.ts +31 -0
  34. package/dist/pages/enableAutoPreviews.js +19 -0
  35. package/dist/pages/enableAutoPreviews.js.map +1 -0
  36. package/dist/pages/exitPreview.d.ts +33 -0
  37. package/dist/pages/exitPreview.js +10 -0
  38. package/dist/pages/exitPreview.js.map +1 -0
  39. package/dist/pages/index.d.ts +18 -0
  40. package/dist/pages/redirectToPreviewURL.d.ts +43 -0
  41. package/dist/pages/redirectToPreviewURL.js +16 -0
  42. package/dist/pages/redirectToPreviewURL.js.map +1 -0
  43. package/dist/{setPreviewData.d.ts → pages/setPreviewData.d.ts} +3 -9
  44. package/dist/{setPreviewData.js → pages/setPreviewData.js} +2 -2
  45. package/dist/pages/setPreviewData.js.map +1 -0
  46. package/dist/pages/types.d.ts +30 -0
  47. package/dist/pages.js +21 -0
  48. package/dist/pages.js.map +1 -0
  49. package/dist/redirectToPreviewURL.d.ts +11 -41
  50. package/dist/redirectToPreviewURL.js +16 -22
  51. package/dist/redirectToPreviewURL.js.map +1 -1
  52. package/dist/types.d.ts +2 -51
  53. package/package.json +61 -54
  54. package/src/PrismicNextImage.tsx +19 -16
  55. package/src/PrismicNextLink.tsx +17 -13
  56. package/src/PrismicPreview.tsx +20 -50
  57. package/src/PrismicPreviewClient.tsx +111 -138
  58. package/src/createLocaleRedirect.ts +14 -56
  59. package/src/enableAutoPreviews.ts +38 -110
  60. package/src/exitPreview.ts +18 -81
  61. package/src/index.ts +15 -26
  62. package/src/lib/devMsg.ts +1 -1
  63. package/src/pages/PrismicPreview.tsx +145 -0
  64. package/src/pages/enableAutoPreviews.ts +62 -0
  65. package/src/pages/exitPreview.ts +45 -0
  66. package/src/pages/index.ts +27 -0
  67. package/src/pages/redirectToPreviewURL.ts +77 -0
  68. package/src/{setPreviewData.ts → pages/setPreviewData.ts} +5 -11
  69. package/src/pages/types.ts +36 -0
  70. package/src/redirectToPreviewURL.ts +44 -95
  71. package/src/types.ts +2 -56
  72. package/dist/PrismicNextImage.cjs +0 -64
  73. package/dist/PrismicNextImage.cjs.map +0 -1
  74. package/dist/PrismicNextLink.cjs +0 -40
  75. package/dist/PrismicNextLink.cjs.map +0 -1
  76. package/dist/PrismicPreview.cjs +0 -28
  77. package/dist/PrismicPreview.cjs.map +0 -1
  78. package/dist/PrismicPreviewClient.cjs +0 -81
  79. package/dist/PrismicPreviewClient.cjs.map +0 -1
  80. package/dist/_node_modules/@prismicio/client/dist/cookie.cjs +0 -5
  81. package/dist/_node_modules/@prismicio/client/dist/cookie.cjs.map +0 -1
  82. package/dist/_node_modules/@prismicio/client/dist/cookie.js +0 -5
  83. package/dist/_node_modules/@prismicio/client/dist/cookie.js.map +0 -1
  84. package/dist/_node_modules/@prismicio/client/dist/errors/PrismicError.cjs +0 -16
  85. package/dist/_node_modules/@prismicio/client/dist/errors/PrismicError.cjs.map +0 -1
  86. package/dist/_node_modules/@prismicio/client/dist/errors/PrismicError.js +0 -16
  87. package/dist/_node_modules/@prismicio/client/dist/errors/PrismicError.js.map +0 -1
  88. package/dist/_node_modules/@prismicio/client/dist/getToolbarSrc.cjs +0 -13
  89. package/dist/_node_modules/@prismicio/client/dist/getToolbarSrc.cjs.map +0 -1
  90. package/dist/_node_modules/@prismicio/client/dist/getToolbarSrc.js +0 -13
  91. package/dist/_node_modules/@prismicio/client/dist/getToolbarSrc.js.map +0 -1
  92. package/dist/_node_modules/@prismicio/client/dist/helpers/asLink.cjs +0 -47
  93. package/dist/_node_modules/@prismicio/client/dist/helpers/asLink.cjs.map +0 -1
  94. package/dist/_node_modules/@prismicio/client/dist/helpers/asLink.js +0 -47
  95. package/dist/_node_modules/@prismicio/client/dist/helpers/asLink.js.map +0 -1
  96. package/dist/_node_modules/@prismicio/client/dist/helpers/asLinkAttrs.cjs +0 -28
  97. package/dist/_node_modules/@prismicio/client/dist/helpers/asLinkAttrs.cjs.map +0 -1
  98. package/dist/_node_modules/@prismicio/client/dist/helpers/asLinkAttrs.js +0 -28
  99. package/dist/_node_modules/@prismicio/client/dist/helpers/asLinkAttrs.js.map +0 -1
  100. package/dist/_node_modules/@prismicio/client/dist/helpers/documentToLinkField.cjs +0 -27
  101. package/dist/_node_modules/@prismicio/client/dist/helpers/documentToLinkField.cjs.map +0 -1
  102. package/dist/_node_modules/@prismicio/client/dist/helpers/documentToLinkField.js +0 -27
  103. package/dist/_node_modules/@prismicio/client/dist/helpers/documentToLinkField.js.map +0 -1
  104. package/dist/_node_modules/@prismicio/client/dist/helpers/isFilled.cjs +0 -14
  105. package/dist/_node_modules/@prismicio/client/dist/helpers/isFilled.cjs.map +0 -1
  106. package/dist/_node_modules/@prismicio/client/dist/helpers/isFilled.js +0 -14
  107. package/dist/_node_modules/@prismicio/client/dist/helpers/isFilled.js.map +0 -1
  108. package/dist/_node_modules/@prismicio/client/dist/isRepositoryName.cjs +0 -7
  109. package/dist/_node_modules/@prismicio/client/dist/isRepositoryName.cjs.map +0 -1
  110. package/dist/_node_modules/@prismicio/client/dist/isRepositoryName.js +0 -7
  111. package/dist/_node_modules/@prismicio/client/dist/isRepositoryName.js.map +0 -1
  112. package/dist/_node_modules/@prismicio/client/dist/lib/isInternalURL.cjs +0 -9
  113. package/dist/_node_modules/@prismicio/client/dist/lib/isInternalURL.cjs.map +0 -1
  114. package/dist/_node_modules/@prismicio/client/dist/lib/isInternalURL.js +0 -9
  115. package/dist/_node_modules/@prismicio/client/dist/lib/isInternalURL.js.map +0 -1
  116. package/dist/_node_modules/@prismicio/client/dist/types/value/link.cjs +0 -10
  117. package/dist/_node_modules/@prismicio/client/dist/types/value/link.cjs.map +0 -1
  118. package/dist/_node_modules/@prismicio/client/dist/types/value/link.js +0 -10
  119. package/dist/_node_modules/@prismicio/client/dist/types/value/link.js.map +0 -1
  120. package/dist/createLocaleRedirect.cjs +0 -32
  121. package/dist/createLocaleRedirect.cjs.map +0 -1
  122. package/dist/enableAutoPreviews.cjs +0 -40
  123. package/dist/enableAutoPreviews.cjs.map +0 -1
  124. package/dist/exitPreview.cjs +0 -20
  125. package/dist/exitPreview.cjs.map +0 -1
  126. package/dist/imgixLoader.cjs +0 -17
  127. package/dist/imgixLoader.cjs.map +0 -1
  128. package/dist/index.cjs +0 -21
  129. package/dist/index.cjs.map +0 -1
  130. package/dist/lib/devMsg.cjs +0 -8
  131. package/dist/lib/devMsg.cjs.map +0 -1
  132. package/dist/lib/getPreviewCookieRepositoryName.cjs +0 -7
  133. package/dist/lib/getPreviewCookieRepositoryName.cjs.map +0 -1
  134. package/dist/lib/getPreviewCookieRepositoryName.d.ts +0 -9
  135. package/dist/lib/getPreviewCookieRepositoryName.js +0 -7
  136. package/dist/lib/getPreviewCookieRepositoryName.js.map +0 -1
  137. package/dist/lib/getPrismicPreviewCookie.cjs +0 -21
  138. package/dist/lib/getPrismicPreviewCookie.cjs.map +0 -1
  139. package/dist/lib/getPrismicPreviewCookie.d.ts +0 -9
  140. package/dist/lib/getPrismicPreviewCookie.js +0 -21
  141. package/dist/lib/getPrismicPreviewCookie.js.map +0 -1
  142. package/dist/package.json.cjs +0 -5
  143. package/dist/package.json.cjs.map +0 -1
  144. package/dist/redirectToPreviewURL.cjs +0 -30
  145. package/dist/redirectToPreviewURL.cjs.map +0 -1
  146. package/dist/setPreviewData.cjs +0 -11
  147. package/dist/setPreviewData.cjs.map +0 -1
  148. package/dist/setPreviewData.js.map +0 -1
  149. package/src/lib/getPreviewCookieRepositoryName.ts +0 -14
  150. package/src/lib/getPrismicPreviewCookie.ts +0 -33
@@ -1,64 +0,0 @@
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 Image = require("next/image");
7
- const imgixUrlBuilder = require("imgix-url-builder");
8
- const devMsg = require("./lib/devMsg.cjs");
9
- const imgixLoader = require("./imgixLoader.cjs");
10
- const isFilled = require('./_node_modules/@prismicio/client/dist/helpers/isFilled.cjs');
11
- const castInt = (input) => {
12
- if (typeof input === "number" || typeof input === "undefined") {
13
- return input;
14
- } else {
15
- const parsed = Number.parseInt(input);
16
- if (Number.isNaN(parsed)) {
17
- return void 0;
18
- } else {
19
- return parsed;
20
- }
21
- }
22
- };
23
- const PrismicNextImage = ({ field, imgixParams = {}, alt, fallbackAlt, fill, width, height, fallback = null, ...restProps }) => {
24
- if (process.env.NODE_ENV !== "production") {
25
- if (typeof alt === "string" && alt !== "") {
26
- 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")}`);
27
- }
28
- if (typeof fallbackAlt === "string" && fallbackAlt !== "") {
29
- 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")}`);
30
- }
31
- }
32
- if (isFilled.imageThumbnail(field)) {
33
- const resolvedImgixParams = imgixParams;
34
- for (const x in imgixParams) {
35
- if (resolvedImgixParams[x] === null) {
36
- resolvedImgixParams[x] = void 0;
37
- }
38
- }
39
- const src = imgixUrlBuilder.buildURL(field.url, imgixParams);
40
- const ar = field.dimensions.width / field.dimensions.height;
41
- const castedWidth = castInt(width);
42
- const castedHeight = castInt(height);
43
- let resolvedWidth = castedWidth ?? field.dimensions.width;
44
- let resolvedHeight = castedHeight ?? field.dimensions.height;
45
- if (castedWidth != null && castedHeight == null) {
46
- resolvedHeight = castedWidth / ar;
47
- } else if (castedWidth == null && castedHeight != null) {
48
- resolvedWidth = castedHeight * ar;
49
- }
50
- const resolvedAlt = alt ?? (field.alt || fallbackAlt);
51
- if (process.env.NODE_ENV !== "production" && typeof resolvedAlt !== "string") {
52
- console.error(`[PrismicNextImage] The following image is missing an "alt" property. Please add Alternative Text to the image in Prismic. To mark the image as decorative instead, add one of \`alt=""\` or \`fallbackAlt=""\`.`, src);
53
- }
54
- let ResolvedImage = Image;
55
- if ("default" in ResolvedImage) {
56
- ResolvedImage = ResolvedImage.default;
57
- }
58
- return jsxRuntime.jsx(ResolvedImage, { src, width: fill ? void 0 : resolvedWidth, height: fill ? void 0 : resolvedHeight, alt: resolvedAlt, fill, loader: imgixLoader.imgixLoader, ...restProps });
59
- } else {
60
- return jsxRuntime.jsx(jsxRuntime.Fragment, { children: fallback });
61
- }
62
- };
63
- exports.PrismicNextImage = PrismicNextImage;
64
- //# sourceMappingURL=PrismicNextImage.cjs.map
@@ -1 +0,0 @@
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 { 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?: { [P in keyof ImgixURLParams]: ImgixURLParams[P] | null };\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 *\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 (process.env.NODE_ENV !== \"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 resolvedImgixParams = imgixParams;\n\t\tfor (const x in imgixParams) {\n\t\t\tif (resolvedImgixParams[x as keyof typeof resolvedImgixParams] === null) {\n\t\t\t\tresolvedImgixParams[x as keyof typeof resolvedImgixParams] = undefined;\n\t\t\t}\n\t\t}\n\n\t\tconst src = buildURL(field.url, imgixParams as ImgixURLParams);\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\t// A non-null assertion is required since we can't statically\n\t\t// know if an alt attribute is available.\n\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\tconst resolvedAlt = (alt ?? (field.alt || fallbackAlt))!;\n\n\t\tif (\n\t\t\tprocess.env.NODE_ENV !== \"production\" &&\n\t\t\ttypeof resolvedAlt !== \"string\"\n\t\t) {\n\t\t\tconsole.error(\n\t\t\t\t`[PrismicNextImage] The following image is missing an \"alt\" property. Please add Alternative Text to the image in Prismic. To mark the image as decorative instead, add one of \\`alt=\"\"\\` or \\`fallbackAlt=\"\"\\`.`,\n\t\t\t\tsrc,\n\t\t\t);\n\t\t}\n\n\t\t// TODO: Remove once https://github.com/vercel/next.js/issues/52216 is resolved.\n\t\t// `next/image` seems to be affected by a default + named export bundling bug.\n\t\tlet ResolvedImage = Image;\n\t\tif (\"default\" in ResolvedImage) {\n\t\t\tResolvedImage = (ResolvedImage as unknown as { default: typeof Image })\n\t\t\t\t.default;\n\t\t}\n\n\t\treturn (\n\t\t\t<ResolvedImage\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\talt={resolvedAlt}\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":";;;;;;;;;;AAUA;AACC;AACQ;AAAA;AAED;AAEF;AACI;AAAA;AAEA;AAAA;AACP;AAEH;AAuDO;AAWF;AACH;AACC;AAGI;AAIL;AACC;AAGI;AAEJ;AAGF;AACC;AACA;AACK;AACH;AAA6D;AAC7D;AAGF;AAEA;AAEM;AACA;AAEF;AACA;AAEA;AACH;AAA+B;AAE/B;AAA+B;AAM1B;AAEN;AAIS;AAEJ;AAML;AACA;AACC;AACE;AAGH;AASG;AAGH;AAAkB;AAEpB;;"}
@@ -1,40 +0,0 @@
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 Link = require("next/link");
8
- const asLinkAttrs = require('./_node_modules/@prismicio/client/dist/helpers/asLinkAttrs.cjs');
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 PrismicNextLink = React__namespace.forwardRef(function PrismicNextLink2(props, ref) {
27
- const { field, document, linkResolver, children, ...restProps } = props;
28
- const { href: computedHref, rel: computedRel, ...attrs } = asLinkAttrs.asLinkAttrs(field ?? document, {
29
- linkResolver,
30
- rel: typeof restProps.rel === "function" ? restProps.rel : void 0
31
- });
32
- const href = ("href" in restProps ? restProps.href : computedHref) || "";
33
- let rel = computedRel;
34
- if ("rel" in restProps && typeof restProps.rel !== "function") {
35
- rel = restProps.rel;
36
- }
37
- return jsxRuntime.jsx(Link, { ref, ...attrs, ...restProps, href, rel, children: "children" in props ? children : field == null ? void 0 : field.text });
38
- });
39
- exports.PrismicNextLink = PrismicNextLink;
40
- //# sourceMappingURL=PrismicNextLink.cjs.map
@@ -1 +0,0 @@
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 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\tfield: prismic.LinkField | null | undefined;\n\t\t\t\tdocument?: never;\n\t\t\t\thref?: never;\n\t\t }\n\t\t| {\n\t\t\t\tfield?: never;\n\t\t\t\tdocument: prismic.PrismicDocument | null | undefined;\n\t\t\t\thref?: never;\n\t\t }\n\t\t| {\n\t\t\t\tfield?: never;\n\t\t\t\tdocument?: never;\n\t\t\t\thref: React.ComponentProps<typeof Link>[\"href\"];\n\t\t }\n\t);\n\nexport const PrismicNextLink = React.forwardRef<\n\tHTMLAnchorElement,\n\tPrismicNextLinkProps\n>(function PrismicNextLink(props, ref): JSX.Element | null {\n\tconst { field, document, linkResolver, children, ...restProps } = props;\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\tconst href = (\"href\" in restProps ? restProps.href : computedHref) || \"\";\n\n\tlet rel = computedRel;\n\tif (\"rel\" in restProps && typeof restProps.rel !== \"function\") {\n\t\trel = restProps.rel;\n\t}\n\n\treturn (\n\t\t<Link ref={ref} {...attrs} {...restProps} href={href} rel={rel}>\n\t\t\t{\"children\" in props ? children : field?.text}\n\t\t</Link>\n\t);\n});\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AA8BO;AAIN;AACM;AAIqC;AAC1C;AAC2D;AAG5D;AAEA;AACA;AACC;AAAgB;AAGjB;AAKD;;"}
@@ -1,28 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const jsxRuntime = require("react/jsx-runtime");
4
- const Script = require("next/script");
5
- const headers = require("next/headers");
6
- const router = require("next/router");
7
- const PrismicPreviewClient = require("./PrismicPreviewClient.cjs");
8
- const getToolbarSrc = require('./_node_modules/@prismicio/client/dist/getToolbarSrc.cjs');
9
- function PrismicPreview({ repositoryName, children, ...props }) {
10
- const toolbarSrc = getToolbarSrc.getToolbarSrc(repositoryName);
11
- let isDraftMode = false;
12
- const result = jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [children, jsxRuntime.jsx(PrismicPreviewClient.PrismicPreviewClient, { repositoryName, isDraftMode, ...props }), jsxRuntime.jsx(Script, { src: toolbarSrc, strategy: "lazyOnload" })] });
13
- let isAppRouter = true;
14
- try {
15
- router.useRouter();
16
- isAppRouter = false;
17
- } catch {
18
- }
19
- if (isAppRouter) {
20
- return new Promise(async (res) => {
21
- isDraftMode = (await headers.draftMode()).isEnabled;
22
- res(result);
23
- });
24
- }
25
- return result;
26
- }
27
- exports.PrismicPreview = PrismicPreview;
28
- //# sourceMappingURL=PrismicPreview.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"PrismicPreview.cjs","sources":["../../src/PrismicPreview.tsx"],"sourcesContent":["import Script from \"next/script\";\nimport { draftMode } from \"next/headers\";\nimport { useRouter as usePagesRouter } from \"next/router\";\nimport * as React from \"react\";\nimport * as prismic from \"@prismicio/client\";\n\nimport { PrismicPreviewClient } from \"./PrismicPreviewClient\";\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 * **Only used in the Pages Directory (/pages).**\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\tupdatePreviewURL?: string;\n\n\t/**\n\t * **Only used in the Pages Directory (/pages).**\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\texitPreviewURL?: string;\n\n\t/**\n\t * Children to render adjacent to the Prismic Toolbar.\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 refresh the page with the\n * changes.\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\t...props\n}: PrismicPreviewProps): JSX.Element | Promise<JSX.Element> {\n\tconst toolbarSrc = prismic.getToolbarSrc(repositoryName);\n\tlet isDraftMode = false;\n\n\tconst result = (\n\t\t<>\n\t\t\t{children}\n\t\t\t<PrismicPreviewClient\n\t\t\t\trepositoryName={repositoryName}\n\t\t\t\tisDraftMode={isDraftMode}\n\t\t\t\t{...props}\n\t\t\t/>\n\t\t\t<Script src={toolbarSrc} strategy=\"lazyOnload\" />\n\t\t</>\n\t);\n\n\t// We need to check `draftMode()`, an async method, when running in the\n\t// App Router. The Pages Router does not support async components, so we\n\t// need to do some trickery to return a Promise in the App Router and\n\t// unwrapped JSX in the Pages Router.\n\t//\n\t// Alternatively, we could serve a special server-only\n\t// `<PrismicPreview>`, but that requires extra set up and depends on the\n\t// compiler to recognize the `react-server` entry point. It is an\n\t// undocumented feature that could be removed.\n\tlet isAppRouter = true;\n\ttry {\n\t\tusePagesRouter();\n\t\tisAppRouter = false;\n\t} catch {}\n\n\tif (isAppRouter) {\n\t\treturn new Promise(async (res) => {\n\t\t\tisDraftMode = (await draftMode()).isEnabled;\n\n\t\t\tres(result);\n\t\t});\n\t}\n\n\treturn result;\n}\n"],"names":["prismic.getToolbarSrc","_jsxs","_Fragment","_jsx","PrismicPreviewClient","draftMode"],"mappings":";;;;;;;;AAiDM,SAAU,eAAe,EAC9B,gBACA,UACA,GAAG,SACkB;AACf,QAAA,aAAaA,4BAAsB,cAAc;AACvD,MAAI,cAAc;AAEZ,QAAA,SACLC,WAAAA,KAAAC,WAAA,UAAA,EAAA,UAAA,CACE,UACDC,eAACC,qBAAAA,sBAAoB,EACpB,gBACA,aACI,GAAA,OACH,GACFD,WAAAA,IAAC,UAAO,KAAK,YAAY,UAAS,aAAe,CAAA,CAAA,EAAA,CAAA;AAanD,MAAI,cAAc;AACd,MAAA;;AAEW,kBAAA;AAAA,EAAA,QACP;AAAA,EAAE;AAEV,MAAI,aAAa;AACT,WAAA,IAAI,QAAQ,OAAO,QAAO;AACjB,qBAAA,MAAME,kBAAa,GAAA;AAElC,UAAI,MAAM;AAAA,IAAA,CACV;AAAA,EACD;AAEM,SAAA;AACR;;"}
@@ -1,81 +0,0 @@
1
- 'use client';
2
- 'use client';
3
- "use strict";
4
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
5
- const React = require("react");
6
- const router = require("next/router");
7
- const navigation = require("next/navigation");
8
- const getPrismicPreviewCookie = require("./lib/getPrismicPreviewCookie.cjs");
9
- const getPreviewCookieRepositoryName = require("./lib/getPreviewCookieRepositoryName.cjs");
10
- function PrismicPreviewClient({ repositoryName, updatePreviewURL = "/api/preview", exitPreviewURL = "/api/exit-preview", isDraftMode }) {
11
- let isPreviewActive = isDraftMode;
12
- let isAppRouter = true;
13
- let basePath = "";
14
- let refresh;
15
- try {
16
- const router$1 = router.useRouter();
17
- isAppRouter = false;
18
- basePath = router$1.basePath;
19
- isPreviewActive || (isPreviewActive = router$1.isPreview);
20
- refresh = () => router$1.replace(router$1.asPath, void 0, { scroll: false });
21
- } catch {
22
- const router2 = navigation.useRouter();
23
- refresh = router2.refresh;
24
- }
25
- React.useEffect(() => {
26
- const startPreviewMode = async () => {
27
- const resolvedUpdatePreviewURL = basePath + updatePreviewURL;
28
- const res = await globalThis.fetch(resolvedUpdatePreviewURL);
29
- if (res.redirected) {
30
- refresh();
31
- } else {
32
- console.error(`[<PrismicPreview>] Failed to start or update Preview Mode using the "${resolvedUpdatePreviewURL}" API endpoint. Does it exist?`);
33
- }
34
- };
35
- const handlePrismicPreviewUpdate = async (event) => {
36
- event.preventDefault();
37
- if (isAppRouter) {
38
- refresh();
39
- } else {
40
- await startPreviewMode();
41
- }
42
- };
43
- const handlePrismicPreviewEnd = async (event) => {
44
- event.preventDefault();
45
- const resolvedExitPreviewURL = basePath + exitPreviewURL;
46
- const res = await globalThis.fetch(resolvedExitPreviewURL);
47
- if (res.ok) {
48
- refresh();
49
- } else {
50
- console.error(`[<PrismicPreview>] Failed to exit Preview Mode using the "${resolvedExitPreviewURL}" API endpoint. Does it exist?`);
51
- }
52
- };
53
- window.addEventListener("prismicPreviewUpdate", handlePrismicPreviewUpdate);
54
- window.addEventListener("prismicPreviewEnd", handlePrismicPreviewEnd);
55
- if (!isPreviewActive) {
56
- const prismicPreviewCookie = getPrismicPreviewCookie.getPrismicPreviewCookie(globalThis.document.cookie);
57
- if (prismicPreviewCookie) {
58
- const locationIsDescendantOfBasePath = window.location.href.startsWith(window.location.origin + basePath);
59
- const prismicPreviewCookieRepositoryName = getPreviewCookieRepositoryName.getPreviewCookieRepositoryName(prismicPreviewCookie);
60
- if (locationIsDescendantOfBasePath && prismicPreviewCookieRepositoryName === repositoryName) {
61
- startPreviewMode();
62
- }
63
- }
64
- }
65
- return () => {
66
- window.removeEventListener("prismicPreviewUpdate", handlePrismicPreviewUpdate);
67
- window.removeEventListener("prismicPreviewEnd", handlePrismicPreviewEnd);
68
- };
69
- }, [
70
- basePath,
71
- exitPreviewURL,
72
- isAppRouter,
73
- isPreviewActive,
74
- refresh,
75
- repositoryName,
76
- updatePreviewURL
77
- ]);
78
- return null;
79
- }
80
- exports.PrismicPreviewClient = PrismicPreviewClient;
81
- //# sourceMappingURL=PrismicPreviewClient.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"PrismicPreviewClient.cjs","sources":["../../src/PrismicPreviewClient.tsx"],"sourcesContent":["\"use client\";\n\nimport { useEffect } from \"react\";\nimport { useRouter as usePagesRouter } from \"next/router\";\nimport { useRouter } from \"next/navigation\";\n\nimport { getPrismicPreviewCookie } from \"./lib/getPrismicPreviewCookie\";\nimport { getPreviewCookieRepositoryName } from \"./lib/getPreviewCookieRepositoryName\";\n\nimport { PrismicPreviewProps } from \"./PrismicPreview\";\n\ntype PrismicPreviewClientProps = Omit<PrismicPreviewProps, \"children\"> & {\n\tisDraftMode: boolean;\n};\n\nexport function PrismicPreviewClient({\n\trepositoryName,\n\tupdatePreviewURL = \"/api/preview\",\n\texitPreviewURL = \"/api/exit-preview\",\n\tisDraftMode,\n}: PrismicPreviewClientProps): null {\n\tlet isPreviewActive = isDraftMode;\n\tlet isAppRouter = true;\n\tlet basePath = \"\";\n\tlet refresh: () => void;\n\n\ttry {\n\t\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\t\tconst router = usePagesRouter();\n\n\t\tisAppRouter = false;\n\t\tbasePath = router.basePath;\n\t\tisPreviewActive ||= router.isPreview;\n\t\trefresh = () => router.replace(router.asPath, undefined, { scroll: false });\n\t} catch {\n\t\t// Assume we are in App Router. Ignore the error.\n\n\t\t// eslint-disable-next-line react-hooks/rules-of-hooks\n\t\tconst router = useRouter();\n\n\t\trefresh = router.refresh;\n\t}\n\n\tuseEffect(() => {\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\tconst resolvedUpdatePreviewURL = basePath + updatePreviewURL;\n\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\trefresh();\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\tif (isAppRouter) {\n\t\t\t\trefresh();\n\t\t\t} else {\n\t\t\t\tawait startPreviewMode();\n\t\t\t}\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\tconst resolvedExitPreviewURL = basePath + exitPreviewURL;\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\trefresh();\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\twindow.addEventListener(\"prismicPreviewUpdate\", handlePrismicPreviewUpdate);\n\t\twindow.addEventListener(\"prismicPreviewEnd\", handlePrismicPreviewEnd);\n\n\t\tif (!isPreviewActive) {\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 + 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\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\tbasePath,\n\t\texitPreviewURL,\n\t\tisAppRouter,\n\t\tisPreviewActive,\n\t\trefresh,\n\t\trepositoryName,\n\t\tupdatePreviewURL,\n\t]);\n\n\treturn null;\n}\n"],"names":["useEffect"],"mappings":";;;;;;;;;AAegB;AAMf;AACA;AACA;AACI;AAEA;AAEH;AAEc;AACd;AACA;AACU;AAAgE;AAK1E;AAEA;AAAiB;AAGlBA;AAIC;AACC;AAGA;AAOA;;;AAGS;AACyH;AAEjI;AAGI;AAEL;AAEA;;;AAGC;;AACA;AAGI;AAEL;AAEA;AAGA;AAEA;;;AAGS;AAC4G;AAEpH;AAGK;AACA;AAEP;AACC;AAIA;AAiBO;AAIA;AAIL;;;AAIA;AACD;AAGF;AACQ;AAIA;AAAgE;AAAA;AAEtE;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AAGM;AACR;;"}
@@ -1,5 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const preview = "io.prismic.preview";
4
- exports.preview = preview;
5
- //# sourceMappingURL=cookie.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"cookie.cjs","sources":["../../../../../node_modules/@prismicio/client/dist/cookie.js"],"sourcesContent":["const preview = \"io.prismic.preview\";\nexport {\n preview\n};\n//# sourceMappingURL=cookie.js.map\n"],"names":[],"mappings":";;AAAK,MAAC,UAAU;;","x_google_ignoreList":[0]}
@@ -1,5 +0,0 @@
1
- const preview = "io.prismic.preview";
2
- export {
3
- preview
4
- };
5
- //# sourceMappingURL=cookie.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"cookie.js","sources":["../../../../../node_modules/@prismicio/client/dist/cookie.js"],"sourcesContent":["const preview = \"io.prismic.preview\";\nexport {\n preview\n};\n//# sourceMappingURL=cookie.js.map\n"],"names":[],"mappings":"AAAK,MAAC,UAAU;","x_google_ignoreList":[0]}
@@ -1,16 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- var __defProp = Object.defineProperty;
4
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
5
- var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
6
- class PrismicError extends Error {
7
- constructor(message = "An invalid API response was returned", url, response) {
8
- super(message);
9
- __publicField(this, "url");
10
- __publicField(this, "response");
11
- this.url = url;
12
- this.response = response;
13
- }
14
- }
15
- exports.PrismicError = PrismicError;
16
- //# sourceMappingURL=PrismicError.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"PrismicError.cjs","sources":["../../../../../../node_modules/@prismicio/client/dist/errors/PrismicError.js"],"sourcesContent":["var __defProp = Object.defineProperty;\nvar __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;\nvar __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== \"symbol\" ? key + \"\" : key, value);\nclass PrismicError extends Error {\n constructor(message = \"An invalid API response was returned\", url, response) {\n super(message);\n __publicField(this, \"url\");\n __publicField(this, \"response\");\n this.url = url;\n this.response = response;\n }\n}\nexport {\n PrismicError\n};\n//# sourceMappingURL=PrismicError.js.map\n"],"names":[],"mappings":";;AAAA,IAAI,YAAY,OAAO;AACvB,IAAI,kBAAkB,CAAC,KAAK,KAAK,UAAU,OAAO,MAAM,UAAU,KAAK,KAAK,EAAE,YAAY,MAAM,cAAc,MAAM,UAAU,MAAM,MAAO,CAAA,IAAI,IAAI,GAAG,IAAI;AAC1J,IAAI,gBAAgB,CAAC,KAAK,KAAK,UAAU,gBAAgB,KAAK,OAAO,QAAQ,WAAW,MAAM,KAAK,KAAK,KAAK;AAC7G,MAAM,qBAAqB,MAAM;AAAA,EAC/B,YAAY,UAAU,wCAAwC,KAAK,UAAU;AAC3E,UAAM,OAAO;AACb,kBAAc,MAAM,KAAK;AACzB,kBAAc,MAAM,UAAU;AAC9B,SAAK,MAAM;AACX,SAAK,WAAW;AAAA,EACjB;AACH;;","x_google_ignoreList":[0]}
@@ -1,16 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
- var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
- class PrismicError extends Error {
5
- constructor(message = "An invalid API response was returned", url, response) {
6
- super(message);
7
- __publicField(this, "url");
8
- __publicField(this, "response");
9
- this.url = url;
10
- this.response = response;
11
- }
12
- }
13
- export {
14
- PrismicError
15
- };
16
- //# sourceMappingURL=PrismicError.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"PrismicError.js","sources":["../../../../../../node_modules/@prismicio/client/dist/errors/PrismicError.js"],"sourcesContent":["var __defProp = Object.defineProperty;\nvar __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;\nvar __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== \"symbol\" ? key + \"\" : key, value);\nclass PrismicError extends Error {\n constructor(message = \"An invalid API response was returned\", url, response) {\n super(message);\n __publicField(this, \"url\");\n __publicField(this, \"response\");\n this.url = url;\n this.response = response;\n }\n}\nexport {\n PrismicError\n};\n//# sourceMappingURL=PrismicError.js.map\n"],"names":[],"mappings":"AAAA,IAAI,YAAY,OAAO;AACvB,IAAI,kBAAkB,CAAC,KAAK,KAAK,UAAU,OAAO,MAAM,UAAU,KAAK,KAAK,EAAE,YAAY,MAAM,cAAc,MAAM,UAAU,MAAM,MAAO,CAAA,IAAI,IAAI,GAAG,IAAI;AAC1J,IAAI,gBAAgB,CAAC,KAAK,KAAK,UAAU,gBAAgB,KAAK,OAAO,QAAQ,WAAW,MAAM,KAAK,KAAK,KAAK;AAC7G,MAAM,qBAAqB,MAAM;AAAA,EAC/B,YAAY,UAAU,wCAAwC,KAAK,UAAU;AAC3E,UAAM,OAAO;AACb,kBAAc,MAAM,KAAK;AACzB,kBAAc,MAAM,UAAU;AAC9B,SAAK,MAAM;AACX,SAAK,WAAW;AAAA,EACjB;AACH;","x_google_ignoreList":[0]}
@@ -1,13 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const PrismicError = require("./errors/PrismicError.cjs");
4
- const isRepositoryName = require("./isRepositoryName.cjs");
5
- const getToolbarSrc = (repositoryName) => {
6
- if (isRepositoryName.isRepositoryName(repositoryName)) {
7
- return `https://static.cdn.prismic.io/prismic.js?new=true&repo=${repositoryName}`;
8
- } else {
9
- throw new PrismicError.PrismicError(`An invalid Prismic repository name was given: ${repositoryName}`, void 0, void 0);
10
- }
11
- };
12
- exports.getToolbarSrc = getToolbarSrc;
13
- //# sourceMappingURL=getToolbarSrc.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getToolbarSrc.cjs","sources":["../../../../../node_modules/@prismicio/client/dist/getToolbarSrc.js"],"sourcesContent":["import { PrismicError } from \"./errors/PrismicError.js\";\nimport { isRepositoryName } from \"./isRepositoryName.js\";\nconst getToolbarSrc = (repositoryName) => {\n if (isRepositoryName(repositoryName)) {\n return `https://static.cdn.prismic.io/prismic.js?new=true&repo=${repositoryName}`;\n } else {\n throw new PrismicError(`An invalid Prismic repository name was given: ${repositoryName}`, void 0, void 0);\n }\n};\nexport {\n getToolbarSrc\n};\n//# sourceMappingURL=getToolbarSrc.js.map\n"],"names":["isRepositoryName","PrismicError"],"mappings":";;;;AAEK,MAAC,gBAAgB,CAAC,mBAAmB;AACxC,MAAIA,iBAAAA,iBAAiB,cAAc,GAAG;AACpC,WAAO,0DAA0D,cAAc;AAAA,EACnF,OAAS;AACL,UAAM,IAAIC,aAAAA,aAAa,iDAAiD,cAAc,IAAI,QAAQ,MAAM;AAAA,EACzG;AACH;;","x_google_ignoreList":[0]}
@@ -1,13 +0,0 @@
1
- import { PrismicError } from "./errors/PrismicError.js";
2
- import { isRepositoryName } from "./isRepositoryName.js";
3
- const getToolbarSrc = (repositoryName) => {
4
- if (isRepositoryName(repositoryName)) {
5
- return `https://static.cdn.prismic.io/prismic.js?new=true&repo=${repositoryName}`;
6
- } else {
7
- throw new PrismicError(`An invalid Prismic repository name was given: ${repositoryName}`, void 0, void 0);
8
- }
9
- };
10
- export {
11
- getToolbarSrc
12
- };
13
- //# sourceMappingURL=getToolbarSrc.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getToolbarSrc.js","sources":["../../../../../node_modules/@prismicio/client/dist/getToolbarSrc.js"],"sourcesContent":["import { PrismicError } from \"./errors/PrismicError.js\";\nimport { isRepositoryName } from \"./isRepositoryName.js\";\nconst getToolbarSrc = (repositoryName) => {\n if (isRepositoryName(repositoryName)) {\n return `https://static.cdn.prismic.io/prismic.js?new=true&repo=${repositoryName}`;\n } else {\n throw new PrismicError(`An invalid Prismic repository name was given: ${repositoryName}`, void 0, void 0);\n }\n};\nexport {\n getToolbarSrc\n};\n//# sourceMappingURL=getToolbarSrc.js.map\n"],"names":[],"mappings":";;AAEK,MAAC,gBAAgB,CAAC,mBAAmB;AACxC,MAAI,iBAAiB,cAAc,GAAG;AACpC,WAAO,0DAA0D,cAAc;AAAA,EACnF,OAAS;AACL,UAAM,IAAI,aAAa,iDAAiD,cAAc,IAAI,QAAQ,MAAM;AAAA,EACzG;AACH;","x_google_ignoreList":[0]}
@@ -1,47 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const link = require("../types/value/link.cjs");
4
- const documentToLinkField = require("./documentToLinkField.cjs");
5
- const asLink = (linkFieldOrDocument, ...configObjectOrTuple) => {
6
- if (!linkFieldOrDocument) {
7
- return null;
8
- }
9
- const linkField = (
10
- // prettier-ignore
11
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
12
- // @ts-ignore - Bug in TypeScript 4.9: https://github.com/microsoft/TypeScript/issues/51501
13
- // TODO: Remove the `prettier-ignore` comment when this bug is fixed.
14
- "link_type" in linkFieldOrDocument ? linkFieldOrDocument : documentToLinkField.documentToLinkField(linkFieldOrDocument)
15
- );
16
- const [configObjectOrLinkResolver] = configObjectOrTuple;
17
- let config;
18
- if (typeof configObjectOrLinkResolver === "function" || configObjectOrLinkResolver == null) {
19
- config = {
20
- linkResolver: configObjectOrLinkResolver
21
- };
22
- } else {
23
- config = { ...configObjectOrLinkResolver };
24
- }
25
- switch (linkField.link_type) {
26
- case link.LinkType.Media:
27
- case link.LinkType.Web:
28
- return "url" in linkField ? linkField.url : null;
29
- case link.LinkType.Document: {
30
- if ("id" in linkField && config.linkResolver) {
31
- const resolvedURL = config.linkResolver(linkField);
32
- if (resolvedURL != null) {
33
- return resolvedURL;
34
- }
35
- }
36
- if ("url" in linkField && linkField.url) {
37
- return linkField.url;
38
- }
39
- return null;
40
- }
41
- case link.LinkType.Any:
42
- default:
43
- return null;
44
- }
45
- };
46
- exports.asLink = asLink;
47
- //# sourceMappingURL=asLink.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"asLink.cjs","sources":["../../../../../../node_modules/@prismicio/client/dist/helpers/asLink.js"],"sourcesContent":["import { LinkType } from \"../types/value/link.js\";\nimport { documentToLinkField } from \"./documentToLinkField.js\";\nconst asLink = (linkFieldOrDocument, ...configObjectOrTuple) => {\n if (!linkFieldOrDocument) {\n return null;\n }\n const linkField = (\n // prettier-ignore\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore - Bug in TypeScript 4.9: https://github.com/microsoft/TypeScript/issues/51501\n // TODO: Remove the `prettier-ignore` comment when this bug is fixed.\n \"link_type\" in linkFieldOrDocument ? linkFieldOrDocument : documentToLinkField(linkFieldOrDocument)\n );\n const [configObjectOrLinkResolver] = configObjectOrTuple;\n let config;\n if (typeof configObjectOrLinkResolver === \"function\" || configObjectOrLinkResolver == null) {\n config = {\n linkResolver: configObjectOrLinkResolver\n };\n } else {\n config = { ...configObjectOrLinkResolver };\n }\n switch (linkField.link_type) {\n case LinkType.Media:\n case LinkType.Web:\n return \"url\" in linkField ? linkField.url : null;\n case LinkType.Document: {\n if (\"id\" in linkField && config.linkResolver) {\n const resolvedURL = config.linkResolver(linkField);\n if (resolvedURL != null) {\n return resolvedURL;\n }\n }\n if (\"url\" in linkField && linkField.url) {\n return linkField.url;\n }\n return null;\n }\n case LinkType.Any:\n default:\n return null;\n }\n};\nexport {\n asLink\n};\n//# sourceMappingURL=asLink.js.map\n"],"names":["documentToLinkField","LinkType"],"mappings":";;;;AAEK,MAAC,SAAS,CAAC,wBAAwB,wBAAwB;AAC9D,MAAI,CAAC,qBAAqB;AACxB,WAAO;AAAA,EACR;AACD,QAAM;AAAA;AAAA;AAAA;AAAA;AAAA,IAKJ,eAAe,sBAAsB,sBAAsBA,oBAAAA,oBAAoB,mBAAmB;AAAA;AAEpG,QAAM,CAAC,0BAA0B,IAAI;AACrC,MAAI;AACJ,MAAI,OAAO,+BAA+B,cAAc,8BAA8B,MAAM;AAC1F,aAAS;AAAA,MACP,cAAc;AAAA,IACpB;AAAA,EACA,OAAS;AACL,aAAS,EAAE,GAAG;EACf;AACD,UAAQ,UAAU,WAAS;AAAA,IACzB,KAAKC,KAAAA,SAAS;AAAA,IACd,KAAKA,KAAQ,SAAC;AACZ,aAAO,SAAS,YAAY,UAAU,MAAM;AAAA,IAC9C,KAAKA,KAAAA,SAAS,UAAU;AACtB,UAAI,QAAQ,aAAa,OAAO,cAAc;AAC5C,cAAM,cAAc,OAAO,aAAa,SAAS;AACjD,YAAI,eAAe,MAAM;AACvB,iBAAO;AAAA,QACR;AAAA,MACF;AACD,UAAI,SAAS,aAAa,UAAU,KAAK;AACvC,eAAO,UAAU;AAAA,MAClB;AACD,aAAO;AAAA,IACR;AAAA,IACD,KAAKA,KAAAA,SAAS;AAAA,IACd;AACE,aAAO;AAAA,EACV;AACH;;","x_google_ignoreList":[0]}
@@ -1,47 +0,0 @@
1
- import { LinkType } from "../types/value/link.js";
2
- import { documentToLinkField } from "./documentToLinkField.js";
3
- const asLink = (linkFieldOrDocument, ...configObjectOrTuple) => {
4
- if (!linkFieldOrDocument) {
5
- return null;
6
- }
7
- const linkField = (
8
- // prettier-ignore
9
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
10
- // @ts-ignore - Bug in TypeScript 4.9: https://github.com/microsoft/TypeScript/issues/51501
11
- // TODO: Remove the `prettier-ignore` comment when this bug is fixed.
12
- "link_type" in linkFieldOrDocument ? linkFieldOrDocument : documentToLinkField(linkFieldOrDocument)
13
- );
14
- const [configObjectOrLinkResolver] = configObjectOrTuple;
15
- let config;
16
- if (typeof configObjectOrLinkResolver === "function" || configObjectOrLinkResolver == null) {
17
- config = {
18
- linkResolver: configObjectOrLinkResolver
19
- };
20
- } else {
21
- config = { ...configObjectOrLinkResolver };
22
- }
23
- switch (linkField.link_type) {
24
- case LinkType.Media:
25
- case LinkType.Web:
26
- return "url" in linkField ? linkField.url : null;
27
- case LinkType.Document: {
28
- if ("id" in linkField && config.linkResolver) {
29
- const resolvedURL = config.linkResolver(linkField);
30
- if (resolvedURL != null) {
31
- return resolvedURL;
32
- }
33
- }
34
- if ("url" in linkField && linkField.url) {
35
- return linkField.url;
36
- }
37
- return null;
38
- }
39
- case LinkType.Any:
40
- default:
41
- return null;
42
- }
43
- };
44
- export {
45
- asLink
46
- };
47
- //# sourceMappingURL=asLink.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"asLink.js","sources":["../../../../../../node_modules/@prismicio/client/dist/helpers/asLink.js"],"sourcesContent":["import { LinkType } from \"../types/value/link.js\";\nimport { documentToLinkField } from \"./documentToLinkField.js\";\nconst asLink = (linkFieldOrDocument, ...configObjectOrTuple) => {\n if (!linkFieldOrDocument) {\n return null;\n }\n const linkField = (\n // prettier-ignore\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore - Bug in TypeScript 4.9: https://github.com/microsoft/TypeScript/issues/51501\n // TODO: Remove the `prettier-ignore` comment when this bug is fixed.\n \"link_type\" in linkFieldOrDocument ? linkFieldOrDocument : documentToLinkField(linkFieldOrDocument)\n );\n const [configObjectOrLinkResolver] = configObjectOrTuple;\n let config;\n if (typeof configObjectOrLinkResolver === \"function\" || configObjectOrLinkResolver == null) {\n config = {\n linkResolver: configObjectOrLinkResolver\n };\n } else {\n config = { ...configObjectOrLinkResolver };\n }\n switch (linkField.link_type) {\n case LinkType.Media:\n case LinkType.Web:\n return \"url\" in linkField ? linkField.url : null;\n case LinkType.Document: {\n if (\"id\" in linkField && config.linkResolver) {\n const resolvedURL = config.linkResolver(linkField);\n if (resolvedURL != null) {\n return resolvedURL;\n }\n }\n if (\"url\" in linkField && linkField.url) {\n return linkField.url;\n }\n return null;\n }\n case LinkType.Any:\n default:\n return null;\n }\n};\nexport {\n asLink\n};\n//# sourceMappingURL=asLink.js.map\n"],"names":[],"mappings":";;AAEK,MAAC,SAAS,CAAC,wBAAwB,wBAAwB;AAC9D,MAAI,CAAC,qBAAqB;AACxB,WAAO;AAAA,EACR;AACD,QAAM;AAAA;AAAA;AAAA;AAAA;AAAA,IAKJ,eAAe,sBAAsB,sBAAsB,oBAAoB,mBAAmB;AAAA;AAEpG,QAAM,CAAC,0BAA0B,IAAI;AACrC,MAAI;AACJ,MAAI,OAAO,+BAA+B,cAAc,8BAA8B,MAAM;AAC1F,aAAS;AAAA,MACP,cAAc;AAAA,IACpB;AAAA,EACA,OAAS;AACL,aAAS,EAAE,GAAG;EACf;AACD,UAAQ,UAAU,WAAS;AAAA,IACzB,KAAK,SAAS;AAAA,IACd,KAAK,SAAS;AACZ,aAAO,SAAS,YAAY,UAAU,MAAM;AAAA,IAC9C,KAAK,SAAS,UAAU;AACtB,UAAI,QAAQ,aAAa,OAAO,cAAc;AAC5C,cAAM,cAAc,OAAO,aAAa,SAAS;AACjD,YAAI,eAAe,MAAM;AACvB,iBAAO;AAAA,QACR;AAAA,MACF;AACD,UAAI,SAAS,aAAa,UAAU,KAAK;AACvC,eAAO,UAAU;AAAA,MAClB;AACD,aAAO;AAAA,IACR;AAAA,IACD,KAAK,SAAS;AAAA,IACd;AACE,aAAO;AAAA,EACV;AACH;","x_google_ignoreList":[0]}
@@ -1,28 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const isInternalURL = require("../lib/isInternalURL.cjs");
4
- const asLink = require("./asLink.cjs");
5
- const isFilled = require("./isFilled.cjs");
6
- const asLinkAttrs = (linkFieldOrDocument, config = {}) => {
7
- if (linkFieldOrDocument && // eslint-disable-next-line @typescript-eslint/ban-ts-comment
8
- // @ts-ignore - Bug in TypeScript 4.9: https://github.com/microsoft/TypeScript/issues/51501
9
- ("link_type" in linkFieldOrDocument ? isFilled.link(linkFieldOrDocument) : linkFieldOrDocument)) {
10
- const target = (
11
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
12
- // @ts-ignore - Bug in TypeScript 4.9: https://github.com/microsoft/TypeScript/issues/51501
13
- "target" in linkFieldOrDocument ? linkFieldOrDocument.target : void 0
14
- );
15
- const rawHref = asLink.asLink(linkFieldOrDocument, config.linkResolver);
16
- const href = rawHref == null ? void 0 : rawHref;
17
- const isExternal = typeof href === "string" ? !isInternalURL.isInternalURL(href) : false;
18
- const rel = config.rel ? config.rel({ href, isExternal, target }) : isExternal ? "noreferrer" : void 0;
19
- return {
20
- href,
21
- target,
22
- rel: rel == null ? void 0 : rel
23
- };
24
- }
25
- return {};
26
- };
27
- exports.asLinkAttrs = asLinkAttrs;
28
- //# sourceMappingURL=asLinkAttrs.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"asLinkAttrs.cjs","sources":["../../../../../../node_modules/@prismicio/client/dist/helpers/asLinkAttrs.js"],"sourcesContent":["import { isInternalURL } from \"../lib/isInternalURL.js\";\nimport { asLink } from \"./asLink.js\";\nimport { link } from \"./isFilled.js\";\nconst asLinkAttrs = (linkFieldOrDocument, config = {}) => {\n if (linkFieldOrDocument && // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore - Bug in TypeScript 4.9: https://github.com/microsoft/TypeScript/issues/51501\n (\"link_type\" in linkFieldOrDocument ? link(linkFieldOrDocument) : linkFieldOrDocument)) {\n const target = (\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore - Bug in TypeScript 4.9: https://github.com/microsoft/TypeScript/issues/51501\n \"target\" in linkFieldOrDocument ? linkFieldOrDocument.target : void 0\n );\n const rawHref = asLink(linkFieldOrDocument, config.linkResolver);\n const href = rawHref == null ? void 0 : rawHref;\n const isExternal = typeof href === \"string\" ? !isInternalURL(href) : false;\n const rel = config.rel ? config.rel({ href, isExternal, target }) : isExternal ? \"noreferrer\" : void 0;\n return {\n href,\n target,\n rel: rel == null ? void 0 : rel\n };\n }\n return {};\n};\nexport {\n asLinkAttrs\n};\n//# sourceMappingURL=asLinkAttrs.js.map\n"],"names":["link","asLink","isInternalURL"],"mappings":";;;;;AAGK,MAAC,cAAc,CAAC,qBAAqB,SAAS,OAAO;AACxD,MAAI;AAAA;AAAA,GAEH,eAAe,sBAAsBA,SAAAA,KAAK,mBAAmB,IAAI,sBAAsB;AACtF,UAAM;AAAA;AAAA;AAAA,MAGJ,YAAY,sBAAsB,oBAAoB,SAAS;AAAA;AAEjE,UAAM,UAAUC,OAAM,OAAC,qBAAqB,OAAO,YAAY;AAC/D,UAAM,OAAO,WAAW,OAAO,SAAS;AACxC,UAAM,aAAa,OAAO,SAAS,WAAW,CAACC,4BAAc,IAAI,IAAI;AACrE,UAAM,MAAM,OAAO,MAAM,OAAO,IAAI,EAAE,MAAM,YAAY,OAAM,CAAE,IAAI,aAAa,eAAe;AAChG,WAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA,KAAK,OAAO,OAAO,SAAS;AAAA,IAClC;AAAA,EACG;AACD,SAAO;AACT;;","x_google_ignoreList":[0]}
@@ -1,28 +0,0 @@
1
- import { isInternalURL } from "../lib/isInternalURL.js";
2
- import { asLink } from "./asLink.js";
3
- import { link } from "./isFilled.js";
4
- const asLinkAttrs = (linkFieldOrDocument, config = {}) => {
5
- if (linkFieldOrDocument && // eslint-disable-next-line @typescript-eslint/ban-ts-comment
6
- // @ts-ignore - Bug in TypeScript 4.9: https://github.com/microsoft/TypeScript/issues/51501
7
- ("link_type" in linkFieldOrDocument ? link(linkFieldOrDocument) : linkFieldOrDocument)) {
8
- const target = (
9
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
10
- // @ts-ignore - Bug in TypeScript 4.9: https://github.com/microsoft/TypeScript/issues/51501
11
- "target" in linkFieldOrDocument ? linkFieldOrDocument.target : void 0
12
- );
13
- const rawHref = asLink(linkFieldOrDocument, config.linkResolver);
14
- const href = rawHref == null ? void 0 : rawHref;
15
- const isExternal = typeof href === "string" ? !isInternalURL(href) : false;
16
- const rel = config.rel ? config.rel({ href, isExternal, target }) : isExternal ? "noreferrer" : void 0;
17
- return {
18
- href,
19
- target,
20
- rel: rel == null ? void 0 : rel
21
- };
22
- }
23
- return {};
24
- };
25
- export {
26
- asLinkAttrs
27
- };
28
- //# sourceMappingURL=asLinkAttrs.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"asLinkAttrs.js","sources":["../../../../../../node_modules/@prismicio/client/dist/helpers/asLinkAttrs.js"],"sourcesContent":["import { isInternalURL } from \"../lib/isInternalURL.js\";\nimport { asLink } from \"./asLink.js\";\nimport { link } from \"./isFilled.js\";\nconst asLinkAttrs = (linkFieldOrDocument, config = {}) => {\n if (linkFieldOrDocument && // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore - Bug in TypeScript 4.9: https://github.com/microsoft/TypeScript/issues/51501\n (\"link_type\" in linkFieldOrDocument ? link(linkFieldOrDocument) : linkFieldOrDocument)) {\n const target = (\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore - Bug in TypeScript 4.9: https://github.com/microsoft/TypeScript/issues/51501\n \"target\" in linkFieldOrDocument ? linkFieldOrDocument.target : void 0\n );\n const rawHref = asLink(linkFieldOrDocument, config.linkResolver);\n const href = rawHref == null ? void 0 : rawHref;\n const isExternal = typeof href === \"string\" ? !isInternalURL(href) : false;\n const rel = config.rel ? config.rel({ href, isExternal, target }) : isExternal ? \"noreferrer\" : void 0;\n return {\n href,\n target,\n rel: rel == null ? void 0 : rel\n };\n }\n return {};\n};\nexport {\n asLinkAttrs\n};\n//# sourceMappingURL=asLinkAttrs.js.map\n"],"names":[],"mappings":";;;AAGK,MAAC,cAAc,CAAC,qBAAqB,SAAS,OAAO;AACxD,MAAI;AAAA;AAAA,GAEH,eAAe,sBAAsB,KAAK,mBAAmB,IAAI,sBAAsB;AACtF,UAAM;AAAA;AAAA;AAAA,MAGJ,YAAY,sBAAsB,oBAAoB,SAAS;AAAA;AAEjE,UAAM,UAAU,OAAO,qBAAqB,OAAO,YAAY;AAC/D,UAAM,OAAO,WAAW,OAAO,SAAS;AACxC,UAAM,aAAa,OAAO,SAAS,WAAW,CAAC,cAAc,IAAI,IAAI;AACrE,UAAM,MAAM,OAAO,MAAM,OAAO,IAAI,EAAE,MAAM,YAAY,OAAM,CAAE,IAAI,aAAa,eAAe;AAChG,WAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA,KAAK,OAAO,OAAO,SAAS;AAAA,IAClC;AAAA,EACG;AACD,SAAO;AACT;","x_google_ignoreList":[0]}
@@ -1,27 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const link = require("../types/value/link.cjs");
4
- const documentToLinkField = (prismicDocument) => {
5
- var _a;
6
- return {
7
- link_type: link.LinkType.Document,
8
- id: prismicDocument.id,
9
- uid: prismicDocument.uid || void 0,
10
- type: prismicDocument.type,
11
- tags: prismicDocument.tags,
12
- lang: prismicDocument.lang,
13
- url: prismicDocument.url == null ? void 0 : prismicDocument.url,
14
- slug: (_a = prismicDocument.slugs) == null ? void 0 : _a[0],
15
- // Slug field is not available with GraphQL
16
- // The REST API does not include a `data` property if the data
17
- // object is empty.
18
- //
19
- // A presence check for `prismicDocument.data` is done to
20
- // support partial documents. While `documentToLinkField` is
21
- // not typed to accept partial documents, passing a partial
22
- // document can happen in untyped projects.
23
- ...prismicDocument.data && Object.keys(prismicDocument.data).length > 0 ? { data: prismicDocument.data } : {}
24
- };
25
- };
26
- exports.documentToLinkField = documentToLinkField;
27
- //# sourceMappingURL=documentToLinkField.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"documentToLinkField.cjs","sources":["../../../../../../node_modules/@prismicio/client/dist/helpers/documentToLinkField.js"],"sourcesContent":["import { LinkType } from \"../types/value/link.js\";\nconst documentToLinkField = (prismicDocument) => {\n var _a;\n return {\n link_type: LinkType.Document,\n id: prismicDocument.id,\n uid: prismicDocument.uid || void 0,\n type: prismicDocument.type,\n tags: prismicDocument.tags,\n lang: prismicDocument.lang,\n url: prismicDocument.url == null ? void 0 : prismicDocument.url,\n slug: (_a = prismicDocument.slugs) == null ? void 0 : _a[0],\n // Slug field is not available with GraphQL\n // The REST API does not include a `data` property if the data\n // object is empty.\n //\n // A presence check for `prismicDocument.data` is done to\n // support partial documents. While `documentToLinkField` is\n // not typed to accept partial documents, passing a partial\n // document can happen in untyped projects.\n ...prismicDocument.data && Object.keys(prismicDocument.data).length > 0 ? { data: prismicDocument.data } : {}\n };\n};\nexport {\n documentToLinkField\n};\n//# sourceMappingURL=documentToLinkField.js.map\n"],"names":["LinkType"],"mappings":";;;AACK,MAAC,sBAAsB,CAAC,oBAAoB;AAC/C,MAAI;AACJ,SAAO;AAAA,IACL,WAAWA,KAAQ,SAAC;AAAA,IACpB,IAAI,gBAAgB;AAAA,IACpB,KAAK,gBAAgB,OAAO;AAAA,IAC5B,MAAM,gBAAgB;AAAA,IACtB,MAAM,gBAAgB;AAAA,IACtB,MAAM,gBAAgB;AAAA,IACtB,KAAK,gBAAgB,OAAO,OAAO,SAAS,gBAAgB;AAAA,IAC5D,OAAO,KAAK,gBAAgB,UAAU,OAAO,SAAS,GAAG,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAS1D,GAAG,gBAAgB,QAAQ,OAAO,KAAK,gBAAgB,IAAI,EAAE,SAAS,IAAI,EAAE,MAAM,gBAAgB,KAAM,IAAG,CAAE;AAAA,EACjH;AACA;;","x_google_ignoreList":[0]}
@@ -1,27 +0,0 @@
1
- import { LinkType } from "../types/value/link.js";
2
- const documentToLinkField = (prismicDocument) => {
3
- var _a;
4
- return {
5
- link_type: LinkType.Document,
6
- id: prismicDocument.id,
7
- uid: prismicDocument.uid || void 0,
8
- type: prismicDocument.type,
9
- tags: prismicDocument.tags,
10
- lang: prismicDocument.lang,
11
- url: prismicDocument.url == null ? void 0 : prismicDocument.url,
12
- slug: (_a = prismicDocument.slugs) == null ? void 0 : _a[0],
13
- // Slug field is not available with GraphQL
14
- // The REST API does not include a `data` property if the data
15
- // object is empty.
16
- //
17
- // A presence check for `prismicDocument.data` is done to
18
- // support partial documents. While `documentToLinkField` is
19
- // not typed to accept partial documents, passing a partial
20
- // document can happen in untyped projects.
21
- ...prismicDocument.data && Object.keys(prismicDocument.data).length > 0 ? { data: prismicDocument.data } : {}
22
- };
23
- };
24
- export {
25
- documentToLinkField
26
- };
27
- //# sourceMappingURL=documentToLinkField.js.map