@prismicio/next 2.2.3 → 2.2.4-pr.114.37ca25f

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 (192) hide show
  1. package/dist/PrismicNextImage.cjs +9 -11
  2. package/dist/PrismicNextImage.cjs.map +1 -1
  3. package/dist/PrismicNextImage.d.cts +13 -21
  4. package/dist/PrismicNextImage.d.cts.map +1 -0
  5. package/dist/PrismicNextImage.d.ts +13 -21
  6. package/dist/PrismicNextImage.d.ts.map +1 -0
  7. package/dist/PrismicNextImage.js +9 -11
  8. package/dist/PrismicNextImage.js.map +1 -1
  9. package/dist/PrismicNextLink.cjs.map +1 -1
  10. package/dist/PrismicNextLink.d.cts +3 -3
  11. package/dist/PrismicNextLink.d.cts.map +1 -0
  12. package/dist/PrismicNextLink.d.ts +3 -3
  13. package/dist/PrismicNextLink.d.ts.map +1 -0
  14. package/dist/PrismicNextLink.js.map +1 -1
  15. package/dist/PrismicPreview.cjs +6 -7
  16. package/dist/PrismicPreview.cjs.map +1 -1
  17. package/dist/PrismicPreview.d.cts +11 -12
  18. package/dist/PrismicPreview.d.cts.map +1 -0
  19. package/dist/PrismicPreview.d.ts +11 -12
  20. package/dist/PrismicPreview.d.ts.map +1 -0
  21. package/dist/PrismicPreview.js +6 -7
  22. package/dist/PrismicPreview.js.map +1 -1
  23. package/dist/PrismicPreviewClient.cjs +1 -3
  24. package/dist/PrismicPreviewClient.cjs.map +1 -1
  25. package/dist/PrismicPreviewClient.js +1 -3
  26. package/dist/PrismicPreviewClient.js.map +1 -1
  27. package/dist/SliceSimulator.cjs +3 -3
  28. package/dist/SliceSimulator.cjs.map +1 -1
  29. package/dist/SliceSimulator.d.cts +3 -5
  30. package/dist/SliceSimulator.d.cts.map +1 -0
  31. package/dist/SliceSimulator.d.ts +3 -5
  32. package/dist/SliceSimulator.d.ts.map +1 -0
  33. package/dist/SliceSimulator.js +3 -3
  34. package/dist/SliceSimulator.js.map +1 -1
  35. package/dist/SliceSimulatorWrapper.cjs +1 -4
  36. package/dist/SliceSimulatorWrapper.cjs.map +1 -1
  37. package/dist/SliceSimulatorWrapper.js +1 -4
  38. package/dist/SliceSimulatorWrapper.js.map +1 -1
  39. package/dist/cacheTagPrismicPages.cjs +11 -0
  40. package/dist/cacheTagPrismicPages.cjs.map +1 -0
  41. package/dist/cacheTagPrismicPages.d.cts +7 -0
  42. package/dist/cacheTagPrismicPages.d.cts.map +1 -0
  43. package/dist/cacheTagPrismicPages.d.ts +7 -0
  44. package/dist/cacheTagPrismicPages.d.ts.map +1 -0
  45. package/dist/cacheTagPrismicPages.js +10 -0
  46. package/dist/cacheTagPrismicPages.js.map +1 -0
  47. package/dist/createLocaleRedirect.cjs.map +1 -1
  48. package/dist/createLocaleRedirect.d.cts.map +1 -0
  49. package/dist/createLocaleRedirect.d.ts.map +1 -0
  50. package/dist/createLocaleRedirect.js.map +1 -1
  51. package/dist/enableAutoPreviews.cjs +1 -2
  52. package/dist/enableAutoPreviews.cjs.map +1 -1
  53. package/dist/enableAutoPreviews.d.cts +1 -2
  54. package/dist/enableAutoPreviews.d.cts.map +1 -0
  55. package/dist/enableAutoPreviews.d.ts +1 -2
  56. package/dist/enableAutoPreviews.d.ts.map +1 -0
  57. package/dist/enableAutoPreviews.js +1 -2
  58. package/dist/enableAutoPreviews.js.map +1 -1
  59. package/dist/exitPreview.cjs +9 -10
  60. package/dist/exitPreview.cjs.map +1 -1
  61. package/dist/exitPreview.d.cts +9 -10
  62. package/dist/exitPreview.d.cts.map +1 -0
  63. package/dist/exitPreview.d.ts +9 -10
  64. package/dist/exitPreview.d.ts.map +1 -0
  65. package/dist/exitPreview.js +9 -10
  66. package/dist/exitPreview.js.map +1 -1
  67. package/dist/getPrismicCacheTags.cjs +29 -0
  68. package/dist/getPrismicCacheTags.cjs.map +1 -0
  69. package/dist/getPrismicCacheTags.d.cts +14 -0
  70. package/dist/getPrismicCacheTags.d.cts.map +1 -0
  71. package/dist/getPrismicCacheTags.d.ts +14 -0
  72. package/dist/getPrismicCacheTags.d.ts.map +1 -0
  73. package/dist/getPrismicCacheTags.js +28 -0
  74. package/dist/getPrismicCacheTags.js.map +1 -0
  75. package/dist/getSlices.cjs.map +1 -1
  76. package/dist/getSlices.d.cts.map +1 -0
  77. package/dist/getSlices.d.ts.map +1 -0
  78. package/dist/getSlices.js.map +1 -1
  79. package/dist/imgixLoader.cjs +2 -2
  80. package/dist/imgixLoader.cjs.map +1 -1
  81. package/dist/imgixLoader.d.cts +2 -2
  82. package/dist/imgixLoader.d.cts.map +1 -0
  83. package/dist/imgixLoader.d.ts +2 -2
  84. package/dist/imgixLoader.d.ts.map +1 -0
  85. package/dist/imgixLoader.js +2 -2
  86. package/dist/imgixLoader.js.map +1 -1
  87. package/dist/index.cjs +6 -0
  88. package/dist/index.d.cts +4 -1
  89. package/dist/index.d.ts +4 -1
  90. package/dist/index.js +4 -1
  91. package/dist/lib/devMsg.cjs +6 -8
  92. package/dist/lib/devMsg.cjs.map +1 -1
  93. package/dist/lib/devMsg.js +6 -8
  94. package/dist/lib/devMsg.js.map +1 -1
  95. package/dist/lib/resolveDefaultExport.cjs +8 -12
  96. package/dist/lib/resolveDefaultExport.cjs.map +1 -1
  97. package/dist/lib/resolveDefaultExport.js +8 -12
  98. package/dist/lib/resolveDefaultExport.js.map +1 -1
  99. package/dist/package.cjs +1 -1
  100. package/dist/package.js +1 -1
  101. package/dist/pages/PrismicPreview.cjs +6 -7
  102. package/dist/pages/PrismicPreview.cjs.map +1 -1
  103. package/dist/pages/PrismicPreview.d.cts +11 -12
  104. package/dist/pages/PrismicPreview.d.cts.map +1 -0
  105. package/dist/pages/PrismicPreview.d.ts +11 -12
  106. package/dist/pages/PrismicPreview.d.ts.map +1 -0
  107. package/dist/pages/PrismicPreview.js +6 -7
  108. package/dist/pages/PrismicPreview.js.map +1 -1
  109. package/dist/pages/SliceSimulator.cjs +2 -2
  110. package/dist/pages/SliceSimulator.cjs.map +1 -1
  111. package/dist/pages/SliceSimulator.d.cts +10 -13
  112. package/dist/pages/SliceSimulator.d.cts.map +1 -0
  113. package/dist/pages/SliceSimulator.d.ts +10 -13
  114. package/dist/pages/SliceSimulator.d.ts.map +1 -0
  115. package/dist/pages/SliceSimulator.js +2 -2
  116. package/dist/pages/SliceSimulator.js.map +1 -1
  117. package/dist/pages/enableAutoPreviews.cjs +3 -3
  118. package/dist/pages/enableAutoPreviews.cjs.map +1 -1
  119. package/dist/pages/enableAutoPreviews.d.cts +5 -5
  120. package/dist/pages/enableAutoPreviews.d.cts.map +1 -0
  121. package/dist/pages/enableAutoPreviews.d.ts +5 -5
  122. package/dist/pages/enableAutoPreviews.d.ts.map +1 -0
  123. package/dist/pages/enableAutoPreviews.js +3 -3
  124. package/dist/pages/enableAutoPreviews.js.map +1 -1
  125. package/dist/pages/exitPreview.cjs +9 -10
  126. package/dist/pages/exitPreview.cjs.map +1 -1
  127. package/dist/pages/exitPreview.d.cts +9 -10
  128. package/dist/pages/exitPreview.d.cts.map +1 -0
  129. package/dist/pages/exitPreview.d.ts +9 -10
  130. package/dist/pages/exitPreview.d.ts.map +1 -0
  131. package/dist/pages/exitPreview.js +9 -10
  132. package/dist/pages/exitPreview.js.map +1 -1
  133. package/dist/pages/redirectToPreviewURL.cjs.map +1 -1
  134. package/dist/pages/redirectToPreviewURL.d.cts +7 -9
  135. package/dist/pages/redirectToPreviewURL.d.cts.map +1 -0
  136. package/dist/pages/redirectToPreviewURL.d.ts +7 -9
  137. package/dist/pages/redirectToPreviewURL.d.ts.map +1 -0
  138. package/dist/pages/redirectToPreviewURL.js.map +1 -1
  139. package/dist/pages/setPreviewData.cjs.map +1 -1
  140. package/dist/pages/setPreviewData.d.cts.map +1 -0
  141. package/dist/pages/setPreviewData.d.ts.map +1 -0
  142. package/dist/pages/setPreviewData.js.map +1 -1
  143. package/dist/pages/types.d.cts +3 -8
  144. package/dist/pages/types.d.cts.map +1 -0
  145. package/dist/pages/types.d.ts +3 -8
  146. package/dist/pages/types.d.ts.map +1 -0
  147. package/dist/redirectToPreviewURL.cjs.map +1 -1
  148. package/dist/redirectToPreviewURL.d.cts +3 -5
  149. package/dist/redirectToPreviewURL.d.cts.map +1 -0
  150. package/dist/redirectToPreviewURL.d.ts +3 -5
  151. package/dist/redirectToPreviewURL.d.ts.map +1 -0
  152. package/dist/redirectToPreviewURL.js.map +1 -1
  153. package/dist/revalidatePrismicPages.cjs +18 -0
  154. package/dist/revalidatePrismicPages.cjs.map +1 -0
  155. package/dist/revalidatePrismicPages.d.cts +12 -0
  156. package/dist/revalidatePrismicPages.d.cts.map +1 -0
  157. package/dist/revalidatePrismicPages.d.ts +12 -0
  158. package/dist/revalidatePrismicPages.d.ts.map +1 -0
  159. package/dist/revalidatePrismicPages.js +17 -0
  160. package/dist/revalidatePrismicPages.js.map +1 -0
  161. package/dist/types.d.cts +1 -2
  162. package/dist/types.d.cts.map +1 -0
  163. package/dist/types.d.ts +1 -2
  164. package/dist/types.d.ts.map +1 -0
  165. package/package.json +32 -34
  166. package/src/PrismicNextImage.tsx +113 -134
  167. package/src/PrismicNextLink.tsx +43 -45
  168. package/src/PrismicPreview.tsx +28 -29
  169. package/src/PrismicPreviewClient.tsx +42 -44
  170. package/src/SliceSimulator.tsx +38 -43
  171. package/src/SliceSimulatorWrapper.tsx +15 -25
  172. package/src/cacheTagPrismicPages.ts +8 -0
  173. package/src/createLocaleRedirect.ts +3 -3
  174. package/src/enableAutoPreviews.ts +15 -16
  175. package/src/exitPreview.ts +12 -13
  176. package/src/getPrismicCacheTags.ts +44 -0
  177. package/src/getSlices.ts +6 -10
  178. package/src/imgixLoader.ts +10 -10
  179. package/src/index.ts +24 -21
  180. package/src/lib/devMsg.ts +9 -11
  181. package/src/lib/resolveDefaultExport.ts +9 -13
  182. package/src/pages/PrismicPreview.tsx +47 -51
  183. package/src/pages/SliceSimulator.tsx +35 -37
  184. package/src/pages/enableAutoPreviews.ts +17 -17
  185. package/src/pages/exitPreview.ts +17 -18
  186. package/src/pages/index.ts +20 -23
  187. package/src/pages/redirectToPreviewURL.ts +22 -33
  188. package/src/pages/setPreviewData.ts +7 -7
  189. package/src/pages/types.ts +16 -20
  190. package/src/redirectToPreviewURL.ts +21 -30
  191. package/src/revalidatePrismicPages.ts +17 -0
  192. package/src/types.ts +12 -13
@@ -0,0 +1,29 @@
1
+ //#region src/getPrismicCacheTags.ts
2
+ const CACHE_TAG_PREFIX = "prismic/";
3
+ /**
4
+ * Generates cache tags for a set of Prismic pages. Tags for linked pages (e.g. a content
5
+ * relationship) are included to ensure all related content can be revalidated.
6
+ *
7
+ * @param pages - A set of Prismic pages used to tag the function.
8
+ * @see {@link https://nextjs.org/docs/app/api-reference/functions/cacheTag}
9
+ */
10
+ function getPrismicCacheTags(pages) {
11
+ return [...new Set(getPrismicDocumentIDs(pages))].map((id) => buildPrismicCacheTag(id));
12
+ }
13
+ function buildPrismicCacheTag(id) {
14
+ return `${CACHE_TAG_PREFIX}${id}`;
15
+ }
16
+ function getPrismicDocumentIDs(input) {
17
+ if (typeof input !== "object" || input == null) return [];
18
+ if (Array.isArray(input)) return input.flatMap((item) => getPrismicDocumentIDs(item));
19
+ if ("id" in input && typeof input.id === "string") {
20
+ 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)];
21
+ else return [input.id];
22
+ }
23
+ return Object.values(input).flatMap((input) => getPrismicDocumentIDs(input));
24
+ }
25
+ //#endregion
26
+ exports.buildPrismicCacheTag = buildPrismicCacheTag;
27
+ exports.getPrismicCacheTags = getPrismicCacheTags;
28
+
29
+ //# sourceMappingURL=getPrismicCacheTags.cjs.map
@@ -0,0 +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 * @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;;;;;;;;AASzB,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"}
@@ -0,0 +1,14 @@
1
+ import { PrismicDocument } from "@prismicio/client";
2
+
3
+ //#region src/getPrismicCacheTags.d.ts
4
+ /**
5
+ * Generates cache tags for a set of Prismic pages. Tags for linked pages (e.g. a content
6
+ * relationship) are included to ensure all related content can be revalidated.
7
+ *
8
+ * @param pages - A set of Prismic pages used to tag the function.
9
+ * @see {@link https://nextjs.org/docs/app/api-reference/functions/cacheTag}
10
+ */
11
+ declare function getPrismicCacheTags(pages: PrismicDocument[]): string[];
12
+ //#endregion
13
+ export { getPrismicCacheTags };
14
+ //# sourceMappingURL=getPrismicCacheTags.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getPrismicCacheTags.d.cts","names":[],"sources":["../src/getPrismicCacheTags.ts"],"mappings":";;;;;AAWA;;;;;iBAAgB,mBAAA,CAAoB,KAAA,EAAO,eAAA"}
@@ -0,0 +1,14 @@
1
+ import { PrismicDocument } from "@prismicio/client";
2
+
3
+ //#region src/getPrismicCacheTags.d.ts
4
+ /**
5
+ * Generates cache tags for a set of Prismic pages. Tags for linked pages (e.g. a content
6
+ * relationship) are included to ensure all related content can be revalidated.
7
+ *
8
+ * @param pages - A set of Prismic pages used to tag the function.
9
+ * @see {@link https://nextjs.org/docs/app/api-reference/functions/cacheTag}
10
+ */
11
+ declare function getPrismicCacheTags(pages: PrismicDocument[]): string[];
12
+ //#endregion
13
+ export { getPrismicCacheTags };
14
+ //# sourceMappingURL=getPrismicCacheTags.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getPrismicCacheTags.d.ts","names":[],"sources":["../src/getPrismicCacheTags.ts"],"mappings":";;;;;AAWA;;;;;iBAAgB,mBAAA,CAAoB,KAAA,EAAO,eAAA"}
@@ -0,0 +1,28 @@
1
+ //#region src/getPrismicCacheTags.ts
2
+ const CACHE_TAG_PREFIX = "prismic/";
3
+ /**
4
+ * Generates cache tags for a set of Prismic pages. Tags for linked pages (e.g. a content
5
+ * relationship) are included to ensure all related content can be revalidated.
6
+ *
7
+ * @param pages - A set of Prismic pages used to tag the function.
8
+ * @see {@link https://nextjs.org/docs/app/api-reference/functions/cacheTag}
9
+ */
10
+ function getPrismicCacheTags(pages) {
11
+ return [...new Set(getPrismicDocumentIDs(pages))].map((id) => buildPrismicCacheTag(id));
12
+ }
13
+ function buildPrismicCacheTag(id) {
14
+ return `${CACHE_TAG_PREFIX}${id}`;
15
+ }
16
+ function getPrismicDocumentIDs(input) {
17
+ if (typeof input !== "object" || input == null) return [];
18
+ if (Array.isArray(input)) return input.flatMap((item) => getPrismicDocumentIDs(item));
19
+ if ("id" in input && typeof input.id === "string") {
20
+ 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)];
21
+ else return [input.id];
22
+ }
23
+ return Object.values(input).flatMap((input) => getPrismicDocumentIDs(input));
24
+ }
25
+ //#endregion
26
+ export { buildPrismicCacheTag, getPrismicCacheTags };
27
+
28
+ //# sourceMappingURL=getPrismicCacheTags.js.map
@@ -0,0 +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 * @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;;;;;;;;AASzB,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 +1 @@
1
- {"version":3,"file":"getSlices.cjs","names":[],"sources":["../src/getSlices.ts"],"sourcesContent":["import { getDefaultSlices } from \"@prismicio/simulator/kit\";\nimport type { StateEvents, StateEventType } from \"@prismicio/simulator/kit\";\nimport { decompressFromEncodedURIComponent } from \"lz-string\";\n\nexport const getSlices = (\n\tstate: string | null | undefined,\n): StateEvents[StateEventType.Slices] => {\n\treturn state\n\t\t? JSON.parse(decompressFromEncodedURIComponent(state))\n\t\t: getDefaultSlices();\n};\n"],"mappings":";;;;AAIA,MAAa,aACZ,UACwC;AACxC,QAAO,QACJ,KAAK,OAAA,GAAA,UAAA,mCAAwC,MAAM,CAAC,IAAA,GAAA,yBAAA,mBAClC"}
1
+ {"version":3,"file":"getSlices.cjs","names":[],"sources":["../src/getSlices.ts"],"sourcesContent":["import { getDefaultSlices } from \"@prismicio/simulator/kit\"\nimport type { StateEvents, StateEventType } from \"@prismicio/simulator/kit\"\nimport { decompressFromEncodedURIComponent } from \"lz-string\"\n\nexport const getSlices = (state: string | null | undefined): StateEvents[StateEventType.Slices] => {\n\treturn state ? JSON.parse(decompressFromEncodedURIComponent(state)) : getDefaultSlices()\n}\n"],"mappings":";;;;AAIA,MAAa,aAAa,UAAyE;AAClG,QAAO,QAAQ,KAAK,OAAA,GAAA,UAAA,mCAAwC,MAAM,CAAC,IAAA,GAAA,yBAAA,mBAAqB"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getSlices.d.cts","names":[],"sources":["../src/getSlices.ts"],"mappings":";;;cAIa,SAAA,GAAa,KAAA,gCAAmC,WAAA,CAAY,cAAA,CAAe,MAAA"}
@@ -0,0 +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 +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 { decompressFromEncodedURIComponent } from \"lz-string\";\n\nexport const getSlices = (\n\tstate: string | null | undefined,\n): StateEvents[StateEventType.Slices] => {\n\treturn state\n\t\t? JSON.parse(decompressFromEncodedURIComponent(state))\n\t\t: getDefaultSlices();\n};\n"],"mappings":";;;AAIA,MAAa,aACZ,UACwC;AACxC,QAAO,QACJ,KAAK,MAAM,kCAAkC,MAAM,CAAC,GACpD,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 { decompressFromEncodedURIComponent } from \"lz-string\"\n\nexport const getSlices = (state: string | null | undefined): StateEvents[StateEventType.Slices] => {\n\treturn state ? JSON.parse(decompressFromEncodedURIComponent(state)) : getDefaultSlices()\n}\n"],"mappings":";;;AAIA,MAAa,aAAa,UAAyE;AAClG,QAAO,QAAQ,KAAK,MAAM,kCAAkC,MAAM,CAAC,GAAG,kBAAkB"}
@@ -2,8 +2,8 @@ require("./_virtual/_rolldown/runtime.cjs");
2
2
  let imgix_url_builder = require("imgix-url-builder");
3
3
  //#region src/imgixLoader.ts
4
4
  /**
5
- * A `next/image` loader for Imgix, which Prismic uses, with an optional
6
- * collection of default Imgix parameters.
5
+ * A `next/image` loader for Imgix, which Prismic uses, with an optional collection of default Imgix
6
+ * parameters.
7
7
  *
8
8
  * @see To learn about `next/image` loaders: https://nextjs.org/docs/api-reference/next/image#loader
9
9
  * @see To learn about Imgix's URL API: https://docs.imgix.com/apis/rendering
@@ -1 +1 @@
1
- {"version":3,"file":"imgixLoader.cjs","names":[],"sources":["../src/imgixLoader.ts"],"sourcesContent":["import type { ImageLoaderProps } from \"next/image\";\nimport type { ImgixURLParams } from \"imgix-url-builder\";\nimport { buildURL } from \"imgix-url-builder\";\n\n/**\n * A `next/image` loader for Imgix, which Prismic uses, with an optional\n * collection of default Imgix 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":[],"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"}
@@ -2,8 +2,8 @@ import { ImageLoaderProps } from "next/image.js";
2
2
 
3
3
  //#region src/imgixLoader.d.ts
4
4
  /**
5
- * A `next/image` loader for Imgix, which Prismic uses, with an optional
6
- * collection of default Imgix parameters.
5
+ * A `next/image` loader for Imgix, which Prismic uses, with an optional collection of default Imgix
6
+ * parameters.
7
7
  *
8
8
  * @see To learn about `next/image` loaders: https://nextjs.org/docs/api-reference/next/image#loader
9
9
  * @see To learn about Imgix's URL API: https://docs.imgix.com/apis/rendering
@@ -0,0 +1 @@
1
+ {"version":3,"file":"imgixLoader.d.cts","names":[],"sources":["../src/imgixLoader.ts"],"mappings":";;;;;AAWA;;;;;cAAa,WAAA,GAAe,IAAA,EAAM,gBAAA"}
@@ -2,8 +2,8 @@ import { ImageLoaderProps } from "next/image.js";
2
2
 
3
3
  //#region src/imgixLoader.d.ts
4
4
  /**
5
- * A `next/image` loader for Imgix, which Prismic uses, with an optional
6
- * collection of default Imgix parameters.
5
+ * A `next/image` loader for Imgix, which Prismic uses, with an optional collection of default Imgix
6
+ * parameters.
7
7
  *
8
8
  * @see To learn about `next/image` loaders: https://nextjs.org/docs/api-reference/next/image#loader
9
9
  * @see To learn about Imgix's URL API: https://docs.imgix.com/apis/rendering
@@ -0,0 +1 @@
1
+ {"version":3,"file":"imgixLoader.d.ts","names":[],"sources":["../src/imgixLoader.ts"],"mappings":";;;;;AAWA;;;;;cAAa,WAAA,GAAe,IAAA,EAAM,gBAAA"}
@@ -1,8 +1,8 @@
1
1
  import { buildURL } from "imgix-url-builder";
2
2
  //#region src/imgixLoader.ts
3
3
  /**
4
- * A `next/image` loader for Imgix, which Prismic uses, with an optional
5
- * collection of default Imgix parameters.
4
+ * A `next/image` loader for Imgix, which Prismic uses, with an optional collection of default Imgix
5
+ * parameters.
6
6
  *
7
7
  * @see To learn about `next/image` loaders: https://nextjs.org/docs/api-reference/next/image#loader
8
8
  * @see To learn about Imgix's URL API: https://docs.imgix.com/apis/rendering
@@ -1 +1 @@
1
- {"version":3,"file":"imgixLoader.js","names":[],"sources":["../src/imgixLoader.ts"],"sourcesContent":["import type { ImageLoaderProps } from \"next/image\";\nimport type { ImgixURLParams } from \"imgix-url-builder\";\nimport { buildURL } from \"imgix-url-builder\";\n\n/**\n * A `next/image` loader for Imgix, which Prismic uses, with an optional\n * collection of default Imgix 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,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"}
package/dist/index.cjs CHANGED
@@ -9,13 +9,19 @@ const require_PrismicNextImage = require("./PrismicNextImage.cjs");
9
9
  const require_getSlices = require("./getSlices.cjs");
10
10
  const require_SliceSimulator = require("./SliceSimulator.cjs");
11
11
  const require_createLocaleRedirect = require("./createLocaleRedirect.cjs");
12
+ const require_getPrismicCacheTags = require("./getPrismicCacheTags.cjs");
13
+ const require_cacheTagPrismicPages = require("./cacheTagPrismicPages.cjs");
14
+ const require_revalidatePrismicPages = require("./revalidatePrismicPages.cjs");
12
15
  exports.PrismicNextImage = require_PrismicNextImage.PrismicNextImage;
13
16
  exports.PrismicNextLink = require_PrismicNextLink.PrismicNextLink;
14
17
  exports.PrismicPreview = require_PrismicPreview.PrismicPreview;
15
18
  exports.SliceSimulator = require_SliceSimulator.SliceSimulator;
19
+ exports.cacheTagPrismicPages = require_cacheTagPrismicPages.cacheTagPrismicPages;
16
20
  exports.createLocaleRedirect = require_createLocaleRedirect.createLocaleRedirect;
17
21
  exports.enableAutoPreviews = require_enableAutoPreviews.enableAutoPreviews;
18
22
  exports.exitPreview = require_exitPreview.exitPreview;
23
+ exports.getPrismicCacheTags = require_getPrismicCacheTags.getPrismicCacheTags;
19
24
  exports.getSlices = require_getSlices.getSlices;
20
25
  exports.imgixLoader = require_imgixLoader.imgixLoader;
21
26
  exports.redirectToPreviewURL = require_redirectToPreviewURL.redirectToPreviewURL;
27
+ exports.revalidatePrismicPages = require_revalidatePrismicPages.revalidatePrismicPages;
package/dist/index.d.cts CHANGED
@@ -9,4 +9,7 @@ import { SliceSimulator, SliceSimulatorParams, SliceSimulatorProps } from "./Sli
9
9
  import { getSlices } from "./getSlices.cjs";
10
10
  import { imgixLoader } from "./imgixLoader.cjs";
11
11
  import { CreateLocaleRedirectConfig, createLocaleRedirect } from "./createLocaleRedirect.cjs";
12
- export { type CreateClientConfig, type CreateLocaleRedirectConfig, type EnableAutoPreviewsConfig, PrismicNextImage, type PrismicNextImageProps, PrismicNextLink, type PrismicNextLinkProps, PrismicPreview, type PrismicPreviewProps, type RedirectToPreviewURLConfig, SliceSimulator, type SliceSimulatorParams, type SliceSimulatorProps, createLocaleRedirect, enableAutoPreviews, exitPreview, getSlices, imgixLoader, redirectToPreviewURL };
12
+ import { getPrismicCacheTags } from "./getPrismicCacheTags.cjs";
13
+ import { cacheTagPrismicPages } from "./cacheTagPrismicPages.cjs";
14
+ import { revalidatePrismicPages } from "./revalidatePrismicPages.cjs";
15
+ export { type CreateClientConfig, type CreateLocaleRedirectConfig, type EnableAutoPreviewsConfig, PrismicNextImage, type PrismicNextImageProps, PrismicNextLink, type PrismicNextLinkProps, PrismicPreview, type PrismicPreviewProps, type RedirectToPreviewURLConfig, SliceSimulator, type SliceSimulatorParams, type SliceSimulatorProps, cacheTagPrismicPages, createLocaleRedirect, enableAutoPreviews, exitPreview, getPrismicCacheTags, getSlices, imgixLoader, redirectToPreviewURL, revalidatePrismicPages };
package/dist/index.d.ts CHANGED
@@ -9,4 +9,7 @@ import { SliceSimulator, SliceSimulatorParams, SliceSimulatorProps } from "./Sli
9
9
  import { getSlices } from "./getSlices.js";
10
10
  import { imgixLoader } from "./imgixLoader.js";
11
11
  import { CreateLocaleRedirectConfig, createLocaleRedirect } from "./createLocaleRedirect.js";
12
- export { type CreateClientConfig, type CreateLocaleRedirectConfig, type EnableAutoPreviewsConfig, PrismicNextImage, type PrismicNextImageProps, PrismicNextLink, type PrismicNextLinkProps, PrismicPreview, type PrismicPreviewProps, type RedirectToPreviewURLConfig, SliceSimulator, type SliceSimulatorParams, type SliceSimulatorProps, createLocaleRedirect, enableAutoPreviews, exitPreview, getSlices, imgixLoader, redirectToPreviewURL };
12
+ import { getPrismicCacheTags } from "./getPrismicCacheTags.js";
13
+ import { cacheTagPrismicPages } from "./cacheTagPrismicPages.js";
14
+ import { revalidatePrismicPages } from "./revalidatePrismicPages.js";
15
+ export { type CreateClientConfig, type CreateLocaleRedirectConfig, type EnableAutoPreviewsConfig, PrismicNextImage, type PrismicNextImageProps, PrismicNextLink, type PrismicNextLinkProps, PrismicPreview, type PrismicPreviewProps, type RedirectToPreviewURLConfig, SliceSimulator, type SliceSimulatorParams, type SliceSimulatorProps, cacheTagPrismicPages, createLocaleRedirect, enableAutoPreviews, exitPreview, getPrismicCacheTags, getSlices, imgixLoader, redirectToPreviewURL, revalidatePrismicPages };
package/dist/index.js CHANGED
@@ -8,4 +8,7 @@ import { PrismicNextImage } from "./PrismicNextImage.js";
8
8
  import { getSlices } from "./getSlices.js";
9
9
  import { SliceSimulator } from "./SliceSimulator.js";
10
10
  import { createLocaleRedirect } from "./createLocaleRedirect.js";
11
- export { PrismicNextImage, PrismicNextLink, PrismicPreview, SliceSimulator, createLocaleRedirect, enableAutoPreviews, exitPreview, getSlices, imgixLoader, redirectToPreviewURL };
11
+ import { getPrismicCacheTags } from "./getPrismicCacheTags.js";
12
+ import { cacheTagPrismicPages } from "./cacheTagPrismicPages.js";
13
+ import { revalidatePrismicPages } from "./revalidatePrismicPages.js";
14
+ export { PrismicNextImage, PrismicNextLink, PrismicPreview, SliceSimulator, cacheTagPrismicPages, createLocaleRedirect, enableAutoPreviews, exitPreview, getPrismicCacheTags, getSlices, imgixLoader, redirectToPreviewURL, revalidatePrismicPages };
@@ -4,15 +4,13 @@ const require_package = require("../package.cjs");
4
4
  * Returns a `prismic.dev/msg` URL for a given message slug.
5
5
  *
6
6
  * @example
7
+ * ;```ts
8
+ * devMsg("missing-param")
9
+ * // => "https://prismic.dev/msg/next/v1.2.3/missing-param"
10
+ * ```
7
11
  *
8
- * ```ts
9
- * devMsg("missing-param");
10
- * // => "https://prismic.dev/msg/next/v1.2.3/missing-param"
11
- * ```
12
- *
13
- * @param slug - Slug for the message. This corresponds to a Markdown file in
14
- * the Git repository's `/messages` directory.
15
- *
12
+ * @param slug - Slug for the message. This corresponds to a Markdown file in the Git repository's
13
+ * `/messages` directory.
16
14
  * @returns The `prismic.dev/msg` URL for the given slug.
17
15
  */
18
16
  const devMsg = (slug) => {
@@ -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 *\n * ```ts\n * devMsg(\"missing-param\");\n * // => \"https://prismic.dev/msg/next/v1.2.3/missing-param\"\n * ```\n *\n * @param slug - Slug for the message. This corresponds to a Markdown file in\n * the Git repository's `/messages` directory.\n *\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":";;;;;;;;;;;;;;;;;AAiBA,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;AAC/C,QAAO,iCAAiCA,gBAAAA,QAAQ,GAAG"}
@@ -4,15 +4,13 @@ import { version } from "../package.js";
4
4
  * Returns a `prismic.dev/msg` URL for a given message slug.
5
5
  *
6
6
  * @example
7
+ * ;```ts
8
+ * devMsg("missing-param")
9
+ * // => "https://prismic.dev/msg/next/v1.2.3/missing-param"
10
+ * ```
7
11
  *
8
- * ```ts
9
- * devMsg("missing-param");
10
- * // => "https://prismic.dev/msg/next/v1.2.3/missing-param"
11
- * ```
12
- *
13
- * @param slug - Slug for the message. This corresponds to a Markdown file in
14
- * the Git repository's `/messages` directory.
15
- *
12
+ * @param slug - Slug for the message. This corresponds to a Markdown file in the Git repository's
13
+ * `/messages` directory.
16
14
  * @returns The `prismic.dev/msg` URL for the given slug.
17
15
  */
18
16
  const devMsg = (slug) => {
@@ -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 *\n * ```ts\n * devMsg(\"missing-param\");\n * // => \"https://prismic.dev/msg/next/v1.2.3/missing-param\"\n * ```\n *\n * @param slug - Slug for the message. This corresponds to a Markdown file in\n * the Git repository's `/messages` directory.\n *\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":";;;;;;;;;;;;;;;;;AAiBA,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;AAC/C,QAAO,iCAAiC,QAAQ,GAAG"}
@@ -1,20 +1,16 @@
1
1
  //#region src/lib/resolveDefaultExport.ts
2
2
  /**
3
- * Resolves a module's default export. The module may provide its default export
4
- * as a `default` property on an object. This happens when named and default
5
- * exports are mixed in modules.
3
+ * Resolves a module's default export. The module may provide its default export as a `default`
4
+ * property on an object. This happens when named and default exports are mixed in modules.
6
5
  *
7
- * In ES Modules, mixing is fine since the module resolver can distinguish
8
- * default and named exports. In transpiled modules, however, all exports are
9
- * put into a single object, and the default export is provided at a property
10
- * called `default`.
6
+ * In ES Modules, mixing is fine since the module resolver can distinguish default and named
7
+ * exports. In transpiled modules, however, all exports are put into a single object, and the
8
+ * default export is provided at a property called `default`.
11
9
  *
12
- * This helper is needed by Next.js uses CJS files with named and default
13
- * exports.
10
+ * This helper is needed by Next.js uses CJS files with named and default exports.
14
11
  *
15
- * This helper _should_ be a temporary hack until Next.js and Node.js resolve
16
- * their ESM difficulties. This will likely not be removed any time soon,
17
- * unfortunately.
12
+ * This helper _should_ be a temporary hack until Next.js and Node.js resolve their ESM
13
+ * difficulties. This will likely not be removed any time soon, unfortunately.
18
14
  */
19
15
  function resolveDefaultExport(mod) {
20
16
  return "default" in mod ? mod.default : mod;
@@ -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\n * as a `default` property on an object. This happens when named and default\n * exports are mixed in modules.\n *\n * In ES Modules, mixing is fine since the module resolver can distinguish\n * default and named exports. In transpiled modules, however, all exports are\n * put into a single object, and the default export is provided at a property\n * called `default`.\n *\n * This helper is needed by Next.js uses CJS files with named and default\n * exports.\n *\n * This helper _should_ be a temporary hack until Next.js and Node.js resolve\n * their ESM difficulties. This will likely not be removed any time soon,\n * 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":";;;;;;;;;;;;;;;;;;AAiBA,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;AAElD,QAAO,aAAc,MAAe,IAAY,UAAU"}
@@ -1,20 +1,16 @@
1
1
  //#region src/lib/resolveDefaultExport.ts
2
2
  /**
3
- * Resolves a module's default export. The module may provide its default export
4
- * as a `default` property on an object. This happens when named and default
5
- * exports are mixed in modules.
3
+ * Resolves a module's default export. The module may provide its default export as a `default`
4
+ * property on an object. This happens when named and default exports are mixed in modules.
6
5
  *
7
- * In ES Modules, mixing is fine since the module resolver can distinguish
8
- * default and named exports. In transpiled modules, however, all exports are
9
- * put into a single object, and the default export is provided at a property
10
- * called `default`.
6
+ * In ES Modules, mixing is fine since the module resolver can distinguish default and named
7
+ * exports. In transpiled modules, however, all exports are put into a single object, and the
8
+ * default export is provided at a property called `default`.
11
9
  *
12
- * This helper is needed by Next.js uses CJS files with named and default
13
- * exports.
10
+ * This helper is needed by Next.js uses CJS files with named and default exports.
14
11
  *
15
- * This helper _should_ be a temporary hack until Next.js and Node.js resolve
16
- * their ESM difficulties. This will likely not be removed any time soon,
17
- * unfortunately.
12
+ * This helper _should_ be a temporary hack until Next.js and Node.js resolve their ESM
13
+ * difficulties. This will likely not be removed any time soon, unfortunately.
18
14
  */
19
15
  function resolveDefaultExport(mod) {
20
16
  return "default" in mod ? mod.default : mod;
@@ -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\n * as a `default` property on an object. This happens when named and default\n * exports are mixed in modules.\n *\n * In ES Modules, mixing is fine since the module resolver can distinguish\n * default and named exports. In transpiled modules, however, all exports are\n * put into a single object, and the default export is provided at a property\n * called `default`.\n *\n * This helper is needed by Next.js uses CJS files with named and default\n * exports.\n *\n * This helper _should_ be a temporary hack until Next.js and Node.js resolve\n * their ESM difficulties. This will likely not be removed any time soon,\n * 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":";;;;;;;;;;;;;;;;;;AAiBA,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;AAElD,QAAO,aAAc,MAAe,IAAY,UAAU"}
package/dist/package.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  //#region package.json
2
- var version = "2.2.3";
2
+ var version = "2.2.4-pr.114.37ca25f";
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.2.3";
2
+ var version = "2.2.4-pr.114.37ca25f";
3
3
  //#endregion
4
4
  export { version };
5
5
 
@@ -1,19 +1,18 @@
1
1
  const require_runtime = require("../_virtual/_rolldown/runtime.cjs");
2
+ let _prismicio_client = require("@prismicio/client");
2
3
  let next_script_js = require("next/script.js");
3
4
  next_script_js = require_runtime.__toESM(next_script_js);
4
- let _prismicio_client = require("@prismicio/client");
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");
8
8
  //#region src/pages/PrismicPreview.tsx
9
9
  /**
10
- * React component that sets up Prismic Previews using the Prismic Toolbar. When
11
- * the Prismic Toolbar send events to the browser, such as on preview updates
12
- * and exiting, this component will automatically refresh the page with the
13
- * changes.
10
+ * React component that sets up Prismic Previews using the Prismic Toolbar. When the Prismic Toolbar
11
+ * send events to the browser, such as on preview updates and exiting, this component will
12
+ * automatically refresh the page with the changes.
14
13
  *
15
- * This component can be wrapped around your app or added anywhere in your app's
16
- * tree. It must be rendered on every page.
14
+ * This component can be wrapped around your app or added anywhere in your app's tree. It must be
15
+ * rendered on every page.
17
16
  */
18
17
  const PrismicPreview = (props) => {
19
18
  const { repositoryName, updatePreviewURL = "/api/preview", exitPreviewURL = "/api/exit-preview", children } = props;
@@ -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\n\t * using this repository.\n\t */\n\trepositoryName: string;\n\n\t/**\n\t * The URL of your app's Prismic preview endpoint (default: `/api/preview`).\n\t * This URL will be fetched on preview update events.\n\t */\n\tupdatePreviewURL?: string;\n\n\t/**\n\t * The URL of your app's exit preview endpoint (default: `/api/exit-preview`).\n\t * This URL will be fetched on preview exit events.\n\t */\n\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\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 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(\n\t\t\t\twindow.location.origin + router.basePath,\n\t\t\t) &&\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\"/) ||\n\t\t[])[1];\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAuCA,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,WACpB,OAAO,SAAS,SAAS,OAAO,SAChC,IACD,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,IACvE,EAAE,EAAE"}
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"}
@@ -4,30 +4,29 @@ import { FC, ReactNode } from "react";
4
4
  /** Props for `<PrismicPreview>`. */
5
5
  type PrismicPreviewProps = {
6
6
  /**
7
- * The name of your Prismic repository. A Prismic Toolbar will be registered
8
- * using this repository.
7
+ * The name of your Prismic repository. A Prismic Toolbar will be registered using this
8
+ * repository.
9
9
  */
10
10
  repositoryName: string;
11
11
  /**
12
- * The URL of your app's Prismic preview endpoint (default: `/api/preview`).
13
- * This URL will be fetched on preview update events.
12
+ * The URL of your app's Prismic preview endpoint (default: `/api/preview`). This URL will be
13
+ * fetched on preview update events.
14
14
  */
15
15
  updatePreviewURL?: string;
16
16
  /**
17
- * The URL of your app's exit preview endpoint (default: `/api/exit-preview`).
18
- * This URL will be fetched on preview exit events.
17
+ * The URL of your app's exit preview endpoint (default: `/api/exit-preview`). This URL will be
18
+ * fetched on preview exit events.
19
19
  */
20
20
  exitPreviewURL?: string; /** Children to render adjacent to the Prismic Toolbar. */
21
21
  children?: ReactNode;
22
22
  };
23
23
  /**
24
- * React component that sets up Prismic Previews using the Prismic Toolbar. When
25
- * the Prismic Toolbar send events to the browser, such as on preview updates
26
- * and exiting, this component will automatically refresh the page with the
27
- * changes.
24
+ * React component that sets up Prismic Previews using the Prismic Toolbar. When the Prismic Toolbar
25
+ * send events to the browser, such as on preview updates and exiting, this component will
26
+ * automatically refresh the page with the changes.
28
27
  *
29
- * This component can be wrapped around your app or added anywhere in your app's
30
- * tree. It must be rendered on every page.
28
+ * This component can be wrapped around your app or added anywhere in your app's tree. It must be
29
+ * rendered on every page.
31
30
  */
32
31
  declare const PrismicPreview: FC<PrismicPreviewProps>;
33
32
  //#endregion
@@ -0,0 +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"}
@@ -4,30 +4,29 @@ import { FC, ReactNode } from "react";
4
4
  /** Props for `<PrismicPreview>`. */
5
5
  type PrismicPreviewProps = {
6
6
  /**
7
- * The name of your Prismic repository. A Prismic Toolbar will be registered
8
- * using this repository.
7
+ * The name of your Prismic repository. A Prismic Toolbar will be registered using this
8
+ * repository.
9
9
  */
10
10
  repositoryName: string;
11
11
  /**
12
- * The URL of your app's Prismic preview endpoint (default: `/api/preview`).
13
- * This URL will be fetched on preview update events.
12
+ * The URL of your app's Prismic preview endpoint (default: `/api/preview`). This URL will be
13
+ * fetched on preview update events.
14
14
  */
15
15
  updatePreviewURL?: string;
16
16
  /**
17
- * The URL of your app's exit preview endpoint (default: `/api/exit-preview`).
18
- * This URL will be fetched on preview exit events.
17
+ * The URL of your app's exit preview endpoint (default: `/api/exit-preview`). This URL will be
18
+ * fetched on preview exit events.
19
19
  */
20
20
  exitPreviewURL?: string; /** Children to render adjacent to the Prismic Toolbar. */
21
21
  children?: ReactNode;
22
22
  };
23
23
  /**
24
- * React component that sets up Prismic Previews using the Prismic Toolbar. When
25
- * the Prismic Toolbar send events to the browser, such as on preview updates
26
- * and exiting, this component will automatically refresh the page with the
27
- * changes.
24
+ * React component that sets up Prismic Previews using the Prismic Toolbar. When the Prismic Toolbar
25
+ * send events to the browser, such as on preview updates and exiting, this component will
26
+ * automatically refresh the page with the changes.
28
27
  *
29
- * This component can be wrapped around your app or added anywhere in your app's
30
- * tree. It must be rendered on every page.
28
+ * This component can be wrapped around your app or added anywhere in your app's tree. It must be
29
+ * rendered on every page.
31
30
  */
32
31
  declare const PrismicPreview: FC<PrismicPreviewProps>;
33
32
  //#endregion
@@ -0,0 +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"}