@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.cjs CHANGED
@@ -1920,7 +1920,9 @@ var UsersScreen = (0, import_vue14.defineComponent)({
1920
1920
  const email = (0, import_vue14.ref)("");
1921
1921
  const selectedId = (0, import_vue14.ref)(props.openUserId ?? "");
1922
1922
  const plans = useSubscriptionIndex(props.billingClient);
1923
- const list = (0, import_vue_admin11.useAdminUsers)(props.client, { limit: props.pageSize });
1923
+ const showDeleted = (0, import_vue14.ref)(false);
1924
+ const activeList = (0, import_vue_admin11.useAdminUsers)(props.client, { limit: props.pageSize });
1925
+ const deletedList = (0, import_vue_admin11.useAdminUsers)(props.client, { limit: props.pageSize, deleted: true });
1924
1926
  const { user, isLoading, error, suspend, unsuspend, revokeSessions } = (0, import_vue_admin11.useAdminUser)(
1925
1927
  props.client,
1926
1928
  { email, id: selectedId }
@@ -1948,6 +1950,7 @@ var UsersScreen = (0, import_vue14.defineComponent)({
1948
1950
  };
1949
1951
  return () => {
1950
1952
  const u = user.value;
1953
+ const list = showDeleted.value ? deletedList : activeList;
1951
1954
  return (0, import_vue14.h)("div", { style: styles.container }, [
1952
1955
  pageHeader(
1953
1956
  "Users",
@@ -1977,7 +1980,37 @@ var UsersScreen = (0, import_vue14.defineComponent)({
1977
1980
  { type: "submit", style: styles.buttonPrimary, disabled: isLoading.value },
1978
1981
  [icon("search", 14), "Look up"]
1979
1982
  ),
1980
- showList.value ? refreshButton2("Refresh", list.isLoading.value, () => void list.refresh()) : actionButton([icon("back", 14), "All users"], false, clear, styles.buttonGhost)
1983
+ showList.value ? refreshButton2("Refresh", list.isLoading.value, () => void list.refresh()) : actionButton([icon("back", 14), "All users"], false, clear, styles.buttonGhost),
1984
+ showList.value ? (0, import_vue14.h)(
1985
+ "fieldset",
1986
+ {
1987
+ style: {
1988
+ display: "flex",
1989
+ gap: "6px",
1990
+ border: "none",
1991
+ margin: "0 0 0 auto",
1992
+ padding: "0",
1993
+ minWidth: "0"
1994
+ },
1995
+ "aria-label": "Which accounts"
1996
+ },
1997
+ [false, true].map(
1998
+ (d) => (0, import_vue14.h)(
1999
+ "button",
2000
+ {
2001
+ key: String(d),
2002
+ type: "button",
2003
+ "aria-pressed": showDeleted.value === d,
2004
+ onClick: () => showDeleted.value = d,
2005
+ style: {
2006
+ ...showDeleted.value === d ? styles.buttonPrimary : styles.button,
2007
+ height: "28px"
2008
+ }
2009
+ },
2010
+ d ? "Deleted" : "Active"
2011
+ )
2012
+ )
2013
+ ) : null
1981
2014
  ]
1982
2015
  ),
1983
2016
  showList.value ? (0, import_vue14.h)("div", [
@@ -2057,7 +2090,10 @@ var UsersScreen = (0, import_vue14.defineComponent)({
2057
2090
  row("created", new Date(u.createdAt).toLocaleString())
2058
2091
  ])
2059
2092
  ]),
2060
- (0, import_vue14.h)("div", { style: { ...styles.toolbar, marginTop: "12px" } }, [
2093
+ u.deletedAt ? (0, import_vue14.h)("div", { style: { ...styles.notice, marginTop: "12px" }, role: "status" }, [
2094
+ (0, import_vue14.h)("strong", `Deleted on ${new Date(u.deletedAt).toLocaleString()}.`),
2095
+ " The account cannot sign in, and it is erased when the retention purge runs. Its billing records stay."
2096
+ ]) : (0, import_vue14.h)("div", { style: { ...styles.toolbar, marginTop: "12px" } }, [
2061
2097
  u.suspended ? actionButton("Unsuspend", isLoading.value, () => void unsuspend()) : actionButton(
2062
2098
  "Suspend",
2063
2099
  isLoading.value,
@@ -2077,46 +2113,60 @@ var UsersScreen = (0, import_vue14.defineComponent)({
2077
2113
  subscriberType: "user",
2078
2114
  subscriberId: u.id
2079
2115
  }) : null,
2080
- (0, import_vue14.h)("h2", { style: styles.subtitle }, "Live sessions"),
2081
- sessions.sessions.value.length === 0 ? (0, import_vue14.h)("p", { style: styles.muted }, "None.") : (0, import_vue14.h)(
2082
- "ul",
2083
- { style: styles.list },
2084
- sessions.sessions.value.map(
2085
- (s) => (0, import_vue14.h)("li", { key: s.id, style: styles.row }, [
2086
- (0, import_vue14.h)("span", { style: styles.mono }, s.ipAddress ?? "\u2014"),
2087
- " ",
2088
- (0, import_vue14.h)("span", { style: styles.muted }, (0, import_client.describeLocation)(s.location) ?? ""),
2089
- " ",
2090
- (0, import_vue14.h)("span", { style: styles.muted }, s.userAgent ?? ""),
2091
- " ",
2092
- (0, import_vue14.h)(
2093
- "span",
2094
- { style: styles.muted },
2095
- `since ${new Date(s.createdAt).toLocaleString()}`
2096
- )
2097
- ])
2098
- )
2099
- ),
2100
- (0, import_vue14.h)("h2", { style: styles.subtitle }, "Recent sign-ins"),
2101
- history.events.value.length === 0 && !history.isLoading.value ? (0, import_vue14.h)("p", { style: styles.muted }, "None recorded.") : (0, import_vue14.h)(
2102
- "ul",
2103
- { style: styles.list },
2104
- history.events.value.map(
2105
- (e) => (0, import_vue14.h)("li", { key: e.id, style: styles.row }, [
2106
- pill(e.outcome === "success" ? "ok" : "bad", e.outcome),
2107
- " ",
2108
- (0, import_vue14.h)("span", { style: styles.muted }, e.method),
2109
- " ",
2110
- (0, import_vue14.h)("span", { style: styles.mono }, e.ipAddress ?? "\u2014"),
2111
- " ",
2112
- (0, import_vue14.h)("span", { style: styles.muted }, (0, import_client.describeLocation)(e.location) ?? ""),
2113
- e.location?.proxy || e.location?.hosting ? [" ", pill("warn", e.location.proxy ? "proxy/VPN" : "hosting")] : "",
2114
- " ",
2115
- (0, import_vue14.h)("span", { style: styles.muted }, new Date(e.createdAt).toLocaleString())
2116
- ])
2117
- )
2118
- ),
2119
- history.hasMore.value && !history.isLoading.value ? loadMoreButton(() => void history.loadMore()) : null
2116
+ u.deletedAt ? null : [
2117
+ (0, import_vue14.h)("h2", { style: styles.subtitle }, "Live sessions"),
2118
+ sessions.sessions.value.length === 0 ? (0, import_vue14.h)("p", { style: styles.muted }, "None.") : (0, import_vue14.h)(
2119
+ "ul",
2120
+ { style: styles.list },
2121
+ sessions.sessions.value.map(
2122
+ (s) => (0, import_vue14.h)("li", { key: s.id, style: styles.row }, [
2123
+ (0, import_vue14.h)("span", { style: styles.mono }, s.ipAddress ?? "\u2014"),
2124
+ " ",
2125
+ (0, import_vue14.h)(
2126
+ "span",
2127
+ { style: styles.muted },
2128
+ (0, import_client.describeLocation)(s.location) ?? ""
2129
+ ),
2130
+ " ",
2131
+ (0, import_vue14.h)("span", { style: styles.muted }, s.userAgent ?? ""),
2132
+ " ",
2133
+ (0, import_vue14.h)(
2134
+ "span",
2135
+ { style: styles.muted },
2136
+ `since ${new Date(s.createdAt).toLocaleString()}`
2137
+ )
2138
+ ])
2139
+ )
2140
+ ),
2141
+ (0, import_vue14.h)("h2", { style: styles.subtitle }, "Recent sign-ins"),
2142
+ history.events.value.length === 0 && !history.isLoading.value ? (0, import_vue14.h)("p", { style: styles.muted }, "None recorded.") : (0, import_vue14.h)(
2143
+ "ul",
2144
+ { style: styles.list },
2145
+ history.events.value.map(
2146
+ (e) => (0, import_vue14.h)("li", { key: e.id, style: styles.row }, [
2147
+ pill(e.outcome === "success" ? "ok" : "bad", e.outcome),
2148
+ " ",
2149
+ (0, import_vue14.h)("span", { style: styles.muted }, e.method),
2150
+ " ",
2151
+ (0, import_vue14.h)("span", { style: styles.mono }, e.ipAddress ?? "\u2014"),
2152
+ " ",
2153
+ (0, import_vue14.h)(
2154
+ "span",
2155
+ { style: styles.muted },
2156
+ (0, import_client.describeLocation)(e.location) ?? ""
2157
+ ),
2158
+ e.location?.proxy || e.location?.hosting ? [" ", pill("warn", e.location.proxy ? "proxy/VPN" : "hosting")] : "",
2159
+ " ",
2160
+ (0, import_vue14.h)(
2161
+ "span",
2162
+ { style: styles.muted },
2163
+ new Date(e.createdAt).toLocaleString()
2164
+ )
2165
+ ])
2166
+ )
2167
+ ),
2168
+ history.hasMore.value && !history.isLoading.value ? loadMoreButton(() => void history.loadMore()) : null
2169
+ ]
2120
2170
  ] : null
2121
2171
  ]);
2122
2172
  };