@workadventure/iframe-api-typings 1.26.15 → 1.26.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@workadventure/iframe-api-typings",
3
- "version": "v1.26.15",
3
+ "version": "v1.26.16",
4
4
  "description": "Typescript typings for WorkAdventure iFrame API",
5
5
  "main": "iframe_api.js",
6
6
  "types": "iframe_api.d.ts",
@@ -1227,15 +1227,15 @@ export declare const isIframeEventWrapper: z.ZodUnion<[z.ZodObject<{
1227
1227
  bgColor: z.ZodOptional<z.ZodString>;
1228
1228
  textColor: z.ZodOptional<z.ZodString>;
1229
1229
  imageSrc: z.ZodOptional<z.ZodString>;
1230
- isGradient: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
1230
+ isGradient: z.ZodOptional<z.ZodBoolean>;
1231
1231
  }, "strip", z.ZodTypeAny, {
1232
1232
  id: string;
1233
- isGradient: boolean;
1234
1233
  label?: string | undefined;
1235
1234
  toolTip?: string | undefined;
1236
1235
  bgColor?: string | undefined;
1237
1236
  textColor?: string | undefined;
1238
1237
  imageSrc?: string | undefined;
1238
+ isGradient?: boolean | undefined;
1239
1239
  }, {
1240
1240
  id: string;
1241
1241
  label?: string | undefined;
@@ -1249,12 +1249,12 @@ export declare const isIframeEventWrapper: z.ZodUnion<[z.ZodObject<{
1249
1249
  type: "addButtonActionBar";
1250
1250
  data: {
1251
1251
  id: string;
1252
- isGradient: boolean;
1253
1252
  label?: string | undefined;
1254
1253
  toolTip?: string | undefined;
1255
1254
  bgColor?: string | undefined;
1256
1255
  textColor?: string | undefined;
1257
1256
  imageSrc?: string | undefined;
1257
+ isGradient?: boolean | undefined;
1258
1258
  };
1259
1259
  }, {
1260
1260
  type: "addButtonActionBar";
@@ -4306,7 +4306,7 @@ export declare const iframeQueryMapTypeGuards: {
4306
4306
  };
4307
4307
  };
4308
4308
  type IframeQueryMapTypeGuardsType = typeof iframeQueryMapTypeGuards;
4309
- type UnknownToVoid<T> = undefined extends T ? void : T;
4309
+ export type UnknownToVoid<T> = undefined extends T ? void : T;
4310
4310
  export type IframeQueryMap = {
4311
4311
  [key in keyof IframeQueryMapTypeGuardsType]: {
4312
4312
  query: z.infer<(typeof iframeQueryMapTypeGuards)[key]["query"]>;
@@ -4344,7 +4344,7 @@ export declare const isIframeErrorAnswerEvent: z.ZodObject<{
4344
4344
  id: number;
4345
4345
  }>;
4346
4346
  /**
4347
- * A message sent from the game to the iFrame when a user enters or leaves a zone.
4347
+ * A message sent from the game to the iFrame when an error occurs while processing a query.
4348
4348
  */
4349
4349
  export type IframeErrorAnswerEvent = z.infer<typeof isIframeErrorAnswerEvent>;
4350
4350
  export {};
@@ -0,0 +1,390 @@
1
+ import { z } from "zod";
2
+ /**
3
+ * List of events that can open a message channel/port between the game and the iFrame.
4
+ * For each message port, we define a type (key), zod validator for data passed on creation, and the
5
+ * list of events that can be sent and received through this message port.
6
+ */
7
+ export declare const iframeMessagePortTypeGuards: {
8
+ joinSpace: {
9
+ data: z.ZodObject<{
10
+ spaceName: z.ZodString;
11
+ filterType: z.ZodEnum<["everyone", "streaming"]>;
12
+ }, "strip", z.ZodTypeAny, {
13
+ spaceName: string;
14
+ filterType: "everyone" | "streaming";
15
+ }, {
16
+ spaceName: string;
17
+ filterType: "everyone" | "streaming";
18
+ }>;
19
+ iframeEvents: z.ZodUnion<[z.ZodObject<{
20
+ type: z.ZodLiteral<"watch">;
21
+ data: z.ZodUndefined;
22
+ }, "strip", z.ZodTypeAny, {
23
+ type: "watch";
24
+ data?: undefined;
25
+ }, {
26
+ type: "watch";
27
+ data?: undefined;
28
+ }>, z.ZodObject<{
29
+ type: z.ZodLiteral<"unwatch">;
30
+ data: z.ZodUndefined;
31
+ }, "strip", z.ZodTypeAny, {
32
+ type: "unwatch";
33
+ data?: undefined;
34
+ }, {
35
+ type: "unwatch";
36
+ data?: undefined;
37
+ }>, z.ZodObject<{
38
+ type: z.ZodLiteral<"leave">;
39
+ data: z.ZodUndefined;
40
+ }, "strip", z.ZodTypeAny, {
41
+ type: "leave";
42
+ data?: undefined;
43
+ }, {
44
+ type: "leave";
45
+ data?: undefined;
46
+ }>, z.ZodObject<{
47
+ type: z.ZodLiteral<"startStreaming">;
48
+ data: z.ZodUndefined;
49
+ }, "strip", z.ZodTypeAny, {
50
+ type: "startStreaming";
51
+ data?: undefined;
52
+ }, {
53
+ type: "startStreaming";
54
+ data?: undefined;
55
+ }>, z.ZodObject<{
56
+ type: z.ZodLiteral<"stopStreaming">;
57
+ data: z.ZodUndefined;
58
+ }, "strip", z.ZodTypeAny, {
59
+ type: "stopStreaming";
60
+ data?: undefined;
61
+ }, {
62
+ type: "stopStreaming";
63
+ data?: undefined;
64
+ }>, z.ZodObject<{
65
+ type: z.ZodLiteral<"setMetadata">;
66
+ data: z.ZodObject<{
67
+ metadata: z.ZodRecord<z.ZodString, z.ZodUnknown>;
68
+ }, "strip", z.ZodTypeAny, {
69
+ metadata: Record<string, unknown>;
70
+ }, {
71
+ metadata: Record<string, unknown>;
72
+ }>;
73
+ }, "strip", z.ZodTypeAny, {
74
+ type: "setMetadata";
75
+ data: {
76
+ metadata: Record<string, unknown>;
77
+ };
78
+ }, {
79
+ type: "setMetadata";
80
+ data: {
81
+ metadata: Record<string, unknown>;
82
+ };
83
+ }>]>;
84
+ workAdventureEvents: z.ZodUnion<[z.ZodObject<{
85
+ type: z.ZodLiteral<"onNewUser">;
86
+ data: z.ZodObject<{
87
+ spaceUserId: z.ZodString;
88
+ name: z.ZodString;
89
+ playUri: z.ZodString;
90
+ isLogged: z.ZodBoolean;
91
+ availabilityStatus: z.ZodNumber;
92
+ tags: z.ZodArray<z.ZodString, "many">;
93
+ cameraState: z.ZodBoolean;
94
+ microphoneState: z.ZodBoolean;
95
+ screenSharingState: z.ZodBoolean;
96
+ megaphoneState: z.ZodBoolean;
97
+ uuid: z.ZodString;
98
+ chatID: z.ZodOptional<z.ZodString>;
99
+ showVoiceIndicator: z.ZodBoolean;
100
+ }, "strip", z.ZodTypeAny, {
101
+ name: string;
102
+ uuid: string;
103
+ tags: string[];
104
+ isLogged: boolean;
105
+ playUri: string;
106
+ availabilityStatus: number;
107
+ spaceUserId: string;
108
+ cameraState: boolean;
109
+ microphoneState: boolean;
110
+ screenSharingState: boolean;
111
+ megaphoneState: boolean;
112
+ showVoiceIndicator: boolean;
113
+ chatID?: string | undefined;
114
+ }, {
115
+ name: string;
116
+ uuid: string;
117
+ tags: string[];
118
+ isLogged: boolean;
119
+ playUri: string;
120
+ availabilityStatus: number;
121
+ spaceUserId: string;
122
+ cameraState: boolean;
123
+ microphoneState: boolean;
124
+ screenSharingState: boolean;
125
+ megaphoneState: boolean;
126
+ showVoiceIndicator: boolean;
127
+ chatID?: string | undefined;
128
+ }>;
129
+ }, "strip", z.ZodTypeAny, {
130
+ type: "onNewUser";
131
+ data: {
132
+ name: string;
133
+ uuid: string;
134
+ tags: string[];
135
+ isLogged: boolean;
136
+ playUri: string;
137
+ availabilityStatus: number;
138
+ spaceUserId: string;
139
+ cameraState: boolean;
140
+ microphoneState: boolean;
141
+ screenSharingState: boolean;
142
+ megaphoneState: boolean;
143
+ showVoiceIndicator: boolean;
144
+ chatID?: string | undefined;
145
+ };
146
+ }, {
147
+ type: "onNewUser";
148
+ data: {
149
+ name: string;
150
+ uuid: string;
151
+ tags: string[];
152
+ isLogged: boolean;
153
+ playUri: string;
154
+ availabilityStatus: number;
155
+ spaceUserId: string;
156
+ cameraState: boolean;
157
+ microphoneState: boolean;
158
+ screenSharingState: boolean;
159
+ megaphoneState: boolean;
160
+ showVoiceIndicator: boolean;
161
+ chatID?: string | undefined;
162
+ };
163
+ }>, z.ZodObject<{
164
+ type: z.ZodLiteral<"onDeleteUser">;
165
+ data: z.ZodObject<{
166
+ spaceUserId: z.ZodString;
167
+ }, "strip", z.ZodTypeAny, {
168
+ spaceUserId: string;
169
+ }, {
170
+ spaceUserId: string;
171
+ }>;
172
+ }, "strip", z.ZodTypeAny, {
173
+ type: "onDeleteUser";
174
+ data: {
175
+ spaceUserId: string;
176
+ };
177
+ }, {
178
+ type: "onDeleteUser";
179
+ data: {
180
+ spaceUserId: string;
181
+ };
182
+ }>, z.ZodObject<{
183
+ type: z.ZodLiteral<"onUpdateUser">;
184
+ data: z.ZodObject<{
185
+ spaceUserId: z.ZodString;
186
+ changes: z.ZodObject<{
187
+ spaceUserId: z.ZodOptional<z.ZodString>;
188
+ name: z.ZodOptional<z.ZodString>;
189
+ playUri: z.ZodOptional<z.ZodString>;
190
+ isLogged: z.ZodOptional<z.ZodBoolean>;
191
+ availabilityStatus: z.ZodOptional<z.ZodNumber>;
192
+ tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
193
+ cameraState: z.ZodOptional<z.ZodBoolean>;
194
+ microphoneState: z.ZodOptional<z.ZodBoolean>;
195
+ screenSharingState: z.ZodOptional<z.ZodBoolean>;
196
+ megaphoneState: z.ZodOptional<z.ZodBoolean>;
197
+ uuid: z.ZodOptional<z.ZodString>;
198
+ chatID: z.ZodOptional<z.ZodOptional<z.ZodString>>;
199
+ showVoiceIndicator: z.ZodOptional<z.ZodBoolean>;
200
+ }, "strip", z.ZodTypeAny, {
201
+ name?: string | undefined;
202
+ uuid?: string | undefined;
203
+ tags?: string[] | undefined;
204
+ isLogged?: boolean | undefined;
205
+ playUri?: string | undefined;
206
+ availabilityStatus?: number | undefined;
207
+ chatID?: string | undefined;
208
+ spaceUserId?: string | undefined;
209
+ cameraState?: boolean | undefined;
210
+ microphoneState?: boolean | undefined;
211
+ screenSharingState?: boolean | undefined;
212
+ megaphoneState?: boolean | undefined;
213
+ showVoiceIndicator?: boolean | undefined;
214
+ }, {
215
+ name?: string | undefined;
216
+ uuid?: string | undefined;
217
+ tags?: string[] | undefined;
218
+ isLogged?: boolean | undefined;
219
+ playUri?: string | undefined;
220
+ availabilityStatus?: number | undefined;
221
+ chatID?: string | undefined;
222
+ spaceUserId?: string | undefined;
223
+ cameraState?: boolean | undefined;
224
+ microphoneState?: boolean | undefined;
225
+ screenSharingState?: boolean | undefined;
226
+ megaphoneState?: boolean | undefined;
227
+ showVoiceIndicator?: boolean | undefined;
228
+ }>;
229
+ updateMask: z.ZodArray<z.ZodString, "many">;
230
+ }, "strip", z.ZodTypeAny, {
231
+ spaceUserId: string;
232
+ changes: {
233
+ name?: string | undefined;
234
+ uuid?: string | undefined;
235
+ tags?: string[] | undefined;
236
+ isLogged?: boolean | undefined;
237
+ playUri?: string | undefined;
238
+ availabilityStatus?: number | undefined;
239
+ chatID?: string | undefined;
240
+ spaceUserId?: string | undefined;
241
+ cameraState?: boolean | undefined;
242
+ microphoneState?: boolean | undefined;
243
+ screenSharingState?: boolean | undefined;
244
+ megaphoneState?: boolean | undefined;
245
+ showVoiceIndicator?: boolean | undefined;
246
+ };
247
+ updateMask: string[];
248
+ }, {
249
+ spaceUserId: string;
250
+ changes: {
251
+ name?: string | undefined;
252
+ uuid?: string | undefined;
253
+ tags?: string[] | undefined;
254
+ isLogged?: boolean | undefined;
255
+ playUri?: string | undefined;
256
+ availabilityStatus?: number | undefined;
257
+ chatID?: string | undefined;
258
+ spaceUserId?: string | undefined;
259
+ cameraState?: boolean | undefined;
260
+ microphoneState?: boolean | undefined;
261
+ screenSharingState?: boolean | undefined;
262
+ megaphoneState?: boolean | undefined;
263
+ showVoiceIndicator?: boolean | undefined;
264
+ };
265
+ updateMask: string[];
266
+ }>;
267
+ }, "strip", z.ZodTypeAny, {
268
+ type: "onUpdateUser";
269
+ data: {
270
+ spaceUserId: string;
271
+ changes: {
272
+ name?: string | undefined;
273
+ uuid?: string | undefined;
274
+ tags?: string[] | undefined;
275
+ isLogged?: boolean | undefined;
276
+ playUri?: string | undefined;
277
+ availabilityStatus?: number | undefined;
278
+ chatID?: string | undefined;
279
+ spaceUserId?: string | undefined;
280
+ cameraState?: boolean | undefined;
281
+ microphoneState?: boolean | undefined;
282
+ screenSharingState?: boolean | undefined;
283
+ megaphoneState?: boolean | undefined;
284
+ showVoiceIndicator?: boolean | undefined;
285
+ };
286
+ updateMask: string[];
287
+ };
288
+ }, {
289
+ type: "onUpdateUser";
290
+ data: {
291
+ spaceUserId: string;
292
+ changes: {
293
+ name?: string | undefined;
294
+ uuid?: string | undefined;
295
+ tags?: string[] | undefined;
296
+ isLogged?: boolean | undefined;
297
+ playUri?: string | undefined;
298
+ availabilityStatus?: number | undefined;
299
+ chatID?: string | undefined;
300
+ spaceUserId?: string | undefined;
301
+ cameraState?: boolean | undefined;
302
+ microphoneState?: boolean | undefined;
303
+ screenSharingState?: boolean | undefined;
304
+ megaphoneState?: boolean | undefined;
305
+ showVoiceIndicator?: boolean | undefined;
306
+ };
307
+ updateMask: string[];
308
+ };
309
+ }>, z.ZodObject<{
310
+ type: z.ZodLiteral<"onSetMetadata">;
311
+ data: z.ZodObject<{
312
+ metadata: z.ZodRecord<z.ZodString, z.ZodUnknown>;
313
+ }, "strip", z.ZodTypeAny, {
314
+ metadata: Record<string, unknown>;
315
+ }, {
316
+ metadata: Record<string, unknown>;
317
+ }>;
318
+ }, "strip", z.ZodTypeAny, {
319
+ type: "onSetMetadata";
320
+ data: {
321
+ metadata: Record<string, unknown>;
322
+ };
323
+ }, {
324
+ type: "onSetMetadata";
325
+ data: {
326
+ metadata: Record<string, unknown>;
327
+ };
328
+ }>]>;
329
+ };
330
+ };
331
+ type IframeMessagePortTypeGuards = typeof iframeMessagePortTypeGuards;
332
+ export type IframeMessagePortMap = {
333
+ [key in keyof IframeMessagePortTypeGuards]: {
334
+ data: z.infer<IframeMessagePortTypeGuards[key]["data"]>;
335
+ iframeEvents: z.infer<IframeMessagePortTypeGuards[key]["iframeEvents"]>;
336
+ workAdventureEvents: IframeMessagePortTypeGuards[key]["workAdventureEvents"];
337
+ };
338
+ };
339
+ export interface IframeMessagePortData<T extends keyof IframeMessagePortMap> {
340
+ type: T;
341
+ data: IframeMessagePortMap[T]["data"];
342
+ }
343
+ export interface MessagePortIframeEvent<T extends keyof IframeMessagePortMap> {
344
+ type: T;
345
+ data: IframeMessagePortMap[T]["iframeEvents"];
346
+ }
347
+ export interface MessagePortWorkAdventureEvent<T extends keyof IframeMessagePortMap> {
348
+ type: T;
349
+ data: IframeMessagePortMap[T]["workAdventureEvents"];
350
+ }
351
+ export declare const isIframeMessagePortType: (type: string) => type is keyof IframeMessagePortMap;
352
+ export interface IframeMessagePortWrapper<T extends keyof IframeMessagePortMap> {
353
+ messagePort: true;
354
+ id: number;
355
+ type: T;
356
+ data: IframeMessagePortMap[T]["data"];
357
+ }
358
+ export declare const isIframeMessagePortWrapper: (event: any) => event is IframeMessagePortWrapper<keyof IframeMessagePortMap>;
359
+ export declare const isIframeErrorMessagePortEvent: z.ZodObject<{
360
+ id: z.ZodNumber;
361
+ error: z.ZodString;
362
+ messagePort: z.ZodLiteral<true>;
363
+ }, "strip", z.ZodTypeAny, {
364
+ error: string;
365
+ id: number;
366
+ messagePort: true;
367
+ }, {
368
+ error: string;
369
+ id: number;
370
+ messagePort: true;
371
+ }>;
372
+ /**
373
+ * A message sent from the game to the iFrame when an error occurs while processing a message port opening.
374
+ */
375
+ export type IframeErrorMessagePortEvent = z.infer<typeof isIframeErrorMessagePortEvent>;
376
+ export declare const isIframeSuccessMessagePortEvent: z.ZodObject<{
377
+ id: z.ZodNumber;
378
+ messagePort: z.ZodLiteral<true>;
379
+ }, "strip", z.ZodTypeAny, {
380
+ id: number;
381
+ messagePort: true;
382
+ }, {
383
+ id: number;
384
+ messagePort: true;
385
+ }>;
386
+ /**
387
+ * A message sent from the game to the iFrame when an error occurs while processing a message port opening.
388
+ */
389
+ export type IframeSuccessMessagePortEvent = z.infer<typeof isIframeSuccessMessagePortEvent>;
390
+ export {};
@@ -0,0 +1,45 @@
1
+ import { z } from "zod";
2
+ export declare const NewSpaceUserEvent: z.ZodObject<{
3
+ spaceUserId: z.ZodString;
4
+ name: z.ZodString;
5
+ playUri: z.ZodString;
6
+ isLogged: z.ZodBoolean;
7
+ availabilityStatus: z.ZodNumber;
8
+ tags: z.ZodArray<z.ZodString, "many">;
9
+ cameraState: z.ZodBoolean;
10
+ microphoneState: z.ZodBoolean;
11
+ screenSharingState: z.ZodBoolean;
12
+ megaphoneState: z.ZodBoolean;
13
+ uuid: z.ZodString;
14
+ chatID: z.ZodOptional<z.ZodString>;
15
+ showVoiceIndicator: z.ZodBoolean;
16
+ }, "strip", z.ZodTypeAny, {
17
+ name: string;
18
+ uuid: string;
19
+ tags: string[];
20
+ isLogged: boolean;
21
+ playUri: string;
22
+ availabilityStatus: number;
23
+ spaceUserId: string;
24
+ cameraState: boolean;
25
+ microphoneState: boolean;
26
+ screenSharingState: boolean;
27
+ megaphoneState: boolean;
28
+ showVoiceIndicator: boolean;
29
+ chatID?: string | undefined;
30
+ }, {
31
+ name: string;
32
+ uuid: string;
33
+ tags: string[];
34
+ isLogged: boolean;
35
+ playUri: string;
36
+ availabilityStatus: number;
37
+ spaceUserId: string;
38
+ cameraState: boolean;
39
+ microphoneState: boolean;
40
+ screenSharingState: boolean;
41
+ megaphoneState: boolean;
42
+ showVoiceIndicator: boolean;
43
+ chatID?: string | undefined;
44
+ }>;
45
+ export type NewSpaceUserEvent = z.infer<typeof NewSpaceUserEvent>;
@@ -6,15 +6,15 @@ export declare const isAddActionBarButtonEvent: z.ZodObject<{
6
6
  bgColor: z.ZodOptional<z.ZodString>;
7
7
  textColor: z.ZodOptional<z.ZodString>;
8
8
  imageSrc: z.ZodOptional<z.ZodString>;
9
- isGradient: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
9
+ isGradient: z.ZodOptional<z.ZodBoolean>;
10
10
  }, "strip", z.ZodTypeAny, {
11
11
  id: string;
12
- isGradient: boolean;
13
12
  label?: string | undefined;
14
13
  toolTip?: string | undefined;
15
14
  bgColor?: string | undefined;
16
15
  textColor?: string | undefined;
17
16
  imageSrc?: string | undefined;
17
+ isGradient?: boolean | undefined;
18
18
  }, {
19
19
  id: string;
20
20
  label?: string | undefined;
@@ -0,0 +1,18 @@
1
+ import { z } from "zod";
2
+ import { Observable } from "rxjs";
3
+ import { IframeMessagePortMap, MessagePortIframeEvent, MessagePortWorkAdventureEvent } from "../Events/MessagePortEvents";
4
+ type MessagePortMessageEvent<K extends keyof IframeMessagePortMap> = MessageEvent<z.infer<MessagePortWorkAdventureEvent<K>["data"]>>;
5
+ /**
6
+ * A wrapper around a MessagePort that ensures the messages sent and received conform to a specific type.
7
+ * This class is used on the iframe side to communicate with the main application.
8
+ */
9
+ export declare class CheckedIframeMessagePort<K extends keyof IframeMessagePortMap> {
10
+ private type;
11
+ private readonly port;
12
+ private readonly _messages;
13
+ readonly messages: Observable<MessagePortMessageEvent<K>>;
14
+ constructor(port: MessagePort, type: K);
15
+ postMessage(message: MessagePortIframeEvent<K>["data"]): void;
16
+ close(): void;
17
+ }
18
+ export {};
@@ -1,10 +1,17 @@
1
- import type { IframeEvent, IframeQuery, IframeQueryMap } from "../Events/IframeEvent";
1
+ import { IframeEvent, IframeQuery, IframeQueryMap } from "../Events/IframeEvent";
2
+ import { IframeMessagePortData, IframeMessagePortMap } from "../Events/MessagePortEvents";
3
+ import { CheckedIframeMessagePort } from "./CheckedIframeMessagePort";
2
4
  export declare function sendToWorkadventure(content: IframeEvent, transfer?: Transferable[]): void;
3
5
  export declare const answerPromises: Map<number, {
4
6
  resolve: (value: IframeQueryMap[keyof IframeQueryMap]["answer"] | PromiseLike<IframeQueryMap[keyof IframeQueryMap]["answer"]>) => void;
5
7
  reject: (reason?: any) => void;
6
8
  }>;
9
+ export declare const answerPromisesMessagePort: Map<number, {
10
+ resolve: () => void;
11
+ reject: (reason?: any) => void;
12
+ }>;
7
13
  export declare function queryWorkadventure<T extends keyof IframeQueryMap>(content: IframeQuery<T>, transfer?: Transferable[]): Promise<IframeQueryMap[T]["answer"]>;
14
+ export declare function openMessagePort<K extends keyof IframeMessagePortMap>(type: K, data: IframeMessagePortData<K>["data"]): Promise<CheckedIframeMessagePort<K>>;
8
15
  /**
9
16
  * !! be aware that the implemented attributes (addMethodsAtRoot and subObjectIdentifier) must be readonly
10
17
  *
@@ -0,0 +1,25 @@
1
+ import { Observable } from "rxjs";
2
+ import { CheckedIframeMessagePort } from "../CheckedIframeMessagePort";
3
+ import { SpaceUser } from "./SpaceUser";
4
+ export declare class Space {
5
+ private readonly port;
6
+ private watchCount;
7
+ private messagesSubscription;
8
+ private readonly users;
9
+ readonly userJoinedObservable: Observable<SpaceUser>;
10
+ readonly userLeftObservable: Observable<SpaceUser>;
11
+ readonly metadataObservable: Observable<Map<string, unknown>>;
12
+ private _userJoinedSubscriber;
13
+ private _userLeftSubscriber;
14
+ private _metadataSubscriber;
15
+ private left;
16
+ private metadata;
17
+ constructor(port: CheckedIframeMessagePort<"joinSpace">);
18
+ private createReactiveUser;
19
+ private watch;
20
+ private unwatch;
21
+ leave(): void;
22
+ startStreaming(): void;
23
+ stopStreaming(): void;
24
+ setMetadata(metadata: Map<string, unknown>): void;
25
+ }
@@ -0,0 +1,8 @@
1
+ import { Observable } from "rxjs";
2
+ import { NewSpaceUserEvent } from "../../Events/NewSpaceUserEvent";
3
+ export type SpaceUser = NewSpaceUserEvent & {
4
+ reactiveUser: ReactiveSpaceUser;
5
+ };
6
+ export type ReactiveSpaceUser = {
7
+ [K in keyof Omit<SpaceUser, "spaceUserId">]: Readonly<Observable<SpaceUser[K]>>;
8
+ };
@@ -0,0 +1,22 @@
1
+ import { IframeApiContribution } from "./IframeApiContribution";
2
+ import { Space } from "./Spaces/Space";
3
+ export declare class WorkAdventureSpacesCommands extends IframeApiContribution<WorkAdventureSpacesCommands> {
4
+ callbacks: never[];
5
+ /**
6
+ * Joins a space.
7
+ * A space is a structure containing a set of players.
8
+ * Players in a space can talk to each others.
9
+ *
10
+ * Use this if you want some players to be able to talk to each others without going through a bubble or a meeting room.
11
+ * Note: users in the same world, but on different maps, can be part of the same space.
12
+ * The spaceName is scope to the world.
13
+ *
14
+ * {@link https://docs.workadventu.re/map-building/api-spaces.md#start-following-player | Website documentation}
15
+ *
16
+ * @param {string} spaceName Name of the space to join
17
+ * @param {("everyone"|"streaming")} filterType Type of filter to apply when joining the space. THis must match the filter decided by the first person joining the space.
18
+ */
19
+ joinSpace(spaceName: string, filterType: "everyone" | "streaming"): Promise<Space>;
20
+ }
21
+ declare const _default: WorkAdventureSpacesCommands;
22
+ export default _default;
@@ -29,6 +29,7 @@ declare const wa: {
29
29
  player: import("./front/Api/Iframe/player").WorkadventurePlayerCommands;
30
30
  players: import("./front/Api/Iframe/players").WorkadventurePlayersCommands;
31
31
  camera: import("./front/Api/Iframe/camera").WorkAdventureCameraCommands;
32
+ spaces: import("./front/Api/Iframe/spaces").WorkAdventureSpacesCommands;
32
33
  state: import("./front/Api/Iframe/state").WorkadventureStateCommands & import("./front/Api/Iframe/RoomState").RoomState;
33
34
  event: import("./front/Api/Iframe/event").WorkadventureEventCommands;
34
35
  mapEditor: import("./front/Api/Iframe/mapEditor").WorkadventureMapEditorCommands;