@fonderie/vue-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
@@ -1885,7 +1885,9 @@ var UsersScreen = defineComponent11({
1885
1885
  const email = ref6("");
1886
1886
  const selectedId = ref6(props.openUserId ?? "");
1887
1887
  const plans = useSubscriptionIndex(props.billingClient);
1888
- const list = useAdminUsers(props.client, { limit: props.pageSize });
1888
+ const showDeleted = ref6(false);
1889
+ const activeList = useAdminUsers(props.client, { limit: props.pageSize });
1890
+ const deletedList = useAdminUsers(props.client, { limit: props.pageSize, deleted: true });
1889
1891
  const { user, isLoading, error, suspend, unsuspend, revokeSessions } = useAdminUser(
1890
1892
  props.client,
1891
1893
  { email, id: selectedId }
@@ -1913,6 +1915,7 @@ var UsersScreen = defineComponent11({
1913
1915
  };
1914
1916
  return () => {
1915
1917
  const u = user.value;
1918
+ const list = showDeleted.value ? deletedList : activeList;
1916
1919
  return h13("div", { style: styles.container }, [
1917
1920
  pageHeader(
1918
1921
  "Users",
@@ -1942,7 +1945,37 @@ var UsersScreen = defineComponent11({
1942
1945
  { type: "submit", style: styles.buttonPrimary, disabled: isLoading.value },
1943
1946
  [icon("search", 14), "Look up"]
1944
1947
  ),
1945
- showList.value ? refreshButton2("Refresh", list.isLoading.value, () => void list.refresh()) : actionButton([icon("back", 14), "All users"], false, clear, styles.buttonGhost)
1948
+ showList.value ? refreshButton2("Refresh", list.isLoading.value, () => void list.refresh()) : actionButton([icon("back", 14), "All users"], false, clear, styles.buttonGhost),
1949
+ showList.value ? h13(
1950
+ "fieldset",
1951
+ {
1952
+ style: {
1953
+ display: "flex",
1954
+ gap: "6px",
1955
+ border: "none",
1956
+ margin: "0 0 0 auto",
1957
+ padding: "0",
1958
+ minWidth: "0"
1959
+ },
1960
+ "aria-label": "Which accounts"
1961
+ },
1962
+ [false, true].map(
1963
+ (d) => h13(
1964
+ "button",
1965
+ {
1966
+ key: String(d),
1967
+ type: "button",
1968
+ "aria-pressed": showDeleted.value === d,
1969
+ onClick: () => showDeleted.value = d,
1970
+ style: {
1971
+ ...showDeleted.value === d ? styles.buttonPrimary : styles.button,
1972
+ height: "28px"
1973
+ }
1974
+ },
1975
+ d ? "Deleted" : "Active"
1976
+ )
1977
+ )
1978
+ ) : null
1946
1979
  ]
1947
1980
  ),
1948
1981
  showList.value ? h13("div", [
@@ -2022,7 +2055,10 @@ var UsersScreen = defineComponent11({
2022
2055
  row("created", new Date(u.createdAt).toLocaleString())
2023
2056
  ])
2024
2057
  ]),
2025
- h13("div", { style: { ...styles.toolbar, marginTop: "12px" } }, [
2058
+ u.deletedAt ? h13("div", { style: { ...styles.notice, marginTop: "12px" }, role: "status" }, [
2059
+ h13("strong", `Deleted on ${new Date(u.deletedAt).toLocaleString()}.`),
2060
+ " The account cannot sign in, and it is erased when the retention purge runs. Its billing records stay."
2061
+ ]) : h13("div", { style: { ...styles.toolbar, marginTop: "12px" } }, [
2026
2062
  u.suspended ? actionButton("Unsuspend", isLoading.value, () => void unsuspend()) : actionButton(
2027
2063
  "Suspend",
2028
2064
  isLoading.value,
@@ -2042,46 +2078,60 @@ var UsersScreen = defineComponent11({
2042
2078
  subscriberType: "user",
2043
2079
  subscriberId: u.id
2044
2080
  }) : null,
2045
- h13("h2", { style: styles.subtitle }, "Live sessions"),
2046
- sessions.sessions.value.length === 0 ? h13("p", { style: styles.muted }, "None.") : h13(
2047
- "ul",
2048
- { style: styles.list },
2049
- sessions.sessions.value.map(
2050
- (s) => h13("li", { key: s.id, style: styles.row }, [
2051
- h13("span", { style: styles.mono }, s.ipAddress ?? "\u2014"),
2052
- " ",
2053
- h13("span", { style: styles.muted }, describeLocation(s.location) ?? ""),
2054
- " ",
2055
- h13("span", { style: styles.muted }, s.userAgent ?? ""),
2056
- " ",
2057
- h13(
2058
- "span",
2059
- { style: styles.muted },
2060
- `since ${new Date(s.createdAt).toLocaleString()}`
2061
- )
2062
- ])
2063
- )
2064
- ),
2065
- h13("h2", { style: styles.subtitle }, "Recent sign-ins"),
2066
- history.events.value.length === 0 && !history.isLoading.value ? h13("p", { style: styles.muted }, "None recorded.") : h13(
2067
- "ul",
2068
- { style: styles.list },
2069
- history.events.value.map(
2070
- (e) => h13("li", { key: e.id, style: styles.row }, [
2071
- pill(e.outcome === "success" ? "ok" : "bad", e.outcome),
2072
- " ",
2073
- h13("span", { style: styles.muted }, e.method),
2074
- " ",
2075
- h13("span", { style: styles.mono }, e.ipAddress ?? "\u2014"),
2076
- " ",
2077
- h13("span", { style: styles.muted }, describeLocation(e.location) ?? ""),
2078
- e.location?.proxy || e.location?.hosting ? [" ", pill("warn", e.location.proxy ? "proxy/VPN" : "hosting")] : "",
2079
- " ",
2080
- h13("span", { style: styles.muted }, new Date(e.createdAt).toLocaleString())
2081
- ])
2082
- )
2083
- ),
2084
- history.hasMore.value && !history.isLoading.value ? loadMoreButton(() => void history.loadMore()) : null
2081
+ u.deletedAt ? null : [
2082
+ h13("h2", { style: styles.subtitle }, "Live sessions"),
2083
+ sessions.sessions.value.length === 0 ? h13("p", { style: styles.muted }, "None.") : h13(
2084
+ "ul",
2085
+ { style: styles.list },
2086
+ sessions.sessions.value.map(
2087
+ (s) => h13("li", { key: s.id, style: styles.row }, [
2088
+ h13("span", { style: styles.mono }, s.ipAddress ?? "\u2014"),
2089
+ " ",
2090
+ h13(
2091
+ "span",
2092
+ { style: styles.muted },
2093
+ describeLocation(s.location) ?? ""
2094
+ ),
2095
+ " ",
2096
+ h13("span", { style: styles.muted }, s.userAgent ?? ""),
2097
+ " ",
2098
+ h13(
2099
+ "span",
2100
+ { style: styles.muted },
2101
+ `since ${new Date(s.createdAt).toLocaleString()}`
2102
+ )
2103
+ ])
2104
+ )
2105
+ ),
2106
+ h13("h2", { style: styles.subtitle }, "Recent sign-ins"),
2107
+ history.events.value.length === 0 && !history.isLoading.value ? h13("p", { style: styles.muted }, "None recorded.") : h13(
2108
+ "ul",
2109
+ { style: styles.list },
2110
+ history.events.value.map(
2111
+ (e) => h13("li", { key: e.id, style: styles.row }, [
2112
+ pill(e.outcome === "success" ? "ok" : "bad", e.outcome),
2113
+ " ",
2114
+ h13("span", { style: styles.muted }, e.method),
2115
+ " ",
2116
+ h13("span", { style: styles.mono }, e.ipAddress ?? "\u2014"),
2117
+ " ",
2118
+ h13(
2119
+ "span",
2120
+ { style: styles.muted },
2121
+ describeLocation(e.location) ?? ""
2122
+ ),
2123
+ e.location?.proxy || e.location?.hosting ? [" ", pill("warn", e.location.proxy ? "proxy/VPN" : "hosting")] : "",
2124
+ " ",
2125
+ h13(
2126
+ "span",
2127
+ { style: styles.muted },
2128
+ new Date(e.createdAt).toLocaleString()
2129
+ )
2130
+ ])
2131
+ )
2132
+ ),
2133
+ history.hasMore.value && !history.isLoading.value ? loadMoreButton(() => void history.loadMore()) : null
2134
+ ]
2085
2135
  ] : null
2086
2136
  ]);
2087
2137
  };