@sanity/vercel-protection-bypass 2.1.1-canary.2 → 2.1.1

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/CHANGELOG.md CHANGED
@@ -1,294 +1,261 @@
1
- # Changelog
1
+ # @sanity/vercel-protection-bypass
2
2
 
3
- ## [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)
3
+ ## 2.1.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#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
4
8
 
9
+ ## [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)
5
10
 
6
11
  ### Features
7
12
 
8
- * 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))
13
+ - 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))
9
14
 
10
15
  ## [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)
11
16
 
12
-
13
17
  ### Dependencies
14
18
 
15
- * The following workspace dependencies were updated
16
- * dependencies
17
- * @sanity/preview-url-secret bumped to 2.1.15
19
+ - The following workspace dependencies were updated
20
+ - dependencies
21
+ - @sanity/preview-url-secret bumped to 2.1.15
18
22
 
19
23
  ## [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)
20
24
 
21
-
22
25
  ### Bug Fixes
23
26
 
24
- * use stable react, next and sanity peer dep ranges ([e58d995](https://github.com/sanity-io/visual-editing/commit/e58d995d57beba1e74f9ec7a2c15831c5cc04446))
27
+ - use stable react, next and sanity peer dep ranges ([e58d995](https://github.com/sanity-io/visual-editing/commit/e58d995d57beba1e74f9ec7a2c15831c5cc04446))
25
28
 
26
29
  ## [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)
27
30
 
28
-
29
31
  ### ⚠ BREAKING CHANGES
30
32
 
31
- * **deps:** update dependency @sanity/ui to v3 (main) ([#3150](https://github.com/sanity-io/visual-editing/issues/3150))
33
+ - **deps:** update dependency @sanity/ui to v3 (main) ([#3150](https://github.com/sanity-io/visual-editing/issues/3150))
32
34
 
33
35
  ### Bug Fixes
34
36
 
35
- * **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))
37
+ - **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))
36
38
 
37
39
  ## [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)
38
40
 
39
-
40
41
  ### Bug Fixes
41
42
 
42
- * **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))
43
-
43
+ - **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))
44
44
 
45
45
  ### Dependencies
46
46
 
47
- * The following workspace dependencies were updated
48
- * dependencies
49
- * @sanity/preview-url-secret bumped to 2.1.14
47
+ - The following workspace dependencies were updated
48
+ - dependencies
49
+ - @sanity/preview-url-secret bumped to 2.1.14
50
50
 
51
51
  ## [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)
52
52
 
53
-
54
53
  ### Dependencies
55
54
 
56
- * The following workspace dependencies were updated
57
- * dependencies
58
- * @sanity/preview-url-secret bumped to 2.1.13
55
+ - The following workspace dependencies were updated
56
+ - dependencies
57
+ - @sanity/preview-url-secret bumped to 2.1.13
59
58
 
60
59
  ## [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)
61
60
 
62
-
63
61
  ### Bug Fixes
64
62
 
65
- * allow sanity v4 in deps range ([d6d1e64](https://github.com/sanity-io/visual-editing/commit/d6d1e6453319f521945ffa7525164d911d5964bf))
66
-
63
+ - allow sanity v4 in deps range ([d6d1e64](https://github.com/sanity-io/visual-editing/commit/d6d1e6453319f521945ffa7525164d911d5964bf))
67
64
 
68
65
  ### Dependencies
69
66
 
70
- * The following workspace dependencies were updated
71
- * dependencies
72
- * @sanity/preview-url-secret bumped to 2.1.12
67
+ - The following workspace dependencies were updated
68
+ - dependencies
69
+ - @sanity/preview-url-secret bumped to 2.1.12
73
70
 
74
71
  ## [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)
75
72
 
76
-
77
73
  ### Bug Fixes
78
74
 
79
- * **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))
75
+ - **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))
80
76
 
81
77
  ## [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)
82
78
 
83
-
84
79
  ### Dependencies
85
80
 
86
- * The following workspace dependencies were updated
87
- * dependencies
88
- * @sanity/preview-url-secret bumped to 2.1.11
81
+ - The following workspace dependencies were updated
82
+ - dependencies
83
+ - @sanity/preview-url-secret bumped to 2.1.11
89
84
 
90
85
  ## [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)
91
86
 
92
-
93
87
  ### Dependencies
94
88
 
95
- * The following workspace dependencies were updated
96
- * dependencies
97
- * @sanity/preview-url-secret bumped to 2.1.10
89
+ - The following workspace dependencies were updated
90
+ - dependencies
91
+ - @sanity/preview-url-secret bumped to 2.1.10
98
92
 
99
93
  ## [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)
100
94
 
101
-
102
95
  ### Bug Fixes
103
96
 
104
- * **deps:** upgrade to react compiler RC ([29a886b](https://github.com/sanity-io/visual-editing/commit/29a886b6ff0b498379d6931ad154976f4bcfad29))
105
-
97
+ - **deps:** upgrade to react compiler RC ([29a886b](https://github.com/sanity-io/visual-editing/commit/29a886b6ff0b498379d6931ad154976f4bcfad29))
106
98
 
107
99
  ### Dependencies
108
100
 
109
- * The following workspace dependencies were updated
110
- * dependencies
111
- * @sanity/preview-url-secret bumped to 2.1.9
101
+ - The following workspace dependencies were updated
102
+ - dependencies
103
+ - @sanity/preview-url-secret bumped to 2.1.9
112
104
 
113
105
  ## [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)
114
106
 
115
-
116
107
  ### Bug Fixes
117
108
 
118
- * **deps:** update dependency @sanity/client to ^6.29.0 ([2a8ff1e](https://github.com/sanity-io/visual-editing/commit/2a8ff1e9369b8a27bb3c122d5f5f9046be43c5a1))
119
-
109
+ - **deps:** update dependency @sanity/client to ^6.29.0 ([2a8ff1e](https://github.com/sanity-io/visual-editing/commit/2a8ff1e9369b8a27bb3c122d5f5f9046be43c5a1))
120
110
 
121
111
  ### Dependencies
122
112
 
123
- * The following workspace dependencies were updated
124
- * dependencies
125
- * @sanity/preview-url-secret bumped to 2.1.8
113
+ - The following workspace dependencies were updated
114
+ - dependencies
115
+ - @sanity/preview-url-secret bumped to 2.1.8
126
116
 
127
117
  ## [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)
128
118
 
129
-
130
119
  ### Bug Fixes
131
120
 
132
- * **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))
121
+ - **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))
133
122
 
134
123
  ## [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)
135
124
 
136
-
137
125
  ### Bug Fixes
138
126
 
139
- * **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))
140
-
127
+ - **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))
141
128
 
142
129
  ### Dependencies
143
130
 
144
- * The following workspace dependencies were updated
145
- * dependencies
146
- * @sanity/preview-url-secret bumped to 2.1.7
131
+ - The following workspace dependencies were updated
132
+ - dependencies
133
+ - @sanity/preview-url-secret bumped to 2.1.7
147
134
 
148
135
  ## [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)
149
136
 
150
-
151
137
  ### Bug Fixes
152
138
 
153
- * **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))
139
+ - **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))
154
140
 
155
141
  ## [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)
156
142
 
157
-
158
143
  ### Bug Fixes
159
144
 
160
- * **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))
145
+ - **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))
161
146
 
162
147
  ## [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)
163
148
 
164
-
165
149
  ### Bug Fixes
166
150
 
167
- * **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))
168
-
151
+ - **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))
169
152
 
170
153
  ### Dependencies
171
154
 
172
- * The following workspace dependencies were updated
173
- * dependencies
174
- * @sanity/preview-url-secret bumped to 2.1.6
155
+ - The following workspace dependencies were updated
156
+ - dependencies
157
+ - @sanity/preview-url-secret bumped to 2.1.6
175
158
 
176
159
  ## [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)
177
160
 
178
-
179
161
  ### Bug Fixes
180
162
 
181
- * **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))
182
-
163
+ - **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))
183
164
 
184
165
  ### Dependencies
185
166
 
186
- * The following workspace dependencies were updated
187
- * dependencies
188
- * @sanity/preview-url-secret bumped to 2.1.5
167
+ - The following workspace dependencies were updated
168
+ - dependencies
169
+ - @sanity/preview-url-secret bumped to 2.1.5
189
170
 
190
171
  ## [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)
191
172
 
192
-
193
173
  ### Bug Fixes
194
174
 
195
- * **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))
175
+ - **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))
196
176
 
197
177
  ## [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)
198
178
 
199
-
200
179
  ### Bug Fixes
201
180
 
202
- * **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))
181
+ - **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))
203
182
 
204
183
  ## [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)
205
184
 
206
-
207
185
  ### Bug Fixes
208
186
 
209
- * **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))
187
+ - **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))
210
188
 
211
189
  ## [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)
212
190
 
213
-
214
191
  ### Bug Fixes
215
192
 
216
- * **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))
193
+ - **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))
217
194
 
218
195
  ## [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)
219
196
 
220
-
221
197
  ### Dependencies
222
198
 
223
- * The following workspace dependencies were updated
224
- * dependencies
225
- * @sanity/preview-url-secret bumped to 2.1.4
199
+ - The following workspace dependencies were updated
200
+ - dependencies
201
+ - @sanity/preview-url-secret bumped to 2.1.4
226
202
 
227
203
  ## [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)
228
204
 
229
-
230
205
  ### Bug Fixes
231
206
 
232
- * **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))
207
+ - **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))
233
208
 
234
209
  ## [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)
235
210
 
236
-
237
211
  ### Dependencies
238
212
 
239
- * The following workspace dependencies were updated
240
- * dependencies
241
- * @sanity/preview-url-secret bumped to 2.1.3
213
+ - The following workspace dependencies were updated
214
+ - dependencies
215
+ - @sanity/preview-url-secret bumped to 2.1.3
242
216
 
243
217
  ## [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)
244
218
 
245
-
246
219
  ### Dependencies
247
220
 
248
- * The following workspace dependencies were updated
249
- * dependencies
250
- * @sanity/preview-url-secret bumped to 2.1.2
221
+ - The following workspace dependencies were updated
222
+ - dependencies
223
+ - @sanity/preview-url-secret bumped to 2.1.2
251
224
 
252
225
  ## [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)
253
226
 
254
-
255
227
  ### Dependencies
256
228
 
257
- * The following workspace dependencies were updated
258
- * dependencies
259
- * @sanity/preview-url-secret bumped to 2.1.1
229
+ - The following workspace dependencies were updated
230
+ - dependencies
231
+ - @sanity/preview-url-secret bumped to 2.1.1
260
232
 
261
233
  ## [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)
262
234
 
263
-
264
235
  ### Bug Fixes
265
236
 
266
- * **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))
237
+ - **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))
267
238
 
268
239
  ## [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)
269
240
 
270
-
271
241
  ### Bug Fixes
272
242
 
273
- * **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))
243
+ - **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))
274
244
 
275
245
  ## [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)
276
246
 
277
-
278
247
  ### Bug Fixes
279
248
 
280
- * **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))
249
+ - **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))
281
250
 
282
251
  ## 1.0.0 (2025-01-10)
283
252
 
284
-
285
253
  ### Features
286
254
 
287
- * 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))
288
-
255
+ - 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))
289
256
 
290
257
  ### Dependencies
291
258
 
292
- * The following workspace dependencies were updated
293
- * dependencies
294
- * @sanity/preview-url-secret bumped to 2.1.0
259
+ - The following workspace dependencies were updated
260
+ - dependencies
261
+ - @sanity/preview-url-secret bumped to 2.1.0
package/README.md CHANGED
@@ -2,8 +2,6 @@
2
2
 
3
3
  [![npm stat](https://img.shields.io/npm/dm/@sanity/vercel-protection-bypass.svg?style=flat-square)](https://npm-stat.com/charts.html?package=@sanity/vercel-protection-bypass)
4
4
  [![npm version](https://img.shields.io/npm/v/@sanity/vercel-protection-bypass.svg?style=flat-square)](https://www.npmjs.com/package/@sanity/vercel-protection-bypass)
5
- [![gzip size][gzip-badge]][bundlephobia]
6
- [![size][size-badge]][bundlephobia]
7
5
 
8
6
  ```sh
9
7
  npm install @sanity/vercel-protection-bypass
@@ -16,9 +14,9 @@ Add the tool your `sanity.config.ts`:
16
14
 
17
15
  ```ts
18
16
  // ./sanity.config.ts
19
- import {vercelProtectionBypassTool} from '@sanity/vercel-protection-bypass'
20
- import {defineConfig} from 'sanity'
21
- import {presentationTool} from 'sanity/presentation'
17
+ import { vercelProtectionBypassTool } from "@sanity/vercel-protection-bypass";
18
+ import { defineConfig } from "sanity";
19
+ import { presentationTool } from "sanity/presentation";
22
20
 
23
21
  export default defineConfig({
24
22
  // ... other options
@@ -27,20 +25,17 @@ export default defineConfig({
27
25
  presentationTool({
28
26
  previewUrl: {
29
27
  // @TODO change to the URL of the application, or `location.origin` if it's an embedded Studio
30
- origin: 'http://localhost:3000',
28
+ origin: "http://localhost:3000",
31
29
  previewMode: {
32
- enable: '/api/draft',
30
+ enable: "/api/draft",
33
31
  },
34
32
  },
35
33
  }),
36
34
  vercelProtectionBypassTool(),
37
35
  ],
38
- })
36
+ });
39
37
  ```
40
38
 
41
39
  You should see a new `Vercel Protection Bypass` tab in the Studio's settings. Click it and follow the instructions to set up the tool.
42
40
 
43
- [`sanity/presentation`]: https://github.com/sanity-io/visual-editing/tree/main/packages/presentation#readme
44
- [gzip-badge]: https://img.shields.io/bundlephobia/minzip/@sanity/vercel-protection-bypass?label=gzip%20size&style=flat-square
45
- [size-badge]: https://img.shields.io/bundlephobia/min/@sanity/vercel-protection-bypass?label=size&style=flat-square
46
- [bundlephobia]: https://bundlephobia.com/package/@sanity/vercel-protection-bypass
41
+ [`sanity/presentation`]: https://www.sanity.io/docs/visual-editing/configuring-the-presentation-tool
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- var jsxRuntime = require("react/jsx-runtime"), reactCompilerRuntime = require("react-compiler-runtime"), icons = require("@sanity/icons"), constants = require("@sanity/preview-url-secret/constants"), toggleVercelProtectionBypass = require("@sanity/preview-url-secret/toggle-vercel-protection-bypass"), ui = require("@sanity/ui"), react = require("react"), sanity = require("sanity");
2
+ var jsxRuntime = require("react/jsx-runtime"), reactCompilerRuntime = require("react-compiler-runtime"), react = require("react"), sanity = require("sanity"), icons = require("@sanity/icons"), constants = require("@sanity/preview-url-secret/constants"), toggleVercelProtectionBypass = require("@sanity/preview-url-secret/toggle-vercel-protection-bypass"), ui = require("@sanity/ui");
3
3
  function reducer(prevState, action) {
4
4
  switch (action.type) {
5
5
  case "removed-secret":
@@ -1 +1 @@
1
- {"version":3,"file":"VercelProtectionBypassTool.cjs","sources":["../../src/VercelProtectionBypassTool.tsx"],"sourcesContent":["import {AddIcon, TrashIcon} from '@sanity/icons'\nimport {apiVersion} from '@sanity/preview-url-secret/constants'\nimport {\n disableVercelProtectionBypass,\n enableVercelProtectionBypass,\n subcribeToVercelProtectionBypass,\n} from '@sanity/preview-url-secret/toggle-vercel-protection-bypass'\nimport {Box, Button, Card, Dialog, Heading, Stack, Text, TextInput, useToast} from '@sanity/ui'\nimport {useEffect, useReducer} from 'react'\nimport {useClient} from 'sanity'\n\ninterface State {\n status:\n | 'loading'\n | 'disabled'\n | 'add-secret-dialog'\n | 'adding-secret'\n | 'enabled'\n | 'removing-secret'\n}\ntype Action =\n | {type: 'add-secret'}\n | {type: 'save-secret'}\n | {type: 'cancel-add-secret'}\n | {type: 'failed-add-secret'}\n | {type: 'saved-secret'}\n | {type: 'remove-secret'}\n | {type: 'failed-remove-secret'}\n | {type: 'removed-secret'}\n\nfunction reducer(prevState: State, action: Action): State {\n switch (action.type) {\n case 'removed-secret':\n return {...prevState, status: 'disabled'}\n case 'remove-secret':\n return {...prevState, status: 'removing-secret'}\n case 'saved-secret':\n return {...prevState, status: 'enabled'}\n case 'save-secret':\n return {...prevState, status: 'adding-secret'}\n case 'cancel-add-secret':\n return {...prevState, status: 'disabled'}\n case 'add-secret':\n return {...prevState, status: 'add-secret-dialog'}\n case 'failed-remove-secret':\n return {...prevState, status: 'enabled'}\n case 'failed-add-secret':\n return {...prevState, status: 'add-secret-dialog'}\n default:\n return prevState\n }\n}\n\nexport default function VercelProtectionBypassTool(): React.JSX.Element {\n const client = useClient({apiVersion: apiVersion})\n const {push: pushToast} = useToast()\n const [state, dispatch] = useReducer(reducer, {status: 'loading'})\n const adding = state.status === 'adding-secret'\n const removing = state.status === 'removing-secret'\n\n const handleEnable = (secret: string) => {\n dispatch({type: 'save-secret'})\n enableVercelProtectionBypass(client, secret)\n .then(() => {\n dispatch({type: 'saved-secret'})\n pushToast({\n status: 'success',\n title: 'Protection bypass is now enabled',\n })\n })\n .catch((reason) => {\n // eslint-disable-next-line no-console\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 dispatch({type: 'failed-add-secret'})\n })\n }\n\n useEffect(() => {\n const unsubscribe = subcribeToVercelProtectionBypass(client, (secret) =>\n dispatch({type: secret ? 'saved-secret' : 'removed-secret'}),\n )\n return () => unsubscribe()\n }, [client])\n\n const enabled = state.status === 'enabled' || removing\n\n return (\n <>\n <Box\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={removing}\n onClick={() => {\n dispatch({type: 'remove-secret'})\n disableVercelProtectionBypass(client)\n .then(() => {\n pushToast({\n status: 'warning',\n title: 'Protection bypass is now disabled',\n })\n dispatch({type: 'removed-secret'})\n })\n .catch((reason) => {\n // eslint-disable-next-line no-console\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 dispatch({type: 'failed-remove-secret'})\n })\n }}\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 loading={state.status === 'loading'}\n onClick={() => {\n dispatch({type: 'add-secret'})\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 {(state.status === 'add-secret-dialog' || state.status === 'adding-secret') && (\n <Dialog\n animate\n id=\"add-secret-dialog\"\n onClickOutside={() => dispatch({type: 'cancel-add-secret'})}\n >\n <Card padding={3}>\n <form\n onSubmit={(event) => {\n event.preventDefault()\n event.currentTarget.reportValidity()\n const formData = new FormData(event.currentTarget)\n const secret = formData.get('secret') as string\n if (secret) handleEnable(secret)\n }}\n >\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\"\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={adding}\n />\n </Stack>\n <Button\n type=\"submit\"\n loading={adding}\n text={adding ? 'Saving…' : 'Save'}\n tone=\"positive\"\n />\n </Stack>\n </form>\n </Card>\n </Dialog>\n )}\n </>\n )\n}\n"],"names":["reducer","prevState","action","type","status","VercelProtectionBypassTool","$","_c","t0","Symbol","for","apiVersion","client","useClient","push","pushToast","useToast","t1","state","dispatch","useReducer","adding","removing","t2","secret","enableVercelProtectionBypass","then","title","catch","reason","console","error","handleEnable","t3","t4","unsubscribe","subcribeToVercelProtectionBypass","secret_0","useEffect","enabled","t5","height","alignItems","justifyContent","flexDirection","t6","maxWidth","t7","t8","justifyItems","textWrap","Heading","t9","Box","jsx","Stack","Card","jsxs","Fragment","Text","Button","TrashIcon","disableVercelProtectionBypass","reason_0","AddIcon","t10","Dialog","event","preventDefault","currentTarget","reportValidity","secret_1","FormData","get","TextInput","_temp","_temp2","t11","event_1","setCustomValidity","value","length","required","event_0"],"mappings":";;AA8BA,SAASA,QAAQC,WAAkBC,QAAuB;AACxD,UAAQA,OAAOC,MAAAA;AAAAA,IACb,KAAK;AACH,aAAO;AAAA,QAAC,GAAGF;AAAAA,QAAWG,QAAQ;AAAA,MAAA;AAAA,IAChC,KAAK;AACH,aAAO;AAAA,QAAC,GAAGH;AAAAA,QAAWG,QAAQ;AAAA,MAAA;AAAA,IAChC,KAAK;AACH,aAAO;AAAA,QAAC,GAAGH;AAAAA,QAAWG,QAAQ;AAAA,M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AAAA,CAAM;AAAA,IAAA,GAEpB;AAAA,IACAiC,2BAAAA,IAACM,GAAAA,QAAA,EACM,MAAA,UACIvC,SAAAA,QACH,MAAAA,SAAA,iBAAA,QACD,MAAA,WAAA,CAAU;AAAA,EAAA,EAAA,CAEnB,EAAA,CACF,GACF,EAAA,CACF,GACDf,QAAAe,QAAAf,QAAA0B,cAAA1B,EAAA,EAAA,IAAAY,MAAAd,QAAAE,QAAA2D,OAAAA,MAAA3D,EAAA,EAAA;AAAA,MAAAuE;AAAA,SAAAvE,EAAA,EAAA,MAAA2D,OAAA3D,UAAA8C,MAvKHyB,6DACEzB,UAAAA;AAAAA,IAAAA;AAAAA,IA8GCa;AAAAA,EAAAA,EAAAA,CAwDA,GACA3D,QAAA2D,KAAA3D,QAAA8C,IAAA9C,QAAAuE,OAAAA,MAAAvE,EAAA,EAAA,GAxKHuE;AAwKG;AA/MQ,SAAAD,OAAAE,SAAA;AAoLOX,UAAKE,cAAcU,kBACjBZ,QAAKE,cAAcW,MAAMC,UAAW,KAApC,KAAA,mCAGF,GACAd,QAAKE,cAAca,WAAY;AAAH;AAzLnC,SAAAP,MAAAQ,SAAA;AAiLOhB,UAAKE,cAAcU,kBAAmB,EAAE;AAAC;;"}
1
+ {"version":3,"file":"VercelProtectionBypassTool.cjs","sources":["../../src/VercelProtectionBypassTool.tsx"],"sourcesContent":["import {useEffect, useReducer} from 'react'\nimport {useClient} from 'sanity'\n\nimport {AddIcon, TrashIcon} from '@sanity/icons'\nimport {apiVersion} from '@sanity/preview-url-secret/constants'\nimport {\n disableVercelProtectionBypass,\n enableVercelProtectionBypass,\n subcribeToVercelProtectionBypass,\n} from '@sanity/preview-url-secret/toggle-vercel-protection-bypass'\nimport {Box, Button, Card, Dialog, Heading, Stack, Text, TextInput, useToast} from '@sanity/ui'\n\ninterface State {\n status:\n | 'loading'\n | 'disabled'\n | 'add-secret-dialog'\n | 'adding-secret'\n | 'enabled'\n | 'removing-secret'\n}\ntype Action =\n | {type: 'add-secret'}\n | {type: 'save-secret'}\n | {type: 'cancel-add-secret'}\n | {type: 'failed-add-secret'}\n | {type: 'saved-secret'}\n | {type: 'remove-secret'}\n | {type: 'failed-remove-secret'}\n | {type: 'removed-secret'}\n\nfunction reducer(prevState: State, action: Action): State {\n switch (action.type) {\n case 'removed-secret':\n return {...prevState, status: 'disabled'}\n case 'remove-secret':\n return {...prevState, status: 'removing-secret'}\n case 'saved-secret':\n return {...prevState, status: 'enabled'}\n case 'save-secret':\n return {...prevState, status: 'adding-secret'}\n case 'cancel-add-secret':\n return {...prevState, status: 'disabled'}\n case 'add-secret':\n return {...prevState, status: 'add-secret-dialog'}\n case 'failed-remove-secret':\n return {...prevState, status: 'enabled'}\n case 'failed-add-secret':\n return {...prevState, status: 'add-secret-dialog'}\n default:\n return prevState\n }\n}\n\nexport default function VercelProtectionBypassTool(): React.JSX.Element {\n const client = useClient({apiVersion: apiVersion})\n const {push: pushToast} = useToast()\n const [state, dispatch] = useReducer(reducer, {status: 'loading'})\n const adding = state.status === 'adding-secret'\n const removing = state.status === 'removing-secret'\n\n const handleEnable = (secret: string) => {\n dispatch({type: 'save-secret'})\n enableVercelProtectionBypass(client, secret)\n .then(() => {\n dispatch({type: 'saved-secret'})\n pushToast({\n status: 'success',\n title: 'Protection bypass is now enabled',\n })\n })\n .catch((reason) => {\n // eslint-disable-next-line no-console\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 dispatch({type: 'failed-add-secret'})\n })\n }\n\n useEffect(() => {\n const unsubscribe = subcribeToVercelProtectionBypass(client, (secret) =>\n dispatch({type: secret ? 'saved-secret' : 'removed-secret'}),\n )\n return () => unsubscribe()\n }, [client])\n\n const enabled = state.status === 'enabled' || removing\n\n return (\n <>\n <Box\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={removing}\n onClick={() => {\n dispatch({type: 'remove-secret'})\n disableVercelProtectionBypass(client)\n .then(() => {\n pushToast({\n status: 'warning',\n title: 'Protection bypass is now disabled',\n })\n dispatch({type: 'removed-secret'})\n })\n .catch((reason) => {\n // eslint-disable-next-line no-console\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 dispatch({type: 'failed-remove-secret'})\n })\n }}\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 loading={state.status === 'loading'}\n onClick={() => {\n dispatch({type: 'add-secret'})\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 {(state.status === 'add-secret-dialog' || state.status === 'adding-secret') && (\n <Dialog\n animate\n id=\"add-secret-dialog\"\n onClickOutside={() => dispatch({type: 'cancel-add-secret'})}\n >\n <Card padding={3}>\n <form\n onSubmit={(event) => {\n event.preventDefault()\n event.currentTarget.reportValidity()\n const formData = new FormData(event.currentTarget)\n const secret = formData.get('secret') as string\n if (secret) handleEnable(secret)\n }}\n >\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\"\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={adding}\n />\n </Stack>\n <Button\n type=\"submit\"\n loading={adding}\n text={adding ? 'Saving…' : 'Save'}\n tone=\"positive\"\n />\n </Stack>\n </form>\n </Card>\n </Dialog>\n )}\n </>\n )\n}\n"],"names":["reducer","prevState","action","type","status","VercelProtectionBypassTool","$","_c","t0","Symbol","for","apiVersion","client","useClient","push","pushToast","useToast","t1","state","dispatch","useReducer","adding","removing","t2","secret","enableVercelProtectionBypass","then","title","catch","reason","console","error","handleEnable","t3","t4","unsubscribe","subcribeToVercelProtectionBypass","secret_0","useEffect","enabled","t5","height","alignItems","justifyContent","flexDirection","t6","maxWidth","t7","t8","justifyItems","textWrap","Heading","t9","Box","jsx","Stack","Card","jsxs","Fragment","Text","Button","TrashIcon","disableVercelProtectionBypass","reason_0","AddIcon","t10","Dialog","event","preventDefault","currentTarget","reportValidity","secret_1","FormData","get","TextInput","_temp","_temp2","t11","event_1","setCustomValidity","value","length","required","event_0"],"mappings":";;AA+BA,SAASA,QAAQC,WAAkBC,QAAuB;AACxD,UAAQA,OAAOC,MAAAA;AAAAA,IACb,KAAK;AACH,aAAO;AAAA,QAAC,GAAGF;AAAAA,QAAWG,QAAQ;AAAA,MAAA;AAAA,IAChC,KAAK;AACH,aAAO;AAAA,QAAC,GAAGH;AAAAA,QAAWG,QAAQ;AAAA,MAAA;AAAA,IAChC,KAAK;AACH,aAAO;AAAA,QAAC,GAAGH;AAAAA,QAAWG,QAAQ;AAAA,MAAA;AAAA,IAChC,KAAK;AACH,aAAO;AAAA,QAAC,GAAGH;AAAAA,QAAWG,QAAQ;AAAA,MAAA;AAAA,IAChC,KAAK;AACH,aAAO;AAAA,QAAC,GAAGH;AAAAA,QAAWG,QAAQ;AAAA,MAAA;AAAA,IAChC,KAAK;AACH,aAAO;AAAA,QAAC,GAAGH;AAAAA,QAAWG,QAAQ;AAAA,MAAA;AAAA,IAChC,KAAK;AACH,aAAO;AAAA,QAAC,GAAGH;AAAAA,QAAWG,QAAQ;AAAA,MAAA;AAAA,IAChC,KAAK;AACH,aAAO;AAAA,QAAC,GAAGH;AAAAA,QAAWG,QAAQ;AAAA,MAAA;AAAA,IAChC;AACE,aAAOH;AAAAA,EAAAA;AAEb;AAEA,SAAeI,6BAAA;AAAA,QAAAC,IAAAC,qBAAAA,EAAA,EAAA;AAAA,MAAAC;AAAAF,IAAA,CAAA,MAAAG,OAAAC,IAAA,2BAAA,KACYF,KAAA;AAAA,IAAA,YAAAG,UAAAA;AAAAA,EAAAA,GAAwBL,OAAAE,MAAAA,KAAAF,EAAA,CAAA;AAAjD,QAAAM,SAAeC,iBAAUL,EAAwB,GACjD;AAAA,IAAAM,MAAAC;AAAAA,EAAAA,IAA0BC,YAAAA;A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 -1,11 +1,11 @@
1
1
  import { jsxs, Fragment, jsx } from "react/jsx-runtime";
2
2
  import { c } from "react-compiler-runtime";
3
+ import { useReducer, useEffect } from "react";
4
+ import { useClient } from "sanity";
3
5
  import { TrashIcon, AddIcon } from "@sanity/icons";
4
6
  import { apiVersion } from "@sanity/preview-url-secret/constants";
5
7
  import { enableVercelProtectionBypass, subcribeToVercelProtectionBypass, disableVercelProtectionBypass } from "@sanity/preview-url-secret/toggle-vercel-protection-bypass";
6
8
  import { useToast, Heading, Box, Stack, Card, Text, Button, Dialog, TextInput } from "@sanity/ui";
7
- import { useReducer, useEffect } from "react";
8
- import { useClient } from "sanity";
9
9
  function reducer(prevState, action) {
10
10
  switch (action.type) {
11
11
  case "removed-secret":
@@ -1 +1 @@
1
- {"version":3,"file":"VercelProtectionBypassTool.js","sources":["../../src/VercelProtectionBypassTool.tsx"],"sourcesContent":["import {AddIcon, TrashIcon} from '@sanity/icons'\nimport {apiVersion} from '@sanity/preview-url-secret/constants'\nimport {\n disableVercelProtectionBypass,\n enableVercelProtectionBypass,\n subcribeToVercelProtectionBypass,\n} from '@sanity/preview-url-secret/toggle-vercel-protection-bypass'\nimport {Box, Button, Card, Dialog, Heading, Stack, Text, TextInput, useToast} from '@sanity/ui'\nimport {useEffect, useReducer} from 'react'\nimport {useClient} from 'sanity'\n\ninterface State {\n status:\n | 'loading'\n | 'disabled'\n | 'add-secret-dialog'\n | 'adding-secret'\n | 'enabled'\n | 'removing-secret'\n}\ntype Action =\n | {type: 'add-secret'}\n | {type: 'save-secret'}\n | {type: 'cancel-add-secret'}\n | {type: 'failed-add-secret'}\n | {type: 'saved-secret'}\n | {type: 'remove-secret'}\n | {type: 'failed-remove-secret'}\n | {type: 'removed-secret'}\n\nfunction reducer(prevState: State, action: Action): State {\n switch (action.type) {\n case 'removed-secret':\n return {...prevState, status: 'disabled'}\n case 'remove-secret':\n return {...prevState, status: 'removing-secret'}\n case 'saved-secret':\n return {...prevState, status: 'enabled'}\n case 'save-secret':\n return {...prevState, status: 'adding-secret'}\n case 'cancel-add-secret':\n return {...prevState, status: 'disabled'}\n case 'add-secret':\n return {...prevState, status: 'add-secret-dialog'}\n case 'failed-remove-secret':\n return {...prevState, status: 'enabled'}\n case 'failed-add-secret':\n return {...prevState, status: 'add-secret-dialog'}\n default:\n return prevState\n }\n}\n\nexport default function VercelProtectionBypassTool(): React.JSX.Element {\n const client = useClient({apiVersion: apiVersion})\n const {push: pushToast} = useToast()\n const [state, dispatch] = useReducer(reducer, {status: 'loading'})\n const adding = state.status === 'adding-secret'\n const removing = state.status === 'removing-secret'\n\n const handleEnable = (secret: string) => {\n dispatch({type: 'save-secret'})\n enableVercelProtectionBypass(client, secret)\n .then(() => {\n dispatch({type: 'saved-secret'})\n pushToast({\n status: 'success',\n title: 'Protection bypass is now enabled',\n })\n })\n .catch((reason) => {\n // eslint-disable-next-line no-console\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 dispatch({type: 'failed-add-secret'})\n })\n }\n\n useEffect(() => {\n const unsubscribe = subcribeToVercelProtectionBypass(client, (secret) =>\n dispatch({type: secret ? 'saved-secret' : 'removed-secret'}),\n )\n return () => unsubscribe()\n }, [client])\n\n const enabled = state.status === 'enabled' || removing\n\n return (\n <>\n <Box\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={removing}\n onClick={() => {\n dispatch({type: 'remove-secret'})\n disableVercelProtectionBypass(client)\n .then(() => {\n pushToast({\n status: 'warning',\n title: 'Protection bypass is now disabled',\n })\n dispatch({type: 'removed-secret'})\n })\n .catch((reason) => {\n // eslint-disable-next-line no-console\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 dispatch({type: 'failed-remove-secret'})\n })\n }}\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 loading={state.status === 'loading'}\n onClick={() => {\n dispatch({type: 'add-secret'})\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 {(state.status === 'add-secret-dialog' || state.status === 'adding-secret') && (\n <Dialog\n animate\n id=\"add-secret-dialog\"\n onClickOutside={() => dispatch({type: 'cancel-add-secret'})}\n >\n <Card padding={3}>\n <form\n onSubmit={(event) => {\n event.preventDefault()\n event.currentTarget.reportValidity()\n const formData = new FormData(event.currentTarget)\n const secret = formData.get('secret') as string\n if (secret) handleEnable(secret)\n }}\n >\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\"\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={adding}\n />\n </Stack>\n <Button\n type=\"submit\"\n loading={adding}\n text={adding ? 'Saving…' : 'Save'}\n tone=\"positive\"\n />\n </Stack>\n </form>\n </Card>\n </Dialog>\n )}\n </>\n )\n}\n"],"names":["reducer","prevState","action","type","status","VercelProtectionBypassTool","$","_c","t0","Symbol","for","apiVersion","client","useClient","push","pushToast","useToast","t1","state","dispatch","useReducer","adding","removing","t2","secret","enableVercelProtectionBypass","then","title","catch","reason","console","error","handleEnable","t3","t4","unsubscribe","subcribeToVercelProtectionBypass","secret_0","useEffect","enabled","t5","height","alignItems","justifyContent","flexDirection","t6","maxWidth","t7","t8","justifyItems","textWrap","t9","disableVercelProtectionBypass","reason_0","t10","event","preventDefault","currentTarget","reportValidity","secret_1","FormData","get","_temp","_temp2","t11","event_1","setCustomValidity","value","length","required","event_0"],"mappings":";;;;;;;;AA8BA,SAASA,QAAQC,WAAkBC,QAAuB;AACxD,UAAQA,OAAOC,MAAAA;AAAAA,IACb,KAAK;AACH,aAAO;AAAA,QAAC,GAAGF;AAAAA,QAAWG,QAAQ;AAAA,MAAA;AAAA,IAChC,KAAK;AACH,aAAO;AAAA,QAAC,GAAGH;AAAAA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MAvKHa,uCACEb,UAAAA;AAAAA,IAAAA;AAAAA,IA8GCG;AAAAA,EAAAA,EAAAA,CAwDA,GACAhD,QAAAgD,KAAAhD,QAAA6C,IAAA7C,QAAA0D,OAAAA,MAAA1D,EAAA,EAAA,GAxKH0D;AAwKG;AA/MQ,SAAAD,OAAAE,SAAA;AAoLOV,UAAKE,cAAcS,kBACjBX,QAAKE,cAAcU,MAAMC,UAAW,KAApC,KAAA,mCAGF,GACAb,QAAKE,cAAcY,WAAY;AAAH;AAzLnC,SAAAP,MAAAQ,SAAA;AAiLOf,UAAKE,cAAcS,kBAAmB,EAAE;AAAC;"}
1
+ {"version":3,"file":"VercelProtectionBypassTool.js","sources":["../../src/VercelProtectionBypassTool.tsx"],"sourcesContent":["import {useEffect, useReducer} from 'react'\nimport {useClient} from 'sanity'\n\nimport {AddIcon, TrashIcon} from '@sanity/icons'\nimport {apiVersion} from '@sanity/preview-url-secret/constants'\nimport {\n disableVercelProtectionBypass,\n enableVercelProtectionBypass,\n subcribeToVercelProtectionBypass,\n} from '@sanity/preview-url-secret/toggle-vercel-protection-bypass'\nimport {Box, Button, Card, Dialog, Heading, Stack, Text, TextInput, useToast} from '@sanity/ui'\n\ninterface State {\n status:\n | 'loading'\n | 'disabled'\n | 'add-secret-dialog'\n | 'adding-secret'\n | 'enabled'\n | 'removing-secret'\n}\ntype Action =\n | {type: 'add-secret'}\n | {type: 'save-secret'}\n | {type: 'cancel-add-secret'}\n | {type: 'failed-add-secret'}\n | {type: 'saved-secret'}\n | {type: 'remove-secret'}\n | {type: 'failed-remove-secret'}\n | {type: 'removed-secret'}\n\nfunction reducer(prevState: State, action: Action): State {\n switch (action.type) {\n case 'removed-secret':\n return {...prevState, status: 'disabled'}\n case 'remove-secret':\n return {...prevState, status: 'removing-secret'}\n case 'saved-secret':\n return {...prevState, status: 'enabled'}\n case 'save-secret':\n return {...prevState, status: 'adding-secret'}\n case 'cancel-add-secret':\n return {...prevState, status: 'disabled'}\n case 'add-secret':\n return {...prevState, status: 'add-secret-dialog'}\n case 'failed-remove-secret':\n return {...prevState, status: 'enabled'}\n case 'failed-add-secret':\n return {...prevState, status: 'add-secret-dialog'}\n default:\n return prevState\n }\n}\n\nexport default function VercelProtectionBypassTool(): React.JSX.Element {\n const client = useClient({apiVersion: apiVersion})\n const {push: pushToast} = useToast()\n const [state, dispatch] = useReducer(reducer, {status: 'loading'})\n const adding = state.status === 'adding-secret'\n const removing = state.status === 'removing-secret'\n\n const handleEnable = (secret: string) => {\n dispatch({type: 'save-secret'})\n enableVercelProtectionBypass(client, secret)\n .then(() => {\n dispatch({type: 'saved-secret'})\n pushToast({\n status: 'success',\n title: 'Protection bypass is now enabled',\n })\n })\n .catch((reason) => {\n // eslint-disable-next-line no-console\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 dispatch({type: 'failed-add-secret'})\n })\n }\n\n useEffect(() => {\n const unsubscribe = subcribeToVercelProtectionBypass(client, (secret) =>\n dispatch({type: secret ? 'saved-secret' : 'removed-secret'}),\n )\n return () => unsubscribe()\n }, [client])\n\n const enabled = state.status === 'enabled' || removing\n\n return (\n <>\n <Box\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={removing}\n onClick={() => {\n dispatch({type: 'remove-secret'})\n disableVercelProtectionBypass(client)\n .then(() => {\n pushToast({\n status: 'warning',\n title: 'Protection bypass is now disabled',\n })\n dispatch({type: 'removed-secret'})\n })\n .catch((reason) => {\n // eslint-disable-next-line no-console\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 dispatch({type: 'failed-remove-secret'})\n })\n }}\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 loading={state.status === 'loading'}\n onClick={() => {\n dispatch({type: 'add-secret'})\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 {(state.status === 'add-secret-dialog' || state.status === 'adding-secret') && (\n <Dialog\n animate\n id=\"add-secret-dialog\"\n onClickOutside={() => dispatch({type: 'cancel-add-secret'})}\n >\n <Card padding={3}>\n <form\n onSubmit={(event) => {\n event.preventDefault()\n event.currentTarget.reportValidity()\n const formData = new FormData(event.currentTarget)\n const secret = formData.get('secret') as string\n if (secret) handleEnable(secret)\n }}\n >\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\"\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={adding}\n />\n </Stack>\n <Button\n type=\"submit\"\n loading={adding}\n text={adding ? 'Saving…' : 'Save'}\n tone=\"positive\"\n />\n </Stack>\n </form>\n </Card>\n </Dialog>\n )}\n </>\n )\n}\n"],"names":["reducer","prevState","action","type","status","VercelProtectionBypassTool","$","_c","t0","Symbol","for","apiVersion","client","useClient","push","pushToast","useToast","t1","state","dispatch","useReducer","adding","removing","t2","secret","enableVercelProtectionBypass","then","title","catch","reason","console","error","handleEnable","t3","t4","unsubscribe","subcribeToVercelProtectionBypass","secret_0","useEffect","enabled","t5","height","alignItems","justifyContent","flexDirection","t6","maxWidth","t7","t8","justifyItems","textWrap","t9","disableVercelProtectionBypass","reason_0","t10","event","preventDefault","currentTarget","reportValidity","secret_1","FormData","get","_temp","_temp2","t11","event_1","setCustomValidity","value","length","required","event_0"],"mappings":";;;;;;;;AA+BA,SAASA,QAAQC,WAAkBC,QAAuB;AACxD,UAAQA,OAAOC,MAAAA;AAAAA,IACb,KAAK;AACH,aAAO;AAAA,QAAC,GAAGF;AAAAA,QAAWG,QAAQ;AAAA,MAAA;AAAA,IAChC,KAAK;AACH,aAAO;AAAA,QAAC,GAAGH;AAAAA,QAAWG,QAAQ;AAAA,MAAA;AAAA,IAChC,KAAK;AACH,aAAO;AAAA,QAAC,GAAGH;AAAAA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GACAhD,QAAAgD,KAAAhD,QAAA6C,IAAA7C,QAAA0D,OAAAA,MAAA1D,EAAA,EAAA,GAxKH0D;AAwKG;AA/MQ,SAAAD,OAAAE,SAAA;AAoLOV,UAAKE,cAAcS,kBACjBX,QAAKE,cAAcU,MAAMC,UAAW,KAApC,KAAA,mCAGF,GACAb,QAAKE,cAAcY,WAAY;AAAH;AAzLnC,SAAAP,MAAAQ,SAAA;AAiLOf,UAAKE,cAAcS,kBAAmB,EAAE;AAAC;"}
package/dist/index.d.cts CHANGED
@@ -1,11 +1,11 @@
1
- import {Plugin as Plugin_2} from 'sanity'
1
+ import { Plugin as Plugin_2 } from "sanity";
2
2
 
3
3
  export declare interface VercelProtectionBypassConfig {
4
- name?: string
5
- title?: string
6
- icon?: React.ComponentType
4
+ name?: string;
5
+ title?: string;
6
+ icon?: React.ComponentType;
7
7
  }
8
8
 
9
- export declare const vercelProtectionBypassTool: Plugin_2<void | VercelProtectionBypassConfig>
9
+ export declare const vercelProtectionBypassTool: Plugin_2<void | VercelProtectionBypassConfig>;
10
10
 
11
- export {}
11
+ export {};
package/dist/index.d.ts CHANGED
@@ -1,11 +1,11 @@
1
- import {Plugin as Plugin_2} from 'sanity'
1
+ import { Plugin as Plugin_2 } from "sanity";
2
2
 
3
3
  export declare interface VercelProtectionBypassConfig {
4
- name?: string
5
- title?: string
6
- icon?: React.ComponentType
4
+ name?: string;
5
+ title?: string;
6
+ icon?: React.ComponentType;
7
7
  }
8
8
 
9
- export declare const vercelProtectionBypassTool: Plugin_2<void | VercelProtectionBypassConfig>
9
+ export declare const vercelProtectionBypassTool: Plugin_2<void | VercelProtectionBypassConfig>;
10
10
 
11
- export {}
11
+ export {};
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@sanity/vercel-protection-bypass",
3
- "version": "2.1.1-canary.2",
4
- "homepage": "https://github.com/sanity-io/visual-editing/tree/main/packages/vercel-protection-bypass#readme",
3
+ "version": "2.1.1",
4
+ "homepage": "https://github.com/sanity-io/plugins/tree/main/packages/@sanity/vercel-protection-bypass#readme",
5
5
  "bugs": {
6
- "url": "https://github.com/sanity-io/visual-editing/issues"
6
+ "url": "https://github.com/sanity-io/plugins/issues"
7
7
  },
8
8
  "repository": {
9
9
  "type": "git",
10
- "url": "git+ssh://git@github.com/sanity-io/visual-editing.git",
11
- "directory": "packages/vercel-protection-bypass"
10
+ "url": "git+ssh://git@github.com/sanity-io/plugins.git",
11
+ "directory": "packages/@sanity/vercel-protection-bypass"
12
12
  },
13
13
  "license": "MIT",
14
14
  "author": "Sanity.io <hello@sanity.io>",
@@ -33,31 +33,19 @@
33
33
  "!src/**/*.test-d.ts",
34
34
  "CHANGELOG.md"
35
35
  ],
36
- "browserslist": "extends @sanity/browserslist-config",
37
- "prettier": "@repo/prettier-config",
38
- "eslintConfig": {
39
- "extends": [
40
- "@repo/eslint-config"
41
- ],
42
- "root": true
43
- },
44
36
  "dependencies": {
45
37
  "@sanity/icons": "^3.7.4",
46
- "@sanity/ui": "^3.1.10",
47
- "react-compiler-runtime": "1.0.0",
48
- "@sanity/preview-url-secret": "^2.1.16-canary.3"
38
+ "@sanity/preview-url-secret": "^2.1.15",
39
+ "@sanity/ui": "^3.1.11",
40
+ "react-compiler-runtime": "^1.0.0"
49
41
  },
50
42
  "devDependencies": {
51
- "@sanity/pkg-utils": "^8.1.24",
52
- "babel-plugin-react-compiler": "1.0.0",
53
- "eslint": "^8.57.1",
43
+ "@sanity/pkg-utils": "^9.1.1",
44
+ "@types/react": "^19.2.6",
45
+ "babel-plugin-react-compiler": "^1.0.0",
54
46
  "react": "^19.2.0",
55
- "sanity": "^4.11.0",
56
- "typescript": "5.9.3",
57
- "vitest": "^3.2.4",
58
- "@repo/eslint-config": "0.0.0",
59
- "@repo/package.config": "0.0.0",
60
- "@repo/prettier-config": "0.0.0"
47
+ "sanity": "^4.16.0",
48
+ "typescript": "5.9.3"
61
49
  },
62
50
  "peerDependencies": {
63
51
  "react": "^18.3 || ^19",
@@ -70,9 +58,6 @@
70
58
  "access": "public"
71
59
  },
72
60
  "scripts": {
73
- "build": "pkg build --strict --check --clean",
74
- "dev": "pkg build --strict",
75
- "lint": "eslint .",
76
- "test": "vitest --pass-with-no-tests --typecheck"
61
+ "build": "pkg build --strict --check --clean"
77
62
  }
78
63
  }
@@ -1,3 +1,6 @@
1
+ import {useEffect, useReducer} from 'react'
2
+ import {useClient} from 'sanity'
3
+
1
4
  import {AddIcon, TrashIcon} from '@sanity/icons'
2
5
  import {apiVersion} from '@sanity/preview-url-secret/constants'
3
6
  import {
@@ -6,8 +9,6 @@ import {
6
9
  subcribeToVercelProtectionBypass,
7
10
  } from '@sanity/preview-url-secret/toggle-vercel-protection-bypass'
8
11
  import {Box, Button, Card, Dialog, Heading, Stack, Text, TextInput, useToast} from '@sanity/ui'
9
- import {useEffect, useReducer} from 'react'
10
- import {useClient} from 'sanity'
11
12
 
12
13
  interface State {
13
14
  status: