aa-geuthur-react 1.5.0 → 1.6.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.
@@ -1,9 +1,13 @@
1
1
  import { BasePaths } from './basePaths';
2
- import { MenuSchema, UserData, UserSettings } from './types';
2
+ import { MenuModals, MenuSchema, UserData, UserSettings } from './types';
3
3
  /** Client for the endpoints every app provides (`menu/`, `user/`) and the optional `settings/`. */
4
4
  export declare const baseApiClient: import('openapi-fetch').Client<BasePaths, `${string}/${string}`>;
5
- /** Loads the menu links of the app. */
6
- export declare function loadMenu(projectName: string): Promise<MenuSchema>;
5
+ /**
6
+ * Loads the menu links and, if the app sends them, the menu modals.
7
+ *
8
+ * An app with its own menu modals passes their type: `loadMenu<{ create_session?: AppModal | null }>("beltradar")`.
9
+ */
10
+ export declare function loadMenu<TModals extends object = MenuModals>(projectName: string): Promise<MenuSchema<TModals>>;
7
11
  /**
8
12
  * Loads the current user of the app.
9
13
  *
@@ -9,10 +9,21 @@ export interface MenuLink {
9
9
  /** Whether the badge pulses because of active errors. */
10
10
  has_errors?: boolean;
11
11
  }
12
- /** The menu of the app: links left and right of the navigation bar. */
13
- export interface MenuSchema {
12
+ /**
13
+ * Modals the menu offers, keyed by the app (e.g. `create_example`, `create_session`).
14
+ * Each app has its own keys and may deliver its own modal shape, so this default stays open.
15
+ */
16
+ export type MenuModals = Record<string, ModalSchema | null | undefined>;
17
+ /**
18
+ * The menu of the app: links left and right of the navigation bar and, for apps that send them, its modals.
19
+ *
20
+ * An app with its own `MenuModalSchema` passes it as type: `MenuSchema<{ create_session?: AppModal | null }>`.
21
+ */
22
+ export interface MenuSchema<TModals extends object = MenuModals> {
14
23
  left_links: MenuLink[];
15
24
  right_links: MenuLink[];
25
+ /** Modals of the menu (`MenuModalSchema` of the app); missing or `null` for apps without menu modals. */
26
+ modals?: TModals | null;
16
27
  }
17
28
  /** The current user as delivered by the `user/` endpoint of the app. */
18
29
  export interface UserData {
@@ -1,2 +1,8 @@
1
- /** Loads the left and right menu links. Reloads them every `menuRefetchInterval` ms when the provider sets it. */
2
- export declare function useMenu(): import('@tanstack/react-query').UseQueryResult<import('../..').MenuSchema, Error>;
1
+ import { MenuModals } from '../../Api/types';
2
+ /**
3
+ * Loads the left and right menu links and the menu modals of the app.
4
+ * Reloads them every `menuRefetchInterval` ms when the provider sets it.
5
+ *
6
+ * An app with its own menu modals passes their type: `useMenu<AppMenuModals>()`.
7
+ */
8
+ export declare function useMenu<TModals extends object = MenuModals>(): import('@tanstack/react-query').UseQueryResult<import('../../Api/types').MenuSchema<TModals>, Error>;