@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.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,31 +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;
|
|
308
511
|
var PENDING_TIMEOUT_MS = 6e4;
|
|
309
512
|
function DeployItem({ target, token, onDelete, onEdit }) {
|
|
310
513
|
const { projectId, hookId } = parseHookUrl(target.url);
|
|
311
514
|
const toast = useToast();
|
|
312
|
-
const [deployments, setDeployments] =
|
|
313
|
-
const [loadingInitial, setLoadingInitial] =
|
|
314
|
-
const [pendingSince, setPendingSince] =
|
|
315
|
-
const [canceling, setCanceling] =
|
|
316
|
-
const [deployError, setDeployError] =
|
|
317
|
-
const [showHistory, setShowHistory] =
|
|
318
|
-
const [elapsed, setElapsed] =
|
|
319
|
-
const [copied, setCopied] =
|
|
320
|
-
const [showDetails, setShowDetails] =
|
|
321
|
-
const [showErrorLogs, setShowErrorLogs] =
|
|
322
|
-
const [errorLines, setErrorLines] =
|
|
323
|
-
const [loadingLogs, setLoadingLogs] =
|
|
324
|
-
const [logError, setLogError] =
|
|
325
|
-
const triggeredFromUidRef =
|
|
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);
|
|
326
529
|
const latest = deployments[0];
|
|
327
530
|
const isPending = pendingSince !== null;
|
|
328
531
|
const isActive = isPending || isActiveState(latest?.state);
|
|
329
|
-
const fetchDeployments =
|
|
532
|
+
const fetchDeployments = useCallback3(async () => {
|
|
330
533
|
if (!projectId || !hookId || !token) return;
|
|
331
534
|
try {
|
|
332
535
|
const data = await listDeployments({ projectId, hookId, token, teamId: target.teamId });
|
|
@@ -335,25 +538,25 @@ function DeployItem({ target, token, onDelete, onEdit }) {
|
|
|
335
538
|
console.error("deploy-vercel-from-sanity: fetch error", err);
|
|
336
539
|
}
|
|
337
540
|
}, [projectId, hookId, token, target.teamId]);
|
|
338
|
-
|
|
541
|
+
useEffect3(() => {
|
|
339
542
|
fetchDeployments().finally(() => setLoadingInitial(false));
|
|
340
543
|
}, [fetchDeployments]);
|
|
341
|
-
|
|
544
|
+
useEffect3(() => {
|
|
342
545
|
if (!isActive) return;
|
|
343
546
|
const id = setInterval(fetchDeployments, POLL_INTERVAL_MS);
|
|
344
547
|
return () => clearInterval(id);
|
|
345
548
|
}, [isActive, fetchDeployments]);
|
|
346
|
-
|
|
549
|
+
useEffect3(() => {
|
|
347
550
|
if (!isPending) return;
|
|
348
551
|
if (latest?.uid && latest.uid !== triggeredFromUidRef.current) setPendingSince(null);
|
|
349
552
|
}, [isPending, latest?.uid]);
|
|
350
|
-
|
|
553
|
+
useEffect3(() => {
|
|
351
554
|
if (!isPending) return;
|
|
352
555
|
const id = setTimeout(() => setPendingSince(null), PENDING_TIMEOUT_MS);
|
|
353
556
|
return () => clearTimeout(id);
|
|
354
557
|
}, [isPending]);
|
|
355
|
-
const prevStateRef =
|
|
356
|
-
|
|
558
|
+
const prevStateRef = useRef2(void 0);
|
|
559
|
+
useEffect3(() => {
|
|
357
560
|
const current = latest?.state;
|
|
358
561
|
const prev = prevStateRef.current;
|
|
359
562
|
if (prev && isActiveState(prev) && current && !isActiveState(current)) {
|
|
@@ -367,13 +570,13 @@ function DeployItem({ target, token, onDelete, onEdit }) {
|
|
|
367
570
|
}
|
|
368
571
|
prevStateRef.current = current;
|
|
369
572
|
}, [latest?.state, target.name, toast]);
|
|
370
|
-
|
|
573
|
+
useEffect3(() => {
|
|
371
574
|
setShowErrorLogs(false);
|
|
372
575
|
setErrorLines([]);
|
|
373
576
|
setLogError(null);
|
|
374
577
|
}, [latest?.uid]);
|
|
375
|
-
const timerRef =
|
|
376
|
-
|
|
578
|
+
const timerRef = useRef2(null);
|
|
579
|
+
useEffect3(() => {
|
|
377
580
|
if (isActive) {
|
|
378
581
|
const start = pendingSince ?? latest?.created ?? Date.now();
|
|
379
582
|
setElapsed(Math.floor((Date.now() - start) / 1e3));
|
|
@@ -388,7 +591,7 @@ function DeployItem({ target, token, onDelete, onEdit }) {
|
|
|
388
591
|
if (timerRef.current) clearInterval(timerRef.current);
|
|
389
592
|
};
|
|
390
593
|
}, [isActive, pendingSince, latest?.created]);
|
|
391
|
-
const deploy =
|
|
594
|
+
const deploy = useCallback3(() => {
|
|
392
595
|
flushSync(() => {
|
|
393
596
|
setDeployError(null);
|
|
394
597
|
triggeredFromUidRef.current = latest?.uid;
|
|
@@ -404,7 +607,7 @@ function DeployItem({ target, token, onDelete, onEdit }) {
|
|
|
404
607
|
}
|
|
405
608
|
})();
|
|
406
609
|
}, [target.url, fetchDeployments, latest?.uid]);
|
|
407
|
-
const cancel =
|
|
610
|
+
const cancel = useCallback3(async () => {
|
|
408
611
|
if (!latest?.uid) return;
|
|
409
612
|
setCanceling(true);
|
|
410
613
|
try {
|
|
@@ -416,7 +619,7 @@ function DeployItem({ target, token, onDelete, onEdit }) {
|
|
|
416
619
|
setCanceling(false);
|
|
417
620
|
}
|
|
418
621
|
}, [latest?.uid, token, target.teamId, fetchDeployments]);
|
|
419
|
-
const copyUrl =
|
|
622
|
+
const copyUrl = useCallback3(() => {
|
|
420
623
|
if (!latest?.url) return;
|
|
421
624
|
const fullUrl = `https://${latest.url}`;
|
|
422
625
|
navigator.clipboard.writeText(fullUrl).then(() => {
|
|
@@ -426,7 +629,7 @@ function DeployItem({ target, token, onDelete, onEdit }) {
|
|
|
426
629
|
window.prompt("Copy deployment URL:", fullUrl);
|
|
427
630
|
});
|
|
428
631
|
}, [latest?.url]);
|
|
429
|
-
const fetchErrorLogs =
|
|
632
|
+
const fetchErrorLogs = useCallback3(async () => {
|
|
430
633
|
if (!latest?.uid) return;
|
|
431
634
|
setLoadingLogs(true);
|
|
432
635
|
setLogError(null);
|
|
@@ -444,7 +647,7 @@ function DeployItem({ target, token, onDelete, onEdit }) {
|
|
|
444
647
|
setLoadingLogs(false);
|
|
445
648
|
}
|
|
446
649
|
}, [latest?.uid, token, target.teamId]);
|
|
447
|
-
const toggleErrorLogs =
|
|
650
|
+
const toggleErrorLogs = useCallback3(() => {
|
|
448
651
|
if (!showErrorLogs && errorLines.length === 0 && !logError) fetchErrorLogs();
|
|
449
652
|
setShowErrorLogs((v) => !v);
|
|
450
653
|
}, [showErrorLogs, errorLines.length, logError, fetchErrorLogs]);
|
|
@@ -457,21 +660,21 @@ function DeployItem({ target, token, onDelete, onEdit }) {
|
|
|
457
660
|
const deployedAt = latest?.created ? timeAgo(latest.created) : null;
|
|
458
661
|
const vercelProjectUrl = projectHref(latest?.inspectorUrl);
|
|
459
662
|
const isError = latest?.state === "ERROR";
|
|
460
|
-
return /* @__PURE__ */
|
|
461
|
-
/* @__PURE__ */
|
|
462
|
-
/* @__PURE__ */
|
|
463
|
-
/* @__PURE__ */
|
|
464
|
-
/* @__PURE__ */
|
|
465
|
-
/* @__PURE__ */
|
|
466
|
-
/* @__PURE__ */
|
|
467
|
-
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: [
|
|
468
671
|
branch,
|
|
469
|
-
/* @__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" }) })
|
|
470
673
|
] }) }),
|
|
471
|
-
token && !loadingInitial && /* @__PURE__ */
|
|
472
|
-
isPending ? /* @__PURE__ */
|
|
473
|
-
isActiveState(latest?.state) && /* @__PURE__ */
|
|
474
|
-
|
|
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,
|
|
475
678
|
{
|
|
476
679
|
text: "Cancel",
|
|
477
680
|
mode: "ghost",
|
|
@@ -484,135 +687,78 @@ function DeployItem({ target, token, onDelete, onEdit }) {
|
|
|
484
687
|
),
|
|
485
688
|
isPending ? (
|
|
486
689
|
/* Optimistic — dimmed spinner only; no elapsed time until a real build exists */
|
|
487
|
-
/* @__PURE__ */
|
|
488
|
-
) : isActive ? /* @__PURE__ */
|
|
489
|
-
/* @__PURE__ */
|
|
490
|
-
/* @__PURE__ */
|
|
491
|
-
] }) : deployedAt ? /* @__PURE__ */
|
|
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
|
|
492
695
|
] })
|
|
493
696
|
] }),
|
|
494
|
-
/* @__PURE__ */
|
|
495
|
-
|
|
697
|
+
/* @__PURE__ */ jsx5(
|
|
698
|
+
ActionMenu,
|
|
496
699
|
{
|
|
497
|
-
button: /* @__PURE__ */ jsx3(Button2, { mode: "ghost", icon: EllipsisVerticalIcon, padding: 2 }),
|
|
498
700
|
id: `menu-${target._id}`,
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
),
|
|
508
|
-
/* @__PURE__ */ jsx3(
|
|
509
|
-
MenuItem,
|
|
510
|
-
{
|
|
511
|
-
text: "History",
|
|
512
|
-
icon: ClockIcon,
|
|
513
|
-
onClick: () => setShowHistory(true)
|
|
514
|
-
}
|
|
515
|
-
),
|
|
516
|
-
safeHref(latest?.inspectorUrl) && /* @__PURE__ */ jsx3(
|
|
517
|
-
MenuItem,
|
|
518
|
-
{
|
|
519
|
-
text: "Build logs",
|
|
520
|
-
icon: LaunchIcon2,
|
|
521
|
-
as: "a",
|
|
522
|
-
href: safeHref(latest?.inspectorUrl),
|
|
523
|
-
target: "_blank",
|
|
524
|
-
rel: "noreferrer"
|
|
525
|
-
}
|
|
526
|
-
),
|
|
527
|
-
vercelProjectUrl && /* @__PURE__ */ jsx3(
|
|
528
|
-
MenuItem,
|
|
529
|
-
{
|
|
530
|
-
text: "Open in Vercel",
|
|
531
|
-
icon: LaunchIcon2,
|
|
532
|
-
as: "a",
|
|
533
|
-
href: vercelProjectUrl,
|
|
534
|
-
target: "_blank",
|
|
535
|
-
rel: "noreferrer"
|
|
536
|
-
}
|
|
537
|
-
),
|
|
538
|
-
!target.disableDeleteAction && /* @__PURE__ */ jsx3(
|
|
539
|
-
MenuItem,
|
|
540
|
-
{
|
|
541
|
-
text: "Delete",
|
|
542
|
-
icon: TrashIcon,
|
|
543
|
-
tone: "critical",
|
|
544
|
-
onClick: () => onDelete(target)
|
|
545
|
-
}
|
|
546
|
-
)
|
|
547
|
-
] }),
|
|
548
|
-
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
|
+
]
|
|
549
709
|
}
|
|
550
710
|
)
|
|
551
711
|
] }),
|
|
552
|
-
/* @__PURE__ */
|
|
553
|
-
!token ? /* @__PURE__ */
|
|
554
|
-
/* @__PURE__ */
|
|
555
|
-
/* @__PURE__ */
|
|
556
|
-
] }) : /* @__PURE__ */
|
|
557
|
-
/* @__PURE__ */
|
|
558
|
-
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(
|
|
559
719
|
"a",
|
|
560
720
|
{
|
|
561
721
|
href: `https://${latest.url}`,
|
|
562
722
|
target: "_blank",
|
|
563
723
|
rel: "noreferrer",
|
|
564
724
|
style: { color: "inherit" },
|
|
565
|
-
children: /* @__PURE__ */
|
|
725
|
+
children: /* @__PURE__ */ jsx5(Flex4, { align: "center", gap: 1, children: /* @__PURE__ */ jsx5(Text3, { size: 1, children: latest.url }) })
|
|
566
726
|
}
|
|
567
727
|
) }),
|
|
568
|
-
sha && /* @__PURE__ */
|
|
569
|
-
|
|
728
|
+
sha && /* @__PURE__ */ jsx5(Tooltip, { text: commitMsg ?? sha, children: commitHref ? /* @__PURE__ */ jsx5(
|
|
729
|
+
"a",
|
|
570
730
|
{
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
href: commitHref,
|
|
577
|
-
target: "_blank",
|
|
578
|
-
rel: "noreferrer",
|
|
579
|
-
style: { color: "inherit", textDecoration: "none" },
|
|
580
|
-
children: /* @__PURE__ */ jsx3(Text2, { size: 1, muted: true, style: { cursor: "pointer", fontFamily: "monospace" }, children: sha })
|
|
581
|
-
}
|
|
582
|
-
) : /* @__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 })
|
|
583
736
|
}
|
|
584
|
-
),
|
|
585
|
-
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: [
|
|
586
739
|
"by ",
|
|
587
740
|
creator
|
|
588
741
|
] }),
|
|
589
|
-
latest?.state === "READY" && latest.ready && latest.created && /* @__PURE__ */
|
|
742
|
+
latest?.state === "READY" && latest.ready && latest.created && /* @__PURE__ */ jsxs4(Text3, { size: 1, muted: true, children: [
|
|
590
743
|
"Took ",
|
|
591
744
|
formatDuration(Math.floor((latest.ready - latest.created) / 1e3)),
|
|
592
745
|
" to build"
|
|
593
746
|
] }),
|
|
594
|
-
latest?.url && latest.state === "READY" && /* @__PURE__ */
|
|
595
|
-
|
|
747
|
+
latest?.url && latest.state === "READY" && /* @__PURE__ */ jsx5(Fragment, { children: /* @__PURE__ */ jsx5(Tooltip, { text: copied ? "Copied!" : "Copy URL", children: /* @__PURE__ */ jsx5(
|
|
748
|
+
Button3,
|
|
596
749
|
{
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
icon: copied ? CheckmarkIcon : CopyIcon,
|
|
604
|
-
padding: 1,
|
|
605
|
-
tone: copied ? "positive" : "default",
|
|
606
|
-
onClick: copyUrl,
|
|
607
|
-
style: { cursor: "pointer" }
|
|
608
|
-
}
|
|
609
|
-
)
|
|
750
|
+
mode: "ghost",
|
|
751
|
+
icon: copied ? CheckmarkIcon : CopyIcon,
|
|
752
|
+
padding: 1,
|
|
753
|
+
tone: copied ? "positive" : "default",
|
|
754
|
+
onClick: copyUrl,
|
|
755
|
+
style: { cursor: "pointer" }
|
|
610
756
|
}
|
|
611
|
-
) })
|
|
757
|
+
) }) })
|
|
612
758
|
] }),
|
|
613
|
-
/* @__PURE__ */
|
|
614
|
-
commitMsg && /* @__PURE__ */
|
|
615
|
-
|
|
759
|
+
/* @__PURE__ */ jsxs4(Flex4, { align: "center", gap: 2, wrap: "wrap", children: [
|
|
760
|
+
commitMsg && /* @__PURE__ */ jsx5(
|
|
761
|
+
Text3,
|
|
616
762
|
{
|
|
617
763
|
size: 0,
|
|
618
764
|
muted: true,
|
|
@@ -620,9 +766,9 @@ function DeployItem({ target, token, onDelete, onEdit }) {
|
|
|
620
766
|
children: commitMsg
|
|
621
767
|
}
|
|
622
768
|
),
|
|
623
|
-
isError && /* @__PURE__ */
|
|
624
|
-
/* @__PURE__ */
|
|
625
|
-
|
|
769
|
+
isError && /* @__PURE__ */ jsxs4(Stack, { space: 2, children: [
|
|
770
|
+
/* @__PURE__ */ jsx5(
|
|
771
|
+
Button3,
|
|
626
772
|
{
|
|
627
773
|
text: showErrorLogs ? "Hide error details" : "Show error details",
|
|
628
774
|
mode: "ghost",
|
|
@@ -634,34 +780,34 @@ function DeployItem({ target, token, onDelete, onEdit }) {
|
|
|
634
780
|
style: { alignSelf: "flex-start", cursor: "pointer" }
|
|
635
781
|
}
|
|
636
782
|
),
|
|
637
|
-
showErrorLogs && /* @__PURE__ */
|
|
638
|
-
loadingLogs && /* @__PURE__ */
|
|
639
|
-
/* @__PURE__ */
|
|
640
|
-
/* @__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" })
|
|
641
787
|
] }),
|
|
642
|
-
logError && /* @__PURE__ */
|
|
643
|
-
/* @__PURE__ */
|
|
644
|
-
safeHref(latest?.inspectorUrl) && /* @__PURE__ */
|
|
645
|
-
/* @__PURE__ */
|
|
646
|
-
/* @__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" })
|
|
647
793
|
] }) })
|
|
648
794
|
] }),
|
|
649
|
-
!loadingLogs && !logError && errorLines.length > 0 && /* @__PURE__ */
|
|
650
|
-
/* @__PURE__ */
|
|
651
|
-
safeHref(latest?.inspectorUrl) && /* @__PURE__ */
|
|
652
|
-
/* @__PURE__ */
|
|
653
|
-
/* @__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" })
|
|
654
800
|
] }) })
|
|
655
801
|
] })
|
|
656
802
|
] })
|
|
657
803
|
] }),
|
|
658
|
-
deployError && /* @__PURE__ */
|
|
804
|
+
deployError && /* @__PURE__ */ jsx5(Card3, { tone: "critical", padding: 2, radius: 2, children: /* @__PURE__ */ jsx5(Text3, { size: 1, children: deployError }) })
|
|
659
805
|
] })
|
|
660
806
|
] })
|
|
661
807
|
] }),
|
|
662
|
-
/* @__PURE__ */
|
|
663
|
-
/* @__PURE__ */
|
|
664
|
-
|
|
808
|
+
/* @__PURE__ */ jsxs4(Box3, { children: [
|
|
809
|
+
/* @__PURE__ */ jsx5(
|
|
810
|
+
Button3,
|
|
665
811
|
{
|
|
666
812
|
mode: "ghost",
|
|
667
813
|
iconRight: showDetails ? ChevronUpIcon : ChevronDownIcon,
|
|
@@ -672,62 +818,62 @@ function DeployItem({ target, token, onDelete, onEdit }) {
|
|
|
672
818
|
style: { width: "100%", justifyContent: "flex-start", borderRadius: 0, cursor: "pointer" }
|
|
673
819
|
}
|
|
674
820
|
),
|
|
675
|
-
showDetails && /* @__PURE__ */
|
|
676
|
-
/* @__PURE__ */
|
|
677
|
-
/* @__PURE__ */
|
|
678
|
-
/* @__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" })
|
|
679
825
|
] }),
|
|
680
|
-
/* @__PURE__ */
|
|
681
|
-
/* @__PURE__ */
|
|
682
|
-
/* @__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" })
|
|
683
829
|
] }),
|
|
684
|
-
target.teamId && /* @__PURE__ */
|
|
685
|
-
/* @__PURE__ */
|
|
686
|
-
/* @__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 })
|
|
687
833
|
] }),
|
|
688
|
-
fullSha && /* @__PURE__ */
|
|
689
|
-
/* @__PURE__ */
|
|
690
|
-
/* @__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 })
|
|
691
837
|
] }),
|
|
692
|
-
latest?.meta?.githubCommitAuthorName && /* @__PURE__ */
|
|
693
|
-
/* @__PURE__ */
|
|
694
|
-
/* @__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 })
|
|
695
841
|
] }),
|
|
696
|
-
branch && /* @__PURE__ */
|
|
697
|
-
/* @__PURE__ */
|
|
698
|
-
/* @__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 })
|
|
699
845
|
] }),
|
|
700
|
-
latest?.uid && /* @__PURE__ */
|
|
701
|
-
/* @__PURE__ */
|
|
702
|
-
/* @__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 })
|
|
703
849
|
] }),
|
|
704
|
-
latest?.url && /* @__PURE__ */
|
|
705
|
-
/* @__PURE__ */
|
|
706
|
-
/* @__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 })
|
|
707
853
|
] }),
|
|
708
|
-
safeHref(latest?.inspectorUrl) && /* @__PURE__ */
|
|
709
|
-
/* @__PURE__ */
|
|
710
|
-
/* @__PURE__ */
|
|
711
|
-
/* @__PURE__ */
|
|
712
|
-
/* @__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 } })
|
|
713
859
|
] }) })
|
|
714
860
|
] }),
|
|
715
|
-
latest?.created && /* @__PURE__ */
|
|
716
|
-
/* @__PURE__ */
|
|
717
|
-
/* @__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() })
|
|
718
864
|
] })
|
|
719
865
|
] }) })
|
|
720
866
|
] })
|
|
721
867
|
] }),
|
|
722
|
-
/* @__PURE__ */
|
|
723
|
-
|
|
868
|
+
/* @__PURE__ */ jsx5(
|
|
869
|
+
Flex4,
|
|
724
870
|
{
|
|
725
871
|
direction: "column",
|
|
726
872
|
gap: 2,
|
|
727
873
|
className: "dvfs-deploy-col",
|
|
728
874
|
style: { flexShrink: 0, alignSelf: "stretch" },
|
|
729
|
-
children: /* @__PURE__ */
|
|
730
|
-
|
|
875
|
+
children: /* @__PURE__ */ jsx5(
|
|
876
|
+
Button3,
|
|
731
877
|
{
|
|
732
878
|
text: "Deploy",
|
|
733
879
|
tone: "primary",
|
|
@@ -746,7 +892,7 @@ function DeployItem({ target, token, onDelete, onEdit }) {
|
|
|
746
892
|
}
|
|
747
893
|
)
|
|
748
894
|
] }) }),
|
|
749
|
-
showHistory && /* @__PURE__ */
|
|
895
|
+
showHistory && /* @__PURE__ */ jsx5(
|
|
750
896
|
DeployHistory,
|
|
751
897
|
{
|
|
752
898
|
target,
|
|
@@ -758,18 +904,24 @@ function DeployItem({ target, token, onDelete, onEdit }) {
|
|
|
758
904
|
}
|
|
759
905
|
|
|
760
906
|
// src/components/TokenSetup.tsx
|
|
761
|
-
import { useState as
|
|
907
|
+
import { useState as useState4, useCallback as useCallback4 } from "react";
|
|
762
908
|
import { useClient } from "sanity";
|
|
763
|
-
import {
|
|
764
|
-
|
|
765
|
-
|
|
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";
|
|
766
918
|
var TOKEN_DOC_ID = "config.vercelDeploy";
|
|
767
919
|
function TokenSetup({ onSaved, onCancel }) {
|
|
768
920
|
const client = useClient({ apiVersion: "2025-01-01" });
|
|
769
|
-
const [token, setToken] =
|
|
770
|
-
const [saving, setSaving] =
|
|
771
|
-
const [error, setError] =
|
|
772
|
-
const save =
|
|
921
|
+
const [token, setToken] = useState4("");
|
|
922
|
+
const [saving, setSaving] = useState4(false);
|
|
923
|
+
const [error, setError] = useState4(null);
|
|
924
|
+
const save = useCallback4(async () => {
|
|
773
925
|
if (!token.trim()) return;
|
|
774
926
|
setSaving(true);
|
|
775
927
|
setError(null);
|
|
@@ -786,17 +938,17 @@ function TokenSetup({ onSaved, onCancel }) {
|
|
|
786
938
|
setSaving(false);
|
|
787
939
|
}
|
|
788
940
|
}, [client, token, onSaved]);
|
|
789
|
-
return /* @__PURE__ */
|
|
941
|
+
return /* @__PURE__ */ jsx6(
|
|
790
942
|
Dialog2,
|
|
791
943
|
{
|
|
792
944
|
header: "Connect Vercel API token",
|
|
793
945
|
id: "token-setup",
|
|
794
946
|
onClose: onCancel,
|
|
795
947
|
width: 1,
|
|
796
|
-
footer: /* @__PURE__ */
|
|
797
|
-
onCancel && /* @__PURE__ */
|
|
798
|
-
/* @__PURE__ */
|
|
799
|
-
|
|
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,
|
|
800
952
|
{
|
|
801
953
|
text: "Save and connect",
|
|
802
954
|
tone: "primary",
|
|
@@ -808,21 +960,21 @@ function TokenSetup({ onSaved, onCancel }) {
|
|
|
808
960
|
}
|
|
809
961
|
)
|
|
810
962
|
] }),
|
|
811
|
-
children: /* @__PURE__ */
|
|
812
|
-
/* @__PURE__ */
|
|
813
|
-
/* @__PURE__ */
|
|
814
|
-
/* @__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: [
|
|
815
967
|
"Create one at ",
|
|
816
|
-
/* @__PURE__ */
|
|
968
|
+
/* @__PURE__ */ jsx6("strong", { children: "vercel.com \u2192 Settings \u2192 Tokens" }),
|
|
817
969
|
" with",
|
|
818
970
|
" ",
|
|
819
|
-
/* @__PURE__ */
|
|
971
|
+
/* @__PURE__ */ jsx6("strong", { children: "Full Account" }),
|
|
820
972
|
" scope. The token is stored in your Sanity dataset and shared across all authenticated studio users."
|
|
821
973
|
] })
|
|
822
974
|
] }),
|
|
823
|
-
/* @__PURE__ */
|
|
824
|
-
/* @__PURE__ */
|
|
825
|
-
/* @__PURE__ */
|
|
975
|
+
/* @__PURE__ */ jsxs5(Stack, { space: 2, children: [
|
|
976
|
+
/* @__PURE__ */ jsx6(Text4, { size: 1, weight: "semibold", children: "Vercel API Token" }),
|
|
977
|
+
/* @__PURE__ */ jsx6(
|
|
826
978
|
TextInput,
|
|
827
979
|
{
|
|
828
980
|
value: token,
|
|
@@ -832,49 +984,47 @@ function TokenSetup({ onSaved, onCancel }) {
|
|
|
832
984
|
}
|
|
833
985
|
)
|
|
834
986
|
] }),
|
|
835
|
-
error && /* @__PURE__ */
|
|
987
|
+
error && /* @__PURE__ */ jsx6(Card4, { tone: "critical", padding: 3, radius: 2, children: /* @__PURE__ */ jsx6(Text4, { size: 1, children: error }) })
|
|
836
988
|
] })
|
|
837
989
|
}
|
|
838
990
|
);
|
|
839
991
|
}
|
|
840
992
|
|
|
841
993
|
// src/components/DeployTargetForm.tsx
|
|
842
|
-
import { useState as
|
|
994
|
+
import { useState as useState5, useCallback as useCallback5 } from "react";
|
|
843
995
|
import { useClient as useClient2 } from "sanity";
|
|
844
996
|
import {
|
|
845
997
|
Dialog as Dialog3,
|
|
846
|
-
Box as
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
Text as Text4,
|
|
998
|
+
Box as Box4,
|
|
999
|
+
Flex as Flex6,
|
|
1000
|
+
Text as Text5,
|
|
850
1001
|
TextInput as TextInput2,
|
|
851
|
-
Button as
|
|
1002
|
+
Button as Button5,
|
|
852
1003
|
Switch,
|
|
853
1004
|
Label,
|
|
854
|
-
Card as
|
|
1005
|
+
Card as Card5
|
|
855
1006
|
} from "@sanity/ui";
|
|
856
|
-
import {
|
|
857
|
-
import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1007
|
+
import { jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
858
1008
|
var VERCEL_HOOK_RE2 = /^https:\/\/api\.vercel\.com\/v1\/integrations\/deploy\//;
|
|
859
1009
|
function DeployTargetForm({ initial, onSaved, onClose }) {
|
|
860
1010
|
const client = useClient2({ apiVersion: "2025-01-01" });
|
|
861
1011
|
const isEdit = Boolean(initial);
|
|
862
|
-
const [name, setName] =
|
|
863
|
-
const [url, setUrl] =
|
|
864
|
-
const [teamId, setTeamId] =
|
|
865
|
-
const [disableDelete, setDisableDelete] =
|
|
866
|
-
const [saving, setSaving] =
|
|
867
|
-
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);
|
|
868
1018
|
const urlValid = !url || VERCEL_HOOK_RE2.test(url.trim());
|
|
869
1019
|
const canSave = name.trim() && url.trim() && urlValid;
|
|
870
|
-
const save =
|
|
1020
|
+
const save = useCallback5(async () => {
|
|
871
1021
|
if (!canSave) return;
|
|
872
1022
|
setSaving(true);
|
|
873
1023
|
setError(null);
|
|
874
1024
|
const fields = {
|
|
875
1025
|
name: name.trim(),
|
|
876
1026
|
url: url.trim(),
|
|
877
|
-
|
|
1027
|
+
teamId: teamId.trim() || null,
|
|
878
1028
|
disableDeleteAction: disableDelete
|
|
879
1029
|
};
|
|
880
1030
|
try {
|
|
@@ -890,21 +1040,21 @@ function DeployTargetForm({ initial, onSaved, onClose }) {
|
|
|
890
1040
|
setSaving(false);
|
|
891
1041
|
}
|
|
892
1042
|
}, [canSave, isEdit, initial, client, name, url, teamId, disableDelete, onSaved]);
|
|
893
|
-
return /* @__PURE__ */
|
|
1043
|
+
return /* @__PURE__ */ jsx7(
|
|
894
1044
|
Dialog3,
|
|
895
1045
|
{
|
|
896
1046
|
header: isEdit ? `Edit "${initial?.name}"` : "Add deploy target",
|
|
897
1047
|
id: "deploy-target-form",
|
|
898
1048
|
onClose,
|
|
899
1049
|
width: 1,
|
|
900
|
-
footer: /* @__PURE__ */
|
|
901
|
-
/* @__PURE__ */
|
|
902
|
-
/* @__PURE__ */
|
|
903
|
-
|
|
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,
|
|
904
1054
|
{
|
|
905
1055
|
text: isEdit ? "Save changes" : "Add target",
|
|
906
1056
|
tone: "primary",
|
|
907
|
-
icon:
|
|
1057
|
+
icon: CheckmarkCircleIcon,
|
|
908
1058
|
loading: saving,
|
|
909
1059
|
disabled: !canSave || saving,
|
|
910
1060
|
onClick: save,
|
|
@@ -912,13 +1062,13 @@ function DeployTargetForm({ initial, onSaved, onClose }) {
|
|
|
912
1062
|
}
|
|
913
1063
|
)
|
|
914
1064
|
] }),
|
|
915
|
-
children: /* @__PURE__ */
|
|
916
|
-
/* @__PURE__ */
|
|
917
|
-
/* @__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: [
|
|
918
1068
|
"Name ",
|
|
919
|
-
/* @__PURE__ */
|
|
1069
|
+
/* @__PURE__ */ jsx7("span", { style: { color: "var(--card-fg-color)" }, children: "*" })
|
|
920
1070
|
] }),
|
|
921
|
-
/* @__PURE__ */
|
|
1071
|
+
/* @__PURE__ */ jsx7(
|
|
922
1072
|
TextInput2,
|
|
923
1073
|
{
|
|
924
1074
|
value: name,
|
|
@@ -927,12 +1077,12 @@ function DeployTargetForm({ initial, onSaved, onClose }) {
|
|
|
927
1077
|
}
|
|
928
1078
|
)
|
|
929
1079
|
] }),
|
|
930
|
-
/* @__PURE__ */
|
|
931
|
-
/* @__PURE__ */
|
|
1080
|
+
/* @__PURE__ */ jsxs6(Stack, { space: 2, children: [
|
|
1081
|
+
/* @__PURE__ */ jsxs6(Label, { size: 1, children: [
|
|
932
1082
|
"Deploy hook URL ",
|
|
933
|
-
/* @__PURE__ */
|
|
1083
|
+
/* @__PURE__ */ jsx7("span", { style: { color: "var(--card-fg-color)" }, children: "*" })
|
|
934
1084
|
] }),
|
|
935
|
-
/* @__PURE__ */
|
|
1085
|
+
/* @__PURE__ */ jsx7(
|
|
936
1086
|
TextInput2,
|
|
937
1087
|
{
|
|
938
1088
|
value: url,
|
|
@@ -940,15 +1090,15 @@ function DeployTargetForm({ initial, onSaved, onClose }) {
|
|
|
940
1090
|
placeholder: "https://api.vercel.com/v1/integrations/deploy/\u2026"
|
|
941
1091
|
}
|
|
942
1092
|
),
|
|
943
|
-
url && !urlValid && /* @__PURE__ */
|
|
944
|
-
/* @__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" })
|
|
945
1095
|
] }),
|
|
946
|
-
/* @__PURE__ */
|
|
947
|
-
/* @__PURE__ */
|
|
1096
|
+
/* @__PURE__ */ jsxs6(Stack, { space: 2, children: [
|
|
1097
|
+
/* @__PURE__ */ jsxs6(Label, { size: 1, children: [
|
|
948
1098
|
"Team ID ",
|
|
949
|
-
/* @__PURE__ */
|
|
1099
|
+
/* @__PURE__ */ jsx7("span", { style: { opacity: 0.5, fontWeight: "normal" }, children: "\u2014 optional" })
|
|
950
1100
|
] }),
|
|
951
|
-
/* @__PURE__ */
|
|
1101
|
+
/* @__PURE__ */ jsx7(
|
|
952
1102
|
TextInput2,
|
|
953
1103
|
{
|
|
954
1104
|
value: teamId,
|
|
@@ -956,14 +1106,14 @@ function DeployTargetForm({ initial, onSaved, onClose }) {
|
|
|
956
1106
|
placeholder: "team_xxxxxxxx"
|
|
957
1107
|
}
|
|
958
1108
|
),
|
|
959
|
-
/* @__PURE__ */
|
|
1109
|
+
/* @__PURE__ */ jsxs6(Text5, { size: 0, muted: true, children: [
|
|
960
1110
|
"Required for team-owned Vercel projects. Find it at Vercel \u2192 Settings \u2192 General \u2192 Team ID (starts with ",
|
|
961
|
-
/* @__PURE__ */
|
|
1111
|
+
/* @__PURE__ */ jsx7("code", { children: "team_" }),
|
|
962
1112
|
")."
|
|
963
1113
|
] })
|
|
964
1114
|
] }),
|
|
965
|
-
/* @__PURE__ */
|
|
966
|
-
/* @__PURE__ */
|
|
1115
|
+
/* @__PURE__ */ jsxs6(Flex6, { align: "center", gap: 3, children: [
|
|
1116
|
+
/* @__PURE__ */ jsx7(
|
|
967
1117
|
Switch,
|
|
968
1118
|
{
|
|
969
1119
|
checked: disableDelete,
|
|
@@ -971,36 +1121,36 @@ function DeployTargetForm({ initial, onSaved, onClose }) {
|
|
|
971
1121
|
id: "disable-delete"
|
|
972
1122
|
}
|
|
973
1123
|
),
|
|
974
|
-
/* @__PURE__ */
|
|
975
|
-
/* @__PURE__ */
|
|
976
|
-
/* @__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." })
|
|
977
1127
|
] })
|
|
978
1128
|
] }),
|
|
979
|
-
error && /* @__PURE__ */
|
|
1129
|
+
error && /* @__PURE__ */ jsx7(Card5, { tone: "critical", padding: 3, radius: 2, children: /* @__PURE__ */ jsx7(Text5, { size: 1, children: error }) })
|
|
980
1130
|
] }) })
|
|
981
1131
|
}
|
|
982
1132
|
);
|
|
983
1133
|
}
|
|
984
1134
|
|
|
985
1135
|
// src/version.ts
|
|
986
|
-
var VERSION = "1.0
|
|
1136
|
+
var VERSION = "1.1.0";
|
|
987
1137
|
|
|
988
1138
|
// src/components/DeployTool.tsx
|
|
989
|
-
import { jsx as
|
|
1139
|
+
import { jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
990
1140
|
var TOKEN_QUERY = `*[_id == "config.vercelDeploy"][0].accessToken`;
|
|
991
1141
|
var TARGETS_QUERY = `*[_type == "vercel_deploy"] | order(_createdAt asc)`;
|
|
992
1142
|
function DeployTool() {
|
|
993
1143
|
const client = useClient3({ apiVersion: "2025-01-01" });
|
|
994
|
-
const toast =
|
|
995
|
-
const [token, setToken] =
|
|
996
|
-
const [targets, setTargets] =
|
|
997
|
-
const [loading, setLoading] =
|
|
998
|
-
const [showTokenSetup, setShowTokenSetup] =
|
|
999
|
-
const [showCreateForm, setShowCreateForm] =
|
|
1000
|
-
const [pendingEdit, setPendingEdit] =
|
|
1001
|
-
const [pendingDelete, setPendingDelete] =
|
|
1002
|
-
const [deleting, setDeleting] =
|
|
1003
|
-
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 () => {
|
|
1004
1154
|
setLoading(true);
|
|
1005
1155
|
try {
|
|
1006
1156
|
const [fetchedToken, fetchedTargets] = await Promise.all([
|
|
@@ -1015,10 +1165,10 @@ function DeployTool() {
|
|
|
1015
1165
|
setLoading(false);
|
|
1016
1166
|
}
|
|
1017
1167
|
}, [client]);
|
|
1018
|
-
|
|
1168
|
+
useEffect4(() => {
|
|
1019
1169
|
load();
|
|
1020
1170
|
}, [load]);
|
|
1021
|
-
|
|
1171
|
+
useEffect4(() => {
|
|
1022
1172
|
if (document.getElementById("dvfs-styles")) return;
|
|
1023
1173
|
const style = document.createElement("style");
|
|
1024
1174
|
style.id = "dvfs-styles";
|
|
@@ -1044,7 +1194,7 @@ function DeployTool() {
|
|
|
1044
1194
|
document.getElementById("dvfs-styles")?.remove();
|
|
1045
1195
|
};
|
|
1046
1196
|
}, []);
|
|
1047
|
-
|
|
1197
|
+
useEffect4(() => {
|
|
1048
1198
|
const sub = client.listen(TARGETS_QUERY).subscribe(() => {
|
|
1049
1199
|
client.fetch(TARGETS_QUERY).then(setTargets).catch((err) => {
|
|
1050
1200
|
console.error("deploy-vercel-from-sanity: subscription refresh error", err);
|
|
@@ -1052,7 +1202,7 @@ function DeployTool() {
|
|
|
1052
1202
|
});
|
|
1053
1203
|
return () => sub.unsubscribe();
|
|
1054
1204
|
}, [client]);
|
|
1055
|
-
const confirmDelete =
|
|
1205
|
+
const confirmDelete = useCallback6(async () => {
|
|
1056
1206
|
if (!pendingDelete) return;
|
|
1057
1207
|
setDeleting(true);
|
|
1058
1208
|
try {
|
|
@@ -1067,15 +1217,15 @@ function DeployTool() {
|
|
|
1067
1217
|
}
|
|
1068
1218
|
}, [client, pendingDelete, toast]);
|
|
1069
1219
|
if (loading) {
|
|
1070
|
-
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 }) }) });
|
|
1071
1221
|
}
|
|
1072
|
-
return /* @__PURE__ */
|
|
1073
|
-
/* @__PURE__ */
|
|
1074
|
-
/* @__PURE__ */
|
|
1075
|
-
/* @__PURE__ */
|
|
1076
|
-
/* @__PURE__ */
|
|
1077
|
-
/* @__PURE__ */
|
|
1078
|
-
|
|
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,
|
|
1079
1229
|
{
|
|
1080
1230
|
text: token ? "Token connected" : "Connect API token",
|
|
1081
1231
|
mode: "ghost",
|
|
@@ -1086,8 +1236,8 @@ function DeployTool() {
|
|
|
1086
1236
|
style: { cursor: "pointer" }
|
|
1087
1237
|
}
|
|
1088
1238
|
),
|
|
1089
|
-
/* @__PURE__ */
|
|
1090
|
-
|
|
1239
|
+
/* @__PURE__ */ jsx8(
|
|
1240
|
+
Button6,
|
|
1091
1241
|
{
|
|
1092
1242
|
text: "Add target",
|
|
1093
1243
|
mode: "ghost",
|
|
@@ -1099,13 +1249,13 @@ function DeployTool() {
|
|
|
1099
1249
|
)
|
|
1100
1250
|
] })
|
|
1101
1251
|
] }),
|
|
1102
|
-
!token && /* @__PURE__ */
|
|
1103
|
-
/* @__PURE__ */
|
|
1104
|
-
/* @__PURE__ */
|
|
1105
|
-
/* @__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." })
|
|
1106
1256
|
] }),
|
|
1107
|
-
/* @__PURE__ */
|
|
1108
|
-
|
|
1257
|
+
/* @__PURE__ */ jsx8(
|
|
1258
|
+
Button6,
|
|
1109
1259
|
{
|
|
1110
1260
|
text: "Connect",
|
|
1111
1261
|
tone: "caution",
|
|
@@ -1115,16 +1265,16 @@ function DeployTool() {
|
|
|
1115
1265
|
}
|
|
1116
1266
|
)
|
|
1117
1267
|
] }) }),
|
|
1118
|
-
targets.length === 0 && /* @__PURE__ */
|
|
1119
|
-
/* @__PURE__ */
|
|
1120
|
-
/* @__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: [
|
|
1121
1271
|
"Add a deploy target using the button above, or create a",
|
|
1122
1272
|
" ",
|
|
1123
|
-
/* @__PURE__ */
|
|
1273
|
+
/* @__PURE__ */ jsx8("code", { children: "vercel_deploy" }),
|
|
1124
1274
|
" document directly in the dataset."
|
|
1125
1275
|
] }),
|
|
1126
|
-
/* @__PURE__ */
|
|
1127
|
-
|
|
1276
|
+
/* @__PURE__ */ jsx8(Flex7, { justify: "center", children: /* @__PURE__ */ jsx8(
|
|
1277
|
+
Button6,
|
|
1128
1278
|
{
|
|
1129
1279
|
text: "Add deploy target",
|
|
1130
1280
|
tone: "primary",
|
|
@@ -1134,12 +1284,12 @@ function DeployTool() {
|
|
|
1134
1284
|
}
|
|
1135
1285
|
) })
|
|
1136
1286
|
] }) }),
|
|
1137
|
-
targets.length > 0 && /* @__PURE__ */
|
|
1287
|
+
targets.length > 0 && /* @__PURE__ */ jsx8("div", { className: "dvfs-grid", style: {
|
|
1138
1288
|
display: "grid",
|
|
1139
1289
|
gridTemplateColumns: "repeat(auto-fill, minmax(min(540px, 100%), 1fr))",
|
|
1140
1290
|
gap: "16px",
|
|
1141
1291
|
alignItems: "start"
|
|
1142
|
-
}, children: targets.map((target) => /* @__PURE__ */
|
|
1292
|
+
}, children: targets.map((target) => /* @__PURE__ */ jsx8(
|
|
1143
1293
|
DeployItem,
|
|
1144
1294
|
{
|
|
1145
1295
|
target,
|
|
@@ -1150,8 +1300,8 @@ function DeployTool() {
|
|
|
1150
1300
|
target._id
|
|
1151
1301
|
)) })
|
|
1152
1302
|
] }) }),
|
|
1153
|
-
/* @__PURE__ */
|
|
1154
|
-
|
|
1303
|
+
/* @__PURE__ */ jsx8(
|
|
1304
|
+
Box5,
|
|
1155
1305
|
{
|
|
1156
1306
|
style: {
|
|
1157
1307
|
position: "fixed",
|
|
@@ -1161,13 +1311,13 @@ function DeployTool() {
|
|
|
1161
1311
|
pointerEvents: "none",
|
|
1162
1312
|
userSelect: "none"
|
|
1163
1313
|
},
|
|
1164
|
-
children: /* @__PURE__ */
|
|
1314
|
+
children: /* @__PURE__ */ jsxs7(Text6, { size: 0, muted: true, children: [
|
|
1165
1315
|
"v",
|
|
1166
1316
|
VERSION
|
|
1167
1317
|
] })
|
|
1168
1318
|
}
|
|
1169
1319
|
),
|
|
1170
|
-
showTokenSetup && /* @__PURE__ */
|
|
1320
|
+
showTokenSetup && /* @__PURE__ */ jsx8(
|
|
1171
1321
|
TokenSetup,
|
|
1172
1322
|
{
|
|
1173
1323
|
onSaved: () => {
|
|
@@ -1177,7 +1327,7 @@ function DeployTool() {
|
|
|
1177
1327
|
onCancel: token ? () => setShowTokenSetup(false) : void 0
|
|
1178
1328
|
}
|
|
1179
1329
|
),
|
|
1180
|
-
showCreateForm && /* @__PURE__ */
|
|
1330
|
+
showCreateForm && /* @__PURE__ */ jsx8(
|
|
1181
1331
|
DeployTargetForm,
|
|
1182
1332
|
{
|
|
1183
1333
|
onSaved: () => {
|
|
@@ -1187,7 +1337,7 @@ function DeployTool() {
|
|
|
1187
1337
|
onClose: () => setShowCreateForm(false)
|
|
1188
1338
|
}
|
|
1189
1339
|
),
|
|
1190
|
-
pendingEdit && /* @__PURE__ */
|
|
1340
|
+
pendingEdit && /* @__PURE__ */ jsx8(
|
|
1191
1341
|
DeployTargetForm,
|
|
1192
1342
|
{
|
|
1193
1343
|
initial: pendingEdit,
|
|
@@ -1198,16 +1348,16 @@ function DeployTool() {
|
|
|
1198
1348
|
onClose: () => setPendingEdit(null)
|
|
1199
1349
|
}
|
|
1200
1350
|
),
|
|
1201
|
-
pendingDelete && /* @__PURE__ */
|
|
1351
|
+
pendingDelete && /* @__PURE__ */ jsx8(
|
|
1202
1352
|
Dialog4,
|
|
1203
1353
|
{
|
|
1204
1354
|
header: "Delete deploy target?",
|
|
1205
1355
|
id: "confirm-delete",
|
|
1206
1356
|
onClose: () => setPendingDelete(null),
|
|
1207
1357
|
width: 1,
|
|
1208
|
-
footer: /* @__PURE__ */
|
|
1209
|
-
/* @__PURE__ */
|
|
1210
|
-
|
|
1358
|
+
footer: /* @__PURE__ */ jsxs7(Flex7, { padding: 3, gap: 2, justify: "flex-end", children: [
|
|
1359
|
+
/* @__PURE__ */ jsx8(
|
|
1360
|
+
Button6,
|
|
1211
1361
|
{
|
|
1212
1362
|
text: "Cancel",
|
|
1213
1363
|
mode: "ghost",
|
|
@@ -1215,12 +1365,12 @@ function DeployTool() {
|
|
|
1215
1365
|
style: { cursor: "pointer" }
|
|
1216
1366
|
}
|
|
1217
1367
|
),
|
|
1218
|
-
/* @__PURE__ */
|
|
1219
|
-
|
|
1368
|
+
/* @__PURE__ */ jsx8(
|
|
1369
|
+
Button6,
|
|
1220
1370
|
{
|
|
1221
1371
|
text: "Delete",
|
|
1222
1372
|
tone: "critical",
|
|
1223
|
-
icon:
|
|
1373
|
+
icon: TrashIcon,
|
|
1224
1374
|
loading: deleting,
|
|
1225
1375
|
disabled: deleting,
|
|
1226
1376
|
onClick: confirmDelete,
|
|
@@ -1228,21 +1378,21 @@ function DeployTool() {
|
|
|
1228
1378
|
}
|
|
1229
1379
|
)
|
|
1230
1380
|
] }),
|
|
1231
|
-
children: /* @__PURE__ */
|
|
1232
|
-
/* @__PURE__ */
|
|
1233
|
-
/* @__PURE__ */
|
|
1234
|
-
/* @__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 })
|
|
1235
1385
|
] }),
|
|
1236
|
-
/* @__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." })
|
|
1237
1387
|
] }) })
|
|
1238
1388
|
}
|
|
1239
|
-
)
|
|
1389
|
+
),
|
|
1390
|
+
/* @__PURE__ */ jsx8(ToastViewport, {})
|
|
1240
1391
|
] });
|
|
1241
1392
|
}
|
|
1242
1393
|
|
|
1243
1394
|
// src/schema/vercelDeploy.ts
|
|
1244
1395
|
import { defineField, defineType } from "sanity";
|
|
1245
|
-
import { RocketIcon } from "@sanity/icons";
|
|
1246
1396
|
var vercelDeploySchema = defineType({
|
|
1247
1397
|
name: "vercel_deploy",
|
|
1248
1398
|
title: "Deploy Target",
|
|
@@ -1300,7 +1450,7 @@ var vercelDeploy = definePlugin((options) => {
|
|
|
1300
1450
|
{
|
|
1301
1451
|
name: config.name ?? "vercel-deploy",
|
|
1302
1452
|
title: config.title ?? "Deploy",
|
|
1303
|
-
icon: config.icon ??
|
|
1453
|
+
icon: config.icon ?? RocketIcon,
|
|
1304
1454
|
component: DeployTool
|
|
1305
1455
|
}
|
|
1306
1456
|
]
|