@sanity/vercel-protection-bypass 4.0.5 → 5.0.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.
@@ -41,7 +41,7 @@ function VercelProtectionBypassTool() {
41
41
  syncTags
42
42
  } = await client.fetch(fetchVercelProtectionBypassSecret, {}, {
43
43
  filterResponse: !1,
44
- lastLiveEventId,
44
+ lastLiveEventId: typeof lastLiveEventId == "string" ? lastLiveEventId : null,
45
45
  tag: "preview-url-secret.fetch-vercel-bypass-protection-secret"
46
46
  });
47
47
  return {
@@ -75,6 +75,8 @@ function Layout(t0) {
75
75
  let t2;
76
76
  $[1] !== client || $[2] !== fetchSecret || $[3] !== pushToast ? (t2 = async (prevState, formData) => {
77
77
  const action = formData.get("action");
78
+ if (typeof action != "string")
79
+ throw new Error("Action is not a string");
78
80
  switch (action) {
79
81
  case "remove-secret":
80
82
  return disableVercelProtectionBypass(client).then(() => (pushToast({
@@ -89,6 +91,8 @@ function Layout(t0) {
89
91
  }), prevState));
90
92
  case "add-secret": {
91
93
  const secret = formData.get("secret");
94
+ if (typeof secret != "string")
95
+ throw new Error("Secret is not a string");
92
96
  return enableVercelProtectionBypass(client, secret).then(() => (pushToast({
93
97
  status: "success",
94
98
  title: "Protection bypass is now enabled"
@@ -1 +1 @@
1
- {"version":3,"file":"VercelProtectionBypassTool.js","sources":["../../src/VercelProtectionBypassTool.tsx"],"sourcesContent":["import type {SyncTag, LiveEvent} from '@sanity/client'\n\nimport {AddIcon, TrashIcon} from '@sanity/icons'\nimport {\n apiVersion,\n vercelProtectionBypassSchemaId as _id,\n vercelProtectionBypassSchemaType as _type,\n tag,\n fetchVercelProtectionBypassSecret,\n} from '@sanity/preview-url-secret/constants'\nimport {\n Box,\n Button,\n Card,\n Dialog,\n Flex,\n Heading,\n Spinner,\n Stack,\n Text,\n TextInput,\n useToast,\n} from '@sanity/ui'\nimport {\n Activity,\n Suspense,\n use,\n useActionState,\n useEffect,\n useEffectEvent,\n useState,\n useTransition,\n} from 'react'\nimport {useClient, type SanityClient} from 'sanity'\n\nasync function enableVercelProtectionBypass(client: SanityClient, secret: string): Promise<void> {\n const patch = client.patch(_id).set({secret})\n await client.transaction().createIfNotExists({_id, _type}).patch(patch).commit({tag})\n}\n\nasync function disableVercelProtectionBypass(client: SanityClient): Promise<void> {\n const patch = client.patch(_id).set({secret: null})\n await client.transaction().createIfNotExists({_id, _type}).patch(patch).commit({tag})\n}\n\nexport default function VercelProtectionBypassTool(): React.JSX.Element {\n const client = useClient({apiVersion: apiVersion})\n\n async function fetchSecret(lastLiveEventId: string | null): Promise<FormState> {\n const {result, syncTags} = await client.fetch<string | null>(\n fetchVercelProtectionBypassSecret,\n {},\n {\n filterResponse: false,\n lastLiveEventId,\n tag: 'preview-url-secret.fetch-vercel-bypass-protection-secret',\n },\n )\n return {secret: result, syncTags: syncTags ?? []}\n }\n const [initialStatePromise] = useState(() => fetchSecret(null))\n\n return (\n <Suspense\n fallback={\n <Flex\n align=\"center\"\n direction=\"column\"\n height=\"fill\"\n justify=\"center\"\n style={{width: '100%'}}\n >\n <Spinner />\n </Flex>\n }\n >\n <Layout initialStatePromise={initialStatePromise} fetchSecret={fetchSecret} />\n </Suspense>\n )\n}\n\ntype FormAction = 'remove-secret' | 'add-secret' | 'refresh-secret'\ntype FormName = 'action' | 'lastLiveEventId' | 'secret'\ntype FormState = {secret: string | null; syncTags: SyncTag[]}\n\nfunction Layout({\n initialStatePromise,\n fetchSecret,\n}: {\n initialStatePromise: Promise<FormState>\n fetchSecret(this: void, lastLiveEventId: string | null): Promise<FormState>\n}) {\n const {push: pushToast} = useToast()\n const [isDialogOpen, setIsDialogOpen] = useState(false)\n const client = useClient({apiVersion})\n\n const action = async (prevState: FormState, formData: FormData): Promise<FormState> => {\n const action = formData.get('action' satisfies FormName) as FormAction\n\n switch (action) {\n case 'remove-secret':\n return disableVercelProtectionBypass(client)\n .then((): FormState => {\n pushToast({\n status: 'warning',\n title: 'Protection bypass is now disabled',\n })\n return {...prevState, secret: null}\n })\n .catch((reason): FormState => {\n console.error(reason)\n pushToast({\n status: 'error',\n title:\n 'There was an error when trying to disable protection bypass. See the browser console for more information.',\n })\n return prevState\n })\n\n case 'add-secret': {\n const secret = formData.get('secret' satisfies FormName) as string\n return enableVercelProtectionBypass(client, secret)\n .then(() => {\n pushToast({\n status: 'success',\n title: 'Protection bypass is now enabled',\n })\n setIsDialogOpen(false)\n return {...prevState, secret}\n })\n .catch((reason) => {\n console.error(reason)\n pushToast({\n status: 'error',\n title:\n 'There was an error when trying to enable protection bypass. See the browser console for more information.',\n })\n return prevState\n })\n }\n case 'refresh-secret':\n return fetchSecret(formData.get('lastLiveEventId' satisfies FormName) as string)\n default:\n // oxlint-disable-next-line typescript/restrict-template-expressions\n throw new Error(`Unknown action: ${action}`)\n }\n }\n\n const [formState, formAction, isPending] = useActionState(action, use(initialStatePromise))\n const isBackgroundRefetch = useRefetchOnLiveEvent(client, formState, formAction)\n\n const loading = isPending && !isBackgroundRefetch\n const enabled = Boolean(formState.secret)\n\n return (\n <>\n <Box\n as=\"form\"\n action={formAction}\n sizing=\"border\"\n display=\"flex\"\n style={{\n height: '100%',\n alignItems: 'center',\n justifyContent: 'center',\n flexDirection: 'column',\n }}\n >\n <Stack space={5}>\n <Card padding={4} style={{maxWidth: 640}}>\n <Stack space={4} style={{justifyItems: 'flex-start', textWrap: 'pretty'}}>\n <Heading>Vercel Protection Bypass</Heading>\n {enabled ? (\n <>\n <Box>\n <Text style={{textWrap: 'pretty'}}>\n Sanity Presentation is setup to use{' '}\n <a\n href=\"https://vercel.com/docs/security/deployment-protection/methods-to-bypass-deployment-protection/protection-bypass-automation\"\n target=\"_blank\"\n rel=\"noreferrer\"\n >\n protection bypass for automation\n </a>{' '}\n in order to display protected deployments in its preview iframe for the\n current Sanity dataset.\n </Text>\n </Box>\n <Box>\n <Text>\n You can turn off automatic protection bypass at any time by clicking the\n button below.\n </Text>\n </Box>\n <Button\n mode=\"ghost\"\n tone=\"critical\"\n icon={<TrashIcon />}\n loading={loading}\n type=\"submit\"\n name={'action' satisfies FormName}\n value={'remove-secret' satisfies FormAction}\n text=\"Remove secret\"\n />\n <Text>\n Protection bypass remains enabled if this plugin is removed from your Sanity\n config.\n </Text>\n </>\n ) : (\n <>\n <Box>\n <Text style={{textWrap: 'pretty'}}>\n Follow the instructions on{' '}\n <a\n href=\"https://vercel.com/docs/security/deployment-protection/methods-to-bypass-deployment-protection/protection-bypass-automation\"\n target=\"_blank\"\n rel=\"noreferrer\"\n >\n how to enable protection bypass for automation\n </a>\n .\n </Text>\n </Box>\n <Box>\n <Text>\n This will setup a secret that Vercel exposes as an environment variable called\n VERCEL_AUTOMATION_BYPASS_SECRET, its value is the secret you need.\n </Text>\n </Box>\n <Button\n mode=\"ghost\"\n icon={<AddIcon />}\n onClick={() => {\n setIsDialogOpen(true)\n }}\n text=\"Add secret\"\n />\n <Text>\n If you&apos;re using Sanity Presentation Tool with multiple protected\n deployments ensure that they have the same secret set, as this tool will set a\n secret that is shared in your dataset with all instances of Presentation Tool.\n </Text>\n </>\n )}\n </Stack>\n </Card>\n </Stack>\n </Box>\n\n <Activity mode={isDialogOpen ? 'visible' : 'hidden'}>\n <Dialog animate id=\"add-secret-dialog\" onClickOutside={() => setIsDialogOpen(false)}>\n <Card as=\"form\" action={formAction} padding={3}>\n <Stack space={3}>\n <Stack space={2}>\n <Text as=\"label\" weight=\"semibold\" size={1}>\n Add bypass secret\n </Text>\n <Text muted size={1}>\n {`Make sure it's the same secret the Vercel deployment is using that's loaded in the preview iframe.`}\n </Text>\n <TextInput\n name={'secret' satisfies FormName}\n onFocus={(event) => {\n event.currentTarget.setCustomValidity('')\n }}\n onBlur={(event) => {\n event.currentTarget.setCustomValidity(\n event.currentTarget.value.length == 32\n ? ''\n : 'Secret must be 32 characters long',\n )\n event.currentTarget.required = true\n }}\n minLength={32}\n maxLength={32}\n autoComplete=\"off\"\n autoCapitalize=\"off\"\n autoCorrect=\"off\"\n spellCheck=\"false\"\n disabled={loading}\n />\n </Stack>\n <Button\n type=\"submit\"\n loading={loading}\n text={loading ? 'Saving…' : 'Save'}\n tone=\"positive\"\n name={'action' satisfies FormName}\n value={'add-secret' satisfies FormAction}\n />\n </Stack>\n </Card>\n </Dialog>\n </Activity>\n </>\n )\n}\n\ntype isBackgroundRefetch = boolean\nfunction useRefetchOnLiveEvent(\n client: SanityClient,\n formState: FormState,\n action: (formData: FormData) => void,\n): isBackgroundRefetch {\n const [isBackgroundRefetch, startTransition] = useTransition()\n const handleLiveEvent = useEffectEvent((event: LiveEvent) => {\n if (event.type === 'message' && event.tags.some((tag) => formState.syncTags.includes(tag))) {\n const formData = new FormData()\n formData.set('action' satisfies FormName, 'refresh-secret' satisfies FormAction)\n formData.set('lastLiveEventId' satisfies FormName, event.id)\n startTransition(() => action(formData))\n }\n })\n useEffect(() => {\n const subscription = client.live.events().subscribe({\n next: handleLiveEvent,\n error: (reason) => console.error(reason),\n })\n\n return () => subscription.unsubscribe()\n }, [client])\n return isBackgroundRefetch\n}\n"],"names":["enableVercelProtectionBypass","client","secret","patch","_id","set","transaction","createIfNotExists","_type","commit","tag","disableVercelProtectionBypass","VercelProtectionBypassTool","$","_c","t0","for","apiVersion","useClient","t1","lastLiveEventId","result","syncTags","fetch","fetchVercelProtectionBypassSecret","filterResponse","fetchSecret","t2","initialStatePromise","useState","t3","width","t4","Layout","push","pushToast","useToast","isDialogOpen","setIsDialogOpen","prevState","formData","action","get","then","status","title","catch","reason_0","console","error","reason","Error","action_0","formState","formAction","isPending","useActionState","use","isBackgroundRefetch","useRefetchOnLiveEvent","loading","enabled","Boolean","height","alignItems","justifyContent","flexDirection","maxWidth","t5","t6","justifyItems","textWrap","t7","t8","t9","t10","t11","t12","_temp","_temp2","t13","t14","t15","t16","t17","event_0","event","currentTarget","setCustomValidity","value","length","required","startTransition","useTransition","type","tags","some","includes","FormData","id","handleLiveEvent","useEffectEvent","live","subscription","events","subscribe","next","_temp3","unsubscribe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AAuF,mBACQjF,KAAAA,MAAA;AACR,UAAAoF,eAAqBtG,OAAMqG,KAAKE,OAAAA,EAASC,UAAW;AAAA,MAAAC,MAC5CN;AAAAA,MAAenD,OACd0D;AAAAA,IAAAA,CACR;AAAC,WAEK,MAAMJ,aAAYK,YAAAA;AAAAA,EAAc,GACxC/F,EAAA,CAAA,IAAAZ,OAAAqG,MAAAzF,OAAAuF,iBAAAvF,OAAAM,MAAAA,KAAAN,EAAA,CAAA;AAAA,MAAAc;AAAA,SAAAd,SAAAZ,UAAE0B,KAAA,CAAC1B,MAAM,GAACY,OAAAZ,QAAAY,OAAAc,MAAAA,KAAAd,EAAA,CAAA,GAPXgG,UAAU1F,IAOPQ,EAAQ,GACJ+B;AAAmB;AAtB5B,SAAAiD,OAAAzD,QAAA;AAAA,SAiByBF,QAAOC,MAAOC,MAAM;AAAC;"}
1
+ {"version":3,"file":"VercelProtectionBypassTool.js","sources":["../../src/VercelProtectionBypassTool.tsx"],"sourcesContent":["import type {SyncTag, LiveEvent} from '@sanity/client'\n\nimport {AddIcon, TrashIcon} from '@sanity/icons'\nimport {\n apiVersion,\n vercelProtectionBypassSchemaId as _id,\n vercelProtectionBypassSchemaType as _type,\n tag,\n fetchVercelProtectionBypassSecret,\n} from '@sanity/preview-url-secret/constants'\nimport {\n Box,\n Button,\n Card,\n Dialog,\n Flex,\n Heading,\n Spinner,\n Stack,\n Text,\n TextInput,\n useToast,\n} from '@sanity/ui'\nimport {\n Activity,\n Suspense,\n use,\n useActionState,\n useEffect,\n useEffectEvent,\n useState,\n useTransition,\n} from 'react'\nimport {useClient, type SanityClient} from 'sanity'\n\nasync function enableVercelProtectionBypass(client: SanityClient, secret: string): Promise<void> {\n const patch = client.patch(_id).set({secret})\n await client.transaction().createIfNotExists({_id, _type}).patch(patch).commit({tag})\n}\n\nasync function disableVercelProtectionBypass(client: SanityClient): Promise<void> {\n const patch = client.patch(_id).set({secret: null})\n await client.transaction().createIfNotExists({_id, _type}).patch(patch).commit({tag})\n}\n\nexport default function VercelProtectionBypassTool(): React.JSX.Element {\n const client = useClient({apiVersion: apiVersion})\n\n async function fetchSecret(lastLiveEventId: FormDataEntryValue | null): Promise<FormState> {\n const {result, syncTags} = await client.fetch<string | null>(\n fetchVercelProtectionBypassSecret,\n {},\n {\n filterResponse: false,\n lastLiveEventId: typeof lastLiveEventId === 'string' ? lastLiveEventId : null,\n tag: 'preview-url-secret.fetch-vercel-bypass-protection-secret',\n },\n )\n return {secret: result, syncTags: syncTags ?? []}\n }\n const [initialStatePromise] = useState(() => fetchSecret(null))\n\n return (\n <Suspense\n fallback={\n <Flex\n align=\"center\"\n direction=\"column\"\n height=\"fill\"\n justify=\"center\"\n style={{width: '100%'}}\n >\n <Spinner />\n </Flex>\n }\n >\n <Layout initialStatePromise={initialStatePromise} fetchSecret={fetchSecret} />\n </Suspense>\n )\n}\n\ntype FormAction = 'remove-secret' | 'add-secret' | 'refresh-secret'\ntype FormName = 'action' | 'lastLiveEventId' | 'secret'\ntype FormState = {secret: string | null; syncTags: SyncTag[]}\n\nfunction Layout({\n initialStatePromise,\n fetchSecret,\n}: {\n initialStatePromise: Promise<FormState>\n fetchSecret(this: void, lastLiveEventId: FormDataEntryValue | null): Promise<FormState>\n}) {\n const {push: pushToast} = useToast()\n const [isDialogOpen, setIsDialogOpen] = useState(false)\n const client = useClient({apiVersion})\n\n const action = async (prevState: FormState, formData: FormData): Promise<FormState> => {\n const action = formData.get('action' satisfies FormName)\n if (typeof action !== 'string') {\n throw new Error('Action is not a string')\n }\n\n switch (action) {\n case 'remove-secret':\n return disableVercelProtectionBypass(client)\n .then((): FormState => {\n pushToast({\n status: 'warning',\n title: 'Protection bypass is now disabled',\n })\n return {...prevState, secret: null}\n })\n .catch((reason): FormState => {\n console.error(reason)\n pushToast({\n status: 'error',\n title:\n 'There was an error when trying to disable protection bypass. See the browser console for more information.',\n })\n return prevState\n })\n\n case 'add-secret': {\n const secret = formData.get('secret' satisfies FormName)\n if (typeof secret !== 'string') {\n throw new Error('Secret is not a string')\n }\n return enableVercelProtectionBypass(client, secret)\n .then(() => {\n pushToast({\n status: 'success',\n title: 'Protection bypass is now enabled',\n })\n setIsDialogOpen(false)\n return {...prevState, secret}\n })\n .catch((reason) => {\n console.error(reason)\n pushToast({\n status: 'error',\n title:\n 'There was an error when trying to enable protection bypass. See the browser console for more information.',\n })\n return prevState\n })\n }\n case 'refresh-secret':\n return fetchSecret(formData.get('lastLiveEventId' satisfies FormName))\n default:\n throw new Error(`Unknown action: ${action}`)\n }\n }\n\n const [formState, formAction, isPending] = useActionState(action, use(initialStatePromise))\n const isBackgroundRefetch = useRefetchOnLiveEvent(client, formState, formAction)\n\n const loading = isPending && !isBackgroundRefetch\n const enabled = Boolean(formState.secret)\n\n return (\n <>\n <Box\n as=\"form\"\n action={formAction}\n sizing=\"border\"\n display=\"flex\"\n style={{\n height: '100%',\n alignItems: 'center',\n justifyContent: 'center',\n flexDirection: 'column',\n }}\n >\n <Stack space={5}>\n <Card padding={4} style={{maxWidth: 640}}>\n <Stack space={4} style={{justifyItems: 'flex-start', textWrap: 'pretty'}}>\n <Heading>Vercel Protection Bypass</Heading>\n {enabled ? (\n <>\n <Box>\n <Text style={{textWrap: 'pretty'}}>\n Sanity Presentation is setup to use{' '}\n <a\n href=\"https://vercel.com/docs/security/deployment-protection/methods-to-bypass-deployment-protection/protection-bypass-automation\"\n target=\"_blank\"\n rel=\"noreferrer\"\n >\n protection bypass for automation\n </a>{' '}\n in order to display protected deployments in its preview iframe for the\n current Sanity dataset.\n </Text>\n </Box>\n <Box>\n <Text>\n You can turn off automatic protection bypass at any time by clicking the\n button below.\n </Text>\n </Box>\n <Button\n mode=\"ghost\"\n tone=\"critical\"\n icon={<TrashIcon />}\n loading={loading}\n type=\"submit\"\n name={'action' satisfies FormName}\n value={'remove-secret' satisfies FormAction}\n text=\"Remove secret\"\n />\n <Text>\n Protection bypass remains enabled if this plugin is removed from your Sanity\n config.\n </Text>\n </>\n ) : (\n <>\n <Box>\n <Text style={{textWrap: 'pretty'}}>\n Follow the instructions on{' '}\n <a\n href=\"https://vercel.com/docs/security/deployment-protection/methods-to-bypass-deployment-protection/protection-bypass-automation\"\n target=\"_blank\"\n rel=\"noreferrer\"\n >\n how to enable protection bypass for automation\n </a>\n .\n </Text>\n </Box>\n <Box>\n <Text>\n This will setup a secret that Vercel exposes as an environment variable called\n VERCEL_AUTOMATION_BYPASS_SECRET, its value is the secret you need.\n </Text>\n </Box>\n <Button\n mode=\"ghost\"\n icon={<AddIcon />}\n onClick={() => {\n setIsDialogOpen(true)\n }}\n text=\"Add secret\"\n />\n <Text>\n If you&apos;re using Sanity Presentation Tool with multiple protected\n deployments ensure that they have the same secret set, as this tool will set a\n secret that is shared in your dataset with all instances of Presentation Tool.\n </Text>\n </>\n )}\n </Stack>\n </Card>\n </Stack>\n </Box>\n\n <Activity mode={isDialogOpen ? 'visible' : 'hidden'}>\n <Dialog animate id=\"add-secret-dialog\" onClickOutside={() => setIsDialogOpen(false)}>\n <Card as=\"form\" action={formAction} padding={3}>\n <Stack space={3}>\n <Stack space={2}>\n <Text as=\"label\" weight=\"semibold\" size={1}>\n Add bypass secret\n </Text>\n <Text muted size={1}>\n {`Make sure it's the same secret the Vercel deployment is using that's loaded in the preview iframe.`}\n </Text>\n <TextInput\n name={'secret' satisfies FormName}\n onFocus={(event) => {\n event.currentTarget.setCustomValidity('')\n }}\n onBlur={(event) => {\n event.currentTarget.setCustomValidity(\n event.currentTarget.value.length == 32\n ? ''\n : 'Secret must be 32 characters long',\n )\n event.currentTarget.required = true\n }}\n minLength={32}\n maxLength={32}\n autoComplete=\"off\"\n autoCapitalize=\"off\"\n autoCorrect=\"off\"\n spellCheck=\"false\"\n disabled={loading}\n />\n </Stack>\n <Button\n type=\"submit\"\n loading={loading}\n text={loading ? 'Saving…' : 'Save'}\n tone=\"positive\"\n name={'action' satisfies FormName}\n value={'add-secret' satisfies FormAction}\n />\n </Stack>\n </Card>\n </Dialog>\n </Activity>\n </>\n )\n}\n\ntype isBackgroundRefetch = boolean\nfunction useRefetchOnLiveEvent(\n client: SanityClient,\n formState: FormState,\n action: (formData: FormData) => void,\n): isBackgroundRefetch {\n const [isBackgroundRefetch, startTransition] = useTransition()\n const handleLiveEvent = useEffectEvent((event: LiveEvent) => {\n if (event.type === 'message' && event.tags.some((tag) => formState.syncTags.includes(tag))) {\n const formData = new FormData()\n formData.set('action' satisfies FormName, 'refresh-secret' satisfies FormAction)\n formData.set('lastLiveEventId' satisfies FormName, event.id)\n startTransition(() => action(formData))\n }\n })\n useEffect(() => {\n const subscription = client.live.events().subscribe({\n next: handleLiveEvent,\n error: (reason) => console.error(reason),\n })\n\n return () => subscription.unsubscribe()\n }, [client])\n return isBackgroundRefetch\n}\n"],"names":["enableVercelProtectionBypass","client","secret","patch","_id","set","transaction","createIfNotExists","_type","commit","tag","disableVercelProtectionBypass","VercelProtectionBypassTool","$","_c","t0","for","apiVersion","useClient","t1","lastLiveEventId","result","syncTags","fetch","fetchVercelProtectionBypassSecret","filterResponse","fetchSecret","t2","initialStatePromise","useState","t3","width","t4","Layout","push","pushToast","useToast","isDialogOpen","setIsDialogOpen","prevState","formData","action","get","Error","then","status","title","catch","reason_0","console","error","reason","action_0","formState","formAction","isPending","useActionState","use","isBackgroundRefetch","useRefetchOnLiveEvent","loading","enabled","Boolean","height","alignItems","justifyContent","flexDirection","maxWidth","t5","t6","justifyItems","textWrap","t7","t8","t9","t10","t11","t12","_temp","_temp2","t13","t14","t15","t16","t17","event_0","event","currentTarget","setCustomValidity","value","length","required","startTransition","useTransition","type","tags","some","includes","FormData","id","handleLiveEvent","useEffectEvent","live","subscription","events","subscribe","next","_temp3","unsubscribe","useEffect"],"mappings":";;;;;;;AAmCA,eAAeA,6BAA6BC,QAAsBC,QAA+B;AAC/F,QAAMC,QAAQF,OAAOE,MAAMC,8BAAG,EAAEC,IAAI;AAAA,IAACH;AAAAA,EAAAA,CAAO;AAC5C,QAAMD,OAAOK,YAAAA,EAAcC,k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ACR,UAAAoF,eAAqBtG,OAAMqG,KAAKE,OAAAA,EAASC,UAAW;AAAA,MAAAC,MAC5CN;AAAAA,MAAelD,OACdyD;AAAAA,IAAAA,CACR;AAAC,WAEK,MAAMJ,aAAYK,YAAAA;AAAAA,EAAc,GACxC/F,EAAA,CAAA,IAAAZ,OAAAqG,MAAAzF,OAAAuF,iBAAAvF,OAAAM,MAAAA,KAAAN,EAAA,CAAA;AAAA,MAAAc;AAAA,SAAAd,SAAAZ,UAAE0B,KAAA,CAAC1B,MAAM,GAACY,OAAAZ,QAAAY,OAAAc,MAAAA,KAAAd,EAAA,CAAA,GAPXgG,UAAU1F,IAOPQ,EAAQ,GACJ+B;AAAmB;AAtB5B,SAAAiD,OAAAxD,QAAA;AAAA,SAiByBF,QAAOC,MAAOC,MAAM;AAAC;"}
package/dist/index.d.ts CHANGED
@@ -1,9 +1,9 @@
1
- import * as sanity0 from "sanity";
1
+ import { Plugin } from "sanity";
2
2
  interface VercelProtectionBypassConfig {
3
3
  name?: string;
4
4
  title?: string;
5
5
  icon?: React.ComponentType;
6
6
  }
7
- declare const vercelProtectionBypassTool: sanity0.Plugin<void | VercelProtectionBypassConfig>;
7
+ declare const vercelProtectionBypassTool: Plugin<VercelProtectionBypassConfig | void>;
8
8
  export { VercelProtectionBypassConfig, vercelProtectionBypassTool };
9
9
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":["VercelProtectionBypassConfig","React","ComponentType","vercelProtectionBypassTool","sanity0","Plugin"],"sources":["../src/index.d.ts"],"sourcesContent":["export interface VercelProtectionBypassConfig {\n name?: string;\n title?: string;\n icon?: React.ComponentType;\n}\nexport declare const vercelProtectionBypassTool: import(\"sanity\").Plugin<void | VercelProtectionBypassConfig>;\n//# sourceMappingURL=index.d.ts.map"],"mappings":";UAAiBA,4BAAAA;;EAAAA,KAAAA,CAAAA,EAAAA,MAAAA;EAKIG,IAAAA,CAAAA,EAFVF,KAAAA,CAAMC,aAEIC;;cAAAA,4BAAuFC,OAAAA,CAA1CC,cAAcL"}
1
+ {"version":3,"file":"index.d.ts","names":["Plugin","VercelProtectionBypassConfig","React","ComponentType","vercelProtectionBypassTool"],"sources":["../src/index.d.ts"],"sourcesContent":["import { type Plugin } from 'sanity';\nexport interface VercelProtectionBypassConfig {\n name?: string;\n title?: string;\n icon?: React.ComponentType;\n}\nexport declare const vercelProtectionBypassTool: Plugin<VercelProtectionBypassConfig | void>;\n//# sourceMappingURL=index.d.ts.map"],"mappings":";UACiBC,4BAAAA;EAAAA,IAAAA,CAAAA,EAAAA,MAAAA;EAKIG,KAAAA,CAAAA,EAAAA,MAAAA;SAFVF,KAAAA,CAAMC;;cAEIC,4BAA4BJ,OAAOC"}
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../src/index.ts"],"sourcesContent":["import {CheckmarkCircleIcon, CloseCircleIcon, LockIcon} from '@sanity/icons'\nimport {\n vercelProtectionBypassSchemaId as _id,\n vercelProtectionBypassSchemaType as type,\n} from '@sanity/preview-url-secret/constants'\nimport {lazy} from 'react'\nimport {definePlugin, defineType} from 'sanity'\n\nconst id = 'vercel-protection-bypass'\n\nexport interface VercelProtectionBypassConfig {\n name?: string\n title?: string\n icon?: React.ComponentType\n}\n\nconst defaultTitle = 'Vercel Protection Bypass'\nconst schema = defineType({\n type: 'document',\n icon: LockIcon,\n name: type,\n title: defaultTitle,\n readOnly: true,\n fields: [\n {\n type: 'string',\n name: 'secret',\n title: 'Secret',\n },\n ],\n preview: {\n select: {\n secret: 'secret',\n },\n prepare(data) {\n const enabled = data.secret !== null\n return {\n title: enabled ? 'Enabled' : 'Disabled',\n subtitle: defaultTitle,\n media: enabled ? CheckmarkCircleIcon : CloseCircleIcon,\n }\n },\n },\n})\n\nconst VercelProtectionBypassTool = lazy(() => import('./VercelProtectionBypassTool'))\n\nexport const vercelProtectionBypassTool = definePlugin<VercelProtectionBypassConfig | void>(\n (options) => {\n const {\n name = 'vercel-protection-bypass',\n title = 'Vercel Protection Bypass',\n icon = LockIcon,\n ...config\n } = options || {}\n return {\n name: `@sanity/preview-url-secret/${id}`,\n tools: [\n {\n name,\n title,\n icon: icon,\n component: VercelProtectionBypassTool,\n options: config,\n __internalApplicationType: `sanity/${id}`,\n },\n ],\n document: {\n actions: (prev, context) => {\n if (context.schemaType !== type) {\n return prev\n }\n return []\n },\n },\n schema: {types: [schema]},\n }\n },\n)\n"],"names":["id","defaultTitle","schema","defineType","type","icon","LockIcon","name","title","readOnly","fields","preview","select","secret","prepare","data","enabled","subtitle","media","CheckmarkCircleIcon","CloseCircleIcon","VercelProtectionBypassTool","lazy","vercelProtectionBypassTool","definePlugin","options","config","tools","component","__internalApplicationType","document","actions","prev","context","schemaType","types"],"mappings":";;;;AAQA,MAAMA,KAAK,4BAQLC,eAAe,4BACfC,SAASC,WAAW;AAAA,EACxBC,MAAM;AAAA,EACNC,MAAMC;AAAAA,EACNC,MAAMH;AAAAA,EACNI,OAAOP;AAAAA,EACPQ,UAAU;AAAA,EACVC,QAAQ,CACN;AAAA,IACEN,MAAM;AAAA,IACNG,MAAM;AAAA,IACNC,OAAO;AAAA,EAAA,CACR;AAAA,EAEHG,SAAS;AAAA,IACPC,QAAQ;AAAA,MACNC,QAAQ;AAAA,IAAA;AAAA,IAEVC,QAAQC,MAAM;AACZ,YAAMC,UAAUD,KAAKF,WAAW;AAChC,aAAO;AAAA,QACLL,OAAOQ,UAAU,YAAY;AAAA,QAC7BC,UAAUhB;AAAAA,QACViB,OAAOF,UAAUG,sBAAsBC;AAAAA,MAAAA;AAAAA,IAE3C;AAAA,EAAA;AAEJ,CAAC,GAEKC,6BAA6BC,KAAK,MAAM,OAAO,4CAA8B,CAAC,GAEvEC,6BAA6BC,aACvCC,CAAAA,YAAY;AACX,QAAM;AAAA,IACJlB,OAAO;AAAA,IACPC,QAAQ;AAAA,IACRH,OAAOC;AAAAA,IACP,GAAGoB;AAAAA,EAAAA,IACDD,WAAW,CAAA;AACf,SAAO;AAAA,IACLlB,MAAM,8BAA8BP,EAAE;AAAA,IACtC2B,OAAO,CACL;AAAA,MACEpB;AAAAA,MACAC;AAAAA,MACAH;AAAAA,MACAuB,WAAWP;AAAAA,MACXI,SAASC;AAAAA,MACTG,2BAA2B,UAAU7B,EAAE;AAAA,IAAA,CACxC;AAAA,IAEH8B,UAAU;AAAA,MACRC,SAASA,CAACC,MAAMC,YACVA,QAAQC,eAAe9B,mCAClB4B,OAEF,CAAA;AAAA,IAAA;AAAA,IAGX9B,QAAQ;AAAA,MAACiC,OAAO,CAACjC,MAAM;AAAA,IAAA;AAAA,EAAC;AAE5B,CACF;"}
1
+ {"version":3,"file":"index.js","sources":["../src/index.ts"],"sourcesContent":["import {CheckmarkCircleIcon, CloseCircleIcon, LockIcon} from '@sanity/icons'\nimport {\n vercelProtectionBypassSchemaId as _id,\n vercelProtectionBypassSchemaType as type,\n} from '@sanity/preview-url-secret/constants'\nimport {lazy} from 'react'\nimport {definePlugin, defineType, type Plugin} from 'sanity'\n\nconst id = 'vercel-protection-bypass'\n\nexport interface VercelProtectionBypassConfig {\n name?: string\n title?: string\n icon?: React.ComponentType\n}\n\nconst defaultTitle = 'Vercel Protection Bypass'\nconst schema = defineType({\n type: 'document',\n icon: LockIcon,\n name: type,\n title: defaultTitle,\n readOnly: true,\n fields: [\n {\n type: 'string',\n name: 'secret',\n title: 'Secret',\n },\n ],\n preview: {\n select: {\n secret: 'secret',\n },\n prepare(data) {\n const enabled = data.secret !== null\n return {\n title: enabled ? 'Enabled' : 'Disabled',\n subtitle: defaultTitle,\n media: enabled ? CheckmarkCircleIcon : CloseCircleIcon,\n }\n },\n },\n})\n\nconst VercelProtectionBypassTool = lazy(() => import('./VercelProtectionBypassTool'))\n\nexport const vercelProtectionBypassTool: Plugin<VercelProtectionBypassConfig | void> = definePlugin(\n (options) => {\n const {\n name = 'vercel-protection-bypass',\n title = 'Vercel Protection Bypass',\n icon = LockIcon,\n ...config\n } = options || {}\n return {\n name: `@sanity/preview-url-secret/${id}`,\n tools: [\n {\n name,\n title,\n icon: icon,\n component: VercelProtectionBypassTool,\n options: config,\n __internalApplicationType: `sanity/${id}`,\n },\n ],\n document: {\n actions: (prev, context) => {\n if (context.schemaType !== type) {\n return prev\n }\n return []\n },\n },\n schema: {types: [schema]},\n }\n },\n)\n"],"names":["id","defaultTitle","schema","defineType","type","icon","LockIcon","name","title","readOnly","fields","preview","select","secret","prepare","data","enabled","subtitle","media","CheckmarkCircleIcon","CloseCircleIcon","VercelProtectionBypassTool","lazy","vercelProtectionBypassTool","definePlugin","options","config","tools","component","__internalApplicationType","document","actions","prev","context","schemaType","types"],"mappings":";;;;AAQA,MAAMA,KAAK,4BAQLC,eAAe,4BACfC,SAASC,WAAW;AAAA,EACxBC,MAAM;AAAA,EACNC,MAAMC;AAAAA,EACNC,MAAMH;AAAAA,EACNI,OAAOP;AAAAA,EACPQ,UAAU;AAAA,EACVC,QAAQ,CACN;AAAA,IACEN,MAAM;AAAA,IACNG,MAAM;AAAA,IACNC,OAAO;AAAA,EAAA,CACR;AAAA,EAEHG,SAAS;AAAA,IACPC,QAAQ;AAAA,MACNC,QAAQ;AAAA,IAAA;AAAA,IAEVC,QAAQC,MAAM;AACZ,YAAMC,UAAUD,KAAKF,WAAW;AAChC,aAAO;AAAA,QACLL,OAAOQ,UAAU,YAAY;AAAA,QAC7BC,UAAUhB;AAAAA,QACViB,OAAOF,UAAUG,sBAAsBC;AAAAA,MAAAA;AAAAA,IAE3C;AAAA,EAAA;AAEJ,CAAC,GAEKC,6BAA6BC,KAAK,MAAM,OAAO,4CAA8B,CAAC,GAEvEC,6BAA0EC,aACpFC,CAAAA,YAAY;AACX,QAAM;AAAA,IACJlB,OAAO;AAAA,IACPC,QAAQ;AAAA,IACRH,OAAOC;AAAAA,IACP,GAAGoB;AAAAA,EAAAA,IACDD,WAAW,CAAA;AACf,SAAO;AAAA,IACLlB,MAAM,8BAA8BP,EAAE;AAAA,IACtC2B,OAAO,CACL;AAAA,MACEpB;AAAAA,MACAC;AAAAA,MACAH;AAAAA,MACAuB,WAAWP;AAAAA,MACXI,SAASC;AAAAA,MACTG,2BAA2B,UAAU7B,EAAE;AAAA,IAAA,CACxC;AAAA,IAEH8B,UAAU;AAAA,MACRC,SAASA,CAACC,MAAMC,YACVA,QAAQC,eAAe9B,mCAClB4B,OAEF,CAAA;AAAA,IAAA;AAAA,IAGX9B,QAAQ;AAAA,MAACiC,OAAO,CAACjC,MAAM;AAAA,IAAA;AAAA,EAAC;AAE5B,CACF;"}
package/package.json CHANGED
@@ -1,6 +1,12 @@
1
1
  {
2
2
  "name": "@sanity/vercel-protection-bypass",
3
- "version": "4.0.5",
3
+ "version": "5.0.0",
4
+ "keywords": [
5
+ "sanity",
6
+ "sanity-plugin",
7
+ "studio",
8
+ "vercel"
9
+ ],
4
10
  "homepage": "https://github.com/sanity-io/plugins/tree/main/plugins/%40sanity/vercel-protection-bypass#readme",
5
11
  "bugs": {
6
12
  "url": "https://github.com/sanity-io/plugins/issues"
@@ -10,14 +16,8 @@
10
16
  "url": "git+ssh://git@github.com/sanity-io/plugins.git",
11
17
  "directory": "plugins/@sanity/vercel-protection-bypass"
12
18
  },
13
- "keywords": [
14
- "sanity",
15
- "studio",
16
- "sanity-plugin",
17
- "vercel"
18
- ],
19
- "license": "MIT",
20
19
  "author": "Sanity.io <hello@sanity.io>",
20
+ "license": "MIT",
21
21
  "type": "module",
22
22
  "exports": {
23
23
  ".": "./dist/index.js",
@@ -25,8 +25,7 @@
25
25
  },
26
26
  "types": "./dist/index.d.ts",
27
27
  "files": [
28
- "dist",
29
- "CHANGELOG.md"
28
+ "dist"
30
29
  ],
31
30
  "dependencies": {
32
31
  "@sanity/icons": "^3.7.4",
@@ -34,29 +33,28 @@
34
33
  "@sanity/ui": "^3.1.11"
35
34
  },
36
35
  "devDependencies": {
37
- "@sanity/client": "7.13.1",
38
- "@sanity/pkg-utils": "^10.1.2",
36
+ "@sanity/client": "7.13.2",
37
+ "@sanity/pkg-utils": "^10.2.1",
39
38
  "@types/react": "^19.2.7",
40
- "@typescript/native-preview": "7.0.0-dev.20251205.1",
39
+ "@typescript/native-preview": "7.0.0-dev.20251216.1",
41
40
  "babel-plugin-react-compiler": "^1.0.0",
42
- "eslint": "^9.39.1",
43
- "react": "^19.2.1",
44
- "sanity": "^4.20.3",
41
+ "eslint": "^9.39.2",
42
+ "react": "^19.2.3",
43
+ "sanity": "^5.0.0",
45
44
  "typescript": "5.9.3",
46
- "@repo/eslint-config": "0.0.5",
45
+ "@repo/eslint-config": "0.0.7",
47
46
  "@repo/package.config": "0.0.0",
48
47
  "@repo/tsconfig": "1.0.0"
49
48
  },
50
49
  "peerDependencies": {
51
50
  "react": "^19.2",
52
- "sanity": "^4.0.0-0 || ^5.0.0-0"
51
+ "sanity": "^5.0.0-0"
53
52
  },
54
53
  "engines": {
55
54
  "node": ">=20.19 <22 || >=22.12"
56
55
  },
57
56
  "scripts": {
58
57
  "build": "pkg build --strict --check --clean",
59
- "lint": "eslint .",
60
- "typecheck": "(cd ../../.. && tsgo --project plugins/@sanity/vercel-protection-bypass/tsconfig.json)"
58
+ "lint": "eslint ."
61
59
  }
62
60
  }
package/CHANGELOG.md DELETED
@@ -1,323 +0,0 @@
1
- # @sanity/vercel-protection-bypass
2
-
3
- ## 4.0.5
4
-
5
- ### Patch Changes
6
-
7
- - [`69a8d2f`](https://github.com/sanity-io/plugins/commit/69a8d2f8ce1e8f5b342e7066dbc79a20b6687abe) Thanks [@stipsan](https://github.com/stipsan)! - Declare support for Studio v5
8
-
9
- ## 4.0.4
10
-
11
- ### Patch Changes
12
-
13
- - [#130](https://github.com/sanity-io/plugins/pull/130) [`4399a30`](https://github.com/sanity-io/plugins/commit/4399a3093607d330942791e2f23981906cb8b56d) Thanks [@stipsan](https://github.com/stipsan)! - Improve quality of generated dts
14
-
15
- ## 4.0.3
16
-
17
- ### Patch Changes
18
-
19
- - [#81](https://github.com/sanity-io/plugins/pull/81) [`33d90c3`](https://github.com/sanity-io/plugins/commit/33d90c3af0732b0b8e890cc87e12ab6a95b818b5) Thanks [@stipsan](https://github.com/stipsan)! - Improve react lazy loading
20
-
21
- ## 4.0.2
22
-
23
- ### Patch Changes
24
-
25
- - [#30](https://github.com/sanity-io/plugins/pull/30) [`5307c0d`](https://github.com/sanity-io/plugins/commit/5307c0d3add079e5e8a16defbfac7016a84784f6) Thanks [@renovate](https://github.com/apps/renovate)! - fix(deps): Update dependency @sanity/preview-url-secret to v3
26
-
27
- ## 4.0.1
28
-
29
- ### Patch Changes
30
-
31
- - [`c934098`](https://github.com/sanity-io/plugins/commit/c9340986f5af78de17e1277a7362b2d18cd59537) Thanks [@stipsan](https://github.com/stipsan)! - Target React 19 in React Compiler
32
-
33
- ## 4.0.0
34
-
35
- ### Major Changes
36
-
37
- - [#26](https://github.com/sanity-io/plugins/pull/26) [`32fb288`](https://github.com/sanity-io/plugins/commit/32fb28823efb7b99b8c884dca475ab16fef4883a) Thanks [@stipsan](https://github.com/stipsan)! - Require React 19.2 or later
38
-
39
- - [#26](https://github.com/sanity-io/plugins/pull/26) [`32fb288`](https://github.com/sanity-io/plugins/commit/32fb28823efb7b99b8c884dca475ab16fef4883a) Thanks [@stipsan](https://github.com/stipsan)! - Require Sanity Studio v4
40
-
41
- ## 3.1.0
42
-
43
- ### Minor Changes
44
-
45
- - [`d090d93`](https://github.com/sanity-io/plugins/commit/d090d939e29a2aa46ccf1e1f18a63eb383630bdd) Thanks [@stipsan](https://github.com/stipsan)! - Add schema type for debugging
46
-
47
- ### Patch Changes
48
-
49
- - [`4f82b31`](https://github.com/sanity-io/plugins/commit/4f82b3120b3006821a74f444589ac3e752475c4e) Thanks [@stipsan](https://github.com/stipsan)! - Stop publishing src folder to npm
50
-
51
- ## 3.0.0
52
-
53
- ### Major Changes
54
-
55
- - [#11](https://github.com/sanity-io/plugins/pull/11) [`d2283b2`](https://github.com/sanity-io/plugins/commit/d2283b2cb214f8c3478e986f0afa06180343dd35) Thanks [@stipsan](https://github.com/stipsan)! - Set node engines to minimum v22.12 in addition to the existing required v20.19 or later
56
-
57
- - [#11](https://github.com/sanity-io/plugins/pull/11) [`d2283b2`](https://github.com/sanity-io/plugins/commit/d2283b2cb214f8c3478e986f0afa06180343dd35) Thanks [@stipsan](https://github.com/stipsan)! - Remove CJS, this package is now ESM-only
58
-
59
- ### Patch Changes
60
-
61
- - [#8](https://github.com/sanity-io/plugins/pull/8) [`17e4495`](https://github.com/sanity-io/plugins/commit/17e44959f157bf6b7239db06f19aec31265d7ca9) Thanks [@renovate](https://github.com/apps/renovate)! - fix(deps): Update dependency @sanity/preview-url-secret to ^2.1.16
62
-
63
- - [`2bda9e1`](https://github.com/sanity-io/plugins/commit/2bda9e147d8bf98b59c83b12b994f821262b7689) Thanks [@stipsan](https://github.com/stipsan)! - Reduce reliance on `@sanity/preview-url-secret`
64
-
65
- ## 2.1.1
66
-
67
- ### Patch Changes
68
-
69
- - [#3](https://github.com/sanity-io/plugins/pull/3) [`0c47c28`](https://github.com/sanity-io/plugins/commit/0c47c28f5709863712d92f4fcfd24ae7dac8b468) Thanks [@stipsan](https://github.com/stipsan)! - Setup npm Trusted Publishing
70
-
71
- ## [2.1.0](https://github.com/sanity-io/visual-editing/compare/vercel-protection-bypass-v2.0.2...vercel-protection-bypass-v2.1.0) (2025-10-15)
72
-
73
- ### Features
74
-
75
- - upgrade to react compiler v1 ([#3255](https://github.com/sanity-io/visual-editing/issues/3255)) ([89565e6](https://github.com/sanity-io/visual-editing/commit/89565e6304d710f5970630a0e40519998725d31e))
76
-
77
- ## [2.0.2](https://github.com/sanity-io/visual-editing/compare/vercel-protection-bypass-v2.0.1...vercel-protection-bypass-v2.0.2) (2025-09-09)
78
-
79
- ### Dependencies
80
-
81
- - The following workspace dependencies were updated
82
- - dependencies
83
- - @sanity/preview-url-secret bumped to 2.1.15
84
-
85
- ## [2.0.1](https://github.com/sanity-io/visual-editing/compare/vercel-protection-bypass-v2.0.0...vercel-protection-bypass-v2.0.1) (2025-09-05)
86
-
87
- ### Bug Fixes
88
-
89
- - use stable react, next and sanity peer dep ranges ([e58d995](https://github.com/sanity-io/visual-editing/commit/e58d995d57beba1e74f9ec7a2c15831c5cc04446))
90
-
91
- ## [2.0.0](https://github.com/sanity-io/visual-editing/compare/vercel-protection-bypass-v1.0.26...vercel-protection-bypass-v2.0.0) (2025-07-24)
92
-
93
- ### ⚠ BREAKING CHANGES
94
-
95
- - **deps:** update dependency @sanity/ui to v3 (main) ([#3150](https://github.com/sanity-io/visual-editing/issues/3150))
96
-
97
- ### Bug Fixes
98
-
99
- - **deps:** update dependency @sanity/ui to v3 (main) ([#3150](https://github.com/sanity-io/visual-editing/issues/3150)) ([6da470d](https://github.com/sanity-io/visual-editing/commit/6da470daa1591521a7b091b817fb5e39d6f4b562))
100
-
101
- ## [1.0.26](https://github.com/sanity-io/visual-editing/compare/vercel-protection-bypass-v1.0.25...vercel-protection-bypass-v1.0.26) (2025-07-21)
102
-
103
- ### Bug Fixes
104
-
105
- - **deps:** update dependency @sanity/pkg-utils to v7 ([#3125](https://github.com/sanity-io/visual-editing/issues/3125)) ([58d123b](https://github.com/sanity-io/visual-editing/commit/58d123bace5c58f634f239bea88e1d975ec5c963))
106
-
107
- ### Dependencies
108
-
109
- - The following workspace dependencies were updated
110
- - dependencies
111
- - @sanity/preview-url-secret bumped to 2.1.14
112
-
113
- ## [1.0.25](https://github.com/sanity-io/visual-editing/compare/vercel-protection-bypass-v1.0.24...vercel-protection-bypass-v1.0.25) (2025-07-17)
114
-
115
- ### Dependencies
116
-
117
- - The following workspace dependencies were updated
118
- - dependencies
119
- - @sanity/preview-url-secret bumped to 2.1.13
120
-
121
- ## [1.0.24](https://github.com/sanity-io/visual-editing/compare/vercel-protection-bypass-v1.0.23...vercel-protection-bypass-v1.0.24) (2025-07-10)
122
-
123
- ### Bug Fixes
124
-
125
- - allow sanity v4 in deps range ([d6d1e64](https://github.com/sanity-io/visual-editing/commit/d6d1e6453319f521945ffa7525164d911d5964bf))
126
-
127
- ### Dependencies
128
-
129
- - The following workspace dependencies were updated
130
- - dependencies
131
- - @sanity/preview-url-secret bumped to 2.1.12
132
-
133
- ## [1.0.23](https://github.com/sanity-io/visual-editing/compare/vercel-protection-bypass-v1.0.22...vercel-protection-bypass-v1.0.23) (2025-05-29)
134
-
135
- ### Bug Fixes
136
-
137
- - **deps:** update react compiler dependencies 🤖 ✨ ([#2994](https://github.com/sanity-io/visual-editing/issues/2994)) ([0388fb0](https://github.com/sanity-io/visual-editing/commit/0388fb0bb9ea6f4fa3686c65d51029aa68104954))
138
-
139
- ## [1.0.22](https://github.com/sanity-io/visual-editing/compare/vercel-protection-bypass-v1.0.21...vercel-protection-bypass-v1.0.22) (2025-05-07)
140
-
141
- ### Dependencies
142
-
143
- - The following workspace dependencies were updated
144
- - dependencies
145
- - @sanity/preview-url-secret bumped to 2.1.11
146
-
147
- ## [1.0.21](https://github.com/sanity-io/visual-editing/compare/vercel-protection-bypass-v1.0.20...vercel-protection-bypass-v1.0.21) (2025-04-30)
148
-
149
- ### Dependencies
150
-
151
- - The following workspace dependencies were updated
152
- - dependencies
153
- - @sanity/preview-url-secret bumped to 2.1.10
154
-
155
- ## [1.0.20](https://github.com/sanity-io/visual-editing/compare/vercel-protection-bypass-v1.0.19...vercel-protection-bypass-v1.0.20) (2025-04-30)
156
-
157
- ### Bug Fixes
158
-
159
- - **deps:** upgrade to react compiler RC ([29a886b](https://github.com/sanity-io/visual-editing/commit/29a886b6ff0b498379d6931ad154976f4bcfad29))
160
-
161
- ### Dependencies
162
-
163
- - The following workspace dependencies were updated
164
- - dependencies
165
- - @sanity/preview-url-secret bumped to 2.1.9
166
-
167
- ## [1.0.19](https://github.com/sanity-io/visual-editing/compare/vercel-protection-bypass-v1.0.18...vercel-protection-bypass-v1.0.19) (2025-04-11)
168
-
169
- ### Bug Fixes
170
-
171
- - **deps:** update dependency @sanity/client to ^6.29.0 ([2a8ff1e](https://github.com/sanity-io/visual-editing/commit/2a8ff1e9369b8a27bb3c122d5f5f9046be43c5a1))
172
-
173
- ### Dependencies
174
-
175
- - The following workspace dependencies were updated
176
- - dependencies
177
- - @sanity/preview-url-secret bumped to 2.1.8
178
-
179
- ## [1.0.18](https://github.com/sanity-io/visual-editing/compare/vercel-protection-bypass-v1.0.17...vercel-protection-bypass-v1.0.18) (2025-04-10)
180
-
181
- ### Bug Fixes
182
-
183
- - **deps:** update react compiler dependencies 🤖 ✨ ([#2897](https://github.com/sanity-io/visual-editing/issues/2897)) ([5c72b41](https://github.com/sanity-io/visual-editing/commit/5c72b41985886c0459230a3b3762a469073ef5f9))
184
-
185
- ## [1.0.17](https://github.com/sanity-io/visual-editing/compare/vercel-protection-bypass-v1.0.16...vercel-protection-bypass-v1.0.17) (2025-04-01)
186
-
187
- ### Bug Fixes
188
-
189
- - **deps:** update react compiler dependencies 🤖 ✨ ([#2878](https://github.com/sanity-io/visual-editing/issues/2878)) ([664abd9](https://github.com/sanity-io/visual-editing/commit/664abd900471eefa9b2c71163efb36909db1aa71))
190
-
191
- ### Dependencies
192
-
193
- - The following workspace dependencies were updated
194
- - dependencies
195
- - @sanity/preview-url-secret bumped to 2.1.7
196
-
197
- ## [1.0.16](https://github.com/sanity-io/visual-editing/compare/vercel-protection-bypass-v1.0.15...vercel-protection-bypass-v1.0.16) (2025-03-24)
198
-
199
- ### Bug Fixes
200
-
201
- - **deps:** update react compiler dependencies 🤖 ✨ ([#2856](https://github.com/sanity-io/visual-editing/issues/2856)) ([5d1e4bb](https://github.com/sanity-io/visual-editing/commit/5d1e4bbc6e7691873f8902a63fe2f586f9f87193))
202
-
203
- ## [1.0.15](https://github.com/sanity-io/visual-editing/compare/vercel-protection-bypass-v1.0.14...vercel-protection-bypass-v1.0.15) (2025-03-17)
204
-
205
- ### Bug Fixes
206
-
207
- - **deps:** update react compiler dependencies 🤖 ✨ ([#2827](https://github.com/sanity-io/visual-editing/issues/2827)) ([a72e9b8](https://github.com/sanity-io/visual-editing/commit/a72e9b8fb63420ea95038b93ab4315e836255860))
208
-
209
- ## [1.0.14](https://github.com/sanity-io/visual-editing/compare/vercel-protection-bypass-v1.0.13...vercel-protection-bypass-v1.0.14) (2025-03-12)
210
-
211
- ### Bug Fixes
212
-
213
- - **deps:** update React Compiler dependencies 🤖 ✨ ([#2800](https://github.com/sanity-io/visual-editing/issues/2800)) ([371b821](https://github.com/sanity-io/visual-editing/commit/371b821a2dcf0d31f6521e7a67c58586c658861b))
214
-
215
- ### Dependencies
216
-
217
- - The following workspace dependencies were updated
218
- - dependencies
219
- - @sanity/preview-url-secret bumped to 2.1.6
220
-
221
- ## [1.0.13](https://github.com/sanity-io/visual-editing/compare/vercel-protection-bypass-v1.0.12...vercel-protection-bypass-v1.0.13) (2025-03-03)
222
-
223
- ### Bug Fixes
224
-
225
- - **deps:** update react compiler dependencies 🤖 ✨ ([#2774](https://github.com/sanity-io/visual-editing/issues/2774)) ([3fed1f2](https://github.com/sanity-io/visual-editing/commit/3fed1f28be50a96ab84a9b38fe09129dcfd35120))
226
-
227
- ### Dependencies
228
-
229
- - The following workspace dependencies were updated
230
- - dependencies
231
- - @sanity/preview-url-secret bumped to 2.1.5
232
-
233
- ## [1.0.12](https://github.com/sanity-io/visual-editing/compare/vercel-protection-bypass-v1.0.11...vercel-protection-bypass-v1.0.12) (2025-02-24)
234
-
235
- ### Bug Fixes
236
-
237
- - **deps:** update react compiler dependencies 🤖 ✨ ([#2745](https://github.com/sanity-io/visual-editing/issues/2745)) ([c185f58](https://github.com/sanity-io/visual-editing/commit/c185f580b323fc168c42ea625d0b7e638d47a6be))
238
-
239
- ## [1.0.11](https://github.com/sanity-io/visual-editing/compare/vercel-protection-bypass-v1.0.10...vercel-protection-bypass-v1.0.11) (2025-02-17)
240
-
241
- ### Bug Fixes
242
-
243
- - **deps:** update react compiler dependencies 🤖 ✨ ([#2694](https://github.com/sanity-io/visual-editing/issues/2694)) ([b80c478](https://github.com/sanity-io/visual-editing/commit/b80c478c7e88d45bf730f67f01cb0bbbe3a70aba))
244
-
245
- ## [1.0.10](https://github.com/sanity-io/visual-editing/compare/vercel-protection-bypass-v1.0.9...vercel-protection-bypass-v1.0.10) (2025-02-10)
246
-
247
- ### Bug Fixes
248
-
249
- - **deps:** update react compiler dependencies 🤖 ✨ ([#2651](https://github.com/sanity-io/visual-editing/issues/2651)) ([0692000](https://github.com/sanity-io/visual-editing/commit/069200095a0e0616b9f81c1b20c937e99ad4d8ad))
250
-
251
- ## [1.0.9](https://github.com/sanity-io/visual-editing/compare/vercel-protection-bypass-v1.0.8...vercel-protection-bypass-v1.0.9) (2025-02-04)
252
-
253
- ### Bug Fixes
254
-
255
- - **deps:** update react compiler dependencies 🤖 ✨ ([#2604](https://github.com/sanity-io/visual-editing/issues/2604)) ([60f5349](https://github.com/sanity-io/visual-editing/commit/60f534928cca0aaf1bf429f13cc56c5658fa9219))
256
-
257
- ## [1.0.8](https://github.com/sanity-io/visual-editing/compare/vercel-protection-bypass-v1.0.7...vercel-protection-bypass-v1.0.8) (2025-01-28)
258
-
259
- ### Dependencies
260
-
261
- - The following workspace dependencies were updated
262
- - dependencies
263
- - @sanity/preview-url-secret bumped to 2.1.4
264
-
265
- ## [1.0.7](https://github.com/sanity-io/visual-editing/compare/vercel-protection-bypass-v1.0.6...vercel-protection-bypass-v1.0.7) (2025-01-27)
266
-
267
- ### Bug Fixes
268
-
269
- - **deps:** update react compiler dependencies 🤖 ✨ ([#2565](https://github.com/sanity-io/visual-editing/issues/2565)) ([74fdcdd](https://github.com/sanity-io/visual-editing/commit/74fdcddacb7ef02748cf729b67c6cdbb4c3647e2))
270
-
271
- ## [1.0.6](https://github.com/sanity-io/visual-editing/compare/vercel-protection-bypass-v1.0.5...vercel-protection-bypass-v1.0.6) (2025-01-23)
272
-
273
- ### Dependencies
274
-
275
- - The following workspace dependencies were updated
276
- - dependencies
277
- - @sanity/preview-url-secret bumped to 2.1.3
278
-
279
- ## [1.0.5](https://github.com/sanity-io/visual-editing/compare/vercel-protection-bypass-v1.0.4...vercel-protection-bypass-v1.0.5) (2025-01-22)
280
-
281
- ### Dependencies
282
-
283
- - The following workspace dependencies were updated
284
- - dependencies
285
- - @sanity/preview-url-secret bumped to 2.1.2
286
-
287
- ## [1.0.4](https://github.com/sanity-io/visual-editing/compare/vercel-protection-bypass-v1.0.3...vercel-protection-bypass-v1.0.4) (2025-01-22)
288
-
289
- ### Dependencies
290
-
291
- - The following workspace dependencies were updated
292
- - dependencies
293
- - @sanity/preview-url-secret bumped to 2.1.1
294
-
295
- ## [1.0.3](https://github.com/sanity-io/visual-editing/compare/vercel-protection-bypass-v1.0.2...vercel-protection-bypass-v1.0.3) (2025-01-21)
296
-
297
- ### Bug Fixes
298
-
299
- - **deps:** update dependency @sanity/ui to v2.11.4 ([#2533](https://github.com/sanity-io/visual-editing/issues/2533)) ([800f6fd](https://github.com/sanity-io/visual-editing/commit/800f6fd468dfe79e6db0cb76cfa38e02d2af85df))
300
-
301
- ## [1.0.2](https://github.com/sanity-io/visual-editing/compare/vercel-protection-bypass-v1.0.1...vercel-protection-bypass-v1.0.2) (2025-01-20)
302
-
303
- ### Bug Fixes
304
-
305
- - **deps:** update react compiler dependencies 🤖 ✨ ([#2529](https://github.com/sanity-io/visual-editing/issues/2529)) ([72897c6](https://github.com/sanity-io/visual-editing/commit/72897c6ee5529611788d39626f7bb7329a47a9a5))
306
-
307
- ## [1.0.1](https://github.com/sanity-io/visual-editing/compare/vercel-protection-bypass-v1.0.0...vercel-protection-bypass-v1.0.1) (2025-01-13)
308
-
309
- ### Bug Fixes
310
-
311
- - **deps:** update react compiler dependencies 🤖 ✨ ([#2483](https://github.com/sanity-io/visual-editing/issues/2483)) ([e059b2e](https://github.com/sanity-io/visual-editing/commit/e059b2ee1461c519b1cc042382762b9a060cd103))
312
-
313
- ## 1.0.0 (2025-01-10)
314
-
315
- ### Features
316
-
317
- - add Vercel Protection Bypass tool ([#2479](https://github.com/sanity-io/visual-editing/issues/2479)) ([7e58143](https://github.com/sanity-io/visual-editing/commit/7e58143e3f70751dbd424641045b218d7e9085b4))
318
-
319
- ### Dependencies
320
-
321
- - The following workspace dependencies were updated
322
- - dependencies
323
- - @sanity/preview-url-secret bumped to 2.1.0