@fonderie/react-admin-screens 1.3.0 → 1.4.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 +102 -43
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +102 -43
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1752,7 +1752,11 @@ function UsersScreen({
|
|
|
1752
1752
|
openUserId ? { id: openUserId } : null
|
|
1753
1753
|
);
|
|
1754
1754
|
const plans = useSubscriptionIndex(billingClient);
|
|
1755
|
-
const
|
|
1755
|
+
const [showDeleted, setShowDeleted] = (0, import_react6.useState)(false);
|
|
1756
|
+
const list = (0, import_react_admin11.useAdminUsers)(client, {
|
|
1757
|
+
limit: pageSize,
|
|
1758
|
+
...showDeleted ? { deleted: true } : {}
|
|
1759
|
+
});
|
|
1756
1760
|
const { user, isLoading, error, suspend, unsuspend, revokeSessions } = (0, import_react_admin11.useAdminUser)(
|
|
1757
1761
|
client,
|
|
1758
1762
|
selected ?? {}
|
|
@@ -1810,11 +1814,57 @@ function UsersScreen({
|
|
|
1810
1814
|
disabled: list.isLoading,
|
|
1811
1815
|
children: "Refresh"
|
|
1812
1816
|
}
|
|
1813
|
-
)
|
|
1817
|
+
),
|
|
1818
|
+
!selected ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1819
|
+
"fieldset",
|
|
1820
|
+
{
|
|
1821
|
+
style: {
|
|
1822
|
+
display: "flex",
|
|
1823
|
+
gap: 6,
|
|
1824
|
+
border: "none",
|
|
1825
|
+
margin: "0 0 0 auto",
|
|
1826
|
+
padding: 0,
|
|
1827
|
+
minWidth: 0
|
|
1828
|
+
},
|
|
1829
|
+
"aria-label": "Which accounts",
|
|
1830
|
+
children: [false, true].map((d) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1831
|
+
"button",
|
|
1832
|
+
{
|
|
1833
|
+
type: "button",
|
|
1834
|
+
"aria-pressed": showDeleted === d,
|
|
1835
|
+
onClick: () => setShowDeleted(d),
|
|
1836
|
+
style: {
|
|
1837
|
+
...showDeleted === d ? styles.buttonPrimary : styles.button,
|
|
1838
|
+
height: 28
|
|
1839
|
+
},
|
|
1840
|
+
children: d ? "Deleted" : "Active"
|
|
1841
|
+
},
|
|
1842
|
+
String(d)
|
|
1843
|
+
))
|
|
1844
|
+
}
|
|
1845
|
+
) : null
|
|
1814
1846
|
]
|
|
1815
1847
|
}
|
|
1816
1848
|
),
|
|
1817
|
-
error ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { style: styles.error, role: "alert", children: error.status === 404 ? "No user with that email." : error.explanation }) : null,
|
|
1849
|
+
error && !(error.status === 404 && selected?.id) ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { style: styles.error, role: "alert", children: error.status === 404 ? "No user with that email." : error.explanation }) : null,
|
|
1850
|
+
error?.status === 404 && selected?.id ? /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
|
|
1851
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { style: styles.notice, role: "status", children: [
|
|
1852
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("strong", { children: "No account with id " }),
|
|
1853
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("code", { style: styles.code, children: selected.id }),
|
|
1854
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("strong", { children: "." }),
|
|
1855
|
+
" It was deleted, or never existed here. Its billing records remain."
|
|
1856
|
+
] }),
|
|
1857
|
+
billingClient ? /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
|
|
1858
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("h2", { style: styles.subtitle, children: "Plan & credits" }),
|
|
1859
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1860
|
+
SubscriberBilling,
|
|
1861
|
+
{
|
|
1862
|
+
client: billingClient,
|
|
1863
|
+
subscriber: { type: "user", id: selected.id }
|
|
1864
|
+
}
|
|
1865
|
+
)
|
|
1866
|
+
] }) : null
|
|
1867
|
+
] }) : null,
|
|
1818
1868
|
!selected ? /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
|
|
1819
1869
|
list.error ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { style: styles.error, role: "alert", children: list.error.explanation }) : null,
|
|
1820
1870
|
list.users.length === 0 && !list.isLoading ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Empty, { icon: "users", title: "No users yet", children: "Sign-ups appear here as they happen." }) : /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("table", { style: styles.table, children: [
|
|
@@ -1906,7 +1956,14 @@ function UsersScreen({
|
|
|
1906
1956
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("td", { style: styles.td, children: new Date(user.createdAt).toLocaleString() })
|
|
1907
1957
|
] })
|
|
1908
1958
|
] }) }),
|
|
1909
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { style: { ...styles.
|
|
1959
|
+
user.deletedAt ? /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { style: { ...styles.notice, marginTop: 12 }, role: "status", children: [
|
|
1960
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("strong", { children: [
|
|
1961
|
+
"Deleted on ",
|
|
1962
|
+
new Date(user.deletedAt).toLocaleString(),
|
|
1963
|
+
"."
|
|
1964
|
+
] }),
|
|
1965
|
+
" The account cannot sign in, and it is erased when the retention purge runs. Its billing records stay."
|
|
1966
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { style: { ...styles.toolbar, marginTop: 12 }, children: [
|
|
1910
1967
|
user.suspended ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1911
1968
|
"button",
|
|
1912
1969
|
{
|
|
@@ -1947,46 +2004,48 @@ function UsersScreen({
|
|
|
1947
2004
|
}
|
|
1948
2005
|
)
|
|
1949
2006
|
] }) : null,
|
|
1950
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.
|
|
1951
|
-
|
|
1952
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("
|
|
1953
|
-
|
|
1954
|
-
(0, import_client.describeLocation)(s.location) ? /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("span", { style: styles.muted, children: [
|
|
1955
|
-
(0, import_client.describeLocation)(s.location),
|
|
1956
|
-
" "
|
|
1957
|
-
] }) : null,
|
|
1958
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { style: styles.muted, children: s.userAgent ?? "" }),
|
|
1959
|
-
" ",
|
|
1960
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("span", { style: styles.muted, children: [
|
|
1961
|
-
"since ",
|
|
1962
|
-
new Date(s.createdAt).toLocaleString()
|
|
1963
|
-
] })
|
|
1964
|
-
] }, s.id)) }),
|
|
1965
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("h2", { style: styles.subtitle, children: "Recent sign-ins" }),
|
|
1966
|
-
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: [
|
|
1967
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Pill, { tone: e.outcome === "success" ? "ok" : "bad", children: e.outcome }),
|
|
1968
|
-
" ",
|
|
1969
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { style: styles.muted, children: e.method }),
|
|
1970
|
-
" ",
|
|
1971
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { style: styles.mono, children: e.ipAddress ?? "\u2014" }),
|
|
1972
|
-
" ",
|
|
1973
|
-
(0, import_client.describeLocation)(e.location) ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { style: styles.muted, children: (0, import_client.describeLocation)(e.location) }) : null,
|
|
1974
|
-
e.location?.proxy || e.location?.hosting ? /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
|
|
2007
|
+
!user.deletedAt ? /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
|
|
2008
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("h2", { style: styles.subtitle, children: "Live sessions" }),
|
|
2009
|
+
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: [
|
|
2010
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { style: styles.mono, children: s.ipAddress ?? "\u2014" }),
|
|
1975
2011
|
" ",
|
|
1976
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
}
|
|
1989
|
-
|
|
2012
|
+
(0, import_client.describeLocation)(s.location) ? /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("span", { style: styles.muted, children: [
|
|
2013
|
+
(0, import_client.describeLocation)(s.location),
|
|
2014
|
+
" "
|
|
2015
|
+
] }) : null,
|
|
2016
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { style: styles.muted, children: s.userAgent ?? "" }),
|
|
2017
|
+
" ",
|
|
2018
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("span", { style: styles.muted, children: [
|
|
2019
|
+
"since ",
|
|
2020
|
+
new Date(s.createdAt).toLocaleString()
|
|
2021
|
+
] })
|
|
2022
|
+
] }, s.id)) }),
|
|
2023
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("h2", { style: styles.subtitle, children: "Recent sign-ins" }),
|
|
2024
|
+
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: [
|
|
2025
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Pill, { tone: e.outcome === "success" ? "ok" : "bad", children: e.outcome }),
|
|
2026
|
+
" ",
|
|
2027
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { style: styles.muted, children: e.method }),
|
|
2028
|
+
" ",
|
|
2029
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { style: styles.mono, children: e.ipAddress ?? "\u2014" }),
|
|
2030
|
+
" ",
|
|
2031
|
+
(0, import_client.describeLocation)(e.location) ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { style: styles.muted, children: (0, import_client.describeLocation)(e.location) }) : null,
|
|
2032
|
+
e.location?.proxy || e.location?.hosting ? /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
|
|
2033
|
+
" ",
|
|
2034
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Pill, { tone: "warn", children: e.location.proxy ? "proxy/VPN" : "hosting" })
|
|
2035
|
+
] }) : null,
|
|
2036
|
+
" ",
|
|
2037
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { style: styles.muted, children: new Date(e.createdAt).toLocaleString() })
|
|
2038
|
+
] }, e.id)) }),
|
|
2039
|
+
history.hasMore && !history.isLoading ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
2040
|
+
"button",
|
|
2041
|
+
{
|
|
2042
|
+
type: "button",
|
|
2043
|
+
style: { ...styles.button, marginTop: 8 },
|
|
2044
|
+
onClick: () => void history.loadMore(),
|
|
2045
|
+
children: "Load more"
|
|
2046
|
+
}
|
|
2047
|
+
) : null
|
|
2048
|
+
] }) : null
|
|
1990
2049
|
] }) : null
|
|
1991
2050
|
] });
|
|
1992
2051
|
}
|