@smplrspace/smplr-loader 2.28.1-beta.8 → 2.29.0

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.
@@ -2,20 +2,44 @@ import { ArcRotateCamera } from '@babylonjs/core/Cameras/arcRotateCamera';
2
2
  import { CSSProperties } from 'react';
3
3
  import { Dispatch } from 'react';
4
4
  import { EasingOptions } from 'mapbox-gl';
5
+ import { GetTokenSilentlyOptions } from '@auth0/auth0-spa-js';
5
6
  import { IMaybe } from 'mobx-state-tree';
6
7
  import { IModelType } from 'mobx-state-tree';
7
8
  import { IOptionalIType } from 'mobx-state-tree';
8
9
  import { ISimpleType } from 'mobx-state-tree';
10
+ import { LogoutOptions } from '@auth0/auth0-spa-js';
9
11
  import { default as NoSleep_2 } from 'nosleep.js';
10
12
  import { _NotCustomized } from 'mobx-state-tree';
13
+ import { RedirectLoginOptions } from '@auth0/auth0-spa-js';
11
14
  import { Reducer } from 'react';
12
15
  import { ReducerAction } from 'react';
13
16
  import { RefObject } from 'react';
14
17
  import { Scene } from '@babylonjs/core/scene';
15
18
  import { SnapshotOut } from 'mobx-state-tree';
16
19
  import { UniversalCamera } from '@babylonjs/core/Cameras/universalCamera';
20
+ import { User as User_2 } from '@auth0/auth0-spa-js';
17
21
  import { VRDeviceOrientationFreeCamera } from '@babylonjs/core/Cameras/VR/vrDeviceOrientationFreeCamera';
18
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
+
19
43
  declare type BaseData = {
20
44
  id?: string | number;
21
45
  };
@@ -189,15 +213,17 @@ export declare class Editor {
189
213
  startSession(options?: SessionOptions): void;
190
214
  }
191
215
 
192
- export declare interface EditorOptions {
216
+ export declare type EditorOptions = {
193
217
  spaceId: string;
194
218
  user: EmbeddedEditorUser;
195
219
  clientToken: string;
196
- containerId: string;
197
220
  disableErrorReporting?: boolean;
198
221
  whiteLabel?: boolean;
199
- internal?: boolean;
200
- }
222
+ } & ({
223
+ containerId: string;
224
+ } | {
225
+ container: HTMLElement;
226
+ });
201
227
 
202
228
  export declare interface EmbeddedEditorUser {
203
229
  id: string;
@@ -438,12 +464,16 @@ export declare interface MapCameraPlacement {
438
464
  center: GeoPoint;
439
465
  }
440
466
 
441
- export declare interface MapOptions {
467
+ export declare type MapOptions = {
442
468
  clientToken: string;
443
- containerId: string;
444
469
  disableErrorReporting?: boolean;
445
470
  internal?: boolean;
446
- }
471
+ sideLoadedAuth0?: Pick<Auth0ContextValue, 'getTokenSilently'>;
472
+ } & ({
473
+ containerId: string;
474
+ } | {
475
+ container: HTMLElement;
476
+ });
447
477
 
448
478
  export declare interface MapSpaceRenderOptions {
449
479
  footprint: {
@@ -689,6 +719,12 @@ export declare class QueryClient {
689
719
  private checkOptions;
690
720
  checkApiConnection(): Promise<string>;
691
721
  getApiVersion(): Promise<string>;
722
+ createSpace({ name, notes }: {
723
+ name: string;
724
+ notes?: string;
725
+ }): Promise<{
726
+ sid: string;
727
+ }>;
692
728
  listSpaces(): Promise<{
693
729
  sid: string;
694
730
  status: string;
@@ -705,10 +741,10 @@ export declare class QueryClient {
705
741
  georeference?: {} | null | undefined;
706
742
  assetmap?: {} | null | undefined;
707
743
  definition?: {} | null | undefined;
744
+ public_link_enabled: boolean;
708
745
  created_at: string;
709
746
  modified_at: string;
710
747
  embed_image?: string | null | undefined;
711
- public_link_enabled: boolean;
712
748
  }>;
713
749
  getSpaceFromCache(spaceId: string): {
714
750
  sid: string;
@@ -717,10 +753,10 @@ export declare class QueryClient {
717
753
  georeference?: {} | null | undefined;
718
754
  assetmap?: {} | null | undefined;
719
755
  definition?: {} | null | undefined;
756
+ public_link_enabled: boolean;
720
757
  created_at: string;
721
758
  modified_at: string;
722
759
  embed_image?: string | null | undefined;
723
- public_link_enabled: boolean;
724
760
  };
725
761
  getAllFurnitureInSpace(spaceId: string): Promise<Furniture[]>;
726
762
  getAllFurnitureInSpaceFromCache(spaceId: string): Furniture[];
@@ -859,6 +895,8 @@ export declare class QueryClient {
859
895
  export declare interface QueryClientOptions {
860
896
  organizationId: string;
861
897
  clientToken: string;
898
+ internal?: boolean;
899
+ sideLoadedAuth0?: Pick<Auth0ContextValue, 'getTokenSilently'>;
862
900
  }
863
901
 
864
902
  declare const ragScale: <C extends string>({ categories, colors, nodata, }: RAGScaleOptions<C>) => (category: C) => string;
@@ -995,14 +1033,19 @@ export declare class Space {
995
1033
  }): Promise<string>;
996
1034
  }
997
1035
 
998
- export declare interface SpaceOptions {
1036
+ export declare type SpaceOptions = {
999
1037
  spaceId: string;
1038
+ spaceDefinition?: object;
1000
1039
  clientToken: string;
1001
- containerId: string;
1002
1040
  disableErrorReporting?: boolean;
1003
1041
  whiteLabel?: boolean;
1004
1042
  internal?: boolean;
1005
- }
1043
+ sideLoadedAuth0?: Pick<Auth0ContextValue, 'getTokenSilently'>;
1044
+ } & ({
1045
+ containerId: string;
1046
+ } | {
1047
+ container: HTMLElement;
1048
+ });
1006
1049
 
1007
1050
  export declare interface SpaceRenderOptions {
1008
1051
  compass?: boolean
@@ -1052,6 +1095,7 @@ export declare interface SpaceViewerOptions {
1052
1095
  onError?: (errorMessage: string) => void;
1053
1096
  onResize?: (containerRect: DOMRect) => void;
1054
1097
  onVisibleLevelsChanged?: (visibleLevels: number[]) => void;
1098
+ onObjectsUpdated?: () => void;
1055
1099
  onModeChange?: (mode: CameraMode) => void;
1056
1100
  loadingMessage?: string;
1057
1101
  renderingMessage?: string;
@@ -1089,6 +1133,16 @@ declare const useEventEmitter: () => {
1089
1133
  clearAllUserDefinedListeners: () => void;
1090
1134
  };
1091
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
+
1092
1146
  declare interface Vector2Coord {
1093
1147
  x: number;
1094
1148
  y: number;
@@ -1098,7 +1152,7 @@ declare interface Vector3Coord extends Vector2Coord {
1098
1152
  z: number;
1099
1153
  }
1100
1154
 
1101
- export declare const version = "2.28.1-beta.8";
1155
+ export declare const version = "2.29.0";
1102
1156
 
1103
1157
  declare interface ViewerRendererHandle {
1104
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.8",
3
+ "version": "2.29.0",
4
4
  "description": "NPM package to load a typed Smplr.js from CDN easily",
5
5
  "type": "module",
6
6
  "files": [