@prismicio/next 2.3.2 → 2.3.3-canary.bab3397

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 (174) hide show
  1. package/dist/PrismicNextImage.cjs +6 -5
  2. package/dist/PrismicNextImage.cjs.map +1 -1
  3. package/dist/PrismicNextImage.d.cts +7 -7
  4. package/dist/PrismicNextImage.d.cts.map +1 -1
  5. package/dist/PrismicNextImage.d.ts +7 -7
  6. package/dist/PrismicNextImage.d.ts.map +1 -1
  7. package/dist/PrismicNextImage.js +5 -4
  8. package/dist/PrismicNextImage.js.map +1 -1
  9. package/dist/PrismicNextLink.cjs +3 -2
  10. package/dist/PrismicNextLink.cjs.map +1 -1
  11. package/dist/PrismicNextLink.d.cts +9 -13
  12. package/dist/PrismicNextLink.d.cts.map +1 -1
  13. package/dist/PrismicNextLink.d.ts +8 -12
  14. package/dist/PrismicNextLink.d.ts.map +1 -1
  15. package/dist/PrismicNextLink.js +2 -1
  16. package/dist/PrismicNextLink.js.map +1 -1
  17. package/dist/PrismicPreview.cjs +2 -2
  18. package/dist/PrismicPreview.cjs.map +1 -1
  19. package/dist/PrismicPreview.d.cts +4 -5
  20. package/dist/PrismicPreview.d.cts.map +1 -1
  21. package/dist/PrismicPreview.d.ts +4 -5
  22. package/dist/PrismicPreview.d.ts.map +1 -1
  23. package/dist/PrismicPreview.js +1 -1
  24. package/dist/PrismicPreview.js.map +1 -1
  25. package/dist/PrismicPreviewClient.cjs +18 -13
  26. package/dist/PrismicPreviewClient.cjs.map +1 -1
  27. package/dist/PrismicPreviewClient.js +18 -12
  28. package/dist/PrismicPreviewClient.js.map +1 -1
  29. package/dist/SliceSimulator.cjs +3 -2
  30. package/dist/SliceSimulator.cjs.map +1 -1
  31. package/dist/SliceSimulator.d.cts +3 -4
  32. package/dist/SliceSimulator.d.cts.map +1 -1
  33. package/dist/SliceSimulator.d.ts +3 -4
  34. package/dist/SliceSimulator.d.ts.map +1 -1
  35. package/dist/SliceSimulator.js +2 -1
  36. package/dist/SliceSimulator.js.map +1 -1
  37. package/dist/SliceSimulatorWrapper.cjs +0 -1
  38. package/dist/SliceSimulatorWrapper.cjs.map +1 -1
  39. package/dist/SliceSimulatorWrapper.js.map +1 -1
  40. package/dist/_virtual/_rolldown/runtime.cjs +1 -1
  41. package/dist/cacheTagPrismicPages.cjs +1 -1
  42. package/dist/cacheTagPrismicPages.cjs.map +1 -1
  43. package/dist/cacheTagPrismicPages.d.cts +1 -3
  44. package/dist/cacheTagPrismicPages.d.cts.map +1 -1
  45. package/dist/cacheTagPrismicPages.d.ts +1 -3
  46. package/dist/cacheTagPrismicPages.d.ts.map +1 -1
  47. package/dist/cacheTagPrismicPages.js.map +1 -1
  48. package/dist/createLocaleRedirect.cjs.map +1 -1
  49. package/dist/createLocaleRedirect.d.cts +2 -3
  50. package/dist/createLocaleRedirect.d.cts.map +1 -1
  51. package/dist/createLocaleRedirect.d.ts +2 -3
  52. package/dist/createLocaleRedirect.d.ts.map +1 -1
  53. package/dist/createLocaleRedirect.js.map +1 -1
  54. package/dist/enableAutoPreviews.cjs.map +1 -1
  55. package/dist/enableAutoPreviews.d.cts +4 -5
  56. package/dist/enableAutoPreviews.d.cts.map +1 -1
  57. package/dist/enableAutoPreviews.d.ts +4 -5
  58. package/dist/enableAutoPreviews.d.ts.map +1 -1
  59. package/dist/enableAutoPreviews.js.map +1 -1
  60. package/dist/exitPreview.cjs +12 -4
  61. package/dist/exitPreview.cjs.map +1 -1
  62. package/dist/exitPreview.d.cts +1 -2
  63. package/dist/exitPreview.d.cts.map +1 -1
  64. package/dist/exitPreview.d.ts +1 -2
  65. package/dist/exitPreview.d.ts.map +1 -1
  66. package/dist/exitPreview.js +12 -3
  67. package/dist/exitPreview.js.map +1 -1
  68. package/dist/getPreviewRef.cjs +1 -2
  69. package/dist/getPreviewRef.cjs.map +1 -1
  70. package/dist/getPreviewRef.d.cts +1 -2
  71. package/dist/getPreviewRef.d.cts.map +1 -1
  72. package/dist/getPreviewRef.d.ts +1 -2
  73. package/dist/getPreviewRef.d.ts.map +1 -1
  74. package/dist/getPreviewRef.js +1 -1
  75. package/dist/getPreviewRef.js.map +1 -1
  76. package/dist/getPrismicCacheTags.cjs +4 -2
  77. package/dist/getPrismicCacheTags.cjs.map +1 -1
  78. package/dist/getPrismicCacheTags.d.cts +1 -3
  79. package/dist/getPrismicCacheTags.d.cts.map +1 -1
  80. package/dist/getPrismicCacheTags.d.ts +1 -3
  81. package/dist/getPrismicCacheTags.d.ts.map +1 -1
  82. package/dist/getPrismicCacheTags.js +4 -2
  83. package/dist/getPrismicCacheTags.js.map +1 -1
  84. package/dist/getSlices.cjs +1 -1
  85. package/dist/getSlices.cjs.map +1 -1
  86. package/dist/getSlices.d.cts +1 -3
  87. package/dist/getSlices.d.cts.map +1 -1
  88. package/dist/getSlices.d.ts +1 -3
  89. package/dist/getSlices.d.ts.map +1 -1
  90. package/dist/getSlices.js.map +1 -1
  91. package/dist/imgixLoader.cjs +0 -1
  92. package/dist/imgixLoader.cjs.map +1 -1
  93. package/dist/imgixLoader.d.cts +1 -3
  94. package/dist/imgixLoader.d.cts.map +1 -1
  95. package/dist/imgixLoader.d.ts +1 -3
  96. package/dist/imgixLoader.d.ts.map +1 -1
  97. package/dist/imgixLoader.js.map +1 -1
  98. package/dist/lib/devMsg.cjs.map +1 -1
  99. package/dist/lib/devMsg.js.map +1 -1
  100. package/dist/lib/resolveDefaultExport.cjs.map +1 -1
  101. package/dist/lib/resolveDefaultExport.js.map +1 -1
  102. package/dist/package.cjs +1 -1
  103. package/dist/package.js +1 -1
  104. package/dist/pages/PrismicPreview.cjs +1 -1
  105. package/dist/pages/PrismicPreview.cjs.map +1 -1
  106. package/dist/pages/PrismicPreview.d.cts +4 -5
  107. package/dist/pages/PrismicPreview.d.cts.map +1 -1
  108. package/dist/pages/PrismicPreview.d.ts +4 -5
  109. package/dist/pages/PrismicPreview.d.ts.map +1 -1
  110. package/dist/pages/PrismicPreview.js.map +1 -1
  111. package/dist/pages/SliceSimulator.cjs +0 -1
  112. package/dist/pages/SliceSimulator.cjs.map +1 -1
  113. package/dist/pages/SliceSimulator.d.cts +3 -4
  114. package/dist/pages/SliceSimulator.d.cts.map +1 -1
  115. package/dist/pages/SliceSimulator.d.ts +3 -4
  116. package/dist/pages/SliceSimulator.d.ts.map +1 -1
  117. package/dist/pages/SliceSimulator.js.map +1 -1
  118. package/dist/pages/enableAutoPreviews.cjs.map +1 -1
  119. package/dist/pages/enableAutoPreviews.d.cts +4 -5
  120. package/dist/pages/enableAutoPreviews.d.cts.map +1 -1
  121. package/dist/pages/enableAutoPreviews.d.ts +4 -5
  122. package/dist/pages/enableAutoPreviews.d.ts.map +1 -1
  123. package/dist/pages/enableAutoPreviews.js.map +1 -1
  124. package/dist/pages/exitPreview.cjs.map +1 -1
  125. package/dist/pages/exitPreview.d.cts +2 -4
  126. package/dist/pages/exitPreview.d.cts.map +1 -1
  127. package/dist/pages/exitPreview.d.ts +2 -4
  128. package/dist/pages/exitPreview.d.ts.map +1 -1
  129. package/dist/pages/exitPreview.js.map +1 -1
  130. package/dist/pages/redirectToPreviewURL.cjs.map +1 -1
  131. package/dist/pages/redirectToPreviewURL.d.cts +4 -5
  132. package/dist/pages/redirectToPreviewURL.d.cts.map +1 -1
  133. package/dist/pages/redirectToPreviewURL.d.ts +4 -5
  134. package/dist/pages/redirectToPreviewURL.d.ts.map +1 -1
  135. package/dist/pages/redirectToPreviewURL.js.map +1 -1
  136. package/dist/pages/setPreviewData.cjs +0 -1
  137. package/dist/pages/setPreviewData.cjs.map +1 -1
  138. package/dist/pages/setPreviewData.d.cts +2 -7
  139. package/dist/pages/setPreviewData.d.cts.map +1 -1
  140. package/dist/pages/setPreviewData.d.ts +2 -7
  141. package/dist/pages/setPreviewData.d.ts.map +1 -1
  142. package/dist/pages/setPreviewData.js.map +1 -1
  143. package/dist/pages/types.d.cts +3 -5
  144. package/dist/pages/types.d.cts.map +1 -1
  145. package/dist/pages/types.d.ts +3 -5
  146. package/dist/pages/types.d.ts.map +1 -1
  147. package/dist/redirectToPreviewURL.cjs +11 -2
  148. package/dist/redirectToPreviewURL.cjs.map +1 -1
  149. package/dist/redirectToPreviewURL.d.cts +4 -5
  150. package/dist/redirectToPreviewURL.d.cts.map +1 -1
  151. package/dist/redirectToPreviewURL.d.ts +4 -5
  152. package/dist/redirectToPreviewURL.d.ts.map +1 -1
  153. package/dist/redirectToPreviewURL.js +11 -1
  154. package/dist/redirectToPreviewURL.js.map +1 -1
  155. package/dist/revalidatePrismicPages.cjs +4 -2
  156. package/dist/revalidatePrismicPages.cjs.map +1 -1
  157. package/dist/revalidatePrismicPages.d.cts +1 -2
  158. package/dist/revalidatePrismicPages.d.cts.map +1 -1
  159. package/dist/revalidatePrismicPages.d.ts +1 -2
  160. package/dist/revalidatePrismicPages.d.ts.map +1 -1
  161. package/dist/revalidatePrismicPages.js +4 -1
  162. package/dist/revalidatePrismicPages.js.map +1 -1
  163. package/dist/types.d.cts +2 -4
  164. package/dist/types.d.cts.map +1 -1
  165. package/dist/types.d.ts +2 -4
  166. package/dist/types.d.ts.map +1 -1
  167. package/package.json +15 -15
  168. package/src/PrismicNextImage.tsx +5 -5
  169. package/src/PrismicNextLink.tsx +2 -2
  170. package/src/PrismicPreview.tsx +2 -2
  171. package/src/PrismicPreviewClient.tsx +26 -11
  172. package/src/exitPreview.ts +4 -6
  173. package/src/getPreviewRef.ts +3 -2
  174. package/src/redirectToPreviewURL.ts +10 -2
@@ -1 +1 @@
1
- {"version":3,"file":"exitPreview.d.cts","names":[],"sources":["../src/exitPreview.ts"],"mappings":";;AAiBA;;;;;;;;;;;;;;iBAAsB,WAAA,CAAA,GAAe,OAAA,CAAQ,QAAA"}
1
+ {"version":3,"file":"exitPreview.d.cts","names":[],"sources":["../src/exitPreview.ts"],"mappings":";;;;;;;;;;;;;;;;wBAiBsB,eAAe,QAAQ"}
@@ -14,7 +14,6 @@
14
14
  * }
15
15
  * ```
16
16
  */
17
- declare function exitPreview(): Promise<Response>;
17
+ export declare function exitPreview(): Promise<Response>;
18
18
  //#endregion
19
- export { exitPreview };
20
19
  //# sourceMappingURL=exitPreview.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"exitPreview.d.ts","names":[],"sources":["../src/exitPreview.ts"],"mappings":";;AAiBA;;;;;;;;;;;;;;iBAAsB,WAAA,CAAA,GAAe,OAAA,CAAQ,QAAA"}
1
+ {"version":3,"file":"exitPreview.d.ts","names":[],"sources":["../src/exitPreview.ts"],"mappings":";;;;;;;;;;;;;;;;wBAiBsB,eAAe,QAAQ"}
@@ -16,9 +16,18 @@ import { cookie } from "@prismicio/client";
16
16
  * ```
17
17
  */
18
18
  async function exitPreview() {
19
- const { cookies, draftMode } = await import("next/headers.js");
20
- (await draftMode()).disable();
21
- (await cookies()).delete(cookie.preview);
19
+ const { cookies } = await import("next/headers.js");
20
+ const cookieJar = await cookies();
21
+ cookieJar.delete({
22
+ name: "__prerender_bypass",
23
+ sameSite: "none",
24
+ secure: true
25
+ });
26
+ cookieJar.delete({
27
+ name: cookie.preview,
28
+ sameSite: "none",
29
+ secure: true
30
+ });
22
31
  return new Response(JSON.stringify({ success: true }), { headers: { "Cache-Control": "no-store" } });
23
32
  }
24
33
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"exitPreview.js","names":["prismicCookie"],"sources":["../src/exitPreview.ts"],"sourcesContent":["import { cookie as prismicCookie } from \"@prismicio/client\"\n\n/**\n * Ends a Prismic preview session within a Next.js app. This function should be used in a Router\n * Handler.\n *\n * @example\n * \t;```typescript\n * \t// src/app/api/exit-preview/route.js\n *\n * \timport { exitPreview } from \"@prismicio/next\"\n *\n * \texport async function GET() {\n * \t\treturn await exitPreview()\n * \t}\n * \t```\n */\nexport async function exitPreview(): Promise<Response> {\n\t// Need this to avoid the following Next.js build-time error:\n\t// You're importing a component that needs next/headers. That only works\n\t// in a Server Component which is not supported in the pages/ directory.\n\tconst { cookies, draftMode } = await import(\"next/headers\")\n\n\t;(await draftMode()).disable()\n\n\t// `redirectToPreviewURL` writes the preview cookie, so `exitPreview`\n\t// clears it to close the preview-cookie loop.\n\t;(await cookies()).delete(prismicCookie.preview)\n\n\t// `Cache-Control` header is used to prevent CDN-level caching.\n\treturn new Response(JSON.stringify({ success: true }), {\n\t\theaders: {\n\t\t\t\"Cache-Control\": \"no-store\",\n\t\t},\n\t})\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAiBA,eAAsB,cAAiC;CAItD,MAAM,EAAE,SAAS,cAAc,MAAM,OAAO;AAE3C,EAAC,MAAM,WAAW,EAAE,SAAS;AAI7B,EAAC,MAAM,SAAS,EAAE,OAAOA,OAAc,QAAQ;AAGhD,QAAO,IAAI,SAAS,KAAK,UAAU,EAAE,SAAS,MAAM,CAAC,EAAE,EACtD,SAAS,EACR,iBAAiB,YACjB,EACD,CAAC"}
1
+ {"version":3,"file":"exitPreview.js","names":["prismicCookie"],"sources":["../src/exitPreview.ts"],"sourcesContent":["import { cookie as prismicCookie } from \"@prismicio/client\"\n\n/**\n * Ends a Prismic preview session within a Next.js app. This function should be used in a Router\n * Handler.\n *\n * @example\n * \t;```typescript\n * \t// src/app/api/exit-preview/route.js\n *\n * \timport { exitPreview } from \"@prismicio/next\"\n *\n * \texport async function GET() {\n * \t\treturn await exitPreview()\n * \t}\n * \t```\n */\nexport async function exitPreview(): Promise<Response> {\n\t// Need this to avoid the following Next.js build-time error:\n\t// You're importing a component that needs next/headers. That only works\n\t// in a Server Component which is not supported in the pages/ directory.\n\tconst { cookies } = await import(\"next/headers\")\n\n\tconst cookieJar = await cookies()\n\tcookieJar.delete({ name: \"__prerender_bypass\", sameSite: \"none\", secure: true })\n\tcookieJar.delete({ name: prismicCookie.preview, sameSite: \"none\", secure: true })\n\n\t// `Cache-Control` header is used to prevent CDN-level caching.\n\treturn new Response(JSON.stringify({ success: true }), {\n\t\theaders: {\n\t\t\t\"Cache-Control\": \"no-store\",\n\t\t},\n\t})\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAiBA,eAAsB,cAAiC;CAItD,MAAM,EAAE,YAAY,MAAM,OAAO;CAEjC,MAAM,YAAY,MAAM,QAAQ;CAChC,UAAU,OAAO;EAAE,MAAM;EAAsB,UAAU;EAAQ,QAAQ;CAAK,CAAC;CAC/E,UAAU,OAAO;EAAE,MAAMA,OAAc;EAAS,UAAU;EAAQ,QAAQ;CAAK,CAAC;CAGhF,OAAO,IAAI,SAAS,KAAK,UAAU,EAAE,SAAS,KAAK,CAAC,GAAG,EACtD,SAAS,EACR,iBAAiB,WAClB,EACD,CAAC;AACF"}
@@ -1,4 +1,3 @@
1
- require("./_virtual/_rolldown/runtime.cjs");
2
1
  let _prismicio_client = require("@prismicio/client");
3
2
  //#region src/getPreviewRef.ts
4
3
  /**
@@ -29,7 +28,7 @@ async function getPreviewRef() {
29
28
  if (!isDraftModeEnabled) return;
30
29
  const cookie = (await cookies()).get(_prismicio_client.cookie.preview)?.value;
31
30
  if (!cookie) return;
32
- if (!cookie.includes("websitePreviewId=")) return;
31
+ if (cookie.startsWith("{") && !cookie.includes("\"preview\"")) return;
33
32
  return cookie;
34
33
  }
35
34
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"getPreviewRef.cjs","names":["prismicCookie"],"sources":["../src/getPreviewRef.ts"],"sourcesContent":["import { cookie as prismicCookie } from \"@prismicio/client\"\n\n/**\n * Reads the Prismic preview ref for the current request when an active preview session exists.\n *\n * This is the read-side counterpart to `redirectToPreviewURL`, which writes the preview cookie. Use\n * it with Next.js Cache Components to read the ref _outside_ a cached function and pass it _in_ as\n * an argument so it becomes part of the cache key:\n *\n * @example\n * \t;```typescript\n * \timport { getPreviewRef } from \"@prismicio/next\"\n *\n * \tconst page = await fetchPage(uid, await getPreviewRef())\n * \t```\n *\n * @returns The active preview ref, or `undefined` if no preview session is active.\n * @experimental\n */\nexport async function getPreviewRef(): Promise<string | undefined> {\n\t// Need this to avoid the following Next.js build-time error:\n\t// You're importing a component that needs next/headers. That only works\n\t// in a Server Component which is not supported in the pages/ directory.\n\tconst { cookies, draftMode } = await import(\"next/headers\")\n\n\tlet isDraftModeEnabled = false\n\ttry {\n\t\tisDraftModeEnabled = (await draftMode()).isEnabled\n\t} catch {\n\t\t// `draftMode()` may have been called in a place that\n\t\t// does not have access to its async storage. This\n\t\t// occurs in places like `generateStaticParams()`. We\n\t\t// can ignore this case.\n\t\treturn\n\t}\n\tif (!isDraftModeEnabled) {\n\t\treturn\n\t}\n\n\tconst cookie = (await cookies()).get(prismicCookie.preview)?.value\n\tif (!cookie) {\n\t\treturn\n\t}\n\n\tconst isActiveCookie = cookie.includes(\"websitePreviewId=\")\n\tif (!isActiveCookie) {\n\t\treturn\n\t}\n\n\treturn cookie\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAmBA,eAAsB,gBAA6C;CAIlE,MAAM,EAAE,SAAS,cAAc,MAAM,OAAO;CAE5C,IAAI,qBAAqB;AACzB,KAAI;AACH,wBAAsB,MAAM,WAAW,EAAE;SAClC;AAKP;;AAED,KAAI,CAAC,mBACJ;CAGD,MAAM,UAAU,MAAM,SAAS,EAAE,IAAIA,kBAAAA,OAAc,QAAQ,EAAE;AAC7D,KAAI,CAAC,OACJ;AAID,KAAI,CADmB,OAAO,SAAS,oBAAoB,CAE1D;AAGD,QAAO"}
1
+ {"version":3,"file":"getPreviewRef.cjs","names":["prismicCookie"],"sources":["../src/getPreviewRef.ts"],"sourcesContent":["import { cookie as prismicCookie } from \"@prismicio/client\"\n\n/**\n * Reads the Prismic preview ref for the current request when an active preview session exists.\n *\n * This is the read-side counterpart to `redirectToPreviewURL`, which writes the preview cookie. Use\n * it with Next.js Cache Components to read the ref _outside_ a cached function and pass it _in_ as\n * an argument so it becomes part of the cache key:\n *\n * @example\n * \t;```typescript\n * \timport { getPreviewRef } from \"@prismicio/next\"\n *\n * \tconst page = await fetchPage(uid, await getPreviewRef())\n * \t```\n *\n * @returns The active preview ref, or `undefined` if no preview session is active.\n * @experimental\n */\nexport async function getPreviewRef(): Promise<string | undefined> {\n\t// Need this to avoid the following Next.js build-time error:\n\t// You're importing a component that needs next/headers. That only works\n\t// in a Server Component which is not supported in the pages/ directory.\n\tconst { cookies, draftMode } = await import(\"next/headers\")\n\n\tlet isDraftModeEnabled = false\n\ttry {\n\t\tisDraftModeEnabled = (await draftMode()).isEnabled\n\t} catch {\n\t\t// `draftMode()` may have been called in a place that\n\t\t// does not have access to its async storage. This\n\t\t// occurs in places like `generateStaticParams()`. We\n\t\t// can ignore this case.\n\t\treturn\n\t}\n\tif (!isDraftModeEnabled) {\n\t\treturn\n\t}\n\n\tconst cookie = (await cookies()).get(prismicCookie.preview)?.value\n\tif (!cookie) {\n\t\treturn\n\t}\n\n\t// The toolbar's JSON cookie has a `preview` entry only while a preview is active.\n\tconst isInactiveCookie = cookie.startsWith(\"{\") && !cookie.includes('\"preview\"')\n\tif (isInactiveCookie) {\n\t\treturn\n\t}\n\n\treturn cookie\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAmBA,eAAsB,gBAA6C;CAIlE,MAAM,EAAE,SAAS,cAAc,MAAM,OAAO;CAE5C,IAAI,qBAAqB;CACzB,IAAI;EACH,sBAAsB,MAAM,UAAU,EAAA,CAAG;CAC1C,QAAQ;EAKP;CACD;CACA,IAAI,CAAC,oBACJ;CAGD,MAAM,UAAU,MAAM,QAAQ,EAAA,CAAG,IAAIA,kBAAAA,OAAc,OAAO,CAAC,EAAE;CAC7D,IAAI,CAAC,QACJ;CAKD,IADyB,OAAO,WAAW,GAAG,KAAK,CAAC,OAAO,SAAS,aAAW,GAE9E;CAGD,OAAO;AACR"}
@@ -16,7 +16,6 @@
16
16
  * @returns The active preview ref, or `undefined` if no preview session is active.
17
17
  * @experimental
18
18
  */
19
- declare function getPreviewRef(): Promise<string | undefined>;
19
+ export declare function getPreviewRef(): Promise<string | undefined>;
20
20
  //#endregion
21
- export { getPreviewRef };
22
21
  //# sourceMappingURL=getPreviewRef.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"getPreviewRef.d.cts","names":[],"sources":["../src/getPreviewRef.ts"],"mappings":";;AAmBA;;;;;;;;;;;;;;;;iBAAsB,aAAA,CAAA,GAAiB,OAAA"}
1
+ {"version":3,"file":"getPreviewRef.d.cts","names":[],"sources":["../src/getPreviewRef.ts"],"mappings":";;;;;;;;;;;;;;;;;;wBAmBsB,iBAAiB"}
@@ -16,7 +16,6 @@
16
16
  * @returns The active preview ref, or `undefined` if no preview session is active.
17
17
  * @experimental
18
18
  */
19
- declare function getPreviewRef(): Promise<string | undefined>;
19
+ export declare function getPreviewRef(): Promise<string | undefined>;
20
20
  //#endregion
21
- export { getPreviewRef };
22
21
  //# sourceMappingURL=getPreviewRef.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"getPreviewRef.d.ts","names":[],"sources":["../src/getPreviewRef.ts"],"mappings":";;AAmBA;;;;;;;;;;;;;;;;iBAAsB,aAAA,CAAA,GAAiB,OAAA"}
1
+ {"version":3,"file":"getPreviewRef.d.ts","names":[],"sources":["../src/getPreviewRef.ts"],"mappings":";;;;;;;;;;;;;;;;;;wBAmBsB,iBAAiB"}
@@ -28,7 +28,7 @@ async function getPreviewRef() {
28
28
  if (!isDraftModeEnabled) return;
29
29
  const cookie$1 = (await cookies()).get(cookie.preview)?.value;
30
30
  if (!cookie$1) return;
31
- if (!cookie$1.includes("websitePreviewId=")) return;
31
+ if (cookie$1.startsWith("{") && !cookie$1.includes("\"preview\"")) return;
32
32
  return cookie$1;
33
33
  }
34
34
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"getPreviewRef.js","names":["cookie","prismicCookie"],"sources":["../src/getPreviewRef.ts"],"sourcesContent":["import { cookie as prismicCookie } from \"@prismicio/client\"\n\n/**\n * Reads the Prismic preview ref for the current request when an active preview session exists.\n *\n * This is the read-side counterpart to `redirectToPreviewURL`, which writes the preview cookie. Use\n * it with Next.js Cache Components to read the ref _outside_ a cached function and pass it _in_ as\n * an argument so it becomes part of the cache key:\n *\n * @example\n * \t;```typescript\n * \timport { getPreviewRef } from \"@prismicio/next\"\n *\n * \tconst page = await fetchPage(uid, await getPreviewRef())\n * \t```\n *\n * @returns The active preview ref, or `undefined` if no preview session is active.\n * @experimental\n */\nexport async function getPreviewRef(): Promise<string | undefined> {\n\t// Need this to avoid the following Next.js build-time error:\n\t// You're importing a component that needs next/headers. That only works\n\t// in a Server Component which is not supported in the pages/ directory.\n\tconst { cookies, draftMode } = await import(\"next/headers\")\n\n\tlet isDraftModeEnabled = false\n\ttry {\n\t\tisDraftModeEnabled = (await draftMode()).isEnabled\n\t} catch {\n\t\t// `draftMode()` may have been called in a place that\n\t\t// does not have access to its async storage. This\n\t\t// occurs in places like `generateStaticParams()`. We\n\t\t// can ignore this case.\n\t\treturn\n\t}\n\tif (!isDraftModeEnabled) {\n\t\treturn\n\t}\n\n\tconst cookie = (await cookies()).get(prismicCookie.preview)?.value\n\tif (!cookie) {\n\t\treturn\n\t}\n\n\tconst isActiveCookie = cookie.includes(\"websitePreviewId=\")\n\tif (!isActiveCookie) {\n\t\treturn\n\t}\n\n\treturn cookie\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAmBA,eAAsB,gBAA6C;CAIlE,MAAM,EAAE,SAAS,cAAc,MAAM,OAAO;CAE5C,IAAI,qBAAqB;AACzB,KAAI;AACH,wBAAsB,MAAM,WAAW,EAAE;SAClC;AAKP;;AAED,KAAI,CAAC,mBACJ;CAGD,MAAMA,YAAU,MAAM,SAAS,EAAE,IAAIC,OAAc,QAAQ,EAAE;AAC7D,KAAI,CAACD,SACJ;AAID,KAAI,CADmBA,SAAO,SAAS,oBAAoB,CAE1D;AAGD,QAAOA"}
1
+ {"version":3,"file":"getPreviewRef.js","names":["cookie","prismicCookie"],"sources":["../src/getPreviewRef.ts"],"sourcesContent":["import { cookie as prismicCookie } from \"@prismicio/client\"\n\n/**\n * Reads the Prismic preview ref for the current request when an active preview session exists.\n *\n * This is the read-side counterpart to `redirectToPreviewURL`, which writes the preview cookie. Use\n * it with Next.js Cache Components to read the ref _outside_ a cached function and pass it _in_ as\n * an argument so it becomes part of the cache key:\n *\n * @example\n * \t;```typescript\n * \timport { getPreviewRef } from \"@prismicio/next\"\n *\n * \tconst page = await fetchPage(uid, await getPreviewRef())\n * \t```\n *\n * @returns The active preview ref, or `undefined` if no preview session is active.\n * @experimental\n */\nexport async function getPreviewRef(): Promise<string | undefined> {\n\t// Need this to avoid the following Next.js build-time error:\n\t// You're importing a component that needs next/headers. That only works\n\t// in a Server Component which is not supported in the pages/ directory.\n\tconst { cookies, draftMode } = await import(\"next/headers\")\n\n\tlet isDraftModeEnabled = false\n\ttry {\n\t\tisDraftModeEnabled = (await draftMode()).isEnabled\n\t} catch {\n\t\t// `draftMode()` may have been called in a place that\n\t\t// does not have access to its async storage. This\n\t\t// occurs in places like `generateStaticParams()`. We\n\t\t// can ignore this case.\n\t\treturn\n\t}\n\tif (!isDraftModeEnabled) {\n\t\treturn\n\t}\n\n\tconst cookie = (await cookies()).get(prismicCookie.preview)?.value\n\tif (!cookie) {\n\t\treturn\n\t}\n\n\t// The toolbar's JSON cookie has a `preview` entry only while a preview is active.\n\tconst isInactiveCookie = cookie.startsWith(\"{\") && !cookie.includes('\"preview\"')\n\tif (isInactiveCookie) {\n\t\treturn\n\t}\n\n\treturn cookie\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAmBA,eAAsB,gBAA6C;CAIlE,MAAM,EAAE,SAAS,cAAc,MAAM,OAAO;CAE5C,IAAI,qBAAqB;CACzB,IAAI;EACH,sBAAsB,MAAM,UAAU,EAAA,CAAG;CAC1C,QAAQ;EAKP;CACD;CACA,IAAI,CAAC,oBACJ;CAGD,MAAMA,YAAU,MAAM,QAAQ,EAAA,CAAG,IAAIC,OAAc,OAAO,CAAC,EAAE;CAC7D,IAAI,CAACD,UACJ;CAKD,IADyBA,SAAO,WAAW,GAAG,KAAK,CAACA,SAAO,SAAS,aAAW,GAE9E;CAGD,OAAOA;AACR"}
@@ -19,8 +19,10 @@ function getPrismicDocumentIDs(input) {
19
19
  if (typeof input !== "object" || input == null) return [];
20
20
  if (Array.isArray(input)) return input.flatMap((item) => getPrismicDocumentIDs(item));
21
21
  if ("id" in input && typeof input.id === "string") {
22
- if ("href" in input && typeof input.href === "string" && input.href.includes("/api/v2/documents/search?") || "link_type" in input && input.link_type === "Document") if ("data" in input && typeof input.data === "object" && input.data !== null) return [input.id, ...getPrismicDocumentIDs(input.data)];
23
- else return [input.id];
22
+ if ("href" in input && typeof input.href === "string" && input.href.includes("/api/v2/documents/search?") || "link_type" in input && input.link_type === "Document") {
23
+ if ("data" in input && typeof input.data === "object" && input.data !== null) return [input.id, ...getPrismicDocumentIDs(input.data)];
24
+ else return [input.id];
25
+ }
24
26
  }
25
27
  return Object.values(input).flatMap((input) => getPrismicDocumentIDs(input));
26
28
  }
@@ -1 +1 @@
1
- {"version":3,"file":"getPrismicCacheTags.cjs","names":[],"sources":["../src/getPrismicCacheTags.ts"],"sourcesContent":["import type { PrismicDocument } from \"@prismicio/client\"\n\nconst CACHE_TAG_PREFIX = \"prismic/\"\n\n/**\n * Generates cache tags for a set of Prismic pages. Tags for linked pages (e.g. a content\n * relationship) are included to ensure all related content can be revalidated.\n *\n * @param pages - A set of Prismic pages used to tag the function.\n * @experimental\n *\n * @see {@link https://nextjs.org/docs/app/api-reference/functions/cacheTag}\n */\nexport function getPrismicCacheTags(pages: PrismicDocument[]): string[] {\n\tconst ids = [...new Set(getPrismicDocumentIDs(pages))]\n\treturn ids.map((id) => buildPrismicCacheTag(id))\n}\n\nexport function buildPrismicCacheTag(id: string): string {\n\treturn `${CACHE_TAG_PREFIX}${id}`\n}\n\nfunction getPrismicDocumentIDs(input: unknown): string[] {\n\tif (typeof input !== \"object\" || input == null) return []\n\n\tif (Array.isArray(input)) return input.flatMap((item) => getPrismicDocumentIDs(item))\n\n\tif (\"id\" in input && typeof input.id === \"string\") {\n\t\t// Document\n\t\t// Content relationship or link\n\t\tif (\n\t\t\t(\"href\" in input &&\n\t\t\t\ttypeof input.href === \"string\" &&\n\t\t\t\tinput.href.includes(\"/api/v2/documents/search?\")) ||\n\t\t\t(\"link_type\" in input && input.link_type === \"Document\")\n\t\t) {\n\t\t\tif (\"data\" in input && typeof input.data === \"object\" && input.data !== null) {\n\t\t\t\treturn [input.id, ...getPrismicDocumentIDs(input.data)]\n\t\t\t} else {\n\t\t\t\treturn [input.id]\n\t\t\t}\n\t\t}\n\t}\n\n\treturn Object.values(input).flatMap((input) => getPrismicDocumentIDs(input))\n}\n"],"mappings":";AAEA,MAAM,mBAAmB;;;;;;;;;;AAWzB,SAAgB,oBAAoB,OAAoC;AAEvE,QADY,CAAC,GAAG,IAAI,IAAI,sBAAsB,MAAM,CAAC,CAAC,CAC3C,KAAK,OAAO,qBAAqB,GAAG,CAAC;;AAGjD,SAAgB,qBAAqB,IAAoB;AACxD,QAAO,GAAG,mBAAmB;;AAG9B,SAAS,sBAAsB,OAA0B;AACxD,KAAI,OAAO,UAAU,YAAY,SAAS,KAAM,QAAO,EAAE;AAEzD,KAAI,MAAM,QAAQ,MAAM,CAAE,QAAO,MAAM,SAAS,SAAS,sBAAsB,KAAK,CAAC;AAErF,KAAI,QAAQ,SAAS,OAAO,MAAM,OAAO;MAItC,UAAU,SACV,OAAO,MAAM,SAAS,YACtB,MAAM,KAAK,SAAS,4BAA4B,IAChD,eAAe,SAAS,MAAM,cAAc,WAE7C,KAAI,UAAU,SAAS,OAAO,MAAM,SAAS,YAAY,MAAM,SAAS,KACvE,QAAO,CAAC,MAAM,IAAI,GAAG,sBAAsB,MAAM,KAAK,CAAC;MAEvD,QAAO,CAAC,MAAM,GAAG;;AAKpB,QAAO,OAAO,OAAO,MAAM,CAAC,SAAS,UAAU,sBAAsB,MAAM,CAAC"}
1
+ {"version":3,"file":"getPrismicCacheTags.cjs","names":[],"sources":["../src/getPrismicCacheTags.ts"],"sourcesContent":["import type { PrismicDocument } from \"@prismicio/client\"\n\nconst CACHE_TAG_PREFIX = \"prismic/\"\n\n/**\n * Generates cache tags for a set of Prismic pages. Tags for linked pages (e.g. a content\n * relationship) are included to ensure all related content can be revalidated.\n *\n * @param pages - A set of Prismic pages used to tag the function.\n * @experimental\n *\n * @see {@link https://nextjs.org/docs/app/api-reference/functions/cacheTag}\n */\nexport function getPrismicCacheTags(pages: PrismicDocument[]): string[] {\n\tconst ids = [...new Set(getPrismicDocumentIDs(pages))]\n\treturn ids.map((id) => buildPrismicCacheTag(id))\n}\n\nexport function buildPrismicCacheTag(id: string): string {\n\treturn `${CACHE_TAG_PREFIX}${id}`\n}\n\nfunction getPrismicDocumentIDs(input: unknown): string[] {\n\tif (typeof input !== \"object\" || input == null) return []\n\n\tif (Array.isArray(input)) return input.flatMap((item) => getPrismicDocumentIDs(item))\n\n\tif (\"id\" in input && typeof input.id === \"string\") {\n\t\t// Document\n\t\t// Content relationship or link\n\t\tif (\n\t\t\t(\"href\" in input &&\n\t\t\t\ttypeof input.href === \"string\" &&\n\t\t\t\tinput.href.includes(\"/api/v2/documents/search?\")) ||\n\t\t\t(\"link_type\" in input && input.link_type === \"Document\")\n\t\t) {\n\t\t\tif (\"data\" in input && typeof input.data === \"object\" && input.data !== null) {\n\t\t\t\treturn [input.id, ...getPrismicDocumentIDs(input.data)]\n\t\t\t} else {\n\t\t\t\treturn [input.id]\n\t\t\t}\n\t\t}\n\t}\n\n\treturn Object.values(input).flatMap((input) => getPrismicDocumentIDs(input))\n}\n"],"mappings":";AAEA,MAAM,mBAAmB;;;;;;;;;;AAWzB,SAAgB,oBAAoB,OAAoC;CAEvE,OAAO,CADM,GAAG,IAAI,IAAI,sBAAsB,KAAK,CAAC,CAC3C,CAAC,CAAC,KAAK,OAAO,qBAAqB,EAAE,CAAC;AAChD;AAEA,SAAgB,qBAAqB,IAAoB;CACxD,OAAO,GAAG,mBAAmB;AAC9B;AAEA,SAAS,sBAAsB,OAA0B;CACxD,IAAI,OAAO,UAAU,YAAY,SAAS,MAAM,OAAO,CAAC;CAExD,IAAI,MAAM,QAAQ,KAAK,GAAG,OAAO,MAAM,SAAS,SAAS,sBAAsB,IAAI,CAAC;CAEpF,IAAI,QAAQ,SAAS,OAAO,MAAM,OAAO,UAItC;MAAA,UAAU,SACV,OAAO,MAAM,SAAS,YACtB,MAAM,KAAK,SAAS,2BAA2B,KAC/C,eAAe,SAAS,MAAM,cAAc,YAC5C;GACD,IAAI,UAAU,SAAS,OAAO,MAAM,SAAS,YAAY,MAAM,SAAS,MACvE,OAAO,CAAC,MAAM,IAAI,GAAG,sBAAsB,MAAM,IAAI,CAAC;QAEtD,OAAO,CAAC,MAAM,EAAE;EAElB;;CAGD,OAAO,OAAO,OAAO,KAAK,CAAC,CAAC,SAAS,UAAU,sBAAsB,KAAK,CAAC;AAC5E"}
@@ -1,5 +1,4 @@
1
1
  import { PrismicDocument } from "@prismicio/client";
2
-
3
2
  //#region src/getPrismicCacheTags.d.ts
4
3
  /**
5
4
  * Generates cache tags for a set of Prismic pages. Tags for linked pages (e.g. a content
@@ -10,7 +9,6 @@ import { PrismicDocument } from "@prismicio/client";
10
9
  *
11
10
  * @see {@link https://nextjs.org/docs/app/api-reference/functions/cacheTag}
12
11
  */
13
- declare function getPrismicCacheTags(pages: PrismicDocument[]): string[];
12
+ export declare function getPrismicCacheTags(pages: PrismicDocument[]): string[];
14
13
  //#endregion
15
- export { getPrismicCacheTags };
16
14
  //# sourceMappingURL=getPrismicCacheTags.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"getPrismicCacheTags.d.cts","names":[],"sources":["../src/getPrismicCacheTags.ts"],"mappings":";;;;;AAaA;;;;;;;iBAAgB,mBAAA,CAAoB,KAAA,EAAO,eAAA"}
1
+ {"version":3,"file":"getPrismicCacheTags.d.cts","names":[],"sources":["../src/getPrismicCacheTags.ts"],"mappings":";;;;;;;;;;;wBAagB,oBAAoB,OAAO"}
@@ -1,5 +1,4 @@
1
1
  import { PrismicDocument } from "@prismicio/client";
2
-
3
2
  //#region src/getPrismicCacheTags.d.ts
4
3
  /**
5
4
  * Generates cache tags for a set of Prismic pages. Tags for linked pages (e.g. a content
@@ -10,7 +9,6 @@ import { PrismicDocument } from "@prismicio/client";
10
9
  *
11
10
  * @see {@link https://nextjs.org/docs/app/api-reference/functions/cacheTag}
12
11
  */
13
- declare function getPrismicCacheTags(pages: PrismicDocument[]): string[];
12
+ export declare function getPrismicCacheTags(pages: PrismicDocument[]): string[];
14
13
  //#endregion
15
- export { getPrismicCacheTags };
16
14
  //# sourceMappingURL=getPrismicCacheTags.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"getPrismicCacheTags.d.ts","names":[],"sources":["../src/getPrismicCacheTags.ts"],"mappings":";;;;;AAaA;;;;;;;iBAAgB,mBAAA,CAAoB,KAAA,EAAO,eAAA"}
1
+ {"version":3,"file":"getPrismicCacheTags.d.ts","names":[],"sources":["../src/getPrismicCacheTags.ts"],"mappings":";;;;;;;;;;;wBAagB,oBAAoB,OAAO"}
@@ -19,8 +19,10 @@ function getPrismicDocumentIDs(input) {
19
19
  if (typeof input !== "object" || input == null) return [];
20
20
  if (Array.isArray(input)) return input.flatMap((item) => getPrismicDocumentIDs(item));
21
21
  if ("id" in input && typeof input.id === "string") {
22
- if ("href" in input && typeof input.href === "string" && input.href.includes("/api/v2/documents/search?") || "link_type" in input && input.link_type === "Document") if ("data" in input && typeof input.data === "object" && input.data !== null) return [input.id, ...getPrismicDocumentIDs(input.data)];
23
- else return [input.id];
22
+ if ("href" in input && typeof input.href === "string" && input.href.includes("/api/v2/documents/search?") || "link_type" in input && input.link_type === "Document") {
23
+ if ("data" in input && typeof input.data === "object" && input.data !== null) return [input.id, ...getPrismicDocumentIDs(input.data)];
24
+ else return [input.id];
25
+ }
24
26
  }
25
27
  return Object.values(input).flatMap((input) => getPrismicDocumentIDs(input));
26
28
  }
@@ -1 +1 @@
1
- {"version":3,"file":"getPrismicCacheTags.js","names":[],"sources":["../src/getPrismicCacheTags.ts"],"sourcesContent":["import type { PrismicDocument } from \"@prismicio/client\"\n\nconst CACHE_TAG_PREFIX = \"prismic/\"\n\n/**\n * Generates cache tags for a set of Prismic pages. Tags for linked pages (e.g. a content\n * relationship) are included to ensure all related content can be revalidated.\n *\n * @param pages - A set of Prismic pages used to tag the function.\n * @experimental\n *\n * @see {@link https://nextjs.org/docs/app/api-reference/functions/cacheTag}\n */\nexport function getPrismicCacheTags(pages: PrismicDocument[]): string[] {\n\tconst ids = [...new Set(getPrismicDocumentIDs(pages))]\n\treturn ids.map((id) => buildPrismicCacheTag(id))\n}\n\nexport function buildPrismicCacheTag(id: string): string {\n\treturn `${CACHE_TAG_PREFIX}${id}`\n}\n\nfunction getPrismicDocumentIDs(input: unknown): string[] {\n\tif (typeof input !== \"object\" || input == null) return []\n\n\tif (Array.isArray(input)) return input.flatMap((item) => getPrismicDocumentIDs(item))\n\n\tif (\"id\" in input && typeof input.id === \"string\") {\n\t\t// Document\n\t\t// Content relationship or link\n\t\tif (\n\t\t\t(\"href\" in input &&\n\t\t\t\ttypeof input.href === \"string\" &&\n\t\t\t\tinput.href.includes(\"/api/v2/documents/search?\")) ||\n\t\t\t(\"link_type\" in input && input.link_type === \"Document\")\n\t\t) {\n\t\t\tif (\"data\" in input && typeof input.data === \"object\" && input.data !== null) {\n\t\t\t\treturn [input.id, ...getPrismicDocumentIDs(input.data)]\n\t\t\t} else {\n\t\t\t\treturn [input.id]\n\t\t\t}\n\t\t}\n\t}\n\n\treturn Object.values(input).flatMap((input) => getPrismicDocumentIDs(input))\n}\n"],"mappings":";AAEA,MAAM,mBAAmB;;;;;;;;;;AAWzB,SAAgB,oBAAoB,OAAoC;AAEvE,QADY,CAAC,GAAG,IAAI,IAAI,sBAAsB,MAAM,CAAC,CAAC,CAC3C,KAAK,OAAO,qBAAqB,GAAG,CAAC;;AAGjD,SAAgB,qBAAqB,IAAoB;AACxD,QAAO,GAAG,mBAAmB;;AAG9B,SAAS,sBAAsB,OAA0B;AACxD,KAAI,OAAO,UAAU,YAAY,SAAS,KAAM,QAAO,EAAE;AAEzD,KAAI,MAAM,QAAQ,MAAM,CAAE,QAAO,MAAM,SAAS,SAAS,sBAAsB,KAAK,CAAC;AAErF,KAAI,QAAQ,SAAS,OAAO,MAAM,OAAO;MAItC,UAAU,SACV,OAAO,MAAM,SAAS,YACtB,MAAM,KAAK,SAAS,4BAA4B,IAChD,eAAe,SAAS,MAAM,cAAc,WAE7C,KAAI,UAAU,SAAS,OAAO,MAAM,SAAS,YAAY,MAAM,SAAS,KACvE,QAAO,CAAC,MAAM,IAAI,GAAG,sBAAsB,MAAM,KAAK,CAAC;MAEvD,QAAO,CAAC,MAAM,GAAG;;AAKpB,QAAO,OAAO,OAAO,MAAM,CAAC,SAAS,UAAU,sBAAsB,MAAM,CAAC"}
1
+ {"version":3,"file":"getPrismicCacheTags.js","names":[],"sources":["../src/getPrismicCacheTags.ts"],"sourcesContent":["import type { PrismicDocument } from \"@prismicio/client\"\n\nconst CACHE_TAG_PREFIX = \"prismic/\"\n\n/**\n * Generates cache tags for a set of Prismic pages. Tags for linked pages (e.g. a content\n * relationship) are included to ensure all related content can be revalidated.\n *\n * @param pages - A set of Prismic pages used to tag the function.\n * @experimental\n *\n * @see {@link https://nextjs.org/docs/app/api-reference/functions/cacheTag}\n */\nexport function getPrismicCacheTags(pages: PrismicDocument[]): string[] {\n\tconst ids = [...new Set(getPrismicDocumentIDs(pages))]\n\treturn ids.map((id) => buildPrismicCacheTag(id))\n}\n\nexport function buildPrismicCacheTag(id: string): string {\n\treturn `${CACHE_TAG_PREFIX}${id}`\n}\n\nfunction getPrismicDocumentIDs(input: unknown): string[] {\n\tif (typeof input !== \"object\" || input == null) return []\n\n\tif (Array.isArray(input)) return input.flatMap((item) => getPrismicDocumentIDs(item))\n\n\tif (\"id\" in input && typeof input.id === \"string\") {\n\t\t// Document\n\t\t// Content relationship or link\n\t\tif (\n\t\t\t(\"href\" in input &&\n\t\t\t\ttypeof input.href === \"string\" &&\n\t\t\t\tinput.href.includes(\"/api/v2/documents/search?\")) ||\n\t\t\t(\"link_type\" in input && input.link_type === \"Document\")\n\t\t) {\n\t\t\tif (\"data\" in input && typeof input.data === \"object\" && input.data !== null) {\n\t\t\t\treturn [input.id, ...getPrismicDocumentIDs(input.data)]\n\t\t\t} else {\n\t\t\t\treturn [input.id]\n\t\t\t}\n\t\t}\n\t}\n\n\treturn Object.values(input).flatMap((input) => getPrismicDocumentIDs(input))\n}\n"],"mappings":";AAEA,MAAM,mBAAmB;;;;;;;;;;AAWzB,SAAgB,oBAAoB,OAAoC;CAEvE,OAAO,CADM,GAAG,IAAI,IAAI,sBAAsB,KAAK,CAAC,CAC3C,CAAC,CAAC,KAAK,OAAO,qBAAqB,EAAE,CAAC;AAChD;AAEA,SAAgB,qBAAqB,IAAoB;CACxD,OAAO,GAAG,mBAAmB;AAC9B;AAEA,SAAS,sBAAsB,OAA0B;CACxD,IAAI,OAAO,UAAU,YAAY,SAAS,MAAM,OAAO,CAAC;CAExD,IAAI,MAAM,QAAQ,KAAK,GAAG,OAAO,MAAM,SAAS,SAAS,sBAAsB,IAAI,CAAC;CAEpF,IAAI,QAAQ,SAAS,OAAO,MAAM,OAAO,UAItC;MAAA,UAAU,SACV,OAAO,MAAM,SAAS,YACtB,MAAM,KAAK,SAAS,2BAA2B,KAC/C,eAAe,SAAS,MAAM,cAAc,YAC5C;GACD,IAAI,UAAU,SAAS,OAAO,MAAM,SAAS,YAAY,MAAM,SAAS,MACvE,OAAO,CAAC,MAAM,IAAI,GAAG,sBAAsB,MAAM,IAAI,CAAC;QAEtD,OAAO,CAAC,MAAM,EAAE;EAElB;;CAGD,OAAO,OAAO,OAAO,KAAK,CAAC,CAAC,SAAS,UAAU,sBAAsB,KAAK,CAAC;AAC5E"}
@@ -1,7 +1,7 @@
1
1
  const require_runtime = require("./_virtual/_rolldown/runtime.cjs");
2
2
  let _prismicio_simulator_kit = require("@prismicio/simulator/kit");
3
3
  let lz_string = require("lz-string");
4
- lz_string = require_runtime.__toESM(lz_string);
4
+ lz_string = require_runtime.__toESM(lz_string, 1);
5
5
  //#region src/getSlices.ts
6
6
  const getSlices = (state) => {
7
7
  return state ? JSON.parse(lz_string.default.decompressFromEncodedURIComponent(state)) : (0, _prismicio_simulator_kit.getDefaultSlices)();
@@ -1 +1 @@
1
- {"version":3,"file":"getSlices.cjs","names":["lzString"],"sources":["../src/getSlices.ts"],"sourcesContent":["import { getDefaultSlices } from \"@prismicio/simulator/kit\"\nimport type { StateEvents, StateEventType } from \"@prismicio/simulator/kit\"\nimport lzString from \"lz-string\"\n\nexport const getSlices = (state: string | null | undefined): StateEvents[StateEventType.Slices] => {\n\treturn state ? JSON.parse(lzString.decompressFromEncodedURIComponent(state)) : getDefaultSlices()\n}\n"],"mappings":";;;;;AAIA,MAAa,aAAa,UAAyE;AAClG,QAAO,QAAQ,KAAK,MAAMA,UAAAA,QAAS,kCAAkC,MAAM,CAAC,IAAA,GAAA,yBAAA,mBAAqB"}
1
+ {"version":3,"file":"getSlices.cjs","names":["lzString","getDefaultSlices"],"sources":["../src/getSlices.ts"],"sourcesContent":["import { getDefaultSlices } from \"@prismicio/simulator/kit\"\nimport type { StateEvents, StateEventType } from \"@prismicio/simulator/kit\"\nimport lzString from \"lz-string\"\n\nexport const getSlices = (state: string | null | undefined): StateEvents[StateEventType.Slices] => {\n\treturn state ? JSON.parse(lzString.decompressFromEncodedURIComponent(state)) : getDefaultSlices()\n}\n"],"mappings":";;;;;AAIA,MAAa,aAAa,UAAyE;CAClG,OAAO,QAAQ,KAAK,MAAMA,UAAAA,QAAS,kCAAkC,KAAK,CAAC,KAAA,GAAIC,yBAAAA,iBAAAA,CAAiB;AACjG"}
@@ -1,7 +1,5 @@
1
1
  import { StateEventType, StateEvents } from "@prismicio/simulator/kit";
2
-
3
2
  //#region src/getSlices.d.ts
4
- declare const getSlices: (state: string | null | undefined) => StateEvents[StateEventType.Slices];
3
+ export declare const getSlices: (state: string | null | undefined) => StateEvents[StateEventType.Slices];
5
4
  //#endregion
6
- export { getSlices };
7
5
  //# sourceMappingURL=getSlices.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"getSlices.d.cts","names":[],"sources":["../src/getSlices.ts"],"mappings":";;;cAIa,SAAA,GAAa,KAAA,gCAAmC,WAAA,CAAY,cAAA,CAAe,MAAA"}
1
+ {"version":3,"file":"getSlices.d.cts","names":[],"sources":["../src/getSlices.ts"],"mappings":";;qBAIa,YAAS,qCAAuC,YAAY,eAAe"}
@@ -1,7 +1,5 @@
1
1
  import { StateEventType, StateEvents } from "@prismicio/simulator/kit";
2
-
3
2
  //#region src/getSlices.d.ts
4
- declare const getSlices: (state: string | null | undefined) => StateEvents[StateEventType.Slices];
3
+ export declare const getSlices: (state: string | null | undefined) => StateEvents[StateEventType.Slices];
5
4
  //#endregion
6
- export { getSlices };
7
5
  //# sourceMappingURL=getSlices.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"getSlices.d.ts","names":[],"sources":["../src/getSlices.ts"],"mappings":";;;cAIa,SAAA,GAAa,KAAA,gCAAmC,WAAA,CAAY,cAAA,CAAe,MAAA"}
1
+ {"version":3,"file":"getSlices.d.ts","names":[],"sources":["../src/getSlices.ts"],"mappings":";;qBAIa,YAAS,qCAAuC,YAAY,eAAe"}
@@ -1 +1 @@
1
- {"version":3,"file":"getSlices.js","names":[],"sources":["../src/getSlices.ts"],"sourcesContent":["import { getDefaultSlices } from \"@prismicio/simulator/kit\"\nimport type { StateEvents, StateEventType } from \"@prismicio/simulator/kit\"\nimport lzString from \"lz-string\"\n\nexport const getSlices = (state: string | null | undefined): StateEvents[StateEventType.Slices] => {\n\treturn state ? JSON.parse(lzString.decompressFromEncodedURIComponent(state)) : getDefaultSlices()\n}\n"],"mappings":";;;AAIA,MAAa,aAAa,UAAyE;AAClG,QAAO,QAAQ,KAAK,MAAM,SAAS,kCAAkC,MAAM,CAAC,GAAG,kBAAkB"}
1
+ {"version":3,"file":"getSlices.js","names":[],"sources":["../src/getSlices.ts"],"sourcesContent":["import { getDefaultSlices } from \"@prismicio/simulator/kit\"\nimport type { StateEvents, StateEventType } from \"@prismicio/simulator/kit\"\nimport lzString from \"lz-string\"\n\nexport const getSlices = (state: string | null | undefined): StateEvents[StateEventType.Slices] => {\n\treturn state ? JSON.parse(lzString.decompressFromEncodedURIComponent(state)) : getDefaultSlices()\n}\n"],"mappings":";;;AAIA,MAAa,aAAa,UAAyE;CAClG,OAAO,QAAQ,KAAK,MAAM,SAAS,kCAAkC,KAAK,CAAC,IAAI,iBAAiB;AACjG"}
@@ -1,4 +1,3 @@
1
- require("./_virtual/_rolldown/runtime.cjs");
2
1
  let imgix_url_builder = require("imgix-url-builder");
3
2
  //#region src/imgixLoader.ts
4
3
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"imgixLoader.cjs","names":[],"sources":["../src/imgixLoader.ts"],"sourcesContent":["import type { ImgixURLParams } from \"imgix-url-builder\"\nimport { buildURL } from \"imgix-url-builder\"\nimport type { ImageLoaderProps } from \"next/image\"\n\n/**\n * A `next/image` loader for Imgix, which Prismic uses, with an optional collection of default Imgix\n * parameters.\n *\n * @see To learn about `next/image` loaders: https://nextjs.org/docs/api-reference/next/image#loader\n * @see To learn about Imgix's URL API: https://docs.imgix.com/apis/rendering\n */\nexport const imgixLoader = (args: ImageLoaderProps): string => {\n\tconst url = new URL(args.src)\n\n\tconst params: ImgixURLParams = {\n\t\tfit: (url.searchParams.get(\"fit\") as ImgixURLParams[\"fit\"]) || \"max\",\n\t\tw: args.width,\n\t\th: undefined,\n\t}\n\n\tif (args.quality) {\n\t\tparams.q = args.quality\n\t}\n\n\treturn buildURL(args.src, params)\n}\n"],"mappings":";;;;;;;;;;AAWA,MAAa,eAAe,SAAmC;CAG9D,MAAM,SAAyB;EAC9B,KAHW,IAAI,IAAI,KAAK,IAAI,CAGlB,aAAa,IAAI,MAAM,IAA8B;EAC/D,GAAG,KAAK;EACR,GAAG,KAAA;EACH;AAED,KAAI,KAAK,QACR,QAAO,IAAI,KAAK;AAGjB,SAAA,GAAA,kBAAA,UAAgB,KAAK,KAAK,OAAO"}
1
+ {"version":3,"file":"imgixLoader.cjs","names":["buildURL"],"sources":["../src/imgixLoader.ts"],"sourcesContent":["import type { ImgixURLParams } from \"imgix-url-builder\"\nimport { buildURL } from \"imgix-url-builder\"\nimport type { ImageLoaderProps } from \"next/image\"\n\n/**\n * A `next/image` loader for Imgix, which Prismic uses, with an optional collection of default Imgix\n * parameters.\n *\n * @see To learn about `next/image` loaders: https://nextjs.org/docs/api-reference/next/image#loader\n * @see To learn about Imgix's URL API: https://docs.imgix.com/apis/rendering\n */\nexport const imgixLoader = (args: ImageLoaderProps): string => {\n\tconst url = new URL(args.src)\n\n\tconst params: ImgixURLParams = {\n\t\tfit: (url.searchParams.get(\"fit\") as ImgixURLParams[\"fit\"]) || \"max\",\n\t\tw: args.width,\n\t\th: undefined,\n\t}\n\n\tif (args.quality) {\n\t\tparams.q = args.quality\n\t}\n\n\treturn buildURL(args.src, params)\n}\n"],"mappings":";;;;;;;;;AAWA,MAAa,eAAe,SAAmC;CAG9D,MAAM,SAAyB;EAC9B,KAAM,IAHS,IAAI,KAAK,GAGhB,CAAC,CAAC,aAAa,IAAI,KAAK,KAA+B;EAC/D,GAAG,KAAK;EACR,GAAG,KAAA;CACJ;CAEA,IAAI,KAAK,SACR,OAAO,IAAI,KAAK;CAGjB,QAAA,GAAOA,kBAAAA,SAAAA,CAAS,KAAK,KAAK,MAAM;AACjC"}
@@ -1,5 +1,4 @@
1
1
  import { ImageLoaderProps } from "next/image.js";
2
-
3
2
  //#region src/imgixLoader.d.ts
4
3
  /**
5
4
  * A `next/image` loader for Imgix, which Prismic uses, with an optional collection of default Imgix
@@ -8,7 +7,6 @@ import { ImageLoaderProps } from "next/image.js";
8
7
  * @see To learn about `next/image` loaders: https://nextjs.org/docs/api-reference/next/image#loader
9
8
  * @see To learn about Imgix's URL API: https://docs.imgix.com/apis/rendering
10
9
  */
11
- declare const imgixLoader: (args: ImageLoaderProps) => string;
10
+ export declare const imgixLoader: (args: ImageLoaderProps) => string;
12
11
  //#endregion
13
- export { imgixLoader };
14
12
  //# sourceMappingURL=imgixLoader.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"imgixLoader.d.cts","names":[],"sources":["../src/imgixLoader.ts"],"mappings":";;;;;AAWA;;;;;cAAa,WAAA,GAAe,IAAA,EAAM,gBAAA"}
1
+ {"version":3,"file":"imgixLoader.d.cts","names":[],"sources":["../src/imgixLoader.ts"],"mappings":";;;;;;;;;qBAWa,cAAW,MAAU"}
@@ -1,5 +1,4 @@
1
1
  import { ImageLoaderProps } from "next/image.js";
2
-
3
2
  //#region src/imgixLoader.d.ts
4
3
  /**
5
4
  * A `next/image` loader for Imgix, which Prismic uses, with an optional collection of default Imgix
@@ -8,7 +7,6 @@ import { ImageLoaderProps } from "next/image.js";
8
7
  * @see To learn about `next/image` loaders: https://nextjs.org/docs/api-reference/next/image#loader
9
8
  * @see To learn about Imgix's URL API: https://docs.imgix.com/apis/rendering
10
9
  */
11
- declare const imgixLoader: (args: ImageLoaderProps) => string;
10
+ export declare const imgixLoader: (args: ImageLoaderProps) => string;
12
11
  //#endregion
13
- export { imgixLoader };
14
12
  //# sourceMappingURL=imgixLoader.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"imgixLoader.d.ts","names":[],"sources":["../src/imgixLoader.ts"],"mappings":";;;;;AAWA;;;;;cAAa,WAAA,GAAe,IAAA,EAAM,gBAAA"}
1
+ {"version":3,"file":"imgixLoader.d.ts","names":[],"sources":["../src/imgixLoader.ts"],"mappings":";;;;;;;;;qBAWa,cAAW,MAAU"}
@@ -1 +1 @@
1
- {"version":3,"file":"imgixLoader.js","names":[],"sources":["../src/imgixLoader.ts"],"sourcesContent":["import type { ImgixURLParams } from \"imgix-url-builder\"\nimport { buildURL } from \"imgix-url-builder\"\nimport type { ImageLoaderProps } from \"next/image\"\n\n/**\n * A `next/image` loader for Imgix, which Prismic uses, with an optional collection of default Imgix\n * parameters.\n *\n * @see To learn about `next/image` loaders: https://nextjs.org/docs/api-reference/next/image#loader\n * @see To learn about Imgix's URL API: https://docs.imgix.com/apis/rendering\n */\nexport const imgixLoader = (args: ImageLoaderProps): string => {\n\tconst url = new URL(args.src)\n\n\tconst params: ImgixURLParams = {\n\t\tfit: (url.searchParams.get(\"fit\") as ImgixURLParams[\"fit\"]) || \"max\",\n\t\tw: args.width,\n\t\th: undefined,\n\t}\n\n\tif (args.quality) {\n\t\tparams.q = args.quality\n\t}\n\n\treturn buildURL(args.src, params)\n}\n"],"mappings":";;;;;;;;;AAWA,MAAa,eAAe,SAAmC;CAG9D,MAAM,SAAyB;EAC9B,KAHW,IAAI,IAAI,KAAK,IAAI,CAGlB,aAAa,IAAI,MAAM,IAA8B;EAC/D,GAAG,KAAK;EACR,GAAG,KAAA;EACH;AAED,KAAI,KAAK,QACR,QAAO,IAAI,KAAK;AAGjB,QAAO,SAAS,KAAK,KAAK,OAAO"}
1
+ {"version":3,"file":"imgixLoader.js","names":[],"sources":["../src/imgixLoader.ts"],"sourcesContent":["import type { ImgixURLParams } from \"imgix-url-builder\"\nimport { buildURL } from \"imgix-url-builder\"\nimport type { ImageLoaderProps } from \"next/image\"\n\n/**\n * A `next/image` loader for Imgix, which Prismic uses, with an optional collection of default Imgix\n * parameters.\n *\n * @see To learn about `next/image` loaders: https://nextjs.org/docs/api-reference/next/image#loader\n * @see To learn about Imgix's URL API: https://docs.imgix.com/apis/rendering\n */\nexport const imgixLoader = (args: ImageLoaderProps): string => {\n\tconst url = new URL(args.src)\n\n\tconst params: ImgixURLParams = {\n\t\tfit: (url.searchParams.get(\"fit\") as ImgixURLParams[\"fit\"]) || \"max\",\n\t\tw: args.width,\n\t\th: undefined,\n\t}\n\n\tif (args.quality) {\n\t\tparams.q = args.quality\n\t}\n\n\treturn buildURL(args.src, params)\n}\n"],"mappings":";;;;;;;;;AAWA,MAAa,eAAe,SAAmC;CAG9D,MAAM,SAAyB;EAC9B,KAAM,IAHS,IAAI,KAAK,GAGhB,CAAC,CAAC,aAAa,IAAI,KAAK,KAA+B;EAC/D,GAAG,KAAK;EACR,GAAG,KAAA;CACJ;CAEA,IAAI,KAAK,SACR,OAAO,IAAI,KAAK;CAGjB,OAAO,SAAS,KAAK,KAAK,MAAM;AACjC"}
@@ -1 +1 @@
1
- {"version":3,"file":"devMsg.cjs","names":["version"],"sources":["../../src/lib/devMsg.ts"],"sourcesContent":["import { version } from \"../../package.json\"\n\n/**\n * Returns a `prismic.dev/msg` URL for a given message slug.\n *\n * @example\n * \t;```ts\n * \tdevMsg(\"missing-param\")\n * \t// => \"https://prismic.dev/msg/next/v1.2.3/missing-param\"\n * \t```\n *\n * @param slug - Slug for the message. This corresponds to a Markdown file in the Git repository's\n * `/messages` directory.\n * @returns The `prismic.dev/msg` URL for the given slug.\n */\nexport const devMsg = (slug: string): string => {\n\treturn `https://prismic.dev/msg/next/v${version}/${slug}`\n}\n"],"mappings":";;;;;;;;;;;;;;;AAeA,MAAa,UAAU,SAAyB;AAC/C,QAAO,iCAAiCA,gBAAAA,QAAQ,GAAG"}
1
+ {"version":3,"file":"devMsg.cjs","names":["version"],"sources":["../../src/lib/devMsg.ts"],"sourcesContent":["import { version } from \"../../package.json\"\n\n/**\n * Returns a `prismic.dev/msg` URL for a given message slug.\n *\n * @example\n * \t;```ts\n * \tdevMsg(\"missing-param\")\n * \t// => \"https://prismic.dev/msg/next/v1.2.3/missing-param\"\n * \t```\n *\n * @param slug - Slug for the message. This corresponds to a Markdown file in the Git repository's\n * `/messages` directory.\n * @returns The `prismic.dev/msg` URL for the given slug.\n */\nexport const devMsg = (slug: string): string => {\n\treturn `https://prismic.dev/msg/next/v${version}/${slug}`\n}\n"],"mappings":";;;;;;;;;;;;;;;AAeA,MAAa,UAAU,SAAyB;CAC/C,OAAO,iCAAiCA,gBAAAA,QAAQ,GAAG;AACpD"}
@@ -1 +1 @@
1
- {"version":3,"file":"devMsg.js","names":[],"sources":["../../src/lib/devMsg.ts"],"sourcesContent":["import { version } from \"../../package.json\"\n\n/**\n * Returns a `prismic.dev/msg` URL for a given message slug.\n *\n * @example\n * \t;```ts\n * \tdevMsg(\"missing-param\")\n * \t// => \"https://prismic.dev/msg/next/v1.2.3/missing-param\"\n * \t```\n *\n * @param slug - Slug for the message. This corresponds to a Markdown file in the Git repository's\n * `/messages` directory.\n * @returns The `prismic.dev/msg` URL for the given slug.\n */\nexport const devMsg = (slug: string): string => {\n\treturn `https://prismic.dev/msg/next/v${version}/${slug}`\n}\n"],"mappings":";;;;;;;;;;;;;;;AAeA,MAAa,UAAU,SAAyB;AAC/C,QAAO,iCAAiC,QAAQ,GAAG"}
1
+ {"version":3,"file":"devMsg.js","names":[],"sources":["../../src/lib/devMsg.ts"],"sourcesContent":["import { version } from \"../../package.json\"\n\n/**\n * Returns a `prismic.dev/msg` URL for a given message slug.\n *\n * @example\n * \t;```ts\n * \tdevMsg(\"missing-param\")\n * \t// => \"https://prismic.dev/msg/next/v1.2.3/missing-param\"\n * \t```\n *\n * @param slug - Slug for the message. This corresponds to a Markdown file in the Git repository's\n * `/messages` directory.\n * @returns The `prismic.dev/msg` URL for the given slug.\n */\nexport const devMsg = (slug: string): string => {\n\treturn `https://prismic.dev/msg/next/v${version}/${slug}`\n}\n"],"mappings":";;;;;;;;;;;;;;;AAeA,MAAa,UAAU,SAAyB;CAC/C,OAAO,iCAAiC,QAAQ,GAAG;AACpD"}
@@ -1 +1 @@
1
- {"version":3,"file":"resolveDefaultExport.cjs","names":[],"sources":["../../src/lib/resolveDefaultExport.ts"],"sourcesContent":["/**\n * Resolves a module's default export. The module may provide its default export as a `default`\n * property on an object. This happens when named and default exports are mixed in modules.\n *\n * In ES Modules, mixing is fine since the module resolver can distinguish default and named\n * exports. In transpiled modules, however, all exports are put into a single object, and the\n * default export is provided at a property called `default`.\n *\n * This helper is needed by Next.js uses CJS files with named and default exports.\n *\n * This helper _should_ be a temporary hack until Next.js and Node.js resolve their ESM\n * difficulties. This will likely not be removed any time soon, unfortunately.\n */\nexport function resolveDefaultExport<T>(mod: T): T {\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\treturn \"default\" in (mod as any) ? (mod as any).default : mod\n}\n"],"mappings":";;;;;;;;;;;;;;AAaA,SAAgB,qBAAwB,KAAW;AAElD,QAAO,aAAc,MAAe,IAAY,UAAU"}
1
+ {"version":3,"file":"resolveDefaultExport.cjs","names":[],"sources":["../../src/lib/resolveDefaultExport.ts"],"sourcesContent":["/**\n * Resolves a module's default export. The module may provide its default export as a `default`\n * property on an object. This happens when named and default exports are mixed in modules.\n *\n * In ES Modules, mixing is fine since the module resolver can distinguish default and named\n * exports. In transpiled modules, however, all exports are put into a single object, and the\n * default export is provided at a property called `default`.\n *\n * This helper is needed by Next.js uses CJS files with named and default exports.\n *\n * This helper _should_ be a temporary hack until Next.js and Node.js resolve their ESM\n * difficulties. This will likely not be removed any time soon, unfortunately.\n */\nexport function resolveDefaultExport<T>(mod: T): T {\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\treturn \"default\" in (mod as any) ? (mod as any).default : mod\n}\n"],"mappings":";;;;;;;;;;;;;;AAaA,SAAgB,qBAAwB,KAAW;CAElD,OAAO,aAAc,MAAe,IAAY,UAAU;AAC3D"}
@@ -1 +1 @@
1
- {"version":3,"file":"resolveDefaultExport.js","names":[],"sources":["../../src/lib/resolveDefaultExport.ts"],"sourcesContent":["/**\n * Resolves a module's default export. The module may provide its default export as a `default`\n * property on an object. This happens when named and default exports are mixed in modules.\n *\n * In ES Modules, mixing is fine since the module resolver can distinguish default and named\n * exports. In transpiled modules, however, all exports are put into a single object, and the\n * default export is provided at a property called `default`.\n *\n * This helper is needed by Next.js uses CJS files with named and default exports.\n *\n * This helper _should_ be a temporary hack until Next.js and Node.js resolve their ESM\n * difficulties. This will likely not be removed any time soon, unfortunately.\n */\nexport function resolveDefaultExport<T>(mod: T): T {\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\treturn \"default\" in (mod as any) ? (mod as any).default : mod\n}\n"],"mappings":";;;;;;;;;;;;;;AAaA,SAAgB,qBAAwB,KAAW;AAElD,QAAO,aAAc,MAAe,IAAY,UAAU"}
1
+ {"version":3,"file":"resolveDefaultExport.js","names":[],"sources":["../../src/lib/resolveDefaultExport.ts"],"sourcesContent":["/**\n * Resolves a module's default export. The module may provide its default export as a `default`\n * property on an object. This happens when named and default exports are mixed in modules.\n *\n * In ES Modules, mixing is fine since the module resolver can distinguish default and named\n * exports. In transpiled modules, however, all exports are put into a single object, and the\n * default export is provided at a property called `default`.\n *\n * This helper is needed by Next.js uses CJS files with named and default exports.\n *\n * This helper _should_ be a temporary hack until Next.js and Node.js resolve their ESM\n * difficulties. This will likely not be removed any time soon, unfortunately.\n */\nexport function resolveDefaultExport<T>(mod: T): T {\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\treturn \"default\" in (mod as any) ? (mod as any).default : mod\n}\n"],"mappings":";;;;;;;;;;;;;;AAaA,SAAgB,qBAAwB,KAAW;CAElD,OAAO,aAAc,MAAe,IAAY,UAAU;AAC3D"}
package/dist/package.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  //#region package.json
2
- var version = "2.3.2";
2
+ var version = "2.3.3-canary.bab3397";
3
3
  //#endregion
4
4
  Object.defineProperty(exports, "version", {
5
5
  enumerable: true,
package/dist/package.js CHANGED
@@ -1,5 +1,5 @@
1
1
  //#region package.json
2
- var version = "2.3.2";
2
+ var version = "2.3.3-canary.bab3397";
3
3
  //#endregion
4
4
  export { version };
5
5
 
@@ -1,7 +1,7 @@
1
1
  const require_runtime = require("../_virtual/_rolldown/runtime.cjs");
2
2
  let _prismicio_client = require("@prismicio/client");
3
3
  let next_script_js = require("next/script.js");
4
- next_script_js = require_runtime.__toESM(next_script_js);
4
+ next_script_js = require_runtime.__toESM(next_script_js, 1);
5
5
  let react = require("react");
6
6
  let react_jsx_runtime = require("react/jsx-runtime");
7
7
  let next_router_js = require("next/router.js");
@@ -1 +1 @@
1
- {"version":3,"file":"PrismicPreview.cjs","names":["Script","prismicCookie"],"sources":["../../src/pages/PrismicPreview.tsx"],"sourcesContent":["import { getToolbarSrc, cookie as prismicCookie } from \"@prismicio/client\"\nimport { useRouter } from \"next/router\"\nimport Script from \"next/script\"\nimport type { FC } from \"react\"\nimport { type ReactNode, useEffect } from \"react\"\n\n/** Props for `<PrismicPreview>`. */\nexport type PrismicPreviewProps = {\n\t/**\n\t * The name of your Prismic repository. A Prismic Toolbar will be registered using this\n\t * repository.\n\t */\n\trepositoryName: string\n\n\t/**\n\t * The URL of your app's Prismic preview endpoint (default: `/api/preview`). This URL will be\n\t * fetched on preview update events.\n\t */\n\tupdatePreviewURL?: string\n\n\t/**\n\t * The URL of your app's exit preview endpoint (default: `/api/exit-preview`). This URL will be\n\t * fetched on preview exit events.\n\t */\n\texitPreviewURL?: string\n\n\t/** Children to render adjacent to the Prismic Toolbar. */\n\tchildren?: ReactNode\n}\n\n/**\n * React component that sets up Prismic Previews using the Prismic Toolbar. When the Prismic Toolbar\n * send events to the browser, such as on preview updates and exiting, this component will\n * automatically refresh the page with the changes.\n *\n * This component can be wrapped around your app or added anywhere in your app's tree. It must be\n * rendered on every page.\n */\nexport const PrismicPreview: FC<PrismicPreviewProps> = (props) => {\n\tconst {\n\t\trepositoryName,\n\t\tupdatePreviewURL = \"/api/preview\",\n\t\texitPreviewURL = \"/api/exit-preview\",\n\t\tchildren,\n\t} = props\n\n\tconst router = useRouter()\n\n\tconst toolbarSrc = getToolbarSrc(repositoryName)\n\n\tuseEffect(() => {\n\t\tconst controller = new AbortController()\n\n\t\twindow.addEventListener(\"prismicPreviewUpdate\", onUpdate, {\n\t\t\tsignal: controller.signal,\n\t\t})\n\t\twindow.addEventListener(\"prismicPreviewEnd\", onEnd, {\n\t\t\tsignal: controller.signal,\n\t\t})\n\n\t\t// Start the preview for preview share links. Previews from\n\t\t// share links do not go to the `updatePreviewURL` like a normal\n\t\t// preview.\n\t\t//\n\t\t// We check that the current URL is a descendant of the base\n\t\t// path to prevent infinite refrehes.\n\t\tif (\n\t\t\twindow.location.href.startsWith(window.location.origin + router.basePath) &&\n\t\t\tgetPreviewCookieRepositoryName() === repositoryName &&\n\t\t\t!router.isPreview\n\t\t) {\n\t\t\tstart()\n\t\t}\n\n\t\tfunction onEnd(event: Event) {\n\t\t\tevent.preventDefault()\n\t\t\tfetch(router.basePath + exitPreviewURL, { signal: controller.signal })\n\t\t\t\t.then((res) => {\n\t\t\t\t\tif (!res.ok) {\n\t\t\t\t\t\tconsole.error(\n\t\t\t\t\t\t\t`[<PrismicPreview>] Failed to exit Preview Mode using the \"${exitPreviewURL}\" API endpoint. Does it exist?`,\n\t\t\t\t\t\t)\n\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\n\t\t\t\t\trefresh()\n\t\t\t\t})\n\t\t\t\t.catch(() => {})\n\t\t}\n\n\t\tfunction onUpdate(event: Event) {\n\t\t\tevent.preventDefault()\n\t\t\tstart()\n\t\t}\n\n\t\tfunction start() {\n\t\t\t// We check `opaqueredirect` because we don't care if\n\t\t\t// the redirect was successful or not. As long as it\n\t\t\t// redirects, we know the endpoint exists and at least\n\t\t\t// attempted to set preview data.\n\t\t\tfetch(router.basePath + updatePreviewURL, {\n\t\t\t\tredirect: \"manual\",\n\t\t\t\tsignal: controller.signal,\n\t\t\t})\n\t\t\t\t.then((res) => {\n\t\t\t\t\tif (res.type !== \"opaqueredirect\") {\n\t\t\t\t\t\tconsole.error(\n\t\t\t\t\t\t\t`[<PrismicPreview>] Failed to start or update the preview using \"${updatePreviewURL}\". Does it exist?`,\n\t\t\t\t\t\t)\n\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\n\t\t\t\t\trefresh()\n\t\t\t\t})\n\t\t\t\t.catch(() => {})\n\t\t}\n\n\t\tfunction refresh() {\n\t\t\trouter.replace(router.asPath, undefined, { scroll: false })\n\t\t}\n\n\t\treturn () => controller.abort()\n\t}, [exitPreviewURL, updatePreviewURL, repositoryName, router])\n\n\treturn (\n\t\t<>\n\t\t\t{children}\n\t\t\t<Script src={toolbarSrc} strategy=\"lazyOnload\" />\n\t\t</>\n\t)\n}\n\nfunction getPreviewCookieRepositoryName() {\n\tconst cookie = window.document.cookie\n\t\t.split(\"; \")\n\t\t.find((row) => row.startsWith(`${prismicCookie.preview}=`))\n\t\t?.split(\"=\")[1]\n\n\treturn (decodeURIComponent(cookie ?? \"\").match(/\"([^\"]+)\\.prismic\\.io\"/) || [])[1]\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAsCA,MAAa,kBAA2C,UAAU;CACjE,MAAM,EACL,gBACA,mBAAmB,gBACnB,iBAAiB,qBACjB,aACG;CAEJ,MAAM,UAAA,GAAA,eAAA,YAAoB;CAE1B,MAAM,cAAA,GAAA,kBAAA,eAA2B,eAAe;AAEhD,EAAA,GAAA,MAAA,iBAAgB;EACf,MAAM,aAAa,IAAI,iBAAiB;AAExC,SAAO,iBAAiB,wBAAwB,UAAU,EACzD,QAAQ,WAAW,QACnB,CAAC;AACF,SAAO,iBAAiB,qBAAqB,OAAO,EACnD,QAAQ,WAAW,QACnB,CAAC;AAQF,MACC,OAAO,SAAS,KAAK,WAAW,OAAO,SAAS,SAAS,OAAO,SAAS,IACzE,gCAAgC,KAAK,kBACrC,CAAC,OAAO,UAER,QAAO;EAGR,SAAS,MAAM,OAAc;AAC5B,SAAM,gBAAgB;AACtB,SAAM,OAAO,WAAW,gBAAgB,EAAE,QAAQ,WAAW,QAAQ,CAAC,CACpE,MAAM,QAAQ;AACd,QAAI,CAAC,IAAI,IAAI;AACZ,aAAQ,MACP,6DAA6D,eAAe,gCAC5E;AAED;;AAGD,aAAS;KACR,CACD,YAAY,GAAG;;EAGlB,SAAS,SAAS,OAAc;AAC/B,SAAM,gBAAgB;AACtB,UAAO;;EAGR,SAAS,QAAQ;AAKhB,SAAM,OAAO,WAAW,kBAAkB;IACzC,UAAU;IACV,QAAQ,WAAW;IACnB,CAAC,CACA,MAAM,QAAQ;AACd,QAAI,IAAI,SAAS,kBAAkB;AAClC,aAAQ,MACP,mEAAmE,iBAAiB,mBACpF;AAED;;AAGD,aAAS;KACR,CACD,YAAY,GAAG;;EAGlB,SAAS,UAAU;AAClB,UAAO,QAAQ,OAAO,QAAQ,KAAA,GAAW,EAAE,QAAQ,OAAO,CAAC;;AAG5D,eAAa,WAAW,OAAO;IAC7B;EAAC;EAAgB;EAAkB;EAAgB;EAAO,CAAC;AAE9D,QACC,iBAAA,GAAA,kBAAA,MAAA,kBAAA,UAAA,EAAA,UAAA,CACE,UACD,iBAAA,GAAA,kBAAA,KAACA,eAAAA,SAAD;EAAQ,KAAK;EAAY,UAAS;EAAe,CAAA,CAC/C,EAAA,CAAA;;AAIL,SAAS,iCAAiC;CACzC,MAAM,SAAS,OAAO,SAAS,OAC7B,MAAM,KAAK,CACX,MAAM,QAAQ,IAAI,WAAW,GAAGC,kBAAAA,OAAc,QAAQ,GAAG,CAAC,EACzD,MAAM,IAAI,CAAC;AAEd,SAAQ,mBAAmB,UAAU,GAAG,CAAC,MAAM,yBAAyB,IAAI,EAAE,EAAE"}
1
+ {"version":3,"file":"PrismicPreview.cjs","names":["useRouter","getToolbarSrc","Script","prismicCookie"],"sources":["../../src/pages/PrismicPreview.tsx"],"sourcesContent":["import { getToolbarSrc, cookie as prismicCookie } from \"@prismicio/client\"\nimport { useRouter } from \"next/router\"\nimport Script from \"next/script\"\nimport type { FC } from \"react\"\nimport { type ReactNode, useEffect } from \"react\"\n\n/** Props for `<PrismicPreview>`. */\nexport type PrismicPreviewProps = {\n\t/**\n\t * The name of your Prismic repository. A Prismic Toolbar will be registered using this\n\t * repository.\n\t */\n\trepositoryName: string\n\n\t/**\n\t * The URL of your app's Prismic preview endpoint (default: `/api/preview`). This URL will be\n\t * fetched on preview update events.\n\t */\n\tupdatePreviewURL?: string\n\n\t/**\n\t * The URL of your app's exit preview endpoint (default: `/api/exit-preview`). This URL will be\n\t * fetched on preview exit events.\n\t */\n\texitPreviewURL?: string\n\n\t/** Children to render adjacent to the Prismic Toolbar. */\n\tchildren?: ReactNode\n}\n\n/**\n * React component that sets up Prismic Previews using the Prismic Toolbar. When the Prismic Toolbar\n * send events to the browser, such as on preview updates and exiting, this component will\n * automatically refresh the page with the changes.\n *\n * This component can be wrapped around your app or added anywhere in your app's tree. It must be\n * rendered on every page.\n */\nexport const PrismicPreview: FC<PrismicPreviewProps> = (props) => {\n\tconst {\n\t\trepositoryName,\n\t\tupdatePreviewURL = \"/api/preview\",\n\t\texitPreviewURL = \"/api/exit-preview\",\n\t\tchildren,\n\t} = props\n\n\tconst router = useRouter()\n\n\tconst toolbarSrc = getToolbarSrc(repositoryName)\n\n\tuseEffect(() => {\n\t\tconst controller = new AbortController()\n\n\t\twindow.addEventListener(\"prismicPreviewUpdate\", onUpdate, {\n\t\t\tsignal: controller.signal,\n\t\t})\n\t\twindow.addEventListener(\"prismicPreviewEnd\", onEnd, {\n\t\t\tsignal: controller.signal,\n\t\t})\n\n\t\t// Start the preview for preview share links. Previews from\n\t\t// share links do not go to the `updatePreviewURL` like a normal\n\t\t// preview.\n\t\t//\n\t\t// We check that the current URL is a descendant of the base\n\t\t// path to prevent infinite refrehes.\n\t\tif (\n\t\t\twindow.location.href.startsWith(window.location.origin + router.basePath) &&\n\t\t\tgetPreviewCookieRepositoryName() === repositoryName &&\n\t\t\t!router.isPreview\n\t\t) {\n\t\t\tstart()\n\t\t}\n\n\t\tfunction onEnd(event: Event) {\n\t\t\tevent.preventDefault()\n\t\t\tfetch(router.basePath + exitPreviewURL, { signal: controller.signal })\n\t\t\t\t.then((res) => {\n\t\t\t\t\tif (!res.ok) {\n\t\t\t\t\t\tconsole.error(\n\t\t\t\t\t\t\t`[<PrismicPreview>] Failed to exit Preview Mode using the \"${exitPreviewURL}\" API endpoint. Does it exist?`,\n\t\t\t\t\t\t)\n\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\n\t\t\t\t\trefresh()\n\t\t\t\t})\n\t\t\t\t.catch(() => {})\n\t\t}\n\n\t\tfunction onUpdate(event: Event) {\n\t\t\tevent.preventDefault()\n\t\t\tstart()\n\t\t}\n\n\t\tfunction start() {\n\t\t\t// We check `opaqueredirect` because we don't care if\n\t\t\t// the redirect was successful or not. As long as it\n\t\t\t// redirects, we know the endpoint exists and at least\n\t\t\t// attempted to set preview data.\n\t\t\tfetch(router.basePath + updatePreviewURL, {\n\t\t\t\tredirect: \"manual\",\n\t\t\t\tsignal: controller.signal,\n\t\t\t})\n\t\t\t\t.then((res) => {\n\t\t\t\t\tif (res.type !== \"opaqueredirect\") {\n\t\t\t\t\t\tconsole.error(\n\t\t\t\t\t\t\t`[<PrismicPreview>] Failed to start or update the preview using \"${updatePreviewURL}\". Does it exist?`,\n\t\t\t\t\t\t)\n\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\n\t\t\t\t\trefresh()\n\t\t\t\t})\n\t\t\t\t.catch(() => {})\n\t\t}\n\n\t\tfunction refresh() {\n\t\t\trouter.replace(router.asPath, undefined, { scroll: false })\n\t\t}\n\n\t\treturn () => controller.abort()\n\t}, [exitPreviewURL, updatePreviewURL, repositoryName, router])\n\n\treturn (\n\t\t<>\n\t\t\t{children}\n\t\t\t<Script src={toolbarSrc} strategy=\"lazyOnload\" />\n\t\t</>\n\t)\n}\n\nfunction getPreviewCookieRepositoryName() {\n\tconst cookie = window.document.cookie\n\t\t.split(\"; \")\n\t\t.find((row) => row.startsWith(`${prismicCookie.preview}=`))\n\t\t?.split(\"=\")[1]\n\n\treturn (decodeURIComponent(cookie ?? \"\").match(/\"([^\"]+)\\.prismic\\.io\"/) || [])[1]\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAsCA,MAAa,kBAA2C,UAAU;CACjE,MAAM,EACL,gBACA,mBAAmB,gBACnB,iBAAiB,qBACjB,aACG;CAEJ,MAAM,UAAA,GAASA,eAAAA,UAAAA,CAAU;CAEzB,MAAM,cAAA,GAAaC,kBAAAA,cAAAA,CAAc,cAAc;CAE/C,CAAA,GAAA,MAAA,UAAA,OAAgB;EACf,MAAM,aAAa,IAAI,gBAAgB;EAEvC,OAAO,iBAAiB,wBAAwB,UAAU,EACzD,QAAQ,WAAW,OACpB,CAAC;EACD,OAAO,iBAAiB,qBAAqB,OAAO,EACnD,QAAQ,WAAW,OACpB,CAAC;EAQD,IACC,OAAO,SAAS,KAAK,WAAW,OAAO,SAAS,SAAS,OAAO,QAAQ,KACxE,+BAA+B,MAAM,kBACrC,CAAC,OAAO,WAER,MAAM;EAGP,SAAS,MAAM,OAAc;GAC5B,MAAM,eAAe;GACrB,MAAM,OAAO,WAAW,gBAAgB,EAAE,QAAQ,WAAW,OAAO,CAAC,CAAC,CACpE,MAAM,QAAQ;IACd,IAAI,CAAC,IAAI,IAAI;KACZ,QAAQ,MACP,6DAA6D,eAAe,+BAC7E;KAEA;IACD;IAEA,QAAQ;GACT,CAAC,CAAC,CACD,YAAY,CAAC,CAAC;EACjB;EAEA,SAAS,SAAS,OAAc;GAC/B,MAAM,eAAe;GACrB,MAAM;EACP;EAEA,SAAS,QAAQ;GAKhB,MAAM,OAAO,WAAW,kBAAkB;IACzC,UAAU;IACV,QAAQ,WAAW;GACpB,CAAC,CAAC,CACA,MAAM,QAAQ;IACd,IAAI,IAAI,SAAS,kBAAkB;KAClC,QAAQ,MACP,mEAAmE,iBAAiB,kBACrF;KAEA;IACD;IAEA,QAAQ;GACT,CAAC,CAAC,CACD,YAAY,CAAC,CAAC;EACjB;EAEA,SAAS,UAAU;GAClB,OAAO,QAAQ,OAAO,QAAQ,KAAA,GAAW,EAAE,QAAQ,MAAM,CAAC;EAC3D;EAEA,aAAa,WAAW,MAAM;CAC/B,GAAG;EAAC;EAAgB;EAAkB;EAAgB;CAAM,CAAC;CAE7D,OACC,iBAAA,GAAA,kBAAA,KAAA,CAAA,kBAAA,UAAA,EAAA,UAAA,CACE,UACD,iBAAA,GAAA,kBAAA,IAAA,CAACC,eAAAA,SAAD;EAAQ,KAAK;EAAY,UAAS;CAAc,CAAA,CAC/C,EAAA,CAAA;AAEJ;AAEA,SAAS,iCAAiC;CACzC,MAAM,SAAS,OAAO,SAAS,OAC7B,MAAM,IAAI,CAAC,CACX,MAAM,QAAQ,IAAI,WAAW,GAAGC,kBAAAA,OAAc,QAAQ,EAAE,CAAC,CAAC,EACzD,MAAM,GAAG,CAAC,CAAC;CAEd,QAAQ,mBAAmB,UAAU,EAAE,CAAC,CAAC,MAAM,wBAAwB,KAAK,CAAC,EAAA,CAAG;AACjF"}
@@ -1,8 +1,7 @@
1
1
  import { FC, ReactNode } from "react";
2
-
3
2
  //#region src/pages/PrismicPreview.d.ts
4
3
  /** Props for `<PrismicPreview>`. */
5
- type PrismicPreviewProps = {
4
+ export type PrismicPreviewProps = {
6
5
  /**
7
6
  * The name of your Prismic repository. A Prismic Toolbar will be registered using this
8
7
  * repository.
@@ -17,7 +16,8 @@ type PrismicPreviewProps = {
17
16
  * The URL of your app's exit preview endpoint (default: `/api/exit-preview`). This URL will be
18
17
  * fetched on preview exit events.
19
18
  */
20
- exitPreviewURL?: string; /** Children to render adjacent to the Prismic Toolbar. */
19
+ exitPreviewURL?: string;
20
+ /** Children to render adjacent to the Prismic Toolbar. */
21
21
  children?: ReactNode;
22
22
  };
23
23
  /**
@@ -28,7 +28,6 @@ type PrismicPreviewProps = {
28
28
  * This component can be wrapped around your app or added anywhere in your app's tree. It must be
29
29
  * rendered on every page.
30
30
  */
31
- declare const PrismicPreview: FC<PrismicPreviewProps>;
31
+ export declare const PrismicPreview: FC<PrismicPreviewProps>;
32
32
  //#endregion
33
- export { PrismicPreview, PrismicPreviewProps };
34
33
  //# sourceMappingURL=PrismicPreview.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"PrismicPreview.d.cts","names":[],"sources":["../../src/pages/PrismicPreview.tsx"],"mappings":";;;;KAOY,mBAAA;EAAmB;;;;EAK9B,cAAA;EAYA;;;;EANA,gBAAA;EAoBY;;;;EAdZ,cAAA;EAGA,QAAA,GAAW,SAAA;AAAA;;;;;;;;;cAWC,cAAA,EAAgB,EAAA,CAAG,mBAAA"}
1
+ {"version":3,"file":"PrismicPreview.d.cts","names":[],"sources":["../../src/pages/PrismicPreview.tsx"],"mappings":";;;YAOY;;;;;EAKX;;;;;EAMA;;;;;EAMA;;EAGA,WAAW;;;;;;;;;;qBAWC,gBAAgB,GAAG"}
@@ -1,8 +1,7 @@
1
1
  import { FC, ReactNode } from "react";
2
-
3
2
  //#region src/pages/PrismicPreview.d.ts
4
3
  /** Props for `<PrismicPreview>`. */
5
- type PrismicPreviewProps = {
4
+ export type PrismicPreviewProps = {
6
5
  /**
7
6
  * The name of your Prismic repository. A Prismic Toolbar will be registered using this
8
7
  * repository.
@@ -17,7 +16,8 @@ type PrismicPreviewProps = {
17
16
  * The URL of your app's exit preview endpoint (default: `/api/exit-preview`). This URL will be
18
17
  * fetched on preview exit events.
19
18
  */
20
- exitPreviewURL?: string; /** Children to render adjacent to the Prismic Toolbar. */
19
+ exitPreviewURL?: string;
20
+ /** Children to render adjacent to the Prismic Toolbar. */
21
21
  children?: ReactNode;
22
22
  };
23
23
  /**
@@ -28,7 +28,6 @@ type PrismicPreviewProps = {
28
28
  * This component can be wrapped around your app or added anywhere in your app's tree. It must be
29
29
  * rendered on every page.
30
30
  */
31
- declare const PrismicPreview: FC<PrismicPreviewProps>;
31
+ export declare const PrismicPreview: FC<PrismicPreviewProps>;
32
32
  //#endregion
33
- export { PrismicPreview, PrismicPreviewProps };
34
33
  //# sourceMappingURL=PrismicPreview.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"PrismicPreview.d.ts","names":[],"sources":["../../src/pages/PrismicPreview.tsx"],"mappings":";;;;KAOY,mBAAA;EAAmB;;;;EAK9B,cAAA;EAYA;;;;EANA,gBAAA;EAoBY;;;;EAdZ,cAAA;EAGA,QAAA,GAAW,SAAA;AAAA;;;;;;;;;cAWC,cAAA,EAAgB,EAAA,CAAG,mBAAA"}
1
+ {"version":3,"file":"PrismicPreview.d.ts","names":[],"sources":["../../src/pages/PrismicPreview.tsx"],"mappings":";;;YAOY;;;;;EAKX;;;;;EAMA;;;;;EAMA;;EAGA,WAAW;;;;;;;;;;qBAWC,gBAAgB,GAAG"}
@@ -1 +1 @@
1
- {"version":3,"file":"PrismicPreview.js","names":["cookie","prismicCookie"],"sources":["../../src/pages/PrismicPreview.tsx"],"sourcesContent":["import { getToolbarSrc, cookie as prismicCookie } from \"@prismicio/client\"\nimport { useRouter } from \"next/router\"\nimport Script from \"next/script\"\nimport type { FC } from \"react\"\nimport { type ReactNode, useEffect } from \"react\"\n\n/** Props for `<PrismicPreview>`. */\nexport type PrismicPreviewProps = {\n\t/**\n\t * The name of your Prismic repository. A Prismic Toolbar will be registered using this\n\t * repository.\n\t */\n\trepositoryName: string\n\n\t/**\n\t * The URL of your app's Prismic preview endpoint (default: `/api/preview`). This URL will be\n\t * fetched on preview update events.\n\t */\n\tupdatePreviewURL?: string\n\n\t/**\n\t * The URL of your app's exit preview endpoint (default: `/api/exit-preview`). This URL will be\n\t * fetched on preview exit events.\n\t */\n\texitPreviewURL?: string\n\n\t/** Children to render adjacent to the Prismic Toolbar. */\n\tchildren?: ReactNode\n}\n\n/**\n * React component that sets up Prismic Previews using the Prismic Toolbar. When the Prismic Toolbar\n * send events to the browser, such as on preview updates and exiting, this component will\n * automatically refresh the page with the changes.\n *\n * This component can be wrapped around your app or added anywhere in your app's tree. It must be\n * rendered on every page.\n */\nexport const PrismicPreview: FC<PrismicPreviewProps> = (props) => {\n\tconst {\n\t\trepositoryName,\n\t\tupdatePreviewURL = \"/api/preview\",\n\t\texitPreviewURL = \"/api/exit-preview\",\n\t\tchildren,\n\t} = props\n\n\tconst router = useRouter()\n\n\tconst toolbarSrc = getToolbarSrc(repositoryName)\n\n\tuseEffect(() => {\n\t\tconst controller = new AbortController()\n\n\t\twindow.addEventListener(\"prismicPreviewUpdate\", onUpdate, {\n\t\t\tsignal: controller.signal,\n\t\t})\n\t\twindow.addEventListener(\"prismicPreviewEnd\", onEnd, {\n\t\t\tsignal: controller.signal,\n\t\t})\n\n\t\t// Start the preview for preview share links. Previews from\n\t\t// share links do not go to the `updatePreviewURL` like a normal\n\t\t// preview.\n\t\t//\n\t\t// We check that the current URL is a descendant of the base\n\t\t// path to prevent infinite refrehes.\n\t\tif (\n\t\t\twindow.location.href.startsWith(window.location.origin + router.basePath) &&\n\t\t\tgetPreviewCookieRepositoryName() === repositoryName &&\n\t\t\t!router.isPreview\n\t\t) {\n\t\t\tstart()\n\t\t}\n\n\t\tfunction onEnd(event: Event) {\n\t\t\tevent.preventDefault()\n\t\t\tfetch(router.basePath + exitPreviewURL, { signal: controller.signal })\n\t\t\t\t.then((res) => {\n\t\t\t\t\tif (!res.ok) {\n\t\t\t\t\t\tconsole.error(\n\t\t\t\t\t\t\t`[<PrismicPreview>] Failed to exit Preview Mode using the \"${exitPreviewURL}\" API endpoint. Does it exist?`,\n\t\t\t\t\t\t)\n\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\n\t\t\t\t\trefresh()\n\t\t\t\t})\n\t\t\t\t.catch(() => {})\n\t\t}\n\n\t\tfunction onUpdate(event: Event) {\n\t\t\tevent.preventDefault()\n\t\t\tstart()\n\t\t}\n\n\t\tfunction start() {\n\t\t\t// We check `opaqueredirect` because we don't care if\n\t\t\t// the redirect was successful or not. As long as it\n\t\t\t// redirects, we know the endpoint exists and at least\n\t\t\t// attempted to set preview data.\n\t\t\tfetch(router.basePath + updatePreviewURL, {\n\t\t\t\tredirect: \"manual\",\n\t\t\t\tsignal: controller.signal,\n\t\t\t})\n\t\t\t\t.then((res) => {\n\t\t\t\t\tif (res.type !== \"opaqueredirect\") {\n\t\t\t\t\t\tconsole.error(\n\t\t\t\t\t\t\t`[<PrismicPreview>] Failed to start or update the preview using \"${updatePreviewURL}\". Does it exist?`,\n\t\t\t\t\t\t)\n\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\n\t\t\t\t\trefresh()\n\t\t\t\t})\n\t\t\t\t.catch(() => {})\n\t\t}\n\n\t\tfunction refresh() {\n\t\t\trouter.replace(router.asPath, undefined, { scroll: false })\n\t\t}\n\n\t\treturn () => controller.abort()\n\t}, [exitPreviewURL, updatePreviewURL, repositoryName, router])\n\n\treturn (\n\t\t<>\n\t\t\t{children}\n\t\t\t<Script src={toolbarSrc} strategy=\"lazyOnload\" />\n\t\t</>\n\t)\n}\n\nfunction getPreviewCookieRepositoryName() {\n\tconst cookie = window.document.cookie\n\t\t.split(\"; \")\n\t\t.find((row) => row.startsWith(`${prismicCookie.preview}=`))\n\t\t?.split(\"=\")[1]\n\n\treturn (decodeURIComponent(cookie ?? \"\").match(/\"([^\"]+)\\.prismic\\.io\"/) || [])[1]\n}\n"],"mappings":";;;;;;;;;;;;;;AAsCA,MAAa,kBAA2C,UAAU;CACjE,MAAM,EACL,gBACA,mBAAmB,gBACnB,iBAAiB,qBACjB,aACG;CAEJ,MAAM,SAAS,WAAW;CAE1B,MAAM,aAAa,cAAc,eAAe;AAEhD,iBAAgB;EACf,MAAM,aAAa,IAAI,iBAAiB;AAExC,SAAO,iBAAiB,wBAAwB,UAAU,EACzD,QAAQ,WAAW,QACnB,CAAC;AACF,SAAO,iBAAiB,qBAAqB,OAAO,EACnD,QAAQ,WAAW,QACnB,CAAC;AAQF,MACC,OAAO,SAAS,KAAK,WAAW,OAAO,SAAS,SAAS,OAAO,SAAS,IACzE,gCAAgC,KAAK,kBACrC,CAAC,OAAO,UAER,QAAO;EAGR,SAAS,MAAM,OAAc;AAC5B,SAAM,gBAAgB;AACtB,SAAM,OAAO,WAAW,gBAAgB,EAAE,QAAQ,WAAW,QAAQ,CAAC,CACpE,MAAM,QAAQ;AACd,QAAI,CAAC,IAAI,IAAI;AACZ,aAAQ,MACP,6DAA6D,eAAe,gCAC5E;AAED;;AAGD,aAAS;KACR,CACD,YAAY,GAAG;;EAGlB,SAAS,SAAS,OAAc;AAC/B,SAAM,gBAAgB;AACtB,UAAO;;EAGR,SAAS,QAAQ;AAKhB,SAAM,OAAO,WAAW,kBAAkB;IACzC,UAAU;IACV,QAAQ,WAAW;IACnB,CAAC,CACA,MAAM,QAAQ;AACd,QAAI,IAAI,SAAS,kBAAkB;AAClC,aAAQ,MACP,mEAAmE,iBAAiB,mBACpF;AAED;;AAGD,aAAS;KACR,CACD,YAAY,GAAG;;EAGlB,SAAS,UAAU;AAClB,UAAO,QAAQ,OAAO,QAAQ,KAAA,GAAW,EAAE,QAAQ,OAAO,CAAC;;AAG5D,eAAa,WAAW,OAAO;IAC7B;EAAC;EAAgB;EAAkB;EAAgB;EAAO,CAAC;AAE9D,QACC,qBAAA,UAAA,EAAA,UAAA,CACE,UACD,oBAAC,QAAD;EAAQ,KAAK;EAAY,UAAS;EAAe,CAAA,CAC/C,EAAA,CAAA;;AAIL,SAAS,iCAAiC;CACzC,MAAMA,WAAS,OAAO,SAAS,OAC7B,MAAM,KAAK,CACX,MAAM,QAAQ,IAAI,WAAW,GAAGC,OAAc,QAAQ,GAAG,CAAC,EACzD,MAAM,IAAI,CAAC;AAEd,SAAQ,mBAAmBD,YAAU,GAAG,CAAC,MAAM,yBAAyB,IAAI,EAAE,EAAE"}
1
+ {"version":3,"file":"PrismicPreview.js","names":["cookie","prismicCookie"],"sources":["../../src/pages/PrismicPreview.tsx"],"sourcesContent":["import { getToolbarSrc, cookie as prismicCookie } from \"@prismicio/client\"\nimport { useRouter } from \"next/router\"\nimport Script from \"next/script\"\nimport type { FC } from \"react\"\nimport { type ReactNode, useEffect } from \"react\"\n\n/** Props for `<PrismicPreview>`. */\nexport type PrismicPreviewProps = {\n\t/**\n\t * The name of your Prismic repository. A Prismic Toolbar will be registered using this\n\t * repository.\n\t */\n\trepositoryName: string\n\n\t/**\n\t * The URL of your app's Prismic preview endpoint (default: `/api/preview`). This URL will be\n\t * fetched on preview update events.\n\t */\n\tupdatePreviewURL?: string\n\n\t/**\n\t * The URL of your app's exit preview endpoint (default: `/api/exit-preview`). This URL will be\n\t * fetched on preview exit events.\n\t */\n\texitPreviewURL?: string\n\n\t/** Children to render adjacent to the Prismic Toolbar. */\n\tchildren?: ReactNode\n}\n\n/**\n * React component that sets up Prismic Previews using the Prismic Toolbar. When the Prismic Toolbar\n * send events to the browser, such as on preview updates and exiting, this component will\n * automatically refresh the page with the changes.\n *\n * This component can be wrapped around your app or added anywhere in your app's tree. It must be\n * rendered on every page.\n */\nexport const PrismicPreview: FC<PrismicPreviewProps> = (props) => {\n\tconst {\n\t\trepositoryName,\n\t\tupdatePreviewURL = \"/api/preview\",\n\t\texitPreviewURL = \"/api/exit-preview\",\n\t\tchildren,\n\t} = props\n\n\tconst router = useRouter()\n\n\tconst toolbarSrc = getToolbarSrc(repositoryName)\n\n\tuseEffect(() => {\n\t\tconst controller = new AbortController()\n\n\t\twindow.addEventListener(\"prismicPreviewUpdate\", onUpdate, {\n\t\t\tsignal: controller.signal,\n\t\t})\n\t\twindow.addEventListener(\"prismicPreviewEnd\", onEnd, {\n\t\t\tsignal: controller.signal,\n\t\t})\n\n\t\t// Start the preview for preview share links. Previews from\n\t\t// share links do not go to the `updatePreviewURL` like a normal\n\t\t// preview.\n\t\t//\n\t\t// We check that the current URL is a descendant of the base\n\t\t// path to prevent infinite refrehes.\n\t\tif (\n\t\t\twindow.location.href.startsWith(window.location.origin + router.basePath) &&\n\t\t\tgetPreviewCookieRepositoryName() === repositoryName &&\n\t\t\t!router.isPreview\n\t\t) {\n\t\t\tstart()\n\t\t}\n\n\t\tfunction onEnd(event: Event) {\n\t\t\tevent.preventDefault()\n\t\t\tfetch(router.basePath + exitPreviewURL, { signal: controller.signal })\n\t\t\t\t.then((res) => {\n\t\t\t\t\tif (!res.ok) {\n\t\t\t\t\t\tconsole.error(\n\t\t\t\t\t\t\t`[<PrismicPreview>] Failed to exit Preview Mode using the \"${exitPreviewURL}\" API endpoint. Does it exist?`,\n\t\t\t\t\t\t)\n\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\n\t\t\t\t\trefresh()\n\t\t\t\t})\n\t\t\t\t.catch(() => {})\n\t\t}\n\n\t\tfunction onUpdate(event: Event) {\n\t\t\tevent.preventDefault()\n\t\t\tstart()\n\t\t}\n\n\t\tfunction start() {\n\t\t\t// We check `opaqueredirect` because we don't care if\n\t\t\t// the redirect was successful or not. As long as it\n\t\t\t// redirects, we know the endpoint exists and at least\n\t\t\t// attempted to set preview data.\n\t\t\tfetch(router.basePath + updatePreviewURL, {\n\t\t\t\tredirect: \"manual\",\n\t\t\t\tsignal: controller.signal,\n\t\t\t})\n\t\t\t\t.then((res) => {\n\t\t\t\t\tif (res.type !== \"opaqueredirect\") {\n\t\t\t\t\t\tconsole.error(\n\t\t\t\t\t\t\t`[<PrismicPreview>] Failed to start or update the preview using \"${updatePreviewURL}\". Does it exist?`,\n\t\t\t\t\t\t)\n\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\n\t\t\t\t\trefresh()\n\t\t\t\t})\n\t\t\t\t.catch(() => {})\n\t\t}\n\n\t\tfunction refresh() {\n\t\t\trouter.replace(router.asPath, undefined, { scroll: false })\n\t\t}\n\n\t\treturn () => controller.abort()\n\t}, [exitPreviewURL, updatePreviewURL, repositoryName, router])\n\n\treturn (\n\t\t<>\n\t\t\t{children}\n\t\t\t<Script src={toolbarSrc} strategy=\"lazyOnload\" />\n\t\t</>\n\t)\n}\n\nfunction getPreviewCookieRepositoryName() {\n\tconst cookie = window.document.cookie\n\t\t.split(\"; \")\n\t\t.find((row) => row.startsWith(`${prismicCookie.preview}=`))\n\t\t?.split(\"=\")[1]\n\n\treturn (decodeURIComponent(cookie ?? \"\").match(/\"([^\"]+)\\.prismic\\.io\"/) || [])[1]\n}\n"],"mappings":";;;;;;;;;;;;;;AAsCA,MAAa,kBAA2C,UAAU;CACjE,MAAM,EACL,gBACA,mBAAmB,gBACnB,iBAAiB,qBACjB,aACG;CAEJ,MAAM,SAAS,UAAU;CAEzB,MAAM,aAAa,cAAc,cAAc;CAE/C,gBAAgB;EACf,MAAM,aAAa,IAAI,gBAAgB;EAEvC,OAAO,iBAAiB,wBAAwB,UAAU,EACzD,QAAQ,WAAW,OACpB,CAAC;EACD,OAAO,iBAAiB,qBAAqB,OAAO,EACnD,QAAQ,WAAW,OACpB,CAAC;EAQD,IACC,OAAO,SAAS,KAAK,WAAW,OAAO,SAAS,SAAS,OAAO,QAAQ,KACxE,+BAA+B,MAAM,kBACrC,CAAC,OAAO,WAER,MAAM;EAGP,SAAS,MAAM,OAAc;GAC5B,MAAM,eAAe;GACrB,MAAM,OAAO,WAAW,gBAAgB,EAAE,QAAQ,WAAW,OAAO,CAAC,CAAC,CACpE,MAAM,QAAQ;IACd,IAAI,CAAC,IAAI,IAAI;KACZ,QAAQ,MACP,6DAA6D,eAAe,+BAC7E;KAEA;IACD;IAEA,QAAQ;GACT,CAAC,CAAC,CACD,YAAY,CAAC,CAAC;EACjB;EAEA,SAAS,SAAS,OAAc;GAC/B,MAAM,eAAe;GACrB,MAAM;EACP;EAEA,SAAS,QAAQ;GAKhB,MAAM,OAAO,WAAW,kBAAkB;IACzC,UAAU;IACV,QAAQ,WAAW;GACpB,CAAC,CAAC,CACA,MAAM,QAAQ;IACd,IAAI,IAAI,SAAS,kBAAkB;KAClC,QAAQ,MACP,mEAAmE,iBAAiB,kBACrF;KAEA;IACD;IAEA,QAAQ;GACT,CAAC,CAAC,CACD,YAAY,CAAC,CAAC;EACjB;EAEA,SAAS,UAAU;GAClB,OAAO,QAAQ,OAAO,QAAQ,KAAA,GAAW,EAAE,QAAQ,MAAM,CAAC;EAC3D;EAEA,aAAa,WAAW,MAAM;CAC/B,GAAG;EAAC;EAAgB;EAAkB;EAAgB;CAAM,CAAC;CAE7D,OACC,qBAAA,UAAA,EAAA,UAAA,CACE,UACD,oBAAC,QAAD;EAAQ,KAAK;EAAY,UAAS;CAAc,CAAA,CAC/C,EAAA,CAAA;AAEJ;AAEA,SAAS,iCAAiC;CACzC,MAAMA,WAAS,OAAO,SAAS,OAC7B,MAAM,IAAI,CAAC,CACX,MAAM,QAAQ,IAAI,WAAW,GAAGC,OAAc,QAAQ,EAAE,CAAC,CAAC,EACzD,MAAM,GAAG,CAAC,CAAC;CAEd,QAAQ,mBAAmBD,YAAU,EAAE,CAAC,CAAC,MAAM,wBAAwB,KAAK,CAAC,EAAA,CAAG;AACjF"}
@@ -1,4 +1,3 @@
1
- require("../_virtual/_rolldown/runtime.cjs");
2
1
  const require_SliceSimulatorWrapper = require("../SliceSimulatorWrapper.cjs");
3
2
  let react = require("react");
4
3
  let react_jsx_runtime = require("react/jsx-runtime");