@sanity/preview-kit
Advanced tools
Comparing version 1.1.0 to 1.1.1
@@ -10,9 +10,6 @@ import type { Config } from '@sanity/groq-store' | ||
*/ | ||
export declare const _checkAuth: ({ | ||
projectId, | ||
token, | ||
}: { | ||
projectId: string | ||
export declare const _checkAuth: ( | ||
projectId: string, | ||
token: string | null | ||
}) => Promise<boolean> | ||
) => Promise<boolean> | ||
@@ -159,3 +156,3 @@ /** | ||
*/ | ||
checkAuth: (options: { projectId: string; token: string | null }) => boolean | ||
checkAuth: (projectId: string, token: string | null) => boolean | ||
} | ||
@@ -162,0 +159,0 @@ |
@@ -7,7 +7,3 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } | ||
import { jsx } from 'react/jsx-runtime'; | ||
const _checkAuth = async _ref => { | ||
let { | ||
projectId, | ||
token | ||
} = _ref; | ||
const _checkAuth = async (projectId, token) => { | ||
const headers = token ? { | ||
@@ -33,3 +29,3 @@ Authorization: "Bearer ".concat(token) | ||
}; | ||
const _definePreview = _ref2 => { | ||
const _definePreview = _ref => { | ||
let { | ||
@@ -45,3 +41,3 @@ projectId, | ||
checkAuth | ||
} = _ref2; | ||
} = _ref; | ||
if (!projectId) { | ||
@@ -62,6 +58,3 @@ console.warn("No projectId set for createPreviewHook, returning dummy hook"); | ||
if (onPublicAccessOnly) { | ||
const hasAuth = checkAuth({ | ||
projectId, | ||
token | ||
}); | ||
const hasAuth = checkAuth(projectId, token); | ||
if (!hasAuth) { | ||
@@ -109,18 +102,9 @@ onPublicAccessOnly(); | ||
preload: (store, query, params) => suspend(() => store.query(query, params), ["@sanity/preview-kit", "preload", query, params]), | ||
checkAuth: _ref3 => { | ||
let { | ||
projectId, | ||
token | ||
} = _ref3; | ||
return suspend(() => _checkAuth({ | ||
projectId, | ||
token | ||
}), ["@sanity/preview-kit", "checkAuth", projectId, token]); | ||
} | ||
checkAuth: (projectId, token) => suspend(() => _checkAuth(projectId, token), ["@sanity/preview-kit", "checkAuth", projectId, token]) | ||
})); | ||
function PreviewSuspense(_ref4) { | ||
function PreviewSuspense(_ref2) { | ||
let { | ||
children, | ||
fallback | ||
} = _ref4; | ||
} = _ref2; | ||
const [mounted, mount] = useReducer(() => true, false); | ||
@@ -127,0 +111,0 @@ useEffect(mount, [mount]); |
{ | ||
"name": "@sanity/preview-kit", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"description": "General purpose live previews, like next-sanity", | ||
@@ -81,3 +81,3 @@ "keywords": [ | ||
"eslint": "^8.27.0", | ||
"eslint-config-next": "13.0.3-canary.4", | ||
"eslint-config-next": "13.0.3", | ||
"eslint-config-prettier": "^8.5.0", | ||
@@ -90,3 +90,3 @@ "eslint-config-sanity": "^6.0.0", | ||
"groqd": "^0.0.4", | ||
"next": "13.0.3-canary.4", | ||
"next": "13.0.3", | ||
"prettier": "^2.7.1", | ||
@@ -93,0 +93,0 @@ "prettier-plugin-packagejson": "^2.3.0", |
@@ -175,1 +175,12 @@ # @sanity/preview-kit | ||
4. As you edit things in the codesandbox studio you'll see them streamed to the next app. | ||
## Release new version | ||
Run ["CI & Release" workflow](https://github.com/sanity-io/preview-kit/actions/workflows/main.yml). | ||
Make sure to select the main branch and check "Release new version". | ||
Semantic release will only release on configured branches, so it is safe to run release on any branch. | ||
## License | ||
MIT-licensed. See [LICENSE](LICENSE). |
@@ -5,9 +5,6 @@ /** | ||
*/ | ||
export const _checkAuth = async ({ | ||
projectId, | ||
token, | ||
}: { | ||
projectId: string | ||
export const _checkAuth = async ( | ||
projectId: string, | ||
token: string | null | ||
}): Promise<boolean> => { | ||
): Promise<boolean> => { | ||
const headers = token ? { Authorization: `Bearer ${token}` } : undefined | ||
@@ -14,0 +11,0 @@ const res = await fetch(`https://${projectId}.api.sanity.io/v1/users/me`, { |
@@ -61,3 +61,3 @@ import type { Config, GroqStore } from '@sanity/groq-store' | ||
*/ | ||
checkAuth: (options: { projectId: string; token: string | null }) => boolean | ||
checkAuth: (projectId: string, token: string | null) => boolean | ||
} | ||
@@ -112,3 +112,3 @@ | ||
if (onPublicAccessOnly) { | ||
const hasAuth = checkAuth({ projectId, token }) | ||
const hasAuth = checkAuth(projectId, token) | ||
if (!hasAuth) { | ||
@@ -244,7 +244,7 @@ onPublicAccessOnly() | ||
), | ||
checkAuth: ({ projectId, token }) => | ||
checkAuth: (projectId, token) => | ||
suspend( | ||
() => _checkAuth({ projectId, token }), | ||
() => _checkAuth(projectId, token), | ||
['@sanity/preview-kit', 'checkAuth', projectId, token] | ||
), | ||
}) |
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
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
186
2
70100
765