@smplrspace/smplr-loader 2.28.1-beta.4 → 2.28.1-beta.40

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,20 +1,45 @@
1
1
  import { ArcRotateCamera } from '@babylonjs/core/Cameras/arcRotateCamera';
2
2
  import { CSSProperties } from 'react';
3
3
  import { Dispatch } from 'react';
4
+ import { EasingOptions } from 'mapbox-gl';
5
+ import { GetTokenSilentlyOptions } from '@auth0/auth0-spa-js';
4
6
  import { IMaybe } from 'mobx-state-tree';
5
7
  import { IModelType } from 'mobx-state-tree';
6
8
  import { IOptionalIType } from 'mobx-state-tree';
7
9
  import { ISimpleType } from 'mobx-state-tree';
10
+ import { LogoutOptions } from '@auth0/auth0-spa-js';
8
11
  import { default as NoSleep_2 } from 'nosleep.js';
9
12
  import { _NotCustomized } from 'mobx-state-tree';
13
+ import { RedirectLoginOptions } from '@auth0/auth0-spa-js';
10
14
  import { Reducer } from 'react';
11
15
  import { ReducerAction } from 'react';
12
16
  import { RefObject } from 'react';
13
17
  import { Scene } from '@babylonjs/core/scene';
14
18
  import { SnapshotOut } from 'mobx-state-tree';
15
19
  import { UniversalCamera } from '@babylonjs/core/Cameras/universalCamera';
20
+ import { User as User_2 } from '@auth0/auth0-spa-js';
16
21
  import { VRDeviceOrientationFreeCamera } from '@babylonjs/core/Cameras/VR/vrDeviceOrientationFreeCamera';
17
22
 
23
+ declare interface Auth0ContextValue {
24
+ isAuthenticated: boolean;
25
+ user: User | null;
26
+ loading: boolean;
27
+ logout: (options?: LogoutOptions) => void;
28
+ loggingOut: boolean;
29
+ loginWithRedirect: (options?: RedirectLoginOptions) => Promise<void>;
30
+ getTokenSilently: (options?: GetTokenSilentlyOptions) => Promise<string>;
31
+ updateUser: (updates: Partial<User>) => void;
32
+ }
33
+
34
+ declare interface Auth0UserWithClaims extends User_2 {
35
+ 'https://smplrspace.com/jwt/claims': {
36
+ personalOrganizationId: string
37
+ smplradmin: boolean
38
+ missiveDigest: string
39
+ emailVerified: boolean
40
+ }
41
+ }
42
+
18
43
  declare type BaseData = {
19
44
  id?: string | number;
20
45
  };
@@ -188,15 +213,17 @@ export declare class Editor {
188
213
  startSession(options?: SessionOptions): void;
189
214
  }
190
215
 
191
- export declare interface EditorOptions {
216
+ export declare type EditorOptions = {
192
217
  spaceId: string;
193
218
  user: EmbeddedEditorUser;
194
219
  clientToken: string;
195
- containerId: string;
196
220
  disableErrorReporting?: boolean;
197
221
  whiteLabel?: boolean;
198
- internal?: boolean;
199
- }
222
+ } & ({
223
+ containerId: string;
224
+ } | {
225
+ container: HTMLElement;
226
+ });
200
227
 
201
228
  export declare interface EmbeddedEditorUser {
202
229
  id: string;
@@ -281,6 +308,7 @@ export declare interface GeojsonSpace {
281
308
  sid: string;
282
309
  name: string;
283
310
  definition?: object | null;
311
+ oldGeoreference?: object | null;
284
312
  georeference?: object | null;
285
313
  }
286
314
 
@@ -397,6 +425,7 @@ declare class Map_2 {
397
425
  remove: () => void;
398
426
  mapbox(): mapboxgl.Map | undefined;
399
427
  startViewer(options: MapViewerOptions): Promise<void>;
428
+ setStyle(style: string): void;
400
429
  addSpaces(spaces: GeojsonSpace[]): void;
401
430
  addSpacesById(spaceIds: string[]): void;
402
431
  removeSpacesById(spaceIds: string[]): void;
@@ -405,6 +434,9 @@ declare class Map_2 {
405
434
  showOsmBuildings(): void;
406
435
  hideOsmBuildings(): void;
407
436
  toggleOsmBuildings(): void;
437
+ showBuildingsFootprint(): void;
438
+ hideBuildingsFootprint(): void;
439
+ toggleBuildingsFootprint(): void;
408
440
  donotuse_setOsmHighlightColor(color: string): void;
409
441
  donotuse_setOsmHighlights(buildingIds: number[]): void;
410
442
  donotuse_addOsmHighlights(buildingIds: number[]): void;
@@ -417,7 +449,7 @@ declare class Map_2 {
417
449
  animate?: boolean;
418
450
  speed?: number;
419
451
  }): void;
420
- flyToSpace(spaceId: string): void;
452
+ flyToSpace(spaceId: string, options?: EasingOptions): void;
421
453
  fitAllSpacesInScreen(): void;
422
454
  updateLoadingMessage(message: string): void;
423
455
  showLoader(): void;
@@ -432,12 +464,16 @@ export declare interface MapCameraPlacement {
432
464
  center: GeoPoint;
433
465
  }
434
466
 
435
- export declare interface MapOptions {
467
+ export declare type MapOptions = {
436
468
  clientToken: string;
437
- containerId: string;
438
469
  disableErrorReporting?: boolean;
439
470
  internal?: boolean;
440
- }
471
+ sideLoadedAuth0?: Pick<Auth0ContextValue, 'getTokenSilently'>;
472
+ } & ({
473
+ containerId: string;
474
+ } | {
475
+ container: HTMLElement;
476
+ });
441
477
 
442
478
  export declare interface MapSpaceRenderOptions {
443
479
  footprint: {
@@ -683,6 +719,12 @@ export declare class QueryClient {
683
719
  private checkOptions;
684
720
  checkApiConnection(): Promise<string>;
685
721
  getApiVersion(): Promise<string>;
722
+ createSpace({ name, notes }: {
723
+ name: string;
724
+ notes?: string;
725
+ }): Promise<{
726
+ sid: string;
727
+ }>;
686
728
  listSpaces(): Promise<{
687
729
  sid: string;
688
730
  status: string;
@@ -696,23 +738,25 @@ export declare class QueryClient {
696
738
  sid: string;
697
739
  status: string;
698
740
  name: string;
699
- definition?: {} | null | undefined;
741
+ georeference?: {} | null | undefined;
700
742
  assetmap?: {} | null | undefined;
743
+ definition?: {} | null | undefined;
744
+ public_link_enabled: boolean;
701
745
  created_at: string;
702
746
  modified_at: string;
703
747
  embed_image?: string | null | undefined;
704
- public_link_enabled: boolean;
705
748
  }>;
706
749
  getSpaceFromCache(spaceId: string): {
707
750
  sid: string;
708
751
  status: string;
709
752
  name: string;
710
- definition?: {} | null | undefined;
753
+ georeference?: {} | null | undefined;
711
754
  assetmap?: {} | null | undefined;
755
+ definition?: {} | null | undefined;
756
+ public_link_enabled: boolean;
712
757
  created_at: string;
713
758
  modified_at: string;
714
759
  embed_image?: string | null | undefined;
715
- public_link_enabled: boolean;
716
760
  };
717
761
  getAllFurnitureInSpace(spaceId: string): Promise<Furniture[]>;
718
762
  getAllFurnitureInSpaceFromCache(spaceId: string): Furniture[];
@@ -851,6 +895,8 @@ export declare class QueryClient {
851
895
  export declare interface QueryClientOptions {
852
896
  organizationId: string;
853
897
  clientToken: string;
898
+ internal?: boolean;
899
+ sideLoadedAuth0?: Pick<Auth0ContextValue, 'getTokenSilently'>;
854
900
  }
855
901
 
856
902
  declare const ragScale: <C extends string>({ categories, colors, nodata, }: RAGScaleOptions<C>) => (category: C) => string;
@@ -987,14 +1033,19 @@ export declare class Space {
987
1033
  }): Promise<string>;
988
1034
  }
989
1035
 
990
- export declare interface SpaceOptions {
1036
+ export declare type SpaceOptions = {
991
1037
  spaceId: string;
1038
+ spaceDefinition?: object;
992
1039
  clientToken: string;
993
- containerId: string;
994
1040
  disableErrorReporting?: boolean;
995
1041
  whiteLabel?: boolean;
996
1042
  internal?: boolean;
997
- }
1043
+ sideLoadedAuth0?: Pick<Auth0ContextValue, 'getTokenSilently'>;
1044
+ } & ({
1045
+ containerId: string;
1046
+ } | {
1047
+ container: HTMLElement;
1048
+ });
998
1049
 
999
1050
  export declare interface SpaceRenderOptions {
1000
1051
  compass?: boolean
@@ -1044,6 +1095,7 @@ export declare interface SpaceViewerOptions {
1044
1095
  onError?: (errorMessage: string) => void;
1045
1096
  onResize?: (containerRect: DOMRect) => void;
1046
1097
  onVisibleLevelsChanged?: (visibleLevels: number[]) => void;
1098
+ onObjectsUpdated?: () => void;
1047
1099
  onModeChange?: (mode: CameraMode) => void;
1048
1100
  loadingMessage?: string;
1049
1101
  renderingMessage?: string;
@@ -1081,6 +1133,16 @@ declare const useEventEmitter: () => {
1081
1133
  clearAllUserDefinedListeners: () => void;
1082
1134
  };
1083
1135
 
1136
+ declare interface User extends Auth0UserWithClaims {
1137
+ sub: string
1138
+ name: string
1139
+ email: string
1140
+ personalOrganizationId: string
1141
+ smplradmin: boolean
1142
+ missiveDigest: string
1143
+ emailVerified: boolean
1144
+ }
1145
+
1084
1146
  declare interface Vector2Coord {
1085
1147
  x: number;
1086
1148
  y: number;
@@ -1090,7 +1152,7 @@ declare interface Vector3Coord extends Vector2Coord {
1090
1152
  z: number;
1091
1153
  }
1092
1154
 
1093
- export declare const version = "2.28.1-beta.4";
1155
+ export declare const version = "2.28.1-beta.40";
1094
1156
 
1095
1157
  declare interface ViewerRendererHandle {
1096
1158
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smplrspace/smplr-loader",
3
- "version": "2.28.1-beta.4",
3
+ "version": "2.28.1-beta.40",
4
4
  "description": "NPM package to load a typed Smplr.js from CDN easily",
5
5
  "type": "module",
6
6
  "files": [