@sanity/preview-url-secret
Advanced tools
Comparing version 0.1.0-pink-lizard to 0.2.0-pink-lizard
# Changelog | ||
## [0.2.0-pink-lizard](https://github.com/sanity-io/visual-editing/compare/preview-url-secret-v0.1.0-pink-lizard...preview-url-secret-v0.2.0-pink-lizard) (2023-11-09) | ||
### Features | ||
* add `definePreviewUrl` API ([c141b74](https://github.com/sanity-io/visual-editing/commit/c141b74b61d93623682a679ecf2614f0886f3939)) | ||
* first mvp of Draft Mode handling ([e7d49f4](https://github.com/sanity-io/visual-editing/commit/e7d49f4a1f5069252a48d99de86bae5ea148881c)) | ||
### Bug Fixes | ||
* add new placeholder export ([fd68482](https://github.com/sanity-io/visual-editing/commit/fd68482ab3cf0b748623566f32aab254f97bf4ca)) | ||
## 0.1.0-pink-lizard (2023-11-09) | ||
@@ -4,0 +17,0 @@ |
import cjs from './index.cjs'; | ||
export const 0 = cjs.0; | ||
export const 1 = cjs.1; | ||
export const 2 = cjs.2; | ||
export const 3 = cjs.3; | ||
export const 4 = cjs.4; | ||
export const urlSearchParamPreviewPathname = cjs.urlSearchParamPreviewPathname; | ||
export const urlSearchParamPreviewSecret = cjs.urlSearchParamPreviewSecret; | ||
export const validateUrlSecret = cjs.validateUrlSecret; | ||
export default cjs; |
@@ -1,4 +0,13 @@ | ||
declare const _default: '@TODO' | ||
export default _default | ||
/** @internal */ | ||
export declare const urlSearchParamPreviewPathname = 'sanity-preview-pathname' | ||
/** @internal */ | ||
export declare const urlSearchParamPreviewSecret = 'sanity-preview-secret' | ||
/** @internal */ | ||
export declare function validateUrlSecret<SanityClientType>( | ||
client: SanityClientType, | ||
secret: string | null | undefined, | ||
): Promise<boolean> | ||
export {} |
@@ -1,3 +0,1 @@ | ||
var index = "@TODO"; | ||
export { index as default }; | ||
//# sourceMappingURL=index.js.map | ||
export{u as urlSearchParamPreviewPathname,a as urlSearchParamPreviewSecret}from"./_chunks/constants-YdXKqiF_.js";async function e(e,r){return console.log("validateUrlSecret",{client:e,secret:r}),!0}export{e as validateUrlSecret};//# sourceMappingURL=index.js.map |
{ | ||
"name": "@sanity/preview-url-secret", | ||
"version": "0.1.0-pink-lizard", | ||
"version": "0.2.0-pink-lizard", | ||
"homepage": "https://github.com/sanity-io/visual-editing/tree/main/packages/preview-url-secret#readme", | ||
@@ -29,2 +29,24 @@ "bugs": { | ||
}, | ||
"./create-secret": { | ||
"types": "./dist/create-secret.d.ts", | ||
"source": "./src/_exports/create-secret.ts", | ||
"require": "./dist/create-secret.cjs", | ||
"node": { | ||
"module": "./dist/create-secret.js", | ||
"import": "./dist/create-secret.cjs.js" | ||
}, | ||
"import": "./dist/create-secret.js", | ||
"default": "./dist/create-secret.js" | ||
}, | ||
"./define-preview-url": { | ||
"types": "./dist/define-preview-url.d.ts", | ||
"source": "./src/_exports/define-preview-url.ts", | ||
"require": "./dist/define-preview-url.cjs", | ||
"node": { | ||
"module": "./dist/define-preview-url.js", | ||
"import": "./dist/define-preview-url.cjs.js" | ||
}, | ||
"import": "./dist/define-preview-url.js", | ||
"default": "./dist/define-preview-url.js" | ||
}, | ||
"./package.json": "./package.json" | ||
@@ -36,2 +58,12 @@ }, | ||
"types": "./dist/index.d.ts", | ||
"typesVersions": { | ||
"*": { | ||
"create-secret": [ | ||
"./dist/create-secret.d.ts" | ||
], | ||
"define-preview-url": [ | ||
"./dist/define-preview-url.d.ts" | ||
] | ||
} | ||
}, | ||
"files": [ | ||
@@ -121,5 +153,4 @@ "dist", | ||
"lint": "eslint .", | ||
"test": "tsc --noEmit", | ||
"watch": "pkg watch --strict" | ||
} | ||
} |
@@ -20,4 +20,41 @@ # @sanity/preview-url-secret | ||
## Presentation Tool | ||
@TODO move to presentation tool docs | ||
```ts | ||
import { presentationTool } from '@sanity/presentation' | ||
import { definePreviewUrl } from '@sanity/preview-url-secret/presentation' | ||
import { visionTool } from '@sanity/vision' | ||
import { defineConfig } from 'sanity' | ||
import { deskTool } from 'sanity/desk' | ||
export default defineConfig({ | ||
projectId, | ||
dataset, | ||
schema, | ||
plugins: [ | ||
presentationTool({ | ||
// The URL you usually would pass into `previewUrl`: | ||
// previewUrl: 'http://localhost:3000/en/home', | ||
// You now pass into `definePreviewUrl`, slightly modified: | ||
previewUrl: definePreviewUrl({ | ||
// You first specify the shared baseUrl: | ||
origin: 'http://localhost:3000', | ||
preview: '/en/home', // Optional, it's '/' by default | ||
// The API route that securely puts the app in a "Draft Mode" | ||
// Next.js docs: https://nextjs.org/docs/app/building-your-application/configuring/draft-mode | ||
draftMode: { | ||
enable: '/api/draft', | ||
}, | ||
}), | ||
}), | ||
deskTool(), | ||
visionTool(), | ||
], | ||
}) | ||
``` | ||
[gzip-badge]: https://img.shields.io/bundlephobia/minzip/@sanity/preview-url-secret@pink-lizard?label=gzip%20size&style=flat-square | ||
[size-badge]: https://img.shields.io/bundlephobia/min/@sanity/preview-url-secret@pink-lizard?label=size&style=flat-square | ||
[bundlephobia]: https://bundlephobia.com/package/@sanity/preview-url-secret@pink-lizard |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 2 instances in 1 package
20875
26
83
60
3