@fonderie/react-admin-screens 1.3.1 → 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.js CHANGED
@@ -1717,7 +1717,11 @@ function UsersScreen({
1717
1717
  openUserId ? { id: openUserId } : null
1718
1718
  );
1719
1719
  const plans = useSubscriptionIndex(billingClient);
1720
- const list = useAdminUsers(client, { limit: pageSize });
1720
+ const [showDeleted, setShowDeleted] = useState6(false);
1721
+ const list = useAdminUsers(client, {
1722
+ limit: pageSize,
1723
+ ...showDeleted ? { deleted: true } : {}
1724
+ });
1721
1725
  const { user, isLoading, error, suspend, unsuspend, revokeSessions } = useAdminUser(
1722
1726
  client,
1723
1727
  selected ?? {}
@@ -1775,7 +1779,35 @@ function UsersScreen({
1775
1779
  disabled: list.isLoading,
1776
1780
  children: "Refresh"
1777
1781
  }
1778
- )
1782
+ ),
1783
+ !selected ? /* @__PURE__ */ jsx12(
1784
+ "fieldset",
1785
+ {
1786
+ style: {
1787
+ display: "flex",
1788
+ gap: 6,
1789
+ border: "none",
1790
+ margin: "0 0 0 auto",
1791
+ padding: 0,
1792
+ minWidth: 0
1793
+ },
1794
+ "aria-label": "Which accounts",
1795
+ children: [false, true].map((d) => /* @__PURE__ */ jsx12(
1796
+ "button",
1797
+ {
1798
+ type: "button",
1799
+ "aria-pressed": showDeleted === d,
1800
+ onClick: () => setShowDeleted(d),
1801
+ style: {
1802
+ ...showDeleted === d ? styles.buttonPrimary : styles.button,
1803
+ height: 28
1804
+ },
1805
+ children: d ? "Deleted" : "Active"
1806
+ },
1807
+ String(d)
1808
+ ))
1809
+ }
1810
+ ) : null
1779
1811
  ]
1780
1812
  }
1781
1813
  ),
@@ -1889,7 +1921,14 @@ function UsersScreen({
1889
1921
  /* @__PURE__ */ jsx12("td", { style: styles.td, children: new Date(user.createdAt).toLocaleString() })
1890
1922
  ] })
1891
1923
  ] }) }),
1892
- /* @__PURE__ */ jsxs12("div", { style: { ...styles.toolbar, marginTop: 12 }, children: [
1924
+ user.deletedAt ? /* @__PURE__ */ jsxs12("div", { style: { ...styles.notice, marginTop: 12 }, role: "status", children: [
1925
+ /* @__PURE__ */ jsxs12("strong", { children: [
1926
+ "Deleted on ",
1927
+ new Date(user.deletedAt).toLocaleString(),
1928
+ "."
1929
+ ] }),
1930
+ " The account cannot sign in, and it is erased when the retention purge runs. Its billing records stay."
1931
+ ] }) : /* @__PURE__ */ jsxs12("div", { style: { ...styles.toolbar, marginTop: 12 }, children: [
1893
1932
  user.suspended ? /* @__PURE__ */ jsx12(
1894
1933
  "button",
1895
1934
  {
@@ -1930,46 +1969,48 @@ function UsersScreen({
1930
1969
  }
1931
1970
  )
1932
1971
  ] }) : null,
1933
- /* @__PURE__ */ jsx12("h2", { style: styles.subtitle, children: "Live sessions" }),
1934
- sessions.sessions.length === 0 ? /* @__PURE__ */ jsx12("p", { style: styles.muted, children: "None." }) : /* @__PURE__ */ jsx12("ul", { style: styles.list, children: sessions.sessions.map((s) => /* @__PURE__ */ jsxs12("li", { style: styles.row, children: [
1935
- /* @__PURE__ */ jsx12("span", { style: styles.mono, children: s.ipAddress ?? "\u2014" }),
1936
- " ",
1937
- describeLocation(s.location) ? /* @__PURE__ */ jsxs12("span", { style: styles.muted, children: [
1938
- describeLocation(s.location),
1939
- " "
1940
- ] }) : null,
1941
- /* @__PURE__ */ jsx12("span", { style: styles.muted, children: s.userAgent ?? "" }),
1942
- " ",
1943
- /* @__PURE__ */ jsxs12("span", { style: styles.muted, children: [
1944
- "since ",
1945
- new Date(s.createdAt).toLocaleString()
1946
- ] })
1947
- ] }, s.id)) }),
1948
- /* @__PURE__ */ jsx12("h2", { style: styles.subtitle, children: "Recent sign-ins" }),
1949
- history.events.length === 0 && !history.isLoading ? /* @__PURE__ */ jsx12("p", { style: styles.muted, children: "None recorded." }) : /* @__PURE__ */ jsx12("ul", { style: styles.list, children: history.events.map((e) => /* @__PURE__ */ jsxs12("li", { style: styles.row, children: [
1950
- /* @__PURE__ */ jsx12(Pill, { tone: e.outcome === "success" ? "ok" : "bad", children: e.outcome }),
1951
- " ",
1952
- /* @__PURE__ */ jsx12("span", { style: styles.muted, children: e.method }),
1953
- " ",
1954
- /* @__PURE__ */ jsx12("span", { style: styles.mono, children: e.ipAddress ?? "\u2014" }),
1955
- " ",
1956
- describeLocation(e.location) ? /* @__PURE__ */ jsx12("span", { style: styles.muted, children: describeLocation(e.location) }) : null,
1957
- e.location?.proxy || e.location?.hosting ? /* @__PURE__ */ jsxs12(Fragment7, { children: [
1972
+ !user.deletedAt ? /* @__PURE__ */ jsxs12(Fragment7, { children: [
1973
+ /* @__PURE__ */ jsx12("h2", { style: styles.subtitle, children: "Live sessions" }),
1974
+ sessions.sessions.length === 0 ? /* @__PURE__ */ jsx12("p", { style: styles.muted, children: "None." }) : /* @__PURE__ */ jsx12("ul", { style: styles.list, children: sessions.sessions.map((s) => /* @__PURE__ */ jsxs12("li", { style: styles.row, children: [
1975
+ /* @__PURE__ */ jsx12("span", { style: styles.mono, children: s.ipAddress ?? "\u2014" }),
1958
1976
  " ",
1959
- /* @__PURE__ */ jsx12(Pill, { tone: "warn", children: e.location.proxy ? "proxy/VPN" : "hosting" })
1960
- ] }) : null,
1961
- " ",
1962
- /* @__PURE__ */ jsx12("span", { style: styles.muted, children: new Date(e.createdAt).toLocaleString() })
1963
- ] }, e.id)) }),
1964
- history.hasMore && !history.isLoading ? /* @__PURE__ */ jsx12(
1965
- "button",
1966
- {
1967
- type: "button",
1968
- style: { ...styles.button, marginTop: 8 },
1969
- onClick: () => void history.loadMore(),
1970
- children: "Load more"
1971
- }
1972
- ) : null
1977
+ describeLocation(s.location) ? /* @__PURE__ */ jsxs12("span", { style: styles.muted, children: [
1978
+ describeLocation(s.location),
1979
+ " "
1980
+ ] }) : null,
1981
+ /* @__PURE__ */ jsx12("span", { style: styles.muted, children: s.userAgent ?? "" }),
1982
+ " ",
1983
+ /* @__PURE__ */ jsxs12("span", { style: styles.muted, children: [
1984
+ "since ",
1985
+ new Date(s.createdAt).toLocaleString()
1986
+ ] })
1987
+ ] }, s.id)) }),
1988
+ /* @__PURE__ */ jsx12("h2", { style: styles.subtitle, children: "Recent sign-ins" }),
1989
+ history.events.length === 0 && !history.isLoading ? /* @__PURE__ */ jsx12("p", { style: styles.muted, children: "None recorded." }) : /* @__PURE__ */ jsx12("ul", { style: styles.list, children: history.events.map((e) => /* @__PURE__ */ jsxs12("li", { style: styles.row, children: [
1990
+ /* @__PURE__ */ jsx12(Pill, { tone: e.outcome === "success" ? "ok" : "bad", children: e.outcome }),
1991
+ " ",
1992
+ /* @__PURE__ */ jsx12("span", { style: styles.muted, children: e.method }),
1993
+ " ",
1994
+ /* @__PURE__ */ jsx12("span", { style: styles.mono, children: e.ipAddress ?? "\u2014" }),
1995
+ " ",
1996
+ describeLocation(e.location) ? /* @__PURE__ */ jsx12("span", { style: styles.muted, children: describeLocation(e.location) }) : null,
1997
+ e.location?.proxy || e.location?.hosting ? /* @__PURE__ */ jsxs12(Fragment7, { children: [
1998
+ " ",
1999
+ /* @__PURE__ */ jsx12(Pill, { tone: "warn", children: e.location.proxy ? "proxy/VPN" : "hosting" })
2000
+ ] }) : null,
2001
+ " ",
2002
+ /* @__PURE__ */ jsx12("span", { style: styles.muted, children: new Date(e.createdAt).toLocaleString() })
2003
+ ] }, e.id)) }),
2004
+ history.hasMore && !history.isLoading ? /* @__PURE__ */ jsx12(
2005
+ "button",
2006
+ {
2007
+ type: "button",
2008
+ style: { ...styles.button, marginTop: 8 },
2009
+ onClick: () => void history.loadMore(),
2010
+ children: "Load more"
2011
+ }
2012
+ ) : null
2013
+ ] }) : null
1973
2014
  ] }) : null
1974
2015
  ] });
1975
2016
  }