@variantic/player 0.0.8 → 0.0.9

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.
@@ -1,7 +1,22 @@
1
1
  export interface ILibraryApi {
2
+ /**
3
+ * Returns the URL for the asset with the given ID for current library version.
4
+ */
2
5
  getAssetUrl(id: string): string;
6
+ /**
7
+ * Returns the thumbnail URL for the asset with the given ID for current library version.
8
+ */
3
9
  getAssetThumbnailUrl(id: string): string;
10
+ /**
11
+ * Retrieves the asset content by ID for current library version, or null if not found.
12
+ */
4
13
  getAssetById(id: string): Promise<Response | null>;
14
+ /**
15
+ * Retrieves the assembly data for current library version.
16
+ */
5
17
  getAssemblyData(): Promise<unknown>;
18
+ /**
19
+ * Retrieves the configuration data for current library version.
20
+ */
6
21
  getConfigurationData(): Promise<unknown>;
7
22
  }
@@ -5,10 +5,16 @@ import type { TWebComponentEvents } from "../../../events/src";
5
5
  */
6
6
  export type TARApi = {
7
7
  events: Emittery<TARApiEvents>;
8
+ /**
9
+ * Generates and uploads the current project for AR viewing, returning a QR image and URL.
10
+ */
8
11
  generateAndUpload(): Promise<{
9
12
  qrImage: string;
10
13
  url: string;
11
14
  }>;
15
+ /**
16
+ * Generates and returns the project data as a Blob for AR viewing.
17
+ */
12
18
  generate(): Promise<Blob>;
13
19
  };
14
20
  export type TARApiEvents = TWebComponentEvents<{
@@ -5,7 +5,13 @@ import type { TWebComponentEvents } from "../../../events/src";
5
5
  */
6
6
  export type TConfigurationApi = {
7
7
  events: Emittery<TConfigurationApiEvents>;
8
+ /**
9
+ * Generates and returns the current configuration content
10
+ */
8
11
  generate(): TConfigurationContent;
12
+ /**
13
+ * Generates and uploads the current configuration, returning a URL for later use.
14
+ */
9
15
  generateAndUpload(): Promise<TConfigurationUrl>;
10
16
  };
11
17
  export type TConfigurationApiEvents = TWebComponentEvents<{
@@ -6,8 +6,17 @@ export type TPrimitive = bigint | boolean | null | number | string | symbol | un
6
6
  */
7
7
  export type TDocumentationApi = {
8
8
  events: Emittery<TDocumentationApiEvents>;
9
+ /**
10
+ * Checks if documentation generation is available.
11
+ */
9
12
  getDocumentationAvailability(): boolean;
13
+ /**
14
+ * Generates the documentation PDF as a Blob using optional source data.
15
+ */
10
16
  generate(sourceData?: Record<string, TPrimitive>): Promise<Blob>;
17
+ /**
18
+ * Generates and triggers download of the documentation PDF using optional source data.
19
+ */
11
20
  generateAndDownload(sourceData?: Record<string, TPrimitive>): Promise<void>;
12
21
  };
13
22
  export type TDocumentationApiEvents = TWebComponentEvents<{
@@ -5,7 +5,13 @@ import type { TWebComponentEvents } from "../../../events/src";
5
5
  */
6
6
  export type TIntegrationConnectorApi = {
7
7
  events: Emittery<TIntegrationConnectorApiEvents>;
8
+ /**
9
+ * Executes a flow immediately with the given parameters and returns the response.
10
+ */
8
11
  execute: (params: TExecuteParams) => Promise<TExecutionResponse>;
12
+ /**
13
+ * Hooks specified flows by their IDs to the current project.
14
+ */
9
15
  hookFlowsByIds: (ids: string[]) => Promise<void>;
10
16
  };
11
17
  export type TIntegrationConnectorApiEvents = TWebComponentEvents<{
@@ -5,6 +5,9 @@ import type { TWebComponentEvents } from "../../../events/src";
5
5
  */
6
6
  export type TLayoutApi = {
7
7
  events: Emittery<TLayoutApiEvents>;
8
+ /**
9
+ * Enables or disables fullscreen mode based on the given state.
10
+ */
8
11
  toggleFullscreen: (state: boolean) => void;
9
12
  };
10
13
  export type TLayoutApiEvents = TWebComponentEvents;
@@ -14,9 +14,21 @@ import type { ILibraryApi } from "../../../../../../library-api/src";
14
14
  export type TPlayerApi = {
15
15
  events: Emittery<TPlayerApiEvents>;
16
16
  viewer: TViewerApi;
17
+ /**
18
+ * Returns the current site identifier as a string.
19
+ */
17
20
  getSiteId: () => string;
21
+ /**
22
+ * Returns the current library version as a string.
23
+ */
18
24
  getLibraryVersion: () => string;
25
+ /**
26
+ * Returns the current configuration ID, or null if none is set.
27
+ */
19
28
  getCurrentConfigurationId: () => string | null;
29
+ /**
30
+ * Asynchronously loads a configuration by ID; returns success status and optional error code.
31
+ */
20
32
  loadConfiguration: (id: string | null) => Promise<{
21
33
  result: boolean;
22
34
  error?: 'INVALID_CONFIGURATION_ID_OR_URL' | 'INVALID_CONFIGURATION' | 'COMPONENT_ID_MISMATCH' | 'LIBRARY_VERSION_MISMATCH';
@@ -5,8 +5,17 @@ import type { TWebComponentEvents } from "../../../events/src";
5
5
  */
6
6
  export type TSnapshotApi = {
7
7
  events: Emittery<TSnapshotApiEvents>;
8
+ /**
9
+ * Generates a snapshot of current view and returns it as a Blob.
10
+ */
8
11
  generate(): Promise<Blob>;
12
+ /**
13
+ * Generates and triggers download of a snapshot of current view.
14
+ */
9
15
  generateAndDownload(): Promise<void>;
16
+ /**
17
+ * Generates and uploads a snapshot of current view, returning its URL.
18
+ */
10
19
  generateAndUpload(): Promise<TSnapshotUrl>;
11
20
  };
12
21
  export type TSnapshotApiEvents = TWebComponentEvents<{
@@ -7,47 +7,143 @@ export type TViewerApi = {
7
7
  events: Emittery<TViewerApiEvents>;
8
8
  getPlayerInstance(): any;
9
9
  get isLoaded(): boolean;
10
+ /**
11
+ * Returns the current configuration formatted for rendering.
12
+ */
10
13
  getConfiguration(options?: TGetConfigurationParams): TConfiguration | null;
14
+ /**
15
+ * Returns the current price value.
16
+ */
11
17
  getPrice(): number;
18
+ /**
19
+ * Returns the current price formatted with the appropriate currency symbol.
20
+ */
12
21
  getPriceWithCurrency(): string | undefined;
22
+ /**
23
+ * Overrides the current price with the specified value.
24
+ *
25
+ * @param value value to replace price with
26
+ */
13
27
  setPrice(value: number | string): void;
28
+ /** @ignore */
14
29
  getScene(): any;
30
+ /** @ignore */
15
31
  getModel3D(): any;
32
+ /** @ignore */
16
33
  getModelContainer3D(): any;
34
+ /**
35
+ * Returns the WebGL canvas element.
36
+ */
17
37
  getCanvas(): HTMLCanvasElement;
38
+ /**
39
+ * Returns all available material groups.
40
+ */
18
41
  getMaterialGroups(): Promise<TMaterialGroup[]>;
42
+ /**
43
+ * Returns a mapping of group IDs to their selected material IDs.
44
+ */
19
45
  getSelectedMaterialByGroup(): {
20
46
  [key: number]: number;
21
47
  };
48
+ /**
49
+ * Returns the material definition for the specified material ID.
50
+ */
22
51
  getMaterialDataById(materialId: number): TMaterial;
52
+ /**
53
+ * Returns a list of materials matching the given filter ID, optionally grouped by the specified query ID.
54
+ */
23
55
  getMaterialsList(filterId: number, groupingQueryId?: number): Promise<TMaterialsList>;
56
+ /**
57
+ * Returns the current layout settings configuration.
58
+ */
24
59
  getLayoutSettings(): TLayoutSettings;
60
+ /**
61
+ * Assigns the specified material ID to the given group ID.
62
+ */
25
63
  assignMaterial(groupId: number, materialId: number): Promise<void>;
64
+ /**
65
+ * Changes the camera projection type to either orthographic or perspective.
66
+ */
26
67
  changeCameraType(type: 'orthographic' | 'perspective'): void;
68
+ /**
69
+ * Applies the specified camera settings.
70
+ */
27
71
  setCameraSettings(settings: TCameraSettings): void;
72
+ /**
73
+ * Moves the camera based on the provided parameters.
74
+ */
28
75
  moveCamera(params: TMoveCameraParams): Promise<void>;
76
+ /**
77
+ * Adjusts the camera to fit the current object within view.
78
+ */
29
79
  autoFitCamera(): Promise<void>;
80
+ /**
81
+ * Generates a bill of materials for the specified template ID and filter ID.
82
+ */
30
83
  generateBom({ templateId, filterId, }: {
31
84
  templateId: number;
32
85
  filterId: number;
33
86
  }): Promise<TBom>;
87
+ /**
88
+ * Returns the current floor settings.
89
+ */
34
90
  getSetFloorSettings(): TFloorSettings;
91
+ /**
92
+ * Returns the target unit for value transformation.
93
+ */
35
94
  getTargetUnit(): string;
95
+ /**
96
+ * Returns the list of available units.
97
+ */
36
98
  getUnits(): TUnit[];
99
+ /** @ignore */
37
100
  getDimensions(filter?: 'default' | 'defaultNotControlledByEvent'): any[];
101
+ /**
102
+ * Changes the current unit to the specified unit.
103
+ */
38
104
  changeUnit(unit: string): void;
105
+ /**
106
+ * Converts a value from millimeters to the current set target unit.
107
+ */
39
108
  convertFromMillimeters(value: number | string, baseUnit: string): number | string;
109
+ /**
110
+ * Returns the localized string for the given key
111
+ */
40
112
  translate(key: string): string;
113
+ /**
114
+ * Switches the interface view to either preview or edit mode.
115
+ */
41
116
  changeView(view: 'preview' | 'edit'): void;
117
+ /**
118
+ * Updates the parameter identified by the code with the specified value.
119
+ */
42
120
  changeParameter(code: string, value: string | number): void;
121
+ /**
122
+ * Normalizes the given value for a parameter, returning the value and its corresponding label.
123
+ */
43
124
  normalizeParameterValue(parameter: TParameter, value: string | number): {
44
125
  value: string | number;
45
126
  label: string;
46
127
  };
128
+ /**
129
+ * Enables all layers in the current context.
130
+ */
47
131
  enableAllLayers(): void;
132
+ /**
133
+ * Disables all layers in the current context.
134
+ */
48
135
  disableAllLayers(): void;
136
+ /**
137
+ * Enables the layer with the specified ID.
138
+ */
49
139
  enableLayer(id: number): void;
140
+ /**
141
+ * Disables the layer with the specified ID.
142
+ */
50
143
  disableLayer(id: number): void;
144
+ /**
145
+ * Toggles dimension visibility based on the state and optional dimension IDs or presets.
146
+ */
51
147
  toggleDimensions(state: boolean, dimensions?: number[] | 'default' | 'defaultNotControlledByEvent'): void;
52
148
  };
53
149
  export type TViewerApiEvents = TWebComponentEvents<{
@@ -81,10 +177,22 @@ export type TViewerApiEvents = TWebComponentEvents<{
81
177
  };
82
178
  }>;
83
179
  export type TGetConfigurationParams = {
180
+ /**
181
+ * Specifies whether to include hidden items
182
+ * @defaultValue `true`
183
+ */
84
184
  includeHidden?: boolean;
85
185
  };
86
186
  export type TMoveCameraParams = {
187
+ /**
188
+ * Target camera angle
189
+ * @defaultValue `default`
190
+ */
87
191
  angle?: TCameraAngle;
192
+ /**
193
+ * Whether to move with animation
194
+ * @defaultValue `true`
195
+ */
88
196
  animation?: boolean;
89
197
  };
90
198
  export type TCameraAngle = 'default' | '-x+z' | '+x+z' | '-x-z' | '+x-z' | '+z' | '-z' | '+y' | '-y' | '+x' | '-x';
@@ -225,6 +333,7 @@ export type TParameterNumberRange = TParameterBase<'number-range', {
225
333
  max: number;
226
334
  maxLabel: string;
227
335
  preferred?: number[];
336
+ step: number;
228
337
  }>;
229
338
  type TNumberPredefinedStyleSettings = {
230
339
  align?: 'content' | 'responsive';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@variantic/player",
3
- "version": "0.0.8",
3
+ "version": "0.0.9",
4
4
  "license": "MIT",
5
5
  "publishConfig": {
6
6
  "access": "public"