@rtsdk/topia 0.0.31 → 0.1.1

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 (101) hide show
  1. package/dist/index.cjs +43 -13
  2. package/dist/index.js +43 -13
  3. package/dist/types/example.d.ts +6 -0
  4. package/dist/types/src/__mocks__/assets.d.ts +99 -0
  5. package/dist/{src/__mocks__/index.js → types/src/__mocks__/index.d.ts} +4 -4
  6. package/dist/types/src/__mocks__/scenes.d.ts +79 -0
  7. package/dist/types/src/__mocks__/visitors.d.ts +83 -0
  8. package/dist/types/src/__mocks__/worlds.d.ts +73 -0
  9. package/dist/types/src/controllers/Asset.d.ts +20 -0
  10. package/dist/types/src/controllers/DroppedAsset.d.ts +285 -0
  11. package/dist/types/src/controllers/SDKController.d.ts +48 -0
  12. package/dist/types/src/controllers/Scene.d.ts +19 -0
  13. package/dist/types/src/controllers/Topia.d.ts +33 -0
  14. package/dist/types/src/controllers/User.d.ts +58 -0
  15. package/dist/types/src/controllers/Visitor.d.ts +50 -0
  16. package/dist/types/src/controllers/World.d.ts +143 -0
  17. package/dist/types/src/controllers/WorldActivity.d.ts +83 -0
  18. package/dist/{src/interfaces/AssetInterfaces.js → types/src/controllers/__tests__/asset.test.d.ts} +1 -1
  19. package/dist/{src/interfaces/DroppedAssetInterfaces.js → types/src/controllers/__tests__/droppedAsset.test.d.ts} +1 -1
  20. package/dist/{src/interfaces/SDKInterfaces.js → types/src/controllers/__tests__/scene.test.d.ts} +1 -1
  21. package/dist/{src/interfaces/SceneInterfaces.js → types/src/controllers/__tests__/user.test.d.ts} +1 -1
  22. package/dist/types/src/controllers/__tests__/visitor.test.d.ts +1 -0
  23. package/dist/types/src/controllers/__tests__/world.test.d.ts +1 -0
  24. package/dist/types/src/controllers/__tests__/worldActivity.test.d.ts +1 -0
  25. package/dist/{src/controllers/index.js → types/src/controllers/index.d.ts} +9 -9
  26. package/dist/types/src/factories/AssetFactory.d.ts +8 -0
  27. package/dist/types/src/factories/DroppedAssetFactory.d.ts +16 -0
  28. package/dist/types/src/factories/SceneFactory.d.ts +9 -0
  29. package/dist/types/src/factories/UserFactory.d.ts +8 -0
  30. package/dist/types/src/factories/VisitorFactory.d.ts +9 -0
  31. package/dist/types/src/factories/WorldActivityFactory.d.ts +8 -0
  32. package/dist/types/src/factories/WorldFactory.d.ts +8 -0
  33. package/dist/{src/factories/index.js → types/src/factories/index.d.ts} +7 -7
  34. package/dist/types/src/index.d.ts +4 -0
  35. package/dist/types/src/interfaces/AssetInterfaces.d.ts +26 -0
  36. package/dist/types/src/interfaces/DroppedAssetInterfaces.d.ts +102 -0
  37. package/dist/types/src/interfaces/SDKInterfaces.d.ts +8 -0
  38. package/dist/types/src/interfaces/SceneInterfaces.d.ts +27 -0
  39. package/dist/types/src/interfaces/TopiaInterfaces.d.ts +10 -0
  40. package/dist/types/src/interfaces/UserInterfaces.d.ts +6 -0
  41. package/dist/types/src/interfaces/VisitorInterfaces.d.ts +37 -0
  42. package/dist/types/src/interfaces/WorldActivityInterfaces.d.ts +11 -0
  43. package/dist/types/src/interfaces/WorldInterfaces.d.ts +32 -0
  44. package/dist/{src/interfaces/index.js → types/src/interfaces/index.d.ts} +9 -9
  45. package/dist/types/src/types/DroppedAssetTypes.d.ts +10 -0
  46. package/dist/types/src/types/InteractiveCredentialsTypes.d.ts +8 -0
  47. package/dist/types/src/types/OptionsTypes.d.ts +21 -0
  48. package/dist/types/src/types/ResponseTypes.d.ts +4 -0
  49. package/dist/types/src/types/VisitorTypes.d.ts +33 -0
  50. package/dist/{src/types/index.js → types/src/types/index.d.ts} +5 -4
  51. package/dist/types/src/utils/__tests__/removeUndefined.test.d.ts +1 -0
  52. package/dist/types/src/utils/__tests__/scatterVisitors.test.d.ts +1 -0
  53. package/dist/types/src/utils/getBrowserWarning.d.ts +1 -0
  54. package/dist/{src/utils/index.js → types/src/utils/index.d.ts} +3 -3
  55. package/dist/types/src/utils/removeUndefined.d.ts +8 -0
  56. package/dist/types/src/utils/scatterVisitors.d.ts +4 -0
  57. package/package.json +3 -2
  58. package/dist/example.js +0 -32
  59. package/dist/src/__mocks__/assets.js +0 -249
  60. package/dist/src/__mocks__/scenes.js +0 -104
  61. package/dist/src/__mocks__/visitors.js +0 -83
  62. package/dist/src/__mocks__/worlds.js +0 -52
  63. package/dist/src/controllers/Asset.js +0 -39
  64. package/dist/src/controllers/DroppedAsset.js +0 -443
  65. package/dist/src/controllers/SDKController.js +0 -76
  66. package/dist/src/controllers/Scene.js +0 -39
  67. package/dist/src/controllers/Topia.js +0 -39
  68. package/dist/src/controllers/User.js +0 -139
  69. package/dist/src/controllers/Visitor.js +0 -92
  70. package/dist/src/controllers/World.js +0 -257
  71. package/dist/src/controllers/WorldActivity.js +0 -162
  72. package/dist/src/controllers/__tests__/asset.test.js +0 -37
  73. package/dist/src/controllers/__tests__/droppedAsset.test.js +0 -98
  74. package/dist/src/controllers/__tests__/scene.test.js +0 -38
  75. package/dist/src/controllers/__tests__/user.test.js +0 -49
  76. package/dist/src/controllers/__tests__/visitor.test.js +0 -47
  77. package/dist/src/controllers/__tests__/world.test.js +0 -51
  78. package/dist/src/controllers/__tests__/worldActivity.test.js +0 -63
  79. package/dist/src/factories/AssetFactory.js +0 -11
  80. package/dist/src/factories/DroppedAssetFactory.js +0 -42
  81. package/dist/src/factories/SceneFactory.js +0 -27
  82. package/dist/src/factories/UserFactory.js +0 -10
  83. package/dist/src/factories/VisitorFactory.js +0 -26
  84. package/dist/src/factories/WorldActivityFactory.js +0 -10
  85. package/dist/src/factories/WorldFactory.js +0 -10
  86. package/dist/src/index.js +0 -23
  87. package/dist/src/interfaces/TopiaInterfaces.js +0 -1
  88. package/dist/src/interfaces/UserInterfaces.js +0 -1
  89. package/dist/src/interfaces/VisitorInterfaces.js +0 -1
  90. package/dist/src/interfaces/WorldActivityInterfaces.js +0 -1
  91. package/dist/src/interfaces/WorldInterfaces.js +0 -1
  92. package/dist/src/types/DroppedAssetTypes.js +0 -12
  93. package/dist/src/types/InteractiveCredentialsTypes.js +0 -1
  94. package/dist/src/types/OptionsTypes.js +0 -1
  95. package/dist/src/types/ResponseTypes.js +0 -1
  96. package/dist/src/types/VisitorTypes.js +0 -1
  97. package/dist/src/utils/__tests__/removeUndefined.test.js +0 -10
  98. package/dist/src/utils/__tests__/scatterVisitors.test.js +0 -11
  99. package/dist/src/utils/getBrowserWarning.js +0 -5
  100. package/dist/src/utils/removeUndefined.js +0 -11
  101. package/dist/src/utils/scatterVisitors.js +0 -8
@@ -0,0 +1,83 @@
1
+ import { SDKController } from "controllers/SDKController";
2
+ import { Topia } from "controllers/Topia";
3
+ import { Visitor } from "controllers/Visitor";
4
+ import { MoveAllVisitorsInterface, WorldActivityOptionalInterface } from "interfaces";
5
+ import { ResponseType, VisitorsToMoveArrayType } from "types";
6
+ /**
7
+ * @summary
8
+ * Create an instance of WorldActivity class with a given url slug and optional attributes and session credentials.
9
+ *
10
+ * This class is responsible for all activity of a specified world including editing dropped assets, moving current visitors, etc.
11
+ *
12
+ * @usage
13
+ * ```ts
14
+ * await new WorldActivity(topia, "exampleWorld", { attributes: { name: "Example World" } });
15
+ * ```
16
+ */
17
+ export declare class WorldActivity extends SDKController {
18
+ #private;
19
+ urlSlug: string;
20
+ constructor(topia: Topia, urlSlug: string, options?: WorldActivityOptionalInterface);
21
+ get visitors(): {
22
+ [key: string]: Visitor;
23
+ };
24
+ private fetchVisitors;
25
+ /**
26
+ * @summary
27
+ * Retrieve all visitors currently in a world.
28
+ *
29
+ * @usage
30
+ * ```ts
31
+ * const visitors = await world.currentVisitors();
32
+ * ```
33
+ */
34
+ currentVisitors(): Promise<unknown>;
35
+ /**
36
+ * @summary
37
+ * Move all visitors currently in a world to a single set of coordinates.
38
+ * Optionally refetch visitors, teleport or walk visitors to new location,
39
+ * and scatter visitors by any number so that they don't all move to the exact same location.
40
+ *
41
+ * @usage
42
+ * ```ts
43
+ * await world.moveAllVisitors({
44
+ * shouldFetchVisitors: true,
45
+ * shouldTeleportVisitors: true,
46
+ * scatterVisitorsBy: 40,
47
+ * x: 100,
48
+ * y: 100,
49
+ * });
50
+ * ```
51
+ *
52
+ * @result
53
+ * Updates each Visitor instance and world.visitors map.
54
+ */
55
+ moveAllVisitors({ shouldFetchVisitors, shouldTeleportVisitors, scatterVisitorsBy, x, y, }: MoveAllVisitorsInterface): Promise<(void | ResponseType)[] | undefined>;
56
+ /**
57
+ * @summary
58
+ * Teleport or walk a list of visitors currently in a world to various coordinates.
59
+ *
60
+ * @usage
61
+ * ```ts
62
+ * const visitorsToMove = [
63
+ * {
64
+ * visitorObj: world.visitors["1"],
65
+ * shouldTeleportVisitor: true,
66
+ * x: 100,
67
+ * y: 100
68
+ * }, {
69
+ * visitorObj: world.visitors["2"],
70
+ * shouldTeleportVisitor: false,
71
+ * x: 100,
72
+ * y: 100
73
+ * }
74
+ * ];
75
+ * await world.moveVisitors(visitorsToMove);
76
+ * ```
77
+ *
78
+ * @result
79
+ * Updates each Visitor instance and world.visitors map.
80
+ */
81
+ moveVisitors(visitorsToMove: VisitorsToMoveArrayType): Promise<(void | ResponseType)[]>;
82
+ }
83
+ export default WorldActivity;
@@ -1,9 +1,9 @@
1
- export { Asset } from "./Asset";
2
- export { DroppedAsset } from "./DroppedAsset";
3
- export { Scene } from "./Scene";
4
- export { SDKController } from "./SDKController";
5
- export { User } from "./User";
6
- export { Visitor } from "./Visitor";
7
- export { World } from "./World";
8
- export { WorldActivity } from "./WorldActivity";
9
- export { Topia } from "./Topia";
1
+ export { Asset } from "./Asset";
2
+ export { DroppedAsset } from "./DroppedAsset";
3
+ export { Scene } from "./Scene";
4
+ export { SDKController } from "./SDKController";
5
+ export { User } from "./User";
6
+ export { Visitor } from "./Visitor";
7
+ export { World } from "./World";
8
+ export { WorldActivity } from "./WorldActivity";
9
+ export { Topia } from "./Topia";
@@ -0,0 +1,8 @@
1
+ import { Asset, Topia } from "controllers";
2
+ import { AssetOptionalInterface } from "interfaces";
3
+ export declare class AssetFactory {
4
+ topia: Topia;
5
+ constructor(topia: Topia);
6
+ create(id: string, options?: AssetOptionalInterface): Asset;
7
+ }
8
+ export default AssetFactory;
@@ -0,0 +1,16 @@
1
+ import { DroppedAsset, Topia, Asset, SDKController } from "controllers";
2
+ import { DroppedAssetOptionalInterface } from "interfaces";
3
+ export declare class DroppedAssetFactory extends SDKController {
4
+ constructor(topia: Topia);
5
+ create(id: string, urlSlug: string, options?: DroppedAssetOptionalInterface): DroppedAsset;
6
+ get(id: string, urlSlug: string, options?: DroppedAssetOptionalInterface): Promise<DroppedAsset>;
7
+ drop(asset: Asset, { position: { x, y }, uniqueName, urlSlug, }: {
8
+ position: {
9
+ x: number;
10
+ y: number;
11
+ };
12
+ uniqueName?: string;
13
+ urlSlug: string;
14
+ }): Promise<DroppedAsset>;
15
+ }
16
+ export default DroppedAssetFactory;
@@ -0,0 +1,9 @@
1
+ import { Scene, Topia } from "controllers";
2
+ import { SceneOptionalInterface } from "interfaces";
3
+ export declare class SceneFactory {
4
+ topia: Topia;
5
+ constructor(topia: Topia);
6
+ create(id: string, options?: SceneOptionalInterface): Scene;
7
+ get(id: string, options?: SceneOptionalInterface): Promise<Scene>;
8
+ }
9
+ export default SceneFactory;
@@ -0,0 +1,8 @@
1
+ import { Topia, User } from "controllers";
2
+ import { UserOptionalInterface } from "interfaces";
3
+ export declare class UserFactory {
4
+ topia: Topia;
5
+ constructor(topia: Topia);
6
+ create(options?: UserOptionalInterface): User;
7
+ }
8
+ export default UserFactory;
@@ -0,0 +1,9 @@
1
+ import { Topia, Visitor } from "controllers";
2
+ import { VisitorOptionalInterface } from "interfaces";
3
+ export declare class VisitorFactory {
4
+ topia: Topia;
5
+ constructor(topia: Topia);
6
+ create(id: number, urlSlug: string, options?: VisitorOptionalInterface): Visitor;
7
+ get(id: number, urlSlug: string, options?: VisitorOptionalInterface): Promise<Visitor>;
8
+ }
9
+ export default VisitorFactory;
@@ -0,0 +1,8 @@
1
+ import { Topia, WorldActivity } from "controllers";
2
+ import { WorldOptionalInterface } from "interfaces";
3
+ export declare class WorldActivityFactory {
4
+ topia: Topia;
5
+ constructor(topia: Topia);
6
+ create(urlSlug: string, options?: WorldOptionalInterface): WorldActivity;
7
+ }
8
+ export default WorldActivityFactory;
@@ -0,0 +1,8 @@
1
+ import { Topia, World } from "controllers";
2
+ import { WorldOptionalInterface } from "interfaces";
3
+ export declare class WorldFactory {
4
+ topia: Topia;
5
+ constructor(topia: Topia);
6
+ create(urlSlug: string, options?: WorldOptionalInterface): World;
7
+ }
8
+ export default WorldFactory;
@@ -1,7 +1,7 @@
1
- export { AssetFactory } from "./AssetFactory";
2
- export { DroppedAssetFactory } from "./DroppedAssetFactory";
3
- export { SceneFactory } from "./SceneFactory";
4
- export { UserFactory } from "./UserFactory";
5
- export { VisitorFactory } from "./VisitorFactory";
6
- export { WorldActivityFactory } from "./WorldActivityFactory";
7
- export { WorldFactory } from "./WorldFactory";
1
+ export { AssetFactory } from "./AssetFactory";
2
+ export { DroppedAssetFactory } from "./DroppedAssetFactory";
3
+ export { SceneFactory } from "./SceneFactory";
4
+ export { UserFactory } from "./UserFactory";
5
+ export { VisitorFactory } from "./VisitorFactory";
6
+ export { WorldActivityFactory } from "./WorldActivityFactory";
7
+ export { WorldFactory } from "./WorldFactory";
@@ -0,0 +1,4 @@
1
+ export { Topia } from "controllers";
2
+ export { AssetFactory, DroppedAssetFactory, SceneFactory, UserFactory, VisitorFactory, WorldActivityFactory, WorldFactory, } from "factories";
3
+ export type { AssetOptions, DroppedAssetClickType, DroppedAssetMediaType, DroppedAssetOptions, InteractiveCredentials, ResponseType, UserOptions, VisitorOptions, VisitorType, VisitorsToMoveType, VisitorsToMoveArrayType, WorldOptions, } from "types";
4
+ export * from "interfaces";
@@ -0,0 +1,26 @@
1
+ import { InteractiveCredentials } from "types";
2
+ import { SDKInterface } from "interfaces/SDKInterfaces";
3
+ export interface AssetInterface extends SDKInterface {
4
+ fetchPlatformAssets(): Promise<object>;
5
+ addedOn?: string;
6
+ assetName?: string;
7
+ creatorTags?: object;
8
+ readonly id?: string;
9
+ isPublic?: boolean;
10
+ library?: string;
11
+ originalAssetId?: string;
12
+ originalKit?: string;
13
+ ownerId?: string;
14
+ ownerName?: string;
15
+ platformAsset?: boolean;
16
+ purchased?: boolean;
17
+ purchaseDate?: string;
18
+ purchasedFrom?: string;
19
+ specialType?: string | null;
20
+ transactionId?: string;
21
+ type?: string;
22
+ }
23
+ export type AssetOptionalInterface = {
24
+ attributes?: AssetInterface | object;
25
+ credentials?: InteractiveCredentials | object;
26
+ };
@@ -0,0 +1,102 @@
1
+ import { DroppedAssetClickType, DroppedAssetMediaType, InteractiveCredentials } from "types";
2
+ import { AssetInterface } from "interfaces";
3
+ export interface DroppedAssetInterface extends AssetInterface {
4
+ id?: string;
5
+ assetId?: string;
6
+ assetScale?: number | null;
7
+ assetPodium?: boolean | null;
8
+ audioRadius?: number | null;
9
+ assetBroadcastAll?: boolean | null;
10
+ assetPrivateConversation?: boolean | null;
11
+ assetPrivateZoneChannelDisabled?: boolean | null;
12
+ assetPrivateConversationCap?: number | null;
13
+ audioSliderVolume?: number | null;
14
+ broadcasterEmail?: string | null;
15
+ clickType?: string | null;
16
+ clickableLink?: string | null;
17
+ clickableLinkTitle?: string | null;
18
+ clickablePortal?: string | null;
19
+ creationDatetime?: number;
20
+ contractAddress?: string | null;
21
+ dataObject?: object | null;
22
+ clickableDisplayTextDescription?: string | null;
23
+ clickableDisplayTextHeadline?: string | null;
24
+ existingKey?: string | null;
25
+ interactivePublicKey?: string | null;
26
+ isInteractive?: boolean | null;
27
+ isVideoPlayer?: boolean | null;
28
+ kitId?: string | null;
29
+ layer0?: string | null;
30
+ layer1?: string | null;
31
+ mediaLink?: string | null;
32
+ mediaPlayTime?: number | null;
33
+ mediaType?: string | null;
34
+ mediaName?: string | null;
35
+ muteZone?: boolean | null;
36
+ mediaUploadedId?: string | null;
37
+ mediaUploadedLink?: string | null;
38
+ metaName?: string | null;
39
+ position?: {
40
+ x?: number;
41
+ y?: number;
42
+ };
43
+ portalCoordsX?: number | null;
44
+ portalCoordsY?: number | null;
45
+ showMediaAsIfPeer?: boolean | null;
46
+ syncUserMedia?: boolean | null;
47
+ urlSlug: string;
48
+ tagJson?: string | null;
49
+ text?: string | null;
50
+ textColor?: string | null;
51
+ textSize?: number | null;
52
+ textWidth?: number | null;
53
+ textWeight?: string | null;
54
+ textFont?: string | null;
55
+ textFontFamily?: string | null;
56
+ teleportX?: number | null;
57
+ teleportY?: number | null;
58
+ tokenSymbol?: string | null;
59
+ tokenName?: string | null;
60
+ worldId?: string | null;
61
+ walletAddress?: string | null;
62
+ yOrderAdjust?: number | null;
63
+ }
64
+ export interface DroppedAssetOptionalInterface {
65
+ attributes?: DroppedAssetInterface | {
66
+ text: string;
67
+ urlSlug?: string;
68
+ };
69
+ credentials?: InteractiveCredentials | object;
70
+ }
71
+ export interface UpdateBroadcastInterface {
72
+ assetBroadcast?: boolean;
73
+ assetBroadcastAll?: boolean;
74
+ broadcasterEmail?: string;
75
+ }
76
+ export interface UpdateClickTypeInterface {
77
+ clickType: DroppedAssetClickType;
78
+ clickableLink: string;
79
+ clickableLinkTitle: string;
80
+ clickableDisplayTextDescription: string;
81
+ clickableDisplayTextHeadline: string;
82
+ portalName: string;
83
+ position: {
84
+ x: number;
85
+ y: number;
86
+ };
87
+ }
88
+ export interface UpdateMediaTypeInterface {
89
+ audioRadius: number;
90
+ audioSliderVolume: number;
91
+ isVideo: boolean;
92
+ mediaLink: string;
93
+ mediaName: string;
94
+ mediaType: DroppedAssetMediaType;
95
+ portalName: string;
96
+ syncUserMedia: boolean;
97
+ }
98
+ export interface UpdatePrivateZoneInterface {
99
+ isPrivateZone: boolean;
100
+ isPrivateZoneChatDisabled: boolean;
101
+ privateZoneUserCap: number;
102
+ }
@@ -0,0 +1,8 @@
1
+ import { InteractiveCredentials } from "types";
2
+ import { Topia } from "controllers";
3
+ export interface SDKInterface {
4
+ credentials?: InteractiveCredentials;
5
+ jwt?: string;
6
+ requestOptions: object;
7
+ topia: Topia;
8
+ }
@@ -0,0 +1,27 @@
1
+ import { InteractiveCredentials } from "types";
2
+ export interface SceneInterface {
3
+ id: string;
4
+ background?: null;
5
+ description?: string;
6
+ created?: {
7
+ _seconds?: number;
8
+ _nanoseconds?: number;
9
+ };
10
+ height?: number;
11
+ kitWorldOwner?: string;
12
+ name?: string;
13
+ price?: number;
14
+ spawnPosition?: {
15
+ radius?: number;
16
+ y?: number;
17
+ x?: number;
18
+ };
19
+ timesUsed?: number;
20
+ urlSlug?: string;
21
+ width?: number;
22
+ worldCenteredAtZero?: boolean;
23
+ }
24
+ export type SceneOptionalInterface = {
25
+ attributes?: SceneInterface | object;
26
+ credentials?: InteractiveCredentials | object;
27
+ };
@@ -0,0 +1,10 @@
1
+ import { AxiosInstance } from "axios";
2
+ import jwt from "jsonwebtoken";
3
+ export interface TopiaInterface {
4
+ apiDomain?: string;
5
+ apiKey?: string;
6
+ apiProtocol?: string;
7
+ axios: AxiosInstance;
8
+ interactiveKey?: string;
9
+ interactiveSecret?: jwt.Secret;
10
+ }
@@ -0,0 +1,6 @@
1
+ import { InteractiveCredentials } from "types";
2
+ export interface UserOptionalInterface {
3
+ credentials?: InteractiveCredentials | object;
4
+ visitorId?: number | null;
5
+ urlSlug?: string;
6
+ }
@@ -0,0 +1,37 @@
1
+ import { InteractiveCredentials } from "types";
2
+ import { SDKInterface } from "interfaces/SDKInterfaces";
3
+ export interface VisitorInterface extends SDKInterface {
4
+ color?: string;
5
+ displayName?: string;
6
+ gestureType?: number;
7
+ hidden?: boolean;
8
+ isAdmin?: boolean;
9
+ isBackground?: boolean;
10
+ isMobile?: boolean;
11
+ isRecording?: boolean;
12
+ isRecordingBot?: boolean;
13
+ lastUpdate?: number | undefined;
14
+ moveFrom?: object;
15
+ movedOn?: number | undefined;
16
+ moveTo?: {
17
+ x?: number;
18
+ y?: number;
19
+ };
20
+ muted?: boolean;
21
+ performer?: boolean;
22
+ performerNear?: boolean;
23
+ id?: number | undefined;
24
+ shareScreen?: boolean;
25
+ sitting?: boolean;
26
+ urlSlug: string;
27
+ username?: string | undefined;
28
+ }
29
+ export interface VisitorOptionalInterface {
30
+ attributes?: VisitorInterface | object;
31
+ credentials?: InteractiveCredentials | object;
32
+ }
33
+ export interface MoveVisitorInterface {
34
+ shouldTeleportVisitor: boolean;
35
+ x: number;
36
+ y: number;
37
+ }
@@ -0,0 +1,11 @@
1
+ import { InteractiveCredentials } from "types";
2
+ export interface WorldActivityOptionalInterface {
3
+ credentials?: InteractiveCredentials | object;
4
+ }
5
+ export interface MoveAllVisitorsInterface {
6
+ shouldFetchVisitors?: boolean;
7
+ shouldTeleportVisitors?: boolean;
8
+ scatterVisitorsBy?: number;
9
+ x: number;
10
+ y: number;
11
+ }
@@ -0,0 +1,32 @@
1
+ import { InteractiveCredentials } from "types";
2
+ import { SDKInterface } from "interfaces/SDKInterfaces";
3
+ export interface WorldInterface extends SDKInterface {
4
+ background?: string | null;
5
+ controls?: {
6
+ allowMuteAll?: boolean;
7
+ disableHideVideo?: boolean;
8
+ isMobileDisabled?: boolean;
9
+ isShowingCurrentGuests?: boolean;
10
+ };
11
+ created?: object;
12
+ description?: string;
13
+ enforceWhitelistOnLogin?: boolean;
14
+ forceAuthOnLogin?: boolean;
15
+ height?: number;
16
+ heroImage?: string;
17
+ mapExists?: boolean;
18
+ name?: string;
19
+ redirectTo?: string | null;
20
+ spawnPosition?: {
21
+ x?: number;
22
+ y?: number;
23
+ };
24
+ tileBackgroundEverywhere?: boolean | null;
25
+ urlSlug: string;
26
+ useTopiaPassword?: boolean;
27
+ width?: number;
28
+ }
29
+ export interface WorldOptionalInterface {
30
+ attributes?: WorldInterface | object;
31
+ credentials?: InteractiveCredentials | object;
32
+ }
@@ -1,9 +1,9 @@
1
- export * from "./AssetInterfaces";
2
- export * from "./DroppedAssetInterfaces";
3
- export * from "./SceneInterfaces";
4
- export * from "./SDKInterfaces";
5
- export * from "./TopiaInterfaces";
6
- export * from "./UserInterfaces";
7
- export * from "./VisitorInterfaces";
8
- export * from "./WorldActivityInterfaces";
9
- export * from "./WorldInterfaces";
1
+ export * from "./AssetInterfaces";
2
+ export * from "./DroppedAssetInterfaces";
3
+ export * from "./SceneInterfaces";
4
+ export * from "./SDKInterfaces";
5
+ export * from "./TopiaInterfaces";
6
+ export * from "./UserInterfaces";
7
+ export * from "./VisitorInterfaces";
8
+ export * from "./WorldActivityInterfaces";
9
+ export * from "./WorldInterfaces";
@@ -0,0 +1,10 @@
1
+ export declare enum DroppedAssetClickType {
2
+ NONE = "none",
3
+ LINK = "link",
4
+ PORTAL = "portal",
5
+ TELEPORT = "teleport"
6
+ }
7
+ export declare enum DroppedAssetMediaType {
8
+ NONE = "none",
9
+ LINK = "link"
10
+ }
@@ -0,0 +1,8 @@
1
+ export type InteractiveCredentials = {
2
+ assetId?: string;
3
+ interactiveNonce?: string;
4
+ interactivePublicKey?: string;
5
+ visitorId?: number;
6
+ urlSlug?: string;
7
+ apiKey?: string;
8
+ };
@@ -0,0 +1,21 @@
1
+ import { AssetInterface, DroppedAssetInterface, VisitorInterface, WorldInterface } from "interfaces";
2
+ import { InteractiveCredentials } from "./InteractiveCredentialsTypes";
3
+ export type AssetOptions = {
4
+ attributes?: AssetInterface | undefined;
5
+ credentials?: InteractiveCredentials | undefined;
6
+ };
7
+ export type DroppedAssetOptions = {
8
+ attributes?: DroppedAssetInterface | undefined;
9
+ credentials?: InteractiveCredentials | undefined;
10
+ };
11
+ export type UserOptions = {
12
+ credentials?: InteractiveCredentials | undefined;
13
+ };
14
+ export type VisitorOptions = {
15
+ attributes?: VisitorInterface | undefined;
16
+ credentials?: InteractiveCredentials | undefined;
17
+ };
18
+ export type WorldOptions = {
19
+ attributes?: WorldInterface | undefined;
20
+ credentials?: InteractiveCredentials | undefined;
21
+ };
@@ -0,0 +1,4 @@
1
+ export type ResponseType = {
2
+ message: string;
3
+ success: boolean;
4
+ };
@@ -0,0 +1,33 @@
1
+ import Visitor from "../controllers/Visitor";
2
+ export type VisitorType = {
3
+ visitorId: number;
4
+ color: string;
5
+ displayName: string;
6
+ gestureType: number;
7
+ hidden: boolean;
8
+ isAdmin: boolean;
9
+ isBackground: boolean;
10
+ isMobile: boolean;
11
+ isRecording: boolean;
12
+ isRecordingBot: boolean;
13
+ lastUpdate: number;
14
+ moveFrom: object;
15
+ movedOn: number;
16
+ moveTo: {
17
+ x: number;
18
+ y: number;
19
+ };
20
+ muted: boolean;
21
+ performer: boolean;
22
+ performerNear: boolean;
23
+ shareScreen: boolean;
24
+ sitting: boolean;
25
+ username: string;
26
+ };
27
+ export type VisitorsToMoveType = {
28
+ visitorObj: Visitor;
29
+ shouldTeleportVisitor: boolean;
30
+ x: number;
31
+ y: number;
32
+ };
33
+ export type VisitorsToMoveArrayType = Array<VisitorsToMoveType>;
@@ -1,4 +1,5 @@
1
- export * from "./DroppedAssetTypes";
2
- export * from "./InteractiveCredentialsTypes";
3
- export * from "./VisitorTypes";
4
- export * from "./ResponseTypes";
1
+ export * from "./DroppedAssetTypes";
2
+ export * from "./InteractiveCredentialsTypes";
3
+ export * from "./OptionsTypes";
4
+ export * from "./ResponseTypes";
5
+ export * from "./VisitorTypes";
@@ -0,0 +1 @@
1
+ export declare const getBrowserWarning: () => void;
@@ -1,3 +1,3 @@
1
- export { getBrowserWarning } from "./getBrowserWarning";
2
- export { removeUndefined } from "./removeUndefined";
3
- export { scatterVisitors } from "./scatterVisitors";
1
+ export { getBrowserWarning } from "./getBrowserWarning";
2
+ export { removeUndefined } from "./removeUndefined";
3
+ export { scatterVisitors } from "./scatterVisitors";
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Parses object, removes keys with undefined value, and returns clean object.
3
+ */
4
+ export declare const removeUndefined: (obj: {
5
+ [key: string]: any;
6
+ }) => {
7
+ [key: string]: any;
8
+ };
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Returns a random whole number within range of (original number - scatterBy) to (original number + scatterBy)
3
+ */
4
+ export declare const scatterVisitors: (original: number, scatterBy: number) => number;