apiblaze 0.19.15 → 0.19.16

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
@@ -933,7 +933,7 @@ var import_commander = require("commander");
933
933
  var import_chalk44 = __toESM(require("chalk"));
934
934
 
935
935
  // package.json
936
- var version = "0.19.15";
936
+ var version = "0.19.16";
937
937
 
938
938
  // src/index.ts
939
939
  init_types();
@@ -26,6 +26,10 @@ interface UsersGroupsWidgetProps {
26
26
  theme?: UsersGroupsWidgetTheme;
27
27
  /** Heading text. Default "Users & groups". */
28
28
  title?: string;
29
+ /** Auto-expand the group with this NAME on first load (if it exists) — e.g.
30
+ * a demo landing the user on the group it just talked about. One-shot: the
31
+ * user can still collapse it; later refreshes don't force it back open. */
32
+ defaultOpenGroup?: string;
29
33
  className?: string;
30
34
  }
31
35
  interface UsersGroupsWidgetHandle {
@@ -26,6 +26,10 @@ interface UsersGroupsWidgetProps {
26
26
  theme?: UsersGroupsWidgetTheme;
27
27
  /** Heading text. Default "Users & groups". */
28
28
  title?: string;
29
+ /** Auto-expand the group with this NAME on first load (if it exists) — e.g.
30
+ * a demo landing the user on the group it just talked about. One-shot: the
31
+ * user can still collapse it; later refreshes don't force it back open. */
32
+ defaultOpenGroup?: string;
29
33
  className?: string;
30
34
  }
31
35
  interface UsersGroupsWidgetHandle {
@@ -169,7 +169,7 @@ function Typeahead(props) {
169
169
  ] })
170
170
  ] });
171
171
  }
172
- var UsersGroupsWidget = React.forwardRef(function UsersGroupsWidget2({ endpoint = "/api/apiblaze/groups", theme, title = "Users & groups", className }, ref) {
172
+ var UsersGroupsWidget = React.forwardRef(function UsersGroupsWidget2({ endpoint = "/api/apiblaze/groups", theme, title = "Users & groups", defaultOpenGroup, className }, ref) {
173
173
  const t = { ...DEFAULTS, ...theme ?? {} };
174
174
  const headerBg = t.headerBackground || t.surface;
175
175
  const [access, setAccess] = React.useState("ok");
@@ -298,6 +298,16 @@ var UsersGroupsWidget = React.forwardRef(function UsersGroupsWidget2({ endpoint
298
298
  setOpen(g.id);
299
299
  loadDetail(g.id);
300
300
  }
301
+ const autoOpened = React.useRef(false);
302
+ React.useEffect(() => {
303
+ if (autoOpened.current || !defaultOpenGroup || open) return;
304
+ const g = (groups ?? []).find((x) => x.name === defaultOpenGroup);
305
+ if (g) {
306
+ autoOpened.current = true;
307
+ setOpen(g.id);
308
+ loadDetail(g.id);
309
+ }
310
+ }, [groups, open, defaultOpenGroup, loadDetail]);
301
311
  async function act(label, body, after) {
302
312
  setPending(label);
303
313
  setErr(null);
@@ -134,7 +134,7 @@ function Typeahead(props) {
134
134
  ] })
135
135
  ] });
136
136
  }
137
- var UsersGroupsWidget = React.forwardRef(function UsersGroupsWidget2({ endpoint = "/api/apiblaze/groups", theme, title = "Users & groups", className }, ref) {
137
+ var UsersGroupsWidget = React.forwardRef(function UsersGroupsWidget2({ endpoint = "/api/apiblaze/groups", theme, title = "Users & groups", defaultOpenGroup, className }, ref) {
138
138
  const t = { ...DEFAULTS, ...theme ?? {} };
139
139
  const headerBg = t.headerBackground || t.surface;
140
140
  const [access, setAccess] = React.useState("ok");
@@ -263,6 +263,16 @@ var UsersGroupsWidget = React.forwardRef(function UsersGroupsWidget2({ endpoint
263
263
  setOpen(g.id);
264
264
  loadDetail(g.id);
265
265
  }
266
+ const autoOpened = React.useRef(false);
267
+ React.useEffect(() => {
268
+ if (autoOpened.current || !defaultOpenGroup || open) return;
269
+ const g = (groups ?? []).find((x) => x.name === defaultOpenGroup);
270
+ if (g) {
271
+ autoOpened.current = true;
272
+ setOpen(g.id);
273
+ loadDetail(g.id);
274
+ }
275
+ }, [groups, open, defaultOpenGroup, loadDetail]);
266
276
  async function act(label, body, after) {
267
277
  setPending(label);
268
278
  setErr(null);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "apiblaze",
3
- "version": "0.19.15",
3
+ "version": "0.19.16",
4
4
  "description": "APIblaze CLI — Chat with your APIs, Manage your API keys, users and groups with the APIblaze serverless proxy",
5
5
  "keywords": [
6
6
  "apiblaze",