next-sanity 9.5.6 → 9.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/draft-mode.cjs +37 -0
- package/dist/draft-mode.cjs.map +1 -0
- package/dist/draft-mode.d.cts +38 -0
- package/dist/draft-mode.d.ts +38 -0
- package/dist/draft-mode.js +40 -0
- package/dist/draft-mode.js.map +1 -0
- package/package.json +13 -3
- package/src/draft-mode/define-enable-draft-mode.ts +90 -0
- package/src/draft-mode/index.ts +1 -0
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: !0 });
|
|
3
|
+
var previewUrlSecret = require("@sanity/preview-url-secret"), constants = require("@sanity/preview-url-secret/constants"), headers = require("next/headers"), navigation = require("next/navigation");
|
|
4
|
+
function defineEnableDraftMode(options) {
|
|
5
|
+
const { client } = options;
|
|
6
|
+
return {
|
|
7
|
+
GET: async (request) => {
|
|
8
|
+
const {
|
|
9
|
+
isValid,
|
|
10
|
+
redirectTo = "/",
|
|
11
|
+
studioPreviewPerspective
|
|
12
|
+
} = await previewUrlSecret.validatePreviewUrl(client, request.url);
|
|
13
|
+
if (!isValid)
|
|
14
|
+
return new Response("Invalid secret", { status: 401 });
|
|
15
|
+
const draftModeStore = await headers.draftMode();
|
|
16
|
+
draftModeStore.isEnabled || draftModeStore.enable();
|
|
17
|
+
const cookieStore = await headers.cookies(), cookie = cookieStore.get("__prerender_bypass");
|
|
18
|
+
return cookieStore.set({
|
|
19
|
+
name: "__prerender_bypass",
|
|
20
|
+
value: cookie?.value,
|
|
21
|
+
httpOnly: !0,
|
|
22
|
+
path: "/",
|
|
23
|
+
secure: !0,
|
|
24
|
+
sameSite: "none"
|
|
25
|
+
}), studioPreviewPerspective && cookieStore.set({
|
|
26
|
+
name: constants.perspectiveCookieName,
|
|
27
|
+
value: studioPreviewPerspective,
|
|
28
|
+
httpOnly: !0,
|
|
29
|
+
path: "/",
|
|
30
|
+
secure: !0,
|
|
31
|
+
sameSite: "none"
|
|
32
|
+
}), navigation.redirect(redirectTo);
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
exports.defineEnableDraftMode = defineEnableDraftMode;
|
|
37
|
+
//# sourceMappingURL=draft-mode.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"draft-mode.cjs","sources":["../src/draft-mode/define-enable-draft-mode.ts"],"sourcesContent":["import {validatePreviewUrl} from '@sanity/preview-url-secret'\nimport {perspectiveCookieName} from '@sanity/preview-url-secret/constants'\nimport {cookies, draftMode} from 'next/headers'\nimport {redirect} from 'next/navigation'\n\nimport type {SanityClient} from '../client'\n\n/**\n * @public\n */\nexport interface DefineEnableDraftModeOptions {\n client: SanityClient\n}\n\n/**\n * @public\n */\nexport interface EnableDraftMode {\n GET: (request: Request) => Promise<Response>\n}\n\n/**\n * Sets up an API route for enabling draft mode, can be paired with the `previewUrl.previewMode.enable` in `sanity/presentation`.\n * Can also be used with `sanity-plugin-iframe-pane`.\n * @example\n * ```ts\n * // src/app/api/draft-mode/enable/route.ts\n *\n * import { defineEnableDraftMode } from \"next-sanity/draft-mode\";\n * import { client } from \"@/sanity/lib/client\";\n *\n * export const { GET } = defineEnableDraftMode({\n * client: client.withConfig({ token: process.env.SANITY_API_READ_TOKEN }),\n * });\n * ```\n *\n * @public\n */\nexport function defineEnableDraftMode(options: DefineEnableDraftModeOptions): EnableDraftMode {\n const {client} = options\n return {\n GET: async (request: Request) => {\n // eslint-disable-next-line no-warning-comments\n // @TODO check if already in draft mode at a much earlier stage, and skip validation\n\n const {\n isValid,\n redirectTo = '/',\n studioPreviewPerspective,\n } = await validatePreviewUrl(client, request.url)\n if (!isValid) {\n return new Response('Invalid secret', {status: 401})\n }\n\n const draftModeStore = await draftMode()\n\n // Let's enable draft mode if it's not already enabled\n if (!draftModeStore.isEnabled) {\n draftModeStore.enable()\n }\n\n // Override cookie header for draft mode for usage in live-preview\n // https://github.com/vercel/next.js/issues/49927\n const cookieStore = await cookies()\n const cookie = cookieStore.get('__prerender_bypass')!\n cookieStore.set({\n name: '__prerender_bypass',\n value: cookie?.value,\n httpOnly: true,\n path: '/',\n secure: true,\n sameSite: 'none',\n })\n\n if (studioPreviewPerspective) {\n cookieStore.set({\n name: perspectiveCookieName,\n value: studioPreviewPerspective,\n httpOnly: true,\n path: '/',\n secure: true,\n sameSite: 'none',\n })\n }\n\n // the `redirect` function throws, and eventually returns a Promise<Response>. TSC doesn't \"see\" that so we have to tell it\n return redirect(redirectTo) as Promise<Response>\n },\n }\n}\n"],"names":["validatePreviewUrl","draftMode","cookies","perspectiveCookieName","redirect"],"mappings":";;;AAsCO,SAAS,sBAAsB,SAAwD;AACtF,QAAA,EAAC,OAAU,IAAA;AACV,SAAA;AAAA,IACL,KAAK,OAAO,YAAqB;AAIzB,YAAA;AAAA,QACJ;AAAA,QACA,aAAa;AAAA,QACb;AAAA,MACE,IAAA,MAAMA,iBAAAA,mBAAmB,QAAQ,QAAQ,GAAG;AAChD,UAAI,CAAC;AACH,eAAO,IAAI,SAAS,kBAAkB,EAAC,QAAQ,IAAI,CAAA;AAG/C,YAAA,iBAAiB,MAAMC,QAAAA;AAGxB,qBAAe,aAClB,eAAe;AAKjB,YAAM,cAAc,MAAMC,mBACpB,SAAS,YAAY,IAAI,oBAAoB;AACnD,aAAA,YAAY,IAAI;AAAA,QACd,MAAM;AAAA,QACN,OAAO,QAAQ;AAAA,QACf,UAAU;AAAA,QACV,MAAM;AAAA,QACN,QAAQ;AAAA,QACR,UAAU;AAAA,MAAA,CACX,GAEG,4BACF,YAAY,IAAI;AAAA,QACd,MAAMC,UAAA;AAAA,QACN,OAAO;AAAA,QACP,UAAU;AAAA,QACV,MAAM;AAAA,QACN,QAAQ;AAAA,QACR,UAAU;AAAA,MAAA,CACX,GAIIC,WAAAA,SAAS,UAAU;AAAA,IAC5B;AAAA,EAAA;AAEJ;;"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import {SanityClient} from '@sanity/client'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Sets up an API route for enabling draft mode, can be paired with the `previewUrl.previewMode.enable` in `sanity/presentation`.
|
|
5
|
+
* Can also be used with `sanity-plugin-iframe-pane`.
|
|
6
|
+
* @example
|
|
7
|
+
* ```ts
|
|
8
|
+
* // src/app/api/draft-mode/enable/route.ts
|
|
9
|
+
*
|
|
10
|
+
* import { defineEnableDraftMode } from "next-sanity/draft-mode";
|
|
11
|
+
* import { client } from "@/sanity/lib/client";
|
|
12
|
+
*
|
|
13
|
+
* export const { GET } = defineEnableDraftMode({
|
|
14
|
+
* client: client.withConfig({ token: process.env.SANITY_API_READ_TOKEN }),
|
|
15
|
+
* });
|
|
16
|
+
* ```
|
|
17
|
+
*
|
|
18
|
+
* @public
|
|
19
|
+
*/
|
|
20
|
+
export declare function defineEnableDraftMode(
|
|
21
|
+
options: DefineEnableDraftModeOptions,
|
|
22
|
+
): EnableDraftMode
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* @public
|
|
26
|
+
*/
|
|
27
|
+
export declare interface DefineEnableDraftModeOptions {
|
|
28
|
+
client: SanityClient
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* @public
|
|
33
|
+
*/
|
|
34
|
+
export declare interface EnableDraftMode {
|
|
35
|
+
GET: (request: Request) => Promise<Response>
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export {}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import {SanityClient} from '@sanity/client'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Sets up an API route for enabling draft mode, can be paired with the `previewUrl.previewMode.enable` in `sanity/presentation`.
|
|
5
|
+
* Can also be used with `sanity-plugin-iframe-pane`.
|
|
6
|
+
* @example
|
|
7
|
+
* ```ts
|
|
8
|
+
* // src/app/api/draft-mode/enable/route.ts
|
|
9
|
+
*
|
|
10
|
+
* import { defineEnableDraftMode } from "next-sanity/draft-mode";
|
|
11
|
+
* import { client } from "@/sanity/lib/client";
|
|
12
|
+
*
|
|
13
|
+
* export const { GET } = defineEnableDraftMode({
|
|
14
|
+
* client: client.withConfig({ token: process.env.SANITY_API_READ_TOKEN }),
|
|
15
|
+
* });
|
|
16
|
+
* ```
|
|
17
|
+
*
|
|
18
|
+
* @public
|
|
19
|
+
*/
|
|
20
|
+
export declare function defineEnableDraftMode(
|
|
21
|
+
options: DefineEnableDraftModeOptions,
|
|
22
|
+
): EnableDraftMode
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* @public
|
|
26
|
+
*/
|
|
27
|
+
export declare interface DefineEnableDraftModeOptions {
|
|
28
|
+
client: SanityClient
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* @public
|
|
33
|
+
*/
|
|
34
|
+
export declare interface EnableDraftMode {
|
|
35
|
+
GET: (request: Request) => Promise<Response>
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export {}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { validatePreviewUrl } from "@sanity/preview-url-secret";
|
|
2
|
+
import { perspectiveCookieName } from "@sanity/preview-url-secret/constants";
|
|
3
|
+
import { draftMode, cookies } from "next/headers";
|
|
4
|
+
import { redirect } from "next/navigation";
|
|
5
|
+
function defineEnableDraftMode(options) {
|
|
6
|
+
const { client } = options;
|
|
7
|
+
return {
|
|
8
|
+
GET: async (request) => {
|
|
9
|
+
const {
|
|
10
|
+
isValid,
|
|
11
|
+
redirectTo = "/",
|
|
12
|
+
studioPreviewPerspective
|
|
13
|
+
} = await validatePreviewUrl(client, request.url);
|
|
14
|
+
if (!isValid)
|
|
15
|
+
return new Response("Invalid secret", { status: 401 });
|
|
16
|
+
const draftModeStore = await draftMode();
|
|
17
|
+
draftModeStore.isEnabled || draftModeStore.enable();
|
|
18
|
+
const cookieStore = await cookies(), cookie = cookieStore.get("__prerender_bypass");
|
|
19
|
+
return cookieStore.set({
|
|
20
|
+
name: "__prerender_bypass",
|
|
21
|
+
value: cookie?.value,
|
|
22
|
+
httpOnly: !0,
|
|
23
|
+
path: "/",
|
|
24
|
+
secure: !0,
|
|
25
|
+
sameSite: "none"
|
|
26
|
+
}), studioPreviewPerspective && cookieStore.set({
|
|
27
|
+
name: perspectiveCookieName,
|
|
28
|
+
value: studioPreviewPerspective,
|
|
29
|
+
httpOnly: !0,
|
|
30
|
+
path: "/",
|
|
31
|
+
secure: !0,
|
|
32
|
+
sameSite: "none"
|
|
33
|
+
}), redirect(redirectTo);
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
export {
|
|
38
|
+
defineEnableDraftMode
|
|
39
|
+
};
|
|
40
|
+
//# sourceMappingURL=draft-mode.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"draft-mode.js","sources":["../src/draft-mode/define-enable-draft-mode.ts"],"sourcesContent":["import {validatePreviewUrl} from '@sanity/preview-url-secret'\nimport {perspectiveCookieName} from '@sanity/preview-url-secret/constants'\nimport {cookies, draftMode} from 'next/headers'\nimport {redirect} from 'next/navigation'\n\nimport type {SanityClient} from '../client'\n\n/**\n * @public\n */\nexport interface DefineEnableDraftModeOptions {\n client: SanityClient\n}\n\n/**\n * @public\n */\nexport interface EnableDraftMode {\n GET: (request: Request) => Promise<Response>\n}\n\n/**\n * Sets up an API route for enabling draft mode, can be paired with the `previewUrl.previewMode.enable` in `sanity/presentation`.\n * Can also be used with `sanity-plugin-iframe-pane`.\n * @example\n * ```ts\n * // src/app/api/draft-mode/enable/route.ts\n *\n * import { defineEnableDraftMode } from \"next-sanity/draft-mode\";\n * import { client } from \"@/sanity/lib/client\";\n *\n * export const { GET } = defineEnableDraftMode({\n * client: client.withConfig({ token: process.env.SANITY_API_READ_TOKEN }),\n * });\n * ```\n *\n * @public\n */\nexport function defineEnableDraftMode(options: DefineEnableDraftModeOptions): EnableDraftMode {\n const {client} = options\n return {\n GET: async (request: Request) => {\n // eslint-disable-next-line no-warning-comments\n // @TODO check if already in draft mode at a much earlier stage, and skip validation\n\n const {\n isValid,\n redirectTo = '/',\n studioPreviewPerspective,\n } = await validatePreviewUrl(client, request.url)\n if (!isValid) {\n return new Response('Invalid secret', {status: 401})\n }\n\n const draftModeStore = await draftMode()\n\n // Let's enable draft mode if it's not already enabled\n if (!draftModeStore.isEnabled) {\n draftModeStore.enable()\n }\n\n // Override cookie header for draft mode for usage in live-preview\n // https://github.com/vercel/next.js/issues/49927\n const cookieStore = await cookies()\n const cookie = cookieStore.get('__prerender_bypass')!\n cookieStore.set({\n name: '__prerender_bypass',\n value: cookie?.value,\n httpOnly: true,\n path: '/',\n secure: true,\n sameSite: 'none',\n })\n\n if (studioPreviewPerspective) {\n cookieStore.set({\n name: perspectiveCookieName,\n value: studioPreviewPerspective,\n httpOnly: true,\n path: '/',\n secure: true,\n sameSite: 'none',\n })\n }\n\n // the `redirect` function throws, and eventually returns a Promise<Response>. TSC doesn't \"see\" that so we have to tell it\n return redirect(redirectTo) as Promise<Response>\n },\n }\n}\n"],"names":[],"mappings":";;;;AAsCO,SAAS,sBAAsB,SAAwD;AACtF,QAAA,EAAC,OAAU,IAAA;AACV,SAAA;AAAA,IACL,KAAK,OAAO,YAAqB;AAIzB,YAAA;AAAA,QACJ;AAAA,QACA,aAAa;AAAA,QACb;AAAA,MACE,IAAA,MAAM,mBAAmB,QAAQ,QAAQ,GAAG;AAChD,UAAI,CAAC;AACH,eAAO,IAAI,SAAS,kBAAkB,EAAC,QAAQ,IAAI,CAAA;AAG/C,YAAA,iBAAiB,MAAM;AAGxB,qBAAe,aAClB,eAAe;AAKjB,YAAM,cAAc,MAAM,WACpB,SAAS,YAAY,IAAI,oBAAoB;AACnD,aAAA,YAAY,IAAI;AAAA,QACd,MAAM;AAAA,QACN,OAAO,QAAQ;AAAA,QACf,UAAU;AAAA,QACV,MAAM;AAAA,QACN,QAAQ;AAAA,QACR,UAAU;AAAA,MAAA,CACX,GAEG,4BACF,YAAY,IAAI;AAAA,QACd,MAAM;AAAA,QACN,OAAO;AAAA,QACP,UAAU;AAAA,QACV,MAAM;AAAA,QACN,QAAQ;AAAA,QACR,UAAU;AAAA,MAAA,CACX,GAII,SAAS,UAAU;AAAA,IAC5B;AAAA,EAAA;AAEJ;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "next-sanity",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.6.0",
|
|
4
4
|
"description": "Sanity.io toolkit for Next.js",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"sanity",
|
|
@@ -31,6 +31,12 @@
|
|
|
31
31
|
"require": "./dist/index.cjs",
|
|
32
32
|
"default": "./dist/index.js"
|
|
33
33
|
},
|
|
34
|
+
"./draft-mode": {
|
|
35
|
+
"source": "./src/draft-mode/index.ts",
|
|
36
|
+
"import": "./dist/draft-mode.js",
|
|
37
|
+
"require": "./dist/draft-mode.cjs",
|
|
38
|
+
"default": "./dist/draft-mode.js"
|
|
39
|
+
},
|
|
34
40
|
"./image": {
|
|
35
41
|
"source": "./src/image/index.ts",
|
|
36
42
|
"import": "./dist/image.js",
|
|
@@ -86,6 +92,9 @@
|
|
|
86
92
|
"types": "./dist/index.d.ts",
|
|
87
93
|
"typesVersions": {
|
|
88
94
|
"*": {
|
|
95
|
+
"draft-mode": [
|
|
96
|
+
"./dist/draft-mode.d.ts"
|
|
97
|
+
],
|
|
89
98
|
"image": [
|
|
90
99
|
"./dist/image.d.ts"
|
|
91
100
|
],
|
|
@@ -121,6 +130,7 @@
|
|
|
121
130
|
"@portabletext/react": "^3.1.0",
|
|
122
131
|
"@sanity/client": "^6.22.2",
|
|
123
132
|
"@sanity/preview-kit": "5.1.7",
|
|
133
|
+
"@sanity/preview-url-secret": "2.0.0",
|
|
124
134
|
"@sanity/visual-editing": "2.2.2",
|
|
125
135
|
"groq": "^3.61.0",
|
|
126
136
|
"history": "^5.3.0"
|
|
@@ -155,12 +165,12 @@
|
|
|
155
165
|
"peerDependencies": {
|
|
156
166
|
"@sanity/client": "^6.22.2",
|
|
157
167
|
"@sanity/icons": "^3.4.0",
|
|
158
|
-
"@sanity/types": "^3.
|
|
168
|
+
"@sanity/types": "^3.61.0",
|
|
159
169
|
"@sanity/ui": "^2.8.9",
|
|
160
170
|
"next": "^14.2 || ^15.0.0-0",
|
|
161
171
|
"react": "^18.3 || ^19.0.0-0",
|
|
162
172
|
"react-dom": "^18.3 || ^19.0.0-0",
|
|
163
|
-
"sanity": "^3.
|
|
173
|
+
"sanity": "^3.61.0",
|
|
164
174
|
"styled-components": "^6.1"
|
|
165
175
|
},
|
|
166
176
|
"engines": {
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import {validatePreviewUrl} from '@sanity/preview-url-secret'
|
|
2
|
+
import {perspectiveCookieName} from '@sanity/preview-url-secret/constants'
|
|
3
|
+
import {cookies, draftMode} from 'next/headers'
|
|
4
|
+
import {redirect} from 'next/navigation'
|
|
5
|
+
|
|
6
|
+
import type {SanityClient} from '../client'
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* @public
|
|
10
|
+
*/
|
|
11
|
+
export interface DefineEnableDraftModeOptions {
|
|
12
|
+
client: SanityClient
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* @public
|
|
17
|
+
*/
|
|
18
|
+
export interface EnableDraftMode {
|
|
19
|
+
GET: (request: Request) => Promise<Response>
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Sets up an API route for enabling draft mode, can be paired with the `previewUrl.previewMode.enable` in `sanity/presentation`.
|
|
24
|
+
* Can also be used with `sanity-plugin-iframe-pane`.
|
|
25
|
+
* @example
|
|
26
|
+
* ```ts
|
|
27
|
+
* // src/app/api/draft-mode/enable/route.ts
|
|
28
|
+
*
|
|
29
|
+
* import { defineEnableDraftMode } from "next-sanity/draft-mode";
|
|
30
|
+
* import { client } from "@/sanity/lib/client";
|
|
31
|
+
*
|
|
32
|
+
* export const { GET } = defineEnableDraftMode({
|
|
33
|
+
* client: client.withConfig({ token: process.env.SANITY_API_READ_TOKEN }),
|
|
34
|
+
* });
|
|
35
|
+
* ```
|
|
36
|
+
*
|
|
37
|
+
* @public
|
|
38
|
+
*/
|
|
39
|
+
export function defineEnableDraftMode(options: DefineEnableDraftModeOptions): EnableDraftMode {
|
|
40
|
+
const {client} = options
|
|
41
|
+
return {
|
|
42
|
+
GET: async (request: Request) => {
|
|
43
|
+
// eslint-disable-next-line no-warning-comments
|
|
44
|
+
// @TODO check if already in draft mode at a much earlier stage, and skip validation
|
|
45
|
+
|
|
46
|
+
const {
|
|
47
|
+
isValid,
|
|
48
|
+
redirectTo = '/',
|
|
49
|
+
studioPreviewPerspective,
|
|
50
|
+
} = await validatePreviewUrl(client, request.url)
|
|
51
|
+
if (!isValid) {
|
|
52
|
+
return new Response('Invalid secret', {status: 401})
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const draftModeStore = await draftMode()
|
|
56
|
+
|
|
57
|
+
// Let's enable draft mode if it's not already enabled
|
|
58
|
+
if (!draftModeStore.isEnabled) {
|
|
59
|
+
draftModeStore.enable()
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// Override cookie header for draft mode for usage in live-preview
|
|
63
|
+
// https://github.com/vercel/next.js/issues/49927
|
|
64
|
+
const cookieStore = await cookies()
|
|
65
|
+
const cookie = cookieStore.get('__prerender_bypass')!
|
|
66
|
+
cookieStore.set({
|
|
67
|
+
name: '__prerender_bypass',
|
|
68
|
+
value: cookie?.value,
|
|
69
|
+
httpOnly: true,
|
|
70
|
+
path: '/',
|
|
71
|
+
secure: true,
|
|
72
|
+
sameSite: 'none',
|
|
73
|
+
})
|
|
74
|
+
|
|
75
|
+
if (studioPreviewPerspective) {
|
|
76
|
+
cookieStore.set({
|
|
77
|
+
name: perspectiveCookieName,
|
|
78
|
+
value: studioPreviewPerspective,
|
|
79
|
+
httpOnly: true,
|
|
80
|
+
path: '/',
|
|
81
|
+
secure: true,
|
|
82
|
+
sameSite: 'none',
|
|
83
|
+
})
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// the `redirect` function throws, and eventually returns a Promise<Response>. TSC doesn't "see" that so we have to tell it
|
|
87
|
+
return redirect(redirectTo) as Promise<Response>
|
|
88
|
+
},
|
|
89
|
+
}
|
|
90
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './define-enable-draft-mode'
|