@prismicio/next 0.1.2 → 0.1.3

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.
package/dist/index.cjs CHANGED
@@ -6,6 +6,8 @@ const prismic = require('@prismicio/client');
6
6
  const React = require('react');
7
7
  const react = require('@prismicio/react');
8
8
  const router = require('next/router');
9
+ const Image = require('next/image');
10
+ const prismicH = require('@prismicio/helpers');
9
11
 
10
12
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
11
13
 
@@ -28,7 +30,9 @@ function _interopNamespace(e) {
28
30
  }
29
31
 
30
32
  const prismic__namespace = /*#__PURE__*/_interopNamespace(prismic);
31
- const React__default = /*#__PURE__*/_interopDefaultLegacy(React);
33
+ const React__namespace = /*#__PURE__*/_interopNamespace(React);
34
+ const Image__default = /*#__PURE__*/_interopDefaultLegacy(Image);
35
+ const prismicH__namespace = /*#__PURE__*/_interopNamespace(prismicH);
32
36
 
33
37
  function setPreviewData({ req, res }) {
34
38
  const ref = req.query.token || req.cookies[prismic__namespace.cookie.preview];
@@ -38,65 +42,29 @@ function setPreviewData({ req, res }) {
38
42
  }
39
43
 
40
44
  function exitPreview(config) {
41
- const { req } = config;
42
45
  config.res.clearPreviewData();
43
- if (req.headers.referer) {
44
- const url = new URL(req.headers.referer);
45
- if (url.pathname !== "/api/exit-preview") {
46
- config.res.redirect(req.headers.referer);
47
- return;
48
- }
49
- }
50
- config.res.redirect("/");
46
+ config.res.json({ success: true });
51
47
  }
52
48
 
53
49
  const readValue = (value) => {
54
50
  return value.replace(/%3B/g, ";");
55
51
  };
56
- const parse = (cookieString) => {
57
- const result = {};
58
- const cookies = cookieString.split("; ");
52
+ const getCookie = (name, cookieJar) => {
53
+ const cookies = cookieJar.split("; ");
59
54
  for (const cookie of cookies) {
60
55
  const parts = cookie.split("=");
61
- const value = parts.slice(1).join("=");
62
- const name = readValue(parts[0]).replace(/%3D/g, "=");
63
- result[name] = readValue(value);
64
- }
65
- return result;
66
- };
67
- const getAll = (cookieStore) => parse(cookieStore);
68
- const getCookie = (name, cookieStore) => getAll(cookieStore)[name];
69
-
70
- const extractFirstSubdomain = (host) => host.split(".")[0];
71
- const extractRepositoryNameFromObjectRef = (previewRef) => {
72
- try {
73
- const parsed = JSON.parse(decodeURIComponent(previewRef));
74
- const keys = Object.keys(parsed);
75
- const domainKey = keys.find((key) => /\.prismic\.io$/.test(key));
76
- if (domainKey) {
77
- return extractFirstSubdomain(domainKey);
78
- } else {
79
- return void 0;
56
+ const thisName = readValue(parts[0]).replace(/%3D/g, "=");
57
+ if (thisName === name) {
58
+ const value = parts.slice(1).join("=");
59
+ return readValue(value);
80
60
  }
81
- } catch (e) {
82
- return void 0;
83
61
  }
84
62
  };
85
- const extractRepositoryNameFromURLRef = (previewRef) => {
86
- try {
87
- const url = new URL(previewRef);
88
- return extractFirstSubdomain(url.host);
89
- } catch (e) {
90
- return void 0;
91
- }
92
- };
93
- const extractPreviewRefRepositoryName = (previewRef) => {
94
- return extractRepositoryNameFromObjectRef(previewRef) || extractRepositoryNameFromURLRef(previewRef);
95
- };
96
63
 
97
- const isPrismicUpdateToolbarEvent = (event) => {
98
- return "detail" in event && typeof event.detail.ref === "string";
64
+ const getPreviewCookieRepositoryName = (previewCookie) => {
65
+ return (decodeURIComponent(previewCookie).match(/"(.+).prismic.io"/) || [])[1];
99
66
  };
67
+
100
68
  function PrismicPreview({
101
69
  repositoryName,
102
70
  children,
@@ -104,41 +72,57 @@ function PrismicPreview({
104
72
  exitPreviewURL = "/api/exit-preview"
105
73
  }) {
106
74
  const router$1 = router.useRouter();
107
- React.useEffect(() => {
108
- const previewRefRepositoryName = extractPreviewRefRepositoryName(getCookie("io.prismic.preview", globalThis.document.cookie));
109
- const startPreviewIfLoadedFromSharedLink = async () => {
110
- if (previewRefRepositoryName === repositoryName && !router$1.isPreview) {
111
- await fetch(updatePreviewURL);
112
- window.location.reload();
75
+ const resolvedUpdatePreviewURL = router$1.basePath + updatePreviewURL;
76
+ const resolvedExitPreviewURL = router$1.basePath + exitPreviewURL;
77
+ React__namespace.useEffect(() => {
78
+ const startPreviewMode = async () => {
79
+ const res = await globalThis.fetch(resolvedUpdatePreviewURL);
80
+ if (res.ok) {
81
+ globalThis.location.reload();
82
+ } else {
83
+ console.error(`[<PrismicPreview>] Failed to start or update Preview Mode using the "${resolvedUpdatePreviewURL}" API endpoint. Does it exist?`);
113
84
  }
114
85
  };
115
- startPreviewIfLoadedFromSharedLink();
116
86
  const handlePrismicPreviewUpdate = async (event) => {
117
- if (isPrismicUpdateToolbarEvent(event)) {
118
- event.preventDefault();
119
- await fetch(updatePreviewURL);
120
- window.location.reload();
121
- }
87
+ event.preventDefault();
88
+ await startPreviewMode();
122
89
  };
123
90
  const handlePrismicPreviewEnd = async (event) => {
124
91
  event.preventDefault();
125
- await fetch(exitPreviewURL);
126
- window.location.reload();
92
+ const res = await globalThis.fetch(resolvedExitPreviewURL);
93
+ if (res.ok) {
94
+ globalThis.location.reload();
95
+ } else {
96
+ console.error(`[<PrismicPreview>] Failed to exit Preview Mode using the "${resolvedExitPreviewURL}" API endpoint. Does it exist?`);
97
+ }
127
98
  };
128
- if (window) {
99
+ if (router$1.isPreview) {
129
100
  window.addEventListener("prismicPreviewUpdate", handlePrismicPreviewUpdate);
130
101
  window.addEventListener("prismicPreviewEnd", handlePrismicPreviewEnd);
102
+ } else {
103
+ const prismicPreviewCookie = getCookie(prismic__namespace.cookie.preview, globalThis.document.cookie);
104
+ if (prismicPreviewCookie) {
105
+ const locationIsDescendantOfBasePath = window.location.href.startsWith(window.location.origin + router$1.basePath);
106
+ const prismicPreviewCookieRepositoryName = getPreviewCookieRepositoryName(prismicPreviewCookie);
107
+ if (locationIsDescendantOfBasePath && prismicPreviewCookieRepositoryName === repositoryName) {
108
+ startPreviewMode();
109
+ }
110
+ }
131
111
  }
132
112
  return () => {
133
- if (window) {
134
- window.removeEventListener("prismicPreviewUpdate", handlePrismicPreviewUpdate);
135
- window.removeEventListener("prismicPreviewEnd", handlePrismicPreviewEnd);
136
- }
113
+ window.removeEventListener("prismicPreviewUpdate", handlePrismicPreviewUpdate);
114
+ window.removeEventListener("prismicPreviewEnd", handlePrismicPreviewEnd);
137
115
  };
138
- }, []);
139
- return /* @__PURE__ */ React__default["default"].createElement(React__default["default"].Fragment, null, /* @__PURE__ */ React__default["default"].createElement(react.PrismicToolbar, {
116
+ }, [
117
+ repositoryName,
118
+ resolvedExitPreviewURL,
119
+ resolvedUpdatePreviewURL,
120
+ router$1.isPreview,
121
+ router$1.basePath
122
+ ]);
123
+ return /* @__PURE__ */ React__namespace.createElement(React__namespace.Fragment, null, children, /* @__PURE__ */ React__namespace.createElement(react.PrismicToolbar, {
140
124
  repositoryName
141
- }), children);
125
+ }));
142
126
  }
143
127
 
144
128
  const isPrismicNextPreviewData = (previewData) => {
@@ -155,28 +139,104 @@ const enableAutoPreviews = (config) => {
155
139
  }
156
140
  };
157
141
 
158
- const isPrismicNextQuery = (query) => typeof query.documentId === "string" && typeof query.token === "string";
159
- async function redirectToPreviewURL({
160
- req,
161
- res,
162
- client,
163
- linkResolver,
164
- defaultURL = "/"
165
- }) {
166
- if (isPrismicNextQuery(req.query)) {
167
- const { documentId, token } = req.query;
168
- const previewUrl = await client.resolvePreviewURL({
169
- linkResolver,
142
+ const isPrismicNextQuery = (query) => {
143
+ return typeof query.documentId === "string" && typeof query.token === "string";
144
+ };
145
+ async function redirectToPreviewURL(config) {
146
+ const defaultURL = config.defaultURL || "/";
147
+ const basePath = config.basePath || "";
148
+ if (isPrismicNextQuery(config.req.query)) {
149
+ const previewUrl = await config.client.resolvePreviewURL({
150
+ linkResolver: config.linkResolver,
170
151
  defaultURL,
171
- documentID: documentId,
172
- previewToken: token
152
+ documentID: config.req.query.documentId,
153
+ previewToken: config.req.query.token
173
154
  });
174
- res.redirect(previewUrl);
155
+ config.res.redirect(basePath + previewUrl);
175
156
  return;
176
157
  }
177
- res.redirect(defaultURL);
158
+ config.res.redirect(basePath + defaultURL);
178
159
  }
179
160
 
161
+ const camelCaseToParamCase = (input) => {
162
+ return input.replace(/[A-Z]/g, (match) => {
163
+ return `-${match.toLowerCase()}`;
164
+ });
165
+ };
166
+ const buildURL = (url, params) => {
167
+ const instance = new URL(url);
168
+ for (const camelCasedParamKey in params) {
169
+ const paramKey = camelCaseToParamCase(camelCasedParamKey);
170
+ const paramValue = params[camelCasedParamKey];
171
+ if (paramValue === void 0) {
172
+ instance.searchParams.delete(paramKey);
173
+ } else if (Array.isArray(paramValue)) {
174
+ instance.searchParams.set(paramKey, paramValue.join(","));
175
+ } else {
176
+ instance.searchParams.set(paramKey, `${paramValue}`);
177
+ }
178
+ }
179
+ const s = instance.searchParams.get("s");
180
+ if (s) {
181
+ instance.searchParams.delete("s");
182
+ instance.searchParams.append("s", s);
183
+ }
184
+ return instance.toString();
185
+ };
186
+
187
+ const __PRODUCTION__ = process.env.NODE_ENV === "production";
188
+
189
+ var version = "0.1.3";
190
+
191
+ const devMsg = (slug) => {
192
+ return `https://prismic.dev/msg/next/v${version}/${slug}`;
193
+ };
194
+
195
+ const imgixLoader = (args) => {
196
+ const url = new URL(args.src);
197
+ const params = {
198
+ fit: url.searchParams.get("fit") || "max",
199
+ w: args.width,
200
+ h: void 0
201
+ };
202
+ if (args.quality) {
203
+ params.q = args.quality;
204
+ }
205
+ return buildURL(args.src, params);
206
+ };
207
+ const PrismicNextImage = ({
208
+ field,
209
+ imgixParams = {},
210
+ alt,
211
+ fallbackAlt,
212
+ layout,
213
+ ...restProps
214
+ }) => {
215
+ if (!__PRODUCTION__) {
216
+ if (typeof alt === "string" && alt !== "") {
217
+ console.warn(`[PrismicNextImage] The "alt" prop can only be used to declare an image as decorative by passing an empty string (alt="") but was provided a non-empty string. You can resolve this warning by removing the "alt" prop or changing it to alt="". For more details, see ${devMsg("alt-must-be-an-empty-string")}`);
218
+ }
219
+ if (typeof fallbackAlt === "string" && fallbackAlt !== "") {
220
+ console.warn(`[PrismicNextImage] The "fallbackAlt" prop can only be used to declare an image as decorative by passing an empty string (fallbackAlt="") but was provided a non-empty string. You can resolve this warning by removing the "fallbackAlt" prop or changing it to fallbackAlt="". For more details, see ${devMsg("alt-must-be-an-empty-string")}`);
221
+ }
222
+ }
223
+ if (prismicH__namespace.isFilled.imageThumbnail(field)) {
224
+ const src = buildURL(field.url, imgixParams);
225
+ return /* @__PURE__ */ React__namespace.createElement(Image__default["default"], {
226
+ src,
227
+ width: layout === "fill" ? void 0 : field.dimensions.width,
228
+ height: layout === "fill" ? void 0 : field.dimensions.height,
229
+ alt: alt != null ? alt : field.alt || fallbackAlt,
230
+ loader: imgixLoader,
231
+ layout,
232
+ ...restProps
233
+ });
234
+ } else {
235
+ return null;
236
+ }
237
+ };
238
+
239
+ exports.PrismicNextImage = PrismicNextImage;
180
240
  exports.PrismicPreview = PrismicPreview;
181
241
  exports.enableAutoPreviews = enableAutoPreviews;
182
242
  exports.exitPreview = exitPreview;
package/dist/index.d.ts CHANGED
@@ -1,7 +1,10 @@
1
1
  import { NextApiRequest, NextApiResponse, PreviewData } from 'next';
2
+ import * as React from 'react';
2
3
  import { Client, HttpRequestLike } from '@prismicio/client';
3
- import React from 'react';
4
4
  import { LinkResolverFunction } from '@prismicio/helpers';
5
+ import { ImageProps } from 'next/image';
6
+ import { ImgixURLParams } from 'imgix-url-builder';
7
+ import * as prismicT from '@prismicio/types';
5
8
 
6
9
  /**
7
10
  * Configuration for `setPreviewData`.
@@ -32,42 +35,6 @@ declare type SetPreviewDataConfig = {
32
35
  */
33
36
  declare function setPreviewData({ req, res }: SetPreviewDataConfig): void;
34
37
 
35
- /**
36
- * Configuration for `enableAutoPreviews`.
37
- *
38
- * @typeParam TPreviewData - Next.js preview data object.
39
- */
40
- declare type EnableAutoPreviewsConfig<TPreviewData extends PreviewData = PreviewData> = {
41
- /**
42
- * Prismic client with which automatic previews will be enabled.
43
- */
44
- client: Client;
45
- } & ({
46
- /**
47
- * A Next.js context object (such as the context object from
48
- * `getStaticProps` or `getServerSideProps`).
49
- *
50
- * Pass a `context` object when using `enableAutoPreviews` outside a
51
- * Next.js API endpoint.
52
- */
53
- previewData?: TPreviewData;
54
- } | {
55
- /**
56
- * A Next.js API endpoint request object.
57
- *
58
- * Pass a `req` object when using `enableAutoPreviews` in a Next.js API endpoint.
59
- */
60
- req?: HttpRequestLike;
61
- });
62
- /**
63
- * Configures a Prismic client to automatically query draft content during a
64
- * preview session. It either takes in a Next.js `getStaticProps` context object
65
- * or a Next.js API endpoint request object.
66
- *
67
- * @param config - Configuration for the function.
68
- */
69
- declare const enableAutoPreviews: <TPreviewData extends PreviewData>(config: EnableAutoPreviewsConfig<TPreviewData>) => void;
70
-
71
38
  /**
72
39
  * Configuration for `exitPreview`.
73
40
  */
@@ -79,9 +46,7 @@ declare type ExitPreviewConfig = {
79
46
  * @see Next.js API route docs: {@link https://nextjs.org/docs/api-routes/introduction}
80
47
  */
81
48
  req: {
82
- headers: {
83
- referer?: NextApiRequest["headers"]["referer"];
84
- };
49
+ headers: NextApiRequest["headers"];
85
50
  };
86
51
  /**
87
52
  * The `res` object from a Next.js API route. This is given as a parameter to
@@ -91,14 +56,15 @@ declare type ExitPreviewConfig = {
91
56
  */
92
57
  res: {
93
58
  clearPreviewData: NextApiResponse["clearPreviewData"];
94
- redirect: NextApiResponse["redirect"];
59
+ json: NextApiResponse["json"];
95
60
  };
61
+ /**
62
+ * @deprecated - This property is no longer used. It can be deleted safely.
63
+ */
64
+ exitPreviewURL?: string;
96
65
  };
97
66
  /**
98
67
  * Exits Next.js's Preview Mode from within a Next.js API route.
99
- *
100
- * If the user was sent to the endpoint from a page, the user will be redirected
101
- * back to that page after exiting Preview Mode.
102
68
  */
103
69
  declare function exitPreview(config: ExitPreviewConfig): void;
104
70
 
@@ -114,13 +80,23 @@ declare type PrismicPreviewProps = {
114
80
  /**
115
81
  * The URL of your app's Prismic preview endpoint (default: `/api/preview`).
116
82
  * This URL will be fetched on preview update events.
83
+ *
84
+ * **Note**: If your `next.config.js` file contains a `basePath`, it is
85
+ * automatically included.
117
86
  */
118
87
  updatePreviewURL?: string;
119
88
  /**
120
89
  * The URL of your app's exit preview endpoint (default: `/api/exit-preview`).
121
90
  * This URL will be fetched on preview exit events.
91
+ *
92
+ * **Note**: If your `next.config.js` file contains a `basePath`, it is
93
+ * automatically included.
122
94
  */
123
95
  exitPreviewURL?: string;
96
+ /**
97
+ * Children to render adjacent to the Prismic Toolbar. The Prismic Toolbar
98
+ * will be rendered last.
99
+ */
124
100
  children?: React.ReactNode;
125
101
  };
126
102
  /**
@@ -135,34 +111,45 @@ declare type PrismicPreviewProps = {
135
111
  declare function PrismicPreview({ repositoryName, children, updatePreviewURL, exitPreviewURL, }: PrismicPreviewProps): JSX.Element;
136
112
 
137
113
  /**
138
- * Redirects a user to the URL of a previewed Prismic document from within a
139
- * Next.js API route.
140
- */
141
- declare function redirectToPreviewURL<TLinkResolverFunction extends LinkResolverFunction<any>>({ req, res, client, linkResolver, defaultURL, }: PreviewConfig<TLinkResolverFunction>): Promise<void>;
142
-
143
- /**
144
- * Configuration for creating a Prismic client with automatic preview support in
145
- * Next.js apps.
114
+ * Configuration for `enableAutoPreviews`.
115
+ *
116
+ * @typeParam TPreviewData - Next.js preview data object.
146
117
  */
147
- declare type CreateClientConfig = {
118
+ declare type EnableAutoPreviewsConfig<TPreviewData extends PreviewData = PreviewData> = {
148
119
  /**
149
- * Preview data coming from Next.js context object. This context object comes
150
- * from `getStaticProps` or `getServerSideProps`.
120
+ * Prismic client with which automatic previews will be enabled.
121
+ */
122
+ client: Client;
123
+ } & ({
124
+ /**
125
+ * A Next.js context object (such as the context object from
126
+ * `getStaticProps` or `getServerSideProps`).
151
127
  *
152
- * Pass `previewData` when using outside a Next.js API endpoint.
128
+ * Pass a `context` object when using `enableAutoPreviews` outside a
129
+ * Next.js API endpoint.
153
130
  */
154
- previewData?: PreviewData;
131
+ previewData?: TPreviewData;
132
+ } | {
155
133
  /**
156
134
  * A Next.js API endpoint request object.
157
135
  *
158
- * Pass a `req` object when using in a Next.js API endpoint.
136
+ * Pass a `req` object when using `enableAutoPreviews` in a Next.js API endpoint.
159
137
  */
160
- req?: NextApiRequest;
161
- };
138
+ req?: HttpRequestLike;
139
+ });
140
+ /**
141
+ * Configures a Prismic client to automatically query draft content during a
142
+ * preview session. It either takes in a Next.js `getStaticProps` context object
143
+ * or a Next.js API endpoint request object.
144
+ *
145
+ * @param config - Configuration for the function.
146
+ */
147
+ declare const enableAutoPreviews: <TPreviewData extends PreviewData>(config: EnableAutoPreviewsConfig<TPreviewData>) => void;
148
+
162
149
  /**
163
150
  * Preview config for enabling previews with redirectToPreviewURL
164
151
  */
165
- declare type PreviewConfig<TLinkResolverFunction extends LinkResolverFunction<any> = LinkResolverFunction> = {
152
+ declare type RedirectToPreviewURLConfig<TLinkResolverFunction extends LinkResolverFunction<any> = LinkResolverFunction> = {
166
153
  /**
167
154
  * The `req` object from a Next.js API route. This is given as a parameter to
168
155
  * the API route.
@@ -193,8 +180,90 @@ declare type PreviewConfig<TLinkResolverFunction extends LinkResolverFunction<an
193
180
  linkResolver?: TLinkResolverFunction;
194
181
  /**
195
182
  * The default redirect URL if a URL cannot be determined for the previewed document.
183
+ *
184
+ * **Note**: If you `next.config.js` file contains a `basePath`, the
185
+ * `defaultURL` option must _not_ include it. Instead, provide the `basePath`
186
+ * property using the `basePath` option.
196
187
  */
197
188
  defaultURL?: string;
189
+ /**
190
+ * The `basePath` for the Next.js app as it is defined in `next.config.js`.
191
+ * This option can be omitted if the app does not have a `basePath`.
192
+ *
193
+ * @remarks
194
+ * The API route is unable to detect the app's `basePath` automatically. It
195
+ * must be provided to `redirectToPreviewURL()` manually.
196
+ */
197
+ basePath?: string;
198
+ };
199
+ /**
200
+ * Redirects a user to the URL of a previewed Prismic document from within a
201
+ * Next.js API route.
202
+ */
203
+ declare function redirectToPreviewURL<TLinkResolverFunction extends LinkResolverFunction<any>>(config: RedirectToPreviewURLConfig<TLinkResolverFunction>): Promise<void>;
204
+
205
+ declare type PrismicNextImageProps = Omit<ImageProps, "src" | "alt" | "width" | "height"> & {
206
+ /**
207
+ * The Prismic Image field or thumbnail to render.
208
+ */
209
+ field: prismicT.ImageFieldImage | null | undefined;
210
+ /**
211
+ * An object of Imgix URL API parameters to transform the image.
212
+ *
213
+ * @see https://docs.imgix.com/apis/rendering
214
+ */
215
+ imgixParams?: ImgixURLParams;
216
+ /**
217
+ * Declare an image as decorative by providing `alt=""`.
218
+ *
219
+ * See:
220
+ * https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/alt#decorative_images
221
+ */
222
+ alt?: "";
223
+ /**
224
+ * Declare an image as decorative only if the Image field does not have
225
+ * alternative text by providing `fallbackAlt=""`.
226
+ *
227
+ * See:
228
+ * https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/alt#decorative_images
229
+ */
230
+ fallbackAlt?: "";
231
+ };
232
+ /**
233
+ * React component that renders an image from a Prismic Image field or one of
234
+ * its thumbnails using `next/image`. It will automatically set the `alt`
235
+ * attribute using the Image field's `alt` property.
236
+ *
237
+ * It uses an Imgix URL-based loader by default. A custom loader can be provided
238
+ * with the `loader` prop. If you would like to use the Next.js Image
239
+ * Optimization API instead, set `loader={undefined}`.
240
+ *
241
+ * @param props - Props for the component.
242
+ *
243
+ * @returns A responsive image component using `next/image` for the given Image field.
244
+ *
245
+ * @see To learn more about `next/image`, see: https://nextjs.org/docs/api-reference/next/image
246
+ */
247
+ declare const PrismicNextImage: ({ field, imgixParams, alt, fallbackAlt, layout, ...restProps }: PrismicNextImageProps) => JSX.Element | null;
248
+
249
+ /**
250
+ * Configuration for creating a Prismic client with automatic preview support in
251
+ * Next.js apps.
252
+ */
253
+ declare type CreateClientConfig = {
254
+ /**
255
+ * Preview data coming from Next.js context object. This context object comes
256
+ * from `getStaticProps` or `getServerSideProps`.
257
+ *
258
+ * Pass `previewData` when using outside a Next.js API endpoint.
259
+ */
260
+ previewData?: PreviewData;
261
+ /**
262
+ * A Next.js API endpoint request object.
263
+ *
264
+ * Pass a `req` object when using in a Next.js API endpoint.
265
+ */
266
+ req?: NextApiRequest;
198
267
  };
199
268
 
200
- export { CreateClientConfig, EnableAutoPreviewsConfig, ExitPreviewConfig as ExitPreviewParams, PreviewConfig, PrismicPreview, PrismicPreviewProps, SetPreviewDataConfig, enableAutoPreviews, exitPreview, redirectToPreviewURL, setPreviewData };
269
+ export { CreateClientConfig, EnableAutoPreviewsConfig, ExitPreviewConfig, PrismicNextImage, PrismicNextImageProps, PrismicPreview, PrismicPreviewProps, RedirectToPreviewURLConfig, SetPreviewDataConfig, enableAutoPreviews, exitPreview, redirectToPreviewURL, setPreviewData };