@fonderie/react-admin-screens 1.3.1 → 1.5.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/dist/index.cjs +203 -62
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +208 -63
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1589,7 +1589,9 @@ var import_react_admin10 = require("@fonderie/react-admin");
|
|
|
1589
1589
|
var import_react5 = require("react");
|
|
1590
1590
|
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
1591
1591
|
function SubscriberBilling({ client, subscriber }) {
|
|
1592
|
-
const
|
|
1592
|
+
const [currency, setCurrency] = (0, import_react5.useState)("");
|
|
1593
|
+
const [currencyDraft, setCurrencyDraft] = (0, import_react5.useState)("");
|
|
1594
|
+
const { subscription, wallet, ledger, hasMoreLedger, isLoading, error, loadMoreLedger, grant } = (0, import_react_admin10.useAdminSubscriber)(client, subscriber, { limit: 20, ...currency ? { currency } : {} });
|
|
1593
1595
|
const [amount, setAmount] = (0, import_react5.useState)("");
|
|
1594
1596
|
const [note, setNote] = (0, import_react5.useState)("");
|
|
1595
1597
|
const [granted, setGranted] = (0, import_react5.useState)(null);
|
|
@@ -1630,7 +1632,42 @@ function SubscriberBilling({ client, subscriber }) {
|
|
|
1630
1632
|
subscription?.providerSubscriptionId ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { style: { ...styles.statHint, fontFamily: "var(--fonderie-mono,monospace)" }, children: subscription.providerSubscriptionId }) : null
|
|
1631
1633
|
] }),
|
|
1632
1634
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { style: styles.card, children: [
|
|
1633
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.
|
|
1635
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
1636
|
+
"div",
|
|
1637
|
+
{
|
|
1638
|
+
style: {
|
|
1639
|
+
display: "flex",
|
|
1640
|
+
justifyContent: "space-between",
|
|
1641
|
+
alignItems: "center",
|
|
1642
|
+
gap: 8
|
|
1643
|
+
},
|
|
1644
|
+
children: [
|
|
1645
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { style: styles.statLabel, children: "Credits" }),
|
|
1646
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1647
|
+
"form",
|
|
1648
|
+
{
|
|
1649
|
+
style: { display: "flex", gap: 4 },
|
|
1650
|
+
onSubmit: (e) => {
|
|
1651
|
+
e.preventDefault();
|
|
1652
|
+
setCurrency(currencyDraft.trim().toUpperCase());
|
|
1653
|
+
},
|
|
1654
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1655
|
+
"input",
|
|
1656
|
+
{
|
|
1657
|
+
value: currencyDraft,
|
|
1658
|
+
onChange: (e) => setCurrencyDraft(e.target.value),
|
|
1659
|
+
placeholder: wallet?.currency ?? "currency",
|
|
1660
|
+
maxLength: 8,
|
|
1661
|
+
style: { ...styles.input, height: 26, width: 84, fontSize: 12 },
|
|
1662
|
+
"aria-label": "Wallet currency",
|
|
1663
|
+
title: "Show the wallet in another currency"
|
|
1664
|
+
}
|
|
1665
|
+
)
|
|
1666
|
+
}
|
|
1667
|
+
)
|
|
1668
|
+
]
|
|
1669
|
+
}
|
|
1670
|
+
),
|
|
1634
1671
|
wallet ? /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_jsx_runtime11.Fragment, { children: [
|
|
1635
1672
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { style: styles.statValue, children: [
|
|
1636
1673
|
wallet.balance,
|
|
@@ -1752,7 +1789,11 @@ function UsersScreen({
|
|
|
1752
1789
|
openUserId ? { id: openUserId } : null
|
|
1753
1790
|
);
|
|
1754
1791
|
const plans = useSubscriptionIndex(billingClient);
|
|
1755
|
-
const
|
|
1792
|
+
const [showDeleted, setShowDeleted] = (0, import_react6.useState)(false);
|
|
1793
|
+
const list = (0, import_react_admin11.useAdminUsers)(client, {
|
|
1794
|
+
limit: pageSize,
|
|
1795
|
+
...showDeleted ? { deleted: true } : {}
|
|
1796
|
+
});
|
|
1756
1797
|
const { user, isLoading, error, suspend, unsuspend, revokeSessions } = (0, import_react_admin11.useAdminUser)(
|
|
1757
1798
|
client,
|
|
1758
1799
|
selected ?? {}
|
|
@@ -1810,7 +1851,35 @@ function UsersScreen({
|
|
|
1810
1851
|
disabled: list.isLoading,
|
|
1811
1852
|
children: "Refresh"
|
|
1812
1853
|
}
|
|
1813
|
-
)
|
|
1854
|
+
),
|
|
1855
|
+
!selected ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1856
|
+
"fieldset",
|
|
1857
|
+
{
|
|
1858
|
+
style: {
|
|
1859
|
+
display: "flex",
|
|
1860
|
+
gap: 6,
|
|
1861
|
+
border: "none",
|
|
1862
|
+
margin: "0 0 0 auto",
|
|
1863
|
+
padding: 0,
|
|
1864
|
+
minWidth: 0
|
|
1865
|
+
},
|
|
1866
|
+
"aria-label": "Which accounts",
|
|
1867
|
+
children: [false, true].map((d) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1868
|
+
"button",
|
|
1869
|
+
{
|
|
1870
|
+
type: "button",
|
|
1871
|
+
"aria-pressed": showDeleted === d,
|
|
1872
|
+
onClick: () => setShowDeleted(d),
|
|
1873
|
+
style: {
|
|
1874
|
+
...showDeleted === d ? styles.buttonPrimary : styles.button,
|
|
1875
|
+
height: 28
|
|
1876
|
+
},
|
|
1877
|
+
children: d ? "Deleted" : "Active"
|
|
1878
|
+
},
|
|
1879
|
+
String(d)
|
|
1880
|
+
))
|
|
1881
|
+
}
|
|
1882
|
+
) : null
|
|
1814
1883
|
]
|
|
1815
1884
|
}
|
|
1816
1885
|
),
|
|
@@ -1924,7 +1993,14 @@ function UsersScreen({
|
|
|
1924
1993
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("td", { style: styles.td, children: new Date(user.createdAt).toLocaleString() })
|
|
1925
1994
|
] })
|
|
1926
1995
|
] }) }),
|
|
1927
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { style: { ...styles.
|
|
1996
|
+
user.deletedAt ? /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { style: { ...styles.notice, marginTop: 12 }, role: "status", children: [
|
|
1997
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("strong", { children: [
|
|
1998
|
+
"Deleted on ",
|
|
1999
|
+
new Date(user.deletedAt).toLocaleString(),
|
|
2000
|
+
"."
|
|
2001
|
+
] }),
|
|
2002
|
+
" The account cannot sign in, and it is erased when the retention purge runs. Its billing records stay."
|
|
2003
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { style: { ...styles.toolbar, marginTop: 12 }, children: [
|
|
1928
2004
|
user.suspended ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1929
2005
|
"button",
|
|
1930
2006
|
{
|
|
@@ -1965,46 +2041,48 @@ function UsersScreen({
|
|
|
1965
2041
|
}
|
|
1966
2042
|
)
|
|
1967
2043
|
] }) : null,
|
|
1968
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.
|
|
1969
|
-
|
|
1970
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("
|
|
1971
|
-
|
|
1972
|
-
(0, import_client.describeLocation)(s.location) ? /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("span", { style: styles.muted, children: [
|
|
1973
|
-
(0, import_client.describeLocation)(s.location),
|
|
1974
|
-
" "
|
|
1975
|
-
] }) : null,
|
|
1976
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { style: styles.muted, children: s.userAgent ?? "" }),
|
|
1977
|
-
" ",
|
|
1978
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("span", { style: styles.muted, children: [
|
|
1979
|
-
"since ",
|
|
1980
|
-
new Date(s.createdAt).toLocaleString()
|
|
1981
|
-
] })
|
|
1982
|
-
] }, s.id)) }),
|
|
1983
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("h2", { style: styles.subtitle, children: "Recent sign-ins" }),
|
|
1984
|
-
history.events.length === 0 && !history.isLoading ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { style: styles.muted, children: "None recorded." }) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("ul", { style: styles.list, children: history.events.map((e) => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("li", { style: styles.row, children: [
|
|
1985
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Pill, { tone: e.outcome === "success" ? "ok" : "bad", children: e.outcome }),
|
|
1986
|
-
" ",
|
|
1987
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { style: styles.muted, children: e.method }),
|
|
1988
|
-
" ",
|
|
1989
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { style: styles.mono, children: e.ipAddress ?? "\u2014" }),
|
|
1990
|
-
" ",
|
|
1991
|
-
(0, import_client.describeLocation)(e.location) ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { style: styles.muted, children: (0, import_client.describeLocation)(e.location) }) : null,
|
|
1992
|
-
e.location?.proxy || e.location?.hosting ? /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
|
|
2044
|
+
!user.deletedAt ? /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
|
|
2045
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("h2", { style: styles.subtitle, children: "Live sessions" }),
|
|
2046
|
+
sessions.sessions.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { style: styles.muted, children: "None." }) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("ul", { style: styles.list, children: sessions.sessions.map((s) => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("li", { style: styles.row, children: [
|
|
2047
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { style: styles.mono, children: s.ipAddress ?? "\u2014" }),
|
|
1993
2048
|
" ",
|
|
1994
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
}
|
|
2007
|
-
|
|
2049
|
+
(0, import_client.describeLocation)(s.location) ? /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("span", { style: styles.muted, children: [
|
|
2050
|
+
(0, import_client.describeLocation)(s.location),
|
|
2051
|
+
" "
|
|
2052
|
+
] }) : null,
|
|
2053
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { style: styles.muted, children: s.userAgent ?? "" }),
|
|
2054
|
+
" ",
|
|
2055
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("span", { style: styles.muted, children: [
|
|
2056
|
+
"since ",
|
|
2057
|
+
new Date(s.createdAt).toLocaleString()
|
|
2058
|
+
] })
|
|
2059
|
+
] }, s.id)) }),
|
|
2060
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("h2", { style: styles.subtitle, children: "Recent sign-ins" }),
|
|
2061
|
+
history.events.length === 0 && !history.isLoading ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { style: styles.muted, children: "None recorded." }) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("ul", { style: styles.list, children: history.events.map((e) => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("li", { style: styles.row, children: [
|
|
2062
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Pill, { tone: e.outcome === "success" ? "ok" : "bad", children: e.outcome }),
|
|
2063
|
+
" ",
|
|
2064
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { style: styles.muted, children: e.method }),
|
|
2065
|
+
" ",
|
|
2066
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { style: styles.mono, children: e.ipAddress ?? "\u2014" }),
|
|
2067
|
+
" ",
|
|
2068
|
+
(0, import_client.describeLocation)(e.location) ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { style: styles.muted, children: (0, import_client.describeLocation)(e.location) }) : null,
|
|
2069
|
+
e.location?.proxy || e.location?.hosting ? /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
|
|
2070
|
+
" ",
|
|
2071
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Pill, { tone: "warn", children: e.location.proxy ? "proxy/VPN" : "hosting" })
|
|
2072
|
+
] }) : null,
|
|
2073
|
+
" ",
|
|
2074
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { style: styles.muted, children: new Date(e.createdAt).toLocaleString() })
|
|
2075
|
+
] }, e.id)) }),
|
|
2076
|
+
history.hasMore && !history.isLoading ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
2077
|
+
"button",
|
|
2078
|
+
{
|
|
2079
|
+
type: "button",
|
|
2080
|
+
style: { ...styles.button, marginTop: 8 },
|
|
2081
|
+
onClick: () => void history.loadMore(),
|
|
2082
|
+
children: "Load more"
|
|
2083
|
+
}
|
|
2084
|
+
) : null
|
|
2085
|
+
] }) : null
|
|
2008
2086
|
] }) : null
|
|
2009
2087
|
] });
|
|
2010
2088
|
}
|
|
@@ -2277,10 +2355,8 @@ var import_react_admin14 = require("@fonderie/react-admin");
|
|
|
2277
2355
|
var import_react8 = require("react");
|
|
2278
2356
|
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
2279
2357
|
function AuditScreen({ client, pageSize = 50 }) {
|
|
2280
|
-
const [draft, setDraft] = (0, import_react8.useState)({ workspaceId: "", type: "", actorId: "" });
|
|
2281
|
-
const [filter, setFilter] = (0, import_react8.useState)(
|
|
2282
|
-
{}
|
|
2283
|
-
);
|
|
2358
|
+
const [draft, setDraft] = (0, import_react8.useState)({ workspaceId: "", type: "", actorId: "", from: "", to: "" });
|
|
2359
|
+
const [filter, setFilter] = (0, import_react8.useState)({});
|
|
2284
2360
|
const { events, hasMore, isLoading, error, refresh, loadMore } = (0, import_react_admin14.useAdminAudit)(client, {
|
|
2285
2361
|
...filter,
|
|
2286
2362
|
limit: pageSize
|
|
@@ -2312,13 +2388,38 @@ function AuditScreen({ client, pageSize = 50 }) {
|
|
|
2312
2388
|
setFilter({
|
|
2313
2389
|
...draft.workspaceId.trim() ? { workspaceId: draft.workspaceId.trim() } : {},
|
|
2314
2390
|
...draft.type.trim() ? { type: draft.type.trim() } : {},
|
|
2315
|
-
...draft.actorId.trim() ? { actorId: draft.actorId.trim() } : {}
|
|
2391
|
+
...draft.actorId.trim() ? { actorId: draft.actorId.trim() } : {},
|
|
2392
|
+
// Dates are whole days in the operator's time zone: "to" includes that day.
|
|
2393
|
+
...draft.from ? { from: /* @__PURE__ */ new Date(`${draft.from}T00:00:00`) } : {},
|
|
2394
|
+
...draft.to ? { to: /* @__PURE__ */ new Date(`${draft.to}T23:59:59.999`) } : {}
|
|
2316
2395
|
});
|
|
2317
2396
|
},
|
|
2318
2397
|
children: [
|
|
2319
2398
|
field("workspaceId", "workspace id (all if empty)"),
|
|
2320
2399
|
field("type", "event type"),
|
|
2321
2400
|
field("actorId", "actor id"),
|
|
2401
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2402
|
+
"input",
|
|
2403
|
+
{
|
|
2404
|
+
type: "date",
|
|
2405
|
+
value: draft.from,
|
|
2406
|
+
onChange: (e) => setDraft({ ...draft, from: e.target.value }),
|
|
2407
|
+
style: styles.input,
|
|
2408
|
+
"aria-label": "From date",
|
|
2409
|
+
title: "From (inclusive)"
|
|
2410
|
+
}
|
|
2411
|
+
),
|
|
2412
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2413
|
+
"input",
|
|
2414
|
+
{
|
|
2415
|
+
type: "date",
|
|
2416
|
+
value: draft.to,
|
|
2417
|
+
onChange: (e) => setDraft({ ...draft, to: e.target.value }),
|
|
2418
|
+
style: styles.input,
|
|
2419
|
+
"aria-label": "To date",
|
|
2420
|
+
title: "To (inclusive)"
|
|
2421
|
+
}
|
|
2422
|
+
),
|
|
2322
2423
|
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("button", { type: "submit", style: styles.buttonPrimary, disabled: isLoading, children: [
|
|
2323
2424
|
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Icon, { name: "search", size: 14 }),
|
|
2324
2425
|
"Filter"
|
|
@@ -2443,7 +2544,8 @@ function AdminShell({
|
|
|
2443
2544
|
envLabel,
|
|
2444
2545
|
footer,
|
|
2445
2546
|
operators = false,
|
|
2446
|
-
currentOperator
|
|
2547
|
+
currentOperator,
|
|
2548
|
+
publicConfigUrl
|
|
2447
2549
|
}) {
|
|
2448
2550
|
const narrow = useNarrow();
|
|
2449
2551
|
const [drawer, setDrawer] = (0, import_react9.useState)(false);
|
|
@@ -2525,7 +2627,7 @@ function AdminShell({
|
|
|
2525
2627
|
) : /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { style: { ...styles.status, padding: "32px 40px" }, children: "Pass an AuthAdminClient to look up users here." });
|
|
2526
2628
|
break;
|
|
2527
2629
|
case "settings":
|
|
2528
|
-
body = !configClient ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { style: { ...styles.status, padding: "32px 40px" }, children: "Pass a ConfigAdminClient to manage config and secrets here." }) : editing && editing.kind
|
|
2630
|
+
body = !configClient ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { style: { ...styles.status, padding: "32px 40px" }, children: "Pass a ConfigAdminClient to manage config and secrets here." }) : editing && (editing.kind === "config" || editing.kind === "secret") ? /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
|
|
2529
2631
|
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { style: { padding: "24px 40px 0" }, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("button", { type: "button", style: styles.buttonGhost, onClick: () => setEditing(null), children: [
|
|
2530
2632
|
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Icon, { name: "back", size: 14 }),
|
|
2531
2633
|
"Config & secrets"
|
|
@@ -2536,24 +2638,52 @@ function AdminShell({
|
|
|
2536
2638
|
client: configClient,
|
|
2537
2639
|
kind: editing.kind,
|
|
2538
2640
|
configKey: editing.key,
|
|
2539
|
-
...environment !== void 0 ? { environment } : {},
|
|
2540
|
-
|
|
2541
|
-
|
|
2641
|
+
...editing.environment !== void 0 ? { environment: editing.environment } : environment !== void 0 ? { environment } : {},
|
|
2642
|
+
...editing.environments ? { environments: editing.environments } : {},
|
|
2643
|
+
onSaved: () => setEditing(null),
|
|
2644
|
+
onDeleted: () => setEditing(null)
|
|
2645
|
+
},
|
|
2646
|
+
`${editing.kind}:${editing.key}:${editing.environment ?? ""}`
|
|
2542
2647
|
)
|
|
2543
2648
|
] }) : /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2544
2649
|
import_react_config_admin_screens.ConfigListScreen,
|
|
2545
2650
|
{
|
|
2546
2651
|
client: configClient,
|
|
2547
2652
|
...environment !== void 0 ? { environment } : {},
|
|
2548
|
-
|
|
2549
|
-
|
|
2550
|
-
|
|
2551
|
-
|
|
2653
|
+
...publicConfigUrl ? { publicConfigUrl } : {},
|
|
2654
|
+
onSelectConfig: (key, env) => setEditing({ kind: "config", key, environment: env }),
|
|
2655
|
+
onSelectSecret: (key, env) => setEditing({ kind: "secret", key, environment: env }),
|
|
2656
|
+
onCreateConfig: (c) => setEditing({
|
|
2657
|
+
kind: "config",
|
|
2658
|
+
key: "",
|
|
2659
|
+
environments: c.environments,
|
|
2660
|
+
...c.environment ? { environment: c.environment } : {}
|
|
2661
|
+
}),
|
|
2662
|
+
onCreateSecret: (c) => setEditing({
|
|
2663
|
+
kind: "secret",
|
|
2664
|
+
key: "",
|
|
2665
|
+
environments: c.environments,
|
|
2666
|
+
...c.environment ? { environment: c.environment } : {}
|
|
2667
|
+
})
|
|
2552
2668
|
}
|
|
2553
2669
|
);
|
|
2554
2670
|
break;
|
|
2555
2671
|
case "templates":
|
|
2556
|
-
body = !courierClient ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { style: { ...styles.status, padding: "32px 40px" }, children: "Pass a CourierAdminClient to manage templates here." }) : editing?.kind === "template" ? /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
|
|
2672
|
+
body = !courierClient ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { style: { ...styles.status, padding: "32px 40px" }, children: "Pass a CourierAdminClient to manage templates here." }) : editing?.kind === "template-new" ? /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
|
|
2673
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { style: { padding: "24px 40px 0" }, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("button", { type: "button", style: styles.buttonGhost, onClick: () => setEditing(null), children: [
|
|
2674
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Icon, { name: "back", size: 14 }),
|
|
2675
|
+
"Templates"
|
|
2676
|
+
] }) }),
|
|
2677
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2678
|
+
import_react_courier_admin_screens.TemplateCreateScreen,
|
|
2679
|
+
{
|
|
2680
|
+
client: courierClient,
|
|
2681
|
+
...editing.type ? { type: editing.type } : {},
|
|
2682
|
+
...editing.locales ? { locales: editing.locales } : {},
|
|
2683
|
+
onCreated: (c) => setEditing({ kind: "template", type: c.type, locale: c.locale, system: false })
|
|
2684
|
+
}
|
|
2685
|
+
)
|
|
2686
|
+
] }) : editing?.kind === "template" ? /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
|
|
2557
2687
|
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { style: { padding: "24px 40px 0" }, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("button", { type: "button", style: styles.buttonGhost, onClick: () => setEditing(null), children: [
|
|
2558
2688
|
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Icon, { name: "back", size: 14 }),
|
|
2559
2689
|
"Templates"
|
|
@@ -2563,14 +2693,25 @@ function AdminShell({
|
|
|
2563
2693
|
{
|
|
2564
2694
|
client: courierClient,
|
|
2565
2695
|
type: editing.type,
|
|
2566
|
-
|
|
2567
|
-
|
|
2696
|
+
locale: editing.locale,
|
|
2697
|
+
system: editing.system,
|
|
2698
|
+
onSaved: () => setEditing(null),
|
|
2699
|
+
onDeleted: () => setEditing(null),
|
|
2700
|
+
onAddLocale: (type) => setEditing({ kind: "template-new", type })
|
|
2701
|
+
},
|
|
2702
|
+
`${editing.type}:${editing.locale ?? ""}`
|
|
2568
2703
|
)
|
|
2569
2704
|
] }) : /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2570
2705
|
import_react_courier_admin_screens.TemplateListScreen,
|
|
2571
2706
|
{
|
|
2572
2707
|
client: courierClient,
|
|
2573
|
-
onSelectTemplate: (t2) => setEditing({
|
|
2708
|
+
onSelectTemplate: (t2) => setEditing({
|
|
2709
|
+
kind: "template",
|
|
2710
|
+
type: t2.type,
|
|
2711
|
+
locale: t2.locale ?? null,
|
|
2712
|
+
system: t2.system === true
|
|
2713
|
+
}),
|
|
2714
|
+
onCreateTemplate: (c) => setEditing({ kind: "template-new", locales: c.locales })
|
|
2574
2715
|
}
|
|
2575
2716
|
);
|
|
2576
2717
|
break;
|