sanity-plugin-dashboard-widget-vercel 4.0.12 → 4.0.13

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/dist/index.js CHANGED
@@ -1,16 +1,16 @@
1
- import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
1
  import { c } from "react/compiler-runtime";
3
2
  import { AddIcon } from "@sanity/icons/Add";
4
- import { useTheme_v2, useToast, Button, Box, Label, Text, Flex, Stack, Tooltip, Inline, TextInput, Dialog, ToastProvider, Card } from "@sanity/ui";
5
- import { useQuery, QueryClient, QueryClientProvider } from "@tanstack/react-query";
6
- import { useMachine, useActor } from "@xstate/react";
3
+ import { Box, Button, Card, Dialog, Flex, Inline, Label, Stack, Text, TextInput, ToastProvider, Tooltip, useTheme_v2, useToast } from "@sanity/ui";
4
+ import { QueryClient, QueryClientProvider, useQuery } from "@tanstack/react-query";
5
+ import { useActor, useMachine } from "@xstate/react";
7
6
  import { useClient } from "sanity";
8
7
  import { EditIcon } from "@sanity/icons/Edit";
9
8
  import { useEffect, useRef } from "react";
10
9
  import useDeepCompareEffect from "use-deep-compare-effect";
11
10
  import hash from "object-hash";
12
- import { setup, fromPromise, assign, assertEvent, toPromise } from "xstate";
11
+ import { assertEvent, assign, fromPromise, setup, toPromise } from "xstate";
13
12
  import { UploadIcon } from "@sanity/icons/Upload";
13
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
14
14
  import { LinkIcon } from "@sanity/icons/Link";
15
15
  import "react-time-ago/locale/en";
16
16
  import ReactTimeAgo from "react-time-ago";
@@ -20,1374 +20,1347 @@ import * as yup from "yup";
20
20
  import { uuid } from "@sanity/uuid";
21
21
  import { red } from "@sanity/color";
22
22
  import { ErrorOutlineIcon } from "@sanity/icons/ErrorOutline";
23
- const API_ENDPOINT_DEPLOYMENTS = "https://api.vercel.com/v5/now/deployments", API_ENDPOINT_ALIASES = "https://api.vercel.com/v3/now/aliases", API_VERSION = "1", DEPLOYMENT_TARGET_DOCUMENT_TYPE = "vercel.deploymentTarget", VERCEL_STATUS_COLORS = {
24
- BUILDING: "#f5a623",
25
- CANCELED: "#ff0000",
26
- ERROR: "#ff0000",
27
- READY: "#50e3c2",
28
- QUEUED: "#333"
29
- }, WIDGET_NAME = "Vercel (dashboard)", Z_INDEX_DIALOG = 600001, Z_INDEX_TOAST_PROVIDER = 600002;
23
+ const DEPLOYMENT_TARGET_DOCUMENT_TYPE = "vercel.deploymentTarget", VERCEL_STATUS_COLORS = {
24
+ BUILDING: "#f5a623",
25
+ CANCELED: "#ff0000",
26
+ ERROR: "#ff0000",
27
+ READY: "#50e3c2",
28
+ QUEUED: "#333"
29
+ }, WIDGET_NAME = "Vercel (dashboard)";
30
30
  function useSanityClient() {
31
- const $ = c(1);
32
- let t0;
33
- return $[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t0 = {
34
- apiVersion: API_VERSION
35
- }, $[0] = t0) : t0 = $[0], useClient(t0);
31
+ let $ = c(1), t0;
32
+ return $[0] === Symbol.for("react.memo_cache_sentinel") ? (t0 = { apiVersion: "1" }, $[0] = t0) : t0 = $[0], useClient(t0);
36
33
  }
37
34
  const fetcher = (deploymentTarget) => async (url, extraParams) => {
38
- const params = new URLSearchParams();
39
- if (params.set("projectId", deploymentTarget.projectId), deploymentTarget.teamId && params.set("teamId", deploymentTarget.teamId), extraParams)
40
- for (const [k, v] of extraParams.entries())
41
- params.append(k, v);
42
- const response = await fetch(`${url}?${params.toString()}`, {
43
- headers: {
44
- Authorization: `Bearer ${deploymentTarget.token}`
45
- }
46
- });
47
- if (!response.ok)
48
- throw new Error("Response not OK");
49
- try {
50
- return await response.json();
51
- } catch (err) {
52
- throw new Error("Unable to parse response as JSON", {
53
- cause: err
54
- });
55
- }
35
+ let params = new URLSearchParams();
36
+ if (params.set("projectId", deploymentTarget.projectId), deploymentTarget.teamId && params.set("teamId", deploymentTarget.teamId), extraParams) for (let [k, v] of extraParams.entries()) params.append(k, v);
37
+ let response = await fetch(`${url}?${params.toString()}`, { headers: { Authorization: `Bearer ${deploymentTarget.token}` } });
38
+ if (!response.ok) throw Error("Response not OK");
39
+ try {
40
+ return await response.json();
41
+ } catch (err) {
42
+ throw Error("Unable to parse response as JSON", { cause: err });
43
+ }
56
44
  }, useDeployments = (deploymentTarget, options) => {
57
- const $ = c(35);
58
- let t0;
59
- $[0] !== deploymentTarget ? (t0 = fetcher(deploymentTarget), $[0] = deploymentTarget, $[1] = t0) : t0 = $[1];
60
- const fetchUrl = t0;
61
- let deployParams;
62
- $[2] !== deploymentTarget?.deployLimit ? (deployParams = new URLSearchParams(), deployParams.set("limit", String(deploymentTarget?.deployLimit)), $[2] = deploymentTarget?.deployLimit, $[3] = deployParams) : deployParams = $[3];
63
- let t1;
64
- $[4] !== deploymentTarget ? (t1 = hash(deploymentTarget), $[4] = deploymentTarget, $[5] = t1) : t1 = $[5];
65
- let t2;
66
- $[6] !== t1 ? (t2 = [t1], $[6] = t1, $[7] = t2) : t2 = $[7];
67
- let t3;
68
- $[8] !== deployParams || $[9] !== fetchUrl ? (t3 = () => fetchUrl(API_ENDPOINT_DEPLOYMENTS, deployParams), $[8] = deployParams, $[9] = fetchUrl, $[10] = t3) : t3 = $[10];
69
- const t4 = options?.enabled ?? !0;
70
- let t5;
71
- $[11] !== t2 || $[12] !== t3 || $[13] !== t4 ? (t5 = {
72
- queryKey: t2,
73
- queryFn: t3,
74
- enabled: t4,
75
- refetchInterval: 2e4,
76
- refetchIntervalInBackground: !1,
77
- refetchOnMount: !0,
78
- refetchOnReconnect: "always",
79
- refetchOnWindowFocus: !1,
80
- retry: !1
81
- }, $[11] = t2, $[12] = t3, $[13] = t4, $[14] = t5) : t5 = $[14];
82
- const {
83
- data: deploymentsData,
84
- isFetching: deploymentsIsFetching,
85
- isSuccess: deploymentsIsSuccess,
86
- error: deploymentsError,
87
- refetch
88
- } = useQuery(t5);
89
- let aliasParams;
90
- $[15] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (aliasParams = new URLSearchParams(), aliasParams.set("limit", "20"), $[15] = aliasParams) : aliasParams = $[15];
91
- let t6;
92
- $[16] !== deploymentTarget ? (t6 = hash(deploymentTarget), $[16] = deploymentTarget, $[17] = t6) : t6 = $[17];
93
- let t7;
94
- $[18] !== t6 ? (t7 = [t6, "aliases"], $[18] = t6, $[19] = t7) : t7 = $[19];
95
- let t8;
96
- $[20] !== fetchUrl ? (t8 = () => fetchUrl(API_ENDPOINT_ALIASES, aliasParams), $[20] = fetchUrl, $[21] = t8) : t8 = $[21];
97
- const t9 = !!deploymentsData;
98
- let t10;
99
- $[22] !== t7 || $[23] !== t8 || $[24] !== t9 ? (t10 = {
100
- queryKey: t7,
101
- queryFn: t8,
102
- enabled: t9,
103
- refetchOnMount: !1,
104
- refetchOnReconnect: !1,
105
- refetchOnWindowFocus: !1,
106
- retry: !1
107
- }, $[22] = t7, $[23] = t8, $[24] = t9, $[25] = t10) : t10 = $[25];
108
- const {
109
- data: aliasesData,
110
- isFetching: aliasesIsFetching,
111
- isSuccess: aliasesIsSuccess,
112
- error: aliasesError
113
- } = useQuery(t10), aliases = aliasesData?.aliases;
114
- let deploymentsWithAlias;
115
- if (aliases) {
116
- let t112;
117
- $[26] !== aliases || $[27] !== deploymentsData?.deployments ? (t112 = deploymentsData?.deployments?.map((val) => {
118
- const alias = aliases.find((a) => a.deploymentId === val.uid);
119
- return Object.assign(val, {
120
- alias: alias?.alias
121
- });
122
- }), $[26] = aliases, $[27] = deploymentsData?.deployments, $[28] = t112) : t112 = $[28], deploymentsWithAlias = t112;
123
- }
124
- const t11 = aliasesError || deploymentsError, t12 = aliasesIsFetching || deploymentsIsFetching, t13 = aliasesIsSuccess && deploymentsIsSuccess;
125
- let t14;
126
- return $[29] !== deploymentsWithAlias || $[30] !== refetch || $[31] !== t11 || $[32] !== t12 || $[33] !== t13 ? (t14 = {
127
- deployments: deploymentsWithAlias,
128
- error: t11,
129
- isFetching: t12,
130
- isSuccess: t13,
131
- refetch
132
- }, $[29] = deploymentsWithAlias, $[30] = refetch, $[31] = t11, $[32] = t12, $[33] = t13, $[34] = t14) : t14 = $[34], t14;
133
- }, refreshMachine = setup({
134
- types: {
135
- events: {}
136
- }
137
- }).createMachine({
138
- /** @xstate-layout N4IgpgJg5mDOIC5QAoC2BDAxgCwJYDswBKAOlwgBswBiAJQFEAxBgZQAkBtABgF1FQADgHtYuAC64h+fiAAeiAIwAmAGwkuGrkoAsAZhVKlAVm0KAHABoQAT0QBOJSRN27XFXaMmz2twF9fVmhYeISkAE5gAGYRsCFQ1PS0tADytNx8SCDCohJSMvIIPnYkxhpKXGZ22kY6xla2CAq6CiQudgDsRnYqKroVfe3+gRg4BMQkEdFwcXRMrGz0ACLpMtniktKZBUUlRmUVVTXadTaISrqObUY97QodvWa6QyBBo6ETUTHYkLPM9OwrTJrXKbUDbJTFLjtMzmWraOx3doqeqKMyOeHdXp3BTHXTVZ6vELjMBhMJCMK-eaAwQidZ5LaIY6Q6Gw47wxHI04IGEkDFma5NbTtY7ufwBED4IQQOAyQljIirWkg-KIAC0nIa6oJIyJpHIVEVOQ2KsKShRCDsunUGLcHi8PhU2uC8o+U1iBCghrpoLkZ2uTk0XCq7SRRl0Zg19itXHhIZ85lMEaUTre40mX0gXuVDIQnmKRhZKk6PmaVXN2PUaLsZhj2hUOJU-JTupIJLJYSzxpzeacheLXFL2nNrkrfW8SKFnhDYt8QA */
139
- initial: "idle",
140
- states: {
141
- idle: {
142
- on: {
143
- REFRESH: {
144
- target: "refreshing"
145
- }
146
- }
147
- },
148
- refreshing: {
149
- on: {
150
- ERROR: {
151
- target: "error"
152
- },
153
- REFRESHED: {
154
- target: "refreshed"
155
- }
156
- }
157
- },
158
- refreshed: {
159
- on: {
160
- REFRESH: {
161
- target: "refreshing"
162
- }
163
- }
164
- },
165
- error: {
166
- on: {
167
- REFRESH: {
168
- target: "refreshing"
169
- }
170
- }
171
- }
172
- }
45
+ let $ = c(35), t0;
46
+ $[0] === deploymentTarget ? t0 = $[1] : (t0 = fetcher(deploymentTarget), $[0] = deploymentTarget, $[1] = t0);
47
+ let fetchUrl = t0, deployParams;
48
+ $[2] === deploymentTarget?.deployLimit ? deployParams = $[3] : (deployParams = new URLSearchParams(), deployParams.set("limit", String(deploymentTarget?.deployLimit)), $[2] = deploymentTarget?.deployLimit, $[3] = deployParams);
49
+ let t1;
50
+ $[4] === deploymentTarget ? t1 = $[5] : (t1 = hash(deploymentTarget), $[4] = deploymentTarget, $[5] = t1);
51
+ let t2;
52
+ $[6] === t1 ? t2 = $[7] : (t2 = [t1], $[6] = t1, $[7] = t2);
53
+ let t3;
54
+ $[8] !== deployParams || $[9] !== fetchUrl ? (t3 = () => fetchUrl("https://api.vercel.com/v5/now/deployments", deployParams), $[8] = deployParams, $[9] = fetchUrl, $[10] = t3) : t3 = $[10];
55
+ let t4 = options?.enabled ?? !0, t5;
56
+ $[11] !== t2 || $[12] !== t3 || $[13] !== t4 ? (t5 = {
57
+ queryKey: t2,
58
+ queryFn: t3,
59
+ enabled: t4,
60
+ refetchInterval: 2e4,
61
+ refetchIntervalInBackground: !1,
62
+ refetchOnMount: !0,
63
+ refetchOnReconnect: "always",
64
+ refetchOnWindowFocus: !1,
65
+ retry: !1
66
+ }, $[11] = t2, $[12] = t3, $[13] = t4, $[14] = t5) : t5 = $[14];
67
+ let { data: deploymentsData, isFetching: deploymentsIsFetching, isSuccess: deploymentsIsSuccess, error: deploymentsError, refetch } = useQuery(t5), aliasParams;
68
+ $[15] === Symbol.for("react.memo_cache_sentinel") ? (aliasParams = new URLSearchParams(), aliasParams.set("limit", "20"), $[15] = aliasParams) : aliasParams = $[15];
69
+ let t6;
70
+ $[16] === deploymentTarget ? t6 = $[17] : (t6 = hash(deploymentTarget), $[16] = deploymentTarget, $[17] = t6);
71
+ let t7;
72
+ $[18] === t6 ? t7 = $[19] : (t7 = [t6, "aliases"], $[18] = t6, $[19] = t7);
73
+ let t8;
74
+ $[20] === fetchUrl ? t8 = $[21] : (t8 = () => fetchUrl("https://api.vercel.com/v3/now/aliases", aliasParams), $[20] = fetchUrl, $[21] = t8);
75
+ let t9 = !!deploymentsData, t10;
76
+ $[22] !== t7 || $[23] !== t8 || $[24] !== t9 ? (t10 = {
77
+ queryKey: t7,
78
+ queryFn: t8,
79
+ enabled: t9,
80
+ refetchOnMount: !1,
81
+ refetchOnReconnect: !1,
82
+ refetchOnWindowFocus: !1,
83
+ retry: !1
84
+ }, $[22] = t7, $[23] = t8, $[24] = t9, $[25] = t10) : t10 = $[25];
85
+ let { data: aliasesData, isFetching: aliasesIsFetching, isSuccess: aliasesIsSuccess, error: aliasesError } = useQuery(t10), aliases = aliasesData?.aliases, deploymentsWithAlias;
86
+ if (aliases) {
87
+ let t11;
88
+ $[26] !== aliases || $[27] !== deploymentsData?.deployments ? (t11 = deploymentsData?.deployments?.map((val) => {
89
+ let alias = aliases.find((a) => a.deploymentId === val.uid);
90
+ return Object.assign(val, { alias: alias?.alias });
91
+ }), $[26] = aliases, $[27] = deploymentsData?.deployments, $[28] = t11) : t11 = $[28], deploymentsWithAlias = t11;
92
+ }
93
+ let t11 = aliasesError || deploymentsError, t12 = aliasesIsFetching || deploymentsIsFetching, t13 = aliasesIsSuccess && deploymentsIsSuccess, t14;
94
+ return $[29] !== deploymentsWithAlias || $[30] !== refetch || $[31] !== t11 || $[32] !== t12 || $[33] !== t13 ? (t14 = {
95
+ deployments: deploymentsWithAlias,
96
+ error: t11,
97
+ isFetching: t12,
98
+ isSuccess: t13,
99
+ refetch
100
+ }, $[29] = deploymentsWithAlias, $[30] = refetch, $[31] = t11, $[32] = t12, $[33] = t13, $[34] = t14) : t14 = $[34], t14;
101
+ }, refreshMachine = setup({ types: { events: {} } }).createMachine({
102
+ /** @xstate-layout N4IgpgJg5mDOIC5QAoC2BDAxgCwJYDswBKAOlwgBswBiAJQFEAxBgZQAkBtABgF1FQADgHtYuAC64h+fiAAeiAIwAmAGwkuGrkoAsAZhVKlAVm0KAHABoQAT0QBOJSRN27XFXaMmz2twF9fVmhYeISkAE5gAGYRsCFQ1PS0tADytNx8SCDCohJSMvIIPnYkxhpKXGZ22kY6xla2CAq6CiQudgDsRnYqKroVfe3+gRg4BMQkEdFwcXRMrGz0ACLpMtniktKZBUUlRmUVVTXadTaISrqObUY97QodvWa6QyBBo6ETUTHYkLPM9OwrTJrXKbUDbJTFLjtMzmWraOx3doqeqKMyOeHdXp3BTHXTVZ6vELjMBhMJCMK-eaAwQidZ5LaIY6Q6Gw47wxHI04IGEkDFma5NbTtY7ufwBED4IQQOAyQljIirWkg-KIAC0nIa6oJIyJpHIVEVOQ2KsKShRCDsunUGLcHi8PhU2uC8o+U1iBCghrpoLkZ2uTk0XCq7SRRl0Zg19itXHhIZ85lMEaUTre40mX0gXuVDIQnmKRhZKk6PmaVXN2PUaLsZhj2hUOJU-JTupIJLJYSzxpzeacheLXFL2nNrkrfW8SKFnhDYt8QA */
103
+ initial: "idle",
104
+ states: {
105
+ idle: { on: { REFRESH: { target: "refreshing" } } },
106
+ refreshing: { on: {
107
+ ERROR: { target: "error" },
108
+ REFRESHED: { target: "refreshed" }
109
+ } },
110
+ refreshed: { on: { REFRESH: { target: "refreshing" } } },
111
+ error: { on: { REFRESH: { target: "refreshing" } } }
112
+ }
173
113
  });
174
114
  function useCardColor() {
175
- const $ = c(2), {
176
- color
177
- } = useTheme_v2();
178
- let t0;
179
- return $[0] !== color.border ? (t0 = {
180
- border: color.border
181
- }, $[0] = color.border, $[1] = t0) : t0 = $[1], t0;
115
+ let $ = c(2), { color } = useTheme_v2(), t0;
116
+ return $[0] === color.border ? t0 = $[1] : (t0 = { border: color.border }, $[0] = color.border, $[1] = t0), t0;
182
117
  }
183
118
  const deployMachine = setup({
184
- types: {
185
- context: {},
186
- events: {},
187
- input: {}
188
- },
189
- actors: {
190
- deploy: fromPromise(async ({
191
- input,
192
- signal
193
- }) => {
194
- try {
195
- if (!input.deployHook)
196
- throw new Error("No deployHook URL defined");
197
- const res = await fetch(input.deployHook, {
198
- method: "POST",
199
- signal
200
- }), data = await res.json();
201
- if (!res.ok)
202
- throw data?.error?.message || res.statusText;
203
- } catch (err) {
204
- throw typeof err == "string" ? err : (console.error("Unable to deploy with error:", err), new Error("Please check the developer console for more information", {
205
- cause: err
206
- }));
207
- }
208
- })
209
- }
119
+ types: {
120
+ context: {},
121
+ events: {},
122
+ input: {}
123
+ },
124
+ actors: { deploy: fromPromise(async ({ input, signal }) => {
125
+ try {
126
+ if (!input.deployHook) throw Error("No deployHook URL defined");
127
+ let res = await fetch(input.deployHook, {
128
+ method: "POST",
129
+ signal
130
+ }), data = await res.json();
131
+ if (!res.ok) throw data?.error?.message || res.statusText;
132
+ } catch (err) {
133
+ throw typeof err == "string" ? err : (console.error("Unable to deploy with error:", err), Error("Please check the developer console for more information", { cause: err }));
134
+ }
135
+ }) }
210
136
  }).createMachine({
211
- /** @xstate-layout N4IgpgJg5mDOIC5QTABwDYHsCeA6AlhOmAMQAiAogAoAyA8gJoDaADALqKiqaz4Au+TADtOIAB6IATCxa4AnADYAHAHYArArUslAZjksNAGhDZEARk3yVmhSxVyHC-QBYAvq+MoMOXF6zZ8ISgSCGEwAiEAN0wAa3C-HwSAoIRA6IBjAEMBYVY2PNFuXhyRJHFENTMzXElFJSUzNTVnWx0FY1MESXVcZzUdM2k1OTUVBoV3TzR-X2mcQOCwACclzCXcDGyAMzWAW1nvPCSF1KjMLJK8grKi-kFS0AkESura5QamlpY2jvMB+QcDkqLH0wxYEw8ICSuFgAFd0uk4LByNR6Mx2IUeHdhKIns1ZN9BtYQVpRnJfl1JM55P1BnY1Ep9CpGpMoXM8MtVksUbRGNcuFiSriKs4CQNurYRgZ7BSGr1ASNupIzEo+kp3JChJgUPAyklMcV7sKEABadomRAmtQAhW2wE6VnQwjEA3Yh7lBDOSQUsxeqyaPoWYbWFSO9kHfwLV1CspPHSSHQ1ZyA1UKJzJlQ+iz+5oKewKWrfNyQ6FwhFI6NG2OINOSXDiypKAxtMyZi1dEE1Qk6L0FpTSUMl8OctaVnHVhC1+uDRvNhStin6XDaHQ9liSXTJiUa1xAA */
212
- id: "deploy",
213
- initial: "idle",
214
- context: ({
215
- input
216
- }) => ({
217
- disabled: !1,
218
- feedback: void 0,
219
- label: void 0,
220
- error: void 0,
221
- deployHook: input.deployHook
222
- }),
223
- states: {
224
- idle: {
225
- entry: assign({
226
- feedback: () => {
227
- },
228
- label: () => "Deploy"
229
- }),
230
- on: {
231
- DEPLOY: {
232
- target: "deploying"
233
- }
234
- }
235
- },
236
- deploying: {
237
- entry: assign({
238
- disabled: () => !0,
239
- label: () => "Deploying"
240
- }),
241
- exit: assign({
242
- disabled: () => !1,
243
- label: () => "Deploy"
244
- }),
245
- invoke: {
246
- src: "deploy",
247
- input: ({
248
- context
249
- }) => ({
250
- deployHook: context.deployHook
251
- }),
252
- onDone: {
253
- target: "success"
254
- },
255
- onError: {
256
- target: "error",
257
- actions: assign({
258
- error: ({
259
- event
260
- }) => {
261
- if ("error" in event) {
262
- const {
263
- error
264
- } = event;
265
- if (typeof error == "string")
266
- return error;
267
- if (error instanceof Error)
268
- return error.message;
269
- }
270
- return "Unknown error";
271
- }
272
- })
273
- }
274
- }
275
- },
276
- success: {
277
- entry: assign({
278
- feedback: () => "Successfully started!"
279
- }),
280
- exit: assign({
281
- feedback: () => {
282
- }
283
- }),
284
- on: {
285
- DEPLOY: {
286
- target: "deploying"
287
- }
288
- }
289
- },
290
- error: {
291
- on: {
292
- DEPLOY: {
293
- target: "deploying"
294
- }
295
- }
296
- }
297
- }
137
+ /** @xstate-layout N4IgpgJg5mDOIC5QTABwDYHsCeA6AlhOmAMQAiAogAoAyA8gJoDaADALqKiqaz4Au+TADtOIAB6IATCxa4AnADYAHAHYArArUslAZjksNAGhDZEARk3yVmhSxVyHC-QBYAvq+MoMOXF6zZ8ISgSCGEwAiEAN0wAa3C-HwSAoIRA6IBjAEMBYVY2PNFuXhyRJHFENTMzXElFJSUzNTVnWx0FY1MESXVcZzUdM2k1OTUVBoV3TzR-X2mcQOCwACclzCXcDGyAMzWAW1nvPCSF1KjMLJK8grKi-kFS0AkESura5QamlpY2jvMB+QcDkqLH0wxYEw8ICSuFgAFd0uk4LByNR6Mx2IUeHdhKIns1ZN9BtYQVpRnJfl1JM55P1BnY1Ep9CpGpMoXM8MtVksUbRGNcuFiSriKs4CQNurYRgZ7BSGr1ASNupIzEo+kp3JChJgUPAyklMcV7sKEABadomRAmtQAhW2wE6VnQwjEA3Yh7lBDOSQUsxeqyaPoWYbWFSO9kHfwLV1CspPHSSHQ1ZyA1UKJzJlQ+iz+5oKewKWrfNyQ6FwhFI6NG2OINOSXDiypKAxtMyZi1dEE1Qk6L0FpTSUMl8OctaVnHVhC1+uDRvNhStin6XDaHQ9liSXTJiUa1xAA */
138
+ id: "deploy",
139
+ initial: "idle",
140
+ context: ({ input }) => ({
141
+ disabled: !1,
142
+ feedback: void 0,
143
+ label: void 0,
144
+ error: void 0,
145
+ deployHook: input.deployHook
146
+ }),
147
+ states: {
148
+ idle: {
149
+ entry: assign({
150
+ feedback: () => void 0,
151
+ label: () => "Deploy"
152
+ }),
153
+ on: { DEPLOY: { target: "deploying" } }
154
+ },
155
+ deploying: {
156
+ entry: assign({
157
+ disabled: () => !0,
158
+ label: () => "Deploying"
159
+ }),
160
+ exit: assign({
161
+ disabled: () => !1,
162
+ label: () => "Deploy"
163
+ }),
164
+ invoke: {
165
+ src: "deploy",
166
+ input: ({ context }) => ({ deployHook: context.deployHook }),
167
+ onDone: { target: "success" },
168
+ onError: {
169
+ target: "error",
170
+ actions: assign({ error: ({ event }) => {
171
+ if ("error" in event) {
172
+ let { error } = event;
173
+ if (typeof error == "string") return error;
174
+ if (error instanceof Error) return error.message;
175
+ }
176
+ return "Unknown error";
177
+ } })
178
+ }
179
+ }
180
+ },
181
+ success: {
182
+ entry: assign({ feedback: () => "Successfully started!" }),
183
+ exit: assign({ feedback: () => void 0 }),
184
+ on: { DEPLOY: { target: "deploying" } }
185
+ },
186
+ error: { on: { DEPLOY: { target: "deploying" } } }
187
+ }
298
188
  }), StateDebug = (props) => {
299
- c(10);
300
- const {
301
- name,
302
- state
303
- } = props;
304
- return null;
189
+ c(10);
190
+ let { name, state } = props;
191
+ return null;
305
192
  }, DeployButton = (props) => {
306
- const $ = c(29), {
307
- deployHook,
308
- onDeploySuccess,
309
- targetName
310
- } = props;
311
- let t0;
312
- $[0] !== deployHook ? (t0 = {
313
- input: {
314
- deployHook
315
- }
316
- }, $[0] = deployHook, $[1] = t0) : t0 = $[1];
317
- const [deployState, deployStateTransition, deployStateInterpreter] = useMachine(deployMachine, t0), toast = useToast();
318
- let t1;
319
- $[2] !== deployState ? (t1 = deployState.matches("error"), $[2] = deployState, $[3] = t1) : t1 = $[3];
320
- const isError = t1;
321
- let t2;
322
- $[4] !== deployState ? (t2 = deployState.matches("success"), $[4] = deployState, $[5] = t2) : t2 = $[5];
323
- const isSuccess = t2;
324
- let t3;
325
- $[6] !== deployStateTransition ? (t3 = () => {
326
- deployStateTransition({
327
- type: "DEPLOY"
328
- });
329
- }, $[6] = deployStateTransition, $[7] = t3) : t3 = $[7];
330
- const handleDeploy = t3;
331
- let t4, t5;
332
- $[8] !== deployState.context.error || $[9] !== isError || $[10] !== isSuccess || $[11] !== targetName || $[12] !== toast ? (t4 = () => {
333
- isError && toast.push({
334
- closable: !0,
335
- description: `Unable to queue deploy for ${targetName}: ${deployState.context.error}`,
336
- duration: 8e3,
337
- status: "error",
338
- title: WIDGET_NAME
339
- }), isSuccess && toast.push({
340
- closable: !0,
341
- description: `Deploy queued for ${targetName}`,
342
- duration: 8e3,
343
- status: "success",
344
- title: WIDGET_NAME
345
- });
346
- }, t5 = [isError, isSuccess, toast, targetName, deployState.context.error], $[8] = deployState.context.error, $[9] = isError, $[10] = isSuccess, $[11] = targetName, $[12] = toast, $[13] = t4, $[14] = t5) : (t4 = $[13], t5 = $[14]), useEffect(t4, t5);
347
- let t6, t7;
348
- $[15] !== deployStateInterpreter || $[16] !== onDeploySuccess ? (t6 = () => {
349
- const subscription = deployStateInterpreter.subscribe((state) => {
350
- state.value === "success" && onDeploySuccess && onDeploySuccess();
351
- });
352
- return () => subscription.unsubscribe();
353
- }, t7 = [deployStateInterpreter, onDeploySuccess], $[15] = deployStateInterpreter, $[16] = onDeploySuccess, $[17] = t6, $[18] = t7) : (t6 = $[17], t7 = $[18]), useEffect(t6, t7);
354
- let t8;
355
- $[19] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t8 = {
356
- position: "relative"
357
- }, $[19] = t8) : t8 = $[19];
358
- let t9;
359
- $[20] !== deployState ? (t9 = /* @__PURE__ */ jsx(StateDebug, { name: "Deploy", state: deployState }), $[20] = deployState, $[21] = t9) : t9 = $[21];
360
- const t10 = `${deployState.context.label} ${targetName}`;
361
- let t11;
362
- $[22] !== deployState.context.disabled || $[23] !== handleDeploy || $[24] !== t10 ? (t11 = /* @__PURE__ */ jsx(Button, { disabled: deployState.context.disabled, fontSize: 1, icon: UploadIcon, mode: "ghost", onClick: handleDeploy, padding: 3, text: t10, tone: "default" }), $[22] = deployState.context.disabled, $[23] = handleDeploy, $[24] = t10, $[25] = t11) : t11 = $[25];
363
- let t12;
364
- return $[26] !== t11 || $[27] !== t9 ? (t12 = /* @__PURE__ */ jsxs(Box, { padding: 3, style: t8, children: [
365
- t9,
366
- t11
367
- ] }), $[26] = t11, $[27] = t9, $[28] = t12) : t12 = $[28], t12;
193
+ let $ = c(29), { deployHook, onDeploySuccess, targetName } = props, t0;
194
+ $[0] === deployHook ? t0 = $[1] : (t0 = { input: { deployHook } }, $[0] = deployHook, $[1] = t0);
195
+ let [deployState, deployStateTransition, deployStateInterpreter] = useMachine(deployMachine, t0), toast = useToast(), t1;
196
+ $[2] === deployState ? t1 = $[3] : (t1 = deployState.matches("error"), $[2] = deployState, $[3] = t1);
197
+ let isError = t1, t2;
198
+ $[4] === deployState ? t2 = $[5] : (t2 = deployState.matches("success"), $[4] = deployState, $[5] = t2);
199
+ let isSuccess = t2, t3;
200
+ $[6] === deployStateTransition ? t3 = $[7] : (t3 = () => {
201
+ deployStateTransition({ type: "DEPLOY" });
202
+ }, $[6] = deployStateTransition, $[7] = t3);
203
+ let handleDeploy = t3, t4, t5;
204
+ $[8] !== deployState.context.error || $[9] !== isError || $[10] !== isSuccess || $[11] !== targetName || $[12] !== toast ? (t4 = () => {
205
+ isError && toast.push({
206
+ closable: !0,
207
+ description: `Unable to queue deploy for ${targetName}: ${deployState.context.error}`,
208
+ duration: 8e3,
209
+ status: "error",
210
+ title: WIDGET_NAME
211
+ }), isSuccess && toast.push({
212
+ closable: !0,
213
+ description: `Deploy queued for ${targetName}`,
214
+ duration: 8e3,
215
+ status: "success",
216
+ title: WIDGET_NAME
217
+ });
218
+ }, t5 = [
219
+ isError,
220
+ isSuccess,
221
+ toast,
222
+ targetName,
223
+ deployState.context.error
224
+ ], $[8] = deployState.context.error, $[9] = isError, $[10] = isSuccess, $[11] = targetName, $[12] = toast, $[13] = t4, $[14] = t5) : (t4 = $[13], t5 = $[14]), useEffect(t4, t5);
225
+ let t6, t7;
226
+ $[15] !== deployStateInterpreter || $[16] !== onDeploySuccess ? (t6 = () => {
227
+ let subscription = deployStateInterpreter.subscribe((state) => {
228
+ state.value === "success" && onDeploySuccess && onDeploySuccess();
229
+ });
230
+ return () => subscription.unsubscribe();
231
+ }, t7 = [deployStateInterpreter, onDeploySuccess], $[15] = deployStateInterpreter, $[16] = onDeploySuccess, $[17] = t6, $[18] = t7) : (t6 = $[17], t7 = $[18]), useEffect(t6, t7);
232
+ let t8;
233
+ $[19] === Symbol.for("react.memo_cache_sentinel") ? (t8 = { position: "relative" }, $[19] = t8) : t8 = $[19];
234
+ let t9;
235
+ $[20] === deployState ? t9 = $[21] : (t9 = /* @__PURE__ */ jsx(StateDebug, {
236
+ name: "Deploy",
237
+ state: deployState
238
+ }), $[20] = deployState, $[21] = t9);
239
+ let t10 = `${deployState.context.label} ${targetName}`, t11;
240
+ $[22] !== deployState.context.disabled || $[23] !== handleDeploy || $[24] !== t10 ? (t11 = /* @__PURE__ */ jsx(Button, {
241
+ disabled: deployState.context.disabled,
242
+ fontSize: 1,
243
+ icon: UploadIcon,
244
+ mode: "ghost",
245
+ onClick: handleDeploy,
246
+ padding: 3,
247
+ text: t10,
248
+ tone: "default"
249
+ }), $[22] = deployState.context.disabled, $[23] = handleDeploy, $[24] = t10, $[25] = t11) : t11 = $[25];
250
+ let t12;
251
+ return $[26] !== t11 || $[27] !== t9 ? (t12 = /* @__PURE__ */ jsxs(Box, {
252
+ padding: 3,
253
+ style: t8,
254
+ children: [t9, t11]
255
+ }), $[26] = t11, $[27] = t9, $[28] = t12) : t12 = $[28], t12;
368
256
  }, StatusDot = (t0) => {
369
- const $ = c(2), {
370
- state
371
- } = t0, t1 = VERCEL_STATUS_COLORS[state];
372
- let t2;
373
- return $[0] !== t1 ? (t2 = /* @__PURE__ */ jsx(Box, { style: {
374
- backgroundColor: t1,
375
- borderRadius: "20px",
376
- height: "9px",
377
- width: "9px"
378
- } }), $[0] = t1, $[1] = t2) : t2 = $[1], t2;
257
+ let $ = c(2), { state } = t0, t1 = VERCEL_STATUS_COLORS[state], t2;
258
+ return $[0] === t1 ? t2 = $[1] : (t2 = /* @__PURE__ */ jsx(Box, { style: {
259
+ backgroundColor: t1,
260
+ borderRadius: "20px",
261
+ height: "9px",
262
+ width: "9px"
263
+ } }), $[0] = t1, $[1] = t2), t2;
379
264
  }, TableCell = (props) => {
380
- const $ = c(20), {
381
- children,
382
- colSpan,
383
- header,
384
- variant
385
- } = props;
386
- let display = "table-cell", cellWidth = "auto";
387
- bb0: switch (variant) {
388
- case "age": {
389
- cellWidth = "50px";
390
- break bb0;
391
- }
392
- case "branch": {
393
- cellWidth = "300px";
394
- let t02;
395
- $[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t02 = ["none", "none", "none", "table-cell"], $[0] = t02) : t02 = $[0], display = t02;
396
- break bb0;
397
- }
398
- case "creator": {
399
- cellWidth = "80px";
400
- break bb0;
401
- }
402
- case "state": {
403
- cellWidth = "110px";
404
- let t02;
405
- $[1] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t02 = ["none", "none", "none", "none", "table-cell"], $[1] = t02) : t02 = $[1], display = t02;
406
- break bb0;
407
- }
408
- }
409
- const {
410
- border
411
- } = useCardColor();
412
- if (header) {
413
- let t02;
414
- $[2] !== cellWidth ? (t02 = {
415
- maxWidth: cellWidth,
416
- position: "relative",
417
- textAlign: "left",
418
- width: cellWidth
419
- }, $[2] = cellWidth, $[3] = t02) : t02 = $[3];
420
- let t12;
421
- $[4] !== children ? (t12 = /* @__PURE__ */ jsx(Label, { size: 0, children }), $[4] = children, $[5] = t12) : t12 = $[5];
422
- let t22;
423
- return $[6] !== colSpan || $[7] !== display || $[8] !== t02 || $[9] !== t12 ? (t22 = /* @__PURE__ */ jsx(Box, { as: "th", colSpan, display, paddingX: 3, paddingY: 2, style: t02, children: t12 }), $[6] = colSpan, $[7] = display, $[8] = t02, $[9] = t12, $[10] = t22) : t22 = $[10], t22;
424
- }
425
- let t0;
426
- $[11] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t0 = [2, 2, 3], $[11] = t0) : t0 = $[11];
427
- const t1 = `1px solid ${border}`;
428
- let t2;
429
- $[12] !== cellWidth || $[13] !== t1 ? (t2 = {
430
- borderTop: t1,
431
- maxWidth: cellWidth,
432
- position: "relative",
433
- textAlign: "left",
434
- width: cellWidth
435
- }, $[12] = cellWidth, $[13] = t1, $[14] = t2) : t2 = $[14];
436
- let t3;
437
- return $[15] !== children || $[16] !== colSpan || $[17] !== display || $[18] !== t2 ? (t3 = /* @__PURE__ */ jsx(Box, { as: "td", colSpan, display, paddingX: 3, paddingY: t0, style: t2, children }), $[15] = children, $[16] = colSpan, $[17] = display, $[18] = t2, $[19] = t3) : t3 = $[19], t3;
265
+ let $ = c(20), { children, colSpan, header, variant } = props, display = "table-cell", cellWidth = "auto";
266
+ bb0: switch (variant) {
267
+ case "age":
268
+ cellWidth = "50px";
269
+ break bb0;
270
+ case "branch": {
271
+ cellWidth = "300px";
272
+ let t0;
273
+ $[0] === Symbol.for("react.memo_cache_sentinel") ? (t0 = [
274
+ "none",
275
+ "none",
276
+ "none",
277
+ "table-cell"
278
+ ], $[0] = t0) : t0 = $[0], display = t0;
279
+ break bb0;
280
+ }
281
+ case "creator":
282
+ cellWidth = "80px";
283
+ break bb0;
284
+ case "state": {
285
+ cellWidth = "110px";
286
+ let t0;
287
+ $[1] === Symbol.for("react.memo_cache_sentinel") ? (t0 = [
288
+ "none",
289
+ "none",
290
+ "none",
291
+ "none",
292
+ "table-cell"
293
+ ], $[1] = t0) : t0 = $[1], display = t0;
294
+ break bb0;
295
+ }
296
+ default:
297
+ }
298
+ let { border } = useCardColor();
299
+ if (header) {
300
+ let t0;
301
+ $[2] === cellWidth ? t0 = $[3] : (t0 = {
302
+ maxWidth: cellWidth,
303
+ position: "relative",
304
+ textAlign: "left",
305
+ width: cellWidth
306
+ }, $[2] = cellWidth, $[3] = t0);
307
+ let t1;
308
+ $[4] === children ? t1 = $[5] : (t1 = /* @__PURE__ */ jsx(Label, {
309
+ size: 0,
310
+ children
311
+ }), $[4] = children, $[5] = t1);
312
+ let t2;
313
+ return $[6] !== colSpan || $[7] !== display || $[8] !== t0 || $[9] !== t1 ? (t2 = /* @__PURE__ */ jsx(Box, {
314
+ as: "th",
315
+ colSpan,
316
+ display,
317
+ paddingX: 3,
318
+ paddingY: 2,
319
+ style: t0,
320
+ children: t1
321
+ }), $[6] = colSpan, $[7] = display, $[8] = t0, $[9] = t1, $[10] = t2) : t2 = $[10], t2;
322
+ }
323
+ let t0;
324
+ $[11] === Symbol.for("react.memo_cache_sentinel") ? (t0 = [
325
+ 2,
326
+ 2,
327
+ 3
328
+ ], $[11] = t0) : t0 = $[11];
329
+ let t1 = `1px solid ${border}`, t2;
330
+ $[12] !== cellWidth || $[13] !== t1 ? (t2 = {
331
+ borderTop: t1,
332
+ maxWidth: cellWidth,
333
+ position: "relative",
334
+ textAlign: "left",
335
+ width: cellWidth
336
+ }, $[12] = cellWidth, $[13] = t1, $[14] = t2) : t2 = $[14];
337
+ let t3;
338
+ return $[15] !== children || $[16] !== colSpan || $[17] !== display || $[18] !== t2 ? (t3 = /* @__PURE__ */ jsx(Box, {
339
+ as: "td",
340
+ colSpan,
341
+ display,
342
+ paddingX: 3,
343
+ paddingY: t0,
344
+ style: t2,
345
+ children
346
+ }), $[15] = children, $[16] = colSpan, $[17] = display, $[18] = t2, $[19] = t3) : t3 = $[19], t3;
438
347
  }, Deployment = (props) => {
439
- const $ = c(42), {
440
- deployment
441
- } = props;
442
- let t0;
443
- $[0] !== deployment.created ? (t0 = new Date(deployment.created), $[0] = deployment.created, $[1] = t0) : t0 = $[1];
444
- const date = t0, commitMessage = deployment?.meta?.githubCommitMessage, commitRef = deployment?.meta?.githubCommitRef, targetUrl = deployment.alias ?? deployment.url;
445
- let t1;
446
- $[2] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t1 = ["block", "block", "block", "block", "none"], $[2] = t1) : t1 = $[2];
447
- let t2;
448
- $[3] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t2 = {
449
- flexShrink: 0
450
- }, $[3] = t2) : t2 = $[3];
451
- let t3;
452
- $[4] !== deployment.state ? (t3 = /* @__PURE__ */ jsx(Box, { display: t1, marginRight: 3, style: t2, children: /* @__PURE__ */ jsx(StatusDot, { state: deployment.state }) }), $[4] = deployment.state, $[5] = t3) : t3 = $[5];
453
- let t4;
454
- $[6] !== deployment.alias || $[7] !== deployment.state || $[8] !== targetUrl ? (t4 = targetUrl ? /* @__PURE__ */ jsxs(Fragment, { children: [
455
- deployment.alias && /* @__PURE__ */ jsx(LinkIcon, {}),
456
- /* @__PURE__ */ jsx(Box, { marginLeft: deployment.alias ? 1 : 0, children: /* @__PURE__ */ jsx(Text, { muted: deployment.state !== "READY", size: 1, style: {
457
- textDecoration: deployment.state === "CANCELED" || deployment.state === "ERROR" ? "line-through" : "normal"
458
- }, textOverflow: "ellipsis", children: deployment.state === "READY" ? /* @__PURE__ */ jsx("a", { href: `https://${targetUrl}`, rel: "noopener noreferrer", target: "_blank", children: targetUrl }) : targetUrl }) })
459
- ] }) : /* @__PURE__ */ jsx(Text, { size: 1, children: "Uploading..." }), $[6] = deployment.alias, $[7] = deployment.state, $[8] = targetUrl, $[9] = t4) : t4 = $[9];
460
- let t5;
461
- $[10] !== t3 || $[11] !== t4 ? (t5 = /* @__PURE__ */ jsx(TableCell, { children: /* @__PURE__ */ jsxs(Flex, { align: "center", children: [
462
- t3,
463
- t4
464
- ] }) }), $[10] = t3, $[11] = t4, $[12] = t5) : t5 = $[12];
465
- let t6;
466
- $[13] !== deployment.state ? (t6 = /* @__PURE__ */ jsx(StatusDot, { state: deployment.state }), $[13] = deployment.state, $[14] = t6) : t6 = $[14];
467
- let t7;
468
- if ($[15] !== deployment.state) {
469
- let t82;
470
- $[17] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t82 = /^[a-z]/i, $[17] = t82) : t82 = $[17], t7 = deployment.state.trim().toLowerCase().replace(t82, _temp$2), $[15] = deployment.state, $[16] = t7;
471
- } else
472
- t7 = $[16];
473
- let t8;
474
- $[18] !== t7 ? (t8 = /* @__PURE__ */ jsx(Box, { marginLeft: 2, children: /* @__PURE__ */ jsx(Text, { size: 1, children: t7 }) }), $[18] = t7, $[19] = t8) : t8 = $[19];
475
- let t9;
476
- $[20] !== t6 || $[21] !== t8 ? (t9 = /* @__PURE__ */ jsx(TableCell, { variant: "state", children: /* @__PURE__ */ jsxs(Flex, { align: "center", children: [
477
- t6,
478
- t8
479
- ] }) }), $[20] = t6, $[21] = t8, $[22] = t9) : t9 = $[22];
480
- let t10;
481
- $[23] !== commitRef ? (t10 = /* @__PURE__ */ jsx(Text, { size: 1, textOverflow: "ellipsis", children: commitRef }), $[23] = commitRef, $[24] = t10) : t10 = $[24];
482
- let t11;
483
- $[25] !== commitMessage ? (t11 = commitMessage && /* @__PURE__ */ jsx(Text, { muted: !0, size: 1, textOverflow: "ellipsis", children: commitMessage }), $[25] = commitMessage, $[26] = t11) : t11 = $[26];
484
- let t12;
485
- $[27] !== t10 || $[28] !== t11 ? (t12 = /* @__PURE__ */ jsx(TableCell, { variant: "branch", children: /* @__PURE__ */ jsxs(Stack, { gap: 2, children: [
486
- t10,
487
- t11
488
- ] }) }), $[27] = t10, $[28] = t11, $[29] = t12) : t12 = $[29];
489
- let t13;
490
- $[30] !== date ? (t13 = /* @__PURE__ */ jsx(TableCell, { variant: "age", children: /* @__PURE__ */ jsx(Flex, { align: "center", children: /* @__PURE__ */ jsx(Text, { size: 1, children: /* @__PURE__ */ jsx(ReactTimeAgo, { date, locale: "en-US", timeStyle: "mini" }) }) }) }), $[30] = date, $[31] = t13) : t13 = $[31];
491
- const t14 = deployment?.creator?.username || "Deployment creator avatar", t15 = `https://vercel.com/api/www/avatar/${deployment?.creator?.uid}?&s=48`;
492
- let t16;
493
- $[32] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t16 = {
494
- borderRadius: "20px",
495
- height: "20px",
496
- width: "20px"
497
- }, $[32] = t16) : t16 = $[32];
498
- let t17;
499
- $[33] !== t14 || $[34] !== t15 ? (t17 = /* @__PURE__ */ jsx(TableCell, { variant: "creator", children: /* @__PURE__ */ jsx(Flex, { align: "center", justify: "center", children: /* @__PURE__ */ jsx("img", { alt: t14, draggable: !1, src: t15, style: t16 }) }) }), $[33] = t14, $[34] = t15, $[35] = t17) : t17 = $[35];
500
- let t18;
501
- return $[36] !== t12 || $[37] !== t13 || $[38] !== t17 || $[39] !== t5 || $[40] !== t9 ? (t18 = /* @__PURE__ */ jsxs("tr", { children: [
502
- t5,
503
- t9,
504
- t12,
505
- t13,
506
- t17
507
- ] }), $[36] = t12, $[37] = t13, $[38] = t17, $[39] = t5, $[40] = t9, $[41] = t18) : t18 = $[41], t18;
348
+ let $ = c(42), { deployment } = props, t0;
349
+ $[0] === deployment.created ? t0 = $[1] : (t0 = new Date(deployment.created), $[0] = deployment.created, $[1] = t0);
350
+ let date = t0, commitMessage = deployment?.meta?.githubCommitMessage, commitRef = deployment?.meta?.githubCommitRef, targetUrl = deployment.alias ?? deployment.url, t1;
351
+ $[2] === Symbol.for("react.memo_cache_sentinel") ? (t1 = [
352
+ "block",
353
+ "block",
354
+ "block",
355
+ "block",
356
+ "none"
357
+ ], $[2] = t1) : t1 = $[2];
358
+ let t2;
359
+ $[3] === Symbol.for("react.memo_cache_sentinel") ? (t2 = { flexShrink: 0 }, $[3] = t2) : t2 = $[3];
360
+ let t3;
361
+ $[4] === deployment.state ? t3 = $[5] : (t3 = /* @__PURE__ */ jsx(Box, {
362
+ display: t1,
363
+ marginRight: 3,
364
+ style: t2,
365
+ children: /* @__PURE__ */ jsx(StatusDot, { state: deployment.state })
366
+ }), $[4] = deployment.state, $[5] = t3);
367
+ let t4;
368
+ $[6] !== deployment.alias || $[7] !== deployment.state || $[8] !== targetUrl ? (t4 = targetUrl ? /* @__PURE__ */ jsxs(Fragment, { children: [deployment.alias && /* @__PURE__ */ jsx(LinkIcon, {}), /* @__PURE__ */ jsx(Box, {
369
+ marginLeft: +!!deployment.alias,
370
+ children: /* @__PURE__ */ jsx(Text, {
371
+ muted: deployment.state !== "READY",
372
+ size: 1,
373
+ style: { textDecoration: deployment.state === "CANCELED" || deployment.state === "ERROR" ? "line-through" : "normal" },
374
+ textOverflow: "ellipsis",
375
+ children: deployment.state === "READY" ? /* @__PURE__ */ jsx("a", {
376
+ href: `https://${targetUrl}`,
377
+ rel: "noopener noreferrer",
378
+ target: "_blank",
379
+ children: targetUrl
380
+ }) : targetUrl
381
+ })
382
+ })] }) : /* @__PURE__ */ jsx(Text, {
383
+ size: 1,
384
+ children: "Uploading..."
385
+ }), $[6] = deployment.alias, $[7] = deployment.state, $[8] = targetUrl, $[9] = t4) : t4 = $[9];
386
+ let t5;
387
+ $[10] !== t3 || $[11] !== t4 ? (t5 = /* @__PURE__ */ jsx(TableCell, { children: /* @__PURE__ */ jsxs(Flex, {
388
+ align: "center",
389
+ children: [t3, t4]
390
+ }) }), $[10] = t3, $[11] = t4, $[12] = t5) : t5 = $[12];
391
+ let t6;
392
+ $[13] === deployment.state ? t6 = $[14] : (t6 = /* @__PURE__ */ jsx(StatusDot, { state: deployment.state }), $[13] = deployment.state, $[14] = t6);
393
+ let t7;
394
+ if ($[15] !== deployment.state) {
395
+ let t8;
396
+ $[17] === Symbol.for("react.memo_cache_sentinel") ? (t8 = /^[a-z]/i, $[17] = t8) : t8 = $[17], t7 = deployment.state.trim().toLowerCase().replace(t8, _temp$2), $[15] = deployment.state, $[16] = t7;
397
+ } else t7 = $[16];
398
+ let t8;
399
+ $[18] === t7 ? t8 = $[19] : (t8 = /* @__PURE__ */ jsx(Box, {
400
+ marginLeft: 2,
401
+ children: /* @__PURE__ */ jsx(Text, {
402
+ size: 1,
403
+ children: t7
404
+ })
405
+ }), $[18] = t7, $[19] = t8);
406
+ let t9;
407
+ $[20] !== t6 || $[21] !== t8 ? (t9 = /* @__PURE__ */ jsx(TableCell, {
408
+ variant: "state",
409
+ children: /* @__PURE__ */ jsxs(Flex, {
410
+ align: "center",
411
+ children: [t6, t8]
412
+ })
413
+ }), $[20] = t6, $[21] = t8, $[22] = t9) : t9 = $[22];
414
+ let t10;
415
+ $[23] === commitRef ? t10 = $[24] : (t10 = /* @__PURE__ */ jsx(Text, {
416
+ size: 1,
417
+ textOverflow: "ellipsis",
418
+ children: commitRef
419
+ }), $[23] = commitRef, $[24] = t10);
420
+ let t11;
421
+ $[25] === commitMessage ? t11 = $[26] : (t11 = commitMessage && /* @__PURE__ */ jsx(Text, {
422
+ muted: !0,
423
+ size: 1,
424
+ textOverflow: "ellipsis",
425
+ children: commitMessage
426
+ }), $[25] = commitMessage, $[26] = t11);
427
+ let t12;
428
+ $[27] !== t10 || $[28] !== t11 ? (t12 = /* @__PURE__ */ jsx(TableCell, {
429
+ variant: "branch",
430
+ children: /* @__PURE__ */ jsxs(Stack, {
431
+ gap: 2,
432
+ children: [t10, t11]
433
+ })
434
+ }), $[27] = t10, $[28] = t11, $[29] = t12) : t12 = $[29];
435
+ let t13;
436
+ $[30] === date ? t13 = $[31] : (t13 = /* @__PURE__ */ jsx(TableCell, {
437
+ variant: "age",
438
+ children: /* @__PURE__ */ jsx(Flex, {
439
+ align: "center",
440
+ children: /* @__PURE__ */ jsx(Text, {
441
+ size: 1,
442
+ children: /* @__PURE__ */ jsx(ReactTimeAgo, {
443
+ date,
444
+ locale: "en-US",
445
+ timeStyle: "mini"
446
+ })
447
+ })
448
+ })
449
+ }), $[30] = date, $[31] = t13);
450
+ let t14 = deployment?.creator?.username || "Deployment creator avatar", t15 = `https://vercel.com/api/www/avatar/${deployment?.creator?.uid}?&s=48`, t16;
451
+ $[32] === Symbol.for("react.memo_cache_sentinel") ? (t16 = {
452
+ borderRadius: "20px",
453
+ height: "20px",
454
+ width: "20px"
455
+ }, $[32] = t16) : t16 = $[32];
456
+ let t17;
457
+ $[33] !== t14 || $[34] !== t15 ? (t17 = /* @__PURE__ */ jsx(TableCell, {
458
+ variant: "creator",
459
+ children: /* @__PURE__ */ jsx(Flex, {
460
+ align: "center",
461
+ justify: "center",
462
+ children: /* @__PURE__ */ jsx("img", {
463
+ alt: t14,
464
+ draggable: !1,
465
+ src: t15,
466
+ style: t16
467
+ })
468
+ })
469
+ }), $[33] = t14, $[34] = t15, $[35] = t17) : t17 = $[35];
470
+ let t18;
471
+ return $[36] !== t12 || $[37] !== t13 || $[38] !== t17 || $[39] !== t5 || $[40] !== t9 ? (t18 = /* @__PURE__ */ jsxs("tr", { children: [
472
+ t5,
473
+ t9,
474
+ t12,
475
+ t13,
476
+ t17
477
+ ] }), $[36] = t12, $[37] = t13, $[38] = t17, $[39] = t5, $[40] = t9, $[41] = t18) : t18 = $[41], t18;
508
478
  };
509
479
  function _temp$2(t) {
510
- return t.toUpperCase();
480
+ return t.toUpperCase();
511
481
  }
512
482
  const PlaceholderAvatar = () => {
513
- const $ = c(2), {
514
- border
515
- } = useCardColor();
516
- let t0;
517
- return $[0] !== border ? (t0 = /* @__PURE__ */ jsx(Box, { style: {
518
- backgroundColor: border,
519
- borderRadius: "20px",
520
- height: "20px",
521
- userSelect: "none",
522
- width: "20px"
523
- } }), $[0] = border, $[1] = t0) : t0 = $[1], t0;
483
+ let $ = c(2), { border } = useCardColor(), t0;
484
+ return $[0] === border ? t0 = $[1] : (t0 = /* @__PURE__ */ jsx(Box, { style: {
485
+ backgroundColor: border,
486
+ borderRadius: "20px",
487
+ height: "20px",
488
+ userSelect: "none",
489
+ width: "20px"
490
+ } }), $[0] = border, $[1] = t0), t0;
524
491
  }, PlaceholderText = (props) => {
525
- const $ = c(7), {
526
- rows
527
- } = props, {
528
- border
529
- } = useCardColor();
530
- let t0;
531
- $[0] !== border ? (t0 = {
532
- backgroundColor: border,
533
- borderRadius: "3px",
534
- userSelect: "none",
535
- width: "100%"
536
- }, $[0] = border, $[1] = t0) : t0 = $[1];
537
- let t1;
538
- $[2] !== rows ? (t1 = /* @__PURE__ */ jsx(Stack, { gap: 2, children: Array.from({
539
- length: rows
540
- }, _temp$1) }), $[2] = rows, $[3] = t1) : t1 = $[3];
541
- let t2;
542
- return $[4] !== t0 || $[5] !== t1 ? (t2 = /* @__PURE__ */ jsx(Box, { style: t0, children: t1 }), $[4] = t0, $[5] = t1, $[6] = t2) : t2 = $[6], t2;
492
+ let $ = c(7), { rows } = props, { border } = useCardColor(), t0;
493
+ $[0] === border ? t0 = $[1] : (t0 = {
494
+ backgroundColor: border,
495
+ borderRadius: "3px",
496
+ userSelect: "none",
497
+ width: "100%"
498
+ }, $[0] = border, $[1] = t0);
499
+ let t1;
500
+ $[2] === rows ? t1 = $[3] : (t1 = /* @__PURE__ */ jsx(Stack, {
501
+ gap: 2,
502
+ children: Array.from({ length: rows }, _temp$1)
503
+ }), $[2] = rows, $[3] = t1);
504
+ let t2;
505
+ return $[4] !== t0 || $[5] !== t1 ? (t2 = /* @__PURE__ */ jsx(Box, {
506
+ style: t0,
507
+ children: t1
508
+ }), $[4] = t0, $[5] = t1, $[6] = t2) : t2 = $[6], t2;
543
509
  };
544
510
  function _temp$1(_, index) {
545
- return /* @__PURE__ */ jsx(Text, { size: 1, children: "\xA0" }, index);
511
+ return /* @__PURE__ */ jsx(Text, {
512
+ size: 1,
513
+ children: "\xA0"
514
+ }, index);
546
515
  }
547
516
  const DeploymentPlaceholder = () => {
548
- const $ = c(5);
549
- let t0;
550
- $[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t0 = /* @__PURE__ */ jsx(TableCell, { children: /* @__PURE__ */ jsx(PlaceholderText, { rows: 1 }) }), $[0] = t0) : t0 = $[0];
551
- let t1;
552
- $[1] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t1 = /* @__PURE__ */ jsx(TableCell, { variant: "state", children: /* @__PURE__ */ jsx(PlaceholderText, { rows: 1 }) }), $[1] = t1) : t1 = $[1];
553
- let t2;
554
- $[2] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t2 = /* @__PURE__ */ jsx(TableCell, { variant: "branch", children: /* @__PURE__ */ jsx(PlaceholderText, { rows: 2 }) }), $[2] = t2) : t2 = $[2];
555
- let t3;
556
- $[3] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t3 = /* @__PURE__ */ jsx(TableCell, { variant: "age", children: /* @__PURE__ */ jsx(PlaceholderText, { rows: 1 }) }), $[3] = t3) : t3 = $[3];
557
- let t4;
558
- return $[4] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t4 = /* @__PURE__ */ jsxs("tr", { children: [
559
- t0,
560
- t1,
561
- t2,
562
- t3,
563
- /* @__PURE__ */ jsx(TableCell, { variant: "creator", children: /* @__PURE__ */ jsx(Flex, { justify: "center", children: /* @__PURE__ */ jsx(PlaceholderAvatar, {}) }) })
564
- ] }), $[4] = t4) : t4 = $[4], t4;
517
+ let $ = c(5), t0;
518
+ $[0] === Symbol.for("react.memo_cache_sentinel") ? (t0 = /* @__PURE__ */ jsx(TableCell, { children: /* @__PURE__ */ jsx(PlaceholderText, { rows: 1 }) }), $[0] = t0) : t0 = $[0];
519
+ let t1;
520
+ $[1] === Symbol.for("react.memo_cache_sentinel") ? (t1 = /* @__PURE__ */ jsx(TableCell, {
521
+ variant: "state",
522
+ children: /* @__PURE__ */ jsx(PlaceholderText, { rows: 1 })
523
+ }), $[1] = t1) : t1 = $[1];
524
+ let t2;
525
+ $[2] === Symbol.for("react.memo_cache_sentinel") ? (t2 = /* @__PURE__ */ jsx(TableCell, {
526
+ variant: "branch",
527
+ children: /* @__PURE__ */ jsx(PlaceholderText, { rows: 2 })
528
+ }), $[2] = t2) : t2 = $[2];
529
+ let t3;
530
+ $[3] === Symbol.for("react.memo_cache_sentinel") ? (t3 = /* @__PURE__ */ jsx(TableCell, {
531
+ variant: "age",
532
+ children: /* @__PURE__ */ jsx(PlaceholderText, { rows: 1 })
533
+ }), $[3] = t3) : t3 = $[3];
534
+ let t4;
535
+ return $[4] === Symbol.for("react.memo_cache_sentinel") ? (t4 = /* @__PURE__ */ jsxs("tr", { children: [
536
+ t0,
537
+ t1,
538
+ t2,
539
+ t3,
540
+ /* @__PURE__ */ jsx(TableCell, {
541
+ variant: "creator",
542
+ children: /* @__PURE__ */ jsx(Flex, {
543
+ justify: "center",
544
+ children: /* @__PURE__ */ jsx(PlaceholderAvatar, {})
545
+ })
546
+ })
547
+ ] }), $[4] = t4) : t4 = $[4], t4;
565
548
  }, Deployments = (props) => {
566
- const $ = c(49), {
567
- deploymentTarget
568
- } = props, refTimeout = useRef(null), [refreshState, refreshStateTransition] = useMachine(refreshMachine);
569
- let t0;
570
- $[0] !== refreshState ? (t0 = refreshState.matches("error"), $[0] = refreshState, $[1] = t0) : t0 = $[1];
571
- const t1 = !t0;
572
- let t2;
573
- $[2] !== t1 ? (t2 = {
574
- enabled: t1
575
- }, $[2] = t1, $[3] = t2) : t2 = $[3];
576
- const {
577
- deployments,
578
- error,
579
- isFetching,
580
- isSuccess,
581
- refetch
582
- } = useDeployments(deploymentTarget, t2), toast = useToast();
583
- let t3;
584
- $[4] !== refreshState ? (t3 = refreshState.matches("error"), $[4] = refreshState, $[5] = t3) : t3 = $[5];
585
- const isError = t3;
586
- let t4;
587
- $[6] !== refetch ? (t4 = () => {
588
- refTimeout.current && clearTimeout(refTimeout.current), refTimeout.current = setTimeout(() => {
589
- refetch({
590
- cancelRefetch: !0,
591
- throwOnError: !0
592
- });
593
- }, 4e3);
594
- }, $[6] = refetch, $[7] = t4) : t4 = $[7];
595
- const handleDeploySuccess = t4;
596
- let t5, t6;
597
- $[8] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t5 = () => () => {
598
- refTimeout.current && clearTimeout(refTimeout.current);
599
- }, t6 = [], $[8] = t5, $[9] = t6) : (t5 = $[8], t6 = $[9]), useEffect(t5, t6);
600
- let t7, t8;
601
- $[10] !== error || $[11] !== isFetching || $[12] !== isSuccess || $[13] !== refreshStateTransition ? (t7 = () => {
602
- error && refreshStateTransition({
603
- type: "ERROR"
604
- }), isFetching && refreshStateTransition({
605
- type: "REFRESH"
606
- }), !isFetching && isSuccess && refreshStateTransition({
607
- type: "REFRESHED"
608
- });
609
- }, t8 = [error, isFetching, isSuccess, refreshStateTransition], $[10] = error, $[11] = isFetching, $[12] = isSuccess, $[13] = refreshStateTransition, $[14] = t7, $[15] = t8) : (t7 = $[14], t8 = $[15]), useEffect(t7, t8);
610
- let t9;
611
- $[16] !== refreshState || $[17] !== refreshStateTransition ? (t9 = () => {
612
- refreshState.matches("refreshing") || refreshStateTransition({
613
- type: "REFRESH"
614
- });
615
- }, $[16] = refreshState, $[17] = refreshStateTransition, $[18] = t9) : t9 = $[18];
616
- let t10;
617
- $[19] !== deploymentTarget ? (t10 = [deploymentTarget], $[19] = deploymentTarget, $[20] = t10) : t10 = $[20], useDeepCompareEffect(t9, t10);
618
- let t11;
619
- $[21] !== deploymentTarget || $[22] !== isError || $[23] !== toast ? (t11 = () => {
620
- isError && toast.push({
621
- closable: !0,
622
- description: `Unable to fetch deployments for ${deploymentTarget.name}`,
623
- duration: 8e3,
624
- status: "error",
625
- title: WIDGET_NAME
626
- });
627
- }, $[21] = deploymentTarget, $[22] = isError, $[23] = toast, $[24] = t11) : t11 = $[24];
628
- let t12;
629
- $[25] !== deploymentTarget || $[26] !== isError ? (t12 = [deploymentTarget, isError], $[25] = deploymentTarget, $[26] = isError, $[27] = t12) : t12 = $[27], useDeepCompareEffect(t11, t12);
630
- const hasFetched = typeof deployments < "u", hasDeployments = deployments && deployments.length > 0, {
631
- border
632
- } = useCardColor();
633
- let t13;
634
- $[28] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t13 = {
635
- position: "relative"
636
- }, $[28] = t13) : t13 = $[28];
637
- let t14;
638
- $[29] !== refreshState ? (t14 = /* @__PURE__ */ jsx(StateDebug, { name: "Refresh", state: refreshState }), $[29] = refreshState, $[30] = t14) : t14 = $[30];
639
- let t15;
640
- $[31] !== border || $[32] !== deploymentTarget || $[33] !== deployments || $[34] !== hasDeployments || $[35] !== hasFetched || $[36] !== refreshState ? (t15 = !refreshState.matches("error") && /* @__PURE__ */ jsxs(Fragment, { children: [
641
- /* @__PURE__ */ jsxs(Box, { as: "table", style: {
642
- borderBottom: `1px solid ${border}`,
643
- borderCollapse: "collapse",
644
- display: "table",
645
- tableLayout: "fixed",
646
- width: "100%"
647
- }, children: [
648
- /* @__PURE__ */ jsx(Box, { as: "thead", style: {
649
- display: "table-header-group"
650
- }, children: /* @__PURE__ */ jsxs("tr", { children: [
651
- /* @__PURE__ */ jsx(TableCell, { header: !0, children: "Deployment" }),
652
- /* @__PURE__ */ jsx(TableCell, { header: !0, variant: "state", children: "State" }),
653
- /* @__PURE__ */ jsx(TableCell, { header: !0, variant: "branch", children: "Branch" }),
654
- /* @__PURE__ */ jsx(TableCell, { header: !0, variant: "age", children: "Age" }),
655
- /* @__PURE__ */ jsx(TableCell, { header: !0, variant: "creator", children: "Creator" })
656
- ] }) }),
657
- /* @__PURE__ */ jsxs(Box, { as: "tbody", style: {
658
- display: "table-row-group"
659
- }, children: [
660
- !deployments && Array.from({
661
- length: deploymentTarget.deployLimit
662
- }, _temp),
663
- hasDeployments && deployments?.map(_temp2)
664
- ] })
665
- ] }),
666
- hasFetched && !hasDeployments && /* @__PURE__ */ jsx(Box, { padding: 3, style: {
667
- width: "100%"
668
- }, children: /* @__PURE__ */ jsx(Text, { muted: !0, size: 1, children: "No deployments found. Don't forget to specify a valid team ID if your project belongs to a team." }) })
669
- ] }), $[31] = border, $[32] = deploymentTarget, $[33] = deployments, $[34] = hasDeployments, $[35] = hasFetched, $[36] = refreshState, $[37] = t15) : t15 = $[37];
670
- let t16;
671
- $[38] !== refreshState ? (t16 = refreshState.matches("error") && /* @__PURE__ */ jsx(Box, { padding: 3, children: /* @__PURE__ */ jsx(Text, { muted: !0, size: 1, children: "Unable to fetch recent deployments. Please check your network and deployment settings." }) }), $[38] = refreshState, $[39] = t16) : t16 = $[39];
672
- let t17;
673
- $[40] !== deploymentTarget || $[41] !== handleDeploySuccess || $[42] !== refreshState ? (t17 = !refreshState.matches("error") && deploymentTarget.deployHook && /* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsx(DeployButton, { deployHook: deploymentTarget.deployHook, onDeploySuccess: handleDeploySuccess, targetName: deploymentTarget.name }) }), $[40] = deploymentTarget, $[41] = handleDeploySuccess, $[42] = refreshState, $[43] = t17) : t17 = $[43];
674
- let t18;
675
- return $[44] !== t14 || $[45] !== t15 || $[46] !== t16 || $[47] !== t17 ? (t18 = /* @__PURE__ */ jsxs(Box, { marginTop: 3, style: t13, children: [
676
- t14,
677
- t15,
678
- t16,
679
- t17
680
- ] }), $[44] = t14, $[45] = t15, $[46] = t16, $[47] = t17, $[48] = t18) : t18 = $[48], t18;
549
+ let $ = c(49), { deploymentTarget } = props, refTimeout = useRef(null), [refreshState, refreshStateTransition] = useMachine(refreshMachine), t0;
550
+ $[0] === refreshState ? t0 = $[1] : (t0 = refreshState.matches("error"), $[0] = refreshState, $[1] = t0);
551
+ let t1 = !t0, t2;
552
+ $[2] === t1 ? t2 = $[3] : (t2 = { enabled: t1 }, $[2] = t1, $[3] = t2);
553
+ let { deployments, error, isFetching, isSuccess, refetch } = useDeployments(deploymentTarget, t2), toast = useToast(), t3;
554
+ $[4] === refreshState ? t3 = $[5] : (t3 = refreshState.matches("error"), $[4] = refreshState, $[5] = t3);
555
+ let isError = t3, t4;
556
+ $[6] === refetch ? t4 = $[7] : (t4 = () => {
557
+ refTimeout.current && clearTimeout(refTimeout.current), refTimeout.current = setTimeout(() => {
558
+ refetch({
559
+ cancelRefetch: !0,
560
+ throwOnError: !0
561
+ });
562
+ }, 4e3);
563
+ }, $[6] = refetch, $[7] = t4);
564
+ let handleDeploySuccess = t4, t5, t6;
565
+ $[8] === Symbol.for("react.memo_cache_sentinel") ? (t5 = () => () => {
566
+ refTimeout.current && clearTimeout(refTimeout.current);
567
+ }, t6 = [], $[8] = t5, $[9] = t6) : (t5 = $[8], t6 = $[9]), useEffect(t5, t6);
568
+ let t7, t8;
569
+ $[10] !== error || $[11] !== isFetching || $[12] !== isSuccess || $[13] !== refreshStateTransition ? (t7 = () => {
570
+ error && refreshStateTransition({ type: "ERROR" }), isFetching && refreshStateTransition({ type: "REFRESH" }), !isFetching && isSuccess && refreshStateTransition({ type: "REFRESHED" });
571
+ }, t8 = [
572
+ error,
573
+ isFetching,
574
+ isSuccess,
575
+ refreshStateTransition
576
+ ], $[10] = error, $[11] = isFetching, $[12] = isSuccess, $[13] = refreshStateTransition, $[14] = t7, $[15] = t8) : (t7 = $[14], t8 = $[15]), useEffect(t7, t8);
577
+ let t9;
578
+ $[16] !== refreshState || $[17] !== refreshStateTransition ? (t9 = () => {
579
+ refreshState.matches("refreshing") || refreshStateTransition({ type: "REFRESH" });
580
+ }, $[16] = refreshState, $[17] = refreshStateTransition, $[18] = t9) : t9 = $[18];
581
+ let t10;
582
+ $[19] === deploymentTarget ? t10 = $[20] : (t10 = [deploymentTarget], $[19] = deploymentTarget, $[20] = t10), useDeepCompareEffect(t9, t10);
583
+ let t11;
584
+ $[21] !== deploymentTarget || $[22] !== isError || $[23] !== toast ? (t11 = () => {
585
+ isError && toast.push({
586
+ closable: !0,
587
+ description: `Unable to fetch deployments for ${deploymentTarget.name}`,
588
+ duration: 8e3,
589
+ status: "error",
590
+ title: WIDGET_NAME
591
+ });
592
+ }, $[21] = deploymentTarget, $[22] = isError, $[23] = toast, $[24] = t11) : t11 = $[24];
593
+ let t12;
594
+ $[25] !== deploymentTarget || $[26] !== isError ? (t12 = [deploymentTarget, isError], $[25] = deploymentTarget, $[26] = isError, $[27] = t12) : t12 = $[27], useDeepCompareEffect(t11, t12);
595
+ let hasFetched = deployments !== void 0, hasDeployments = deployments && deployments.length > 0, { border } = useCardColor(), t13;
596
+ $[28] === Symbol.for("react.memo_cache_sentinel") ? (t13 = { position: "relative" }, $[28] = t13) : t13 = $[28];
597
+ let t14;
598
+ $[29] === refreshState ? t14 = $[30] : (t14 = /* @__PURE__ */ jsx(StateDebug, {
599
+ name: "Refresh",
600
+ state: refreshState
601
+ }), $[29] = refreshState, $[30] = t14);
602
+ let t15;
603
+ $[31] !== border || $[32] !== deploymentTarget || $[33] !== deployments || $[34] !== hasDeployments || $[35] !== hasFetched || $[36] !== refreshState ? (t15 = !refreshState.matches("error") && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs(Box, {
604
+ as: "table",
605
+ style: {
606
+ borderBottom: `1px solid ${border}`,
607
+ borderCollapse: "collapse",
608
+ display: "table",
609
+ tableLayout: "fixed",
610
+ width: "100%"
611
+ },
612
+ children: [/* @__PURE__ */ jsx(Box, {
613
+ as: "thead",
614
+ style: { display: "table-header-group" },
615
+ children: /* @__PURE__ */ jsxs("tr", { children: [
616
+ /* @__PURE__ */ jsx(TableCell, {
617
+ header: !0,
618
+ children: "Deployment"
619
+ }),
620
+ /* @__PURE__ */ jsx(TableCell, {
621
+ header: !0,
622
+ variant: "state",
623
+ children: "State"
624
+ }),
625
+ /* @__PURE__ */ jsx(TableCell, {
626
+ header: !0,
627
+ variant: "branch",
628
+ children: "Branch"
629
+ }),
630
+ /* @__PURE__ */ jsx(TableCell, {
631
+ header: !0,
632
+ variant: "age",
633
+ children: "Age"
634
+ }),
635
+ /* @__PURE__ */ jsx(TableCell, {
636
+ header: !0,
637
+ variant: "creator",
638
+ children: "Creator"
639
+ })
640
+ ] })
641
+ }), /* @__PURE__ */ jsxs(Box, {
642
+ as: "tbody",
643
+ style: { display: "table-row-group" },
644
+ children: [!deployments && Array.from({ length: deploymentTarget.deployLimit }, _temp), hasDeployments && deployments?.map(_temp2)]
645
+ })]
646
+ }), hasFetched && !hasDeployments && /* @__PURE__ */ jsx(Box, {
647
+ padding: 3,
648
+ style: { width: "100%" },
649
+ children: /* @__PURE__ */ jsx(Text, {
650
+ muted: !0,
651
+ size: 1,
652
+ children: "No deployments found. Don't forget to specify a valid team ID if your project belongs to a team."
653
+ })
654
+ })] }), $[31] = border, $[32] = deploymentTarget, $[33] = deployments, $[34] = hasDeployments, $[35] = hasFetched, $[36] = refreshState, $[37] = t15) : t15 = $[37];
655
+ let t16;
656
+ $[38] === refreshState ? t16 = $[39] : (t16 = refreshState.matches("error") && /* @__PURE__ */ jsx(Box, {
657
+ padding: 3,
658
+ children: /* @__PURE__ */ jsx(Text, {
659
+ muted: !0,
660
+ size: 1,
661
+ children: "Unable to fetch recent deployments. Please check your network and deployment settings."
662
+ })
663
+ }), $[38] = refreshState, $[39] = t16);
664
+ let t17;
665
+ $[40] !== deploymentTarget || $[41] !== handleDeploySuccess || $[42] !== refreshState ? (t17 = !refreshState.matches("error") && deploymentTarget.deployHook && /* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsx(DeployButton, {
666
+ deployHook: deploymentTarget.deployHook,
667
+ onDeploySuccess: handleDeploySuccess,
668
+ targetName: deploymentTarget.name
669
+ }) }), $[40] = deploymentTarget, $[41] = handleDeploySuccess, $[42] = refreshState, $[43] = t17) : t17 = $[43];
670
+ let t18;
671
+ return $[44] !== t14 || $[45] !== t15 || $[46] !== t16 || $[47] !== t17 ? (t18 = /* @__PURE__ */ jsxs(Box, {
672
+ marginTop: 3,
673
+ style: t13,
674
+ children: [
675
+ t14,
676
+ t15,
677
+ t16,
678
+ t17
679
+ ]
680
+ }), $[44] = t14, $[45] = t15, $[46] = t16, $[47] = t17, $[48] = t18) : t18 = $[48], t18;
681
681
  };
682
682
  function _temp(_, index) {
683
- return /* @__PURE__ */ jsx(DeploymentPlaceholder, {}, index);
683
+ return /* @__PURE__ */ jsx(DeploymentPlaceholder, {}, index);
684
684
  }
685
685
  function _temp2(deployment) {
686
- return /* @__PURE__ */ jsx(Deployment, { deployment }, deployment.uid);
686
+ return /* @__PURE__ */ jsx(Deployment, { deployment }, deployment.uid);
687
687
  }
688
688
  const DeploymentTarget = (props) => {
689
- const $ = c(22), {
690
- item,
691
- onDialogEdit
692
- } = props;
693
- let t0;
694
- $[0] !== item.deployHook || $[1] !== item.deployLimit || $[2] !== item.name || $[3] !== item.projectId || $[4] !== item.teamId || $[5] !== item.token ? (t0 = {
695
- deployHook: item.deployHook,
696
- deployLimit: item.deployLimit,
697
- name: item.name,
698
- projectId: item.projectId,
699
- teamId: item.teamId,
700
- token: item.token
701
- }, $[0] = item.deployHook, $[1] = item.deployLimit, $[2] = item.name, $[3] = item.projectId, $[4] = item.teamId, $[5] = item.token, $[6] = t0) : t0 = $[6];
702
- const deploymentTarget = t0;
703
- let t1;
704
- $[7] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t1 = {
705
- position: "relative"
706
- }, $[7] = t1) : t1 = $[7];
707
- let t2;
708
- $[8] !== item.name ? (t2 = /* @__PURE__ */ jsx(Text, { size: 2, children: item.name }), $[8] = item.name, $[9] = t2) : t2 = $[9];
709
- let t3;
710
- $[10] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t3 = /* @__PURE__ */ jsx(Box, { padding: 2, children: /* @__PURE__ */ jsx(Text, { muted: !0, size: 1, children: "Edit deployment target" }) }), $[10] = t3) : t3 = $[10];
711
- let t4;
712
- $[11] !== item || $[12] !== onDialogEdit ? (t4 = /* @__PURE__ */ jsx(Tooltip, { content: t3, placement: "left", children: /* @__PURE__ */ jsx(Button, { fontSize: 1, icon: EditIcon, mode: "bleed", onClick: () => onDialogEdit(item) }) }), $[11] = item, $[12] = onDialogEdit, $[13] = t4) : t4 = $[13];
713
- let t5;
714
- $[14] !== t2 || $[15] !== t4 ? (t5 = /* @__PURE__ */ jsxs(Flex, { align: "center", justify: "space-between", marginTop: 2, paddingX: 3, children: [
715
- t2,
716
- t4
717
- ] }), $[14] = t2, $[15] = t4, $[16] = t5) : t5 = $[16];
718
- let t6;
719
- $[17] !== deploymentTarget ? (t6 = /* @__PURE__ */ jsx(Deployments, { deploymentTarget }), $[17] = deploymentTarget, $[18] = t6) : t6 = $[18];
720
- let t7;
721
- return $[19] !== t5 || $[20] !== t6 ? (t7 = /* @__PURE__ */ jsxs(Box, { style: t1, children: [
722
- t5,
723
- t6
724
- ] }), $[19] = t5, $[20] = t6, $[21] = t7) : t7 = $[21], t7;
689
+ let $ = c(22), { item, onDialogEdit } = props, t0;
690
+ $[0] !== item.deployHook || $[1] !== item.deployLimit || $[2] !== item.name || $[3] !== item.projectId || $[4] !== item.teamId || $[5] !== item.token ? (t0 = {
691
+ deployHook: item.deployHook,
692
+ deployLimit: item.deployLimit,
693
+ name: item.name,
694
+ projectId: item.projectId,
695
+ teamId: item.teamId,
696
+ token: item.token
697
+ }, $[0] = item.deployHook, $[1] = item.deployLimit, $[2] = item.name, $[3] = item.projectId, $[4] = item.teamId, $[5] = item.token, $[6] = t0) : t0 = $[6];
698
+ let deploymentTarget = t0, t1;
699
+ $[7] === Symbol.for("react.memo_cache_sentinel") ? (t1 = { position: "relative" }, $[7] = t1) : t1 = $[7];
700
+ let t2;
701
+ $[8] === item.name ? t2 = $[9] : (t2 = /* @__PURE__ */ jsx(Text, {
702
+ size: 2,
703
+ children: item.name
704
+ }), $[8] = item.name, $[9] = t2);
705
+ let t3;
706
+ $[10] === Symbol.for("react.memo_cache_sentinel") ? (t3 = /* @__PURE__ */ jsx(Box, {
707
+ padding: 2,
708
+ children: /* @__PURE__ */ jsx(Text, {
709
+ muted: !0,
710
+ size: 1,
711
+ children: "Edit deployment target"
712
+ })
713
+ }), $[10] = t3) : t3 = $[10];
714
+ let t4;
715
+ $[11] !== item || $[12] !== onDialogEdit ? (t4 = /* @__PURE__ */ jsx(Tooltip, {
716
+ content: t3,
717
+ placement: "left",
718
+ children: /* @__PURE__ */ jsx(Button, {
719
+ fontSize: 1,
720
+ icon: EditIcon,
721
+ mode: "bleed",
722
+ onClick: () => onDialogEdit(item)
723
+ })
724
+ }), $[11] = item, $[12] = onDialogEdit, $[13] = t4) : t4 = $[13];
725
+ let t5;
726
+ $[14] !== t2 || $[15] !== t4 ? (t5 = /* @__PURE__ */ jsxs(Flex, {
727
+ align: "center",
728
+ justify: "space-between",
729
+ marginTop: 2,
730
+ paddingX: 3,
731
+ children: [t2, t4]
732
+ }), $[14] = t2, $[15] = t4, $[16] = t5) : t5 = $[16];
733
+ let t6;
734
+ $[17] === deploymentTarget ? t6 = $[18] : (t6 = /* @__PURE__ */ jsx(Deployments, { deploymentTarget }), $[17] = deploymentTarget, $[18] = t6);
735
+ let t7;
736
+ return $[19] !== t5 || $[20] !== t6 ? (t7 = /* @__PURE__ */ jsxs(Box, {
737
+ style: t1,
738
+ children: [t5, t6]
739
+ }), $[19] = t5, $[20] = t6, $[21] = t7) : t7 = $[21], t7;
725
740
  }, DeploymentTargets = (props) => {
726
- const $ = c(5), {
727
- items,
728
- onDialogEdit
729
- } = props;
730
- let t0;
731
- $[0] !== items || $[1] !== onDialogEdit ? (t0 = items?.map((item) => /* @__PURE__ */ jsx(DeploymentTarget, { item, onDialogEdit }, item._id)), $[0] = items, $[1] = onDialogEdit, $[2] = t0) : t0 = $[2];
732
- let t1;
733
- return $[3] !== t0 ? (t1 = /* @__PURE__ */ jsx(Stack, { gap: 5, children: t0 }), $[3] = t0, $[4] = t1) : t1 = $[4], t1;
741
+ let $ = c(5), { items, onDialogEdit } = props, t0;
742
+ $[0] !== items || $[1] !== onDialogEdit ? (t0 = items?.map((item) => /* @__PURE__ */ jsx(DeploymentTarget, {
743
+ item,
744
+ onDialogEdit
745
+ }, item._id)), $[0] = items, $[1] = onDialogEdit, $[2] = t0) : t0 = $[2];
746
+ let t1;
747
+ return $[3] === t0 ? t1 = $[4] : (t1 = /* @__PURE__ */ jsx(Stack, {
748
+ gap: 5,
749
+ children: t0
750
+ }), $[3] = t0, $[4] = t1), t1;
734
751
  }, formMachine = setup({
735
- types: {},
736
- actions: {
737
- setId: assign({
738
- id: ({
739
- event
740
- }) => (assertEvent(event, ["UPDATE", "DELETE"]), event.id)
741
- }),
742
- setFormData: assign({
743
- formData: ({
744
- event
745
- }) => (assertEvent(event, ["CREATE", "UPDATE"]), event.formData)
746
- }),
747
- setMessage: assign({
748
- message: ({
749
- event
750
- }) => "data" in event && event.data && typeof event.data == "object" && "details" in event.data && event.data.details && typeof event.data.details == "object" && "description" in event.data.details ? event.data.details.description : "An error occurred"
751
- }),
752
- setDocument: assign({
753
- document: ({
754
- event
755
- }) => event.output
756
- })
757
- },
758
- actors: {
759
- // The explicit `Promise<SanityDocument>` return types keep the inferred machine
760
- // type portable for declaration emit (TS2883), by referencing the `SanityDocument`
761
- // alias imported from `sanity` instead of a deep `@sanity/client` path.
762
- "create document": fromPromise(({
763
- input
764
- }) => input.client.create({
765
- _id: `vercel.${uuid()}`,
766
- _type: DEPLOYMENT_TARGET_DOCUMENT_TYPE,
767
- ...input.formData
768
- })),
769
- "update document": fromPromise(({
770
- input
771
- }) => input.client.patch(input.id).set(input.formData).commit()),
772
- "delete document": fromPromise(({
773
- input
774
- }) => input.client.delete(input.id))
775
- }
752
+ types: {},
753
+ actions: {
754
+ setId: assign({ id: ({ event }) => (assertEvent(event, ["UPDATE", "DELETE"]), event.id) }),
755
+ setFormData: assign({ formData: ({ event }) => (assertEvent(event, ["CREATE", "UPDATE"]), event.formData) }),
756
+ setMessage: assign({ message: ({ event }) => "data" in event && event.data && typeof event.data == "object" && "details" in event.data && event.data.details && typeof event.data.details == "object" && "description" in event.data.details ? event.data.details.description : "An error occurred" }),
757
+ setDocument: assign({ document: ({ event }) => event.output })
758
+ },
759
+ actors: {
760
+ "create document": fromPromise(({ input }) => input.client.create({
761
+ _id: `vercel.${uuid()}`,
762
+ _type: DEPLOYMENT_TARGET_DOCUMENT_TYPE,
763
+ ...input.formData
764
+ })),
765
+ "update document": fromPromise(({ input }) => input.client.patch(input.id).set(input.formData).commit()),
766
+ "delete document": fromPromise(({ input }) => input.client.delete(input.id))
767
+ }
776
768
  }).createMachine({
777
- /** @xstate-layout N4IgpgJg5mDOIC5QAoC2BDAxgCwJYDswBKAOlwgBswBiAYQCUBRAQQBVGBtABgF1FQADgHtYuAC64h+fiAAeiAIwBmAGwkuGjQFYALAE4AHACYdWgwYA0IAJ6IjKgOwkdXFUYVa9h-Ua5KAvv5WaFh4hKTkVNQAqgAKACJsnLwywqISUjLyCMpqmtr6xqbmVrYIBgokWvlGWkpaCgZeKoHBGDgExGSUNPGMADKM7Nx8SCBp4pLSY9m56vm6hiZmljaIOipqdXpcDk1aWiYqBlqtICEd4SSYAE5g6BL4UNQQUmBk+ABuQgDW77f3MRgeJCTAAV1QYHwYmYmDEQhuI1SIkmmRmiGOShIDiUOh0SiaCgUegcDj0pTsjhI5iMewUpPsTSMZwuYS6AIeBGeYBuNwRJAEFAeADMEahrncHsDQRCoTC4QikWMJhlpqBspjsbj8YTiaTyWsEKouNT6noiX5zUpiQEgud2mzSGCBBBOU8Xm8Pt8-iRna6gSDwZDobD4YiUsqUaqshiDFicXiCea9WSKeVKiSVIclEYlIY-BUWQ7Ok6XW7ubz+YKRWLfWWAzLg-Kw0rBFGpjGEJqEzrkyTU4b6ToSHojHos7VXEc6kXQiWSBAwFRHs9XoQvb93ovl9Kg3LQ4qI230h30V241rE7r+wayro1A4dO4VHotA5fPTTnbWfPt2AV9QPJ8jcApCmIoo3OKf4NnuIYKuGozHqiapyLG8bakmRI3mmpjxk0XAuEoXAHI+DgtGc+BCIu8BjD+4TIieaLqogAC0Khpmxs6XF0kRgAxyGdk+aYKLSVR7Fweg6A4IkGFwChcY6EqAly-HRmeY7DnSY5GHGL4qFwRhpjpJpmriDjVMRLgGAp84ckCECqaezEIHoObUuZuwKH4xGPgoRnmCQpmOAcqhmPJ37Flcfrlo5TGoQgY4mgYHkeAS+iqH5hqSc4dSuCo+I6SoSjvjZUX1pAsUodkrlGO51TSd5b46JlZRebVuG7IcjRmA05FtHOVzQSpkaMVVdivs4CibHGxg6biSg4ZsJD2AccaFEVGwOKVXTQRVI0CWeNV1Z5jW+WmujDj4HjmMRnhEttpBAQilWdkdyX1V5RFNS1iAEpU1pHER9JWjogSBEAA */
778
- context: ({
779
- input
780
- }) => ({
781
- client: input.client,
782
- formData: {},
783
- message: ""
784
- }),
785
- initial: "idle",
786
- states: {
787
- idle: {
788
- on: {
789
- CREATE: {
790
- actions: ["setFormData"],
791
- target: "creating"
792
- },
793
- UPDATE: {
794
- actions: ["setId", "setFormData"],
795
- target: "updating"
796
- },
797
- DELETE: {
798
- actions: "setId",
799
- target: "deleting"
800
- }
801
- }
802
- },
803
- creating: {
804
- tags: ["busy"],
805
- invoke: {
806
- src: "create document",
807
- id: "createDocumentActor",
808
- input: ({
809
- context
810
- }) => ({
811
- client: context.client,
812
- formData: context.formData
813
- }),
814
- onDone: {
815
- actions: "setDocument",
816
- target: "created"
817
- },
818
- onError: {
819
- actions: "setMessage",
820
- target: "error"
821
- }
822
- }
823
- },
824
- created: {
825
- type: "final"
826
- },
827
- updating: {
828
- tags: ["busy"],
829
- invoke: {
830
- src: "update document",
831
- id: "updateDocumentActor",
832
- input: ({
833
- context
834
- }) => ({
835
- client: context.client,
836
- id: context.id,
837
- formData: context.formData
838
- }),
839
- onDone: {
840
- actions: "setDocument",
841
- target: "updated"
842
- },
843
- onError: {
844
- actions: "setMessage",
845
- target: "error"
846
- }
847
- }
848
- },
849
- updated: {
850
- type: "final"
851
- },
852
- deleting: {
853
- tags: ["busy"],
854
- invoke: {
855
- src: "delete document",
856
- id: "deleteDocumentActor",
857
- input: ({
858
- context
859
- }) => ({
860
- client: context.client,
861
- id: context.id
862
- }),
863
- onDone: {
864
- target: "deleted"
865
- },
866
- onError: {
867
- actions: "setMessage",
868
- target: "error"
869
- }
870
- }
871
- },
872
- deleted: {
873
- type: "final"
874
- },
875
- error: {
876
- type: "final"
877
- }
878
- }
769
+ /** @xstate-layout N4IgpgJg5mDOIC5QAoC2BDAxgCwJYDswBKAOlwgBswBiAYQCUBRAQQBVGBtABgF1FQADgHtYuAC64h+fiAAeiAIwBmAGwkuGjQFYALAE4AHACYdWgwYA0IAJ6IjKgOwkdXFUYVa9h-Ua5KAvv5WaFh4hKTkVNQAqgAKACJsnLwywqISUjLyCMpqmtr6xqbmVrYIBgokWvlGWkpaCgZeKoHBGDgExGSUNPGMADKM7Nx8SCBp4pLSY9m56vm6hiZmljaIOipqdXpcDk1aWiYqBlqtICEd4SSYAE5g6BL4UNQQUmBk+ABuQgDW77f3MRgeJCTAAV1QYHwYmYmDEQhuI1SIkmmRmiGOShIDiUOh0SiaCgUegcDj0pTsjhI5iMewUpPsTSMZwuYS6AIeBGeYBuNwRJAEFAeADMEahrncHsDQRCoTC4QikWMJhlpqBspjsbj8YTiaTyWsEKouNT6noiX5zUpiQEgud2mzSGCBBBOU8Xm8Pt8-iRna6gSDwZDobD4YiUsqUaqshiDFicXiCea9WSKeVKiSVIclEYlIY-BUWQ7Ok6XW7ubz+YKRWLfWWAzLg-Kw0rBFGpjGEJqEzrkyTU4b6ToSHojHos7VXEc6kXQiWSBAwFRHs9XoQvb93ovl9Kg3LQ4qI230h30V241rE7r+wayro1A4dO4VHotA5fPTTnbWfPt2AV9QPJ8jcApCmIoo3OKf4NnuIYKuGozHqiapyLG8bakmRI3mmpjxk0XAuEoXAHI+DgtGc+BCIu8BjD+4TIieaLqogAC0Khpmxs6XF0kRgAxyGdk+aYKLSVR7Fweg6A4IkGFwChcY6EqAly-HRmeY7DnSY5GHGL4qFwRhpjpJpmriDjVMRLgGAp84ckCECqaezEIHoObUuZuwKH4xGPgoRnmCQpmOAcqhmPJ37Flcfrlo5TGoQgY4mgYHkeAS+iqH5hqSc4dSuCo+I6SoSjvjZUX1pAsUodkrlGO51TSd5b46JlZRebVuG7IcjRmA05FtHOVzQSpkaMVVdivs4CibHGxg6biSg4ZsJD2AccaFEVGwOKVXTQRVI0CWeNV1Z5jW+WmujDj4HjmMRnhEttpBAQilWdkdyX1V5RFNS1iAEpU1pHER9JWjogSBEAA */
770
+ context: ({ input }) => ({
771
+ client: input.client,
772
+ formData: {},
773
+ message: ""
774
+ }),
775
+ initial: "idle",
776
+ states: {
777
+ idle: { on: {
778
+ CREATE: {
779
+ actions: ["setFormData"],
780
+ target: "creating"
781
+ },
782
+ UPDATE: {
783
+ actions: ["setId", "setFormData"],
784
+ target: "updating"
785
+ },
786
+ DELETE: {
787
+ actions: "setId",
788
+ target: "deleting"
789
+ }
790
+ } },
791
+ creating: {
792
+ tags: ["busy"],
793
+ invoke: {
794
+ src: "create document",
795
+ id: "createDocumentActor",
796
+ input: ({ context }) => ({
797
+ client: context.client,
798
+ formData: context.formData
799
+ }),
800
+ onDone: {
801
+ actions: "setDocument",
802
+ target: "created"
803
+ },
804
+ onError: {
805
+ actions: "setMessage",
806
+ target: "error"
807
+ }
808
+ }
809
+ },
810
+ created: { type: "final" },
811
+ updating: {
812
+ tags: ["busy"],
813
+ invoke: {
814
+ src: "update document",
815
+ id: "updateDocumentActor",
816
+ input: ({ context }) => ({
817
+ client: context.client,
818
+ id: context.id,
819
+ formData: context.formData
820
+ }),
821
+ onDone: {
822
+ actions: "setDocument",
823
+ target: "updated"
824
+ },
825
+ onError: {
826
+ actions: "setMessage",
827
+ target: "error"
828
+ }
829
+ }
830
+ },
831
+ updated: { type: "final" },
832
+ deleting: {
833
+ tags: ["busy"],
834
+ invoke: {
835
+ src: "delete document",
836
+ id: "deleteDocumentActor",
837
+ input: ({ context }) => ({
838
+ client: context.client,
839
+ id: context.id
840
+ }),
841
+ onDone: { target: "deleted" },
842
+ onError: {
843
+ actions: "setMessage",
844
+ target: "error"
845
+ }
846
+ }
847
+ },
848
+ deleted: { type: "final" },
849
+ error: { type: "final" }
850
+ }
879
851
  }), sanitizeFormData = (formData) => Object.keys(formData).reduce((acc, key) => {
880
- const val = formData[key];
881
- return typeof val == "object" && val !== null && val.constructor !== Array ? acc[key] = sanitizeFormData(val) : val === "" || typeof val > "u" || val?.length === 0 ? acc[key] = null : typeof val == "string" && val ? acc[key] = formData[key].trim() : acc[key] = formData[key], acc;
882
- }, {}), errorIconStyle = {
883
- color: red[500].hex
884
- }, FormFieldInputLabel = (props) => {
885
- const $ = c(13), {
886
- description,
887
- error,
888
- label,
889
- name
890
- } = props;
891
- let t0;
892
- $[0] !== label || $[1] !== name ? (t0 = /* @__PURE__ */ jsx(Text, { as: "label", htmlFor: name, size: 1, weight: "semibold", children: label }), $[0] = label, $[1] = name, $[2] = t0) : t0 = $[2];
893
- let t1;
894
- $[3] !== error ? (t1 = error && /* @__PURE__ */ jsx(Text, { size: 1, children: /* @__PURE__ */ jsx(Tooltip, { content: /* @__PURE__ */ jsx(Box, { padding: 2, children: /* @__PURE__ */ jsxs(Text, { muted: !0, size: 1, children: [
895
- /* @__PURE__ */ jsx(ErrorOutlineIcon, { style: {
896
- ...errorIconStyle,
897
- marginRight: "0.1em"
898
- } }),
899
- error.message
900
- ] }) }), fallbackPlacements: ["top", "left"], placement: "right", portal: !0, children: /* @__PURE__ */ jsx(ErrorOutlineIcon, { style: errorIconStyle }) }) }), $[3] = error, $[4] = t1) : t1 = $[4];
901
- let t2;
902
- $[5] !== t0 || $[6] !== t1 ? (t2 = /* @__PURE__ */ jsxs(Inline, { gap: 2, children: [
903
- t0,
904
- t1
905
- ] }), $[5] = t0, $[6] = t1, $[7] = t2) : t2 = $[7];
906
- let t3;
907
- $[8] !== description ? (t3 = description && /* @__PURE__ */ jsx(Box, { marginY: 3, children: /* @__PURE__ */ jsx(Text, { as: "p", muted: !0, size: 1, children: description }) }), $[8] = description, $[9] = t3) : t3 = $[9];
908
- let t4;
909
- return $[10] !== t2 || $[11] !== t3 ? (t4 = /* @__PURE__ */ jsxs(Box, { marginBottom: 3, children: [
910
- t2,
911
- t3
912
- ] }), $[10] = t2, $[11] = t3, $[12] = t4) : t4 = $[12], t4;
852
+ let val = formData[key];
853
+ return typeof val == "object" && val && val.constructor !== Array ? acc[key] = sanitizeFormData(val) : val === "" || val === void 0 || val?.length === 0 ? acc[key] = null : typeof val == "string" && val ? acc[key] = formData[key].trim() : acc[key] = formData[key], acc;
854
+ }, {}), errorIconStyle = { color: red[500].hex }, FormFieldInputLabel = (props) => {
855
+ let $ = c(13), { description, error, label, name } = props, t0;
856
+ $[0] !== label || $[1] !== name ? (t0 = /* @__PURE__ */ jsx(Text, {
857
+ as: "label",
858
+ htmlFor: name,
859
+ size: 1,
860
+ weight: "semibold",
861
+ children: label
862
+ }), $[0] = label, $[1] = name, $[2] = t0) : t0 = $[2];
863
+ let t1;
864
+ $[3] === error ? t1 = $[4] : (t1 = error && /* @__PURE__ */ jsx(Text, {
865
+ size: 1,
866
+ children: /* @__PURE__ */ jsx(Tooltip, {
867
+ content: /* @__PURE__ */ jsx(Box, {
868
+ padding: 2,
869
+ children: /* @__PURE__ */ jsxs(Text, {
870
+ muted: !0,
871
+ size: 1,
872
+ children: [/* @__PURE__ */ jsx(ErrorOutlineIcon, { style: {
873
+ ...errorIconStyle,
874
+ marginRight: "0.1em"
875
+ } }), error.message]
876
+ })
877
+ }),
878
+ fallbackPlacements: ["top", "left"],
879
+ placement: "right",
880
+ portal: !0,
881
+ children: /* @__PURE__ */ jsx(ErrorOutlineIcon, { style: errorIconStyle })
882
+ })
883
+ }), $[3] = error, $[4] = t1);
884
+ let t2;
885
+ $[5] !== t0 || $[6] !== t1 ? (t2 = /* @__PURE__ */ jsxs(Inline, {
886
+ gap: 2,
887
+ children: [t0, t1]
888
+ }), $[5] = t0, $[6] = t1, $[7] = t2) : t2 = $[7];
889
+ let t3;
890
+ $[8] === description ? t3 = $[9] : (t3 = description && /* @__PURE__ */ jsx(Box, {
891
+ marginY: 3,
892
+ children: /* @__PURE__ */ jsx(Text, {
893
+ as: "p",
894
+ muted: !0,
895
+ size: 1,
896
+ children: description
897
+ })
898
+ }), $[8] = description, $[9] = t3);
899
+ let t4;
900
+ return $[10] !== t2 || $[11] !== t3 ? (t4 = /* @__PURE__ */ jsxs(Box, {
901
+ marginBottom: 3,
902
+ children: [t2, t3]
903
+ }), $[10] = t2, $[11] = t3, $[12] = t4) : t4 = $[12], t4;
913
904
  }, FormFieldInputText = (props) => {
914
- const $ = c(16), {
915
- description,
916
- disabled,
917
- error,
918
- label,
919
- name,
920
- placeholder,
921
- value,
922
- onChange,
923
- onBlur,
924
- ref
925
- } = props;
926
- let t0;
927
- $[0] !== description || $[1] !== error || $[2] !== label || $[3] !== name ? (t0 = /* @__PURE__ */ jsx(FormFieldInputLabel, { description, error, label, name }), $[0] = description, $[1] = error, $[2] = label, $[3] = name, $[4] = t0) : t0 = $[4];
928
- let t1;
929
- $[5] !== disabled || $[6] !== name || $[7] !== onBlur || $[8] !== onChange || $[9] !== placeholder || $[10] !== ref || $[11] !== value ? (t1 = /* @__PURE__ */ jsx(TextInput, { autoComplete: "off", autoFocus: !0, defaultValue: value, disabled, id: name, name, placeholder, onChange, onBlur, ref }), $[5] = disabled, $[6] = name, $[7] = onBlur, $[8] = onChange, $[9] = placeholder, $[10] = ref, $[11] = value, $[12] = t1) : t1 = $[12];
930
- let t2;
931
- return $[13] !== t0 || $[14] !== t1 ? (t2 = /* @__PURE__ */ jsxs(Box, { children: [
932
- t0,
933
- t1
934
- ] }), $[13] = t0, $[14] = t1, $[15] = t2) : t2 = $[15], t2;
905
+ let $ = c(16), { description, disabled, error, label, name, placeholder, value, onChange, onBlur, ref } = props, t0;
906
+ $[0] !== description || $[1] !== error || $[2] !== label || $[3] !== name ? (t0 = /* @__PURE__ */ jsx(FormFieldInputLabel, {
907
+ description,
908
+ error,
909
+ label,
910
+ name
911
+ }), $[0] = description, $[1] = error, $[2] = label, $[3] = name, $[4] = t0) : t0 = $[4];
912
+ let t1;
913
+ $[5] !== disabled || $[6] !== name || $[7] !== onBlur || $[8] !== onChange || $[9] !== placeholder || $[10] !== ref || $[11] !== value ? (t1 = /* @__PURE__ */ jsx(TextInput, {
914
+ autoComplete: "off",
915
+ autoFocus: !0,
916
+ defaultValue: value,
917
+ disabled,
918
+ id: name,
919
+ name,
920
+ placeholder,
921
+ onChange,
922
+ onBlur,
923
+ ref
924
+ }), $[5] = disabled, $[6] = name, $[7] = onBlur, $[8] = onChange, $[9] = placeholder, $[10] = ref, $[11] = value, $[12] = t1) : t1 = $[12];
925
+ let t2;
926
+ return $[13] !== t0 || $[14] !== t1 ? (t2 = /* @__PURE__ */ jsxs(Box, { children: [t0, t1] }), $[13] = t0, $[14] = t1, $[15] = t2) : t2 = $[15], t2;
935
927
  }, formSchema = yup.object().shape({
936
- deployHook: yup.string().url("Deploy hook must be a valid URL"),
937
- deployLimit: yup.number().positive().integer().min(1, "Deploy limit must no less than 1").max(15, "Deploy limit must no higher than 15").typeError("Deploy limit must be a number").required("Deploy limit must be a positive integer between 1 and 15"),
938
- name: yup.string().required("Name cannot be empty"),
939
- projectId: yup.string().required("Vercel Project ID cannot be empty"),
940
- teamId: yup.string(),
941
- token: yup.string().required("Vercel Account Token cannot be empty")
928
+ deployHook: yup.string().url("Deploy hook must be a valid URL"),
929
+ deployLimit: yup.number().positive().integer().min(1, "Deploy limit must no less than 1").max(15, "Deploy limit must no higher than 15").typeError("Deploy limit must be a number").required("Deploy limit must be a positive integer between 1 and 15"),
930
+ name: yup.string().required("Name cannot be empty"),
931
+ projectId: yup.string().required("Vercel Project ID cannot be empty"),
932
+ teamId: yup.string(),
933
+ token: yup.string().required("Vercel Account Token cannot be empty")
942
934
  }), DialogForm = (props) => {
943
- const $ = c(104), {
944
- deploymentTarget,
945
- onClose,
946
- onCreate,
947
- onDelete,
948
- onUpdate
949
- } = props, client = useSanityClient(), toast = useToast();
950
- let t0;
951
- $[0] !== client ? (t0 = {
952
- input: {
953
- client
954
- }
955
- }, $[0] = client, $[1] = t0) : t0 = $[1];
956
- const [formState, formStateTransition, formStateActorRef] = useActor(formMachine, t0);
957
- let t1;
958
- $[2] !== formState ? (t1 = formState.hasTag("busy"), $[2] = formState, $[3] = t1) : t1 = $[3];
959
- const formUpdating = t1, t2 = deploymentTarget?.deployHook || "", t3 = deploymentTarget?.deployLimit || 5, t4 = deploymentTarget?.name || "", t5 = deploymentTarget?.projectId || "", t6 = deploymentTarget?.teamId || "", t7 = deploymentTarget?.token || "";
960
- let t8;
961
- $[4] !== t2 || $[5] !== t3 || $[6] !== t4 || $[7] !== t5 || $[8] !== t6 || $[9] !== t7 ? (t8 = {
962
- deployHook: t2,
963
- deployLimit: t3,
964
- name: t4,
965
- projectId: t5,
966
- teamId: t6,
967
- token: t7
968
- }, $[4] = t2, $[5] = t3, $[6] = t4, $[7] = t5, $[8] = t6, $[9] = t7, $[10] = t8) : t8 = $[10];
969
- let t9;
970
- $[11] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t9 = yupResolver(formSchema), $[11] = t9) : t9 = $[11];
971
- let t10;
972
- $[12] !== t8 ? (t10 = {
973
- defaultValues: t8,
974
- mode: "onChange",
975
- resolver: t9
976
- }, $[12] = t8, $[13] = t10) : t10 = $[13];
977
- const {
978
- formState: t11,
979
- handleSubmit,
980
- register
981
- } = useForm(t10), {
982
- errors,
983
- isDirty,
984
- isValid
985
- } = t11;
986
- let t12, t13;
987
- $[14] !== formState || $[15] !== onClose || $[16] !== toast ? (t12 = () => {
988
- formState.matches("error") && toast.push({
989
- status: "error",
990
- title: formState.context.message || "An error occurred"
991
- }), formState.status === "done" && onClose();
992
- }, t13 = [formState, onClose, toast], $[14] = formState, $[15] = onClose, $[16] = toast, $[17] = t12, $[18] = t13) : (t12 = $[17], t13 = $[18]), useEffect(t12, t13);
993
- let t14;
994
- $[19] !== deploymentTarget || $[20] !== formStateActorRef || $[21] !== formStateTransition || $[22] !== onCreate || $[23] !== onUpdate ? (t14 = async (formData) => {
995
- const sanitizedFormData = sanitizeFormData(formData);
996
- formStateTransition(deploymentTarget ? {
997
- type: "UPDATE",
998
- id: deploymentTarget._id,
999
- formData: sanitizedFormData
1000
- } : {
1001
- type: "CREATE",
1002
- formData: sanitizedFormData
1003
- }), await toPromise(formStateActorRef);
1004
- const snapshot = formStateActorRef.getSnapshot(), {
1005
- document
1006
- } = snapshot.context;
1007
- document && (snapshot.matches("created") ? onCreate?.(document) : snapshot.matches("updated") && onUpdate?.(document));
1008
- }, $[19] = deploymentTarget, $[20] = formStateActorRef, $[21] = formStateTransition, $[22] = onCreate, $[23] = onUpdate, $[24] = t14) : t14 = $[24];
1009
- const onSubmit = t14;
1010
- let t15;
1011
- $[25] !== deploymentTarget || $[26] !== formStateActorRef || $[27] !== formStateTransition || $[28] !== onDelete ? (t15 = async () => {
1012
- if (!deploymentTarget)
1013
- return;
1014
- const id = deploymentTarget._id;
1015
- formStateTransition({
1016
- type: "DELETE",
1017
- id
1018
- }), await toPromise(formStateActorRef), formStateActorRef.getSnapshot().matches("deleted") && onDelete?.(id);
1019
- }, $[25] = deploymentTarget, $[26] = formStateActorRef, $[27] = formStateTransition, $[28] = onDelete, $[29] = t15) : t15 = $[29];
1020
- const handleDelete = t15, t16 = deploymentTarget ? "space-between" : "flex-end";
1021
- let t17;
1022
- $[30] !== deploymentTarget || $[31] !== formState || $[32] !== formUpdating || $[33] !== handleDelete ? (t17 = deploymentTarget && /* @__PURE__ */ jsx(Button, { loading: formState.matches("deleting"), disabled: formUpdating, fontSize: 1, mode: "bleed", onClick: handleDelete, text: "Delete", tone: "critical" }), $[30] = deploymentTarget, $[31] = formState, $[32] = formUpdating, $[33] = handleDelete, $[34] = t17) : t17 = $[34];
1023
- let t18;
1024
- $[35] !== formState ? (t18 = formState.matches("creating") || formState.matches("updating"), $[35] = formState, $[36] = t18) : t18 = $[36];
1025
- const t19 = !isDirty || !isValid;
1026
- let t20;
1027
- $[37] !== handleSubmit || $[38] !== onSubmit ? (t20 = handleSubmit(onSubmit), $[37] = handleSubmit, $[38] = onSubmit, $[39] = t20) : t20 = $[39];
1028
- const t21 = deploymentTarget ? "Update and close" : "Create";
1029
- let t22;
1030
- $[40] !== t18 || $[41] !== t19 || $[42] !== t20 || $[43] !== t21 ? (t22 = /* @__PURE__ */ jsx(Button, { loading: t18, disabled: t19, fontSize: 1, onClick: t20, text: t21, tone: "primary" }), $[40] = t18, $[41] = t19, $[42] = t20, $[43] = t21, $[44] = t22) : t22 = $[44];
1031
- let t23;
1032
- $[45] !== t16 || $[46] !== t17 || $[47] !== t22 ? (t23 = /* @__PURE__ */ jsx(Box, { padding: 3, children: /* @__PURE__ */ jsxs(Flex, { justify: t16, children: [
1033
- t17,
1034
- t22
1035
- ] }) }), $[45] = t16, $[46] = t17, $[47] = t22, $[48] = t23) : t23 = $[48];
1036
- const t24 = `${deploymentTarget ? "Edit" : "Create"} deployment target`;
1037
- let t25;
1038
- $[49] !== handleSubmit || $[50] !== onSubmit ? (t25 = handleSubmit(onSubmit), $[49] = handleSubmit, $[50] = onSubmit, $[51] = t25) : t25 = $[51];
1039
- let t26;
1040
- $[52] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t26 = /* @__PURE__ */ jsx("button", { "aria-label": "Submit", style: {
1041
- display: "none"
1042
- }, tabIndex: -1, type: "submit" }), $[52] = t26) : t26 = $[52];
1043
- const t27 = errors?.name;
1044
- let t28;
1045
- $[53] !== register ? (t28 = register("name"), $[53] = register, $[54] = t28) : t28 = $[54];
1046
- let t29;
1047
- $[55] !== formUpdating || $[56] !== t27 || $[57] !== t28 ? (t29 = /* @__PURE__ */ jsx(FormFieldInputText, { disabled: formUpdating, description: "Name displayed in this plugin (e.g. production, staging)", error: t27, label: "Name", ...t28 }), $[55] = formUpdating, $[56] = t27, $[57] = t28, $[58] = t29) : t29 = $[58];
1048
- const t30 = errors?.token;
1049
- let t31;
1050
- $[59] !== register ? (t31 = register("token"), $[59] = register, $[60] = t31) : t31 = $[60];
1051
- let t32;
1052
- $[61] !== formUpdating || $[62] !== t30 || $[63] !== t31 ? (t32 = /* @__PURE__ */ jsx(FormFieldInputText, { disabled: formUpdating, error: t30, label: "Vercel Account Token", ...t31 }), $[61] = formUpdating, $[62] = t30, $[63] = t31, $[64] = t32) : t32 = $[64];
1053
- const t33 = errors?.projectId;
1054
- let t34;
1055
- $[65] !== register ? (t34 = register("projectId"), $[65] = register, $[66] = t34) : t34 = $[66];
1056
- let t35;
1057
- $[67] !== formUpdating || $[68] !== t33 || $[69] !== t34 ? (t35 = /* @__PURE__ */ jsx(FormFieldInputText, { disabled: formUpdating, error: t33, label: "Vercel Project ID", ...t34 }), $[67] = formUpdating, $[68] = t33, $[69] = t34, $[70] = t35) : t35 = $[70];
1058
- const t36 = errors?.teamId;
1059
- let t37;
1060
- $[71] !== register ? (t37 = register("teamId"), $[71] = register, $[72] = t37) : t37 = $[72];
1061
- let t38;
1062
- $[73] !== formUpdating || $[74] !== t36 || $[75] !== t37 ? (t38 = /* @__PURE__ */ jsx(FormFieldInputText, { description: "Required only if your project is owned by a team account", disabled: formUpdating, error: t36, label: "Vercel Team ID (optional)", ...t37 }), $[73] = formUpdating, $[74] = t36, $[75] = t37, $[76] = t38) : t38 = $[76];
1063
- const t39 = errors?.deployHook;
1064
- let t40;
1065
- $[77] !== register ? (t40 = register("deployHook"), $[77] = register, $[78] = t40) : t40 = $[78];
1066
- let t41;
1067
- $[79] !== formUpdating || $[80] !== t39 || $[81] !== t40 ? (t41 = /* @__PURE__ */ jsx(FormFieldInputText, { description: "Enter a valid deploy hook URL to enable manual deploys", disabled: formUpdating, error: t39, label: "Vercel Deploy Hook (optional)", ...t40 }), $[79] = formUpdating, $[80] = t39, $[81] = t40, $[82] = t41) : t41 = $[82];
1068
- const t42 = errors?.deployLimit;
1069
- let t43;
1070
- $[83] !== register ? (t43 = register("deployLimit", {
1071
- valueAsNumber: !0
1072
- }), $[83] = register, $[84] = t43) : t43 = $[84];
1073
- let t44;
1074
- $[85] !== formUpdating || $[86] !== t42 || $[87] !== t43 ? (t44 = /* @__PURE__ */ jsx(FormFieldInputText, { disabled: formUpdating, error: t42, label: "Number of deploys to display", ...t43 }), $[85] = formUpdating, $[86] = t42, $[87] = t43, $[88] = t44) : t44 = $[88];
1075
- let t45;
1076
- $[89] !== t29 || $[90] !== t32 || $[91] !== t35 || $[92] !== t38 || $[93] !== t41 || $[94] !== t44 ? (t45 = /* @__PURE__ */ jsxs(Stack, { gap: 5, children: [
1077
- t29,
1078
- t32,
1079
- t35,
1080
- t38,
1081
- t41,
1082
- t44
1083
- ] }), $[89] = t29, $[90] = t32, $[91] = t35, $[92] = t38, $[93] = t41, $[94] = t44, $[95] = t45) : t45 = $[95];
1084
- let t46;
1085
- $[96] !== t25 || $[97] !== t45 ? (t46 = /* @__PURE__ */ jsxs(Box, { as: "form", padding: 4, onSubmit: t25, children: [
1086
- t26,
1087
- t45
1088
- ] }), $[96] = t25, $[97] = t45, $[98] = t46) : t46 = $[98];
1089
- let t47;
1090
- return $[99] !== onClose || $[100] !== t23 || $[101] !== t24 || $[102] !== t46 ? (t47 = /* @__PURE__ */ jsx(Dialog, { footer: t23, header: t24, id: "create", onClose, width: 1, zOffset: Z_INDEX_DIALOG, children: t46 }), $[99] = onClose, $[100] = t23, $[101] = t24, $[102] = t46, $[103] = t47) : t47 = $[103], t47;
935
+ let $ = c(104), { deploymentTarget, onClose, onCreate, onDelete, onUpdate } = props, client = useSanityClient(), toast = useToast(), t0;
936
+ $[0] === client ? t0 = $[1] : (t0 = { input: { client } }, $[0] = client, $[1] = t0);
937
+ let [formState, formStateTransition, formStateActorRef] = useActor(formMachine, t0), t1;
938
+ $[2] === formState ? t1 = $[3] : (t1 = formState.hasTag("busy"), $[2] = formState, $[3] = t1);
939
+ let formUpdating = t1, t2 = deploymentTarget?.deployHook || "", t3 = deploymentTarget?.deployLimit || 5, t4 = deploymentTarget?.name || "", t5 = deploymentTarget?.projectId || "", t6 = deploymentTarget?.teamId || "", t7 = deploymentTarget?.token || "", t8;
940
+ $[4] !== t2 || $[5] !== t3 || $[6] !== t4 || $[7] !== t5 || $[8] !== t6 || $[9] !== t7 ? (t8 = {
941
+ deployHook: t2,
942
+ deployLimit: t3,
943
+ name: t4,
944
+ projectId: t5,
945
+ teamId: t6,
946
+ token: t7
947
+ }, $[4] = t2, $[5] = t3, $[6] = t4, $[7] = t5, $[8] = t6, $[9] = t7, $[10] = t8) : t8 = $[10];
948
+ let t9;
949
+ $[11] === Symbol.for("react.memo_cache_sentinel") ? (t9 = yupResolver(formSchema), $[11] = t9) : t9 = $[11];
950
+ let t10;
951
+ $[12] === t8 ? t10 = $[13] : (t10 = {
952
+ defaultValues: t8,
953
+ mode: "onChange",
954
+ resolver: t9
955
+ }, $[12] = t8, $[13] = t10);
956
+ let { formState: t11, handleSubmit, register } = useForm(t10), { errors, isDirty, isValid } = t11, t12, t13;
957
+ $[14] !== formState || $[15] !== onClose || $[16] !== toast ? (t12 = () => {
958
+ formState.matches("error") && toast.push({
959
+ status: "error",
960
+ title: formState.context.message || "An error occurred"
961
+ }), formState.status === "done" && onClose();
962
+ }, t13 = [
963
+ formState,
964
+ onClose,
965
+ toast
966
+ ], $[14] = formState, $[15] = onClose, $[16] = toast, $[17] = t12, $[18] = t13) : (t12 = $[17], t13 = $[18]), useEffect(t12, t13);
967
+ let t14;
968
+ $[19] !== deploymentTarget || $[20] !== formStateActorRef || $[21] !== formStateTransition || $[22] !== onCreate || $[23] !== onUpdate ? (t14 = async (formData) => {
969
+ let sanitizedFormData = sanitizeFormData(formData);
970
+ formStateTransition(deploymentTarget ? {
971
+ type: "UPDATE",
972
+ id: deploymentTarget._id,
973
+ formData: sanitizedFormData
974
+ } : {
975
+ type: "CREATE",
976
+ formData: sanitizedFormData
977
+ }), await toPromise(formStateActorRef);
978
+ let snapshot = formStateActorRef.getSnapshot(), { document } = snapshot.context;
979
+ document && (snapshot.matches("created") ? onCreate?.(document) : snapshot.matches("updated") && onUpdate?.(document));
980
+ }, $[19] = deploymentTarget, $[20] = formStateActorRef, $[21] = formStateTransition, $[22] = onCreate, $[23] = onUpdate, $[24] = t14) : t14 = $[24];
981
+ let onSubmit = t14, t15;
982
+ $[25] !== deploymentTarget || $[26] !== formStateActorRef || $[27] !== formStateTransition || $[28] !== onDelete ? (t15 = async () => {
983
+ if (!deploymentTarget) return;
984
+ let id = deploymentTarget._id;
985
+ formStateTransition({
986
+ type: "DELETE",
987
+ id
988
+ }), await toPromise(formStateActorRef), formStateActorRef.getSnapshot().matches("deleted") && onDelete?.(id);
989
+ }, $[25] = deploymentTarget, $[26] = formStateActorRef, $[27] = formStateTransition, $[28] = onDelete, $[29] = t15) : t15 = $[29];
990
+ let handleDelete = t15, t16 = deploymentTarget ? "space-between" : "flex-end", t17;
991
+ $[30] !== deploymentTarget || $[31] !== formState || $[32] !== formUpdating || $[33] !== handleDelete ? (t17 = deploymentTarget && /* @__PURE__ */ jsx(Button, {
992
+ loading: formState.matches("deleting"),
993
+ disabled: formUpdating,
994
+ fontSize: 1,
995
+ mode: "bleed",
996
+ onClick: handleDelete,
997
+ text: "Delete",
998
+ tone: "critical"
999
+ }), $[30] = deploymentTarget, $[31] = formState, $[32] = formUpdating, $[33] = handleDelete, $[34] = t17) : t17 = $[34];
1000
+ let t18;
1001
+ $[35] === formState ? t18 = $[36] : (t18 = formState.matches("creating") || formState.matches("updating"), $[35] = formState, $[36] = t18);
1002
+ let t19 = !isDirty || !isValid, t20;
1003
+ $[37] !== handleSubmit || $[38] !== onSubmit ? (t20 = handleSubmit(onSubmit), $[37] = handleSubmit, $[38] = onSubmit, $[39] = t20) : t20 = $[39];
1004
+ let t21 = deploymentTarget ? "Update and close" : "Create", t22;
1005
+ $[40] !== t18 || $[41] !== t19 || $[42] !== t20 || $[43] !== t21 ? (t22 = /* @__PURE__ */ jsx(Button, {
1006
+ loading: t18,
1007
+ disabled: t19,
1008
+ fontSize: 1,
1009
+ onClick: t20,
1010
+ text: t21,
1011
+ tone: "primary"
1012
+ }), $[40] = t18, $[41] = t19, $[42] = t20, $[43] = t21, $[44] = t22) : t22 = $[44];
1013
+ let t23;
1014
+ $[45] !== t16 || $[46] !== t17 || $[47] !== t22 ? (t23 = /* @__PURE__ */ jsx(Box, {
1015
+ padding: 3,
1016
+ children: /* @__PURE__ */ jsxs(Flex, {
1017
+ justify: t16,
1018
+ children: [t17, t22]
1019
+ })
1020
+ }), $[45] = t16, $[46] = t17, $[47] = t22, $[48] = t23) : t23 = $[48];
1021
+ let t24 = `${deploymentTarget ? "Edit" : "Create"} deployment target`, t25;
1022
+ $[49] !== handleSubmit || $[50] !== onSubmit ? (t25 = handleSubmit(onSubmit), $[49] = handleSubmit, $[50] = onSubmit, $[51] = t25) : t25 = $[51];
1023
+ let t26;
1024
+ $[52] === Symbol.for("react.memo_cache_sentinel") ? (t26 = /* @__PURE__ */ jsx("button", {
1025
+ "aria-label": "Submit",
1026
+ style: { display: "none" },
1027
+ tabIndex: -1,
1028
+ type: "submit"
1029
+ }), $[52] = t26) : t26 = $[52];
1030
+ let t27 = errors?.name, t28;
1031
+ $[53] === register ? t28 = $[54] : (t28 = register("name"), $[53] = register, $[54] = t28);
1032
+ let t29;
1033
+ $[55] !== formUpdating || $[56] !== t27 || $[57] !== t28 ? (t29 = /* @__PURE__ */ jsx(FormFieldInputText, {
1034
+ disabled: formUpdating,
1035
+ description: "Name displayed in this plugin (e.g. production, staging)",
1036
+ error: t27,
1037
+ label: "Name",
1038
+ ...t28
1039
+ }), $[55] = formUpdating, $[56] = t27, $[57] = t28, $[58] = t29) : t29 = $[58];
1040
+ let t30 = errors?.token, t31;
1041
+ $[59] === register ? t31 = $[60] : (t31 = register("token"), $[59] = register, $[60] = t31);
1042
+ let t32;
1043
+ $[61] !== formUpdating || $[62] !== t30 || $[63] !== t31 ? (t32 = /* @__PURE__ */ jsx(FormFieldInputText, {
1044
+ disabled: formUpdating,
1045
+ error: t30,
1046
+ label: "Vercel Account Token",
1047
+ ...t31
1048
+ }), $[61] = formUpdating, $[62] = t30, $[63] = t31, $[64] = t32) : t32 = $[64];
1049
+ let t33 = errors?.projectId, t34;
1050
+ $[65] === register ? t34 = $[66] : (t34 = register("projectId"), $[65] = register, $[66] = t34);
1051
+ let t35;
1052
+ $[67] !== formUpdating || $[68] !== t33 || $[69] !== t34 ? (t35 = /* @__PURE__ */ jsx(FormFieldInputText, {
1053
+ disabled: formUpdating,
1054
+ error: t33,
1055
+ label: "Vercel Project ID",
1056
+ ...t34
1057
+ }), $[67] = formUpdating, $[68] = t33, $[69] = t34, $[70] = t35) : t35 = $[70];
1058
+ let t36 = errors?.teamId, t37;
1059
+ $[71] === register ? t37 = $[72] : (t37 = register("teamId"), $[71] = register, $[72] = t37);
1060
+ let t38;
1061
+ $[73] !== formUpdating || $[74] !== t36 || $[75] !== t37 ? (t38 = /* @__PURE__ */ jsx(FormFieldInputText, {
1062
+ description: "Required only if your project is owned by a team account",
1063
+ disabled: formUpdating,
1064
+ error: t36,
1065
+ label: "Vercel Team ID (optional)",
1066
+ ...t37
1067
+ }), $[73] = formUpdating, $[74] = t36, $[75] = t37, $[76] = t38) : t38 = $[76];
1068
+ let t39 = errors?.deployHook, t40;
1069
+ $[77] === register ? t40 = $[78] : (t40 = register("deployHook"), $[77] = register, $[78] = t40);
1070
+ let t41;
1071
+ $[79] !== formUpdating || $[80] !== t39 || $[81] !== t40 ? (t41 = /* @__PURE__ */ jsx(FormFieldInputText, {
1072
+ description: "Enter a valid deploy hook URL to enable manual deploys",
1073
+ disabled: formUpdating,
1074
+ error: t39,
1075
+ label: "Vercel Deploy Hook (optional)",
1076
+ ...t40
1077
+ }), $[79] = formUpdating, $[80] = t39, $[81] = t40, $[82] = t41) : t41 = $[82];
1078
+ let t42 = errors?.deployLimit, t43;
1079
+ $[83] === register ? t43 = $[84] : (t43 = register("deployLimit", { valueAsNumber: !0 }), $[83] = register, $[84] = t43);
1080
+ let t44;
1081
+ $[85] !== formUpdating || $[86] !== t42 || $[87] !== t43 ? (t44 = /* @__PURE__ */ jsx(FormFieldInputText, {
1082
+ disabled: formUpdating,
1083
+ error: t42,
1084
+ label: "Number of deploys to display",
1085
+ ...t43
1086
+ }), $[85] = formUpdating, $[86] = t42, $[87] = t43, $[88] = t44) : t44 = $[88];
1087
+ let t45;
1088
+ $[89] !== t29 || $[90] !== t32 || $[91] !== t35 || $[92] !== t38 || $[93] !== t41 || $[94] !== t44 ? (t45 = /* @__PURE__ */ jsxs(Stack, {
1089
+ gap: 5,
1090
+ children: [
1091
+ t29,
1092
+ t32,
1093
+ t35,
1094
+ t38,
1095
+ t41,
1096
+ t44
1097
+ ]
1098
+ }), $[89] = t29, $[90] = t32, $[91] = t35, $[92] = t38, $[93] = t41, $[94] = t44, $[95] = t45) : t45 = $[95];
1099
+ let t46;
1100
+ $[96] !== t25 || $[97] !== t45 ? (t46 = /* @__PURE__ */ jsxs(Box, {
1101
+ as: "form",
1102
+ padding: 4,
1103
+ onSubmit: t25,
1104
+ children: [t26, t45]
1105
+ }), $[96] = t25, $[97] = t45, $[98] = t46) : t46 = $[98];
1106
+ let t47;
1107
+ return $[99] !== onClose || $[100] !== t23 || $[101] !== t24 || $[102] !== t46 ? (t47 = /* @__PURE__ */ jsx(Dialog, {
1108
+ footer: t23,
1109
+ header: t24,
1110
+ id: "create",
1111
+ onClose,
1112
+ width: 1,
1113
+ zOffset: 600001,
1114
+ children: t46
1115
+ }), $[99] = onClose, $[100] = t23, $[101] = t24, $[102] = t46, $[103] = t47) : t47 = $[103], t47;
1091
1116
  }, sortByTargetName = (items) => items.sort((a, b) => a.name > b.name ? 1 : a.name < b.name ? -1 : 0), deploymentTargetListMachine = setup({
1092
- types: {},
1093
- actions: {
1094
- targetCreate: assign({
1095
- results: ({
1096
- context,
1097
- event
1098
- }) => (assertEvent(event, "CREATE"), sortByTargetName([...context.results, event.deploymentTarget]))
1099
- }),
1100
- targetDelete: assign({
1101
- results: ({
1102
- context,
1103
- event
1104
- }) => (assertEvent(event, "DELETE"), context.results.filter((target) => target._id !== event.id))
1105
- }),
1106
- targetUpdate: assign({
1107
- results: ({
1108
- context,
1109
- event
1110
- }) => {
1111
- assertEvent(event, "UPDATE");
1112
- const {
1113
- deploymentTarget
1114
- } = event, index = context.results.findIndex((target) => target._id === deploymentTarget._id), updatedResults = Object.assign([], context.results, {
1115
- [index]: deploymentTarget
1116
- });
1117
- return sortByTargetName(updatedResults);
1118
- }
1119
- })
1120
- },
1121
- guards: {
1122
- hasData: ({
1123
- context
1124
- }) => context?.results?.length > 0,
1125
- hasNoData: ({
1126
- context
1127
- }) => context?.results?.length === 0
1128
- },
1129
- actors: {
1130
- "fetch data": fromPromise(({
1131
- input,
1132
- signal
1133
- }) => input.client.fetch("*[_type == $type] | order(name asc)", {
1134
- type: DEPLOYMENT_TARGET_DOCUMENT_TYPE
1135
- }, {
1136
- signal
1137
- }).catch((error) => {
1138
- if (error instanceof Error && error.name === "AbortError")
1139
- return [];
1140
- throw console.error("Failed to fetch deployment targets", error), error;
1141
- }))
1142
- }
1117
+ types: {},
1118
+ actions: {
1119
+ targetCreate: assign({ results: ({ context, event }) => (assertEvent(event, "CREATE"), sortByTargetName([...context.results, event.deploymentTarget])) }),
1120
+ targetDelete: assign({ results: ({ context, event }) => (assertEvent(event, "DELETE"), context.results.filter((target) => target._id !== event.id)) }),
1121
+ targetUpdate: assign({ results: ({ context, event }) => {
1122
+ assertEvent(event, "UPDATE");
1123
+ let { deploymentTarget } = event, index = context.results.findIndex((target) => target._id === deploymentTarget._id);
1124
+ return sortByTargetName(Object.assign([], context.results, { [index]: deploymentTarget }));
1125
+ } })
1126
+ },
1127
+ guards: {
1128
+ hasData: ({ context }) => context?.results?.length > 0,
1129
+ hasNoData: ({ context }) => context?.results?.length === 0
1130
+ },
1131
+ actors: { "fetch data": fromPromise(({ input, signal }) => input.client.fetch("*[_type == $type] | order(name asc)", { type: DEPLOYMENT_TARGET_DOCUMENT_TYPE }, { signal }).catch((error) => {
1132
+ if (error instanceof Error && error.name === "AbortError") return [];
1133
+ throw console.error("Failed to fetch deployment targets", error), error;
1134
+ })) }
1143
1135
  }).createMachine({
1144
- /** @xstate-layout N4IgpgJg5mDOIC5QAoC2BDAxgCwJYDswBKAOgAcx8ICoBiCAe0JIIDcGBrMEgMzABccAEXT90AbQAMAXUSgyDWLn64mckAA9EAZkkBOEgHYAjAA5DAFgBsFgEwnJAVkMAaEAE9Ep4yUeT-klbGesbaoYaGAL6RbmhYeISkFFQ0tGAATukM6eQANqI82ai8AsKiEjLqCkoqakiaOvpGZpY29sZOrh6IxpYkFo5h2oaOpnqOxraSFtGxGDgExCTpYOgQ7rQAwgBKAKIAggAqu1Ky9dXKqvjqWggWHSS9eoaS9ibao6aObp4IVh8kL56OzGII2PT-WYgOILRLLVbrWhCXYAGV2x1OVUUlzqoFu90kRm8tlM2gsL1eJJ+iEGBj0gVsFm0YWmVkctihMISSxWaw2AFUAApCI4nSrnbG1a71fGSUz9WzBezTFWvb7dO5MkjjMITZykwxjTnzbmkXnrEgAV3wHHwDAA7vhaJiJTUrjces9fFZGc9TLYrGqA9SEM9CcT7sznH5HHpjfFFmaEe4rTa7Y7ncYzvJJe6ZZ7DN7fYaA0GrCHvD4xs4S+yPnGYtCTYn4XySPblNgRGJneKc27cQ0EI4BiQ2T77noAzXyxrTIESGFGd4rP9DONTPHYTzk+3OwxLfxu+he9mQBcpR7h6Px4ylWyIrPfl9bIvJhZJIYA-7zFZoo27QgOB1C5RMsQHaU8UQABaYIQ2gv9G1AuFkmofAoHAnFIKHOwQz0bRtUMcd-j8WwpnuLdTVbdZMMvfMEFsPQQxMeViQmZkLC+f0oiQ5s4XNFNrVtB1sIvPMoIQCIK1BIsmXXWxtFJcZKJbAS934Ltylo8ShysfDHl9PRxjlekrC6Z9BhIBk5MkXpzFBFT+N3DsNIPI8tNdLCr20L0Wmscw5V0e5pMJYwBiI8kwrDRC5gTOEeHQXBckgbTB1uZwQw6RwrEBd9bEcQZYzsRDoiAA */
1145
- context: ({
1146
- input
1147
- }) => ({
1148
- client: input.client,
1149
- results: []
1150
- }),
1151
- initial: "pending",
1152
- states: {
1153
- pending: {
1154
- invoke: {
1155
- src: "fetch data",
1156
- id: "fetchData",
1157
- input: ({
1158
- context
1159
- }) => ({
1160
- client: context.client
1161
- }),
1162
- onDone: {
1163
- actions: assign({
1164
- results: ({
1165
- event
1166
- }) => event.output
1167
- }),
1168
- target: "ready"
1169
- },
1170
- onError: {
1171
- target: "failed"
1172
- }
1173
- }
1174
- },
1175
- ready: {
1176
- initial: "unknown",
1177
- on: {
1178
- CREATE: {
1179
- actions: "targetCreate"
1180
- },
1181
- DELETE: {
1182
- actions: "targetDelete"
1183
- },
1184
- UPDATE: {
1185
- actions: "targetUpdate"
1186
- }
1187
- },
1188
- states: {
1189
- unknown: {
1190
- always: [{
1191
- target: "withData",
1192
- guard: "hasData"
1193
- }, {
1194
- target: "withoutData",
1195
- guard: "hasNoData"
1196
- }]
1197
- },
1198
- withData: {
1199
- always: [{
1200
- target: "withoutData",
1201
- guard: "hasNoData"
1202
- }]
1203
- },
1204
- withoutData: {
1205
- always: [{
1206
- target: "withData",
1207
- guard: "hasData"
1208
- }]
1209
- }
1210
- }
1211
- },
1212
- failed: {
1213
- type: "final"
1214
- }
1215
- }
1136
+ /** @xstate-layout N4IgpgJg5mDOIC5QAoC2BDAxgCwJYDswBKAOgAcx8ICoBiCAe0JIIDcGBrMEgMzABccAEXT90AbQAMAXUSgyDWLn64mckAA9EAZkkBOEgHYAjAA5DAFgBsFgEwnJAVkMAaEAE9Ep4yUeT-klbGesbaoYaGAL6RbmhYeISkFFQ0tGAATukM6eQANqI82ai8AsKiEjLqCkoqakiaOvpGZpY29sZOrh6IxpYkFo5h2oaOpnqOxraSFtGxGDgExCTpYOgQ7rQAwgBKAKIAggAqu1Ky9dXKqvjqWggWHSS9eoaS9ibao6aObp4IVh8kL56OzGII2PT-WYgOILRLLVbrWhCXYAGV2x1OVUUlzqoFu90kRm8tlM2gsL1eJJ+iEGBj0gVsFm0YWmVkctihMISSxWaw2AFUAApCI4nSrnbG1a71fGSUz9WzBezTFWvb7dO5MkjjMITZykwxjTnzbmkXnrEgAV3wHHwDAA7vhaJiJTUrjces9fFZGc9TLYrGqA9SEM9CcT7sznH5HHpjfFFmaEe4rTa7Y7ncYzvJJe6ZZ7DN7fYaA0GrCHvD4xs4S+yPnGYtCTYn4XySPblNgRGJneKc27cQ0EI4BiQ2T77noAzXyxrTIESGFGd4rP9DONTPHYTzk+3OwxLfxu+he9mQBcpR7h6Px4ylWyIrPfl9bIvJhZJIYA-7zFZoo27QgOB1C5RMsQHaU8UQABaYIQ2gv9G1AuFkmofAoHAnFIKHOwQz0bRtUMcd-j8WwpnuLdTVbdZMMvfMEFsPQQxMeViQmZkLC+f0oiQ5s4XNFNrVtB1sIvPMoIQCIK1BIsmXXWxtFJcZKJbAS934Ltylo8ShysfDHl9PRxjlekrC6Z9BhIBk5MkXpzFBFT+N3DsNIPI8tNdLCr20L0Wmscw5V0e5pMJYwBiI8kwrDRC5gTOEeHQXBckgbTB1uZwQw6RwrEBd9bEcQZYzsRDoiAA */
1137
+ context: ({ input }) => ({
1138
+ client: input.client,
1139
+ results: []
1140
+ }),
1141
+ initial: "pending",
1142
+ states: {
1143
+ pending: { invoke: {
1144
+ src: "fetch data",
1145
+ id: "fetchData",
1146
+ input: ({ context }) => ({ client: context.client }),
1147
+ onDone: {
1148
+ actions: assign({ results: ({ event }) => event.output }),
1149
+ target: "ready"
1150
+ },
1151
+ onError: { target: "failed" }
1152
+ } },
1153
+ ready: {
1154
+ initial: "unknown",
1155
+ on: {
1156
+ CREATE: { actions: "targetCreate" },
1157
+ DELETE: { actions: "targetDelete" },
1158
+ UPDATE: { actions: "targetUpdate" }
1159
+ },
1160
+ states: {
1161
+ unknown: { always: [{
1162
+ target: "withData",
1163
+ guard: "hasData"
1164
+ }, {
1165
+ target: "withoutData",
1166
+ guard: "hasNoData"
1167
+ }] },
1168
+ withData: { always: [{
1169
+ target: "withoutData",
1170
+ guard: "hasNoData"
1171
+ }] },
1172
+ withoutData: { always: [{
1173
+ target: "withData",
1174
+ guard: "hasData"
1175
+ }] }
1176
+ }
1177
+ },
1178
+ failed: { type: "final" }
1179
+ }
1216
1180
  }), dialogMachine = setup({
1217
- types: {
1218
- context: {},
1219
- events: {}
1220
- },
1221
- actions: {
1222
- setEditDeploymentTarget: assign({
1223
- editDeploymentTarget: ({
1224
- event
1225
- }) => (assertEvent(event, "EDIT"), event.deploymentTarget)
1226
- })
1227
- }
1181
+ types: {
1182
+ context: {},
1183
+ events: {}
1184
+ },
1185
+ actions: { setEditDeploymentTarget: assign({ editDeploymentTarget: ({ event }) => (assertEvent(event, "EDIT"), event.deploymentTarget) }) }
1228
1186
  }).createMachine({
1229
- /** @xstate-layout N4IgpgJg5mDOIC5QAoC2BDAxgCwJYDswBKAOlwgBswBiAYQCUBRAQQBVGBtABgF1FQADgHtYuAC64h+fiAAeiAEwKArCQCcANgAcAdmUbNOhVx0BGLQBoQAT0SmAzApJcXXexoAsW5fbWaFAL4BVmhYeISk5FTUjAAiAJKs3HxIIMKiElIy8ghKqpq6+obGZpY2ivb2zq4e5moeXKZc3kEhGDgExCSQ4nQAMgDyAMqcvDLp4pLSqTn2DSQefn7uyq5aWvZWtgjmTqsuvnU6XMoK9q0goR0RJJgATmDoYjS0gyPJ4yKTWTOIc1wLJZqFZrDZbRBaUwkfZuew6SFcepuILBED4IQQOAyK7hYifDJTbKIAC0GnBCFJFxxnUilDA+O+01AOQ8CnJGxIGn29lMpjUxhcCh0VPauNIPTEDMyTLkiA8PhIxh5Cg8DS8pgM5L5UOalSMah0cP05hFYRptweT3pqQm0qJCHlVSVphVashmvKCDUAN17j0XNMqrUyhRASAA */
1230
- context: {
1231
- editDeploymentTarget: void 0
1232
- },
1233
- initial: "idle",
1234
- states: {
1235
- idle: {
1236
- entry: assign({
1237
- editDeploymentTarget: () => {
1238
- }
1239
- }),
1240
- on: {
1241
- CREATE: {
1242
- target: "create"
1243
- },
1244
- EDIT: {
1245
- actions: "setEditDeploymentTarget",
1246
- target: "edit"
1247
- }
1248
- }
1249
- },
1250
- edit: {
1251
- on: {
1252
- CLOSE: {
1253
- target: "idle"
1254
- }
1255
- }
1256
- },
1257
- create: {
1258
- on: {
1259
- CLOSE: {
1260
- target: "idle"
1261
- }
1262
- }
1263
- }
1264
- }
1265
- }), queryClient = new QueryClient({
1266
- defaultOptions: {
1267
- queries: {
1268
- gcTime: 0,
1269
- staleTime: 0
1270
- }
1271
- }
1272
- }), Widget = () => {
1273
- const $ = c(53), client = useSanityClient();
1274
- let t0;
1275
- $[0] !== client ? (t0 = {
1276
- input: {
1277
- client
1278
- }
1279
- }, $[0] = client, $[1] = t0) : t0 = $[1];
1280
- const [deploymentTargetListState, deploymentTargetListStateTransition] = useMachine(deploymentTargetListMachine, t0), [dialogState, dialogStateTransition] = useMachine(dialogMachine);
1281
- let t1;
1282
- $[2] !== dialogStateTransition ? (t1 = () => {
1283
- dialogStateTransition({
1284
- type: "CLOSE"
1285
- });
1286
- }, $[2] = dialogStateTransition, $[3] = t1) : t1 = $[3];
1287
- const handleDialogClose = t1;
1288
- let t2;
1289
- $[4] !== dialogStateTransition ? (t2 = () => {
1290
- dialogStateTransition({
1291
- type: "CREATE"
1292
- });
1293
- }, $[4] = dialogStateTransition, $[5] = t2) : t2 = $[5];
1294
- const handleDialogShowCreate = t2;
1295
- let t3;
1296
- $[6] !== dialogStateTransition ? (t3 = (deploymentTarget) => {
1297
- dialogStateTransition({
1298
- type: "EDIT",
1299
- deploymentTarget
1300
- });
1301
- }, $[6] = dialogStateTransition, $[7] = t3) : t3 = $[7];
1302
- const handleDialogShowEdit = t3;
1303
- let t4;
1304
- $[8] !== deploymentTargetListStateTransition ? (t4 = (deploymentTarget_0) => {
1305
- deploymentTargetListStateTransition({
1306
- type: "CREATE",
1307
- deploymentTarget: deploymentTarget_0
1308
- });
1309
- }, $[8] = deploymentTargetListStateTransition, $[9] = t4) : t4 = $[9];
1310
- const handleTargetCreate = t4;
1311
- let t5;
1312
- $[10] !== deploymentTargetListStateTransition ? (t5 = (id) => {
1313
- deploymentTargetListStateTransition({
1314
- type: "DELETE",
1315
- id
1316
- });
1317
- }, $[10] = deploymentTargetListStateTransition, $[11] = t5) : t5 = $[11];
1318
- const handleTargetDelete = t5;
1319
- let t6;
1320
- $[12] !== deploymentTargetListStateTransition ? (t6 = (deploymentTarget_1) => {
1321
- deploymentTargetListStateTransition({
1322
- type: "UPDATE",
1323
- deploymentTarget: deploymentTarget_1
1324
- });
1325
- }, $[12] = deploymentTargetListStateTransition, $[13] = t6) : t6 = $[13];
1326
- const handleTargetUpdate = t6;
1327
- let t7;
1328
- $[14] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t7 = {
1329
- overflow: "hidden "
1330
- }, $[14] = t7) : t7 = $[14];
1331
- let t8;
1332
- $[15] !== deploymentTargetListState ? (t8 = /* @__PURE__ */ jsx(StateDebug, { name: "List", state: deploymentTargetListState }), $[15] = deploymentTargetListState, $[16] = t8) : t8 = $[16];
1333
- let t9;
1334
- $[17] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t9 = /* @__PURE__ */ jsx(Text, { size: 5, weight: "semibold", children: "Vercel deployments" }), $[17] = t9) : t9 = $[17];
1335
- let t10;
1336
- $[18] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t10 = /* @__PURE__ */ jsx(Box, { padding: 2, children: /* @__PURE__ */ jsx(Text, { muted: !0, size: 1, children: "Create new deployment target" }) }), $[18] = t10) : t10 = $[18];
1337
- let t11;
1338
- $[19] !== handleDialogShowCreate ? (t11 = /* @__PURE__ */ jsxs(Flex, { align: "center", justify: "space-between", paddingX: 3, paddingY: 2, children: [
1339
- t9,
1340
- /* @__PURE__ */ jsx(Tooltip, { content: t10, placement: "left", children: /* @__PURE__ */ jsx(Button, { fontSize: 1, icon: AddIcon, onClick: handleDialogShowCreate, mode: "bleed" }) })
1341
- ] }), $[19] = handleDialogShowCreate, $[20] = t11) : t11 = $[20];
1342
- let t12;
1343
- $[21] !== deploymentTargetListState ? (t12 = deploymentTargetListState.matches("pending") && /* @__PURE__ */ jsx(Box, { paddingX: 3, paddingY: 4, children: /* @__PURE__ */ jsx(Text, { children: "Loading..." }) }), $[21] = deploymentTargetListState, $[22] = t12) : t12 = $[22];
1344
- let t13;
1345
- $[23] !== deploymentTargetListState || $[24] !== handleDialogShowCreate ? (t13 = deploymentTargetListState.matches({
1346
- ready: "withoutData"
1347
- }) && /* @__PURE__ */ jsxs(Flex, { align: "center", gap: 3, paddingX: 3, paddingY: 4, children: [
1348
- /* @__PURE__ */ jsx(Text, { children: "No deployment targets found." }),
1349
- /* @__PURE__ */ jsx(Button, { fontSize: 1, mode: "ghost", onClick: handleDialogShowCreate, text: "Create a new target" })
1350
- ] }), $[23] = deploymentTargetListState, $[24] = handleDialogShowCreate, $[25] = t13) : t13 = $[25];
1351
- let t14;
1352
- $[26] !== deploymentTargetListState || $[27] !== handleDialogShowEdit ? (t14 = deploymentTargetListState.matches({
1353
- ready: "withData"
1354
- }) && /* @__PURE__ */ jsx(DeploymentTargets, { items: deploymentTargetListState.context.results, onDialogEdit: handleDialogShowEdit }), $[26] = deploymentTargetListState, $[27] = handleDialogShowEdit, $[28] = t14) : t14 = $[28];
1355
- let t15;
1356
- $[29] !== deploymentTargetListState ? (t15 = deploymentTargetListState.matches("failed") && /* @__PURE__ */ jsx(Box, { paddingX: 3, paddingY: 4, children: /* @__PURE__ */ jsx(Text, { children: "Failed to retrieve deployment targets. Please check the developer console log for more information." }) }), $[29] = deploymentTargetListState, $[30] = t15) : t15 = $[30];
1357
- let t16;
1358
- $[31] !== t12 || $[32] !== t13 || $[33] !== t14 || $[34] !== t15 ? (t16 = /* @__PURE__ */ jsxs(Box, { children: [
1359
- t12,
1360
- t13,
1361
- t14,
1362
- t15
1363
- ] }), $[31] = t12, $[32] = t13, $[33] = t14, $[34] = t15, $[35] = t16) : t16 = $[35];
1364
- let t17;
1365
- $[36] !== t11 || $[37] !== t16 || $[38] !== t8 ? (t17 = /* @__PURE__ */ jsxs(Card, { radius: 2, style: t7, children: [
1366
- t8,
1367
- t11,
1368
- t16
1369
- ] }), $[36] = t11, $[37] = t16, $[38] = t8, $[39] = t17) : t17 = $[39];
1370
- let t18;
1371
- $[40] !== dialogState || $[41] !== handleDialogClose || $[42] !== handleTargetCreate ? (t18 = dialogState.matches("create") && /* @__PURE__ */ jsx(DialogForm, { onClose: handleDialogClose, onCreate: handleTargetCreate }), $[40] = dialogState, $[41] = handleDialogClose, $[42] = handleTargetCreate, $[43] = t18) : t18 = $[43];
1372
- let t19;
1373
- $[44] !== dialogState || $[45] !== handleDialogClose || $[46] !== handleTargetDelete || $[47] !== handleTargetUpdate ? (t19 = dialogState.matches("edit") && /* @__PURE__ */ jsx(DialogForm, { deploymentTarget: dialogState.context.editDeploymentTarget, onClose: handleDialogClose, onDelete: handleTargetDelete, onUpdate: handleTargetUpdate }), $[44] = dialogState, $[45] = handleDialogClose, $[46] = handleTargetDelete, $[47] = handleTargetUpdate, $[48] = t19) : t19 = $[48];
1374
- let t20;
1375
- return $[49] !== t17 || $[50] !== t18 || $[51] !== t19 ? (t20 = /* @__PURE__ */ jsx(ToastProvider, { zOffset: Z_INDEX_TOAST_PROVIDER, children: /* @__PURE__ */ jsxs(QueryClientProvider, { client: queryClient, children: [
1376
- t17,
1377
- t18,
1378
- t19
1379
- ] }) }), $[49] = t17, $[50] = t18, $[51] = t19, $[52] = t20) : t20 = $[52], t20;
1187
+ /** @xstate-layout N4IgpgJg5mDOIC5QAoC2BDAxgCwJYDswBKAOlwgBswBiAYQCUBRAQQBVGBtABgF1FQADgHtYuAC64h+fiAAeiAEwKArCQCcANgAcAdmUbNOhVx0BGLQBoQAT0SmAzApJcXXexoAsW5fbWaFAL4BVmhYeISk5FTUjAAiAJKs3HxIIMKiElIy8ghKqpq6+obGZpY2ivb2zq4e5moeXKZc3kEhGDgExCSQ4nQAMgDyAMqcvDLp4pLSqTn2DSQefn7uyq5aWvZWtgjmTqsuvnU6XMoK9q0goR0RJJgATmDoYjS0gyPJ4yKTWTOIc1wLJZqFZrDZbRBaUwkfZuew6SFcepuILBED4IQQOAyK7hYifDJTbKIAC0GnBCFJFxxnUilDA+O+01AOQ8CnJGxIGn29lMpjUxhcCh0VPauNIPTEDMyTLkiA8PhIxh5Cg8DS8pgM5L5UOalSMah0cP05hFYRptweT3pqQm0qJCHlVSVphVashmvKCDUAN17j0XNMqrUyhRASAA */
1188
+ context: { editDeploymentTarget: void 0 },
1189
+ initial: "idle",
1190
+ states: {
1191
+ idle: {
1192
+ entry: assign({ editDeploymentTarget: () => void 0 }),
1193
+ on: {
1194
+ CREATE: { target: "create" },
1195
+ EDIT: {
1196
+ actions: "setEditDeploymentTarget",
1197
+ target: "edit"
1198
+ }
1199
+ }
1200
+ },
1201
+ edit: { on: { CLOSE: { target: "idle" } } },
1202
+ create: { on: { CLOSE: { target: "idle" } } }
1203
+ }
1204
+ }), queryClient = new QueryClient({ defaultOptions: { queries: {
1205
+ gcTime: 0,
1206
+ staleTime: 0
1207
+ } } }), Widget = () => {
1208
+ let $ = c(53), client = useSanityClient(), t0;
1209
+ $[0] === client ? t0 = $[1] : (t0 = { input: { client } }, $[0] = client, $[1] = t0);
1210
+ let [deploymentTargetListState, deploymentTargetListStateTransition] = useMachine(deploymentTargetListMachine, t0), [dialogState, dialogStateTransition] = useMachine(dialogMachine), t1;
1211
+ $[2] === dialogStateTransition ? t1 = $[3] : (t1 = () => {
1212
+ dialogStateTransition({ type: "CLOSE" });
1213
+ }, $[2] = dialogStateTransition, $[3] = t1);
1214
+ let handleDialogClose = t1, t2;
1215
+ $[4] === dialogStateTransition ? t2 = $[5] : (t2 = () => {
1216
+ dialogStateTransition({ type: "CREATE" });
1217
+ }, $[4] = dialogStateTransition, $[5] = t2);
1218
+ let handleDialogShowCreate = t2, t3;
1219
+ $[6] === dialogStateTransition ? t3 = $[7] : (t3 = (deploymentTarget) => {
1220
+ dialogStateTransition({
1221
+ type: "EDIT",
1222
+ deploymentTarget
1223
+ });
1224
+ }, $[6] = dialogStateTransition, $[7] = t3);
1225
+ let handleDialogShowEdit = t3, t4;
1226
+ $[8] === deploymentTargetListStateTransition ? t4 = $[9] : (t4 = (deploymentTarget_0) => {
1227
+ deploymentTargetListStateTransition({
1228
+ type: "CREATE",
1229
+ deploymentTarget: deploymentTarget_0
1230
+ });
1231
+ }, $[8] = deploymentTargetListStateTransition, $[9] = t4);
1232
+ let handleTargetCreate = t4, t5;
1233
+ $[10] === deploymentTargetListStateTransition ? t5 = $[11] : (t5 = (id) => {
1234
+ deploymentTargetListStateTransition({
1235
+ type: "DELETE",
1236
+ id
1237
+ });
1238
+ }, $[10] = deploymentTargetListStateTransition, $[11] = t5);
1239
+ let handleTargetDelete = t5, t6;
1240
+ $[12] === deploymentTargetListStateTransition ? t6 = $[13] : (t6 = (deploymentTarget_1) => {
1241
+ deploymentTargetListStateTransition({
1242
+ type: "UPDATE",
1243
+ deploymentTarget: deploymentTarget_1
1244
+ });
1245
+ }, $[12] = deploymentTargetListStateTransition, $[13] = t6);
1246
+ let handleTargetUpdate = t6, t7;
1247
+ $[14] === Symbol.for("react.memo_cache_sentinel") ? (t7 = { overflow: "hidden " }, $[14] = t7) : t7 = $[14];
1248
+ let t8;
1249
+ $[15] === deploymentTargetListState ? t8 = $[16] : (t8 = /* @__PURE__ */ jsx(StateDebug, {
1250
+ name: "List",
1251
+ state: deploymentTargetListState
1252
+ }), $[15] = deploymentTargetListState, $[16] = t8);
1253
+ let t9;
1254
+ $[17] === Symbol.for("react.memo_cache_sentinel") ? (t9 = /* @__PURE__ */ jsx(Text, {
1255
+ size: 5,
1256
+ weight: "semibold",
1257
+ children: "Vercel deployments"
1258
+ }), $[17] = t9) : t9 = $[17];
1259
+ let t10;
1260
+ $[18] === Symbol.for("react.memo_cache_sentinel") ? (t10 = /* @__PURE__ */ jsx(Box, {
1261
+ padding: 2,
1262
+ children: /* @__PURE__ */ jsx(Text, {
1263
+ muted: !0,
1264
+ size: 1,
1265
+ children: "Create new deployment target"
1266
+ })
1267
+ }), $[18] = t10) : t10 = $[18];
1268
+ let t11;
1269
+ $[19] === handleDialogShowCreate ? t11 = $[20] : (t11 = /* @__PURE__ */ jsxs(Flex, {
1270
+ align: "center",
1271
+ justify: "space-between",
1272
+ paddingX: 3,
1273
+ paddingY: 2,
1274
+ children: [t9, /* @__PURE__ */ jsx(Tooltip, {
1275
+ content: t10,
1276
+ placement: "left",
1277
+ children: /* @__PURE__ */ jsx(Button, {
1278
+ fontSize: 1,
1279
+ icon: AddIcon,
1280
+ onClick: handleDialogShowCreate,
1281
+ mode: "bleed"
1282
+ })
1283
+ })]
1284
+ }), $[19] = handleDialogShowCreate, $[20] = t11);
1285
+ let t12;
1286
+ $[21] === deploymentTargetListState ? t12 = $[22] : (t12 = deploymentTargetListState.matches("pending") && /* @__PURE__ */ jsx(Box, {
1287
+ paddingX: 3,
1288
+ paddingY: 4,
1289
+ children: /* @__PURE__ */ jsx(Text, { children: "Loading..." })
1290
+ }), $[21] = deploymentTargetListState, $[22] = t12);
1291
+ let t13;
1292
+ $[23] !== deploymentTargetListState || $[24] !== handleDialogShowCreate ? (t13 = deploymentTargetListState.matches({ ready: "withoutData" }) && /* @__PURE__ */ jsxs(Flex, {
1293
+ align: "center",
1294
+ gap: 3,
1295
+ paddingX: 3,
1296
+ paddingY: 4,
1297
+ children: [/* @__PURE__ */ jsx(Text, { children: "No deployment targets found." }), /* @__PURE__ */ jsx(Button, {
1298
+ fontSize: 1,
1299
+ mode: "ghost",
1300
+ onClick: handleDialogShowCreate,
1301
+ text: "Create a new target"
1302
+ })]
1303
+ }), $[23] = deploymentTargetListState, $[24] = handleDialogShowCreate, $[25] = t13) : t13 = $[25];
1304
+ let t14;
1305
+ $[26] !== deploymentTargetListState || $[27] !== handleDialogShowEdit ? (t14 = deploymentTargetListState.matches({ ready: "withData" }) && /* @__PURE__ */ jsx(DeploymentTargets, {
1306
+ items: deploymentTargetListState.context.results,
1307
+ onDialogEdit: handleDialogShowEdit
1308
+ }), $[26] = deploymentTargetListState, $[27] = handleDialogShowEdit, $[28] = t14) : t14 = $[28];
1309
+ let t15;
1310
+ $[29] === deploymentTargetListState ? t15 = $[30] : (t15 = deploymentTargetListState.matches("failed") && /* @__PURE__ */ jsx(Box, {
1311
+ paddingX: 3,
1312
+ paddingY: 4,
1313
+ children: /* @__PURE__ */ jsx(Text, { children: "Failed to retrieve deployment targets. Please check the developer console log for more information." })
1314
+ }), $[29] = deploymentTargetListState, $[30] = t15);
1315
+ let t16;
1316
+ $[31] !== t12 || $[32] !== t13 || $[33] !== t14 || $[34] !== t15 ? (t16 = /* @__PURE__ */ jsxs(Box, { children: [
1317
+ t12,
1318
+ t13,
1319
+ t14,
1320
+ t15
1321
+ ] }), $[31] = t12, $[32] = t13, $[33] = t14, $[34] = t15, $[35] = t16) : t16 = $[35];
1322
+ let t17;
1323
+ $[36] !== t11 || $[37] !== t16 || $[38] !== t8 ? (t17 = /* @__PURE__ */ jsxs(Card, {
1324
+ radius: 2,
1325
+ style: t7,
1326
+ children: [
1327
+ t8,
1328
+ t11,
1329
+ t16
1330
+ ]
1331
+ }), $[36] = t11, $[37] = t16, $[38] = t8, $[39] = t17) : t17 = $[39];
1332
+ let t18;
1333
+ $[40] !== dialogState || $[41] !== handleDialogClose || $[42] !== handleTargetCreate ? (t18 = dialogState.matches("create") && /* @__PURE__ */ jsx(DialogForm, {
1334
+ onClose: handleDialogClose,
1335
+ onCreate: handleTargetCreate
1336
+ }), $[40] = dialogState, $[41] = handleDialogClose, $[42] = handleTargetCreate, $[43] = t18) : t18 = $[43];
1337
+ let t19;
1338
+ $[44] !== dialogState || $[45] !== handleDialogClose || $[46] !== handleTargetDelete || $[47] !== handleTargetUpdate ? (t19 = dialogState.matches("edit") && /* @__PURE__ */ jsx(DialogForm, {
1339
+ deploymentTarget: dialogState.context.editDeploymentTarget,
1340
+ onClose: handleDialogClose,
1341
+ onDelete: handleTargetDelete,
1342
+ onUpdate: handleTargetUpdate
1343
+ }), $[44] = dialogState, $[45] = handleDialogClose, $[46] = handleTargetDelete, $[47] = handleTargetUpdate, $[48] = t19) : t19 = $[48];
1344
+ let t20;
1345
+ return $[49] !== t17 || $[50] !== t18 || $[51] !== t19 ? (t20 = /* @__PURE__ */ jsx(ToastProvider, {
1346
+ zOffset: 600002,
1347
+ children: /* @__PURE__ */ jsxs(QueryClientProvider, {
1348
+ client: queryClient,
1349
+ children: [
1350
+ t17,
1351
+ t18,
1352
+ t19
1353
+ ]
1354
+ })
1355
+ }), $[49] = t17, $[50] = t18, $[51] = t19, $[52] = t20) : t20 = $[52], t20;
1380
1356
  };
1381
1357
  function vercelWidget(config = {}) {
1382
- return {
1383
- name: "vercel",
1384
- component: Widget,
1385
- layout: config.layout ?? {
1386
- width: "full"
1387
- }
1388
- };
1358
+ return {
1359
+ name: "vercel",
1360
+ component: Widget,
1361
+ layout: config.layout ?? { width: "full" }
1362
+ };
1389
1363
  }
1390
- export {
1391
- vercelWidget
1392
- };
1393
- //# sourceMappingURL=index.js.map
1364
+ export { vercelWidget };
1365
+
1366
+ //# sourceMappingURL=index.js.map