@jwilleke/ngdpbase-types 5.37.0 → 5.38.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.
@@ -15,6 +15,7 @@
15
15
  * only, so the published entry carries no JavaScript.
16
16
  */
17
17
  export type { AddonModule, AddonManifest, AddonListing } from '../../src/managers/AddonsManager.js';
18
+ export type { AddonDashboardCard, AddonCardSurface, AddonCardSummary, AddonCardFigure } from '../../src/managers/AddonsManager.js';
18
19
  export type { AddonHost, AddonIceDeclaration, PersonSwitchSetter } from '../../src/utils/addonHost.js';
19
20
  export type { WikiEngine } from '../../src/types/WikiEngine.js';
20
21
  export type { ApiContext } from '../../src/context/ApiContext.js';
@@ -289,9 +289,27 @@ export interface AddonStatusDetails {
289
289
  message?: string;
290
290
  [key: string]: unknown;
291
291
  }
292
+ /** The pages an add-on's card can be shown on: `/admin` (the default) and the Executive Hub, `/executive` (#2093). */
293
+ export type AddonCardSurface = 'admin' | 'executive';
294
+ /** One labelled figure on an Executive Hub card (`Funds`, `$12,400.00`). The add-on formats the value. */
295
+ export interface AddonCardFigure {
296
+ label: string;
297
+ value: string | number;
298
+ }
299
+ /** What an Executive Hub card shows a viewer: its figures, and an optional line under them. */
300
+ export interface AddonCardSummary {
301
+ figures?: AddonCardFigure[];
302
+ message?: string;
303
+ }
292
304
  /**
293
- * Card registered by an add-on for display on the admin dashboard.
294
- * The card's live stats are sourced from the add-on's existing status() method.
305
+ * Card registered by an add-on for display on the admin dashboard, or, with
306
+ * `surface: 'executive'`, on the Executive Hub (#2093). An add-on registers
307
+ * at most one card per surface.
308
+ *
309
+ * An admin card's live stats come from the add-on's existing status() method.
310
+ * An executive card names the `permission` a viewer must hold to see it, and
311
+ * its figures come from `summary(ctx)`, called with the viewer's context, so
312
+ * the add-on's own doors decide what it reads.
295
313
  */
296
314
  export interface AddonDashboardCard {
297
315
  /** Must match the add-on's registered name */
@@ -300,8 +318,25 @@ export interface AddonDashboardCard {
300
318
  title: string;
301
319
  /** Font Awesome class, e.g. 'fas fa-wpforms' */
302
320
  icon: string;
303
- /** URL of the add-on's admin page */
321
+ /** The page the card links to: the add-on's admin page, or for an executive card the page with the detail */
304
322
  adminUrl: string;
323
+ /** Where the card is shown; omitted means `/admin` */
324
+ surface?: AddonCardSurface;
325
+ /** Executive cards: the permission a viewer must hold to see the card (the add-on's own read permission). Required there */
326
+ permission?: string;
327
+ /** Executive cards: the card's figures for this viewer, read with their context. Throw to say they could not be read */
328
+ summary?: (ctx: ActorContext) => Promise<AddonCardSummary>;
329
+ }
330
+ /** An executive card as the hub shows it to one viewer: the figures read for them, or that they could not be. */
331
+ export interface ExecutiveCardView {
332
+ addonName: string;
333
+ title: string;
334
+ icon: string;
335
+ adminUrl: string;
336
+ figures: AddonCardFigure[];
337
+ message: string;
338
+ /** True when the add-on's summary threw; the card says its figures could not be read. */
339
+ failed: boolean;
305
340
  }
306
341
  /** #2100: the PDP refused an administrator's add-on Update or Check. */
307
342
  export declare class AddonUpdateForbiddenError extends Error {
@@ -823,10 +858,19 @@ declare class AddonsManager extends BaseManager {
823
858
  */
824
859
  registerDashboardCard(card: AddonDashboardCard): void;
825
860
  /**
826
- * Return all registered dashboard cards in registration order.
827
- * Called by the admin dashboard route to populate the addon cards row.
861
+ * Return the registered cards for one surface, in registration order.
862
+ * The admin dashboard route calls it with no argument for the `/admin` cards.
863
+ */
864
+ getDashboardCards(surface?: AddonCardSurface): AddonDashboardCard[];
865
+ /**
866
+ * The Executive Hub's cards for one viewer (#2093): each card whose
867
+ * permission the PDP permits `ctx`, asked with that context, with the
868
+ * figures its add-on's `summary(ctx)` reads for them. A card the viewer may
869
+ * not see is left out; a summary that throws shows the card with its
870
+ * figures marked as not read, and is logged by add-on name only. No
871
+ * context, or no PDP, shows no cards.
828
872
  */
829
- getDashboardCards(): AddonDashboardCard[];
873
+ executiveCardsFor(ctx: ActorContext): Promise<ExecutiveCardView[]>;
830
874
  /**
831
875
  * Get list of all discovered add-on names
832
876
  */
@@ -22,6 +22,8 @@ export type CorePermission =
22
22
  | 'comment-create'
23
23
  /** Change any configuration setting, and download a backup (#1525). Admin only by default; asks for a fresh sign-in when listed in ngdpbase.auth.step-up */
24
24
  | 'config-manage'
25
+ /** Open the Executive Hub (/executive): the organization's summary cards and the requests waiting for the board (#2093). Held by the executive role; deciding a request still needs that request's own permission */
26
+ | 'executive-read'
25
27
  /** Create, edit, delete and link identity records, of users and contacts alike, and organizations, and an identity's affiliations, through IdentityManager and OrganizationManager (#1930). Reading them is identity-read. Was contact-manage until #2038; a policy naming that is still read as this for one release. Admins by default; an add-on grants it to its own roles in its own policy */
26
28
  | 'identity-manage'
27
29
  /** List, search and view identity records, of users and contacts alike, and organizations, and their affiliations, through IdentityManager and OrganizationManager, and the /admin/contacts and /admin/organizations views (#1930). Was contact-read until #2038; a policy naming that is still read as this for one release. Admins and demo admins by default; an add-on grants it to its own roles in its own policy */
@@ -58,6 +58,8 @@ export declare const AUDIT_EVENT: {
58
58
  readonly EMAILCHANGE_CONFIRM: "emailchange-confirm";
59
59
  /** A user asked to change their own email: a confirmation link was sent to the new address (#2073). Names only, never an address */
60
60
  readonly EMAILCHANGE_REQUEST: "emailchange-request";
61
+ /** Executive Hub read; not recorded, read volume */
62
+ readonly EXECUTIVE_READ: "executive-read";
61
63
  /** A page's footnote list changed — action add, import, transfer, update or delete; page content written on someone's behalf (#1233) */
62
64
  readonly FOOTNOTE_EDIT: "footnote-edit";
63
65
  /** Identity record or organization created, changed, deleted or linked to an account (recorded as contact-manage before #2038); metadata names the kind (person or organization), the operation and the fields changed, never their values */
@@ -65,6 +65,8 @@ export const AUDIT_EVENT = {
65
65
  EMAILCHANGE_CONFIRM: 'emailchange-confirm',
66
66
  /** A user asked to change their own email: a confirmation link was sent to the new address (#2073). Names only, never an address */
67
67
  EMAILCHANGE_REQUEST: 'emailchange-request',
68
+ /** Executive Hub read; not recorded, read volume */
69
+ EXECUTIVE_READ: 'executive-read',
68
70
  /** A page's footnote list changed — action add, import, transfer, update or delete; page content written on someone's behalf (#1233) */
69
71
  FOOTNOTE_EDIT: 'footnote-edit',
70
72
  /** Identity record or organization created, changed, deleted or linked to an account (recorded as contact-manage before #2038); metadata names the kind (person or organization), the operation and the fields changed, never their values */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jwilleke/ngdpbase-types",
3
- "version": "5.37.0",
3
+ "version": "5.38.0",
4
4
  "description": "TypeScript types for ngdpbase add-ons, and a test kit of core's own values. A dev dependency, versioned with ngdpbase.",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Jim Willeke",