@workadventure/iframe-api-typings 1.25.14 → 1.26.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.
- package/package.json +1 -1
- package/play/src/front/Api/Events/IframeEvent.d.ts +5 -5
- package/play/src/front/Api/Events/MessagePortEvents.d.ts +352 -0
- package/play/src/front/Api/Events/NewSpaceUserEvent.d.ts +45 -0
- package/play/src/front/Api/Events/Ui/ButtonActionBarEvent.d.ts +2 -2
- package/play/src/front/Api/Iframe/CheckedIframeMessagePort.d.ts +18 -0
- package/play/src/front/Api/Iframe/IframeApiContribution.d.ts +8 -1
- package/play/src/front/Api/Iframe/Spaces/Space.d.ts +21 -0
- package/play/src/front/Api/Iframe/Spaces/SpaceUser.d.ts +8 -0
- package/play/src/front/Api/Iframe/spaces.d.ts +22 -0
- package/play/src/iframe_api.d.ts +1 -0
package/package.json
CHANGED
|
@@ -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.
|
|
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
|
|
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,352 @@
|
|
|
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
|
+
}>]>;
|
|
65
|
+
workAdventureEvents: z.ZodUnion<[z.ZodObject<{
|
|
66
|
+
type: z.ZodLiteral<"onNewUser">;
|
|
67
|
+
data: z.ZodObject<{
|
|
68
|
+
spaceUserId: z.ZodString;
|
|
69
|
+
name: z.ZodString;
|
|
70
|
+
playUri: z.ZodString;
|
|
71
|
+
isLogged: z.ZodBoolean;
|
|
72
|
+
availabilityStatus: z.ZodNumber;
|
|
73
|
+
tags: z.ZodArray<z.ZodString, "many">;
|
|
74
|
+
cameraState: z.ZodBoolean;
|
|
75
|
+
microphoneState: z.ZodBoolean;
|
|
76
|
+
screenSharingState: z.ZodBoolean;
|
|
77
|
+
megaphoneState: z.ZodBoolean;
|
|
78
|
+
uuid: z.ZodString;
|
|
79
|
+
chatID: z.ZodOptional<z.ZodString>;
|
|
80
|
+
showVoiceIndicator: z.ZodBoolean;
|
|
81
|
+
}, "strip", z.ZodTypeAny, {
|
|
82
|
+
name: string;
|
|
83
|
+
uuid: string;
|
|
84
|
+
tags: string[];
|
|
85
|
+
isLogged: boolean;
|
|
86
|
+
playUri: string;
|
|
87
|
+
availabilityStatus: number;
|
|
88
|
+
spaceUserId: string;
|
|
89
|
+
cameraState: boolean;
|
|
90
|
+
microphoneState: boolean;
|
|
91
|
+
screenSharingState: boolean;
|
|
92
|
+
megaphoneState: boolean;
|
|
93
|
+
showVoiceIndicator: boolean;
|
|
94
|
+
chatID?: string | undefined;
|
|
95
|
+
}, {
|
|
96
|
+
name: string;
|
|
97
|
+
uuid: string;
|
|
98
|
+
tags: string[];
|
|
99
|
+
isLogged: boolean;
|
|
100
|
+
playUri: string;
|
|
101
|
+
availabilityStatus: number;
|
|
102
|
+
spaceUserId: string;
|
|
103
|
+
cameraState: boolean;
|
|
104
|
+
microphoneState: boolean;
|
|
105
|
+
screenSharingState: boolean;
|
|
106
|
+
megaphoneState: boolean;
|
|
107
|
+
showVoiceIndicator: boolean;
|
|
108
|
+
chatID?: string | undefined;
|
|
109
|
+
}>;
|
|
110
|
+
}, "strip", z.ZodTypeAny, {
|
|
111
|
+
type: "onNewUser";
|
|
112
|
+
data: {
|
|
113
|
+
name: string;
|
|
114
|
+
uuid: string;
|
|
115
|
+
tags: string[];
|
|
116
|
+
isLogged: boolean;
|
|
117
|
+
playUri: string;
|
|
118
|
+
availabilityStatus: number;
|
|
119
|
+
spaceUserId: string;
|
|
120
|
+
cameraState: boolean;
|
|
121
|
+
microphoneState: boolean;
|
|
122
|
+
screenSharingState: boolean;
|
|
123
|
+
megaphoneState: boolean;
|
|
124
|
+
showVoiceIndicator: boolean;
|
|
125
|
+
chatID?: string | undefined;
|
|
126
|
+
};
|
|
127
|
+
}, {
|
|
128
|
+
type: "onNewUser";
|
|
129
|
+
data: {
|
|
130
|
+
name: string;
|
|
131
|
+
uuid: string;
|
|
132
|
+
tags: string[];
|
|
133
|
+
isLogged: boolean;
|
|
134
|
+
playUri: string;
|
|
135
|
+
availabilityStatus: number;
|
|
136
|
+
spaceUserId: string;
|
|
137
|
+
cameraState: boolean;
|
|
138
|
+
microphoneState: boolean;
|
|
139
|
+
screenSharingState: boolean;
|
|
140
|
+
megaphoneState: boolean;
|
|
141
|
+
showVoiceIndicator: boolean;
|
|
142
|
+
chatID?: string | undefined;
|
|
143
|
+
};
|
|
144
|
+
}>, z.ZodObject<{
|
|
145
|
+
type: z.ZodLiteral<"onDeleteUser">;
|
|
146
|
+
data: z.ZodObject<{
|
|
147
|
+
spaceUserId: z.ZodString;
|
|
148
|
+
}, "strip", z.ZodTypeAny, {
|
|
149
|
+
spaceUserId: string;
|
|
150
|
+
}, {
|
|
151
|
+
spaceUserId: string;
|
|
152
|
+
}>;
|
|
153
|
+
}, "strip", z.ZodTypeAny, {
|
|
154
|
+
type: "onDeleteUser";
|
|
155
|
+
data: {
|
|
156
|
+
spaceUserId: string;
|
|
157
|
+
};
|
|
158
|
+
}, {
|
|
159
|
+
type: "onDeleteUser";
|
|
160
|
+
data: {
|
|
161
|
+
spaceUserId: string;
|
|
162
|
+
};
|
|
163
|
+
}>, z.ZodObject<{
|
|
164
|
+
type: z.ZodLiteral<"onUpdateUser">;
|
|
165
|
+
data: z.ZodObject<{
|
|
166
|
+
spaceUserId: z.ZodString;
|
|
167
|
+
changes: z.ZodObject<{
|
|
168
|
+
spaceUserId: z.ZodOptional<z.ZodString>;
|
|
169
|
+
name: z.ZodOptional<z.ZodString>;
|
|
170
|
+
playUri: z.ZodOptional<z.ZodString>;
|
|
171
|
+
isLogged: z.ZodOptional<z.ZodBoolean>;
|
|
172
|
+
availabilityStatus: z.ZodOptional<z.ZodNumber>;
|
|
173
|
+
tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
174
|
+
cameraState: z.ZodOptional<z.ZodBoolean>;
|
|
175
|
+
microphoneState: z.ZodOptional<z.ZodBoolean>;
|
|
176
|
+
screenSharingState: z.ZodOptional<z.ZodBoolean>;
|
|
177
|
+
megaphoneState: z.ZodOptional<z.ZodBoolean>;
|
|
178
|
+
uuid: z.ZodOptional<z.ZodString>;
|
|
179
|
+
chatID: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
180
|
+
showVoiceIndicator: z.ZodOptional<z.ZodBoolean>;
|
|
181
|
+
}, "strip", z.ZodTypeAny, {
|
|
182
|
+
name?: string | undefined;
|
|
183
|
+
uuid?: string | undefined;
|
|
184
|
+
tags?: string[] | undefined;
|
|
185
|
+
isLogged?: boolean | undefined;
|
|
186
|
+
playUri?: string | undefined;
|
|
187
|
+
availabilityStatus?: number | undefined;
|
|
188
|
+
chatID?: string | undefined;
|
|
189
|
+
spaceUserId?: string | undefined;
|
|
190
|
+
cameraState?: boolean | undefined;
|
|
191
|
+
microphoneState?: boolean | undefined;
|
|
192
|
+
screenSharingState?: boolean | undefined;
|
|
193
|
+
megaphoneState?: boolean | undefined;
|
|
194
|
+
showVoiceIndicator?: boolean | undefined;
|
|
195
|
+
}, {
|
|
196
|
+
name?: string | undefined;
|
|
197
|
+
uuid?: string | undefined;
|
|
198
|
+
tags?: string[] | undefined;
|
|
199
|
+
isLogged?: boolean | undefined;
|
|
200
|
+
playUri?: string | undefined;
|
|
201
|
+
availabilityStatus?: number | undefined;
|
|
202
|
+
chatID?: string | undefined;
|
|
203
|
+
spaceUserId?: string | undefined;
|
|
204
|
+
cameraState?: boolean | undefined;
|
|
205
|
+
microphoneState?: boolean | undefined;
|
|
206
|
+
screenSharingState?: boolean | undefined;
|
|
207
|
+
megaphoneState?: boolean | undefined;
|
|
208
|
+
showVoiceIndicator?: boolean | undefined;
|
|
209
|
+
}>;
|
|
210
|
+
updateMask: z.ZodArray<z.ZodString, "many">;
|
|
211
|
+
}, "strip", z.ZodTypeAny, {
|
|
212
|
+
spaceUserId: string;
|
|
213
|
+
changes: {
|
|
214
|
+
name?: string | undefined;
|
|
215
|
+
uuid?: string | undefined;
|
|
216
|
+
tags?: string[] | undefined;
|
|
217
|
+
isLogged?: boolean | undefined;
|
|
218
|
+
playUri?: string | undefined;
|
|
219
|
+
availabilityStatus?: number | undefined;
|
|
220
|
+
chatID?: string | undefined;
|
|
221
|
+
spaceUserId?: string | undefined;
|
|
222
|
+
cameraState?: boolean | undefined;
|
|
223
|
+
microphoneState?: boolean | undefined;
|
|
224
|
+
screenSharingState?: boolean | undefined;
|
|
225
|
+
megaphoneState?: boolean | undefined;
|
|
226
|
+
showVoiceIndicator?: boolean | undefined;
|
|
227
|
+
};
|
|
228
|
+
updateMask: string[];
|
|
229
|
+
}, {
|
|
230
|
+
spaceUserId: string;
|
|
231
|
+
changes: {
|
|
232
|
+
name?: string | undefined;
|
|
233
|
+
uuid?: string | undefined;
|
|
234
|
+
tags?: string[] | undefined;
|
|
235
|
+
isLogged?: boolean | undefined;
|
|
236
|
+
playUri?: string | undefined;
|
|
237
|
+
availabilityStatus?: number | undefined;
|
|
238
|
+
chatID?: string | undefined;
|
|
239
|
+
spaceUserId?: string | undefined;
|
|
240
|
+
cameraState?: boolean | undefined;
|
|
241
|
+
microphoneState?: boolean | undefined;
|
|
242
|
+
screenSharingState?: boolean | undefined;
|
|
243
|
+
megaphoneState?: boolean | undefined;
|
|
244
|
+
showVoiceIndicator?: boolean | undefined;
|
|
245
|
+
};
|
|
246
|
+
updateMask: string[];
|
|
247
|
+
}>;
|
|
248
|
+
}, "strip", z.ZodTypeAny, {
|
|
249
|
+
type: "onUpdateUser";
|
|
250
|
+
data: {
|
|
251
|
+
spaceUserId: string;
|
|
252
|
+
changes: {
|
|
253
|
+
name?: string | undefined;
|
|
254
|
+
uuid?: string | undefined;
|
|
255
|
+
tags?: string[] | undefined;
|
|
256
|
+
isLogged?: boolean | undefined;
|
|
257
|
+
playUri?: string | undefined;
|
|
258
|
+
availabilityStatus?: number | undefined;
|
|
259
|
+
chatID?: string | undefined;
|
|
260
|
+
spaceUserId?: string | undefined;
|
|
261
|
+
cameraState?: boolean | undefined;
|
|
262
|
+
microphoneState?: boolean | undefined;
|
|
263
|
+
screenSharingState?: boolean | undefined;
|
|
264
|
+
megaphoneState?: boolean | undefined;
|
|
265
|
+
showVoiceIndicator?: boolean | undefined;
|
|
266
|
+
};
|
|
267
|
+
updateMask: string[];
|
|
268
|
+
};
|
|
269
|
+
}, {
|
|
270
|
+
type: "onUpdateUser";
|
|
271
|
+
data: {
|
|
272
|
+
spaceUserId: string;
|
|
273
|
+
changes: {
|
|
274
|
+
name?: string | undefined;
|
|
275
|
+
uuid?: string | undefined;
|
|
276
|
+
tags?: string[] | undefined;
|
|
277
|
+
isLogged?: boolean | undefined;
|
|
278
|
+
playUri?: string | undefined;
|
|
279
|
+
availabilityStatus?: number | undefined;
|
|
280
|
+
chatID?: string | undefined;
|
|
281
|
+
spaceUserId?: string | undefined;
|
|
282
|
+
cameraState?: boolean | undefined;
|
|
283
|
+
microphoneState?: boolean | undefined;
|
|
284
|
+
screenSharingState?: boolean | undefined;
|
|
285
|
+
megaphoneState?: boolean | undefined;
|
|
286
|
+
showVoiceIndicator?: boolean | undefined;
|
|
287
|
+
};
|
|
288
|
+
updateMask: string[];
|
|
289
|
+
};
|
|
290
|
+
}>]>;
|
|
291
|
+
};
|
|
292
|
+
};
|
|
293
|
+
type IframeMessagePortTypeGuards = typeof iframeMessagePortTypeGuards;
|
|
294
|
+
export type IframeMessagePortMap = {
|
|
295
|
+
[key in keyof IframeMessagePortTypeGuards]: {
|
|
296
|
+
data: z.infer<IframeMessagePortTypeGuards[key]["data"]>;
|
|
297
|
+
iframeEvents: z.infer<IframeMessagePortTypeGuards[key]["iframeEvents"]>;
|
|
298
|
+
workAdventureEvents: IframeMessagePortTypeGuards[key]["workAdventureEvents"];
|
|
299
|
+
};
|
|
300
|
+
};
|
|
301
|
+
export interface IframeMessagePortData<T extends keyof IframeMessagePortMap> {
|
|
302
|
+
type: T;
|
|
303
|
+
data: IframeMessagePortMap[T]["data"];
|
|
304
|
+
}
|
|
305
|
+
export interface MessagePortIframeEvent<T extends keyof IframeMessagePortMap> {
|
|
306
|
+
type: T;
|
|
307
|
+
data: IframeMessagePortMap[T]["iframeEvents"];
|
|
308
|
+
}
|
|
309
|
+
export interface MessagePortWorkAdventureEvent<T extends keyof IframeMessagePortMap> {
|
|
310
|
+
type: T;
|
|
311
|
+
data: IframeMessagePortMap[T]["workAdventureEvents"];
|
|
312
|
+
}
|
|
313
|
+
export declare const isIframeMessagePortType: (type: string) => type is keyof IframeMessagePortMap;
|
|
314
|
+
export interface IframeMessagePortWrapper<T extends keyof IframeMessagePortMap> {
|
|
315
|
+
messagePort: true;
|
|
316
|
+
id: number;
|
|
317
|
+
type: T;
|
|
318
|
+
data: IframeMessagePortMap[T]["data"];
|
|
319
|
+
}
|
|
320
|
+
export declare const isIframeMessagePortWrapper: (event: any) => event is IframeMessagePortWrapper<keyof IframeMessagePortMap>;
|
|
321
|
+
export declare const isIframeErrorMessagePortEvent: z.ZodObject<{
|
|
322
|
+
id: z.ZodNumber;
|
|
323
|
+
error: z.ZodString;
|
|
324
|
+
messagePort: z.ZodLiteral<true>;
|
|
325
|
+
}, "strip", z.ZodTypeAny, {
|
|
326
|
+
error: string;
|
|
327
|
+
id: number;
|
|
328
|
+
messagePort: true;
|
|
329
|
+
}, {
|
|
330
|
+
error: string;
|
|
331
|
+
id: number;
|
|
332
|
+
messagePort: true;
|
|
333
|
+
}>;
|
|
334
|
+
/**
|
|
335
|
+
* A message sent from the game to the iFrame when an error occurs while processing a message port opening.
|
|
336
|
+
*/
|
|
337
|
+
export type IframeErrorMessagePortEvent = z.infer<typeof isIframeErrorMessagePortEvent>;
|
|
338
|
+
export declare const isIframeSuccessMessagePortEvent: z.ZodObject<{
|
|
339
|
+
id: z.ZodNumber;
|
|
340
|
+
messagePort: z.ZodLiteral<true>;
|
|
341
|
+
}, "strip", z.ZodTypeAny, {
|
|
342
|
+
id: number;
|
|
343
|
+
messagePort: true;
|
|
344
|
+
}, {
|
|
345
|
+
id: number;
|
|
346
|
+
messagePort: true;
|
|
347
|
+
}>;
|
|
348
|
+
/**
|
|
349
|
+
* A message sent from the game to the iFrame when an error occurs while processing a message port opening.
|
|
350
|
+
*/
|
|
351
|
+
export type IframeSuccessMessagePortEvent = z.infer<typeof isIframeSuccessMessagePortEvent>;
|
|
352
|
+
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.
|
|
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
|
|
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,21 @@
|
|
|
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
|
+
private _userJoinedSubscriber;
|
|
12
|
+
private _userLeftSubscriber;
|
|
13
|
+
private left;
|
|
14
|
+
constructor(port: CheckedIframeMessagePort<"joinSpace">);
|
|
15
|
+
private createReactiveUser;
|
|
16
|
+
private watch;
|
|
17
|
+
private unwatch;
|
|
18
|
+
leave(): void;
|
|
19
|
+
startStreaming(): void;
|
|
20
|
+
stopStreaming(): void;
|
|
21
|
+
}
|
|
@@ -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;
|
package/play/src/iframe_api.d.ts
CHANGED
|
@@ -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;
|