@smarterplan/ngx-smarterplan-core 1.4.23 → 1.4.25

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 (31) hide show
  1. package/esm2022/lib/components/csv-export/csv-export.component.mjs +3 -3
  2. package/esm2022/lib/components/inventory-runs/inventory-files.component.mjs +125 -0
  3. package/esm2022/lib/components/inventory-runs/inventory-runs.component.mjs +150 -0
  4. package/esm2022/lib/components/menu-bar/menu-bar.component.mjs +3 -3
  5. package/esm2022/lib/components/splat-viewer/splat-viewer.component.mjs +2 -2
  6. package/esm2022/lib/helpers.service.mjs +1 -1
  7. package/esm2022/lib/ngx-smarterplan-core.module.mjs +14 -4
  8. package/esm2022/lib/services/locale.service.mjs +3 -2
  9. package/esm2022/lib/services/matterport-import.service.mjs +4 -3
  10. package/esm2022/lib/services/models/inventory.service.mjs +252 -0
  11. package/esm2022/lib/services/zone-drawer.service.mjs +1 -1
  12. package/esm2022/lib/types.service.mjs +2 -1
  13. package/esm2022/public-api.mjs +4 -1
  14. package/fesm2022/smarterplan-ngx-smarterplan-core.mjs +540 -18
  15. package/fesm2022/smarterplan-ngx-smarterplan-core.mjs.map +1 -1
  16. package/lib/components/inventory-runs/inventory-files.component.d.ts +23 -0
  17. package/lib/components/inventory-runs/inventory-runs.component.d.ts +49 -0
  18. package/lib/components/splat-viewer/splat-viewer.component.d.ts +1 -1
  19. package/lib/ngx-smarterplan-core.module.d.ts +9 -7
  20. package/lib/services/models/inventory.service.d.ts +112 -0
  21. package/lib/types.service.d.ts +2 -1
  22. package/package.json +1 -1
  23. package/public-api.d.ts +3 -0
  24. package/src/assets/viewers/splat/{chunk-WZ5Z4TU3.js → chunk-EG4HD6E6.js} +2 -2
  25. package/src/assets/viewers/splat/{convert-4DRLH77X.js → convert-AJMRDWU6.js} +1 -1
  26. package/src/assets/viewers/splat/convert.html +1 -1
  27. package/src/assets/viewers/splat/{converter-SLBB5MHG.js → converter-UV7KH5KN.js} +1 -1
  28. package/src/assets/viewers/splat/index.html +1 -1
  29. package/src/assets/viewers/splat/{viewer-W4X3FWQJ.js → viewer-QLWW4L3N.js} +2 -2
  30. /package/src/assets/viewers/splat/{chunk-BYLI4YBI.js → chunk-KX25RBTZ.js} +0 -0
  31. /package/src/assets/viewers/splat/{spz-DEYRea_v-QE6YSGIB.js → spz-DEYRea_v-ZGM37WHQ.js} +0 -0
@@ -0,0 +1,23 @@
1
+ import { EventEmitter } from "@angular/core";
2
+ import { InventoryFiles } from "../../services/models/inventory.service";
3
+ import * as i0 from "@angular/core";
4
+ /**
5
+ * What a visit has of what its AI inventory needs (InventoryService.checkFiles), and where what is
6
+ * missing comes from, for the screens to show before launching one. The mesh, which nothing else
7
+ * puts in the bucket, can be sent from here: the .obj of the visit's MatterPak, as it is.
8
+ */
9
+ export declare class InventoryFilesComponent {
10
+ files: InventoryFiles;
11
+ /** Said when the visit gets a file from here: [(files)]. */
12
+ filesChange: EventEmitter<InventoryFiles>;
13
+ /** The visit's Matterport model, the folder of its files. */
14
+ model3D: string;
15
+ /** How much of the .obj is sent, from 0 to 100, while it is. */
16
+ uploadPercent: number;
17
+ uploadName: string;
18
+ /** Why the .obj was not sent, as a key to translate. */
19
+ uploadError: string;
20
+ onModelObjSelected(event: Event): Promise<void>;
21
+ static ɵfac: i0.ɵɵFactoryDeclaration<InventoryFilesComponent, never>;
22
+ static ɵcmp: i0.ɵɵComponentDeclaration<InventoryFilesComponent, "lib-inventory-files", never, { "files": { "alias": "files"; "required": false; }; "model3D": { "alias": "model3D"; "required": false; }; }, { "filesChange": "filesChange"; }, never, never, false, never>;
23
+ }
@@ -0,0 +1,49 @@
1
+ import { EventEmitter, OnChanges, OnDestroy } from "@angular/core";
2
+ import { InventoryRun, InventoryService } from "../../services/models/inventory.service";
3
+ import * as i0 from "@angular/core";
4
+ /**
5
+ * How the latest AI inventory of each visit goes, as its ECS task writes it on its record: the step
6
+ * it is at, the panoramas analysed and about how long the rest will take, then done with the
7
+ * equipment added, or failed and why. One running can be cancelled, and one stopped resumed from
8
+ * where it stopped. Looked at again every few seconds while one is running; refresh() after
9
+ * launching one.
10
+ */
11
+ export declare class InventoryRunsComponent implements OnChanges, OnDestroy {
12
+ inventoryService: InventoryService;
13
+ /** The space whose inventories to show. */
14
+ spaceID: string;
15
+ /** Only these visits' inventories; all of the space's when it is not given. */
16
+ nodeIDs: string[];
17
+ /** A name for each visit, by its id. */
18
+ labels: Record<string, string>;
19
+ /** Whether one of the inventories shown is running: said when it changes. */
20
+ runningChange: EventEmitter<boolean>;
21
+ runs: InventoryRun[];
22
+ /** The inventory whose cancelling waits for its confirmation. */
23
+ confirmingCancel: string;
24
+ /** The inventory being cancelled or resumed, its buttons disabled meanwhile. */
25
+ busy: string;
26
+ /** What went wrong, or why nothing was done, as a key to translate. */
27
+ message: string;
28
+ private running;
29
+ private poll;
30
+ /**
31
+ * Each inventory's panoramas done when it was first seen analysing them, and when: how fast
32
+ * it goes, for how long the rest will take.
33
+ */
34
+ private firstSeen;
35
+ constructor(inventoryService: InventoryService);
36
+ ngOnChanges(): void;
37
+ ngOnDestroy(): void;
38
+ refresh(): Promise<void>;
39
+ /**
40
+ * About how many minutes the panoramas left will take, at the pace seen since the inventory
41
+ * was first seen analysing them; null until a panorama has been done meanwhile.
42
+ */
43
+ minutesLeft(run: InventoryRun): number;
44
+ onConfirmCancel(run: InventoryRun): Promise<void>;
45
+ onResume(run: InventoryRun): Promise<void>;
46
+ private stopPolling;
47
+ static ɵfac: i0.ɵɵFactoryDeclaration<InventoryRunsComponent, never>;
48
+ static ɵcmp: i0.ɵɵComponentDeclaration<InventoryRunsComponent, "lib-inventory-runs", never, { "spaceID": { "alias": "spaceID"; "required": false; }; "nodeIDs": { "alias": "nodeIDs"; "required": false; }; "labels": { "alias": "labels"; "required": false; }; }, { "runningChange": "runningChange"; }, never, never, false, never>;
49
+ }
@@ -8,7 +8,7 @@ import * as i0 from "@angular/core";
8
8
  export type SplatViewerMode = 'orbit' | 'walk';
9
9
  /**
10
10
  * Gaussian splats, drawn by SuperSplat's viewer (PlayCanvas) in an iframe, as Matterport's showcase
11
- * is: the page built from projects/splat-viewer, which each app serves from assets/viewers/splat.
11
+ * is: the page built from src/lib/splat-viewer, which each app serves from assets/viewers/splat.
12
12
  *
13
13
  * The visit's Three.js scene stays underneath, unseen, holding the tags, their calibration and the
14
14
  * measurement, as it does for a model it draws itself; this hands the viewer what the scene holds,
@@ -16,15 +16,17 @@ import * as i12 from "./components/loader/loader.component";
16
16
  import * as i13 from "./components/support-modal/support-modal.component";
17
17
  import * as i14 from "./pipes/format-date-number-to-digits.pipe";
18
18
  import * as i15 from "./components/splat-viewer/splat-viewer.component";
19
- import * as i16 from "@angular/forms";
20
- import * as i17 from "@angular/common";
21
- import * as i18 from "@angular/router";
22
- import * as i19 from "@ng-bootstrap/ng-bootstrap";
23
- import * as i20 from "@abhinavakhil/iconify-angular";
24
- import * as i21 from "@ngx-translate/core";
19
+ import * as i16 from "./components/inventory-runs/inventory-runs.component";
20
+ import * as i17 from "./components/inventory-runs/inventory-files.component";
21
+ import * as i18 from "@angular/forms";
22
+ import * as i19 from "@angular/common";
23
+ import * as i20 from "@angular/router";
24
+ import * as i21 from "@ng-bootstrap/ng-bootstrap";
25
+ import * as i22 from "@abhinavakhil/iconify-angular";
26
+ import * as i23 from "@ngx-translate/core";
25
27
  export declare class NgxSmarterplanCoreModule {
26
28
  static forRoot(config: Config): ModuleWithProviders<NgxSmarterplanCoreModule>;
27
29
  static ɵfac: i0.ɵɵFactoryDeclaration<NgxSmarterplanCoreModule, never>;
28
- static ɵmod: i0.ɵɵNgModuleDeclaration<NgxSmarterplanCoreModule, [typeof i1.TimeDateToLocalStringPipe, typeof i2.SafeUrlPipe, typeof i3.HashtagFromIdPipe, typeof i4.DurationToStringPipe, typeof i5.CsvExportComponent, typeof i6.SearchBarComponent, typeof i7.UsernameFromIdPipe, typeof i8.ModalSwitchVisitComponent, typeof i9.MenuBarComponent, typeof i10.AvatarComponent, typeof i11.NavigationBarComponent, typeof i12.LoaderComponent, typeof i13.SupportModalComponent, typeof i14.FormatDateNumberToDigitsPipe, typeof i15.SplatViewerComponent], [typeof i16.FormsModule, typeof i16.ReactiveFormsModule, typeof i17.CommonModule, typeof i18.RouterModule, typeof i19.NgbModule, typeof i20.IconModule, typeof i21.TranslateModule], [typeof i5.CsvExportComponent, typeof i6.SearchBarComponent, typeof i1.TimeDateToLocalStringPipe, typeof i2.SafeUrlPipe, typeof i3.HashtagFromIdPipe, typeof i4.DurationToStringPipe, typeof i7.UsernameFromIdPipe, typeof i9.MenuBarComponent, typeof i12.LoaderComponent, typeof i13.SupportModalComponent, typeof i10.AvatarComponent, typeof i15.SplatViewerComponent]>;
30
+ static ɵmod: i0.ɵɵNgModuleDeclaration<NgxSmarterplanCoreModule, [typeof i1.TimeDateToLocalStringPipe, typeof i2.SafeUrlPipe, typeof i3.HashtagFromIdPipe, typeof i4.DurationToStringPipe, typeof i5.CsvExportComponent, typeof i6.SearchBarComponent, typeof i7.UsernameFromIdPipe, typeof i8.ModalSwitchVisitComponent, typeof i9.MenuBarComponent, typeof i10.AvatarComponent, typeof i11.NavigationBarComponent, typeof i12.LoaderComponent, typeof i13.SupportModalComponent, typeof i14.FormatDateNumberToDigitsPipe, typeof i15.SplatViewerComponent, typeof i16.InventoryRunsComponent, typeof i17.InventoryFilesComponent], [typeof i18.FormsModule, typeof i18.ReactiveFormsModule, typeof i19.CommonModule, typeof i20.RouterModule, typeof i21.NgbModule, typeof i22.IconModule, typeof i23.TranslateModule], [typeof i5.CsvExportComponent, typeof i6.SearchBarComponent, typeof i1.TimeDateToLocalStringPipe, typeof i2.SafeUrlPipe, typeof i3.HashtagFromIdPipe, typeof i4.DurationToStringPipe, typeof i7.UsernameFromIdPipe, typeof i9.MenuBarComponent, typeof i12.LoaderComponent, typeof i13.SupportModalComponent, typeof i10.AvatarComponent, typeof i15.SplatViewerComponent, typeof i16.InventoryRunsComponent, typeof i17.InventoryFilesComponent]>;
29
31
  static ɵinj: i0.ɵɵInjectorDeclaration<NgxSmarterplanCoreModule>;
30
32
  }
@@ -0,0 +1,112 @@
1
+ import { InventoryStatus } from "../../types.service";
2
+ import * as i0 from "@angular/core";
3
+ /** An inventory of one visit (node), as the inventory screens show it. */
4
+ export interface InventoryRun {
5
+ id: string;
6
+ nodeID: string;
7
+ status: InventoryStatus;
8
+ MLInventoryModelName: string;
9
+ MLInventoryModelID: string;
10
+ cutoffScore: number;
11
+ createdAt: string;
12
+ updatedAt: string;
13
+ imagesTotal?: number;
14
+ imagesDone?: number;
15
+ objectsFound?: number;
16
+ errorMessage?: string;
17
+ /** DOWNLOADING, DETECTING, PLACING, SAVING, then DONE, or STOPPED once CANCELLED. */
18
+ step?: string;
19
+ /** The stopped inventory whose analysed panoramas this one started from. */
20
+ resumeFrom?: string;
21
+ }
22
+ /**
23
+ * What the screens say of an inventory: cancelling while its task finishes the panorama it is on,
24
+ * cancelled once it has stopped.
25
+ */
26
+ export type InventoryRunState = "waiting" | "running" | "done" | "failed" | "stale" | "cancelling" | "cancelled";
27
+ /** An AI model the inventory can run, by the name the screens show. */
28
+ export interface InventoryModel {
29
+ id: string;
30
+ name: string;
31
+ }
32
+ /**
33
+ * What the inventory of a visit needs in the bucket, under public/visits/<model3D>/: its
34
+ * panoramas (sweeps/) and their positions (inventory/data.json), which the site's Matterport import
35
+ * puts there, and its mesh (inventory/model.obj), Matterport's Matterpak .obj, which nothing here
36
+ * does.
37
+ */
38
+ export interface InventoryFiles {
39
+ panoramas: number;
40
+ dataJson: boolean;
41
+ modelObj: boolean;
42
+ }
43
+ /**
44
+ * The minimum scores a detection can be asked to beat. The model keeps those scoring strictly more
45
+ * (yolact's postprocess: score > threshold), and a score is at most 1: 1.0 would keep none.
46
+ */
47
+ export declare const INVENTORY_CUTOFF_SCORES: string[];
48
+ /** The model's own (machine-learning: configuration/inference.yaml, score_threshold). */
49
+ export declare const INVENTORY_DEFAULT_CUTOFF = "0.6";
50
+ /**
51
+ * An inventory with no news for this long is taken to have stopped, its task gone without saying
52
+ * so: it no longer keeps another from being launched.
53
+ */
54
+ export declare const INVENTORY_STALE_AFTER_MS: number;
55
+ /**
56
+ * The AI inventory: an Inventory record per visit, whose creation makes the app's Amplify Lambda
57
+ * `inventory` start an ECS task that looks for equipment in the visit's panoramas, adds it to the
58
+ * space, and writes on the record how it goes.
59
+ */
60
+ export declare class InventoryService {
61
+ API: any;
62
+ /** Which of RUN_FIELDS the API has all of, as far as is known. */
63
+ private fieldsLevel;
64
+ constructor(apiInjected: any);
65
+ /** The trained models. */
66
+ getModels(): Promise<InventoryModel[]>;
67
+ /** The space's inventories, the latest first. */
68
+ getRuns(spaceID: string): Promise<InventoryRun[]>;
69
+ /** What the visit has of what its inventory needs; null when the bucket could not be read. */
70
+ checkFiles(model3D: string): Promise<InventoryFiles>;
71
+ /** Whether the visit has all its inventory needs. */
72
+ isComplete(files: InventoryFiles): boolean;
73
+ /** The latest inventory of each visit, the latest first. */
74
+ latestOfEachVisit(runs: InventoryRun[]): InventoryRun[];
75
+ isToRun(run: InventoryRun): boolean;
76
+ isStale(run: InventoryRun, now?: number): boolean;
77
+ /**
78
+ * Whether the inventory's task is yet to finish - cancelled ones included, until it has
79
+ * stopped - and has not stopped without saying so.
80
+ */
81
+ isRunning(run: InventoryRun, now?: number): boolean;
82
+ state(run: InventoryRun, now?: number): InventoryRunState;
83
+ /**
84
+ * Whether the inventory can be cancelled: running, by a task that stops when asked to - one
85
+ * that says its step (machine-learning: inventory_job.py) - so not yet when it has not started.
86
+ */
87
+ canCancel(run: InventoryRun, now?: number): boolean;
88
+ /**
89
+ * Whether the inventory can be resumed from where it stopped: over without being done, by a
90
+ * task that keeps what it analyses, with some panoramas analysed and some not.
91
+ */
92
+ canResume(run: InventoryRun, now?: number): boolean;
93
+ /** Asks the inventory's task to stop, after the panorama it is on: it inserts nothing. */
94
+ cancel(run: InventoryRun): Promise<void>;
95
+ /**
96
+ * Launches the inventory of the stopped one's visit again, from the panoramas that one
97
+ * analysed, unless one is running in the space.
98
+ */
99
+ resume(spaceID: string, run: InventoryRun): Promise<"LAUNCHED" | "ALREADY_RUNNING">;
100
+ /** How much of the panoramas is done, from 0 to 100. */
101
+ percent(run: InventoryRun): number;
102
+ /** Why it failed, as a key to translate. */
103
+ failure(run: InventoryRun): string;
104
+ /**
105
+ * Launches an inventory of each of the visits, unless one is already running in the space:
106
+ * of all their panoramas, or of the one of `sweep` (the first 8 characters of its sweep, as
107
+ * the panoramas are named) when it is given.
108
+ */
109
+ launch(spaceID: string, nodeIDs: string[], model: InventoryModel, cutoffScore: number, sweep?: string): Promise<"LAUNCHED" | "ALREADY_RUNNING">;
110
+ static ɵfac: i0.ɵɵFactoryDeclaration<InventoryService, never>;
111
+ static ɵprov: i0.ɵɵInjectableDeclaration<InventoryService>;
112
+ }
@@ -137,7 +137,8 @@ export declare enum InventoryStatus {
137
137
  TO_RUN_ONE_IMAGE = "TO_RUN_ONE_IMAGE",
138
138
  ERROR_FILE_OBJ_NOT_EXIST = "ERROR_FILE_OBJ_NOT_EXIST",
139
139
  ERROR_FILE_JSON_NOT_EXIST = "ERROR_FILE_JSON_NOT_EXIST",
140
- ERROR_FILE_MODEL_NOT_EXIST = "ERROR_FILE_MODEL_NOT_EXIST"
140
+ ERROR_FILE_MODEL_NOT_EXIST = "ERROR_FILE_MODEL_NOT_EXIST",
141
+ CANCELLED = "CANCELLED"
141
142
  }
142
143
  export declare enum TypeNote {
143
144
  CONTRACTUAL = "CONTRACTUAL",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smarterplan/ngx-smarterplan-core",
3
- "version": "1.4.23",
3
+ "version": "1.4.25",
4
4
  "dependencies": {
5
5
  "tslib": "^2.5.0"
6
6
  },
package/public-api.d.ts CHANGED
@@ -30,6 +30,7 @@ export * from './lib/services/models/zone.service';
30
30
  export * from './lib/services/models/mission.service';
31
31
  export * from './lib/services/models/object3D.service';
32
32
  export * from './lib/services/models/poi.service';
33
+ export * from './lib/services/models/inventory.service';
33
34
  export * from './lib/services/models/property.service';
34
35
  export * from './lib/services/models/organisation.service';
35
36
  export * from './lib/services/models/domain.service';
@@ -58,6 +59,8 @@ export * from './lib/components/search-bar/search-bar.component';
58
59
  export * from './lib/components/menu-bar/menu-bar.component';
59
60
  export * from './lib/components/loader/loader.component';
60
61
  export * from './lib/components/splat-viewer/splat-viewer.component';
62
+ export * from './lib/components/inventory-runs/inventory-runs.component';
63
+ export * from './lib/components/inventory-runs/inventory-files.component';
61
64
  export * from './lib/components/support-modal/support-modal.component';
62
65
  export * from './lib/components/menu-bar/avatar/avatar.component';
63
66
  export * from './lib/pipes/duration-to-string.pipe';