@xh/hoist 73.0.0-SNAPSHOT.1744386127895 → 73.0.0-SNAPSHOT.1744587436966

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/CHANGELOG.md CHANGED
@@ -8,6 +8,7 @@
8
8
  connected clients.
9
9
  * Enabled telemetry reporting from `WebSocketService`.
10
10
  * Updated `MenuItem.actionFn()` to receive the click event as an additional argument.
11
+ * Support for reporting App Build, TabID and Client ID in websocket admin page
11
12
 
12
13
  ## v72.4.0 - 2025-04-09
13
14
 
@@ -73,11 +73,33 @@ export const lastReceivedTime: ColumnSpec = {
73
73
  width: 140
74
74
  };
75
75
 
76
- export const clientAppVersion: ColumnSpec = {
76
+ export const appVersion: ColumnSpec = {
77
77
  field: {
78
- name: 'clientAppVersion',
78
+ name: 'appVersion',
79
79
  type: 'string',
80
80
  displayName: 'Client Version'
81
81
  },
82
82
  width: 120
83
83
  };
84
+
85
+ export const appBuild: ColumnSpec = {
86
+ field: {
87
+ name: 'appBuild',
88
+ type: 'string'
89
+ },
90
+ width: 120
91
+ };
92
+ export const loadId: ColumnSpec = {
93
+ field: {
94
+ name: 'loadId',
95
+ type: 'string'
96
+ },
97
+ width: 120
98
+ };
99
+ export const tabId: ColumnSpec = {
100
+ field: {
101
+ name: 'tabId',
102
+ type: 'string'
103
+ },
104
+ width: 120
105
+ };
@@ -92,7 +92,10 @@ export class WebSocketModel extends BaseInstanceModel {
92
92
  WSCol.lastSentTime,
93
93
  WSCol.receivedMessageCount,
94
94
  WSCol.lastReceivedTime,
95
- WSCol.clientAppVersion
95
+ WSCol.appVersion,
96
+ WSCol.appBuild,
97
+ WSCol.loadId,
98
+ WSCol.tabId
96
99
  ]
97
100
  });
98
101
 
@@ -92,14 +92,14 @@ export class AppStateModel extends HoistModel {
92
92
  timestamp: loadStarted,
93
93
  elapsed: Date.now() - loadStarted - (timings.LOGIN_REQUIRED ?? 0),
94
94
  data: {
95
- clientId: XH.clientId,
96
- sessionId: XH.sessionId,
95
+ loadId: XH.loadId,
96
+ tabId: XH.tabId,
97
97
  timings: mapKeys(timings, (v, k) => camelCase(k)),
98
98
  clientHealth: XH.clientHealthService.getReport(),
99
99
  window: this.getWindowData(),
100
100
  screen: this.getScreenData()
101
101
  },
102
- logData: ['clientId', 'sessionId'],
102
+ logData: ['loadId', 'tabId'],
103
103
  omit: !XH.appSpec.trackAppLoad
104
104
  })
105
105
  });
@@ -6,4 +6,7 @@ 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;
9
+ export declare const appVersion: ColumnSpec;
10
+ export declare const appBuild: ColumnSpec;
11
+ export declare const loadId: ColumnSpec;
12
+ export declare const tabId: ColumnSpec;
@@ -22,12 +22,12 @@ export declare const MIN_HOIST_CORE_VERSION = "28.0";
22
22
  */
23
23
  export declare class XHApi {
24
24
  /** Unique id for this loaded instance of the app. Unique for every refresh of document. */
25
- clientId: string;
25
+ loadId: string;
26
26
  /**
27
27
  * Unique id for this browser tab/window on this domain.
28
28
  * Corresponds to the scope of the built-in sessionStorage object.
29
29
  */
30
- sessionId: string;
30
+ tabId: string;
31
31
  /** Core implementation model hosting all application state. */
32
32
  appContainerModel: AppContainerModel;
33
33
  /** Provider of centralized exception handling for the app. */
@@ -412,8 +412,8 @@ export declare class XHApi {
412
412
  */
413
413
  genId(): string;
414
414
  private get acm();
415
- private genClientId;
416
- private genSessionId;
415
+ private genLoadId;
416
+ private genTabId;
417
417
  }
418
418
  /** The app-wide singleton instance. */
419
419
  export declare const XH: XHApi;
@@ -28,6 +28,7 @@ export declare class WebSocketService extends HoistService {
28
28
  readonly REG_SUCCESS_TOPIC = "xhRegistrationSuccess";
29
29
  readonly FORCE_APP_SUSPEND_TOPIC = "xhForceAppSuspend";
30
30
  readonly REQ_CLIENT_HEALTH_RPT_TOPIC = "xhRequestClientHealthReport";
31
+ readonly METADATA_FOR_HANDSHAKE: string[];
31
32
  /** True if WebSockets generally enabled - set statically in code via {@link AppSpec}. */
32
33
  enabled: boolean;
33
34
  /** Unique channel assigned by server upon successful connection. */
package/core/XH.ts CHANGED
@@ -87,13 +87,13 @@ declare const xhIsDevelopmentMode: boolean;
87
87
  */
88
88
  export class XHApi {
89
89
  /** Unique id for this loaded instance of the app. Unique for every refresh of document. */
90
- clientId: string = this.genClientId();
90
+ loadId: string = this.genLoadId();
91
91
 
92
92
  /**
93
93
  * Unique id for this browser tab/window on this domain.
94
94
  * Corresponds to the scope of the built-in sessionStorage object.
95
95
  */
96
- sessionId: string = this.genSessionId();
96
+ tabId: string = this.genTabId();
97
97
 
98
98
  //--------------------------
99
99
  // Implementation Delegates
@@ -807,15 +807,15 @@ export class XHApi {
807
807
  return this.appContainerModel;
808
808
  }
809
809
 
810
- private genClientId(): string {
810
+ private genLoadId(): string {
811
811
  return new ShortUniqueId({length: 8}).rnd();
812
812
  }
813
813
 
814
- private genSessionId(): string {
815
- let ret = window.sessionStorage?.getItem('xhSessionId');
814
+ private genTabId(): string {
815
+ let ret = window.sessionStorage?.getItem('xhTabId');
816
816
  if (!ret) {
817
817
  ret = new ShortUniqueId({length: 8}).rnd();
818
- window.sessionStorage?.setItem('xhSessionId', ret);
818
+ window.sessionStorage?.setItem('xhTabId', ret);
819
819
  }
820
820
  return ret;
821
821
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xh/hoist",
3
- "version": "73.0.0-SNAPSHOT.1744386127895",
3
+ "version": "73.0.0-SNAPSHOT.1744587436966",
4
4
  "description": "Hoist add-on for building and deploying React Applications.",
5
5
  "repository": "github:xh/hoist-react",
6
6
  "homepage": "https://xh.io",
@@ -142,8 +142,8 @@ export class ClientHealthService extends HoistService {
142
142
  ...rest,
143
143
  ...opts,
144
144
  data: {
145
- clientId: XH.clientId,
146
- sessionId: XH.sessionId,
145
+ loadId: XH.loadId,
146
+ tabId: XH.tabId,
147
147
  ...this.getReport()
148
148
  }
149
149
  });
@@ -42,6 +42,7 @@ export class WebSocketService extends HoistService {
42
42
  readonly REG_SUCCESS_TOPIC = 'xhRegistrationSuccess';
43
43
  readonly FORCE_APP_SUSPEND_TOPIC = 'xhForceAppSuspend';
44
44
  readonly REQ_CLIENT_HEALTH_RPT_TOPIC = 'xhRequestClientHealthReport';
45
+ readonly METADATA_FOR_HANDSHAKE = ['appVersion', 'appBuild', 'loadId', 'tabId'];
45
46
 
46
47
  /** True if WebSockets generally enabled - set statically in code via {@link AppSpec}. */
47
48
  enabled: boolean = XH.appSpec.webSocketsEnabled;
@@ -304,7 +305,7 @@ export class WebSocketService extends HoistService {
304
305
 
305
306
  private buildWebSocketUrl() {
306
307
  const protocol = window.location.protocol == 'https:' ? 'wss:' : 'ws:',
307
- endpoint = 'xhWebSocket?clientAppVersion=' + XH.appVersion;
308
+ endpoint = `xhWebSocket?${this.METADATA_FOR_HANDSHAKE.map(key => `${key}=${XH[key]}`).join('&')}`;
308
309
  return XH.isDevelopmentMode
309
310
  ? `${protocol}//${XH.baseUrl.split('//')[1]}${endpoint}`
310
311
  : `${protocol}//${window.location.host}${XH.baseUrl}${endpoint}`;