@sanity/preview-url-secret
Advanced tools
Comparing version 0.3.3-pink-lizard to 1.0.0
# Changelog | ||
## [1.0.0](https://github.com/sanity-io/visual-editing/compare/preview-url-secret-v0.3.3-pink-lizard...preview-url-secret-v1.0.0) (2023-11-15) | ||
### Features | ||
* production ready release ([#246](https://github.com/sanity-io/visual-editing/issues/246)) ([993c3cc](https://github.com/sanity-io/visual-editing/commit/993c3cc621921971087053950a1dc88fd9e34762)) | ||
## [0.3.3-pink-lizard](https://github.com/sanity-io/visual-editing/compare/preview-url-secret-v0.3.2-pink-lizard...preview-url-secret-v0.3.3-pink-lizard) (2023-11-13) | ||
@@ -4,0 +11,0 @@ |
{ | ||
"name": "@sanity/preview-url-secret", | ||
"version": "0.3.3-pink-lizard", | ||
"version": "1.0.0", | ||
"homepage": "https://github.com/sanity-io/visual-editing/tree/main/packages/preview-url-secret#readme", | ||
@@ -162,4 +162,3 @@ "bugs": { | ||
"publishConfig": { | ||
"access": "public", | ||
"tag": "pink-lizard" | ||
"access": "public" | ||
}, | ||
@@ -166,0 +165,0 @@ "scripts": { |
# @sanity/preview-url-secret | ||
[![npm stat](https://img.shields.io/npm/dm/@sanity/preview-url-secret.svg?style=flat-square)](https://npm-stat.com/charts.html?package=@sanity/preview-url-secret) | ||
[![npm version](https://img.shields.io/npm/v/@sanity/preview-url-secret/pink-lizard.svg?style=flat-square)](https://www.npmjs.com/package/@sanity/preview-url-secret) | ||
[![npm version](https://img.shields.io/npm/v/@sanity/preview-url-secret.svg?style=flat-square)](https://www.npmjs.com/package/@sanity/preview-url-secret) | ||
[![gzip size][gzip-badge]][bundlephobia] | ||
[![size][size-badge]][bundlephobia] | ||
> **Warning** | ||
> | ||
> This is an experimental package. Breaking changes may be introduced at any time. It's not production ready. | ||
```sh | ||
npm i --save-exact @sanity/preview-url-secret@pink-lizard @sanity/client | ||
npm install @sanity/preview-url-secret @sanity/client | ||
``` | ||
## Usage | ||
TODO how to verify the secret in an API handler that enables Draft Mode | ||
## 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 | ||
[gzip-badge]: https://img.shields.io/bundlephobia/minzip/@sanity/preview-url-secret?label=gzip%20size&style=flat-square | ||
[size-badge]: https://img.shields.io/bundlephobia/min/@sanity/preview-url-secret?label=size&style=flat-square | ||
[bundlephobia]: https://bundlephobia.com/package/@sanity/preview-url-secret |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
4
49315
15