@liiift-studio/deploy-vercel-from-sanity 1.0.9 → 1.1.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/README.md +15 -3
- package/dist/index.d.mts +38 -5
- package/dist/index.d.ts +38 -5
- package/dist/index.js +587 -398
- package/dist/index.mjs +584 -420
- package/package.json +8 -5
- package/src/components/DeployHistory.tsx +3 -2
- package/src/components/DeployItem.tsx +61 -79
- package/src/components/DeployTargetForm.tsx +6 -5
- package/src/components/DeployTool.tsx +6 -2
- package/src/components/TokenSetup.tsx +5 -2
- package/src/icons.tsx +71 -0
- package/src/index.ts +1 -1
- package/src/schema/vercelDeploy.ts +1 -1
- package/src/ui.tsx +337 -0
- package/src/version.ts +1 -1
package/dist/index.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
2
3
|
var __defProp = Object.defineProperty;
|
|
3
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
5
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
8
|
var __export = (target, all) => {
|
|
7
9
|
for (var name in all)
|
|
@@ -15,6 +17,14 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
15
17
|
}
|
|
16
18
|
return to;
|
|
17
19
|
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
18
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
29
|
|
|
20
30
|
// src/index.ts
|
|
@@ -25,19 +35,244 @@ __export(index_exports, {
|
|
|
25
35
|
});
|
|
26
36
|
module.exports = __toCommonJS(index_exports);
|
|
27
37
|
var import_sanity5 = require("sanity");
|
|
28
|
-
|
|
38
|
+
|
|
39
|
+
// src/icons.tsx
|
|
40
|
+
var import_react = require("react");
|
|
41
|
+
var sanityIcons = __toESM(require("@sanity/icons"));
|
|
42
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
43
|
+
var INSTALLED = sanityIcons;
|
|
44
|
+
var GLYPH = { width: "1em", height: "1em", viewBox: "0 0 25 25", fill: "none" };
|
|
45
|
+
var MissingIcon = (0, import_react.forwardRef)(function MissingIcon2(props, ref) {
|
|
46
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("svg", { ...GLYPH, xmlns: "http://www.w3.org/2000/svg", ...props, ref });
|
|
47
|
+
});
|
|
48
|
+
function resolveIcon(name, symbol) {
|
|
49
|
+
const named = INSTALLED[name];
|
|
50
|
+
if (named) return named;
|
|
51
|
+
const Icon = INSTALLED.Icon;
|
|
52
|
+
if (!Icon) return MissingIcon;
|
|
53
|
+
const Resolved = (0, import_react.forwardRef)(function SanityIcon(props, ref) {
|
|
54
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Icon, { symbol, ...props, ref });
|
|
55
|
+
});
|
|
56
|
+
Resolved.displayName = name;
|
|
57
|
+
return Resolved;
|
|
58
|
+
}
|
|
59
|
+
var AddIcon = resolveIcon("AddIcon", "add");
|
|
60
|
+
var CheckmarkCircleIcon = resolveIcon("CheckmarkCircleIcon", "checkmark-circle");
|
|
61
|
+
var CheckmarkIcon = resolveIcon("CheckmarkIcon", "checkmark");
|
|
62
|
+
var ChevronDownIcon = resolveIcon("ChevronDownIcon", "chevron-down");
|
|
63
|
+
var ChevronUpIcon = resolveIcon("ChevronUpIcon", "chevron-up");
|
|
64
|
+
var ClockIcon = resolveIcon("ClockIcon", "clock");
|
|
65
|
+
var CloseIcon = resolveIcon("CloseIcon", "close");
|
|
66
|
+
var CopyIcon = resolveIcon("CopyIcon", "copy");
|
|
67
|
+
var EditIcon = resolveIcon("EditIcon", "edit");
|
|
68
|
+
var EllipsisVerticalIcon = resolveIcon("EllipsisVerticalIcon", "ellipsis-vertical");
|
|
69
|
+
var LaunchIcon = resolveIcon("LaunchIcon", "launch");
|
|
70
|
+
var RocketIcon = resolveIcon("RocketIcon", "rocket");
|
|
71
|
+
var SchemaIcon = resolveIcon("SchemaIcon", "schema");
|
|
72
|
+
var TokenIcon = resolveIcon("TokenIcon", "token");
|
|
73
|
+
var TrashIcon = resolveIcon("TrashIcon", "trash");
|
|
74
|
+
var WarningOutlineIcon = resolveIcon("WarningOutlineIcon", "warning-outline");
|
|
29
75
|
|
|
30
76
|
// src/components/DeployTool.tsx
|
|
31
|
-
var
|
|
77
|
+
var import_react7 = require("react");
|
|
32
78
|
var import_sanity3 = require("sanity");
|
|
33
|
-
var
|
|
34
|
-
var import_icons5 = require("@sanity/icons");
|
|
79
|
+
var import_ui11 = require("@sanity/ui");
|
|
35
80
|
|
|
36
|
-
// src/
|
|
81
|
+
// src/ui.tsx
|
|
37
82
|
var import_react2 = require("react");
|
|
83
|
+
var sanityUi = __toESM(require("@sanity/ui"));
|
|
84
|
+
var import_ui = require("@sanity/ui");
|
|
85
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
86
|
+
var INSTALLED2 = sanityUi;
|
|
87
|
+
var IS_UI_V4_PLUS = !("useToast" in INSTALLED2);
|
|
88
|
+
function Stack({ space, children, ...rest }) {
|
|
89
|
+
const spacing = space === void 0 ? {} : IS_UI_V4_PLUS ? { gap: space } : { space };
|
|
90
|
+
const Component = import_ui.Stack;
|
|
91
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Component, { ...rest, ...spacing, children });
|
|
92
|
+
}
|
|
93
|
+
var LOCAL_TOAST_MS = 5e3;
|
|
94
|
+
var LOCAL_TOAST_TONE = {
|
|
95
|
+
success: "positive",
|
|
96
|
+
error: "critical",
|
|
97
|
+
warning: "caution",
|
|
98
|
+
info: "primary"
|
|
99
|
+
};
|
|
100
|
+
var nextToastId = 0;
|
|
101
|
+
var localToasts = [];
|
|
102
|
+
var toastListeners = /* @__PURE__ */ new Set();
|
|
103
|
+
function emitToasts() {
|
|
104
|
+
for (const listener of toastListeners) listener(localToasts);
|
|
105
|
+
}
|
|
106
|
+
function pushLocalToast(params) {
|
|
107
|
+
const toast = { ...params, id: nextToastId++ };
|
|
108
|
+
localToasts = [...localToasts, toast];
|
|
109
|
+
emitToasts();
|
|
110
|
+
setTimeout(() => {
|
|
111
|
+
localToasts = localToasts.filter((t) => t.id !== toast.id);
|
|
112
|
+
emitToasts();
|
|
113
|
+
}, LOCAL_TOAST_MS);
|
|
114
|
+
}
|
|
115
|
+
var installedUseToast = INSTALLED2.useToast;
|
|
116
|
+
var localToaster = { push: pushLocalToast };
|
|
117
|
+
function useToast() {
|
|
118
|
+
const real = installedUseToast;
|
|
119
|
+
if (real) return real();
|
|
120
|
+
return localToaster;
|
|
121
|
+
}
|
|
122
|
+
function ToastViewport() {
|
|
123
|
+
const [toasts, setToasts] = (0, import_react2.useState)(localToasts);
|
|
124
|
+
(0, import_react2.useEffect)(() => {
|
|
125
|
+
if (installedUseToast) return;
|
|
126
|
+
toastListeners.add(setToasts);
|
|
127
|
+
return () => {
|
|
128
|
+
toastListeners.delete(setToasts);
|
|
129
|
+
};
|
|
130
|
+
}, []);
|
|
131
|
+
if (installedUseToast || toasts.length === 0) return null;
|
|
132
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_ui.Box, { style: { position: "fixed", bottom: 16, right: 16, zIndex: 1e6, maxWidth: 360 }, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Stack, { space: 2, children: toasts.map((toast) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
133
|
+
import_ui.Card,
|
|
134
|
+
{
|
|
135
|
+
padding: 3,
|
|
136
|
+
radius: 2,
|
|
137
|
+
shadow: 3,
|
|
138
|
+
tone: LOCAL_TOAST_TONE[toast.status ?? "info"] ?? "primary",
|
|
139
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Stack, { space: 2, children: [
|
|
140
|
+
toast.title && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_ui.Text, { size: 1, weight: "semibold", children: toast.title }),
|
|
141
|
+
toast.description && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_ui.Text, { size: 1, muted: true, children: toast.description })
|
|
142
|
+
] })
|
|
143
|
+
},
|
|
144
|
+
toast.id
|
|
145
|
+
)) }) });
|
|
146
|
+
}
|
|
147
|
+
var InstalledTooltip = INSTALLED2.Tooltip;
|
|
148
|
+
function Tooltip({ text, children }) {
|
|
149
|
+
if (InstalledTooltip) {
|
|
150
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(InstalledTooltip, { content: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_ui.Box, { padding: 2, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_ui.Text, { size: 1, children: text }) }), portal: true, children });
|
|
151
|
+
}
|
|
152
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { title: text, style: { display: "inline-flex" }, children });
|
|
153
|
+
}
|
|
154
|
+
var InstalledMenuButton = INSTALLED2.MenuButton;
|
|
155
|
+
var InstalledMenu = INSTALLED2.Menu;
|
|
156
|
+
var InstalledMenuItem = INSTALLED2.MenuItem;
|
|
157
|
+
var HAS_INSTALLED_MENU = Boolean(InstalledMenuButton && InstalledMenu && InstalledMenuItem);
|
|
158
|
+
function ActionMenu({ id, items, buttonIcon }) {
|
|
159
|
+
const [open, setOpen] = (0, import_react2.useState)(false);
|
|
160
|
+
const wrapRef = (0, import_react2.useRef)(null);
|
|
161
|
+
(0, import_react2.useEffect)(() => {
|
|
162
|
+
if (HAS_INSTALLED_MENU || !open) return;
|
|
163
|
+
const onPointerDown = (e) => {
|
|
164
|
+
if (!wrapRef.current?.contains(e.target)) setOpen(false);
|
|
165
|
+
};
|
|
166
|
+
const onKeyDown = (e) => {
|
|
167
|
+
if (e.key === "Escape") setOpen(false);
|
|
168
|
+
};
|
|
169
|
+
document.addEventListener("mousedown", onPointerDown);
|
|
170
|
+
document.addEventListener("keydown", onKeyDown);
|
|
171
|
+
return () => {
|
|
172
|
+
document.removeEventListener("mousedown", onPointerDown);
|
|
173
|
+
document.removeEventListener("keydown", onKeyDown);
|
|
174
|
+
};
|
|
175
|
+
}, [open]);
|
|
176
|
+
const runAction = (0, import_react2.useCallback)((item) => {
|
|
177
|
+
setOpen(false);
|
|
178
|
+
item.onClick?.();
|
|
179
|
+
}, []);
|
|
180
|
+
if (HAS_INSTALLED_MENU && InstalledMenuButton && InstalledMenu && InstalledMenuItem) {
|
|
181
|
+
const MenuButton = InstalledMenuButton;
|
|
182
|
+
const Menu = InstalledMenu;
|
|
183
|
+
const MenuItem = InstalledMenuItem;
|
|
184
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
185
|
+
MenuButton,
|
|
186
|
+
{
|
|
187
|
+
id,
|
|
188
|
+
button: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_ui.Button, { mode: "ghost", icon: buttonIcon, padding: 2 }),
|
|
189
|
+
popover: { placement: "bottom-end" },
|
|
190
|
+
menu: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Menu, { children: items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
191
|
+
MenuItem,
|
|
192
|
+
{
|
|
193
|
+
text: item.text,
|
|
194
|
+
icon: item.icon,
|
|
195
|
+
tone: item.tone,
|
|
196
|
+
...item.href ? { as: "a", href: item.href, target: "_blank", rel: "noreferrer" } : { onClick: () => item.onClick?.() }
|
|
197
|
+
},
|
|
198
|
+
item.text
|
|
199
|
+
)) })
|
|
200
|
+
}
|
|
201
|
+
);
|
|
202
|
+
}
|
|
203
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { ref: wrapRef, style: { position: "relative" }, children: [
|
|
204
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
205
|
+
import_ui.Button,
|
|
206
|
+
{
|
|
207
|
+
mode: "ghost",
|
|
208
|
+
icon: buttonIcon,
|
|
209
|
+
padding: 2,
|
|
210
|
+
id,
|
|
211
|
+
"aria-haspopup": "menu",
|
|
212
|
+
"aria-expanded": open,
|
|
213
|
+
onClick: () => setOpen((o) => !o)
|
|
214
|
+
}
|
|
215
|
+
),
|
|
216
|
+
open && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
217
|
+
import_ui.Card,
|
|
218
|
+
{
|
|
219
|
+
radius: 2,
|
|
220
|
+
shadow: 3,
|
|
221
|
+
padding: 1,
|
|
222
|
+
role: "menu",
|
|
223
|
+
style: { position: "absolute", top: "100%", right: 0, marginTop: 4, zIndex: 1e3, minWidth: 180 },
|
|
224
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Stack, { space: 1, children: items.map((item) => {
|
|
225
|
+
const Icon = item.icon;
|
|
226
|
+
const label = /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_ui.Flex, { align: "center", gap: 2, paddingX: 2, paddingY: 2, children: [
|
|
227
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Icon, { width: "1em", height: "1em" }),
|
|
228
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_ui.Text, { size: 1, children: item.text })
|
|
229
|
+
] });
|
|
230
|
+
return item.href ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
231
|
+
"a",
|
|
232
|
+
{
|
|
233
|
+
role: "menuitem",
|
|
234
|
+
href: item.href,
|
|
235
|
+
target: "_blank",
|
|
236
|
+
rel: "noreferrer",
|
|
237
|
+
onClick: () => setOpen(false),
|
|
238
|
+
style: { color: "inherit", textDecoration: "none", display: "block" },
|
|
239
|
+
children: label
|
|
240
|
+
},
|
|
241
|
+
item.text
|
|
242
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
243
|
+
import_ui.Card,
|
|
244
|
+
{
|
|
245
|
+
as: "button",
|
|
246
|
+
role: "menuitem",
|
|
247
|
+
tone: item.tone === "critical" ? "critical" : "default",
|
|
248
|
+
radius: 1,
|
|
249
|
+
onClick: () => runAction(item),
|
|
250
|
+
style: { display: "block", width: "100%", textAlign: "left", cursor: "pointer", border: 0, background: "none" },
|
|
251
|
+
children: label
|
|
252
|
+
},
|
|
253
|
+
item.text
|
|
254
|
+
);
|
|
255
|
+
}) })
|
|
256
|
+
}
|
|
257
|
+
)
|
|
258
|
+
] });
|
|
259
|
+
}
|
|
260
|
+
var InstalledCode = INSTALLED2.Code;
|
|
261
|
+
var FALLBACK_CODE_STYLE = {
|
|
262
|
+
fontFamily: "ui-monospace, SFMono-Regular, Menlo, Consolas, monospace",
|
|
263
|
+
fontSize: "0.8125rem",
|
|
264
|
+
lineHeight: 1.4,
|
|
265
|
+
margin: 0
|
|
266
|
+
};
|
|
267
|
+
function Code({ style, children }) {
|
|
268
|
+
if (InstalledCode) return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(InstalledCode, { size: 1, style, children });
|
|
269
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("code", { style: { ...FALLBACK_CODE_STYLE, ...style }, children });
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
// src/components/DeployItem.tsx
|
|
273
|
+
var import_react4 = require("react");
|
|
38
274
|
var import_react_dom = require("react-dom");
|
|
39
|
-
var
|
|
40
|
-
var import_icons2 = require("@sanity/icons");
|
|
275
|
+
var import_ui5 = require("@sanity/ui");
|
|
41
276
|
|
|
42
277
|
// src/lib/api.ts
|
|
43
278
|
var BASE = "https://api.vercel.com";
|
|
@@ -180,28 +415,27 @@ function projectHref(inspectorUrl) {
|
|
|
180
415
|
}
|
|
181
416
|
|
|
182
417
|
// src/components/StatusBadge.tsx
|
|
183
|
-
var
|
|
184
|
-
var
|
|
418
|
+
var import_ui2 = require("@sanity/ui");
|
|
419
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
185
420
|
function StatusBadge({ state, showSpinner }) {
|
|
186
421
|
const { label, tone } = stateLabel(state);
|
|
187
422
|
const spinning = showSpinner && (state === "QUEUED" || state === "INITIALIZING" || state === "BUILDING");
|
|
188
|
-
return /* @__PURE__ */ (0,
|
|
189
|
-
spinning && /* @__PURE__ */ (0,
|
|
190
|
-
/* @__PURE__ */ (0,
|
|
423
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_ui2.Flex, { align: "center", gap: 2, children: [
|
|
424
|
+
spinning && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_ui2.Spinner, { muted: true }),
|
|
425
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_ui2.Badge, { tone, padding: 2, children: label })
|
|
191
426
|
] });
|
|
192
427
|
}
|
|
193
428
|
|
|
194
429
|
// src/components/DeployHistory.tsx
|
|
195
|
-
var
|
|
196
|
-
var
|
|
197
|
-
var
|
|
198
|
-
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
430
|
+
var import_react3 = require("react");
|
|
431
|
+
var import_ui3 = require("@sanity/ui");
|
|
432
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
199
433
|
function DeployHistory({ target, token, onClose }) {
|
|
200
|
-
const [deployments, setDeployments] = (0,
|
|
201
|
-
const [loading, setLoading] = (0,
|
|
202
|
-
const [error, setError] = (0,
|
|
434
|
+
const [deployments, setDeployments] = (0, import_react3.useState)([]);
|
|
435
|
+
const [loading, setLoading] = (0, import_react3.useState)(true);
|
|
436
|
+
const [error, setError] = (0, import_react3.useState)(null);
|
|
203
437
|
const { projectId, hookId } = parseHookUrl(target.url);
|
|
204
|
-
const load = (0,
|
|
438
|
+
const load = (0, import_react3.useCallback)(async () => {
|
|
205
439
|
setLoading(true);
|
|
206
440
|
setError(null);
|
|
207
441
|
try {
|
|
@@ -213,64 +447,64 @@ function DeployHistory({ target, token, onClose }) {
|
|
|
213
447
|
setLoading(false);
|
|
214
448
|
}
|
|
215
449
|
}, [projectId, hookId, token, target.teamId]);
|
|
216
|
-
(0,
|
|
450
|
+
(0, import_react3.useEffect)(() => {
|
|
217
451
|
load();
|
|
218
452
|
}, [load]);
|
|
219
|
-
return /* @__PURE__ */ (0,
|
|
220
|
-
|
|
453
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
454
|
+
import_ui3.Dialog,
|
|
221
455
|
{
|
|
222
456
|
header: `${target.name} \u2014 Deployment History`,
|
|
223
457
|
id: "deploy-history",
|
|
224
458
|
onClose,
|
|
225
459
|
width: 2,
|
|
226
|
-
footer: /* @__PURE__ */ (0,
|
|
227
|
-
children: /* @__PURE__ */ (0,
|
|
228
|
-
loading && /* @__PURE__ */ (0,
|
|
229
|
-
error && /* @__PURE__ */ (0,
|
|
230
|
-
!loading && !error && deployments.length === 0 && /* @__PURE__ */ (0,
|
|
231
|
-
!loading && deployments.length > 0 && /* @__PURE__ */ (0,
|
|
232
|
-
/* @__PURE__ */ (0,
|
|
233
|
-
/* @__PURE__ */ (0,
|
|
234
|
-
/* @__PURE__ */ (0,
|
|
235
|
-
/* @__PURE__ */ (0,
|
|
236
|
-
/* @__PURE__ */ (0,
|
|
237
|
-
/* @__PURE__ */ (0,
|
|
460
|
+
footer: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_ui3.Box, { padding: 3, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_ui3.Button, { text: "Close", icon: CloseIcon, mode: "ghost", onClick: onClose }) }),
|
|
461
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_ui3.Box, { padding: 4, children: [
|
|
462
|
+
loading && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_ui3.Flex, { justify: "center", padding: 6, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_ui3.Spinner, { muted: true }) }),
|
|
463
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_ui3.Card, { tone: "critical", padding: 4, radius: 2, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_ui3.Text, { size: 1, children: error }) }),
|
|
464
|
+
!loading && !error && deployments.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_ui3.Card, { tone: "transparent", padding: 4, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_ui3.Text, { size: 1, muted: true, align: "center", children: "No deployments found for this hook." }) }),
|
|
465
|
+
!loading && deployments.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Stack, { space: 2, children: [
|
|
466
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_ui3.Card, { padding: 3, radius: 2, tone: "transparent", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_ui3.Flex, { gap: 3, children: [
|
|
467
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_ui3.Box, { flex: 2, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_ui3.Text, { size: 0, weight: "semibold", muted: true, children: "Preview URL" }) }),
|
|
468
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_ui3.Box, { flex: 1, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_ui3.Text, { size: 0, weight: "semibold", muted: true, children: "Status" }) }),
|
|
469
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_ui3.Box, { flex: 2, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_ui3.Text, { size: 0, weight: "semibold", muted: true, children: "Branch \xB7 Commit" }) }),
|
|
470
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_ui3.Box, { flex: 1, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_ui3.Text, { size: 0, weight: "semibold", muted: true, children: "Deployed" }) }),
|
|
471
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_ui3.Box, { style: { width: 64 }, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_ui3.Text, { size: 0, weight: "semibold", muted: true, children: "Logs" }) })
|
|
238
472
|
] }) }),
|
|
239
473
|
deployments.map((d) => {
|
|
240
474
|
const { label, tone } = stateLabel(d.state);
|
|
241
475
|
const branch = d.meta?.githubCommitRef ?? "\u2014";
|
|
242
476
|
const sha = shortSha(d.meta?.githubCommitSha);
|
|
243
477
|
const message = d.meta?.githubCommitMessage?.split("\n")[0] ?? "";
|
|
244
|
-
return /* @__PURE__ */ (0,
|
|
245
|
-
/* @__PURE__ */ (0,
|
|
478
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_ui3.Card, { padding: 3, radius: 2, shadow: 1, tone: "default", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_ui3.Flex, { gap: 3, align: "center", children: [
|
|
479
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_ui3.Box, { flex: 2, style: { overflow: "hidden" }, children: d.url ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
246
480
|
"a",
|
|
247
481
|
{
|
|
248
482
|
href: `https://${d.url}`,
|
|
249
483
|
target: "_blank",
|
|
250
484
|
rel: "noreferrer",
|
|
251
485
|
style: { color: "inherit" },
|
|
252
|
-
children: /* @__PURE__ */ (0,
|
|
486
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_ui3.Text, { size: 1, style: { textDecoration: "underline" }, children: d.url.length > 36 ? `${d.url.slice(0, 36)}\u2026` : d.url })
|
|
253
487
|
}
|
|
254
|
-
) : /* @__PURE__ */ (0,
|
|
255
|
-
/* @__PURE__ */ (0,
|
|
256
|
-
/* @__PURE__ */ (0,
|
|
257
|
-
/* @__PURE__ */ (0,
|
|
258
|
-
sha && /* @__PURE__ */ (0,
|
|
488
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_ui3.Text, { size: 1, muted: true, children: "\u2014" }) }),
|
|
489
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_ui3.Box, { flex: 1, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_ui3.Badge, { tone, children: label }) }),
|
|
490
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_ui3.Box, { flex: 2, style: { overflow: "hidden" }, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Stack, { space: 1, children: [
|
|
491
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_ui3.Text, { size: 1, children: branch }),
|
|
492
|
+
sha && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_ui3.Text, { size: 0, muted: true, children: [
|
|
259
493
|
sha,
|
|
260
494
|
message ? ` \xB7 ${message.slice(0, 40)}${message.length > 40 ? "\u2026" : ""}` : ""
|
|
261
495
|
] })
|
|
262
496
|
] }) }),
|
|
263
|
-
/* @__PURE__ */ (0,
|
|
264
|
-
/* @__PURE__ */ (0,
|
|
265
|
-
|
|
497
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_ui3.Box, { flex: 1, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_ui3.Text, { size: 1, muted: true, children: timeAgo(d.created) }) }),
|
|
498
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_ui3.Box, { style: { width: 64 }, children: safeHref(d.inspectorUrl) ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("a", { href: safeHref(d.inspectorUrl), target: "_blank", rel: "noreferrer", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
499
|
+
import_ui3.Button,
|
|
266
500
|
{
|
|
267
501
|
text: "Logs",
|
|
268
502
|
mode: "ghost",
|
|
269
503
|
tone: "default",
|
|
270
|
-
icon:
|
|
504
|
+
icon: LaunchIcon,
|
|
271
505
|
style: { fontSize: "12px" }
|
|
272
506
|
}
|
|
273
|
-
) }) : /* @__PURE__ */ (0,
|
|
507
|
+
) }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_ui3.Text, { size: 1, muted: true, children: "\u2014" }) })
|
|
274
508
|
] }) }, d.uid);
|
|
275
509
|
})
|
|
276
510
|
] })
|
|
@@ -280,28 +514,31 @@ function DeployHistory({ target, token, onClose }) {
|
|
|
280
514
|
}
|
|
281
515
|
|
|
282
516
|
// src/components/DeployItem.tsx
|
|
283
|
-
var
|
|
517
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
284
518
|
var POLL_INTERVAL_MS = 5e3;
|
|
285
519
|
var LABEL_WIDTH = 64;
|
|
520
|
+
var PENDING_TIMEOUT_MS = 6e4;
|
|
286
521
|
function DeployItem({ target, token, onDelete, onEdit }) {
|
|
287
522
|
const { projectId, hookId } = parseHookUrl(target.url);
|
|
288
|
-
const toast =
|
|
289
|
-
const [deployments, setDeployments] = (0,
|
|
290
|
-
const [loadingInitial, setLoadingInitial] = (0,
|
|
291
|
-
const [
|
|
292
|
-
const [canceling, setCanceling] = (0,
|
|
293
|
-
const [deployError, setDeployError] = (0,
|
|
294
|
-
const [showHistory, setShowHistory] = (0,
|
|
295
|
-
const [elapsed, setElapsed] = (0,
|
|
296
|
-
const [copied, setCopied] = (0,
|
|
297
|
-
const [showDetails, setShowDetails] = (0,
|
|
298
|
-
const [showErrorLogs, setShowErrorLogs] = (0,
|
|
299
|
-
const [errorLines, setErrorLines] = (0,
|
|
300
|
-
const [loadingLogs, setLoadingLogs] = (0,
|
|
301
|
-
const [logError, setLogError] = (0,
|
|
523
|
+
const toast = useToast();
|
|
524
|
+
const [deployments, setDeployments] = (0, import_react4.useState)([]);
|
|
525
|
+
const [loadingInitial, setLoadingInitial] = (0, import_react4.useState)(true);
|
|
526
|
+
const [pendingSince, setPendingSince] = (0, import_react4.useState)(null);
|
|
527
|
+
const [canceling, setCanceling] = (0, import_react4.useState)(false);
|
|
528
|
+
const [deployError, setDeployError] = (0, import_react4.useState)(null);
|
|
529
|
+
const [showHistory, setShowHistory] = (0, import_react4.useState)(false);
|
|
530
|
+
const [elapsed, setElapsed] = (0, import_react4.useState)(0);
|
|
531
|
+
const [copied, setCopied] = (0, import_react4.useState)(false);
|
|
532
|
+
const [showDetails, setShowDetails] = (0, import_react4.useState)(false);
|
|
533
|
+
const [showErrorLogs, setShowErrorLogs] = (0, import_react4.useState)(false);
|
|
534
|
+
const [errorLines, setErrorLines] = (0, import_react4.useState)([]);
|
|
535
|
+
const [loadingLogs, setLoadingLogs] = (0, import_react4.useState)(false);
|
|
536
|
+
const [logError, setLogError] = (0, import_react4.useState)(null);
|
|
537
|
+
const triggeredFromUidRef = (0, import_react4.useRef)(void 0);
|
|
302
538
|
const latest = deployments[0];
|
|
303
|
-
const
|
|
304
|
-
const
|
|
539
|
+
const isPending = pendingSince !== null;
|
|
540
|
+
const isActive = isPending || isActiveState(latest?.state);
|
|
541
|
+
const fetchDeployments = (0, import_react4.useCallback)(async () => {
|
|
305
542
|
if (!projectId || !hookId || !token) return;
|
|
306
543
|
try {
|
|
307
544
|
const data = await listDeployments({ projectId, hookId, token, teamId: target.teamId });
|
|
@@ -310,19 +547,25 @@ function DeployItem({ target, token, onDelete, onEdit }) {
|
|
|
310
547
|
console.error("deploy-vercel-from-sanity: fetch error", err);
|
|
311
548
|
}
|
|
312
549
|
}, [projectId, hookId, token, target.teamId]);
|
|
313
|
-
(0,
|
|
550
|
+
(0, import_react4.useEffect)(() => {
|
|
314
551
|
fetchDeployments().finally(() => setLoadingInitial(false));
|
|
315
552
|
}, [fetchDeployments]);
|
|
316
|
-
(0,
|
|
553
|
+
(0, import_react4.useEffect)(() => {
|
|
317
554
|
if (!isActive) return;
|
|
318
555
|
const id = setInterval(fetchDeployments, POLL_INTERVAL_MS);
|
|
319
556
|
return () => clearInterval(id);
|
|
320
557
|
}, [isActive, fetchDeployments]);
|
|
321
|
-
(0,
|
|
322
|
-
if (
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
(0,
|
|
558
|
+
(0, import_react4.useEffect)(() => {
|
|
559
|
+
if (!isPending) return;
|
|
560
|
+
if (latest?.uid && latest.uid !== triggeredFromUidRef.current) setPendingSince(null);
|
|
561
|
+
}, [isPending, latest?.uid]);
|
|
562
|
+
(0, import_react4.useEffect)(() => {
|
|
563
|
+
if (!isPending) return;
|
|
564
|
+
const id = setTimeout(() => setPendingSince(null), PENDING_TIMEOUT_MS);
|
|
565
|
+
return () => clearTimeout(id);
|
|
566
|
+
}, [isPending]);
|
|
567
|
+
const prevStateRef = (0, import_react4.useRef)(void 0);
|
|
568
|
+
(0, import_react4.useEffect)(() => {
|
|
326
569
|
const current = latest?.state;
|
|
327
570
|
const prev = prevStateRef.current;
|
|
328
571
|
if (prev && isActiveState(prev) && current && !isActiveState(current)) {
|
|
@@ -336,15 +579,15 @@ function DeployItem({ target, token, onDelete, onEdit }) {
|
|
|
336
579
|
}
|
|
337
580
|
prevStateRef.current = current;
|
|
338
581
|
}, [latest?.state, target.name, toast]);
|
|
339
|
-
(0,
|
|
582
|
+
(0, import_react4.useEffect)(() => {
|
|
340
583
|
setShowErrorLogs(false);
|
|
341
584
|
setErrorLines([]);
|
|
342
585
|
setLogError(null);
|
|
343
586
|
}, [latest?.uid]);
|
|
344
|
-
const timerRef = (0,
|
|
345
|
-
(0,
|
|
587
|
+
const timerRef = (0, import_react4.useRef)(null);
|
|
588
|
+
(0, import_react4.useEffect)(() => {
|
|
346
589
|
if (isActive) {
|
|
347
|
-
const start = latest?.created ?? Date.now();
|
|
590
|
+
const start = pendingSince ?? latest?.created ?? Date.now();
|
|
348
591
|
setElapsed(Math.floor((Date.now() - start) / 1e3));
|
|
349
592
|
timerRef.current = setInterval(() => {
|
|
350
593
|
setElapsed(Math.floor((Date.now() - start) / 1e3));
|
|
@@ -356,23 +599,24 @@ function DeployItem({ target, token, onDelete, onEdit }) {
|
|
|
356
599
|
return () => {
|
|
357
600
|
if (timerRef.current) clearInterval(timerRef.current);
|
|
358
601
|
};
|
|
359
|
-
}, [isActive, latest?.created]);
|
|
360
|
-
const deploy = (0,
|
|
602
|
+
}, [isActive, pendingSince, latest?.created]);
|
|
603
|
+
const deploy = (0, import_react4.useCallback)(() => {
|
|
361
604
|
(0, import_react_dom.flushSync)(() => {
|
|
362
605
|
setDeployError(null);
|
|
363
|
-
|
|
606
|
+
triggeredFromUidRef.current = latest?.uid;
|
|
607
|
+
setPendingSince(Date.now());
|
|
364
608
|
});
|
|
365
609
|
void (async () => {
|
|
366
610
|
try {
|
|
367
611
|
await triggerDeploy(target.url);
|
|
368
612
|
setTimeout(fetchDeployments, 2e3);
|
|
369
613
|
} catch (err) {
|
|
370
|
-
|
|
614
|
+
setPendingSince(null);
|
|
371
615
|
setDeployError(err instanceof Error ? err.message : "Deploy failed");
|
|
372
616
|
}
|
|
373
617
|
})();
|
|
374
|
-
}, [target.url, fetchDeployments]);
|
|
375
|
-
const cancel = (0,
|
|
618
|
+
}, [target.url, fetchDeployments, latest?.uid]);
|
|
619
|
+
const cancel = (0, import_react4.useCallback)(async () => {
|
|
376
620
|
if (!latest?.uid) return;
|
|
377
621
|
setCanceling(true);
|
|
378
622
|
try {
|
|
@@ -384,7 +628,7 @@ function DeployItem({ target, token, onDelete, onEdit }) {
|
|
|
384
628
|
setCanceling(false);
|
|
385
629
|
}
|
|
386
630
|
}, [latest?.uid, token, target.teamId, fetchDeployments]);
|
|
387
|
-
const copyUrl = (0,
|
|
631
|
+
const copyUrl = (0, import_react4.useCallback)(() => {
|
|
388
632
|
if (!latest?.url) return;
|
|
389
633
|
const fullUrl = `https://${latest.url}`;
|
|
390
634
|
navigator.clipboard.writeText(fullUrl).then(() => {
|
|
@@ -394,7 +638,7 @@ function DeployItem({ target, token, onDelete, onEdit }) {
|
|
|
394
638
|
window.prompt("Copy deployment URL:", fullUrl);
|
|
395
639
|
});
|
|
396
640
|
}, [latest?.url]);
|
|
397
|
-
const fetchErrorLogs = (0,
|
|
641
|
+
const fetchErrorLogs = (0, import_react4.useCallback)(async () => {
|
|
398
642
|
if (!latest?.uid) return;
|
|
399
643
|
setLoadingLogs(true);
|
|
400
644
|
setLogError(null);
|
|
@@ -412,7 +656,7 @@ function DeployItem({ target, token, onDelete, onEdit }) {
|
|
|
412
656
|
setLoadingLogs(false);
|
|
413
657
|
}
|
|
414
658
|
}, [latest?.uid, token, target.teamId]);
|
|
415
|
-
const toggleErrorLogs = (0,
|
|
659
|
+
const toggleErrorLogs = (0, import_react4.useCallback)(() => {
|
|
416
660
|
if (!showErrorLogs && errorLines.length === 0 && !logError) fetchErrorLogs();
|
|
417
661
|
setShowErrorLogs((v) => !v);
|
|
418
662
|
}, [showErrorLogs, errorLines.length, logError, fetchErrorLogs]);
|
|
@@ -425,21 +669,21 @@ function DeployItem({ target, token, onDelete, onEdit }) {
|
|
|
425
669
|
const deployedAt = latest?.created ? timeAgo(latest.created) : null;
|
|
426
670
|
const vercelProjectUrl = projectHref(latest?.inspectorUrl);
|
|
427
671
|
const isError = latest?.state === "ERROR";
|
|
428
|
-
return /* @__PURE__ */ (0,
|
|
429
|
-
/* @__PURE__ */ (0,
|
|
430
|
-
/* @__PURE__ */ (0,
|
|
431
|
-
/* @__PURE__ */ (0,
|
|
432
|
-
/* @__PURE__ */ (0,
|
|
433
|
-
/* @__PURE__ */ (0,
|
|
434
|
-
/* @__PURE__ */ (0,
|
|
435
|
-
branch && /* @__PURE__ */ (0,
|
|
672
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
|
|
673
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_ui5.Card, { radius: 2, shadow: 1, tone: "default", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_ui5.Flex, { align: "stretch", className: "dvfs-card-flex", children: [
|
|
674
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_ui5.Flex, { direction: "column", flex: 1, style: { minWidth: 0 }, children: [
|
|
675
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Stack, { space: 3, padding: 3, style: { flex: 1 }, children: [
|
|
676
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_ui5.Flex, { align: "center", justify: "space-between", gap: 2, children: [
|
|
677
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_ui5.Flex, { align: "center", gap: 2, style: { minWidth: 0, flexWrap: "wrap" }, children: [
|
|
678
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_ui5.Text, { size: 2, weight: "semibold", style: { flexShrink: 0 }, children: target.name }),
|
|
679
|
+
branch && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_ui5.Badge, { tone: "default", padding: 2, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_ui5.Flex, { align: "center", gap: 1, children: [
|
|
436
680
|
branch,
|
|
437
|
-
/* @__PURE__ */ (0,
|
|
681
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("svg", { width: "12", height: "12", viewBox: "0 0 16 16", fill: "currentColor", "aria-hidden": "true", style: { marginLeft: "-0.1em", opacity: 0.5 }, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("path", { d: "M5 3.25a.75.75 0 1 1-1.5 0 .75.75 0 0 1 1.5 0zm0 2.122a2.25 2.25 0 1 0-1.5 0v.878A2.25 2.25 0 0 0 5.75 8.5h1.5v2.128a2.251 2.251 0 1 0 1.5 0V8.5h1.5a2.25 2.25 0 0 0 2.25-2.25v-.878a2.25 2.25 0 1 0-1.5 0v.878a.75.75 0 0 1-.75.75h-4.5A.75.75 0 0 1 5 6.25v-.878zm3.75 7.378a.75.75 0 1 1-1.5 0 .75.75 0 0 1 1.5 0zm3-8.75a.75.75 0 1 1-1.5 0 .75.75 0 0 1 1.5 0z" }) })
|
|
438
682
|
] }) }),
|
|
439
|
-
token && !loadingInitial && /* @__PURE__ */ (0,
|
|
440
|
-
|
|
441
|
-
isActiveState(latest?.state) && /* @__PURE__ */ (0,
|
|
442
|
-
|
|
683
|
+
token && !loadingInitial && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
|
|
684
|
+
isPending ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(StatusBadge, { state: "QUEUED" }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(StatusBadge, { state: latest?.state }),
|
|
685
|
+
isActiveState(latest?.state) && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
686
|
+
import_ui5.Button,
|
|
443
687
|
{
|
|
444
688
|
text: "Cancel",
|
|
445
689
|
mode: "ghost",
|
|
@@ -450,134 +694,80 @@ function DeployItem({ target, token, onDelete, onEdit }) {
|
|
|
450
694
|
style: { cursor: "pointer" }
|
|
451
695
|
}
|
|
452
696
|
),
|
|
453
|
-
|
|
454
|
-
/*
|
|
455
|
-
/* @__PURE__ */ (0,
|
|
456
|
-
|
|
697
|
+
isPending ? (
|
|
698
|
+
/* Optimistic — dimmed spinner only; no elapsed time until a real build exists */
|
|
699
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_ui5.Spinner, { muted: true, style: { marginLeft: 4, opacity: 0.5 } })
|
|
700
|
+
) : isActive ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_ui5.Flex, { align: "center", gap: 1, children: [
|
|
701
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_ui5.Spinner, { muted: true, style: { marginLeft: 4 } }),
|
|
702
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_ui5.Text, { size: 1, muted: true, children: formatDuration(elapsed) })
|
|
703
|
+
] }) : deployedAt ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_ui5.Text, { size: 1, muted: true, children: deployedAt }) : null
|
|
457
704
|
] })
|
|
458
705
|
] }),
|
|
459
|
-
/* @__PURE__ */ (0,
|
|
460
|
-
|
|
706
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
707
|
+
ActionMenu,
|
|
461
708
|
{
|
|
462
|
-
button: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_ui3.Button, { mode: "ghost", icon: import_icons2.EllipsisVerticalIcon, padding: 2 }),
|
|
463
709
|
id: `menu-${target._id}`,
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
),
|
|
473
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
474
|
-
import_ui3.MenuItem,
|
|
475
|
-
{
|
|
476
|
-
text: "History",
|
|
477
|
-
icon: import_icons2.ClockIcon,
|
|
478
|
-
onClick: () => setShowHistory(true)
|
|
479
|
-
}
|
|
480
|
-
),
|
|
481
|
-
safeHref(latest?.inspectorUrl) && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
482
|
-
import_ui3.MenuItem,
|
|
483
|
-
{
|
|
484
|
-
text: "Build logs",
|
|
485
|
-
icon: import_icons2.LaunchIcon,
|
|
486
|
-
as: "a",
|
|
487
|
-
href: safeHref(latest?.inspectorUrl),
|
|
488
|
-
target: "_blank",
|
|
489
|
-
rel: "noreferrer"
|
|
490
|
-
}
|
|
491
|
-
),
|
|
492
|
-
vercelProjectUrl && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
493
|
-
import_ui3.MenuItem,
|
|
494
|
-
{
|
|
495
|
-
text: "Open in Vercel",
|
|
496
|
-
icon: import_icons2.LaunchIcon,
|
|
497
|
-
as: "a",
|
|
498
|
-
href: vercelProjectUrl,
|
|
499
|
-
target: "_blank",
|
|
500
|
-
rel: "noreferrer"
|
|
501
|
-
}
|
|
502
|
-
),
|
|
503
|
-
!target.disableDeleteAction && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
504
|
-
import_ui3.MenuItem,
|
|
505
|
-
{
|
|
506
|
-
text: "Delete",
|
|
507
|
-
icon: import_icons2.TrashIcon,
|
|
508
|
-
tone: "critical",
|
|
509
|
-
onClick: () => onDelete(target)
|
|
510
|
-
}
|
|
511
|
-
)
|
|
512
|
-
] }),
|
|
513
|
-
popover: { placement: "bottom-end" }
|
|
710
|
+
buttonIcon: EllipsisVerticalIcon,
|
|
711
|
+
items: [
|
|
712
|
+
{ text: "Edit target", icon: EditIcon, onClick: () => onEdit(target) },
|
|
713
|
+
{ text: "History", icon: ClockIcon, onClick: () => setShowHistory(true) },
|
|
714
|
+
...safeHref(latest?.inspectorUrl) ? [{ text: "Build logs", icon: LaunchIcon, href: safeHref(latest?.inspectorUrl) }] : [],
|
|
715
|
+
...vercelProjectUrl ? [{ text: "Open in Vercel", icon: LaunchIcon, href: vercelProjectUrl }] : [],
|
|
716
|
+
...!target.disableDeleteAction ? [{ text: "Delete", icon: TrashIcon, tone: "critical", onClick: () => onDelete(target) }] : []
|
|
717
|
+
]
|
|
514
718
|
}
|
|
515
719
|
)
|
|
516
720
|
] }),
|
|
517
|
-
/* @__PURE__ */ (0,
|
|
518
|
-
!token ? /* @__PURE__ */ (0,
|
|
519
|
-
/* @__PURE__ */ (0,
|
|
520
|
-
/* @__PURE__ */ (0,
|
|
521
|
-
] }) : /* @__PURE__ */ (0,
|
|
522
|
-
/* @__PURE__ */ (0,
|
|
523
|
-
latest?.url && latest.state === "READY" && /* @__PURE__ */ (0,
|
|
721
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("hr", { style: { border: "none", borderTop: "1px solid currentColor", opacity: 0.1, margin: 0 } }),
|
|
722
|
+
!token ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_ui5.Text, { size: 1, muted: true, children: "Connect a Vercel API token to see deployment status." }) : loadingInitial ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_ui5.Flex, { align: "center", gap: 2, children: [
|
|
723
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_ui5.Spinner, { muted: true }),
|
|
724
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_ui5.Text, { size: 1, muted: true, children: "Loading\u2026" })
|
|
725
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Stack, { space: 2, children: [
|
|
726
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_ui5.Flex, { align: "center", gap: 2, wrap: "wrap", children: [
|
|
727
|
+
latest?.url && latest.state === "READY" && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_jsx_runtime5.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
524
728
|
"a",
|
|
525
729
|
{
|
|
526
730
|
href: `https://${latest.url}`,
|
|
527
731
|
target: "_blank",
|
|
528
732
|
rel: "noreferrer",
|
|
529
733
|
style: { color: "inherit" },
|
|
530
|
-
children: /* @__PURE__ */ (0,
|
|
734
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_ui5.Flex, { align: "center", gap: 1, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_ui5.Text, { size: 1, children: latest.url }) })
|
|
531
735
|
}
|
|
532
736
|
) }),
|
|
533
|
-
sha && /* @__PURE__ */ (0,
|
|
534
|
-
|
|
737
|
+
sha && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Tooltip, { text: commitMsg ?? sha, children: commitHref ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
738
|
+
"a",
|
|
535
739
|
{
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
href: commitHref,
|
|
542
|
-
target: "_blank",
|
|
543
|
-
rel: "noreferrer",
|
|
544
|
-
style: { color: "inherit", textDecoration: "none" },
|
|
545
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_ui3.Text, { size: 1, muted: true, style: { cursor: "pointer", fontFamily: "monospace" }, children: sha })
|
|
546
|
-
}
|
|
547
|
-
) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_ui3.Text, { size: 1, muted: true, style: { cursor: "default", fontFamily: "monospace" }, children: sha })
|
|
740
|
+
href: commitHref,
|
|
741
|
+
target: "_blank",
|
|
742
|
+
rel: "noreferrer",
|
|
743
|
+
style: { color: "inherit", textDecoration: "none" },
|
|
744
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_ui5.Text, { size: 1, muted: true, style: { cursor: "pointer", fontFamily: "monospace" }, children: sha })
|
|
548
745
|
}
|
|
549
|
-
),
|
|
550
|
-
creator && /* @__PURE__ */ (0,
|
|
746
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_ui5.Text, { size: 1, muted: true, style: { cursor: "default", fontFamily: "monospace" }, children: sha }) }),
|
|
747
|
+
creator && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_ui5.Text, { size: 1, muted: true, children: [
|
|
551
748
|
"by ",
|
|
552
749
|
creator
|
|
553
750
|
] }),
|
|
554
|
-
latest?.state === "READY" && latest.ready && latest.created && /* @__PURE__ */ (0,
|
|
751
|
+
latest?.state === "READY" && latest.ready && latest.created && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_ui5.Text, { size: 1, muted: true, children: [
|
|
555
752
|
"Took ",
|
|
556
753
|
formatDuration(Math.floor((latest.ready - latest.created) / 1e3)),
|
|
557
754
|
" to build"
|
|
558
755
|
] }),
|
|
559
|
-
latest?.url && latest.state === "READY" && /* @__PURE__ */ (0,
|
|
560
|
-
|
|
756
|
+
latest?.url && latest.state === "READY" && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_jsx_runtime5.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Tooltip, { text: copied ? "Copied!" : "Copy URL", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
757
|
+
import_ui5.Button,
|
|
561
758
|
{
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
icon: copied ? import_icons2.CheckmarkIcon : import_icons2.CopyIcon,
|
|
569
|
-
padding: 1,
|
|
570
|
-
tone: copied ? "positive" : "default",
|
|
571
|
-
onClick: copyUrl,
|
|
572
|
-
style: { cursor: "pointer" }
|
|
573
|
-
}
|
|
574
|
-
)
|
|
759
|
+
mode: "ghost",
|
|
760
|
+
icon: copied ? CheckmarkIcon : CopyIcon,
|
|
761
|
+
padding: 1,
|
|
762
|
+
tone: copied ? "positive" : "default",
|
|
763
|
+
onClick: copyUrl,
|
|
764
|
+
style: { cursor: "pointer" }
|
|
575
765
|
}
|
|
576
|
-
) })
|
|
766
|
+
) }) })
|
|
577
767
|
] }),
|
|
578
|
-
/* @__PURE__ */ (0,
|
|
579
|
-
commitMsg && /* @__PURE__ */ (0,
|
|
580
|
-
|
|
768
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_ui5.Flex, { align: "center", gap: 2, wrap: "wrap", children: [
|
|
769
|
+
commitMsg && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
770
|
+
import_ui5.Text,
|
|
581
771
|
{
|
|
582
772
|
size: 0,
|
|
583
773
|
muted: true,
|
|
@@ -585,51 +775,51 @@ function DeployItem({ target, token, onDelete, onEdit }) {
|
|
|
585
775
|
children: commitMsg
|
|
586
776
|
}
|
|
587
777
|
),
|
|
588
|
-
isError && /* @__PURE__ */ (0,
|
|
589
|
-
/* @__PURE__ */ (0,
|
|
590
|
-
|
|
778
|
+
isError && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Stack, { space: 2, children: [
|
|
779
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
780
|
+
import_ui5.Button,
|
|
591
781
|
{
|
|
592
782
|
text: showErrorLogs ? "Hide error details" : "Show error details",
|
|
593
783
|
mode: "ghost",
|
|
594
784
|
tone: "critical",
|
|
595
|
-
icon:
|
|
785
|
+
icon: WarningOutlineIcon,
|
|
596
786
|
fontSize: 1,
|
|
597
787
|
padding: 2,
|
|
598
788
|
onClick: toggleErrorLogs,
|
|
599
789
|
style: { alignSelf: "flex-start", cursor: "pointer" }
|
|
600
790
|
}
|
|
601
791
|
),
|
|
602
|
-
showErrorLogs && /* @__PURE__ */ (0,
|
|
603
|
-
loadingLogs && /* @__PURE__ */ (0,
|
|
604
|
-
/* @__PURE__ */ (0,
|
|
605
|
-
/* @__PURE__ */ (0,
|
|
792
|
+
showErrorLogs && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_ui5.Card, { tone: "critical", radius: 2, padding: 3, children: [
|
|
793
|
+
loadingLogs && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_ui5.Flex, { align: "center", gap: 2, children: [
|
|
794
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_ui5.Spinner, { muted: true }),
|
|
795
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_ui5.Text, { size: 1, muted: true, children: "Loading logs\u2026" })
|
|
606
796
|
] }),
|
|
607
|
-
logError && /* @__PURE__ */ (0,
|
|
608
|
-
/* @__PURE__ */ (0,
|
|
609
|
-
safeHref(latest?.inspectorUrl) && /* @__PURE__ */ (0,
|
|
610
|
-
/* @__PURE__ */ (0,
|
|
611
|
-
/* @__PURE__ */ (0,
|
|
797
|
+
logError && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Stack, { space: 2, children: [
|
|
798
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_ui5.Text, { size: 1, children: logError }),
|
|
799
|
+
safeHref(latest?.inspectorUrl) && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("a", { href: safeHref(latest?.inspectorUrl), target: "_blank", rel: "noreferrer", style: { color: "inherit" }, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_ui5.Flex, { align: "center", gap: 1, children: [
|
|
800
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(LaunchIcon, {}),
|
|
801
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_ui5.Text, { size: 1, children: "View full logs in Vercel" })
|
|
612
802
|
] }) })
|
|
613
803
|
] }),
|
|
614
|
-
!loadingLogs && !logError && errorLines.length > 0 && /* @__PURE__ */ (0,
|
|
615
|
-
/* @__PURE__ */ (0,
|
|
616
|
-
safeHref(latest?.inspectorUrl) && /* @__PURE__ */ (0,
|
|
617
|
-
/* @__PURE__ */ (0,
|
|
618
|
-
/* @__PURE__ */ (0,
|
|
804
|
+
!loadingLogs && !logError && errorLines.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Stack, { space: 2, children: [
|
|
805
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_ui5.Box, { style: { maxHeight: 240, overflowY: "auto", fontFamily: "monospace", fontSize: 13, lineHeight: 1.6 }, children: errorLines.map((line, i) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Code, { style: { display: "block", whiteSpace: "pre-wrap", wordBreak: "break-all" }, children: line }, i)) }),
|
|
806
|
+
safeHref(latest?.inspectorUrl) && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("a", { href: safeHref(latest?.inspectorUrl), target: "_blank", rel: "noreferrer", style: { color: "inherit" }, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_ui5.Flex, { align: "center", gap: 1, children: [
|
|
807
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(LaunchIcon, {}),
|
|
808
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_ui5.Text, { size: 1, children: "View full logs in Vercel" })
|
|
619
809
|
] }) })
|
|
620
810
|
] })
|
|
621
811
|
] })
|
|
622
812
|
] }),
|
|
623
|
-
deployError && /* @__PURE__ */ (0,
|
|
813
|
+
deployError && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_ui5.Card, { tone: "critical", padding: 2, radius: 2, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_ui5.Text, { size: 1, children: deployError }) })
|
|
624
814
|
] })
|
|
625
815
|
] })
|
|
626
816
|
] }),
|
|
627
|
-
/* @__PURE__ */ (0,
|
|
628
|
-
/* @__PURE__ */ (0,
|
|
629
|
-
|
|
817
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_ui5.Box, { children: [
|
|
818
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
819
|
+
import_ui5.Button,
|
|
630
820
|
{
|
|
631
821
|
mode: "ghost",
|
|
632
|
-
iconRight: showDetails ?
|
|
822
|
+
iconRight: showDetails ? ChevronUpIcon : ChevronDownIcon,
|
|
633
823
|
text: "Details",
|
|
634
824
|
fontSize: 0,
|
|
635
825
|
padding: 3,
|
|
@@ -637,65 +827,66 @@ function DeployItem({ target, token, onDelete, onEdit }) {
|
|
|
637
827
|
style: { width: "100%", justifyContent: "flex-start", borderRadius: 0, cursor: "pointer" }
|
|
638
828
|
}
|
|
639
829
|
),
|
|
640
|
-
showDetails && /* @__PURE__ */ (0,
|
|
641
|
-
/* @__PURE__ */ (0,
|
|
642
|
-
/* @__PURE__ */ (0,
|
|
643
|
-
/* @__PURE__ */ (0,
|
|
830
|
+
showDetails && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_ui5.Card, { tone: "primary", padding: 3, className: "dvfs-accordion-content", style: { borderRadius: 0, borderTop: "1px solid rgba(128,128,128,0.15)" }, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Stack, { space: 2, children: [
|
|
831
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_ui5.Flex, { gap: 2, align: "center", children: [
|
|
832
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_ui5.Text, { size: 0, muted: true, weight: "semibold", style: { minWidth: LABEL_WIDTH }, children: "Project" }),
|
|
833
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_ui5.Text, { size: 0, muted: true, style: { fontFamily: "monospace" }, children: projectId || "\u2014" })
|
|
644
834
|
] }),
|
|
645
|
-
/* @__PURE__ */ (0,
|
|
646
|
-
/* @__PURE__ */ (0,
|
|
647
|
-
/* @__PURE__ */ (0,
|
|
835
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_ui5.Flex, { gap: 2, align: "center", children: [
|
|
836
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_ui5.Text, { size: 0, muted: true, weight: "semibold", style: { minWidth: LABEL_WIDTH }, children: "Hook" }),
|
|
837
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_ui5.Text, { size: 0, muted: true, style: { fontFamily: "monospace" }, children: hookId || "\u2014" })
|
|
648
838
|
] }),
|
|
649
|
-
target.teamId && /* @__PURE__ */ (0,
|
|
650
|
-
/* @__PURE__ */ (0,
|
|
651
|
-
/* @__PURE__ */ (0,
|
|
839
|
+
target.teamId && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_ui5.Flex, { gap: 2, align: "center", children: [
|
|
840
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_ui5.Text, { size: 0, muted: true, weight: "semibold", style: { minWidth: LABEL_WIDTH }, children: "Team" }),
|
|
841
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_ui5.Text, { size: 0, muted: true, style: { fontFamily: "monospace" }, children: target.teamId })
|
|
652
842
|
] }),
|
|
653
|
-
fullSha && /* @__PURE__ */ (0,
|
|
654
|
-
/* @__PURE__ */ (0,
|
|
655
|
-
/* @__PURE__ */ (0,
|
|
843
|
+
fullSha && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_ui5.Flex, { gap: 2, align: "flex-start", children: [
|
|
844
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_ui5.Text, { size: 0, muted: true, weight: "semibold", style: { minWidth: LABEL_WIDTH }, children: "Commit" }),
|
|
845
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_ui5.Text, { size: 0, muted: true, style: { fontFamily: "monospace", wordBreak: "break-all" }, children: fullSha })
|
|
656
846
|
] }),
|
|
657
|
-
latest?.meta?.githubCommitAuthorName && /* @__PURE__ */ (0,
|
|
658
|
-
/* @__PURE__ */ (0,
|
|
659
|
-
/* @__PURE__ */ (0,
|
|
847
|
+
latest?.meta?.githubCommitAuthorName && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_ui5.Flex, { gap: 2, align: "center", children: [
|
|
848
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_ui5.Text, { size: 0, muted: true, weight: "semibold", style: { minWidth: LABEL_WIDTH }, children: "Author" }),
|
|
849
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_ui5.Text, { size: 0, muted: true, children: latest.meta.githubCommitAuthorName })
|
|
660
850
|
] }),
|
|
661
|
-
branch && /* @__PURE__ */ (0,
|
|
662
|
-
/* @__PURE__ */ (0,
|
|
663
|
-
/* @__PURE__ */ (0,
|
|
851
|
+
branch && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_ui5.Flex, { gap: 2, align: "center", children: [
|
|
852
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_ui5.Text, { size: 0, muted: true, weight: "semibold", style: { minWidth: LABEL_WIDTH }, children: "Branch" }),
|
|
853
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_ui5.Text, { size: 0, muted: true, style: { fontFamily: "monospace" }, children: branch })
|
|
664
854
|
] }),
|
|
665
|
-
latest?.uid && /* @__PURE__ */ (0,
|
|
666
|
-
/* @__PURE__ */ (0,
|
|
667
|
-
/* @__PURE__ */ (0,
|
|
855
|
+
latest?.uid && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_ui5.Flex, { gap: 2, align: "center", children: [
|
|
856
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_ui5.Text, { size: 0, muted: true, weight: "semibold", style: { minWidth: LABEL_WIDTH }, children: "Deploy ID" }),
|
|
857
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_ui5.Text, { size: 0, muted: true, style: { fontFamily: "monospace" }, children: latest.uid })
|
|
668
858
|
] }),
|
|
669
|
-
latest?.url && /* @__PURE__ */ (0,
|
|
670
|
-
/* @__PURE__ */ (0,
|
|
671
|
-
/* @__PURE__ */ (0,
|
|
859
|
+
latest?.url && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_ui5.Flex, { gap: 2, align: "flex-start", children: [
|
|
860
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_ui5.Text, { size: 0, muted: true, weight: "semibold", style: { minWidth: LABEL_WIDTH }, children: "URL" }),
|
|
861
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_ui5.Text, { size: 0, muted: true, style: { fontFamily: "monospace", wordBreak: "break-all" }, children: latest.url })
|
|
672
862
|
] }),
|
|
673
|
-
safeHref(latest?.inspectorUrl) && /* @__PURE__ */ (0,
|
|
674
|
-
/* @__PURE__ */ (0,
|
|
675
|
-
/* @__PURE__ */ (0,
|
|
676
|
-
/* @__PURE__ */ (0,
|
|
677
|
-
/* @__PURE__ */ (0,
|
|
863
|
+
safeHref(latest?.inspectorUrl) && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_ui5.Flex, { gap: 2, align: "center", children: [
|
|
864
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_ui5.Text, { size: 0, muted: true, weight: "semibold", style: { minWidth: LABEL_WIDTH }, children: "Inspector" }),
|
|
865
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("a", { href: safeHref(latest?.inspectorUrl), target: "_blank", rel: "noreferrer", style: { color: "inherit" }, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_ui5.Flex, { align: "center", gap: 1, children: [
|
|
866
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_ui5.Text, { size: 0, muted: true, style: { fontFamily: "monospace" }, children: "Open in Vercel" }),
|
|
867
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(LaunchIcon, { style: { width: 10, height: 10 } })
|
|
678
868
|
] }) })
|
|
679
869
|
] }),
|
|
680
|
-
latest?.created && /* @__PURE__ */ (0,
|
|
681
|
-
/* @__PURE__ */ (0,
|
|
682
|
-
/* @__PURE__ */ (0,
|
|
870
|
+
latest?.created && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_ui5.Flex, { gap: 2, align: "center", children: [
|
|
871
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_ui5.Text, { size: 0, muted: true, weight: "semibold", style: { minWidth: LABEL_WIDTH }, children: "Created" }),
|
|
872
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_ui5.Text, { size: 0, muted: true, children: new Date(latest.created).toLocaleString() })
|
|
683
873
|
] })
|
|
684
874
|
] }) })
|
|
685
875
|
] })
|
|
686
876
|
] }),
|
|
687
|
-
/* @__PURE__ */ (0,
|
|
688
|
-
|
|
877
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
878
|
+
import_ui5.Flex,
|
|
689
879
|
{
|
|
690
880
|
direction: "column",
|
|
691
881
|
gap: 2,
|
|
692
882
|
className: "dvfs-deploy-col",
|
|
693
883
|
style: { flexShrink: 0, alignSelf: "stretch" },
|
|
694
|
-
children: /* @__PURE__ */ (0,
|
|
695
|
-
|
|
884
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
885
|
+
import_ui5.Button,
|
|
696
886
|
{
|
|
697
887
|
text: "Deploy",
|
|
698
888
|
tone: "primary",
|
|
889
|
+
loading: isPending,
|
|
699
890
|
disabled: isActive,
|
|
700
891
|
onClick: deploy,
|
|
701
892
|
style: {
|
|
@@ -710,7 +901,7 @@ function DeployItem({ target, token, onDelete, onEdit }) {
|
|
|
710
901
|
}
|
|
711
902
|
)
|
|
712
903
|
] }) }),
|
|
713
|
-
showHistory && /* @__PURE__ */ (0,
|
|
904
|
+
showHistory && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
714
905
|
DeployHistory,
|
|
715
906
|
{
|
|
716
907
|
target,
|
|
@@ -722,18 +913,17 @@ function DeployItem({ target, token, onDelete, onEdit }) {
|
|
|
722
913
|
}
|
|
723
914
|
|
|
724
915
|
// src/components/TokenSetup.tsx
|
|
725
|
-
var
|
|
916
|
+
var import_react5 = require("react");
|
|
726
917
|
var import_sanity = require("sanity");
|
|
727
|
-
var
|
|
728
|
-
var
|
|
729
|
-
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
918
|
+
var import_ui7 = require("@sanity/ui");
|
|
919
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
730
920
|
var TOKEN_DOC_ID = "config.vercelDeploy";
|
|
731
921
|
function TokenSetup({ onSaved, onCancel }) {
|
|
732
922
|
const client = (0, import_sanity.useClient)({ apiVersion: "2025-01-01" });
|
|
733
|
-
const [token, setToken] = (0,
|
|
734
|
-
const [saving, setSaving] = (0,
|
|
735
|
-
const [error, setError] = (0,
|
|
736
|
-
const save = (0,
|
|
923
|
+
const [token, setToken] = (0, import_react5.useState)("");
|
|
924
|
+
const [saving, setSaving] = (0, import_react5.useState)(false);
|
|
925
|
+
const [error, setError] = (0, import_react5.useState)(null);
|
|
926
|
+
const save = (0, import_react5.useCallback)(async () => {
|
|
737
927
|
if (!token.trim()) return;
|
|
738
928
|
setSaving(true);
|
|
739
929
|
setError(null);
|
|
@@ -750,21 +940,21 @@ function TokenSetup({ onSaved, onCancel }) {
|
|
|
750
940
|
setSaving(false);
|
|
751
941
|
}
|
|
752
942
|
}, [client, token, onSaved]);
|
|
753
|
-
return /* @__PURE__ */ (0,
|
|
754
|
-
|
|
943
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
944
|
+
import_ui7.Dialog,
|
|
755
945
|
{
|
|
756
946
|
header: "Connect Vercel API token",
|
|
757
947
|
id: "token-setup",
|
|
758
948
|
onClose: onCancel,
|
|
759
949
|
width: 1,
|
|
760
|
-
footer: /* @__PURE__ */ (0,
|
|
761
|
-
onCancel && /* @__PURE__ */ (0,
|
|
762
|
-
/* @__PURE__ */ (0,
|
|
763
|
-
|
|
950
|
+
footer: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_ui7.Flex, { padding: 3, gap: 2, justify: "flex-end", children: [
|
|
951
|
+
onCancel && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_ui7.Button, { text: "Cancel", mode: "ghost", onClick: onCancel, style: { cursor: "pointer" } }),
|
|
952
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
953
|
+
import_ui7.Button,
|
|
764
954
|
{
|
|
765
955
|
text: "Save and connect",
|
|
766
956
|
tone: "primary",
|
|
767
|
-
icon:
|
|
957
|
+
icon: CheckmarkCircleIcon,
|
|
768
958
|
loading: saving,
|
|
769
959
|
disabled: !token.trim() || saving,
|
|
770
960
|
onClick: save,
|
|
@@ -772,22 +962,22 @@ function TokenSetup({ onSaved, onCancel }) {
|
|
|
772
962
|
}
|
|
773
963
|
)
|
|
774
964
|
] }),
|
|
775
|
-
children: /* @__PURE__ */ (0,
|
|
776
|
-
/* @__PURE__ */ (0,
|
|
777
|
-
/* @__PURE__ */ (0,
|
|
778
|
-
/* @__PURE__ */ (0,
|
|
965
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Stack, { space: 4, padding: 4, children: [
|
|
966
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Stack, { space: 3, children: [
|
|
967
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_ui7.Text, { size: 1, muted: true, children: "A Vercel API token lets this tool read deployment status, history, build logs, and branch metadata. Without it you can still trigger deploys \u2014 you just won't see any feedback." }),
|
|
968
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_ui7.Text, { size: 1, muted: true, children: [
|
|
779
969
|
"Create one at ",
|
|
780
|
-
/* @__PURE__ */ (0,
|
|
970
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("strong", { children: "vercel.com \u2192 Settings \u2192 Tokens" }),
|
|
781
971
|
" with",
|
|
782
972
|
" ",
|
|
783
|
-
/* @__PURE__ */ (0,
|
|
973
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("strong", { children: "Full Account" }),
|
|
784
974
|
" scope. The token is stored in your Sanity dataset and shared across all authenticated studio users."
|
|
785
975
|
] })
|
|
786
976
|
] }),
|
|
787
|
-
/* @__PURE__ */ (0,
|
|
788
|
-
/* @__PURE__ */ (0,
|
|
789
|
-
/* @__PURE__ */ (0,
|
|
790
|
-
|
|
977
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Stack, { space: 2, children: [
|
|
978
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_ui7.Text, { size: 1, weight: "semibold", children: "Vercel API Token" }),
|
|
979
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
980
|
+
import_ui7.TextInput,
|
|
791
981
|
{
|
|
792
982
|
value: token,
|
|
793
983
|
onChange: (e) => setToken(e.target.value),
|
|
@@ -796,38 +986,37 @@ function TokenSetup({ onSaved, onCancel }) {
|
|
|
796
986
|
}
|
|
797
987
|
)
|
|
798
988
|
] }),
|
|
799
|
-
error && /* @__PURE__ */ (0,
|
|
989
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_ui7.Card, { tone: "critical", padding: 3, radius: 2, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_ui7.Text, { size: 1, children: error }) })
|
|
800
990
|
] })
|
|
801
991
|
}
|
|
802
992
|
);
|
|
803
993
|
}
|
|
804
994
|
|
|
805
995
|
// src/components/DeployTargetForm.tsx
|
|
806
|
-
var
|
|
996
|
+
var import_react6 = require("react");
|
|
807
997
|
var import_sanity2 = require("sanity");
|
|
808
|
-
var
|
|
809
|
-
var
|
|
810
|
-
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
998
|
+
var import_ui9 = require("@sanity/ui");
|
|
999
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
811
1000
|
var VERCEL_HOOK_RE2 = /^https:\/\/api\.vercel\.com\/v1\/integrations\/deploy\//;
|
|
812
1001
|
function DeployTargetForm({ initial, onSaved, onClose }) {
|
|
813
1002
|
const client = (0, import_sanity2.useClient)({ apiVersion: "2025-01-01" });
|
|
814
1003
|
const isEdit = Boolean(initial);
|
|
815
|
-
const [name, setName] = (0,
|
|
816
|
-
const [url, setUrl] = (0,
|
|
817
|
-
const [teamId, setTeamId] = (0,
|
|
818
|
-
const [disableDelete, setDisableDelete] = (0,
|
|
819
|
-
const [saving, setSaving] = (0,
|
|
820
|
-
const [error, setError] = (0,
|
|
1004
|
+
const [name, setName] = (0, import_react6.useState)(initial?.name ?? "");
|
|
1005
|
+
const [url, setUrl] = (0, import_react6.useState)(initial?.url ?? "");
|
|
1006
|
+
const [teamId, setTeamId] = (0, import_react6.useState)(initial?.teamId ?? "");
|
|
1007
|
+
const [disableDelete, setDisableDelete] = (0, import_react6.useState)(initial?.disableDeleteAction ?? false);
|
|
1008
|
+
const [saving, setSaving] = (0, import_react6.useState)(false);
|
|
1009
|
+
const [error, setError] = (0, import_react6.useState)(null);
|
|
821
1010
|
const urlValid = !url || VERCEL_HOOK_RE2.test(url.trim());
|
|
822
1011
|
const canSave = name.trim() && url.trim() && urlValid;
|
|
823
|
-
const save = (0,
|
|
1012
|
+
const save = (0, import_react6.useCallback)(async () => {
|
|
824
1013
|
if (!canSave) return;
|
|
825
1014
|
setSaving(true);
|
|
826
1015
|
setError(null);
|
|
827
1016
|
const fields = {
|
|
828
1017
|
name: name.trim(),
|
|
829
1018
|
url: url.trim(),
|
|
830
|
-
|
|
1019
|
+
teamId: teamId.trim() || null,
|
|
831
1020
|
disableDeleteAction: disableDelete
|
|
832
1021
|
};
|
|
833
1022
|
try {
|
|
@@ -843,21 +1032,21 @@ function DeployTargetForm({ initial, onSaved, onClose }) {
|
|
|
843
1032
|
setSaving(false);
|
|
844
1033
|
}
|
|
845
1034
|
}, [canSave, isEdit, initial, client, name, url, teamId, disableDelete, onSaved]);
|
|
846
|
-
return /* @__PURE__ */ (0,
|
|
847
|
-
|
|
1035
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1036
|
+
import_ui9.Dialog,
|
|
848
1037
|
{
|
|
849
1038
|
header: isEdit ? `Edit "${initial?.name}"` : "Add deploy target",
|
|
850
1039
|
id: "deploy-target-form",
|
|
851
1040
|
onClose,
|
|
852
1041
|
width: 1,
|
|
853
|
-
footer: /* @__PURE__ */ (0,
|
|
854
|
-
/* @__PURE__ */ (0,
|
|
855
|
-
/* @__PURE__ */ (0,
|
|
856
|
-
|
|
1042
|
+
footer: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_ui9.Flex, { padding: 3, gap: 2, justify: "flex-end", children: [
|
|
1043
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_ui9.Button, { text: "Cancel", mode: "ghost", onClick: onClose, style: { cursor: "pointer" } }),
|
|
1044
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1045
|
+
import_ui9.Button,
|
|
857
1046
|
{
|
|
858
1047
|
text: isEdit ? "Save changes" : "Add target",
|
|
859
1048
|
tone: "primary",
|
|
860
|
-
icon:
|
|
1049
|
+
icon: CheckmarkCircleIcon,
|
|
861
1050
|
loading: saving,
|
|
862
1051
|
disabled: !canSave || saving,
|
|
863
1052
|
onClick: save,
|
|
@@ -865,14 +1054,14 @@ function DeployTargetForm({ initial, onSaved, onClose }) {
|
|
|
865
1054
|
}
|
|
866
1055
|
)
|
|
867
1056
|
] }),
|
|
868
|
-
children: /* @__PURE__ */ (0,
|
|
869
|
-
/* @__PURE__ */ (0,
|
|
870
|
-
/* @__PURE__ */ (0,
|
|
1057
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_ui9.Box, { padding: 4, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Stack, { space: 4, children: [
|
|
1058
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Stack, { space: 2, children: [
|
|
1059
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_ui9.Label, { size: 1, children: [
|
|
871
1060
|
"Name ",
|
|
872
|
-
/* @__PURE__ */ (0,
|
|
1061
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { style: { color: "var(--card-fg-color)" }, children: "*" })
|
|
873
1062
|
] }),
|
|
874
|
-
/* @__PURE__ */ (0,
|
|
875
|
-
|
|
1063
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1064
|
+
import_ui9.TextInput,
|
|
876
1065
|
{
|
|
877
1066
|
value: name,
|
|
878
1067
|
onChange: (e) => setName(e.target.value),
|
|
@@ -880,80 +1069,80 @@ function DeployTargetForm({ initial, onSaved, onClose }) {
|
|
|
880
1069
|
}
|
|
881
1070
|
)
|
|
882
1071
|
] }),
|
|
883
|
-
/* @__PURE__ */ (0,
|
|
884
|
-
/* @__PURE__ */ (0,
|
|
1072
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Stack, { space: 2, children: [
|
|
1073
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_ui9.Label, { size: 1, children: [
|
|
885
1074
|
"Deploy hook URL ",
|
|
886
|
-
/* @__PURE__ */ (0,
|
|
1075
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { style: { color: "var(--card-fg-color)" }, children: "*" })
|
|
887
1076
|
] }),
|
|
888
|
-
/* @__PURE__ */ (0,
|
|
889
|
-
|
|
1077
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1078
|
+
import_ui9.TextInput,
|
|
890
1079
|
{
|
|
891
1080
|
value: url,
|
|
892
1081
|
onChange: (e) => setUrl(e.target.value),
|
|
893
1082
|
placeholder: "https://api.vercel.com/v1/integrations/deploy/\u2026"
|
|
894
1083
|
}
|
|
895
1084
|
),
|
|
896
|
-
url && !urlValid && /* @__PURE__ */ (0,
|
|
897
|
-
/* @__PURE__ */ (0,
|
|
1085
|
+
url && !urlValid && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_ui9.Text, { size: 1, style: { color: "var(--card-critical-fg-color, red)" }, children: "Must be a Vercel deploy hook URL (api.vercel.com/v1/integrations/deploy/\u2026)" }),
|
|
1086
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_ui9.Text, { size: 0, muted: true, children: "Vercel dashboard \u2192 Project \u2192 Settings \u2192 Git \u2192 Deploy Hooks" })
|
|
898
1087
|
] }),
|
|
899
|
-
/* @__PURE__ */ (0,
|
|
900
|
-
/* @__PURE__ */ (0,
|
|
1088
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Stack, { space: 2, children: [
|
|
1089
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_ui9.Label, { size: 1, children: [
|
|
901
1090
|
"Team ID ",
|
|
902
|
-
/* @__PURE__ */ (0,
|
|
1091
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { style: { opacity: 0.5, fontWeight: "normal" }, children: "\u2014 optional" })
|
|
903
1092
|
] }),
|
|
904
|
-
/* @__PURE__ */ (0,
|
|
905
|
-
|
|
1093
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1094
|
+
import_ui9.TextInput,
|
|
906
1095
|
{
|
|
907
1096
|
value: teamId,
|
|
908
1097
|
onChange: (e) => setTeamId(e.target.value),
|
|
909
1098
|
placeholder: "team_xxxxxxxx"
|
|
910
1099
|
}
|
|
911
1100
|
),
|
|
912
|
-
/* @__PURE__ */ (0,
|
|
1101
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_ui9.Text, { size: 0, muted: true, children: [
|
|
913
1102
|
"Required for team-owned Vercel projects. Find it at Vercel \u2192 Settings \u2192 General \u2192 Team ID (starts with ",
|
|
914
|
-
/* @__PURE__ */ (0,
|
|
1103
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("code", { children: "team_" }),
|
|
915
1104
|
")."
|
|
916
1105
|
] })
|
|
917
1106
|
] }),
|
|
918
|
-
/* @__PURE__ */ (0,
|
|
919
|
-
/* @__PURE__ */ (0,
|
|
920
|
-
|
|
1107
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_ui9.Flex, { align: "center", gap: 3, children: [
|
|
1108
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1109
|
+
import_ui9.Switch,
|
|
921
1110
|
{
|
|
922
1111
|
checked: disableDelete,
|
|
923
1112
|
onChange: (e) => setDisableDelete(e.target.checked),
|
|
924
1113
|
id: "disable-delete"
|
|
925
1114
|
}
|
|
926
1115
|
),
|
|
927
|
-
/* @__PURE__ */ (0,
|
|
928
|
-
/* @__PURE__ */ (0,
|
|
929
|
-
/* @__PURE__ */ (0,
|
|
1116
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Stack, { space: 1, children: [
|
|
1117
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_ui9.Label, { as: "label", size: 1, htmlFor: "disable-delete", children: "Disable delete action" }),
|
|
1118
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_ui9.Text, { size: 0, muted: true, children: "Hides the delete button for this target in the studio." })
|
|
930
1119
|
] })
|
|
931
1120
|
] }),
|
|
932
|
-
error && /* @__PURE__ */ (0,
|
|
1121
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_ui9.Card, { tone: "critical", padding: 3, radius: 2, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_ui9.Text, { size: 1, children: error }) })
|
|
933
1122
|
] }) })
|
|
934
1123
|
}
|
|
935
1124
|
);
|
|
936
1125
|
}
|
|
937
1126
|
|
|
938
1127
|
// src/version.ts
|
|
939
|
-
var VERSION = "1.0
|
|
1128
|
+
var VERSION = "1.1.0";
|
|
940
1129
|
|
|
941
1130
|
// src/components/DeployTool.tsx
|
|
942
|
-
var
|
|
1131
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
943
1132
|
var TOKEN_QUERY = `*[_id == "config.vercelDeploy"][0].accessToken`;
|
|
944
1133
|
var TARGETS_QUERY = `*[_type == "vercel_deploy"] | order(_createdAt asc)`;
|
|
945
1134
|
function DeployTool() {
|
|
946
1135
|
const client = (0, import_sanity3.useClient)({ apiVersion: "2025-01-01" });
|
|
947
|
-
const toast =
|
|
948
|
-
const [token, setToken] = (0,
|
|
949
|
-
const [targets, setTargets] = (0,
|
|
950
|
-
const [loading, setLoading] = (0,
|
|
951
|
-
const [showTokenSetup, setShowTokenSetup] = (0,
|
|
952
|
-
const [showCreateForm, setShowCreateForm] = (0,
|
|
953
|
-
const [pendingEdit, setPendingEdit] = (0,
|
|
954
|
-
const [pendingDelete, setPendingDelete] = (0,
|
|
955
|
-
const [deleting, setDeleting] = (0,
|
|
956
|
-
const load = (0,
|
|
1136
|
+
const toast = useToast();
|
|
1137
|
+
const [token, setToken] = (0, import_react7.useState)(null);
|
|
1138
|
+
const [targets, setTargets] = (0, import_react7.useState)([]);
|
|
1139
|
+
const [loading, setLoading] = (0, import_react7.useState)(true);
|
|
1140
|
+
const [showTokenSetup, setShowTokenSetup] = (0, import_react7.useState)(false);
|
|
1141
|
+
const [showCreateForm, setShowCreateForm] = (0, import_react7.useState)(false);
|
|
1142
|
+
const [pendingEdit, setPendingEdit] = (0, import_react7.useState)(null);
|
|
1143
|
+
const [pendingDelete, setPendingDelete] = (0, import_react7.useState)(null);
|
|
1144
|
+
const [deleting, setDeleting] = (0, import_react7.useState)(false);
|
|
1145
|
+
const load = (0, import_react7.useCallback)(async () => {
|
|
957
1146
|
setLoading(true);
|
|
958
1147
|
try {
|
|
959
1148
|
const [fetchedToken, fetchedTargets] = await Promise.all([
|
|
@@ -968,10 +1157,10 @@ function DeployTool() {
|
|
|
968
1157
|
setLoading(false);
|
|
969
1158
|
}
|
|
970
1159
|
}, [client]);
|
|
971
|
-
(0,
|
|
1160
|
+
(0, import_react7.useEffect)(() => {
|
|
972
1161
|
load();
|
|
973
1162
|
}, [load]);
|
|
974
|
-
(0,
|
|
1163
|
+
(0, import_react7.useEffect)(() => {
|
|
975
1164
|
if (document.getElementById("dvfs-styles")) return;
|
|
976
1165
|
const style = document.createElement("style");
|
|
977
1166
|
style.id = "dvfs-styles";
|
|
@@ -997,7 +1186,7 @@ function DeployTool() {
|
|
|
997
1186
|
document.getElementById("dvfs-styles")?.remove();
|
|
998
1187
|
};
|
|
999
1188
|
}, []);
|
|
1000
|
-
(0,
|
|
1189
|
+
(0, import_react7.useEffect)(() => {
|
|
1001
1190
|
const sub = client.listen(TARGETS_QUERY).subscribe(() => {
|
|
1002
1191
|
client.fetch(TARGETS_QUERY).then(setTargets).catch((err) => {
|
|
1003
1192
|
console.error("deploy-vercel-from-sanity: subscription refresh error", err);
|
|
@@ -1005,7 +1194,7 @@ function DeployTool() {
|
|
|
1005
1194
|
});
|
|
1006
1195
|
return () => sub.unsubscribe();
|
|
1007
1196
|
}, [client]);
|
|
1008
|
-
const confirmDelete = (0,
|
|
1197
|
+
const confirmDelete = (0, import_react7.useCallback)(async () => {
|
|
1009
1198
|
if (!pendingDelete) return;
|
|
1010
1199
|
setDeleting(true);
|
|
1011
1200
|
try {
|
|
@@ -1020,31 +1209,31 @@ function DeployTool() {
|
|
|
1020
1209
|
}
|
|
1021
1210
|
}, [client, pendingDelete, toast]);
|
|
1022
1211
|
if (loading) {
|
|
1023
|
-
return /* @__PURE__ */ (0,
|
|
1212
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_ui11.Card, { height: "fill", tone: "transparent", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_ui11.Flex, { align: "center", justify: "center", height: "fill", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_ui11.Spinner, { muted: true }) }) });
|
|
1024
1213
|
}
|
|
1025
|
-
return /* @__PURE__ */ (0,
|
|
1026
|
-
/* @__PURE__ */ (0,
|
|
1027
|
-
/* @__PURE__ */ (0,
|
|
1028
|
-
/* @__PURE__ */ (0,
|
|
1029
|
-
/* @__PURE__ */ (0,
|
|
1030
|
-
/* @__PURE__ */ (0,
|
|
1031
|
-
|
|
1214
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_ui11.Card, { height: "fill", tone: "transparent", children: [
|
|
1215
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_ui11.Box, { padding: 5, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Stack, { space: 5, children: [
|
|
1216
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_ui11.Flex, { align: "center", justify: "space-between", className: "dvfs-header", children: [
|
|
1217
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_ui11.Heading, { size: 2, children: "Deploy with Vercel" }),
|
|
1218
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_ui11.Flex, { align: "center", gap: 3, className: "dvfs-header-actions", children: [
|
|
1219
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1220
|
+
import_ui11.Button,
|
|
1032
1221
|
{
|
|
1033
1222
|
text: token ? "Token connected" : "Connect API token",
|
|
1034
1223
|
mode: "ghost",
|
|
1035
|
-
icon:
|
|
1224
|
+
icon: TokenIcon,
|
|
1036
1225
|
fontSize: 1,
|
|
1037
1226
|
tone: token ? "positive" : "caution",
|
|
1038
1227
|
onClick: () => setShowTokenSetup(true),
|
|
1039
1228
|
style: { cursor: "pointer" }
|
|
1040
1229
|
}
|
|
1041
1230
|
),
|
|
1042
|
-
/* @__PURE__ */ (0,
|
|
1043
|
-
|
|
1231
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1232
|
+
import_ui11.Button,
|
|
1044
1233
|
{
|
|
1045
1234
|
text: "Add target",
|
|
1046
1235
|
mode: "ghost",
|
|
1047
|
-
icon:
|
|
1236
|
+
icon: AddIcon,
|
|
1048
1237
|
fontSize: 1,
|
|
1049
1238
|
onClick: () => setShowCreateForm(true),
|
|
1050
1239
|
style: { cursor: "pointer" }
|
|
@@ -1052,13 +1241,13 @@ function DeployTool() {
|
|
|
1052
1241
|
)
|
|
1053
1242
|
] })
|
|
1054
1243
|
] }),
|
|
1055
|
-
!token && /* @__PURE__ */ (0,
|
|
1056
|
-
/* @__PURE__ */ (0,
|
|
1057
|
-
/* @__PURE__ */ (0,
|
|
1058
|
-
/* @__PURE__ */ (0,
|
|
1244
|
+
!token && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_ui11.Card, { padding: 4, radius: 2, tone: "caution", shadow: 1, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_ui11.Flex, { align: "center", justify: "space-between", gap: 4, children: [
|
|
1245
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Stack, { space: 2, children: [
|
|
1246
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_ui11.Text, { size: 1, weight: "semibold", children: "Deploy status is not connected" }),
|
|
1247
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_ui11.Text, { size: 1, muted: true, children: "You can trigger deploys now. Connect a Vercel API token to also see deployment status, build logs, history, and commit metadata." })
|
|
1059
1248
|
] }),
|
|
1060
|
-
/* @__PURE__ */ (0,
|
|
1061
|
-
|
|
1249
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1250
|
+
import_ui11.Button,
|
|
1062
1251
|
{
|
|
1063
1252
|
text: "Connect",
|
|
1064
1253
|
tone: "caution",
|
|
@@ -1068,31 +1257,31 @@ function DeployTool() {
|
|
|
1068
1257
|
}
|
|
1069
1258
|
)
|
|
1070
1259
|
] }) }),
|
|
1071
|
-
targets.length === 0 && /* @__PURE__ */ (0,
|
|
1072
|
-
/* @__PURE__ */ (0,
|
|
1073
|
-
/* @__PURE__ */ (0,
|
|
1260
|
+
targets.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_ui11.Card, { padding: 5, radius: 2, tone: "transparent", shadow: 1, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Stack, { space: 4, style: { textAlign: "center" }, children: [
|
|
1261
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_ui11.Text, { size: 2, weight: "semibold", children: "No deploy targets configured" }),
|
|
1262
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_ui11.Text, { size: 1, muted: true, children: [
|
|
1074
1263
|
"Add a deploy target using the button above, or create a",
|
|
1075
1264
|
" ",
|
|
1076
|
-
/* @__PURE__ */ (0,
|
|
1265
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("code", { children: "vercel_deploy" }),
|
|
1077
1266
|
" document directly in the dataset."
|
|
1078
1267
|
] }),
|
|
1079
|
-
/* @__PURE__ */ (0,
|
|
1080
|
-
|
|
1268
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_ui11.Flex, { justify: "center", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1269
|
+
import_ui11.Button,
|
|
1081
1270
|
{
|
|
1082
1271
|
text: "Add deploy target",
|
|
1083
1272
|
tone: "primary",
|
|
1084
|
-
icon:
|
|
1273
|
+
icon: AddIcon,
|
|
1085
1274
|
onClick: () => setShowCreateForm(true),
|
|
1086
1275
|
style: { cursor: "pointer" }
|
|
1087
1276
|
}
|
|
1088
1277
|
) })
|
|
1089
1278
|
] }) }),
|
|
1090
|
-
targets.length > 0 && /* @__PURE__ */ (0,
|
|
1279
|
+
targets.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "dvfs-grid", style: {
|
|
1091
1280
|
display: "grid",
|
|
1092
1281
|
gridTemplateColumns: "repeat(auto-fill, minmax(min(540px, 100%), 1fr))",
|
|
1093
1282
|
gap: "16px",
|
|
1094
1283
|
alignItems: "start"
|
|
1095
|
-
}, children: targets.map((target) => /* @__PURE__ */ (0,
|
|
1284
|
+
}, children: targets.map((target) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1096
1285
|
DeployItem,
|
|
1097
1286
|
{
|
|
1098
1287
|
target,
|
|
@@ -1103,8 +1292,8 @@ function DeployTool() {
|
|
|
1103
1292
|
target._id
|
|
1104
1293
|
)) })
|
|
1105
1294
|
] }) }),
|
|
1106
|
-
/* @__PURE__ */ (0,
|
|
1107
|
-
|
|
1295
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1296
|
+
import_ui11.Box,
|
|
1108
1297
|
{
|
|
1109
1298
|
style: {
|
|
1110
1299
|
position: "fixed",
|
|
@@ -1114,13 +1303,13 @@ function DeployTool() {
|
|
|
1114
1303
|
pointerEvents: "none",
|
|
1115
1304
|
userSelect: "none"
|
|
1116
1305
|
},
|
|
1117
|
-
children: /* @__PURE__ */ (0,
|
|
1306
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_ui11.Text, { size: 0, muted: true, children: [
|
|
1118
1307
|
"v",
|
|
1119
1308
|
VERSION
|
|
1120
1309
|
] })
|
|
1121
1310
|
}
|
|
1122
1311
|
),
|
|
1123
|
-
showTokenSetup && /* @__PURE__ */ (0,
|
|
1312
|
+
showTokenSetup && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1124
1313
|
TokenSetup,
|
|
1125
1314
|
{
|
|
1126
1315
|
onSaved: () => {
|
|
@@ -1130,7 +1319,7 @@ function DeployTool() {
|
|
|
1130
1319
|
onCancel: token ? () => setShowTokenSetup(false) : void 0
|
|
1131
1320
|
}
|
|
1132
1321
|
),
|
|
1133
|
-
showCreateForm && /* @__PURE__ */ (0,
|
|
1322
|
+
showCreateForm && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1134
1323
|
DeployTargetForm,
|
|
1135
1324
|
{
|
|
1136
1325
|
onSaved: () => {
|
|
@@ -1140,7 +1329,7 @@ function DeployTool() {
|
|
|
1140
1329
|
onClose: () => setShowCreateForm(false)
|
|
1141
1330
|
}
|
|
1142
1331
|
),
|
|
1143
|
-
pendingEdit && /* @__PURE__ */ (0,
|
|
1332
|
+
pendingEdit && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1144
1333
|
DeployTargetForm,
|
|
1145
1334
|
{
|
|
1146
1335
|
initial: pendingEdit,
|
|
@@ -1151,16 +1340,16 @@ function DeployTool() {
|
|
|
1151
1340
|
onClose: () => setPendingEdit(null)
|
|
1152
1341
|
}
|
|
1153
1342
|
),
|
|
1154
|
-
pendingDelete && /* @__PURE__ */ (0,
|
|
1155
|
-
|
|
1343
|
+
pendingDelete && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1344
|
+
import_ui11.Dialog,
|
|
1156
1345
|
{
|
|
1157
1346
|
header: "Delete deploy target?",
|
|
1158
1347
|
id: "confirm-delete",
|
|
1159
1348
|
onClose: () => setPendingDelete(null),
|
|
1160
1349
|
width: 1,
|
|
1161
|
-
footer: /* @__PURE__ */ (0,
|
|
1162
|
-
/* @__PURE__ */ (0,
|
|
1163
|
-
|
|
1350
|
+
footer: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_ui11.Flex, { padding: 3, gap: 2, justify: "flex-end", children: [
|
|
1351
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1352
|
+
import_ui11.Button,
|
|
1164
1353
|
{
|
|
1165
1354
|
text: "Cancel",
|
|
1166
1355
|
mode: "ghost",
|
|
@@ -1168,12 +1357,12 @@ function DeployTool() {
|
|
|
1168
1357
|
style: { cursor: "pointer" }
|
|
1169
1358
|
}
|
|
1170
1359
|
),
|
|
1171
|
-
/* @__PURE__ */ (0,
|
|
1172
|
-
|
|
1360
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1361
|
+
import_ui11.Button,
|
|
1173
1362
|
{
|
|
1174
1363
|
text: "Delete",
|
|
1175
1364
|
tone: "critical",
|
|
1176
|
-
icon:
|
|
1365
|
+
icon: TrashIcon,
|
|
1177
1366
|
loading: deleting,
|
|
1178
1367
|
disabled: deleting,
|
|
1179
1368
|
onClick: confirmDelete,
|
|
@@ -1181,26 +1370,26 @@ function DeployTool() {
|
|
|
1181
1370
|
}
|
|
1182
1371
|
)
|
|
1183
1372
|
] }),
|
|
1184
|
-
children: /* @__PURE__ */ (0,
|
|
1185
|
-
/* @__PURE__ */ (0,
|
|
1186
|
-
/* @__PURE__ */ (0,
|
|
1187
|
-
/* @__PURE__ */ (0,
|
|
1373
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_ui11.Box, { padding: 4, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Stack, { space: 3, children: [
|
|
1374
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_ui11.Flex, { align: "center", gap: 2, children: [
|
|
1375
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(WarningOutlineIcon, {}),
|
|
1376
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_ui11.Text, { size: 2, weight: "semibold", children: pendingDelete.name })
|
|
1188
1377
|
] }),
|
|
1189
|
-
/* @__PURE__ */ (0,
|
|
1378
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_ui11.Text, { size: 1, muted: true, children: "This removes the deploy target from the dataset. The Vercel deploy hook itself is not affected." })
|
|
1190
1379
|
] }) })
|
|
1191
1380
|
}
|
|
1192
|
-
)
|
|
1381
|
+
),
|
|
1382
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(ToastViewport, {})
|
|
1193
1383
|
] });
|
|
1194
1384
|
}
|
|
1195
1385
|
|
|
1196
1386
|
// src/schema/vercelDeploy.ts
|
|
1197
1387
|
var import_sanity4 = require("sanity");
|
|
1198
|
-
var import_icons6 = require("@sanity/icons");
|
|
1199
1388
|
var vercelDeploySchema = (0, import_sanity4.defineType)({
|
|
1200
1389
|
name: "vercel_deploy",
|
|
1201
1390
|
title: "Deploy Target",
|
|
1202
1391
|
type: "document",
|
|
1203
|
-
icon:
|
|
1392
|
+
icon: RocketIcon,
|
|
1204
1393
|
fields: [
|
|
1205
1394
|
(0, import_sanity4.defineField)({
|
|
1206
1395
|
name: "name",
|
|
@@ -1253,7 +1442,7 @@ var vercelDeploy = (0, import_sanity5.definePlugin)((options) => {
|
|
|
1253
1442
|
{
|
|
1254
1443
|
name: config.name ?? "vercel-deploy",
|
|
1255
1444
|
title: config.title ?? "Deploy",
|
|
1256
|
-
icon: config.icon ??
|
|
1445
|
+
icon: config.icon ?? RocketIcon,
|
|
1257
1446
|
component: DeployTool
|
|
1258
1447
|
}
|
|
1259
1448
|
]
|