@liiift-studio/deploy-vercel-from-sanity 1.0.10 → 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 +568 -393
- package/dist/index.mjs +565 -415
- package/package.json +8 -5
- package/src/components/DeployHistory.tsx +3 -2
- package/src/components/DeployItem.tsx +21 -65
- 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,31 +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;
|
|
286
520
|
var PENDING_TIMEOUT_MS = 6e4;
|
|
287
521
|
function DeployItem({ target, token, onDelete, onEdit }) {
|
|
288
522
|
const { projectId, hookId } = parseHookUrl(target.url);
|
|
289
|
-
const toast =
|
|
290
|
-
const [deployments, setDeployments] = (0,
|
|
291
|
-
const [loadingInitial, setLoadingInitial] = (0,
|
|
292
|
-
const [pendingSince, setPendingSince] = (0,
|
|
293
|
-
const [canceling, setCanceling] = (0,
|
|
294
|
-
const [deployError, setDeployError] = (0,
|
|
295
|
-
const [showHistory, setShowHistory] = (0,
|
|
296
|
-
const [elapsed, setElapsed] = (0,
|
|
297
|
-
const [copied, setCopied] = (0,
|
|
298
|
-
const [showDetails, setShowDetails] = (0,
|
|
299
|
-
const [showErrorLogs, setShowErrorLogs] = (0,
|
|
300
|
-
const [errorLines, setErrorLines] = (0,
|
|
301
|
-
const [loadingLogs, setLoadingLogs] = (0,
|
|
302
|
-
const [logError, setLogError] = (0,
|
|
303
|
-
const triggeredFromUidRef = (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);
|
|
304
538
|
const latest = deployments[0];
|
|
305
539
|
const isPending = pendingSince !== null;
|
|
306
540
|
const isActive = isPending || isActiveState(latest?.state);
|
|
307
|
-
const fetchDeployments = (0,
|
|
541
|
+
const fetchDeployments = (0, import_react4.useCallback)(async () => {
|
|
308
542
|
if (!projectId || !hookId || !token) return;
|
|
309
543
|
try {
|
|
310
544
|
const data = await listDeployments({ projectId, hookId, token, teamId: target.teamId });
|
|
@@ -313,25 +547,25 @@ function DeployItem({ target, token, onDelete, onEdit }) {
|
|
|
313
547
|
console.error("deploy-vercel-from-sanity: fetch error", err);
|
|
314
548
|
}
|
|
315
549
|
}, [projectId, hookId, token, target.teamId]);
|
|
316
|
-
(0,
|
|
550
|
+
(0, import_react4.useEffect)(() => {
|
|
317
551
|
fetchDeployments().finally(() => setLoadingInitial(false));
|
|
318
552
|
}, [fetchDeployments]);
|
|
319
|
-
(0,
|
|
553
|
+
(0, import_react4.useEffect)(() => {
|
|
320
554
|
if (!isActive) return;
|
|
321
555
|
const id = setInterval(fetchDeployments, POLL_INTERVAL_MS);
|
|
322
556
|
return () => clearInterval(id);
|
|
323
557
|
}, [isActive, fetchDeployments]);
|
|
324
|
-
(0,
|
|
558
|
+
(0, import_react4.useEffect)(() => {
|
|
325
559
|
if (!isPending) return;
|
|
326
560
|
if (latest?.uid && latest.uid !== triggeredFromUidRef.current) setPendingSince(null);
|
|
327
561
|
}, [isPending, latest?.uid]);
|
|
328
|
-
(0,
|
|
562
|
+
(0, import_react4.useEffect)(() => {
|
|
329
563
|
if (!isPending) return;
|
|
330
564
|
const id = setTimeout(() => setPendingSince(null), PENDING_TIMEOUT_MS);
|
|
331
565
|
return () => clearTimeout(id);
|
|
332
566
|
}, [isPending]);
|
|
333
|
-
const prevStateRef = (0,
|
|
334
|
-
(0,
|
|
567
|
+
const prevStateRef = (0, import_react4.useRef)(void 0);
|
|
568
|
+
(0, import_react4.useEffect)(() => {
|
|
335
569
|
const current = latest?.state;
|
|
336
570
|
const prev = prevStateRef.current;
|
|
337
571
|
if (prev && isActiveState(prev) && current && !isActiveState(current)) {
|
|
@@ -345,13 +579,13 @@ function DeployItem({ target, token, onDelete, onEdit }) {
|
|
|
345
579
|
}
|
|
346
580
|
prevStateRef.current = current;
|
|
347
581
|
}, [latest?.state, target.name, toast]);
|
|
348
|
-
(0,
|
|
582
|
+
(0, import_react4.useEffect)(() => {
|
|
349
583
|
setShowErrorLogs(false);
|
|
350
584
|
setErrorLines([]);
|
|
351
585
|
setLogError(null);
|
|
352
586
|
}, [latest?.uid]);
|
|
353
|
-
const timerRef = (0,
|
|
354
|
-
(0,
|
|
587
|
+
const timerRef = (0, import_react4.useRef)(null);
|
|
588
|
+
(0, import_react4.useEffect)(() => {
|
|
355
589
|
if (isActive) {
|
|
356
590
|
const start = pendingSince ?? latest?.created ?? Date.now();
|
|
357
591
|
setElapsed(Math.floor((Date.now() - start) / 1e3));
|
|
@@ -366,7 +600,7 @@ function DeployItem({ target, token, onDelete, onEdit }) {
|
|
|
366
600
|
if (timerRef.current) clearInterval(timerRef.current);
|
|
367
601
|
};
|
|
368
602
|
}, [isActive, pendingSince, latest?.created]);
|
|
369
|
-
const deploy = (0,
|
|
603
|
+
const deploy = (0, import_react4.useCallback)(() => {
|
|
370
604
|
(0, import_react_dom.flushSync)(() => {
|
|
371
605
|
setDeployError(null);
|
|
372
606
|
triggeredFromUidRef.current = latest?.uid;
|
|
@@ -382,7 +616,7 @@ function DeployItem({ target, token, onDelete, onEdit }) {
|
|
|
382
616
|
}
|
|
383
617
|
})();
|
|
384
618
|
}, [target.url, fetchDeployments, latest?.uid]);
|
|
385
|
-
const cancel = (0,
|
|
619
|
+
const cancel = (0, import_react4.useCallback)(async () => {
|
|
386
620
|
if (!latest?.uid) return;
|
|
387
621
|
setCanceling(true);
|
|
388
622
|
try {
|
|
@@ -394,7 +628,7 @@ function DeployItem({ target, token, onDelete, onEdit }) {
|
|
|
394
628
|
setCanceling(false);
|
|
395
629
|
}
|
|
396
630
|
}, [latest?.uid, token, target.teamId, fetchDeployments]);
|
|
397
|
-
const copyUrl = (0,
|
|
631
|
+
const copyUrl = (0, import_react4.useCallback)(() => {
|
|
398
632
|
if (!latest?.url) return;
|
|
399
633
|
const fullUrl = `https://${latest.url}`;
|
|
400
634
|
navigator.clipboard.writeText(fullUrl).then(() => {
|
|
@@ -404,7 +638,7 @@ function DeployItem({ target, token, onDelete, onEdit }) {
|
|
|
404
638
|
window.prompt("Copy deployment URL:", fullUrl);
|
|
405
639
|
});
|
|
406
640
|
}, [latest?.url]);
|
|
407
|
-
const fetchErrorLogs = (0,
|
|
641
|
+
const fetchErrorLogs = (0, import_react4.useCallback)(async () => {
|
|
408
642
|
if (!latest?.uid) return;
|
|
409
643
|
setLoadingLogs(true);
|
|
410
644
|
setLogError(null);
|
|
@@ -422,7 +656,7 @@ function DeployItem({ target, token, onDelete, onEdit }) {
|
|
|
422
656
|
setLoadingLogs(false);
|
|
423
657
|
}
|
|
424
658
|
}, [latest?.uid, token, target.teamId]);
|
|
425
|
-
const toggleErrorLogs = (0,
|
|
659
|
+
const toggleErrorLogs = (0, import_react4.useCallback)(() => {
|
|
426
660
|
if (!showErrorLogs && errorLines.length === 0 && !logError) fetchErrorLogs();
|
|
427
661
|
setShowErrorLogs((v) => !v);
|
|
428
662
|
}, [showErrorLogs, errorLines.length, logError, fetchErrorLogs]);
|
|
@@ -435,21 +669,21 @@ function DeployItem({ target, token, onDelete, onEdit }) {
|
|
|
435
669
|
const deployedAt = latest?.created ? timeAgo(latest.created) : null;
|
|
436
670
|
const vercelProjectUrl = projectHref(latest?.inspectorUrl);
|
|
437
671
|
const isError = latest?.state === "ERROR";
|
|
438
|
-
return /* @__PURE__ */ (0,
|
|
439
|
-
/* @__PURE__ */ (0,
|
|
440
|
-
/* @__PURE__ */ (0,
|
|
441
|
-
/* @__PURE__ */ (0,
|
|
442
|
-
/* @__PURE__ */ (0,
|
|
443
|
-
/* @__PURE__ */ (0,
|
|
444
|
-
/* @__PURE__ */ (0,
|
|
445
|
-
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: [
|
|
446
680
|
branch,
|
|
447
|
-
/* @__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" }) })
|
|
448
682
|
] }) }),
|
|
449
|
-
token && !loadingInitial && /* @__PURE__ */ (0,
|
|
450
|
-
isPending ? /* @__PURE__ */ (0,
|
|
451
|
-
isActiveState(latest?.state) && /* @__PURE__ */ (0,
|
|
452
|
-
|
|
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,
|
|
453
687
|
{
|
|
454
688
|
text: "Cancel",
|
|
455
689
|
mode: "ghost",
|
|
@@ -462,135 +696,78 @@ function DeployItem({ target, token, onDelete, onEdit }) {
|
|
|
462
696
|
),
|
|
463
697
|
isPending ? (
|
|
464
698
|
/* Optimistic — dimmed spinner only; no elapsed time until a real build exists */
|
|
465
|
-
/* @__PURE__ */ (0,
|
|
466
|
-
) : isActive ? /* @__PURE__ */ (0,
|
|
467
|
-
/* @__PURE__ */ (0,
|
|
468
|
-
/* @__PURE__ */ (0,
|
|
469
|
-
] }) : deployedAt ? /* @__PURE__ */ (0,
|
|
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
|
|
470
704
|
] })
|
|
471
705
|
] }),
|
|
472
|
-
/* @__PURE__ */ (0,
|
|
473
|
-
|
|
706
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
707
|
+
ActionMenu,
|
|
474
708
|
{
|
|
475
|
-
button: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_ui3.Button, { mode: "ghost", icon: import_icons2.EllipsisVerticalIcon, padding: 2 }),
|
|
476
709
|
id: `menu-${target._id}`,
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
),
|
|
486
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
487
|
-
import_ui3.MenuItem,
|
|
488
|
-
{
|
|
489
|
-
text: "History",
|
|
490
|
-
icon: import_icons2.ClockIcon,
|
|
491
|
-
onClick: () => setShowHistory(true)
|
|
492
|
-
}
|
|
493
|
-
),
|
|
494
|
-
safeHref(latest?.inspectorUrl) && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
495
|
-
import_ui3.MenuItem,
|
|
496
|
-
{
|
|
497
|
-
text: "Build logs",
|
|
498
|
-
icon: import_icons2.LaunchIcon,
|
|
499
|
-
as: "a",
|
|
500
|
-
href: safeHref(latest?.inspectorUrl),
|
|
501
|
-
target: "_blank",
|
|
502
|
-
rel: "noreferrer"
|
|
503
|
-
}
|
|
504
|
-
),
|
|
505
|
-
vercelProjectUrl && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
506
|
-
import_ui3.MenuItem,
|
|
507
|
-
{
|
|
508
|
-
text: "Open in Vercel",
|
|
509
|
-
icon: import_icons2.LaunchIcon,
|
|
510
|
-
as: "a",
|
|
511
|
-
href: vercelProjectUrl,
|
|
512
|
-
target: "_blank",
|
|
513
|
-
rel: "noreferrer"
|
|
514
|
-
}
|
|
515
|
-
),
|
|
516
|
-
!target.disableDeleteAction && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
517
|
-
import_ui3.MenuItem,
|
|
518
|
-
{
|
|
519
|
-
text: "Delete",
|
|
520
|
-
icon: import_icons2.TrashIcon,
|
|
521
|
-
tone: "critical",
|
|
522
|
-
onClick: () => onDelete(target)
|
|
523
|
-
}
|
|
524
|
-
)
|
|
525
|
-
] }),
|
|
526
|
-
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
|
+
]
|
|
527
718
|
}
|
|
528
719
|
)
|
|
529
720
|
] }),
|
|
530
|
-
/* @__PURE__ */ (0,
|
|
531
|
-
!token ? /* @__PURE__ */ (0,
|
|
532
|
-
/* @__PURE__ */ (0,
|
|
533
|
-
/* @__PURE__ */ (0,
|
|
534
|
-
] }) : /* @__PURE__ */ (0,
|
|
535
|
-
/* @__PURE__ */ (0,
|
|
536
|
-
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)(
|
|
537
728
|
"a",
|
|
538
729
|
{
|
|
539
730
|
href: `https://${latest.url}`,
|
|
540
731
|
target: "_blank",
|
|
541
732
|
rel: "noreferrer",
|
|
542
733
|
style: { color: "inherit" },
|
|
543
|
-
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 }) })
|
|
544
735
|
}
|
|
545
736
|
) }),
|
|
546
|
-
sha && /* @__PURE__ */ (0,
|
|
547
|
-
|
|
737
|
+
sha && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Tooltip, { text: commitMsg ?? sha, children: commitHref ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
738
|
+
"a",
|
|
548
739
|
{
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
href: commitHref,
|
|
555
|
-
target: "_blank",
|
|
556
|
-
rel: "noreferrer",
|
|
557
|
-
style: { color: "inherit", textDecoration: "none" },
|
|
558
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_ui3.Text, { size: 1, muted: true, style: { cursor: "pointer", fontFamily: "monospace" }, children: sha })
|
|
559
|
-
}
|
|
560
|
-
) : /* @__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 })
|
|
561
745
|
}
|
|
562
|
-
),
|
|
563
|
-
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: [
|
|
564
748
|
"by ",
|
|
565
749
|
creator
|
|
566
750
|
] }),
|
|
567
|
-
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: [
|
|
568
752
|
"Took ",
|
|
569
753
|
formatDuration(Math.floor((latest.ready - latest.created) / 1e3)),
|
|
570
754
|
" to build"
|
|
571
755
|
] }),
|
|
572
|
-
latest?.url && latest.state === "READY" && /* @__PURE__ */ (0,
|
|
573
|
-
|
|
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,
|
|
574
758
|
{
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
icon: copied ? import_icons2.CheckmarkIcon : import_icons2.CopyIcon,
|
|
582
|
-
padding: 1,
|
|
583
|
-
tone: copied ? "positive" : "default",
|
|
584
|
-
onClick: copyUrl,
|
|
585
|
-
style: { cursor: "pointer" }
|
|
586
|
-
}
|
|
587
|
-
)
|
|
759
|
+
mode: "ghost",
|
|
760
|
+
icon: copied ? CheckmarkIcon : CopyIcon,
|
|
761
|
+
padding: 1,
|
|
762
|
+
tone: copied ? "positive" : "default",
|
|
763
|
+
onClick: copyUrl,
|
|
764
|
+
style: { cursor: "pointer" }
|
|
588
765
|
}
|
|
589
|
-
) })
|
|
766
|
+
) }) })
|
|
590
767
|
] }),
|
|
591
|
-
/* @__PURE__ */ (0,
|
|
592
|
-
commitMsg && /* @__PURE__ */ (0,
|
|
593
|
-
|
|
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,
|
|
594
771
|
{
|
|
595
772
|
size: 0,
|
|
596
773
|
muted: true,
|
|
@@ -598,51 +775,51 @@ function DeployItem({ target, token, onDelete, onEdit }) {
|
|
|
598
775
|
children: commitMsg
|
|
599
776
|
}
|
|
600
777
|
),
|
|
601
|
-
isError && /* @__PURE__ */ (0,
|
|
602
|
-
/* @__PURE__ */ (0,
|
|
603
|
-
|
|
778
|
+
isError && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Stack, { space: 2, children: [
|
|
779
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
780
|
+
import_ui5.Button,
|
|
604
781
|
{
|
|
605
782
|
text: showErrorLogs ? "Hide error details" : "Show error details",
|
|
606
783
|
mode: "ghost",
|
|
607
784
|
tone: "critical",
|
|
608
|
-
icon:
|
|
785
|
+
icon: WarningOutlineIcon,
|
|
609
786
|
fontSize: 1,
|
|
610
787
|
padding: 2,
|
|
611
788
|
onClick: toggleErrorLogs,
|
|
612
789
|
style: { alignSelf: "flex-start", cursor: "pointer" }
|
|
613
790
|
}
|
|
614
791
|
),
|
|
615
|
-
showErrorLogs && /* @__PURE__ */ (0,
|
|
616
|
-
loadingLogs && /* @__PURE__ */ (0,
|
|
617
|
-
/* @__PURE__ */ (0,
|
|
618
|
-
/* @__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" })
|
|
619
796
|
] }),
|
|
620
|
-
logError && /* @__PURE__ */ (0,
|
|
621
|
-
/* @__PURE__ */ (0,
|
|
622
|
-
safeHref(latest?.inspectorUrl) && /* @__PURE__ */ (0,
|
|
623
|
-
/* @__PURE__ */ (0,
|
|
624
|
-
/* @__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" })
|
|
625
802
|
] }) })
|
|
626
803
|
] }),
|
|
627
|
-
!loadingLogs && !logError && errorLines.length > 0 && /* @__PURE__ */ (0,
|
|
628
|
-
/* @__PURE__ */ (0,
|
|
629
|
-
safeHref(latest?.inspectorUrl) && /* @__PURE__ */ (0,
|
|
630
|
-
/* @__PURE__ */ (0,
|
|
631
|
-
/* @__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" })
|
|
632
809
|
] }) })
|
|
633
810
|
] })
|
|
634
811
|
] })
|
|
635
812
|
] }),
|
|
636
|
-
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 }) })
|
|
637
814
|
] })
|
|
638
815
|
] })
|
|
639
816
|
] }),
|
|
640
|
-
/* @__PURE__ */ (0,
|
|
641
|
-
/* @__PURE__ */ (0,
|
|
642
|
-
|
|
817
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_ui5.Box, { children: [
|
|
818
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
819
|
+
import_ui5.Button,
|
|
643
820
|
{
|
|
644
821
|
mode: "ghost",
|
|
645
|
-
iconRight: showDetails ?
|
|
822
|
+
iconRight: showDetails ? ChevronUpIcon : ChevronDownIcon,
|
|
646
823
|
text: "Details",
|
|
647
824
|
fontSize: 0,
|
|
648
825
|
padding: 3,
|
|
@@ -650,62 +827,62 @@ function DeployItem({ target, token, onDelete, onEdit }) {
|
|
|
650
827
|
style: { width: "100%", justifyContent: "flex-start", borderRadius: 0, cursor: "pointer" }
|
|
651
828
|
}
|
|
652
829
|
),
|
|
653
|
-
showDetails && /* @__PURE__ */ (0,
|
|
654
|
-
/* @__PURE__ */ (0,
|
|
655
|
-
/* @__PURE__ */ (0,
|
|
656
|
-
/* @__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" })
|
|
657
834
|
] }),
|
|
658
|
-
/* @__PURE__ */ (0,
|
|
659
|
-
/* @__PURE__ */ (0,
|
|
660
|
-
/* @__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" })
|
|
661
838
|
] }),
|
|
662
|
-
target.teamId && /* @__PURE__ */ (0,
|
|
663
|
-
/* @__PURE__ */ (0,
|
|
664
|
-
/* @__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 })
|
|
665
842
|
] }),
|
|
666
|
-
fullSha && /* @__PURE__ */ (0,
|
|
667
|
-
/* @__PURE__ */ (0,
|
|
668
|
-
/* @__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 })
|
|
669
846
|
] }),
|
|
670
|
-
latest?.meta?.githubCommitAuthorName && /* @__PURE__ */ (0,
|
|
671
|
-
/* @__PURE__ */ (0,
|
|
672
|
-
/* @__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 })
|
|
673
850
|
] }),
|
|
674
|
-
branch && /* @__PURE__ */ (0,
|
|
675
|
-
/* @__PURE__ */ (0,
|
|
676
|
-
/* @__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 })
|
|
677
854
|
] }),
|
|
678
|
-
latest?.uid && /* @__PURE__ */ (0,
|
|
679
|
-
/* @__PURE__ */ (0,
|
|
680
|
-
/* @__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 })
|
|
681
858
|
] }),
|
|
682
|
-
latest?.url && /* @__PURE__ */ (0,
|
|
683
|
-
/* @__PURE__ */ (0,
|
|
684
|
-
/* @__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 })
|
|
685
862
|
] }),
|
|
686
|
-
safeHref(latest?.inspectorUrl) && /* @__PURE__ */ (0,
|
|
687
|
-
/* @__PURE__ */ (0,
|
|
688
|
-
/* @__PURE__ */ (0,
|
|
689
|
-
/* @__PURE__ */ (0,
|
|
690
|
-
/* @__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 } })
|
|
691
868
|
] }) })
|
|
692
869
|
] }),
|
|
693
|
-
latest?.created && /* @__PURE__ */ (0,
|
|
694
|
-
/* @__PURE__ */ (0,
|
|
695
|
-
/* @__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() })
|
|
696
873
|
] })
|
|
697
874
|
] }) })
|
|
698
875
|
] })
|
|
699
876
|
] }),
|
|
700
|
-
/* @__PURE__ */ (0,
|
|
701
|
-
|
|
877
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
878
|
+
import_ui5.Flex,
|
|
702
879
|
{
|
|
703
880
|
direction: "column",
|
|
704
881
|
gap: 2,
|
|
705
882
|
className: "dvfs-deploy-col",
|
|
706
883
|
style: { flexShrink: 0, alignSelf: "stretch" },
|
|
707
|
-
children: /* @__PURE__ */ (0,
|
|
708
|
-
|
|
884
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
885
|
+
import_ui5.Button,
|
|
709
886
|
{
|
|
710
887
|
text: "Deploy",
|
|
711
888
|
tone: "primary",
|
|
@@ -724,7 +901,7 @@ function DeployItem({ target, token, onDelete, onEdit }) {
|
|
|
724
901
|
}
|
|
725
902
|
)
|
|
726
903
|
] }) }),
|
|
727
|
-
showHistory && /* @__PURE__ */ (0,
|
|
904
|
+
showHistory && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
728
905
|
DeployHistory,
|
|
729
906
|
{
|
|
730
907
|
target,
|
|
@@ -736,18 +913,17 @@ function DeployItem({ target, token, onDelete, onEdit }) {
|
|
|
736
913
|
}
|
|
737
914
|
|
|
738
915
|
// src/components/TokenSetup.tsx
|
|
739
|
-
var
|
|
916
|
+
var import_react5 = require("react");
|
|
740
917
|
var import_sanity = require("sanity");
|
|
741
|
-
var
|
|
742
|
-
var
|
|
743
|
-
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
918
|
+
var import_ui7 = require("@sanity/ui");
|
|
919
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
744
920
|
var TOKEN_DOC_ID = "config.vercelDeploy";
|
|
745
921
|
function TokenSetup({ onSaved, onCancel }) {
|
|
746
922
|
const client = (0, import_sanity.useClient)({ apiVersion: "2025-01-01" });
|
|
747
|
-
const [token, setToken] = (0,
|
|
748
|
-
const [saving, setSaving] = (0,
|
|
749
|
-
const [error, setError] = (0,
|
|
750
|
-
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 () => {
|
|
751
927
|
if (!token.trim()) return;
|
|
752
928
|
setSaving(true);
|
|
753
929
|
setError(null);
|
|
@@ -764,21 +940,21 @@ function TokenSetup({ onSaved, onCancel }) {
|
|
|
764
940
|
setSaving(false);
|
|
765
941
|
}
|
|
766
942
|
}, [client, token, onSaved]);
|
|
767
|
-
return /* @__PURE__ */ (0,
|
|
768
|
-
|
|
943
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
944
|
+
import_ui7.Dialog,
|
|
769
945
|
{
|
|
770
946
|
header: "Connect Vercel API token",
|
|
771
947
|
id: "token-setup",
|
|
772
948
|
onClose: onCancel,
|
|
773
949
|
width: 1,
|
|
774
|
-
footer: /* @__PURE__ */ (0,
|
|
775
|
-
onCancel && /* @__PURE__ */ (0,
|
|
776
|
-
/* @__PURE__ */ (0,
|
|
777
|
-
|
|
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,
|
|
778
954
|
{
|
|
779
955
|
text: "Save and connect",
|
|
780
956
|
tone: "primary",
|
|
781
|
-
icon:
|
|
957
|
+
icon: CheckmarkCircleIcon,
|
|
782
958
|
loading: saving,
|
|
783
959
|
disabled: !token.trim() || saving,
|
|
784
960
|
onClick: save,
|
|
@@ -786,22 +962,22 @@ function TokenSetup({ onSaved, onCancel }) {
|
|
|
786
962
|
}
|
|
787
963
|
)
|
|
788
964
|
] }),
|
|
789
|
-
children: /* @__PURE__ */ (0,
|
|
790
|
-
/* @__PURE__ */ (0,
|
|
791
|
-
/* @__PURE__ */ (0,
|
|
792
|
-
/* @__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: [
|
|
793
969
|
"Create one at ",
|
|
794
|
-
/* @__PURE__ */ (0,
|
|
970
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("strong", { children: "vercel.com \u2192 Settings \u2192 Tokens" }),
|
|
795
971
|
" with",
|
|
796
972
|
" ",
|
|
797
|
-
/* @__PURE__ */ (0,
|
|
973
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("strong", { children: "Full Account" }),
|
|
798
974
|
" scope. The token is stored in your Sanity dataset and shared across all authenticated studio users."
|
|
799
975
|
] })
|
|
800
976
|
] }),
|
|
801
|
-
/* @__PURE__ */ (0,
|
|
802
|
-
/* @__PURE__ */ (0,
|
|
803
|
-
/* @__PURE__ */ (0,
|
|
804
|
-
|
|
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,
|
|
805
981
|
{
|
|
806
982
|
value: token,
|
|
807
983
|
onChange: (e) => setToken(e.target.value),
|
|
@@ -810,38 +986,37 @@ function TokenSetup({ onSaved, onCancel }) {
|
|
|
810
986
|
}
|
|
811
987
|
)
|
|
812
988
|
] }),
|
|
813
|
-
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 }) })
|
|
814
990
|
] })
|
|
815
991
|
}
|
|
816
992
|
);
|
|
817
993
|
}
|
|
818
994
|
|
|
819
995
|
// src/components/DeployTargetForm.tsx
|
|
820
|
-
var
|
|
996
|
+
var import_react6 = require("react");
|
|
821
997
|
var import_sanity2 = require("sanity");
|
|
822
|
-
var
|
|
823
|
-
var
|
|
824
|
-
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
998
|
+
var import_ui9 = require("@sanity/ui");
|
|
999
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
825
1000
|
var VERCEL_HOOK_RE2 = /^https:\/\/api\.vercel\.com\/v1\/integrations\/deploy\//;
|
|
826
1001
|
function DeployTargetForm({ initial, onSaved, onClose }) {
|
|
827
1002
|
const client = (0, import_sanity2.useClient)({ apiVersion: "2025-01-01" });
|
|
828
1003
|
const isEdit = Boolean(initial);
|
|
829
|
-
const [name, setName] = (0,
|
|
830
|
-
const [url, setUrl] = (0,
|
|
831
|
-
const [teamId, setTeamId] = (0,
|
|
832
|
-
const [disableDelete, setDisableDelete] = (0,
|
|
833
|
-
const [saving, setSaving] = (0,
|
|
834
|
-
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);
|
|
835
1010
|
const urlValid = !url || VERCEL_HOOK_RE2.test(url.trim());
|
|
836
1011
|
const canSave = name.trim() && url.trim() && urlValid;
|
|
837
|
-
const save = (0,
|
|
1012
|
+
const save = (0, import_react6.useCallback)(async () => {
|
|
838
1013
|
if (!canSave) return;
|
|
839
1014
|
setSaving(true);
|
|
840
1015
|
setError(null);
|
|
841
1016
|
const fields = {
|
|
842
1017
|
name: name.trim(),
|
|
843
1018
|
url: url.trim(),
|
|
844
|
-
|
|
1019
|
+
teamId: teamId.trim() || null,
|
|
845
1020
|
disableDeleteAction: disableDelete
|
|
846
1021
|
};
|
|
847
1022
|
try {
|
|
@@ -857,21 +1032,21 @@ function DeployTargetForm({ initial, onSaved, onClose }) {
|
|
|
857
1032
|
setSaving(false);
|
|
858
1033
|
}
|
|
859
1034
|
}, [canSave, isEdit, initial, client, name, url, teamId, disableDelete, onSaved]);
|
|
860
|
-
return /* @__PURE__ */ (0,
|
|
861
|
-
|
|
1035
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1036
|
+
import_ui9.Dialog,
|
|
862
1037
|
{
|
|
863
1038
|
header: isEdit ? `Edit "${initial?.name}"` : "Add deploy target",
|
|
864
1039
|
id: "deploy-target-form",
|
|
865
1040
|
onClose,
|
|
866
1041
|
width: 1,
|
|
867
|
-
footer: /* @__PURE__ */ (0,
|
|
868
|
-
/* @__PURE__ */ (0,
|
|
869
|
-
/* @__PURE__ */ (0,
|
|
870
|
-
|
|
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,
|
|
871
1046
|
{
|
|
872
1047
|
text: isEdit ? "Save changes" : "Add target",
|
|
873
1048
|
tone: "primary",
|
|
874
|
-
icon:
|
|
1049
|
+
icon: CheckmarkCircleIcon,
|
|
875
1050
|
loading: saving,
|
|
876
1051
|
disabled: !canSave || saving,
|
|
877
1052
|
onClick: save,
|
|
@@ -879,14 +1054,14 @@ function DeployTargetForm({ initial, onSaved, onClose }) {
|
|
|
879
1054
|
}
|
|
880
1055
|
)
|
|
881
1056
|
] }),
|
|
882
|
-
children: /* @__PURE__ */ (0,
|
|
883
|
-
/* @__PURE__ */ (0,
|
|
884
|
-
/* @__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: [
|
|
885
1060
|
"Name ",
|
|
886
|
-
/* @__PURE__ */ (0,
|
|
1061
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { style: { color: "var(--card-fg-color)" }, children: "*" })
|
|
887
1062
|
] }),
|
|
888
|
-
/* @__PURE__ */ (0,
|
|
889
|
-
|
|
1063
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1064
|
+
import_ui9.TextInput,
|
|
890
1065
|
{
|
|
891
1066
|
value: name,
|
|
892
1067
|
onChange: (e) => setName(e.target.value),
|
|
@@ -894,80 +1069,80 @@ function DeployTargetForm({ initial, onSaved, onClose }) {
|
|
|
894
1069
|
}
|
|
895
1070
|
)
|
|
896
1071
|
] }),
|
|
897
|
-
/* @__PURE__ */ (0,
|
|
898
|
-
/* @__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: [
|
|
899
1074
|
"Deploy hook URL ",
|
|
900
|
-
/* @__PURE__ */ (0,
|
|
1075
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { style: { color: "var(--card-fg-color)" }, children: "*" })
|
|
901
1076
|
] }),
|
|
902
|
-
/* @__PURE__ */ (0,
|
|
903
|
-
|
|
1077
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1078
|
+
import_ui9.TextInput,
|
|
904
1079
|
{
|
|
905
1080
|
value: url,
|
|
906
1081
|
onChange: (e) => setUrl(e.target.value),
|
|
907
1082
|
placeholder: "https://api.vercel.com/v1/integrations/deploy/\u2026"
|
|
908
1083
|
}
|
|
909
1084
|
),
|
|
910
|
-
url && !urlValid && /* @__PURE__ */ (0,
|
|
911
|
-
/* @__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" })
|
|
912
1087
|
] }),
|
|
913
|
-
/* @__PURE__ */ (0,
|
|
914
|
-
/* @__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: [
|
|
915
1090
|
"Team ID ",
|
|
916
|
-
/* @__PURE__ */ (0,
|
|
1091
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { style: { opacity: 0.5, fontWeight: "normal" }, children: "\u2014 optional" })
|
|
917
1092
|
] }),
|
|
918
|
-
/* @__PURE__ */ (0,
|
|
919
|
-
|
|
1093
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1094
|
+
import_ui9.TextInput,
|
|
920
1095
|
{
|
|
921
1096
|
value: teamId,
|
|
922
1097
|
onChange: (e) => setTeamId(e.target.value),
|
|
923
1098
|
placeholder: "team_xxxxxxxx"
|
|
924
1099
|
}
|
|
925
1100
|
),
|
|
926
|
-
/* @__PURE__ */ (0,
|
|
1101
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_ui9.Text, { size: 0, muted: true, children: [
|
|
927
1102
|
"Required for team-owned Vercel projects. Find it at Vercel \u2192 Settings \u2192 General \u2192 Team ID (starts with ",
|
|
928
|
-
/* @__PURE__ */ (0,
|
|
1103
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("code", { children: "team_" }),
|
|
929
1104
|
")."
|
|
930
1105
|
] })
|
|
931
1106
|
] }),
|
|
932
|
-
/* @__PURE__ */ (0,
|
|
933
|
-
/* @__PURE__ */ (0,
|
|
934
|
-
|
|
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,
|
|
935
1110
|
{
|
|
936
1111
|
checked: disableDelete,
|
|
937
1112
|
onChange: (e) => setDisableDelete(e.target.checked),
|
|
938
1113
|
id: "disable-delete"
|
|
939
1114
|
}
|
|
940
1115
|
),
|
|
941
|
-
/* @__PURE__ */ (0,
|
|
942
|
-
/* @__PURE__ */ (0,
|
|
943
|
-
/* @__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." })
|
|
944
1119
|
] })
|
|
945
1120
|
] }),
|
|
946
|
-
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 }) })
|
|
947
1122
|
] }) })
|
|
948
1123
|
}
|
|
949
1124
|
);
|
|
950
1125
|
}
|
|
951
1126
|
|
|
952
1127
|
// src/version.ts
|
|
953
|
-
var VERSION = "1.0
|
|
1128
|
+
var VERSION = "1.1.0";
|
|
954
1129
|
|
|
955
1130
|
// src/components/DeployTool.tsx
|
|
956
|
-
var
|
|
1131
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
957
1132
|
var TOKEN_QUERY = `*[_id == "config.vercelDeploy"][0].accessToken`;
|
|
958
1133
|
var TARGETS_QUERY = `*[_type == "vercel_deploy"] | order(_createdAt asc)`;
|
|
959
1134
|
function DeployTool() {
|
|
960
1135
|
const client = (0, import_sanity3.useClient)({ apiVersion: "2025-01-01" });
|
|
961
|
-
const toast =
|
|
962
|
-
const [token, setToken] = (0,
|
|
963
|
-
const [targets, setTargets] = (0,
|
|
964
|
-
const [loading, setLoading] = (0,
|
|
965
|
-
const [showTokenSetup, setShowTokenSetup] = (0,
|
|
966
|
-
const [showCreateForm, setShowCreateForm] = (0,
|
|
967
|
-
const [pendingEdit, setPendingEdit] = (0,
|
|
968
|
-
const [pendingDelete, setPendingDelete] = (0,
|
|
969
|
-
const [deleting, setDeleting] = (0,
|
|
970
|
-
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 () => {
|
|
971
1146
|
setLoading(true);
|
|
972
1147
|
try {
|
|
973
1148
|
const [fetchedToken, fetchedTargets] = await Promise.all([
|
|
@@ -982,10 +1157,10 @@ function DeployTool() {
|
|
|
982
1157
|
setLoading(false);
|
|
983
1158
|
}
|
|
984
1159
|
}, [client]);
|
|
985
|
-
(0,
|
|
1160
|
+
(0, import_react7.useEffect)(() => {
|
|
986
1161
|
load();
|
|
987
1162
|
}, [load]);
|
|
988
|
-
(0,
|
|
1163
|
+
(0, import_react7.useEffect)(() => {
|
|
989
1164
|
if (document.getElementById("dvfs-styles")) return;
|
|
990
1165
|
const style = document.createElement("style");
|
|
991
1166
|
style.id = "dvfs-styles";
|
|
@@ -1011,7 +1186,7 @@ function DeployTool() {
|
|
|
1011
1186
|
document.getElementById("dvfs-styles")?.remove();
|
|
1012
1187
|
};
|
|
1013
1188
|
}, []);
|
|
1014
|
-
(0,
|
|
1189
|
+
(0, import_react7.useEffect)(() => {
|
|
1015
1190
|
const sub = client.listen(TARGETS_QUERY).subscribe(() => {
|
|
1016
1191
|
client.fetch(TARGETS_QUERY).then(setTargets).catch((err) => {
|
|
1017
1192
|
console.error("deploy-vercel-from-sanity: subscription refresh error", err);
|
|
@@ -1019,7 +1194,7 @@ function DeployTool() {
|
|
|
1019
1194
|
});
|
|
1020
1195
|
return () => sub.unsubscribe();
|
|
1021
1196
|
}, [client]);
|
|
1022
|
-
const confirmDelete = (0,
|
|
1197
|
+
const confirmDelete = (0, import_react7.useCallback)(async () => {
|
|
1023
1198
|
if (!pendingDelete) return;
|
|
1024
1199
|
setDeleting(true);
|
|
1025
1200
|
try {
|
|
@@ -1034,31 +1209,31 @@ function DeployTool() {
|
|
|
1034
1209
|
}
|
|
1035
1210
|
}, [client, pendingDelete, toast]);
|
|
1036
1211
|
if (loading) {
|
|
1037
|
-
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 }) }) });
|
|
1038
1213
|
}
|
|
1039
|
-
return /* @__PURE__ */ (0,
|
|
1040
|
-
/* @__PURE__ */ (0,
|
|
1041
|
-
/* @__PURE__ */ (0,
|
|
1042
|
-
/* @__PURE__ */ (0,
|
|
1043
|
-
/* @__PURE__ */ (0,
|
|
1044
|
-
/* @__PURE__ */ (0,
|
|
1045
|
-
|
|
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,
|
|
1046
1221
|
{
|
|
1047
1222
|
text: token ? "Token connected" : "Connect API token",
|
|
1048
1223
|
mode: "ghost",
|
|
1049
|
-
icon:
|
|
1224
|
+
icon: TokenIcon,
|
|
1050
1225
|
fontSize: 1,
|
|
1051
1226
|
tone: token ? "positive" : "caution",
|
|
1052
1227
|
onClick: () => setShowTokenSetup(true),
|
|
1053
1228
|
style: { cursor: "pointer" }
|
|
1054
1229
|
}
|
|
1055
1230
|
),
|
|
1056
|
-
/* @__PURE__ */ (0,
|
|
1057
|
-
|
|
1231
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1232
|
+
import_ui11.Button,
|
|
1058
1233
|
{
|
|
1059
1234
|
text: "Add target",
|
|
1060
1235
|
mode: "ghost",
|
|
1061
|
-
icon:
|
|
1236
|
+
icon: AddIcon,
|
|
1062
1237
|
fontSize: 1,
|
|
1063
1238
|
onClick: () => setShowCreateForm(true),
|
|
1064
1239
|
style: { cursor: "pointer" }
|
|
@@ -1066,13 +1241,13 @@ function DeployTool() {
|
|
|
1066
1241
|
)
|
|
1067
1242
|
] })
|
|
1068
1243
|
] }),
|
|
1069
|
-
!token && /* @__PURE__ */ (0,
|
|
1070
|
-
/* @__PURE__ */ (0,
|
|
1071
|
-
/* @__PURE__ */ (0,
|
|
1072
|
-
/* @__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." })
|
|
1073
1248
|
] }),
|
|
1074
|
-
/* @__PURE__ */ (0,
|
|
1075
|
-
|
|
1249
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1250
|
+
import_ui11.Button,
|
|
1076
1251
|
{
|
|
1077
1252
|
text: "Connect",
|
|
1078
1253
|
tone: "caution",
|
|
@@ -1082,31 +1257,31 @@ function DeployTool() {
|
|
|
1082
1257
|
}
|
|
1083
1258
|
)
|
|
1084
1259
|
] }) }),
|
|
1085
|
-
targets.length === 0 && /* @__PURE__ */ (0,
|
|
1086
|
-
/* @__PURE__ */ (0,
|
|
1087
|
-
/* @__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: [
|
|
1088
1263
|
"Add a deploy target using the button above, or create a",
|
|
1089
1264
|
" ",
|
|
1090
|
-
/* @__PURE__ */ (0,
|
|
1265
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("code", { children: "vercel_deploy" }),
|
|
1091
1266
|
" document directly in the dataset."
|
|
1092
1267
|
] }),
|
|
1093
|
-
/* @__PURE__ */ (0,
|
|
1094
|
-
|
|
1268
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_ui11.Flex, { justify: "center", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1269
|
+
import_ui11.Button,
|
|
1095
1270
|
{
|
|
1096
1271
|
text: "Add deploy target",
|
|
1097
1272
|
tone: "primary",
|
|
1098
|
-
icon:
|
|
1273
|
+
icon: AddIcon,
|
|
1099
1274
|
onClick: () => setShowCreateForm(true),
|
|
1100
1275
|
style: { cursor: "pointer" }
|
|
1101
1276
|
}
|
|
1102
1277
|
) })
|
|
1103
1278
|
] }) }),
|
|
1104
|
-
targets.length > 0 && /* @__PURE__ */ (0,
|
|
1279
|
+
targets.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "dvfs-grid", style: {
|
|
1105
1280
|
display: "grid",
|
|
1106
1281
|
gridTemplateColumns: "repeat(auto-fill, minmax(min(540px, 100%), 1fr))",
|
|
1107
1282
|
gap: "16px",
|
|
1108
1283
|
alignItems: "start"
|
|
1109
|
-
}, children: targets.map((target) => /* @__PURE__ */ (0,
|
|
1284
|
+
}, children: targets.map((target) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1110
1285
|
DeployItem,
|
|
1111
1286
|
{
|
|
1112
1287
|
target,
|
|
@@ -1117,8 +1292,8 @@ function DeployTool() {
|
|
|
1117
1292
|
target._id
|
|
1118
1293
|
)) })
|
|
1119
1294
|
] }) }),
|
|
1120
|
-
/* @__PURE__ */ (0,
|
|
1121
|
-
|
|
1295
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1296
|
+
import_ui11.Box,
|
|
1122
1297
|
{
|
|
1123
1298
|
style: {
|
|
1124
1299
|
position: "fixed",
|
|
@@ -1128,13 +1303,13 @@ function DeployTool() {
|
|
|
1128
1303
|
pointerEvents: "none",
|
|
1129
1304
|
userSelect: "none"
|
|
1130
1305
|
},
|
|
1131
|
-
children: /* @__PURE__ */ (0,
|
|
1306
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_ui11.Text, { size: 0, muted: true, children: [
|
|
1132
1307
|
"v",
|
|
1133
1308
|
VERSION
|
|
1134
1309
|
] })
|
|
1135
1310
|
}
|
|
1136
1311
|
),
|
|
1137
|
-
showTokenSetup && /* @__PURE__ */ (0,
|
|
1312
|
+
showTokenSetup && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1138
1313
|
TokenSetup,
|
|
1139
1314
|
{
|
|
1140
1315
|
onSaved: () => {
|
|
@@ -1144,7 +1319,7 @@ function DeployTool() {
|
|
|
1144
1319
|
onCancel: token ? () => setShowTokenSetup(false) : void 0
|
|
1145
1320
|
}
|
|
1146
1321
|
),
|
|
1147
|
-
showCreateForm && /* @__PURE__ */ (0,
|
|
1322
|
+
showCreateForm && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1148
1323
|
DeployTargetForm,
|
|
1149
1324
|
{
|
|
1150
1325
|
onSaved: () => {
|
|
@@ -1154,7 +1329,7 @@ function DeployTool() {
|
|
|
1154
1329
|
onClose: () => setShowCreateForm(false)
|
|
1155
1330
|
}
|
|
1156
1331
|
),
|
|
1157
|
-
pendingEdit && /* @__PURE__ */ (0,
|
|
1332
|
+
pendingEdit && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1158
1333
|
DeployTargetForm,
|
|
1159
1334
|
{
|
|
1160
1335
|
initial: pendingEdit,
|
|
@@ -1165,16 +1340,16 @@ function DeployTool() {
|
|
|
1165
1340
|
onClose: () => setPendingEdit(null)
|
|
1166
1341
|
}
|
|
1167
1342
|
),
|
|
1168
|
-
pendingDelete && /* @__PURE__ */ (0,
|
|
1169
|
-
|
|
1343
|
+
pendingDelete && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1344
|
+
import_ui11.Dialog,
|
|
1170
1345
|
{
|
|
1171
1346
|
header: "Delete deploy target?",
|
|
1172
1347
|
id: "confirm-delete",
|
|
1173
1348
|
onClose: () => setPendingDelete(null),
|
|
1174
1349
|
width: 1,
|
|
1175
|
-
footer: /* @__PURE__ */ (0,
|
|
1176
|
-
/* @__PURE__ */ (0,
|
|
1177
|
-
|
|
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,
|
|
1178
1353
|
{
|
|
1179
1354
|
text: "Cancel",
|
|
1180
1355
|
mode: "ghost",
|
|
@@ -1182,12 +1357,12 @@ function DeployTool() {
|
|
|
1182
1357
|
style: { cursor: "pointer" }
|
|
1183
1358
|
}
|
|
1184
1359
|
),
|
|
1185
|
-
/* @__PURE__ */ (0,
|
|
1186
|
-
|
|
1360
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1361
|
+
import_ui11.Button,
|
|
1187
1362
|
{
|
|
1188
1363
|
text: "Delete",
|
|
1189
1364
|
tone: "critical",
|
|
1190
|
-
icon:
|
|
1365
|
+
icon: TrashIcon,
|
|
1191
1366
|
loading: deleting,
|
|
1192
1367
|
disabled: deleting,
|
|
1193
1368
|
onClick: confirmDelete,
|
|
@@ -1195,26 +1370,26 @@ function DeployTool() {
|
|
|
1195
1370
|
}
|
|
1196
1371
|
)
|
|
1197
1372
|
] }),
|
|
1198
|
-
children: /* @__PURE__ */ (0,
|
|
1199
|
-
/* @__PURE__ */ (0,
|
|
1200
|
-
/* @__PURE__ */ (0,
|
|
1201
|
-
/* @__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 })
|
|
1202
1377
|
] }),
|
|
1203
|
-
/* @__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." })
|
|
1204
1379
|
] }) })
|
|
1205
1380
|
}
|
|
1206
|
-
)
|
|
1381
|
+
),
|
|
1382
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(ToastViewport, {})
|
|
1207
1383
|
] });
|
|
1208
1384
|
}
|
|
1209
1385
|
|
|
1210
1386
|
// src/schema/vercelDeploy.ts
|
|
1211
1387
|
var import_sanity4 = require("sanity");
|
|
1212
|
-
var import_icons6 = require("@sanity/icons");
|
|
1213
1388
|
var vercelDeploySchema = (0, import_sanity4.defineType)({
|
|
1214
1389
|
name: "vercel_deploy",
|
|
1215
1390
|
title: "Deploy Target",
|
|
1216
1391
|
type: "document",
|
|
1217
|
-
icon:
|
|
1392
|
+
icon: RocketIcon,
|
|
1218
1393
|
fields: [
|
|
1219
1394
|
(0, import_sanity4.defineField)({
|
|
1220
1395
|
name: "name",
|
|
@@ -1267,7 +1442,7 @@ var vercelDeploy = (0, import_sanity5.definePlugin)((options) => {
|
|
|
1267
1442
|
{
|
|
1268
1443
|
name: config.name ?? "vercel-deploy",
|
|
1269
1444
|
title: config.title ?? "Deploy",
|
|
1270
|
-
icon: config.icon ??
|
|
1445
|
+
icon: config.icon ?? RocketIcon,
|
|
1271
1446
|
component: DeployTool
|
|
1272
1447
|
}
|
|
1273
1448
|
]
|