dominion-cli 0.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 +304 -0
- package/dist/app.d.ts +15 -0
- package/dist/app.d.ts.map +1 -0
- package/dist/app.js +36 -0
- package/dist/app.js.map +1 -0
- package/dist/cli.d.ts +9 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +369 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands/account.d.ts +28 -0
- package/dist/commands/account.d.ts.map +1 -0
- package/dist/commands/account.js +133 -0
- package/dist/commands/account.js.map +1 -0
- package/dist/commands/billing.d.ts +16 -0
- package/dist/commands/billing.d.ts.map +1 -0
- package/dist/commands/billing.js +61 -0
- package/dist/commands/billing.js.map +1 -0
- package/dist/commands/buy.d.ts +27 -0
- package/dist/commands/buy.d.ts.map +1 -0
- package/dist/commands/buy.js +293 -0
- package/dist/commands/buy.js.map +1 -0
- package/dist/commands/cart/add.d.ts +17 -0
- package/dist/commands/cart/add.d.ts.map +1 -0
- package/dist/commands/cart/add.js +119 -0
- package/dist/commands/cart/add.js.map +1 -0
- package/dist/commands/cart/clear.d.ts +12 -0
- package/dist/commands/cart/clear.d.ts.map +1 -0
- package/dist/commands/cart/clear.js +49 -0
- package/dist/commands/cart/clear.js.map +1 -0
- package/dist/commands/cart/index.d.ts +8 -0
- package/dist/commands/cart/index.d.ts.map +1 -0
- package/dist/commands/cart/index.js +8 -0
- package/dist/commands/cart/index.js.map +1 -0
- package/dist/commands/cart/list.d.ts +14 -0
- package/dist/commands/cart/list.d.ts.map +1 -0
- package/dist/commands/cart/list.js +51 -0
- package/dist/commands/cart/list.js.map +1 -0
- package/dist/commands/cart/remove.d.ts +13 -0
- package/dist/commands/cart/remove.d.ts.map +1 -0
- package/dist/commands/cart/remove.js +24 -0
- package/dist/commands/cart/remove.js.map +1 -0
- package/dist/commands/credits.d.ts +10 -0
- package/dist/commands/credits.d.ts.map +1 -0
- package/dist/commands/credits.js +139 -0
- package/dist/commands/credits.js.map +1 -0
- package/dist/commands/dns/add.d.ts +30 -0
- package/dist/commands/dns/add.d.ts.map +1 -0
- package/dist/commands/dns/add.js +144 -0
- package/dist/commands/dns/add.js.map +1 -0
- package/dist/commands/dns/index.d.ts +7 -0
- package/dist/commands/dns/index.d.ts.map +1 -0
- package/dist/commands/dns/index.js +7 -0
- package/dist/commands/dns/index.js.map +1 -0
- package/dist/commands/dns/list.d.ts +24 -0
- package/dist/commands/dns/list.d.ts.map +1 -0
- package/dist/commands/dns/list.js +111 -0
- package/dist/commands/dns/list.js.map +1 -0
- package/dist/commands/dns/remove.d.ts +24 -0
- package/dist/commands/dns/remove.d.ts.map +1 -0
- package/dist/commands/dns/remove.js +137 -0
- package/dist/commands/dns/remove.js.map +1 -0
- package/dist/commands/domains/detail.d.ts +20 -0
- package/dist/commands/domains/detail.d.ts.map +1 -0
- package/dist/commands/domains/detail.js +112 -0
- package/dist/commands/domains/detail.js.map +1 -0
- package/dist/commands/domains/index.d.ts +6 -0
- package/dist/commands/domains/index.d.ts.map +1 -0
- package/dist/commands/domains/index.js +6 -0
- package/dist/commands/domains/index.js.map +1 -0
- package/dist/commands/domains/list.d.ts +21 -0
- package/dist/commands/domains/list.d.ts.map +1 -0
- package/dist/commands/domains/list.js +106 -0
- package/dist/commands/domains/list.js.map +1 -0
- package/dist/commands/hack.d.ts +9 -0
- package/dist/commands/hack.d.ts.map +1 -0
- package/dist/commands/hack.js +104 -0
- package/dist/commands/hack.js.map +1 -0
- package/dist/commands/integrations.d.ts +20 -0
- package/dist/commands/integrations.d.ts.map +1 -0
- package/dist/commands/integrations.js +92 -0
- package/dist/commands/integrations.js.map +1 -0
- package/dist/commands/login.d.ts +15 -0
- package/dist/commands/login.d.ts.map +1 -0
- package/dist/commands/login.js +95 -0
- package/dist/commands/login.js.map +1 -0
- package/dist/commands/logout.d.ts +13 -0
- package/dist/commands/logout.d.ts.map +1 -0
- package/dist/commands/logout.js +32 -0
- package/dist/commands/logout.js.map +1 -0
- package/dist/commands/search.d.ts +24 -0
- package/dist/commands/search.d.ts.map +1 -0
- package/dist/commands/search.js +162 -0
- package/dist/commands/search.js.map +1 -0
- package/dist/commands/settings/index.d.ts +6 -0
- package/dist/commands/settings/index.d.ts.map +1 -0
- package/dist/commands/settings/index.js +6 -0
- package/dist/commands/settings/index.js.map +1 -0
- package/dist/commands/settings/set.d.ts +25 -0
- package/dist/commands/settings/set.d.ts.map +1 -0
- package/dist/commands/settings/set.js +215 -0
- package/dist/commands/settings/set.js.map +1 -0
- package/dist/commands/settings/view.d.ts +17 -0
- package/dist/commands/settings/view.d.ts.map +1 -0
- package/dist/commands/settings/view.js +99 -0
- package/dist/commands/settings/view.js.map +1 -0
- package/dist/commands/team/add.d.ts +17 -0
- package/dist/commands/team/add.d.ts.map +1 -0
- package/dist/commands/team/add.js +64 -0
- package/dist/commands/team/add.js.map +1 -0
- package/dist/commands/team/index.d.ts +7 -0
- package/dist/commands/team/index.d.ts.map +1 -0
- package/dist/commands/team/index.js +7 -0
- package/dist/commands/team/index.js.map +1 -0
- package/dist/commands/team/list.d.ts +13 -0
- package/dist/commands/team/list.d.ts.map +1 -0
- package/dist/commands/team/list.js +51 -0
- package/dist/commands/team/list.js.map +1 -0
- package/dist/commands/team/remove.d.ts +14 -0
- package/dist/commands/team/remove.d.ts.map +1 -0
- package/dist/commands/team/remove.js +57 -0
- package/dist/commands/team/remove.js.map +1 -0
- package/dist/commands/vercel/index.d.ts +8 -0
- package/dist/commands/vercel/index.d.ts.map +1 -0
- package/dist/commands/vercel/index.js +8 -0
- package/dist/commands/vercel/index.js.map +1 -0
- package/dist/commands/vercel/link.d.ts +25 -0
- package/dist/commands/vercel/link.d.ts.map +1 -0
- package/dist/commands/vercel/link.js +176 -0
- package/dist/commands/vercel/link.js.map +1 -0
- package/dist/commands/vercel/setup.d.ts +13 -0
- package/dist/commands/vercel/setup.d.ts.map +1 -0
- package/dist/commands/vercel/setup.js +113 -0
- package/dist/commands/vercel/setup.js.map +1 -0
- package/dist/commands/vercel/status.d.ts +15 -0
- package/dist/commands/vercel/status.d.ts.map +1 -0
- package/dist/commands/vercel/status.js +103 -0
- package/dist/commands/vercel/status.js.map +1 -0
- package/dist/commands/vercel/unlink.d.ts +16 -0
- package/dist/commands/vercel/unlink.d.ts.map +1 -0
- package/dist/commands/vercel/unlink.js +118 -0
- package/dist/commands/vercel/unlink.js.map +1 -0
- package/dist/commands/webhooks/add.d.ts +16 -0
- package/dist/commands/webhooks/add.d.ts.map +1 -0
- package/dist/commands/webhooks/add.js +61 -0
- package/dist/commands/webhooks/add.js.map +1 -0
- package/dist/commands/webhooks/index.d.ts +7 -0
- package/dist/commands/webhooks/index.d.ts.map +1 -0
- package/dist/commands/webhooks/index.js +7 -0
- package/dist/commands/webhooks/index.js.map +1 -0
- package/dist/commands/webhooks/list.d.ts +14 -0
- package/dist/commands/webhooks/list.d.ts.map +1 -0
- package/dist/commands/webhooks/list.js +47 -0
- package/dist/commands/webhooks/list.js.map +1 -0
- package/dist/commands/webhooks/remove.d.ts +14 -0
- package/dist/commands/webhooks/remove.d.ts.map +1 -0
- package/dist/commands/webhooks/remove.js +57 -0
- package/dist/commands/webhooks/remove.js.map +1 -0
- package/dist/commands/whoami.d.ts +13 -0
- package/dist/commands/whoami.d.ts.map +1 -0
- package/dist/commands/whoami.js +33 -0
- package/dist/commands/whoami.js.map +1 -0
- package/dist/components/account-card.d.ts +17 -0
- package/dist/components/account-card.d.ts.map +1 -0
- package/dist/components/account-card.js +19 -0
- package/dist/components/account-card.js.map +1 -0
- package/dist/components/billing-table.d.ts +22 -0
- package/dist/components/billing-table.d.ts.map +1 -0
- package/dist/components/billing-table.js +53 -0
- package/dist/components/billing-table.js.map +1 -0
- package/dist/components/celebration.d.ts +21 -0
- package/dist/components/celebration.d.ts.map +1 -0
- package/dist/components/celebration.js +55 -0
- package/dist/components/celebration.js.map +1 -0
- package/dist/components/contact-form.d.ts +23 -0
- package/dist/components/contact-form.d.ts.map +1 -0
- package/dist/components/contact-form.js +109 -0
- package/dist/components/contact-form.js.map +1 -0
- package/dist/components/dns-table.d.ts +14 -0
- package/dist/components/dns-table.d.ts.map +1 -0
- package/dist/components/dns-table.js +71 -0
- package/dist/components/dns-table.js.map +1 -0
- package/dist/components/domain-card.d.ts +14 -0
- package/dist/components/domain-card.d.ts.map +1 -0
- package/dist/components/domain-card.js +41 -0
- package/dist/components/domain-card.js.map +1 -0
- package/dist/components/domain-table.d.ts +30 -0
- package/dist/components/domain-table.d.ts.map +1 -0
- package/dist/components/domain-table.js +87 -0
- package/dist/components/domain-table.js.map +1 -0
- package/dist/components/error-display.d.ts +25 -0
- package/dist/components/error-display.d.ts.map +1 -0
- package/dist/components/error-display.js +51 -0
- package/dist/components/error-display.js.map +1 -0
- package/dist/components/layout.d.ts +14 -0
- package/dist/components/layout.d.ts.map +1 -0
- package/dist/components/layout.js +21 -0
- package/dist/components/layout.js.map +1 -0
- package/dist/components/logo.d.ts +37 -0
- package/dist/components/logo.d.ts.map +1 -0
- package/dist/components/logo.js +70 -0
- package/dist/components/logo.js.map +1 -0
- package/dist/components/matrix-rain.d.ts +17 -0
- package/dist/components/matrix-rain.d.ts.map +1 -0
- package/dist/components/matrix-rain.js +105 -0
- package/dist/components/matrix-rain.js.map +1 -0
- package/dist/components/purchase-confirmation.d.ts +17 -0
- package/dist/components/purchase-confirmation.d.ts.map +1 -0
- package/dist/components/purchase-confirmation.js +17 -0
- package/dist/components/purchase-confirmation.js.map +1 -0
- package/dist/components/search-results.d.ts +30 -0
- package/dist/components/search-results.d.ts.map +1 -0
- package/dist/components/search-results.js +53 -0
- package/dist/components/search-results.js.map +1 -0
- package/dist/components/settings-card.d.ts +14 -0
- package/dist/components/settings-card.d.ts.map +1 -0
- package/dist/components/settings-card.js +40 -0
- package/dist/components/settings-card.js.map +1 -0
- package/dist/components/spinner-messages.d.ts +19 -0
- package/dist/components/spinner-messages.d.ts.map +1 -0
- package/dist/components/spinner-messages.js +55 -0
- package/dist/components/spinner-messages.js.map +1 -0
- package/dist/lib/achievements.d.ts +107 -0
- package/dist/lib/achievements.d.ts.map +1 -0
- package/dist/lib/achievements.js +341 -0
- package/dist/lib/achievements.js.map +1 -0
- package/dist/lib/auth.d.ts +45 -0
- package/dist/lib/auth.d.ts.map +1 -0
- package/dist/lib/auth.js +125 -0
- package/dist/lib/auth.js.map +1 -0
- package/dist/lib/cart.d.ts +69 -0
- package/dist/lib/cart.d.ts.map +1 -0
- package/dist/lib/cart.js +131 -0
- package/dist/lib/cart.js.map +1 -0
- package/dist/lib/config.d.ts +51 -0
- package/dist/lib/config.d.ts.map +1 -0
- package/dist/lib/config.js +116 -0
- package/dist/lib/config.js.map +1 -0
- package/dist/lib/dns-validation.d.ts +51 -0
- package/dist/lib/dns-validation.d.ts.map +1 -0
- package/dist/lib/dns-validation.js +185 -0
- package/dist/lib/dns-validation.js.map +1 -0
- package/dist/lib/easter-eggs.d.ts +21 -0
- package/dist/lib/easter-eggs.d.ts.map +1 -0
- package/dist/lib/easter-eggs.js +64 -0
- package/dist/lib/easter-eggs.js.map +1 -0
- package/dist/lib/error-personality.d.ts +35 -0
- package/dist/lib/error-personality.d.ts.map +1 -0
- package/dist/lib/error-personality.js +191 -0
- package/dist/lib/error-personality.js.map +1 -0
- package/dist/lib/errors.d.ts +8 -0
- package/dist/lib/errors.d.ts.map +1 -0
- package/dist/lib/errors.js +7 -0
- package/dist/lib/errors.js.map +1 -0
- package/dist/lib/konami.d.ts +51 -0
- package/dist/lib/konami.d.ts.map +1 -0
- package/dist/lib/konami.js +107 -0
- package/dist/lib/konami.js.map +1 -0
- package/dist/lib/loading-messages.d.ts +13 -0
- package/dist/lib/loading-messages.d.ts.map +1 -0
- package/dist/lib/loading-messages.js +13 -0
- package/dist/lib/loading-messages.js.map +1 -0
- package/dist/lib/namecom-client.d.ts +73 -0
- package/dist/lib/namecom-client.d.ts.map +1 -0
- package/dist/lib/namecom-client.js +260 -0
- package/dist/lib/namecom-client.js.map +1 -0
- package/dist/lib/nameserver-presets.d.ts +27 -0
- package/dist/lib/nameserver-presets.d.ts.map +1 -0
- package/dist/lib/nameserver-presets.js +45 -0
- package/dist/lib/nameserver-presets.js.map +1 -0
- package/dist/lib/purchase.d.ts +71 -0
- package/dist/lib/purchase.d.ts.map +1 -0
- package/dist/lib/purchase.js +160 -0
- package/dist/lib/purchase.js.map +1 -0
- package/dist/lib/schemas.d.ts +1968 -0
- package/dist/lib/schemas.d.ts.map +1 -0
- package/dist/lib/schemas.js +112 -0
- package/dist/lib/schemas.js.map +1 -0
- package/dist/lib/team.d.ts +71 -0
- package/dist/lib/team.d.ts.map +1 -0
- package/dist/lib/team.js +135 -0
- package/dist/lib/team.js.map +1 -0
- package/dist/lib/theme.d.ts +152 -0
- package/dist/lib/theme.d.ts.map +1 -0
- package/dist/lib/theme.js +185 -0
- package/dist/lib/theme.js.map +1 -0
- package/dist/lib/types.d.ts +136 -0
- package/dist/lib/types.d.ts.map +1 -0
- package/dist/lib/types.js +19 -0
- package/dist/lib/types.js.map +1 -0
- package/dist/lib/vercel-client.d.ts +110 -0
- package/dist/lib/vercel-client.d.ts.map +1 -0
- package/dist/lib/vercel-client.js +196 -0
- package/dist/lib/vercel-client.js.map +1 -0
- package/dist/lib/webhooks.d.ts +83 -0
- package/dist/lib/webhooks.d.ts.map +1 -0
- package/dist/lib/webhooks.js +195 -0
- package/dist/lib/webhooks.js.map +1 -0
- package/package.json +66 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unlink.d.ts","sourceRoot":"","sources":["../../../src/commands/vercel/unlink.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAI1D,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,YAAY,CAAC,EAAE,YAAY,CAAC;CAC7B;AAID,wBAAgB,YAAY,CAAC,EAC3B,MAAM,EACN,aAAa,EACb,YAAY,GACb,EAAE,iBAAiB,2CAgKnB;AAED,eAAe,YAAY,CAAC"}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* dominion vercel unlink <domain> — remove a domain from the Vercel project.
|
|
4
|
+
*
|
|
5
|
+
* Confirms with the user before removing. Calls VercelClient.removeDomain()
|
|
6
|
+
* to unregister the domain from the Vercel project.
|
|
7
|
+
*/
|
|
8
|
+
import { Box, Text, useApp, useInput } from "ink";
|
|
9
|
+
import { useState, useEffect, useRef } from "react";
|
|
10
|
+
import { ConfigManager } from "../../lib/config.js";
|
|
11
|
+
import { VercelClient } from "../../lib/vercel-client.js";
|
|
12
|
+
import { getRandomMessage } from "../../components/spinner-messages.js";
|
|
13
|
+
import { DomainError } from "../../lib/types.js";
|
|
14
|
+
export function VercelUnlink({ domain, configManager, vercelClient, }) {
|
|
15
|
+
const { exit } = useApp();
|
|
16
|
+
const [state, setState] = useState("confirm");
|
|
17
|
+
const [loadingMessage, setLoadingMessage] = useState(getRandomMessage());
|
|
18
|
+
const [errorMessage, setErrorMessage] = useState("");
|
|
19
|
+
const intervalRef = useRef(null);
|
|
20
|
+
// Rotate loading messages
|
|
21
|
+
useEffect(() => {
|
|
22
|
+
if (state === "removing") {
|
|
23
|
+
intervalRef.current = setInterval(() => {
|
|
24
|
+
setLoadingMessage(getRandomMessage());
|
|
25
|
+
}, 2000);
|
|
26
|
+
return () => {
|
|
27
|
+
if (intervalRef.current) {
|
|
28
|
+
clearInterval(intervalRef.current);
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
}, [state]);
|
|
33
|
+
// Handle confirmation input
|
|
34
|
+
useInput((input, key) => {
|
|
35
|
+
if (state !== "confirm")
|
|
36
|
+
return;
|
|
37
|
+
if (input === "y" || input === "Y") {
|
|
38
|
+
setState("removing");
|
|
39
|
+
}
|
|
40
|
+
else if (input === "n" || input === "N" || key.escape) {
|
|
41
|
+
setState("cancelled");
|
|
42
|
+
setTimeout(() => exit(), 100);
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
// Remove domain from Vercel when confirmed
|
|
46
|
+
useEffect(() => {
|
|
47
|
+
if (state !== "removing")
|
|
48
|
+
return;
|
|
49
|
+
let cancelled = false;
|
|
50
|
+
const manager = configManager ?? new ConfigManager();
|
|
51
|
+
async function removeDomain() {
|
|
52
|
+
const config = manager.load();
|
|
53
|
+
// Check Vercel config
|
|
54
|
+
if (!config.vercel?.token || !config.vercel?.projectId) {
|
|
55
|
+
setErrorMessage("Vercel integration not configured. Run `dominion vercel setup` to connect.");
|
|
56
|
+
setState("error");
|
|
57
|
+
setTimeout(() => exit(), 200);
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
try {
|
|
61
|
+
const client = vercelClient ??
|
|
62
|
+
new VercelClient({
|
|
63
|
+
apiToken: config.vercel.token,
|
|
64
|
+
projectId: config.vercel.projectId,
|
|
65
|
+
teamId: config.vercel.teamId,
|
|
66
|
+
});
|
|
67
|
+
await client.removeDomain(domain);
|
|
68
|
+
if (cancelled)
|
|
69
|
+
return;
|
|
70
|
+
setState("done");
|
|
71
|
+
setTimeout(() => exit(), 200);
|
|
72
|
+
}
|
|
73
|
+
catch (err) {
|
|
74
|
+
if (cancelled)
|
|
75
|
+
return;
|
|
76
|
+
if (err instanceof DomainError) {
|
|
77
|
+
if (err.code === "DOMAIN_NOT_FOUND") {
|
|
78
|
+
setErrorMessage(`Domain "${domain}" is not linked to your Vercel project.`);
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
setErrorMessage(err.message);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
setErrorMessage(err instanceof Error
|
|
86
|
+
? err.message
|
|
87
|
+
: "An unexpected error occurred while unlinking the domain.");
|
|
88
|
+
}
|
|
89
|
+
setState("error");
|
|
90
|
+
setTimeout(() => exit(), 200);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
removeDomain();
|
|
94
|
+
return () => {
|
|
95
|
+
cancelled = true;
|
|
96
|
+
};
|
|
97
|
+
}, [state, domain, configManager, vercelClient, exit]);
|
|
98
|
+
// ─── Confirmation prompt ────────────────────────────────────────────────────
|
|
99
|
+
if (state === "confirm") {
|
|
100
|
+
return (_jsxs(Box, { flexDirection: "column", gap: 1, children: [_jsxs(Text, { bold: true, color: "cyan", children: ["Unlink ", domain, " from Vercel"] }), _jsxs(Text, { color: "yellow", children: ["This will remove ", domain, " from your Vercel project. The domain will no longer serve your Vercel deployment."] }), _jsxs(Text, { children: ["Remove ", _jsx(Text, { bold: true, color: "white", children: domain }), " from Vercel? (y/n)"] })] }));
|
|
101
|
+
}
|
|
102
|
+
// ─── Removing ───────────────────────────────────────────────────────────────
|
|
103
|
+
if (state === "removing") {
|
|
104
|
+
return (_jsxs(Box, { flexDirection: "column", gap: 1, children: [_jsxs(Text, { bold: true, color: "cyan", children: ["Unlinking ", domain, " from Vercel..."] }), _jsxs(Text, { color: "yellow", children: ["\u2837", " ", loadingMessage] })] }));
|
|
105
|
+
}
|
|
106
|
+
// ─── Done ───────────────────────────────────────────────────────────────────
|
|
107
|
+
if (state === "done") {
|
|
108
|
+
return (_jsxs(Box, { flexDirection: "column", gap: 1, children: [_jsxs(Text, { color: "green", bold: true, children: ["\u2714", " ", domain, " has been unlinked from your Vercel project."] }), _jsxs(Text, { color: "gray", children: ["DNS records are still configured. Remove them with", " ", _jsxs(Text, { bold: true, color: "white", children: ["dominion dns ", domain] }), " if needed."] })] }));
|
|
109
|
+
}
|
|
110
|
+
// ─── Cancelled ──────────────────────────────────────────────────────────────
|
|
111
|
+
if (state === "cancelled") {
|
|
112
|
+
return (_jsx(Box, { children: _jsxs(Text, { color: "gray", children: ["Unlink cancelled. ", domain, " remains linked to Vercel."] }) }));
|
|
113
|
+
}
|
|
114
|
+
// ─── Error ──────────────────────────────────────────────────────────────────
|
|
115
|
+
return (_jsxs(Box, { flexDirection: "column", gap: 1, children: [_jsxs(Text, { bold: true, color: "red", children: ["Failed to unlink ", domain, " from Vercel"] }), _jsx(Text, { color: "red", children: errorMessage })] }));
|
|
116
|
+
}
|
|
117
|
+
export default VercelUnlink;
|
|
118
|
+
//# sourceMappingURL=unlink.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unlink.js","sourceRoot":"","sources":["../../../src/commands/vercel/unlink.tsx"],"names":[],"mappings":";AAAA;;;;;GAKG;AAEH,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AACxE,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAUjD,MAAM,UAAU,YAAY,CAAC,EAC3B,MAAM,EACN,aAAa,EACb,YAAY,GACM;IAClB,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,EAAE,CAAC;IAC1B,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAc,SAAS,CAAC,CAAC;IAC3D,MAAM,CAAC,cAAc,EAAE,iBAAiB,CAAC,GAAG,QAAQ,CAAC,gBAAgB,EAAE,CAAC,CAAC;IACzE,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAC;IACrD,MAAM,WAAW,GAAG,MAAM,CAAwC,IAAI,CAAC,CAAC;IAExE,0BAA0B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AAC,KAAK,EAAC,OAAO,8BAAe,MAAM,IAAQ,mBAChD,IACH,CACP,CAAC;IACJ,CAAC;IAED,+EAA+E;IAE/E,IAAI,KAAK,KAAK,WAAW,EAAE,CAAC;QAC1B,OAAO,CACL,KAAC,GAAG,cACF,MAAC,IAAI,IAAC,KAAK,EAAC,MAAM,mCAAoB,MAAM,kCAAkC,GAC1E,CACP,CAAC;IACJ,CAAC;IAED,+EAA+E;IAE/E,OAAO,CACL,MAAC,GAAG,IAAC,aAAa,EAAC,QAAQ,EAAC,GAAG,EAAE,CAAC,aAChC,MAAC,IAAI,IAAC,IAAI,QAAC,KAAK,EAAC,KAAK,kCAAmB,MAAM,oBAAoB,EACnE,KAAC,IAAI,IAAC,KAAK,EAAC,KAAK,YAAE,YAAY,GAAQ,IACnC,CACP,CAAC;AACJ,CAAC;AAED,eAAe,YAAY,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* dominion webhooks add <url> — add a webhook.
|
|
3
|
+
*
|
|
4
|
+
* Adds a webhook with the specified URL and event subscriptions.
|
|
5
|
+
* Events: domain.registered, domain.expired, dns.changed, domain.renewed.
|
|
6
|
+
* If no --events flag is provided, subscribes to all events.
|
|
7
|
+
*/
|
|
8
|
+
import { WebhookManager } from "../../lib/webhooks.js";
|
|
9
|
+
export interface WebhooksAddProps {
|
|
10
|
+
url: string;
|
|
11
|
+
events?: string;
|
|
12
|
+
webhookManager?: WebhookManager;
|
|
13
|
+
}
|
|
14
|
+
export declare function WebhooksAdd({ url, events, webhookManager }: WebhooksAddProps): import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export default WebhooksAdd;
|
|
16
|
+
//# sourceMappingURL=add.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add.d.ts","sourceRoot":"","sources":["../../../src/commands/webhooks/add.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,EACL,cAAc,EAKf,MAAM,uBAAuB,CAAC;AAE/B,MAAM,WAAW,gBAAgB;IAC/B,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,cAAc,CAAC,EAAE,cAAc,CAAC;CACjC;AAID,wBAAgB,WAAW,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,cAAc,EAAE,EAAE,gBAAgB,2CA2G5E;AAED,eAAe,WAAW,CAAC"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* dominion webhooks add <url> — add a webhook.
|
|
4
|
+
*
|
|
5
|
+
* Adds a webhook with the specified URL and event subscriptions.
|
|
6
|
+
* Events: domain.registered, domain.expired, dns.changed, domain.renewed.
|
|
7
|
+
* If no --events flag is provided, subscribes to all events.
|
|
8
|
+
*/
|
|
9
|
+
import { Box, Text, useApp } from "ink";
|
|
10
|
+
import { useEffect, useState } from "react";
|
|
11
|
+
import { WebhookManager, isValidEvent, getValidEvents, } from "../../lib/webhooks.js";
|
|
12
|
+
export function WebhooksAdd({ url, events, webhookManager }) {
|
|
13
|
+
const { exit } = useApp();
|
|
14
|
+
const [state, setState] = useState("adding");
|
|
15
|
+
const [errorMessage, setErrorMessage] = useState("");
|
|
16
|
+
const [webhook, setWebhook] = useState(null);
|
|
17
|
+
useEffect(() => {
|
|
18
|
+
const manager = webhookManager ?? new WebhookManager();
|
|
19
|
+
try {
|
|
20
|
+
// Parse events — if provided, split by comma; otherwise use all events
|
|
21
|
+
let resolvedEvents;
|
|
22
|
+
if (events) {
|
|
23
|
+
const parts = events.split(",").map((e) => e.trim());
|
|
24
|
+
// Validate each event
|
|
25
|
+
for (const part of parts) {
|
|
26
|
+
if (!isValidEvent(part)) {
|
|
27
|
+
setErrorMessage(`Invalid event "${part}". Must be one of: ${getValidEvents().join(", ")}`);
|
|
28
|
+
setState("error");
|
|
29
|
+
setTimeout(() => exit(), 200);
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
resolvedEvents = parts;
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
resolvedEvents = getValidEvents();
|
|
37
|
+
}
|
|
38
|
+
const created = manager.add(url, resolvedEvents);
|
|
39
|
+
setWebhook(created);
|
|
40
|
+
setState("added");
|
|
41
|
+
setTimeout(() => exit(), 200);
|
|
42
|
+
}
|
|
43
|
+
catch (err) {
|
|
44
|
+
setErrorMessage(err instanceof Error ? err.message : "An unexpected error occurred.");
|
|
45
|
+
setState("error");
|
|
46
|
+
setTimeout(() => exit(), 200);
|
|
47
|
+
}
|
|
48
|
+
}, [url, events, webhookManager, exit]);
|
|
49
|
+
// ─── Adding state ───────────────────────────────────────────────────────
|
|
50
|
+
if (state === "adding") {
|
|
51
|
+
return (_jsx(Box, { flexDirection: "column", gap: 1, children: _jsx(Text, { bold: true, color: "cyan", children: "Adding webhook..." }) }));
|
|
52
|
+
}
|
|
53
|
+
// ─── Error state ──────────────────────────────────────────────────────
|
|
54
|
+
if (state === "error") {
|
|
55
|
+
return (_jsxs(Box, { flexDirection: "column", gap: 1, children: [_jsx(Text, { bold: true, color: "red", children: "Failed to add webhook" }), _jsx(Text, { color: "red", children: errorMessage })] }));
|
|
56
|
+
}
|
|
57
|
+
// ─── Added state ──────────────────────────────────────────────────────
|
|
58
|
+
return (_jsxs(Box, { flexDirection: "column", gap: 1, children: [_jsx(Text, { bold: true, color: "green", children: "Webhook added" }), webhook && (_jsxs(_Fragment, { children: [_jsxs(Box, { children: [_jsx(Text, { color: "white", children: "ID: " }), _jsx(Text, { bold: true, color: "cyan", children: webhook.id })] }), _jsxs(Box, { children: [_jsx(Text, { color: "white", children: "URL: " }), _jsx(Text, { bold: true, color: "cyan", children: webhook.url })] }), _jsxs(Box, { children: [_jsx(Text, { color: "white", children: "Events: " }), _jsx(Text, { color: "cyan", children: webhook.events.join(", ") })] })] })), _jsxs(Text, { color: "gray", children: ["Run", " ", _jsx(Text, { bold: true, color: "white", children: "dominion webhooks" }), " ", "to view all webhooks."] })] }));
|
|
59
|
+
}
|
|
60
|
+
export default WebhooksAdd;
|
|
61
|
+
//# sourceMappingURL=add.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add.js","sourceRoot":"","sources":["../../../src/commands/webhooks/add.tsx"],"names":[],"mappings":";AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,KAAK,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,EACL,cAAc,EACd,YAAY,EACZ,cAAc,GAGf,MAAM,uBAAuB,CAAC;AAU/B,MAAM,UAAU,WAAW,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,cAAc,EAAoB;IAC3E,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,EAAE,CAAC;IAC1B,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAW,QAAQ,CAAC,CAAC;IACvD,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAC;IACrD,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAiB,IAAI,CAAC,CAAC;IAE7D,SAAS,CAAC,GAAG,EAAE;QACb,MAAM,OAAO,GAAG,cAAc,IAAI,IAAI,cAAc,EAAE,CAAC;QAEvD,IAAI,CAAC;YACH,uEAAuE;YACvE,IAAI,cAA8B,CAAC;YAEnC,IAAI,MAAM,EAAE,CAAC;gBACX,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;gBAErD,sBAAsB;gBACtB,KAAK,MAAM,IAAI,IAAI,KAAK,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sx"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/webhooks/index.tsx"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* dominion webhooks list — display configured webhooks.
|
|
3
|
+
*
|
|
4
|
+
* Shows a formatted table of webhooks with URL, events, active status,
|
|
5
|
+
* and last triggered timestamp.
|
|
6
|
+
* Empty state shows helpful hint to run dominion webhooks add.
|
|
7
|
+
*/
|
|
8
|
+
import { WebhookManager } from "../../lib/webhooks.js";
|
|
9
|
+
export interface WebhooksListProps {
|
|
10
|
+
webhookManager?: WebhookManager;
|
|
11
|
+
}
|
|
12
|
+
export declare function WebhooksList({ webhookManager }: WebhooksListProps): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export default WebhooksList;
|
|
14
|
+
//# sourceMappingURL=list.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../src/commands/webhooks/list.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,EAAE,cAAc,EAAgB,MAAM,uBAAuB,CAAC;AAErE,MAAM,WAAW,iBAAiB;IAChC,cAAc,CAAC,EAAE,cAAc,CAAC;CACjC;AAED,wBAAgB,YAAY,CAAC,EAAE,cAAc,EAAE,EAAE,iBAAiB,2CAoHjE;AAkBD,eAAe,YAAY,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* dominion webhooks list — display configured webhooks.
|
|
4
|
+
*
|
|
5
|
+
* Shows a formatted table of webhooks with URL, events, active status,
|
|
6
|
+
* and last triggered timestamp.
|
|
7
|
+
* Empty state shows helpful hint to run dominion webhooks add.
|
|
8
|
+
*/
|
|
9
|
+
import { Box, Text, useApp } from "ink";
|
|
10
|
+
import { useEffect } from "react";
|
|
11
|
+
import { WebhookManager } from "../../lib/webhooks.js";
|
|
12
|
+
export function WebhooksList({ webhookManager }) {
|
|
13
|
+
const { exit } = useApp();
|
|
14
|
+
const manager = webhookManager ?? new WebhookManager();
|
|
15
|
+
const webhooks = manager.list();
|
|
16
|
+
useEffect(() => {
|
|
17
|
+
const timer = setTimeout(() => exit(), 200);
|
|
18
|
+
return () => clearTimeout(timer);
|
|
19
|
+
}, [exit]);
|
|
20
|
+
if (webhooks.length === 0) {
|
|
21
|
+
return (_jsxs(Box, { flexDirection: "column", gap: 1, children: [_jsx(Text, { bold: true, color: "cyan", children: "Webhooks" }), _jsx(Text, { color: "yellow", children: "No webhooks configured." }), _jsxs(Text, { color: "gray", children: ["Add a webhook with", " ", _jsxs(Text, { bold: true, color: "white", children: ["dominion webhooks add ", "<url>"] })] })] }));
|
|
22
|
+
}
|
|
23
|
+
return (_jsxs(Box, { flexDirection: "column", gap: 1, children: [_jsxs(Text, { bold: true, color: "cyan", children: ["Webhooks (", webhooks.length, " configured)"] }), _jsxs(Box, { children: [_jsx(Box, { width: 10, children: _jsx(Text, { bold: true, color: "gray", children: "ID" }) }), _jsx(Box, { width: 40, children: _jsx(Text, { bold: true, color: "gray", children: "URL" }) }), _jsx(Box, { width: 25, children: _jsx(Text, { bold: true, color: "gray", children: "Events" }) }), _jsx(Box, { width: 8, children: _jsx(Text, { bold: true, color: "gray", children: "Active" }) }), _jsx(Box, { width: 20, children: _jsx(Text, { bold: true, color: "gray", children: "Last Triggered" }) })] }), _jsx(Text, { color: "gray", children: "─".repeat(103) }), webhooks.map((webhook) => {
|
|
24
|
+
const eventsStr = webhook.events.join(", ");
|
|
25
|
+
const lastTriggered = webhook.lastTriggeredAt
|
|
26
|
+
? formatDate(new Date(webhook.lastTriggeredAt))
|
|
27
|
+
: "Never";
|
|
28
|
+
return (_jsxs(Box, { children: [_jsx(Box, { width: 10, children: _jsx(Text, { bold: true, color: "white", children: webhook.id }) }), _jsx(Box, { width: 40, children: _jsx(Text, { color: "cyan", children: truncate(webhook.url, 38) }) }), _jsx(Box, { width: 25, children: _jsx(Text, { color: "gray", children: truncate(eventsStr, 23) }) }), _jsx(Box, { width: 8, children: _jsx(Text, { bold: true, color: webhook.active ? "green" : "red", children: webhook.active ? "Yes" : "No" }) }), _jsx(Box, { width: 20, children: _jsx(Text, { color: "gray", children: lastTriggered }) })] }, webhook.id));
|
|
29
|
+
}), _jsx(Text, { color: "gray", children: "─".repeat(103) }), _jsx(Box, { marginTop: 1, children: _jsxs(Text, { color: "gray", children: ["Run", " ", _jsxs(Text, { bold: true, color: "white", children: ["dominion webhooks add ", "<url>"] }), " ", "to add a webhook or", " ", _jsxs(Text, { bold: true, color: "white", children: ["dominion webhooks remove ", "<id>"] }), " ", "to remove one."] }) })] }));
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Format a date as YYYY-MM-DD HH:MM.
|
|
33
|
+
*/
|
|
34
|
+
function formatDate(date) {
|
|
35
|
+
const d = date.toISOString().split("T");
|
|
36
|
+
return `${d[0]} ${d[1].slice(0, 5)}`;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Truncate a string to maxLen, adding ellipsis if needed.
|
|
40
|
+
*/
|
|
41
|
+
function truncate(str, maxLen) {
|
|
42
|
+
if (str.length <= maxLen)
|
|
43
|
+
return str;
|
|
44
|
+
return str.slice(0, maxLen - 1) + "…";
|
|
45
|
+
}
|
|
46
|
+
export default WebhooksList;
|
|
47
|
+
//# sourceMappingURL=list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list.js","sourceRoot":"","sources":["../../../src/commands/webhooks/list.tsx"],"names":[],"mappings":";AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,KAAK,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAClC,OAAO,EAAE,cAAc,EAAgB,MAAM,uBAAuB,CAAC;AAMrE,MAAM,UAAU,YAAY,CAAC,EAAE,cAAc,EAAqB;IAChE,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,EAAE,CAAC;IAC1B,MAAM,OAAO,GAAG,cAAc,IAAI,IAAI,cAAc,EAAE,CAAC;IACvD,MAAM,QAAQ,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC;IAEhC,SAAS,CAAC,GAAG,EAAE;QACb,MAAM,KAAK,GAAG,UAAU,CAAC,GAAG,EAAE,CAAC,IAAI,EAAE,EAAE,GAAG,CAAC,CAAC;QAC5C,OAAO,GAAG,EAAE,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;IACnC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;IAEX,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC1B,OAAO,CACL,MAAC,GAAG,IAAC,aAAa,EAAC,QAAQ,EAAC,GAAG,EAAE,CAAC,aAChC,KAAC,IAAI,IAAC,IAAI,QAAC,KAAK,EAAC,MAAM,yBAEhB,EACP,KAAC,IAAI,IAAC,KAAK,EAAC,QAAQ,wCAA+B,EACnD,MAAC,IAAI,IAAC,KAAK,EAAC,MAAM,mCACG,GAAG,EACtB,MAAC,IAAI,IAAC,IAAI,QAAC,KAAK,EAAC,OAAO,uCACC,OAAO,IACzB,IACF,IACH,CACP,CAAC;IACJ,CAAC;IAED,OAAO,CACL,MAAC,GAAG,I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AG,CAAC,CAAC;IACxC,OAAO,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC;AACvC,CAAC;AAED;;GAEG;AACH,SAAS,QAAQ,CAAC,GAAW,EAAE,MAAc;IAC3C,IAAI,GAAG,CAAC,MAAM,IAAI,MAAM;QAAE,OAAO,GAAG,CAAC;IACrC,OAAO,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC;AACxC,CAAC;AAED,eAAe,YAAY,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* dominion webhooks remove <id> — remove a webhook by ID.
|
|
3
|
+
*
|
|
4
|
+
* Removes a webhook from the local webhook data.
|
|
5
|
+
* Shows confirmation with webhook details before removal.
|
|
6
|
+
*/
|
|
7
|
+
import { WebhookManager } from "../../lib/webhooks.js";
|
|
8
|
+
export interface WebhooksRemoveProps {
|
|
9
|
+
id: string;
|
|
10
|
+
webhookManager?: WebhookManager;
|
|
11
|
+
}
|
|
12
|
+
export declare function WebhooksRemove({ id, webhookManager }: WebhooksRemoveProps): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export default WebhooksRemove;
|
|
14
|
+
//# sourceMappingURL=remove.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remove.d.ts","sourceRoot":"","sources":["../../../src/commands/webhooks/remove.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEvD,MAAM,WAAW,mBAAmB;IAClC,EAAE,EAAE,MAAM,CAAC;IACX,cAAc,CAAC,EAAE,cAAc,CAAC;CACjC;AAID,wBAAgB,cAAc,CAAC,EAAE,EAAE,EAAE,cAAc,EAAE,EAAE,mBAAmB,2CAgHzE;AAED,eAAe,cAAc,CAAC"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* dominion webhooks remove <id> — remove a webhook by ID.
|
|
4
|
+
*
|
|
5
|
+
* Removes a webhook from the local webhook data.
|
|
6
|
+
* Shows confirmation with webhook details before removal.
|
|
7
|
+
*/
|
|
8
|
+
import { Box, Text, useApp } from "ink";
|
|
9
|
+
import { useEffect, useState } from "react";
|
|
10
|
+
import { WebhookManager } from "../../lib/webhooks.js";
|
|
11
|
+
export function WebhooksRemove({ id, webhookManager }) {
|
|
12
|
+
const { exit } = useApp();
|
|
13
|
+
const [state, setState] = useState("removing");
|
|
14
|
+
const [removedUrl, setRemovedUrl] = useState("");
|
|
15
|
+
const [removedEvents, setRemovedEvents] = useState([]);
|
|
16
|
+
const [errorMessage, setErrorMessage] = useState("");
|
|
17
|
+
useEffect(() => {
|
|
18
|
+
const manager = webhookManager ?? new WebhookManager();
|
|
19
|
+
try {
|
|
20
|
+
// Look up webhook details before removing
|
|
21
|
+
const existing = manager.getById(id);
|
|
22
|
+
if (existing) {
|
|
23
|
+
setRemovedUrl(existing.url);
|
|
24
|
+
setRemovedEvents(existing.events);
|
|
25
|
+
}
|
|
26
|
+
const removed = manager.remove(id);
|
|
27
|
+
if (!removed) {
|
|
28
|
+
setState("not-found");
|
|
29
|
+
setTimeout(() => exit(), 200);
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
setState("removed");
|
|
33
|
+
setTimeout(() => exit(), 200);
|
|
34
|
+
}
|
|
35
|
+
catch (err) {
|
|
36
|
+
setErrorMessage(err instanceof Error ? err.message : "An unexpected error occurred.");
|
|
37
|
+
setState("error");
|
|
38
|
+
setTimeout(() => exit(), 200);
|
|
39
|
+
}
|
|
40
|
+
}, [id, webhookManager, exit]);
|
|
41
|
+
// ─── Removing state ─────────────────────────────────────────────────────
|
|
42
|
+
if (state === "removing") {
|
|
43
|
+
return (_jsx(Box, { flexDirection: "column", gap: 1, children: _jsx(Text, { bold: true, color: "cyan", children: "Removing webhook..." }) }));
|
|
44
|
+
}
|
|
45
|
+
// ─── Error state ──────────────────────────────────────────────────────
|
|
46
|
+
if (state === "error") {
|
|
47
|
+
return (_jsxs(Box, { flexDirection: "column", gap: 1, children: [_jsx(Text, { bold: true, color: "red", children: "Failed to remove webhook" }), _jsx(Text, { color: "red", children: errorMessage })] }));
|
|
48
|
+
}
|
|
49
|
+
// ─── Not found state ──────────────────────────────────────────────────
|
|
50
|
+
if (state === "not-found") {
|
|
51
|
+
return (_jsxs(Box, { flexDirection: "column", gap: 1, children: [_jsxs(Text, { bold: true, color: "yellow", children: ["No webhook found with ID \"", id, "\"."] }), _jsxs(Text, { color: "gray", children: ["Run", " ", _jsx(Text, { bold: true, color: "white", children: "dominion webhooks" }), " ", "to see all webhooks."] })] }));
|
|
52
|
+
}
|
|
53
|
+
// ─── Removed state ───────────────────────────────────────────────────
|
|
54
|
+
return (_jsxs(Box, { flexDirection: "column", gap: 1, children: [_jsx(Text, { bold: true, color: "green", children: "Webhook removed" }), _jsxs(Box, { children: [_jsx(Text, { color: "white", children: "ID: " }), _jsx(Text, { color: "gray", children: id })] }), removedUrl && (_jsxs(Box, { children: [_jsx(Text, { color: "white", children: "URL: " }), _jsx(Text, { color: "gray", children: removedUrl })] })), removedEvents.length > 0 && (_jsxs(Box, { children: [_jsx(Text, { color: "white", children: "Events: " }), _jsx(Text, { color: "gray", children: removedEvents.join(", ") })] })), _jsxs(Text, { color: "gray", children: ["Run", " ", _jsx(Text, { bold: true, color: "white", children: "dominion webhooks" }), " ", "to view remaining webhooks."] })] }));
|
|
55
|
+
}
|
|
56
|
+
export default WebhooksRemove;
|
|
57
|
+
//# sourceMappingURL=remove.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remove.js","sourceRoot":"","sources":["../../../src/commands/webhooks/remove.tsx"],"names":[],"mappings":";AAAA;;;;;GA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AAK,EAAC,OAAO,kCAEjB,EAAC,GAAG,4BAEN,IACH,CACP,CAAC;IACJ,CAAC;IAED,wEAAwE;IAExE,OAAO,CACL,MAAC,GAAG,IAAC,aAAa,EAAC,QAAQ,EAAC,GAAG,EAAE,CAAC,aAChC,KAAC,IAAI,IAAC,IAAI,QAAC,KAAK,EAAC,OAAO,gCAEjB,EACP,MAAC,GAAG,eACF,KAAC,IAAI,IAAC,KAAK,EAAC,OAAO,qBAAY,EAC/B,KAAC,IAAI,IAAC,KAAK,EAAC,MAAM,YAAE,EAAE,GAAQ,IAC1B,EACL,UAAU,IAAI,CACb,MAAC,GAAG,eACF,KAAC,IAAI,IAAC,KAAK,EAAC,OAAO,sBAAa,EAChC,KAAC,IAAI,IAAC,KAAK,EAAC,MAAM,YAAE,UAAU,GAAQ,IAClC,CACP,EACA,aAAa,CAAC,MAAM,GAAG,CAAC,IAAI,CAC3B,MAAC,GAAG,eACF,KAAC,IAAI,IAAC,KAAK,EAAC,OAAO,yBAAgB,EACnC,KAAC,IAAI,IAAC,KAAK,EAAC,MAAM,YAAE,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,GAAQ,IAChD,CACP,EACD,MAAC,IAAI,IAAC,KAAK,EAAC,MAAM,oBACZ,GAAG,EACP,KAAC,IAAI,IAAC,IAAI,QAAC,KAAK,EAAC,OAAO,kCAEjB,EAAC,GAAG,mCAEN,IACH,CACP,CAAC;AACJ,CAAC;AAED,eAAe,cAAc,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* dominion whoami — display authenticated user info.
|
|
3
|
+
*
|
|
4
|
+
* Shows username, domain count, and config path when logged in.
|
|
5
|
+
* Shows "Not logged in" with hint when not authenticated.
|
|
6
|
+
*/
|
|
7
|
+
import { ConfigManager } from "../lib/config.js";
|
|
8
|
+
interface WhoamiProps {
|
|
9
|
+
configManager?: ConfigManager;
|
|
10
|
+
}
|
|
11
|
+
export declare function Whoami({ configManager }: WhoamiProps): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export default Whoami;
|
|
13
|
+
//# sourceMappingURL=whoami.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"whoami.d.ts","sourceRoot":"","sources":["../../src/commands/whoami.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAGjD,UAAU,WAAW;IACnB,aAAa,CAAC,EAAE,aAAa,CAAC;CAC/B;AAID,wBAAgB,MAAM,CAAC,EAAE,aAAa,EAAE,EAAE,WAAW,2CA8DpD;AAED,eAAe,MAAM,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* dominion whoami — display authenticated user info.
|
|
4
|
+
*
|
|
5
|
+
* Shows username, domain count, and config path when logged in.
|
|
6
|
+
* Shows "Not logged in" with hint when not authenticated.
|
|
7
|
+
*/
|
|
8
|
+
import { Box, Text, useApp } from "ink";
|
|
9
|
+
import { useEffect, useState } from "react";
|
|
10
|
+
import { ConfigManager } from "../lib/config.js";
|
|
11
|
+
import { getAuthStatusWithDomainCount } from "../lib/auth.js";
|
|
12
|
+
export function Whoami({ configManager }) {
|
|
13
|
+
const { exit } = useApp();
|
|
14
|
+
const [state, setState] = useState("loading");
|
|
15
|
+
const [authStatus, setAuthStatus] = useState(null);
|
|
16
|
+
useEffect(() => {
|
|
17
|
+
const manager = configManager ?? new ConfigManager();
|
|
18
|
+
getAuthStatusWithDomainCount(manager).then((status) => {
|
|
19
|
+
setAuthStatus(status);
|
|
20
|
+
setState("done");
|
|
21
|
+
setTimeout(() => exit(), 100);
|
|
22
|
+
});
|
|
23
|
+
}, [configManager, exit]);
|
|
24
|
+
if (state === "loading" || !authStatus) {
|
|
25
|
+
return (_jsx(Box, { children: _jsx(Text, { color: "yellow", children: "Checking authentication..." }) }));
|
|
26
|
+
}
|
|
27
|
+
if (!authStatus.authenticated) {
|
|
28
|
+
return (_jsxs(Box, { flexDirection: "column", gap: 1, children: [_jsx(Text, { color: "yellow", bold: true, children: "Not logged in" }), _jsxs(Text, { color: "gray", children: ["Run ", _jsx(Text, { bold: true, color: "white", children: "dominion login" }), " to authenticate with your Name.com credentials."] })] }));
|
|
29
|
+
}
|
|
30
|
+
return (_jsxs(Box, { flexDirection: "column", gap: 1, children: [_jsx(Text, { bold: true, color: "cyan", children: "Authenticated User" }), _jsxs(Box, { children: [_jsx(Text, { color: "gray", children: "Username: " }), _jsx(Text, { bold: true, color: "white", children: authStatus.username })] }), authStatus.domainCount !== undefined && (_jsxs(Box, { children: [_jsx(Text, { color: "gray", children: "Domains: " }), _jsxs(Text, { bold: true, color: "white", children: [authStatus.domainCount, " domain", authStatus.domainCount !== 1 ? "s" : ""] })] })), _jsxs(Box, { children: [_jsx(Text, { color: "gray", children: "Config: " }), _jsx(Text, { color: "white", children: authStatus.configPath })] })] }));
|
|
31
|
+
}
|
|
32
|
+
export default Whoami;
|
|
33
|
+
//# sourceMappingURL=whoami.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"whoami.js","sourceRoot":"","sources":["../../src/commands/whoami.tsx"],"names":[],"mappings":";AAAA;;;;;GAKG;AAEH,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,KAAK,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,4BAA4B,EAAmB,MAAM,gBAAgB,CAAC;AAQ/E,MAAM,UAAU,MAAM,CAAC,EAAE,aAAa,EAAe;IACnD,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,EAAE,CAAC;IAC1B,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAc,SA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,KAAK,EAAC,OAAO,YAAE,UAAU,CAAC,QAAQ,GAAQ,IACjD,EAEL,UAAU,CAAC,WAAW,KAAK,SAAS,IAAI,CACvC,MAAC,GAAG,eACF,KAAC,IAAI,IAAC,KAAK,EAAC,MAAM,2BAAkB,EACpC,MAAC,IAAI,IAAC,IAAI,QAAC,KAAK,EAAC,OAAO,aACrB,UAAU,CAAC,WAAW,aAAS,UAAU,CAAC,WAAW,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,IAClE,IACH,CACP,EAED,MAAC,GAAG,eACF,KAAC,IAAI,IAAC,KAAK,EAAC,MAAM,2BAAkB,EACpC,KAAC,IAAI,IAAC,KAAK,EAAC,OAAO,YAAE,UAAU,CAAC,UAAU,GAAQ,IAC9C,IACF,CACP,CAAC;AACJ,CAAC;AAED,eAAe,MAAM,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AccountCard — boxen-style card layout for account detail view.
|
|
3
|
+
*
|
|
4
|
+
* Displays: Name.com username, total domains, config file location,
|
|
5
|
+
* stored contact info (if set), integration status (Vercel y/n).
|
|
6
|
+
*/
|
|
7
|
+
import type { ContactInfo } from "../lib/types.js";
|
|
8
|
+
export interface AccountCardProps {
|
|
9
|
+
username: string;
|
|
10
|
+
domainCount: number;
|
|
11
|
+
configPath: string;
|
|
12
|
+
contactInfo?: ContactInfo;
|
|
13
|
+
vercelConnected: boolean;
|
|
14
|
+
}
|
|
15
|
+
export declare function AccountCard({ username, domainCount, configPath, contactInfo, vercelConnected, }: AccountCardProps): import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
export default AccountCard;
|
|
17
|
+
//# sourceMappingURL=account-card.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"account-card.d.ts","sourceRoot":"","sources":["../../src/components/account-card.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAEnD,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,eAAe,EAAE,OAAO,CAAC;CAC1B;AAgBD,wBAAgB,WAAW,CAAC,EAC1B,QAAQ,EACR,WAAW,EACX,UAAU,EACV,WAAW,EACX,eAAe,GAChB,EAAE,gBAAgB,2CAsFlB;AAED,eAAe,WAAW,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* AccountCard — boxen-style card layout for account detail view.
|
|
4
|
+
*
|
|
5
|
+
* Displays: Name.com username, total domains, config file location,
|
|
6
|
+
* stored contact info (if set), integration status (Vercel y/n).
|
|
7
|
+
*/
|
|
8
|
+
import { Box, Text } from "ink";
|
|
9
|
+
/**
|
|
10
|
+
* A labeled row in the card (key: value layout).
|
|
11
|
+
*/
|
|
12
|
+
function CardRow({ label, children }) {
|
|
13
|
+
return (_jsxs(Box, { children: [_jsx(Box, { width: 22, children: _jsx(Text, { color: "gray", children: label }) }), children] }));
|
|
14
|
+
}
|
|
15
|
+
export function AccountCard({ username, domainCount, configPath, contactInfo, vercelConnected, }) {
|
|
16
|
+
return (_jsxs(Box, { flexDirection: "column", borderStyle: "round", borderColor: "cyan", paddingX: 2, paddingY: 1, children: [_jsx(Box, { marginBottom: 1, children: _jsx(Text, { bold: true, color: "cyan", children: "Account Details" }) }), _jsxs(Box, { flexDirection: "column", children: [_jsx(Text, { bold: true, color: "white", underline: true, children: "Identity" }), _jsxs(Box, { flexDirection: "column", marginTop: 1, children: [_jsx(CardRow, { label: "Username:", children: _jsx(Text, { bold: true, color: "white", children: username }) }), _jsx(CardRow, { label: "Total Domains:", children: _jsxs(Text, { color: "white", children: [domainCount, " domain", domainCount !== 1 ? "s" : ""] }) }), _jsx(CardRow, { label: "Config File:", children: _jsx(Text, { color: "white", children: configPath }) })] })] }), _jsxs(Box, { flexDirection: "column", marginTop: 1, children: [_jsx(Text, { bold: true, color: "white", underline: true, children: "Contact Info" }), _jsx(Box, { flexDirection: "column", marginTop: 1, children: contactInfo ? (_jsxs(_Fragment, { children: [_jsx(CardRow, { label: "Name:", children: _jsxs(Text, { color: "white", children: [contactInfo.firstName, " ", contactInfo.lastName] }) }), _jsx(CardRow, { label: "Email:", children: _jsx(Text, { color: "white", children: contactInfo.email }) }), _jsx(CardRow, { label: "Phone:", children: _jsx(Text, { color: "white", children: contactInfo.phone }) }), _jsx(CardRow, { label: "Address:", children: _jsxs(Text, { color: "white", children: [contactInfo.address1, contactInfo.address2 ? `, ${contactInfo.address2}` : ""] }) }), _jsx(CardRow, { label: "Location:", children: _jsxs(Text, { color: "white", children: [contactInfo.city, ", ", contactInfo.state, " ", contactInfo.zip, ", ", contactInfo.country] }) })] })) : (_jsx(CardRow, { label: "Status:", children: _jsxs(Text, { color: "yellow", children: ["Not set \u2014 run", " ", _jsx(Text, { bold: true, color: "white", children: "dominion account set contact" }), " ", "to configure"] }) })) })] }), _jsxs(Box, { flexDirection: "column", marginTop: 1, children: [_jsx(Text, { bold: true, color: "white", underline: true, children: "Integrations" }), _jsx(Box, { flexDirection: "column", marginTop: 1, children: _jsx(CardRow, { label: "Vercel:", children: _jsx(Text, { color: vercelConnected ? "green" : "gray", children: vercelConnected ? "Connected" : "Not connected" }) }) })] })] }));
|
|
17
|
+
}
|
|
18
|
+
export default AccountCard;
|
|
19
|
+
//# sourceMappingURL=account-card.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"account-card.js","sourceRoot":"","sources":["../../src/components/account-card.tsx"],"names":[],"mappings":";AAAA;;;;;GAKG;AAEH,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AA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CACX,GACG,IACF,EAGN,MAAC,GAAG,IAAC,aAAa,EAAC,QAAQ,EAAC,SAAS,EAAE,CAAC,aACtC,KAAC,IAAI,IAAC,IAAI,QAAC,KAAK,EAAC,OAAO,EAAC,SAAS,mCAAoB,EACtD,KAAC,GAAG,IAAC,aAAa,EAAC,QAAQ,EAAC,SAAS,EAAE,CAAC,YACtC,KAAC,OAAO,IAAC,KAAK,EAAC,SAAS,YACtB,KAAC,IAAI,IAAC,KAAK,EAAE,eAAe,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,YAC5C,eAAe,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,eAAe,GAC3C,GACC,GACN,IACF,IACF,CACP,CAAC;AACJ,CAAC;AAED,eAAe,WAAW,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* BillingTable — formatted table display for domain billing summary.
|
|
3
|
+
*
|
|
4
|
+
* Shows each domain with renewal price, next renewal date, and
|
|
5
|
+
* a summary footer with total domains, annual renewal cost, and
|
|
6
|
+
* the next upcoming renewal date.
|
|
7
|
+
*/
|
|
8
|
+
import type { Domain } from "../lib/types.js";
|
|
9
|
+
export interface BillingTableProps {
|
|
10
|
+
domains: Domain[];
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Calculate total annual renewal cost in cents.
|
|
14
|
+
*/
|
|
15
|
+
export declare function calculateAnnualTotal(domains: Domain[]): number;
|
|
16
|
+
/**
|
|
17
|
+
* Find the domain with the soonest upcoming renewal (non-expired).
|
|
18
|
+
*/
|
|
19
|
+
export declare function getNextUpcomingRenewal(domains: Domain[]): Domain | null;
|
|
20
|
+
export declare function BillingTable({ domains }: BillingTableProps): import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
export default BillingTable;
|
|
22
|
+
//# sourceMappingURL=billing-table.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"billing-table.d.ts","sourceRoot":"","sources":["../../src/components/billing-table.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAI9C,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB;AAkBD;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,MAAM,CAE9D;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,MAAM,GAAG,IAAI,CAOvE;AAED,wBAAgB,YAAY,CAAC,EAAE,OAAO,EAAE,EAAE,iBAAiB,2CA4F1D;AAED,eAAe,YAAY,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* BillingTable — formatted table display for domain billing summary.
|
|
4
|
+
*
|
|
5
|
+
* Shows each domain with renewal price, next renewal date, and
|
|
6
|
+
* a summary footer with total domains, annual renewal cost, and
|
|
7
|
+
* the next upcoming renewal date.
|
|
8
|
+
*/
|
|
9
|
+
import { Box, Text } from "ink";
|
|
10
|
+
import { formatPrice } from "./search-results.js";
|
|
11
|
+
import { formatExpiryDate, getDomainStatus, getStatusColor } from "./domain-table.js";
|
|
12
|
+
/**
|
|
13
|
+
* Get the next renewal date for a domain.
|
|
14
|
+
* For active domains, this is the expiry date.
|
|
15
|
+
* For expired domains, renewal is overdue.
|
|
16
|
+
*/
|
|
17
|
+
function getNextRenewalDate(domain) {
|
|
18
|
+
const status = getDomainStatus(domain.expireDate);
|
|
19
|
+
const statusColor = getStatusColor(status);
|
|
20
|
+
if (status === "expired") {
|
|
21
|
+
return { label: "OVERDUE", color: "red" };
|
|
22
|
+
}
|
|
23
|
+
return { label: formatExpiryDate(domain.expireDate), color: statusColor };
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Calculate total annual renewal cost in cents.
|
|
27
|
+
*/
|
|
28
|
+
export function calculateAnnualTotal(domains) {
|
|
29
|
+
return domains.reduce((sum, d) => sum + (d.renewalPrice ?? 0), 0);
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Find the domain with the soonest upcoming renewal (non-expired).
|
|
33
|
+
*/
|
|
34
|
+
export function getNextUpcomingRenewal(domains) {
|
|
35
|
+
const now = new Date();
|
|
36
|
+
const active = domains
|
|
37
|
+
.filter((d) => new Date(d.expireDate) > now)
|
|
38
|
+
.sort((a, b) => new Date(a.expireDate).getTime() - new Date(b.expireDate).getTime());
|
|
39
|
+
return active.length > 0 ? active[0] : null;
|
|
40
|
+
}
|
|
41
|
+
export function BillingTable({ domains }) {
|
|
42
|
+
if (domains.length === 0) {
|
|
43
|
+
return (_jsxs(Box, { flexDirection: "column", gap: 1, children: [_jsx(Text, { color: "yellow", children: "No domains found." }), _jsxs(Text, { color: "gray", children: ["Search for your first domain with", " ", _jsxs(Text, { bold: true, color: "white", children: ["dominion search ", "<name>"] })] })] }));
|
|
44
|
+
}
|
|
45
|
+
const annualTotal = calculateAnnualTotal(domains);
|
|
46
|
+
const nextRenewal = getNextUpcomingRenewal(domains);
|
|
47
|
+
return (_jsxs(Box, { flexDirection: "column", children: [_jsx(Box, { marginBottom: 1, children: _jsx(Text, { bold: true, color: "cyan", children: "Domain Billing Summary" }) }), _jsxs(Box, { children: [_jsx(Box, { width: 35, children: _jsx(Text, { bold: true, color: "gray", children: "Domain" }) }), _jsx(Box, { width: 14, children: _jsx(Text, { bold: true, color: "gray", children: "Renewal Price" }) }), _jsx(Box, { width: 20, children: _jsx(Text, { bold: true, color: "gray", children: "Next Renewal" }) })] }), _jsx(Text, { color: "gray", children: "─".repeat(69) }), domains.map((domain) => {
|
|
48
|
+
const renewal = getNextRenewalDate(domain);
|
|
49
|
+
return (_jsxs(Box, { children: [_jsx(Box, { width: 35, children: _jsx(Text, { bold: true, color: "white", children: domain.domainName }) }), _jsx(Box, { width: 14, children: _jsx(Text, { color: "white", children: formatPrice(domain.renewalPrice) }) }), _jsx(Box, { width: 20, children: _jsx(Text, { color: renewal.color, children: renewal.label }) })] }, domain.domainName));
|
|
50
|
+
}), _jsx(Text, { color: "gray", children: "─".repeat(69) }), _jsxs(Box, { flexDirection: "column", gap: 1, children: [_jsxs(Box, { children: [_jsx(Box, { width: 22, children: _jsx(Text, { color: "gray", children: "Total Domains:" }) }), _jsx(Text, { bold: true, color: "white", children: domains.length })] }), _jsxs(Box, { children: [_jsx(Box, { width: 22, children: _jsx(Text, { color: "gray", children: "Annual Renewal Cost:" }) }), _jsx(Text, { bold: true, color: "cyan", children: formatPrice(annualTotal) })] }), nextRenewal && (_jsxs(Box, { children: [_jsx(Box, { width: 22, children: _jsx(Text, { color: "gray", children: "Next Renewal:" }) }), _jsxs(Text, { color: "white", children: [nextRenewal.domainName, _jsx(Text, { color: "gray", children: " \u2014 " }), formatExpiryDate(nextRenewal.expireDate)] })] }))] })] }));
|
|
51
|
+
}
|
|
52
|
+
export default BillingTable;
|
|
53
|
+
//# sourceMappingURL=billing-table.js.map
|