@virtualdisplay.io/client 4.0.0-alpha.15 → 4.0.0-alpha.17
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 +12 -0
- package/dist/index.d.ts +1096 -0
- package/dist/virtualdisplay.client.cjs.js +6 -6
- package/dist/virtualdisplay.client.es.js +238 -217
- package/dist/virtualdisplay.client.umd.js +9 -9
- package/package.json +3 -3
- package/dist/src/annotations/annotations.d.ts +0 -20
- package/dist/src/annotations/annotations.d.ts.map +0 -1
- package/dist/src/annotations/index.d.ts +0 -2
- package/dist/src/annotations/index.d.ts.map +0 -1
- package/dist/src/attributes/attribute.d.ts +0 -40
- package/dist/src/attributes/attribute.d.ts.map +0 -1
- package/dist/src/attributes/attributes.d.ts +0 -45
- package/dist/src/attributes/attributes.d.ts.map +0 -1
- package/dist/src/attributes/selections.d.ts +0 -17
- package/dist/src/attributes/selections.d.ts.map +0 -1
- package/dist/src/attributes/value.d.ts +0 -13
- package/dist/src/attributes/value.d.ts.map +0 -1
- package/dist/src/camera/camera.d.ts +0 -40
- package/dist/src/camera/camera.d.ts.map +0 -1
- package/dist/src/camera/index.d.ts +0 -4
- package/dist/src/camera/index.d.ts.map +0 -1
- package/dist/src/camera/position.d.ts +0 -56
- package/dist/src/camera/position.d.ts.map +0 -1
- package/dist/src/client/client.d.ts +0 -71
- package/dist/src/client/client.d.ts.map +0 -1
- package/dist/src/client/error.d.ts +0 -23
- package/dist/src/client/error.d.ts.map +0 -1
- package/dist/src/client/events.d.ts +0 -22
- package/dist/src/client/events.d.ts.map +0 -1
- package/dist/src/client/iframe-builder.d.ts +0 -27
- package/dist/src/client/iframe-builder.d.ts.map +0 -1
- package/dist/src/client/options.d.ts +0 -19
- package/dist/src/client/options.d.ts.map +0 -1
- package/dist/src/client/ready-state-tracker.d.ts +0 -13
- package/dist/src/client/ready-state-tracker.d.ts.map +0 -1
- package/dist/src/client/types.d.ts +0 -20
- package/dist/src/client/types.d.ts.map +0 -1
- package/dist/src/configuration/configuration.d.ts +0 -113
- package/dist/src/configuration/configuration.d.ts.map +0 -1
- package/dist/src/configuration/index.d.ts +0 -2
- package/dist/src/configuration/index.d.ts.map +0 -1
- package/dist/src/configuration/resolver.d.ts +0 -16
- package/dist/src/configuration/resolver.d.ts.map +0 -1
- package/dist/src/focus/focus.d.ts +0 -43
- package/dist/src/focus/focus.d.ts.map +0 -1
- package/dist/src/focus/index.d.ts +0 -2
- package/dist/src/focus/index.d.ts.map +0 -1
- package/dist/src/index.d.ts +0 -16
- package/dist/src/index.d.ts.map +0 -1
- package/dist/src/snapshot/index.d.ts +0 -3
- package/dist/src/snapshot/index.d.ts.map +0 -1
- package/dist/src/snapshot/photo.d.ts +0 -47
- package/dist/src/snapshot/photo.d.ts.map +0 -1
- package/dist/src/snapshot/snapshot.d.ts +0 -36
- package/dist/src/snapshot/snapshot.d.ts.map +0 -1
- package/dist/src/ui/action-bar.d.ts +0 -18
- package/dist/src/ui/action-bar.d.ts.map +0 -1
- package/dist/src/ui/camera-controls.d.ts +0 -8
- package/dist/src/ui/camera-controls.d.ts.map +0 -1
- package/dist/src/ui/commerce-panel.d.ts +0 -31
- package/dist/src/ui/commerce-panel.d.ts.map +0 -1
- package/dist/src/ui/controls/attribute-group.d.ts +0 -6
- package/dist/src/ui/controls/attribute-group.d.ts.map +0 -1
- package/dist/src/ui/event-bus.d.ts +0 -12
- package/dist/src/ui/event-bus.d.ts.map +0 -1
- package/dist/src/ui/layouts/inframe-layout.d.ts +0 -13
- package/dist/src/ui/layouts/inframe-layout.d.ts.map +0 -1
- package/dist/src/ui/layouts/layout.d.ts +0 -15
- package/dist/src/ui/layouts/layout.d.ts.map +0 -1
- package/dist/src/ui/layouts/null-layout.d.ts +0 -12
- package/dist/src/ui/layouts/null-layout.d.ts.map +0 -1
- package/dist/src/ui/layouts/registry.d.ts +0 -4
- package/dist/src/ui/layouts/registry.d.ts.map +0 -1
- package/dist/src/ui/layouts/sidebar-layout.d.ts +0 -24
- package/dist/src/ui/layouts/sidebar-layout.d.ts.map +0 -1
- package/dist/src/ui/loading.d.ts +0 -43
- package/dist/src/ui/loading.d.ts.map +0 -1
- package/dist/src/ui/standard-interface.d.ts +0 -47
- package/dist/src/ui/standard-interface.d.ts.map +0 -1
- package/dist/src/ui/styles.d.ts +0 -3
- package/dist/src/ui/styles.d.ts.map +0 -1
- package/dist/src/utils/logger.d.ts +0 -11
- package/dist/src/utils/logger.d.ts.map +0 -1
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { Attribute } from './attribute';
|
|
2
|
-
import { AttributeValue } from './value';
|
|
3
|
-
import { MappingMessage, MessageCallback, MutationResultMessage } from '@virtualdisplay.io/messaging';
|
|
4
|
-
/**
|
|
5
|
-
* Public attribute API.
|
|
6
|
-
* Receives mapping from server, provides query/select API,
|
|
7
|
-
* and sends mutations via postMessage.
|
|
8
|
-
*
|
|
9
|
-
* select() can be called before the mapping arrives — mutations are sent
|
|
10
|
-
* immediately and buffered by the messenger's publisher queue until the
|
|
11
|
-
* iframe is ready. onChange() callbacks registered before the mapping are
|
|
12
|
-
* replayed once the registry is created.
|
|
13
|
-
*/
|
|
14
|
-
export declare class Attributes {
|
|
15
|
-
private readonly send;
|
|
16
|
-
private readonly onMutationFailed?;
|
|
17
|
-
private registry;
|
|
18
|
-
private readonly pendingCallbacks;
|
|
19
|
-
constructor(send: MessageCallback, onMutationFailed?: ((attribute: string, value: string) => void) | undefined);
|
|
20
|
-
/**
|
|
21
|
-
* Handle incoming MAPPING message from server
|
|
22
|
-
*/
|
|
23
|
-
handleMappingReceived(message: MappingMessage): void;
|
|
24
|
-
handleMutationResult(message: MutationResultMessage): void;
|
|
25
|
-
/**
|
|
26
|
-
* Select a value for an attribute - sends mutation to server.
|
|
27
|
-
* Can be called before the mapping arrives — the mutation is sent immediately
|
|
28
|
-
* and the messenger's publisher queue holds it until the iframe is ready.
|
|
29
|
-
*/
|
|
30
|
-
select(name: string, value: string): void;
|
|
31
|
-
getValues(name: string): AttributeValue[];
|
|
32
|
-
getValue(name: string, value: string): AttributeValue | undefined;
|
|
33
|
-
/**
|
|
34
|
-
* Register onChange callback for an attribute.
|
|
35
|
-
* Buffers the callback if the mapping hasn't arrived yet.
|
|
36
|
-
*/
|
|
37
|
-
onChange(name: string, callback: (selectedValue: AttributeValue) => void): void;
|
|
38
|
-
getAttribute(name: string): Attribute | undefined;
|
|
39
|
-
/** The current selection as attribute name→value pairs, empty before the mapping arrives. */
|
|
40
|
-
getSelection(): Record<string, string>;
|
|
41
|
-
get hasMapping(): boolean;
|
|
42
|
-
private sendMutation;
|
|
43
|
-
private replayPendingCallbacks;
|
|
44
|
-
}
|
|
45
|
-
//# sourceMappingURL=attributes.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"attributes.d.ts","sourceRoot":"","sources":["../../../src/attributes/attributes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAC9C,OAAO,EAEL,KAAK,cAAc,EACnB,KAAK,eAAe,EAGpB,KAAK,qBAAqB,EAC3B,MAAM,8BAA8B,CAAC;AAGtC;;;;;;;;;GASG;AACH,qBAAa,UAAU;IAMnB,OAAO,CAAC,QAAQ,CAAC,IAAI;IACrB,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAC;IANpC,OAAO,CAAC,QAAQ,CAAgC;IAEhD,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAkF;gBAGhG,IAAI,EAAE,eAAe,EACrB,gBAAgB,CAAC,GAAE,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,aAAA;IAGhF;;OAEG;IACI,qBAAqB,CAAC,OAAO,EAAE,cAAc,GAAG,IAAI;IAepD,oBAAoB,CAAC,OAAO,EAAE,qBAAqB,GAAG,IAAI;IAIjE;;;;OAIG;IACI,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI;IAIzC,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,cAAc,EAAE;IAIzC,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,cAAc,GAAG,SAAS;IAIxE;;;OAGG;IACI,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,aAAa,EAAE,cAAc,KAAK,IAAI,GAAG,IAAI;IAe/E,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS;IAIxD,6FAA6F;IACtF,YAAY,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IAI7C,IAAW,UAAU,IAAI,OAAO,CAE/B;IAED,OAAO,CAAC,YAAY;IAUpB,OAAO,CAAC,sBAAsB;CAU/B"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { Attribute } from './attribute';
|
|
2
|
-
import { AttributeDefinition, MutationDto, MutationResult } from '@virtualdisplay.io/messaging';
|
|
3
|
-
/**
|
|
4
|
-
* Creates and tracks attribute instances from server definitions.
|
|
5
|
-
* Handles mutation results by updating the corresponding attribute.
|
|
6
|
-
*/
|
|
7
|
-
export declare class AttributeRegistry {
|
|
8
|
-
private readonly attributes;
|
|
9
|
-
constructor(definitions: AttributeDefinition[], sendMutation: (mutations: MutationDto[], isInitial: boolean) => void, onMutationFailed?: (attribute: string, value: string) => void);
|
|
10
|
-
private readonly onMutationFailed;
|
|
11
|
-
get(name: string): Attribute | undefined;
|
|
12
|
-
/** The current selection as attribute name→value pairs, skipping unset attributes. */
|
|
13
|
-
getSelection(): Record<string, string>;
|
|
14
|
-
handleResults(results: MutationResult[]): void;
|
|
15
|
-
private buildOptions;
|
|
16
|
-
}
|
|
17
|
-
//# sourceMappingURL=selections.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"selections.d.ts","sourceRoot":"","sources":["../../../src/attributes/selections.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAyB,MAAM,aAAa,CAAC;AAC/D,OAAO,KAAK,EAAE,mBAAmB,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAErG;;;GAGG;AACH,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAgC;gBAGzD,WAAW,EAAE,mBAAmB,EAAE,EAClC,YAAY,EAAE,CAAC,SAAS,EAAE,WAAW,EAAE,EAAE,SAAS,EAAE,OAAO,KAAK,IAAI,EACpE,gBAAgB,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI;IAS/D,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAA2D;IAErF,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS;IAI/C,sFAAsF;IAC/E,YAAY,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IAWtC,aAAa,CAAC,OAAO,EAAE,cAAc,EAAE,GAAG,IAAI;IAWrD,OAAO,CAAC,YAAY;CAkBrB"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Pure domain entity representing a single attribute value
|
|
3
|
-
* No side effects - only state
|
|
4
|
-
*/
|
|
5
|
-
export declare class AttributeValue {
|
|
6
|
-
readonly value: string;
|
|
7
|
-
readonly attribute: string;
|
|
8
|
-
private isSelectedValue;
|
|
9
|
-
constructor(value: string, attribute: string);
|
|
10
|
-
get isSelected(): boolean;
|
|
11
|
-
setSelected(selected: boolean): void;
|
|
12
|
-
}
|
|
13
|
-
//# sourceMappingURL=value.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"value.d.ts","sourceRoot":"","sources":["../../../src/attributes/value.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,qBAAa,cAAc;aAIP,KAAK,EAAE,MAAM;aACb,SAAS,EAAE,MAAM;IAJnC,OAAO,CAAC,eAAe,CAAS;gBAGd,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,MAAM;IAGnC,IAAW,UAAU,IAAI,OAAO,CAE/B;IAEM,WAAW,CAAC,QAAQ,EAAE,OAAO,GAAG,IAAI;CAG5C"}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { MessageCallback } from '@virtualdisplay.io/messaging';
|
|
2
|
-
/**
|
|
3
|
-
* Camera control API for positioning and zoom
|
|
4
|
-
* Uses chaining pattern for building commands
|
|
5
|
-
*/
|
|
6
|
-
export declare class Camera {
|
|
7
|
-
private readonly send;
|
|
8
|
-
private commands;
|
|
9
|
-
constructor(send: MessageCallback);
|
|
10
|
-
/**
|
|
11
|
-
* Rotate camera horizontally
|
|
12
|
-
* @param degrees - Absolute rotation in degrees (0 = front view)
|
|
13
|
-
* @throws VirtualdisplayError if value is not a finite number
|
|
14
|
-
*/
|
|
15
|
-
rotate(degrees: number): this;
|
|
16
|
-
/**
|
|
17
|
-
* Tilt camera vertically
|
|
18
|
-
* @param degrees - Absolute tilt in degrees (0 = top view, 90 = horizontal)
|
|
19
|
-
* @throws VirtualdisplayError if value is not a finite number
|
|
20
|
-
*/
|
|
21
|
-
tilt(degrees: number): this;
|
|
22
|
-
/**
|
|
23
|
-
* Zoom camera
|
|
24
|
-
* @param percentage - Zoom percentage (100 = normal, >100 = zoom in, <100 = zoom out)
|
|
25
|
-
* @throws VirtualdisplayError if value is not a finite number
|
|
26
|
-
*/
|
|
27
|
-
zoom(percentage: number): this;
|
|
28
|
-
/**
|
|
29
|
-
* Execute accumulated camera commands
|
|
30
|
-
* @throws VirtualdisplayError if no commands have been accumulated
|
|
31
|
-
*/
|
|
32
|
-
set(): void;
|
|
33
|
-
private validateFiniteNumber;
|
|
34
|
-
/**
|
|
35
|
-
* Reset camera to initial position
|
|
36
|
-
* This is not chainable and executes immediately
|
|
37
|
-
*/
|
|
38
|
-
reset(): void;
|
|
39
|
-
}
|
|
40
|
-
//# sourceMappingURL=camera.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"camera.d.ts","sourceRoot":"","sources":["../../../src/camera/camera.ts"],"names":[],"mappings":"AACA,OAAO,EAAgE,KAAK,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAElI;;;GAGG;AACH,qBAAa,MAAM;IAIf,OAAO,CAAC,QAAQ,CAAC,IAAI;IAHvB,OAAO,CAAC,QAAQ,CAAuB;gBAGpB,IAAI,EAAE,eAAe;IAGxC;;;;OAIG;IACI,MAAM,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAMpC;;;;OAIG;IACI,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAMlC;;;;OAIG;IACI,IAAI,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI;IAMrC;;;OAGG;IACI,GAAG,IAAI,IAAI;IAiBlB,OAAO,CAAC,oBAAoB;IAQ5B;;;OAGG;IACI,KAAK,IAAI,IAAI;CAQrB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/camera/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,cAAc,EAAE,KAAK,mBAAmB,EAAE,MAAM,YAAY,CAAC;AACtE,YAAY,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC"}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { CameraLimits, CameraParameter, CameraPositionMessage } from '@virtualdisplay.io/messaging';
|
|
2
|
-
/**
|
|
3
|
-
* Camera position state object
|
|
4
|
-
*/
|
|
5
|
-
export interface CameraPositionState {
|
|
6
|
-
rotation: number;
|
|
7
|
-
tilt: number;
|
|
8
|
-
zoom: number;
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* Camera position state
|
|
12
|
-
* Tracks current rotation, tilt, zoom, and movement limits from server updates.
|
|
13
|
-
*/
|
|
14
|
-
export declare class CameraPosition {
|
|
15
|
-
private readonly state;
|
|
16
|
-
private limitsState;
|
|
17
|
-
private readonly changeCallbacks;
|
|
18
|
-
constructor();
|
|
19
|
-
/**
|
|
20
|
-
* Get current rotation in degrees
|
|
21
|
-
*/
|
|
22
|
-
get rotation(): number;
|
|
23
|
-
/**
|
|
24
|
-
* Get current tilt in degrees
|
|
25
|
-
*/
|
|
26
|
-
get tilt(): number;
|
|
27
|
-
/**
|
|
28
|
-
* Get current zoom percentage
|
|
29
|
-
*/
|
|
30
|
-
get zoom(): number;
|
|
31
|
-
/**
|
|
32
|
-
* Subscribe to camera position changes.
|
|
33
|
-
* Also fires when limits are applied via applyLimits() so components
|
|
34
|
-
* can re-evaluate disabled states without a separate callback.
|
|
35
|
-
*/
|
|
36
|
-
onChange(callback: (position: CameraPositionState) => void): void;
|
|
37
|
-
/**
|
|
38
|
-
* Current camera movement limits (set from CONFIG message).
|
|
39
|
-
* Undefined until the server sends limits in its CONFIG payload.
|
|
40
|
-
*/
|
|
41
|
-
get limits(): CameraLimits | undefined;
|
|
42
|
-
/**
|
|
43
|
-
* Apply camera limits received from the server CONFIG message.
|
|
44
|
-
* Fires onChange callbacks so button disabled states update immediately.
|
|
45
|
-
*/
|
|
46
|
-
applyLimits(limits: CameraLimits | undefined): void;
|
|
47
|
-
/**
|
|
48
|
-
* Handle incoming camera position message from server
|
|
49
|
-
*/
|
|
50
|
-
handlePositionUpdate(message: CameraPositionMessage): void;
|
|
51
|
-
/**
|
|
52
|
-
* Update camera position from server transforms
|
|
53
|
-
*/
|
|
54
|
-
update(transforms: CameraParameter[]): void;
|
|
55
|
-
}
|
|
56
|
-
//# sourceMappingURL=position.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"position.d.ts","sourceRoot":"","sources":["../../../src/camera/position.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAEzG;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;;GAGG;AACH,qBAAa,cAAc;IACzB,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAsB;IAE5C,OAAO,CAAC,WAAW,CAA2B;IAE9C,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAsD;;IAUtF;;OAEG;IACH,IAAW,QAAQ,IAAI,MAAM,CAE5B;IAED;;OAEG;IACH,IAAW,IAAI,IAAI,MAAM,CAExB;IAED;;OAEG;IACH,IAAW,IAAI,IAAI,MAAM,CAExB;IAED;;;;OAIG;IACI,QAAQ,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE,mBAAmB,KAAK,IAAI,GAAG,IAAI;IAIxE;;;OAGG;IACH,IAAW,MAAM,IAAI,YAAY,GAAG,SAAS,CAE5C;IAED;;;OAGG;IACI,WAAW,CAAC,MAAM,EAAE,YAAY,GAAG,SAAS,GAAG,IAAI;IAM1D;;OAEG;IACI,oBAAoB,CAAC,OAAO,EAAE,qBAAqB,GAAG,IAAI;IAIjE;;OAEG;IACI,MAAM,CAAC,UAAU,EAAE,eAAe,EAAE,GAAG,IAAI;CAmCnD"}
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import { ClientOptions } from './options';
|
|
2
|
-
import { MutationFailedEvent, VirtualdisplayUiEventMap, VirtualdisplayUiEventType } from './types';
|
|
3
|
-
import { Annotations } from '../annotations';
|
|
4
|
-
import { Attribute } from '../attributes/attribute';
|
|
5
|
-
import { AttributeValue } from '../attributes/value';
|
|
6
|
-
import { Camera, CameraPosition } from '../camera';
|
|
7
|
-
import { Focus } from '../focus';
|
|
8
|
-
import { Configuration } from '../configuration';
|
|
9
|
-
import { ViewerSettings } from '@virtualdisplay.io/messaging';
|
|
10
|
-
import { Snapshot } from '../snapshot';
|
|
11
|
-
/**
|
|
12
|
-
* Main Virtualdisplay Client — composition root.
|
|
13
|
-
* Wires all services together and exposes the public API.
|
|
14
|
-
*/
|
|
15
|
-
export declare class VirtualdisplayClient {
|
|
16
|
-
private readonly attributes;
|
|
17
|
-
private readonly readyStateTracker;
|
|
18
|
-
private readonly messenger;
|
|
19
|
-
private readonly cameraApi;
|
|
20
|
-
private readonly cameraPositionApi;
|
|
21
|
-
private readonly focusApi;
|
|
22
|
-
private readonly configurationApi;
|
|
23
|
-
private readonly snapshotApi;
|
|
24
|
-
private readonly annotationsApi;
|
|
25
|
-
private readonly eventBus;
|
|
26
|
-
private readonly ui;
|
|
27
|
-
private readonly qrModal;
|
|
28
|
-
private readonly options;
|
|
29
|
-
private iframe;
|
|
30
|
-
private container;
|
|
31
|
-
private readyCallbacks;
|
|
32
|
-
private readonly mutationFailedCallbacks;
|
|
33
|
-
constructor(options: ClientOptions);
|
|
34
|
-
private registerHandlers;
|
|
35
|
-
/** Handlers that feed viewer-reported state into the facades (focus, pricing). */
|
|
36
|
-
private registerFacadeStateHandlers;
|
|
37
|
-
/**
|
|
38
|
-
* Dispatch a bubbling `vd:focus-change` event on the container so a page can
|
|
39
|
-
* react to focus without registering an `onChange` callback.
|
|
40
|
-
*/
|
|
41
|
-
private dispatchFocusChange;
|
|
42
|
-
/**
|
|
43
|
-
* Dispatch a bubbling `vd:configuration-change` event on the container so a
|
|
44
|
-
* page or tag manager can react to price changes without a client callback.
|
|
45
|
-
*/
|
|
46
|
-
private dispatchConfigurationChange;
|
|
47
|
-
/** Dispatch a bubbling `vd:configuration-submit` event when the CTA is used. */
|
|
48
|
-
private dispatchConfigurationSubmit;
|
|
49
|
-
private handleConfig;
|
|
50
|
-
private activateAr;
|
|
51
|
-
private initializeLogging;
|
|
52
|
-
private createAndConnectIframe;
|
|
53
|
-
select(name: string, value: string): void;
|
|
54
|
-
getValues(name: string): AttributeValue[];
|
|
55
|
-
getValue(name: string, value: string): AttributeValue | undefined;
|
|
56
|
-
onChange(name: string, callback: (selectedValue: AttributeValue) => void): void;
|
|
57
|
-
getAttribute(name: string): Attribute | undefined;
|
|
58
|
-
get isReady(): boolean;
|
|
59
|
-
onReady(callback: (client: VirtualdisplayClient) => void): void;
|
|
60
|
-
onMutationFailed(callback: (event: MutationFailedEvent) => void): void;
|
|
61
|
-
on<T extends VirtualdisplayUiEventType>(type: T, callback: (event: VirtualdisplayUiEventMap[T]) => void): void;
|
|
62
|
-
get annotations(): Annotations;
|
|
63
|
-
get camera(): Camera;
|
|
64
|
-
get focus(): Focus;
|
|
65
|
-
get configuration(): Configuration;
|
|
66
|
-
get cameraPosition(): CameraPosition;
|
|
67
|
-
get snapshot(): Snapshot;
|
|
68
|
-
get viewerSettings(): ViewerSettings;
|
|
69
|
-
destroy(): void;
|
|
70
|
-
}
|
|
71
|
-
//# sourceMappingURL=client.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/client/client.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAE/C,OAAO,KAAK,EAAE,mBAAmB,EAAE,wBAAwB,EAAE,yBAAyB,EAAE,MAAM,SAAS,CAAC;AACxG,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAEzD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAEnD,OAAO,EAAE,KAAK,EAAmB,MAAM,UAAU,CAAC;AAClD,OAAO,EAAE,aAAa,EAA2D,MAAM,kBAAkB,CAAC;AAC1G,OAAO,EAaL,KAAK,cAAc,EACpB,MAAM,8BAA8B,CAAC;AACtC,OAAO,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PARENT_NOT_FOUND: "PARENT_NOT_FOUND";
|
|
9
|
-
readonly INVALID_PARAMETER: "INVALID_PARAMETER";
|
|
10
|
-
readonly SNAPSHOT_FAILED: "SNAPSHOT_FAILED";
|
|
11
|
-
};
|
|
12
|
-
export type ErrorCode = typeof ERROR_CODES[keyof typeof ERROR_CODES];
|
|
13
|
-
/**
|
|
14
|
-
* Custom error class for Virtualdisplay client errors
|
|
15
|
-
*/
|
|
16
|
-
export declare class VirtualdisplayError extends Error {
|
|
17
|
-
readonly code: ErrorCode;
|
|
18
|
-
constructor(message: string, code: ErrorCode);
|
|
19
|
-
static valueNotFound(attributeName: string, valueName: string): VirtualdisplayError;
|
|
20
|
-
static parentNotFound(selector: string): VirtualdisplayError;
|
|
21
|
-
static invalidParameter(reason: string): VirtualdisplayError;
|
|
22
|
-
}
|
|
23
|
-
//# sourceMappingURL=error.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../../src/client/error.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,WAAW;;;;;;;CAOd,CAAC;AAEX,MAAM,MAAM,SAAS,GAAG,OAAO,WAAW,CAAC,MAAM,OAAO,WAAW,CAAC,CAAC;AAErE;;GAEG;AACH,qBAAa,mBAAoB,SAAQ,KAAK;IAC5C,SAAgB,IAAI,EAAE,SAAS,CAAC;gBAEpB,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS;WAM9B,aAAa,CAAC,aAAa,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,mBAAmB;WAO5E,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,mBAAmB;WAOrD,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,mBAAmB;CAGpE"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The Virtualdisplay client's DOM event names, in one registry.
|
|
3
|
-
*
|
|
4
|
-
* - `ui:*` events dispatch on the container (non-bubbling). They are the typed
|
|
5
|
-
* surface of `client.on(...)` — payloads in `VirtualdisplayUiEventMap` (./types).
|
|
6
|
-
* - `vd:*` events bubble into the customer's page, so a page can react with
|
|
7
|
-
* `addEventListener` without registering a client callback.
|
|
8
|
-
*/
|
|
9
|
-
export declare const VD_EVENTS: {
|
|
10
|
-
/** Attribute selection requested (cancelable). `detail`: `{ attribute, value }`. */
|
|
11
|
-
readonly SELECT: "ui:select";
|
|
12
|
-
/** Attribute selection applied. `detail`: `{ attribute, value }`. */
|
|
13
|
-
readonly SELECTED: "ui:selected";
|
|
14
|
-
/** Focus changed (bubbles). `detail`: `{ component, attributes }`, or `null` for the overview. */
|
|
15
|
-
readonly FOCUS_CHANGE: "vd:focus-change";
|
|
16
|
-
/** Resolved configuration changed (bubbles). `detail`: the resolved configuration, or `null` when nothing matches. */
|
|
17
|
-
readonly CONFIGURATION_CHANGE: "vd:configuration-change";
|
|
18
|
-
/** Configuration submitted (bubbles). `detail`: the resolved configuration handed to the host. */
|
|
19
|
-
readonly CONFIGURATION_SUBMIT: "vd:configuration-submit";
|
|
20
|
-
};
|
|
21
|
-
export type VdEvent = typeof VD_EVENTS[keyof typeof VD_EVENTS];
|
|
22
|
-
//# sourceMappingURL=events.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../../src/client/events.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,eAAO,MAAM,SAAS;IACpB,oFAAoF;;IAEpF,qEAAqE;;IAErE,kGAAkG;;IAElG,sHAAsH;;IAEtH,kGAAkG;;CAE1F,CAAC;AAEX,MAAM,MAAM,OAAO,GAAG,OAAO,SAAS,CAAC,MAAM,OAAO,SAAS,CAAC,CAAC"}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { ClientOptions } from './options';
|
|
2
|
-
export interface IframeResult {
|
|
3
|
-
container: HTMLElement;
|
|
4
|
-
iframe: HTMLIFrameElement;
|
|
5
|
-
}
|
|
6
|
-
/**
|
|
7
|
-
* Builds the container + iframe structure for Virtualdisplay.
|
|
8
|
-
*
|
|
9
|
-
* Creates a vd-container div inside the parent element, then places the
|
|
10
|
-
* iframe inside. UI overlays are layered on top of the iframe within the container.
|
|
11
|
-
*/
|
|
12
|
-
export declare class IframeBuilder {
|
|
13
|
-
private readonly defaultServer;
|
|
14
|
-
private readonly options;
|
|
15
|
-
constructor(options: ClientOptions);
|
|
16
|
-
/**
|
|
17
|
-
* Create container and iframe, attach to parent element
|
|
18
|
-
*/
|
|
19
|
-
create(): IframeResult;
|
|
20
|
-
private createContainer;
|
|
21
|
-
private createIframe;
|
|
22
|
-
private attachToParent;
|
|
23
|
-
private buildUrl;
|
|
24
|
-
private getServerUrl;
|
|
25
|
-
private getParentElement;
|
|
26
|
-
}
|
|
27
|
-
//# sourceMappingURL=iframe-builder.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"iframe-builder.d.ts","sourceRoot":"","sources":["../../../src/client/iframe-builder.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAE/C,MAAM,WAAW,YAAY;IAC3B,SAAS,EAAE,WAAW,CAAC;IACvB,MAAM,EAAE,iBAAiB,CAAC;CAC3B;AAED;;;;;GAKG;AACH,qBAAa,aAAa;IACxB,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAsC;IAEpE,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAgB;gBAE5B,OAAO,EAAE,aAAa;IAIlC;;OAEG;IACI,MAAM,IAAI,YAAY;IAS7B,OAAO,CAAC,eAAe;IAcvB,OAAO,CAAC,YAAY;IAgBpB,OAAO,CAAC,cAAc;IAKtB,OAAO,CAAC,QAAQ;IAsBhB,OAAO,CAAC,YAAY;IAQpB,OAAO,CAAC,gBAAgB;CAYzB"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { ViewerSettings } from '@virtualdisplay.io/messaging';
|
|
2
|
-
/**
|
|
3
|
-
* Configuration options for VirtualdisplayClient
|
|
4
|
-
*/
|
|
5
|
-
export interface ClientOptions {
|
|
6
|
-
readonly parent: string | HTMLElement;
|
|
7
|
-
readonly model: string;
|
|
8
|
-
readonly license: string;
|
|
9
|
-
readonly debug?: boolean;
|
|
10
|
-
readonly language?: string;
|
|
11
|
-
/** W3C traceparent string to propagate to the viewer iframe for end-to-end tracing. */
|
|
12
|
-
readonly traceparent?: string;
|
|
13
|
-
/**
|
|
14
|
-
* Override viewer settings from metadata. Omitted fields use the metadata value.
|
|
15
|
-
* A warning is logged when an override differs from the metadata value.
|
|
16
|
-
*/
|
|
17
|
-
readonly viewerSettings?: Partial<ViewerSettings>;
|
|
18
|
-
}
|
|
19
|
-
//# sourceMappingURL=options.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../../src/client/options.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAEnE;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,WAAW,CAAC;IACtC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,uFAAuF;IACvF,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B;;;OAGG;IACH,QAAQ,CAAC,cAAc,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,CAAC;CACnD"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Tracks when the client is ready for use.
|
|
3
|
-
* Ready fires when the server sends the MAPPING message.
|
|
4
|
-
*/
|
|
5
|
-
export declare class ReadyStateTracker {
|
|
6
|
-
private ready;
|
|
7
|
-
private readonly onReady;
|
|
8
|
-
constructor(onReady?: () => void);
|
|
9
|
-
handleMappingReceived(): void;
|
|
10
|
-
get isReady(): boolean;
|
|
11
|
-
clear(): void;
|
|
12
|
-
}
|
|
13
|
-
//# sourceMappingURL=ready-state-tracker.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ready-state-tracker.d.ts","sourceRoot":"","sources":["../../../src/client/ready-state-tracker.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,KAAK,CAAS;IAEtB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA2B;gBAEvC,OAAO,CAAC,EAAE,MAAM,IAAI;IAIzB,qBAAqB,IAAI,IAAI;IAOpC,IAAW,OAAO,IAAI,OAAO,CAE5B;IAEM,KAAK,IAAI,IAAI;CAGrB"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { VD_EVENTS } from './events';
|
|
2
|
-
export interface MutationFailedEvent {
|
|
3
|
-
readonly attribute: string;
|
|
4
|
-
readonly value: string;
|
|
5
|
-
}
|
|
6
|
-
export interface VirtualdisplaySelectEvent {
|
|
7
|
-
readonly attribute: string;
|
|
8
|
-
readonly value: string;
|
|
9
|
-
preventDefault(): void;
|
|
10
|
-
}
|
|
11
|
-
export interface VirtualdisplaySelectedEvent {
|
|
12
|
-
readonly attribute: string;
|
|
13
|
-
readonly value: string;
|
|
14
|
-
}
|
|
15
|
-
export type VirtualdisplayUiEventMap = {
|
|
16
|
-
[VD_EVENTS.SELECT]: VirtualdisplaySelectEvent;
|
|
17
|
-
[VD_EVENTS.SELECTED]: VirtualdisplaySelectedEvent;
|
|
18
|
-
};
|
|
19
|
-
export type VirtualdisplayUiEventType = keyof VirtualdisplayUiEventMap;
|
|
20
|
-
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/client/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAErC,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,yBAAyB;IACxC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,cAAc,IAAI,IAAI,CAAC;CACxB;AAED,MAAM,WAAW,2BAA2B;IAC1C,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,MAAM,wBAAwB,GAAG;IACrC,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,yBAAyB,CAAC;IAC9C,CAAC,SAAS,CAAC,QAAQ,CAAC,EAAE,2BAA2B,CAAC;CACnD,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG,MAAM,wBAAwB,CAAC"}
|
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
import { Selection } from './resolver';
|
|
2
|
-
import { PricingDocument } from '@virtualdisplay.io/messaging';
|
|
3
|
-
/**
|
|
4
|
-
* The buyer's current configuration once it resolves to a price. `availability`
|
|
5
|
-
* is `available` (price + submit) or `view_only` (price, no submit); a matched
|
|
6
|
-
* `hidden` rule and a no-match both surface as `undefined` instead.
|
|
7
|
-
*/
|
|
8
|
-
export interface ResolvedConfiguration {
|
|
9
|
-
readonly attributes: Record<string, string>;
|
|
10
|
-
readonly reference: string;
|
|
11
|
-
/** Price in minor units (cents), exactly as the source displays it. */
|
|
12
|
-
readonly price: number;
|
|
13
|
-
readonly currency: string;
|
|
14
|
-
readonly availability: 'available' | 'view_only';
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* What submit hands to the host: the buyer's selection and the reference to act
|
|
18
|
-
* on. Deliberately carries no price — the shop's checkout price is binding and
|
|
19
|
-
* ours is display-only, so handing it into the cart hand-off would only invite a
|
|
20
|
-
* wrong-price error. Price stays on the display side (`current`, `onChange`).
|
|
21
|
-
*/
|
|
22
|
-
export interface SubmittedConfiguration {
|
|
23
|
-
readonly attributes: Record<string, string>;
|
|
24
|
-
readonly reference: string;
|
|
25
|
-
}
|
|
26
|
-
type ChangeCallback = (configuration: ResolvedConfiguration | undefined) => void;
|
|
27
|
-
type SubmitCallback = (configuration: SubmittedConfiguration) => void | Promise<unknown>;
|
|
28
|
-
type Dispatch<T> = (detail: T) => void;
|
|
29
|
-
/** Options for {@link Configuration.onSubmit}. */
|
|
30
|
-
export interface SubmitOptions {
|
|
31
|
-
/** Fallback button label when the customer authored none (the adapter brings it). */
|
|
32
|
-
readonly defaultLabel?: string;
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Configuration API — resolves the buyer's selection to a reference + price and
|
|
36
|
-
* carries it to the host page.
|
|
37
|
-
*
|
|
38
|
-
* Follows the existing facade style (`client.camera`, `client.focus`). It holds
|
|
39
|
-
* the pricing document and the latest selection, re-resolving on every change.
|
|
40
|
-
* `onChange` fires with the resolved configuration (or `undefined` when nothing
|
|
41
|
-
* matches); alongside it the container dispatches a bubbling `vd:configuration-change`
|
|
42
|
-
* CustomEvent so a page reacts without registering a callback. `onSubmit` registers
|
|
43
|
-
* the host handler that the CTA hands the configuration to.
|
|
44
|
-
*/
|
|
45
|
-
export declare class Configuration {
|
|
46
|
-
private readonly dispatchChange;
|
|
47
|
-
private readonly dispatchSubmit;
|
|
48
|
-
private pricing;
|
|
49
|
-
private selection;
|
|
50
|
-
private resolved;
|
|
51
|
-
private readonly changeCallbacks;
|
|
52
|
-
private readonly renderCallbacks;
|
|
53
|
-
private submitCallback;
|
|
54
|
-
private submitDefaultLabel;
|
|
55
|
-
constructor(dispatchChange: Dispatch<ResolvedConfiguration | undefined>, dispatchSubmit: Dispatch<SubmittedConfiguration>);
|
|
56
|
-
/** The resolved configuration, or undefined when nothing matches. */
|
|
57
|
-
get current(): ResolvedConfiguration | undefined;
|
|
58
|
-
/** The VAT label for bare embeds (e.g. "incl. btw"), or undefined without pricing. */
|
|
59
|
-
get vatDisplay(): string | undefined;
|
|
60
|
-
/**
|
|
61
|
-
* The CTA label: the customer's `button_label`, or the adapter's `defaultLabel`
|
|
62
|
-
* when that is empty. Undefined when neither is set — a button must know what
|
|
63
|
-
* it says, so the CTA does not render.
|
|
64
|
-
*/
|
|
65
|
-
get buttonLabel(): string | undefined;
|
|
66
|
-
/**
|
|
67
|
-
* Whether the current configuration may be submitted: a handler is registered
|
|
68
|
-
* and the configuration is either price-less or an `available` priced one. The
|
|
69
|
-
* CTA's visibility ({@link submitEnabled}) layers a label requirement on top of
|
|
70
|
-
* this; a programmatic `submit()` does not need a label.
|
|
71
|
-
*/
|
|
72
|
-
private get submittable();
|
|
73
|
-
/**
|
|
74
|
-
* Whether the CTA should render: the configuration is submittable and a label
|
|
75
|
-
* exists. A button must say something, so an empty label hides the CTA rather
|
|
76
|
-
* than rendering blank.
|
|
77
|
-
*/
|
|
78
|
-
get submitEnabled(): boolean;
|
|
79
|
-
/**
|
|
80
|
-
* Subscribe to configuration changes. Fires after every selection change with
|
|
81
|
-
* the resolved configuration, including undefined when nothing matches.
|
|
82
|
-
*/
|
|
83
|
-
onChange(callback: ChangeCallback): void;
|
|
84
|
-
/**
|
|
85
|
-
* Register the submit handler the CTA hands the configuration to. Registering
|
|
86
|
-
* one is what switches the button on (capability driven). `defaultLabel` fills
|
|
87
|
-
* in when the customer authored no button label.
|
|
88
|
-
*/
|
|
89
|
-
onSubmit(callback: SubmitCallback, options?: SubmitOptions): void;
|
|
90
|
-
/**
|
|
91
|
-
* Subscribe the built-in UI to re-render the price + CTA. Fires on every
|
|
92
|
-
* resolve and when a submit handler is registered (which can switch the button
|
|
93
|
-
* on without a configuration change). Separate from `onChange`, which stays the
|
|
94
|
-
* host-facing, mutation-driven contract. Returns a disposer.
|
|
95
|
-
*/
|
|
96
|
-
onRender(callback: () => void): () => void;
|
|
97
|
-
/**
|
|
98
|
-
* Hand the current configuration to the registered handler and fire the
|
|
99
|
-
* bubbling `vd:configuration-submit` event. No-op without a handler or a
|
|
100
|
-
* resolved configuration. Returns the handler's promise so the caller can
|
|
101
|
-
* reflect the result (bezig / gelukt / mislukt).
|
|
102
|
-
*/
|
|
103
|
-
submit(): Promise<void>;
|
|
104
|
-
/** Called by the client when a PRICING message arrives from the viewer. */
|
|
105
|
-
handlePricingReceived(pricing: PricingDocument): void;
|
|
106
|
-
/** Called by the client after every mutation result, with the full selection. */
|
|
107
|
-
handleSelectionChanged(selection: Selection): void;
|
|
108
|
-
private recompute;
|
|
109
|
-
private notifyRender;
|
|
110
|
-
private resolve;
|
|
111
|
-
}
|
|
112
|
-
export {};
|
|
113
|
-
//# sourceMappingURL=configuration.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"configuration.d.ts","sourceRoot":"","sources":["../../../src/configuration/configuration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,KAAK,SAAS,EAAE,MAAM,YAAY,CAAC;AACzD,OAAO,EAAgB,KAAK,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAElF;;;;GAIG;AACH,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC5C,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,uEAAuE;IACvE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,YAAY,EAAE,WAAW,GAAG,WAAW,CAAC;CAClD;AAED;;;;;GAKG;AACH,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,UAAU,EAAE,MAAM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G;IACI,QAAQ,CAAC,QAAQ,EAAE,cAAc,GAAG,IAAI;IAI/C;;;;OAIG;IACI,QAAQ,CAAC,QAAQ,EAAE,cAAc,EAAE,OAAO,CAAC,EAAE,aAAa,GAAG,IAAI;IAMxE;;;;;OAKG;IACI,QAAQ,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,MAAM,IAAI;IAQjD;;;;;OAKG;IACU,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;IAmBpC,2EAA2E;IACpE,qBAAqB,CAAC,OAAO,EAAE,eAAe,GAAG,IAAI;IAK5D,iFAAiF;IAC1E,sBAAsB,CAAC,SAAS,EAAE,SAAS,GAAG,IAAI;IAKzD,OAAO,CAAC,SAAS;IASjB,OAAO,CAAC,YAAY;IAMpB,OAAO,CAAC,OAAO;CAkBhB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/configuration/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,KAAK,qBAAqB,EAC1B,KAAK,sBAAsB,EAC3B,KAAK,aAAa,GACnB,MAAM,iBAAiB,CAAC"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { PricingRule } from '@virtualdisplay.io/messaging';
|
|
2
|
-
/** The buyer's current configuration as attribute name→value pairs. */
|
|
3
|
-
export type Selection = Record<string, string>;
|
|
4
|
-
/**
|
|
5
|
-
* Find the rule that prices the current selection.
|
|
6
|
-
*
|
|
7
|
-
* Matching is subset-based, most-specific wins: a rule matches when every
|
|
8
|
-
* attribute value it names equals the selection, and the rule naming the most
|
|
9
|
-
* attributes is chosen. Returns undefined when nothing matches, or when two
|
|
10
|
-
* rules tie as the most specific match — the latter is rejected at save time,
|
|
11
|
-
* so a runtime tie is fail-safe handled as "no price" rather than a wrong one.
|
|
12
|
-
*
|
|
13
|
-
* Pure and dependency-free: the viewer bundle is size-critical.
|
|
14
|
-
*/
|
|
15
|
-
export declare function resolveRule(rules: PricingRule[], selection: Selection): PricingRule | undefined;
|
|
16
|
-
//# sourceMappingURL=resolver.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"resolver.d.ts","sourceRoot":"","sources":["../../../src/configuration/resolver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAEhE,uEAAuE;AACvE,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAE/C;;;;;;;;;;GAUG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,WAAW,EAAE,EAAE,SAAS,EAAE,SAAS,GAAG,WAAW,GAAG,SAAS,CAU/F"}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { FocusStateMessage, MessageCallback } from '@virtualdisplay.io/messaging';
|
|
2
|
-
/** The focus state reported to `onChange` and the `vd:focus-change` event. */
|
|
3
|
-
export interface FocusState {
|
|
4
|
-
readonly component: string;
|
|
5
|
-
readonly attributes: string[];
|
|
6
|
-
}
|
|
7
|
-
type FocusChange = FocusState | null;
|
|
8
|
-
type FocusChangeCallback = (state: FocusChange) => void;
|
|
9
|
-
type DispatchFn = (state: FocusChange) => void;
|
|
10
|
-
/**
|
|
11
|
-
* Focus control API — isolate and frame a component, or return to overview.
|
|
12
|
-
*
|
|
13
|
-
* Programmatic by design: `set('Seat')` needs no user selection, which is how the
|
|
14
|
-
* (future) component menu and the portal/admin editors drive it over the same
|
|
15
|
-
* message bus. Alongside `onChange`, the container dispatches a bubbling
|
|
16
|
-
* `vd:focus-change` CustomEvent so a page can react without registering a callback.
|
|
17
|
-
*/
|
|
18
|
-
export declare class Focus {
|
|
19
|
-
private readonly send;
|
|
20
|
-
private readonly dispatch;
|
|
21
|
-
private focused;
|
|
22
|
-
private attributes;
|
|
23
|
-
private readonly changeCallbacks;
|
|
24
|
-
constructor(send: MessageCallback, dispatch: DispatchFn);
|
|
25
|
-
/** The focused component name, or null in overview. */
|
|
26
|
-
get current(): string | null;
|
|
27
|
-
/**
|
|
28
|
-
* Focus a component by name. Sends a focus message to the viewer.
|
|
29
|
-
* @throws VirtualdisplayError if component is not a non-empty string
|
|
30
|
-
*/
|
|
31
|
-
set(component: string): void;
|
|
32
|
-
/** Return to the overview — unfocus the current component. */
|
|
33
|
-
clear(): void;
|
|
34
|
-
/**
|
|
35
|
-
* Subscribe to focus changes. The callback fires with the focus state when a
|
|
36
|
-
* component is focused, and with null when returning to overview.
|
|
37
|
-
*/
|
|
38
|
-
onChange(callback: FocusChangeCallback): void;
|
|
39
|
-
/** Called by the client when a FocusStateMessage is received from the viewer. */
|
|
40
|
-
handleStateReceived(message: FocusStateMessage): void;
|
|
41
|
-
}
|
|
42
|
-
export {};
|
|
43
|
-
//# sourceMappingURL=focus.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"focus.d.ts","sourceRoot":"","sources":["../../../src/focus/focus.ts"],"names":[],"mappings":"AACA,OAAO,EAIL,KAAK,iBAAiB,EACtB,KAAK,eAAe,EACrB,MAAM,8BAA8B,CAAC;AAEtC,8EAA8E;AAC9E,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,UAAU,EAAE,MAAM,EAAE,CAAC;CAC/B;AAED,KAAK,WAAW,GAAG,UAAU,GAAG,IAAI,CAAC;AACrC,KAAK,mBAAmB,GAAG,CAAC,KAAK,EAAE,WAAW,KAAK,IAAI,CAAC;AACxD,KAAK,UAAU,GAAG,CAAC,KAAK,EAAE,WAAW,KAAK,IAAI,CAAC;AAE/C;;;;;;;GAOG;AACH,qBAAa,KAAK;IAMd,OAAO,CAAC,QAAQ,CAAC,IAAI;IACrB,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAN3B,OAAO,CAAC,OAAO,CAAuB;IACtC,OAAO,CAAC,UAAU,CAAgB;IAClC,OAAO,CAAC,QAAQ,CAAC,eAAe,CAA6B;gBAG1C,IAAI,EAAE,eAAe,EACrB,QAAQ,EAAE,UAAU;IAGvC,uDAAuD;IACvD,IAAW,OAAO,IAAI,MAAM,GAAG,IAAI,CAElC;IAED;;;OAGG;IACI,GAAG,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI;IAUnC,8DAA8D;IACvD,KAAK,IAAI,IAAI;IAIpB;;;OAGG;IACI,QAAQ,CAAC,QAAQ,EAAE,mBAAmB,GAAG,IAAI;IAIpD,iFAAiF;IAC1E,mBAAmB,CAAC,OAAO,EAAE,iBAAiB,GAAG,IAAI;CAkB7D"}
|