sanity-plugin-dashboard-widget-vercel 3.1.5 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +8 -36
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1380 -0
- package/dist/index.js.map +1 -0
- package/package.json +42 -85
- package/lib/index.d.mts +0 -6
- package/lib/index.d.ts +0 -6
- package/lib/index.js +0 -1007
- package/lib/index.js.map +0 -1
- package/lib/index.mjs +0 -1005
- package/lib/index.mjs.map +0 -1
- package/sanity.json +0 -8
- package/src/app.tsx +0 -135
- package/src/client.ts +0 -7
- package/src/components/DeployButton/index.tsx +0 -86
- package/src/components/Deployment/index.tsx +0 -126
- package/src/components/DeploymentPlaceholder/index.tsx +0 -41
- package/src/components/DeploymentTarget/index.tsx +0 -51
- package/src/components/DeploymentTargets/index.tsx +0 -24
- package/src/components/Deployments/index.tsx +0 -187
- package/src/components/DialogForm/index.tsx +0 -220
- package/src/components/FormFieldInputLabel/index.tsx +0 -65
- package/src/components/FormFieldInputText/index.tsx +0 -43
- package/src/components/PlaceholderAvatar/index.tsx +0 -20
- package/src/components/PlaceholderText/index.tsx +0 -32
- package/src/components/StateDebug/index.tsx +0 -46
- package/src/components/StatusDot/index.tsx +0 -22
- package/src/components/TableCell/index.tsx +0 -81
- package/src/constants.ts +0 -26
- package/src/hooks/useDeployments.ts +0 -89
- package/src/index.ts +0 -16
- package/src/machines/deploy.ts +0 -117
- package/src/machines/deploymentTargetList.ts +0 -149
- package/src/machines/dialog.ts +0 -62
- package/src/machines/form.ts +0 -155
- package/src/machines/refresh.ts +0 -47
- package/src/types/index.ts +0 -49
- package/src/utils/fetcher.ts +0 -37
- package/src/utils/sanitizeFormData.ts +0 -26
- package/src/utils/useCardColor.ts +0 -5
- package/v2-incompatible.js +0 -11
package/lib/index.js
DELETED
|
@@ -1,1007 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: !0 });
|
|
3
|
-
var jsxRuntime = require("react/jsx-runtime"), icons = require("@sanity/icons"), ui = require("@sanity/ui"), react$1 = require("@xstate/react"), reactQuery = require("@tanstack/react-query"), xstate = require("xstate"), react = require("react"), useDeepCompareEffect = require("use-deep-compare-effect"), hash = require("object-hash"), ReactTimeAgo = require("react-time-ago"), yup$1 = require("@hookform/resolvers/yup"), reactHookForm = require("react-hook-form"), yup = require("yup"), uuid = require("@sanity/uuid"), styledComponents = require("styled-components"), sanity = require("sanity"), TimeAgo = require("javascript-time-ago"), en = require("javascript-time-ago/locale/en");
|
|
4
|
-
function _interopDefaultCompat(e) {
|
|
5
|
-
return e && typeof e == "object" && "default" in e ? e : { default: e };
|
|
6
|
-
}
|
|
7
|
-
function _interopNamespaceCompat(e) {
|
|
8
|
-
if (e && typeof e == "object" && "default" in e) return e;
|
|
9
|
-
var n = /* @__PURE__ */ Object.create(null);
|
|
10
|
-
return e && Object.keys(e).forEach(function(k) {
|
|
11
|
-
if (k !== "default") {
|
|
12
|
-
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
13
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
14
|
-
enumerable: !0,
|
|
15
|
-
get: function() {
|
|
16
|
-
return e[k];
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
}), n.default = e, Object.freeze(n);
|
|
21
|
-
}
|
|
22
|
-
var useDeepCompareEffect__default = /* @__PURE__ */ _interopDefaultCompat(useDeepCompareEffect), hash__default = /* @__PURE__ */ _interopDefaultCompat(hash), ReactTimeAgo__default = /* @__PURE__ */ _interopDefaultCompat(ReactTimeAgo), yup__namespace = /* @__PURE__ */ _interopNamespaceCompat(yup), TimeAgo__default = /* @__PURE__ */ _interopDefaultCompat(TimeAgo), en__default = /* @__PURE__ */ _interopDefaultCompat(en);
|
|
23
|
-
const API_ENDPOINT_DEPLOYMENTS = "https://api.vercel.com/v5/now/deployments", API_ENDPOINT_ALIASES = "https://api.vercel.com/v3/now/aliases", API_VERSION = "1", DEPLOYMENT_TARGET_DOCUMENT_TYPE = "vercel.deploymentTarget", VERCEL_STATUS_COLORS = {
|
|
24
|
-
BUILDING: "#f5a623",
|
|
25
|
-
CANCELED: "#ff0000",
|
|
26
|
-
ERROR: "#ff0000",
|
|
27
|
-
READY: "#50e3c2",
|
|
28
|
-
QUEUED: "#333"
|
|
29
|
-
}, WIDGET_NAME = "Vercel (dashboard)", Z_INDEX_DIALOG = 600001, Z_INDEX_TOAST_PROVIDER = 600002, StateDebug = (props) => null, sortByTargetName = (items) => items.sort((a, b) => a.name > b.name ? 1 : a.name < b.name ? -1 : 0), deploymentTargetListMachine = xstate.setup({
|
|
30
|
-
types: {},
|
|
31
|
-
actions: {
|
|
32
|
-
targetCreate: xstate.assign({
|
|
33
|
-
results: ({ context, event }) => (xstate.assertEvent(event, "CREATE"), sortByTargetName([...context.results, event.deploymentTarget]))
|
|
34
|
-
}),
|
|
35
|
-
targetDelete: xstate.assign({
|
|
36
|
-
results: ({ context, event }) => (xstate.assertEvent(event, "DELETE"), context.results.filter((target) => target._id !== event.id))
|
|
37
|
-
}),
|
|
38
|
-
targetUpdate: xstate.assign({
|
|
39
|
-
results: ({ context, event }) => {
|
|
40
|
-
xstate.assertEvent(event, "UPDATE");
|
|
41
|
-
const { deploymentTarget } = event, index = context.results.findIndex((target) => target._id === deploymentTarget._id), updatedResults = Object.assign([], context.results, {
|
|
42
|
-
[index]: deploymentTarget
|
|
43
|
-
});
|
|
44
|
-
return sortByTargetName(updatedResults);
|
|
45
|
-
}
|
|
46
|
-
})
|
|
47
|
-
},
|
|
48
|
-
guards: {
|
|
49
|
-
hasData: ({ context }) => context?.results?.length > 0,
|
|
50
|
-
hasNoData: ({ context }) => context?.results?.length === 0
|
|
51
|
-
},
|
|
52
|
-
actors: {
|
|
53
|
-
"fetch data": xstate.fromPromise(
|
|
54
|
-
({ input, signal }) => input.client.fetch(
|
|
55
|
-
"*[_type == $type] | order(name asc)",
|
|
56
|
-
{
|
|
57
|
-
type: DEPLOYMENT_TARGET_DOCUMENT_TYPE
|
|
58
|
-
},
|
|
59
|
-
{ signal }
|
|
60
|
-
).catch((error) => {
|
|
61
|
-
if (error instanceof Error && error.name === "AbortError")
|
|
62
|
-
return [];
|
|
63
|
-
throw console.error("Failed to fetch deployment targets", error), error;
|
|
64
|
-
})
|
|
65
|
-
)
|
|
66
|
-
}
|
|
67
|
-
}).createMachine({
|
|
68
|
-
/** @xstate-layout N4IgpgJg5mDOIC5QAoC2BDAxgCwJYDswBKAOgAcx8ICoBiCAe0JIIDcGBrMEgMzABccAEXT90AbQAMAXUSgyDWLn64mckAA9EAZkkBOEgHYAjAA5DAFgBsFgEwnJAVkMAaEAE9Ep4yUeT-klbGesbaoYaGAL6RbmhYeISkFFQ0tGAATukM6eQANqI82ai8AsKiEjLqCkoqakiaOvpGZpY29sZOrh6IxpYkFo5h2oaOpnqOxraSFtGxGDgExCTpYOgQ7rQAwgBKAKIAggAqu1Ky9dXKqvjqWggWHSS9eoaS9ibao6aObp4IVh8kL56OzGII2PT-WYgOILRLLVbrWhCXYAGV2x1OVUUlzqoFu90kRm8tlM2gsL1eJJ+iEGBj0gVsFm0YWmVkctihMISSxWaw2AFUAApCI4nSrnbG1a71fGSUz9WzBezTFWvb7dO5MkjjMITZykwxjTnzbmkXnrEgAV3wHHwDAA7vhaJiJTUrjces9fFZGc9TLYrGqA9SEM9CcT7sznH5HHpjfFFmaEe4rTa7Y7ncYzvJJe6ZZ7DN7fYaA0GrCHvD4xs4S+yPnGYtCTYn4XySPblNgRGJneKc27cQ0EI4BiQ2T77noAzXyxrTIESGFGd4rP9DONTPHYTzk+3OwxLfxu+he9mQBcpR7h6Px4ylWyIrPfl9bIvJhZJIYA-7zFZoo27QgOB1C5RMsQHaU8UQABaYIQ2gv9G1AuFkmofAoHAnFIKHOwQz0bRtUMcd-j8WwpnuLdTVbdZMMvfMEFsPQQxMeViQmZkLC+f0oiQ5s4XNFNrVtB1sIvPMoIQCIK1BIsmXXWxtFJcZKJbAS934Ltylo8ShysfDHl9PRxjlekrC6Z9BhIBk5MkXpzFBFT+N3DsNIPI8tNdLCr20L0Wmscw5V0e5pMJYwBiI8kwrDRC5gTOEeHQXBckgbTB1uZwQw6RwrEBd9bEcQZYzsRDoiAA */
|
|
69
|
-
context: ({ input }) => ({
|
|
70
|
-
client: input.client,
|
|
71
|
-
results: []
|
|
72
|
-
}),
|
|
73
|
-
initial: "pending",
|
|
74
|
-
states: {
|
|
75
|
-
pending: {
|
|
76
|
-
invoke: {
|
|
77
|
-
src: "fetch data",
|
|
78
|
-
id: "fetchData",
|
|
79
|
-
input: ({ context }) => ({ client: context.client }),
|
|
80
|
-
onDone: {
|
|
81
|
-
actions: xstate.assign({ results: ({ event }) => event.output }),
|
|
82
|
-
target: "ready"
|
|
83
|
-
},
|
|
84
|
-
onError: {
|
|
85
|
-
target: "failed"
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
},
|
|
89
|
-
ready: {
|
|
90
|
-
initial: "unknown",
|
|
91
|
-
on: {
|
|
92
|
-
CREATE: {
|
|
93
|
-
actions: "targetCreate"
|
|
94
|
-
},
|
|
95
|
-
DELETE: {
|
|
96
|
-
actions: "targetDelete"
|
|
97
|
-
},
|
|
98
|
-
UPDATE: {
|
|
99
|
-
actions: "targetUpdate"
|
|
100
|
-
}
|
|
101
|
-
},
|
|
102
|
-
states: {
|
|
103
|
-
unknown: {
|
|
104
|
-
always: [
|
|
105
|
-
{ target: "withData", guard: "hasData" },
|
|
106
|
-
{ target: "withoutData", guard: "hasNoData" }
|
|
107
|
-
]
|
|
108
|
-
},
|
|
109
|
-
withData: {
|
|
110
|
-
always: [{ target: "withoutData", guard: "hasNoData" }]
|
|
111
|
-
},
|
|
112
|
-
withoutData: {
|
|
113
|
-
always: [{ target: "withData", guard: "hasData" }]
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
},
|
|
117
|
-
failed: {
|
|
118
|
-
type: "final"
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
}), fetcher = (deploymentTarget) => async (url, extraParams) => {
|
|
122
|
-
const params = new URLSearchParams();
|
|
123
|
-
if (params.set("projectId", deploymentTarget.projectId), deploymentTarget.teamId && params.set("teamId", deploymentTarget.teamId), extraParams)
|
|
124
|
-
for (const [k, v] of extraParams.entries())
|
|
125
|
-
params.append(k, v);
|
|
126
|
-
const response = await fetch(`${url}?${params.toString()}`, {
|
|
127
|
-
headers: {
|
|
128
|
-
Authorization: `Bearer ${deploymentTarget.token}`
|
|
129
|
-
}
|
|
130
|
-
});
|
|
131
|
-
if (!response.ok)
|
|
132
|
-
throw new Error("Response not OK");
|
|
133
|
-
try {
|
|
134
|
-
return response.json();
|
|
135
|
-
} catch (err) {
|
|
136
|
-
throw new Error(err);
|
|
137
|
-
}
|
|
138
|
-
}, useDeployments = (deploymentTarget, options) => {
|
|
139
|
-
const fetchUrl = fetcher(deploymentTarget), deployParams = new URLSearchParams();
|
|
140
|
-
deployParams.set("limit", String(deploymentTarget?.deployLimit));
|
|
141
|
-
const {
|
|
142
|
-
data: deploymentsData,
|
|
143
|
-
isFetching: deploymentsIsFetching,
|
|
144
|
-
isSuccess: deploymentsIsSuccess,
|
|
145
|
-
error: deploymentsError,
|
|
146
|
-
refetch
|
|
147
|
-
} = reactQuery.useQuery({
|
|
148
|
-
queryKey: [hash__default.default(deploymentTarget)],
|
|
149
|
-
queryFn: () => fetchUrl(API_ENDPOINT_DEPLOYMENTS, deployParams),
|
|
150
|
-
enabled: options?.enabled ?? !0,
|
|
151
|
-
refetchInterval: 2e4,
|
|
152
|
-
// ms
|
|
153
|
-
refetchIntervalInBackground: !1,
|
|
154
|
-
refetchOnMount: !0,
|
|
155
|
-
refetchOnReconnect: "always",
|
|
156
|
-
refetchOnWindowFocus: !1,
|
|
157
|
-
retry: !1
|
|
158
|
-
}), aliasParams = new URLSearchParams();
|
|
159
|
-
aliasParams.set("limit", "20");
|
|
160
|
-
const {
|
|
161
|
-
data: aliasesData,
|
|
162
|
-
isFetching: aliasesIsFetching,
|
|
163
|
-
isSuccess: aliasesIsSuccess,
|
|
164
|
-
error: aliasesError
|
|
165
|
-
} = reactQuery.useQuery({
|
|
166
|
-
queryKey: [hash__default.default(deploymentTarget), "aliases"],
|
|
167
|
-
queryFn: () => fetchUrl(API_ENDPOINT_ALIASES, aliasParams),
|
|
168
|
-
enabled: !!deploymentsData,
|
|
169
|
-
refetchOnMount: !1,
|
|
170
|
-
refetchOnReconnect: !1,
|
|
171
|
-
refetchOnWindowFocus: !1,
|
|
172
|
-
retry: !1
|
|
173
|
-
}), aliases = aliasesData?.aliases;
|
|
174
|
-
let deploymentsWithAlias;
|
|
175
|
-
return aliases && (deploymentsWithAlias = deploymentsData?.deployments?.map((val) => {
|
|
176
|
-
const alias = aliases.find((a) => a.deploymentId === val.uid);
|
|
177
|
-
return {
|
|
178
|
-
...val,
|
|
179
|
-
alias: alias?.alias
|
|
180
|
-
};
|
|
181
|
-
})), {
|
|
182
|
-
deployments: deploymentsWithAlias,
|
|
183
|
-
error: aliasesError || deploymentsError,
|
|
184
|
-
isFetching: aliasesIsFetching || deploymentsIsFetching,
|
|
185
|
-
isSuccess: aliasesIsSuccess && deploymentsIsSuccess,
|
|
186
|
-
refetch
|
|
187
|
-
};
|
|
188
|
-
}, refreshMachine = xstate.setup({
|
|
189
|
-
types: {
|
|
190
|
-
events: {}
|
|
191
|
-
}
|
|
192
|
-
}).createMachine({
|
|
193
|
-
/** @xstate-layout N4IgpgJg5mDOIC5QAoC2BDAxgCwJYDswBKAOlwgBswBiAJQFEAxBgZQAkBtABgF1FQADgHtYuAC64h+fiAAeiAIwAmAGwkuGrkoAsAZhVKlAVm0KAHABoQAT0QBOJSRN27XFXaMmz2twF9fVmhYeISkAE5gAGYRsCFQ1PS0tADytNx8SCDCohJSMvIIPnYkxhpKXGZ22kY6xla2CAq6CiQudgDsRnYqKroVfe3+gRg4BMQkEdFwcXRMrGz0ACLpMtniktKZBUUlRmUVVTXadTaISrqObUY97QodvWa6QyBBo6ETUTHYkLPM9OwrTJrXKbUDbJTFLjtMzmWraOx3doqeqKMyOeHdXp3BTHXTVZ6vELjMBhMJCMK-eaAwQidZ5LaIY6Q6Gw47wxHI04IGEkDFma5NbTtY7ufwBED4IQQOAyQljIirWkg-KIAC0nIa6oJIyJpHIVEVOQ2KsKShRCDsunUGLcHi8PhU2uC8o+U1iBCghrpoLkZ2uTk0XCq7SRRl0Zg19itXHhIZ85lMEaUTre40mX0gXuVDIQnmKRhZKk6PmaVXN2PUaLsZhj2hUOJU-JTupIJLJYSzxpzeacheLXFL2nNrkrfW8SKFnhDYt8QA */
|
|
194
|
-
initial: "idle",
|
|
195
|
-
states: {
|
|
196
|
-
idle: {
|
|
197
|
-
on: {
|
|
198
|
-
REFRESH: {
|
|
199
|
-
target: "refreshing"
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
},
|
|
203
|
-
refreshing: {
|
|
204
|
-
on: {
|
|
205
|
-
ERROR: {
|
|
206
|
-
target: "error"
|
|
207
|
-
},
|
|
208
|
-
REFRESHED: {
|
|
209
|
-
target: "refreshed"
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
},
|
|
213
|
-
refreshed: {
|
|
214
|
-
on: {
|
|
215
|
-
REFRESH: {
|
|
216
|
-
target: "refreshing"
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
},
|
|
220
|
-
error: {
|
|
221
|
-
on: {
|
|
222
|
-
REFRESH: {
|
|
223
|
-
target: "refreshing"
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
});
|
|
229
|
-
function useCardColor() {
|
|
230
|
-
return ui.useTheme().sanity.color.card.enabled;
|
|
231
|
-
}
|
|
232
|
-
const TableCell = (props) => {
|
|
233
|
-
const { children, colSpan, header, variant } = props;
|
|
234
|
-
let display = "table-cell", cellWidth = "auto";
|
|
235
|
-
switch (variant) {
|
|
236
|
-
case "age":
|
|
237
|
-
cellWidth = "50px";
|
|
238
|
-
break;
|
|
239
|
-
case "branch":
|
|
240
|
-
cellWidth = "300px", display = ["none", "none", "none", "table-cell"];
|
|
241
|
-
break;
|
|
242
|
-
case "creator":
|
|
243
|
-
cellWidth = "80px";
|
|
244
|
-
break;
|
|
245
|
-
case "state":
|
|
246
|
-
cellWidth = "110px", display = ["none", "none", "none", "none", "table-cell"];
|
|
247
|
-
break;
|
|
248
|
-
}
|
|
249
|
-
const { border } = useCardColor();
|
|
250
|
-
return header ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
251
|
-
ui.Box,
|
|
252
|
-
{
|
|
253
|
-
as: "th",
|
|
254
|
-
colSpan,
|
|
255
|
-
display,
|
|
256
|
-
paddingX: 3,
|
|
257
|
-
paddingY: 2,
|
|
258
|
-
style: {
|
|
259
|
-
maxWidth: cellWidth,
|
|
260
|
-
position: "relative",
|
|
261
|
-
textAlign: "left",
|
|
262
|
-
width: cellWidth
|
|
263
|
-
},
|
|
264
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(ui.Label, { size: 0, children })
|
|
265
|
-
}
|
|
266
|
-
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
267
|
-
ui.Box,
|
|
268
|
-
{
|
|
269
|
-
as: "td",
|
|
270
|
-
colSpan,
|
|
271
|
-
display,
|
|
272
|
-
paddingX: 3,
|
|
273
|
-
paddingY: [2, 2, 3],
|
|
274
|
-
style: {
|
|
275
|
-
borderTop: `1px solid ${border}`,
|
|
276
|
-
maxWidth: cellWidth,
|
|
277
|
-
position: "relative",
|
|
278
|
-
textAlign: "left",
|
|
279
|
-
width: cellWidth
|
|
280
|
-
},
|
|
281
|
-
children
|
|
282
|
-
}
|
|
283
|
-
);
|
|
284
|
-
}, StatusDot = ({ state }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
285
|
-
ui.Box,
|
|
286
|
-
{
|
|
287
|
-
style: {
|
|
288
|
-
backgroundColor: `${VERCEL_STATUS_COLORS[state]}`,
|
|
289
|
-
borderRadius: "20px",
|
|
290
|
-
height: "9px",
|
|
291
|
-
width: "9px"
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
), Deployment = (props) => {
|
|
295
|
-
const { deployment } = props, date = react.useRef(new Date(deployment.created)), commitMessage = deployment?.meta?.githubCommitMessage, commitRef = deployment?.meta?.githubCommitRef, targetUrl = deployment.alias ?? deployment.url;
|
|
296
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
|
|
297
|
-
/* @__PURE__ */ jsxRuntime.jsx(TableCell, { children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { align: "center", children: [
|
|
298
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
299
|
-
ui.Box,
|
|
300
|
-
{
|
|
301
|
-
display: ["block", "block", "block", "block", "none"],
|
|
302
|
-
marginRight: 3,
|
|
303
|
-
style: { flexShrink: 0 },
|
|
304
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(StatusDot, { state: deployment.state })
|
|
305
|
-
}
|
|
306
|
-
),
|
|
307
|
-
targetUrl ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
308
|
-
deployment.alias && /* @__PURE__ */ jsxRuntime.jsx(icons.LinkIcon, {}),
|
|
309
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Box, { marginLeft: deployment.alias ? 1 : 0, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
310
|
-
ui.Text,
|
|
311
|
-
{
|
|
312
|
-
muted: deployment.state !== "READY",
|
|
313
|
-
size: 1,
|
|
314
|
-
style: {
|
|
315
|
-
textDecoration: deployment.state === "CANCELED" || deployment.state === "ERROR" ? "line-through" : "normal"
|
|
316
|
-
},
|
|
317
|
-
textOverflow: "ellipsis",
|
|
318
|
-
children: deployment.state === "READY" ? /* @__PURE__ */ jsxRuntime.jsx("a", { href: `https://${targetUrl}`, rel: "noopener noreferrer", target: "_blank", children: targetUrl }) : targetUrl
|
|
319
|
-
}
|
|
320
|
-
) })
|
|
321
|
-
] }) : /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: 1, children: "Uploading..." })
|
|
322
|
-
] }) }),
|
|
323
|
-
/* @__PURE__ */ jsxRuntime.jsx(TableCell, { variant: "state", children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { align: "center", children: [
|
|
324
|
-
/* @__PURE__ */ jsxRuntime.jsx(StatusDot, { state: deployment.state }),
|
|
325
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Box, { marginLeft: 2, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: 1, children: deployment.state.trim().toLowerCase().replace(/^[a-z]/i, (t) => t.toUpperCase()) }) })
|
|
326
|
-
] }) }),
|
|
327
|
-
/* @__PURE__ */ jsxRuntime.jsx(TableCell, { variant: "branch", children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Stack, { space: 2, children: [
|
|
328
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: 1, textOverflow: "ellipsis", children: commitRef }),
|
|
329
|
-
commitMessage && /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { muted: !0, size: 1, textOverflow: "ellipsis", children: commitMessage })
|
|
330
|
-
] }) }),
|
|
331
|
-
/* @__PURE__ */ jsxRuntime.jsx(TableCell, { variant: "age", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Flex, { align: "center", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: 1, children: /* @__PURE__ */ jsxRuntime.jsx(ReactTimeAgo__default.default, { date: date.current, locale: "en-US", timeStyle: "mini" }) }) }) }),
|
|
332
|
-
/* @__PURE__ */ jsxRuntime.jsx(TableCell, { variant: "creator", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Flex, { align: "center", justify: "center", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
333
|
-
"img",
|
|
334
|
-
{
|
|
335
|
-
draggable: !1,
|
|
336
|
-
src: `https://vercel.com/api/www/avatar/${deployment?.creator?.uid}?&s=48`,
|
|
337
|
-
style: {
|
|
338
|
-
borderRadius: "20px",
|
|
339
|
-
height: "20px",
|
|
340
|
-
width: "20px"
|
|
341
|
-
}
|
|
342
|
-
}
|
|
343
|
-
) }) })
|
|
344
|
-
] });
|
|
345
|
-
}, deployMachine = xstate.setup({
|
|
346
|
-
types: {
|
|
347
|
-
context: {},
|
|
348
|
-
events: {},
|
|
349
|
-
input: {}
|
|
350
|
-
},
|
|
351
|
-
actors: {
|
|
352
|
-
deploy: xstate.fromPromise(async ({ input, signal }) => {
|
|
353
|
-
try {
|
|
354
|
-
if (!input.deployHook)
|
|
355
|
-
throw new Error("No deployHook URL defined");
|
|
356
|
-
const res = await fetch(input.deployHook, { method: "POST", signal }), data = await res.json();
|
|
357
|
-
if (!res.ok)
|
|
358
|
-
throw (data?.error).message || res.statusText;
|
|
359
|
-
} catch (err) {
|
|
360
|
-
throw typeof err == "string" ? err : (console.error("Unable to deploy with error:", err), new Error("Please check the developer console for more information"));
|
|
361
|
-
}
|
|
362
|
-
})
|
|
363
|
-
}
|
|
364
|
-
}).createMachine({
|
|
365
|
-
/** @xstate-layout N4IgpgJg5mDOIC5QTABwDYHsCeA6AlhOmAMQAiAogAoAyA8gJoDaADALqKiqaz4Au+TADtOIAB6IATCxa4AnADYAHAHYArArUslAZjksNAGhDZEARk3yVmhSxVyHC-QBYAvq+MoMOXF6zZ8ISgSCGEwAiEAN0wAa3C-HwSAoIRA6IBjAEMBYVY2PNFuXhyRJHFENTMzXElFJSUzNTVnWx0FY1MESXVcZzUdM2k1OTUVBoV3TzR-X2mcQOCwACclzCXcDGyAMzWAW1nvPCSF1KjMLJK8grKi-kFS0AkESura5QamlpY2jvMB+QcDkqLH0wxYEw8ICSuFgAFd0uk4LByNR6Mx2IUeHdhKIns1ZN9BtYQVpRnJfl1JM55P1BnY1Ep9CpGpMoXM8MtVksUbRGNcuFiSriKs4CQNurYRgZ7BSGr1ASNupIzEo+kp3JChJgUPAyklMcV7sKEABadomRAmtQAhW2wE6VnQwjEA3Yh7lBDOSQUsxeqyaPoWYbWFSO9kHfwLV1CspPHSSHQ1ZyA1UKJzJlQ+iz+5oKewKWrfNyQ6FwhFI6NG2OINOSXDiypKAxtMyZi1dEE1Qk6L0FpTSUMl8OctaVnHVhC1+uDRvNhStin6XDaHQ9liSXTJiUa1xAA */
|
|
366
|
-
id: "deploy",
|
|
367
|
-
initial: "idle",
|
|
368
|
-
context: ({ input }) => ({
|
|
369
|
-
disabled: !1,
|
|
370
|
-
feedback: void 0,
|
|
371
|
-
label: void 0,
|
|
372
|
-
error: void 0,
|
|
373
|
-
deployHook: input.deployHook
|
|
374
|
-
}),
|
|
375
|
-
states: {
|
|
376
|
-
idle: {
|
|
377
|
-
entry: xstate.assign({
|
|
378
|
-
feedback: () => {
|
|
379
|
-
},
|
|
380
|
-
label: () => "Deploy"
|
|
381
|
-
}),
|
|
382
|
-
on: {
|
|
383
|
-
DEPLOY: {
|
|
384
|
-
target: "deploying"
|
|
385
|
-
}
|
|
386
|
-
}
|
|
387
|
-
},
|
|
388
|
-
deploying: {
|
|
389
|
-
entry: xstate.assign({
|
|
390
|
-
disabled: () => !0,
|
|
391
|
-
label: () => "Deploying"
|
|
392
|
-
}),
|
|
393
|
-
exit: xstate.assign({
|
|
394
|
-
disabled: () => !1,
|
|
395
|
-
label: () => "Deploy"
|
|
396
|
-
}),
|
|
397
|
-
invoke: {
|
|
398
|
-
src: "deploy",
|
|
399
|
-
input: ({ context }) => ({ deployHook: context.deployHook }),
|
|
400
|
-
onDone: {
|
|
401
|
-
target: "success"
|
|
402
|
-
},
|
|
403
|
-
onError: {
|
|
404
|
-
target: "error",
|
|
405
|
-
actions: xstate.assign({
|
|
406
|
-
error: ({ event }) => "error" in event ? event.error : "Unknown error"
|
|
407
|
-
})
|
|
408
|
-
}
|
|
409
|
-
}
|
|
410
|
-
},
|
|
411
|
-
success: {
|
|
412
|
-
entry: xstate.assign({
|
|
413
|
-
feedback: () => "Successfully started!"
|
|
414
|
-
}),
|
|
415
|
-
exit: xstate.assign({
|
|
416
|
-
feedback: () => {
|
|
417
|
-
}
|
|
418
|
-
}),
|
|
419
|
-
on: {
|
|
420
|
-
DEPLOY: {
|
|
421
|
-
target: "deploying"
|
|
422
|
-
}
|
|
423
|
-
}
|
|
424
|
-
},
|
|
425
|
-
error: {
|
|
426
|
-
on: {
|
|
427
|
-
DEPLOY: {
|
|
428
|
-
target: "deploying"
|
|
429
|
-
}
|
|
430
|
-
}
|
|
431
|
-
}
|
|
432
|
-
}
|
|
433
|
-
}), DeployButton = (props) => {
|
|
434
|
-
const { deployHook, onDeploySuccess, targetName } = props, [deployState, deployStateTransition, deployStateInterpreter] = react$1.useMachine(deployMachine, {
|
|
435
|
-
input: { deployHook }
|
|
436
|
-
}), toast = ui.useToast(), isError = deployState.matches("error"), isSuccess = deployState.matches("success"), handleDeploy = () => {
|
|
437
|
-
deployStateTransition({ type: "DEPLOY" });
|
|
438
|
-
};
|
|
439
|
-
return react.useEffect(() => {
|
|
440
|
-
isError && toast.push({
|
|
441
|
-
closable: !0,
|
|
442
|
-
description: `Unable to queue deploy for ${targetName}: ${deployState.context.error}`,
|
|
443
|
-
duration: 8e3,
|
|
444
|
-
status: "error",
|
|
445
|
-
title: WIDGET_NAME
|
|
446
|
-
}), isSuccess && toast.push({
|
|
447
|
-
closable: !0,
|
|
448
|
-
description: `Deploy queued for ${targetName}`,
|
|
449
|
-
duration: 8e3,
|
|
450
|
-
status: "success",
|
|
451
|
-
title: WIDGET_NAME
|
|
452
|
-
});
|
|
453
|
-
}, [isError, isSuccess, toast, targetName, deployState.context.error]), react.useEffect(() => {
|
|
454
|
-
const subscription = deployStateInterpreter.subscribe((state) => {
|
|
455
|
-
state.value === "success" && onDeploySuccess && onDeploySuccess();
|
|
456
|
-
});
|
|
457
|
-
return () => subscription.unsubscribe();
|
|
458
|
-
}, [deployStateInterpreter, onDeploySuccess]), /* @__PURE__ */ jsxRuntime.jsxs(ui.Box, { padding: 3, style: { position: "relative" }, children: [
|
|
459
|
-
/* @__PURE__ */ jsxRuntime.jsx(StateDebug, { name: "Deploy", state: deployState }),
|
|
460
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
461
|
-
ui.Button,
|
|
462
|
-
{
|
|
463
|
-
disabled: deployState.context.disabled,
|
|
464
|
-
fontSize: 1,
|
|
465
|
-
icon: icons.UploadIcon,
|
|
466
|
-
mode: "ghost",
|
|
467
|
-
onClick: handleDeploy,
|
|
468
|
-
padding: 3,
|
|
469
|
-
text: `${deployState.context.label} ${targetName}`,
|
|
470
|
-
tone: "default"
|
|
471
|
-
}
|
|
472
|
-
)
|
|
473
|
-
] });
|
|
474
|
-
}, PlaceholderAvatar = () => {
|
|
475
|
-
const { border } = useCardColor();
|
|
476
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
477
|
-
ui.Box,
|
|
478
|
-
{
|
|
479
|
-
style: {
|
|
480
|
-
backgroundColor: border,
|
|
481
|
-
borderRadius: "20px",
|
|
482
|
-
height: "20px",
|
|
483
|
-
userSelect: "none",
|
|
484
|
-
width: "20px"
|
|
485
|
-
}
|
|
486
|
-
}
|
|
487
|
-
);
|
|
488
|
-
}, PlaceholderText = (props) => {
|
|
489
|
-
const { rows } = props, { border } = useCardColor();
|
|
490
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
491
|
-
ui.Box,
|
|
492
|
-
{
|
|
493
|
-
style: {
|
|
494
|
-
backgroundColor: border,
|
|
495
|
-
borderRadius: "3px",
|
|
496
|
-
userSelect: "none",
|
|
497
|
-
width: "100%"
|
|
498
|
-
},
|
|
499
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(ui.Stack, { space: 2, children: new Array(rows).fill(void 0).map((_, index) => /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: 1, children: "\xA0" }, index)) })
|
|
500
|
-
}
|
|
501
|
-
);
|
|
502
|
-
}, DeploymentPlaceholder = () => /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
|
|
503
|
-
/* @__PURE__ */ jsxRuntime.jsx(TableCell, { children: /* @__PURE__ */ jsxRuntime.jsx(PlaceholderText, { rows: 1 }) }),
|
|
504
|
-
/* @__PURE__ */ jsxRuntime.jsx(TableCell, { variant: "state", children: /* @__PURE__ */ jsxRuntime.jsx(PlaceholderText, { rows: 1 }) }),
|
|
505
|
-
/* @__PURE__ */ jsxRuntime.jsx(TableCell, { variant: "branch", children: /* @__PURE__ */ jsxRuntime.jsx(PlaceholderText, { rows: 2 }) }),
|
|
506
|
-
/* @__PURE__ */ jsxRuntime.jsx(TableCell, { variant: "age", children: /* @__PURE__ */ jsxRuntime.jsx(PlaceholderText, { rows: 1 }) }),
|
|
507
|
-
/* @__PURE__ */ jsxRuntime.jsx(TableCell, { variant: "creator", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Flex, { justify: "center", children: /* @__PURE__ */ jsxRuntime.jsx(PlaceholderAvatar, {}) }) })
|
|
508
|
-
] }), Deployments = (props) => {
|
|
509
|
-
const { deploymentTarget } = props, refTimeout = react.useRef(null), [refreshState, refreshStateTransition] = react$1.useMachine(refreshMachine), { deployments, error, isFetching, isSuccess, refetch } = useDeployments(deploymentTarget, {
|
|
510
|
-
enabled: !refreshState.matches("error")
|
|
511
|
-
}), toast = ui.useToast(), isError = refreshState.matches("error"), handleDeploySuccess = () => {
|
|
512
|
-
refTimeout.current && clearTimeout(refTimeout.current), refTimeout.current = setTimeout(() => {
|
|
513
|
-
refetch({
|
|
514
|
-
cancelRefetch: !0,
|
|
515
|
-
throwOnError: !0
|
|
516
|
-
});
|
|
517
|
-
}, 4e3);
|
|
518
|
-
};
|
|
519
|
-
react.useEffect(() => () => {
|
|
520
|
-
refTimeout.current && clearTimeout(refTimeout.current);
|
|
521
|
-
}, []), react.useEffect(() => {
|
|
522
|
-
error && refreshStateTransition({ type: "ERROR" }), isFetching && refreshStateTransition({ type: "REFRESH" }), !isFetching && isSuccess && refreshStateTransition({ type: "REFRESHED" });
|
|
523
|
-
}, [error, isFetching, isSuccess, refreshStateTransition]), useDeepCompareEffect__default.default(() => {
|
|
524
|
-
refreshState.matches("refreshing") || refreshStateTransition({ type: "REFRESH" });
|
|
525
|
-
}, [deploymentTarget]), useDeepCompareEffect__default.default(() => {
|
|
526
|
-
isError && toast.push({
|
|
527
|
-
closable: !0,
|
|
528
|
-
description: `Unable to fetch deployments for ${deploymentTarget.name}`,
|
|
529
|
-
duration: 8e3,
|
|
530
|
-
status: "error",
|
|
531
|
-
title: WIDGET_NAME
|
|
532
|
-
});
|
|
533
|
-
}, [deploymentTarget, isError]);
|
|
534
|
-
const hasFetched = typeof deployments < "u", hasDeployments = deployments && deployments.length > 0, { border } = useCardColor();
|
|
535
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(ui.Box, { marginTop: 3, style: { position: "relative" }, children: [
|
|
536
|
-
/* @__PURE__ */ jsxRuntime.jsx(StateDebug, { name: "Refresh", state: refreshState }),
|
|
537
|
-
!refreshState.matches("error") && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
538
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
539
|
-
ui.Box,
|
|
540
|
-
{
|
|
541
|
-
as: "table",
|
|
542
|
-
style: {
|
|
543
|
-
borderBottom: `1px solid ${border}`,
|
|
544
|
-
borderCollapse: "collapse",
|
|
545
|
-
display: "table",
|
|
546
|
-
tableLayout: "fixed",
|
|
547
|
-
width: "100%"
|
|
548
|
-
},
|
|
549
|
-
children: [
|
|
550
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Box, { as: "thead", style: { display: "table-header-group" }, children: /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
|
|
551
|
-
/* @__PURE__ */ jsxRuntime.jsx(TableCell, { header: !0, children: "Deployment" }),
|
|
552
|
-
/* @__PURE__ */ jsxRuntime.jsx(TableCell, { header: !0, variant: "state", children: "State" }),
|
|
553
|
-
/* @__PURE__ */ jsxRuntime.jsx(TableCell, { header: !0, variant: "branch", children: "Branch" }),
|
|
554
|
-
/* @__PURE__ */ jsxRuntime.jsx(TableCell, { header: !0, variant: "age", children: "Age" }),
|
|
555
|
-
/* @__PURE__ */ jsxRuntime.jsx(TableCell, { header: !0, variant: "age", children: "Creator" })
|
|
556
|
-
] }) }),
|
|
557
|
-
/* @__PURE__ */ jsxRuntime.jsxs(ui.Box, { as: "tbody", style: { display: "table-header-group" }, children: [
|
|
558
|
-
!deployments && new Array(deploymentTarget?.deployLimit).fill(void 0).map((_, index) => /* @__PURE__ */ jsxRuntime.jsx(DeploymentPlaceholder, {}, index)),
|
|
559
|
-
hasDeployments && deployments?.map((deployment) => /* @__PURE__ */ jsxRuntime.jsx(Deployment, { deployment }, deployment.uid))
|
|
560
|
-
] })
|
|
561
|
-
]
|
|
562
|
-
}
|
|
563
|
-
),
|
|
564
|
-
hasFetched && !hasDeployments && /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { padding: 3, style: { width: "100%" }, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { muted: !0, size: 1, children: "No deployments found. Don't forget to specify a valid team ID if your project belongs to a team." }) })
|
|
565
|
-
] }),
|
|
566
|
-
refreshState.matches("error") && /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { padding: 3, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { muted: !0, size: 1, children: "Unable to fetch recent deployments. Please check your network and deployment settings." }) }),
|
|
567
|
-
!refreshState.matches("error") && deploymentTarget.deployHook && /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
568
|
-
DeployButton,
|
|
569
|
-
{
|
|
570
|
-
deployHook: deploymentTarget.deployHook,
|
|
571
|
-
onDeploySuccess: handleDeploySuccess,
|
|
572
|
-
targetName: deploymentTarget.name
|
|
573
|
-
}
|
|
574
|
-
) })
|
|
575
|
-
] });
|
|
576
|
-
}, DeploymentTarget = (props) => {
|
|
577
|
-
const { item, onDialogEdit } = props, deploymentTarget = {
|
|
578
|
-
deployHook: item.deployHook,
|
|
579
|
-
deployLimit: item.deployLimit,
|
|
580
|
-
name: item.name,
|
|
581
|
-
projectId: item.projectId,
|
|
582
|
-
teamId: item.teamId,
|
|
583
|
-
token: item.token
|
|
584
|
-
};
|
|
585
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(ui.Box, { style: { position: "relative" }, children: [
|
|
586
|
-
/* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { align: "center", justify: "space-between", marginTop: 2, paddingX: 3, children: [
|
|
587
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: 2, children: item.name }),
|
|
588
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
589
|
-
ui.Tooltip,
|
|
590
|
-
{
|
|
591
|
-
content: /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { padding: 2, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { muted: !0, size: 1, children: "Edit deployment target" }) }),
|
|
592
|
-
placement: "left",
|
|
593
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { fontSize: 1, icon: icons.EditIcon, mode: "bleed", onClick: () => onDialogEdit(item) })
|
|
594
|
-
}
|
|
595
|
-
)
|
|
596
|
-
] }),
|
|
597
|
-
/* @__PURE__ */ jsxRuntime.jsx(Deployments, { deploymentTarget })
|
|
598
|
-
] });
|
|
599
|
-
}, DeploymentTargets = (props) => {
|
|
600
|
-
const { items, onDialogEdit } = props;
|
|
601
|
-
return /* @__PURE__ */ jsxRuntime.jsx(ui.Stack, { space: 5, children: items?.map((item) => /* @__PURE__ */ jsxRuntime.jsx(DeploymentTarget, { item, onDialogEdit }, item._id)) });
|
|
602
|
-
}, formMachine = xstate.setup({
|
|
603
|
-
types: {},
|
|
604
|
-
actions: {
|
|
605
|
-
setId: xstate.assign({
|
|
606
|
-
id: ({ event }) => (xstate.assertEvent(event, ["UPDATE", "DELETE"]), event.id)
|
|
607
|
-
}),
|
|
608
|
-
setFormData: xstate.assign({
|
|
609
|
-
formData: ({ event }) => (xstate.assertEvent(event, ["CREATE", "UPDATE"]), event.formData)
|
|
610
|
-
}),
|
|
611
|
-
setMessage: xstate.assign({
|
|
612
|
-
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"
|
|
613
|
-
}),
|
|
614
|
-
setDocument: xstate.assign({
|
|
615
|
-
document: ({ event }) => event.output
|
|
616
|
-
})
|
|
617
|
-
},
|
|
618
|
-
actors: {
|
|
619
|
-
"create document": xstate.fromPromise(
|
|
620
|
-
({ input }) => input.client.create({
|
|
621
|
-
_id: `vercel.${uuid.uuid()}`,
|
|
622
|
-
_type: DEPLOYMENT_TARGET_DOCUMENT_TYPE,
|
|
623
|
-
...input.formData
|
|
624
|
-
})
|
|
625
|
-
),
|
|
626
|
-
"update document": xstate.fromPromise(
|
|
627
|
-
({ input }) => input.client.patch(input.id).set(input.formData).commit()
|
|
628
|
-
),
|
|
629
|
-
"delete document": xstate.fromPromise(({ input }) => input.client.delete(input.id))
|
|
630
|
-
}
|
|
631
|
-
}).createMachine({
|
|
632
|
-
/** @xstate-layout N4IgpgJg5mDOIC5QAoC2BDAxgCwJYDswBKAOlwgBswBiAYQCUBRAQQBVGBtABgF1FQADgHtYuAC64h+fiAAeiAIwBmAGwkuGjQFYALAE4AHACYdWgwYA0IAJ6IjKgOwkdXFUYVa9h-Ua5KAvv5WaFh4hKTkVNQAqgAKACJsnLwywqISUjLyCMpqmtr6xqbmVrYIBgokWvlGWkpaCgZeKoHBGDgExGSUNPGMADKM7Nx8SCBp4pLSY9m56vm6hiZmljaIOipqdXpcDk1aWiYqBlqtICEd4SSYAE5g6BL4UNQQUmBk+ABuQgDW77f3MRgeJCTAAV1QYHwYmYmDEQhuI1SIkmmRmiGOShIDiUOh0SiaCgUegcDj0pTsjhI5iMewUpPsTSMZwuYS6AIeBGeYBuNwRJAEFAeADMEahrncHsDQRCoTC4QikWMJhlpqBspjsbj8YTiaTyWsEKouNT6noiX5zUpiQEgud2mzSGCBBBOU8Xm8Pt8-iRna6gSDwZDobD4YiUsqUaqshiDFicXiCea9WSKeVKiSVIclEYlIY-BUWQ7Ok6XW7ubz+YKRWLfWWAzLg-Kw0rBFGpjGEJqEzrkyTU4b6ToSHojHos7VXEc6kXQiWSBAwFRHs9XoQvb93ovl9Kg3LQ4qI230h30V241rE7r+wayro1A4dO4VHotA5fPTTnbWfPt2AV9QPJ8jcApCmIoo3OKf4NnuIYKuGozHqiapyLG8bakmRI3mmpjxk0XAuEoXAHI+DgtGc+BCIu8BjD+4TIieaLqogAC0Khpmxs6XF0kRgAxyGdk+aYKLSVR7Fweg6A4IkGFwChcY6EqAly-HRmeY7DnSY5GHGL4qFwRhpjpJpmriDjVMRLgGAp84ckCECqaezEIHoObUuZuwKH4xGPgoRnmCQpmOAcqhmPJ37Flcfrlo5TGoQgY4mgYHkeAS+iqH5hqSc4dSuCo+I6SoSjvjZUX1pAsUodkrlGO51TSd5b46JlZRebVuG7IcjRmA05FtHOVzQSpkaMVVdivs4CibHGxg6biSg4ZsJD2AccaFEVGwOKVXTQRVI0CWeNV1Z5jW+WmujDj4HjmMRnhEttpBAQilWdkdyX1V5RFNS1iAEpU1pHER9JWjogSBEAA */
|
|
633
|
-
context: ({ input }) => ({
|
|
634
|
-
client: input.client,
|
|
635
|
-
formData: {},
|
|
636
|
-
message: ""
|
|
637
|
-
}),
|
|
638
|
-
initial: "idle",
|
|
639
|
-
states: {
|
|
640
|
-
idle: {
|
|
641
|
-
on: {
|
|
642
|
-
CREATE: {
|
|
643
|
-
actions: ["setFormData"],
|
|
644
|
-
target: "creating"
|
|
645
|
-
},
|
|
646
|
-
UPDATE: {
|
|
647
|
-
actions: ["setId", "setFormData"],
|
|
648
|
-
target: "updating"
|
|
649
|
-
},
|
|
650
|
-
DELETE: {
|
|
651
|
-
actions: "setId",
|
|
652
|
-
target: "deleting"
|
|
653
|
-
}
|
|
654
|
-
}
|
|
655
|
-
},
|
|
656
|
-
creating: {
|
|
657
|
-
tags: ["busy"],
|
|
658
|
-
invoke: {
|
|
659
|
-
src: "create document",
|
|
660
|
-
id: "createDocumentActor",
|
|
661
|
-
input: ({ context }) => ({ client: context.client, formData: context.formData }),
|
|
662
|
-
onDone: { actions: "setDocument", target: "created" },
|
|
663
|
-
onError: { actions: "setMessage", target: "error" }
|
|
664
|
-
}
|
|
665
|
-
},
|
|
666
|
-
created: { type: "final" },
|
|
667
|
-
updating: {
|
|
668
|
-
tags: ["busy"],
|
|
669
|
-
invoke: {
|
|
670
|
-
src: "update document",
|
|
671
|
-
id: "updateDocumentActor",
|
|
672
|
-
input: ({ context }) => ({
|
|
673
|
-
client: context.client,
|
|
674
|
-
id: context.id,
|
|
675
|
-
formData: context.formData
|
|
676
|
-
}),
|
|
677
|
-
onDone: { actions: "setDocument", target: "updated" },
|
|
678
|
-
onError: { actions: "setMessage", target: "error" }
|
|
679
|
-
}
|
|
680
|
-
},
|
|
681
|
-
updated: { type: "final" },
|
|
682
|
-
deleting: {
|
|
683
|
-
tags: ["busy"],
|
|
684
|
-
invoke: {
|
|
685
|
-
src: "delete document",
|
|
686
|
-
id: "deleteDocumentActor",
|
|
687
|
-
input: ({ context }) => ({ client: context.client, id: context.id }),
|
|
688
|
-
onDone: { target: "deleted" },
|
|
689
|
-
onError: { actions: "setMessage", target: "error" }
|
|
690
|
-
}
|
|
691
|
-
},
|
|
692
|
-
deleted: { type: "final" },
|
|
693
|
-
error: { type: "final" }
|
|
694
|
-
}
|
|
695
|
-
}), sanitizeFormData = (formData) => Object.keys(formData).reduce((acc, key) => {
|
|
696
|
-
const val = formData[key];
|
|
697
|
-
return typeof val == "object" && val !== null && val.constructor !== Array ? acc[key] = sanitizeFormData(val) : val === "" || typeof val > "u" || val?.length === 0 ? acc[key] = null : typeof val == "string" && val ? acc[key] = formData[key].trim() : acc[key] = formData[key], acc;
|
|
698
|
-
}, {}), StyledErrorOutlineIcon = styledComponents.styled(icons.ErrorOutlineIcon)(({ theme }) => ({
|
|
699
|
-
color: theme.sanity.color.spot.red
|
|
700
|
-
})), FormFieldInputLabel = (props) => {
|
|
701
|
-
const { description, error, label, name } = props;
|
|
702
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(ui.Box, { marginBottom: 3, children: [
|
|
703
|
-
/* @__PURE__ */ jsxRuntime.jsxs(ui.Inline, { space: 2, children: [
|
|
704
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { as: "label", htmlFor: name, size: 1, weight: "semibold", children: label }),
|
|
705
|
-
error && /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: 1, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
706
|
-
ui.Tooltip,
|
|
707
|
-
{
|
|
708
|
-
content: /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { padding: 2, children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Text, { muted: !0, size: 1, children: [
|
|
709
|
-
/* @__PURE__ */ jsxRuntime.jsx(StyledErrorOutlineIcon, { style: { marginRight: "0.1em" } }),
|
|
710
|
-
error.message
|
|
711
|
-
] }) }),
|
|
712
|
-
fallbackPlacements: ["top", "left"],
|
|
713
|
-
placement: "right",
|
|
714
|
-
portal: !0,
|
|
715
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(StyledErrorOutlineIcon, {})
|
|
716
|
-
}
|
|
717
|
-
) })
|
|
718
|
-
] }),
|
|
719
|
-
description && /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { marginY: 3, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { htmlFor: name, muted: !0, size: 1, children: description }) })
|
|
720
|
-
] });
|
|
721
|
-
}, FormFieldInputText = react.forwardRef((props, ref) => {
|
|
722
|
-
const { description, disabled, error, label, name, placeholder, value, onChange, onBlur } = props;
|
|
723
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(ui.Box, { children: [
|
|
724
|
-
/* @__PURE__ */ jsxRuntime.jsx(FormFieldInputLabel, { description, error, label, name }),
|
|
725
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
726
|
-
ui.TextInput,
|
|
727
|
-
{
|
|
728
|
-
autoComplete: "off",
|
|
729
|
-
autoFocus: !0,
|
|
730
|
-
defaultValue: value,
|
|
731
|
-
disabled,
|
|
732
|
-
id: name,
|
|
733
|
-
name,
|
|
734
|
-
placeholder,
|
|
735
|
-
onChange,
|
|
736
|
-
onBlur,
|
|
737
|
-
ref
|
|
738
|
-
}
|
|
739
|
-
)
|
|
740
|
-
] });
|
|
741
|
-
});
|
|
742
|
-
function useSanityClient() {
|
|
743
|
-
return sanity.useClient({ apiVersion: API_VERSION });
|
|
744
|
-
}
|
|
745
|
-
const formSchema = yup__namespace.object().shape({
|
|
746
|
-
deployHook: yup__namespace.string().url("Deploy hook must be a valid URL"),
|
|
747
|
-
deployLimit: yup__namespace.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"),
|
|
748
|
-
name: yup__namespace.string().required("Name cannot be empty"),
|
|
749
|
-
projectId: yup__namespace.string().required("Vercel Project ID cannot be empty"),
|
|
750
|
-
teamId: yup__namespace.string(),
|
|
751
|
-
token: yup__namespace.string().required("Vercel Account Token cannot be empty")
|
|
752
|
-
}), DialogForm = (props) => {
|
|
753
|
-
const { deploymentTarget, onClose, onCreate, onDelete, onUpdate } = props, client = useSanityClient(), toast = ui.useToast(), [formState, formStateTransition, formStateActorRef] = react$1.useActor(formMachine, {
|
|
754
|
-
input: { client }
|
|
755
|
-
}), formUpdating = formState.hasTag("busy"), {
|
|
756
|
-
formState: { errors, isDirty, isValid },
|
|
757
|
-
handleSubmit,
|
|
758
|
-
register
|
|
759
|
-
} = reactHookForm.useForm({
|
|
760
|
-
// @ts-expect-error - fix typings later
|
|
761
|
-
defaultValues: {
|
|
762
|
-
deployHook: deploymentTarget?.deployHook || "",
|
|
763
|
-
deployLimit: deploymentTarget?.deployLimit || 5,
|
|
764
|
-
name: deploymentTarget?.name || "",
|
|
765
|
-
projectId: deploymentTarget?.projectId || "",
|
|
766
|
-
teamId: deploymentTarget?.teamId || "",
|
|
767
|
-
token: deploymentTarget?.token || ""
|
|
768
|
-
},
|
|
769
|
-
mode: "onChange",
|
|
770
|
-
resolver: yup$1.yupResolver(formSchema)
|
|
771
|
-
});
|
|
772
|
-
react.useEffect(() => {
|
|
773
|
-
formState.matches("error") && toast.push({
|
|
774
|
-
status: "error",
|
|
775
|
-
title: formState.context.message || "An error occurred"
|
|
776
|
-
}), formState.status === "done" && onClose();
|
|
777
|
-
}, [formState, onClose, toast]);
|
|
778
|
-
const onSubmit = async (formData) => {
|
|
779
|
-
const sanitizedFormData = sanitizeFormData(formData);
|
|
780
|
-
formStateTransition(deploymentTarget ? { type: "UPDATE", id: deploymentTarget._id, formData: sanitizedFormData } : { type: "CREATE", formData: sanitizedFormData }), await xstate.toPromise(formStateActorRef);
|
|
781
|
-
const snapshot = formStateActorRef.getSnapshot(), { document } = snapshot.context;
|
|
782
|
-
document && (snapshot.matches("created") ? onCreate?.(document) : snapshot.matches("updated") && onUpdate?.(document));
|
|
783
|
-
}, handleDelete = async () => {
|
|
784
|
-
const id = deploymentTarget._id;
|
|
785
|
-
formStateTransition({ type: "DELETE", id }), await xstate.toPromise(formStateActorRef), formStateActorRef.getSnapshot().matches("deleted") && onDelete?.(id);
|
|
786
|
-
};
|
|
787
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
788
|
-
ui.Dialog,
|
|
789
|
-
{
|
|
790
|
-
footer: /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { padding: 3, children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { justify: deploymentTarget ? "space-between" : "flex-end", children: [
|
|
791
|
-
deploymentTarget && /* @__PURE__ */ jsxRuntime.jsx(
|
|
792
|
-
ui.Button,
|
|
793
|
-
{
|
|
794
|
-
loading: formState.matches("deleting"),
|
|
795
|
-
disabled: formUpdating,
|
|
796
|
-
fontSize: 1,
|
|
797
|
-
mode: "bleed",
|
|
798
|
-
onClick: handleDelete,
|
|
799
|
-
text: "Delete",
|
|
800
|
-
tone: "critical"
|
|
801
|
-
}
|
|
802
|
-
),
|
|
803
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
804
|
-
ui.Button,
|
|
805
|
-
{
|
|
806
|
-
loading: formState.matches("creating") || formState.matches("updating"),
|
|
807
|
-
disabled: !isDirty || !isValid,
|
|
808
|
-
fontSize: 1,
|
|
809
|
-
onClick: handleSubmit(onSubmit),
|
|
810
|
-
text: deploymentTarget ? "Update and close" : "Create",
|
|
811
|
-
tone: "primary"
|
|
812
|
-
}
|
|
813
|
-
)
|
|
814
|
-
] }) }),
|
|
815
|
-
header: `${deploymentTarget ? "Edit" : "Create"} deployment target`,
|
|
816
|
-
id: "create",
|
|
817
|
-
onClose,
|
|
818
|
-
width: 1,
|
|
819
|
-
zOffset: Z_INDEX_DIALOG,
|
|
820
|
-
children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Box, { as: "form", padding: 4, onSubmit: handleSubmit(onSubmit), children: [
|
|
821
|
-
/* @__PURE__ */ jsxRuntime.jsx("button", { style: { display: "none" }, tabIndex: -1, type: "submit" }),
|
|
822
|
-
/* @__PURE__ */ jsxRuntime.jsxs(ui.Stack, { space: 5, children: [
|
|
823
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
824
|
-
FormFieldInputText,
|
|
825
|
-
{
|
|
826
|
-
disabled: formUpdating,
|
|
827
|
-
description: "Name displayed in this plugin (e.g. production, staging)",
|
|
828
|
-
error: errors?.name,
|
|
829
|
-
label: "Name",
|
|
830
|
-
...register("name")
|
|
831
|
-
}
|
|
832
|
-
),
|
|
833
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
834
|
-
FormFieldInputText,
|
|
835
|
-
{
|
|
836
|
-
disabled: formUpdating,
|
|
837
|
-
error: errors?.token,
|
|
838
|
-
label: "Vercel Account Token",
|
|
839
|
-
...register("token")
|
|
840
|
-
}
|
|
841
|
-
),
|
|
842
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
843
|
-
FormFieldInputText,
|
|
844
|
-
{
|
|
845
|
-
disabled: formUpdating,
|
|
846
|
-
error: errors?.projectId,
|
|
847
|
-
label: "Vercel Project ID",
|
|
848
|
-
...register("projectId")
|
|
849
|
-
}
|
|
850
|
-
),
|
|
851
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
852
|
-
FormFieldInputText,
|
|
853
|
-
{
|
|
854
|
-
description: "Required only if your project is owned by a team account",
|
|
855
|
-
disabled: formUpdating,
|
|
856
|
-
error: errors?.teamId,
|
|
857
|
-
label: "Vercel Team ID (optional)",
|
|
858
|
-
...register("teamId")
|
|
859
|
-
}
|
|
860
|
-
),
|
|
861
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
862
|
-
FormFieldInputText,
|
|
863
|
-
{
|
|
864
|
-
description: "Enter a valid deploy hook URL to enable manual deploys",
|
|
865
|
-
disabled: formUpdating,
|
|
866
|
-
error: errors?.deployHook,
|
|
867
|
-
label: "Vercel Deploy Hook (optional)",
|
|
868
|
-
...register("deployHook")
|
|
869
|
-
}
|
|
870
|
-
),
|
|
871
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
872
|
-
FormFieldInputText,
|
|
873
|
-
{
|
|
874
|
-
disabled: formUpdating,
|
|
875
|
-
error: errors?.deployLimit,
|
|
876
|
-
label: "Number of deploys to display",
|
|
877
|
-
...register("deployLimit", { valueAsNumber: !0 })
|
|
878
|
-
}
|
|
879
|
-
)
|
|
880
|
-
] })
|
|
881
|
-
] })
|
|
882
|
-
}
|
|
883
|
-
);
|
|
884
|
-
}, dialogMachine = xstate.setup({
|
|
885
|
-
types: {
|
|
886
|
-
context: {},
|
|
887
|
-
events: {}
|
|
888
|
-
},
|
|
889
|
-
actions: {
|
|
890
|
-
setEditDeploymentTarget: xstate.assign({
|
|
891
|
-
editDeploymentTarget: ({ event }) => (xstate.assertEvent(event, "EDIT"), event.deploymentTarget)
|
|
892
|
-
})
|
|
893
|
-
}
|
|
894
|
-
}).createMachine({
|
|
895
|
-
/** @xstate-layout N4IgpgJg5mDOIC5QAoC2BDAxgCwJYDswBKAOlwgBswBiAYQCUBRAQQBVGBtABgF1FQADgHtYuAC64h+fiAAeiAEwKArCQCcANgAcAdmUbNOhVx0BGLQBoQAT0SmAzApJcXXexoAsW5fbWaFAL4BVmhYeISk5FTUjAAiAJKs3HxIIMKiElIy8ghKqpq6+obGZpY2ivb2zq4e5moeXKZc3kEhGDgExCSQ4nQAMgDyAMqcvDLp4pLSqTn2DSQefn7uyq5aWvZWtgjmTqsuvnU6XMoK9q0goR0RJJgATmDoYjS0gyPJ4yKTWTOIc1wLJZqFZrDZbRBaUwkfZuew6SFcepuILBED4IQQOAyK7hYifDJTbKIAC0GnBCFJFxxnUilDA+O+01AOQ8CnJGxIGn29lMpjUxhcCh0VPauNIPTEDMyTLkiA8PhIxh5Cg8DS8pgM5L5UOalSMah0cP05hFYRptweT3pqQm0qJCHlVSVphVashmvKCDUAN17j0XNMqrUyhRASAA */
|
|
896
|
-
context: {
|
|
897
|
-
editDeploymentTarget: void 0
|
|
898
|
-
},
|
|
899
|
-
initial: "idle",
|
|
900
|
-
states: {
|
|
901
|
-
idle: {
|
|
902
|
-
entry: xstate.assign({
|
|
903
|
-
editDeploymentTarget: () => {
|
|
904
|
-
}
|
|
905
|
-
}),
|
|
906
|
-
on: {
|
|
907
|
-
CREATE: {
|
|
908
|
-
target: "create"
|
|
909
|
-
},
|
|
910
|
-
EDIT: {
|
|
911
|
-
actions: "setEditDeploymentTarget",
|
|
912
|
-
target: "edit"
|
|
913
|
-
}
|
|
914
|
-
}
|
|
915
|
-
},
|
|
916
|
-
edit: {
|
|
917
|
-
on: {
|
|
918
|
-
CLOSE: {
|
|
919
|
-
target: "idle"
|
|
920
|
-
}
|
|
921
|
-
}
|
|
922
|
-
},
|
|
923
|
-
create: {
|
|
924
|
-
on: {
|
|
925
|
-
CLOSE: {
|
|
926
|
-
target: "idle"
|
|
927
|
-
}
|
|
928
|
-
}
|
|
929
|
-
}
|
|
930
|
-
}
|
|
931
|
-
}), queryClient = new reactQuery.QueryClient({
|
|
932
|
-
defaultOptions: {
|
|
933
|
-
queries: {
|
|
934
|
-
gcTime: 0,
|
|
935
|
-
staleTime: 0
|
|
936
|
-
}
|
|
937
|
-
}
|
|
938
|
-
}), Widget = () => {
|
|
939
|
-
const client = useSanityClient(), [deploymentTargetListState, deploymentTargetListStateTransition] = react$1.useMachine(
|
|
940
|
-
deploymentTargetListMachine,
|
|
941
|
-
{ input: { client } }
|
|
942
|
-
), [dialogState, dialogStateTransition] = react$1.useMachine(dialogMachine), handleDialogClose = () => {
|
|
943
|
-
dialogStateTransition({ type: "CLOSE" });
|
|
944
|
-
}, handleDialogShowCreate = () => {
|
|
945
|
-
dialogStateTransition({ type: "CREATE" });
|
|
946
|
-
}, handleDialogShowEdit = (deploymentTarget) => {
|
|
947
|
-
dialogStateTransition({ type: "EDIT", deploymentTarget });
|
|
948
|
-
}, handleTargetCreate = (deploymentTarget) => {
|
|
949
|
-
deploymentTargetListStateTransition({ type: "CREATE", deploymentTarget });
|
|
950
|
-
}, handleTargetDelete = (id) => {
|
|
951
|
-
deploymentTargetListStateTransition({ type: "DELETE", id });
|
|
952
|
-
}, handleTargetUpdate = (deploymentTarget) => {
|
|
953
|
-
deploymentTargetListStateTransition({ type: "UPDATE", deploymentTarget });
|
|
954
|
-
};
|
|
955
|
-
return /* @__PURE__ */ jsxRuntime.jsx(ui.ToastProvider, { zOffset: Z_INDEX_TOAST_PROVIDER, children: /* @__PURE__ */ jsxRuntime.jsxs(reactQuery.QueryClientProvider, { client: queryClient, children: [
|
|
956
|
-
/* @__PURE__ */ jsxRuntime.jsxs(ui.Card, { radius: 2, style: { overflow: "hidden " }, children: [
|
|
957
|
-
/* @__PURE__ */ jsxRuntime.jsx(StateDebug, { name: "List", state: deploymentTargetListState }),
|
|
958
|
-
/* @__PURE__ */ jsxRuntime.jsxs(ui.Flex, { align: "center", justify: "space-between", paddingX: 3, paddingY: 2, children: [
|
|
959
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Text, { size: 5, weight: "semibold", children: "Vercel deployments" }),
|
|
960
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
961
|
-
ui.Tooltip,
|
|
962
|
-
{
|
|
963
|
-
content: /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { padding: 2, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { muted: !0, size: 1, children: "Create new deployment target" }) }),
|
|
964
|
-
placement: "left",
|
|
965
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { fontSize: 1, icon: icons.AddIcon, onClick: handleDialogShowCreate, mode: "bleed" })
|
|
966
|
-
}
|
|
967
|
-
)
|
|
968
|
-
] }),
|
|
969
|
-
/* @__PURE__ */ jsxRuntime.jsxs(ui.Box, { children: [
|
|
970
|
-
deploymentTargetListState.matches("pending") && /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { paddingX: 3, paddingY: 4, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { children: "Loading..." }) }),
|
|
971
|
-
deploymentTargetListState.matches({ ready: "withoutData" }) && /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { paddingX: 3, paddingY: 4, children: /* @__PURE__ */ jsxRuntime.jsxs(ui.Text, { children: [
|
|
972
|
-
"No deployment targets found.",
|
|
973
|
-
" ",
|
|
974
|
-
/* @__PURE__ */ jsxRuntime.jsx("a", { onClick: handleDialogShowCreate, style: { cursor: "pointer" }, children: "Create a new target?" })
|
|
975
|
-
] }) }),
|
|
976
|
-
deploymentTargetListState.matches({ ready: "withData" }) && /* @__PURE__ */ jsxRuntime.jsx(
|
|
977
|
-
DeploymentTargets,
|
|
978
|
-
{
|
|
979
|
-
items: deploymentTargetListState.context.results,
|
|
980
|
-
onDialogEdit: handleDialogShowEdit
|
|
981
|
-
}
|
|
982
|
-
),
|
|
983
|
-
deploymentTargetListState.matches("failed") && /* @__PURE__ */ jsxRuntime.jsx(ui.Box, { paddingX: 3, paddingY: 4, children: /* @__PURE__ */ jsxRuntime.jsx(ui.Text, { children: "Failed to retrieve deployment targets. Please check the developer console log for more information." }) })
|
|
984
|
-
] })
|
|
985
|
-
] }),
|
|
986
|
-
dialogState.matches("create") && /* @__PURE__ */ jsxRuntime.jsx(DialogForm, { onClose: handleDialogClose, onCreate: handleTargetCreate }),
|
|
987
|
-
dialogState.matches("edit") && /* @__PURE__ */ jsxRuntime.jsx(
|
|
988
|
-
DialogForm,
|
|
989
|
-
{
|
|
990
|
-
deploymentTarget: dialogState.context.editDeploymentTarget,
|
|
991
|
-
onClose: handleDialogClose,
|
|
992
|
-
onDelete: handleTargetDelete,
|
|
993
|
-
onUpdate: handleTargetUpdate
|
|
994
|
-
}
|
|
995
|
-
)
|
|
996
|
-
] }) });
|
|
997
|
-
};
|
|
998
|
-
TimeAgo__default.default.addDefaultLocale(en__default.default);
|
|
999
|
-
function vercelWidget(config = {}) {
|
|
1000
|
-
return {
|
|
1001
|
-
name: "vercel",
|
|
1002
|
-
component: Widget,
|
|
1003
|
-
layout: config.layout ?? { width: "full" }
|
|
1004
|
-
};
|
|
1005
|
-
}
|
|
1006
|
-
exports.vercelWidget = vercelWidget;
|
|
1007
|
-
//# sourceMappingURL=index.js.map
|