@xh/hoist 72.2.0 → 72.3.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.
Files changed (37) hide show
  1. package/CHANGELOG.md +28 -2
  2. package/admin/tabs/cluster/instances/InstancesTabModel.ts +4 -3
  3. package/admin/tabs/cluster/instances/logs/LogDisplay.ts +12 -14
  4. package/admin/tabs/cluster/instances/logs/LogDisplayModel.ts +0 -2
  5. package/admin/tabs/cluster/instances/logs/LogViewer.ts +6 -5
  6. package/admin/tabs/cluster/instances/logs/LogViewerModel.ts +8 -1
  7. package/admin/tabs/cluster/instances/memory/MemoryMonitorModel.ts +1 -0
  8. package/admin/tabs/cluster/instances/services/DetailsModel.ts +1 -2
  9. package/admin/tabs/cluster/instances/services/DetailsPanel.ts +19 -14
  10. package/admin/tabs/cluster/instances/services/ServiceModel.ts +14 -6
  11. package/admin/tabs/cluster/instances/services/ServicePanel.ts +9 -10
  12. package/admin/tabs/cluster/instances/websocket/WebSocketColumns.ts +9 -0
  13. package/admin/tabs/cluster/instances/websocket/WebSocketModel.ts +2 -1
  14. package/admin/tabs/userData/roles/RoleModel.ts +1 -1
  15. package/appcontainer/AppStateModel.ts +6 -1
  16. package/build/types/admin/tabs/activity/tracking/ActivityTrackingModel.d.ts +4 -1
  17. package/build/types/admin/tabs/cluster/instances/services/DetailsModel.d.ts +2 -3
  18. package/build/types/admin/tabs/cluster/instances/websocket/WebSocketColumns.d.ts +1 -0
  19. package/build/types/appcontainer/AppStateModel.d.ts +5 -1
  20. package/build/types/desktop/cmp/tab/TabSwitcher.d.ts +1 -1
  21. package/build/types/security/BaseOAuthClient.d.ts +6 -7
  22. package/build/types/security/Types.d.ts +32 -5
  23. package/build/types/security/msal/MsalClient.d.ts +12 -1
  24. package/build/types/svc/TrackService.d.ts +31 -1
  25. package/build/types/utils/js/BrowserUtils.d.ts +38 -1
  26. package/data/Store.ts +3 -0
  27. package/desktop/cmp/grid/editors/BooleanEditor.ts +15 -3
  28. package/desktop/cmp/tab/TabSwitcher.ts +1 -1
  29. package/package.json +2 -2
  30. package/security/BaseOAuthClient.ts +12 -10
  31. package/security/Types.ts +35 -6
  32. package/security/msal/MsalClient.ts +125 -20
  33. package/svc/FetchService.ts +3 -2
  34. package/svc/TrackService.ts +94 -8
  35. package/svc/WebSocketService.ts +1 -2
  36. package/tsconfig.tsbuildinfo +1 -1
  37. package/utils/js/BrowserUtils.ts +72 -21
package/CHANGELOG.md CHANGED
@@ -1,8 +1,34 @@
1
1
  # Changelog
2
2
 
3
+ ## v72.3.0 - 2025-04-08
4
+
5
+ ### 🎁 New Features
6
+
7
+ * Added support for posting a "Client Health Report" track message on a configurable interval. This
8
+ message will include basic client information, and can be extended to include any other desired
9
+ data via `XH.trackService.addClientHealthReportSource()`. Enable by updating your app's
10
+ `xhActivityTrackingConfig` to include `clientHealthReport: {intervalMins: XXXX}`.
11
+ * Enabled opt-in support for telemetry in `MsalClient`, leveraging hooks built-in to MSAL to collect
12
+ timing and success/failure count for all events emitted by the library.
13
+ * Added the reported client app version as a column in the Admin Console WebSockets tab.
14
+
15
+ ### 🐞 Bug Fixes
16
+
17
+ * Improved fetch request tracking to include time spent loading headers as specified by application.
18
+
19
+ ### ⚙️ Technical
20
+
21
+ * Update shape of returned `BrowserUtils.getClientDeviceInfo()` to nest several properties under new
22
+ top-level `window` key and report JS heap size / usage values under the `memory` block in MB.
23
+
24
+ ### 📚 Libraries
25
+
26
+ * @azure/msal-browser `3.28 → 4.8.0`
27
+
3
28
  ## v72.2.0 - 2025-03-13
4
29
 
5
30
  ### 🎁 New Features
31
+
6
32
  * Modified `TabContainerModel` to make more methods `protected`, improving extensibility for
7
33
  advanced use-cases.
8
34
  * Enhanced `XH.reloadApp` with new argument to clear query parameters before loading.
@@ -15,8 +41,8 @@
15
41
 
16
42
  ### 🐞 Bug Fixes
17
43
 
18
- * Prevent native browser context menu on Dash Canvas surfaces. It can hide the Dash Canvas custom
19
- context menu when an app's `showBrowserContextMenu` flag is `true`.
44
+ * Prevented native browser context menu from showing on `DashCanvas` surfaces and obscuring the
45
+ `DashCanvas` custom context menu.
20
46
 
21
47
  ## v72.1.0 - 2025-02-13
22
48
 
@@ -149,7 +149,7 @@ export class InstancesTabModel extends HoistModel {
149
149
  },
150
150
  {
151
151
  ...usedHeapMb,
152
- headerName: 'Heap (MB)'
152
+ headerName: 'Heap (mb)'
153
153
  },
154
154
  {
155
155
  ...usedPctMax,
@@ -214,11 +214,12 @@ export class InstancesTabModel extends HoistModel {
214
214
  private async shutdownInstanceAsync(instance: PlainObject) {
215
215
  if (
216
216
  !(await XH.confirm({
217
- message: `Are you SURE you want to shutdown instance ${instance.name}?`,
217
+ message: `Are you sure you wish to immediately terminate instance ${instance.name}?`,
218
218
  confirmProps: {
219
219
  icon: Icon.skull(),
220
- text: 'Shutdown Now',
220
+ text: 'Yes, kill the instance',
221
221
  intent: 'danger',
222
+ outlined: true,
222
223
  autoFocus: false
223
224
  }
224
225
  }))
@@ -6,12 +6,12 @@
6
6
  */
7
7
  import {clock} from '@xh/hoist/cmp/clock';
8
8
  import {grid} from '@xh/hoist/cmp/grid';
9
- import {code, filler, fragment, hspacer, label, placeholder} from '@xh/hoist/cmp/layout';
9
+ import {filler, fragment, hspacer, label, placeholder} from '@xh/hoist/cmp/layout';
10
+ import {loadingIndicator} from '@xh/hoist/cmp/loadingindicator';
10
11
  import {hoistCmp, uses, XH} from '@xh/hoist/core';
11
12
  import {button, modalToggleButton} from '@xh/hoist/desktop/cmp/button';
12
13
  import {gridFindField} from '@xh/hoist/desktop/cmp/grid';
13
14
  import {numberInput, switchInput, textInput} from '@xh/hoist/desktop/cmp/input';
14
- import {loadingIndicator} from '@xh/hoist/cmp/loadingindicator';
15
15
  import {panel} from '@xh/hoist/desktop/cmp/panel';
16
16
  import {toolbar, toolbarSep} from '@xh/hoist/desktop/cmp/toolbar';
17
17
  import {Icon} from '@xh/hoist/icon';
@@ -48,7 +48,7 @@ const tbar = hoistCmp.factory<LogDisplayModel>(({model}) => {
48
48
  numberInput({
49
49
  bind: 'startLine',
50
50
  min: 1,
51
- width: 80,
51
+ width: 70,
52
52
  disabled: model.tail,
53
53
  displayWithCommas: true
54
54
  }),
@@ -57,13 +57,13 @@ const tbar = hoistCmp.factory<LogDisplayModel>(({model}) => {
57
57
  numberInput({
58
58
  bind: 'maxLines',
59
59
  min: 1,
60
- width: 80,
60
+ width: 70,
61
61
  displayWithCommas: true
62
62
  }),
63
63
  '-',
64
64
  textInput({
65
65
  bind: 'pattern',
66
- placeholder: 'Filter',
66
+ placeholder: 'Filter lines...',
67
67
  leftIcon: Icon.filter(),
68
68
  flex: 1,
69
69
  rightElement: fragment(
@@ -85,7 +85,7 @@ const tbar = hoistCmp.factory<LogDisplayModel>(({model}) => {
85
85
  })
86
86
  )
87
87
  }),
88
- gridFindField({flex: 1}),
88
+ gridFindField({flex: 1, placeholder: 'Find lines...'}),
89
89
  '-',
90
90
  switchInput({
91
91
  bind: 'tail',
@@ -123,16 +123,14 @@ const bbar = hoistCmp.factory<LogDisplayModel>({
123
123
  }),
124
124
  filler(),
125
125
  Icon.clock(),
126
- code(
127
- clock({
128
- timezone: zone,
129
- format: 'HH:mm',
130
- suffix: fmtTimeZone(zone, offset)
131
- })
132
- ),
126
+ clock({
127
+ timezone: zone,
128
+ format: 'HH:mm',
129
+ suffix: fmtTimeZone(zone, offset)
130
+ }),
133
131
  fragment({
134
132
  omit: !logRootPath,
135
- items: [toolbarSep(), Icon.folder(), code(logRootPath)]
133
+ items: [toolbarSep(), Icon.folder({className: 'xh-margin-right'}), logRootPath]
136
134
  })
137
135
  );
138
136
  }
@@ -117,8 +117,6 @@ export class LogDisplayModel extends HoistModel {
117
117
  },
118
118
  loadSpec
119
119
  });
120
- // Backward compatibility for Hoist Core < v22, which returned exception in-band
121
- if (!response.success) throw XH.exception(response.exception);
122
120
  this.updateGridData(response.content);
123
121
  }
124
122
 
@@ -5,8 +5,8 @@
5
5
  * Copyright © 2025 Extremely Heavy Industries Inc.
6
6
  */
7
7
  import {logLevelDialog} from '@xh/hoist/admin/tabs/cluster/instances/logs/levels/LogLevelDialog';
8
- import {grid} from '@xh/hoist/cmp/grid';
9
- import {hframe} from '@xh/hoist/cmp/layout';
8
+ import {grid, gridCountLabel} from '@xh/hoist/cmp/grid';
9
+ import {filler, hframe} from '@xh/hoist/cmp/layout';
10
10
  import {storeFilterField} from '@xh/hoist/cmp/store';
11
11
  import {creates, hoistCmp} from '@xh/hoist/core';
12
12
  import {errorMessage} from '@xh/hoist/cmp/error';
@@ -37,9 +37,8 @@ export const logViewer = hoistCmp.factory({
37
37
  side: 'left',
38
38
  defaultSize: 380
39
39
  },
40
- item: grid(),
41
- bbar: [
42
- storeFilterField({flex: 1}),
40
+ tbar: [
41
+ storeFilterField({flex: 1, placeholder: 'Filter files...'}),
43
42
  select({
44
43
  leftIcon: Icon.server(),
45
44
  bind: 'instanceOnly',
@@ -53,6 +52,8 @@ export const logViewer = hoistCmp.factory({
53
52
  ]
54
53
  })
55
54
  ],
55
+ item: grid(),
56
+ bbar: [filler(), gridCountLabel({unit: 'log file'})],
56
57
  mask: 'onLoad'
57
58
  }),
58
59
  logDisplay(),
@@ -13,6 +13,7 @@ import {RecordActionSpec} from '@xh/hoist/data';
13
13
  import {compactDateRenderer, fmtNumber} from '@xh/hoist/format';
14
14
  import {Icon} from '@xh/hoist/icon';
15
15
  import {bindable, makeObservable, observable} from '@xh/hoist/mobx';
16
+ import {pluralize} from '@xh/hoist/utils/js';
16
17
  import download from 'downloadjs';
17
18
  import {LogDisplayModel} from './LogDisplayModel';
18
19
 
@@ -119,7 +120,13 @@ export class LogViewerModel extends BaseInstanceModel {
119
120
  if (!count) return;
120
121
 
121
122
  const confirmed = await XH.confirm({
122
- message: `Delete ${count} log files on the server? This cannot be undone.`
123
+ message: `Are you sure you want to delete ${pluralize('log file', count, true)}? This cannot be undone.`,
124
+ confirmProps: {
125
+ text: `Yes, delete the ${pluralize('file', count)}`,
126
+ intent: 'danger',
127
+ outlined: true,
128
+ autoFocus: false
129
+ }
123
130
  });
124
131
  if (!confirmed) return;
125
132
 
@@ -131,6 +131,7 @@ export class MemoryMonitorModel extends BaseInstanceModel {
131
131
  },
132
132
  {
133
133
  groupId: 'GC',
134
+ headerName: 'Garbage Collection',
134
135
  headerAlign: 'center',
135
136
  children: [collectionCount, avgCollectionTime, pctCollectionTime]
136
137
  }
@@ -5,7 +5,6 @@
5
5
  * Copyright © 2025 Extremely Heavy Industries Inc.
6
6
  */
7
7
  import {HoistModel, LoadSpec, lookup, PlainObject, XH} from '@xh/hoist/core';
8
- import {StoreRecord} from '@xh/hoist/data';
9
8
  import {bindable} from '@xh/hoist/mobx';
10
9
  import {ServiceModel} from './ServiceModel';
11
10
 
@@ -14,7 +13,7 @@ export class DetailsModel extends HoistModel {
14
13
  parent: ServiceModel;
15
14
 
16
15
  @bindable.ref
17
- svcName: StoreRecord;
16
+ svcName: String;
18
17
 
19
18
  @bindable.ref
20
19
  stats: PlainObject;
@@ -11,6 +11,7 @@ import {errorMessage} from '@xh/hoist/cmp/error';
11
11
  import {panel} from '@xh/hoist/desktop/cmp/panel';
12
12
  import {jsonInput} from '@xh/hoist/desktop/cmp/input';
13
13
  import {Icon} from '@xh/hoist/icon';
14
+ import {isEmpty} from 'lodash';
14
15
 
15
16
  export const detailsPanel = hoistCmp.factory({
16
17
  model: creates(DetailsModel),
@@ -18,7 +19,7 @@ export const detailsPanel = hoistCmp.factory({
18
19
  render({model}) {
19
20
  const {svcName} = model;
20
21
  return panel({
21
- title: svcName ? `Stats: ${svcName}` : 'Stats',
22
+ title: svcName ?? 'Stats',
22
23
  mask: 'onLoad',
23
24
  icon: Icon.info(),
24
25
  compactHeader: true,
@@ -42,18 +43,22 @@ const stats = hoistCmp.factory<DetailsModel>({
42
43
  });
43
44
  }
44
45
 
45
- if (stats == null) return null;
46
-
47
- return panel(
48
- jsonInput({
49
- readonly: true,
50
- width: '100%',
51
- height: '100%',
52
- enableSearch: true,
53
- showFullscreenButton: false,
54
- editorProps: {lineNumbers: false},
55
- value: model.parent.fmtStats(stats)
56
- })
57
- );
46
+ return isEmpty(stats)
47
+ ? placeholder(
48
+ ...(loadModel.isPending
49
+ ? []
50
+ : [Icon.questionCircle(), 'This service does not report any admin stats.'])
51
+ )
52
+ : panel(
53
+ jsonInput({
54
+ readonly: true,
55
+ width: '100%',
56
+ height: '100%',
57
+ enableSearch: true,
58
+ showFullscreenButton: false,
59
+ editorProps: {lineNumbers: false},
60
+ value: model.parent.fmtStats(stats)
61
+ })
62
+ );
58
63
  }
59
64
  });
@@ -10,7 +10,7 @@ import {timestampNoYear} from '@xh/hoist/admin/columns';
10
10
  import {BaseInstanceModel} from '@xh/hoist/admin/tabs/cluster/instances/BaseInstanceModel';
11
11
  import {GridModel} from '@xh/hoist/cmp/grid';
12
12
  import {br, fragment} from '@xh/hoist/cmp/layout';
13
- import {LoadSpec, managed, XH} from '@xh/hoist/core';
13
+ import {LoadSpec, managed, PlainObject, XH} from '@xh/hoist/core';
14
14
  import {FilterLike, FilterTestFn, RecordActionSpec} from '@xh/hoist/data';
15
15
  import {Icon} from '@xh/hoist/icon';
16
16
  import {bindable, makeObservable} from '@xh/hoist/mobx';
@@ -52,15 +52,16 @@ export class ServiceModel extends BaseInstanceModel {
52
52
  selModel: 'multiple',
53
53
  enableExport: true,
54
54
  exportOptions: {filename: exportFilenameWithDate('services')},
55
+ groupBy: 'provider',
55
56
  store: {
56
57
  idSpec: 'name',
57
58
  processRawData: this.processRawData,
58
59
  fields: [
59
60
  {name: 'provider', type: 'string'},
60
61
  {name: 'name', type: 'string'},
61
- {name: 'displayName', type: 'string'},
62
+ {name: 'displayName', type: 'string', displayName: 'Service'},
62
63
  {name: 'initializedDate', type: 'date', displayName: 'Initialized'},
63
- {name: 'lastCachesCleared', type: 'date', displayName: 'Last Cleared'}
64
+ {name: 'lastCachesCleared', type: 'date', displayName: 'Caches Last Cleared'}
64
65
  ]
65
66
  },
66
67
  sortBy: ['provider', 'displayName'],
@@ -81,6 +82,7 @@ export class ServiceModel extends BaseInstanceModel {
81
82
  constructor() {
82
83
  super();
83
84
  makeObservable(this);
85
+
84
86
  this.addReaction({
85
87
  track: () => [this.textFilter, this.typeFilter],
86
88
  run: this.applyFilters,
@@ -91,6 +93,7 @@ export class ServiceModel extends BaseInstanceModel {
91
93
  async clearCachesAsync(entireCluster: boolean) {
92
94
  const {gridModel, instanceName, loadModel} = this,
93
95
  {selectedRecords} = gridModel;
96
+
94
97
  if (isEmpty(selectedRecords)) return;
95
98
 
96
99
  const cacheStr =
@@ -131,19 +134,24 @@ export class ServiceModel extends BaseInstanceModel {
131
134
  }
132
135
 
133
136
  override async doLoadAsync(loadSpec: LoadSpec) {
137
+ const {gridModel, instanceName: instance} = this;
134
138
  try {
135
139
  const data = await XH.fetchJson({
136
140
  url: 'serviceManagerAdmin/listServices',
137
- params: {instance: this.instanceName},
141
+ params: {instance},
138
142
  loadSpec
139
143
  });
140
- return this.gridModel.loadData(data);
144
+
145
+ if (!loadSpec.isStale) {
146
+ gridModel.loadData(data);
147
+ gridModel.preSelectFirstAsync();
148
+ }
141
149
  } catch (e) {
142
150
  this.handleLoadException(e, loadSpec);
143
151
  }
144
152
  }
145
153
 
146
- private processRawData(r) {
154
+ private processRawData(r: PlainObject) {
147
155
  const provider = r.name && r.name.startsWith('hoistCore') ? 'Hoist' : 'App';
148
156
  const displayName = lowerFirst(r.name.replace('hoistCore', ''));
149
157
  return {provider, displayName, ...r};
@@ -9,11 +9,11 @@ import {grid, gridCountLabel} from '@xh/hoist/cmp/grid';
9
9
  import {filler, hframe} from '@xh/hoist/cmp/layout';
10
10
  import {storeFilterField} from '@xh/hoist/cmp/store';
11
11
  import {creates, hoistCmp, uses} from '@xh/hoist/core';
12
- import {exportButton} from '@xh/hoist/desktop/cmp/button';
12
+ import {button, exportButton} from '@xh/hoist/desktop/cmp/button';
13
+ import {buttonGroupInput} from '@xh/hoist/desktop/cmp/input';
13
14
  import {panel} from '@xh/hoist/desktop/cmp/panel';
14
15
  import {recordActionBar} from '@xh/hoist/desktop/cmp/record';
15
16
  import {toolbar} from '@xh/hoist/desktop/cmp/toolbar';
16
- import {select} from '@xh/hoist/desktop/cmp/input';
17
17
  import {ServiceModel} from './ServiceModel';
18
18
 
19
19
  export const servicePanel = hoistCmp.factory({
@@ -52,15 +52,14 @@ const bbar = hoistCmp.factory({
52
52
  filler(),
53
53
  gridCountLabel({unit: 'service'}),
54
54
  '-',
55
- select({
56
- options: [
57
- {value: 'all', label: 'All'},
58
- {value: 'app', label: 'App Only'},
59
- {value: 'hoist', label: 'Hoist Only'}
60
- ],
61
- width: 125,
55
+ buttonGroupInput({
62
56
  bind: 'typeFilter',
63
- hideDropdownIndicator: true
57
+ outlined: true,
58
+ items: [
59
+ button({value: 'all', text: 'All'}),
60
+ button({value: 'app', text: 'App'}),
61
+ button({value: 'hoist', text: 'Hoist'})
62
+ ]
64
63
  }),
65
64
  storeFilterField({
66
65
  matchMode: 'any',
@@ -72,3 +72,12 @@ export const lastReceivedTime: ColumnSpec = {
72
72
  ...Col.compactDate,
73
73
  width: 140
74
74
  };
75
+
76
+ export const clientAppVersion: ColumnSpec = {
77
+ field: {
78
+ name: 'clientAppVersion',
79
+ type: 'string',
80
+ displayName: 'Client Version'
81
+ },
82
+ width: 120
83
+ };
@@ -77,7 +77,8 @@ export class WebSocketModel extends BaseInstanceModel {
77
77
  WSCol.sentMessageCount,
78
78
  WSCol.lastSentTime,
79
79
  WSCol.receivedMessageCount,
80
- WSCol.lastReceivedTime
80
+ WSCol.lastReceivedTime,
81
+ WSCol.clientAppVersion
81
82
  ]
82
83
  });
83
84
 
@@ -275,7 +275,7 @@ export class RoleModel extends HoistModel {
275
275
  return new GridModel({
276
276
  treeMode: true,
277
277
  treeStyle: TreeStyle.HIGHLIGHTS_AND_BORDERS,
278
- autosizeOptions: {mode: 'managed'},
278
+ autosizeOptions: {mode: 'managed', includeCollapsedChildren: true},
279
279
  selModel: 'multiple',
280
280
  emptyText: 'No roles found.',
281
281
  colChooserModel: true,
@@ -24,8 +24,13 @@ export class AppStateModel extends HoistModel {
24
24
  suspendData: AppSuspendData;
25
25
  accessDeniedMessage: string = 'Access Denied';
26
26
 
27
+ /**
28
+ * Timestamp when the app first started loading, prior to even JS download/eval.
29
+ * Read from timestamp set on window within index.html.
30
+ */
31
+ readonly loadStarted: number = window['_xhLoadTimestamp'];
32
+
27
33
  private timings: Record<AppState, number> = {} as Record<AppState, number>;
28
- private loadStarted: number = window['_xhLoadTimestamp']; // set in index.html
29
34
  private lastStateChangeTime: number = this.loadStarted;
30
35
 
31
36
  constructor() {
@@ -26,7 +26,10 @@ export declare class ActivityTrackingModel extends HoistModel {
26
26
  */
27
27
  get queryDisplayString(): string;
28
28
  get endDay(): LocalDate;
29
- get maxRowOptions(): any;
29
+ get maxRowOptions(): {
30
+ value: number;
31
+ label: string;
32
+ }[];
30
33
  get maxRows(): number;
31
34
  /** True if data loaded from the server has been topped by maxRows. */
32
35
  get maxRowsReached(): boolean;
@@ -1,11 +1,10 @@
1
1
  import { HoistModel, LoadSpec, PlainObject } from '@xh/hoist/core';
2
- import { StoreRecord } from '@xh/hoist/data';
3
2
  import { ServiceModel } from './ServiceModel';
4
3
  export declare class DetailsModel extends HoistModel {
5
4
  parent: ServiceModel;
6
- svcName: StoreRecord;
5
+ svcName: String;
7
6
  stats: PlainObject;
8
- get selectedRecord(): StoreRecord;
7
+ get selectedRecord(): import("../../../../../data").StoreRecord;
9
8
  onLinked(): void;
10
9
  doLoadAsync(loadSpec: LoadSpec): Promise<void>;
11
10
  }
@@ -6,3 +6,4 @@ export declare const sentMessageCount: ColumnSpec;
6
6
  export declare const lastSentTime: ColumnSpec;
7
7
  export declare const receivedMessageCount: ColumnSpec;
8
8
  export declare const lastReceivedTime: ColumnSpec;
9
+ export declare const clientAppVersion: ColumnSpec;
@@ -10,8 +10,12 @@ export declare class AppStateModel extends HoistModel {
10
10
  lastActivityMs: number;
11
11
  suspendData: AppSuspendData;
12
12
  accessDeniedMessage: string;
13
+ /**
14
+ * Timestamp when the app first started loading, prior to even JS download/eval.
15
+ * Read from timestamp set on window within index.html.
16
+ */
17
+ readonly loadStarted: number;
13
18
  private timings;
14
- private loadStarted;
15
19
  private lastStateChangeTime;
16
20
  constructor();
17
21
  setAppState(nextState: AppState): void;
@@ -10,6 +10,6 @@ import '@xh/hoist/desktop/register';
10
10
  *
11
11
  * Overflowing tabs can be displayed in a dropdown menu if `enableOverflow` is true.
12
12
  * Note that in order for tabs to overflow, the TabSwitcher or it's wrapper must have a
13
- * a maximum width.
13
+ * maximum width.
14
14
  */
15
15
  export declare const TabSwitcher: import("react").FC<TabSwitcherProps>, tabSwitcher: import("@xh/hoist/core").ElementFactory<TabSwitcherProps>;
@@ -40,14 +40,13 @@ export interface BaseOAuthClientConfig<S extends AccessTokenSpec> {
40
40
  */
41
41
  idScopes?: string[];
42
42
  /**
43
- * Optional map of access tokens to be loaded and maintained.
43
+ * Optional spec for access tokens to be loaded and maintained to support access to one or more
44
+ * different back-end resources, distinct from the core Hoist auth flow via ID token.
44
45
  *
45
- * Map of code to a spec for an access token. The code is app-determined and
46
- * will simply be used to get the loaded token via tha getAccessToken() method. The
47
- * spec is implementation specific, but will typically include scopes to be loaded
48
- * for the access token and potentially other meta-data required by the underlying provider.
49
- *
50
- * Use this map to gain targeted access tokens for different back-end resources.
46
+ * Map of key to a spec for an access token. The key is an arbitrary, app-determined string
47
+ * used to retrieve the loaded token via {@link getAccessTokenAsync}. The spec is implementation
48
+ * specific, but will typically include scopes to be loaded for the access token and potentially
49
+ * other metadata required by the underlying provider.
51
50
  */
52
51
  accessTokens?: Record<string, S>;
53
52
  }
@@ -1,12 +1,39 @@
1
1
  import { Token } from './Token';
2
- export type TokenMap = Record<string, Token>;
3
2
  export interface AccessTokenSpec {
4
3
  /**
5
- * Mode governing when the access token should be requested from provider.
6
- * eager (default) - initiate lookup on initialization, but do not block on failure.
7
- * lazy - lookup when requested by client.
4
+ * Mode governing when the access token should be requested from provider:
5
+ * - eager (or undefined) - load on overall initialization, but do not block on failure.
6
+ * Useful for tokens that an app is almost certain to require during a user session.
7
+ * - lazy - defer loading until first requested by client. Useful for tokens that might
8
+ * never be needed by the app during a given user session.
8
9
  */
9
- fetchMode: 'eager' | 'lazy';
10
+ fetchMode?: 'eager' | 'lazy';
10
11
  /** Scopes for the desired access token.*/
11
12
  scopes: string[];
12
13
  }
14
+ export type TokenMap = Record<string, Token>;
15
+ /** Aggregated telemetry results, produced by {@link MsalClient} when enabled via config. */
16
+ export interface TelemetryResults {
17
+ /** Stats by event type - */
18
+ events: Record<string, TelemetryEventResults>;
19
+ }
20
+ /** Aggregated telemetry results for a single type of event. */
21
+ export interface TelemetryEventResults {
22
+ firstTime: Date;
23
+ lastTime: Date;
24
+ successCount: number;
25
+ failureCount: number;
26
+ /** Timing info (in ms) for event instances reported with duration. */
27
+ duration: {
28
+ count: number;
29
+ total: number;
30
+ average: number;
31
+ worst: number;
32
+ };
33
+ lastFailure?: {
34
+ time: Date;
35
+ duration: number;
36
+ code: string;
37
+ name: string;
38
+ };
39
+ }
@@ -1,8 +1,8 @@
1
1
  import * as msal from '@azure/msal-browser';
2
2
  import { LogLevel } from '@azure/msal-browser';
3
3
  import { Token } from '@xh/hoist/security/Token';
4
- import { AccessTokenSpec, TokenMap } from '../Types';
5
4
  import { BaseOAuthClient, BaseOAuthClientConfig } from '../BaseOAuthClient';
5
+ import { AccessTokenSpec, TelemetryResults, TokenMap } from '../Types';
6
6
  export interface MsalClientConfig extends BaseOAuthClientConfig<MsalTokenSpec> {
7
7
  /**
8
8
  * Authority for your organization's tenant: `https://login.microsoftonline.com/[tenantId]`.
@@ -16,6 +16,12 @@ export interface MsalClientConfig extends BaseOAuthClientConfig<MsalTokenSpec> {
16
16
  * The value of the domain hint is a registered domain for the tenant.
17
17
  */
18
18
  domainHint?: string;
19
+ /**
20
+ * True to enable support for built-in telemetry provided by this class's internal MSAL client.
21
+ * Captured performance events will be summarized via {@link telemetryResults}.
22
+ * See https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-browser/docs/performance.md
23
+ */
24
+ enableTelemetry?: boolean;
19
25
  /**
20
26
  * If specified, the client will use this value when initializing the app to enforce a minimum
21
27
  * amount of time during which no further auth flow with the provider should be necessary.
@@ -80,6 +86,9 @@ export declare class MsalClient extends BaseOAuthClient<MsalClientConfig, MsalTo
80
86
  private client;
81
87
  private account;
82
88
  private initialTokenLoad;
89
+ /** Enable telemetry via `enableTelemetry` ctor config, or via {@link enableTelemetry}. */
90
+ telemetryResults: TelemetryResults;
91
+ private _telemetryCbHandle;
83
92
  constructor(config: MsalClientConfig);
84
93
  protected doInitAsync(): Promise<TokenMap>;
85
94
  protected doLoginPopupAsync(): Promise<void>;
@@ -87,6 +96,8 @@ export declare class MsalClient extends BaseOAuthClient<MsalClientConfig, MsalTo
87
96
  protected fetchIdTokenAsync(useCache?: boolean): Promise<Token>;
88
97
  protected fetchAccessTokenAsync(spec: MsalTokenSpec, useCache?: boolean): Promise<Token>;
89
98
  protected doLogoutAsync(): Promise<void>;
99
+ enableTelemetry(): void;
100
+ disableTelemetry(): void;
90
101
  private loginSsoAsync;
91
102
  private createClientAsync;
92
103
  private logFromMsal;