sanity-plugin-dashboard-widget-vercel 4.0.11 → 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 +1305 -1329
- package/dist/index.js.map +1 -1
- package/package.json +7 -8
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 {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
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 {
|
|
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,1371 +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
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}, WIDGET_NAME = "Vercel (dashboard)"
|
|
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
|
-
|
|
32
|
-
|
|
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
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
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
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
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
|
-
|
|
176
|
-
|
|
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
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
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
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
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
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
state
|
|
303
|
-
} = props;
|
|
304
|
-
return null;
|
|
189
|
+
c(10);
|
|
190
|
+
let { name, state } = props;
|
|
191
|
+
return null;
|
|
305
192
|
}, DeployButton = (props) => {
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
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
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
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
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
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
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
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
|
-
|
|
480
|
+
return t.toUpperCase();
|
|
511
481
|
}
|
|
512
482
|
const PlaceholderAvatar = () => {
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
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
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
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
|
-
|
|
511
|
+
return /* @__PURE__ */ jsx(Text, {
|
|
512
|
+
size: 1,
|
|
513
|
+
children: "\xA0"
|
|
514
|
+
}, index);
|
|
546
515
|
}
|
|
547
516
|
const DeploymentPlaceholder = () => {
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
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
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
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
|
-
|
|
683
|
+
return /* @__PURE__ */ jsx(DeploymentPlaceholder, {}, index);
|
|
684
684
|
}
|
|
685
685
|
function _temp2(deployment) {
|
|
686
|
-
|
|
686
|
+
return /* @__PURE__ */ jsx(Deployment, { deployment }, deployment.uid);
|
|
687
687
|
}
|
|
688
688
|
const DeploymentTarget = (props) => {
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
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
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
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
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
}),
|
|
752
|
-
setDocument: assign({
|
|
753
|
-
document: ({
|
|
754
|
-
event
|
|
755
|
-
}) => event.output
|
|
756
|
-
})
|
|
757
|
-
},
|
|
758
|
-
actors: {
|
|
759
|
-
"create document": fromPromise(({
|
|
760
|
-
input
|
|
761
|
-
}) => input.client.create({
|
|
762
|
-
_id: `vercel.${uuid()}`,
|
|
763
|
-
_type: DEPLOYMENT_TARGET_DOCUMENT_TYPE,
|
|
764
|
-
...input.formData
|
|
765
|
-
})),
|
|
766
|
-
"update document": fromPromise(({
|
|
767
|
-
input
|
|
768
|
-
}) => input.client.patch(input.id).set(input.formData).commit()),
|
|
769
|
-
"delete document": fromPromise(({
|
|
770
|
-
input
|
|
771
|
-
}) => input.client.delete(input.id))
|
|
772
|
-
}
|
|
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
|
+
}
|
|
773
768
|
}).createMachine({
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
}) => ({
|
|
857
|
-
client: context.client,
|
|
858
|
-
id: context.id
|
|
859
|
-
}),
|
|
860
|
-
onDone: {
|
|
861
|
-
target: "deleted"
|
|
862
|
-
},
|
|
863
|
-
onError: {
|
|
864
|
-
actions: "setMessage",
|
|
865
|
-
target: "error"
|
|
866
|
-
}
|
|
867
|
-
}
|
|
868
|
-
},
|
|
869
|
-
deleted: {
|
|
870
|
-
type: "final"
|
|
871
|
-
},
|
|
872
|
-
error: {
|
|
873
|
-
type: "final"
|
|
874
|
-
}
|
|
875
|
-
}
|
|
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
|
+
}
|
|
876
851
|
}), sanitizeFormData = (formData) => Object.keys(formData).reduce((acc, key) => {
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
}, {}), errorIconStyle = {
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
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;
|
|
910
904
|
}, FormFieldInputText = (props) => {
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
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;
|
|
932
927
|
}, formSchema = yup.object().shape({
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
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")
|
|
939
934
|
}), DialogForm = (props) => {
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
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;
|
|
1088
1116
|
}, sortByTargetName = (items) => items.sort((a, b) => a.name > b.name ? 1 : a.name < b.name ? -1 : 0), deploymentTargetListMachine = setup({
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
}) => {
|
|
1108
|
-
assertEvent(event, "UPDATE");
|
|
1109
|
-
const {
|
|
1110
|
-
deploymentTarget
|
|
1111
|
-
} = event, index = context.results.findIndex((target) => target._id === deploymentTarget._id), updatedResults = Object.assign([], context.results, {
|
|
1112
|
-
[index]: deploymentTarget
|
|
1113
|
-
});
|
|
1114
|
-
return sortByTargetName(updatedResults);
|
|
1115
|
-
}
|
|
1116
|
-
})
|
|
1117
|
-
},
|
|
1118
|
-
guards: {
|
|
1119
|
-
hasData: ({
|
|
1120
|
-
context
|
|
1121
|
-
}) => context?.results?.length > 0,
|
|
1122
|
-
hasNoData: ({
|
|
1123
|
-
context
|
|
1124
|
-
}) => context?.results?.length === 0
|
|
1125
|
-
},
|
|
1126
|
-
actors: {
|
|
1127
|
-
"fetch data": fromPromise(({
|
|
1128
|
-
input,
|
|
1129
|
-
signal
|
|
1130
|
-
}) => input.client.fetch("*[_type == $type] | order(name asc)", {
|
|
1131
|
-
type: DEPLOYMENT_TARGET_DOCUMENT_TYPE
|
|
1132
|
-
}, {
|
|
1133
|
-
signal
|
|
1134
|
-
}).catch((error) => {
|
|
1135
|
-
if (error instanceof Error && error.name === "AbortError")
|
|
1136
|
-
return [];
|
|
1137
|
-
throw console.error("Failed to fetch deployment targets", error), error;
|
|
1138
|
-
}))
|
|
1139
|
-
}
|
|
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
|
+
})) }
|
|
1140
1135
|
}).createMachine({
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
states: {
|
|
1186
|
-
unknown: {
|
|
1187
|
-
always: [{
|
|
1188
|
-
target: "withData",
|
|
1189
|
-
guard: "hasData"
|
|
1190
|
-
}, {
|
|
1191
|
-
target: "withoutData",
|
|
1192
|
-
guard: "hasNoData"
|
|
1193
|
-
}]
|
|
1194
|
-
},
|
|
1195
|
-
withData: {
|
|
1196
|
-
always: [{
|
|
1197
|
-
target: "withoutData",
|
|
1198
|
-
guard: "hasNoData"
|
|
1199
|
-
}]
|
|
1200
|
-
},
|
|
1201
|
-
withoutData: {
|
|
1202
|
-
always: [{
|
|
1203
|
-
target: "withData",
|
|
1204
|
-
guard: "hasData"
|
|
1205
|
-
}]
|
|
1206
|
-
}
|
|
1207
|
-
}
|
|
1208
|
-
},
|
|
1209
|
-
failed: {
|
|
1210
|
-
type: "final"
|
|
1211
|
-
}
|
|
1212
|
-
}
|
|
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
|
+
}
|
|
1213
1180
|
}), dialogMachine = setup({
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
setEditDeploymentTarget: assign({
|
|
1220
|
-
editDeploymentTarget: ({
|
|
1221
|
-
event
|
|
1222
|
-
}) => (assertEvent(event, "EDIT"), event.deploymentTarget)
|
|
1223
|
-
})
|
|
1224
|
-
}
|
|
1181
|
+
types: {
|
|
1182
|
+
context: {},
|
|
1183
|
+
events: {}
|
|
1184
|
+
},
|
|
1185
|
+
actions: { setEditDeploymentTarget: assign({ editDeploymentTarget: ({ event }) => (assertEvent(event, "EDIT"), event.deploymentTarget) }) }
|
|
1225
1186
|
}).createMachine({
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
})
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
})
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
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;
|
|
1377
1356
|
};
|
|
1378
1357
|
function vercelWidget(config = {}) {
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
}
|
|
1385
|
-
};
|
|
1358
|
+
return {
|
|
1359
|
+
name: "vercel",
|
|
1360
|
+
component: Widget,
|
|
1361
|
+
layout: config.layout ?? { width: "full" }
|
|
1362
|
+
};
|
|
1386
1363
|
}
|
|
1387
|
-
export {
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
//# sourceMappingURL=index.js.map
|
|
1364
|
+
export { vercelWidget };
|
|
1365
|
+
|
|
1366
|
+
//# sourceMappingURL=index.js.map
|