@sanity/vercel-protection-bypass 2.1.1-canary.3 → 3.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.
- package/CHANGELOG.md +93 -112
- package/README.md +7 -12
- package/dist/_chunks-es/VercelProtectionBypassTool.js +27 -5
- package/dist/_chunks-es/VercelProtectionBypassTool.js.map +1 -1
- package/dist/index.d.ts +7 -10
- package/package.json +23 -35
- package/src/VercelProtectionBypassTool.tsx +19 -7
- package/dist/_chunks-cjs/VercelProtectionBypassTool.cjs +0 -188
- package/dist/_chunks-cjs/VercelProtectionBypassTool.cjs.map +0 -1
- package/dist/index.cjs +0 -26
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.cts +0 -11
package/CHANGELOG.md
CHANGED
|
@@ -1,294 +1,275 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @sanity/vercel-protection-bypass
|
|
2
2
|
|
|
3
|
-
##
|
|
3
|
+
## 3.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- [#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
|
|
8
|
+
|
|
9
|
+
- [#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
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#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
|
|
14
|
+
|
|
15
|
+
- [`2bda9e1`](https://github.com/sanity-io/plugins/commit/2bda9e147d8bf98b59c83b12b994f821262b7689) Thanks [@stipsan](https://github.com/stipsan)! - Reduce reliance on `@sanity/preview-url-secret`
|
|
4
16
|
|
|
17
|
+
## 2.1.1
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- [#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
|
|
22
|
+
|
|
23
|
+
## [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
24
|
|
|
6
25
|
### Features
|
|
7
26
|
|
|
8
|
-
|
|
27
|
+
- 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
28
|
|
|
10
29
|
## [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
30
|
|
|
12
|
-
|
|
13
31
|
### Dependencies
|
|
14
32
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
33
|
+
- The following workspace dependencies were updated
|
|
34
|
+
- dependencies
|
|
35
|
+
- @sanity/preview-url-secret bumped to 2.1.15
|
|
18
36
|
|
|
19
37
|
## [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
38
|
|
|
21
|
-
|
|
22
39
|
### Bug Fixes
|
|
23
40
|
|
|
24
|
-
|
|
41
|
+
- use stable react, next and sanity peer dep ranges ([e58d995](https://github.com/sanity-io/visual-editing/commit/e58d995d57beba1e74f9ec7a2c15831c5cc04446))
|
|
25
42
|
|
|
26
43
|
## [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
44
|
|
|
28
|
-
|
|
29
45
|
### ⚠ BREAKING CHANGES
|
|
30
46
|
|
|
31
|
-
|
|
47
|
+
- **deps:** update dependency @sanity/ui to v3 (main) ([#3150](https://github.com/sanity-io/visual-editing/issues/3150))
|
|
32
48
|
|
|
33
49
|
### Bug Fixes
|
|
34
50
|
|
|
35
|
-
|
|
51
|
+
- **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
52
|
|
|
37
53
|
## [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
54
|
|
|
39
|
-
|
|
40
55
|
### Bug Fixes
|
|
41
56
|
|
|
42
|
-
|
|
43
|
-
|
|
57
|
+
- **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
58
|
|
|
45
59
|
### Dependencies
|
|
46
60
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
61
|
+
- The following workspace dependencies were updated
|
|
62
|
+
- dependencies
|
|
63
|
+
- @sanity/preview-url-secret bumped to 2.1.14
|
|
50
64
|
|
|
51
65
|
## [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
66
|
|
|
53
|
-
|
|
54
67
|
### Dependencies
|
|
55
68
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
69
|
+
- The following workspace dependencies were updated
|
|
70
|
+
- dependencies
|
|
71
|
+
- @sanity/preview-url-secret bumped to 2.1.13
|
|
59
72
|
|
|
60
73
|
## [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
74
|
|
|
62
|
-
|
|
63
75
|
### Bug Fixes
|
|
64
76
|
|
|
65
|
-
|
|
66
|
-
|
|
77
|
+
- allow sanity v4 in deps range ([d6d1e64](https://github.com/sanity-io/visual-editing/commit/d6d1e6453319f521945ffa7525164d911d5964bf))
|
|
67
78
|
|
|
68
79
|
### Dependencies
|
|
69
80
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
81
|
+
- The following workspace dependencies were updated
|
|
82
|
+
- dependencies
|
|
83
|
+
- @sanity/preview-url-secret bumped to 2.1.12
|
|
73
84
|
|
|
74
85
|
## [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
86
|
|
|
76
|
-
|
|
77
87
|
### Bug Fixes
|
|
78
88
|
|
|
79
|
-
|
|
89
|
+
- **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
90
|
|
|
81
91
|
## [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
92
|
|
|
83
|
-
|
|
84
93
|
### Dependencies
|
|
85
94
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
95
|
+
- The following workspace dependencies were updated
|
|
96
|
+
- dependencies
|
|
97
|
+
- @sanity/preview-url-secret bumped to 2.1.11
|
|
89
98
|
|
|
90
99
|
## [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
100
|
|
|
92
|
-
|
|
93
101
|
### Dependencies
|
|
94
102
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
103
|
+
- The following workspace dependencies were updated
|
|
104
|
+
- dependencies
|
|
105
|
+
- @sanity/preview-url-secret bumped to 2.1.10
|
|
98
106
|
|
|
99
107
|
## [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
108
|
|
|
101
|
-
|
|
102
109
|
### Bug Fixes
|
|
103
110
|
|
|
104
|
-
|
|
105
|
-
|
|
111
|
+
- **deps:** upgrade to react compiler RC ([29a886b](https://github.com/sanity-io/visual-editing/commit/29a886b6ff0b498379d6931ad154976f4bcfad29))
|
|
106
112
|
|
|
107
113
|
### Dependencies
|
|
108
114
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
115
|
+
- The following workspace dependencies were updated
|
|
116
|
+
- dependencies
|
|
117
|
+
- @sanity/preview-url-secret bumped to 2.1.9
|
|
112
118
|
|
|
113
119
|
## [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
120
|
|
|
115
|
-
|
|
116
121
|
### Bug Fixes
|
|
117
122
|
|
|
118
|
-
|
|
119
|
-
|
|
123
|
+
- **deps:** update dependency @sanity/client to ^6.29.0 ([2a8ff1e](https://github.com/sanity-io/visual-editing/commit/2a8ff1e9369b8a27bb3c122d5f5f9046be43c5a1))
|
|
120
124
|
|
|
121
125
|
### Dependencies
|
|
122
126
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
127
|
+
- The following workspace dependencies were updated
|
|
128
|
+
- dependencies
|
|
129
|
+
- @sanity/preview-url-secret bumped to 2.1.8
|
|
126
130
|
|
|
127
131
|
## [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
132
|
|
|
129
|
-
|
|
130
133
|
### Bug Fixes
|
|
131
134
|
|
|
132
|
-
|
|
135
|
+
- **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
136
|
|
|
134
137
|
## [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
138
|
|
|
136
|
-
|
|
137
139
|
### Bug Fixes
|
|
138
140
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
+
- **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
142
|
|
|
142
143
|
### Dependencies
|
|
143
144
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
145
|
+
- The following workspace dependencies were updated
|
|
146
|
+
- dependencies
|
|
147
|
+
- @sanity/preview-url-secret bumped to 2.1.7
|
|
147
148
|
|
|
148
149
|
## [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
150
|
|
|
150
|
-
|
|
151
151
|
### Bug Fixes
|
|
152
152
|
|
|
153
|
-
|
|
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))
|
|
154
154
|
|
|
155
155
|
## [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
156
|
|
|
157
|
-
|
|
158
157
|
### Bug Fixes
|
|
159
158
|
|
|
160
|
-
|
|
159
|
+
- **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
160
|
|
|
162
161
|
## [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
162
|
|
|
164
|
-
|
|
165
163
|
### Bug Fixes
|
|
166
164
|
|
|
167
|
-
|
|
168
|
-
|
|
165
|
+
- **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
166
|
|
|
170
167
|
### Dependencies
|
|
171
168
|
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
169
|
+
- The following workspace dependencies were updated
|
|
170
|
+
- dependencies
|
|
171
|
+
- @sanity/preview-url-secret bumped to 2.1.6
|
|
175
172
|
|
|
176
173
|
## [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
174
|
|
|
178
|
-
|
|
179
175
|
### Bug Fixes
|
|
180
176
|
|
|
181
|
-
|
|
182
|
-
|
|
177
|
+
- **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
178
|
|
|
184
179
|
### Dependencies
|
|
185
180
|
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
181
|
+
- The following workspace dependencies were updated
|
|
182
|
+
- dependencies
|
|
183
|
+
- @sanity/preview-url-secret bumped to 2.1.5
|
|
189
184
|
|
|
190
185
|
## [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
186
|
|
|
192
|
-
|
|
193
187
|
### Bug Fixes
|
|
194
188
|
|
|
195
|
-
|
|
189
|
+
- **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
190
|
|
|
197
191
|
## [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
192
|
|
|
199
|
-
|
|
200
193
|
### Bug Fixes
|
|
201
194
|
|
|
202
|
-
|
|
195
|
+
- **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
196
|
|
|
204
197
|
## [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
198
|
|
|
206
|
-
|
|
207
199
|
### Bug Fixes
|
|
208
200
|
|
|
209
|
-
|
|
201
|
+
- **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
202
|
|
|
211
203
|
## [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
204
|
|
|
213
|
-
|
|
214
205
|
### Bug Fixes
|
|
215
206
|
|
|
216
|
-
|
|
207
|
+
- **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
208
|
|
|
218
209
|
## [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
210
|
|
|
220
|
-
|
|
221
211
|
### Dependencies
|
|
222
212
|
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
213
|
+
- The following workspace dependencies were updated
|
|
214
|
+
- dependencies
|
|
215
|
+
- @sanity/preview-url-secret bumped to 2.1.4
|
|
226
216
|
|
|
227
217
|
## [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
218
|
|
|
229
|
-
|
|
230
219
|
### Bug Fixes
|
|
231
220
|
|
|
232
|
-
|
|
221
|
+
- **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
222
|
|
|
234
223
|
## [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
224
|
|
|
236
|
-
|
|
237
225
|
### Dependencies
|
|
238
226
|
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
227
|
+
- The following workspace dependencies were updated
|
|
228
|
+
- dependencies
|
|
229
|
+
- @sanity/preview-url-secret bumped to 2.1.3
|
|
242
230
|
|
|
243
231
|
## [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
232
|
|
|
245
|
-
|
|
246
233
|
### Dependencies
|
|
247
234
|
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
235
|
+
- The following workspace dependencies were updated
|
|
236
|
+
- dependencies
|
|
237
|
+
- @sanity/preview-url-secret bumped to 2.1.2
|
|
251
238
|
|
|
252
239
|
## [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
240
|
|
|
254
|
-
|
|
255
241
|
### Dependencies
|
|
256
242
|
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
243
|
+
- The following workspace dependencies were updated
|
|
244
|
+
- dependencies
|
|
245
|
+
- @sanity/preview-url-secret bumped to 2.1.1
|
|
260
246
|
|
|
261
247
|
## [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
248
|
|
|
263
|
-
|
|
264
249
|
### Bug Fixes
|
|
265
250
|
|
|
266
|
-
|
|
251
|
+
- **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
252
|
|
|
268
253
|
## [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
254
|
|
|
270
|
-
|
|
271
255
|
### Bug Fixes
|
|
272
256
|
|
|
273
|
-
|
|
257
|
+
- **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
258
|
|
|
275
259
|
## [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
260
|
|
|
277
|
-
|
|
278
261
|
### Bug Fixes
|
|
279
262
|
|
|
280
|
-
|
|
263
|
+
- **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
264
|
|
|
282
265
|
## 1.0.0 (2025-01-10)
|
|
283
266
|
|
|
284
|
-
|
|
285
267
|
### Features
|
|
286
268
|
|
|
287
|
-
|
|
288
|
-
|
|
269
|
+
- 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
270
|
|
|
290
271
|
### Dependencies
|
|
291
272
|
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
273
|
+
- The following workspace dependencies were updated
|
|
274
|
+
- dependencies
|
|
275
|
+
- @sanity/preview-url-secret bumped to 2.1.0
|
package/README.md
CHANGED
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://npm-stat.com/charts.html?package=@sanity/vercel-protection-bypass)
|
|
4
4
|
[](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
|
|
20
|
-
import {defineConfig} from
|
|
21
|
-
import {presentationTool} from
|
|
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:
|
|
28
|
+
origin: "http://localhost:3000",
|
|
31
29
|
previewMode: {
|
|
32
|
-
enable:
|
|
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://
|
|
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,11 +1,11 @@
|
|
|
1
1
|
import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
2
2
|
import { c } from "react-compiler-runtime";
|
|
3
|
-
import { TrashIcon, AddIcon } from "@sanity/icons";
|
|
4
|
-
import { apiVersion } from "@sanity/preview-url-secret/constants";
|
|
5
|
-
import { enableVercelProtectionBypass, subcribeToVercelProtectionBypass, disableVercelProtectionBypass } from "@sanity/preview-url-secret/toggle-vercel-protection-bypass";
|
|
6
|
-
import { useToast, Heading, Box, Stack, Card, Text, Button, Dialog, TextInput } from "@sanity/ui";
|
|
7
3
|
import { useReducer, useEffect } from "react";
|
|
8
4
|
import { useClient } from "sanity";
|
|
5
|
+
import { TrashIcon, AddIcon } from "@sanity/icons";
|
|
6
|
+
import { apiVersion, vercelProtectionBypassSchemaId, vercelProtectionBypassSchemaType, tag } from "@sanity/preview-url-secret/constants";
|
|
7
|
+
import { subscribeToVercelProtectionBypass } from "@sanity/preview-url-secret/toggle-vercel-protection-bypass";
|
|
8
|
+
import { useToast, Heading, Box, Stack, Card, Text, Button, Dialog, TextInput } from "@sanity/ui";
|
|
9
9
|
function reducer(prevState, action) {
|
|
10
10
|
switch (action.type) {
|
|
11
11
|
case "removed-secret":
|
|
@@ -52,6 +52,28 @@ function reducer(prevState, action) {
|
|
|
52
52
|
return prevState;
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
|
+
async function enableVercelProtectionBypass(client, secret) {
|
|
56
|
+
const patch = client.patch(vercelProtectionBypassSchemaId).set({
|
|
57
|
+
secret
|
|
58
|
+
});
|
|
59
|
+
await client.transaction().createIfNotExists({
|
|
60
|
+
_id: vercelProtectionBypassSchemaId,
|
|
61
|
+
_type: vercelProtectionBypassSchemaType
|
|
62
|
+
}).patch(patch).commit({
|
|
63
|
+
tag
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
async function disableVercelProtectionBypass(client) {
|
|
67
|
+
const patch = client.patch(vercelProtectionBypassSchemaId).set({
|
|
68
|
+
secret: null
|
|
69
|
+
});
|
|
70
|
+
await client.transaction().createIfNotExists({
|
|
71
|
+
_id: vercelProtectionBypassSchemaId,
|
|
72
|
+
_type: vercelProtectionBypassSchemaType
|
|
73
|
+
}).patch(patch).commit({
|
|
74
|
+
tag
|
|
75
|
+
});
|
|
76
|
+
}
|
|
55
77
|
function VercelProtectionBypassTool() {
|
|
56
78
|
const $ = c(25);
|
|
57
79
|
let t0;
|
|
@@ -89,7 +111,7 @@ function VercelProtectionBypassTool() {
|
|
|
89
111
|
const handleEnable = t2;
|
|
90
112
|
let t3, t4;
|
|
91
113
|
$[5] !== client ? (t3 = () => {
|
|
92
|
-
const unsubscribe =
|
|
114
|
+
const unsubscribe = subscribeToVercelProtectionBypass(client, (secret_0) => dispatch({
|
|
93
115
|
type: secret_0 ? "saved-secret" : "removed-secret"
|
|
94
116
|
}));
|
|
95
117
|
return () => unsubscribe();
|
|
@@ -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'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,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,aAA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;AAAC;"}
|
|
1
|
+
{"version":3,"file":"VercelProtectionBypassTool.js","sources":["../../src/VercelProtectionBypassTool.tsx"],"sourcesContent":["import {useEffect, useReducer} from 'react'\nimport {useClient, type SanityClient} from 'sanity'\n\nimport {AddIcon, TrashIcon} from '@sanity/icons'\nimport {apiVersion} from '@sanity/preview-url-secret/constants'\nimport {\n vercelProtectionBypassSchemaId as _id,\n vercelProtectionBypassSchemaType as _type,\n tag,\n} from '@sanity/preview-url-secret/constants'\nimport {subscribeToVercelProtectionBypass} 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\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 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 = subscribeToVercelProtectionBypass(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'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","enableVercelProtectionBypass","client","secret","patch","_id","set","transaction","createIfNotExists","_type","commit","tag","disableVercelProtectionBypass","VercelProtectionBypassTool","$","_c","t0","Symbol","for","apiVersion","useClient","push","pushToast","useToast","t1","state","dispatch","useReducer","adding","removing","t2","then","title","catch","reason","console","error","handleEnable","t3","t4","unsubscribe","subscribeToVercelProtectionBypass","secret_0","useEffect","enabled","t5","height","alignItems","justifyContent","flexDirection","t6","maxWidth","t7","t8","justifyItems","textWrap","t9","reason_0","t10","event","preventDefault","currentTarget","reportValidity","secret_1","FormData","get","_temp","_temp2","t11","event_1","setCustomValidity","value","length","required","event_0"],"mappings":";;;;;;;;AAgCA,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;A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sGACH;AAAA,MACA,oBAAC,aACM,MAAA,UACI,SAAA+D,OAGD,QAAAC,QAQG,WAAA,IACA,WAAA,IACE,cAAA,OACE,gBAAA,OACH,aAAA,OACD,YAAA,SACDvC,UAAAA,OAAAA,CAAM;AAAA,IAAA,GAEpB;AAAA,IACA,oBAAC,QAAA,EACM,MAAA,UACIA,SAAAA,QACH,MAAAA,SAAA,iBAAA,QACD,MAAA,WAAA,CAAU;AAAA,EAAA,EAAA,CAEnB,EAAA,CACF,GACF,EAAA,CACF,GACDd,QAAAc,QAAAd,QAAAuB,cAAAvB,EAAA,EAAA,IAAAW,MAAAzB,QAAAc,QAAA4C,OAAAA,MAAA5C,EAAA,EAAA;AAAA,MAAAsD;AAAA,SAAAtD,EAAA,EAAA,MAAA4C,OAAA5C,UAAA0C,MAvKHY,uCACEZ,UAAAA;AAAAA,IAAAA;AAAAA,IA8GCE;AAAAA,EAAAA,EAAAA,CAwDA,GACA5C,QAAA4C,KAAA5C,QAAA0C,IAAA1C,QAAAsD,OAAAA,MAAAtD,EAAA,EAAA,GAxKHsD;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.ts
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
icon?: React.ComponentType
|
|
1
|
+
import * as sanity0 from "sanity";
|
|
2
|
+
interface VercelProtectionBypassConfig {
|
|
3
|
+
name?: string;
|
|
4
|
+
title?: string;
|
|
5
|
+
icon?: React.ComponentType;
|
|
7
6
|
}
|
|
8
|
-
|
|
9
|
-
export
|
|
10
|
-
|
|
11
|
-
export {}
|
|
7
|
+
declare const vercelProtectionBypassTool: sanity0.Plugin<void | VercelProtectionBypassConfig>;
|
|
8
|
+
export { VercelProtectionBypassConfig, vercelProtectionBypassTool };
|
package/package.json
CHANGED
|
@@ -1,30 +1,31 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sanity/vercel-protection-bypass",
|
|
3
|
-
"version": "
|
|
4
|
-
"homepage": "https://github.com/sanity-io/
|
|
3
|
+
"version": "3.0.0",
|
|
4
|
+
"homepage": "https://github.com/sanity-io/plugins/tree/main/packages/%40sanity/vercel-protection-bypass#readme",
|
|
5
5
|
"bugs": {
|
|
6
|
-
"url": "https://github.com/sanity-io/
|
|
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/
|
|
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
|
+
"keywords": [
|
|
14
|
+
"sanity",
|
|
15
|
+
"studio",
|
|
16
|
+
"sanity-plugin",
|
|
17
|
+
"vercel"
|
|
18
|
+
],
|
|
13
19
|
"license": "MIT",
|
|
14
20
|
"author": "Sanity.io <hello@sanity.io>",
|
|
15
|
-
"sideEffects": false,
|
|
16
21
|
"type": "module",
|
|
17
22
|
"exports": {
|
|
18
23
|
".": {
|
|
19
24
|
"source": "./src/index.ts",
|
|
20
|
-
"import": "./dist/index.js",
|
|
21
|
-
"require": "./dist/index.cjs",
|
|
22
25
|
"default": "./dist/index.js"
|
|
23
26
|
},
|
|
24
27
|
"./package.json": "./package.json"
|
|
25
28
|
},
|
|
26
|
-
"main": "./dist/index.cjs",
|
|
27
|
-
"module": "./dist/index.js",
|
|
28
29
|
"types": "./dist/index.d.ts",
|
|
29
30
|
"files": [
|
|
30
31
|
"dist",
|
|
@@ -33,46 +34,33 @@
|
|
|
33
34
|
"!src/**/*.test-d.ts",
|
|
34
35
|
"CHANGELOG.md"
|
|
35
36
|
],
|
|
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
37
|
"dependencies": {
|
|
45
38
|
"@sanity/icons": "^3.7.4",
|
|
46
|
-
"@sanity/
|
|
47
|
-
"
|
|
48
|
-
"
|
|
39
|
+
"@sanity/preview-url-secret": "^2.1.16",
|
|
40
|
+
"@sanity/ui": "^3.1.11",
|
|
41
|
+
"react-compiler-runtime": "^1.0.0"
|
|
49
42
|
},
|
|
50
43
|
"devDependencies": {
|
|
51
|
-
"@sanity/pkg-utils": "^
|
|
52
|
-
"
|
|
53
|
-
"
|
|
44
|
+
"@sanity/pkg-utils": "^9.1.1",
|
|
45
|
+
"@types/react": "^19.2.6",
|
|
46
|
+
"@typescript/native-preview": "7.0.0-dev.20251117.1",
|
|
47
|
+
"babel-plugin-react-compiler": "^1.0.0",
|
|
54
48
|
"react": "^19.2.0",
|
|
55
|
-
"sanity": "^4.
|
|
56
|
-
"typescript": "5.9.3"
|
|
57
|
-
"vitest": "^3.2.4",
|
|
58
|
-
"@repo/package.config": "0.0.0",
|
|
59
|
-
"@repo/eslint-config": "0.0.0",
|
|
60
|
-
"@repo/prettier-config": "0.0.0"
|
|
49
|
+
"sanity": "^4.16.0",
|
|
50
|
+
"typescript": "5.9.3"
|
|
61
51
|
},
|
|
62
52
|
"peerDependencies": {
|
|
63
53
|
"react": "^18.3 || ^19",
|
|
64
54
|
"sanity": "^3.93.0 || ^4"
|
|
65
55
|
},
|
|
66
56
|
"engines": {
|
|
67
|
-
"node": ">=20.19"
|
|
57
|
+
"node": ">=20.19 <22 || >=22.12"
|
|
68
58
|
},
|
|
69
59
|
"publishConfig": {
|
|
70
60
|
"access": "public"
|
|
71
61
|
},
|
|
72
62
|
"scripts": {
|
|
73
|
-
"
|
|
74
|
-
"
|
|
75
|
-
"lint": "eslint .",
|
|
76
|
-
"test": "vitest --pass-with-no-tests --typecheck"
|
|
63
|
+
"typecheck": "(cd ../../.. && tsgo --project packages/@sanity/vercel-protection-bypass/tsconfig.json)",
|
|
64
|
+
"build": "pkg build --strict --check --clean"
|
|
77
65
|
}
|
|
78
66
|
}
|
|
@@ -1,13 +1,15 @@
|
|
|
1
|
+
import {useEffect, useReducer} from 'react'
|
|
2
|
+
import {useClient, type SanityClient} from 'sanity'
|
|
3
|
+
|
|
1
4
|
import {AddIcon, TrashIcon} from '@sanity/icons'
|
|
2
5
|
import {apiVersion} from '@sanity/preview-url-secret/constants'
|
|
3
6
|
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
} from '@sanity/preview-url-secret/
|
|
7
|
+
vercelProtectionBypassSchemaId as _id,
|
|
8
|
+
vercelProtectionBypassSchemaType as _type,
|
|
9
|
+
tag,
|
|
10
|
+
} from '@sanity/preview-url-secret/constants'
|
|
11
|
+
import {subscribeToVercelProtectionBypass} from '@sanity/preview-url-secret/toggle-vercel-protection-bypass'
|
|
8
12
|
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
13
|
|
|
12
14
|
interface State {
|
|
13
15
|
status:
|
|
@@ -51,6 +53,16 @@ function reducer(prevState: State, action: Action): State {
|
|
|
51
53
|
}
|
|
52
54
|
}
|
|
53
55
|
|
|
56
|
+
async function enableVercelProtectionBypass(client: SanityClient, secret: string): Promise<void> {
|
|
57
|
+
const patch = client.patch(_id).set({secret})
|
|
58
|
+
await client.transaction().createIfNotExists({_id, _type}).patch(patch).commit({tag})
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
async function disableVercelProtectionBypass(client: SanityClient): Promise<void> {
|
|
62
|
+
const patch = client.patch(_id).set({secret: null})
|
|
63
|
+
await client.transaction().createIfNotExists({_id, _type}).patch(patch).commit({tag})
|
|
64
|
+
}
|
|
65
|
+
|
|
54
66
|
export default function VercelProtectionBypassTool(): React.JSX.Element {
|
|
55
67
|
const client = useClient({apiVersion: apiVersion})
|
|
56
68
|
const {push: pushToast} = useToast()
|
|
@@ -81,7 +93,7 @@ export default function VercelProtectionBypassTool(): React.JSX.Element {
|
|
|
81
93
|
}
|
|
82
94
|
|
|
83
95
|
useEffect(() => {
|
|
84
|
-
const unsubscribe =
|
|
96
|
+
const unsubscribe = subscribeToVercelProtectionBypass(client, (secret) =>
|
|
85
97
|
dispatch({type: secret ? 'saved-secret' : 'removed-secret'}),
|
|
86
98
|
)
|
|
87
99
|
return () => unsubscribe()
|
|
@@ -1,188 +0,0 @@
|
|
|
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");
|
|
3
|
-
function reducer(prevState, action) {
|
|
4
|
-
switch (action.type) {
|
|
5
|
-
case "removed-secret":
|
|
6
|
-
return {
|
|
7
|
-
...prevState,
|
|
8
|
-
status: "disabled"
|
|
9
|
-
};
|
|
10
|
-
case "remove-secret":
|
|
11
|
-
return {
|
|
12
|
-
...prevState,
|
|
13
|
-
status: "removing-secret"
|
|
14
|
-
};
|
|
15
|
-
case "saved-secret":
|
|
16
|
-
return {
|
|
17
|
-
...prevState,
|
|
18
|
-
status: "enabled"
|
|
19
|
-
};
|
|
20
|
-
case "save-secret":
|
|
21
|
-
return {
|
|
22
|
-
...prevState,
|
|
23
|
-
status: "adding-secret"
|
|
24
|
-
};
|
|
25
|
-
case "cancel-add-secret":
|
|
26
|
-
return {
|
|
27
|
-
...prevState,
|
|
28
|
-
status: "disabled"
|
|
29
|
-
};
|
|
30
|
-
case "add-secret":
|
|
31
|
-
return {
|
|
32
|
-
...prevState,
|
|
33
|
-
status: "add-secret-dialog"
|
|
34
|
-
};
|
|
35
|
-
case "failed-remove-secret":
|
|
36
|
-
return {
|
|
37
|
-
...prevState,
|
|
38
|
-
status: "enabled"
|
|
39
|
-
};
|
|
40
|
-
case "failed-add-secret":
|
|
41
|
-
return {
|
|
42
|
-
...prevState,
|
|
43
|
-
status: "add-secret-dialog"
|
|
44
|
-
};
|
|
45
|
-
default:
|
|
46
|
-
return prevState;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
function VercelProtectionBypassTool() {
|
|
50
|
-
const $ = reactCompilerRuntime.c(25);
|
|
51
|
-
let t0;
|
|
52
|
-
$[0] === Symbol.for("react.memo_cache_sentinel") ? (t0 = {
|
|
53
|
-
apiVersion: constants.apiVersion
|
|
54
|
-
}, $[0] = t0) : t0 = $[0];
|
|
55
|
-
const client = sanity.useClient(t0), {
|
|
56
|
-
push: pushToast
|
|
57
|
-
} = ui.useToast();
|
|
58
|
-
let t1;
|
|
59
|
-
$[1] === Symbol.for("react.memo_cache_sentinel") ? (t1 = {
|
|
60
|
-
status: "loading"
|
|
61
|
-
}, $[1] = t1) : t1 = $[1];
|
|
62
|
-
const [state, dispatch] = react.useReducer(reducer, t1), adding = state.status === "adding-secret", removing = state.status === "removing-secret";
|
|
63
|
-
let t2;
|
|
64
|
-
$[2] !== client || $[3] !== pushToast ? (t2 = (secret) => {
|
|
65
|
-
dispatch({
|
|
66
|
-
type: "save-secret"
|
|
67
|
-
}), toggleVercelProtectionBypass.enableVercelProtectionBypass(client, secret).then(() => {
|
|
68
|
-
dispatch({
|
|
69
|
-
type: "saved-secret"
|
|
70
|
-
}), pushToast({
|
|
71
|
-
status: "success",
|
|
72
|
-
title: "Protection bypass is now enabled"
|
|
73
|
-
});
|
|
74
|
-
}).catch((reason) => {
|
|
75
|
-
console.error(reason), pushToast({
|
|
76
|
-
status: "error",
|
|
77
|
-
title: "There was an error when trying to enable protection bypass. See the browser console for more information."
|
|
78
|
-
}), dispatch({
|
|
79
|
-
type: "failed-add-secret"
|
|
80
|
-
});
|
|
81
|
-
});
|
|
82
|
-
}, $[2] = client, $[3] = pushToast, $[4] = t2) : t2 = $[4];
|
|
83
|
-
const handleEnable = t2;
|
|
84
|
-
let t3, t4;
|
|
85
|
-
$[5] !== client ? (t3 = () => {
|
|
86
|
-
const unsubscribe = toggleVercelProtectionBypass.subcribeToVercelProtectionBypass(client, (secret_0) => dispatch({
|
|
87
|
-
type: secret_0 ? "saved-secret" : "removed-secret"
|
|
88
|
-
}));
|
|
89
|
-
return () => unsubscribe();
|
|
90
|
-
}, t4 = [client], $[5] = client, $[6] = t3, $[7] = t4) : (t3 = $[6], t4 = $[7]), react.useEffect(t3, t4);
|
|
91
|
-
const enabled = state.status === "enabled" || removing;
|
|
92
|
-
let t5;
|
|
93
|
-
$[8] === Symbol.for("react.memo_cache_sentinel") ? (t5 = {
|
|
94
|
-
height: "100%",
|
|
95
|
-
alignItems: "center",
|
|
96
|
-
justifyContent: "center",
|
|
97
|
-
flexDirection: "column"
|
|
98
|
-
}, $[8] = t5) : t5 = $[8];
|
|
99
|
-
let t6;
|
|
100
|
-
$[9] === Symbol.for("react.memo_cache_sentinel") ? (t6 = {
|
|
101
|
-
maxWidth: 640
|
|
102
|
-
}, $[9] = t6) : t6 = $[9];
|
|
103
|
-
let t7, t8;
|
|
104
|
-
$[10] === Symbol.for("react.memo_cache_sentinel") ? (t7 = {
|
|
105
|
-
justifyItems: "flex-start",
|
|
106
|
-
textWrap: "pretty"
|
|
107
|
-
}, t8 = /* @__PURE__ */ jsxRuntime.jsx(ui.Heading, { children: "Vercel Protection Bypass" }), $[10] = t7, $[11] = t8) : (t7 = $[10], t8 = $[11]);
|
|
108
|
-
let t9;
|
|
109
|
-
$[12] !== client || $[13] !== enabled || $[14] !== pushToast || $[15] !== removing || $[16] !== state.status ? (t9 = /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { sizing: "border", display: "flex", style: t5, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Stack, { space: 5, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Card, { padding: 4, style: t6, children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Stack, { space: 4, style: t7, children: [
|
|
110
|
-
t8,
|
|
111
|
-
enabled ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
112
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Box, { children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Text, { style: {
|
|
113
|
-
textWrap: "pretty"
|
|
114
|
-
}, children: [
|
|
115
|
-
"Sanity Presentation is setup to use",
|
|
116
|
-
" ",
|
|
117
|
-
/* @__PURE__ */ jsxRuntime.jsx("a", { href: "https://vercel.com/docs/security/deployment-protection/methods-to-bypass-deployment-protection/protection-bypass-automation", target: "_blank", rel: "noreferrer", children: "protection bypass for automation" }),
|
|
118
|
-
" ",
|
|
119
|
-
"in order to display protected deployments in its preview iframe for the current Sanity dataset."
|
|
120
|
-
] }) }),
|
|
121
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Box, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { children: "You can turn off automatic protection bypass at any time by clicking the button below." }) }),
|
|
122
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { mode: "ghost", tone: "critical", icon: /* @__PURE__ */ jsxRuntime.jsx(icons.TrashIcon, {}), loading: removing, onClick: () => {
|
|
123
|
-
dispatch({
|
|
124
|
-
type: "remove-secret"
|
|
125
|
-
}), toggleVercelProtectionBypass.disableVercelProtectionBypass(client).then(() => {
|
|
126
|
-
pushToast({
|
|
127
|
-
status: "warning",
|
|
128
|
-
title: "Protection bypass is now disabled"
|
|
129
|
-
}), dispatch({
|
|
130
|
-
type: "removed-secret"
|
|
131
|
-
});
|
|
132
|
-
}).catch((reason_0) => {
|
|
133
|
-
console.error(reason_0), pushToast({
|
|
134
|
-
status: "error",
|
|
135
|
-
title: "There was an error when trying to disable protection bypass. See the browser console for more information."
|
|
136
|
-
}), dispatch({
|
|
137
|
-
type: "failed-remove-secret"
|
|
138
|
-
});
|
|
139
|
-
});
|
|
140
|
-
}, text: "Remove secret" }),
|
|
141
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { children: "Protection bypass remains enabled if this plugin is removed from your Sanity config." })
|
|
142
|
-
] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
143
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Box, { children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Text, { style: {
|
|
144
|
-
textWrap: "pretty"
|
|
145
|
-
}, children: [
|
|
146
|
-
"Follow the instructions on",
|
|
147
|
-
" ",
|
|
148
|
-
/* @__PURE__ */ jsxRuntime.jsx("a", { href: "https://vercel.com/docs/security/deployment-protection/methods-to-bypass-deployment-protection/protection-bypass-automation", target: "_blank", rel: "noreferrer", children: "how to enable protection bypass for automation" }),
|
|
149
|
-
"."
|
|
150
|
-
] }) }),
|
|
151
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Box, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { children: "This will setup a secret that Vercel exposes as an environment variable called VERCEL_AUTOMATION_BYPASS_SECRET, its value is the secret you need." }) }),
|
|
152
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { mode: "ghost", icon: /* @__PURE__ */ jsxRuntime.jsx(icons.AddIcon, {}), loading: state.status === "loading", onClick: () => {
|
|
153
|
-
dispatch({
|
|
154
|
-
type: "add-secret"
|
|
155
|
-
});
|
|
156
|
-
}, text: "Add secret" }),
|
|
157
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { children: "If you're using Sanity Presentation Tool with multiple protected deployments ensure that they have the same secret set, as this tool will set a secret that is shared in your dataset with all instances of Presentation Tool." })
|
|
158
|
-
] })
|
|
159
|
-
] }) }) }) }), $[12] = client, $[13] = enabled, $[14] = pushToast, $[15] = removing, $[16] = state.status, $[17] = t9) : t9 = $[17];
|
|
160
|
-
let t10;
|
|
161
|
-
$[18] !== adding || $[19] !== handleEnable || $[20] !== state.status ? (t10 = (state.status === "add-secret-dialog" || state.status === "adding-secret") && /* @__PURE__ */ jsxRuntime.jsx(ui.Dialog, { animate: !0, id: "add-secret-dialog", onClickOutside: () => dispatch({
|
|
162
|
-
type: "cancel-add-secret"
|
|
163
|
-
}), children: /* @__PURE__ */ jsxRuntime.jsx(ui.Card, { padding: 3, children: /* @__PURE__ */ jsxRuntime.jsx("form", { onSubmit: (event) => {
|
|
164
|
-
event.preventDefault(), event.currentTarget.reportValidity();
|
|
165
|
-
const secret_1 = new FormData(event.currentTarget).get("secret");
|
|
166
|
-
secret_1 && handleEnable(secret_1);
|
|
167
|
-
}, children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Stack, { space: 3, children: [
|
|
168
|
-
/* @__PURE__ */ jsxRuntime.jsxs(ui.Stack, { space: 2, children: [
|
|
169
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { as: "label", weight: "semibold", size: 1, children: "Add bypass secret" }),
|
|
170
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { muted: !0, size: 1, children: "Make sure it's the same secret the Vercel deployment is using that's loaded in the preview iframe." }),
|
|
171
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.TextInput, { name: "secret", onFocus: _temp, onBlur: _temp2, minLength: 32, maxLength: 32, autoComplete: "off", autoCapitalize: "off", autoCorrect: "off", spellCheck: "false", disabled: adding })
|
|
172
|
-
] }),
|
|
173
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { type: "submit", loading: adding, text: adding ? "Saving\u2026" : "Save", tone: "positive" })
|
|
174
|
-
] }) }) }) }), $[18] = adding, $[19] = handleEnable, $[20] = state.status, $[21] = t10) : t10 = $[21];
|
|
175
|
-
let t11;
|
|
176
|
-
return $[22] !== t10 || $[23] !== t9 ? (t11 = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
177
|
-
t9,
|
|
178
|
-
t10
|
|
179
|
-
] }), $[22] = t10, $[23] = t9, $[24] = t11) : t11 = $[24], t11;
|
|
180
|
-
}
|
|
181
|
-
function _temp2(event_1) {
|
|
182
|
-
event_1.currentTarget.setCustomValidity(event_1.currentTarget.value.length == 32 ? "" : "Secret must be 32 characters long"), event_1.currentTarget.required = !0;
|
|
183
|
-
}
|
|
184
|
-
function _temp(event_0) {
|
|
185
|
-
event_0.currentTarget.setCustomValidity("");
|
|
186
|
-
}
|
|
187
|
-
exports.default = VercelProtectionBypassTool;
|
|
188
|
-
//# sourceMappingURL=VercelProtectionBypassTool.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
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'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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e,QAAA,YAAiB,MAAA,GAAG,UAAA,oBAAA,CAE5C;AAAA,qCACCA,GAAAA,MAAA,EAAK,WAAY,MAAA,GACf,UAAA,sGACH;AAAA,MACAL,2BAAAA,IAACoB,GAAAA,aACM,MAAA,UACI,SAAAC,OAGD,QAAAC,QAQG,WAAA,IACA,WAAA,IACE,cAAA,OACE,gBAAA,OACH,aAAA,OACD,YAAA,SACDvD,UAAAA,OAAAA,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;;"}
|
package/dist/index.cjs
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: !0 });
|
|
3
|
-
var react = require("react"), sanity = require("sanity");
|
|
4
|
-
const id = "vercel-protection-bypass", vercelProtectionBypassTool = sanity.definePlugin((options) => {
|
|
5
|
-
const {
|
|
6
|
-
name,
|
|
7
|
-
title,
|
|
8
|
-
icon,
|
|
9
|
-
...config
|
|
10
|
-
} = options || {};
|
|
11
|
-
return {
|
|
12
|
-
name: `@sanity/preview-url-secret/${id}`,
|
|
13
|
-
tools: [{
|
|
14
|
-
name: name || "vercel-protection-bypass",
|
|
15
|
-
title: title || "Vercel Protection Bypass",
|
|
16
|
-
icon,
|
|
17
|
-
component: react.lazy(() => Promise.resolve().then(function() {
|
|
18
|
-
return require("./_chunks-cjs/VercelProtectionBypassTool.cjs");
|
|
19
|
-
})),
|
|
20
|
-
options: config,
|
|
21
|
-
__internalApplicationType: `sanity/${id}`
|
|
22
|
-
}]
|
|
23
|
-
};
|
|
24
|
-
});
|
|
25
|
-
exports.vercelProtectionBypassTool = vercelProtectionBypassTool;
|
|
26
|
-
//# sourceMappingURL=index.cjs.map
|
package/dist/index.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../src/index.ts"],"sourcesContent":["import {lazy} from 'react'\nimport {definePlugin} from 'sanity'\n\nconst id = 'vercel-protection-bypass'\n\nexport interface VercelProtectionBypassConfig {\n name?: string\n title?: string\n icon?: React.ComponentType\n}\n\nexport const vercelProtectionBypassTool = definePlugin<VercelProtectionBypassConfig | void>(\n (options) => {\n const {name, title, icon, ...config} = options || {}\n return {\n name: `@sanity/preview-url-secret/${id}`,\n tools: [\n {\n name: name || 'vercel-protection-bypass',\n title: title || 'Vercel Protection Bypass',\n icon: icon,\n component: lazy(() => import('./VercelProtectionBypassTool')),\n options: config,\n __internalApplicationType: `sanity/${id}`,\n },\n ],\n }\n },\n)\n"],"names":["id","vercelProtectionBypassTool","definePlugin","options","name","title","icon","config","tools","component","lazy","__internalApplicationType"],"mappings":";;;AAGA,MAAMA,KAAK,4BAQEC,6BAA6BC,OAAAA,aACvCC,CAAAA,YAAY;AACX,QAAM;AAAA,IAACC;AAAAA,IAAMC;AAAAA,IAAOC;AAAAA,IAAM,GAAGC;AAAAA,EAAAA,IAAUJ,WAAW,CAAA;AAClD,SAAO;AAAA,IACLC,MAAM,8BAA8BJ,EAAE;AAAA,IACtCQ,OAAO,CACL;AAAA,MACEJ,MAAMA,QAAQ;AAAA,MACdC,OAAOA,SAAS;AAAA,MAChBC;AAAAA,MACAG,WAAWC,MAAAA,KAAK,MAAM,QAAA,QAAA,EAAA,KAAA,WAAA;AAAA,eAAA,QAAO,8CAA8B;AAAA,QAAC;AAAA,MAC5DP,SAASI;AAAAA,MACTI,2BAA2B,UAAUX,EAAE;AAAA,IAAA,CACxC;AAAA,EAAA;AAGP,CACF;;"}
|
package/dist/index.d.cts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import {Plugin as Plugin_2} from 'sanity'
|
|
2
|
-
|
|
3
|
-
export declare interface VercelProtectionBypassConfig {
|
|
4
|
-
name?: string
|
|
5
|
-
title?: string
|
|
6
|
-
icon?: React.ComponentType
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export declare const vercelProtectionBypassTool: Plugin_2<void | VercelProtectionBypassConfig>
|
|
10
|
-
|
|
11
|
-
export {}
|