@smarterplan/ngx-smarterplan-core 1.4.15 → 1.4.16

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 (102) hide show
  1. package/README.md +24 -24
  2. package/esm2022/lib/components/csv-export/csv-export.component.mjs +3 -3
  3. package/esm2022/lib/components/loader/loader.component.mjs +3 -3
  4. package/esm2022/lib/components/menu-bar/avatar/avatar.component.mjs +1 -1
  5. package/esm2022/lib/components/menu-bar/menu-bar.component.mjs +3 -3
  6. package/esm2022/lib/components/menu-bar/navigation-bar/navigation-bar.component.mjs +3 -3
  7. package/esm2022/lib/components/modal-switch-visit/modal-switch-visit.component.mjs +3 -3
  8. package/esm2022/lib/components/search-bar/search-bar.component.mjs +3 -3
  9. package/esm2022/lib/components/support-modal/support-modal.component.mjs +3 -3
  10. package/esm2022/lib/config.mjs +1 -1
  11. package/esm2022/lib/helpers.service.mjs +46 -1
  12. package/esm2022/lib/matterport-extensions/nest-thermostat/CanvasImage.mjs +1 -1
  13. package/esm2022/lib/matterport-extensions/nest-thermostat/CanvasRenderer.mjs +1 -1
  14. package/esm2022/lib/matterport-extensions/nest-thermostat/NestThermostat.mjs +1 -1
  15. package/esm2022/lib/matterport-extensions/nest-thermostat/PlaneRenderer.mjs +1 -1
  16. package/esm2022/lib/matterport-extensions/scene-component/SceneComponent.mjs +1 -1
  17. package/esm2022/lib/matterport-extensions/security-camera/SecurityCamera.mjs +22 -22
  18. package/esm2022/lib/matterport-extensions/tv-player/TvPlayer.mjs +1 -1
  19. package/esm2022/lib/matterport-extensions/view-frustum-mesh/ViewFrustumMesh.mjs +22 -22
  20. package/esm2022/lib/mattertagData.mjs +1 -1
  21. package/esm2022/lib/ngx-smarterplan-core.module.mjs +1 -1
  22. package/esm2022/lib/ngx-smarterplan-core.service.mjs +1 -1
  23. package/esm2022/lib/pipes/duration-to-string.pipe.mjs +1 -1
  24. package/esm2022/lib/pipes/format-date-number-to-digits.pipe.mjs +1 -1
  25. package/esm2022/lib/pipes/hashtag-from-id.pipe.mjs +1 -1
  26. package/esm2022/lib/pipes/safe-url.pipe.mjs +1 -1
  27. package/esm2022/lib/pipes/time-date-to-local-string.pipe.mjs +1 -1
  28. package/esm2022/lib/pipes/username-from-id.pipe.mjs +1 -1
  29. package/esm2022/lib/services/amplify-cache.service.mjs +1 -1
  30. package/esm2022/lib/services/base-tab.service.mjs +1 -1
  31. package/esm2022/lib/services/baseVisibility.service.mjs +1 -1
  32. package/esm2022/lib/services/content.service.mjs +1 -1
  33. package/esm2022/lib/services/filter.service.mjs +1 -1
  34. package/esm2022/lib/services/intervention.service.mjs +1 -1
  35. package/esm2022/lib/services/locale.service.mjs +1 -1
  36. package/esm2022/lib/services/matterport-import.service.mjs +1 -1
  37. package/esm2022/lib/services/matterport-measurement.service.mjs +1 -1
  38. package/esm2022/lib/services/matterport-navigation.service.mjs +1 -1
  39. package/esm2022/lib/services/matterport-object3d.service.mjs +1 -1
  40. package/esm2022/lib/services/matterport-pointer.service.mjs +6 -6
  41. package/esm2022/lib/services/matterport-tag-copy.service.mjs +1 -1
  42. package/esm2022/lib/services/matterport-tag.service.mjs +1 -1
  43. package/esm2022/lib/services/matterport.service.mjs +17 -17
  44. package/esm2022/lib/services/models/affectation.service.mjs +1 -1
  45. package/esm2022/lib/services/models/base-object.service.mjs +1 -1
  46. package/esm2022/lib/services/models/capture.service.mjs +1 -1
  47. package/esm2022/lib/services/models/comment.service.mjs +1 -1
  48. package/esm2022/lib/services/models/domain.service.mjs +1 -1
  49. package/esm2022/lib/services/models/equipment.service.mjs +1 -1
  50. package/esm2022/lib/services/models/event.service.mjs +1 -1
  51. package/esm2022/lib/services/models/feature.service.mjs +1 -1
  52. package/esm2022/lib/services/models/hashtag.service.mjs +1 -1
  53. package/esm2022/lib/services/models/layer.service.mjs +1 -1
  54. package/esm2022/lib/services/models/measurement.service.mjs +1 -1
  55. package/esm2022/lib/services/models/mission.service.mjs +1 -1
  56. package/esm2022/lib/services/models/navigation.service.mjs +1 -1
  57. package/esm2022/lib/services/models/node.service.mjs +1 -1
  58. package/esm2022/lib/services/models/object3D.service.mjs +1 -1
  59. package/esm2022/lib/services/models/operation.service.mjs +1 -1
  60. package/esm2022/lib/services/models/organisation.service.mjs +1 -1
  61. package/esm2022/lib/services/models/plan.service.mjs +1 -1
  62. package/esm2022/lib/services/models/poi.service.mjs +27 -27
  63. package/esm2022/lib/services/models/profile.service.mjs +1 -1
  64. package/esm2022/lib/services/models/property.service.mjs +1 -1
  65. package/esm2022/lib/services/models/space.service.mjs +25 -6
  66. package/esm2022/lib/services/models/template.service.mjs +1 -1
  67. package/esm2022/lib/services/models/ticket.service.mjs +1 -1
  68. package/esm2022/lib/services/models/visit.service.mjs +17 -5
  69. package/esm2022/lib/services/models/zone.service.mjs +1 -1
  70. package/esm2022/lib/services/navigator.service.mjs +1 -1
  71. package/esm2022/lib/services/s3.service.mjs +18 -1
  72. package/esm2022/lib/services/search.service.mjs +1 -1
  73. package/esm2022/lib/services/support.service.mjs +1 -1
  74. package/esm2022/lib/services/tag.service.mjs +16 -16
  75. package/esm2022/lib/services/threejs-import.service.mjs +151 -0
  76. package/esm2022/lib/services/threejs.service.mjs +1306 -0
  77. package/esm2022/lib/services/user.service.mjs +1 -1
  78. package/esm2022/lib/services/utils/matterport-transform.util.mjs +1 -1
  79. package/esm2022/lib/services/validators.service.mjs +1 -1
  80. package/esm2022/lib/services/viewer.service.mjs +263 -5
  81. package/esm2022/lib/services/zone-drawer.service.mjs +1 -1
  82. package/esm2022/lib/services/zoneChange.service.mjs +1 -1
  83. package/esm2022/lib/tokens/matterport-sdk-key.token.mjs +1 -1
  84. package/esm2022/lib/types.service.mjs +2 -1
  85. package/esm2022/lib/validators/email.directive.mjs +1 -1
  86. package/esm2022/lib/validators/no-empty.directive.mjs +1 -1
  87. package/esm2022/lib/validators/number.directive.mjs +1 -1
  88. package/esm2022/lib/validators/text.directive.mjs +1 -1
  89. package/esm2022/public-api.mjs +3 -1
  90. package/fesm2022/smarterplan-ngx-smarterplan-core.mjs +2196 -402
  91. package/fesm2022/smarterplan-ngx-smarterplan-core.mjs.map +1 -1
  92. package/lib/helpers.service.d.ts +43 -0
  93. package/lib/services/models/space.service.d.ts +15 -1
  94. package/lib/services/models/visit.service.d.ts +9 -1
  95. package/lib/services/s3.service.d.ts +8 -0
  96. package/lib/services/threejs-import.service.d.ts +31 -0
  97. package/lib/services/threejs.service.d.ts +423 -0
  98. package/lib/services/viewer.service.d.ts +114 -1
  99. package/lib/types.service.d.ts +7 -1
  100. package/package.json +1 -1
  101. package/public-api.d.ts +2 -0
  102. package/src/assets/vs-app.json +67 -67
@@ -1,5 +1,6 @@
1
1
  import { Subject } from 'rxjs';
2
2
  import { MatterportService } from './matterport.service';
3
+ import { ThreeJsService } from './threejs.service';
3
4
  import { BaseTagService } from './tag.service';
4
5
  import { DbObjectType, POI, PoiType, Comment, Equipment, Ticket, Feature, SpModule } from '../types.service';
5
6
  import { PoiService } from './models/poi.service';
@@ -8,6 +9,7 @@ export declare class ViewerService {
8
9
  private readonly sdkKey;
9
10
  private poiService;
10
11
  private matterportService;
12
+ private threeJsService;
11
13
  private viewerMode;
12
14
  currentModel3D: string;
13
15
  private tourUrl;
@@ -50,7 +52,7 @@ export declare class ViewerService {
50
52
  };
51
53
  };
52
54
  private isObjectLoaded;
53
- constructor(sdkKey: string, poiService: PoiService, matterportService: MatterportService);
55
+ constructor(sdkKey: string, poiService: PoiService, matterportService: MatterportService, threeJsService: ThreeJsService);
54
56
  checkMode(indexMode: string): boolean;
55
57
  setMode(indexMode: string): void;
56
58
  setTourUrl(options: {
@@ -82,7 +84,55 @@ export declare class ViewerService {
82
84
  */
83
85
  addObjectTagsToViewer(objects: DbObjectType[]): Promise<void>;
84
86
  actionAddObjectFromPOI(object: DbObjectType, poi: POI): Promise<any>;
87
+ /**
88
+ * Draws a POI as a tag in the Three.js scene.
89
+ *
90
+ * Both viewers are fed by the same subscriptions on the same POI records, so a tag created in
91
+ * either one shows up in the other without any syncing of its own - this is just the Three.js end
92
+ * of the pipeline that already drives Matterport.
93
+ */
94
+ private addThreeJsTagFromPOI;
95
+ /** Moves the Three.js camera to frame a tag, mirroring Matterport's goToTag. */
96
+ goToThreeJsTag(elementId: string): void;
97
+ /** Shows only tags of the given POI types; null clears the filter. */
98
+ setVisibleThreeJsTagTypes(types: PoiType[] | null): void;
99
+ /**
100
+ * Alignment walkthrough: pick a tag, then click where it really sits, three times over.
101
+ *
102
+ * Uses tags that already exist, so nothing is created and nothing is written until the caller
103
+ * saves the result. See threeJsAlignmentProgress$ for what the UI should be asking for.
104
+ */
105
+ startThreeJsTagAlignment(): void;
106
+ cancelThreeJsTagAlignment(): void;
107
+ get threeJsAlignmentProgress$(): Subject<{
108
+ pairs: number;
109
+ awaiting: "tag" | "point";
110
+ tagId?: string;
111
+ }>;
112
+ /**
113
+ * Solves the alignment and applies it to the scene, returning it as the JSON to store in the
114
+ * capture's metadata. Null means the three tags were collinear and nothing was applied.
115
+ */
116
+ solveThreeJsTagAlignment(existingMetadata?: string): {
117
+ alignment: any;
118
+ metadata: string;
119
+ } | null;
120
+ /** Shows or hides a single Three.js tag. */
121
+ setThreeJsTagVisibility(elementId: string, visible: boolean): void;
85
122
  action_delete_element(element: DbObjectType): Promise<void>;
123
+ /** Emits when a Three.js model load actually stopped short, rather than merely being asked to. */
124
+ get threeJsModelLoadCancelled$(): Subject<void>;
125
+ /** Stops the Three.js model download in progress. */
126
+ cancelThreeJsModelLoad(): void;
127
+ /** Emits the element id of a tag clicked in the Three.js scene. */
128
+ get threeJsTagClicked$(): Subject<import("./threejs.service").ThreeJsTagClick>;
129
+ /**
130
+ * Applies the visit's stored tag alignment, mapping captured tag coordinates onto this model.
131
+ *
132
+ * Safe to call before the model or any tag exists: it is a transform on the group both end up
133
+ * under, so it applies to whatever arrives later.
134
+ */
135
+ setThreeJsTagAlignmentFromMetadata(metadata: string): void;
86
136
  /**
87
137
  * Enable tag placement menu to add a new element depending on its type (TICKET, DATA, EQUIPMENT etc)
88
138
  */
@@ -104,6 +154,17 @@ export declare class ViewerService {
104
154
  action_toolbox_mesure(): void;
105
155
  action_toolbox_cancel_mesure(): void;
106
156
  action_update_poi(poi: POI, isValid: boolean, element: DbObjectType): Promise<POI>;
157
+ /**
158
+ * Writes the spot picked in the Three.js scene into the POI, mirroring the Matterport branch.
159
+ *
160
+ * The coordinate goes in the same field and the same space Matterport writes, which is what makes
161
+ * a tag created here show up in the right place there - and the other way round.
162
+ */
163
+ private commitThreeJsTagPlacement;
164
+ /** Emits when a tag is dropped on the model in the Three.js scene. */
165
+ get threeJsTagPlaced$(): Subject<import("./threejs.service").ThreeJsTagPlacement>;
166
+ /** Leaves Three.js tag placement mode without placing anything. */
167
+ cancelThreeJsTagPlacement(): void;
107
168
  editOnlyTagStyleForPoi(poi: POI, object: DbObjectType): void;
108
169
  addIconAndSetForPoi(poi: POI, iconPath: string): void;
109
170
  changeToRegistredIconForPoi(poi: POI, iconName: string): void;
@@ -114,6 +175,58 @@ export declare class ViewerService {
114
175
  * @param element
115
176
  */
116
177
  action_move_poi_visually(poi: POI, element: Ticket | Feature | Equipment | Comment): Promise<void>;
178
+ initThreeJs(canvas: HTMLCanvasElement): void;
179
+ /**
180
+ * Loads a 3D model into the Three.js scene (GLTF).
181
+ * Only works when the viewer is in 'threejs' mode.
182
+ */
183
+ loadGLTFModel(url: string, cameraPosition?: {
184
+ x: number;
185
+ y: number;
186
+ z: number;
187
+ }, rotation?: {
188
+ x: number;
189
+ y: number;
190
+ z: number;
191
+ }): void;
192
+ /**
193
+ * Loads a GLB stored in S3, given its key (e.g. `visits/<id>/model.glb`).
194
+ *
195
+ * Resolves the key to a signed URL first, then loads it like any other. The signed URL only
196
+ * covers authentication - the bucket still needs a CORS rule allowing GET from the app's origin,
197
+ * or the browser blocks the download before it starts.
198
+ *
199
+ * `placementMetadata` is the capture's stored placement; when absent or unusable the viewer falls
200
+ * back to framing the model automatically.
201
+ */
202
+ loadGLTFModelFromS3(key: string, placementMetadata?: string): Promise<void>;
203
+ /**
204
+ * Loads a 3D model into the Three.js scene (OBJ).
205
+ */
206
+ loadObjModel(mtlUrl: string, objUrl: string, cameraPosition?: {
207
+ x: number;
208
+ y: number;
209
+ z: number;
210
+ }, rotation?: {
211
+ x: number;
212
+ y: number;
213
+ z: number;
214
+ }): void;
215
+ get threeJsObjectHovered$(): Subject<{
216
+ id: string;
217
+ event: MouseEvent;
218
+ }>;
219
+ get threeJsObjectClicked$(): Subject<string>;
220
+ /** Emits true while a heavy .obj file is being parsed (in a worker, when available), false once done. */
221
+ get threeJsModelLoading$(): Subject<boolean>;
222
+ /** Download progress for GLB models as a 0-1 fraction, or null when the size isn't known upfront. */
223
+ get threeJsModelLoadProgress$(): Subject<number>;
224
+ /**
225
+ * Registers the Web Worker used to parse heavy .obj files off the main thread.
226
+ * Must be created by the app (see obj-parser.worker.ts), since this library can't bundle worker files.
227
+ */
228
+ setObjParserWorker(worker: Worker): void;
229
+ addThreeJsObjects(objs: any[]): void;
117
230
  initMatterportSdk(spaceID: string, model3D: string, tagService: BaseTagService, module?: SpModule): Promise<void>;
118
231
  removeForbiddenSweeps(forbiddenSweeps: string[]): void;
119
232
  setObject3DLoadedInPosition(objectLoaded: boolean): void;
@@ -127,7 +127,8 @@ export declare enum EmailStatus {
127
127
  export declare enum CaptureViewer {
128
128
  CUPIX = "CUPIX",
129
129
  MATTERPORT = "MATTERPORT",
130
- SMARTERPLAN_V1 = "SMARTERPLAN_V1"
130
+ SMARTERPLAN_V1 = "SMARTERPLAN_V1",
131
+ THREEJS = "THREEJS"
131
132
  }
132
133
  export declare enum InventoryStatus {
133
134
  SUCCESS = "SUCCESS",
@@ -595,6 +596,11 @@ export type Visit = {
595
596
  node: Node;
596
597
  name?: string | null;
597
598
  nmbImagesImported: number;
599
+ /**
600
+ * Free-form metadata from the capture. Named after its source to keep it distinct from `name`,
601
+ * which comes from node.metadata. Three.js visits store their initial placement here.
602
+ */
603
+ captureMetadata?: string | null;
598
604
  };
599
605
  export type Hashtag = {
600
606
  name?: string | null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smarterplan/ngx-smarterplan-core",
3
- "version": "1.4.15",
3
+ "version": "1.4.16",
4
4
  "dependencies": {
5
5
  "tslib": "^2.5.0"
6
6
  },
package/public-api.d.ts CHANGED
@@ -6,6 +6,7 @@ export * from './lib/services/tag.service';
6
6
  export * from './lib/services/baseVisibility.service';
7
7
  export * from './lib/services/content.service';
8
8
  export * from './lib/services/viewer.service';
9
+ export * from './lib/services/threejs.service';
9
10
  export * from './lib/services/navigator.service';
10
11
  export * from './lib/services/zoneChange.service';
11
12
  export * from './lib/config';
@@ -18,6 +19,7 @@ export * from './lib/services/filter.service';
18
19
  export * from './lib/services/search.service';
19
20
  export * from './lib/services/zone-drawer.service';
20
21
  export * from './lib/services/matterport-import.service';
22
+ export * from './lib/services/threejs-import.service';
21
23
  export * from './lib/services/matterport-tag-copy.service';
22
24
  export * from './lib/mattertagData';
23
25
  export * from './lib/services/utils/matterport-transform.util';
@@ -1,67 +1,67 @@
1
- {
2
- "version": "1.0",
3
- "payload": {
4
- "objects": [
5
- {
6
- "name": "slot_camera",
7
- "position": {
8
- "x": 2.8,
9
- "y": 2.4,
10
- "z": 10.71
11
- },
12
- "rotation": {
13
- "x": 0,
14
- "y": -22,
15
- "z": 0
16
- },
17
- "scale": {
18
- "x": 1,
19
- "y": 1,
20
- "z": 1
21
- },
22
- "components": [
23
- {
24
- "type": "mp.gltfLoader",
25
- "inputs": {
26
- "url": "https://static.matterport.com/showcase-sdk/examples/assets-1.0-2-g6b74572/assets/models/camera-1/scene.gltf",
27
- "localScale": { "x": 0.0008, "y": 0.0008, "z": 0.0008 },
28
- "localRotation": { "x": 0, "y": 90, "z": 0 }
29
- },
30
- "events": {
31
- "INTERACTION.CLICK": false,
32
- "INTERACTION.HOVER": false,
33
- "INTERACTION.DRAG": false
34
- }
35
- },
36
- {
37
- "type": "mp.securityCamera",
38
- "inputs": {
39
- "nearPlane": 0.1,
40
- "farPlane": 10,
41
- "horizontalFOV": 52,
42
- "aspect": 1.7777777777777777,
43
- "localPosition": {
44
- "x": 0,
45
- "y": 0.18,
46
- "z": -0.3
47
- },
48
- "localRotation": {
49
- "x": -15,
50
- "y": 0,
51
- "z": 0
52
- },
53
- "color": 65280,
54
- "panPeriod": 5,
55
- "panAngle": -45
56
- },
57
- "events": {
58
- "INTERACTION.CLICK": false,
59
- "INTERACTION.HOVER": false,
60
- "INTERACTION.DRAG": false
61
- }
62
- }
63
- ]
64
- }
65
- ]
66
- }
67
- }
1
+ {
2
+ "version": "1.0",
3
+ "payload": {
4
+ "objects": [
5
+ {
6
+ "name": "slot_camera",
7
+ "position": {
8
+ "x": 2.8,
9
+ "y": 2.4,
10
+ "z": 10.71
11
+ },
12
+ "rotation": {
13
+ "x": 0,
14
+ "y": -22,
15
+ "z": 0
16
+ },
17
+ "scale": {
18
+ "x": 1,
19
+ "y": 1,
20
+ "z": 1
21
+ },
22
+ "components": [
23
+ {
24
+ "type": "mp.gltfLoader",
25
+ "inputs": {
26
+ "url": "https://static.matterport.com/showcase-sdk/examples/assets-1.0-2-g6b74572/assets/models/camera-1/scene.gltf",
27
+ "localScale": { "x": 0.0008, "y": 0.0008, "z": 0.0008 },
28
+ "localRotation": { "x": 0, "y": 90, "z": 0 }
29
+ },
30
+ "events": {
31
+ "INTERACTION.CLICK": false,
32
+ "INTERACTION.HOVER": false,
33
+ "INTERACTION.DRAG": false
34
+ }
35
+ },
36
+ {
37
+ "type": "mp.securityCamera",
38
+ "inputs": {
39
+ "nearPlane": 0.1,
40
+ "farPlane": 10,
41
+ "horizontalFOV": 52,
42
+ "aspect": 1.7777777777777777,
43
+ "localPosition": {
44
+ "x": 0,
45
+ "y": 0.18,
46
+ "z": -0.3
47
+ },
48
+ "localRotation": {
49
+ "x": -15,
50
+ "y": 0,
51
+ "z": 0
52
+ },
53
+ "color": 65280,
54
+ "panPeriod": 5,
55
+ "panAngle": -45
56
+ },
57
+ "events": {
58
+ "INTERACTION.CLICK": false,
59
+ "INTERACTION.HOVER": false,
60
+ "INTERACTION.DRAG": false
61
+ }
62
+ }
63
+ ]
64
+ }
65
+ ]
66
+ }
67
+ }