@virtualdisplay.io/client 3.3.0 → 3.4.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.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ## [3.4.0](https://github.com/virtualdisplay-io/client/compare/v3.3.0...v3.4.0) (2025-07-09)
6
+
7
+ ### ✨ Features
8
+
9
+ * implement UI configuration via PostMessage CONFIG messages ([#2](https://github.com/virtualdisplay-io/client/issues/2)) ([abc2294](https://github.com/virtualdisplay-io/client/commit/abc229414f9f70c54f37db903c46c0612c5eb6cf))
10
+
5
11
  ## [3.3.0](https://github.com/virtualdisplay-io/client/compare/v3.2.2...v3.3.0) (2025-07-07)
6
12
 
7
13
  ### ✨ Features
package/dist/index.d.ts CHANGED
@@ -121,13 +121,6 @@ export declare interface AttributeValueConfig {
121
121
  readonly isSelected?: boolean;
122
122
  }
123
123
 
124
- /**
125
- * Base message interface
126
- */
127
- declare interface BaseMessage {
128
- readonly type: MessageType;
129
- }
130
-
131
124
  /**
132
125
  * Configuration options for VirtualdisplayClient
133
126
  */
@@ -137,6 +130,17 @@ export declare interface ClientOptions {
137
130
  readonly license: string;
138
131
  readonly debug?: boolean;
139
132
  readonly language?: string;
133
+ readonly arEnabled?: boolean;
134
+ readonly fullscreenEnabled?: boolean;
135
+ readonly loadingIndicatorEnabled?: boolean;
136
+ }
137
+
138
+ /**
139
+ * Configuration message sent to server
140
+ */
141
+ export declare interface ConfigMessage {
142
+ readonly type: typeof MESSAGE_TYPES.CONFIG;
143
+ readonly config: ViewerConfig;
140
144
  }
141
145
 
142
146
  declare interface CreateNodeParams {
@@ -151,9 +155,11 @@ declare interface CreateNodeParams {
151
155
  */
152
156
  export declare interface DomainEvents extends Record<string, unknown> {
153
157
  [EVENT_NAMES.IFRAME_READY]: VoidEvent;
154
- [EVENT_NAMES.MUTATION_MESSAGE]: MutationMessageEvent;
155
- [EVENT_NAMES.MESSAGE_RECEIVED]: MessageReceivedEvent;
158
+ [EVENT_NAMES.MUTATION_MESSAGE]: MessageEvent_2<MutationMessage>;
159
+ [EVENT_NAMES.CONFIG_MESSAGE]: MessageEvent_2<ConfigMessage>;
160
+ [EVENT_NAMES.MESSAGE_RECEIVED]: MessageEvent_2;
156
161
  [EVENT_NAMES.STATE_CHANGED]: StateChangedEvent;
162
+ [EVENT_NAMES.INITIAL_STATE_RECEIVED]: VoidEvent;
157
163
  }
158
164
 
159
165
  export declare function enableDebugMode(): void;
@@ -178,6 +184,7 @@ export declare type ErrorCode = typeof ERROR_CODES[keyof typeof ERROR_CODES];
178
184
  export declare const EVENT_NAMES: {
179
185
  readonly IFRAME_READY: "iframe:ready";
180
186
  readonly MUTATION_MESSAGE: "mutation:message";
187
+ readonly CONFIG_MESSAGE: "config:message";
181
188
  readonly MESSAGE_RECEIVED: "message:received";
182
189
  readonly STATE_CHANGED: "state:changed";
183
190
  readonly INITIAL_STATE_RECEIVED: "state:initial-received";
@@ -292,7 +299,7 @@ export declare class MappingValidator {
292
299
  /**
293
300
  * Union of all possible messages
294
301
  */
295
- export declare type Message = MutationMessage | StateMessage;
302
+ export declare type Message = MutationMessage | StateMessage | ConfigMessage;
296
303
 
297
304
  /**
298
305
  * Types of messages exchanged between client and server
@@ -301,17 +308,16 @@ export declare type Message = MutationMessage | StateMessage;
301
308
  export declare const MESSAGE_TYPES: {
302
309
  readonly MUTATION: "mutation";
303
310
  readonly STATE: "state";
311
+ readonly CONFIG: "config";
304
312
  };
305
313
 
306
314
  /**
307
- * State Flow Events (Server → Client)
315
+ * Generic message event - used for all message passing
308
316
  */
309
- declare interface MessageReceivedEvent {
310
- message: unknown;
317
+ declare interface MessageEvent_2<T extends Message = Message> {
318
+ message: T;
311
319
  }
312
320
 
313
- declare type MessageType = typeof MESSAGE_TYPES[keyof typeof MESSAGE_TYPES];
314
-
315
321
  /**
316
322
  * Represents a 3D node in the scene
317
323
  * Live object that can be updated to reflect state changes
@@ -373,18 +379,11 @@ export declare interface MutationDto {
373
379
  /**
374
380
  * Mutation message sent to server
375
381
  */
376
- export declare interface MutationMessage extends BaseMessage {
382
+ export declare interface MutationMessage {
377
383
  readonly type: typeof MESSAGE_TYPES.MUTATION;
378
384
  readonly mutations: MutationDto[];
379
385
  }
380
386
 
381
- /**
382
- * Mutation Flow Events (Client → Server)
383
- */
384
- declare interface MutationMessageEvent {
385
- message: MutationMessage;
386
- }
387
-
388
387
  export declare type MutationType = typeof MUTATION_TYPES[keyof typeof MUTATION_TYPES];
389
388
 
390
389
  /**
@@ -425,7 +424,7 @@ declare interface StateChangedEvent {
425
424
  * State message received from server
426
425
  * Contains array of model node DTOs
427
426
  */
428
- export declare interface StateMessage extends BaseMessage {
427
+ export declare interface StateMessage {
429
428
  readonly type: typeof MESSAGE_TYPES.STATE;
430
429
  readonly nodes: ModelNodeDto[];
431
430
  readonly isInitial: boolean;
@@ -451,6 +450,22 @@ declare class StateService {
451
450
  clear(): void;
452
451
  }
453
452
 
453
+ /**
454
+ * UI configuration options
455
+ */
456
+ export declare interface UIConfig {
457
+ readonly arEnabled?: boolean;
458
+ readonly fullscreenEnabled?: boolean;
459
+ readonly loadingIndicatorEnabled?: boolean;
460
+ }
461
+
462
+ /**
463
+ * Viewer configuration
464
+ */
465
+ export declare interface ViewerConfig {
466
+ readonly ui?: UIConfig;
467
+ }
468
+
454
469
  /**
455
470
  * Main Virtualdisplay Client
456
471
  * Provides the public API for 3D product visualization
@@ -460,11 +475,13 @@ export declare class VirtualdisplayClient {
460
475
  private readonly attributeService;
461
476
  private readonly stateService;
462
477
  private readonly messageHandler;
478
+ private readonly viewerService;
463
479
  private readonly options;
464
480
  private iframe;
465
481
  constructor(options: ClientOptions);
466
482
  private initializeLogging;
467
483
  private createAndConnectIframe;
484
+ private setupInitialConfig;
468
485
  /**
469
486
  * Load attribute mapping configuration
470
487
  * @throws {VirtualdisplayError} When mapping configuration is invalid
@@ -492,6 +509,10 @@ export declare class VirtualdisplayClient {
492
509
  * If already ready, the callback is called immediately
493
510
  */
494
511
  onReady(callback: () => void): void;
512
+ /**
513
+ * Get the viewer service for UI configuration
514
+ */
515
+ get viewer(): VirtualdisplayViewerService;
495
516
  destroy(): void;
496
517
  }
497
518
 
@@ -509,6 +530,48 @@ export declare class VirtualdisplayError extends Error {
509
530
  static invalidMutations(reason?: string): VirtualdisplayError;
510
531
  }
511
532
 
533
+ /**
534
+ * Service responsible for managing viewer UI configuration
535
+ * Sends CONFIG messages to control AR button, fullscreen button, and loading indicator
536
+ */
537
+ export declare class VirtualdisplayViewerService {
538
+ private readonly eventBus;
539
+ constructor(eventBus: EventBus);
540
+ /**
541
+ * Send initial configuration based on client options
542
+ * Only sends config when values are false (server defaults to true)
543
+ */
544
+ sendInitialConfig(options: ClientOptions): void;
545
+ /**
546
+ * Update AR button visibility
547
+ */
548
+ setArEnabled(enabled: boolean): void;
549
+ /**
550
+ * Update fullscreen button visibility
551
+ */
552
+ setFullscreenEnabled(enabled: boolean): void;
553
+ /**
554
+ * Update loading indicator visibility
555
+ */
556
+ setLoadingIndicatorEnabled(enabled: boolean): void;
557
+ /**
558
+ * Update multiple UI settings at once
559
+ */
560
+ updateUIConfig(config: Partial<UIConfig>): void;
561
+ /**
562
+ * Hide all UI elements
563
+ */
564
+ hideAllUI(): void;
565
+ /**
566
+ * Show all UI elements
567
+ */
568
+ showAllUI(): void;
569
+ /**
570
+ * Send UI configuration to server
571
+ */
572
+ private sendUIConfig;
573
+ }
574
+
512
575
  declare interface VoidEvent {
513
576
  }
514
577