@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":"SliceSimulator.cjs","names":["SimulatorManager","StateEventType","SliceSimulatorWrapper"],"sources":["../../src/pages/SliceSimulator.tsx"],"sourcesContent":["import {\n\tSimulatorManager,\n\tStateEventType,\n\tgetDefaultMessage,\n\tgetDefaultSlices,\n} from \"@prismicio/simulator/kit\"\nimport type {\n\tSliceSimulatorProps as BaseSliceSimulatorProps,\n\tSliceSimulatorState,\n} from \"@prismicio/simulator/kit\"\nimport { useEffect, useState } from \"react\"\nimport type { ComponentType, FC } from \"react\"\n\nimport { SliceSimulatorWrapper } from \"../SliceSimulatorWrapper\"\n\nconst simulatorManager = new SimulatorManager()\n\nexport type SliceSimulatorSliceZoneProps = {\n\tslices: SliceSimulatorState[\"slices\"]\n}\n\nexport type SliceSimulatorProps = BaseSliceSimulatorProps & {\n\t/**\n\t * React component to render simulated Slices.\n\t *\n\t * @example\n\t * \t;```tsx\n\t * \timport { SliceSimulator } from \"@slicemachine/adapter-next/simulator\"\n\t * \timport { SliceZone } from \"@prismicio/react\"\n\t *\n\t * \timport { components } from \"../slices\"\n\t *\n\t * \t;<SliceSimulator\n\t * \t\tsliceZone={({ slices }) => <SliceZone slices={slices} components={components} />}\n\t * \t/>\n\t * \t```\n\t */\n\tsliceZone: ComponentType<SliceSimulatorSliceZoneProps>\n\tclassName?: string\n}\n\n/**\n * Simulate slices in isolation. The slice simulator enables live slice development in Slice Machine\n * and live previews in the Page Builder.\n */\nexport const SliceSimulator: FC<SliceSimulatorProps> = ({\n\tbackground,\n\tzIndex,\n\tclassName,\n\tsliceZone: SliceZoneComp,\n}) => {\n\tconst [slices, setSlices] = useState(() => getDefaultSlices())\n\tconst [message, setMessage] = useState(() => getDefaultMessage())\n\n\tuseEffect(() => {\n\t\tsimulatorManager.state.on(\n\t\t\tStateEventType.Slices,\n\t\t\t(_slices) => {\n\t\t\t\tsetSlices(_slices)\n\t\t\t},\n\t\t\t\"simulator-slices\",\n\t\t)\n\t\tsimulatorManager.state.on(\n\t\t\tStateEventType.Message,\n\t\t\t(_message) => {\n\t\t\t\tsetMessage(_message)\n\t\t\t},\n\t\t\t\"simulator-message\",\n\t\t)\n\n\t\tsimulatorManager.init()\n\n\t\treturn () => {\n\t\t\tsimulatorManager.state.off(StateEventType.Slices, \"simulator-slices\")\n\n\t\t\tsimulatorManager.state.off(StateEventType.Message, \"simulator-message\")\n\t\t}\n\t}, [])\n\n\treturn (\n\t\t<SliceSimulatorWrapper\n\t\t\tmessage={message}\n\t\t\thasSlices={slices.length > 0}\n\t\t\tbackground={background}\n\t\t\tzIndex={zIndex}\n\t\t\tclassName={className}\n\t\t>\n\t\t\t<SliceZoneComp slices={slices} />\n\t\t</SliceSimulatorWrapper>\n\t)\n}\n"],"mappings":";;;;;;AAeA,MAAM,mBAAmB,IAAIA,yBAAAA,kBAAkB;;;;;AA8B/C,MAAa,kBAA2C,EACvD,YACA,QACA,WACA,WAAW,oBACN;CACL,MAAM,CAAC,QAAQ,cAAA,GAAA,MAAA,iBAAA,GAAA,yBAAA,mBAA8C,CAAC;CAC9D,MAAM,CAAC,SAAS,eAAA,GAAA,MAAA,iBAAA,GAAA,yBAAA,oBAAgD,CAAC;AAEjE,EAAA,GAAA,MAAA,iBAAgB;AACf,mBAAiB,MAAM,GACtBC,yBAAAA,eAAe,SACd,YAAY;AACZ,aAAU,QAAQ;KAEnB,mBACA;AACD,mBAAiB,MAAM,GACtBA,yBAAAA,eAAe,UACd,aAAa;AACb,cAAW,SAAS;KAErB,oBACA;AAED,mBAAiB,MAAM;AAEvB,eAAa;AACZ,oBAAiB,MAAM,IAAIA,yBAAAA,eAAe,QAAQ,mBAAmB;AAErE,oBAAiB,MAAM,IAAIA,yBAAAA,eAAe,SAAS,oBAAoB;;IAEtE,EAAE,CAAC;AAEN,QACC,iBAAA,GAAA,kBAAA,KAACC,8BAAAA,uBAAD;EACU;EACT,WAAW,OAAO,SAAS;EACf;EACJ;EACG;YAEX,iBAAA,GAAA,kBAAA,KAAC,eAAD,EAAuB,QAAU,CAAA;EACV,CAAA"}
1
+ {"version":3,"file":"SliceSimulator.cjs","names":["SimulatorManager","useState","getDefaultSlices","getDefaultMessage","StateEventType","SliceSimulatorWrapper"],"sources":["../../src/pages/SliceSimulator.tsx"],"sourcesContent":["import {\n\tSimulatorManager,\n\tStateEventType,\n\tgetDefaultMessage,\n\tgetDefaultSlices,\n} from \"@prismicio/simulator/kit\"\nimport type {\n\tSliceSimulatorProps as BaseSliceSimulatorProps,\n\tSliceSimulatorState,\n} from \"@prismicio/simulator/kit\"\nimport { useEffect, useState } from \"react\"\nimport type { ComponentType, FC } from \"react\"\n\nimport { SliceSimulatorWrapper } from \"../SliceSimulatorWrapper\"\n\nconst simulatorManager = new SimulatorManager()\n\nexport type SliceSimulatorSliceZoneProps = {\n\tslices: SliceSimulatorState[\"slices\"]\n}\n\nexport type SliceSimulatorProps = BaseSliceSimulatorProps & {\n\t/**\n\t * React component to render simulated Slices.\n\t *\n\t * @example\n\t * \t;```tsx\n\t * \timport { SliceSimulator } from \"@slicemachine/adapter-next/simulator\"\n\t * \timport { SliceZone } from \"@prismicio/react\"\n\t *\n\t * \timport { components } from \"../slices\"\n\t *\n\t * \t;<SliceSimulator\n\t * \t\tsliceZone={({ slices }) => <SliceZone slices={slices} components={components} />}\n\t * \t/>\n\t * \t```\n\t */\n\tsliceZone: ComponentType<SliceSimulatorSliceZoneProps>\n\tclassName?: string\n}\n\n/**\n * Simulate slices in isolation. The slice simulator enables live slice development in Slice Machine\n * and live previews in the Page Builder.\n */\nexport const SliceSimulator: FC<SliceSimulatorProps> = ({\n\tbackground,\n\tzIndex,\n\tclassName,\n\tsliceZone: SliceZoneComp,\n}) => {\n\tconst [slices, setSlices] = useState(() => getDefaultSlices())\n\tconst [message, setMessage] = useState(() => getDefaultMessage())\n\n\tuseEffect(() => {\n\t\tsimulatorManager.state.on(\n\t\t\tStateEventType.Slices,\n\t\t\t(_slices) => {\n\t\t\t\tsetSlices(_slices)\n\t\t\t},\n\t\t\t\"simulator-slices\",\n\t\t)\n\t\tsimulatorManager.state.on(\n\t\t\tStateEventType.Message,\n\t\t\t(_message) => {\n\t\t\t\tsetMessage(_message)\n\t\t\t},\n\t\t\t\"simulator-message\",\n\t\t)\n\n\t\tsimulatorManager.init()\n\n\t\treturn () => {\n\t\t\tsimulatorManager.state.off(StateEventType.Slices, \"simulator-slices\")\n\n\t\t\tsimulatorManager.state.off(StateEventType.Message, \"simulator-message\")\n\t\t}\n\t}, [])\n\n\treturn (\n\t\t<SliceSimulatorWrapper\n\t\t\tmessage={message}\n\t\t\thasSlices={slices.length > 0}\n\t\t\tbackground={background}\n\t\t\tzIndex={zIndex}\n\t\t\tclassName={className}\n\t\t>\n\t\t\t<SliceZoneComp slices={slices} />\n\t\t</SliceSimulatorWrapper>\n\t)\n}\n"],"mappings":";;;;;AAeA,MAAM,mBAAmB,IAAIA,yBAAAA,iBAAiB;;;;;AA8B9C,MAAa,kBAA2C,EACvD,YACA,QACA,WACA,WAAW,oBACN;CACL,MAAM,CAAC,QAAQ,cAAA,GAAaC,MAAAA,SAAAA,QAAAA,GAAeC,yBAAAA,iBAAAA,CAAiB,CAAC;CAC7D,MAAM,CAAC,SAAS,eAAA,GAAcD,MAAAA,SAAAA,QAAAA,GAAeE,yBAAAA,kBAAAA,CAAkB,CAAC;CAEhE,CAAA,GAAA,MAAA,UAAA,OAAgB;EACf,iBAAiB,MAAM,GACtBC,yBAAAA,eAAe,SACd,YAAY;GACZ,UAAU,OAAO;EAClB,GACA,kBACD;EACA,iBAAiB,MAAM,GACtBA,yBAAAA,eAAe,UACd,aAAa;GACb,WAAW,QAAQ;EACpB,GACA,mBACD;EAEA,iBAAiB,KAAK;EAEtB,aAAa;GACZ,iBAAiB,MAAM,IAAIA,yBAAAA,eAAe,QAAQ,kBAAkB;GAEpE,iBAAiB,MAAM,IAAIA,yBAAAA,eAAe,SAAS,mBAAmB;EACvE;CACD,GAAG,CAAC,CAAC;CAEL,OACC,iBAAA,GAAA,kBAAA,IAAA,CAACC,8BAAAA,uBAAD;EACU;EACT,WAAW,OAAO,SAAS;EACf;EACJ;EACG;EAEX,UAAA,iBAAA,GAAA,kBAAA,IAAA,CAAC,eAAD,EAAuB,OAAS,CAAA;CACV,CAAA;AAEzB"}
@@ -1,8 +1,7 @@
1
1
  import { ComponentType, FC } from "react";
2
2
  import { SliceSimulatorProps, SliceSimulatorState } from "@prismicio/simulator/kit";
3
-
4
3
  //#region src/pages/SliceSimulator.d.ts
5
- type SliceSimulatorSliceZoneProps = {
4
+ export type SliceSimulatorSliceZoneProps = {
6
5
  slices: SliceSimulatorState["slices"];
7
6
  };
8
7
  type SliceSimulatorProps$1 = SliceSimulatorProps & {
@@ -28,7 +27,7 @@ type SliceSimulatorProps$1 = SliceSimulatorProps & {
28
27
  * Simulate slices in isolation. The slice simulator enables live slice development in Slice Machine
29
28
  * and live previews in the Page Builder.
30
29
  */
31
- declare const SliceSimulator: FC<SliceSimulatorProps$1>;
30
+ export declare const SliceSimulator: FC<SliceSimulatorProps$1>;
32
31
  //#endregion
33
- export { SliceSimulator, SliceSimulatorProps$1 as SliceSimulatorProps, SliceSimulatorSliceZoneProps };
32
+ export { SliceSimulatorProps$1 as SliceSimulatorProps };
34
33
  //# sourceMappingURL=SliceSimulator.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"SliceSimulator.d.cts","names":[],"sources":["../../src/pages/SliceSimulator.tsx"],"mappings":";;;;KAiBY,4BAAA;EACX,MAAA,EAAQ,mBAAA;AAAA;AAAA,KAGG,qBAAA,GAAsB,mBAAA;;;;AAAlC;;;;;;;;;;;;EAgBC,SAAA,EAAW,aAAA,CAAc,4BAAA;EACzB,SAAA;AAAA;AAOD;;;;AAAA,cAAa,cAAA,EAAgB,EAAA,CAAG,qBAAA"}
1
+ {"version":3,"file":"SliceSimulator.d.cts","names":[],"sources":["../../src/pages/SliceSimulator.tsx"],"mappings":";;;YAiBY;EACX,QAAQ;;KAGG,wBAAsB;;;;;;;;;;;;;;;;EAgBjC,WAAW,cAAc;EACzB;;;;;;qBAOY,gBAAgB,GAAG"}
@@ -1,8 +1,7 @@
1
1
  import { ComponentType, FC } from "react";
2
2
  import { SliceSimulatorProps, SliceSimulatorState } from "@prismicio/simulator/kit";
3
-
4
3
  //#region src/pages/SliceSimulator.d.ts
5
- type SliceSimulatorSliceZoneProps = {
4
+ export type SliceSimulatorSliceZoneProps = {
6
5
  slices: SliceSimulatorState["slices"];
7
6
  };
8
7
  type SliceSimulatorProps$1 = SliceSimulatorProps & {
@@ -28,7 +27,7 @@ type SliceSimulatorProps$1 = SliceSimulatorProps & {
28
27
  * Simulate slices in isolation. The slice simulator enables live slice development in Slice Machine
29
28
  * and live previews in the Page Builder.
30
29
  */
31
- declare const SliceSimulator: FC<SliceSimulatorProps$1>;
30
+ export declare const SliceSimulator: FC<SliceSimulatorProps$1>;
32
31
  //#endregion
33
- export { SliceSimulator, SliceSimulatorProps$1 as SliceSimulatorProps, SliceSimulatorSliceZoneProps };
32
+ export { SliceSimulatorProps$1 as SliceSimulatorProps };
34
33
  //# sourceMappingURL=SliceSimulator.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"SliceSimulator.d.ts","names":[],"sources":["../../src/pages/SliceSimulator.tsx"],"mappings":";;;;KAiBY,4BAAA;EACX,MAAA,EAAQ,mBAAA;AAAA;AAAA,KAGG,qBAAA,GAAsB,mBAAA;;;;AAAlC;;;;;;;;;;;;EAgBC,SAAA,EAAW,aAAA,CAAc,4BAAA;EACzB,SAAA;AAAA;AAOD;;;;AAAA,cAAa,cAAA,EAAgB,EAAA,CAAG,qBAAA"}
1
+ {"version":3,"file":"SliceSimulator.d.ts","names":[],"sources":["../../src/pages/SliceSimulator.tsx"],"mappings":";;;YAiBY;EACX,QAAQ;;KAGG,wBAAsB;;;;;;;;;;;;;;;;EAgBjC,WAAW,cAAc;EACzB;;;;;;qBAOY,gBAAgB,GAAG"}
@@ -1 +1 @@
1
- {"version":3,"file":"SliceSimulator.js","names":[],"sources":["../../src/pages/SliceSimulator.tsx"],"sourcesContent":["import {\n\tSimulatorManager,\n\tStateEventType,\n\tgetDefaultMessage,\n\tgetDefaultSlices,\n} from \"@prismicio/simulator/kit\"\nimport type {\n\tSliceSimulatorProps as BaseSliceSimulatorProps,\n\tSliceSimulatorState,\n} from \"@prismicio/simulator/kit\"\nimport { useEffect, useState } from \"react\"\nimport type { ComponentType, FC } from \"react\"\n\nimport { SliceSimulatorWrapper } from \"../SliceSimulatorWrapper\"\n\nconst simulatorManager = new SimulatorManager()\n\nexport type SliceSimulatorSliceZoneProps = {\n\tslices: SliceSimulatorState[\"slices\"]\n}\n\nexport type SliceSimulatorProps = BaseSliceSimulatorProps & {\n\t/**\n\t * React component to render simulated Slices.\n\t *\n\t * @example\n\t * \t;```tsx\n\t * \timport { SliceSimulator } from \"@slicemachine/adapter-next/simulator\"\n\t * \timport { SliceZone } from \"@prismicio/react\"\n\t *\n\t * \timport { components } from \"../slices\"\n\t *\n\t * \t;<SliceSimulator\n\t * \t\tsliceZone={({ slices }) => <SliceZone slices={slices} components={components} />}\n\t * \t/>\n\t * \t```\n\t */\n\tsliceZone: ComponentType<SliceSimulatorSliceZoneProps>\n\tclassName?: string\n}\n\n/**\n * Simulate slices in isolation. The slice simulator enables live slice development in Slice Machine\n * and live previews in the Page Builder.\n */\nexport const SliceSimulator: FC<SliceSimulatorProps> = ({\n\tbackground,\n\tzIndex,\n\tclassName,\n\tsliceZone: SliceZoneComp,\n}) => {\n\tconst [slices, setSlices] = useState(() => getDefaultSlices())\n\tconst [message, setMessage] = useState(() => getDefaultMessage())\n\n\tuseEffect(() => {\n\t\tsimulatorManager.state.on(\n\t\t\tStateEventType.Slices,\n\t\t\t(_slices) => {\n\t\t\t\tsetSlices(_slices)\n\t\t\t},\n\t\t\t\"simulator-slices\",\n\t\t)\n\t\tsimulatorManager.state.on(\n\t\t\tStateEventType.Message,\n\t\t\t(_message) => {\n\t\t\t\tsetMessage(_message)\n\t\t\t},\n\t\t\t\"simulator-message\",\n\t\t)\n\n\t\tsimulatorManager.init()\n\n\t\treturn () => {\n\t\t\tsimulatorManager.state.off(StateEventType.Slices, \"simulator-slices\")\n\n\t\t\tsimulatorManager.state.off(StateEventType.Message, \"simulator-message\")\n\t\t}\n\t}, [])\n\n\treturn (\n\t\t<SliceSimulatorWrapper\n\t\t\tmessage={message}\n\t\t\thasSlices={slices.length > 0}\n\t\t\tbackground={background}\n\t\t\tzIndex={zIndex}\n\t\t\tclassName={className}\n\t\t>\n\t\t\t<SliceZoneComp slices={slices} />\n\t\t</SliceSimulatorWrapper>\n\t)\n}\n"],"mappings":";;;;;AAeA,MAAM,mBAAmB,IAAI,kBAAkB;;;;;AA8B/C,MAAa,kBAA2C,EACvD,YACA,QACA,WACA,WAAW,oBACN;CACL,MAAM,CAAC,QAAQ,aAAa,eAAe,kBAAkB,CAAC;CAC9D,MAAM,CAAC,SAAS,cAAc,eAAe,mBAAmB,CAAC;AAEjE,iBAAgB;AACf,mBAAiB,MAAM,GACtB,eAAe,SACd,YAAY;AACZ,aAAU,QAAQ;KAEnB,mBACA;AACD,mBAAiB,MAAM,GACtB,eAAe,UACd,aAAa;AACb,cAAW,SAAS;KAErB,oBACA;AAED,mBAAiB,MAAM;AAEvB,eAAa;AACZ,oBAAiB,MAAM,IAAI,eAAe,QAAQ,mBAAmB;AAErE,oBAAiB,MAAM,IAAI,eAAe,SAAS,oBAAoB;;IAEtE,EAAE,CAAC;AAEN,QACC,oBAAC,uBAAD;EACU;EACT,WAAW,OAAO,SAAS;EACf;EACJ;EACG;YAEX,oBAAC,eAAD,EAAuB,QAAU,CAAA;EACV,CAAA"}
1
+ {"version":3,"file":"SliceSimulator.js","names":[],"sources":["../../src/pages/SliceSimulator.tsx"],"sourcesContent":["import {\n\tSimulatorManager,\n\tStateEventType,\n\tgetDefaultMessage,\n\tgetDefaultSlices,\n} from \"@prismicio/simulator/kit\"\nimport type {\n\tSliceSimulatorProps as BaseSliceSimulatorProps,\n\tSliceSimulatorState,\n} from \"@prismicio/simulator/kit\"\nimport { useEffect, useState } from \"react\"\nimport type { ComponentType, FC } from \"react\"\n\nimport { SliceSimulatorWrapper } from \"../SliceSimulatorWrapper\"\n\nconst simulatorManager = new SimulatorManager()\n\nexport type SliceSimulatorSliceZoneProps = {\n\tslices: SliceSimulatorState[\"slices\"]\n}\n\nexport type SliceSimulatorProps = BaseSliceSimulatorProps & {\n\t/**\n\t * React component to render simulated Slices.\n\t *\n\t * @example\n\t * \t;```tsx\n\t * \timport { SliceSimulator } from \"@slicemachine/adapter-next/simulator\"\n\t * \timport { SliceZone } from \"@prismicio/react\"\n\t *\n\t * \timport { components } from \"../slices\"\n\t *\n\t * \t;<SliceSimulator\n\t * \t\tsliceZone={({ slices }) => <SliceZone slices={slices} components={components} />}\n\t * \t/>\n\t * \t```\n\t */\n\tsliceZone: ComponentType<SliceSimulatorSliceZoneProps>\n\tclassName?: string\n}\n\n/**\n * Simulate slices in isolation. The slice simulator enables live slice development in Slice Machine\n * and live previews in the Page Builder.\n */\nexport const SliceSimulator: FC<SliceSimulatorProps> = ({\n\tbackground,\n\tzIndex,\n\tclassName,\n\tsliceZone: SliceZoneComp,\n}) => {\n\tconst [slices, setSlices] = useState(() => getDefaultSlices())\n\tconst [message, setMessage] = useState(() => getDefaultMessage())\n\n\tuseEffect(() => {\n\t\tsimulatorManager.state.on(\n\t\t\tStateEventType.Slices,\n\t\t\t(_slices) => {\n\t\t\t\tsetSlices(_slices)\n\t\t\t},\n\t\t\t\"simulator-slices\",\n\t\t)\n\t\tsimulatorManager.state.on(\n\t\t\tStateEventType.Message,\n\t\t\t(_message) => {\n\t\t\t\tsetMessage(_message)\n\t\t\t},\n\t\t\t\"simulator-message\",\n\t\t)\n\n\t\tsimulatorManager.init()\n\n\t\treturn () => {\n\t\t\tsimulatorManager.state.off(StateEventType.Slices, \"simulator-slices\")\n\n\t\t\tsimulatorManager.state.off(StateEventType.Message, \"simulator-message\")\n\t\t}\n\t}, [])\n\n\treturn (\n\t\t<SliceSimulatorWrapper\n\t\t\tmessage={message}\n\t\t\thasSlices={slices.length > 0}\n\t\t\tbackground={background}\n\t\t\tzIndex={zIndex}\n\t\t\tclassName={className}\n\t\t>\n\t\t\t<SliceZoneComp slices={slices} />\n\t\t</SliceSimulatorWrapper>\n\t)\n}\n"],"mappings":";;;;;AAeA,MAAM,mBAAmB,IAAI,iBAAiB;;;;;AA8B9C,MAAa,kBAA2C,EACvD,YACA,QACA,WACA,WAAW,oBACN;CACL,MAAM,CAAC,QAAQ,aAAa,eAAe,iBAAiB,CAAC;CAC7D,MAAM,CAAC,SAAS,cAAc,eAAe,kBAAkB,CAAC;CAEhE,gBAAgB;EACf,iBAAiB,MAAM,GACtB,eAAe,SACd,YAAY;GACZ,UAAU,OAAO;EAClB,GACA,kBACD;EACA,iBAAiB,MAAM,GACtB,eAAe,UACd,aAAa;GACb,WAAW,QAAQ;EACpB,GACA,mBACD;EAEA,iBAAiB,KAAK;EAEtB,aAAa;GACZ,iBAAiB,MAAM,IAAI,eAAe,QAAQ,kBAAkB;GAEpE,iBAAiB,MAAM,IAAI,eAAe,SAAS,mBAAmB;EACvE;CACD,GAAG,CAAC,CAAC;CAEL,OACC,oBAAC,uBAAD;EACU;EACT,WAAW,OAAO,SAAS;EACf;EACJ;EACG;EAEX,UAAA,oBAAC,eAAD,EAAuB,OAAS,CAAA;CACV,CAAA;AAEzB"}
@@ -1 +1 @@
1
- {"version":3,"file":"enableAutoPreviews.cjs","names":[],"sources":["../../src/pages/enableAutoPreviews.ts"],"sourcesContent":["import type { Client } from \"@prismicio/client\"\nimport type { PreviewData } from \"next\"\n\nimport type { NextApiRequestLike } from \"./types\"\n\n/**\n * Configuration for `enableAutoPreviews`.\n *\n * @typeParam TPreviewData - Next.js preview data object.\n */\nexport type EnableAutoPreviewsConfig = {\n\t/** Prismic client with which automatic previews will be enabled. */\n\t// `Pick` is used to use the smallest possible subset of\n\t// `prismic.Client`. Doing this reduces the surface area for breaking\n\t// type changes.\n\tclient: Pick<Client, \"queryContentFromRef\" | \"enableAutoPreviewsFromReq\">\n\n\t/**\n\t * The `previewData` object provided in the `getStaticProps()` or `getServerSideProps()` context\n\t * object.\n\t */\n\tpreviewData?: PreviewData\n\n\t/**\n\t * The `req` object from a Next.js API route.\n\t *\n\t * @see Next.js API route docs: \\<https://nextjs.org/docs/api-routes/introduction\\>\n\t */\n\treq?: NextApiRequestLike\n}\n\n/**\n * Configures a Prismic client to automatically query draft content during a preview session. It\n * either takes in a Next.js `getStaticProps` context object or a Next.js API endpoint request\n * object.\n *\n * @param config - Configuration for the function.\n */\nexport function enableAutoPreviews(config: EnableAutoPreviewsConfig): void {\n\tif (\"previewData\" in config && config.previewData) {\n\t\t// Assume we are in `getStaticProps()` or\n\t\t// `getServerSideProps()` with active Preview Mode.\n\n\t\tif (isPrismicPreviewData(config.previewData)) {\n\t\t\tconfig.client.queryContentFromRef(config.previewData.ref)\n\t\t}\n\n\t\treturn\n\t}\n\n\tif (\"req\" in config && config.req) {\n\t\t// Assume we are in an API Route.\n\n\t\tconfig.client.enableAutoPreviewsFromReq(config.req)\n\n\t\treturn\n\t}\n}\n\nfunction isPrismicPreviewData(input: unknown): input is { ref: string } {\n\treturn typeof input === \"object\" && input !== null && \"ref\" in input\n}\n"],"mappings":";;;;;;;;AAsCA,SAAgB,mBAAmB,QAAwC;AAC1E,KAAI,iBAAiB,UAAU,OAAO,aAAa;AAIlD,MAAI,qBAAqB,OAAO,YAAY,CAC3C,QAAO,OAAO,oBAAoB,OAAO,YAAY,IAAI;AAG1D;;AAGD,KAAI,SAAS,UAAU,OAAO,KAAK;AAGlC,SAAO,OAAO,0BAA0B,OAAO,IAAI;AAEnD;;;AAIF,SAAS,qBAAqB,OAA0C;AACvE,QAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,SAAS"}
1
+ {"version":3,"file":"enableAutoPreviews.cjs","names":[],"sources":["../../src/pages/enableAutoPreviews.ts"],"sourcesContent":["import type { Client } from \"@prismicio/client\"\nimport type { PreviewData } from \"next\"\n\nimport type { NextApiRequestLike } from \"./types\"\n\n/**\n * Configuration for `enableAutoPreviews`.\n *\n * @typeParam TPreviewData - Next.js preview data object.\n */\nexport type EnableAutoPreviewsConfig = {\n\t/** Prismic client with which automatic previews will be enabled. */\n\t// `Pick` is used to use the smallest possible subset of\n\t// `prismic.Client`. Doing this reduces the surface area for breaking\n\t// type changes.\n\tclient: Pick<Client, \"queryContentFromRef\" | \"enableAutoPreviewsFromReq\">\n\n\t/**\n\t * The `previewData` object provided in the `getStaticProps()` or `getServerSideProps()` context\n\t * object.\n\t */\n\tpreviewData?: PreviewData\n\n\t/**\n\t * The `req` object from a Next.js API route.\n\t *\n\t * @see Next.js API route docs: \\<https://nextjs.org/docs/api-routes/introduction\\>\n\t */\n\treq?: NextApiRequestLike\n}\n\n/**\n * Configures a Prismic client to automatically query draft content during a preview session. It\n * either takes in a Next.js `getStaticProps` context object or a Next.js API endpoint request\n * object.\n *\n * @param config - Configuration for the function.\n */\nexport function enableAutoPreviews(config: EnableAutoPreviewsConfig): void {\n\tif (\"previewData\" in config && config.previewData) {\n\t\t// Assume we are in `getStaticProps()` or\n\t\t// `getServerSideProps()` with active Preview Mode.\n\n\t\tif (isPrismicPreviewData(config.previewData)) {\n\t\t\tconfig.client.queryContentFromRef(config.previewData.ref)\n\t\t}\n\n\t\treturn\n\t}\n\n\tif (\"req\" in config && config.req) {\n\t\t// Assume we are in an API Route.\n\n\t\tconfig.client.enableAutoPreviewsFromReq(config.req)\n\n\t\treturn\n\t}\n}\n\nfunction isPrismicPreviewData(input: unknown): input is { ref: string } {\n\treturn typeof input === \"object\" && input !== null && \"ref\" in input\n}\n"],"mappings":";;;;;;;;AAsCA,SAAgB,mBAAmB,QAAwC;CAC1E,IAAI,iBAAiB,UAAU,OAAO,aAAa;EAIlD,IAAI,qBAAqB,OAAO,WAAW,GAC1C,OAAO,OAAO,oBAAoB,OAAO,YAAY,GAAG;EAGzD;CACD;CAEA,IAAI,SAAS,UAAU,OAAO,KAAK;EAGlC,OAAO,OAAO,0BAA0B,OAAO,GAAG;EAElD;CACD;AACD;AAEA,SAAS,qBAAqB,OAA0C;CACvE,OAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,SAAS;AAChE"}
@@ -1,15 +1,15 @@
1
1
  import { NextApiRequestLike } from "./types.cjs";
2
2
  import { Client } from "@prismicio/client";
3
3
  import { PreviewData } from "next";
4
-
5
4
  //#region src/pages/enableAutoPreviews.d.ts
6
5
  /**
7
6
  * Configuration for `enableAutoPreviews`.
8
7
  *
9
8
  * @typeParam TPreviewData - Next.js preview data object.
10
9
  */
11
- type EnableAutoPreviewsConfig = {
12
- /** Prismic client with which automatic previews will be enabled. */client: Pick<Client, "queryContentFromRef" | "enableAutoPreviewsFromReq">;
10
+ export type EnableAutoPreviewsConfig = {
11
+ /** Prismic client with which automatic previews will be enabled. */
12
+ client: Pick<Client, "queryContentFromRef" | "enableAutoPreviewsFromReq">;
13
13
  /**
14
14
  * The `previewData` object provided in the `getStaticProps()` or `getServerSideProps()` context
15
15
  * object.
@@ -29,7 +29,6 @@ type EnableAutoPreviewsConfig = {
29
29
  *
30
30
  * @param config - Configuration for the function.
31
31
  */
32
- declare function enableAutoPreviews(config: EnableAutoPreviewsConfig): void;
32
+ export declare function enableAutoPreviews(config: EnableAutoPreviewsConfig): void;
33
33
  //#endregion
34
- export { EnableAutoPreviewsConfig, enableAutoPreviews };
35
34
  //# sourceMappingURL=enableAutoPreviews.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"enableAutoPreviews.d.cts","names":[],"sources":["../../src/pages/enableAutoPreviews.ts"],"mappings":";;;;;;;AAUA;;;KAAY,wBAAA;EAKH,oEAAR,MAAA,EAAQ,IAAA,CAAK,MAAA;EAaP;;;;EAPN,WAAA,GAAc,WAAA;EAND;;;;;EAab,GAAA,GAAM,kBAAA;AAAA;AAUP;;;;;;;AAAA,iBAAgB,kBAAA,CAAmB,MAAA,EAAQ,wBAAA"}
1
+ {"version":3,"file":"enableAutoPreviews.d.cts","names":[],"sources":["../../src/pages/enableAutoPreviews.ts"],"mappings":";;;;;;;;;YAUY;;EAKX,QAAQ,KAAK;;;;;EAMb,cAAc;;;;;;EAOd,MAAM;;;;;;;;;wBAUS,mBAAmB,QAAQ"}
@@ -1,15 +1,15 @@
1
1
  import { NextApiRequestLike } from "./types.js";
2
2
  import { Client } from "@prismicio/client";
3
3
  import { PreviewData } from "next";
4
-
5
4
  //#region src/pages/enableAutoPreviews.d.ts
6
5
  /**
7
6
  * Configuration for `enableAutoPreviews`.
8
7
  *
9
8
  * @typeParam TPreviewData - Next.js preview data object.
10
9
  */
11
- type EnableAutoPreviewsConfig = {
12
- /** Prismic client with which automatic previews will be enabled. */client: Pick<Client, "queryContentFromRef" | "enableAutoPreviewsFromReq">;
10
+ export type EnableAutoPreviewsConfig = {
11
+ /** Prismic client with which automatic previews will be enabled. */
12
+ client: Pick<Client, "queryContentFromRef" | "enableAutoPreviewsFromReq">;
13
13
  /**
14
14
  * The `previewData` object provided in the `getStaticProps()` or `getServerSideProps()` context
15
15
  * object.
@@ -29,7 +29,6 @@ type EnableAutoPreviewsConfig = {
29
29
  *
30
30
  * @param config - Configuration for the function.
31
31
  */
32
- declare function enableAutoPreviews(config: EnableAutoPreviewsConfig): void;
32
+ export declare function enableAutoPreviews(config: EnableAutoPreviewsConfig): void;
33
33
  //#endregion
34
- export { EnableAutoPreviewsConfig, enableAutoPreviews };
35
34
  //# sourceMappingURL=enableAutoPreviews.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"enableAutoPreviews.d.ts","names":[],"sources":["../../src/pages/enableAutoPreviews.ts"],"mappings":";;;;;;;AAUA;;;KAAY,wBAAA;EAKH,oEAAR,MAAA,EAAQ,IAAA,CAAK,MAAA;EAaP;;;;EAPN,WAAA,GAAc,WAAA;EAND;;;;;EAab,GAAA,GAAM,kBAAA;AAAA;AAUP;;;;;;;AAAA,iBAAgB,kBAAA,CAAmB,MAAA,EAAQ,wBAAA"}
1
+ {"version":3,"file":"enableAutoPreviews.d.ts","names":[],"sources":["../../src/pages/enableAutoPreviews.ts"],"mappings":";;;;;;;;;YAUY;;EAKX,QAAQ,KAAK;;;;;EAMb,cAAc;;;;;;EAOd,MAAM;;;;;;;;;wBAUS,mBAAmB,QAAQ"}
@@ -1 +1 @@
1
- {"version":3,"file":"enableAutoPreviews.js","names":[],"sources":["../../src/pages/enableAutoPreviews.ts"],"sourcesContent":["import type { Client } from \"@prismicio/client\"\nimport type { PreviewData } from \"next\"\n\nimport type { NextApiRequestLike } from \"./types\"\n\n/**\n * Configuration for `enableAutoPreviews`.\n *\n * @typeParam TPreviewData - Next.js preview data object.\n */\nexport type EnableAutoPreviewsConfig = {\n\t/** Prismic client with which automatic previews will be enabled. */\n\t// `Pick` is used to use the smallest possible subset of\n\t// `prismic.Client`. Doing this reduces the surface area for breaking\n\t// type changes.\n\tclient: Pick<Client, \"queryContentFromRef\" | \"enableAutoPreviewsFromReq\">\n\n\t/**\n\t * The `previewData` object provided in the `getStaticProps()` or `getServerSideProps()` context\n\t * object.\n\t */\n\tpreviewData?: PreviewData\n\n\t/**\n\t * The `req` object from a Next.js API route.\n\t *\n\t * @see Next.js API route docs: \\<https://nextjs.org/docs/api-routes/introduction\\>\n\t */\n\treq?: NextApiRequestLike\n}\n\n/**\n * Configures a Prismic client to automatically query draft content during a preview session. It\n * either takes in a Next.js `getStaticProps` context object or a Next.js API endpoint request\n * object.\n *\n * @param config - Configuration for the function.\n */\nexport function enableAutoPreviews(config: EnableAutoPreviewsConfig): void {\n\tif (\"previewData\" in config && config.previewData) {\n\t\t// Assume we are in `getStaticProps()` or\n\t\t// `getServerSideProps()` with active Preview Mode.\n\n\t\tif (isPrismicPreviewData(config.previewData)) {\n\t\t\tconfig.client.queryContentFromRef(config.previewData.ref)\n\t\t}\n\n\t\treturn\n\t}\n\n\tif (\"req\" in config && config.req) {\n\t\t// Assume we are in an API Route.\n\n\t\tconfig.client.enableAutoPreviewsFromReq(config.req)\n\n\t\treturn\n\t}\n}\n\nfunction isPrismicPreviewData(input: unknown): input is { ref: string } {\n\treturn typeof input === \"object\" && input !== null && \"ref\" in input\n}\n"],"mappings":";;;;;;;;AAsCA,SAAgB,mBAAmB,QAAwC;AAC1E,KAAI,iBAAiB,UAAU,OAAO,aAAa;AAIlD,MAAI,qBAAqB,OAAO,YAAY,CAC3C,QAAO,OAAO,oBAAoB,OAAO,YAAY,IAAI;AAG1D;;AAGD,KAAI,SAAS,UAAU,OAAO,KAAK;AAGlC,SAAO,OAAO,0BAA0B,OAAO,IAAI;AAEnD;;;AAIF,SAAS,qBAAqB,OAA0C;AACvE,QAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,SAAS"}
1
+ {"version":3,"file":"enableAutoPreviews.js","names":[],"sources":["../../src/pages/enableAutoPreviews.ts"],"sourcesContent":["import type { Client } from \"@prismicio/client\"\nimport type { PreviewData } from \"next\"\n\nimport type { NextApiRequestLike } from \"./types\"\n\n/**\n * Configuration for `enableAutoPreviews`.\n *\n * @typeParam TPreviewData - Next.js preview data object.\n */\nexport type EnableAutoPreviewsConfig = {\n\t/** Prismic client with which automatic previews will be enabled. */\n\t// `Pick` is used to use the smallest possible subset of\n\t// `prismic.Client`. Doing this reduces the surface area for breaking\n\t// type changes.\n\tclient: Pick<Client, \"queryContentFromRef\" | \"enableAutoPreviewsFromReq\">\n\n\t/**\n\t * The `previewData` object provided in the `getStaticProps()` or `getServerSideProps()` context\n\t * object.\n\t */\n\tpreviewData?: PreviewData\n\n\t/**\n\t * The `req` object from a Next.js API route.\n\t *\n\t * @see Next.js API route docs: \\<https://nextjs.org/docs/api-routes/introduction\\>\n\t */\n\treq?: NextApiRequestLike\n}\n\n/**\n * Configures a Prismic client to automatically query draft content during a preview session. It\n * either takes in a Next.js `getStaticProps` context object or a Next.js API endpoint request\n * object.\n *\n * @param config - Configuration for the function.\n */\nexport function enableAutoPreviews(config: EnableAutoPreviewsConfig): void {\n\tif (\"previewData\" in config && config.previewData) {\n\t\t// Assume we are in `getStaticProps()` or\n\t\t// `getServerSideProps()` with active Preview Mode.\n\n\t\tif (isPrismicPreviewData(config.previewData)) {\n\t\t\tconfig.client.queryContentFromRef(config.previewData.ref)\n\t\t}\n\n\t\treturn\n\t}\n\n\tif (\"req\" in config && config.req) {\n\t\t// Assume we are in an API Route.\n\n\t\tconfig.client.enableAutoPreviewsFromReq(config.req)\n\n\t\treturn\n\t}\n}\n\nfunction isPrismicPreviewData(input: unknown): input is { ref: string } {\n\treturn typeof input === \"object\" && input !== null && \"ref\" in input\n}\n"],"mappings":";;;;;;;;AAsCA,SAAgB,mBAAmB,QAAwC;CAC1E,IAAI,iBAAiB,UAAU,OAAO,aAAa;EAIlD,IAAI,qBAAqB,OAAO,WAAW,GAC1C,OAAO,OAAO,oBAAoB,OAAO,YAAY,GAAG;EAGzD;CACD;CAEA,IAAI,SAAS,UAAU,OAAO,KAAK;EAGlC,OAAO,OAAO,0BAA0B,OAAO,GAAG;EAElD;CACD;AACD;AAEA,SAAS,qBAAqB,OAA0C;CACvE,OAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,SAAS;AAChE"}
@@ -1 +1 @@
1
- {"version":3,"file":"exitPreview.cjs","names":[],"sources":["../../src/pages/exitPreview.ts"],"sourcesContent":["import type { NextApiRequestLike, NextApiResponseLike } from \"./types\"\n\n/** Configuration for `exitPreview()`. */\nexport type ExitPreviewAPIRouteConfig = {\n\t/**\n\t * The `req` object from a Next.js API route.\n\t *\n\t * @see Next.js API route docs: \\<https://nextjs.org/docs/api-routes/introduction\\>\n\t */\n\treq?: NextApiRequestLike\n\n\t/**\n\t * The `res` object from a Next.js API route.\n\t *\n\t * @see Next.js API route docs: \\<https://nextjs.org/docs/api-routes/introduction\\>\n\t */\n\tres: NextApiResponseLike\n}\n\n/**\n * Ends a Prismic preview session within a Next.js app. This function should be used in an API\n * route.\n *\n * @example\n * \t;```typescript\n * \t// src/pages/api/exit-preview.js\n *\n * \timport { exitPreview } from \"@prismicio/next\"\n *\n * \texport default function handler(_req, res) {\n * \t\treturn exitPreview({ res })\n * \t}\n * \t```\n */\nexport function exitPreview(config: ExitPreviewAPIRouteConfig): void {\n\tconfig.res.clearPreviewData()\n\n\t// `Cache-Control` header is used to prevent CDN-level caching.\n\tconfig.res.setHeader(\"Cache-Control\", \"no-store\")\n\n\tconfig.res.json({ success: true })\n\n\treturn\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAkCA,SAAgB,YAAY,QAAyC;AACpE,QAAO,IAAI,kBAAkB;AAG7B,QAAO,IAAI,UAAU,iBAAiB,WAAW;AAEjD,QAAO,IAAI,KAAK,EAAE,SAAS,MAAM,CAAC"}
1
+ {"version":3,"file":"exitPreview.cjs","names":[],"sources":["../../src/pages/exitPreview.ts"],"sourcesContent":["import type { NextApiRequestLike, NextApiResponseLike } from \"./types\"\n\n/** Configuration for `exitPreview()`. */\nexport type ExitPreviewAPIRouteConfig = {\n\t/**\n\t * The `req` object from a Next.js API route.\n\t *\n\t * @see Next.js API route docs: \\<https://nextjs.org/docs/api-routes/introduction\\>\n\t */\n\treq?: NextApiRequestLike\n\n\t/**\n\t * The `res` object from a Next.js API route.\n\t *\n\t * @see Next.js API route docs: \\<https://nextjs.org/docs/api-routes/introduction\\>\n\t */\n\tres: NextApiResponseLike\n}\n\n/**\n * Ends a Prismic preview session within a Next.js app. This function should be used in an API\n * route.\n *\n * @example\n * \t;```typescript\n * \t// src/pages/api/exit-preview.js\n *\n * \timport { exitPreview } from \"@prismicio/next\"\n *\n * \texport default function handler(_req, res) {\n * \t\treturn exitPreview({ res })\n * \t}\n * \t```\n */\nexport function exitPreview(config: ExitPreviewAPIRouteConfig): void {\n\tconfig.res.clearPreviewData()\n\n\t// `Cache-Control` header is used to prevent CDN-level caching.\n\tconfig.res.setHeader(\"Cache-Control\", \"no-store\")\n\n\tconfig.res.json({ success: true })\n\n\treturn\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAkCA,SAAgB,YAAY,QAAyC;CACpE,OAAO,IAAI,iBAAiB;CAG5B,OAAO,IAAI,UAAU,iBAAiB,UAAU;CAEhD,OAAO,IAAI,KAAK,EAAE,SAAS,KAAK,CAAC;AAGlC"}
@@ -1,8 +1,7 @@
1
1
  import { NextApiRequestLike, NextApiResponseLike } from "./types.cjs";
2
-
3
2
  //#region src/pages/exitPreview.d.ts
4
3
  /** Configuration for `exitPreview()`. */
5
- type ExitPreviewAPIRouteConfig = {
4
+ export type ExitPreviewAPIRouteConfig = {
6
5
  /**
7
6
  * The `req` object from a Next.js API route.
8
7
  *
@@ -31,7 +30,6 @@ type ExitPreviewAPIRouteConfig = {
31
30
  * }
32
31
  * ```
33
32
  */
34
- declare function exitPreview(config: ExitPreviewAPIRouteConfig): void;
33
+ export declare function exitPreview(config: ExitPreviewAPIRouteConfig): void;
35
34
  //#endregion
36
- export { ExitPreviewAPIRouteConfig, exitPreview };
37
35
  //# sourceMappingURL=exitPreview.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"exitPreview.d.cts","names":[],"sources":["../../src/pages/exitPreview.ts"],"mappings":";;;;KAGY,yBAAA;EAAA;;;;;EAMX,GAAA,GAAM,kBAAA;EAON;;;;AAkBD;EAlBC,GAAA,EAAK,mBAAA;AAAA;;;;;;;;;;;;;;;;iBAkBU,WAAA,CAAY,MAAA,EAAQ,yBAAA"}
1
+ {"version":3,"file":"exitPreview.d.cts","names":[],"sources":["../../src/pages/exitPreview.ts"],"mappings":";;;YAGY;;;;;;EAMX,MAAM;;;;;;EAON,KAAK;;;;;;;;;;;;;;;;;wBAkBU,YAAY,QAAQ"}
@@ -1,8 +1,7 @@
1
1
  import { NextApiRequestLike, NextApiResponseLike } from "./types.js";
2
-
3
2
  //#region src/pages/exitPreview.d.ts
4
3
  /** Configuration for `exitPreview()`. */
5
- type ExitPreviewAPIRouteConfig = {
4
+ export type ExitPreviewAPIRouteConfig = {
6
5
  /**
7
6
  * The `req` object from a Next.js API route.
8
7
  *
@@ -31,7 +30,6 @@ type ExitPreviewAPIRouteConfig = {
31
30
  * }
32
31
  * ```
33
32
  */
34
- declare function exitPreview(config: ExitPreviewAPIRouteConfig): void;
33
+ export declare function exitPreview(config: ExitPreviewAPIRouteConfig): void;
35
34
  //#endregion
36
- export { ExitPreviewAPIRouteConfig, exitPreview };
37
35
  //# sourceMappingURL=exitPreview.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"exitPreview.d.ts","names":[],"sources":["../../src/pages/exitPreview.ts"],"mappings":";;;;KAGY,yBAAA;EAAA;;;;;EAMX,GAAA,GAAM,kBAAA;EAON;;;;AAkBD;EAlBC,GAAA,EAAK,mBAAA;AAAA;;;;;;;;;;;;;;;;iBAkBU,WAAA,CAAY,MAAA,EAAQ,yBAAA"}
1
+ {"version":3,"file":"exitPreview.d.ts","names":[],"sources":["../../src/pages/exitPreview.ts"],"mappings":";;;YAGY;;;;;;EAMX,MAAM;;;;;;EAON,KAAK;;;;;;;;;;;;;;;;;wBAkBU,YAAY,QAAQ"}
@@ -1 +1 @@
1
- {"version":3,"file":"exitPreview.js","names":[],"sources":["../../src/pages/exitPreview.ts"],"sourcesContent":["import type { NextApiRequestLike, NextApiResponseLike } from \"./types\"\n\n/** Configuration for `exitPreview()`. */\nexport type ExitPreviewAPIRouteConfig = {\n\t/**\n\t * The `req` object from a Next.js API route.\n\t *\n\t * @see Next.js API route docs: \\<https://nextjs.org/docs/api-routes/introduction\\>\n\t */\n\treq?: NextApiRequestLike\n\n\t/**\n\t * The `res` object from a Next.js API route.\n\t *\n\t * @see Next.js API route docs: \\<https://nextjs.org/docs/api-routes/introduction\\>\n\t */\n\tres: NextApiResponseLike\n}\n\n/**\n * Ends a Prismic preview session within a Next.js app. This function should be used in an API\n * route.\n *\n * @example\n * \t;```typescript\n * \t// src/pages/api/exit-preview.js\n *\n * \timport { exitPreview } from \"@prismicio/next\"\n *\n * \texport default function handler(_req, res) {\n * \t\treturn exitPreview({ res })\n * \t}\n * \t```\n */\nexport function exitPreview(config: ExitPreviewAPIRouteConfig): void {\n\tconfig.res.clearPreviewData()\n\n\t// `Cache-Control` header is used to prevent CDN-level caching.\n\tconfig.res.setHeader(\"Cache-Control\", \"no-store\")\n\n\tconfig.res.json({ success: true })\n\n\treturn\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAkCA,SAAgB,YAAY,QAAyC;AACpE,QAAO,IAAI,kBAAkB;AAG7B,QAAO,IAAI,UAAU,iBAAiB,WAAW;AAEjD,QAAO,IAAI,KAAK,EAAE,SAAS,MAAM,CAAC"}
1
+ {"version":3,"file":"exitPreview.js","names":[],"sources":["../../src/pages/exitPreview.ts"],"sourcesContent":["import type { NextApiRequestLike, NextApiResponseLike } from \"./types\"\n\n/** Configuration for `exitPreview()`. */\nexport type ExitPreviewAPIRouteConfig = {\n\t/**\n\t * The `req` object from a Next.js API route.\n\t *\n\t * @see Next.js API route docs: \\<https://nextjs.org/docs/api-routes/introduction\\>\n\t */\n\treq?: NextApiRequestLike\n\n\t/**\n\t * The `res` object from a Next.js API route.\n\t *\n\t * @see Next.js API route docs: \\<https://nextjs.org/docs/api-routes/introduction\\>\n\t */\n\tres: NextApiResponseLike\n}\n\n/**\n * Ends a Prismic preview session within a Next.js app. This function should be used in an API\n * route.\n *\n * @example\n * \t;```typescript\n * \t// src/pages/api/exit-preview.js\n *\n * \timport { exitPreview } from \"@prismicio/next\"\n *\n * \texport default function handler(_req, res) {\n * \t\treturn exitPreview({ res })\n * \t}\n * \t```\n */\nexport function exitPreview(config: ExitPreviewAPIRouteConfig): void {\n\tconfig.res.clearPreviewData()\n\n\t// `Cache-Control` header is used to prevent CDN-level caching.\n\tconfig.res.setHeader(\"Cache-Control\", \"no-store\")\n\n\tconfig.res.json({ success: true })\n\n\treturn\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAkCA,SAAgB,YAAY,QAAyC;CACpE,OAAO,IAAI,iBAAiB;CAG5B,OAAO,IAAI,UAAU,iBAAiB,UAAU;CAEhD,OAAO,IAAI,KAAK,EAAE,SAAS,KAAK,CAAC;AAGlC"}
@@ -1 +1 @@
1
- {"version":3,"file":"redirectToPreviewURL.cjs","names":[],"sources":["../../src/pages/redirectToPreviewURL.ts"],"sourcesContent":["import type { LinkResolverFunction, Client } from \"@prismicio/client\"\n\nimport type { NextApiRequestLike, NextApiResponseLike } from \"./types\"\n\nexport type RedirectToPreviewURLConfig = {\n\t/** The Prismic client configured for the preview session's repository. */\n\t// `Pick` is used to use the smallest possible subset of\n\t// `prismic.Client`. Doing this reduces the surface area for breaking\n\t// type changes.\n\tclient: Pick<Client, \"resolvePreviewURL\">\n\n\t/**\n\t * The `req` object from a Next.js API route.\n\t *\n\t * @see Next.js API route docs: \\<https://nextjs.org/docs/pages/building-your-application/routing/api-routes\\>\n\t */\n\treq: NextApiRequestLike\n\n\t/**\n\t * The `res` object from a Next.js API route.\n\t *\n\t * @see Next.js API route docs: \\<https://nextjs.org/docs/pages/building-your-application/routing/api-routes\\>\n\t */\n\tres: NextApiResponseLike\n\n\t/**\n\t * A Link Resolver used to resolve the previewed document's URL.\n\t *\n\t * @see To learn more about Link Resolver: {@link https://prismic.io/docs/core-concepts/link-resolver-route-resolver}\n\t */\n\tlinkResolver?: LinkResolverFunction\n\n\t/**\n\t * The default redirect URL if a URL cannot be determined for the previewed document.\n\t *\n\t * **Note**: If you `next.config.js` file contains a `basePath`, the `defaultURL` option must\n\t * _not_ include it. Instead, provide the `basePath` property using the `basePath` option.\n\t */\n\tdefaultURL?: string\n\n\t/**\n\t * The `basePath` for the Next.js app as it is defined in `next.config.js`. This option can be\n\t * omitted if the app does not have a `basePath`.\n\t *\n\t * @remarks\n\t * The Router Handler or API route is unable to detect the app's `basePath` automatically. It\n\t * must be provided to `redirectToPreviewURL()` manually.\n\t */\n\tbasePath?: string\n}\n\nexport async function redirectToPreviewURL(config: RedirectToPreviewURLConfig): Promise<void> {\n\tconst { client, req, res, linkResolver, defaultURL = \"/\", basePath = \"\" } = config\n\n\tconst previewToken = req.query.token?.toString()\n\n\tconst previewURL = await client.resolvePreviewURL({\n\t\tlinkResolver,\n\t\tdefaultURL,\n\t\tpreviewToken,\n\t})\n\n\tres.redirect(basePath + previewURL)\n\n\treturn\n}\n"],"mappings":";AAmDA,eAAsB,qBAAqB,QAAmD;CAC7F,MAAM,EAAE,QAAQ,KAAK,KAAK,cAAc,aAAa,KAAK,WAAW,OAAO;CAE5E,MAAM,eAAe,IAAI,MAAM,OAAO,UAAU;CAEhD,MAAM,aAAa,MAAM,OAAO,kBAAkB;EACjD;EACA;EACA;EACA,CAAC;AAEF,KAAI,SAAS,WAAW,WAAW"}
1
+ {"version":3,"file":"redirectToPreviewURL.cjs","names":[],"sources":["../../src/pages/redirectToPreviewURL.ts"],"sourcesContent":["import type { LinkResolverFunction, Client } from \"@prismicio/client\"\n\nimport type { NextApiRequestLike, NextApiResponseLike } from \"./types\"\n\nexport type RedirectToPreviewURLConfig = {\n\t/** The Prismic client configured for the preview session's repository. */\n\t// `Pick` is used to use the smallest possible subset of\n\t// `prismic.Client`. Doing this reduces the surface area for breaking\n\t// type changes.\n\tclient: Pick<Client, \"resolvePreviewURL\">\n\n\t/**\n\t * The `req` object from a Next.js API route.\n\t *\n\t * @see Next.js API route docs: \\<https://nextjs.org/docs/pages/building-your-application/routing/api-routes\\>\n\t */\n\treq: NextApiRequestLike\n\n\t/**\n\t * The `res` object from a Next.js API route.\n\t *\n\t * @see Next.js API route docs: \\<https://nextjs.org/docs/pages/building-your-application/routing/api-routes\\>\n\t */\n\tres: NextApiResponseLike\n\n\t/**\n\t * A Link Resolver used to resolve the previewed document's URL.\n\t *\n\t * @see To learn more about Link Resolver: {@link https://prismic.io/docs/core-concepts/link-resolver-route-resolver}\n\t */\n\tlinkResolver?: LinkResolverFunction\n\n\t/**\n\t * The default redirect URL if a URL cannot be determined for the previewed document.\n\t *\n\t * **Note**: If you `next.config.js` file contains a `basePath`, the `defaultURL` option must\n\t * _not_ include it. Instead, provide the `basePath` property using the `basePath` option.\n\t */\n\tdefaultURL?: string\n\n\t/**\n\t * The `basePath` for the Next.js app as it is defined in `next.config.js`. This option can be\n\t * omitted if the app does not have a `basePath`.\n\t *\n\t * @remarks\n\t * The Router Handler or API route is unable to detect the app's `basePath` automatically. It\n\t * must be provided to `redirectToPreviewURL()` manually.\n\t */\n\tbasePath?: string\n}\n\nexport async function redirectToPreviewURL(config: RedirectToPreviewURLConfig): Promise<void> {\n\tconst { client, req, res, linkResolver, defaultURL = \"/\", basePath = \"\" } = config\n\n\tconst previewToken = req.query.token?.toString()\n\n\tconst previewURL = await client.resolvePreviewURL({\n\t\tlinkResolver,\n\t\tdefaultURL,\n\t\tpreviewToken,\n\t})\n\n\tres.redirect(basePath + previewURL)\n\n\treturn\n}\n"],"mappings":";AAmDA,eAAsB,qBAAqB,QAAmD;CAC7F,MAAM,EAAE,QAAQ,KAAK,KAAK,cAAc,aAAa,KAAK,WAAW,OAAO;CAE5E,MAAM,eAAe,IAAI,MAAM,OAAO,SAAS;CAE/C,MAAM,aAAa,MAAM,OAAO,kBAAkB;EACjD;EACA;EACA;CACD,CAAC;CAED,IAAI,SAAS,WAAW,UAAU;AAGnC"}
@@ -1,9 +1,9 @@
1
1
  import { NextApiRequestLike, NextApiResponseLike } from "./types.cjs";
2
2
  import { Client, LinkResolverFunction } from "@prismicio/client";
3
-
4
3
  //#region src/pages/redirectToPreviewURL.d.ts
5
- type RedirectToPreviewURLConfig = {
6
- /** The Prismic client configured for the preview session's repository. */client: Pick<Client, "resolvePreviewURL">;
4
+ export type RedirectToPreviewURLConfig = {
5
+ /** The Prismic client configured for the preview session's repository. */
6
+ client: Pick<Client, "resolvePreviewURL">;
7
7
  /**
8
8
  * The `req` object from a Next.js API route.
9
9
  *
@@ -39,7 +39,6 @@ type RedirectToPreviewURLConfig = {
39
39
  */
40
40
  basePath?: string;
41
41
  };
42
- declare function redirectToPreviewURL(config: RedirectToPreviewURLConfig): Promise<void>;
42
+ export declare function redirectToPreviewURL(config: RedirectToPreviewURLConfig): Promise<void>;
43
43
  //#endregion
44
- export { RedirectToPreviewURLConfig, redirectToPreviewURL };
45
44
  //# sourceMappingURL=redirectToPreviewURL.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"redirectToPreviewURL.d.cts","names":[],"sources":["../../src/pages/redirectToPreviewURL.ts"],"mappings":";;;;KAIY,0BAAA;4EAKX,MAAA,EAAQ,IAAA,CAAK,MAAA;EALwB;;;;;EAYrC,GAAA,EAAK,kBAAA;EAcU;;;;;EAPf,GAAA,EAAK,mBAAA;EAPL;;;;;EAcA,YAAA,GAAe,oBAAA;EAQf;;;;AAaD;;EAbC,UAAA;EAasF;;;;;;;;EAHtF,QAAA;AAAA;AAAA,iBAGqB,oBAAA,CAAqB,MAAA,EAAQ,0BAAA,GAA6B,OAAA"}
1
+ {"version":3,"file":"redirectToPreviewURL.d.cts","names":[],"sources":["../../src/pages/redirectToPreviewURL.ts"],"mappings":";;;YAIY;;EAKX,QAAQ,KAAK;;;;;;EAOb,KAAK;;;;;;EAOL,KAAK;;;;;;EAOL,eAAe;;;;;;;EAQf;;;;;;;;;EAUA;;wBAGqB,qBAAqB,QAAQ,6BAA6B"}
@@ -1,9 +1,9 @@
1
1
  import { NextApiRequestLike, NextApiResponseLike } from "./types.js";
2
2
  import { Client, LinkResolverFunction } from "@prismicio/client";
3
-
4
3
  //#region src/pages/redirectToPreviewURL.d.ts
5
- type RedirectToPreviewURLConfig = {
6
- /** The Prismic client configured for the preview session's repository. */client: Pick<Client, "resolvePreviewURL">;
4
+ export type RedirectToPreviewURLConfig = {
5
+ /** The Prismic client configured for the preview session's repository. */
6
+ client: Pick<Client, "resolvePreviewURL">;
7
7
  /**
8
8
  * The `req` object from a Next.js API route.
9
9
  *
@@ -39,7 +39,6 @@ type RedirectToPreviewURLConfig = {
39
39
  */
40
40
  basePath?: string;
41
41
  };
42
- declare function redirectToPreviewURL(config: RedirectToPreviewURLConfig): Promise<void>;
42
+ export declare function redirectToPreviewURL(config: RedirectToPreviewURLConfig): Promise<void>;
43
43
  //#endregion
44
- export { RedirectToPreviewURLConfig, redirectToPreviewURL };
45
44
  //# sourceMappingURL=redirectToPreviewURL.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"redirectToPreviewURL.d.ts","names":[],"sources":["../../src/pages/redirectToPreviewURL.ts"],"mappings":";;;;KAIY,0BAAA;4EAKX,MAAA,EAAQ,IAAA,CAAK,MAAA;EALwB;;;;;EAYrC,GAAA,EAAK,kBAAA;EAcU;;;;;EAPf,GAAA,EAAK,mBAAA;EAPL;;;;;EAcA,YAAA,GAAe,oBAAA;EAQf;;;;AAaD;;EAbC,UAAA;EAasF;;;;;;;;EAHtF,QAAA;AAAA;AAAA,iBAGqB,oBAAA,CAAqB,MAAA,EAAQ,0BAAA,GAA6B,OAAA"}
1
+ {"version":3,"file":"redirectToPreviewURL.d.ts","names":[],"sources":["../../src/pages/redirectToPreviewURL.ts"],"mappings":";;;YAIY;;EAKX,QAAQ,KAAK;;;;;;EAOb,KAAK;;;;;;EAOL,KAAK;;;;;;EAOL,eAAe;;;;;;;EAQf;;;;;;;;;EAUA;;wBAGqB,qBAAqB,QAAQ,6BAA6B"}
@@ -1 +1 @@
1
- {"version":3,"file":"redirectToPreviewURL.js","names":[],"sources":["../../src/pages/redirectToPreviewURL.ts"],"sourcesContent":["import type { LinkResolverFunction, Client } from \"@prismicio/client\"\n\nimport type { NextApiRequestLike, NextApiResponseLike } from \"./types\"\n\nexport type RedirectToPreviewURLConfig = {\n\t/** The Prismic client configured for the preview session's repository. */\n\t// `Pick` is used to use the smallest possible subset of\n\t// `prismic.Client`. Doing this reduces the surface area for breaking\n\t// type changes.\n\tclient: Pick<Client, \"resolvePreviewURL\">\n\n\t/**\n\t * The `req` object from a Next.js API route.\n\t *\n\t * @see Next.js API route docs: \\<https://nextjs.org/docs/pages/building-your-application/routing/api-routes\\>\n\t */\n\treq: NextApiRequestLike\n\n\t/**\n\t * The `res` object from a Next.js API route.\n\t *\n\t * @see Next.js API route docs: \\<https://nextjs.org/docs/pages/building-your-application/routing/api-routes\\>\n\t */\n\tres: NextApiResponseLike\n\n\t/**\n\t * A Link Resolver used to resolve the previewed document's URL.\n\t *\n\t * @see To learn more about Link Resolver: {@link https://prismic.io/docs/core-concepts/link-resolver-route-resolver}\n\t */\n\tlinkResolver?: LinkResolverFunction\n\n\t/**\n\t * The default redirect URL if a URL cannot be determined for the previewed document.\n\t *\n\t * **Note**: If you `next.config.js` file contains a `basePath`, the `defaultURL` option must\n\t * _not_ include it. Instead, provide the `basePath` property using the `basePath` option.\n\t */\n\tdefaultURL?: string\n\n\t/**\n\t * The `basePath` for the Next.js app as it is defined in `next.config.js`. This option can be\n\t * omitted if the app does not have a `basePath`.\n\t *\n\t * @remarks\n\t * The Router Handler or API route is unable to detect the app's `basePath` automatically. It\n\t * must be provided to `redirectToPreviewURL()` manually.\n\t */\n\tbasePath?: string\n}\n\nexport async function redirectToPreviewURL(config: RedirectToPreviewURLConfig): Promise<void> {\n\tconst { client, req, res, linkResolver, defaultURL = \"/\", basePath = \"\" } = config\n\n\tconst previewToken = req.query.token?.toString()\n\n\tconst previewURL = await client.resolvePreviewURL({\n\t\tlinkResolver,\n\t\tdefaultURL,\n\t\tpreviewToken,\n\t})\n\n\tres.redirect(basePath + previewURL)\n\n\treturn\n}\n"],"mappings":";AAmDA,eAAsB,qBAAqB,QAAmD;CAC7F,MAAM,EAAE,QAAQ,KAAK,KAAK,cAAc,aAAa,KAAK,WAAW,OAAO;CAE5E,MAAM,eAAe,IAAI,MAAM,OAAO,UAAU;CAEhD,MAAM,aAAa,MAAM,OAAO,kBAAkB;EACjD;EACA;EACA;EACA,CAAC;AAEF,KAAI,SAAS,WAAW,WAAW"}
1
+ {"version":3,"file":"redirectToPreviewURL.js","names":[],"sources":["../../src/pages/redirectToPreviewURL.ts"],"sourcesContent":["import type { LinkResolverFunction, Client } from \"@prismicio/client\"\n\nimport type { NextApiRequestLike, NextApiResponseLike } from \"./types\"\n\nexport type RedirectToPreviewURLConfig = {\n\t/** The Prismic client configured for the preview session's repository. */\n\t// `Pick` is used to use the smallest possible subset of\n\t// `prismic.Client`. Doing this reduces the surface area for breaking\n\t// type changes.\n\tclient: Pick<Client, \"resolvePreviewURL\">\n\n\t/**\n\t * The `req` object from a Next.js API route.\n\t *\n\t * @see Next.js API route docs: \\<https://nextjs.org/docs/pages/building-your-application/routing/api-routes\\>\n\t */\n\treq: NextApiRequestLike\n\n\t/**\n\t * The `res` object from a Next.js API route.\n\t *\n\t * @see Next.js API route docs: \\<https://nextjs.org/docs/pages/building-your-application/routing/api-routes\\>\n\t */\n\tres: NextApiResponseLike\n\n\t/**\n\t * A Link Resolver used to resolve the previewed document's URL.\n\t *\n\t * @see To learn more about Link Resolver: {@link https://prismic.io/docs/core-concepts/link-resolver-route-resolver}\n\t */\n\tlinkResolver?: LinkResolverFunction\n\n\t/**\n\t * The default redirect URL if a URL cannot be determined for the previewed document.\n\t *\n\t * **Note**: If you `next.config.js` file contains a `basePath`, the `defaultURL` option must\n\t * _not_ include it. Instead, provide the `basePath` property using the `basePath` option.\n\t */\n\tdefaultURL?: string\n\n\t/**\n\t * The `basePath` for the Next.js app as it is defined in `next.config.js`. This option can be\n\t * omitted if the app does not have a `basePath`.\n\t *\n\t * @remarks\n\t * The Router Handler or API route is unable to detect the app's `basePath` automatically. It\n\t * must be provided to `redirectToPreviewURL()` manually.\n\t */\n\tbasePath?: string\n}\n\nexport async function redirectToPreviewURL(config: RedirectToPreviewURLConfig): Promise<void> {\n\tconst { client, req, res, linkResolver, defaultURL = \"/\", basePath = \"\" } = config\n\n\tconst previewToken = req.query.token?.toString()\n\n\tconst previewURL = await client.resolvePreviewURL({\n\t\tlinkResolver,\n\t\tdefaultURL,\n\t\tpreviewToken,\n\t})\n\n\tres.redirect(basePath + previewURL)\n\n\treturn\n}\n"],"mappings":";AAmDA,eAAsB,qBAAqB,QAAmD;CAC7F,MAAM,EAAE,QAAQ,KAAK,KAAK,cAAc,aAAa,KAAK,WAAW,OAAO;CAE5E,MAAM,eAAe,IAAI,MAAM,OAAO,SAAS;CAE/C,MAAM,aAAa,MAAM,OAAO,kBAAkB;EACjD;EACA;EACA;CACD,CAAC;CAED,IAAI,SAAS,WAAW,UAAU;AAGnC"}
@@ -1,4 +1,3 @@
1
- require("../_virtual/_rolldown/runtime.cjs");
2
1
  let _prismicio_client = require("@prismicio/client");
3
2
  //#region src/pages/setPreviewData.ts
4
3
  /** Set Prismic preview data for Next.js's Preview Mode. */
@@ -1 +1 @@
1
- {"version":3,"file":"setPreviewData.cjs","names":["cookie"],"sources":["../../src/pages/setPreviewData.ts"],"sourcesContent":["import { cookie } from \"@prismicio/client\"\n\nimport type { NextApiRequestLike, NextApiResponseLike } from \"./types\"\n\n/** Configuration for `setPreviewData`. */\nexport type SetPreviewDataConfig = {\n\t/**\n\t * The `req` object from a Next.js API route.\n\t *\n\t * @see Next.js API route docs: \\<https://nextjs.org/docs/api-routes/introduction\\>\n\t */\n\treq: NextApiRequestLike\n\n\t/**\n\t * The `res` object from a Next.js API route.\n\t *\n\t * @see Next.js API route docs: \\<https://nextjs.org/docs/api-routes/introduction\\>\n\t */\n\tres: NextApiResponseLike\n}\n\n/** Set Prismic preview data for Next.js's Preview Mode. */\nexport function setPreviewData({ req, res }: SetPreviewDataConfig): void {\n\tconst ref = req.query.token || req.cookies[cookie.preview]\n\n\tif (ref) {\n\t\tres.setPreviewData({ ref })\n\t}\n}\n"],"mappings":";;;;AAsBA,SAAgB,eAAe,EAAE,KAAK,OAAmC;CACxE,MAAM,MAAM,IAAI,MAAM,SAAS,IAAI,QAAQA,kBAAAA,OAAO;AAElD,KAAI,IACH,KAAI,eAAe,EAAE,KAAK,CAAC"}
1
+ {"version":3,"file":"setPreviewData.cjs","names":["cookie"],"sources":["../../src/pages/setPreviewData.ts"],"sourcesContent":["import { cookie } from \"@prismicio/client\"\n\nimport type { NextApiRequestLike, NextApiResponseLike } from \"./types\"\n\n/** Configuration for `setPreviewData`. */\nexport type SetPreviewDataConfig = {\n\t/**\n\t * The `req` object from a Next.js API route.\n\t *\n\t * @see Next.js API route docs: \\<https://nextjs.org/docs/api-routes/introduction\\>\n\t */\n\treq: NextApiRequestLike\n\n\t/**\n\t * The `res` object from a Next.js API route.\n\t *\n\t * @see Next.js API route docs: \\<https://nextjs.org/docs/api-routes/introduction\\>\n\t */\n\tres: NextApiResponseLike\n}\n\n/** Set Prismic preview data for Next.js's Preview Mode. */\nexport function setPreviewData({ req, res }: SetPreviewDataConfig): void {\n\tconst ref = req.query.token || req.cookies[cookie.preview]\n\n\tif (ref) {\n\t\tres.setPreviewData({ ref })\n\t}\n}\n"],"mappings":";;;AAsBA,SAAgB,eAAe,EAAE,KAAK,OAAmC;CACxE,MAAM,MAAM,IAAI,MAAM,SAAS,IAAI,QAAQA,kBAAAA,OAAO;CAElD,IAAI,KACH,IAAI,eAAe,EAAE,IAAI,CAAC;AAE5B"}
@@ -1,8 +1,7 @@
1
1
  import { NextApiRequestLike, NextApiResponseLike } from "./types.cjs";
2
-
3
2
  //#region src/pages/setPreviewData.d.ts
4
3
  /** Configuration for `setPreviewData`. */
5
- type SetPreviewDataConfig = {
4
+ export type SetPreviewDataConfig = {
6
5
  /**
7
6
  * The `req` object from a Next.js API route.
8
7
  *
@@ -17,10 +16,6 @@ type SetPreviewDataConfig = {
17
16
  res: NextApiResponseLike;
18
17
  };
19
18
  /** Set Prismic preview data for Next.js's Preview Mode. */
20
- declare function setPreviewData({
21
- req,
22
- res
23
- }: SetPreviewDataConfig): void;
19
+ export declare function setPreviewData({ req, res }: SetPreviewDataConfig): void;
24
20
  //#endregion
25
- export { SetPreviewDataConfig, setPreviewData };
26
21
  //# sourceMappingURL=setPreviewData.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"setPreviewData.d.cts","names":[],"sources":["../../src/pages/setPreviewData.ts"],"mappings":";;;;KAKY,oBAAA;EAAA;;;;;EAMX,GAAA,EAAK,kBAAA;EAOL;;;;AAID;EAJC,GAAA,EAAK,mBAAA;AAAA;;iBAIU,cAAA,CAAA;EAAiB,GAAA;EAAK;AAAA,GAAO,oBAAA"}
1
+ {"version":3,"file":"setPreviewData.d.cts","names":[],"sources":["../../src/pages/setPreviewData.ts"],"mappings":";;;YAKY;;;;;;EAMX,KAAK;;;;;;EAOL,KAAK;;;wBAIU,iBAAiB,KAAK,OAAO"}
@@ -1,8 +1,7 @@
1
1
  import { NextApiRequestLike, NextApiResponseLike } from "./types.js";
2
-
3
2
  //#region src/pages/setPreviewData.d.ts
4
3
  /** Configuration for `setPreviewData`. */
5
- type SetPreviewDataConfig = {
4
+ export type SetPreviewDataConfig = {
6
5
  /**
7
6
  * The `req` object from a Next.js API route.
8
7
  *
@@ -17,10 +16,6 @@ type SetPreviewDataConfig = {
17
16
  res: NextApiResponseLike;
18
17
  };
19
18
  /** Set Prismic preview data for Next.js's Preview Mode. */
20
- declare function setPreviewData({
21
- req,
22
- res
23
- }: SetPreviewDataConfig): void;
19
+ export declare function setPreviewData({ req, res }: SetPreviewDataConfig): void;
24
20
  //#endregion
25
- export { SetPreviewDataConfig, setPreviewData };
26
21
  //# sourceMappingURL=setPreviewData.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"setPreviewData.d.ts","names":[],"sources":["../../src/pages/setPreviewData.ts"],"mappings":";;;;KAKY,oBAAA;EAAA;;;;;EAMX,GAAA,EAAK,kBAAA;EAOL;;;;AAID;EAJC,GAAA,EAAK,mBAAA;AAAA;;iBAIU,cAAA,CAAA;EAAiB,GAAA;EAAK;AAAA,GAAO,oBAAA"}
1
+ {"version":3,"file":"setPreviewData.d.ts","names":[],"sources":["../../src/pages/setPreviewData.ts"],"mappings":";;;YAKY;;;;;;EAMX,KAAK;;;;;;EAOL,KAAK;;;wBAIU,iBAAiB,KAAK,OAAO"}
@@ -1 +1 @@
1
- {"version":3,"file":"setPreviewData.js","names":[],"sources":["../../src/pages/setPreviewData.ts"],"sourcesContent":["import { cookie } from \"@prismicio/client\"\n\nimport type { NextApiRequestLike, NextApiResponseLike } from \"./types\"\n\n/** Configuration for `setPreviewData`. */\nexport type SetPreviewDataConfig = {\n\t/**\n\t * The `req` object from a Next.js API route.\n\t *\n\t * @see Next.js API route docs: \\<https://nextjs.org/docs/api-routes/introduction\\>\n\t */\n\treq: NextApiRequestLike\n\n\t/**\n\t * The `res` object from a Next.js API route.\n\t *\n\t * @see Next.js API route docs: \\<https://nextjs.org/docs/api-routes/introduction\\>\n\t */\n\tres: NextApiResponseLike\n}\n\n/** Set Prismic preview data for Next.js's Preview Mode. */\nexport function setPreviewData({ req, res }: SetPreviewDataConfig): void {\n\tconst ref = req.query.token || req.cookies[cookie.preview]\n\n\tif (ref) {\n\t\tres.setPreviewData({ ref })\n\t}\n}\n"],"mappings":";;;AAsBA,SAAgB,eAAe,EAAE,KAAK,OAAmC;CACxE,MAAM,MAAM,IAAI,MAAM,SAAS,IAAI,QAAQ,OAAO;AAElD,KAAI,IACH,KAAI,eAAe,EAAE,KAAK,CAAC"}
1
+ {"version":3,"file":"setPreviewData.js","names":[],"sources":["../../src/pages/setPreviewData.ts"],"sourcesContent":["import { cookie } from \"@prismicio/client\"\n\nimport type { NextApiRequestLike, NextApiResponseLike } from \"./types\"\n\n/** Configuration for `setPreviewData`. */\nexport type SetPreviewDataConfig = {\n\t/**\n\t * The `req` object from a Next.js API route.\n\t *\n\t * @see Next.js API route docs: \\<https://nextjs.org/docs/api-routes/introduction\\>\n\t */\n\treq: NextApiRequestLike\n\n\t/**\n\t * The `res` object from a Next.js API route.\n\t *\n\t * @see Next.js API route docs: \\<https://nextjs.org/docs/api-routes/introduction\\>\n\t */\n\tres: NextApiResponseLike\n}\n\n/** Set Prismic preview data for Next.js's Preview Mode. */\nexport function setPreviewData({ req, res }: SetPreviewDataConfig): void {\n\tconst ref = req.query.token || req.cookies[cookie.preview]\n\n\tif (ref) {\n\t\tres.setPreviewData({ ref })\n\t}\n}\n"],"mappings":";;;AAsBA,SAAgB,eAAe,EAAE,KAAK,OAAmC;CACxE,MAAM,MAAM,IAAI,MAAM,SAAS,IAAI,QAAQ,OAAO;CAElD,IAAI,KACH,IAAI,eAAe,EAAE,IAAI,CAAC;AAE5B"}
@@ -1,15 +1,14 @@
1
1
  import { EnableAutoPreviewsConfig } from "./enableAutoPreviews.cjs";
2
2
  import { ClientConfig } from "@prismicio/client";
3
-
4
3
  //#region src/pages/types.d.ts
5
4
  /** Configuration for creating a Prismic client with automatic preview support in Next.js apps. */
6
- type CreateClientConfig = ClientConfig & Pick<EnableAutoPreviewsConfig, "previewData" | "req">;
5
+ export type CreateClientConfig = ClientConfig & Pick<EnableAutoPreviewsConfig, "previewData" | "req">;
7
6
  /**
8
7
  * The minimal set of properties needed from `next`'s `NextApiRequest` type.
9
8
  *
10
9
  * This request type is only compatible with API routes defined in the `pages` directory.
11
10
  */
12
- type NextApiRequestLike = {
11
+ export type NextApiRequestLike = {
13
12
  query: Partial<Record<string, string | string[]>>;
14
13
  cookies: Partial<Record<string, string>>;
15
14
  };
@@ -18,7 +17,7 @@ type NextApiRequestLike = {
18
17
  *
19
18
  * This request type is only compatible with API routes defined in the `pages` directory.
20
19
  */
21
- type NextApiResponseLike = {
20
+ export type NextApiResponseLike = {
22
21
  redirect(url: string): NextApiResponseLike;
23
22
  clearPreviewData(): NextApiResponseLike;
24
23
  setHeader(name: string, value: string | string[]): NextApiResponseLike;
@@ -26,5 +25,4 @@ type NextApiResponseLike = {
26
25
  setPreviewData(data: object | string): NextApiResponseLike;
27
26
  };
28
27
  //#endregion
29
- export { CreateClientConfig, NextApiRequestLike, NextApiResponseLike };
30
28
  //# sourceMappingURL=types.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.cts","names":[],"sources":["../../src/pages/types.ts"],"mappings":";;;;;KAKY,kBAAA,GAAqB,YAAA,GAChC,IAAA,CAAK,wBAAA;AADN;;;;;AAAA,KAQY,kBAAA;EACX,KAAA,EAAO,OAAA,CAAQ,MAAA;EACf,OAAA,EAAS,OAAA,CAAQ,MAAA;AAAA;;;;;AAFlB;KAUY,mBAAA;EACX,QAAA,CAAS,GAAA,WAAc,mBAAA;EACvB,gBAAA,IAAoB,mBAAA;EACpB,SAAA,CAAU,IAAA,UAAc,KAAA,sBAA2B,mBAAA;EAEnD,IAAA,CAAK,IAAA;EACL,cAAA,CAAe,IAAA,oBAAwB,mBAAA;AAAA"}
1
+ {"version":3,"file":"types.d.cts","names":[],"sources":["../../src/pages/types.ts"],"mappings":";;;;YAKY,qBAAqB,eAChC,KAAK;;;;;;YAOM;EACX,OAAO,QAAQ;EACf,SAAS,QAAQ;;;;;;;YAQN;EACX,SAAS,cAAc;EACvB,oBAAoB;EACpB,UAAU,cAAc,2BAA2B;EAEnD,KAAK;EACL,eAAe,wBAAwB"}
@@ -1,15 +1,14 @@
1
1
  import { EnableAutoPreviewsConfig } from "./enableAutoPreviews.js";
2
2
  import { ClientConfig } from "@prismicio/client";
3
-
4
3
  //#region src/pages/types.d.ts
5
4
  /** Configuration for creating a Prismic client with automatic preview support in Next.js apps. */
6
- type CreateClientConfig = ClientConfig & Pick<EnableAutoPreviewsConfig, "previewData" | "req">;
5
+ export type CreateClientConfig = ClientConfig & Pick<EnableAutoPreviewsConfig, "previewData" | "req">;
7
6
  /**
8
7
  * The minimal set of properties needed from `next`'s `NextApiRequest` type.
9
8
  *
10
9
  * This request type is only compatible with API routes defined in the `pages` directory.
11
10
  */
12
- type NextApiRequestLike = {
11
+ export type NextApiRequestLike = {
13
12
  query: Partial<Record<string, string | string[]>>;
14
13
  cookies: Partial<Record<string, string>>;
15
14
  };
@@ -18,7 +17,7 @@ type NextApiRequestLike = {
18
17
  *
19
18
  * This request type is only compatible with API routes defined in the `pages` directory.
20
19
  */
21
- type NextApiResponseLike = {
20
+ export type NextApiResponseLike = {
22
21
  redirect(url: string): NextApiResponseLike;
23
22
  clearPreviewData(): NextApiResponseLike;
24
23
  setHeader(name: string, value: string | string[]): NextApiResponseLike;
@@ -26,5 +25,4 @@ type NextApiResponseLike = {
26
25
  setPreviewData(data: object | string): NextApiResponseLike;
27
26
  };
28
27
  //#endregion
29
- export { CreateClientConfig, NextApiRequestLike, NextApiResponseLike };
30
28
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","names":[],"sources":["../../src/pages/types.ts"],"mappings":";;;;;KAKY,kBAAA,GAAqB,YAAA,GAChC,IAAA,CAAK,wBAAA;AADN;;;;;AAAA,KAQY,kBAAA;EACX,KAAA,EAAO,OAAA,CAAQ,MAAA;EACf,OAAA,EAAS,OAAA,CAAQ,MAAA;AAAA;;;;;AAFlB;KAUY,mBAAA;EACX,QAAA,CAAS,GAAA,WAAc,mBAAA;EACvB,gBAAA,IAAoB,mBAAA;EACpB,SAAA,CAAU,IAAA,UAAc,KAAA,sBAA2B,mBAAA;EAEnD,IAAA,CAAK,IAAA;EACL,cAAA,CAAe,IAAA,oBAAwB,mBAAA;AAAA"}
1
+ {"version":3,"file":"types.d.ts","names":[],"sources":["../../src/pages/types.ts"],"mappings":";;;;YAKY,qBAAqB,eAChC,KAAK;;;;;;YAOM;EACX,OAAO,QAAQ;EACf,SAAS,QAAQ;;;;;;;YAQN;EACX,SAAS,cAAc;EACvB,oBAAoB;EACpB,UAAU,cAAc,2BAA2B;EAEnD,KAAK;EACL,eAAe,wBAAwB"}
@@ -1,4 +1,3 @@
1
- require("./_virtual/_rolldown/runtime.cjs");
2
1
  let _prismicio_client = require("@prismicio/client");
3
2
  //#region src/redirectToPreviewURL.ts
4
3
  async function redirectToPreviewURL(config) {
@@ -6,8 +5,12 @@ async function redirectToPreviewURL(config) {
6
5
  const { cookies, draftMode } = await import("next/headers.js");
7
6
  const { redirect } = await import("next/navigation");
8
7
  const documentID = request.nextUrl.searchParams.get("documentId") ?? void 0;
8
+ const cookieJar = await cookies();
9
9
  const previewToken = request.nextUrl.searchParams.get("token") ?? void 0;
10
- if (previewToken) (await cookies()).set(_prismicio_client.cookie.preview, previewToken);
10
+ if (previewToken) cookieJar.set(_prismicio_client.cookie.preview, previewToken, {
11
+ sameSite: "none",
12
+ secure: true
13
+ });
11
14
  const previewURL = await client.resolvePreviewURL({
12
15
  documentID,
13
16
  previewToken,
@@ -15,6 +18,12 @@ async function redirectToPreviewURL(config) {
15
18
  linkResolver
16
19
  });
17
20
  (await draftMode()).enable();
21
+ cookieJar.set({
22
+ ...cookieJar.get("__prerender_bypass"),
23
+ httpOnly: true,
24
+ sameSite: "none",
25
+ secure: true
26
+ });
18
27
  return redirect(previewURL);
19
28
  }
20
29
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"redirectToPreviewURL.cjs","names":["prismicCookie"],"sources":["../src/redirectToPreviewURL.ts"],"sourcesContent":["import { cookie as prismicCookie, type Client, type LinkResolverFunction } from \"@prismicio/client\"\n\nimport type { NextRequestLike } from \"./types\"\n\nexport type RedirectToPreviewURLConfig = {\n\t/** The Prismic client configured for the preview session's repository. */\n\t// `Pick` is used to use the smallest possible subset of\n\t// `prismic.Client`. Doing this reduces the surface area for breaking\n\t// type changes.\n\tclient: Pick<Client, \"resolvePreviewURL\">\n\n\t/**\n\t * The `request` object from a Next.js Route Handler.\n\t *\n\t * @see Next.js Route Handler docs: \\<https://nextjs.org/docs/app/building-your-application/routing/route-handlers\\>\n\t */\n\trequest: NextRequestLike\n\n\t/**\n\t * A Link Resolver used to resolve the previewed document's URL.\n\t *\n\t * @see To learn more about Link Resolver: {@link https://prismic.io/docs/core-concepts/link-resolver-route-resolver}\n\t */\n\tlinkResolver?: LinkResolverFunction\n\n\t/**\n\t * The default redirect URL if a URL cannot be determined for the previewed document.\n\t *\n\t * **Note**: If you `next.config.js` file contains a `basePath`, the `defaultURL` option must\n\t * _not_ include it. Instead, provide the `basePath` property using the `basePath` option.\n\t */\n\tdefaultURL?: string\n}\n\nexport async function redirectToPreviewURL(config: RedirectToPreviewURLConfig): Promise<never> {\n\tconst { client, request, linkResolver, defaultURL = \"/\" } = config\n\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// Dynamic so Node.js can load this module: the bare specifier (kept by\n\t// tsdown.config.ts for Next.js's server alias) is not resolvable by Node.js.\n\tconst { redirect } = await import(\"next/navigation\")\n\n\tconst documentID = request.nextUrl.searchParams.get(\"documentId\") ?? undefined\n\n\t// Set the initial preview cookie. Setting the cookie here is necessary\n\t// to support unpublished previews. Without setting it here, the page\n\t// will try to render without the preview cookie, leading to a\n\t// PrismicNotFound error.\n\tconst previewToken = request.nextUrl.searchParams.get(\"token\") ?? undefined\n\tif (previewToken) {\n\t\tconst cookieJar = await cookies()\n\t\tcookieJar.set(prismicCookie.preview, previewToken)\n\t}\n\n\tconst previewURL = await client.resolvePreviewURL({\n\t\tdocumentID,\n\t\tpreviewToken,\n\t\tdefaultURL,\n\t\tlinkResolver,\n\t})\n\n\t;(await draftMode()).enable()\n\n\treturn redirect(previewURL)\n}\n"],"mappings":";;;AAkCA,eAAsB,qBAAqB,QAAoD;CAC9F,MAAM,EAAE,QAAQ,SAAS,cAAc,aAAa,QAAQ;CAK5D,MAAM,EAAE,SAAS,cAAc,MAAM,OAAO;CAI5C,MAAM,EAAE,aAAa,MAAM,OAAO;CAElC,MAAM,aAAa,QAAQ,QAAQ,aAAa,IAAI,aAAa,IAAI,KAAA;CAMrE,MAAM,eAAe,QAAQ,QAAQ,aAAa,IAAI,QAAQ,IAAI,KAAA;AAClE,KAAI,aAEH,EADkB,MAAM,SAAS,EACvB,IAAIA,kBAAAA,OAAc,SAAS,aAAa;CAGnD,MAAM,aAAa,MAAM,OAAO,kBAAkB;EACjD;EACA;EACA;EACA;EACA,CAAC;AAED,EAAC,MAAM,WAAW,EAAE,QAAQ;AAE7B,QAAO,SAAS,WAAW"}
1
+ {"version":3,"file":"redirectToPreviewURL.cjs","names":["prismicCookie"],"sources":["../src/redirectToPreviewURL.ts"],"sourcesContent":["import { cookie as prismicCookie, type Client, type LinkResolverFunction } from \"@prismicio/client\"\n\nimport type { NextRequestLike } from \"./types\"\n\nexport type RedirectToPreviewURLConfig = {\n\t/** The Prismic client configured for the preview session's repository. */\n\t// `Pick` is used to use the smallest possible subset of\n\t// `prismic.Client`. Doing this reduces the surface area for breaking\n\t// type changes.\n\tclient: Pick<Client, \"resolvePreviewURL\">\n\n\t/**\n\t * The `request` object from a Next.js Route Handler.\n\t *\n\t * @see Next.js Route Handler docs: \\<https://nextjs.org/docs/app/building-your-application/routing/route-handlers\\>\n\t */\n\trequest: NextRequestLike\n\n\t/**\n\t * A Link Resolver used to resolve the previewed document's URL.\n\t *\n\t * @see To learn more about Link Resolver: {@link https://prismic.io/docs/core-concepts/link-resolver-route-resolver}\n\t */\n\tlinkResolver?: LinkResolverFunction\n\n\t/**\n\t * The default redirect URL if a URL cannot be determined for the previewed document.\n\t *\n\t * **Note**: If you `next.config.js` file contains a `basePath`, the `defaultURL` option must\n\t * _not_ include it. Instead, provide the `basePath` property using the `basePath` option.\n\t */\n\tdefaultURL?: string\n}\n\nexport async function redirectToPreviewURL(config: RedirectToPreviewURLConfig): Promise<never> {\n\tconst { client, request, linkResolver, defaultURL = \"/\" } = config\n\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// Dynamic so Node.js can load this module: the bare specifier (kept by\n\t// tsdown.config.ts for Next.js's server alias) is not resolvable by Node.js.\n\tconst { redirect } = await import(\"next/navigation\")\n\n\tconst documentID = request.nextUrl.searchParams.get(\"documentId\") ?? undefined\n\n\t// Set the initial preview cookie. Setting the cookie here is necessary\n\t// to support unpublished previews. Without setting it here, the page\n\t// will try to render without the preview cookie, leading to a\n\t// PrismicNotFound error.\n\tconst cookieJar = await cookies()\n\tconst previewToken = request.nextUrl.searchParams.get(\"token\") ?? undefined\n\tif (previewToken) {\n\t\tcookieJar.set(prismicCookie.preview, previewToken, { sameSite: \"none\", secure: true })\n\t}\n\n\tconst previewURL = await client.resolvePreviewURL({\n\t\tdocumentID,\n\t\tpreviewToken,\n\t\tdefaultURL,\n\t\tlinkResolver,\n\t})\n\n\t;(await draftMode()).enable()\n\n\t// Next.js uses `SameSite=Lax` in development, which cross-site iframes drop.\n\tcookieJar.set({\n\t\t...cookieJar.get(\"__prerender_bypass\")!,\n\t\thttpOnly: true,\n\t\tsameSite: \"none\",\n\t\tsecure: true,\n\t})\n\n\treturn redirect(previewURL)\n}\n"],"mappings":";;AAkCA,eAAsB,qBAAqB,QAAoD;CAC9F,MAAM,EAAE,QAAQ,SAAS,cAAc,aAAa,QAAQ;CAK5D,MAAM,EAAE,SAAS,cAAc,MAAM,OAAO;CAI5C,MAAM,EAAE,aAAa,MAAM,OAAO;CAElC,MAAM,aAAa,QAAQ,QAAQ,aAAa,IAAI,YAAY,KAAK,KAAA;CAMrE,MAAM,YAAY,MAAM,QAAQ;CAChC,MAAM,eAAe,QAAQ,QAAQ,aAAa,IAAI,OAAO,KAAK,KAAA;CAClE,IAAI,cACH,UAAU,IAAIA,kBAAAA,OAAc,SAAS,cAAc;EAAE,UAAU;EAAQ,QAAQ;CAAK,CAAC;CAGtF,MAAM,aAAa,MAAM,OAAO,kBAAkB;EACjD;EACA;EACA;EACA;CACD,CAAC;CAEA,CAAC,MAAM,UAAU,EAAA,CAAG,OAAO;CAG5B,UAAU,IAAI;EACb,GAAG,UAAU,IAAI,oBAAoB;EACrC,UAAU;EACV,UAAU;EACV,QAAQ;CACT,CAAC;CAED,OAAO,SAAS,UAAU;AAC3B"}
@@ -1,9 +1,9 @@
1
1
  import { NextRequestLike } from "./types.cjs";
2
2
  import { Client, LinkResolverFunction } from "@prismicio/client";
3
-
4
3
  //#region src/redirectToPreviewURL.d.ts
5
- type RedirectToPreviewURLConfig = {
6
- /** The Prismic client configured for the preview session's repository. */client: Pick<Client, "resolvePreviewURL">;
4
+ export type RedirectToPreviewURLConfig = {
5
+ /** The Prismic client configured for the preview session's repository. */
6
+ client: Pick<Client, "resolvePreviewURL">;
7
7
  /**
8
8
  * The `request` object from a Next.js Route Handler.
9
9
  *
@@ -24,7 +24,6 @@ type RedirectToPreviewURLConfig = {
24
24
  */
25
25
  defaultURL?: string;
26
26
  };
27
- declare function redirectToPreviewURL(config: RedirectToPreviewURLConfig): Promise<never>;
27
+ export declare function redirectToPreviewURL(config: RedirectToPreviewURLConfig): Promise<never>;
28
28
  //#endregion
29
- export { RedirectToPreviewURLConfig, redirectToPreviewURL };
30
29
  //# sourceMappingURL=redirectToPreviewURL.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"redirectToPreviewURL.d.cts","names":[],"sources":["../src/redirectToPreviewURL.ts"],"mappings":";;;;KAIY,0BAAA;4EAKX,MAAA,EAAQ,IAAA,CAAK,MAAA;EALwB;;;;;EAYrC,OAAA,EAAS,eAAA;EAO0B;;;;;EAAnC,YAAA,GAAe,oBAAA;EAPN;;;;;;EAeT,UAAA;AAAA;AAAA,iBAGqB,oBAAA,CAAqB,MAAA,EAAQ,0BAAA,GAA6B,OAAA"}
1
+ {"version":3,"file":"redirectToPreviewURL.d.cts","names":[],"sources":["../src/redirectToPreviewURL.ts"],"mappings":";;;YAIY;;EAKX,QAAQ,KAAK;;;;;;EAOb,SAAS;;;;;;EAOT,eAAe;;;;;;;EAQf;;wBAGqB,qBAAqB,QAAQ,6BAA6B"}