@@ -11,6 +11,9 @@ import type {
11
11
} from 'data/integrations/integrations.types'
12
12
import { useVercelConnectionUpdateMutation } from 'data/integrations/vercel-connection-update-mutate'
13
13
import {
14
+ AlertDescription_Shadcn_ ,
15
+ AlertTitle_Shadcn_ ,
16
+ Alert_Shadcn_ ,
14
17
FormControl_Shadcn_ ,
15
18
FormDescription_Shadcn_ ,
16
19
FormField_Shadcn_ ,
@@ -21,6 +24,8 @@ import {
21
24
Input_Shadcn_ ,
22
25
Switch ,
23
26
} from 'ui'
27
+ import { useSelectedOrganization } from 'hooks/misc/useSelectedOrganization'
28
+ import Link from 'next/link'
24
29
25
30
const VercelIntegrationConnectionForm = ( {
26
31
disabled,
@@ -31,7 +36,11 @@ const VercelIntegrationConnectionForm = ({
31
36
connection : IntegrationProjectConnection
32
37
integration : Integration
33
38
} ) => {
34
- const envSyncTargets = connection . env_sync_targets ?? [ ]
39
+ // NOTE(kamil): Ignore sync targets for Vercel Marketplace as it's not synchronized using integration,
40
+ // but through a separate marketplace mechanism. It's not theoretically necessary, but we might have some stale data.
41
+ const org = useSelectedOrganization ( )
42
+ const envSyncTargets =
43
+ org ?. managed_by === 'vercel-marketplace' ? [ ] : connection . env_sync_targets ?? [ ]
35
44
36
45
const FormSchema = z . object ( {
37
46
environmentVariablesProduction : z . boolean ( ) . default ( envSyncTargets . includes ( 'production' ) ) ,
@@ -88,76 +97,101 @@ const VercelIntegrationConnectionForm = ({
88
97
className = { 'w-full space-y-6' }
89
98
>
90
99
< div className = "px-6 py-4 flex flex-col gap-y-4" >
91
- < h5 className = "text-foreground text-sm" >
92
- Sync environment variables for selected target environments
93
- </ h5 >
94
100
< div className = "flex flex-col gap-4" >
95
- < FormField_Shadcn_
96
- control = { form . control }
97
- name = "environmentVariablesProduction"
98
- render = { ( { field } ) => (
99
- < FormItem_Shadcn_ className = "space-y-0 flex gap-x-4" >
100
- < FormControl_Shadcn_ >
101
- < Switch
102
- disabled = { disabled }
103
- className = "mt-1"
104
- checked = { field . value }
105
- onCheckedChange = { field . onChange }
106
- />
107
- </ FormControl_Shadcn_ >
108
- < div >
109
- < FormLabel_Shadcn_ className = "!text" > Production</ FormLabel_Shadcn_ >
110
- < FormDescription_Shadcn_ className = "text-xs text-foreground-lighter" >
111
- Sync environment variables for < code > production</ code > environment.
112
- </ FormDescription_Shadcn_ >
113
- </ div >
114
- </ FormItem_Shadcn_ >
115
- ) }
116
- />
117
- < FormField_Shadcn_
118
- control = { form . control }
119
- name = "environmentVariablesPreview"
120
- render = { ( { field } ) => (
121
- < FormItem_Shadcn_ className = "space-y-0 flex gap-x-4" >
122
- < FormControl_Shadcn_ >
123
- < Switch
124
- disabled = { disabled }
125
- className = "mt-1"
126
- checked = { field . value }
127
- onCheckedChange = { field . onChange }
128
- />
129
- </ FormControl_Shadcn_ >
130
- < div >
131
- < FormLabel_Shadcn_ className = "!text" > Preview</ FormLabel_Shadcn_ >
132
- < FormDescription_Shadcn_ className = "text-xs text-foreground-lighter" >
133
- Sync environment variables for < code > preview</ code > environment.
134
- </ FormDescription_Shadcn_ >
135
- </ div >
136
- </ FormItem_Shadcn_ >
137
- ) }
138
- />
139
- < FormField_Shadcn_
140
- control = { form . control }
141
- name = "environmentVariablesDevelopment"
142
- render = { ( { field } ) => (
143
- < FormItem_Shadcn_ className = "space-y-0 flex gap-x-4" >
144
- < FormControl_Shadcn_ >
145
- < Switch
146
- disabled = { disabled }
147
- className = "mt-1"
148
- checked = { field . value }
149
- onCheckedChange = { field . onChange }
150
- />
151
- </ FormControl_Shadcn_ >
152
- < div >
153
- < FormLabel_Shadcn_ className = "!text" > Development</ FormLabel_Shadcn_ >
154
- < FormDescription_Shadcn_ className = "text-xs text-foreground-lighter" >
155
- Sync environment variables for < code > development</ code > environment.
156
- </ FormDescription_Shadcn_ >
157
- </ div >
158
- </ FormItem_Shadcn_ >
159
- ) }
160
- />
101
+ { org ?. managed_by === 'vercel-marketplace' ? (
102
+ < Alert_Shadcn_ >
103
+ < AlertTitle_Shadcn_ className = "text-sm" >
104
+ Vercel Marketplace managed project
105
+ </ AlertTitle_Shadcn_ >
106
+ < AlertDescription_Shadcn_ className = "text-xs" >
107
+ This project is managed via Vercel Marketplace. Environment variables are
108
+ automatically synchronized for your connected Vercel projects. This integration
109
+ purpose is synchronizing preview deployments environment variables with our{ ' ' }
110
+ < Link
111
+ target = "_blank"
112
+ rel = "noreferrer"
113
+ href = "https://supabase.com/docs/guides/platform/branching"
114
+ className = "underline"
115
+ >
116
+ Branching
117
+ </ Link > { ' ' }
118
+ feature.
119
+ </ AlertDescription_Shadcn_ >
120
+ </ Alert_Shadcn_ >
121
+ ) : (
122
+ < div >
123
+ < h5 className = "text-foreground text-sm" >
124
+ Sync environment variables for selected target environments
125
+ </ h5 >
126
+
127
+ < FormField_Shadcn_
128
+ control = { form . control }
129
+ name = "environmentVariablesProduction"
130
+ render = { ( { field } ) => (
131
+ < FormItem_Shadcn_ className = "space-y-0 flex gap-x-4" >
132
+ < FormControl_Shadcn_ >
133
+ < Switch
134
+ disabled = { disabled }
135
+ className = "mt-1"
136
+ checked = { field . value }
137
+ onCheckedChange = { field . onChange }
138
+ />
139
+ </ FormControl_Shadcn_ >
140
+ < div >
141
+ < FormLabel_Shadcn_ className = "!text" > Production</ FormLabel_Shadcn_ >
142
+ < FormDescription_Shadcn_ className = "text-xs text-foreground-lighter" >
143
+ Sync environment variables for < code > production</ code > environment.
144
+ </ FormDescription_Shadcn_ >
145
+ </ div >
146
+ </ FormItem_Shadcn_ >
147
+ ) }
148
+ />
149
+ < FormField_Shadcn_
150
+ control = { form . control }
151
+ name = "environmentVariablesPreview"
152
+ render = { ( { field } ) => (
153
+ < FormItem_Shadcn_ className = "space-y-0 flex gap-x-4" >
154
+ < FormControl_Shadcn_ >
155
+ < Switch
156
+ disabled = { disabled }
157
+ className = "mt-1"
158
+ checked = { field . value }
159
+ onCheckedChange = { field . onChange }
160
+ />
161
+ </ FormControl_Shadcn_ >
162
+ < div >
163
+ < FormLabel_Shadcn_ className = "!text" > Preview</ FormLabel_Shadcn_ >
164
+ < FormDescription_Shadcn_ className = "text-xs text-foreground-lighter" >
165
+ Sync environment variables for < code > preview</ code > environment.
166
+ </ FormDescription_Shadcn_ >
167
+ </ div >
168
+ </ FormItem_Shadcn_ >
169
+ ) }
170
+ />
171
+ < FormField_Shadcn_
172
+ control = { form . control }
173
+ name = "environmentVariablesDevelopment"
174
+ render = { ( { field } ) => (
175
+ < FormItem_Shadcn_ className = "space-y-0 flex gap-x-4" >
176
+ < FormControl_Shadcn_ >
177
+ < Switch
178
+ disabled = { disabled }
179
+ className = "mt-1"
180
+ checked = { field . value }
181
+ onCheckedChange = { field . onChange }
182
+ />
183
+ </ FormControl_Shadcn_ >
184
+ < div >
185
+ < FormLabel_Shadcn_ className = "!text" > Development</ FormLabel_Shadcn_ >
186
+ < FormDescription_Shadcn_ className = "text-xs text-foreground-lighter" >
187
+ Sync environment variables for < code > development</ code > environment.
188
+ </ FormDescription_Shadcn_ >
189
+ </ div >
190
+ </ FormItem_Shadcn_ >
191
+ ) }
192
+ />
193
+ </ div >
194
+ ) }
161
195
</ div >
162
196
< h5 className = "mt-2 text-foreground text-sm" >
163
197
Customize public environment variable prefix
0 commit comments