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